@konstructio/ui 0.1.2-alpha.74 → 0.1.2-alpha.76
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/{Modal-CXRo8f-h.js → Modal-BTOXCb0Y.js} +1 -1
- package/dist/assets/icons/components/Home2.d.ts +3 -0
- package/dist/assets/icons/components/Home2.js +28 -0
- package/dist/assets/icons/components/Upload.d.ts +3 -0
- package/dist/assets/icons/components/Upload.js +28 -0
- package/dist/assets/icons/components/index.d.ts +2 -0
- package/dist/assets/icons/components/index.js +70 -66
- package/dist/assets/icons/index.js +70 -66
- package/dist/components/Alert/Alert.d.ts +2 -2
- package/dist/components/Alert/Alert.types.d.ts +3 -1
- package/dist/components/AlertDialog/AlertDialog.d.ts +2 -2
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +5 -3
- package/dist/components/AlertDialog/components/AlertDialogTrigger.d.ts +2 -2
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/AlertDialogTrigger.types.d.ts +4 -2
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +3 -1
- package/dist/components/Badge/Badge.d.ts +2 -2
- package/dist/components/Badge/Badge.types.d.ts +3 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts +3 -1
- package/dist/components/Breadcrumb/components/Item/Item.d.ts +2 -2
- package/dist/components/Breadcrumb/components/Item/Item.types.d.ts +3 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/Button.types.d.ts +3 -1
- package/dist/components/Button/Button.variants.js +4 -5
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +1 -1
- package/dist/components/Card/Card.d.ts +2 -2
- package/dist/components/Card/Card.types.d.ts +3 -1
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.types.d.ts +3 -1
- package/dist/components/Command/Command.d.ts +2 -2
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/Command.types.d.ts +3 -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 +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 +1 -1
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Counter/Counter.d.ts +2 -2
- package/dist/components/Counter/Counter.types.d.ts +3 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.types.d.ts +3 -1
- package/dist/components/DateRangePicker/components/CalendarPanel/components/IndependentModeCalendar/IndependentModeCalendar.js +1 -1
- package/dist/components/DateRangePicker/components/CalendarPanel/components/TogetherModeCalendar/TogetherModeCalendar.js +1 -1
- package/dist/components/Datepicker/DatePicker.d.ts +2 -2
- package/dist/components/Datepicker/DatePicker.types.d.ts +3 -1
- package/dist/components/Filter/Filter.js +24 -22
- package/dist/components/Filter/Filter.types.d.ts +13 -3
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.d.ts +3 -1
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.hook.js +57 -41
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +75 -49
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.types.d.ts +2 -0
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.hook.js +38 -37
- package/dist/components/Filter/components/DateRangeFilterDropdown/DateRangeFilterDropdown.hook.js +31 -30
- package/dist/components/Filter/components/ResetButton/ResetButton.types.d.ts +1 -1
- package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.js +64 -47
- package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.types.d.ts +2 -0
- package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.hook.js +35 -34
- package/dist/components/Filter/contexts/filter.context.d.ts +4 -0
- package/dist/components/Filter/contexts/filter.context.js +7 -0
- package/dist/components/Filter/contexts/filter.hook.d.ts +2 -0
- package/dist/components/Filter/contexts/filter.hook.js +11 -0
- package/dist/components/Filter/contexts/filter.provider.d.ts +5 -0
- package/dist/components/Filter/contexts/filter.provider.js +6 -0
- package/dist/components/Filter/contexts/index.d.ts +3 -0
- package/dist/components/Filter/contexts/index.js +8 -0
- package/dist/components/ImageUpload/ImageUpload.d.ts +2 -2
- package/dist/components/ImageUpload/ImageUpload.types.d.ts +3 -1
- package/dist/components/Input/Input.d.ts +2 -2
- package/dist/components/Input/Input.types.d.ts +3 -1
- package/dist/components/LineChart/LineChart.d.ts +2 -2
- package/dist/components/LineChart/LineChart.js +55 -52
- package/dist/components/LineChart/LineChart.types.d.ts +6 -2
- package/dist/components/Loading/Loading.d.ts +2 -2
- package/dist/components/Loading/Loading.types.d.ts +3 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.d.ts +2 -2
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.types.d.ts +3 -1
- package/dist/components/MultiSelectDropdown/components/Wrapper/Wrapper.types.d.ts +1 -1
- package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +394 -353
- package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -2
- package/dist/components/ProgressBar/ProgressBar.types.d.ts +3 -1
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/Radio/Radio.types.d.ts +3 -1
- package/dist/components/RadioCard/RadioCard.d.ts +2 -2
- package/dist/components/RadioCard/RadioCard.types.d.ts +5 -3
- package/dist/components/RadioCardGroup/RadioCardGroup.d.ts +2 -2
- package/dist/components/RadioCardGroup/RadioCardGroup.types.d.ts +4 -2
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +4 -2
- package/dist/components/Range/Range.d.ts +2 -2
- package/dist/components/Range/Range.types.d.ts +3 -1
- package/dist/components/Select/Select.d.ts +2 -2
- package/dist/components/Select/Select.types.d.ts +4 -1
- package/dist/components/Select/Select.variants.js +1 -1
- package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.types.d.ts +1 -1
- package/dist/components/Select/components/List/List.js +64 -61
- package/dist/components/Select/components/List/List.types.d.ts +2 -1
- package/dist/components/Select/components/Wrapper.js +46 -44
- package/dist/components/Select/constants/index.d.ts +1 -0
- package/dist/components/Select/constants/index.js +3 -1
- package/dist/components/Select/constants/list.d.ts +1 -0
- package/dist/components/Select/constants/list.js +4 -0
- package/dist/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.types.d.ts +3 -1
- package/dist/components/Sidebar/components/Footer/Footer.d.ts +2 -2
- package/dist/components/Sidebar/components/Footer/Footer.types.d.ts +3 -1
- package/dist/components/Sidebar/components/Logo/Logo.d.ts +2 -2
- package/dist/components/Sidebar/components/Logo/Logo.types.d.ts +3 -1
- package/dist/components/Sidebar/components/Navigation/Navigation.d.ts +2 -2
- package/dist/components/Sidebar/components/Navigation/Navigation.types.d.ts +7 -5
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.d.ts +2 -2
- package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.types.d.ts +3 -1
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.d.ts +2 -2
- package/dist/components/Sidebar/components/NavigationOption/NavigationOption.types.d.ts +3 -1
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.d.ts +2 -2
- package/dist/components/Sidebar/components/NavigationSeparator/NavigationSeparator.types.d.ts +3 -1
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.d.ts +2 -2
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.js +1 -5
- package/dist/components/Sidebar/components/NavigationTitle/NavigationTitle.types.d.ts +3 -1
- package/dist/components/Sidebar/components/index.d.ts +7 -7
- package/dist/components/Slider/Slider.d.ts +2 -2
- package/dist/components/Slider/Slider.types.d.ts +3 -1
- package/dist/components/Spinner/Spinner.d.ts +2 -2
- package/dist/components/Spinner/Spinner.types.d.ts +4 -2
- package/dist/components/Stepper/Stepper.d.ts +2 -2
- package/dist/components/Stepper/Stepper.types.d.ts +3 -1
- package/dist/components/Switch/Switch.d.ts +2 -2
- package/dist/components/Switch/Switch.types.d.ts +3 -1
- package/dist/components/Table/Table.types.d.ts +3 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/Tabs/Tabs.types.d.ts +3 -1
- package/dist/components/Tag/Tag.d.ts +2 -2
- package/dist/components/Tag/Tag.types.d.ts +3 -1
- package/dist/components/TagSelect/TagSelect.d.ts +2 -2
- package/dist/components/TagSelect/TagSelect.js +3 -1
- package/dist/components/TagSelect/TagSelect.types.d.ts +4 -2
- package/dist/components/TagSelect/components/Item/Item.types.d.ts +1 -1
- package/dist/components/TagSelect/components/Wrapper/Wrapper.types.d.ts +1 -1
- package/dist/components/TagSelect/contexts/TagSelect.types.d.ts +1 -1
- package/dist/components/TextArea/TextArea.d.ts +2 -2
- package/dist/components/TextArea/TextArea.types.d.ts +3 -1
- package/dist/components/TimePicker/TimePicker.d.ts +2 -2
- package/dist/components/TimePicker/TimePicker.types.d.ts +3 -1
- package/dist/components/TimePicker/components/HoursList/HoursList.types.d.ts +1 -1
- package/dist/components/TimePicker/components/MeridianList/MeridianList.types.d.ts +1 -1
- package/dist/components/TimePicker/components/MinutesList/MinutesList.types.d.ts +1 -1
- package/dist/components/TimePicker/components/Wrapper/Wrapper.types.d.ts +1 -1
- package/dist/components/TimePicker/components/WrapperList/WrapperList.types.d.ts +1 -1
- package/dist/components/Toast/Toast.d.ts +2 -2
- package/dist/components/Toast/Toast.js +191 -184
- package/dist/components/Toast/Toast.types.d.ts +3 -1
- package/dist/components/Toast/Toast.variants.js +6 -12
- package/dist/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.js +20 -20
- package/dist/components/Tooltip/Tooltip.types.d.ts +3 -1
- package/dist/components/Typography/Typography.d.ts +2 -2
- package/dist/components/Typography/Typography.types.d.ts +3 -1
- package/dist/components/VirtualizedTable/VirtualizedTable.js +57 -55
- package/dist/components/VirtualizedTable/VirtualizedTable.types.d.ts +3 -1
- package/dist/components/VirtualizedTable/components/Filter/Filter.js +55 -54
- package/dist/components/VirtualizedTable/components/Filter/Filter.types.d.ts +1 -0
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.d.ts +1 -1
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +55 -26
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.types.d.ts +4 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +70 -66
- package/dist/index-BvEpLnOv.js +144 -0
- package/dist/{index-Dd_ZmIqU.js → index-C7zAY3xv.js} +1 -1
- package/dist/{index-Dfq4O3b4.js → index-CrCTywU1.js} +1 -1
- package/dist/{index-9a-FL_6D.js → index-DWyM654o.js} +41 -42
- package/dist/{index-B7-5g1Sm.js → index-mPinF0Ho.js} +407 -401
- package/dist/index.js +1 -1
- package/dist/package.json +10 -10
- package/dist/proxy-BvdTb_6B.js +4974 -0
- package/dist/styles.css +1 -1
- package/package.json +10 -10
- package/dist/index-CESXsoMn.js +0 -14
- package/dist/index-URQGEGX7.js +0 -136
- package/dist/proxy-0sbyKj-k.js +0 -4946
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { FilterEvent as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useId as L, useRef as F, useState as m, useEffect as p, useCallback as d, useMemo as v } from "react";
|
|
2
|
+
import { FilterEvent as O, sendOpenFilterEvent as k } from "../../events/index.js";
|
|
3
|
+
import { useFilterContext as x } from "../../contexts/filter.hook.js";
|
|
4
|
+
const B = ({
|
|
5
|
+
onApply: l,
|
|
6
|
+
options: a = []
|
|
5
7
|
}) => {
|
|
6
|
-
const r =
|
|
7
|
-
|
|
8
|
+
const { closeOnApply: r } = x(), c = L(), u = F(null), [g, o] = m(!1), [n, i] = m([]);
|
|
9
|
+
p(() => {
|
|
8
10
|
const e = new AbortController();
|
|
9
11
|
return document.addEventListener(
|
|
10
|
-
|
|
12
|
+
O.OPEN,
|
|
11
13
|
(t) => {
|
|
12
|
-
t.detail !==
|
|
14
|
+
t.detail !== c && o(!1);
|
|
13
15
|
},
|
|
14
16
|
{
|
|
15
17
|
signal: e.signal
|
|
16
18
|
}
|
|
17
19
|
), document.addEventListener(
|
|
18
|
-
|
|
20
|
+
O.RESET,
|
|
19
21
|
() => {
|
|
20
22
|
i([]), l?.([]);
|
|
21
23
|
},
|
|
@@ -25,43 +27,55 @@ const k = ({
|
|
|
25
27
|
), () => {
|
|
26
28
|
e.abort();
|
|
27
29
|
};
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
30
|
-
() =>
|
|
31
|
-
(t) => t.filter((
|
|
30
|
+
}, [c, l]);
|
|
31
|
+
const E = d(
|
|
32
|
+
() => o((e) => (e || (k(c), i(
|
|
33
|
+
(t) => t.filter((s) => s.isApplied)
|
|
32
34
|
)), !e)),
|
|
33
|
-
[
|
|
34
|
-
),
|
|
35
|
+
[c, o]
|
|
36
|
+
), f = d(() => o(!1), []), h = d(
|
|
35
37
|
(e, t) => {
|
|
36
38
|
i(t ? [
|
|
37
|
-
...
|
|
39
|
+
...n,
|
|
38
40
|
{ ...e, isApplied: !1 }
|
|
39
|
-
] :
|
|
41
|
+
] : n.map((s) => s.id === e.id ? { ...s, isRemoved: !0 } : s));
|
|
40
42
|
},
|
|
41
|
-
[i,
|
|
42
|
-
),
|
|
43
|
-
i([]), l?.([]);
|
|
44
|
-
}, [l]),
|
|
45
|
-
const e =
|
|
43
|
+
[i, n]
|
|
44
|
+
), R = d(() => {
|
|
45
|
+
i([]), l?.([]), r && o(!1);
|
|
46
|
+
}, [r, l]), A = d(() => {
|
|
47
|
+
const e = n?.filter((t) => !t.isRemoved).map((t) => ({ ...t, isApplied: !0 }));
|
|
46
48
|
i(e), l?.(
|
|
47
49
|
e.map(
|
|
48
|
-
({ isApplied: t, isRemoved:
|
|
50
|
+
({ isApplied: t, isRemoved: s, ...w }) => w
|
|
49
51
|
)
|
|
50
|
-
);
|
|
51
|
-
}, [l,
|
|
52
|
-
() =>
|
|
53
|
-
[
|
|
52
|
+
), r && o(!1);
|
|
53
|
+
}, [r, l, n, i]), C = v(
|
|
54
|
+
() => n.filter((e) => e.isApplied),
|
|
55
|
+
[n]
|
|
56
|
+
), S = v(
|
|
57
|
+
() => a.length > 0 && a.every(
|
|
58
|
+
(e) => n.some((t) => t.id === e.id && !t.isRemoved)
|
|
59
|
+
),
|
|
60
|
+
[a, n]
|
|
61
|
+
), b = d(
|
|
62
|
+
(e, t) => {
|
|
63
|
+
t && i(
|
|
64
|
+
e.map((s) => ({ ...s, isApplied: !1 }))
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
[]
|
|
54
68
|
);
|
|
55
|
-
return
|
|
56
|
-
const e = new AbortController(), t = (
|
|
57
|
-
|
|
69
|
+
return p(() => {
|
|
70
|
+
const e = new AbortController(), t = (s) => {
|
|
71
|
+
u.current?.contains(s.target) || f();
|
|
58
72
|
};
|
|
59
73
|
return document.addEventListener("mousedown", t, {
|
|
60
74
|
signal: e.signal
|
|
61
75
|
}), document.addEventListener(
|
|
62
76
|
"visibilitychange",
|
|
63
77
|
() => {
|
|
64
|
-
document.hidden &&
|
|
78
|
+
document.hidden && f();
|
|
65
79
|
},
|
|
66
80
|
{
|
|
67
81
|
signal: e.signal
|
|
@@ -69,17 +83,19 @@ const k = ({
|
|
|
69
83
|
), () => {
|
|
70
84
|
e.abort();
|
|
71
85
|
};
|
|
72
|
-
}, [
|
|
73
|
-
isOpen:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
}, [f, u]), {
|
|
87
|
+
isOpen: g,
|
|
88
|
+
isAllSelected: S,
|
|
89
|
+
selectedCount: C,
|
|
90
|
+
selectedOptions: n,
|
|
91
|
+
wrapperRef: u,
|
|
92
|
+
handleApplyOptions: A,
|
|
93
|
+
handleOpen: E,
|
|
94
|
+
handleResetOptions: R,
|
|
95
|
+
handleSelectAll: b,
|
|
96
|
+
handleSelectOption: h
|
|
81
97
|
};
|
|
82
98
|
};
|
|
83
99
|
export {
|
|
84
|
-
|
|
100
|
+
B as useBadgeMultiSelect
|
|
85
101
|
};
|
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Badge as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Checkbox as
|
|
5
|
-
import { filterButtonIconVariants as
|
|
1
|
+
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as c } from "../../../Badge/Badge.js";
|
|
3
|
+
import { Button as h } from "../../../Button/Button.js";
|
|
4
|
+
import { Checkbox as f } from "../../../Checkbox/Checkbox.js";
|
|
5
|
+
import { filterButtonIconVariants as B, filterButtonVariants as O } from "../../Filter.variants.js";
|
|
6
6
|
import { cn as r } from "../../../../utils/index.js";
|
|
7
|
-
import { useBadgeMultiSelect as
|
|
8
|
-
import { C as
|
|
9
|
-
const
|
|
10
|
-
options:
|
|
7
|
+
import { useBadgeMultiSelect as A } from "./BadgeMultiSelect.hook.js";
|
|
8
|
+
import { C as I } from "../../../../chevron-down-BBFYYzZq.js";
|
|
9
|
+
const q = ({
|
|
10
|
+
options: t,
|
|
11
11
|
label: p,
|
|
12
12
|
position: i = "left",
|
|
13
|
-
onApply:
|
|
13
|
+
onApply: g,
|
|
14
|
+
showSelectAll: u = !0,
|
|
15
|
+
selectAllLabel: b = "All"
|
|
14
16
|
}) => {
|
|
15
17
|
const {
|
|
16
|
-
wrapperRef:
|
|
17
|
-
isOpen:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
wrapperRef: x,
|
|
19
|
+
isOpen: d,
|
|
20
|
+
isAllSelected: s,
|
|
21
|
+
selectedOptions: v,
|
|
22
|
+
selectedCount: m,
|
|
23
|
+
handleOpen: k,
|
|
24
|
+
handleResetOptions: C,
|
|
25
|
+
handleApplyOptions: N,
|
|
26
|
+
handleSelectAll: y,
|
|
27
|
+
handleSelectOption: S
|
|
28
|
+
} = A({ onApply: g, options: t });
|
|
29
|
+
return t.length === 0 ? null : /* @__PURE__ */ a("div", { ref: x, className: "relative", children: [
|
|
30
|
+
/* @__PURE__ */ a(
|
|
27
31
|
"button",
|
|
28
32
|
{
|
|
29
|
-
className: r(
|
|
30
|
-
"text-slate-700 dark:text-metal-50":
|
|
33
|
+
className: r(O(), {
|
|
34
|
+
"text-slate-700 dark:text-metal-50": d
|
|
31
35
|
}),
|
|
32
|
-
onClick:
|
|
36
|
+
onClick: k,
|
|
33
37
|
children: [
|
|
34
38
|
p,
|
|
35
|
-
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
39
|
+
m.length > 0 && /* @__PURE__ */ l(c, { label: m.length.toString() }),
|
|
40
|
+
/* @__PURE__ */ l(
|
|
41
|
+
I,
|
|
38
42
|
{
|
|
39
|
-
className: r(
|
|
40
|
-
"rotate-180 text-blue-600 dark:text-aurora-500":
|
|
43
|
+
className: r(B(), {
|
|
44
|
+
"rotate-180 text-blue-600 dark:text-aurora-500": d
|
|
41
45
|
})
|
|
42
46
|
}
|
|
43
47
|
)
|
|
44
48
|
]
|
|
45
49
|
}
|
|
46
50
|
),
|
|
47
|
-
|
|
51
|
+
d && /* @__PURE__ */ a(
|
|
48
52
|
"div",
|
|
49
53
|
{
|
|
50
54
|
className: r(
|
|
@@ -67,24 +71,46 @@ const $ = ({
|
|
|
67
71
|
}
|
|
68
72
|
),
|
|
69
73
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return /* @__PURE__ */ t("div", { className: "flex gap-4", children: [
|
|
75
|
-
/* @__PURE__ */ e(
|
|
76
|
-
k,
|
|
74
|
+
/* @__PURE__ */ l("div", { className: "px-6 py-4", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
|
|
75
|
+
u && /* @__PURE__ */ a("div", { className: "flex gap-4", children: [
|
|
76
|
+
/* @__PURE__ */ l(
|
|
77
|
+
f,
|
|
77
78
|
{
|
|
78
79
|
defaultChecked: s,
|
|
79
|
-
|
|
80
|
-
onChange: (d) => v(a, d)
|
|
80
|
+
onChange: (e) => y(t, e)
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
`select-all-${s}`
|
|
83
83
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
] },
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
/* @__PURE__ */ l(c, { label: b })
|
|
85
|
+
] }),
|
|
86
|
+
t.map((e) => {
|
|
87
|
+
const o = !!v.find(
|
|
88
|
+
(n) => n.id === e.id
|
|
89
|
+
);
|
|
90
|
+
return /* @__PURE__ */ a("div", { className: "flex gap-4", children: [
|
|
91
|
+
/* @__PURE__ */ l(
|
|
92
|
+
f,
|
|
93
|
+
{
|
|
94
|
+
defaultChecked: o,
|
|
95
|
+
"data-label": e.id,
|
|
96
|
+
onChange: (n) => S(e, n)
|
|
97
|
+
},
|
|
98
|
+
`${e.id}-${o}`
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ l(
|
|
101
|
+
c,
|
|
102
|
+
{
|
|
103
|
+
label: e.label,
|
|
104
|
+
variant: e.variant,
|
|
105
|
+
leftIcon: e.leftIcon,
|
|
106
|
+
rightIcon: e.rightIcon,
|
|
107
|
+
loading: e.loading
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] }, e.id);
|
|
111
|
+
})
|
|
112
|
+
] }) }),
|
|
113
|
+
/* @__PURE__ */ a(
|
|
88
114
|
"div",
|
|
89
115
|
{
|
|
90
116
|
className: r(
|
|
@@ -99,16 +125,16 @@ const $ = ({
|
|
|
99
125
|
"dark:border-metal-700"
|
|
100
126
|
),
|
|
101
127
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
|
|
128
|
+
/* @__PURE__ */ l(
|
|
129
|
+
h,
|
|
104
130
|
{
|
|
105
131
|
variant: "secondary",
|
|
106
132
|
appearance: "compact",
|
|
107
|
-
onClick:
|
|
133
|
+
onClick: C,
|
|
108
134
|
children: "Reset"
|
|
109
135
|
}
|
|
110
136
|
),
|
|
111
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ l(h, { appearance: "compact", onClick: N, children: "Apply" })
|
|
112
138
|
]
|
|
113
139
|
}
|
|
114
140
|
)
|
|
@@ -118,5 +144,5 @@ const $ = ({
|
|
|
118
144
|
] });
|
|
119
145
|
};
|
|
120
146
|
export {
|
|
121
|
-
|
|
147
|
+
q as BadgeMultiSelect
|
|
122
148
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { sendOpenFilterEvent as
|
|
3
|
-
import { getLocale as
|
|
4
|
-
|
|
1
|
+
import { useRef as C, useId as S, useState as f, useMemo as y, useCallback as r, useEffect as E } from "react";
|
|
2
|
+
import { sendOpenFilterEvent as F, FilterEvent as v } from "../../events/index.js";
|
|
3
|
+
import { getLocale as R } from "../../utils/index.js";
|
|
4
|
+
import { useFilterContext as k } from "../../contexts/filter.hook.js";
|
|
5
|
+
const A = ({
|
|
5
6
|
onApply: n,
|
|
6
|
-
countryCode:
|
|
7
|
+
countryCode: g = "US"
|
|
7
8
|
}) => {
|
|
8
|
-
const i =
|
|
9
|
-
() =>
|
|
9
|
+
const { closeOnApply: a } = k(), i = C(null), t = S(), [h, o] = f(!1), [l, c] = f(), [p, d] = f(), D = y(
|
|
10
|
+
() => p?.toLocaleDateString(R(g), {
|
|
10
11
|
day: "numeric",
|
|
11
12
|
month: "short",
|
|
12
13
|
year: "numeric"
|
|
13
14
|
}),
|
|
14
|
-
[
|
|
15
|
-
),
|
|
16
|
-
() =>
|
|
15
|
+
[p, g]
|
|
16
|
+
), b = r(
|
|
17
|
+
() => o((e) => (e || F(t), !e)),
|
|
17
18
|
[t]
|
|
18
|
-
),
|
|
19
|
-
|
|
20
|
-
}, [n,
|
|
21
|
-
|
|
22
|
-
}, [n]);
|
|
23
|
-
return
|
|
19
|
+
), O = r(() => {
|
|
20
|
+
d(l), n?.(l), a && o(!1);
|
|
21
|
+
}, [a, n, l]), L = r((e) => c(e), []), u = r(() => o(!1), []), w = r(() => {
|
|
22
|
+
c(void 0), d(void 0), n?.(), a && o(!1);
|
|
23
|
+
}, [a, n]);
|
|
24
|
+
return E(() => {
|
|
24
25
|
const e = new AbortController();
|
|
25
26
|
return document.addEventListener(
|
|
26
|
-
|
|
27
|
-
((
|
|
28
|
-
|
|
27
|
+
v.OPEN,
|
|
28
|
+
((s) => {
|
|
29
|
+
s.detail !== t && o(!1);
|
|
29
30
|
}),
|
|
30
31
|
{
|
|
31
32
|
signal: e.signal
|
|
@@ -33,20 +34,20 @@ const N = ({
|
|
|
33
34
|
), () => {
|
|
34
35
|
e.abort();
|
|
35
36
|
};
|
|
36
|
-
}, [t]),
|
|
37
|
+
}, [t]), E(() => {
|
|
37
38
|
const e = new AbortController();
|
|
38
39
|
return document.addEventListener(
|
|
39
|
-
|
|
40
|
-
(
|
|
41
|
-
|
|
40
|
+
v.OPEN,
|
|
41
|
+
(s) => {
|
|
42
|
+
s.detail !== t && o(!1);
|
|
42
43
|
},
|
|
43
44
|
{
|
|
44
45
|
signal: e.signal
|
|
45
46
|
}
|
|
46
47
|
), document.addEventListener(
|
|
47
|
-
|
|
48
|
+
v.RESET,
|
|
48
49
|
() => {
|
|
49
|
-
|
|
50
|
+
c(void 0), d(void 0), n?.();
|
|
50
51
|
},
|
|
51
52
|
{
|
|
52
53
|
signal: e.signal
|
|
@@ -54,16 +55,16 @@ const N = ({
|
|
|
54
55
|
), () => {
|
|
55
56
|
e.abort();
|
|
56
57
|
};
|
|
57
|
-
}, [t, n]),
|
|
58
|
-
const e = new AbortController(),
|
|
59
|
-
i.current?.contains(
|
|
58
|
+
}, [t, n]), E(() => {
|
|
59
|
+
const e = new AbortController(), s = (m) => {
|
|
60
|
+
i.current?.contains(m.target) || u();
|
|
60
61
|
};
|
|
61
|
-
return document.addEventListener("mousedown",
|
|
62
|
+
return document.addEventListener("mousedown", s, {
|
|
62
63
|
signal: e.signal
|
|
63
64
|
}), document.addEventListener(
|
|
64
65
|
"visibilitychange",
|
|
65
66
|
() => {
|
|
66
|
-
document.hidden &&
|
|
67
|
+
document.hidden && u();
|
|
67
68
|
},
|
|
68
69
|
{
|
|
69
70
|
signal: e.signal
|
|
@@ -71,18 +72,18 @@ const N = ({
|
|
|
71
72
|
), () => {
|
|
72
73
|
e.abort();
|
|
73
74
|
};
|
|
74
|
-
}, [
|
|
75
|
+
}, [u, i]), {
|
|
75
76
|
id: t,
|
|
76
|
-
appliedDay:
|
|
77
|
+
appliedDay: D,
|
|
77
78
|
isOpen: h,
|
|
78
|
-
selectedDay:
|
|
79
|
+
selectedDay: l,
|
|
79
80
|
wrapperRef: i,
|
|
80
|
-
handleApply:
|
|
81
|
-
handleOpen:
|
|
81
|
+
handleApply: O,
|
|
82
|
+
handleOpen: b,
|
|
82
83
|
handleSelect: L,
|
|
83
|
-
handleReset:
|
|
84
|
+
handleReset: w
|
|
84
85
|
};
|
|
85
86
|
};
|
|
86
87
|
export {
|
|
87
|
-
|
|
88
|
+
A as useDateFilterDropdown
|
|
88
89
|
};
|
package/dist/components/Filter/components/DateRangeFilterDropdown/DateRangeFilterDropdown.hook.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { sendOpenFilterEvent as
|
|
3
|
-
import { getLocale as
|
|
4
|
-
|
|
1
|
+
import { useRef as F, useId as S, useState as u, useMemo as D, useCallback as a, useEffect as p } from "react";
|
|
2
|
+
import { sendOpenFilterEvent as k, FilterEvent as v } from "../../events/index.js";
|
|
3
|
+
import { getLocale as x } from "../../utils/index.js";
|
|
4
|
+
import { useFilterContext as I } from "../../contexts/filter.hook.js";
|
|
5
|
+
const P = ({
|
|
5
6
|
defaultRange: h,
|
|
6
7
|
onApply: t,
|
|
7
8
|
countryCode: E = "US"
|
|
8
9
|
}) => {
|
|
9
|
-
const d =
|
|
10
|
+
const { closeOnApply: i } = I(), d = F(null), o = S(), [R, s] = u(!1), [l, c] = u(
|
|
10
11
|
h
|
|
11
|
-
), [n,
|
|
12
|
+
), [n, f] = u(), C = D(() => {
|
|
12
13
|
if (!n?.from) return;
|
|
13
|
-
const e = (r) => r.toLocaleDateString(
|
|
14
|
+
const e = (r) => r.toLocaleDateString(x(E), {
|
|
14
15
|
day: "numeric",
|
|
15
16
|
month: "short"
|
|
16
17
|
});
|
|
17
18
|
return n.to ? `${e(n.from)} - ${e(n.to)}` : e(n.from);
|
|
18
|
-
}, [n]),
|
|
19
|
-
() =>
|
|
19
|
+
}, [n]), O = a(
|
|
20
|
+
() => s((e) => (e || k(o), !e)),
|
|
20
21
|
[o]
|
|
21
|
-
),
|
|
22
|
+
), b = a(() => {
|
|
22
23
|
const e = {
|
|
23
|
-
from:
|
|
24
|
-
to:
|
|
24
|
+
from: l?.from,
|
|
25
|
+
to: l?.to
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
}, [t,
|
|
28
|
-
|
|
29
|
-
}, []), m =
|
|
30
|
-
|
|
31
|
-
}, [t]);
|
|
32
|
-
return
|
|
27
|
+
f(e), t?.(e), i && s(!1);
|
|
28
|
+
}, [i, t, l]), L = a((e) => {
|
|
29
|
+
c({ from: e.from, to: e.to });
|
|
30
|
+
}, []), m = a(() => s(!1), []), w = a(() => {
|
|
31
|
+
c(void 0), f(void 0), t?.(), i && s(!1);
|
|
32
|
+
}, [i, t]);
|
|
33
|
+
return p(() => {
|
|
33
34
|
const e = new AbortController();
|
|
34
35
|
return document.addEventListener(
|
|
35
36
|
v.OPEN,
|
|
36
37
|
(r) => {
|
|
37
|
-
r.detail !== o &&
|
|
38
|
+
r.detail !== o && s(!1);
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
signal: e.signal
|
|
@@ -42,7 +43,7 @@ const x = ({
|
|
|
42
43
|
), document.addEventListener(
|
|
43
44
|
v.RESET,
|
|
44
45
|
() => {
|
|
45
|
-
|
|
46
|
+
c(void 0), f(void 0), t?.();
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
signal: e.signal
|
|
@@ -50,9 +51,9 @@ const x = ({
|
|
|
50
51
|
), () => {
|
|
51
52
|
e.abort();
|
|
52
53
|
};
|
|
53
|
-
}, [o, t]),
|
|
54
|
-
const e = new AbortController(), r = (
|
|
55
|
-
d.current?.contains(
|
|
54
|
+
}, [o, t]), p(() => {
|
|
55
|
+
const e = new AbortController(), r = (g) => {
|
|
56
|
+
d.current?.contains(g.target) || m();
|
|
56
57
|
};
|
|
57
58
|
return document.addEventListener("mousedown", r, {
|
|
58
59
|
signal: e.signal
|
|
@@ -69,16 +70,16 @@ const x = ({
|
|
|
69
70
|
};
|
|
70
71
|
}, [m, d]), {
|
|
71
72
|
id: o,
|
|
72
|
-
appliedRange:
|
|
73
|
+
appliedRange: C,
|
|
73
74
|
isOpen: R,
|
|
74
|
-
selectedRange:
|
|
75
|
+
selectedRange: l,
|
|
75
76
|
wrapperRef: d,
|
|
76
|
-
handleApply:
|
|
77
|
-
handleOpen:
|
|
77
|
+
handleApply: b,
|
|
78
|
+
handleOpen: O,
|
|
78
79
|
handleRangeChange: L,
|
|
79
|
-
handleReset:
|
|
80
|
+
handleReset: w
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
83
|
export {
|
|
83
|
-
|
|
84
|
+
P as useDateRangeFilterDropdown
|
|
84
85
|
};
|