prometeo-design-system 2.7.8 → 2.7.9
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-WHoeSibd.js → CardProfile-DV3gwvqE.js} +24 -24
- package/dist/CardProfile.es.js +1 -1
- package/dist/CheckBox.es.js +60 -60
- 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-U6mPwuDH.js +24 -0
- package/dist/Icons/Icons.d.ts +1 -61
- package/dist/Icons.es.js +8 -68
- package/dist/{ImageGallery-WKzUevOQ.js → ImageGallery-D8nIvBpV.js} +43 -43
- package/dist/ImageGallery.es.js +1 -1
- package/dist/{Input-D6as6xD-.js → Input-60IT1aGF.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-sdfP2TL0.js → Select-C4UvSsof.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/CheckBox/CheckBox.d.ts +5 -4
- 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 +125 -126
- package/package.json +1 -1
- package/dist/HelperComponent-BeNlTMqI.js +0 -24
- package/dist/components/Spinner/SpinnerV2.d.ts +0 -12
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as r } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
+
import { Icons as z } from "./Icons.es.js";
|
|
2
3
|
import { c as t } from "./cn-B6yFEsav.js";
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import { H as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const ne = (o) => {
|
|
4
|
+
import { useRef as q, useLayoutEffect as V, memo as F, forwardRef as ee, useState as te } from "react";
|
|
5
|
+
import re from "./Spinner.es.js";
|
|
6
|
+
import { H as oe } from "./HelperComponent-U6mPwuDH.js";
|
|
7
|
+
import le from "./Button.es.js";
|
|
8
|
+
const se = (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 ne = (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 ae() {
|
|
20
|
+
const o = q(null);
|
|
21
|
+
return V(() => {
|
|
22
22
|
if (!o.current || !o.current.parentElement) return;
|
|
23
|
-
const e =
|
|
23
|
+
const e = se(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 = ee(
|
|
64
64
|
({
|
|
65
65
|
label: o,
|
|
66
66
|
icon: e,
|
|
67
67
|
iconPosition: l = "left",
|
|
68
|
-
onChange:
|
|
68
|
+
onChange: C,
|
|
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: $,
|
|
82
|
+
required: N = !1,
|
|
83
|
+
onFocus: k,
|
|
84
|
+
onBlur: B,
|
|
85
|
+
onKeyDown: L,
|
|
86
|
+
onKeyUp: R,
|
|
87
|
+
className: P,
|
|
88
|
+
style: D,
|
|
89
|
+
readOnly: A = !1,
|
|
90
|
+
onClear: v,
|
|
91
|
+
...E
|
|
92
|
+
}, M) => {
|
|
93
|
+
const [y, O] = te(!1), { ref: T } = ae();
|
|
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
|
+
}, G = () => {
|
|
126
|
+
O(!y);
|
|
127
127
|
}, j = {};
|
|
128
128
|
m && m !== "100%" && (j.width = m), u && (j.height = u);
|
|
129
|
-
const
|
|
129
|
+
const I = c === "error" && h, J = !I && w, K = s === "password", Q = () => 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`, U = () => u ? d.customHeight.label : d[p].label, W = () => u ? { height: u } : {}, X = () => a === "default" ? o : $ || o || "", Y = () => K ? e ? l === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : e ? l === "left" ? "pl-10 pr-3" : "pr-10 pl-3" : "", Z = 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
|
+
P
|
|
140
140
|
),
|
|
141
|
-
style: { ...
|
|
141
|
+
style: { ...D, ...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: M,
|
|
149
149
|
value: n,
|
|
150
|
-
placeholder:
|
|
150
|
+
placeholder: X(),
|
|
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
|
+
Y()
|
|
163
163
|
),
|
|
164
|
-
style:
|
|
165
|
-
onChange:
|
|
166
|
-
onFocus:
|
|
167
|
-
onBlur:
|
|
164
|
+
style: W(),
|
|
165
|
+
onChange: C,
|
|
166
|
+
onFocus: k,
|
|
167
|
+
onBlur: B,
|
|
168
168
|
disabled: x,
|
|
169
|
-
required:
|
|
170
|
-
onKeyDown:
|
|
171
|
-
onKeyUp:
|
|
172
|
-
defaultValue:
|
|
173
|
-
readOnly:
|
|
174
|
-
...
|
|
169
|
+
required: N,
|
|
170
|
+
onKeyDown: L,
|
|
171
|
+
onKeyUp: R,
|
|
172
|
+
defaultValue: E.defaultValue,
|
|
173
|
+
readOnly: A,
|
|
174
|
+
...E
|
|
175
175
|
}
|
|
176
176
|
),
|
|
177
177
|
/* @__PURE__ */ r.jsx(
|
|
178
178
|
"label",
|
|
179
179
|
{
|
|
180
|
-
ref:
|
|
180
|
+
ref: T,
|
|
181
181
|
htmlFor: g,
|
|
182
182
|
className: t(
|
|
183
183
|
"absolute left-3 pointer-events-none px-1 z-10",
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
Z,
|
|
185
|
+
U(),
|
|
186
186
|
b[c].label,
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
Q(),
|
|
188
|
+
N && "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 ? G : void 0,
|
|
207
|
+
onMouseDown: (_) => s === "password" && !f && _.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(re, { size: 24, color: "#7c86ff", loading: !0, variant: "clip" }) }),
|
|
210
|
+
s === "password" && (y ? /* @__PURE__ */ r.jsx(z.EyeVisibility, { size: 24, className: "" }) : /* @__PURE__ */ r.jsx(z.EyeVisibilityOff, { size: 24, className: "" })),
|
|
211
211
|
e
|
|
212
212
|
] })
|
|
213
213
|
}
|
|
214
214
|
),
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
v && /* @__PURE__ */ r.jsx(
|
|
216
|
+
le,
|
|
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: v,
|
|
231
231
|
variant: "text",
|
|
232
232
|
animateIcon: !1,
|
|
233
|
-
icon: /* @__PURE__ */ r.jsx(
|
|
233
|
+
icon: /* @__PURE__ */ r.jsx(z.Close, { 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: (I || J) && /* @__PURE__ */ r.jsx(
|
|
237
|
+
oe,
|
|
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 me = F(S);
|
|
251
251
|
export {
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
me as I,
|
|
253
|
+
ae 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";
|
|
3
2
|
import { c as s } from "./cn-B6yFEsav.js";
|
|
4
|
-
import { FastField as
|
|
5
|
-
import { memo as
|
|
6
|
-
|
|
3
|
+
import { FastField as q, ErrorMessage as G } from "formik";
|
|
4
|
+
import { memo as H, useState as I, useRef as J, useCallback as y, useLayoutEffect as Q } from "react";
|
|
5
|
+
import { Icons as N } from "./Icons.es.js";
|
|
6
|
+
const W = ({
|
|
7
7
|
icon: t,
|
|
8
8
|
iconPosition: r = "left",
|
|
9
9
|
label: d,
|
|
10
10
|
className: B,
|
|
11
|
-
containerClassName:
|
|
11
|
+
containerClassName: R,
|
|
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: $,
|
|
19
|
+
form: z,
|
|
20
20
|
...a
|
|
21
21
|
}) => {
|
|
22
|
-
const [o, v] =
|
|
22
|
+
const [o, v] = I(!1), [C, K] = I(!1), i = J(null), F = z.getFieldMeta(l.name), k = F.touched && F.error, E = l.value && l.value.toString().length > 0, x = j === "password", M = x ? C ? "text" : "password" : j, P = () => n === "static" ? p || d : p || "", A = () => x ? t ? r === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : t ? r === "left" ? "pl-10" : "pr-10" : "", D = y(() => {
|
|
23
23
|
v(!0), a.onFocus?.();
|
|
24
|
-
}, [a]),
|
|
24
|
+
}, [a]), T = y(
|
|
25
25
|
(c) => {
|
|
26
26
|
v(!1), a.onBlur?.(), l.onBlur(c);
|
|
27
27
|
},
|
|
28
28
|
[l, a]
|
|
29
|
-
),
|
|
30
|
-
|
|
29
|
+
), U = y(() => {
|
|
30
|
+
K((c) => !c);
|
|
31
31
|
}, []);
|
|
32
|
-
|
|
32
|
+
Q(() => {
|
|
33
33
|
if (i.current) {
|
|
34
|
-
const
|
|
35
|
-
let u =
|
|
34
|
+
const L = ((O) => {
|
|
35
|
+
let u = O;
|
|
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 X = ({
|
|
|
44
44
|
})(
|
|
45
45
|
i.current.parentElement
|
|
46
46
|
);
|
|
47
|
-
i.current.style.backgroundColor =
|
|
47
|
+
i.current.style.backgroundColor = L;
|
|
48
48
|
}
|
|
49
49
|
}, []);
|
|
50
50
|
const g = {
|
|
@@ -78,7 +78,7 @@ const X = ({
|
|
|
78
78
|
icon: {},
|
|
79
79
|
placeholder: {}
|
|
80
80
|
}
|
|
81
|
-
},
|
|
81
|
+
}, V = {
|
|
82
82
|
none: {
|
|
83
83
|
label: "left-2 "
|
|
84
84
|
},
|
|
@@ -104,7 +104,7 @@ const X = ({
|
|
|
104
104
|
className: s(
|
|
105
105
|
"relative w-full bg-inherit",
|
|
106
106
|
n === "static" && "mt-5",
|
|
107
|
-
|
|
107
|
+
R
|
|
108
108
|
),
|
|
109
109
|
children: [
|
|
110
110
|
/* @__PURE__ */ e.jsxs("div", { className: "relative bg-inherit", children: [
|
|
@@ -113,25 +113,25 @@ const X = ({
|
|
|
113
113
|
{
|
|
114
114
|
disabled: b,
|
|
115
115
|
id: w || l.name,
|
|
116
|
-
type:
|
|
116
|
+
type: M,
|
|
117
117
|
name: l.name,
|
|
118
118
|
value: l.value || "",
|
|
119
|
-
placeholder:
|
|
119
|
+
placeholder: P(),
|
|
120
120
|
onChange: l.onChange,
|
|
121
|
-
onFocus:
|
|
121
|
+
onFocus: D,
|
|
122
122
|
onEmptied: a.onEmptied,
|
|
123
123
|
onKeyDown: a.onKeyDown,
|
|
124
124
|
onKeyUp: a.onKeyUp,
|
|
125
|
-
onBlur:
|
|
125
|
+
onBlur: T,
|
|
126
126
|
className: s(
|
|
127
|
-
"w-full px-3 h-12 text-left border rounded-lg transition-all duration-200 ease-in-out text-neutral-default-default",
|
|
127
|
+
"w-full px-3 h-12 text-left border-[1px] 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
|
+
A(),
|
|
132
132
|
B
|
|
133
133
|
),
|
|
134
|
-
ref:
|
|
134
|
+
ref: $
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
137
|
/* @__PURE__ */ e.jsx(
|
|
@@ -142,7 +142,7 @@ const X = ({
|
|
|
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
|
+
V[t ? r : "none"].label,
|
|
146
146
|
S[n].label,
|
|
147
147
|
g[h].label
|
|
148
148
|
),
|
|
@@ -164,7 +164,7 @@ const X = ({
|
|
|
164
164
|
"button",
|
|
165
165
|
{
|
|
166
166
|
type: "button",
|
|
167
|
-
onClick:
|
|
167
|
+
onClick: U,
|
|
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 X = ({
|
|
|
173
173
|
tabIndex: -1,
|
|
174
174
|
disabled: b,
|
|
175
175
|
children: C ? /* @__PURE__ */ e.jsx(
|
|
176
|
-
|
|
176
|
+
N.EyeVisibility,
|
|
177
177
|
{
|
|
178
178
|
size: 24,
|
|
179
179
|
className: "text-neutral-default-default"
|
|
180
180
|
}
|
|
181
181
|
) : /* @__PURE__ */ e.jsx(
|
|
182
|
-
|
|
182
|
+
N.EyeVisibilityOff,
|
|
183
183
|
{
|
|
184
184
|
size: 24,
|
|
185
185
|
className: "text-neutral-default-default"
|
|
@@ -189,7 +189,7 @@ const X = ({
|
|
|
189
189
|
)
|
|
190
190
|
] }),
|
|
191
191
|
k && /* @__PURE__ */ e.jsx(
|
|
192
|
-
|
|
192
|
+
G,
|
|
193
193
|
{
|
|
194
194
|
name: l.name,
|
|
195
195
|
component: "span",
|
|
@@ -199,8 +199,8 @@ const X = ({
|
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
|
-
},
|
|
203
|
-
|
|
202
|
+
}, X = H(W), ae = (t) => /* @__PURE__ */ e.jsx(q, { name: t.name, children: ({ field: r, form: d }) => /* @__PURE__ */ e.jsx(
|
|
203
|
+
X,
|
|
204
204
|
{
|
|
205
205
|
...t,
|
|
206
206
|
field: r,
|
|
@@ -209,5 +209,5 @@ const X = ({
|
|
|
209
209
|
}
|
|
210
210
|
) });
|
|
211
211
|
export {
|
|
212
|
-
|
|
212
|
+
ae 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-60IT1aGF.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 { Icons as C } from "./Icons.es.js";
|
|
3
3
|
import { c as d } from "./cn-B6yFEsav.js";
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
const o =
|
|
4
|
+
import S, { useRef as M, useState as x, useCallback as T, useEffect as ee } from "react";
|
|
5
|
+
const te = ({ label: D, name: K, onChange: f, value: l, icon: V, valueSeparator: w = ",", variant: y = "default", placeholder: U, itemClassName: $, itemIcon: F, helperText: j, errorText: N, disabled: a, onClick: z, className: B, readonly: h, onValueDelete: O, ...q }) => {
|
|
6
|
+
const o = M(null), E = M(null), [u, n] = x(""), [P, i] = x(0), [A, c] = x(!0), [v, R] = x(!1), [m, p] = x(!1), [k, I] = x(null), g = (e) => {
|
|
7
7
|
if (h || !e) return;
|
|
8
8
|
const t = e.selectionStart ?? u.length;
|
|
9
9
|
i(t);
|
|
10
|
-
},
|
|
10
|
+
}, G = (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 se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator:
|
|
|
25
25
|
n(e.target.value), c(!1);
|
|
26
26
|
}
|
|
27
27
|
g(e.target);
|
|
28
|
-
}, b =
|
|
28
|
+
}, b = T(() => {
|
|
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), I(null);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
p(!1), k !== null && f(
|
|
35
|
-
}, [k, u, f, l]),
|
|
34
|
+
p(!1), k !== null && f(W(l.map((t, s) => s === k ? e : t))), n(""), c(!0), i(0), I(null);
|
|
35
|
+
}, [k, u, f, l]), H = (e) => {
|
|
36
36
|
if (!h) {
|
|
37
37
|
if (e.key === "Backspace" && u.length === 0) {
|
|
38
|
-
if (
|
|
38
|
+
if (A) {
|
|
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 se = ({ label: S, name: D, onChange: f, value: l, icon: C, 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), I(null)), g(e.currentTarget);
|
|
54
54
|
}
|
|
55
|
-
}, H = (e) => {
|
|
56
|
-
const t = l.filter((s) => s !== e);
|
|
57
|
-
f(t), B?.(e);
|
|
58
55
|
}, J = (e) => {
|
|
59
|
-
|
|
56
|
+
const t = l.filter((s) => s !== e);
|
|
57
|
+
f(t), O?.(e);
|
|
60
58
|
}, 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
|
+
}, W = (e) => e.filter((t, s, Z) => Z.indexOf(t) === s);
|
|
64
|
+
ee(() => {
|
|
65
65
|
o.current && (o.current.onfocus = () => {
|
|
66
|
-
|
|
66
|
+
R(!0);
|
|
67
67
|
}, o.current.onblur = () => {
|
|
68
|
-
|
|
68
|
+
R(!1), m && b();
|
|
69
69
|
}), E.current && (E.current.onblur = () => {
|
|
70
70
|
m && b();
|
|
71
71
|
});
|
|
72
72
|
}, [m, b]);
|
|
73
|
-
const
|
|
73
|
+
const X = {
|
|
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 se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator:
|
|
|
89
89
|
warning: "border-warning-default-disabled",
|
|
90
90
|
default: "border-neutral-default-disabled"
|
|
91
91
|
}
|
|
92
|
-
},
|
|
92
|
+
}, Y = {
|
|
93
93
|
default: {
|
|
94
94
|
default: "text-neutral-default-default",
|
|
95
95
|
isFocused: "text-neutral-default-focused",
|
|
@@ -110,27 +110,27 @@ const se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator:
|
|
|
110
110
|
isFocused: "text-warning-default-focused",
|
|
111
111
|
disabled: "text-warning-default-disabled"
|
|
112
112
|
}
|
|
113
|
-
},
|
|
113
|
+
}, _ = a ? "disabled" : v ? "isFocused" : "default";
|
|
114
114
|
return /* @__PURE__ */ r.jsxs("div", { className: d(
|
|
115
115
|
"relative w-full",
|
|
116
|
-
|
|
116
|
+
B
|
|
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
|
+
Y?.[y || "default"]?.[_]
|
|
122
|
+
), children: D }),
|
|
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: H,
|
|
130
|
+
onChange: G,
|
|
131
131
|
onClick: (e) => g(e.currentTarget),
|
|
132
132
|
onSelect: (e) => g(e.currentTarget),
|
|
133
|
-
name:
|
|
133
|
+
name: K,
|
|
134
134
|
disabled: a,
|
|
135
135
|
className: d(
|
|
136
136
|
"absolute inset-0 w-full h-full",
|
|
@@ -143,7 +143,7 @@ const se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator:
|
|
|
143
143
|
autoCapitalize: "off",
|
|
144
144
|
spellCheck: "false",
|
|
145
145
|
inputMode: "text",
|
|
146
|
-
...
|
|
146
|
+
...q
|
|
147
147
|
}
|
|
148
148
|
),
|
|
149
149
|
/* @__PURE__ */ r.jsxs(
|
|
@@ -151,42 +151,42 @@ const se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator:
|
|
|
151
151
|
{
|
|
152
152
|
ref: E,
|
|
153
153
|
className: d(
|
|
154
|
-
"border border-neutral-default-default rounded-md p-3",
|
|
154
|
+
"border-1 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
|
+
X[_][y],
|
|
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(), z?.(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(), z?.(e);
|
|
170
170
|
},
|
|
171
171
|
children: [
|
|
172
|
-
|
|
172
|
+
V && /* @__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: V }),
|
|
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 border-neutral-default-default",
|
|
180
|
+
"h-8 max-h-8 rounded-lg bg-primary-light-default border-[1px] 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
|
+
$
|
|
186
186
|
),
|
|
187
187
|
children: [
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
F && /* @__PURE__ */ r.jsx("div", { className: "flex items-center", children: S.createElement(
|
|
189
|
+
F,
|
|
190
190
|
{
|
|
191
191
|
size: 16,
|
|
192
192
|
className: d(
|
|
@@ -199,7 +199,7 @@ const se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator:
|
|
|
199
199
|
"span",
|
|
200
200
|
{
|
|
201
201
|
onClick: (s) => {
|
|
202
|
-
s.stopPropagation(), !a &&
|
|
202
|
+
s.stopPropagation(), !a && L(e);
|
|
203
203
|
},
|
|
204
204
|
className: d(
|
|
205
205
|
"cursor-pointer hover:text-neutral-default-hover",
|
|
@@ -212,14 +212,14 @@ const se = ({ label: S, name: D, onChange: f, value: l, icon: C, valueSeparator:
|
|
|
212
212
|
"div",
|
|
213
213
|
{
|
|
214
214
|
onClick: (s) => {
|
|
215
|
-
s.stopPropagation(), !a &&
|
|
215
|
+
s.stopPropagation(), !a && J(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
|
+
C.Close,
|
|
223
223
|
{
|
|
224
224
|
size: 16,
|
|
225
225
|
className: d(
|
|
@@ -235,28 +235,28 @@ const se = ({ label: S, name: D, onChange: f, value: l, icon: C, 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
|
|
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
|
|
238
|
+
/* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap break-words", children: u.slice(0, P) }),
|
|
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-[1px] z-20" }),
|
|
240
|
+
/* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap break-words", children: u.slice(P) })
|
|
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: U || `Escribe los valores separados por ${w}` })
|
|
246
246
|
]
|
|
247
247
|
}
|
|
248
248
|
)
|
|
249
249
|
] }),
|
|
250
|
-
j &&
|
|
251
|
-
/* @__PURE__ */ r.jsx(
|
|
250
|
+
j && y !== "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(C.Info, { 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(C.Error, { size: 16, className: "text-error-default-default" }),
|
|
256
256
|
N
|
|
257
257
|
] }) : N
|
|
258
258
|
] });
|
|
259
|
-
},
|
|
259
|
+
}, ne = S.memo(te);
|
|
260
260
|
export {
|
|
261
|
-
|
|
261
|
+
ne as InputMultiple
|
|
262
262
|
};
|