@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
@@ -18,6 +18,18 @@ var __spreadValues = (a, b) => {
18
18
  }
19
19
  return a;
20
20
  };
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
21
33
  var __export = (target, all) => {
22
34
  for (var name in all)
23
35
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -55,6 +67,7 @@ var import_useEvent = __toESM(require("../hooks/useEvent"));
55
67
  var import_useMergedState = __toESM(require("../hooks/useMergedState"));
56
68
  var import_useVirtualList = __toESM(require("../hooks/useVirtualList"));
57
69
  var import_mergeContextToProps = __toESM(require("../utils/mergeContextToProps"));
70
+ var import_types = require("../utils/types");
58
71
  var import_tree_node = __toESM(require("./tree-node"));
59
72
  var import_tree_tools = require("./utils/tree-tools");
60
73
  var import_style = require("./style/index.less");
@@ -146,7 +159,7 @@ function setToArray(s) {
146
159
  var Tree = (baseprops) => {
147
160
  const { tree } = (0, import_react2.useContext)(import_Config_Provider.GlobalContext);
148
161
  const props = (0, import_mergeContextToProps.default)(baseprops, tree);
149
- const {
162
+ const _a = props, {
150
163
  prefixCls = "yee-tree",
151
164
  className,
152
165
  style,
@@ -174,7 +187,36 @@ var Tree = (baseprops) => {
174
187
  virtual = false,
175
188
  height,
176
189
  itemHeight = 28
177
- } = props;
190
+ } = _a, rest = __objRest(_a, [
191
+ "prefixCls",
192
+ "className",
193
+ "style",
194
+ "dataSource",
195
+ "fieldNames",
196
+ "defaultExpandAll",
197
+ "expandedKeys",
198
+ "defaultExpandedKeys",
199
+ "selectedKeys",
200
+ "defaultSelectedKeys",
201
+ "checkedKeys",
202
+ "defaultCheckedKeys",
203
+ "checkable",
204
+ "multiple",
205
+ "showIcon",
206
+ "icon",
207
+ "showLine",
208
+ "switcherIcon",
209
+ "draggable",
210
+ "allowDrop",
211
+ "onDrop",
212
+ "onSelect",
213
+ "onCheck",
214
+ "onExpand",
215
+ "virtual",
216
+ "height",
217
+ "itemHeight"
218
+ ]);
219
+ const dataAttrs = (0, import_types.pickDataAttrs)(rest);
178
220
  const [flatItems, itemMap] = (0, import_react2.useMemo)(
179
221
  () => (0, import_tree_tools.tree2array)(dataSource != null ? dataSource : [], fieldNames),
180
222
  [dataSource, fieldNames]
@@ -265,8 +307,8 @@ var Tree = (baseprops) => {
265
307
  const externalKeys = uidsToKeys(newUidArr, itemMap);
266
308
  const nodes = [];
267
309
  newUidSet.forEach((u) => {
268
- var _a;
269
- const n = (_a = itemMap.get(u)) == null ? void 0 : _a.original;
310
+ var _a2;
311
+ const n = (_a2 = itemMap.get(u)) == null ? void 0 : _a2.original;
270
312
  if (n)
271
313
  nodes.push(n);
272
314
  });
@@ -279,7 +321,7 @@ var Tree = (baseprops) => {
279
321
  }
280
322
  );
281
323
  const handleSelect = (0, import_useEvent.default)((uid) => {
282
- var _a;
324
+ var _a2;
283
325
  const selected = selectedUidSet.has(uid);
284
326
  let newUidArr;
285
327
  if (multiple) {
@@ -297,7 +339,7 @@ var Tree = (baseprops) => {
297
339
  const externalKeys = uidsToKeys(newUidArr, itemMap);
298
340
  const nodes = [];
299
341
  for (const u of newUidArr) {
300
- const n = (_a = itemMap.get(u)) == null ? void 0 : _a.original;
342
+ const n = (_a2 = itemMap.get(u)) == null ? void 0 : _a2.original;
301
343
  if (n)
302
344
  nodes.push(n);
303
345
  }
@@ -309,7 +351,7 @@ var Tree = (baseprops) => {
309
351
  }
310
352
  });
311
353
  const handleExpand = (0, import_useEvent.default)((uid) => {
312
- var _a;
354
+ var _a2;
313
355
  const expanded = expandedUidSet.has(uid);
314
356
  const newUidArr = expanded ? expandedUidArray.filter((u) => u !== uid) : [...expandedUidArray, uid];
315
357
  setExpandedUidArray(newUidArr);
@@ -318,7 +360,7 @@ var Tree = (baseprops) => {
318
360
  const treeNode = itemMap.get(uid);
319
361
  const nodes = [];
320
362
  for (const u of newUidArr) {
321
- const n = (_a = itemMap.get(u)) == null ? void 0 : _a.original;
363
+ const n = (_a2 = itemMap.get(u)) == null ? void 0 : _a2.original;
322
364
  if (n)
323
365
  nodes.push(n);
324
366
  }
@@ -505,11 +547,12 @@ var Tree = (baseprops) => {
505
547
  const slicedItems = visibleItems.slice(start, end);
506
548
  return /* @__PURE__ */ import_react2.default.createElement(
507
549
  "div",
508
- {
550
+ __spreadValues({
509
551
  className: (0, import_clsx.default)(prefixCls, className),
510
552
  style,
553
+ role: "tree",
511
554
  onDragEnd: handleDragEnd
512
- },
555
+ }, dataAttrs),
513
556
  /* @__PURE__ */ import_react2.default.createElement(TreeContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react2.default.createElement(
514
557
  "div",
515
558
  {
@@ -560,11 +603,12 @@ var Tree = (baseprops) => {
560
603
  }
561
604
  return /* @__PURE__ */ import_react2.default.createElement(
562
605
  "div",
563
- {
606
+ __spreadValues({
564
607
  className: (0, import_clsx.default)(prefixCls, className),
565
608
  style,
609
+ role: "tree",
566
610
  onDragEnd: handleDragEnd
567
- },
611
+ }, dataAttrs),
568
612
  /* @__PURE__ */ import_react2.default.createElement(TreeContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react2.default.createElement(import_react.AnimatePresence, { initial: false }, segments.map((segment) => {
569
613
  if (segment.type === "node") {
570
614
  return /* @__PURE__ */ import_react2.default.createElement(import_tree_node.default, { node: segment.node, key: segment.node.uid });
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { TriggerProps as RcTriggerProps } from '@rc-component/trigger';
3
+ import type { DataAttributeProps } from '../utils/types';
3
4
  export type Placement = 'top' | 'bottom' | 'left' | 'right' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
4
5
  export type Point = 'tl' | 'tc' | 'tr' | 'bl' | 'bc' | 'br' | 'lt' | 'lc' | 'lb' | 'rt' | 'rc' | 'rb' | 'cc' | 'cl' | 'cr';
5
- export interface TriggerProps extends Omit<RcTriggerProps, 'children'> {
6
+ export interface TriggerProps extends Omit<RcTriggerProps, 'children'>, DataAttributeProps {
6
7
  /**
7
8
  * Custom class name prefix
8
9
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-07-28T07:56:30.159Z
4
+ * Generated on 2026-07-28T09:50:04.606Z
5
5
  */
6
6
 
7
7
  /* ========== color.blue.css ========== */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @rainbow-oh/yee-c CSS Variables
3
3
  * Auto-generated, do not edit manually
4
- * Generated on 2026-07-28T07:56:30.159Z
4
+ * Generated on 2026-07-28T09:50:04.606Z
5
5
  */
6
6
 
7
7
  /* ========== color.css ========== */
@@ -3,4 +3,4 @@ declare global {
3
3
  __yee_c_version__: string;
4
4
  }
5
5
  }
6
- export declare const version = "0.8.5";
6
+ export declare const version = "0.8.7";
@@ -22,7 +22,7 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- var version = "0.8.5";
25
+ var version = "0.8.7";
26
26
  if (typeof window !== "undefined") {
27
27
  window.__yee_c_version__ = version;
28
28
  }
@@ -94,6 +94,7 @@ var Alert = function Alert(baseprops) {
94
94
  }, description) : null;
95
95
  };
96
96
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
97
+ role: "alert",
97
98
  className: clsx(prefixCls, ["".concat(prefixCls, "-").concat(mergedState)], ["".concat(prefixCls, "-").concat(sizeType)], _defineProperty({}, "".concat(prefixCls, "-banner"), banner), className),
98
99
  style: style
99
100
  }), closable && /*#__PURE__*/React.createElement(Button, {
@@ -21,6 +21,10 @@ import mergeContextToProps from "../utils/mergeContextToProps";
21
21
  import AnchorItem from "./anchor-item";
22
22
  import "./style/index.less";
23
23
  export var AnchorContext = /*#__PURE__*/createContext({});
24
+ var NAVIGATION_LOCK_TIMEOUT = 5000;
25
+ var NAVIGATION_SETTLE_DELAY = 100;
26
+ var TARGET_POSITION_TOLERANCE = 2;
27
+ var SCROLL_KEYS = new Set(['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' ', 'Spacebar']);
24
28
  var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
25
29
  var _useContext = useContext(GlobalContext),
26
30
  anchor = _useContext.anchor;
@@ -60,10 +64,67 @@ var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
60
64
  anchorList = _useState2[0],
61
65
  setAnchorList = _useState2[1];
62
66
  var containerRef = useRef(null);
67
+ var anchorRootRef = useRef(null);
63
68
  var activeKeyRef = useRef(mergedActiveKey);
69
+ var handleScrollRef = useRef(function () {});
70
+ var pendingTargetKeyRef = useRef(undefined);
71
+ var navigationTimeoutRef = useRef(null);
72
+ var navigationSettleTimeoutRef = useRef(null);
64
73
  useEffect(function () {
65
74
  activeKeyRef.current = mergedActiveKey;
66
75
  }, [mergedActiveKey]);
76
+ var setAnchorRootRef = useCallback(function (node) {
77
+ anchorRootRef.current = node;
78
+ if (typeof ref === 'function') {
79
+ ref(node);
80
+ } else if (ref) {
81
+ ref.current = node;
82
+ }
83
+ }, [ref]);
84
+ var clearNavigationSettleTimer = useCallback(function () {
85
+ if (navigationSettleTimeoutRef.current !== null) {
86
+ clearTimeout(navigationSettleTimeoutRef.current);
87
+ navigationSettleTimeoutRef.current = null;
88
+ }
89
+ }, []);
90
+ var clearNavigationLock = useCallback(function () {
91
+ pendingTargetKeyRef.current = undefined;
92
+ clearNavigationSettleTimer();
93
+ if (navigationTimeoutRef.current !== null) {
94
+ clearTimeout(navigationTimeoutRef.current);
95
+ navigationTimeoutRef.current = null;
96
+ }
97
+ }, [clearNavigationSettleTimer]);
98
+ var scheduleNavigationUnlock = useCallback(function (key) {
99
+ clearNavigationSettleTimer();
100
+ navigationSettleTimeoutRef.current = setTimeout(function () {
101
+ if (pendingTargetKeyRef.current === key) {
102
+ clearNavigationLock();
103
+ }
104
+ }, NAVIGATION_SETTLE_DELAY);
105
+ }, [clearNavigationLock, clearNavigationSettleTimer]);
106
+ var startNavigationLock = useCallback(function (key) {
107
+ clearNavigationLock();
108
+ pendingTargetKeyRef.current = key;
109
+ navigationTimeoutRef.current = setTimeout(function () {
110
+ if (pendingTargetKeyRef.current === key) {
111
+ clearNavigationLock();
112
+ handleScrollRef.current();
113
+ }
114
+ }, NAVIGATION_LOCK_TIMEOUT);
115
+ }, [clearNavigationLock]);
116
+ useEffect(function () {
117
+ return clearNavigationLock;
118
+ }, [clearNavigationLock]);
119
+ var commitActiveKey = useCallback(function (key) {
120
+ var forceNotify = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
121
+ var changed = activeKeyRef.current !== key;
122
+ activeKeyRef.current = key;
123
+ setMergedActiveKey(key);
124
+ if (changed || forceNotify) {
125
+ onChange === null || onChange === void 0 || onChange(key);
126
+ }
127
+ }, [onChange]);
67
128
 
68
129
  // Auto-generate anchor list from DOM
69
130
  var generateAnchorList = useCallback(function () {
@@ -98,11 +159,30 @@ var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
98
159
  var currentScroll = container === window ? window.scrollY : container.scrollTop;
99
160
  return currentScroll + (target.getBoundingClientRect().top - containerTop);
100
161
  }, []);
162
+ var hasReachedTarget = useCallback(function (key) {
163
+ var _document$body;
164
+ var container = containerRef.current;
165
+ var target = document.getElementById(key);
166
+ if (!container || !target) return false;
167
+ var currentScroll = container === window ? window.pageYOffset || document.documentElement.scrollTop : container.scrollTop;
168
+ var maxScroll = container === window ? Math.max(document.documentElement.scrollHeight, ((_document$body = document.body) === null || _document$body === void 0 ? void 0 : _document$body.scrollHeight) || 0) - window.innerHeight : container.scrollHeight - container.clientHeight;
169
+ var targetScroll = Math.min(Math.max(getTargetOffsetTop(target) - offsetTop, 0), Math.max(maxScroll, 0));
170
+ return Math.abs(currentScroll - targetScroll) <= TARGET_POSITION_TOLERANCE;
171
+ }, [getTargetOffsetTop, offsetTop]);
101
172
 
102
173
  // Handle scroll to update active key
103
174
  var handleScroll = useCallback(function () {
104
175
  var container = containerRef.current;
105
176
  if (!container) return;
177
+ var pendingTargetKey = pendingTargetKeyRef.current;
178
+ if (pendingTargetKey) {
179
+ if (hasReachedTarget(pendingTargetKey)) {
180
+ scheduleNavigationUnlock(pendingTargetKey);
181
+ } else {
182
+ clearNavigationSettleTimer();
183
+ }
184
+ return;
185
+ }
106
186
  var scrollTop = container === window ? window.pageYOffset || document.documentElement.scrollTop : container.scrollTop;
107
187
  var currentItems = auto ? anchorList : items;
108
188
 
@@ -130,11 +210,13 @@ var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
130
210
  });
131
211
  nextActiveKey = first === null || first === void 0 ? void 0 : first.key;
132
212
  }
133
- if (nextActiveKey && activeKeyRef.current !== nextActiveKey) {
134
- setMergedActiveKey(nextActiveKey);
135
- onChange === null || onChange === void 0 || onChange(nextActiveKey);
213
+ if (nextActiveKey) {
214
+ commitActiveKey(nextActiveKey);
136
215
  }
137
- }, [auto, anchorList, items, offsetTop, onChange, getTargetOffsetTop]);
216
+ }, [auto, anchorList, items, offsetTop, getTargetOffsetTop, hasReachedTarget, scheduleNavigationUnlock, clearNavigationSettleTimer, clearNavigationLock, commitActiveKey]);
217
+ useEffect(function () {
218
+ handleScrollRef.current = handleScroll;
219
+ }, [handleScroll]);
138
220
  useEffect(function () {
139
221
  // Resolve in a passive effect: parent-owned refs passed via `getContainer`
140
222
  // aren't attached until after child layout effects run.
@@ -145,28 +227,60 @@ var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
145
227
  // rAF throttle so the active key tracks scroll live.
146
228
  var rafId = null;
147
229
  var onScroll = function onScroll() {
230
+ if (pendingTargetKeyRef.current) {
231
+ clearNavigationSettleTimer();
232
+ }
148
233
  if (rafId !== null) return;
149
234
  rafId = requestAnimationFrame(function () {
150
235
  rafId = null;
151
236
  handleScroll();
152
237
  });
153
238
  };
239
+ var onScrollEnd = function onScrollEnd() {
240
+ var pendingTargetKey = pendingTargetKeyRef.current;
241
+ if (pendingTargetKey && hasReachedTarget(pendingTargetKey)) {
242
+ scheduleNavigationUnlock(pendingTargetKey);
243
+ }
244
+ };
245
+ var onUserInterrupt = function onUserInterrupt(event) {
246
+ if (event.type === 'pointerdown' && event.target instanceof Element) {
247
+ var item = event.target.closest(".".concat(CSS.escape("".concat(prefixCls, "-item"))));
248
+ var owner = item === null || item === void 0 ? void 0 : item.closest(".".concat(CSS.escape(prefixCls)));
249
+ if (owner === anchorRootRef.current) {
250
+ return;
251
+ }
252
+ }
253
+ if (event.type === 'keydown' && !SCROLL_KEYS.has(event.key)) {
254
+ return;
255
+ }
256
+ clearNavigationLock();
257
+ };
154
258
  container.addEventListener('scroll', onScroll);
259
+ container.addEventListener('scrollend', onScrollEnd);
260
+ container.addEventListener('wheel', onUserInterrupt);
261
+ container.addEventListener('touchstart', onUserInterrupt);
262
+ document.addEventListener('pointerdown', onUserInterrupt);
263
+ container.addEventListener('keydown', onUserInterrupt);
155
264
  handleScroll();
156
265
  return function () {
157
266
  container.removeEventListener('scroll', onScroll);
267
+ container.removeEventListener('scrollend', onScrollEnd);
268
+ container.removeEventListener('wheel', onUserInterrupt);
269
+ container.removeEventListener('touchstart', onUserInterrupt);
270
+ document.removeEventListener('pointerdown', onUserInterrupt);
271
+ container.removeEventListener('keydown', onUserInterrupt);
158
272
  if (rafId !== null) {
159
273
  cancelAnimationFrame(rafId);
160
274
  }
161
275
  };
162
- }, [getContainer, handleScroll]);
276
+ }, [getContainer, handleScroll, hasReachedTarget, scheduleNavigationUnlock, clearNavigationSettleTimer, clearNavigationLock, prefixCls]);
163
277
 
164
278
  // Scroll to target when activeKey changes
165
279
  var scrollToAnchor = useCallback(function (key) {
166
280
  var target = document.getElementById(key);
167
- if (!target) return;
281
+ if (!target) return false;
168
282
  var container = containerRef.current;
169
- if (!container) return;
283
+ if (!container) return false;
170
284
  var targetTop = getTargetOffsetTop(target) - offsetTop;
171
285
  if (container === window) {
172
286
  window.scrollTo({
@@ -179,6 +293,7 @@ var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
179
293
  behavior: 'smooth'
180
294
  });
181
295
  }
296
+ return true;
182
297
  }, [offsetTop, getTargetOffsetTop]);
183
298
  useEffect(function () {
184
299
  if (defaultActiveKey) {
@@ -188,10 +303,16 @@ var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
188
303
  }, [defaultActiveKey]); // Only execute when defaultActiveKey changes
189
304
 
190
305
  var handleItemClick = useCallback(function (key) {
191
- setMergedActiveKey(key);
192
- scrollToAnchor(key);
193
- onChange === null || onChange === void 0 || onChange(key);
194
- }, [scrollToAnchor, onChange]);
306
+ startNavigationLock(key);
307
+ commitActiveKey(key, true);
308
+ if (!scrollToAnchor(key)) {
309
+ clearNavigationLock();
310
+ return;
311
+ }
312
+
313
+ // Handles instant scrolling and targets that are already in position.
314
+ handleScroll();
315
+ }, [startNavigationLock, commitActiveKey, scrollToAnchor, clearNavigationLock, handleScroll]);
195
316
  var cls = clsx(prefixCls, _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-").concat(direction), direction), "".concat(prefixCls, "-affix"), affix), "".concat(prefixCls, "-static"), !affix), className);
196
317
  var currentItems = auto ? anchorList : items;
197
318
  var contextValue = {
@@ -214,7 +335,7 @@ var Anchor = /*#__PURE__*/forwardRef(function (baseprops, ref) {
214
335
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
215
336
  className: cls,
216
337
  style: style,
217
- ref: ref
338
+ ref: setAnchorRootRef
218
339
  }), renderNavArrow(), /*#__PURE__*/React.createElement(AnchorContext.Provider, {
219
340
  value: contextValue
220
341
  }, /*#__PURE__*/React.createElement("div", {
@@ -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
  /**
@@ -86,6 +86,9 @@ var Input = /*#__PURE__*/forwardRef(function (baseprops, ref) {
86
86
  }, showClear && /*#__PURE__*/React.createElement("span", {
87
87
  className: clsx("".concat(prefixCls, "-clear"), classNames === null || classNames === void 0 ? void 0 : classNames.clear),
88
88
  style: styles === null || styles === void 0 ? void 0 : styles.clear,
89
+ role: "button",
90
+ "aria-label": "clear",
91
+ tabIndex: 0,
89
92
  onClick: onClear,
90
93
  onKeyDown: function onKeyDown(event) {
91
94
  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;
@@ -32,7 +32,8 @@ var Option = function Option(props) {
32
32
  var focused = looseMatch ? String(focusedKey) === String(value) : focusedKey === value;
33
33
  return /*#__PURE__*/React.createElement("div", {
34
34
  className: clsx("".concat(prefixCls, "-option"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-option-selected"), selected), "".concat(prefixCls, "-option-focused"), focused), "".concat(prefixCls, "-option-disabled"), disabled)),
35
- "aria-label": "option",
35
+ "aria-selected": selected,
36
+ "aria-disabled": disabled || undefined,
36
37
  onClick: handleClick,
37
38
  onKeyDown: function onKeyDown(e) {
38
39
  if (e.key === 'Enter') {
@@ -146,6 +146,8 @@ var Options = /*#__PURE__*/forwardRef(function (props, ref) {
146
146
  className: clsx("".concat(prefixCls, "-popup"), "".concat(prefixCls, "-popup-virtual"), popupClassName),
147
147
  style: popupStyle,
148
148
  ref: rootRef,
149
+ role: "listbox",
150
+ "aria-multiselectable": multiple || undefined,
149
151
  tabIndex: -1
150
152
  }), /*#__PURE__*/React.createElement(OptionsCtx.Provider, {
151
153
  value: ctxValue
@@ -196,6 +198,8 @@ var Options = /*#__PURE__*/forwardRef(function (props, ref) {
196
198
  className: clsx("".concat(prefixCls, "-popup"), "".concat(prefixCls, "-popup-virtual"), popupClassName),
197
199
  style: popupStyle,
198
200
  ref: rootRef,
201
+ role: "listbox",
202
+ "aria-multiselectable": multiple || undefined,
199
203
  tabIndex: -1
200
204
  }), /*#__PURE__*/React.createElement(OptionsCtx.Provider, {
201
205
  value: ctxValue
@@ -235,6 +239,8 @@ var Options = /*#__PURE__*/forwardRef(function (props, ref) {
235
239
  '--yee-select-columns': columns
236
240
  } : undefined),
237
241
  ref: rootRef,
242
+ role: "listbox",
243
+ "aria-multiselectable": multiple || undefined,
238
244
  tabIndex: -1
239
245
  }), isEmpty ? /*#__PURE__*/React.createElement("div", {
240
246
  className: "".concat(prefixCls, "-empty")
@@ -192,7 +192,15 @@ var Selector = /*#__PURE__*/React.forwardRef(function (props, ref) {
192
192
  }
193
193
  return /*#__PURE__*/React.createElement("span", {
194
194
  className: "".concat(prefixCls, "-clear"),
195
- onClick: handleClear
195
+ role: "button",
196
+ "aria-label": "clear",
197
+ tabIndex: 0,
198
+ onClick: handleClear,
199
+ onKeyDown: function onKeyDown(e) {
200
+ if (e.key === 'Enter') {
201
+ handleClear(e);
202
+ }
203
+ }
196
204
  }, /*#__PURE__*/React.createElement(X, {
197
205
  size: 12,
198
206
  strokeWidth: 1
@@ -202,6 +210,10 @@ var Selector = /*#__PURE__*/React.forwardRef(function (props, ref) {
202
210
  tabIndex: disabled || searchable ? -1 : 0,
203
211
  className: cls,
204
212
  style: style,
213
+ role: "combobox",
214
+ "aria-expanded": open || false,
215
+ "aria-haspopup": "listbox",
216
+ "aria-disabled": disabled || undefined,
205
217
  onKeyDown: function onKeyDown(event) {
206
218
  if (disabled) return;
207
219
  // For non-searchable single select, handle Enter to open dropdown
@@ -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
 
@@ -186,7 +186,7 @@ var HeaderFilter = /*#__PURE__*/React.memo(function (props) {
186
186
  size: 14,
187
187
  strokeWidth: 1.5
188
188
  }),
189
- variant: selectNodes.length ? 'filled' : undefined,
189
+ variant: selectNodes.length || searchValue ? 'filled' : undefined,
190
190
  type: "text",
191
191
  size: "small"
192
192
  });
@@ -47,6 +47,7 @@ var Tag = /*#__PURE__*/forwardRef(function (baseprops, ref) {
47
47
  style: styles === null || styles === void 0 ? void 0 : styles.close,
48
48
  type: "text",
49
49
  size: "small",
50
+ "aria-label": "close",
50
51
  onClick: onClose
51
52
  }, typeof closable === 'boolean' ? /*#__PURE__*/React.createElement(X, {
52
53
  size: 14,
@@ -58,7 +59,11 @@ var Tag = /*#__PURE__*/forwardRef(function (baseprops, ref) {
58
59
  className: cls,
59
60
  onClick: handleClick,
60
61
  ref: ref
61
- }), icon && /*#__PURE__*/React.createElement("span", {
62
+ }, checkable ? {
63
+ role: 'checkbox',
64
+ 'aria-checked': checked || false,
65
+ tabIndex: 0
66
+ } : undefined), icon && /*#__PURE__*/React.createElement("span", {
62
67
  className: clsx("".concat(prefixCls, "-icon"), classNames === null || classNames === void 0 ? void 0 : classNames.icon),
63
68
  style: styles === null || styles === void 0 ? void 0 : styles.icon
64
69
  }, icon), icon || closeNode ? /*#__PURE__*/React.createElement("span", {
@@ -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
  */
@@ -134,7 +134,12 @@ var Node = function Node(props) {
134
134
  } : {};
135
135
  return /*#__PURE__*/React.createElement("div", _extends({
136
136
  className: clsx("".concat(prefixCls, "-node"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-node-with-line"), showLine), "".concat(prefixCls, "-leaf-node"), isLeaf), "".concat(prefixCls, "-last-node"), isLast), "".concat(prefixCls, "-node-dragging"), draggingUid === uid), "".concat(prefixCls, "-node-drag-over-before"), dropPosition === 'before'), "".concat(prefixCls, "-node-drag-over-after"), dropPosition === 'after'), "".concat(prefixCls, "-node-drag-over-inside"), dropPosition === 'inside')),
137
- style: nodeStyle
137
+ style: nodeStyle,
138
+ role: "treeitem",
139
+ "aria-expanded": isLeaf ? undefined : expanded,
140
+ "aria-selected": selected,
141
+ "aria-level": depth + 1,
142
+ "aria-disabled": disabled || undefined
138
143
  }, dragProps), renderEmptyNodes(depth), renderExpandedIcon(), renderCheckbox(), renderLabel());
139
144
  };
140
145
  export default Node;