@konstructio/ui 0.0.12-alpha.2 → 0.0.12-alpha.21
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-DZUwNzSW.js → Modal-B-E9uaA6.js} +354 -346
- package/dist/components/Alert/Alert.js +1 -1
- 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/Breadcrumb/Breadcrumb.variants.js +18 -15
- package/dist/components/Checkbox/Checkbox.js +1 -1
- 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/Dropdown/Dropdown.js +6 -6
- package/dist/components/Dropdown/Dropdown.variants.js +22 -3
- package/dist/components/Dropdown/components/List/List.js +42 -16
- package/dist/components/Dropdown/components/List/List.variants.js +7 -5
- package/dist/components/Dropdown/components/ListItem/ListItem.js +26 -21
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +6 -4
- package/dist/components/Dropdown/components/Wrapper.js +97 -63
- 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 +112 -67
- package/dist/components/Input/Input.variants.js +5 -6
- package/dist/components/Loading/Loading.js +102 -21
- package/dist/components/Loading/Loading.variants.js +13 -14
- package/dist/components/Modal/Modal.js +3 -3
- package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -4
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +88 -88
- package/dist/components/NumberInput/NumberInput.variants.js +23 -19
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Sidebar/Sidebar.variants.js +2 -1
- package/dist/components/Sidebar/components/Logo/Logo.variants.js +9 -17
- 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/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +99 -101
- package/dist/components/Switch/Switch.variants.js +4 -4
- package/dist/components/Table/Table.js +31 -0
- package/dist/components/Table/Table.variants.js +78 -0
- package/dist/components/Table/components/Body.js +28 -0
- package/dist/components/Table/components/Filter.js +9 -0
- package/dist/components/Table/components/Head.js +28 -0
- package/dist/components/Table/components/Row.js +34 -0
- 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 +141 -128
- package/dist/components/Toast/Toast.variants.js +2 -3
- package/dist/components/Typography/Typography.js +23 -22
- package/dist/components/Typography/Typography.variants.js +49 -22
- package/dist/components/index.js +22 -20
- package/dist/{index-C6WtlN_F.js → index-BzaHYXkt.js} +1 -1
- package/dist/{index-Z1voPZOH.js → index-CbTU3cnP.js} +1 -1
- 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-B33at13_.js → index-D_76wh4w.js} +1 -1
- package/dist/index-DyKo5ZJT.js +446 -0
- package/dist/index.d.ts +85 -17
- package/dist/index.js +18 -16
- package/dist/package.json +26 -24
- package/dist/styles.css +1 -1
- package/dist/utils/index.js +320 -322
- package/package.json +26 -24
- package/dist/index-3jTPaVvh.js +0 -551
- package/dist/index-BTeAm7mx.js +0 -19133
|
@@ -1,25 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useNavigationUlList as
|
|
5
|
-
import { ListItem as
|
|
6
|
-
import { listVariants as
|
|
7
|
-
import { useDropdownContext as
|
|
8
|
-
const
|
|
9
|
-
({ options:
|
|
10
|
-
const
|
|
11
|
-
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useRef as d, useImperativeHandle as b } from "react";
|
|
3
|
+
import { cn as v } from "../../../../utils/index.js";
|
|
4
|
+
import { useNavigationUlList as x } from "../../hooks/useNavigationList.js";
|
|
5
|
+
import { ListItem as l } from "../ListItem/ListItem.js";
|
|
6
|
+
import { listVariants as L } from "./List.variants.js";
|
|
7
|
+
import { useDropdownContext as g } from "../../contexts/dropdown.hook.js";
|
|
8
|
+
const y = c(
|
|
9
|
+
({ isLoading: s, options: r, theme: o, wrapperRef: a, wrapperInputRef: n, name: m }, f) => {
|
|
10
|
+
const e = d(null), { isOpen: p } = g();
|
|
11
|
+
b(f, () => e.current, [e]), x({ ulRef: e, wrapperRef: a, wrapperInputRef: n });
|
|
12
|
+
const u = r.length === 0;
|
|
13
|
+
return /* @__PURE__ */ i(
|
|
12
14
|
"ul",
|
|
13
15
|
{
|
|
14
|
-
ref:
|
|
15
|
-
title:
|
|
16
|
+
ref: e,
|
|
17
|
+
title: m,
|
|
16
18
|
role: "listbox",
|
|
17
|
-
className:
|
|
18
|
-
children:
|
|
19
|
+
className: v(L({ theme: o }), p ? "flex" : "hidden"),
|
|
20
|
+
children: s ? /* @__PURE__ */ i(
|
|
21
|
+
l,
|
|
22
|
+
{
|
|
23
|
+
theme: o,
|
|
24
|
+
isClickable: !1,
|
|
25
|
+
value: "Loading...",
|
|
26
|
+
label: "Loading..."
|
|
27
|
+
}
|
|
28
|
+
) : u ? /* @__PURE__ */ i(
|
|
29
|
+
l,
|
|
30
|
+
{
|
|
31
|
+
theme: o,
|
|
32
|
+
isClickable: !1,
|
|
33
|
+
value: "No options",
|
|
34
|
+
label: "No options"
|
|
35
|
+
}
|
|
36
|
+
) : r.map((t) => /* @__PURE__ */ i(
|
|
37
|
+
l,
|
|
38
|
+
{
|
|
39
|
+
theme: o,
|
|
40
|
+
isClickable: !0,
|
|
41
|
+
...t
|
|
42
|
+
},
|
|
43
|
+
t.value
|
|
44
|
+
))
|
|
19
45
|
}
|
|
20
46
|
);
|
|
21
47
|
}
|
|
22
48
|
);
|
|
23
49
|
export {
|
|
24
|
-
|
|
50
|
+
y as List
|
|
25
51
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
const
|
|
1
|
+
import { c as t } from "../../../../index-BNmRGtA6.js";
|
|
2
|
+
const e = t(
|
|
3
3
|
[
|
|
4
4
|
"absolute",
|
|
5
5
|
"bg-white",
|
|
@@ -14,13 +14,15 @@ const t = r(
|
|
|
14
14
|
"top-full",
|
|
15
15
|
"transition-all",
|
|
16
16
|
"w-full",
|
|
17
|
-
"z-10"
|
|
17
|
+
"z-10",
|
|
18
|
+
"max-h-[185px]",
|
|
19
|
+
"overflow-y-auto"
|
|
18
20
|
],
|
|
19
21
|
{
|
|
20
22
|
variants: {
|
|
21
23
|
theme: {
|
|
22
24
|
colony: ["border-red-400"],
|
|
23
|
-
kubefirst: ["
|
|
25
|
+
kubefirst: ["text-zinc-700"],
|
|
24
26
|
civo: ""
|
|
25
27
|
}
|
|
26
28
|
},
|
|
@@ -30,5 +32,5 @@ const t = r(
|
|
|
30
32
|
}
|
|
31
33
|
);
|
|
32
34
|
export {
|
|
33
|
-
|
|
35
|
+
e as listVariants
|
|
34
36
|
};
|
|
@@ -1,36 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as u, useCallback as
|
|
1
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as u, useCallback as s } from "react";
|
|
3
3
|
import { cn as d } from "../../../../utils/index.js";
|
|
4
|
-
import { listItemVariants as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { listItemVariants as h } from "./ListItem.variants.js";
|
|
5
|
+
import { Typography as x } from "../../../Typography/Typography.js";
|
|
6
|
+
import { useDropdownContext as y } from "../../contexts/dropdown.hook.js";
|
|
7
|
+
const j = ({
|
|
8
|
+
isClickable: a,
|
|
9
|
+
theme: c,
|
|
10
|
+
...e
|
|
11
|
+
}) => {
|
|
12
|
+
const { setValue: n, toggleOpen: r } = y(), i = u(null), l = s(
|
|
13
|
+
(t) => {
|
|
14
|
+
n(t.value), r(!1);
|
|
10
15
|
},
|
|
11
|
-
[n,
|
|
12
|
-
),
|
|
13
|
-
(
|
|
14
|
-
|
|
16
|
+
[n, r]
|
|
17
|
+
), m = s(
|
|
18
|
+
(t, f) => {
|
|
19
|
+
t.key === "Enter" && l(f);
|
|
15
20
|
},
|
|
16
|
-
[
|
|
21
|
+
[l]
|
|
17
22
|
);
|
|
18
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ p(
|
|
19
24
|
"li",
|
|
20
25
|
{
|
|
21
|
-
ref:
|
|
26
|
+
ref: i,
|
|
22
27
|
role: "option",
|
|
23
|
-
className: d(
|
|
28
|
+
className: d(h({ theme: c })),
|
|
24
29
|
tabIndex: 0,
|
|
25
|
-
onClick: () =>
|
|
26
|
-
onKeyDown: (
|
|
30
|
+
onClick: () => a && l(e),
|
|
31
|
+
onKeyDown: (t) => m(t, e),
|
|
27
32
|
children: [
|
|
28
|
-
e.leftIcon ? /* @__PURE__ */
|
|
29
|
-
e.label
|
|
33
|
+
e.leftIcon ? /* @__PURE__ */ o("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null,
|
|
34
|
+
/* @__PURE__ */ o(x, { variant: "body2", className: "text-zinc-700", children: e.label })
|
|
30
35
|
]
|
|
31
36
|
}
|
|
32
37
|
);
|
|
33
38
|
};
|
|
34
39
|
export {
|
|
35
|
-
|
|
40
|
+
j as ListItem
|
|
36
41
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as e } from "../../../../index-BNmRGtA6.js";
|
|
2
|
-
const
|
|
2
|
+
const o = e(
|
|
3
3
|
[
|
|
4
4
|
"cursor-pointer",
|
|
5
5
|
"py-2",
|
|
@@ -10,12 +10,14 @@ const t = e(
|
|
|
10
10
|
"w-full",
|
|
11
11
|
"flex",
|
|
12
12
|
"items-center",
|
|
13
|
-
"gap-3"
|
|
13
|
+
"gap-3",
|
|
14
|
+
"hover:bg-slate-50",
|
|
15
|
+
"focus:bg-slate-50"
|
|
14
16
|
],
|
|
15
17
|
{
|
|
16
18
|
variants: {
|
|
17
19
|
theme: {
|
|
18
|
-
kubefirst: ["
|
|
20
|
+
kubefirst: [""],
|
|
19
21
|
colony: ["focus:bg-red-100", "hover:bg-red-100"],
|
|
20
22
|
civo: ""
|
|
21
23
|
}
|
|
@@ -26,5 +28,5 @@ const t = e(
|
|
|
26
28
|
}
|
|
27
29
|
);
|
|
28
30
|
export {
|
|
29
|
-
|
|
31
|
+
o as listItemVariants
|
|
30
32
|
};
|
|
@@ -1,69 +1,101 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { dropdownVariants as
|
|
5
|
-
import { useDropdown as
|
|
6
|
-
import { List as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as H, useId as M, useRef as O, useImperativeHandle as U, useMemo as W, useEffect as p } from "react";
|
|
3
|
+
import { cn as u } from "../../../utils/index.js";
|
|
4
|
+
import { labelVariants as B, dropdownVariants as G } from "../Dropdown.variants.js";
|
|
5
|
+
import { useDropdown as J } from "../hooks/useDropdown.js";
|
|
6
|
+
import { List as K } from "./List/List.js";
|
|
7
|
+
import { Typography as z } from "../../Typography/Typography.js";
|
|
8
|
+
import { Loading as P } from "../../Loading/Loading.js";
|
|
9
|
+
import { C as Q } from "../../../chevron-up-DgLBQCKD.js";
|
|
10
|
+
import { useDropdownContext as S } from "../contexts/dropdown.hook.js";
|
|
11
|
+
import { useTheme as X } from "../../../contexts/theme.hook.js";
|
|
12
|
+
const ae = H(
|
|
13
|
+
({
|
|
14
|
+
theme: T,
|
|
15
|
+
label: h,
|
|
16
|
+
labelClassName: j,
|
|
17
|
+
placeholder: E,
|
|
18
|
+
name: l,
|
|
19
|
+
options: n,
|
|
20
|
+
required: x,
|
|
21
|
+
defaultValue: f,
|
|
22
|
+
isLoading: v
|
|
23
|
+
}, L) => {
|
|
24
|
+
const b = M(), s = O(null), w = O(null), { wrapperRef: a, wrapperInputRef: N, handleOpen: k, handleOpenIfClosed: D } = J({ ulRef: w }), { isOpen: g, toggleOpen: C, value: r, setValue: I } = S(), { theme: F } = X(), d = T ?? F, c = l ? `${b}-${l}` : b;
|
|
25
|
+
U(L, () => s.current, [s]);
|
|
26
|
+
const e = W(() => n.find(({ value: o }) => o === r), [n, r]);
|
|
27
|
+
p(() => {
|
|
28
|
+
s.current && (s.current.value = r ? e == null ? void 0 : e.value : "");
|
|
29
|
+
}, [e, r]), p(() => {
|
|
30
|
+
if (f && !r) {
|
|
31
|
+
const o = n && n.find((i) => i.value === f);
|
|
32
|
+
o && I(o.value);
|
|
21
33
|
}
|
|
22
|
-
}, [
|
|
34
|
+
}, [f, n, I, r]), p(() => {
|
|
23
35
|
var i;
|
|
24
|
-
const
|
|
25
|
-
return (i =
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
(!
|
|
36
|
+
const o = new AbortController();
|
|
37
|
+
return (i = a.current) == null || i.addEventListener("focusout", (A) => {
|
|
38
|
+
var R;
|
|
39
|
+
const y = A.relatedTarget;
|
|
40
|
+
(!y || !((R = a.current) != null && R.contains(y))) && C(!1);
|
|
29
41
|
}), () => {
|
|
30
|
-
|
|
42
|
+
o.abort();
|
|
31
43
|
};
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
|
|
44
|
+
}, [C, a]);
|
|
45
|
+
const $ = () => e != null && e.leftIcon ? /* @__PURE__ */ t("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null;
|
|
46
|
+
return /* @__PURE__ */ m("div", { ref: a, className: "flex flex-col w-full relative", children: [
|
|
47
|
+
h ? /* @__PURE__ */ m(
|
|
36
48
|
"label",
|
|
37
49
|
{
|
|
38
|
-
id:
|
|
39
|
-
className:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
id: c,
|
|
51
|
+
className: u(
|
|
52
|
+
B({ theme: d }),
|
|
53
|
+
j
|
|
54
|
+
),
|
|
55
|
+
htmlFor: c,
|
|
56
|
+
onClick: D,
|
|
57
|
+
children: [
|
|
58
|
+
h,
|
|
59
|
+
x ? /* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" }) : null
|
|
60
|
+
]
|
|
43
61
|
}
|
|
44
62
|
) : null,
|
|
45
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ m(
|
|
46
64
|
"div",
|
|
47
65
|
{
|
|
48
|
-
ref:
|
|
49
|
-
id:
|
|
50
|
-
className:
|
|
66
|
+
ref: N,
|
|
67
|
+
id: c,
|
|
68
|
+
className: u(G({ theme: d })),
|
|
51
69
|
role: "combobox",
|
|
52
|
-
onClick:
|
|
53
|
-
"aria-expanded":
|
|
70
|
+
onClick: k,
|
|
71
|
+
"aria-expanded": g,
|
|
54
72
|
tabIndex: 0,
|
|
55
|
-
"aria-labelledby":
|
|
73
|
+
"aria-labelledby": c,
|
|
56
74
|
children: [
|
|
57
|
-
/* @__PURE__ */ t("span", { className: "text-base text-inherit", children:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
75
|
+
/* @__PURE__ */ t("span", { className: "text-base text-inherit", children: r ? /* @__PURE__ */ m(
|
|
76
|
+
z,
|
|
77
|
+
{
|
|
78
|
+
variant: "body2",
|
|
79
|
+
className: "flex gap-3 items-center text-zinc-700",
|
|
80
|
+
children: [
|
|
81
|
+
$(),
|
|
82
|
+
e == null ? void 0 : e.label
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
) : /* @__PURE__ */ t(
|
|
86
|
+
z,
|
|
87
|
+
{
|
|
88
|
+
variant: "body2",
|
|
89
|
+
className: "flex gap-3 items-center text-zinc-700",
|
|
90
|
+
children: E
|
|
91
|
+
}
|
|
92
|
+
) }),
|
|
93
|
+
v ? /* @__PURE__ */ t(P, { className: "w-4 h-4 text-zinc-500" }) : /* @__PURE__ */ t(
|
|
94
|
+
Q,
|
|
63
95
|
{
|
|
64
|
-
className:
|
|
65
|
-
"w-4 h-4 text-
|
|
66
|
-
|
|
96
|
+
className: u(
|
|
97
|
+
"w-4 h-4 text-zinc-500 transition-all duration-50",
|
|
98
|
+
g ? "rotate-0" : "rotate-180"
|
|
67
99
|
)
|
|
68
100
|
}
|
|
69
101
|
)
|
|
@@ -73,27 +105,29 @@ const X = F(
|
|
|
73
105
|
/* @__PURE__ */ t(
|
|
74
106
|
"input",
|
|
75
107
|
{
|
|
76
|
-
ref:
|
|
108
|
+
ref: s,
|
|
77
109
|
type: "text",
|
|
78
|
-
name:
|
|
110
|
+
name: l,
|
|
79
111
|
className: "hidden",
|
|
80
|
-
"aria-hidden": "true"
|
|
112
|
+
"aria-hidden": "true",
|
|
113
|
+
required: x
|
|
81
114
|
}
|
|
82
115
|
),
|
|
83
116
|
/* @__PURE__ */ t(
|
|
84
|
-
|
|
117
|
+
K,
|
|
85
118
|
{
|
|
86
|
-
ref:
|
|
87
|
-
name:
|
|
88
|
-
wrapperRef:
|
|
89
|
-
wrapperInputRef:
|
|
90
|
-
options:
|
|
91
|
-
|
|
119
|
+
ref: w,
|
|
120
|
+
name: l,
|
|
121
|
+
wrapperRef: a,
|
|
122
|
+
wrapperInputRef: N,
|
|
123
|
+
options: n,
|
|
124
|
+
isLoading: !!v,
|
|
125
|
+
theme: d
|
|
92
126
|
}
|
|
93
127
|
)
|
|
94
128
|
] });
|
|
95
129
|
}
|
|
96
130
|
);
|
|
97
131
|
export {
|
|
98
|
-
|
|
132
|
+
ae as Wrapper
|
|
99
133
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createContext as e } from "react";
|
|
2
2
|
const t = e({
|
|
3
|
-
value: null,
|
|
4
3
|
isOpen: !1,
|
|
5
4
|
toggleOpen() {
|
|
6
5
|
throw new Error("toggleOpen function must be overridden");
|
|
7
6
|
},
|
|
7
|
+
value: void 0,
|
|
8
8
|
setValue() {
|
|
9
9
|
throw new Error("setValue function must be overridden");
|
|
10
10
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as u } from "react";
|
|
3
3
|
import { DropdownContext as d } from "./dropdown.context.js";
|
|
4
4
|
import { useToggle as f } from "../../../hooks/useToggle.js";
|
|
5
|
-
const w = ({ children: t, onChange: o }) => {
|
|
6
|
-
const [
|
|
7
|
-
(
|
|
8
|
-
|
|
5
|
+
const w = ({ children: t, onChange: r, value: e, name: o }) => {
|
|
6
|
+
const [l, p] = f(!1), s = u(
|
|
7
|
+
(m) => {
|
|
8
|
+
r == null || r({ target: { value: m, name: o ?? "" } });
|
|
9
9
|
},
|
|
10
|
-
[o]
|
|
10
|
+
[r, o]
|
|
11
11
|
);
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ i(
|
|
13
13
|
d.Provider,
|
|
14
14
|
{
|
|
15
|
-
value: { value:
|
|
15
|
+
value: { value: e, isOpen: l, setValue: s, toggleOpen: p },
|
|
16
16
|
children: t
|
|
17
17
|
}
|
|
18
18
|
);
|