prometeo-design-system 2.7.6 → 2.7.8
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/Button.es.js +5 -5
- package/dist/{CardProfile-DV3gwvqE.js → CardProfile-WHoeSibd.js} +24 -24
- package/dist/CardProfile.es.js +1 -1
- package/dist/CheckBox.es.js +2 -2
- package/dist/CheckboxFormik.es.js +2 -2
- package/dist/DatePicker.es.js +68 -68
- package/dist/DrawerDesktop.es.js +4 -4
- package/dist/DropZone.es.js +32 -32
- package/dist/FAButton.es.js +2 -2
- package/dist/HelperComponent-BeNlTMqI.js +24 -0
- package/dist/Icons/Icons.d.ts +61 -1
- package/dist/Icons.es.js +68 -8
- package/dist/{ImageGallery-D8nIvBpV.js → ImageGallery-WKzUevOQ.js} +43 -43
- package/dist/ImageGallery.es.js +1 -1
- package/dist/{Input-60IT1aGF.js → Input-D6as6xD-.js} +61 -61
- package/dist/Input.es.js +1 -1
- package/dist/InputFormik.es.js +32 -32
- package/dist/InputFormikV2.es.js +1 -1
- package/dist/InputMultiple.es.js +51 -51
- package/dist/Logo.es.js +3 -3
- package/dist/Menu.es.js +2 -2
- package/dist/OtpInput.es.js +42 -42
- package/dist/Pagination.es.js +1 -1
- package/dist/RadioButton.es.js +1 -1
- package/dist/{Select-C4UvSsof.js → Select-sdfP2TL0.js} +164 -164
- package/dist/Select.es.js +1 -1
- package/dist/SelectFormik.es.js +1 -1
- package/dist/SelectFormikLegacy.es.js +25 -25
- package/dist/SelectSearch.es.js +1 -1
- package/dist/Steps.es.js +14 -14
- package/dist/TabLinks.es.js +2 -2
- package/dist/Table.es.js +2 -2
- package/dist/Toast.es.js +23 -23
- package/dist/Tooltip.es.js +7 -7
- package/dist/components/Spinner/SpinnerV2.d.ts +12 -0
- package/dist/components/Toaster/Toaster.d.ts +3 -3
- package/dist/exports/Icons.d.ts +1 -1
- package/dist/prometeo-design-system.css +1 -1
- package/dist/prometeo-design-system.es.js +126 -125
- package/package.json +1 -1
- package/dist/HelperComponent-U6mPwuDH.js +0 -24
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as r } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
-
import { Icons as z } from "./Icons.es.js";
|
|
3
2
|
import { c as t } from "./cn-B6yFEsav.js";
|
|
4
|
-
import { useRef as
|
|
5
|
-
import
|
|
6
|
-
import { H as
|
|
7
|
-
import
|
|
8
|
-
|
|
3
|
+
import { useRef as _, useLayoutEffect as q, memo as V, forwardRef as F, useState as ee } from "react";
|
|
4
|
+
import te from "./Spinner.es.js";
|
|
5
|
+
import { H as re } from "./HelperComponent-BeNlTMqI.js";
|
|
6
|
+
import oe from "./Button.es.js";
|
|
7
|
+
import { EyeVisibility as le, EyeVisibilityOff as se, Close as ae } from "./Icons.es.js";
|
|
8
|
+
const ne = (o) => {
|
|
9
9
|
let e = o;
|
|
10
10
|
for (; e && e !== document.body; ) {
|
|
11
11
|
const n = window.getComputedStyle(e).backgroundColor;
|
|
@@ -16,11 +16,11 @@ const se = (o) => {
|
|
|
16
16
|
const l = window.getComputedStyle(document.body).backgroundColor;
|
|
17
17
|
return l && l !== "transparent" && l !== "rgba(0, 0, 0, 0)" ? l : "rgb(255, 255, 255)";
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
const o =
|
|
21
|
-
return
|
|
19
|
+
function ue() {
|
|
20
|
+
const o = _(null);
|
|
21
|
+
return q(() => {
|
|
22
22
|
if (!o.current || !o.current.parentElement) return;
|
|
23
|
-
const e =
|
|
23
|
+
const e = ne(o.current.parentElement);
|
|
24
24
|
o.current.style.backgroundColor = e;
|
|
25
25
|
}, []), {
|
|
26
26
|
ref: o
|
|
@@ -60,12 +60,12 @@ const b = {
|
|
|
60
60
|
label: t("text-success", "peer-focus:text-success-light"),
|
|
61
61
|
icon: t("text-success-light", "peer-focus:text-success-light")
|
|
62
62
|
}
|
|
63
|
-
}, S =
|
|
63
|
+
}, S = F(
|
|
64
64
|
({
|
|
65
65
|
label: o,
|
|
66
66
|
icon: e,
|
|
67
67
|
iconPosition: l = "left",
|
|
68
|
-
onChange:
|
|
68
|
+
onChange: z,
|
|
69
69
|
value: n,
|
|
70
70
|
name: g,
|
|
71
71
|
width: m = "100%",
|
|
@@ -78,19 +78,19 @@ const b = {
|
|
|
78
78
|
isFetching: f,
|
|
79
79
|
errorComponent: h,
|
|
80
80
|
helperComponent: w,
|
|
81
|
-
placeholder:
|
|
82
|
-
required:
|
|
83
|
-
onFocus:
|
|
84
|
-
onBlur:
|
|
85
|
-
onKeyDown:
|
|
86
|
-
onKeyUp:
|
|
87
|
-
className:
|
|
88
|
-
style:
|
|
89
|
-
readOnly:
|
|
90
|
-
onClear:
|
|
91
|
-
...
|
|
92
|
-
},
|
|
93
|
-
const [y,
|
|
81
|
+
placeholder: I,
|
|
82
|
+
required: C = !1,
|
|
83
|
+
onFocus: $,
|
|
84
|
+
onBlur: k,
|
|
85
|
+
onKeyDown: B,
|
|
86
|
+
onKeyUp: L,
|
|
87
|
+
className: R,
|
|
88
|
+
style: P,
|
|
89
|
+
readOnly: D = !1,
|
|
90
|
+
onClear: N,
|
|
91
|
+
...v
|
|
92
|
+
}, A) => {
|
|
93
|
+
const [y, M] = ee(!1), { ref: O } = ue();
|
|
94
94
|
let p = H;
|
|
95
95
|
u && (p = "customHeight");
|
|
96
96
|
const d = {
|
|
@@ -122,11 +122,11 @@ const b = {
|
|
|
122
122
|
label: "text-sm peer-focus:text-sm peer-placeholder-shown:text-xs ",
|
|
123
123
|
icon: "w-6 h-6 right-3"
|
|
124
124
|
}
|
|
125
|
-
},
|
|
126
|
-
|
|
125
|
+
}, T = () => {
|
|
126
|
+
M(!y);
|
|
127
127
|
}, j = {};
|
|
128
128
|
m && m !== "100%" && (j.width = m), u && (j.height = u);
|
|
129
|
-
const
|
|
129
|
+
const E = c === "error" && h, G = !E && w, J = s === "password", K = () => a === "static" ? "-top-1 -translate-y-full left-0 pl-3" : e ? `${i ? "peer-placeholder-shown:top-[calc(50%-12px)]" : "peer-placeholder-shown:top-1/2"} -translate-y-1/2 peer-focus:top-0 peer-focus:left-3 peer-focus:px-1 peer-focus:ml-0 peer-focus:mr-0 ${l === "left" ? "peer-placeholder-shown:ml-6" : "peer-placeholder-shown:mr-6"}` : `${i ? "peer-placeholder-shown:top-[calc(50%-12px)]" : "peer-placeholder-shown:top-1/2"} -translate-y-1/2 peer-focus:top-0 peer-focus:left-3 peer-focus:px-1`, Q = () => u ? d.customHeight.label : d[p].label, U = () => u ? { height: u } : {}, W = () => a === "default" ? o : I || o || "", X = () => J ? e ? l === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : e ? l === "left" ? "pl-10 pr-3" : "pr-10 pl-3" : "", Y = a === "default" && "transition-all duration-200 ease-in-out", i = h || w;
|
|
130
130
|
return /* @__PURE__ */ r.jsxs(
|
|
131
131
|
"div",
|
|
132
132
|
{
|
|
@@ -136,18 +136,18 @@ const b = {
|
|
|
136
136
|
!m && "w-full",
|
|
137
137
|
"bg-inherit",
|
|
138
138
|
a === "static" && "mt-2",
|
|
139
|
-
|
|
139
|
+
R
|
|
140
140
|
),
|
|
141
|
-
style: { ...
|
|
141
|
+
style: { ...P, ...j },
|
|
142
142
|
children: [
|
|
143
143
|
/* @__PURE__ */ r.jsx(
|
|
144
144
|
"input",
|
|
145
145
|
{
|
|
146
146
|
id: g,
|
|
147
147
|
name: g,
|
|
148
|
-
ref:
|
|
148
|
+
ref: A,
|
|
149
149
|
value: n,
|
|
150
|
-
placeholder:
|
|
150
|
+
placeholder: W(),
|
|
151
151
|
type: s === "password" && y ? "text" : s,
|
|
152
152
|
className: t(
|
|
153
153
|
"peer w-full border rounded-lg bg-transparent appearance-none transition-all duration-200 ease-in-out",
|
|
@@ -159,33 +159,33 @@ const b = {
|
|
|
159
159
|
e && "pr-10",
|
|
160
160
|
x && "bg-transparent opacity-60 border-neutral-strong-default text-neutral-medium-disabled",
|
|
161
161
|
b[c].container,
|
|
162
|
-
|
|
162
|
+
X()
|
|
163
163
|
),
|
|
164
|
-
style:
|
|
165
|
-
onChange:
|
|
166
|
-
onFocus:
|
|
167
|
-
onBlur:
|
|
164
|
+
style: U(),
|
|
165
|
+
onChange: z,
|
|
166
|
+
onFocus: $,
|
|
167
|
+
onBlur: k,
|
|
168
168
|
disabled: x,
|
|
169
|
-
required:
|
|
170
|
-
onKeyDown:
|
|
171
|
-
onKeyUp:
|
|
172
|
-
defaultValue:
|
|
173
|
-
readOnly:
|
|
174
|
-
...
|
|
169
|
+
required: C,
|
|
170
|
+
onKeyDown: B,
|
|
171
|
+
onKeyUp: L,
|
|
172
|
+
defaultValue: v.defaultValue,
|
|
173
|
+
readOnly: D,
|
|
174
|
+
...v
|
|
175
175
|
}
|
|
176
176
|
),
|
|
177
177
|
/* @__PURE__ */ r.jsx(
|
|
178
178
|
"label",
|
|
179
179
|
{
|
|
180
|
-
ref:
|
|
180
|
+
ref: O,
|
|
181
181
|
htmlFor: g,
|
|
182
182
|
className: t(
|
|
183
183
|
"absolute left-3 pointer-events-none px-1 z-10",
|
|
184
|
-
|
|
185
|
-
U(),
|
|
186
|
-
b[c].label,
|
|
184
|
+
Y,
|
|
187
185
|
Q(),
|
|
188
|
-
|
|
186
|
+
b[c].label,
|
|
187
|
+
K(),
|
|
188
|
+
C && "after:content-['*'] after:text-error-default after:ml-1",
|
|
189
189
|
x && "text-neutral-medium-disabled prometeo-fonts-label-large"
|
|
190
190
|
),
|
|
191
191
|
children: o
|
|
@@ -203,17 +203,17 @@ const b = {
|
|
|
203
203
|
s === "password" && !f ? "cursor-pointer" : "pointer-events-none",
|
|
204
204
|
l === "right" ? "right-3" : "left-3"
|
|
205
205
|
),
|
|
206
|
-
onClick: s === "password" && !f ?
|
|
207
|
-
onMouseDown: (
|
|
206
|
+
onClick: s === "password" && !f ? T : void 0,
|
|
207
|
+
onMouseDown: (Z) => s === "password" && !f && Z.preventDefault(),
|
|
208
208
|
children: /* @__PURE__ */ r.jsxs("div", { children: [
|
|
209
|
-
f && s !== "password" && /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(
|
|
210
|
-
s === "password" && (y ? /* @__PURE__ */ r.jsx(
|
|
209
|
+
f && s !== "password" && /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(te, { size: 24, color: "#7c86ff", loading: !0, variant: "clip" }) }),
|
|
210
|
+
s === "password" && (y ? /* @__PURE__ */ r.jsx(le, { size: 24, className: "" }) : /* @__PURE__ */ r.jsx(se, { size: 24, className: "" })),
|
|
211
211
|
e
|
|
212
212
|
] })
|
|
213
213
|
}
|
|
214
214
|
),
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
N && /* @__PURE__ */ r.jsx(
|
|
216
|
+
oe,
|
|
217
217
|
{
|
|
218
218
|
type: "button",
|
|
219
219
|
color: "secondary",
|
|
@@ -227,14 +227,14 @@ const b = {
|
|
|
227
227
|
),
|
|
228
228
|
label: "",
|
|
229
229
|
disabled: x,
|
|
230
|
-
onClick:
|
|
230
|
+
onClick: N,
|
|
231
231
|
variant: "text",
|
|
232
232
|
animateIcon: !1,
|
|
233
|
-
icon: /* @__PURE__ */ r.jsx(
|
|
233
|
+
icon: /* @__PURE__ */ r.jsx(ae, { size: 20, className: "" })
|
|
234
234
|
}
|
|
235
235
|
),
|
|
236
|
-
i && /* @__PURE__ */ r.jsx("div", { className: "min-h-6", children: (
|
|
237
|
-
|
|
236
|
+
i && /* @__PURE__ */ r.jsx("div", { className: "min-h-6", children: (E || G) && /* @__PURE__ */ r.jsx(
|
|
237
|
+
re,
|
|
238
238
|
{
|
|
239
239
|
className: "absolute ",
|
|
240
240
|
variant: c,
|
|
@@ -247,8 +247,8 @@ const b = {
|
|
|
247
247
|
}
|
|
248
248
|
);
|
|
249
249
|
S.displayName = "Input";
|
|
250
|
-
const
|
|
250
|
+
const be = V(S);
|
|
251
251
|
export {
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
be as I,
|
|
253
|
+
ue as u
|
|
254
254
|
};
|
package/dist/Input.es.js
CHANGED
package/dist/InputFormik.es.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
+
import { EyeVisibility as O, EyeVisibilityOff as q } from "./Icons.es.js";
|
|
2
3
|
import { c as s } from "./cn-B6yFEsav.js";
|
|
3
|
-
import { FastField as
|
|
4
|
-
import { memo as
|
|
5
|
-
|
|
6
|
-
const W = ({
|
|
4
|
+
import { FastField as G, ErrorMessage as H } from "formik";
|
|
5
|
+
import { memo as J, useState as N, useRef as Q, useCallback as y, useLayoutEffect as W } from "react";
|
|
6
|
+
const X = ({
|
|
7
7
|
icon: t,
|
|
8
8
|
iconPosition: r = "left",
|
|
9
9
|
label: d,
|
|
10
10
|
className: B,
|
|
11
|
-
containerClassName:
|
|
11
|
+
containerClassName: I,
|
|
12
12
|
id: w,
|
|
13
13
|
type: j = "text",
|
|
14
14
|
labelVariant: n = "default",
|
|
15
15
|
placeholder: p,
|
|
16
16
|
disabled: b = !1,
|
|
17
17
|
field: l,
|
|
18
|
-
innerRef:
|
|
19
|
-
form:
|
|
18
|
+
innerRef: R,
|
|
19
|
+
form: $,
|
|
20
20
|
...a
|
|
21
21
|
}) => {
|
|
22
|
-
const [o, v] =
|
|
22
|
+
const [o, v] = N(!1), [C, z] = N(!1), i = Q(null), F = $.getFieldMeta(l.name), k = F.touched && F.error, E = l.value && l.value.toString().length > 0, x = j === "password", K = x ? C ? "text" : "password" : j, M = () => n === "static" ? p || d : p || "", P = () => x ? t ? r === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : t ? r === "left" ? "pl-10" : "pr-10" : "", A = y(() => {
|
|
23
23
|
v(!0), a.onFocus?.();
|
|
24
|
-
}, [a]),
|
|
24
|
+
}, [a]), D = y(
|
|
25
25
|
(c) => {
|
|
26
26
|
v(!1), a.onBlur?.(), l.onBlur(c);
|
|
27
27
|
},
|
|
28
28
|
[l, a]
|
|
29
|
-
),
|
|
30
|
-
|
|
29
|
+
), T = y(() => {
|
|
30
|
+
z((c) => !c);
|
|
31
31
|
}, []);
|
|
32
|
-
|
|
32
|
+
W(() => {
|
|
33
33
|
if (i.current) {
|
|
34
|
-
const
|
|
35
|
-
let u =
|
|
34
|
+
const V = ((L) => {
|
|
35
|
+
let u = L;
|
|
36
36
|
for (; u && u !== document.body; ) {
|
|
37
37
|
const f = window.getComputedStyle(u).backgroundColor;
|
|
38
38
|
if (f && f !== "transparent" && f !== "rgba(0, 0, 0, 0)")
|
|
@@ -44,7 +44,7 @@ const W = ({
|
|
|
44
44
|
})(
|
|
45
45
|
i.current.parentElement
|
|
46
46
|
);
|
|
47
|
-
i.current.style.backgroundColor =
|
|
47
|
+
i.current.style.backgroundColor = V;
|
|
48
48
|
}
|
|
49
49
|
}, []);
|
|
50
50
|
const g = {
|
|
@@ -78,7 +78,7 @@ const W = ({
|
|
|
78
78
|
icon: {},
|
|
79
79
|
placeholder: {}
|
|
80
80
|
}
|
|
81
|
-
},
|
|
81
|
+
}, U = {
|
|
82
82
|
none: {
|
|
83
83
|
label: "left-2 "
|
|
84
84
|
},
|
|
@@ -104,7 +104,7 @@ const W = ({
|
|
|
104
104
|
className: s(
|
|
105
105
|
"relative w-full bg-inherit",
|
|
106
106
|
n === "static" && "mt-5",
|
|
107
|
-
|
|
107
|
+
I
|
|
108
108
|
),
|
|
109
109
|
children: [
|
|
110
110
|
/* @__PURE__ */ e.jsxs("div", { className: "relative bg-inherit", children: [
|
|
@@ -113,25 +113,25 @@ const W = ({
|
|
|
113
113
|
{
|
|
114
114
|
disabled: b,
|
|
115
115
|
id: w || l.name,
|
|
116
|
-
type:
|
|
116
|
+
type: K,
|
|
117
117
|
name: l.name,
|
|
118
118
|
value: l.value || "",
|
|
119
|
-
placeholder:
|
|
119
|
+
placeholder: M(),
|
|
120
120
|
onChange: l.onChange,
|
|
121
|
-
onFocus:
|
|
121
|
+
onFocus: A,
|
|
122
122
|
onEmptied: a.onEmptied,
|
|
123
123
|
onKeyDown: a.onKeyDown,
|
|
124
124
|
onKeyUp: a.onKeyUp,
|
|
125
|
-
onBlur:
|
|
125
|
+
onBlur: D,
|
|
126
126
|
className: s(
|
|
127
|
-
"w-full px-3 h-12 text-left border
|
|
127
|
+
"w-full px-3 h-12 text-left border rounded-lg transition-all duration-200 ease-in-out text-neutral-default-default",
|
|
128
128
|
"bg-transparent focus:outline-none",
|
|
129
129
|
S[n].input,
|
|
130
130
|
g[h].input,
|
|
131
|
-
|
|
131
|
+
P(),
|
|
132
132
|
B
|
|
133
133
|
),
|
|
134
|
-
ref:
|
|
134
|
+
ref: R
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
137
|
/* @__PURE__ */ e.jsx(
|
|
@@ -142,7 +142,7 @@ const W = ({
|
|
|
142
142
|
className: s(
|
|
143
143
|
"absolute transition-all duration-200 font-bold text-sm ease-in-out pointer-events-none bg-inherit px-1 z-10",
|
|
144
144
|
"prometeo-fonts-label-large text-sm",
|
|
145
|
-
|
|
145
|
+
U[t ? r : "none"].label,
|
|
146
146
|
S[n].label,
|
|
147
147
|
g[h].label
|
|
148
148
|
),
|
|
@@ -164,7 +164,7 @@ const W = ({
|
|
|
164
164
|
"button",
|
|
165
165
|
{
|
|
166
166
|
type: "button",
|
|
167
|
-
onClick:
|
|
167
|
+
onClick: T,
|
|
168
168
|
className: s(
|
|
169
169
|
"absolute top-1/2 -translate-y-1/2 p-1 text-neutral-medium-default hover:text-neutral-strong-default",
|
|
170
170
|
"transition-colors duration-200 focus:outline-none focus:text-primary-default-default",
|
|
@@ -173,13 +173,13 @@ const W = ({
|
|
|
173
173
|
tabIndex: -1,
|
|
174
174
|
disabled: b,
|
|
175
175
|
children: C ? /* @__PURE__ */ e.jsx(
|
|
176
|
-
|
|
176
|
+
O,
|
|
177
177
|
{
|
|
178
178
|
size: 24,
|
|
179
179
|
className: "text-neutral-default-default"
|
|
180
180
|
}
|
|
181
181
|
) : /* @__PURE__ */ e.jsx(
|
|
182
|
-
|
|
182
|
+
q,
|
|
183
183
|
{
|
|
184
184
|
size: 24,
|
|
185
185
|
className: "text-neutral-default-default"
|
|
@@ -189,7 +189,7 @@ const W = ({
|
|
|
189
189
|
)
|
|
190
190
|
] }),
|
|
191
191
|
k && /* @__PURE__ */ e.jsx(
|
|
192
|
-
|
|
192
|
+
H,
|
|
193
193
|
{
|
|
194
194
|
name: l.name,
|
|
195
195
|
component: "span",
|
|
@@ -199,8 +199,8 @@ const W = ({
|
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
|
-
},
|
|
203
|
-
|
|
202
|
+
}, Y = J(X), re = (t) => /* @__PURE__ */ e.jsx(G, { name: t.name, children: ({ field: r, form: d }) => /* @__PURE__ */ e.jsx(
|
|
203
|
+
Y,
|
|
204
204
|
{
|
|
205
205
|
...t,
|
|
206
206
|
field: r,
|
|
@@ -209,5 +209,5 @@ const W = ({
|
|
|
209
209
|
}
|
|
210
210
|
) });
|
|
211
211
|
export {
|
|
212
|
-
|
|
212
|
+
re as default
|
|
213
213
|
};
|
package/dist/InputFormikV2.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as i } from "./jsx-runtime-DKDX3adD.js";
|
|
2
2
|
import { FastField as m, getIn as n } from "formik";
|
|
3
3
|
import { memo as s } from "react";
|
|
4
|
-
import { I as d } from "./Input-
|
|
4
|
+
import { I as d } from "./Input-D6as6xD-.js";
|
|
5
5
|
const f = ({
|
|
6
6
|
field: a,
|
|
7
7
|
form: r,
|
package/dist/InputMultiple.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { j as r } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Close as Z, Info as T, Error as ee } from "./Icons.es.js";
|
|
3
3
|
import { c as d } from "./cn-B6yFEsav.js";
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
const o =
|
|
4
|
+
import M, { useRef as _, useState as x, useCallback as te, useEffect as re } from "react";
|
|
5
|
+
const se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator: w = ",", variant: I = "default", placeholder: K, itemClassName: U, itemIcon: V, helperText: j, errorText: N, disabled: a, onClick: F, className: $, readonly: h, onValueDelete: B, ...O }) => {
|
|
6
|
+
const o = _(null), E = _(null), [u, n] = x(""), [z, i] = x(0), [q, c] = x(!0), [v, P] = x(!1), [m, p] = x(!1), [k, y] = x(null), g = (e) => {
|
|
7
7
|
if (h || !e) return;
|
|
8
8
|
const t = e.selectionStart ?? u.length;
|
|
9
9
|
i(t);
|
|
10
|
-
},
|
|
10
|
+
}, A = (e) => {
|
|
11
11
|
if (h) return;
|
|
12
12
|
if (e.target.value[e.target.value.length - 1] === w && u.length > 0) {
|
|
13
13
|
const s = u.trim();
|
|
@@ -25,17 +25,17 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
25
25
|
n(e.target.value), c(!1);
|
|
26
26
|
}
|
|
27
27
|
g(e.target);
|
|
28
|
-
}, b =
|
|
28
|
+
}, b = te(() => {
|
|
29
29
|
const e = u.trim();
|
|
30
30
|
if (e.length === 0) {
|
|
31
|
-
p(!1), n(""), c(!0), i(0),
|
|
31
|
+
p(!1), n(""), c(!0), i(0), y(null);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
p(!1), k !== null && f(
|
|
35
|
-
}, [k, u, f, l]),
|
|
34
|
+
p(!1), k !== null && f(Q(l.map((t, s) => s === k ? e : t))), n(""), c(!0), i(0), y(null);
|
|
35
|
+
}, [k, u, f, l]), G = (e) => {
|
|
36
36
|
if (!h) {
|
|
37
37
|
if (e.key === "Backspace" && u.length === 0) {
|
|
38
|
-
if (
|
|
38
|
+
if (q) {
|
|
39
39
|
const t = l[l.length - 1];
|
|
40
40
|
t && (f(l.filter((s) => s !== t)), n(t), i(t.length));
|
|
41
41
|
} else
|
|
@@ -50,27 +50,27 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
50
50
|
}
|
|
51
51
|
t.length > 0 && !l.includes(t) && t !== w && (f([...l, t]), n(""), c(!0), i(0));
|
|
52
52
|
}
|
|
53
|
-
e.key === "Escape" && m && (p(!1), n(""), c(!0), i(0),
|
|
53
|
+
e.key === "Escape" && m && (p(!1), n(""), c(!0), i(0), y(null)), g(e.currentTarget);
|
|
54
54
|
}
|
|
55
|
-
},
|
|
55
|
+
}, H = (e) => {
|
|
56
56
|
const t = l.filter((s) => s !== e);
|
|
57
|
-
f(t),
|
|
57
|
+
f(t), B?.(e);
|
|
58
|
+
}, J = (e) => {
|
|
59
|
+
h || (L(e), p(!0), n(e), i(e.length), y(l.length - 1), o.current?.focus());
|
|
58
60
|
}, L = (e) => {
|
|
59
|
-
h || (Q(e), p(!0), n(e), i(e.length), I(l.length - 1), o.current?.focus());
|
|
60
|
-
}, Q = (e) => {
|
|
61
61
|
const t = l.filter((s) => s !== e);
|
|
62
62
|
f([...t, e]);
|
|
63
|
-
},
|
|
64
|
-
|
|
63
|
+
}, Q = (e) => e.filter((t, s, Y) => Y.indexOf(t) === s);
|
|
64
|
+
re(() => {
|
|
65
65
|
o.current && (o.current.onfocus = () => {
|
|
66
|
-
|
|
66
|
+
P(!0);
|
|
67
67
|
}, o.current.onblur = () => {
|
|
68
|
-
|
|
68
|
+
P(!1), m && b();
|
|
69
69
|
}), E.current && (E.current.onblur = () => {
|
|
70
70
|
m && b();
|
|
71
71
|
});
|
|
72
72
|
}, [m, b]);
|
|
73
|
-
const
|
|
73
|
+
const W = {
|
|
74
74
|
isFocused: {
|
|
75
75
|
error: "border-error-default-focused ring-error-default-focused",
|
|
76
76
|
success: "border-success-default-focused ring-success-default-focused",
|
|
@@ -89,7 +89,7 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
89
89
|
warning: "border-warning-default-disabled",
|
|
90
90
|
default: "border-neutral-default-disabled"
|
|
91
91
|
}
|
|
92
|
-
},
|
|
92
|
+
}, X = {
|
|
93
93
|
default: {
|
|
94
94
|
default: "text-neutral-default-default",
|
|
95
95
|
isFocused: "text-neutral-default-focused",
|
|
@@ -110,27 +110,27 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
110
110
|
isFocused: "text-warning-default-focused",
|
|
111
111
|
disabled: "text-warning-default-disabled"
|
|
112
112
|
}
|
|
113
|
-
},
|
|
113
|
+
}, R = a ? "disabled" : v ? "isFocused" : "default";
|
|
114
114
|
return /* @__PURE__ */ r.jsxs("div", { className: d(
|
|
115
115
|
"relative w-full",
|
|
116
|
-
|
|
116
|
+
$
|
|
117
117
|
), children: [
|
|
118
118
|
/* @__PURE__ */ r.jsx("p", { className: d(
|
|
119
119
|
"mb-1 px-3",
|
|
120
120
|
"prometeo-fonts-label-large",
|
|
121
|
-
|
|
122
|
-
), children:
|
|
121
|
+
X?.[I || "default"]?.[R]
|
|
122
|
+
), children: S }),
|
|
123
123
|
/* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
|
|
124
124
|
/* @__PURE__ */ r.jsx(
|
|
125
125
|
"input",
|
|
126
126
|
{
|
|
127
127
|
ref: o,
|
|
128
128
|
value: u,
|
|
129
|
-
onKeyUp:
|
|
130
|
-
onChange:
|
|
129
|
+
onKeyUp: G,
|
|
130
|
+
onChange: A,
|
|
131
131
|
onClick: (e) => g(e.currentTarget),
|
|
132
132
|
onSelect: (e) => g(e.currentTarget),
|
|
133
|
-
name:
|
|
133
|
+
name: D,
|
|
134
134
|
disabled: a,
|
|
135
135
|
className: d(
|
|
136
136
|
"absolute inset-0 w-full h-full",
|
|
@@ -143,7 +143,7 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
143
143
|
autoCapitalize: "off",
|
|
144
144
|
spellCheck: "false",
|
|
145
145
|
inputMode: "text",
|
|
146
|
-
...
|
|
146
|
+
...O
|
|
147
147
|
}
|
|
148
148
|
),
|
|
149
149
|
/* @__PURE__ */ r.jsxs(
|
|
@@ -151,42 +151,42 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
151
151
|
{
|
|
152
152
|
ref: E,
|
|
153
153
|
className: d(
|
|
154
|
-
"border
|
|
154
|
+
"border border-neutral-default-default rounded-md p-3",
|
|
155
155
|
"flex flex-wrap gap-1 min-h-[58px]",
|
|
156
156
|
"transition-all duration-300 ease-in-out",
|
|
157
157
|
"cursor-text",
|
|
158
|
-
|
|
158
|
+
W[R][I],
|
|
159
159
|
v ? "ring-[1px]" : "",
|
|
160
160
|
// 'hover:border-primary-default-hover',
|
|
161
161
|
a && "hover:border-neutral-default-disabled"
|
|
162
162
|
),
|
|
163
163
|
onMouseDown: (e) => {
|
|
164
|
-
e.stopPropagation(),
|
|
164
|
+
e.stopPropagation(), F?.(e), o.current?.focus();
|
|
165
165
|
const t = u.length;
|
|
166
166
|
o.current && (o.current.selectionStart = t, o.current.selectionEnd = t), i(t);
|
|
167
167
|
},
|
|
168
168
|
onClick: (e) => {
|
|
169
|
-
e.stopPropagation(), o.current?.focus(),
|
|
169
|
+
e.stopPropagation(), o.current?.focus(), F?.(e);
|
|
170
170
|
},
|
|
171
171
|
children: [
|
|
172
|
-
|
|
172
|
+
C && /* @__PURE__ */ r.jsx("div", { className: d(
|
|
173
173
|
"flex items-center text-neutral-default-default",
|
|
174
174
|
a && "text-neutral-default-disabled"
|
|
175
|
-
), children:
|
|
175
|
+
), children: C }),
|
|
176
176
|
l.map((e, t) => /* @__PURE__ */ r.jsxs(
|
|
177
177
|
"div",
|
|
178
178
|
{
|
|
179
179
|
className: d(
|
|
180
|
-
"h-8 max-h-8 rounded-lg bg-primary-light-default border
|
|
180
|
+
"h-8 max-h-8 rounded-lg bg-primary-light-default border border-neutral-default-default",
|
|
181
181
|
"flex items-center gap-2 px-2",
|
|
182
182
|
"prometeo-fonts-label-medium z-20",
|
|
183
183
|
t === l.length - 1 && m ? "opacity-0 hidden overflow-hidden" : "",
|
|
184
184
|
a && "border-neutral-default-disabled text-neutral-default-disabled",
|
|
185
|
-
|
|
185
|
+
U
|
|
186
186
|
),
|
|
187
187
|
children: [
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
V && /* @__PURE__ */ r.jsx("div", { className: "flex items-center", children: M.createElement(
|
|
189
|
+
V,
|
|
190
190
|
{
|
|
191
191
|
size: 16,
|
|
192
192
|
className: d(
|
|
@@ -199,7 +199,7 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
199
199
|
"span",
|
|
200
200
|
{
|
|
201
201
|
onClick: (s) => {
|
|
202
|
-
s.stopPropagation(), !a &&
|
|
202
|
+
s.stopPropagation(), !a && J(e);
|
|
203
203
|
},
|
|
204
204
|
className: d(
|
|
205
205
|
"cursor-pointer hover:text-neutral-default-hover",
|
|
@@ -212,14 +212,14 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
212
212
|
"div",
|
|
213
213
|
{
|
|
214
214
|
onClick: (s) => {
|
|
215
|
-
s.stopPropagation(), !a &&
|
|
215
|
+
s.stopPropagation(), !a && H(e);
|
|
216
216
|
},
|
|
217
217
|
className: d(
|
|
218
218
|
"cursor-pointer hover:scale-105 transition-all duration-200 ",
|
|
219
219
|
a && " cursor-default hover:scale-100 "
|
|
220
220
|
),
|
|
221
221
|
children: /* @__PURE__ */ r.jsx(
|
|
222
|
-
|
|
222
|
+
Z,
|
|
223
223
|
{
|
|
224
224
|
size: 16,
|
|
225
225
|
className: d(
|
|
@@ -235,28 +235,28 @@ const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator:
|
|
|
235
235
|
e
|
|
236
236
|
)),
|
|
237
237
|
v && !h && /* @__PURE__ */ r.jsxs("div", { className: "flex items-center min-w-[2px]", children: [
|
|
238
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap break-
|
|
239
|
-
/* @__PURE__ */ r.jsx("span", { className: "animate-[cursor-intermitent_1s_ease-in-out_infinite] bg-neutral-default-pressed w-[2px] h-5 inline-block align-middle mx-
|
|
240
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap break-
|
|
238
|
+
/* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap wrap-break-word", children: u.slice(0, z) }),
|
|
239
|
+
/* @__PURE__ */ r.jsx("span", { className: "animate-[cursor-intermitent_1s_ease-in-out_infinite] bg-neutral-default-pressed w-[2px] h-5 inline-block align-middle mx-px z-20" }),
|
|
240
|
+
/* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap wrap-break-word", children: u.slice(z) })
|
|
241
241
|
] }),
|
|
242
242
|
l.length === 0 && !v && /* @__PURE__ */ r.jsx("span", { className: d(
|
|
243
243
|
"text-neutral-medium-default self-center",
|
|
244
244
|
a && "text-neutral-default-disabled"
|
|
245
|
-
), children:
|
|
245
|
+
), children: K || `Escribe los valores separados por ${w}` })
|
|
246
246
|
]
|
|
247
247
|
}
|
|
248
248
|
)
|
|
249
249
|
] }),
|
|
250
|
-
j &&
|
|
251
|
-
/* @__PURE__ */ r.jsx(
|
|
250
|
+
j && I !== "error" && !a && (typeof j == "string" ? /* @__PURE__ */ r.jsxs("div", { className: "prometeo-fonts-body-small text-neutral-medium-default ml-3 mt-1 flex items-center gap-1", children: [
|
|
251
|
+
/* @__PURE__ */ r.jsx(T, { size: 16, className: "text-neutral-medium-default" }),
|
|
252
252
|
j
|
|
253
253
|
] }) : /* @__PURE__ */ r.jsx("div", { className: "ml-3", children: j })),
|
|
254
254
|
N && typeof N == "string" && !a ? /* @__PURE__ */ r.jsxs("div", { className: "prometeo-fonts-body-small text-error-default-default ml-3 mt-1 flex items-center gap-1", children: [
|
|
255
|
-
/* @__PURE__ */ r.jsx(
|
|
255
|
+
/* @__PURE__ */ r.jsx(ee, { size: 16, className: "text-error-default-default" }),
|
|
256
256
|
N
|
|
257
257
|
] }) : N
|
|
258
258
|
] });
|
|
259
|
-
},
|
|
259
|
+
}, de = M.memo(se);
|
|
260
260
|
export {
|
|
261
|
-
|
|
261
|
+
de as InputMultiple
|
|
262
262
|
};
|