@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,183 +1,198 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { makeStyles as
|
|
3
|
-
import { useId as
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
1
|
+
import { jsx as j, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles as ce, tokens as C, mergeClasses as de, Input as fe, Text as me } from "@fluentui/react-components";
|
|
3
|
+
import { useId as pe, useMemo as S, useCallback as k, useState as A, useRef as ge, useEffect as L } from "react";
|
|
4
|
+
import { stripFormatting as D, applyFormatting as p, isValidNumber as Q } from "./EFWNumberInput.utils.js";
|
|
5
|
+
const be = ce({
|
|
6
6
|
EFWNumberInputError: {
|
|
7
|
-
backgroundColor:
|
|
7
|
+
backgroundColor: C.colorPaletteRedBackground1,
|
|
8
8
|
"::after": {
|
|
9
|
-
borderBottomColor:
|
|
9
|
+
borderBottomColor: C.colorPaletteRedBorder2,
|
|
10
10
|
borderBottomStyle: "solid",
|
|
11
11
|
borderBottomWidth: "2px"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
EFWNumberInput: {
|
|
15
15
|
"& [disabled]": {
|
|
16
|
-
backgroundColor:
|
|
17
|
-
color:
|
|
16
|
+
backgroundColor: C.colorNeutralBackground3,
|
|
17
|
+
color: C.colorNeutralForeground2,
|
|
18
18
|
"&::placeholder": {
|
|
19
19
|
color: "transparent"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"&:has(span + [disabled])": {
|
|
23
|
-
backgroundColor:
|
|
23
|
+
backgroundColor: C.colorNeutralBackground3
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
}),
|
|
26
|
+
}), Ve = () => {
|
|
27
27
|
const i = /* @__PURE__ */ new Map();
|
|
28
|
-
return (
|
|
29
|
-
const
|
|
30
|
-
if (!i.has(
|
|
31
|
-
const
|
|
32
|
-
i.set(
|
|
33
|
-
validation: new RegExp(`^-?[\\d${
|
|
34
|
-
thousandSeparator: new RegExp(`^\\d+${
|
|
28
|
+
return (o, V) => {
|
|
29
|
+
const a = `${o}-${V}`;
|
|
30
|
+
if (!i.has(a)) {
|
|
31
|
+
const w = o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), h = V.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
32
|
+
i.set(a, {
|
|
33
|
+
validation: new RegExp(`^-?[\\d${w}]*${h}?\\d*$`),
|
|
34
|
+
thousandSeparator: new RegExp(`^\\d+${w}0{1,2}$`),
|
|
35
35
|
progressPatterns: [
|
|
36
36
|
new RegExp("^-?$"),
|
|
37
|
-
new RegExp(`^-?\\d+${
|
|
38
|
-
new RegExp(`^-?\\d+${
|
|
39
|
-
new RegExp(`^-?[\\d${
|
|
40
|
-
new RegExp(`^-?[\\d${
|
|
37
|
+
new RegExp(`^-?\\d+${h}$`),
|
|
38
|
+
new RegExp(`^-?\\d+${h}0+$`),
|
|
39
|
+
new RegExp(`^-?[\\d${w}]+${h}$`),
|
|
40
|
+
new RegExp(`^-?[\\d${w}]+${h}0+$`)
|
|
41
41
|
]
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
return i.get(
|
|
44
|
+
return i.get(a);
|
|
45
45
|
};
|
|
46
|
-
},
|
|
46
|
+
}, he = Ve(), X = (i, o) => o.some((V) => V.test(i)), Ee = (i, o) => i.includes(o) && (i.endsWith("0") || i.endsWith(o) || /\.\d*0$/.test(i.replace(o, "."))), ye = (i) => {
|
|
47
47
|
const {
|
|
48
|
-
value:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
value: o,
|
|
49
|
+
defaultValue: V,
|
|
50
|
+
onChange: a,
|
|
51
|
+
editable: w = !0,
|
|
52
|
+
disabled: h = !1,
|
|
53
|
+
className: Y = "",
|
|
54
|
+
autoComplete: Z = "off",
|
|
55
|
+
placeholder: ee,
|
|
56
|
+
contentBefore: re,
|
|
57
|
+
contentAfter: te,
|
|
58
|
+
formatType: t = "number",
|
|
59
|
+
maxValue: R,
|
|
60
|
+
minValue: F,
|
|
61
|
+
validationState: ne = "none",
|
|
61
62
|
setParentComponentState: d,
|
|
62
|
-
enableFormatting:
|
|
63
|
-
thousandSeparator:
|
|
63
|
+
enableFormatting: H = !0,
|
|
64
|
+
thousandSeparator: N = ",",
|
|
64
65
|
decimalSeparator: f = "."
|
|
65
|
-
} = i,
|
|
66
|
-
enableFormatting:
|
|
67
|
-
thousandSeparator:
|
|
66
|
+
} = i, I = V ?? null, O = be(), U = pe(), x = o !== void 0, P = x ? o ?? null : V ?? null, n = S(() => ({
|
|
67
|
+
enableFormatting: H,
|
|
68
|
+
thousandSeparator: N,
|
|
68
69
|
decimalSeparator: f
|
|
69
|
-
}), [
|
|
70
|
-
|
|
70
|
+
}), [H, N, f]), $ = k((r) => r === null ? "" : D(r.toString(), t, n), [t, n]), B = S(() => $(P), [$, P]), y = S(
|
|
71
|
+
() => $(I),
|
|
72
|
+
[$, I]
|
|
73
|
+
), _ = S(
|
|
74
|
+
() => y ? p(y, t, n) : "",
|
|
75
|
+
[y, t, n]
|
|
76
|
+
), [c, g] = A(() => B ? p(B, t, n) : ""), [W, v] = A(!1), [b, q] = A(!1), l = ge({
|
|
77
|
+
prevValue: P,
|
|
71
78
|
lastValidatedValue: "",
|
|
72
|
-
rawValue:
|
|
73
|
-
}),
|
|
74
|
-
if (
|
|
75
|
-
return
|
|
76
|
-
if (
|
|
79
|
+
rawValue: B
|
|
80
|
+
}), E = he(N, f), T = k((r) => {
|
|
81
|
+
if (l.current.lastValidatedValue === r)
|
|
82
|
+
return W;
|
|
83
|
+
if (l.current.lastValidatedValue = r, t !== "number" || r.length === 0)
|
|
77
84
|
return d?.("none", ""), !1;
|
|
78
|
-
if (!
|
|
85
|
+
if (!E.validation.test(r))
|
|
79
86
|
return d?.("error", "El valor ingresado no es un número válido."), !0;
|
|
80
|
-
const s =
|
|
81
|
-
if (
|
|
87
|
+
const s = D(r, t, n);
|
|
88
|
+
if (X(r, E.progressPatterns))
|
|
82
89
|
return d?.("none", ""), !1;
|
|
83
|
-
if (s && !
|
|
90
|
+
if (s && !Q(s))
|
|
84
91
|
return d?.("error", "El valor ingresado no es un número válido."), !0;
|
|
85
92
|
if (s) {
|
|
86
93
|
const e = Number(s);
|
|
87
|
-
if (
|
|
88
|
-
return d?.("error", `El valor debe ser mayor o igual a ${p(
|
|
89
|
-
if (
|
|
90
|
-
return d?.("error", `El valor debe ser menor o igual a ${p(
|
|
94
|
+
if (F !== void 0 && e < F)
|
|
95
|
+
return d?.("error", `El valor debe ser mayor o igual a ${p(F.toString(), "number", n)}.`), !0;
|
|
96
|
+
if (R !== void 0 && e > R)
|
|
97
|
+
return d?.("error", `El valor debe ser menor o igual a ${p(R.toString(), "number", n)}.`), !0;
|
|
91
98
|
}
|
|
92
99
|
return d?.("none", ""), !1;
|
|
93
|
-
}, [
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
|
|
100
|
+
}, [t, E, d, F, R, n, W]);
|
|
101
|
+
L(() => {
|
|
102
|
+
if (x && o !== l.current.prevValue && !b) {
|
|
103
|
+
const r = $(o ?? null), s = r ? p(r, t, n) : "";
|
|
104
|
+
l.current.rawValue = r, l.current.prevValue = o ?? null, g(s), v(!1);
|
|
98
105
|
}
|
|
99
|
-
}, [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
}, [o, t, n, b, x, $]), L(() => {
|
|
107
|
+
x || b || (l.current.rawValue = y, l.current.prevValue = I, g(_), v(!1));
|
|
108
|
+
}, [
|
|
109
|
+
x,
|
|
110
|
+
b,
|
|
111
|
+
y,
|
|
112
|
+
_,
|
|
113
|
+
I
|
|
114
|
+
]);
|
|
115
|
+
const ae = k(() => {
|
|
116
|
+
if (t !== "number" || !b) return;
|
|
117
|
+
q(!1);
|
|
118
|
+
let r = c;
|
|
119
|
+
if (r.endsWith(f) && (r = r.slice(0, -1)), r.includes(f)) {
|
|
120
|
+
const [e, z] = r.split(f);
|
|
121
|
+
z && /^0+$/.test(z) && (r = e);
|
|
107
122
|
}
|
|
108
|
-
const s =
|
|
109
|
-
if (s &&
|
|
110
|
-
const e = p(s,
|
|
111
|
-
|
|
112
|
-
} else (c === "" || c === "-") && (
|
|
113
|
-
}, [c,
|
|
123
|
+
const s = D(r, t, n);
|
|
124
|
+
if (s && Q(s)) {
|
|
125
|
+
const e = p(s, t, n);
|
|
126
|
+
l.current.rawValue = s, g(e), v(!1), a?.(Number(s), e);
|
|
127
|
+
} else (c === "" || c === "-") && (l.current.rawValue = "", g(""), v(!1), a?.(null, ""));
|
|
128
|
+
}, [c, t, n, a, f, b]), oe = k((r, s) => {
|
|
114
129
|
if (typeof s.value != "string") return;
|
|
115
130
|
const e = s.value;
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
|
|
131
|
+
if (b || q(!0), g(e), e.length < c.length && c.startsWith(e) && E.thousandSeparator.test(e)) {
|
|
132
|
+
const u = e.replace(new RegExp(N.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), ""), M = p(u, t, n), K = T(M);
|
|
133
|
+
l.current.rawValue = u, g(M), v(K), a?.(K || !u ? null : Number(u), M);
|
|
119
134
|
return;
|
|
120
135
|
}
|
|
121
|
-
const m =
|
|
122
|
-
if (
|
|
123
|
-
if (m &&
|
|
124
|
-
if (
|
|
125
|
-
|
|
136
|
+
const m = D(e, t, n), G = T(e), J = Ee(e, f), ue = X(e, E.progressPatterns);
|
|
137
|
+
if (l.current.rawValue = m, v(G), G)
|
|
138
|
+
if (m && E.validation.test(e))
|
|
139
|
+
if (J)
|
|
140
|
+
a?.(Number(m), e);
|
|
126
141
|
else {
|
|
127
|
-
const
|
|
128
|
-
|
|
142
|
+
const u = p(m, t, n);
|
|
143
|
+
g(u), a?.(Number(m), u);
|
|
129
144
|
}
|
|
130
145
|
else
|
|
131
|
-
|
|
146
|
+
a?.(null, e);
|
|
132
147
|
else if (m)
|
|
133
|
-
if (
|
|
134
|
-
|
|
148
|
+
if (J)
|
|
149
|
+
a?.(Number(m), e);
|
|
135
150
|
else {
|
|
136
|
-
const
|
|
137
|
-
|
|
151
|
+
const u = p(m, t, n);
|
|
152
|
+
g(u), a?.(Number(m), u);
|
|
138
153
|
}
|
|
139
|
-
else if (
|
|
140
|
-
const
|
|
141
|
-
|
|
154
|
+
else if (ue) {
|
|
155
|
+
const u = e.replace(/[^\d-]/g, "");
|
|
156
|
+
u && u !== "-" ? (l.current.rawValue = u, a?.(Number(u), e)) : (l.current.rawValue = "", a?.(null, e));
|
|
142
157
|
} else
|
|
143
|
-
|
|
158
|
+
l.current.rawValue = "", a?.(null, "");
|
|
144
159
|
}, [
|
|
145
160
|
c,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
161
|
+
b,
|
|
162
|
+
E,
|
|
163
|
+
N,
|
|
164
|
+
t,
|
|
165
|
+
n,
|
|
166
|
+
T,
|
|
152
167
|
f,
|
|
153
|
-
|
|
154
|
-
]),
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
168
|
+
a
|
|
169
|
+
]), le = ne === "error" || W, se = de(
|
|
170
|
+
Y,
|
|
171
|
+
O.EFWNumberInput,
|
|
172
|
+
le && O.EFWNumberInputError
|
|
158
173
|
);
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
-
|
|
174
|
+
return /* @__PURE__ */ j(ie, { children: w ? /* @__PURE__ */ j(
|
|
175
|
+
fe,
|
|
161
176
|
{
|
|
162
|
-
className:
|
|
163
|
-
id:
|
|
164
|
-
name:
|
|
177
|
+
className: se,
|
|
178
|
+
id: U,
|
|
179
|
+
name: U,
|
|
165
180
|
type: "text",
|
|
166
|
-
placeholder:
|
|
167
|
-
contentBefore:
|
|
168
|
-
contentAfter:
|
|
169
|
-
disabled:
|
|
181
|
+
placeholder: ee,
|
|
182
|
+
contentBefore: re,
|
|
183
|
+
contentAfter: te,
|
|
184
|
+
disabled: h,
|
|
170
185
|
value: c,
|
|
171
|
-
"data-raw-value":
|
|
172
|
-
autoComplete:
|
|
186
|
+
"data-raw-value": l.current.rawValue,
|
|
187
|
+
autoComplete: Z,
|
|
173
188
|
autoCorrect: "off",
|
|
174
189
|
autoCapitalize: "off",
|
|
175
190
|
spellCheck: "false",
|
|
176
|
-
onChange:
|
|
177
|
-
onBlur:
|
|
191
|
+
onChange: oe,
|
|
192
|
+
onBlur: ae
|
|
178
193
|
}
|
|
179
|
-
) : /* @__PURE__ */
|
|
194
|
+
) : /* @__PURE__ */ j(me, { style: c ? void 0 : { opacity: 0.7 }, children: c || "Sin datos disponibles" }) });
|
|
180
195
|
};
|
|
181
196
|
export {
|
|
182
|
-
|
|
197
|
+
ye as EFWNumberInput
|
|
183
198
|
};
|
|
@@ -71,6 +71,18 @@ export interface EFWNumberInputProps extends Partial<EFWFieldChildrenProps> {
|
|
|
71
71
|
* value={null}
|
|
72
72
|
*/
|
|
73
73
|
value?: EFWNumberInputValue;
|
|
74
|
+
/**
|
|
75
|
+
* Valor inicial usado cuando el componente opera en modo uncontrolled.
|
|
76
|
+
* Solo se toma en cuenta durante el montaje o cuando cambia explícitamente
|
|
77
|
+
* mientras no se haya definido `value`.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* defaultValue={25000}
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* defaultValue={null}
|
|
84
|
+
*/
|
|
85
|
+
defaultValue?: EFWNumberInputValue;
|
|
74
86
|
formatType?: FormatType;
|
|
75
87
|
/**
|
|
76
88
|
* Controla si el usuario puede editar el contenido del campo.
|
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { EFWField as
|
|
3
|
-
import { EFWNumberInput as
|
|
4
|
-
const
|
|
2
|
+
import { EFWField as I } from "../EFWField/EFWField.js";
|
|
3
|
+
import { EFWNumberInput as L } from "../EFWNumberInput/EFWNumberInput.js";
|
|
4
|
+
const y = (t) => {
|
|
5
5
|
const {
|
|
6
6
|
title: n,
|
|
7
|
-
infoLabel:
|
|
8
|
-
hint:
|
|
7
|
+
infoLabel: l,
|
|
8
|
+
hint: o,
|
|
9
9
|
style: r = {},
|
|
10
10
|
required: i = !1,
|
|
11
11
|
contentBefore: d,
|
|
12
|
-
contentAfter:
|
|
13
|
-
minValue:
|
|
14
|
-
maxValue:
|
|
15
|
-
validationState:
|
|
12
|
+
contentAfter: u,
|
|
13
|
+
minValue: h,
|
|
14
|
+
maxValue: m,
|
|
15
|
+
validationState: s,
|
|
16
16
|
validationMessage: f,
|
|
17
17
|
value: p,
|
|
18
|
+
defaultValue: c,
|
|
18
19
|
editable: e = !0,
|
|
19
|
-
disabled:
|
|
20
|
-
hidden:
|
|
21
|
-
onChange:
|
|
22
|
-
autoComplete:
|
|
23
|
-
placeholder:
|
|
20
|
+
disabled: g = !1,
|
|
21
|
+
hidden: b = !1,
|
|
22
|
+
onChange: C,
|
|
23
|
+
autoComplete: F = "off",
|
|
24
|
+
placeholder: V,
|
|
24
25
|
thousandSeparator: v,
|
|
25
26
|
decimalSeparator: x,
|
|
26
27
|
onValidationChange: E
|
|
27
28
|
} = t;
|
|
28
29
|
return /* @__PURE__ */ a(
|
|
29
|
-
|
|
30
|
+
I,
|
|
30
31
|
{
|
|
31
32
|
style: r,
|
|
32
33
|
title: n,
|
|
33
|
-
infoLabel:
|
|
34
|
+
infoLabel: l,
|
|
34
35
|
weightLabel: e ? "regular" : "semibold",
|
|
35
|
-
hint:
|
|
36
|
+
hint: o,
|
|
36
37
|
required: i,
|
|
37
|
-
validationState:
|
|
38
|
+
validationState: s,
|
|
38
39
|
validationMessage: f,
|
|
39
40
|
onValidationChange: E,
|
|
40
|
-
hidden:
|
|
41
|
+
hidden: b,
|
|
41
42
|
children: /* @__PURE__ */ a(
|
|
42
|
-
|
|
43
|
+
L,
|
|
43
44
|
{
|
|
44
45
|
value: p,
|
|
46
|
+
defaultValue: c,
|
|
45
47
|
editable: e,
|
|
46
|
-
onChange: (S,
|
|
47
|
-
|
|
48
|
+
onChange: (S, W) => {
|
|
49
|
+
C?.(S, W);
|
|
48
50
|
},
|
|
49
|
-
disabled:
|
|
50
|
-
autoComplete:
|
|
51
|
-
placeholder:
|
|
51
|
+
disabled: g,
|
|
52
|
+
autoComplete: F,
|
|
53
|
+
placeholder: V,
|
|
52
54
|
contentBefore: d,
|
|
53
|
-
contentAfter:
|
|
54
|
-
minValue:
|
|
55
|
-
maxValue:
|
|
55
|
+
contentAfter: u,
|
|
56
|
+
minValue: h,
|
|
57
|
+
maxValue: m,
|
|
56
58
|
thousandSeparator: v,
|
|
57
59
|
decimalSeparator: x
|
|
58
60
|
}
|
|
@@ -61,5 +63,5 @@ const w = (t) => {
|
|
|
61
63
|
);
|
|
62
64
|
};
|
|
63
65
|
export {
|
|
64
|
-
|
|
66
|
+
y as EFWNumberInputField
|
|
65
67
|
};
|
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { makeStyles as
|
|
3
|
-
import { useId as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as r, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles as y, tokens as c, mergeClasses as T, Switch as v, Text as F } from "@fluentui/react-components";
|
|
3
|
+
import { useId as V, useState as _, useEffect as I, useCallback as B } from "react";
|
|
4
|
+
const E = y({
|
|
5
5
|
efwSwitch: {
|
|
6
6
|
"& [disabled]": {
|
|
7
7
|
"&~ .fui-Switch__indicator": {
|
|
8
|
-
backgroundColor:
|
|
9
|
-
color:
|
|
8
|
+
backgroundColor: c.colorNeutralBackground3,
|
|
9
|
+
color: c.colorNeutralForeground4
|
|
10
10
|
},
|
|
11
11
|
"&~ .fui-Switch__label": {
|
|
12
|
-
color:
|
|
12
|
+
color: c.colorNeutralForeground2
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
// Afectar el span que contiene el input disabled
|
|
16
16
|
"& :has(span + [disabled])": {
|
|
17
|
-
backgroundColor:
|
|
17
|
+
backgroundColor: c.colorNeutralBackground3
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
}),
|
|
20
|
+
}), U = (f) => {
|
|
21
21
|
const {
|
|
22
|
-
value:
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
value: d,
|
|
23
|
+
defaultValue: k,
|
|
24
|
+
onChange: i,
|
|
25
|
+
className: m = "",
|
|
25
26
|
editable: g = !0,
|
|
26
|
-
disabled:
|
|
27
|
-
checkedText:
|
|
28
|
-
uncheckedText:
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
disabled: C = !1,
|
|
28
|
+
checkedText: l = "Sí",
|
|
29
|
+
uncheckedText: s = "No"
|
|
30
|
+
} = f, S = E(), b = V(), o = k ?? !1, e = d !== void 0, [w, u] = _(o);
|
|
31
|
+
I(() => {
|
|
32
|
+
e || u((t) => t === o ? t : o);
|
|
33
|
+
}, [e, o]);
|
|
34
|
+
const h = e ? !!d : w, a = h ? l : s, p = B((t) => {
|
|
35
|
+
const n = t.currentTarget.checked;
|
|
36
|
+
e || u(n), i?.(n, n ? l : s);
|
|
37
|
+
}, [l, s, i, e]), N = T(
|
|
38
|
+
S.efwSwitch,
|
|
39
|
+
m
|
|
39
40
|
);
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
|
|
41
|
+
return /* @__PURE__ */ r(x, { children: g ? /* @__PURE__ */ r(
|
|
42
|
+
v,
|
|
42
43
|
{
|
|
43
|
-
className:
|
|
44
|
-
id:
|
|
45
|
-
disabled:
|
|
46
|
-
checked:
|
|
47
|
-
onChange:
|
|
48
|
-
label:
|
|
44
|
+
className: N,
|
|
45
|
+
id: b,
|
|
46
|
+
disabled: C,
|
|
47
|
+
checked: h,
|
|
48
|
+
onChange: p,
|
|
49
|
+
label: a
|
|
49
50
|
}
|
|
50
|
-
) : /* @__PURE__ */
|
|
51
|
+
) : /* @__PURE__ */ r(F, { style: a ? void 0 : { opacity: 0.7 }, children: a || "Sin datos disponibles" }) });
|
|
51
52
|
};
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
U as EFWSwitch
|
|
54
55
|
};
|
|
@@ -23,6 +23,12 @@ export interface EFWSwitchProps extends Partial<EFWFieldChildrenProps> {
|
|
|
23
23
|
* Valor inicial del switch.
|
|
24
24
|
*/
|
|
25
25
|
value?: EFWSwitchValue;
|
|
26
|
+
/**
|
|
27
|
+
* Valor por defecto utilizado cuando el componente opera en modo uncontrolled.
|
|
28
|
+
* Este valor solo se usa durante la inicialización o cuando cambia la prop
|
|
29
|
+
* `defaultValue` mientras no exista una prop `value` controlando el campo.
|
|
30
|
+
*/
|
|
31
|
+
defaultValue?: EFWSwitchValue;
|
|
26
32
|
/**
|
|
27
33
|
* Determina si el switch es editable por el usuario.
|
|
28
34
|
* @default true
|
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { EFWField as
|
|
3
|
-
import { EFWSwitch as
|
|
4
|
-
const
|
|
2
|
+
import { EFWField as x } from "../EFWField/EFWField.js";
|
|
3
|
+
import { EFWSwitch as S } from "../EFWSwitch/EFWSwitch.js";
|
|
4
|
+
const k = (t) => {
|
|
5
5
|
const {
|
|
6
6
|
title: i,
|
|
7
|
-
infoLabel:
|
|
8
|
-
hint:
|
|
7
|
+
infoLabel: l,
|
|
8
|
+
hint: n,
|
|
9
9
|
style: o = {},
|
|
10
10
|
required: d = !1,
|
|
11
11
|
validationState: h,
|
|
12
12
|
validationMessage: r,
|
|
13
|
-
value: s
|
|
13
|
+
value: s,
|
|
14
|
+
defaultValue: c,
|
|
14
15
|
editable: e = !0,
|
|
15
|
-
disabled:
|
|
16
|
-
hidden:
|
|
17
|
-
checkedText:
|
|
16
|
+
disabled: f = !1,
|
|
17
|
+
hidden: g = !1,
|
|
18
|
+
checkedText: u = "Sí",
|
|
18
19
|
uncheckedText: m = "No",
|
|
19
|
-
onChange:
|
|
20
|
-
onValidationChange:
|
|
20
|
+
onChange: b,
|
|
21
|
+
onValidationChange: C
|
|
21
22
|
} = t;
|
|
22
23
|
return /* @__PURE__ */ a(
|
|
23
|
-
|
|
24
|
+
x,
|
|
24
25
|
{
|
|
25
26
|
style: o,
|
|
26
27
|
title: i,
|
|
27
|
-
infoLabel:
|
|
28
|
+
infoLabel: l,
|
|
28
29
|
weightLabel: e ? "regular" : "semibold",
|
|
29
|
-
hint:
|
|
30
|
+
hint: n,
|
|
30
31
|
required: d,
|
|
31
32
|
validationState: h,
|
|
32
33
|
validationMessage: r,
|
|
33
|
-
onValidationChange:
|
|
34
|
-
hidden:
|
|
34
|
+
onValidationChange: C,
|
|
35
|
+
hidden: g,
|
|
35
36
|
children: /* @__PURE__ */ a(
|
|
36
|
-
|
|
37
|
+
S,
|
|
37
38
|
{
|
|
38
39
|
value: s,
|
|
40
|
+
defaultValue: c,
|
|
39
41
|
editable: e,
|
|
40
|
-
onChange: (
|
|
41
|
-
|
|
42
|
+
onChange: (F, p) => {
|
|
43
|
+
b?.(F, p);
|
|
42
44
|
},
|
|
43
|
-
disabled:
|
|
44
|
-
checkedText:
|
|
45
|
+
disabled: f,
|
|
46
|
+
checkedText: u,
|
|
45
47
|
uncheckedText: m
|
|
46
48
|
}
|
|
47
49
|
)
|
|
@@ -49,5 +51,5 @@ const W = (t) => {
|
|
|
49
51
|
);
|
|
50
52
|
};
|
|
51
53
|
export {
|
|
52
|
-
|
|
54
|
+
k as EFWSwitchField
|
|
53
55
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EFWFieldProps } from '../EFWField/EFWField.types';
|
|
2
2
|
import { EFWSwitchProps, EFWSwitchValue, EFWSwitchOnChange } from '../EFWSwitch/EFWSwitch.types';
|
|
3
3
|
|
|
4
|
-
export type EFWSwitchFieldValue = EFWSwitchValue;
|
|
4
|
+
export type EFWSwitchFieldValue = EFWSwitchValue | undefined;
|
|
5
5
|
export type EFWSwitchFieldOnChange = EFWSwitchOnChange;
|
|
6
6
|
export interface EFWSwitchFieldProps extends Omit<EFWFieldProps, 'children'>, EFWSwitchProps {
|
|
7
7
|
}
|