@konstructio/ui 0.0.9 → 0.0.11
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-Ca3bkvvt.js → Modal-L73dmnHv.js} +240 -235
- package/dist/components/AlertDialog/AlertDialog.js +37 -30
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +7 -2
- package/dist/components/Autocomplete/Autocomplete.js +42 -37
- package/dist/components/Autocomplete/components/List/List.js +60 -0
- package/dist/components/Autocomplete/components/{List.types.d.ts → List/List.types.d.ts} +3 -3
- package/dist/components/Autocomplete/components/{List.variants.js → List/List.variants.js} +1 -1
- package/dist/components/Autocomplete/components/index.d.ts +1 -0
- package/dist/components/Autocomplete/components/index.js +4 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +44 -39
- package/dist/components/Button/Button.variants.d.ts +2 -2
- package/dist/components/Button/Button.variants.js +142 -8
- package/dist/components/Card/Card.js +30 -25
- package/dist/components/Checkbox/Checkbox.js +56 -51
- package/dist/components/Dropdown/components/ListItem/ListItem.js +18 -17
- package/dist/components/Dropdown/components/Wrapper.js +15 -15
- package/dist/components/Input/Input.js +4 -4
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +5 -4
- package/dist/components/Modal/components/Header/Header.js +4 -3
- package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -3
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +78 -69
- package/dist/components/ProgressBar/ProgressBar.js +6 -6
- package/dist/components/Radio/Radio.js +21 -18
- package/dist/components/RadioGroup/RadioGroup.js +26 -22
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +4 -3
- package/dist/components/Range/Range.js +40 -40
- package/dist/components/Sidebar/Sidebar.d.ts +5 -0
- package/dist/components/Sidebar/Sidebar.js +27 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts +17 -0
- package/dist/components/Sidebar/Sidebar.types.js +1 -0
- package/dist/components/Sidebar/Sidebar.variants.d.ts +6 -0
- package/dist/components/Sidebar/Sidebar.variants.js +56 -0
- package/dist/components/Sidebar/components/Footer/Footer.d.ts +3 -0
- package/dist/components/Sidebar/components/Footer/Footer.js +22 -0
- package/dist/components/Sidebar/components/Footer/Footer.types.d.ts +6 -0
- package/dist/components/Sidebar/components/Footer/Footer.types.js +1 -0
- package/dist/components/Sidebar/components/Footer/Footer.variants.d.ts +3 -0
- package/dist/components/Sidebar/components/Footer/Footer.variants.js +19 -0
- package/dist/components/Sidebar/components/Logo/Logo.d.ts +3 -0
- package/dist/components/Sidebar/components/Logo/Logo.js +20 -0
- package/dist/components/Sidebar/components/Logo/Logo.types.d.ts +6 -0
- package/dist/components/Sidebar/components/Logo/Logo.types.js +1 -0
- package/dist/components/Sidebar/components/Logo/Logo.variants.d.ts +3 -0
- package/dist/components/Sidebar/components/Logo/Logo.variants.js +45 -0
- package/dist/components/Sidebar/components/Navigation/Navigation.d.ts +4 -0
- package/dist/components/Sidebar/components/Navigation/Navigation.js +34 -0
- package/dist/components/Sidebar/components/Navigation/Navigation.types.d.ts +16 -0
- package/dist/components/Sidebar/components/Navigation/Navigation.types.js +1 -0
- package/dist/components/Sidebar/components/Navigation/Navigation.variants.d.ts +3 -0
- package/dist/components/Sidebar/components/Navigation/Navigation.variants.js +19 -0
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.js +40 -0
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.types.d.ts +7 -0
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.types.js +1 -0
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +16 -0
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.js +29 -0
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.types.d.ts +15 -0
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.types.js +1 -0
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +39 -0
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.js +24 -0
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.types.d.ts +5 -0
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.types.js +1 -0
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.variants.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.variants.js +19 -0
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.js +26 -0
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.types.d.ts +7 -0
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.types.js +1 -0
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.variants.d.ts +3 -0
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.variants.js +23 -0
- package/dist/components/Sidebar/components/Wrapper/Wrapper.d.ts +3 -0
- package/dist/components/Sidebar/components/Wrapper/Wrapper.js +84 -0
- package/dist/components/Sidebar/components/index.d.ts +15 -0
- package/dist/components/Sidebar/components/index.js +18 -0
- package/dist/components/Slider/Slider.js +25 -25
- package/dist/components/Switch/Switch.js +30 -30
- package/dist/components/Tag/Tag.js +5 -4
- package/dist/components/TagSelect/TagSelect.js +24 -24
- package/dist/components/TextArea/TextArea.js +17 -16
- package/dist/components/Toast/Toast.js +103 -97
- package/dist/components/Tooltip/Tooltip.js +12 -12
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +44 -30
- package/dist/index.js +47 -33
- package/dist/package.json +31 -16
- package/dist/plugins/utils/colors.d.ts +5 -0
- package/dist/plugins/utils/colors.js +6 -1
- package/dist/styles.css +1 -1
- package/dist/utils/index.js +747 -530
- package/package.json +31 -16
- package/dist/components/Autocomplete/components/List.js +0 -57
- /package/dist/components/Autocomplete/components/{List.d.ts → List/List.d.ts} +0 -0
- /package/dist/components/Autocomplete/components/{List.types.js → List/List.types.js} +0 -0
- /package/dist/components/Autocomplete/components/{List.variants.d.ts → List/List.variants.d.ts} +0 -0
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsxs as D, jsx as c, Fragment as
|
|
1
|
+
import { jsxs as D, jsx as c, Fragment as se } from "react/jsx-runtime";
|
|
2
|
+
import { u as ae, S as j } from "../../index-DoOsnuB6.js";
|
|
2
3
|
import * as s from "react";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { P as L, r as
|
|
5
|
-
import { c as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { V as ae, R as ke } from "../../index-BtibbG81.js";
|
|
4
|
+
import { useState as Re, useRef as be, useEffect as ge, useMemo as oe, isValidElement as re, useCallback as Se } from "react";
|
|
5
|
+
import { P as L, r as Ie, d as Ne } from "../../index-BaNV0qac.js";
|
|
6
|
+
import { c as Ae, a as Fe, b as X, d as b, u as _e } from "../../index-8vgf-x5i.js";
|
|
7
|
+
import { c as De } from "../../index-BBjak_0p.js";
|
|
8
|
+
import { B as Le, R as Oe, P as Me } from "../../index-BedjZUuB.js";
|
|
9
|
+
import { P as ke } from "../../index-D4Q2rMby.js";
|
|
10
|
+
import { V as ie, R as Ve } from "../../index-BtibbG81.js";
|
|
11
11
|
import "../../contexts/theme.context.js";
|
|
12
|
-
import { useTheme as
|
|
12
|
+
import { useTheme as Ke } from "../../contexts/theme.hook.js";
|
|
13
13
|
import "../../js.cookie-OLEfuq_g.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
14
|
+
import { cn as q } from "../../utils/index.js";
|
|
15
|
+
import { toastVariants as He, closeToastVariants as We, viewportToastVariants as Xe } from "./Toast.variants.js";
|
|
16
|
+
import { X as $e } from "../../x-CRBgmX1Q.js";
|
|
17
|
+
var Z = "ToastProvider", [ee, Ue, Ye] = De("Toast"), [ce, It] = Ae("Toast", [Ye]), [Be, $] = ce(Z), ue = (e) => {
|
|
17
18
|
const {
|
|
18
19
|
__scopeToast: r,
|
|
19
20
|
label: o = "Notification",
|
|
@@ -23,9 +24,9 @@ var Q = "ToastProvider", [Z, $e, Ue] = _e("Toast"), [ie, gt] = Ne("Toast", [Ue])
|
|
|
23
24
|
children: p
|
|
24
25
|
} = e, [m, v] = s.useState(null), [n, w] = s.useState(0), E = s.useRef(!1), I = s.useRef(!1);
|
|
25
26
|
return o.trim() || console.error(
|
|
26
|
-
`Invalid prop \`label\` supplied to \`${
|
|
27
|
-
), /* @__PURE__ */ c(
|
|
28
|
-
|
|
27
|
+
`Invalid prop \`label\` supplied to \`${Z}\`. Expected non-empty \`string\`.`
|
|
28
|
+
), /* @__PURE__ */ c(ee.Provider, { scope: r, children: /* @__PURE__ */ c(
|
|
29
|
+
Be,
|
|
29
30
|
{
|
|
30
31
|
scope: r,
|
|
31
32
|
label: o,
|
|
@@ -43,15 +44,15 @@ var Q = "ToastProvider", [Z, $e, Ue] = _e("Toast"), [ie, gt] = Ne("Toast", [Ue])
|
|
|
43
44
|
}
|
|
44
45
|
) });
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
var
|
|
47
|
+
ue.displayName = Z;
|
|
48
|
+
var le = "ToastViewport", je = ["F8"], G = "toast.viewportPause", J = "toast.viewportResume", de = s.forwardRef(
|
|
48
49
|
(e, r) => {
|
|
49
50
|
const {
|
|
50
51
|
__scopeToast: o,
|
|
51
|
-
hotkey: t =
|
|
52
|
+
hotkey: t = je,
|
|
52
53
|
label: u = "Notifications ({hotkey})",
|
|
53
54
|
...d
|
|
54
|
-
} = e, p = $(
|
|
55
|
+
} = e, p = $(le, o), m = Ue(o), v = s.useRef(null), n = s.useRef(null), w = s.useRef(null), E = s.useRef(null), I = ae(r, E, p.onViewportChange), R = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), g = p.toastCount > 0;
|
|
55
56
|
s.useEffect(() => {
|
|
56
57
|
const a = (P) => {
|
|
57
58
|
var T;
|
|
@@ -63,12 +64,12 @@ var ue = "ToastViewport", Be = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
63
64
|
if (g && a && P) {
|
|
64
65
|
const f = () => {
|
|
65
66
|
if (!p.isClosePausedRef.current) {
|
|
66
|
-
const C = new CustomEvent(
|
|
67
|
+
const C = new CustomEvent(G);
|
|
67
68
|
P.dispatchEvent(C), p.isClosePausedRef.current = !0;
|
|
68
69
|
}
|
|
69
70
|
}, T = () => {
|
|
70
71
|
if (p.isClosePausedRef.current) {
|
|
71
|
-
const C = new CustomEvent(
|
|
72
|
+
const C = new CustomEvent(J);
|
|
72
73
|
P.dispatchEvent(C), p.isClosePausedRef.current = !1;
|
|
73
74
|
}
|
|
74
75
|
}, h = (C) => {
|
|
@@ -84,7 +85,7 @@ var ue = "ToastViewport", Be = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
84
85
|
const l = s.useCallback(
|
|
85
86
|
({ tabbingDirection: a }) => {
|
|
86
87
|
const f = m().map((T) => {
|
|
87
|
-
const h = T.ref.current, y = [h, ...
|
|
88
|
+
const h = T.ref.current, y = [h, ...at(h)];
|
|
88
89
|
return a === "forwards" ? y : y.reverse();
|
|
89
90
|
});
|
|
90
91
|
return (a === "forwards" ? f.reverse() : f).flat();
|
|
@@ -104,13 +105,13 @@ var ue = "ToastViewport", Be = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
107
|
const A = l({ tabbingDirection: F ? "backwards" : "forwards" }), V = A.findIndex((i) => i === O);
|
|
107
|
-
|
|
108
|
+
z(A.slice(V + 1)) ? f.preventDefault() : F ? (C = n.current) == null || C.focus() : (N = w.current) == null || N.focus();
|
|
108
109
|
}
|
|
109
110
|
};
|
|
110
111
|
return a.addEventListener("keydown", P), () => a.removeEventListener("keydown", P);
|
|
111
112
|
}
|
|
112
113
|
}, [m, l]), /* @__PURE__ */ D(
|
|
113
|
-
|
|
114
|
+
Le,
|
|
114
115
|
{
|
|
115
116
|
ref: v,
|
|
116
117
|
role: "region",
|
|
@@ -119,27 +120,27 @@ var ue = "ToastViewport", Be = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
119
120
|
style: { pointerEvents: g ? void 0 : "none" },
|
|
120
121
|
children: [
|
|
121
122
|
g && /* @__PURE__ */ c(
|
|
122
|
-
|
|
123
|
+
Q,
|
|
123
124
|
{
|
|
124
125
|
ref: n,
|
|
125
126
|
onFocusFromOutsideViewport: () => {
|
|
126
127
|
const a = l({
|
|
127
128
|
tabbingDirection: "forwards"
|
|
128
129
|
});
|
|
129
|
-
|
|
130
|
+
z(a);
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
),
|
|
133
|
-
/* @__PURE__ */ c(
|
|
134
|
+
/* @__PURE__ */ c(ee.Slot, { scope: o, children: /* @__PURE__ */ c(L.ol, { tabIndex: -1, ...d, ref: I }) }),
|
|
134
135
|
g && /* @__PURE__ */ c(
|
|
135
|
-
|
|
136
|
+
Q,
|
|
136
137
|
{
|
|
137
138
|
ref: w,
|
|
138
139
|
onFocusFromOutsideViewport: () => {
|
|
139
140
|
const a = l({
|
|
140
141
|
tabbingDirection: "backwards"
|
|
141
142
|
});
|
|
142
|
-
|
|
143
|
+
z(a);
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
)
|
|
@@ -148,12 +149,12 @@ var ue = "ToastViewport", Be = ["F8"], z = "toast.viewportPause", G = "toast.vie
|
|
|
148
149
|
);
|
|
149
150
|
}
|
|
150
151
|
);
|
|
151
|
-
|
|
152
|
-
var
|
|
152
|
+
de.displayName = le;
|
|
153
|
+
var pe = "ToastFocusProxy", Q = s.forwardRef(
|
|
153
154
|
(e, r) => {
|
|
154
|
-
const { __scopeToast: o, onFocusFromOutsideViewport: t, ...u } = e, d = $(
|
|
155
|
+
const { __scopeToast: o, onFocusFromOutsideViewport: t, ...u } = e, d = $(pe, o);
|
|
155
156
|
return /* @__PURE__ */ c(
|
|
156
|
-
|
|
157
|
+
ie,
|
|
157
158
|
{
|
|
158
159
|
"aria-hidden": !0,
|
|
159
160
|
tabIndex: 0,
|
|
@@ -169,16 +170,16 @@ var de = "ToastFocusProxy", J = s.forwardRef(
|
|
|
169
170
|
);
|
|
170
171
|
}
|
|
171
172
|
);
|
|
172
|
-
|
|
173
|
-
var U = "Toast",
|
|
173
|
+
Q.displayName = pe;
|
|
174
|
+
var U = "Toast", qe = "toast.swipeStart", ze = "toast.swipeMove", Ge = "toast.swipeCancel", Je = "toast.swipeEnd", fe = s.forwardRef(
|
|
174
175
|
(e, r) => {
|
|
175
|
-
const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...p } = e, [m = !0, v] =
|
|
176
|
+
const { forceMount: o, open: t, defaultOpen: u, onOpenChange: d, ...p } = e, [m = !0, v] = Fe({
|
|
176
177
|
prop: t,
|
|
177
178
|
defaultProp: u,
|
|
178
179
|
onChange: d
|
|
179
180
|
});
|
|
180
|
-
return /* @__PURE__ */ c(
|
|
181
|
-
|
|
181
|
+
return /* @__PURE__ */ c(ke, { present: o || m, children: /* @__PURE__ */ c(
|
|
182
|
+
et,
|
|
182
183
|
{
|
|
183
184
|
open: m,
|
|
184
185
|
...p,
|
|
@@ -204,11 +205,11 @@ var U = "Toast", je = "toast.swipeStart", qe = "toast.swipeMove", ze = "toast.sw
|
|
|
204
205
|
) });
|
|
205
206
|
}
|
|
206
207
|
);
|
|
207
|
-
|
|
208
|
-
var [
|
|
208
|
+
fe.displayName = U;
|
|
209
|
+
var [Qe, Ze] = ce(U, {
|
|
209
210
|
onClose() {
|
|
210
211
|
}
|
|
211
|
-
}),
|
|
212
|
+
}), et = s.forwardRef(
|
|
212
213
|
(e, r) => {
|
|
213
214
|
const {
|
|
214
215
|
__scopeToast: o,
|
|
@@ -224,7 +225,7 @@ var [Je, Qe] = ie(U, {
|
|
|
224
225
|
onSwipeCancel: I,
|
|
225
226
|
onSwipeEnd: R,
|
|
226
227
|
...g
|
|
227
|
-
} = e, l = $(U, o), [a, P] = s.useState(null), f =
|
|
228
|
+
} = e, l = $(U, o), [a, P] = s.useState(null), f = ae(r, (i) => P(i)), T = s.useRef(null), h = s.useRef(null), y = u || l.duration, C = s.useRef(0), N = s.useRef(y), O = s.useRef(0), { onToastAdd: F, onToastRemove: Y } = l, _ = X(() => {
|
|
228
229
|
var x;
|
|
229
230
|
(a == null ? void 0 : a.contains(document.activeElement)) && ((x = l.viewport) == null || x.focus()), p();
|
|
230
231
|
}), A = s.useCallback(
|
|
@@ -242,17 +243,17 @@ var [Je, Qe] = ie(U, {
|
|
|
242
243
|
const M = (/* @__PURE__ */ new Date()).getTime() - C.current;
|
|
243
244
|
N.current = N.current - M, window.clearTimeout(O.current), v == null || v();
|
|
244
245
|
};
|
|
245
|
-
return i.addEventListener(
|
|
246
|
-
i.removeEventListener(
|
|
246
|
+
return i.addEventListener(G, S), i.addEventListener(J, x), () => {
|
|
247
|
+
i.removeEventListener(G, S), i.removeEventListener(J, x);
|
|
247
248
|
};
|
|
248
249
|
}
|
|
249
250
|
}, [l.viewport, y, v, n, A]), s.useEffect(() => {
|
|
250
251
|
d && !l.isClosePausedRef.current && A(y);
|
|
251
252
|
}, [d, y, l.isClosePausedRef, A]), s.useEffect(() => (F(), () => Y()), [F, Y]);
|
|
252
|
-
const V = s.useMemo(() => a ?
|
|
253
|
-
return l.viewport ? /* @__PURE__ */ D(
|
|
253
|
+
const V = s.useMemo(() => a ? Pe(a) : null, [a]);
|
|
254
|
+
return l.viewport ? /* @__PURE__ */ D(se, { children: [
|
|
254
255
|
V && /* @__PURE__ */ c(
|
|
255
|
-
|
|
256
|
+
tt,
|
|
256
257
|
{
|
|
257
258
|
__scopeToast: o,
|
|
258
259
|
role: "status",
|
|
@@ -261,9 +262,9 @@ var [Je, Qe] = ie(U, {
|
|
|
261
262
|
children: V
|
|
262
263
|
}
|
|
263
264
|
),
|
|
264
|
-
/* @__PURE__ */ c(
|
|
265
|
-
/* @__PURE__ */ c(
|
|
266
|
-
|
|
265
|
+
/* @__PURE__ */ c(Qe, { scope: o, onClose: _, children: Ie.createPortal(
|
|
266
|
+
/* @__PURE__ */ c(ee.ItemSlot, { scope: o, children: /* @__PURE__ */ c(
|
|
267
|
+
Oe,
|
|
267
268
|
{
|
|
268
269
|
asChild: !0,
|
|
269
270
|
onEscapeKeyDown: b(m, () => {
|
|
@@ -289,10 +290,10 @@ var [Je, Qe] = ie(U, {
|
|
|
289
290
|
}),
|
|
290
291
|
onPointerMove: b(e.onPointerMove, (i) => {
|
|
291
292
|
if (!T.current) return;
|
|
292
|
-
const x = i.clientX - T.current.x, S = i.clientY - T.current.y, M = !!h.current, k = ["left", "right"].includes(l.swipeDirection), K = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max,
|
|
293
|
-
M ? (h.current = H, W(
|
|
293
|
+
const x = i.clientX - T.current.x, S = i.clientY - T.current.y, M = !!h.current, k = ["left", "right"].includes(l.swipeDirection), K = ["left", "up"].includes(l.swipeDirection) ? Math.min : Math.max, Ce = k ? K(0, x) : 0, xe = k ? 0 : K(0, S), B = i.pointerType === "touch" ? 10 : 2, H = { x: Ce, y: xe }, te = { originalEvent: i, delta: H };
|
|
294
|
+
M ? (h.current = H, W(ze, E, te, {
|
|
294
295
|
discrete: !1
|
|
295
|
-
})) :
|
|
296
|
+
})) : ne(H, l.swipeDirection, B) ? (h.current = H, W(qe, w, te, {
|
|
296
297
|
discrete: !1
|
|
297
298
|
}), i.target.setPointerCapture(i.pointerId)) : (Math.abs(x) > B || Math.abs(S) > B) && (T.current = null);
|
|
298
299
|
}),
|
|
@@ -300,10 +301,10 @@ var [Je, Qe] = ie(U, {
|
|
|
300
301
|
const x = h.current, S = i.target;
|
|
301
302
|
if (S.hasPointerCapture(i.pointerId) && S.releasePointerCapture(i.pointerId), h.current = null, T.current = null, x) {
|
|
302
303
|
const M = i.currentTarget, k = { originalEvent: i, delta: x };
|
|
303
|
-
|
|
304
|
+
ne(x, l.swipeDirection, l.swipeThreshold) ? W(Je, R, k, {
|
|
304
305
|
discrete: !0
|
|
305
306
|
}) : W(
|
|
306
|
-
|
|
307
|
+
Ge,
|
|
307
308
|
I,
|
|
308
309
|
k,
|
|
309
310
|
{
|
|
@@ -322,43 +323,43 @@ var [Je, Qe] = ie(U, {
|
|
|
322
323
|
) })
|
|
323
324
|
] }) : null;
|
|
324
325
|
}
|
|
325
|
-
),
|
|
326
|
+
), tt = (e) => {
|
|
326
327
|
const { __scopeToast: r, children: o, ...t } = e, u = $(U, r), [d, p] = s.useState(!1), [m, v] = s.useState(!1);
|
|
327
|
-
return
|
|
328
|
+
return nt(() => p(!0)), s.useEffect(() => {
|
|
328
329
|
const n = window.setTimeout(() => v(!0), 1e3);
|
|
329
330
|
return () => window.clearTimeout(n);
|
|
330
|
-
}, []), m ? null : /* @__PURE__ */ c(
|
|
331
|
+
}, []), m ? null : /* @__PURE__ */ c(Me, { asChild: !0, children: /* @__PURE__ */ c(ie, { ...t, children: d && /* @__PURE__ */ D(se, { children: [
|
|
331
332
|
u.label,
|
|
332
333
|
" ",
|
|
333
334
|
o
|
|
334
335
|
] }) }) });
|
|
335
|
-
},
|
|
336
|
+
}, ot = "ToastTitle", me = s.forwardRef(
|
|
336
337
|
(e, r) => {
|
|
337
338
|
const { __scopeToast: o, ...t } = e;
|
|
338
339
|
return /* @__PURE__ */ c(L.div, { ...t, ref: r });
|
|
339
340
|
}
|
|
340
341
|
);
|
|
341
|
-
|
|
342
|
-
var
|
|
342
|
+
me.displayName = ot;
|
|
343
|
+
var rt = "ToastDescription", Te = s.forwardRef(
|
|
343
344
|
(e, r) => {
|
|
344
345
|
const { __scopeToast: o, ...t } = e;
|
|
345
346
|
return /* @__PURE__ */ c(L.div, { ...t, ref: r });
|
|
346
347
|
}
|
|
347
348
|
);
|
|
348
|
-
|
|
349
|
-
var
|
|
349
|
+
Te.displayName = rt;
|
|
350
|
+
var ve = "ToastAction", we = s.forwardRef(
|
|
350
351
|
(e, r) => {
|
|
351
352
|
const { altText: o, ...t } = e;
|
|
352
|
-
return o.trim() ? /* @__PURE__ */ c(
|
|
353
|
-
`Invalid prop \`altText\` supplied to \`${
|
|
353
|
+
return o.trim() ? /* @__PURE__ */ c(ye, { altText: o, asChild: !0, children: /* @__PURE__ */ c(he, { ...t, ref: r }) }) : (console.error(
|
|
354
|
+
`Invalid prop \`altText\` supplied to \`${ve}\`. Expected non-empty \`string\`.`
|
|
354
355
|
), null);
|
|
355
356
|
}
|
|
356
357
|
);
|
|
357
|
-
|
|
358
|
-
var
|
|
358
|
+
we.displayName = ve;
|
|
359
|
+
var Ee = "ToastClose", he = s.forwardRef(
|
|
359
360
|
(e, r) => {
|
|
360
|
-
const { __scopeToast: o, ...t } = e, u =
|
|
361
|
-
return /* @__PURE__ */ c(
|
|
361
|
+
const { __scopeToast: o, ...t } = e, u = Ze(Ee, o);
|
|
362
|
+
return /* @__PURE__ */ c(ye, { asChild: !0, children: /* @__PURE__ */ c(
|
|
362
363
|
L.button,
|
|
363
364
|
{
|
|
364
365
|
type: "button",
|
|
@@ -369,8 +370,8 @@ var we = "ToastClose", Ee = s.forwardRef(
|
|
|
369
370
|
) });
|
|
370
371
|
}
|
|
371
372
|
);
|
|
372
|
-
|
|
373
|
-
var
|
|
373
|
+
he.displayName = Ee;
|
|
374
|
+
var ye = s.forwardRef((e, r) => {
|
|
374
375
|
const { __scopeToast: o, altText: t, ...u } = e;
|
|
375
376
|
return /* @__PURE__ */ c(
|
|
376
377
|
L.div,
|
|
@@ -382,42 +383,42 @@ var he = s.forwardRef((e, r) => {
|
|
|
382
383
|
}
|
|
383
384
|
);
|
|
384
385
|
});
|
|
385
|
-
function
|
|
386
|
+
function Pe(e) {
|
|
386
387
|
const r = [];
|
|
387
388
|
return Array.from(e.childNodes).forEach((t) => {
|
|
388
|
-
if (t.nodeType === t.TEXT_NODE && t.textContent && r.push(t.textContent),
|
|
389
|
+
if (t.nodeType === t.TEXT_NODE && t.textContent && r.push(t.textContent), st(t)) {
|
|
389
390
|
const u = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
|
|
390
391
|
if (!u)
|
|
391
392
|
if (d) {
|
|
392
393
|
const p = t.dataset.radixToastAnnounceAlt;
|
|
393
394
|
p && r.push(p);
|
|
394
395
|
} else
|
|
395
|
-
r.push(...
|
|
396
|
+
r.push(...Pe(t));
|
|
396
397
|
}
|
|
397
398
|
}), r;
|
|
398
399
|
}
|
|
399
400
|
function W(e, r, o, { discrete: t }) {
|
|
400
401
|
const u = o.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: o });
|
|
401
|
-
r && u.addEventListener(e, r, { once: !0 }), t ?
|
|
402
|
+
r && u.addEventListener(e, r, { once: !0 }), t ? Ne(u, d) : u.dispatchEvent(d);
|
|
402
403
|
}
|
|
403
|
-
var
|
|
404
|
+
var ne = (e, r, o = 0) => {
|
|
404
405
|
const t = Math.abs(e.x), u = Math.abs(e.y), d = t > u;
|
|
405
406
|
return r === "left" || r === "right" ? d && t > o : !d && u > o;
|
|
406
407
|
};
|
|
407
|
-
function
|
|
408
|
+
function nt(e = () => {
|
|
408
409
|
}) {
|
|
409
410
|
const r = X(e);
|
|
410
|
-
|
|
411
|
+
_e(() => {
|
|
411
412
|
let o = 0, t = 0;
|
|
412
413
|
return o = window.requestAnimationFrame(() => t = window.requestAnimationFrame(r)), () => {
|
|
413
414
|
window.cancelAnimationFrame(o), window.cancelAnimationFrame(t);
|
|
414
415
|
};
|
|
415
416
|
}, [r]);
|
|
416
417
|
}
|
|
417
|
-
function
|
|
418
|
+
function st(e) {
|
|
418
419
|
return e.nodeType === e.ELEMENT_NODE;
|
|
419
420
|
}
|
|
420
|
-
function
|
|
421
|
+
function at(e) {
|
|
421
422
|
const r = [], o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
422
423
|
acceptNode: (t) => {
|
|
423
424
|
const u = t.tagName === "INPUT" && t.type === "hidden";
|
|
@@ -427,12 +428,12 @@ function st(e) {
|
|
|
427
428
|
for (; o.nextNode(); ) r.push(o.currentNode);
|
|
428
429
|
return r;
|
|
429
430
|
}
|
|
430
|
-
function
|
|
431
|
+
function z(e) {
|
|
431
432
|
const r = document.activeElement;
|
|
432
433
|
return e.some((o) => o === r ? !0 : (o.focus(), document.activeElement !== r));
|
|
433
434
|
}
|
|
434
|
-
var
|
|
435
|
-
const
|
|
435
|
+
var it = ue, ct = de, ut = fe, lt = me, dt = Te, pt = we;
|
|
436
|
+
const Nt = ({
|
|
436
437
|
title: e,
|
|
437
438
|
duration: r = 5e3,
|
|
438
439
|
titleClassName: o,
|
|
@@ -443,32 +444,37 @@ const St = ({
|
|
|
443
444
|
showCloseButton: m = !0,
|
|
444
445
|
className: v
|
|
445
446
|
}) => {
|
|
446
|
-
const [n, w] =
|
|
447
|
-
|
|
448
|
-
const g =
|
|
447
|
+
const [n, w] = Re(!1), E = be(0), { theme: I } = Ke(), R = p ?? I;
|
|
448
|
+
ge(() => () => clearTimeout(E.current), []);
|
|
449
|
+
const g = oe(() => re(e) ? /* @__PURE__ */ c(j, { className: o, children: e }) : /* @__PURE__ */ c("h6", { className: o, children: e }), [e, o]), l = oe(() => re(u) ? /* @__PURE__ */ c(j, { className: t, children: u }) : /* @__PURE__ */ c("h6", { className: t, children: u }), [u, t]), a = Se(() => {
|
|
449
450
|
w(!1), E.current = window.setTimeout(() => w(!0), 100);
|
|
450
451
|
}, []);
|
|
451
|
-
return /* @__PURE__ */ D(
|
|
452
|
+
return /* @__PURE__ */ D(it, { swipeDirection: "right", duration: r, children: [
|
|
452
453
|
/* @__PURE__ */ c(j, { onClick: a, children: d }),
|
|
453
454
|
/* @__PURE__ */ D(
|
|
454
|
-
|
|
455
|
+
ut,
|
|
455
456
|
{
|
|
456
|
-
className:
|
|
457
|
+
className: q(He({ theme: R, className: v })),
|
|
457
458
|
open: n,
|
|
458
459
|
onOpenChange: w,
|
|
459
460
|
children: [
|
|
460
|
-
/* @__PURE__ */ c(
|
|
461
|
-
/* @__PURE__ */ c(
|
|
462
|
-
m && /* @__PURE__ */ c(
|
|
463
|
-
/* @__PURE__ */ c(
|
|
464
|
-
/* @__PURE__ */ c(
|
|
461
|
+
/* @__PURE__ */ c(lt, { asChild: !0, className: "text-lg mb-2 font-semibold", children: g }),
|
|
462
|
+
/* @__PURE__ */ c(dt, { asChild: !0, children: l }),
|
|
463
|
+
m && /* @__PURE__ */ c(pt, { asChild: !0, altText: "Close the toast", children: /* @__PURE__ */ D("button", { type: "button", className: "absolute right-1.5 top-1.5", children: [
|
|
464
|
+
/* @__PURE__ */ c($e, { className: q(We({ theme: R })) }),
|
|
465
|
+
/* @__PURE__ */ c(Ve, { children: "Close toast" })
|
|
465
466
|
] }) })
|
|
466
467
|
]
|
|
467
468
|
}
|
|
468
469
|
),
|
|
469
|
-
/* @__PURE__ */ c(
|
|
470
|
+
/* @__PURE__ */ c(
|
|
471
|
+
ct,
|
|
472
|
+
{
|
|
473
|
+
className: q(Xe({ theme: R }))
|
|
474
|
+
}
|
|
475
|
+
)
|
|
470
476
|
] });
|
|
471
477
|
};
|
|
472
478
|
export {
|
|
473
|
-
|
|
479
|
+
Nt as Toast
|
|
474
480
|
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
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
|
|
3
|
+
import { S as a } from "../../index-DoOsnuB6.js";
|
|
4
4
|
import "../../contexts/theme.context.js";
|
|
5
5
|
import { useTheme as V } from "../../contexts/theme.hook.js";
|
|
6
6
|
import "../../js.cookie-OLEfuq_g.js";
|
|
7
|
-
import { cn as
|
|
7
|
+
import { cn as o } from "../../utils/index.js";
|
|
8
8
|
import { tooltipVariants as b, arrowVariants as j } from "./Tooltip.variants.js";
|
|
9
9
|
import { useTooltip as C } from "./hooks/useTooltip.js";
|
|
10
10
|
const z = N(
|
|
11
|
-
({ children: t, content: l, className: n, theme: p, position:
|
|
12
|
-
const d = w(null), { theme: h } = V(),
|
|
13
|
-
x(f, () =>
|
|
11
|
+
({ children: t, content: l, className: n, theme: p, position: s, wrapperClassName: c }, f) => {
|
|
12
|
+
const d = w(null), { theme: h } = V(), m = p ?? h, { isVisible: u, componentRef: r } = C();
|
|
13
|
+
x(f, () => r.current, [r]);
|
|
14
14
|
const v = R(
|
|
15
15
|
() => T(t) ? t : /* @__PURE__ */ e("p", { className: "p-2", children: t }),
|
|
16
16
|
[t]
|
|
17
17
|
);
|
|
18
|
-
return /* @__PURE__ */ e("div", { className:
|
|
19
|
-
/* @__PURE__ */ e(
|
|
20
|
-
/* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ e("div", { className: o("w-full", c), children: /* @__PURE__ */ i("div", { className: "relative w-max", children: [
|
|
19
|
+
/* @__PURE__ */ e(a, { ref: r, className: o("cursor-pointer ", n), children: v }),
|
|
20
|
+
/* @__PURE__ */ i(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
23
|
ref: d,
|
|
24
|
-
className: b({ theme:
|
|
24
|
+
className: o(b({ theme: m, position: s })),
|
|
25
25
|
"data-visible": u,
|
|
26
26
|
children: [
|
|
27
27
|
/* @__PURE__ */ e(
|
|
28
28
|
"span",
|
|
29
29
|
{
|
|
30
|
-
className: j({ theme:
|
|
30
|
+
className: o(j({ theme: m, position: s }))
|
|
31
31
|
}
|
|
32
32
|
),
|
|
33
|
-
/* @__PURE__ */ e(
|
|
33
|
+
/* @__PURE__ */ e(a, { children: l })
|
|
34
34
|
]
|
|
35
35
|
}
|
|
36
36
|
)
|
|
@@ -11,6 +11,7 @@ export * from './NumberInput/NumberInput';
|
|
|
11
11
|
export * from './ProgressBar/ProgressBar';
|
|
12
12
|
export * from './Radio/Radio';
|
|
13
13
|
export * from './Range/Range';
|
|
14
|
+
export * from './Sidebar/Sidebar';
|
|
14
15
|
export * from './Slider/Slider';
|
|
15
16
|
export * from './Switch/Switch';
|
|
16
17
|
export * from './Tag/Tag';
|
package/dist/components/index.js
CHANGED
|
@@ -1,42 +1,56 @@
|
|
|
1
|
-
import { AlertDialog as
|
|
1
|
+
import { AlertDialog as t } from "./AlertDialog/AlertDialog.js";
|
|
2
2
|
import { Autocomplete as p } from "./Autocomplete/Autocomplete.js";
|
|
3
3
|
import { Breadcrumb as x } from "./Breadcrumb/Breadcrumb.js";
|
|
4
4
|
import { Button as a } from "./Button/Button.js";
|
|
5
|
-
import { Card as
|
|
6
|
-
import { Checkbox as
|
|
7
|
-
import { Dropdown as
|
|
8
|
-
import { Input as
|
|
9
|
-
import { M as
|
|
10
|
-
import { NumberInput as
|
|
11
|
-
import { ProgressBar as
|
|
12
|
-
import { Radio as
|
|
13
|
-
import { Range as
|
|
5
|
+
import { Card as g } from "./Card/Card.js";
|
|
6
|
+
import { Checkbox as d } from "./Checkbox/Checkbox.js";
|
|
7
|
+
import { Dropdown as u } from "./Dropdown/Dropdown.js";
|
|
8
|
+
import { Input as N } from "./Input/Input.js";
|
|
9
|
+
import { M as T } from "../Modal-L73dmnHv.js";
|
|
10
|
+
import { NumberInput as s } from "./NumberInput/NumberInput.js";
|
|
11
|
+
import { ProgressBar as A } from "./ProgressBar/ProgressBar.js";
|
|
12
|
+
import { Radio as h } from "./Radio/Radio.js";
|
|
13
|
+
import { Range as C } from "./Range/Range.js";
|
|
14
|
+
import { Sidebar as I } from "./Sidebar/Sidebar.js";
|
|
14
15
|
import { Slider as R } from "./Slider/Slider.js";
|
|
15
|
-
import { Switch as
|
|
16
|
-
import { Tag as
|
|
17
|
-
import { TagSelect as
|
|
18
|
-
import { TextArea as
|
|
19
|
-
import { Toast as
|
|
16
|
+
import { Switch as F } from "./Switch/Switch.js";
|
|
17
|
+
import { Tag as L } from "./Tag/Tag.js";
|
|
18
|
+
import { TagSelect as P } from "./TagSelect/TagSelect.js";
|
|
19
|
+
import { TextArea as q } from "./TextArea/TextArea.js";
|
|
20
|
+
import { Toast as z } from "./Toast/Toast.js";
|
|
20
21
|
import { Tooltip as H } from "./Tooltip/Tooltip.js";
|
|
22
|
+
import { Footer as K } from "./Sidebar/components/Footer/Footer.js";
|
|
23
|
+
import { Logo as U } from "./Sidebar/components/Logo/Logo.js";
|
|
24
|
+
import { Navigation as W } from "./Sidebar/components/Navigation/Navigation.js";
|
|
25
|
+
import { NavigationGroup as Y } from "./Sidebar/components/NavigationGroup/NavigationGroup.js";
|
|
26
|
+
import { NavigationOption as _ } from "./Sidebar/components/NavigationOption/NavigationOption.js";
|
|
27
|
+
import { NavigationSeparator as oo } from "./Sidebar/components/NavigationSeparator/NavigationSeparator.js";
|
|
21
28
|
export {
|
|
22
|
-
|
|
29
|
+
t as AlertDialog,
|
|
23
30
|
p as Autocomplete,
|
|
24
31
|
x as Breadcrumb,
|
|
25
32
|
a as Button,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
g as Card,
|
|
34
|
+
d as Checkbox,
|
|
35
|
+
u as Dropdown,
|
|
36
|
+
K as Footer,
|
|
37
|
+
N as Input,
|
|
38
|
+
U as Logo,
|
|
39
|
+
T as Modal,
|
|
40
|
+
W as Navigation,
|
|
41
|
+
Y as NavigationGroup,
|
|
42
|
+
_ as NavigationOption,
|
|
43
|
+
oo as NavigationSeparator,
|
|
44
|
+
s as NumberInput,
|
|
45
|
+
A as ProgressBar,
|
|
46
|
+
h as Radio,
|
|
47
|
+
C as Range,
|
|
48
|
+
I as Sidebar,
|
|
35
49
|
R as Slider,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
F as Switch,
|
|
51
|
+
L as Tag,
|
|
52
|
+
P as TagSelect,
|
|
53
|
+
q as TextArea,
|
|
54
|
+
z as Toast,
|
|
41
55
|
H as Tooltip
|
|
42
56
|
};
|