@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,24 +1,24 @@
|
|
|
1
1
|
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import {
|
|
4
|
-
import { Typography as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { labelVariants as oe, inputVariants as
|
|
7
|
-
import { useDropdown as
|
|
8
|
-
import { List as
|
|
9
|
-
import { c as
|
|
10
|
-
import { C as
|
|
2
|
+
import { forwardRef as Z, useId as ee, useRef as C, useMemo as te, useImperativeHandle as ae, useEffect as re } from "react";
|
|
3
|
+
import { L as ne } from "../../../loader-H82RiE-I.js";
|
|
4
|
+
import { Typography as se } from "../../Typography/Typography.js";
|
|
5
|
+
import { cn as o } from "../../../utils/index.js";
|
|
6
|
+
import { labelVariants as oe, inputVariants as le, dropdownVariants as ie } from "../Dropdown.variants.js";
|
|
7
|
+
import { useDropdown as ce } from "../hooks/useDropdown.js";
|
|
8
|
+
import { List as pe } from "./List/List.js";
|
|
9
|
+
import { c as ue } from "../../../createLucideIcon-D4r5Phnh.js";
|
|
10
|
+
import { C as me } from "../../../chevron-up-DrQr2Fwd.js";
|
|
11
11
|
import { useDropdownContext as fe } from "../contexts/dropdown.hook.js";
|
|
12
|
-
const
|
|
12
|
+
const de = [
|
|
13
13
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
14
14
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
15
|
-
],
|
|
15
|
+
], xe = ue("search", de), be = Z(
|
|
16
16
|
({
|
|
17
17
|
additionalOptions: V,
|
|
18
18
|
className: O,
|
|
19
19
|
defaultValue: x,
|
|
20
20
|
disabled: a = !1,
|
|
21
|
-
error:
|
|
21
|
+
error: m,
|
|
22
22
|
iconClassName: R,
|
|
23
23
|
inputClassName: F,
|
|
24
24
|
isLoading: k,
|
|
@@ -28,9 +28,9 @@ const me = [
|
|
|
28
28
|
listClassName: D,
|
|
29
29
|
listItemClassName: E,
|
|
30
30
|
listItemSecondRowClassName: M,
|
|
31
|
-
name:
|
|
31
|
+
name: f,
|
|
32
32
|
placeholder: N,
|
|
33
|
-
searchable:
|
|
33
|
+
searchable: y = !1,
|
|
34
34
|
showSearchIcon: w,
|
|
35
35
|
theme: W,
|
|
36
36
|
wrapperClassName: _,
|
|
@@ -38,52 +38,53 @@ const me = [
|
|
|
38
38
|
onFetchMoreOptions: H,
|
|
39
39
|
onBlur: P,
|
|
40
40
|
onSearchChange: U,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
noOptionsText: q,
|
|
42
|
+
...g
|
|
43
|
+
}, A) => {
|
|
44
|
+
const I = ee(), l = C(null), L = C(null), B = C(0), {
|
|
44
45
|
isOpen: i,
|
|
45
|
-
searchTerm:
|
|
46
|
-
value:
|
|
46
|
+
searchTerm: G,
|
|
47
|
+
value: s,
|
|
47
48
|
options: n,
|
|
48
49
|
setValue: c,
|
|
49
|
-
setSearchTerm:
|
|
50
|
-
setCanFilter:
|
|
51
|
-
toggleOpen:
|
|
52
|
-
} = fe(), e =
|
|
50
|
+
setSearchTerm: J,
|
|
51
|
+
setCanFilter: K,
|
|
52
|
+
toggleOpen: Q
|
|
53
|
+
} = fe(), e = te(() => n.find(({ value: r }) => r === s), [n, s]), { wrapperRef: S, wrapperInputRef: j, handleOpen: b } = ce({
|
|
53
54
|
ulRef: L,
|
|
54
55
|
inputRef: l,
|
|
55
56
|
disabled: a,
|
|
56
57
|
internalValue: e,
|
|
57
58
|
onBlur: P
|
|
58
|
-
}), p =
|
|
59
|
-
|
|
60
|
-
if (x && !
|
|
59
|
+
}), p = f ? `${I}-${f}` : I;
|
|
60
|
+
ae(A, () => l.current, [l]), re(() => {
|
|
61
|
+
if (x && !s) {
|
|
61
62
|
const r = n && n.find((u) => u.value === x);
|
|
62
63
|
r && c(r.value);
|
|
63
64
|
}
|
|
64
|
-
}, [x, n, c,
|
|
65
|
-
const
|
|
65
|
+
}, [x, n, c, s]);
|
|
66
|
+
const X = (r) => {
|
|
66
67
|
const u = r.target.value;
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
(
|
|
68
|
+
K(!0), c(""), J(u ?? ""), U?.(u);
|
|
69
|
+
const z = n.find(
|
|
70
|
+
(Y) => Y.value.toLocaleLowerCase() === u.toLocaleLowerCase()
|
|
70
71
|
);
|
|
71
|
-
c(
|
|
72
|
+
c(z ? z.value : e?.value ?? "");
|
|
72
73
|
};
|
|
73
74
|
return /* @__PURE__ */ d(
|
|
74
75
|
"div",
|
|
75
76
|
{
|
|
76
|
-
ref:
|
|
77
|
-
className:
|
|
77
|
+
ref: S,
|
|
78
|
+
className: o("flex flex-col w-full relative", _),
|
|
78
79
|
"data-theme": W,
|
|
79
80
|
children: [
|
|
80
81
|
v ? /* @__PURE__ */ d(
|
|
81
82
|
"label",
|
|
82
83
|
{
|
|
83
84
|
id: p,
|
|
84
|
-
className:
|
|
85
|
+
className: o(oe({ className: T })),
|
|
85
86
|
htmlFor: p,
|
|
86
|
-
onClick: () => !a &&
|
|
87
|
+
onClick: () => !a && b(),
|
|
87
88
|
children: [
|
|
88
89
|
v,
|
|
89
90
|
h && /* @__PURE__ */ t("span", { className: "text-red-600 ml-1", children: "*" })
|
|
@@ -95,30 +96,30 @@ const me = [
|
|
|
95
96
|
{
|
|
96
97
|
ref: j,
|
|
97
98
|
id: p,
|
|
98
|
-
className:
|
|
99
|
-
|
|
99
|
+
className: o(
|
|
100
|
+
ie({ className: O, hasError: !!m, disabled: a })
|
|
100
101
|
),
|
|
101
102
|
role: "combobox",
|
|
102
|
-
onClick: () => !a &&
|
|
103
|
+
onClick: () => !a && Q(!i),
|
|
103
104
|
"aria-expanded": i,
|
|
104
|
-
tabIndex:
|
|
105
|
+
tabIndex: B.current,
|
|
105
106
|
"aria-labelledby": p,
|
|
106
107
|
children: [
|
|
107
108
|
/* @__PURE__ */ d("div", { className: "flex gap-2.5 items-center flex-1", children: [
|
|
108
109
|
e?.leftIcon && !w && /* @__PURE__ */ t("span", { className: "w-4 h-4 flex justify-center items-center dark:text-slate-50", children: e.leftIcon }),
|
|
109
|
-
w && /* @__PURE__ */ t(
|
|
110
|
-
|
|
110
|
+
w && /* @__PURE__ */ t(xe, { 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" }),
|
|
111
|
+
y ? /* @__PURE__ */ t(
|
|
111
112
|
"input",
|
|
112
113
|
{
|
|
113
114
|
type: "text",
|
|
114
|
-
value: i ?
|
|
115
|
-
onChange:
|
|
115
|
+
value: i ? G : e?.label ?? s ?? "",
|
|
116
|
+
onChange: X,
|
|
116
117
|
placeholder: N,
|
|
117
|
-
className:
|
|
118
|
-
"text-red-700 placeholder:text-red-700": !!
|
|
118
|
+
className: o(le({ className: F }), {
|
|
119
|
+
"text-red-700 placeholder:text-red-700": !!m
|
|
119
120
|
}),
|
|
120
121
|
onClick: (r) => {
|
|
121
|
-
r.stopPropagation(), a ||
|
|
122
|
+
r.stopPropagation(), a || b();
|
|
122
123
|
},
|
|
123
124
|
"aria-label": v || N,
|
|
124
125
|
"aria-labelledby": p,
|
|
@@ -127,16 +128,16 @@ const me = [
|
|
|
127
128
|
autoCapitalize: "words",
|
|
128
129
|
disabled: a,
|
|
129
130
|
tabIndex: -1,
|
|
130
|
-
...
|
|
131
|
+
...g
|
|
131
132
|
}
|
|
132
133
|
) : /* @__PURE__ */ t(
|
|
133
|
-
|
|
134
|
+
se,
|
|
134
135
|
{
|
|
135
136
|
variant: "body2",
|
|
136
|
-
className:
|
|
137
|
+
className: o(
|
|
137
138
|
"flex-1 text-zinc-400 text-sm dark:text-slate-400",
|
|
138
139
|
{
|
|
139
|
-
"text-red-700": !!
|
|
140
|
+
"text-red-700": !!m,
|
|
140
141
|
"select-none": !e,
|
|
141
142
|
"text-slate-800 dark:text-slate-50": e,
|
|
142
143
|
"text-slate-400/50 dark:text-slate-50/50": a
|
|
@@ -146,15 +147,15 @@ const me = [
|
|
|
146
147
|
}
|
|
147
148
|
)
|
|
148
149
|
] }),
|
|
149
|
-
k ? /* @__PURE__ */ t(
|
|
150
|
-
|
|
150
|
+
k ? /* @__PURE__ */ t(ne, { className: "w-4 h-4 text-slate-400 animate-spin select-none" }) : !w && /* @__PURE__ */ t(
|
|
151
|
+
me,
|
|
151
152
|
{
|
|
152
153
|
"data-state": i ? "open" : "closed",
|
|
153
|
-
className:
|
|
154
|
+
className: o(
|
|
154
155
|
"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",
|
|
155
156
|
R,
|
|
156
157
|
{
|
|
157
|
-
"text-red-700": !!
|
|
158
|
+
"text-red-700": !!m,
|
|
158
159
|
"text-slate-400/50 dark:group-focus-within:text-zinc-500": a
|
|
159
160
|
}
|
|
160
161
|
)
|
|
@@ -168,31 +169,32 @@ const me = [
|
|
|
168
169
|
{
|
|
169
170
|
ref: l,
|
|
170
171
|
type: "text",
|
|
171
|
-
name:
|
|
172
|
+
name: f,
|
|
172
173
|
className: "hidden",
|
|
173
174
|
"aria-hidden": "true",
|
|
174
175
|
required: h,
|
|
175
176
|
inert: !0,
|
|
176
|
-
defaultValue: e?.value ??
|
|
177
|
-
...
|
|
177
|
+
defaultValue: e?.value ?? s ?? void 0,
|
|
178
|
+
...g
|
|
178
179
|
}
|
|
179
180
|
),
|
|
180
181
|
i && /* @__PURE__ */ t(
|
|
181
|
-
|
|
182
|
+
pe,
|
|
182
183
|
{
|
|
183
184
|
ref: L,
|
|
184
185
|
additionalOptions: V,
|
|
185
186
|
className: D,
|
|
186
187
|
itemClassName: E,
|
|
187
|
-
name:
|
|
188
|
+
name: f,
|
|
188
189
|
wrapperInputRef: j,
|
|
189
190
|
inputRef: l,
|
|
190
191
|
options: n,
|
|
191
192
|
isLoading: !!k,
|
|
192
|
-
searchable:
|
|
193
|
+
searchable: y,
|
|
193
194
|
listItemSecondRowClassName: M,
|
|
194
195
|
isInfiniteScrollEnabled: $,
|
|
195
|
-
onFetchMoreOptions: H
|
|
196
|
+
onFetchMoreOptions: H,
|
|
197
|
+
noOptionsText: q
|
|
196
198
|
}
|
|
197
199
|
)
|
|
198
200
|
]
|
|
@@ -201,5 +203,5 @@ const me = [
|
|
|
201
203
|
}
|
|
202
204
|
);
|
|
203
205
|
export {
|
|
204
|
-
|
|
206
|
+
be as Wrapper
|
|
205
207
|
};
|