@telefonica/mistica 16.0.0 → 16.1.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.
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 +1 -1
  39. package/dist/phone-number-field.js +42 -40
  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 +2 -0
  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 +51 -49
  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
package/dist/slider.js CHANGED
@@ -122,24 +122,24 @@ function _object_without_properties_loose(source, excluded) {
122
122
  }
123
123
  return target;
124
124
  }
125
- const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t), I = (n, t, o, a, g)=>{
125
+ const Re = 48, me = 20, Ce = 28, Ve = (r, t, o)=>t >= o ? 0 : (r - t) / (o - t), I = (r, t, o, a, h)=>{
126
126
  const v = (i)=>{
127
127
  if (i === void 0) return t;
128
- const B = n ? t + (o - t) * i : i;
128
+ const B = r ? t + (o - t) * i : i;
129
129
  return Math.max(t, Math.min(o, B));
130
130
  };
131
131
  if (t >= o) return t;
132
- const h = v(g), P = t + Math.floor((h - t) / a) * a, R = t + Math.ceil((h - t) / a) * a;
133
- return R <= o && R - h <= h - P ? R : P;
134
- }, w = (n, t, o)=>{
132
+ const b = v(h), P = t + Math.floor((b - t) / a) * a, R = t + Math.ceil((b - t) / a) * a;
133
+ return R <= o && R - b <= b - P ? R : P;
134
+ }, w = (r, t, o)=>{
135
135
  if (!o) return t;
136
- if (t === void 0) return n;
136
+ if (t === void 0) return r;
137
137
  let a = 0;
138
- return o.forEach((g, v)=>{
139
- o && Math.abs(g - t) <= Math.abs(o[a] - t) && (a = v);
138
+ return o.forEach((h, v)=>{
139
+ o && Math.abs(h - t) <= Math.abs(o[a] - t) && (a = v);
140
140
  }), a;
141
141
  }, Pe = /*#__PURE__*/ _react.forwardRef((_param, B)=>{
142
- var { values: n, step: t = 1, min: o = 0, max: a = 100, "aria-label": g, "aria-labelledby": v, id: h, dataAttributes: P, tooltip: R } = _param, i = _object_without_properties(_param, [
142
+ var { values: r, step: t = 1, min: o = 0, max: a = 100, "aria-label": h, "aria-labelledby": v, id: b, dataAttributes: P, tooltip: R } = _param, i = _object_without_properties(_param, [
143
143
  "values",
144
144
  "step",
145
145
  "min",
@@ -150,21 +150,22 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
150
150
  "dataAttributes",
151
151
  "tooltip"
152
152
  ]);
153
- n && (n.length === 0 ? n = void 0 : a = n.length - 1), t = t | 0, t = t <= 0 ? 1 : t;
153
+ r && (r.length === 0 ? r = void 0 : a = r.length - 1), t = t | 0, t = t <= 0 ? 1 : t;
154
154
  const { defaultValue: Z, value: D, onChange: H, focusableRef: x, disabled: U, name: z } = (0, _formcontext.useControlProps)({
155
155
  name: i.name,
156
- value: i.value !== void 0 ? I(!1, o, a, t, w(o, i.value, n)) : void 0,
157
- defaultValue: i.defaultValue !== void 0 ? I(!1, o, a, t, w(o, i.defaultValue, n)) : void 0,
156
+ label: h,
157
+ value: i.value !== void 0 ? I(!1, o, a, t, w(o, i.value, r)) : void 0,
158
+ defaultValue: i.defaultValue !== void 0 ? I(!1, o, a, t, w(o, i.defaultValue, r)) : void 0,
158
159
  onChange: i.onChangeValue,
159
160
  disabled: i.disabled
160
- }), [q, G] = _react.useState(D !== null && D !== void 0 ? D : I(!1, o, a, t, w(o, Z, n))), u = D !== null && D !== void 0 ? D : q, $ = _react.useRef(u), T = _react.useCallback((e, r)=>{
161
- const c = I(r, o, a, t, e);
162
- $.current !== c && (H(n ? n[c] : c), G(c), $.current = c);
161
+ }), [q, G] = _react.useState(D !== null && D !== void 0 ? D : I(!1, o, a, t, w(o, Z, r))), u = D !== null && D !== void 0 ? D : q, $ = _react.useRef(u), T = _react.useCallback((e, n)=>{
162
+ const c = I(n, o, a, t, e);
163
+ $.current !== c && (H(r ? r[c] : c), G(c), $.current = c);
163
164
  }, [
164
165
  o,
165
166
  a,
166
167
  t,
167
- n,
168
+ r,
168
169
  H
169
170
  ]);
170
171
  _react.useEffect(()=>{
@@ -172,24 +173,24 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
172
173
  }, [
173
174
  T
174
175
  ]);
175
- const _ = _react.useRef(null), m = _react.useRef(null), N = _react.useRef(null), J = _react.useRef(null), [p, E] = _react.useState(!1), [y, F] = _react.useState(!1), [K, L] = _react.useState(!1), { isIos: S } = (0, _hooks.useTheme)(), A = (e, r, c)=>{
176
+ const _ = _react.useRef(null), m = _react.useRef(null), N = _react.useRef(null), J = _react.useRef(null), [p, E] = _react.useState(!1), [y, F] = _react.useState(!1), [K, O] = _react.useState(!1), { isIos: S } = (0, _hooks.useTheme)(), A = (e, n, c)=>{
176
177
  const d = e == null ? void 0 : e.getBoundingClientRect();
177
- return !!d && d.left <= r && r <= d.right && d.top <= c && c <= d.bottom;
178
+ return !!d && d.left <= n && n <= d.right && d.top <= c && c <= d.bottom;
178
179
  }, l = (0, _environment.isTouchableDevice)(), C = S ? Ce : me, f = l ? Re : C, M = (e)=>{
179
- const r = _.current;
180
- if (r) {
181
- const c = r.getBoundingClientRect().left + C / 2, d = r.getBoundingClientRect().right - C / 2;
180
+ const n = _.current;
181
+ if (n) {
182
+ const c = n.getBoundingClientRect().left + C / 2, d = n.getBoundingClientRect().right - C / 2;
182
183
  T((e - c) / (d - c), !0);
183
184
  }
184
185
  }, Q = (e)=>{
185
186
  (0, _dom.cancelEvent)(e), M(e.clientX);
186
187
  }, W = (e)=>{
187
- const r = m.current;
188
- r && (r.onpointermove = Q, r.setPointerCapture(e.pointerId));
188
+ const n = m.current;
189
+ n && (n.onpointermove = Q, n.setPointerCapture(e.pointerId));
189
190
  }, ee = (e)=>{
190
- const r = m.current;
191
- r && (r.onpointermove = null, r.releasePointerCapture(e.pointerId));
192
- }, k = `calc(${Ve(u, o, a)} * (100% - ${C}px) - ${(f - C) / 2}px)`, O = `calc(${k} + ${f / 2}px)`, X = /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
191
+ const n = m.current;
192
+ n && (n.onpointermove = null, n.releasePointerCapture(e.pointerId));
193
+ }, k = `calc(${Ve(u, o, a)} * (100% - ${C}px) - ${(f - C) / 2}px)`, X = `calc(${k} + ${f / 2}px)`, L = /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
193
194
  className: (0, _classnames.default)(S ? _slidercssmistica.iosThumb : _slidercssmistica.defaultThumb, {
194
195
  [_slidercssmistica.thumbHover]: !S && y && !p,
195
196
  [_slidercssmistica.thumbActive]: !S && p
@@ -209,16 +210,16 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
209
210
  },
210
211
  ref: N,
211
212
  onPointerDown: (e)=>{
212
- const r = e.clientX, c = e.clientY;
213
- !l && A(N.current, r, c) ? (A(m.current, r, c) || M(r), E(!0), W(e)) : (0, _dom.cancelEvent)(e);
213
+ const n = e.clientX, c = e.clientY;
214
+ !l && A(N.current, n, c) ? (A(m.current, n, c) || M(n), E(!0), W(e)) : (0, _dom.cancelEvent)(e);
214
215
  },
215
216
  onPointerUp: (e)=>{
216
217
  l || (E(!1), ee(e));
217
218
  },
218
219
  onTouchStart: (e)=>{
219
220
  if ((0, _dom.cancelEvent)(e), l) {
220
- const r = e.nativeEvent.touches[0].clientX, c = e.nativeEvent.touches[0].clientY;
221
- A(m.current, r, c) || M(r), E(!0);
221
+ const n = e.nativeEvent.touches[0].clientX, c = e.nativeEvent.touches[0].clientY;
222
+ A(m.current, n, c) || M(n), E(!0);
222
223
  }
223
224
  },
224
225
  onTouchEnd: (e)=>{
@@ -232,7 +233,7 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
232
233
  className: _slidercssmistica.track,
233
234
  ref: _,
234
235
  style: {
235
- background: `linear-gradient(to right, ${_skincontractcssmistica.vars.colors.controlActivated} ${O}, ${_skincontractcssmistica.vars.colors.barTrack} ${O}`
236
+ background: `linear-gradient(to right, ${_skincontractcssmistica.vars.colors.controlActivated} ${X}, ${_skincontractcssmistica.vars.colors.barTrack} ${X}`
236
237
  }
237
238
  }),
238
239
  /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
@@ -251,12 +252,12 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
251
252
  l || F(!1);
252
253
  },
253
254
  children: R ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_tooltip.default, {
254
- target: X,
255
+ target: L,
255
256
  open: p || K || y ? !0 : void 0,
256
- description: String(n ? n[u] : u),
257
+ description: String(r ? r[u] : u),
257
258
  centerContent: !0,
258
259
  delay: !1
259
- }) : X
260
+ }) : L
260
261
  }),
261
262
  /* @__PURE__ */ (0, _jsxruntime.jsx)("input", {
262
263
  type: "range",
@@ -264,11 +265,11 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
264
265
  max: a,
265
266
  ref: (0, _common.combineRefs)(B, J, x),
266
267
  step: t,
267
- "aria-label": g,
268
+ "aria-label": h,
268
269
  "aria-labelledby": v,
269
- id: h,
270
+ id: b,
270
271
  className: _slidercssmistica.input,
271
- "aria-valuetext": String(n ? n[u] : u),
272
+ "aria-valuetext": String(r ? r[u] : u),
272
273
  style: {
273
274
  left: k,
274
275
  width: f,
@@ -279,10 +280,10 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
279
280
  disabled: U,
280
281
  onChange: (e)=>T(+e.target.value, !1),
281
282
  onFocus: ()=>{
282
- L(!0);
283
+ O(!0);
283
284
  },
284
285
  onBlur: ()=>{
285
- L(!1);
286
+ O(!1);
286
287
  }
287
288
  })
288
289
  ]
@@ -118,22 +118,23 @@ function _object_spread_props(target, source) {
118
118
  return target;
119
119
  }
120
120
  const L = (e)=>{
121
- const { isIos: d, isDarkMode: f } = (0, _hooks.useTheme)(), u = _react.useId(), n = e["aria-labelledby"] || u, { defaultValue: k, value: c, onChange: a, focusableRef: v, disabled: t } = (0, _formcontext.useControlProps)({
121
+ const { isIos: d, isDarkMode: f } = (0, _hooks.useTheme)(), u = _react.useId(), n = e["aria-labelledby"] || u, { defaultValue: k, value: s, onChange: a, focusableRef: v, disabled: i } = (0, _formcontext.useControlProps)({
122
122
  name: e.name,
123
+ label: e["aria-label"],
123
124
  value: e.checked,
124
125
  defaultValue: e.defaultChecked,
125
126
  onChange: e.onChange,
126
127
  disabled: e.disabled
127
- }), [l, I] = _react.useState(!!k), r = c !== null && c !== void 0 ? c : l, N = _react.useMemo(()=>process.env.NODE_ENV === "test" ? (i)=>a == null ? void 0 : a(i) : (0, _helpers.debounce)((i)=>{
128
- a == null || a(i);
128
+ }), [c, I] = _react.useState(!!k), r = s !== null && s !== void 0 ? s : c, N = _react.useMemo(()=>process.env.NODE_ENV === "test" ? (t)=>a == null ? void 0 : a(t) : (0, _helpers.debounce)((t)=>{
129
+ a == null || a(t);
129
130
  }, 300), [
130
131
  a
131
132
  ]), m = ()=>{
132
- c !== void 0 ? a == null || a(!c) : (I(!l), N(!l));
133
- }, w = (i)=>{
134
- i.key === _keys.SPACE && (i.preventDefault(), i.stopPropagation(), m());
133
+ s !== void 0 ? a == null || a(!s) : (I(!c), N(!c));
134
+ }, w = (t)=>{
135
+ t.key === _keys.SPACE && (t.preventDefault(), t.stopPropagation(), m());
135
136
  }, h = /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
136
- className: _switchcomponentcssmistica.checkboxVariants[d ? t ? "disabledIos" : "ios" : t ? "disabled" : "default"],
137
+ className: _switchcomponentcssmistica.checkboxVariants[d ? i ? "disabledIos" : "ios" : i ? "disabled" : "default"],
137
138
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
138
139
  className: _switchcomponentcssmistica.switchCheckboxContainerVariants[d ? "ios" : "default"],
139
140
  children: /* @__PURE__ */ (0, _jsxruntime.jsxs)("div", {
@@ -152,15 +153,15 @@ const L = (e)=>{
152
153
  return(// eslint-disable-next-line jsx-a11y/interactive-supports-focus
153
154
  /* @__PURE__ */ (0, _jsxruntime.jsx)("span", _object_spread_props(_object_spread({
154
155
  role: "switch",
155
- "aria-checked": c !== null && c !== void 0 ? c : l,
156
- onClick: (i)=>{
157
- i.stopPropagation(), t || m();
156
+ "aria-checked": s !== null && s !== void 0 ? s : c,
157
+ onClick: (t)=>{
158
+ t.stopPropagation(), i || m();
158
159
  },
159
- onKeyDown: t ? void 0 : w,
160
- tabIndex: t ? void 0 : 0,
160
+ onKeyDown: i ? void 0 : w,
161
+ tabIndex: i ? void 0 : 0,
161
162
  ref: v,
162
- className: t ? _switchcomponentcssmistica.containerDisabled : _switchcomponentcssmistica.container,
163
- "aria-disabled": t,
163
+ className: i ? _switchcomponentcssmistica.containerDisabled : _switchcomponentcssmistica.container,
164
+ "aria-disabled": i,
164
165
  "aria-label": e["aria-label"],
165
166
  "aria-labelledby": e["aria-label"] ? void 0 : n
166
167
  }, (0, _dom.getPrefixedDataAttributes)(e.dataAttributes, "Switch")), {
@@ -168,8 +169,8 @@ const L = (e)=>{
168
169
  children: e.render({
169
170
  controlElement: h,
170
171
  labelId: n,
171
- disabled: !!t,
172
- checked: c !== null && c !== void 0 ? c : l
172
+ disabled: !!i,
173
+ checked: s !== null && s !== void 0 ? s : c
173
174
  })
174
175
  }) : /* @__PURE__ */ (0, _jsxruntime.jsxs)(_inline.default, {
175
176
  space: 16,
@@ -182,7 +183,7 @@ const L = (e)=>{
182
183
  as: "div",
183
184
  id: n,
184
185
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
185
- className: t ? _switchcomponentcssmistica.disabled : "",
186
+ className: i ? _switchcomponentcssmistica.disabled : "",
186
187
  children: e.children
187
188
  })
188
189
  })
@@ -50,6 +50,7 @@ export interface CommonFormFieldProps<T = HTMLInputElement> {
50
50
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
51
51
  children?: void;
52
52
  readOnly?: boolean;
53
+ preventCopy?: boolean;
53
54
  dataAttributes?: DataAttributes;
54
55
  }
55
56
  interface TextFieldBaseProps {
@@ -92,6 +93,7 @@ interface TextFieldBaseProps {
92
93
  multiline?: boolean;
93
94
  inputMode?: string;
94
95
  readOnly?: boolean;
96
+ preventCopy?: boolean;
95
97
  min?: string;
96
98
  max?: string;
97
99
  role?: string;
@@ -11,13 +11,13 @@ function _export(target, all) {
11
11
  }
12
12
  _export(exports, {
13
13
  FieldEndIcon: function() {
14
- return et;
14
+ return nt;
15
15
  },
16
16
  TextFieldBase: function() {
17
17
  return W;
18
18
  },
19
19
  TextFieldBaseAutosuggest: function() {
20
- return tt;
20
+ return at;
21
21
  }
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
@@ -160,34 +160,36 @@ function _object_without_properties_loose(source, excluded) {
160
160
  }
161
161
  return target;
162
162
  }
163
- const De = (d, u)=>{
163
+ const _e = (l, u)=>{
164
164
  if (!u) return !0;
165
165
  const t = document.createElement("input");
166
- return t.type = u, t.value = d || "", t.value !== "";
167
- }, et = (param)=>{
168
- let { hasBackgroundColor: d = !0, onPress: u, onChange: t, disabled: m, Icon: S, checkedProps: l, uncheckedProps: a, "aria-label": h } = param;
166
+ return t.type = u, t.value = l || "", t.value !== "";
167
+ }, nt = (param)=>{
168
+ let { hasBackgroundColor: l = !0, onPress: u, onChange: t, disabled: m, Icon: S, checkedProps: o, uncheckedProps: a, "aria-label": h } = param;
169
169
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
170
170
  className: _textfieldbasecssmistica.fieldEndIconContainer,
171
- children: l ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_iconbutton.InternalToggleIconButton, {
172
- checkedProps: _object_spread_props(_object_spread({}, l), {
173
- "aria-label": l["aria-label"] || ""
171
+ children: o ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_iconbutton.InternalToggleIconButton, {
172
+ checkedProps: _object_spread_props(_object_spread({}, o), {
173
+ "aria-label": o["aria-label"] || ""
174
174
  }),
175
175
  uncheckedProps: _object_spread_props(_object_spread({}, a), {
176
176
  "aria-label": a["aria-label"] || ""
177
177
  }),
178
178
  onChange: t,
179
- hasOverlay: d,
179
+ hasOverlay: l,
180
180
  disabled: m
181
181
  }) : /* @__PURE__ */ (0, _jsxruntime.jsx)(_iconbutton.InternalIconButton, {
182
182
  Icon: S,
183
183
  disabled: m,
184
184
  "aria-label": h || "",
185
185
  onPress: u,
186
- hasOverlay: d
186
+ hasOverlay: l
187
187
  })
188
188
  });
189
- }, W = /*#__PURE__*/ _react.forwardRef((_param, Q)=>{
190
- var { error: d, helperText: u, label: t, inputProps: m, inputRef: S, defaultValue: l, value: a, onFocus: h, onBlur: b, inputComponent: L, prefix: y, startIcon: f, endIcon: x, endIconOverlay: i, shrinkLabel: g, multiline: p = !1, focus: I, fieldRef: k, maxLength: C, id: H, autoComplete: K, fullWidth: M, dataAttributes: J } = _param, o = _object_without_properties(_param, [
189
+ }, H = (l)=>{
190
+ l.preventDefault();
191
+ }, W = /*#__PURE__*/ _react.forwardRef((_param, Y)=>{
192
+ var { error: l, helperText: u, label: t, inputProps: m, inputRef: S, defaultValue: o, value: a, onFocus: h, onBlur: b, inputComponent: v, prefix: y, startIcon: f, endIcon: x, endIconOverlay: i, shrinkLabel: g, multiline: p = !1, focus: I, fieldRef: M, maxLength: C, id: J, autoComplete: Q, fullWidth: U, dataAttributes: X, preventCopy: A } = _param, d = _object_without_properties(_param, [
191
193
  "error",
192
194
  "helperText",
193
195
  "label",
@@ -210,59 +212,62 @@ const De = (d, u)=>{
210
212
  "id",
211
213
  "autoComplete",
212
214
  "fullWidth",
213
- "dataAttributes"
215
+ "dataAttributes",
216
+ "preventCopy"
214
217
  ]);
218
+ const { preventCopyInFormFields: Z } = (0, _hooks.useTheme)();
219
+ A = A !== null && A !== void 0 ? A : Z;
215
220
  var _ref;
216
- const U = _react.useId(), N = H || U, w = _react.useId(), [s, c] = _react.useState(l != null && l.length || a != null && a.length ? "filled" : "default"), { isTabletOrSmaller: X } = (0, _hooks.useScreenSize)(), [P, O] = _react.useState((_ref = l == null ? void 0 : l.length) !== null && _ref !== void 0 ? _ref : 0), A = !!t || !o.required, E = o.type === "date" || o.type === "datetime-local" || o.type === "month", B = _react.useRef(void 0);
221
+ const V = _react.useId(), w = J || V, P = _react.useId(), [s, c] = _react.useState(o != null && o.length || a != null && a.length ? "filled" : "default"), { isTabletOrSmaller: ee } = (0, _hooks.useScreenSize)(), [D, O] = _react.useState((_ref = o == null ? void 0 : o.length) !== null && _ref !== void 0 ? _ref : 0), $ = !!t || !d.required, E = d.type === "date" || d.type === "datetime-local" || d.type === "month", B = _react.useRef(void 0);
217
222
  (0, _hooks.useIsomorphicLayoutEffect)(()=>{
218
- const e = E && !De(a, o.type) ? "" : a;
223
+ const e = E && !_e(a, d.type) ? "" : a;
219
224
  B.current !== a && E && !(e != null && e.length) && s === "filled" && I === void 0 && c("default"), B.current = a, s !== "focused" && e != null && e.length && (O(e.length), c("filled")), I && c("focused"), I === !1 && !(e != null && e.length) && c("default"), I === !1 && e != null && e.length && c("filled");
220
225
  }, [
221
226
  s,
222
227
  a,
223
228
  I,
224
229
  E,
225
- o.type
230
+ d.type
226
231
  ]), _react.useEffect(()=>{
227
- o.autoFocus && c("focused");
232
+ d.autoFocus && c("focused");
228
233
  }, [
229
- o.autoFocus
234
+ d.autoFocus
230
235
  ]);
231
- const Y = p ? "textarea" : "input", Z = L ? {
236
+ const te = p ? "textarea" : "input", ie = v ? {
232
237
  inputRef: S
233
238
  } : {
234
- ref: (0, _common.combineRefs)(Q, S)
235
- }, R = _object_spread(_object_spread_props(_object_spread({}, o), {
239
+ ref: (0, _common.combineRefs)(Y, S)
240
+ }, R = _object_spread(_object_spread_props(_object_spread({}, d), {
236
241
  maxLength: C,
237
- autoComplete: K
238
- }), m), $ = `calc(${_iconbuttoncssmistica.iconSize.default} + ${_textfieldbasecssmistica.fieldElementsGap}px)`, D = `calc(${_textfieldbasecssmistica.iconButtonSize} + ${_textfieldbasecssmistica.fieldEndIconGap}px)`, V = g || s === "focused" || s === "filled" ? X ? _textfieldcomponentscssmistica.LABEL_SCALE_MOBILE : _textfieldcomponentscssmistica.LABEL_SCALE_DESKTOP : 1, ee = {
239
- left: `calc(${_textfieldbasecssmistica.fieldLeftPadding}px + ${f ? $ : "0px"})`,
242
+ autoComplete: Q
243
+ }), m), F = `calc(${_iconbuttoncssmistica.iconSize.default} + ${_textfieldbasecssmistica.fieldElementsGap}px)`, q = `calc(${_textfieldbasecssmistica.iconButtonSize} + ${_textfieldbasecssmistica.fieldEndIconGap}px)`, ne = g || s === "focused" || s === "filled" ? ee ? _textfieldcomponentscssmistica.LABEL_SCALE_MOBILE : _textfieldcomponentscssmistica.LABEL_SCALE_DESKTOP : 1, ae = {
244
+ left: `calc(${_textfieldbasecssmistica.fieldLeftPadding}px + ${f ? F : "0px"})`,
240
245
  // shrinking means applying a scale transformation, so width will be proportionally reduced.
241
246
  // Let's keep the original width.
242
- width: `calc((100% - ${_textfieldbasecssmistica.fieldLeftPadding}px - ${f ? $ : "0px"} - ${x || i ? D : `${_textfieldbasecssmistica.fieldRightPadding}px`}) / ${V})`
243
- }, te = o.type === "password" && P > 0 ? "Lucida Grande, Arial, sans-serif" : "inherit";
247
+ width: `calc((100% - ${_textfieldbasecssmistica.fieldLeftPadding}px - ${f ? F : "0px"} - ${x || i ? q : `${_textfieldbasecssmistica.fieldRightPadding}px`}) / ${ne})`
248
+ }, re = d.type === "password" && D > 0 ? "Lucida Grande, Arial, sans-serif" : "inherit";
244
249
  return /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.FieldContainer, {
245
- disabled: o.disabled,
250
+ disabled: d.disabled,
246
251
  helperText: /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.HelperText, {
247
- error: d,
252
+ error: l,
248
253
  leftText: u,
249
- id: w,
250
- rightText: p && C ? `${P}/${C}` : void 0
254
+ id: P,
255
+ rightText: p && C ? `${D}/${C}` : void 0
251
256
  }),
252
257
  multiline: p,
253
- fullWidth: M,
254
- fieldRef: k,
255
- readOnly: o.readOnly,
256
- dataAttributes: J,
258
+ fullWidth: U,
259
+ fieldRef: M,
260
+ readOnly: d.readOnly,
261
+ dataAttributes: X,
257
262
  children: /* @__PURE__ */ (0, _jsxruntime.jsxs)(_themevariantcontext.ThemeVariant, {
258
- isInverse: !1,
263
+ variant: "default",
259
264
  children: [
260
265
  f && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
261
266
  className: _textfieldbasecssmistica.startIcon,
262
267
  children: f
263
268
  }),
264
269
  y && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
265
- className: (0, _classnames.default)(_textfieldbasecssmistica.prefix, A ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel),
270
+ className: (0, _classnames.default)(_textfieldbasecssmistica.prefix, $ ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel),
266
271
  style: {
267
272
  opacity: s === "default" ? 0 : 1
268
273
  },
@@ -273,20 +278,29 @@ const De = (d, u)=>{
273
278
  children: y
274
279
  })
275
280
  }),
281
+ t && /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.Label, {
282
+ style: ae,
283
+ error: l,
284
+ forId: w,
285
+ inputState: s,
286
+ shrinkLabel: g,
287
+ optional: !d.required,
288
+ children: t
289
+ }),
276
290
  /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
277
291
  className: _textfieldbasecssmistica.fullWidth,
278
292
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
279
293
  as: "div",
280
294
  regular: !0,
281
- children: /*#__PURE__*/ _react.createElement(L || Y, _object_spread(_object_spread_props(_object_spread({}, Z, R), {
282
- id: N,
295
+ children: /*#__PURE__*/ _react.createElement(v || te, _object_spread(_object_spread_props(_object_spread({}, ie, R), {
296
+ id: w,
283
297
  style: _object_spread_props(_object_spread({
284
- paddingRight: x ? 0 : i ? D : _textfieldbasecssmistica.fieldRightPadding,
285
- paddingLeft: y ? 0 : f ? `calc(${$} + ${_textfieldbasecssmistica.fieldLeftPadding}px)` : _textfieldbasecssmistica.fieldLeftPadding
298
+ paddingRight: x ? 0 : i ? q : _textfieldbasecssmistica.fieldRightPadding,
299
+ paddingLeft: y ? 0 : f ? `calc(${F} + ${_textfieldbasecssmistica.fieldLeftPadding}px)` : _textfieldbasecssmistica.fieldLeftPadding
286
300
  }, R.style), {
287
- fontFamily: te
301
+ fontFamily: re
288
302
  }),
289
- className: p ? (0, _classnames.default)(_textfieldbasecssmistica.textArea, A ? _textfieldbasecssmistica.textAreaWithLabel : _textfieldbasecssmistica.textAreaWithoutLabel) : (0, _classnames.default)(_textfieldbasecssmistica.input, A ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel, {
303
+ className: p ? (0, _classnames.default)(_textfieldbasecssmistica.textArea, $ ? _textfieldbasecssmistica.textAreaWithLabel : _textfieldbasecssmistica.textAreaWithoutLabel) : (0, _classnames.default)(_textfieldbasecssmistica.input, $ ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel, {
290
304
  [_textfieldbasecssmistica.inputFirefoxStyles]: (0, _platform.isFirefox)(),
291
305
  // Hide webkit placeholder when label is not shrinked and value is empty
292
306
  [_textfieldbasecssmistica.hiddenDatePlaceholder]: E && s === "default",
@@ -300,27 +314,21 @@ const De = (d, u)=>{
300
314
  e.target.value.length > 0 ? c("filled") : c("default"), b == null || b(e);
301
315
  },
302
316
  onChange: (e)=>{
303
- var q;
304
- C === void 0 || e.target.value.length <= C ? (O(e.target.value.length), e.target.value.length > 0 && s !== "focused" && c(e.target.value.length > 0 ? "filled" : "default"), (q = R.onChange) == null || q.call(R, e)) : (e.stopPropagation(), e.preventDefault());
317
+ var z;
318
+ C === void 0 || e.target.value.length <= C ? (O(e.target.value.length), e.target.value.length > 0 && s !== "focused" && c(e.target.value.length > 0 ? "filled" : "default"), (z = R.onChange) == null || z.call(R, e)) : (e.stopPropagation(), e.preventDefault());
305
319
  },
306
- defaultValue: l,
320
+ defaultValue: o,
307
321
  value: a
308
- }), d && {
322
+ }), l && {
309
323
  "aria-invalid": !0
310
324
  }, u && {
311
- "aria-describedby": w
325
+ "aria-describedby": P
326
+ }, A && {
327
+ onCopy: H,
328
+ onCut: H
312
329
  }))
313
330
  })
314
331
  }),
315
- t && /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.Label, {
316
- style: ee,
317
- error: d,
318
- forId: N,
319
- inputState: s,
320
- shrinkLabel: g,
321
- optional: !o.required,
322
- children: t
323
- }),
324
332
  x && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
325
333
  className: _textfieldbasecssmistica.endIconContainer,
326
334
  children: x
@@ -329,21 +337,21 @@ const De = (d, u)=>{
329
337
  ]
330
338
  })
331
339
  });
332
- }), qe = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")))), tt = /*#__PURE__*/ _react.forwardRef((_param, m)=>{
333
- var { getSuggestions: d, id: u } = _param, t = _object_without_properties(_param, [
340
+ }), Ge = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")))), at = /*#__PURE__*/ _react.forwardRef((_param, m)=>{
341
+ var { getSuggestions: l, id: u } = _param, t = _object_without_properties(_param, [
334
342
  "getSuggestions",
335
343
  "id"
336
344
  ]);
337
- const [S, l] = _react.useState([]), a = _react.useRef(null), { platformOverrides: h, texts: b, t: L } = (0, _hooks.useTheme)(), y = _react.useId(), f = u || y, x = _react.useId();
338
- if (d && (t.value === void 0 || t.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
339
- return d ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_react.Suspense, {
345
+ const [S, o] = _react.useState([]), a = _react.useRef(null), { platformOverrides: h, texts: b, t: v } = (0, _hooks.useTheme)(), y = _react.useId(), f = u || y, x = _react.useId();
346
+ if (l && (t.value === void 0 || t.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
347
+ return l ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_react.Suspense, {
340
348
  fallback: /* @__PURE__ */ (0, _jsxruntime.jsx)(W, _object_spread_props(_object_spread({}, t), {
341
349
  label: (0, _platform.isRunningAcceptanceTest)(h) ? "" : t.label,
342
350
  autoComplete: "off",
343
351
  ref: m,
344
352
  id: f
345
353
  })),
346
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)(qe, {
354
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(Ge, {
347
355
  id: x,
348
356
  inputProps: _object_spread_props(_object_spread({}, t), {
349
357
  id: f,
@@ -365,9 +373,9 @@ const De = (d, u)=>{
365
373
  suggestions: S,
366
374
  onSuggestionsFetchRequested: (param)=>{
367
375
  let { value: i } = param;
368
- return l(d(i));
376
+ return o(l(i));
369
377
  },
370
- onSuggestionsClearRequested: ()=>l([]),
378
+ onSuggestionsClearRequested: ()=>o([]),
371
379
  getSuggestionValue: (i)=>i,
372
380
  renderSuggestion: (i, param)=>{
373
381
  let { isHighlighted: g } = param;
@@ -387,7 +395,7 @@ const De = (d, u)=>{
387
395
  width: a.current ? a.current.clientWidth + 2 : 0
388
396
  },
389
397
  className: _textfieldbasecssmistica.suggestionsContainer,
390
- "aria-label": `${t.label} ${b.menuLabelSuffix || L(_texttokens.menuLabelSuffix)}`,
398
+ "aria-label": `${t.label} ${b.menuLabelSuffix || v(_texttokens.menuLabelSuffix)}`,
391
399
  children: i.children
392
400
  }))
393
401
  })
@@ -19,39 +19,39 @@ _export(exports, {
19
19
  return e;
20
20
  },
21
21
  disabled: function() {
22
- return k;
22
+ return y;
23
23
  },
24
24
  field: function() {
25
- return i;
25
+ return k;
26
26
  },
27
27
  fieldContainer: function() {
28
- return y;
28
+ return i;
29
29
  },
30
30
  fullWidth: function() {
31
- return t;
31
+ return l;
32
32
  },
33
33
  helperContainer: function() {
34
- return l;
34
+ return h;
35
35
  },
36
36
  helperText: function() {
37
- return h;
37
+ return t;
38
38
  },
39
39
  labelContainer: function() {
40
- return u;
40
+ return o;
41
41
  },
42
42
  labelText: function() {
43
- return o;
43
+ return p;
44
44
  },
45
- leftText: function() {
46
- return d;
45
+ leftHelperText: function() {
46
+ return u;
47
47
  },
48
48
  normalWidth: function() {
49
- return p;
50
- },
51
- rightText: function() {
52
49
  return L;
53
50
  },
54
51
  shrinked: function() {
52
+ return d;
53
+ },
54
+ warnIcon: function() {
55
55
  return E;
56
56
  }
57
57
  });
@@ -59,4 +59,4 @@ require("./sprinkles.css.ts.vanilla.css-mistica.js");
59
59
  require("./icon-button.css.ts.vanilla.css-mistica.js");
60
60
  require("./text-field-base.css.ts.vanilla.css-mistica.js");
61
61
  require("./text-field-components.css.ts.vanilla.css-mistica.js");
62
- var a = 328, f = 0.78, e = 0.75, k = "_15k6ur97", i = "_1y2v1nfkl _1y2v1nfk1 _1y2v1nfhk _1y2v1nfka _1y2v1nfhe", y = "_15k6ur96 _1y2v1nfhk _1y2v1nfhq", t = "_1y2v1nfi7", l = "_1y2v1nfa7 _1y2v1nfbj _1y2v1nfhk", h = "_15k6ur9d", u = "_15k6ur91 _1y2v1nfhf _1y2v1nfhk _1y2v1nfhp", o = "_15k6ur93 _1y2v1nfkl _1y2v1nfi3", d = "_15k6ur9e", p = "_15k6ur99 _1y2v1nfi7", L = "_15k6ur9f", E = "_15k6ur94";
62
+ var a = 328, f = 0.78, e = 0.75, y = "_15k6ur97", k = "_1y2v1nfkl _1y2v1nfk1 _1y2v1nfhk _1y2v1nfka _1y2v1nfhe", i = "_15k6ur96 _1y2v1nfhk _1y2v1nfhq", l = "_1y2v1nfi7", h = "_1y2v1nfa7 _1y2v1nfbj _1y2v1nfhk", t = "_1y2v1nfi5 _1y2v1nf7j", o = "_15k6ur91 _1y2v1nfhf _1y2v1nfhk _1y2v1nfhp", p = "_15k6ur93 _1y2v1nfkl _1y2v1nfi3", u = "_15k6ur9e _1y2v1nfhk", L = "_15k6ur99 _1y2v1nfi7", d = "_15k6ur94", E = "_15k6ur9g";
@@ -10,6 +10,6 @@ export declare const normalWidth: string;
10
10
  export declare const fullWidth: string;
11
11
  export declare const field: string;
12
12
  export declare const helperContainer: string;
13
+ export declare const leftHelperText: string;
13
14
  export declare const helperText: string;
14
- export declare const leftText: string;
15
- export declare const rightText: string;
15
+ export declare const warnIcon: string;