prometeo-design-system 1.6.7 → 1.6.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 CHANGED
@@ -1,8 +1,8 @@
1
1
  import { j as t } from "./jsx-runtime-ByW6EXIE.js";
2
2
  import { c as n } from "./cn-B6yFEsav.js";
3
- import { c as S } from "./index-BOQuZ0gG.js";
4
- import { useAnimationControls as C, motion as m } from "framer-motion";
5
- const N = S(
3
+ import { c as C } from "./index-BOQuZ0gG.js";
4
+ import { useAnimationControls as N, motion as m } from "framer-motion";
5
+ const z = C(
6
6
  "flex items-center justify-center cursor-pointer focus:outline-none font-semibold rounded-md transition-colors",
7
7
  {
8
8
  variants: {
@@ -75,7 +75,7 @@ const N = S(
75
75
  }
76
76
  }
77
77
  );
78
- function B({
78
+ function R({
79
79
  label: o = "Selene",
80
80
  onClick: p,
81
81
  icon: l,
@@ -92,14 +92,15 @@ function B({
92
92
  children: u,
93
93
  Spinner: g,
94
94
  className: y,
95
- ...h
95
+ form: h,
96
+ ...w
96
97
  }) {
97
- const d = C(), w = () => {
98
+ const d = N(), j = () => {
98
99
  !a || r || e || !s || d.start({ rotate: 90 });
99
- }, j = () => {
100
+ }, H = () => {
100
101
  !a || r || e || !s || d.start({ rotate: 0 });
101
- }, H = n(
102
- N({
102
+ }, S = n(
103
+ z({
103
104
  variant: v,
104
105
  color: x,
105
106
  size: i,
@@ -111,16 +112,17 @@ function B({
111
112
  return /* @__PURE__ */ t.jsx(
112
113
  m.button,
113
114
  {
115
+ form: h,
114
116
  onClick: p,
115
- className: H,
117
+ className: S,
116
118
  whileHover: a && !r && !e ? { scale: 1.05 } : {},
117
119
  whileTap: a && !r && !e ? { scale: 0.98 } : {},
118
120
  transition: { type: "spring", stiffness: 400, damping: 17 },
119
- onHoverStart: w,
120
- onHoverEnd: j,
121
+ onHoverStart: j,
122
+ onHoverEnd: H,
121
123
  disabled: r || e,
122
124
  type: b,
123
- ...h,
125
+ ...w,
124
126
  children: e ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
125
127
  g,
126
128
  i !== "small" && /* @__PURE__ */ t.jsx("span", { children: f })
@@ -143,5 +145,5 @@ function B({
143
145
  );
144
146
  }
145
147
  export {
146
- B as default
148
+ R as default
147
149
  };
@@ -1,89 +1,97 @@
1
- import { j as t } from "./jsx-runtime-ByW6EXIE.js";
2
- import { c as n } from "./cn-B6yFEsav.js";
3
- import { useField as V, ErrorMessage as k } from "formik";
4
- import { useState as p } from "react";
5
- import { Icons as b } from "./Icons.es.js";
6
- const D = ({
1
+ import { j as e } from "./jsx-runtime-ByW6EXIE.js";
2
+ import { c as u } from "./cn-B6yFEsav.js";
3
+ import { useField as k, ErrorMessage as B } from "formik";
4
+ import { useState as w } from "react";
5
+ import { Icons as v } from "./Icons.es.js";
6
+ const U = ({
7
7
  icon: a,
8
- iconPosition: l = "left",
9
- label: g,
10
- className: y,
11
- containerClassName: v,
12
- id: i,
13
- type: f = "text",
14
- disabled: m = !1,
15
- ...e
8
+ iconPosition: s = "left",
9
+ label: c,
10
+ className: j,
11
+ containerClassName: N,
12
+ id: x,
13
+ type: p = "text",
14
+ labelVariant: r = "default",
15
+ placeholder: o,
16
+ disabled: h = !1,
17
+ ...t
16
18
  }) => {
17
- const [r, c] = V(e), [s, x] = p(!1), [u, w] = p(!1), o = c.touched && c.error, h = r.value && r.value.toString().length > 0, d = f === "password", j = d ? u ? "text" : "password" : f, N = () => s || h ? "-top-3 left-2 scale-90" : "top-1/2 -translate-y-1/2 scale-100", E = () => d ? a ? l === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : a ? l === "left" ? "pl-10" : "pr-10" : "", F = () => a && l === "left" ? "left-10" : "left-3", I = () => {
18
- w(!u);
19
+ const [l, g] = k(t), [d, y] = w(!1), [i, E] = w(!1), f = g.touched && g.error, b = l.value && l.value.toString().length > 0, m = p === "password", F = m ? i ? "text" : "password" : p, I = () => {
20
+ const n = () => a && s === "left" ? "left-9" : "left-0";
21
+ return r === "static" ? `-top-5 ${n()} scale-90 px-1` : d || b ? `-top-2 ${n()} scale-90` : `top-1/2 -translate-y-1/2 ${n()} scale-100`;
22
+ }, z = () => r === "static" ? "text-sm" : "text-sm peer-focus:text-sm peer-placeholder-shown:text-base", C = () => r === "static" ? o || c : o || "", K = () => m ? a ? s === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : a ? s === "left" ? "pl-10" : "pr-10" : "", P = () => {
23
+ E(!i);
19
24
  };
20
- return /* @__PURE__ */ t.jsxs("div", { className: n("relative w-full bg-inherit", v), children: [
21
- /* @__PURE__ */ t.jsxs("div", { className: "relative bg-inherit", children: [
22
- /* @__PURE__ */ t.jsx(
25
+ return /* @__PURE__ */ e.jsxs("div", { className: u("relative w-full bg-inherit", r === "static" && "mt-2", N), children: [
26
+ /* @__PURE__ */ e.jsxs("div", { className: "relative bg-inherit", children: [
27
+ /* @__PURE__ */ e.jsx(
23
28
  "input",
24
29
  {
25
- disabled: m,
26
- id: i || e.name,
27
- type: j,
28
- name: r.name,
29
- value: r.value || "",
30
- onChange: r.onChange,
30
+ disabled: h,
31
+ id: x || t.name,
32
+ type: F,
33
+ name: l.name,
34
+ value: l.value || "",
35
+ placeholder: C(),
36
+ onChange: l.onChange,
31
37
  onFocus: () => {
32
- x(!0), e.onFocus?.();
38
+ y(!0), t.onFocus?.();
33
39
  },
34
- onEmptied: e.onEmptied,
35
- onKeyDown: e.onKeyDown,
36
- onKeyUp: e.onKeyUp,
37
- onBlur: (K) => {
38
- x(!1), e.onBlur?.(), r.onBlur(K);
40
+ onEmptied: t.onEmptied,
41
+ onKeyDown: t.onKeyDown,
42
+ onKeyUp: t.onKeyUp,
43
+ onBlur: (n) => {
44
+ y(!1), t.onBlur?.(), l.onBlur(n);
39
45
  },
40
- className: n(
46
+ className: u(
41
47
  "w-full px-3 h-12 text-left border-1 rounded-lg transition-all duration-200 ease-in-out text-neutral-default-default",
42
48
  "bg-transparent focus:outline-none",
43
- s ? "border-primary-default-default border-2" : o ? "border-error-default-default" : "border-neutral-default-default hover:border-neutral-strong-default",
44
- E(),
45
- y
49
+ r === "default" && !o && "placeholder:text-transparent",
50
+ r === "default" && o && "placeholder:text-neutral-medium-default placeholder:opacity-50",
51
+ r === "static" && "placeholder:text-neutral-medium-default placeholder:opacity-50",
52
+ d ? "border-primary-default-default border-2 text-primary-default-default" : f ? "border-error-default-default" : "border-neutral-default-default hover:border-neutral-strong-default",
53
+ K(),
54
+ j
46
55
  )
47
56
  }
48
57
  ),
49
- /* @__PURE__ */ t.jsx(
58
+ /* @__PURE__ */ e.jsx(
50
59
  "label",
51
60
  {
52
- htmlFor: i || e.name,
53
- className: n(
54
- "absolute transition-all duration-200 ease-in-out pointer-events-none bg-inherit px-1 z-10",
55
- "text-md",
56
- N(),
57
- h || s ? "text-primary-default-default" : o ? "text-red-500" : "text-neutral-medium-default",
58
- F()
61
+ htmlFor: x || t.name,
62
+ className: u(
63
+ "absolute transition-all duration-200 font-bold text-sm ease-in-out pointer-events-none bg-inherit px-1 z-10",
64
+ z(),
65
+ I(),
66
+ b || d ? "text-primary-default-default" : f ? "text-red-500" : "text-neutral-medium-default"
59
67
  ),
60
- children: g
68
+ children: c
61
69
  }
62
70
  ),
63
- a && /* @__PURE__ */ t.jsx("div", { className: n(
71
+ a && /* @__PURE__ */ e.jsx("div", { className: u(
64
72
  "absolute top-1/2 -translate-y-1/2 text-neutral-medium-default",
65
- l === "left" ? "left-3" : "right-3"
73
+ s === "left" ? "left-3" : "right-3"
66
74
  ), children: a }),
67
- d && /* @__PURE__ */ t.jsx(
75
+ m && /* @__PURE__ */ e.jsx(
68
76
  "button",
69
77
  {
70
78
  type: "button",
71
- onClick: I,
72
- className: n(
79
+ onClick: P,
80
+ className: u(
73
81
  "absolute top-1/2 -translate-y-1/2 p-1 text-neutral-medium-default hover:text-neutral-strong-default",
74
82
  "transition-colors duration-200 focus:outline-none focus:text-primary-default-default",
75
- a && l === "right" ? "right-8" : "right-3"
83
+ a && s === "right" ? "right-8" : "right-3"
76
84
  ),
77
85
  tabIndex: -1,
78
- disabled: m,
79
- children: u ? /* @__PURE__ */ t.jsx(b.EyeVisibilityOff, { size: 24, className: "text-neutral-default-default" }) : /* @__PURE__ */ t.jsx(b.EyeVisibility, { size: 24, className: "text-neutral-default-default" })
86
+ disabled: h,
87
+ children: i ? /* @__PURE__ */ e.jsx(v.EyeVisibility, { size: 24, className: "text-neutral-default-default" }) : /* @__PURE__ */ e.jsx(v.EyeVisibilityOff, { size: 24, className: "text-neutral-default-default" })
80
88
  }
81
89
  )
82
90
  ] }),
83
- o && /* @__PURE__ */ t.jsx(
84
- k,
91
+ f && /* @__PURE__ */ e.jsx(
92
+ B,
85
93
  {
86
- name: e.name,
94
+ name: t.name,
87
95
  component: "span",
88
96
  className: "block text-error-default-default text-xs mt-1"
89
97
  }
@@ -91,5 +99,5 @@ const D = ({
91
99
  ] });
92
100
  };
93
101
  export {
94
- D as default
102
+ U as default
95
103
  };
@@ -0,0 +1,2 @@
1
+ export * from './exports/InputMultiple'
2
+ export {}
@@ -0,0 +1,254 @@
1
+ import { j as r } from "./jsx-runtime-ByW6EXIE.js";
2
+ import { Icons as E } from "./Icons.es.js";
3
+ import { c as d } from "./cn-B6yFEsav.js";
4
+ import M, { useRef as D, useState as p, useCallback as W, useEffect as X } from "react";
5
+ const Y = ({ label: R, name: S, onChange: f, value: l, icon: C, valueSeparator: b = ",", variant: y = "default", placeholder: K, itemClassName: P, itemIcon: V, helperText: w, errorText: j, disabled: a, ...U }) => {
6
+ const o = D(null), I = D(null), [u, n] = p(""), [F, i] = p(0), [$, c] = p(!0), [N, z] = p(!1), [m, x] = p(!1), [k, v] = p(null), h = (e) => {
7
+ if (!e) return;
8
+ const t = e.selectionStart ?? u.length;
9
+ i(t);
10
+ }, B = (e) => {
11
+ if (e.target.value[e.target.value.length - 1] === b && u.length > 0) {
12
+ const s = u.trim();
13
+ if (m) {
14
+ s.length > 0 ? (n(s), g()) : (x(!1), n(""), c(!0), i(0));
15
+ return;
16
+ }
17
+ if (s.length === 0 || l.includes(s)) {
18
+ n(""), c(!0), h(e.target);
19
+ return;
20
+ }
21
+ f([...l, s]), n(""), c(!0);
22
+ } else {
23
+ if (e.target.value === b) return;
24
+ n(e.target.value), c(!1);
25
+ }
26
+ h(e.target);
27
+ }, g = W(() => {
28
+ const e = u.trim();
29
+ if (e.length === 0) {
30
+ x(!1), n(""), c(!0), i(0), v(null);
31
+ return;
32
+ }
33
+ x(!1), k !== null && f(H(l.map((t, s) => s === k ? e : t))), n(""), c(!0), i(0), v(null);
34
+ }, [k, u, f, l]), O = (e) => {
35
+ if (e.key === "Backspace" && u.length === 0) {
36
+ if ($) {
37
+ const t = l[l.length - 1];
38
+ t && (f(l.filter((s) => s !== t)), n(t), i(t.length));
39
+ } else
40
+ c(!0);
41
+ return;
42
+ }
43
+ if (e.key === "Enter") {
44
+ const t = u.trim();
45
+ if (m) {
46
+ t.length > 0 ? (n(t), g()) : (x(!1), n(""), c(!0), i(0));
47
+ return;
48
+ }
49
+ t.length > 0 && !l.includes(t) && t !== b && (f([...l, t]), n(""), c(!0), i(0));
50
+ }
51
+ e.key === "Escape" && m && (x(!1), n(""), c(!0), i(0), v(null)), h(e.currentTarget);
52
+ }, q = (e) => {
53
+ const t = l.filter((s) => s !== e);
54
+ f(t);
55
+ }, A = (e) => {
56
+ G(e), x(!0), n(e), i(e.length), v(l.length - 1), o.current?.focus();
57
+ }, G = (e) => {
58
+ const t = l.filter((s) => s !== e);
59
+ f([...t, e]);
60
+ }, H = (e) => e.filter((t, s, Q) => Q.indexOf(t) === s);
61
+ X(() => {
62
+ o.current && (o.current.onfocus = () => {
63
+ z(!0);
64
+ }, o.current.onblur = () => {
65
+ z(!1), m && g();
66
+ }), I.current && (I.current.onblur = () => {
67
+ m && g();
68
+ });
69
+ }, [m, g]);
70
+ const J = {
71
+ isFocused: {
72
+ error: "border-error-default-focused ring-error-default-focused",
73
+ success: "border-success-default-focused ring-success-default-focused",
74
+ warning: "border-warning-default-focused ring-warning-default-focused",
75
+ default: "border-primary-default-focused ring-primary-default-focused"
76
+ },
77
+ default: {
78
+ error: "border-error-default-default hover:border-error-default-hover",
79
+ success: "border-success-default-default hover:border-success-default-hover",
80
+ warning: "border-warning-default-default hover:border-warning-default-hover",
81
+ default: "border-neutral-default-default hover:border-primary-default-hover"
82
+ },
83
+ disabled: {
84
+ error: "border-error-default-disabled",
85
+ success: "border-success-default-disabled",
86
+ warning: "border-warning-default-disabled",
87
+ default: "border-neutral-default-disabled"
88
+ }
89
+ }, L = {
90
+ default: {
91
+ default: "text-neutral-default-default",
92
+ isFocused: "text-neutral-default-focused",
93
+ disabled: "text-neutral-default-disabled"
94
+ },
95
+ error: {
96
+ default: "text-error-medium-default",
97
+ isFocused: "text-error-medium-focused",
98
+ disabled: "text-error-medium-disabled"
99
+ },
100
+ success: {
101
+ default: "text-success-medium-default",
102
+ isFocused: "text-success-medium-focused",
103
+ disabled: "text-success-medium-disabled"
104
+ },
105
+ warning: {
106
+ default: "text-warning-default-default",
107
+ isFocused: "text-warning-default-focused",
108
+ disabled: "text-warning-default-disabled"
109
+ }
110
+ }, _ = a ? "disabled" : N ? "isFocused" : "default";
111
+ return /* @__PURE__ */ r.jsxs("div", { className: d(
112
+ "relative w-full"
113
+ ), children: [
114
+ /* @__PURE__ */ r.jsx("p", { className: d(
115
+ "mb-1 px-3",
116
+ "prometeo-fonts-label-large",
117
+ L?.[y || "default"]?.[_]
118
+ ), children: R }),
119
+ /* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
120
+ /* @__PURE__ */ r.jsx(
121
+ "input",
122
+ {
123
+ ref: o,
124
+ value: u,
125
+ onKeyUp: O,
126
+ onChange: B,
127
+ onClick: (e) => h(e.currentTarget),
128
+ onSelect: (e) => h(e.currentTarget),
129
+ name: S,
130
+ disabled: a,
131
+ className: d(
132
+ "absolute inset-0 w-full h-full",
133
+ "opacity-0 cursor-text z-10",
134
+ "bg-transparent border-none outline-none",
135
+ "pointer-events-none"
136
+ ),
137
+ autoComplete: "off",
138
+ autoCorrect: "off",
139
+ autoCapitalize: "off",
140
+ spellCheck: "false",
141
+ inputMode: "text",
142
+ ...U
143
+ }
144
+ ),
145
+ /* @__PURE__ */ r.jsxs(
146
+ "div",
147
+ {
148
+ ref: I,
149
+ className: d(
150
+ "border-1 border-neutral-default-default rounded-md p-3",
151
+ "flex flex-wrap gap-1 min-h-[58px]",
152
+ "transition-all duration-300 ease-in-out",
153
+ "cursor-text",
154
+ J[_][y],
155
+ N ? "ring-[1px]" : "",
156
+ // 'hover:border-primary-default-hover',
157
+ a && "hover:border-neutral-default-disabled"
158
+ ),
159
+ onMouseDown: (e) => {
160
+ e.preventDefault(), o.current?.focus();
161
+ const t = u.length;
162
+ o.current && (o.current.selectionStart = t, o.current.selectionEnd = t), i(t);
163
+ },
164
+ onClick: () => {
165
+ o.current?.focus();
166
+ },
167
+ children: [
168
+ C && /* @__PURE__ */ r.jsx("div", { className: d(
169
+ "flex items-center text-neutral-default-default",
170
+ a && "text-neutral-default-disabled"
171
+ ), children: C }),
172
+ l.map((e, t) => /* @__PURE__ */ r.jsxs(
173
+ "div",
174
+ {
175
+ className: d(
176
+ "h-8 max-h-8 rounded-lg bg-primary-light-default border-[1px] border-neutral-default-default",
177
+ "flex items-center gap-2 px-2",
178
+ "prometeo-fonts-label-medium z-20",
179
+ t === l.length - 1 && m ? "opacity-0 hidden overflow-hidden" : "",
180
+ a && "border-neutral-default-disabled text-neutral-default-disabled",
181
+ P
182
+ ),
183
+ children: [
184
+ V && /* @__PURE__ */ r.jsx("div", { className: "flex items-center", children: M.createElement(
185
+ V,
186
+ {
187
+ size: 16,
188
+ className: d(
189
+ "text-neutral-default-default",
190
+ a && "text-neutral-default-disabled"
191
+ )
192
+ }
193
+ ) }),
194
+ /* @__PURE__ */ r.jsx(
195
+ "span",
196
+ {
197
+ onClick: () => !a && A(e),
198
+ className: d(
199
+ "cursor-pointer hover:text-neutral-default-hover",
200
+ a && "cursor-default hover:text-neutral-default-disabled"
201
+ ),
202
+ children: e
203
+ }
204
+ ),
205
+ /* @__PURE__ */ r.jsx(
206
+ "div",
207
+ {
208
+ onClick: () => !a && q(e),
209
+ className: d(
210
+ "cursor-pointer hover:scale-105 transition-all duration-200",
211
+ a && " cursor-default hover:scale-100 "
212
+ ),
213
+ children: /* @__PURE__ */ r.jsx(
214
+ E.Close,
215
+ {
216
+ size: 16,
217
+ className: d(
218
+ "text-neutral-default-default hover:text-neutral-default-hover transition-all duration-200",
219
+ a && "text-neutral-default-disabled hover:text-neutral-default-disabled"
220
+ )
221
+ }
222
+ )
223
+ }
224
+ )
225
+ ]
226
+ },
227
+ e
228
+ )),
229
+ N && /* @__PURE__ */ r.jsxs("div", { className: "flex items-center min-w-[2px]", children: [
230
+ /* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap break-words", children: u.slice(0, F) }),
231
+ /* @__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" }),
232
+ /* @__PURE__ */ r.jsx("span", { className: "text-neutral-default-default whitespace-pre-wrap break-words", children: u.slice(F) })
233
+ ] }),
234
+ l.length === 0 && !N && /* @__PURE__ */ r.jsx("span", { className: d(
235
+ "text-neutral-medium-default self-center",
236
+ a && "text-neutral-default-disabled"
237
+ ), children: K || `Escribe los valores separados por ${b}` })
238
+ ]
239
+ }
240
+ )
241
+ ] }),
242
+ w && y !== "error" && !a && (typeof w == "string" ? /* @__PURE__ */ r.jsxs("div", { className: "prometeo-fonts-body-small text-neutral-medium-default ml-3 mt-1 flex items-center gap-1", children: [
243
+ /* @__PURE__ */ r.jsx(E.Info, { size: 16, className: "text-neutral-medium-default" }),
244
+ w
245
+ ] }) : /* @__PURE__ */ r.jsx("div", { className: "ml-3", children: w })),
246
+ j && typeof j == "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: [
247
+ /* @__PURE__ */ r.jsx(E.Error, { size: 16, className: "text-error-default-default" }),
248
+ j
249
+ ] }) : j
250
+ ] });
251
+ }, re = M.memo(Y);
252
+ export {
253
+ re as InputMultiple
254
+ };
@@ -0,0 +1,2 @@
1
+ export * from './exports/ProfilePictureUpload'
2
+ export {}