@rainbow-oh/yee-c 0.8.5 → 0.8.7

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 (59) hide show
  1. package/dist/cjs/Alert/alert.js +1 -0
  2. package/dist/cjs/Anchor/anchor.js +195 -12
  3. package/dist/cjs/Anchor/interface.d.ts +1 -1
  4. package/dist/cjs/Input/input.js +3 -0
  5. package/dist/cjs/Input/style/index.less +2 -2
  6. package/dist/cjs/Select/option.js +2 -1
  7. package/dist/cjs/Select/options.js +6 -0
  8. package/dist/cjs/Selector/selector.js +20 -1
  9. package/dist/cjs/Spin/style/index.less +11 -6
  10. package/dist/cjs/Table/theader/filter.js +1 -1
  11. package/dist/cjs/Tag/tag.js +23 -8
  12. package/dist/cjs/Tree/interface.d.ts +2 -1
  13. package/dist/cjs/Tree/tree-node.js +6 -1
  14. package/dist/cjs/Tree/tree.js +56 -12
  15. package/dist/cjs/Trigger/interface.d.ts +2 -1
  16. package/dist/cjs/style/themes.css +1 -1
  17. package/dist/cjs/style/variables.css +1 -1
  18. package/dist/cjs/version.d.ts +1 -1
  19. package/dist/cjs/version.js +1 -1
  20. package/dist/esm/Alert/alert.js +1 -0
  21. package/dist/esm/Anchor/anchor.js +133 -12
  22. package/dist/esm/Anchor/interface.d.ts +1 -1
  23. package/dist/esm/Input/input.js +3 -0
  24. package/dist/esm/Input/style/index.less +2 -2
  25. package/dist/esm/Select/option.js +2 -1
  26. package/dist/esm/Select/options.js +6 -0
  27. package/dist/esm/Selector/selector.js +13 -1
  28. package/dist/esm/Spin/style/index.less +11 -6
  29. package/dist/esm/Table/theader/filter.js +1 -1
  30. package/dist/esm/Tag/tag.js +6 -1
  31. package/dist/esm/Tree/interface.d.ts +2 -1
  32. package/dist/esm/Tree/tree-node.js +6 -1
  33. package/dist/esm/Tree/tree.js +14 -5
  34. package/dist/esm/Trigger/interface.d.ts +2 -1
  35. package/dist/esm/style/themes.css +1 -1
  36. package/dist/esm/style/variables.css +1 -1
  37. package/dist/esm/version.d.ts +1 -1
  38. package/dist/esm/version.js +1 -1
  39. package/dist/umd/yee-c.min.css +1 -1
  40. package/dist/umd/yee-c.min.js +1 -1
  41. package/package.json +1 -1
  42. package/src/Alert/alert.tsx +1 -0
  43. package/src/Anchor/anchor.tsx +224 -13
  44. package/src/Anchor/index.en-US.md +1 -1
  45. package/src/Anchor/index.zh-CN.md +1 -1
  46. package/src/Anchor/interface.ts +1 -1
  47. package/src/Input/input.tsx +3 -0
  48. package/src/Input/style/index.less +2 -2
  49. package/src/Select/option.tsx +2 -1
  50. package/src/Select/options.tsx +6 -0
  51. package/src/Selector/selector.tsx +16 -1
  52. package/src/Spin/style/index.less +11 -6
  53. package/src/Table/theader/filter.tsx +1 -1
  54. package/src/Tag/tag.tsx +14 -1
  55. package/src/Tree/interface.ts +3 -1
  56. package/src/Tree/tree-node.tsx +5 -0
  57. package/src/Tree/tree.tsx +8 -0
  58. package/src/Trigger/interface.ts +2 -1
  59. package/src/version.ts +1 -1
