prometeo-design-system 2.5.0 → 2.5.2

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/Select.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as f } from "./Select-CxJFcGuQ.js";
1
+ import { S as f } from "./Select-B32JqJIS.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { j as m } from "./jsx-runtime-DKDX3adD.js";
2
2
  import { useField as c } from "formik";
3
- import { S as f } from "./Select-CxJFcGuQ.js";
3
+ import { S as f } from "./Select-B32JqJIS.js";
4
4
  import { useRef as d, useEffect as v } from "react";
5
5
  function n(r) {
6
6
  return Array.isArray(r) && r.every(
@@ -1,146 +1,140 @@
1
- import { j as q } from "./jsx-runtime-DKDX3adD.js";
2
- import { g as s, S as $ } from "./Select-CxJFcGuQ.js";
3
- import { useState as C, useRef as j, useEffect as f, useMemo as z, useCallback as G } from "react";
4
- function ee(e) {
1
+ import { j as z } from "./jsx-runtime-DKDX3adD.js";
2
+ import { g as i, S as ee } from "./Select-B32JqJIS.js";
3
+ import { useState as y, useRef as O, useEffect as a, useMemo as G, useCallback as H } from "react";
4
+ function te(e) {
5
5
  const {
6
- options: u,
6
+ options: f,
7
7
  multiple: l = !1,
8
- fetcher: v,
9
- asyncMode: b = "fetch_in_open",
10
- disabled: S = !1,
11
- debounceDelay: d = 500,
12
- minCharacters: L = 3,
13
- optionLabel: h,
14
- optionValue: a,
15
- controlledValue: p,
16
- isOpen: k,
17
- inputRef: V,
18
- name: x
19
- } = e || {}, [_, w] = C(u || []), [E, T] = C(u || []), [r, y] = C(""), [P, I] = C(!1), [m, M] = C([]), [H, N] = C(!1), R = j(null), A = j(null), D = j(!1), F = j(v);
20
- f(() => {
21
- F.current = v;
22
- }, [v]), f(() => {
23
- p !== void 0 && M(p);
24
- }, [p]), f(() => {
25
- e?.options && (w(e.options), T(e.options));
8
+ fetcher: C,
9
+ asyncMode: g = "fetch_in_open",
10
+ disabled: v = !1,
11
+ debounceDelay: p = 500,
12
+ minCharacters: S = 3,
13
+ optionLabel: m,
14
+ optionValue: d,
15
+ controlledValue: u,
16
+ isOpen: j,
17
+ inputRef: L,
18
+ name: k
19
+ } = e || {}, [V, _] = y(f || []), [P, w] = y(f || []), [c, T] = y(""), [M, I] = y(!1), [h, A] = y([]), [N, Q] = y(!1), R = O(null), D = O(null), J = O(!1), x = O(C), F = O([]);
20
+ a(() => {
21
+ x.current = C;
22
+ }, [C]), a(() => {
23
+ u !== void 0 && A(u);
24
+ }, [u]), a(() => {
25
+ F.current = u !== void 0 ? u : h;
26
+ }, [u, h]), a(() => {
27
+ e?.options && (_(e.options), w(e.options));
26
28
  }, [e?.options]);
27
- const J = z(() => (n, t) => new Promise((o, c) => {
28
- R.current && clearTimeout(R.current), R.current = setTimeout(() => n(r).then(o).catch(c), t);
29
- }), [r]), Q = (n) => {
30
- const t = p !== void 0;
31
- console.log(t, "isControlled");
32
- const o = t ? p : m;
33
- console.log(o, "prev value");
34
- let c;
35
- const i = (O) => a ? s(O, a) : s(O, "id");
36
- if (l) {
37
- const O = o.some((g) => i(g) === i(n));
38
- console.log(O, "exists"), O ? c = o.filter((g) => i(g) !== i(n)) : c = [...o, n];
39
- } else
40
- c = [n];
41
- t || M(c), e?.onChange?.(c, x);
42
- }, K = (n) => (e?.onFetchingStart?.(), F.current?.(n) || Promise.resolve([])), B = G((n, t) => n.length === 0 ? t : a ? t.filter((o) => !n.some((c) => s(c, a) === s(o, a))) : t.filter((o) => !n.some((c) => s(c, "id") === s(o, "id"))), [a]);
43
- f(() => {
44
- const n = e?.subscribeOpenChange;
45
- if (!n) return;
46
- const t = n((o) => {
47
- N(o);
29
+ const K = G(() => (t, n) => new Promise((r, o) => {
30
+ R.current && clearTimeout(R.current), R.current = setTimeout(() => t(c).then(r).catch(o), n);
31
+ }), [c]), X = (t) => {
32
+ const n = u !== void 0, r = F.current;
33
+ let o;
34
+ const s = (E) => d ? i(E, d) : i(E, "id");
35
+ l ? r.some((b) => s(b) === s(t)) ? o = r.filter((b) => s(b) !== s(t)) : o = [...r, t] : o = [t], n ? (F.current = o, e?.onChange?.(o, k)) : (F.current = o, A(o), e?.onChange?.(o, k));
36
+ }, B = (t) => (e?.onFetchingStart?.(), x.current?.(t) || Promise.resolve([])), U = H((t, n) => t.length === 0 ? n : d ? n.filter((r) => !t.some((o) => i(o, d) === i(r, d))) : n.filter((r) => !t.some((o) => i(o, "id") === i(r, "id"))), [d]);
37
+ a(() => {
38
+ const t = e?.subscribeOpenChange;
39
+ if (!t) return;
40
+ const n = t((r) => {
41
+ Q(r);
48
42
  });
49
43
  return () => {
50
- t && t();
44
+ n && n();
51
45
  };
52
46
  }, [e?.subscribeOpenChange]);
53
- const U = k !== void 0 ? k : H;
54
- f(() => {
55
- if (!S && F.current && b === "fetch_on_type") {
56
- if (!r || r === "" || r.length < L) {
47
+ const W = j !== void 0 ? j : N;
48
+ a(() => {
49
+ if (!v && x.current && g === "fetch_on_type") {
50
+ if (!c || c === "" || c.length < S) {
57
51
  R.current && clearTimeout(R.current), I(!1);
58
52
  return;
59
53
  }
60
- const n = J(K, d);
61
- I(!0), n.then((t) => {
62
- w(t);
54
+ const t = K(B, p);
55
+ I(!0), t.then((n) => {
56
+ _(n);
63
57
  }).finally(() => {
64
58
  I(!1), e?.onFetchingEnd?.();
65
59
  });
66
60
  }
67
- }, [b, r, S, d, J, L]), f(() => {
68
- if (U) {
69
- if (e?.onOpen?.(), b === "fetch_in_open") {
70
- if (!F.current)
61
+ }, [g, c, v, p, K, S]), a(() => {
62
+ if (W) {
63
+ if (e?.onOpen?.(), g === "fetch_in_open") {
64
+ if (!x.current)
71
65
  return;
72
- I(!0), K().then((n) => {
73
- w(() => m.length > 0 ? [...B(m, n), ...m] : n);
66
+ I(!0), B().then((t) => {
67
+ _(() => h.length > 0 ? [...U(h, t), ...h] : t);
74
68
  }).finally(() => {
75
69
  I(!1), e?.onFetchingEnd?.();
76
70
  });
77
71
  }
78
72
  } else
79
73
  e?.onClose?.();
80
- }, [U, b]);
81
- const X = (n, t) => n.filter((o) => {
82
- if (h)
83
- return s(o, h).toLowerCase().includes(t.toLowerCase());
84
- switch (typeof o) {
74
+ }, [W, g]);
75
+ const Y = (t, n) => t.filter((r) => {
76
+ if (m)
77
+ return i(r, m).toLowerCase().includes(n.toLowerCase());
78
+ switch (typeof r) {
85
79
  case "string":
86
- return o.toLowerCase().includes(t.toLowerCase());
80
+ return r.toLowerCase().includes(n.toLowerCase());
87
81
  case "number":
88
- return o.toString().includes(t);
82
+ return r.toString().includes(n);
89
83
  case "object":
90
- return Object.values(o).some((i) => i.toString().toLowerCase().includes(t.toLowerCase()));
84
+ return Object.values(r).some((s) => s.toString().toLowerCase().includes(n.toLowerCase()));
91
85
  default:
92
86
  return !1;
93
87
  }
94
- }), Y = (n) => n.sort((t, o) => {
95
- if (h)
96
- return s(t, h) < s(o, h) ? -1 : 1;
88
+ }), Z = (t) => t.sort((n, r) => {
89
+ if (m)
90
+ return i(n, m) < i(r, m) ? -1 : 1;
97
91
  {
98
- const i = ["label", "name", "value"].find((g) => typeof t == "object" && Object.keys(t).includes(g));
99
- switch (typeof t) {
92
+ const s = ["label", "name", "value"].find((b) => typeof n == "object" && Object.keys(n).includes(b));
93
+ switch (typeof n) {
100
94
  case "string":
101
- return t < o ? -1 : 1;
95
+ return n < r ? -1 : 1;
102
96
  case "number":
103
- return t < o ? -1 : 1;
97
+ return n < r ? -1 : 1;
104
98
  case "object":
105
- if (i) {
106
- const g = s(t, i), Z = s(o, i);
107
- return g < Z ? -1 : 1;
99
+ if (s) {
100
+ const b = i(n, s), $ = i(r, s);
101
+ return b < $ ? -1 : 1;
108
102
  } else
109
103
  return 1;
110
104
  default:
111
105
  return 1;
112
106
  }
113
107
  }
114
- }), W = (n) => {
115
- const t = typeof V == "function" ? V() : V;
116
- n.target === t?.current && (A.current && clearTimeout(A.current), D.current || (D.current = !0, e?.onTypeStart?.()), A.current = setTimeout(() => {
117
- D.current = !1;
118
- }, d));
108
+ }), q = (t) => {
109
+ const n = typeof L == "function" ? L() : L;
110
+ t.target === n?.current && (D.current && clearTimeout(D.current), J.current || (J.current = !0, e?.onTypeStart?.()), D.current = setTimeout(() => {
111
+ J.current = !1;
112
+ }, p));
119
113
  };
120
- return f(() => {
121
- if (r === "")
122
- T(Y(_));
114
+ return a(() => {
115
+ if (c === "")
116
+ w(Z(V));
123
117
  else {
124
- const n = B(m, _);
125
- T([...X(n, r), ...m]);
118
+ const t = U(h, V);
119
+ w([...Y(t, c), ...h]);
126
120
  }
127
- }, [_]), f(() => (document.addEventListener("keydown", W), () => {
128
- document.removeEventListener("keydown", W);
121
+ }, [V]), a(() => (document.addEventListener("keydown", q), () => {
122
+ document.removeEventListener("keydown", q);
129
123
  }), []), {
130
- inputValue: r,
131
- setInputValue: y,
124
+ inputValue: c,
125
+ setInputValue: T,
132
126
  cleanInputValue: () => {
133
- y("");
127
+ T("");
134
128
  },
135
- filteredOptions: E,
136
- isLoading: P,
137
- value: m,
138
- setValue: M,
139
- onOptionClick: Q
129
+ filteredOptions: P,
130
+ isLoading: M,
131
+ value: h,
132
+ setValue: A,
133
+ onOptionClick: X
140
134
  };
141
135
  }
142
- const ce = (e) => {
143
- const u = j(null), { asyncMode: l = "fetch_in_open" } = e, { inputValue: v, setInputValue: b, filteredOptions: S, isLoading: d, value: L, onOptionClick: h, cleanInputValue: a } = ee({
136
+ const ie = (e) => {
137
+ const f = O(null), { asyncMode: l = "fetch_in_open" } = e, { inputValue: C, setInputValue: g, filteredOptions: v, isLoading: p, value: S, onOptionClick: m, cleanInputValue: d } = te({
144
138
  options: e.options,
145
139
  fetcher: e.fetcher,
146
140
  asyncMode: l,
@@ -151,51 +145,50 @@ const ce = (e) => {
151
145
  optionValue: e.optionValue,
152
146
  optionLabel: e.optionLabel,
153
147
  onFetchingStart: () => {
154
- l === "fetch_on_type" && u.current?.open();
148
+ l === "fetch_on_type" && f.current?.open();
155
149
  },
156
150
  onTypeStart: () => {
157
- !e?.fetcher && u.current?.open();
151
+ !e?.fetcher && f.current?.open();
158
152
  },
159
- inputRef: () => u.current?.searchInputRef,
153
+ inputRef: () => f.current?.searchInputRef,
160
154
  //estado controlado
161
155
  controlledValue: e.value,
162
- subscribeOpenChange: u.current?.subscribeOpenChange,
156
+ subscribeOpenChange: f.current?.subscribeOpenChange,
163
157
  onChange: e.onChange,
164
158
  name: e.name
165
- }), p = z(() => L.map((r) => s(r, e.optionValue)), [L, e.optionValue]), k = G(() => l === "fetch_on_type" ? d : !1, [l, d]), V = (r) => {
166
- console.log(r, "newValue");
167
- const y = S.find((P) => s(P, e.optionValue) === r.id);
168
- y && (console.log(y, "originalOption"), h(y));
169
- }, { displayMode: x = "chips", dropdownOptions: _, overflow: w = "scroll", ...E } = e.selectComponentProps || {}, T = {
170
- controledSearchValue: v,
171
- onSearchValueChange: l === "fetch_on_type" ? b : void 0,
172
- onSearchClear: l === "fetch_on_type" ? a : void 0,
159
+ }), u = G(() => S.map((c) => i(c, e.optionValue)), [S, e.optionValue]), j = H(() => l === "fetch_on_type" ? p : !1, [l, p]), L = (c) => {
160
+ const T = v.find((M) => i(M, e.optionValue) === c.id);
161
+ T && m(T);
162
+ }, { displayMode: k = "chips", dropdownOptions: V, overflow: _ = "scroll", ...P } = e.selectComponentProps || {}, w = {
163
+ controledSearchValue: C,
164
+ onSearchValueChange: l === "fetch_on_type" ? g : void 0,
165
+ onSearchClear: l === "fetch_on_type" ? d : void 0,
173
166
  inputSearchPlaceholder: e.inputSearchPlaceholder,
174
- isLoading: k(),
175
- ..._ || {}
167
+ isLoading: j(),
168
+ ...V || {}
176
169
  };
177
- return /* @__PURE__ */ q.jsx("div", { children: /* @__PURE__ */ q.jsx(
178
- $,
170
+ return /* @__PURE__ */ z.jsx("div", { children: /* @__PURE__ */ z.jsx(
171
+ ee,
179
172
  {
180
173
  name: e.name,
181
- overflow: w,
182
- ...E,
174
+ overflow: _,
175
+ ...P,
183
176
  label: e.label || "",
184
- value: p,
185
- options: S,
177
+ value: u,
178
+ options: v,
186
179
  optionValue: e.optionValue,
187
180
  optionLabel: e.optionLabel,
188
181
  renderOption: e.renderOption,
189
- onOptionClick: V,
182
+ onOptionClick: L,
190
183
  multiple: e.multiple,
191
- displayMode: x,
192
- controls: u,
184
+ displayMode: k,
185
+ controls: f,
193
186
  emptyMessage: "Use el buscador para obtener las opciones disponibles",
194
- dropdownOptions: T,
195
- isLoading: l === "fetch_in_open" ? d : !1
187
+ dropdownOptions: w,
188
+ isLoading: l === "fetch_in_open" ? p : !1
196
189
  }
197
190
  ) });
198
191
  };
199
192
  export {
200
- ce as default
193
+ ie as default
201
194
  };
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ import { ColorVariant, ButtonVariant } from '../Shared/types';
3
+ import { IconComponent } from '../../Icons/Icons';
4
+ export interface FAButtonProps {
5
+ icon?: IconComponent;
6
+ label?: string;
7
+ attachToParent?: boolean;
8
+ position?: {
9
+ left?: number | string;
10
+ top?: number | string;
11
+ right?: number | string;
12
+ bottom?: number | string;
13
+ };
14
+ color?: ColorVariant;
15
+ variant?: ButtonVariant;
16
+ disabled?: boolean;
17
+ className?: string;
18
+ onClick: () => void;
19
+ }
20
+ declare const FAButton: React.MemoExoticComponent<(props: FAButtonProps) => import("react/jsx-runtime").JSX.Element>;
21
+ export default FAButton;
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  export interface OtpInputProps {
3
3
  value?: string;
4
- onChange?: (value: string) => void;
4
+ onChange?: (value: string, name?: string) => void;
5
5
  onComplete?: (value: string) => void;
6
6
  onBlur?: () => void;
7
7
  maxLength?: number;
@@ -23,5 +23,8 @@ export interface OtpInputProps {
23
23
  name?: string;
24
24
  variant?: 'default' | 'error' | 'success';
25
25
  }
26
- declare const OtpInputComponent: ({ value, name, onChange, onComplete, onBlur, maxLength, placeholder, disabled, className, autoFocus, pasteTransformer, errorComponent, hasError, helperComponent, helperAlignment, slotClassName, variant, hideSlotsMiddleSeparator }: OtpInputProps) => import("react/jsx-runtime").JSX.Element;
26
+ declare const OtpInputComponent: {
27
+ ({ value, name, onChange, onComplete, onBlur, maxLength, placeholder, disabled, className, autoFocus, pasteTransformer, errorComponent, hasError, helperComponent, helperAlignment, slotClassName, variant, hideSlotsMiddleSeparator }: OtpInputProps): import("react/jsx-runtime").JSX.Element;
28
+ displayName: string;
29
+ };
27
30
  export default OtpInputComponent;
@@ -0,0 +1 @@
1
+ export { default } from '../components/FAB/FAButton';
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { default as Toast } from './components/Toaster/Toaster';
37
37
  export { default as ToastProvider } from './components/Toaster/ToastProvider';
38
38
  export { toastpyrion } from './components/Toaster/Toaster';
39
39
  export { default as SelectSearch } from './components/SelectSearch/SelectSearch';
40
+ export { default as FAButton } from './components/FAB/FAButton';
40
41
  export * from './components/Sidebar';
41
42
  export { SecondaryBar } from './components/Sidebar/SecondaryBar/SecondaryBar';
42
43
  export { Badge } from './components/Sidebar/components/badge';
@@ -99,4 +100,5 @@ export type { CustomSelectionDisplayProps } from './components/Select/Select';
99
100
  export type { CustomSelectOptionRendererProps } from './components/Select/Select';
100
101
  export type { SelectOptionType } from './components/Select/Select';
101
102
  export type { SelectSearchProps } from './components/SelectSearch/SelectSearch';
103
+ export type { FAButtonProps } from './components/FAB/FAButton';
102
104
  export { Icons } from './Icons/Icons';
@@ -0,0 +1,2 @@
1
+ declare const ButtonsPage: () => import("react/jsx-runtime").JSX.Element;
2
+ export default ButtonsPage;
@@ -0,0 +1,2 @@
1
+ declare const OtpPage: () => import("react/jsx-runtime").JSX.Element;
2
+ export default OtpPage;
@@ -0,0 +1,2 @@
1
+ declare const FABPreview: () => import("react/jsx-runtime").JSX.Element;
2
+ export default FABPreview;
@@ -0,0 +1,2 @@
1
+ declare const OTPPreview: () => import("react/jsx-runtime").JSX.Element;
2
+ export default OTPPreview;
@@ -0,0 +1,2 @@
1
+ declare const SegmentedButtonPreview: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SegmentedButtonPreview;