@pismo/marola 1.1.5 → 1.1.7
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/assets/Badge.css +1 -0
- package/dist/components/Badge/Badge.d.ts +10 -0
- package/dist/components/Badge/Badge.js +35 -0
- package/dist/components/Badge/Badge.stories.d.ts +14 -0
- package/dist/components/Badge/Badge.test.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +7 -1
- package/dist/components/Input/Input.js +360 -323
- package/dist/components/Input/Input.stories.d.ts +1 -0
- package/dist/components/InputSearch/InputSearch.d.ts +4 -1
- package/dist/components/InputSearch/InputSearch.stories.d.ts +4 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +99 -97
- package/dist/marola.css +1 -1
- package/dist/utils/inputNumberAsText.d.ts +10 -0
- package/dist/utils/inputNumberAsText.js +42 -0
- package/package.json +1 -1
|
@@ -1,229 +1,230 @@
|
|
|
1
1
|
import '../../assets/Input.css';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsxs as D, jsx as M } from "react/jsx-runtime";
|
|
3
|
+
import * as V from "react";
|
|
4
|
+
import { forwardRef as _e, useState as fe, useId as me, useMemo as re } from "react";
|
|
5
|
+
import { formatDecimalValue as ie, parseToInteger as he, allowOnlyIntegerNumbers as ge, allowOnlyNumbers as be } from "../../utils/inputNumberAsText.js";
|
|
6
|
+
import { c as k } from "../../clsx-DB4S2d7J.js";
|
|
7
|
+
import { Icon as ye } from "../Icon/Icon.js";
|
|
8
|
+
import { Typography as le } from "../Typography/Typography.js";
|
|
9
|
+
import { g as we, a as Ne, u as xe, f as ue, b as v, _ as Ce, c as se, i as ve, P as t, d as qe, e as Pe } from "../../useSlotProps-C_I1kEHr.js";
|
|
10
|
+
function Re(i) {
|
|
11
|
+
let s = "https://mui.com/production-error/?code=" + i;
|
|
12
|
+
for (let f = 1; f < arguments.length; f += 1)
|
|
13
|
+
s += "&args[]=" + encodeURIComponent(arguments[f]);
|
|
14
|
+
return "Minified MUI error #" + i + "; visit " + s + " for the full message.";
|
|
14
15
|
}
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
return
|
|
16
|
+
const pe = "Input";
|
|
17
|
+
function Ee(i) {
|
|
18
|
+
return we(pe, i);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
process.env.NODE_ENV !== "production" && (
|
|
22
|
-
function
|
|
23
|
-
return
|
|
20
|
+
Ne(pe, ["root", "formControl", "focused", "disabled", "error", "multiline", "input", "inputMultiline", "inputTypeSearch", "adornedStart", "adornedEnd"]);
|
|
21
|
+
const de = /* @__PURE__ */ V.createContext(void 0);
|
|
22
|
+
process.env.NODE_ENV !== "production" && (de.displayName = "FormControlContext");
|
|
23
|
+
function Ve() {
|
|
24
|
+
return V.useContext(de);
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function Fe(i = {}) {
|
|
26
27
|
const {
|
|
27
|
-
defaultValue:
|
|
28
|
-
disabled:
|
|
29
|
-
error:
|
|
30
|
-
onBlur:
|
|
31
|
-
onChange:
|
|
32
|
-
onFocus:
|
|
33
|
-
required:
|
|
34
|
-
value:
|
|
35
|
-
inputRef:
|
|
36
|
-
} =
|
|
37
|
-
let
|
|
38
|
-
if (
|
|
39
|
-
var
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
28
|
+
defaultValue: s,
|
|
29
|
+
disabled: f = !1,
|
|
30
|
+
error: d = !1,
|
|
31
|
+
onBlur: m,
|
|
32
|
+
onChange: N,
|
|
33
|
+
onFocus: F,
|
|
34
|
+
required: S = !1,
|
|
35
|
+
value: c,
|
|
36
|
+
inputRef: O
|
|
37
|
+
} = i, a = Ve();
|
|
38
|
+
let h, g, x, P, q;
|
|
39
|
+
if (a) {
|
|
40
|
+
var C, b, U;
|
|
41
|
+
if (h = void 0, g = (C = a.disabled) != null ? C : !1, x = (b = a.error) != null ? b : !1, P = (U = a.required) != null ? U : !1, q = a.value, process.env.NODE_ENV !== "production") {
|
|
42
|
+
const n = ["defaultValue", "disabled", "error", "required", "value"].filter((l) => i[l] !== void 0);
|
|
43
|
+
n.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: ${n.join(", ")}`].join(`
|
|
43
44
|
`));
|
|
44
45
|
}
|
|
45
46
|
} else
|
|
46
|
-
|
|
47
|
+
h = s, g = f, x = d, P = S, q = c;
|
|
47
48
|
const {
|
|
48
|
-
current:
|
|
49
|
-
} =
|
|
50
|
-
process.env.NODE_ENV !== "production" &&
|
|
49
|
+
current: H
|
|
50
|
+
} = V.useRef(q != null), K = V.useCallback((n) => {
|
|
51
|
+
process.env.NODE_ENV !== "production" && n && n.nodeName !== "INPUT" && !n.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
52
|
`));
|
|
52
|
-
}, []),
|
|
53
|
-
|
|
54
|
-
!
|
|
55
|
-
}, [
|
|
56
|
-
const
|
|
57
|
-
var
|
|
58
|
-
if (
|
|
59
|
-
|
|
53
|
+
}, []), R = V.useRef(null), j = xe(R, O, K), [T, I] = V.useState(!1);
|
|
54
|
+
V.useEffect(() => {
|
|
55
|
+
!a && g && T && (I(!1), m == null || m());
|
|
56
|
+
}, [a, g, T, m]);
|
|
57
|
+
const $ = (n) => (l) => {
|
|
58
|
+
var r;
|
|
59
|
+
if (a != null && a.disabled) {
|
|
60
|
+
l.stopPropagation();
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
if ((
|
|
63
|
-
var
|
|
64
|
-
|
|
63
|
+
if ((r = n.onFocus) == null || r.call(n, l), a && a.onFocus) {
|
|
64
|
+
var p;
|
|
65
|
+
a == null || (p = a.onFocus) == null || p.call(a);
|
|
65
66
|
} else
|
|
66
67
|
I(!0);
|
|
67
|
-
},
|
|
68
|
-
var
|
|
69
|
-
(
|
|
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
|
-
|
|
75
|
-
},
|
|
76
|
-
var
|
|
77
|
-
|
|
68
|
+
}, L = (n) => (l) => {
|
|
69
|
+
var r;
|
|
70
|
+
(r = n.onBlur) == null || r.call(n, l), a && a.onBlur ? a.onBlur() : I(!1);
|
|
71
|
+
}, Y = (n) => (l, ...r) => {
|
|
72
|
+
var p, E;
|
|
73
|
+
if (!H && (l.target || R.current) == null)
|
|
74
|
+
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." : Re(17));
|
|
75
|
+
a == null || (p = a.onChange) == null || p.call(a, l), (E = n.onChange) == null || E.call(n, l, ...r);
|
|
76
|
+
}, W = (n) => (l) => {
|
|
77
|
+
var r;
|
|
78
|
+
R.current && l.currentTarget === l.target && R.current.focus(), (r = n.onClick) == null || r.call(n, l);
|
|
78
79
|
};
|
|
79
80
|
return {
|
|
80
|
-
disabled:
|
|
81
|
-
error:
|
|
82
|
-
focused:
|
|
83
|
-
formControlContext:
|
|
84
|
-
getInputProps: (
|
|
85
|
-
const
|
|
86
|
-
onBlur:
|
|
87
|
-
onChange:
|
|
88
|
-
onFocus:
|
|
89
|
-
},
|
|
90
|
-
onBlur:
|
|
91
|
-
onChange:
|
|
92
|
-
onFocus:
|
|
81
|
+
disabled: g,
|
|
82
|
+
error: x,
|
|
83
|
+
focused: T,
|
|
84
|
+
formControlContext: a,
|
|
85
|
+
getInputProps: (n = {}) => {
|
|
86
|
+
const r = v({}, {
|
|
87
|
+
onBlur: m,
|
|
88
|
+
onChange: N,
|
|
89
|
+
onFocus: F
|
|
90
|
+
}, ue(n)), p = v({}, r, {
|
|
91
|
+
onBlur: L(r),
|
|
92
|
+
onChange: Y(r),
|
|
93
|
+
onFocus: $(r)
|
|
93
94
|
});
|
|
94
|
-
return
|
|
95
|
-
"aria-invalid":
|
|
96
|
-
defaultValue:
|
|
97
|
-
value:
|
|
98
|
-
required:
|
|
99
|
-
disabled:
|
|
100
|
-
},
|
|
101
|
-
ref:
|
|
102
|
-
},
|
|
95
|
+
return v({}, p, {
|
|
96
|
+
"aria-invalid": x || void 0,
|
|
97
|
+
defaultValue: h,
|
|
98
|
+
value: q,
|
|
99
|
+
required: P,
|
|
100
|
+
disabled: g
|
|
101
|
+
}, n, {
|
|
102
|
+
ref: j
|
|
103
|
+
}, p);
|
|
103
104
|
},
|
|
104
|
-
getRootProps: (
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
onClick:
|
|
105
|
+
getRootProps: (n = {}) => {
|
|
106
|
+
const l = ue(i, ["onBlur", "onChange", "onFocus"]), r = v({}, l, ue(n));
|
|
107
|
+
return v({}, n, r, {
|
|
108
|
+
onClick: W(r)
|
|
108
109
|
});
|
|
109
110
|
},
|
|
110
|
-
inputRef:
|
|
111
|
-
required:
|
|
112
|
-
value:
|
|
111
|
+
inputRef: j,
|
|
112
|
+
required: P,
|
|
113
|
+
value: q
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
|
-
const
|
|
116
|
+
const Se = ["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"], Oe = (i) => {
|
|
116
117
|
const {
|
|
117
|
-
disabled:
|
|
118
|
-
error:
|
|
119
|
-
focused:
|
|
120
|
-
formControlContext:
|
|
121
|
-
multiline:
|
|
122
|
-
startAdornment:
|
|
123
|
-
endAdornment:
|
|
124
|
-
} =
|
|
125
|
-
return
|
|
126
|
-
root: ["root",
|
|
127
|
-
input: ["input",
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
var
|
|
118
|
+
disabled: s,
|
|
119
|
+
error: f,
|
|
120
|
+
focused: d,
|
|
121
|
+
formControlContext: m,
|
|
122
|
+
multiline: N,
|
|
123
|
+
startAdornment: F,
|
|
124
|
+
endAdornment: S
|
|
125
|
+
} = i;
|
|
126
|
+
return qe({
|
|
127
|
+
root: ["root", s && "disabled", f && "error", d && "focused", !!m && "formControl", N && "multiline", !!F && "adornedStart", !!S && "adornedEnd"],
|
|
128
|
+
input: ["input", s && "disabled", N && "multiline"]
|
|
129
|
+
}, Pe(Ee));
|
|
130
|
+
}, ce = /* @__PURE__ */ V.forwardRef(function(s, f) {
|
|
131
|
+
var d, m, N;
|
|
131
132
|
const {
|
|
132
|
-
"aria-describedby":
|
|
133
|
-
"aria-label":
|
|
134
|
-
"aria-labelledby":
|
|
135
|
-
autoComplete:
|
|
136
|
-
autoFocus:
|
|
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:
|
|
133
|
+
"aria-describedby": F,
|
|
134
|
+
"aria-label": S,
|
|
135
|
+
"aria-labelledby": c,
|
|
136
|
+
autoComplete: O,
|
|
137
|
+
autoFocus: a,
|
|
138
|
+
className: h,
|
|
139
|
+
defaultValue: g,
|
|
140
|
+
disabled: x,
|
|
141
|
+
endAdornment: P,
|
|
142
|
+
error: q,
|
|
143
|
+
id: C,
|
|
144
|
+
multiline: b = !1,
|
|
145
|
+
name: U,
|
|
146
|
+
onClick: H,
|
|
147
|
+
onChange: K,
|
|
148
|
+
onKeyDown: R,
|
|
149
|
+
onKeyUp: j,
|
|
150
|
+
onFocus: T,
|
|
150
151
|
onBlur: I,
|
|
151
|
-
placeholder:
|
|
152
|
-
readOnly:
|
|
153
|
-
required:
|
|
154
|
-
startAdornment:
|
|
155
|
-
value:
|
|
156
|
-
type:
|
|
157
|
-
rows:
|
|
158
|
-
slotProps:
|
|
159
|
-
slots:
|
|
160
|
-
minRows:
|
|
161
|
-
maxRows:
|
|
162
|
-
} =
|
|
163
|
-
getRootProps:
|
|
164
|
-
getInputProps:
|
|
165
|
-
focused:
|
|
166
|
-
formControlContext:
|
|
167
|
-
error:
|
|
168
|
-
disabled:
|
|
169
|
-
} =
|
|
170
|
-
disabled:
|
|
171
|
-
defaultValue:
|
|
172
|
-
error:
|
|
152
|
+
placeholder: $,
|
|
153
|
+
readOnly: L,
|
|
154
|
+
required: Y,
|
|
155
|
+
startAdornment: W,
|
|
156
|
+
value: e,
|
|
157
|
+
type: z,
|
|
158
|
+
rows: n,
|
|
159
|
+
slotProps: l = {},
|
|
160
|
+
slots: r = {},
|
|
161
|
+
minRows: p,
|
|
162
|
+
maxRows: E
|
|
163
|
+
} = s, J = Ce(s, Se), {
|
|
164
|
+
getRootProps: Z,
|
|
165
|
+
getInputProps: ee,
|
|
166
|
+
focused: te,
|
|
167
|
+
formControlContext: ne,
|
|
168
|
+
error: oe,
|
|
169
|
+
disabled: Q
|
|
170
|
+
} = Fe({
|
|
171
|
+
disabled: x,
|
|
172
|
+
defaultValue: g,
|
|
173
|
+
error: q,
|
|
173
174
|
onBlur: I,
|
|
174
|
-
onClick:
|
|
175
|
-
onChange:
|
|
176
|
-
onFocus:
|
|
177
|
-
required:
|
|
178
|
-
value:
|
|
179
|
-
}),
|
|
180
|
-
disabled:
|
|
181
|
-
error:
|
|
182
|
-
focused:
|
|
183
|
-
formControlContext:
|
|
184
|
-
multiline:
|
|
185
|
-
type:
|
|
186
|
-
}),
|
|
187
|
-
"aria-describedby":
|
|
188
|
-
"aria-label":
|
|
189
|
-
"aria-labelledby":
|
|
190
|
-
autoComplete:
|
|
191
|
-
autoFocus:
|
|
192
|
-
id:
|
|
193
|
-
onKeyDown:
|
|
194
|
-
onKeyUp:
|
|
195
|
-
name:
|
|
196
|
-
placeholder:
|
|
197
|
-
readOnly:
|
|
198
|
-
type:
|
|
199
|
-
},
|
|
200
|
-
elementType:
|
|
201
|
-
getSlotProps:
|
|
202
|
-
externalSlotProps:
|
|
203
|
-
externalForwardedProps:
|
|
175
|
+
onClick: H,
|
|
176
|
+
onChange: K,
|
|
177
|
+
onFocus: T,
|
|
178
|
+
required: Y,
|
|
179
|
+
value: e
|
|
180
|
+
}), G = b ? void 0 : z ?? "text", o = v({}, s, {
|
|
181
|
+
disabled: Q,
|
|
182
|
+
error: oe,
|
|
183
|
+
focused: te,
|
|
184
|
+
formControlContext: ne,
|
|
185
|
+
multiline: b,
|
|
186
|
+
type: G
|
|
187
|
+
}), y = Oe(o), A = {
|
|
188
|
+
"aria-describedby": F,
|
|
189
|
+
"aria-label": S,
|
|
190
|
+
"aria-labelledby": c,
|
|
191
|
+
autoComplete: O,
|
|
192
|
+
autoFocus: a,
|
|
193
|
+
id: C,
|
|
194
|
+
onKeyDown: R,
|
|
195
|
+
onKeyUp: j,
|
|
196
|
+
name: U,
|
|
197
|
+
placeholder: $,
|
|
198
|
+
readOnly: L,
|
|
199
|
+
type: G
|
|
200
|
+
}, u = (d = r.root) != null ? d : "div", B = se({
|
|
201
|
+
elementType: u,
|
|
202
|
+
getSlotProps: Z,
|
|
203
|
+
externalSlotProps: l.root,
|
|
204
|
+
externalForwardedProps: J,
|
|
204
205
|
additionalProps: {
|
|
205
|
-
ref:
|
|
206
|
+
ref: f
|
|
206
207
|
},
|
|
207
|
-
ownerState:
|
|
208
|
-
className: [
|
|
209
|
-
}),
|
|
210
|
-
elementType:
|
|
211
|
-
getSlotProps: (
|
|
212
|
-
externalSlotProps:
|
|
213
|
-
additionalProps:
|
|
214
|
-
rows:
|
|
215
|
-
},
|
|
216
|
-
minRows:
|
|
217
|
-
maxRows:
|
|
208
|
+
ownerState: o,
|
|
209
|
+
className: [y.root, h]
|
|
210
|
+
}), w = b ? (m = r.textarea) != null ? m : "textarea" : (N = r.input) != null ? N : "input", ae = se({
|
|
211
|
+
elementType: w,
|
|
212
|
+
getSlotProps: (X) => ee(v({}, A, X)),
|
|
213
|
+
externalSlotProps: l.input,
|
|
214
|
+
additionalProps: v({
|
|
215
|
+
rows: b ? n : void 0
|
|
216
|
+
}, b && !ve(w) && {
|
|
217
|
+
minRows: n || p,
|
|
218
|
+
maxRows: n || E
|
|
218
219
|
}),
|
|
219
|
-
ownerState:
|
|
220
|
-
className:
|
|
220
|
+
ownerState: o,
|
|
221
|
+
className: y.input
|
|
221
222
|
});
|
|
222
|
-
return process.env.NODE_ENV !== "production" &&
|
|
223
|
-
children: [
|
|
223
|
+
return process.env.NODE_ENV !== "production" && b && n && (p || E) && console.warn("MUI: You can not use the `minRows` or `maxRows` props when the input `rows` prop is set."), /* @__PURE__ */ D(u, v({}, B, {
|
|
224
|
+
children: [W, /* @__PURE__ */ M(w, v({}, ae)), P]
|
|
224
225
|
}));
|
|
225
226
|
});
|
|
226
|
-
process.env.NODE_ENV !== "production" && (
|
|
227
|
+
process.env.NODE_ENV !== "production" && (ce.propTypes = {
|
|
227
228
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
228
229
|
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
229
230
|
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
@@ -231,149 +232,149 @@ process.env.NODE_ENV !== "production" && (se.propTypes = {
|
|
|
231
232
|
/**
|
|
232
233
|
* @ignore
|
|
233
234
|
*/
|
|
234
|
-
"aria-describedby":
|
|
235
|
+
"aria-describedby": t.string,
|
|
235
236
|
/**
|
|
236
237
|
* @ignore
|
|
237
238
|
*/
|
|
238
|
-
"aria-label":
|
|
239
|
+
"aria-label": t.string,
|
|
239
240
|
/**
|
|
240
241
|
* @ignore
|
|
241
242
|
*/
|
|
242
|
-
"aria-labelledby":
|
|
243
|
+
"aria-labelledby": t.string,
|
|
243
244
|
/**
|
|
244
245
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
245
246
|
* The name can be confusing, as it's more like an autofill.
|
|
246
247
|
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
247
248
|
*/
|
|
248
|
-
autoComplete:
|
|
249
|
+
autoComplete: t.string,
|
|
249
250
|
/**
|
|
250
251
|
* If `true`, the `input` element is focused during the first mount.
|
|
251
252
|
*/
|
|
252
|
-
autoFocus:
|
|
253
|
+
autoFocus: t.bool,
|
|
253
254
|
/**
|
|
254
255
|
* Class name applied to the root element.
|
|
255
256
|
*/
|
|
256
|
-
className:
|
|
257
|
+
className: t.string,
|
|
257
258
|
/**
|
|
258
259
|
* The default value. Use when the component is not controlled.
|
|
259
260
|
*/
|
|
260
|
-
defaultValue:
|
|
261
|
+
defaultValue: t.any,
|
|
261
262
|
/**
|
|
262
263
|
* If `true`, the component is disabled.
|
|
263
264
|
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
|
|
264
265
|
*/
|
|
265
|
-
disabled:
|
|
266
|
+
disabled: t.bool,
|
|
266
267
|
/**
|
|
267
268
|
* Trailing adornment for this input.
|
|
268
269
|
*/
|
|
269
|
-
endAdornment:
|
|
270
|
+
endAdornment: t.node,
|
|
270
271
|
/**
|
|
271
272
|
* If `true`, the `input` will indicate an error by setting the `aria-invalid` attribute on the input and the `baseui--error` class on the root element.
|
|
272
273
|
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
|
|
273
274
|
*/
|
|
274
|
-
error:
|
|
275
|
+
error: t.bool,
|
|
275
276
|
/**
|
|
276
277
|
* The id of the `input` element.
|
|
277
278
|
*/
|
|
278
|
-
id:
|
|
279
|
+
id: t.string,
|
|
279
280
|
/**
|
|
280
281
|
* @ignore
|
|
281
282
|
*/
|
|
282
|
-
inputRef:
|
|
283
|
-
current:
|
|
283
|
+
inputRef: t.oneOfType([t.func, t.shape({
|
|
284
|
+
current: t.object
|
|
284
285
|
})]),
|
|
285
286
|
/**
|
|
286
287
|
* Maximum number of rows to display when multiline option is set to true.
|
|
287
288
|
*/
|
|
288
|
-
maxRows:
|
|
289
|
+
maxRows: t.number,
|
|
289
290
|
/**
|
|
290
291
|
* Minimum number of rows to display when multiline option is set to true.
|
|
291
292
|
*/
|
|
292
|
-
minRows:
|
|
293
|
+
minRows: t.number,
|
|
293
294
|
/**
|
|
294
295
|
* If `true`, a `textarea` element is rendered.
|
|
295
296
|
* @default false
|
|
296
297
|
*/
|
|
297
|
-
multiline:
|
|
298
|
+
multiline: t.bool,
|
|
298
299
|
/**
|
|
299
300
|
* Name attribute of the `input` element.
|
|
300
301
|
*/
|
|
301
|
-
name:
|
|
302
|
+
name: t.string,
|
|
302
303
|
/**
|
|
303
304
|
* @ignore
|
|
304
305
|
*/
|
|
305
|
-
onBlur:
|
|
306
|
+
onBlur: t.func,
|
|
306
307
|
/**
|
|
307
308
|
* @ignore
|
|
308
309
|
*/
|
|
309
|
-
onChange:
|
|
310
|
+
onChange: t.func,
|
|
310
311
|
/**
|
|
311
312
|
* @ignore
|
|
312
313
|
*/
|
|
313
|
-
onClick:
|
|
314
|
+
onClick: t.func,
|
|
314
315
|
/**
|
|
315
316
|
* @ignore
|
|
316
317
|
*/
|
|
317
|
-
onFocus:
|
|
318
|
+
onFocus: t.func,
|
|
318
319
|
/**
|
|
319
320
|
* @ignore
|
|
320
321
|
*/
|
|
321
|
-
onKeyDown:
|
|
322
|
+
onKeyDown: t.func,
|
|
322
323
|
/**
|
|
323
324
|
* @ignore
|
|
324
325
|
*/
|
|
325
|
-
onKeyUp:
|
|
326
|
+
onKeyUp: t.func,
|
|
326
327
|
/**
|
|
327
328
|
* The short hint displayed in the `input` before the user enters a value.
|
|
328
329
|
*/
|
|
329
|
-
placeholder:
|
|
330
|
+
placeholder: t.string,
|
|
330
331
|
/**
|
|
331
332
|
* It prevents the user from changing the value of the field
|
|
332
333
|
* (not from interacting with the field).
|
|
333
334
|
*/
|
|
334
|
-
readOnly:
|
|
335
|
+
readOnly: t.bool,
|
|
335
336
|
/**
|
|
336
337
|
* If `true`, the `input` element is required.
|
|
337
338
|
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
|
|
338
339
|
*/
|
|
339
|
-
required:
|
|
340
|
+
required: t.bool,
|
|
340
341
|
/**
|
|
341
342
|
* Number of rows to display when multiline option is set to true.
|
|
342
343
|
*/
|
|
343
|
-
rows:
|
|
344
|
+
rows: t.number,
|
|
344
345
|
/**
|
|
345
346
|
* The props used for each slot inside the Input.
|
|
346
347
|
* @default {}
|
|
347
348
|
*/
|
|
348
|
-
slotProps:
|
|
349
|
-
input:
|
|
350
|
-
root:
|
|
349
|
+
slotProps: t.shape({
|
|
350
|
+
input: t.oneOfType([t.func, t.object]),
|
|
351
|
+
root: t.oneOfType([t.func, t.object])
|
|
351
352
|
}),
|
|
352
353
|
/**
|
|
353
354
|
* The components used for each slot inside the InputBase.
|
|
354
355
|
* Either a string to use a HTML element or a component.
|
|
355
356
|
* @default {}
|
|
356
357
|
*/
|
|
357
|
-
slots:
|
|
358
|
-
input:
|
|
359
|
-
root:
|
|
360
|
-
textarea:
|
|
358
|
+
slots: t.shape({
|
|
359
|
+
input: t.elementType,
|
|
360
|
+
root: t.elementType,
|
|
361
|
+
textarea: t.elementType
|
|
361
362
|
}),
|
|
362
363
|
/**
|
|
363
364
|
* Leading adornment for this input.
|
|
364
365
|
*/
|
|
365
|
-
startAdornment:
|
|
366
|
+
startAdornment: t.node,
|
|
366
367
|
/**
|
|
367
368
|
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
|
|
368
369
|
* @default 'text'
|
|
369
370
|
*/
|
|
370
|
-
type:
|
|
371
|
+
type: t.oneOf(["button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week"]),
|
|
371
372
|
/**
|
|
372
373
|
* The value of the `input` element, required for a controlled component.
|
|
373
374
|
*/
|
|
374
|
-
value:
|
|
375
|
+
value: t.any
|
|
375
376
|
});
|
|
376
|
-
const
|
|
377
|
+
const Te = "_input_101pq_57", Ie = "_input__label_101pq_84", _ = {
|
|
377
378
|
"u-typography-h1": "_u-typography-h1_101pq_1",
|
|
378
379
|
"u-typography-h2": "_u-typography-h2_101pq_8",
|
|
379
380
|
"u-typography-h3": "_u-typography-h3_101pq_15",
|
|
@@ -390,7 +391,7 @@ const Fe = "_input_101pq_57", Ie = "_input__label_101pq_84", p = {
|
|
|
390
391
|
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_101pq_68",
|
|
391
392
|
"u-typography-base--underlined": "_u-typography-base--underlined_101pq_71",
|
|
392
393
|
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_101pq_74",
|
|
393
|
-
input:
|
|
394
|
+
input: Te,
|
|
394
395
|
"input__messages-wrapper": "_input__messages-wrapper_101pq_81",
|
|
395
396
|
input__label: Ie,
|
|
396
397
|
"input__input-el-wrapper": "_input__input-el-wrapper_101pq_89",
|
|
@@ -402,123 +403,159 @@ const Fe = "_input_101pq_57", Ie = "_input__label_101pq_84", p = {
|
|
|
402
403
|
"input--disabled": "_input--disabled_101pq_153",
|
|
403
404
|
"input--focused": "_input--focused_101pq_159",
|
|
404
405
|
"input--error": "_input--error_101pq_162"
|
|
405
|
-
},
|
|
406
|
+
}, He = _e(
|
|
406
407
|
({
|
|
407
|
-
label:
|
|
408
|
-
infoMessage:
|
|
409
|
-
error:
|
|
410
|
-
errorMessage:
|
|
411
|
-
leftIcon:
|
|
412
|
-
rightIcon:
|
|
413
|
-
id:
|
|
414
|
-
disabled:
|
|
415
|
-
type:
|
|
416
|
-
maxLength:
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
"data-testid-
|
|
431
|
-
"data-testid-
|
|
432
|
-
"data-testid-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
408
|
+
label: i,
|
|
409
|
+
infoMessage: s,
|
|
410
|
+
error: f,
|
|
411
|
+
errorMessage: d,
|
|
412
|
+
leftIcon: m,
|
|
413
|
+
rightIcon: N,
|
|
414
|
+
id: F,
|
|
415
|
+
disabled: S,
|
|
416
|
+
type: c = "text",
|
|
417
|
+
maxLength: O,
|
|
418
|
+
isInteger: a,
|
|
419
|
+
useCommaInDecimal: h,
|
|
420
|
+
allowNegativeNumbers: g = !1,
|
|
421
|
+
decimalLength: x = 10,
|
|
422
|
+
hideCharsCounter: P = !1,
|
|
423
|
+
required: q,
|
|
424
|
+
onChange: C,
|
|
425
|
+
classNameWrapper: b,
|
|
426
|
+
classNameLabel: U,
|
|
427
|
+
classNameInput: H,
|
|
428
|
+
classNameInfoMessage: K,
|
|
429
|
+
classNameErrorMessage: R,
|
|
430
|
+
classNameCharsCounter: j,
|
|
431
|
+
"data-testid-wrapper": T,
|
|
432
|
+
"data-testid-label": I,
|
|
433
|
+
"data-testid-input": $,
|
|
434
|
+
"data-testid-infoMessage": L,
|
|
435
|
+
"data-testid-errorMessage": Y,
|
|
436
|
+
"data-testid-charsCounter": W,
|
|
437
|
+
...e
|
|
438
|
+
}, z) => {
|
|
439
|
+
var Q, G;
|
|
440
|
+
const [n, l] = fe(
|
|
441
|
+
((Q = e.value) == null ? void 0 : Q.length) || ((G = e.defaultValue) == null ? void 0 : G.length) || 0
|
|
442
|
+
), r = me(), p = F || `input_${r}`;
|
|
443
|
+
Object.assign(e, { "data-testid": $ });
|
|
444
|
+
const E = O && !P, J = (o) => {
|
|
445
|
+
var y, A;
|
|
446
|
+
if (c === "number-as-text") {
|
|
447
|
+
let u = a ? he(o.target.value) : h ? o.target.value.replace(".", ",") : o.target.value.replace(",", ".");
|
|
448
|
+
if (!a && x > 0) {
|
|
449
|
+
const w = String(u), [ae, X] = w.split(/,|\./);
|
|
450
|
+
w !== "" && X && (u = [ae, X.slice(0, x)].join(h ? "," : "."));
|
|
451
|
+
}
|
|
452
|
+
o.target.value = String(u);
|
|
453
|
+
const B = !isNaN(Number(String(u).replace(",", ".")));
|
|
454
|
+
C == null || C({
|
|
455
|
+
...o,
|
|
456
|
+
target: {
|
|
457
|
+
...o.target,
|
|
458
|
+
value: B && String(u).length ? String(Number(String(u).replace(",", "."))) : "",
|
|
459
|
+
valueAsNumber: B && String(u).length ? Number(String(u).replace(",", ".")) : NaN
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if (c === "number") {
|
|
465
|
+
let u = String(o.target.value);
|
|
466
|
+
const [B, w] = u.split(".");
|
|
467
|
+
u !== "" && (w != null && w.length ? u = [Number(B), w.slice(0, x)].join(".") : u = String(Number(B))), o.target.value = u;
|
|
468
|
+
}
|
|
469
|
+
E && l((A = (y = o == null ? void 0 : o.target) == null ? void 0 : y.value) == null ? void 0 : A.length), C && C(o);
|
|
470
|
+
}, Z = (o) => {
|
|
471
|
+
var y;
|
|
472
|
+
c === "number-as-text" && (a ? ge(o, g) : be(o, g)), (y = e == null ? void 0 : e.onKeyDown) == null || y.call(e, o);
|
|
473
|
+
}, ee = (o) => {
|
|
474
|
+
var y;
|
|
475
|
+
if (c === "number-as-text" && o.target.value.length) {
|
|
476
|
+
const A = a ? o.target.value.replace(/(,\.)/gi, "") : o.target.value.replace(",", ".");
|
|
477
|
+
let u = String(Number(A));
|
|
478
|
+
isNaN(Number(u)) && (u = ""), o.target.value = h ? u.replace(".", ",") : u;
|
|
446
479
|
}
|
|
447
|
-
|
|
448
|
-
},
|
|
449
|
-
type:
|
|
450
|
-
multiline:
|
|
480
|
+
(y = e == null ? void 0 : e.onBlur) == null || y.call(e, o);
|
|
481
|
+
}, te = re(() => e.multiline !== !0 ? {
|
|
482
|
+
type: c === "number-as-text" ? "text" : c,
|
|
483
|
+
multiline: e.multiline
|
|
451
484
|
} : {
|
|
452
485
|
type: void 0,
|
|
453
|
-
multiline:
|
|
454
|
-
rows: (
|
|
455
|
-
minRows:
|
|
456
|
-
maxRows:
|
|
457
|
-
}, [
|
|
458
|
-
return /* @__PURE__ */
|
|
459
|
-
|
|
460
|
-
|
|
486
|
+
multiline: e.multiline,
|
|
487
|
+
rows: (e == null ? void 0 : e.rows) || 5,
|
|
488
|
+
minRows: e == null ? void 0 : e.minRows,
|
|
489
|
+
maxRows: e == null ? void 0 : e.maxRows
|
|
490
|
+
}, [e]), ne = re(() => c === "number-as-text" && (e != null && e.defaultValue) ? ie(e == null ? void 0 : e.defaultValue, h) : e == null ? void 0 : e.defaultValue, [e.defaultValue]), oe = re(() => c === "number-as-text" && (e != null && e.value) ? ie(e == null ? void 0 : e.value, h) : e == null ? void 0 : e.value, [e.value]);
|
|
491
|
+
return /* @__PURE__ */ D("div", { className: k(_.input, b), "data-testid": T, children: [
|
|
492
|
+
i && /* @__PURE__ */ D(
|
|
493
|
+
le,
|
|
461
494
|
{
|
|
462
495
|
bold: !0,
|
|
463
496
|
element: "label",
|
|
464
|
-
elementProps: { htmlFor:
|
|
465
|
-
className:
|
|
466
|
-
"data-testid":
|
|
497
|
+
elementProps: { htmlFor: p },
|
|
498
|
+
className: k(_.input__label, U),
|
|
499
|
+
"data-testid": I,
|
|
467
500
|
children: [
|
|
468
|
-
|
|
469
|
-
|
|
501
|
+
i,
|
|
502
|
+
q && /* @__PURE__ */ M("span", { children: "*" })
|
|
470
503
|
]
|
|
471
504
|
}
|
|
472
505
|
),
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
|
|
506
|
+
/* @__PURE__ */ M(
|
|
507
|
+
ce,
|
|
475
508
|
{
|
|
476
|
-
id:
|
|
477
|
-
disabled:
|
|
478
|
-
error: typeof
|
|
479
|
-
"aria-label":
|
|
509
|
+
id: p,
|
|
510
|
+
disabled: S,
|
|
511
|
+
error: typeof f == "boolean" ? f : !!d,
|
|
512
|
+
"aria-label": i,
|
|
480
513
|
slotProps: {
|
|
481
|
-
root: (
|
|
482
|
-
className:
|
|
483
|
-
[
|
|
484
|
-
[
|
|
485
|
-
[
|
|
514
|
+
root: (o) => ({
|
|
515
|
+
className: k(_["input__input-el-wrapper"], {
|
|
516
|
+
[_["input--disabled"]]: o.disabled,
|
|
517
|
+
[_["input--focused"]]: o.focused,
|
|
518
|
+
[_["input--error"]]: o.error
|
|
486
519
|
})
|
|
487
520
|
}),
|
|
488
521
|
input: {
|
|
489
|
-
ref:
|
|
490
|
-
className:
|
|
491
|
-
maxLength:
|
|
492
|
-
onChange:
|
|
493
|
-
...
|
|
522
|
+
ref: z,
|
|
523
|
+
className: k(_["input__input-el"], H),
|
|
524
|
+
maxLength: O,
|
|
525
|
+
onChange: J,
|
|
526
|
+
...e,
|
|
527
|
+
onKeyDown: Z,
|
|
528
|
+
onBlur: ee,
|
|
529
|
+
defaultValue: ne,
|
|
530
|
+
value: oe
|
|
494
531
|
}
|
|
495
532
|
},
|
|
496
|
-
startAdornment:
|
|
497
|
-
endAdornment:
|
|
498
|
-
...
|
|
533
|
+
startAdornment: m && /* @__PURE__ */ M("span", { className: _["input__left-icon"], children: m }),
|
|
534
|
+
endAdornment: N && /* @__PURE__ */ M("span", { className: _["input__right-icon"], children: N }),
|
|
535
|
+
...te
|
|
499
536
|
}
|
|
500
537
|
),
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
(
|
|
503
|
-
|
|
538
|
+
/* @__PURE__ */ D("div", { className: _["input__messages-wrapper"], children: [
|
|
539
|
+
(d || s) && /* @__PURE__ */ D(
|
|
540
|
+
le,
|
|
504
541
|
{
|
|
505
|
-
className:
|
|
506
|
-
"data-testid":
|
|
542
|
+
className: d ? k(_["input__error-message"], R) : k(_["input__info-message"], K),
|
|
543
|
+
"data-testid": d ? Y : L,
|
|
507
544
|
children: [
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
|
|
545
|
+
/* @__PURE__ */ M(ye, { icon: d ? "circle-exclamation" : "circle-info" }),
|
|
546
|
+
d || s
|
|
510
547
|
]
|
|
511
548
|
}
|
|
512
549
|
),
|
|
513
|
-
|
|
514
|
-
|
|
550
|
+
E && /* @__PURE__ */ D(
|
|
551
|
+
le,
|
|
515
552
|
{
|
|
516
|
-
className:
|
|
517
|
-
"data-testid":
|
|
553
|
+
className: k(_["input__chars-counter"], j),
|
|
554
|
+
"data-testid": W,
|
|
518
555
|
children: [
|
|
519
|
-
|
|
556
|
+
n,
|
|
520
557
|
" / ",
|
|
521
|
-
|
|
558
|
+
O
|
|
522
559
|
]
|
|
523
560
|
}
|
|
524
561
|
)
|
|
@@ -527,5 +564,5 @@ const Fe = "_input_101pq_57", Ie = "_input__label_101pq_84", p = {
|
|
|
527
564
|
}
|
|
528
565
|
);
|
|
529
566
|
export {
|
|
530
|
-
|
|
567
|
+
He as Input
|
|
531
568
|
};
|