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