@mortenbrudvik/waveui 0.15.0 → 0.16.0

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 (155) hide show
  1. package/README.md +274 -24
  2. package/dist/components/data-display/List.cjs +1 -1
  3. package/dist/components/data-display/List.cjs.map +1 -1
  4. package/dist/components/data-display/List.mjs +405 -219
  5. package/dist/components/data-display/List.mjs.map +1 -1
  6. package/dist/components/data-display/List.registry.cjs +1 -1
  7. package/dist/components/data-display/List.registry.cjs.map +1 -1
  8. package/dist/components/data-display/List.registry.mjs +12 -6
  9. package/dist/components/data-display/List.registry.mjs.map +1 -1
  10. package/dist/components/input/Combobox.cjs +1 -1
  11. package/dist/components/input/Combobox.cjs.map +1 -1
  12. package/dist/components/input/Combobox.mjs +163 -148
  13. package/dist/components/input/Combobox.mjs.map +1 -1
  14. package/dist/components/input/Dropdown.cjs +1 -1
  15. package/dist/components/input/Dropdown.cjs.map +1 -1
  16. package/dist/components/input/Dropdown.mjs +132 -117
  17. package/dist/components/input/Dropdown.mjs.map +1 -1
  18. package/dist/components/input/Listbox.cjs +1 -1
  19. package/dist/components/input/Listbox.cjs.map +1 -1
  20. package/dist/components/input/Listbox.mjs +90 -78
  21. package/dist/components/input/Listbox.mjs.map +1 -1
  22. package/dist/components/input/Option.cjs +1 -1
  23. package/dist/components/input/Option.cjs.map +1 -1
  24. package/dist/components/input/Option.data.cjs +2 -0
  25. package/dist/components/input/Option.data.cjs.map +1 -0
  26. package/dist/components/input/Option.data.mjs +114 -0
  27. package/dist/components/input/Option.data.mjs.map +1 -0
  28. package/dist/components/input/Option.mjs +21 -17
  29. package/dist/components/input/Option.mjs.map +1 -1
  30. package/dist/components/layout/FlatTree.cjs +2 -0
  31. package/dist/components/layout/FlatTree.cjs.map +1 -0
  32. package/dist/components/layout/FlatTree.context.cjs +2 -0
  33. package/dist/components/layout/FlatTree.context.cjs.map +1 -0
  34. package/dist/components/layout/FlatTree.context.mjs +20 -0
  35. package/dist/components/layout/FlatTree.context.mjs.map +1 -0
  36. package/dist/components/layout/FlatTree.item.cjs +2 -0
  37. package/dist/components/layout/FlatTree.item.cjs.map +1 -0
  38. package/dist/components/layout/FlatTree.item.mjs +90 -0
  39. package/dist/components/layout/FlatTree.item.mjs.map +1 -0
  40. package/dist/components/layout/FlatTree.mjs +276 -0
  41. package/dist/components/layout/FlatTree.mjs.map +1 -0
  42. package/dist/components/layout/Tree.core.cjs +1 -1
  43. package/dist/components/layout/Tree.core.cjs.map +1 -1
  44. package/dist/components/layout/Tree.core.mjs +166 -165
  45. package/dist/components/layout/Tree.core.mjs.map +1 -1
  46. package/dist/components/layout/Tree.selection.cjs +1 -1
  47. package/dist/components/layout/Tree.selection.cjs.map +1 -1
  48. package/dist/components/layout/Tree.selection.mjs +11 -57
  49. package/dist/components/layout/Tree.selection.mjs.map +1 -1
  50. package/dist/components/layout/useFlatTree.cjs +2 -0
  51. package/dist/components/layout/useFlatTree.cjs.map +1 -0
  52. package/dist/components/layout/useFlatTree.mjs +83 -0
  53. package/dist/components/layout/useFlatTree.mjs.map +1 -0
  54. package/dist/components/table/DataGrid.cjs +1 -1
  55. package/dist/components/table/DataGrid.cjs.map +1 -1
  56. package/dist/components/table/DataGrid.context.cjs +2 -0
  57. package/dist/components/table/DataGrid.context.cjs.map +1 -0
  58. package/dist/components/table/DataGrid.context.mjs +74 -0
  59. package/dist/components/table/DataGrid.context.mjs.map +1 -0
  60. package/dist/components/table/DataGrid.header.cjs +2 -0
  61. package/dist/components/table/DataGrid.header.cjs.map +1 -0
  62. package/dist/components/table/DataGrid.header.mjs +168 -0
  63. package/dist/components/table/DataGrid.header.mjs.map +1 -0
  64. package/dist/components/table/DataGrid.mjs +488 -591
  65. package/dist/components/table/DataGrid.mjs.map +1 -1
  66. package/dist/components/table/DataGrid.sizing.cjs +2 -0
  67. package/dist/components/table/DataGrid.sizing.cjs.map +1 -0
  68. package/dist/components/table/DataGrid.sizing.mjs +187 -0
  69. package/dist/components/table/DataGrid.sizing.mjs.map +1 -0
  70. package/dist/components/table/DataGrid.store.cjs +2 -0
  71. package/dist/components/table/DataGrid.store.cjs.map +1 -0
  72. package/dist/components/table/DataGrid.store.mjs +108 -0
  73. package/dist/components/table/DataGrid.store.mjs.map +1 -0
  74. package/dist/components/table/DataGrid.window.cjs +2 -0
  75. package/dist/components/table/DataGrid.window.cjs.map +1 -0
  76. package/dist/components/table/DataGrid.window.mjs +165 -0
  77. package/dist/components/table/DataGrid.window.mjs.map +1 -0
  78. package/dist/components/table/Table.cjs +1 -1
  79. package/dist/components/table/Table.cjs.map +1 -1
  80. package/dist/components/table/Table.mjs +74 -72
  81. package/dist/components/table/Table.mjs.map +1 -1
  82. package/dist/components/table/Table.resize.cjs +2 -0
  83. package/dist/components/table/Table.resize.cjs.map +1 -0
  84. package/dist/components/table/Table.resize.mjs +98 -0
  85. package/dist/components/table/Table.resize.mjs.map +1 -0
  86. package/dist/components/table/useGridNavigation.cjs +1 -1
  87. package/dist/components/table/useGridNavigation.cjs.map +1 -1
  88. package/dist/components/table/useGridNavigation.mjs +343 -140
  89. package/dist/components/table/useGridNavigation.mjs.map +1 -1
  90. package/dist/components/table/useTableColumnSizing.cjs +2 -0
  91. package/dist/components/table/useTableColumnSizing.cjs.map +1 -0
  92. package/dist/components/table/useTableColumnSizing.mjs +76 -0
  93. package/dist/components/table/useTableColumnSizing.mjs.map +1 -0
  94. package/dist/components/table/useTableFeatures.cjs +2 -0
  95. package/dist/components/table/useTableFeatures.cjs.map +1 -0
  96. package/dist/components/table/useTableFeatures.mjs +110 -0
  97. package/dist/components/table/useTableFeatures.mjs.map +1 -0
  98. package/dist/components/table/useTableSelection.cjs +2 -0
  99. package/dist/components/table/useTableSelection.cjs.map +1 -0
  100. package/dist/components/table/useTableSelection.mjs +39 -0
  101. package/dist/components/table/useTableSelection.mjs.map +1 -0
  102. package/dist/components/table/useTableSort.cjs +2 -0
  103. package/dist/components/table/useTableSort.cjs.map +1 -0
  104. package/dist/components/table/useTableSort.mjs +58 -0
  105. package/dist/components/table/useTableSort.mjs.map +1 -0
  106. package/dist/hooks/useActiveDescendant.cjs +1 -1
  107. package/dist/hooks/useActiveDescendant.cjs.map +1 -1
  108. package/dist/hooks/useActiveDescendant.mjs +33 -25
  109. package/dist/hooks/useActiveDescendant.mjs.map +1 -1
  110. package/dist/hooks/useListbox.cjs +1 -1
  111. package/dist/hooks/useListbox.cjs.map +1 -1
  112. package/dist/hooks/useListbox.mjs +140 -130
  113. package/dist/hooks/useListbox.mjs.map +1 -1
  114. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  115. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  116. package/dist/hooks/useRovingTabIndex.mjs +1 -1
  117. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  118. package/dist/hooks/useSelection.cjs +2 -0
  119. package/dist/hooks/useSelection.cjs.map +1 -0
  120. package/dist/hooks/useSelection.mjs +57 -0
  121. package/dist/hooks/useSelection.mjs.map +1 -0
  122. package/dist/hooks/useVirtualWindow.cjs +2 -0
  123. package/dist/hooks/useVirtualWindow.cjs.map +1 -0
  124. package/dist/hooks/useVirtualWindow.mjs +102 -0
  125. package/dist/hooks/useVirtualWindow.mjs.map +1 -0
  126. package/dist/index.cjs +1 -1
  127. package/dist/index.d.cts +1542 -53
  128. package/dist/index.d.ts +1542 -53
  129. package/dist/index.mjs +147 -136
  130. package/dist/lib/classNames.cjs +1 -1
  131. package/dist/lib/classNames.cjs.map +1 -1
  132. package/dist/lib/classNames.mjs +68 -49
  133. package/dist/lib/classNames.mjs.map +1 -1
  134. package/dist/lib/columnSizing.cjs +2 -0
  135. package/dist/lib/columnSizing.cjs.map +1 -0
  136. package/dist/lib/columnSizing.mjs +27 -0
  137. package/dist/lib/columnSizing.mjs.map +1 -0
  138. package/dist/lib/flatTree.cjs +2 -0
  139. package/dist/lib/flatTree.cjs.map +1 -0
  140. package/dist/lib/flatTree.mjs +118 -0
  141. package/dist/lib/flatTree.mjs.map +1 -0
  142. package/dist/lib/selection.cjs +2 -0
  143. package/dist/lib/selection.cjs.map +1 -0
  144. package/dist/lib/selection.mjs +28 -0
  145. package/dist/lib/selection.mjs.map +1 -0
  146. package/dist/lib/treeCascade.cjs +2 -0
  147. package/dist/lib/treeCascade.cjs.map +1 -0
  148. package/dist/lib/treeCascade.mjs +52 -0
  149. package/dist/lib/treeCascade.mjs.map +1 -0
  150. package/dist/lib/virtual.cjs +2 -0
  151. package/dist/lib/virtual.cjs.map +1 -0
  152. package/dist/lib/virtual.mjs +54 -0
  153. package/dist/lib/virtual.mjs.map +1 -0
  154. package/dist/styles.css +1 -1
  155. package/package.json +1 -1
