@konstructio/ui 0.1.0-alpha.8 → 0.1.1-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/DatePicker.css +1 -1
- package/dist/{Modal-CrG0m703.js → Modal-0oht63vU.js} +32 -32
- package/dist/assets/icons/components/Search.js +26 -0
- package/dist/assets/icons/components/Warning.js +22 -0
- package/dist/assets/icons/components/index.js +6 -0
- package/dist/{chevron-down-UW8ts6wI.js → chevron-down-CVce9Mvh.js} +2 -2
- package/dist/components/Alert/Alert.js +23 -25
- package/dist/components/Alert/Alert.variants.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/AlertDialog/hooks/useAlertDialog.js +7 -7
- package/dist/components/Autocomplete/Autocomplete.variants.js +3 -4
- package/dist/components/Autocomplete/components/List/List.variants.js +3 -7
- package/dist/components/Autocomplete/hooks/useAutocomplete.js +38 -43
- package/dist/components/Autocomplete/hooks/useNavigationList.js +29 -37
- package/dist/components/Badge/Badge.js +40 -42
- package/dist/components/Badge/Badge.variants.js +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +1 -1
- package/dist/components/Breadcrumb/components/Item/Item.js +22 -21
- package/dist/components/Breadcrumb/components/Item/Item.variants.js +1 -1
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +15 -15
- package/dist/components/Button/Button.variants.js +10 -77
- package/dist/components/Card/Card.variants.js +3 -5
- package/dist/components/Checkbox/Checkbox.js +48 -47
- package/dist/components/Checkbox/Checkbox.variants.js +3 -4
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/Command.variants.js +1 -1
- 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 +13 -13
- 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 +1 -1
- package/dist/components/Datepicker/DatePicker.js +1496 -1577
- package/dist/components/Datepicker/DatePicker.variants.js +1 -1
- package/dist/components/Divider/Divider.variants.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +28 -6
- package/dist/components/Dropdown/Dropdown.variants.js +43 -26
- package/dist/components/Dropdown/components/List/List.variants.js +1 -1
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +5 -5
- package/dist/components/Dropdown/components/Wrapper.js +96 -86
- package/dist/components/Dropdown/contexts/dropdown.provider.js +12 -12
- package/dist/components/Dropdown/hooks/useDropdown.js +26 -30
- package/dist/components/Dropdown/hooks/useNavigationList.js +25 -31
- package/dist/components/DropdownButton/DropdownButton.js +135 -0
- package/dist/components/Filter/Filter.variants.js +1 -1
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.js +47 -49
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +70 -57
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +41 -42
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +68 -55
- package/dist/components/Filter/components/ResetButton/ResetButton.js +22 -16
- package/dist/components/Input/Input.js +116 -109
- package/dist/components/Input/Input.variants.js +18 -5
- package/dist/components/Loading/Loading.js +2 -2
- package/dist/components/Loading/Loading.variants.js +1 -2
- 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 +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +7 -9
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/Modal/hooks/useModal.js +16 -17
- package/dist/components/NumberInput/NumberInput.js +91 -91
- package/dist/components/NumberInput/NumberInput.variants.js +1 -1
- package/dist/components/PieChart/PieChart.js +5138 -0
- package/dist/components/ProgressBar/ProgressBar.js +58 -26
- package/dist/components/ProgressBar/ProgressBar.variants.js +1 -1
- package/dist/components/Radio/Radio.js +64 -48
- package/dist/components/Radio/Radio.variants.js +3 -3
- package/dist/components/RadioCard/RadioCard.js +26 -23
- package/dist/components/RadioCard/RadioCard.variants.js +1 -1
- package/dist/components/RadioCardGroup/RadioCardGroup.js +28 -28
- package/dist/components/RadioCardGroup/RadioCardGroup.variants.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +37 -37
- package/dist/components/RadioGroup/RadioGroup.variants.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Range/Range.variants.js +2 -3
- package/dist/components/Sidebar/Sidebar.js +4 -3
- package/dist/components/Sidebar/Sidebar.variants.js +1 -1
- package/dist/components/Sidebar/components/Footer/Footer.js +5 -4
- package/dist/components/Sidebar/components/Footer/Footer.variants.js +1 -1
- package/dist/components/Sidebar/components/Logo/Logo.js +6 -5
- package/dist/components/Sidebar/components/Logo/Logo.variants.js +1 -1
- package/dist/components/Sidebar/components/Navigation/Navigation.js +5 -4
- package/dist/components/Sidebar/components/Navigation/Navigation.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.js +14 -13
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.js +13 -12
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.js +5 -6
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.variants.js +1 -1
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.js +9 -8
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.variants.js +1 -1
- package/dist/components/Sidebar/components/Wrapper/Wrapper.js +15 -14
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider.variants.js +2 -8
- package/dist/components/Switch/Switch.js +54 -54
- package/dist/components/Switch/Switch.variants.js +2 -3
- package/dist/components/Table/Table.variants.js +1 -1
- package/dist/components/Tabs/Tabs.js +20 -16
- package/dist/components/Tabs/Tabs.variants.js +3 -5
- package/dist/components/Tabs/components/Content.js +10 -13
- package/dist/components/Tabs/components/List.js +9 -8
- package/dist/components/Tabs/components/Trigger.js +12 -16
- package/dist/components/Tabs/components/index.js +8 -0
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/Tag/Tag.variants.js +1 -1
- package/dist/components/TagSelect/TagSelect.variants.js +1 -1
- package/dist/components/TagSelect/components/Item/Item.variants.js +1 -1
- package/dist/components/TagSelect/components/List/List.variants.js +1 -1
- package/dist/components/TagSelect/hooks/useTagSelect.js +14 -16
- package/dist/components/TextArea/TextArea.variants.js +4 -5
- package/dist/components/TimePicker/TimePicker.variants.js +6 -7
- package/dist/components/TimePicker/components/HoursList/HoursList.js +21 -26
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +19 -20
- package/dist/components/TimePicker/components/MinutesList/MinutesList.js +24 -25
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +33 -34
- package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +1 -1
- package/dist/components/Toast/Toast.js +223 -232
- package/dist/components/Toast/Toast.variants.js +8 -11
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/Tooltip.variants.js +7 -14
- package/dist/components/Tooltip/hooks/useTooltip.js +8 -9
- package/dist/components/Typography/Typography.js +26 -31
- package/dist/components/Typography/Typography.variants.js +1 -1
- package/dist/components/index.js +78 -66
- package/dist/contexts/theme.provider.js +28 -29
- package/dist/{createLucideIcon-ByJ0JZvK.js → createLucideIcon-BpsAkT97.js} +4 -4
- package/dist/index-0ioNhtNM.js +10 -0
- package/dist/{index-CvfCCTEO.js → index-BAraV3ai.js} +7 -7
- package/dist/index-BXuxPoz7.js +435 -0
- package/dist/index-BfXxHr_2.js +125 -0
- package/dist/index-C1g_chDT.js +70 -0
- package/dist/{index-BCGvACM9.js → index-C9T9HQaa.js} +1 -1
- package/dist/{index-Bc1LNrRD.js → index-CZnD2QxM.js} +1 -1
- package/dist/index-CrBonFvu.js +144 -0
- package/dist/{index-rUBNhTeF.js → index-Cvx4lqTq.js} +2 -2
- package/dist/{index-BNmRGtA6.js → index-D29mdTf5.js} +3 -3
- package/dist/{index-Dkt8F6CZ.js → index-D3xzCzcO.js} +12 -12
- package/dist/index-DB2XhXHn.js +431 -0
- package/dist/{index-B5MIi2tR.js → index-DQH6odE9.js} +2 -3
- package/dist/index-Oq5GlCHP.js +131 -0
- package/dist/{index-Cs8Lv8Wj.js → index-bwWKd82e.js} +1 -1
- package/dist/{index--EmNlyHx.js → index-iXyXtdgP.js} +1 -1
- package/dist/index.d.ts +159 -9
- package/dist/index.js +88 -76
- package/dist/package.json +41 -37
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +261 -241
- package/dist/ui/kubefirst-theme.css +4 -4
- package/dist/ui/theme.css +0 -2
- package/dist/{useBreadcrumb-DMERrNkJ.js → useBreadcrumb-B8DnuqkR.js} +254 -261
- package/dist/utils/index.js +25 -26
- package/package.json +41 -37
- package/dist/index-BNU3RH-3.js +0 -133
- package/dist/index-BvCZBMfr.js +0 -432
- package/dist/index-Cq1I1cG9.js +0 -129
- package/dist/index-DLYwlPRZ.js +0 -440
- package/dist/index-DNRcvRTB.js +0 -145
- package/dist/index-Dm-ooN_M.js +0 -71
- package/dist/index-DwYXX2sM.js +0 -13
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { DropdownProvider as
|
|
4
|
-
import { Wrapper as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
|
+
import { DropdownProvider as n } from "./contexts/dropdown.provider.js";
|
|
4
|
+
import { Wrapper as c } from "./components/Wrapper.js";
|
|
5
|
+
const v = p(({ onChange: r, onBlur: l, value: a, error: s, helperText: e, name: o, ...i }, d) => /* @__PURE__ */ t(
|
|
6
|
+
n,
|
|
7
|
+
{
|
|
8
|
+
onChange: r,
|
|
9
|
+
onBlur: l,
|
|
10
|
+
value: a,
|
|
11
|
+
name: o,
|
|
12
|
+
children: /* @__PURE__ */ m("div", { className: "relative w-full", children: [
|
|
13
|
+
/* @__PURE__ */ t(
|
|
14
|
+
c,
|
|
15
|
+
{
|
|
16
|
+
name: o,
|
|
17
|
+
error: s,
|
|
18
|
+
ref: d,
|
|
19
|
+
onBlur: l,
|
|
20
|
+
...i
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
s ? /* @__PURE__ */ t("span", { className: "text-xs text-red-700", children: s }) : null,
|
|
24
|
+
!s && e ? /* @__PURE__ */ t("span", { className: "text-xs text-slate-600", children: e }) : null
|
|
25
|
+
] })
|
|
26
|
+
}
|
|
27
|
+
));
|
|
6
28
|
export {
|
|
7
|
-
|
|
29
|
+
v as Dropdown
|
|
8
30
|
};
|
|
@@ -1,27 +1,44 @@
|
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
]
|
|
1
|
+
import { c as r } from "../../index-D29mdTf5.js";
|
|
2
|
+
const a = r(
|
|
3
|
+
[
|
|
4
|
+
"border",
|
|
5
|
+
"cursor-pointer",
|
|
6
|
+
"ease-in-out",
|
|
7
|
+
"flex",
|
|
8
|
+
"items-center",
|
|
9
|
+
"justify-between",
|
|
10
|
+
"px-3",
|
|
11
|
+
"py-1",
|
|
12
|
+
"relative",
|
|
13
|
+
"rounded-md",
|
|
14
|
+
"transition-all",
|
|
15
|
+
"w-full",
|
|
16
|
+
"outline-none",
|
|
17
|
+
"h-9",
|
|
18
|
+
"border-gray-200",
|
|
19
|
+
"aria-expanded:border-kubefirst-primary",
|
|
20
|
+
"aria-expanded:text-kubefirst-secondary",
|
|
21
|
+
"focus-visible:bg-zinc-50",
|
|
22
|
+
"civo:aria-expanded:border-civo-primary",
|
|
23
|
+
"civo:aria-expanded:text-civo-primary"
|
|
24
|
+
],
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
hasError: {
|
|
28
|
+
true: [
|
|
29
|
+
"border-red-600",
|
|
30
|
+
"text-red-600",
|
|
31
|
+
"civo:aria-expanded:border-red-600",
|
|
32
|
+
"civo:aria-expanded:text-red-600"
|
|
33
|
+
],
|
|
34
|
+
false: ""
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
hasError: !1
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
), i = r([
|
|
25
42
|
"mb-1",
|
|
26
43
|
"cursor-pointer",
|
|
27
44
|
"text-[14px]",
|
|
@@ -29,6 +46,6 @@ const o = e([
|
|
|
29
46
|
"tracking-[0.1px]"
|
|
30
47
|
]);
|
|
31
48
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
a as dropdownVariants,
|
|
50
|
+
i as labelVariants
|
|
34
51
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as o } from "../../../../index-
|
|
2
|
-
const
|
|
1
|
+
import { c as o } from "../../../../index-D29mdTf5.js";
|
|
2
|
+
const i = o([
|
|
3
3
|
"cursor-pointer",
|
|
4
4
|
"py-2",
|
|
5
5
|
"px-2",
|
|
@@ -12,9 +12,9 @@ const l = o([
|
|
|
12
12
|
"gap-3",
|
|
13
13
|
"hover:bg-slate-50",
|
|
14
14
|
"focus:bg-slate-50",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"civo:focus:bg-civo-primary/5",
|
|
16
|
+
"civo:hover:bg-civo-primary/5"
|
|
17
17
|
]);
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
i as listItemVariants
|
|
20
20
|
};
|
|
@@ -1,151 +1,161 @@
|
|
|
1
|
-
import { jsxs as m, jsx as
|
|
2
|
-
import { forwardRef as W, useId as
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as W, useId as q, useRef as T, useImperativeHandle as G, useMemo as J, useEffect as N } from "react";
|
|
3
3
|
import { Loading as K } from "../../Loading/Loading.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { C as
|
|
10
|
-
import { useDropdownContext as
|
|
11
|
-
const
|
|
4
|
+
import { Typography as Q } from "../../Typography/Typography.js";
|
|
5
|
+
import { cn as s } from "../../../utils/index.js";
|
|
6
|
+
import { labelVariants as X, dropdownVariants as Y } from "../Dropdown.variants.js";
|
|
7
|
+
import { useDropdown as Z } from "../hooks/useDropdown.js";
|
|
8
|
+
import { List as _ } from "./List/List.js";
|
|
9
|
+
import { C as B } from "../../../chevron-up-RLP4nX7V.js";
|
|
10
|
+
import { useDropdownContext as ee } from "../contexts/dropdown.hook.js";
|
|
11
|
+
const fe = W(
|
|
12
12
|
({
|
|
13
|
-
className:
|
|
14
|
-
defaultValue:
|
|
15
|
-
|
|
13
|
+
className: j,
|
|
14
|
+
defaultValue: p,
|
|
15
|
+
error: f,
|
|
16
|
+
iconClassName: k,
|
|
16
17
|
isLoading: C,
|
|
17
18
|
label: x,
|
|
18
|
-
labelClassName:
|
|
19
|
-
listClassName:
|
|
20
|
-
listItemClassName:
|
|
21
|
-
name:
|
|
22
|
-
options:
|
|
19
|
+
labelClassName: V,
|
|
20
|
+
listClassName: D,
|
|
21
|
+
listItemClassName: F,
|
|
22
|
+
name: u,
|
|
23
|
+
options: a,
|
|
23
24
|
placeholder: h,
|
|
24
|
-
|
|
25
|
+
isRequired: g,
|
|
25
26
|
searchable: y = !1,
|
|
26
|
-
theme:
|
|
27
|
-
wrapperClassName:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
theme: M,
|
|
28
|
+
wrapperClassName: $,
|
|
29
|
+
onBlur: I
|
|
30
|
+
}, A) => {
|
|
31
|
+
const L = q(), n = T(null), O = T(null), { wrapperRef: c, wrapperInputRef: R, handleOpen: z, handleOpenIfClosed: H } = Z({ ulRef: O }), { isOpen: v, searchTerm: P, value: r, toggleOpen: E, setValue: b, setSearchTerm: w } = ee(), i = u ? `${L}-${u}` : L;
|
|
32
|
+
G(A, () => n.current, [n]);
|
|
33
|
+
const l = J(() => a.find(({ value: e }) => e === r), [a, r]);
|
|
32
34
|
N(() => {
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
35
|
+
n.current && (n.current.value = r ? l?.value : "");
|
|
36
|
+
}, [l, r]), N(() => {
|
|
37
|
+
if (p && !r) {
|
|
38
|
+
const e = a && a.find((o) => o.value === p);
|
|
39
|
+
e && b(e.value);
|
|
38
40
|
}
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const f = d.relatedTarget;
|
|
45
|
-
(!f || !((T = l.current) != null && T.contains(f))) && (z(!1), w(""));
|
|
41
|
+
}, [p, a, b, r]), N(() => {
|
|
42
|
+
const e = new AbortController();
|
|
43
|
+
return c.current?.addEventListener("focusout", (o) => {
|
|
44
|
+
const d = o.relatedTarget;
|
|
45
|
+
(!d || !c.current?.contains(d)) && (E(!1), w(""), n.current?.value || I?.());
|
|
46
46
|
}), () => {
|
|
47
|
-
|
|
47
|
+
e.abort();
|
|
48
48
|
};
|
|
49
|
-
}, [
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
w(
|
|
53
|
-
const d =
|
|
54
|
-
(
|
|
49
|
+
}, [E, c, w, I, r]);
|
|
50
|
+
const S = (e) => {
|
|
51
|
+
const o = e.target.value;
|
|
52
|
+
w(o);
|
|
53
|
+
const d = a.find(
|
|
54
|
+
(U) => U.value.toLocaleLowerCase() === o.toLocaleLowerCase()
|
|
55
55
|
);
|
|
56
56
|
d && b(d.value);
|
|
57
57
|
};
|
|
58
58
|
return /* @__PURE__ */ m(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
|
-
ref:
|
|
62
|
-
className:
|
|
63
|
-
"data-theme":
|
|
61
|
+
ref: c,
|
|
62
|
+
className: s("flex flex-col w-full relative", $),
|
|
63
|
+
"data-theme": M,
|
|
64
64
|
children: [
|
|
65
65
|
x ? /* @__PURE__ */ m(
|
|
66
66
|
"label",
|
|
67
67
|
{
|
|
68
|
-
id:
|
|
69
|
-
className:
|
|
70
|
-
htmlFor:
|
|
71
|
-
onClick:
|
|
68
|
+
id: i,
|
|
69
|
+
className: s(X({ className: V })),
|
|
70
|
+
htmlFor: i,
|
|
71
|
+
onClick: H,
|
|
72
72
|
children: [
|
|
73
73
|
x,
|
|
74
|
-
g ? /* @__PURE__ */
|
|
74
|
+
g ? /* @__PURE__ */ t("span", { className: "text-red-600 ml-1", children: "*" }) : null
|
|
75
75
|
]
|
|
76
76
|
}
|
|
77
77
|
) : null,
|
|
78
78
|
/* @__PURE__ */ m(
|
|
79
79
|
"div",
|
|
80
80
|
{
|
|
81
|
-
ref:
|
|
82
|
-
id:
|
|
83
|
-
className:
|
|
81
|
+
ref: R,
|
|
82
|
+
id: i,
|
|
83
|
+
className: s(Y({ className: j, hasError: !!f })),
|
|
84
84
|
role: "combobox",
|
|
85
|
-
onClick:
|
|
85
|
+
onClick: z,
|
|
86
86
|
"aria-expanded": v,
|
|
87
87
|
tabIndex: 0,
|
|
88
|
-
"aria-labelledby":
|
|
88
|
+
"aria-labelledby": i,
|
|
89
89
|
children: [
|
|
90
90
|
/* @__PURE__ */ m("div", { className: "flex gap-3 items-center flex-1", children: [
|
|
91
|
-
|
|
92
|
-
y ? /* @__PURE__ */
|
|
91
|
+
l?.leftIcon && /* @__PURE__ */ t("span", { className: "w-4 h-4 flex justify-center items-center", children: l.leftIcon }),
|
|
92
|
+
y ? /* @__PURE__ */ t(
|
|
93
93
|
"input",
|
|
94
94
|
{
|
|
95
95
|
type: "text",
|
|
96
|
-
value: v ?
|
|
97
|
-
onChange:
|
|
96
|
+
value: v ? P : l?.label || "",
|
|
97
|
+
onChange: S,
|
|
98
98
|
placeholder: h,
|
|
99
|
-
className:
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
className: s(
|
|
100
|
+
"flex-1 bg-transparent border-none outline-none text-zinc-700 text-base",
|
|
101
|
+
{
|
|
102
|
+
"text-red-700 placeholder:text-red-700": !!f
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
onClick: (e) => {
|
|
106
|
+
e.stopPropagation(), z();
|
|
102
107
|
},
|
|
103
108
|
"aria-label": x || h,
|
|
104
|
-
"aria-labelledby":
|
|
109
|
+
"aria-labelledby": i
|
|
105
110
|
}
|
|
106
|
-
) : /* @__PURE__ */
|
|
107
|
-
|
|
111
|
+
) : /* @__PURE__ */ t(
|
|
112
|
+
Q,
|
|
108
113
|
{
|
|
109
114
|
variant: "body2",
|
|
110
|
-
className: "flex-1 text-zinc-700 text-base",
|
|
111
|
-
|
|
115
|
+
className: s("flex-1 text-zinc-700 text-base", {
|
|
116
|
+
"text-red-700": !!f
|
|
117
|
+
}),
|
|
118
|
+
children: l?.label || h
|
|
112
119
|
}
|
|
113
120
|
)
|
|
114
121
|
] }),
|
|
115
|
-
C ? /* @__PURE__ */
|
|
116
|
-
|
|
122
|
+
C ? /* @__PURE__ */ t(K, { className: "w-4 h-4 text-zinc-500" }) : /* @__PURE__ */ t(
|
|
123
|
+
B,
|
|
117
124
|
{
|
|
118
125
|
"data-state": v ? "open" : "closed",
|
|
119
|
-
className:
|
|
126
|
+
className: s(
|
|
120
127
|
"w-4 h-4 text-zinc-500 transition-all duration-50 data-[state=open]:rotate-0 data-[state=closed]:rotate-180",
|
|
121
|
-
|
|
128
|
+
k,
|
|
129
|
+
{
|
|
130
|
+
"text-red-700": !!f
|
|
131
|
+
}
|
|
122
132
|
)
|
|
123
133
|
}
|
|
124
134
|
)
|
|
125
135
|
]
|
|
126
136
|
}
|
|
127
137
|
),
|
|
128
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ t(
|
|
129
139
|
"input",
|
|
130
140
|
{
|
|
131
|
-
ref:
|
|
141
|
+
ref: n,
|
|
132
142
|
type: "text",
|
|
133
|
-
name:
|
|
143
|
+
name: u,
|
|
134
144
|
className: "hidden",
|
|
135
145
|
"aria-hidden": "true",
|
|
136
146
|
required: g
|
|
137
147
|
}
|
|
138
148
|
),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
149
|
+
/* @__PURE__ */ t(
|
|
150
|
+
_,
|
|
141
151
|
{
|
|
142
|
-
ref:
|
|
143
|
-
className:
|
|
144
|
-
itemClassName:
|
|
145
|
-
name:
|
|
146
|
-
wrapperRef:
|
|
147
|
-
wrapperInputRef:
|
|
148
|
-
options:
|
|
152
|
+
ref: O,
|
|
153
|
+
className: D,
|
|
154
|
+
itemClassName: F,
|
|
155
|
+
name: u,
|
|
156
|
+
wrapperRef: c,
|
|
157
|
+
wrapperInputRef: R,
|
|
158
|
+
options: a,
|
|
149
159
|
isLoading: !!C,
|
|
150
160
|
searchable: y
|
|
151
161
|
}
|
|
@@ -156,5 +166,5 @@ const de = W(
|
|
|
156
166
|
}
|
|
157
167
|
);
|
|
158
168
|
export {
|
|
159
|
-
|
|
169
|
+
fe as Wrapper
|
|
160
170
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useState as u, useCallback as d } from "react";
|
|
3
3
|
import { DropdownContext as f } from "./dropdown.context.js";
|
|
4
|
-
import { useToggle as
|
|
5
|
-
const
|
|
6
|
-
const [
|
|
4
|
+
import { useToggle as g } from "../../../hooks/useToggle.js";
|
|
5
|
+
const w = ({ children: t, value: s, name: e, onChange: r, onBlur: o }) => {
|
|
6
|
+
const [a, m] = g(!1), [n, p] = u(""), l = d(
|
|
7
7
|
(c) => {
|
|
8
|
-
r
|
|
8
|
+
r?.({ target: { value: c, name: e ?? "" } }), o?.();
|
|
9
9
|
},
|
|
10
|
-
[r, e]
|
|
10
|
+
[r, e, o]
|
|
11
11
|
);
|
|
12
12
|
return /* @__PURE__ */ i(
|
|
13
13
|
f.Provider,
|
|
14
14
|
{
|
|
15
15
|
value: {
|
|
16
|
-
value:
|
|
17
|
-
isOpen:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
value: s,
|
|
17
|
+
isOpen: a,
|
|
18
|
+
searchTerm: n,
|
|
19
|
+
setSearchTerm: p,
|
|
20
|
+
setValue: l,
|
|
21
|
+
toggleOpen: m
|
|
22
22
|
},
|
|
23
23
|
children: t
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
w as DropdownProvider
|
|
29
29
|
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useDropdownContext as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var d;
|
|
11
|
-
(d = l.current) != null && d.contains(t.target) || e(!1);
|
|
1
|
+
import { useRef as c, useEffect as d, useCallback as u } from "react";
|
|
2
|
+
import { useDropdownContext as g } from "../contexts/dropdown.hook.js";
|
|
3
|
+
const b = ({ ulRef: a }) => {
|
|
4
|
+
const o = c(null), t = c(null), { isOpen: i, toggleOpen: e } = g();
|
|
5
|
+
d(() => {
|
|
6
|
+
const n = new AbortController(), s = (l) => {
|
|
7
|
+
l.key === "Escape" && e(!1);
|
|
8
|
+
}, r = (l) => {
|
|
9
|
+
o.current?.contains(l.target) || e(!1);
|
|
12
10
|
};
|
|
13
11
|
return document.addEventListener("keydown", s, {
|
|
14
12
|
signal: n.signal
|
|
15
|
-
}), document.addEventListener("mousedown",
|
|
13
|
+
}), document.addEventListener("mousedown", r, {
|
|
16
14
|
signal: n.signal
|
|
17
15
|
}), document.addEventListener(
|
|
18
16
|
"visibilitychange",
|
|
@@ -22,7 +20,7 @@ const E = ({ ulRef: i }) => {
|
|
|
22
20
|
{
|
|
23
21
|
signal: n.signal
|
|
24
22
|
}
|
|
25
|
-
),
|
|
23
|
+
), t.current?.addEventListener(
|
|
26
24
|
"focus",
|
|
27
25
|
() => {
|
|
28
26
|
e(!0);
|
|
@@ -31,33 +29,31 @@ const E = ({ ulRef: i }) => {
|
|
|
31
29
|
), () => {
|
|
32
30
|
n.abort();
|
|
33
31
|
};
|
|
34
|
-
}, [e,
|
|
35
|
-
var s;
|
|
32
|
+
}, [e, o]), d(() => {
|
|
36
33
|
const n = new AbortController();
|
|
37
|
-
return
|
|
34
|
+
return t.current?.addEventListener(
|
|
38
35
|
"keydown",
|
|
39
|
-
(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
t && t.focus();
|
|
36
|
+
(s) => {
|
|
37
|
+
if (s.key === "ArrowDown") {
|
|
38
|
+
const r = a.current?.querySelector("li");
|
|
39
|
+
r && r.focus();
|
|
44
40
|
}
|
|
45
41
|
},
|
|
46
42
|
{ signal: n.signal }
|
|
47
43
|
), () => {
|
|
48
44
|
n.abort();
|
|
49
45
|
};
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
}, [
|
|
46
|
+
}, [t, a]);
|
|
47
|
+
const f = u(() => e(!0), [e]), p = u(() => {
|
|
48
|
+
i || e(!1);
|
|
49
|
+
}, [i, e]);
|
|
54
50
|
return {
|
|
55
|
-
wrapperRef:
|
|
56
|
-
wrapperInputRef:
|
|
57
|
-
handleOpen:
|
|
58
|
-
handleOpenIfClosed:
|
|
51
|
+
wrapperRef: o,
|
|
52
|
+
wrapperInputRef: t,
|
|
53
|
+
handleOpen: f,
|
|
54
|
+
handleOpenIfClosed: p
|
|
59
55
|
};
|
|
60
56
|
};
|
|
61
57
|
export {
|
|
62
|
-
|
|
58
|
+
b as useDropdown
|
|
63
59
|
};
|
|
@@ -1,39 +1,35 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useDropdownContext as
|
|
3
|
-
const
|
|
4
|
-
ulRef:
|
|
5
|
-
wrapperRef:
|
|
6
|
-
wrapperInputRef:
|
|
1
|
+
import { useRef as b, useEffect as u } from "react";
|
|
2
|
+
import { useDropdownContext as f } from "../contexts/dropdown.hook.js";
|
|
3
|
+
const d = ({
|
|
4
|
+
ulRef: t,
|
|
5
|
+
wrapperRef: i,
|
|
6
|
+
wrapperInputRef: o
|
|
7
7
|
}) => {
|
|
8
|
-
const r =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const e = ((s = n.current) == null ? void 0 : s.querySelectorAll("li")) ?? [], c = new AbortController(), i = () => {
|
|
8
|
+
const r = b(0), { isOpen: l } = f();
|
|
9
|
+
u(() => {
|
|
10
|
+
const e = t.current?.querySelectorAll("li") ?? [], c = new AbortController(), n = () => {
|
|
12
11
|
r.current < e.length - 1 ? (r.current = r.current + 1, e[r.current].focus()) : (r.current = 0, e[0].focus());
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
r.current > 0 ? (r.current = r.current - 1, e[r.current].focus()) : (r.current = 0, (t = u.current) == null || t.focus());
|
|
12
|
+
}, a = () => {
|
|
13
|
+
r.current > 0 ? (r.current = r.current - 1, e[r.current].focus()) : (r.current = 0, o.current?.focus());
|
|
16
14
|
};
|
|
17
|
-
return
|
|
15
|
+
return t.current?.addEventListener(
|
|
18
16
|
"keydown",
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
switch (t.preventDefault(), t.key) {
|
|
17
|
+
(s) => {
|
|
18
|
+
switch (s.preventDefault(), s.key) {
|
|
22
19
|
case "ArrowDown": {
|
|
23
|
-
|
|
20
|
+
n();
|
|
24
21
|
break;
|
|
25
22
|
}
|
|
26
23
|
case "Tab": {
|
|
27
|
-
|
|
24
|
+
s.shiftKey ? a() : n();
|
|
28
25
|
break;
|
|
29
26
|
}
|
|
30
27
|
case "ArrowUp": {
|
|
31
|
-
r.current === 0 ?
|
|
28
|
+
r.current === 0 ? o.current?.focus() : a();
|
|
32
29
|
break;
|
|
33
30
|
}
|
|
34
31
|
case "Enter": {
|
|
35
|
-
|
|
36
|
-
l == null || l.click();
|
|
32
|
+
e[r.current].querySelector("button")?.click();
|
|
37
33
|
break;
|
|
38
34
|
}
|
|
39
35
|
}
|
|
@@ -42,23 +38,21 @@ const w = ({
|
|
|
42
38
|
), () => {
|
|
43
39
|
c.abort();
|
|
44
40
|
};
|
|
45
|
-
}, [
|
|
46
|
-
var c;
|
|
41
|
+
}, [t, r, o]), u(() => {
|
|
47
42
|
const e = new AbortController();
|
|
48
|
-
return
|
|
43
|
+
return i.current?.addEventListener(
|
|
49
44
|
"mouseenter",
|
|
50
45
|
() => {
|
|
51
|
-
|
|
52
|
-
(((o = n.current) == null ? void 0 : o.querySelectorAll("li")) ?? []).forEach((s) => s.blur());
|
|
46
|
+
(t.current?.querySelectorAll("li") ?? []).forEach((n) => n.blur());
|
|
53
47
|
},
|
|
54
48
|
{ signal: e.signal }
|
|
55
49
|
), () => {
|
|
56
50
|
e.abort();
|
|
57
51
|
};
|
|
58
|
-
}, [
|
|
59
|
-
|
|
60
|
-
}, [
|
|
52
|
+
}, [t, i]), u(() => {
|
|
53
|
+
l || (r.current = 0);
|
|
54
|
+
}, [l]);
|
|
61
55
|
};
|
|
62
56
|
export {
|
|
63
|
-
|
|
57
|
+
d as useNavigationUlList
|
|
64
58
|
};
|