@box-kite/react 2.2.15 → 2.2.16
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 +1 -1
- package/.claude/skills/box-kite/SKILL.md +1 -1
- package/.claude/skills/box-kite/references/styling.md +1 -1
- package/.cursor/rules/box-kite.mdc +1 -1
- package/AGENTS.md +1 -1
- package/BOX_AI_CONTEXT.md +16 -0
- package/BOX_KITE_AI_CONTEXT.md +16 -0
- package/behavior.cjs +1 -1
- package/behavior.mjs +16 -16
- package/catalog.cjs +1 -1
- package/catalog.mjs +1 -1
- package/client.cjs +1 -1
- package/client.mjs +10 -10
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +95 -91
- package/components/calendar.cjs +1 -1
- package/components/calendar.mjs +212 -210
- package/components/chart.cjs +1 -1
- package/components/chart.d.ts +8 -3
- package/components/chart.mjs +70 -65
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +187 -186
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.d.ts +1 -44
- package/components/dashboard.mjs +202 -201
- package/components/dataGrid/components/dataGridListLayout.d.ts +1 -1
- package/components/dataGrid/contracts/dataGridContract.d.ts +1 -1
- package/components/dataGrid/models/gridModel.d.ts +1 -1
- package/components/dataGrid.cjs +2 -2
- package/components/dataGrid.mjs +10 -10
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +96 -96
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +177 -179
- package/components/dialog.cjs +1 -1
- package/components/dialog.d.ts +2 -64
- package/components/dialog.mjs +130 -126
- package/components/form.cjs +1 -1
- package/components/form.d.ts +4 -3
- package/components/form.mjs +25 -22
- package/components/menu.cjs +1 -1
- package/components/menu.d.ts +2 -73
- package/components/menu.mjs +222 -218
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +43 -43
- package/components/popover.cjs +1 -1
- package/components/popover.d.ts +1 -41
- package/components/popover.mjs +55 -51
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +59 -55
- package/components/slider.cjs +1 -1
- package/components/slider.d.ts +1 -55
- package/components/slider.mjs +92 -90
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +149 -148
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +100 -100
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +135 -132
- package/components/toaster.cjs +1 -1
- package/components/toaster.d.ts +1 -37
- package/components/toaster.mjs +130 -128
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +1 -34
- package/components/tooltip.mjs +73 -69
- package/components/virtualList.cjs +1 -1
- package/components/virtualList.mjs +88 -87
- package/interactionListening.cjs +1 -1
- package/interactionListening.mjs +3 -3
- package/layer.cjs +1 -1
- package/layer.mjs +1 -1
- package/package.json +31 -30
- package/placement.cjs +1 -1
- package/placement.mjs +1 -1
- package/platform.cjs +1 -1
- package/platform.mjs +17 -14
- package/react/componentsContext.d.ts +1 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +1 -1
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/utils/chart/chartUtils.d.ts +3 -2
- package/utils/dashboard/dashboardUtils.d.ts +1 -1
- package/utils/dom/domUtils.d.ts +6 -0
- package/create/src/agents.d.ts +0 -22
- package/create/src/agents.test.d.ts +0 -1
- package/create/src/index.d.ts +0 -1
- package/create/src/options.d.ts +0 -31
- package/create/src/options.test.d.ts +0 -1
- package/create/src/packageManager.d.ts +0 -5
- package/create/src/project.d.ts +0 -27
- package/create/src/project.test.d.ts +0 -1
- package/create/templates/ts/designs/azure.d.ts +0 -5
- package/create/templates/ts/designs/ember.d.ts +0 -5
- package/create/templates/ts/designs/mono.d.ts +0 -5
- package/create/templates/ts/src/App.d.ts +0 -2
- package/create/templates/ts/src/design.d.ts +0 -5
- package/create/templates/ts/src/main.d.ts +0 -0
- package/mcp/src/data.d.ts +0 -90
- package/mcp/src/data.test.d.ts +0 -1
- package/mcp/src/engine.d.ts +0 -23
- package/mcp/src/index.d.ts +0 -1
- package/mcp/src/search.d.ts +0 -38
- package/mcp/src/search.test.d.ts +0 -1
- package/mcp/src/server.d.ts +0 -18
- package/mcp/src/server.test.d.ts +0 -1
- package/mcp/src/styles.d.ts +0 -27
- package/mcp/src/styles.test.d.ts +0 -1
- package/mcp/src/tools.d.ts +0 -18
- package/mcp/src/vocabulary.d.ts +0 -41
- package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +0 -24
- package/registry/blocks/dashboard-shell/dashboard-stats.d.ts +0 -13
- package/registry/blocks/data-grid/invoice-rows.d.ts +0 -15
- package/registry/blocks/data-grid/invoices-grid.d.ts +0 -1
- package/registry/blocks/settings-form/settings-form.d.ts +0 -17
- package/registry/designs/store/address-form.d.ts +0 -11
- package/registry/designs/store/cart-items.d.ts +0 -10
- package/registry/designs/store/cart-page.d.ts +0 -4
- package/registry/designs/store/checkout-page.d.ts +0 -7
- package/registry/designs/store/credit-card-form.d.ts +0 -10
- package/registry/designs/store/form-field.d.ts +0 -19
- package/registry/designs/store/order-summary.d.ts +0 -18
- package/registry/designs/store/product-art.d.ts +0 -26
- package/registry/designs/store/product-card.d.ts +0 -11
- package/registry/designs/store/product-gallery.d.ts +0 -11
- package/registry/designs/store/product-grid.d.ts +0 -10
- package/registry/designs/store/product-page.d.ts +0 -5
- package/registry/designs/store/quantity-stepper.d.ts +0 -13
- package/registry/designs/store/shipping-method.d.ts +0 -14
- package/registry/designs/store/store-data.d.ts +0 -53
- package/registry/designs/store/store-design.d.ts +0 -63
- package/registry/designs/store/store-shell.d.ts +0 -12
- package/registry/designs/store/storefront-page.d.ts +0 -4
- package/registry/designs/store/variant-picker.d.ts +0 -15
- package/supabase/functions/collect/index.d.ts +0 -30
- package/supabase/functions/collect/index.test.d.ts +0 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { f as e } from "../react-shared.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import l from "./
|
|
9
|
-
import
|
|
10
|
-
import d from "
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
3
|
+
import { l as t } from "../platform.mjs";
|
|
4
|
+
import { n } from "../effects.mjs";
|
|
5
|
+
import { useBoxElement as r } from "../box.mjs";
|
|
6
|
+
import { a as i, o as a } from "../behavior.mjs";
|
|
7
|
+
import { i as o, r as s } from "../reporting.mjs";
|
|
8
|
+
import { Circle as c, Svg as l } from "./svg.mjs";
|
|
9
|
+
import u from "./visuallyHidden.mjs";
|
|
10
|
+
import { t as d } from "../scrolling.mjs";
|
|
11
|
+
import f from "./list.mjs";
|
|
12
|
+
import { createContext as p, useCallback as ee, useContext as m, useEffect as h, useId as te, useMemo as g, useRef as _, useState as v } from "react";
|
|
13
|
+
import { jsx as y, jsxs as ne } from "react/jsx-runtime";
|
|
13
14
|
//#region src/utils/sortable/sortableUtils.ts
|
|
14
|
-
var
|
|
15
|
+
var b;
|
|
15
16
|
(function(e) {
|
|
16
17
|
e.SLOP = 4;
|
|
17
18
|
function t(e) {
|
|
@@ -54,31 +55,31 @@ var y;
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
e.keyTarget = o;
|
|
57
|
-
})(
|
|
58
|
-
var
|
|
59
|
-
function T(e) {
|
|
60
|
-
return e ? Array.from(e.querySelectorAll(w)) : [];
|
|
61
|
-
}
|
|
58
|
+
})(b ||= {});
|
|
59
|
+
var x = b, S = p(null), C = p(null), w = 48, re = 12, T = ":scope > [data-sortable-value]";
|
|
62
60
|
function E(e) {
|
|
63
|
-
return
|
|
61
|
+
return e ? Array.from(e.querySelectorAll(T)) : [];
|
|
64
62
|
}
|
|
65
63
|
function D(e) {
|
|
66
|
-
return
|
|
64
|
+
return E(e).map((e) => e.dataset.sortableValue ?? "");
|
|
65
|
+
}
|
|
66
|
+
function O(e) {
|
|
67
|
+
return new Map(E(e).map((e) => [e.dataset.sortableValue ?? "", e.getBoundingClientRect().top]));
|
|
67
68
|
}
|
|
68
69
|
function ie(e, t) {
|
|
69
70
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
let { onOrderChange:
|
|
73
|
-
|
|
74
|
-
}, [
|
|
75
|
-
|
|
72
|
+
function k(e, r) {
|
|
73
|
+
let { onOrderChange: c, onOrderCommit: l, children: p, variant: m, props: b, ...C } = e, T = _(null), k = _(null), A = _(null), [j, M] = v(null), [N, P] = v(0), [F, I] = v(!1), [ae, L] = v(""), R = `${te()}-sortable`, z = a(j), B = s(c, "sortableList", "orderChange"), V = s(l, "sortableList", "orderCommit"), H = o("sortableList"), oe = ee((e) => {
|
|
74
|
+
T.current = e, t(r, e);
|
|
75
|
+
}, [r]), U = (e, t) => `position ${e.indexOf(t) + 1} of ${e.length}`, W = (e, t) => {
|
|
76
|
+
A.current = O(T.current), B(e, t);
|
|
76
77
|
};
|
|
77
|
-
|
|
78
|
-
let e =
|
|
78
|
+
n(() => {
|
|
79
|
+
let e = A.current;
|
|
79
80
|
if (e) {
|
|
80
|
-
|
|
81
|
-
for (let t of T
|
|
81
|
+
A.current = null;
|
|
82
|
+
for (let t of E(T.current)) {
|
|
82
83
|
let n = e.get(t.dataset.sortableValue ?? ""), r = n === void 0 ? 0 : n - t.getBoundingClientRect().top, i = parseFloat(getComputedStyle(t).transitionDuration) * 1e3 || 0;
|
|
83
84
|
Math.abs(r) < 1 || i === 0 || typeof t.animate != "function" || t.animate([{ translate: `0 ${r}px` }, { translate: "0 0" }], {
|
|
84
85
|
duration: i,
|
|
@@ -86,25 +87,25 @@ function O(e, n) {
|
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
}),
|
|
90
|
-
if (!
|
|
91
|
-
let e = requestAnimationFrame(() =>
|
|
90
|
+
}), h(() => {
|
|
91
|
+
if (!F) return;
|
|
92
|
+
let e = requestAnimationFrame(() => I(!1));
|
|
92
93
|
return () => cancelAnimationFrame(e);
|
|
93
|
-
}, [
|
|
94
|
-
if (!
|
|
95
|
-
let e = T
|
|
94
|
+
}, [F]), n(() => {
|
|
95
|
+
if (!j || j.pointer) return;
|
|
96
|
+
let e = E(T.current).find((e) => e.dataset.sortableValue === j.value)?.querySelector("[data-sortable-handle]");
|
|
96
97
|
e && e.ownerDocument.activeElement !== e && e.focus();
|
|
97
98
|
});
|
|
98
|
-
let
|
|
99
|
-
let n = e.pointer, r =
|
|
99
|
+
let G = i((e, t) => {
|
|
100
|
+
let n = e.pointer, r = T.current;
|
|
100
101
|
if (!n || !r) return;
|
|
101
102
|
n.lastY = t;
|
|
102
103
|
let i = t - r.getBoundingClientRect().top - (n.startY - n.startTop), a = n.order.indexOf(e.value);
|
|
103
|
-
n.to =
|
|
104
|
+
n.to = x.targetIndex(n.slots, a, i), P(i);
|
|
104
105
|
}), se = (e, t) => {
|
|
105
|
-
let n =
|
|
106
|
+
let n = T.current;
|
|
106
107
|
if (!n) return;
|
|
107
|
-
let r = n.getBoundingClientRect().top, i =
|
|
108
|
+
let r = n.getBoundingClientRect().top, i = E(n), a = i.map((e) => e.dataset.sortableValue ?? ""), o = i.map((e) => {
|
|
108
109
|
let t = e.getBoundingClientRect();
|
|
109
110
|
return {
|
|
110
111
|
top: t.top - r,
|
|
@@ -124,202 +125,202 @@ function O(e, n) {
|
|
|
124
125
|
to: a.indexOf(t.value)
|
|
125
126
|
}
|
|
126
127
|
};
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
if (!
|
|
131
|
-
let e =
|
|
132
|
-
let r =
|
|
128
|
+
M(s), G(s, e.clientY);
|
|
129
|
+
}, K = j?.pointer !== void 0;
|
|
130
|
+
h(() => {
|
|
131
|
+
if (!K) return;
|
|
132
|
+
let e = d(T.current), t = 0, n = () => {
|
|
133
|
+
let r = z.current;
|
|
133
134
|
if (r?.pointer) {
|
|
134
|
-
let t = r.pointer.lastY, n = e ? e.getBoundingClientRect().top : 0, i = e ? e.getBoundingClientRect().bottom : window.innerHeight, a = t < n +
|
|
135
|
-
a && ((e ?? window).scrollBy(0, a),
|
|
135
|
+
let t = r.pointer.lastY, n = e ? e.getBoundingClientRect().top : 0, i = e ? e.getBoundingClientRect().bottom : window.innerHeight, a = t < n + w ? -12 : t > i - w ? re : 0;
|
|
136
|
+
a && ((e ?? window).scrollBy(0, a), G(r, t));
|
|
136
137
|
}
|
|
137
138
|
t = requestAnimationFrame(n);
|
|
138
139
|
};
|
|
139
140
|
return t = requestAnimationFrame(n), () => cancelAnimationFrame(t);
|
|
140
141
|
}, [
|
|
142
|
+
K,
|
|
141
143
|
G,
|
|
142
|
-
|
|
143
|
-
R
|
|
144
|
+
z
|
|
144
145
|
]);
|
|
145
|
-
let
|
|
146
|
-
let r =
|
|
147
|
-
|
|
146
|
+
let q = (e, t, n) => {
|
|
147
|
+
let r = D(T.current);
|
|
148
|
+
M({
|
|
148
149
|
value: e,
|
|
149
150
|
name: t,
|
|
150
151
|
origin: r
|
|
151
|
-
}),
|
|
152
|
+
}), H("grab", e, {
|
|
152
153
|
reason: n.type === "keydown" ? "keyboard" : "pointer",
|
|
153
154
|
event: n,
|
|
154
155
|
from: r.indexOf(e)
|
|
155
|
-
}),
|
|
156
|
-
},
|
|
156
|
+
}), L(`${t} picked up at ${U(r, e)}. Use the arrow keys to move it, Enter to drop it.`), n.preventDefault();
|
|
157
|
+
}, J = (e, t, n = D(T.current)) => {
|
|
157
158
|
let r = n.indexOf(e.value);
|
|
158
|
-
|
|
159
|
+
M(null), V(n, {
|
|
159
160
|
reason: "keyboard",
|
|
160
161
|
event: t,
|
|
161
162
|
value: e.value,
|
|
162
163
|
from: e.origin.indexOf(e.value),
|
|
163
164
|
to: r
|
|
164
|
-
}),
|
|
165
|
-
},
|
|
166
|
-
let n =
|
|
167
|
-
|
|
165
|
+
}), L(`${e.name} dropped at ${U(n, e.value)}.`);
|
|
166
|
+
}, Y = i((e, t) => {
|
|
167
|
+
let n = D(T.current);
|
|
168
|
+
H("grabCancel", e.value, {
|
|
168
169
|
reason: t.type === "keydown" ? "escape" : t.type === "blur" ? "blur" : "pointercancel",
|
|
169
170
|
event: t
|
|
170
|
-
}),
|
|
171
|
+
}), M(null), P(0), ie(n, e.origin) || W(e.origin, {
|
|
171
172
|
reason: e.pointer ? "pointer" : "keyboard",
|
|
172
173
|
event: t,
|
|
173
174
|
value: e.value,
|
|
174
175
|
from: n.indexOf(e.value),
|
|
175
176
|
to: e.origin.indexOf(e.value)
|
|
176
|
-
}),
|
|
177
|
-
}),
|
|
178
|
-
let r =
|
|
177
|
+
}), L(`${e.name} put back at ${U(e.origin, e.value)}.`);
|
|
178
|
+
}), X = (e, t, n) => {
|
|
179
|
+
let r = D(T.current), i = r.indexOf(e.value);
|
|
179
180
|
if (i < 0 || t === i) return r;
|
|
180
|
-
let a =
|
|
181
|
-
return
|
|
181
|
+
let a = x.move(r, i, t);
|
|
182
|
+
return W(a, {
|
|
182
183
|
reason: "keyboard",
|
|
183
184
|
event: n,
|
|
184
185
|
value: e.value,
|
|
185
186
|
from: i,
|
|
186
187
|
to: t
|
|
187
|
-
}),
|
|
188
|
-
},
|
|
189
|
-
e.button !== 0 || e.defaultPrevented || (e.preventDefault(), e.currentTarget.focus(), e.currentTarget.setPointerCapture?.(e.pointerId),
|
|
188
|
+
}), L(`${e.name}, ${U(a, e.value)}.`), a;
|
|
189
|
+
}, Z = i((e, t, n) => {
|
|
190
|
+
e.button !== 0 || e.defaultPrevented || (e.preventDefault(), e.currentTarget.focus(), e.currentTarget.setPointerCapture?.(e.pointerId), k.current = {
|
|
190
191
|
id: e.pointerId,
|
|
191
192
|
x: e.clientX,
|
|
192
193
|
y: e.clientY,
|
|
193
194
|
value: t,
|
|
194
195
|
name: n
|
|
195
196
|
});
|
|
196
|
-
}),
|
|
197
|
-
let t =
|
|
197
|
+
}), Q = i((e) => {
|
|
198
|
+
let t = z.current;
|
|
198
199
|
if (t?.pointer && t.pointer.id === e.pointerId) {
|
|
199
|
-
|
|
200
|
+
G(t, e.clientY);
|
|
200
201
|
return;
|
|
201
202
|
}
|
|
202
|
-
let n =
|
|
203
|
-
!n || n.id !== e.pointerId || Math.hypot(e.clientX - n.x, e.clientY - n.y) <
|
|
204
|
-
}),
|
|
205
|
-
let t =
|
|
206
|
-
|
|
207
|
-
let n =
|
|
203
|
+
let n = k.current;
|
|
204
|
+
!n || n.id !== e.pointerId || Math.hypot(e.clientX - n.x, e.clientY - n.y) < x.SLOP || (k.current = null, se(e, n));
|
|
205
|
+
}), $ = i((e) => {
|
|
206
|
+
let t = k.current;
|
|
207
|
+
k.current = null;
|
|
208
|
+
let n = z.current;
|
|
208
209
|
if (t && t.id === e.pointerId && e.type === "pointerup") {
|
|
209
|
-
n && !n.pointer ? n.value === t.value &&
|
|
210
|
+
n && !n.pointer ? n.value === t.value && J(n, e) : q(t.value, t.name, e);
|
|
210
211
|
return;
|
|
211
212
|
}
|
|
212
213
|
let r = n?.pointer;
|
|
213
214
|
if (!n || !r || r.id !== e.pointerId) return;
|
|
214
|
-
if (e.currentTarget.releasePointerCapture?.(e.pointerId),
|
|
215
|
-
|
|
215
|
+
if (e.currentTarget.releasePointerCapture?.(e.pointerId), I(!0), e.type === "pointercancel") {
|
|
216
|
+
A.current = O(T.current), Y(n, e);
|
|
216
217
|
return;
|
|
217
218
|
}
|
|
218
|
-
let i = r.order.indexOf(n.value), a =
|
|
219
|
+
let i = r.order.indexOf(n.value), a = x.move(r.order, i, r.to), o = {
|
|
219
220
|
reason: "pointer",
|
|
220
221
|
event: e,
|
|
221
222
|
value: n.value,
|
|
222
223
|
from: i,
|
|
223
224
|
to: r.to
|
|
224
225
|
};
|
|
225
|
-
|
|
226
|
-
}),
|
|
226
|
+
A.current = O(T.current), M(null), P(0), r.to !== i && B(a, o), V(a, o), L(`${n.name} dropped at ${U(a, n.value)}.`);
|
|
227
|
+
}), ce = i((e, t, n) => {
|
|
227
228
|
if (e.defaultPrevented) return;
|
|
228
|
-
let r =
|
|
229
|
+
let r = z.current, i = r && r.value === t && !r.pointer ? r : void 0;
|
|
229
230
|
if (!i) {
|
|
230
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
231
|
+
(e.key === "Enter" || e.key === " ") && q(t, n, e);
|
|
231
232
|
return;
|
|
232
233
|
}
|
|
233
234
|
if (e.key === "Escape") {
|
|
234
|
-
e.preventDefault(),
|
|
235
|
+
e.preventDefault(), Y(i, e);
|
|
235
236
|
return;
|
|
236
237
|
}
|
|
237
238
|
if (e.key === "Enter" || e.key === " ") {
|
|
238
|
-
e.preventDefault(),
|
|
239
|
+
e.preventDefault(), J(i, e);
|
|
239
240
|
return;
|
|
240
241
|
}
|
|
241
|
-
let a =
|
|
242
|
-
o !== null && (e.preventDefault(),
|
|
243
|
-
}),
|
|
242
|
+
let a = D(T.current), o = x.keyTarget(e.key, a.indexOf(t), a.length);
|
|
243
|
+
o !== null && (e.preventDefault(), X(i, o, e));
|
|
244
|
+
}), le = i((e) => {
|
|
244
245
|
setTimeout(() => {
|
|
245
|
-
let t =
|
|
246
|
-
!t || t.pointer || t.value !== e || !n || n.ownerDocument.activeElement?.closest("[data-sortable-value]")?.getAttribute("data-sortable-value") !== e &&
|
|
246
|
+
let t = z.current, n = T.current;
|
|
247
|
+
!t || t.pointer || t.value !== e || !n || n.ownerDocument.activeElement?.closest("[data-sortable-value]")?.getAttribute("data-sortable-value") !== e && Y(t, new Event("blur"));
|
|
247
248
|
});
|
|
248
|
-
}),
|
|
249
|
-
let t =
|
|
249
|
+
}), ue = (e) => {
|
|
250
|
+
let t = z.current;
|
|
250
251
|
if (!t || t.pointer || !(e.target instanceof Element)) return null;
|
|
251
252
|
let n = e.target.closest("[data-sortable-value]");
|
|
252
|
-
return n && n.parentElement ===
|
|
253
|
-
}, ue = (e) => {
|
|
254
|
-
le(e) && e.preventDefault();
|
|
253
|
+
return n && n.parentElement === T.current && n.dataset.sortableValue !== t.value ? n : null;
|
|
255
254
|
}, de = (e) => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
255
|
+
ue(e) && e.preventDefault();
|
|
256
|
+
}, fe = (e) => {
|
|
257
|
+
let t = ue(e), n = z.current;
|
|
258
|
+
!t || !n || (e.preventDefault(), e.stopPropagation(), J(n, e, X(n, D(T.current).indexOf(t.dataset.sortableValue ?? ""), e)));
|
|
259
|
+
}, pe = g(() => {
|
|
260
|
+
let e = j?.pointer, t = e ? e.order.indexOf(j.value) : -1;
|
|
260
261
|
return {
|
|
261
|
-
heldOf: (e) =>
|
|
262
|
+
heldOf: (e) => j && j.value === e ? j.pointer ? "pointer" : "keyboard" : void 0,
|
|
262
263
|
translateOf: (n) => {
|
|
263
264
|
if (!e) return;
|
|
264
|
-
if (n ===
|
|
265
|
-
let r =
|
|
265
|
+
if (n === j.value) return `0 ${Math.round(N)}px`;
|
|
266
|
+
let r = x.shiftOf(e.slots, t, e.to, e.order.indexOf(n));
|
|
266
267
|
return r ? `0 ${r}px` : void 0;
|
|
267
268
|
},
|
|
268
|
-
settling:
|
|
269
|
-
instructionsId:
|
|
269
|
+
settling: F,
|
|
270
|
+
instructionsId: R,
|
|
270
271
|
handleProps: (e, t) => ({
|
|
271
272
|
type: "button",
|
|
272
273
|
"data-sortable-handle": "",
|
|
273
274
|
"aria-label": `Move ${t}`,
|
|
274
|
-
"aria-pressed":
|
|
275
|
-
"aria-describedby":
|
|
276
|
-
onPointerDown: (n) =>
|
|
277
|
-
onPointerMove:
|
|
278
|
-
onPointerUp:
|
|
279
|
-
onPointerCancel:
|
|
280
|
-
onKeyDown: (n) =>
|
|
281
|
-
onBlur: () =>
|
|
275
|
+
"aria-pressed": j?.value === e,
|
|
276
|
+
"aria-describedby": R,
|
|
277
|
+
onPointerDown: (n) => Z(n, e, t),
|
|
278
|
+
onPointerMove: Q,
|
|
279
|
+
onPointerUp: $,
|
|
280
|
+
onPointerCancel: $,
|
|
281
|
+
onKeyDown: (n) => ce(n, e, t),
|
|
282
|
+
onBlur: () => le(e)
|
|
282
283
|
})
|
|
283
284
|
};
|
|
284
285
|
}, [
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
X,
|
|
286
|
+
j,
|
|
287
|
+
N,
|
|
288
|
+
F,
|
|
289
|
+
R,
|
|
290
290
|
Z,
|
|
291
291
|
Q,
|
|
292
292
|
$,
|
|
293
|
-
ce
|
|
293
|
+
ce,
|
|
294
|
+
le
|
|
294
295
|
]);
|
|
295
|
-
return /* @__PURE__ */ ne(
|
|
296
|
-
value:
|
|
296
|
+
return /* @__PURE__ */ ne(S.Provider, {
|
|
297
|
+
value: pe,
|
|
297
298
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ y(f, {
|
|
299
300
|
ref: oe,
|
|
300
|
-
...
|
|
301
|
-
variant:
|
|
302
|
-
userSelect:
|
|
301
|
+
...C,
|
|
302
|
+
variant: m,
|
|
303
|
+
userSelect: K ? "none" : void 0,
|
|
303
304
|
props: {
|
|
304
|
-
...
|
|
305
|
-
onMouseDownCapture:
|
|
306
|
-
onClickCapture:
|
|
305
|
+
...b,
|
|
306
|
+
onMouseDownCapture: de,
|
|
307
|
+
onClickCapture: fe
|
|
307
308
|
},
|
|
308
|
-
children:
|
|
309
|
+
children: p
|
|
309
310
|
}),
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ y(u, {
|
|
311
312
|
props: { role: "status" },
|
|
312
313
|
children: ae
|
|
313
314
|
}),
|
|
314
|
-
/* @__PURE__ */
|
|
315
|
-
id:
|
|
315
|
+
/* @__PURE__ */ y(u, {
|
|
316
|
+
id: R,
|
|
316
317
|
children: "Press Enter or Space to pick the item up, the arrow keys to move it, Enter to drop it and Escape to put it back."
|
|
317
318
|
})
|
|
318
319
|
]
|
|
319
320
|
});
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
-
let { value: n, label: r, disabled: i = !1, variant: a, props: o, ...s } = e, c =
|
|
322
|
+
function A(e, t) {
|
|
323
|
+
let { value: n, label: r, disabled: i = !1, variant: a, props: o, ...s } = e, c = m(S), l = c?.heldOf(n), u = c?.translateOf(n), d = g(() => ({
|
|
323
324
|
value: n,
|
|
324
325
|
name: r ?? n,
|
|
325
326
|
disabled: i
|
|
@@ -328,9 +329,9 @@ function k(e, t) {
|
|
|
328
329
|
r,
|
|
329
330
|
i
|
|
330
331
|
]);
|
|
331
|
-
return /* @__PURE__ */
|
|
332
|
-
value:
|
|
333
|
-
children: /* @__PURE__ */
|
|
332
|
+
return /* @__PURE__ */ y(C.Provider, {
|
|
333
|
+
value: d,
|
|
334
|
+
children: /* @__PURE__ */ y(f.Item, {
|
|
334
335
|
ref: t,
|
|
335
336
|
...s,
|
|
336
337
|
variant: [a, {
|
|
@@ -346,8 +347,8 @@ function k(e, t) {
|
|
|
346
347
|
})
|
|
347
348
|
});
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
-
return /* @__PURE__ */
|
|
350
|
+
function j() {
|
|
351
|
+
return /* @__PURE__ */ y(l, {
|
|
351
352
|
viewBox: "0 0 16 16",
|
|
352
353
|
width: "1rem",
|
|
353
354
|
fill: "currentColor",
|
|
@@ -355,16 +356,16 @@ function A() {
|
|
|
355
356
|
3,
|
|
356
357
|
8,
|
|
357
358
|
13
|
|
358
|
-
].map((t) => /* @__PURE__ */
|
|
359
|
+
].map((t) => /* @__PURE__ */ y(c, {
|
|
359
360
|
cx: e,
|
|
360
361
|
cy: t,
|
|
361
362
|
r: 1.4
|
|
362
363
|
}, `${e}-${t}`)))
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
|
-
function
|
|
366
|
-
let { children:
|
|
367
|
-
return
|
|
366
|
+
function M(e, t) {
|
|
367
|
+
let { children: n, variant: i, props: a, ...o } = e, s = m(S), c = m(C), l = c && s ? s.handleProps(c.value, c.name) : {};
|
|
368
|
+
return r({
|
|
368
369
|
tag: "button",
|
|
369
370
|
component: "sortableList.handle",
|
|
370
371
|
display: "flex",
|
|
@@ -383,10 +384,10 @@ function j(e, t) {
|
|
|
383
384
|
...c?.disabled ? { disabled: !0 } : {},
|
|
384
385
|
...a
|
|
385
386
|
},
|
|
386
|
-
children:
|
|
387
|
+
children: n ?? /* @__PURE__ */ y(j, {})
|
|
387
388
|
}, t);
|
|
388
389
|
}
|
|
389
|
-
var
|
|
390
|
-
|
|
390
|
+
var N = e(k, "SortableList");
|
|
391
|
+
N.Item = e(A, "SortableList.Item"), N.Handle = e(M, "SortableList.Handle");
|
|
391
392
|
//#endregion
|
|
392
|
-
export {
|
|
393
|
+
export { x as SortableUtils, N as default };
|
package/components/swipeItem.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs"),t=require("../platform.cjs"),n=require("../effects.cjs"),r=require("../box.cjs"),i=require("../behavior.cjs"),a=require("../reporting.cjs"),o=require("../motion.cjs"),s=require("./list.cjs");let c=require("react"),l=require("react/jsx-runtime");var u;(function(e){let t=e.SLOP=8,n=e.FLICK=.4,r=e.FULL_RATIO=.6;function i(e,n){return Math.max(Math.abs(e),Math.abs(n))<t?null:Math.abs(e)>Math.abs(n)?`swipe`:`scroll`}e.intent=i;function a(e,t){return(1-1/(e*.55/t+1))*t}function o(e,t,n,r,i){let o=e+t,s=o<0?-1:1,c=o<0?n.end:n.start,l=Math.abs(o);return c===0?0:l<=c?o:i?s*Math.min(l,r):s*(c+a(l-c,Math.max(r,1)))}e.offsetFor=o;function s(e,n,i,a){if(!a||e===0)return null;let o=e>0?`start`:`end`,s=n[o];return s===0?null:Math.abs(e)>=Math.max(s+t*4,i*r)?o:null}e.armed=s;function c(e,t,r,i,a){let o=s(e,r,i,a);if(o)return{open:null,full:o};if(e===0)return{open:null,full:null};let c=e>0?`start`:`end`,l=r[c];return l===0?{open:null,full:null}:Math.abs(t)>=n?{open:Math.sign(t)===Math.sign(e)?c:null,full:null}:{open:Math.abs(e)>=l/2?c:null,full:null}}e.settle=c;let l=e.VELOCITY_WINDOW=100;function u(e,t){return[...e.filter(e=>t.t-e.t<=l),t]}e.track=u;function d(e){let t=e[0],n=e[e.length-1];return!t||!n||n.t-t.t<16?0:(n.x-t.x)/(n.t-t.t)}e.velocity=d;function f(e,t){return e===`start`?t.start:e===`end`?-t.end:0}e.restOffset=f})(u||={});var d=u,f=(0,c.createContext)(null),p={start:0,end:0};function m(e,u){let{size:m=`md`,wrap:h=!1,selected:g=!1,chevron:_=!1,startActions:v,endActions:y,fullSwipe:b=!1,open:ne,defaultOpen:x=null,onOpenChange:S,variant:C,children:w,props:T,...re}=e,E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=(0,c.useRef)(null),k=(0,c.useRef)(null),A=(0,c.useRef)(!1),[j,M]=a.a({value:ne,defaultValue:x,onChange:S,interaction:{component:`swipeItem`,type:`openChange`}}),[N,P]=(0,c.useState)(null),[F,I]=(0,c.useState)(null),[L,ie]=(0,c.useState)({trays:p,width:0,rtl:!1}),R=i.o(L),z=(0,c.useCallback)(e=>{E.current=e,
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs"),t=require("../platform.cjs"),n=require("../effects.cjs"),r=require("../box.cjs"),i=require("../behavior.cjs"),a=require("../reporting.cjs"),o=require("../motion.cjs"),s=require("./list.cjs");let c=require("react"),l=require("react/jsx-runtime");var u;(function(e){let t=e.SLOP=8,n=e.FLICK=.4,r=e.FULL_RATIO=.6;function i(e,n){return Math.max(Math.abs(e),Math.abs(n))<t?null:Math.abs(e)>Math.abs(n)?`swipe`:`scroll`}e.intent=i;function a(e,t){return(1-1/(e*.55/t+1))*t}function o(e,t,n,r,i){let o=e+t,s=o<0?-1:1,c=o<0?n.end:n.start,l=Math.abs(o);return c===0?0:l<=c?o:i?s*Math.min(l,r):s*(c+a(l-c,Math.max(r,1)))}e.offsetFor=o;function s(e,n,i,a){if(!a||e===0)return null;let o=e>0?`start`:`end`,s=n[o];return s===0?null:Math.abs(e)>=Math.max(s+t*4,i*r)?o:null}e.armed=s;function c(e,t,r,i,a){let o=s(e,r,i,a);if(o)return{open:null,full:o};if(e===0)return{open:null,full:null};let c=e>0?`start`:`end`,l=r[c];return l===0?{open:null,full:null}:Math.abs(t)>=n?{open:Math.sign(t)===Math.sign(e)?c:null,full:null}:{open:Math.abs(e)>=l/2?c:null,full:null}}e.settle=c;let l=e.VELOCITY_WINDOW=100;function u(e,t){return[...e.filter(e=>t.t-e.t<=l),t]}e.track=u;function d(e){let t=e[0],n=e[e.length-1];return!t||!n||n.t-t.t<16?0:(n.x-t.x)/(n.t-t.t)}e.velocity=d;function f(e,t){return e===`start`?t.start:e===`end`?-t.end:0}e.restOffset=f})(u||={});var d=u,f=(0,c.createContext)(null),p={start:0,end:0};function m(e,u){let{size:m=`md`,wrap:h=!1,selected:g=!1,chevron:_=!1,startActions:v,endActions:y,fullSwipe:b=!1,open:ne,defaultOpen:x=null,onOpenChange:S,variant:C,children:w,props:T,...re}=e,E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=(0,c.useRef)(null),k=(0,c.useRef)(null),A=(0,c.useRef)(!1),[j,M]=a.a({value:ne,defaultValue:x,onChange:S,interaction:{component:`swipeItem`,type:`openChange`}}),[N,P]=(0,c.useState)(null),[F,I]=(0,c.useState)(null),[L,ie]=(0,c.useState)({trays:p,width:0,rtl:!1}),R=i.o(L),z=(0,c.useCallback)(e=>{E.current=e,t.l(u,e)},[u]),B=i.a(()=>{let e=e=>e?.firstElementChild?.offsetWidth??0,n={trays:{start:v?e(D.current):0,end:y?e(O.current):0},width:E.current?.offsetWidth??0,rtl:t.m(E.current)},r=R.current;return(r.trays.start!==n.trays.start||r.trays.end!==n.trays.end||r.width!==n.width||r.rtl!==n.rtl)&&ie(n),n});n.n(()=>{j&&B()},[j,B]);let V=i.a(e=>M(null,e)),H=a.i(`swipeItem`);(0,c.useEffect)(()=>{let e=t.t();if(!j||!e)return;let n=e=>{t.p(e,[E])||V({reason:`outside-pointer`,event:e})};return e.addEventListener(`pointerdown`,n,!0),()=>e.removeEventListener(`pointerdown`,n,!0)},[j,V]),(0,c.useEffect)(()=>{if(!F)return;let e=(F===`start`?D:O).current,t=E.current?.firstElementChild,n=t&&typeof getComputedStyle==`function`?o.n.activeDuration(getComputedStyle(t)):0,r=setTimeout(()=>{I(null),e?.querySelector(`[data-swipe-action]`)?.click()},n+o.n.SETTLE_FRAME);return()=>clearTimeout(r)},[F]);let U=i.a(e=>{if(A.current=!1,e.button!==0||F||!v&&!y)return;let{trays:t}=B();k.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,rest:d.restOffset(j,t),intent:null,samples:[{t:e.timeStamp,x:e.clientX}]}}),W=i.a(e=>{let n=k.current;if(!n||n.pointerId!==e.pointerId||n.intent===`scroll`)return;let r=e.clientX-n.x;if(!n.intent){if(n.intent=d.intent(r,e.clientY-n.y),n.intent!==`swipe`)return;e.currentTarget.setPointerCapture?.(e.pointerId),t.u(e.currentTarget)}let{trays:i,width:a,rtl:o}=R.current;n.samples=d.track(n.samples,{t:e.timeStamp,x:e.clientX}),P(d.offsetFor(n.rest,o?-r:r,i,a,b))}),G=i.a(e=>{let t=k.current;if(!t||t.pointerId!==e.pointerId||(k.current=null,t.intent!==`swipe`||N===null))return;e.currentTarget.releasePointerCapture?.(e.pointerId),A.current=!0;let{trays:n,width:r,rtl:i}=R.current,a=d.velocity(t.samples)*(i?-1:1),o=e.type===`pointercancel`?{open:j,full:null}:d.settle(N,a,n,r,b);P(null),o.full?(I(o.full),H(`fullSwipe`,o.full,{reason:`swipe`,event:e}),M(null,{reason:`swipe`,event:e})):M(o.open,{reason:`swipe`,event:e})}),K=i.a(e=>{if(A.current){A.current=!1,e.preventDefault(),e.stopPropagation();return}j&&(e.preventDefault(),e.stopPropagation(),V({reason:`outside-pointer`,event:e}))}),q=i.a(e=>{let t=D.current?.contains(e.target)?`start`:O.current?.contains(e.target)?`end`:null;t&&t!==j&&(B(),M(t,{reason:`focus`,event:e}))}),J=i.a(e=>{let t=e.relatedTarget;j&&(!t||!E.current?.contains(t))&&V({reason:`focus`,event:e})}),ae=i.a(e=>{e.key!==`Escape`||!j||e.defaultPrevented||(e.preventDefault(),V({reason:`escape`,event:e}),E.current?.querySelector(`[data-list-action]`)?.focus())}),{trays:Y,width:X,rtl:oe}=L,Z=N??(F?F===`start`?X:-X:d.restOffset(j,Y)),se=N===null?F:d.armed(N,Y,X,b),Q=N!==null,$=(e,t)=>(0,l.jsx)(te,{side:e,trayRef:e===`start`?D:O,width:e===`start`?Math.max(0,Z):Math.max(0,-Z),dragging:Q,children:(0,l.jsx)(f.Provider,{value:{side:e,armed:se===e,close:V},children:t})});return r.useBoxElement({tag:`li`,component:`list.item`,...s.i({...s.t,css:{...s.t.css,overflow:`clip`}},re),variant:[C,{selected:g}],props:{...T,onFocus:q,onBlur:J,onKeyDown:ae},children:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(ee,{size:m,wrap:h,dragging:Q,translate:Z===0?void 0:`${Math.round(oe?-Z:Z)}px`,handlers:{onPointerDown:U,onPointerMove:W,onPointerUp:G,onPointerCancel:G,onClickCapture:K,onDragStart:e=>e.preventDefault()},children:[w,_&&(0,l.jsx)(s.default.Chevron,{})]}),v?$(`start`,v):null,y?$(`end`,y):null]})},z)}function ee({size:e,wrap:t,dragging:n,translate:i,handlers:a,children:o}){return r.useBoxElement({component:`swipeItem.row`,...s.n,...s.r[e],...t?{flexWrap:`wrap`}:{},position:`relative`,css:{touchAction:`pan-y`},variant:{dragging:n},style:i?{translate:i}:void 0,props:a,children:o})}function te({side:e,trayRef:t,width:n,dragging:i,children:a}){let o=r.useBoxElement({display:`flex`,d:e===`end`?`row-reverse`:`row`,position:`absolute`,top:0,bottom:0,...e===`start`?{insetStart:0}:{insetEnd:0},minWidth:`fit`,css:{width:`max-content`},children:a});return r.useBoxElement({component:`swipeItem.tray`,position:`absolute`,top:0,bottom:0,...e===`start`?{insetStart:0}:{insetEnd:0},overflow:`hidden`,variant:{dragging:i},style:{width:`${Math.round(n)}px`},children:o},t)}function h(e,t){let{icon:n,onClick:i,closeOnSelect:a=!0,variant:o,children:s,props:u,...d}=e,p=(0,c.useContext)(f),m=e=>{i?.(e),a&&!e.defaultPrevented&&p?.close({reason:`action`,event:e})};return r.useBoxElement({tag:`button`,component:`swipeItem.action`,display:`flex`,d:`column`,ai:`center`,jc:`center`,gap:1,px:4,minWidth:18,flexGrow:1,flexShrink:0,fontSize:14,lineHeight:18,fontWeight:500,cursor:`pointer`,...d,variant:[o,{armed:p?.armed??!1}],props:{type:`button`,"data-swipe-action":``,...u,onClick:m},children:n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(g,{children:n}),s]}):s},t)}function g({children:e}){return r.useBoxElement({tag:`span`,display:`flex`,props:{"aria-hidden":!0},children:e})}var _=e.f(m,`SwipeItem`);_.Action=e.f(h,`SwipeItem.Action`),exports.SwipeUtils=d,exports.default=_;
|