@rainbow-oh/yee-c 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +40 -25
- package/dist/cjs/Card/card.js +7 -3
- package/dist/cjs/Carousel/carousel-item.js +7 -2
- package/dist/cjs/Carousel/carousel.js +31 -4
- package/dist/cjs/Cascader/cascader.js +38 -30
- package/dist/cjs/Cascader/column.js +17 -9
- package/dist/cjs/Cascader/node.js +16 -4
- package/dist/cjs/Cascader/search-list.js +31 -14
- package/dist/cjs/Cascader/utils/index.js +1 -5
- package/dist/cjs/Checkbox/checkbox-group.js +23 -14
- package/dist/cjs/Checkbox/checkbox.js +6 -3
- package/dist/cjs/Collapse/panel.js +10 -1
- package/dist/cjs/Dialog/dialog.js +22 -7
- package/dist/cjs/Dialog/interface.d.ts +1 -1
- package/dist/cjs/Dialog/style/index.less +2 -1
- package/dist/cjs/Drawer/drawer.js +22 -5
- package/dist/cjs/Form/Group.js +1 -1
- package/dist/cjs/Form/demo/tooltip.js +1 -3
- package/dist/cjs/List/hooks/useListKeyboard.js +3 -1
- package/dist/cjs/Menu/menu-item.js +14 -5
- package/dist/cjs/Menu/menu.js +26 -2
- package/dist/cjs/Pagination/items.js +60 -27
- package/dist/cjs/Pagination/pagination.js +33 -11
- package/dist/cjs/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.js +7 -1
- package/dist/cjs/Radio/radio-group.js +6 -5
- package/dist/cjs/Radio/radio.js +39 -29
- package/dist/cjs/Rate/rate.js +6 -1
- package/dist/cjs/Rate/star.js +31 -3
- package/dist/cjs/Segmented/demo/variant.js +15 -1
- package/dist/cjs/Segmented/index.d.ts +1 -1
- package/dist/cjs/Segmented/segmented.js +12 -15
- package/dist/cjs/Select/option.js +8 -1
- package/dist/cjs/Select/options.js +9 -1
- package/dist/cjs/Select/select.js +3 -1
- package/dist/cjs/Steps/step.js +19 -5
- package/dist/cjs/Steps/steps.js +11 -1
- package/dist/cjs/Table/demo/components-override.js +31 -2
- package/dist/cjs/Table/demo/grouping.js +7 -1
- package/dist/cjs/Table/hooks/useColumns.d.ts +3 -3
- package/dist/cjs/Table/hooks/useColumns.js +11 -14
- package/dist/cjs/Table/index.d.ts +1 -1
- package/dist/cjs/Table/style/index.less +2 -4
- package/dist/cjs/Table/tbody/row.js +1 -4
- package/dist/cjs/Table/theader/index.js +12 -4
- package/dist/cjs/Tabs/tab-content.js +3 -1
- package/dist/cjs/Tabs/tab-header/index.js +3 -1
- package/dist/cjs/Tabs/tab-header/tab-header-title.js +3 -1
- package/dist/cjs/Tour/index.d.ts +1 -1
- package/dist/cjs/Tree/style/index.less +1 -5
- package/dist/cjs/Tree/tree.js +38 -35
- package/dist/cjs/hooks/useDelayState.js +3 -2
- package/dist/cjs/hooks/useEvent.js +1 -4
- package/dist/cjs/hooks/useFocusManage.d.ts +1 -1
- package/dist/cjs/hooks/useFocusManage.js +27 -22
- package/dist/cjs/style/size.css +2 -0
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +3 -1
- package/dist/cjs/utils/focusStack.d.ts +6 -2
- package/dist/cjs/utils/focusStack.js +40 -11
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Card/card.js +7 -3
- package/dist/esm/Carousel/carousel-item.js +7 -2
- package/dist/esm/Carousel/carousel.js +31 -4
- package/dist/esm/Cascader/cascader.js +3 -1
- package/dist/esm/Cascader/column.js +2 -1
- package/dist/esm/Cascader/node.js +18 -4
- package/dist/esm/Cascader/search-list.js +18 -4
- package/dist/esm/Checkbox/checkbox-group.js +3 -1
- package/dist/esm/Checkbox/checkbox.js +6 -3
- package/dist/esm/Collapse/panel.js +11 -2
- package/dist/esm/Dialog/dialog.js +28 -11
- package/dist/esm/Dialog/interface.d.ts +1 -1
- package/dist/esm/Dialog/style/index.less +2 -1
- package/dist/esm/Drawer/drawer.js +16 -7
- package/dist/esm/Form/Group.js +1 -1
- package/dist/esm/Menu/menu-item.js +16 -5
- package/dist/esm/Menu/menu.js +11 -5
- package/dist/esm/Pagination/items.js +14 -5
- package/dist/esm/Pagination/pagination.js +16 -4
- package/dist/esm/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/esm/Radio/radio-group.js +5 -4
- package/dist/esm/Radio/radio.js +5 -4
- package/dist/esm/Rate/rate.js +6 -1
- package/dist/esm/Rate/star.js +12 -4
- package/dist/esm/Segmented/index.d.ts +1 -1
- package/dist/esm/Segmented/segmented.js +1 -1
- package/dist/esm/Steps/step.js +12 -6
- package/dist/esm/Steps/steps.js +3 -1
- package/dist/esm/Table/demo/components-override.js +1 -0
- package/dist/esm/Table/hooks/useColumns.d.ts +3 -3
- package/dist/esm/Table/hooks/useColumns.js +13 -16
- package/dist/esm/Table/index.d.ts +1 -1
- package/dist/esm/Table/style/index.less +2 -4
- package/dist/esm/Tabs/tab-content.js +3 -1
- package/dist/esm/Tabs/tab-header/index.js +3 -1
- package/dist/esm/Tabs/tab-header/tab-header-title.js +3 -1
- package/dist/esm/Tour/index.d.ts +1 -1
- package/dist/esm/Tree/style/index.less +1 -5
- package/dist/esm/Tree/tree.js +1 -1
- package/dist/esm/hooks/useDelayState.js +5 -2
- package/dist/esm/hooks/useFocusManage.d.ts +1 -1
- package/dist/esm/hooks/useFocusManage.js +31 -13
- package/dist/esm/style/size.css +2 -0
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +3 -1
- package/dist/esm/utils/focusStack.d.ts +6 -2
- package/dist/esm/utils/focusStack.js +37 -14
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +2 -2
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +10 -6
- package/src/Anchor/anchor.tsx +2 -2
- package/src/Card/card.tsx +5 -1
- package/src/Carousel/carousel-item.tsx +7 -1
- package/src/Carousel/carousel.tsx +29 -3
- package/src/Cascader/cascader.tsx +5 -1
- package/src/Cascader/column.tsx +5 -1
- package/src/Cascader/node.tsx +14 -2
- package/src/Cascader/search-list.tsx +19 -3
- package/src/Cascader/utils/index.ts +3 -6
- package/src/Checkbox/checkbox-group.tsx +6 -1
- package/src/Checkbox/checkbox.tsx +3 -0
- package/src/Collapse/panel.tsx +11 -1
- package/src/Dialog/dialog.tsx +35 -6
- package/src/Dialog/interface.ts +1 -1
- package/src/Dialog/style/index.less +2 -1
- package/src/Drawer/drawer.tsx +18 -3
- package/src/Form/Group.tsx +2 -4
- package/src/Form/demo/tooltip.tsx +2 -11
- package/src/Form/utils/validate.ts +1 -4
- package/src/List/hooks/useListKeyboard.ts +3 -3
- package/src/List/list.tsx +2 -1
- package/src/Menu/menu-item.tsx +12 -3
- package/src/Menu/menu.tsx +22 -5
- package/src/Pagination/items.tsx +21 -4
- package/src/Pagination/pagination.tsx +24 -4
- package/src/PickerPanel/panels/DatePanel/DateBody.tsx +1 -1
- package/src/PickerPanel/panels/DateTimePanel/index.tsx +1 -1
- package/src/PickerPanel/panels/MonthPanel/MonthHeader.tsx +7 -2
- package/src/PickerPanel/panels/PanelBody.tsx +1 -1
- package/src/PickerPanel/panels/QuarterPanel/QuarterHeader.tsx +1 -1
- package/src/PickerPanel/panels/RangePanel/index.tsx +1 -1
- package/src/PickerPanel/panels/TimePanel/TimeBody.tsx +1 -1
- package/src/PickerPanel/panels/YearPanel/YearHeader.tsx +1 -1
- package/src/PickerPanel/utils/pickerUtils.ts +2 -1
- package/src/Radio/radio-group.tsx +2 -1
- package/src/Radio/radio.tsx +7 -2
- package/src/RangePicker/range-picker-mobile.tsx +1 -3
- package/src/Rate/rate.tsx +5 -0
- package/src/Rate/star.tsx +20 -4
- package/src/Segmented/demo/variant.tsx +10 -2
- package/src/Segmented/index.ts +2 -2
- package/src/Segmented/segmented.tsx +4 -11
- package/src/Select/interface.ts +0 -1
- package/src/Select/option.tsx +8 -2
- package/src/Select/options.tsx +11 -4
- package/src/Select/select.tsx +4 -4
- package/src/Steps/step.tsx +23 -5
- package/src/Steps/steps.tsx +8 -1
- package/src/Table/demo/components-override.tsx +34 -7
- package/src/Table/demo/grouping.tsx +8 -4
- package/src/Table/hooks/useColumns.ts +14 -18
- package/src/Table/index.ts +3 -3
- package/src/Table/style/index.less +2 -4
- package/src/Table/table.tsx +2 -4
- package/src/Table/tbody/row.tsx +1 -3
- package/src/Table/theader/index.tsx +9 -10
- package/src/Tabs/tab-content.tsx +2 -0
- package/src/Tabs/tab-header/index.tsx +2 -0
- package/src/Tabs/tab-header/tab-header-title.tsx +3 -1
- package/src/Tour/demo/placement.tsx +2 -1
- package/src/Tour/index.ts +1 -1
- package/src/Tree/style/index.less +1 -5
- package/src/Tree/tree.tsx +16 -11
- package/src/Tree/utils/tree-tools.ts +4 -1
- package/src/hooks/useDelayState.ts +4 -2
- package/src/hooks/useEvent.ts +1 -3
- package/src/hooks/useFocusManage.ts +33 -17
- package/src/locale/context.tsx +5 -1
- package/src/locale/interface.ts +3 -1
- package/src/style/size.css +2 -0
- package/src/utils/debounce.ts +1 -3
- package/src/utils/focusStack.ts +55 -12
- package/src/version.ts +1 -1
|
@@ -31,9 +31,9 @@ export default function useListKeyboard({
|
|
|
31
31
|
onFocusChange,
|
|
32
32
|
onClick,
|
|
33
33
|
}: UseListKeyboardParams) {
|
|
34
|
-
const [internalFocusedKey, setInternalFocusedKey] = useState<
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState<string | number>(
|
|
35
|
+
'',
|
|
36
|
+
);
|
|
37
37
|
|
|
38
38
|
const isControlled = controlledFocusedKey !== undefined;
|
|
39
39
|
const focusedKey = isControlled ? controlledFocusedKey : internalFocusedKey;
|
package/src/List/list.tsx
CHANGED
|
@@ -33,7 +33,8 @@ const List = forwardRef<HTMLUListElement, ListProps>((baseprops, ref) => {
|
|
|
33
33
|
} = props;
|
|
34
34
|
|
|
35
35
|
const multiColumn = columns > 1;
|
|
36
|
-
const useVirtual =
|
|
36
|
+
const useVirtual =
|
|
37
|
+
virtual && height !== null && height !== undefined && Array.isArray(items);
|
|
37
38
|
const safeItems = Array.isArray(items) ? items : [];
|
|
38
39
|
|
|
39
40
|
// Keyboard navigation
|
package/src/Menu/menu-item.tsx
CHANGED
|
@@ -69,6 +69,10 @@ const MenuItem = (props: MenuItemProps) => {
|
|
|
69
69
|
style={{ paddingLeft, ...styles?.item }}
|
|
70
70
|
onClick={handleClick}
|
|
71
71
|
title={isCollapsed && typeof label === 'string' ? label : undefined}
|
|
72
|
+
role="menuitem"
|
|
73
|
+
aria-disabled={disabled || undefined}
|
|
74
|
+
aria-current={selectedKeys?.includes(key) ? 'page' : undefined}
|
|
75
|
+
tabIndex={disabled ? -1 : 0}
|
|
72
76
|
>
|
|
73
77
|
{iconNode}
|
|
74
78
|
{!isCollapsed && (
|
|
@@ -149,7 +153,7 @@ const MenuItem = (props: MenuItemProps) => {
|
|
|
149
153
|
if (isCollapsed) return null;
|
|
150
154
|
if (mode === 'vertical' || mode === 'horizontal') {
|
|
151
155
|
return (
|
|
152
|
-
<span className={`${prefixCls}-item-switch`}>
|
|
156
|
+
<span className={`${prefixCls}-item-switch`} aria-hidden="true">
|
|
153
157
|
<ChevronRight strokeWidth={2} size={18} />
|
|
154
158
|
</span>
|
|
155
159
|
);
|
|
@@ -159,6 +163,7 @@ const MenuItem = (props: MenuItemProps) => {
|
|
|
159
163
|
className={`${prefixCls}-item-switch`}
|
|
160
164
|
animate={{ rotateX: opened ? 180 : 0 }}
|
|
161
165
|
transition={{ duration: 0.15 }}
|
|
166
|
+
aria-hidden="true"
|
|
162
167
|
>
|
|
163
168
|
<ChevronDown strokeWidth={2} size={18} />
|
|
164
169
|
</motion.span>
|
|
@@ -167,7 +172,10 @@ const MenuItem = (props: MenuItemProps) => {
|
|
|
167
172
|
|
|
168
173
|
const triggerNode = (
|
|
169
174
|
<div
|
|
170
|
-
role="
|
|
175
|
+
role="menuitem"
|
|
176
|
+
aria-haspopup="true"
|
|
177
|
+
aria-expanded={opened}
|
|
178
|
+
aria-disabled={disabled || undefined}
|
|
171
179
|
className={clsx(`${prefixCls}-submenu-title`, {
|
|
172
180
|
[`${prefixCls}-submenu-open`]: opened,
|
|
173
181
|
[`${prefixCls}-submenu-selected`]:
|
|
@@ -178,6 +186,7 @@ const MenuItem = (props: MenuItemProps) => {
|
|
|
178
186
|
})}
|
|
179
187
|
style={{ paddingLeft }}
|
|
180
188
|
onClick={handleExpand}
|
|
189
|
+
tabIndex={disabled ? -1 : 0}
|
|
181
190
|
title={isCollapsed && typeof label === 'string' ? label : undefined}
|
|
182
191
|
>
|
|
183
192
|
{iconNode}
|
|
@@ -203,7 +212,7 @@ const MenuItem = (props: MenuItemProps) => {
|
|
|
203
212
|
mode === 'horizontal' && !isCollapsed ? 'bottomLeft' : 'rightTop';
|
|
204
213
|
|
|
205
214
|
const childNode = (
|
|
206
|
-
<li className={cls}>
|
|
215
|
+
<li className={cls} role="none">
|
|
207
216
|
{usePopup ? (
|
|
208
217
|
<Trigger
|
|
209
218
|
open={openKeys.includes(key)}
|
package/src/Menu/menu.tsx
CHANGED
|
@@ -40,9 +40,19 @@ const MenuGroup = ({
|
|
|
40
40
|
prefixCls: string;
|
|
41
41
|
renderItems: (items: MenuItemType[]) => React.ReactNode[];
|
|
42
42
|
}) => (
|
|
43
|
-
<li className={`${prefixCls}-item-group`}>
|
|
44
|
-
<div
|
|
45
|
-
|
|
43
|
+
<li className={`${prefixCls}-item-group`} role="none">
|
|
44
|
+
<div
|
|
45
|
+
className={`${prefixCls}-item-group-title`}
|
|
46
|
+
role="presentation"
|
|
47
|
+
id={`${prefixCls}-group-${String(item.label)}`}
|
|
48
|
+
>
|
|
49
|
+
{item.label}
|
|
50
|
+
</div>
|
|
51
|
+
<ul
|
|
52
|
+
className={`${prefixCls}-item-group-list`}
|
|
53
|
+
role="group"
|
|
54
|
+
aria-labelledby={`${prefixCls}-group-${String(item.label)}`}
|
|
55
|
+
>
|
|
46
56
|
{renderItems(item.children)}
|
|
47
57
|
</ul>
|
|
48
58
|
</li>
|
|
@@ -112,11 +122,18 @@ const Menu = (props: InnerMenuProps) => {
|
|
|
112
122
|
const rootStyle = root ? { ...style } : {};
|
|
113
123
|
|
|
114
124
|
return (
|
|
115
|
-
<ul
|
|
125
|
+
<ul
|
|
126
|
+
{...dataAttrs}
|
|
127
|
+
className={cls}
|
|
128
|
+
style={rootStyle}
|
|
129
|
+
role={root && mode === 'horizontal' ? 'menubar' : 'menu'}
|
|
130
|
+
>
|
|
116
131
|
<MenuCtx.Provider value={{ level, mode, classNames, styles }}>
|
|
117
132
|
{getChildFromItems(items)}
|
|
118
133
|
{level === 0 && footer && (
|
|
119
|
-
<li className={`${prefixCls}-footer`}>
|
|
134
|
+
<li className={`${prefixCls}-footer`} role="none">
|
|
135
|
+
{footer}
|
|
136
|
+
</li>
|
|
120
137
|
)}
|
|
121
138
|
</MenuCtx.Provider>
|
|
122
139
|
</ul>
|
package/src/Pagination/items.tsx
CHANGED
|
@@ -81,18 +81,25 @@ const Items: React.FC<PaginationItemsProps> = (props) => {
|
|
|
81
81
|
}
|
|
82
82
|
}}
|
|
83
83
|
role="button"
|
|
84
|
+
aria-label="Jump back 7 pages"
|
|
84
85
|
key="turnleft"
|
|
85
86
|
>
|
|
86
87
|
{components?.jumpPrev ?? (
|
|
87
88
|
<>
|
|
88
|
-
<span
|
|
89
|
+
<span
|
|
90
|
+
className={`${prefixCls}-jump-prev-ellipsis`}
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
>
|
|
89
93
|
<Ellipsis
|
|
90
94
|
className="ellipsis"
|
|
91
95
|
size={18}
|
|
92
96
|
strokeWidth={1.5}
|
|
93
97
|
/>
|
|
94
98
|
</span>
|
|
95
|
-
<span
|
|
99
|
+
<span
|
|
100
|
+
className={`${prefixCls}-jump-prev-icon`}
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
>
|
|
96
103
|
<ChevronsLeft
|
|
97
104
|
className="turn"
|
|
98
105
|
size={18}
|
|
@@ -116,18 +123,25 @@ const Items: React.FC<PaginationItemsProps> = (props) => {
|
|
|
116
123
|
}
|
|
117
124
|
}}
|
|
118
125
|
role="button"
|
|
126
|
+
aria-label="Jump forward 7 pages"
|
|
119
127
|
key="turn-right"
|
|
120
128
|
>
|
|
121
129
|
{components?.jumpNext ?? (
|
|
122
130
|
<>
|
|
123
|
-
<span
|
|
131
|
+
<span
|
|
132
|
+
className={`${prefixCls}-jump-next-ellipsis`}
|
|
133
|
+
aria-hidden="true"
|
|
134
|
+
>
|
|
124
135
|
<Ellipsis
|
|
125
136
|
className="ellipsis"
|
|
126
137
|
size={18}
|
|
127
138
|
strokeWidth={1.5}
|
|
128
139
|
/>
|
|
129
140
|
</span>
|
|
130
|
-
<span
|
|
141
|
+
<span
|
|
142
|
+
className={`${prefixCls}-jump-next-icon`}
|
|
143
|
+
aria-hidden="true"
|
|
144
|
+
>
|
|
131
145
|
<ChevronsRight
|
|
132
146
|
className="turn"
|
|
133
147
|
size={18}
|
|
@@ -159,6 +173,9 @@ const Items: React.FC<PaginationItemsProps> = (props) => {
|
|
|
159
173
|
onChange(number as number);
|
|
160
174
|
}
|
|
161
175
|
}}
|
|
176
|
+
role="button"
|
|
177
|
+
aria-label={`Page ${number}`}
|
|
178
|
+
aria-current={current === number ? 'page' : undefined}
|
|
162
179
|
>
|
|
163
180
|
{number}
|
|
164
181
|
</li>
|
|
@@ -179,9 +179,14 @@ const Pagination = React.forwardRef(
|
|
|
179
179
|
prevClick();
|
|
180
180
|
}
|
|
181
181
|
}}
|
|
182
|
+
role="button"
|
|
183
|
+
aria-label="Previous page"
|
|
184
|
+
aria-disabled={mergedCurrent === 1 || undefined}
|
|
182
185
|
key="prev"
|
|
183
186
|
>
|
|
184
|
-
{components?.prev ??
|
|
187
|
+
{components?.prev ?? (
|
|
188
|
+
<ChevronLeft size={20} strokeWidth={1.5} aria-hidden="true" />
|
|
189
|
+
)}
|
|
185
190
|
</li>
|
|
186
191
|
);
|
|
187
192
|
};
|
|
@@ -204,9 +209,14 @@ const Pagination = React.forwardRef(
|
|
|
204
209
|
nextClick();
|
|
205
210
|
}
|
|
206
211
|
}}
|
|
212
|
+
role="button"
|
|
213
|
+
aria-label="Next page"
|
|
214
|
+
aria-disabled={mergedCurrent === pageCount || undefined}
|
|
207
215
|
key="next"
|
|
208
216
|
>
|
|
209
|
-
{components?.next ??
|
|
217
|
+
{components?.next ?? (
|
|
218
|
+
<ChevronRight size={20} strokeWidth={1.5} aria-hidden="true" />
|
|
219
|
+
)}
|
|
210
220
|
</li>
|
|
211
221
|
);
|
|
212
222
|
};
|
|
@@ -249,13 +259,23 @@ const Pagination = React.forwardRef(
|
|
|
249
259
|
}
|
|
250
260
|
|
|
251
261
|
return (
|
|
252
|
-
<ul
|
|
262
|
+
<ul
|
|
263
|
+
{...rest}
|
|
264
|
+
className={cls}
|
|
265
|
+
style={style}
|
|
266
|
+
ref={ref}
|
|
267
|
+
role="navigation"
|
|
268
|
+
aria-label="Pagination"
|
|
269
|
+
aria-disabled={disabled || undefined}
|
|
270
|
+
>
|
|
253
271
|
{renderTotal()}
|
|
254
272
|
{renderPrevious()}
|
|
255
273
|
{simple ? (
|
|
256
274
|
<li className={`${prefixCls}-simple`}>
|
|
257
275
|
{renderNumber(false)}
|
|
258
|
-
<span className="split"
|
|
276
|
+
<span className="split" aria-hidden="true">
|
|
277
|
+
/
|
|
278
|
+
</span>
|
|
259
279
|
<span className="total-page">{pageCount}</span>
|
|
260
280
|
</li>
|
|
261
281
|
) : (
|
|
@@ -2,8 +2,8 @@ import clsx from 'clsx';
|
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import useEvent from '../../../hooks/useEvent';
|
|
5
|
-
import type { PanelSharedProps } from '../../interface';
|
|
6
5
|
import panelConfig from '../../configs';
|
|
6
|
+
import type { PanelSharedProps } from '../../interface';
|
|
7
7
|
import pickerUtils from '../../utils/pickerUtils';
|
|
8
8
|
import PanelBody from '../PanelBody';
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PanelSharedProps, PickerType } from '../../interface';
|
|
4
4
|
import DatePanel from '../DatePanel';
|
|
5
5
|
import TimePanel from '../TimePanel';
|
|
6
6
|
|
|
@@ -6,8 +6,13 @@ import pickerUtils from '../../utils/pickerUtils';
|
|
|
6
6
|
import Header from '../Header';
|
|
7
7
|
|
|
8
8
|
export default function MonthHeader(props: PanelSharedProps) {
|
|
9
|
-
const {
|
|
10
|
-
|
|
9
|
+
const {
|
|
10
|
+
prefixCls,
|
|
11
|
+
viewDate,
|
|
12
|
+
offsetYear = 0,
|
|
13
|
+
onViewDateChange,
|
|
14
|
+
onPanelChange,
|
|
15
|
+
} = props;
|
|
11
16
|
|
|
12
17
|
const year = pickerUtils.getYear(viewDate) + offsetYear;
|
|
13
18
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import pickerUtils from '../utils/pickerUtils';
|
|
5
4
|
import type { PickerType } from '../interface';
|
|
5
|
+
import pickerUtils from '../utils/pickerUtils';
|
|
6
6
|
|
|
7
7
|
export interface PanelBodyProps {
|
|
8
8
|
prefixCls?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Button from '../../../Button';
|
|
3
3
|
import useEvent from '../../../hooks/useEvent';
|
|
4
|
-
import Header from '../Header';
|
|
5
4
|
import type { PanelSharedProps } from '../../interface';
|
|
5
|
+
import Header from '../Header';
|
|
6
6
|
|
|
7
7
|
import pickerUtils from '../../utils/pickerUtils';
|
|
8
8
|
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Dayjs } from 'dayjs';
|
|
4
4
|
import type { PickerPanelProps } from '../../interface';
|
|
5
|
-
import type { RangePanelProps } from './interface';
|
|
6
5
|
import PickerPanel from '../../picker-panel';
|
|
7
6
|
import pickerUtils from '../../utils/pickerUtils';
|
|
7
|
+
import type { RangePanelProps } from './interface';
|
|
8
8
|
|
|
9
9
|
function RangePanel(props: RangePanelProps) {
|
|
10
10
|
const {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type { PanelSharedProps, TimeUnit } from '../../interface';
|
|
4
3
|
import panelConfig from '../../configs';
|
|
4
|
+
import type { PanelSharedProps, TimeUnit } from '../../interface';
|
|
5
5
|
import pickerUtils from '../../utils/pickerUtils';
|
|
6
6
|
import TimeColumn from './TimeColumn';
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Button from '../../../Button';
|
|
3
3
|
import useEvent from '../../../hooks/useEvent';
|
|
4
|
-
import Header from '../Header';
|
|
5
4
|
import type { PanelSharedProps } from '../../interface';
|
|
5
|
+
import Header from '../Header';
|
|
6
6
|
|
|
7
7
|
import pickerUtils from '../../utils/pickerUtils';
|
|
8
8
|
|
|
@@ -26,7 +26,8 @@ type PickerType =
|
|
|
26
26
|
|
|
27
27
|
const d = {
|
|
28
28
|
dayjs: dayjs,
|
|
29
|
-
init: (date?: dayjs.ConfigType, option?: dayjs.OptionType) =>
|
|
29
|
+
init: (date?: dayjs.ConfigType, option?: dayjs.OptionType) =>
|
|
30
|
+
dayjs(date, option),
|
|
30
31
|
getNow: () => {
|
|
31
32
|
return d.init(undefined);
|
|
32
33
|
},
|
|
@@ -61,6 +61,8 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
|
61
61
|
style={{ ...style, gap: gap }}
|
|
62
62
|
ref={ref}
|
|
63
63
|
role="radiogroup"
|
|
64
|
+
aria-disabled={disabled || undefined}
|
|
65
|
+
{...rest}
|
|
64
66
|
>
|
|
65
67
|
<GroupCtx.Provider
|
|
66
68
|
value={{ name, buttonStyle, onChange: handleChange }}
|
|
@@ -68,7 +70,6 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
|
68
70
|
{options?.map((option, index) => (
|
|
69
71
|
<Radio
|
|
70
72
|
disabled={disabled}
|
|
71
|
-
{...rest}
|
|
72
73
|
{...option}
|
|
73
74
|
checked={option.value === mergedValue}
|
|
74
75
|
key={option.value || index}
|
package/src/Radio/radio.tsx
CHANGED
|
@@ -67,7 +67,12 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
|
|
|
67
67
|
);
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
|
-
<label
|
|
70
|
+
<label
|
|
71
|
+
className={cls}
|
|
72
|
+
style={style}
|
|
73
|
+
onClick={handleClick}
|
|
74
|
+
aria-disabled={disabled || undefined}
|
|
75
|
+
>
|
|
71
76
|
<span
|
|
72
77
|
className={clsx(prefixCls, {
|
|
73
78
|
[`${prefixCls}-disabled`]: disabled,
|
|
@@ -83,12 +88,12 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
|
|
|
83
88
|
checked={mergedChecked}
|
|
84
89
|
disabled={disabled}
|
|
85
90
|
onChange={handleChange}
|
|
86
|
-
aria-checked={mergedChecked}
|
|
87
91
|
/>
|
|
88
92
|
{!buttonStyle && (
|
|
89
93
|
<span
|
|
90
94
|
className={clsx(`${prefixCls}-inner`, classNames?.inner)}
|
|
91
95
|
style={styles?.inner}
|
|
96
|
+
aria-hidden="true"
|
|
92
97
|
></span>
|
|
93
98
|
)}
|
|
94
99
|
</span>
|
|
@@ -306,9 +306,7 @@ const RangePickerMobile: FC<RangePickerProps> = (props) => {
|
|
|
306
306
|
</Space>
|
|
307
307
|
)}
|
|
308
308
|
<Button block type="primary" onClick={handleTabConfirm}>
|
|
309
|
-
{activeTab === 'start'
|
|
310
|
-
? rangepicker.next
|
|
311
|
-
: rangepicker.confirm}
|
|
309
|
+
{activeTab === 'start' ? rangepicker.next : rangepicker.confirm}
|
|
312
310
|
</Button>
|
|
313
311
|
</div>
|
|
314
312
|
}
|
package/src/Rate/rate.tsx
CHANGED
|
@@ -106,6 +106,11 @@ const Rate = React.forwardRef<HTMLUListElement, RateProps>((baseprops, ref) => {
|
|
|
106
106
|
ref={componentRef}
|
|
107
107
|
role="radiogroup"
|
|
108
108
|
aria-label="Rating"
|
|
109
|
+
aria-disabled={disabled || undefined}
|
|
110
|
+
aria-valuemin={0}
|
|
111
|
+
aria-valuemax={count}
|
|
112
|
+
aria-valuenow={mergedValue}
|
|
113
|
+
aria-valuetext={`${mergedValue} out of ${count} stars`}
|
|
109
114
|
>
|
|
110
115
|
{Array(count)
|
|
111
116
|
.fill(0)
|
package/src/Rate/star.tsx
CHANGED
|
@@ -45,6 +45,7 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
45
45
|
aria-checked={active}
|
|
46
46
|
aria-posinset={index + 1}
|
|
47
47
|
aria-setsize={count}
|
|
48
|
+
aria-label={`${index + 1} ${index + 1 === 1 ? 'star' : 'stars'}`}
|
|
48
49
|
key={'star-' + index}
|
|
49
50
|
>
|
|
50
51
|
<div
|
|
@@ -57,6 +58,7 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
57
58
|
}
|
|
58
59
|
}}
|
|
59
60
|
tabIndex={0}
|
|
61
|
+
aria-label={`${index + 0.5} stars`}
|
|
60
62
|
key={'star-' + index + 'left'}
|
|
61
63
|
>
|
|
62
64
|
{character ? (
|
|
@@ -64,7 +66,10 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
64
66
|
{renderCharacter()}
|
|
65
67
|
</span>
|
|
66
68
|
) : (
|
|
67
|
-
<StarHalf
|
|
69
|
+
<StarHalf
|
|
70
|
+
className={`${prefixCls}-star-half`}
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
/>
|
|
68
73
|
)}
|
|
69
74
|
</div>
|
|
70
75
|
<div
|
|
@@ -77,6 +82,7 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
77
82
|
}
|
|
78
83
|
}}
|
|
79
84
|
tabIndex={0}
|
|
85
|
+
aria-label={`${index + 1} ${index + 1 === 1 ? 'star' : 'stars'}`}
|
|
80
86
|
key={'star-' + index + 'right'}
|
|
81
87
|
>
|
|
82
88
|
{character ? (
|
|
@@ -84,7 +90,10 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
84
90
|
{renderCharacter()}
|
|
85
91
|
</span>
|
|
86
92
|
) : (
|
|
87
|
-
<StarFull
|
|
93
|
+
<StarFull
|
|
94
|
+
className={`${prefixCls}-star-full`}
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
/>
|
|
88
97
|
)}
|
|
89
98
|
</div>
|
|
90
99
|
</li>
|
|
@@ -103,6 +112,7 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
103
112
|
aria-checked={active}
|
|
104
113
|
aria-posinset={index + 1}
|
|
105
114
|
aria-setsize={count}
|
|
115
|
+
aria-label={`${index + 1} ${index + 1 === 1 ? 'star' : 'stars'}`}
|
|
106
116
|
key={'star-' + index}
|
|
107
117
|
>
|
|
108
118
|
{character ? (
|
|
@@ -110,9 +120,15 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
110
120
|
{renderCharacter()}
|
|
111
121
|
</span>
|
|
112
122
|
) : active ? (
|
|
113
|
-
<StarFull
|
|
123
|
+
<StarFull
|
|
124
|
+
className={`${prefixCls}-star-active`}
|
|
125
|
+
aria-hidden="true"
|
|
126
|
+
/>
|
|
114
127
|
) : (
|
|
115
|
-
<StarFull
|
|
128
|
+
<StarFull
|
|
129
|
+
className={`${prefixCls}-star-inactive`}
|
|
130
|
+
aria-hidden="true"
|
|
131
|
+
/>
|
|
116
132
|
)}
|
|
117
133
|
</li>
|
|
118
134
|
)}
|
|
@@ -9,8 +9,16 @@ export default () => (
|
|
|
9
9
|
<Segmented variant="pill" options={['Daily', 'Weekly', 'Monthly']} />
|
|
10
10
|
</Space>
|
|
11
11
|
<Space block>
|
|
12
|
-
<Segmented
|
|
13
|
-
|
|
12
|
+
<Segmented
|
|
13
|
+
variant="pill"
|
|
14
|
+
size="small"
|
|
15
|
+
options={['Small', 'Default', 'Large']}
|
|
16
|
+
/>
|
|
17
|
+
<Segmented
|
|
18
|
+
variant="pill"
|
|
19
|
+
size="large"
|
|
20
|
+
options={['Small', 'Default', 'Large']}
|
|
21
|
+
/>
|
|
14
22
|
</Space>
|
|
15
23
|
<div style={{ width: 480 }}>
|
|
16
24
|
<Segmented
|
package/src/Segmented/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import InternalSegmented from './segmented';
|
|
2
2
|
|
|
3
3
|
export type {
|
|
4
|
-
SegmentedOption,
|
|
5
4
|
SegmentedLabeledOption,
|
|
5
|
+
SegmentedOption,
|
|
6
|
+
SegmentedProps,
|
|
6
7
|
SegmentedRawOption,
|
|
7
8
|
SegmentedSemanticDOM,
|
|
8
9
|
SegmentedValue,
|
|
9
|
-
SegmentedProps,
|
|
10
10
|
} from './interface';
|
|
11
11
|
|
|
12
12
|
export default InternalSegmented;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import React, { useContext, useId, useMemo } from 'react';
|
|
3
2
|
import { motion } from 'motion/react';
|
|
3
|
+
import React, { useContext, useId, useMemo } from 'react';
|
|
4
4
|
import { GlobalContext } from '../Config-Provider';
|
|
5
5
|
import useMergedState from '../hooks/useMergedState';
|
|
6
6
|
import mergeContextToProps from '../utils/mergeContextToProps';
|
|
@@ -13,9 +13,7 @@ import type {
|
|
|
13
13
|
|
|
14
14
|
import './style/index.less';
|
|
15
15
|
|
|
16
|
-
const normalizeOption = (
|
|
17
|
-
option: SegmentedOption,
|
|
18
|
-
): SegmentedLabeledOption => {
|
|
16
|
+
const normalizeOption = (option: SegmentedOption): SegmentedLabeledOption => {
|
|
19
17
|
if (typeof option === 'string' || typeof option === 'number') {
|
|
20
18
|
return { label: String(option), value: option };
|
|
21
19
|
}
|
|
@@ -47,10 +45,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
|
|
47
45
|
...rest
|
|
48
46
|
} = props;
|
|
49
47
|
|
|
50
|
-
const items = useMemo(
|
|
51
|
-
() => options.map(normalizeOption),
|
|
52
|
-
[options],
|
|
53
|
-
);
|
|
48
|
+
const items = useMemo(() => options.map(normalizeOption), [options]);
|
|
54
49
|
|
|
55
50
|
const firstValue = items[0]?.value;
|
|
56
51
|
|
|
@@ -104,9 +99,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
|
|
104
99
|
) : null}
|
|
105
100
|
<span className={`${prefixCls}-item-inner`}>
|
|
106
101
|
{item.icon ? (
|
|
107
|
-
<span className={`${prefixCls}-item-icon`}>
|
|
108
|
-
{item.icon}
|
|
109
|
-
</span>
|
|
102
|
+
<span className={`${prefixCls}-item-icon`}>{item.icon}</span>
|
|
110
103
|
) : null}
|
|
111
104
|
{item.label !== undefined && item.label !== null ? (
|
|
112
105
|
<span className={`${prefixCls}-item-label`}>
|
package/src/Select/interface.ts
CHANGED
package/src/Select/option.tsx
CHANGED
|
@@ -7,8 +7,14 @@ import { OptionsCtx } from './options';
|
|
|
7
7
|
|
|
8
8
|
const Option = (props: OptionProps) => {
|
|
9
9
|
const { label, value, disabled, title, dataTestId, style } = props;
|
|
10
|
-
const {
|
|
11
|
-
|
|
10
|
+
const {
|
|
11
|
+
prefixCls,
|
|
12
|
+
selectedKeys,
|
|
13
|
+
focusedKey,
|
|
14
|
+
multiple,
|
|
15
|
+
looseMatch,
|
|
16
|
+
onSelect,
|
|
17
|
+
} = useContext(OptionsCtx);
|
|
12
18
|
|
|
13
19
|
const handleClick = (e: React.MouseEvent | React.KeyboardEvent) => {
|
|
14
20
|
if (!disabled) {
|
package/src/Select/options.tsx
CHANGED
|
@@ -117,13 +117,20 @@ const Options = forwardRef<HTMLDivElement, OptionsProps>(
|
|
|
117
117
|
const containerRect = container.getBoundingClientRect();
|
|
118
118
|
const targetRect = targetElement.getBoundingClientRect();
|
|
119
119
|
if (targetRect.bottom > containerRect.bottom) {
|
|
120
|
-
container.scrollTop +=
|
|
121
|
-
targetRect.bottom - containerRect.bottom;
|
|
120
|
+
container.scrollTop += targetRect.bottom - containerRect.bottom;
|
|
122
121
|
} else if (targetRect.top < containerRect.top) {
|
|
123
122
|
container.scrollTop -= containerRect.top - targetRect.top;
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
|
-
}, [
|
|
125
|
+
}, [
|
|
126
|
+
focusedKey,
|
|
127
|
+
virtual,
|
|
128
|
+
options,
|
|
129
|
+
scrollToIndex,
|
|
130
|
+
rootRef,
|
|
131
|
+
multiColumn,
|
|
132
|
+
columns,
|
|
133
|
+
]);
|
|
127
134
|
|
|
128
135
|
const isEmpty = options.length === 0;
|
|
129
136
|
const ctxValue = {
|
|
@@ -257,7 +264,7 @@ const Options = forwardRef<HTMLDivElement, OptionsProps>(
|
|
|
257
264
|
style={{
|
|
258
265
|
...popupStyle,
|
|
259
266
|
...(multiColumn
|
|
260
|
-
? { '--yee-select-columns': columns } as React.CSSProperties
|
|
267
|
+
? ({ '--yee-select-columns': columns } as React.CSSProperties)
|
|
261
268
|
: undefined),
|
|
262
269
|
}}
|
|
263
270
|
ref={rootRef}
|
package/src/Select/select.tsx
CHANGED
|
@@ -97,9 +97,7 @@ const Select = (baseprops: SelectProps) => {
|
|
|
97
97
|
virtualApiRef.current?.scrollToIndex(index);
|
|
98
98
|
}, []);
|
|
99
99
|
|
|
100
|
-
const getOptions = (
|
|
101
|
-
keys: string | number | Array<string | number>,
|
|
102
|
-
) => {
|
|
100
|
+
const getOptions = (keys: string | number | Array<string | number>) => {
|
|
103
101
|
if (keys === '' || keys === null) {
|
|
104
102
|
return undefined;
|
|
105
103
|
}
|
|
@@ -133,7 +131,9 @@ const Select = (baseprops: SelectProps) => {
|
|
|
133
131
|
setOpen(false);
|
|
134
132
|
} else {
|
|
135
133
|
if (keysIncludes(mergedValue, key, looseMatch)) {
|
|
136
|
-
keys = mergedValue.filter(
|
|
134
|
+
keys = mergedValue.filter(
|
|
135
|
+
(k: string | number) => !matchValue(k, key, looseMatch),
|
|
136
|
+
);
|
|
137
137
|
} else {
|
|
138
138
|
keys = [...mergedValue, key];
|
|
139
139
|
}
|