index.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import { TinyColor } from '@ctrl/tinycolor';
  3. import { genActiveStyle, genBasicInputStyle, genHoverStyle, initInputToken } from '../../input/style';
  4. import { initSlideMotion, initMoveMotion, slideDownIn, slideDownOut, slideUpIn, slideUpOut } from '../../style/motion';
  5. import { genComponentStyleHook, mergeToken } from '../../theme/internal';
  6. import { resetComponent, roundedArrow, textEllipsis } from '../../style';
  7. import { genCompactItemStyle } from '../../style/compact-item';
  8. const genPikerPadding = (token, inputHeight, fontSize, paddingHorizontal) => {
  9. const {
  10. lineHeight
  11. } = token;
  12. const fontHeight = Math.floor(fontSize * lineHeight) + 2;
  13. const paddingTop = Math.max((inputHeight - fontHeight) / 2, 0);
  14. const paddingBottom = Math.max(inputHeight - fontHeight - paddingTop, 0);
  15. return {
  16. padding: `${paddingTop}px ${paddingHorizontal}px ${paddingBottom}px`
  17. };
  18. };
  19. const genPickerCellInnerStyle = token => {
  20. const {
  21. componentCls,
  22. pickerCellCls,
  23. pickerCellInnerCls,
  24. pickerPanelCellHeight,
  25. motionDurationSlow,
  26. borderRadiusSM,
  27. motionDurationMid,
  28. controlItemBgHover,
  29. lineWidth,
  30. lineType,
  31. colorPrimary,
  32. controlItemBgActive,
  33. colorTextLightSolid,
  34. controlHeightSM,
  35. pickerDateHoverRangeBorderColor,
  36. pickerCellBorderGap,
  37. pickerBasicCellHoverWithRangeColor,
  38. pickerPanelCellWidth,
  39. colorTextDisabled,
  40. colorBgContainerDisabled
  41. } = token;
  42. return {
  43. '&::before': {
  44. position: 'absolute',
  45. top: '50%',
  46. insetInlineStart: 0,
  47. insetInlineEnd: 0,
  48. zIndex: 1,
  49. height: pickerPanelCellHeight,
  50. transform: 'translateY(-50%)',
  51. transition: `all ${motionDurationSlow}`,
  52. content: '""'
  53. },
  54. // >>> Default
  55. [pickerCellInnerCls]: {
  56. position: 'relative',
  57. zIndex: 2,
  58. display: 'inline-block',
  59. minWidth: pickerPanelCellHeight,
  60. height: pickerPanelCellHeight,
  61. lineHeight: `${pickerPanelCellHeight}px`,
  62. borderRadius: borderRadiusSM,
  63. transition: `background ${motionDurationMid}, border ${motionDurationMid}`
  64. },
  65. // >>> Hover
  66. [`&:hover:not(${pickerCellCls}-in-view),
  67. &:hover:not(${pickerCellCls}-selected):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end):not(${pickerCellCls}-range-hover-start):not(${pickerCellCls}-range-hover-end)`]: {
  68. [pickerCellInnerCls]: {
  69. background: controlItemBgHover
  70. }
  71. },
  72. // >>> Today
  73. [`&-in-view${pickerCellCls}-today ${pickerCellInnerCls}`]: {
  74. '&::before': {
  75. position: 'absolute',
  76. top: 0,
  77. insetInlineEnd: 0,
  78. bottom: 0,
  79. insetInlineStart: 0,
  80. zIndex: 1,
  81. border: `${lineWidth}px ${lineType} ${colorPrimary}`,
  82. borderRadius: borderRadiusSM,
  83. content: '""'
  84. }
  85. },
  86. // >>> In Range
  87. [`&-in-view${pickerCellCls}-in-range`]: {
  88. position: 'relative',
  89. '&::before': {
  90. background: controlItemBgActive
  91. }
  92. },
  93. // >>> Selected
  94. [`&-in-view${pickerCellCls}-selected ${pickerCellInnerCls},
  95. &-in-view${pickerCellCls}-range-start ${pickerCellInnerCls},
  96. &-in-view${pickerCellCls}-range-end ${pickerCellInnerCls}`]: {
  97. color: colorTextLightSolid,
  98. background: colorPrimary
  99. },
  100. [`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-start-single),
  101. &-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-end-single)`]: {
  102. '&::before': {
  103. background: controlItemBgActive
  104. }
  105. },
  106. [`&-in-view${pickerCellCls}-range-start::before`]: {
  107. insetInlineStart: '50%'
  108. },
  109. [`&-in-view${pickerCellCls}-range-end::before`]: {
  110. insetInlineEnd: '50%'
  111. },
  112. // >>> Range Hover
  113. [`&-in-view${pickerCellCls}-range-hover-start:not(${pickerCellCls}-in-range):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end),
  114. &-in-view${pickerCellCls}-range-hover-end:not(${pickerCellCls}-in-range):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end),
  115. &-in-view${pickerCellCls}-range-hover-start${pickerCellCls}-range-start-single,
  116. &-in-view${pickerCellCls}-range-hover-start${pickerCellCls}-range-start${pickerCellCls}-range-end${pickerCellCls}-range-end-near-hover,
  117. &-in-view${pickerCellCls}-range-hover-end${pickerCellCls}-range-start${pickerCellCls}-range-end${pickerCellCls}-range-start-near-hover,
  118. &-in-view${pickerCellCls}-range-hover-end${pickerCellCls}-range-end-single,
  119. &-in-view${pickerCellCls}-range-hover:not(${pickerCellCls}-in-range)`]: {
  120. '&::after': {
  121. position: 'absolute',
  122. top: '50%',
  123. zIndex: 0,
  124. height: controlHeightSM,
  125. borderTop: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  126. borderBottom: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  127. transform: 'translateY(-50%)',
  128. transition: `all ${motionDurationSlow}`,
  129. content: '""'
  130. }
  131. },
  132. // Add space for stash
  133. [`&-range-hover-start::after,
  134. &-range-hover-end::after,
  135. &-range-hover::after`]: {
  136. insetInlineEnd: 0,
  137. insetInlineStart: pickerCellBorderGap
  138. },
  139. // Hover with in range
  140. [`&-in-view${pickerCellCls}-in-range${pickerCellCls}-range-hover::before,
  141. &-in-view${pickerCellCls}-range-start${pickerCellCls}-range-hover::before,
  142. &-in-view${pickerCellCls}-range-end${pickerCellCls}-range-hover::before,
  143. &-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-start-single)${pickerCellCls}-range-hover-start::before,
  144. &-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-end-single)${pickerCellCls}-range-hover-end::before,
  145. ${componentCls}-panel
  146. > :not(${componentCls}-date-panel)
  147. &-in-view${pickerCellCls}-in-range${pickerCellCls}-range-hover-start::before,
  148. ${componentCls}-panel
  149. > :not(${componentCls}-date-panel)
  150. &-in-view${pickerCellCls}-in-range${pickerCellCls}-range-hover-end::before`]: {
  151. background: pickerBasicCellHoverWithRangeColor
  152. },
  153. // range start border-radius
  154. [`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-start-single):not(${pickerCellCls}-range-end) ${pickerCellInnerCls}`]: {
  155. borderStartStartRadius: borderRadiusSM,
  156. borderEndStartRadius: borderRadiusSM,
  157. borderStartEndRadius: 0,
  158. borderEndEndRadius: 0
  159. },
  160. // range end border-radius
  161. [`&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-end-single):not(${pickerCellCls}-range-start) ${pickerCellInnerCls}`]: {
  162. borderStartStartRadius: 0,
  163. borderEndStartRadius: 0,
  164. borderStartEndRadius: borderRadiusSM,
  165. borderEndEndRadius: borderRadiusSM
  166. },
  167. [`&-range-hover${pickerCellCls}-range-end::after`]: {
  168. insetInlineStart: '50%'
  169. },
  170. // Edge start
  171. [`tr > &-in-view${pickerCellCls}-range-hover:first-child::after,
  172. tr > &-in-view${pickerCellCls}-range-hover-end:first-child::after,
  173. &-in-view${pickerCellCls}-start${pickerCellCls}-range-hover-edge-start${pickerCellCls}-range-hover-edge-start-near-range::after,
  174. &-in-view${pickerCellCls}-range-hover-edge-start:not(${pickerCellCls}-range-hover-edge-start-near-range)::after,
  175. &-in-view${pickerCellCls}-range-hover-start::after`]: {
  176. insetInlineStart: (pickerPanelCellWidth - pickerPanelCellHeight) / 2,
  177. borderInlineStart: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  178. borderStartStartRadius: lineWidth,
  179. borderEndStartRadius: lineWidth
  180. },
  181. // Edge end
  182. [`tr > &-in-view${pickerCellCls}-range-hover:last-child::after,
  183. tr > &-in-view${pickerCellCls}-range-hover-start:last-child::after,
  184. &-in-view${pickerCellCls}-end${pickerCellCls}-range-hover-edge-end${pickerCellCls}-range-hover-edge-end-near-range::after,
  185. &-in-view${pickerCellCls}-range-hover-edge-end:not(${pickerCellCls}-range-hover-edge-end-near-range)::after,
  186. &-in-view${pickerCellCls}-range-hover-end::after`]: {
  187. insetInlineEnd: (pickerPanelCellWidth - pickerPanelCellHeight) / 2,
  188. borderInlineEnd: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  189. borderStartEndRadius: lineWidth,
  190. borderEndEndRadius: lineWidth
  191. },
  192. // >>> Disabled
  193. '&-disabled': {
  194. color: colorTextDisabled,
  195. pointerEvents: 'none',
  196. [pickerCellInnerCls]: {
  197. background: 'transparent'
  198. },
  199. '&::before': {
  200. background: colorBgContainerDisabled
  201. }
  202. },
  203. [`&-disabled${pickerCellCls}-today ${pickerCellInnerCls}::before`]: {
  204. borderColor: colorTextDisabled
  205. }
  206. };
  207. };
  208. export const genPanelStyle = token => {
  209. const {
  210. componentCls,
  211. pickerCellInnerCls,
  212. pickerYearMonthCellWidth,
  213. pickerControlIconSize,
  214. pickerPanelCellWidth,
  215. paddingSM,
  216. paddingXS,
  217. paddingXXS,
  218. colorBgContainer,
  219. lineWidth,
  220. lineType,
  221. borderRadiusLG,
  222. colorPrimary,
  223. colorTextHeading,
  224. colorSplit,
  225. pickerControlIconBorderWidth,
  226. colorIcon,
  227. pickerTextHeight,
  228. motionDurationMid,
  229. colorIconHover,
  230. fontWeightStrong,
  231. pickerPanelCellHeight,
  232. pickerCellPaddingVertical,
  233. colorTextDisabled,
  234. colorText,
  235. fontSize,
  236. pickerBasicCellHoverWithRangeColor,
  237. motionDurationSlow,
  238. pickerPanelWithoutTimeCellHeight,
  239. pickerQuarterPanelContentHeight,
  240. colorLink,
  241. colorLinkActive,
  242. colorLinkHover,
  243. pickerDateHoverRangeBorderColor,
  244. borderRadiusSM,
  245. colorTextLightSolid,
  246. borderRadius,
  247. controlItemBgHover,
  248. pickerTimePanelColumnHeight,
  249. pickerTimePanelColumnWidth,
  250. pickerTimePanelCellHeight,
  251. controlItemBgActive,
  252. marginXXS
  253. } = token;
  254. const pickerPanelWidth = pickerPanelCellWidth * 7 + paddingSM * 2 + 4;
  255. const hoverCellFixedDistance = (pickerPanelWidth - paddingXS * 2) / 3 - pickerYearMonthCellWidth - paddingSM;
  256. return {
  257. [componentCls]: {
  258. '&-panel': {
  259. display: 'inline-flex',
  260. flexDirection: 'column',
  261. textAlign: 'center',
  262. background: colorBgContainer,
  263. border: `${lineWidth}px ${lineType} ${colorSplit}`,
  264. borderRadius: borderRadiusLG,
  265. outline: 'none',
  266. '&-focused': {
  267. borderColor: colorPrimary
  268. },
  269. '&-rtl': {
  270. direction: 'rtl',
  271. [`${componentCls}-prev-icon,
  272. ${componentCls}-super-prev-icon`]: {
  273. transform: 'rotate(45deg)'
  274. },
  275. [`${componentCls}-next-icon,
  276. ${componentCls}-super-next-icon`]: {
  277. transform: 'rotate(-135deg)'
  278. }
  279. }
  280. },
  281. // ========================================================
  282. // = Shared Panel =
  283. // ========================================================
  284. [`&-decade-panel,
  285. &-year-panel,
  286. &-quarter-panel,
  287. &-month-panel,
  288. &-week-panel,
  289. &-date-panel,
  290. &-time-panel`]: {
  291. display: 'flex',
  292. flexDirection: 'column',
  293. width: pickerPanelWidth
  294. },
  295. // ======================= Header =======================
  296. '&-header': {
  297. display: 'flex',
  298. padding: `0 ${paddingXS}px`,
  299. color: colorTextHeading,
  300. borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`,
  301. '> *': {
  302. flex: 'none'
  303. },
  304. button: {
  305. padding: 0,
  306. color: colorIcon,
  307. lineHeight: `${pickerTextHeight}px`,
  308. background: 'transparent',
  309. border: 0,
  310. cursor: 'pointer',
  311. transition: `color ${motionDurationMid}`
  312. },
  313. '> button': {
  314. minWidth: '1.6em',
  315. fontSize,
  316. '&:hover': {
  317. color: colorIconHover
  318. }
  319. },
  320. '&-view': {
  321. flex: 'auto',
  322. fontWeight: fontWeightStrong,
  323. lineHeight: `${pickerTextHeight}px`,
  324. button: {
  325. color: 'inherit',
  326. fontWeight: 'inherit',
  327. verticalAlign: 'top',
  328. '&:not(:first-child)': {
  329. marginInlineStart: paddingXS
  330. },
  331. '&:hover': {
  332. color: colorPrimary
  333. }
  334. }
  335. }
  336. },
  337. // Arrow button
  338. [`&-prev-icon,
  339. &-next-icon,
  340. &-super-prev-icon,
  341. &-super-next-icon`]: {
  342. position: 'relative',
  343. display: 'inline-block',
  344. width: pickerControlIconSize,
  345. height: pickerControlIconSize,
  346. '&::before': {
  347. position: 'absolute',
  348. top: 0,
  349. insetInlineStart: 0,
  350. display: 'inline-block',
  351. width: pickerControlIconSize,
  352. height: pickerControlIconSize,
  353. border: `0 solid currentcolor`,
  354. borderBlockStartWidth: pickerControlIconBorderWidth,
  355. borderBlockEndWidth: 0,
  356. borderInlineStartWidth: pickerControlIconBorderWidth,
  357. borderInlineEndWidth: 0,
  358. content: '""'
  359. }
  360. },
  361. [`&-super-prev-icon,
  362. &-super-next-icon`]: {
  363. '&::after': {
  364. position: 'absolute',
  365. top: Math.ceil(pickerControlIconSize / 2),
  366. insetInlineStart: Math.ceil(pickerControlIconSize / 2),
  367. display: 'inline-block',
  368. width: pickerControlIconSize,
  369. height: pickerControlIconSize,
  370. border: '0 solid currentcolor',
  371. borderBlockStartWidth: pickerControlIconBorderWidth,
  372. borderBlockEndWidth: 0,
  373. borderInlineStartWidth: pickerControlIconBorderWidth,
  374. borderInlineEndWidth: 0,
  375. content: '""'
  376. }
  377. },
  378. [`&-prev-icon,
  379. &-super-prev-icon`]: {
  380. transform: 'rotate(-45deg)'
  381. },
  382. [`&-next-icon,
  383. &-super-next-icon`]: {
  384. transform: 'rotate(135deg)'
  385. },
  386. // ======================== Body ========================
  387. '&-content': {
  388. width: '100%',
  389. tableLayout: 'fixed',
  390. borderCollapse: 'collapse',
  391. 'th, td': {
  392. position: 'relative',
  393. minWidth: pickerPanelCellHeight,
  394. fontWeight: 'normal'
  395. },
  396. th: {
  397. height: pickerPanelCellHeight + pickerCellPaddingVertical * 2,
  398. color: colorText,
  399. verticalAlign: 'middle'
  400. }
  401. },
  402. '&-cell': _extends({
  403. padding: `${pickerCellPaddingVertical}px 0`,
  404. color: colorTextDisabled,
  405. cursor: 'pointer',
  406. // In view
  407. '&-in-view': {
  408. color: colorText
  409. }
  410. }, genPickerCellInnerStyle(token)),
  411. // DatePanel only
  412. [`&-date-panel ${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-start ${pickerCellInnerCls},
  413. &-date-panel ${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-end ${pickerCellInnerCls}`]: {
  414. '&::after': {
  415. position: 'absolute',
  416. top: 0,
  417. bottom: 0,
  418. zIndex: -1,
  419. background: pickerBasicCellHoverWithRangeColor,
  420. transition: `all ${motionDurationSlow}`,
  421. content: '""'
  422. }
  423. },
  424. [`&-date-panel
  425. ${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-start
  426. ${pickerCellInnerCls}::after`]: {
  427. insetInlineEnd: -(pickerPanelCellWidth - pickerPanelCellHeight) / 2,
  428. insetInlineStart: 0
  429. },
  430. [`&-date-panel ${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-end ${pickerCellInnerCls}::after`]: {
  431. insetInlineEnd: 0,
  432. insetInlineStart: -(pickerPanelCellWidth - pickerPanelCellHeight) / 2
  433. },
  434. // Hover with range start & end
  435. [`&-range-hover${componentCls}-range-start::after`]: {
  436. insetInlineEnd: '50%'
  437. },
  438. [`&-decade-panel,
  439. &-year-panel,
  440. &-quarter-panel,
  441. &-month-panel`]: {
  442. [`${componentCls}-content`]: {
  443. height: pickerPanelWithoutTimeCellHeight * 4
  444. },
  445. [pickerCellInnerCls]: {
  446. padding: `0 ${paddingXS}px`
  447. }
  448. },
  449. '&-quarter-panel': {
  450. [`${componentCls}-content`]: {
  451. height: pickerQuarterPanelContentHeight
  452. }
  453. },
  454. // ======================== Footer ========================
  455. [`&-panel ${componentCls}-footer`]: {
  456. borderTop: `${lineWidth}px ${lineType} ${colorSplit}`
  457. },
  458. '&-footer': {
  459. width: 'min-content',
  460. minWidth: '100%',
  461. lineHeight: `${pickerTextHeight - 2 * lineWidth}px`,
  462. textAlign: 'center',
  463. '&-extra': {
  464. padding: `0 ${paddingSM}`,
  465. lineHeight: `${pickerTextHeight - 2 * lineWidth}px`,
  466. textAlign: 'start',
  467. '&:not(:last-child)': {
  468. borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`
  469. }
  470. }
  471. },
  472. '&-now': {
  473. textAlign: 'start'
  474. },
  475. '&-today-btn': {
  476. color: colorLink,
  477. '&:hover': {
  478. color: colorLinkHover
  479. },
  480. '&:active': {
  481. color: colorLinkActive
  482. },
  483. [`&${componentCls}-today-btn-disabled`]: {
  484. color: colorTextDisabled,
  485. cursor: 'not-allowed'
  486. }
  487. },
  488. // ========================================================
  489. // = Special =
  490. // ========================================================
  491. // ===================== Decade Panel =====================
  492. '&-decade-panel': {
  493. [pickerCellInnerCls]: {
  494. padding: `0 ${paddingXS / 2}px`
  495. },
  496. [`${componentCls}-cell::before`]: {
  497. display: 'none'
  498. }
  499. },
  500. // ============= Year & Quarter & Month Panel =============
  501. [`&-year-panel,
  502. &-quarter-panel,
  503. &-month-panel`]: {
  504. [`${componentCls}-body`]: {
  505. padding: `0 ${paddingXS}px`
  506. },
  507. [pickerCellInnerCls]: {
  508. width: pickerYearMonthCellWidth
  509. },
  510. [`${componentCls}-cell-range-hover-start::after`]: {
  511. insetInlineStart: hoverCellFixedDistance,
  512. borderInlineStart: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  513. borderStartStartRadius: borderRadiusSM,
  514. borderBottomStartRadius: borderRadiusSM,
  515. borderStartEndRadius: 0,
  516. borderBottomEndRadius: 0,
  517. [`${componentCls}-panel-rtl &`]: {
  518. insetInlineEnd: hoverCellFixedDistance,
  519. borderInlineEnd: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  520. borderStartStartRadius: 0,
  521. borderBottomStartRadius: 0,
  522. borderStartEndRadius: borderRadiusSM,
  523. borderBottomEndRadius: borderRadiusSM
  524. }
  525. },
  526. [`${componentCls}-cell-range-hover-end::after`]: {
  527. insetInlineEnd: hoverCellFixedDistance,
  528. borderInlineEnd: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  529. borderStartStartRadius: 0,
  530. borderEndStartRadius: 0,
  531. borderStartEndRadius: borderRadius,
  532. borderEndEndRadius: borderRadius,
  533. [`${componentCls}-panel-rtl &`]: {
  534. insetInlineStart: hoverCellFixedDistance,
  535. borderInlineStart: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
  536. borderStartStartRadius: borderRadius,
  537. borderEndStartRadius: borderRadius,
  538. borderStartEndRadius: 0,
  539. borderEndEndRadius: 0
  540. }
  541. }
  542. },
  543. // ====================== Week Panel ======================
  544. '&-week-panel': {
  545. [`${componentCls}-body`]: {
  546. padding: `${paddingXS}px ${paddingSM}px`
  547. },
  548. // Clear cell style
  549. [`${componentCls}-cell`]: {
  550. [`&:hover ${pickerCellInnerCls},
  551. &-selected ${pickerCellInnerCls},
  552. ${pickerCellInnerCls}`]: {
  553. background: 'transparent !important'
  554. }
  555. },
  556. '&-row': {
  557. td: {
  558. transition: `background ${motionDurationMid}`,
  559. '&:first-child': {
  560. borderStartStartRadius: borderRadiusSM,
  561. borderEndStartRadius: borderRadiusSM
  562. },
  563. '&:last-child': {
  564. borderStartEndRadius: borderRadiusSM,
  565. borderEndEndRadius: borderRadiusSM
  566. }
  567. },
  568. '&:hover td': {
  569. background: controlItemBgHover
  570. },
  571. [`&-selected td,
  572. &-selected:hover td`]: {
  573. background: colorPrimary,
  574. [`&${componentCls}-cell-week`]: {
  575. color: new TinyColor(colorTextLightSolid).setAlpha(0.5).toHexString()
  576. },
  577. [`&${componentCls}-cell-today ${pickerCellInnerCls}::before`]: {
  578. borderColor: colorTextLightSolid
  579. },
  580. [pickerCellInnerCls]: {
  581. color: colorTextLightSolid
  582. }
  583. }
  584. }
  585. },
  586. // ====================== Date Panel ======================
  587. '&-date-panel': {
  588. [`${componentCls}-body`]: {
  589. padding: `${paddingXS}px ${paddingSM}px`
  590. },
  591. [`${componentCls}-content`]: {
  592. width: pickerPanelCellWidth * 7,
  593. th: {
  594. width: pickerPanelCellWidth
  595. }
  596. }
  597. },
  598. // ==================== Datetime Panel ====================
  599. '&-datetime-panel': {
  600. display: 'flex',
  601. [`${componentCls}-time-panel`]: {
  602. borderInlineStart: `${lineWidth}px ${lineType} ${colorSplit}`
  603. },
  604. [`${componentCls}-date-panel,
  605. ${componentCls}-time-panel`]: {
  606. transition: `opacity ${motionDurationSlow}`
  607. },
  608. // Keyboard
  609. '&-active': {
  610. [`${componentCls}-date-panel,
  611. ${componentCls}-time-panel`]: {
  612. opacity: 0.3,
  613. '&-active': {
  614. opacity: 1
  615. }
  616. }
  617. }
  618. },
  619. // ====================== Time Panel ======================
  620. '&-time-panel': {
  621. width: 'auto',
  622. minWidth: 'auto',
  623. direction: 'ltr',
  624. [`${componentCls}-content`]: {
  625. display: 'flex',
  626. flex: 'auto',
  627. height: pickerTimePanelColumnHeight
  628. },
  629. '&-column': {
  630. flex: '1 0 auto',
  631. width: pickerTimePanelColumnWidth,
  632. margin: `${paddingXXS}px 0`,
  633. padding: 0,
  634. overflowY: 'hidden',
  635. textAlign: 'start',
  636. listStyle: 'none',
  637. transition: `background ${motionDurationMid}`,
  638. overflowX: 'hidden',
  639. '&::after': {
  640. display: 'block',
  641. height: pickerTimePanelColumnHeight - pickerTimePanelCellHeight,
  642. content: '""'
  643. },
  644. '&:not(:first-child)': {
  645. borderInlineStart: `${lineWidth}px ${lineType} ${colorSplit}`
  646. },
  647. '&-active': {
  648. background: new TinyColor(controlItemBgActive).setAlpha(0.2).toHexString()
  649. },
  650. '&:hover': {
  651. overflowY: 'auto'
  652. },
  653. '> li': {
  654. margin: 0,
  655. padding: 0,
  656. [`&${componentCls}-time-panel-cell`]: {
  657. marginInline: marginXXS,
  658. [`${componentCls}-time-panel-cell-inner`]: {
  659. display: 'block',
  660. width: pickerTimePanelColumnWidth - 2 * marginXXS,
  661. height: pickerTimePanelCellHeight,
  662. margin: 0,
  663. paddingBlock: 0,
  664. paddingInlineEnd: 0,
  665. paddingInlineStart: (pickerTimePanelColumnWidth - pickerTimePanelCellHeight) / 2,
  666. color: colorText,
  667. lineHeight: `${pickerTimePanelCellHeight}px`,
  668. borderRadius: borderRadiusSM,
  669. cursor: 'pointer',
  670. transition: `background ${motionDurationMid}`,
  671. '&:hover': {
  672. background: controlItemBgHover
  673. }
  674. },
  675. '&-selected': {
  676. [`${componentCls}-time-panel-cell-inner`]: {
  677. background: controlItemBgActive
  678. }
  679. },
  680. '&-disabled': {
  681. [`${componentCls}-time-panel-cell-inner`]: {
  682. color: colorTextDisabled,
  683. background: 'transparent',
  684. cursor: 'not-allowed'
  685. }
  686. }
  687. }
  688. }
  689. }
  690. },
  691. // https://github.com/ant-design/ant-design/issues/39227
  692. [`&-datetime-panel ${componentCls}-time-panel-column:after`]: {
  693. height: pickerTimePanelColumnHeight - pickerTimePanelCellHeight + paddingXXS * 2
  694. }
  695. }
  696. };
  697. };
  698. const genPickerStatusStyle = token => {
  699. const {
  700. componentCls,
  701. colorBgContainer,
  702. colorError,
  703. colorErrorOutline,
  704. colorWarning,
  705. colorWarningOutline
  706. } = token;
  707. return {
  708. [componentCls]: {
  709. [`&-status-error${componentCls}`]: {
  710. '&, &:not([disabled]):hover': {
  711. backgroundColor: colorBgContainer,
  712. borderColor: colorError
  713. },
  714. '&-focused, &:focus': _extends({}, genActiveStyle(mergeToken(token, {
  715. inputBorderActiveColor: colorError,
  716. inputBorderHoverColor: colorError,
  717. controlOutline: colorErrorOutline
  718. }))),
  719. [`${componentCls}-active-bar`]: {
  720. background: colorError
  721. }
  722. },
  723. [`&-status-warning${componentCls}`]: {
  724. '&, &:not([disabled]):hover': {
  725. backgroundColor: colorBgContainer,
  726. borderColor: colorWarning
  727. },
  728. '&-focused, &:focus': _extends({}, genActiveStyle(mergeToken(token, {
  729. inputBorderActiveColor: colorWarning,
  730. inputBorderHoverColor: colorWarning,
  731. controlOutline: colorWarningOutline
  732. }))),
  733. [`${componentCls}-active-bar`]: {
  734. background: colorWarning
  735. }
  736. }
  737. }
  738. };
  739. };
  740. const genPickerStyle = token => {
  741. const {
  742. componentCls,
  743. antCls,
  744. boxShadowPopoverArrow,
  745. controlHeight,
  746. fontSize,
  747. inputPaddingHorizontal,
  748. colorBgContainer,
  749. lineWidth,
  750. lineType,
  751. colorBorder,
  752. borderRadius,
  753. motionDurationMid,
  754. colorBgContainerDisabled,
  755. colorTextDisabled,
  756. colorTextPlaceholder,
  757. controlHeightLG,
  758. fontSizeLG,
  759. controlHeightSM,
  760. inputPaddingHorizontalSM,
  761. paddingXS,
  762. marginXS,
  763. colorTextDescription,
  764. lineWidthBold,
  765. lineHeight,
  766. colorPrimary,
  767. motionDurationSlow,
  768. zIndexPopup,
  769. paddingXXS,
  770. paddingSM,
  771. pickerTextHeight,
  772. controlItemBgActive,
  773. colorPrimaryBorder,
  774. sizePopupArrow,
  775. borderRadiusXS,
  776. borderRadiusOuter,
  777. colorBgElevated,
  778. borderRadiusLG,
  779. boxShadowSecondary,
  780. borderRadiusSM,
  781. colorSplit,
  782. controlItemBgHover,
  783. presetsWidth,
  784. presetsMaxWidth
  785. } = token;
  786. return [{
  787. [componentCls]: _extends(_extends(_extends({}, resetComponent(token)), genPikerPadding(token, controlHeight, fontSize, inputPaddingHorizontal)), {
  788. position: 'relative',
  789. display: 'inline-flex',
  790. alignItems: 'center',
  791. background: colorBgContainer,
  792. lineHeight: 1,
  793. border: `${lineWidth}px ${lineType} ${colorBorder}`,
  794. borderRadius,
  795. transition: `border ${motionDurationMid}, box-shadow ${motionDurationMid}`,
  796. '&:hover, &-focused': _extends({}, genHoverStyle(token)),
  797. '&-focused': _extends({}, genActiveStyle(token)),
  798. [`&${componentCls}-disabled`]: {
  799. background: colorBgContainerDisabled,
  800. borderColor: colorBorder,
  801. cursor: 'not-allowed',
  802. [`${componentCls}-suffix`]: {
  803. color: colorTextDisabled
  804. }
  805. },
  806. [`&${componentCls}-borderless`]: {
  807. backgroundColor: 'transparent !important',
  808. borderColor: 'transparent !important',
  809. boxShadow: 'none !important'
  810. },
  811. // ======================== Input =========================
  812. [`${componentCls}-input`]: {
  813. position: 'relative',
  814. display: 'inline-flex',
  815. alignItems: 'center',
  816. width: '100%',
  817. '> input': _extends(_extends({}, genBasicInputStyle(token)), {
  818. flex: 'auto',
  819. // Fix Firefox flex not correct:
  820. // https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
  821. minWidth: 1,
  822. height: 'auto',
  823. padding: 0,
  824. background: 'transparent',
  825. border: 0,
  826. '&:focus': {
  827. boxShadow: 'none'
  828. },
  829. '&[disabled]': {
  830. background: 'transparent'
  831. }
  832. }),
  833. '&:hover': {
  834. [`${componentCls}-clear`]: {
  835. opacity: 1
  836. }
  837. },
  838. '&-placeholder': {
  839. '> input': {
  840. color: colorTextPlaceholder
  841. }
  842. }
  843. },
  844. // Size
  845. '&-large': _extends(_extends({}, genPikerPadding(token, controlHeightLG, fontSizeLG, inputPaddingHorizontal)), {
  846. [`${componentCls}-input > input`]: {
  847. fontSize: fontSizeLG
  848. }
  849. }),
  850. '&-small': _extends({}, genPikerPadding(token, controlHeightSM, fontSize, inputPaddingHorizontalSM)),
  851. [`${componentCls}-suffix`]: {
  852. display: 'flex',
  853. flex: 'none',
  854. alignSelf: 'center',
  855. marginInlineStart: paddingXS / 2,
  856. color: colorTextDisabled,
  857. lineHeight: 1,
  858. pointerEvents: 'none',
  859. '> *': {
  860. verticalAlign: 'top',
  861. '&:not(:last-child)': {
  862. marginInlineEnd: marginXS
  863. }
  864. }
  865. },
  866. [`${componentCls}-clear`]: {
  867. position: 'absolute',
  868. top: '50%',
  869. insetInlineEnd: 0,
  870. color: colorTextDisabled,
  871. lineHeight: 1,
  872. background: colorBgContainer,
  873. transform: 'translateY(-50%)',
  874. cursor: 'pointer',
  875. opacity: 0,
  876. transition: `opacity ${motionDurationMid}, color ${motionDurationMid}`,
  877. '> *': {
  878. verticalAlign: 'top'
  879. },
  880. '&:hover': {
  881. color: colorTextDescription
  882. }
  883. },
  884. [`${componentCls}-separator`]: {
  885. position: 'relative',
  886. display: 'inline-block',
  887. width: '1em',
  888. height: fontSizeLG,
  889. color: colorTextDisabled,
  890. fontSize: fontSizeLG,
  891. verticalAlign: 'top',
  892. cursor: 'default',
  893. [`${componentCls}-focused &`]: {
  894. color: colorTextDescription
  895. },
  896. [`${componentCls}-range-separator &`]: {
  897. [`${componentCls}-disabled &`]: {
  898. cursor: 'not-allowed'
  899. }
  900. }
  901. },
  902. // ======================== Range =========================
  903. '&-range': {
  904. position: 'relative',
  905. display: 'inline-flex',
  906. // Clear
  907. [`${componentCls}-clear`]: {
  908. insetInlineEnd: inputPaddingHorizontal
  909. },
  910. '&:hover': {
  911. [`${componentCls}-clear`]: {
  912. opacity: 1
  913. }
  914. },
  915. // Active bar
  916. [`${componentCls}-active-bar`]: {
  917. bottom: -lineWidth,
  918. height: lineWidthBold,
  919. marginInlineStart: inputPaddingHorizontal,
  920. background: colorPrimary,
  921. opacity: 0,
  922. transition: `all ${motionDurationSlow} ease-out`,
  923. pointerEvents: 'none'
  924. },
  925. [`&${componentCls}-focused`]: {
  926. [`${componentCls}-active-bar`]: {
  927. opacity: 1
  928. }
  929. },
  930. [`${componentCls}-range-separator`]: {
  931. alignItems: 'center',
  932. padding: `0 ${paddingXS}px`,
  933. lineHeight: 1
  934. },
  935. [`&${componentCls}-small`]: {
  936. [`${componentCls}-clear`]: {
  937. insetInlineEnd: inputPaddingHorizontalSM
  938. },
  939. [`${componentCls}-active-bar`]: {
  940. marginInlineStart: inputPaddingHorizontalSM
  941. }
  942. }
  943. },
  944. // ======================= Dropdown =======================
  945. '&-dropdown': _extends(_extends(_extends({}, resetComponent(token)), genPanelStyle(token)), {
  946. position: 'absolute',
  947. // Fix incorrect position of picker popup
  948. // https://github.com/ant-design/ant-design/issues/35590
  949. top: -9999,
  950. left: {
  951. _skip_check_: true,
  952. value: -9999
  953. },
  954. zIndex: zIndexPopup,
  955. [`&${componentCls}-dropdown-hidden`]: {
  956. display: 'none'
  957. },
  958. [`&${componentCls}-dropdown-placement-bottomLeft`]: {
  959. [`${componentCls}-range-arrow`]: {
  960. top: 0,
  961. display: 'block',
  962. transform: 'translateY(-100%)'
  963. }
  964. },
  965. [`&${componentCls}-dropdown-placement-topLeft`]: {
  966. [`${componentCls}-range-arrow`]: {
  967. bottom: 0,
  968. display: 'block',
  969. transform: 'translateY(100%) rotate(180deg)'
  970. }
  971. },
  972. [`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-topLeft,
  973. &${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-topRight,
  974. &${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-topLeft,
  975. &${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-topRight`]: {
  976. animationName: slideDownIn
  977. },
  978. [`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-bottomLeft,
  979. &${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-bottomRight,
  980. &${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-bottomLeft,
  981. &${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-bottomRight`]: {
  982. animationName: slideUpIn
  983. },
  984. [`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-topLeft,
  985. &${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-topRight`]: {
  986. animationName: slideDownOut
  987. },
  988. [`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-bottomLeft,
  989. &${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-bottomRight`]: {
  990. animationName: slideUpOut
  991. },
  992. // Time picker with additional style
  993. [`${componentCls}-panel > ${componentCls}-time-panel`]: {
  994. paddingTop: paddingXXS
  995. },
  996. // ======================== Ranges ========================
  997. [`${componentCls}-ranges`]: {
  998. marginBottom: 0,
  999. padding: `${paddingXXS}px ${paddingSM}px`,
  1000. overflow: 'hidden',
  1001. lineHeight: `${pickerTextHeight - 2 * lineWidth - paddingXS / 2}px`,
  1002. textAlign: 'start',
  1003. listStyle: 'none',
  1004. display: 'flex',
  1005. justifyContent: 'space-between',
  1006. '> li': {
  1007. display: 'inline-block'
  1008. },
  1009. // https://github.com/ant-design/ant-design/issues/23687
  1010. [`${componentCls}-preset > ${antCls}-tag-blue`]: {
  1011. color: colorPrimary,
  1012. background: controlItemBgActive,
  1013. borderColor: colorPrimaryBorder,
  1014. cursor: 'pointer'
  1015. },
  1016. [`${componentCls}-ok`]: {
  1017. marginInlineStart: 'auto'
  1018. }
  1019. },
  1020. [`${componentCls}-range-wrapper`]: {
  1021. display: 'flex',
  1022. position: 'relative'
  1023. },
  1024. [`${componentCls}-range-arrow`]: _extends({
  1025. position: 'absolute',
  1026. zIndex: 1,
  1027. display: 'none',
  1028. marginInlineStart: inputPaddingHorizontal * 1.5,
  1029. transition: `left ${motionDurationSlow} ease-out`
  1030. }, roundedArrow(sizePopupArrow, borderRadiusXS, borderRadiusOuter, colorBgElevated, boxShadowPopoverArrow)),
  1031. [`${componentCls}-panel-container`]: {
  1032. overflow: 'hidden',
  1033. verticalAlign: 'top',
  1034. background: colorBgElevated,
  1035. borderRadius: borderRadiusLG,
  1036. boxShadow: boxShadowSecondary,
  1037. transition: `margin ${motionDurationSlow}`,
  1038. // ======================== Layout ========================
  1039. [`${componentCls}-panel-layout`]: {
  1040. display: 'flex',
  1041. flexWrap: 'nowrap',
  1042. alignItems: 'stretch'
  1043. },
  1044. // ======================== Preset ========================
  1045. [`${componentCls}-presets`]: {
  1046. display: 'flex',
  1047. flexDirection: 'column',
  1048. minWidth: presetsWidth,
  1049. maxWidth: presetsMaxWidth,
  1050. ul: {
  1051. height: 0,
  1052. flex: 'auto',
  1053. listStyle: 'none',
  1054. overflow: 'auto',
  1055. margin: 0,
  1056. padding: paddingXS,
  1057. borderInlineEnd: `${lineWidth}px ${lineType} ${colorSplit}`,
  1058. li: _extends(_extends({}, textEllipsis), {
  1059. borderRadius: borderRadiusSM,
  1060. paddingInline: paddingXS,
  1061. paddingBlock: (controlHeightSM - Math.round(fontSize * lineHeight)) / 2,
  1062. cursor: 'pointer',
  1063. transition: `all ${motionDurationSlow}`,
  1064. '+ li': {
  1065. marginTop: marginXS
  1066. },
  1067. '&:hover': {
  1068. background: controlItemBgHover
  1069. }
  1070. })
  1071. }
  1072. },
  1073. // ======================== Panels ========================
  1074. [`${componentCls}-panels`]: {
  1075. display: 'inline-flex',
  1076. flexWrap: 'nowrap',
  1077. direction: 'ltr',
  1078. [`${componentCls}-panel`]: {
  1079. borderWidth: `0 0 ${lineWidth}px`
  1080. },
  1081. '&:last-child': {
  1082. [`${componentCls}-panel`]: {
  1083. borderWidth: 0
  1084. }
  1085. }
  1086. },
  1087. [`${componentCls}-panel`]: {
  1088. verticalAlign: 'top',
  1089. background: 'transparent',
  1090. borderRadius: 0,
  1091. borderWidth: 0,
  1092. [`${componentCls}-content,
  1093. table`]: {
  1094. textAlign: 'center'
  1095. },
  1096. '&-focused': {
  1097. borderColor: colorBorder
  1098. }
  1099. }
  1100. }
  1101. }),
  1102. '&-dropdown-range': {
  1103. padding: `${sizePopupArrow * 2 / 3}px 0`,
  1104. '&-hidden': {
  1105. display: 'none'
  1106. }
  1107. },
  1108. '&-rtl': {
  1109. direction: 'rtl',
  1110. [`${componentCls}-separator`]: {
  1111. transform: 'rotate(180deg)'
  1112. },
  1113. [`${componentCls}-footer`]: {
  1114. '&-extra': {
  1115. direction: 'rtl'
  1116. }
  1117. }
  1118. }
  1119. })
  1120. },
  1121. // Follow code may reuse in other components
  1122. initSlideMotion(token, 'slide-up'), initSlideMotion(token, 'slide-down'), initMoveMotion(token, 'move-up'), initMoveMotion(token, 'move-down')];
  1123. };
  1124. export const initPickerPanelToken = token => {
  1125. const pickerTimePanelCellHeight = 28;
  1126. const {
  1127. componentCls,
  1128. controlHeightLG,
  1129. controlHeightSM,
  1130. colorPrimary,
  1131. paddingXXS
  1132. } = token;
  1133. return {
  1134. pickerCellCls: `${componentCls}-cell`,
  1135. pickerCellInnerCls: `${componentCls}-cell-inner`,
  1136. pickerTextHeight: controlHeightLG,
  1137. pickerPanelCellWidth: controlHeightSM * 1.5,
  1138. pickerPanelCellHeight: controlHeightSM,
  1139. pickerDateHoverRangeBorderColor: new TinyColor(colorPrimary).lighten(20).toHexString(),
  1140. pickerBasicCellHoverWithRangeColor: new TinyColor(colorPrimary).lighten(35).toHexString(),
  1141. pickerPanelWithoutTimeCellHeight: controlHeightLG * 1.65,
  1142. pickerYearMonthCellWidth: controlHeightLG * 1.5,
  1143. pickerTimePanelColumnHeight: pickerTimePanelCellHeight * 8,
  1144. pickerTimePanelColumnWidth: controlHeightLG * 1.4,
  1145. pickerTimePanelCellHeight,
  1146. pickerQuarterPanelContentHeight: controlHeightLG * 1.4,
  1147. pickerCellPaddingVertical: paddingXXS,
  1148. pickerCellBorderGap: 2,
  1149. pickerControlIconSize: 7,
  1150. pickerControlIconBorderWidth: 1.5
  1151. };
  1152. };
  1153. // ============================== Export ==============================
  1154. export default genComponentStyleHook('DatePicker', token => {
  1155. const pickerToken = mergeToken(initInputToken(token), initPickerPanelToken(token));
  1156. return [genPickerStyle(pickerToken), genPickerStatusStyle(pickerToken),
  1157. // =====================================================
  1158. // == Space Compact ==
  1159. // =====================================================
  1160. genCompactItemStyle(token, {
  1161. focusElCls: `${token.componentCls}-focused`
  1162. })];
  1163. }, token => ({
  1164. presetsWidth: 120,
  1165. presetsMaxWidth: 200,
  1166. zIndexPopup: token.zIndexPopupBase + 50
  1167. }));