@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
package/components/swipeItem.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { f as e } from "../react-shared.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { useBoxElement as
|
|
6
|
-
import { a as
|
|
7
|
-
import { a as
|
|
8
|
-
import { n as
|
|
9
|
-
import
|
|
10
|
-
import { createContext as
|
|
11
|
-
import { Fragment as
|
|
3
|
+
import { l as t, m as n, p as r, t as i, u as a } from "../platform.mjs";
|
|
4
|
+
import { n as o } from "../effects.mjs";
|
|
5
|
+
import { useBoxElement as s } from "../box.mjs";
|
|
6
|
+
import { a as c, o as l } from "../behavior.mjs";
|
|
7
|
+
import { a as u, i as d } from "../reporting.mjs";
|
|
8
|
+
import { n as f } from "../motion.mjs";
|
|
9
|
+
import ee, { i as p, n as m, r as h, t as g } from "./list.mjs";
|
|
10
|
+
import { createContext as _, useCallback as te, useContext as v, useEffect as y, useRef as b, useState as x } from "react";
|
|
11
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
12
12
|
//#region src/utils/swipe/swipeUtils.ts
|
|
13
|
-
var
|
|
13
|
+
var T;
|
|
14
14
|
(function(e) {
|
|
15
15
|
let t = e.SLOP = 8, n = e.FLICK = .4, r = e.FULL_RATIO = .6;
|
|
16
16
|
function i(e, n) {
|
|
@@ -68,94 +68,94 @@ var w;
|
|
|
68
68
|
return e === "start" ? t.start : e === "end" ? -t.end : 0;
|
|
69
69
|
}
|
|
70
70
|
e.restOffset = f;
|
|
71
|
-
})(
|
|
72
|
-
var
|
|
71
|
+
})(T ||= {});
|
|
72
|
+
var E = T, D = _(null), ne = {
|
|
73
73
|
start: 0,
|
|
74
74
|
end: 0
|
|
75
75
|
};
|
|
76
|
-
function
|
|
77
|
-
let { size:
|
|
78
|
-
value:
|
|
76
|
+
function O(e, m) {
|
|
77
|
+
let { size: h = "md", wrap: _ = !1, selected: v = !1, chevron: T = !1, startActions: O, endActions: k, fullSwipe: A = !1, open: j, defaultOpen: ae = null, onOpenChange: oe, variant: se, children: ce, props: le, ...ue } = e, M = b(null), N = b(null), P = b(null), F = b(null), I = b(!1), [L, R] = u({
|
|
78
|
+
value: j,
|
|
79
79
|
defaultValue: ae,
|
|
80
80
|
onChange: oe,
|
|
81
81
|
interaction: {
|
|
82
82
|
component: "swipeItem",
|
|
83
83
|
type: "openChange"
|
|
84
84
|
}
|
|
85
|
-
}), [z, B] =
|
|
85
|
+
}), [z, B] = x(null), [V, H] = x(null), [U, de] = x({
|
|
86
86
|
trays: ne,
|
|
87
87
|
width: 0,
|
|
88
88
|
rtl: !1
|
|
89
|
-
}),
|
|
90
|
-
M.current = e,
|
|
91
|
-
}, [
|
|
89
|
+
}), W = l(U), fe = te((e) => {
|
|
90
|
+
M.current = e, t(m, e);
|
|
91
|
+
}, [m]), G = c(() => {
|
|
92
92
|
let e = (e) => e?.firstElementChild?.offsetWidth ?? 0, t = {
|
|
93
93
|
trays: {
|
|
94
|
-
start:
|
|
95
|
-
end:
|
|
94
|
+
start: O ? e(N.current) : 0,
|
|
95
|
+
end: k ? e(P.current) : 0
|
|
96
96
|
},
|
|
97
97
|
width: M.current?.offsetWidth ?? 0,
|
|
98
|
-
rtl:
|
|
99
|
-
},
|
|
100
|
-
return (
|
|
98
|
+
rtl: n(M.current)
|
|
99
|
+
}, r = W.current;
|
|
100
|
+
return (r.trays.start !== t.trays.start || r.trays.end !== t.trays.end || r.width !== t.width || r.rtl !== t.rtl) && de(t), t;
|
|
101
101
|
});
|
|
102
|
-
|
|
103
|
-
L &&
|
|
104
|
-
}, [L,
|
|
105
|
-
let
|
|
106
|
-
|
|
102
|
+
o(() => {
|
|
103
|
+
L && G();
|
|
104
|
+
}, [L, G]);
|
|
105
|
+
let K = c((e) => R(null, e)), pe = d("swipeItem");
|
|
106
|
+
y(() => {
|
|
107
107
|
let e = i();
|
|
108
108
|
if (!L || !e) return;
|
|
109
|
-
let
|
|
110
|
-
|
|
109
|
+
let t = (e) => {
|
|
110
|
+
r(e, [M]) || K({
|
|
111
111
|
reason: "outside-pointer",
|
|
112
112
|
event: e
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
|
-
return e.addEventListener("pointerdown",
|
|
116
|
-
}, [L,
|
|
115
|
+
return e.addEventListener("pointerdown", t, !0), () => e.removeEventListener("pointerdown", t, !0);
|
|
116
|
+
}, [L, K]), y(() => {
|
|
117
117
|
if (!V) return;
|
|
118
|
-
let e = (V === "start" ? N : P).current, t = M.current?.firstElementChild, n = t && typeof getComputedStyle == "function" ?
|
|
118
|
+
let e = (V === "start" ? N : P).current, t = M.current?.firstElementChild, n = t && typeof getComputedStyle == "function" ? f.activeDuration(getComputedStyle(t)) : 0, r = setTimeout(() => {
|
|
119
119
|
H(null), e?.querySelector("[data-swipe-action]")?.click();
|
|
120
|
-
}, n +
|
|
120
|
+
}, n + f.SETTLE_FRAME);
|
|
121
121
|
return () => clearTimeout(r);
|
|
122
122
|
}, [V]);
|
|
123
|
-
let
|
|
124
|
-
if (I.current = !1, e.button !== 0 || V || !
|
|
125
|
-
let { trays: t } =
|
|
123
|
+
let me = c((e) => {
|
|
124
|
+
if (I.current = !1, e.button !== 0 || V || !O && !k) return;
|
|
125
|
+
let { trays: t } = G();
|
|
126
126
|
F.current = {
|
|
127
127
|
pointerId: e.pointerId,
|
|
128
128
|
x: e.clientX,
|
|
129
129
|
y: e.clientY,
|
|
130
|
-
rest:
|
|
130
|
+
rest: E.restOffset(L, t),
|
|
131
131
|
intent: null,
|
|
132
132
|
samples: [{
|
|
133
133
|
t: e.timeStamp,
|
|
134
134
|
x: e.clientX
|
|
135
135
|
}]
|
|
136
136
|
};
|
|
137
|
-
}),
|
|
137
|
+
}), he = c((e) => {
|
|
138
138
|
let t = F.current;
|
|
139
139
|
if (!t || t.pointerId !== e.pointerId || t.intent === "scroll") return;
|
|
140
|
-
let
|
|
140
|
+
let n = e.clientX - t.x;
|
|
141
141
|
if (!t.intent) {
|
|
142
|
-
if (t.intent =
|
|
143
|
-
e.currentTarget.setPointerCapture?.(e.pointerId),
|
|
142
|
+
if (t.intent = E.intent(n, e.clientY - t.y), t.intent !== "swipe") return;
|
|
143
|
+
e.currentTarget.setPointerCapture?.(e.pointerId), a(e.currentTarget);
|
|
144
144
|
}
|
|
145
|
-
let { trays:
|
|
146
|
-
t.samples =
|
|
145
|
+
let { trays: r, width: i, rtl: o } = W.current;
|
|
146
|
+
t.samples = E.track(t.samples, {
|
|
147
147
|
t: e.timeStamp,
|
|
148
148
|
x: e.clientX
|
|
149
|
-
}), B(
|
|
150
|
-
}),
|
|
149
|
+
}), B(E.offsetFor(t.rest, o ? -n : n, r, i, A));
|
|
150
|
+
}), q = c((e) => {
|
|
151
151
|
let t = F.current;
|
|
152
152
|
if (!t || t.pointerId !== e.pointerId || (F.current = null, t.intent !== "swipe" || z === null)) return;
|
|
153
153
|
e.currentTarget.releasePointerCapture?.(e.pointerId), I.current = !0;
|
|
154
|
-
let { trays: n, width: r, rtl: i } =
|
|
154
|
+
let { trays: n, width: r, rtl: i } = W.current, a = E.velocity(t.samples) * (i ? -1 : 1), o = e.type === "pointercancel" ? {
|
|
155
155
|
open: L,
|
|
156
156
|
full: null
|
|
157
|
-
} :
|
|
158
|
-
B(null), o.full ? (H(o.full),
|
|
157
|
+
} : E.settle(z, a, n, r, A);
|
|
158
|
+
B(null), o.full ? (H(o.full), pe("fullSwipe", o.full, {
|
|
159
159
|
reason: "swipe",
|
|
160
160
|
event: e
|
|
161
161
|
}), R(null, {
|
|
@@ -165,89 +165,89 @@ function D(e, p) {
|
|
|
165
165
|
reason: "swipe",
|
|
166
166
|
event: e
|
|
167
167
|
});
|
|
168
|
-
}),
|
|
168
|
+
}), ge = c((e) => {
|
|
169
169
|
if (I.current) {
|
|
170
170
|
I.current = !1, e.preventDefault(), e.stopPropagation();
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
L && (e.preventDefault(), e.stopPropagation(),
|
|
173
|
+
L && (e.preventDefault(), e.stopPropagation(), K({
|
|
174
174
|
reason: "outside-pointer",
|
|
175
175
|
event: e
|
|
176
176
|
}));
|
|
177
|
-
}),
|
|
177
|
+
}), J = c((e) => {
|
|
178
178
|
let t = N.current?.contains(e.target) ? "start" : P.current?.contains(e.target) ? "end" : null;
|
|
179
|
-
t && t !== L && (
|
|
179
|
+
t && t !== L && (G(), R(t, {
|
|
180
180
|
reason: "focus",
|
|
181
181
|
event: e
|
|
182
182
|
}));
|
|
183
|
-
}),
|
|
183
|
+
}), _e = c((e) => {
|
|
184
184
|
let t = e.relatedTarget;
|
|
185
|
-
L && (!t || !M.current?.contains(t)) &&
|
|
185
|
+
L && (!t || !M.current?.contains(t)) && K({
|
|
186
186
|
reason: "focus",
|
|
187
187
|
event: e
|
|
188
188
|
});
|
|
189
|
-
}),
|
|
190
|
-
e.key !== "Escape" || !L || e.defaultPrevented || (e.preventDefault(),
|
|
189
|
+
}), ve = c((e) => {
|
|
190
|
+
e.key !== "Escape" || !L || e.defaultPrevented || (e.preventDefault(), K({
|
|
191
191
|
reason: "escape",
|
|
192
192
|
event: e
|
|
193
193
|
}), M.current?.querySelector("[data-list-action]")?.focus());
|
|
194
|
-
}), { trays: Y, width: X, rtl:
|
|
194
|
+
}), { trays: Y, width: X, rtl: ye } = U, Z = z ?? (V ? V === "start" ? X : -X : E.restOffset(L, Y)), be = z === null ? V : E.armed(z, Y, X, A), Q = z !== null, $ = (e, t) => /* @__PURE__ */ C(ie, {
|
|
195
195
|
side: e,
|
|
196
196
|
trayRef: e === "start" ? N : P,
|
|
197
197
|
width: e === "start" ? Math.max(0, Z) : Math.max(0, -Z),
|
|
198
198
|
dragging: Q,
|
|
199
|
-
children: /* @__PURE__ */
|
|
199
|
+
children: /* @__PURE__ */ C(D.Provider, {
|
|
200
200
|
value: {
|
|
201
201
|
side: e,
|
|
202
|
-
armed:
|
|
203
|
-
close:
|
|
202
|
+
armed: be === e,
|
|
203
|
+
close: K
|
|
204
204
|
},
|
|
205
205
|
children: t
|
|
206
206
|
})
|
|
207
207
|
});
|
|
208
|
-
return
|
|
208
|
+
return s({
|
|
209
209
|
tag: "li",
|
|
210
210
|
component: "list.item",
|
|
211
|
-
...
|
|
212
|
-
...
|
|
211
|
+
...p({
|
|
212
|
+
...g,
|
|
213
213
|
css: {
|
|
214
|
-
...
|
|
214
|
+
...g.css,
|
|
215
215
|
overflow: "clip"
|
|
216
216
|
}
|
|
217
|
-
},
|
|
218
|
-
variant: [se, { selected:
|
|
217
|
+
}, ue),
|
|
218
|
+
variant: [se, { selected: v }],
|
|
219
219
|
props: {
|
|
220
|
-
...
|
|
221
|
-
onFocus:
|
|
222
|
-
onBlur:
|
|
223
|
-
onKeyDown:
|
|
220
|
+
...le,
|
|
221
|
+
onFocus: J,
|
|
222
|
+
onBlur: _e,
|
|
223
|
+
onKeyDown: ve
|
|
224
224
|
},
|
|
225
|
-
children: /* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
size:
|
|
228
|
-
wrap:
|
|
225
|
+
children: /* @__PURE__ */ w(S, { children: [
|
|
226
|
+
/* @__PURE__ */ w(re, {
|
|
227
|
+
size: h,
|
|
228
|
+
wrap: _,
|
|
229
229
|
dragging: Q,
|
|
230
|
-
translate: Z === 0 ? void 0 : `${Math.round(
|
|
230
|
+
translate: Z === 0 ? void 0 : `${Math.round(ye ? -Z : Z)}px`,
|
|
231
231
|
handlers: {
|
|
232
|
-
onPointerDown:
|
|
233
|
-
onPointerMove:
|
|
234
|
-
onPointerUp:
|
|
235
|
-
onPointerCancel:
|
|
236
|
-
onClickCapture:
|
|
232
|
+
onPointerDown: me,
|
|
233
|
+
onPointerMove: he,
|
|
234
|
+
onPointerUp: q,
|
|
235
|
+
onPointerCancel: q,
|
|
236
|
+
onClickCapture: ge,
|
|
237
237
|
onDragStart: (e) => e.preventDefault()
|
|
238
238
|
},
|
|
239
|
-
children: [
|
|
239
|
+
children: [ce, T && /* @__PURE__ */ C(ee.Chevron, {})]
|
|
240
240
|
}),
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
O ? $("start", O) : null,
|
|
242
|
+
k ? $("end", k) : null
|
|
243
243
|
] })
|
|
244
|
-
},
|
|
244
|
+
}, fe);
|
|
245
245
|
}
|
|
246
246
|
function re({ size: e, wrap: t, dragging: n, translate: r, handlers: i, children: a }) {
|
|
247
|
-
return
|
|
247
|
+
return s({
|
|
248
248
|
component: "swipeItem.row",
|
|
249
|
-
...
|
|
250
|
-
...
|
|
249
|
+
...m,
|
|
250
|
+
...h[e],
|
|
251
251
|
...t ? { flexWrap: "wrap" } : {},
|
|
252
252
|
position: "relative",
|
|
253
253
|
css: { touchAction: "pan-y" },
|
|
@@ -258,7 +258,7 @@ function re({ size: e, wrap: t, dragging: n, translate: r, handlers: i, children
|
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
function ie({ side: e, trayRef: t, width: n, dragging: r, children: i }) {
|
|
261
|
-
let a =
|
|
261
|
+
let a = s({
|
|
262
262
|
display: "flex",
|
|
263
263
|
d: e === "end" ? "row-reverse" : "row",
|
|
264
264
|
position: "absolute",
|
|
@@ -269,7 +269,7 @@ function ie({ side: e, trayRef: t, width: n, dragging: r, children: i }) {
|
|
|
269
269
|
css: { width: "max-content" },
|
|
270
270
|
children: i
|
|
271
271
|
});
|
|
272
|
-
return
|
|
272
|
+
return s({
|
|
273
273
|
component: "swipeItem.tray",
|
|
274
274
|
position: "absolute",
|
|
275
275
|
top: 0,
|
|
@@ -281,14 +281,14 @@ function ie({ side: e, trayRef: t, width: n, dragging: r, children: i }) {
|
|
|
281
281
|
children: a
|
|
282
282
|
}, t);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
let { icon: n, onClick: r, closeOnSelect: i = !0, variant: a, children:
|
|
284
|
+
function k(e, t) {
|
|
285
|
+
let { icon: n, onClick: r, closeOnSelect: i = !0, variant: a, children: o, props: c, ...l } = e, u = v(D), d = (e) => {
|
|
286
286
|
r?.(e), i && !e.defaultPrevented && u?.close({
|
|
287
287
|
reason: "action",
|
|
288
288
|
event: e
|
|
289
289
|
});
|
|
290
290
|
};
|
|
291
|
-
return
|
|
291
|
+
return s({
|
|
292
292
|
tag: "button",
|
|
293
293
|
component: "swipeItem.action",
|
|
294
294
|
display: "flex",
|
|
@@ -312,18 +312,18 @@ function O(e, t) {
|
|
|
312
312
|
...c,
|
|
313
313
|
onClick: d
|
|
314
314
|
},
|
|
315
|
-
children: n ? /* @__PURE__ */
|
|
315
|
+
children: n ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(A, { children: n }), o] }) : o
|
|
316
316
|
}, t);
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
return
|
|
318
|
+
function A({ children: e }) {
|
|
319
|
+
return s({
|
|
320
320
|
tag: "span",
|
|
321
321
|
display: "flex",
|
|
322
322
|
props: { "aria-hidden": !0 },
|
|
323
323
|
children: e
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
|
-
var
|
|
327
|
-
|
|
326
|
+
var j = e(O, "SwipeItem");
|
|
327
|
+
j.Action = e(k, "SwipeItem.Action");
|
|
328
328
|
//#endregion
|
|
329
|
-
export {
|
|
329
|
+
export { E as SwipeUtils, j as default };
|
package/components/tabs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../
|
|
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("../identity.cjs"),o=require("../reporting.cjs"),s=require("../motion.cjs");let c=require("react"),l=require("react/jsx-runtime");var u;(function(e){let t=e.TAB_SELECTOR=`[role="tab"]`,n=e.LIST_SELECTOR=`[role="tablist"]`,r=e.PANEL_SELECTOR=`[role="tabpanel"]`;function i(e,t){return t instanceof Element&&t.closest(n)===e}e.owns=i;function a(e){return e?[...e.querySelectorAll(t)].filter(t=>i(e,t)):[]}e.tabs=a;function o(e){return e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}e.isDisabled=o;function s(e){return e.dataset.value}e.valueOf=s;function c(e){return e.replace(/[^A-Za-z0-9-]/g,e=>`_${e.codePointAt(0).toString(36)}_`)}e.token=c;function l(e,t,n,r){let i=e.length;if(i===0)return;let a=t<0||t>=i?n>0?-1:i:t;for(let t=0;t<i;t++){if(a+=n,a<0||a>=i){if(!r)return;a=(a%i+i)%i}if(!o(e[a]))return e[a]}}e.step=l;function u(e,t){return l(e,t===1?-1:e.length,t,!1)}e.edge=u;function d(e,t){return t instanceof HTMLElement?e.indexOf(t):-1}e.indexOf=d;function f(e,t,n=!1){if(e===`Home`)return{kind:`edge`,delta:1};if(e===`End`)return{kind:`edge`,delta:-1};let r=t===`vertical`,i=r?`ArrowDown`:n?`ArrowLeft`:`ArrowRight`,a=r?`ArrowUp`:n?`ArrowRight`:`ArrowLeft`;if(e===i)return{kind:`step`,delta:1};if(e===a)return{kind:`step`,delta:-1}}e.moveFor=f;function p(e,t,n,r){return n.kind===`edge`?u(e,n.delta):l(e,t,n.delta,r)}e.target=p;function m(e){if(e)return a(e).find(e=>e.getAttribute(`aria-selected`)===`true`)}e.selectedTab=m;function h(e,t,n){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();return n===`vertical`?{start:i.top-r.top+e.scrollTop,size:i.height}:{start:i.left-r.left+e.scrollLeft,size:i.width}}e.bounds=h;function g(e,t){return!e||!t?e===t:e.start===t.start&&e.size===t.size}e.sameBounds=g;function _(e){if(e)return[...e.querySelectorAll(r)].find(e=>!e.hasAttribute(`hidden`))}e.visiblePanel=_})(u||={});var d=u,f=(0,c.createContext)(null);function p(e){let t=(0,c.useContext)(f);if(!t)throw Error(`<${e}> has to be rendered inside a <Tabs>.`);return t}function m(e){let{children:t,value:i,defaultValue:s,onValueChange:u,orientation:p=`horizontal`,activation:m=`automatic`,loop:h=!0,keepMounted:g=!1,indicator:_=`static`,props:v,...y}=e,b=a.t(`tabs`),[x,S]=o.a({value:i,defaultValue:s,onChange:u,interaction:{component:`tabs`,type:`valueChange`}}),[C,w]=(0,c.useState)(),[T,E]=(0,c.useState)(!1);n.n(()=>{x!==void 0&&w(x)},[x]);let D=(0,c.useMemo)(()=>({identifier:b,value:x,orientation:p,activation:m,loop:h,keepMounted:g,indicator:_,indicatorLive:T,setIndicatorLive:E,tabStop:C??x,setTabStop:w,select:S,tabId:e=>`${b}-tab-${d.token(e)}`,panelId:e=>`${b}-panel-${d.token(e)}`}),[b,x,p,m,h,g,_,T,C,S]);return(0,l.jsx)(f.Provider,{value:D,children:(0,l.jsx)(r.default,{component:`tabs`,...y,variant:[y.variant,{vertical:p===`vertical`}],props:v,children:t})})}function h(e,a){let{children:o,label:s,labelledBy:u,props:f,...m}=e,{value:h,orientation:g,activation:_,loop:v,indicator:y,tabStop:b,setTabStop:x,setIndicatorLive:S,select:C}=p(`Tabs.List`),w=(0,c.useRef)(null),T=(0,c.useCallback)(e=>{w.current=e,t.l(a,e)},[a]),[E,D]=(0,c.useState)(),O=y===`sliding`;n.n(()=>{let e=w.current;if(!O||!e)return;let t=()=>{let t=d.selectedTab(e),n=t&&d.bounds(e,t,g);D(e=>d.sameBounds(e,n)?e:n)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);n.observe(e);for(let t of d.tabs(e))n.observe(t);return()=>n.disconnect()},[O,g,h]);let k=O&&E&&E.size>0?E:void 0;n.n(()=>{S(k!==void 0)},[k,S]),n.n(()=>{if(b!==void 0)return;let e=d.edge(d.tabs(w.current),1),t=e&&d.valueOf(e);t!==void 0&&x(t)},[b,x]);let A=i.a(e=>{let n=w.current;if(!n||e.defaultPrevented||!d.owns(n,e.target))return;let r=d.tabs(n),i=d.indexOf(r,e.target);if(i===-1)return;if(_===`manual`&&(e.key===`Enter`||e.key===` `)){let t=d.valueOf(r[i]);if(t===void 0)return;e.preventDefault(),C(t,{reason:`keyboard`,event:e});return}let a=d.moveFor(e.key,g,t.m(n));if(!a)return;let o=d.target(r,i,a,v);if(!o)return;e.preventDefault(),o.focus();let s=d.valueOf(o);_===`automatic`&&s!==void 0&&C(s,{reason:`keyboard`,event:e})});return(0,l.jsxs)(r.default,{ref:T,component:`tabs.list`,...m,variant:[m.variant,{vertical:g===`vertical`,sliding:O}],props:{role:`tablist`,"aria-label":s,"aria-labelledby":u,"aria-orientation":g,...f,onKeyDown:A},children:[o,k&&(0,l.jsx)(r.default,{tag:`span`,component:`tabs.indicator`,variant:{vertical:g===`vertical`},style:g===`vertical`?{top:`${k.start}px`,height:`${k.size}px`}:{left:`${k.start}px`,width:`${k.size}px`},props:{"aria-hidden":!0}})]})}function g(e){let{value:t,children:n,disabled:a,props:o,...s}=e,{value:c,orientation:u,keepMounted:d,indicatorLive:f,tabStop:m,setTabStop:h,select:g,tabId:_,panelId:v}=p(`Tabs.Tab`),y=c===t,b=i.a(e=>g(t,{reason:`click`,event:e})),x=i.a(()=>h(t));return(0,l.jsx)(r.default,{tag:`button`,component:`tabs.tab`,...s,variant:[s.variant,{vertical:u===`vertical`,underline:!f}],disabled:a,id:_(t),props:{type:`button`,role:`tab`,"aria-selected":y,"aria-controls":y||d?v(t):void 0,tabIndex:m===t?0:-1,"data-value":t,...o,onClick:b,onFocus:x},children:n})}g.displayName=`Tabs.Tab`;function _(e,a){let{children:o,props:u,...f}=e,{value:m}=p(`Tabs.Panels`),h=(0,c.useRef)(null),g=(0,c.useCallback)(e=>{h.current=e,t.l(a,e)},[a]),[_,v]=(0,c.useState)(),[y,b]=(0,c.useState)(!1),x=i.a(()=>{let e=h.current;if(!e)return;let t=d.visiblePanel(e)?.offsetHeight;t!==_&&(_!==void 0&&t!==void 0&&b(!0),v(t))});return n.n(()=>{let e=h.current;if(!e||(x(),typeof ResizeObserver>`u`))return;let t=d.visiblePanel(e);if(!t)return;let n=new ResizeObserver(x);return n.observe(t),()=>n.disconnect()},[m,x]),n.n(()=>{let e=h.current;if(!e||!y)return;let t=setTimeout(()=>b(!1),s.n.activeDuration(getComputedStyle(e))+s.n.SETTLE_FRAME);return()=>clearTimeout(t)},[y,_]),(0,l.jsx)(r.default,{ref:g,component:`tabs.panels`,...f,variant:[f.variant,{resizing:y}],style:{height:_===void 0?void 0:`${_}px`,...f.style},props:u,children:o})}function v(e){let{value:t,children:n,props:i,...a}=e,{value:o,keepMounted:s,tabId:c,panelId:u}=p(`Tabs.Panel`),d=o===t;return!d&&!s?null:(0,l.jsx)(r.default,{component:`tabs.panel`,...a,variant:[a.variant,{hidden:!d}],id:u(t),props:{role:`tabpanel`,"aria-labelledby":c(t),hidden:!d||void 0,tabIndex:0,...i},children:n})}v.displayName=`Tabs.Panel`;var y=m;y.List=e.f(h,`Tabs.List`),y.Tab=g,y.Panels=e.f(_,`Tabs.Panels`),y.Panel=v,y.displayName=`Tabs`,exports.default=y;
|