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