1 line
15 KiB
JSON
1 line
15 KiB
JSON
|
{"ast":null,"code":"import { unit } from '@ant-design/cssinjs';\nimport { resetComponent } from '../../style';\nimport { mergeToken } from '../../theme/internal';\nfunction genSizeStyle(token, suffix) {\n const {\n componentCls,\n inputPaddingHorizontalBase,\n borderRadius\n } = token;\n const selectHeightWithoutBorder = token.calc(token.controlHeight).sub(token.calc(token.lineWidth).mul(2)).equal();\n const suffixCls = suffix ? `${componentCls}-${suffix}` : '';\n return {\n [`${componentCls}-single${suffixCls}`]: {\n fontSize: token.fontSize,\n height: token.controlHeight,\n // ========================= Selector =========================\n [`${componentCls}-selector`]: Object.assign(Object.assign({}, resetComponent(token, true)), {\n display: 'flex',\n borderRadius,\n [`${componentCls}-selection-search`]: {\n position: 'absolute',\n top: 0,\n insetInlineStart: inputPaddingHorizontalBase,\n insetInlineEnd: inputPaddingHorizontalBase,\n bottom: 0,\n '&-input': {\n width: '100%',\n WebkitAppearance: 'textfield'\n }\n },\n [`\n ${componentCls}-selection-item,\n ${componentCls}-selection-placeholder\n `]: {\n padding: 0,\n lineHeight: unit(selectHeightWithoutBorder),\n transition: `all ${token.motionDurationSlow}, visibility 0s`,\n alignSelf: 'center'\n },\n [`${componentCls}-selection-placeholder`]: {\n transition: 'none',\n pointerEvents: 'none'\n },\n // For common baseline align\n [['&:after', /* For '' value baseline align */\n `${componentCls}-selection-item:empty:after`, /* For undefined value baseline align */\n `${componentCls}-selection-placeholder:empty:after`].join(',')]: {\n display: 'inline-block',\n width: 0,\n visibility: 'hidden',\n content: '\"\\\\a0\"'\n }\n }),\n [`\n &${componentCls}-show-arrow ${componentCls}-selection-item,\n &${componentCls}-show-arrow ${componentCls}-selection-placeholder\n `]: {\n paddingInlineEnd: token.showArrowPaddingInlineEnd\n },\n // Opacity selection if open\n [`&${componentCls}-open ${componentCls}-selection-item`]: {\n color: token.colorTextPlaceholder\n },\n // ========================== Input ==========================\n // We only change the style of non-customize input which is only support by `combobox` mode.\n // Not customize\n [`&:not(${componentCls}-customize-input)`]: {\n [`${componentCls}-selector`]: {\n width: '100%',\n height: '100%',\n padding: `0 ${unit(inputPaddingHorizontalBase)}`,\n [`${componentCls}-selection-search-input`]: {\n height: selectHeightWithoutBorder\n },\n '&:after': {\n lineHeight: unit(selectHeightWithoutBorder)\n }\n }\n },\n [`&${componentCls}-customize-input`]: {\n [`${componentCls}-selector`]: {\n '&:after': {\n display: 'none'\n },\n [`${componentCls}-selection-search`]: {\n position: 'static',\n width: '100%'\n },\n [`${componentCls}-selection-placeholder`]: {\n position: 'absolute',\n insetInlineStart: 0,\n insetInlineEnd: 0,\n padding: `0 ${unit(inputPaddingHorizontalBase)}`,\n '&:after': {\n display: 'none'\n }\n }\n }\n }\n }\n };\n}\nexport default function genSingleStyle(token) {\n const {\n componentCls\n } = token;\n const inputPaddingHorizontalSM = token.calc(token.controlPaddingHorizontalSM).sub(token.lineWidth).equal();\n return [genSizeStyle(token),\n // ======================== Small ========================\n // Shared\n genSizeStyle(mergeToken(token, {\n controlHeight: token.controlHeightSM,\n borderRadius:
|