@konstructio/ui 0.1.0-alpha.2 → 0.1.0-alpha.21
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/Dropdown.variants.js +6 -5
- 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/ListItem/ListItem.variants.js +6 -4
- 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 +64 -67
- 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-Bry5AFQ2.js → index-Bc1LNrRD.js} +1 -1
- package/dist/index-BdMNhZnh.js +9 -0
- package/dist/index-BvCZBMfr.js +432 -0
- package/dist/{index-AM3avohj.js → index-CT6_TaZk.js} +3 -3
- package/dist/index-Cq1I1cG9.js +129 -0
- package/dist/index-Cs8Lv8Wj.js +13 -0
- package/dist/{index-YaQrdkGE.js → index-DNRcvRTB.js} +31 -30
- package/dist/index-DdbImHmO.js +323 -0
- package/dist/index-DwYXX2sM.js +13 -0
- package/dist/{index-DvFiic6N.js → index-aR9z1Fe3.js} +96 -102
- package/dist/{index-C5psggHV.js → index-h-Ul0anl.js} +1 -2
- package/dist/{index-G_6jG4Qc.js → index-j2KyU-zG.js} +19 -19
- package/dist/{index-dRxIWVBr.js → index-oBRTQ54R.js} +6 -5
- 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
|
@@ -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
|
+
};
|
|
@@ -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,86 @@
|
|
|
1
|
+
import { useId as C, useRef as w, useState as m, useEffect as f, useCallback as d, useMemo as S } from "react";
|
|
2
|
+
import { FilterEvent as v, sendOpenFilterEvent as L } from "../../events/index.js";
|
|
3
|
+
const I = ({
|
|
4
|
+
onApply: t
|
|
5
|
+
}) => {
|
|
6
|
+
const a = C(), o = w(null), [E, c] = m(!1), [n, r] = m([]);
|
|
7
|
+
f(() => {
|
|
8
|
+
const e = new AbortController();
|
|
9
|
+
return document.addEventListener(
|
|
10
|
+
v.OPEN,
|
|
11
|
+
(s) => {
|
|
12
|
+
s.detail !== a && c(!1);
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
signal: e.signal
|
|
16
|
+
}
|
|
17
|
+
), document.addEventListener(
|
|
18
|
+
v.RESET,
|
|
19
|
+
() => {
|
|
20
|
+
r([]), t == null || t([]);
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
signal: e.signal
|
|
24
|
+
}
|
|
25
|
+
), () => {
|
|
26
|
+
e.abort();
|
|
27
|
+
};
|
|
28
|
+
}, [a, t]);
|
|
29
|
+
const g = d(
|
|
30
|
+
() => c((e) => (e || (L(a), r(
|
|
31
|
+
(s) => s.filter((i) => i.isApplied)
|
|
32
|
+
)), !e)),
|
|
33
|
+
[a, c]
|
|
34
|
+
), u = d(() => c(!1), []), O = d(
|
|
35
|
+
(e, s) => {
|
|
36
|
+
r(s ? [
|
|
37
|
+
...n,
|
|
38
|
+
{ ...e, isApplied: !1 }
|
|
39
|
+
] : n.map((i) => i.id === e.id ? { ...i, isRemoved: !0 } : i));
|
|
40
|
+
},
|
|
41
|
+
[r, n]
|
|
42
|
+
), h = d(() => {
|
|
43
|
+
r([]), t == null || t([]);
|
|
44
|
+
}, [t]), R = d(() => {
|
|
45
|
+
const e = n == null ? void 0 : n.filter((s) => !s.isRemoved).map((s) => ({ ...s, isApplied: !0 }));
|
|
46
|
+
r(e), t == null || t(
|
|
47
|
+
e.map(
|
|
48
|
+
({ isApplied: s, isRemoved: i, ...l }) => l
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
}, [t, n, r]), b = S(
|
|
52
|
+
() => n.filter((e) => e.isApplied),
|
|
53
|
+
[n]
|
|
54
|
+
);
|
|
55
|
+
return f(() => {
|
|
56
|
+
const e = new AbortController(), s = (i) => {
|
|
57
|
+
var l;
|
|
58
|
+
(l = o.current) != null && l.contains(i.target) || u();
|
|
59
|
+
};
|
|
60
|
+
return document.addEventListener("mousedown", s, {
|
|
61
|
+
signal: e.signal
|
|
62
|
+
}), document.addEventListener(
|
|
63
|
+
"visibilitychange",
|
|
64
|
+
() => {
|
|
65
|
+
document.hidden && u();
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
signal: e.signal
|
|
69
|
+
}
|
|
70
|
+
), () => {
|
|
71
|
+
e.abort();
|
|
72
|
+
};
|
|
73
|
+
}, [u, o]), {
|
|
74
|
+
isOpen: E,
|
|
75
|
+
selectedCount: b,
|
|
76
|
+
selectedOptions: n,
|
|
77
|
+
wrapperRef: o,
|
|
78
|
+
handleApplyOptions: R,
|
|
79
|
+
handleOpen: g,
|
|
80
|
+
handleResetOptions: h,
|
|
81
|
+
handleSelectOption: O
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
I as useBadgeMultiSelect
|
|
86
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
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-3QGcvbP_.js";
|
|
9
|
+
const $ = ({
|
|
10
|
+
options: i,
|
|
11
|
+
label: p,
|
|
12
|
+
position: d = "left",
|
|
13
|
+
onApply: f
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
wrapperRef: h,
|
|
17
|
+
isOpen: l,
|
|
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(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
className: n(N(), {
|
|
30
|
+
"text-slate-700": l
|
|
31
|
+
}),
|
|
32
|
+
onClick: g,
|
|
33
|
+
children: [
|
|
34
|
+
p,
|
|
35
|
+
c.length > 0 && /* @__PURE__ */ e(o, { label: c.length.toString() }),
|
|
36
|
+
/* @__PURE__ */ e(
|
|
37
|
+
O,
|
|
38
|
+
{
|
|
39
|
+
className: n(y(), {
|
|
40
|
+
"rotate-180": l,
|
|
41
|
+
"text-blue-600": l
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
),
|
|
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",
|
|
53
|
+
{
|
|
54
|
+
"left-0": d === "left",
|
|
55
|
+
"right-0": d === "right"
|
|
56
|
+
}
|
|
57
|
+
),
|
|
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
|
+
)
|
|
91
|
+
] });
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
$ as BadgeMultiSelect
|
|
95
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useRef as L, useId as S, useState as E, useMemo as F, useCallback as r, useEffect as f } from "react";
|
|
2
|
+
import { sendOpenFilterEvent as R, FilterEvent as v } from "../../events/index.js";
|
|
3
|
+
const N = ({
|
|
4
|
+
onApply: t
|
|
5
|
+
}) => {
|
|
6
|
+
const c = L(null), n = S(), [h, o] = E(!1), [a, d] = E(), [i, l] = E(), b = F(
|
|
7
|
+
() => i == null ? void 0 : i.toLocaleDateString("en-GB", {
|
|
8
|
+
day: "numeric",
|
|
9
|
+
month: "short",
|
|
10
|
+
year: "numeric"
|
|
11
|
+
}),
|
|
12
|
+
[i]
|
|
13
|
+
), D = r(
|
|
14
|
+
() => o((e) => (e || R(n), !e)),
|
|
15
|
+
[n]
|
|
16
|
+
), O = r(() => {
|
|
17
|
+
l(a), t == null || t(a);
|
|
18
|
+
}, [t, a]), w = r((e) => d(e), []), u = r(() => o(!1), []), C = r(() => {
|
|
19
|
+
d(void 0), l(void 0), t == null || t();
|
|
20
|
+
}, [t]);
|
|
21
|
+
return f(() => {
|
|
22
|
+
const e = new AbortController();
|
|
23
|
+
return document.addEventListener(
|
|
24
|
+
v.OPEN,
|
|
25
|
+
(s) => {
|
|
26
|
+
s.detail !== n && o(!1);
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
signal: e.signal
|
|
30
|
+
}
|
|
31
|
+
), () => {
|
|
32
|
+
e.abort();
|
|
33
|
+
};
|
|
34
|
+
}, [n]), f(() => {
|
|
35
|
+
const e = new AbortController();
|
|
36
|
+
return document.addEventListener(
|
|
37
|
+
v.OPEN,
|
|
38
|
+
(s) => {
|
|
39
|
+
s.detail !== n && o(!1);
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
signal: e.signal
|
|
43
|
+
}
|
|
44
|
+
), document.addEventListener(
|
|
45
|
+
v.RESET,
|
|
46
|
+
() => {
|
|
47
|
+
d(void 0), l(void 0), t == null || t();
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
signal: e.signal
|
|
51
|
+
}
|
|
52
|
+
), () => {
|
|
53
|
+
e.abort();
|
|
54
|
+
};
|
|
55
|
+
}, [n, t]), f(() => {
|
|
56
|
+
const e = new AbortController(), s = (m) => {
|
|
57
|
+
var g;
|
|
58
|
+
(g = c.current) != null && g.contains(m.target) || u();
|
|
59
|
+
};
|
|
60
|
+
return document.addEventListener("mousedown", s, {
|
|
61
|
+
signal: e.signal
|
|
62
|
+
}), document.addEventListener(
|
|
63
|
+
"visibilitychange",
|
|
64
|
+
() => {
|
|
65
|
+
document.hidden && u();
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
signal: e.signal
|
|
69
|
+
}
|
|
70
|
+
), () => {
|
|
71
|
+
e.abort();
|
|
72
|
+
};
|
|
73
|
+
}, [u, c]), {
|
|
74
|
+
id: n,
|
|
75
|
+
appliedDay: b,
|
|
76
|
+
isOpen: h,
|
|
77
|
+
selectedDay: a,
|
|
78
|
+
wrapperRef: c,
|
|
79
|
+
handleApply: O,
|
|
80
|
+
handleOpen: D,
|
|
81
|
+
handleSelect: w,
|
|
82
|
+
handleReset: C
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
N as useDateFilterDropdown
|
|
87
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as g } from "../../../Badge/Badge.js";
|
|
3
|
+
import { Button as i } from "../../../Button/Button.js";
|
|
4
|
+
import { DatePicker as w } from "../../../Datepicker/DatePicker.js";
|
|
5
|
+
import { cn as o } from "../../../../utils/index.js";
|
|
6
|
+
import { filterButtonIconVariants as x, filterButtonVariants as N } from "../../Filter.variants.js";
|
|
7
|
+
import { useDateFilterDropdown as b } from "./DateFilterDropdown.hook.js";
|
|
8
|
+
import { C as y } from "../../../../chevron-down-3QGcvbP_.js";
|
|
9
|
+
const R = ({
|
|
10
|
+
label: p,
|
|
11
|
+
position: l = "left",
|
|
12
|
+
onApply: s
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
id: m,
|
|
16
|
+
appliedDay: n,
|
|
17
|
+
isOpen: a,
|
|
18
|
+
selectedDay: e,
|
|
19
|
+
wrapperRef: c,
|
|
20
|
+
handleApply: d,
|
|
21
|
+
handleOpen: f,
|
|
22
|
+
handleSelect: h,
|
|
23
|
+
handleReset: u
|
|
24
|
+
} = b({ onApply: s });
|
|
25
|
+
return /* @__PURE__ */ r("div", { ref: c, className: "relative", children: [
|
|
26
|
+
/* @__PURE__ */ r(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
className: o(N(), {
|
|
30
|
+
"text-slate-700": a
|
|
31
|
+
}),
|
|
32
|
+
onClick: f,
|
|
33
|
+
children: [
|
|
34
|
+
p,
|
|
35
|
+
n && /* @__PURE__ */ t(g, { label: n }),
|
|
36
|
+
/* @__PURE__ */ t(
|
|
37
|
+
y,
|
|
38
|
+
{
|
|
39
|
+
className: o(x(), {
|
|
40
|
+
"rotate-180": a,
|
|
41
|
+
"text-blue-600": a
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
a && /* @__PURE__ */ r(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: o(
|
|
52
|
+
"absolute top-full mt-1 bg-white rounded-md shadow-md animate-in fade-in-0 z-10 border border-gray-200 flex flex-col gap-4 py-4 px-6",
|
|
53
|
+
{
|
|
54
|
+
"left-0": l === "left",
|
|
55
|
+
"right-0": l === "right"
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ t(
|
|
60
|
+
w,
|
|
61
|
+
{
|
|
62
|
+
className: "p-0",
|
|
63
|
+
arrowClassName: "-top-1 right-0",
|
|
64
|
+
monthsClassName: "shadow-none p-0 w-auto",
|
|
65
|
+
defaultSelected: e,
|
|
66
|
+
defaultMonth: e,
|
|
67
|
+
onSelect: h
|
|
68
|
+
},
|
|
69
|
+
(e == null ? void 0 : e.toISOString()) ?? m
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ r("div", { className: "flex justify-end items-center gap-4 py-2", children: [
|
|
72
|
+
/* @__PURE__ */ t(
|
|
73
|
+
i,
|
|
74
|
+
{
|
|
75
|
+
variant: "secondary",
|
|
76
|
+
appearance: "compact",
|
|
77
|
+
onClick: u,
|
|
78
|
+
children: "Reset"
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ t(i, { appearance: "compact", onClick: d, children: "Apply" })
|
|
82
|
+
] })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] });
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
R as DateFilterDropdown
|
|
90
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as a } from "react";
|
|
3
|
+
import { Button as m } from "../../../Button/Button.js";
|
|
4
|
+
import { resetEvent as n } from "../../events/index.js";
|
|
5
|
+
const f = ({ disabled: e, onClick: t }) => {
|
|
6
|
+
const r = a(() => {
|
|
7
|
+
n(), t == null || t();
|
|
8
|
+
}, [t]);
|
|
9
|
+
return /* @__PURE__ */ o(
|
|
10
|
+
m,
|
|
11
|
+
{
|
|
12
|
+
type: "button",
|
|
13
|
+
variant: "text",
|
|
14
|
+
appearance: "compact",
|
|
15
|
+
version: "alternate",
|
|
16
|
+
onClick: r,
|
|
17
|
+
disabled: e,
|
|
18
|
+
children: "Reset"
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
f as ResetButton
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BadgeMultiSelect as o } from "./BadgeDropdown/BadgeMultiSelect.js";
|
|
2
|
+
import { DateFilterDropdown as p } from "./DateFilterDropdown/DateFilterDropdown.js";
|
|
3
|
+
import { ResetButton as l } from "./ResetButton/ResetButton.js";
|
|
4
|
+
export {
|
|
5
|
+
o as BadgeMultiSelect,
|
|
6
|
+
p as DateFilterDropdown,
|
|
7
|
+
l as ResetButton
|
|
8
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var e = /* @__PURE__ */ ((t) => (t.OPEN = "@konstrtuctio/Filter/event-OPEN", t.RESET = "@konstrtuctio/Filter/event-RESET", t))(e || {});
|
|
2
|
+
const n = (t) => document.dispatchEvent(
|
|
3
|
+
new CustomEvent("@konstrtuctio/Filter/event-OPEN", { detail: t })
|
|
4
|
+
), o = () => document.dispatchEvent(new CustomEvent(
|
|
5
|
+
"@konstrtuctio/Filter/event-RESET"
|
|
6
|
+
/* RESET */
|
|
7
|
+
));
|
|
8
|
+
export {
|
|
9
|
+
e as FilterEvent,
|
|
10
|
+
o as resetEvent,
|
|
11
|
+
n as sendOpenFilterEvent
|
|
12
|
+
};
|