@konstructio/ui 0.1.0-alpha.2 → 0.1.0-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 (133) hide show
  1. package/dist/{Combination-b348x__d.js → Combination-VYaRRJBZ.js} +155 -157
  2. package/dist/DatePicker.css +1 -0
  3. package/dist/Modal-CrG0m703.js +98 -0
  4. package/dist/assets/icons/components/Search.js +26 -0
  5. package/dist/assets/icons/components/Warning.js +22 -0
  6. package/dist/assets/icons/components/index.js +6 -0
  7. package/dist/chevron-down-3QGcvbP_.js +11 -0
  8. package/dist/{chevron-up-DgLBQCKD.js → chevron-up-RLP4nX7V.js} +1 -1
  9. package/dist/components/Alert/Alert.js +2 -2
  10. package/dist/components/AlertDialog/AlertDialog.js +55 -41
  11. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  12. package/dist/components/AlertDialog/components/index.js +1 -1
  13. package/dist/components/Badge/Badge.js +14 -14
  14. package/dist/components/Badge/Badge.variants.js +18 -17
  15. package/dist/components/Breadcrumb/Breadcrumb.js +44 -53
  16. package/dist/components/Breadcrumb/Breadcrumb.variants.js +10 -41
  17. package/dist/components/Breadcrumb/components/Item/Item.js +27 -27
  18. package/dist/components/Breadcrumb/components/Item/Item.variants.js +43 -56
  19. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  20. package/dist/components/Button/Button.js +30 -26
  21. package/dist/components/Button/Button.variants.js +116 -29
  22. package/dist/components/Checkbox/Checkbox.js +300 -185
  23. package/dist/components/Checkbox/Checkbox.variants.js +12 -15
  24. package/dist/components/Command/Command.js +2 -2
  25. package/dist/components/Command/components/Command.js +1 -1
  26. package/dist/components/Command/components/CommandEmpty.js +1 -1
  27. package/dist/components/Command/components/CommandGroup.js +1 -1
  28. package/dist/components/Command/components/CommandInput.js +2 -2
  29. package/dist/components/Command/components/CommandItem.js +1 -1
  30. package/dist/components/Command/components/CommandList.js +1 -1
  31. package/dist/components/Command/components/CommandSeparator.js +1 -1
  32. package/dist/components/Command/components/DialogContent.js +2 -2
  33. package/dist/components/Command/components/DialogOverlay.js +1 -1
  34. package/dist/components/Datepicker/DatePicker.js +2728 -0
  35. package/dist/components/Datepicker/DatePicker.variants.js +5 -0
  36. package/dist/components/Dropdown/components/List/List.js +55 -18
  37. package/dist/components/Dropdown/components/List/List.variants.js +5 -3
  38. package/dist/components/Dropdown/components/ListItem/ListItem.js +28 -22
  39. package/dist/components/Dropdown/components/Wrapper.js +110 -86
  40. package/dist/components/Dropdown/contexts/dropdown.context.js +6 -2
  41. package/dist/components/Dropdown/contexts/dropdown.hook.js +5 -3
  42. package/dist/components/Dropdown/contexts/dropdown.provider.js +18 -11
  43. package/dist/components/DropdownButton/DropdownButton.js +136 -0
  44. package/dist/components/Filter/Filter.js +20 -0
  45. package/dist/components/Filter/Filter.variants.js +22 -0
  46. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.js +86 -0
  47. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +95 -0
  48. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +87 -0
  49. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +90 -0
  50. package/dist/components/Filter/components/ResetButton/ResetButton.js +24 -0
  51. package/dist/components/Filter/components/index.js +8 -0
  52. package/dist/components/Filter/events/index.js +12 -0
  53. package/dist/components/Input/Input.js +134 -163
  54. package/dist/components/Input/Input.variants.js +15 -13
  55. package/dist/components/Loading/Loading.js +2 -2
  56. package/dist/components/Modal/Modal.js +2 -2
  57. package/dist/components/Modal/components/Body/Body.js +1 -1
  58. package/dist/components/Modal/components/Footer/Footer.js +1 -1
  59. package/dist/components/Modal/components/Header/Header.js +1 -1
  60. package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -4
  61. package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +4 -6
  62. package/dist/components/Modal/components/index.js +1 -1
  63. package/dist/components/NumberInput/NumberInput.js +2 -2
  64. package/dist/components/PieChart/PieChart.js +5130 -0
  65. package/dist/components/Radio/Radio.js +64 -49
  66. package/dist/components/Radio/Radio.variants.js +14 -12
  67. package/dist/components/RadioCard/RadioCard.js +23 -21
  68. package/dist/components/RadioCardGroup/RadioCardGroup.js +18 -18
  69. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  70. package/dist/components/Range/Range.js +1 -1
  71. package/dist/components/Slider/Slider.js +1 -1
  72. package/dist/components/Switch/Switch.js +141 -126
  73. package/dist/components/Tabs/Tabs.js +27 -0
  74. package/dist/components/Tabs/Tabs.variants.js +58 -0
  75. package/dist/components/Tabs/components/Content.js +19 -0
  76. package/dist/components/Tabs/components/List.js +20 -0
  77. package/dist/components/Tabs/components/Trigger.js +26 -0
  78. package/dist/components/Tabs/components/index.js +8 -0
  79. package/dist/components/Tag/Tag.js +1 -1
  80. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +2 -2
  81. package/dist/components/TimePicker/TimePicker.js +8 -0
  82. package/dist/components/TimePicker/TimePicker.variants.js +62 -0
  83. package/dist/components/TimePicker/components/HoursList/HoursList.js +93 -0
  84. package/dist/components/TimePicker/components/MeridianList/MeridianList.js +68 -0
  85. package/dist/components/TimePicker/components/MinutesList/MinutesList.js +60 -0
  86. package/dist/components/TimePicker/components/Wrapper/Wrapper.js +96 -0
  87. package/dist/components/TimePicker/components/WrapperList/WrapperList.js +51 -0
  88. package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +16 -0
  89. package/dist/components/TimePicker/components/index.js +4 -0
  90. package/dist/components/TimePicker/contexts/index.js +8 -0
  91. package/dist/components/TimePicker/contexts/time-picker.context.js +22 -0
  92. package/dist/components/TimePicker/contexts/time-picker.hook.js +13 -0
  93. package/dist/components/TimePicker/contexts/time-picker.provider.js +46 -0
  94. package/dist/components/TimePicker/utils/index.js +6 -0
  95. package/dist/components/Toast/Toast.js +38 -36
  96. package/dist/components/Tooltip/Tooltip.js +1 -1
  97. package/dist/components/Typography/Typography.js +14 -16
  98. package/dist/components/index.js +90 -66
  99. package/dist/createLucideIcon-B7yPYScZ.js +94 -0
  100. package/dist/index--EmNlyHx.js +31 -0
  101. package/dist/{index-Bk324h27.js → index-B5MIi2tR.js} +6 -5
  102. package/dist/{index-g-TFwd6Y.js → index-BCGvACM9.js} +2 -1
  103. package/dist/{index-AM3avohj.js → index-BNU3RH-3.js} +3 -3
  104. package/dist/{index-Bry5AFQ2.js → index-Bc1LNrRD.js} +1 -1
  105. package/dist/index-BdMNhZnh.js +9 -0
  106. package/dist/index-BvCZBMfr.js +432 -0
  107. package/dist/index-Cq1I1cG9.js +129 -0
  108. package/dist/index-Cs8Lv8Wj.js +13 -0
  109. package/dist/index-CvfCCTEO.js +323 -0
  110. package/dist/{index-DvFiic6N.js → index-DLYwlPRZ.js} +96 -102
  111. package/dist/{index-YaQrdkGE.js → index-DNRcvRTB.js} +31 -30
  112. package/dist/{index-dRxIWVBr.js → index-Dkt8F6CZ.js} +6 -5
  113. package/dist/{index-G_6jG4Qc.js → index-Dm-ooN_M.js} +18 -18
  114. package/dist/index-DwYXX2sM.js +13 -0
  115. package/dist/{index-C5psggHV.js → index-h-Ul0anl.js} +1 -2
  116. package/dist/{index-D9BbbgUq.js → index-rUBNhTeF.js} +2 -2
  117. package/dist/index.d.ts +263 -18
  118. package/dist/index.js +96 -72
  119. package/dist/package.json +42 -40
  120. package/dist/styles.css +1 -1
  121. package/dist/ui/civo-theme.css +263 -0
  122. package/dist/ui/kubefirst-theme.css +1 -1
  123. package/dist/ui/theme.css +11 -0
  124. package/dist/useBreadcrumb-DMERrNkJ.js +1280 -0
  125. package/dist/utils/index.js +4 -4
  126. package/dist/{x-DU-Zw-L_.js → x-BPcqkRZd.js} +1 -1
  127. package/package.json +42 -40
  128. package/dist/Modal-i7eolhYH.js +0 -926
  129. package/dist/createLucideIcon-CoF3ywd5.js +0 -89
  130. package/dist/index-BOx5P4tS.js +0 -423
  131. package/dist/index-CWKdynYu.js +0 -32
  132. package/dist/index-bYyfdsls.js +0 -118
  133. package/dist/useBreadcrumb-BsIeMoR1.js +0 -1279
