prometeo-design-system 2.7.1 → 2.7.3

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.
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-DKDX3adD.js";
2
2
  import ee, { memo as D, forwardRef as L, useRef as v, useEffect as te, useCallback as i, useState as R, useImperativeHandle as ne } from "react";
3
3
  import { c as X } from "./cn-B6yFEsav.js";
4
4
  import { u as re } from "./useDragScroll-CHN9OMwn.js";
5
- import { B as S } from "./Button-CvBWH1HX.js";
5
+ import S from "./Button.es.js";
6
6
  import { Icons as M } from "./Icons.es.js";
7
7
  const O = D(L(({ images: n, className: c }, r) => {
8
8
  const { ref: d, bind: a } = re({
@@ -37,7 +37,7 @@ const O = D(L(({ images: n, className: c }, r) => {
37
37
  );
38
38
  }));
39
39
  O.displayName = "GalleryPreview";
40
- const B = D(({ images: n, lightboxClassName: c, closeLightbox: r, showThumbnails: d, thumbnailsClassName: a, currentIndex: l, goToNext: o, goToPrevious: s, goToIndex: N }) => {
40
+ const _ = D(({ images: n, lightboxClassName: c, closeLightbox: r, showThumbnails: d, thumbnailsClassName: a, currentIndex: l, goToNext: o, goToPrevious: s, goToIndex: N }) => {
41
41
  const h = v(null), y = v(null), w = v(null), m = v({
42
42
  scale: 1,
43
43
  translateX: 0,
@@ -194,7 +194,7 @@ const B = D(({ images: n, lightboxClassName: c, closeLightbox: r, showThumbnails
194
194
  )
195
195
  }
196
196
  ),
197
- d && /* @__PURE__ */ t.jsx("div", { className: " w-full absolute items-center flex justify-center left-0 right-0 z-[100] bottom-0", children: /* @__PURE__ */ t.jsx(_, { images: n, currentIndex: l, goToIndex: N, thumbnailsClassName: a }) }),
197
+ d && /* @__PURE__ */ t.jsx("div", { className: " w-full absolute items-center flex justify-center left-0 right-0 z-[100] bottom-0", children: /* @__PURE__ */ t.jsx(B, { images: n, currentIndex: l, goToIndex: N, thumbnailsClassName: a }) }),
198
198
  n.length > 1 && /* @__PURE__ */ t.jsxs("div", { className: "absolute bottom-20 left-1/2 transform -translate-x-1/2 text-neutral-default-default prometeo-fonts-label-xlarge px-4 py-2 rounded-full", children: [
199
199
  l + 1,
200
200
  " / ",
@@ -204,13 +204,13 @@ const B = D(({ images: n, lightboxClassName: c, closeLightbox: r, showThumbnails
204
204
  }
205
205
  );
206
206
  });
207
- B.displayName = "LightBox";
207
+ _.displayName = "LightBox";
208
208
  const se = (n, c) => {
209
209
  if (n.currentIndex !== c.currentIndex || n.thumbnailsClassName !== c.thumbnailsClassName || n.images.length !== c.images.length) return !1;
210
210
  for (let r = 0; r < n.images.length; r++)
211
211
  if (n.images[r].src !== c.images[r].src) return !1;
212
212
  return !0;
213
- }, _ = D(({ images: n, currentIndex: c, goToIndex: r, thumbnailsClassName: d }) => /* @__PURE__ */ t.jsxs(
213
+ }, B = D(({ images: n, currentIndex: c, goToIndex: r, thumbnailsClassName: d }) => /* @__PURE__ */ t.jsxs(
214
214
  "div",
215
215
  {
216
216
  className: "flex gap-4 w-max overflow-x-auto overflow-y-visible max-w-full px-16 py-4",
@@ -251,7 +251,7 @@ const se = (n, c) => {
251
251
  ]
252
252
  }
253
253
  ), se);
254
- _.displayName = "Thumbnails";
254
+ B.displayName = "Thumbnails";
255
255
  const ae = L(
256
256
  (n, c) => {
257
257
  const {
@@ -295,7 +295,7 @@ const ae = L(
295
295
  }
296
296
  ),
297
297
  h && /* @__PURE__ */ t.jsx(
298
- B,
298
+ _,
299
299
  {
300
300
  images: s,
301
301
  closeLightbox: j,
@@ -1,4 +1,4 @@
1
- import { I as p } from "./ImageGallery-DKzJg3un.js";
1
+ import { I as p } from "./ImageGallery-D8nIvBpV.js";
2
2
  import { useRef as u, useCallback as r } from "react";
3
3
  const g = () => {
4
4
  const e = u(null), t = r((a) => {
@@ -1,26 +1,26 @@
1
1
  import { j as r } from "./jsx-runtime-DKDX3adD.js";
2
- import { Icons as E } from "./Icons.es.js";
2
+ import { Icons as z } from "./Icons.es.js";
3
3
  import { c as t } from "./cn-B6yFEsav.js";
4
- import { useRef as H, useLayoutEffect as oe, memo as le, forwardRef as se, useState as ne, useEffect as ae } from "react";
5
- import ue from "./Spinner.es.js";
6
- import { H as ce } from "./HelperComponent-U6mPwuDH.js";
7
- import fe from "./ButtonV2.es.js";
8
- const de = (o) => {
4
+ import { useRef as q, useLayoutEffect as F, memo as V, 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
- const a = window.getComputedStyle(e).backgroundColor;
12
- if (a && a !== "transparent" && a !== "rgba(0, 0, 0, 0)")
13
- return a;
11
+ const n = window.getComputedStyle(e).backgroundColor;
12
+ if (n && n !== "transparent" && n !== "rgba(0, 0, 0, 0)")
13
+ return n;
14
14
  e = e.parentElement;
15
15
  }
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 pe() {
20
- const o = H(null);
21
- return oe(() => {
19
+ function ae() {
20
+ const o = q(null);
21
+ return F(() => {
22
22
  if (!o.current || !o.current.parentElement) return;
23
- const e = de(o.current.parentElement);
23
+ const e = se(o.current.parentElement);
24
24
  o.current.style.backgroundColor = e;
25
25
  }, []), {
26
26
  ref: o
@@ -60,47 +60,46 @@ 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
- }, k = se(
63
+ }, I = ee(
64
64
  ({
65
65
  label: o,
66
66
  icon: e,
67
67
  iconPosition: l = "left",
68
- onChange: I,
69
- value: a = "",
68
+ onChange: C,
69
+ value: n = "",
70
70
  name: g,
71
71
  width: m = "100%",
72
72
  height: u,
73
73
  variant: c = "default",
74
- labelVariant: n = "default",
75
- size: B = "medium",
74
+ labelVariant: a = "default",
75
+ size: S = "medium",
76
76
  disabled: x = !1,
77
77
  type: s = "text",
78
78
  isFetching: f,
79
79
  errorComponent: h,
80
80
  helperComponent: w,
81
- placeholder: $,
82
- required: R = !1,
83
- onFocus: L,
84
- onBlur: P,
85
- onKeyDown: D,
86
- onKeyUp: M,
87
- className: O,
88
- isActive: y,
89
- style: T,
90
- readOnly: G = !1,
91
- onClear: S,
92
- ...J
93
- }, K) => {
94
- const [j, Q] = ne(!1), { ref: U } = pe(), W = H(null), z = K || null || W;
95
- let d = B;
96
- u && (d = "customHeight");
97
- const p = {
81
+ placeholder: H,
82
+ required: N = !1,
83
+ onFocus: $,
84
+ onBlur: k,
85
+ onKeyDown: B,
86
+ onKeyUp: L,
87
+ className: R,
88
+ style: P,
89
+ readOnly: D = !1,
90
+ onClear: v,
91
+ ...A
92
+ }, M) => {
93
+ const [y, O] = te(!1), { ref: T } = ae();
94
+ let p = S;
95
+ u && (p = "customHeight");
96
+ const d = {
98
97
  small: {
99
98
  container: "text-sm",
100
99
  input: "h-10 px-3 text-[1rem] prometeo-fonts-body-large",
101
100
  label: ` prometeo-fonts-label-large
102
101
  peer-focus:prometeo-fonts-label-large
103
- peer-placeholder-shown:${n === "default" ? "prometeo-fonts-body-large" : "prometeo-fonts-label-large"} peer-placeholder-shown:text-neutral-medium-default peer-focus:text-neutral-medium-default `,
102
+ peer-placeholder-shown:${a === "default" ? "prometeo-fonts-body-large" : "prometeo-fonts-label-large"} peer-placeholder-shown:text-neutral-medium-default peer-focus:text-neutral-medium-default `,
104
103
  icon: "w-4 h-4 right-3"
105
104
  },
106
105
  medium: {
@@ -108,7 +107,7 @@ const b = {
108
107
  input: "h-12 px-3 prometeo-fonts-body-large",
109
108
  label: ` prometeo-fonts-label-large
110
109
  peer-focus:prometeo-fonts-label-large
111
- peer-placeholder-shown:${n === "default" ? "prometeo-fonts-body-large" : "prometeo-fonts-label-large"} peer-placeholder-shown:text-neutral-medium-default text-neutral-medium-default peer-focus:text-neutral-medium-default `,
110
+ peer-placeholder-shown:${a === "default" ? "prometeo-fonts-body-large" : "prometeo-fonts-label-large"} peer-placeholder-shown:text-neutral-medium-default text-neutral-medium-default peer-focus:text-neutral-medium-default `,
112
111
  icon: "w-5 h-5 right-3"
113
112
  },
114
113
  large: {
@@ -123,77 +122,69 @@ const b = {
123
122
  label: "text-sm peer-focus:text-sm peer-placeholder-shown:text-xs ",
124
123
  icon: "w-6 h-6 right-3"
125
124
  }
126
- };
127
- ae(() => {
128
- y && z.current?.focus();
129
- }, [y, z.current?.focus]);
130
- const X = (i) => {
131
- L?.(i);
132
- }, Y = (i) => {
133
- y === void 0 && P?.(i);
134
- }, Z = () => {
135
- Q(!j);
136
- }, C = {};
137
- m && m !== "100%" && (C.width = m), u && (C.height = u);
138
- const v = c === "error" && h, _ = !v && w, q = s === "password", A = () => n === "static" ? "-top-1 -translate-y-full left-0 pl-3" : e ? `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"}` : "peer-placeholder-shown:top-1/2 -translate-y-1/2 peer-focus:top-0 peer-focus:left-3 peer-focus:px-1", F = () => u ? p.customHeight.label : p[d].label, V = () => u ? { height: u } : {}, ee = () => n === "default" ? o : $ || o || "", te = () => q ? e ? l === "left" ? "pl-10 pr-10" : "pr-16" : "pr-10" : e ? l === "left" ? "pl-10 pr-3" : "pr-10 pl-3" : "", re = n === "default" && "transition-all duration-200 ease-in-out", N = h || w;
125
+ }, G = () => {
126
+ O(!y);
127
+ }, j = {};
128
+ m && m !== "100%" && (j.width = m), u && (j.height = u);
129
+ const E = c === "error" && h, J = !E && 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 : H || 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;
139
130
  return /* @__PURE__ */ r.jsxs(
140
131
  "div",
141
132
  {
142
133
  className: t(
143
134
  "relative",
144
- p[d].container,
135
+ d[p].container,
145
136
  !m && "w-full",
146
137
  "bg-inherit",
147
- n === "static" && "mt-2",
148
- O
138
+ a === "static" && "mt-2",
139
+ R
149
140
  ),
150
- style: { ...T, ...C },
141
+ style: { ...P, ...j },
151
142
  children: [
152
143
  /* @__PURE__ */ r.jsx(
153
144
  "input",
154
145
  {
155
146
  id: g,
156
147
  name: g,
157
- ref: z,
158
- value: a,
159
- placeholder: ee(),
160
- type: s === "password" && j ? "text" : s,
148
+ ref: M,
149
+ value: n,
150
+ placeholder: X(),
151
+ type: s === "password" && y ? "text" : s,
161
152
  className: t(
162
153
  "peer w-full border rounded-lg bg-transparent appearance-none transition-all duration-200 ease-in-out",
163
154
  "focus:outline-none px-3",
164
- n === "default" && "placeholder:text-transparent",
165
- n === "static" && "placeholder:text-neutral-medium-default ",
155
+ a === "default" && "placeholder:text-transparent",
156
+ a === "static" && "placeholder:text-neutral-medium-default ",
166
157
  b[c].input,
167
- p[d].input,
158
+ d[p].input,
168
159
  e && "pr-10",
169
160
  x && "bg-transparent opacity-60 border-neutral-strong-default text-neutral-medium-disabled",
170
161
  b[c].container,
171
- te()
162
+ Y()
172
163
  ),
173
- style: V(),
174
- onChange: I,
175
- onFocus: X,
176
- onBlur: Y,
164
+ style: W(),
165
+ onChange: C,
166
+ onFocus: $,
167
+ onBlur: k,
177
168
  disabled: x,
178
- required: R,
179
- onKeyDown: D,
180
- onKeyUp: M,
181
- readOnly: G,
182
- ...J
169
+ required: N,
170
+ onKeyDown: B,
171
+ onKeyUp: L,
172
+ readOnly: D,
173
+ ...A
183
174
  }
184
175
  ),
185
176
  /* @__PURE__ */ r.jsx(
186
177
  "label",
187
178
  {
188
- ref: U,
179
+ ref: T,
189
180
  htmlFor: g,
190
181
  className: t(
191
182
  "absolute left-3 pointer-events-none px-1 z-10",
192
- re,
193
- F(),
183
+ Z,
184
+ U(),
194
185
  b[c].label,
195
- A(),
196
- R && "after:content-['*'] after:text-error-default after:ml-1",
186
+ Q(),
187
+ N && "after:content-['*'] after:text-error-default after:ml-1",
197
188
  x && "text-neutral-medium-disabled prometeo-fonts-label-large"
198
189
  ),
199
190
  children: o
@@ -205,51 +196,58 @@ const b = {
205
196
  tabIndex: -1,
206
197
  type: "button",
207
198
  className: t(
208
- `absolute ${N ? "top-[calc(50%-12px)]" : "top-1/2"} -translate-y-1/2 flex items-center justify-center z-10`,
209
- p[d].icon,
199
+ `absolute ${i ? "top-[calc(50%-12px)]" : "top-1/2"} -translate-y-1/2 flex items-center justify-center z-10`,
200
+ d[p].icon,
210
201
  b[c].icon,
211
202
  s === "password" && !f ? "cursor-pointer" : "pointer-events-none",
212
203
  l === "right" ? "right-3" : "left-3"
213
204
  ),
214
- onClick: s === "password" && !f ? Z : void 0,
215
- onMouseDown: (i) => s === "password" && !f && i.preventDefault(),
205
+ onClick: s === "password" && !f ? G : void 0,
206
+ onMouseDown: (_) => s === "password" && !f && _.preventDefault(),
216
207
  children: /* @__PURE__ */ r.jsxs("div", { children: [
217
- f && s !== "password" && /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(ue, { size: 24, color: "#7c86ff", loading: !0, variant: "clip" }) }),
218
- s === "password" && (j ? /* @__PURE__ */ r.jsx(E.EyeVisibility, { size: 24, className: "" }) : /* @__PURE__ */ r.jsx(E.EyeVisibilityOff, { size: 24, className: "" })),
208
+ f && s !== "password" && /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(re, { size: 24, color: "#7c86ff", loading: !0, variant: "clip" }) }),
209
+ s === "password" && (y ? /* @__PURE__ */ r.jsx(z.EyeVisibility, { size: 24, className: "" }) : /* @__PURE__ */ r.jsx(z.EyeVisibilityOff, { size: 24, className: "" })),
219
210
  e
220
211
  ] })
221
212
  }
222
213
  ),
223
- S && /* @__PURE__ */ r.jsx(
224
- fe,
214
+ v && /* @__PURE__ */ r.jsx(
215
+ le,
225
216
  {
226
217
  type: "button",
227
218
  color: "secondary",
228
219
  size: "small",
229
220
  animate: !1,
230
221
  className: t(
231
- `absolute ${N ? "top-[calc(50%-12px)]" : "top-1/2"} -translate-y-1/2 flex items-center justify-center z-10 right-1`,
222
+ `absolute! ${i ? "top-[calc(50%-12px)]" : "top-1/2"} -translate-y-1/2 flex items-center justify-center z-10 right-1`,
232
223
  "size-6 p-4 ",
233
224
  "bg-inherit",
234
225
  "hover:bg-transparent! p-4 rounded-full"
235
226
  ),
236
227
  label: "",
237
228
  disabled: x,
238
- onClick: S,
229
+ onClick: v,
239
230
  variant: "text",
240
231
  animateIcon: !1,
241
- icon: /* @__PURE__ */ r.jsx(E.Close, { size: 20, className: "" })
232
+ icon: /* @__PURE__ */ r.jsx(z.Close, { size: 20, className: "" })
242
233
  }
243
234
  ),
244
- N && /* @__PURE__ */ r.jsx("div", { className: "min-h-6", children: (v || _) && /* @__PURE__ */ r.jsx(ce, { className: "absolute ", variant: c, children: h || w }) })
235
+ i && /* @__PURE__ */ r.jsx("div", { className: "min-h-6", children: (E || J) && /* @__PURE__ */ r.jsx(
236
+ oe,
237
+ {
238
+ className: "absolute ",
239
+ variant: c,
240
+ children: h || w
241
+ }
242
+ ) })
245
243
  ]
246
244
  }
247
245
  );
248
246
  }
249
247
  );
250
- k.displayName = "Input";
251
- const je = le(k);
248
+ I.displayName = "Input";
249
+ const me = V(I);
252
250
  export {
253
- je as I,
254
- pe as u
251
+ me as I,
252
+ ae as u
255
253
  };
package/dist/Input.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { I as f } from "./Input-C22kKz7U.js";
1
+ import { I as f } from "./Input-CnXDg2s7.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,29 +1,41 @@
1
- import { j as o } from "./jsx-runtime-DKDX3adD.js";
2
- import { FastField as u } from "formik";
1
+ import { j as i } from "./jsx-runtime-DKDX3adD.js";
2
+ import { FastField as m, getIn as n } from "formik";
3
3
  import { memo as s } from "react";
4
- import { I as i } from "./Input-C22kKz7U.js";
5
- const c = ({
6
- field: r,
7
- form: t,
4
+ import { I as d } from "./Input-CnXDg2s7.js";
5
+ const f = ({
6
+ field: a,
7
+ form: r,
8
8
  ...e
9
9
  }) => {
10
- const n = t.getFieldMeta(r.name), a = n.touched && n.error;
11
- return /* @__PURE__ */ o.jsx(
12
- i,
10
+ const t = r.getFieldMeta(a.name), o = t.touched && t.error;
11
+ return /* @__PURE__ */ i.jsx(
12
+ d,
13
13
  {
14
14
  ...e,
15
- ...r,
16
- value: r.value,
17
- onChange: (m) => {
18
- r.onChange({ target: { value: m, name: r.name } });
15
+ ...a,
16
+ value: a.value,
17
+ onChange: (u) => {
18
+ a.onChange({ target: { value: u.target.value, name: a.name } });
19
19
  },
20
- variant: a ? "error" : "default",
21
- errorComponent: n.error,
20
+ variant: o ? "error" : "default",
21
+ errorComponent: t.error,
22
22
  type: e.type,
23
- ref: e.innerRef
23
+ ref: e.innerRef,
24
+ disabled: e.disabled
24
25
  }
25
26
  );
26
- }, p = s(c), j = (r) => /* @__PURE__ */ o.jsx(u, { name: r.name, children: ({ field: t, form: e }) => /* @__PURE__ */ o.jsx(p, { ...r, field: t, form: e }) });
27
+ }, l = s(f), h = (a) => /* @__PURE__ */ i.jsx(
28
+ m,
29
+ {
30
+ name: a.name,
31
+ disabled: a.disabled,
32
+ shouldUpdate: (r, e) => {
33
+ const t = r.name;
34
+ return r.disabled !== e.disabled || t !== e.name || n(r.formik.values, t) !== n(e.formik.values, t) || n(r.formik.errors, t) !== n(e.formik.errors, t) || n(r.formik.touched, t) !== n(e.formik.touched, t) || r.formik.isSubmitting !== e.formik.isSubmitting || Object.keys(r).length !== Object.keys(e).length;
35
+ },
36
+ children: ({ field: r, form: e }) => /* @__PURE__ */ i.jsx(l, { ...a, field: r, form: e, disabled: a.disabled })
37
+ }
38
+ );
27
39
  export {
28
- j as default
40
+ h as default
29
41
  };