@rainbow-oh/yee-c 0.8.0 → 0.8.1

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 (101) 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 +1 -1
  7. package/dist/cjs/Cascader/column.js +1 -1
  8. package/dist/cjs/Cascader/node.js +16 -4
  9. package/dist/cjs/Cascader/search-list.js +13 -4
  10. package/dist/cjs/Checkbox/checkbox-group.js +1 -1
  11. package/dist/cjs/Checkbox/checkbox.js +6 -3
  12. package/dist/cjs/Collapse/panel.js +10 -1
  13. package/dist/cjs/Dialog/dialog.js +22 -7
  14. package/dist/cjs/Drawer/drawer.js +14 -5
  15. package/dist/cjs/Menu/menu-item.js +14 -5
  16. package/dist/cjs/Menu/menu.js +10 -2
  17. package/dist/cjs/Pagination/items.js +10 -5
  18. package/dist/cjs/Pagination/pagination.js +9 -3
  19. package/dist/cjs/Radio/radio-group.js +6 -5
  20. package/dist/cjs/Radio/radio.js +39 -29
  21. package/dist/cjs/Rate/rate.js +6 -1
  22. package/dist/cjs/Rate/star.js +7 -3
  23. package/dist/cjs/Steps/step.js +7 -5
  24. package/dist/cjs/Steps/steps.js +1 -1
  25. package/dist/cjs/Tabs/tab-content.js +3 -1
  26. package/dist/cjs/Tabs/tab-header/index.js +3 -1
  27. package/dist/cjs/Tabs/tab-header/tab-header-title.js +3 -1
  28. package/dist/cjs/hooks/useDelayState.js +3 -2
  29. package/dist/cjs/hooks/useFocusManage.d.ts +1 -1
  30. package/dist/cjs/hooks/useFocusManage.js +27 -22
  31. package/dist/cjs/style/themes.css +1 -1
  32. package/dist/cjs/style/variables.css +1 -1
  33. package/dist/cjs/utils/focusStack.d.ts +6 -2
  34. package/dist/cjs/utils/focusStack.js +40 -11
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/esm/Card/card.js +7 -3
  38. package/dist/esm/Carousel/carousel-item.js +7 -2
  39. package/dist/esm/Carousel/carousel.js +31 -4
  40. package/dist/esm/Cascader/cascader.js +3 -1
  41. package/dist/esm/Cascader/column.js +2 -1
  42. package/dist/esm/Cascader/node.js +18 -4
  43. package/dist/esm/Cascader/search-list.js +18 -4
  44. package/dist/esm/Checkbox/checkbox-group.js +3 -1
  45. package/dist/esm/Checkbox/checkbox.js +6 -3
  46. package/dist/esm/Collapse/panel.js +11 -2
  47. package/dist/esm/Dialog/dialog.js +26 -9
  48. package/dist/esm/Drawer/drawer.js +16 -7
  49. package/dist/esm/Menu/menu-item.js +16 -5
  50. package/dist/esm/Menu/menu.js +11 -5
  51. package/dist/esm/Pagination/items.js +14 -5
  52. package/dist/esm/Pagination/pagination.js +16 -4
  53. package/dist/esm/Radio/radio-group.js +5 -4
  54. package/dist/esm/Radio/radio.js +5 -4
  55. package/dist/esm/Rate/rate.js +6 -1
  56. package/dist/esm/Rate/star.js +12 -4
  57. package/dist/esm/Steps/step.js +12 -6
  58. package/dist/esm/Steps/steps.js +3 -1
  59. package/dist/esm/Tabs/tab-content.js +3 -1
  60. package/dist/esm/Tabs/tab-header/index.js +3 -1
  61. package/dist/esm/Tabs/tab-header/tab-header-title.js +3 -1
  62. package/dist/esm/hooks/useDelayState.js +5 -2
  63. package/dist/esm/hooks/useFocusManage.d.ts +1 -1
  64. package/dist/esm/hooks/useFocusManage.js +31 -13
  65. package/dist/esm/style/themes.css +1 -1
  66. package/dist/esm/style/variables.css +1 -1
  67. package/dist/esm/utils/focusStack.d.ts +6 -2
  68. package/dist/esm/utils/focusStack.js +37 -14
  69. package/dist/esm/version.d.ts +1 -1
  70. package/dist/esm/version.js +1 -1
  71. package/dist/umd/yee-c.min.js +1 -1
  72. package/package.json +10 -6
  73. package/src/Card/card.tsx +5 -1
  74. package/src/Carousel/carousel-item.tsx +7 -1
  75. package/src/Carousel/carousel.tsx +30 -3
  76. package/src/Cascader/cascader.tsx +1 -1
  77. package/src/Cascader/column.tsx +1 -1
  78. package/src/Cascader/node.tsx +14 -2
  79. package/src/Cascader/search-list.tsx +11 -2
  80. package/src/Checkbox/checkbox-group.tsx +1 -1
  81. package/src/Checkbox/checkbox.tsx +3 -0
  82. package/src/Collapse/panel.tsx +11 -1
  83. package/src/Dialog/dialog.tsx +31 -6
  84. package/src/Drawer/drawer.tsx +12 -3
  85. package/src/Menu/menu-item.tsx +12 -3
  86. package/src/Menu/menu.tsx +11 -5
  87. package/src/Pagination/items.tsx +9 -4
  88. package/src/Pagination/pagination.tsx +10 -4
  89. package/src/Radio/radio-group.tsx +2 -1
  90. package/src/Radio/radio.tsx +7 -2
  91. package/src/Rate/rate.tsx +5 -0
  92. package/src/Rate/star.tsx +8 -4
  93. package/src/Steps/step.tsx +15 -5
  94. package/src/Steps/steps.tsx +1 -1
  95. package/src/Tabs/tab-content.tsx +2 -0
  96. package/src/Tabs/tab-header/index.tsx +2 -0
  97. package/src/Tabs/tab-header/tab-header-title.tsx +3 -1
  98. package/src/hooks/useDelayState.ts +4 -2
  99. package/src/hooks/useFocusManage.ts +33 -17
  100. package/src/utils/focusStack.ts +55 -12
  101. package/src/version.ts +1 -1
