You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_datefield.scss 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. /**
  2. * Outputs the selectors and properties for the DateField component.
  3. *
  4. * @param {string} $primary-stylename (v-datefield) - the primary style name for the selectors
  5. * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component
  6. *
  7. * @group datefield
  8. */
  9. @mixin valo-datefield ($primary-stylename: v-datefield, $include-additional-styles: contains($v-included-additional-styles, datefield)) {
  10. .#{$primary-stylename} {
  11. position: relative;
  12. width: $v-default-field-width;
  13. @include valo-datefield-style;
  14. }
  15. .#{$primary-stylename}-error {
  16. .#{$primary-stylename}-textfield {
  17. @include valo-textfield-error-style;
  18. }
  19. .#{$primary-stylename}-button {
  20. color: $v-error-indicator-color;
  21. border-color: $v-error-indicator-color;
  22. }
  23. }
  24. .#{$primary-stylename}-error-info {
  25. .#{$primary-stylename}-textfield {
  26. @include valo-textfield-error-level-info-style;
  27. }
  28. .#{$primary-stylename}-button {
  29. color: $v-error-indicator-level-info-color;
  30. border-color: $v-error-indicator-level-info-color;
  31. }
  32. }
  33. .#{$primary-stylename}-error-warning {
  34. .#{$primary-stylename}-textfield {
  35. @include valo-textfield-error-level-warning-style;
  36. }
  37. .#{$primary-stylename}-button {
  38. color: $v-error-indicator-level-warning-color;
  39. border-color: $v-error-indicator-level-warning-color;
  40. }
  41. }
  42. .#{$primary-stylename}-error-error {
  43. .#{$primary-stylename}-textfield {
  44. @include valo-textfield-error-level-error-style;
  45. }
  46. .#{$primary-stylename}-button {
  47. color: $v-error-indicator-level-error-color;
  48. border-color: $v-error-indicator-level-error-color;
  49. }
  50. }
  51. .#{$primary-stylename}-error-critical {
  52. .#{$primary-stylename}-textfield {
  53. @include valo-textfield-error-level-critical-style;
  54. }
  55. .#{$primary-stylename}-button {
  56. color: $v-error-indicator-level-critical-color;
  57. border-color: $v-error-indicator-level-critical-color;
  58. }
  59. }
  60. .#{$primary-stylename}-error-system {
  61. .#{$primary-stylename}-textfield {
  62. @include valo-textfield-error-level-system-style;
  63. }
  64. .#{$primary-stylename}-button {
  65. color: $v-error-indicator-level-system-color;
  66. border-color: $v-error-indicator-level-system-color;
  67. }
  68. }
  69. // Different widths for different resolutions
  70. .#{$primary-stylename}-full {
  71. width: round($v-font-size * 15);
  72. }
  73. .#{$primary-stylename}-day {
  74. width: $v-default-field-width;
  75. }
  76. .#{$primary-stylename}-month {
  77. width: round($v-font-size * 7.5);
  78. }
  79. .#{$primary-stylename}-year {
  80. width: round($v-font-size * 6.5);
  81. }
  82. .#{$primary-stylename}-popup {
  83. @include valo-datefield-popup-style;
  84. }
  85. @include valo-datefield-calendarpanel-style;
  86. @if $include-additional-styles {
  87. .#{$primary-stylename}-borderless {
  88. .#{$primary-stylename}-textfield {
  89. @include valo-textfield-borderless-style;
  90. }
  91. .#{$primary-stylename}-button {
  92. border: none;
  93. color: inherit;
  94. @include opacity(.5);
  95. }
  96. }
  97. .#{$primary-stylename}-align-right input {
  98. text-align: right;
  99. }
  100. .#{$primary-stylename}-align-center input {
  101. text-align: center;
  102. }
  103. .#{$primary-stylename}-tiny {
  104. @include valo-datefield-style($unit-size: $v-unit-size--tiny, $bevel: null, $shadow: null, $border: null, $background-color: null, $states: normal);
  105. font-size: $v-font-size--tiny;
  106. }
  107. .#{$primary-stylename}-compact,
  108. .#{$primary-stylename}-small {
  109. @include valo-datefield-style($unit-size: $v-unit-size--small, $bevel: null, $shadow: null, $border: null, $background-color: null, $states: normal);
  110. }
  111. .#{$primary-stylename}-small {
  112. font-size: $v-font-size--small;
  113. }
  114. .#{$primary-stylename}-large {
  115. @include valo-datefield-style($unit-size: $v-unit-size--large, $bevel: null, $shadow: null, $border: null, $background-color: null, $states: normal);
  116. font-size: $v-font-size--large;
  117. }
  118. .#{$primary-stylename}-huge {
  119. @include valo-datefield-style($unit-size: $v-unit-size--huge, $bevel: null, $shadow: null, $border: null, $background-color: null, $states: normal);
  120. font-size: $v-font-size--huge;
  121. }
  122. }
  123. }
  124. /**
  125. * Outputs the selectors and properties for the InlineDateField component.
  126. *
  127. * @param {string} $primary-stylename (v-inline-datefield) - the primary style name for the selectors
  128. *
  129. * @group datefield
  130. */
  131. @mixin valo-inline-datefield ($primary-stylename: v-inline-datefield) {
  132. @include valo-datefield-calendarpanel-style(#{$primary-stylename}-calendarpanel);
  133. .#{$primary-stylename}-calendarpanel {
  134. position: relative;
  135. background: $v-overlay-background-color;
  136. padding: round($v-unit-size/6);
  137. }
  138. }
  139. /**
  140. * Outputs the styles for a date field variant.
  141. *
  142. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  143. * @param {list} $shadow ($v-textfield-shadow) - Box-shadow value according to $v-shadow documentation
  144. * @param {size} $unit-size ($v-unit-size) - The sizing of the datefield, which corresponds its height
  145. * @param {list} $border ($v-textfield-border) - The border of the datefield
  146. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the datefield
  147. * @param {color} $background-color ($v-textfield-background-color) - The background color of the datefield
  148. * @param {list} $states (normal focus disabled) - The datefield states for which to output corresponding styles
  149. *
  150. * @group datefield
  151. */
  152. @mixin valo-datefield-style (
  153. $bevel : $v-textfield-bevel,
  154. $shadow : $v-textfield-shadow,
  155. $unit-size : $v-unit-size,
  156. $border : $v-textfield-border,
  157. $border-radius : $v-textfield-border-radius,
  158. $background-color : $v-textfield-background-color,
  159. $states : normal focus disabled
  160. ) {
  161. height: $unit-size;
  162. border-radius: $border-radius;
  163. [class*="textfield"] {
  164. box-sizing: border-box;
  165. @include valo-textfield-style($bevel: $bevel, $shadow: $shadow, $unit-size: $unit-size, $border: $border, $border-radius: $border-radius, $background-color: $background-color, $states: $states) ;
  166. padding-left: $unit-size * 1.2;
  167. width: 100%;
  168. height: 100%;
  169. border-radius: inherit;
  170. }
  171. &[class*="prompt"] > [class*="textfield"] {
  172. @include valo-textfield-prompt-style($background-color);
  173. }
  174. [class*="button"] {
  175. @include valo-datefield-button-style($unit-size: $unit-size, $bevel: $bevel, $background-color: $background-color, $border-radius: $border-radius, $border: $border);
  176. }
  177. &.v-disabled {
  178. @include opacity($v-disabled-opacity);
  179. [class*="button"] {
  180. cursor: default;
  181. pointer-events: none;
  182. &:active:after {
  183. display: none;
  184. }
  185. }
  186. }
  187. &.v-readonly {
  188. [class*="textfield"] {
  189. @include valo-textfield-readonly-style;
  190. }
  191. [class*="button"] {
  192. cursor: default;
  193. pointer-events: none;
  194. &:active:after {
  195. display: none;
  196. }
  197. }
  198. &.borderless {
  199. [class*="textfield"] {
  200. @include valo-textfield-borderless-style;
  201. }
  202. }
  203. }
  204. }
  205. /**
  206. * Outputs the styles for a date field variant button element.
  207. *
  208. * @param {size} $unit-size ($v-unit-size) - The sizing of the button, which corresponds its width.
  209. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  210. * @param {color} $background-color ($v-textfield-background-color) - The background color of the input, which affects the font color of the button
  211. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the input, which affects the border-radius of the button
  212. * @param {list} $border ($v-textfield-border) - The border of the input, which affects the border of the button
  213. *
  214. * @group datefield
  215. */
  216. @mixin valo-datefield-button-style ($unit-size: $v-unit-size, $bevel: $v-bevel, $background-color: $v-textfield-background-color, $border-radius: $v-border-radius, $border: $v-textfield-border) {
  217. $border-width: first-number($border) or 0;
  218. @include valo-tappable;
  219. -webkit-appearance: none;
  220. background: transparent;
  221. padding: 0;
  222. position: absolute;
  223. z-index: 10;
  224. width: $unit-size;
  225. line-height: $unit-size - ($border-width*2);
  226. text-align: center;
  227. font: inherit;
  228. outline: none;
  229. margin: 0;
  230. @if $border and $border != none {
  231. top: $border-width;
  232. bottom: $border-width;
  233. left: $border-width;
  234. }
  235. @if $border {
  236. border: none;
  237. }
  238. @if type-of($background-color) == color {
  239. @if $border {
  240. border-right: valo-border($color: $background-color, $border: $v-textfield-border, $strength: 0.5);
  241. }
  242. color: mix($background-color, valo-font-color($background-color));
  243. &:hover {
  244. color: valo-font-color($background-color);
  245. }
  246. }
  247. @if $border-radius > 0 {
  248. $br: max(0, $border-radius - $border-width);
  249. border-radius: $br 0 0 $br;
  250. }
  251. &:before {
  252. @include valo-datefield-button-icon-style;
  253. @if $v-animations-enabled {
  254. @include transition(color 140ms);
  255. }
  256. }
  257. &:active:after {
  258. content: "";
  259. position: absolute;
  260. top: 0;
  261. right: 0;
  262. bottom: 0;
  263. left: 0;
  264. @if type-of($background-color) == color {
  265. @include valo-button-active-style($background-color);
  266. }
  267. border-radius: inherit;
  268. }
  269. }
  270. /**
  271. * Outputs the font icon styles for the date field drop down button.
  272. *
  273. * @group datefield
  274. */
  275. @mixin valo-datefield-button-icon-style {
  276. font-family: ThemeIcons;
  277. content: "\f073";
  278. }
  279. /**
  280. * Outputs the styles for a date field popup.
  281. *
  282. * @group datefield
  283. */
  284. @mixin valo-datefield-popup-style {
  285. @include valo-overlay-style;
  286. margin-top: ceil($v-unit-size/8) !important;
  287. margin-bottom: ceil($v-unit-size/8) !important;
  288. margin-right: ceil($v-unit-size/8) !important;
  289. cursor: default;
  290. width: auto;
  291. table {
  292. border-collapse: collapse;
  293. border-spacing: 0;
  294. margin: 0 auto;
  295. }
  296. td {
  297. padding: round($v-unit-size/20);
  298. }
  299. @include valo-datefield-calendarpanel-style;
  300. }
  301. /**
  302. * Outputs the styles for calendar panel (i.e. month view).
  303. *
  304. * @param {string} $primary-stylename (v-datefield-calendarpanel) - the primary style name for the selectors
  305. *
  306. * @group datefield
  307. */
  308. @mixin valo-datefield-calendarpanel-style ($primary-stylename: v-datefield-calendarpanel) {
  309. .#{$primary-stylename} {
  310. font-size: $v-font-size;
  311. text-align: center;
  312. &:focus {
  313. outline: none;
  314. }
  315. }
  316. .#{$primary-stylename}-day {
  317. @include valo-datefield-calendarpanel-day-style;
  318. display: inline-block;
  319. box-sizing: border-box;
  320. cursor: pointer;
  321. &:hover {
  322. @include valo-datefield-calendarpanel-day-hover-style;
  323. }
  324. }
  325. .#{$primary-stylename}-day-offmonth {
  326. @include valo-datefield-calendarpanel-day-offmonth-style;
  327. }
  328. .#{$primary-stylename}-day-today {
  329. @include valo-datefield-calendarpanel-day-today-style;
  330. }
  331. .#{$primary-stylename}-day.#{$primary-stylename}-day-selected,
  332. .#{$primary-stylename}-day.#{$primary-stylename}-day-selected:hover {
  333. @include valo-datefield-calendarpanel-day-selected-style
  334. }
  335. .#{$primary-stylename}-day.#{$primary-stylename}-day-focused {
  336. @include valo-datefield-calendarpanel-day-focused-style;
  337. }
  338. .#{$primary-stylename}-day.#{$primary-stylename}-day-outside-range,
  339. .#{$primary-stylename}-day.#{$primary-stylename}-day-outside-range:hover {
  340. @include valo-datefield-calendarpanel-outside-range-style;
  341. }
  342. .#{$primary-stylename}-weekdays {
  343. height: round($v-unit-size * 0.7);
  344. color: mix(valo-font-color($v-background-color), rgba($v-background-color, .7));
  345. strong {
  346. font: inherit;
  347. font-size: ceil($v-font-size * 0.86);
  348. }
  349. }
  350. .#{$primary-stylename}-header {
  351. white-space: nowrap;
  352. }
  353. td[class*="year"],
  354. td[class*="month"] {
  355. button {
  356. @include appearance(none);
  357. border: none;
  358. background: transparent;
  359. padding: 0;
  360. margin: 0;
  361. cursor: pointer;
  362. color: transparent;
  363. font-size: 0; // For IE8, where transparent text is not possible
  364. width: round($v-unit-size * 0.5);
  365. height: round($v-unit-size * 0.67);
  366. outline: none;
  367. position: relative;
  368. vertical-align: middle;
  369. &:before {
  370. color: mix($v-background-color, valo-font-color($v-background-color));
  371. font-size: round($v-font-size * 1.3);
  372. line-height: round($v-font-size * 1.5);
  373. @if $v-animations-enabled {
  374. @include transition(color 200ms);
  375. }
  376. }
  377. &:hover:before {
  378. color: $v-focus-color;
  379. }
  380. &.outside-range {
  381. cursor: default;
  382. @include opacity(.3);
  383. &:hover:before {
  384. color: mix($v-background-color, valo-font-color($v-background-color));
  385. }
  386. }
  387. }
  388. }
  389. .v-button-prevyear:before {
  390. @include valo-datefield-calendarpanel-prevyear-icon-style;
  391. }
  392. .v-button-prevmonth:before {
  393. @include valo-datefield-calendarpanel-prevmonth-icon-style;
  394. }
  395. .v-button-nextyear:before {
  396. @include valo-datefield-calendarpanel-nextyear-icon-style;
  397. }
  398. .v-button-nextmonth:before {
  399. @include valo-datefield-calendarpanel-nextmonth-icon-style;
  400. }
  401. td.#{$primary-stylename}-month {
  402. width: round($v-unit-size * 4);
  403. cursor:default;
  404. @include valo-datefield-calendarpanel-month-style;
  405. }
  406. td.#{$primary-stylename}-month.header-month-year{
  407. cursor:pointer;
  408. }
  409. .#{$primary-stylename}-year td.#{$primary-stylename}-month {
  410. width: round($v-unit-size * 2);
  411. }
  412. .#{$primary-stylename}-weeknumber,
  413. .#{$primary-stylename}-weekdays.#{$primary-stylename}-weeknumbers td:first-child {
  414. width: round($v-unit-size * 0.8);
  415. color: mix(valo-font-color($v-background-color), rgba($v-background-color, .7));
  416. font-size: ceil($v-font-size * 0.86);
  417. display: inline-block;
  418. text-align: left;
  419. }
  420. .#{$primary-stylename}-weeknumber {
  421. position: relative;
  422. }
  423. .#{$primary-stylename}-weeknumbers .v-first:before {
  424. content: "";
  425. position: absolute;
  426. top: round($v-unit-size * 0.7) + round($v-unit-size/10)*2 + $v-overlay-padding-vertical;
  427. bottom: 0;
  428. left: 0;
  429. width: round($v-unit-size * 0.7) + $v-overlay-padding-horizontal*2;
  430. border-top: valo-border($color: $v-app-background-color, $strength: 0.3);
  431. border-right: valo-border($color: $v-app-background-color, $strength: 0.3);
  432. border-top-right-radius: $v-border-radius;
  433. border-bottom-left-radius: $v-border-radius;
  434. background: $v-app-background-color;
  435. }
  436. td.#{$primary-stylename}-time {
  437. width: 100%;
  438. font-size: ceil($v-font-size * 0.86);
  439. .v-label {
  440. display: inline;
  441. margin: 0 0.1em;
  442. font-weight: 400;
  443. }
  444. }
  445. }
  446. /**
  447. * Outputs the styles for an individual day element in a calendar panel.
  448. *
  449. * @group datefield
  450. */
  451. @mixin valo-datefield-calendarpanel-day-style {
  452. box-sizing: border-box;
  453. width: round($v-unit-size * 0.8);
  454. height: round($v-unit-size * 0.7);
  455. border: first-number(valo-border()) solid transparent;
  456. line-height: round($v-unit-size * 0.7);
  457. text-align: center;
  458. font-size: ceil($v-font-size * 0.86);
  459. background: $v-background-color;
  460. @if $v-border-radius > 0 {
  461. border-radius: ceil($v-border-radius/2);
  462. }
  463. @if $v-animations-enabled {
  464. @include transition(color 200ms);
  465. }
  466. }
  467. /**
  468. * Outputs the hover state styles for an individual day element in a calendar panel.
  469. *
  470. * @group datefield
  471. */
  472. @mixin valo-datefield-calendarpanel-day-hover-style {
  473. color: $v-selection-color;
  474. }
  475. /**
  476. * Outputs the styles for an individual day element, which are not part of the current month, in a calendar panel.
  477. *
  478. * @group datefield
  479. */
  480. @mixin valo-datefield-calendarpanel-day-offmonth-style {
  481. color: mix(valo-font-color($v-background-color), $v-background-color);
  482. background: transparent;
  483. }
  484. /**
  485. * Outputs the styles for an individual day element, which are outside available range.
  486. *
  487. * @group datefield
  488. */
  489. @mixin valo-datefield-calendarpanel-outside-range-style {
  490. color: mix(valo-font-color($v-background-color), $v-background-color);
  491. cursor: not-allowed;
  492. }
  493. /**
  494. * Outputs the styles for todays day element in a calendar panel.
  495. *
  496. * @group datefield
  497. */
  498. @mixin valo-datefield-calendarpanel-day-today-style {
  499. color: valo-font-color($v-background-color, 0.9);
  500. font-weight: max(600, $v-font-weight + 100);
  501. border-color: valo-font-color($v-background-color, 0.3);
  502. }
  503. /**
  504. * Outputs the styles for the selected day element in a calendar panel.
  505. *
  506. * @group datefield
  507. */
  508. @mixin valo-datefield-calendarpanel-day-selected-style {
  509. color: valo-font-color($v-selection-color);
  510. @include valo-gradient($v-selection-color);
  511. border: none;
  512. font-weight: max(600, $v-font-weight + 100);
  513. }
  514. /**
  515. * Outputs the focus state styles for an individual day element in a calendar panel.
  516. *
  517. * @group datefield
  518. */
  519. @mixin valo-datefield-calendarpanel-day-focused-style {
  520. @include valo-focus-style;
  521. position: relative; // Show above other cells
  522. }
  523. /**
  524. * Outputs the font icon styles for the next month button in a calendar panel.
  525. *
  526. * @group datefield
  527. */
  528. @mixin valo-datefield-calendarpanel-nextmonth-icon-style {
  529. font-family: ThemeIcons;
  530. content: "\f105";
  531. }
  532. /**
  533. * Outputs the font icon styles for the previous month button in a calendar panel.
  534. *
  535. * @group datefield
  536. */
  537. @mixin valo-datefield-calendarpanel-prevmonth-icon-style {
  538. font-family: ThemeIcons;
  539. content: "\f104";
  540. }
  541. /**
  542. * Outputs the font icon styles for the next year button in a calendar panel.
  543. *
  544. * @group datefield
  545. */
  546. @mixin valo-datefield-calendarpanel-nextyear-icon-style {
  547. font-family: ThemeIcons;
  548. content: "\f101";
  549. }
  550. /**
  551. * Outputs the font icon styles for the previous year button in a calendar panel.
  552. *
  553. * @group datefield
  554. */
  555. @mixin valo-datefield-calendarpanel-prevyear-icon-style {
  556. font-family: ThemeIcons;
  557. content: "\f100";
  558. }
  559. /**
  560. * Outputs the styles for the current month and year title element in a calendar panel.
  561. *
  562. * @group datefield
  563. */
  564. @mixin valo-datefield-calendarpanel-month-style {
  565. color: $v-selection-color;
  566. }