@@ -7,24 +7,26 @@ import { composeEventHandlers as l } from "../../lib/composeEventHandlers.mjs";
7
7
  import { listClassNames as ee, listItemClassNames as u } from "../../lib/classNames.mjs";
8
8
  import { useEventCallback as d } from "../../hooks/useEventCallback.mjs";
9
9
  import { useControllable as te } from "../../hooks/useControllable.mjs";
10
- import { useId as ne } from "../../hooks/useId.mjs";
11
- import { getArrowIntent as f, getDirection as p } from "../../lib/direction.mjs";
10
+ import { useId as f } from "../../hooks/useId.mjs";
11
+ import { getArrowIntent as ne, getDirection as p } from "../../lib/direction.mjs";
12
12
  import { FOCUSABLE_SELECTOR as m, isFocusable as h } from "../../lib/focus.mjs";
13
- import { useRovingTabIndex as re } from "../../hooks/useRovingTabIndex.mjs";
14
- import { useMergedRefs as ie } from "../../hooks/useMergedRefs.mjs";
15
- import { focusableDisabledProps as ae } from "../../lib/aria.mjs";
16
- import { focusRingInset as g, forcedColors as _ } from "../../lib/styles.mjs";
17
- import { CheckIcon as v } from "../../lib/icons.mjs";
18
- import { INTERACTIVE_SELECTOR as y, isForeignEvent as b } from "../../lib/events.mjs";
19
- import { ListRegistry as x } from "./List.registry.mjs";
20
- import * as S from "react";
21
- import { jsx as C, jsxs as oe } from "react/jsx-runtime";
13
+ import { ownsArrowKeys as re, useRovingTabIndex as ie } from "../../hooks/useRovingTabIndex.mjs";
14
+ import { useMergedRefs as ae } from "../../hooks/useMergedRefs.mjs";
15
+ import { focusableDisabledProps as oe } from "../../lib/aria.mjs";
16
+ import { focusRingInset as se, forcedColors as ce } from "../../lib/styles.mjs";
17
+ import { CheckIcon as le } from "../../lib/icons.mjs";
18
+ import { INTERACTIVE_SELECTOR as g, isForeignEvent as _ } from "../../lib/events.mjs";
19
+ import { ListRegistry as v } from "./List.registry.mjs";
20
+ import * as y from "react";
21
+ import { jsx as b, jsxs as ue } from "react/jsx-runtime";
22
22
  //#region src/components/data-display/List.tsx
