@hortiview/default-components 0.0.11937 → 0.0.12167
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/README.md +74 -31
- package/dist/components/DefaultFormNumber/DefaultFormNumber.js +67 -67
- package/dist/components/HealthChecks/HealthCheck.test.js +23910 -0
- package/dist/components/InternationalizationWrapper/InternationalizationWrapper.d.ts +1 -2
- package/dist/magic-string.es-D4UQQyt0.js +859 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hortiview Default Components
|
|
2
2
|
|
|
3
|
-
This is a component library that provides default components that
|
|
3
|
+
This is a component library that provides default components that possess default translations for the basic languages used in the HortiView Platform.
|
|
4
4
|
|
|
5
5
|
Supported languages are currently: English, spanish and turkish.
|
|
6
6
|
|
|
@@ -10,6 +10,49 @@ Supported languages are currently: English, spanish and turkish.
|
|
|
10
10
|
|
|
11
11
|
`yarn add @hortiview/default-components`
|
|
12
12
|
|
|
13
|
+
## Important Note
|
|
14
|
+
|
|
15
|
+
To ensure that this library´s components always have access to the current platform language, it is mandatory to pass the language from the base props or from the i18n instance the components are wrapped in.
|
|
16
|
+
|
|
17
|
+
To do so please call the useChangeDefaultComponentsLanguage-hook in a place where you can access the current language. The current language has to be provided to the hook as a parameter.
|
|
18
|
+
The hook only has to be called once inside of a module.
|
|
19
|
+
|
|
20
|
+
When using the current language from the base props this might look like shown in the following example:
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { useChangeDefaultComponentsLanguage } from '@hortiview/default-components';
|
|
24
|
+
import { useBasePropsStore } from './stores/BaseStore';
|
|
25
|
+
|
|
26
|
+
export const ModuleBase = () => {
|
|
27
|
+
const currentLanguage = useBasePropsStore(state => state.currentLanguage);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* needed to handle translations of the default components
|
|
31
|
+
*/
|
|
32
|
+
useChangeDefaultComponentsLanguage(currentLanguage);
|
|
33
|
+
|
|
34
|
+
return <AnyComponent />;
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
When using i18next this might look like shown in the following example:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { useChangeDefaultComponentsLanguage } from '@hortiview/default-components';
|
|
42
|
+
import { AVAILABLE_LANGUAGE_CODES } from '@hortiview/shared-components';
|
|
43
|
+
import { useTranslation } from 'react-i18next';
|
|
44
|
+
|
|
45
|
+
export const ModuleBase = () => {
|
|
46
|
+
const { i18n } = useTranslation();
|
|
47
|
+
/**
|
|
48
|
+
* needed to handle translations of the default components
|
|
49
|
+
*/
|
|
50
|
+
useChangeDefaultComponentsLanguage(i18n.language as AVAILABLE_LANGUAGE_CODES);
|
|
51
|
+
|
|
52
|
+
return <AnyComponent />;
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
13
56
|
## Remarks
|
|
14
57
|
|
|
15
58
|
This library provides form components using [react-hook-form](https://react-hook-form.com/get-started). When you want to use these components please install `react-hook-form` before using them.
|
|
@@ -60,15 +103,15 @@ const { handleSubmit } = formMethods;
|
|
|
60
103
|
|
|
61
104
|
Renders a loading spinner. The loading spinner can be customized in size and color. It can also be centered.
|
|
62
105
|
|
|
63
|
-
```
|
|
64
|
-
import { DefaultLoadingSpinner } from
|
|
106
|
+
```tsx
|
|
107
|
+
import { DefaultLoadingSpinner } from '@hortiview/default-components';
|
|
65
108
|
|
|
66
|
-
const [isLoading, setIsLoading] = useState(false)
|
|
109
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
67
110
|
|
|
68
111
|
/** add logic that changes state of isLoading */
|
|
69
112
|
|
|
70
|
-
if (isLoading) return <DefaultLoadingSpinner
|
|
71
|
-
return <DefaultComponent
|
|
113
|
+
if (isLoading) return <DefaultLoadingSpinner />;
|
|
114
|
+
return <DefaultComponent />;
|
|
72
115
|
```
|
|
73
116
|
|
|
74
117
|
### HealthCheckComponents
|
|
@@ -79,54 +122,54 @@ If a custom text and type should be displayed please use the shared component `<
|
|
|
79
122
|
|
|
80
123
|
#### DataBaseHealthCheck
|
|
81
124
|
|
|
82
|
-
```
|
|
83
|
-
import { DataBaseHealthCheck } from
|
|
125
|
+
```tsx
|
|
126
|
+
import { DataBaseHealthCheck } from '@hortiview/default-components';
|
|
84
127
|
|
|
85
|
-
const [isHealthy, setIsHealthy] = useState(false)
|
|
128
|
+
const [isHealthy, setIsHealthy] = useState(false);
|
|
86
129
|
|
|
87
130
|
/** add logic that changes state of isHealthy */
|
|
88
131
|
|
|
89
|
-
if (!isHealthy) return <DataBaseHealthCheck
|
|
90
|
-
return <DefaultComponent
|
|
132
|
+
if (!isHealthy) return <DataBaseHealthCheck />;
|
|
133
|
+
return <DefaultComponent />;
|
|
91
134
|
```
|
|
92
135
|
|
|
93
136
|
#### DataBaseHealthCheck
|
|
94
137
|
|
|
95
|
-
```
|
|
96
|
-
import { DataBaseHealthCheck } from
|
|
138
|
+
```tsx
|
|
139
|
+
import { DataBaseHealthCheck } from '@hortiview/default-components';
|
|
97
140
|
|
|
98
|
-
const [isHealthy, setIsHealthy] = useState(false)
|
|
141
|
+
const [isHealthy, setIsHealthy] = useState(false);
|
|
99
142
|
|
|
100
143
|
/** add logic that changes state of isHealthy */
|
|
101
144
|
|
|
102
|
-
if (!isHealthy) return <DataBaseHealthCheck
|
|
103
|
-
return <DefaultComponent
|
|
145
|
+
if (!isHealthy) return <DataBaseHealthCheck />;
|
|
146
|
+
return <DefaultComponent />;
|
|
104
147
|
```
|
|
105
148
|
|
|
106
149
|
#### IotServiceHealthCheck
|
|
107
150
|
|
|
108
|
-
```
|
|
109
|
-
import { IotServiceHealthCheck } from
|
|
151
|
+
```tsx
|
|
152
|
+
import { IotServiceHealthCheck } from '@hortiview/default-components';
|
|
110
153
|
|
|
111
|
-
const [isHealthy, setIsHealthy] = useState(false)
|
|
154
|
+
const [isHealthy, setIsHealthy] = useState(false);
|
|
112
155
|
|
|
113
156
|
/** add logic that changes state of isHealthy */
|
|
114
157
|
|
|
115
|
-
if (!isHealthy) return <IotServiceHealthCheck
|
|
116
|
-
return <DefaultComponent
|
|
158
|
+
if (!isHealthy) return <IotServiceHealthCheck />;
|
|
159
|
+
return <DefaultComponent />;
|
|
117
160
|
```
|
|
118
161
|
|
|
119
162
|
#### PlatformHealthCheck
|
|
120
163
|
|
|
121
|
-
```
|
|
122
|
-
import { PlatformHealthCheck } from
|
|
164
|
+
```tsx
|
|
165
|
+
import { PlatformHealthCheck } from '@hortiview/default-components';
|
|
123
166
|
|
|
124
|
-
const [isHealthy, setIsHealthy] = useState(false)
|
|
167
|
+
const [isHealthy, setIsHealthy] = useState(false);
|
|
125
168
|
|
|
126
169
|
/** add logic that changes state of isHealthy */
|
|
127
170
|
|
|
128
|
-
if (!isHealthy) return <PlatformHealthCheck
|
|
129
|
-
return <DefaultComponent
|
|
171
|
+
if (!isHealthy) return <PlatformHealthCheck />;
|
|
172
|
+
return <DefaultComponent />;
|
|
130
173
|
```
|
|
131
174
|
|
|
132
175
|
### ImpatienceLoadingSpinner
|
|
@@ -134,13 +177,13 @@ return <DefaultComponent />
|
|
|
134
177
|
This Loading spinner will automatically change to a specific text, after a certain waiting time, the time is adjustable.
|
|
135
178
|
The default waiting time are 10 seconds.
|
|
136
179
|
|
|
137
|
-
```
|
|
138
|
-
import { ImpatienceLoadingSpinner } from
|
|
180
|
+
```tsx
|
|
181
|
+
import { ImpatienceLoadingSpinner } from '@hortiview/default-components';
|
|
139
182
|
|
|
140
|
-
const [isLoading, setIsLoading] = useState(false)
|
|
183
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
141
184
|
|
|
142
185
|
/** add logic that changes state of isLoading */
|
|
143
186
|
|
|
144
|
-
if (isLoading) return <ImpatienceLoadingSpinner
|
|
145
|
-
return <DefaultComponent
|
|
187
|
+
if (isLoading) return <ImpatienceLoadingSpinner />;
|
|
188
|
+
return <DefaultComponent />;
|
|
146
189
|
```
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as jt } from "react/jsx-runtime";
|
|
2
2
|
import { t as xn } from "../../i18n-DIprVS_u.js";
|
|
3
3
|
import { s as Tn, R as u, F as Cn, t as On, v as Ln, o as be, w as Nn, N as lt, _ as Y, x as Ht, h as K, f as Et, p as k, a as It, y as An, D as Ye, U as Sn, r as _e, L as tn, b as ct, I as Rn, g as Vn, u as Pn } from "../../useTranslation-Bh0VR1ML.js";
|
|
4
|
-
import I, { forwardRef as mt, useState as rt, useRef as F, useImperativeHandle as xt, useEffect as
|
|
4
|
+
import I, { forwardRef as mt, useState as rt, useRef as F, useImperativeHandle as xt, useEffect as B, useMemo as vt, useCallback as _t, Fragment as Le, useLayoutEffect as Fn } from "react";
|
|
5
5
|
import { useFormContext as en, Controller as wn } from "react-hook-form";
|
|
6
6
|
import { D as Dn, p as Gt, U as Ne, _ as Hn, O as jn } from "../../component-DsB0poTj-B4NF-JCy.js";
|
|
7
|
-
import
|
|
8
|
-
import { I as
|
|
7
|
+
import Bn from "react-dom";
|
|
8
|
+
import { I as $n } from "../../InternationalizationWrapper-BtWuzVFG.js";
|
|
9
9
|
import '../../assets/DefaultFormNumber.css';const kn = {
|
|
10
10
|
/**
|
|
11
11
|
* Content to be rendered inside the portal.
|
|
@@ -36,7 +36,7 @@ import '../../assets/DefaultFormNumber.css';const kn = {
|
|
|
36
36
|
container: o,
|
|
37
37
|
disabled: l
|
|
38
38
|
} = n, s = F();
|
|
39
|
-
return xt(e, () => s.current, []),
|
|
39
|
+
return xt(e, () => s.current, []), B(() => {
|
|
40
40
|
var f;
|
|
41
41
|
const p = (f = document) === null || f === void 0 ? void 0 : f.body;
|
|
42
42
|
if (typeof o == "string")
|
|
@@ -49,7 +49,7 @@ import '../../assets/DefaultFormNumber.css';const kn = {
|
|
|
49
49
|
else
|
|
50
50
|
i(o || p);
|
|
51
51
|
}, [o]), // eslint-disable-next-line react/jsx-no-useless-fragment
|
|
52
|
-
/* @__PURE__ */ I.createElement(I.Fragment, null, l || !r ? a : /* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ I.createElement(I.Fragment, null, l || !r ? a : /* @__PURE__ */ Bn.createPortal(a, r));
|
|
53
53
|
});
|
|
54
54
|
Kt.displayName = "Portal";
|
|
55
55
|
Kt.propTypes = kn;
|
|
@@ -182,10 +182,10 @@ function Qn() {
|
|
|
182
182
|
}
|
|
183
183
|
return pe = e, pe;
|
|
184
184
|
}
|
|
185
|
-
var he,
|
|
185
|
+
var he, Be;
|
|
186
186
|
function Yn() {
|
|
187
|
-
if (
|
|
188
|
-
|
|
187
|
+
if (Be) return he;
|
|
188
|
+
Be = 1;
|
|
189
189
|
var n = Jn(), e = Qn();
|
|
190
190
|
function t(r, i) {
|
|
191
191
|
i = n(i, r);
|
|
@@ -195,10 +195,10 @@ function Yn() {
|
|
|
195
195
|
}
|
|
196
196
|
return he = t, he;
|
|
197
197
|
}
|
|
198
|
-
var me,
|
|
198
|
+
var me, $e;
|
|
199
199
|
function tr() {
|
|
200
|
-
if (
|
|
201
|
-
|
|
200
|
+
if ($e) return me;
|
|
201
|
+
$e = 1;
|
|
202
202
|
var n = Yn();
|
|
203
203
|
function e(t, r, i) {
|
|
204
204
|
var a = t == null ? void 0 : n(t, r);
|
|
@@ -578,7 +578,7 @@ const rr = {
|
|
|
578
578
|
float: !1,
|
|
579
579
|
htmlFor: "",
|
|
580
580
|
shake: !1
|
|
581
|
-
},
|
|
581
|
+
}, Bt = /* @__PURE__ */ mt((n, e) => {
|
|
582
582
|
const {
|
|
583
583
|
children: t,
|
|
584
584
|
htmlFor: r = "",
|
|
@@ -588,9 +588,9 @@ const rr = {
|
|
|
588
588
|
style: l,
|
|
589
589
|
...s
|
|
590
590
|
} = n, f = F(), p = t, v = F();
|
|
591
|
-
return xt(e, () => v.current, []),
|
|
591
|
+
return xt(e, () => v.current, []), B(() => (f.current = rn.attachTo(v.current), () => {
|
|
592
592
|
f.current.destroy();
|
|
593
|
-
})),
|
|
593
|
+
})), B(() => {
|
|
594
594
|
f.current.float(a);
|
|
595
595
|
}, [a]), /* @__PURE__ */ I.createElement("label", lt({
|
|
596
596
|
ref: v,
|
|
@@ -600,9 +600,9 @@ const rr = {
|
|
|
600
600
|
style: l
|
|
601
601
|
}), p);
|
|
602
602
|
});
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
603
|
+
Bt.displayName = "FloatingLabel";
|
|
604
|
+
Bt.propTypes = rr;
|
|
605
|
+
Bt.defaultProps = ir;
|
|
606
606
|
const ar = {
|
|
607
607
|
/**
|
|
608
608
|
* Content to be rendered inside the notched outline. Accepts a string.
|
|
@@ -641,11 +641,11 @@ const ar = {
|
|
|
641
641
|
width: a,
|
|
642
642
|
...o
|
|
643
643
|
} = n, l = F(), s = F();
|
|
644
|
-
return xt(e, () => l.current, []),
|
|
644
|
+
return xt(e, () => l.current, []), B(() => (s.current = on.attachTo(l.current), () => {
|
|
645
645
|
s.current.destroy();
|
|
646
|
-
}), []),
|
|
646
|
+
}), []), B(() => {
|
|
647
647
|
t !== void 0 && (t ? s.current.closeNotch() : s.current.notch());
|
|
648
|
-
}, [t]),
|
|
648
|
+
}, [t]), B(() => {
|
|
649
649
|
a ? s.current.foundation.adapter.setNotchWidthProperty(a) : s.current.foundation.adapter.removeNotchWidthProperty();
|
|
650
650
|
}, [a]), /* @__PURE__ */ I.createElement("div", lt({
|
|
651
651
|
className: Y("lmnt", "mdc-notched-outline", r),
|
|
@@ -819,7 +819,7 @@ const Ee = /* @__PURE__ */ mt((n, e) => {
|
|
|
819
819
|
xt(e, () => g.current, []);
|
|
820
820
|
const [h] = rt(() => o || Ht()), w = _t(() => {
|
|
821
821
|
l == null || l();
|
|
822
|
-
}, [l]),
|
|
822
|
+
}, [l]), $ = _t((T) => {
|
|
823
823
|
T.key === "Enter" && (l == null || l());
|
|
824
824
|
}, [l]);
|
|
825
825
|
An(() => {
|
|
@@ -873,7 +873,7 @@ const Ee = /* @__PURE__ */ mt((n, e) => {
|
|
|
873
873
|
const T = t;
|
|
874
874
|
return T.type ? T.type === Le : T === Le;
|
|
875
875
|
}, [t]);
|
|
876
|
-
|
|
876
|
+
B(() => {
|
|
877
877
|
const T = `Tooltips should only include short text for additional context and should not exceed three lines visually. (Toolitip ID ${h}).`;
|
|
878
878
|
p && p.length > 100 && Sn(T);
|
|
879
879
|
}, [p, h]);
|
|
@@ -888,7 +888,7 @@ const Ee = /* @__PURE__ */ mt((n, e) => {
|
|
|
888
888
|
), S = l ? {
|
|
889
889
|
tabIndex: 0,
|
|
890
890
|
role: l ? "button" : "note",
|
|
891
|
-
onKeyPress:
|
|
891
|
+
onKeyPress: $,
|
|
892
892
|
onClick: w
|
|
893
893
|
} : {};
|
|
894
894
|
return /* @__PURE__ */ I.createElement("span", lt({
|
|
@@ -1985,8 +1985,8 @@ var _r = (
|
|
|
1985
1985
|
!h && m && b && (h = b.querySelector(L.ROOT_SELECTOR)), this.characterCounter_ = h ? a(h) : null;
|
|
1986
1986
|
var w = this.root.querySelector(nt.LEADING_ICON_SELECTOR);
|
|
1987
1987
|
this.leadingIcon_ = w ? o(w) : null;
|
|
1988
|
-
var
|
|
1989
|
-
this.trailingIcon_ =
|
|
1988
|
+
var $ = this.root.querySelector(nt.TRAILING_ICON_SELECTOR);
|
|
1989
|
+
this.trailingIcon_ = $ ? o($) : null, this.prefix_ = this.root.querySelector(nt.PREFIX_SELECTOR), this.suffix_ = this.root.querySelector(nt.SUFFIX_SELECTOR), this.ripple = this.createRipple_(t);
|
|
1990
1990
|
}, e.prototype.destroy = function() {
|
|
1991
1991
|
this.ripple && this.ripple.destroy(), this.lineRipple_ && this.lineRipple_.destroy(), this.helperText_ && this.helperText_.destroy(), this.characterCounter_ && this.characterCounter_.destroy(), this.leadingIcon_ && this.leadingIcon_.destroy(), this.trailingIcon_ && this.trailingIcon_.destroy(), this.label_ && this.label_.destroy(), this.outline_ && this.outline_.destroy(), n.prototype.destroy.call(this);
|
|
1992
1992
|
}, e.prototype.initialSyncWithDOM = function() {
|
|
@@ -2357,11 +2357,11 @@ const yr = {
|
|
|
2357
2357
|
className: i,
|
|
2358
2358
|
...a
|
|
2359
2359
|
} = n, o = F(), l = F();
|
|
2360
|
-
return xt(e, () => l.current, []),
|
|
2360
|
+
return xt(e, () => l.current, []), B(() => (o.current = ln.attachTo(l.current), () => {
|
|
2361
2361
|
o.current.destroy();
|
|
2362
|
-
}), [l]),
|
|
2362
|
+
}), [l]), B(() => {
|
|
2363
2363
|
t ? o.current.activate() : o.current.deactivate();
|
|
2364
|
-
}, [t]),
|
|
2364
|
+
}, [t]), B(() => {
|
|
2365
2365
|
r && o.current.setRippleCenter(r);
|
|
2366
2366
|
}, [r]), /* @__PURE__ */ I.createElement("div", lt({
|
|
2367
2367
|
ref: l,
|
|
@@ -2759,7 +2759,7 @@ const Ir = {
|
|
|
2759
2759
|
helperTextId: L,
|
|
2760
2760
|
helperTextPersistent: h,
|
|
2761
2761
|
helperTextValidation: w,
|
|
2762
|
-
id:
|
|
2762
|
+
id: $,
|
|
2763
2763
|
label: O,
|
|
2764
2764
|
labelId: U,
|
|
2765
2765
|
leadingContent: J,
|
|
@@ -2787,30 +2787,30 @@ const Ir = {
|
|
|
2787
2787
|
} = n, {
|
|
2788
2788
|
hoisted: Vt,
|
|
2789
2789
|
position: Ut = "bottom"
|
|
2790
|
-
} = R && typeof R == "object" ? R : {}, [Tt] = rt(() =>
|
|
2791
|
-
|
|
2790
|
+
} = R && typeof R == "object" ? R : {}, [Tt] = rt(() => $ || Ht()), [Pt] = rt(() => L || Ht()), [Ft] = rt(() => U || Ht()), [Wt, te] = rt(!0), [Ct, ee] = rt(!1), [c, d] = rt(T), y = g || l && c, P = N ? "textarea" : "input", G = F(), A = F(), E = F(), Z = F(), tt = F(), Q = F(), pt = F(), wt = F(), yn = (j || q) && !N, Ot = vt(() => dt ?? !0, [dt]), Lt = !N && (v || x || ft === "embedded"), ne = !v && (z || _ || ft === "outlined"), qt = !ne && !Lt && (gt || C || ft === "filled"), Dt = Lt || m || t, re = !Lt && !!O && !f;
|
|
2791
|
+
B(() => (E.current = _r.attachTo(Z.current), () => {
|
|
2792
2792
|
E.current.destroy();
|
|
2793
2793
|
}), [Ct]), xt(e, () => ({
|
|
2794
2794
|
mdc: E.current,
|
|
2795
2795
|
input: tt.current,
|
|
2796
2796
|
container: Q.current,
|
|
2797
2797
|
label: Z.current
|
|
2798
|
-
})),
|
|
2798
|
+
})), B(() => (g && typeof g == "string" && (A.current = new dn(G.current)), () => {
|
|
2799
2799
|
A.current && A.current.destroy();
|
|
2800
|
-
}), [g]),
|
|
2800
|
+
}), [g]), B(() => {
|
|
2801
2801
|
if (g) {
|
|
2802
2802
|
var W, et, at, Nt;
|
|
2803
2803
|
(W = A.current) === null || W === void 0 || W.foundation.setValidation(w), (et = A.current) === null || et === void 0 || et.foundation.setValidity(Ot), (at = A.current) === null || at === void 0 || at.foundation.setPersistent(h), (Nt = A.current) === null || Nt === void 0 || Nt.foundation.setContent(g);
|
|
2804
2804
|
}
|
|
2805
|
-
}, [g, h, w, Ot]),
|
|
2805
|
+
}, [g, h, w, Ot]), B(() => {
|
|
2806
2806
|
s || (E.current.value = X || X === 0 ? X : ""), E.current.valid = Ot;
|
|
2807
|
-
}, [E, X, Ot, s]),
|
|
2807
|
+
}, [E, X, Ot, s]), B(() => {
|
|
2808
2808
|
E.current.disabled = p;
|
|
2809
|
-
}, [E, p]),
|
|
2809
|
+
}, [E, p]), B(() => {
|
|
2810
2810
|
d(S && !T ? S : T);
|
|
2811
|
-
}, [T, S]),
|
|
2811
|
+
}, [T, S]), B(() => {
|
|
2812
2812
|
ee(c > 0 && l);
|
|
2813
|
-
}, [c, l]),
|
|
2813
|
+
}, [c, l]), B(() => {
|
|
2814
2814
|
te(Dt || l || g);
|
|
2815
2815
|
}, [Dt, l, g]);
|
|
2816
2816
|
const En = () => {
|
|
@@ -2820,9 +2820,9 @@ const Ir = {
|
|
|
2820
2820
|
}, xe = () => {
|
|
2821
2821
|
E.current.value = "", E.current.valid = Ot;
|
|
2822
2822
|
};
|
|
2823
|
-
|
|
2823
|
+
B(() => (window.addEventListener("reset", xe), () => {
|
|
2824
2824
|
window.removeEventListener("reset", xe);
|
|
2825
|
-
}), []),
|
|
2825
|
+
}), []), B(() => {
|
|
2826
2826
|
if (R) {
|
|
2827
2827
|
const W = [{
|
|
2828
2828
|
name: "flip",
|
|
@@ -2908,10 +2908,10 @@ const Ir = {
|
|
|
2908
2908
|
value: X
|
|
2909
2909
|
}, Rt)), !D && Ke(Ct, c)), j && !N && Cr(j), V && !j && !N && /* @__PURE__ */ I.createElement("span", {
|
|
2910
2910
|
className: "mdc-text-field__affix mdc-text-field__affix--suffix"
|
|
2911
|
-
}, V), ne && /* @__PURE__ */ I.createElement(zt, null, re && /* @__PURE__ */ I.createElement(
|
|
2911
|
+
}, V), ne && /* @__PURE__ */ I.createElement(zt, null, re && /* @__PURE__ */ I.createElement(Bt, {
|
|
2912
2912
|
id: Ft,
|
|
2913
2913
|
htmlFor: Tt
|
|
2914
|
-
}, O)), qt && re && /* @__PURE__ */ I.createElement(
|
|
2914
|
+
}, O)), qt && re && /* @__PURE__ */ I.createElement(Bt, {
|
|
2915
2915
|
id: Ft,
|
|
2916
2916
|
htmlFor: Tt
|
|
2917
2917
|
}, O), (qt || Lt) && /* @__PURE__ */ I.createElement(Zt, null)), H, y && /* @__PURE__ */ I.createElement("div", {
|
|
@@ -2942,10 +2942,10 @@ function pn(n, e) {
|
|
|
2942
2942
|
e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[i]) && (t[r[i]] = n[r[i]]);
|
|
2943
2943
|
return t;
|
|
2944
2944
|
}
|
|
2945
|
-
var
|
|
2945
|
+
var $t;
|
|
2946
2946
|
(function(n) {
|
|
2947
2947
|
n.event = "event", n.props = "prop";
|
|
2948
|
-
})(
|
|
2948
|
+
})($t || ($t = {}));
|
|
2949
2949
|
function ht() {
|
|
2950
2950
|
}
|
|
2951
2951
|
function Lr(n) {
|
|
@@ -3122,8 +3122,8 @@ function jr(n, e, t, r, i, a, o) {
|
|
|
3122
3122
|
var w = h === f || C[h] === -1 ? p : C[h];
|
|
3123
3123
|
for (h = r - 1; h > 0 && C[h] === -1; )
|
|
3124
3124
|
h--;
|
|
3125
|
-
var
|
|
3126
|
-
return
|
|
3125
|
+
var $ = h === -1 || C[h] === -1 ? 0 : C[h] + 1;
|
|
3126
|
+
return $ > w ? w : r - $ < w - r ? $ : w;
|
|
3127
3127
|
}
|
|
3128
3128
|
function Je(n, e, t, r) {
|
|
3129
3129
|
var i = n.length;
|
|
@@ -3138,7 +3138,7 @@ function Je(n, e, t, r) {
|
|
|
3138
3138
|
}
|
|
3139
3139
|
return e === -1 && (e = i), e;
|
|
3140
3140
|
}
|
|
3141
|
-
function
|
|
3141
|
+
function Br(n) {
|
|
3142
3142
|
for (var e = Array.from({ length: n.length + 1 }).map(function() {
|
|
3143
3143
|
return !0;
|
|
3144
3144
|
}), t = 0, r = e.length; t < r; t++)
|
|
@@ -3164,7 +3164,7 @@ function _n(n, e, t, r, i, a) {
|
|
|
3164
3164
|
f(b);
|
|
3165
3165
|
}, [b.formattedValue]), [s, p];
|
|
3166
3166
|
}
|
|
3167
|
-
function
|
|
3167
|
+
function $r(n) {
|
|
3168
3168
|
return n.replace(/[^0-9]/g, "");
|
|
3169
3169
|
}
|
|
3170
3170
|
function kr(n) {
|
|
@@ -3178,7 +3178,7 @@ function Mr(n) {
|
|
|
3178
3178
|
var r = n.customInput, i = n.renderText, a = n.getInputRef, o = n.format;
|
|
3179
3179
|
o === void 0 && (o = kr);
|
|
3180
3180
|
var l = n.removeFormatting;
|
|
3181
|
-
l === void 0 && (l =
|
|
3181
|
+
l === void 0 && (l = $r);
|
|
3182
3182
|
var s = n.defaultValue, f = n.valueIsNumericString, p = n.onValueChange, v = n.isAllowed, C = n.onChange;
|
|
3183
3183
|
C === void 0 && (C = ht);
|
|
3184
3184
|
var b = n.onKeyDown;
|
|
@@ -3190,16 +3190,16 @@ function Mr(n) {
|
|
|
3190
3190
|
var L = n.onBlur;
|
|
3191
3191
|
L === void 0 && (L = ht);
|
|
3192
3192
|
var h = n.value, w = n.getCaretBoundary;
|
|
3193
|
-
w === void 0 && (w =
|
|
3194
|
-
var
|
|
3195
|
-
|
|
3193
|
+
w === void 0 && (w = Br);
|
|
3194
|
+
var $ = n.isValidInputCharacter;
|
|
3195
|
+
$ === void 0 && ($ = kt);
|
|
3196
3196
|
var O = n.isCharacterSame, U = pn(n, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter", "isCharacterSame"]), J = _n(h, s, !!f, o, l, p), q = J[0], S = q.formattedValue, T = q.numAsString, D = J[1], M = F(), z = F({ formattedValue: S, numAsString: T }), it = function(c, d) {
|
|
3197
3197
|
z.current = { formattedValue: c.formattedValue, numAsString: c.value }, D(c, d);
|
|
3198
3198
|
}, ut = rt(!1), gt = ut[0], x = ut[1], _ = F(null), V = F({
|
|
3199
3199
|
setCaretTimeout: null,
|
|
3200
3200
|
focusTimeout: null
|
|
3201
3201
|
});
|
|
3202
|
-
|
|
3202
|
+
B(function() {
|
|
3203
3203
|
return x(!0), function() {
|
|
3204
3204
|
clearTimeout(V.current.setCaretTimeout), clearTimeout(V.current.focusTimeout);
|
|
3205
3205
|
};
|
|
@@ -3218,7 +3218,7 @@ function Mr(n) {
|
|
|
3218
3218
|
}, j = function(c, d, y) {
|
|
3219
3219
|
return Je(c, d, w(c), y);
|
|
3220
3220
|
}, st = function(c, d, y) {
|
|
3221
|
-
var P = w(d), G = jr(d, S, c, y, P,
|
|
3221
|
+
var P = w(d), G = jr(d, S, c, y, P, $, O);
|
|
3222
3222
|
return G = Je(d, G, P), G;
|
|
3223
3223
|
}, dt = function(c) {
|
|
3224
3224
|
var d = c.formattedValue;
|
|
@@ -3230,14 +3230,14 @@ function Mr(n) {
|
|
|
3230
3230
|
}
|
|
3231
3231
|
d !== S && it(R(d, A), { event: G, source: P });
|
|
3232
3232
|
};
|
|
3233
|
-
|
|
3233
|
+
B(function() {
|
|
3234
3234
|
var c = z.current, d = c.formattedValue, y = c.numAsString;
|
|
3235
3235
|
(S !== d || T !== y) && it(R(S, T), {
|
|
3236
3236
|
event: void 0,
|
|
3237
|
-
source:
|
|
3237
|
+
source: $t.props
|
|
3238
3238
|
});
|
|
3239
3239
|
}, [S, T]);
|
|
3240
|
-
var X = _.current ? ve(_.current) : void 0, ft = typeof window < "u" ? Fn :
|
|
3240
|
+
var X = _.current ? ve(_.current) : void 0, ft = typeof window < "u" ? Fn : B;
|
|
3241
3241
|
ft(function() {
|
|
3242
3242
|
var c = _.current;
|
|
3243
3243
|
if (S !== z.current.formattedValue && c) {
|
|
@@ -3264,7 +3264,7 @@ function Mr(n) {
|
|
|
3264
3264
|
var y = c.selectionStart, P = c.selectionEnd;
|
|
3265
3265
|
M.current = { selectionStart: y, selectionEnd: P + d };
|
|
3266
3266
|
}, Ut = function(c) {
|
|
3267
|
-
var d = c.target, y = d.value, P = Rt(y, c,
|
|
3267
|
+
var d = c.target, y = d.value, P = Rt(y, c, $t.event);
|
|
3268
3268
|
P && C(c), M.current = void 0;
|
|
3269
3269
|
}, Tt = function(c) {
|
|
3270
3270
|
var d = c.target, y = c.key, P = d.selectionStart, G = d.selectionEnd, A = d.value;
|
|
@@ -3282,7 +3282,7 @@ function Mr(n) {
|
|
|
3282
3282
|
if (tt) {
|
|
3283
3283
|
var pt = y === "ArrowLeft" ? "left" : "right";
|
|
3284
3284
|
Q = j(A, E, pt), Q !== E && c.preventDefault();
|
|
3285
|
-
} else y === "Delete" &&
|
|
3285
|
+
} else y === "Delete" && !$(A[E]) ? Q = j(A, E, "right") : y === "Backspace" && !$(A[E]) && (Q = j(A, E, "left"));
|
|
3286
3286
|
Q !== E && H(d, Q, A), b(c), Vt(d, Z);
|
|
3287
3287
|
}, Pt = function(c) {
|
|
3288
3288
|
var d = c.target, y = function() {
|
|
@@ -3374,14 +3374,14 @@ function Gr(n, e, t) {
|
|
|
3374
3374
|
a.startsWith("-") ? R = !1 : _.startsWith("--") ? (R = !1, H = !0) : o.startsWith("-") && _.length === o.length ? R = !1 : _[0] === "-" && (R = !0);
|
|
3375
3375
|
var j = R ? 1 : 0;
|
|
3376
3376
|
return H && (j = 2), j && (_ = _.substring(j), V -= j, N -= j), { value: _, start: V, end: N, hasNegation: R };
|
|
3377
|
-
}, w = h(n, p, v),
|
|
3377
|
+
}, w = h(n, p, v), $ = w.hasNegation;
|
|
3378
3378
|
r = w, n = r.value, p = r.start, v = r.end;
|
|
3379
3379
|
var O = h(e.lastValue, s.start, s.end), U = O.start, J = O.end, q = O.value, S = n.substring(p, v);
|
|
3380
3380
|
n.length && q.length && (U > q.length - o.length || J < a.length) && !(S && o.startsWith(S)) && (n = q);
|
|
3381
3381
|
var T = 0;
|
|
3382
3382
|
n.startsWith(a) ? T += a.length : p < a.length && (T = p), n = n.substring(T), v -= T;
|
|
3383
3383
|
var D = n.length, M = n.length - o.length;
|
|
3384
|
-
n.endsWith(o) ? D = M : (v > M || v > n.length - o.length) && (D = v), n = n.substring(0, D), n = Ur(
|
|
3384
|
+
n.endsWith(o) ? D = M : (v > M || v > n.length - o.length) && (D = v), n = n.substring(0, D), n = Ur($ ? "-" + n : n, i), n = (n.match(Wr(m)) || []).join("");
|
|
3385
3385
|
var z = n.indexOf(m);
|
|
3386
3386
|
n = n.replace(new RegExp(mn(m), "g"), function(_, V) {
|
|
3387
3387
|
return V === z ? "." : "";
|
|
@@ -3427,13 +3427,13 @@ function zr(n) {
|
|
|
3427
3427
|
f === void 0 && (f = "");
|
|
3428
3428
|
var p = n.defaultValue, v = n.value, C = n.valueIsNumericString, b = n.onValueChange, m = pn(n, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]), g = Yt(n), L = g.decimalSeparator, h = g.allowedDecimalSeparators, w = function(x) {
|
|
3429
3429
|
return Qe(x, n);
|
|
3430
|
-
},
|
|
3430
|
+
}, $ = function(x, _) {
|
|
3431
3431
|
return Gr(x, _, n);
|
|
3432
3432
|
}, O = St(v) ? p : v, U = C ?? qr(O, f, e);
|
|
3433
3433
|
St(v) ? St(p) || (U = U || typeof p == "number") : U = U || typeof v == "number";
|
|
3434
3434
|
var J = function(x) {
|
|
3435
3435
|
return hn(x) ? x : (typeof x == "number" && (x = gn(x)), U && typeof l == "number" ? Ze(x, l, !!s) : x);
|
|
3436
|
-
}, q = _n(J(v), J(p), !!U, w,
|
|
3436
|
+
}, q = _n(J(v), J(p), !!U, w, $, b), S = q[0], T = S.numAsString, D = S.formattedValue, M = q[1], z = function(x) {
|
|
3437
3437
|
var _ = x.target, V = x.key, N = _.selectionStart, R = _.selectionEnd, H = _.value;
|
|
3438
3438
|
if (H === void 0 && (H = ""), (V === "Backspace" || V === "Delete") && R < f.length) {
|
|
3439
3439
|
x.preventDefault();
|
|
@@ -3456,7 +3456,7 @@ function zr(n) {
|
|
|
3456
3456
|
floatValue: parseFloat(_)
|
|
3457
3457
|
}, {
|
|
3458
3458
|
event: x,
|
|
3459
|
-
source:
|
|
3459
|
+
source: $t.event
|
|
3460
3460
|
});
|
|
3461
3461
|
}
|
|
3462
3462
|
a(x);
|
|
@@ -3464,7 +3464,7 @@ function zr(n) {
|
|
|
3464
3464
|
return x === L ? !0 : kt(x);
|
|
3465
3465
|
}, gt = function(x) {
|
|
3466
3466
|
var _ = x.currentValue, V = x.lastValue, N = x.formattedValue, R = x.currentValueIndex, H = x.formattedValueIndex, j = _[R], st = N[H], dt = bn(V, _), X = dt.to, ft = function(Rt) {
|
|
3467
|
-
return
|
|
3467
|
+
return $(Rt).indexOf(".") + f.length;
|
|
3468
3468
|
};
|
|
3469
3469
|
return v === 0 && s && l && _[X.start] === L && ft(_) < R && ft(N) > H ? !1 : R >= X.start && R < X.end && h && h.includes(j) && st === L ? !0 : j === st;
|
|
3470
3470
|
};
|
|
@@ -3475,7 +3475,7 @@ function zr(n) {
|
|
|
3475
3475
|
isCharacterSame: gt,
|
|
3476
3476
|
onValueChange: M,
|
|
3477
3477
|
format: w,
|
|
3478
|
-
removeFormatting:
|
|
3478
|
+
removeFormatting: $,
|
|
3479
3479
|
getCaretBoundary: function(x) {
|
|
3480
3480
|
return Xr(x, n);
|
|
3481
3481
|
},
|
|
@@ -3586,7 +3586,7 @@ const Yr = "_invalid_1dsbr_1", ti = {
|
|
|
3586
3586
|
...n
|
|
3587
3587
|
}) => {
|
|
3588
3588
|
const { t: e, i18n: t } = Pn();
|
|
3589
|
-
return /* @__PURE__ */ jt(
|
|
3589
|
+
return /* @__PURE__ */ jt($n, { children: /* @__PURE__ */ jt(
|
|
3590
3590
|
ni,
|
|
3591
3591
|
{
|
|
3592
3592
|
...n,
|