@konstructio/ui 0.1.2-alpha.34 → 0.1.2-alpha.35

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.
@@ -1,9 +1,9 @@
1
- import { jsx as a, jsxs as D, Fragment as ae } from "react/jsx-runtime";
1
+ import { jsx as i, jsxs as A, Fragment as ae } from "react/jsx-runtime";
2
2
  import { S as B } from "../../index-BtQfgaSF.js";
3
3
  import * as n from "react";
4
4
  import { useRef as xe, useEffect as be, useMemo as re, isValidElement as ne, useCallback as ge } from "react";
5
5
  import * as Se from "react-dom";
6
- import { P as A, c as Ie, a as Ne, b as x, d as Ae, u as De } from "../../index-CIAmiWcw.js";
6
+ import { P as D, c as Ne, a as Ie, b as x, d as Ae, u as De } from "../../index-CIAmiWcw.js";
7
7
  import { u as ie } from "../../index-DLcqcWxM.js";
8
8
  import { c as _e } from "../../index-CigKKiZS.js";
9
9
  import { B as Fe, R as Le } from "../../index-Dbt2vBmS.js";
@@ -27,8 +27,8 @@ var Ue = Object.freeze({
27
27
  whiteSpace: "nowrap",
28
28
  wordWrap: "normal"
29
29
  }), Xe = "VisuallyHidden", Q = n.forwardRef(
30
- (e, o) => /* @__PURE__ */ a(
31
- A.span,
30
+ (e, o) => /* @__PURE__ */ i(
31
+ D.span,
32
32
  {
33
33
  ...e,
34
34
  ref: o,
@@ -37,33 +37,33 @@ var Ue = Object.freeze({
37
37
  )
38
38
  );
39
39
  Q.displayName = Xe;
40
- var Z = "ToastProvider", [ee, Ye, $e] = _e("Toast"), [ce, St] = Ie("Toast", [$e]), [Be, Y] = ce(Z), ue = (e) => {
40
+ var Z = "ToastProvider", [ee, Ye, $e] = _e("Toast"), [ce, St] = Ne("Toast", [$e]), [Be, Y] = ce(Z), ue = (e) => {
41
41
  const {
42
42
  __scopeToast: o,
43
43
  label: r = "Notification",
44
44
  duration: t = 5e3,
45
- swipeDirection: c = "right",
45
+ swipeDirection: u = "right",
46
46
  swipeThreshold: d = 50,
47
- children: p
48
- } = e, [w, v] = n.useState(null), [i, E] = n.useState(0), T = n.useRef(!1), S = n.useRef(!1);
47
+ children: f
48
+ } = e, [w, v] = n.useState(null), [c, E] = n.useState(0), T = n.useRef(!1), N = n.useRef(!1);
49
49
  return r.trim() || console.error(
50
50
  `Invalid prop \`label\` supplied to \`${Z}\`. Expected non-empty \`string\`.`
51
- ), /* @__PURE__ */ a(ee.Provider, { scope: o, children: /* @__PURE__ */ a(
51
+ ), /* @__PURE__ */ i(ee.Provider, { scope: o, children: /* @__PURE__ */ i(
52
52
  Be,
53
53
  {
54
54
  scope: o,
55
55
  label: r,
56
56
  duration: t,
57
- swipeDirection: c,
57
+ swipeDirection: u,
58
58
  swipeThreshold: d,
59
- toastCount: i,
59
+ toastCount: c,
60
60
  viewport: w,
61
61
  onViewportChange: v,
62
- onToastAdd: n.useCallback(() => E((b) => b + 1), []),
63
- onToastRemove: n.useCallback(() => E((b) => b - 1), []),
62
+ onToastAdd: n.useCallback(() => E((R) => R + 1), []),
63
+ onToastRemove: n.useCallback(() => E((R) => R - 1), []),
64
64
  isFocusedToastEscapeKeyDownRef: T,
65
- isClosePausedRef: S,
66
- children: p
65
+ isClosePausedRef: N,
66
+ children: f
67
67
  }
68
68
  ) });
69
69
  };
@@ -73,95 +73,95 @@ var le = "ToastViewport", je = ["F8"], z = "toast.viewportPause", G = "toast.vie
73
73
  const {
74
74
  __scopeToast: r,
75
75
  hotkey: t = je,
76
- label: c = "Notifications ({hotkey})",
76
+ label: u = "Notifications ({hotkey})",
77
77
  ...d
78
- } = e, p = Y(le, r), w = Ye(r), v = n.useRef(null), i = n.useRef(null), E = n.useRef(null), T = n.useRef(null), S = ie(o, T, p.onViewportChange), b = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), R = p.toastCount > 0;
78
+ } = e, f = Y(le, r), w = Ye(r), v = n.useRef(null), c = n.useRef(null), E = n.useRef(null), T = n.useRef(null), N = ie(o, T, f.onViewportChange), R = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), b = f.toastCount > 0;
79
79
  n.useEffect(() => {
80
- const u = (h) => {
80
+ const s = (h) => {
81
81
  t.length !== 0 && t.every((m) => h[m] || h.code === m) && T.current?.focus();
82
82
  };
83
- return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
83
+ return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
84
84
  }, [t]), n.useEffect(() => {
85
- const u = v.current, h = T.current;
86
- if (R && u && h) {
87
- const f = () => {
88
- if (!p.isClosePausedRef.current) {
85
+ const s = v.current, h = T.current;
86
+ if (b && s && h) {
87
+ const p = () => {
88
+ if (!f.isClosePausedRef.current) {
89
89
  const y = new CustomEvent(z);
90
- h.dispatchEvent(y), p.isClosePausedRef.current = !0;
90
+ h.dispatchEvent(y), f.isClosePausedRef.current = !0;
91
91
  }
92
92
  }, m = () => {
93
- if (p.isClosePausedRef.current) {
93
+ if (f.isClosePausedRef.current) {
94
94
  const y = new CustomEvent(G);
95
- h.dispatchEvent(y), p.isClosePausedRef.current = !1;
95
+ h.dispatchEvent(y), f.isClosePausedRef.current = !1;
96
96
  }
97
97
  }, P = (y) => {
98
- !u.contains(y.relatedTarget) && m();
98
+ !s.contains(y.relatedTarget) && m();
99
99
  }, C = () => {
100
- u.contains(document.activeElement) || m();
100
+ s.contains(document.activeElement) || m();
101
101
  };
102
- return u.addEventListener("focusin", f), u.addEventListener("focusout", P), u.addEventListener("pointermove", f), u.addEventListener("pointerleave", C), window.addEventListener("blur", f), window.addEventListener("focus", m), () => {
103
- u.removeEventListener("focusin", f), u.removeEventListener("focusout", P), u.removeEventListener("pointermove", f), u.removeEventListener("pointerleave", C), window.removeEventListener("blur", f), window.removeEventListener("focus", m);
102
+ return s.addEventListener("focusin", p), s.addEventListener("focusout", P), s.addEventListener("pointermove", p), s.addEventListener("pointerleave", C), window.addEventListener("blur", p), window.addEventListener("focus", m), () => {
103
+ s.removeEventListener("focusin", p), s.removeEventListener("focusout", P), s.removeEventListener("pointermove", p), s.removeEventListener("pointerleave", C), window.removeEventListener("blur", p), window.removeEventListener("focus", m);
104
104
  };
105
105
  }
106
- }, [R, p.isClosePausedRef]);
106
+ }, [b, f.isClosePausedRef]);
107
107
  const l = n.useCallback(
108
- ({ tabbingDirection: u }) => {
109
- const f = w().map((m) => {
108
+ ({ tabbingDirection: s }) => {
109
+ const p = w().map((m) => {
110
110
  const P = m.ref.current, C = [P, ...at(P)];
111
- return u === "forwards" ? C : C.reverse();
111
+ return s === "forwards" ? C : C.reverse();
112
112
  });
113
- return (u === "forwards" ? f.reverse() : f).flat();
113
+ return (s === "forwards" ? p.reverse() : p).flat();
114
114
  },
115
115
  [w]
116
116
  );
117
117
  return n.useEffect(() => {
118
- const u = T.current;
119
- if (u) {
120
- const h = (f) => {
121
- const m = f.altKey || f.ctrlKey || f.metaKey;
122
- if (f.key === "Tab" && !m) {
123
- const C = document.activeElement, y = f.shiftKey;
124
- if (f.target === u && y) {
125
- i.current?.focus();
118
+ const s = T.current;
119
+ if (s) {
120
+ const h = (p) => {
121
+ const m = p.altKey || p.ctrlKey || p.metaKey;
122
+ if (p.key === "Tab" && !m) {
123
+ const C = document.activeElement, y = p.shiftKey;
124
+ if (p.target === s && y) {
125
+ c.current?.focus();
126
126
  return;
127
127
  }
128
- const F = l({ tabbingDirection: y ? "backwards" : "forwards" }), V = F.findIndex((N) => N === C);
129
- q(F.slice(V + 1)) ? f.preventDefault() : y ? i.current?.focus() : E.current?.focus();
128
+ const F = l({ tabbingDirection: y ? "backwards" : "forwards" }), V = F.findIndex((I) => I === C);
129
+ q(F.slice(V + 1)) ? p.preventDefault() : y ? c.current?.focus() : E.current?.focus();
130
130
  }
131
131
  };
132
- return u.addEventListener("keydown", h), () => u.removeEventListener("keydown", h);
132
+ return s.addEventListener("keydown", h), () => s.removeEventListener("keydown", h);
133
133
  }
134
- }, [w, l]), /* @__PURE__ */ D(
134
+ }, [w, l]), /* @__PURE__ */ A(
135
135
  Fe,
136
136
  {
137
137
  ref: v,
138
138
  role: "region",
139
- "aria-label": c.replace("{hotkey}", b),
139
+ "aria-label": u.replace("{hotkey}", R),
140
140
  tabIndex: -1,
141
- style: { pointerEvents: R ? void 0 : "none" },
141
+ style: { pointerEvents: b ? void 0 : "none" },
142
142
  children: [
143
- R && /* @__PURE__ */ a(
143
+ b && /* @__PURE__ */ i(
144
144
  J,
145
145
  {
146
- ref: i,
146
+ ref: c,
147
147
  onFocusFromOutsideViewport: () => {
148
- const u = l({
148
+ const s = l({
149
149
  tabbingDirection: "forwards"
150
150
  });
151
- q(u);
151
+ q(s);
152
152
  }
153
153
  }
154
154
  ),
155
- /* @__PURE__ */ a(ee.Slot, { scope: r, children: /* @__PURE__ */ a(A.ol, { tabIndex: -1, ...d, ref: S }) }),
156
- R && /* @__PURE__ */ a(
155
+ /* @__PURE__ */ i(ee.Slot, { scope: r, children: /* @__PURE__ */ i(D.ol, { tabIndex: -1, ...d, ref: N }) }),
156
+ b && /* @__PURE__ */ i(
157
157
  J,
158
158
  {
159
159
  ref: E,
160
160
  onFocusFromOutsideViewport: () => {
161
- const u = l({
161
+ const s = l({
162
162
  tabbingDirection: "backwards"
163
163
  });
164
- q(u);
164
+ q(s);
165
165
  }
166
166
  }
167
167
  )
@@ -171,61 +171,61 @@ var le = "ToastViewport", je = ["F8"], z = "toast.viewportPause", G = "toast.vie
171
171
  }
172
172
  );
173
173
  de.displayName = le;
174
- var pe = "ToastFocusProxy", J = n.forwardRef(
174
+ var fe = "ToastFocusProxy", J = n.forwardRef(
175
175
  (e, o) => {
176
- const { __scopeToast: r, onFocusFromOutsideViewport: t, ...c } = e, d = Y(pe, r);
177
- return /* @__PURE__ */ a(
176
+ const { __scopeToast: r, onFocusFromOutsideViewport: t, ...u } = e, d = Y(fe, r);
177
+ return /* @__PURE__ */ i(
178
178
  Q,
179
179
  {
180
180
  tabIndex: 0,
181
- ...c,
181
+ ...u,
182
182
  ref: o,
183
183
  style: { position: "fixed" },
184
- onFocus: (p) => {
185
- const w = p.relatedTarget;
184
+ onFocus: (f) => {
185
+ const w = f.relatedTarget;
186
186
  !d.viewport?.contains(w) && t();
187
187
  }
188
188
  }
189
189
  );
190
190
  }
191
191
  );
192
- J.displayName = pe;
193
- var O = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.swipeCancel", Je = "toast.swipeEnd", fe = n.forwardRef(
192
+ J.displayName = fe;
193
+ var O = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.swipeCancel", Je = "toast.swipeEnd", pe = n.forwardRef(
194
194
  (e, o) => {
195
- const { forceMount: r, open: t, defaultOpen: c, onOpenChange: d, ...p } = e, [w, v] = Ne({
195
+ const { forceMount: r, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [w, v] = Ie({
196
196
  prop: t,
197
- defaultProp: c ?? !0,
197
+ defaultProp: u ?? !0,
198
198
  onChange: d,
199
199
  caller: O
200
200
  });
201
- return /* @__PURE__ */ a(Oe, { present: r || w, children: /* @__PURE__ */ a(
201
+ return /* @__PURE__ */ i(Oe, { present: r || w, children: /* @__PURE__ */ i(
202
202
  et,
203
203
  {
204
204
  open: w,
205
- ...p,
205
+ ...f,
206
206
  ref: o,
207
207
  onClose: () => v(!1),
208
208
  onPause: X(e.onPause),
209
209
  onResume: X(e.onResume),
210
- onSwipeStart: x(e.onSwipeStart, (i) => {
211
- i.currentTarget.setAttribute("data-swipe", "start");
210
+ onSwipeStart: x(e.onSwipeStart, (c) => {
211
+ c.currentTarget.setAttribute("data-swipe", "start");
212
212
  }),
213
- onSwipeMove: x(e.onSwipeMove, (i) => {
214
- const { x: E, y: T } = i.detail.delta;
215
- i.currentTarget.setAttribute("data-swipe", "move"), i.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${E}px`), i.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${T}px`);
213
+ onSwipeMove: x(e.onSwipeMove, (c) => {
214
+ const { x: E, y: T } = c.detail.delta;
215
+ c.currentTarget.setAttribute("data-swipe", "move"), c.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${E}px`), c.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${T}px`);
216
216
  }),
217
- onSwipeCancel: x(e.onSwipeCancel, (i) => {
218
- i.currentTarget.setAttribute("data-swipe", "cancel"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), i.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), i.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
217
+ onSwipeCancel: x(e.onSwipeCancel, (c) => {
218
+ c.currentTarget.setAttribute("data-swipe", "cancel"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
219
219
  }),
220
- onSwipeEnd: x(e.onSwipeEnd, (i) => {
221
- const { x: E, y: T } = i.detail.delta;
222
- i.currentTarget.setAttribute("data-swipe", "end"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), i.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), i.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${E}px`), i.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${T}px`), v(!1);
220
+ onSwipeEnd: x(e.onSwipeEnd, (c) => {
221
+ const { x: E, y: T } = c.detail.delta;
222
+ c.currentTarget.setAttribute("data-swipe", "end"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), c.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${E}px`), c.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${T}px`), v(!1);
223
223
  })
224
224
  }
225
225
  ) });
226
226
  }
227
227
  );
228
- fe.displayName = O;
228
+ pe.displayName = O;
229
229
  var [Qe, Ze] = ce(O, {
230
230
  onClose() {
231
231
  }
@@ -234,44 +234,44 @@ var [Qe, Ze] = ce(O, {
234
234
  const {
235
235
  __scopeToast: r,
236
236
  type: t = "foreground",
237
- duration: c,
237
+ duration: u,
238
238
  open: d,
239
- onClose: p,
239
+ onClose: f,
240
240
  onEscapeKeyDown: w,
241
241
  onPause: v,
242
- onResume: i,
242
+ onResume: c,
243
243
  onSwipeStart: E,
244
244
  onSwipeMove: T,
245
- onSwipeCancel: S,
246
- onSwipeEnd: b,
247
- ...R
248
- } = e, l = Y(O, r), [u, h] = n.useState(null), f = ie(o, (s) => h(s)), m = n.useRef(null), P = n.useRef(null), C = c || l.duration, y = n.useRef(0), _ = n.useRef(C), k = n.useRef(0), { onToastAdd: F, onToastRemove: V } = l, N = X(() => {
249
- u?.contains(document.activeElement) && l.viewport?.focus(), p();
245
+ onSwipeCancel: N,
246
+ onSwipeEnd: R,
247
+ ...b
248
+ } = e, l = Y(O, r), [s, h] = n.useState(null), p = ie(o, (a) => h(a)), m = n.useRef(null), P = n.useRef(null), C = u || l.duration, y = n.useRef(0), _ = n.useRef(C), k = n.useRef(0), { onToastAdd: F, onToastRemove: V } = l, I = X(() => {
249
+ s?.contains(document.activeElement) && l.viewport?.focus(), f();
250
250
  }), K = n.useCallback(
251
- (s) => {
252
- !s || s === 1 / 0 || (window.clearTimeout(k.current), y.current = (/* @__PURE__ */ new Date()).getTime(), k.current = window.setTimeout(N, s));
251
+ (a) => {
252
+ !a || a === 1 / 0 || (window.clearTimeout(k.current), y.current = (/* @__PURE__ */ new Date()).getTime(), k.current = window.setTimeout(I, a));
253
253
  },
254
- [N]
254
+ [I]
255
255
  );
256
256
  n.useEffect(() => {
257
- const s = l.viewport;
258
- if (s) {
257
+ const a = l.viewport;
258
+ if (a) {
259
259
  const g = () => {
260
- K(_.current), i?.();
261
- }, I = () => {
260
+ K(_.current), c?.();
261
+ }, S = () => {
262
262
  const L = (/* @__PURE__ */ new Date()).getTime() - y.current;
263
263
  _.current = _.current - L, window.clearTimeout(k.current), v?.();
264
264
  };
265
- return s.addEventListener(z, I), s.addEventListener(G, g), () => {
266
- s.removeEventListener(z, I), s.removeEventListener(G, g);
265
+ return a.addEventListener(z, S), a.addEventListener(G, g), () => {
266
+ a.removeEventListener(z, S), a.removeEventListener(G, g);
267
267
  };
268
268
  }
269
- }, [l.viewport, C, v, i, K]), n.useEffect(() => {
269
+ }, [l.viewport, C, v, c, K]), n.useEffect(() => {
270
270
  d && !l.isClosePausedRef.current && K(C);
271
271
  }, [d, C, l.isClosePausedRef, K]), n.useEffect(() => (F(), () => V()), [F, V]);
272
- const te = n.useMemo(() => u ? Pe(u) : null, [u]);
273
- return l.viewport ? /* @__PURE__ */ D(ae, { children: [
274
- te && /* @__PURE__ */ a(
272
+ const te = n.useMemo(() => s ? Pe(s) : null, [s]);
273
+ return l.viewport ? /* @__PURE__ */ A(ae, { children: [
274
+ te && /* @__PURE__ */ i(
275
275
  tt,
276
276
  {
277
277
  __scopeToast: r,
@@ -280,47 +280,47 @@ var [Qe, Ze] = ce(O, {
280
280
  children: te
281
281
  }
282
282
  ),
283
- /* @__PURE__ */ a(Qe, { scope: r, onClose: N, children: Se.createPortal(
284
- /* @__PURE__ */ a(ee.ItemSlot, { scope: r, children: /* @__PURE__ */ a(
283
+ /* @__PURE__ */ i(Qe, { scope: r, onClose: I, children: Se.createPortal(
284
+ /* @__PURE__ */ i(ee.ItemSlot, { scope: r, children: /* @__PURE__ */ i(
285
285
  Le,
286
286
  {
287
287
  asChild: !0,
288
288
  onEscapeKeyDown: x(w, () => {
289
- l.isFocusedToastEscapeKeyDownRef.current || N(), l.isFocusedToastEscapeKeyDownRef.current = !1;
289
+ l.isFocusedToastEscapeKeyDownRef.current || I(), l.isFocusedToastEscapeKeyDownRef.current = !1;
290
290
  }),
291
- children: /* @__PURE__ */ a(
292
- A.li,
291
+ children: /* @__PURE__ */ i(
292
+ D.li,
293
293
  {
294
294
  tabIndex: 0,
295
295
  "data-state": d ? "open" : "closed",
296
296
  "data-swipe-direction": l.swipeDirection,
297
- ...R,
298
- ref: f,
297
+ ...b,
298
+ ref: p,
299
299
  style: { userSelect: "none", touchAction: "none", ...e.style },
300
- onKeyDown: x(e.onKeyDown, (s) => {
301
- s.key === "Escape" && (w?.(s.nativeEvent), s.nativeEvent.defaultPrevented || (l.isFocusedToastEscapeKeyDownRef.current = !0, N()));
300
+ onKeyDown: x(e.onKeyDown, (a) => {
301
+ a.key === "Escape" && (w?.(a.nativeEvent), a.nativeEvent.defaultPrevented || (l.isFocusedToastEscapeKeyDownRef.current = !0, I()));
302
302
  }),
303
- onPointerDown: x(e.onPointerDown, (s) => {
304
- s.button === 0 && (m.current = { x: s.clientX, y: s.clientY });
303
+ onPointerDown: x(e.onPointerDown, (a) => {
304
+ a.button === 0 && (m.current = { x: a.clientX, y: a.clientY });
305
305
  }),
306
- onPointerMove: x(e.onPointerMove, (s) => {
306
+ onPointerMove: x(e.onPointerMove, (a) => {
307
307
  if (!m.current) return;
308
- const g = s.clientX - m.current.x, I = s.clientY - m.current.y, L = !!P.current, M = ["left", "right"].includes(l.swipeDirection), H = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Ce = M ? H(0, g) : 0, Re = M ? 0 : H(0, I), $ = s.pointerType === "touch" ? 10 : 2, W = { x: Ce, y: Re }, oe = { originalEvent: s, delta: W };
308
+ const g = a.clientX - m.current.x, S = a.clientY - m.current.y, L = !!P.current, M = ["left", "right"].includes(l.swipeDirection), H = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Ce = M ? H(0, g) : 0, Re = M ? 0 : H(0, S), $ = a.pointerType === "touch" ? 10 : 2, W = { x: Ce, y: Re }, oe = { originalEvent: a, delta: W };
309
309
  L ? (P.current = W, U(ze, T, oe, {
310
310
  discrete: !1
311
311
  })) : se(W, l.swipeDirection, $) ? (P.current = W, U(qe, E, oe, {
312
312
  discrete: !1
313
- }), s.target.setPointerCapture(s.pointerId)) : (Math.abs(g) > $ || Math.abs(I) > $) && (m.current = null);
313
+ }), a.target.setPointerCapture(a.pointerId)) : (Math.abs(g) > $ || Math.abs(S) > $) && (m.current = null);
314
314
  }),
315
- onPointerUp: x(e.onPointerUp, (s) => {
316
- const g = P.current, I = s.target;
317
- if (I.hasPointerCapture(s.pointerId) && I.releasePointerCapture(s.pointerId), P.current = null, m.current = null, g) {
318
- const L = s.currentTarget, M = { originalEvent: s, delta: g };
319
- se(g, l.swipeDirection, l.swipeThreshold) ? U(Je, b, M, {
315
+ onPointerUp: x(e.onPointerUp, (a) => {
316
+ const g = P.current, S = a.target;
317
+ if (S.hasPointerCapture(a.pointerId) && S.releasePointerCapture(a.pointerId), P.current = null, m.current = null, g) {
318
+ const L = a.currentTarget, M = { originalEvent: a, delta: g };
319
+ se(g, l.swipeDirection, l.swipeThreshold) ? U(Je, R, M, {
320
320
  discrete: !0
321
321
  }) : U(
322
322
  Ge,
323
- S,
323
+ N,
324
324
  M,
325
325
  {
326
326
  discrete: !0
@@ -339,33 +339,33 @@ var [Qe, Ze] = ce(O, {
339
339
  ] }) : null;
340
340
  }
341
341
  ), tt = (e) => {
342
- const { __scopeToast: o, children: r, ...t } = e, c = Y(O, o), [d, p] = n.useState(!1), [w, v] = n.useState(!1);
343
- return nt(() => p(!0)), n.useEffect(() => {
344
- const i = window.setTimeout(() => v(!0), 1e3);
345
- return () => window.clearTimeout(i);
346
- }, []), w ? null : /* @__PURE__ */ a(Me, { asChild: !0, children: /* @__PURE__ */ a(Q, { ...t, children: d && /* @__PURE__ */ D(ae, { children: [
347
- c.label,
342
+ const { __scopeToast: o, children: r, ...t } = e, u = Y(O, o), [d, f] = n.useState(!1), [w, v] = n.useState(!1);
343
+ return nt(() => f(!0)), n.useEffect(() => {
344
+ const c = window.setTimeout(() => v(!0), 1e3);
345
+ return () => window.clearTimeout(c);
346
+ }, []), w ? null : /* @__PURE__ */ i(Me, { asChild: !0, children: /* @__PURE__ */ i(Q, { ...t, children: d && /* @__PURE__ */ A(ae, { children: [
347
+ u.label,
348
348
  " ",
349
349
  r
350
350
  ] }) }) });
351
351
  }, ot = "ToastTitle", me = n.forwardRef(
352
352
  (e, o) => {
353
353
  const { __scopeToast: r, ...t } = e;
354
- return /* @__PURE__ */ a(A.div, { ...t, ref: o });
354
+ return /* @__PURE__ */ i(D.div, { ...t, ref: o });
355
355
  }
356
356
  );
357
357
  me.displayName = ot;
358
358
  var rt = "ToastDescription", we = n.forwardRef(
359
359
  (e, o) => {
360
360
  const { __scopeToast: r, ...t } = e;
361
- return /* @__PURE__ */ a(A.div, { ...t, ref: o });
361
+ return /* @__PURE__ */ i(D.div, { ...t, ref: o });
362
362
  }
363
363
  );
364
364
  we.displayName = rt;
365
365
  var Te = "ToastAction", ve = n.forwardRef(
366
366
  (e, o) => {
367
367
  const { altText: r, ...t } = e;
368
- return r.trim() ? /* @__PURE__ */ a(he, { altText: r, asChild: !0, children: /* @__PURE__ */ a(ye, { ...t, ref: o }) }) : (console.error(
368
+ return r.trim() ? /* @__PURE__ */ i(he, { altText: r, asChild: !0, children: /* @__PURE__ */ i(ye, { ...t, ref: o }) }) : (console.error(
369
369
  `Invalid prop \`altText\` supplied to \`${Te}\`. Expected non-empty \`string\`.`
370
370
  ), null);
371
371
  }
@@ -373,27 +373,27 @@ var Te = "ToastAction", ve = n.forwardRef(
373
373
  ve.displayName = Te;
374
374
  var Ee = "ToastClose", ye = n.forwardRef(
375
375
  (e, o) => {
376
- const { __scopeToast: r, ...t } = e, c = Ze(Ee, r);
377
- return /* @__PURE__ */ a(he, { asChild: !0, children: /* @__PURE__ */ a(
378
- A.button,
376
+ const { __scopeToast: r, ...t } = e, u = Ze(Ee, r);
377
+ return /* @__PURE__ */ i(he, { asChild: !0, children: /* @__PURE__ */ i(
378
+ D.button,
379
379
  {
380
380
  type: "button",
381
381
  ...t,
382
382
  ref: o,
383
- onClick: x(e.onClick, c.onClose)
383
+ onClick: x(e.onClick, u.onClose)
384
384
  }
385
385
  ) });
386
386
  }
387
387
  );
388
388
  ye.displayName = Ee;
389
389
  var he = n.forwardRef((e, o) => {
390
- const { __scopeToast: r, altText: t, ...c } = e;
391
- return /* @__PURE__ */ a(
392
- A.div,
390
+ const { __scopeToast: r, altText: t, ...u } = e;
391
+ return /* @__PURE__ */ i(
392
+ D.div,
393
393
  {
394
394
  "data-radix-toast-announce-exclude": "",
395
395
  "data-radix-toast-announce-alt": t || void 0,
396
- ...c,
396
+ ...u,
397
397
  ref: o
398
398
  }
399
399
  );
@@ -402,23 +402,23 @@ function Pe(e) {
402
402
  const o = [];
403
403
  return Array.from(e.childNodes).forEach((t) => {
404
404
  if (t.nodeType === t.TEXT_NODE && t.textContent && o.push(t.textContent), st(t)) {
405
- const c = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
406
- if (!c)
405
+ const u = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
406
+ if (!u)
407
407
  if (d) {
408
- const p = t.dataset.radixToastAnnounceAlt;
409
- p && o.push(p);
408
+ const f = t.dataset.radixToastAnnounceAlt;
409
+ f && o.push(f);
410
410
  } else
411
411
  o.push(...Pe(t));
412
412
  }
413
413
  }), o;
414
414
  }
415
415
  function U(e, o, r, { discrete: t }) {
416
- const c = r.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: r });
417
- o && c.addEventListener(e, o, { once: !0 }), t ? Ae(c, d) : c.dispatchEvent(d);
416
+ const u = r.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: r });
417
+ o && u.addEventListener(e, o, { once: !0 }), t ? Ae(u, d) : u.dispatchEvent(d);
418
418
  }
419
419
  var se = (e, o, r = 0) => {
420
- const t = Math.abs(e.x), c = Math.abs(e.y), d = t > c;
421
- return o === "left" || o === "right" ? d && t > r : !d && c > r;
420
+ const t = Math.abs(e.x), u = Math.abs(e.y), d = t > u;
421
+ return o === "left" || o === "right" ? d && t > r : !d && u > r;
422
422
  };
423
423
  function nt(e = () => {
424
424
  }) {
@@ -436,8 +436,8 @@ function st(e) {
436
436
  function at(e) {
437
437
  const o = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
438
438
  acceptNode: (t) => {
439
- const c = t.tagName === "INPUT" && t.type === "hidden";
440
- return t.disabled || t.hidden || c ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
439
+ const u = t.tagName === "INPUT" && t.type === "hidden";
440
+ return t.disabled || t.hidden || u ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
441
441
  }
442
442
  });
443
443
  for (; r.nextNode(); ) o.push(r.currentNode);
@@ -447,40 +447,43 @@ function q(e) {
447
447
  const o = document.activeElement;
448
448
  return e.some((r) => r === o ? !0 : (r.focus(), document.activeElement !== o));
449
449
  }
450
- var it = ue, ct = de, ut = fe, lt = me, dt = we, pt = ve;
451
- const It = ({
450
+ var it = ue, ct = de, ut = pe, lt = me, dt = we, ft = ve;
451
+ const Nt = ({
452
452
  title: e,
453
453
  duration: o = 5e3,
454
454
  titleClassName: r,
455
455
  descriptionClassName: t,
456
- description: c,
456
+ description: u,
457
457
  children: d,
458
- theme: p,
458
+ theme: f,
459
459
  showCloseButton: w = !0,
460
460
  closeButtonClassName: v,
461
- className: i,
461
+ className: c,
462
462
  open: E = !1,
463
- setOpen: T
463
+ setOpen: T,
464
+ variant: N
464
465
  }) => {
465
- const S = xe(0);
466
- be(() => () => clearTimeout(S.current), []);
467
- const b = re(() => ne(e) ? /* @__PURE__ */ a(B, { className: r, children: e }) : e, [e, r]), R = re(() => ne(c) ? /* @__PURE__ */ a(B, { className: t, children: c }) : c, [c, t]), l = ge(() => {
468
- T(!1), S.current = window.setTimeout(() => T(!0), 100);
466
+ const R = xe(0);
467
+ be(() => () => clearTimeout(R.current), []);
468
+ const b = re(() => ne(e) ? /* @__PURE__ */ i(B, { className: r, children: e }) : e, [e, r]), l = re(() => ne(u) ? /* @__PURE__ */ i(B, { className: t, children: u }) : u, [u, t]), s = ge(() => {
469
+ T(!1), R.current = window.setTimeout(() => T(!0), 100);
469
470
  }, [T]);
470
- return /* @__PURE__ */ D(it, { swipeDirection: "right", duration: o, children: [
471
- /* @__PURE__ */ a(B, { onClick: l, children: d }),
472
- /* @__PURE__ */ D(
471
+ return /* @__PURE__ */ A(it, { swipeDirection: "right", duration: o, children: [
472
+ /* @__PURE__ */ i(B, { onClick: s, children: d }),
473
+ /* @__PURE__ */ A(
473
474
  ut,
474
475
  {
475
- className: j(Ke({ className: i })),
476
- "data-theme": p,
476
+ className: j(Ke({ variant: N, className: c })),
477
+ "data-theme": f,
477
478
  open: E,
478
479
  onOpenChange: T,
479
480
  children: [
480
- /* @__PURE__ */ a(lt, { asChild: !0, className: r, children: b }),
481
- R && /* @__PURE__ */ a(dt, { asChild: !0, children: R }),
482
- w && /* @__PURE__ */ a(pt, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ D("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
483
- /* @__PURE__ */ a(
481
+ /* @__PURE__ */ A("div", { className: "flex gap-2 items-center flex-1", children: [
482
+ /* @__PURE__ */ i(lt, { asChild: !0, className: r, children: b }),
483
+ l && /* @__PURE__ */ i(dt, { asChild: !0, children: l })
484
+ ] }),
485
+ w && /* @__PURE__ */ i(ft, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ A("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
486
+ /* @__PURE__ */ i(
484
487
  We,
485
488
  {
486
489
  className: j(
@@ -490,14 +493,14 @@ const It = ({
490
493
  )
491
494
  }
492
495
  ),
493
- /* @__PURE__ */ a(ke, { children: "Close toast" })
496
+ /* @__PURE__ */ i(ke, { children: "Close toast" })
494
497
  ] }) })
495
498
  ]
496
499
  }
497
500
  ),
498
- /* @__PURE__ */ a(ct, { className: j(He()) })
501
+ /* @__PURE__ */ i(ct, { className: j(He()) })
499
502
  ] });
500
503
  };
501
504
  export {
502
- It as Toast
505
+ Nt as Toast
503
506
  };