@box-kite/react 2.2.17 → 2.2.18
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.
- package/.claude/rules/box-kite-rules.md +3 -3
- package/.claude/skills/box-kite/SKILL.md +3 -3
- package/.claude/skills/box-kite/references/components.md +1 -1
- package/.claude/skills/box-kite/references/styling.md +1 -1
- package/.cursor/rules/box-kite.mdc +3 -3
- package/AGENTS.md +3 -3
- package/BOX_AI_CONTEXT.md +2 -2
- package/BOX_KITE_AI_CONTEXT.md +2 -2
- package/behavior.cjs +1 -1
- package/behavior.mjs +62 -62
- package/catalog.cjs +1 -1
- package/catalog.mjs +3 -3
- package/client.cjs +1 -1
- package/client.mjs +15 -15
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +1 -1
- package/components/calendar.cjs +1 -1
- package/components/calendar.mjs +1 -1
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +1 -1
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +1 -1
- package/components/dataGrid.cjs +2 -2
- package/components/dataGrid.mjs +11 -11
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +1 -1
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +2 -5
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +108 -101
- package/components/form.cjs +1 -1
- package/components/form.mjs +1 -1
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +1 -1
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +4 -4
- package/components/popover.cjs +1 -1
- package/components/popover.mjs +1 -1
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +1 -1
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +1 -1
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +1 -1
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +11 -11
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +1 -1
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +133 -115
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.mjs +1 -1
- package/components/virtualList.cjs +1 -1
- package/components/virtualList.mjs +1 -1
- package/interactionListening.cjs +1 -1
- package/interactionListening.mjs +3 -3
- package/layer.cjs +1 -1
- package/layer.mjs +17 -14
- package/package.json +2 -2
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +18 -11
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +1 -1
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/utils/dom/domUtils.d.ts +7 -0
package/behavior.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as e, h as t, m as n, p as r, t as i } from "./platform.mjs";
|
|
2
2
|
import { n as a } from "./effects.mjs";
|
|
3
3
|
import { t as o } from "./keyboard.mjs";
|
|
4
4
|
import { useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
@@ -37,21 +37,21 @@ function g() {
|
|
|
37
37
|
let e = m.filter((e) => !m.some((t) => t !== e && h(e, t)));
|
|
38
38
|
return e[e.length - 1];
|
|
39
39
|
}
|
|
40
|
-
function _(
|
|
41
|
-
let { enabled: n = !0, onDismiss: i, inside: o, escapeKey: s = !0, outsidePointer: c = !0 } =
|
|
40
|
+
function _(e) {
|
|
41
|
+
let { enabled: n = !0, onDismiss: i, inside: o, escapeKey: s = !0, outsidePointer: c = !0 } = e, l = d(o), u = f(i);
|
|
42
42
|
a(() => {
|
|
43
43
|
if (!n) return;
|
|
44
|
-
let
|
|
45
|
-
m.push(
|
|
44
|
+
let e = { elements: () => (l.current ?? []).map((e) => r(e)).filter((e) => e !== null) };
|
|
45
|
+
m.push(e);
|
|
46
46
|
let i = new AbortController(), a = (e, t) => document.addEventListener(e, t, { signal: i.signal });
|
|
47
|
-
return s && a("keydown", (
|
|
48
|
-
|
|
47
|
+
return s && a("keydown", (t) => {
|
|
48
|
+
t.key !== "Escape" || t.defaultPrevented || g() === e && u("escape", t);
|
|
49
49
|
}), c && a("pointerdown", (e) => {
|
|
50
|
-
|
|
50
|
+
t(e, l.current ?? []) || u("outside-pointer", e);
|
|
51
51
|
}), () => {
|
|
52
52
|
i.abort();
|
|
53
|
-
let
|
|
54
|
-
|
|
53
|
+
let t = m.indexOf(e);
|
|
54
|
+
t !== -1 && m.splice(t, 1);
|
|
55
55
|
};
|
|
56
56
|
}, [
|
|
57
57
|
n,
|
|
@@ -68,17 +68,17 @@ function v() {
|
|
|
68
68
|
return e && e !== document.body ? e : null;
|
|
69
69
|
}
|
|
70
70
|
function y(e = {}) {
|
|
71
|
-
let { enabled:
|
|
72
|
-
|
|
71
|
+
let { enabled: t = !0, returnTo: r, preventScroll: i } = e, [a, o] = u(null), [s, l] = u(!1);
|
|
72
|
+
t !== s && (l(t), t && o(v()));
|
|
73
73
|
let d = f(() => {
|
|
74
|
-
(
|
|
74
|
+
(n(r) ?? a)?.focus({ preventScroll: i });
|
|
75
75
|
});
|
|
76
76
|
return c(() => {
|
|
77
|
-
if (
|
|
77
|
+
if (t) return () => {
|
|
78
78
|
let e = document.activeElement;
|
|
79
79
|
(!e || e === document.body || !document.contains(e)) && d();
|
|
80
80
|
};
|
|
81
|
-
}, [
|
|
81
|
+
}, [t, d]), { returnFocus: d };
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/react/a11y/useRovingFocus.ts
|
|
@@ -101,12 +101,12 @@ function S(e, t, n, r, i) {
|
|
|
101
101
|
function C(e, t, n) {
|
|
102
102
|
return S(e === 1 ? -1 : t, e, t, !1, n);
|
|
103
103
|
}
|
|
104
|
-
function w(
|
|
105
|
-
let { count:
|
|
104
|
+
function w(t) {
|
|
105
|
+
let { count: n, columns: r, columnIndexOf: i, pageSize: a = b, defaultActiveColumn: c = 0, onActiveCellChange: f, orientation: m = "vertical", loop: h = !0, activeIndex: g, defaultActiveIndex: _ = 0, onActiveIndexChange: v, isDisabled: y, textOf: w, focusItems: T = !0, onSelect: E } = t, [D, O] = p({
|
|
106
106
|
value: g,
|
|
107
107
|
defaultValue: _,
|
|
108
108
|
onChange: v
|
|
109
|
-
}), k = Math.min(D,
|
|
109
|
+
}), k = Math.min(D, n - 1), A = r !== void 0, j = s((e) => typeof r == "function" ? r(e) : r ?? 0, [r]), M = s((e, t) => {
|
|
110
110
|
let n = j(e);
|
|
111
111
|
if (!i) return x(t, n - 1);
|
|
112
112
|
if (n <= 0) return -1;
|
|
@@ -127,8 +127,8 @@ function w(e) {
|
|
|
127
127
|
]), G = d({
|
|
128
128
|
row: k,
|
|
129
129
|
column: F
|
|
130
|
-
}), K = d(N), q = d(f), J = d(j), Y = d(M), X = d(i), Z = s((e,
|
|
131
|
-
let i = x(e,
|
|
130
|
+
}), K = d(N), q = d(f), J = d(j), Y = d(M), X = d(i), Z = s((e, t, r) => {
|
|
131
|
+
let i = x(e, n - 1), a = Math.max(0, t), o = i < 0 ? -1 : Y.current(i, a), s = G.current;
|
|
132
132
|
return i === s.row && o === s.column ? s : (O(i, r), P(a), q.current?.({
|
|
133
133
|
row: i,
|
|
134
134
|
column: o
|
|
@@ -140,14 +140,14 @@ function w(e) {
|
|
|
140
140
|
G,
|
|
141
141
|
Y,
|
|
142
142
|
q,
|
|
143
|
-
|
|
143
|
+
n,
|
|
144
144
|
O
|
|
145
|
-
]), Q = s((e,
|
|
146
|
-
let i = x(e,
|
|
145
|
+
]), Q = s((e, t, r) => {
|
|
146
|
+
let i = x(e, n - 1), a = i < 0 ? -1 : x(Math.max(0, t), J.current(i) - 1);
|
|
147
147
|
return Z(i, a < 0 ? 0 : X.current?.(i, a) ?? a, r);
|
|
148
148
|
}, [
|
|
149
149
|
X,
|
|
150
|
-
|
|
150
|
+
n,
|
|
151
151
|
Z,
|
|
152
152
|
J
|
|
153
153
|
]), ee = s((e, t) => {
|
|
@@ -175,35 +175,35 @@ function w(e) {
|
|
|
175
175
|
k,
|
|
176
176
|
T,
|
|
177
177
|
O
|
|
178
|
-
]), $ = s((
|
|
179
|
-
let { row: r, column: i } = G.current, o = (
|
|
180
|
-
|
|
181
|
-
let r = Q(
|
|
178
|
+
]), $ = s((t) => {
|
|
179
|
+
let { row: r, column: i } = G.current, o = (e, n) => {
|
|
180
|
+
t.preventDefault();
|
|
181
|
+
let r = Q(e, n, {
|
|
182
182
|
reason: "keyboard",
|
|
183
|
-
event:
|
|
183
|
+
event: t
|
|
184
184
|
});
|
|
185
185
|
T && U(r.row, r.column);
|
|
186
|
-
}, s = (
|
|
187
|
-
|
|
188
|
-
let n = Z(
|
|
186
|
+
}, s = (e) => {
|
|
187
|
+
t.preventDefault();
|
|
188
|
+
let n = Z(e, K.current, {
|
|
189
189
|
reason: "keyboard",
|
|
190
|
-
event:
|
|
190
|
+
event: t
|
|
191
191
|
});
|
|
192
192
|
T && U(n.row, n.column);
|
|
193
|
-
}, c = 2 ** 53 - 1, l = () =>
|
|
194
|
-
switch (
|
|
193
|
+
}, c = 2 ** 53 - 1, l = () => e(t.currentTarget) ? -1 : 1;
|
|
194
|
+
switch (t.key) {
|
|
195
195
|
case "ArrowRight": return o(r, i + l());
|
|
196
196
|
case "ArrowLeft": return o(r, i - l());
|
|
197
197
|
case "ArrowDown": return s(r + 1);
|
|
198
198
|
case "ArrowUp": return s(r - 1);
|
|
199
|
-
case "Home": return
|
|
200
|
-
case "End": return
|
|
199
|
+
case "Home": return t.ctrlKey || t.metaKey ? o(0, 0) : o(r, 0);
|
|
200
|
+
case "End": return t.ctrlKey || t.metaKey ? o(n - 1, c) : o(r, c);
|
|
201
201
|
case "PageDown": return s(r + a);
|
|
202
202
|
case "PageUp": return s(r - a);
|
|
203
203
|
}
|
|
204
204
|
}, [
|
|
205
205
|
G,
|
|
206
|
-
|
|
206
|
+
n,
|
|
207
207
|
K,
|
|
208
208
|
U,
|
|
209
209
|
T,
|
|
@@ -216,51 +216,51 @@ function w(e) {
|
|
|
216
216
|
activeColumn: F,
|
|
217
217
|
setActiveIndex: O,
|
|
218
218
|
setActiveCell: Q,
|
|
219
|
-
onKeyDown: s((
|
|
220
|
-
if (
|
|
219
|
+
onKeyDown: s((t) => {
|
|
220
|
+
if (t.defaultPrevented) return;
|
|
221
221
|
if (A) {
|
|
222
|
-
$(
|
|
222
|
+
$(t);
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
|
-
let r = m !== "horizontal", i = m !== "vertical", a = B.current, s = o.isOpen(a,
|
|
226
|
-
|
|
225
|
+
let r = m !== "horizontal", i = m !== "vertical", a = B.current, s = o.isOpen(a, t.timeStamp), c = (e, n) => {
|
|
226
|
+
e !== -1 && e !== k && (t.preventDefault(), O(e, {
|
|
227
227
|
reason: n,
|
|
228
|
-
event:
|
|
229
|
-
}), T && V(
|
|
228
|
+
event: t
|
|
229
|
+
}), T && V(e));
|
|
230
230
|
};
|
|
231
|
-
if (i && (
|
|
232
|
-
let r =
|
|
233
|
-
c(S(k, r ? 1 : -1,
|
|
231
|
+
if (i && (t.key === "ArrowRight" || t.key === "ArrowLeft")) {
|
|
232
|
+
let r = t.key === "ArrowRight" !== e(t.currentTarget);
|
|
233
|
+
c(S(k, r ? 1 : -1, n, h, y), "keyboard");
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
|
-
if (
|
|
237
|
-
c(S(k, 1,
|
|
236
|
+
if (t.key === "ArrowDown" && r) {
|
|
237
|
+
c(S(k, 1, n, h, y), "keyboard");
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
|
-
if (
|
|
241
|
-
c(S(k, -1,
|
|
240
|
+
if (t.key === "ArrowUp" && r) {
|
|
241
|
+
c(S(k, -1, n, h, y), "keyboard");
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
if (
|
|
245
|
-
c(C(1,
|
|
244
|
+
if (t.key === "Home") {
|
|
245
|
+
c(C(1, n, y), "keyboard");
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
if (
|
|
249
|
-
c(C(-1,
|
|
248
|
+
if (t.key === "End") {
|
|
249
|
+
c(C(-1, n, y), "keyboard");
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
|
-
if (
|
|
252
|
+
if (t.key === "Enter" || t.key === " " && !(s && w)) {
|
|
253
253
|
if (!E || k === -1) return;
|
|
254
|
-
|
|
254
|
+
t.preventDefault(), E(k, t);
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
|
-
if (w && o.isPrintable(
|
|
258
|
-
let
|
|
259
|
-
c(o.target(
|
|
257
|
+
if (w && o.isPrintable(t)) {
|
|
258
|
+
let e = o.push(a, t.key, t.timeStamp);
|
|
259
|
+
c(o.target(e, k, n, w, y), "typeahead");
|
|
260
260
|
}
|
|
261
261
|
}, [
|
|
262
262
|
k,
|
|
263
|
-
|
|
263
|
+
n,
|
|
264
264
|
V,
|
|
265
265
|
T,
|
|
266
266
|
y,
|