@konstructio/ui 0.1.2-alpha.20 → 0.1.2-alpha.22

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 (103) hide show
  1. package/dist/{Modal-B8jrP02v.js → Modal-Dpk-1N9W.js} +2 -2
  2. package/dist/chevron-down-DgT-uSF9.js +5 -0
  3. package/dist/chevron-right-DYvXLeql.js +7 -0
  4. package/dist/components/Alert/Alert.js +2 -2
  5. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  6. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  7. package/dist/components/AlertDialog/components/index.js +1 -1
  8. package/dist/components/Badge/Badge.js +2 -8
  9. package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
  10. package/dist/components/Breadcrumb/components/Item/Item.js +1 -1
  11. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  12. package/dist/components/Button/Button.js +1 -1
  13. package/dist/components/Checkbox/Checkbox.js +6 -7
  14. package/dist/components/Command/Command.js +2 -2
  15. package/dist/components/Command/components/Command.js +1 -1
  16. package/dist/components/Command/components/CommandEmpty.js +1 -1
  17. package/dist/components/Command/components/CommandGroup.js +1 -1
  18. package/dist/components/Command/components/CommandInput.js +2 -2
  19. package/dist/components/Command/components/CommandItem.js +1 -1
  20. package/dist/components/Command/components/CommandList.js +1 -1
  21. package/dist/components/Command/components/CommandSeparator.js +1 -1
  22. package/dist/components/Command/components/DialogContent.js +2 -2
  23. package/dist/components/Command/components/DialogOverlay.js +1 -1
  24. package/dist/components/Datepicker/DatePicker.js +1 -1
  25. package/dist/components/Dropdown/components/List/List.js +1 -1
  26. package/dist/components/Dropdown/components/Wrapper.js +52 -64
  27. package/dist/components/DropdownButton/DropdownButton.js +1 -1
  28. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +1 -1
  29. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +1 -1
  30. package/dist/components/Input/Input.js +1 -1
  31. package/dist/components/Loading/Loading.js +1 -7
  32. package/dist/components/Modal/Modal.js +1 -1
  33. package/dist/components/Modal/components/Body/Body.js +1 -1
  34. package/dist/components/Modal/components/Footer/Footer.js +1 -1
  35. package/dist/components/Modal/components/Header/Header.js +1 -1
  36. package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -3
  37. package/dist/components/Modal/components/index.js +1 -1
  38. package/dist/components/NumberInput/NumberInput.js +2 -2
  39. package/dist/components/PieChart/PieChart.js +0 -18
  40. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  41. package/dist/components/Range/Range.js +1 -1
  42. package/dist/components/Slider/Slider.js +1 -1
  43. package/dist/components/Switch/Switch.js +10 -11
  44. package/dist/components/Tabs/Tabs.js +1 -1
  45. package/dist/components/Tabs/components/Content.js +1 -1
  46. package/dist/components/Tabs/components/List.js +1 -1
  47. package/dist/components/Tabs/components/Trigger.js +1 -1
  48. package/dist/components/Tag/Tag.js +1 -1
  49. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +2 -2
  50. package/dist/components/TimePicker/components/Wrapper/Wrapper.js +1 -1
  51. package/dist/components/Toast/Toast.js +233 -210
  52. package/dist/components/Tooltip/Tooltip.js +1 -1
  53. package/dist/components/VirtualizedTable/VirtualizedTable.js +64 -67
  54. package/dist/components/VirtualizedTable/components/Actions/Actions.js +2 -2
  55. package/dist/components/VirtualizedTable/components/Body/Body.js +36 -22
  56. package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +1 -1
  57. package/dist/components/VirtualizedTable/components/Header/Header.js +40 -38
  58. package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +23 -16
  59. package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +52 -0
  60. package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +263 -236
  61. package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +27 -0
  62. package/dist/components/VirtualizedTable/components/index.js +8 -6
  63. package/dist/components/VirtualizedTable/contexts/table.context.js +1 -0
  64. package/dist/components/VirtualizedTable/contexts/table.provider.js +43 -42
  65. package/dist/components/index.js +1 -1
  66. package/dist/contexts/theme.provider.js +0 -1
  67. package/dist/{createLucideIcon-DGhJ8Z4k.js → createLucideIcon-D4r5Phnh.js} +0 -24
  68. package/dist/{ellipsis-vertical-DpnVYRxI.js → ellipsis-vertical-BVPtjl5f.js} +1 -7
  69. package/dist/{index-N2OStZoU.js → index--V_ZsiQe.js} +0 -21
  70. package/dist/{index-bwWKd82e.js → index-BbQkJE5L.js} +1 -1
  71. package/dist/index-BtQfgaSF.js +60 -0
  72. package/dist/index-CIAmiWcw.js +200 -0
  73. package/dist/index-CSFe9uC5.js +14 -0
  74. package/dist/{index-Dx2grAuN.js → index-CSWGJT-v.js} +0 -20
  75. package/dist/index-CigKKiZS.js +91 -0
  76. package/dist/index-DDByhzds.js +137 -0
  77. package/dist/{index-DQJhMz8c.js → index-DH2Fnov1.js} +11 -12
  78. package/dist/index-DLcqcWxM.js +29 -0
  79. package/dist/{index-CffpTFMi.js → index-Dbt2vBmS.js} +5 -6
  80. package/dist/{index-l3NwplN0.js → index-DpW9ExsS.js} +10 -11
  81. package/dist/index-DrWQH0QF.js +55 -0
  82. package/dist/{index-0XtjXVpJ.js → index-X4k_cU8k.js} +4 -4
  83. package/dist/index-kyuBfLcN.js +479 -0
  84. package/dist/{index-C1g_chDT.js → index-mPY_8Y5v.js} +2 -2
  85. package/dist/{index-BAEWsOG1.js → index-ohdbKsws.js} +1 -1
  86. package/dist/index.d.ts +9 -0
  87. package/dist/index.js +1 -1
  88. package/dist/package.json +17 -17
  89. package/dist/styles.css +1 -1
  90. package/dist/{useBreadcrumb-B8DnuqkR.js → useBreadcrumb-BAHbGQ_O.js} +0 -10
  91. package/dist/{x-4F_5p77m.js → x-DPU9OdYH.js} +1 -1
  92. package/package.json +17 -17
  93. package/dist/chevron-down-J5nS1Tu0.js +0 -11
  94. package/dist/chevron-right-DeMVrnIg.js +0 -19
  95. package/dist/components/Skeleton/Skeleton.js +0 -42
  96. package/dist/index-BVRIAMfe.js +0 -36
  97. package/dist/index-BfXxHr_2.js +0 -125
  98. package/dist/index-Bn4c-gww.js +0 -131
  99. package/dist/index-Cvx4lqTq.js +0 -47
  100. package/dist/index-DQH6odE9.js +0 -82
  101. package/dist/index-DdXGVVBv.js +0 -15
  102. package/dist/index-amYX3uxF.js +0 -436
  103. package/dist/index-sp5ZfG6g.js +0 -31
