@konstructio/ui 0.0.13-alpha.2 → 0.1.0-alpha.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/{Combination-b348x__d.js → Combination-VYaRRJBZ.js} +155 -157
- package/dist/DatePicker.css +1 -0
- package/dist/Modal-CrG0m703.js +98 -0
- 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 +11 -0
- package/dist/{chevron-up-DgLBQCKD.js → chevron-up-RLP4nX7V.js} +1 -1
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/AlertDialog/AlertDialog.js +55 -41
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +79 -0
- package/dist/components/Badge/Badge.variants.js +68 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +44 -53
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +10 -41
- package/dist/components/Breadcrumb/components/Item/Item.js +22 -23
- package/dist/components/Breadcrumb/components/Item/Item.variants.js +43 -56
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +30 -26
- package/dist/components/Button/Button.variants.js +116 -29
- package/dist/components/Checkbox/Checkbox.js +300 -185
- package/dist/components/Checkbox/Checkbox.variants.js +12 -15
- package/dist/components/Command/Command.js +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +2722 -0
- package/dist/components/Datepicker/DatePicker.variants.js +5 -0
- package/dist/components/Divider/Divider.variants.js +9 -12
- package/dist/components/Dropdown/components/List/List.js +55 -18
- package/dist/components/Dropdown/components/List/List.variants.js +5 -3
- package/dist/components/Dropdown/components/ListItem/ListItem.js +28 -22
- package/dist/components/Dropdown/components/Wrapper.js +110 -86
- package/dist/components/Dropdown/contexts/dropdown.context.js +6 -2
- package/dist/components/Dropdown/contexts/dropdown.hook.js +5 -3
- package/dist/components/Dropdown/contexts/dropdown.provider.js +18 -11
- package/dist/components/Filter/Filter.js +20 -0
- package/dist/components/Filter/Filter.variants.js +22 -0
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.js +87 -0
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +95 -0
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +87 -0
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +90 -0
- package/dist/components/Filter/components/ResetButton/ResetButton.js +18 -0
- package/dist/components/Filter/components/index.js +8 -0
- package/dist/components/Filter/events/index.js +12 -0
- package/dist/components/Input/Input.js +134 -163
- package/dist/components/Input/Input.variants.js +15 -13
- package/dist/components/Loading/Loading.js +14 -99
- 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 +4 -4
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +4 -6
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +2 -2
- package/dist/components/Radio/Radio.variants.js +14 -12
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +141 -126
- package/dist/components/Tabs/Tabs.js +24 -0
- package/dist/components/Tabs/Tabs.variants.js +58 -0
- package/dist/components/Tabs/components/Content.js +19 -0
- package/dist/components/Tabs/components/List.js +20 -0
- package/dist/components/Tabs/components/Trigger.js +26 -0
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/TimePicker/TimePicker.js +8 -0
- package/dist/components/TimePicker/TimePicker.variants.js +62 -0
- package/dist/components/TimePicker/components/HoursList/HoursList.js +93 -0
- package/dist/components/TimePicker/components/MeridianList/MeridianList.js +68 -0
- package/dist/components/TimePicker/components/MinutesList/MinutesList.js +60 -0
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +96 -0
- package/dist/components/TimePicker/components/WrapperList/WrapperList.js +51 -0
- package/dist/components/TimePicker/components/WrapperList/WrapperList.variants.js +16 -0
- package/dist/components/TimePicker/components/index.js +4 -0
- package/dist/components/TimePicker/contexts/index.js +8 -0
- package/dist/components/TimePicker/contexts/time-picker.context.js +22 -0
- package/dist/components/TimePicker/contexts/time-picker.hook.js +13 -0
- package/dist/components/TimePicker/contexts/time-picker.provider.js +46 -0
- package/dist/components/TimePicker/utils/index.js +6 -0
- package/dist/components/Toast/Toast.js +38 -36
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Typography/Typography.js +14 -16
- package/dist/components/index.js +78 -66
- package/dist/createLucideIcon-ByJ0JZvK.js +94 -0
- package/dist/index--EmNlyHx.js +31 -0
- package/dist/{index-Bk324h27.js → index-B5MIi2tR.js} +6 -5
- package/dist/{index-g-TFwd6Y.js → index-BCGvACM9.js} +2 -1
- package/dist/{index-AM3avohj.js → index-BNU3RH-3.js} +3 -3
- package/dist/{index-Bry5AFQ2.js → index-Bc1LNrRD.js} +1 -1
- package/dist/index-BdMNhZnh.js +9 -0
- package/dist/index-BvCZBMfr.js +432 -0
- package/dist/index-Cq1I1cG9.js +129 -0
- package/dist/index-Cs8Lv8Wj.js +13 -0
- package/dist/index-CvfCCTEO.js +323 -0
- package/dist/{index-DvFiic6N.js → index-DLYwlPRZ.js} +96 -102
- package/dist/{index-YaQrdkGE.js → index-DNRcvRTB.js} +31 -30
- package/dist/{index-dRxIWVBr.js → index-Dkt8F6CZ.js} +6 -5
- package/dist/{index-G_6jG4Qc.js → index-Dm-ooN_M.js} +18 -18
- package/dist/index-DwYXX2sM.js +13 -0
- package/dist/{index-C5psggHV.js → index-h-Ul0anl.js} +1 -2
- package/dist/{index-D9BbbgUq.js → index-rUBNhTeF.js} +2 -2
- package/dist/index.d.ts +128 -17
- package/dist/index.js +84 -72
- package/dist/package.json +37 -37
- package/dist/styles.css +1 -1
- package/dist/ui/civo-theme.css +263 -0
- package/dist/ui/kubefirst-theme.css +1 -1
- package/dist/ui/theme.css +11 -0
- package/dist/ui/utilities.css +11 -2
- package/dist/useBreadcrumb-DMERrNkJ.js +1280 -0
- package/dist/utils/index.js +3 -3
- package/dist/{x-DU-Zw-L_.js → x-BPcqkRZd.js} +1 -1
- package/package.json +37 -37
- package/dist/Modal-i7eolhYH.js +0 -926
- package/dist/index-BOx5P4tS.js +0 -423
- package/dist/index-CWKdynYu.js +0 -32
- package/dist/index-bYyfdsls.js +0 -118
- package/dist/useBreadcrumb-BsIeMoR1.js +0 -1279
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { c as a } from "../../index-BNmRGtA6.js";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
variant: {
|
|
7
|
-
default: ""
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
defaultVariants: {
|
|
11
|
-
variant: "default"
|
|
2
|
+
const i = a(["h-[1px]", "bg-zinc-200", "w-full"], {
|
|
3
|
+
variants: {
|
|
4
|
+
variant: {
|
|
5
|
+
default: ""
|
|
12
6
|
}
|
|
7
|
+
},
|
|
8
|
+
defaultVariants: {
|
|
9
|
+
variant: "default"
|
|
13
10
|
}
|
|
14
|
-
);
|
|
11
|
+
});
|
|
15
12
|
export {
|
|
16
|
-
|
|
13
|
+
i as dividerVariants
|
|
17
14
|
};
|
|
@@ -1,27 +1,64 @@
|
|
|
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
|
-
({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as v, useRef as w, useImperativeHandle as N } from "react";
|
|
3
|
+
import { cn as h } from "../../../../utils/index.js";
|
|
4
|
+
import { useNavigationUlList as x } from "../../hooks/useNavigationList.js";
|
|
5
|
+
import { ListItem as s } from "../ListItem/ListItem.js";
|
|
6
|
+
import { listVariants as C } from "./List.variants.js";
|
|
7
|
+
import { useDropdownContext as k } from "../../contexts/dropdown.hook.js";
|
|
8
|
+
const T = v(
|
|
9
|
+
({
|
|
10
|
+
className: i,
|
|
11
|
+
isLoading: n,
|
|
12
|
+
itemClassName: o,
|
|
13
|
+
name: c,
|
|
14
|
+
options: r,
|
|
15
|
+
searchable: m = !1,
|
|
16
|
+
wrapperInputRef: f,
|
|
17
|
+
wrapperRef: p
|
|
18
|
+
}, u) => {
|
|
19
|
+
const l = w(null), { isOpen: b, searchTerm: d } = k();
|
|
20
|
+
N(u, () => l.current, [l]), x({ ulRef: l, wrapperRef: p, wrapperInputRef: f });
|
|
21
|
+
const a = m ? r.filter((e) => {
|
|
22
|
+
const g = d.toLowerCase();
|
|
23
|
+
return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(g);
|
|
24
|
+
}) : r, L = a.length === 0;
|
|
25
|
+
return /* @__PURE__ */ t(
|
|
14
26
|
"ul",
|
|
15
27
|
{
|
|
16
|
-
ref:
|
|
17
|
-
title:
|
|
28
|
+
ref: l,
|
|
29
|
+
title: c,
|
|
18
30
|
role: "listbox",
|
|
19
|
-
className:
|
|
20
|
-
|
|
31
|
+
className: h(C({ className: i })),
|
|
32
|
+
"data-state": b ? "open" : "closed",
|
|
33
|
+
children: n ? /* @__PURE__ */ t(
|
|
34
|
+
s,
|
|
35
|
+
{
|
|
36
|
+
className: o,
|
|
37
|
+
isClickable: !1,
|
|
38
|
+
value: "Loading...",
|
|
39
|
+
label: "Loading..."
|
|
40
|
+
}
|
|
41
|
+
) : L ? /* @__PURE__ */ t(
|
|
42
|
+
s,
|
|
43
|
+
{
|
|
44
|
+
className: o,
|
|
45
|
+
isClickable: !1,
|
|
46
|
+
value: "No options",
|
|
47
|
+
label: "No options"
|
|
48
|
+
}
|
|
49
|
+
) : a.map((e) => /* @__PURE__ */ t(
|
|
50
|
+
s,
|
|
51
|
+
{
|
|
52
|
+
className: o,
|
|
53
|
+
isClickable: !0,
|
|
54
|
+
...e
|
|
55
|
+
},
|
|
56
|
+
e.value
|
|
57
|
+
))
|
|
21
58
|
}
|
|
22
59
|
);
|
|
23
60
|
}
|
|
24
61
|
);
|
|
25
62
|
export {
|
|
26
|
-
|
|
63
|
+
T as List
|
|
27
64
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as o } from "../../../../index-BNmRGtA6.js";
|
|
2
|
-
const
|
|
2
|
+
const a = o([
|
|
3
3
|
"absolute",
|
|
4
4
|
"bg-white",
|
|
5
5
|
"border",
|
|
@@ -17,8 +17,10 @@ const r = o([
|
|
|
17
17
|
"max-h-[185px]",
|
|
18
18
|
"overflow-y-auto",
|
|
19
19
|
"border-gray-200",
|
|
20
|
-
"text-zinc-700"
|
|
20
|
+
"text-zinc-700",
|
|
21
|
+
"data-[state=open]:block",
|
|
22
|
+
"data-[state=closed]:hidden"
|
|
21
23
|
]);
|
|
22
24
|
export {
|
|
23
|
-
|
|
25
|
+
a as listVariants
|
|
24
26
|
};
|
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useDropdownContext as
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as u, useCallback as s } from "react";
|
|
3
|
+
import { Typography as d } from "../../../Typography/Typography.js";
|
|
4
|
+
import { cn as h } from "../../../../utils/index.js";
|
|
5
|
+
import { listItemVariants as x } from "./ListItem.variants.js";
|
|
6
|
+
import { useDropdownContext as y } from "../../contexts/dropdown.hook.js";
|
|
7
|
+
const j = ({
|
|
8
|
+
isClickable: a,
|
|
9
|
+
className: i,
|
|
10
|
+
...t
|
|
11
|
+
}) => {
|
|
12
|
+
const { setValue: l, toggleOpen: n } = y(), c = u(null), o = s(
|
|
13
|
+
(e) => {
|
|
14
|
+
l(e.value), n(!1);
|
|
11
15
|
},
|
|
12
|
-
[
|
|
13
|
-
),
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
+
[l, n]
|
|
17
|
+
), m = s(
|
|
18
|
+
(e, f) => {
|
|
19
|
+
e.key === "Enter" && (e.stopPropagation(), o(f));
|
|
16
20
|
},
|
|
17
|
-
[
|
|
21
|
+
[o]
|
|
18
22
|
);
|
|
19
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ p(
|
|
20
24
|
"li",
|
|
21
25
|
{
|
|
22
26
|
ref: c,
|
|
23
27
|
role: "option",
|
|
24
|
-
className:
|
|
28
|
+
className: h(x({ className: i })),
|
|
25
29
|
tabIndex: 0,
|
|
26
|
-
onClick: () =>
|
|
27
|
-
|
|
30
|
+
onClick: (e) => {
|
|
31
|
+
a && (o(t), e.stopPropagation());
|
|
32
|
+
},
|
|
33
|
+
onKeyDown: (e) => m(e, t),
|
|
28
34
|
children: [
|
|
29
|
-
|
|
30
|
-
/* @__PURE__ */
|
|
35
|
+
t.leftIcon ? /* @__PURE__ */ r("span", { className: "w-4 h-4 flex justify-center items-center", children: t.leftIcon }) : null,
|
|
36
|
+
/* @__PURE__ */ r(d, { variant: "body2", className: "text-zinc-700", children: t.label })
|
|
31
37
|
]
|
|
32
38
|
}
|
|
33
39
|
);
|
|
34
40
|
};
|
|
35
41
|
export {
|
|
36
|
-
|
|
42
|
+
j as ListItem
|
|
37
43
|
};
|
|
@@ -1,129 +1,153 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Loading as
|
|
4
|
-
import { Typography as O } from "../../Typography/Typography.js";
|
|
1
|
+
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as W, useId as B, useRef as j, useImperativeHandle as G, useMemo as J, useEffect as N } from "react";
|
|
3
|
+
import { Loading as K } from "../../Loading/Loading.js";
|
|
5
4
|
import { cn as p } from "../../../utils/index.js";
|
|
6
|
-
import { labelVariants as
|
|
7
|
-
import { useDropdown as
|
|
8
|
-
import { List as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
5
|
+
import { labelVariants as Q, dropdownVariants as X } from "../Dropdown.variants.js";
|
|
6
|
+
import { useDropdown as Y } from "../hooks/useDropdown.js";
|
|
7
|
+
import { List as Z } from "./List/List.js";
|
|
8
|
+
import { Typography as _ } from "../../Typography/Typography.js";
|
|
9
|
+
import { C as q } from "../../../chevron-up-RLP4nX7V.js";
|
|
10
|
+
import { useDropdownContext as V } from "../contexts/dropdown.hook.js";
|
|
11
|
+
const de = W(
|
|
12
12
|
({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
13
|
+
className: k,
|
|
14
|
+
defaultValue: u,
|
|
15
|
+
iconClassName: E,
|
|
16
|
+
isLoading: C,
|
|
17
|
+
label: x,
|
|
18
|
+
labelClassName: D,
|
|
19
|
+
listClassName: F,
|
|
20
|
+
listItemClassName: M,
|
|
21
|
+
name: i,
|
|
22
|
+
options: r,
|
|
23
|
+
placeholder: h,
|
|
24
|
+
required: g,
|
|
25
|
+
searchable: y = !1,
|
|
26
|
+
theme: $,
|
|
27
|
+
wrapperClassName: A
|
|
28
|
+
}, H) => {
|
|
29
|
+
const I = B(), s = j(null), R = j(null), { wrapperRef: l, wrapperInputRef: L, handleOpen: O, handleOpenIfClosed: P } = Y({ ulRef: R }), { isOpen: v, toggleOpen: z, value: o, setValue: b, setSearchTerm: w, searchTerm: S } = V(), c = i ? `${I}-${i}` : I;
|
|
30
|
+
G(H, () => s.current, [s]);
|
|
31
|
+
const e = J(() => r.find(({ value: t }) => t === o), [r, o]);
|
|
32
|
+
N(() => {
|
|
33
|
+
s.current && (s.current.value = o ? e == null ? void 0 : e.value : "");
|
|
34
|
+
}, [e, o]), N(() => {
|
|
35
|
+
if (u && !o) {
|
|
36
|
+
const t = r && r.find((n) => n.value === u);
|
|
37
|
+
t && b(t.value);
|
|
32
38
|
}
|
|
33
|
-
}, [
|
|
34
|
-
var
|
|
35
|
-
const
|
|
36
|
-
return (
|
|
37
|
-
var
|
|
38
|
-
const
|
|
39
|
-
(!
|
|
39
|
+
}, [u, r, b, o]), N(() => {
|
|
40
|
+
var n;
|
|
41
|
+
const t = new AbortController();
|
|
42
|
+
return (n = l.current) == null || n.addEventListener("focusout", (d) => {
|
|
43
|
+
var T;
|
|
44
|
+
const f = d.relatedTarget;
|
|
45
|
+
(!f || !((T = l.current) != null && T.contains(f))) && (z(!1), w(""));
|
|
40
46
|
}), () => {
|
|
41
|
-
|
|
47
|
+
t.abort();
|
|
42
48
|
};
|
|
43
|
-
}, [
|
|
44
|
-
const
|
|
45
|
-
|
|
49
|
+
}, [z, l, w]);
|
|
50
|
+
const U = (t) => {
|
|
51
|
+
const n = t.target.value;
|
|
52
|
+
w(n);
|
|
53
|
+
const d = r.find(
|
|
54
|
+
(f) => f.value.toLowerCase() === n.toLowerCase()
|
|
55
|
+
);
|
|
56
|
+
d && b(d.value);
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ m(
|
|
46
59
|
"div",
|
|
47
60
|
{
|
|
48
61
|
ref: l,
|
|
49
|
-
className: "flex flex-col w-full relative",
|
|
50
|
-
"data-theme":
|
|
62
|
+
className: p("flex flex-col w-full relative", A),
|
|
63
|
+
"data-theme": $,
|
|
51
64
|
children: [
|
|
52
|
-
|
|
65
|
+
x ? /* @__PURE__ */ m(
|
|
53
66
|
"label",
|
|
54
67
|
{
|
|
55
68
|
id: c,
|
|
56
|
-
className: p(
|
|
69
|
+
className: p(Q({ className: D })),
|
|
57
70
|
htmlFor: c,
|
|
58
|
-
onClick:
|
|
71
|
+
onClick: P,
|
|
59
72
|
children: [
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
x,
|
|
74
|
+
g ? /* @__PURE__ */ a("span", { className: "text-red-500 ml-1", children: "*" }) : null
|
|
62
75
|
]
|
|
63
76
|
}
|
|
64
77
|
) : null,
|
|
65
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ m(
|
|
66
79
|
"div",
|
|
67
80
|
{
|
|
68
|
-
ref:
|
|
81
|
+
ref: L,
|
|
69
82
|
id: c,
|
|
70
|
-
className: p(
|
|
83
|
+
className: p(X({ className: k })),
|
|
71
84
|
role: "combobox",
|
|
72
|
-
onClick:
|
|
73
|
-
"aria-expanded":
|
|
85
|
+
onClick: O,
|
|
86
|
+
"aria-expanded": v,
|
|
74
87
|
tabIndex: 0,
|
|
75
88
|
"aria-labelledby": c,
|
|
76
89
|
children: [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
/* @__PURE__ */ m("div", { className: "flex gap-3 items-center flex-1", children: [
|
|
91
|
+
(e == null ? void 0 : e.leftIcon) && /* @__PURE__ */ a("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }),
|
|
92
|
+
y ? /* @__PURE__ */ a(
|
|
93
|
+
"input",
|
|
94
|
+
{
|
|
95
|
+
type: "text",
|
|
96
|
+
value: v ? S : (e == null ? void 0 : e.label) || "",
|
|
97
|
+
onChange: U,
|
|
98
|
+
placeholder: h,
|
|
99
|
+
className: "flex-1 bg-transparent border-none outline-none text-zinc-700 text-base",
|
|
100
|
+
onClick: (t) => {
|
|
101
|
+
t.stopPropagation(), O();
|
|
102
|
+
},
|
|
103
|
+
"aria-label": x || h,
|
|
104
|
+
"aria-labelledby": c
|
|
105
|
+
}
|
|
106
|
+
) : /* @__PURE__ */ a(
|
|
107
|
+
_,
|
|
108
|
+
{
|
|
109
|
+
variant: "body2",
|
|
110
|
+
className: "flex-1 text-zinc-700 text-base",
|
|
111
|
+
children: (e == null ? void 0 : e.label) || h
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }),
|
|
115
|
+
C ? /* @__PURE__ */ a(K, { className: "w-4 h-4 text-zinc-500" }) : /* @__PURE__ */ a(
|
|
116
|
+
q,
|
|
97
117
|
{
|
|
118
|
+
"data-state": v ? "open" : "closed",
|
|
98
119
|
className: p(
|
|
99
|
-
"w-4 h-4 text-zinc-500 transition-all duration-50",
|
|
100
|
-
|
|
120
|
+
"w-4 h-4 text-zinc-500 transition-all duration-50 data-[state=open]:rotate-0 data-[state=closed]:rotate-180",
|
|
121
|
+
E
|
|
101
122
|
)
|
|
102
123
|
}
|
|
103
124
|
)
|
|
104
125
|
]
|
|
105
126
|
}
|
|
106
127
|
),
|
|
107
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ a(
|
|
108
129
|
"input",
|
|
109
130
|
{
|
|
110
|
-
ref:
|
|
131
|
+
ref: s,
|
|
111
132
|
type: "text",
|
|
112
|
-
name:
|
|
133
|
+
name: i,
|
|
113
134
|
className: "hidden",
|
|
114
135
|
"aria-hidden": "true",
|
|
115
|
-
required:
|
|
136
|
+
required: g
|
|
116
137
|
}
|
|
117
138
|
),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
|
|
139
|
+
/* @__PURE__ */ a(
|
|
140
|
+
Z,
|
|
120
141
|
{
|
|
121
|
-
ref:
|
|
122
|
-
|
|
142
|
+
ref: R,
|
|
143
|
+
className: F,
|
|
144
|
+
itemClassName: M,
|
|
145
|
+
name: i,
|
|
123
146
|
wrapperRef: l,
|
|
124
|
-
wrapperInputRef:
|
|
125
|
-
options:
|
|
126
|
-
isLoading: !!
|
|
147
|
+
wrapperInputRef: L,
|
|
148
|
+
options: r,
|
|
149
|
+
isLoading: !!C,
|
|
150
|
+
searchable: y
|
|
127
151
|
}
|
|
128
152
|
)
|
|
129
153
|
]
|
|
@@ -132,5 +156,5 @@ const re = $(
|
|
|
132
156
|
}
|
|
133
157
|
);
|
|
134
158
|
export {
|
|
135
|
-
|
|
159
|
+
de as Wrapper
|
|
136
160
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext as e } from "react";
|
|
2
|
-
const
|
|
2
|
+
const o = e({
|
|
3
3
|
isOpen: !1,
|
|
4
4
|
toggleOpen() {
|
|
5
5
|
throw new Error("toggleOpen function must be overridden");
|
|
@@ -7,8 +7,12 @@ const t = e({
|
|
|
7
7
|
value: void 0,
|
|
8
8
|
setValue() {
|
|
9
9
|
throw new Error("setValue function must be overridden");
|
|
10
|
+
},
|
|
11
|
+
searchTerm: "",
|
|
12
|
+
setSearchTerm() {
|
|
13
|
+
throw new Error("setSearchTerm function must be overridden");
|
|
10
14
|
}
|
|
11
15
|
});
|
|
12
16
|
export {
|
|
13
|
-
|
|
17
|
+
o as DropdownContext
|
|
14
18
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { useContext as t } from "react";
|
|
2
2
|
import { DropdownContext as r } from "./dropdown.context.js";
|
|
3
|
-
const
|
|
3
|
+
const p = () => {
|
|
4
4
|
const o = t(r);
|
|
5
5
|
if (!o)
|
|
6
|
-
throw new Error(
|
|
6
|
+
throw new Error(
|
|
7
|
+
"useDropdownContext must be used within a DropdownProvider"
|
|
8
|
+
);
|
|
7
9
|
return o;
|
|
8
10
|
};
|
|
9
11
|
export {
|
|
10
|
-
|
|
12
|
+
p as useDropdownContext
|
|
11
13
|
};
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { DropdownContext as
|
|
4
|
-
import { useToggle as
|
|
5
|
-
const
|
|
6
|
-
const [
|
|
7
|
-
(
|
|
8
|
-
r == null || r({ target: { value:
|
|
2
|
+
import { useState as u, useCallback as d } from "react";
|
|
3
|
+
import { DropdownContext as f } from "./dropdown.context.js";
|
|
4
|
+
import { useToggle as v } from "../../../hooks/useToggle.js";
|
|
5
|
+
const D = ({ children: t, onChange: r, value: o, name: e }) => {
|
|
6
|
+
const [s, m] = v(!1), [l, p] = u(""), a = d(
|
|
7
|
+
(c) => {
|
|
8
|
+
r == null || r({ target: { value: c, name: e ?? "" } });
|
|
9
9
|
},
|
|
10
|
-
[r,
|
|
10
|
+
[r, e]
|
|
11
11
|
);
|
|
12
12
|
return /* @__PURE__ */ i(
|
|
13
|
-
|
|
13
|
+
f.Provider,
|
|
14
14
|
{
|
|
15
|
-
value: {
|
|
15
|
+
value: {
|
|
16
|
+
value: o,
|
|
17
|
+
isOpen: s,
|
|
18
|
+
setValue: a,
|
|
19
|
+
toggleOpen: m,
|
|
20
|
+
searchTerm: l,
|
|
21
|
+
setSearchTerm: p
|
|
22
|
+
},
|
|
16
23
|
children: t
|
|
17
24
|
}
|
|
18
25
|
);
|
|
19
26
|
};
|
|
20
27
|
export {
|
|
21
|
-
|
|
28
|
+
D as DropdownProvider
|
|
22
29
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { cn as m } from "../../utils/index.js";
|
|
3
|
+
import { filterVariants as a } from "./Filter.variants.js";
|
|
4
|
+
import { BadgeMultiSelect as l } from "./components/BadgeDropdown/BadgeMultiSelect.js";
|
|
5
|
+
import { DateFilterDropdown as p } from "./components/DateFilterDropdown/DateFilterDropdown.js";
|
|
6
|
+
import { ResetButton as s } from "./components/ResetButton/ResetButton.js";
|
|
7
|
+
const t = ({
|
|
8
|
+
className: e,
|
|
9
|
+
theme: o = "civo",
|
|
10
|
+
children: r
|
|
11
|
+
}) => /* @__PURE__ */ i("div", { className: m(a({ className: e })), "data-theme": o, children: r });
|
|
12
|
+
t.displayName = "Filter";
|
|
13
|
+
t.BadgeMultiSelect = l;
|
|
14
|
+
t.DateFilterDropdown = p;
|
|
15
|
+
t.ResetButton = s;
|
|
16
|
+
export {
|
|
17
|
+
l as BadgeMultiSelect,
|
|
18
|
+
p as DateFilterDropdown,
|
|
19
|
+
t as Filter
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { c as t } from "../../index-BNmRGtA6.js";
|
|
2
|
+
const a = t(["flex", "gap-8", "items-center"]), n = t([
|
|
3
|
+
"flex",
|
|
4
|
+
"items-center",
|
|
5
|
+
"gap-1",
|
|
6
|
+
"text-slate-500",
|
|
7
|
+
"cursor-pointer",
|
|
8
|
+
"text-sm",
|
|
9
|
+
"w-max"
|
|
10
|
+
]), r = t([
|
|
11
|
+
"text-slate-400",
|
|
12
|
+
"h-[20px]",
|
|
13
|
+
"w-[20px]",
|
|
14
|
+
"transition-all",
|
|
15
|
+
"duration-150",
|
|
16
|
+
"ease-in-out"
|
|
17
|
+
]);
|
|
18
|
+
export {
|
|
19
|
+
r as filterButtonIconVariants,
|
|
20
|
+
n as filterButtonVariants,
|
|
21
|
+
a as filterVariants
|
|
22
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useId as C, useRef as S, useState as m, useEffect as f, useCallback as r, useMemo as w } from "react";
|
|
2
|
+
import { FilterEvent as E, sendOpenFilterEvent as L } from "../../events/index.js";
|
|
3
|
+
const I = ({
|
|
4
|
+
onApply: t
|
|
5
|
+
}) => {
|
|
6
|
+
const a = C(), c = S(null), [g, l] = m(!1), [n, d] = m([]);
|
|
7
|
+
f(() => {
|
|
8
|
+
const e = new AbortController();
|
|
9
|
+
return document.addEventListener(
|
|
10
|
+
E.OPEN,
|
|
11
|
+
(s) => {
|
|
12
|
+
s.detail !== a && l(!1);
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
signal: e.signal
|
|
16
|
+
}
|
|
17
|
+
), document.addEventListener(
|
|
18
|
+
E.RESET,
|
|
19
|
+
() => {
|
|
20
|
+
d([]), t == null || t([]);
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
signal: e.signal
|
|
24
|
+
}
|
|
25
|
+
), () => {
|
|
26
|
+
e.abort();
|
|
27
|
+
};
|
|
28
|
+
}, [a, t]);
|
|
29
|
+
const O = r(
|
|
30
|
+
() => l((e) => (e || (L(a), d(
|
|
31
|
+
(s) => s.filter((i) => i.isApplied)
|
|
32
|
+
)), !e)),
|
|
33
|
+
[a, l]
|
|
34
|
+
), o = r(() => l(!1), []), h = r(
|
|
35
|
+
(e, s) => {
|
|
36
|
+
d(s ? [
|
|
37
|
+
...n,
|
|
38
|
+
{ ...e, isApplied: !1 }
|
|
39
|
+
] : n.map((i) => i.id === e.id ? { ...i, isRemoved: !0 } : i));
|
|
40
|
+
},
|
|
41
|
+
[d, n]
|
|
42
|
+
), v = r(() => {
|
|
43
|
+
d([]), t == null || t([]);
|
|
44
|
+
}, [t]), R = r(() => {
|
|
45
|
+
d(
|
|
46
|
+
(e) => e == null ? void 0 : e.filter((s) => !s.isRemoved).map((s) => ({ ...s, isApplied: !0 }))
|
|
47
|
+
), t == null || t(
|
|
48
|
+
n.map(
|
|
49
|
+
({ isApplied: e, isRemoved: s, ...i }) => i
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
}, [t, n, d]), b = w(
|
|
53
|
+
() => n.filter((e) => e.isApplied),
|
|
54
|
+
[n]
|
|
55
|
+
);
|
|
56
|
+
return f(() => {
|
|
57
|
+
const e = new AbortController(), s = (i) => {
|
|
58
|
+
var u;
|
|
59
|
+
(u = c.current) != null && u.contains(i.target) || o();
|
|
60
|
+
};
|
|
61
|
+
return document.addEventListener("mousedown", s, {
|
|
62
|
+
signal: e.signal
|
|
63
|
+
}), document.addEventListener(
|
|
64
|
+
"visibilitychange",
|
|
65
|
+
() => {
|
|
66
|
+
document.hidden && o();
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
signal: e.signal
|
|
70
|
+
}
|
|
71
|
+
), () => {
|
|
72
|
+
e.abort();
|
|
73
|
+
};
|
|
74
|
+
}, [o, c]), {
|
|
75
|
+
isOpen: g,
|
|
76
|
+
selectedCount: b,
|
|
77
|
+
selectedOptions: n,
|
|
78
|
+
wrapperRef: c,
|
|
79
|
+
handleApplyOptions: R,
|
|
80
|
+
handleOpen: O,
|
|
81
|
+
handleResetOptions: v,
|
|
82
|
+
handleSelectOption: h
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
I as useBadgeMultiSelect
|
|
87
|
+
};
|