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