prometeo-design-system 4.3.6 → 4.4.1

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.
@@ -4,19 +4,19 @@ import { useState as A, useRef as E, useEffect as b, useMemo as ee, useCallback
4
4
  import Z from "./Select.es.js";
5
5
  function re(e) {
6
6
  const {
7
- options: C,
7
+ options: O,
8
8
  fetcher: d,
9
- asyncMode: _ = "fetch_in_open",
10
- disabled: w = !1,
11
- debounceDelay: P = 500,
9
+ asyncMode: w = "fetch_in_open",
10
+ disabled: _ = !1,
11
+ debounceDelay: M = 500,
12
12
  minCharacters: T = 3,
13
13
  optionLabel: h,
14
14
  optionValue: c,
15
15
  controlledValue: f,
16
- isOpen: F,
16
+ isOpen: P,
17
17
  inputRef: p,
18
18
  name: I
19
- } = e || {}, M = C ? C.filter((n) => n != null) : [], [V, g] = A(M || []), [D, k] = A(M || []), [s, N] = A(""), [W, v] = A(!1), [J, U] = A(!1), o = E(null), O = E(null), m = E(!1), S = E(d), L = e?.multiple === !0 || !1, j = E(L ? [] : void 0), [a, y] = A(L ? [] : void 0);
19
+ } = e || {}, F = O ? O.filter((n) => n != null) : [], [V, g] = A(F || []), [D, k] = A(F || []), [s, N] = A(""), [W, C] = A(!1), [J, U] = A(!1), o = E(null), v = E(null), m = E(!1), S = E(d), L = e?.multiple === !0 || !1, j = E(L ? [] : void 0), [a, y] = A(L ? [] : void 0);
20
20
  b(() => {
21
21
  S.current = d;
22
22
  }, [d]), b(() => {
@@ -54,28 +54,28 @@ function re(e) {
54
54
  t && t();
55
55
  };
56
56
  }, [e?.subscribeOpenChange]);
57
- const G = F !== void 0 ? F : J;
57
+ const G = P !== void 0 ? P : J;
58
58
  b(() => {
59
- if (!w && S.current && _ === "fetch_on_type") {
59
+ if (!_ && S.current && w === "fetch_on_type") {
60
60
  if (!s || s === "" || s.length < T) {
61
- o.current && clearTimeout(o.current), v(!1);
61
+ o.current && clearTimeout(o.current), C(!1);
62
62
  return;
63
63
  }
64
- const n = B(q, P);
65
- v(!0), n.then((t) => {
64
+ const n = B(q, M);
65
+ C(!0), n.then((t) => {
66
66
  const l = z(t);
67
67
  g(l);
68
68
  }).finally(() => {
69
- v(!1), e?.onFetchingEnd?.();
69
+ C(!1), e?.onFetchingEnd?.();
70
70
  });
71
71
  }
72
- }, [_, s, w, P, B, T]), b(() => {
73
- if (!w)
72
+ }, [w, s, _, M, B, T]), b(() => {
73
+ if (!_)
74
74
  if (G) {
75
- if (e?.onOpen?.(), _ === "fetch_in_open") {
75
+ if (e?.onOpen?.(), w === "fetch_in_open") {
76
76
  if (!S.current)
77
77
  return;
78
- v(!0), q().then((n) => {
78
+ C(!0), q().then((n) => {
79
79
  const t = z(n);
80
80
  g(() => {
81
81
  const l = t.filter((r) => {
@@ -85,12 +85,12 @@ function re(e) {
85
85
  return L && a.length > 0 ? [...$(a, l), ...a] : l;
86
86
  });
87
87
  }).finally(() => {
88
- v(!1), e?.onFetchingEnd?.();
88
+ C(!1), e?.onFetchingEnd?.();
89
89
  });
90
90
  }
91
91
  } else
92
92
  e?.onClose?.();
93
- }, [G, _, w]);
93
+ }, [G, w, _]);
94
94
  const H = (n, t) => n?.filter((l) => {
95
95
  if (h)
96
96
  return i(l, h)?.toLowerCase().includes(t.toLowerCase());
@@ -129,9 +129,9 @@ function re(e) {
129
129
  }
130
130
  }) || [], Q = (n) => {
131
131
  const t = typeof p == "function" ? p() : p;
132
- n.target === t?.current && (O.current && clearTimeout(O.current), m.current || (m.current = !0, e?.onTypeStart?.()), O.current = setTimeout(() => {
132
+ n.target === t?.current && (v.current && clearTimeout(v.current), m.current || (m.current = !0, e?.onTypeStart?.()), v.current = setTimeout(() => {
133
133
  m.current = !1;
134
- }, P));
134
+ }, M));
135
135
  };
136
136
  b(() => {
137
137
  if (s === "")
@@ -173,18 +173,18 @@ function re(e) {
173
173
  };
174
174
  }
175
175
  const he = (e) => {
176
- const C = E(null), { asyncMode: d = "fetch_in_open" } = e, _ = (o, O, m) => {
176
+ const O = E(null), { asyncMode: d = "fetch_in_open" } = e, w = (o, v, m) => {
177
177
  const S = {
178
178
  options: o.options,
179
179
  fetcher: o.fetcher,
180
- asyncMode: O,
180
+ asyncMode: v,
181
181
  debounceDelay: o.debounceDelay,
182
182
  minCharacters: o.minCharacters,
183
183
  disabled: o.disabled,
184
184
  optionValue: o.optionValue,
185
185
  optionLabel: o.optionLabel,
186
186
  onFetchingStart: () => {
187
- O === "fetch_on_type" && m.current?.open();
187
+ m.current?.open();
188
188
  },
189
189
  onTypeStart: () => {
190
190
  !o?.fetcher && m.current?.open();
@@ -204,29 +204,29 @@ const he = (e) => {
204
204
  controlledValue: o.value,
205
205
  onChange: o.onChange
206
206
  };
207
- }, { inputValue: w, setInputValue: P, filteredOptions: T, isLoading: h, value: c, onOptionClick: f, cleanInputValue: F, cleanOptions: p, clearValue: I } = re(_(e, d, C));
207
+ }, { inputValue: _, setInputValue: M, filteredOptions: T, isLoading: h, value: c, onOptionClick: f, cleanInputValue: P, cleanOptions: p, clearValue: I } = re(w(e, d, O));
208
208
  b(() => {
209
- !e.controls || !C.current || (e.controls.current = {
210
- ...C.current,
209
+ !e.controls || !O.current || (e.controls.current = {
210
+ ...O.current,
211
211
  cleanOptions: () => {
212
212
  p();
213
213
  }
214
214
  });
215
215
  }, [e.controls, p]);
216
- const M = ne(
216
+ const F = ne(
217
217
  () => d === "fetch_on_type" ? h : !1,
218
218
  [d, h]
219
219
  ), V = ee(() => e.multiple ? c.map((o) => i(o, e.optionValue)) : c ? i(c, e.optionValue) : void 0, [c, e.optionValue, e.multiple]), g = (o) => {
220
- const O = T.find((m) => i(m, e.optionValue) === o.id);
221
- O && f(O);
222
- }, { displayMode: D = e.multiple ? "chips" : "compact", dropdownOptions: k, overflow: s = "scroll", onChange: N, onClear: W, ...v } = e.selectComponentProps || {}, J = {
223
- controledSearchValue: w,
224
- onSearchValueChange: d === "fetch_on_type" ? P : void 0,
220
+ const v = T.find((m) => i(m, e.optionValue) === o.id);
221
+ v && f(v);
222
+ }, { displayMode: D = e.multiple ? "chips" : "compact", dropdownOptions: k, overflow: s = "scroll", onChange: N, onClear: W, ...C } = e.selectComponentProps || {}, J = {
223
+ controledSearchValue: _,
224
+ onSearchValueChange: d === "fetch_on_type" ? M : void 0,
225
225
  onSearchClear: d === "fetch_on_type" ? () => {
226
- F(), p();
226
+ P(), p();
227
227
  } : void 0,
228
228
  inputSearchPlaceholder: e.inputSearchPlaceholder,
229
- isLoading: M(),
229
+ isLoading: F(),
230
230
  focusSearchInputOnOpen: !0,
231
231
  ...k || {}
232
232
  }, U = () => {
@@ -240,7 +240,7 @@ const he = (e) => {
240
240
  name: e.name,
241
241
  overflow: s,
242
242
  placeholder: e.placeholder,
243
- ...v,
243
+ ...C,
244
244
  onClear: e?.selectComponentProps?.onClear && U,
245
245
  multiple: !0,
246
246
  value: V,
@@ -252,7 +252,7 @@ const he = (e) => {
252
252
  renderSelection: e.renderSelection,
253
253
  onOptionClick: g,
254
254
  displayMode: D,
255
- controls: C,
255
+ controls: O,
256
256
  emptyMessage: "Use el buscador para obtener las opciones disponibles",
257
257
  dropdownOptions: J,
258
258
  isLoading: d === "fetch_in_open" ? h : !1
@@ -261,7 +261,7 @@ const he = (e) => {
261
261
  Z,
262
262
  {
263
263
  disabled: e.disabled,
264
- ...v,
264
+ ...C,
265
265
  placeholder: e.placeholder,
266
266
  onClear: U,
267
267
  className: e.className,
@@ -277,7 +277,7 @@ const he = (e) => {
277
277
  renderSelection: e.renderSelection,
278
278
  onOptionClick: g,
279
279
  displayMode: "compact",
280
- controls: C,
280
+ controls: O,
281
281
  emptyMessage: "Use el buscador para obtener las opciones disponibles",
282
282
  dropdownOptions: J,
283
283
  isLoading: d === "fetch_in_open" ? h : !1
@@ -1,59 +1,59 @@
1
- import { j as o } from "./jsx-runtime-GkKLlHH4.js";
2
- import { motion as v } from "framer-motion";
3
- import { memo as I, isValidElement as z } from "react";
1
+ import { j as n } from "./jsx-runtime-GkKLlHH4.js";
2
+ import { motion as I } from "framer-motion";
3
+ import { memo as $, useId as w, useRef as z, useEffect as E, isValidElement as L } from "react";
4
4
  import { c as d } from "./cn-B6yFEsav.js";
5
- import $ from "./PlainTooltip.es.js";
6
- const w = /* @__PURE__ */ Symbol.for("react.memo"), E = (e, a, l) => {
5
+ import M from "./PlainTooltip.es.js";
6
+ const R = /* @__PURE__ */ Symbol.for("react.memo"), S = (e, a, o) => {
7
7
  if (!e)
8
8
  return null;
9
9
  if (typeof e == "function") {
10
10
  const i = e;
11
- return /* @__PURE__ */ o.jsx(i, { size: l, className: a });
11
+ return /* @__PURE__ */ n.jsx(i, { size: o, className: a });
12
12
  }
13
13
  if (typeof e == "object") {
14
- if (z(e))
14
+ if (L(e))
15
15
  return e;
16
- if ("$$typeof" in e && e.$$typeof === w) {
16
+ if ("$$typeof" in e && e.$$typeof === R) {
17
17
  const i = e;
18
- return /* @__PURE__ */ o.jsx(i, { size: l, className: a });
18
+ return /* @__PURE__ */ n.jsx(i, { size: o, className: a });
19
19
  }
20
20
  }
21
21
  return e;
22
22
  };
23
- function j({
23
+ function v({
24
24
  items: e,
25
25
  activeTab: a,
26
- onTabChange: l,
26
+ onTabChange: o,
27
27
  className: i,
28
- tabClassName: n,
28
+ tabClassName: l,
29
29
  activeTabClassName: s,
30
- indicatorClassName: f,
30
+ indicatorClassName: b,
31
31
  animated: r = !0,
32
32
  renderTab: u
33
33
  }) {
34
- const b = (t) => {
35
- t.disabled || l?.(t.id, t);
36
- };
37
- return /* @__PURE__ */ o.jsx(
34
+ const p = (t) => {
35
+ t.disabled || o?.(t.id, t);
36
+ }, x = w();
37
+ return /* @__PURE__ */ n.jsx(
38
38
  "div",
39
39
  {
40
40
  className: d(
41
- "flex flex-row justify-around items-end relative border-b border-neutral-strong-default w-full md:justify-start md:px-10 md:gap-5",
41
+ "flex flex-row justify-around items-end relative border-b border-neutral-strong-default w-full md:justify-start md:px-10 md:gap-5 overflow-hidden",
42
42
  i
43
43
  ),
44
44
  role: "tablist",
45
45
  children: e?.map((t) => {
46
- const c = a === t.id, m = () => b(t), { iconPosition: p = "top", iconSize: x = 24 } = t;
47
- return u ? /* @__PURE__ */ o.jsx("div", { children: u(t, c, m, t.onIconClick, t.onIconHover, t.iconTooltipTitle, t.iconTooltipProps, t.iconSize) }, t.id) : /* @__PURE__ */ o.jsx(
48
- L,
46
+ const c = a === t.id, f = () => p(t), { iconPosition: h = "top", iconSize: m = 24 } = t;
47
+ return u ? /* @__PURE__ */ n.jsx("div", { children: u(t, c, f, t.onIconClick, t.onIconHover, t.iconTooltipTitle, t.iconTooltipProps, t.iconSize) }, t.id) : /* @__PURE__ */ n.jsx(
48
+ H,
49
49
  {
50
50
  id: t.id,
51
51
  title: t.title,
52
52
  icon: t.icon,
53
- iconPosition: p,
54
- onClick: m,
53
+ iconPosition: h,
54
+ onClick: f,
55
55
  disabled: t.disabled,
56
- className: n,
56
+ className: l,
57
57
  isActive: c,
58
58
  activeClassName: s,
59
59
  animated: r,
@@ -61,37 +61,43 @@ function j({
61
61
  onIconClick: t.onIconClick,
62
62
  iconTooltipTitle: t.iconTooltipTitle,
63
63
  iconTooltipProps: t.iconTooltipProps,
64
- iconSize: x,
65
- indicatorClassName: f
66
- }
64
+ iconSize: m,
65
+ indicatorClassName: b,
66
+ layoutId: x
67
+ },
68
+ t.id
67
69
  );
68
70
  })
69
71
  }
70
72
  );
71
73
  }
72
- j.displayName = "TabLinks";
73
- const W = I(j, (e, a) => {
74
+ v.displayName = "TabLinks";
75
+ const D = $(v, (e, a) => {
74
76
  if (e.activeTab !== a.activeTab || e.className !== a.className || e.tabClassName !== a.tabClassName || e.activeTabClassName !== a.activeTabClassName || e.indicatorClassName !== a.indicatorClassName || e.animated !== a.animated || e.onTabChange !== a.onTabChange || e.renderTab !== a.renderTab || e.items.length !== a.items.length)
75
77
  return !1;
76
- for (let l = 0; l < e.items.length; l++) {
77
- const i = e.items[l], n = a.items[l];
78
- if (i.id !== n.id || i.title !== n.title || i.disabled !== n.disabled || i.description !== n.description)
78
+ for (let o = 0; o < e.items.length; o++) {
79
+ const i = e.items[o], l = a.items[o];
80
+ if (i.id !== l.id || i.title !== l.title || i.disabled !== l.disabled || i.description !== l.description)
79
81
  return !1;
80
82
  }
81
83
  return !0;
82
- }), L = ({ id: e, title: a, icon: l, iconPosition: i = "top", onClick: n, disabled: s = !1, className: f, isActive: r = !1, activeClassName: u, animated: b = !0, onIconHover: t, onIconClick: c, iconTooltipTitle: m, iconTooltipProps: p, iconSize: x = 20, indicatorClassName: k }) => {
83
- const C = (h, y, T, N, g) => T ? /* @__PURE__ */ o.jsx($, { title: T, ...N, children: /* @__PURE__ */ o.jsx("div", { onMouseEnter: y, onClick: g, children: h }) }) : /* @__PURE__ */ o.jsx("div", { onMouseEnter: y, onClick: g, children: h });
84
- return /* @__PURE__ */ o.jsxs(
84
+ }), H = ({ id: e, title: a, icon: o, iconPosition: i = "top", onClick: l, disabled: s = !1, className: b, isActive: r, activeClassName: u, onIconHover: p, onIconClick: x, iconTooltipTitle: t, iconTooltipProps: c, iconSize: f = 20, indicatorClassName: h, layoutId: m }) => {
85
+ const y = z(!0);
86
+ E(() => {
87
+ y.current && (y.current = !1);
88
+ }, []);
89
+ const C = (T, g, j, N, k) => j ? /* @__PURE__ */ n.jsx(M, { title: j, ...N, children: /* @__PURE__ */ n.jsx("div", { onMouseEnter: g, onClick: k, children: T }) }) : /* @__PURE__ */ n.jsx("div", { onMouseEnter: g, onClick: k, children: T });
90
+ return /* @__PURE__ */ n.jsxs(
85
91
  "button",
86
92
  {
87
- onClick: n,
93
+ onClick: l,
88
94
  disabled: s,
89
95
  className: d(
90
96
  "group/tablink-item",
91
97
  "relative flex flex-col pb-[14px] justify-center items-center h-max px-4 font-medium focus:outline-none transition-colors pt-[14px]",
92
98
  s && "hover:text-primary-default-default cursor-pointer",
93
99
  s && "opacity-50 cursor-default",
94
- f,
100
+ b,
95
101
  r && u
96
102
  ),
97
103
  tabIndex: s ? -1 : 0,
@@ -99,12 +105,12 @@ const W = I(j, (e, a) => {
99
105
  role: "tab",
100
106
  "aria-selected": r,
101
107
  children: [
102
- /* @__PURE__ */ o.jsxs("div", { className: d(
108
+ /* @__PURE__ */ n.jsxs("div", { className: d(
103
109
  "flex items-center gap-0.5",
104
110
  i === "left" && "flex-row-reverse",
105
111
  i === "top" ? "flex-col-reverse" : "gap-1"
106
112
  ), children: [
107
- /* @__PURE__ */ o.jsx(
113
+ /* @__PURE__ */ n.jsx(
108
114
  "label",
109
115
  {
110
116
  className: d(
@@ -115,33 +121,34 @@ const W = I(j, (e, a) => {
115
121
  children: a
116
122
  }
117
123
  ),
118
- C(E(l, d(
124
+ C(S(o, d(
119
125
  "transition-all duration-300 ease-in-out group-hover/tablink-item:text-neutral-medium-hover ",
120
126
  r ? "text-primary-default-default prometeo-fonts-title-medium group-hover/tablink-item:text-primary-default-default" : "text-neutral-medium-default prometeo-fonts-body-large"
121
- ), x), t, m, p, c)
127
+ ), f), p, t, c, x)
122
128
  ] }),
123
- r && b && /* @__PURE__ */ o.jsx(
124
- v.div,
129
+ r ? /* @__PURE__ */ n.jsx(
130
+ I.div,
125
131
  {
126
- layoutId: "tab-indicator",
132
+ layoutId: m ? `tab-indicator-${m}` : "tab-indicator",
133
+ id: `tab-indicator-${e}`,
134
+ initial: y.current ? !1 : void 0,
127
135
  className: d(
128
- "absolute -bottom-px left-1/2 -translate-x-1/2 h-[4px] rounded-t-xl bg-primary-default-default z-0 w-[calc(100%-32px)]",
129
- k
136
+ "absolute bottom-0 left-1/2 -translate-x-1/2 h-[4px] rounded-t-xl bg-primary-default-default z-10 w-[calc(100%-32px)]",
137
+ h
130
138
  ),
131
139
  transition: {
132
140
  type: "spring",
133
141
  stiffness: 250,
134
142
  damping: 17
135
- },
136
- "aria-hidden": "true"
143
+ }
137
144
  }
138
- )
145
+ ) : null
139
146
  ]
140
147
  },
141
- e
148
+ `tablink-${e}`
142
149
  );
143
150
  };
144
151
  export {
145
- W as T,
146
- L as a
152
+ D as T,
153
+ H as a
147
154
  };
@@ -1,4 +1,4 @@
1
- import { T as f } from "./TabLinks-DxqprStp.js";
1
+ import { T as f } from "./TabLinks-BjGwvqR9.js";
2
2
  export {
3
3
  f as default
4
4
  };