@telefonica/mistica 16.0.0 → 16.1.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/README.md +11 -9
- package/css/mistica.css +1 -1
- package/dist/box.d.ts +1 -0
- package/dist/box.js +12 -12
- package/dist/card.d.ts +14 -2
- package/dist/card.js +210 -206
- package/dist/credit-card-expiration-field.d.ts +1 -1
- package/dist/credit-card-expiration-field.js +53 -52
- package/dist/credit-card-number-field.d.ts +1 -1
- package/dist/credit-card-number-field.js +47 -45
- package/dist/cvv-field.d.ts +1 -1
- package/dist/cvv-field.js +38 -37
- package/dist/date-field.d.ts +1 -1
- package/dist/date-field.js +15 -13
- package/dist/date-time-field.d.ts +1 -1
- package/dist/date-time-field.js +13 -11
- package/dist/decimal-field.d.ts +1 -1
- package/dist/decimal-field.js +39 -38
- package/dist/email-field.d.ts +1 -1
- package/dist/email-field.js +21 -19
- package/dist/form-context.d.ts +7 -2
- package/dist/form-context.js +69 -62
- package/dist/form.d.ts +2 -1
- package/dist/form.js +94 -80
- package/dist/iban-field.d.ts +1 -1
- package/dist/iban-field.js +32 -30
- package/dist/index.d.ts +12 -3
- package/dist/index.js +19 -8
- package/dist/inline.d.ts +2 -1
- package/dist/inline.js +16 -15
- package/dist/integer-field.d.ts +1 -1
- package/dist/integer-field.js +30 -30
- package/dist/month-field.d.ts +1 -1
- package/dist/month-field.js +15 -13
- package/dist/package-version.js +1 -1
- package/dist/password-field.d.ts +1 -1
- package/dist/password-field.js +24 -22
- package/dist/phone-number-field.d.ts +4 -1
- package/dist/phone-number-field.js +84 -52
- package/dist/pin-field.js +21 -20
- package/dist/radio-button.d.ts +1 -0
- package/dist/radio-button.js +42 -41
- package/dist/rating.css-mistica.js +44 -0
- package/dist/rating.css.d.ts +11 -0
- package/dist/rating.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/rating.d.ts +37 -0
- package/dist/rating.js +320 -0
- package/dist/search-field.d.ts +1 -0
- package/dist/search-field.js +18 -16
- package/dist/select.js +36 -33
- package/dist/sheet-action-row.css-mistica.js +13 -0
- package/dist/sheet-action-row.css.d.ts +1 -0
- package/dist/sheet-actions-list.d.ts +26 -0
- package/dist/sheet-actions-list.js +147 -0
- package/dist/sheet-actions.d.ts +23 -0
- package/dist/sheet-actions.js +175 -0
- package/dist/{sheet.css-mistica.js → sheet-common.css-mistica.js} +15 -21
- package/dist/{sheet.css.d.ts → sheet-common.css.d.ts} +0 -2
- package/dist/sheet-common.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/sheet-common.d.ts +24 -0
- package/dist/sheet-common.js +429 -0
- package/dist/sheet-info.css-mistica.js +12 -0
- package/dist/sheet-info.css.d.ts +1 -0
- package/dist/sheet-info.d.ts +28 -0
- package/dist/sheet-info.js +156 -0
- package/dist/sheet-native.d.ts +2 -0
- package/dist/sheet-native.js +173 -0
- package/dist/sheet-radio-list.d.ts +22 -0
- package/dist/sheet-radio-list.js +143 -0
- package/dist/sheet-root.d.ts +4 -85
- package/dist/sheet-root.js +48 -322
- package/dist/sheet-types.d.ts +88 -0
- package/dist/sheet-web.d.ts +8 -0
- package/dist/sheet-web.js +183 -0
- package/dist/slider.js +40 -39
- package/dist/switch-component.js +18 -17
- package/dist/text-field-base.d.ts +3 -1
- package/dist/text-field-base.js +74 -66
- package/dist/text-field-components.css-mistica.js +14 -14
- package/dist/text-field-components.css.d.ts +2 -2
- package/dist/text-field-components.js +49 -39
- package/dist/text-field.d.ts +1 -0
- package/dist/text-field.js +24 -22
- package/dist/text-tokens.d.ts +14 -0
- package/dist/text-tokens.js +145 -89
- package/dist/theme-context-provider.js +6 -5
- package/dist/theme.d.ts +2 -0
- package/dist/utils/credit-card.d.ts +2 -2
- package/dist/utils/credit-card.js +1 -1
- package/dist/vivinho-loading-animation/in-lottie.json.js +544 -612
- package/dist/vivinho-loading-animation/out-lottie.json.js +828 -896
- package/dist/vivinho-loading-animation/pulse-lottie.json.js +798 -866
- package/dist/vivinho-loading-animation/wave-lottie.json.js +4303 -4409
- package/dist-es/box.js +18 -18
- package/dist-es/card.js +305 -301
- package/dist-es/credit-card-expiration-field.js +57 -56
- package/dist-es/credit-card-number-field.js +74 -72
- package/dist-es/cvv-field.js +82 -81
- package/dist-es/date-field.js +29 -27
- package/dist-es/date-time-field.js +29 -27
- package/dist-es/decimal-field.js +46 -45
- package/dist-es/email-field.js +26 -24
- package/dist-es/form-context.js +70 -63
- package/dist-es/form.js +102 -88
- package/dist-es/iban-field.js +35 -33
- package/dist-es/index.js +1822 -1817
- package/dist-es/inline.js +26 -25
- package/dist-es/integer-field.js +31 -31
- package/dist-es/month-field.js +28 -26
- package/dist-es/package-version.js +1 -1
- package/dist-es/password-field.js +37 -35
- package/dist-es/phone-number-field.js +92 -60
- package/dist-es/pin-field.js +32 -31
- package/dist-es/radio-button.js +42 -41
- package/dist-es/rating.css-mistica.js +6 -0
- package/dist-es/rating.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/rating.js +257 -0
- package/dist-es/search-field.js +33 -31
- package/dist-es/select.js +49 -46
- package/dist-es/sheet-action-row.css-mistica.js +4 -0
- package/dist-es/sheet-actions-list.js +92 -0
- package/dist-es/sheet-actions.js +125 -0
- package/dist-es/sheet-common.css-mistica.js +4 -0
- package/dist-es/sheet-common.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/sheet-common.js +366 -0
- package/dist-es/sheet-info.css-mistica.js +3 -0
- package/dist-es/sheet-info.js +101 -0
- package/dist-es/sheet-native.js +164 -0
- package/dist-es/sheet-radio-list.js +88 -0
- package/dist-es/sheet-root.js +50 -319
- package/dist-es/sheet-web.js +128 -0
- package/dist-es/slider.js +49 -48
- package/dist-es/style.css +1 -1
- package/dist-es/switch-component.js +27 -26
- package/dist-es/text-field-base.js +108 -100
- package/dist-es/text-field-components.css-mistica.js +2 -2
- package/dist-es/text-field-components.js +70 -60
- package/dist-es/text-field.js +33 -31
- package/dist-es/text-tokens.js +80 -45
- package/dist-es/theme-context-provider.js +20 -19
- package/dist-es/utils/credit-card.js +1 -1
- package/dist-es/vivinho-loading-animation/in-lottie.json.js +534 -599
- package/dist-es/vivinho-loading-animation/out-lottie.json.js +821 -886
- package/dist-es/vivinho-loading-animation/pulse-lottie.json.js +790 -855
- package/dist-es/vivinho-loading-animation/wave-lottie.json.js +4297 -4400
- package/package.json +4 -3
- package/dist/sheet.d.ts +0 -107
- package/dist/sheet.js +0 -642
- package/dist-es/sheet.css-mistica.js +0 -4
- package/dist-es/sheet.js +0 -567
- /package/dist/{sheet.css.ts.vanilla.css-mistica.js → sheet-action-row.css.ts.vanilla.css-mistica.js} +0 -0
- /package/dist-es/{sheet.css.ts.vanilla.css-mistica.js → sheet-action-row.css.ts.vanilla.css-mistica.js} +0 -0
package/dist-es/date-field.js
CHANGED
|
@@ -80,23 +80,24 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
80
80
|
}
|
|
81
81
|
import { jsx as t } from "react/jsx-runtime";
|
|
82
82
|
import * as f from "react";
|
|
83
|
-
import { useFieldProps as
|
|
84
|
-
import { TextFieldBaseAutosuggest as
|
|
85
|
-
import { isInputTypeSupported as
|
|
86
|
-
import { isServerSide as
|
|
87
|
-
import
|
|
83
|
+
import { useFieldProps as b } from "./form-context.js";
|
|
84
|
+
import { TextFieldBaseAutosuggest as A } from "./text-field-base.js";
|
|
85
|
+
import { isInputTypeSupported as E } from "./utils/dom.js";
|
|
86
|
+
import { isServerSide as N } from "./utils/environment.js";
|
|
87
|
+
import j from "./generated/mistica-icons/icon-calendar-regular.js";
|
|
88
88
|
import { getLocalDateString as r } from "./utils/time.js";
|
|
89
|
-
import { useTheme as
|
|
90
|
-
import { isFirefox as
|
|
91
|
-
import { iconContainer as
|
|
92
|
-
import { iconSize as
|
|
93
|
-
import { formDateOutOfRangeError as
|
|
94
|
-
const
|
|
95
|
-
var { disabled: D, error: g, helperText: F, name: R, optional: c, validate: n, onChange:
|
|
89
|
+
import { useTheme as v } from "./hooks.js";
|
|
90
|
+
import { isFirefox as B } from "./utils/platform.js";
|
|
91
|
+
import { iconContainer as C } from "./date-field.css-mistica.js";
|
|
92
|
+
import { iconSize as L } from "./icon-button.css-mistica.js";
|
|
93
|
+
import { formDateOutOfRangeError as M } from "./text-tokens.js";
|
|
94
|
+
const V = /*#__PURE__*/ f.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), $ = (_param)=>{
|
|
95
|
+
var { disabled: D, error: g, helperText: F, name: R, label: S, optional: c, validate: n, onChange: O, onChangeValue: s, onBlur: k, value: y, defaultValue: I, min: o, max: i, dataAttributes: d } = _param, u = _object_without_properties(_param, [
|
|
96
96
|
"disabled",
|
|
97
97
|
"error",
|
|
98
98
|
"helperText",
|
|
99
99
|
"name",
|
|
100
|
+
"label",
|
|
100
101
|
"optional",
|
|
101
102
|
"validate",
|
|
102
103
|
"onChange",
|
|
@@ -108,38 +109,39 @@ const M = /*#__PURE__*/ f.lazy(()=>import(/* webpackChunkName: "date-time-picker
|
|
|
108
109
|
"max",
|
|
109
110
|
"dataAttributes"
|
|
110
111
|
]);
|
|
111
|
-
const
|
|
112
|
+
const T = (e)=>e, h = f.useMemo(()=>B() ? !1 : E("date"), []), { texts: x, t: z } = v(), a = (e)=>!(o && e && e < r(o) || i && e && e > r(i)), p = b({
|
|
112
113
|
name: R,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
label: S,
|
|
115
|
+
value: y,
|
|
116
|
+
defaultValue: I,
|
|
117
|
+
processValue: T,
|
|
116
118
|
helperText: F,
|
|
117
119
|
optional: c,
|
|
118
120
|
error: g,
|
|
119
121
|
disabled: D,
|
|
120
|
-
onBlur:
|
|
121
|
-
validate: (e, m)=>a(e) ? n == null ? void 0 : n(e, m) :
|
|
122
|
-
onChange:
|
|
122
|
+
onBlur: k,
|
|
123
|
+
validate: (e, m)=>a(e) ? n == null ? void 0 : n(e, m) : x.formDateOutOfRangeError || z(M),
|
|
124
|
+
onChange: O,
|
|
123
125
|
onChangeValue: (e, m)=>{
|
|
124
126
|
a(e) && (s == null || s(e, m));
|
|
125
127
|
}
|
|
126
|
-
}), l = /* @__PURE__ */ t(
|
|
128
|
+
}), l = /* @__PURE__ */ t(A, _object_spread_props(_object_spread({}, u, p), {
|
|
127
129
|
min: o ? r(o) : void 0,
|
|
128
130
|
max: i ? r(i) : void 0,
|
|
129
131
|
type: "date",
|
|
130
132
|
endIconOverlay: /* @__PURE__ */ t("div", {
|
|
131
|
-
className:
|
|
132
|
-
children: /* @__PURE__ */ t(
|
|
133
|
-
size:
|
|
133
|
+
className: C,
|
|
134
|
+
children: /* @__PURE__ */ t(j, {
|
|
135
|
+
size: L.default
|
|
134
136
|
})
|
|
135
137
|
}),
|
|
136
138
|
dataAttributes: _object_spread({
|
|
137
139
|
"component-name": "DateField"
|
|
138
140
|
}, d)
|
|
139
141
|
}));
|
|
140
|
-
return
|
|
142
|
+
return h || N() ? l : /* @__PURE__ */ t(f.Suspense, {
|
|
141
143
|
fallback: l,
|
|
142
|
-
children: /* @__PURE__ */ t(
|
|
144
|
+
children: /* @__PURE__ */ t(V, _object_spread_props(_object_spread({}, u, p), {
|
|
143
145
|
optional: c,
|
|
144
146
|
isValidDate: (e)=>a(r(e.toDate())),
|
|
145
147
|
dataAttributes: _object_spread({
|
|
@@ -147,5 +149,5 @@ const M = /*#__PURE__*/ f.lazy(()=>import(/* webpackChunkName: "date-time-picker
|
|
|
147
149
|
}, d)
|
|
148
150
|
}))
|
|
149
151
|
});
|
|
150
|
-
},
|
|
151
|
-
export {
|
|
152
|
+
}, ee = $;
|
|
153
|
+
export { ee as default };
|
|
@@ -80,19 +80,19 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
80
80
|
}
|
|
81
81
|
import { jsx as r } from "react/jsx-runtime";
|
|
82
82
|
import * as c from "react";
|
|
83
|
-
import { useFieldProps as
|
|
84
|
-
import { TextFieldBaseAutosuggest as
|
|
85
|
-
import { isInputTypeSupported as
|
|
86
|
-
import { isServerSide as
|
|
83
|
+
import { useFieldProps as z } from "./form-context.js";
|
|
84
|
+
import { TextFieldBaseAutosuggest as b } from "./text-field-base.js";
|
|
85
|
+
import { isInputTypeSupported as w } from "./utils/dom.js";
|
|
86
|
+
import { isServerSide as A } from "./utils/environment.js";
|
|
87
87
|
import { getLocalDateTimeString as o } from "./utils/time.js";
|
|
88
|
-
import
|
|
89
|
-
import { isFirefox as
|
|
90
|
-
import { useTheme as
|
|
91
|
-
import { iconContainer as
|
|
92
|
-
import { iconSize as
|
|
93
|
-
import { formDateOutOfRangeError as
|
|
94
|
-
const
|
|
95
|
-
var { disabled: F, error: g, helperText: R, name: S, optional: f, validate: m, onChange:
|
|
88
|
+
import E from "./generated/mistica-icons/icon-calendar-regular.js";
|
|
89
|
+
import { isFirefox as N } from "./utils/platform.js";
|
|
90
|
+
import { useTheme as V } from "./hooks.js";
|
|
91
|
+
import { iconContainer as j } from "./date-field.css-mistica.js";
|
|
92
|
+
import { iconSize as B } from "./icon-button.css-mistica.js";
|
|
93
|
+
import { formDateOutOfRangeError as C } from "./text-tokens.js";
|
|
94
|
+
const L = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), M = (_param)=>{
|
|
95
|
+
var { disabled: F, error: g, helperText: R, name: S, label: O, optional: f, validate: m, onChange: h, onChangeValue: n, onBlur: k, value: y, defaultValue: I, min: i, /**
|
|
96
96
|
* When typing a datetime value into the input field (inside a test for example), some browsers like Chrome
|
|
97
97
|
* force the year to have exactly 6 digits. In order to prevent this, in case max value was not provided we
|
|
98
98
|
* set it so that it only accepts datetime values with years having up to 4 digits.
|
|
@@ -101,6 +101,7 @@ const C = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker
|
|
|
101
101
|
"error",
|
|
102
102
|
"helperText",
|
|
103
103
|
"name",
|
|
104
|
+
"label",
|
|
104
105
|
"optional",
|
|
105
106
|
"validate",
|
|
106
107
|
"onChange",
|
|
@@ -112,41 +113,42 @@ const C = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker
|
|
|
112
113
|
"max",
|
|
113
114
|
"dataAttributes"
|
|
114
115
|
]);
|
|
115
|
-
const d = c.useMemo(()=>
|
|
116
|
+
const d = c.useMemo(()=>N() ? !1 : w("datetime-local"), []), p = (e)=>d ? e : e.replace(/\s/, "T"), { texts: v, t: x } = V(), a = (e)=>{
|
|
116
117
|
const t = p(e);
|
|
117
118
|
return !(i && t && t < o(i) || s && t && t > o(s));
|
|
118
|
-
}, D =
|
|
119
|
+
}, D = z({
|
|
119
120
|
name: S,
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
label: O,
|
|
122
|
+
value: y,
|
|
123
|
+
defaultValue: I,
|
|
122
124
|
processValue: p,
|
|
123
125
|
helperText: R,
|
|
124
126
|
optional: f,
|
|
125
127
|
error: g,
|
|
126
128
|
disabled: F,
|
|
127
|
-
onBlur:
|
|
128
|
-
validate: (e, t)=>a(e) ? m == null ? void 0 : m(e, t) :
|
|
129
|
-
onChange:
|
|
129
|
+
onBlur: k,
|
|
130
|
+
validate: (e, t)=>a(e) ? m == null ? void 0 : m(e, t) : v.formDateOutOfRangeError || x(C),
|
|
131
|
+
onChange: h,
|
|
130
132
|
onChangeValue: (e, t)=>{
|
|
131
133
|
a(e) && (n == null || n(e, t));
|
|
132
134
|
}
|
|
133
|
-
}), T = /* @__PURE__ */ r(
|
|
135
|
+
}), T = /* @__PURE__ */ r(b, _object_spread_props(_object_spread({}, u, D), {
|
|
134
136
|
min: i ? o(i) : void 0,
|
|
135
137
|
max: s ? o(s) : void 0,
|
|
136
138
|
type: "datetime-local",
|
|
137
139
|
endIconOverlay: /* @__PURE__ */ r("div", {
|
|
138
|
-
className:
|
|
139
|
-
children: /* @__PURE__ */ r(
|
|
140
|
-
size:
|
|
140
|
+
className: j,
|
|
141
|
+
children: /* @__PURE__ */ r(E, {
|
|
142
|
+
size: B.default
|
|
141
143
|
})
|
|
142
144
|
}),
|
|
143
145
|
dataAttributes: _object_spread({
|
|
144
146
|
"component-name": "DateTimeField"
|
|
145
147
|
}, l)
|
|
146
148
|
}));
|
|
147
|
-
return d ||
|
|
149
|
+
return d || A() ? T : /* @__PURE__ */ r(c.Suspense, {
|
|
148
150
|
fallback: T,
|
|
149
|
-
children: /* @__PURE__ */ r(
|
|
151
|
+
children: /* @__PURE__ */ r(L, _object_spread_props(_object_spread({}, u, D), {
|
|
150
152
|
optional: f,
|
|
151
153
|
withTime: !0,
|
|
152
154
|
isValidDate: (e)=>a(o(e.toDate())),
|
|
@@ -155,5 +157,5 @@ const C = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker
|
|
|
155
157
|
}, l)
|
|
156
158
|
}))
|
|
157
159
|
});
|
|
158
|
-
},
|
|
159
|
-
export {
|
|
160
|
+
}, ee = M;
|
|
161
|
+
export { ee as default };
|
package/dist-es/decimal-field.js
CHANGED
|
@@ -78,57 +78,57 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
}
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
|
-
import { jsx as
|
|
82
|
-
import * as
|
|
83
|
-
import { useFieldProps as
|
|
84
|
-
import { useTheme as
|
|
85
|
-
import { TextFieldBaseAutosuggest as
|
|
86
|
-
import { createChangeEvent as
|
|
87
|
-
import { useRifm as
|
|
88
|
-
import { combineRefs as
|
|
89
|
-
|
|
90
|
-
const j = (o)=>{
|
|
81
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
82
|
+
import * as S from "react";
|
|
83
|
+
import { useFieldProps as D } from "./form-context.js";
|
|
84
|
+
import { useTheme as V } from "./hooks.js";
|
|
85
|
+
import { TextFieldBaseAutosuggest as x } from "./text-field-base.js";
|
|
86
|
+
import { createChangeEvent as F } from "./utils/dom.js";
|
|
87
|
+
import { useRifm as P } from "rifm";
|
|
88
|
+
import { combineRefs as R } from "./utils/common.js";
|
|
89
|
+
const b = (n)=>{
|
|
91
90
|
try {
|
|
92
|
-
return 1.1.toLocaleString(
|
|
91
|
+
return 1.1.toLocaleString(n.replace("_", "-"))[1];
|
|
93
92
|
} catch (e) {
|
|
94
93
|
return ".";
|
|
95
94
|
}
|
|
96
|
-
},
|
|
97
|
-
const
|
|
98
|
-
return
|
|
99
|
-
},
|
|
100
|
-
var { inputRef:
|
|
95
|
+
}, v = (n, t)=>{
|
|
96
|
+
const c = String(n !== null && n !== void 0 ? n : "").replace(/[^.,\d]/g, ""), e = /[.,]/.exec(c), r = c.split(/[.,]/);
|
|
97
|
+
return r.length === 0 ? "" : e && t > 0 ? r.shift() + e[0] + r.join("").slice(0, t) : r[0];
|
|
98
|
+
}, j = (_param)=>{
|
|
99
|
+
var { inputRef: n, value: t, defaultValue: c, onChange: e, maxDecimals: r } = _param, l = _object_without_properties(_param, [
|
|
101
100
|
"inputRef",
|
|
102
101
|
"value",
|
|
103
102
|
"defaultValue",
|
|
104
103
|
"onChange",
|
|
105
104
|
"maxDecimals"
|
|
106
105
|
]);
|
|
107
|
-
const { i18n:
|
|
108
|
-
|
|
106
|
+
const { i18n: a } = V(), u = b(a.locale), p = (o)=>String(o !== null && o !== void 0 ? o : "").replace(/[.,]/g, u), [m, f] = S.useState(c !== null && c !== void 0 ? c : ""), s = S.useRef(null), i = typeof t < "u", d = i ? t : m, g = S.useCallback((o)=>{
|
|
107
|
+
i || f(o), s.current && (e == null || e(F(s.current, o)));
|
|
109
108
|
}, [
|
|
110
|
-
|
|
109
|
+
i,
|
|
111
110
|
e
|
|
112
|
-
]),
|
|
113
|
-
format: (
|
|
111
|
+
]), h = P({
|
|
112
|
+
format: (o)=>v(o, r),
|
|
114
113
|
replace: p,
|
|
115
|
-
value:
|
|
116
|
-
onChange:
|
|
114
|
+
value: d,
|
|
115
|
+
onChange: g,
|
|
117
116
|
accept: /[\d.,]+/g
|
|
118
117
|
});
|
|
119
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ y("input", _object_spread_props(_object_spread({}, l), {
|
|
120
119
|
type: "text",
|
|
121
120
|
inputMode: "decimal",
|
|
122
|
-
value:
|
|
123
|
-
onChange:
|
|
124
|
-
ref:
|
|
121
|
+
value: h.value,
|
|
122
|
+
onChange: h.onChange,
|
|
123
|
+
ref: R(n, s)
|
|
125
124
|
}));
|
|
126
|
-
},
|
|
127
|
-
var { disabled:
|
|
125
|
+
}, A = (_param)=>{
|
|
126
|
+
var { disabled: n, error: t, helperText: c, name: e, label: r, optional: l, validate: a, onChange: u, onChangeValue: p, onBlur: m, value: f, defaultValue: s, maxDecimals: i = 1 / 0, dataAttributes: d } = _param, g = _object_without_properties(_param, [
|
|
128
127
|
"disabled",
|
|
129
128
|
"error",
|
|
130
129
|
"helperText",
|
|
131
130
|
"name",
|
|
131
|
+
"label",
|
|
132
132
|
"optional",
|
|
133
133
|
"validate",
|
|
134
134
|
"onChange",
|
|
@@ -139,28 +139,29 @@ const j = (o)=>{
|
|
|
139
139
|
"maxDecimals",
|
|
140
140
|
"dataAttributes"
|
|
141
141
|
]);
|
|
142
|
-
const
|
|
142
|
+
const o = D({
|
|
143
143
|
name: e,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
label: r,
|
|
145
|
+
value: f,
|
|
146
|
+
defaultValue: s,
|
|
147
|
+
processValue: (C)=>C.trim(),
|
|
148
|
+
helperText: c,
|
|
149
|
+
optional: l,
|
|
150
|
+
error: t,
|
|
151
|
+
disabled: n,
|
|
152
|
+
onBlur: m,
|
|
153
|
+
validate: a,
|
|
153
154
|
onChange: u,
|
|
154
|
-
onChangeValue:
|
|
155
|
+
onChangeValue: p
|
|
155
156
|
});
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
inputComponent:
|
|
157
|
+
return /* @__PURE__ */ y(x, _object_spread_props(_object_spread({}, g, o), {
|
|
158
|
+
inputComponent: j,
|
|
158
159
|
inputProps: {
|
|
159
160
|
maxDecimals: i
|
|
160
161
|
},
|
|
161
162
|
dataAttributes: _object_spread({
|
|
162
163
|
"component-name": "DecimalField"
|
|
163
|
-
},
|
|
164
|
+
}, d)
|
|
164
165
|
}));
|
|
165
|
-
},
|
|
166
|
-
export {
|
|
166
|
+
}, M = A;
|
|
167
|
+
export { j as DecimalInput, M as default };
|
package/dist-es/email-field.js
CHANGED
|
@@ -78,17 +78,18 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
}
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
|
-
import { jsx as
|
|
82
|
-
import { useFieldProps as
|
|
83
|
-
import { useTheme as
|
|
84
|
-
import { TextFieldBaseAutosuggest as
|
|
85
|
-
import {
|
|
86
|
-
const
|
|
87
|
-
var { disabled:
|
|
81
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
82
|
+
import { useFieldProps as T } from "./form-context.js";
|
|
83
|
+
import { useTheme as V } from "./hooks.js";
|
|
84
|
+
import { TextFieldBaseAutosuggest as $ } from "./text-field-base.js";
|
|
85
|
+
import { formEmailError as b } from "./text-tokens.js";
|
|
86
|
+
const h = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, j = (_param)=>{
|
|
87
|
+
var { disabled: r, error: o, helperText: s, name: m, label: i, optional: l, validate: e, onChange: n, onChangeValue: a, onBlur: u, value: c, autoComplete: f = "email", defaultValue: p, dataAttributes: E } = _param, d = _object_without_properties(_param, [
|
|
88
88
|
"disabled",
|
|
89
89
|
"error",
|
|
90
90
|
"helperText",
|
|
91
91
|
"name",
|
|
92
|
+
"label",
|
|
92
93
|
"optional",
|
|
93
94
|
"validate",
|
|
94
95
|
"onChange",
|
|
@@ -99,27 +100,28 @@ const $ = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, b = (_param)=>{
|
|
|
99
100
|
"defaultValue",
|
|
100
101
|
"dataAttributes"
|
|
101
102
|
]);
|
|
102
|
-
const { texts:
|
|
103
|
-
name:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
const { texts: F, t: x } = V(), A = T({
|
|
104
|
+
name: m,
|
|
105
|
+
label: i,
|
|
106
|
+
value: c,
|
|
107
|
+
defaultValue: p,
|
|
108
|
+
processValue: (t)=>t.trim(),
|
|
109
|
+
helperText: s,
|
|
110
|
+
optional: l,
|
|
111
|
+
error: o,
|
|
112
|
+
disabled: r,
|
|
113
|
+
onBlur: u,
|
|
114
|
+
validate: (t, g)=>h.test(t !== null && t !== void 0 ? t : "") ? e == null ? void 0 : e(t, g) : F.formEmailError || x(b),
|
|
115
|
+
onChange: n,
|
|
116
|
+
onChangeValue: a
|
|
115
117
|
});
|
|
116
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ M($, _object_spread_props(_object_spread({}, d, A), {
|
|
117
119
|
type: "email",
|
|
118
120
|
inputMode: "email",
|
|
119
|
-
autoComplete:
|
|
121
|
+
autoComplete: f,
|
|
120
122
|
dataAttributes: _object_spread({
|
|
121
123
|
"component-name": "EmailField"
|
|
122
|
-
},
|
|
124
|
+
}, E)
|
|
123
125
|
}));
|
|
124
|
-
}, q =
|
|
126
|
+
}, q = j;
|
|
125
127
|
export { q as default };
|
package/dist-es/form-context.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
3
|
-
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import { useTheme as z } from "./hooks.js";
|
|
4
|
+
import { formFieldErrorIsMandatory as A } from "./text-tokens.js";
|
|
5
|
+
const D = /*#__PURE__*/ l.createContext({
|
|
4
6
|
values: {},
|
|
5
7
|
setValue: ()=>{},
|
|
6
8
|
rawValues: {},
|
|
@@ -13,108 +15,113 @@ const k = /*#__PURE__*/ c.createContext({
|
|
|
13
15
|
submit: ()=>{},
|
|
14
16
|
validate: ()=>({}),
|
|
15
17
|
formId: ""
|
|
16
|
-
}),
|
|
17
|
-
let { name: r, value:
|
|
18
|
-
const { setRawValue:
|
|
18
|
+
}), M = ()=>l.useContext(D), J = (param)=>{
|
|
19
|
+
let { name: r, label: d, value: s, defaultValue: u, onChange: f, disabled: x } = param;
|
|
20
|
+
const { setRawValue: i, setValue: v, rawValues: o, setFormError: E, register: p, formStatus: w } = M();
|
|
19
21
|
var _o_r;
|
|
20
|
-
return
|
|
22
|
+
return l.useEffect(()=>{
|
|
21
23
|
if (o[r] === void 0) {
|
|
22
24
|
var _ref;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
+
const t = (_ref = s !== null && s !== void 0 ? s : u) !== null && _ref !== void 0 ? _ref : !1;
|
|
26
|
+
v({
|
|
25
27
|
name: r,
|
|
26
|
-
value:
|
|
27
|
-
}),
|
|
28
|
+
value: t
|
|
29
|
+
}), i({
|
|
28
30
|
name: r,
|
|
29
|
-
value:
|
|
31
|
+
value: t
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
}, [
|
|
33
|
-
|
|
35
|
+
s,
|
|
34
36
|
r,
|
|
35
|
-
|
|
37
|
+
u,
|
|
36
38
|
o,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
v,
|
|
40
|
+
i
|
|
39
41
|
]), {
|
|
40
42
|
name: r,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
label: d,
|
|
44
|
+
value: s,
|
|
45
|
+
defaultValue: u !== null && u !== void 0 ? u : s === void 0 ? (_o_r = o[r]) !== null && _o_r !== void 0 ? _o_r : !1 : void 0,
|
|
46
|
+
focusableRef: (t)=>p(r, {
|
|
47
|
+
focusableElement: t,
|
|
48
|
+
label: d
|
|
45
49
|
}),
|
|
46
|
-
onChange: (
|
|
47
|
-
|
|
50
|
+
onChange: (t)=>{
|
|
51
|
+
i({
|
|
48
52
|
name: r,
|
|
49
|
-
value:
|
|
50
|
-
}),
|
|
53
|
+
value: t
|
|
54
|
+
}), v({
|
|
51
55
|
name: r,
|
|
52
|
-
value:
|
|
56
|
+
value: t
|
|
53
57
|
}), E({
|
|
54
58
|
name: r,
|
|
55
59
|
error: ""
|
|
56
|
-
}),
|
|
60
|
+
}), f == null || f(t);
|
|
57
61
|
},
|
|
58
|
-
disabled:
|
|
62
|
+
disabled: w === "sending" || x
|
|
59
63
|
};
|
|
60
|
-
},
|
|
61
|
-
let { name: r, value:
|
|
64
|
+
}, K = (param)=>{
|
|
65
|
+
let { name: r, label: d, value: s, defaultValue: u, processValue: f, helperText: x, optional: i, error: v, disabled: o, onBlur: E, validate: p, onChange: w, onChangeValue: t } = param;
|
|
62
66
|
var _ref, _ref1;
|
|
63
|
-
const { setRawValue:
|
|
64
|
-
var
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
+
const { texts: P, t: j } = z(), { setRawValue: V, setValue: T, rawValues: F, values: q, formErrors: S, formStatus: N, setFormError: R, register: b } = M(), I = (_ref1 = (_ref = s !== null && s !== void 0 ? s : u) !== null && _ref !== void 0 ? _ref : F[r]) !== null && _ref1 !== void 0 ? _ref1 : "", k = l.useRef(f);
|
|
68
|
+
var _F_r;
|
|
69
|
+
return l.useEffect(()=>{
|
|
70
|
+
V({
|
|
67
71
|
name: r,
|
|
68
|
-
value:
|
|
69
|
-
}),
|
|
72
|
+
value: I
|
|
73
|
+
}), T({
|
|
70
74
|
name: r,
|
|
71
|
-
value:
|
|
75
|
+
value: k.current(I)
|
|
72
76
|
});
|
|
73
77
|
}, [
|
|
74
78
|
r,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
]),
|
|
79
|
-
o &&
|
|
79
|
+
I,
|
|
80
|
+
V,
|
|
81
|
+
T
|
|
82
|
+
]), l.useEffect(()=>{
|
|
83
|
+
o && R({
|
|
80
84
|
name: r,
|
|
81
85
|
error: void 0
|
|
82
86
|
});
|
|
83
87
|
}, [
|
|
84
88
|
o,
|
|
85
89
|
r,
|
|
86
|
-
|
|
90
|
+
R
|
|
87
91
|
]), {
|
|
88
|
-
value:
|
|
89
|
-
defaultValue:
|
|
92
|
+
value: s,
|
|
93
|
+
defaultValue: u !== null && u !== void 0 ? u : s === void 0 ? (_F_r = F[r]) !== null && _F_r !== void 0 ? _F_r : "" : void 0,
|
|
90
94
|
name: r,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
label: d,
|
|
96
|
+
helperText: S[r] || x,
|
|
97
|
+
required: !i,
|
|
98
|
+
error: v || !!S[r],
|
|
99
|
+
disabled: o || N === "sending",
|
|
100
|
+
onBlur: (c)=>{
|
|
101
|
+
let e;
|
|
102
|
+
!F[r] && !i ? e = P.formFieldErrorIsMandatory || j(A) : p && (e = p(q[r], F[r])), R({
|
|
97
103
|
name: r,
|
|
98
|
-
error:
|
|
99
|
-
}), E == null || E(
|
|
104
|
+
error: e
|
|
105
|
+
}), E == null || E(c);
|
|
100
106
|
},
|
|
101
|
-
inputRef: (
|
|
102
|
-
input:
|
|
103
|
-
validator:
|
|
107
|
+
inputRef: (c)=>b(r, {
|
|
108
|
+
input: c,
|
|
109
|
+
validator: p,
|
|
110
|
+
label: d
|
|
104
111
|
}),
|
|
105
|
-
onChange: (
|
|
106
|
-
const
|
|
107
|
-
|
|
112
|
+
onChange: (c)=>{
|
|
113
|
+
const e = c.currentTarget.value, y = f(e);
|
|
114
|
+
V({
|
|
108
115
|
name: r,
|
|
109
|
-
value:
|
|
110
|
-
}),
|
|
116
|
+
value: e
|
|
117
|
+
}), T({
|
|
111
118
|
name: r,
|
|
112
|
-
value:
|
|
113
|
-
}),
|
|
119
|
+
value: y
|
|
120
|
+
}), R({
|
|
114
121
|
name: r,
|
|
115
122
|
error: ""
|
|
116
|
-
}),
|
|
123
|
+
}), w == null || w(c), t == null || t(y, e);
|
|
117
124
|
}
|
|
118
125
|
};
|
|
119
126
|
};
|
|
120
|
-
export {
|
|
127
|
+
export { D as FormContext, J as useControlProps, K as useFieldProps, M as useForm };
|