@konstructio/ui 0.1.0-alpha.2 → 0.1.0-alpha.20
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-3QGcvbP_.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 +14 -14
- package/dist/components/Badge/Badge.variants.js +18 -17
- 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 +27 -27
- 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 +2728 -0
- package/dist/components/Datepicker/DatePicker.variants.js +5 -0
- 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/DropdownButton/DropdownButton.js +136 -0
- 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 +86 -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 +24 -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 +2 -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 +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/PieChart/PieChart.js +5130 -0
- package/dist/components/Radio/Radio.js +64 -49
- package/dist/components/Radio/Radio.variants.js +14 -12
- package/dist/components/RadioCard/RadioCard.js +23 -21
- package/dist/components/RadioCardGroup/RadioCardGroup.js +18 -18
- 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 +27 -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/Tabs/components/index.js +8 -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 +90 -66
- package/dist/createLucideIcon-B7yPYScZ.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 +263 -18
- package/dist/index.js +96 -72
- package/dist/package.json +42 -40
- 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/useBreadcrumb-DMERrNkJ.js +1280 -0
- package/dist/utils/index.js +4 -4
- package/dist/{x-DU-Zw-L_.js → x-BPcqkRZd.js} +1 -1
- package/package.json +42 -40
- package/dist/Modal-i7eolhYH.js +0 -926
- package/dist/createLucideIcon-CoF3ywd5.js +0 -89
- 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,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,136 @@
|
|
|
1
|
+
import { jsxs as v, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import w, { forwardRef as E, useState as P, useRef as b, useCallback as y, useEffect as z } from "react";
|
|
3
|
+
import { cn as l } from "../../utils/index.js";
|
|
4
|
+
import { Button as C } from "../Button/Button.js";
|
|
5
|
+
import { P as c } from "../../index-h-Ul0anl.js";
|
|
6
|
+
function m() {
|
|
7
|
+
return m = Object.assign || function(e) {
|
|
8
|
+
for (var a = 1; a < arguments.length; a++) {
|
|
9
|
+
var n = arguments[a];
|
|
10
|
+
for (var t in n)
|
|
11
|
+
Object.prototype.hasOwnProperty.call(n, t) && (e[t] = n[t]);
|
|
12
|
+
}
|
|
13
|
+
return e;
|
|
14
|
+
}, m.apply(this, arguments);
|
|
15
|
+
}
|
|
16
|
+
function L(e, a) {
|
|
17
|
+
if (e == null) return {};
|
|
18
|
+
var n = N(e, a), t, r;
|
|
19
|
+
if (Object.getOwnPropertySymbols) {
|
|
20
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
21
|
+
for (r = 0; r < o.length; r++)
|
|
22
|
+
t = o[r], !(a.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (n[t] = e[t]);
|
|
23
|
+
}
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
function N(e, a) {
|
|
27
|
+
if (e == null) return {};
|
|
28
|
+
var n = {}, t = Object.keys(e), r, o;
|
|
29
|
+
for (o = 0; o < t.length; o++)
|
|
30
|
+
r = t[o], !(a.indexOf(r) >= 0) && (n[r] = e[r]);
|
|
31
|
+
return n;
|
|
32
|
+
}
|
|
33
|
+
var g = E(function(e, a) {
|
|
34
|
+
var n = e.color, t = n === void 0 ? "currentColor" : n, r = e.size, o = r === void 0 ? 24 : r, s = L(e, ["color", "size"]);
|
|
35
|
+
return /* @__PURE__ */ w.createElement("svg", m({
|
|
36
|
+
ref: a,
|
|
37
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
38
|
+
width: o,
|
|
39
|
+
height: o,
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
fill: "none",
|
|
42
|
+
stroke: t,
|
|
43
|
+
strokeWidth: "2",
|
|
44
|
+
strokeLinecap: "round",
|
|
45
|
+
strokeLinejoin: "round"
|
|
46
|
+
}, s), /* @__PURE__ */ w.createElement("polyline", {
|
|
47
|
+
points: "6 9 12 15 18 9"
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
50
|
+
g.propTypes = {
|
|
51
|
+
color: c.string,
|
|
52
|
+
size: c.oneOfType([c.string, c.number])
|
|
53
|
+
};
|
|
54
|
+
g.displayName = "ChevronDown";
|
|
55
|
+
const T = ({
|
|
56
|
+
buttonClassName: e,
|
|
57
|
+
className: a,
|
|
58
|
+
itemClassName: n,
|
|
59
|
+
listClassName: t,
|
|
60
|
+
options: r
|
|
61
|
+
}) => {
|
|
62
|
+
const [o, s] = P(!1), O = b(null), f = b(null), j = y(() => s((i) => !i), []), x = y((i) => {
|
|
63
|
+
s(!1), i == null || i();
|
|
64
|
+
}, []);
|
|
65
|
+
return z(() => {
|
|
66
|
+
const i = new AbortController(), u = (d) => {
|
|
67
|
+
d.key === "Escape" && s(!1);
|
|
68
|
+
}, k = (d) => {
|
|
69
|
+
var h;
|
|
70
|
+
(h = f.current) != null && h.contains(d.target) || s(!1);
|
|
71
|
+
};
|
|
72
|
+
return document.addEventListener("keydown", u, {
|
|
73
|
+
signal: i.signal
|
|
74
|
+
}), document.addEventListener("mousedown", k, {
|
|
75
|
+
signal: i.signal
|
|
76
|
+
}), document.addEventListener(
|
|
77
|
+
"visibilitychange",
|
|
78
|
+
() => {
|
|
79
|
+
document.hidden && s(!1);
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
signal: i.signal
|
|
83
|
+
}
|
|
84
|
+
), () => {
|
|
85
|
+
i.abort();
|
|
86
|
+
};
|
|
87
|
+
}, [f]), /* @__PURE__ */ v("div", { ref: f, className: l("relative w-full", a), children: [
|
|
88
|
+
/* @__PURE__ */ v(
|
|
89
|
+
C,
|
|
90
|
+
{
|
|
91
|
+
ref: O,
|
|
92
|
+
className: l(
|
|
93
|
+
"flex gap-2 items-center justify-between w-full",
|
|
94
|
+
e
|
|
95
|
+
),
|
|
96
|
+
onClick: j,
|
|
97
|
+
children: [
|
|
98
|
+
"Download Invoice as",
|
|
99
|
+
/* @__PURE__ */ p(
|
|
100
|
+
g,
|
|
101
|
+
{
|
|
102
|
+
className: l({
|
|
103
|
+
"transform rotate-180": o,
|
|
104
|
+
"transition-transform duration-200": !0
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
o && /* @__PURE__ */ p(
|
|
112
|
+
"ul",
|
|
113
|
+
{
|
|
114
|
+
className: l(
|
|
115
|
+
"absolute z-10 mt-1 w-full bg-white border border-gray-200 rounded shadow-xs animate-in fade-in-0 py-2",
|
|
116
|
+
t
|
|
117
|
+
),
|
|
118
|
+
children: r.map((i, u) => /* @__PURE__ */ p(
|
|
119
|
+
"li",
|
|
120
|
+
{
|
|
121
|
+
className: l(
|
|
122
|
+
"hover:bg-gray-50 px-6 py-1.5 hover:cursor-pointer",
|
|
123
|
+
n
|
|
124
|
+
),
|
|
125
|
+
onClick: () => x(i.onClick),
|
|
126
|
+
children: i.label
|
|
127
|
+
},
|
|
128
|
+
u
|
|
129
|
+
))
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] });
|
|
133
|
+
};
|
|
134
|
+
export {
|
|
135
|
+
T as DropdownButton
|
|
136
|
+
};
|
|
@@ -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
|
+
};
|