@konstructio/ui 0.1.2-alpha.13 → 0.1.2-alpha.15
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/{chevron-down-Cx07rtLP.js → chevron-down-J5nS1Tu0.js} +2 -2
- package/dist/{chevron-right-DCDOrc04.js → chevron-right-DeMVrnIg.js} +3 -3
- package/dist/components/Badge/Badge.js +2 -2
- package/dist/components/Button/Button.variants.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +1 -1
- package/dist/components/Dropdown/Dropdown.variants.js +9 -4
- package/dist/components/Dropdown/components/List/List.js +55 -51
- package/dist/components/Dropdown/components/ListItem/ListItem.js +58 -36
- package/dist/components/Dropdown/components/Wrapper.js +128 -118
- package/dist/components/Dropdown/hooks/useDropdown.js +16 -12
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +1 -1
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +1 -1
- package/dist/components/Loading/Loading.js +2 -2
- package/dist/components/PieChart/PieChart.js +460 -461
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +1 -1
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +2 -2
- package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +1 -1
- package/dist/{createLucideIcon-DnY-81vT.js → createLucideIcon-DGhJ8Z4k.js} +4 -4
- package/dist/index.d.ts +4 -0
- package/dist/package.json +9 -9
- package/dist/styles.css +1 -1
- package/package.json +9 -9
|
@@ -1,165 +1,173 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Loading as
|
|
4
|
-
import { Typography as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { labelVariants as
|
|
7
|
-
import { useDropdown as
|
|
8
|
-
import { List as
|
|
9
|
-
import { c as
|
|
10
|
-
import { useDropdownContext as
|
|
1
|
+
import { jsxs as x, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S, useId as X, useRef as T, useImperativeHandle as Y, useMemo as Z, useEffect as z } from "react";
|
|
3
|
+
import { Loading as B } from "../../Loading/Loading.js";
|
|
4
|
+
import { Typography as ee } from "../../Typography/Typography.js";
|
|
5
|
+
import { cn as c } from "../../../utils/index.js";
|
|
6
|
+
import { labelVariants as te, inputVariants as ae, dropdownVariants as re } from "../Dropdown.variants.js";
|
|
7
|
+
import { useDropdown as ne } from "../hooks/useDropdown.js";
|
|
8
|
+
import { List as oe } from "./List/List.js";
|
|
9
|
+
import { c as V } from "../../../createLucideIcon-DGhJ8Z4k.js";
|
|
10
|
+
import { useDropdownContext as le } from "../contexts/dropdown.hook.js";
|
|
11
11
|
/**
|
|
12
|
-
* @license lucide-react v0.
|
|
12
|
+
* @license lucide-react v0.548.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const se = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], ce = V("chevron-up", se);
|
|
18
18
|
/**
|
|
19
|
-
* @license lucide-react v0.
|
|
19
|
+
* @license lucide-react v0.548.0 - ISC
|
|
20
20
|
*
|
|
21
21
|
* This source code is licensed under the ISC license.
|
|
22
22
|
* See the LICENSE file in the root directory of this source tree.
|
|
23
23
|
*/
|
|
24
|
-
const
|
|
24
|
+
const ie = [
|
|
25
25
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
26
26
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
27
|
-
],
|
|
27
|
+
], ue = V("search", ie), Ce = S(
|
|
28
28
|
({
|
|
29
|
-
additionalOptions:
|
|
30
|
-
className:
|
|
31
|
-
defaultValue:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
additionalOptions: _,
|
|
30
|
+
className: $,
|
|
31
|
+
defaultValue: h,
|
|
32
|
+
disabled: r = !1,
|
|
33
|
+
error: m,
|
|
34
|
+
iconClassName: D,
|
|
35
|
+
inputClassName: F,
|
|
36
|
+
isLoading: j,
|
|
37
|
+
isRequired: v,
|
|
38
|
+
label: w,
|
|
39
|
+
labelClassName: M,
|
|
40
|
+
listClassName: A,
|
|
41
|
+
listItemClassName: H,
|
|
42
|
+
listItemSecondRowClassName: P,
|
|
43
|
+
name: i,
|
|
44
|
+
options: o,
|
|
43
45
|
placeholder: N,
|
|
44
|
-
searchable:
|
|
46
|
+
searchable: k = !1,
|
|
45
47
|
showSearchIcon: C,
|
|
46
|
-
theme:
|
|
47
|
-
wrapperClassName:
|
|
48
|
-
onBlur:
|
|
49
|
-
...
|
|
50
|
-
},
|
|
51
|
-
const
|
|
52
|
-
ulRef:
|
|
53
|
-
inputRef: t
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
theme: U,
|
|
49
|
+
wrapperClassName: W,
|
|
50
|
+
onBlur: I,
|
|
51
|
+
...b
|
|
52
|
+
}, q) => {
|
|
53
|
+
const E = X(), t = T(null), O = T(null), { wrapperRef: u, wrapperInputRef: R, handleOpen: g } = ne({
|
|
54
|
+
ulRef: O,
|
|
55
|
+
inputRef: t,
|
|
56
|
+
disabled: r
|
|
57
|
+
}), { isOpen: p, searchTerm: G, value: l, toggleOpen: J, setValue: y, setSearchTerm: L } = le(), f = i ? `${E}-${i}` : E;
|
|
58
|
+
Y(q, () => t.current, [t]);
|
|
59
|
+
const n = Z(() => o.find(({ value: e }) => e === l), [o, l]);
|
|
60
|
+
z(() => {
|
|
61
|
+
t.current && (t.current.value = l ? n?.value : "");
|
|
62
|
+
}, [n, l]), z(() => {
|
|
63
|
+
if (h && !l) {
|
|
64
|
+
const e = o && o.find((s) => s.value === h);
|
|
62
65
|
e && y(e.value);
|
|
63
66
|
}
|
|
64
|
-
}, [
|
|
67
|
+
}, [h, o, y, l]), z(() => {
|
|
65
68
|
const e = new AbortController();
|
|
66
|
-
return
|
|
67
|
-
const
|
|
68
|
-
(!
|
|
69
|
+
return u.current?.addEventListener("focusout", (s) => {
|
|
70
|
+
const d = s.relatedTarget;
|
|
71
|
+
(!d || !u.current?.contains(d)) && (L(""), t.current?.value || I?.());
|
|
69
72
|
}), () => {
|
|
70
73
|
e.abort();
|
|
71
74
|
};
|
|
72
|
-
}, [
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
(
|
|
75
|
+
}, [J, u, L, I, l]);
|
|
76
|
+
const K = (e) => {
|
|
77
|
+
const s = e.target.value;
|
|
78
|
+
L(s);
|
|
79
|
+
const d = o.find(
|
|
80
|
+
(Q) => Q.value.toLocaleLowerCase() === s.toLocaleLowerCase()
|
|
78
81
|
);
|
|
79
|
-
|
|
82
|
+
d && y(d.value);
|
|
80
83
|
};
|
|
81
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ x(
|
|
82
85
|
"div",
|
|
83
86
|
{
|
|
84
|
-
ref:
|
|
85
|
-
className:
|
|
86
|
-
"data-theme":
|
|
87
|
+
ref: u,
|
|
88
|
+
className: c("flex flex-col w-full relative", W),
|
|
89
|
+
"data-theme": U,
|
|
87
90
|
children: [
|
|
88
|
-
|
|
91
|
+
w ? /* @__PURE__ */ x(
|
|
89
92
|
"label",
|
|
90
93
|
{
|
|
91
|
-
id:
|
|
92
|
-
className:
|
|
93
|
-
htmlFor:
|
|
94
|
-
onClick:
|
|
94
|
+
id: f,
|
|
95
|
+
className: c(te({ className: M })),
|
|
96
|
+
htmlFor: f,
|
|
97
|
+
onClick: () => !r && g(),
|
|
95
98
|
children: [
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
w,
|
|
100
|
+
v && /* @__PURE__ */ a("span", { className: "text-red-600 ml-1", children: "*" })
|
|
98
101
|
]
|
|
99
102
|
}
|
|
100
103
|
) : null,
|
|
101
|
-
/* @__PURE__ */
|
|
104
|
+
/* @__PURE__ */ x(
|
|
102
105
|
"div",
|
|
103
106
|
{
|
|
104
|
-
ref:
|
|
105
|
-
id:
|
|
106
|
-
className:
|
|
107
|
+
ref: R,
|
|
108
|
+
id: f,
|
|
109
|
+
className: c(
|
|
110
|
+
re({ className: $, hasError: !!m, disabled: r })
|
|
111
|
+
),
|
|
107
112
|
role: "combobox",
|
|
108
|
-
onClick:
|
|
109
|
-
"aria-expanded":
|
|
113
|
+
onClick: () => !r && g(),
|
|
114
|
+
"aria-expanded": p,
|
|
110
115
|
tabIndex: 0,
|
|
111
|
-
"aria-labelledby":
|
|
116
|
+
"aria-labelledby": f,
|
|
112
117
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
C && /* @__PURE__ */ a(
|
|
116
|
-
|
|
118
|
+
/* @__PURE__ */ x("div", { className: "flex gap-2.5 items-center flex-1", children: [
|
|
119
|
+
n?.leftIcon && !C && /* @__PURE__ */ a("span", { className: "w-4 h-4 flex justify-center items-center dark:text-slate-50", children: n.leftIcon }),
|
|
120
|
+
C && /* @__PURE__ */ a(ue, { className: "w-4 h-4 text-zinc-500 select-none dark:text-slate-300 dark:group-focus-within:text-slate-50 transition-colors duration-300" }),
|
|
121
|
+
k ? /* @__PURE__ */ a(
|
|
117
122
|
"input",
|
|
118
123
|
{
|
|
119
124
|
ref: t,
|
|
120
125
|
type: "text",
|
|
121
|
-
value:
|
|
122
|
-
name:
|
|
123
|
-
onChange:
|
|
126
|
+
value: p ? G : n?.label || "",
|
|
127
|
+
name: i,
|
|
128
|
+
onChange: K,
|
|
124
129
|
placeholder: N,
|
|
125
|
-
className:
|
|
126
|
-
"text-red-700 placeholder:text-red-700": !!
|
|
130
|
+
className: c(ae({ className: F }), {
|
|
131
|
+
"text-red-700 placeholder:text-red-700": !!m
|
|
127
132
|
}),
|
|
128
133
|
onClick: (e) => {
|
|
129
|
-
e.stopPropagation(),
|
|
134
|
+
e.stopPropagation(), r || g();
|
|
130
135
|
},
|
|
131
|
-
"aria-label":
|
|
132
|
-
"aria-labelledby":
|
|
133
|
-
required:
|
|
136
|
+
"aria-label": w || N,
|
|
137
|
+
"aria-labelledby": f,
|
|
138
|
+
required: v,
|
|
134
139
|
autoComplete: "off",
|
|
135
140
|
autoCapitalize: "words",
|
|
136
|
-
|
|
141
|
+
disabled: r,
|
|
142
|
+
...b
|
|
137
143
|
}
|
|
138
144
|
) : /* @__PURE__ */ a(
|
|
139
|
-
|
|
145
|
+
ee,
|
|
140
146
|
{
|
|
141
147
|
variant: "body2",
|
|
142
|
-
className:
|
|
148
|
+
className: c(
|
|
143
149
|
"flex-1 text-zinc-400 text-sm dark:text-slate-400",
|
|
144
150
|
{
|
|
145
|
-
"text-red-700": !!
|
|
146
|
-
"select-none": !
|
|
147
|
-
"text-slate-800 dark:text-slate-50":
|
|
151
|
+
"text-red-700": !!m,
|
|
152
|
+
"select-none": !n,
|
|
153
|
+
"text-slate-800 dark:text-slate-50": n,
|
|
154
|
+
"text-slate-400/50 dark:text-slate-50/50": r
|
|
148
155
|
}
|
|
149
156
|
),
|
|
150
|
-
children:
|
|
157
|
+
children: n?.label || N
|
|
151
158
|
}
|
|
152
159
|
)
|
|
153
160
|
] }),
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
j ? /* @__PURE__ */ a(B, { className: "w-4 h-4 text-zinc-500 select-none" }) : !C && /* @__PURE__ */ a(
|
|
162
|
+
ce,
|
|
156
163
|
{
|
|
157
|
-
"data-state":
|
|
158
|
-
className:
|
|
164
|
+
"data-state": p ? "open" : "closed",
|
|
165
|
+
className: c(
|
|
159
166
|
"w-4 h-4 text-zinc-500 transition-all duration-100 data-[state=open]:rotate-0 data-[state=closed]:rotate-180 select-none dark:group-focus-within:text-slate-50",
|
|
160
|
-
|
|
167
|
+
D,
|
|
161
168
|
{
|
|
162
|
-
"text-red-700": !!
|
|
169
|
+
"text-red-700": !!m,
|
|
170
|
+
"text-slate-400/50 dark:group-focus-within:text-zinc-500": r
|
|
163
171
|
}
|
|
164
172
|
)
|
|
165
173
|
}
|
|
@@ -167,32 +175,34 @@ const se = [
|
|
|
167
175
|
]
|
|
168
176
|
}
|
|
169
177
|
),
|
|
170
|
-
!
|
|
178
|
+
!k && /* @__PURE__ */ a(
|
|
171
179
|
"input",
|
|
172
180
|
{
|
|
173
181
|
ref: t,
|
|
174
182
|
type: "text",
|
|
175
|
-
name:
|
|
183
|
+
name: i,
|
|
176
184
|
className: "hidden",
|
|
177
185
|
"aria-hidden": "true",
|
|
178
|
-
required:
|
|
179
|
-
|
|
186
|
+
required: v,
|
|
187
|
+
inert: !0,
|
|
188
|
+
...b
|
|
180
189
|
}
|
|
181
190
|
),
|
|
182
|
-
|
|
183
|
-
|
|
191
|
+
p && /* @__PURE__ */ a(
|
|
192
|
+
oe,
|
|
184
193
|
{
|
|
185
|
-
ref:
|
|
186
|
-
additionalOptions:
|
|
187
|
-
className:
|
|
188
|
-
itemClassName:
|
|
189
|
-
name:
|
|
190
|
-
wrapperRef:
|
|
191
|
-
wrapperInputRef:
|
|
194
|
+
ref: O,
|
|
195
|
+
additionalOptions: _,
|
|
196
|
+
className: A,
|
|
197
|
+
itemClassName: H,
|
|
198
|
+
name: i,
|
|
199
|
+
wrapperRef: u,
|
|
200
|
+
wrapperInputRef: R,
|
|
192
201
|
inputRef: t,
|
|
193
|
-
options:
|
|
194
|
-
isLoading: !!
|
|
195
|
-
searchable:
|
|
202
|
+
options: o,
|
|
203
|
+
isLoading: !!j,
|
|
204
|
+
searchable: k,
|
|
205
|
+
listItemSecondRowClassName: P
|
|
196
206
|
}
|
|
197
207
|
)
|
|
198
208
|
]
|
|
@@ -201,5 +211,5 @@ const se = [
|
|
|
201
211
|
}
|
|
202
212
|
);
|
|
203
213
|
export {
|
|
204
|
-
|
|
214
|
+
Ce as Wrapper
|
|
205
215
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { useRef as c, useEffect as u, useCallback as
|
|
2
|
-
import { useDropdownContext as
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import { useRef as c, useEffect as u, useCallback as g } from "react";
|
|
2
|
+
import { useDropdownContext as m } from "../contexts/dropdown.hook.js";
|
|
3
|
+
const b = ({
|
|
4
|
+
ulRef: i,
|
|
5
|
+
inputRef: l,
|
|
6
|
+
disabled: d
|
|
7
|
+
}) => {
|
|
8
|
+
const o = c(null), t = c(null), { toggleOpen: n } = m();
|
|
5
9
|
u(() => {
|
|
6
10
|
const e = new AbortController(), s = (a) => {
|
|
7
11
|
a.key === "Escape" && n(!1);
|
|
@@ -23,7 +27,7 @@ const w = ({ ulRef: l, inputRef: i }) => {
|
|
|
23
27
|
), t.current?.addEventListener(
|
|
24
28
|
"focus",
|
|
25
29
|
() => {
|
|
26
|
-
n(!0);
|
|
30
|
+
d || n(!0);
|
|
27
31
|
},
|
|
28
32
|
{ signal: e.signal }
|
|
29
33
|
), () => {
|
|
@@ -35,7 +39,7 @@ const w = ({ ulRef: l, inputRef: i }) => {
|
|
|
35
39
|
"keydown",
|
|
36
40
|
(s) => {
|
|
37
41
|
if (s.key === "ArrowDown") {
|
|
38
|
-
const r =
|
|
42
|
+
const r = i.current?.querySelector("li");
|
|
39
43
|
r && r.focus();
|
|
40
44
|
}
|
|
41
45
|
},
|
|
@@ -43,16 +47,16 @@ const w = ({ ulRef: l, inputRef: i }) => {
|
|
|
43
47
|
), () => {
|
|
44
48
|
e.abort();
|
|
45
49
|
};
|
|
46
|
-
}, [t,
|
|
47
|
-
const
|
|
48
|
-
n(!0), requestAnimationFrame(() =>
|
|
49
|
-
}, [
|
|
50
|
+
}, [t, i]);
|
|
51
|
+
const f = g(() => {
|
|
52
|
+
n(!0), requestAnimationFrame(() => l?.current?.focus());
|
|
53
|
+
}, [l, n]);
|
|
50
54
|
return {
|
|
51
55
|
wrapperRef: o,
|
|
52
56
|
wrapperInputRef: t,
|
|
53
|
-
handleOpen:
|
|
57
|
+
handleOpen: f
|
|
54
58
|
};
|
|
55
59
|
};
|
|
56
60
|
export {
|
|
57
|
-
|
|
61
|
+
b as useDropdown
|
|
58
62
|
};
|
|
@@ -5,7 +5,7 @@ import { Checkbox as C } from "../../../Checkbox/Checkbox.js";
|
|
|
5
5
|
import { cn as n } from "../../../../utils/index.js";
|
|
6
6
|
import { filterButtonIconVariants as y, filterButtonVariants as N } from "../../Filter.variants.js";
|
|
7
7
|
import { useBadgeMultiSelect as B } from "./BadgeMultiSelect.hook.js";
|
|
8
|
-
import { C as O } from "../../../../chevron-down-
|
|
8
|
+
import { C as O } from "../../../../chevron-down-J5nS1Tu0.js";
|
|
9
9
|
const $ = ({
|
|
10
10
|
options: i,
|
|
11
11
|
label: p,
|
|
@@ -5,7 +5,7 @@ import { DatePicker as w } from "../../../Datepicker/DatePicker.js";
|
|
|
5
5
|
import { cn as o } from "../../../../utils/index.js";
|
|
6
6
|
import { filterButtonIconVariants as x, filterButtonVariants as y } from "../../Filter.variants.js";
|
|
7
7
|
import { useDateFilterDropdown as D } from "./DateFilterDropdown.hook.js";
|
|
8
|
-
import { C as N } from "../../../../chevron-down-
|
|
8
|
+
import { C as N } from "../../../../chevron-down-J5nS1Tu0.js";
|
|
9
9
|
const R = ({
|
|
10
10
|
label: s,
|
|
11
11
|
position: l = "left",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { cn as c } from "../../utils/index.js";
|
|
3
3
|
import { loadingVariants as i } from "./Loading.variants.js";
|
|
4
|
-
import { c as t } from "../../createLucideIcon-
|
|
4
|
+
import { c as t } from "../../createLucideIcon-DGhJ8Z4k.js";
|
|
5
5
|
/**
|
|
6
|
-
* @license lucide-react v0.
|
|
6
|
+
* @license lucide-react v0.548.0 - ISC
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the ISC license.
|
|
9
9
|
* See the LICENSE file in the root directory of this source tree.
|