@@ -1,114 +1,137 @@
1
- import { jsx as i, jsxs as A, Fragment as se } from "react/jsx-runtime";
2
- import { u as ae, S as B } from "../../index-DQH6odE9.js";
1
+ import { jsx as a, jsxs as D, Fragment as ae } from "react/jsx-runtime";
2
+ import { S as B } from "../../index-BtQfgaSF.js";
3
3
  import * as n from "react";
4
- import { useRef as xe, useEffect as be, useMemo as oe, isValidElement as re, useCallback as ge } from "react";
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 { c as Ie, a as Ne, b as x, u as Ae } from "../../index-BfXxHr_2.js";
7
- import { c as De } from "../../index-Cvx4lqTq.js";
8
- import { B as Fe, R as _e } from "../../index-CffpTFMi.js";
9
- import { P as Le } from "../../index-DdXGVVBv.js";
10
- import { P as Me } from "../../index-C1g_chDT.js";
11
- import { P as D, d as Oe } from "../../index-BVRIAMfe.js";
12
- import { u as $ } from "../../index-0ioNhtNM.js";
13
- import { V as ie, R as ke } from "../../index-sp5ZfG6g.js";
6
+ import { P as A, c as Ie, a as Ne, b as x, d as Ae, u as De } from "../../index-CIAmiWcw.js";
7
+ import { u as ie } from "../../index-DLcqcWxM.js";
8
+ import { c as _e } from "../../index-CigKKiZS.js";
9
+ import { B as Fe, R as Le } from "../../index-Dbt2vBmS.js";
10
+ import { P as Me } from "../../index-CSFe9uC5.js";
11
+ import { P as Oe } from "../../index-mPY_8Y5v.js";
12
+ import { u as X } from "../../index-0ioNhtNM.js";
13
+ import { R as ke } from "../../index-DrWQH0QF.js";
14
14
  import { cn as j } from "../../utils/index.js";
15
15
  import { closeToastVariants as Ve, toastVariants as Ke, viewportToastVariants as He } from "./Toast.variants.js";
