@box-kite/react 2.2.6 → 2.2.8
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 +2 -0
- package/.claude/skills/box-kite/SKILL.md +2 -0
- package/.claude/skills/box-kite/references/extending.md +10 -0
- package/.claude/skills/box-kite/references/styling.md +3 -2
- package/.cursor/rules/box-kite.mdc +2 -0
- package/AGENTS.md +2 -0
- package/BOX_AI_CONTEXT.md +128 -2
- package/BOX_KITE_AI_CONTEXT.md +128 -2
- package/analytics.cjs +1 -0
- package/analytics.d.ts +10 -0
- package/analytics.mjs +121 -0
- package/behavior.cjs +1 -1
- package/behavior.mjs +42 -38
- package/box.cjs +1 -1
- package/box.d.ts +14 -0
- package/box.mjs +17 -16
- package/catalog.cjs +1 -1
- package/catalog.mjs +8 -0
- package/client.cjs +1 -1
- package/client.mjs +144 -113
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +19 -10
- package/components/agent.cjs +1 -1
- package/components/agent.mjs +21 -8
- package/components/calendar.cjs +1 -1
- package/components/calendar.d.ts +3 -1
- package/components/calendar.mjs +154 -142
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +184 -174
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +183 -170
- package/components/dataGrid/models/columnModel.d.ts +1 -0
- package/components/dataGrid/models/gridModel.d.ts +18 -0
- package/components/dataGrid/models/headerCellModel.d.ts +1 -0
- package/components/dataGrid/models/rangeModel.d.ts +3 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +1015 -923
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +165 -159
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +198 -183
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +38 -33
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.mjs +107 -93
- package/components/form.cjs +1 -1
- package/components/form.mjs +22 -18
- package/components/menu.cjs +1 -1
- package/components/menu.d.ts +2 -0
- package/components/menu.mjs +196 -175
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +7 -7
- package/components/popover.cjs +1 -1
- package/components/popover.mjs +4 -0
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +10 -5
- package/components/semantics.d.ts +29 -29
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +84 -83
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +158 -150
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +92 -84
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +10 -5
- package/components/timeZoneSelect.cjs +1 -1
- package/components/timeZoneSelect.mjs +40 -35
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +151 -113
- package/create/src/index.d.ts +1 -0
- package/create/src/options.d.ts +27 -0
- package/create/src/options.test.d.ts +1 -0
- package/create/src/packageManager.d.ts +5 -0
- package/create/src/project.d.ts +25 -0
- package/create/src/project.test.d.ts +1 -0
- package/create/templates/ts/designs/azure.d.ts +5 -0
- package/create/templates/ts/designs/ember.d.ts +5 -0
- package/create/templates/ts/designs/mono.d.ts +5 -0
- package/create/templates/ts/src/App.d.ts +2 -0
- package/create/templates/ts/src/design.d.ts +5 -0
- package/create/templates/ts/src/main.d.ts +0 -0
- package/dataGridDateParts.cjs +1 -1
- package/dataGridDateParts.mjs +56 -55
- package/dataGridList.cjs +1 -1
- package/dataGridList.mjs +437 -436
- package/docs/props.md +19 -19
- package/effects.cjs +1 -1
- package/effects.mjs +1 -1
- package/interactionListening.cjs +1 -0
- package/interactionListening.mjs +117 -0
- package/interactions.cjs +1 -0
- package/interactions.mjs +25 -0
- package/layer.cjs +1 -1
- package/layer.mjs +68 -66
- package/package.json +139 -70
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +44 -25
- package/react/interactions/interactions.d.ts +30 -0
- package/react/popover/usePopoverLayer.d.ts +3 -0
- package/react/theme/theme.d.ts +9 -0
- package/react/theme/themeContext.d.ts +2 -0
- package/react/useStyles.d.ts +8 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +49 -48
- package/reporting.cjs +1 -0
- package/reporting.mjs +51 -0
- package/rsc.cjs +1 -1
- package/rsc.d.ts +3 -0
- package/rsc.mjs +1 -1
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/supabase/functions/collect/index.d.ts +30 -0
- package/supabase/functions/collect/index.test.d.ts +1 -0
- package/utils/analytics/analytics.d.ts +72 -0
- package/utils/analytics/analyticsIdentity.d.ts +13 -0
- package/utils/interactions/componentAttribute.d.ts +6 -0
- package/utils/interactions/interactionChannel.d.ts +35 -0
- package/utils/interactions/interactionJson.d.ts +6 -0
- package/utils/interactions/interactionListening.d.ts +6 -0
- package/utils/interactions/interactionTypes.d.ts +224 -0
package/components/swipeItem.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { f as e } from "../react-shared.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { f as t, l as n, p as r, t as i } from "../platform.mjs";
|
|
4
4
|
import { n as a } from "../effects.mjs";
|
|
5
5
|
import { useBoxElement as o } from "../box.mjs";
|
|
6
|
-
import { a as s,
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
6
|
+
import { a as s, o as c } from "../behavior.mjs";
|
|
7
|
+
import { a as l, i as u } from "../reporting.mjs";
|
|
8
|
+
import { n as d } from "../motion.mjs";
|
|
9
|
+
import f, { i as ee, n as p, r as m, t as h } from "./list.mjs";
|
|
10
|
+
import { createContext as g, useCallback as te, useContext as _, useEffect as v, useRef as y, useState as b } from "react";
|
|
10
11
|
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
11
12
|
//#region src/utils/swipe/swipeUtils.ts
|
|
12
13
|
var w;
|
|
@@ -68,131 +69,138 @@ var w;
|
|
|
68
69
|
}
|
|
69
70
|
e.restOffset = f;
|
|
70
71
|
})(w ||= {});
|
|
71
|
-
var T = w, E = g(null),
|
|
72
|
+
var T = w, E = g(null), ne = {
|
|
72
73
|
start: 0,
|
|
73
74
|
end: 0
|
|
74
75
|
};
|
|
75
76
|
function D(e, p) {
|
|
76
|
-
let { size: m = "md", wrap: g = !1, selected: _ = !1, chevron: w = !1, startActions: D, endActions: O, fullSwipe: k = !1, open: A, defaultOpen:
|
|
77
|
+
let { size: m = "md", wrap: g = !1, selected: _ = !1, chevron: w = !1, startActions: D, endActions: O, fullSwipe: k = !1, open: A, defaultOpen: ae = null, onOpenChange: oe, variant: se, children: j, props: ce, ...le } = e, M = y(null), N = y(null), P = y(null), F = y(null), I = y(!1), [L, R] = l({
|
|
77
78
|
value: A,
|
|
78
|
-
defaultValue:
|
|
79
|
-
onChange:
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
defaultValue: ae,
|
|
80
|
+
onChange: oe,
|
|
81
|
+
interaction: {
|
|
82
|
+
component: "swipeItem",
|
|
83
|
+
type: "openChange"
|
|
84
|
+
}
|
|
85
|
+
}), [z, B] = b(null), [V, H] = b(null), [U, W] = b({
|
|
86
|
+
trays: ne,
|
|
82
87
|
width: 0,
|
|
83
88
|
rtl: !1
|
|
84
|
-
}),
|
|
85
|
-
|
|
86
|
-
}, [p]),
|
|
87
|
-
let e = (e) => e?.firstElementChild?.offsetWidth ?? 0,
|
|
89
|
+
}), G = c(U), ue = te((e) => {
|
|
90
|
+
M.current = e, typeof p == "function" ? p(e) : p && (p.current = e);
|
|
91
|
+
}, [p]), K = s(() => {
|
|
92
|
+
let e = (e) => e?.firstElementChild?.offsetWidth ?? 0, t = {
|
|
88
93
|
trays: {
|
|
89
|
-
start: D ? e(
|
|
90
|
-
end: O ? e(
|
|
94
|
+
start: D ? e(N.current) : 0,
|
|
95
|
+
end: O ? e(P.current) : 0
|
|
91
96
|
},
|
|
92
|
-
width:
|
|
93
|
-
rtl:
|
|
94
|
-
},
|
|
95
|
-
return (
|
|
97
|
+
width: M.current?.offsetWidth ?? 0,
|
|
98
|
+
rtl: r(M.current)
|
|
99
|
+
}, n = G.current;
|
|
100
|
+
return (n.trays.start !== t.trays.start || n.trays.end !== t.trays.end || n.width !== t.width || n.rtl !== t.rtl) && W(t), t;
|
|
96
101
|
});
|
|
97
102
|
a(() => {
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
let
|
|
103
|
+
L && K();
|
|
104
|
+
}, [L, K]);
|
|
105
|
+
let q = s((e) => R(null, e)), de = u("swipeItem");
|
|
101
106
|
v(() => {
|
|
102
|
-
let e =
|
|
103
|
-
if (!
|
|
104
|
-
let
|
|
105
|
-
|
|
107
|
+
let e = i();
|
|
108
|
+
if (!L || !e) return;
|
|
109
|
+
let n = (e) => {
|
|
110
|
+
t(e, [M]) || q({
|
|
106
111
|
reason: "outside-pointer",
|
|
107
112
|
event: e
|
|
108
113
|
});
|
|
109
114
|
};
|
|
110
|
-
return e.addEventListener("pointerdown",
|
|
111
|
-
}, [
|
|
112
|
-
if (!
|
|
113
|
-
let e = (
|
|
114
|
-
|
|
115
|
-
}, n +
|
|
115
|
+
return e.addEventListener("pointerdown", n, !0), () => e.removeEventListener("pointerdown", n, !0);
|
|
116
|
+
}, [L, q]), v(() => {
|
|
117
|
+
if (!V) return;
|
|
118
|
+
let e = (V === "start" ? N : P).current, t = M.current?.firstElementChild, n = t && typeof getComputedStyle == "function" ? d.activeDuration(getComputedStyle(t)) : 0, r = setTimeout(() => {
|
|
119
|
+
H(null), e?.querySelector("[data-swipe-action]")?.click();
|
|
120
|
+
}, n + d.SETTLE_FRAME);
|
|
116
121
|
return () => clearTimeout(r);
|
|
117
|
-
}, [
|
|
118
|
-
let
|
|
119
|
-
if (
|
|
120
|
-
let { trays: t } =
|
|
121
|
-
|
|
122
|
+
}, [V]);
|
|
123
|
+
let fe = s((e) => {
|
|
124
|
+
if (I.current = !1, e.button !== 0 || V || !D && !O) return;
|
|
125
|
+
let { trays: t } = K();
|
|
126
|
+
F.current = {
|
|
122
127
|
pointerId: e.pointerId,
|
|
123
128
|
x: e.clientX,
|
|
124
129
|
y: e.clientY,
|
|
125
|
-
rest: T.restOffset(
|
|
130
|
+
rest: T.restOffset(L, t),
|
|
126
131
|
intent: null,
|
|
127
132
|
samples: [{
|
|
128
133
|
t: e.timeStamp,
|
|
129
134
|
x: e.clientX
|
|
130
135
|
}]
|
|
131
136
|
};
|
|
132
|
-
}),
|
|
133
|
-
let t =
|
|
137
|
+
}), pe = s((e) => {
|
|
138
|
+
let t = F.current;
|
|
134
139
|
if (!t || t.pointerId !== e.pointerId || t.intent === "scroll") return;
|
|
135
140
|
let r = e.clientX - t.x;
|
|
136
141
|
if (!t.intent) {
|
|
137
142
|
if (t.intent = T.intent(r, e.clientY - t.y), t.intent !== "swipe") return;
|
|
138
143
|
e.currentTarget.setPointerCapture?.(e.pointerId), n(e.currentTarget);
|
|
139
144
|
}
|
|
140
|
-
let { trays: i, width: a, rtl: o } =
|
|
145
|
+
let { trays: i, width: a, rtl: o } = G.current;
|
|
141
146
|
t.samples = T.track(t.samples, {
|
|
142
147
|
t: e.timeStamp,
|
|
143
148
|
x: e.clientX
|
|
144
|
-
}),
|
|
145
|
-
}),
|
|
146
|
-
let t =
|
|
147
|
-
if (!t || t.pointerId !== e.pointerId || (
|
|
148
|
-
e.currentTarget.releasePointerCapture?.(e.pointerId),
|
|
149
|
-
let { trays: n, width: r, rtl: i } =
|
|
150
|
-
open:
|
|
149
|
+
}), B(T.offsetFor(t.rest, o ? -r : r, i, a, k));
|
|
150
|
+
}), J = s((e) => {
|
|
151
|
+
let t = F.current;
|
|
152
|
+
if (!t || t.pointerId !== e.pointerId || (F.current = null, t.intent !== "swipe" || z === null)) return;
|
|
153
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId), I.current = !0;
|
|
154
|
+
let { trays: n, width: r, rtl: i } = G.current, a = T.velocity(t.samples) * (i ? -1 : 1), o = e.type === "pointercancel" ? {
|
|
155
|
+
open: L,
|
|
151
156
|
full: null
|
|
152
|
-
} : T.settle(
|
|
153
|
-
|
|
157
|
+
} : T.settle(z, a, n, r, k);
|
|
158
|
+
B(null), o.full ? (H(o.full), de("fullSwipe", o.full, {
|
|
159
|
+
reason: "swipe",
|
|
160
|
+
event: e
|
|
161
|
+
}), R(null, {
|
|
154
162
|
reason: "swipe",
|
|
155
163
|
event: e
|
|
156
|
-
})) :
|
|
164
|
+
})) : R(o.open, {
|
|
157
165
|
reason: "swipe",
|
|
158
166
|
event: e
|
|
159
167
|
});
|
|
160
|
-
}),
|
|
161
|
-
if (
|
|
162
|
-
|
|
168
|
+
}), me = s((e) => {
|
|
169
|
+
if (I.current) {
|
|
170
|
+
I.current = !1, e.preventDefault(), e.stopPropagation();
|
|
163
171
|
return;
|
|
164
172
|
}
|
|
165
|
-
|
|
173
|
+
L && (e.preventDefault(), e.stopPropagation(), q({
|
|
166
174
|
reason: "outside-pointer",
|
|
167
175
|
event: e
|
|
168
176
|
}));
|
|
169
|
-
}),
|
|
170
|
-
let t =
|
|
171
|
-
t && t !==
|
|
177
|
+
}), he = s((e) => {
|
|
178
|
+
let t = N.current?.contains(e.target) ? "start" : P.current?.contains(e.target) ? "end" : null;
|
|
179
|
+
t && t !== L && (K(), R(t, {
|
|
172
180
|
reason: "focus",
|
|
173
181
|
event: e
|
|
174
182
|
}));
|
|
175
|
-
}),
|
|
183
|
+
}), ge = s((e) => {
|
|
176
184
|
let t = e.relatedTarget;
|
|
177
|
-
|
|
185
|
+
L && (!t || !M.current?.contains(t)) && q({
|
|
178
186
|
reason: "focus",
|
|
179
187
|
event: e
|
|
180
188
|
});
|
|
181
|
-
}),
|
|
182
|
-
e.key !== "Escape" || !
|
|
189
|
+
}), _e = s((e) => {
|
|
190
|
+
e.key !== "Escape" || !L || e.defaultPrevented || (e.preventDefault(), q({
|
|
183
191
|
reason: "escape",
|
|
184
192
|
event: e
|
|
185
|
-
}),
|
|
186
|
-
}), { trays:
|
|
193
|
+
}), M.current?.querySelector("[data-list-action]")?.focus());
|
|
194
|
+
}), { trays: Y, width: X, rtl: ve } = U, Z = z ?? (V ? V === "start" ? X : -X : T.restOffset(L, Y)), ye = z === null ? V : T.armed(z, Y, X, k), Q = z !== null, $ = (e, t) => /* @__PURE__ */ S(ie, {
|
|
187
195
|
side: e,
|
|
188
|
-
trayRef: e === "start" ?
|
|
196
|
+
trayRef: e === "start" ? N : P,
|
|
189
197
|
width: e === "start" ? Math.max(0, Z) : Math.max(0, -Z),
|
|
190
198
|
dragging: Q,
|
|
191
199
|
children: /* @__PURE__ */ S(E.Provider, {
|
|
192
200
|
value: {
|
|
193
201
|
side: e,
|
|
194
|
-
armed:
|
|
195
|
-
close:
|
|
202
|
+
armed: ye === e,
|
|
203
|
+
close: q
|
|
196
204
|
},
|
|
197
205
|
children: t
|
|
198
206
|
})
|
|
@@ -200,42 +208,42 @@ function D(e, p) {
|
|
|
200
208
|
return o({
|
|
201
209
|
tag: "li",
|
|
202
210
|
component: "list.item",
|
|
203
|
-
...
|
|
211
|
+
...ee({
|
|
204
212
|
...h,
|
|
205
213
|
css: {
|
|
206
214
|
...h.css,
|
|
207
215
|
overflow: "clip"
|
|
208
216
|
}
|
|
209
217
|
}, le),
|
|
210
|
-
variant: [
|
|
218
|
+
variant: [se, { selected: _ }],
|
|
211
219
|
props: {
|
|
212
220
|
...ce,
|
|
213
|
-
onFocus:
|
|
214
|
-
onBlur:
|
|
215
|
-
onKeyDown:
|
|
221
|
+
onFocus: he,
|
|
222
|
+
onBlur: ge,
|
|
223
|
+
onKeyDown: _e
|
|
216
224
|
},
|
|
217
225
|
children: /* @__PURE__ */ C(x, { children: [
|
|
218
|
-
/* @__PURE__ */ C(
|
|
226
|
+
/* @__PURE__ */ C(re, {
|
|
219
227
|
size: m,
|
|
220
228
|
wrap: g,
|
|
221
229
|
dragging: Q,
|
|
222
|
-
translate: Z === 0 ? void 0 : `${Math.round(
|
|
230
|
+
translate: Z === 0 ? void 0 : `${Math.round(ve ? -Z : Z)}px`,
|
|
223
231
|
handlers: {
|
|
224
|
-
onPointerDown:
|
|
225
|
-
onPointerMove:
|
|
226
|
-
onPointerUp:
|
|
227
|
-
onPointerCancel:
|
|
228
|
-
onClickCapture:
|
|
232
|
+
onPointerDown: fe,
|
|
233
|
+
onPointerMove: pe,
|
|
234
|
+
onPointerUp: J,
|
|
235
|
+
onPointerCancel: J,
|
|
236
|
+
onClickCapture: me,
|
|
229
237
|
onDragStart: (e) => e.preventDefault()
|
|
230
238
|
},
|
|
231
|
-
children: [
|
|
239
|
+
children: [j, w && /* @__PURE__ */ S(f.Chevron, {})]
|
|
232
240
|
}),
|
|
233
241
|
D ? $("start", D) : null,
|
|
234
242
|
O ? $("end", O) : null
|
|
235
243
|
] })
|
|
236
244
|
}, ue);
|
|
237
245
|
}
|
|
238
|
-
function
|
|
246
|
+
function re({ size: e, wrap: t, dragging: n, translate: r, handlers: i, children: a }) {
|
|
239
247
|
return o({
|
|
240
248
|
component: "swipeItem.row",
|
|
241
249
|
...p,
|
|
@@ -249,7 +257,7 @@ function ne({ size: e, wrap: t, dragging: n, translate: r, handlers: i, children
|
|
|
249
257
|
children: a
|
|
250
258
|
});
|
|
251
259
|
}
|
|
252
|
-
function
|
|
260
|
+
function ie({ side: e, trayRef: t, width: n, dragging: r, children: i }) {
|
|
253
261
|
let a = o({
|
|
254
262
|
display: "flex",
|
|
255
263
|
d: e === "end" ? "row-reverse" : "row",
|
package/components/tabs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../platform.cjs"),t=require("../effects.cjs"),n=require("../box.cjs"),r=require("../behavior.cjs"),i=require("../identity.cjs"),a=require("../motion.cjs");let
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../platform.cjs"),t=require("../effects.cjs"),n=require("../box.cjs"),r=require("../behavior.cjs"),i=require("../identity.cjs"),a=require("../reporting.cjs"),o=require("../motion.cjs");let s=require("react"),c=require("react/jsx-runtime");var l;(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=_})(l||={});var u=l,d=(0,s.createContext)(null);function f(e){let t=(0,s.useContext)(d);if(!t)throw Error(`<${e}> has to be rendered inside a <Tabs>.`);return t}function p(e){let{children:r,value:o,defaultValue:l,onValueChange:f,orientation:p=`horizontal`,activation:m=`automatic`,loop:h=!0,keepMounted:g=!1,indicator:_=`static`,props:v,...y}=e,b=i.t(`tabs`),[x,S]=a.a({value:o,defaultValue:l,onChange:f,interaction:{component:`tabs`,type:`valueChange`}}),[C,w]=(0,s.useState)(),[T,E]=(0,s.useState)(!1);t.n(()=>{x!==void 0&&w(x)},[x]);let D=(0,s.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-${u.token(e)}`,panelId:e=>`${b}-panel-${u.token(e)}`}),[b,x,p,m,h,g,_,T,C,S]);return(0,c.jsx)(d.Provider,{value:D,children:(0,c.jsx)(n.default,{component:`tabs`,...y,variant:[y.variant,{vertical:p===`vertical`}],props:v,children:r})})}function m(i){let{children:a,label:o,labelledBy:l,props:d,...p}=i,{value:m,orientation:h,activation:g,loop:_,indicator:v,tabStop:y,setTabStop:b,setIndicatorLive:x,select:S}=f(`Tabs.List`),C=(0,s.useRef)(null),[w,T]=(0,s.useState)(),E=v===`sliding`;t.n(()=>{let e=C.current;if(!E||!e)return;let t=()=>{let t=u.selectedTab(e),n=t&&u.bounds(e,t,h);T(e=>u.sameBounds(e,n)?e:n)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);n.observe(e);for(let t of u.tabs(e))n.observe(t);return()=>n.disconnect()},[E,h,m]);let D=E&&w&&w.size>0?w:void 0;t.n(()=>{x(D!==void 0)},[D,x]),t.n(()=>{if(y!==void 0)return;let e=u.edge(u.tabs(C.current),1),t=e&&u.valueOf(e);t!==void 0&&b(t)},[y,b]);let O=r.a(t=>{let n=C.current;if(!n||t.defaultPrevented||!u.owns(n,t.target))return;let r=u.tabs(n),i=u.indexOf(r,t.target);if(i===-1)return;if(g===`manual`&&(t.key===`Enter`||t.key===` `)){let e=u.valueOf(r[i]);if(e===void 0)return;t.preventDefault(),S(e,{reason:`keyboard`,event:t});return}let a=u.moveFor(t.key,h,e.p(n));if(!a)return;let o=u.target(r,i,a,_);if(!o)return;t.preventDefault(),o.focus();let s=u.valueOf(o);g===`automatic`&&s!==void 0&&S(s,{reason:`keyboard`,event:t})});return(0,c.jsxs)(n.default,{ref:C,component:`tabs.list`,...p,variant:[p.variant,{vertical:h===`vertical`,sliding:E}],props:{role:`tablist`,"aria-label":o,"aria-labelledby":l,"aria-orientation":h,...d,onKeyDown:O},children:[a,D&&(0,c.jsx)(n.default,{tag:`span`,component:`tabs.indicator`,variant:{vertical:h===`vertical`},style:h===`vertical`?{top:`${D.start}px`,height:`${D.size}px`}:{left:`${D.start}px`,width:`${D.size}px`},props:{"aria-hidden":!0}})]})}m.displayName=`Tabs.List`;function h(e){let{value:t,children:i,disabled:a,props:o,...s}=e,{value:l,orientation:u,keepMounted:d,indicatorLive:p,tabStop:m,setTabStop:h,select:g,tabId:_,panelId:v}=f(`Tabs.Tab`),y=l===t,b=r.a(e=>g(t,{reason:`click`,event:e})),x=r.a(()=>h(t));return(0,c.jsx)(n.default,{tag:`button`,component:`tabs.tab`,...s,variant:[s.variant,{vertical:u===`vertical`,underline:!p}],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:i})}h.displayName=`Tabs.Tab`;function g(e){let{children:i,props:a,...l}=e,{value:d}=f(`Tabs.Panels`),p=(0,s.useRef)(null),[m,h]=(0,s.useState)(),[g,_]=(0,s.useState)(!1),v=r.a(()=>{let e=p.current;if(!e)return;let t=u.visiblePanel(e)?.offsetHeight;t!==m&&(m!==void 0&&t!==void 0&&_(!0),h(t))});return t.n(()=>{let e=p.current;if(!e||(v(),typeof ResizeObserver>`u`))return;let t=u.visiblePanel(e);if(!t)return;let n=new ResizeObserver(v);return n.observe(t),()=>n.disconnect()},[d,v]),t.n(()=>{let e=p.current;if(!e||!g)return;let t=setTimeout(()=>_(!1),o.n.activeDuration(getComputedStyle(e))+o.n.SETTLE_FRAME);return()=>clearTimeout(t)},[g,m]),(0,c.jsx)(n.default,{ref:p,component:`tabs.panels`,...l,variant:[l.variant,{resizing:g}],style:{height:m===void 0?void 0:`${m}px`,...l.style},props:a,children:i})}g.displayName=`Tabs.Panels`;function _(e){let{value:t,children:r,props:i,...a}=e,{value:o,keepMounted:s,tabId:l,panelId:u}=f(`Tabs.Panel`),d=o===t;return!d&&!s?null:(0,c.jsx)(n.default,{component:`tabs.panel`,...a,variant:[a.variant,{hidden:!d}],id:u(t),props:{role:`tabpanel`,"aria-labelledby":l(t),hidden:!d||void 0,tabIndex:0,...i},children:r})}_.displayName=`Tabs.Panel`;var v=p;v.List=m,v.Tab=h,v.Panels=g,v.Panel=_,v.displayName=`Tabs`,exports.default=v;
|
package/components/tabs.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { p as e } from "../platform.mjs";
|
|
3
3
|
import { n as t } from "../effects.mjs";
|
|
4
4
|
import n from "../box.mjs";
|
|
5
|
-
import { a as r
|
|
6
|
-
import { t as
|
|
5
|
+
import { a as r } from "../behavior.mjs";
|
|
6
|
+
import { t as i } from "../identity.mjs";
|
|
7
|
+
import { a } from "../reporting.mjs";
|
|
7
8
|
import { n as o } from "../motion.mjs";
|
|
8
9
|
import { createContext as s, useContext as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
9
10
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
@@ -107,10 +108,14 @@ function _(e) {
|
|
|
107
108
|
return t;
|
|
108
109
|
}
|
|
109
110
|
function v(e) {
|
|
110
|
-
let { children: r, value: o, defaultValue: s, onValueChange: c, orientation: u = "horizontal", activation: p = "automatic", loop: m = !0, keepMounted: _ = !1, indicator: v = "static", props: y, ...b } = e, x =
|
|
111
|
+
let { children: r, value: o, defaultValue: s, onValueChange: c, orientation: u = "horizontal", activation: p = "automatic", loop: m = !0, keepMounted: _ = !1, indicator: v = "static", props: y, ...b } = e, x = i("tabs"), [S, C] = a({
|
|
111
112
|
value: o,
|
|
112
113
|
defaultValue: s,
|
|
113
|
-
onChange: c
|
|
114
|
+
onChange: c,
|
|
115
|
+
interaction: {
|
|
116
|
+
component: "tabs",
|
|
117
|
+
type: "valueChange"
|
|
118
|
+
}
|
|
114
119
|
}), [w, T] = d(), [E, D] = d(!1);
|
|
115
120
|
t(() => {
|
|
116
121
|
S !== void 0 && T(S);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../box.cjs"),t=require("../
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../box.cjs"),t=require("../dates.cjs"),n=require("../reporting.cjs"),r=require("../date-environment.cjs"),i=require("./combobox.cjs");let a=require("react"),o=require("react/jsx-runtime");function s(e=t.M(),n=Date.now()){return e.map(e=>{let r=e===`UTC`?0:t.A(e,n),i=e.split(`/`),a=i[i.length-1].replace(/_/g,` `),o=`UTC${r===0?``:t.D(r)}`;return{id:e,city:a,region:i.length>1?i.slice(0,-1).join(`/`).replace(/_/g,` `):``,offset:r,offsetText:o,label:`${a} (${o})`}}).sort((e,t)=>e.offset-t.offset||e.city.localeCompare(t.city))}function c(e,t){let n=t.trim().toLowerCase().replace(/\s+/g,` `);if(!n)return!0;let r=e.offsetText.replace(/:00$/,``).replace(/([+-])0/,`$1`);return`${e.id} ${e.city} ${e.region} ${e.offsetText} ${r} gmt${e.offsetText.slice(3)}`.toLowerCase().replace(/_/g,` `).includes(n)}function l(l){let{value:u,defaultValue:d,onValueChange:f,zones:p,label:m,placeholder:h,name:g,disabled:_,props:v,emptyText:y=`No time zone matches`,...b}=l,x=r.n(),S=(0,a.useMemo)(()=>s(p),[p]),C=(0,a.useMemo)(()=>new Map(S.map(e=>[e.id,e])),[S]),[w,T]=n.a({value:u===void 0?void 0:u&&(t.k(u)??u),defaultValue:d===void 0?x.readerZone:d,onChange:f,interaction:{component:`timeZoneSelect`,type:`valueChange`}}),E=n.i(`timeZoneSelect`);return(0,o.jsx)(n.t,{children:(0,o.jsx)(i.default,{...b,onOpenChange:(e,t)=>E(`openChange`,e,t),data:S,def:{label:`label`,key:`id`,display:t=>(0,o.jsxs)(e.default,{display:`flex`,jc:`space-between`,gap:4,width:`fit`,children:[(0,o.jsx)(e.default,{tag:`span`,children:t.city}),(0,o.jsxs)(e.default,{tag:`span`,opacity:.7,fontSize:12,css:{fontVariantNumeric:`tabular-nums`},children:[t.region?`${t.region} · `:``,t.offsetText]})]})},value:(w?C.get(w):void 0)??null,onValueChange:(e,t)=>T(e?.id??null,t),filter:(e,t)=>e.filter(e=>c(e,t)),label:m,placeholder:h,name:g,disabled:_,emptyText:y,props:v})})}var u=l;u.displayName=`TimeZoneSelect`,exports.default=u;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e from "../box.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import
|
|
7
|
-
import { useMemo as
|
|
8
|
-
import { jsx as
|
|
3
|
+
import { A as t, D as n, M as r, k as i } from "../dates.mjs";
|
|
4
|
+
import { a, i as o, t as s } from "../reporting.mjs";
|
|
5
|
+
import { n as c } from "../date-environment.mjs";
|
|
6
|
+
import l from "./combobox.mjs";
|
|
7
|
+
import { useMemo as u } from "react";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
//#region src/utils/date/zoneOptions.ts
|
|
10
|
-
function
|
|
10
|
+
function p(e = r(), i = Date.now()) {
|
|
11
11
|
return e.map((e) => {
|
|
12
|
-
let
|
|
12
|
+
let r = e === "UTC" ? 0 : t(e, i), a = e.split("/"), o = a[a.length - 1].replace(/_/g, " "), s = `UTC${r === 0 ? "" : n(r)}`;
|
|
13
13
|
return {
|
|
14
14
|
id: e,
|
|
15
15
|
city: o,
|
|
16
16
|
region: a.length > 1 ? a.slice(0, -1).join("/").replace(/_/g, " ") : "",
|
|
17
|
-
offset:
|
|
17
|
+
offset: r,
|
|
18
18
|
offsetText: s,
|
|
19
19
|
label: `${o} (${s})`
|
|
20
20
|
};
|
|
21
21
|
}).sort((e, t) => e.offset - t.offset || e.city.localeCompare(t.city));
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function m(e, t) {
|
|
24
24
|
let n = t.trim().toLowerCase().replace(/\s+/g, " ");
|
|
25
25
|
if (!n) return !0;
|
|
26
26
|
let r = e.offsetText.replace(/:00$/, "").replace(/([+-])0/, "$1");
|
|
@@ -28,27 +28,32 @@ function f(e, t) {
|
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/components/timeZoneSelect.tsx
|
|
31
|
-
function
|
|
32
|
-
let { value:
|
|
33
|
-
value:
|
|
34
|
-
defaultValue:
|
|
35
|
-
onChange:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
function h(t) {
|
|
32
|
+
let { value: n, defaultValue: r, onValueChange: h, zones: g, label: _, placeholder: v, name: y, disabled: b, props: x, emptyText: S = "No time zone matches", ...C } = t, w = c(), T = u(() => p(g), [g]), E = u(() => new Map(T.map((e) => [e.id, e])), [T]), [D, O] = a({
|
|
33
|
+
value: n === void 0 ? void 0 : n && (i(n) ?? n),
|
|
34
|
+
defaultValue: r === void 0 ? w.readerZone : r,
|
|
35
|
+
onChange: h,
|
|
36
|
+
interaction: {
|
|
37
|
+
component: "timeZoneSelect",
|
|
38
|
+
type: "valueChange"
|
|
39
|
+
}
|
|
40
|
+
}), k = o("timeZoneSelect");
|
|
41
|
+
return /* @__PURE__ */ d(s, { children: /* @__PURE__ */ d(l, {
|
|
42
|
+
...C,
|
|
43
|
+
onOpenChange: (e, t) => k("openChange", e, t),
|
|
44
|
+
data: T,
|
|
40
45
|
def: {
|
|
41
46
|
label: "label",
|
|
42
47
|
key: "id",
|
|
43
|
-
display: (t) => /* @__PURE__ */
|
|
48
|
+
display: (t) => /* @__PURE__ */ f(e, {
|
|
44
49
|
display: "flex",
|
|
45
50
|
jc: "space-between",
|
|
46
51
|
gap: 4,
|
|
47
52
|
width: "fit",
|
|
48
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ d(e, {
|
|
49
54
|
tag: "span",
|
|
50
55
|
children: t.city
|
|
51
|
-
}), /* @__PURE__ */
|
|
56
|
+
}), /* @__PURE__ */ f(e, {
|
|
52
57
|
tag: "span",
|
|
53
58
|
opacity: .7,
|
|
54
59
|
fontSize: 12,
|
|
@@ -57,18 +62,18 @@ function p(n) {
|
|
|
57
62
|
})]
|
|
58
63
|
})
|
|
59
64
|
},
|
|
60
|
-
value: (
|
|
61
|
-
onValueChange: (e, t) =>
|
|
62
|
-
filter: (e, t) => e.filter((e) =>
|
|
63
|
-
label:
|
|
64
|
-
placeholder:
|
|
65
|
-
name:
|
|
66
|
-
disabled:
|
|
67
|
-
emptyText:
|
|
68
|
-
props:
|
|
69
|
-
});
|
|
65
|
+
value: (D ? E.get(D) : void 0) ?? null,
|
|
66
|
+
onValueChange: (e, t) => O(e?.id ?? null, t),
|
|
67
|
+
filter: (e, t) => e.filter((e) => m(e, t)),
|
|
68
|
+
label: _,
|
|
69
|
+
placeholder: v,
|
|
70
|
+
name: y,
|
|
71
|
+
disabled: b,
|
|
72
|
+
emptyText: S,
|
|
73
|
+
props: x
|
|
74
|
+
}) });
|
|
70
75
|
}
|
|
71
|
-
var
|
|
72
|
-
|
|
76
|
+
var g = h;
|
|
77
|
+
g.displayName = "TimeZoneSelect";
|
|
73
78
|
//#endregion
|
|
74
|
-
export {
|
|
79
|
+
export { g as default };
|
package/components/toaster.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("../platform.cjs"),t=require("../client.cjs"),n=require("../effects.cjs"),r=require("../interactions.cjs"),i=require("../box.cjs"),a=require("../reporting.cjs"),o=require("../layer.cjs"),s=require("../motion.cjs");let c=require("react"),l=require("react/jsx-runtime"),u=require("react-dom"),d=require("use-sync-external-store/shim");var f=[`value`],p={toasts:[],overflow:0},m=0;function h(){return m+=1,`toast-${m}`}function g(e){let t=[],n=p,i=e?.limit??3,a=e?.duration??5e3,o=!1,s=new Set,c=new Map,l=e=>{let t=c.get(e);t?.handle&&clearTimeout(t.handle),c.delete(e)},u=()=>{let e=0;t=t.map(t=>{let n=!t.open||e++<i;return t.visible===n?t:{...t,visible:n}}),n={toasts:t,overflow:Math.max(0,e-i)},d(),s.forEach(e=>e())};function d(){let e=new Set;for(let n of t){if(!n.open||!n.visible||!Number.isFinite(n.duration))continue;e.add(n.id);let t=c.get(n.id)??{handle:null,remaining:n.duration,startedAt:0};c.set(n.id,t),!(o||t.handle)&&(t.startedAt=Date.now(),t.handle=setTimeout(()=>{c.delete(n.id),g(n.id,`timeout`)},t.remaining))}for(let t of[...c.keys()])e.has(t)||l(t)}let m=(e,t)=>t??(e===`loading`?1/0:a);function g(e,n=`imperative`){let i=[];t=t.map(t=>!t.open||e!==void 0&&t.id!==e?t:(i.push(t),l(t.id),{...t,open:!1})),i.length&&(u(),i.forEach(e=>{e.onDismiss?.(n),r.t({component:`toaster`,type:`dismiss`,reason:n,value:e.message,details:{id:e.id,kind:e.kind},content:f})}))}function _(e,n,i){let a=!1;t=t.map(t=>{if(t.id!==e)return t;a=!0,l(e);let r=i?.kind??t.kind;return{...t,...i,id:e,message:n,kind:r,duration:i?.duration??(i?.kind?m(r):t.duration),open:!0}}),a&&(u(),r.t({component:`toaster`,type:`update`,reason:i?.kind,value:n,details:{id:e},source:`app`,content:f}))}function v(e,n){let i=n?.id??h();if(n?.id&&t.some(e=>e.id===i))return _(i,e,n),i;let a=n?.kind??`default`;return t=[...t,{id:i,kind:a,message:e,description:n?.description,duration:m(a,n?.duration),action:n?.action,dismissible:n?.dismissible??!0,onDismiss:n?.onDismiss,open:!0,visible:!1}],u(),r.t({component:`toaster`,type:`show`,reason:a,value:e,details:{id:i,kind:a},source:`app`,content:f}),i}return{subscribe(e){return s.add(e),()=>s.delete(e)},getSnapshot:()=>n,getServerSnapshot:()=>p,add:v,update:_,dismiss:g,remove(e){let n=t.filter(t=>t.id!==e);n.length!==t.length&&(l(e),t=n,u())},setLimit(e){e!==i&&(i=e,u())},setDefaultDuration(e){a=e},pause(){if(!o){o=!0;for(let e of c.values())e.handle&&(clearTimeout(e.handle),e.handle=null,e.remaining=Math.max(0,e.remaining-(Date.now()-e.startedAt)))}},resume(){o&&(o=!1,d())},reset(){for(let e of[...c.keys()])l(e);t=[],n=p,s.forEach(e=>e())}}}var _=g(),v=e=>(t,n)=>_.add(t,{...n,kind:e}),y=Object.assign((e,t)=>_.add(e,t),{success:v(`success`),error:v(`error`),warning:v(`warning`),info:v(`info`),loading:v(`loading`),update:(e,t,n)=>_.update(e,t,n),dismiss:e=>_.dismiss(e,`imperative`),promise(e,t,n){let r=_.add(t.loading,{...n,id:n?.id,kind:`loading`}),i=(e,t)=>typeof e==`function`?e(t):e;return e.then(e=>_.update(r,i(t.success,e),{kind:`success`}),e=>_.update(r,i(t.error,e),{kind:`error`})),e}}),b={"top-start":`topStart`,"top-center":`topCenter`,"top-end":`topEnd`,"bottom-start":`bottomStart`,"bottom-center":`bottomCenter`,"bottom-end":`bottomEnd`};function x(e,t){let n=t.toLowerCase().split(`+`),r=n[n.length-1],i=new Set(n.slice(0,-1));return e.key.toLowerCase()===r&&e.altKey===i.has(`alt`)&&e.ctrlKey===i.has(`ctrl`)&&e.shiftKey===i.has(`shift`)&&e.metaKey===i.has(`meta`)}function S(e){let{toast:t,store:r,fromTop:o,closeLabel:c}=e,{mounted:u,ref:d,props:f}=s.t({present:t.open}),p=a.i(`toaster`);if(n.n(()=>{u||r.remove(t.id)},[u,r,t.id]),!u)return null;let m=t.action,h=()=>{m?.onClick(),m?.closeOnClick===!1?p(`action`,t.message,{reason:`action`,id:t.id,kind:t.kind,content:[`value`]}):r.dismiss(t.id,`action`)};return(0,l.jsxs)(i.default,{ref:d,component:`toaster.toast`,variant:{[t.kind]:t.kind!=="default",fromTop:o},props:{...t.kind===`error`?{role:`alert`}:{},"data-toast-id":t.id,...f},children:[(0,l.jsx)(i.default,{component:`toaster.message`,children:t.message}),t.description!==void 0&&(0,l.jsx)(i.default,{component:`toaster.description`,children:t.description}),m&&(0,l.jsx)(i.default,{tag:`button`,component:`toaster.action`,props:{type:`button`,onClick:h},children:m.label}),t.dismissible&&(0,l.jsx)(i.default,{tag:`button`,component:`toaster.close`,props:{type:`button`,"aria-label":c,onClick:()=>r.dismiss(t.id,`close`)}})]})}function C(r){let{position:a=`bottom-end`,limit:s=3,duration:f=5e3,label:p=`Notifications`,closeLabel:m=`Close`,overflowLabel:h=e=>`+${e} more`,hotkey:g=`F6`,store:v=_,props:y,...C}=r,w=(0,d.useSyncExternalStore)(v.subscribe,v.getSnapshot,v.getServerSnapshot),T=o.n(),E=t.t(!T),D=(0,c.useRef)(null),O=(0,c.useRef)(null),k=(0,c.useRef)({hovered:!1,focused:!1,hidden:!1}),A=(0,c.useCallback)(()=>{let{hovered:e,focused:t,hidden:n}=k.current;e||t||n?v.pause():v.resume()},[v]);n.n(()=>v.setLimit(s),[v,s]),n.n(()=>v.setDefaultDuration(f),[v,f]),n.n(()=>{let t=D.current;!T||!e.c()||!t||!t.isConnected||t.matches(`:popover-open`)||t.showPopover()}),n.n(()=>{let t=e.t();if(!t)return;let n=new AbortController;return t.addEventListener(`visibilitychange`,()=>{k.current.hidden=t.hidden,A()},{signal:n.signal}),()=>n.abort()},[A]),n.n(()=>{let t=e.t();if(!g||!t)return;let n=new AbortController;return t.addEventListener(`keydown`,e=>{!x(e,g)||!D.current||(e.preventDefault(),O.current=t.activeElement,D.current.focus())},{signal:n.signal}),()=>n.abort()},[g]);let j=e=>!!e&&!!D.current?.contains(e),M=()=>{k.current.hovered=!0,A()},N=e=>{j(e.relatedTarget)||(k.current.hovered=!1,A())},P=e=>{k.current.focused=!0,A(),j(e.relatedTarget)||(O.current=e.relatedTarget)},F=e=>{j(e.relatedTarget)||(k.current.focused=!1,A())},I=e=>{if(e.key!==`Escape`)return;let t=(e.target.closest?.(`[data-toast-id]`))?.getAttribute(`data-toast-id`);t&&v.dismiss(t,`close`),v.getSnapshot().toasts.some(e=>e.open)?D.current?.focus():O.current?.focus()},L=a.startsWith(`top`),R=w.toasts.filter(e=>e.visible),z=L?[...R].reverse():R,B=w.overflow>0&&(0,l.jsx)(i.default,{component:`toaster.overflow`,children:h(w.overflow)}),V=(0,l.jsxs)(i.default,{tag:`section`,ref:D,component:`toaster`,...C,variant:[C.variant,{[b[a]]:!0}],props:{...T?{popover:`manual`}:{},"aria-live":`polite`,"aria-atomic":`false`,"aria-relevant":`additions text`,"aria-label":p,tabIndex:-1,...y,onPointerOver:M,onPointerOut:N,onFocus:P,onBlur:F,onKeyDown:I},children:[!L&&B,z.map(e=>(0,l.jsx)(S,{toast:e,store:v,fromTop:L,closeLabel:m},e.id)),L&&B]});return T?V:E?(0,u.createPortal)(V,E):null}var w=C;w.displayName=`Toaster`,exports.createToastStore=g,exports.default=w,exports.defaultToastStore=_,exports.toast=y;
|