prometeo-design-system 2.5.6 → 2.5.7
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/InputFormik.es.js +46 -38
- package/package.json +1 -1
package/dist/InputFormik.es.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as s } from "./cn-B6yFEsav.js";
|
|
3
3
|
import { FastField as q, ErrorMessage as G } from "formik";
|
|
4
4
|
import { memo as H, useState as I, useRef as J, useCallback as y, useLayoutEffect as Q } from "react";
|
|
5
5
|
import { Icons as N } from "./Icons.es.js";
|
|
6
6
|
const W = ({
|
|
7
|
-
icon:
|
|
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
|
-
field:
|
|
18
|
-
innerRef:
|
|
19
|
-
form:
|
|
17
|
+
field: l,
|
|
18
|
+
innerRef: $,
|
|
19
|
+
form: z,
|
|
20
20
|
...a
|
|
21
21
|
}) => {
|
|
22
|
-
const [o, v] = I(!1), [C,
|
|
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
24
|
}, [a]), T = y(
|
|
25
|
-
(
|
|
26
|
-
v(!1), a.onBlur?.(),
|
|
25
|
+
(c) => {
|
|
26
|
+
v(!1), a.onBlur?.(), l.onBlur(c);
|
|
27
27
|
},
|
|
28
|
-
[
|
|
28
|
+
[l, a]
|
|
29
29
|
), U = y(() => {
|
|
30
|
-
|
|
30
|
+
K((c) => !c);
|
|
31
31
|
}, []);
|
|
32
32
|
Q(() => {
|
|
33
|
-
if (
|
|
33
|
+
if (i.current) {
|
|
34
34
|
const L = ((O) => {
|
|
35
|
-
let
|
|
36
|
-
for (;
|
|
37
|
-
const f = window.getComputedStyle(
|
|
35
|
+
let u = O;
|
|
36
|
+
for (; u && u !== document.body; ) {
|
|
37
|
+
const f = window.getComputedStyle(u).backgroundColor;
|
|
38
38
|
if (f && f !== "transparent" && f !== "rgba(0, 0, 0, 0)")
|
|
39
39
|
return f;
|
|
40
|
-
|
|
40
|
+
u = u.parentElement;
|
|
41
41
|
}
|
|
42
42
|
const m = window.getComputedStyle(document.body).backgroundColor;
|
|
43
43
|
return m && m !== "transparent" && m !== "rgba(0, 0, 0, 0)" ? m : "rgb(255, 255, 255)";
|
|
44
44
|
})(
|
|
45
|
-
|
|
45
|
+
i.current.parentElement
|
|
46
46
|
);
|
|
47
|
-
|
|
47
|
+
i.current.style.backgroundColor = L;
|
|
48
48
|
}
|
|
49
49
|
}, []);
|
|
50
50
|
const g = {
|
|
@@ -101,10 +101,10 @@ const W = ({
|
|
|
101
101
|
return /* @__PURE__ */ e.jsxs(
|
|
102
102
|
"div",
|
|
103
103
|
{
|
|
104
|
-
className:
|
|
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: [
|
|
@@ -112,18 +112,18 @@ const W = ({
|
|
|
112
112
|
"input",
|
|
113
113
|
{
|
|
114
114
|
disabled: b,
|
|
115
|
-
id: w ||
|
|
116
|
-
type:
|
|
117
|
-
name:
|
|
118
|
-
value:
|
|
119
|
-
placeholder:
|
|
120
|
-
onChange:
|
|
115
|
+
id: w || l.name,
|
|
116
|
+
type: M,
|
|
117
|
+
name: l.name,
|
|
118
|
+
value: l.value || "",
|
|
119
|
+
placeholder: P(),
|
|
120
|
+
onChange: l.onChange,
|
|
121
121
|
onFocus: D,
|
|
122
122
|
onEmptied: a.onEmptied,
|
|
123
123
|
onKeyDown: a.onKeyDown,
|
|
124
124
|
onKeyUp: a.onKeyUp,
|
|
125
125
|
onBlur: T,
|
|
126
|
-
className:
|
|
126
|
+
className: s(
|
|
127
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,
|
|
@@ -131,33 +131,33 @@ const W = ({
|
|
|
131
131
|
A(),
|
|
132
132
|
B
|
|
133
133
|
),
|
|
134
|
-
ref:
|
|
134
|
+
ref: $
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
137
|
/* @__PURE__ */ e.jsx(
|
|
138
138
|
"label",
|
|
139
139
|
{
|
|
140
|
-
ref:
|
|
140
|
+
ref: i,
|
|
141
141
|
htmlFor: w || a.name,
|
|
142
|
-
className:
|
|
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
|
-
V[
|
|
145
|
+
V[t ? r : "none"].label,
|
|
146
146
|
S[n].label,
|
|
147
147
|
g[h].label
|
|
148
148
|
),
|
|
149
149
|
children: d
|
|
150
150
|
}
|
|
151
151
|
),
|
|
152
|
-
|
|
152
|
+
t && /* @__PURE__ */ e.jsx(
|
|
153
153
|
"div",
|
|
154
154
|
{
|
|
155
|
-
className:
|
|
155
|
+
className: s(
|
|
156
156
|
"absolute top-1/2 -translate-y-1/2 text-neutral-medium-default",
|
|
157
157
|
g[h].icon,
|
|
158
158
|
r === "left" ? "left-3" : "right-3"
|
|
159
159
|
),
|
|
160
|
-
children:
|
|
160
|
+
children: t
|
|
161
161
|
}
|
|
162
162
|
),
|
|
163
163
|
x && /* @__PURE__ */ e.jsx(
|
|
@@ -165,10 +165,10 @@ const W = ({
|
|
|
165
165
|
{
|
|
166
166
|
type: "button",
|
|
167
167
|
onClick: U,
|
|
168
|
-
className:
|
|
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",
|
|
171
|
-
|
|
171
|
+
t && r === "right" ? "right-8" : "right-3"
|
|
172
172
|
),
|
|
173
173
|
tabIndex: -1,
|
|
174
174
|
disabled: b,
|
|
@@ -191,7 +191,7 @@ const W = ({
|
|
|
191
191
|
k && /* @__PURE__ */ e.jsx(
|
|
192
192
|
G,
|
|
193
193
|
{
|
|
194
|
-
name:
|
|
194
|
+
name: l.name,
|
|
195
195
|
component: "span",
|
|
196
196
|
className: "block text-error-default-default text-xs mt-1"
|
|
197
197
|
}
|
|
@@ -199,7 +199,15 @@ const W = ({
|
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
|
-
}, X = H(W), ae = (
|
|
202
|
+
}, X = H(W), ae = (t) => /* @__PURE__ */ e.jsx(q, { name: t.name, children: ({ field: r, form: d }) => /* @__PURE__ */ e.jsx(
|
|
203
|
+
X,
|
|
204
|
+
{
|
|
205
|
+
...t,
|
|
206
|
+
field: r,
|
|
207
|
+
form: d,
|
|
208
|
+
innerRef: t.innerRef
|
|
209
|
+
}
|
|
210
|
+
) });
|
|
203
211
|
export {
|
|
204
212
|
ae as default
|
|
205
213
|
};
|