@konstructio/ui 0.0.12-alpha.2 → 0.0.12-alpha.20

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 (93) hide show
  1. package/dist/{Modal-DZUwNzSW.js → Modal-B-E9uaA6.js} +354 -346
  2. package/dist/components/Alert/Alert.js +1 -1
  3. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  4. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  5. package/dist/components/AlertDialog/components/index.js +1 -1
  6. package/dist/components/Autocomplete/Autocomplete.variants.js +0 -1
  7. package/dist/components/Breadcrumb/Breadcrumb.variants.js +18 -15
  8. package/dist/components/Checkbox/Checkbox.js +1 -1
  9. package/dist/components/Command/Command.js +32 -0
  10. package/dist/components/Command/Command.variants.js +97 -0
  11. package/dist/components/Command/components/Command.js +8 -0
  12. package/dist/components/Command/components/CommandEmpty.js +15 -0
  13. package/dist/components/Command/components/CommandGroup.js +19 -0
  14. package/dist/components/Command/components/CommandInput.js +84 -0
  15. package/dist/components/Command/components/CommandItem.js +29 -0
  16. package/dist/components/Command/components/CommandList.js +16 -0
  17. package/dist/components/Command/components/CommandSeparator.js +16 -0
  18. package/dist/components/Command/components/CommandShortcut.js +19 -0
  19. package/dist/components/Command/components/DialogContent.js +31 -0
  20. package/dist/components/Command/components/DialogOverlay.js +19 -0
  21. package/dist/components/Command/components/index.js +20 -0
  22. package/dist/components/Command/contexts/Command.context.js +13 -0
  23. package/dist/components/Command/contexts/Command.provider.js +24 -0
  24. package/dist/components/Command/contexts/index.js +6 -0
  25. package/dist/components/Dropdown/Dropdown.js +6 -6
  26. package/dist/components/Dropdown/Dropdown.variants.js +22 -3
  27. package/dist/components/Dropdown/components/List/List.js +42 -16
  28. package/dist/components/Dropdown/components/List/List.variants.js +7 -5
  29. package/dist/components/Dropdown/components/ListItem/ListItem.js +26 -21
  30. package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +6 -4
  31. package/dist/components/Dropdown/components/Wrapper.js +97 -63
  32. package/dist/components/Dropdown/contexts/dropdown.context.js +1 -1
  33. package/dist/components/Dropdown/contexts/dropdown.provider.js +9 -9
  34. package/dist/components/Input/Input.js +112 -67
  35. package/dist/components/Input/Input.variants.js +5 -6
  36. package/dist/components/Loading/Loading.js +102 -21
  37. package/dist/components/Loading/Loading.variants.js +13 -14
  38. package/dist/components/Modal/Modal.js +3 -3
  39. package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -4
  40. package/dist/components/Modal/components/index.js +1 -1
  41. package/dist/components/NumberInput/NumberInput.js +88 -88
  42. package/dist/components/NumberInput/NumberInput.variants.js +23 -19
  43. package/dist/components/Range/Range.js +1 -1
  44. package/dist/components/Sidebar/Sidebar.variants.js +2 -1
  45. package/dist/components/Sidebar/components/Logo/Logo.variants.js +9 -17
  46. package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +2 -2
  47. package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +6 -5
  48. package/dist/components/Slider/Slider.js +1 -1
  49. package/dist/components/Switch/Switch.js +1 -1
  50. package/dist/components/Switch/Switch.variants.js +4 -4
  51. package/dist/components/Table/Table.js +31 -0
  52. package/dist/components/Table/Table.variants.js +78 -0
  53. package/dist/components/Table/components/Body.js +28 -0
  54. package/dist/components/Table/components/Filter.js +9 -0
  55. package/dist/components/Table/components/Head.js +28 -0
  56. package/dist/components/Table/components/Row.js +34 -0
  57. package/dist/components/Tag/Tag.js +17 -5
  58. package/dist/components/Tag/Tag.variants.js +11 -1
  59. package/dist/components/TagSelect/TagSelect.js +6 -71
  60. package/dist/components/TagSelect/TagSelect.variants.js +29 -50
  61. package/dist/components/TagSelect/components/Item/Item.js +23 -0
  62. package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
  63. package/dist/components/TagSelect/components/List/List.js +13 -0
  64. package/dist/components/TagSelect/components/List/List.variants.js +37 -0
  65. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
  66. package/dist/components/TagSelect/components/index.js +8 -0
  67. package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
  68. package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
  69. package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
  70. package/dist/components/TagSelect/contexts/index.js +6 -0
  71. package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
  72. package/dist/components/TextArea/TextArea.js +28 -22
  73. package/dist/components/TextArea/TextArea.variants.js +0 -1
  74. package/dist/components/Toast/Toast.js +141 -128
  75. package/dist/components/Toast/Toast.variants.js +2 -3
  76. package/dist/components/Typography/Typography.js +23 -22
  77. package/dist/components/Typography/Typography.variants.js +49 -22
  78. package/dist/components/index.js +22 -20
  79. package/dist/{index-C6WtlN_F.js → index-BzaHYXkt.js} +1 -1
  80. package/dist/{index-Z1voPZOH.js → index-CbTU3cnP.js} +1 -1
  81. package/dist/index-CzSBQN5S.js +432 -0
  82. package/dist/index-D7QNmo_D.js +422 -0
  83. package/dist/index-DUA6Y_AE.js +126 -0
  84. package/dist/{index-B33at13_.js → index-D_76wh4w.js} +1 -1
  85. package/dist/index-DyKo5ZJT.js +446 -0
  86. package/dist/index.d.ts +82 -16
  87. package/dist/index.js +18 -16
  88. package/dist/package.json +26 -24
  89. package/dist/styles.css +1 -1
  90. package/dist/utils/index.js +320 -322
  91. package/package.json +26 -24
  92. package/dist/index-3jTPaVvh.js +0 -551
  93. package/dist/index-BTeAm7mx.js +0 -19133
