Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

flatpickr.scss 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. @import "../../scss/_bootstrap-extended/include";
  2. @import "../../scss/_components/include";
  3. $flatpickr-time-picker-height: 40px !default;
  4. /* set position to open flat picker calendar */
  5. .flatpickr-wrapper{
  6. position: relative;
  7. }
  8. /* Animations */
  9. @mixin keyframes($name) {
  10. @keyframes #{$name} {
  11. @content;
  12. }
  13. @keyframes #{$name} {
  14. @content;
  15. }
  16. @keyframes #{$name} {
  17. @content;
  18. }
  19. }
  20. @include keyframes(fpFadeInDown) {
  21. from {
  22. opacity: 0;
  23. transform: translate3d(0, -20px, 0);
  24. }
  25. to {
  26. opacity: 1;
  27. transform: translate3d(0, 0, 0);
  28. }
  29. }
  30. .flatpickr-calendar {
  31. position: absolute;
  32. overflow: hidden;
  33. box-sizing: border-box;
  34. padding: $picker-padding;
  35. animation: none;
  36. background: $picker-bg;
  37. box-shadow: $picker-box-shadow;
  38. font-size: $font-size-base;
  39. inline-size: $picker-width;
  40. opacity: 0;
  41. text-align: center;
  42. visibility: hidden;
  43. @include border-radius($picker-border-radius);
  44. &.open,
  45. &.inline {
  46. opacity: 1;
  47. visibility: visible;
  48. }
  49. &.open {
  50. z-index: $picker-zindex;
  51. }
  52. &.animate.open {
  53. animation: fpFadeInDown 300ms cubic-bezier(.23, 1, .32, 1);
  54. }
  55. &:not(.inline, .open) {
  56. display: none;
  57. }
  58. &.inline {
  59. position: relative;
  60. inset-block-start: 2px;
  61. }
  62. /* below style required important to override default flatpickr element styles */
  63. &.hasWeeks {
  64. inline-size: $picker-width + $picker-cell-size !important;
  65. }
  66. &.hasTime .flatpickr-weeks {
  67. border-block-end: 0;
  68. border-end-end-radius: 0;
  69. border-end-start-radius: 0;
  70. margin-block-start: 1.125rem;
  71. }
  72. /* if hasTime with calendar */
  73. &.hasTime {
  74. padding-block-end: 0;
  75. .flatpickr-time {
  76. block-size: $flatpickr-time-picker-height;
  77. }
  78. &:not(.noCalendar) {
  79. border-block-start: $picker-timer-border-width solid $picker-timer-border-color;
  80. }
  81. }
  82. &.noCalendar.hasTime {
  83. padding: 0;
  84. }
  85. /* To update arrows in number input of time picker */
  86. input[type="number"]::-webkit-inner-spin-button,
  87. input[type="number"]::-webkit-outer-spin-button {
  88. margin: 0;
  89. appearance: none;
  90. }
  91. /* flat picker month list */
  92. .flatpickr-month {
  93. position: relative;
  94. overflow: hidden;
  95. background: $picker-bg;
  96. block-size: $picker-cell-size + .0375rem;
  97. line-height: 1;
  98. text-align: center;
  99. user-select: none;
  100. }
  101. .flatpickr-prev-month,
  102. .flatpickr-next-month {
  103. position: absolute;
  104. z-index: 3;
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. background-color: $picker-arrow-bg;
  109. block-size: $picker-arrow-wrapper-size;
  110. cursor: pointer;
  111. inline-size: $picker-arrow-wrapper-size;
  112. inset-block-start: .75rem;
  113. line-height: $picker-arrow-wrapper-size;
  114. padding-block: 0;
  115. padding-inline: .41rem;
  116. text-decoration: none;
  117. @include border-radius($picker-cell-border-radius);
  118. svg {
  119. fill: $picker-arrow-color;
  120. inline-size: calc($picker-arrow-size + .15rem);
  121. stroke: $picker-arrow-color;
  122. stroke-width: 2;
  123. vertical-align: middle;
  124. }
  125. :dir(rtl) &{
  126. transform: scaleX(-1);
  127. }
  128. }
  129. .flatpickr-prev-month i,
  130. .flatpickr-next-month i {
  131. position: relative;
  132. }
  133. .flatpickr-prev-month {
  134. &.flatpickr-prev-month {
  135. inset-inline-start: 1rem;
  136. }
  137. }
  138. .flatpickr-next-month {
  139. &.flatpickr-prev-month {
  140. inset-inline: 0;
  141. }
  142. &.flatpickr-next-month {
  143. inset-inline-end: 1rem;
  144. }
  145. }
  146. .flatpickr-prev-month:hover,
  147. .flatpickr-next-month:hover {
  148. opacity: 1;
  149. }
  150. .flatpickr-prev-month svg path,
  151. .flatpickr-next-month svg path {
  152. fill: inherit;
  153. @include transition(fill .1s);
  154. }
  155. /* flat picker input styles */
  156. .numInputWrapper {
  157. position: relative;
  158. block-size: auto;
  159. input,
  160. span {
  161. display: inline-block;
  162. }
  163. input {
  164. inline-size: 100%;
  165. }
  166. span {
  167. position: absolute;
  168. inset-inline-end: 4px;
  169. opacity: 0;
  170. &:hover {
  171. background: rgb(0 0 0 / 10%);
  172. }
  173. &:active {
  174. background: rgb(0 0 0 / 20%);
  175. }
  176. &::after {
  177. display: block;
  178. block-size: 0;
  179. content: "";
  180. inline-size: 0;
  181. }
  182. &.arrowUp {
  183. inset-block-start: 7px;
  184. }
  185. &.arrowUp::after {
  186. border-block-end: 4px solid rgb(72 72 72 / 60%);
  187. border-inline-end: 4px solid transparent;
  188. border-inline-start: 4px solid transparent;
  189. }
  190. &.arrowDown {
  191. inset-block-end: 7px;
  192. }
  193. &.arrowDown::after {
  194. border-block-start: 4px solid rgb(72 72 72 / 60%);
  195. border-inline-end: 4px solid transparent;
  196. border-inline-start: 4px solid transparent;
  197. }
  198. svg {
  199. block-size: auto;
  200. inline-size: inherit;
  201. }
  202. svg path {
  203. fill: rgb(255 255 255 / 50%);
  204. }
  205. }
  206. &:hover {
  207. background: rgb(0 0 0 / 5%);
  208. }
  209. &:hover span {
  210. opacity: 1;
  211. }
  212. }
  213. /* flat picker current month styles */
  214. .flatpickr-current-month {
  215. position: absolute;
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. block-size: $picker-arrow-wrapper-size - .375;
  220. color: $picker-header-color;
  221. font-weight: 300;
  222. gap: .25rem;
  223. inline-size: 75%;
  224. inset-inline-start: 12.5%;
  225. line-height: 1;
  226. padding-block: 1rem 0;
  227. padding-inline: 0;
  228. text-align: center;
  229. transform: translate3d(0, 0, 0);
  230. .cur-month{
  231. font-size: $font-size-base;
  232. font-weight: $font-weight-normal;
  233. }
  234. .flatpickr-monthDropdown-months,
  235. input.cur-year {
  236. display: inline-block;
  237. box-sizing: border-box;
  238. border: 0;
  239. @include border-radius(0);
  240. background: transparent;
  241. color: inherit;
  242. font-family: inherit;
  243. font-size: inherit;
  244. font-weight: $font-weight-normal;
  245. line-height: inherit;
  246. outline: none;
  247. padding-block: 0;
  248. padding-inline: .5ch 0;
  249. vertical-align: middle;
  250. &:not(:first-child) {
  251. padding-block: 0;
  252. padding-inline: .5ch 0;
  253. }
  254. }
  255. .numInputWrapper {
  256. display: inline-block;
  257. inline-size: 6ch;
  258. }
  259. .flatpickr-monthDropdown-months {
  260. position: relative;
  261. appearance: menulist;
  262. background-color: $picker-bg;
  263. block-size: $picker-cell-size;
  264. color: $picker-header-color;
  265. cursor: pointer;
  266. font-size: $font-size-lg;
  267. inline-size: auto;
  268. }
  269. input.cur-year {
  270. margin: 0;
  271. block-size: $picker-cell-size - .5rem;
  272. cursor: default;
  273. &:focus {
  274. outline: 0;
  275. }
  276. }
  277. }
  278. /* flat picker calendar weekdays styles */
  279. .flatpickr-weekdays {
  280. display: flex;
  281. overflow: hidden;
  282. align-items: center;
  283. background: $picker-bg;
  284. block-size: $picker-cell-size;
  285. inline-size: 100%;
  286. margin-block-end: .6875rem;
  287. margin-block-start: .5rem;
  288. max-inline-size: 17.5rem;
  289. text-align: center;
  290. .flatpickr-weekdaycontainer {
  291. display: flex;
  292. inline-size: 100%;
  293. padding-block: calc($picker-cell-padding / 2);
  294. }
  295. span.flatpickr-weekday {
  296. display: block;
  297. flex: 1;
  298. margin: 0;
  299. background: $picker-bg;
  300. color: $picker-header-color;
  301. cursor: default;
  302. font-size: $font-size-sm;
  303. inline-size: $picker-cell-size;
  304. line-height: 1;
  305. text-align: center;
  306. }
  307. }
  308. .dayContainer,
  309. .flatpickr-weeks {
  310. padding-block: 1px 0;
  311. padding-inline: 0;
  312. }
  313. /* flat picker days styles */
  314. .flatpickr-days {
  315. position: relative;
  316. display: flex;
  317. overflow: hidden;
  318. background: $picker-bg;
  319. inline-size: auto;
  320. &:focus {
  321. outline: 0;
  322. }
  323. /* days wrapper/container */
  324. .dayContainer {
  325. display: inline-block;
  326. display: flex;
  327. box-sizing: border-box;
  328. flex-wrap: wrap;
  329. justify-content: space-around;
  330. padding: 0;
  331. inline-size: $picker-cell-size * 7;
  332. max-inline-size: $picker-cell-size * 7;
  333. min-inline-size: $picker-cell-size * 7;
  334. opacity: 1;
  335. outline: 0;
  336. transform: translate3d(0, 0, 0);
  337. }
  338. /* day wise styling */
  339. .flatpickr-day {
  340. display: flex;
  341. box-sizing: border-box;
  342. align-items: center;
  343. justify-content: center;
  344. border: 1px solid transparent;
  345. margin: 0;
  346. background: none;
  347. block-size: $picker-cell-size;
  348. color: $picker-color;
  349. cursor: pointer;
  350. font-weight: $font-weight-normal;
  351. inline-size: 15.2857%;
  352. line-height: $picker-cell-size;
  353. max-inline-size: $picker-cell-size;
  354. text-align: center;
  355. @include border-radius($picker-cell-border-radius);
  356. &.today,
  357. &.today:hover {
  358. background-color: $picker-cell-today-bg;
  359. color: $picker-cell-today-color;
  360. }
  361. &.inRange,
  362. &.prevMonthDay.inRange,
  363. &.nextMonthDay.inRange,
  364. &.today.inRange,
  365. &.prevMonthDay.today.inRange,
  366. &.nextMonthDay.today.inRange,
  367. &:hover,
  368. &.prevMonthDay:hover,
  369. &.nextMonthDay:hover,
  370. &:focus,
  371. &.prevMonthDay:focus,
  372. &.nextMonthDay:focus {
  373. cursor: pointer;
  374. outline: 0;
  375. }
  376. /* hover & focus styles */
  377. &:hover,
  378. &.prevMonthDay:hover,
  379. &.nextMonthDay:hover,
  380. &:focus,
  381. &.prevMonthDay:focus,
  382. &.nextMonthDay:focus{
  383. background-color: $picker-cell-hover-bg;
  384. }
  385. /* range styles */
  386. &.inRange,
  387. &.prevMonthDay.inRange,
  388. &.nextMonthDay.inRange,
  389. &.today.inRange,
  390. &.prevMonthDay.today.inRange,
  391. &.nextMonthDay.today.inRange{
  392. background-color: $picker-range-active-bg;
  393. color: $picker-color;
  394. }
  395. /* selected styles */
  396. &.selected,
  397. &.selected.inRange,
  398. &.selected:focus,
  399. &.selected:hover,
  400. &.selected.nextMonthDay,
  401. &.selected.prevMonthDay,
  402. &.startRange,
  403. &.startRange.inRange,
  404. &.startRange:focus,
  405. &.startRange:hover,
  406. &.startRange.nextMonthDay,
  407. &.startRange.prevMonthDay,
  408. &.endRange,
  409. &.endRange.inRange,
  410. &.endRange:focus,
  411. &.endRange:hover,
  412. &.endRange.nextMonthDay,
  413. &.endRange.prevMonthDay,
  414. &.week.selected {
  415. background-color: $picker-cell-active-bg;
  416. box-shadow: $picker-cell-active-shadow;
  417. color: $picker-cell-active-color;
  418. }
  419. &.inRange:not(.startRange, .endRange) {
  420. @include border-radius(0);
  421. }
  422. /* disabled styles */
  423. &.disabled,
  424. &.flatpickr-disabled,
  425. &.flatpickr-disabled.today,
  426. &.disabled:hover,
  427. &.flatpickr-disabled:hover,
  428. &.flatpickr-disabled.today:hover {
  429. border-color: transparent;
  430. background: transparent;
  431. cursor: default;
  432. pointer-events: none;
  433. }
  434. &.prevMonthDay,
  435. &.nextMonthDay {
  436. border-color: transparent;
  437. background: transparent;
  438. color: $picker-disabled-color;
  439. cursor: default;
  440. }
  441. &.flatpickr-disabled,
  442. &.disabled{
  443. color: $picker-disabled-color;
  444. }
  445. &.notAllowed,
  446. &.notAllowed.prevMonthDay,
  447. &.notAllowed.nextMonthDay {
  448. border-color: transparent;
  449. background: transparent;
  450. cursor: default;
  451. }
  452. &.selected.startRange,
  453. &.startRange.startRange,
  454. &.endRange.startRange {
  455. @include border-end-radius(0);
  456. }
  457. &.selected.endRange,
  458. &.startRange.endRange,
  459. &.endRange.endRange {
  460. @include border-start-radius(0);
  461. }
  462. }
  463. }
  464. .flatpickr-weekwrapper {
  465. display: inline-block;
  466. margin-block-start: .5rem;
  467. .flatpickr-weekday {
  468. position: relative;
  469. float: none;
  470. inline-size: 100%;
  471. inset-block-start: 1px;
  472. line-height: $picker-cell-size;
  473. }
  474. /* Weekdays style for weeks */
  475. span.flatpickr-day {
  476. display: block;
  477. background: none;
  478. block-size: $picker-cell-size;
  479. inline-size: $picker-cell-size;
  480. max-inline-size: none;
  481. }
  482. }
  483. .flatpickr-innerContainer {
  484. display: flex;
  485. overflow: hidden;
  486. box-sizing: border-box;
  487. .flatpickr-rContainer {
  488. display: inline-block;
  489. box-sizing: border-box;
  490. padding: 0;
  491. }
  492. }
  493. /* flat picker time styles */
  494. .flatpickr-time {
  495. display: flex;
  496. line-height: $flatpickr-time-picker-height;
  497. text-align: center;
  498. .numInputWrapper {
  499. flex: 1;
  500. block-size: $flatpickr-time-picker-height;
  501. float: inline-start;
  502. inline-size: 40%;
  503. }
  504. &.hasSeconds .numInputWrapper {
  505. inline-size: 26%;
  506. }
  507. &.time24hr .numInputWrapper {
  508. inline-size: 49%;
  509. }
  510. input {
  511. position: relative;
  512. box-sizing: border-box;
  513. padding: 0;
  514. border: 0;
  515. @include border-radius(0);
  516. margin: 0;
  517. background: transparent;
  518. block-size: inherit;
  519. box-shadow: none;
  520. cursor: pointer;
  521. font-size: $font-size-base;
  522. line-height: inherit;
  523. text-align: center;
  524. &:focus {
  525. border: 0;
  526. outline: 0;
  527. }
  528. }
  529. .flatpickr-am-pm {
  530. cursor: pointer;
  531. inline-size: 18%;
  532. &:hover {
  533. background: rgb(0 0 0 / 5%);
  534. }
  535. }
  536. }
  537. }