@konstructio/ui 0.1.2-alpha.19 → 0.1.2-alpha.20
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,30 +1,30 @@
|
|
|
1
1
|
import { jsxs as x, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Loading as
|
|
4
|
-
import { Typography as
|
|
2
|
+
import { forwardRef as X, useId as Y, useRef as T, useImperativeHandle as Z, useMemo as B, useEffect as z } from "react";
|
|
3
|
+
import { Loading as ee } from "../../Loading/Loading.js";
|
|
4
|
+
import { Typography as te } from "../../Typography/Typography.js";
|
|
5
5
|
import { cn as c } from "../../../utils/index.js";
|
|
6
|
-
import { labelVariants as
|
|
7
|
-
import { useDropdown as
|
|
8
|
-
import { List as
|
|
6
|
+
import { labelVariants as ae, inputVariants as re, dropdownVariants as ne } from "../Dropdown.variants.js";
|
|
7
|
+
import { useDropdown as oe } from "../hooks/useDropdown.js";
|
|
8
|
+
import { List as le } from "./List/List.js";
|
|
9
9
|
import { c as V } from "../../../createLucideIcon-DGhJ8Z4k.js";
|
|
10
|
-
import { useDropdownContext as
|
|
10
|
+
import { useDropdownContext as se } from "../contexts/dropdown.hook.js";
|
|
11
11
|
/**
|
|
12
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 ce = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], ie = V("chevron-up", ce);
|
|
18
18
|
/**
|
|
19
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 ue = [
|
|
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
|
+
], fe = V("search", ue), ge = X(
|
|
28
28
|
({
|
|
29
29
|
additionalOptions: _,
|
|
30
30
|
className: $,
|
|
@@ -44,19 +44,20 @@ const ie = [
|
|
|
44
44
|
options: o,
|
|
45
45
|
placeholder: N,
|
|
46
46
|
searchable: k = !1,
|
|
47
|
+
onSearchChange: U,
|
|
47
48
|
showSearchIcon: C,
|
|
48
|
-
theme:
|
|
49
|
-
wrapperClassName:
|
|
49
|
+
theme: W,
|
|
50
|
+
wrapperClassName: q,
|
|
50
51
|
onBlur: I,
|
|
51
52
|
...b
|
|
52
|
-
},
|
|
53
|
-
const E =
|
|
53
|
+
}, G) => {
|
|
54
|
+
const E = Y(), t = T(null), O = T(null), { wrapperRef: u, wrapperInputRef: R, handleOpen: g } = oe({
|
|
54
55
|
ulRef: O,
|
|
55
56
|
inputRef: t,
|
|
56
57
|
disabled: r
|
|
57
|
-
}), { isOpen: p, searchTerm:
|
|
58
|
-
|
|
59
|
-
const n =
|
|
58
|
+
}), { isOpen: p, searchTerm: J, value: l, toggleOpen: K, setValue: y, setSearchTerm: L } = se(), f = i ? `${E}-${i}` : E;
|
|
59
|
+
Z(G, () => t.current, [t]);
|
|
60
|
+
const n = B(() => o.find(({ value: e }) => e === l), [o, l]);
|
|
60
61
|
z(() => {
|
|
61
62
|
t.current && (t.current.value = l ? n?.value : "");
|
|
62
63
|
}, [n, l]), z(() => {
|
|
@@ -72,12 +73,12 @@ const ie = [
|
|
|
72
73
|
}), () => {
|
|
73
74
|
e.abort();
|
|
74
75
|
};
|
|
75
|
-
}, [
|
|
76
|
-
const
|
|
76
|
+
}, [K, u, L, I, l]);
|
|
77
|
+
const Q = (e) => {
|
|
77
78
|
const s = e.target.value;
|
|
78
|
-
L(s);
|
|
79
|
+
U?.(s), L(s);
|
|
79
80
|
const d = o.find(
|
|
80
|
-
(
|
|
81
|
+
(S) => S.value.toLocaleLowerCase() === s.toLocaleLowerCase()
|
|
81
82
|
);
|
|
82
83
|
d && y(d.value);
|
|
83
84
|
};
|
|
@@ -85,14 +86,14 @@ const ie = [
|
|
|
85
86
|
"div",
|
|
86
87
|
{
|
|
87
88
|
ref: u,
|
|
88
|
-
className: c("flex flex-col w-full relative",
|
|
89
|
-
"data-theme":
|
|
89
|
+
className: c("flex flex-col w-full relative", q),
|
|
90
|
+
"data-theme": W,
|
|
90
91
|
children: [
|
|
91
92
|
w ? /* @__PURE__ */ x(
|
|
92
93
|
"label",
|
|
93
94
|
{
|
|
94
95
|
id: f,
|
|
95
|
-
className: c(
|
|
96
|
+
className: c(ae({ className: M })),
|
|
96
97
|
htmlFor: f,
|
|
97
98
|
onClick: () => !r && g(),
|
|
98
99
|
children: [
|
|
@@ -107,7 +108,7 @@ const ie = [
|
|
|
107
108
|
ref: R,
|
|
108
109
|
id: f,
|
|
109
110
|
className: c(
|
|
110
|
-
|
|
111
|
+
ne({ className: $, hasError: !!m, disabled: r })
|
|
111
112
|
),
|
|
112
113
|
role: "combobox",
|
|
113
114
|
onClick: () => !r && g(),
|
|
@@ -117,17 +118,17 @@ const ie = [
|
|
|
117
118
|
children: [
|
|
118
119
|
/* @__PURE__ */ x("div", { className: "flex gap-2.5 items-center flex-1", children: [
|
|
119
120
|
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(
|
|
121
|
+
C && /* @__PURE__ */ a(fe, { 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
122
|
k ? /* @__PURE__ */ a(
|
|
122
123
|
"input",
|
|
123
124
|
{
|
|
124
125
|
ref: t,
|
|
125
126
|
type: "text",
|
|
126
|
-
value: p ?
|
|
127
|
+
value: p ? J : n?.label || "",
|
|
127
128
|
name: i,
|
|
128
|
-
onChange:
|
|
129
|
+
onChange: Q,
|
|
129
130
|
placeholder: N,
|
|
130
|
-
className: c(
|
|
131
|
+
className: c(re({ className: F }), {
|
|
131
132
|
"text-red-700 placeholder:text-red-700": !!m
|
|
132
133
|
}),
|
|
133
134
|
onClick: (e) => {
|
|
@@ -142,7 +143,7 @@ const ie = [
|
|
|
142
143
|
...b
|
|
143
144
|
}
|
|
144
145
|
) : /* @__PURE__ */ a(
|
|
145
|
-
|
|
146
|
+
te,
|
|
146
147
|
{
|
|
147
148
|
variant: "body2",
|
|
148
149
|
className: c(
|
|
@@ -158,8 +159,8 @@ const ie = [
|
|
|
158
159
|
}
|
|
159
160
|
)
|
|
160
161
|
] }),
|
|
161
|
-
j ? /* @__PURE__ */ a(
|
|
162
|
-
|
|
162
|
+
j ? /* @__PURE__ */ a(ee, { className: "w-4 h-4 text-zinc-500 select-none" }) : !C && /* @__PURE__ */ a(
|
|
163
|
+
ie,
|
|
163
164
|
{
|
|
164
165
|
"data-state": p ? "open" : "closed",
|
|
165
166
|
className: c(
|
|
@@ -189,7 +190,7 @@ const ie = [
|
|
|
189
190
|
}
|
|
190
191
|
),
|
|
191
192
|
p && /* @__PURE__ */ a(
|
|
192
|
-
|
|
193
|
+
le,
|
|
193
194
|
{
|
|
194
195
|
ref: O,
|
|
195
196
|
additionalOptions: _,
|
|
@@ -211,5 +212,5 @@ const ie = [
|
|
|
211
212
|
}
|
|
212
213
|
);
|
|
213
214
|
export {
|
|
214
|
-
|
|
215
|
+
ge as Wrapper
|
|
215
216
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -239,6 +239,7 @@ declare type DropdownProps = VariantProps<typeof dropdownVariants> & Omit<InputH
|
|
|
239
239
|
wrapperClassName?: string;
|
|
240
240
|
onBlur?: VoidFunction;
|
|
241
241
|
onChange?: OnChangeFn;
|
|
242
|
+
onSearchChange?: (searchTerm: string) => void;
|
|
242
243
|
};
|
|
243
244
|
|
|
244
245
|
declare const dropdownVariants: (props?: ({
|
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.2-alpha.
|
|
5
|
+
"version": "0.1.2-alpha.19",
|
|
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.2-alpha.
|
|
5
|
+
"version": "0.1.2-alpha.20",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|