@@ -151,6 +151,7 @@ var Alert = (baseprops) => {
151
151
  return /* @__PURE__ */ import_react.default.createElement(
152
152
  "div",
153
153
  __spreadProps(__spreadValues({}, rest), {
154
+ role: "alert",
154
155
  className: (0, import_clsx.default)(
155
156
  prefixCls,
156
157
  [`${prefixCls}-${mergedState}`],
@@ -73,6 +73,19 @@ var import_style = require("./style/index.less");
73
73
  var AnchorContext = (0, import_react.createContext)(
74
74
  {}
75
75
  );
76
+ var NAVIGATION_LOCK_TIMEOUT = 5e3;
77
+ var NAVIGATION_SETTLE_DELAY = 100;
78
+ var TARGET_POSITION_TOLERANCE = 2;
79
+ var SCROLL_KEYS = /* @__PURE__ */ new Set([
80
+ "ArrowUp",
81
+ "ArrowDown",
82
+ "PageUp",
83
+ "PageDown",
84
+ "Home",
85
+ "End",
86
+ " ",
87
+ "Spacebar"
88
+ ]);
76
89
  var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
77
90
  const { anchor } = (0, import_react.useContext)(import_Config_Provider.GlobalContext);
78
91
  const props = (0, import_mergeContextToProps.default)(baseprops, anchor);
@@ -117,10 +130,79 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
117
130
  });
118
131
  const [anchorList, setAnchorList] = (0, import_react.useState)([]);
119
132
  const containerRef = (0, import_react.useRef)(null);
133
+ const anchorRootRef = (0, import_react.useRef)(null);
120
134
  const activeKeyRef = (0, import_react.useRef)(mergedActiveKey);
135
+ const handleScrollRef = (0, import_react.useRef)(() => {
136
+ });
137
+ const pendingTargetKeyRef = (0, import_react.useRef)(void 0);
138
+ const navigationTimeoutRef = (0, import_react.useRef)(
139
+ null
140
+ );
141
+ const navigationSettleTimeoutRef = (0, import_react.useRef)(null);
121
142
  (0, import_react.useEffect)(() => {
122
143
  activeKeyRef.current = mergedActiveKey;
123
144
  }, [mergedActiveKey]);
145
+ const setAnchorRootRef = (0, import_react.useCallback)(
146
+ (node) => {
147
+ anchorRootRef.current = node;
148
+ if (typeof ref === "function") {
149
+ ref(node);
150
+ } else if (ref) {
151
+ ref.current = node;
152
+ }
153
+ },
154
+ [ref]
155
+ );
156
+ const clearNavigationSettleTimer = (0, import_react.useCallback)(() => {
157
+ if (navigationSettleTimeoutRef.current !== null) {
158
+ clearTimeout(navigationSettleTimeoutRef.current);
159
+ navigationSettleTimeoutRef.current = null;
160
+ }
161
+ }, []);
162
+ const clearNavigationLock = (0, import_react.useCallback)(() => {
163
+ pendingTargetKeyRef.current = void 0;
164
+ clearNavigationSettleTimer();
165
+ if (navigationTimeoutRef.current !== null) {
166
+ clearTimeout(navigationTimeoutRef.current);
167
+ navigationTimeoutRef.current = null;
168
+ }
169
+ }, [clearNavigationSettleTimer]);
170
+ const scheduleNavigationUnlock = (0, import_react.useCallback)(
171
+ (key) => {
172
+ clearNavigationSettleTimer();
173
+ navigationSettleTimeoutRef.current = setTimeout(() => {
174
+ if (pendingTargetKeyRef.current === key) {
175
+ clearNavigationLock();
176
+ }
177
+ }, NAVIGATION_SETTLE_DELAY);
178
+ },
179
+ [clearNavigationLock, clearNavigationSettleTimer]
180
+ );
181
+ const startNavigationLock = (0, import_react.useCallback)(
182
+ (key) => {
183
+ clearNavigationLock();
184
+ pendingTargetKeyRef.current = key;
185
+ navigationTimeoutRef.current = setTimeout(() => {
186
+ if (pendingTargetKeyRef.current === key) {
187
+ clearNavigationLock();
188
+ handleScrollRef.current();
189
+ }
190
+ }, NAVIGATION_LOCK_TIMEOUT);
191
+ },
192
+ [clearNavigationLock]
193
+ );
194
+ (0, import_react.useEffect)(() => clearNavigationLock, [clearNavigationLock]);
195
+ const commitActiveKey = (0, import_react.useCallback)(
196
+ (key, forceNotify = false) => {
197
+ const changed = activeKeyRef.current !== key;
198
+ activeKeyRef.current = key;
199
+ setMergedActiveKey(key);
200
+ if (changed || forceNotify) {
201
+ onChange == null ? void 0 : onChange(key);
202
+ }
203
+ },
204
+ [onChange]
205
+ );
124
206
  const generateAnchorList = (0, import_react.useCallback)(() => {
125
207
  if (!auto || !name)
126
208
  return;
@@ -149,10 +231,39 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
149
231
  const currentScroll = container === window ? window.scrollY : container.scrollTop;
150
232
  return currentScroll + (target.getBoundingClientRect().top - containerTop);
151
233
  }, []);
234
+ const hasReachedTarget = (0, import_react.useCallback)(
235
+ (key) => {
236
+ var _a2;
237
+ const container = containerRef.current;
238
+ const target = document.getElementById(key);
239
+ if (!container || !target)
240
+ return false;
241
+ const currentScroll = container === window ? window.pageYOffset || document.documentElement.scrollTop : container.scrollTop;
242
+ const maxScroll = container === window ? Math.max(
243
+ document.documentElement.scrollHeight,
244
+ ((_a2 = document.body) == null ? void 0 : _a2.scrollHeight) || 0
245
+ ) - window.innerHeight : container.scrollHeight - container.clientHeight;
246
+ const targetScroll = Math.min(
247
+ Math.max(getTargetOffsetTop(target) - offsetTop, 0),
248
+ Math.max(maxScroll, 0)
249
+ );
250
+ return Math.abs(currentScroll - targetScroll) <= TARGET_POSITION_TOLERANCE;
251
+ },
252
+ [getTargetOffsetTop, offsetTop]
253
+ );
152
254
  const handleScroll = (0, import_react.useCallback)(() => {
153
255
  const container = containerRef.current;
154
256
  if (!container)
155
257
  return;
258
+ const pendingTargetKey = pendingTargetKeyRef.current;
259
+ if (pendingTargetKey) {
260
+ if (hasReachedTarget(pendingTargetKey)) {
261
+ scheduleNavigationUnlock(pendingTargetKey);
262
+ } else {
263
+ clearNavigationSettleTimer();
264
+ }
265
+ return;
266
+ }
156
267
  const scrollTop = container === window ? window.pageYOffset || document.documentElement.scrollTop : container.scrollTop;
157
268
  const currentItems2 = auto ? anchorList : items;
158
269
  if (!currentItems2 || currentItems2.length === 0)
@@ -175,11 +286,24 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
175
286
  );
176
287
  nextActiveKey = first == null ? void 0 : first.key;
177
288
  }
178
- if (nextActiveKey && activeKeyRef.current !== nextActiveKey) {
179
- setMergedActiveKey(nextActiveKey);
180
- onChange == null ? void 0 : onChange(nextActiveKey);
289
+ if (nextActiveKey) {
290
+ commitActiveKey(nextActiveKey);
181
291
  }
182
- }, [auto, anchorList, items, offsetTop, onChange, getTargetOffsetTop]);
292
+ }, [
293
+ auto,
294
+ anchorList,
295
+ items,
296
+ offsetTop,
297
+ getTargetOffsetTop,
298
+ hasReachedTarget,
299
+ scheduleNavigationUnlock,
300
+ clearNavigationSettleTimer,
301
+ clearNavigationLock,
302
+ commitActiveKey
303
+ ]);
304
+ (0, import_react.useEffect)(() => {
305
+ handleScrollRef.current = handleScroll;
306
+ }, [handleScroll]);
183
307
  (0, import_react.useEffect)(() => {
184
308
  const container = getContainer ? getContainer() : window;
185
309
  containerRef.current = container;
@@ -187,6 +311,9 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
187
311
  return;
188
312
  let rafId = null;
189
313
  const onScroll = () => {
314
+ if (pendingTargetKeyRef.current) {
315
+ clearNavigationSettleTimer();
316
+ }
190
317
  if (rafId !== null)
191
318
  return;
192
319
  rafId = requestAnimationFrame(() => {
@@ -194,23 +321,68 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
194
321
  handleScroll();
195
322
  });
196
323
  };
324
+ const onScrollEnd = () => {
325
+ const pendingTargetKey = pendingTargetKeyRef.current;
326
+ if (pendingTargetKey && hasReachedTarget(pendingTargetKey)) {
327
+ scheduleNavigationUnlock(pendingTargetKey);
328
+ }
329
+ };
330
+ const onUserInterrupt = (event) => {
331
+ if (event.type === "pointerdown" && event.target instanceof Element) {
332
+ const item = event.target.closest(
333
+ `.${CSS.escape(`${prefixCls}-item`)}`
334
+ );
335
+ const owner = item == null ? void 0 : item.closest(`.${CSS.escape(prefixCls)}`);
336
+ if (owner === anchorRootRef.current) {
337
+ return;
338
+ }
339
+ }
340
+ if (event.type === "keydown" && !SCROLL_KEYS.has(event.key)) {
341
+ return;
342
+ }
343
+ clearNavigationLock();
344
+ };
197
345
  container.addEventListener("scroll", onScroll);
346
+ container.addEventListener("scrollend", onScrollEnd);
347
+ container.addEventListener("wheel", onUserInterrupt);
348
+ container.addEventListener("touchstart", onUserInterrupt);
349
+ document.addEventListener("pointerdown", onUserInterrupt);
350
+ container.addEventListener("keydown", onUserInterrupt);
198
351
  handleScroll();
199
352
  return () => {
200
353
  container.removeEventListener("scroll", onScroll);
354
+ container.removeEventListener("scrollend", onScrollEnd);
355
+ container.removeEventListener("wheel", onUserInterrupt);
356
+ container.removeEventListener(
357
+ "touchstart",
358
+ onUserInterrupt
359
+ );
360
+ document.removeEventListener(
361
+ "pointerdown",
362
+ onUserInterrupt
363
+ );
364
+ container.removeEventListener("keydown", onUserInterrupt);
201
365
  if (rafId !== null) {
202
366
  cancelAnimationFrame(rafId);
203
367
  }
204
368
  };
205
- }, [getContainer, handleScroll]);
369
+ }, [
370
+ getContainer,
371
+ handleScroll,
372
+ hasReachedTarget,
373
+ scheduleNavigationUnlock,
374
+ clearNavigationSettleTimer,
375
+ clearNavigationLock,
376
+ prefixCls
377
+ ]);
206
378
  const scrollToAnchor = (0, import_react.useCallback)(
207
379
  (key) => {
208
380
  const target = document.getElementById(key);
209
381
  if (!target)
210
- return;
382
+ return false;
211
383
  const container = containerRef.current;
212
384
  if (!container)
213
- return;
385
+ return false;
214
386
  const targetTop = getTargetOffsetTop(target) - offsetTop;
215
387
  if (container === window) {
216
388
  window.scrollTo({ top: targetTop, behavior: "smooth" });
@@ -220,6 +392,7 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
220
392
  behavior: "smooth"
221
393
  });
222
394
  }
