@pismo/marola 2.1.23 → 2.1.24
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.d.ts +2 -0
- package/dist/components/Input/Input.js +274 -273
- package/dist/components/InputSearch/InputSearch.d.ts +1 -0
- package/dist/components/InputSearch/InputSearch.stories.d.ts +1 -0
- package/dist/utils/inputNumberAsText.d.ts +1 -1
- package/dist/utils/inputNumberAsText.js +13 -9
- package/package.json +1 -1
|
@@ -18,6 +18,8 @@ export type SingleInputProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
|
18
18
|
rightIcon?: ReactNode;
|
|
19
19
|
/** Input type. Default: text */
|
|
20
20
|
type?: CustomInputTypeAttribute | 'number-as-text';
|
|
21
|
+
/** allow leading zeros to use as a number code (000123) or phone number (08001234567) */
|
|
22
|
+
allowLeadingZeros?: boolean;
|
|
21
23
|
/** allow only integer value. Default: false */
|
|
22
24
|
isInteger?: boolean;
|
|
23
25
|
/** use comma or dot as decimal separator, for example in Brazil it's use comma as pattern. Default: false */
|
|
@@ -1,229 +1,229 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { formatDecimalValue as
|
|
5
|
-
import { c as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { Typography as
|
|
8
|
-
import { g as
|
|
9
|
-
import '../../assets/Input.css';function
|
|
10
|
-
let
|
|
11
|
-
for (let
|
|
12
|
-
|
|
13
|
-
return "Minified MUI error #" + u + "; visit " +
|
|
1
|
+
import { jsxs as $, jsx as Y } from "react/jsx-runtime";
|
|
2
|
+
import * as F from "react";
|
|
3
|
+
import { forwardRef as ge, useState as he, useId as we, useMemo as re } from "react";
|
|
4
|
+
import { formatDecimalValue as pe, allowOnlyIntegerNumbers as ye, allowOnlyNumbers as Ne, parseToInteger as Ce } from "../../utils/inputNumberAsText.js";
|
|
5
|
+
import { c as B } from "../../clsx-OuTLNxxd.js";
|
|
6
|
+
import { Icon as xe } from "../Icon/Icon.js";
|
|
7
|
+
import { Typography as ie } from "../Typography/Typography.js";
|
|
8
|
+
import { g as ve, a as Pe, u as Re, f as ue, _ as C, b as Ee, c as ce, i as Ve, d as Fe, e as Se, P as n } from "../../useSlotProps-CYHDC4TN.js";
|
|
9
|
+
import '../../assets/Input.css';function qe(u) {
|
|
10
|
+
let d = "https://mui.com/production-error/?code=" + u;
|
|
11
|
+
for (let b = 1; b < arguments.length; b += 1)
|
|
12
|
+
d += "&args[]=" + encodeURIComponent(arguments[b]);
|
|
13
|
+
return "Minified MUI error #" + u + "; visit " + d + " for the full message.";
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
return
|
|
15
|
+
const fe = "Input";
|
|
16
|
+
function Oe(u) {
|
|
17
|
+
return ve(fe, u);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
process.env.NODE_ENV !== "production" && (
|
|
22
|
-
function
|
|
23
|
-
return
|
|
19
|
+
Pe(fe, ["root", "formControl", "focused", "disabled", "error", "multiline", "input", "inputMultiline", "inputTypeSearch", "adornedStart", "adornedEnd"]);
|
|
20
|
+
const me = /* @__PURE__ */ F.createContext(void 0);
|
|
21
|
+
process.env.NODE_ENV !== "production" && (me.displayName = "FormControlContext");
|
|
22
|
+
function Te() {
|
|
23
|
+
return F.useContext(me);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function Ie(u = {}) {
|
|
26
26
|
const {
|
|
27
|
-
defaultValue:
|
|
28
|
-
disabled:
|
|
29
|
-
error:
|
|
30
|
-
onBlur:
|
|
31
|
-
onChange:
|
|
32
|
-
onFocus:
|
|
33
|
-
required:
|
|
34
|
-
value:
|
|
35
|
-
inputRef:
|
|
36
|
-
} = u, l =
|
|
37
|
-
let
|
|
27
|
+
defaultValue: d,
|
|
28
|
+
disabled: b = !1,
|
|
29
|
+
error: c = !1,
|
|
30
|
+
onBlur: g,
|
|
31
|
+
onChange: h,
|
|
32
|
+
onFocus: S,
|
|
33
|
+
required: q = !1,
|
|
34
|
+
value: f,
|
|
35
|
+
inputRef: O
|
|
36
|
+
} = u, l = Te();
|
|
37
|
+
let w, p, x, y, v;
|
|
38
38
|
if (l) {
|
|
39
|
-
var
|
|
40
|
-
if (
|
|
39
|
+
var U, s, j;
|
|
40
|
+
if (w = void 0, p = (U = l.disabled) != null ? U : !1, x = (s = l.error) != null ? s : !1, y = (j = l.required) != null ? j : !1, v = l.value, process.env.NODE_ENV !== "production") {
|
|
41
41
|
const o = ["defaultValue", "disabled", "error", "required", "value"].filter((r) => u[r] !== void 0);
|
|
42
42
|
o.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: ${o.join(", ")}`].join(`
|
|
43
43
|
`));
|
|
44
44
|
}
|
|
45
45
|
} else
|
|
46
|
-
|
|
46
|
+
w = d, p = b, x = c, y = q, v = f;
|
|
47
47
|
const {
|
|
48
|
-
current:
|
|
49
|
-
} =
|
|
48
|
+
current: L
|
|
49
|
+
} = F.useRef(v != null), W = F.useCallback((o) => {
|
|
50
50
|
process.env.NODE_ENV !== "production" && o && o.nodeName !== "INPUT" && !o.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
|
-
}, []),
|
|
53
|
-
|
|
54
|
-
!l &&
|
|
55
|
-
}, [l,
|
|
56
|
-
const
|
|
52
|
+
}, []), R = F.useRef(null), A = Re(R, O, W), [T, I] = F.useState(!1);
|
|
53
|
+
F.useEffect(() => {
|
|
54
|
+
!l && p && T && (I(!1), g == null || g());
|
|
55
|
+
}, [l, p, T, g]);
|
|
56
|
+
const z = (o) => (r) => {
|
|
57
57
|
var a;
|
|
58
58
|
if (l != null && l.disabled) {
|
|
59
59
|
r.stopPropagation();
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
if ((a = o.onFocus) == null || a.call(o, r), l && l.onFocus) {
|
|
63
|
-
var
|
|
64
|
-
l == null || (
|
|
63
|
+
var m;
|
|
64
|
+
l == null || (m = l.onFocus) == null || m.call(l);
|
|
65
65
|
} else
|
|
66
|
-
|
|
67
|
-
},
|
|
66
|
+
I(!0);
|
|
67
|
+
}, G = (o) => (r) => {
|
|
68
68
|
var a;
|
|
69
|
-
(a = o.onBlur) == null || a.call(o, r), l && l.onBlur ? l.onBlur() :
|
|
70
|
-
},
|
|
71
|
-
var
|
|
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
|
-
l == null || (
|
|
75
|
-
},
|
|
69
|
+
(a = o.onBlur) == null || a.call(o, r), l && l.onBlur ? l.onBlur() : I(!1);
|
|
70
|
+
}, J = (o) => (r, ...a) => {
|
|
71
|
+
var m, E;
|
|
72
|
+
if (!L && (r.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." : qe(17));
|
|
74
|
+
l == null || (m = l.onChange) == null || m.call(l, r), (E = o.onChange) == null || E.call(o, r, ...a);
|
|
75
|
+
}, Q = (o) => (r) => {
|
|
76
76
|
var a;
|
|
77
|
-
|
|
77
|
+
R.current && r.currentTarget === r.target && R.current.focus(), (a = o.onClick) == null || a.call(o, r);
|
|
78
78
|
};
|
|
79
79
|
return {
|
|
80
|
-
disabled:
|
|
81
|
-
error:
|
|
82
|
-
focused:
|
|
80
|
+
disabled: p,
|
|
81
|
+
error: x,
|
|
82
|
+
focused: T,
|
|
83
83
|
formControlContext: l,
|
|
84
84
|
getInputProps: (o = {}) => {
|
|
85
|
-
const a =
|
|
86
|
-
onBlur:
|
|
87
|
-
onChange:
|
|
88
|
-
onFocus:
|
|
89
|
-
},
|
|
90
|
-
onBlur:
|
|
91
|
-
onChange:
|
|
92
|
-
onFocus:
|
|
85
|
+
const a = C({}, {
|
|
86
|
+
onBlur: g,
|
|
87
|
+
onChange: h,
|
|
88
|
+
onFocus: S
|
|
89
|
+
}, ue(o)), m = C({}, a, {
|
|
90
|
+
onBlur: G(a),
|
|
91
|
+
onChange: J(a),
|
|
92
|
+
onFocus: z(a)
|
|
93
93
|
});
|
|
94
|
-
return
|
|
95
|
-
"aria-invalid":
|
|
96
|
-
defaultValue:
|
|
97
|
-
value:
|
|
98
|
-
required:
|
|
99
|
-
disabled:
|
|
94
|
+
return C({}, m, {
|
|
95
|
+
"aria-invalid": x || void 0,
|
|
96
|
+
defaultValue: w,
|
|
97
|
+
value: v,
|
|
98
|
+
required: y,
|
|
99
|
+
disabled: p
|
|
100
100
|
}, o, {
|
|
101
|
-
ref:
|
|
102
|
-
},
|
|
101
|
+
ref: A
|
|
102
|
+
}, m);
|
|
103
103
|
},
|
|
104
104
|
getRootProps: (o = {}) => {
|
|
105
|
-
const r =
|
|
106
|
-
return
|
|
107
|
-
onClick:
|
|
105
|
+
const r = ue(u, ["onBlur", "onChange", "onFocus"]), a = C({}, r, ue(o));
|
|
106
|
+
return C({}, o, a, {
|
|
107
|
+
onClick: Q(a)
|
|
108
108
|
});
|
|
109
109
|
},
|
|
110
|
-
inputRef:
|
|
111
|
-
required:
|
|
112
|
-
value:
|
|
110
|
+
inputRef: A,
|
|
111
|
+
required: y,
|
|
112
|
+
value: v
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const Be = ["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"], Ue = (u) => {
|
|
116
116
|
const {
|
|
117
|
-
disabled:
|
|
118
|
-
error:
|
|
119
|
-
focused:
|
|
120
|
-
formControlContext:
|
|
121
|
-
multiline:
|
|
122
|
-
startAdornment:
|
|
123
|
-
endAdornment:
|
|
117
|
+
disabled: d,
|
|
118
|
+
error: b,
|
|
119
|
+
focused: c,
|
|
120
|
+
formControlContext: g,
|
|
121
|
+
multiline: h,
|
|
122
|
+
startAdornment: S,
|
|
123
|
+
endAdornment: q
|
|
124
124
|
} = u;
|
|
125
|
-
return
|
|
126
|
-
root: ["root",
|
|
127
|
-
input: ["input",
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
var
|
|
125
|
+
return Fe({
|
|
126
|
+
root: ["root", d && "disabled", b && "error", c && "focused", !!g && "formControl", h && "multiline", !!S && "adornedStart", !!q && "adornedEnd"],
|
|
127
|
+
input: ["input", d && "disabled", h && "multiline"]
|
|
128
|
+
}, Se(Oe));
|
|
129
|
+
}, _e = /* @__PURE__ */ F.forwardRef(function(d, b) {
|
|
130
|
+
var c, g, h;
|
|
131
131
|
const {
|
|
132
|
-
"aria-describedby":
|
|
133
|
-
"aria-label":
|
|
134
|
-
"aria-labelledby":
|
|
135
|
-
autoComplete:
|
|
132
|
+
"aria-describedby": S,
|
|
133
|
+
"aria-label": q,
|
|
134
|
+
"aria-labelledby": f,
|
|
135
|
+
autoComplete: O,
|
|
136
136
|
autoFocus: l,
|
|
137
|
-
className:
|
|
138
|
-
defaultValue:
|
|
139
|
-
disabled:
|
|
140
|
-
endAdornment:
|
|
141
|
-
error:
|
|
142
|
-
id:
|
|
143
|
-
multiline:
|
|
144
|
-
name:
|
|
145
|
-
onClick:
|
|
146
|
-
onChange:
|
|
147
|
-
onKeyDown:
|
|
148
|
-
onKeyUp:
|
|
149
|
-
onFocus:
|
|
150
|
-
onBlur:
|
|
151
|
-
placeholder:
|
|
152
|
-
readOnly:
|
|
153
|
-
required:
|
|
154
|
-
startAdornment:
|
|
155
|
-
value:
|
|
156
|
-
type:
|
|
137
|
+
className: w,
|
|
138
|
+
defaultValue: p,
|
|
139
|
+
disabled: x,
|
|
140
|
+
endAdornment: y,
|
|
141
|
+
error: v,
|
|
142
|
+
id: U,
|
|
143
|
+
multiline: s = !1,
|
|
144
|
+
name: j,
|
|
145
|
+
onClick: L,
|
|
146
|
+
onChange: W,
|
|
147
|
+
onKeyDown: R,
|
|
148
|
+
onKeyUp: A,
|
|
149
|
+
onFocus: T,
|
|
150
|
+
onBlur: I,
|
|
151
|
+
placeholder: z,
|
|
152
|
+
readOnly: G,
|
|
153
|
+
required: J,
|
|
154
|
+
startAdornment: Q,
|
|
155
|
+
value: Z,
|
|
156
|
+
type: e,
|
|
157
157
|
rows: o,
|
|
158
158
|
slotProps: r = {},
|
|
159
159
|
slots: a = {},
|
|
160
|
-
minRows:
|
|
161
|
-
maxRows:
|
|
162
|
-
} =
|
|
160
|
+
minRows: m,
|
|
161
|
+
maxRows: E
|
|
162
|
+
} = d, k = Ee(d, Be), {
|
|
163
163
|
getRootProps: ee,
|
|
164
164
|
getInputProps: ne,
|
|
165
165
|
focused: te,
|
|
166
166
|
formControlContext: oe,
|
|
167
167
|
error: le,
|
|
168
|
-
disabled:
|
|
169
|
-
} =
|
|
170
|
-
disabled:
|
|
171
|
-
defaultValue:
|
|
172
|
-
error:
|
|
173
|
-
onBlur:
|
|
174
|
-
onClick:
|
|
175
|
-
onChange:
|
|
176
|
-
onFocus:
|
|
177
|
-
required:
|
|
178
|
-
value:
|
|
179
|
-
}),
|
|
180
|
-
disabled:
|
|
168
|
+
disabled: ae
|
|
169
|
+
} = Ie({
|
|
170
|
+
disabled: x,
|
|
171
|
+
defaultValue: p,
|
|
172
|
+
error: v,
|
|
173
|
+
onBlur: I,
|
|
174
|
+
onClick: L,
|
|
175
|
+
onChange: W,
|
|
176
|
+
onFocus: T,
|
|
177
|
+
required: J,
|
|
178
|
+
value: Z
|
|
179
|
+
}), X = s ? void 0 : e ?? "text", D = C({}, d, {
|
|
180
|
+
disabled: ae,
|
|
181
181
|
error: le,
|
|
182
182
|
focused: te,
|
|
183
183
|
formControlContext: oe,
|
|
184
|
-
multiline:
|
|
185
|
-
type:
|
|
186
|
-
}),
|
|
187
|
-
"aria-describedby":
|
|
188
|
-
"aria-label":
|
|
189
|
-
"aria-labelledby":
|
|
190
|
-
autoComplete:
|
|
184
|
+
multiline: s,
|
|
185
|
+
type: X
|
|
186
|
+
}), t = Ue(D), N = {
|
|
187
|
+
"aria-describedby": S,
|
|
188
|
+
"aria-label": q,
|
|
189
|
+
"aria-labelledby": f,
|
|
190
|
+
autoComplete: O,
|
|
191
191
|
autoFocus: l,
|
|
192
|
-
id:
|
|
193
|
-
onKeyDown:
|
|
194
|
-
onKeyUp:
|
|
195
|
-
name:
|
|
196
|
-
placeholder:
|
|
197
|
-
readOnly:
|
|
198
|
-
type:
|
|
199
|
-
},
|
|
200
|
-
elementType:
|
|
192
|
+
id: U,
|
|
193
|
+
onKeyDown: R,
|
|
194
|
+
onKeyUp: A,
|
|
195
|
+
name: j,
|
|
196
|
+
placeholder: z,
|
|
197
|
+
readOnly: G,
|
|
198
|
+
type: X
|
|
199
|
+
}, V = (c = a.root) != null ? c : "div", P = ce({
|
|
200
|
+
elementType: V,
|
|
201
201
|
getSlotProps: ee,
|
|
202
202
|
externalSlotProps: r.root,
|
|
203
|
-
externalForwardedProps:
|
|
203
|
+
externalForwardedProps: k,
|
|
204
204
|
additionalProps: {
|
|
205
|
-
ref:
|
|
205
|
+
ref: b
|
|
206
206
|
},
|
|
207
|
-
ownerState:
|
|
208
|
-
className: [
|
|
209
|
-
}),
|
|
210
|
-
elementType:
|
|
211
|
-
getSlotProps: (
|
|
207
|
+
ownerState: D,
|
|
208
|
+
className: [t.root, w]
|
|
209
|
+
}), M = s ? (g = a.textarea) != null ? g : "textarea" : (h = a.input) != null ? h : "input", i = ce({
|
|
210
|
+
elementType: M,
|
|
211
|
+
getSlotProps: (H) => ne(C({}, N, H)),
|
|
212
212
|
externalSlotProps: r.input,
|
|
213
|
-
additionalProps:
|
|
214
|
-
rows:
|
|
215
|
-
},
|
|
216
|
-
minRows: o ||
|
|
217
|
-
maxRows: o ||
|
|
213
|
+
additionalProps: C({
|
|
214
|
+
rows: s ? o : void 0
|
|
215
|
+
}, s && !Ve(M) && {
|
|
216
|
+
minRows: o || m,
|
|
217
|
+
maxRows: o || E
|
|
218
218
|
}),
|
|
219
|
-
ownerState:
|
|
220
|
-
className:
|
|
219
|
+
ownerState: D,
|
|
220
|
+
className: t.input
|
|
221
221
|
});
|
|
222
|
-
return process.env.NODE_ENV !== "production" &&
|
|
223
|
-
children: [
|
|
222
|
+
return process.env.NODE_ENV !== "production" && s && o && (m || E) && console.warn("MUI: You can not use the `minRows` or `maxRows` props when the input `rows` prop is set."), /* @__PURE__ */ $(V, C({}, P, {
|
|
223
|
+
children: [Q, /* @__PURE__ */ Y(M, C({}, i)), y]
|
|
224
224
|
}));
|
|
225
225
|
});
|
|
226
|
-
process.env.NODE_ENV !== "production" && (
|
|
226
|
+
process.env.NODE_ENV !== "production" && (_e.propTypes = {
|
|
227
227
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
228
228
|
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
229
229
|
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
@@ -373,11 +373,11 @@ process.env.NODE_ENV !== "production" && (fe.propTypes = {
|
|
|
373
373
|
*/
|
|
374
374
|
value: n.any
|
|
375
375
|
});
|
|
376
|
-
const
|
|
376
|
+
const je = "_input_101pq_57", Ae = "_input__label_101pq_84", _ = {
|
|
377
377
|
"input__input-el": "_input__input-el_101pq_57",
|
|
378
|
-
input:
|
|
378
|
+
input: je,
|
|
379
379
|
"input__messages-wrapper": "_input__messages-wrapper_101pq_81",
|
|
380
|
-
input__label:
|
|
380
|
+
input__label: Ae,
|
|
381
381
|
"input__input-el-wrapper": "_input__input-el-wrapper_101pq_89",
|
|
382
382
|
"input__left-icon": "_input__left-icon_101pq_111",
|
|
383
383
|
"input__right-icon": "_input__right-icon_101pq_111",
|
|
@@ -387,83 +387,84 @@ const Be = "_input_101pq_57", Ue = "_input__label_101pq_84", f = {
|
|
|
387
387
|
"input--disabled": "_input--disabled_101pq_153",
|
|
388
388
|
"input--focused": "_input--focused_101pq_159",
|
|
389
389
|
"input--error": "_input--error_101pq_162"
|
|
390
|
-
},
|
|
390
|
+
}, Le = ge(
|
|
391
391
|
({
|
|
392
392
|
label: u,
|
|
393
|
-
infoMessage:
|
|
394
|
-
error:
|
|
395
|
-
errorMessage:
|
|
396
|
-
leftIcon:
|
|
397
|
-
rightIcon:
|
|
398
|
-
id:
|
|
399
|
-
disabled:
|
|
400
|
-
type:
|
|
401
|
-
maxLength:
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
393
|
+
infoMessage: d,
|
|
394
|
+
error: b,
|
|
395
|
+
errorMessage: c,
|
|
396
|
+
leftIcon: g,
|
|
397
|
+
rightIcon: h,
|
|
398
|
+
id: S,
|
|
399
|
+
disabled: q,
|
|
400
|
+
type: f = "text",
|
|
401
|
+
maxLength: O,
|
|
402
|
+
allowLeadingZeros: l = !1,
|
|
403
|
+
isInteger: w,
|
|
404
|
+
useCommaInDecimal: p,
|
|
405
|
+
allowNegativeNumbers: x = !1,
|
|
406
|
+
decimalLength: y = 10,
|
|
407
|
+
hideCharsCounter: v = !1,
|
|
408
|
+
required: U,
|
|
409
|
+
onChange: s,
|
|
410
|
+
classNameWrapper: j,
|
|
411
|
+
classNameLabel: L,
|
|
412
|
+
classNameInput: W,
|
|
413
|
+
classNameInfoMessage: R,
|
|
414
|
+
classNameErrorMessage: A,
|
|
415
|
+
classNameCharsCounter: T,
|
|
415
416
|
"data-testid-wrapper": I,
|
|
416
|
-
"data-testid-label":
|
|
417
|
-
"data-testid-input":
|
|
418
|
-
"data-testid-infoMessage":
|
|
419
|
-
"data-testid-errorMessage":
|
|
420
|
-
"data-testid-charsCounter":
|
|
417
|
+
"data-testid-label": z,
|
|
418
|
+
"data-testid-input": G,
|
|
419
|
+
"data-testid-infoMessage": J,
|
|
420
|
+
"data-testid-errorMessage": Q,
|
|
421
|
+
"data-testid-charsCounter": Z,
|
|
421
422
|
...e
|
|
422
|
-
},
|
|
423
|
-
var X,
|
|
424
|
-
const [
|
|
425
|
-
((X = e.value) == null ? void 0 : X.length) || ((
|
|
426
|
-
),
|
|
427
|
-
Object.assign(e, { "data-testid":
|
|
428
|
-
const
|
|
429
|
-
var
|
|
430
|
-
if (
|
|
431
|
-
let i =
|
|
432
|
-
if (!
|
|
433
|
-
const
|
|
434
|
-
|
|
423
|
+
}, o) => {
|
|
424
|
+
var X, D;
|
|
425
|
+
const [r, a] = he(
|
|
426
|
+
((X = e.value) == null ? void 0 : X.length) || ((D = e.defaultValue) == null ? void 0 : D.length) || 0
|
|
427
|
+
), m = we(), E = S || `input_${m}`;
|
|
428
|
+
Object.assign(e, { "data-testid": G });
|
|
429
|
+
const k = O && !v, ee = (t) => {
|
|
430
|
+
var N, V, P, M;
|
|
431
|
+
if (f === "number-as-text") {
|
|
432
|
+
let i = w ? Ce(t.target.value, l) : p ? t.target.value.replace(".", ",") : t.target.value.replace(",", ".");
|
|
433
|
+
if (!w && y > 0) {
|
|
434
|
+
const se = String(i), [be, de] = se.split(/,|\./);
|
|
435
|
+
se !== "" && de && (i = [be, de.slice(0, y)].join(p ? "," : "."));
|
|
435
436
|
}
|
|
436
437
|
t.target.value = String(i);
|
|
437
|
-
const
|
|
438
|
-
|
|
438
|
+
const H = !isNaN(Number(String(i).replace(",", "."))), K = String(i).length ? String(i).replace(",", ".") : "";
|
|
439
|
+
s == null || s({
|
|
439
440
|
...t,
|
|
440
441
|
target: {
|
|
441
442
|
...t.target,
|
|
442
|
-
value:
|
|
443
|
-
valueAsNumber:
|
|
443
|
+
value: K,
|
|
444
|
+
valueAsNumber: H && String(i).length ? Number(String(i).replace(",", ".")) : NaN
|
|
444
445
|
}
|
|
445
|
-
}),
|
|
446
|
+
}), k && a((V = (N = t == null ? void 0 : t.target) == null ? void 0 : N.value) == null ? void 0 : V.length);
|
|
446
447
|
return;
|
|
447
448
|
}
|
|
448
|
-
if (
|
|
449
|
+
if (f === "number") {
|
|
449
450
|
let i = String(t.target.value);
|
|
450
|
-
const [
|
|
451
|
-
i !== "" && (
|
|
451
|
+
const [H, K] = i.split(".");
|
|
452
|
+
i !== "" && (K != null && K.length ? i = [Number(H), K.slice(0, y)].join(".") : i = String(Number(H))), t.target.value = i;
|
|
452
453
|
}
|
|
453
|
-
|
|
454
|
-
}, ee = (t) => {
|
|
455
|
-
var w;
|
|
456
|
-
c === "number-as-text" && (l ? he(t, g) : we(t, g)), (w = e == null ? void 0 : e.onKeyDown) == null || w.call(e, t);
|
|
454
|
+
k && a((M = (P = t == null ? void 0 : t.target) == null ? void 0 : P.value) == null ? void 0 : M.length), s && s(t);
|
|
457
455
|
}, ne = (t) => {
|
|
458
|
-
var
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
456
|
+
var N;
|
|
457
|
+
f === "number-as-text" && (w ? ye(t, x) : Ne(t, x)), (N = e == null ? void 0 : e.onKeyDown) == null || N.call(e, t);
|
|
458
|
+
}, te = (t) => {
|
|
459
|
+
var N;
|
|
460
|
+
if (f === "number-as-text" && t.target.value.length) {
|
|
461
|
+
const V = w ? t.target.value.replace(/(,\.)/gi, "") : t.target.value.replace(",", ".");
|
|
462
|
+
let P = String(l ? V : Number(V));
|
|
463
|
+
isNaN(Number(P)) && (P = ""), t.target.value = p ? P.replace(".", ",") : P;
|
|
463
464
|
}
|
|
464
|
-
(
|
|
465
|
-
},
|
|
466
|
-
type:
|
|
465
|
+
(N = e == null ? void 0 : e.onBlur) == null || N.call(e, t);
|
|
466
|
+
}, oe = re(() => e.multiline !== !0 ? {
|
|
467
|
+
type: f === "number-as-text" ? "text" : f,
|
|
467
468
|
multiline: e.multiline
|
|
468
469
|
} : {
|
|
469
470
|
type: void 0,
|
|
@@ -471,75 +472,75 @@ const Be = "_input_101pq_57", Ue = "_input__label_101pq_84", f = {
|
|
|
471
472
|
rows: (e == null ? void 0 : e.rows) || 5,
|
|
472
473
|
minRows: e == null ? void 0 : e.minRows,
|
|
473
474
|
maxRows: e == null ? void 0 : e.maxRows
|
|
474
|
-
}, [e]),
|
|
475
|
-
return /* @__PURE__ */
|
|
476
|
-
u && /* @__PURE__ */
|
|
477
|
-
|
|
475
|
+
}, [e]), le = re(() => f === "number-as-text" && (e != null && e.defaultValue) ? pe(e == null ? void 0 : e.defaultValue, p) : e == null ? void 0 : e.defaultValue, [e.defaultValue]), ae = re(() => f === "number-as-text" && (e != null && e.value) ? pe(e == null ? void 0 : e.value, p) : e == null ? void 0 : e.value, [e.value]);
|
|
476
|
+
return /* @__PURE__ */ $("div", { className: B(_.input, j), "data-testid": I, children: [
|
|
477
|
+
u && /* @__PURE__ */ $(
|
|
478
|
+
ie,
|
|
478
479
|
{
|
|
479
480
|
bold: !0,
|
|
480
481
|
element: "label",
|
|
481
|
-
elementProps: { htmlFor:
|
|
482
|
-
className:
|
|
483
|
-
"data-testid":
|
|
482
|
+
elementProps: { htmlFor: E },
|
|
483
|
+
className: B(_.input__label, L),
|
|
484
|
+
"data-testid": z,
|
|
484
485
|
children: [
|
|
485
486
|
u,
|
|
486
|
-
|
|
487
|
+
U && /* @__PURE__ */ Y("span", { children: "*" })
|
|
487
488
|
]
|
|
488
489
|
}
|
|
489
490
|
),
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
|
|
491
|
+
/* @__PURE__ */ Y(
|
|
492
|
+
_e,
|
|
492
493
|
{
|
|
493
|
-
id:
|
|
494
|
-
disabled:
|
|
495
|
-
error: typeof
|
|
494
|
+
id: E,
|
|
495
|
+
disabled: q,
|
|
496
|
+
error: typeof b == "boolean" ? b : !!c,
|
|
496
497
|
"aria-label": u,
|
|
497
498
|
slotProps: {
|
|
498
499
|
root: (t) => ({
|
|
499
|
-
className:
|
|
500
|
-
[
|
|
501
|
-
[
|
|
502
|
-
[
|
|
500
|
+
className: B(_["input__input-el-wrapper"], {
|
|
501
|
+
[_["input--disabled"]]: t.disabled,
|
|
502
|
+
[_["input--focused"]]: t.focused,
|
|
503
|
+
[_["input--error"]]: t.error
|
|
503
504
|
})
|
|
504
505
|
}),
|
|
505
506
|
input: {
|
|
506
|
-
ref:
|
|
507
|
-
className:
|
|
508
|
-
maxLength:
|
|
509
|
-
onChange:
|
|
507
|
+
ref: o,
|
|
508
|
+
className: B(_["input__input-el"], W),
|
|
509
|
+
maxLength: O,
|
|
510
|
+
onChange: ee,
|
|
510
511
|
...e,
|
|
511
|
-
onKeyDown:
|
|
512
|
-
onBlur:
|
|
513
|
-
defaultValue:
|
|
514
|
-
value:
|
|
512
|
+
onKeyDown: ne,
|
|
513
|
+
onBlur: te,
|
|
514
|
+
defaultValue: le,
|
|
515
|
+
value: ae
|
|
515
516
|
}
|
|
516
517
|
},
|
|
517
|
-
startAdornment:
|
|
518
|
-
endAdornment:
|
|
519
|
-
...
|
|
518
|
+
startAdornment: g && /* @__PURE__ */ Y("span", { className: _["input__left-icon"], children: g }),
|
|
519
|
+
endAdornment: h && /* @__PURE__ */ Y("span", { className: _["input__right-icon"], children: h }),
|
|
520
|
+
...oe
|
|
520
521
|
}
|
|
521
522
|
),
|
|
522
|
-
/* @__PURE__ */
|
|
523
|
-
(
|
|
524
|
-
|
|
523
|
+
/* @__PURE__ */ $("div", { className: _["input__messages-wrapper"], children: [
|
|
524
|
+
(c || d) && /* @__PURE__ */ $(
|
|
525
|
+
ie,
|
|
525
526
|
{
|
|
526
|
-
className:
|
|
527
|
-
"data-testid":
|
|
527
|
+
className: c ? B(_["input__error-message"], A) : B(_["input__info-message"], R),
|
|
528
|
+
"data-testid": c ? Q : J,
|
|
528
529
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
|
|
530
|
+
/* @__PURE__ */ Y(xe, { icon: c ? "circle-exclamation" : "circle-info" }),
|
|
531
|
+
c || d
|
|
531
532
|
]
|
|
532
533
|
}
|
|
533
534
|
),
|
|
534
|
-
|
|
535
|
-
|
|
535
|
+
k && /* @__PURE__ */ $(
|
|
536
|
+
ie,
|
|
536
537
|
{
|
|
537
|
-
className:
|
|
538
|
-
"data-testid":
|
|
538
|
+
className: B(_["input__chars-counter"], T),
|
|
539
|
+
"data-testid": Z,
|
|
539
540
|
children: [
|
|
540
|
-
|
|
541
|
+
r,
|
|
541
542
|
" / ",
|
|
542
|
-
|
|
543
|
+
O
|
|
543
544
|
]
|
|
544
545
|
}
|
|
545
546
|
)
|
|
@@ -548,5 +549,5 @@ const Be = "_input_101pq_57", Ue = "_input__label_101pq_84", f = {
|
|
|
548
549
|
}
|
|
549
550
|
);
|
|
550
551
|
export {
|
|
551
|
-
|
|
552
|
+
Le as Input
|
|
552
553
|
};
|
|
@@ -12,6 +12,7 @@ export declare const InputSearch: import('react').ForwardRefExoticComponent<(Omi
|
|
|
12
12
|
leftIcon?: import('react').ReactNode;
|
|
13
13
|
rightIcon?: import('react').ReactNode;
|
|
14
14
|
type?: ("number" | "url" | "file" | "color" | "search" | (string & {}) | "button" | "time" | "image" | "text" | "reset" | "tel" | "email" | "date" | "hidden" | "range" | "datetime-local" | "month" | "password" | "week") | "number-as-text" | undefined;
|
|
15
|
+
allowLeadingZeros?: boolean | undefined;
|
|
15
16
|
isInteger?: boolean | undefined;
|
|
16
17
|
useCommaInDecimal?: boolean | undefined;
|
|
17
18
|
allowNegativeNumbers?: boolean | undefined;
|
|
@@ -13,6 +13,7 @@ declare const meta: {
|
|
|
13
13
|
leftIcon?: import('react').ReactNode;
|
|
14
14
|
rightIcon?: import('react').ReactNode;
|
|
15
15
|
type?: ("number" | "url" | "file" | "color" | "search" | (string & {}) | "button" | "time" | "image" | "text" | "reset" | "tel" | "email" | "date" | "hidden" | "range" | "datetime-local" | "month" | "password" | "week") | "number-as-text" | undefined;
|
|
16
|
+
allowLeadingZeros?: boolean | undefined;
|
|
16
17
|
isInteger?: boolean | undefined;
|
|
17
18
|
useCommaInDecimal?: boolean | undefined;
|
|
18
19
|
allowNegativeNumbers?: boolean | undefined;
|
|
@@ -5,5 +5,5 @@ declare const allowOnlyMathSignals: (ev: KeyboardEvent<HTMLInputElement>) => {
|
|
|
5
5
|
declare const allowOnlyNumbers: (ev: KeyboardEvent<HTMLInputElement>, allowNegative?: boolean) => void;
|
|
6
6
|
declare const allowOnlyIntegerNumbers: (ev: KeyboardEvent<HTMLInputElement>, allowNegative?: boolean) => void;
|
|
7
7
|
declare const formatDecimalValue: (value: string | number, useCommaInDecimal?: boolean) => string;
|
|
8
|
-
declare const parseToInteger: (value: string) =>
|
|
8
|
+
declare const parseToInteger: (value: string, allowLeadingZeros?: boolean) => string;
|
|
9
9
|
export { allowOnlyNumbers, allowOnlyIntegerNumbers, allowOnlyMathSignals, formatDecimalValue, parseToInteger };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const s = ["ArrowLeft", "ArrowRight", "Backspace", "Delete", "Tab"], n = [".", ","], l = ["-"], i = (e) => {
|
|
2
2
|
var t;
|
|
3
3
|
return l.includes(e.key) ? e.currentTarget.value.match(
|
|
4
|
-
new RegExp(l.map((
|
|
4
|
+
new RegExp(l.map((a) => `\\${a}`).join("|"))
|
|
5
5
|
) ? (e.preventDefault(), { wasPrevented: !0 }) : (n.includes((t = e.currentTarget.value) == null ? void 0 : t[0]) ? (e.currentTarget.value = e.key, e.preventDefault()) : e.currentTarget.setSelectionRange(0, 0), { wasPrevented: !0 }) : { wasPrevented: !1 };
|
|
6
6
|
}, u = (e, t = !1) => {
|
|
7
7
|
if (e.key === " ") {
|
|
@@ -9,28 +9,32 @@ const s = ["ArrowLeft", "ArrowRight", "Backspace", "Delete", "Tab"], n = [".", "
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
if (t) {
|
|
12
|
-
const { wasPrevented:
|
|
13
|
-
if (
|
|
12
|
+
const { wasPrevented: a } = i(e);
|
|
13
|
+
if (a) return;
|
|
14
14
|
}
|
|
15
15
|
if (isNaN(Number(e.key)) && !s.includes(e.key) && !n.includes(e.key)) {
|
|
16
16
|
e.preventDefault();
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
new RegExp(`(${n.map((
|
|
19
|
+
const r = e.currentTarget.value.match(
|
|
20
|
+
new RegExp(`(${n.map((a) => `\\${a}`).join("|")})`)
|
|
21
21
|
);
|
|
22
|
-
n.includes(e.key) &&
|
|
22
|
+
n.includes(e.key) && r && e.preventDefault();
|
|
23
23
|
}, c = (e, t = !1) => {
|
|
24
24
|
if (e.key === " ") {
|
|
25
25
|
e.preventDefault();
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
if (t) {
|
|
29
|
-
const { wasPrevented:
|
|
30
|
-
if (
|
|
29
|
+
const { wasPrevented: r } = i(e);
|
|
30
|
+
if (r) return;
|
|
31
31
|
}
|
|
32
32
|
isNaN(Number(e.key)) && !s.includes(e.key) && e.preventDefault();
|
|
33
|
-
}, o = (e, t = !1) => t ? String(e).replace(".", ",") : String(e).replace(",", "."), f = (e
|
|
33
|
+
}, o = (e, t = !1) => t ? String(e).replace(".", ",") : String(e).replace(",", "."), f = (e, t = !1) => {
|
|
34
|
+
if (!e.length) return "";
|
|
35
|
+
const r = String(e).replace(/\.|,/gi, "");
|
|
36
|
+
return t ? r : String(Number(r));
|
|
37
|
+
};
|
|
34
38
|
export {
|
|
35
39
|
c as allowOnlyIntegerNumbers,
|
|
36
40
|
i as allowOnlyMathSignals,
|