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