prometeo-design-system 4.4.0 → 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.
- package/dist/Chip.d.ts +6 -0
- package/dist/Chip.es.js +55 -0
- package/dist/Input.es.js +108 -95
- package/dist/PyrionLayout.es.js +5 -4
- package/dist/Select.es.js +382 -429
- package/dist/SelectSearch.es.js +38 -38
- package/dist/components/Input/Input.d.ts +3 -3
- package/dist/components/Shared/Chip.d.ts +2 -2
- package/dist/exports/Chip.d.ts +2 -0
- package/package.json +8 -1
package/dist/SelectSearch.es.js
CHANGED
|
@@ -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:
|
|
7
|
+
options: O,
|
|
8
8
|
fetcher: d,
|
|
9
|
-
asyncMode:
|
|
10
|
-
disabled:
|
|
11
|
-
debounceDelay:
|
|
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:
|
|
16
|
+
isOpen: P,
|
|
17
17
|
inputRef: p,
|
|
18
18
|
name: I
|
|
19
|
-
} = e || {},
|
|
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 =
|
|
57
|
+
const G = P !== void 0 ? P : J;
|
|
58
58
|
b(() => {
|
|
59
|
-
if (!
|
|
59
|
+
if (!_ && S.current && w === "fetch_on_type") {
|
|
60
60
|
if (!s || s === "" || s.length < T) {
|
|
61
|
-
o.current && clearTimeout(o.current),
|
|
61
|
+
o.current && clearTimeout(o.current), C(!1);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
const n = B(q,
|
|
65
|
-
|
|
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
|
-
|
|
69
|
+
C(!1), e?.onFetchingEnd?.();
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
}, [
|
|
73
|
-
if (!
|
|
72
|
+
}, [w, s, _, M, B, T]), b(() => {
|
|
73
|
+
if (!_)
|
|
74
74
|
if (G) {
|
|
75
|
-
if (e?.onOpen?.(),
|
|
75
|
+
if (e?.onOpen?.(), w === "fetch_in_open") {
|
|
76
76
|
if (!S.current)
|
|
77
77
|
return;
|
|
78
|
-
|
|
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
|
-
|
|
88
|
+
C(!1), e?.onFetchingEnd?.();
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
} else
|
|
92
92
|
e?.onClose?.();
|
|
93
|
-
}, [G,
|
|
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 && (
|
|
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
|
-
},
|
|
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
|
|
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:
|
|
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
|
-
|
|
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:
|
|
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 || !
|
|
210
|
-
...
|
|
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
|
|
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
|
|
221
|
-
|
|
222
|
-
}, { displayMode: D = e.multiple ? "chips" : "compact", dropdownOptions: k, overflow: s = "scroll", onChange: N, onClear: W, ...
|
|
223
|
-
controledSearchValue:
|
|
224
|
-
onSearchValueChange: d === "fetch_on_type" ?
|
|
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
|
-
|
|
226
|
+
P(), p();
|
|
227
227
|
} : void 0,
|
|
228
228
|
inputSearchPlaceholder: e.inputSearchPlaceholder,
|
|
229
|
-
isLoading:
|
|
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
|
-
...
|
|
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:
|
|
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
|
-
...
|
|
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:
|
|
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,5 +1,5 @@
|
|
|
1
1
|
export type InputVariant = "default" | "error" | "success";
|
|
2
|
-
export type InputSize = "small" | "medium" | "large";
|
|
2
|
+
export type InputSize = "xsmall" | "small" | "medium" | "large";
|
|
3
3
|
export type LabelVariant = "default" | "static";
|
|
4
4
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
|
|
5
5
|
label: string;
|
|
@@ -31,5 +31,5 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
31
31
|
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
32
32
|
onClickIcon?: (event: React.MouseEvent) => void;
|
|
33
33
|
}
|
|
34
|
-
declare const
|
|
35
|
-
export default
|
|
34
|
+
declare const Input: import('react').NamedExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
35
|
+
export default Input;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prometeo-design-system",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.4.
|
|
4
|
+
"version": "4.4.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "design kit system",
|
|
7
7
|
"main": "dist/prometeo-design-system.umd.js",
|
|
@@ -202,6 +202,10 @@
|
|
|
202
202
|
"types": "./dist/UserCard.d.ts",
|
|
203
203
|
"import": "./dist/UserCard.es.js"
|
|
204
204
|
},
|
|
205
|
+
"./Chip": {
|
|
206
|
+
"types": "./dist/Chip.d.ts",
|
|
207
|
+
"import": "./dist/Chip.es.js"
|
|
208
|
+
},
|
|
205
209
|
"./styles": "./dist/styles.css",
|
|
206
210
|
"./intellisense": "./src/styles/intellisense.css"
|
|
207
211
|
},
|
|
@@ -305,6 +309,9 @@
|
|
|
305
309
|
"ajv": "^8.17.1",
|
|
306
310
|
"ajv-draft-04": {
|
|
307
311
|
"ajv": "^8.17.1"
|
|
312
|
+
},
|
|
313
|
+
"ajv-formats": {
|
|
314
|
+
"ajv": "^8.17.1"
|
|
308
315
|
}
|
|
309
316
|
}
|
|
310
317
|
}
|