@envisiongroup/porygon 0.1.0-rc.2 → 0.1.0-rc.4
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/react-components/fields/EFWAttachments/EFWAttachments.js +68 -67
- package/dist/react-components/fields/EFWAttachments/EFWAttachments.types.d.ts +8 -2
- package/dist/react-components/fields/EFWAttachmentsField/EFWAttachmentsField.js +18 -16
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.js +79 -100
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.types.d.ts +6 -1
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.d.ts +2 -0
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.js +33 -19
- package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.js +35 -33
- package/dist/react-components/fields/EFWField/EFWField.d.ts +2 -1
- package/dist/react-components/fields/EFWField/EFWField.js +39 -33
- package/dist/react-components/fields/EFWInput/EFWInput.js +86 -67
- package/dist/react-components/fields/EFWInput/EFWInput.types.d.ts +13 -1
- package/dist/react-components/fields/EFWInput/EFWInput.utils.js +32 -33
- package/dist/react-components/fields/EFWInputField/EFWInputField.js +33 -31
- package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.js +136 -121
- package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.types.d.ts +12 -0
- package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.js +31 -29
- package/dist/react-components/fields/EFWSwitch/EFWSwitch.js +36 -35
- package/dist/react-components/fields/EFWSwitch/EFWSwitch.types.d.ts +6 -0
- package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.js +24 -22
- package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.types.d.ts +1 -1
- package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.js +122 -113
- package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.types.d.ts +7 -2
- package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.js +31 -29
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.js +59 -57
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.types.d.ts +6 -2
- package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.js +31 -29
- package/dist/react-components/forms/EFWForm/EFWForm.d.ts +2 -1
- package/dist/react-components/forms/EFWForm/EFWForm.js +245 -210
- package/dist/react-components/forms/EFWForm/EFWForm.types.d.ts +13 -8
- package/dist/react-components/forms/EFWForm/EFWForm.utils.js +212 -179
- package/dist/react-components/tables/EFWTable/EFWTable.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/EFWTable.js +473 -392
- package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +21 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.js +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +68 -77
- package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.js +4 -4
- package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.js +33 -30
- package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +1 -1
- package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as y, useState as
|
|
3
|
-
import { makeStyles as
|
|
4
|
-
import { CollectionsEmpty20Regular as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as o, Fragment as pe, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as y, useState as O, useMemo as V, useEffect as T, useCallback as u } from "react";
|
|
3
|
+
import { makeStyles as ue, tokens as s, useTagPickerFilter as fe, TagPickerOption as R, Avatar as ge, Spinner as me, mergeClasses as he, TagPicker as be, TagPickerControl as Oe, TagPickerGroup as Ce, Tag as Se, TagPickerInput as ke, Button as ye, TagPickerList as Te, Text as xe } from "@fluentui/react-components";
|
|
4
|
+
import { CollectionsEmpty20Regular as Pe, Eraser20Regular as ve } from "@fluentui/react-icons";
|
|
5
|
+
const w = [], Ne = ue({
|
|
6
6
|
efwTagPickerControl: {
|
|
7
7
|
"& [disabled]": {
|
|
8
8
|
backgroundColor: s.colorNeutralBackground3,
|
|
@@ -35,99 +35,106 @@ const ye = se({
|
|
|
35
35
|
borderBottomWidth: "2px"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
38
|
+
}), Me = (q) => {
|
|
39
39
|
const {
|
|
40
|
-
placeholder:
|
|
41
|
-
noMatchesMessage:
|
|
42
|
-
loadingMessage:
|
|
43
|
-
className:
|
|
44
|
-
minQueryLength:
|
|
45
|
-
options:
|
|
46
|
-
hidden:
|
|
47
|
-
disabled:
|
|
48
|
-
editable:
|
|
49
|
-
selectedOptions:
|
|
50
|
-
|
|
51
|
-
noPopover:
|
|
52
|
-
tagSize:
|
|
53
|
-
tagShape:
|
|
54
|
-
tagAppearance:
|
|
55
|
-
onChange:
|
|
56
|
-
beforeRenderOptions:
|
|
57
|
-
multiple:
|
|
58
|
-
validationState:
|
|
59
|
-
validationMessage:
|
|
60
|
-
setParentComponentState:
|
|
61
|
-
} =
|
|
62
|
-
Object.fromEntries(
|
|
63
|
-
),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
40
|
+
placeholder: Q = "Selecciona una opción",
|
|
41
|
+
noMatchesMessage: W = "No se encontraron coincidencias",
|
|
42
|
+
loadingMessage: G = "Buscando información...",
|
|
43
|
+
className: J = "",
|
|
44
|
+
minQueryLength: f = 0,
|
|
45
|
+
options: r = w,
|
|
46
|
+
hidden: Y = !1,
|
|
47
|
+
disabled: M = !1,
|
|
48
|
+
editable: H = !0,
|
|
49
|
+
selectedOptions: x = w,
|
|
50
|
+
defaultSelectedOptions: P = w,
|
|
51
|
+
noPopover: U = !1,
|
|
52
|
+
tagSize: X = "medium",
|
|
53
|
+
tagShape: Z = "rounded",
|
|
54
|
+
tagAppearance: $ = "brand",
|
|
55
|
+
onChange: C,
|
|
56
|
+
beforeRenderOptions: g,
|
|
57
|
+
multiple: L = !0,
|
|
58
|
+
validationState: z = "none",
|
|
59
|
+
validationMessage: K,
|
|
60
|
+
setParentComponentState: v
|
|
61
|
+
} = q, ee = y(z), te = y(K), [a, A] = O(""), i = x !== void 0, D = (i ? x : P) ?? [], [oe, N] = O(D), l = i ? x ?? [] : oe, d = V(() => l.map((e) => e.key), [l]), [c, m] = O([]), [ne, B] = O(!1), [h, S] = O(!1), p = y(), k = y(
|
|
62
|
+
Object.fromEntries(D.map((e) => [e.key, e]))
|
|
63
|
+
), I = V(
|
|
64
|
+
() => P ?? [],
|
|
65
|
+
[P]
|
|
66
|
+
);
|
|
67
|
+
T(() => {
|
|
68
|
+
l.forEach((e) => {
|
|
69
|
+
k.current[e.key] = e;
|
|
70
|
+
});
|
|
71
|
+
}, [l]);
|
|
72
|
+
const _ = Ne(), re = u((e) => (l.find((n) => n.key === e) || k.current[e])?.text || e, [l]);
|
|
73
|
+
T(() => {
|
|
74
|
+
typeof r == "function" && a.length < f && h && S(!1);
|
|
75
|
+
}, [a, f, r, h]), T(() => h ? (p.current?.abort(), p.current = new AbortController(), (async () => {
|
|
76
|
+
if (typeof r != "function") {
|
|
77
|
+
const t = g ? g(r) : r;
|
|
78
|
+
m(t);
|
|
72
79
|
return;
|
|
73
80
|
}
|
|
74
|
-
|
|
81
|
+
v?.(ee.current, te.current);
|
|
75
82
|
try {
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
} catch (
|
|
80
|
-
|
|
83
|
+
B(!0), m([]);
|
|
84
|
+
const t = await r(a, { signal: p.current.signal }), n = g ? g(t) : t;
|
|
85
|
+
m(n);
|
|
86
|
+
} catch (t) {
|
|
87
|
+
p.current?.signal.aborted || (console.error("Error loading options:", t), m([]), v?.("error", JSON.stringify(t)));
|
|
81
88
|
} finally {
|
|
82
|
-
|
|
89
|
+
p.current?.signal.aborted || B(!1);
|
|
83
90
|
}
|
|
84
|
-
})(), () =>
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
}, [
|
|
88
|
-
if (
|
|
89
|
-
|
|
91
|
+
})(), () => p.current?.abort()) : void 0, [h, r, a, g, v, f]);
|
|
92
|
+
const ae = u(() => {
|
|
93
|
+
i || N([]), C?.([]);
|
|
94
|
+
}, [i, C]), le = u((e, t) => {
|
|
95
|
+
if (t.open && typeof r == "function" && a.length < f) {
|
|
96
|
+
S(!1);
|
|
90
97
|
return;
|
|
91
98
|
}
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
if (
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
return
|
|
99
|
+
t.open && typeof r == "function" && (B(!0), m([])), S(t.open);
|
|
100
|
+
}, [r, a, f]), se = u((e, t) => {
|
|
101
|
+
if (t.value === "no-matches") return;
|
|
102
|
+
let n;
|
|
103
|
+
L ? n = t.selectedOptions : (n = t.selectedOptions.slice(-1), S(!1)), A("");
|
|
104
|
+
const j = n.map((b) => {
|
|
105
|
+
const E = c.find((de) => de.key === b) || k.current[b];
|
|
106
|
+
return E && (k.current[b] = E), E || { key: b, text: b };
|
|
100
107
|
});
|
|
101
|
-
|
|
102
|
-
}, [
|
|
108
|
+
i || N(j), C?.(j);
|
|
109
|
+
}, [c, C, L, i]), ie = fe({
|
|
103
110
|
// La consulta actual ingresada por el usuario para filtrar opciones.
|
|
104
111
|
query: a,
|
|
105
112
|
// Lista de claves (como strings) de las opciones disponibles, obtenidas de 'availableOptions'.
|
|
106
|
-
options:
|
|
113
|
+
options: c.map((e) => e.key.toString()),
|
|
107
114
|
// Elemento a mostrar cuando no hay opciones disponibles.
|
|
108
|
-
noOptionsElement:
|
|
115
|
+
noOptionsElement: ne ? (
|
|
109
116
|
// Si está cargando ('isLoading' es true), muestra un spinner pequeño.
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
117
|
+
/* @__PURE__ */ o(
|
|
118
|
+
me,
|
|
112
119
|
{
|
|
113
120
|
style: { height: "30px" },
|
|
114
121
|
size: "extra-tiny",
|
|
115
122
|
appearance: "primary",
|
|
116
123
|
label: {
|
|
117
124
|
size: "small",
|
|
118
|
-
children:
|
|
125
|
+
children: G
|
|
119
126
|
// Mensaje como "Buscando información...".
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
129
|
)
|
|
123
130
|
) : (
|
|
124
131
|
// Si no está cargando y no hay opciones, muestra un mensaje de "sin coincidencias".
|
|
125
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ o(
|
|
126
133
|
R,
|
|
127
134
|
{
|
|
128
135
|
value: "no-matches",
|
|
129
|
-
media: /* @__PURE__ */
|
|
130
|
-
children:
|
|
136
|
+
media: /* @__PURE__ */ o(Pe, {}),
|
|
137
|
+
children: W
|
|
131
138
|
}
|
|
132
139
|
)
|
|
133
140
|
),
|
|
@@ -137,21 +144,21 @@ const ye = se({
|
|
|
137
144
|
* @returns {JSX.Element} - Elemento JSX que representa la opción.
|
|
138
145
|
*/
|
|
139
146
|
renderOption: u((e) => {
|
|
140
|
-
const
|
|
141
|
-
return
|
|
147
|
+
const t = c.find((n) => n.key === e);
|
|
148
|
+
return t ? /* @__PURE__ */ o(
|
|
142
149
|
R,
|
|
143
150
|
{
|
|
144
|
-
secondaryContent:
|
|
145
|
-
media: /* @__PURE__ */
|
|
146
|
-
value:
|
|
147
|
-
children:
|
|
151
|
+
secondaryContent: t.secondaryContent || "",
|
|
152
|
+
media: /* @__PURE__ */ o(ge, { shape: "square", "aria-hidden": !0, name: t.text, color: "colorful" }),
|
|
153
|
+
value: t.key,
|
|
154
|
+
children: t.text
|
|
148
155
|
},
|
|
149
|
-
|
|
156
|
+
t.key
|
|
150
157
|
) : (
|
|
151
158
|
// Si no se encuentra la opción, renderiza una versión básica con solo la clave.
|
|
152
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ o(R, { value: e, children: e }, e)
|
|
153
160
|
);
|
|
154
|
-
}, [
|
|
161
|
+
}, [c]),
|
|
155
162
|
// Dependencia: se recrea si 'availableOptions' cambia.
|
|
156
163
|
/**
|
|
157
164
|
* Función de filtrado para determinar qué opciones mostrar.
|
|
@@ -159,58 +166,60 @@ const ye = se({
|
|
|
159
166
|
* @returns {boolean} - True si la opción debe mostrarse, false si no.
|
|
160
167
|
*/
|
|
161
168
|
filter: u((e) => {
|
|
162
|
-
const
|
|
163
|
-
return
|
|
164
|
-
}, [
|
|
169
|
+
const t = c.find((n) => n.key === e);
|
|
170
|
+
return t ? !d.includes(e) && t.text.toLowerCase().includes(a.toLowerCase()) : !1;
|
|
171
|
+
}, [c, d, a])
|
|
165
172
|
});
|
|
166
|
-
if (
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
if (Y) return null;
|
|
174
|
+
const ce = he(
|
|
175
|
+
J,
|
|
176
|
+
_.efwTagPickerControl,
|
|
177
|
+
z === "error" && _.efwTagPickerControlError
|
|
171
178
|
);
|
|
172
|
-
return
|
|
173
|
-
|
|
179
|
+
return T(() => {
|
|
180
|
+
i || N(I);
|
|
181
|
+
}, [i, I]), /* @__PURE__ */ o(pe, { children: H ? /* @__PURE__ */ F(
|
|
182
|
+
be,
|
|
174
183
|
{
|
|
175
|
-
open:
|
|
176
|
-
size:
|
|
177
|
-
disabled:
|
|
178
|
-
onOptionSelect:
|
|
179
|
-
onOpenChange:
|
|
180
|
-
selectedOptions:
|
|
181
|
-
noPopover:
|
|
184
|
+
open: h,
|
|
185
|
+
size: X,
|
|
186
|
+
disabled: M,
|
|
187
|
+
onOptionSelect: se,
|
|
188
|
+
onOpenChange: le,
|
|
189
|
+
selectedOptions: d,
|
|
190
|
+
noPopover: U,
|
|
182
191
|
children: [
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
|
|
192
|
+
/* @__PURE__ */ F(
|
|
193
|
+
Oe,
|
|
185
194
|
{
|
|
186
|
-
className:
|
|
187
|
-
secondaryAction: !
|
|
188
|
-
|
|
195
|
+
className: ce,
|
|
196
|
+
secondaryAction: !M && d.length ? /* @__PURE__ */ o(
|
|
197
|
+
ye,
|
|
189
198
|
{
|
|
190
199
|
appearance: "transparent",
|
|
191
200
|
size: "small",
|
|
192
201
|
shape: "rounded",
|
|
193
|
-
onClick:
|
|
194
|
-
icon: /* @__PURE__ */
|
|
202
|
+
onClick: ae,
|
|
203
|
+
icon: /* @__PURE__ */ o(ve, {}),
|
|
195
204
|
iconPosition: "before"
|
|
196
205
|
}
|
|
197
206
|
) : void 0,
|
|
198
207
|
children: [
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
|
|
208
|
+
/* @__PURE__ */ o(Ce, { "aria-label": "Selected items", children: d.map((e) => /* @__PURE__ */ o(
|
|
209
|
+
Se,
|
|
201
210
|
{
|
|
202
211
|
style: { paddingTop: "0px", paddingBottom: "0px" },
|
|
203
|
-
shape:
|
|
204
|
-
appearance:
|
|
212
|
+
shape: Z,
|
|
213
|
+
appearance: $,
|
|
205
214
|
value: e,
|
|
206
|
-
children:
|
|
215
|
+
children: re(e)
|
|
207
216
|
},
|
|
208
217
|
e
|
|
209
218
|
)) }),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
|
|
219
|
+
/* @__PURE__ */ o(
|
|
220
|
+
ke,
|
|
212
221
|
{
|
|
213
|
-
placeholder:
|
|
222
|
+
placeholder: d.length ? "" : Q,
|
|
214
223
|
autoComplete: "off",
|
|
215
224
|
"aria-label": "Select items",
|
|
216
225
|
value: a,
|
|
@@ -220,11 +229,11 @@ const ye = se({
|
|
|
220
229
|
]
|
|
221
230
|
}
|
|
222
231
|
),
|
|
223
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ o(Te, { children: ie })
|
|
224
233
|
]
|
|
225
234
|
}
|
|
226
|
-
) : /* @__PURE__ */
|
|
235
|
+
) : /* @__PURE__ */ o(xe, { style: l.length ? void 0 : { opacity: 0.7 }, children: l.length ? l.map((e) => e.text).join(", ") : "Sin datos disponibles" }) });
|
|
227
236
|
};
|
|
228
237
|
export {
|
|
229
|
-
|
|
238
|
+
Me as EFWTagPicker
|
|
230
239
|
};
|
|
@@ -122,10 +122,15 @@ export interface EFWTagPickerProps extends EFWFieldChildrenProps {
|
|
|
122
122
|
*/
|
|
123
123
|
options: EFWTagPickerOption[] | AsyncOptionsLoader;
|
|
124
124
|
/**
|
|
125
|
-
* Array de opciones actualmente seleccionadas
|
|
126
|
-
*
|
|
125
|
+
* Array de opciones actualmente seleccionadas. Cuando esta prop está presente,
|
|
126
|
+
* el componente funciona en modo controlled y se espera que los cambios se sincronicen desde el padre.
|
|
127
127
|
*/
|
|
128
128
|
selectedOptions?: EFWTagPickerOption[];
|
|
129
|
+
/**
|
|
130
|
+
* Selección inicial utilizada en modo uncontrolled. Solo se aplica durante el montaje
|
|
131
|
+
* y permite que el componente administre su propio estado si no se proporciona `selectedOptions`.
|
|
132
|
+
*/
|
|
133
|
+
defaultSelectedOptions?: EFWTagPickerOption[];
|
|
129
134
|
/** Función callback ejecutada cuando cambian las opciones seleccionadas */
|
|
130
135
|
onChange?: EFWTagPickerOnChange;
|
|
131
136
|
/** Función para transformar o procesar las opciones antes de renderizarlas */
|
|
@@ -1,72 +1,74 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { EFWField as
|
|
3
|
-
import { EFWTagPicker as
|
|
4
|
-
const
|
|
2
|
+
import { EFWField as L } from "../EFWField/EFWField.js";
|
|
3
|
+
import { EFWTagPicker as O } from "../EFWTagPicker/EFWTagPicker.js";
|
|
4
|
+
const q = (n) => {
|
|
5
5
|
const {
|
|
6
6
|
title: i,
|
|
7
7
|
// description,
|
|
8
8
|
infoLabel: o,
|
|
9
9
|
hint: t,
|
|
10
10
|
style: l = {},
|
|
11
|
-
required:
|
|
12
|
-
placeholder:
|
|
11
|
+
required: d = !1,
|
|
12
|
+
placeholder: r = "Selecciona una opción",
|
|
13
13
|
noMatchesMessage: s = "No se encontraron coincidencias",
|
|
14
14
|
loadingMessage: c = "Buscando información...",
|
|
15
15
|
validationState: g = "none",
|
|
16
16
|
validationMessage: h = "",
|
|
17
17
|
minQueryLength: p = 0,
|
|
18
|
-
options:
|
|
19
|
-
selectedOptions:
|
|
18
|
+
options: f = [],
|
|
19
|
+
selectedOptions: m,
|
|
20
|
+
defaultSelectedOptions: u,
|
|
20
21
|
editable: e = !0,
|
|
21
|
-
disabled:
|
|
22
|
-
hidden:
|
|
23
|
-
noPopover:
|
|
24
|
-
multiple:
|
|
22
|
+
disabled: b = !1,
|
|
23
|
+
hidden: F = !1,
|
|
24
|
+
noPopover: C = !1,
|
|
25
|
+
multiple: S = !1,
|
|
25
26
|
tagSize: E = "medium",
|
|
26
27
|
tagShape: M = "rounded",
|
|
27
28
|
tagAppearance: P = "brand",
|
|
28
|
-
onChange:
|
|
29
|
-
beforeRenderOptions:
|
|
30
|
-
onValidationChange:
|
|
29
|
+
onChange: W,
|
|
30
|
+
beforeRenderOptions: _,
|
|
31
|
+
onValidationChange: k
|
|
31
32
|
} = n;
|
|
32
33
|
return /* @__PURE__ */ a(
|
|
33
|
-
|
|
34
|
+
L,
|
|
34
35
|
{
|
|
35
36
|
hint: t,
|
|
36
37
|
style: l,
|
|
37
38
|
title: i,
|
|
38
39
|
infoLabel: o,
|
|
39
40
|
weightLabel: e ? "regular" : "semibold",
|
|
40
|
-
required:
|
|
41
|
+
required: d,
|
|
41
42
|
validationState: g,
|
|
42
43
|
validationMessage: h,
|
|
43
|
-
onValidationChange:
|
|
44
|
-
hidden:
|
|
44
|
+
onValidationChange: k,
|
|
45
|
+
hidden: F,
|
|
45
46
|
children: /* @__PURE__ */ a(
|
|
46
|
-
|
|
47
|
+
O,
|
|
47
48
|
{
|
|
48
49
|
editable: e,
|
|
49
50
|
noMatchesMessage: s,
|
|
50
51
|
loadingMessage: c,
|
|
51
|
-
placeholder:
|
|
52
|
-
selectedOptions:
|
|
52
|
+
placeholder: r,
|
|
53
|
+
selectedOptions: m,
|
|
54
|
+
defaultSelectedOptions: u,
|
|
53
55
|
minQueryLength: p,
|
|
54
|
-
options:
|
|
55
|
-
onChange: (
|
|
56
|
-
|
|
56
|
+
options: f,
|
|
57
|
+
onChange: (v = []) => {
|
|
58
|
+
W?.(v, "[EFWTagPickerField]: __handleChange__");
|
|
57
59
|
},
|
|
58
|
-
beforeRenderOptions:
|
|
59
|
-
disabled:
|
|
60
|
-
noPopover:
|
|
60
|
+
beforeRenderOptions: _,
|
|
61
|
+
disabled: b,
|
|
62
|
+
noPopover: C,
|
|
61
63
|
tagSize: E,
|
|
62
64
|
tagShape: M,
|
|
63
65
|
tagAppearance: P,
|
|
64
|
-
multiple:
|
|
66
|
+
multiple: S
|
|
65
67
|
}
|
|
66
68
|
)
|
|
67
69
|
}
|
|
68
70
|
);
|
|
69
71
|
};
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
q as EFWTagPickerField
|
|
72
74
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { makeStyles as
|
|
3
|
-
import { useId as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as m, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles as L, tokens as l, mergeClasses as $, Textarea as U, Text as W } from "@fluentui/react-components";
|
|
3
|
+
import { useId as _, useRef as z, useState as q, useCallback as s, useEffect as h, useLayoutEffect as G } from "react";
|
|
4
|
+
const J = L({
|
|
5
5
|
efwTextArea: {
|
|
6
6
|
"& textarea": {
|
|
7
7
|
maxHeight: "none",
|
|
@@ -29,75 +29,77 @@ const $ = B({
|
|
|
29
29
|
// borderBottom: "2px solid var(--colorPaletteRedBorder2) !important"
|
|
30
30
|
// }
|
|
31
31
|
}
|
|
32
|
-
}),
|
|
32
|
+
}), x = (i) => i ?? "", X = (i) => {
|
|
33
33
|
const {
|
|
34
|
-
value:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
value: u,
|
|
35
|
+
defaultValue: p,
|
|
36
|
+
onKeyDown: C,
|
|
37
|
+
onChange: y,
|
|
38
|
+
editable: S = !0,
|
|
39
|
+
disabled: N = !1,
|
|
40
|
+
autoComplete: A = "off",
|
|
41
|
+
className: E = "",
|
|
42
|
+
placeholder: D,
|
|
42
43
|
maxLength: c = 250,
|
|
43
|
-
size:
|
|
44
|
-
validationState:
|
|
45
|
-
setParentComponentState:
|
|
46
|
-
autoResize:
|
|
44
|
+
size: H,
|
|
45
|
+
validationState: I = "none",
|
|
46
|
+
setParentComponentState: d,
|
|
47
|
+
autoResize: f = !0
|
|
47
48
|
// Nuevo prop con valor por defecto true
|
|
48
|
-
} =
|
|
49
|
-
if (!
|
|
50
|
-
const e =
|
|
49
|
+
} = i, t = u !== void 0, R = x(t ? u : p), r = x(p), k = J(), v = _(), g = z(null), [B, V] = q(R), b = z(!1), o = t ? x(u) : B, T = s(() => {
|
|
50
|
+
if (!f || !g.current) return;
|
|
51
|
+
const e = g.current;
|
|
51
52
|
e.style.height = "auto", e.style.height = `${e.scrollHeight}px`;
|
|
52
|
-
}, [
|
|
53
|
-
e.length > c ?
|
|
54
|
-
}, [c,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
}, [f]), a = s((e) => {
|
|
54
|
+
e.length > c ? d?.("error", `Por favor introduzca menos de ${c} caracteres.`) : d?.("none", "");
|
|
55
|
+
}, [c, d]);
|
|
56
|
+
h(() => {
|
|
57
|
+
t && a(o);
|
|
58
|
+
}, [t, o, a]), h(() => {
|
|
59
|
+
t || b.current || (b.current = !0, a(o));
|
|
60
|
+
}, [t, o, a]), G(() => {
|
|
61
|
+
T();
|
|
62
|
+
}, [o, T]);
|
|
63
|
+
const F = s((e, w) => {
|
|
64
|
+
if (typeof w.value == "string") {
|
|
65
|
+
const n = w.value ?? "";
|
|
66
|
+
a(n), t || V(n), y?.(n, n);
|
|
59
67
|
}
|
|
60
|
-
}, [
|
|
61
|
-
C();
|
|
62
|
-
}, [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
n(a), p(a), d.current = a, r?.(a, a);
|
|
67
|
-
}
|
|
68
|
-
}, [n, r]), E = s((e) => {
|
|
69
|
-
g?.(e, t);
|
|
70
|
-
}, [g, t]), R = D(
|
|
71
|
-
S,
|
|
72
|
-
h.efwTextArea,
|
|
73
|
-
z === "error" && h.efwTextAreaError
|
|
68
|
+
}, [a, t, y]), K = s((e) => {
|
|
69
|
+
C?.(e, o);
|
|
70
|
+
}, [C, o]), P = $(
|
|
71
|
+
E,
|
|
72
|
+
k.efwTextArea,
|
|
73
|
+
I === "error" && k.efwTextAreaError
|
|
74
74
|
);
|
|
75
|
-
return
|
|
76
|
-
|
|
75
|
+
return h(() => {
|
|
76
|
+
t || (V((e) => e === r ? e : r), a(r));
|
|
77
|
+
}, [t, r, a]), /* @__PURE__ */ m(j, { children: S ? /* @__PURE__ */ m(
|
|
78
|
+
U,
|
|
77
79
|
{
|
|
78
|
-
ref:
|
|
79
|
-
className:
|
|
80
|
-
id:
|
|
81
|
-
name:
|
|
82
|
-
placeholder:
|
|
83
|
-
disabled:
|
|
84
|
-
value:
|
|
85
|
-
autoComplete:
|
|
80
|
+
ref: g,
|
|
81
|
+
className: P,
|
|
82
|
+
id: v,
|
|
83
|
+
name: v,
|
|
84
|
+
placeholder: D,
|
|
85
|
+
disabled: N,
|
|
86
|
+
value: o,
|
|
87
|
+
autoComplete: A,
|
|
86
88
|
autoCorrect: "off",
|
|
87
89
|
autoCapitalize: "off",
|
|
88
90
|
spellCheck: "false",
|
|
89
|
-
onChange:
|
|
90
|
-
onKeyDown:
|
|
91
|
-
size:
|
|
91
|
+
onChange: F,
|
|
92
|
+
onKeyDown: K,
|
|
93
|
+
size: H,
|
|
92
94
|
style: {
|
|
93
|
-
resize:
|
|
95
|
+
resize: f ? "none" : "vertical",
|
|
94
96
|
overflow: "hidden",
|
|
95
97
|
minHeight: "40px"
|
|
96
98
|
// Altura mínima para mantener usabilidad
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
|
-
) : /* @__PURE__ */
|
|
101
|
+
) : /* @__PURE__ */ m(W, { style: o ? void 0 : { opacity: 0.7 }, children: o || "Sin datos disponibles" }) });
|
|
100
102
|
};
|
|
101
103
|
export {
|
|
102
|
-
|
|
104
|
+
X as EFWTextArea
|
|
103
105
|
};
|
|
@@ -22,10 +22,14 @@ export interface EFWTextAreaProps extends Partial<EFWFieldChildrenProps> {
|
|
|
22
22
|
*/
|
|
23
23
|
autoComplete?: 'on' | 'off';
|
|
24
24
|
/**
|
|
25
|
-
* Valor
|
|
26
|
-
* @default ""
|
|
25
|
+
* Valor controlado del textarea. Si se proporciona, el componente opera en modo controlled.
|
|
27
26
|
*/
|
|
28
27
|
value?: EFWTextAreaValue;
|
|
28
|
+
/**
|
|
29
|
+
* Valor inicial usado cuando el componente funciona en modo uncontrolled.
|
|
30
|
+
* Solo se aplica durante el montaje.
|
|
31
|
+
*/
|
|
32
|
+
defaultValue?: EFWTextAreaValue;
|
|
29
33
|
/**
|
|
30
34
|
* Tamaño visual del textarea
|
|
31
35
|
*/
|