@konstructio/ui 0.1.2-alpha.73 → 0.1.2-alpha.75

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