1 line
22 KiB
JSON
1 line
22 KiB
JSON
|
{"ast":null,"code":"import { resetComponent, resetIcon, textEllipsis } from '../../style';\nimport { genCompactItemStyle } from '../../style/compact-item';\nimport { genStyleHooks, mergeToken } from '../../theme/internal';\nimport genDropdownStyle from './dropdown';\nimport genMultipleStyle from './multiple';\nimport genSingleStyle from './single';\nimport { prepareComponentToken } from './token';\nimport genVariantsStyle from './variants';\n// ============================= Selector =============================\nconst genSelectorStyle = token => {\n const {\n componentCls\n } = token;\n return {\n position: 'relative',\n transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,\n input: {\n cursor: 'pointer'\n },\n [`${componentCls}-show-search&`]: {\n cursor: 'text',\n input: {\n cursor: 'auto',\n color: 'inherit',\n height: '100%'\n }\n },\n [`${componentCls}-disabled&`]: {\n cursor: 'not-allowed',\n input: {\n cursor: 'not-allowed'\n }\n }\n };\n};\n// ============================== Styles ==============================\n// /* Reset search input style */\nconst getSearchInputWithoutBorderStyle = token => {\n const {\n componentCls\n } = token;\n return {\n [`${componentCls}-selection-search-input`]: {\n margin: 0,\n padding: 0,\n background: 'transparent',\n border: 'none',\n outline: 'none',\n appearance: 'none',\n fontFamily: 'inherit',\n '&::-webkit-search-cancel-button': {\n display: 'none',\n '-webkit-appearance': 'none'\n }\n }\n };\n};\n// =============================== Base ===============================\nconst genBaseStyle = token => {\n const {\n antCls,\n componentCls,\n inputPaddingHorizontalBase,\n iconCls\n } = token;\n return {\n [componentCls]: Object.assign(Object.assign({}, resetComponent(token)), {\n position: 'relative',\n display: 'inline-block',\n cursor: 'pointer',\n [`&:not(${componentCls}-customize-input) ${componentCls}-selector`]: Object.assign(Object.assign({}, genSelectorStyle(token)), getSearchInputWithoutBorderStyle(token)),\n // ======================== Selection ========================\n [`${componentCls}-selection-item`]: Object.assign(Object.assign({\n flex: 1,\n fontWeight: 'normal',\n position: 'relative',\n userSelect: 'none'\n }, textEllipsis), {\n // https://github.com/ant-design/ant-design/issues/40421\n [`> ${antCls}-typography`]: {\n display: 'inline'\n }\n }),\n // ======================= Placeholder =======================\n [`${componentCls}-selection-placeholder`]: Object.assign(Object.assign({}, textEllipsis), {\n flex: 1,\n color: token.colorTextPlaceholder,\n pointerEvents: 'none'\n }),\n // ========================== Arrow ==========================\n [`${componentCls}-arrow`]: Object.assign(Object.assign({}, resetIcon()), {\n position: 'absolute',\n top: '50%',\n insetInlineStart: 'auto',\n insetInlineEnd: inputPaddingHorizontalBase,\n height: token.fontSizeIcon,\n marginTop: token.calc(token.fontSizeIcon).mul(-1).div(2).equal(),\n color: token.colorTextQuaternary,\n fontSize: token.fontSizeIcon,\n lineHeight: 1,\n textAlign: 'center',\n pointerEvents: 'none',\n display: 'flex',\n alignItems: 'center',\n transition: `opacity ${token.motionDurationSlow} ease`,\n [iconCls]: {\n verticalAlign: 'top',\n transition: `transform ${token.motionDurationSlow}`,\n '> svg': {\n verticalAlign: 'top'\n },\n [`&:not(${componentCls}-suffix)`]: {\n pointerEvents: 'auto'\n }\n },\n [`${componentCls}-disabled &`]: {\n cursor: 'not-allowed'\n },\n '> *:not(:last-child)': {\n marginInlineEnd: 8 // FIXME: magic\n }\n
|