File size: 3,537 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import { unit } from '@ant-design/cssinjs';
import type { CSSInterpolation } from '@ant-design/cssinjs';

import type { CascaderToken } from '.';
import { getStyle as getCheckboxStyle } from '../../checkbox/style';
import { textEllipsis } from '../../style';
import type { GenerateStyle } from '../../theme/internal';

const getColumnsStyle: GenerateStyle<CascaderToken> = (token: CascaderToken): CSSInterpolation => {
  const { prefixCls, componentCls } = token;

  const cascaderMenuItemCls = `${componentCls}-menu-item`;
  const iconCls = `
  &${cascaderMenuItemCls}-expand ${cascaderMenuItemCls}-expand-icon,
  ${cascaderMenuItemCls}-loading-icon
`;

  return [
    // ==================== Checkbox ====================
    getCheckboxStyle(`${prefixCls}-checkbox`, token),

    {
      [componentCls]: {
        // ================== Checkbox ==================
        '&-checkbox': {
          top: 0,
          marginInlineEnd: token.paddingXS,
          pointerEvents: 'unset',
        },

        // ==================== Menu ====================
        // >>> Menus
        '&-menus': {
          display: 'flex',
          flexWrap: 'nowrap',
          alignItems: 'flex-start',

          [`&${componentCls}-menu-empty`]: {
            [`${componentCls}-menu`]: {
              width: '100%',
              height: 'auto',

              [cascaderMenuItemCls]: {
                color: token.colorTextDisabled,
              },
            },
          },
        },

        // >>> Menu
        '&-menu': {
          flexGrow: 1,
          flexShrink: 0,
          minWidth: token.controlItemWidth,
          height: token.dropdownHeight,
          margin: 0,
          padding: token.menuPadding,
          overflow: 'auto',
          verticalAlign: 'top',
          listStyle: 'none',
          '-ms-overflow-style': '-ms-autohiding-scrollbar', // https://github.com/ant-design/ant-design/issues/11857

          '&:not(:last-child)': {
            borderInlineEnd: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
          },

          '&-item': {
            ...textEllipsis,
            display: 'flex',
            flexWrap: 'nowrap',
            alignItems: 'center',
            padding: token.optionPadding,
            lineHeight: token.lineHeight,
            cursor: 'pointer',
            transition: `all ${token.motionDurationMid}`,
            borderRadius: token.borderRadiusSM,

            '&:hover': {
              background: token.controlItemBgHover,
            },
            '&-disabled': {
              color: token.colorTextDisabled,
              cursor: 'not-allowed',

              '&:hover': {
                background: 'transparent',
              },

              [iconCls]: {
                color: token.colorTextDisabled,
              },
            },

            [`&-active:not(${cascaderMenuItemCls}-disabled)`]: {
              '&, &:hover': {
                color: token.optionSelectedColor,
                fontWeight: token.optionSelectedFontWeight,
                backgroundColor: token.optionSelectedBg,
              },
            },

            '&-content': {
              flex: 'auto',
            },

            [iconCls]: {
              marginInlineStart: token.paddingXXS,
              color: token.colorIcon,
              fontSize: token.fontSizeIcon,
            },

            '&-keyword': {
              color: token.colorHighlight,
            },
          },
        },
      },
    },
  ];
};

export default getColumnsStyle;