23
- var w = S.createContext(null);
24
- w.displayName = "ListContext";
25
- var T = null;
26
- function E() {
27
- return T ??= {
23
+ var x = y.createContext(null);
24
+ x.displayName = "ListContext";
25
+ var de = y.createContext(null);
26
+ de.displayName = "ListItemIndexContext";
27
+ var S = null;
28
+ function fe() {
29
+ return S ??= {
28
30
  mode: "list",
29
31
  navigable: !1,
30
32
  selection: !1,
@@ -32,14 +34,15 @@ function E() {
32
34
  selectedValues: /* @__PURE__ */ new Set(),
33
35
  toggleItem: () => {},
34
36
  getTabIndex: () => -1,
35
- registry: new x()
36
- }, T;
37
+ registry: new v(),
38
+ listWindow: null
39
+ }, S;
37
40
  }
38
- function D(e) {
39
- return S.useContext(w) || (r(e, "a List"), E());
41
+ function C(e) {
42
+ return y.useContext(x) || (r(e, "a List"), fe());
40
43
  }
41
- var O = [];
42
- function k(e, t, n) {
44
+ var pe = [];
45
+ function w(e, t, n) {
43
46
  return n === "composite" || e && t ? {
44
47
  mode: "grid",
45
48
  navigation: "composite"
@@ -51,26 +54,26 @@ function k(e, t, n) {
51
54
  navigation: n === "items" ? "items" : "none"
52
55
  };
53
56
  }
54
- function se(e) {
57
+ function T(e) {
55
58
  a(`List:duplicate:${e}`, `List: several items share the value "${e}". Item values must be unique within a List; items with the same value are selected (and tab stops) together.`);
56
59
  }
57
- function A(e) {
58
- return t(e).some(({ node: e }) => n(e, G) && c(e.props.action));
60
+ function me(e) {
61
+ return t(e).some(({ node: e }) => n(e, J) && c(e.props.action));
59
62
  }
60
- var j = { interactive: `${y}, [data-list-action]` };
61
- function M(e) {
62
- return b(e, j);
63
+ var E = { interactive: `${g}, [data-list-action]` };
64
+ function D(e) {
65
+ return _(e, E);
63
66
  }
64
- function N(e) {
67
+ function O(e) {
65
68
  return e.ctrlKey || e.altKey || e.metaKey ? !1 : e.key === "Enter" || e.key === " ";
66
69
  }
67
- var P = /* @__PURE__ */ new Set([
70
+ var k = /* @__PURE__ */ new Set([
68
71
  "textbox",
69
72
  "searchbox",
70
73
  "combobox",
71
74
  "spinbutton",
72
75
  "slider"
73
- ]), F = /* @__PURE__ */ new Set([
76
+ ]), A = /* @__PURE__ */ new Set([
74
77
  "button",
75
78
  "checkbox",
76
79
  "color",
@@ -81,279 +84,462 @@ var P = /* @__PURE__ */ new Set([
81
84
  "reset",
82
85
  "submit"
83
86
  ]);
84
- function I(e) {
87
+ function j(e) {
85
88
  let t = e.getAttribute("role");
86
- if (t !== null && P.has(t)) return !0;
89
+ if (t !== null && k.has(t)) return !0;
87
90
  let n = e.localName;
88
- return n === "textarea" || n === "select" ? !0 : n === "input" ? !F.has(e.type) : e.matches("[contenteditable]:not([contenteditable=\"false\"])");
91
+ return n === "textarea" || n === "select" ? !0 : n === "input" ? !A.has(e.type) : e.matches("[contenteditable]:not([contenteditable=\"false\"])");
89
92
  }
90
- function L(e) {
93
+ function M(e) {
91
94
  return Array.from(e.querySelectorAll(m)).filter((e) => h(e));
92
95
  }
93
- function R(e) {
96
+ function N(e) {
94
97
  if (!e.parentElement) return -1;
95
98
  let t = 0;
96
99
  for (let n = e.previousElementSibling; n; n = n.previousElementSibling) t++;
97
100
  return t;
98
101
  }
102
+ function P(e) {
103
+ return e.hasAttribute("tabindex") ? e : M(e)[0] ?? null;
104
+ }
105
+ function F(e, t, n) {
106
+ let r = null, i = null, a = null, o = 0;
107
+ for (let s = e.firstElementChild; s; s = s.nextElementSibling, o++) {
108
+ let e = n ? R(s) : o;
109
+ if (e !== null) {
110
+ if (t.value !== void 0 && s.getAttribute("data-roving-value") === t.value) {
111
+ r = s;
112
+ break;
113
+ }
114
+ e === t.index && (i = s), a = s;
115
+ }
116
+ }
117
+ let s = r ?? i ?? (t.index >= 0 ? a : null);
118
+ return s ? P(s) : null;
119
+ }
120
+ function I(e) {
121
+ return e !== void 0 && Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0;
122
+ }
123
+ function L(...e) {
124
+ return e.filter((e) => e !== null);
125
+ }
126
+ function R(e) {
127
+ let t = e.getAttribute("data-index");
128
+ return t !== null && /^\d+$/.test(t) ? Number(t) : null;
129
+ }
99
130
  function z(e, t) {
100
- let n = null, r = null, i = null, a = 0;
101
- for (let o = e.firstElementChild; o; o = o.nextElementSibling, a++) {
102
- if (t.value !== void 0 && o.getAttribute("data-roving-value") === t.value) {
103
- n = o;
104
- break;
131
+ let n = t instanceof Element ? t : null;
132
+ for (; n && n.parentElement !== e;) n = n.parentElement;
133
+ return n ? R(n) : null;
134
+ }
135
+ function B(e, t) {
136
+ for (let n = e.firstElementChild; n; n = n.nextElementSibling) if (R(n) === t) return n;
137
+ return null;
138
+ }
139
+ var V = 10;
140
+ function he(e, t, n) {
141
+ let r = n - 1, i = t === null ? null : Math.min(t, r);
142
+ switch (e) {
143
+ case "ArrowDown": return i === null || i === r ? 0 : i + 1;
144
+ case "ArrowUp": return i === null || i === 0 ? r : i - 1;
145
+ case "PageDown": return i === null ? 0 : Math.min(i + V, r);
146
+ case "PageUp": return i === null ? r : Math.max(i - V, 0);
147
+ case "Home": return 0;
148
+ case "End": return r;
149
+ default: return;
150
+ }
151
+ }
152
+ var H = {
153
+ focused: null,
154
+ pending: null
155
+ }, U = class {
156
+ state = H;
157
+ listeners = /* @__PURE__ */ new Set();
158
+ subscribe = (e) => (this.listeners.add(e), () => {
159
+ this.listeners.delete(e);
160
+ });
161
+ getSnapshot = () => this.state;
162
+ getServerSnapshot = () => H;
163
+ update(e) {
164
+ let t = {
165
+ ...this.state,
166
+ ...e
167
+ };
168
+ if (t.focused !== this.state.focused || t.pending !== this.state.pending) {
169
+ this.state = t;
170
+ for (let e of this.listeners) e();
105
171
  }
106
- a === t.index && (r = o), i = o;
107
172
  }
108
- let o = n ?? r ?? (t.index >= 0 ? i : null);
109
- return o ? o.hasAttribute("tabindex") ? o : L(o)[0] ?? null : null;
173
+ };
174
+ function W({ grid: e, size: t }) {
175
+ return /* @__PURE__ */ b(e ? "div" : "li", {
176
+ "aria-hidden": "true",
177
+ role: "presentation",
178
+ "data-virtual-spacer": "",
179
+ className: ee.spacer,
180
+ style: { height: t }
181
+ });
110
182
  }
111
- function B(e) {
183
+ W.displayName = "ListSpacer";
184
+ function ge(e) {
112
185
  for (let t = e.firstElementChild; t; t = t.nextElementSibling) if (t.hasAttribute("data-list-action")) return t;
113
186
  return null;
114
187
  }
115
- function V(e) {
188
+ function _e(e) {
116
189
  let t = [];
117
- for (let n of L(e)) {
118
- let r = I(n) ? e : n;
190
+ for (let n of M(e)) {
191
+ let r = j(n) ? e : n;
119
192
  t.includes(r) || t.push(r);
120
193
  }
121
194
  return t;
122
195
  }
123
- var H = (t) => {
124
- let { selectable: n = !1, selectionMode: r, selectedItems: o, defaultSelectedItems: s, onSelectionChange: c, selectedItem: u, defaultSelectedItem: d, onSelectedItemChange: ne, navigationMode: f, checkmark: p = !1, className: m, children: h, ref: ae, onKeyDown: g, onKeyDownCapture: _, onFocus: v, ...y } = t;
196
+ var G = (t) => {
197
+ let { selectable: n = !1, selectionMode: r, selectedItems: o, defaultSelectedItems: s, onSelectionChange: c, selectedItem: u, defaultSelectedItem: f, onSelectedItemChange: ne, navigationMode: p, checkmark: m = !1, virtualWindow: h, count: oe, className: se, children: ce, ref: le, onKeyDown: g, onKeyDownCapture: _, onFocus: ue, onBlur: S, ...fe } = t, C = typeof ce == "function" ? ce : null, E = h !== void 0 && oe !== void 0 && C ? h : null, D = E !== null, O = !D && (h !== void 0 || oe !== void 0 || C !== null), k = D ? I(oe) : 0, A = E?.itemSize, j = y.useMemo(() => A === void 0 ? null : {
198
+ count: k,
199
+ itemSize: A
200
+ }, [k, A]);
125
201
  r === "multi" && i("List", "selectionMode=\"multi\"", "selectionMode=\"multiple\"");
126
- let b = r === "multiple" || r === "multi", oe = S.useMemo(() => !b && u !== void 0 ? u === null ? O : [u] : o, [
127
- b,
202
+ let N = r === "multiple" || r === "multi", R = y.useMemo(() => !N && u !== void 0 ? u === null ? pe : [u] : o, [
203
+ N,
128
204
  u,
129
205
  o
130
- ]), T = S.useMemo(() => !b && d != null ? [d] : s ?? O, [
131
- b,
132
- d,
206
+ ]), V = y.useMemo(() => !N && f != null ? [f] : s ?? pe, [
207
+ N,
208
+ f,
133
209
  s
134
- ]), [E, D] = te(oe, T, (e) => {
210
+ ]), [ge, _e] = te(R, V, (e) => {
135
211
  let t = [...e];
136
- c?.(t), b || ne?.(t[0] ?? null);
137
- }), [j] = S.useState(() => new x()), M = S.useSyncExternalStore(j.subscribe, j.getSnapshot, j.getServerSnapshot), N = S.useMemo(() => M ? E.filter((e) => M.valueSet.has(e)) : E, [M, E]), P = S.useMemo(() => new Set(N), [N]), F = n && f !== "composite" && (M ? M.hasActions : A(h)), { mode: I, navigation: R } = k(n, F, f), B = R !== "none", V = n && p;
138
- S.useLayoutEffect(() => {
139
- j.setActive(B);
140
- }, [j, B]);
141
- let H = M ? M.values.find((e) => P.has(e)) ?? null : N[0] ?? null, { containerProps: U, getTabIndex: W } = re({
142
- activeValue: n ? H : null,
212
+ c?.(t), N || ne?.(t[0] ?? null);
213
+ }), [G] = y.useState(() => new v()), K = y.useSyncExternalStore(G.subscribe, G.getSnapshot, G.getServerSnapshot), q = y.useMemo(() => K && !D ? ge.filter((e) => K.valueSet.has(e)) : ge, [
214
+ K,
215
+ ge,
216
+ D
217
+ ]), ve = y.useMemo(() => new Set(q), [q]), [J] = y.useState(() => new U()), { focused: Y, pending: ye } = y.useSyncExternalStore(J.subscribe, J.getSnapshot, J.getServerSnapshot), be = y.useMemo(() => L(Y, ye), [Y, ye]), X = E && C ? E.layout(k, { keep: be }).map((e) => e.kind === "item" ? {
218
+ ...e,
219
+ node: C(e.index)
220
+ } : e) : null, xe = C ? null : ce, Se = n && p !== "composite" && (K ? K.hasActions : me(X ? X.map((e) => e.kind === "item" ? e.node : null) : xe)), Ce = Se && !D, we = Se && D, { mode: Z, navigation: Te } = w(n, Ce, p), Q = Te !== "none", Ee = n && m;
221
+ y.useLayoutEffect(() => {
222
+ G.setActive(Q);
223
+ }, [G, Q]);
224
+ let De = K ? K.values.find((e) => ve.has(e)) ?? null : q[0] ?? null, Oe = d((e, t) => {
225
+ let n = t.currentTarget, r = n.ownerDocument.activeElement, i = r ? z(n, r) : null;
226
+ i !== null && E?.scrollToIndex(i, { align: "auto" });
227
+ }), { containerProps: ke, getTabIndex: Ae } = ie({
228
+ activeValue: n ? De : null,
143
229
  orientation: "vertical",
144
- typeahead: (M?.count ?? 0) > 7,
145
- tabStop: n ? "active" : "last-focused",
230
+ onFocusMove: D ? Oe : void 0,
231
+ typeahead: (D ? k : K?.count ?? 0) > 7,
232
+ tabStop: n && !(D && Y !== null) ? "active" : "last-focused",
146
233
  itemSelector: ":scope > [data-roving-value]"
147
- }), { ref: ce, onKeyDown: G, onKeyDownCapture: K, onFocus: q } = U, J = S.useRef(null), le = ie(ae, B ? ce : null, J);
148
- S.useLayoutEffect(() => {
149
- let e = j.takeFocusLoss(), t = J.current;
234
+ }), { ref: je, onKeyDown: Me, onKeyDownCapture: Ne, onFocus: Pe } = ke, $ = y.useRef(null), Fe = ae(le, Q ? je : null, $, E?.scrollRef), Ie = y.useRef(!1), Le = d((e) => {
235
+ Q && Pe(e);
236
+ let t = e.currentTarget;
237
+ Ie.current = !t.contains(e.target);
238
+ let n = z(t, e.target);
239
+ n !== null && J.update({
240
+ focused: n,
241
+ pending: null
242
+ });
243
+ }), Re = D ? Le : Q ? Pe : void 0, ze = d((e) => {
244
+ let t = e.currentTarget, n = e.relatedTarget;
245
+ n && t.contains(n) || (Ie.current = !1, queueMicrotask(() => {
246
+ if (!t.isConnected || Ie.current) return;
247
+ let e = t.ownerDocument.activeElement;
248
+ e && t.contains(e) || J.update(H);
249
+ }));
250
+ }), Be = d((e) => {
251
+ if (!E || e.defaultPrevented || k === 0 || e.ctrlKey || e.altKey || e.metaKey) return;
252
+ let t = e.currentTarget;
253
+ if (!t.contains(e.target) || re(e.target)) return;
254
+ let n = z(t, e.target), r = he(e.key, J.getSnapshot().pending ?? n, k);
255
+ if (r === void 0) return;
256
+ if (e.preventDefault(), r === n) {
257
+ J.update({ pending: null }), E.scrollToIndex(r, { align: "auto" });
258
+ return;
259
+ }
260
+ let i = B(t, r);
261
+ if (i) {
262
+ J.update({ pending: null }), i.scrollIntoView?.({ block: "nearest" }), P(i)?.focus();
263
+ return;
264
+ }
265
+ let a = J.getSnapshot().pending;
266
+ J.update({ pending: r }), a !== r && E.scrollToIndex(r, { align: "auto" });
267
+ }), Ve = d((e) => {
268
+ D && Be(e), Me(e);
269
+ });
270
+ y.useLayoutEffect(() => {
271
+ let e = G.takeFocusLoss(), t = $.current;
150
272
  if (!e || !t) return;
151
273
  let n = t.ownerDocument, r = n.activeElement;
152
- r && r !== n.body && r.isConnected || z(t, e)?.focus();
153
- }, [I, j]), S.useLayoutEffect(() => {
154
- if (B) return;
155
- let e = J.current, t = e?.ownerDocument.activeElement;
156
- t && t.parentElement === e && !t.hasAttribute("tabindex") && L(t)[0]?.focus();
157
- }, [B]), S.useLayoutEffect(() => {
158
- j.syncOrder(J.current);
274
+ r && r !== n.body && r.isConnected || F(t, e, D)?.focus();
275
+ }, [
276
+ Z,
277
+ G,
278
+ D
279
+ ]), y.useLayoutEffect(() => {
280
+ let e = $.current;
281
+ if (!D || !e) {
282
+ J.update(H);
283
+ return;
284
+ }
285
+ let t = e.ownerDocument, n = t.activeElement, r = !n || n === t.body || !n.isConnected || n === e, { pending: i } = J.getSnapshot();
286
+ if (i !== null) {
287
+ J.update({ pending: null });
288
+ let t = i < k ? B(e, i) : null;
289
+ t && (r || e.contains(n)) && P(t)?.focus();
290
+ }
291
+ let { focused: a } = J.getSnapshot();
292
+ if (!(a === null || a < k)) {
293
+ if (r && k > 0) {
294
+ let t = B(e, k - 1);
295
+ if (t) P(t)?.focus();
296
+ else {
297
+ J.update({
298
+ focused: null,
299
+ pending: k - 1
300
+ }), E?.scrollToIndex(k - 1, { align: "auto" });
301
+ return;
302
+ }
303
+ }
304
+ J.getSnapshot().focused === a && J.update({ focused: null });
305
+ }
306
+ }), y.useLayoutEffect(() => {
307
+ if (Q) return;
308
+ let e = $.current, t = e?.ownerDocument.activeElement;
309
+ t && t.parentElement === e && !t.hasAttribute("tabindex") && M(t)[0]?.focus();
310
+ }, [Q]), y.useLayoutEffect(() => {
311
+ G.syncOrder($.current);
159
312
  });
160
- let Y = S.useCallback((e) => {
161
- D((t) => {
162
- let n = j.prune(t), r = n.includes(e);
163
- return b ? r ? n.filter((t) => t !== e) : [...n, e] : r ? [] : [e];
313
+ let He = y.useCallback((e) => {
314
+ _e((t) => {
315
+ let n = D ? t : G.prune(t), r = n.includes(e);
316
+ return N ? r ? n.filter((t) => t !== e) : [...n, e] : r ? [] : [e];
164
317
  });
165
318
  }, [
166
- b,
167
- j,
319
+ N,
320
+ G,
321
+ _e,
168
322
  D
169
- ]), X = M?.duplicates ?? O;
170
- S.useEffect(() => {
171
- for (let e of X) se(e);
172
- }, [X]);
173
- let Z = N.length;
174
- S.useEffect(() => {
175
- n && !b && Z > 1 && a("List:single-several-selected", `List: a single-selection list (selectionMode "single") received ${Z} selected items. Pass one value with \`selectedItem\`, or use selectionMode="multiple".`);
323
+ ]), Ue = K?.duplicates ?? pe;
324
+ y.useEffect(() => {
325
+ for (let e of Ue) T(e);
326
+ }, [Ue]);
327
+ let We = q.length;
328
+ y.useEffect(() => {
329
+ n && !N && We > 1 && a("List:single-several-selected", `List: a single-selection list (selectionMode "single") received ${We} selected items. Pass one value with \`selectedItem\`, or use selectionMode="multiple".`);
176
330
  }, [
177
331
  n,
178
- b,
179
- Z
332
+ N,
333
+ We
180
334
  ]);
181
- let Q = n && f === "items" && F, $ = n && f === "none";
182
- S.useEffect(() => {
183
- Q && a("List:items-with-actions", "List: a selectable list whose items have actions is a grid (an option cannot hold interactive content), so navigationMode=\"items\" acts as \"composite\". Set navigationMode=\"composite\"."), $ && a("List:none-selectable", "List: navigationMode=\"none\" has no effect on a selectable list, whose items are always reached with the arrow keys. Remove it, or use \"items\" or \"composite\".");
184
- }, [Q, $]);
185
- let ue = S.useMemo(() => ({
186
- mode: I,
187
- navigable: B,
335
+ let Ge = n && p === "items" && Ce, Ke = n && p === "none";
336
+ y.useEffect(() => {
337
+ Ge && a("List:items-with-actions", "List: a selectable list whose items have actions is a grid (an option cannot hold interactive content), so navigationMode=\"items\" acts as \"composite\". Set navigationMode=\"composite\"."), Ke && a("List:none-selectable", "List: navigationMode=\"none\" has no effect on a selectable list, whose items are always reached with the arrow keys. Remove it, or use \"items\" or \"composite\".");
338
+ }, [Ge, Ke]), y.useEffect(() => {
339
+ O && a("List:virtual-window-children", "List: a windowed list needs `virtualWindow`, `count` and a function child that returns the `List.Item` at an index; without one of them the window is ignored (a function child then renders nothing, and element children are all rendered).");
340
+ }, [O]), y.useEffect(() => {
341
+ we && a("List:virtual-window-actions", "List: a selectable windowed list keeps its listbox structure whatever items are rendered, so an item action sits inside an option, which cannot hold interactive content. Set navigationMode=\"composite\" to render a grid whose rows hold the actions.");
342
+ }, [we]);
343
+ let qe = y.useMemo(() => ({
344
+ mode: Z,
345
+ navigable: Q,
188
346
  selection: n,
189
- checkmark: V,
190
- selectedValues: P,
191
- toggleItem: Y,
192
- getTabIndex: W,
193
- registry: j
347
+ checkmark: Ee,
348
+ selectedValues: ve,
349
+ toggleItem: He,
350
+ getTabIndex: Ae,
351
+ registry: G,
352
+ listWindow: j
194
353
  }), [
195
- I,
196
- B,
354
+ Z,
355
+ Q,
197
356
  n,
198
- V,
199
- P,
200
- Y,
201
- W,
357
+ Ee,
358
+ ve,
359
+ He,
360
+ Ae,
361
+ G,
202
362
  j
203
- ]), de = I === "grid" ? "div" : "ul", fe = I === "grid" ? "grid" : I === "listbox" ? "listbox" : "list";
204
- return /* @__PURE__ */ C(w.Provider, {
205
- value: ue,
206
- children: /* @__PURE__ */ C(de, {
207
- role: fe,
208
- "aria-multiselectable": n && b ? !0 : void 0,
209
- "data-navigation-mode": R,
210
- "data-checkmark": V ? "" : void 0,
211
- className: e(ee.root, "m-0 list-none p-0", m),
212
- ...y,
213
- ref: le,
214
- "data-roving-container": B ? "" : void 0,
215
- onKeyDown: B ? l(g, G) : g,
216
- onKeyDownCapture: B ? l(_, K) : _,
217
- onFocus: B ? l(v, q, { checkDefaultPrevented: !1 }) : v,
218
- children: h
363
+ ]), Je = Z === "grid" ? "div" : "ul", Ye = Z === "grid" ? "grid" : Z === "listbox" ? "listbox" : "list", Xe = X ? X.map((e) => e.kind === "item" ? /* @__PURE__ */ b(de.Provider, {
364
+ value: e.index,
365
+ children: e.node
366
+ }, e.index) : /* @__PURE__ */ b(W, {
367
+ grid: Z === "grid",
368
+ size: e.size
369
+ }, e.key)) : xe;
370
+ return /* @__PURE__ */ b(x.Provider, {
371
+ value: qe,
372
+ children: /* @__PURE__ */ b(Je, {
373
+ role: Ye,
374
+ "aria-multiselectable": n && N ? !0 : void 0,
375
+ "aria-rowcount": D && Z === "grid" ? k : void 0,
376
+ "data-navigation-mode": Te,
377
+ "data-checkmark": Ee ? "" : void 0,
378
+ tabIndex: D && Q ? -1 : void 0,
379
+ className: e(ee.root, "m-0 list-none p-0", D && "overflow-y-auto [overflow-anchor:none]", se),
380
+ ...fe,
381
+ ref: Fe,
382
+ "data-roving-container": Q ? "" : void 0,
383
+ onKeyDown: Q ? l(g, Ve) : g,
384
+ onKeyDownCapture: Q ? l(_, Ne) : _,
385
+ onFocus: Re ? l(ue, Re, { checkDefaultPrevented: !1 }) : ue,
386
+ onBlur: D ? l(S, ze, { checkDefaultPrevented: !1 }) : S,
387
+ children: Xe
219
388
  })
220
389
  });
221
390
  };
222
- H.displayName = "List";
223
- var U = "forced-colors:text-[Highlight] forced-colors:forced-color-adjust-none", W = "forced-colors:text-[GrayText] forced-colors:forced-color-adjust-none";
224
- function ce(t, { selected: n, disabled: r }) {
225
- let i = e(u.checkmark, "order-first me-2 inline-flex shrink-0 items-center justify-center", r ? ["text-muted-foreground", W] : ["text-primary", U], !n && "invisible");
226
- return t === void 0 ? /* @__PURE__ */ C("span", {
391
+ G.displayName = "List";
392
+ var K = "forced-colors:text-[Highlight] forced-colors:forced-color-adjust-none", q = "forced-colors:text-[GrayText] forced-colors:forced-color-adjust-none";
393
+ function ve(t, { selected: n, disabled: r }) {
394
+ let i = e(u.checkmark, "order-first me-2 inline-flex shrink-0 items-center justify-center", r ? ["text-muted-foreground", q] : ["text-primary", K], !n && "invisible");
395
+ return t === void 0 ? /* @__PURE__ */ b("span", {
227
396
  "aria-hidden": "true",
228
397
  className: i,
229
- children: /* @__PURE__ */ C(v, {})
398
+ children: /* @__PURE__ */ b(le, {})
230
399
  }) : s(t, "span", i, { "aria-hidden": !0 });
231
400
  }
232
- var G = ({ value: t, action: n, onAction: r, disabledSelection: i = !1, checkmark: s, className: ee, children: te, onClick: m, onKeyDown: h, ref: re, ...v }) => {
233
- let { mode: y, navigable: b, selection: x, checkmark: w, selectedValues: T, toggleItem: E, getTabIndex: O, registry: k } = D("ListItem"), se = ne("list-item"), A = t || void 0, j = A ?? se, P = c(n), [F] = S.useState(() => ({})), z = S.useRef(null), H = ie(re, z);
234
- S.useLayoutEffect(() => {
235
- k.set(F, {
401
+ var J = ({ value: t, action: n, onAction: r, disabledSelection: i = !1, checkmark: s, className: ee, style: te, children: m, onClick: h, onKeyDown: re, ref: ie, ...le }) => {
402
+ let { mode: g, navigable: _, selection: v, checkmark: x, selectedValues: S, toggleItem: fe, getTabIndex: pe, registry: w, listWindow: T } = C("ListItem"), me = y.useContext(de), E = T ? me : null, k = f("list-item"), A = t || void 0, P = A ?? k, F = c(n), [I] = y.useState(() => ({})), L = y.useRef(null), R = ae(ie, L);
403
+ y.useLayoutEffect(() => {
404
+ w.set(I, {
236
405
  value: A,
237
- hasAction: P,
238
- element: z
406
+ hasAction: F,
407
+ element: L,
408
+ index: E ?? void 0
239
409
  });
240
410
  }, [
241
- k,
242
- F,
411
+ w,
412
+ I,
243
413
  A,
244
- P
245
- ]), S.useLayoutEffect(() => () => k.delete(F), [k, F]);
246
- let U = d((e) => {
414
+ F,
415
+ E
416
+ ]), y.useLayoutEffect(() => () => w.delete(I), [w, I]);
417
+ let z = d((e) => {
247
418
  let t = e.parentElement;
248
- k.recordFocusLoss({
419
+ w.recordFocusLoss({
249
420
  value: A,
250
- index: t ? R(t) : -1
421
+ index: E ?? (t ? N(t) : -1)
251
422
  });
252
423
  });
253
- S.useLayoutEffect(() => {
254
- let e = z.current;
424
+ y.useLayoutEffect(() => {
425
+ let e = L.current;
255
426
  return () => {
256
427
  if (!e) return;
257
428
  let t = e.ownerDocument.activeElement;
258
- t && e.contains(t) && k.recordFocusLoss({
429
+ t && e.contains(t) && w.recordFocusLoss({
259
430
  value: A,
260
- index: R(e)
431
+ index: E ?? N(e)
261
432
  });
262
433
  };
263
- }, [k, A]);
264
- let W = r !== void 0 && !b;
265
- S.useEffect(() => {
266
- W && a("List.Item:action-not-navigable", "List.Item: `onAction` runs only on clicks here: the List does not navigate its items, so keyboard users cannot reach them. Set navigationMode=\"items\" (or \"composite\") on the List, or make it selectable.");
267
- }, [W]);
268
- let G = x && A !== void 0 && T.has(A), K = x && A !== void 0, q = x && i, J = q && r === void 0, Y = () => {
269
- x && !i && A !== void 0 && E(A);
270
- }, X = (e) => {
271
- r?.(e), e.isDefaultPrevented() || Y();
272
- }, Z = (e) => {
273
- M(e) || X(e);
274
- }, Q = (e) => {
275
- if (e.key === " " && K) {
276
- e.preventDefault(), Y();
434
+ }, [
435
+ w,
436
+ A,
437
+ E
438
+ ]);
439
+ let B = r !== void 0 && !_;
440
+ y.useEffect(() => {
441
+ B && a("List.Item:action-not-navigable", "List.Item: `onAction` runs only on clicks here: the List does not navigate its items, so keyboard users cannot reach them. Set navigationMode=\"items\" (or \"composite\") on the List, or make it selectable.");
442
+ }, [B]);
443
+ let V = v && A !== void 0 && S.has(A), he = v && A !== void 0, H = v && i, U = H && r === void 0, W = () => {
444
+ v && !i && A !== void 0 && fe(A);
445
+ }, G = (e) => {
446
+ r?.(e), e.isDefaultPrevented() || W();
447
+ }, K = (e) => {
448
+ D(e) || G(e);
449
+ }, q = (e) => {
450
+ if (e.key === " " && he) {
451
+ e.preventDefault(), W();
277
452
  return;
278
453
  }
279
- (x || r !== void 0) && (X(e), e.preventDefault());
280
- }, $ = (e) => {
281
- M(e) || N(e) && Q(e);
282
- }, ue = (e) => {
283
- let t = e.currentTarget, n = e.target, r = B(t);
454
+ (v || r !== void 0) && (G(e), e.preventDefault());
455
+ }, J = (e) => {
456
+ D(e) || O(e) && q(e);
457
+ }, Y = (e) => {
458
+ let t = e.currentTarget, n = e.target, r = ge(t);
284
459
  if (!r || !r.contains(n)) {
285
460
  if (n !== t) return;
286
- if (N(e)) {
287
- Q(e);
461
+ if (O(e)) {
462
+ q(e);
288
463
  return;
289
464
  }
290
- let i = f(e.key, {
465
+ let i = ne(e.key, {
291
466
  orientation: "horizontal",
292
467
  dir: p(t)
293
- }) === "next" && r ? V(r)[0] : void 0;
468
+ }) === "next" && r ? _e(r)[0] : void 0;
294
469
  i && (e.preventDefault(), i.focus());
295
470
  return;
296
471
  }
297
- if (n !== r && I(n)) {
472
+ if (n !== r && j(n)) {
298
473
  e.key === "Escape" && (e.preventDefault(), r.focus());
299
474
  return;
300
475
  }
301
476
  if (n === r && (e.key === "Enter" || e.key === "F2")) {
302
- let t = L(r).find((e) => I(e));
477
+ let t = M(r).find((e) => j(e));
303
478
  t && (e.preventDefault(), t.focus());
304
479
  return;
305
480
  }
306
- let i = f(e.key, {
481
+ let i = ne(e.key, {
307
482
  orientation: "horizontal",
308
483
  dir: p(t)
309
484
  });
310
485
  if (!i) return;
311
486
  e.preventDefault();
312
- let a = V(r), o = a.indexOf(n);
487
+ let a = _e(r), o = a.indexOf(n);
313
488
  i === "next" ? a[o + 1]?.focus() : o > 0 ? a[o - 1].focus() : t.focus();
314
- }, de = y === "grid" ? "div" : "li", fe = y === "grid" ? "div" : "span", pe = y === "grid" ? "row" : y === "listbox" ? "option" : "listitem", me = b ? {
315
- "aria-selected": x ? G : void 0,
316
- tabIndex: O(j),
317
- "data-roving-value": j,
318
- "data-selected": G ? "" : void 0,
319
- ...ae(J, { reachable: !0 }),
320
- onClick: l(m, Z),
321
- onKeyDown: l(h, y === "grid" ? ue : $)
489
+ }, ye = g === "grid" ? "div" : "li", be = g === "grid" ? "div" : "span", xe = g === "grid" ? "row" : g === "listbox" ? "option" : "listitem", Se = _ ? {
490
+ "aria-selected": v ? V : void 0,
491
+ tabIndex: pe(P),
492
+ "data-roving-value": P,
493
+ "data-selected": V ? "" : void 0,
494
+ ...oe(U, { reachable: !0 }),
495
+ onClick: l(h, K),
496
+ onKeyDown: l(re, g === "grid" ? Y : J)
322
497
  } : {
323
- onClick: r ? l(m, Z) : m,
324
- onKeyDown: h
325
- }, he = x ? J ? "cursor-default" : "cursor-pointer" : r && "cursor-pointer", ge = x ? !J : r !== void 0, _e = s != null && c(s), ve = x && (s == null ? w : _e);
326
- return /* @__PURE__ */ oe(de, {
327
- role: pe,
328
- "data-disabled-selection": q ? "" : void 0,
329
- className: e(u.root, "flex items-center border-b border-border px-4 py-2 text-body-1", b ? [
498
+ onClick: r ? l(h, K) : h,
499
+ onKeyDown: re
500
+ }, Ce = v ? U ? "cursor-default" : "cursor-pointer" : r && "cursor-pointer", we = v ? !U : r !== void 0, Z = s != null && c(s), Te = v && (s == null ? x : Z), Q = T && E !== null ? {
501
+ "data-index": E,
502
+ ...g === "grid" ? { "aria-rowindex": E + 1 } : {
503
+ "aria-setsize": T.count,
504
+ "aria-posinset": E + 1
505
+ }
506
+ } : {};
507
+ return /* @__PURE__ */ ue(ye, {
508
+ role: xe,
509
+ "data-disabled-selection": H ? "" : void 0,
510
+ className: e(u.root, "flex items-center border-b border-border px-4 py-2 text-body-1", E !== null && "box-border", _ ? [
330
511
  "relative",
331
- he,
332
- g
333
- ] : he, G ? ["bg-subtle-selected before:absolute before:inset-y-2 before:start-0 before:w-0.5 before:rounded-full before:bg-primary", _.selectedContainer] : ge && "hover:bg-subtle-hover", ee),
334
- ...v,
335
- ref: H,
336
- ...me,
512
+ Ce,
513
+ se
514
+ ] : Ce, V ? ["bg-subtle-selected before:absolute before:inset-y-2 before:start-0 before:w-0.5 before:rounded-full before:bg-primary", ce.selectedContainer] : we && "hover:bg-subtle-hover", ee),
515
+ style: T && E !== null ? {
516
+ ...te,
517
+ height: T.itemSize
518
+ } : te,
519
+ ...le,
520
+ ref: R,
521
+ ...Se,
522
+ ...Q,
337
523
  children: [
338
- /* @__PURE__ */ C(fe, {
339
- role: y === "grid" ? "gridcell" : void 0,
524
+ /* @__PURE__ */ b(be, {
525
+ role: g === "grid" ? "gridcell" : void 0,
340
526
  className: e(u.content, "min-w-0 flex-1"),
341
- children: te
527
+ children: m
342
528
  }),
343
- P && /* @__PURE__ */ C(le, {
344
- grid: y === "grid",
345
- onRemovedWithFocus: U,
529
+ F && /* @__PURE__ */ b(X, {
530
+ grid: g === "grid",
531
+ onRemovedWithFocus: z,
346
532
  children: o(n)
347
533
  }),
348
- ve && ce(_e ? s : void 0, {
349
- selected: G,
350
- disabled: q
534
+ Te && ve(Z ? s : void 0, {
535
+ selected: V,
536
+ disabled: H
351
537
  })
352
538
  ]
353
539
  });
354
540
  };
355
- G.displayName = "ListItem";
356
- var K = ["[data-roving-container]", ...[
541
+ J.displayName = "ListItem";
542
+ var Y = ["[data-roving-container]", ...[
357
543
  "toolbar",
358
544
  "radiogroup",
359
545
  "listbox",
@@ -363,19 +549,19 @@ var K = ["[data-roving-container]", ...[
363
549
  "menu",
364
550
  "menubar",
365
551
  "tree"
366
- ].map((e) => `[role="${e}"]`)].join(", "), q = [
552
+ ].map((e) => `[role="${e}"]`)].join(", "), ye = [
367
553
  "tabindex",
368
554
  "href",
369
555
  "contenteditable",
370
556
  "controls"
371
557
  ];
372
- function J(e) {
558
+ function be(e) {
373
559
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new WeakSet(), r = () => {
374
560
  for (let n of t.keys()) e.contains(n) || t.delete(n);
375
561
  for (let r of e.querySelectorAll(m)) {
376
562
  let i = r.getAttribute("tabindex");
377
563
  if (i === "-1" || n.has(r)) continue;
378
- let a = r.closest(K);
564
+ let a = r.closest(Y);
379
565
  a && e.contains(a) || (t.set(r, i), r.setAttribute("tabindex", "-1"));
380
566
  }
381
567
  };
@@ -396,26 +582,26 @@ function J(e) {
396
582
  subtree: !0,
397
583
  childList: !0,
398
584
  attributes: !0,
399
- attributeFilter: q
585
+ attributeFilter: ye
400
586
  }), () => {
401
587
  i.disconnect();
402
588
  for (let [e, n] of t) n === null ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", n);
403
589
  t.clear();
404
590
  };
405
591
  }
406
- function le({ grid: t, onRemovedWithFocus: n, children: r }) {
407
- let i = S.useRef(null);
408
- return S.useLayoutEffect(() => {
592
+ function X({ grid: t, onRemovedWithFocus: n, children: r }) {
593
+ let i = y.useRef(null);
594
+ return y.useLayoutEffect(() => {
409
595
  let e = i.current;
410
596
  return () => {
411
597
  if (!e) return;
412
598
  let t = e.ownerDocument.activeElement;
413
599
  t && e.contains(t) && n(e);
414
600
  };
415
- }, [n, t]), S.useLayoutEffect(() => {
601
+ }, [n, t]), y.useLayoutEffect(() => {
416
602
  let e = i.current;
417
- return t && e ? J(e) : void 0;
418
- }, [t]), /* @__PURE__ */ C(t ? "div" : "span", {
603
+ return t && e ? be(e) : void 0;
604
+ }, [t]), /* @__PURE__ */ b(t ? "div" : "span", {
419
605
  ref: i,
420
606
  role: t ? "gridcell" : void 0,
421
607
  tabIndex: t ? -1 : void 0,
@@ -424,9 +610,9 @@ function le({ grid: t, onRemovedWithFocus: n, children: r }) {
424
610
  children: r
425
611
  });
426
612
  }
427
- le.displayName = "ListActionCell";
428
- var Y = /* @__PURE__ */ Object.assign(H, { Item: G });
613
+ X.displayName = "ListActionCell";
614
+ var xe = /* @__PURE__ */ Object.assign(G, { Item: J });
429
615
  //#endregion
430
- export { Y as List, G as ListItem };
616
+ export { xe as List, J as ListItem };
431
617
 
432
618
  //# sourceMappingURL=List.mjs.map