@konstructio/ui 0.1.2-alpha.34 → 0.1.2-alpha.35
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/components/Badge/Badge.js +42 -41
- package/dist/components/Dropdown/components/List/List.js +62 -60
- package/dist/components/Dropdown/components/ListItem/ListItem.js +57 -47
- package/dist/components/Dropdown/components/Wrapper.js +65 -63
- package/dist/components/Toast/Toast.js +173 -170
- package/dist/components/Toast/Toast.variants.js +37 -24
- package/dist/index.d.ts +4 -1
- package/dist/loader-H82RiE-I.js +4 -0
- package/dist/package.json +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,67 +1,68 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as y, useState as v, useCallback as N, useEffect as g } from "react";
|
|
3
|
+
import { L as x } from "../../loader-H82RiE-I.js";
|
|
4
|
+
import { cn as d } from "../../utils/index.js";
|
|
5
|
+
import { buttonDismissVariants as w, badgeVariants as L } from "./Badge.variants.js";
|
|
6
|
+
import { S as V } from "../../index-BtQfgaSF.js";
|
|
7
|
+
import { c as D } from "../../createLucideIcon-D4r5Phnh.js";
|
|
8
|
+
const S = [
|
|
8
9
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
9
10
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
10
|
-
],
|
|
11
|
-
className:
|
|
12
|
-
dismissible:
|
|
13
|
-
label:
|
|
14
|
-
leftIcon:
|
|
15
|
-
loading:
|
|
16
|
-
size:
|
|
17
|
-
variant:
|
|
11
|
+
], j = D("x", S), B = ({
|
|
12
|
+
className: u,
|
|
13
|
+
dismissible: p = !1,
|
|
14
|
+
label: r,
|
|
15
|
+
leftIcon: o,
|
|
16
|
+
loading: i = !1,
|
|
17
|
+
size: n,
|
|
18
|
+
variant: l,
|
|
18
19
|
onClick: e,
|
|
19
|
-
onDismiss:
|
|
20
|
+
onDismiss: m
|
|
20
21
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
(
|
|
23
|
-
|
|
22
|
+
const s = y(null), [b, f] = v("visible"), h = N(
|
|
23
|
+
(a) => {
|
|
24
|
+
a.stopPropagation(), m?.(), f("hidden");
|
|
24
25
|
},
|
|
25
|
-
[
|
|
26
|
+
[m]
|
|
26
27
|
);
|
|
27
|
-
return
|
|
28
|
-
const
|
|
29
|
-
return
|
|
28
|
+
return g(() => {
|
|
29
|
+
const a = new AbortController();
|
|
30
|
+
return s.current?.addEventListener(
|
|
30
31
|
"animationend",
|
|
31
32
|
() => {
|
|
32
|
-
|
|
33
|
+
s.current?.style.setProperty("display", "none"), s.current?.remove();
|
|
33
34
|
},
|
|
34
|
-
{ signal:
|
|
35
|
-
), () =>
|
|
35
|
+
{ signal: a.signal }
|
|
36
|
+
), () => a.abort();
|
|
36
37
|
}, []), /* @__PURE__ */ c(
|
|
37
38
|
"span",
|
|
38
39
|
{
|
|
39
|
-
ref:
|
|
40
|
-
className:
|
|
41
|
-
|
|
40
|
+
ref: s,
|
|
41
|
+
className: d(
|
|
42
|
+
L({ variant: l, size: n, className: u }),
|
|
42
43
|
e && "cursor-pointer"
|
|
43
44
|
),
|
|
44
45
|
role: e ? "button" : void 0,
|
|
45
46
|
onClick: e,
|
|
46
47
|
tabIndex: e ? 0 : void 0,
|
|
47
|
-
"aria-label": e ? `${
|
|
48
|
-
"aria-busy":
|
|
48
|
+
"aria-label": e ? `${r} badge` : void 0,
|
|
49
|
+
"aria-busy": i,
|
|
49
50
|
"aria-live": "polite",
|
|
50
|
-
"data-state":
|
|
51
|
+
"data-state": b,
|
|
51
52
|
children: [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
i && /* @__PURE__ */ t(x, { className: "h-3 w-3 animate-spin animate-duration-time-2" }),
|
|
54
|
+
o ? /* @__PURE__ */ t(V, { className: "h-3 w-3", children: o }) : null,
|
|
55
|
+
r,
|
|
56
|
+
p && /* @__PURE__ */ c(
|
|
56
57
|
"button",
|
|
57
58
|
{
|
|
58
59
|
type: "button",
|
|
59
|
-
className:
|
|
60
|
-
onClick:
|
|
60
|
+
className: d(w({ size: n, variant: l })),
|
|
61
|
+
onClick: h,
|
|
61
62
|
"aria-label": "Dismiss",
|
|
62
63
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ t(j, { className: "h-full w-full" }),
|
|
65
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: "Dismiss" })
|
|
65
66
|
]
|
|
66
67
|
}
|
|
67
68
|
)
|
|
@@ -70,5 +71,5 @@ const Z = [
|
|
|
70
71
|
);
|
|
71
72
|
};
|
|
72
73
|
export {
|
|
73
|
-
|
|
74
|
+
B as Badge
|
|
74
75
|
};
|
|
@@ -1,76 +1,77 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { S as
|
|
3
|
-
import { d as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { Loading as
|
|
1
|
+
import { jsxs as V, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { S as Z } from "../../../../index-BtQfgaSF.js";
|
|
3
|
+
import { d as B } from "../../../../debounce-BFejQm9P.js";
|
|
4
|
+
import { forwardRef as G, useRef as C, useState as J, useImperativeHandle as K, useMemo as M, useEffect as Q } from "react";
|
|
5
|
+
import { Loading as R } from "../../../Loading/Loading.js";
|
|
6
6
|
import { cn as a } from "../../../../utils/index.js";
|
|
7
|
-
import { useNavigationUlList as
|
|
7
|
+
import { useNavigationUlList as W } from "../../hooks/useNavigationList.js";
|
|
8
8
|
import { ListItem as b } from "../ListItem/ListItem.js";
|
|
9
|
-
import { listVariants as
|
|
10
|
-
import { DEFAULT_LIST_SIZE as
|
|
11
|
-
import { useDropdownContext as
|
|
12
|
-
const
|
|
9
|
+
import { listVariants as X } from "./List.variants.js";
|
|
10
|
+
import { DEFAULT_LIST_SIZE as Y } from "../../constants/pagination.js";
|
|
11
|
+
import { useDropdownContext as $ } from "../../contexts/dropdown.hook.js";
|
|
12
|
+
const fe = G(
|
|
13
13
|
({
|
|
14
|
-
additionalOptions:
|
|
15
|
-
className:
|
|
14
|
+
additionalOptions: F,
|
|
15
|
+
className: N,
|
|
16
16
|
inputRef: i,
|
|
17
|
-
isLoading:
|
|
17
|
+
isLoading: E,
|
|
18
18
|
itemClassName: l,
|
|
19
19
|
name: I,
|
|
20
|
-
searchable:
|
|
20
|
+
searchable: y = !1,
|
|
21
21
|
listItemSecondRowClassName: c,
|
|
22
|
-
wrapperInputRef:
|
|
22
|
+
wrapperInputRef: j,
|
|
23
23
|
isInfiniteScrollEnabled: u,
|
|
24
|
-
onFetchMoreOptions: f
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
onFetchMoreOptions: f,
|
|
25
|
+
noOptionsText: L
|
|
26
|
+
}, O) => {
|
|
27
|
+
const o = C(null), m = C(null), [p, w] = J(!1), {
|
|
28
|
+
isOpen: P,
|
|
28
29
|
searchTerm: g,
|
|
29
|
-
canFilter:
|
|
30
|
+
canFilter: S,
|
|
30
31
|
canContinueFetching: n,
|
|
31
32
|
page: d,
|
|
32
|
-
options:
|
|
33
|
-
isTyping:
|
|
34
|
-
setOptions:
|
|
35
|
-
setPage:
|
|
36
|
-
setCanContinueFetching:
|
|
37
|
-
} =
|
|
38
|
-
|
|
39
|
-
const h =
|
|
33
|
+
options: x,
|
|
34
|
+
isTyping: k,
|
|
35
|
+
setOptions: T,
|
|
36
|
+
setPage: D,
|
|
37
|
+
setCanContinueFetching: U
|
|
38
|
+
} = $();
|
|
39
|
+
K(O, () => o.current, [o]);
|
|
40
|
+
const h = y && S ? x.filter((e) => {
|
|
40
41
|
const t = g.toLowerCase();
|
|
41
42
|
return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(t);
|
|
42
|
-
}) :
|
|
43
|
-
|
|
44
|
-
ulRef:
|
|
45
|
-
wrapperInputRef:
|
|
46
|
-
searchable:
|
|
43
|
+
}) : x;
|
|
44
|
+
W({
|
|
45
|
+
ulRef: o,
|
|
46
|
+
wrapperInputRef: j,
|
|
47
|
+
searchable: y,
|
|
47
48
|
filteredOptions: h
|
|
48
49
|
});
|
|
49
|
-
const
|
|
50
|
-
(e, t,
|
|
51
|
-
),
|
|
52
|
-
() =>
|
|
50
|
+
const _ = h.filter(
|
|
51
|
+
(e, t, s) => t === s.findIndex((v) => v.value === e.value)
|
|
52
|
+
), q = h.length === 0, z = M(
|
|
53
|
+
() => B(async (e) => {
|
|
53
54
|
const [t] = e;
|
|
54
55
|
if (t.isIntersecting && !p && f && n)
|
|
55
56
|
try {
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
page:
|
|
59
|
-
pageSize:
|
|
57
|
+
w(!0);
|
|
58
|
+
const s = d + 1, { data: v, hasMore: A } = await f({
|
|
59
|
+
page: s,
|
|
60
|
+
pageSize: Y,
|
|
60
61
|
termOfSearch: g
|
|
61
62
|
});
|
|
62
|
-
|
|
63
|
+
D(s), U(A), T((H) => [...H, ...v]);
|
|
63
64
|
} catch {
|
|
64
65
|
console.error("Error fetching more options");
|
|
65
66
|
} finally {
|
|
66
|
-
|
|
67
|
+
w(!1);
|
|
67
68
|
}
|
|
68
69
|
}, 100),
|
|
69
70
|
[p, f, g, d]
|
|
70
71
|
);
|
|
71
|
-
return
|
|
72
|
-
if (u && n && m.current && !
|
|
73
|
-
const e = new IntersectionObserver(
|
|
72
|
+
return Q(() => {
|
|
73
|
+
if (u && n && m.current && !k) {
|
|
74
|
+
const e = new IntersectionObserver(z, {
|
|
74
75
|
threshold: 0.1
|
|
75
76
|
});
|
|
76
77
|
return e.observe(m.current), () => e.disconnect();
|
|
@@ -79,18 +80,18 @@ const ue = B(
|
|
|
79
80
|
u,
|
|
80
81
|
n,
|
|
81
82
|
p,
|
|
82
|
-
|
|
83
|
+
k,
|
|
83
84
|
d
|
|
84
|
-
]), /* @__PURE__ */
|
|
85
|
+
]), /* @__PURE__ */ V(
|
|
85
86
|
"ul",
|
|
86
87
|
{
|
|
87
|
-
ref:
|
|
88
|
+
ref: o,
|
|
88
89
|
title: I,
|
|
89
90
|
role: "listbox",
|
|
90
|
-
className: a(
|
|
91
|
-
"data-state":
|
|
91
|
+
className: a(X({ className: N })),
|
|
92
|
+
"data-state": P ? "open" : "closed",
|
|
92
93
|
children: [
|
|
93
|
-
|
|
94
|
+
E ? /* @__PURE__ */ r(
|
|
94
95
|
b,
|
|
95
96
|
{
|
|
96
97
|
className: a("select-none", l),
|
|
@@ -100,17 +101,18 @@ const ue = B(
|
|
|
100
101
|
label: "Loading...",
|
|
101
102
|
listItemSecondRowClassName: c
|
|
102
103
|
}
|
|
103
|
-
) :
|
|
104
|
+
) : q ? /* @__PURE__ */ r(
|
|
104
105
|
b,
|
|
105
106
|
{
|
|
107
|
+
isEmpty: !0,
|
|
106
108
|
className: a("select-none", l),
|
|
107
109
|
isClickable: !1,
|
|
108
110
|
inputRef: i,
|
|
109
|
-
value:
|
|
110
|
-
label: "No options",
|
|
111
|
+
value: L ?? "",
|
|
112
|
+
label: L ?? "No options",
|
|
111
113
|
listItemSecondRowClassName: c
|
|
112
114
|
}
|
|
113
|
-
) :
|
|
115
|
+
) : _.map((e) => /* @__PURE__ */ r(
|
|
114
116
|
b,
|
|
115
117
|
{
|
|
116
118
|
className: a("select-none", l),
|
|
@@ -121,7 +123,7 @@ const ue = B(
|
|
|
121
123
|
},
|
|
122
124
|
e.value
|
|
123
125
|
)),
|
|
124
|
-
u && n && /* @__PURE__ */
|
|
126
|
+
u && n && /* @__PURE__ */ r(
|
|
125
127
|
"li",
|
|
126
128
|
{
|
|
127
129
|
ref: m,
|
|
@@ -129,15 +131,15 @@ const ue = B(
|
|
|
129
131
|
"data-action": "true",
|
|
130
132
|
className: "flex items-center justify-center py-3",
|
|
131
133
|
onClick: (e) => e.stopPropagation(),
|
|
132
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ r(R, { className: "w-4 h-4 text-aurora-500 select-none" })
|
|
133
135
|
}
|
|
134
136
|
),
|
|
135
|
-
|
|
137
|
+
F?.map((e, t) => /* @__PURE__ */ r("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ r(Z, { className: "flex p-2 w-full h-full gap-1 items-center text-sm [&>svg]:w-3.5 [&>svg]:h-3.5 [&>svg]:shrink-0 cursor-pointer select-none hover:bg-gray-50 hover:dark:bg-slate-700 focus:outline-0", children: e }) }, t))
|
|
136
138
|
]
|
|
137
139
|
}
|
|
138
140
|
);
|
|
139
141
|
}
|
|
140
142
|
);
|
|
141
143
|
export {
|
|
142
|
-
|
|
144
|
+
fe as List
|
|
143
145
|
};
|
|
@@ -1,65 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Typography as
|
|
5
|
-
import { listItemVariants as
|
|
6
|
-
import { useDropdownContext as
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
return
|
|
1
|
+
import { jsx as s, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I, useCallback as u } from "react";
|
|
3
|
+
import { cn as l } from "../../../../utils/index.js";
|
|
4
|
+
import { Typography as y } from "../../../Typography/Typography.js";
|
|
5
|
+
import { listItemVariants as L } from "./ListItem.variants.js";
|
|
6
|
+
import { useDropdownContext as V } from "../../contexts/dropdown.hook.js";
|
|
7
|
+
function j(c, n) {
|
|
8
|
+
const i = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(`(${i})`, "gi");
|
|
9
|
+
return c.split(o).map((a, t) => a.toLowerCase() === n.toLowerCase() ? /* @__PURE__ */ s(
|
|
10
10
|
"mark",
|
|
11
11
|
{
|
|
12
12
|
className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
|
|
13
|
-
children:
|
|
13
|
+
children: a
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
) : /* @__PURE__ */
|
|
15
|
+
t
|
|
16
|
+
) : /* @__PURE__ */ s("span", { children: a }, t));
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const K = ({
|
|
19
|
+
isEmpty: c,
|
|
20
|
+
isClickable: n,
|
|
21
|
+
className: i,
|
|
22
|
+
inputRef: o,
|
|
23
|
+
listItemSecondRowClassName: a,
|
|
23
24
|
...t
|
|
24
25
|
}) => {
|
|
25
|
-
const { searchTerm:
|
|
26
|
+
const { searchTerm: m, highlightSearchEnabled: h, setValue: p, toggleOpen: x } = V(), b = I(null), f = u(
|
|
26
27
|
(e) => {
|
|
27
|
-
|
|
28
|
+
p(e.value, o), x(!1);
|
|
28
29
|
},
|
|
29
|
-
[
|
|
30
|
-
),
|
|
31
|
-
(e,
|
|
32
|
-
e.key === "Enter" && (e.stopPropagation(),
|
|
30
|
+
[p, x]
|
|
31
|
+
), w = u(
|
|
32
|
+
(e, r) => {
|
|
33
|
+
e.key === "Enter" && (e.stopPropagation(), f(r));
|
|
33
34
|
},
|
|
34
|
-
[
|
|
35
|
-
),
|
|
36
|
-
({ label: e, rightComponent:
|
|
35
|
+
[f]
|
|
36
|
+
), N = u(
|
|
37
|
+
({ label: e, rightComponent: r, subLabel: g, rightComponentClassName: C }) => {
|
|
38
|
+
if (c)
|
|
39
|
+
return /* @__PURE__ */ s(
|
|
40
|
+
y,
|
|
41
|
+
{
|
|
42
|
+
variant: "body2",
|
|
43
|
+
className: "text-zinc-800 dark:text-slate-50 italic",
|
|
44
|
+
children: e
|
|
45
|
+
}
|
|
46
|
+
);
|
|
37
47
|
if (typeof e != "string")
|
|
38
48
|
return e;
|
|
39
|
-
const
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
|
|
49
|
+
const k = h && m.length > 0 ? j(e, m) : [e];
|
|
50
|
+
return /* @__PURE__ */ d(
|
|
51
|
+
y,
|
|
42
52
|
{
|
|
43
53
|
variant: "body2",
|
|
44
54
|
className: "text-zinc-700 dark:text-slate-50 font-medium",
|
|
45
55
|
children: [
|
|
46
|
-
|
|
56
|
+
r ? /* @__PURE__ */ d(
|
|
47
57
|
"span",
|
|
48
58
|
{
|
|
49
|
-
className:
|
|
59
|
+
className: l("flex gap-2 items-center", C),
|
|
50
60
|
children: [
|
|
51
|
-
|
|
61
|
+
k,
|
|
52
62
|
" ",
|
|
53
|
-
|
|
63
|
+
r
|
|
54
64
|
]
|
|
55
65
|
}
|
|
56
|
-
) :
|
|
57
|
-
g ? /* @__PURE__ */
|
|
66
|
+
) : k,
|
|
67
|
+
g ? /* @__PURE__ */ s(
|
|
58
68
|
"span",
|
|
59
69
|
{
|
|
60
|
-
className:
|
|
70
|
+
className: l(
|
|
61
71
|
"block font-normal text-sm text-slate-800 dark:text-slate-50",
|
|
62
|
-
|
|
72
|
+
a
|
|
63
73
|
),
|
|
64
74
|
children: g
|
|
65
75
|
}
|
|
@@ -68,25 +78,25 @@ const P = ({
|
|
|
68
78
|
}
|
|
69
79
|
);
|
|
70
80
|
},
|
|
71
|
-
[
|
|
81
|
+
[h, m]
|
|
72
82
|
);
|
|
73
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ d(
|
|
74
84
|
"li",
|
|
75
85
|
{
|
|
76
|
-
ref:
|
|
86
|
+
ref: b,
|
|
77
87
|
role: "option",
|
|
78
88
|
"data-action": "false",
|
|
79
|
-
className:
|
|
89
|
+
className: l(L({ className: i })),
|
|
80
90
|
tabIndex: 0,
|
|
81
91
|
onClick: (e) => {
|
|
82
|
-
|
|
92
|
+
n && (f(t), e.stopPropagation());
|
|
83
93
|
},
|
|
84
|
-
onKeyDown: (e) =>
|
|
94
|
+
onKeyDown: (e) => w(e, t),
|
|
85
95
|
children: [
|
|
86
|
-
t.leftIcon ? /* @__PURE__ */
|
|
96
|
+
t.leftIcon ? /* @__PURE__ */ s(
|
|
87
97
|
"span",
|
|
88
98
|
{
|
|
89
|
-
className:
|
|
99
|
+
className: l(
|
|
90
100
|
"w-4 h-4 flex justify-center",
|
|
91
101
|
{
|
|
92
102
|
"items-center": !t.subLabel,
|
|
@@ -97,11 +107,11 @@ const P = ({
|
|
|
97
107
|
children: t.leftIcon
|
|
98
108
|
}
|
|
99
109
|
) : null,
|
|
100
|
-
|
|
110
|
+
N(t)
|
|
101
111
|
]
|
|
102
112
|
}
|
|
103
113
|
);
|
|
104
114
|
};
|
|
105
115
|
export {
|
|
106
|
-
|
|
116
|
+
K as ListItem
|
|
107
117
|
};
|