@konstructio/ui 0.1.2-alpha.70 → 0.1.2-alpha.72
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-BGcucTHv.js → Modal-CXRo8f-h.js} +1 -1
- package/dist/assets/icons/components/CheckCircleFilled.d.ts +3 -0
- package/dist/assets/icons/components/CheckCircleFilled.js +31 -0
- package/dist/assets/icons/components/CheckCircleOutline.d.ts +3 -0
- package/dist/assets/icons/components/{CheckCircle.js → CheckCircleOutline.js} +8 -8
- package/dist/assets/icons/components/CheckboxMarkedCircleOutline.d.ts +3 -0
- package/dist/assets/icons/components/CheckboxMarkedCircleOutline.js +26 -0
- package/dist/assets/icons/components/InfoCircle.d.ts +3 -0
- package/dist/assets/icons/components/InfoCircle.js +31 -0
- package/dist/assets/icons/components/WarningTriangle.d.ts +3 -0
- package/dist/assets/icons/components/WarningTriangle.js +28 -0
- package/dist/assets/icons/components/index.d.ts +5 -1
- package/dist/assets/icons/components/index.js +124 -116
- package/dist/assets/icons/index.js +124 -116
- package/dist/components/Alert/Alert.d.ts +5 -16
- package/dist/components/Alert/Alert.js +46 -32
- package/dist/components/Alert/Alert.types.d.ts +8 -8
- package/dist/components/Alert/Alert.variants.d.ts +11 -2
- package/dist/components/Alert/Alert.variants.js +77 -32
- package/dist/components/Badge/Badge.variants.d.ts +2 -2
- package/dist/components/Button/Button.variants.d.ts +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +1 -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/DateRangePicker/components/DateTimeInputs/hooks/useDateTimeInputs.d.ts +1 -1
- package/dist/components/Filter/Filter.d.ts +2 -2
- package/dist/components/Filter/Filter.js +20 -14
- package/dist/components/Filter/Filter.types.d.ts +3 -1
- package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.d.ts +3 -0
- package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.js +122 -0
- package/dist/components/Filter/components/TextMultiSelect/TextMultiSelect.types.d.ts +7 -0
- package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.d.ts +3 -0
- package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.hook.d.ts +14 -0
- package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.hook.js +74 -0
- package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.js +155 -0
- package/dist/components/Filter/components/TimeFilterDropdown/TimeFilterDropdown.types.d.ts +13 -0
- package/dist/components/Filter/components/index.d.ts +4 -0
- package/dist/components/Filter/components/index.js +8 -4
- package/dist/components/LineChart/LineChart.d.ts +17 -0
- package/dist/components/LineChart/LineChart.js +154 -0
- package/dist/components/LineChart/LineChart.types.d.ts +54 -0
- 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/PhoneNumberInput/components/TruncateText/TruncateText.js +1 -1
- package/dist/components/PieChart/PieChart.js +51 -5095
- package/dist/components/ProgressBar/ProgressBar.variants.d.ts +1 -1
- package/dist/components/RadioCardGroup/RadioCardGroup.variants.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.variants.d.ts +1 -1
- package/dist/components/Tabs/Tabs.variants.d.ts +1 -1
- package/dist/components/Toast/Toast.variants.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +4 -9
- package/dist/components/Tooltip/Tooltip.js +35 -33
- package/dist/components/Tooltip/Tooltip.types.d.ts +22 -11
- package/dist/components/Typography/Typography.variants.d.ts +1 -1
- package/dist/components/VirtualizedTable/VirtualizedTable.js +61 -59
- package/dist/components/VirtualizedTable/VirtualizedTable.types.d.ts +93 -8
- package/dist/components/VirtualizedTable/components/Filter/Filter.js +153 -71
- package/dist/components/VirtualizedTable/components/Filter/Filter.types.d.ts +7 -8
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +1 -1
- package/dist/components/VirtualizedTable/contexts/table.context.d.ts +12 -0
- package/dist/components/VirtualizedTable/contexts/table.context.js +9 -0
- package/dist/components/VirtualizedTable/contexts/table.provider.js +198 -162
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +124 -118
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +124 -116
- package/dist/{index-DPcwqB8q.js → index-B7-5g1Sm.js} +169 -168
- package/dist/index-qDQP8rW4.js +7281 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +142 -135
- package/dist/package.json +8 -8
- package/dist/{proxy-CngVm5qA.js → proxy-0sbyKj-k.js} +732 -728
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +16 -15
- package/package.json +8 -8
- package/dist/assets/icons/components/CheckCircle.d.ts +0 -3
- package/dist/components/Tooltip/Tooltip.variants.d.ts +0 -6
- package/dist/components/Tooltip/Tooltip.variants.js +0 -86
- package/dist/components/Tooltip/hooks/useTooltip.d.ts +0 -4
- package/dist/components/Tooltip/hooks/useTooltip.js +0 -24
|
@@ -6,7 +6,7 @@ import { CalendarDivider as F } from "../CalendarDivider/CalendarDivider.js";
|
|
|
6
6
|
import { CalendarMonth as G } from "../CalendarMonth/CalendarMonth.js";
|
|
7
7
|
import { NavigationButton as m } from "../NavigationButton/NavigationButton.js";
|
|
8
8
|
import { useTogetherCarousel as H } from "../../hooks/useTogetherCarousel.js";
|
|
9
|
-
import { m as R } from "../../../../../../proxy-
|
|
9
|
+
import { m as R } from "../../../../../../proxy-0sbyKj-k.js";
|
|
10
10
|
const S = ({
|
|
11
11
|
className: s,
|
|
12
12
|
calendarWidth: h = 550,
|
package/dist/components/DateRangePicker/components/DateTimeInputs/hooks/useDateTimeInputs.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type UseDateTimeInputsProps = {
|
|
|
6
6
|
errorEndBeforeStart: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const useDateTimeInputs: ({ errorInvalidDate, errorDateNotAvailable, errorStartAfterEnd, errorEndBeforeStart, }: UseDateTimeInputsProps) => {
|
|
9
|
-
timeFormat: "
|
|
9
|
+
timeFormat: "24" | "12";
|
|
10
10
|
showTime: boolean;
|
|
11
11
|
name: string | undefined;
|
|
12
12
|
disabled: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilterComponentProps } from './Filter.types';
|
|
2
|
-
import { BadgeMultiSelect, DateFilterDropdown, DateRangeFilterDropdown } from './components';
|
|
2
|
+
import { BadgeMultiSelect, DateFilterDropdown, DateRangeFilterDropdown, TextMultiSelect, TimeFilterDropdown } from './components';
|
|
3
3
|
/**
|
|
4
4
|
* A compound component for building filter interfaces.
|
|
5
5
|
* Includes sub-components for badge multi-select, date filtering, and reset actions.
|
|
@@ -23,4 +23,4 @@ import { BadgeMultiSelect, DateFilterDropdown, DateRangeFilterDropdown } from '.
|
|
|
23
23
|
* @see {@link https://konstructio.github.io/konstruct-ui/?path=/docs/components-filter--docs Storybook}
|
|
24
24
|
*/
|
|
25
25
|
declare const Filter: FilterComponentProps;
|
|
26
|
-
export { Filter, BadgeMultiSelect, DateFilterDropdown, DateRangeFilterDropdown, };
|
|
26
|
+
export { Filter, BadgeMultiSelect, TextMultiSelect, DateFilterDropdown, DateRangeFilterDropdown, TimeFilterDropdown, };
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { cn as m } from "../../utils/index.js";
|
|
3
|
-
import { filterVariants as
|
|
4
|
-
import { BadgeMultiSelect as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { filterVariants as l } from "./Filter.variants.js";
|
|
4
|
+
import { BadgeMultiSelect as p } from "./components/BadgeDropdown/BadgeMultiSelect.js";
|
|
5
|
+
import { TextMultiSelect as a } from "./components/TextMultiSelect/TextMultiSelect.js";
|
|
6
|
+
import { DateFilterDropdown as n } from "./components/DateFilterDropdown/DateFilterDropdown.js";
|
|
7
|
+
import { DateRangeFilterDropdown as d } from "./components/DateRangeFilterDropdown/DateRangeFilterDropdown.js";
|
|
8
|
+
import { TimeFilterDropdown as f } from "./components/TimeFilterDropdown/TimeFilterDropdown.js";
|
|
9
|
+
import { ResetButton as D } from "./components/ResetButton/ResetButton.js";
|
|
8
10
|
const t = ({
|
|
9
11
|
className: e,
|
|
10
12
|
theme: o = "civo",
|
|
11
13
|
children: r
|
|
12
|
-
}) => /* @__PURE__ */ i("div", { className: m(
|
|
14
|
+
}) => /* @__PURE__ */ i("div", { className: m(l({ className: e })), "data-theme": o, children: r });
|
|
13
15
|
t.displayName = "KonstructFilter";
|
|
14
|
-
t.BadgeMultiSelect =
|
|
15
|
-
t.
|
|
16
|
-
t.
|
|
17
|
-
t.
|
|
16
|
+
t.BadgeMultiSelect = p;
|
|
17
|
+
t.TextMultiSelect = a;
|
|
18
|
+
t.DateFilterDropdown = n;
|
|
19
|
+
t.DateRangeFilterDropdown = d;
|
|
20
|
+
t.TimeFilterDropdown = f;
|
|
21
|
+
t.ResetButton = D;
|
|
18
22
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
t as Filter
|
|
23
|
+
p as BadgeMultiSelect,
|
|
24
|
+
n as DateFilterDropdown,
|
|
25
|
+
d as DateRangeFilterDropdown,
|
|
26
|
+
t as Filter,
|
|
27
|
+
a as TextMultiSelect,
|
|
28
|
+
f as TimeFilterDropdown
|
|
23
29
|
};
|
|
@@ -3,7 +3,7 @@ import { FC, PropsWithChildren } from 'react';
|
|
|
3
3
|
import { Theme } from '../../domain/theme';
|
|
4
4
|
import { BadgeProps } from '../Badge/Badge.types';
|
|
5
5
|
import { filterVariants } from './Filter.variants';
|
|
6
|
-
import { BadgeMultiSelectProps, DateFilterDropdownProps, DateRangeFilterDropdownProps, ResetButtonProps } from './components';
|
|
6
|
+
import { BadgeMultiSelectProps, DateFilterDropdownProps, DateRangeFilterDropdownProps, ResetButtonProps, TextMultiSelectProps, TimeFilterDropdownProps } from './components';
|
|
7
7
|
/**
|
|
8
8
|
* Configuration for a filter option.
|
|
9
9
|
*/
|
|
@@ -47,7 +47,9 @@ export type FilterProps = VariantProps<typeof filterVariants> & PropsWithChildre
|
|
|
47
47
|
*/
|
|
48
48
|
export type FilterComponentProps = FC<FilterProps> & {
|
|
49
49
|
BadgeMultiSelect: FC<BadgeMultiSelectProps>;
|
|
50
|
+
TextMultiSelect: FC<TextMultiSelectProps>;
|
|
50
51
|
DateFilterDropdown: FC<DateFilterDropdownProps>;
|
|
51
52
|
DateRangeFilterDropdown: FC<DateRangeFilterDropdownProps>;
|
|
53
|
+
TimeFilterDropdown: FC<TimeFilterDropdownProps>;
|
|
52
54
|
ResetButton: FC<ResetButtonProps>;
|
|
53
55
|
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as k } from "../../../Badge/Badge.js";
|
|
3
|
+
import { Button as o } from "../../../Button/Button.js";
|
|
4
|
+
import { Checkbox as v } from "../../../Checkbox/Checkbox.js";
|
|
5
|
+
import { filterButtonIconVariants as C, filterButtonVariants as N } from "../../Filter.variants.js";
|
|
6
|
+
import { cn as r } from "../../../../utils/index.js";
|
|
7
|
+
import { useBadgeMultiSelect as y } from "../BadgeDropdown/BadgeMultiSelect.hook.js";
|
|
8
|
+
import { C as w } from "../../../../chevron-down-BBFYYzZq.js";
|
|
9
|
+
const $ = ({
|
|
10
|
+
options: n,
|
|
11
|
+
label: m,
|
|
12
|
+
position: i = "left",
|
|
13
|
+
onApply: p
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
wrapperRef: h,
|
|
17
|
+
isOpen: l,
|
|
18
|
+
selectedOptions: f,
|
|
19
|
+
selectedCount: c,
|
|
20
|
+
handleOpen: u,
|
|
21
|
+
handleResetOptions: x,
|
|
22
|
+
handleApplyOptions: g,
|
|
23
|
+
handleSelectOption: b
|
|
24
|
+
} = y({ onApply: p });
|
|
25
|
+
return n.length === 0 ? null : /* @__PURE__ */ a("div", { ref: h, className: "relative", children: [
|
|
26
|
+
/* @__PURE__ */ a(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
className: r(N(), {
|
|
30
|
+
"text-slate-700 dark:text-metal-50": l
|
|
31
|
+
}),
|
|
32
|
+
onClick: u,
|
|
33
|
+
children: [
|
|
34
|
+
m,
|
|
35
|
+
c.length > 0 && /* @__PURE__ */ e(k, { label: c.length.toString() }),
|
|
36
|
+
/* @__PURE__ */ e(
|
|
37
|
+
w,
|
|
38
|
+
{
|
|
39
|
+
className: r(C(), {
|
|
40
|
+
"rotate-180 text-blue-600 dark:text-aurora-500": l
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
l && /* @__PURE__ */ a(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: r(
|
|
51
|
+
"absolute",
|
|
52
|
+
"top-full",
|
|
53
|
+
"mt-1",
|
|
54
|
+
"bg-white",
|
|
55
|
+
"rounded-md",
|
|
56
|
+
"shadow-md",
|
|
57
|
+
"animate-in",
|
|
58
|
+
"fade-in-0",
|
|
59
|
+
"z-10",
|
|
60
|
+
"border",
|
|
61
|
+
"border-gray-200",
|
|
62
|
+
"dark:bg-metal-800",
|
|
63
|
+
"dark:border-metal-700",
|
|
64
|
+
{
|
|
65
|
+
"left-0": i === "left",
|
|
66
|
+
"right-0": i === "right"
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ e("div", { className: "px-6 py-4", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: n.map((t) => {
|
|
71
|
+
const s = !!f.find(
|
|
72
|
+
(d) => d.id === t.id
|
|
73
|
+
);
|
|
74
|
+
return /* @__PURE__ */ a("div", { className: "flex gap-4", children: [
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
|
+
v,
|
|
77
|
+
{
|
|
78
|
+
defaultChecked: s,
|
|
79
|
+
"data-label": t.id,
|
|
80
|
+
onChange: (d) => b(t, d)
|
|
81
|
+
},
|
|
82
|
+
`${t.id}-${s}`
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-slate-700 dark:text-metal-200 whitespace-nowrap", children: t.label })
|
|
85
|
+
] }, t.id);
|
|
86
|
+
}) }) }),
|
|
87
|
+
/* @__PURE__ */ a(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: r(
|
|
91
|
+
"flex",
|
|
92
|
+
"justify-center",
|
|
93
|
+
"items-center",
|
|
94
|
+
"gap-4",
|
|
95
|
+
"px-6",
|
|
96
|
+
"py-4",
|
|
97
|
+
"border-t",
|
|
98
|
+
"border-gray-200",
|
|
99
|
+
"dark:border-metal-700"
|
|
100
|
+
),
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ e(
|
|
103
|
+
o,
|
|
104
|
+
{
|
|
105
|
+
variant: "secondary",
|
|
106
|
+
appearance: "compact",
|
|
107
|
+
onClick: x,
|
|
108
|
+
children: "Reset"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ e(o, { appearance: "compact", onClick: g, children: "Apply" })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
$ as TextMultiSelect
|
|
122
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TimeFilterDropdownProps, TimePreset } from './TimeFilterDropdown.types';
|
|
2
|
+
export declare const useTimeFilterDropdown: ({ onApply, format, }: Pick<TimeFilterDropdownProps, "onApply" | "format">) => {
|
|
3
|
+
id: string;
|
|
4
|
+
appliedLabel: string | undefined;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
selectedTime: Date | undefined;
|
|
7
|
+
selectedPresetLabel: string | undefined;
|
|
8
|
+
wrapperRef: import('react').RefObject<HTMLDivElement | null>;
|
|
9
|
+
handleApply: () => void;
|
|
10
|
+
handleOpen: () => void;
|
|
11
|
+
handleSelectPreset: (preset: TimePreset) => void;
|
|
12
|
+
handleSelectCustom: (time: Date) => void;
|
|
13
|
+
handleReset: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useRef as R, useId as k, useState as o, useCallback as n, useEffect as g } from "react";
|
|
2
|
+
import { getFormattedTime as I } from "../../../TimePicker/utils/index.js";
|
|
3
|
+
import { sendOpenFilterEvent as x, FilterEvent as p } from "../../events/index.js";
|
|
4
|
+
const q = ({
|
|
5
|
+
onApply: t,
|
|
6
|
+
format: h = "24"
|
|
7
|
+
}) => {
|
|
8
|
+
const r = R(null), s = k(), [L, a] = o(!1), [i, l] = o(), [b, c] = o(), [u, d] = o(), [T, m] = o(), C = T ?? (b ? I(b, h) : void 0), O = n(
|
|
9
|
+
() => a((e) => (e || x(s), !e)),
|
|
10
|
+
[s]
|
|
11
|
+
), P = n((e) => {
|
|
12
|
+
l(e.value), d(e.label);
|
|
13
|
+
}, []), S = n((e) => {
|
|
14
|
+
l(e), d(void 0);
|
|
15
|
+
}, []), w = n(() => {
|
|
16
|
+
c(i), m(u), t?.(i);
|
|
17
|
+
}, [t, i, u]), v = n(() => a(!1), []), F = n(() => {
|
|
18
|
+
l(void 0), c(void 0), d(void 0), m(void 0), t?.();
|
|
19
|
+
}, [t]);
|
|
20
|
+
return g(() => {
|
|
21
|
+
const e = new AbortController();
|
|
22
|
+
return document.addEventListener(
|
|
23
|
+
p.OPEN,
|
|
24
|
+
(f) => {
|
|
25
|
+
f.detail !== s && a(!1);
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
signal: e.signal
|
|
29
|
+
}
|
|
30
|
+
), document.addEventListener(
|
|
31
|
+
p.RESET,
|
|
32
|
+
() => {
|
|
33
|
+
l(void 0), c(void 0), d(void 0), m(void 0), t?.();
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
signal: e.signal
|
|
37
|
+
}
|
|
38
|
+
), () => {
|
|
39
|
+
e.abort();
|
|
40
|
+
};
|
|
41
|
+
}, [s, t]), g(() => {
|
|
42
|
+
const e = new AbortController(), f = (E) => {
|
|
43
|
+
r.current?.contains(E.target) || v();
|
|
44
|
+
};
|
|
45
|
+
return document.addEventListener("mousedown", f, {
|
|
46
|
+
signal: e.signal
|
|
47
|
+
}), document.addEventListener(
|
|
48
|
+
"visibilitychange",
|
|
49
|
+
() => {
|
|
50
|
+
document.hidden && v();
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
signal: e.signal
|
|
54
|
+
}
|
|
55
|
+
), () => {
|
|
56
|
+
e.abort();
|
|
57
|
+
};
|
|
58
|
+
}, [v, r]), {
|
|
59
|
+
id: s,
|
|
60
|
+
appliedLabel: C,
|
|
61
|
+
isOpen: L,
|
|
62
|
+
selectedTime: i,
|
|
63
|
+
selectedPresetLabel: u,
|
|
64
|
+
wrapperRef: r,
|
|
65
|
+
handleApply: w,
|
|
66
|
+
handleOpen: O,
|
|
67
|
+
handleSelectPreset: P,
|
|
68
|
+
handleSelectCustom: S,
|
|
69
|
+
handleReset: F
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
q as useTimeFilterDropdown
|
|
74
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as N } from "../../../Badge/Badge.js";
|
|
3
|
+
import { Button as p } from "../../../Button/Button.js";
|
|
4
|
+
import { filterButtonIconVariants as w, filterButtonVariants as C } from "../../Filter.variants.js";
|
|
5
|
+
import { TimePicker as B } from "../../../TimePicker/TimePicker.js";
|
|
6
|
+
import { cn as a } from "../../../../utils/index.js";
|
|
7
|
+
import { useTimeFilterDropdown as j } from "./TimeFilterDropdown.hook.js";
|
|
8
|
+
import { C as D } from "../../../../chevron-down-BBFYYzZq.js";
|
|
9
|
+
const V = ({
|
|
10
|
+
label: b,
|
|
11
|
+
position: o = "left",
|
|
12
|
+
format: r = "24",
|
|
13
|
+
presets: n,
|
|
14
|
+
showTimePicker: d = !0,
|
|
15
|
+
onApply: h
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
appliedLabel: c,
|
|
19
|
+
isOpen: i,
|
|
20
|
+
selectedTime: x,
|
|
21
|
+
selectedPresetLabel: m,
|
|
22
|
+
wrapperRef: g,
|
|
23
|
+
handleApply: f,
|
|
24
|
+
handleOpen: u,
|
|
25
|
+
handleSelectPreset: y,
|
|
26
|
+
handleSelectCustom: k,
|
|
27
|
+
handleReset: v
|
|
28
|
+
} = j({ onApply: h, format: r }), s = n && n.length > 0;
|
|
29
|
+
return /* @__PURE__ */ l("div", { ref: g, className: "relative", children: [
|
|
30
|
+
/* @__PURE__ */ l(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
className: a(C(), {
|
|
34
|
+
"text-slate-700 dark:text-metal-100": i
|
|
35
|
+
}),
|
|
36
|
+
onClick: u,
|
|
37
|
+
children: [
|
|
38
|
+
b,
|
|
39
|
+
c && /* @__PURE__ */ e(N, { label: c }),
|
|
40
|
+
/* @__PURE__ */ e(
|
|
41
|
+
D,
|
|
42
|
+
{
|
|
43
|
+
className: a(w(), {
|
|
44
|
+
"rotate-180 text-blue-600 dark:text-aurora-500": i
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
i && /* @__PURE__ */ l(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: a(
|
|
55
|
+
"absolute",
|
|
56
|
+
"top-full",
|
|
57
|
+
"mt-1",
|
|
58
|
+
"bg-white",
|
|
59
|
+
"rounded-md",
|
|
60
|
+
"shadow-md",
|
|
61
|
+
"animate-in",
|
|
62
|
+
"fade-in-0",
|
|
63
|
+
"z-10",
|
|
64
|
+
"border",
|
|
65
|
+
"border-gray-200",
|
|
66
|
+
"flex",
|
|
67
|
+
"flex-col",
|
|
68
|
+
"dark:bg-metal-800",
|
|
69
|
+
"dark:border-metal-700",
|
|
70
|
+
{
|
|
71
|
+
"left-0": o === "left",
|
|
72
|
+
"right-0": o === "right"
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ l("div", { className: "flex", children: [
|
|
77
|
+
s && /* @__PURE__ */ e("div", { className: "flex flex-col gap-1 py-4 px-4 min-w-40", children: n.map((t) => /* @__PURE__ */ e(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
className: a(
|
|
82
|
+
"text-left",
|
|
83
|
+
"px-3",
|
|
84
|
+
"py-1.5",
|
|
85
|
+
"rounded",
|
|
86
|
+
"cursor-pointer",
|
|
87
|
+
"text-sm",
|
|
88
|
+
"whitespace-nowrap",
|
|
89
|
+
"transition-colors",
|
|
90
|
+
"hover:bg-gray-100",
|
|
91
|
+
"dark:hover:bg-metal-700",
|
|
92
|
+
{
|
|
93
|
+
"bg-blue-50 text-blue-600 dark:bg-metal-700 dark:text-aurora-500": m === t.label,
|
|
94
|
+
"text-gray-700 dark:text-gray-300": m !== t.label
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
onClick: () => y(t),
|
|
98
|
+
children: t.label
|
|
99
|
+
},
|
|
100
|
+
t.label
|
|
101
|
+
)) }),
|
|
102
|
+
s && d && /* @__PURE__ */ e("div", { className: "w-px bg-gray-200 dark:bg-metal-700" }),
|
|
103
|
+
d && /* @__PURE__ */ e("div", { className: "py-4 px-6", children: /* @__PURE__ */ e(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: a({
|
|
107
|
+
"w-35.5": r === "24",
|
|
108
|
+
"w-52": r === "12"
|
|
109
|
+
}),
|
|
110
|
+
children: /* @__PURE__ */ e(
|
|
111
|
+
B,
|
|
112
|
+
{
|
|
113
|
+
format: r,
|
|
114
|
+
time: x,
|
|
115
|
+
onChange: k,
|
|
116
|
+
mode: "input"
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
) })
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ e("div", { className: "h-px bg-gray-200 dark:bg-metal-700" }),
|
|
123
|
+
/* @__PURE__ */ l(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
className: a(
|
|
127
|
+
"flex",
|
|
128
|
+
"justify-end",
|
|
129
|
+
"items-center",
|
|
130
|
+
"gap-4",
|
|
131
|
+
"px-6",
|
|
132
|
+
"py-3"
|
|
133
|
+
),
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ e(
|
|
136
|
+
p,
|
|
137
|
+
{
|
|
138
|
+
variant: "secondary",
|
|
139
|
+
appearance: "compact",
|
|
140
|
+
onClick: v,
|
|
141
|
+
children: "Reset"
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ e(p, { appearance: "compact", onClick: f, children: "Apply" })
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] });
|
|
152
|
+
};
|
|
153
|
+
export {
|
|
154
|
+
V as TimeFilterDropdown
|
|
155
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type TimePreset = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: Date;
|
|
4
|
+
};
|
|
5
|
+
export type TimeFilterDropdownProps = {
|
|
6
|
+
label: string;
|
|
7
|
+
position?: 'left' | 'right';
|
|
8
|
+
format?: '12' | '24';
|
|
9
|
+
presets?: TimePreset[];
|
|
10
|
+
/** Whether to show the TimePicker for custom time selection (default: true) */
|
|
11
|
+
showTimePicker?: boolean;
|
|
12
|
+
onApply?: (time?: Date) => void;
|
|
13
|
+
};
|
|
@@ -6,3 +6,7 @@ export * from './DateRangeFilterDropdown/DateRangeFilterDropdown';
|
|
|
6
6
|
export * from './DateRangeFilterDropdown/DateRangeFilterDropdown.types';
|
|
7
7
|
export * from './ResetButton/ResetButton';
|
|
8
8
|
export * from './ResetButton/ResetButton.types';
|
|
9
|
+
export * from './TextMultiSelect/TextMultiSelect';
|
|
10
|
+
export * from './TextMultiSelect/TextMultiSelect.types';
|
|
11
|
+
export * from './TimeFilterDropdown/TimeFilterDropdown';
|
|
12
|
+
export * from './TimeFilterDropdown/TimeFilterDropdown.types';
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { BadgeMultiSelect as t } from "./BadgeDropdown/BadgeMultiSelect.js";
|
|
2
2
|
import { DateFilterDropdown as p } from "./DateFilterDropdown/DateFilterDropdown.js";
|
|
3
|
-
import { DateRangeFilterDropdown as
|
|
4
|
-
import { ResetButton as
|
|
3
|
+
import { DateRangeFilterDropdown as m } from "./DateRangeFilterDropdown/DateRangeFilterDropdown.js";
|
|
4
|
+
import { ResetButton as f } from "./ResetButton/ResetButton.js";
|
|
5
|
+
import { TextMultiSelect as n } from "./TextMultiSelect/TextMultiSelect.js";
|
|
6
|
+
import { TimeFilterDropdown as a } from "./TimeFilterDropdown/TimeFilterDropdown.js";
|
|
5
7
|
export {
|
|
6
8
|
t as BadgeMultiSelect,
|
|
7
9
|
p as DateFilterDropdown,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
m as DateRangeFilterDropdown,
|
|
11
|
+
f as ResetButton,
|
|
12
|
+
n as TextMultiSelect,
|
|
13
|
+
a as TimeFilterDropdown
|
|
10
14
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { LineChartProps } from './LineChart.types';
|
|
3
|
+
/**
|
|
4
|
+
* A line chart component for time-series data visualization.
|
|
5
|
+
* Built on Chart.js with support for single and multi-line datasets.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <LineChart
|
|
10
|
+
* title="Disk Usage %"
|
|
11
|
+
* labels={['11:20', '11:25', '11:30']}
|
|
12
|
+
* datasets={[{ label: 'Usage', data: [6, 3, 8, 5] }]}
|
|
13
|
+
* yAxisFormatter={(v) => `${v}%`}
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const LineChart: FC<LineChartProps>;
|