@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
@@ -78,49 +78,50 @@ function _object_without_properties_loose(source, excluded) {
78
78
  }
79
79
  return target;
80
80
  }
81
- import { jsx as I } from "react/jsx-runtime";
82
- import * as R from "react";
81
+ import { jsx as w } from "react/jsx-runtime";
82
+ import * as V from "react";
83
83
  import { useForm as b, useFieldProps as j } from "./form-context.js";
84
- import { useTheme as M } from "./hooks.js";
84
+ import { useTheme as T } from "./hooks.js";
85
85
  import { TextFieldBaseAutosuggest as A } from "./text-field-base.js";
86
- import { expirationDatePlaceholder as B, formFieldErrorIsMandatory as K, formCreditCardExpirationError as y } from "./text-tokens.js";
87
- const N = (_param)=>{
88
- var { inputRef: h, defaultValue: u, value: l } = _param, i = _object_without_properties(_param, [
86
+ import { expirationDatePlaceholder as B, formCreditCardExpirationError as y } from "./text-tokens.js";
87
+ const K = (_param)=>{
88
+ var { inputRef: d, defaultValue: s, value: l } = _param, c = _object_without_properties(_param, [
89
89
  "inputRef",
90
90
  "defaultValue",
91
91
  "value"
92
92
  ]);
93
- const { texts: p, t: c } = M(), d = R.useRef(""), s = (r)=>{
94
- if (r.length === 2 && d.current === "Backspace") return r[0];
93
+ const { texts: f, t: g } = T(), i = V.useRef(""), u = (r)=>{
94
+ if (r.length === 2 && i.current === "Backspace") return r[0];
95
95
  let e = "";
96
96
  return [
97
97
  ...r
98
- ].forEach((E)=>{
99
- e = (e + E).replace(/[^0-9]/g, "").replace(/^([2-9])$/g, "0$1").replace(/^(1{1})([3-9]{1})$/g, "0$1/$2").replace(/^0{1,}/g, "0").replace(/^([0-1]{1}[0-9]{1})([0-9]{1,2}).*/g, "$1/$2");
98
+ ].forEach((h)=>{
99
+ e = (e + h).replace(/[^0-9]/g, "").replace(/^([2-9])$/g, "0$1").replace(/^(1{1})([3-9]{1})$/g, "0$1/$2").replace(/^0{1,}/g, "0").replace(/^([0-1]{1}[0-9]{1})([0-9]{1,2}).*/g, "$1/$2");
100
100
  }), e.length === 2 ? e + "/" : e;
101
- }, C = (r)=>{
102
- d.current = r.key;
101
+ }, x = (r)=>{
102
+ i.current = r.key;
103
103
  };
104
- return /* @__PURE__ */ I("input", _object_spread_props(_object_spread({}, i), {
105
- placeholder: p.expirationDatePlaceholder || c(B),
104
+ return /* @__PURE__ */ w("input", _object_spread_props(_object_spread({}, c), {
105
+ placeholder: f.expirationDatePlaceholder || g(B),
106
106
  type: "text",
107
107
  inputMode: "decimal",
108
108
  maxLength: "5",
109
- onKeyDown: C,
109
+ onKeyDown: x,
110
110
  onInput: (r)=>{
111
- const e = s(r.currentTarget.value);
111
+ const e = u(r.currentTarget.value);
112
112
  r.currentTarget.value = e;
113
113
  },
114
- value: l === void 0 ? void 0 : s(l),
115
- defaultValue: u === void 0 ? void 0 : s(u),
116
- ref: h
114
+ value: l === void 0 ? void 0 : u(l),
115
+ defaultValue: s === void 0 ? void 0 : u(s),
116
+ ref: d
117
117
  }));
118
- }, V = (_param)=>{
119
- var { disabled: h, error: u, helperText: l, name: i, optional: p, validate: c, onChange: d, onChangeValue: s, onBlur: C, value: r, autoComplete: e = "cc-exp", defaultValue: E, dataAttributes: T } = _param, w = _object_without_properties(_param, [
118
+ }, N = (_param)=>{
119
+ var { disabled: d, error: s, helperText: l, name: c, label: f, optional: g, validate: i, onChange: u, onChangeValue: x, onBlur: r, value: e, autoComplete: h = "cc-exp", defaultValue: I, dataAttributes: M } = _param, Y = _object_without_properties(_param, [
120
120
  "disabled",
121
121
  "error",
122
122
  "helperText",
123
123
  "name",
124
+ "label",
124
125
  "optional",
125
126
  "validate",
126
127
  "onChange",
@@ -131,50 +132,50 @@ const N = (_param)=>{
131
132
  "defaultValue",
132
133
  "dataAttributes"
133
134
  ]);
134
- const { texts: m, t: f } = M(), { setFormError: Y, jumpToNext: k } = b(), g = (t, o)=>{
135
- if (!o) return p ? "" : m.formFieldErrorIsMandatory || f(K);
136
- const { month: a, year: n } = t;
137
- if (!a || !n) return m.formCreditCardExpirationError || f(y);
138
- const x = /* @__PURE__ */ new Date(), v = x.getMonth() + 1, $ = x.getFullYear();
139
- return n < $ ? m.formCreditCardExpirationError || f(y) : n === $ && a < v ? m.formCreditCardExpirationError || f(y) : c == null ? void 0 : c(t, o);
140
- }, F = (t)=>{
141
- const [o, a] = String(t).split("/").map((x)=>parseInt(x)), n = Number.isInteger(a) ? 2e3 + a : null;
135
+ const { texts: C, t: E } = T(), { setFormError: k, jumpToNext: v } = b(), p = (t, n)=>{
136
+ const { month: a, year: o } = t;
137
+ if (!a || !o) return C.formCreditCardExpirationError || E(y);
138
+ const m = /* @__PURE__ */ new Date(), R = m.getMonth() + 1, $ = m.getFullYear();
139
+ return o < $ ? C.formCreditCardExpirationError || E(y) : o === $ && a < R ? C.formCreditCardExpirationError || E(y) : i == null ? void 0 : i(t, n);
140
+ }, D = (t)=>{
141
+ const [n, a] = String(t).split("/").map((m)=>parseInt(m)), o = Number.isInteger(a) ? 2e3 + a : null;
142
142
  return {
143
- month: o || null,
144
- year: n,
143
+ month: n || null,
144
+ year: o,
145
145
  raw: t
146
146
  };
147
- }, D = j({
148
- name: i,
149
- value: r,
150
- defaultValue: E,
151
- processValue: F,
147
+ }, F = j({
148
+ name: c,
149
+ label: f,
150
+ value: e,
151
+ defaultValue: I,
152
+ processValue: D,
152
153
  helperText: l,
153
- optional: p,
154
- error: u,
155
- disabled: h,
156
- onBlur: C,
157
- validate: g,
158
- onChange: d,
159
- onChangeValue: s
154
+ optional: g,
155
+ error: s,
156
+ disabled: d,
157
+ onBlur: r,
158
+ validate: p,
159
+ onChange: u,
160
+ onChangeValue: x
160
161
  });
161
- return /* @__PURE__ */ I(A, _object_spread_props(_object_spread({}, w, D), {
162
+ return /* @__PURE__ */ w(A, _object_spread_props(_object_spread({}, Y, F), {
162
163
  onChange: (t)=>{
163
- D.onChange(t);
164
- const o = t.currentTarget.value, a = F(o);
165
- if (o.length === 5) {
166
- const n = g == null ? void 0 : g(a, o);
167
- n ? Y({
168
- name: i,
169
- error: n
170
- }) : k(i);
164
+ F.onChange(t);
165
+ const n = t.currentTarget.value, a = D(n);
166
+ if (n.length === 5) {
167
+ const o = p == null ? void 0 : p(a, n);
168
+ o ? k({
169
+ name: c,
170
+ error: o
171
+ }) : v(c);
171
172
  }
172
173
  },
173
- autoComplete: e,
174
- inputComponent: N,
174
+ autoComplete: h,
175
+ inputComponent: K,
175
176
  dataAttributes: _object_spread({
176
177
  "component-name": "CreditCardExpirationField"
177
- }, T)
178
+ }, M)
178
179
  }));
179
- }, H = V;
180
+ }, H = N;
180
181
  export { H as default };
@@ -78,76 +78,76 @@ function _object_without_properties_loose(source, excluded) {
78
78
  }
79
79
  return target;
80
80
  }
81
- import { jsx as o, jsxs as j } from "react/jsx-runtime";
81
+ import { jsx as o, jsxs as D } from "react/jsx-runtime";
82
82
  import * as l from "react";
83
- import { useForm as D, useFieldProps as L } from "./form-context.js";
84
- import { useTheme as O } from "./hooks.js";
85
- import { getCreditCardNumberLength as I, isAmericanExpress as b, isVisa as A, isMasterCard as E, isValidCreditCardNumber as U } from "./utils/credit-card.js";
86
- import { TextFieldBaseAutosuggest as _ } from "./text-field-base.js";
87
- import w from "./generated/mistica-icons/icon-credit-card-visa-regular.js";
88
- import P from "./icons/icon-visa.js";
89
- import $ from "./icons/icon-mastercard.js";
90
- import q from "./icons/icon-amex.js";
91
- import { useRifm as G } from "rifm";
92
- import { createChangeEvent as H } from "./utils/dom.js";
93
- import { combineRefs as J } from "./utils/common.js";
94
- import { flip as K, variants as Q, flipFront as W, flipBack as X } from "./credit-card-number-field.css-mistica.js";
95
- import { vars as Y } from "./skins/skin-contract.css-mistica.js";
83
+ import { useForm as L, useFieldProps as O } from "./form-context.js";
84
+ import { useTheme as U } from "./hooks.js";
85
+ import { getCreditCardNumberLength as b, isAmericanExpress as A, isVisa as x, isMasterCard as I, isValidCreditCardNumber as _ } from "./utils/credit-card.js";
86
+ import { TextFieldBaseAutosuggest as P } from "./text-field-base.js";
87
+ import V from "./generated/mistica-icons/icon-credit-card-visa-regular.js";
88
+ import $ from "./icons/icon-visa.js";
89
+ import q from "./icons/icon-mastercard.js";
90
+ import G from "./icons/icon-amex.js";
91
+ import { useRifm as H } from "rifm";
92
+ import { createChangeEvent as J } from "./utils/dom.js";
93
+ import { combineRefs as K } from "./utils/common.js";
94
+ import { flip as Q, variants as W, flipFront as X, flipBack as Y } from "./credit-card-number-field.css-mistica.js";
95
+ import { vars as Z } from "./skins/skin-contract.css-mistica.js";
96
96
  import { iconSize as p } from "./icon-button.css-mistica.js";
97
- import { formCreditCardNumberError as Z, formFieldErrorIsMandatory as v } from "./text-tokens.js";
97
+ import { formCreditCardNumberError as v } from "./text-tokens.js";
98
98
  const rr = (r)=>{
99
- var t;
99
+ var i;
100
100
  const n = String(r !== null && r !== void 0 ? r : "").replace(/[^\d]/g, "");
101
101
  var _ref;
102
- return (_ref = (t = n.match(/.{1,4}/g)) == null ? void 0 : t.join(" ")) !== null && _ref !== void 0 ? _ref : n;
102
+ return (_ref = (i = n.match(/.{1,4}/g)) == null ? void 0 : i.join(" ")) !== null && _ref !== void 0 ? _ref : n;
103
103
  }, er = (_param)=>{
104
- var { inputRef: r, value: n, defaultValue: t, onChange: e } = _param, a = _object_without_properties(_param, [
104
+ var { inputRef: r, value: n, defaultValue: i, onChange: e } = _param, a = _object_without_properties(_param, [
105
105
  "inputRef",
106
106
  "value",
107
107
  "defaultValue",
108
108
  "onChange"
109
109
  ]);
110
- const [c, T] = l.useState(t !== null && t !== void 0 ? t : ""), m = l.useRef(null), f = typeof n < "u", u = f ? n : c, g = l.useCallback((C)=>{
111
- f || T(C), m.current && (e == null || e(H(m.current, C)));
110
+ const [N, m] = l.useState(i !== null && i !== void 0 ? i : ""), f = l.useRef(null), u = typeof n < "u", T = u ? n : N, d = l.useCallback((g)=>{
111
+ u || m(g), f.current && (e == null || e(J(f.current, g)));
112
112
  }, [
113
- f,
113
+ u,
114
114
  e
115
- ]), d = G({
115
+ ]), c = H({
116
116
  format: rr,
117
- value: u,
118
- onChange: g,
117
+ value: T,
118
+ onChange: d,
119
119
  accept: /[\d]+/g
120
120
  });
121
121
  return /* @__PURE__ */ o("input", _object_spread_props(_object_spread({}, a), {
122
122
  type: "text",
123
123
  inputMode: "decimal",
124
- maxLength: I(d.value) + 3,
125
- onChange: d.onChange,
126
- value: d.value,
127
- ref: J(r, m)
124
+ maxLength: b(c.value) + 3,
125
+ onChange: c.onChange,
126
+ value: c.value,
127
+ ref: K(r, f)
128
128
  }));
129
- }, tr = (r)=>A(r) ? /* @__PURE__ */ o(P, {
129
+ }, tr = (r)=>x(r) ? /* @__PURE__ */ o($, {
130
130
  size: p.default
131
- }) : E(r) ? /* @__PURE__ */ o($, {
131
+ }) : I(r) ? /* @__PURE__ */ o(q, {
132
132
  size: p.default
133
- }) : b(r) ? /* @__PURE__ */ o(q, {
133
+ }) : A(r) ? /* @__PURE__ */ o(G, {
134
134
  size: p.default
135
135
  }) : null, ir = {
136
136
  showBackface: !1,
137
- animationTarget: /* @__PURE__ */ o(w, {
137
+ animationTarget: /* @__PURE__ */ o(V, {
138
138
  size: p.default
139
139
  }),
140
140
  isAnimating: !1
141
141
  }, nr = (r, param)=>{
142
- let { type: n, value: t } = param;
142
+ let { type: n, value: i } = param;
143
143
  if (n === "INPUT") {
144
- const e = tr(t);
144
+ const e = tr(i);
145
145
  if (e && !r.showBackface) return {
146
146
  animationTarget: e,
147
147
  showBackface: !0,
148
148
  isAnimating: !0
149
149
  };
150
- if (!A(t) && !E(t) && !b(t) && r.showBackface) return {
150
+ if (!x(i) && !I(i) && !A(i) && r.showBackface) return {
151
151
  animationTarget: r.animationTarget,
152
152
  showBackface: !1,
153
153
  isAnimating: !0
@@ -161,7 +161,7 @@ const rr = (r)=>{
161
161
  }) : r;
162
162
  }, or = (param)=>{
163
163
  let { value: r } = param;
164
- const [{ showBackface: n, animationTarget: t, isAnimating: e }, a] = l.useReducer(nr, ir);
164
+ const [{ showBackface: n, animationTarget: i, isAnimating: e }, a] = l.useReducer(nr, ir);
165
165
  return l.useEffect(()=>{
166
166
  a({
167
167
  type: "INPUT",
@@ -170,37 +170,38 @@ const rr = (r)=>{
170
170
  }, [
171
171
  r
172
172
  ]), /* @__PURE__ */ o("div", {
173
- className: K,
174
- children: /* @__PURE__ */ j("div", {
175
- className: Q[n ? "backface" : "default"],
173
+ className: Q,
174
+ children: /* @__PURE__ */ D("div", {
175
+ className: W[n ? "backface" : "default"],
176
176
  onTransitionEnd: ()=>e && a({
177
177
  type: "TRANSITION_END"
178
178
  }),
179
179
  children: [
180
180
  /* @__PURE__ */ o("div", {
181
- className: W,
182
- children: /* @__PURE__ */ o(w, {
181
+ className: X,
182
+ children: /* @__PURE__ */ o(V, {
183
183
  size: p.default,
184
- color: Y.colors.neutralMedium
184
+ color: Z.colors.neutralMedium
185
185
  })
186
186
  }),
187
187
  /* @__PURE__ */ o("div", {
188
- className: X,
189
- children: t
188
+ className: Y,
189
+ children: i
190
190
  })
191
191
  ]
192
192
  })
193
193
  });
194
194
  }, sr = (_param)=>{
195
- var { disabled: r, error: n, helperText: t, name: e, optional: a, validate: c, onChange: T, onChangeValue: m, onBlur: f, acceptedCards: u = {
195
+ var { disabled: r, error: n, helperText: i, name: e, label: a, optional: N, validate: m, onChange: f, onChangeValue: u, onBlur: T, acceptedCards: d = {
196
196
  americanExpress: !0,
197
197
  visa: !0,
198
198
  masterCard: !0
199
- }, value: g, autoComplete: d = "cc-number", defaultValue: C, dataAttributes: R } = _param, z = _object_without_properties(_param, [
199
+ }, value: c, autoComplete: g = "cc-number", defaultValue: w, dataAttributes: R } = _param, z = _object_without_properties(_param, [
200
200
  "disabled",
201
201
  "error",
202
202
  "helperText",
203
203
  "name",
204
+ "label",
204
205
  "optional",
205
206
  "validate",
206
207
  "onChange",
@@ -212,44 +213,45 @@ const rr = (r)=>{
212
213
  "defaultValue",
213
214
  "dataAttributes"
214
215
  ]);
215
- const { texts: x, t: k } = O(), { jumpToNext: S, rawValues: y, setFormError: M } = D(), h = (i, N)=>{
216
- const s = x.formCreditCardNumberError || k(Z);
217
- return i ? b(i) && !u.americanExpress || A(i) && !u.visa || E(i) && !u.masterCard || !U(i) || I(i) !== i.length ? s : c == null ? void 0 : c(i, N) : a ? "" : x.formFieldErrorIsMandatory || k(v);
218
- }, B = (i)=>i.replace(/\s/g, ""), V = L({
216
+ const { texts: F, t: S } = U(), { jumpToNext: j, rawValues: y, setFormError: M } = L(), C = (t, h)=>{
217
+ const s = F.formCreditCardNumberError || S(v);
218
+ return A(t) && !d.americanExpress || x(t) && !d.visa || I(t) && !d.masterCard || !_(t) || b(t) !== (t == null ? void 0 : t.length) ? s : m == null ? void 0 : m(t, h);
219
+ }, E = (t)=>t.replace(/\s/g, ""), k = O({
219
220
  name: e,
220
- value: g,
221
- defaultValue: C,
222
- processValue: B,
223
- helperText: t,
224
- optional: a,
221
+ label: a,
222
+ value: c,
223
+ defaultValue: w,
224
+ processValue: E,
225
+ helperText: i,
226
+ optional: N,
225
227
  error: n,
226
228
  disabled: r,
227
- onBlur: f,
228
- validate: h,
229
- onChange: T,
230
- onChangeValue: m
229
+ onBlur: T,
230
+ validate: C,
231
+ onChange: f,
232
+ onChangeValue: u
231
233
  });
232
234
  var _ref;
233
- return /* @__PURE__ */ o(_, _object_spread_props(_object_spread({}, z, V), {
234
- onChange: (i)=>{
235
- V.onChange(i);
236
- const N = i.currentTarget.value, s = B(N);
237
- if (s.length >= I(s)) {
238
- const F = h == null ? void 0 : h(s, N);
239
- F ? M({
235
+ return /* @__PURE__ */ o(P, _object_spread_props(_object_spread({}, z, k), {
236
+ onChange: (t)=>{
237
+ k.onChange(t);
238
+ const h = t.currentTarget.value, s = E(h);
239
+ if (s.length >= b(s)) {
240
+ const B = C == null ? void 0 : C(s, h);
241
+ B ? M({
240
242
  name: e,
241
- error: F
242
- }) : S(e);
243
+ error: B
244
+ }) : j(e);
243
245
  }
244
246
  },
245
247
  inputComponent: er,
246
- autoComplete: d,
248
+ autoComplete: g,
247
249
  endIcon: /* @__PURE__ */ o(or, {
248
- value: (_ref = g !== null && g !== void 0 ? g : y[e]) !== null && _ref !== void 0 ? _ref : ""
250
+ value: (_ref = c !== null && c !== void 0 ? c : y[e]) !== null && _ref !== void 0 ? _ref : ""
249
251
  }),
250
252
  dataAttributes: _object_spread({
251
253
  "component-name": "CreditCardNumberField"
252
254
  }, R)
253
255
  }));
254
- }, Er = sr;
255
- export { Er as default };
256
+ }, Ir = sr;
257
+ export { Ir as default };
@@ -78,77 +78,77 @@ function _object_without_properties_loose(source, excluded) {
78
78
  }
79
79
  return target;
80
80
  }
81
- import { jsx as r, Fragment as R, jsxs as C } from "react/jsx-runtime";
82
- import * as H from "react";
83
- import { useTheme as V } from "./hooks.js";
84
- import k from "./icons/icon-cvv-visa-mc.js";
85
- import D from "./icons/icon-cvv-amex.js";
86
- import N from "./popover.js";
87
- import q from "./generated/mistica-icons/icon-information-regular.js";
88
- import { useForm as G, useFieldProps as J } from "./form-context.js";
89
- import { TextFieldBaseAutosuggest as K } from "./text-field-base.js";
90
- import { IntegerInput as P } from "./integer-field.js";
91
- import F from "./inline.js";
92
- import Q from "./stack.js";
93
- import U from "./box.js";
94
- import W from "./divider.js";
95
- import M from "./text.js";
96
- import { vars as X } from "./skins/skin-contract.css-mistica.js";
97
- import { pxToRem as Y } from "./utils/css.js";
98
- import { iconButtonSize as c } from "./text-field-base.css-mistica.js";
99
- import Z from "./touchable.js";
100
- import { formCreditCardCvvTooltipVisaMcButtonClose as _, formCreditCardCvvTooltipVisaMcButtonOpen as L, formCreditCardCvvTooltipVisaMc as rr, formCreditCardCvvTooltipAmex as or, formFieldErrorIsMandatory as tr, formCreditCardCvvError as er } from "./text-tokens.js";
101
- const ir = (param)=>{
81
+ import { jsx as o, Fragment as H, jsxs as d } from "react/jsx-runtime";
82
+ import * as k from "react";
83
+ import { useTheme as F } from "./hooks.js";
84
+ import D from "./icons/icon-cvv-visa-mc.js";
85
+ import N from "./icons/icon-cvv-amex.js";
86
+ import q from "./popover.js";
87
+ import G from "./generated/mistica-icons/icon-information-regular.js";
88
+ import { useForm as J, useFieldProps as K } from "./form-context.js";
89
+ import { TextFieldBaseAutosuggest as P } from "./text-field-base.js";
90
+ import { IntegerInput as Q } from "./integer-field.js";
91
+ import I from "./inline.js";
92
+ import U from "./stack.js";
93
+ import W from "./box.js";
94
+ import X from "./divider.js";
95
+ import V from "./text.js";
96
+ import { vars as Y } from "./skins/skin-contract.css-mistica.js";
97
+ import { pxToRem as Z } from "./utils/css.js";
98
+ import { iconButtonSize as m } from "./text-field-base.css-mistica.js";
99
+ import _ from "./touchable.js";
100
+ import { formCreditCardCvvTooltipVisaMcButtonClose as L, formCreditCardCvvTooltipVisaMcButtonOpen as oo, formCreditCardCvvTooltipVisaMc as ro, formCreditCardCvvTooltipAmex as to, formCreditCardCvvError as eo } from "./text-tokens.js";
101
+ const io = (param)=>{
102
102
  let { acceptedCards: t } = param;
103
- const { texts: i, t: n } = V();
104
- return /* @__PURE__ */ r(R, {
105
- children: /* @__PURE__ */ r(U, {
103
+ const { texts: i, t: n } = F();
104
+ return /* @__PURE__ */ o(H, {
105
+ children: /* @__PURE__ */ o(W, {
106
106
  padding: 8,
107
- children: /* @__PURE__ */ C(Q, {
107
+ children: /* @__PURE__ */ d(U, {
108
108
  space: 8,
109
109
  children: [
110
- /* @__PURE__ */ C(F, {
110
+ /* @__PURE__ */ d(I, {
111
111
  space: 16,
112
112
  alignItems: "center",
113
113
  children: [
114
- /* @__PURE__ */ r(k, {
114
+ /* @__PURE__ */ o(D, {
115
115
  size: 48,
116
116
  role: "img"
117
117
  }),
118
- /* @__PURE__ */ r(M, {
119
- children: i.formCreditCardCvvTooltipVisaMc || n(rr)
118
+ /* @__PURE__ */ o(V, {
119
+ children: i.formCreditCardCvvTooltipVisaMc || n(ro)
120
120
  })
121
121
  ]
122
122
  }),
123
- /* @__PURE__ */ r(W, {}),
124
- (t == null ? void 0 : t.americanExpress) && /* @__PURE__ */ C(F, {
123
+ /* @__PURE__ */ o(X, {}),
124
+ (t == null ? void 0 : t.americanExpress) && /* @__PURE__ */ d(I, {
125
125
  space: 16,
126
126
  alignItems: "center",
127
127
  children: [
128
- /* @__PURE__ */ r(D, {
128
+ /* @__PURE__ */ o(N, {
129
129
  size: 48,
130
130
  role: "img"
131
131
  }),
132
- /* @__PURE__ */ r(M, {
133
- children: i.formCreditCardCvvTooltipAmex || n(or)
134
- }),
135
- ")"
132
+ /* @__PURE__ */ o(V, {
133
+ children: i.formCreditCardCvvTooltipAmex || n(to)
134
+ })
136
135
  ]
137
136
  })
138
137
  ]
139
138
  })
140
139
  })
141
140
  });
142
- }, nr = (_param)=>{
143
- var { disabled: t, error: i, helperText: n, name: a, optional: v, validate: p, onChange: B, onChangeValue: E, onBlur: y, acceptedCards: z = {
141
+ }, no = (_param)=>{
142
+ var { disabled: t, error: i, helperText: n, name: l, label: M, optional: B, validate: c, onChange: z, onChangeValue: A, onBlur: E, acceptedCards: $ = {
144
143
  americanExpress: !0,
145
144
  visa: !0,
146
145
  masterCard: !0
147
- }, maxLength: f = 4, value: A, autoComplete: $ = "cc-csc", defaultValue: j, dataAttributes: O } = _param, S = _object_without_properties(_param, [
146
+ }, maxLength: p = 4, value: j, autoComplete: y = "cc-csc", defaultValue: O, dataAttributes: S } = _param, b = _object_without_properties(_param, [
148
147
  "disabled",
149
148
  "error",
150
149
  "helperText",
151
150
  "name",
151
+ "label",
152
152
  "optional",
153
153
  "validate",
154
154
  "onChange",
@@ -161,70 +161,71 @@ const ir = (param)=>{
161
161
  "defaultValue",
162
162
  "dataAttributes"
163
163
  ]);
164
- const { texts: s, t: m } = V(), { setFormError: b, jumpToNext: w } = G(), [d, u] = H.useState(!1), h = (o, l)=>o ? o.length !== f ? s.formCreditCardCvvError || m(er) : p == null ? void 0 : p(o, l) : v ? "" : s.formFieldErrorIsMandatory || m(tr), g = (o)=>o, T = J({
165
- name: a,
166
- value: A,
167
- defaultValue: j,
168
- processValue: g,
164
+ const { texts: a, t: C } = F(), { setFormError: w, jumpToNext: R } = J(), [f, v] = k.useState(!1), u = (r, s)=>r.length !== p ? a.formCreditCardCvvError || C(eo) : c == null ? void 0 : c(r, s), h = (r)=>r, g = K({
165
+ name: l,
166
+ label: M,
167
+ value: j,
168
+ defaultValue: O,
169
+ processValue: h,
169
170
  helperText: n,
170
- optional: v,
171
+ optional: B,
171
172
  error: i,
172
173
  disabled: t,
173
- onBlur: y,
174
- validate: h,
175
- onChange: B,
176
- onChangeValue: E
177
- }), e = Y(16);
178
- return /* @__PURE__ */ r(K, _object_spread_props(_object_spread({}, S, T), {
179
- maxLength: f,
180
- onChange: (o)=>{
181
- T.onChange(o);
182
- const l = o.currentTarget.value, x = g(l);
183
- if (x.length === f) {
184
- const I = h(x, l);
185
- I ? b({
186
- name: a,
187
- error: I
188
- }) : w(a);
174
+ onBlur: E,
175
+ validate: u,
176
+ onChange: z,
177
+ onChangeValue: A
178
+ }), e = Z(16);
179
+ return /* @__PURE__ */ o(P, _object_spread_props(_object_spread({}, b, g), {
180
+ maxLength: p,
181
+ onChange: (r)=>{
182
+ g.onChange(r);
183
+ const s = r.currentTarget.value, T = h(s);
184
+ if (T.length === p) {
185
+ const x = u(T, s);
186
+ x ? w({
187
+ name: l,
188
+ error: x
189
+ }) : R(l);
189
190
  }
190
191
  },
191
- endIcon: /* @__PURE__ */ r(N, {
192
+ endIcon: /* @__PURE__ */ o(q, {
192
193
  position: "top",
193
- open: d,
194
- children: /* @__PURE__ */ r(ir, {
195
- acceptedCards: z
194
+ open: f,
195
+ children: /* @__PURE__ */ o(io, {
196
+ acceptedCards: $
196
197
  }),
197
- onClose: ()=>u(!1),
198
- target: /* @__PURE__ */ r("div", {
198
+ onClose: ()=>v(!1),
199
+ target: /* @__PURE__ */ o("div", {
199
200
  style: {
200
201
  width: e,
201
202
  height: e
202
203
  },
203
- children: /* @__PURE__ */ r(Z, {
204
+ children: /* @__PURE__ */ o(_, {
204
205
  style: {
205
206
  display: "flex",
206
207
  alignItems: "center",
207
208
  justifyContent: "center",
208
- width: c,
209
- height: c,
209
+ width: m,
210
+ height: m,
210
211
  position: "relative",
211
- left: `calc(-1 * (${c} - ${e}) / 2)`,
212
- top: `calc(-1 * (${c} - ${e}) / 2)`
212
+ left: `calc(-1 * (${m} - ${e}) / 2)`,
213
+ top: `calc(-1 * (${m} - ${e}) / 2)`
213
214
  },
214
- onPress: ()=>u(!d),
215
- "aria-label": d ? s.formCreditCardCvvTooltipVisaMcButtonClose || m(_) : s.formCreditCardCvvTooltipVisaMcButtonOpen || m(L),
216
- children: /* @__PURE__ */ r(q, {
215
+ onPress: ()=>v(!f),
216
+ "aria-label": f ? a.formCreditCardCvvTooltipVisaMcButtonClose || C(L) : a.formCreditCardCvvTooltipVisaMcButtonOpen || C(oo),
217
+ children: /* @__PURE__ */ o(G, {
217
218
  size: e,
218
- color: X.colors.neutralMedium
219
+ color: Y.colors.neutralMedium
219
220
  })
220
221
  })
221
222
  })
222
223
  }),
223
- autoComplete: $,
224
- inputComponent: P,
224
+ autoComplete: y,
225
+ inputComponent: Q,
225
226
  dataAttributes: _object_spread({
226
227
  "component-name": "CvvField"
227
- }, O)
228
+ }, S)
228
229
  }));
229
- }, Br = nr;
230
- export { Br as default };
230
+ }, zo = no;
231
+ export { zo as default };