@@ -1,33 +1,39 @@
1
- import { jsxs as h, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as v, useId as N, useState as T, useCallback as j } from "react";
3
- import { cn as A } from "../../utils/index.js";
4
- import { textAreaVariants as I } from "./TextArea.variants.js";
5
- import { useTheme as V } from "../../contexts/theme.hook.js";
6
- const S = v(
7
- ({ initialValue: m, label: t, name: o, placeholder: l, rows: c = 3, theme: i, onChange: e }, u) => {
8
- const r = N(), { theme: d } = V(), s = o ? `${r}-name` : r, [f, n] = T(m ?? ""), x = j(
9
- (p) => {
10
- n(p.target.value), e == null || e();
11
- },
12
- [e]
13
- );
14
- return /* @__PURE__ */ h("div", { className: "flex flex-col gap-2", children: [
15
- t ? /* @__PURE__ */ a("label", { htmlFor: s, className: "cursor-pointer", children: t }) : null,
16
- /* @__PURE__ */ a(
1
+ import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as h, useId as u } from "react";
3
+ import { cn as p } from "../../utils/index.js";
4
+ import { textAreaVariants as v } from "./TextArea.variants.js";
5
+ import { useTheme as N } from "../../contexts/theme.hook.js";
6
+ const w = h(
7
+ ({
8
+ initialValue: a,
9
+ label: e,
10
+ name: s,
11
+ placeholder: l,
12
+ rows: c = 3,
13
+ theme: n,
14
+ className: i,
15
+ ...r
16
+ }, f) => {
17
+ const t = u(), { theme: x } = N(), m = s ? `${t}-name` : t;
18
+ return /* @__PURE__ */ d("div", { className: "flex flex-col gap-2", children: [
19
+ e ? /* @__PURE__ */ o("label", { htmlFor: m, className: "cursor-pointer", children: e }) : null,
20
+ /* @__PURE__ */ o(
17
21
  "textarea",
18
22
  {
19
- id: s,
20
- ref: u,
21
- className: A(I({ theme: i ?? d })),
23
+ id: m,
24
+ ref: f,
25
+ className: p(
26
+ v({ className: i, theme: n ?? x })
27
+ ),
22
28
  rows: c,
23
29
  placeholder: l,
24
- value: f,
25
- onChange: x
30
+ value: a ?? r.value,
31
+ ...r
26
32
  }
27
33
  )
28
34
  ] });
29
35
  }
30
36
  );
31
37
  export {
32
- S as TextArea
38
+ w as TextArea
33
39
  };
@@ -13,7 +13,6 @@ const i = e(
13
13
  "resize-none",
14
14
  "rounded-md",
15
15
  "shadow-sm",
16
- "text-base",
17
16
  "w-full"
18
17
  ],
19
18
  {
@@ -1,18 +1,18 @@
1
1
  import { jsx as c, jsxs as D, Fragment as se } from "react/jsx-runtime";
2
2
  import { u as ae, S as j } from "../../index-B_6_jmOO.js";
3
3
  import * as s from "react";
4
- import { useState as Re, useRef as be, useEffect as ge, useMemo as oe, isValidElement as re, useCallback as Se } from "react";
5
- import { P as L, r as Ie, d as Ne } from "../../index-BTeAm7mx.js";
6
- import { c as Ae, a as Fe, b, d as X, u as _e } from "../../index-Cva-e5M4.js";
7
- import { c as De } from "../../index-BbsJ0VIJ.js";
8
- import { B as Le, R as Oe, P as Me } from "../../index-B33at13_.js";
9
- import { P as ke } from "../../index-Dj1pom3_.js";
10
- import { V as ie, R as Ve } from "../../index-Z1voPZOH.js";
4
+ import { useRef as Re, useEffect as be, useMemo as oe, isValidElement as re, useCallback as ge } from "react";
5
+ import { P as L, r as Se, d as Ie } from "../../index-D7QNmo_D.js";
6
+ import { c as Ne, a as Ae, b, d as X, u as Fe } from "../../index-Cva-e5M4.js";
7
+ import { c as _e } from "../../index-BbsJ0VIJ.js";
8
+ import { B as De, R as Le, P as Me } from "../../index-D_76wh4w.js";
9
+ import { P as Oe } from "../../index-Dj1pom3_.js";
10
+ import { V as ie, R as ke } from "../../index-CbTU3cnP.js";
11
11
  import { cn as q } from "../../utils/index.js";
12
- import { closeToastVariants as Ke, toastVariants as He, viewportToastVariants as We } from "./Toast.variants.js";
13
- import { X as Xe } from "../../x-DU-Zw-L_.js";
14
- import { useTheme as $e } from "../../contexts/theme.hook.js";
15
- var Z = "ToastProvider", [ee, Ue, Ye] = De("Toast"), [ce, gt] = Ae("Toast", [Ye]), [Be, $] = ce(Z), ue = (e) => {
12
+ import { closeToastVariants as Ve, toastVariants as Ke, viewportToastVariants as He } from "./Toast.variants.js";
13
+ import { X as We } from "../../x-DU-Zw-L_.js";
14
+ import { useTheme as Xe } from "../../contexts/theme.hook.js";
15
+ var Z = "ToastProvider", [ee, $e, Ue] = _e("Toast"), [ce, bt] = Ne("Toast", [Ue]), [Ye, $] = ce(Z), ue = (e) => {
16
16
  const {
17
17
  __scopeToast: r,
18
18
  label: o = "Notification",
@@ -20,11 +20,11 @@ var Z = "ToastProvider", [ee, Ue, Ye] = De("Toast"), [ce, gt] = Ae("Toast", [Ye]
20
20
  swipeDirection: u = "right",
21
21
  swipeThreshold: d = 50,
22
22
  children: f
23
- } = e, [m, v] = s.useState(null), [n, w] = s.useState(0), E = s.useRef(!1), I = s.useRef(!1);
23
+ } = e, [m, v] = s.useState(null), [n, y] = s.useState(0), w = s.useRef(!1), S = s.useRef(!1);
24
24
  return o.trim() || console.error(
25
25
  `Invalid prop \`label\` supplied to \`${Z}\`. Expected non-empty \`string\`.`
26
26
  ), /* @__PURE__ */ c(ee.Provider, { scope: r, children: /* @__PURE__ */ c(
27
- Be,
27
+ Ye,
28
28
  {
29
29
  scope: r,
30
30
  label: o,
@@ -34,90 +34,90 @@ var Z = "ToastProvider", [ee, Ue, Ye] = De("Toast"), [ce, gt] = Ae("Toast", [Ye]
34
34
  toastCount: n,
35
35
  viewport: m,
36
36
  onViewportChange: v,
37
- onToastAdd: s.useCallback(() => w((R) => R + 1), []),
38
- onToastRemove: s.useCallback(() => w((R) => R - 1), []),
39
- isFocusedToastEscapeKeyDownRef: E,
40
- isClosePausedRef: I,
37
+ onToastAdd: s.useCallback(() => y((g) => g + 1), []),
38
+ onToastRemove: s.useCallback(() => y((g) => g - 1), []),
39
+ isFocusedToastEscapeKeyDownRef: w,
40
+ isClosePausedRef: S,
41
41
  children: f
42
42
  }
43
43
  ) });
44
44
  };
45
45
  ue.displayName = Z;
46
- var le = "ToastViewport", je = ["F8"], G = "toast.viewportPause", J = "toast.viewportResume", de = s.forwardRef(
46
+ var le = "ToastViewport", Be = ["F8"], G = "toast.viewportPause", J = "toast.viewportResume", de = s.forwardRef(
47
47
  (e, r) => {
48
48
  const {
49
49
  __scopeToast: o,
50
- hotkey: t = je,
50
+ hotkey: t = Be,
51
51
  label: u = "Notifications ({hotkey})",
52
52
  ...d
53
- } = e, f = $(le, o), m = Ue(o), v = s.useRef(null), n = s.useRef(null), w = s.useRef(null), E = s.useRef(null), I = ae(r, E, f.onViewportChange), R = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), g = f.toastCount > 0;
53
+ } = e, f = $(le, o), m = $e(o), v = s.useRef(null), n = s.useRef(null), y = s.useRef(null), w = s.useRef(null), S = ae(r, w, f.onViewportChange), g = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), R = f.toastCount > 0;
54
54
  s.useEffect(() => {
55
- const a = (P) => {
55
+ const a = (h) => {
56
56
  var T;
57
- t.length !== 0 && t.every((h) => P[h] || P.code === h) && ((T = E.current) == null || T.focus());
57
+ t.length !== 0 && t.every((E) => h[E] || h.code === E) && ((T = w.current) == null || T.focus());
58
58
  };
59
59
  return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
60
60
  }, [t]), s.useEffect(() => {
61
- const a = v.current, P = E.current;
62
- if (g && a && P) {
61
+ const a = v.current, h = w.current;
62
+ if (R && a && h) {
63
63
  const p = () => {
64
64
  if (!f.isClosePausedRef.current) {
65
- const C = new CustomEvent(G);
66
- P.dispatchEvent(C), f.isClosePausedRef.current = !0;
65
+ const P = new CustomEvent(G);
66
+ h.dispatchEvent(P), f.isClosePausedRef.current = !0;
67
67
  }
68
68
  }, T = () => {
69
69
  if (f.isClosePausedRef.current) {
70
- const C = new CustomEvent(J);
71
- P.dispatchEvent(C), f.isClosePausedRef.current = !1;
70
+ const P = new CustomEvent(J);
71
+ h.dispatchEvent(P), f.isClosePausedRef.current = !1;
72
72
  }
73
- }, h = (C) => {
74
- !a.contains(C.relatedTarget) && T();
75
- }, y = () => {
73
+ }, E = (P) => {
74
+ !a.contains(P.relatedTarget) && T();
75
+ }, C = () => {
76
76
  a.contains(document.activeElement) || T();
77
77
  };
78
- return a.addEventListener("focusin", p), a.addEventListener("focusout", h), a.addEventListener("pointermove", p), a.addEventListener("pointerleave", y), window.addEventListener("blur", p), window.addEventListener("focus", T), () => {
79
- a.removeEventListener("focusin", p), a.removeEventListener("focusout", h), a.removeEventListener("pointermove", p), a.removeEventListener("pointerleave", y), window.removeEventListener("blur", p), window.removeEventListener("focus", T);
78
+ return a.addEventListener("focusin", p), a.addEventListener("focusout", E), a.addEventListener("pointermove", p), a.addEventListener("pointerleave", C), window.addEventListener("blur", p), window.addEventListener("focus", T), () => {
79
+ a.removeEventListener("focusin", p), a.removeEventListener("focusout", E), a.removeEventListener("pointermove", p), a.removeEventListener("pointerleave", C), window.removeEventListener("blur", p), window.removeEventListener("focus", T);
80
80
  };
81
81
  }
82
- }, [g, f.isClosePausedRef]);
82
+ }, [R, f.isClosePausedRef]);
83
83
  const l = s.useCallback(
84
84
  ({ tabbingDirection: a }) => {
85
85
  const p = m().map((T) => {
86
- const h = T.ref.current, y = [h, ...at(h)];
87
- return a === "forwards" ? y : y.reverse();
86
+ const E = T.ref.current, C = [E, ...st(E)];
87
+ return a === "forwards" ? C : C.reverse();
88
88
  });
89
89
  return (a === "forwards" ? p.reverse() : p).flat();
90
90
  },
91
91
  [m]
92
92
  );
93
93
  return s.useEffect(() => {
94
- const a = E.current;
94
+ const a = w.current;
95
95
  if (a) {
96
- const P = (p) => {
97
- var y, C, N;
96
+ const h = (p) => {
97
+ var C, P, N;
98
98
  const T = p.altKey || p.ctrlKey || p.metaKey;
99
99
  if (p.key === "Tab" && !T) {
100
- const O = document.activeElement, F = p.shiftKey;
100
+ const M = document.activeElement, F = p.shiftKey;
101
101
  if (p.target === a && F) {
102
- (y = n.current) == null || y.focus();
102
+ (C = n.current) == null || C.focus();
103
103
  return;
104
104
  }
105
- const A = l({ tabbingDirection: F ? "backwards" : "forwards" }), V = A.findIndex((i) => i === O);
106
- z(A.slice(V + 1)) ? p.preventDefault() : F ? (C = n.current) == null || C.focus() : (N = w.current) == null || N.focus();
105
+ const A = l({ tabbingDirection: F ? "backwards" : "forwards" }), V = A.findIndex((i) => i === M);
106
+ z(A.slice(V + 1)) ? p.preventDefault() : F ? (P = n.current) == null || P.focus() : (N = y.current) == null || N.focus();
107
107
  }
108
108
  };
109
- return a.addEventListener("keydown", P), () => a.removeEventListener("keydown", P);
109
+ return a.addEventListener("keydown", h), () => a.removeEventListener("keydown", h);
110
110
  }
111
111
  }, [m, l]), /* @__PURE__ */ D(
112
- Le,
112
+ De,
113
113
  {
114
114
  ref: v,
115
115
  role: "region",
116
- "aria-label": u.replace("{hotkey}", R),
116
+ "aria-label": u.replace("{hotkey}", g),
117
117
  tabIndex: -1,
118
- style: { pointerEvents: g ? void 0 : "none" },
118
+ style: { pointerEvents: R ? void 0 : "none" },
119
119
  children: [
120
- g && /* @__PURE__ */ c(
120
+ R && /* @__PURE__ */ c(
121
121
  Q,
122
122
  {
123
123
  ref: n,
@@ -129,11 +129,11 @@ var le = "ToastViewport", je = ["F8"], G = "toast.viewportPause", J = "toast.vie
129
129
  }
130
130
  }
131
131
  ),
132
- /* @__PURE__ */ c(ee.Slot, { scope: o, children: /* @__PURE__ */ c(L.ol, { tabIndex: -1, ...d, ref: I }) }),
133
- g && /* @__PURE__ */ c(
132
+ /* @__PURE__ */ c(ee.Slot, { scope: o, children: /* @__PURE__ */ c(L.ol, { tabIndex: -1, ...d, ref: S }) }),
133
+ R && /* @__PURE__ */ c(
134
134
  Q,
135
135
  {
136
- ref: w,
136
+ ref: y,
137
137
  onFocusFromOutsideViewport: () => {
138
138
  const a = l({
139
139
  tabbingDirection: "backwards"
@@ -169,15 +169,15 @@ var fe = "ToastFocusProxy", Q = s.forwardRef(
169
169
  }
170
170
  );
171
171
  Q.displayName = fe;
172
- var U = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.swipeCancel", Je = "toast.swipeEnd", pe = s.forwardRef(
172
+ var U = "Toast", je = "toast.swipeStart", qe = "toast.swipeMove", ze = "toast.swipeCancel", Ge = "toast.swipeEnd", pe = s.forwardRef(
173
173
  (e, r) => {
174
- const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [m = !0, v] = Fe({
174
+ const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [m = !0, v] = Ae({
175
175
  prop: t,
176
176
  defaultProp: u,
177
177
  onChange: d
178
178
  });
179
- return /* @__PURE__ */ c(ke, { present: o || m, children: /* @__PURE__ */ c(
180
- et,
179
+ return /* @__PURE__ */ c(Oe, { present: o || m, children: /* @__PURE__ */ c(
180
+ Ze,
181
181
  {
182
182
  open: m,
183
183
  ...f,
@@ -189,25 +189,25 @@ var U = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.sw
189
189
  n.currentTarget.setAttribute("data-swipe", "start");
190
190
  }),
191
191
  onSwipeMove: b(e.onSwipeMove, (n) => {
192
- const { x: w, y: E } = n.detail.delta;
193
- n.currentTarget.setAttribute("data-swipe", "move"), n.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${w}px`), n.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${E}px`);
192
+ const { x: y, y: w } = n.detail.delta;
193
+ n.currentTarget.setAttribute("data-swipe", "move"), n.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${y}px`), n.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${w}px`);
194
194
  }),
195
195
  onSwipeCancel: b(e.onSwipeCancel, (n) => {
196
196
  n.currentTarget.setAttribute("data-swipe", "cancel"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), n.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), n.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
197
197
  }),
198
198
  onSwipeEnd: b(e.onSwipeEnd, (n) => {
199
- const { x: w, y: E } = n.detail.delta;
200
- n.currentTarget.setAttribute("data-swipe", "end"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), n.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${w}px`), n.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${E}px`), v(!1);
199
+ const { x: y, y: w } = n.detail.delta;
200
+ n.currentTarget.setAttribute("data-swipe", "end"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), n.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), n.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${y}px`), n.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${w}px`), v(!1);
201
201
  })
202
202
  }
203
203
  ) });
204
204
  }
205
205
  );
206
206
  pe.displayName = U;
207
- var [Qe, Ze] = ce(U, {
207
+ var [Je, Qe] = ce(U, {
208
208
  onClose() {
209
209
  }
210
- }), et = s.forwardRef(
210
+ }), Ze = s.forwardRef(
211
211
  (e, r) => {
212
212
  const {
213
213
  __scopeToast: o,
@@ -218,17 +218,17 @@ var [Qe, Ze] = ce(U, {
218
218
  onEscapeKeyDown: m,
219
219
  onPause: v,
220
220
  onResume: n,
221
- onSwipeStart: w,
222
- onSwipeMove: E,
223
- onSwipeCancel: I,
224
- onSwipeEnd: R,
225
- ...g
226
- } = e, l = $(U, o), [a, P] = s.useState(null), p = ae(r, (i) => P(i)), T = s.useRef(null), h = s.useRef(null), y = u || l.duration, C = s.useRef(0), N = s.useRef(y), O = s.useRef(0), { onToastAdd: F, onToastRemove: Y } = l, _ = X(() => {
221
+ onSwipeStart: y,
222
+ onSwipeMove: w,
223
+ onSwipeCancel: S,
224
+ onSwipeEnd: g,
225
+ ...R
226
+ } = e, l = $(U, o), [a, h] = s.useState(null), p = ae(r, (i) => h(i)), T = s.useRef(null), E = s.useRef(null), C = u || l.duration, P = s.useRef(0), N = s.useRef(C), M = s.useRef(0), { onToastAdd: F, onToastRemove: Y } = l, _ = X(() => {
227
227
  var x;
228
228
  (a == null ? void 0 : a.contains(document.activeElement)) && ((x = l.viewport) == null || x.focus()), f();
229
229
  }), A = s.useCallback(
230
230
  (i) => {
231
- !i || i === 1 / 0 || (window.clearTimeout(O.current), C.current = (/* @__PURE__ */ new Date()).getTime(), O.current = window.setTimeout(_, i));
231
+ !i || i === 1 / 0 || (window.clearTimeout(M.current), P.current = (/* @__PURE__ */ new Date()).getTime(), M.current = window.setTimeout(_, i));
232
232
  },
233
233
  [_]
234
234
  );
@@ -237,21 +237,21 @@ var [Qe, Ze] = ce(U, {
237
237
  if (i) {
238
238
  const x = () => {
239
239
  A(N.current), n == null || n();
240
- }, S = () => {
241
- const M = (/* @__PURE__ */ new Date()).getTime() - C.current;
242
- N.current = N.current - M, window.clearTimeout(O.current), v == null || v();
240
+ }, I = () => {
241
+ const O = (/* @__PURE__ */ new Date()).getTime() - P.current;
242
+ N.current = N.current - O, window.clearTimeout(M.current), v == null || v();
243
243
  };
244
- return i.addEventListener(G, S), i.addEventListener(J, x), () => {
245
- i.removeEventListener(G, S), i.removeEventListener(J, x);
244
+ return i.addEventListener(G, I), i.addEventListener(J, x), () => {
245
+ i.removeEventListener(G, I), i.removeEventListener(J, x);
246
246
  };
247
247
  }
248
- }, [l.viewport, y, v, n, A]), s.useEffect(() => {
249
- d && !l.isClosePausedRef.current && A(y);
250
- }, [d, y, l.isClosePausedRef, A]), s.useEffect(() => (F(), () => Y()), [F, Y]);
251
- const V = s.useMemo(() => a ? Pe(a) : null, [a]);
248
+ }, [l.viewport, C, v, n, A]), s.useEffect(() => {
249
+ d && !l.isClosePausedRef.current && A(C);
250
+ }, [d, C, l.isClosePausedRef, A]), s.useEffect(() => (F(), () => Y()), [F, Y]);
251
+ const V = s.useMemo(() => a ? Ce(a) : null, [a]);
252
252
  return l.viewport ? /* @__PURE__ */ D(se, { children: [
253
253
  V && /* @__PURE__ */ c(
254
- tt,
254
+ et,
255
255
  {
256
256
  __scopeToast: o,
257
257
  role: "status",
@@ -260,9 +260,9 @@ var [Qe, Ze] = ce(U, {
260
260
  children: V
261
261
  }
262
262
  ),
263
- /* @__PURE__ */ c(Qe, { scope: o, onClose: _, children: Ie.createPortal(
263
+ /* @__PURE__ */ c(Je, { scope: o, onClose: _, children: Se.createPortal(
264
264
  /* @__PURE__ */ c(ee.ItemSlot, { scope: o, children: /* @__PURE__ */ c(
265
- Oe,
265
+ Le,
266
266
  {
267
267
  asChild: !0,
268
268
  onEscapeKeyDown: b(m, () => {
@@ -277,7 +277,7 @@ var [Qe, Ze] = ce(U, {
277
277
  tabIndex: 0,
278
278
  "data-state": d ? "open" : "closed",
279
279
  "data-swipe-direction": l.swipeDirection,
280
- ...g,
280
+ ...R,
281
281
  ref: p,
282
282
  style: { userSelect: "none", touchAction: "none", ...e.style },
283
283
  onKeyDown: b(e.onKeyDown, (i) => {
@@ -288,27 +288,27 @@ var [Qe, Ze] = ce(U, {
288
288
  }),
289
289
  onPointerMove: b(e.onPointerMove, (i) => {
290
290
  if (!T.current) return;
291
- const x = i.clientX - T.current.x, S = i.clientY - T.current.y, M = !!h.current, k = ["left", "right"].includes(l.swipeDirection), K = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Ce = k ? K(0, x) : 0, xe = k ? 0 : K(0, S), B = i.pointerType === "touch" ? 10 : 2, H = { x: Ce, y: xe }, te = { originalEvent: i, delta: H };
292
- M ? (h.current = H, W(ze, E, te, {
291
+ const x = i.clientX - T.current.x, I = i.clientY - T.current.y, O = !!E.current, k = ["left", "right"].includes(l.swipeDirection), K = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Pe = k ? K(0, x) : 0, xe = k ? 0 : K(0, I), B = i.pointerType === "touch" ? 10 : 2, H = { x: Pe, y: xe }, te = { originalEvent: i, delta: H };
292
+ O ? (E.current = H, W(qe, w, te, {
293
293
  discrete: !1
294
- })) : ne(H, l.swipeDirection, B) ? (h.current = H, W(qe, w, te, {
294
+ })) : ne(H, l.swipeDirection, B) ? (E.current = H, W(je, y, te, {
295
295
  discrete: !1
296
- }), i.target.setPointerCapture(i.pointerId)) : (Math.abs(x) > B || Math.abs(S) > B) && (T.current = null);
296
+ }), i.target.setPointerCapture(i.pointerId)) : (Math.abs(x) > B || Math.abs(I) > B) && (T.current = null);
297
297
  }),
298
298
  onPointerUp: b(e.onPointerUp, (i) => {
299
- const x = h.current, S = i.target;
300
- if (S.hasPointerCapture(i.pointerId) && S.releasePointerCapture(i.pointerId), h.current = null, T.current = null, x) {
301
- const M = i.currentTarget, k = { originalEvent: i, delta: x };
302
- ne(x, l.swipeDirection, l.swipeThreshold) ? W(Je, R, k, {
299
+ const x = E.current, I = i.target;
300
+ if (I.hasPointerCapture(i.pointerId) && I.releasePointerCapture(i.pointerId), E.current = null, T.current = null, x) {
301
+ const O = i.currentTarget, k = { originalEvent: i, delta: x };
302
+ ne(x, l.swipeDirection, l.swipeThreshold) ? W(Ge, g, k, {
303
303
  discrete: !0
304
304
  }) : W(
305
- Ge,
306
- I,
305
+ ze,
306
+ S,
307
307
  k,
308
308
  {
309
309
  discrete: !0
310
310
  }
311
- ), M.addEventListener("click", (K) => K.preventDefault(), {
311
+ ), O.addEventListener("click", (K) => K.preventDefault(), {
312
312
  once: !0
313
313
  });
314
314
  }
@@ -321,9 +321,9 @@ var [Qe, Ze] = ce(U, {
321
321
  ) })
322
322
  ] }) : null;
323
323
  }
324
- ), tt = (e) => {
324
+ ), et = (e) => {
325
325
  const { __scopeToast: r, children: o, ...t } = e, u = $(U, r), [d, f] = s.useState(!1), [m, v] = s.useState(!1);
326
- return nt(() => f(!0)), s.useEffect(() => {
326
+ return rt(() => f(!0)), s.useEffect(() => {
327
327
  const n = window.setTimeout(() => v(!0), 1e3);
328
328
  return () => window.clearTimeout(n);
329
329
  }, []), m ? null : /* @__PURE__ */ c(Me, { asChild: !0, children: /* @__PURE__ */ c(ie, { ...t, children: d && /* @__PURE__ */ D(se, { children: [
@@ -331,20 +331,20 @@ var [Qe, Ze] = ce(U, {
331
331
  " ",
332
332
  o
333
333
  ] }) }) });
334
- }, ot = "ToastTitle", me = s.forwardRef(
334
+ }, tt = "ToastTitle", me = s.forwardRef(
335
335
  (e, r) => {
336
336
  const { __scopeToast: o, ...t } = e;
337
337
  return /* @__PURE__ */ c(L.div, { ...t, ref: r });
338
338
  }
339
339
  );
340
- me.displayName = ot;
341
- var rt = "ToastDescription", Te = s.forwardRef(
340
+ me.displayName = tt;
341
+ var ot = "ToastDescription", Te = s.forwardRef(
342
342
  (e, r) => {
343
343
  const { __scopeToast: o, ...t } = e;
344
344
  return /* @__PURE__ */ c(L.div, { ...t, ref: r });
345
345
  }
346
346
  );
347
- Te.displayName = rt;
347
+ Te.displayName = ot;
348
348
  var ve = "ToastAction", we = s.forwardRef(
349
349
  (e, r) => {
350
350
  const { altText: o, ...t } = e;
@@ -356,7 +356,7 @@ var ve = "ToastAction", we = s.forwardRef(
356
356
  we.displayName = ve;
357
357
  var Ee = "ToastClose", he = s.forwardRef(
358
358
  (e, r) => {
359
- const { __scopeToast: o, ...t } = e, u = Ze(Ee, o);
359
+ const { __scopeToast: o, ...t } = e, u = Qe(Ee, o);
360
360
  return /* @__PURE__ */ c(ye, { asChild: !0, children: /* @__PURE__ */ c(
361
361
  L.button,
362
362
  {
@@ -381,42 +381,42 @@ var ye = s.forwardRef((e, r) => {
381
381
  }
382
382
  );
383
383
  });
384
- function Pe(e) {
384
+ function Ce(e) {
385
385
  const r = [];
386
386
  return Array.from(e.childNodes).forEach((t) => {
387
- if (t.nodeType === t.TEXT_NODE && t.textContent && r.push(t.textContent), st(t)) {
387
+ if (t.nodeType === t.TEXT_NODE && t.textContent && r.push(t.textContent), nt(t)) {
388
388
  const u = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
389
389
  if (!u)
390
390
  if (d) {
391
391
  const f = t.dataset.radixToastAnnounceAlt;
392
392
  f && r.push(f);
393
393
  } else
394
- r.push(...Pe(t));
394
+ r.push(...Ce(t));
395
395
  }
396
396
  }), r;
397
397
  }
398
398
  function W(e, r, o, { discrete: t }) {
399
399
  const u = o.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: o });
400
- r && u.addEventListener(e, r, { once: !0 }), t ? Ne(u, d) : u.dispatchEvent(d);
400
+ r && u.addEventListener(e, r, { once: !0 }), t ? Ie(u, d) : u.dispatchEvent(d);
401
401
  }
402
402
  var ne = (e, r, o = 0) => {
403
403
  const t = Math.abs(e.x), u = Math.abs(e.y), d = t > u;
404
404
  return r === "left" || r === "right" ? d && t > o : !d && u > o;
405
405
  };
406
- function nt(e = () => {
406
+ function rt(e = () => {
407
407
  }) {
408
408
  const r = X(e);
409
- _e(() => {
409
+ Fe(() => {
410
410
  let o = 0, t = 0;
411
411
  return o = window.requestAnimationFrame(() => t = window.requestAnimationFrame(r)), () => {
412
412
  window.cancelAnimationFrame(o), window.cancelAnimationFrame(t);
413
413
  };
414
414
  }, [r]);
415
415
  }
416
- function st(e) {
416
+ function nt(e) {
417
417
  return e.nodeType === e.ELEMENT_NODE;
418
418
  }
419
- function at(e) {
419
+ function st(e) {
420
420
  const r = [], o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
421
421
  acceptNode: (t) => {
422
422
  const u = t.tagName === "INPUT" && t.type === "hidden";
@@ -430,8 +430,8 @@ function z(e) {
430
430
  const r = document.activeElement;
431
431
  return e.some((o) => o === r ? !0 : (o.focus(), document.activeElement !== r));
432
432
  }
433
- var it = ue, ct = de, ut = pe, lt = me, dt = Te, ft = we;
434
- const St = ({
433
+ var at = ue, it = de, ct = pe, ut = me, lt = Te, dt = we;
434
+ const gt = ({
435
435
  title: e,
436
436
  duration: r = 5e3,
437
437
  titleClassName: o,
@@ -440,39 +440,52 @@ const St = ({
440
440
  children: d,
441
441
  theme: f,
442
442
  showCloseButton: m = !0,
443
- className: v
443
+ closeButtonClassName: v,
444
+ className: n,
445
+ open: y = !1,
446
+ setOpen: w
444
447
  }) => {
445
- const [n, w] = Re(!1), E = be(0), { theme: I } = $e(), R = f ?? I;
446
- ge(() => () => clearTimeout(E.current), []);
447
- const g = oe(() => re(e) ? /* @__PURE__ */ c(j, { className: o, children: e }) : /* @__PURE__ */ c("h6", { className: o, children: e }), [e, o]), l = oe(() => re(u) ? /* @__PURE__ */ c(j, { className: t, children: u }) : /* @__PURE__ */ c("h6", { className: t, children: u }), [u, t]), a = Se(() => {
448
- w(!1), E.current = window.setTimeout(() => w(!0), 100);
449
- }, []);
450
- return /* @__PURE__ */ D(it, { swipeDirection: "right", duration: r, children: [
451
- /* @__PURE__ */ c(j, { onClick: a, children: d }),
448
+ const S = Re(0), { theme: g } = Xe(), R = f ?? g;
449
+ be(() => () => clearTimeout(S.current), []);
450
+ const l = oe(() => re(e) ? /* @__PURE__ */ c(j, { className: o, children: e }) : e, [e, o]), a = oe(() => re(u) ? /* @__PURE__ */ c(j, { className: t, children: u }) : u, [u, t]), h = ge(() => {
451
+ w(!1), S.current = window.setTimeout(() => w(!0), 100);
452
+ }, [w]);
453
+ return /* @__PURE__ */ D(at, { swipeDirection: "right", duration: r, children: [
454
+ /* @__PURE__ */ c(j, { onClick: h, children: d }),
452
455
  /* @__PURE__ */ D(
453
- ut,
456
+ ct,
454
457
  {
455
- className: q(He({ theme: R, className: v })),
456
- open: n,
458
+ className: q(Ke({ theme: R, className: n })),
459
+ open: y,
457
460
  onOpenChange: w,
458
461
  children: [
459
- /* @__PURE__ */ c(lt, { asChild: !0, className: "text-lg mb-2 font-semibold", children: g }),
460
- /* @__PURE__ */ c(dt, { asChild: !0, children: l }),
461
- m && /* @__PURE__ */ c(ft, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ D("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
462
- /* @__PURE__ */ c(Xe, { className: q(Ke({ theme: R })) }),
463
- /* @__PURE__ */ c(Ve, { children: "Close toast" })
462
+ /* @__PURE__ */ c(ut, { asChild: !0, className: o, children: l }),
463
+ a && /* @__PURE__ */ c(lt, { asChild: !0, children: a }),
464
+ m && /* @__PURE__ */ c(dt, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ D("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
465
+ /* @__PURE__ */ c(
466
+ We,
467
+ {
468
+ className: q(
469
+ Ve({
470
+ theme: R,
471
+ className: v
472
+ })
473
+ )
474
+ }
475
+ ),
476
+ /* @__PURE__ */ c(ke, { children: "Close toast" })
464
477
  ] }) })
465
478
  ]
466
479
  }
467
480
  ),
468
481
  /* @__PURE__ */ c(
469
- ct,
482
+ it,
470
483
  {
471
- className: q(We({ theme: R }))
484
+ className: q(He({ theme: R }))
472
485
  }
473
486
  )
474
487
  ] });
475
488
  };
476
489
  export {
477
- St as Toast
490
+ gt as Toast
478
491
  };
@@ -1,7 +1,6 @@
1
1
  import { c as e } from "../../index-BNmRGtA6.js";
2
2
  const a = e(
3
3
  [
4
- "bg-white",
5
4
  "rounded-md",
6
5
  "shadow-md",
7
6
  "p-4",
@@ -55,7 +54,7 @@ const a = e(
55
54
  theme: "kubefirst"
56
55
  }
57
56
  }
58
- ), i = e(["top-2", "right-2", "w-4", "h-4"], {
57
+ ), o = e(["top-2", "right-2", "w-4", "h-4"], {
59
58
  variants: {
60
59
  theme: {
61
60
  kubefirst: ["text-kubefirst-primary"],
@@ -68,7 +67,7 @@ const a = e(
68
67
  }
69
68
  });
70
69
  export {
71
- i as closeToastVariants,
70
+ o as closeToastVariants,
72
71
  a as toastVariants,
73
72
  r as viewportToastVariants
74
73
  };