@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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsxs as h, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import v, { forwardRef as x, useState as C, useRef as w, useCallback as b, useEffect as E } from "react";
|
|
3
|
+
import { cn as l } from "../../utils/index.js";
|
|
4
|
+
import { Button as P } 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 i = 1; i < arguments.length; i++) {
|
|
9
|
+
var n = arguments[i];
|
|
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 z(e, i) {
|
|
17
|
+
if (e == null) return {};
|
|
18
|
+
var n = L(e, i), t, r;
|
|
19
|
+
if (Object.getOwnPropertySymbols) {
|
|
20
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
21
|
+
for (r = 0; r < o.length; r++)
|
|
22
|
+
t = o[r], !(i.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (n[t] = e[t]);
|
|
23
|
+
}
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
function L(e, i) {
|
|
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], !(i.indexOf(r) >= 0) && (n[r] = e[r]);
|
|
31
|
+
return n;
|
|
32
|
+
}
|
|
33
|
+
var g = x(function(e, i) {
|
|
34
|
+
var n = e.color, t = n === void 0 ? "currentColor" : n, r = e.size, o = r === void 0 ? 24 : r, s = z(e, ["color", "size"]);
|
|
35
|
+
return /* @__PURE__ */ v.createElement("svg", m({
|
|
36
|
+
ref: i,
|
|
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__ */ v.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 I = ({
|
|
56
|
+
buttonClassName: e,
|
|
57
|
+
className: i,
|
|
58
|
+
itemClassName: n,
|
|
59
|
+
listClassName: t,
|
|
60
|
+
options: r
|
|
61
|
+
}) => {
|
|
62
|
+
const [o, s] = C(!1), y = w(null), f = w(null), O = b(() => s((a) => !a), []), k = b((a) => {
|
|
63
|
+
s(!1), a?.();
|
|
64
|
+
}, []);
|
|
65
|
+
return E(() => {
|
|
66
|
+
const a = new AbortController(), u = (d) => {
|
|
67
|
+
d.key === "Escape" && s(!1);
|
|
68
|
+
}, j = (d) => {
|
|
69
|
+
f.current?.contains(d.target) || s(!1);
|
|
70
|
+
};
|
|
71
|
+
return document.addEventListener("keydown", u, {
|
|
72
|
+
signal: a.signal
|
|
73
|
+
}), document.addEventListener("mousedown", j, {
|
|
74
|
+
signal: a.signal
|
|
75
|
+
}), document.addEventListener(
|
|
76
|
+
"visibilitychange",
|
|
77
|
+
() => {
|
|
78
|
+
document.hidden && s(!1);
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
signal: a.signal
|
|
82
|
+
}
|
|
83
|
+
), () => {
|
|
84
|
+
a.abort();
|
|
85
|
+
};
|
|
86
|
+
}, [f]), /* @__PURE__ */ h("div", { ref: f, className: l("relative w-full", i), children: [
|
|
87
|
+
/* @__PURE__ */ h(
|
|
88
|
+
P,
|
|
89
|
+
{
|
|
90
|
+
ref: y,
|
|
91
|
+
className: l(
|
|
92
|
+
"flex gap-2 items-center justify-between w-full",
|
|
93
|
+
e
|
|
94
|
+
),
|
|
95
|
+
onClick: O,
|
|
96
|
+
children: [
|
|
97
|
+
"Download Invoice as",
|
|
98
|
+
/* @__PURE__ */ p(
|
|
99
|
+
g,
|
|
100
|
+
{
|
|
101
|
+
className: l({
|
|
102
|
+
"transform rotate-180": o,
|
|
103
|
+
"transition-transform duration-200": !0
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
o && /* @__PURE__ */ p(
|
|
111
|
+
"ul",
|
|
112
|
+
{
|
|
113
|
+
className: l(
|
|
114
|
+
"absolute z-10 mt-1 w-full bg-white border border-gray-200 rounded shadow-xs animate-in fade-in-0 py-2",
|
|
115
|
+
t
|
|
116
|
+
),
|
|
117
|
+
children: r.map((a, u) => /* @__PURE__ */ p(
|
|
118
|
+
"li",
|
|
119
|
+
{
|
|
120
|
+
className: l(
|
|
121
|
+
"hover:bg-gray-50 px-6 py-1.5 hover:cursor-pointer",
|
|
122
|
+
n
|
|
123
|
+
),
|
|
124
|
+
onClick: () => k(a.onClick),
|
|
125
|
+
children: a.label
|
|
126
|
+
},
|
|
127
|
+
u
|
|
128
|
+
))
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
] });
|
|
132
|
+
};
|
|
133
|
+
export {
|
|
134
|
+
I as DropdownButton
|
|
135
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { FilterEvent as
|
|
3
|
-
const
|
|
4
|
-
onApply:
|
|
1
|
+
import { useId as b, useRef as C, useState as u, useEffect as m, useCallback as o, useMemo as w } from "react";
|
|
2
|
+
import { FilterEvent as p, sendOpenFilterEvent as S } from "../../events/index.js";
|
|
3
|
+
const k = ({
|
|
4
|
+
onApply: l
|
|
5
5
|
}) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const r = b(), a = C(null), [f, d] = u(!1), [s, i] = u([]);
|
|
7
|
+
m(() => {
|
|
8
8
|
const e = new AbortController();
|
|
9
9
|
return document.addEventListener(
|
|
10
|
-
|
|
11
|
-
(
|
|
12
|
-
|
|
10
|
+
p.OPEN,
|
|
11
|
+
(t) => {
|
|
12
|
+
t.detail !== r && d(!1);
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
signal: e.signal
|
|
16
16
|
}
|
|
17
17
|
), document.addEventListener(
|
|
18
|
-
|
|
18
|
+
p.RESET,
|
|
19
19
|
() => {
|
|
20
|
-
|
|
20
|
+
i([]), l?.([]);
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
signal: e.signal
|
|
@@ -25,45 +25,43 @@ const I = ({
|
|
|
25
25
|
), () => {
|
|
26
26
|
e.abort();
|
|
27
27
|
};
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
30
|
-
() =>
|
|
31
|
-
(
|
|
28
|
+
}, [r, l]);
|
|
29
|
+
const v = o(
|
|
30
|
+
() => d((e) => (e || (S(r), i(
|
|
31
|
+
(t) => t.filter((n) => n.isApplied)
|
|
32
32
|
)), !e)),
|
|
33
|
-
[
|
|
34
|
-
),
|
|
35
|
-
(e,
|
|
36
|
-
|
|
37
|
-
...
|
|
33
|
+
[r, d]
|
|
34
|
+
), c = o(() => d(!1), []), E = o(
|
|
35
|
+
(e, t) => {
|
|
36
|
+
i(t ? [
|
|
37
|
+
...s,
|
|
38
38
|
{ ...e, isApplied: !1 }
|
|
39
|
-
] :
|
|
39
|
+
] : s.map((n) => n.id === e.id ? { ...n, isRemoved: !0 } : n));
|
|
40
40
|
},
|
|
41
|
-
[
|
|
42
|
-
),
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
({ isApplied: e, isRemoved: s, ...i }) => i
|
|
41
|
+
[i, s]
|
|
42
|
+
), O = o(() => {
|
|
43
|
+
i([]), l?.([]);
|
|
44
|
+
}, [l]), g = o(() => {
|
|
45
|
+
const e = s?.filter((t) => !t.isRemoved).map((t) => ({ ...t, isApplied: !0 }));
|
|
46
|
+
i(e), l?.(
|
|
47
|
+
e.map(
|
|
48
|
+
({ isApplied: t, isRemoved: n, ...R }) => R
|
|
50
49
|
)
|
|
51
50
|
);
|
|
52
|
-
}, [
|
|
53
|
-
() =>
|
|
54
|
-
[
|
|
51
|
+
}, [l, s, i]), h = w(
|
|
52
|
+
() => s.filter((e) => e.isApplied),
|
|
53
|
+
[s]
|
|
55
54
|
);
|
|
56
|
-
return
|
|
57
|
-
const e = new AbortController(),
|
|
58
|
-
|
|
59
|
-
(u = c.current) != null && u.contains(i.target) || o();
|
|
55
|
+
return m(() => {
|
|
56
|
+
const e = new AbortController(), t = (n) => {
|
|
57
|
+
a.current?.contains(n.target) || c();
|
|
60
58
|
};
|
|
61
|
-
return document.addEventListener("mousedown",
|
|
59
|
+
return document.addEventListener("mousedown", t, {
|
|
62
60
|
signal: e.signal
|
|
63
61
|
}), document.addEventListener(
|
|
64
62
|
"visibilitychange",
|
|
65
63
|
() => {
|
|
66
|
-
document.hidden &&
|
|
64
|
+
document.hidden && c();
|
|
67
65
|
},
|
|
68
66
|
{
|
|
69
67
|
signal: e.signal
|
|
@@ -71,17 +69,17 @@ const I = ({
|
|
|
71
69
|
), () => {
|
|
72
70
|
e.abort();
|
|
73
71
|
};
|
|
74
|
-
}, [
|
|
75
|
-
isOpen:
|
|
76
|
-
selectedCount:
|
|
77
|
-
selectedOptions:
|
|
78
|
-
wrapperRef:
|
|
79
|
-
handleApplyOptions:
|
|
80
|
-
handleOpen:
|
|
81
|
-
handleResetOptions:
|
|
82
|
-
handleSelectOption:
|
|
72
|
+
}, [c, a]), {
|
|
73
|
+
isOpen: f,
|
|
74
|
+
selectedCount: h,
|
|
75
|
+
selectedOptions: s,
|
|
76
|
+
wrapperRef: a,
|
|
77
|
+
handleApplyOptions: g,
|
|
78
|
+
handleOpen: v,
|
|
79
|
+
handleResetOptions: O,
|
|
80
|
+
handleSelectOption: E
|
|
83
81
|
};
|
|
84
82
|
};
|
|
85
83
|
export {
|
|
86
|
-
|
|
84
|
+
k as useBadgeMultiSelect
|
|
87
85
|
};
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Badge as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Checkbox as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { filterButtonIconVariants as
|
|
7
|
-
import { useBadgeMultiSelect as
|
|
8
|
-
import { C as
|
|
9
|
-
const
|
|
10
|
-
options:
|
|
11
|
-
label:
|
|
12
|
-
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as o } from "../../../Badge/Badge.js";
|
|
3
|
+
import { Button as m } from "../../../Button/Button.js";
|
|
4
|
+
import { Checkbox as C } from "../../../Checkbox/Checkbox.js";
|
|
5
|
+
import { cn as n } from "../../../../utils/index.js";
|
|
6
|
+
import { filterButtonIconVariants as y, filterButtonVariants as N } from "../../Filter.variants.js";
|
|
7
|
+
import { useBadgeMultiSelect as B } from "./BadgeMultiSelect.hook.js";
|
|
8
|
+
import { C as O } from "../../../../chevron-down-CVce9Mvh.js";
|
|
9
|
+
const $ = ({
|
|
10
|
+
options: i,
|
|
11
|
+
label: p,
|
|
12
|
+
position: d = "left",
|
|
13
|
+
onApply: f
|
|
13
14
|
}) => {
|
|
14
15
|
const {
|
|
15
|
-
wrapperRef:
|
|
16
|
+
wrapperRef: h,
|
|
16
17
|
isOpen: l,
|
|
17
|
-
selectedOptions:
|
|
18
|
-
selectedCount:
|
|
19
|
-
handleOpen:
|
|
20
|
-
handleResetOptions:
|
|
21
|
-
handleApplyOptions:
|
|
22
|
-
handleSelectOption:
|
|
23
|
-
} =
|
|
24
|
-
return
|
|
25
|
-
/* @__PURE__ */
|
|
18
|
+
selectedOptions: u,
|
|
19
|
+
selectedCount: c,
|
|
20
|
+
handleOpen: g,
|
|
21
|
+
handleResetOptions: b,
|
|
22
|
+
handleApplyOptions: v,
|
|
23
|
+
handleSelectOption: x
|
|
24
|
+
} = B({ onApply: f });
|
|
25
|
+
return i.length === 0 ? null : /* @__PURE__ */ a("div", { ref: h, className: "relative", children: [
|
|
26
|
+
/* @__PURE__ */ a(
|
|
26
27
|
"button",
|
|
27
28
|
{
|
|
28
|
-
className:
|
|
29
|
+
className: n(N(), {
|
|
29
30
|
"text-slate-700": l
|
|
30
31
|
}),
|
|
31
|
-
onClick:
|
|
32
|
+
onClick: g,
|
|
32
33
|
children: [
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
p,
|
|
35
|
+
c.length > 0 && /* @__PURE__ */ e(o, { label: c.length.toString() }),
|
|
35
36
|
/* @__PURE__ */ e(
|
|
36
|
-
|
|
37
|
+
O,
|
|
37
38
|
{
|
|
38
|
-
className:
|
|
39
|
+
className: n(y(), {
|
|
39
40
|
"rotate-180": l,
|
|
40
41
|
"text-blue-600": l
|
|
41
42
|
})
|
|
@@ -44,39 +45,51 @@ const V = ({
|
|
|
44
45
|
]
|
|
45
46
|
}
|
|
46
47
|
),
|
|
47
|
-
l && /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return /* @__PURE__ */ t("div", { className: "flex gap-4 px-6", children: [
|
|
53
|
-
/* @__PURE__ */ e(
|
|
54
|
-
x,
|
|
55
|
-
{
|
|
56
|
-
defaultChecked: d,
|
|
57
|
-
"data-label": a.id,
|
|
58
|
-
onChange: (r) => v(a, r)
|
|
59
|
-
},
|
|
60
|
-
`${a.id}-${d}`
|
|
61
|
-
),
|
|
62
|
-
/* @__PURE__ */ e(c, { label: a.label, variant: a.variant })
|
|
63
|
-
] }, a.id);
|
|
64
|
-
}) }) }),
|
|
65
|
-
/* @__PURE__ */ t("div", { className: "flex justify-center items-center gap-4 py-4 border-t border-gray-200", children: [
|
|
66
|
-
/* @__PURE__ */ e(
|
|
67
|
-
s,
|
|
48
|
+
l && /* @__PURE__ */ a(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: n(
|
|
52
|
+
"absolute top-full mt-1 bg-white rounded-md shadow-md animate-in fade-in-0 z-10 border border-gray-200",
|
|
68
53
|
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
onClick: g,
|
|
72
|
-
children: "Reset"
|
|
54
|
+
"left-0": d === "left",
|
|
55
|
+
"right-0": d === "right"
|
|
73
56
|
}
|
|
74
57
|
),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ e("div", { className: "py-4", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: i.map((t) => {
|
|
60
|
+
const s = !!u.find(
|
|
61
|
+
(r) => r.id === t.id
|
|
62
|
+
);
|
|
63
|
+
return /* @__PURE__ */ a("div", { className: "flex gap-4 px-6", children: [
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
C,
|
|
66
|
+
{
|
|
67
|
+
defaultChecked: s,
|
|
68
|
+
"data-label": t.id,
|
|
69
|
+
onChange: (r) => x(t, r)
|
|
70
|
+
},
|
|
71
|
+
`${t.id}-${s}`
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ e(o, { label: t.label, variant: t.variant })
|
|
74
|
+
] }, t.id);
|
|
75
|
+
}) }) }),
|
|
76
|
+
/* @__PURE__ */ a("div", { className: "flex justify-center items-center gap-4 py-4 border-t border-gray-200", children: [
|
|
77
|
+
/* @__PURE__ */ e(
|
|
78
|
+
m,
|
|
79
|
+
{
|
|
80
|
+
variant: "secondary",
|
|
81
|
+
appearance: "compact",
|
|
82
|
+
onClick: b,
|
|
83
|
+
children: "Reset"
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ e(m, { appearance: "compact", onClick: v, children: "Apply" })
|
|
87
|
+
] })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
)
|
|
78
91
|
] });
|
|
79
92
|
};
|
|
80
93
|
export {
|
|
81
|
-
|
|
94
|
+
$ as BadgeMultiSelect
|
|
82
95
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { sendOpenFilterEvent as
|
|
3
|
-
const
|
|
4
|
-
onApply:
|
|
1
|
+
import { useRef as w, useId as C, useState as m, useMemo as L, useCallback as s, useEffect as E } from "react";
|
|
2
|
+
import { sendOpenFilterEvent as y, FilterEvent as f } from "../../events/index.js";
|
|
3
|
+
const R = ({
|
|
4
|
+
onApply: n
|
|
5
5
|
}) => {
|
|
6
|
-
const
|
|
7
|
-
() =>
|
|
6
|
+
const i = w(null), t = C(), [g, a] = m(!1), [r, l] = m(), [v, d] = m(), h = L(
|
|
7
|
+
() => v?.toLocaleDateString("en-GB", {
|
|
8
8
|
day: "numeric",
|
|
9
9
|
month: "short",
|
|
10
10
|
year: "numeric"
|
|
11
11
|
}),
|
|
12
|
-
[
|
|
13
|
-
),
|
|
14
|
-
() =>
|
|
15
|
-
[
|
|
16
|
-
),
|
|
17
|
-
|
|
18
|
-
}, [
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
return
|
|
12
|
+
[v]
|
|
13
|
+
), p = s(
|
|
14
|
+
() => a((e) => (e || y(t), !e)),
|
|
15
|
+
[t]
|
|
16
|
+
), D = s(() => {
|
|
17
|
+
d(r), n?.(r);
|
|
18
|
+
}, [n, r]), b = s((e) => l(e), []), c = s(() => a(!1), []), O = s(() => {
|
|
19
|
+
l(void 0), d(void 0), n?.();
|
|
20
|
+
}, [n]);
|
|
21
|
+
return E(() => {
|
|
22
22
|
const e = new AbortController();
|
|
23
23
|
return document.addEventListener(
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
|
|
24
|
+
f.OPEN,
|
|
25
|
+
(o) => {
|
|
26
|
+
o.detail !== t && a(!1);
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
signal: e.signal
|
|
@@ -31,20 +31,20 @@ const N = ({
|
|
|
31
31
|
), () => {
|
|
32
32
|
e.abort();
|
|
33
33
|
};
|
|
34
|
-
}, [
|
|
34
|
+
}, [t]), E(() => {
|
|
35
35
|
const e = new AbortController();
|
|
36
36
|
return document.addEventListener(
|
|
37
|
-
|
|
38
|
-
(
|
|
39
|
-
|
|
37
|
+
f.OPEN,
|
|
38
|
+
(o) => {
|
|
39
|
+
o.detail !== t && a(!1);
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
signal: e.signal
|
|
43
43
|
}
|
|
44
44
|
), document.addEventListener(
|
|
45
|
-
|
|
45
|
+
f.RESET,
|
|
46
46
|
() => {
|
|
47
|
-
|
|
47
|
+
l(void 0), d(void 0), n?.();
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
signal: e.signal
|
|
@@ -52,17 +52,16 @@ const N = ({
|
|
|
52
52
|
), () => {
|
|
53
53
|
e.abort();
|
|
54
54
|
};
|
|
55
|
-
}, [
|
|
56
|
-
const e = new AbortController(),
|
|
57
|
-
|
|
58
|
-
(g = c.current) != null && g.contains(m.target) || u();
|
|
55
|
+
}, [t, n]), E(() => {
|
|
56
|
+
const e = new AbortController(), o = (u) => {
|
|
57
|
+
i.current?.contains(u.target) || c();
|
|
59
58
|
};
|
|
60
|
-
return document.addEventListener("mousedown",
|
|
59
|
+
return document.addEventListener("mousedown", o, {
|
|
61
60
|
signal: e.signal
|
|
62
61
|
}), document.addEventListener(
|
|
63
62
|
"visibilitychange",
|
|
64
63
|
() => {
|
|
65
|
-
document.hidden &&
|
|
64
|
+
document.hidden && c();
|
|
66
65
|
},
|
|
67
66
|
{
|
|
68
67
|
signal: e.signal
|
|
@@ -70,18 +69,18 @@ const N = ({
|
|
|
70
69
|
), () => {
|
|
71
70
|
e.abort();
|
|
72
71
|
};
|
|
73
|
-
}, [
|
|
74
|
-
id:
|
|
75
|
-
appliedDay:
|
|
76
|
-
isOpen:
|
|
77
|
-
selectedDay:
|
|
78
|
-
wrapperRef:
|
|
79
|
-
handleApply:
|
|
80
|
-
handleOpen:
|
|
81
|
-
handleSelect:
|
|
82
|
-
handleReset:
|
|
72
|
+
}, [c, i]), {
|
|
73
|
+
id: t,
|
|
74
|
+
appliedDay: h,
|
|
75
|
+
isOpen: g,
|
|
76
|
+
selectedDay: r,
|
|
77
|
+
wrapperRef: i,
|
|
78
|
+
handleApply: D,
|
|
79
|
+
handleOpen: p,
|
|
80
|
+
handleSelect: b,
|
|
81
|
+
handleReset: O
|
|
83
82
|
};
|
|
84
83
|
};
|
|
85
84
|
export {
|
|
86
|
-
|
|
85
|
+
R as useDateFilterDropdown
|
|
87
86
|
};
|