16
- import { X as We } from "../../x-4F_5p77m.js";
17
- var Q = "ToastProvider", [Z, Xe, $e] = De("Toast"), [ce, bt] = Ie("Toast", [$e]), [Ue, U] = ce(Q), ue = (e) => {
16
+ import { X as We } from "../../x-DPU9OdYH.js";
17
+ var Ue = Object.freeze({
18
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
19
+ position: "absolute",
20
+ border: 0,
21
+ width: 1,
22
+ height: 1,
23
+ padding: 0,
24
+ margin: -1,
25
+ overflow: "hidden",
26
+ clip: "rect(0, 0, 0, 0)",
27
+ whiteSpace: "nowrap",
28
+ wordWrap: "normal"
29
+ }), Xe = "VisuallyHidden", Q = n.forwardRef(
30
+ (e, o) => /* @__PURE__ */ a(
31
+ A.span,
32
+ {
33
+ ...e,
34
+ ref: o,
35
+ style: { ...Ue, ...e.style }
36
+ }
37
+ )
38
+ );
39
+ Q.displayName = Xe;
40
+ var Z = "ToastProvider", [ee, Ye, $e] = _e("Toast"), [ce, St] = Ie("Toast", [$e]), [Be, Y] = ce(Z), ue = (e) => {
18
41
  const {
19
- __scopeToast: r,
20
- label: o = "Notification",
42
+ __scopeToast: o,
43
+ label: r = "Notification",
21
44
  duration: t = 5e3,
22
45
  swipeDirection: c = "right",
23
46
  swipeThreshold: d = 50,
24
- children: f
25
- } = e, [T, v] = n.useState(null), [a, E] = n.useState(0), w = n.useRef(!1), S = n.useRef(!1);
26
- return o.trim() || console.error(
27
- `Invalid prop \`label\` supplied to \`${Q}\`. Expected non-empty \`string\`.`
28
- ), /* @__PURE__ */ i(Z.Provider, { scope: r, children: /* @__PURE__ */ i(
29
- Ue,
47
+ children: p
48
+ } = e, [w, v] = n.useState(null), [i, E] = n.useState(0), T = n.useRef(!1), S = n.useRef(!1);
49
+ return r.trim() || console.error(
50
+ `Invalid prop \`label\` supplied to \`${Z}\`. Expected non-empty \`string\`.`
51
+ ), /* @__PURE__ */ a(ee.Provider, { scope: o, children: /* @__PURE__ */ a(
52
+ Be,
30
53
  {
31
- scope: r,
32
- label: o,
54
+ scope: o,
55
+ label: r,
33
56
  duration: t,
34
57
  swipeDirection: c,
35
58
  swipeThreshold: d,
36
- toastCount: a,
37
- viewport: T,
59
+ toastCount: i,
60
+ viewport: w,
38
61
  onViewportChange: v,
39
62
  onToastAdd: n.useCallback(() => E((b) => b + 1), []),
40
63
  onToastRemove: n.useCallback(() => E((b) => b - 1), []),
41
- isFocusedToastEscapeKeyDownRef: w,
64
+ isFocusedToastEscapeKeyDownRef: T,
42
65
  isClosePausedRef: S,
43
- children: f
66
+ children: p
44
67
  }
45
68
  ) });
46
69
  };
47
- ue.displayName = Q;
48
- var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.viewportResume", de = n.forwardRef(
49
- (e, r) => {
70
+ ue.displayName = Z;
71
+ var le = "ToastViewport", je = ["F8"], z = "toast.viewportPause", G = "toast.viewportResume", de = n.forwardRef(
72
+ (e, o) => {
50
73
  const {
51
- __scopeToast: o,
52
- hotkey: t = Ye,
74
+ __scopeToast: r,
75
+ hotkey: t = je,
53
76
  label: c = "Notifications ({hotkey})",
54
77
  ...d
55
- } = e, f = U(le, o), T = Xe(o), v = n.useRef(null), a = n.useRef(null), E = n.useRef(null), w = n.useRef(null), S = ae(r, w, f.onViewportChange), b = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), R = f.toastCount > 0;
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;
56
79
  n.useEffect(() => {
57
80
  const u = (h) => {
58
- t.length !== 0 && t.every((m) => h[m] || h.code === m) && w.current?.focus();
81
+ t.length !== 0 && t.every((m) => h[m] || h.code === m) && T.current?.focus();
59
82
  };
60
83
  return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
61
84
  }, [t]), n.useEffect(() => {
62
- const u = v.current, h = w.current;
85
+ const u = v.current, h = T.current;
63
86
  if (R && u && h) {
64
- const p = () => {
65
- if (!f.isClosePausedRef.current) {
87
+ const f = () => {
88
+ if (!p.isClosePausedRef.current) {
66
89
  const y = new CustomEvent(z);
67
- h.dispatchEvent(y), f.isClosePausedRef.current = !0;
90
+ h.dispatchEvent(y), p.isClosePausedRef.current = !0;
68
91
  }
69
92
  }, m = () => {
70
- if (f.isClosePausedRef.current) {
93
+ if (p.isClosePausedRef.current) {
71
94
  const y = new CustomEvent(G);
72
- h.dispatchEvent(y), f.isClosePausedRef.current = !1;
95
+ h.dispatchEvent(y), p.isClosePausedRef.current = !1;
73
96
  }
74
97
  }, P = (y) => {
75
98
  !u.contains(y.relatedTarget) && m();
76
99
  }, C = () => {
77
100
  u.contains(document.activeElement) || m();
78
101
  };
79
- return u.addEventListener("focusin", p), u.addEventListener("focusout", P), u.addEventListener("pointermove", p), u.addEventListener("pointerleave", C), window.addEventListener("blur", p), window.addEventListener("focus", m), () => {
80
- u.removeEventListener("focusin", p), u.removeEventListener("focusout", P), u.removeEventListener("pointermove", p), u.removeEventListener("pointerleave", C), window.removeEventListener("blur", p), window.removeEventListener("focus", m);
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);
81
104
  };
82
105
  }
83
- }, [R, f.isClosePausedRef]);
106
+ }, [R, p.isClosePausedRef]);
84
107
  const l = n.useCallback(
85
108
  ({ tabbingDirection: u }) => {
86
- const p = T().map((m) => {
87
- const P = m.ref.current, C = [P, ...nt(P)];
109
+ const f = w().map((m) => {
110
+ const P = m.ref.current, C = [P, ...at(P)];
88
111
  return u === "forwards" ? C : C.reverse();
89
112
  });
90
- return (u === "forwards" ? p.reverse() : p).flat();
113
+ return (u === "forwards" ? f.reverse() : f).flat();
91
114
  },
92
- [T]
115
+ [w]
93
116
  );
94
117
  return n.useEffect(() => {
95
- const u = w.current;
118
+ const u = T.current;
96
119
  if (u) {
97
- const h = (p) => {
98
- const m = p.altKey || p.ctrlKey || p.metaKey;
99
- if (p.key === "Tab" && !m) {
100
- const C = document.activeElement, y = p.shiftKey;
101
- if (p.target === u && y) {
102
- a.current?.focus();
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();
103
126
  return;
104
127
  }
105
- const _ = l({ tabbingDirection: y ? "backwards" : "forwards" }), V = _.findIndex((N) => N === C);
106
- q(_.slice(V + 1)) ? p.preventDefault() : y ? a.current?.focus() : E.current?.focus();
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();
107
130
  }
108
131
  };
109
132
  return u.addEventListener("keydown", h), () => u.removeEventListener("keydown", h);
110
133
  }
111
- }, [T, l]), /* @__PURE__ */ A(
134
+ }, [w, l]), /* @__PURE__ */ D(
112
135
  Fe,
113
136
  {
114
137
  ref: v,
@@ -117,10 +140,10 @@ var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.vie
117
140
  tabIndex: -1,
118
141
  style: { pointerEvents: R ? void 0 : "none" },
119
142
  children: [
120
- R && /* @__PURE__ */ i(
143
+ R && /* @__PURE__ */ a(
121
144
  J,
122
145
  {
123
- ref: a,
146
+ ref: i,
124
147
  onFocusFromOutsideViewport: () => {
125
148
  const u = l({
126
149
  tabbingDirection: "forwards"
@@ -129,8 +152,8 @@ var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.vie
129
152
  }
130
153
  }
131
154
  ),
132
- /* @__PURE__ */ i(Z.Slot, { scope: o, children: /* @__PURE__ */ i(D.ol, { tabIndex: -1, ...d, ref: S }) }),
133
- R && /* @__PURE__ */ i(
155
+ /* @__PURE__ */ a(ee.Slot, { scope: r, children: /* @__PURE__ */ a(A.ol, { tabIndex: -1, ...d, ref: S }) }),
156
+ R && /* @__PURE__ */ a(
134
157
  J,
135
158
  {
136
159
  ref: E,
@@ -148,82 +171,82 @@ var le = "ToastViewport", Ye = ["F8"], z = "toast.viewportPause", G = "toast.vie
148
171
  }
149
172
  );
150
173
  de.displayName = le;
151
- var fe = "ToastFocusProxy", J = n.forwardRef(
152
- (e, r) => {
153
- const { __scopeToast: o, onFocusFromOutsideViewport: t, ...c } = e, d = U(fe, o);
154
- return /* @__PURE__ */ i(
155
- ie,
174
+ var pe = "ToastFocusProxy", J = n.forwardRef(
175
+ (e, o) => {
176
+ const { __scopeToast: r, onFocusFromOutsideViewport: t, ...c } = e, d = Y(pe, r);
177
+ return /* @__PURE__ */ a(
178
+ Q,
156
179
  {
157
180
  tabIndex: 0,
158
181
  ...c,
159
- ref: r,
182
+ ref: o,
160
183
  style: { position: "fixed" },
161
- onFocus: (f) => {
162
- const T = f.relatedTarget;
163
- !d.viewport?.contains(T) && t();
184
+ onFocus: (p) => {
185
+ const w = p.relatedTarget;
186
+ !d.viewport?.contains(w) && t();
164
187
  }
165
188
  }
166
189
  );
167
190
  }
168
191
  );
169
- J.displayName = fe;
170
- var O = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.swipeCancel", ze = "toast.swipeEnd", pe = n.forwardRef(
171
- (e, r) => {
172
- const { forceMount: o, open: t, defaultOpen: c, onOpenChange: d, ...f } = e, [T, v] = Ne({
192
+ J.displayName = pe;
193
+ var O = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.swipeCancel", Je = "toast.swipeEnd", fe = n.forwardRef(
194
+ (e, o) => {
195
+ const { forceMount: r, open: t, defaultOpen: c, onOpenChange: d, ...p } = e, [w, v] = Ne({
173
196
  prop: t,
174
197
  defaultProp: c ?? !0,
175
198
  onChange: d,
176
199
  caller: O
177
200
  });
178
- return /* @__PURE__ */ i(Me, { present: o || T, children: /* @__PURE__ */ i(
179
- Qe,
201
+ return /* @__PURE__ */ a(Oe, { present: r || w, children: /* @__PURE__ */ a(
202
+ et,
180
203
  {
181
- open: T,
182
- ...f,
183
- ref: r,
204
+ open: w,
205
+ ...p,
206
+ ref: o,
184
207
  onClose: () => v(!1),
185
- onPause: $(e.onPause),
186
- onResume: $(e.onResume),
187
- onSwipeStart: x(e.onSwipeStart, (a) => {
188
- a.currentTarget.setAttribute("data-swipe", "start");
208
+ onPause: X(e.onPause),
209
+ onResume: X(e.onResume),
210
+ onSwipeStart: x(e.onSwipeStart, (i) => {
211
+ i.currentTarget.setAttribute("data-swipe", "start");
189
212
  }),
190
- onSwipeMove: x(e.onSwipeMove, (a) => {
191
- const { x: E, y: w } = a.detail.delta;
192
- a.currentTarget.setAttribute("data-swipe", "move"), a.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${E}px`), a.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${w}px`);
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`);
193
216
  }),
194
- onSwipeCancel: x(e.onSwipeCancel, (a) => {
195
- a.currentTarget.setAttribute("data-swipe", "cancel"), a.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), a.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), a.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), a.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
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");
196
219
  }),
197
- onSwipeEnd: x(e.onSwipeEnd, (a) => {
198
- const { x: E, y: w } = a.detail.delta;
199
- a.currentTarget.setAttribute("data-swipe", "end"), a.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), a.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), a.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${E}px`), a.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${w}px`), v(!1);
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);
200
223
  })
201
224
  }
202
225
  ) });
203
226
  }
204
227
  );
205
- pe.displayName = O;
206
- var [Ge, Je] = ce(O, {
228
+ fe.displayName = O;
229
+ var [Qe, Ze] = ce(O, {
207
230
  onClose() {
208
231
  }
209
- }), Qe = n.forwardRef(
210
- (e, r) => {
232
+ }), et = n.forwardRef(
233
+ (e, o) => {
211
234
  const {
212
- __scopeToast: o,
235
+ __scopeToast: r,
213
236
  type: t = "foreground",
214
237
  duration: c,
215
238
  open: d,
216
- onClose: f,
217
- onEscapeKeyDown: T,
239
+ onClose: p,
240
+ onEscapeKeyDown: w,
218
241
  onPause: v,
219
- onResume: a,
242
+ onResume: i,
220
243
  onSwipeStart: E,
221
- onSwipeMove: w,
244
+ onSwipeMove: T,
222
245
  onSwipeCancel: S,
223
246
  onSwipeEnd: b,
224
247
  ...R
225
- } = e, l = U(O, o), [u, h] = n.useState(null), p = ae(r, (s) => h(s)), m = n.useRef(null), P = n.useRef(null), C = c || l.duration, y = n.useRef(0), F = n.useRef(C), k = n.useRef(0), { onToastAdd: _, onToastRemove: V } = l, N = $(() => {
226
- u?.contains(document.activeElement) && l.viewport?.focus(), f();
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();
227
250
  }), K = n.useCallback(
228
251
  (s) => {
229
252
  !s || s === 1 / 0 || (window.clearTimeout(k.current), y.current = (/* @__PURE__ */ new Date()).getTime(), k.current = window.setTimeout(N, s));
@@ -234,69 +257,69 @@ var [Ge, Je] = ce(O, {
234
257
  const s = l.viewport;
235
258
  if (s) {
236
259
  const g = () => {
237
- K(F.current), a?.();
260
+ K(_.current), i?.();
238
261
  }, I = () => {
239
262
  const L = (/* @__PURE__ */ new Date()).getTime() - y.current;
240
- F.current = F.current - L, window.clearTimeout(k.current), v?.();
263
+ _.current = _.current - L, window.clearTimeout(k.current), v?.();
241
264
  };
242
265
  return s.addEventListener(z, I), s.addEventListener(G, g), () => {
243
266
  s.removeEventListener(z, I), s.removeEventListener(G, g);
244
267
  };
245
268
  }
246
- }, [l.viewport, C, v, a, K]), n.useEffect(() => {
269
+ }, [l.viewport, C, v, i, K]), n.useEffect(() => {
247
270
  d && !l.isClosePausedRef.current && K(C);
248
- }, [d, C, l.isClosePausedRef, K]), n.useEffect(() => (_(), () => V()), [_, V]);
249
- const ee = n.useMemo(() => u ? Pe(u) : null, [u]);
250
- return l.viewport ? /* @__PURE__ */ A(se, { children: [
251
- ee && /* @__PURE__ */ i(
252
- Ze,
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(
275
+ tt,
253
276
  {
254
- __scopeToast: o,
277
+ __scopeToast: r,
255
278
  role: "status",
256
279
  "aria-live": t === "foreground" ? "assertive" : "polite",
257
- children: ee
280
+ children: te
258
281
  }
259
282
  ),
260
- /* @__PURE__ */ i(Ge, { scope: o, onClose: N, children: Se.createPortal(
261
- /* @__PURE__ */ i(Z.ItemSlot, { scope: o, children: /* @__PURE__ */ i(
262
- _e,
283
+ /* @__PURE__ */ a(Qe, { scope: r, onClose: N, children: Se.createPortal(
284
+ /* @__PURE__ */ a(ee.ItemSlot, { scope: r, children: /* @__PURE__ */ a(
285
+ Le,
263
286
  {
264
287
  asChild: !0,
265
- onEscapeKeyDown: x(T, () => {
288
+ onEscapeKeyDown: x(w, () => {
266
289
  l.isFocusedToastEscapeKeyDownRef.current || N(), l.isFocusedToastEscapeKeyDownRef.current = !1;
267
290
  }),
268
- children: /* @__PURE__ */ i(
269
- D.li,
291
+ children: /* @__PURE__ */ a(
292
+ A.li,
270
293
  {
271
294
  tabIndex: 0,
272
295
  "data-state": d ? "open" : "closed",
273
296
  "data-swipe-direction": l.swipeDirection,
274
297
  ...R,
275
- ref: p,
298
+ ref: f,
276
299
  style: { userSelect: "none", touchAction: "none", ...e.style },
277
300
  onKeyDown: x(e.onKeyDown, (s) => {
278
- s.key === "Escape" && (T?.(s.nativeEvent), s.nativeEvent.defaultPrevented || (l.isFocusedToastEscapeKeyDownRef.current = !0, N()));
301
+ s.key === "Escape" && (w?.(s.nativeEvent), s.nativeEvent.defaultPrevented || (l.isFocusedToastEscapeKeyDownRef.current = !0, N()));
279
302
  }),
280
303
  onPointerDown: x(e.onPointerDown, (s) => {
281
304
  s.button === 0 && (m.current = { x: s.clientX, y: s.clientY });
282
305
  }),
283
306
  onPointerMove: x(e.onPointerMove, (s) => {
284
307
  if (!m.current) return;
285
- 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), Y = s.pointerType === "touch" ? 10 : 2, W = { x: Ce, y: Re }, te = { originalEvent: s, delta: W };
286
- L ? (P.current = W, X(je, w, te, {
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 };
309
+ L ? (P.current = W, U(ze, T, oe, {
287
310
  discrete: !1
288
- })) : ne(W, l.swipeDirection, Y) ? (P.current = W, X(Be, E, te, {
311
+ })) : se(W, l.swipeDirection, $) ? (P.current = W, U(qe, E, oe, {
289
312
  discrete: !1
290
- }), s.target.setPointerCapture(s.pointerId)) : (Math.abs(g) > Y || Math.abs(I) > Y) && (m.current = null);
313
+ }), s.target.setPointerCapture(s.pointerId)) : (Math.abs(g) > $ || Math.abs(I) > $) && (m.current = null);
291
314
  }),
292
315
  onPointerUp: x(e.onPointerUp, (s) => {
293
316
  const g = P.current, I = s.target;
294
317
  if (I.hasPointerCapture(s.pointerId) && I.releasePointerCapture(s.pointerId), P.current = null, m.current = null, g) {
295
318
  const L = s.currentTarget, M = { originalEvent: s, delta: g };
296
- ne(g, l.swipeDirection, l.swipeThreshold) ? X(ze, b, M, {
319
+ se(g, l.swipeDirection, l.swipeThreshold) ? U(Je, b, M, {
297
320
  discrete: !0
298
- }) : X(
299
- qe,
321
+ }) : U(
322
+ Ge,
300
323
  S,
301
324
  M,
302
325
  {
@@ -315,149 +338,149 @@ var [Ge, Je] = ce(O, {
315
338
  ) })
316
339
  ] }) : null;
317
340
  }
318
- ), Ze = (e) => {
319
- const { __scopeToast: r, children: o, ...t } = e, c = U(O, r), [d, f] = n.useState(!1), [T, v] = n.useState(!1);
320
- return ot(() => f(!0)), n.useEffect(() => {
321
- const a = window.setTimeout(() => v(!0), 1e3);
322
- return () => window.clearTimeout(a);
323
- }, []), T ? null : /* @__PURE__ */ i(Le, { asChild: !0, children: /* @__PURE__ */ i(ie, { ...t, children: d && /* @__PURE__ */ A(se, { children: [
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: [
324
347
  c.label,
325
348
  " ",
326
- o
349
+ r
327
350
  ] }) }) });
328
- }, et = "ToastTitle", me = n.forwardRef(
329
- (e, r) => {
330
- const { __scopeToast: o, ...t } = e;
331
- return /* @__PURE__ */ i(D.div, { ...t, ref: r });
351
+ }, ot = "ToastTitle", me = n.forwardRef(
352
+ (e, o) => {
353
+ const { __scopeToast: r, ...t } = e;
354
+ return /* @__PURE__ */ a(A.div, { ...t, ref: o });
332
355
  }
333
356
  );
334
- me.displayName = et;
335
- var tt = "ToastDescription", Te = n.forwardRef(
336
- (e, r) => {
337
- const { __scopeToast: o, ...t } = e;
338
- return /* @__PURE__ */ i(D.div, { ...t, ref: r });
357
+ me.displayName = ot;
358
+ var rt = "ToastDescription", we = n.forwardRef(
359
+ (e, o) => {
360
+ const { __scopeToast: r, ...t } = e;
361
+ return /* @__PURE__ */ a(A.div, { ...t, ref: o });
339
362
  }
340
363
  );
341
- Te.displayName = tt;
342
- var we = "ToastAction", ve = n.forwardRef(
343
- (e, r) => {
344
- const { altText: o, ...t } = e;
345
- return o.trim() ? /* @__PURE__ */ i(he, { altText: o, asChild: !0, children: /* @__PURE__ */ i(ye, { ...t, ref: r }) }) : (console.error(
346
- `Invalid prop \`altText\` supplied to \`${we}\`. Expected non-empty \`string\`.`
364
+ we.displayName = rt;
365
+ var Te = "ToastAction", ve = n.forwardRef(
366
+ (e, o) => {
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(
369
+ `Invalid prop \`altText\` supplied to \`${Te}\`. Expected non-empty \`string\`.`
347
370
  ), null);
348
371
  }
349
372
  );
350
- ve.displayName = we;
373
+ ve.displayName = Te;
351
374
  var Ee = "ToastClose", ye = n.forwardRef(
352
- (e, r) => {
353
- const { __scopeToast: o, ...t } = e, c = Je(Ee, o);
354
- return /* @__PURE__ */ i(he, { asChild: !0, children: /* @__PURE__ */ i(
355
- D.button,
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,
356
379
  {
357
380
  type: "button",
358
381
  ...t,
359
- ref: r,
382
+ ref: o,
360
383
  onClick: x(e.onClick, c.onClose)
361
384
  }
362
385
  ) });
363
386
  }
364
387
  );
365
388
  ye.displayName = Ee;
366
- var he = n.forwardRef((e, r) => {
367
- const { __scopeToast: o, altText: t, ...c } = e;
368
- return /* @__PURE__ */ i(
369
- D.div,
389
+ var he = n.forwardRef((e, o) => {
390
+ const { __scopeToast: r, altText: t, ...c } = e;
391
+ return /* @__PURE__ */ a(
392
+ A.div,
370
393
  {
371
394
  "data-radix-toast-announce-exclude": "",
372
395
  "data-radix-toast-announce-alt": t || void 0,
373
396
  ...c,
374
- ref: r
397
+ ref: o
375
398
  }
376
399
  );
377
400
  });
378
401
  function Pe(e) {
379
- const r = [];
402
+ const o = [];
380
403
  return Array.from(e.childNodes).forEach((t) => {
381
- if (t.nodeType === t.TEXT_NODE && t.textContent && r.push(t.textContent), rt(t)) {
404
+ if (t.nodeType === t.TEXT_NODE && t.textContent && o.push(t.textContent), st(t)) {
382
405
  const c = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
383
406
  if (!c)
384
407
  if (d) {
385
- const f = t.dataset.radixToastAnnounceAlt;
386
- f && r.push(f);
408
+ const p = t.dataset.radixToastAnnounceAlt;
409
+ p && o.push(p);
387
410
  } else
388
- r.push(...Pe(t));
411
+ o.push(...Pe(t));
389
412
  }
390
- }), r;
413
+ }), o;
391
414
  }
392
- function X(e, r, o, { discrete: t }) {
393
- const c = o.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: o });
394
- r && c.addEventListener(e, r, { once: !0 }), t ? Oe(c, d) : c.dispatchEvent(d);
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);
395
418
  }
396
- var ne = (e, r, o = 0) => {
419
+ var se = (e, o, r = 0) => {
397
420
  const t = Math.abs(e.x), c = Math.abs(e.y), d = t > c;
398
- return r === "left" || r === "right" ? d && t > o : !d && c > o;
421
+ return o === "left" || o === "right" ? d && t > r : !d && c > r;
399
422
  };
400
- function ot(e = () => {
423
+ function nt(e = () => {
401
424
  }) {
402
- const r = $(e);
403
- Ae(() => {
404
- let o = 0, t = 0;
405
- return o = window.requestAnimationFrame(() => t = window.requestAnimationFrame(r)), () => {
406
- window.cancelAnimationFrame(o), window.cancelAnimationFrame(t);
425
+ const o = X(e);
426
+ De(() => {
427
+ let r = 0, t = 0;
428
+ return r = window.requestAnimationFrame(() => t = window.requestAnimationFrame(o)), () => {
429
+ window.cancelAnimationFrame(r), window.cancelAnimationFrame(t);
407
430
  };
408
- }, [r]);
431
+ }, [o]);
409
432
  }
410
- function rt(e) {
433
+ function st(e) {
411
434
  return e.nodeType === e.ELEMENT_NODE;
412
435
  }
413
- function nt(e) {
414
- const r = [], o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
436
+ function at(e) {
437
+ const o = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
415
438
  acceptNode: (t) => {
416
439
  const c = t.tagName === "INPUT" && t.type === "hidden";
417
440
  return t.disabled || t.hidden || c ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
418
441
  }
419
442
  });
420
- for (; o.nextNode(); ) r.push(o.currentNode);
421
- return r;
443
+ for (; r.nextNode(); ) o.push(r.currentNode);
444
+ return o;
422
445
  }
423
446
  function q(e) {
424
- const r = document.activeElement;
425
- return e.some((o) => o === r ? !0 : (o.focus(), document.activeElement !== r));
447
+ const o = document.activeElement;
448
+ return e.some((r) => r === o ? !0 : (r.focus(), document.activeElement !== o));
426
449
  }
427
- var st = ue, at = de, it = pe, ct = me, ut = Te, lt = ve;
428
- const gt = ({
450
+ var it = ue, ct = de, ut = fe, lt = me, dt = we, pt = ve;
451
+ const It = ({
429
452
  title: e,
430
- duration: r = 5e3,
431
- titleClassName: o,
453
+ duration: o = 5e3,
454
+ titleClassName: r,
432
455
  descriptionClassName: t,
433
456
  description: c,
434
457
  children: d,
435
- theme: f,
436
- showCloseButton: T = !0,
458
+ theme: p,
459
+ showCloseButton: w = !0,
437
460
  closeButtonClassName: v,
438
- className: a,
461
+ className: i,
439
462
  open: E = !1,
440
- setOpen: w
463
+ setOpen: T
441
464
  }) => {
442
465
  const S = xe(0);
443
466
  be(() => () => clearTimeout(S.current), []);
444
- const b = oe(() => re(e) ? /* @__PURE__ */ i(B, { className: o, children: e }) : e, [e, o]), R = oe(() => re(c) ? /* @__PURE__ */ i(B, { className: t, children: c }) : c, [c, t]), l = ge(() => {
445
- w(!1), S.current = window.setTimeout(() => w(!0), 100);
446
- }, [w]);
447
- return /* @__PURE__ */ A(st, { swipeDirection: "right", duration: r, children: [
448
- /* @__PURE__ */ i(B, { onClick: l, children: d }),
449
- /* @__PURE__ */ A(
450
- it,
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);
469
+ }, [T]);
470
+ return /* @__PURE__ */ D(it, { swipeDirection: "right", duration: o, children: [
471
+ /* @__PURE__ */ a(B, { onClick: l, children: d }),
472
+ /* @__PURE__ */ D(
473
+ ut,
451
474
  {
452
- className: j(Ke({ className: a })),
453
- "data-theme": f,
475
+ className: j(Ke({ className: i })),
476
+ "data-theme": p,
454
477
  open: E,
455
- onOpenChange: w,
478
+ onOpenChange: T,
456
479
  children: [
457
- /* @__PURE__ */ i(ct, { asChild: !0, className: o, children: b }),
458
- R && /* @__PURE__ */ i(ut, { asChild: !0, children: R }),
459
- T && /* @__PURE__ */ i(lt, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ A("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
460
- /* @__PURE__ */ i(
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(
461
484
  We,
462
485
  {
463
486
  className: j(
@@ -467,14 +490,14 @@ const gt = ({
467
490
  )
468
491
  }
469
492
  ),
470
- /* @__PURE__ */ i(ke, { children: "Close toast" })
493
+ /* @__PURE__ */ a(ke, { children: "Close toast" })
471
494
  ] }) })
472
495
  ]
473
496
  }
474
497
  ),
475
- /* @__PURE__ */ i(at, { className: j(He()) })
498
+ /* @__PURE__ */ a(ct, { className: j(He()) })
476
499
  ] });
477
500
  };
478
501
  export {
479
- gt as Toast
502
+ It as Toast
480
503
  };