@konstructio/ui 0.1.0-alpha.8 → 0.1.0-alpha.9
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.
|
@@ -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-UW8ts6wI.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,41 +1,42 @@
|
|
|
1
1
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { Badge as
|
|
3
|
-
import { Button as
|
|
2
|
+
import { Badge as g } from "../../../Badge/Badge.js";
|
|
3
|
+
import { Button as i } from "../../../Button/Button.js";
|
|
4
4
|
import { DatePicker as w } from "../../../Datepicker/DatePicker.js";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as o } from "../../../../utils/index.js";
|
|
6
6
|
import { filterButtonIconVariants as x, filterButtonVariants as N } from "../../Filter.variants.js";
|
|
7
7
|
import { useDateFilterDropdown as b } from "./DateFilterDropdown.hook.js";
|
|
8
|
-
import { C as
|
|
9
|
-
const
|
|
10
|
-
label:
|
|
11
|
-
|
|
8
|
+
import { C as y } from "../../../../chevron-down-UW8ts6wI.js";
|
|
9
|
+
const R = ({
|
|
10
|
+
label: p,
|
|
11
|
+
position: l = "left",
|
|
12
|
+
onApply: s
|
|
12
13
|
}) => {
|
|
13
14
|
const {
|
|
14
|
-
id:
|
|
15
|
-
appliedDay:
|
|
15
|
+
id: m,
|
|
16
|
+
appliedDay: n,
|
|
16
17
|
isOpen: a,
|
|
17
18
|
selectedDay: e,
|
|
18
|
-
wrapperRef:
|
|
19
|
-
handleApply:
|
|
20
|
-
handleOpen:
|
|
21
|
-
handleSelect:
|
|
22
|
-
handleReset:
|
|
23
|
-
} = b({ onApply:
|
|
24
|
-
return /* @__PURE__ */ r("div", { ref:
|
|
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: [
|
|
25
26
|
/* @__PURE__ */ r(
|
|
26
27
|
"button",
|
|
27
28
|
{
|
|
28
|
-
className:
|
|
29
|
+
className: o(N(), {
|
|
29
30
|
"text-slate-700": a
|
|
30
31
|
}),
|
|
31
|
-
onClick:
|
|
32
|
+
onClick: f,
|
|
32
33
|
children: [
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
p,
|
|
35
|
+
n && /* @__PURE__ */ t(g, { label: n }),
|
|
35
36
|
/* @__PURE__ */ t(
|
|
36
|
-
|
|
37
|
+
y,
|
|
37
38
|
{
|
|
38
|
-
className:
|
|
39
|
+
className: o(x(), {
|
|
39
40
|
"rotate-180": a,
|
|
40
41
|
"text-blue-600": a
|
|
41
42
|
})
|
|
@@ -44,34 +45,46 @@ const O = ({
|
|
|
44
45
|
]
|
|
45
46
|
}
|
|
46
47
|
),
|
|
47
|
-
a && /* @__PURE__ */ r(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
arrowClassName: "-top-1 right-0",
|
|
53
|
-
monthsClassName: "shadow-none p-0 w-auto",
|
|
54
|
-
defaultSelected: e,
|
|
55
|
-
defaultMonth: e,
|
|
56
|
-
onSelect: f
|
|
57
|
-
},
|
|
58
|
-
(e == null ? void 0 : e.toISOString()) ?? s
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ r("div", { className: "flex justify-end items-center gap-4 py-2", children: [
|
|
61
|
-
/* @__PURE__ */ t(
|
|
62
|
-
n,
|
|
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",
|
|
63
53
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
onClick: h,
|
|
67
|
-
children: "Reset"
|
|
54
|
+
"left-0": l === "left",
|
|
55
|
+
"right-0": l === "right"
|
|
68
56
|
}
|
|
69
57
|
),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
+
)
|
|
73
86
|
] });
|
|
74
87
|
};
|
|
75
88
|
export {
|
|
76
|
-
|
|
89
|
+
R as DateFilterDropdown
|
|
77
90
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export declare const BadgeMultiSelect: FC<BadgeMultiSelectProps>;
|
|
|
74
74
|
declare type BadgeMultiSelectProps = {
|
|
75
75
|
label: string;
|
|
76
76
|
options: Option_4[];
|
|
77
|
+
position?: 'left' | 'right';
|
|
77
78
|
onApply?: (selectedOptions: Option_4[]) => void;
|
|
78
79
|
};
|
|
79
80
|
|
|
@@ -170,6 +171,7 @@ export declare const DateFilterDropdown: FC<DateFilterDropdownProps>;
|
|
|
170
171
|
|
|
171
172
|
declare type DateFilterDropdownProps = {
|
|
172
173
|
label: string;
|
|
174
|
+
position?: 'left' | 'right';
|
|
173
175
|
onApply?: (date?: Date) => void;
|
|
174
176
|
};
|
|
175
177
|
|
package/dist/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.8",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.9",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|