123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.genPanelStyle = exports.default = void 0;
- var _cssinjs = require("@ant-design/cssinjs");
- var _fastColor = require("@ant-design/fast-color");
- const genPickerCellInnerStyle = token => {
- const {
- pickerCellCls,
- pickerCellInnerCls,
- cellHeight,
- borderRadiusSM,
- motionDurationMid,
- cellHoverBg,
- lineWidth,
- lineType,
- colorPrimary,
- cellActiveWithRangeBg,
- colorTextLightSolid,
- colorTextDisabled,
- cellBgDisabled,
- colorFillSecondary
- } = token;
- return {
- '&::before': {
- position: 'absolute',
- top: '50%',
- insetInlineStart: 0,
- insetInlineEnd: 0,
- zIndex: 1,
- height: cellHeight,
- transform: 'translateY(-50%)',
- content: '""',
- pointerEvents: 'none'
- },
- // >>> Default
- [pickerCellInnerCls]: {
- position: 'relative',
- zIndex: 2,
- display: 'inline-block',
- minWidth: cellHeight,
- height: cellHeight,
- lineHeight: (0, _cssinjs.unit)(cellHeight),
- borderRadius: borderRadiusSM,
- transition: `background ${motionDurationMid}`
- },
- // >>> Hover
- [`&:hover:not(${pickerCellCls}-in-view):not(${pickerCellCls}-disabled),
- &:hover:not(${pickerCellCls}-selected):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end):not(${pickerCellCls}-disabled)`]: {
- [pickerCellInnerCls]: {
- background: cellHoverBg
- }
- },
- // >>> Today
- [`&-in-view${pickerCellCls}-today ${pickerCellInnerCls}`]: {
- '&::before': {
- position: 'absolute',
- top: 0,
- insetInlineEnd: 0,
- bottom: 0,
- insetInlineStart: 0,
- zIndex: 1,
- border: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorPrimary}`,
- borderRadius: borderRadiusSM,
- content: '""'
- }
- },
- // >>> In Range
- [`&-in-view${pickerCellCls}-in-range,
- &-in-view${pickerCellCls}-range-start,
- &-in-view${pickerCellCls}-range-end`]: {
- position: 'relative',
- [`&:not(${pickerCellCls}-disabled):before`]: {
- background: cellActiveWithRangeBg
- }
- },
- // >>> Selected
- [`&-in-view${pickerCellCls}-selected,
- &-in-view${pickerCellCls}-range-start,
- &-in-view${pickerCellCls}-range-end`]: {
- [`&:not(${pickerCellCls}-disabled) ${pickerCellInnerCls}`]: {
- color: colorTextLightSolid,
- background: colorPrimary
- },
- [`&${pickerCellCls}-disabled ${pickerCellInnerCls}`]: {
- background: colorFillSecondary
- }
- },
- [`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-disabled):before`]: {
- insetInlineStart: '50%'
- },
- [`&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-disabled):before`]: {
- insetInlineEnd: '50%'
- },
- // range start border-radius
- [`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-end) ${pickerCellInnerCls}`]: {
- borderStartStartRadius: borderRadiusSM,
- borderEndStartRadius: borderRadiusSM,
- borderStartEndRadius: 0,
- borderEndEndRadius: 0
- },
- // range end border-radius
- [`&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-start) ${pickerCellInnerCls}`]: {
- borderStartStartRadius: 0,
- borderEndStartRadius: 0,
- borderStartEndRadius: borderRadiusSM,
- borderEndEndRadius: borderRadiusSM
- },
- // >>> Disabled
- '&-disabled': {
- color: colorTextDisabled,
- cursor: 'not-allowed',
- [pickerCellInnerCls]: {
- background: 'transparent'
- },
- '&::before': {
- background: cellBgDisabled
- }
- },
- [`&-disabled${pickerCellCls}-today ${pickerCellInnerCls}::before`]: {
- borderColor: colorTextDisabled
- }
- };
- };
- const genPanelStyle = token => {
- const {
- componentCls,
- pickerCellCls,
- pickerCellInnerCls,
- pickerYearMonthCellWidth,
- pickerControlIconSize,
- cellWidth,
- paddingSM,
- paddingXS,
- paddingXXS,
- colorBgContainer,
- lineWidth,
- lineType,
- borderRadiusLG,
- colorPrimary,
- colorTextHeading,
- colorSplit,
- pickerControlIconBorderWidth,
- colorIcon,
- textHeight,
- motionDurationMid,
- colorIconHover,
- fontWeightStrong,
- cellHeight,
- pickerCellPaddingVertical,
- colorTextDisabled,
- colorText,
- fontSize,
- motionDurationSlow,
- withoutTimeCellHeight,
- pickerQuarterPanelContentHeight,
- borderRadiusSM,
- colorTextLightSolid,
- cellHoverBg,
- timeColumnHeight,
- timeColumnWidth,
- timeCellHeight,
- controlItemBgActive,
- marginXXS,
- pickerDatePanelPaddingHorizontal,
- pickerControlIconMargin
- } = token;
- const pickerPanelWidth = token.calc(cellWidth).mul(7).add(token.calc(pickerDatePanelPaddingHorizontal).mul(2)).equal();
- return {
- [componentCls]: {
- '&-panel': {
- display: 'inline-flex',
- flexDirection: 'column',
- textAlign: 'center',
- background: colorBgContainer,
- borderRadius: borderRadiusLG,
- outline: 'none',
- '&-focused': {
- borderColor: colorPrimary
- },
- '&-rtl': {
- [`${componentCls}-prev-icon,
- ${componentCls}-super-prev-icon`]: {
- transform: 'rotate(45deg)'
- },
- [`${componentCls}-next-icon,
- ${componentCls}-super-next-icon`]: {
- transform: 'rotate(-135deg)'
- },
- [`${componentCls}-time-panel`]: {
- [`${componentCls}-content`]: {
- direction: 'ltr',
- '> *': {
- direction: 'rtl'
- }
- }
- }
- }
- },
- // ========================================================
- // = Shared Panel =
- // ========================================================
- [`&-decade-panel,
- &-year-panel,
- &-quarter-panel,
- &-month-panel,
- &-week-panel,
- &-date-panel,
- &-time-panel`]: {
- display: 'flex',
- flexDirection: 'column',
- width: pickerPanelWidth
- },
- // ======================= Header =======================
- '&-header': {
- display: 'flex',
- padding: `0 ${(0, _cssinjs.unit)(paddingXS)}`,
- color: colorTextHeading,
- borderBottom: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`,
- '> *': {
- flex: 'none'
- },
- button: {
- padding: 0,
- color: colorIcon,
- lineHeight: (0, _cssinjs.unit)(textHeight),
- background: 'transparent',
- border: 0,
- cursor: 'pointer',
- transition: `color ${motionDurationMid}`,
- fontSize: 'inherit',
- display: 'inline-flex',
- alignItems: 'center',
- justifyContent: 'center',
- '&:empty': {
- display: 'none'
- }
- },
- '> button': {
- minWidth: '1.6em',
- fontSize,
- '&:hover': {
- color: colorIconHover
- },
- '&:disabled': {
- opacity: 0.25,
- pointerEvents: 'none'
- }
- },
- '&-view': {
- flex: 'auto',
- fontWeight: fontWeightStrong,
- lineHeight: (0, _cssinjs.unit)(textHeight),
- '> button': {
- color: 'inherit',
- fontWeight: 'inherit',
- verticalAlign: 'top',
- '&:not(:first-child)': {
- marginInlineStart: paddingXS
- },
- '&:hover': {
- color: colorPrimary
- }
- }
- }
- },
- // Arrow button
- [`&-prev-icon,
- &-next-icon,
- &-super-prev-icon,
- &-super-next-icon`]: {
- position: 'relative',
- width: pickerControlIconSize,
- height: pickerControlIconSize,
- '&::before': {
- position: 'absolute',
- top: 0,
- insetInlineStart: 0,
- width: pickerControlIconSize,
- height: pickerControlIconSize,
- border: `0 solid currentcolor`,
- borderBlockStartWidth: pickerControlIconBorderWidth,
- borderInlineStartWidth: pickerControlIconBorderWidth,
- content: '""'
- }
- },
- [`&-super-prev-icon,
- &-super-next-icon`]: {
- '&::after': {
- position: 'absolute',
- top: pickerControlIconMargin,
- insetInlineStart: pickerControlIconMargin,
- display: 'inline-block',
- width: pickerControlIconSize,
- height: pickerControlIconSize,
- border: '0 solid currentcolor',
- borderBlockStartWidth: pickerControlIconBorderWidth,
- borderInlineStartWidth: pickerControlIconBorderWidth,
- content: '""'
- }
- },
- '&-prev-icon, &-super-prev-icon': {
- transform: 'rotate(-45deg)'
- },
- '&-next-icon, &-super-next-icon': {
- transform: 'rotate(135deg)'
- },
- // ======================== Body ========================
- '&-content': {
- width: '100%',
- tableLayout: 'fixed',
- borderCollapse: 'collapse',
- 'th, td': {
- position: 'relative',
- minWidth: cellHeight,
- fontWeight: 'normal'
- },
- th: {
- height: token.calc(cellHeight).add(token.calc(pickerCellPaddingVertical).mul(2)).equal(),
- color: colorText,
- verticalAlign: 'middle'
- }
- },
- '&-cell': Object.assign({
- padding: `${(0, _cssinjs.unit)(pickerCellPaddingVertical)} 0`,
- color: colorTextDisabled,
- cursor: 'pointer',
- // In view
- '&-in-view': {
- color: colorText
- }
- }, genPickerCellInnerStyle(token)),
- [`&-decade-panel,
- &-year-panel,
- &-quarter-panel,
- &-month-panel`]: {
- [`${componentCls}-content`]: {
- height: token.calc(withoutTimeCellHeight).mul(4).equal()
- },
- [pickerCellInnerCls]: {
- padding: `0 ${(0, _cssinjs.unit)(paddingXS)}`
- }
- },
- '&-quarter-panel': {
- [`${componentCls}-content`]: {
- height: pickerQuarterPanelContentHeight
- }
- },
- // ========================================================
- // = Special =
- // ========================================================
- // ===================== Decade Panel =====================
- '&-decade-panel': {
- [pickerCellInnerCls]: {
- padding: `0 ${(0, _cssinjs.unit)(token.calc(paddingXS).div(2).equal())}`
- },
- [`${componentCls}-cell::before`]: {
- display: 'none'
- }
- },
- // ============= Year & Quarter & Month Panel =============
- [`&-year-panel,
- &-quarter-panel,
- &-month-panel`]: {
- [`${componentCls}-body`]: {
- padding: `0 ${(0, _cssinjs.unit)(paddingXS)}`
- },
- [pickerCellInnerCls]: {
- width: pickerYearMonthCellWidth
- }
- },
- // ====================== Date Panel ======================
- '&-date-panel': {
- [`${componentCls}-body`]: {
- padding: `${(0, _cssinjs.unit)(paddingXS)} ${(0, _cssinjs.unit)(pickerDatePanelPaddingHorizontal)}`
- },
- [`${componentCls}-content th`]: {
- boxSizing: 'border-box',
- padding: 0
- }
- },
- // ====================== Week Panel ======================
- '&-week-panel-row': {
- td: {
- '&:before': {
- transition: `background ${motionDurationMid}`
- },
- '&:first-child:before': {
- borderStartStartRadius: borderRadiusSM,
- borderEndStartRadius: borderRadiusSM
- },
- '&:last-child:before': {
- borderStartEndRadius: borderRadiusSM,
- borderEndEndRadius: borderRadiusSM
- }
- },
- '&:hover td:before': {
- background: cellHoverBg
- },
- '&-range-start td, &-range-end td, &-selected td, &-hover td': {
- // Rise priority to override hover style
- [`&${pickerCellCls}`]: {
- '&:before': {
- background: colorPrimary
- },
- [`&${componentCls}-cell-week`]: {
- color: new _fastColor.FastColor(colorTextLightSolid).setA(0.5).toHexString()
- },
- [pickerCellInnerCls]: {
- color: colorTextLightSolid
- }
- }
- },
- '&-range-hover td:before': {
- background: controlItemBgActive
- }
- },
- // >>> ShowWeek
- '&-week-panel, &-date-panel-show-week': {
- [`${componentCls}-body`]: {
- padding: `${(0, _cssinjs.unit)(paddingXS)} ${(0, _cssinjs.unit)(paddingSM)}`
- },
- [`${componentCls}-content th`]: {
- width: 'auto'
- }
- },
- // ==================== Datetime Panel ====================
- '&-datetime-panel': {
- display: 'flex',
- [`${componentCls}-time-panel`]: {
- borderInlineStart: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`
- },
- [`${componentCls}-date-panel,
- ${componentCls}-time-panel`]: {
- transition: `opacity ${motionDurationSlow}`
- },
- // Keyboard
- '&-active': {
- [`${componentCls}-date-panel,
- ${componentCls}-time-panel`]: {
- opacity: 0.3,
- '&-active': {
- opacity: 1
- }
- }
- }
- },
- // ====================== Time Panel ======================
- '&-time-panel': {
- width: 'auto',
- minWidth: 'auto',
- [`${componentCls}-content`]: {
- display: 'flex',
- flex: 'auto',
- height: timeColumnHeight
- },
- '&-column': {
- flex: '1 0 auto',
- width: timeColumnWidth,
- margin: `${(0, _cssinjs.unit)(paddingXXS)} 0`,
- padding: 0,
- overflowY: 'hidden',
- textAlign: 'start',
- listStyle: 'none',
- transition: `background ${motionDurationMid}`,
- overflowX: 'hidden',
- '&::-webkit-scrollbar': {
- width: 8,
- backgroundColor: 'transparent'
- },
- '&::-webkit-scrollbar-thumb': {
- backgroundColor: token.colorTextTertiary,
- borderRadius: token.borderRadiusSM
- },
- // For Firefox
- '&': {
- scrollbarWidth: 'thin',
- scrollbarColor: `${token.colorTextTertiary} transparent`
- },
- '&::after': {
- display: 'block',
- height: `calc(100% - ${(0, _cssinjs.unit)(timeCellHeight)})`,
- content: '""'
- },
- '&:not(:first-child)': {
- borderInlineStart: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`
- },
- '&-active': {
- background: new _fastColor.FastColor(controlItemBgActive).setA(0.2).toHexString()
- },
- '&:hover': {
- overflowY: 'auto'
- },
- '> li': {
- margin: 0,
- padding: 0,
- [`&${componentCls}-time-panel-cell`]: {
- marginInline: marginXXS,
- [`${componentCls}-time-panel-cell-inner`]: {
- display: 'block',
- width: token.calc(timeColumnWidth).sub(token.calc(marginXXS).mul(2)).equal(),
- height: timeCellHeight,
- margin: 0,
- paddingBlock: 0,
- paddingInlineEnd: 0,
- paddingInlineStart: token.calc(timeColumnWidth).sub(timeCellHeight).div(2).equal(),
- color: colorText,
- lineHeight: (0, _cssinjs.unit)(timeCellHeight),
- borderRadius: borderRadiusSM,
- cursor: 'pointer',
- transition: `background ${motionDurationMid}`,
- '&:hover': {
- background: cellHoverBg
- }
- },
- '&-selected': {
- [`${componentCls}-time-panel-cell-inner`]: {
- background: controlItemBgActive
- }
- },
- '&-disabled': {
- [`${componentCls}-time-panel-cell-inner`]: {
- color: colorTextDisabled,
- background: 'transparent',
- cursor: 'not-allowed'
- }
- }
- }
- }
- }
- }
- }
- };
- };
- exports.genPanelStyle = genPanelStyle;
- const genPickerPanelStyle = token => {
- const {
- componentCls,
- textHeight,
- lineWidth,
- paddingSM,
- antCls,
- colorPrimary,
- cellActiveWithRangeBg,
- colorPrimaryBorder,
- lineType,
- colorSplit
- } = token;
- return {
- [`${componentCls}-dropdown`]: {
- // ======================== Footer ========================
- [`${componentCls}-footer`]: {
- borderTop: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`,
- '&-extra': {
- padding: `0 ${(0, _cssinjs.unit)(paddingSM)}`,
- lineHeight: (0, _cssinjs.unit)(token.calc(textHeight).sub(token.calc(lineWidth).mul(2)).equal()),
- textAlign: 'start',
- '&:not(:last-child)': {
- borderBottom: `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${colorSplit}`
- }
- }
- },
- // ==================== Footer > Ranges ===================
- [`${componentCls}-panels + ${componentCls}-footer ${componentCls}-ranges`]: {
- justifyContent: 'space-between'
- },
- [`${componentCls}-ranges`]: {
- marginBlock: 0,
- paddingInline: (0, _cssinjs.unit)(paddingSM),
- overflow: 'hidden',
- textAlign: 'start',
- listStyle: 'none',
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'center',
- '> li': {
- lineHeight: (0, _cssinjs.unit)(token.calc(textHeight).sub(token.calc(lineWidth).mul(2)).equal()),
- display: 'inline-block'
- },
- [`${componentCls}-now-btn-disabled`]: {
- pointerEvents: 'none',
- color: token.colorTextDisabled
- },
- // https://github.com/ant-design/ant-design/issues/23687
- [`${componentCls}-preset > ${antCls}-tag-blue`]: {
- color: colorPrimary,
- background: cellActiveWithRangeBg,
- borderColor: colorPrimaryBorder,
- cursor: 'pointer'
- },
- [`${componentCls}-ok`]: {
- paddingBlock: token.calc(lineWidth).mul(2).equal(),
- marginInlineStart: 'auto'
- }
- }
- }
- };
- };
- var _default = exports.default = genPickerPanelStyle;
|