@pismo/marola 2.1.55 → 2.1.56
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/components/Input/Input.js +151 -145
- package/package.json +1 -1
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as M, jsx as H } from "react/jsx-runtime";
|
|
2
2
|
import * as E from "react";
|
|
3
|
-
import { forwardRef as xe, useState as we, useId as Ne, useMemo as ue } from "react";
|
|
4
|
-
import { formatDecimalValue as me, allowOnlyIntegerNumbers as
|
|
3
|
+
import { forwardRef as xe, useState as we, useId as Ne, useRef as Ce, useMemo as ue } from "react";
|
|
4
|
+
import { formatDecimalValue as me, allowOnlyIntegerNumbers as ve, allowOnlyNumbers as Pe, parseToInteger as Re } from "../../utils/inputNumberAsText.js";
|
|
5
5
|
import { c as U } from "../../clsx-OuTLNxxd.js";
|
|
6
|
-
import { Icon as
|
|
6
|
+
import { Icon as Ee } from "../Icon/Icon.js";
|
|
7
7
|
import { Typography as se } from "../Typography/Typography.js";
|
|
8
|
-
import { g as
|
|
9
|
-
import '../../assets/Input.css';function
|
|
8
|
+
import { g as Ve, a as Fe, u as Se, f as de, _ as w, b as Oe, c as _e, i as Te, d as Ie, e as Be, P as n } from "../../useSlotProps-CYHDC4TN.js";
|
|
9
|
+
import '../../assets/Input.css';function Ue(r) {
|
|
10
10
|
let u = "https://mui.com/production-error/?code=" + r;
|
|
11
11
|
for (let _ = 1; _ < arguments.length; _ += 1)
|
|
12
12
|
u += "&args[]=" + encodeURIComponent(arguments[_]);
|
|
13
13
|
return "Minified MUI error #" + r + "; visit " + u + " for the full message.";
|
|
14
14
|
}
|
|
15
15
|
const be = "Input";
|
|
16
|
-
function
|
|
17
|
-
return
|
|
16
|
+
function je(r) {
|
|
17
|
+
return Ve(be, r);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
Fe(be, ["root", "formControl", "focused", "disabled", "error", "multiline", "input", "inputMultiline", "inputTypeSearch", "adornedStart", "adornedEnd"]);
|
|
20
20
|
const ge = /* @__PURE__ */ E.createContext(void 0);
|
|
21
21
|
process.env.NODE_ENV !== "production" && (ge.displayName = "FormControlContext");
|
|
22
|
-
function
|
|
22
|
+
function Ae() {
|
|
23
23
|
return E.useContext(ge);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function ke(r = {}) {
|
|
26
26
|
const {
|
|
27
27
|
defaultValue: u,
|
|
28
28
|
disabled: _ = !1,
|
|
29
29
|
error: p = !1,
|
|
30
30
|
onBlur: b,
|
|
31
|
-
onChange:
|
|
31
|
+
onChange: h,
|
|
32
32
|
onFocus: V,
|
|
33
33
|
required: F = !1,
|
|
34
34
|
value: f,
|
|
35
35
|
inputRef: S
|
|
36
|
-
} = r, o =
|
|
37
|
-
let
|
|
36
|
+
} = r, o = Ae();
|
|
37
|
+
let y, s, N, x, C;
|
|
38
38
|
if (o) {
|
|
39
|
-
var j, i,
|
|
40
|
-
if (
|
|
39
|
+
var j, i, v;
|
|
40
|
+
if (y = void 0, s = (j = o.disabled) != null ? j : !1, N = (i = o.error) != null ? i : !1, x = (v = o.required) != null ? v : !1, C = o.value, process.env.NODE_ENV !== "production") {
|
|
41
41
|
const e = ["defaultValue", "disabled", "error", "required", "value"].filter((a) => r[a] !== void 0);
|
|
42
42
|
e.length > 0 && console.warn(["MUI: You have set props on an input that is inside a FormControl.", "Set these props on a FormControl instead. Otherwise they will be ignored.", `Ignored props: ${e.join(", ")}`].join(`
|
|
43
43
|
`));
|
|
44
44
|
}
|
|
45
45
|
} else
|
|
46
|
-
|
|
46
|
+
y = u, s = _, N = p, x = F, C = f;
|
|
47
47
|
const {
|
|
48
|
-
current:
|
|
49
|
-
} = E.useRef(C != null),
|
|
48
|
+
current: K
|
|
49
|
+
} = E.useRef(C != null), q = E.useCallback((e) => {
|
|
50
50
|
process.env.NODE_ENV !== "production" && e && e.nodeName !== "INPUT" && !e.focus && console.error(["MUI: You have provided a `slots.input` to the input component", "that does not correctly handle the `ref` prop.", "Make sure the `ref` prop is called with a HTMLInputElement."].join(`
|
|
51
51
|
`));
|
|
52
|
-
}, []), R = E.useRef(null), A =
|
|
52
|
+
}, []), R = E.useRef(null), A = Se(R, S, q), [O, T] = E.useState(!1);
|
|
53
53
|
E.useEffect(() => {
|
|
54
|
-
!o && s &&
|
|
55
|
-
}, [o, s,
|
|
56
|
-
const
|
|
54
|
+
!o && s && O && (T(!1), b == null || b());
|
|
55
|
+
}, [o, s, O, b]);
|
|
56
|
+
const D = (e) => (a) => {
|
|
57
57
|
var l;
|
|
58
58
|
if (o != null && o.disabled) {
|
|
59
59
|
a.stopPropagation();
|
|
@@ -63,15 +63,15 @@ function Ae(r = {}) {
|
|
|
63
63
|
var d;
|
|
64
64
|
o == null || (d = o.onFocus) == null || d.call(o);
|
|
65
65
|
} else
|
|
66
|
-
|
|
66
|
+
T(!0);
|
|
67
67
|
}, $ = (e) => (a) => {
|
|
68
68
|
var l;
|
|
69
|
-
(l = e.onBlur) == null || l.call(e, a), o && o.onBlur ? o.onBlur() :
|
|
69
|
+
(l = e.onBlur) == null || l.call(e, a), o && o.onBlur ? o.onBlur() : T(!1);
|
|
70
70
|
}, Y = (e) => (a, ...l) => {
|
|
71
|
-
var d,
|
|
72
|
-
if (!
|
|
73
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Expected valid input target. Did you use a custom `slots.input` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info." :
|
|
74
|
-
o == null || (d = o.onChange) == null || d.call(o, a), (
|
|
71
|
+
var d, I;
|
|
72
|
+
if (!K && (a.target || R.current) == null)
|
|
73
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Expected valid input target. Did you use a custom `slots.input` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info." : Ue(17));
|
|
74
|
+
o == null || (d = o.onChange) == null || d.call(o, a), (I = e.onChange) == null || I.call(e, a, ...l);
|
|
75
75
|
}, L = (e) => (a) => {
|
|
76
76
|
var l;
|
|
77
77
|
R.current && a.currentTarget === a.target && R.current.focus(), (l = e.onClick) == null || l.call(e, a);
|
|
@@ -79,23 +79,23 @@ function Ae(r = {}) {
|
|
|
79
79
|
return {
|
|
80
80
|
disabled: s,
|
|
81
81
|
error: N,
|
|
82
|
-
focused:
|
|
82
|
+
focused: O,
|
|
83
83
|
formControlContext: o,
|
|
84
84
|
getInputProps: (e = {}) => {
|
|
85
85
|
const l = w({}, {
|
|
86
86
|
onBlur: b,
|
|
87
|
-
onChange:
|
|
87
|
+
onChange: h,
|
|
88
88
|
onFocus: V
|
|
89
89
|
}, de(e)), d = w({}, l, {
|
|
90
90
|
onBlur: $(l),
|
|
91
91
|
onChange: Y(l),
|
|
92
|
-
onFocus:
|
|
92
|
+
onFocus: D(l)
|
|
93
93
|
});
|
|
94
94
|
return w({}, d, {
|
|
95
95
|
"aria-invalid": N || void 0,
|
|
96
|
-
defaultValue:
|
|
96
|
+
defaultValue: y,
|
|
97
97
|
value: C,
|
|
98
|
-
required:
|
|
98
|
+
required: x,
|
|
99
99
|
disabled: s
|
|
100
100
|
}, e, {
|
|
101
101
|
ref: A
|
|
@@ -108,82 +108,82 @@ function Ae(r = {}) {
|
|
|
108
108
|
});
|
|
109
109
|
},
|
|
110
110
|
inputRef: A,
|
|
111
|
-
required:
|
|
111
|
+
required: x,
|
|
112
112
|
value: C
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const Me = ["aria-describedby", "aria-label", "aria-labelledby", "autoComplete", "autoFocus", "className", "defaultValue", "disabled", "endAdornment", "error", "id", "multiline", "name", "onClick", "onChange", "onKeyDown", "onKeyUp", "onFocus", "onBlur", "placeholder", "readOnly", "required", "startAdornment", "value", "type", "rows", "slotProps", "slots", "minRows", "maxRows"], He = (r) => {
|
|
116
116
|
const {
|
|
117
117
|
disabled: u,
|
|
118
118
|
error: _,
|
|
119
119
|
focused: p,
|
|
120
120
|
formControlContext: b,
|
|
121
|
-
multiline:
|
|
121
|
+
multiline: h,
|
|
122
122
|
startAdornment: V,
|
|
123
123
|
endAdornment: F
|
|
124
124
|
} = r;
|
|
125
|
-
return
|
|
126
|
-
root: ["root", u && "disabled", _ && "error", p && "focused", !!b && "formControl",
|
|
127
|
-
input: ["input", u && "disabled",
|
|
128
|
-
},
|
|
125
|
+
return Ie({
|
|
126
|
+
root: ["root", u && "disabled", _ && "error", p && "focused", !!b && "formControl", h && "multiline", !!V && "adornedStart", !!F && "adornedEnd"],
|
|
127
|
+
input: ["input", u && "disabled", h && "multiline"]
|
|
128
|
+
}, Be(je));
|
|
129
129
|
}, he = /* @__PURE__ */ E.forwardRef(function(u, _) {
|
|
130
|
-
var p, b,
|
|
130
|
+
var p, b, h;
|
|
131
131
|
const {
|
|
132
132
|
"aria-describedby": V,
|
|
133
133
|
"aria-label": F,
|
|
134
134
|
"aria-labelledby": f,
|
|
135
135
|
autoComplete: S,
|
|
136
136
|
autoFocus: o,
|
|
137
|
-
className:
|
|
137
|
+
className: y,
|
|
138
138
|
defaultValue: s,
|
|
139
139
|
disabled: N,
|
|
140
|
-
endAdornment:
|
|
140
|
+
endAdornment: x,
|
|
141
141
|
error: C,
|
|
142
142
|
id: j,
|
|
143
143
|
multiline: i = !1,
|
|
144
|
-
name:
|
|
145
|
-
onClick:
|
|
146
|
-
onChange:
|
|
144
|
+
name: v,
|
|
145
|
+
onClick: K,
|
|
146
|
+
onChange: q,
|
|
147
147
|
onKeyDown: R,
|
|
148
148
|
onKeyUp: A,
|
|
149
|
-
onFocus:
|
|
150
|
-
onBlur:
|
|
151
|
-
placeholder:
|
|
149
|
+
onFocus: O,
|
|
150
|
+
onBlur: T,
|
|
151
|
+
placeholder: D,
|
|
152
152
|
readOnly: $,
|
|
153
153
|
required: Y,
|
|
154
154
|
startAdornment: L,
|
|
155
|
-
value:
|
|
155
|
+
value: Z,
|
|
156
156
|
type: W,
|
|
157
157
|
rows: e,
|
|
158
158
|
slotProps: a = {},
|
|
159
159
|
slots: l = {},
|
|
160
160
|
minRows: d,
|
|
161
|
-
maxRows:
|
|
162
|
-
} = u, z =
|
|
161
|
+
maxRows: I
|
|
162
|
+
} = u, z = Oe(u, Me), {
|
|
163
163
|
getRootProps: G,
|
|
164
|
-
getInputProps:
|
|
165
|
-
focused:
|
|
166
|
-
formControlContext:
|
|
164
|
+
getInputProps: J,
|
|
165
|
+
focused: ae,
|
|
166
|
+
formControlContext: ee,
|
|
167
167
|
error: re,
|
|
168
168
|
disabled: ie
|
|
169
|
-
} =
|
|
169
|
+
} = ke({
|
|
170
170
|
disabled: N,
|
|
171
171
|
defaultValue: s,
|
|
172
172
|
error: C,
|
|
173
|
-
onBlur:
|
|
174
|
-
onClick:
|
|
175
|
-
onChange:
|
|
176
|
-
onFocus:
|
|
173
|
+
onBlur: T,
|
|
174
|
+
onClick: K,
|
|
175
|
+
onChange: q,
|
|
176
|
+
onFocus: O,
|
|
177
177
|
required: Y,
|
|
178
|
-
value:
|
|
179
|
-
}),
|
|
178
|
+
value: Z
|
|
179
|
+
}), ne = i ? void 0 : W ?? "text", Q = w({}, u, {
|
|
180
180
|
disabled: ie,
|
|
181
181
|
error: re,
|
|
182
|
-
focused:
|
|
183
|
-
formControlContext:
|
|
182
|
+
focused: ae,
|
|
183
|
+
formControlContext: ee,
|
|
184
184
|
multiline: i,
|
|
185
|
-
type:
|
|
186
|
-
}),
|
|
185
|
+
type: ne
|
|
186
|
+
}), te = He(Q), oe = {
|
|
187
187
|
"aria-describedby": V,
|
|
188
188
|
"aria-label": F,
|
|
189
189
|
"aria-labelledby": f,
|
|
@@ -192,35 +192,35 @@ const ke = ["aria-describedby", "aria-label", "aria-labelledby", "autoComplete",
|
|
|
192
192
|
id: j,
|
|
193
193
|
onKeyDown: R,
|
|
194
194
|
onKeyUp: A,
|
|
195
|
-
name:
|
|
196
|
-
placeholder:
|
|
195
|
+
name: v,
|
|
196
|
+
placeholder: D,
|
|
197
197
|
readOnly: $,
|
|
198
|
-
type:
|
|
199
|
-
},
|
|
200
|
-
elementType:
|
|
198
|
+
type: ne
|
|
199
|
+
}, X = (p = l.root) != null ? p : "div", t = _e({
|
|
200
|
+
elementType: X,
|
|
201
201
|
getSlotProps: G,
|
|
202
202
|
externalSlotProps: a.root,
|
|
203
203
|
externalForwardedProps: z,
|
|
204
204
|
additionalProps: {
|
|
205
205
|
ref: _
|
|
206
206
|
},
|
|
207
|
-
ownerState:
|
|
208
|
-
className: [
|
|
209
|
-
}),
|
|
210
|
-
elementType:
|
|
211
|
-
getSlotProps: (
|
|
207
|
+
ownerState: Q,
|
|
208
|
+
className: [te.root, y]
|
|
209
|
+
}), g = i ? (b = l.textarea) != null ? b : "textarea" : (h = l.input) != null ? h : "input", B = _e({
|
|
210
|
+
elementType: g,
|
|
211
|
+
getSlotProps: (P) => J(w({}, oe, P)),
|
|
212
212
|
externalSlotProps: a.input,
|
|
213
213
|
additionalProps: w({
|
|
214
214
|
rows: i ? e : void 0
|
|
215
|
-
}, i && !
|
|
215
|
+
}, i && !Te(g) && {
|
|
216
216
|
minRows: e || d,
|
|
217
|
-
maxRows: e ||
|
|
217
|
+
maxRows: e || I
|
|
218
218
|
}),
|
|
219
|
-
ownerState:
|
|
220
|
-
className:
|
|
219
|
+
ownerState: Q,
|
|
220
|
+
className: te.input
|
|
221
221
|
});
|
|
222
|
-
return process.env.NODE_ENV !== "production" && i && e && (d ||
|
|
223
|
-
children: [L, /* @__PURE__ */
|
|
222
|
+
return process.env.NODE_ENV !== "production" && i && e && (d || I) && console.warn("MUI: You can not use the `minRows` or `maxRows` props when the input `rows` prop is set."), /* @__PURE__ */ M(X, w({}, t, {
|
|
223
|
+
children: [L, /* @__PURE__ */ H(g, w({}, B)), x]
|
|
224
224
|
}));
|
|
225
225
|
});
|
|
226
226
|
process.env.NODE_ENV !== "production" && (he.propTypes = {
|
|
@@ -373,11 +373,11 @@ process.env.NODE_ENV !== "production" && (he.propTypes = {
|
|
|
373
373
|
*/
|
|
374
374
|
value: n.any
|
|
375
375
|
});
|
|
376
|
-
const
|
|
376
|
+
const Ke = "_input_1cxiy_58", qe = "_input__label_1cxiy_85", m = {
|
|
377
377
|
"input__input-el": "_input__input-el_1cxiy_58",
|
|
378
|
-
input:
|
|
378
|
+
input: Ke,
|
|
379
379
|
"input__messages-wrapper": "_input__messages-wrapper_1cxiy_82",
|
|
380
|
-
input__label:
|
|
380
|
+
input__label: qe,
|
|
381
381
|
"input__input-el-wrapper": "_input__input-el-wrapper_1cxiy_90",
|
|
382
382
|
"input__left-icon": "_input__left-icon_1cxiy_115",
|
|
383
383
|
"input__right-icon": "_input__right-icon_1cxiy_115",
|
|
@@ -387,88 +387,88 @@ const Me = "_input_1cxiy_58", He = "_input__label_1cxiy_85", m = {
|
|
|
387
387
|
"input--disabled": "_input--disabled_1cxiy_157",
|
|
388
388
|
"input--focused": "_input--focused_1cxiy_163",
|
|
389
389
|
"input--error": "_input--error_1cxiy_166"
|
|
390
|
-
}
|
|
391
|
-
let ce;
|
|
392
|
-
const Ge = xe(
|
|
390
|
+
}, Je = xe(
|
|
393
391
|
({
|
|
394
392
|
label: r,
|
|
395
393
|
infoMessage: u,
|
|
396
394
|
error: _,
|
|
397
395
|
errorMessage: p,
|
|
398
396
|
leftIcon: b,
|
|
399
|
-
rightIcon:
|
|
397
|
+
rightIcon: h,
|
|
400
398
|
id: V,
|
|
401
399
|
disabled: F,
|
|
402
400
|
type: f = "text",
|
|
403
401
|
maxLength: S,
|
|
404
402
|
allowLeadingZeros: o = !1,
|
|
405
|
-
isInteger:
|
|
403
|
+
isInteger: y,
|
|
406
404
|
useCommaInDecimal: s,
|
|
407
405
|
allowNegativeNumbers: N = !1,
|
|
408
|
-
decimalLength:
|
|
406
|
+
decimalLength: x = 10,
|
|
409
407
|
hideCharsCounter: C = !1,
|
|
410
408
|
required: j,
|
|
411
409
|
onChange: i,
|
|
412
|
-
triggerDelay:
|
|
413
|
-
classNameWrapper:
|
|
414
|
-
classNameLabel:
|
|
410
|
+
triggerDelay: v,
|
|
411
|
+
classNameWrapper: K,
|
|
412
|
+
classNameLabel: q,
|
|
415
413
|
classNameInput: R,
|
|
416
414
|
classNameInfoMessage: A,
|
|
417
|
-
classNameErrorMessage:
|
|
418
|
-
classNameCharsCounter:
|
|
419
|
-
"data-testid-wrapper":
|
|
415
|
+
classNameErrorMessage: O,
|
|
416
|
+
classNameCharsCounter: T,
|
|
417
|
+
"data-testid-wrapper": D,
|
|
420
418
|
"data-testid-label": $,
|
|
421
419
|
"data-testid-input": Y,
|
|
422
420
|
"data-testid-infoMessage": L,
|
|
423
|
-
"data-testid-errorMessage":
|
|
421
|
+
"data-testid-errorMessage": Z,
|
|
424
422
|
"data-testid-charsCounter": W,
|
|
425
423
|
...e
|
|
426
424
|
}, a) => {
|
|
427
|
-
var
|
|
425
|
+
var oe, X;
|
|
428
426
|
const [l, d] = we(
|
|
429
|
-
((
|
|
430
|
-
),
|
|
427
|
+
((oe = e.value) == null ? void 0 : oe.length) || ((X = e.defaultValue) == null ? void 0 : X.length) || 0
|
|
428
|
+
), I = Ne(), z = V || `input_${I}`;
|
|
431
429
|
Object.assign(e, { "data-testid": Y });
|
|
432
|
-
const G = S && !C,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
430
|
+
const G = S && !C, J = Ce(), ae = (t) => {
|
|
431
|
+
J.current && clearTimeout(J.current), J.current = setTimeout(() => {
|
|
432
|
+
ee(t);
|
|
433
|
+
}, v);
|
|
434
|
+
}, ee = (t) => {
|
|
435
|
+
var g, B, P, ce;
|
|
436
436
|
if (f === "number-as-text") {
|
|
437
|
-
let c =
|
|
438
|
-
if (!
|
|
437
|
+
let c = y ? Re(t.target.value, o) : s ? t.target.value.replace(".", ",") : t.target.value.replace(",", ".");
|
|
438
|
+
if (!y && x > 0) {
|
|
439
439
|
const pe = String(c), [ye, fe] = pe.split(/,|\./);
|
|
440
|
-
pe !== "" && fe && (c = [ye, fe.slice(0,
|
|
440
|
+
pe !== "" && fe && (c = [ye, fe.slice(0, x)].join(s ? "," : "."));
|
|
441
441
|
}
|
|
442
442
|
t.target.value = String(c);
|
|
443
|
-
const
|
|
443
|
+
const le = !isNaN(Number(String(c).replace(",", "."))), k = String(c).length ? String(c).replace(",", ".") : "";
|
|
444
444
|
i == null || i({
|
|
445
445
|
...t,
|
|
446
446
|
target: {
|
|
447
447
|
...t.target,
|
|
448
448
|
value: k,
|
|
449
|
-
valueAsNumber:
|
|
449
|
+
valueAsNumber: le && String(c).length ? Number(String(c).replace(",", ".")) : NaN
|
|
450
450
|
}
|
|
451
|
-
}), G && d((
|
|
451
|
+
}), G && d((B = (g = t == null ? void 0 : t.target) == null ? void 0 : g.value) == null ? void 0 : B.length);
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
454
454
|
if (f === "number") {
|
|
455
455
|
let c = String(t.target.value);
|
|
456
|
-
const [
|
|
457
|
-
c !== "" && (k != null && k.length ? c = [Number(
|
|
456
|
+
const [le, k] = c.split(".");
|
|
457
|
+
c !== "" && (k != null && k.length ? c = [Number(le), k.slice(0, x)].join(".") : c = String(Number(le))), t.target.value = c;
|
|
458
458
|
}
|
|
459
|
-
G && d((
|
|
460
|
-
}, ae = (t) => {
|
|
461
|
-
var x;
|
|
462
|
-
f === "number-as-text" && (h ? Ce(t, N) : ve(t, N)), (x = e == null ? void 0 : e.onKeyDown) == null || x.call(e, t);
|
|
459
|
+
G && d((ce = (P = t == null ? void 0 : t.target) == null ? void 0 : P.value) == null ? void 0 : ce.length), i && i(t);
|
|
463
460
|
}, re = (t) => {
|
|
464
|
-
var
|
|
461
|
+
var g;
|
|
462
|
+
f === "number-as-text" && (y ? ve(t, N) : Pe(t, N)), (g = e == null ? void 0 : e.onKeyDown) == null || g.call(e, t);
|
|
463
|
+
}, ie = (t) => {
|
|
464
|
+
var g;
|
|
465
465
|
if (f === "number-as-text" && t.target.value.length) {
|
|
466
|
-
const
|
|
467
|
-
let P = String(o ?
|
|
466
|
+
const B = y ? t.target.value.replace(/(,\.)/gi, "") : t.target.value.replace(",", ".");
|
|
467
|
+
let P = String(o ? B : Number(B));
|
|
468
468
|
isNaN(Number(P)) && (P = ""), t.target.value = s ? P.replace(".", ",") : P;
|
|
469
469
|
}
|
|
470
|
-
(
|
|
471
|
-
},
|
|
470
|
+
(g = e == null ? void 0 : e.onBlur) == null || g.call(e, t);
|
|
471
|
+
}, ne = ue(() => e.multiline !== !0 ? {
|
|
472
472
|
type: f === "number-as-text" ? "text" : f,
|
|
473
473
|
multiline: e.multiline
|
|
474
474
|
} : {
|
|
@@ -477,23 +477,29 @@ const Ge = xe(
|
|
|
477
477
|
rows: (e == null ? void 0 : e.rows) || 5,
|
|
478
478
|
minRows: e == null ? void 0 : e.minRows,
|
|
479
479
|
maxRows: e == null ? void 0 : e.maxRows
|
|
480
|
-
}, [e]),
|
|
481
|
-
|
|
482
|
-
|
|
480
|
+
}, [e]), Q = ue(() => {
|
|
481
|
+
const t = v ? (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.defaultValue) : e == null ? void 0 : e.defaultValue;
|
|
482
|
+
return f === "number-as-text" && t ? me(t, s) : t;
|
|
483
|
+
}, [e.defaultValue]), te = ue(() => {
|
|
484
|
+
if (!v)
|
|
485
|
+
return f === "number-as-text" && (e != null && e.value) ? me(e == null ? void 0 : e.value, s) : e == null ? void 0 : e.value;
|
|
486
|
+
}, [e.value]);
|
|
487
|
+
return /* @__PURE__ */ M("div", { className: U(m.input, K), "data-testid": D, children: [
|
|
488
|
+
r && /* @__PURE__ */ M(
|
|
483
489
|
se,
|
|
484
490
|
{
|
|
485
491
|
bold: !0,
|
|
486
492
|
element: "label",
|
|
487
493
|
elementProps: { htmlFor: z },
|
|
488
|
-
className: U(m.input__label,
|
|
494
|
+
className: U(m.input__label, q),
|
|
489
495
|
"data-testid": $,
|
|
490
496
|
children: [
|
|
491
497
|
r,
|
|
492
|
-
j && /* @__PURE__ */
|
|
498
|
+
j && /* @__PURE__ */ H("span", { children: "*" })
|
|
493
499
|
]
|
|
494
500
|
}
|
|
495
501
|
),
|
|
496
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ H(
|
|
497
503
|
he,
|
|
498
504
|
{
|
|
499
505
|
id: z,
|
|
@@ -512,35 +518,35 @@ const Ge = xe(
|
|
|
512
518
|
ref: a,
|
|
513
519
|
className: U(m["input__input-el"], R),
|
|
514
520
|
maxLength: S,
|
|
515
|
-
onChange:
|
|
521
|
+
onChange: v ? ae : ee,
|
|
516
522
|
...e,
|
|
517
|
-
onKeyDown:
|
|
518
|
-
onBlur:
|
|
519
|
-
defaultValue:
|
|
520
|
-
value:
|
|
523
|
+
onKeyDown: re,
|
|
524
|
+
onBlur: ie,
|
|
525
|
+
defaultValue: Q,
|
|
526
|
+
value: te
|
|
521
527
|
}
|
|
522
528
|
},
|
|
523
|
-
startAdornment: b && /* @__PURE__ */
|
|
524
|
-
endAdornment:
|
|
525
|
-
...
|
|
529
|
+
startAdornment: b && /* @__PURE__ */ H("span", { className: m["input__left-icon"], children: b }),
|
|
530
|
+
endAdornment: h && /* @__PURE__ */ H("span", { className: m["input__right-icon"], children: h }),
|
|
531
|
+
...ne
|
|
526
532
|
}
|
|
527
533
|
),
|
|
528
|
-
/* @__PURE__ */
|
|
529
|
-
(p || u) && /* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ M("div", { className: m["input__messages-wrapper"], children: [
|
|
535
|
+
(p || u) && /* @__PURE__ */ M(
|
|
530
536
|
se,
|
|
531
537
|
{
|
|
532
|
-
className: p ? U(m["input__error-message"],
|
|
533
|
-
"data-testid": p ?
|
|
538
|
+
className: p ? U(m["input__error-message"], O) : U(m["input__info-message"], A),
|
|
539
|
+
"data-testid": p ? Z : L,
|
|
534
540
|
children: [
|
|
535
|
-
/* @__PURE__ */
|
|
541
|
+
/* @__PURE__ */ H(Ee, { icon: p ? "circle-exclamation" : "circle-info" }),
|
|
536
542
|
p || u
|
|
537
543
|
]
|
|
538
544
|
}
|
|
539
545
|
),
|
|
540
|
-
G && /* @__PURE__ */
|
|
546
|
+
G && /* @__PURE__ */ M(
|
|
541
547
|
se,
|
|
542
548
|
{
|
|
543
|
-
className: U(m["input__chars-counter"],
|
|
549
|
+
className: U(m["input__chars-counter"], T),
|
|
544
550
|
"data-testid": W,
|
|
545
551
|
children: [
|
|
546
552
|
l,
|
|
@@ -554,5 +560,5 @@ const Ge = xe(
|
|
|
554
560
|
}
|
|
555
561
|
);
|
|
556
562
|
export {
|
|
557
|
-
|
|
563
|
+
Je as Input
|
|
558
564
|
};
|