@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,9 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { cn as o } from "../../utils/index.js";
|
|
2
3
|
import { dividerVariants as a } from "./Divider.variants.js";
|
|
3
4
|
const d = ({
|
|
4
5
|
className: i,
|
|
5
6
|
...r
|
|
6
|
-
}) => /* @__PURE__ */
|
|
7
|
+
}) => /* @__PURE__ */ m("div", { className: o(a({ className: i })), ...r });
|
|
7
8
|
d.displayName = "Divider";
|
|
8
9
|
export {
|
|
9
10
|
d as Divider
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { c as a } from "../../index-BNmRGtA6.js";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const t = a(
|
|
3
|
+
["h-[1px]", "bg-zinc-200", "w-full", "border-gray-200"],
|
|
4
|
+
{
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: ""
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
defaultVariants: {
|
|
11
|
+
variant: "default"
|
|
6
12
|
}
|
|
7
|
-
},
|
|
8
|
-
defaultVariants: {
|
|
9
|
-
variant: "default"
|
|
10
13
|
}
|
|
11
|
-
|
|
14
|
+
);
|
|
12
15
|
export {
|
|
13
|
-
|
|
16
|
+
t as dividerVariants
|
|
14
17
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { DropdownProvider as
|
|
4
|
-
import { Wrapper as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { DropdownProvider as d } from "./contexts/dropdown.provider.js";
|
|
4
|
+
import { Wrapper as e } from "./components/Wrapper.js";
|
|
5
|
+
const x = t(({ onChange: p, value: m, name: r, ...f }, i) => /* @__PURE__ */ o(d, { onChange: p, value: m, name: r, children: /* @__PURE__ */ o(e, { name: r, ref: i, ...f }) }));
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
x as Dropdown
|
|
8
8
|
};
|
|
@@ -1,41 +1,34 @@
|
|
|
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
|
-
civo: ""
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
defaultVariants: {
|
|
35
|
-
theme: "kubefirst"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
);
|
|
2
|
+
const o = e([
|
|
3
|
+
"border",
|
|
4
|
+
"cursor-pointer",
|
|
5
|
+
"ease-in-out",
|
|
6
|
+
"flex",
|
|
7
|
+
"items-center",
|
|
8
|
+
"justify-between",
|
|
9
|
+
"px-3",
|
|
10
|
+
"py-1",
|
|
11
|
+
"relative",
|
|
12
|
+
"rounded-md",
|
|
13
|
+
"transition-all",
|
|
14
|
+
"w-full",
|
|
15
|
+
"outline-none",
|
|
16
|
+
"h-9",
|
|
17
|
+
"border-gray-200",
|
|
18
|
+
"aria-expanded:border-kubefirst-primary",
|
|
19
|
+
"aria-expanded:text-kubefirst-secondary",
|
|
20
|
+
"focus-visible:bg-zinc-50",
|
|
21
|
+
"colony:aria-expanded:border-red-400",
|
|
22
|
+
"colony:aria-expanded:text-red-400",
|
|
23
|
+
"colony:focus-visible:bg-red-100"
|
|
24
|
+
]), a = e([
|
|
25
|
+
"mb-1",
|
|
26
|
+
"cursor-pointer",
|
|
27
|
+
"text-[14px]",
|
|
28
|
+
"leading-[20px]",
|
|
29
|
+
"tracking-[0.1px]"
|
|
30
|
+
]);
|
|
39
31
|
export {
|
|
40
|
-
|
|
32
|
+
o as dropdownVariants,
|
|
33
|
+
a as labelVariants
|
|
41
34
|
};
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useNavigationUlList as
|
|
5
|
-
import { ListItem as
|
|
6
|
-
import { listVariants as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as u, useRef as c, useImperativeHandle as d } from "react";
|
|
3
|
+
import { cn as b } from "../../../../utils/index.js";
|
|
4
|
+
import { useNavigationUlList as v } from "../../hooks/useNavigationList.js";
|
|
5
|
+
import { ListItem as t } from "../ListItem/ListItem.js";
|
|
6
|
+
import { listVariants as x } from "./List.variants.js";
|
|
7
7
|
import { useDropdownContext as L } from "../../contexts/dropdown.hook.js";
|
|
8
|
-
const
|
|
9
|
-
({
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
const I = u(
|
|
9
|
+
({ isLoading: r, options: i, wrapperRef: s, wrapperInputRef: a, name: m }, n) => {
|
|
10
|
+
const e = c(null), { isOpen: f } = L();
|
|
11
|
+
d(n, () => e.current, [e]), v({ ulRef: e, wrapperRef: s, wrapperInputRef: a });
|
|
12
|
+
const p = i.length === 0;
|
|
13
|
+
return /* @__PURE__ */ o(
|
|
12
14
|
"ul",
|
|
13
15
|
{
|
|
14
|
-
ref:
|
|
15
|
-
title:
|
|
16
|
+
ref: e,
|
|
17
|
+
title: m,
|
|
16
18
|
role: "listbox",
|
|
17
|
-
className:
|
|
18
|
-
children: i.map((
|
|
19
|
+
className: b(x(), f ? "flex" : "hidden"),
|
|
20
|
+
children: r ? /* @__PURE__ */ o(t, { isClickable: !1, value: "Loading...", label: "Loading..." }) : p ? /* @__PURE__ */ o(t, { isClickable: !1, value: "No options", label: "No options" }) : i.map((l) => /* @__PURE__ */ o(t, { isClickable: !0, ...l }, l.value))
|
|
19
21
|
}
|
|
20
22
|
);
|
|
21
23
|
}
|
|
22
24
|
);
|
|
23
25
|
export {
|
|
24
|
-
|
|
26
|
+
I as List
|
|
25
27
|
};
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
colony: ["border-red-400"],
|
|
23
|
-
kubefirst: [""],
|
|
24
|
-
civo: ""
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
defaultVariants: {
|
|
28
|
-
theme: "kubefirst"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
);
|
|
1
|
+
import { c as o } from "../../../../index-BNmRGtA6.js";
|
|
2
|
+
const r = o([
|
|
3
|
+
"absolute",
|
|
4
|
+
"bg-white",
|
|
5
|
+
"border",
|
|
6
|
+
"duration-100",
|
|
7
|
+
"ease-in-out",
|
|
8
|
+
"flex-col",
|
|
9
|
+
"mt-1",
|
|
10
|
+
"overflow-hidden",
|
|
11
|
+
"rounded-md",
|
|
12
|
+
"shadow-2xs",
|
|
13
|
+
"top-full",
|
|
14
|
+
"transition-all",
|
|
15
|
+
"w-full",
|
|
16
|
+
"z-10",
|
|
17
|
+
"max-h-[185px]",
|
|
18
|
+
"overflow-y-auto",
|
|
19
|
+
"border-gray-200",
|
|
20
|
+
"text-zinc-700"
|
|
21
|
+
]);
|
|
32
22
|
export {
|
|
33
|
-
|
|
23
|
+
r as listVariants
|
|
34
24
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { jsxs as f, jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { listItemVariants as
|
|
1
|
+
import { jsxs as f, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useCallback as s } from "react";
|
|
3
|
+
import { cn as u } from "../../../../utils/index.js";
|
|
4
|
+
import { listItemVariants as d } from "./ListItem.variants.js";
|
|
5
|
+
import { Typography as h } from "../../../Typography/Typography.js";
|
|
5
6
|
import { useDropdownContext as x } from "../../contexts/dropdown.hook.js";
|
|
6
|
-
const
|
|
7
|
-
const { setValue: n, toggleOpen:
|
|
8
|
-
(
|
|
9
|
-
n(
|
|
7
|
+
const g = ({ isClickable: a, ...e }) => {
|
|
8
|
+
const { setValue: n, toggleOpen: r } = x(), c = p(null), l = s(
|
|
9
|
+
(t) => {
|
|
10
|
+
n(t.value), r(!1);
|
|
10
11
|
},
|
|
11
|
-
[n,
|
|
12
|
-
),
|
|
13
|
-
(
|
|
14
|
-
|
|
12
|
+
[n, r]
|
|
13
|
+
), i = s(
|
|
14
|
+
(t, m) => {
|
|
15
|
+
t.key === "Enter" && l(m);
|
|
15
16
|
},
|
|
16
|
-
[
|
|
17
|
+
[l]
|
|
17
18
|
);
|
|
18
19
|
return /* @__PURE__ */ f(
|
|
19
20
|
"li",
|
|
20
21
|
{
|
|
21
22
|
ref: c,
|
|
22
23
|
role: "option",
|
|
23
|
-
className: d(
|
|
24
|
+
className: u(d()),
|
|
24
25
|
tabIndex: 0,
|
|
25
|
-
onClick: () =>
|
|
26
|
-
onKeyDown: (
|
|
26
|
+
onClick: () => a && l(e),
|
|
27
|
+
onKeyDown: (t) => i(t, e),
|
|
27
28
|
children: [
|
|
28
|
-
e.leftIcon ? /* @__PURE__ */
|
|
29
|
-
e.label
|
|
29
|
+
e.leftIcon ? /* @__PURE__ */ o("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null,
|
|
30
|
+
/* @__PURE__ */ o(h, { variant: "body2", className: "text-zinc-700", children: e.label })
|
|
30
31
|
]
|
|
31
32
|
}
|
|
32
33
|
);
|
|
33
34
|
};
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
g as ListItem
|
|
36
37
|
};
|
|
@@ -1,32 +1,20 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
variants: {
|
|
19
|
-
theme: {
|
|
20
|
-
kubefirst: [""],
|
|
21
|
-
colony: ["focus:bg-red-100", "hover:bg-red-100"],
|
|
22
|
-
civo: ""
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
theme: "kubefirst"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
1
|
+
import { c as o } from "../../../../index-BNmRGtA6.js";
|
|
2
|
+
const l = o([
|
|
3
|
+
"cursor-pointer",
|
|
4
|
+
"py-2",
|
|
5
|
+
"px-2",
|
|
6
|
+
"h-full",
|
|
7
|
+
"focus-visible:outline-none",
|
|
8
|
+
"m-0",
|
|
9
|
+
"w-full",
|
|
10
|
+
"flex",
|
|
11
|
+
"items-center",
|
|
12
|
+
"gap-3",
|
|
13
|
+
"hover:bg-slate-50",
|
|
14
|
+
"focus:bg-slate-50",
|
|
15
|
+
"colony:focus:bg-red-100",
|
|
16
|
+
"colony:hover:bg-red-100"
|
|
17
|
+
]);
|
|
30
18
|
export {
|
|
31
|
-
|
|
19
|
+
l as listItemVariants
|
|
32
20
|
};
|
|
@@ -1,99 +1,136 @@
|
|
|
1
|
-
import { jsxs as f, jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as $, useId as A, useRef as R, useImperativeHandle as H, useMemo as M, useEffect as m } from "react";
|
|
3
|
+
import { Loading as U } from "../../Loading/Loading.js";
|
|
4
|
+
import { Typography as O } from "../../Typography/Typography.js";
|
|
5
|
+
import { cn as p } from "../../../utils/index.js";
|
|
6
|
+
import { labelVariants as W, dropdownVariants as B } from "../Dropdown.variants.js";
|
|
7
|
+
import { useDropdown as G } from "../hooks/useDropdown.js";
|
|
8
|
+
import { List as J } from "./List/List.js";
|
|
9
|
+
import { C as K } from "../../../chevron-up-DgLBQCKD.js";
|
|
10
|
+
import { useDropdownContext as P } from "../contexts/dropdown.hook.js";
|
|
11
|
+
const re = $(
|
|
12
|
+
({
|
|
13
|
+
theme: z,
|
|
14
|
+
label: u,
|
|
15
|
+
labelClassName: j,
|
|
16
|
+
placeholder: E,
|
|
17
|
+
name: s,
|
|
18
|
+
options: n,
|
|
19
|
+
required: x,
|
|
20
|
+
defaultValue: d,
|
|
21
|
+
isLoading: h
|
|
22
|
+
}, L) => {
|
|
23
|
+
const v = A(), a = R(null), b = R(null), { wrapperRef: l, wrapperInputRef: w, handleOpen: k, handleOpenIfClosed: D } = G({ ulRef: b }), { isOpen: N, toggleOpen: g, value: t, setValue: I } = P(), c = s ? `${v}-${s}` : v;
|
|
24
|
+
H(L, () => a.current, [a]);
|
|
25
|
+
const e = M(() => n.find(({ value: o }) => o === t), [n, t]);
|
|
26
|
+
m(() => {
|
|
27
|
+
a.current && (a.current.value = t ? e == null ? void 0 : e.value : "");
|
|
28
|
+
}, [e, t]), m(() => {
|
|
29
|
+
if (d && !t) {
|
|
30
|
+
const o = n && n.find((i) => i.value === d);
|
|
31
|
+
o && I(o.value);
|
|
21
32
|
}
|
|
22
|
-
}, [
|
|
33
|
+
}, [d, n, I, t]), m(() => {
|
|
23
34
|
var i;
|
|
24
|
-
const
|
|
25
|
-
return (i =
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
(!
|
|
35
|
+
const o = new AbortController();
|
|
36
|
+
return (i = l.current) == null || i.addEventListener("focusout", (T) => {
|
|
37
|
+
var C;
|
|
38
|
+
const y = T.relatedTarget;
|
|
39
|
+
(!y || !((C = l.current) != null && C.contains(y))) && g(!1);
|
|
29
40
|
}), () => {
|
|
30
|
-
|
|
41
|
+
o.abort();
|
|
31
42
|
};
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
34
|
-
return /* @__PURE__ */ f(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
}, [g, l]);
|
|
44
|
+
const F = () => e != null && e.leftIcon ? /* @__PURE__ */ r("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null;
|
|
45
|
+
return /* @__PURE__ */ f(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
ref: l,
|
|
49
|
+
className: "flex flex-col w-full relative",
|
|
50
|
+
"data-theme": z,
|
|
51
|
+
children: [
|
|
52
|
+
u ? /* @__PURE__ */ f(
|
|
53
|
+
"label",
|
|
54
|
+
{
|
|
55
|
+
id: c,
|
|
56
|
+
className: p(W({ className: j })),
|
|
57
|
+
htmlFor: c,
|
|
58
|
+
onClick: D,
|
|
59
|
+
children: [
|
|
60
|
+
u,
|
|
61
|
+
x ? /* @__PURE__ */ r("span", { className: "text-red-500 ml-1", children: "*" }) : null
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
) : null,
|
|
65
|
+
/* @__PURE__ */ f(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
ref: w,
|
|
69
|
+
id: c,
|
|
70
|
+
className: p(B()),
|
|
71
|
+
role: "combobox",
|
|
72
|
+
onClick: k,
|
|
73
|
+
"aria-expanded": N,
|
|
74
|
+
tabIndex: 0,
|
|
75
|
+
"aria-labelledby": c,
|
|
76
|
+
children: [
|
|
77
|
+
t ? /* @__PURE__ */ f(
|
|
78
|
+
O,
|
|
79
|
+
{
|
|
80
|
+
variant: "body2",
|
|
81
|
+
className: "flex gap-3 items-center text-zinc-700 text-base",
|
|
82
|
+
children: [
|
|
83
|
+
F(),
|
|
84
|
+
e == null ? void 0 : e.label
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
) : /* @__PURE__ */ r(
|
|
88
|
+
O,
|
|
89
|
+
{
|
|
90
|
+
variant: "body2",
|
|
91
|
+
className: "flex gap-3 items-center text-zinc-700 text-base",
|
|
92
|
+
children: E
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
h ? /* @__PURE__ */ r(U, { className: "w-4 h-4 text-zinc-500" }) : /* @__PURE__ */ r(
|
|
96
|
+
K,
|
|
97
|
+
{
|
|
98
|
+
className: p(
|
|
99
|
+
"w-4 h-4 text-zinc-500 transition-all duration-50",
|
|
100
|
+
N ? "rotate-0" : "rotate-180"
|
|
101
|
+
)
|
|
102
|
+
}
|
|
67
103
|
)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ r(
|
|
108
|
+
"input",
|
|
109
|
+
{
|
|
110
|
+
ref: a,
|
|
111
|
+
type: "text",
|
|
112
|
+
name: s,
|
|
113
|
+
className: "hidden",
|
|
114
|
+
"aria-hidden": "true",
|
|
115
|
+
required: x
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ r(
|
|
119
|
+
J,
|
|
120
|
+
{
|
|
121
|
+
ref: b,
|
|
122
|
+
name: s,
|
|
123
|
+
wrapperRef: l,
|
|
124
|
+
wrapperInputRef: w,
|
|
125
|
+
options: n,
|
|
126
|
+
isLoading: !!h
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
);
|
|
95
132
|
}
|
|
96
133
|
);
|
|
97
134
|
export {
|
|
98
|
-
|
|
135
|
+
re as Wrapper
|
|
99
136
|
};
|
|
@@ -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
|
);
|