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 16KB

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