// deps-lint-skip-all import { getStyle as getCheckboxStyle } from '../../checkbox/style'; import { genTreeStyle } from '../../tree/style'; import type { AliasToken, FullToken, GenerateStyle } from '../../_util/theme'; import { genComponentStyleHook, mergeToken } from '../../_util/theme'; interface TreeSelectToken extends FullToken<'TreeSelect'> { treePrefixCls: string; } // =============================== Base =============================== const genBaseStyle: GenerateStyle = token => { const { componentCls, treePrefixCls, colorBgElevated } = token; const treeCls = `.${treePrefixCls}`; return [ // ====================================================== // == Dropdown == // ====================================================== { [`${componentCls}-dropdown`]: [ { padding: `${token.paddingXS}px ${token.paddingXS / 2}px`, }, // ====================== Tree ====================== genTreeStyle( treePrefixCls, mergeToken(token, { colorBgComponent: colorBgElevated }), ), { [treeCls]: { borderRadius: 0, '&-list-holder-inner': { alignItems: 'stretch', [`${treeCls}-treenode`]: { [`${treeCls}-node-content-wrapper`]: { flex: 'auto', }, }, }, }, }, // ==================== Checkbox ==================== getCheckboxStyle(`${treePrefixCls}-checkbox`, token), // ====================== RTL ======================= { '&-rtl': { direction: 'rtl', [`${treeCls}-switcher${treeCls}-switcher_close`]: { [`${treeCls}-switcher-icon svg`]: { transform: 'rotate(90deg)', }, }, }, }, ], }, ]; }; // ============================== Export ============================== export default function useTreeSelectStyle(prefixCls: string, treePrefixCls: string) { return genComponentStyleHook('TreeSelect', token => { const treeSelectToken = mergeToken(token, { treePrefixCls, }); return [genBaseStyle(treeSelectToken)]; })(prefixCls); }