@konstructio/ui 0.1.2-alpha.104 → 0.1.2-alpha.105
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/Wrapper-R8fik3ah.js +182 -0
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/components/Wrapper.js +1 -1
- package/dist/components/Select/components/index.js +1 -1
- package/dist/components/Select/hooks/useSelect.js +31 -43
- package/dist/lib/components/Select/hooks/useSelect.d.ts +1 -3
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/Wrapper-BhqUVI1G.js +0 -171
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { t as r } from "./utils-Cx-WzRZF.js";
|
|
2
|
+
import { LoaderIcon as oe } from "./assets/icons/components/Loader.js";
|
|
3
|
+
import { t as se } from "./createLucideIcon-MbzNWCaI.js";
|
|
4
|
+
import { t as ie } from "./chevron-up-Bjpvg6ui.js";
|
|
5
|
+
import { Typography as ce } from "./components/Typography/Typography.js";
|
|
6
|
+
import { useSelectContext as ue } from "./components/Select/contexts/select.hook.js";
|
|
7
|
+
import { List as me } from "./components/Select/components/List/List.js";
|
|
8
|
+
import { inputVariants as fe, labelVariants as pe, selectVariants as de } from "./components/Select/Select.variants.js";
|
|
9
|
+
import { useSelect as xe } from "./components/Select/hooks/useSelect.js";
|
|
10
|
+
import { forwardRef as he, useEffect as we, useId as Ne, useImperativeHandle as ge, useMemo as ve, useRef as h } from "react";
|
|
11
|
+
import { jsx as n, jsxs as i } from "react/jsx-runtime";
|
|
12
|
+
var ye = [["path", {
|
|
13
|
+
d: "m21 21-4.34-4.34",
|
|
14
|
+
key: "14j7rj"
|
|
15
|
+
}], ["circle", {
|
|
16
|
+
cx: "11",
|
|
17
|
+
cy: "11",
|
|
18
|
+
r: "8",
|
|
19
|
+
key: "4ej97u"
|
|
20
|
+
}]], ke = se("search", ye), Se = he(({ additionalOptions: R, className: D, defaultValue: w, disabled: a = !1, error: p, groupedOptions: T, iconClassName: S, inputClassName: E, isInfiniteScrollEnabled: F = !1, isLoading: k, isRequired: N, label: g, labelAction: K, labelClassName: M, labelWrapperClassName: W, listClassName: _, listItemClassName: $, listItemSecondRowClassName: q, name: d, noOptionsText: A, placeholder: v, searchable: C = !1, showSearchIcon: y, theme: H, visibleItems: P, wrapperClassName: U, onFetchMoreOptions: B, onBlur: G, onSearchChange: J, ...I }, Q) => {
|
|
21
|
+
const j = Ne(), c = h(null), L = h(null), O = h(null), X = h(0), { isOpen: o, options: l, searchTerm: Y, value: s, setCanFilter: Z, setSearchTerm: ee, setValue: u, toggleOpen: te } = ue(), t = ve(() => l.find(({ value: e }) => e === s), [l, s]), { wrapperRef: ae, wrapperInputRef: V, handleOpen: x } = xe({
|
|
22
|
+
inputRef: c,
|
|
23
|
+
searchInputRef: L,
|
|
24
|
+
internalValue: t,
|
|
25
|
+
onBlur: G
|
|
26
|
+
}), b = () => {
|
|
27
|
+
if (!a) {
|
|
28
|
+
if (o) {
|
|
29
|
+
te(!1);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
x();
|
|
33
|
+
}
|
|
34
|
+
}, re = (e) => {
|
|
35
|
+
if (!a) {
|
|
36
|
+
if (e.key === "ArrowDown") {
|
|
37
|
+
if (e.preventDefault(), !o) {
|
|
38
|
+
x();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
O.current?.querySelector("li")?.focus();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
|
|
45
|
+
}
|
|
46
|
+
}, m = d ? `${j}-${d}` : j;
|
|
47
|
+
ge(Q, () => c.current, [c]), we(() => {
|
|
48
|
+
if (w && !s) {
|
|
49
|
+
const e = l && l.find((f) => f.value === w);
|
|
50
|
+
e && u(e.value);
|
|
51
|
+
}
|
|
52
|
+
}, [
|
|
53
|
+
w,
|
|
54
|
+
l,
|
|
55
|
+
u,
|
|
56
|
+
s
|
|
57
|
+
]);
|
|
58
|
+
const ne = (e) => {
|
|
59
|
+
const f = e.target.value;
|
|
60
|
+
Z(!0), u(""), ee(f ?? ""), J?.(f);
|
|
61
|
+
const z = l.find((le) => le.value.toLocaleLowerCase() === f.toLocaleLowerCase());
|
|
62
|
+
u(z ? z.value : t?.value ?? "");
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ i("div", {
|
|
65
|
+
ref: ae,
|
|
66
|
+
className: r("flex flex-col gap-2 w-full relative", U),
|
|
67
|
+
"data-theme": H,
|
|
68
|
+
children: [
|
|
69
|
+
g ? /* @__PURE__ */ i("div", {
|
|
70
|
+
className: r("flex items-center justify-between", W),
|
|
71
|
+
children: [/* @__PURE__ */ i("label", {
|
|
72
|
+
id: m,
|
|
73
|
+
className: r(pe({ className: M })),
|
|
74
|
+
htmlFor: m,
|
|
75
|
+
onClick: () => !a && x(),
|
|
76
|
+
children: [g, N && /* @__PURE__ */ n("span", {
|
|
77
|
+
className: "text-red-600 dark:text-red-500 ml-1",
|
|
78
|
+
children: "*"
|
|
79
|
+
})]
|
|
80
|
+
}), K]
|
|
81
|
+
}) : null,
|
|
82
|
+
/* @__PURE__ */ i("div", {
|
|
83
|
+
ref: V,
|
|
84
|
+
id: m,
|
|
85
|
+
className: r(de({
|
|
86
|
+
className: D,
|
|
87
|
+
hasError: !!p,
|
|
88
|
+
disabled: a
|
|
89
|
+
})),
|
|
90
|
+
role: "combobox",
|
|
91
|
+
onClick: b,
|
|
92
|
+
onKeyDown: re,
|
|
93
|
+
"aria-expanded": o,
|
|
94
|
+
tabIndex: X.current,
|
|
95
|
+
"aria-labelledby": m,
|
|
96
|
+
children: [/* @__PURE__ */ i("div", {
|
|
97
|
+
className: "flex gap-2.5 items-center flex-1",
|
|
98
|
+
children: [
|
|
99
|
+
t?.leftIcon && !y && /* @__PURE__ */ n("span", {
|
|
100
|
+
className: "w-4 h-4 flex justify-center items-center dark:text-metal-50",
|
|
101
|
+
children: t.leftIcon
|
|
102
|
+
}),
|
|
103
|
+
y && /* @__PURE__ */ n(ke, { className: r("w-4", "h-4", "text-zinc-500", "select-none", "transition-colors", "duration-300", "dark:text-metal-300", "dark:group-focus-within:text-metal-50") }),
|
|
104
|
+
C ? /* @__PURE__ */ n("input", {
|
|
105
|
+
ref: L,
|
|
106
|
+
type: "text",
|
|
107
|
+
value: o ? Y : t?.label ?? s ?? "",
|
|
108
|
+
onChange: ne,
|
|
109
|
+
placeholder: v,
|
|
110
|
+
className: r(fe({ className: E }), { "text-red-700 placeholder:text-red-700": !!p }),
|
|
111
|
+
onClick: (e) => {
|
|
112
|
+
e.stopPropagation(), a || x();
|
|
113
|
+
},
|
|
114
|
+
"aria-label": g || v,
|
|
115
|
+
"aria-labelledby": m,
|
|
116
|
+
required: N,
|
|
117
|
+
autoComplete: "off",
|
|
118
|
+
autoCapitalize: "words",
|
|
119
|
+
disabled: a,
|
|
120
|
+
tabIndex: -1,
|
|
121
|
+
...I
|
|
122
|
+
}) : /* @__PURE__ */ i(ce, {
|
|
123
|
+
variant: "body2",
|
|
124
|
+
className: r("flex-1 text-zinc-400 text-sm dark:text-metal-400 flex gap-2 items-center", {
|
|
125
|
+
"text-red-700": !!p,
|
|
126
|
+
"select-none": !t,
|
|
127
|
+
"text-metal-800 dark:text-metal-50": t,
|
|
128
|
+
"text-metal-400/50 dark:text-metal-50/50": a
|
|
129
|
+
}, t?.wrapperClassNameOnSelectedValue),
|
|
130
|
+
children: [
|
|
131
|
+
t?.label || v,
|
|
132
|
+
" ",
|
|
133
|
+
t?.showRightComponentOnselectedValue ? t?.rightComponent : null
|
|
134
|
+
]
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
}), k ? /* @__PURE__ */ n(oe, {
|
|
138
|
+
size: 16,
|
|
139
|
+
className: "text-metal-400 animate-spin select-none"
|
|
140
|
+
}) : !y && /* @__PURE__ */ n(ie, {
|
|
141
|
+
"data-state": o ? "open" : "closed",
|
|
142
|
+
className: r("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-metal-50", S, {
|
|
143
|
+
"text-red-700": !!p,
|
|
144
|
+
"text-metal-400/50 dark:group-focus-within:text-zinc-500": a
|
|
145
|
+
})
|
|
146
|
+
})]
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ n("input", {
|
|
149
|
+
ref: c,
|
|
150
|
+
type: "text",
|
|
151
|
+
name: d,
|
|
152
|
+
className: "hidden",
|
|
153
|
+
"aria-hidden": "true",
|
|
154
|
+
required: N,
|
|
155
|
+
inert: !0,
|
|
156
|
+
defaultValue: t?.value ?? s ?? void 0,
|
|
157
|
+
...I
|
|
158
|
+
}),
|
|
159
|
+
o && /* @__PURE__ */ n(me, {
|
|
160
|
+
ref: O,
|
|
161
|
+
additionalOptions: R,
|
|
162
|
+
className: _,
|
|
163
|
+
groupedOptions: T,
|
|
164
|
+
itemClassName: $,
|
|
165
|
+
name: d,
|
|
166
|
+
wrapperInputRef: V,
|
|
167
|
+
inputRef: c,
|
|
168
|
+
options: l,
|
|
169
|
+
isLoading: !!k,
|
|
170
|
+
searchable: C,
|
|
171
|
+
listItemSecondRowClassName: q,
|
|
172
|
+
isInfiniteScrollEnabled: F,
|
|
173
|
+
onFetchMoreOptions: B,
|
|
174
|
+
noOptionsText: A,
|
|
175
|
+
visibleItems: P
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
export {
|
|
181
|
+
Se as t
|
|
182
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as a } from "../../utils-Cx-WzRZF.js";
|
|
2
|
-
import { t as h } from "../../Wrapper-
|
|
2
|
+
import { t as h } from "../../Wrapper-R8fik3ah.js";
|
|
3
3
|
import { SelectProvider as v } from "./contexts/select.provider.js";
|
|
4
4
|
import { n as N } from "../../AdditionalOptions-D0BAS2HG.js";
|
|
5
5
|
import { forwardRef as g, useMemo as j } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as o } from "../../../Wrapper-
|
|
1
|
+
import { t as o } from "../../../Wrapper-R8fik3ah.js";
|
|
2
2
|
import { t as i } from "../../../AdditionalOptions-D0BAS2HG.js";
|
|
3
3
|
import { EmptyList as p } from "./EmptyList.js";
|
|
4
4
|
import { List as a } from "./List/List.js";
|
|
@@ -1,68 +1,56 @@
|
|
|
1
|
-
import { useClickOutside as
|
|
2
|
-
import { useSelectContext as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
}, [
|
|
9
|
-
const e = new AbortController(), s = (
|
|
10
|
-
|
|
1
|
+
import { useClickOutside as m } from "../../../hooks/useClickOutside.js";
|
|
2
|
+
import { useSelectContext as E } from "../contexts/select.hook.js";
|
|
3
|
+
import { useCallback as b, useEffect as l, useRef as g } from "react";
|
|
4
|
+
var h = ({ inputRef: r, searchInputRef: v, internalValue: c, onBlur: i }) => {
|
|
5
|
+
const t = g(null), d = g(null), { value: o, setSearchTerm: f, setCanFilter: u, toggleOpen: n } = E();
|
|
6
|
+
return m(t, b(() => {
|
|
7
|
+
n(!1);
|
|
8
|
+
}, [n])), l(() => {
|
|
9
|
+
const e = new AbortController(), s = (a) => {
|
|
10
|
+
a.key === "Escape" && n(!1);
|
|
11
11
|
};
|
|
12
12
|
return document.addEventListener("keydown", s, { signal: e.signal }), document.addEventListener("visibilitychange", () => {
|
|
13
|
-
document.hidden &&
|
|
14
|
-
}, { signal: e.signal }), a.current?.addEventListener("focusin", (t) => {
|
|
15
|
-
!b && t.target?.matches(":focus-visible") && r(!0);
|
|
13
|
+
document.hidden && n(!1);
|
|
16
14
|
}, { signal: e.signal }), () => {
|
|
17
15
|
e.abort();
|
|
18
16
|
};
|
|
19
|
-
}, [
|
|
17
|
+
}, [n, t]), l(() => {
|
|
20
18
|
const e = new AbortController();
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
t && t.focus();
|
|
25
|
-
}
|
|
26
|
-
}, { signal: e.signal }), () => {
|
|
27
|
-
e.abort();
|
|
28
|
-
};
|
|
29
|
-
}, [a, d]), l(() => {
|
|
30
|
-
const e = new AbortController();
|
|
31
|
-
return o?.current?.addEventListener("focusin", () => {
|
|
32
|
-
g(i?.value ?? ""), u(!1);
|
|
33
|
-
}, { signal: e.signal }), o?.current?.addEventListener("focusout", () => {
|
|
19
|
+
return r?.current?.addEventListener("focusin", () => {
|
|
20
|
+
f(c?.value ?? ""), u(!1);
|
|
21
|
+
}, { signal: e.signal }), r?.current?.addEventListener("focusout", () => {
|
|
34
22
|
u(!0);
|
|
35
|
-
}, { signal: e.signal }),
|
|
23
|
+
}, { signal: e.signal }), d.current?.addEventListener("focus", () => {
|
|
36
24
|
u(!1);
|
|
37
|
-
}, { signal: e.signal }),
|
|
38
|
-
|
|
25
|
+
}, { signal: e.signal }), t.current?.addEventListener("focusout", (s) => {
|
|
26
|
+
t.current?.contains(s.relatedTarget) || n(!1);
|
|
39
27
|
}, { signal: e.signal }), () => {
|
|
40
28
|
e.abort();
|
|
41
29
|
};
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
}, [
|
|
30
|
+
}, [o]), l(() => {
|
|
31
|
+
r?.current && (r.current.value = o && c?.value || "");
|
|
32
|
+
}, [c, o]), l(() => {
|
|
45
33
|
const e = new AbortController();
|
|
46
|
-
return
|
|
47
|
-
const
|
|
48
|
-
(!
|
|
34
|
+
return t.current?.addEventListener("focusout", (s) => {
|
|
35
|
+
const a = s.relatedTarget;
|
|
36
|
+
(!a || !t.current?.contains(a)) && (r?.current?.value || i?.());
|
|
49
37
|
}), () => {
|
|
50
38
|
e.abort();
|
|
51
39
|
};
|
|
52
40
|
}, [
|
|
53
|
-
r,
|
|
54
41
|
n,
|
|
55
|
-
|
|
42
|
+
t,
|
|
56
43
|
f,
|
|
57
|
-
|
|
44
|
+
i,
|
|
45
|
+
o
|
|
58
46
|
]), {
|
|
59
|
-
wrapperRef:
|
|
60
|
-
wrapperInputRef:
|
|
47
|
+
wrapperRef: t,
|
|
48
|
+
wrapperInputRef: d,
|
|
61
49
|
handleOpen: () => {
|
|
62
|
-
|
|
50
|
+
n(!0), requestAnimationFrame(() => v?.current?.focus());
|
|
63
51
|
}
|
|
64
52
|
};
|
|
65
53
|
};
|
|
66
54
|
export {
|
|
67
|
-
|
|
55
|
+
h as useSelect
|
|
68
56
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { ComponentRef, RefObject } from 'react';
|
|
2
2
|
import { SelectProps, Option } from '../Select.types';
|
|
3
3
|
type UseSelectParams = {
|
|
4
|
-
ulRef: RefObject<ComponentRef<'ul'> | null>;
|
|
5
4
|
inputRef?: RefObject<ComponentRef<'input'> | null>;
|
|
6
5
|
searchInputRef?: RefObject<ComponentRef<'input'> | null>;
|
|
7
|
-
disabled: boolean;
|
|
8
6
|
internalValue?: Option;
|
|
9
7
|
onBlur?: SelectProps['onBlur'];
|
|
10
8
|
};
|
|
11
|
-
export declare const useSelect: ({
|
|
9
|
+
export declare const useSelect: ({ inputRef, searchInputRef, internalValue, onBlur, }: UseSelectParams) => {
|
|
12
10
|
wrapperRef: RefObject<HTMLDivElement | null>;
|
|
13
11
|
wrapperInputRef: RefObject<HTMLDivElement | null>;
|
|
14
12
|
handleOpen: () => void;
|
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.104",
|
|
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.105",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
package/dist/Wrapper-BhqUVI1G.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { t as r } from "./utils-Cx-WzRZF.js";
|
|
2
|
-
import { LoaderIcon as le } from "./assets/icons/components/Loader.js";
|
|
3
|
-
import { t as se } from "./createLucideIcon-MbzNWCaI.js";
|
|
4
|
-
import { t as oe } from "./chevron-up-Bjpvg6ui.js";
|
|
5
|
-
import { Typography as ie } from "./components/Typography/Typography.js";
|
|
6
|
-
import { useSelectContext as ce } from "./components/Select/contexts/select.hook.js";
|
|
7
|
-
import { List as me } from "./components/Select/components/List/List.js";
|
|
8
|
-
import { inputVariants as pe, labelVariants as ue, selectVariants as fe } from "./components/Select/Select.variants.js";
|
|
9
|
-
import { useSelect as de } from "./components/Select/hooks/useSelect.js";
|
|
10
|
-
import { forwardRef as xe, useEffect as he, useId as ve, useImperativeHandle as Ne, useMemo as ge, useRef as x } from "react";
|
|
11
|
-
import { jsx as n, jsxs as o } from "react/jsx-runtime";
|
|
12
|
-
var Ce = [["path", {
|
|
13
|
-
d: "m21 21-4.34-4.34",
|
|
14
|
-
key: "14j7rj"
|
|
15
|
-
}], ["circle", {
|
|
16
|
-
cx: "11",
|
|
17
|
-
cy: "11",
|
|
18
|
-
r: "8",
|
|
19
|
-
key: "4ej97u"
|
|
20
|
-
}]], we = se("search", Ce), Fe = xe(({ additionalOptions: z, className: R, defaultValue: h, disabled: t = !1, error: f, groupedOptions: T, iconClassName: F, inputClassName: S, isInfiniteScrollEnabled: E = !1, isLoading: k, isRequired: v, label: N, labelAction: M, labelClassName: W, labelWrapperClassName: _, listClassName: $, listItemClassName: H, listItemSecondRowClassName: P, name: d, noOptionsText: U, placeholder: g, searchable: y = !1, showSearchIcon: C, theme: q, visibleItems: A, wrapperClassName: B, onFetchMoreOptions: D, onBlur: G, onSearchChange: J, ...I }, K) => {
|
|
21
|
-
const j = ve(), i = x(null), L = x(null), O = x(null), Q = x(0), { isOpen: c, options: l, searchTerm: X, value: s, setCanFilter: Y, setSearchTerm: Z, setValue: m, toggleOpen: ee } = ce(), e = ge(() => l.find(({ value: a }) => a === s), [l, s]), { wrapperRef: te, wrapperInputRef: V, handleOpen: w } = de({
|
|
22
|
-
ulRef: O,
|
|
23
|
-
inputRef: i,
|
|
24
|
-
searchInputRef: L,
|
|
25
|
-
disabled: t,
|
|
26
|
-
internalValue: e,
|
|
27
|
-
onBlur: G
|
|
28
|
-
}), ae = () => {
|
|
29
|
-
if (!t) {
|
|
30
|
-
if (c) {
|
|
31
|
-
ee(!1);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
w();
|
|
35
|
-
}
|
|
36
|
-
}, p = d ? `${j}-${d}` : j;
|
|
37
|
-
Ne(K, () => i.current, [i]), he(() => {
|
|
38
|
-
if (h && !s) {
|
|
39
|
-
const a = l && l.find((u) => u.value === h);
|
|
40
|
-
a && m(a.value);
|
|
41
|
-
}
|
|
42
|
-
}, [
|
|
43
|
-
h,
|
|
44
|
-
l,
|
|
45
|
-
m,
|
|
46
|
-
s
|
|
47
|
-
]);
|
|
48
|
-
const re = (a) => {
|
|
49
|
-
const u = a.target.value;
|
|
50
|
-
Y(!0), m(""), Z(u ?? ""), J?.(u);
|
|
51
|
-
const b = l.find((ne) => ne.value.toLocaleLowerCase() === u.toLocaleLowerCase());
|
|
52
|
-
m(b ? b.value : e?.value ?? "");
|
|
53
|
-
};
|
|
54
|
-
return /* @__PURE__ */ o("div", {
|
|
55
|
-
ref: te,
|
|
56
|
-
className: r("flex flex-col gap-2 w-full relative", B),
|
|
57
|
-
"data-theme": q,
|
|
58
|
-
children: [
|
|
59
|
-
N ? /* @__PURE__ */ o("div", {
|
|
60
|
-
className: r("flex items-center justify-between", _),
|
|
61
|
-
children: [/* @__PURE__ */ o("label", {
|
|
62
|
-
id: p,
|
|
63
|
-
className: r(ue({ className: W })),
|
|
64
|
-
htmlFor: p,
|
|
65
|
-
onClick: () => !t && w(),
|
|
66
|
-
children: [N, v && /* @__PURE__ */ n("span", {
|
|
67
|
-
className: "text-red-600 dark:text-red-500 ml-1",
|
|
68
|
-
children: "*"
|
|
69
|
-
})]
|
|
70
|
-
}), M]
|
|
71
|
-
}) : null,
|
|
72
|
-
/* @__PURE__ */ o("div", {
|
|
73
|
-
ref: V,
|
|
74
|
-
id: p,
|
|
75
|
-
className: r(fe({
|
|
76
|
-
className: R,
|
|
77
|
-
hasError: !!f,
|
|
78
|
-
disabled: t
|
|
79
|
-
})),
|
|
80
|
-
role: "combobox",
|
|
81
|
-
onClick: ae,
|
|
82
|
-
"aria-expanded": c,
|
|
83
|
-
tabIndex: Q.current,
|
|
84
|
-
"aria-labelledby": p,
|
|
85
|
-
children: [/* @__PURE__ */ o("div", {
|
|
86
|
-
className: "flex gap-2.5 items-center flex-1",
|
|
87
|
-
children: [
|
|
88
|
-
e?.leftIcon && !C && /* @__PURE__ */ n("span", {
|
|
89
|
-
className: "w-4 h-4 flex justify-center items-center dark:text-metal-50",
|
|
90
|
-
children: e.leftIcon
|
|
91
|
-
}),
|
|
92
|
-
C && /* @__PURE__ */ n(we, { className: r("w-4", "h-4", "text-zinc-500", "select-none", "transition-colors", "duration-300", "dark:text-metal-300", "dark:group-focus-within:text-metal-50") }),
|
|
93
|
-
y ? /* @__PURE__ */ n("input", {
|
|
94
|
-
ref: L,
|
|
95
|
-
type: "text",
|
|
96
|
-
value: c ? X : e?.label ?? s ?? "",
|
|
97
|
-
onChange: re,
|
|
98
|
-
placeholder: g,
|
|
99
|
-
className: r(pe({ className: S }), { "text-red-700 placeholder:text-red-700": !!f }),
|
|
100
|
-
onClick: (a) => {
|
|
101
|
-
a.stopPropagation(), t || w();
|
|
102
|
-
},
|
|
103
|
-
"aria-label": N || g,
|
|
104
|
-
"aria-labelledby": p,
|
|
105
|
-
required: v,
|
|
106
|
-
autoComplete: "off",
|
|
107
|
-
autoCapitalize: "words",
|
|
108
|
-
disabled: t,
|
|
109
|
-
tabIndex: -1,
|
|
110
|
-
...I
|
|
111
|
-
}) : /* @__PURE__ */ o(ie, {
|
|
112
|
-
variant: "body2",
|
|
113
|
-
className: r("flex-1 text-zinc-400 text-sm dark:text-metal-400 flex gap-2 items-center", {
|
|
114
|
-
"text-red-700": !!f,
|
|
115
|
-
"select-none": !e,
|
|
116
|
-
"text-metal-800 dark:text-metal-50": e,
|
|
117
|
-
"text-metal-400/50 dark:text-metal-50/50": t
|
|
118
|
-
}, e?.wrapperClassNameOnSelectedValue),
|
|
119
|
-
children: [
|
|
120
|
-
e?.label || g,
|
|
121
|
-
" ",
|
|
122
|
-
e?.showRightComponentOnselectedValue ? e?.rightComponent : null
|
|
123
|
-
]
|
|
124
|
-
})
|
|
125
|
-
]
|
|
126
|
-
}), k ? /* @__PURE__ */ n(le, {
|
|
127
|
-
size: 16,
|
|
128
|
-
className: "text-metal-400 animate-spin select-none"
|
|
129
|
-
}) : !C && /* @__PURE__ */ n(oe, {
|
|
130
|
-
"data-state": c ? "open" : "closed",
|
|
131
|
-
className: r("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-metal-50", F, {
|
|
132
|
-
"text-red-700": !!f,
|
|
133
|
-
"text-metal-400/50 dark:group-focus-within:text-zinc-500": t
|
|
134
|
-
})
|
|
135
|
-
})]
|
|
136
|
-
}),
|
|
137
|
-
/* @__PURE__ */ n("input", {
|
|
138
|
-
ref: i,
|
|
139
|
-
type: "text",
|
|
140
|
-
name: d,
|
|
141
|
-
className: "hidden",
|
|
142
|
-
"aria-hidden": "true",
|
|
143
|
-
required: v,
|
|
144
|
-
inert: !0,
|
|
145
|
-
defaultValue: e?.value ?? s ?? void 0,
|
|
146
|
-
...I
|
|
147
|
-
}),
|
|
148
|
-
c && /* @__PURE__ */ n(me, {
|
|
149
|
-
ref: O,
|
|
150
|
-
additionalOptions: z,
|
|
151
|
-
className: $,
|
|
152
|
-
groupedOptions: T,
|
|
153
|
-
itemClassName: H,
|
|
154
|
-
name: d,
|
|
155
|
-
wrapperInputRef: V,
|
|
156
|
-
inputRef: i,
|
|
157
|
-
options: l,
|
|
158
|
-
isLoading: !!k,
|
|
159
|
-
searchable: y,
|
|
160
|
-
listItemSecondRowClassName: P,
|
|
161
|
-
isInfiniteScrollEnabled: E,
|
|
162
|
-
onFetchMoreOptions: D,
|
|
163
|
-
noOptionsText: U,
|
|
164
|
-
visibleItems: A
|
|
165
|
-
})
|
|
166
|
-
]
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
export {
|
|
170
|
-
Fe as t
|
|
171
|
-
};
|