lawgic-dev-kit 0.21.0 → 0.21.6
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/atoms/SelectInput/SelectInput.d.ts +1 -1
- package/dist/components/atoms/SelectInput/SelectInput.js +85 -75
- package/dist/components/atoms/SelectInput/SelectInput.types.d.ts +9 -2
- package/dist/components/atoms/UncontrolledSelector/UncontrolledSelector.d.ts +6 -2
- package/dist/components/atoms/UncontrolledSelector/UncontrolledSelector.js +58 -54
- package/dist/lawgic-dev-kit.css +1 -1
- package/dist/lawgic-dev-kit.umd.js +44 -44
- package/dist/src/components/atoms/SelectInput/SelectInput.d.ts +4 -0
- package/dist/src/components/atoms/SelectInput/SelectInput.types.d.ts +31 -0
- package/dist/src/components/atoms/UncontrolledSelector/UncontrolledSelector.d.ts +22 -0
- package/dist/types/toast.d.ts +2 -2
- package/dist/utils/toast.js +44 -40
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FieldValues } from 'react-hook-form';
|
|
2
2
|
import { SelectInputProps } from './SelectInput.types';
|
|
3
|
-
declare const SelectInput: <T extends FieldValues>({ options, name, control, label, placeholder, className, input, }: SelectInputProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const SelectInput: <T extends FieldValues>({ options, name, control, label, placeholder, className, input, dropdownStyle, innerClassName, showChevron, }: SelectInputProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default SelectInput;
|
|
@@ -1,115 +1,124 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Controller as
|
|
5
|
-
import { useTheme as
|
|
6
|
-
import { autoUpdate as
|
|
7
|
-
import { offset as
|
|
8
|
-
const
|
|
2
|
+
import { useFloating as Y, useClick as _, useDismiss as q, useInteractions as G, useTransitionStyles as J } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
|
|
3
|
+
import { useState as N, useRef as S, useEffect as K } from "react";
|
|
4
|
+
import { Controller as Q } from "react-hook-form";
|
|
5
|
+
import { useTheme as V } from "../../../hooks/useTheme.js";
|
|
6
|
+
import { autoUpdate as X } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
7
|
+
import { offset as Z, flip as ee, shift as te, size as se, arrow as re } from "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
|
|
8
|
+
const pe = ({
|
|
9
9
|
options: c,
|
|
10
10
|
name: l,
|
|
11
11
|
control: p,
|
|
12
|
-
label:
|
|
13
|
-
placeholder:
|
|
12
|
+
label: x = "Select an option",
|
|
13
|
+
placeholder: m = "Type to search...",
|
|
14
14
|
className: r = "",
|
|
15
|
-
input: h = !0
|
|
15
|
+
input: h = !0,
|
|
16
|
+
dropdownStyle: f = {},
|
|
17
|
+
innerClassName: g = "",
|
|
18
|
+
showChevron: b = !0
|
|
16
19
|
}) => /* @__PURE__ */ e.jsx(
|
|
17
|
-
|
|
20
|
+
Q,
|
|
18
21
|
{
|
|
19
22
|
name: l,
|
|
20
23
|
control: p,
|
|
21
|
-
render: ({ field: { onChange:
|
|
22
|
-
|
|
24
|
+
render: ({ field: { onChange: y, value: n }, fieldState: { error: s } }) => /* @__PURE__ */ e.jsx(
|
|
25
|
+
ne,
|
|
23
26
|
{
|
|
24
27
|
options: c,
|
|
25
|
-
value:
|
|
26
|
-
onChange:
|
|
27
|
-
label:
|
|
28
|
-
placeholder:
|
|
28
|
+
value: n,
|
|
29
|
+
onChange: y,
|
|
30
|
+
label: x,
|
|
31
|
+
placeholder: m,
|
|
29
32
|
error: s == null ? void 0 : s.message,
|
|
30
33
|
className: r,
|
|
31
|
-
input: h
|
|
34
|
+
input: h,
|
|
35
|
+
dropdownStyle: f,
|
|
36
|
+
innerClassName: g,
|
|
37
|
+
showChevron: b
|
|
32
38
|
}
|
|
33
39
|
)
|
|
34
40
|
}
|
|
35
|
-
),
|
|
41
|
+
), ne = ({
|
|
36
42
|
options: c,
|
|
37
43
|
value: l,
|
|
38
44
|
onChange: p,
|
|
39
|
-
label:
|
|
40
|
-
placeholder:
|
|
45
|
+
label: x = "Select an option",
|
|
46
|
+
placeholder: m = "Type to search...",
|
|
41
47
|
error: r,
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
input: h = !0,
|
|
49
|
+
className: f = "",
|
|
50
|
+
dropdownStyle: g = {},
|
|
51
|
+
innerClassName: b = "",
|
|
52
|
+
showChevron: y = !0
|
|
44
53
|
}) => {
|
|
45
|
-
const { t:
|
|
54
|
+
const { t: n } = V(), [s, j] = N(!1), [a, k] = N(""), [i, C] = N(
|
|
46
55
|
l || null
|
|
47
|
-
),
|
|
56
|
+
), v = S(null), M = S(null), { x: T, y: $, strategy: O, refs: d, context: w } = Y({
|
|
48
57
|
open: s,
|
|
49
|
-
onOpenChange:
|
|
58
|
+
onOpenChange: j,
|
|
50
59
|
middleware: [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
apply({ availableHeight: t, elements:
|
|
56
|
-
Object.assign(
|
|
60
|
+
Z(8),
|
|
61
|
+
ee(),
|
|
62
|
+
te({ padding: 8 }),
|
|
63
|
+
se({
|
|
64
|
+
apply({ availableHeight: t, elements: o }) {
|
|
65
|
+
Object.assign(o.floating.style, {
|
|
57
66
|
maxHeight: `${Math.min(t - 10, 300)}px`
|
|
58
67
|
});
|
|
59
68
|
},
|
|
60
69
|
padding: 8
|
|
61
70
|
}),
|
|
62
|
-
|
|
71
|
+
re({ element: M })
|
|
63
72
|
],
|
|
64
73
|
placement: "bottom-start",
|
|
65
|
-
whileElementsMounted:
|
|
66
|
-
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
]), { isMounted:
|
|
74
|
+
whileElementsMounted: X
|
|
75
|
+
}), P = _(w), R = q(w), { getReferenceProps: z, getFloatingProps: F } = G([
|
|
76
|
+
P,
|
|
77
|
+
R
|
|
78
|
+
]), { isMounted: I, styles: W } = J(w, {
|
|
70
79
|
duration: { open: 200, close: 150 },
|
|
71
80
|
initial: { opacity: 0, transform: "translateY(-4px)" }
|
|
72
|
-
}),
|
|
81
|
+
}), L = (() => {
|
|
73
82
|
const t = Array.isArray(c) ? c : [];
|
|
74
83
|
if (!a.trim()) return t;
|
|
75
|
-
const
|
|
84
|
+
const o = a.toLowerCase();
|
|
76
85
|
return t.filter((u) => {
|
|
77
|
-
const
|
|
78
|
-
return
|
|
86
|
+
const H = u.label.toLowerCase(), U = u.key.toLowerCase();
|
|
87
|
+
return H.includes(o) || U.includes(o);
|
|
79
88
|
});
|
|
80
|
-
})(),
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
89
|
+
})(), B = (t) => {
|
|
90
|
+
C(t), j(!1), k(""), p(t);
|
|
91
|
+
}, E = () => {
|
|
92
|
+
j(!s), !s && v.current && setTimeout(() => {
|
|
84
93
|
var t;
|
|
85
|
-
return (t =
|
|
94
|
+
return (t = v.current) == null ? void 0 : t.focus();
|
|
86
95
|
}, 100);
|
|
87
96
|
};
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
K(() => {
|
|
98
|
+
C(l);
|
|
90
99
|
}, [l]);
|
|
91
|
-
const
|
|
92
|
-
onClick:
|
|
93
|
-
}),
|
|
94
|
-
return /* @__PURE__ */ e.jsxs("div", { className: `w-full relative flex flex-col gap-8 ${
|
|
100
|
+
const A = z({
|
|
101
|
+
onClick: E
|
|
102
|
+
}), D = n(m);
|
|
103
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `w-full relative flex flex-col gap-8 ${f}`, children: [
|
|
95
104
|
/* @__PURE__ */ e.jsx(
|
|
96
105
|
"h6",
|
|
97
106
|
{
|
|
98
107
|
className: `text-gray-600 font-600 group ${r ? "!text-red-500" : ""} text-label`,
|
|
99
|
-
children:
|
|
108
|
+
children: x
|
|
100
109
|
}
|
|
101
110
|
),
|
|
102
111
|
/* @__PURE__ */ e.jsxs(
|
|
103
112
|
"div",
|
|
104
113
|
{
|
|
105
114
|
ref: d.setReference,
|
|
106
|
-
className:
|
|
115
|
+
className: `${b} flex items-center justify-between bg-light rounded-full p-16 cursor-pointer
|
|
107
116
|
border transition-all duration-200 hover:border-blue-400
|
|
108
117
|
${r ? "border-red-500 hover:border-red-600" : ""} ${s ? "border-blue-400" : "border-blue-100"}`,
|
|
109
|
-
...
|
|
118
|
+
...A,
|
|
110
119
|
children: [
|
|
111
|
-
i ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center w-full", children: /* @__PURE__ */ e.jsx("span", { className: "flex-grow font-600 text-body-m", children:
|
|
112
|
-
/* @__PURE__ */ e.jsx(
|
|
120
|
+
i ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center w-full", children: /* @__PURE__ */ e.jsx("span", { className: "flex-grow font-600 text-body-m", children: n(i.label) }) }) : /* @__PURE__ */ e.jsx("span", { className: "text-gray-400 font-600 text-body-m", children: D }),
|
|
121
|
+
y && /* @__PURE__ */ e.jsx(
|
|
113
122
|
"svg",
|
|
114
123
|
{
|
|
115
124
|
className: `w-16 h-16 transition-transform ${s ? "transform rotate-180" : ""}`,
|
|
@@ -131,32 +140,33 @@ const ce = ({
|
|
|
131
140
|
}
|
|
132
141
|
),
|
|
133
142
|
r && /* @__PURE__ */ e.jsx("p", { className: "mt-1 text-sm text-red-600", children: r }),
|
|
134
|
-
|
|
143
|
+
I && /* @__PURE__ */ e.jsxs(
|
|
135
144
|
"div",
|
|
136
145
|
{
|
|
137
146
|
ref: d.setFloating,
|
|
138
147
|
style: {
|
|
139
|
-
position:
|
|
140
|
-
top:
|
|
141
|
-
left:
|
|
142
|
-
...
|
|
148
|
+
position: O,
|
|
149
|
+
top: $ ?? 0,
|
|
150
|
+
left: T ?? 0,
|
|
151
|
+
...W,
|
|
143
152
|
width: d.reference.current instanceof Element ? d.reference.current.clientWidth : void 0,
|
|
144
|
-
zIndex: 50
|
|
153
|
+
zIndex: 50,
|
|
154
|
+
...g
|
|
145
155
|
},
|
|
146
156
|
className: "bg-white border border-blue-400 rounded-3xl shadow-lg overflow-hidden",
|
|
147
|
-
...
|
|
157
|
+
...F(),
|
|
148
158
|
children: [
|
|
149
|
-
|
|
159
|
+
h && /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 bg-white p-8 border-b border-gray-100 z-20", children: /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
|
|
150
160
|
/* @__PURE__ */ e.jsx("div", { className: "absolute inset-y-0 left-0 pl-12 flex items-center pointer-events-none", children: /* @__PURE__ */ e.jsx("svg", { className: "h-16 w-16 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
|
|
151
161
|
/* @__PURE__ */ e.jsx(
|
|
152
162
|
"input",
|
|
153
163
|
{
|
|
154
|
-
ref:
|
|
164
|
+
ref: v,
|
|
155
165
|
type: "text",
|
|
156
166
|
className: "w-full py-8 pl-40 pr-12 rounded-full focus:outline-none text-body-s",
|
|
157
|
-
placeholder:
|
|
167
|
+
placeholder: n("search_options"),
|
|
158
168
|
value: a,
|
|
159
|
-
onChange: (t) =>
|
|
169
|
+
onChange: (t) => k(t.target.value),
|
|
160
170
|
onClick: (t) => t.stopPropagation(),
|
|
161
171
|
autoFocus: !0
|
|
162
172
|
}
|
|
@@ -166,22 +176,22 @@ const ce = ({
|
|
|
166
176
|
{
|
|
167
177
|
className: "absolute inset-y-0 right-0 pr-12 flex items-center",
|
|
168
178
|
onClick: (t) => {
|
|
169
|
-
t.stopPropagation(),
|
|
179
|
+
t.stopPropagation(), k("");
|
|
170
180
|
},
|
|
171
181
|
children: /* @__PURE__ */ e.jsx("svg", { className: "h-16 w-16 text-gray-400 hover:text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M6 18L18 6M6 6l12 12" }) })
|
|
172
182
|
}
|
|
173
183
|
)
|
|
174
184
|
] }) }),
|
|
175
|
-
/* @__PURE__ */ e.jsx("div", { className: "max-h-[250px] overflow-y-auto", children:
|
|
185
|
+
/* @__PURE__ */ e.jsx("div", { className: "max-h-[250px] overflow-y-auto", children: L.length > 0 ? /* @__PURE__ */ e.jsx("ul", { className: "py-4", children: L.map((t, o) => /* @__PURE__ */ e.jsx(
|
|
176
186
|
"li",
|
|
177
187
|
{
|
|
178
188
|
className: `flex items-center px-16 py-10 transition-all duration-200 hover:bg-blue-50 cursor-pointer ${(i == null ? void 0 : i.key) === t.key ? "bg-blue-100/30 text-blue-500 font-medium" : ""}`,
|
|
179
189
|
onClick: (u) => {
|
|
180
|
-
u.stopPropagation(),
|
|
190
|
+
u.stopPropagation(), B(t);
|
|
181
191
|
},
|
|
182
|
-
children: /* @__PURE__ */ e.jsx("span", { children:
|
|
192
|
+
children: /* @__PURE__ */ e.jsx("span", { children: typeof t.label == "string" ? n(t.label) : t.expandedLabel || t.label })
|
|
183
193
|
},
|
|
184
|
-
`${t.key}-${
|
|
194
|
+
`${t.key}-${o}`
|
|
185
195
|
)) }) : /* @__PURE__ */ e.jsxs("div", { className: "px-16 py-16 text-center text-gray-500", children: [
|
|
186
196
|
/* @__PURE__ */ e.jsx("svg", { className: "mx-auto h-24 w-24 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
187
197
|
/* @__PURE__ */ e.jsxs("p", { className: "mt-8 text-body-s", children: [
|
|
@@ -196,5 +206,5 @@ const ce = ({
|
|
|
196
206
|
] });
|
|
197
207
|
};
|
|
198
208
|
export {
|
|
199
|
-
|
|
209
|
+
pe as default
|
|
200
210
|
};
|
|
@@ -2,6 +2,7 @@ import { Control, FieldValues, Path } from 'react-hook-form';
|
|
|
2
2
|
export interface Option {
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
5
|
+
expandedLabel?: string | React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
export interface SelectInputProps<T extends FieldValues> {
|
|
7
8
|
options: Option[];
|
|
@@ -9,8 +10,11 @@ export interface SelectInputProps<T extends FieldValues> {
|
|
|
9
10
|
control: Control<T>;
|
|
10
11
|
label?: string;
|
|
11
12
|
placeholder?: string;
|
|
12
|
-
className?: string;
|
|
13
13
|
input?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
innerClassName?: string;
|
|
16
|
+
dropdownStyle?: React.CSSProperties;
|
|
17
|
+
showChevron?: boolean;
|
|
14
18
|
}
|
|
15
19
|
export interface SelectInputFieldProps {
|
|
16
20
|
options: Option[];
|
|
@@ -19,6 +23,9 @@ export interface SelectInputFieldProps {
|
|
|
19
23
|
label?: string;
|
|
20
24
|
placeholder?: string;
|
|
21
25
|
error?: string;
|
|
22
|
-
className?: string;
|
|
23
26
|
input?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
innerClassName?: string;
|
|
29
|
+
dropdownStyle?: React.CSSProperties;
|
|
30
|
+
showChevron?: boolean;
|
|
24
31
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
interface Option {
|
|
3
|
-
label: string | React.ReactNode;
|
|
4
3
|
value: number | string;
|
|
4
|
+
label: string | React.ReactNode;
|
|
5
|
+
expandedLabel?: string | React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
interface UncontrolledSelectorProps {
|
|
7
8
|
value: number | string;
|
|
@@ -11,8 +12,11 @@ interface UncontrolledSelectorProps {
|
|
|
11
12
|
label?: string;
|
|
12
13
|
error?: string;
|
|
13
14
|
disabled?: boolean;
|
|
14
|
-
className?: string;
|
|
15
15
|
allowSearch?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
innerClassName?: string;
|
|
18
|
+
dropdownStyle?: React.CSSProperties;
|
|
19
|
+
showChevron?: boolean;
|
|
16
20
|
}
|
|
17
21
|
declare const UncontrolledSelector: React.FC<UncontrolledSelectorProps>;
|
|
18
22
|
export default UncontrolledSelector;
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import M, { useState as k, useRef as N, useMemo as
|
|
3
|
-
import { useFloating as
|
|
4
|
-
import
|
|
5
|
-
import { autoUpdate as
|
|
6
|
-
import { offset as
|
|
7
|
-
const
|
|
2
|
+
import M, { useState as k, useRef as N, useMemo as p } from "react";
|
|
3
|
+
import { useFloating as _, useClick as H, useDismiss as Y, useInteractions as q, useTransitionStyles as G } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
|
|
4
|
+
import J from "fuse.js";
|
|
5
|
+
import { autoUpdate as K } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
6
|
+
import { offset as Q, flip as X, shift as Z, size as ee, arrow as te } from "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
|
|
7
|
+
const ce = ({
|
|
8
8
|
options: r,
|
|
9
9
|
onChange: x,
|
|
10
10
|
value: s,
|
|
11
11
|
disabled: d,
|
|
12
|
-
error:
|
|
13
|
-
label: g = "
|
|
14
|
-
placeholder: L = "
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
error: o,
|
|
13
|
+
label: g = "",
|
|
14
|
+
placeholder: L = "",
|
|
15
|
+
allowSearch: b = !1,
|
|
16
|
+
className: C = "",
|
|
17
|
+
innerClassName: $ = "",
|
|
18
|
+
dropdownStyle: S = {},
|
|
19
|
+
showChevron: O = !0
|
|
17
20
|
}) => {
|
|
18
|
-
const [
|
|
21
|
+
const [a, u] = k(!1), [l, m] = k(""), h = N(null), R = N(null), y = r.find((e) => e.value === s), j = p(() => r.map((e) => ({
|
|
19
22
|
...e,
|
|
20
23
|
// Extract text from React nodes if needed
|
|
21
24
|
searchableLabel: typeof e.label == "string" ? e.label : M.isValidElement(e.label) ? c(e.label) : String(e.label),
|
|
22
25
|
searchableValue: String(e.value)
|
|
23
|
-
})), [r]), v =
|
|
26
|
+
})), [r]), v = p(() => {
|
|
24
27
|
const e = {
|
|
25
28
|
keys: [
|
|
26
29
|
{ name: "searchableLabel", weight: 2 },
|
|
@@ -38,15 +41,15 @@ const le = ({
|
|
|
38
41
|
shouldSort: !0,
|
|
39
42
|
findAllMatches: !0
|
|
40
43
|
};
|
|
41
|
-
return new
|
|
42
|
-
}, [j]), { x:
|
|
43
|
-
open:
|
|
44
|
+
return new J(j, e);
|
|
45
|
+
}, [j]), { x: T, y: F, strategy: P, refs: i, context: f } = _({
|
|
46
|
+
open: a,
|
|
44
47
|
onOpenChange: u,
|
|
45
48
|
middleware: [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
Q(8),
|
|
50
|
+
X(),
|
|
51
|
+
Z({ padding: 8 }),
|
|
52
|
+
ee({
|
|
50
53
|
apply({ availableHeight: e, elements: n }) {
|
|
51
54
|
Object.assign(n.floating.style, {
|
|
52
55
|
maxHeight: `${Math.min(e - 10, 300)}px`
|
|
@@ -54,35 +57,35 @@ const le = ({
|
|
|
54
57
|
},
|
|
55
58
|
padding: 8
|
|
56
59
|
}),
|
|
57
|
-
|
|
60
|
+
te({ element: R })
|
|
58
61
|
],
|
|
59
62
|
placement: "bottom-start",
|
|
60
|
-
whileElementsMounted:
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
]), { isMounted:
|
|
63
|
+
whileElementsMounted: K
|
|
64
|
+
}), z = H(f), A = Y(f), { getReferenceProps: E, getFloatingProps: W } = q([
|
|
65
|
+
z,
|
|
66
|
+
A
|
|
67
|
+
]), { isMounted: B, styles: V } = G(f, {
|
|
65
68
|
duration: { open: 200, close: 150 },
|
|
66
69
|
initial: { opacity: 0, transform: "translateY(-4px)" }
|
|
67
|
-
}), w =
|
|
70
|
+
}), w = p(() => l.trim() ? v.search(l).map((n) => ({
|
|
68
71
|
...n.item,
|
|
69
72
|
score: n.score,
|
|
70
73
|
matches: n.matches
|
|
71
|
-
})) : r, [
|
|
74
|
+
})) : r, [l, v, r]), D = (e) => {
|
|
72
75
|
x(e.value), u(!1), m("");
|
|
73
|
-
},
|
|
76
|
+
}, I = E({
|
|
74
77
|
onClick: () => {
|
|
75
|
-
d || (u(!
|
|
78
|
+
d || (u(!a), !a && h.current && b && setTimeout(() => {
|
|
76
79
|
var e;
|
|
77
|
-
return (e =
|
|
80
|
+
return (e = h.current) == null ? void 0 : e.focus();
|
|
78
81
|
}, 100));
|
|
79
82
|
}
|
|
80
83
|
});
|
|
81
|
-
return /* @__PURE__ */ t.jsxs("div", { className: `w-full relative flex flex-col gap-8 ${
|
|
84
|
+
return /* @__PURE__ */ t.jsxs("div", { className: `w-full relative flex flex-col gap-8 ${C}`, children: [
|
|
82
85
|
g && /* @__PURE__ */ t.jsx(
|
|
83
86
|
"h6",
|
|
84
87
|
{
|
|
85
|
-
className: `text-gray-600 font-600 group ${
|
|
88
|
+
className: `text-gray-600 font-600 group ${o ? "!text-red-500" : ""} text-label ${d ? "text-gray-300" : ""}`,
|
|
86
89
|
children: g
|
|
87
90
|
}
|
|
88
91
|
),
|
|
@@ -90,16 +93,16 @@ const le = ({
|
|
|
90
93
|
"div",
|
|
91
94
|
{
|
|
92
95
|
ref: i.setReference,
|
|
93
|
-
className:
|
|
96
|
+
className: `${$} flex items-center justify-between bg-light rounded-full p-16 cursor-pointer
|
|
94
97
|
border transition-all duration-200 ${d ? "opacity-60 cursor-not-allowed" : "hover:border-blue-400"}
|
|
95
|
-
${
|
|
96
|
-
...
|
|
98
|
+
${o ? "border-red-500 hover:border-red-600" : ""} ${a ? "border-blue-400" : "border-blue-100"}`,
|
|
99
|
+
...I,
|
|
97
100
|
children: [
|
|
98
101
|
y ? /* @__PURE__ */ t.jsx("div", { className: "flex items-center w-full", children: /* @__PURE__ */ t.jsx("span", { className: "flex-grow font-600 text-body-m", children: y.label }) }) : /* @__PURE__ */ t.jsx("span", { className: "text-gray-400 font-600 text-body-m", children: L }),
|
|
99
|
-
/* @__PURE__ */ t.jsx(
|
|
102
|
+
O && /* @__PURE__ */ t.jsx(
|
|
100
103
|
"svg",
|
|
101
104
|
{
|
|
102
|
-
className: `w-16 h-16 transition-transform ${
|
|
105
|
+
className: `w-16 h-16 transition-transform ${a ? "transform rotate-180" : ""}`,
|
|
103
106
|
fill: "none",
|
|
104
107
|
stroke: "currentColor",
|
|
105
108
|
viewBox: "0 0 24 24",
|
|
@@ -117,38 +120,39 @@ const le = ({
|
|
|
117
120
|
]
|
|
118
121
|
}
|
|
119
122
|
),
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
o && /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-sm text-red-600", children: o }),
|
|
124
|
+
B && /* @__PURE__ */ t.jsxs(
|
|
122
125
|
"div",
|
|
123
126
|
{
|
|
124
127
|
ref: i.setFloating,
|
|
125
128
|
style: {
|
|
126
|
-
position:
|
|
127
|
-
top:
|
|
128
|
-
left:
|
|
129
|
-
...
|
|
129
|
+
position: P,
|
|
130
|
+
top: F ?? 0,
|
|
131
|
+
left: T ?? 0,
|
|
132
|
+
...V,
|
|
130
133
|
width: i.reference.current instanceof Element ? i.reference.current.clientWidth : void 0,
|
|
131
|
-
zIndex: 50
|
|
134
|
+
zIndex: 50,
|
|
135
|
+
...S
|
|
132
136
|
},
|
|
133
137
|
className: "bg-white border border-blue-400 rounded-3xl shadow-lg overflow-hidden",
|
|
134
|
-
...
|
|
138
|
+
...W(),
|
|
135
139
|
children: [
|
|
136
140
|
b && /* @__PURE__ */ t.jsx("div", { className: "sticky top-0 bg-white p-8 border-b border-gray-100 z-20", children: /* @__PURE__ */ t.jsxs("div", { className: "relative", children: [
|
|
137
141
|
/* @__PURE__ */ t.jsx("div", { className: "absolute inset-y-0 left-0 pl-12 flex items-center pointer-events-none", children: /* @__PURE__ */ t.jsx("svg", { className: "h-16 w-16 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
|
|
138
142
|
/* @__PURE__ */ t.jsx(
|
|
139
143
|
"input",
|
|
140
144
|
{
|
|
141
|
-
ref:
|
|
145
|
+
ref: h,
|
|
142
146
|
type: "text",
|
|
143
147
|
className: "w-full py-8 pl-40 pr-12 rounded-full focus:outline-none text-body-s",
|
|
144
148
|
placeholder: "Search options...",
|
|
145
|
-
value:
|
|
149
|
+
value: l,
|
|
146
150
|
onChange: (e) => m(e.target.value),
|
|
147
151
|
onClick: (e) => e.stopPropagation(),
|
|
148
152
|
autoFocus: !0
|
|
149
153
|
}
|
|
150
154
|
),
|
|
151
|
-
|
|
155
|
+
l && /* @__PURE__ */ t.jsx(
|
|
152
156
|
"button",
|
|
153
157
|
{
|
|
154
158
|
className: "absolute inset-y-0 right-0 pr-12 flex items-center",
|
|
@@ -163,17 +167,17 @@ const le = ({
|
|
|
163
167
|
"li",
|
|
164
168
|
{
|
|
165
169
|
className: `flex items-center px-16 py-10 transition-all duration-200 hover:bg-blue-50 cursor-pointer ${s === e.value ? "bg-blue-100/30 text-blue-500 font-medium" : ""}`,
|
|
166
|
-
onClick: (
|
|
167
|
-
|
|
170
|
+
onClick: (U) => {
|
|
171
|
+
U.stopPropagation(), D(e);
|
|
168
172
|
},
|
|
169
|
-
children: /* @__PURE__ */ t.jsx("span", { children: e.label })
|
|
173
|
+
children: /* @__PURE__ */ t.jsx("span", { children: (e == null ? void 0 : e.expandedLabel) || e.label })
|
|
170
174
|
},
|
|
171
175
|
`${e.value}-${n}`
|
|
172
176
|
)) }) : /* @__PURE__ */ t.jsxs("div", { className: "px-16 py-16 text-center text-gray-500", children: [
|
|
173
177
|
/* @__PURE__ */ t.jsx("svg", { className: "mx-auto h-24 w-24 text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
174
178
|
/* @__PURE__ */ t.jsxs("p", { className: "mt-8 text-body-s", children: [
|
|
175
179
|
'No matches found for "',
|
|
176
|
-
|
|
180
|
+
l,
|
|
177
181
|
'"'
|
|
178
182
|
] })
|
|
179
183
|
] }) })
|
|
@@ -192,5 +196,5 @@ const le = ({
|
|
|
192
196
|
return Array.isArray(r) ? r.map(c).join(" ") : "";
|
|
193
197
|
};
|
|
194
198
|
export {
|
|
195
|
-
|
|
199
|
+
ce as default
|
|
196
200
|
};
|