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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  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. }
  199. }
  200. /**
  201. * Outputs the styles for a date field variant button element.
  202. *
  203. * @param {size} $unit-size ($v-unit-size) - The sizing of the button, which corresponds its width.
  204. * @param {list} $bevel ($v-textfield-bevel) - Box-shadow value according to $v-bevel documentation
  205. * @param {color} $background-color ($v-textfield-background-color) - The background color of the input, which affects the font color of the button
  206. * @param {size} $border-radius ($v-textfield-border-radius) - The border-radius of the input, which affects the border-radius of the button
  207. * @param {list} $border ($v-textfield-border) - The border of the input, which affects the border of the button
  208. *
  209. * @group datefield
  210. */
  211. @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) {
  212. $border-width: first-number($border) or 0;
  213. @include valo-tappable;
  214. -webkit-appearance: none;
  215. background: transparent;
  216. padding: 0;
  217. position: absolute;
  218. z-index: 10;
  219. width: $unit-size;
  220. line-height: $unit-size - ($border-width*2);
  221. text-align: center;
  222. font: inherit;
  223. outline: none;
  224. margin: 0;
  225. @if $border and $border != none {
  226. top: $border-width;
  227. bottom: $border-width;
  228. left: $border-width;
  229. }
  230. @if $border {
  231. border: none;
  232. }
  233. @if type-of($background-color) == color {
  234. @if $border {
  235. border-right: valo-border($color: $background-color, $border: $v-textfield-border, $strength: 0.5);
  236. }
  237. color: mix($background-color, valo-font-color($background-color));
  238. &:hover {
  239. color: valo-font-color($background-color);
  240. }
  241. }
  242. @if $border-radius > 0 {
  243. $br: max(0, $border-radius - $border-width);
  244. border-radius: $br 0 0 $br;
  245. }
  246. &:before {
  247. @include valo-datefield-button-icon-style;
  248. @if $v-animations-enabled {
  249. @include transition(color 140ms);
  250. }
  251. }
  252. &:active:after {
  253. content: "";
  254. position: absolute;
  255. top: 0;
  256. right: 0;
  257. bottom: 0;
  258. left: 0;
  259. @if type-of($background-color) == color {
  260. @include valo-button-active-style($background-color);
  261. }
  262. border-radius: inherit;
  263. }
  264. }
  265. /**
  266. * Outputs the font icon styles for the date field drop down button.
  267. *
  268. * @group datefield
  269. */
  270. @mixin valo-datefield-button-icon-style {
  271. font-family: ThemeIcons;
  272. content: "\f073";
  273. }
  274. /**
  275. * Outputs the styles for a date field popup.
  276. *
  277. * @group datefield
  278. */
  279. @mixin valo-datefield-popup-style {
  280. @include valo-overlay-style;
  281. margin-top: ceil($v-unit-size/8) !important;
  282. margin-bottom: ceil($v-unit-size/8) !important;
  283. margin-right: ceil($v-unit-size/8) !important;
  284. cursor: default;
  285. width: auto;
  286. table {
  287. border-collapse: collapse;
  288. border-spacing: 0;
  289. margin: 0 auto;
  290. }
  291. td {
  292. padding: round($v-unit-size/20);
  293. }
  294. @include valo-datefield-calendarpanel-style;
  295. }
  296. /**
  297. * Outputs the styles for calendar panel (i.e. month view).
  298. *
  299. * @param {string} $primary-stylename (v-datefield-calendarpanel) - the primary style name for the selectors
  300. *
  301. * @group datefield
  302. */
  303. @mixin valo-datefield-calendarpanel-style ($primary-stylename: v-datefield-calendarpanel) {
  304. .#{$primary-stylename} {
  305. font-size: $v-font-size;
  306. text-align: center;
  307. &:focus {
  308. outline: none;
  309. }
  310. }
  311. .#{$primary-stylename}-day {
  312. @include valo-datefield-calendarpanel-day-style;
  313. display: inline-block;
  314. box-sizing: border-box;
  315. cursor: pointer;
  316. &:hover {
  317. @include valo-datefield-calendarpanel-day-hover-style;
  318. }
  319. }
  320. .#{$primary-stylename}-day-offmonth {
  321. @include valo-datefield-calendarpanel-day-offmonth-style;
  322. }
  323. .#{$primary-stylename}-day-today {
  324. @include valo-datefield-calendarpanel-day-today-style;
  325. }
  326. .#{$primary-stylename}-day.#{$primary-stylename}-day-selected,
  327. .#{$primary-stylename}-day.#{$primary-stylename}-day-selected:hover {
  328. @include valo-datefield-calendarpanel-day-selected-style
  329. }
  330. .#{$primary-stylename}-day.#{$primary-stylename}-day-focused {
  331. @include valo-datefield-calendarpanel-day-focused-style;
  332. }
  333. .#{$primary-stylename}-day.#{$primary-stylename}-day-outside-range,
  334. .#{$primary-stylename}-day.#{$primary-stylename}-day-outside-range:hover {
  335. @include valo-datefield-calendarpanel-outside-range-style;
  336. }
  337. .#{$primary-stylename}-weekdays {
  338. height: round($v-unit-size * 0.7);
  339. color: mix(valo-font-color($v-background-color), rgba($v-background-color, .7));
  340. strong {
  341. font: inherit;
  342. font-size: ceil($v-font-size * 0.86);
  343. }
  344. }
  345. .#{$primary-stylename}-header {
  346. white-space: nowrap;
  347. }
  348. td[class*="year"],
  349. td[class*="month"] {
  350. button {
  351. @include appearance(none);
  352. border: none;
  353. background: transparent;
  354. padding: 0;
  355. margin: 0;
  356. cursor: pointer;
  357. color: transparent;
  358. font-size: 0; // For IE8, where transparent text is not possible
  359. width: round($v-unit-size * 0.5);
  360. height: round($v-unit-size * 0.67);
  361. outline: none;
  362. position: relative;
  363. vertical-align: middle;
  364. &:before {
  365. color: mix($v-background-color, valo-font-color($v-background-color));
  366. font-size: round($v-font-size * 1.3);
  367. line-height: round($v-font-size * 1.5);
  368. @if $v-animations-enabled {
  369. @include transition(color 200ms);
  370. }
  371. }
  372. &:hover:before {
  373. color: $v-focus-color;
  374. }
  375. &.outside-range {
  376. cursor: default;
  377. @include opacity(.3);
  378. &:hover:before {
  379. color: mix($v-background-color, valo-font-color($v-background-color));
  380. }
  381. }
  382. }
  383. }
  384. .v-button-prevyear:before {
  385. @include valo-datefield-calendarpanel-prevyear-icon-style;
  386. }
  387. .v-button-prevmonth:before {
  388. @include valo-datefield-calendarpanel-prevmonth-icon-style;
  389. }
  390. .v-button-nextyear:before {
  391. @include valo-datefield-calendarpanel-nextyear-icon-style;
  392. }
  393. .v-button-nextmonth:before {
  394. @include valo-datefield-calendarpanel-nextmonth-icon-style;
  395. }
  396. td.#{$primary-stylename}-month {
  397. width: round($v-unit-size * 4);
  398. cursor:default;
  399. @include valo-datefield-calendarpanel-month-style;
  400. }
  401. td.#{$primary-stylename}-month.header-month-year{
  402. cursor:pointer;
  403. }
  404. .#{$primary-stylename}-year td.#{$primary-stylename}-month {
  405. width: round($v-unit-size * 2);
  406. }
  407. .#{$primary-stylename}-weeknumber,
  408. .#{$primary-stylename}-weekdays.#{$primary-stylename}-weeknumbers td:first-child {
  409. width: round($v-unit-size * 0.8);
  410. color: mix(valo-font-color($v-background-color), rgba($v-background-color, .7));
  411. font-size: ceil($v-font-size * 0.86);
  412. display: inline-block;
  413. text-align: left;
  414. }
  415. .#{$primary-stylename}-weeknumber {
  416. position: relative;
  417. }
  418. .#{$primary-stylename}-weeknumbers .v-first:before {
  419. content: "";
  420. position: absolute;
  421. top: round($v-unit-size * 0.7) + round($v-unit-size/10)*2 + $v-overlay-padding-vertical;
  422. bottom: 0;
  423. left: 0;
  424. width: round($v-unit-size * 0.7) + $v-overlay-padding-horizontal*2;
  425. border-top: valo-border($color: $v-app-background-color, $strength: 0.3);
  426. border-right: valo-border($color: $v-app-background-color, $strength: 0.3);
  427. border-top-right-radius: $v-border-radius;
  428. border-bottom-left-radius: $v-border-radius;
  429. background: $v-app-background-color;
  430. }
  431. td.#{$primary-stylename}-time {
  432. width: 100%;
  433. font-size: ceil($v-font-size * 0.86);
  434. .v-label {
  435. display: inline;
  436. margin: 0 0.1em;
  437. font-weight: 400;
  438. }
  439. }
  440. }
  441. /**
  442. * Outputs the styles for an individual day element in a calendar panel.
  443. *
  444. * @group datefield
  445. */
  446. @mixin valo-datefield-calendarpanel-day-style {
  447. box-sizing: border-box;
  448. width: round($v-unit-size * 0.8);
  449. height: round($v-unit-size * 0.7);
  450. border: first-number(valo-border()) solid transparent;
  451. line-height: round($v-unit-size * 0.7);
  452. text-align: center;
  453. font-size: ceil($v-font-size * 0.86);
  454. background: $v-background-color;
  455. @if $v-border-radius > 0 {
  456. border-radius: ceil($v-border-radius/2);
  457. }
  458. @if $v-animations-enabled {
  459. @include transition(color 200ms);
  460. }
  461. }
  462. /**
  463. * Outputs the hover state styles for an individual day element in a calendar panel.
  464. *
  465. * @group datefield
  466. */
  467. @mixin valo-datefield-calendarpanel-day-hover-style {
  468. color: $v-selection-color;
  469. }
  470. /**
  471. * Outputs the styles for an individual day element, which are not part of the current month, in a calendar panel.
  472. *
  473. * @group datefield
  474. */
  475. @mixin valo-datefield-calendarpanel-day-offmonth-style {
  476. color: mix(valo-font-color($v-background-color), $v-background-color);
  477. background: transparent;
  478. }
  479. /**
  480. * Outputs the styles for an individual day element, which are outside available range.
  481. *
  482. * @group datefield
  483. */
  484. @mixin valo-datefield-calendarpanel-outside-range-style {
  485. color: mix(valo-font-color($v-background-color), $v-background-color);
  486. cursor: not-allowed;
  487. }
  488. /**
  489. * Outputs the styles for todays day element in a calendar panel.
  490. *
  491. * @group datefield
  492. */
  493. @mixin valo-datefield-calendarpanel-day-today-style {
  494. color: valo-font-color($v-background-color, 0.9);
  495. font-weight: max(600, $v-font-weight + 100);
  496. border-color: valo-font-color($v-background-color, 0.3);
  497. }
  498. /**
  499. * Outputs the styles for the selected day element in a calendar panel.
  500. *
  501. * @group datefield
  502. */
  503. @mixin valo-datefield-calendarpanel-day-selected-style {
  504. color: valo-font-color($v-selection-color);
  505. @include valo-gradient($v-selection-color);
  506. border: none;
  507. font-weight: max(600, $v-font-weight + 100);
  508. }
  509. /**
  510. * Outputs the focus state styles for an individual day element in a calendar panel.
  511. *
  512. * @group datefield
  513. */
  514. @mixin valo-datefield-calendarpanel-day-focused-style {
  515. @include valo-focus-style;
  516. position: relative; // Show above other cells
  517. }
  518. /**
  519. * Outputs the font icon styles for the next month button in a calendar panel.
  520. *
  521. * @group datefield
  522. */
  523. @mixin valo-datefield-calendarpanel-nextmonth-icon-style {
  524. font-family: ThemeIcons;
  525. content: "\f105";
  526. }
  527. /**
  528. * Outputs the font icon styles for the previous month button in a calendar panel.
  529. *
  530. * @group datefield
  531. */
  532. @mixin valo-datefield-calendarpanel-prevmonth-icon-style {
  533. font-family: ThemeIcons;
  534. content: "\f104";
  535. }
  536. /**
  537. * Outputs the font icon styles for the next year button in a calendar panel.
  538. *
  539. * @group datefield
  540. */
  541. @mixin valo-datefield-calendarpanel-nextyear-icon-style {
  542. font-family: ThemeIcons;
  543. content: "\f101";
  544. }
  545. /**
  546. * Outputs the font icon styles for the previous year button in a calendar panel.
  547. *
  548. * @group datefield
  549. */
  550. @mixin valo-datefield-calendarpanel-prevyear-icon-style {
  551. font-family: ThemeIcons;
  552. content: "\f100";
  553. }
  554. /**
  555. * Outputs the styles for the current month and year title element in a calendar panel.
  556. *
  557. * @group datefield
  558. */
  559. @mixin valo-datefield-calendarpanel-month-style {
  560. color: $v-selection-color;
  561. }