@@ -0,0 +1,68 @@
1
+ import { jsxs as b, jsx as r } from "react/jsx-runtime";
2
+ import { useCallback as N } from "react";
3
+ import { cn as t } from "../../../../utils/index.js";
4
+ import { buttonVariants as c, liVariants as s } from "../../TimePicker.variants.js";
5
+ import { useTimePickerContext as x } from "../../contexts/time-picker.hook.js";
6
+ const M = ({
7
+ listClassName: m,
8
+ listItemClassName: a,
9
+ listItemButtonClassName: i
10
+ }) => {
11
+ const { format: p, isAM: l, onSelectAM: u, onSelectPM: d } = x(), o = N(
12
+ (e, f) => {
13
+ var n;
14
+ (n = e.currentTarget) == null || n.blur(), f();
15
+ },
16
+ []
17
+ );
18
+ return p === "24" ? null : /* @__PURE__ */ b(
19
+ "ul",
20
+ {
21
+ className: t("flex items-center justify-center flex-col", m),
22
+ "aria-label": "meridian",
23
+ role: "listbox",
24
+ children: [
25
+ /* @__PURE__ */ r(
26
+ "li",
27
+ {
28
+ className: t(s({ className: a })),
29
+ "data-active": l,
30
+ role: "presentation",
31
+ children: /* @__PURE__ */ r(
32
+ "button",
33
+ {
34
+ type: "button",
35
+ role: "option",
36
+ className: t(c({ className: i })),
37
+ onClick: (e) => o(e, u),
38
+ children: "AM"
39
+ }
40
+ )
41
+ }
42
+ ),
43
+ /* @__PURE__ */ r(
44
+ "li",
45
+ {
46
+ className: t(s({ className: a })),
47
+ "data-active": !l,
48
+ role: "presentation",
49
+ children: /* @__PURE__ */ r(
50
+ "button",
51
+ {
52
+ type: "button",
53
+ role: "option",
54
+ className: t(c({ className: i })),
55
+ onClick: (e) => o(e, d),
56
+ children: "PM"
57
+ }
58
+ )
59
+ }
60
+ )
61
+ ]
62
+ }
63
+ );
64
+ };
65
+ M.displayName = "MeridianList";
66
+ export {
67
+ M as MeridianList
68
+ };
@@ -0,0 +1,60 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useRef as i, useEffect as p, useCallback as f } from "react";
3
+ import { cn as n } from "../../../../utils/index.js";
4
+ import { buttonVariants as b, liVariants as h, ulVariants as d } from "../../TimePicker.variants.js";
5
+ import { useTimePickerContext as k } from "../../contexts/time-picker.hook.js";
6
+ const y = ({ minutes: a, scrollBehavior: l }) => {
7
+ const s = i(null), u = i(a), { onSelectMinute: c } = k();
8
+ p(() => {
9
+ const r = s.current;
10
+ if (r) {
11
+ const e = `0${u.current}`.slice(-2), t = r.querySelector(
12
+ `[data-value="${e}"]`
13
+ );
14
+ t == null || t.scrollIntoView({
15
+ behavior: l,
16
+ block: "center"
17
+ });
18
+ }
19
+ }, [l]);
20
+ const m = f(
21
+ (r, e) => {
22
+ var t;
23
+ c(r), (t = e.currentTarget) == null || t.blur();
24
+ },
25
+ [c]
26
+ );
27
+ return /* @__PURE__ */ o(
28
+ "ul",
29
+ {
30
+ ref: s,
31
+ className: n(d()),
32
+ "aria-label": "minutes",
33
+ role: "listbox",
34
+ children: Array.from({ length: 60 }, (r, e) => /* @__PURE__ */ o(
35
+ "li",
36
+ {
37
+ className: n(h()),
38
+ "data-value": `0${e}`.slice(-2),
39
+ "data-active": a === e,
40
+ role: "presentation",
41
+ children: /* @__PURE__ */ o(
42
+ "button",
43
+ {
44
+ type: "button",
45
+ role: "option",
46
+ className: n(b()),
47
+ onClick: (t) => m(e, t),
48
+ children: `0${e}`.slice(-2)
49
+ }
50
+ )
51
+ },
52
+ e
53
+ ))
54
+ }
55
+ );
56
+ };
57
+ y.displayName = "MinutesList";
58
+ export {
59
+ y as MinutesList
60
+ };
@@ -0,0 +1,96 @@
1
+ import { jsxs as t, jsx as a } from "react/jsx-runtime";
2
+ import { useId as y, useState as E, useRef as O, useCallback as I, useEffect as L } from "react";
3
+ import { cn as d } from "../../../../utils/index.js";
4
+ import { timePickerVariants as j } from "../../TimePicker.variants.js";
5
+ import { WrapperList as P } from "../WrapperList/WrapperList.js";
6
+ import { C as R } from "../../../../chevron-down-3QGcvbP_.js";
7
+ import { useTimePickerContext as T } from "../../contexts/time-picker.hook.js";
8
+ const $ = ({
9
+ name: p,
10
+ label: i,
11
+ required: f,
12
+ scrollBehavior: u,
13
+ className: x,
14
+ listClassName: h,
15
+ listItemClassName: w,
16
+ listItemButtonClassName: b
17
+ }) => {
18
+ const g = y(), [n, r] = E(!1), l = O(null), { format: k, formattedTime: c } = T(), s = p ?? `time-${g}`, v = I(() => r((e) => !e), []);
19
+ return L(() => {
20
+ const e = new AbortController(), C = (o) => {
21
+ o.key === "Escape" && r(!1);
22
+ }, N = (o) => {
23
+ var m;
24
+ (m = l.current) != null && m.contains(o.target) || r(!1);
25
+ };
26
+ return document.addEventListener("mousedown", N, {
27
+ signal: e.signal
28
+ }), document.addEventListener("keydown", C, {
29
+ signal: e.signal
30
+ }), () => {
31
+ e.abort();
32
+ };
33
+ }, []), /* @__PURE__ */ t(
34
+ "div",
35
+ {
36
+ ref: l,
37
+ className: d(
38
+ "w-max text-slate-800 text-sm flex flex-col gap-2",
39
+ k === "12" ? "w-[208px]" : "w-[140px]"
40
+ ),
41
+ children: [
42
+ i ? /* @__PURE__ */ t("label", { htmlFor: s, className: "text-slate-500 font-medium", children: [
43
+ i,
44
+ " ",
45
+ f && /* @__PURE__ */ a("span", { className: "text-red-600", children: "*" })
46
+ ] }) : null,
47
+ /* @__PURE__ */ t("div", { className: "relative", children: [
48
+ /* @__PURE__ */ t(
49
+ "button",
50
+ {
51
+ "aria-label": s,
52
+ "aria-haspopup": "listbox",
53
+ "aria-expanded": "true",
54
+ "aria-controls": "time-options",
55
+ className: d(j({ className: x })),
56
+ "data-open": n,
57
+ onClick: v,
58
+ children: [
59
+ c,
60
+ /* @__PURE__ */ a(
61
+ R,
62
+ {
63
+ className: "w-4 h-4 transition-all text-gray-400 data-[open=true]:rotate-180",
64
+ "data-open": n
65
+ }
66
+ )
67
+ ]
68
+ }
69
+ ),
70
+ /* @__PURE__ */ a(
71
+ P,
72
+ {
73
+ isOpen: n,
74
+ scrollBehavior: u,
75
+ listClassName: h,
76
+ listItemClassName: w,
77
+ listItemButtonClassName: b
78
+ }
79
+ )
80
+ ] }),
81
+ /* @__PURE__ */ a(
82
+ "input",
83
+ {
84
+ type: "hidden",
85
+ name: s,
86
+ value: c,
87
+ className: "hidden"
88
+ }
89
+ )
90
+ ]
91
+ }
92
+ );
93
+ };
94
+ export {
95
+ $ as Wrapper
96
+ };
@@ -0,0 +1,51 @@
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { useMemo as n } from "react";
3
+ import { cn as s } from "../../../../utils/index.js";
4
+ import { getHours as d, getMinutes as M } from "../../utils/index.js";
5
+ import { HoursList as x } from "../HoursList/HoursList.js";
6
+ import { MeridianList as L } from "../MeridianList/MeridianList.js";
7
+ import { MinutesList as g } from "../MinutesList/MinutesList.js";
8
+ import { wrapperVariants as H } from "./WrapperList.variants.js";
9
+ import { useTimePickerContext as j } from "../../contexts/time-picker.hook.js";
10
+ const v = ({
11
+ isOpen: m,
12
+ scrollBehavior: p,
13
+ listClassName: o,
14
+ listItemClassName: i,
15
+ listItemButtonClassName: t
16
+ }) => {
17
+ const { time: r } = j(), u = n(() => d(r), [r]), f = n(() => M(r), [r]);
18
+ return m ? /* @__PURE__ */ c("div", { role: "group", className: s(H()), children: [
19
+ /* @__PURE__ */ e(
20
+ x,
21
+ {
22
+ hours: u,
23
+ scrollBehavior: p,
24
+ listClassName: o,
25
+ listItemClassName: i,
26
+ listItemButtonClassName: t
27
+ }
28
+ ),
29
+ /* @__PURE__ */ e(
30
+ g,
31
+ {
32
+ minutes: f,
33
+ scrollBehavior: p,
34
+ listClassName: o,
35
+ listItemClassName: i,
36
+ listItemButtonClassName: t
37
+ }
38
+ ),
39
+ /* @__PURE__ */ e(
40
+ L,
41
+ {
42
+ listClassName: o,
43
+ listItemClassName: i,
44
+ listItemButtonClassName: t
45
+ }
46
+ )
47
+ ] }) : null;
48
+ };
49
+ export {
50
+ v as WrapperList
51
+ };
@@ -0,0 +1,16 @@
1
+ import { c as a } from "../../../../index-BNmRGtA6.js";
2
+ const p = a([
3
+ "flex",
4
+ "gap-1.5",
5
+ "p-2",
6
+ "rounded-md",
7
+ "shadow",
8
+ "w-full",
9
+ "max-h-[216px]",
10
+ "absolute mt-1",
11
+ "bg-white",
12
+ "z-10"
13
+ ]);
14
+ export {
15
+ p as wrapperVariants
16
+ };
@@ -0,0 +1,4 @@
1
+ import { WrapperList as e } from "./WrapperList/WrapperList.js";
2
+ export {
3
+ e as WrapperList
4
+ };
@@ -0,0 +1,8 @@
1
+ import { TimePickerContext as o } from "./time-picker.context.js";
2
+ import { TimePickerProvider as t } from "./time-picker.provider.js";
3
+ import { useTimePickerContext as x } from "./time-picker.hook.js";
4
+ export {
5
+ o as TimePickerContext,
6
+ t as TimePickerProvider,
7
+ x as useTimePickerContext
8
+ };
@@ -0,0 +1,22 @@
1
+ import { createContext as e } from "react";
2
+ const o = e({
3
+ time: /* @__PURE__ */ new Date(),
4
+ format: "12",
5
+ formattedTime: "",
6
+ isAM: !1,
7
+ onSelectHour() {
8
+ throw new Error("onSelectHour is not implemented");
9
+ },
10
+ onSelectMinute() {
11
+ throw new Error("onSelectMinute is not implemented");
12
+ },
13
+ onSelectAM() {
14
+ throw new Error("onSelectAM is not implemented");
15
+ },
16
+ onSelectPM() {
17
+ throw new Error("onSelectPM is not implemented");
18
+ }
19
+ });
20
+ export {
21
+ o as TimePickerContext
22
+ };
@@ -0,0 +1,13 @@
1
+ import { useContext as t } from "react";
2
+ import { TimePickerContext as r } from "./time-picker.context.js";
3
+ const n = () => {
4
+ const e = t(r);
5
+ if (!e)
6
+ throw new Error(
7
+ "useTimePickerContext must be used within a TimePickerProvider"
8
+ );
9
+ return e;
10
+ };
11
+ export {
12
+ n as useTimePickerContext
13
+ };
@@ -0,0 +1,46 @@
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import { useState as i, useMemo as T, useCallback as c, useEffect as d } from "react";
3
+ import { getFormattedTime as P } from "../utils/index.js";
4
+ import { TimePickerContext as p } from "./time-picker.context.js";
5
+ const x = ({ children: m, time: u, format: a }) => {
6
+ const [n, l] = i(a), [t, r] = i(() => u ?? /* @__PURE__ */ new Date()), s = T(() => t.getHours() < 12, [t]), f = c(
7
+ (e) => {
8
+ const o = new Date(t);
9
+ n === "12" ? e === 12 ? o.setHours(s ? 0 : 12) : o.setHours(s ? e : e + 12) : o.setHours(e), r(o);
10
+ },
11
+ [n, s, t]
12
+ ), H = c(
13
+ (e) => {
14
+ const o = new Date(t);
15
+ o.setMinutes(e), r(o);
16
+ },
17
+ [t]
18
+ ), w = c(() => {
19
+ const e = new Date(t), o = e.getHours();
20
+ s || e.setHours(o - 12), r(e);
21
+ }, [s, t]), M = c(() => {
22
+ const e = new Date(t), o = e.getHours();
23
+ s && e.setHours(o + 12), r(e);
24
+ }, [s, t]);
25
+ return d(() => {
26
+ l(n);
27
+ }, [n]), /* @__PURE__ */ S(
28
+ p.Provider,
29
+ {
30
+ value: {
31
+ time: t,
32
+ format: n,
33
+ formattedTime: P(t, n),
34
+ isAM: s,
35
+ onSelectHour: f,
36
+ onSelectMinute: H,
37
+ onSelectAM: w,
38
+ onSelectPM: M
39
+ },
40
+ children: m
41
+ }
42
+ );
43
+ };
44
+ export {
45
+ x as TimePickerProvider
46
+ };
@@ -0,0 +1,6 @@
1
+ const e = (t, r) => r === "12" ? `${t.getHours() % 12 || 12}:${t.getMinutes().toString().padStart(2, "0")} ${t.getHours() >= 12 ? "PM" : "AM"}` : `${t.getHours().toString().padStart(2, "0")}:${t.getMinutes().toString().padStart(2, "0")}`, n = (t) => t.getHours(), g = (t) => t.getMinutes();
2
+ export {
3
+ e as getFormattedTime,
4
+ n as getHours,
5
+ g as getMinutes
6
+ };
@@ -1,17 +1,18 @@
1
1
  import { jsx as c, jsxs as D, Fragment as se } from "react/jsx-runtime";
