@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.
Files changed (188) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +40 -25
  3. package/dist/cjs/Card/card.js +7 -3
  4. package/dist/cjs/Carousel/carousel-item.js +7 -2
  5. package/dist/cjs/Carousel/carousel.js +31 -4
  6. package/dist/cjs/Cascader/cascader.js +38 -30
  7. package/dist/cjs/Cascader/column.js +17 -9
  8. package/dist/cjs/Cascader/node.js +16 -4
  9. package/dist/cjs/Cascader/search-list.js +31 -14
  10. package/dist/cjs/Cascader/utils/index.js +1 -5
  11. package/dist/cjs/Checkbox/checkbox-group.js +23 -14
  12. package/dist/cjs/Checkbox/checkbox.js +6 -3
  13. package/dist/cjs/Collapse/panel.js +10 -1
  14. package/dist/cjs/Dialog/dialog.js +22 -7
  15. package/dist/cjs/Dialog/interface.d.ts +1 -1
  16. package/dist/cjs/Dialog/style/index.less +2 -1
  17. package/dist/cjs/Drawer/drawer.js +22 -5
  18. package/dist/cjs/Form/Group.js +1 -1
  19. package/dist/cjs/Form/demo/tooltip.js +1 -3
  20. package/dist/cjs/List/hooks/useListKeyboard.js +3 -1
  21. package/dist/cjs/Menu/menu-item.js +14 -5
  22. package/dist/cjs/Menu/menu.js +26 -2
  23. package/dist/cjs/Pagination/items.js +60 -27
  24. package/dist/cjs/Pagination/pagination.js +33 -11
  25. package/dist/cjs/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
  26. package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.js +7 -1
  27. package/dist/cjs/Radio/radio-group.js +6 -5
  28. package/dist/cjs/Radio/radio.js +39 -29
  29. package/dist/cjs/Rate/rate.js +6 -1
  30. package/dist/cjs/Rate/star.js +31 -3
  31. package/dist/cjs/Segmented/demo/variant.js +15 -1
  32. package/dist/cjs/Segmented/index.d.ts +1 -1
  33. package/dist/cjs/Segmented/segmented.js +12 -15
  34. package/dist/cjs/Select/option.js +8 -1
  35. package/dist/cjs/Select/options.js +9 -1
  36. package/dist/cjs/Select/select.js +3 -1
  37. package/dist/cjs/Steps/step.js +19 -5
  38. package/dist/cjs/Steps/steps.js +11 -1
  39. package/dist/cjs/Table/demo/components-override.js +31 -2
  40. package/dist/cjs/Table/demo/grouping.js +7 -1
  41. package/dist/cjs/Table/hooks/useColumns.d.ts +3 -3
  42. package/dist/cjs/Table/hooks/useColumns.js +11 -14
  43. package/dist/cjs/Table/index.d.ts +1 -1
  44. package/dist/cjs/Table/style/index.less +2 -4
  45. package/dist/cjs/Table/tbody/row.js +1 -4
  46. package/dist/cjs/Table/theader/index.js +12 -4
  47. package/dist/cjs/Tabs/tab-content.js +3 -1
  48. package/dist/cjs/Tabs/tab-header/index.js +3 -1
  49. package/dist/cjs/Tabs/tab-header/tab-header-title.js +3 -1
  50. package/dist/cjs/Tour/index.d.ts +1 -1
  51. package/dist/cjs/Tree/style/index.less +1 -5
  52. package/dist/cjs/Tree/tree.js +38 -35
  53. package/dist/cjs/hooks/useDelayState.js +3 -2
  54. package/dist/cjs/hooks/useEvent.js +1 -4
  55. package/dist/cjs/hooks/useFocusManage.d.ts +1 -1
  56. package/dist/cjs/hooks/useFocusManage.js +27 -22
  57. package/dist/cjs/style/size.css +2 -0
  58. package/dist/cjs/style/themes.css +1 -1
  59. package/dist/cjs/style/variables.css +3 -1
  60. package/dist/cjs/utils/focusStack.d.ts +6 -2
  61. package/dist/cjs/utils/focusStack.js +40 -11
  62. package/dist/cjs/version.d.ts +1 -1
  63. package/dist/cjs/version.js +1 -1
  64. package/dist/esm/Card/card.js +7 -3
  65. package/dist/esm/Carousel/carousel-item.js +7 -2
  66. package/dist/esm/Carousel/carousel.js +31 -4
  67. package/dist/esm/Cascader/cascader.js +3 -1
  68. package/dist/esm/Cascader/column.js +2 -1
  69. package/dist/esm/Cascader/node.js +18 -4
  70. package/dist/esm/Cascader/search-list.js +18 -4
  71. package/dist/esm/Checkbox/checkbox-group.js +3 -1
  72. package/dist/esm/Checkbox/checkbox.js +6 -3
  73. package/dist/esm/Collapse/panel.js +11 -2
  74. package/dist/esm/Dialog/dialog.js +28 -11
  75. package/dist/esm/Dialog/interface.d.ts +1 -1
  76. package/dist/esm/Dialog/style/index.less +2 -1
  77. package/dist/esm/Drawer/drawer.js +16 -7
  78. package/dist/esm/Form/Group.js +1 -1
  79. package/dist/esm/Menu/menu-item.js +16 -5
  80. package/dist/esm/Menu/menu.js +11 -5
  81. package/dist/esm/Pagination/items.js +14 -5
  82. package/dist/esm/Pagination/pagination.js +16 -4
  83. package/dist/esm/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
  84. package/dist/esm/Radio/radio-group.js +5 -4
  85. package/dist/esm/Radio/radio.js +5 -4
  86. package/dist/esm/Rate/rate.js +6 -1
  87. package/dist/esm/Rate/star.js +12 -4
  88. package/dist/esm/Segmented/index.d.ts +1 -1
  89. package/dist/esm/Segmented/segmented.js +1 -1
  90. package/dist/esm/Steps/step.js +12 -6
  91. package/dist/esm/Steps/steps.js +3 -1
  92. package/dist/esm/Table/demo/components-override.js +1 -0
  93. package/dist/esm/Table/hooks/useColumns.d.ts +3 -3
  94. package/dist/esm/Table/hooks/useColumns.js +13 -16
  95. package/dist/esm/Table/index.d.ts +1 -1
  96. package/dist/esm/Table/style/index.less +2 -4
  97. package/dist/esm/Tabs/tab-content.js +3 -1
  98. package/dist/esm/Tabs/tab-header/index.js +3 -1
  99. package/dist/esm/Tabs/tab-header/tab-header-title.js +3 -1
  100. package/dist/esm/Tour/index.d.ts +1 -1
  101. package/dist/esm/Tree/style/index.less +1 -5
  102. package/dist/esm/Tree/tree.js +1 -1
  103. package/dist/esm/hooks/useDelayState.js +5 -2
  104. package/dist/esm/hooks/useFocusManage.d.ts +1 -1
  105. package/dist/esm/hooks/useFocusManage.js +31 -13
  106. package/dist/esm/style/size.css +2 -0
  107. package/dist/esm/style/themes.css +1 -1
  108. package/dist/esm/style/variables.css +3 -1
  109. package/dist/esm/utils/focusStack.d.ts +6 -2
  110. package/dist/esm/utils/focusStack.js +37 -14
  111. package/dist/esm/version.d.ts +1 -1
  112. package/dist/esm/version.js +1 -1
  113. package/dist/umd/yee-c.min.css +2 -2
  114. package/dist/umd/yee-c.min.js +1 -1
  115. package/package.json +10 -6
  116. package/src/Anchor/anchor.tsx +2 -2
  117. package/src/Card/card.tsx +5 -1
  118. package/src/Carousel/carousel-item.tsx +7 -1
  119. package/src/Carousel/carousel.tsx +29 -3
  120. package/src/Cascader/cascader.tsx +5 -1
  121. package/src/Cascader/column.tsx +5 -1
  122. package/src/Cascader/node.tsx +14 -2
  123. package/src/Cascader/search-list.tsx +19 -3
  124. package/src/Cascader/utils/index.ts +3 -6
  125. package/src/Checkbox/checkbox-group.tsx +6 -1
  126. package/src/Checkbox/checkbox.tsx +3 -0
  127. package/src/Collapse/panel.tsx +11 -1
  128. package/src/Dialog/dialog.tsx +35 -6
  129. package/src/Dialog/interface.ts +1 -1
  130. package/src/Dialog/style/index.less +2 -1
  131. package/src/Drawer/drawer.tsx +18 -3
  132. package/src/Form/Group.tsx +2 -4
  133. package/src/Form/demo/tooltip.tsx +2 -11
  134. package/src/Form/utils/validate.ts +1 -4
  135. package/src/List/hooks/useListKeyboard.ts +3 -3
  136. package/src/List/list.tsx +2 -1
  137. package/src/Menu/menu-item.tsx +12 -3
  138. package/src/Menu/menu.tsx +22 -5
  139. package/src/Pagination/items.tsx +21 -4
  140. package/src/Pagination/pagination.tsx +24 -4
  141. package/src/PickerPanel/panels/DatePanel/DateBody.tsx +1 -1
  142. package/src/PickerPanel/panels/DateTimePanel/index.tsx +1 -1
  143. package/src/PickerPanel/panels/MonthPanel/MonthHeader.tsx +7 -2
  144. package/src/PickerPanel/panels/PanelBody.tsx +1 -1
  145. package/src/PickerPanel/panels/QuarterPanel/QuarterHeader.tsx +1 -1
  146. package/src/PickerPanel/panels/RangePanel/index.tsx +1 -1
  147. package/src/PickerPanel/panels/TimePanel/TimeBody.tsx +1 -1
  148. package/src/PickerPanel/panels/YearPanel/YearHeader.tsx +1 -1
  149. package/src/PickerPanel/utils/pickerUtils.ts +2 -1
  150. package/src/Radio/radio-group.tsx +2 -1
  151. package/src/Radio/radio.tsx +7 -2
  152. package/src/RangePicker/range-picker-mobile.tsx +1 -3
  153. package/src/Rate/rate.tsx +5 -0
  154. package/src/Rate/star.tsx +20 -4
  155. package/src/Segmented/demo/variant.tsx +10 -2
  156. package/src/Segmented/index.ts +2 -2
  157. package/src/Segmented/segmented.tsx +4 -11
  158. package/src/Select/interface.ts +0 -1
  159. package/src/Select/option.tsx +8 -2
  160. package/src/Select/options.tsx +11 -4
  161. package/src/Select/select.tsx +4 -4
  162. package/src/Steps/step.tsx +23 -5
  163. package/src/Steps/steps.tsx +8 -1
  164. package/src/Table/demo/components-override.tsx +34 -7
  165. package/src/Table/demo/grouping.tsx +8 -4
  166. package/src/Table/hooks/useColumns.ts +14 -18
  167. package/src/Table/index.ts +3 -3
  168. package/src/Table/style/index.less +2 -4
  169. package/src/Table/table.tsx +2 -4
  170. package/src/Table/tbody/row.tsx +1 -3
  171. package/src/Table/theader/index.tsx +9 -10
  172. package/src/Tabs/tab-content.tsx +2 -0
  173. package/src/Tabs/tab-header/index.tsx +2 -0
  174. package/src/Tabs/tab-header/tab-header-title.tsx +3 -1
  175. package/src/Tour/demo/placement.tsx +2 -1
  176. package/src/Tour/index.ts +1 -1
  177. package/src/Tree/style/index.less +1 -5
  178. package/src/Tree/tree.tsx +16 -11
  179. package/src/Tree/utils/tree-tools.ts +4 -1
  180. package/src/hooks/useDelayState.ts +4 -2
  181. package/src/hooks/useEvent.ts +1 -3
  182. package/src/hooks/useFocusManage.ts +33 -17
  183. package/src/locale/context.tsx +5 -1
  184. package/src/locale/interface.ts +3 -1
  185. package/src/style/size.css +2 -0
  186. package/src/utils/debounce.ts +1 -3
  187. package/src/utils/focusStack.ts +55 -12
  188. 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
