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.
@@ -1,5 +1,4 @@
1
- import { __require as r } from "../node_modules/property-expr/index.js";
2
- var e = r();
1
+ var p = { exports: {} };
3
2
  export {
4
- e as p
3
+ p as __module
5
4
  };
@@ -1,5 +1,5 @@
1
- import { __require as r } from "../node_modules/tiny-case/index.js";
2
- var a = r();
1
+ import { __require as r } from "../node_modules/property-expr/index.js";
2
+ var e = r();
3
3
  export {
4
- a as t
4
+ e as p
5
5
  };
@@ -1,7 +1,5 @@
1
- import { getDefaultExportFromCjs as o } from "./_commonjsHelpers.js";
2
- import { __require as r } from "../node_modules/toposort/index.js";
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
- s as default
4
+ a as t
7
5
  };
@@ -1,4 +1,7 @@
1
- var p = { exports: {} };
1
+ import { getDefaultExportFromCjs as o } from "./_commonjsHelpers.js";
2
+ import { __require as r } from "../node_modules/toposort/index.js";
3
+ var t = r();
4
+ const s = /* @__PURE__ */ o(t);
2
5
  export {
3
- p as __module
6
+ s as default
4
7
  };
@@ -1,4 +1,4 @@
1
- import { j as a } from "../../../_virtual/jsx-runtime.js";
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: i = "",
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 = () => i ? h(i) : t ? h(
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", c = (f) => {
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 = () => c(m) ? m : t != null && t.image && c(t.image) ? t.image : t != null && t.image ? E(t.image) : "", S = () => i ? /* @__PURE__ */ a.jsx(
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: i
37
+ children: a
37
38
  }
38
- ) : t ? /* @__PURE__ */ a.jsx(
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__ */ a.jsx(
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
- }, r = y();
62
- return /* @__PURE__ */ a.jsxs(
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
- r && !j && /* @__PURE__ */ a.jsx(
76
+ c && !j && /* @__PURE__ */ i.jsx(
76
77
  "img",
77
78
  {
78
- src: r,
79
- alt: i,
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__ */ a.jsx(
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
- $ as default
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 B, useClick as H, useDismiss as U, useInteractions as W, useTransitionStyles as Y } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
3
- import { useState as b, useRef as k, useEffect as q } from "react";
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: a,
9
+ options: c,
10
10
  name: l,
11
- control: c,
12
- label: d = "Select an option",
13
- placeholder: p = "Type to search...",
11
+ control: p,
12
+ label: m = "Select an option",
13
+ placeholder: x = "Type to search...",
14
14
  className: r = "",
15
- input: u = !0
15
+ input: h = !0
16
16
  }) => /* @__PURE__ */ e.jsx(
17
17
  G,
18
18
  {
19
19
  name: l,
20
- control: c,
20
+ control: p,
21
21
  render: ({ field: { onChange: f, value: o }, fieldState: { error: s } }) => /* @__PURE__ */ e.jsx(
22
22
  te,
23
23
  {
24
- options: a,
24
+ options: c,
25
25
  value: o,
26
26
  onChange: f,
27
- label: d,
28
- placeholder: p,
27
+ label: m,
28
+ placeholder: x,
29
29
  error: s == null ? void 0 : s.message,
30
30
  className: r,
31
- input: u
31
+ input: h
32
32
  }
33
33
  )
34
34
  }
35
35
  ), te = ({
36
- options: a,
36
+ options: c,
37
37
  value: l,
38
- onChange: c,
39
- label: d = "Select an option",
40
- placeholder: p = "Type to search...",
38
+ onChange: p,
39
+ label: m = "Select an option",
40
+ placeholder: x = "Type to search...",
41
41
  error: r,
42
- className: u = "",
42
+ className: h = "",
43
43
  input: f = !0
44
44
  }) => {
45
- const { t: o } = J(), [s, m] = b(!1), [x, y] = b(""), [j, w] = b(
45
+ const { t: o } = J(), [s, g] = k(!1), [a, y] = k(""), [i, v] = k(
46
46
  l || null
47
- ), h = k(null), C = k(null), { x: T, y: O, strategy: $, refs: v, context: g } = B({
47
+ ), b = N(null), C = N(null), { x: L, y: S, strategy: M, refs: d, context: j } = D({
48
48
  open: s,
49
- onOpenChange: m,
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
- }), L = H(g), P = U(g), { getReferenceProps: R, getFloatingProps: F } = W([
67
- L,
68
- P
69
- ]), { isMounted: N, styles: I } = Y(g, {
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
- }), S = (() => {
73
- const t = Array.isArray(a) ? a : [];
74
- if (!x.trim()) return t;
75
- const n = x.toLowerCase();
76
- return t.filter((i) => {
77
- const D = i.label.toLowerCase(), _ = i.key.toLowerCase();
78
- return D.includes(n) || _.includes(n);
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
- })(), M = (t) => {
81
- w(t), m(!1), y(""), c(t);
82
- }, z = () => {
83
- m(!s), !s && h.current && setTimeout(() => {
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 = h.current) == null ? void 0 : t.focus();
85
+ return (t = b.current) == null ? void 0 : t.focus();
86
86
  }, 100);
87
87
  };
88
88
  q(() => {
89
- w(l);
89
+ v(l);
90
90
  }, [l]);
91
- const E = R({
92
- onClick: z
93
- }), A = o(p);
94
- return /* @__PURE__ */ e.jsxs("div", { className: `w-full relative flex flex-col gap-8 ${u}`, children: [
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
- "label",
96
+ "h6",
97
97
  {
98
- className: `text-gray-600 font-600 group ${r && "!text-red-500"} text-label`,
99
- children: d
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: v.setReference,
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 && "border-red-500 hover:border-red-600"} ${N ? "border-blue-400" : "border-blue-100"}`,
109
- ...E,
108
+ ${r ? "border-red-500 hover:border-red-600" : ""} ${s ? "border-blue-400" : "border-blue-100"}`,
109
+ ...W,
110
110
  children: [
111
- j ? /* @__PURE__ */ e.jsx("div", { className: "flex items-center w-full", children: /* @__PURE__ */ e.jsx("span", { className: "flex-grow flex-grow font-600 text-body-m", children: o(j.label) }) }) : /* @__PURE__ */ e.jsx("span", { className: "text-gray-400 font-600 text-body-m", children: A }),
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
- N && /* @__PURE__ */ e.jsxs(
134
+ R && /* @__PURE__ */ e.jsxs(
135
135
  "div",
136
136
  {
137
- ref: v.setFloating,
137
+ ref: d.setFloating,
138
138
  style: {
139
- position: $,
140
- top: O ?? 0,
141
- left: T ?? 0,
142
- ...I
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: "z-10 w-full bg-white border border-blue-400 rounded-3xl shadow-lg overflow-auto",
145
- ...F(),
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-2 z-20", children: /* @__PURE__ */ e.jsx(
148
- "input",
149
- {
150
- ref: h,
151
- type: "text",
152
- className: "w-full p-16",
153
- placeholder: "Search...",
154
- value: x,
155
- onChange: (t) => y(t.target.value),
156
- onClick: (t) => t.stopPropagation(),
157
- autoFocus: !0
158
- }
159
- ) }),
160
- /* @__PURE__ */ e.jsx("div", { className: "", children: S.length > 0 ? /* @__PURE__ */ e.jsx("ul", { children: S.map((t, n) => /* @__PURE__ */ e.jsx(
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: "flex items-center justify-between px-16 py-8 transition-all duration-200 hover:bg-blue-100/50 cursor-pointer",
164
- onClick: (i) => {
165
- i.stopPropagation(), M(t);
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.jsx("div", { className: "px-16 py-8 text-gray-500 text-body-s", children: o("no_options_found") }) })
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 e } from "../../../_virtual/jsx-runtime.js";
2
- import { useState as m } from "react";
3
- import u from "../../molecules/FloatingMenu/FloatingMenu.js";
4
- import { FontAwesomeIcon as f } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
5
- import { faChevronDown as p } from "../../../node_modules/@fortawesome/pro-regular-svg-icons/index.js";
6
- const v = ({ options: r, onChange: n, value: o, disabled: i, error: d, label: c, placeholder: x }) => {
7
- var s;
8
- const [l, a] = m(!1);
9
- return /* @__PURE__ */ e.jsx(
10
- u,
11
- {
12
- open: l,
13
- onClose: () => a(!1),
14
- offset: 12,
15
- padding: 0,
16
- placement: "bottom",
17
- className: "!p-0 overflow-hidden",
18
- strategy: "fixed",
19
- component: /* @__PURE__ */ e.jsx("div", { className: "bg-white rounded-lg shadow-lg max-h-[150px] overflow-y-auto flex flex-col py-8", children: r.map((t) => /* @__PURE__ */ e.jsx(
20
- "button",
21
- {
22
- onClick: () => n(t.value),
23
- className: `w-full text-center px-16 py-8 transition-all duration-100 hover:bg-blue-100 ${o === t.label ? "text-blue-500 font-medium" : ""}`,
24
- children: t.label
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
- t.value
27
- )) }),
28
- children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-8 relative", onClick: () => a(!l), children: [
29
- /* @__PURE__ */ e.jsx(
30
- "h6",
31
- {
32
- className: `text-gray-600 font-600 group ${d && "!text-red-500"} text-label ${i && "text-gray-300"}`,
33
- children: c
34
- }
35
- ),
36
- /* @__PURE__ */ e.jsxs(
37
- "div",
38
- {
39
- className: `px-10 py-8 bg-blue-50 border-1 border-blue-200 rounded-full flex items-center gap-8 cursor-pointer transition-colors duration-150 ease-in-out ${l ? "!border-blue-500" : ""}`,
40
- children: [
41
- o ? /* @__PURE__ */ e.jsx("h4", { className: "text-body-m", children: (s = r.find((t) => t.value === o)) == null ? void 0 : s.label }) : /* @__PURE__ */ e.jsx("h4", { className: "text-body-m text-gray-400", children: x }),
42
- /* @__PURE__ */ e.jsx(
43
- f,
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
- icon: p,
46
- className: `text-gray-400 transition-all duration-150 ease-in-out ${l ? "rotate-180" : ""}`
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
- v as default
195
+ le as default
58
196
  };