2
- import { u as ae, S as j } from "../../index-Bk324h27.js";
2
+ import { u as ae, S as j } from "../../index-B5MIi2tR.js";
3
3
  import * as s from "react";
4
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-g-TFwd6Y.js";
6
- import { c as Ne, a as Ae, b, d as X, u as Fe } from "../../index-bYyfdsls.js";
7
- import { c as _e } from "../../index-D9BbbgUq.js";
8
- import { B as De, R as Le, P as Me } from "../../index-YaQrdkGE.js";
9
- import { P as Oe } from "../../index-G_6jG4Qc.js";
10
- import { V as ie, R as ke } from "../../index-CWKdynYu.js";
5
+ import { P as L, r as Se, d as Ie } from "../../index-BCGvACM9.js";
6
+ import { c as Ne, a as Ae, b, u as Fe } from "../../index-Cq1I1cG9.js";
7
+ import { c as _e } from "../../index-rUBNhTeF.js";
8
+ import { B as De, R as Le, P as Me } from "../../index-DNRcvRTB.js";
9
+ import { P as Oe } from "../../index-Dm-ooN_M.js";
10
+ import { u as $ } from "../../index-DwYXX2sM.js";
11
+ import { V as ie, R as ke } from "../../index--EmNlyHx.js";
11
12
  import { cn as q } from "../../utils/index.js";
