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