- string | number
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 = virtual && height !== null && height !== undefined && Array.isArray(items);
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
@@ -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="submenu"
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 className={`${prefixCls}-item-group-title`}>{item.label}</div>
45
- <ul className={`${prefixCls}-item-group-list`}>
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 {...dataAttrs} className={cls} style={rootStyle} role="menu">
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`}>{footer}</li>
134
+ <li className={`${prefixCls}-footer`} role="none">
135
+ {footer}
136
+ </li>
120
137
  )}
121
138
  </MenuCtx.Provider>
122
139
  </ul>
@@ -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 className={`${prefixCls}-jump-prev-ellipsis`}>
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 className={`${prefixCls}-jump-prev-icon`}>
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 className={`${prefixCls}-jump-next-ellipsis`}>
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 className={`${prefixCls}-jump-next-icon`}>
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 ?? <ChevronLeft size={20} strokeWidth={1.5} />}
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 ?? <ChevronRight size={20} strokeWidth={1.5} />}
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 {...rest} className={cls} style={style} ref={ref}>
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">/</span>
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 { PickerType, PanelSharedProps } from '../../interface';
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 { prefixCls, viewDate, offsetYear = 0, onViewDateChange, onPanelChange } =
10
- props;
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) => dayjs(date, option),
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}
@@ -67,7 +67,12 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
67
67
  );
68
68
 
69
69
  return (
70
- <label className={cls} style={style} onClick={handleClick}>
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 className={`${prefixCls}-star-half`} />
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 className={`${prefixCls}-star-full`} />
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 className={`${prefixCls}-star-active`} />
123
+ <StarFull
124
+ className={`${prefixCls}-star-active`}
125
+ aria-hidden="true"
126
+ />
114
127
  ) : (
115
- <StarFull className={`${prefixCls}-star-inactive`} />
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 variant="pill" size="small" options={['Small', 'Default', 'Large']} />
13
- <Segmented variant="pill" size="large" options={['Small', 'Default', 'Large']} />
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
@@ -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`}>
@@ -277,4 +277,3 @@ export interface OptionsProps extends Omit<
277
277
  e?: React.MouseEvent | React.KeyboardEvent,
278
278
  ) => void;
279
279
  }
280
-
@@ -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 { prefixCls, selectedKeys, focusedKey, multiple, looseMatch, onSelect } =
11
- useContext(OptionsCtx);
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) {
@@ -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
- }, [focusedKey, virtual, options, scrollToIndex, rootRef, multiColumn, columns]);
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}
@@ -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((k: string | number) => !matchValue(k, key, looseMatch));
134
+ keys = mergedValue.filter(
135
+ (k: string | number) => !matchValue(k, key, looseMatch),
136
+ );
137
137
  } else {
138
138
  keys = [...mergedValue, key];
139
139
  }