lawgic-dev-kit 0.13.6 → 0.14.0
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/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/atoms/CountryInput/CountryInput.js +32 -32
- package/dist/components/atoms/PhoneInput/PhoneInput.d.ts +2 -1
- package/dist/components/atoms/PhoneInput/PhoneInput.js +14 -14
- package/dist/components/atoms/PhoneInput/PhoneInput.types.d.ts +3 -3
- package/dist/components/atoms/SelectInput/SelectInput.d.ts +4 -0
- package/dist/components/atoms/{SelectDropdown/SelectDropdown.js → SelectInput/SelectInput.js} +38 -38
- package/dist/components/atoms/{SelectDropdown/SelectDropdown.types.d.ts → SelectInput/SelectInput.types.d.ts} +2 -2
- package/dist/components/atoms/SelectInput/index.d.ts +1 -0
- package/dist/components/atoms/index.d.ts +1 -1
- package/dist/index.js +30 -29
- package/dist/lawgic-dev-kit.css +1 -1
- package/dist/lawgic-dev-kit.umd.js +41 -41
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/toposort/index.js +1 -1
- package/dist/src/components/atoms/PhoneInput/PhoneInput.d.ts +5 -0
- package/dist/src/components/atoms/PhoneInput/PhoneInput.types.d.ts +12 -0
- package/dist/src/components/atoms/SelectInput/SelectInput.d.ts +4 -0
- package/dist/src/components/atoms/SelectInput/SelectInput.types.d.ts +24 -0
- package/dist/src/components/atoms/SelectInput/index.d.ts +1 -0
- package/dist/src/components/atoms/index.d.ts +33 -0
- package/dist/types/modal.d.ts +3 -1
- package/dist/types/modalType.d.ts +1 -1
- package/dist/utils/modal.d.ts +3 -0
- package/dist/utils/modal.js +63 -43
- package/package.json +1 -1
- package/dist/components/atoms/SelectDropdown/SelectDropdown.d.ts +0 -4
- package/dist/components/atoms/SelectDropdown/index.d.ts +0 -1
- package/dist/src/components/atoms/ProgressBar/ProgressBar.d.ts +0 -3
- package/dist/src/components/atoms/ProgressBar/ProgressBar.types.d.ts +0 -6
package/dist/_virtual/index6.js
CHANGED
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { useState as b, useRef as w, useEffect as P } from "react";
|
|
3
|
-
import { useController as
|
|
4
|
-
import { useFloating as
|
|
3
|
+
import { useController as se } from "react-hook-form";
|
|
4
|
+
import { useFloating as re, useClick as le, useDismiss as ne, useInteractions as ae, useTransitionStyles as ie } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
|
|
5
5
|
import { useTheme as ce } from "../../../hooks/useTheme.js";
|
|
6
6
|
import de from "../../../constants/countries.js";
|
|
7
7
|
import { autoUpdate as pe } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
8
|
-
import { offset as ue, flip as me, shift as fe, size as
|
|
8
|
+
import { offset as ue, flip as me, shift as fe, size as xe, arrow as he } from "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
|
|
9
9
|
const Le = ({
|
|
10
10
|
countries: v = de,
|
|
11
11
|
name: C,
|
|
@@ -17,36 +17,36 @@ const Le = ({
|
|
|
17
17
|
translateKey: D
|
|
18
18
|
}) => {
|
|
19
19
|
var O, I, R;
|
|
20
|
-
const { t:
|
|
20
|
+
const { t: r } = ce(), { field: l, fieldState: A } = se({
|
|
21
21
|
name: C,
|
|
22
22
|
control: _,
|
|
23
23
|
rules: { validate: {} },
|
|
24
24
|
defaultValue: null
|
|
25
25
|
}), [n, u] = b(!1), [c, j] = b(""), [o, S] = b(
|
|
26
26
|
l.value || null
|
|
27
|
-
), m = w(null), y = w(null), f = w(null), { x: Y, y: H, strategy: U, refs: N, context:
|
|
27
|
+
), m = w(null), y = w(null), f = w(null), { x: Y, y: H, strategy: U, refs: N, context: x, placement: V, middlewareData: L } = re({
|
|
28
28
|
open: n,
|
|
29
29
|
onOpenChange: u,
|
|
30
30
|
middleware: [
|
|
31
31
|
ue(8),
|
|
32
32
|
me(),
|
|
33
33
|
fe({ padding: 8 }),
|
|
34
|
-
|
|
35
|
-
apply({ availableHeight: e, elements:
|
|
36
|
-
Object.assign(
|
|
34
|
+
xe({
|
|
35
|
+
apply({ availableHeight: e, elements: s }) {
|
|
36
|
+
Object.assign(s.floating.style, {
|
|
37
37
|
maxHeight: `${Math.min(e - 10, 300)}px`
|
|
38
38
|
});
|
|
39
39
|
},
|
|
40
40
|
padding: 8
|
|
41
41
|
}),
|
|
42
|
-
|
|
42
|
+
he({ element: y })
|
|
43
43
|
],
|
|
44
44
|
placement: "bottom-start",
|
|
45
45
|
whileElementsMounted: pe
|
|
46
|
-
}), W = le(
|
|
46
|
+
}), W = le(x), X = ne(x), { getReferenceProps: q, getFloatingProps: G } = ae([
|
|
47
47
|
W,
|
|
48
48
|
X
|
|
49
|
-
]), { isMounted: $, styles: J } = ie(
|
|
49
|
+
]), { isMounted: $, styles: J } = ie(x, {
|
|
50
50
|
duration: {
|
|
51
51
|
open: 200,
|
|
52
52
|
close: 150
|
|
@@ -57,8 +57,8 @@ const Le = ({
|
|
|
57
57
|
}
|
|
58
58
|
}), E = (Array.isArray(v) ? v : []).filter((e) => {
|
|
59
59
|
if (!c.trim()) return !0;
|
|
60
|
-
const
|
|
61
|
-
return
|
|
60
|
+
const s = p === "es" && e.labelES ? e.labelES.toLowerCase() : e.label.toLowerCase(), i = e.code ? e.code.toLowerCase() : "";
|
|
61
|
+
return s.includes(c.toLowerCase()) || i.includes(c.toLowerCase());
|
|
62
62
|
}), K = (e) => {
|
|
63
63
|
S(e), u(!1), j(""), l.onChange(e);
|
|
64
64
|
}, Q = () => {
|
|
@@ -74,16 +74,16 @@ const Le = ({
|
|
|
74
74
|
P(() => {
|
|
75
75
|
S(l.value);
|
|
76
76
|
}, [l.value]), P(() => {
|
|
77
|
-
const e = (
|
|
78
|
-
f.current && !f.current.contains(
|
|
77
|
+
const e = (s) => {
|
|
78
|
+
f.current && !f.current.contains(s.target) && l.onBlur();
|
|
79
79
|
};
|
|
80
80
|
return document.addEventListener("mousedown", e), () => {
|
|
81
81
|
document.removeEventListener("mousedown", e);
|
|
82
82
|
};
|
|
83
83
|
}, [l]);
|
|
84
|
-
const
|
|
85
|
-
var
|
|
86
|
-
return e ? e.codeISO2 ? e.codeISO2.toLowerCase() : ((
|
|
84
|
+
const h = (e) => {
|
|
85
|
+
var s;
|
|
86
|
+
return e ? e.codeISO2 ? e.codeISO2.toLowerCase() : ((s = e.code) == null ? void 0 : s.toLowerCase()) || "" : "";
|
|
87
87
|
}, T = (O = L.arrow) == null ? void 0 : O.x, k = (I = L.arrow) == null ? void 0 : I.y, a = {
|
|
88
88
|
top: "bottom",
|
|
89
89
|
right: "left",
|
|
@@ -92,7 +92,7 @@ const Le = ({
|
|
|
92
92
|
}[V.split("-")[0]], ee = q({
|
|
93
93
|
onClick: Q,
|
|
94
94
|
onBlur: Z
|
|
95
|
-
}), te =
|
|
95
|
+
}), te = r(z), oe = r(F), d = (R = A.error) == null ? void 0 : R.message;
|
|
96
96
|
return /* @__PURE__ */ t.jsxs(
|
|
97
97
|
"div",
|
|
98
98
|
{
|
|
@@ -114,18 +114,18 @@ const Le = ({
|
|
|
114
114
|
...ee,
|
|
115
115
|
tabIndex: 0,
|
|
116
116
|
children: [
|
|
117
|
-
o != null && o.code ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center w-full", children: [
|
|
118
|
-
|
|
117
|
+
o != null && o.code ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center w-full gap-10", children: [
|
|
118
|
+
h(o) && /* @__PURE__ */ t.jsx(
|
|
119
119
|
"img",
|
|
120
120
|
{
|
|
121
121
|
loading: "lazy",
|
|
122
122
|
width: "24",
|
|
123
123
|
height: "16",
|
|
124
124
|
className: "mr-2",
|
|
125
|
-
src: `https://flagcdn.com/w20/${
|
|
125
|
+
src: `https://flagcdn.com/w20/${h(
|
|
126
126
|
o
|
|
127
127
|
)}.png`,
|
|
128
|
-
srcSet: `https://flagcdn.com/w40/${
|
|
128
|
+
srcSet: `https://flagcdn.com/w40/${h(
|
|
129
129
|
o
|
|
130
130
|
)}.png 2x`,
|
|
131
131
|
alt: o.label,
|
|
@@ -134,11 +134,11 @@ const Le = ({
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
|
-
/* @__PURE__ */ t.jsxs("span", { className: "flex-grow", children: [
|
|
137
|
+
/* @__PURE__ */ t.jsxs("span", { className: "flex-grow font-600 text-body-m", children: [
|
|
138
138
|
p === "es" && o.labelES ? o.labelES : o.label,
|
|
139
|
-
o.code ? ` (${o.code})` :
|
|
139
|
+
o.code ? ` (${o.code})` : r("select_country")
|
|
140
140
|
] })
|
|
141
|
-
] }) : /* @__PURE__ */ t.jsx("span", { className: "text-gray-
|
|
141
|
+
] }) : /* @__PURE__ */ t.jsx("span", { className: "text-gray-400 font-600 text-body-m", children: oe }),
|
|
142
142
|
/* @__PURE__ */ t.jsx(
|
|
143
143
|
"svg",
|
|
144
144
|
{
|
|
@@ -160,7 +160,7 @@ const Le = ({
|
|
|
160
160
|
]
|
|
161
161
|
}
|
|
162
162
|
),
|
|
163
|
-
d && /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-sm text-red-600", children:
|
|
163
|
+
d && /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-sm text-red-600", children: r(d, { x: r(D || "") || r(C) }) }),
|
|
164
164
|
$ && /* @__PURE__ */ t.jsxs(
|
|
165
165
|
"div",
|
|
166
166
|
{
|
|
@@ -197,8 +197,8 @@ const Le = ({
|
|
|
197
197
|
{
|
|
198
198
|
ref: m,
|
|
199
199
|
type: "text",
|
|
200
|
-
className: "w-full p-16",
|
|
201
|
-
placeholder:
|
|
200
|
+
className: "w-full p-16 text-body-s",
|
|
201
|
+
placeholder: r("search") + "...",
|
|
202
202
|
value: c,
|
|
203
203
|
onChange: (e) => j(e.target.value),
|
|
204
204
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -208,7 +208,7 @@ const Le = ({
|
|
|
208
208
|
autoFocus: !0
|
|
209
209
|
}
|
|
210
210
|
) }),
|
|
211
|
-
/* @__PURE__ */ t.jsx("div", { children: E.length > 0 ? /* @__PURE__ */ t.jsx("ul", { className: "flex flex-col", children: E.map((e,
|
|
211
|
+
/* @__PURE__ */ t.jsx("div", { children: E.length > 0 ? /* @__PURE__ */ t.jsx("ul", { className: "flex flex-col", children: E.map((e, s) => {
|
|
212
212
|
var B;
|
|
213
213
|
const i = e.codeISO2 ? e.codeISO2.toLowerCase() : ((B = e.code) == null ? void 0 : B.toLowerCase()) || "";
|
|
214
214
|
return /* @__PURE__ */ t.jsxs(
|
|
@@ -240,9 +240,9 @@ const Le = ({
|
|
|
240
240
|
] })
|
|
241
241
|
]
|
|
242
242
|
},
|
|
243
|
-
`${e.code}-${
|
|
243
|
+
`${e.code}-${s}`
|
|
244
244
|
);
|
|
245
|
-
}) }) : /* @__PURE__ */ t.jsx("div", { className: "px-
|
|
245
|
+
}) }) : /* @__PURE__ */ t.jsx("div", { className: "px-16 py-8 text-gray-500 text-body-s", children: r("no_countries_found") }) })
|
|
246
246
|
]
|
|
247
247
|
}
|
|
248
248
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { FieldValues } from 'react-hook-form';
|
|
2
3
|
import { PhoneInputProps } from './PhoneInput.types';
|
|
3
|
-
declare const PhoneInput: <T extends FieldValues>({ name, control, label, placeholder, language, className, translateKey, countries, }: PhoneInputProps<T>) =>
|
|
4
|
+
declare const PhoneInput: <T extends FieldValues = FieldValues>({ name, control, label, placeholder, language, className, translateKey, countries, }: PhoneInputProps<T>) => React.ReactElement;
|
|
4
5
|
export default PhoneInput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { useState as f, useRef as h, useEffect as A } from "react";
|
|
3
3
|
import { useController as xe } from "react-hook-form";
|
|
4
|
-
import { useFloating as be, useClick as we, useDismiss as Ce, useInteractions as ve, useTransitionStyles as
|
|
5
|
-
import { FontAwesomeIcon as
|
|
6
|
-
import { faChevronDown as
|
|
4
|
+
import { useFloating as be, useClick as we, useDismiss as Ce, useInteractions as ve, useTransitionStyles as ye } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
|
|
5
|
+
import { FontAwesomeIcon as je } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
|
|
6
|
+
import { faChevronDown as Ne } from "../../../node_modules/@fortawesome/pro-regular-svg-icons/index.js";
|
|
7
7
|
import { useTheme as Se } from "../../../hooks/useTheme.js";
|
|
8
8
|
import Le from "../../../constants/countries.js";
|
|
9
9
|
import { autoUpdate as Te } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
|
|
@@ -19,11 +19,11 @@ const Ye = ({
|
|
|
19
19
|
countries: i = Le
|
|
20
20
|
}) => {
|
|
21
21
|
var z, F, D, V;
|
|
22
|
-
const { t: l } = Se(), { field: s, fieldState:
|
|
22
|
+
const { t: l } = Se(), { field: s, fieldState: y } = xe({
|
|
23
23
|
name: v,
|
|
24
24
|
control: H,
|
|
25
25
|
rules: { validate: {} }
|
|
26
|
-
}),
|
|
26
|
+
}), j = ((z = s.value) == null ? void 0 : z.split(" ")) || [], G = j[0] || null, J = j[1] || "", K = i.find((e) => G === e.phone), [c, g] = f(!1), [d, N] = f(""), [r, S] = f(
|
|
27
27
|
K || null
|
|
28
28
|
), [L, T] = f(J), [Q, I] = f(!1), x = h(null), $ = h(null), E = h(null), b = h(null), { x: Z, y: ee, strategy: te, refs: O, context: w, placement: oe, middlewareData: P } = be({
|
|
29
29
|
open: c,
|
|
@@ -47,7 +47,7 @@ const Ye = ({
|
|
|
47
47
|
}), ne = we(w), re = Ce(w), { getReferenceProps: se, getFloatingProps: le } = ve([
|
|
48
48
|
ne,
|
|
49
49
|
re
|
|
50
|
-
]), { isMounted: ae, styles: ie } =
|
|
50
|
+
]), { isMounted: ae, styles: ie } = ye(w, {
|
|
51
51
|
duration: {
|
|
52
52
|
open: 200,
|
|
53
53
|
close: 150
|
|
@@ -61,7 +61,7 @@ const Ye = ({
|
|
|
61
61
|
const o = W === "es" && e.labelES ? e.labelES.toLowerCase() : e.label.toLowerCase(), n = e.code ? e.code.toLowerCase() : "", a = e.phone ? e.phone.toLowerCase() : "";
|
|
62
62
|
return o.includes(d.toLowerCase()) || n.includes(d.toLowerCase()) || a.includes(d.toLowerCase());
|
|
63
63
|
}), ce = (e) => {
|
|
64
|
-
S(e), g(!1),
|
|
64
|
+
S(e), g(!1), N("");
|
|
65
65
|
const o = `${e.phone} ${L}`;
|
|
66
66
|
s.onChange(o), setTimeout(() => {
|
|
67
67
|
var n;
|
|
@@ -113,7 +113,7 @@ const Ye = ({
|
|
|
113
113
|
}[oe.split("-")[0]], fe = se({
|
|
114
114
|
onClick: ue,
|
|
115
115
|
onBlur: B
|
|
116
|
-
}), _ = () =>
|
|
116
|
+
}), _ = () => y.error ? "border-red-500" : Q || c ? "border-blue-400" : "border-blue-100", he = l(Y), ge = l(U), p = (V = y.error) == null ? void 0 : V.message;
|
|
117
117
|
return /* @__PURE__ */ t.jsxs("div", { className: `w-full relative flex flex-col gap-8 ${X}`, children: [
|
|
118
118
|
/* @__PURE__ */ t.jsx(
|
|
119
119
|
"label",
|
|
@@ -163,11 +163,11 @@ const Ye = ({
|
|
|
163
163
|
"+",
|
|
164
164
|
r.phone
|
|
165
165
|
] })
|
|
166
|
-
] }) : /* @__PURE__ */ t.jsx("span", { className: "text-gray-
|
|
166
|
+
] }) : /* @__PURE__ */ t.jsx("span", { className: "text-gray-400 font-600 text-body-m truncate", children: l("select_country") }),
|
|
167
167
|
/* @__PURE__ */ t.jsx(
|
|
168
|
-
|
|
168
|
+
je,
|
|
169
169
|
{
|
|
170
|
-
icon:
|
|
170
|
+
icon: Ne,
|
|
171
171
|
className: "w-14 h-14 min-w-14 min-h-14"
|
|
172
172
|
}
|
|
173
173
|
)
|
|
@@ -179,7 +179,7 @@ const Ye = ({
|
|
|
179
179
|
{
|
|
180
180
|
ref: E,
|
|
181
181
|
type: "tel",
|
|
182
|
-
className: `flex-grow bg-light rounded-r-full font-600 text-
|
|
182
|
+
className: `placeholder:text-gray-400 flex-grow bg-light rounded-r-full font-600 text-body-m p-16 border transition-all duration-200 ${p ? "border-red-500" : _()}`,
|
|
183
183
|
placeholder: ge,
|
|
184
184
|
value: L,
|
|
185
185
|
onChange: de,
|
|
@@ -229,7 +229,7 @@ const Ye = ({
|
|
|
229
229
|
className: "w-fit p-16",
|
|
230
230
|
placeholder: l("search") + "...",
|
|
231
231
|
value: d,
|
|
232
|
-
onChange: (e) =>
|
|
232
|
+
onChange: (e) => N(e.target.value),
|
|
233
233
|
onClick: (e) => e.stopPropagation(),
|
|
234
234
|
onBlur: (e) => {
|
|
235
235
|
e.stopPropagation();
|
|
@@ -271,7 +271,7 @@ const Ye = ({
|
|
|
271
271
|
},
|
|
272
272
|
`${e.code}-${o}`
|
|
273
273
|
);
|
|
274
|
-
}) }) : /* @__PURE__ */ t.jsx("div", { className: "px-
|
|
274
|
+
}) }) : /* @__PURE__ */ t.jsx("div", { className: "px-16 py-8 text-gray-500 text-body-s", children: l("no_countries_found") }) })
|
|
275
275
|
]
|
|
276
276
|
}
|
|
277
277
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Control, FieldValues } from 'react-hook-form';
|
|
1
|
+
import { Control, FieldValues, Path } from 'react-hook-form';
|
|
2
2
|
import { Country } from '../../../constants/countries';
|
|
3
|
-
export interface PhoneInputProps<T extends FieldValues> {
|
|
3
|
+
export interface PhoneInputProps<T extends FieldValues = FieldValues> {
|
|
4
4
|
countries?: Country[];
|
|
5
|
-
name:
|
|
5
|
+
name: Path<T>;
|
|
6
6
|
control: Control<T>;
|
|
7
7
|
label?: string;
|
|
8
8
|
placeholder?: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
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;
|
|
4
|
+
export default SelectInput;
|
package/dist/components/atoms/{SelectDropdown/SelectDropdown.js → SelectInput/SelectInput.js}
RENAMED
|
@@ -4,10 +4,10 @@ import { useState as b, useRef as k, 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
|
-
import { offset as Q, flip as V, shift as X, size as Z, arrow as
|
|
8
|
-
const
|
|
9
|
-
options:
|
|
10
|
-
name:
|
|
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
|
+
const ce = ({
|
|
9
|
+
options: a,
|
|
10
|
+
name: l,
|
|
11
11
|
control: c,
|
|
12
12
|
label: d = "Select an option",
|
|
13
13
|
placeholder: p = "Type to search...",
|
|
@@ -16,13 +16,13 @@ const ie = ({
|
|
|
16
16
|
}) => /* @__PURE__ */ e.jsx(
|
|
17
17
|
G,
|
|
18
18
|
{
|
|
19
|
-
name:
|
|
19
|
+
name: l,
|
|
20
20
|
control: c,
|
|
21
|
-
render: ({ field: { onChange: f, value:
|
|
22
|
-
|
|
21
|
+
render: ({ field: { onChange: f, value: o }, fieldState: { error: s } }) => /* @__PURE__ */ e.jsx(
|
|
22
|
+
te,
|
|
23
23
|
{
|
|
24
|
-
options:
|
|
25
|
-
value:
|
|
24
|
+
options: a,
|
|
25
|
+
value: o,
|
|
26
26
|
onChange: f,
|
|
27
27
|
label: d,
|
|
28
28
|
placeholder: p,
|
|
@@ -32,9 +32,9 @@ const ie = ({
|
|
|
32
32
|
}
|
|
33
33
|
)
|
|
34
34
|
}
|
|
35
|
-
),
|
|
36
|
-
options:
|
|
37
|
-
value:
|
|
35
|
+
), te = ({
|
|
36
|
+
options: a,
|
|
37
|
+
value: l,
|
|
38
38
|
onChange: c,
|
|
39
39
|
label: d = "Select an option",
|
|
40
40
|
placeholder: p = "Type to search...",
|
|
@@ -42,8 +42,8 @@ const ie = ({
|
|
|
42
42
|
className: u = "",
|
|
43
43
|
input: f = !0
|
|
44
44
|
}) => {
|
|
45
|
-
const { t:
|
|
46
|
-
|
|
45
|
+
const { t: o } = J(), [s, m] = b(!1), [x, y] = b(""), [j, w] = b(
|
|
46
|
+
l || null
|
|
47
47
|
), h = k(null), C = k(null), { x: T, y: O, strategy: $, refs: v, context: g } = B({
|
|
48
48
|
open: s,
|
|
49
49
|
onOpenChange: m,
|
|
@@ -52,33 +52,33 @@ const ie = ({
|
|
|
52
52
|
V(),
|
|
53
53
|
X({ padding: 8 }),
|
|
54
54
|
Z({
|
|
55
|
-
apply({ availableHeight: t, elements:
|
|
56
|
-
Object.assign(
|
|
55
|
+
apply({ availableHeight: t, elements: n }) {
|
|
56
|
+
Object.assign(n.floating.style, {
|
|
57
57
|
maxHeight: `${Math.min(t - 10, 300)}px`
|
|
58
58
|
});
|
|
59
59
|
},
|
|
60
60
|
padding: 8
|
|
61
61
|
}),
|
|
62
|
-
|
|
62
|
+
ee({ element: C })
|
|
63
63
|
],
|
|
64
64
|
placement: "bottom-start",
|
|
65
65
|
whileElementsMounted: K
|
|
66
|
-
}), L = H(g),
|
|
66
|
+
}), L = H(g), P = U(g), { getReferenceProps: R, getFloatingProps: F } = W([
|
|
67
67
|
L,
|
|
68
|
-
|
|
69
|
-
]), { isMounted: N, styles:
|
|
68
|
+
P
|
|
69
|
+
]), { isMounted: N, styles: I } = Y(g, {
|
|
70
70
|
duration: { open: 200, close: 150 },
|
|
71
71
|
initial: { opacity: 0, transform: "translateY(-4px)" }
|
|
72
72
|
}), S = (() => {
|
|
73
|
-
const t = Array.isArray(
|
|
73
|
+
const t = Array.isArray(a) ? a : [];
|
|
74
74
|
if (!x.trim()) return t;
|
|
75
|
-
const
|
|
75
|
+
const n = x.toLowerCase();
|
|
76
76
|
return t.filter((i) => {
|
|
77
|
-
const
|
|
78
|
-
return
|
|
77
|
+
const D = i.label.toLowerCase(), _ = i.key.toLowerCase();
|
|
78
|
+
return D.includes(n) || _.includes(n);
|
|
79
79
|
});
|
|
80
80
|
})(), M = (t) => {
|
|
81
|
-
w(t), m(!1),
|
|
81
|
+
w(t), m(!1), y(""), c(t);
|
|
82
82
|
}, z = () => {
|
|
83
83
|
m(!s), !s && h.current && setTimeout(() => {
|
|
84
84
|
var t;
|
|
@@ -86,11 +86,11 @@ const ie = ({
|
|
|
86
86
|
}, 100);
|
|
87
87
|
};
|
|
88
88
|
q(() => {
|
|
89
|
-
w(
|
|
90
|
-
}, [
|
|
91
|
-
const E =
|
|
89
|
+
w(l);
|
|
90
|
+
}, [l]);
|
|
91
|
+
const E = R({
|
|
92
92
|
onClick: z
|
|
93
|
-
});
|
|
93
|
+
}), A = o(p);
|
|
94
94
|
return /* @__PURE__ */ e.jsxs("div", { className: `w-full relative flex flex-col gap-8 ${u}`, children: [
|
|
95
95
|
/* @__PURE__ */ e.jsx(
|
|
96
96
|
"label",
|
|
@@ -108,7 +108,7 @@ const ie = ({
|
|
|
108
108
|
${r && "border-red-500 hover:border-red-600"} ${N ? "border-blue-400" : "border-blue-100"}`,
|
|
109
109
|
...E,
|
|
110
110
|
children: [
|
|
111
|
-
|
|
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 }),
|
|
112
112
|
/* @__PURE__ */ e.jsx(
|
|
113
113
|
"svg",
|
|
114
114
|
{
|
|
@@ -139,10 +139,10 @@ const ie = ({
|
|
|
139
139
|
position: $,
|
|
140
140
|
top: O ?? 0,
|
|
141
141
|
left: T ?? 0,
|
|
142
|
-
...
|
|
142
|
+
...I
|
|
143
143
|
},
|
|
144
144
|
className: "z-10 w-full bg-white border border-blue-400 rounded-3xl shadow-lg overflow-auto",
|
|
145
|
-
...
|
|
145
|
+
...F(),
|
|
146
146
|
children: [
|
|
147
147
|
f && /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 bg-white p-2 z-20", children: /* @__PURE__ */ e.jsx(
|
|
148
148
|
"input",
|
|
@@ -152,27 +152,27 @@ const ie = ({
|
|
|
152
152
|
className: "w-full p-16",
|
|
153
153
|
placeholder: "Search...",
|
|
154
154
|
value: x,
|
|
155
|
-
onChange: (t) =>
|
|
155
|
+
onChange: (t) => y(t.target.value),
|
|
156
156
|
onClick: (t) => t.stopPropagation(),
|
|
157
157
|
autoFocus: !0
|
|
158
158
|
}
|
|
159
159
|
) }),
|
|
160
|
-
/* @__PURE__ */ e.jsx("div", { className: "", children: S.length > 0 ? /* @__PURE__ */ e.jsx("ul", { children: S.map((t,
|
|
160
|
+
/* @__PURE__ */ e.jsx("div", { className: "", children: S.length > 0 ? /* @__PURE__ */ e.jsx("ul", { children: S.map((t, n) => /* @__PURE__ */ e.jsx(
|
|
161
161
|
"li",
|
|
162
162
|
{
|
|
163
163
|
className: "flex items-center justify-between px-16 py-8 transition-all duration-200 hover:bg-blue-100/50 cursor-pointer",
|
|
164
164
|
onClick: (i) => {
|
|
165
165
|
i.stopPropagation(), M(t);
|
|
166
166
|
},
|
|
167
|
-
children: /* @__PURE__ */ e.jsx("span", { children:
|
|
167
|
+
children: /* @__PURE__ */ e.jsx("span", { children: o(t.label) })
|
|
168
168
|
},
|
|
169
|
-
`${t.key}-${
|
|
170
|
-
)) }) : /* @__PURE__ */ e.jsx("div", { className: "px-
|
|
169
|
+
`${t.key}-${n}`
|
|
170
|
+
)) }) : /* @__PURE__ */ e.jsx("div", { className: "px-16 py-8 text-gray-500 text-body-s", children: o("no_options_found") }) })
|
|
171
171
|
]
|
|
172
172
|
}
|
|
173
173
|
)
|
|
174
174
|
] });
|
|
175
175
|
};
|
|
176
176
|
export {
|
|
177
|
-
|
|
177
|
+
ce as default
|
|
178
178
|
};
|
|
@@ -3,7 +3,7 @@ export interface Option {
|
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface SelectInputProps<T extends FieldValues> {
|
|
7
7
|
options: Option[];
|
|
8
8
|
name: Path<T>;
|
|
9
9
|
control: Control<T>;
|
|
@@ -12,7 +12,7 @@ export interface SelectDropdownProps<T extends FieldValues> {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
input?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface SelectInputFieldProps {
|
|
16
16
|
options: Option[];
|
|
17
17
|
value: Option | null;
|
|
18
18
|
onChange: (option: Option | null) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SelectInput } from './SelectInput';
|
|
@@ -21,7 +21,7 @@ export * from './PhoneInput/index';
|
|
|
21
21
|
export * from './ProgressBar/index';
|
|
22
22
|
export * from './SearchBar/index';
|
|
23
23
|
export * from './SectionButton/index';
|
|
24
|
-
export * from './
|
|
24
|
+
export * from './SelectInput/index';
|
|
25
25
|
export * from './SidebarButton/index';
|
|
26
26
|
export * from './Tab/index';
|
|
27
27
|
export * from './TextButton/index';
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,9 @@ import { default as I } from "./components/atoms/Checkbox/Checkbox.js";
|
|
|
9
9
|
import { default as C } from "./components/atoms/CountryInput/CountryInput.js";
|
|
10
10
|
import { default as B } from "./components/atoms/CountryLabel/CountryLabel.js";
|
|
11
11
|
import { default as h } from "./components/atoms/CountrySelectInput/CountryDropdown.js";
|
|
12
|
-
import { default as
|
|
12
|
+
import { default as y } from "./components/atoms/Divider/Divider.js";
|
|
13
13
|
import { default as b } from "./components/atoms/IconButton/IconButton.js";
|
|
14
|
-
import { default as
|
|
14
|
+
import { default as w } from "./components/atoms/ImageProfileInput/ImageProfileInput.js";
|
|
15
15
|
import { default as L } from "./components/atoms/ImageProfileInput/ImageProfileInput.validators.js";
|
|
16
16
|
import { default as v } from "./components/atoms/IndexedStep/IndexedStep.js";
|
|
17
17
|
import { default as z } from "./components/atoms/InfoCard/InfoCard.js";
|
|
@@ -22,7 +22,7 @@ import { default as H } from "./components/atoms/PhoneInput/PhoneInput.js";
|
|
|
22
22
|
import { default as K } from "./components/atoms/ProgressBar/ProgressBar.js";
|
|
23
23
|
import { SearchBar as Q } from "./components/atoms/SearchBar/index.js";
|
|
24
24
|
import { default as W } from "./components/atoms/SectionButton/SectionButton.js";
|
|
25
|
-
import { default as Y } from "./components/atoms/
|
|
25
|
+
import { default as Y } from "./components/atoms/SelectInput/SelectInput.js";
|
|
26
26
|
import { default as _ } from "./components/atoms/SidebarButton/SidebarButton.js";
|
|
27
27
|
import { default as oo } from "./components/atoms/Tab/Tab.js";
|
|
28
28
|
import { default as eo } from "./components/atoms/TextButton/TextButton.js";
|
|
@@ -35,9 +35,9 @@ import { default as co } from "./components/atoms/UploadContainer/UploadContaine
|
|
|
35
35
|
import { default as To } from "./components/molecules/AlertModal/AlertModal.js";
|
|
36
36
|
import { default as go } from "./components/molecules/CalendarSelector/CalendarSelector.js";
|
|
37
37
|
import { default as So } from "./components/molecules/DateInput/DateInput.js";
|
|
38
|
-
import { default as
|
|
39
|
-
import { default as
|
|
40
|
-
import { default as
|
|
38
|
+
import { default as Mo } from "./components/molecules/DialogModal/DialogModal.js";
|
|
39
|
+
import { default as Do } from "./components/molecules/Dropdown/Dropdown.js";
|
|
40
|
+
import { default as Po } from "./components/molecules/FileUpload/FileUpload.js";
|
|
41
41
|
import { default as Ao } from "./components/molecules/FloatingMenu/FloatingMenu.js";
|
|
42
42
|
import { default as Uo } from "./components/molecules/SearchModal/SearchModal.js";
|
|
43
43
|
import { default as Fo } from "./components/molecules/Stepper/Stepper.js";
|
|
@@ -46,14 +46,14 @@ import { Organism as Vo } from "./components/organisms/index.js";
|
|
|
46
46
|
import { formatLocalizedDate as qo } from "./utils/dates.js";
|
|
47
47
|
import { toBase64 as Go, translateBytes as Ho } from "./utils/files.js";
|
|
48
48
|
import { getImageUrl as Ko } from "./utils/images.js";
|
|
49
|
-
import { ModalContainer as Qo, closeModal as Ro,
|
|
50
|
-
import { renderTabContent as
|
|
51
|
-
import { capitalizeFirstLetter as
|
|
52
|
-
import { showToastAsync as
|
|
53
|
-
import { ThemeProvider as
|
|
54
|
-
import { useTheme as
|
|
49
|
+
import { ModalContainer as Qo, closeModal as Ro, openCustomModal as Wo, openModal as Xo } from "./utils/modal.js";
|
|
50
|
+
import { renderTabContent as Zo } from "./utils/renderContentOptions.js";
|
|
51
|
+
import { capitalizeFirstLetter as $o, stringToColor as ot } from "./utils/strings.js";
|
|
52
|
+
import { showToastAsync as et, showToastLoading as rt, toast as at } from "./utils/toast.js";
|
|
53
|
+
import { ThemeProvider as pt } from "./providers/ThemeProvider.js";
|
|
54
|
+
import { useTheme as dt } from "./hooks/useTheme.js";
|
|
55
55
|
import "./contexts/themeContext.js";
|
|
56
|
-
import { defaultTheme as
|
|
56
|
+
import { defaultTheme as st } from "./themes/default.js";
|
|
57
57
|
export {
|
|
58
58
|
a as ActionButton,
|
|
59
59
|
To as AlertModal,
|
|
@@ -68,13 +68,13 @@ export {
|
|
|
68
68
|
C as CountryInput,
|
|
69
69
|
B as CountryLabel,
|
|
70
70
|
So as DateInput,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
Mo as DialogModal,
|
|
72
|
+
y as Divider,
|
|
73
|
+
Do as Dropdown,
|
|
74
|
+
Po as FileUpload,
|
|
75
75
|
Ao as FloatingMenu,
|
|
76
76
|
b as IconButton,
|
|
77
|
-
|
|
77
|
+
w as ImageProfileInput,
|
|
78
78
|
v as IndexedStep,
|
|
79
79
|
z as InfoCard,
|
|
80
80
|
O as InformationDisclaimer,
|
|
@@ -87,7 +87,7 @@ export {
|
|
|
87
87
|
Q as SearchBar,
|
|
88
88
|
Uo as SearchModal,
|
|
89
89
|
W as SectionButton,
|
|
90
|
-
Y as
|
|
90
|
+
Y as SelectInput,
|
|
91
91
|
_ as SidebarButton,
|
|
92
92
|
Fo as Stepper,
|
|
93
93
|
oo as Tab,
|
|
@@ -95,24 +95,25 @@ export {
|
|
|
95
95
|
eo as TextButton,
|
|
96
96
|
ao as TextInput,
|
|
97
97
|
po as TextStaticInput,
|
|
98
|
-
|
|
98
|
+
pt as ThemeProvider,
|
|
99
99
|
mo as Toast,
|
|
100
100
|
uo as UncontrolledSelector,
|
|
101
101
|
no as UncontrolledTextInput,
|
|
102
102
|
co as UploadContainer,
|
|
103
|
-
|
|
103
|
+
$o as capitalizeFirstLetter,
|
|
104
104
|
Ro as closeModal,
|
|
105
|
-
|
|
105
|
+
st as defaultTheme,
|
|
106
106
|
qo as formatLocalizedDate,
|
|
107
107
|
Ko as getImageUrl,
|
|
108
|
-
Wo as
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
et as
|
|
112
|
-
|
|
108
|
+
Wo as openCustomModal,
|
|
109
|
+
Xo as openModal,
|
|
110
|
+
Zo as renderTabContent,
|
|
111
|
+
et as showToastAsync,
|
|
112
|
+
rt as showToastLoading,
|
|
113
|
+
ot as stringToColor,
|
|
113
114
|
Go as toBase64,
|
|
114
|
-
|
|
115
|
+
at as toast,
|
|
115
116
|
Ho as translateBytes,
|
|
116
|
-
|
|
117
|
+
dt as useTheme,
|
|
117
118
|
L as yupImageProfileValidator
|
|
118
119
|
};
|