12
13
  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
- var Z = "ToastProvider", [ee, Xe, $e] = _e("Toast"), [ce, xt] = Ne("Toast", [$e]), [Ue, $] = ce(Z), ue = (e) => {
14
+ import { X as We } from "../../x-BPcqkRZd.js";
15
+ var Z = "ToastProvider", [ee, Xe, $e] = _e("Toast"), [ce, Rt] = Ne("Toast", [$e]), [Ue, U] = ce(Z), ue = (e) => {
15
16
  const {
16
17
  __scopeToast: r,
17
18
  label: o = "Notification",
@@ -49,7 +50,7 @@ var le = "ToastViewport", Ye = ["F8"], G = "toast.viewportPause", J = "toast.vie
49
50
  hotkey: t = Ye,
50
51
  label: u = "Notifications ({hotkey})",
51
52
  ...d
52
- } = e, f = $(le, o), m = Xe(o), v = s.useRef(null), n = s.useRef(null), h = 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;
53
+ } = e, f = U(le, o), m = Xe(o), v = s.useRef(null), n = s.useRef(null), h = 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;
53
54
  s.useEffect(() => {
54
55
  const i = (C) => {
55
56
  var T;
@@ -101,8 +102,8 @@ var le = "ToastViewport", Ye = ["F8"], G = "toast.viewportPause", J = "toast.vie
101
102
  (y = n.current) == null || y.focus();
102
103
  return;
103
104
  }
104
- const A = l({ tabbingDirection: F ? "backwards" : "forwards" }), V = A.findIndex((a) => a === M);
105
- z(A.slice(V + 1)) ? p.preventDefault() : F ? (P = n.current) == null || P.focus() : (N = h.current) == null || N.focus();
105
+ const A = l({ tabbingDirection: F ? "backwards" : "forwards" }), K = A.findIndex((a) => a === M);
106
+ z(A.slice(K + 1)) ? p.preventDefault() : F ? (P = n.current) == null || P.focus() : (N = h.current) == null || N.focus();
106
107
  }
107
108
  };
108
109
  return i.addEventListener("keydown", C), () => i.removeEventListener("keydown", C);
@@ -149,7 +150,7 @@ var le = "ToastViewport", Ye = ["F8"], G = "toast.viewportPause", J = "toast.vie
149
150
  de.displayName = le;
150
151
  var fe = "ToastFocusProxy", Q = s.forwardRef(
151
152
  (e, r) => {
152
- const { __scopeToast: o, onFocusFromOutsideViewport: t, ...u } = e, d = $(fe, o);
153
+ const { __scopeToast: o, onFocusFromOutsideViewport: t, ...u } = e, d = U(fe, o);
153
154
  return /* @__PURE__ */ c(
154
155
  ie,
155
156
  {
@@ -168,12 +169,13 @@ var fe = "ToastFocusProxy", Q = s.forwardRef(
168
169
  }
169
170
  );
170
171
  Q.displayName = fe;
171
- var U = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.swipeCancel", ze = "toast.swipeEnd", pe = s.forwardRef(
172
+ var V = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.swipeCancel", ze = "toast.swipeEnd", pe = s.forwardRef(
172
173
  (e, r) => {
173
- const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [m = !0, v] = Ae({
174
+ const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...f } = e, [m, v] = Ae({
174
175
  prop: t,
175
- defaultProp: u,
176
- onChange: d
176
+ defaultProp: u ?? !0,
177
+ onChange: d,
178
+ caller: V
177
179
  });
178
180
  return /* @__PURE__ */ c(Oe, { present: o || m, children: /* @__PURE__ */ c(
179
181
  Qe,
@@ -182,8 +184,8 @@ var U = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.sw
182
184
  ...f,
183
185
  ref: r,
184
186
  onClose: () => v(!1),
185
- onPause: X(e.onPause),
186
- onResume: X(e.onResume),
187
+ onPause: $(e.onPause),
188
+ onResume: $(e.onResume),
187
189
  onSwipeStart: b(e.onSwipeStart, (n) => {
188
190
  n.currentTarget.setAttribute("data-swipe", "start");
189
191
  }),
@@ -202,8 +204,8 @@ var U = "Toast", Be = "toast.swipeStart", je = "toast.swipeMove", qe = "toast.sw
202
204
  ) });
203
205
  }
204
206
  );
205
- pe.displayName = U;
206
- var [Ge, Je] = ce(U, {
207
+ pe.displayName = V;
208
+ var [Ge, Je] = ce(V, {
207
209
  onClose() {
208
210
  }
209
211
  }), Qe = s.forwardRef(
@@ -222,7 +224,7 @@ var [Ge, Je] = ce(U, {
222
224
  onSwipeCancel: S,
223
225
  onSwipeEnd: g,
224
226
  ...R
225
- } = e, l = $(U, o), [i, C] = s.useState(null), p = ae(r, (a) => C(a)), T = s.useRef(null), E = s.useRef(null), y = u || l.duration, P = s.useRef(0), N = s.useRef(y), M = s.useRef(0), { onToastAdd: F, onToastRemove: Y } = l, _ = X(() => {
227
+ } = e, l = U(V, o), [i, C] = s.useState(null), p = ae(r, (a) => C(a)), T = s.useRef(null), E = s.useRef(null), y = u || l.duration, P = s.useRef(0), N = s.useRef(y), M = s.useRef(0), { onToastAdd: F, onToastRemove: Y } = l, _ = $(() => {
226
228
  var x;
227
229
  (i == null ? void 0 : i.contains(document.activeElement)) && ((x = l.viewport) == null || x.focus()), f();
228
230
  }), A = s.useCallback(
@@ -247,16 +249,16 @@ var [Ge, Je] = ce(U, {
247
249
  }, [l.viewport, y, v, n, A]), s.useEffect(() => {
248
250
  d && !l.isClosePausedRef.current && A(y);
249
251
  }, [d, y, l.isClosePausedRef, A]), s.useEffect(() => (F(), () => Y()), [F, Y]);
250
- const V = s.useMemo(() => i ? Ce(i) : null, [i]);
252
+ const K = s.useMemo(() => i ? Ce(i) : null, [i]);
251
253
  return l.viewport ? /* @__PURE__ */ D(se, { children: [
252
- V && /* @__PURE__ */ c(
254
+ K && /* @__PURE__ */ c(
253
255
  Ze,
254
256
  {
255
257
  __scopeToast: o,
256
258
  role: "status",
257
259
  "aria-live": t === "foreground" ? "assertive" : "polite",
258
260
  "aria-atomic": !0,
259
- children: V
261
+ children: K
260
262
  }
261
263
  ),
262
264
  /* @__PURE__ */ c(Ge, { scope: o, onClose: _, children: Se.createPortal(
@@ -287,10 +289,10 @@ var [Ge, Je] = ce(U, {
287
289
  }),
288
290
  onPointerMove: b(e.onPointerMove, (a) => {
289
291
  if (!T.current) return;
290
- const x = a.clientX - T.current.x, I = a.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 = a.pointerType === "touch" ? 10 : 2, H = { x: Pe, y: xe }, te = { originalEvent: a, delta: H };
291
- O ? (E.current = H, W(je, w, te, {
292
+ const x = a.clientX - T.current.x, I = a.clientY - T.current.y, O = !!E.current, k = ["left", "right"].includes(l.swipeDirection), H = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Pe = k ? H(0, x) : 0, xe = k ? 0 : H(0, I), B = a.pointerType === "touch" ? 10 : 2, W = { x: Pe, y: xe }, te = { originalEvent: a, delta: W };
293
+ O ? (E.current = W, X(je, w, te, {
292
294
  discrete: !1
293
- })) : ne(H, l.swipeDirection, B) ? (E.current = H, W(Be, h, te, {
295
+ })) : ne(W, l.swipeDirection, B) ? (E.current = W, X(Be, h, te, {
294
296
  discrete: !1
295
297
  }), a.target.setPointerCapture(a.pointerId)) : (Math.abs(x) > B || Math.abs(I) > B) && (T.current = null);
296
298
  }),
@@ -298,16 +300,16 @@ var [Ge, Je] = ce(U, {
298
300
  const x = E.current, I = a.target;
299
301
  if (I.hasPointerCapture(a.pointerId) && I.releasePointerCapture(a.pointerId), E.current = null, T.current = null, x) {
300
302
  const O = a.currentTarget, k = { originalEvent: a, delta: x };
301
- ne(x, l.swipeDirection, l.swipeThreshold) ? W(ze, g, k, {
303
+ ne(x, l.swipeDirection, l.swipeThreshold) ? X(ze, g, k, {
302
304
  discrete: !0
303
- }) : W(
305
+ }) : X(
304
306
  qe,
305
307
  S,
306
308
  k,
307
309
  {
308
310
  discrete: !0
309
311
  }
310
- ), O.addEventListener("click", (K) => K.preventDefault(), {
312
+ ), O.addEventListener("click", (H) => H.preventDefault(), {
311
313
  once: !0
312
314
  });
313
315
  }
@@ -321,7 +323,7 @@ var [Ge, Je] = ce(U, {
321
323
  ] }) : null;
322
324
  }
323
325
  ), Ze = (e) => {
324
- const { __scopeToast: r, children: o, ...t } = e, u = $(U, r), [d, f] = s.useState(!1), [m, v] = s.useState(!1);
326
+ const { __scopeToast: r, children: o, ...t } = e, u = U(V, r), [d, f] = s.useState(!1), [m, v] = s.useState(!1);
325
327
  return ot(() => f(!0)), s.useEffect(() => {
326
328
  const n = window.setTimeout(() => v(!0), 1e3);
327
329
  return () => window.clearTimeout(n);
@@ -394,7 +396,7 @@ function Ce(e) {
394
396
  }
395
397
  }), r;
396
398
  }
397
- function W(e, r, o, { discrete: t }) {
399
+ function X(e, r, o, { discrete: t }) {
398
400
  const u = o.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: o });
399
401
  r && u.addEventListener(e, r, { once: !0 }), t ? Ie(u, d) : u.dispatchEvent(d);
400
402
  }
@@ -404,7 +406,7 @@ var ne = (e, r, o = 0) => {
404
406
  };
405
407
  function ot(e = () => {
406
408
  }) {
407
- const r = X(e);
409
+ const r = $(e);
408
410
  Fe(() => {
409
411
  let o = 0, t = 0;
410
412
  return o = window.requestAnimationFrame(() => t = window.requestAnimationFrame(r)), () => {
@@ -430,7 +432,7 @@ function z(e) {
430
432
  return e.some((o) => o === r ? !0 : (o.focus(), document.activeElement !== r));
431
433
  }
432
434
  var st = ue, at = de, it = pe, ct = me, ut = Te, lt = we;
433
- const Rt = ({
435
+ const bt = ({
434
436
  title: e,
435
437
  duration: r = 5e3,
436
438
  titleClassName: o,
@@ -481,5 +483,5 @@ const Rt = ({
481
483
  ] });
482
484
  };
483
485
  export {
484
- Rt as Toast
486
+ bt as Toast
485
487
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { S as i } from "../../index-Bk324h27.js";
2
+ import { S as i } from "../../index-B5MIi2tR.js";
3
3
  import { forwardRef as v, useRef as N, useImperativeHandle as w, useMemo as h, isValidElement as x } from "react";
4
4
  import { cn as o } from "../../utils/index.js";
5
5
  import { arrowVariants as R, tooltipVariants as V } from "./Tooltip.variants.js";
@@ -1,25 +1,23 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { useId as d } from "react";
3
- import { cn as h } from "../../utils/index.js";
4
- import { typographyVariants as l } from "./Typography.variants.js";
5
- import { S as g } from "../../index-Bk324h27.js";
6
- const i = ({
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { cn as f } from "../../utils/index.js";
3
+ import { typographyVariants as h } from "./Typography.variants.js";
4
+ import { S as l } from "../../index-B5MIi2tR.js";
5
+ const d = ({
7
6
  className: p,
8
7
  theme: m,
9
8
  children: s,
10
9
  variant: o,
11
- component: r,
12
- asChild: e = !1,
10
+ component: e,
11
+ asChild: r = !1,
13
12
  ...t
14
13
  }) => {
15
- const y = d(), c = e ? g : r ?? (o != null && o.includes("h") ? o : "p");
16
- return /* @__PURE__ */ f(
17
- c,
14
+ const y = r ? l : e ?? (o != null && o.includes("h") ? o : "p");
15
+ return /* @__PURE__ */ c(
16
+ y,
18
17
  {
19
- id: y,
20
18
  "data-theme": m,
21
- className: h(
22
- l({
19
+ className: f(
20
+ h({
23
21
  className: p,
24
22
  variant: o
25
23
  })
@@ -29,7 +27,7 @@ const i = ({
29
27
  }
30
28
  );
31
29
  };
32
- i.displayName = "Typography";
30
+ d.displayName = "Typography";
33
31
  export {
34
- i as Typography
32
+ d as Typography
35
33
  };