1 line
38 KiB
JSON
1 line
38 KiB
JSON
|
{"ast":null,"code":"import { unit } from '@ant-design/cssinjs';\nimport { genFocusStyle } from '../../style';\nimport { genStyleHooks, mergeToken } from '../../theme/internal';\nimport genGroupStyle from './group';\nimport { prepareComponentToken, prepareToken } from './token';\n// ============================== Shared ==============================\nconst genSharedButtonStyle = token => {\n const {\n componentCls,\n iconCls,\n fontWeight\n } = token;\n return {\n [componentCls]: {\n outline: 'none',\n position: 'relative',\n display: 'inline-flex',\n gap: token.marginXS,\n alignItems: 'center',\n justifyContent: 'center',\n fontWeight,\n whiteSpace: 'nowrap',\n textAlign: 'center',\n backgroundImage: 'none',\n background: 'transparent',\n border: `${unit(token.lineWidth)} ${token.lineType} transparent`,\n cursor: 'pointer',\n transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,\n userSelect: 'none',\n touchAction: 'manipulation',\n color: token.colorText,\n '&:disabled > *': {\n pointerEvents: 'none'\n },\n '> span': {\n display: 'inline-block'\n },\n [`${componentCls}-icon`]: {\n lineHeight: 1\n },\n '> a': {\n color: 'currentColor'\n },\n '&:not(:disabled)': Object.assign({}, genFocusStyle(token)),\n [`&${componentCls}-two-chinese-chars::first-letter`]: {\n letterSpacing: '0.34em'\n },\n [`&${componentCls}-two-chinese-chars > *:not(${iconCls})`]: {\n marginInlineEnd: '-0.34em',\n letterSpacing: '0.34em'\n },\n // iconPosition=\"end\"\n '&-icon-end': {\n flexDirection: 'row-reverse'\n }\n }\n };\n};\nconst genHoverActiveButtonStyle = (btnCls, hoverStyle, activeStyle) => ({\n [`&:not(:disabled):not(${btnCls}-disabled)`]: {\n '&:hover': hoverStyle,\n '&:active': activeStyle\n }\n});\n// ============================== Shape ===============================\nconst genCircleButtonStyle = token => ({\n minWidth: token.controlHeight,\n paddingInlineStart: 0,\n paddingInlineEnd: 0,\n borderRadius: '50%'\n});\nconst genRoundButtonStyle = token => ({\n borderRadius: token.controlHeight,\n paddingInlineStart: token.calc(token.controlHeight).div(2).equal(),\n paddingInlineEnd: token.calc(token.controlHeight).div(2).equal()\n});\n// =============================== Type ===============================\nconst genDisabledStyle = token => ({\n cursor: 'not-allowed',\n borderColor: token.borderColorDisabled,\n color: token.colorTextDisabled,\n background: token.colorBgContainerDisabled,\n boxShadow: 'none'\n});\nconst genGhostButtonStyle = (btnCls, background, textColor, borderColor, textColorDisabled, borderColorDisabled, hoverStyle, activeStyle) => ({\n [`&${btnCls}-background-ghost`]: Object.assign(Object.assign({\n color: textColor || undefined,\n background,\n borderColor: borderColor || undefined,\n boxShadow: 'none'\n }, genHoverActiveButtonStyle(btnCls, Object.assign({\n background\n }, hoverStyle), Object.assign({\n background\n }, activeStyle))), {\n '&:disabled': {\n cursor: 'not-allowed',\n color: textColorDisabled || undefined,\n borderColor: borderColorDisabled || undefined\n }\n })\n});\nconst genSolidDisabledButtonStyle = token => ({\n [`&:disabled, &${token.componentCls}-disabled`]: Object.assign({}, genDisabledStyle(token))\n});\nconst genSolidButtonStyle = token => Object.assign({}, genSolidDisabledButtonStyle(token));\nconst genPureDisabledButtonStyle = token => ({\n [`&:disabled, &${token.componentCls}-disabled`]: {\n cursor: 'not-allowed',\n color: token.colorTextDisabled\n }\n});\n// Type: Default\nconst genDefaultButtonStyle = token => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, genSolidButtonStyle(token)), {\n background: token.defaultBg,\n borderColor: token.defaultBorderColor,\n color: token.defaultColor,\n boxShadow: token.defaultShadow\n}), genHoverA
|