395
+ return true;
223
396
  },
224
397
  [offsetTop, getTargetOffsetTop]
225
398
  );
@@ -230,11 +403,21 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
230
403
  }, [defaultActiveKey]);
231
404
  const handleItemClick = (0, import_react.useCallback)(
232
405
  (key) => {
233
- setMergedActiveKey(key);
234
- scrollToAnchor(key);
235
- onChange == null ? void 0 : onChange(key);
406
+ startNavigationLock(key);
407
+ commitActiveKey(key, true);
408
+ if (!scrollToAnchor(key)) {
409
+ clearNavigationLock();
410
+ return;
411
+ }
412
+ handleScroll();
236
413
  },
237
- [scrollToAnchor, onChange]
414
+ [
415
+ startNavigationLock,
416
+ commitActiveKey,
417
+ scrollToAnchor,
418
+ clearNavigationLock,
419
+ handleScroll
420
+ ]
238
421
  );
239
422
  const cls = (0, import_clsx.default)(
240
423
  prefixCls,
@@ -258,7 +441,7 @@ var Anchor = (0, import_react.forwardRef)((baseprops, ref) => {
258
441
  return null;
259
442
  return /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-nav-arrow` }, /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-arrow-icon` }, /* @__PURE__ */ import_react.default.createElement(import_lucide_react.ChevronLeft, { size: 18 })));