@@ -166,6 +166,9 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
166
166
  };
167
167
  var carouselProps = _objectSpread(_objectSpread({}, rest), {}, {
168
168
  className: clsx(prefixCls, ["".concat(prefixCls, "-").concat(direction)], ["".concat(prefixCls, "-").concat(effect)], _defineProperty({}, "".concat(prefixCls, "-arrows-visible"), showArrow), className),
169
+ role: 'region',
170
+ 'aria-roledescription': 'carousel',
171
+ 'aria-live': autoplay ? 'off' : 'polite',
169
172
  onMouseEnter: handleMouseEnter,
170
173
  onMouseLeave: handleMouseLeave
171
174
  });
@@ -181,24 +184,48 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
181
184
  show: infinite || current > 1
182
185
  }, classNames === null || classNames === void 0 ? void 0 : classNames.prev),
183
186
  style: styles === null || styles === void 0 ? void 0 : styles.prev,
184
- onClick: prev
187
+ onClick: prev,
188
+ role: "button",
189
+ "aria-label": "Previous slide",
190
+ tabIndex: 0,
191
+ onKeyDown: function onKeyDown(e) {
192
+ if (e.key === 'Enter' || e.key === ' ') {
193
+ e.preventDefault();
194
+ prev();
195
+ }
196
+ }
185
197
  }, direction === 'vertical' ? /*#__PURE__*/React.createElement(ChevronUp, null) : /*#__PURE__*/React.createElement(ChevronLeft, null)), /*#__PURE__*/React.createElement("div", {
186
198
  className: clsx("".concat(prefixCls, "-next"), {
187
199
  show: infinite || current !== count
188
200
  }, classNames === null || classNames === void 0 ? void 0 : classNames.next),
189
201
  style: styles === null || styles === void 0 ? void 0 : styles.next,
190
- onClick: next
202
+ onClick: next,
203
+ role: "button",
204
+ "aria-label": "Next slide",
205
+ tabIndex: 0,
206
+ onKeyDown: function onKeyDown(e) {
207
+ if (e.key === 'Enter' || e.key === ' ') {
208
+ e.preventDefault();
209
+ next();
210
+ }
211
+ }
191
212
  }, direction === 'vertical' ? /*#__PURE__*/React.createElement(ChevronDown, null) : /*#__PURE__*/React.createElement(ChevronRight, null)));
192
213
  };
