@telefonica/mistica 14.41.0 → 14.42.1
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/css/mistica.css +1 -1
- package/dist/boxed.css-mistica.js +14 -5
- package/dist/boxed.css.d.ts +1 -0
- package/dist/boxed.d.ts +1 -0
- package/dist/boxed.js +11 -9
- package/dist/button-fixed-footer-layout.d.ts +1 -0
- package/dist/button-fixed-footer-layout.js +19 -14
- package/dist/button-layout.css-mistica.js +16 -13
- package/dist/button-layout.css.d.ts +1 -0
- package/dist/button-layout.js +15 -15
- package/dist/button.js +43 -35
- package/dist/carousel.d.ts +13 -0
- package/dist/carousel.js +325 -223
- package/dist/credit-card-expiration-field.js +30 -26
- package/dist/credit-card-number-field.css-mistica.js +7 -7
- package/dist/credit-card-number-field.js +59 -45
- package/dist/cvv-field.js +46 -41
- package/dist/date-field.css-mistica.js +14 -0
- package/dist/date-field.css.d.ts +1 -0
- package/dist/date-field.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/date-field.js +41 -35
- package/dist/date-time-field.js +40 -34
- package/dist/date-time-picker.js +43 -45
- package/dist/decimal-field.js +26 -22
- package/dist/dialog-context.d.ts +24 -0
- package/dist/dialog-context.js +192 -0
- package/dist/dialog.css-mistica.js +15 -12
- package/dist/dialog.css.d.ts +1 -0
- package/dist/dialog.d.ts +14 -44
- package/dist/dialog.js +163 -246
- package/dist/double-field.css-mistica.js +3 -2
- package/dist/email-field.js +15 -11
- package/dist/feedback.css-mistica.js +23 -14
- package/dist/feedback.css.d.ts +7 -4
- package/dist/feedback.js +157 -143
- package/dist/fixed-footer-layout.css-mistica.js +1 -1
- package/dist/fixed-footer-layout.js +9 -8
- package/dist/iban-field.js +31 -27
- package/dist/icons/icon-amex.d.ts +1 -1
- package/dist/icons/icon-cvv-amex.d.ts +1 -1
- package/dist/icons/icon-cvv-visa-mc.d.ts +1 -1
- package/dist/icons/icon-mastercard.d.ts +1 -1
- package/dist/icons/icon-visa.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -4
- package/dist/inline.css-mistica.js +9 -6
- package/dist/inline.css.d.ts +1 -1
- package/dist/inline.js +9 -9
- package/dist/integer-field.js +17 -13
- package/dist/loading-bar.css-mistica.js +4 -7
- package/dist/loading-bar.css.d.ts +0 -2
- package/dist/loading-bar.js +3 -6
- package/dist/month-field.js +39 -33
- package/dist/package-version.js +1 -1
- package/dist/password-field.js +46 -44
- package/dist/phone-number-field.js +50 -46
- package/dist/pin-field.css-mistica.js +12 -6
- package/dist/pin-field.css.d.ts +2 -0
- package/dist/pin-field.d.ts +3 -1
- package/dist/pin-field.js +129 -95
- package/dist/responsive-layout.css-mistica.js +10 -7
- package/dist/responsive-layout.css.d.ts +2 -1
- package/dist/responsive-layout.d.ts +1 -1
- package/dist/responsive-layout.js +20 -17
- package/dist/search-field.js +36 -35
- package/dist/select.css-mistica.js +16 -15
- package/dist/select.css.d.ts +1 -0
- package/dist/select.js +138 -143
- package/dist/text-field-base.css-mistica.js +45 -21
- package/dist/text-field-base.css.d.ts +30 -7
- package/dist/text-field-base.d.ts +11 -0
- package/dist/text-field-base.js +175 -140
- package/dist/text-field-components.css-mistica.js +13 -21
- package/dist/text-field-components.css.d.ts +0 -3
- package/dist/text-field-components.d.ts +3 -0
- package/dist/text-field-components.js +38 -35
- package/dist/text-field.js +26 -22
- package/dist/text.css-mistica.js +7 -7
- package/dist/text.css.d.ts +0 -1
- package/dist/text.js +24 -24
- package/dist/theme-context-provider.js +2 -2
- package/dist/utils/platform.js +8 -11
- package/dist-es/boxed.css-mistica.js +3 -2
- package/dist-es/boxed.js +17 -15
- package/dist-es/button-fixed-footer-layout.js +29 -24
- package/dist-es/button-layout.css-mistica.js +7 -7
- package/dist-es/button-layout.js +23 -23
- package/dist-es/button.js +65 -57
- package/dist-es/carousel.js +373 -280
- package/dist-es/credit-card-expiration-field.js +34 -30
- package/dist-es/credit-card-number-field.css-mistica.js +4 -4
- package/dist-es/credit-card-number-field.js +84 -70
- package/dist-es/cvv-field.js +68 -63
- package/dist-es/date-field.css-mistica.js +5 -0
- package/dist-es/date-field.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/date-field.js +46 -40
- package/dist-es/date-time-field.js +47 -41
- package/dist-es/date-time-picker.js +55 -57
- package/dist-es/decimal-field.js +31 -27
- package/dist-es/dialog-context.js +125 -0
- package/dist-es/dialog.css-mistica.js +3 -3
- package/dist-es/dialog.js +193 -262
- package/dist-es/double-field.css-mistica.js +3 -2
- package/dist-es/email-field.js +16 -12
- package/dist-es/feedback.css-mistica.js +2 -2
- package/dist-es/feedback.js +196 -182
- package/dist-es/fixed-footer-layout.css-mistica.js +1 -1
- package/dist-es/fixed-footer-layout.js +21 -20
- package/dist-es/iban-field.js +42 -38
- package/dist-es/index.js +1778 -1778
- package/dist-es/inline.css-mistica.js +3 -3
- package/dist-es/inline.js +18 -18
- package/dist-es/integer-field.js +21 -17
- package/dist-es/loading-bar.css-mistica.js +2 -2
- package/dist-es/loading-bar.js +10 -13
- package/dist-es/month-field.js +47 -41
- package/dist-es/package-version.js +1 -1
- package/dist-es/password-field.js +54 -52
- package/dist-es/phone-number-field.js +53 -49
- package/dist-es/pin-field.css-mistica.js +2 -2
- package/dist-es/pin-field.js +145 -111
- package/dist-es/responsive-layout.css-mistica.js +3 -3
- package/dist-es/responsive-layout.js +27 -24
- package/dist-es/search-field.js +45 -44
- package/dist-es/select.css-mistica.js +8 -7
- package/dist-es/select.js +167 -172
- package/dist-es/style.css +1 -1
- package/dist-es/text-field-base.css-mistica.js +2 -2
- package/dist-es/text-field-base.js +189 -157
- package/dist-es/text-field-components.css-mistica.js +3 -2
- package/dist-es/text-field-components.js +52 -49
- package/dist-es/text-field.js +31 -27
- package/dist-es/text.css-mistica.js +3 -3
- package/dist-es/text.js +32 -32
- package/dist-es/theme-context-provider.js +1 -1
- package/dist-es/utils/platform.js +6 -6
- package/package.json +1 -1
- package/dist/password-field.css-mistica.js +0 -13
- package/dist/password-field.css.d.ts +0 -1
- package/dist-es/password-field.css-mistica.js +0 -4
- /package/dist/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
- /package/dist-es/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
package/dist-es/date-field.js
CHANGED
|
@@ -79,17 +79,19 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
81
|
import { jsx as t } from "react/jsx-runtime";
|
|
82
|
-
import * as
|
|
83
|
-
import { useFieldProps as
|
|
82
|
+
import * as c from "react";
|
|
83
|
+
import { useFieldProps as z } from "./form-context.js";
|
|
84
84
|
import { TextFieldBaseAutosuggest as O } from "./text-field-base.js";
|
|
85
85
|
import { isInputTypeSupported as b } from "./utils/dom.js";
|
|
86
|
-
import { isServerSide as
|
|
87
|
-
import
|
|
86
|
+
import { isServerSide as A } from "./utils/environment.js";
|
|
87
|
+
import N from "./generated/mistica-icons/icon-calendar-regular.js";
|
|
88
88
|
import { getLocalDateString as r } from "./utils/time.js";
|
|
89
89
|
import { useTheme as j } from "./hooks.js";
|
|
90
|
-
import { isFirefox as
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
import { isFirefox as v } from "./utils/platform.js";
|
|
91
|
+
import { iconContainer as B } from "./date-field.css-mistica.js";
|
|
92
|
+
import { iconSize as C } from "./text-field-base.css-mistica.js";
|
|
93
|
+
const E = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), L = (_param)=>{
|
|
94
|
+
var { disabled: D, error: F, helperText: g, name: S, optional: f, validate: s, onChange: R, onChangeValue: n, onBlur: k, value: y, defaultValue: I, min: i, max: o, dataAttributes: d } = _param, u = _object_without_properties(_param, [
|
|
93
95
|
"disabled",
|
|
94
96
|
"error",
|
|
95
97
|
"helperText",
|
|
@@ -102,43 +104,47 @@ const A = /*#__PURE__*/ a.lazy(()=>import(/* webpackChunkName: "date-time-picker
|
|
|
102
104
|
"value",
|
|
103
105
|
"defaultValue",
|
|
104
106
|
"min",
|
|
105
|
-
"max"
|
|
107
|
+
"max",
|
|
108
|
+
"dataAttributes"
|
|
106
109
|
]);
|
|
107
|
-
const
|
|
108
|
-
name:
|
|
109
|
-
value:
|
|
110
|
-
defaultValue:
|
|
111
|
-
processValue:
|
|
112
|
-
helperText:
|
|
113
|
-
optional:
|
|
114
|
-
error:
|
|
115
|
-
disabled:
|
|
116
|
-
onBlur:
|
|
117
|
-
validate: (e,
|
|
118
|
-
onChange:
|
|
119
|
-
onChangeValue: (e,
|
|
120
|
-
|
|
110
|
+
const T = (e)=>e, h = c.useMemo(()=>v() ? !1 : b("date"), []), { texts: x } = j(), a = (e)=>!(i && e && e < r(i) || o && e && e > r(o)), p = z({
|
|
111
|
+
name: S,
|
|
112
|
+
value: y,
|
|
113
|
+
defaultValue: I,
|
|
114
|
+
processValue: T,
|
|
115
|
+
helperText: g,
|
|
116
|
+
optional: f,
|
|
117
|
+
error: F,
|
|
118
|
+
disabled: D,
|
|
119
|
+
onBlur: k,
|
|
120
|
+
validate: (e, m)=>a(e) ? s == null ? void 0 : s(e, m) : x.formDateOutOfRangeError,
|
|
121
|
+
onChange: R,
|
|
122
|
+
onChangeValue: (e, m)=>{
|
|
123
|
+
a(e) && (n == null || n(e, m));
|
|
121
124
|
}
|
|
122
|
-
}),
|
|
123
|
-
min:
|
|
124
|
-
max:
|
|
125
|
+
}), l = /* @__PURE__ */ t(O, _object_spread_props(_object_spread({}, u, p), {
|
|
126
|
+
min: i ? r(i) : void 0,
|
|
127
|
+
max: o ? r(o) : void 0,
|
|
125
128
|
type: "date",
|
|
126
129
|
endIconOverlay: /* @__PURE__ */ t("div", {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
})
|
|
130
|
+
className: B,
|
|
131
|
+
children: /* @__PURE__ */ t(N, {
|
|
132
|
+
size: C
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
dataAttributes: _object_spread({
|
|
136
|
+
"component-name": "DateField"
|
|
137
|
+
}, d)
|
|
135
138
|
}));
|
|
136
|
-
return
|
|
137
|
-
fallback:
|
|
138
|
-
children: /* @__PURE__ */ t(
|
|
139
|
-
optional:
|
|
140
|
-
isValidDate: (e)=>
|
|
139
|
+
return h || A() ? l : /* @__PURE__ */ t(c.Suspense, {
|
|
140
|
+
fallback: l,
|
|
141
|
+
children: /* @__PURE__ */ t(E, _object_spread_props(_object_spread({}, u, p), {
|
|
142
|
+
optional: f,
|
|
143
|
+
isValidDate: (e)=>a(r(e.toDate())),
|
|
144
|
+
dataAttributes: _object_spread({
|
|
145
|
+
"component-name": "DateField"
|
|
146
|
+
}, d)
|
|
141
147
|
}))
|
|
142
148
|
});
|
|
143
|
-
},
|
|
144
|
-
export {
|
|
149
|
+
}, Y = L;
|
|
150
|
+
export { Y as default };
|
|
@@ -79,21 +79,23 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
81
|
import { jsx as r } from "react/jsx-runtime";
|
|
82
|
-
import * as
|
|
83
|
-
import { useFieldProps as
|
|
84
|
-
import { TextFieldBaseAutosuggest as
|
|
82
|
+
import * as c from "react";
|
|
83
|
+
import { useFieldProps as x } from "./form-context.js";
|
|
84
|
+
import { TextFieldBaseAutosuggest as z } from "./text-field-base.js";
|
|
85
85
|
import { isInputTypeSupported as O } from "./utils/dom.js";
|
|
86
86
|
import { isServerSide as b } from "./utils/environment.js";
|
|
87
|
-
import { getLocalDateTimeString as
|
|
87
|
+
import { getLocalDateTimeString as i } from "./utils/time.js";
|
|
88
88
|
import w from "./generated/mistica-icons/icon-calendar-regular.js";
|
|
89
|
-
import { isFirefox as
|
|
90
|
-
import { useTheme as
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
import { isFirefox as A } from "./utils/platform.js";
|
|
90
|
+
import { useTheme as N } from "./hooks.js";
|
|
91
|
+
import { iconSize as V } from "./text-field-base.css-mistica.js";
|
|
92
|
+
import { iconContainer as j } from "./date-field.css-mistica.js";
|
|
93
|
+
const B = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), C = (_param)=>{
|
|
94
|
+
var { disabled: F, error: g, helperText: S, name: R, optional: f, validate: n, onChange: h, onChangeValue: m, onBlur: k, value: y, defaultValue: I, min: o, /**
|
|
93
95
|
* When typing a datetime value into the input field (inside a test for example), some browsers like Chrome
|
|
94
96
|
* force the year to have exactly 6 digits. In order to prevent this, in case max value was not provided we
|
|
95
97
|
* set it so that it only accepts datetime values with years having up to 4 digits.
|
|
96
|
-
*/ max: s = /* @__PURE__ */ new Date("9999-12-31T23:59") } = _param,
|
|
98
|
+
*/ max: s = /* @__PURE__ */ new Date("9999-12-31T23:59"), dataAttributes: l } = _param, u = _object_without_properties(_param, [
|
|
97
99
|
"disabled",
|
|
98
100
|
"error",
|
|
99
101
|
"helperText",
|
|
@@ -106,47 +108,51 @@ const j = /*#__PURE__*/ m.lazy(()=>import(/* webpackChunkName: "date-time-picker
|
|
|
106
108
|
"value",
|
|
107
109
|
"defaultValue",
|
|
108
110
|
"min",
|
|
109
|
-
"max"
|
|
111
|
+
"max",
|
|
112
|
+
"dataAttributes"
|
|
110
113
|
]);
|
|
111
|
-
const
|
|
112
|
-
const t =
|
|
113
|
-
return !(
|
|
114
|
-
},
|
|
115
|
-
name:
|
|
116
|
-
value:
|
|
117
|
-
defaultValue:
|
|
118
|
-
processValue:
|
|
119
|
-
helperText:
|
|
114
|
+
const d = c.useMemo(()=>A() ? !1 : O("datetime-local"), []), p = (e)=>d ? e : e.replace(/\s/, "T"), { texts: v } = N(), a = (e)=>{
|
|
115
|
+
const t = p(e);
|
|
116
|
+
return !(o && t && t < i(o) || s && t && t > i(s));
|
|
117
|
+
}, D = x({
|
|
118
|
+
name: R,
|
|
119
|
+
value: y,
|
|
120
|
+
defaultValue: I,
|
|
121
|
+
processValue: p,
|
|
122
|
+
helperText: S,
|
|
120
123
|
optional: f,
|
|
121
124
|
error: g,
|
|
122
|
-
disabled:
|
|
123
|
-
onBlur:
|
|
124
|
-
validate: (e, t)=>
|
|
125
|
-
onChange:
|
|
125
|
+
disabled: F,
|
|
126
|
+
onBlur: k,
|
|
127
|
+
validate: (e, t)=>a(e) ? n == null ? void 0 : n(e, t) : v.formDateOutOfRangeError,
|
|
128
|
+
onChange: h,
|
|
126
129
|
onChangeValue: (e, t)=>{
|
|
127
|
-
|
|
130
|
+
a(e) && (m == null || m(e, t));
|
|
128
131
|
}
|
|
129
|
-
}),
|
|
130
|
-
min:
|
|
131
|
-
max: s ?
|
|
132
|
+
}), T = /* @__PURE__ */ r(z, _object_spread_props(_object_spread({}, u, D), {
|
|
133
|
+
min: o ? i(o) : void 0,
|
|
134
|
+
max: s ? i(s) : void 0,
|
|
132
135
|
type: "datetime-local",
|
|
133
136
|
endIconOverlay: /* @__PURE__ */ r("div", {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
})
|
|
137
|
+
className: j,
|
|
138
|
+
children: /* @__PURE__ */ r(w, {
|
|
139
|
+
size: V
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
dataAttributes: _object_spread({
|
|
143
|
+
"component-name": "DateTimeField"
|
|
144
|
+
}, l)
|
|
142
145
|
}));
|
|
143
|
-
return
|
|
144
|
-
fallback:
|
|
145
|
-
children: /* @__PURE__ */ r(
|
|
146
|
+
return d || b() ? T : /* @__PURE__ */ r(c.Suspense, {
|
|
147
|
+
fallback: T,
|
|
148
|
+
children: /* @__PURE__ */ r(B, _object_spread_props(_object_spread({}, u, D), {
|
|
146
149
|
optional: f,
|
|
147
150
|
withTime: !0,
|
|
148
|
-
isValidDate: (e)=>
|
|
151
|
+
isValidDate: (e)=>a(i(e.toDate())),
|
|
152
|
+
dataAttributes: _object_spread({
|
|
153
|
+
"component-name": "DateTimeField"
|
|
154
|
+
}, l)
|
|
149
155
|
}))
|
|
150
156
|
});
|
|
151
|
-
},
|
|
152
|
-
export {
|
|
157
|
+
}, Y = C;
|
|
158
|
+
export { Y as default };
|
|
@@ -78,24 +78,24 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
}
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
|
-
import { jsxs as
|
|
81
|
+
import { jsxs as R, Fragment as H, jsx as n } from "react/jsx-runtime";
|
|
82
82
|
import * as d from "react";
|
|
83
|
-
import { TextFieldBaseAutosuggest as
|
|
84
|
-
import
|
|
85
|
-
import
|
|
86
|
-
import
|
|
83
|
+
import { TextFieldBaseAutosuggest as I, FieldEndIcon as g } from "./text-field-base.js";
|
|
84
|
+
import F from "./generated/mistica-icons/icon-calendar-regular.js";
|
|
85
|
+
import S from "react-datetime";
|
|
86
|
+
import E from "./overlay.js";
|
|
87
87
|
import { DEFAULT_WIDTH as L } from "./text-field-components.css-mistica.js";
|
|
88
|
-
import g from "./icon-button.js";
|
|
89
88
|
import { cancelEvent as T, createChangeEvent as B } from "./utils/dom.js";
|
|
90
|
-
import { useTheme as
|
|
91
|
-
import
|
|
89
|
+
import { useTheme as V, useElementDimensions as Y } from "./hooks.js";
|
|
90
|
+
import N from "./generated/mistica-icons/icon-close-regular.js";
|
|
92
91
|
import { reactDatePicker as j } from "./date-time-picker.css-mistica.js";
|
|
93
|
-
import { vars as
|
|
92
|
+
import { vars as A } from "./skins/skin-contract.css-mistica.js";
|
|
94
93
|
import "moment/locale/es";
|
|
95
94
|
import "moment/locale/de";
|
|
96
95
|
import "moment/locale/pt-br";
|
|
97
96
|
import "moment/locale/en-gb";
|
|
98
|
-
|
|
97
|
+
import { endIcon as h } from "./text-field-base.css-mistica.js";
|
|
98
|
+
const O = {
|
|
99
99
|
es: "es",
|
|
100
100
|
// spanish
|
|
101
101
|
ca: "es",
|
|
@@ -109,95 +109,93 @@ const A = {
|
|
|
109
109
|
pt: "pt-br",
|
|
110
110
|
// portuguese
|
|
111
111
|
en: "en-gb"
|
|
112
|
-
},
|
|
112
|
+
}, q = (a)=>{
|
|
113
113
|
const i = a.toLocaleLowerCase().split("-")[0];
|
|
114
|
-
return
|
|
115
|
-
},
|
|
116
|
-
var { withTime: a, mode: i, isValidDate:
|
|
114
|
+
return O[i] || "en-gb";
|
|
115
|
+
}, ae = (_param)=>{
|
|
116
|
+
var { withTime: a, mode: i, isValidDate: y, optional: m } = _param, o = _object_without_properties(_param, [
|
|
117
117
|
"withTime",
|
|
118
118
|
"mode",
|
|
119
119
|
"isValidDate",
|
|
120
120
|
"optional"
|
|
121
121
|
]);
|
|
122
|
-
const [
|
|
123
|
-
|
|
124
|
-
},
|
|
122
|
+
const [u, x] = d.useState(!1), { texts: b, i18n: { locale: k } } = V(), r = d.useRef(null), { height: v, ref: C } = Y(), c = (e)=>{
|
|
123
|
+
o.disabled || x(e);
|
|
124
|
+
}, D = ()=>{
|
|
125
125
|
var f;
|
|
126
|
-
const { top: e = 0, bottom:
|
|
126
|
+
const { top: e = 0, bottom: t = 0, left: l = 0 } = ((f = r.current) == null ? void 0 : f.getBoundingClientRect()) || {}, P = 260 + t < window.innerHeight;
|
|
127
127
|
return {
|
|
128
128
|
width: L,
|
|
129
|
-
top:
|
|
130
|
-
left:
|
|
129
|
+
top: P ? t : e - v,
|
|
130
|
+
left: l,
|
|
131
131
|
position: "absolute",
|
|
132
|
-
borderRadius:
|
|
132
|
+
borderRadius: A.borderRadii.input,
|
|
133
133
|
overflow: "hidden",
|
|
134
134
|
boxShadow: "0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12)"
|
|
135
135
|
};
|
|
136
136
|
}, s = ()=>{
|
|
137
|
-
var
|
|
138
|
-
const e = (
|
|
137
|
+
var t;
|
|
138
|
+
const e = (t = r.current) == null ? void 0 : t.value;
|
|
139
139
|
return e ? new Date(e) : void 0;
|
|
140
|
-
},
|
|
141
|
-
var
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}) : /* @__PURE__ */ r(g, {
|
|
152
|
-
disabled: t.disabled,
|
|
140
|
+
}, w = (e)=>a ? e.format("yyyy-MM-DD HH:mm") : i === "year-month" ? e.format("yyyy-MM") : e.format("yyyy-MM-DD"), p = (e)=>{
|
|
141
|
+
var l;
|
|
142
|
+
const t = typeof e == "string" ? e : w(e);
|
|
143
|
+
r.current && (r.current.focus(), (l = o.onChange) == null || l.call(o, B(r.current, t)));
|
|
144
|
+
}, M = ()=>s() && m ? /* @__PURE__ */ n(g, {
|
|
145
|
+
Icon: N,
|
|
146
|
+
"aria-label": b.clearButton,
|
|
147
|
+
className: h,
|
|
148
|
+
onPress: ()=>p("")
|
|
149
|
+
}) : /* @__PURE__ */ n(g, {
|
|
150
|
+
Icon: F,
|
|
153
151
|
"aria-label": "",
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
disabled: o.disabled,
|
|
153
|
+
className: h,
|
|
154
|
+
onPress: ()=>c(!u)
|
|
157
155
|
});
|
|
158
|
-
return /* @__PURE__ */
|
|
156
|
+
return /* @__PURE__ */ R(H, {
|
|
159
157
|
children: [
|
|
160
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ n(I, _object_spread_props(_object_spread({}, o), {
|
|
161
159
|
style: {
|
|
162
|
-
cursor: "
|
|
160
|
+
cursor: "pointer"
|
|
163
161
|
},
|
|
164
|
-
required: !
|
|
162
|
+
required: !m,
|
|
165
163
|
type: "text",
|
|
166
164
|
autoComplete: "off",
|
|
167
165
|
shrinkLabel: !!s(),
|
|
168
|
-
endIcon:
|
|
166
|
+
endIcon: M(),
|
|
169
167
|
inputRef: (e)=>{
|
|
170
|
-
var
|
|
171
|
-
(
|
|
168
|
+
var t;
|
|
169
|
+
(t = o == null ? void 0 : o.inputRef) == null || t.call(o, e), r.current = e;
|
|
172
170
|
},
|
|
173
171
|
readOnly: !0,
|
|
174
|
-
onKeyDown: ()=>
|
|
172
|
+
onKeyDown: ()=>c(!0),
|
|
175
173
|
onClick: ()=>{
|
|
176
|
-
|
|
174
|
+
c(!0);
|
|
177
175
|
}
|
|
178
176
|
})),
|
|
179
|
-
|
|
177
|
+
u && /* @__PURE__ */ n(E, {
|
|
180
178
|
onPress: (e)=>{
|
|
181
|
-
T(e),
|
|
179
|
+
T(e), c(!1);
|
|
182
180
|
},
|
|
183
181
|
disableScroll: !0,
|
|
184
|
-
children: /* @__PURE__ */
|
|
185
|
-
ref:
|
|
186
|
-
style:
|
|
182
|
+
children: /* @__PURE__ */ n("div", {
|
|
183
|
+
ref: C,
|
|
184
|
+
style: D(),
|
|
187
185
|
className: j,
|
|
188
|
-
children: /* @__PURE__ */
|
|
186
|
+
children: /* @__PURE__ */ n(S, {
|
|
189
187
|
initialViewMode: i === "year-month" ? "months" : void 0,
|
|
190
188
|
dateFormat: i === "year-month" ? "YYYY-MM" : void 0,
|
|
191
189
|
timeFormat: a ? "HH:mm" : !1,
|
|
192
190
|
initialValue: s(),
|
|
193
|
-
locale:
|
|
191
|
+
locale: q(k),
|
|
194
192
|
input: !1,
|
|
195
193
|
onChange: p,
|
|
196
|
-
isValidDate:
|
|
194
|
+
isValidDate: y
|
|
197
195
|
})
|
|
198
196
|
})
|
|
199
197
|
})
|
|
200
198
|
]
|
|
201
199
|
});
|
|
202
200
|
};
|
|
203
|
-
export {
|
|
201
|
+
export { ae as default };
|
package/dist-es/decimal-field.js
CHANGED
|
@@ -79,51 +79,51 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
81
|
import { jsx as x } from "react/jsx-runtime";
|
|
82
|
-
import * as
|
|
83
|
-
import { useFieldProps as
|
|
82
|
+
import * as S from "react";
|
|
83
|
+
import { useFieldProps as V } from "./form-context.js";
|
|
84
84
|
import { useTheme as C } from "./hooks.js";
|
|
85
|
-
import { TextFieldBaseAutosuggest as
|
|
86
|
-
import { createChangeEvent as
|
|
85
|
+
import { TextFieldBaseAutosuggest as R } from "./text-field-base.js";
|
|
86
|
+
import { createChangeEvent as b } from "./utils/dom.js";
|
|
87
87
|
import { useRifm as I } from "rifm";
|
|
88
|
-
import { combineRefs as
|
|
89
|
-
const
|
|
88
|
+
import { combineRefs as j } from "./utils/common.js";
|
|
89
|
+
const A = (o)=>{
|
|
90
90
|
try {
|
|
91
|
-
return 1.1.toLocaleString(
|
|
91
|
+
return 1.1.toLocaleString(o.replace("_", "-"))[1];
|
|
92
92
|
} catch (e) {
|
|
93
93
|
return ".";
|
|
94
94
|
}
|
|
95
|
-
}, B = (
|
|
96
|
-
const s = String(
|
|
95
|
+
}, B = (o, r)=>{
|
|
96
|
+
const s = String(o !== null && o !== void 0 ? o : "").replace(/[^.,\d]/g, ""), e = /[.,]/.exec(s), t = s.split(/[.,]/);
|
|
97
97
|
return t.length === 0 ? "" : e && r > 0 ? t.shift() + e[0] + t.join("").slice(0, r) : t[0];
|
|
98
98
|
}, E = (_param)=>{
|
|
99
|
-
var { inputRef:
|
|
99
|
+
var { inputRef: o, value: r, defaultValue: s, onChange: e, maxDecimals: t } = _param, c = _object_without_properties(_param, [
|
|
100
100
|
"inputRef",
|
|
101
101
|
"value",
|
|
102
102
|
"defaultValue",
|
|
103
103
|
"onChange",
|
|
104
104
|
"maxDecimals"
|
|
105
105
|
]);
|
|
106
|
-
const { i18n: u } = C(), f =
|
|
107
|
-
l || d(
|
|
106
|
+
const { i18n: u } = C(), f = A(u.locale), m = (n)=>String(n !== null && n !== void 0 ? n : "").replace(/[.,]/g, f), [p, d] = S.useState(s !== null && s !== void 0 ? s : ""), i = S.useRef(null), l = typeof r < "u", g = l ? r : p, h = S.useCallback((n)=>{
|
|
107
|
+
l || d(n), i.current && (e == null || e(b(i.current, n)));
|
|
108
108
|
}, [
|
|
109
109
|
l,
|
|
110
110
|
e
|
|
111
|
-
]),
|
|
112
|
-
format: (
|
|
111
|
+
]), y = I({
|
|
112
|
+
format: (n)=>B(n, t),
|
|
113
113
|
replace: m,
|
|
114
114
|
value: g,
|
|
115
|
-
onChange:
|
|
115
|
+
onChange: h,
|
|
116
116
|
accept: /[\d.,]+/g
|
|
117
117
|
});
|
|
118
118
|
return /* @__PURE__ */ x("input", _object_spread_props(_object_spread({}, c), {
|
|
119
119
|
type: "text",
|
|
120
120
|
inputMode: "decimal",
|
|
121
|
-
value:
|
|
122
|
-
onChange:
|
|
123
|
-
ref:
|
|
121
|
+
value: y.value,
|
|
122
|
+
onChange: y.onChange,
|
|
123
|
+
ref: j(o, i)
|
|
124
124
|
}));
|
|
125
125
|
}, L = (_param)=>{
|
|
126
|
-
var { disabled:
|
|
126
|
+
var { disabled: o, error: r, helperText: s, name: e, optional: t, validate: c, onChange: u, onChangeValue: f, onBlur: m, value: p, defaultValue: d, maxDecimals: i = 1 / 0, dataAttributes: l } = _param, g = _object_without_properties(_param, [
|
|
127
127
|
"disabled",
|
|
128
128
|
"error",
|
|
129
129
|
"helperText",
|
|
@@ -135,9 +135,10 @@ const j = (n)=>{
|
|
|
135
135
|
"onBlur",
|
|
136
136
|
"value",
|
|
137
137
|
"defaultValue",
|
|
138
|
-
"maxDecimals"
|
|
138
|
+
"maxDecimals",
|
|
139
|
+
"dataAttributes"
|
|
139
140
|
]);
|
|
140
|
-
const { texts:
|
|
141
|
+
const { texts: h } = C(), D = V({
|
|
141
142
|
name: e,
|
|
142
143
|
value: p,
|
|
143
144
|
defaultValue: d,
|
|
@@ -145,17 +146,20 @@ const j = (n)=>{
|
|
|
145
146
|
helperText: s,
|
|
146
147
|
optional: t,
|
|
147
148
|
error: r,
|
|
148
|
-
disabled:
|
|
149
|
+
disabled: o,
|
|
149
150
|
onBlur: m,
|
|
150
|
-
validate: (a,
|
|
151
|
+
validate: (a, F)=>a ? c == null ? void 0 : c(a, F) : t ? "" : h.formFieldErrorIsMandatory,
|
|
151
152
|
onChange: u,
|
|
152
153
|
onChangeValue: f
|
|
153
154
|
});
|
|
154
|
-
return /* @__PURE__ */ x(
|
|
155
|
+
return /* @__PURE__ */ x(R, _object_spread_props(_object_spread({}, g, D), {
|
|
155
156
|
inputComponent: E,
|
|
156
157
|
inputProps: {
|
|
157
158
|
maxDecimals: i
|
|
158
|
-
}
|
|
159
|
+
},
|
|
160
|
+
dataAttributes: _object_spread({
|
|
161
|
+
"component-name": "DecimalField"
|
|
162
|
+
}, l)
|
|
159
163
|
}));
|
|
160
|
-
},
|
|
161
|
-
export { E as DecimalInput,
|
|
164
|
+
}, q = L;
|
|
165
|
+
export { E as DecimalInput, q as default };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _object_spread(target) {
|
|
16
|
+
for(var i = 1; i < arguments.length; i++){
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
+
var ownKeys = Object.keys(source);
|
|
19
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
ownKeys.forEach(function(key) {
|
|
25
|
+
_define_property(target, key, source[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
function ownKeys(object, enumerableOnly) {
|
|
31
|
+
var keys = Object.keys(object);
|
|
32
|
+
if (Object.getOwnPropertySymbols) {
|
|
33
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
+
if (enumerableOnly) {
|
|
35
|
+
symbols = symbols.filter(function(sym) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
keys.push.apply(keys, symbols);
|
|
40
|
+
}
|
|
41
|
+
return keys;
|
|
42
|
+
}
|
|
43
|
+
function _object_spread_props(target, source) {
|
|
44
|
+
source = source != null ? source : {};
|
|
45
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
46
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
47
|
+
} else {
|
|
48
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
49
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return target;
|
|
53
|
+
}
|
|
54
|
+
import { jsx as r, Fragment as u, jsxs as d } from "react/jsx-runtime";
|
|
55
|
+
import * as e from "react";
|
|
56
|
+
const c = /*#__PURE__*/ e.createContext({
|
|
57
|
+
mounted: !1,
|
|
58
|
+
dialog: null,
|
|
59
|
+
setDialog: ()=>{}
|
|
60
|
+
}), m = /*#__PURE__*/ e.lazy(()=>import(/* webpackChunkName: "dialog" */ "./dialog.js")), a = ()=>{
|
|
61
|
+
throw Error("Tried to show a dialog but the DialogRoot component was not mounted (missing ThemeContextProvider?)");
|
|
62
|
+
}, f = ()=>{
|
|
63
|
+
const { dialog: o, setDialog: s, mounted: i } = e.useContext(c), n = e.useCallback((t)=>{
|
|
64
|
+
if (i || a(), t && o) throw Error("Tried to show a dialog on top of another dialog");
|
|
65
|
+
s(t);
|
|
66
|
+
}, [
|
|
67
|
+
s,
|
|
68
|
+
o,
|
|
69
|
+
i
|
|
70
|
+
]);
|
|
71
|
+
return e.useMemo(()=>({
|
|
72
|
+
alert: (t)=>n(_object_spread({
|
|
73
|
+
type: "alert"
|
|
74
|
+
}, t)),
|
|
75
|
+
confirm: (t)=>n(_object_spread({
|
|
76
|
+
type: "confirm"
|
|
77
|
+
}, t)),
|
|
78
|
+
dialog: (t)=>n(_object_spread({
|
|
79
|
+
type: "dialog"
|
|
80
|
+
}, t))
|
|
81
|
+
}), [
|
|
82
|
+
n
|
|
83
|
+
]);
|
|
84
|
+
}, g = {
|
|
85
|
+
alert: a,
|
|
86
|
+
confirm: a,
|
|
87
|
+
dialog: a
|
|
88
|
+
};
|
|
89
|
+
let l = g;
|
|
90
|
+
const D = ()=>{
|
|
91
|
+
const o = f();
|
|
92
|
+
return e.useEffect(()=>(l = o, ()=>{
|
|
93
|
+
l = g;
|
|
94
|
+
}), [
|
|
95
|
+
o
|
|
96
|
+
]), /* @__PURE__ */ r(u, {});
|
|
97
|
+
}, p = (o)=>l.alert(o), x = (o)=>l.confirm(o), w = (o)=>l.dialog(o), C = (param)=>{
|
|
98
|
+
let { children: o } = param;
|
|
99
|
+
const { mounted: s } = e.useContext(c), [i, n] = e.useState(null), t = e.useMemo(()=>({
|
|
100
|
+
mounted: !0,
|
|
101
|
+
dialog: i,
|
|
102
|
+
setDialog: n
|
|
103
|
+
}), [
|
|
104
|
+
i,
|
|
105
|
+
n
|
|
106
|
+
]);
|
|
107
|
+
return s ? /* @__PURE__ */ r(u, {
|
|
108
|
+
children: o
|
|
109
|
+
}) : /* @__PURE__ */ d(c.Provider, {
|
|
110
|
+
value: t,
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ r(D, {}),
|
|
113
|
+
o,
|
|
114
|
+
i && /* @__PURE__ */ r(e.Suspense, {
|
|
115
|
+
fallback: null,
|
|
116
|
+
children: /* @__PURE__ */ r(m, _object_spread_props(_object_spread({}, i), {
|
|
117
|
+
onDestroy: ()=>{
|
|
118
|
+
n(null);
|
|
119
|
+
}
|
|
120
|
+
}))
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
export { C as DialogRoot, p as alert, x as confirm, w as dialog, f as useDialog };
|