@clearstory/drywall-react 3.4.0 → 3.5.0
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/{AdapterDayjs-onBBJ8Hr.js → AdapterDayjs-BbRw4Xr1.js} +1 -1
- package/dist/{Autocomplete-CfXcTXLL.js → Autocomplete-BjL4YeDS.js} +1 -1
- package/dist/{Button-B4158Ttr.js → Button-6w4XBJj2.js} +1 -3
- package/dist/{Chip-BzXGbbX1.js → Chip-BqSPADPe.js} +1 -3
- package/dist/{Datepicker-CJBEgBsm.js → Datepicker-BW_oZhpV.js} +2 -2
- package/dist/SelectControl-uhYAlpEk.js +1041 -0
- package/dist/components/Autocomplete/Autocomplete.js +1 -1
- package/dist/components/Autocomplete/index.js +1 -1
- package/dist/components/AutocompleteControl/AutocompleteControl.js +6 -4
- package/dist/components/AutocompleteControl/index.js +1 -1
- package/dist/components/Button/Button.d.ts +7 -0
- package/dist/components/Button/Button.js +11 -0
- package/dist/components/Button/Button.theme.js +30 -5
- package/dist/components/Button/Button.types.d.ts +6 -0
- package/dist/components/Button/Button.types.js +1 -0
- package/dist/components/Button/index.d.ts +4 -2
- package/dist/components/Button/index.js +3 -4
- package/dist/components/Chip/Chip.d.ts +7 -0
- package/dist/components/Chip/Chip.js +11 -0
- package/dist/components/Chip/Chip.theme.js +31 -6
- package/dist/components/Chip/Chip.types.d.ts +6 -0
- package/dist/components/Chip/Chip.types.js +1 -0
- package/dist/components/Chip/index.d.ts +4 -2
- package/dist/components/Chip/index.js +3 -4
- package/dist/components/Datepicker/Datepicker.js +1 -1
- package/dist/components/Datepicker/index.js +2 -2
- package/dist/components/DatepickerControl/DatepickerControl.d.ts +1 -0
- package/dist/components/DatepickerControl/DatepickerControl.js +6 -4
- package/dist/components/DatepickerControl/index.js +1 -1
- package/dist/components/FormSublabel/FormSublabel.js +6 -4
- package/dist/components/FormSublabel/index.js +1 -1
- package/dist/components/InputControl/InputControl.js +6 -4
- package/dist/components/InputControl/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.d.ts +28 -0
- package/dist/components/NumberInput/NumberInput.js +26 -0
- package/dist/components/NumberInput/index.d.ts +1 -0
- package/dist/components/NumberInput/index.js +4 -0
- package/dist/components/NumberInputControl/NumberInputControl.d.ts +18 -0
- package/dist/components/NumberInputControl/NumberInputControl.js +32 -0
- package/dist/components/NumberInputControl/index.d.ts +1 -0
- package/dist/components/NumberInputControl/index.js +4 -0
- package/dist/components/SelectControl/SelectControl.js +6 -4
- package/dist/components/SelectControl/index.js +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +379 -381
- package/package.json +4 -3
- package/dist/SelectControl-DEUgj2Ie.js +0 -321
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
import { jsxs as Z, jsx as I } from "react/jsx-runtime";
|
|
2
|
+
import ee, { forwardRef as ae, useRef as re, useState as Be, useEffect as Se, useLayoutEffect as qe, useMemo as Pe } from "react";
|
|
3
|
+
import { useId as ue } from "./hooks/useId.js";
|
|
4
|
+
import "./icons/ClearstoryIcon.js";
|
|
5
|
+
import "./icons/InternalOnlyIcon.js";
|
|
6
|
+
import "./icons/MoneyBucketIcon.js";
|
|
7
|
+
import "./icons/MoreCircleOutlineIcon.js";
|
|
8
|
+
import { I as fe } from "./Info-DtWHV9kz.js";
|
|
9
|
+
import "./theme/index.js";
|
|
10
|
+
import { A as He } from "./Autocomplete-BjL4YeDS.js";
|
|
11
|
+
import "./components/Button/Button.js";
|
|
12
|
+
import "./components/Chip/Chip.js";
|
|
13
|
+
import { D as ze } from "./Datepicker-BW_oZhpV.js";
|
|
14
|
+
import "./components/DescriptionDetails/DescriptionDetails.js";
|
|
15
|
+
import "./components/DescriptionList/DescriptionList.js";
|
|
16
|
+
import "./components/DescriptionList/DescriptionListContext.js";
|
|
17
|
+
import "./components/DescriptionTerm/DescriptionTerm.js";
|
|
18
|
+
import { Input as Ee } from "./components/Input/Input.js";
|
|
19
|
+
import { Select as Je } from "./components/Select/Select.js";
|
|
20
|
+
import "./theme/internal.js";
|
|
21
|
+
import "./components/ToastContainer/ToastContainer.js";
|
|
22
|
+
import "./components/ToastContainer/ToastLabelContext.js";
|
|
23
|
+
import "./index-SzwnPTHF.js";
|
|
24
|
+
import { F as ce } from "./FormControl-CuHXXTcL.js";
|
|
25
|
+
import { B as de } from "./Box-CKDKtm7F.js";
|
|
26
|
+
import { F as se } from "./FormLabel-CgNd8XLN.js";
|
|
27
|
+
import { T as ve } from "./Tooltip-BJmTHiZe.js";
|
|
28
|
+
import { F as ne } from "./FormHelperText-wucHHOG8.js";
|
|
29
|
+
import { s as Qe } from "./styled-fvngWWLy.js";
|
|
30
|
+
function Xe(e, r) {
|
|
31
|
+
const {
|
|
32
|
+
disabled: t,
|
|
33
|
+
error: n,
|
|
34
|
+
helperText: a,
|
|
35
|
+
id: i,
|
|
36
|
+
label: o,
|
|
37
|
+
required: d,
|
|
38
|
+
slotProps: m,
|
|
39
|
+
sublabel: g,
|
|
40
|
+
tooltip: s,
|
|
41
|
+
...v
|
|
42
|
+
} = e, h = ue("autocomplete"), c = i || h, u = a ? `${c}-helper` : void 0;
|
|
43
|
+
return /* @__PURE__ */ Z(ce, { disabled: t, error: n, ...m?.root, children: [
|
|
44
|
+
/* @__PURE__ */ Z(
|
|
45
|
+
de,
|
|
46
|
+
{
|
|
47
|
+
sx: {
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
display: "flex",
|
|
50
|
+
gap: "0.25rem"
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ I(se, { htmlFor: c, required: d, ...m?.label, children: o }),
|
|
54
|
+
s && /* @__PURE__ */ I(ve, { title: s, arrow: !0, children: /* @__PURE__ */ I(
|
|
55
|
+
fe,
|
|
56
|
+
{
|
|
57
|
+
sx: ({ vars: S }) => ({
|
|
58
|
+
color: S?.palette.text.secondary,
|
|
59
|
+
marginBlockEnd: "3px",
|
|
60
|
+
height: "1rem",
|
|
61
|
+
width: "1rem"
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
) })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
g && /* @__PURE__ */ I(me, { ...m?.sublabel, children: g }),
|
|
69
|
+
/* @__PURE__ */ I(
|
|
70
|
+
He,
|
|
71
|
+
{
|
|
72
|
+
disabled: t,
|
|
73
|
+
ref: r,
|
|
74
|
+
error: n,
|
|
75
|
+
id: c,
|
|
76
|
+
"aria-describedby": u ? v["aria-describedby"] ? `${v["aria-describedby"]} ${u}` : u : v["aria-describedby"],
|
|
77
|
+
...v
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
a && /* @__PURE__ */ I(ne, { id: u, ...m?.helperText, children: a })
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
const Ye = ae(
|
|
84
|
+
Xe
|
|
85
|
+
);
|
|
86
|
+
Ye.displayName = "AutocompleteControl";
|
|
87
|
+
const er = ae(
|
|
88
|
+
({
|
|
89
|
+
disabled: e = !1,
|
|
90
|
+
error: r = !1,
|
|
91
|
+
fullWidth: t,
|
|
92
|
+
helperText: n,
|
|
93
|
+
label: a,
|
|
94
|
+
required: i = !1,
|
|
95
|
+
slotProps: o = {},
|
|
96
|
+
sublabel: d,
|
|
97
|
+
tooltip: m,
|
|
98
|
+
name: g,
|
|
99
|
+
value: s,
|
|
100
|
+
onChange: v,
|
|
101
|
+
onAccept: h,
|
|
102
|
+
onClose: c,
|
|
103
|
+
onOpen: u,
|
|
104
|
+
format: S,
|
|
105
|
+
views: V,
|
|
106
|
+
openTo: b,
|
|
107
|
+
disableFuture: E,
|
|
108
|
+
disablePast: F,
|
|
109
|
+
minDate: j,
|
|
110
|
+
maxDate: _,
|
|
111
|
+
closeOnSelect: K,
|
|
112
|
+
readOnly: U,
|
|
113
|
+
clearable: w,
|
|
114
|
+
reduceAnimations: k,
|
|
115
|
+
...G
|
|
116
|
+
}, M) => {
|
|
117
|
+
const W = ue("datepicker"), L = g || W, q = n ? `${L}-helper` : void 0;
|
|
118
|
+
return /* @__PURE__ */ Z(
|
|
119
|
+
ce,
|
|
120
|
+
{
|
|
121
|
+
disabled: e,
|
|
122
|
+
error: r,
|
|
123
|
+
fullWidth: t,
|
|
124
|
+
...o.root,
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ Z(
|
|
127
|
+
de,
|
|
128
|
+
{
|
|
129
|
+
sx: {
|
|
130
|
+
alignItems: "center",
|
|
131
|
+
display: "flex",
|
|
132
|
+
gap: "0.25rem"
|
|
133
|
+
},
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ I(se, { htmlFor: L, required: i, ...o.label, children: a }),
|
|
136
|
+
m && /* @__PURE__ */ I(ve, { title: m, arrow: !0, children: /* @__PURE__ */ I(
|
|
137
|
+
fe,
|
|
138
|
+
{
|
|
139
|
+
sx: ({ vars: Q }) => ({
|
|
140
|
+
color: Q?.palette.text.secondary,
|
|
141
|
+
marginBlockEnd: "3px",
|
|
142
|
+
height: "1rem",
|
|
143
|
+
width: "1rem"
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
) })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
d && /* @__PURE__ */ I(me, { ...o.sublabel, children: d }),
|
|
151
|
+
/* @__PURE__ */ I(
|
|
152
|
+
ze,
|
|
153
|
+
{
|
|
154
|
+
ref: M,
|
|
155
|
+
disabled: e,
|
|
156
|
+
name: L,
|
|
157
|
+
value: s,
|
|
158
|
+
onChange: v,
|
|
159
|
+
onAccept: h,
|
|
160
|
+
onClose: c,
|
|
161
|
+
onOpen: u,
|
|
162
|
+
format: S,
|
|
163
|
+
views: V,
|
|
164
|
+
openTo: b,
|
|
165
|
+
disableFuture: E,
|
|
166
|
+
disablePast: F,
|
|
167
|
+
minDate: j,
|
|
168
|
+
maxDate: _,
|
|
169
|
+
closeOnSelect: K,
|
|
170
|
+
readOnly: U,
|
|
171
|
+
clearable: w,
|
|
172
|
+
reduceAnimations: k,
|
|
173
|
+
error: r,
|
|
174
|
+
slotProps: {
|
|
175
|
+
field: {
|
|
176
|
+
id: L,
|
|
177
|
+
"aria-describedby": q,
|
|
178
|
+
...t && { sx: { width: "100%" } }
|
|
179
|
+
},
|
|
180
|
+
popper: {
|
|
181
|
+
"aria-label": `Date picker${typeof a == "string" && ` for ${a}`}`
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
...G
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
n && /* @__PURE__ */ I(ne, { id: q, ...o.helperText, children: n })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
er.displayName = "DatepickerControl";
|
|
194
|
+
const me = Qe(ne)(() => ({
|
|
195
|
+
marginBlockStart: 0,
|
|
196
|
+
marginBlockEnd: "3px",
|
|
197
|
+
marginInline: 0
|
|
198
|
+
})), rr = ae(
|
|
199
|
+
({
|
|
200
|
+
disabled: e,
|
|
201
|
+
error: r,
|
|
202
|
+
fullWidth: t,
|
|
203
|
+
helperText: n,
|
|
204
|
+
id: a,
|
|
205
|
+
label: i,
|
|
206
|
+
required: o,
|
|
207
|
+
slotProps: d,
|
|
208
|
+
sublabel: m,
|
|
209
|
+
tooltip: g,
|
|
210
|
+
...s
|
|
211
|
+
}, v) => {
|
|
212
|
+
const h = ue("input"), c = a || h, u = n ? `${c}-helper` : void 0;
|
|
213
|
+
return /* @__PURE__ */ Z(
|
|
214
|
+
ce,
|
|
215
|
+
{
|
|
216
|
+
disabled: e,
|
|
217
|
+
error: r,
|
|
218
|
+
fullWidth: t,
|
|
219
|
+
...d?.root,
|
|
220
|
+
children: [
|
|
221
|
+
/* @__PURE__ */ Z(
|
|
222
|
+
de,
|
|
223
|
+
{
|
|
224
|
+
sx: {
|
|
225
|
+
alignItems: "center",
|
|
226
|
+
display: "flex",
|
|
227
|
+
gap: "0.25rem"
|
|
228
|
+
},
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ I(
|
|
231
|
+
se,
|
|
232
|
+
{
|
|
233
|
+
htmlFor: c,
|
|
234
|
+
required: o,
|
|
235
|
+
...d?.label,
|
|
236
|
+
children: i
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
g && /* @__PURE__ */ I(ve, { title: g, arrow: !0, children: /* @__PURE__ */ I(
|
|
240
|
+
fe,
|
|
241
|
+
{
|
|
242
|
+
sx: ({ vars: S }) => ({
|
|
243
|
+
color: S?.palette.text.secondary,
|
|
244
|
+
marginBlockEnd: "3px",
|
|
245
|
+
height: "1rem",
|
|
246
|
+
width: "1rem"
|
|
247
|
+
})
|
|
248
|
+
}
|
|
249
|
+
) })
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
m && /* @__PURE__ */ I(me, { ...d?.sublabel, children: m }),
|
|
254
|
+
/* @__PURE__ */ I(
|
|
255
|
+
Ee,
|
|
256
|
+
{
|
|
257
|
+
ref: v,
|
|
258
|
+
disabled: e,
|
|
259
|
+
error: r,
|
|
260
|
+
fullWidth: t,
|
|
261
|
+
id: c,
|
|
262
|
+
"aria-describedby": u ? s["aria-describedby"] ? `${s["aria-describedby"]} ${u}` : u : s["aria-describedby"],
|
|
263
|
+
...s
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
n && /* @__PURE__ */ I(ne, { id: u, ...d?.helperText, children: n })
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
rr.displayName = "InputControl";
|
|
273
|
+
function Fe(e, r) {
|
|
274
|
+
var t = {};
|
|
275
|
+
for (var n in e)
|
|
276
|
+
Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
|
|
277
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
278
|
+
for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
|
|
279
|
+
r.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (t[n[a]] = e[n[a]]);
|
|
280
|
+
return t;
|
|
281
|
+
}
|
|
282
|
+
var oe;
|
|
283
|
+
(function(e) {
|
|
284
|
+
e.event = "event", e.props = "prop";
|
|
285
|
+
})(oe || (oe = {}));
|
|
286
|
+
function J() {
|
|
287
|
+
}
|
|
288
|
+
function tr(e) {
|
|
289
|
+
var r, t = void 0;
|
|
290
|
+
return function() {
|
|
291
|
+
for (var n = [], a = arguments.length; a--; ) n[a] = arguments[a];
|
|
292
|
+
return r && n.length === r.length && n.every(function(i, o) {
|
|
293
|
+
return i === r[o];
|
|
294
|
+
}) || (r = n, t = e.apply(void 0, n)), t;
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function le(e) {
|
|
298
|
+
return !!(e || "").match(/\d/);
|
|
299
|
+
}
|
|
300
|
+
function te(e) {
|
|
301
|
+
return e == null;
|
|
302
|
+
}
|
|
303
|
+
function ar(e) {
|
|
304
|
+
return typeof e == "number" && isNaN(e);
|
|
305
|
+
}
|
|
306
|
+
function Te(e) {
|
|
307
|
+
return te(e) || ar(e) || typeof e == "number" && !isFinite(e);
|
|
308
|
+
}
|
|
309
|
+
function Oe(e) {
|
|
310
|
+
return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
311
|
+
}
|
|
312
|
+
function nr(e) {
|
|
313
|
+
switch (e) {
|
|
314
|
+
case "lakh":
|
|
315
|
+
return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
|
|
316
|
+
case "wan":
|
|
317
|
+
return /(\d)(?=(\d{4})+(?!\d))/g;
|
|
318
|
+
case "thousand":
|
|
319
|
+
default:
|
|
320
|
+
return /(\d)(?=(\d{3})+(?!\d))/g;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
function ir(e, r, t) {
|
|
324
|
+
var n = nr(t), a = e.search(/[1-9]/);
|
|
325
|
+
return a = a === -1 ? e.length : a, e.substring(0, a) + e.substring(a, e.length).replace(n, "$1" + r);
|
|
326
|
+
}
|
|
327
|
+
function or(e) {
|
|
328
|
+
var r = re(e);
|
|
329
|
+
r.current = e;
|
|
330
|
+
var t = re(function() {
|
|
331
|
+
for (var n = [], a = arguments.length; a--; ) n[a] = arguments[a];
|
|
332
|
+
return r.current.apply(r, n);
|
|
333
|
+
});
|
|
334
|
+
return t.current;
|
|
335
|
+
}
|
|
336
|
+
function we(e, r) {
|
|
337
|
+
r === void 0 && (r = !0);
|
|
338
|
+
var t = e[0] === "-", n = t && r;
|
|
339
|
+
e = e.replace("-", "");
|
|
340
|
+
var a = e.split("."), i = a[0], o = a[1] || "";
|
|
341
|
+
return {
|
|
342
|
+
beforeDecimal: i,
|
|
343
|
+
afterDecimal: o,
|
|
344
|
+
hasNegation: t,
|
|
345
|
+
addNegation: n
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function lr(e) {
|
|
349
|
+
if (!e)
|
|
350
|
+
return e;
|
|
351
|
+
var r = e[0] === "-";
|
|
352
|
+
r && (e = e.substring(1, e.length));
|
|
353
|
+
var t = e.split("."), n = t[0].replace(/^0+/, "") || "0", a = t[1] || "";
|
|
354
|
+
return (r ? "-" : "") + n + (a ? "." + a : "");
|
|
355
|
+
}
|
|
356
|
+
function Re(e, r, t) {
|
|
357
|
+
for (var n = "", a = t ? "0" : "", i = 0; i <= r - 1; i++)
|
|
358
|
+
n += e[i] || a;
|
|
359
|
+
return n;
|
|
360
|
+
}
|
|
361
|
+
function Ve(e, r) {
|
|
362
|
+
return Array(r + 1).join(e);
|
|
363
|
+
}
|
|
364
|
+
function _e(e) {
|
|
365
|
+
var r = e + "", t = r[0] === "-" ? "-" : "";
|
|
366
|
+
t && (r = r.substring(1));
|
|
367
|
+
var n = r.split(/[eE]/g), a = n[0], i = n[1];
|
|
368
|
+
if (i = Number(i), !i)
|
|
369
|
+
return t + a;
|
|
370
|
+
a = a.replace(".", "");
|
|
371
|
+
var o = 1 + i, d = a.length;
|
|
372
|
+
return o < 0 ? a = "0." + Ve("0", Math.abs(o)) + a : o >= d ? a = a + Ve("0", o - d) : a = (a.substring(0, o) || "0") + "." + a.substring(o), t + a;
|
|
373
|
+
}
|
|
374
|
+
function De(e, r, t) {
|
|
375
|
+
if (["", "-"].indexOf(e) !== -1)
|
|
376
|
+
return e;
|
|
377
|
+
var n = (e.indexOf(".") !== -1 || t) && r, a = we(e), i = a.beforeDecimal, o = a.afterDecimal, d = a.hasNegation, m = parseFloat("0." + (o || "0")), g = o.length <= r ? "0." + o : m.toFixed(r), s = g.split("."), v = i;
|
|
378
|
+
i && Number(s[0]) && (v = i.split("").reverse().reduce(function(S, V, b) {
|
|
379
|
+
return S.length > b ? (Number(S[0]) + Number(V)).toString() + S.substring(1, S.length) : V + S;
|
|
380
|
+
}, s[0]));
|
|
381
|
+
var h = Re(s[1] || "", r, t), c = d ? "-" : "", u = n ? "." : "";
|
|
382
|
+
return "" + c + v + u + h;
|
|
383
|
+
}
|
|
384
|
+
function X(e, r) {
|
|
385
|
+
if (e.value = e.value, e !== null) {
|
|
386
|
+
if (e.createTextRange) {
|
|
387
|
+
var t = e.createTextRange();
|
|
388
|
+
return t.move("character", r), t.select(), !0;
|
|
389
|
+
}
|
|
390
|
+
return e.selectionStart || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(r, r), !0) : (e.focus(), !1);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
var ke = tr(function(e, r) {
|
|
394
|
+
for (var t = 0, n = 0, a = e.length, i = r.length; e[t] === r[t] && t < a; )
|
|
395
|
+
t++;
|
|
396
|
+
for (; e[a - 1 - n] === r[i - 1 - n] && i - n > t && a - n > t; )
|
|
397
|
+
n++;
|
|
398
|
+
return {
|
|
399
|
+
from: { start: t, end: a - n },
|
|
400
|
+
to: { start: t, end: i - n }
|
|
401
|
+
};
|
|
402
|
+
}), ur = function(e, r) {
|
|
403
|
+
var t = Math.min(e.selectionStart, r);
|
|
404
|
+
return {
|
|
405
|
+
from: { start: t, end: e.selectionEnd },
|
|
406
|
+
to: { start: t, end: r }
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
function fr(e, r, t) {
|
|
410
|
+
return Math.min(Math.max(e, r), t);
|
|
411
|
+
}
|
|
412
|
+
function Ie(e) {
|
|
413
|
+
return Math.max(e.selectionStart, e.selectionEnd);
|
|
414
|
+
}
|
|
415
|
+
function cr() {
|
|
416
|
+
return typeof navigator < "u" && !(navigator.platform && /iPhone|iPod/.test(navigator.platform));
|
|
417
|
+
}
|
|
418
|
+
function dr(e) {
|
|
419
|
+
return {
|
|
420
|
+
from: {
|
|
421
|
+
start: 0,
|
|
422
|
+
end: 0
|
|
423
|
+
},
|
|
424
|
+
to: {
|
|
425
|
+
start: 0,
|
|
426
|
+
end: e.length
|
|
427
|
+
},
|
|
428
|
+
lastValue: ""
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function sr(e) {
|
|
432
|
+
var r = e.currentValue, t = e.formattedValue, n = e.currentValueIndex, a = e.formattedValueIndex;
|
|
433
|
+
return r[n] === t[a];
|
|
434
|
+
}
|
|
435
|
+
function vr(e, r, t, n, a, i, o) {
|
|
436
|
+
o === void 0 && (o = sr);
|
|
437
|
+
var d = a.findIndex(function(j) {
|
|
438
|
+
return j;
|
|
439
|
+
}), m = e.slice(0, d);
|
|
440
|
+
!r && !t.startsWith(m) && (r = m, t = m + t, n = n + m.length);
|
|
441
|
+
for (var g = t.length, s = e.length, v = {}, h = new Array(g), c = 0; c < g; c++) {
|
|
442
|
+
h[c] = -1;
|
|
443
|
+
for (var u = 0, S = s; u < S; u++) {
|
|
444
|
+
var V = o({
|
|
445
|
+
currentValue: t,
|
|
446
|
+
lastValue: r,
|
|
447
|
+
formattedValue: e,
|
|
448
|
+
currentValueIndex: c,
|
|
449
|
+
formattedValueIndex: u
|
|
450
|
+
});
|
|
451
|
+
if (V && v[u] !== !0) {
|
|
452
|
+
h[c] = u, v[u] = !0;
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
for (var b = n; b < g && (h[b] === -1 || !i(t[b])); )
|
|
458
|
+
b++;
|
|
459
|
+
var E = b === g || h[b] === -1 ? s : h[b];
|
|
460
|
+
for (b = n - 1; b > 0 && h[b] === -1; )
|
|
461
|
+
b--;
|
|
462
|
+
var F = b === -1 || h[b] === -1 ? 0 : h[b] + 1;
|
|
463
|
+
return F > E ? E : n - F < E - n ? F : E;
|
|
464
|
+
}
|
|
465
|
+
function Ce(e, r, t, n) {
|
|
466
|
+
var a = e.length;
|
|
467
|
+
if (r = fr(r, 0, a), n === "left") {
|
|
468
|
+
for (; r >= 0 && !t[r]; )
|
|
469
|
+
r--;
|
|
470
|
+
r === -1 && (r = t.indexOf(!0));
|
|
471
|
+
} else {
|
|
472
|
+
for (; r <= a && !t[r]; )
|
|
473
|
+
r++;
|
|
474
|
+
r > a && (r = t.lastIndexOf(!0));
|
|
475
|
+
}
|
|
476
|
+
return r === -1 && (r = a), r;
|
|
477
|
+
}
|
|
478
|
+
function mr(e) {
|
|
479
|
+
for (var r = Array.from({ length: e.length + 1 }).map(function() {
|
|
480
|
+
return !0;
|
|
481
|
+
}), t = 0, n = r.length; t < n; t++)
|
|
482
|
+
r[t] = !!(le(e[t]) || le(e[t - 1]));
|
|
483
|
+
return r;
|
|
484
|
+
}
|
|
485
|
+
function $e(e, r, t, n, a, i) {
|
|
486
|
+
i === void 0 && (i = J);
|
|
487
|
+
var o = or(function(u, S) {
|
|
488
|
+
var V, b;
|
|
489
|
+
return Te(u) ? (b = "", V = "") : typeof u == "number" || S ? (b = typeof u == "number" ? _e(u) : u, V = n(b)) : (b = a(u, void 0), V = n(b)), { formattedValue: V, numAsString: b };
|
|
490
|
+
}), d = Be(function() {
|
|
491
|
+
return o(te(e) ? r : e, t);
|
|
492
|
+
}), m = d[0], g = d[1], s = function(u, S) {
|
|
493
|
+
u.formattedValue !== m.formattedValue && g({
|
|
494
|
+
formattedValue: u.formattedValue,
|
|
495
|
+
numAsString: u.value
|
|
496
|
+
}), i(u, S);
|
|
497
|
+
}, v = e, h = t;
|
|
498
|
+
te(e) && (v = m.numAsString, h = !0);
|
|
499
|
+
var c = o(v, h);
|
|
500
|
+
return Pe(function() {
|
|
501
|
+
g(c);
|
|
502
|
+
}, [c.formattedValue]), [m, s];
|
|
503
|
+
}
|
|
504
|
+
function gr(e) {
|
|
505
|
+
return e.replace(/[^0-9]/g, "");
|
|
506
|
+
}
|
|
507
|
+
function hr(e) {
|
|
508
|
+
return e;
|
|
509
|
+
}
|
|
510
|
+
function pr(e) {
|
|
511
|
+
var r = e.type;
|
|
512
|
+
r === void 0 && (r = "text");
|
|
513
|
+
var t = e.displayType;
|
|
514
|
+
t === void 0 && (t = "input");
|
|
515
|
+
var n = e.customInput, a = e.renderText, i = e.getInputRef, o = e.format;
|
|
516
|
+
o === void 0 && (o = hr);
|
|
517
|
+
var d = e.removeFormatting;
|
|
518
|
+
d === void 0 && (d = gr);
|
|
519
|
+
var m = e.defaultValue, g = e.valueIsNumericString, s = e.onValueChange, v = e.isAllowed, h = e.onChange;
|
|
520
|
+
h === void 0 && (h = J);
|
|
521
|
+
var c = e.onKeyDown;
|
|
522
|
+
c === void 0 && (c = J);
|
|
523
|
+
var u = e.onMouseUp;
|
|
524
|
+
u === void 0 && (u = J);
|
|
525
|
+
var S = e.onFocus;
|
|
526
|
+
S === void 0 && (S = J);
|
|
527
|
+
var V = e.onBlur;
|
|
528
|
+
V === void 0 && (V = J);
|
|
529
|
+
var b = e.value, E = e.getCaretBoundary;
|
|
530
|
+
E === void 0 && (E = mr);
|
|
531
|
+
var F = e.isValidInputCharacter;
|
|
532
|
+
F === void 0 && (F = le);
|
|
533
|
+
var j = e.isCharacterSame, _ = Fe(e, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]), K = $e(b, m, !!g, o, d, s), U = K[0], w = U.formattedValue, k = U.numAsString, G = K[1], M = re(), W = re({ formattedValue: w, numAsString: k }), L = function(l, f) {
|
|
534
|
+
W.current = { formattedValue: l.formattedValue, numAsString: l.value }, G(l, f);
|
|
535
|
+
}, q = Be(!1), Q = q[0], y = q[1], p = re(null), D = re({
|
|
536
|
+
setCaretTimeout: null,
|
|
537
|
+
focusTimeout: null
|
|
538
|
+
});
|
|
539
|
+
Se(function() {
|
|
540
|
+
return y(!0), function() {
|
|
541
|
+
clearTimeout(D.current.setCaretTimeout), clearTimeout(D.current.focusTimeout);
|
|
542
|
+
};
|
|
543
|
+
}, []);
|
|
544
|
+
var T = o, O = function(l, f) {
|
|
545
|
+
var x = parseFloat(f);
|
|
546
|
+
return {
|
|
547
|
+
formattedValue: l,
|
|
548
|
+
value: f,
|
|
549
|
+
floatValue: isNaN(x) ? void 0 : x
|
|
550
|
+
};
|
|
551
|
+
}, B = function(l, f, x) {
|
|
552
|
+
l.selectionStart === 0 && l.selectionEnd === l.value.length || (X(l, f), D.current.setCaretTimeout = setTimeout(function() {
|
|
553
|
+
l.value === x && l.selectionStart !== f && X(l, f);
|
|
554
|
+
}, 0));
|
|
555
|
+
}, R = function(l, f, x) {
|
|
556
|
+
return Ce(l, f, E(l), x);
|
|
557
|
+
}, Y = function(l, f, x) {
|
|
558
|
+
var C = E(f), $ = vr(f, w, l, x, C, F, j);
|
|
559
|
+
return $ = Ce(f, $, C), $;
|
|
560
|
+
}, pe = function(l) {
|
|
561
|
+
var f = l.formattedValue;
|
|
562
|
+
f === void 0 && (f = "");
|
|
563
|
+
var x = l.input, C = l.source, $ = l.event, A = l.numAsString, N;
|
|
564
|
+
if (x) {
|
|
565
|
+
var P = l.inputValue || x.value, H = Ie(x);
|
|
566
|
+
x.value = f, N = Y(P, f, H), N !== void 0 && B(x, N, f);
|
|
567
|
+
}
|
|
568
|
+
f !== w && L(O(f, A), { event: $, source: C });
|
|
569
|
+
};
|
|
570
|
+
Se(function() {
|
|
571
|
+
var l = W.current, f = l.formattedValue, x = l.numAsString;
|
|
572
|
+
(w !== f || k !== x) && L(O(w, k), {
|
|
573
|
+
event: void 0,
|
|
574
|
+
source: oe.props
|
|
575
|
+
});
|
|
576
|
+
}, [w, k]);
|
|
577
|
+
var ie = p.current ? Ie(p.current) : void 0, ge = typeof window < "u" ? qe : Se;
|
|
578
|
+
ge(function() {
|
|
579
|
+
var l = p.current;
|
|
580
|
+
if (w !== W.current.formattedValue && l) {
|
|
581
|
+
var f = Y(W.current.formattedValue, w, ie);
|
|
582
|
+
l.value = w, B(l, f, w);
|
|
583
|
+
}
|
|
584
|
+
}, [w]);
|
|
585
|
+
var be = function(l, f, x) {
|
|
586
|
+
var C = f.target, $ = M.current ? ur(M.current, C.selectionEnd) : ke(w, l), A = Object.assign(Object.assign({}, $), { lastValue: w }), N = d(l, A), P = T(N);
|
|
587
|
+
if (N = d(P, void 0), v && !v(O(P, N))) {
|
|
588
|
+
var H = f.target, z = Ie(H), ye = Y(l, w, z);
|
|
589
|
+
return H.value = w, B(H, ye, w), !1;
|
|
590
|
+
}
|
|
591
|
+
return pe({
|
|
592
|
+
formattedValue: P,
|
|
593
|
+
numAsString: N,
|
|
594
|
+
inputValue: l,
|
|
595
|
+
event: f,
|
|
596
|
+
source: x,
|
|
597
|
+
input: f.target
|
|
598
|
+
}), !0;
|
|
599
|
+
}, xe = function(l, f) {
|
|
600
|
+
f === void 0 && (f = 0);
|
|
601
|
+
var x = l.selectionStart, C = l.selectionEnd;
|
|
602
|
+
M.current = { selectionStart: x, selectionEnd: C + f };
|
|
603
|
+
}, Le = function(l) {
|
|
604
|
+
var f = l.target, x = f.value, C = be(x, l, oe.event);
|
|
605
|
+
C && h(l), M.current = void 0;
|
|
606
|
+
}, Me = function(l) {
|
|
607
|
+
var f = l.target, x = l.key, C = f.selectionStart, $ = f.selectionEnd, A = f.value;
|
|
608
|
+
A === void 0 && (A = "");
|
|
609
|
+
var N;
|
|
610
|
+
x === "ArrowLeft" || x === "Backspace" ? N = Math.max(C - 1, 0) : x === "ArrowRight" ? N = Math.min(C + 1, A.length) : x === "Delete" && (N = C);
|
|
611
|
+
var P = 0;
|
|
612
|
+
x === "Delete" && C === $ && (P = 1);
|
|
613
|
+
var H = x === "ArrowLeft" || x === "ArrowRight";
|
|
614
|
+
if (N === void 0 || C !== $ && !H) {
|
|
615
|
+
c(l), xe(f, P);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
var z = N;
|
|
619
|
+
if (H) {
|
|
620
|
+
var ye = x === "ArrowLeft" ? "left" : "right";
|
|
621
|
+
z = R(A, N, ye), z !== N && l.preventDefault();
|
|
622
|
+
} else x === "Delete" && !F(A[N]) ? z = R(A, N, "right") : x === "Backspace" && !F(A[N]) && (z = R(A, N, "left"));
|
|
623
|
+
z !== N && B(f, z, A), c(l), xe(f, P);
|
|
624
|
+
}, Ke = function(l) {
|
|
625
|
+
var f = l.target, x = function() {
|
|
626
|
+
var C = f.selectionStart, $ = f.selectionEnd, A = f.value;
|
|
627
|
+
if (A === void 0 && (A = ""), C === $) {
|
|
628
|
+
var N = R(A, C);
|
|
629
|
+
N !== C && B(f, N, A);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
x(), requestAnimationFrame(function() {
|
|
633
|
+
x();
|
|
634
|
+
}), u(l), xe(f);
|
|
635
|
+
}, Ue = function(l) {
|
|
636
|
+
l.persist && l.persist();
|
|
637
|
+
var f = l.target, x = l.currentTarget;
|
|
638
|
+
p.current = f, D.current.focusTimeout = setTimeout(function() {
|
|
639
|
+
var C = f.selectionStart, $ = f.selectionEnd, A = f.value;
|
|
640
|
+
A === void 0 && (A = "");
|
|
641
|
+
var N = R(A, C);
|
|
642
|
+
N !== C && !(C === 0 && $ === A.length) && B(f, N, A), S(Object.assign(Object.assign({}, l), { currentTarget: x }));
|
|
643
|
+
}, 0);
|
|
644
|
+
}, Ge = function(l) {
|
|
645
|
+
p.current = null, clearTimeout(D.current.focusTimeout), clearTimeout(D.current.setCaretTimeout), V(l);
|
|
646
|
+
}, We = Q && cr() ? "numeric" : void 0, Ne = Object.assign({ inputMode: We }, _, {
|
|
647
|
+
type: r,
|
|
648
|
+
value: w,
|
|
649
|
+
onChange: Le,
|
|
650
|
+
onKeyDown: Me,
|
|
651
|
+
onMouseUp: Ke,
|
|
652
|
+
onFocus: Ue,
|
|
653
|
+
onBlur: Ge
|
|
654
|
+
});
|
|
655
|
+
if (t === "text")
|
|
656
|
+
return a ? ee.createElement(ee.Fragment, null, a(w, _) || null) : ee.createElement("span", Object.assign({}, _, { ref: i }), w);
|
|
657
|
+
if (n) {
|
|
658
|
+
var Ze = n;
|
|
659
|
+
return ee.createElement(Ze, Object.assign({}, Ne, { ref: i }));
|
|
660
|
+
}
|
|
661
|
+
return ee.createElement("input", Object.assign({}, Ne, { ref: i }));
|
|
662
|
+
}
|
|
663
|
+
function Ae(e, r) {
|
|
664
|
+
var t = r.decimalScale, n = r.fixedDecimalScale, a = r.prefix;
|
|
665
|
+
a === void 0 && (a = "");
|
|
666
|
+
var i = r.suffix;
|
|
667
|
+
i === void 0 && (i = "");
|
|
668
|
+
var o = r.allowNegative, d = r.thousandsGroupStyle;
|
|
669
|
+
if (d === void 0 && (d = "thousand"), e === "" || e === "-")
|
|
670
|
+
return e;
|
|
671
|
+
var m = he(r), g = m.thousandSeparator, s = m.decimalSeparator, v = t !== 0 && e.indexOf(".") !== -1 || t && n, h = we(e, o), c = h.beforeDecimal, u = h.afterDecimal, S = h.addNegation;
|
|
672
|
+
return t !== void 0 && (u = Re(u, t, !!n)), g && (c = ir(c, g, d)), a && (c = a + c), i && (u = u + i), S && (c = "-" + c), e = c + (v && s || "") + u, e;
|
|
673
|
+
}
|
|
674
|
+
function he(e) {
|
|
675
|
+
var r = e.decimalSeparator;
|
|
676
|
+
r === void 0 && (r = ".");
|
|
677
|
+
var t = e.thousandSeparator, n = e.allowedDecimalSeparators;
|
|
678
|
+
return t === !0 && (t = ","), n || (n = [r, "."]), {
|
|
679
|
+
decimalSeparator: r,
|
|
680
|
+
thousandSeparator: t,
|
|
681
|
+
allowedDecimalSeparators: n
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
function br(e, r) {
|
|
685
|
+
e === void 0 && (e = "");
|
|
686
|
+
var t = new RegExp("(-)"), n = new RegExp("(-)(.)*(-)"), a = t.test(e), i = n.test(e);
|
|
687
|
+
return e = e.replace(/-/g, ""), a && !i && r && (e = "-" + e), e;
|
|
688
|
+
}
|
|
689
|
+
function xr(e, r) {
|
|
690
|
+
return new RegExp("(^-)|[0-9]|" + Oe(e), "g");
|
|
691
|
+
}
|
|
692
|
+
function yr(e, r, t) {
|
|
693
|
+
return e === "" ? !0 : !r?.match(/\d/) && !t?.match(/\d/) && typeof e == "string" && !isNaN(Number(e));
|
|
694
|
+
}
|
|
695
|
+
function Sr(e, r, t) {
|
|
696
|
+
var n;
|
|
697
|
+
r === void 0 && (r = dr(e));
|
|
698
|
+
var a = t.allowNegative, i = t.prefix;
|
|
699
|
+
i === void 0 && (i = "");
|
|
700
|
+
var o = t.suffix;
|
|
701
|
+
o === void 0 && (o = "");
|
|
702
|
+
var d = t.decimalScale, m = r.from, g = r.to, s = g.start, v = g.end, h = he(t), c = h.allowedDecimalSeparators, u = h.decimalSeparator, S = e[v] === u;
|
|
703
|
+
if (le(e) && (e === i || e === o) && r.lastValue === "")
|
|
704
|
+
return e;
|
|
705
|
+
if (v - s === 1 && c.indexOf(e[s]) !== -1) {
|
|
706
|
+
var V = d === 0 ? "" : u;
|
|
707
|
+
e = e.substring(0, s) + V + e.substring(s + 1, e.length);
|
|
708
|
+
}
|
|
709
|
+
var b = function(p, D, T) {
|
|
710
|
+
var O = !1, B = !1;
|
|
711
|
+
i.startsWith("-") ? O = !1 : p.startsWith("--") ? (O = !1, B = !0) : o.startsWith("-") && p.length === o.length ? O = !1 : p[0] === "-" && (O = !0);
|
|
712
|
+
var R = O ? 1 : 0;
|
|
713
|
+
return B && (R = 2), R && (p = p.substring(R), D -= R, T -= R), { value: p, start: D, end: T, hasNegation: O };
|
|
714
|
+
}, E = b(e, s, v), F = E.hasNegation;
|
|
715
|
+
n = E, e = n.value, s = n.start, v = n.end;
|
|
716
|
+
var j = b(r.lastValue, m.start, m.end), _ = j.start, K = j.end, U = j.value, w = e.substring(s, v);
|
|
717
|
+
e.length && U.length && (_ > U.length - o.length || K < i.length) && !(w && o.startsWith(w)) && (e = U);
|
|
718
|
+
var k = 0;
|
|
719
|
+
e.startsWith(i) ? k += i.length : s < i.length && (k = s), e = e.substring(k), v -= k;
|
|
720
|
+
var G = e.length, M = e.length - o.length;
|
|
721
|
+
e.endsWith(o) ? G = M : (v > M || v > e.length - o.length) && (G = v), e = e.substring(0, G), e = br(F ? "-" + e : e, a), e = (e.match(xr(u)) || []).join("");
|
|
722
|
+
var W = e.indexOf(u);
|
|
723
|
+
e = e.replace(new RegExp(Oe(u), "g"), function(p, D) {
|
|
724
|
+
return D === W ? "." : "";
|
|
725
|
+
});
|
|
726
|
+
var L = we(e, a), q = L.beforeDecimal, Q = L.afterDecimal, y = L.addNegation;
|
|
727
|
+
return g.end - g.start < m.end - m.start && q === "" && S && !parseFloat(Q) && (e = y ? "-" : ""), e;
|
|
728
|
+
}
|
|
729
|
+
function Ir(e, r) {
|
|
730
|
+
var t = r.prefix;
|
|
731
|
+
t === void 0 && (t = "");
|
|
732
|
+
var n = r.suffix;
|
|
733
|
+
n === void 0 && (n = "");
|
|
734
|
+
var a = Array.from({ length: e.length + 1 }).map(function() {
|
|
735
|
+
return !0;
|
|
736
|
+
}), i = e[0] === "-";
|
|
737
|
+
a.fill(!1, 0, t.length + (i ? 1 : 0));
|
|
738
|
+
var o = e.length;
|
|
739
|
+
return a.fill(!1, o - n.length + 1, o + 1), a;
|
|
740
|
+
}
|
|
741
|
+
function wr(e) {
|
|
742
|
+
var r = he(e), t = r.thousandSeparator, n = r.decimalSeparator, a = e.prefix;
|
|
743
|
+
a === void 0 && (a = "");
|
|
744
|
+
var i = e.allowNegative;
|
|
745
|
+
if (i === void 0 && (i = !0), t === n)
|
|
746
|
+
throw new Error(`
|
|
747
|
+
Decimal separator can't be same as thousand separator.
|
|
748
|
+
thousandSeparator: ` + t + ` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
749
|
+
decimalSeparator: ` + n + ` (default value for decimalSeparator is .)
|
|
750
|
+
`);
|
|
751
|
+
return a.startsWith("-") && i && (console.error(`
|
|
752
|
+
Prefix can't start with '-' when allowNegative is true.
|
|
753
|
+
prefix: ` + a + `
|
|
754
|
+
allowNegative: ` + i + `
|
|
755
|
+
`), i = !1), Object.assign(Object.assign({}, e), { allowNegative: i });
|
|
756
|
+
}
|
|
757
|
+
function Nr(e) {
|
|
758
|
+
e = wr(e), e.decimalSeparator, e.allowedDecimalSeparators, e.thousandsGroupStyle;
|
|
759
|
+
var r = e.suffix, t = e.allowNegative, n = e.allowLeadingZeros, a = e.onKeyDown;
|
|
760
|
+
a === void 0 && (a = J);
|
|
761
|
+
var i = e.onBlur;
|
|
762
|
+
i === void 0 && (i = J);
|
|
763
|
+
var o = e.thousandSeparator, d = e.decimalScale, m = e.fixedDecimalScale, g = e.prefix;
|
|
764
|
+
g === void 0 && (g = "");
|
|
765
|
+
var s = e.defaultValue, v = e.value, h = e.valueIsNumericString, c = e.onValueChange, u = Fe(e, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]), S = he(e), V = S.decimalSeparator, b = S.allowedDecimalSeparators, E = function(y) {
|
|
766
|
+
return Ae(y, e);
|
|
767
|
+
}, F = function(y, p) {
|
|
768
|
+
return Sr(y, p, e);
|
|
769
|
+
}, j = te(v) ? s : v, _ = h ?? yr(j, g, r);
|
|
770
|
+
te(v) ? te(s) || (_ = _ || typeof s == "number") : _ = _ || typeof v == "number";
|
|
771
|
+
var K = function(y) {
|
|
772
|
+
return Te(y) ? y : (typeof y == "number" && (y = _e(y)), _ && typeof d == "number" ? De(y, d, !!m) : y);
|
|
773
|
+
}, U = $e(K(v), K(s), !!_, E, F, c), w = U[0], k = w.numAsString, G = w.formattedValue, M = U[1], W = function(y) {
|
|
774
|
+
var p = y.target, D = y.key, T = p.selectionStart, O = p.selectionEnd, B = p.value;
|
|
775
|
+
if (B === void 0 && (B = ""), (D === "Backspace" || D === "Delete") && O < g.length) {
|
|
776
|
+
y.preventDefault();
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
if (T !== O) {
|
|
780
|
+
a(y);
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
D === "Backspace" && B[0] === "-" && T === g.length + 1 && t && X(p, 1), d && m && (D === "Backspace" && B[T - 1] === V ? (X(p, T - 1), y.preventDefault()) : D === "Delete" && B[T] === V && y.preventDefault()), b?.includes(D) && B[T] === V && X(p, T + 1);
|
|
784
|
+
var R = o === !0 ? "," : o;
|
|
785
|
+
D === "Backspace" && B[T - 1] === R && X(p, T - 1), D === "Delete" && B[T] === R && X(p, T + 1), a(y);
|
|
786
|
+
}, L = function(y) {
|
|
787
|
+
var p = k;
|
|
788
|
+
if (p.match(/\d/g) || (p = ""), n || (p = lr(p)), m && d && (p = De(p, d, m)), p !== k) {
|
|
789
|
+
var D = Ae(p, e);
|
|
790
|
+
M({
|
|
791
|
+
formattedValue: D,
|
|
792
|
+
value: p,
|
|
793
|
+
floatValue: parseFloat(p)
|
|
794
|
+
}, {
|
|
795
|
+
event: y,
|
|
796
|
+
source: oe.event
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
i(y);
|
|
800
|
+
}, q = function(y) {
|
|
801
|
+
return y === V ? !0 : le(y);
|
|
802
|
+
}, Q = function(y) {
|
|
803
|
+
var p = y.currentValue, D = y.lastValue, T = y.formattedValue, O = y.currentValueIndex, B = y.formattedValueIndex, R = p[O], Y = T[B], pe = ke(D, p), ie = pe.to, ge = function(be) {
|
|
804
|
+
return F(be).indexOf(".") + g.length;
|
|
805
|
+
};
|
|
806
|
+
return v === 0 && m && d && p[ie.start] === V && ge(p) < O && ge(T) > B ? !1 : O >= ie.start && O < ie.end && b && b.includes(R) && Y === V ? !0 : R === Y;
|
|
807
|
+
};
|
|
808
|
+
return Object.assign(Object.assign({}, u), {
|
|
809
|
+
value: G,
|
|
810
|
+
valueIsNumericString: !1,
|
|
811
|
+
isValidInputCharacter: q,
|
|
812
|
+
isCharacterSame: Q,
|
|
813
|
+
onValueChange: M,
|
|
814
|
+
format: E,
|
|
815
|
+
removeFormatting: F,
|
|
816
|
+
getCaretBoundary: function(y) {
|
|
817
|
+
return Ir(y, e);
|
|
818
|
+
},
|
|
819
|
+
onKeyDown: W,
|
|
820
|
+
onBlur: L
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
function Vr(e) {
|
|
824
|
+
var r = Nr(e);
|
|
825
|
+
return ee.createElement(pr, Object.assign({}, r));
|
|
826
|
+
}
|
|
827
|
+
const je = ae(
|
|
828
|
+
({
|
|
829
|
+
allowNegative: e = !0,
|
|
830
|
+
decimalScale: r = 2,
|
|
831
|
+
fixedDecimalScale: t = !1,
|
|
832
|
+
thousandSeparator: n = !0,
|
|
833
|
+
prefix: a,
|
|
834
|
+
suffix: i,
|
|
835
|
+
isAllowed: o,
|
|
836
|
+
onValueChange: d,
|
|
837
|
+
defaultValue: m,
|
|
838
|
+
value: g,
|
|
839
|
+
id: s,
|
|
840
|
+
name: v,
|
|
841
|
+
placeholder: h,
|
|
842
|
+
disabled: c,
|
|
843
|
+
error: u,
|
|
844
|
+
fullWidth: S = !0,
|
|
845
|
+
size: V = "small",
|
|
846
|
+
onBlur: b,
|
|
847
|
+
onFocus: E,
|
|
848
|
+
onKeyDown: F,
|
|
849
|
+
valueIsNumericString: j,
|
|
850
|
+
..._
|
|
851
|
+
}, K) => /* @__PURE__ */ I(
|
|
852
|
+
Vr,
|
|
853
|
+
{
|
|
854
|
+
customInput: Ee,
|
|
855
|
+
getInputRef: K,
|
|
856
|
+
allowNegative: e,
|
|
857
|
+
decimalScale: r,
|
|
858
|
+
fixedDecimalScale: t,
|
|
859
|
+
thousandSeparator: n,
|
|
860
|
+
prefix: a,
|
|
861
|
+
suffix: i,
|
|
862
|
+
isAllowed: o,
|
|
863
|
+
onValueChange: d,
|
|
864
|
+
defaultValue: m,
|
|
865
|
+
value: g,
|
|
866
|
+
valueIsNumericString: j,
|
|
867
|
+
id: s,
|
|
868
|
+
name: v,
|
|
869
|
+
placeholder: h,
|
|
870
|
+
disabled: c,
|
|
871
|
+
error: u,
|
|
872
|
+
fullWidth: S,
|
|
873
|
+
size: V,
|
|
874
|
+
onBlur: b,
|
|
875
|
+
onFocus: E,
|
|
876
|
+
onKeyDown: F,
|
|
877
|
+
..._
|
|
878
|
+
}
|
|
879
|
+
)
|
|
880
|
+
);
|
|
881
|
+
je.displayName = "NumberInput";
|
|
882
|
+
const Dr = ae(
|
|
883
|
+
({
|
|
884
|
+
disabled: e,
|
|
885
|
+
fullWidth: r,
|
|
886
|
+
helperText: t,
|
|
887
|
+
id: n,
|
|
888
|
+
label: a,
|
|
889
|
+
required: i,
|
|
890
|
+
slotProps: o,
|
|
891
|
+
sublabel: d,
|
|
892
|
+
tooltip: m,
|
|
893
|
+
...g
|
|
894
|
+
}, s) => {
|
|
895
|
+
const v = ue("number-input"), h = n || v, c = t ? `${h}-helper` : void 0, u = g.error;
|
|
896
|
+
return /* @__PURE__ */ Z(
|
|
897
|
+
ce,
|
|
898
|
+
{
|
|
899
|
+
disabled: e,
|
|
900
|
+
error: u,
|
|
901
|
+
fullWidth: r,
|
|
902
|
+
...o?.root,
|
|
903
|
+
children: [
|
|
904
|
+
/* @__PURE__ */ Z(
|
|
905
|
+
de,
|
|
906
|
+
{
|
|
907
|
+
sx: {
|
|
908
|
+
alignItems: "center",
|
|
909
|
+
display: "flex",
|
|
910
|
+
gap: "0.25rem"
|
|
911
|
+
},
|
|
912
|
+
children: [
|
|
913
|
+
/* @__PURE__ */ I(
|
|
914
|
+
se,
|
|
915
|
+
{
|
|
916
|
+
htmlFor: h,
|
|
917
|
+
required: i,
|
|
918
|
+
...o?.label,
|
|
919
|
+
children: a
|
|
920
|
+
}
|
|
921
|
+
),
|
|
922
|
+
m && /* @__PURE__ */ I(ve, { title: m, arrow: !0, children: /* @__PURE__ */ I(
|
|
923
|
+
fe,
|
|
924
|
+
{
|
|
925
|
+
sx: ({ vars: S }) => ({
|
|
926
|
+
color: S?.palette.text.secondary,
|
|
927
|
+
marginBlockEnd: "3px",
|
|
928
|
+
height: "1rem",
|
|
929
|
+
width: "1rem"
|
|
930
|
+
})
|
|
931
|
+
}
|
|
932
|
+
) })
|
|
933
|
+
]
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
d && /* @__PURE__ */ I(me, { ...o?.sublabel, children: d }),
|
|
937
|
+
/* @__PURE__ */ I(
|
|
938
|
+
je,
|
|
939
|
+
{
|
|
940
|
+
ref: s,
|
|
941
|
+
disabled: e,
|
|
942
|
+
id: h,
|
|
943
|
+
error: u,
|
|
944
|
+
fullWidth: r,
|
|
945
|
+
"aria-describedby": c ? g["aria-describedby"] ? `${g["aria-describedby"]} ${c}` : c : g["aria-describedby"],
|
|
946
|
+
...g
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
t && /* @__PURE__ */ I(ne, { id: c, ...o?.helperText, children: t })
|
|
950
|
+
]
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
);
|
|
955
|
+
Dr.displayName = "NumberInputControl";
|
|
956
|
+
const Cr = ae(
|
|
957
|
+
({
|
|
958
|
+
disabled: e,
|
|
959
|
+
error: r,
|
|
960
|
+
fullWidth: t,
|
|
961
|
+
helperText: n,
|
|
962
|
+
id: a,
|
|
963
|
+
label: i,
|
|
964
|
+
required: o,
|
|
965
|
+
slotProps: d,
|
|
966
|
+
sublabel: m,
|
|
967
|
+
tooltip: g,
|
|
968
|
+
...s
|
|
969
|
+
}, v) => {
|
|
970
|
+
const h = ue("select"), c = a || h, u = n ? `${c}-helper` : void 0;
|
|
971
|
+
return /* @__PURE__ */ Z(
|
|
972
|
+
ce,
|
|
973
|
+
{
|
|
974
|
+
disabled: e,
|
|
975
|
+
error: r,
|
|
976
|
+
fullWidth: t,
|
|
977
|
+
...d?.root,
|
|
978
|
+
children: [
|
|
979
|
+
/* @__PURE__ */ Z(
|
|
980
|
+
de,
|
|
981
|
+
{
|
|
982
|
+
sx: {
|
|
983
|
+
alignItems: "center",
|
|
984
|
+
display: "flex",
|
|
985
|
+
gap: "0.25rem"
|
|
986
|
+
},
|
|
987
|
+
children: [
|
|
988
|
+
/* @__PURE__ */ I(
|
|
989
|
+
se,
|
|
990
|
+
{
|
|
991
|
+
id: `${c}-label`,
|
|
992
|
+
htmlFor: c,
|
|
993
|
+
required: o,
|
|
994
|
+
...d?.label,
|
|
995
|
+
children: i
|
|
996
|
+
}
|
|
997
|
+
),
|
|
998
|
+
g && /* @__PURE__ */ I(ve, { title: g, arrow: !0, children: /* @__PURE__ */ I(
|
|
999
|
+
fe,
|
|
1000
|
+
{
|
|
1001
|
+
sx: ({ vars: S }) => ({
|
|
1002
|
+
color: S?.palette.text.secondary,
|
|
1003
|
+
marginBlockEnd: "3px",
|
|
1004
|
+
height: "1rem",
|
|
1005
|
+
width: "1rem"
|
|
1006
|
+
})
|
|
1007
|
+
}
|
|
1008
|
+
) })
|
|
1009
|
+
]
|
|
1010
|
+
}
|
|
1011
|
+
),
|
|
1012
|
+
m && /* @__PURE__ */ I(me, { ...d?.sublabel, children: m }),
|
|
1013
|
+
/* @__PURE__ */ I(
|
|
1014
|
+
Je,
|
|
1015
|
+
{
|
|
1016
|
+
ref: v,
|
|
1017
|
+
disabled: e,
|
|
1018
|
+
error: r,
|
|
1019
|
+
fullWidth: t,
|
|
1020
|
+
labelId: `${c}-label`,
|
|
1021
|
+
id: c,
|
|
1022
|
+
"aria-describedby": u ? s["aria-describedby"] ? `${s["aria-describedby"]} ${u}` : u : s["aria-describedby"],
|
|
1023
|
+
...s
|
|
1024
|
+
}
|
|
1025
|
+
),
|
|
1026
|
+
n && /* @__PURE__ */ I(ne, { id: u, ...d?.helperText, children: n })
|
|
1027
|
+
]
|
|
1028
|
+
}
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
Cr.displayName = "SelectControl";
|
|
1033
|
+
export {
|
|
1034
|
+
Ye as A,
|
|
1035
|
+
er as D,
|
|
1036
|
+
me as F,
|
|
1037
|
+
rr as I,
|
|
1038
|
+
je as N,
|
|
1039
|
+
Cr as S,
|
|
1040
|
+
Dr as a
|
|
1041
|
+
};
|