193
214
  var renderDots = function renderDots() {
194
215
  return dots ? /*#__PURE__*/React.createElement("ul", {
195
216
  className: clsx("".concat(prefixCls, "-bar"), ["".concat(prefixCls, "-bar-").concat(dotShape)], ["".concat(prefixCls, "-bar-").concat(dotPosition)], classNames === null || classNames === void 0 ? void 0 : classNames.dot),
196
- style: styles === null || styles === void 0 ? void 0 : styles.dot
217
+ style: styles === null || styles === void 0 ? void 0 : styles.dot,
218
+ role: "tablist",
219
+ "aria-label": "Slide controls"
197
220
  }, new Array(React.Children.count(children)).fill(0).map(function (i, index) {
221
+ var isActive = current === index + 1 || current === 0 && index === count - 1;
198
222
  return /*#__PURE__*/React.createElement("li", {
199
223
  className: clsx({
200
- active: current === index + 1 || current === 0 && index === count
224
+ active: isActive
201
225
  }),
226
+ role: "tab",
227
+ "aria-selected": isActive,
228
+ "aria-label": "Slide ".concat(index + 1),
202
229
  tabIndex: 0,
203
230
  onClick: function onClick() {
204
231
  return handleIndicator(index + 1, 'click');
@@ -425,7 +425,9 @@ var Cascader = function Cascader(baseprops) {
425
425
  };
426
426
  var renderPopup = function renderPopup() {
427
427
  return /*#__PURE__*/React.createElement("div", {
428
- className: clsx(prefixCls)
428
+ className: clsx(prefixCls),
429
+ role: "group",
430
+ "aria-label": "Cascader options"
429
431
  }, isFilter ? /*#__PURE__*/React.createElement(SearchList, {
430
432
  prefixCls: prefixCls,
431
433
  items: filteredList,
@@ -7,7 +7,8 @@ var Column = function Column(props) {
7
7
  index = props.index;
8
8
  return /*#__PURE__*/React.createElement("ul", {
9
9
  className: "".concat(prefixCls, "-menu"),
10
- role: "menu"
10
+ role: "listbox",
11
+ "aria-label": "Level ".concat(index + 1, " options")
11
12
  }, Array.isArray(data) && data.map(function (item, idx) {
12
13
  return /*#__PURE__*/React.createElement(Node, _extends({}, item, {
13
14
  index: idx,
@@ -17,7 +17,7 @@ import isEqual from "../utils/isEqual";
17
17
  import { CascaderCtx } from "./cascader";
18
18
  import { getChildren, isHalfChecked } from "./utils";
19
19
  var Node = function Node(props) {
20
- var _expandedPath$level;
20
+ var _expandedPath$level, _expandedPath$level2, _expandedPath$level3;
21
21
  var uid = props.uid,
22
22
  value = props.value,
23
23
  disabled = props.disabled,
@@ -95,22 +95,36 @@ var Node = function Node(props) {
95
95
  onMouseEnter: handleMouseEnter,
96
96
  onClick: function onClick(e) {
97
97
  return handleClick(false, e);
98
+ },
99
+ role: "option",
100
+ "aria-disabled": disabled || undefined,
101
+ "aria-selected": checked || ((_expandedPath$level2 = expandedPath[level]) === null || _expandedPath$level2 === void 0 ? void 0 : _expandedPath$level2.key) === uid,
102
+ "aria-expanded": isParent ? ((_expandedPath$level3 = expandedPath[level]) === null || _expandedPath$level3 === void 0 ? void 0 : _expandedPath$level3.key) === uid : undefined,
103
+ tabIndex: disabled ? -1 : 0,
104
+ onKeyDown: function onKeyDown(e) {
105
+ if (e.key === 'Enter' || e.key === ' ') {
106
+ e.preventDefault();
107
+ handleClick(false, e);
108
+ }
98
109
  }
99
110
  }, multiple && /*#__PURE__*/React.createElement(Checkbox, {
100
111
  checked: isParent ? checkedAll : checked,
101
112
  onChange: isParent ? function () {
102
113
  return handleClick(true);
103
114
  } : undefined,
104
- indeterminate: indeterminate
115
+ indeterminate: indeterminate,
116
+ "aria-label": "Select ".concat(typeof label === 'string' ? label : String(label))
105
117
  }), /*#__PURE__*/React.createElement("span", {
106
118
  className: clsx("".concat(prefixCls, "-menu-item-label"), {
107
119
  loaded: load === 2
108
120
  }),
109
121
  title: typeof label === 'string' ? label : String(label)
110
122
  }, label), load === 1 ? /*#__PURE__*/React.createElement(Spin, {
111
- size: "small"
123
+ size: "small",
124
+ "aria-label": "Loading"
112
125
  }) : isLeaf === false ? /*#__PURE__*/React.createElement(ChevronRight, {
113
- size: 20
126
+ size: 20,
127
+ "aria-hidden": "true"
114
128
  }) : null);
115
129
  };
116
130
  export default /*#__PURE__*/memo(Node);
@@ -12,9 +12,11 @@ var SearchList = function SearchList(props) {
12
12
  items = props.items,
13
13
  _onClick = props.onClick;
14
14
  return /*#__PURE__*/React.createElement("ul", {
15
- className: "".concat(prefixCls, "-filter-menu")
15
+ className: "".concat(prefixCls, "-filter-menu"),
16
+ role: "listbox",
17
+ "aria-label": "Search results"
16
18
  }, items.length ? items.map(function (item) {
17
- var _item$data$$source;
19
+ var _item$data$$source, _item$data$$source2;
18
20
  var title = ((_item$data$$source = item.data.$source) === null || _item$data$$source === void 0 ? void 0 : _item$data$$source.title) || item.data.labelPath.join(' / ');
19
21
  return /*#__PURE__*/React.createElement("li", {
20
22
  className: "".concat(prefixCls, "-filter-menu-item"),
@@ -22,8 +24,20 @@ var SearchList = function SearchList(props) {
22
24
  onClick: function onClick() {
23
25
  return _onClick(item.data);
24
26
  },
25
- key: item.data.uid
27
+ key: item.data.uid,
28
+ role: "option",
29
+ "aria-disabled": ((_item$data$$source2 = item.data.$source) === null || _item$data$$source2 === void 0 ? void 0 : _item$data$$source2.disabled) || undefined,
30
+ tabIndex: 0,
31
+ onKeyDown: function onKeyDown(e) {
32
+ if (e.key === 'Enter' || e.key === ' ') {
33
+ e.preventDefault();
34
+ _onClick(item.data);
35
+ }
36
+ }
26
37
  }, renderHighlightText(item.matches));
27
- }) : /*#__PURE__*/React.createElement("p", null, 'No result'));
38
+ }) : /*#__PURE__*/React.createElement("li", {
39
+ role: "option",
40
+ "aria-disabled": "true"
41
+ }, 'No result'));
28
42
  };
29
43
  export default /*#__PURE__*/React.memo(SearchList);
@@ -60,7 +60,9 @@ var CheckboxGroup = function CheckboxGroup(baseprops) {
60
60
  };
61
61
  return /*#__PURE__*/React.createElement("div", {
62
62
  className: cls,
63
- style: style
63
+ style: style,
64
+ role: "group",
65
+ "aria-disabled": disabled || undefined
64
66
  }, /*#__PURE__*/React.createElement(CheckboxGroupCtx.Provider, {
65
67
  value: {
66
68
  name: name,
@@ -55,7 +55,8 @@ var Checkbox = function Checkbox(baseprops) {
55
55
  };
56
56
  return /*#__PURE__*/React.createElement("label", {
57
57
  className: clsx("".concat(prefixCls, "-wrapper"), _defineProperty({}, "".concat(prefixCls, "-wrapper-disabled"), disabled), className),
58
- style: style
58
+ style: style,
59
+ "aria-disabled": disabled || undefined
59
60
  }, /*#__PURE__*/React.createElement("span", {
60
61
  className: clsx("".concat(prefixCls), _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-checked"), mergedChecked), "".concat(prefixCls, "-indeterminate"), indeterminate), "".concat(prefixCls, "-disabled"), disabled))
61
62
  }, /*#__PURE__*/React.createElement("input", _extends({}, rest, {
@@ -65,10 +66,12 @@ var Checkbox = function Checkbox(baseprops) {
65
66
  value: value,
66
67
  disabled: disabled,
67
68
  checked: mergedChecked,
68
- onChange: handleChange
69
+ onChange: handleChange,
70
+ "aria-checked": indeterminate ? 'mixed' : mergedChecked
69
71
  })), /*#__PURE__*/React.createElement("span", {
70
72
  className: clsx("".concat(prefixCls, "-inner"), classNames === null || classNames === void 0 ? void 0 : classNames.inner),
71
- style: styles === null || styles === void 0 ? void 0 : styles.inner
73
+ style: styles === null || styles === void 0 ? void 0 : styles.inner,
74
+ "aria-hidden": "true"
72
75
  })), children ? /*#__PURE__*/React.createElement("span", {
73
76
  className: clsx("".concat(prefixCls, "-label"), classNames === null || classNames === void 0 ? void 0 : classNames.label),
74
77
  style: styles === null || styles === void 0 ? void 0 : styles.label
@@ -5,7 +5,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
5
5
  import clsx from 'clsx';
6
6
  import { ChevronRight } from 'lucide-react';
7
7
  import { AnimatePresence, motion } from 'motion/react';
8
- import React, { useContext } from 'react';
8
+ import React, { useContext, useId } from 'react';
9
9
  import Button from "../Button";
10
10
  import { CollapseContext } from "./collapse";
11
11
  var Panel = function Panel(props) {
@@ -21,6 +21,9 @@ var Panel = function Panel(props) {
21
21
  prefixCls = _useContext.prefixCls,
22
22
  activeKey = _useContext.activeKey,
23
23
  onExpand = _useContext.onExpand;
24
+ var panelId = useId();
25
+ var headerId = "".concat(panelId, "-header");
26
+ var contentId = "".concat(panelId, "-content");
24
27
  var expanded = activeKey.includes(id);
25
28
  var itemClassName = clsx("".concat(prefixCls, "-item"), _defineProperty({}, "".concat(prefixCls, "-item-expanded"), expanded), className);
26
29
  return /*#__PURE__*/React.createElement("div", {
@@ -30,7 +33,9 @@ var Panel = function Panel(props) {
30
33
  className: clsx("".concat(prefixCls, "-header"), classNames === null || classNames === void 0 ? void 0 : classNames.header),
31
34
  role: "button",
32
35
  style: styles === null || styles === void 0 ? void 0 : styles.header,
36
+ id: headerId,
33
37
  "aria-expanded": expanded,
38
+ "aria-controls": contentId,
34
39
  "aria-disabled": "false",
35
40
  tabIndex: 0,
36
41
  onClick: function onClick() {
@@ -50,7 +55,8 @@ var Panel = function Panel(props) {
50
55
  },
51
56
  transition: {
52
57
  duration: 0.15
53
- }
58
+ },
59
+ "aria-hidden": "true"
54
60
  }, /*#__PURE__*/React.createElement(Button, {
55
61
  icon: /*#__PURE__*/React.createElement(ChevronRight, {
56
62
  size: 16
@@ -69,6 +75,9 @@ var Panel = function Panel(props) {
69
75
  }, typeof extra === 'function' ? extra() : extra)), /*#__PURE__*/React.createElement(AnimatePresence, null, expanded && /*#__PURE__*/React.createElement(motion.div, {
70
76
  className: clsx("".concat(prefixCls, "-content"), classNames === null || classNames === void 0 ? void 0 : classNames.content),
71
77
  style: styles === null || styles === void 0 ? void 0 : styles.content,
78
+ id: contentId,
79
+ role: "region",
80
+ "aria-labelledby": headerId,
72
81
  initial: {
73
82
  height: 0,
74
83
  opacity: 0
@@ -17,7 +17,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
17
17
  import clsx from 'clsx';
18
18
  import { X } from 'lucide-react';
19
19
  import { motion } from 'motion/react';
20
- import React, { useContext, useEffect, useRef, useState } from 'react';
20
+ import React, { useCallback, useContext, useEffect, useId, useRef, useState } from 'react';
21
21
  import Button from "../Button";
22
22
  import { GlobalContext } from "../Config-Provider";
23
23
  import useEsc from "../hooks/useEsc";
@@ -35,7 +35,6 @@ var ANIMATION_DURATION = 0.2;
35
35
  var CLOSE_ICON_SIZE = 16;
36
36
  var CLOSE_ICON_STROKE_WIDTH = 1.5;
37
37
  var Dialog = function Dialog(baseprops) {
38
- var _contentRef$current2;
39
38
  var _useContext = useContext(GlobalContext),
40
39
  dialog = _useContext.dialog;
41
40
  var props = mergeContextToProps(baseprops, dialog);
@@ -84,7 +83,18 @@ var Dialog = function Dialog(baseprops) {
84
83
  _useState2 = _slicedToArray(_useState, 2),
85
84
  delayOpen = _useState2[0],
86
85
  setDelayOpen = _useState2[1];
86
+ var _useState3 = useState(null),
87
+ _useState4 = _slicedToArray(_useState3, 2),
88
+ contentElement = _useState4[0],
89
+ setContentElement = _useState4[1];
87
90
  var contentRef = useRef(null);
91
+ var setContentRef = useCallback(function (element) {
92
+ contentRef.current = element;
93
+ setContentElement(element);
94
+ }, []);
95
+ var dialogId = useId();
96
+ var titleId = "".concat(dialogId, "-title");
97
+ var bodyId = "".concat(dialogId, "-body");
88
98
 
89
99
  // When open changes and openResetLocation is true, reset position
90
100
  useEffect(function () {
@@ -102,7 +112,7 @@ var Dialog = function Dialog(baseprops) {
102
112
  });
103
113
 
104
114
  // lock focus in the dialog
105
- useLockFocus((_contentRef$current2 = contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) !== null && _contentRef$current2 !== void 0 ? _contentRef$current2 : null, delayOpen);
115
+ useLockFocus(contentElement, delayOpen);
106
116
 
107
117
  // enable esc to close dialog
108
118
  useEsc({
@@ -112,8 +122,8 @@ var Dialog = function Dialog(baseprops) {
112
122
  }
113
123
  });
114
124
 
115
- // manage focus
116
- useFocusManage(contentRef.current, delayOpen);
125
+ // manage focus once per open cycle
126
+ useFocusManage(contentElement, open);
117
127
  var cls = clsx(prefixCls, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-open"), delayOpen), "".concat(prefixCls, "-fullscreen"), fullscreen));
118
128
  var renderFooter = function renderFooter() {
119
129
  if (footer === false || footer === null) {
@@ -164,7 +174,8 @@ var Dialog = function Dialog(baseprops) {
164
174
  }
165
175
  }), showMask && delayOpen && /*#__PURE__*/React.createElement("div", {
166
176
  className: clsx("".concat(prefixCls, "-mask"), classNames === null || classNames === void 0 ? void 0 : classNames.mask),
167
- style: styles === null || styles === void 0 ? void 0 : styles.mask
177
+ style: styles === null || styles === void 0 ? void 0 : styles.mask,
178
+ "aria-hidden": "true"
168
179
  }), /*#__PURE__*/React.createElement("div", {
169
180
  className: "".concat(prefixCls, "-content-wrapper"),
170
181
  onClick: maskClosable ? onCancel : undefined
@@ -177,7 +188,11 @@ var Dialog = function Dialog(baseprops) {
177
188
  onClick: function onClick(e) {
178
189
  return e.stopPropagation();
179
190
  },
180
- ref: contentRef
191
+ ref: setContentRef,
192
+ role: "dialog",
193
+ "aria-modal": showMask ? true : undefined,
194
+ "aria-labelledby": title ? titleId : undefined,
195
+ "aria-describedby": bodyId
181
196
  }, closable ? /*#__PURE__*/React.createElement(Button, {
182
197
  type: "text",
183
198
  icon: /*#__PURE__*/React.createElement(X, {
@@ -191,10 +206,12 @@ var Dialog = function Dialog(baseprops) {
191
206
  className: clsx("".concat(prefixCls, "-header"), classNames === null || classNames === void 0 ? void 0 : classNames.header),
192
207
  style: styles === null || styles === void 0 ? void 0 : styles.header
193
208
  }, /*#__PURE__*/React.createElement("div", {
194
- className: "".concat(prefixCls, "-title")
209
+ className: "".concat(prefixCls, "-title"),
210
+ id: titleId
195
211
  }, title)) : null, /*#__PURE__*/React.createElement("div", {
196
212
  className: clsx("".concat(prefixCls, "-body"), classNames === null || classNames === void 0 ? void 0 : classNames.body),
197
- style: styles === null || styles === void 0 ? void 0 : styles.body
213
+ style: styles === null || styles === void 0 ? void 0 : styles.body,
214
+ id: bodyId
198
215
  }, children), renderFooter())));
199
216
  return /*#__PURE__*/React.createElement(Portal, {
200
217
  open: open,
@@ -15,7 +15,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
15
15
  import clsx from 'clsx';
16
16
  import { X } from 'lucide-react';
17
17
  import { motion } from 'motion/react';
18
- import React, { useContext, useRef, useState } from 'react';
18
+ import React, { useContext, useId, useRef, useState } from 'react';
19
19
  import Button from "../Button";
20
20
  import { GlobalContext } from "../Config-Provider";
21
21
  import Portal from "../Portal";
@@ -132,6 +132,9 @@ var Drawer = function Drawer(baseprops) {
132
132
  delayOpen = _useState2[0],
133
133
  setDelayOpen = _useState2[1];
134
134
  var contentRef = useRef(null);
135
+ var drawerId = useId();
136
+ var titleId = "".concat(drawerId, "-title");
137
+ var bodyId = "".concat(drawerId, "-body");
135
138
  useLockFocus(contentRef.current, delayOpen);
136
139
  useEsc({
137
140
  enabled: keyboard,
@@ -177,8 +180,7 @@ var Drawer = function Drawer(baseprops) {
177
180
  exit = _getAnimate.exit;
178
181
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
179
182
  className: cls,
180
- style: style,
181
- role: "modal"
183
+ style: style
182
184
  }), showMask && delayOpen && /*#__PURE__*/React.createElement(motion.div, {
183
185
  className: clsx("".concat(prefixCls, "-mask"), classNames === null || classNames === void 0 ? void 0 : classNames.mask),
184
186
  style: styles === null || styles === void 0 ? void 0 : styles.mask,
@@ -196,7 +198,8 @@ var Drawer = function Drawer(baseprops) {
196
198
  },
197
199
  transition: {
198
200
  duration: ANIMATION_DURATION
199
- }
201
+ },
202
+ "aria-hidden": "true"
200
203
  }), /*#__PURE__*/React.createElement(motion.div, {
201
204
  className: "".concat(prefixCls, "-content-wrapper"),
202
205
  style: {
@@ -223,16 +226,22 @@ var Drawer = function Drawer(baseprops) {
223
226
  className: clsx("".concat(prefixCls, "-content"), classNames === null || classNames === void 0 ? void 0 : classNames.content),
224
227
  tabIndex: 0,
225
228
  style: styles === null || styles === void 0 ? void 0 : styles.content,
226
- ref: contentRef
229
+ ref: contentRef,
230
+ role: "dialog",
231
+ "aria-modal": showMask ? true : undefined,
232
+ "aria-labelledby": title ? titleId : undefined,
233
+ "aria-describedby": bodyId
227
234
  }, renderClose(), title ? /*#__PURE__*/React.createElement("div", {
228
235
  className: clsx("".concat(prefixCls, "-header"), classNames === null || classNames === void 0 ? void 0 : classNames.header),
229
236
  style: styles === null || styles === void 0 ? void 0 : styles.header
230
237
  }, /*#__PURE__*/React.createElement("div", {
231
238
  className: clsx("".concat(prefixCls, "-title"), classNames === null || classNames === void 0 ? void 0 : classNames.title),
232
- style: styles === null || styles === void 0 ? void 0 : styles.title
239
+ style: styles === null || styles === void 0 ? void 0 : styles.title,
240
+ id: titleId
233
241
  }, title)) : null, /*#__PURE__*/React.createElement("div", {
234
242
  className: clsx("".concat(prefixCls, "-body"), classNames === null || classNames === void 0 ? void 0 : classNames.body),
235
- style: styles === null || styles === void 0 ? void 0 : styles.body
243
+ style: styles === null || styles === void 0 ? void 0 : styles.body,
244
+ id: bodyId
236
245
  }, children), renderFooter())));
237
246
  };
238
247
  return /*#__PURE__*/React.createElement(Portal, {
@@ -69,7 +69,11 @@ var MenuItem = function MenuItem(props) {
69
69
  paddingLeft: paddingLeft
70
70
  }, styles === null || styles === void 0 ? void 0 : styles.item),
71
71
  onClick: handleClick,
72
- title: isCollapsed && typeof label === 'string' ? label : undefined
72
+ title: isCollapsed && typeof label === 'string' ? label : undefined,
73
+ role: "menuitem",
74
+ "aria-disabled": disabled || undefined,
75
+ "aria-current": selectedKeys !== null && selectedKeys !== void 0 && selectedKeys.includes(key) ? 'page' : undefined,
76
+ tabIndex: disabled ? -1 : 0
73
77
  }, iconNode, !isCollapsed && /*#__PURE__*/React.createElement("span", {
74
78
  className: "".concat(prefixCls, "-item-content"),
75
79
  title: typeof label === 'string' ? label : ''
@@ -130,7 +134,8 @@ var MenuItem = function MenuItem(props) {
130
134
  if (isCollapsed) return null;
131
135
  if (mode === 'vertical' || mode === 'horizontal') {
132
136
  return /*#__PURE__*/React.createElement("span", {
133
- className: "".concat(prefixCls, "-item-switch")
137
+ className: "".concat(prefixCls, "-item-switch"),
138
+ "aria-hidden": "true"
134
139
  }, /*#__PURE__*/React.createElement(ChevronRight, {
135
140
  strokeWidth: 2,
136
141
  size: 18
@@ -143,14 +148,18 @@ var MenuItem = function MenuItem(props) {
143
148
  },
144
149
  transition: {
145
150
  duration: 0.15
146
- }
151
+ },
152
+ "aria-hidden": "true"
147
153
  }, /*#__PURE__*/React.createElement(ChevronDown, {
148
154
  strokeWidth: 2,
149
155
  size: 18
150
156
  }));
151
157
  };
152
158
  var triggerNode = /*#__PURE__*/React.createElement("div", {
153
- role: "submenu",
159
+ role: "menuitem",
160
+ "aria-haspopup": "true",
161
+ "aria-expanded": opened,
162
+ "aria-disabled": disabled || undefined,
154
163
  className: clsx("".concat(prefixCls, "-submenu-title"), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-submenu-open"), opened), "".concat(prefixCls, "-submenu-selected"), selectedKeys.includes(key) || selectedKeys.find(function (k) {
155
164
  return childrenKeys.includes(k);
156
165
  }))),
@@ -158,6 +167,7 @@ var MenuItem = function MenuItem(props) {
158
167
  paddingLeft: paddingLeft
159
168
  },
160
169
  onClick: handleExpand,
170
+ tabIndex: disabled ? -1 : 0,
161
171
  title: isCollapsed && typeof label === 'string' ? label : undefined
162
172
  }, iconNode, !isCollapsed && /*#__PURE__*/React.createElement("div", {
163
173
  className: "".concat(prefixCls, "-item-content"),
@@ -168,7 +178,8 @@ var MenuItem = function MenuItem(props) {
168
178
  var usePopup = mode === 'vertical' || mode === 'horizontal' || isCollapsed;
169
179
  var placement = mode === 'horizontal' && !isCollapsed ? 'bottomLeft' : 'rightTop';
170
180
  var childNode = /*#__PURE__*/React.createElement("li", {
171
- className: cls
181
+ className: cls,
182
+ role: "none"
172
183
  }, usePopup ? /*#__PURE__*/React.createElement(Trigger, {
173
184
  open: openKeys.includes(key),
174
185
  popup: popup,
@@ -25,11 +25,16 @@ var MenuGroup = function MenuGroup(_ref2) {
25
25
  prefixCls = _ref2.prefixCls,
26
26
  renderItems = _ref2.renderItems;
27
27
  return /*#__PURE__*/React.createElement("li", {
28
- className: "".concat(prefixCls, "-item-group")
28
+ className: "".concat(prefixCls, "-item-group"),
29
+ role: "none"
29
30
  }, /*#__PURE__*/React.createElement("div", {
30
- className: "".concat(prefixCls, "-item-group-title")
31
+ className: "".concat(prefixCls, "-item-group-title"),
32
+ role: "presentation",
33
+ id: "".concat(prefixCls, "-group-").concat(String(item.label))
31
34
  }, item.label), /*#__PURE__*/React.createElement("ul", {
32
- className: "".concat(prefixCls, "-item-group-list")
35
+ className: "".concat(prefixCls, "-item-group-list"),
36
+ role: "group",
37
+ "aria-labelledby": "".concat(prefixCls, "-group-").concat(String(item.label))
33
38
  }, renderItems(item.children)));
34
39
  };
35
40
  var Menu = function Menu(props) {
@@ -89,7 +94,7 @@ var Menu = function Menu(props) {
89
94
  return /*#__PURE__*/React.createElement("ul", _extends({}, dataAttrs, {
90
95
  className: cls,
91
96
  style: rootStyle,
92
- role: "menu"
97
+ role: root && mode === 'horizontal' ? 'menubar' : 'menu'
93
98
  }), /*#__PURE__*/React.createElement(MenuCtx.Provider, {
94
99
  value: {
95
100
  level: level,
@@ -98,7 +103,8 @@ var Menu = function Menu(props) {
98
103
  styles: styles
99
104
  }
100
105
  }, getChildFromItems(items), level === 0 && footer && /*#__PURE__*/React.createElement("li", {
101
- className: "".concat(prefixCls, "-footer")
106
+ className: "".concat(prefixCls, "-footer"),
107
+ role: "none"
102
108
  }, footer)));
103
109
  };
104
110
  Menu.displayName = 'Menu';
@@ -60,15 +60,18 @@ var Items = function Items(props) {
60
60
  }
61
61
  },
62
62
  role: "button",
63
+ "aria-label": "Jump back 7 pages",
63
64
  key: "turnleft"
64
65
  }, (_components$jumpPrev = components === null || components === void 0 ? void 0 : components.jumpPrev) !== null && _components$jumpPrev !== void 0 ? _components$jumpPrev : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
65
- className: "".concat(prefixCls, "-jump-prev-ellipsis")
66
+ className: "".concat(prefixCls, "-jump-prev-ellipsis"),
67
+ "aria-hidden": "true"
66
68
  }, /*#__PURE__*/React.createElement(Ellipsis, {
67
69
  className: "ellipsis",
68
70
  size: 18,
69
71
  strokeWidth: 1.5
70
72
  })), /*#__PURE__*/React.createElement("span", {
71
- className: "".concat(prefixCls, "-jump-prev-icon")
73
+ className: "".concat(prefixCls, "-jump-prev-icon"),
74
+ "aria-hidden": "true"
72
75
  }, /*#__PURE__*/React.createElement(ChevronsLeft, {
73
76
  className: "turn",
74
77
  size: 18,
@@ -89,15 +92,18 @@ var Items = function Items(props) {
89
92
  }
90
93
  },
91
94
  role: "button",
95
+ "aria-label": "Jump forward 7 pages",
92
96
  key: "turn-right"
93
97
  }, (_components$jumpNext = components === null || components === void 0 ? void 0 : components.jumpNext) !== null && _components$jumpNext !== void 0 ? _components$jumpNext : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
94
- className: "".concat(prefixCls, "-jump-next-ellipsis")
98
+ className: "".concat(prefixCls, "-jump-next-ellipsis"),
99
+ "aria-hidden": "true"
95
100
  }, /*#__PURE__*/React.createElement(Ellipsis, {
96
101
  className: "ellipsis",
97
102
  size: 18,
98
103
  strokeWidth: 1.5
99
104
  })), /*#__PURE__*/React.createElement("span", {
100
- className: "".concat(prefixCls, "-jump-next-icon")
105
+ className: "".concat(prefixCls, "-jump-next-icon"),
106
+ "aria-hidden": "true"
101
107
  }, /*#__PURE__*/React.createElement(ChevronsRight, {
102
108
  className: "turn",
103
109
  size: 18,
@@ -116,7 +122,10 @@ var Items = function Items(props) {
116
122
  if (e.key === 'Enter') {
117
123
  onChange(number);
118
124
  }
119
- }
125
+ },
126
+ role: "button",
127
+ "aria-label": "Page ".concat(number),
128
+ "aria-current": current === number ? 'page' : undefined
120
129
  }, number);
121
130
  }
122
131
  }));
@@ -169,10 +169,14 @@ var Pagination = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
169
169
  prevClick();
170
170
  }
171
171
  },
172
+ role: "button",
173
+ "aria-label": "Previous page",
174
+ "aria-disabled": mergedCurrent === 1 || undefined,
172
175
  key: "prev"
173
176
  }, (_components$prev = components === null || components === void 0 ? void 0 : components.prev) !== null && _components$prev !== void 0 ? _components$prev : /*#__PURE__*/React.createElement(ChevronLeft, {
174
177
  size: 20,
175
- strokeWidth: 1.5
178
+ strokeWidth: 1.5,
179
+ "aria-hidden": "true"
176
180
  }));
177
181
  };
178
182
  var renderNext = function renderNext() {
@@ -187,10 +191,14 @@ var Pagination = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
187
191
  nextClick();
188
192
  }
189
193
  },
194
+ role: "button",
195
+ "aria-label": "Next page",
196
+ "aria-disabled": mergedCurrent === pageCount || undefined,
190
197
  key: "next"
191
198
  }, (_components$next = components === null || components === void 0 ? void 0 : components.next) !== null && _components$next !== void 0 ? _components$next : /*#__PURE__*/React.createElement(ChevronRight, {
192
199
  size: 20,
193
- strokeWidth: 1.5
200
+ strokeWidth: 1.5,
201
+ "aria-hidden": "true"
194
202
  }));
195
203
  };
196
204
  var renderSizeChanger = function renderSizeChanger() {
@@ -225,11 +233,15 @@ var Pagination = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
225
233
  return /*#__PURE__*/React.createElement("ul", _extends({}, rest, {
226
234
  className: cls,
227
235
  style: style,
228
- ref: ref
236
+ ref: ref,
237
+ role: "navigation",
238
+ "aria-label": "Pagination",
239
+ "aria-disabled": disabled || undefined
229
240
  }), renderTotal(), renderPrevious(), simple ? /*#__PURE__*/React.createElement("li", {
230
241
  className: "".concat(prefixCls, "-simple")
231
242
  }, renderNumber(false), /*#__PURE__*/React.createElement("span", {
232
- className: "split"
243
+ className: "split",
244
+ "aria-hidden": "true"
233
245
  }, "/"), /*#__PURE__*/React.createElement("span", {
234
246
  className: "total-page"
235
247
  }, pageCount)) : /*#__PURE__*/React.createElement(Items, {
@@ -53,14 +53,15 @@ var RadioGroup = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
53
53
  setMergedValue(event.target.value);
54
54
  onChange === null || onChange === void 0 || onChange(event.target.value, event);
55
55
  };
56
- return /*#__PURE__*/React.createElement("div", {
56
+ return /*#__PURE__*/React.createElement("div", _extends({
57
57
  className: cls,
58
58
  style: _objectSpread(_objectSpread({}, style), {}, {
59
59
  gap: gap
60
60
  }),
61
61
  ref: ref,
62
- role: "radiogroup"
63
- }, /*#__PURE__*/React.createElement(GroupCtx.Provider, {
62
+ role: "radiogroup",
63
+ "aria-disabled": disabled || undefined
64
+ }, rest), /*#__PURE__*/React.createElement(GroupCtx.Provider, {
64
65
  value: {
65
66
  name: name,
66
67
  buttonStyle: buttonStyle,
@@ -69,7 +70,7 @@ var RadioGroup = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
69
70
  }, options === null || options === void 0 ? void 0 : options.map(function (option, index) {
70
71
  return /*#__PURE__*/React.createElement(Radio, _extends({
71
72
  disabled: disabled
72
- }, rest, option, {
73
+ }, option, {
73
74
  checked: option.value === mergedValue,
74
75
  key: option.value || index
75
76
  }));