260
443
  };
261
- return /* @__PURE__ */ import_react.default.createElement("div", __spreadProps(__spreadValues({}, rest), { className: cls, style, ref }), renderNavArrow(), /* @__PURE__ */ import_react.default.createElement(AnchorContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-content-wrapper` }, /* @__PURE__ */ import_react.default.createElement(
444
+ return /* @__PURE__ */ import_react.default.createElement("div", __spreadProps(__spreadValues({}, rest), { className: cls, style, ref: setAnchorRootRef }), renderNavArrow(), /* @__PURE__ */ import_react.default.createElement(AnchorContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-content-wrapper` }, /* @__PURE__ */ import_react.default.createElement(
262
445
  "ul",
263
446
  {
264
447
  className: (0, import_clsx.default)(`${prefixCls}-content`, classNames == null ? void 0 : classNames.content),
@@ -88,7 +88,7 @@ export interface AnchorProps extends DataAttributeProps {
88
88
  */
89
89
  defaultActiveKey?: string;
90
90
  /**
91
- * Anchor position (controlled)
91
+ * Anchor position (controlled). When provided, update it from onChange.
92
92
  */
93
93
  activeKey?: string;
94
94
  /**
@@ -159,6 +159,9 @@ var Input = (0, import_react.forwardRef)((baseprops, ref) => {
159
159
  {
160
160
  className: (0, import_clsx.default)(`${prefixCls}-clear`, classNames == null ? void 0 : classNames.clear),
161
161
  style: styles == null ? void 0 : styles.clear,
162
+ role: "button",
163
+ "aria-label": "clear",
164
+ tabIndex: 0,
162
165
  onClick: onClear,
163
166
  onKeyDown: (event) => {
164
167
  if (event.key === "Enter") {
@@ -8,7 +8,7 @@
8
8
  width: 100%;
9
9
  padding: var(--yee-input-padding, 2px 8px);
10
10
  font-size: var(--yee-input-font-size);
11
- line-height: var(--yee-input-line-height);
11
+ // line-height: var(--yee-input-line-height);
12
12
  background-color: var(--yee-input-content-bg-color);
13
13
  border: var(--yee-input-border-width) solid var(--yee-input-border-color);
14
14
  border-radius: var(--yee-input-border-radius, 4px);
@@ -49,7 +49,7 @@
49
49
  &-inner {
50
50
  width: 100%;
51
51
  font-family: var(--yee-font-family);
52
- line-height: var(--yee-input-line-height);
52
+ // line-height: var(--yee-input-line-height);
53
53
  background-color: inherit;
54
54
  border: none;
55
55
  outline: none;
@@ -62,7 +62,8 @@ var Option = (props) => {
62
62
  [`${prefixCls}-option-focused`]: focused,
63
63
  [`${prefixCls}-option-disabled`]: disabled
64
64
  }),
65
- "aria-label": "option",
65
+ "aria-selected": selected,
66
+ "aria-disabled": disabled || void 0,
66
67
  onClick: handleClick,
67
68
  onKeyDown: (e) => {
68
69
  if (e.key === "Enter") {
@@ -210,6 +210,8 @@ var Options = (0, import_react.forwardRef)(
210
210
  ),
211
211
  style: popupStyle,
212
212
  ref: rootRef,
213
+ role: "listbox",
214
+ "aria-multiselectable": multiple || void 0,
213
215
  tabIndex: -1
214
216
  }),
215
217
  /* @__PURE__ */ import_react.default.createElement(OptionsCtx.Provider, { value: ctxValue }, /* @__PURE__ */ import_react.default.createElement(
@@ -259,6 +261,8 @@ var Options = (0, import_react.forwardRef)(
259
261
  ),
260
262
  style: popupStyle,
261
263
  ref: rootRef,
264
+ role: "listbox",
265
+ "aria-multiselectable": multiple || void 0,
262
266
  tabIndex: -1
263
267
  }),
264
268
  /* @__PURE__ */ import_react.default.createElement(OptionsCtx.Provider, { value: ctxValue }, /* @__PURE__ */ import_react.default.createElement(
@@ -297,6 +301,8 @@ var Options = (0, import_react.forwardRef)(
297
301
  ),
298
302
  style: __spreadValues(__spreadValues({}, popupStyle), multiColumn ? { "--yee-select-columns": columns } : void 0),
299
303
  ref: rootRef,
304
+ role: "listbox",
305
+ "aria-multiselectable": multiple || void 0,
300
306
  tabIndex: -1
301
307
  }),
302
308
  isEmpty ? /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-empty` }, select.noData) : /* @__PURE__ */ import_react.default.createElement(OptionsCtx.Provider, { value: ctxValue }, options.map((option, index) => /* @__PURE__ */ import_react.default.createElement(
@@ -274,7 +274,22 @@ var Selector = import_react.default.forwardRef(
274
274
  if (selectedKeys.length === 0 && !searchValue) {
275
275
  return null;
276
276
  }
277
- return /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-clear`, onClick: handleClear }, /* @__PURE__ */ import_react.default.createElement(import_lucide_react.X, { size: 12, strokeWidth: 1 }));
277
+ return /* @__PURE__ */ import_react.default.createElement(
278
+ "span",
279
+ {
280
+ className: `${prefixCls}-clear`,
281
+ role: "button",
282
+ "aria-label": "clear",
283
+ tabIndex: 0,
284
+ onClick: handleClear,
285
+ onKeyDown: (e) => {
286
+ if (e.key === "Enter") {
287
+ handleClear(e);
288
+ }
289
+ }
290
+ },
291
+ /* @__PURE__ */ import_react.default.createElement(import_lucide_react.X, { size: 12, strokeWidth: 1 })
292
+ );
278
293
  };
279
294
  return /* @__PURE__ */ import_react.default.createElement(
280
295
  "div",
@@ -282,6 +297,10 @@ var Selector = import_react.default.forwardRef(
282
297
  tabIndex: disabled || searchable ? -1 : 0,
283
298
  className: cls,
284
299
  style,
300
+ role: "combobox",
301
+ "aria-expanded": open || false,
302
+ "aria-haspopup": "listbox",
303
+ "aria-disabled": disabled || void 0,
285
304
  onKeyDown: (event) => {
286
305
  if (disabled)
287
306
  return;
@@ -38,7 +38,7 @@
38
38
  }
39
39
 
40
40
  &-ring {
41
- .yee-spin-ring {
41
+ @{pls}-ring {
42
42
  box-sizing: border-box;
43
43
  display: block;
44
44
  border-style: solid;
@@ -53,13 +53,13 @@
53
53
  }
54
54
 
55
55
  &-spokes {
56
- .yee-spin-spokes {
56
+ @{pls}-spokes {
57
57
  position: relative;
58
58
  width: 100%;
59
59
  height: 100%;
60
60
  }
61
61
 
62
- .yee-spin-spokes-line {
62
+ @{pls}-spokes-line {
63
63
  position: absolute;
64
64
  top: 0;
65
65
  left: 50%;
@@ -101,9 +101,14 @@
101
101
 
102
102
  &-blur {
103
103
  position: absolute;
104
- top: 50%;
105
- left: 50%;
106
- transform: translate(-50%, -50%);
104
+ display: flex;
105
+ align-items: center;
106
+ justify-content: center;
107
+ width: 100%;
108
+ height: 100%;
109
+ // top: 50%;
110
+ // left: 50%;
111
+ // transform: translate(-50%, -50%);
107
112
  background-color: var(--yee-color-bg-mask-light, rgba(255, 255, 255, 40%));
108
113
  }
109
114
 
@@ -159,7 +159,7 @@ var HeaderFilter = import_react.default.memo((props) => {
159
159
  import_Button.default,
160
160
  {
161
161
  icon: items ? /* @__PURE__ */ import_react.default.createElement(import_lucide_react.ListFilter, { size: 14, strokeWidth: 1.5 }) : /* @__PURE__ */ import_react.default.createElement(import_lucide_react.Search, { size: 14, strokeWidth: 1.5 }),
162
- variant: selectNodes.length ? "filled" : void 0,
162
+ variant: selectNodes.length || searchValue ? "filled" : void 0,
163
163
  type: "text",
164
164
  size: "small"
165
165
  }
@@ -129,19 +129,34 @@ var Tag = (0, import_react.forwardRef)(
129
129
  style: styles == null ? void 0 : styles.close,
130
130
  type: "text",
131
131
  size: "small",
132
+ "aria-label": "close",
132
133
  onClick: onClose
133
134
  },
134
135
  typeof closable === "boolean" ? /* @__PURE__ */ import_react.default.createElement(import_lucide_react.X, { size: 14, strokeWidth: 1 }) : closable
135
136
  ) : null;
136
137
  const closeNode = renderClose();
137
- return /* @__PURE__ */ import_react.default.createElement("div", __spreadProps(__spreadValues({}, rest), { className: cls, onClick: handleClick, ref }), icon && /* @__PURE__ */ import_react.default.createElement(
138
- "span",
139
- {
140
- className: (0, import_clsx.default)(`${prefixCls}-icon`, classNames == null ? void 0 : classNames.icon),
141
- style: styles == null ? void 0 : styles.icon
142
- },
143
- icon
144
- ), icon || closeNode ? /* @__PURE__ */ import_react.default.createElement("span", { className: (0, import_clsx.default)(classNames == null ? void 0 : classNames.content), style: styles == null ? void 0 : styles.content }, children) : children, closeNode);
138
+ return /* @__PURE__ */ import_react.default.createElement(
139
+ "div",
140
+ __spreadValues(__spreadProps(__spreadValues({}, rest), {
141
+ className: cls,
142
+ onClick: handleClick,
143
+ ref
144
+ }), checkable ? {
145
+ role: "checkbox",
146
+ "aria-checked": checked || false,
147
+ tabIndex: 0
148
+ } : void 0),
149
+ icon && /* @__PURE__ */ import_react.default.createElement(
150
+ "span",
151
+ {
152
+ className: (0, import_clsx.default)(`${prefixCls}-icon`, classNames == null ? void 0 : classNames.icon),
153
+ style: styles == null ? void 0 : styles.icon
154
+ },
155
+ icon
156
+ ),
157
+ icon || closeNode ? /* @__PURE__ */ import_react.default.createElement("span", { className: (0, import_clsx.default)(classNames == null ? void 0 : classNames.content), style: styles == null ? void 0 : styles.content }, children) : children,
158
+ closeNode
159
+ );
145
160
  }
146
161
  );
147
162
  Tag.displayName = "Tag";
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import type { DataAttributeProps } from '../utils/types';
2
3
  export type SemanticType = '';
3
4
  export type DragPosition = 'before' | 'after' | 'inside';
4
5
  export type { MoveInfo } from './utils/tree-tools';
@@ -69,7 +70,7 @@ export interface TreeNodeProps<T> {
69
70
  node: TreeNode<T>;
70
71
  style?: React.CSSProperties;
71
72
  }
72
- export interface TreeProps<T> {
73
+ export interface TreeProps<T> extends DataAttributeProps {
73
74
  /**
74
75
  * Custom class name prefix
75
76
  */
@@ -191,7 +191,12 @@ var Node = (props) => {
191
191
  [`${prefixCls}-node-drag-over-after`]: dropPosition === "after",
192
192
  [`${prefixCls}-node-drag-over-inside`]: dropPosition === "inside"
193
193
  }),
194
- style: nodeStyle
194
+ style: nodeStyle,
195
+ role: "treeitem",
196
+ "aria-expanded": isLeaf ? void 0 : expanded,
197
+ "aria-selected": selected,
198
+ "aria-level": depth + 1,
199
+ "aria-disabled": disabled || void 0
195
200
  }, dragProps),
196
201
  renderEmptyNodes(depth),
197
202
  renderExpandedIcon(),