@konstructio/ui 0.0.12-alpha.1 → 0.0.12-alpha.10
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.
- package/dist/{Combination-BQYb0Gw7.js → Combination-b348x__d.js} +24 -24
- package/dist/Modal-B-E9uaA6.js +922 -0
- package/dist/components/Alert/Alert.js +58 -0
- package/dist/components/Alert/Alert.variants.js +77 -0
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Autocomplete/Autocomplete.variants.js +0 -1
- package/dist/components/Autocomplete/components/List/List.js +3 -3
- package/dist/components/Breadcrumb/Breadcrumb.js +3 -3
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +18 -15
- package/dist/components/Breadcrumb/components/Item/Item.js +4 -4
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Card/Card.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +5 -5
- package/dist/components/Command/Command.js +32 -0
- package/dist/components/Command/Command.variants.js +97 -0
- package/dist/components/Command/components/Command.js +8 -0
- package/dist/components/Command/components/CommandEmpty.js +15 -0
- package/dist/components/Command/components/CommandGroup.js +19 -0
- package/dist/components/Command/components/CommandInput.js +84 -0
- package/dist/components/Command/components/CommandItem.js +29 -0
- package/dist/components/Command/components/CommandList.js +16 -0
- package/dist/components/Command/components/CommandSeparator.js +16 -0
- package/dist/components/Command/components/CommandShortcut.js +19 -0
- package/dist/components/Command/components/DialogContent.js +31 -0
- package/dist/components/Command/components/DialogOverlay.js +19 -0
- package/dist/components/Command/components/index.js +20 -0
- package/dist/components/Command/contexts/Command.context.js +13 -0
- package/dist/components/Command/contexts/Command.provider.js +24 -0
- package/dist/components/Command/contexts/index.js +6 -0
- package/dist/components/Divider/Divider.js +10 -0
- package/dist/components/Divider/Divider.variants.js +14 -0
- package/dist/components/Dropdown/Dropdown.variants.js +22 -3
- package/dist/components/Dropdown/components/List/List.variants.js +4 -4
- package/dist/components/Dropdown/components/ListItem/ListItem.js +19 -18
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +6 -4
- package/dist/components/Dropdown/components/Wrapper.js +88 -57
- package/dist/components/Input/Input.js +112 -67
- package/dist/components/Input/Input.variants.js +5 -6
- package/dist/components/Loading/Loading.js +109 -0
- package/dist/components/Loading/Loading.variants.js +19 -0
- package/dist/components/Modal/Modal.js +3 -3
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -5
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +3 -3
- package/dist/components/Radio/Radio.js +4 -4
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +4 -4
- package/dist/components/Sidebar/Sidebar.variants.js +2 -1
- package/dist/components/Sidebar/components/Logo/Logo.variants.js +9 -15
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +2 -2
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +6 -5
- package/dist/components/Sidebar/components/Wrapper/Wrapper.js +3 -3
- package/dist/components/Slider/Slider.js +14 -14
- package/dist/components/Switch/Switch.js +17 -17
- package/dist/components/Tag/Tag.js +17 -5
- package/dist/components/Tag/Tag.variants.js +11 -1
- package/dist/components/TagSelect/TagSelect.js +6 -71
- package/dist/components/TagSelect/TagSelect.variants.js +29 -50
- package/dist/components/TagSelect/components/Item/Item.js +23 -0
- package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
- package/dist/components/TagSelect/components/List/List.js +13 -0
- package/dist/components/TagSelect/components/List/List.variants.js +37 -0
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
- package/dist/components/TagSelect/components/index.js +8 -0
- package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
- package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
- package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
- package/dist/components/TagSelect/contexts/index.js +6 -0
- package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
- package/dist/components/TextArea/TextArea.js +28 -22
- package/dist/components/TextArea/TextArea.variants.js +0 -1
- package/dist/components/Toast/Toast.js +143 -130
- package/dist/components/Toast/Toast.variants.js +2 -3
- package/dist/components/Tooltip/Tooltip.js +4 -4
- package/dist/components/Typography/Typography.js +31 -0
- package/dist/components/Typography/Typography.variants.js +63 -0
- package/dist/components/index.js +61 -53
- package/dist/{index-BxeV34ij.js → index-4ecjw_Aj.js} +1 -1
- package/dist/index-B_6_jmOO.js +68 -0
- package/dist/{index-BBjak_0p.js → index-BbsJ0VIJ.js} +2 -2
- package/dist/{index-CJsYodgi.js → index-BzaHYXkt.js} +9 -9
- package/dist/{index-KEdwcThH.js → index-CbTU3cnP.js} +1 -1
- package/dist/{index-8vgf-x5i.js → index-Cva-e5M4.js} +2 -2
- package/dist/index-CzSBQN5S.js +432 -0
- package/dist/index-D7QNmo_D.js +422 -0
- package/dist/index-DUA6Y_AE.js +126 -0
- package/dist/{index-CoqDsznq.js → index-D_76wh4w.js} +3 -3
- package/dist/{index-D4Q2rMby.js → index-Dj1pom3_.js} +2 -2
- package/dist/index-DyKo5ZJT.js +446 -0
- package/dist/index.d.ts +61 -7
- package/dist/index.js +76 -68
- package/dist/package.json +36 -35
- package/dist/plugins/konstruct.js +34 -31
- package/dist/plugins/utils/animation.styles.js +162 -0
- package/dist/plugins/utils/index.js +7 -0
- package/dist/styles.css +1 -1
- package/dist/{useBreadcrumb-CojbXFVD.js → useBreadcrumb-BsIeMoR1.js} +47 -47
- package/dist/utils/index.js +320 -322
- package/package.json +36 -35
- package/dist/Modal-W2GbkC_F.js +0 -906
- package/dist/index-1GLoikpT.js +0 -19134
- package/dist/index-BVppSRDQ.js +0 -551
- package/dist/index-DoOsnuB6.js +0 -72
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { u as ae, S as j } from "../../index-
|
|
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-B_6_jmOO.js";
|
|
3
3
|
import * as s from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { P as L, r as
|
|
6
|
-
import { c as
|
|
7
|
-
import { c as
|
|
8
|
-
import { B as
|
|
9
|
-
import { P as
|
|
10
|
-
import { V as ie, R as
|
|
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 {
|
|
13
|
-
import { X as
|
|
14
|
-
import { useTheme as
|
|
15
|
-
var Z = "ToastProvider", [ee,
|
|
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,
|
|
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
|
-
|
|
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(() =>
|
|
38
|
-
onToastRemove: s.useCallback(() =>
|
|
39
|
-
isFocusedToastEscapeKeyDownRef:
|
|
40
|
-
isClosePausedRef:
|
|
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",
|
|
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 =
|
|
50
|
+
hotkey: t = Be,
|
|
51
51
|
label: u = "Notifications ({hotkey})",
|
|
52
52
|
...d
|
|
53
|
-
} = e, f = $(le, o), m =
|
|
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 = (
|
|
55
|
+
const a = (h) => {
|
|
56
56
|
var T;
|
|
57
|
-
t.length !== 0 && t.every((
|
|
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,
|
|
62
|
-
if (
|
|
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
|
|
66
|
-
|
|
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
|
|
71
|
-
|
|
70
|
+
const P = new CustomEvent(J);
|
|
71
|
+
h.dispatchEvent(P), f.isClosePausedRef.current = !1;
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
!a.contains(
|
|
75
|
-
},
|
|
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",
|
|
79
|
-
a.removeEventListener("focusin", p), a.removeEventListener("focusout",
|
|
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
|
-
}, [
|
|
82
|
+
}, [R, f.isClosePausedRef]);
|
|
83
83
|
const l = s.useCallback(
|
|
84
84
|
({ tabbingDirection: a }) => {
|
|
85
85
|
const p = m().map((T) => {
|
|
86
|
-
const
|
|
87
|
-
return a === "forwards" ?
|
|
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 =
|
|
94
|
+
const a = w.current;
|
|
95
95
|
if (a) {
|
|
96
|
-
const
|
|
97
|
-
var
|
|
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
|
|
100
|
+
const M = document.activeElement, F = p.shiftKey;
|
|
101
101
|
if (p.target === a && F) {
|
|
102
|
-
(
|
|
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 ===
|
|
106
|
-
z(A.slice(V + 1)) ? p.preventDefault() : F ? (
|
|
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",
|
|
109
|
+
return a.addEventListener("keydown", h), () => a.removeEventListener("keydown", h);
|
|
110
110
|
}
|
|
111
111
|
}, [m, l]), /* @__PURE__ */ D(
|
|
112
|
-
|
|
112
|
+
De,
|
|
113
113
|
{
|
|
114
114
|
ref: v,
|
|
115
115
|
role: "region",
|
|
116
|
-
"aria-label": u.replace("{hotkey}",
|
|
116
|
+
"aria-label": u.replace("{hotkey}", g),
|
|
117
117
|
tabIndex: -1,
|
|
118
|
-
style: { pointerEvents:
|
|
118
|
+
style: { pointerEvents: R ? void 0 : "none" },
|
|
119
119
|
children: [
|
|
120
|
-
|
|
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:
|
|
133
|
-
|
|
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:
|
|
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",
|
|
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] =
|
|
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(
|
|
180
|
-
|
|
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:
|
|
193
|
-
n.currentTarget.setAttribute("data-swipe", "move"), n.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${
|
|
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:
|
|
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", `${
|
|
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 [
|
|
207
|
+
var [Je, Qe] = ce(U, {
|
|
208
208
|
onClose() {
|
|
209
209
|
}
|
|
210
|
-
}),
|
|
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:
|
|
222
|
-
onSwipeMove:
|
|
223
|
-
onSwipeCancel:
|
|
224
|
-
onSwipeEnd:
|
|
225
|
-
...
|
|
226
|
-
} = e, l = $(U, o), [a,
|
|
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(
|
|
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
|
-
},
|
|
241
|
-
const
|
|
242
|
-
N.current = N.current -
|
|
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,
|
|
245
|
-
i.removeEventListener(G,
|
|
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,
|
|
249
|
-
d && !l.isClosePausedRef.current && A(
|
|
250
|
-
}, [d,
|
|
251
|
-
const V = s.useMemo(() => 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
|
-
|
|
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(
|
|
263
|
+
/* @__PURE__ */ c(Je, { scope: o, onClose: _, children: Se.createPortal(
|
|
264
264
|
/* @__PURE__ */ c(ee.ItemSlot, { scope: o, children: /* @__PURE__ */ c(
|
|
265
|
-
|
|
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
|
-
...
|
|
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,
|
|
292
|
-
|
|
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) ? (
|
|
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(
|
|
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 =
|
|
300
|
-
if (
|
|
301
|
-
const
|
|
302
|
-
ne(x, l.swipeDirection, l.swipeThreshold) ? W(
|
|
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
|
-
|
|
306
|
-
|
|
305
|
+
ze,
|
|
306
|
+
S,
|
|
307
307
|
k,
|
|
308
308
|
{
|
|
309
309
|
discrete: !0
|
|
310
310
|
}
|
|
311
|
-
),
|
|
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
|
-
),
|
|
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
|
|
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
|
-
},
|
|
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 =
|
|
341
|
-
var
|
|
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 =
|
|
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 =
|
|
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
|
|
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),
|
|
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(...
|
|
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 ?
|
|
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
|
|
406
|
+
function rt(e = () => {
|
|
407
407
|
}) {
|
|
408
408
|
const r = X(e);
|
|
409
|
-
|
|
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
|
|
416
|
+
function nt(e) {
|
|
417
417
|
return e.nodeType === e.ELEMENT_NODE;
|
|
418
418
|
}
|
|
419
|
-
function
|
|
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
|
|
434
|
-
const
|
|
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
|
-
|
|
443
|
+
closeButtonClassName: v,
|
|
444
|
+
className: n,
|
|
445
|
+
open: y = !1,
|
|
446
|
+
setOpen: w
|
|
444
447
|
}) => {
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
const
|
|
448
|
-
w(!1),
|
|
449
|
-
}, []);
|
|
450
|
-
return /* @__PURE__ */ D(
|
|
451
|
-
/* @__PURE__ */ c(j, { onClick:
|
|
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
|
-
|
|
456
|
+
ct,
|
|
454
457
|
{
|
|
455
|
-
className: q(Ke({ theme: R, className:
|
|
456
|
-
open:
|
|
458
|
+
className: q(Ke({ theme: R, className: n })),
|
|
459
|
+
open: y,
|
|
457
460
|
onOpenChange: w,
|
|
458
461
|
children: [
|
|
459
|
-
/* @__PURE__ */ c(
|
|
460
|
-
/* @__PURE__ */ c(
|
|
461
|
-
m && /* @__PURE__ */ c(
|
|
462
|
-
/* @__PURE__ */ c(
|
|
463
|
-
|
|
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
|
-
|
|
482
|
+
it,
|
|
470
483
|
{
|
|
471
|
-
className: q(
|
|
484
|
+
className: q(He({ theme: R }))
|
|
472
485
|
}
|
|
473
486
|
)
|
|
474
487
|
] });
|
|
475
488
|
};
|
|
476
489
|
export {
|
|
477
|
-
|
|
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
|
-
),
|
|
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
|
-
|
|
70
|
+
o as closeToastVariants,
|
|
72
71
|
a as toastVariants,
|
|
73
72
|
r as viewportToastVariants
|
|
74
73
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as N, useRef as w, useImperativeHandle as x, useMemo as R, isValidElement as T } from "react";
|
|
3
|
-
import { S as a } from "../../index-
|
|
3
|
+
import { S as a } from "../../index-B_6_jmOO.js";
|
|
4
4
|
import { cn as o } from "../../utils/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { arrowVariants as V, tooltipVariants as b } from "./Tooltip.variants.js";
|
|
6
6
|
import { useTooltip as j } from "./hooks/useTooltip.js";
|
|
7
7
|
import { useTheme as C } from "../../contexts/theme.hook.js";
|
|
8
8
|
const q = N(
|
|
@@ -19,13 +19,13 @@ const q = N(
|
|
|
19
19
|
"div",
|
|
20
20
|
{
|
|
21
21
|
ref: d,
|
|
22
|
-
className: o(
|
|
22
|
+
className: o(b({ theme: m, position: s })),
|
|
23
23
|
"data-visible": u,
|
|
24
24
|
children: [
|
|
25
25
|
/* @__PURE__ */ e(
|
|
26
26
|
"span",
|
|
27
27
|
{
|
|
28
|
-
className: o(
|
|
28
|
+
className: o(V({ theme: m, position: s }))
|
|
29
29
|
}
|
|
30
30
|
),
|
|
31
31
|
/* @__PURE__ */ e(a, { children: l })
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useId as d } from "react";
|
|
3
|
+
import { typographyVariants as f } from "./Typography.variants.js";
|
|
4
|
+
import { useTheme as n } from "../../contexts/theme.hook.js";
|
|
5
|
+
const u = ({
|
|
6
|
+
className: e,
|
|
7
|
+
theme: m,
|
|
8
|
+
children: p,
|
|
9
|
+
variant: o,
|
|
10
|
+
component: s,
|
|
11
|
+
...t
|
|
12
|
+
}) => {
|
|
13
|
+
const r = d(), { theme: h } = n(), y = s ?? (o != null && o.includes("h") ? o : "p");
|
|
14
|
+
return /* @__PURE__ */ c(
|
|
15
|
+
y,
|
|
16
|
+
{
|
|
17
|
+
id: r,
|
|
18
|
+
className: f({
|
|
19
|
+
className: e,
|
|
20
|
+
theme: m ?? h,
|
|
21
|
+
variant: o
|
|
22
|
+
}),
|
|
23
|
+
...t,
|
|
24
|
+
children: p
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
u.displayName = "Typography";
|
|
29
|
+
export {
|
|
30
|
+
u as Typography
|
|
31
|
+
};
|