123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.prepareToken = exports.prepareComponentToken = exports.default = void 0;
- var _cssinjs = require("@ant-design/cssinjs");
- var _style = require("../../input/style");
- var _variants = require("../../input/style/variants");
- var _style2 = require("../../style");
- var _internal = require("../../theme/internal");
- const genPaginationDisabledStyle = token => {
- const {
- componentCls
- } = token;
- return {
- [`${componentCls}-disabled`]: {
- '&, &:hover': {
- cursor: 'not-allowed',
- [`${componentCls}-item-link`]: {
- color: token.colorTextDisabled,
- cursor: 'not-allowed'
- }
- },
- '&:focus-visible': {
- cursor: 'not-allowed',
- [`${componentCls}-item-link`]: {
- color: token.colorTextDisabled,
- cursor: 'not-allowed'
- }
- }
- },
- [`&${componentCls}-disabled`]: {
- cursor: 'not-allowed',
- [`${componentCls}-item`]: {
- cursor: 'not-allowed',
- backgroundColor: 'transparent',
- '&:hover, &:active': {
- backgroundColor: 'transparent'
- },
- a: {
- color: token.colorTextDisabled,
- backgroundColor: 'transparent',
- border: 'none',
- cursor: 'not-allowed'
- },
- '&-active': {
- borderColor: token.colorBorder,
- backgroundColor: token.itemActiveBgDisabled,
- '&:hover, &:active': {
- backgroundColor: token.itemActiveBgDisabled
- },
- a: {
- color: token.itemActiveColorDisabled
- }
- }
- },
- [`${componentCls}-item-link`]: {
- color: token.colorTextDisabled,
- cursor: 'not-allowed',
- '&:hover, &:active': {
- backgroundColor: 'transparent'
- },
- [`${componentCls}-simple&`]: {
- backgroundColor: 'transparent',
- '&:hover, &:active': {
- backgroundColor: 'transparent'
- }
- }
- },
- [`${componentCls}-simple-pager`]: {
- color: token.colorTextDisabled
- },
- [`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
- [`${componentCls}-item-link-icon`]: {
- opacity: 0
- },
- [`${componentCls}-item-ellipsis`]: {
- opacity: 1
- }
- }
- }
- };
- };
- const genPaginationMiniStyle = token => {
- const {
- componentCls
- } = token;
- return {
- [`&${componentCls}-mini ${componentCls}-total-text, &${componentCls}-mini ${componentCls}-simple-pager`]: {
- height: token.itemSizeSM,
- lineHeight: (0, _cssinjs.unit)(token.itemSizeSM)
- },
- [`&${componentCls}-mini ${componentCls}-item`]: {
- minWidth: token.itemSizeSM,
- height: token.itemSizeSM,
- margin: 0,
- lineHeight: (0, _cssinjs.unit)(token.calc(token.itemSizeSM).sub(2).equal())
- },
- [`&${componentCls}-mini ${componentCls}-prev, &${componentCls}-mini ${componentCls}-next`]: {
- minWidth: token.itemSizeSM,
- height: token.itemSizeSM,
- margin: 0,
- lineHeight: (0, _cssinjs.unit)(token.itemSizeSM)
- },
- [`&${componentCls}-mini:not(${componentCls}-disabled)`]: {
- [`${componentCls}-prev, ${componentCls}-next`]: {
- [`&:hover ${componentCls}-item-link`]: {
- backgroundColor: token.colorBgTextHover
- },
- [`&:active ${componentCls}-item-link`]: {
- backgroundColor: token.colorBgTextActive
- },
- [`&${componentCls}-disabled:hover ${componentCls}-item-link`]: {
- backgroundColor: 'transparent'
- }
- }
- },
- [`
- &${componentCls}-mini ${componentCls}-prev ${componentCls}-item-link,
- &${componentCls}-mini ${componentCls}-next ${componentCls}-item-link
- `]: {
- backgroundColor: 'transparent',
- borderColor: 'transparent',
- '&::after': {
- height: token.itemSizeSM,
- lineHeight: (0, _cssinjs.unit)(token.itemSizeSM)
- }
- },
- [`&${componentCls}-mini ${componentCls}-jump-prev, &${componentCls}-mini ${componentCls}-jump-next`]: {
- height: token.itemSizeSM,
- marginInlineEnd: 0,
- lineHeight: (0, _cssinjs.unit)(token.itemSizeSM)
- },
- [`&${componentCls}-mini ${componentCls}-options`]: {
- marginInlineStart: token.paginationMiniOptionsMarginInlineStart,
- '&-size-changer': {
- top: token.miniOptionsSizeChangerTop
- },
- '&-quick-jumper': {
- height: token.itemSizeSM,
- lineHeight: (0, _cssinjs.unit)(token.itemSizeSM),
- input: Object.assign(Object.assign({}, (0, _style.genInputSmallStyle)(token)), {
- width: token.paginationMiniQuickJumperInputWidth,
- height: token.controlHeightSM
- })
- }
- }
- };
- };
- const genPaginationSimpleStyle = token => {
- const {
- componentCls
- } = token;
- return {
- [`&${componentCls}-simple`]: {
- [`${componentCls}-prev, ${componentCls}-next`]: {
- height: token.itemSize,
- lineHeight: (0, _cssinjs.unit)(token.itemSize),
- verticalAlign: 'top',
- [`${componentCls}-item-link`]: {
- height: token.itemSize,
- backgroundColor: 'transparent',
- border: 0,
- '&:hover': {
- backgroundColor: token.colorBgTextHover
- },
- '&:active': {
- backgroundColor: token.colorBgTextActive
- },
- '&::after': {
- height: token.itemSize,
- lineHeight: (0, _cssinjs.unit)(token.itemSize)
- }
- }
- },
- [`${componentCls}-simple-pager`]: {
- display: 'inline-flex',
- alignItems: 'center',
- height: token.itemSize,
- marginInlineEnd: token.marginXS,
- input: {
- boxSizing: 'border-box',
- height: '100%',
- width: token.quickJumperInputWidth,
- padding: `0 ${(0, _cssinjs.unit)(token.paginationItemPaddingInline)}`,
- textAlign: 'center',
- backgroundColor: token.itemInputBg,
- border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
- borderRadius: token.borderRadius,
- outline: 'none',
- transition: `border-color ${token.motionDurationMid}`,
- color: 'inherit',
- '&:hover': {
- borderColor: token.colorPrimary
- },
- '&:focus': {
- borderColor: token.colorPrimaryHover,
- boxShadow: `${(0, _cssinjs.unit)(token.inputOutlineOffset)} 0 ${(0, _cssinjs.unit)(token.controlOutlineWidth)} ${token.controlOutline}`
- },
- '&[disabled]': {
- color: token.colorTextDisabled,
- backgroundColor: token.colorBgContainerDisabled,
- borderColor: token.colorBorder,
- cursor: 'not-allowed'
- }
- }
- },
- [`&${componentCls}-disabled`]: {
- [`${componentCls}-prev, ${componentCls}-next`]: {
- [`${componentCls}-item-link`]: {
- '&:hover, &:active': {
- backgroundColor: 'transparent'
- }
- }
- }
- },
- [`&${componentCls}-mini`]: {
- [`${componentCls}-prev, ${componentCls}-next`]: {
- height: token.itemSizeSM,
- lineHeight: (0, _cssinjs.unit)(token.itemSizeSM),
- [`${componentCls}-item-link`]: {
- height: token.itemSizeSM,
- '&::after': {
- height: token.itemSizeSM,
- lineHeight: (0, _cssinjs.unit)(token.itemSizeSM)
- }
- }
- },
- [`${componentCls}-simple-pager`]: {
- height: token.itemSizeSM,
- input: {
- width: token.paginationMiniQuickJumperInputWidth
- }
- }
- }
- }
- };
- };
- const genPaginationJumpStyle = token => {
- const {
- componentCls
- } = token;
- return {
- [`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
- outline: 0,
- [`${componentCls}-item-container`]: {
- position: 'relative',
- [`${componentCls}-item-link-icon`]: {
- color: token.colorPrimary,
- fontSize: token.fontSizeSM,
- opacity: 0,
- transition: `all ${token.motionDurationMid}`,
- '&-svg': {
- top: 0,
- insetInlineEnd: 0,
- bottom: 0,
- insetInlineStart: 0,
- margin: 'auto'
- }
- },
- [`${componentCls}-item-ellipsis`]: {
- position: 'absolute',
- top: 0,
- insetInlineEnd: 0,
- bottom: 0,
- insetInlineStart: 0,
- display: 'block',
- margin: 'auto',
- color: token.colorTextDisabled,
- letterSpacing: token.paginationEllipsisLetterSpacing,
- textAlign: 'center',
- textIndent: token.paginationEllipsisTextIndent,
- opacity: 1,
- transition: `all ${token.motionDurationMid}`
- }
- },
- '&:hover': {
- [`${componentCls}-item-link-icon`]: {
- opacity: 1
- },
- [`${componentCls}-item-ellipsis`]: {
- opacity: 0
- }
- }
- },
- [`
- ${componentCls}-prev,
- ${componentCls}-jump-prev,
- ${componentCls}-jump-next
- `]: {
- marginInlineEnd: token.marginXS
- },
- [`
- ${componentCls}-prev,
- ${componentCls}-next,
- ${componentCls}-jump-prev,
- ${componentCls}-jump-next
- `]: {
- display: 'inline-block',
- minWidth: token.itemSize,
- height: token.itemSize,
- color: token.colorText,
- fontFamily: token.fontFamily,
- lineHeight: (0, _cssinjs.unit)(token.itemSize),
- textAlign: 'center',
- verticalAlign: 'middle',
- listStyle: 'none',
- borderRadius: token.borderRadius,
- cursor: 'pointer',
- transition: `all ${token.motionDurationMid}`
- },
- [`${componentCls}-prev, ${componentCls}-next`]: {
- outline: 0,
- button: {
- color: token.colorText,
- cursor: 'pointer',
- userSelect: 'none'
- },
- [`${componentCls}-item-link`]: {
- display: 'block',
- width: '100%',
- height: '100%',
- padding: 0,
- fontSize: token.fontSizeSM,
- textAlign: 'center',
- backgroundColor: 'transparent',
- border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} transparent`,
- borderRadius: token.borderRadius,
- outline: 'none',
- transition: `all ${token.motionDurationMid}`
- },
- [`&:hover ${componentCls}-item-link`]: {
- backgroundColor: token.colorBgTextHover
- },
- [`&:active ${componentCls}-item-link`]: {
- backgroundColor: token.colorBgTextActive
- },
- [`&${componentCls}-disabled:hover`]: {
- [`${componentCls}-item-link`]: {
- backgroundColor: 'transparent'
- }
- }
- },
- [`${componentCls}-slash`]: {
- marginInlineEnd: token.paginationSlashMarginInlineEnd,
- marginInlineStart: token.paginationSlashMarginInlineStart
- },
- [`${componentCls}-options`]: {
- display: 'inline-block',
- marginInlineStart: token.margin,
- verticalAlign: 'middle',
- '&-size-changer': {
- display: 'inline-block',
- width: 'auto'
- },
- '&-quick-jumper': {
- display: 'inline-block',
- height: token.controlHeight,
- marginInlineStart: token.marginXS,
- lineHeight: (0, _cssinjs.unit)(token.controlHeight),
- verticalAlign: 'top',
- input: Object.assign(Object.assign(Object.assign({}, (0, _style.genBasicInputStyle)(token)), (0, _variants.genBaseOutlinedStyle)(token, {
- borderColor: token.colorBorder,
- hoverBorderColor: token.colorPrimaryHover,
- activeBorderColor: token.colorPrimary,
- activeShadow: token.activeShadow
- })), {
- '&[disabled]': Object.assign({}, (0, _variants.genDisabledStyle)(token)),
- width: token.quickJumperInputWidth,
- height: token.controlHeight,
- boxSizing: 'border-box',
- margin: 0,
- marginInlineStart: token.marginXS,
- marginInlineEnd: token.marginXS
- })
- }
- }
- };
- };
- const genPaginationItemStyle = token => {
- const {
- componentCls
- } = token;
- return {
- [`${componentCls}-item`]: {
- display: 'inline-block',
- minWidth: token.itemSize,
- height: token.itemSize,
- marginInlineEnd: token.marginXS,
- fontFamily: token.fontFamily,
- lineHeight: (0, _cssinjs.unit)(token.calc(token.itemSize).sub(2).equal()),
- textAlign: 'center',
- verticalAlign: 'middle',
- listStyle: 'none',
- backgroundColor: token.itemBg,
- border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} transparent`,
- borderRadius: token.borderRadius,
- outline: 0,
- cursor: 'pointer',
- userSelect: 'none',
- a: {
- display: 'block',
- padding: `0 ${(0, _cssinjs.unit)(token.paginationItemPaddingInline)}`,
- color: token.colorText,
- '&:hover': {
- textDecoration: 'none'
- }
- },
- [`&:not(${componentCls}-item-active)`]: {
- '&:hover': {
- transition: `all ${token.motionDurationMid}`,
- backgroundColor: token.colorBgTextHover
- },
- '&:active': {
- backgroundColor: token.colorBgTextActive
- }
- },
- '&-active': {
- fontWeight: token.fontWeightStrong,
- backgroundColor: token.itemActiveBg,
- borderColor: token.colorPrimary,
- a: {
- color: token.colorPrimary
- },
- '&:hover': {
- borderColor: token.colorPrimaryHover
- },
- '&:hover a': {
- color: token.colorPrimaryHover
- }
- }
- }
- };
- };
- const genPaginationStyle = token => {
- const {
- componentCls
- } = token;
- return {
- [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, _style2.resetComponent)(token)), {
- display: 'flex',
- '&-start': {
- justifyContent: 'start'
- },
- '&-center': {
- justifyContent: 'center'
- },
- '&-end': {
- justifyContent: 'end'
- },
- 'ul, ol': {
- margin: 0,
- padding: 0,
- listStyle: 'none'
- },
- '&::after': {
- display: 'block',
- clear: 'both',
- height: 0,
- overflow: 'hidden',
- visibility: 'hidden',
- content: '""'
- },
- [`${componentCls}-total-text`]: {
- display: 'inline-block',
- height: token.itemSize,
- marginInlineEnd: token.marginXS,
- lineHeight: (0, _cssinjs.unit)(token.calc(token.itemSize).sub(2).equal()),
- verticalAlign: 'middle'
- }
- }), genPaginationItemStyle(token)), genPaginationJumpStyle(token)), genPaginationSimpleStyle(token)), genPaginationMiniStyle(token)), genPaginationDisabledStyle(token)), {
- // media query style
- [`@media only screen and (max-width: ${token.screenLG}px)`]: {
- [`${componentCls}-item`]: {
- '&-after-jump-prev, &-before-jump-next': {
- display: 'none'
- }
- }
- },
- [`@media only screen and (max-width: ${token.screenSM}px)`]: {
- [`${componentCls}-options`]: {
- display: 'none'
- }
- }
- }),
- // rtl style
- [`&${token.componentCls}-rtl`]: {
- direction: 'rtl'
- }
- };
- };
- const genPaginationFocusStyle = token => {
- const {
- componentCls
- } = token;
- return {
- [`${componentCls}:not(${componentCls}-disabled)`]: {
- [`${componentCls}-item`]: Object.assign({}, (0, _style2.genFocusStyle)(token)),
- [`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
- '&:focus-visible': Object.assign({
- [`${componentCls}-item-link-icon`]: {
- opacity: 1
- },
- [`${componentCls}-item-ellipsis`]: {
- opacity: 0
- }
- }, (0, _style2.genFocusOutline)(token))
- },
- [`${componentCls}-prev, ${componentCls}-next`]: {
- [`&:focus-visible ${componentCls}-item-link`]: (0, _style2.genFocusOutline)(token)
- }
- }
- };
- };
- const prepareComponentToken = token => Object.assign({
- itemBg: token.colorBgContainer,
- itemSize: token.controlHeight,
- itemSizeSM: token.controlHeightSM,
- itemActiveBg: token.colorBgContainer,
- itemLinkBg: token.colorBgContainer,
- itemActiveColorDisabled: token.colorTextDisabled,
- itemActiveBgDisabled: token.controlItemBgActiveDisabled,
- itemInputBg: token.colorBgContainer,
- miniOptionsSizeChangerTop: 0
- }, (0, _style.initComponentToken)(token));
- exports.prepareComponentToken = prepareComponentToken;
- const prepareToken = token => (0, _internal.mergeToken)(token, {
- inputOutlineOffset: 0,
- quickJumperInputWidth: token.calc(token.controlHeightLG).mul(1.25).equal(),
- paginationMiniOptionsMarginInlineStart: token.calc(token.marginXXS).div(2).equal(),
- paginationMiniQuickJumperInputWidth: token.calc(token.controlHeightLG).mul(1.1).equal(),
- paginationItemPaddingInline: token.calc(token.marginXXS).mul(1.5).equal(),
- paginationEllipsisLetterSpacing: token.calc(token.marginXXS).div(2).equal(),
- paginationSlashMarginInlineStart: token.marginSM,
- paginationSlashMarginInlineEnd: token.marginSM,
- paginationEllipsisTextIndent: '0.13em' // magic for ui experience
- }, (0, _style.initInputToken)(token));
- // ============================== Export ==============================
- exports.prepareToken = prepareToken;
- var _default = exports.default = (0, _internal.genStyleHooks)('Pagination', token => {
- const paginationToken = prepareToken(token);
- return [genPaginationStyle(paginationToken), genPaginationFocusStyle(paginationToken)];
- }, prepareComponentToken);
|