@telefonica/mistica 14.41.0 → 14.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/boxed.css-mistica.js +14 -5
  3. package/dist/boxed.css.d.ts +1 -0
  4. package/dist/boxed.d.ts +1 -0
  5. package/dist/boxed.js +11 -9
  6. package/dist/button-fixed-footer-layout.d.ts +1 -0
  7. package/dist/button-fixed-footer-layout.js +19 -14
  8. package/dist/button-layout.css-mistica.js +16 -13
  9. package/dist/button-layout.css.d.ts +1 -0
  10. package/dist/button-layout.js +15 -15
  11. package/dist/button.js +43 -35
  12. package/dist/carousel.d.ts +13 -0
  13. package/dist/carousel.js +325 -223
  14. package/dist/credit-card-expiration-field.js +30 -26
  15. package/dist/credit-card-number-field.css-mistica.js +7 -7
  16. package/dist/credit-card-number-field.js +59 -45
  17. package/dist/cvv-field.js +46 -41
  18. package/dist/date-field.css-mistica.js +14 -0
  19. package/dist/date-field.css.d.ts +1 -0
  20. package/dist/date-field.css.ts.vanilla.css-mistica.js +11 -0
  21. package/dist/date-field.js +41 -35
  22. package/dist/date-time-field.js +40 -34
  23. package/dist/date-time-picker.js +43 -45
  24. package/dist/decimal-field.js +26 -22
  25. package/dist/dialog-context.d.ts +24 -0
  26. package/dist/dialog-context.js +192 -0
  27. package/dist/dialog.css-mistica.js +15 -12
  28. package/dist/dialog.css.d.ts +1 -0
  29. package/dist/dialog.d.ts +14 -44
  30. package/dist/dialog.js +163 -246
  31. package/dist/double-field.css-mistica.js +3 -2
  32. package/dist/email-field.js +15 -11
  33. package/dist/feedback.css-mistica.js +23 -14
  34. package/dist/feedback.css.d.ts +7 -4
  35. package/dist/feedback.js +157 -143
  36. package/dist/fixed-footer-layout.css-mistica.js +1 -1
  37. package/dist/fixed-footer-layout.js +9 -8
  38. package/dist/iban-field.js +31 -27
  39. package/dist/icons/icon-amex.d.ts +1 -1
  40. package/dist/icons/icon-cvv-amex.d.ts +1 -1
  41. package/dist/icons/icon-cvv-visa-mc.d.ts +1 -1
  42. package/dist/icons/icon-mastercard.d.ts +1 -1
  43. package/dist/icons/icon-visa.d.ts +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.js +16 -4
  46. package/dist/inline.css-mistica.js +9 -6
  47. package/dist/inline.css.d.ts +1 -1
  48. package/dist/inline.js +9 -9
  49. package/dist/integer-field.js +17 -13
  50. package/dist/loading-bar.css-mistica.js +4 -7
  51. package/dist/loading-bar.css.d.ts +0 -2
  52. package/dist/loading-bar.js +3 -6
  53. package/dist/month-field.js +39 -33
  54. package/dist/package-version.js +1 -1
  55. package/dist/password-field.js +46 -44
  56. package/dist/phone-number-field.js +50 -46
  57. package/dist/pin-field.css-mistica.js +12 -6
  58. package/dist/pin-field.css.d.ts +2 -0
  59. package/dist/pin-field.d.ts +3 -1
  60. package/dist/pin-field.js +129 -95
  61. package/dist/responsive-layout.css-mistica.js +10 -7
  62. package/dist/responsive-layout.css.d.ts +2 -1
  63. package/dist/responsive-layout.d.ts +1 -1
  64. package/dist/responsive-layout.js +20 -17
  65. package/dist/search-field.js +36 -35
  66. package/dist/select.css-mistica.js +16 -15
  67. package/dist/select.css.d.ts +1 -0
  68. package/dist/select.js +138 -143
  69. package/dist/text-field-base.css-mistica.js +45 -21
  70. package/dist/text-field-base.css.d.ts +30 -7
  71. package/dist/text-field-base.d.ts +11 -0
  72. package/dist/text-field-base.js +175 -140
  73. package/dist/text-field-components.css-mistica.js +13 -21
  74. package/dist/text-field-components.css.d.ts +0 -3
  75. package/dist/text-field-components.d.ts +3 -0
  76. package/dist/text-field-components.js +38 -35
  77. package/dist/text-field.js +26 -22
  78. package/dist/text.css-mistica.js +7 -7
  79. package/dist/text.css.d.ts +0 -1
  80. package/dist/text.js +24 -24
  81. package/dist/theme-context-provider.js +2 -2
  82. package/dist/utils/platform.js +8 -11
  83. package/dist-es/boxed.css-mistica.js +3 -2
  84. package/dist-es/boxed.js +17 -15
  85. package/dist-es/button-fixed-footer-layout.js +29 -24
  86. package/dist-es/button-layout.css-mistica.js +7 -7
  87. package/dist-es/button-layout.js +23 -23
  88. package/dist-es/button.js +65 -57
  89. package/dist-es/carousel.js +373 -280
  90. package/dist-es/credit-card-expiration-field.js +34 -30
  91. package/dist-es/credit-card-number-field.css-mistica.js +4 -4
  92. package/dist-es/credit-card-number-field.js +84 -70
  93. package/dist-es/cvv-field.js +68 -63
  94. package/dist-es/date-field.css-mistica.js +5 -0
  95. package/dist-es/date-field.css.ts.vanilla.css-mistica.js +2 -0
  96. package/dist-es/date-field.js +46 -40
  97. package/dist-es/date-time-field.js +47 -41
  98. package/dist-es/date-time-picker.js +55 -57
  99. package/dist-es/decimal-field.js +31 -27
  100. package/dist-es/dialog-context.js +125 -0
  101. package/dist-es/dialog.css-mistica.js +3 -3
  102. package/dist-es/dialog.js +193 -262
  103. package/dist-es/double-field.css-mistica.js +3 -2
  104. package/dist-es/email-field.js +16 -12
  105. package/dist-es/feedback.css-mistica.js +2 -2
  106. package/dist-es/feedback.js +196 -182
  107. package/dist-es/fixed-footer-layout.css-mistica.js +1 -1
  108. package/dist-es/fixed-footer-layout.js +21 -20
  109. package/dist-es/iban-field.js +42 -38
  110. package/dist-es/index.js +1778 -1778
  111. package/dist-es/inline.css-mistica.js +3 -3
  112. package/dist-es/inline.js +18 -18
  113. package/dist-es/integer-field.js +21 -17
  114. package/dist-es/loading-bar.css-mistica.js +2 -2
  115. package/dist-es/loading-bar.js +10 -13
  116. package/dist-es/month-field.js +47 -41
  117. package/dist-es/package-version.js +1 -1
  118. package/dist-es/password-field.js +54 -52
  119. package/dist-es/phone-number-field.js +53 -49
  120. package/dist-es/pin-field.css-mistica.js +2 -2
  121. package/dist-es/pin-field.js +145 -111
  122. package/dist-es/responsive-layout.css-mistica.js +3 -3
  123. package/dist-es/responsive-layout.js +27 -24
  124. package/dist-es/search-field.js +45 -44
  125. package/dist-es/select.css-mistica.js +8 -7
  126. package/dist-es/select.js +167 -172
  127. package/dist-es/style.css +1 -1
  128. package/dist-es/text-field-base.css-mistica.js +2 -2
  129. package/dist-es/text-field-base.js +189 -157
  130. package/dist-es/text-field-components.css-mistica.js +3 -2
  131. package/dist-es/text-field-components.js +52 -49
  132. package/dist-es/text-field.js +31 -27
  133. package/dist-es/text.css-mistica.js +3 -3
  134. package/dist-es/text.js +32 -32
  135. package/dist-es/theme-context-provider.js +1 -1
  136. package/dist-es/utils/platform.js +6 -6
  137. package/package.json +1 -1
  138. package/dist/password-field.css-mistica.js +0 -13
  139. package/dist/password-field.css.d.ts +0 -1
  140. package/dist-es/password-field.css-mistica.js +0 -4
  141. /package/dist/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
  142. /package/dist-es/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
@@ -9,55 +9,79 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ emptyDateValue: function() {
13
+ return t;
14
+ },
12
15
  endIcon: function() {
13
- return n;
16
+ return v;
17
+ },
18
+ endIconContainer: function() {
19
+ return r;
20
+ },
21
+ endIconWithShadow: function() {
22
+ return y;
23
+ },
24
+ fieldElementsGap: function() {
25
+ return a;
26
+ },
27
+ fieldEndIconContainer: function() {
28
+ return f;
29
+ },
30
+ fieldLeftPadding: function() {
31
+ return i;
32
+ },
33
+ fieldRightPadding: function() {
34
+ return _;
14
35
  },
15
36
  fullWidth: function() {
16
- return t;
37
+ return h;
38
+ },
39
+ hiddenDatePlaceholder: function() {
40
+ return d;
41
+ },
42
+ iconButtonSize: function() {
43
+ return o;
44
+ },
45
+ iconSize: function() {
46
+ return l;
17
47
  },
18
48
  input: function() {
19
- return e;
49
+ return g;
20
50
  },
21
51
  inputFirefoxStyles: function() {
22
- return r;
52
+ return u;
23
53
  },
24
54
  inputWithLabel: function() {
25
- return f;
55
+ return c;
26
56
  },
27
57
  inputWithoutLabel: function() {
28
- return _;
58
+ return m;
29
59
  },
30
60
  menuItem: function() {
31
- return a;
61
+ return p;
32
62
  },
33
63
  menuItemSelected: function() {
34
- return h;
64
+ return x;
35
65
  },
36
66
  prefix: function() {
37
- return i;
38
- },
39
- prefixWithLabel: function() {
40
- return o;
41
- },
42
- prefixWithoutLabel: function() {
43
- return x;
67
+ return b;
44
68
  },
45
69
  startIcon: function() {
46
- return g;
70
+ return s;
47
71
  },
48
72
  suggestionsContainer: function() {
49
- return l;
73
+ return I;
50
74
  },
51
75
  textArea: function() {
52
- return u;
76
+ return W;
53
77
  },
54
78
  textAreaWithLabel: function() {
55
- return p;
79
+ return j;
56
80
  },
57
81
  textAreaWithoutLabel: function() {
58
- return b;
82
+ return L;
59
83
  }
60
84
  });
61
85
  require("./sprinkles.css.ts.vanilla.css-mistica.js");
62
86
  require("./text-field-base.css.ts.vanilla.css-mistica.js");
63
- var n = "rhey4tf _1y2v1nf92 _1y2v1nfah _1y2v1nfgi _1y2v1nfgx", t = "rhey4t4", e = "rhey4ta _1y2v1nfgc _1y2v1nfhm rhey4t1 _1y2v1nfj0 _1y2v1nfi3 _1y2v1nf22 _1y2v1nfh5", r = "rhey4tb", f = "rhey4tc", _ = "_1y2v1nf6q _1y2v1nf7z", a = "rhey4to _1y2v1nfhx _1y2v1nfgi _1y2v1nfgx _1y2v1nfji", h = "_1y2v1nf3k", i = "rhey4tj _1y2v1nf95 _1y2v1nfah", o = "rhey4tl _1y2v1nf7t", x = "_1y2v1nf6q _1y2v1nf7z", g = "rhey4th _1y2v1nf95 _1y2v1nfae _1y2v1nfgi _1y2v1nfgx _1y2v1nfhm _1y2v1nfgd", l = "rhey4tr _1y2v1nfgd", u = "rhey4t6 _1y2v1nf6b _1y2v1nf7k _1y2v1nf8t _1y2v1nfa2 rhey4t1 _1y2v1nfj0 _1y2v1nfi3 _1y2v1nf22 _1y2v1nfh5", p = "rhey4t7", b = "rhey4t8";
87
+ var t = "rhey4t8", v = "rhey4ts _1y2v1nf6b _1y2v1nf7k _1y2v1nf8t _1y2v1nfa2 _1y2v1nf6a", r = "rhey4th _1y2v1nf95 _1y2v1nfgi _1y2v1nfgx", y = "rhey4tu rhey4ts _1y2v1nf6b _1y2v1nf7k _1y2v1nf8t _1y2v1nfa2 _1y2v1nf6a _1y2v1nfj1", a = 12, f = "rhey4tv", i = 11, _ = 15, h = "rhey4t4", d = "rhey4t7", o = "2.500rem", l = "1.500rem", g = "rhey4ta _1y2v1nfgc rhey4t1 _1y2v1nfj0 _1y2v1nfi3 _1y2v1nf22 _1y2v1nfh5", u = "rhey4tb", c = "rhey4tc", m = "rhey4td", p = "rhey4tn _1y2v1nfgi _1y2v1nfgx _1y2v1nfji", x = "_1y2v1nf3k", b = "rhey4tl _1y2v1nfae", s = "rhey4tj _1y2v1nfae _1y2v1nfgi _1y2v1nfgx _1y2v1nfhm _1y2v1nfgd", I = "rhey4tq _1y2v1nfgd", W = "rhey4t6 _1y2v1nf6b _1y2v1nf7k rhey4t1 _1y2v1nfj0 _1y2v1nfi3 _1y2v1nf22 _1y2v1nfh5", j = "rhey4te", L = "rhey4tf";
@@ -1,19 +1,42 @@
1
- export declare const mobileFontSize = 16;
2
- export declare const desktopFontSize = 18;
1
+ export declare const fieldVerticalPadding: number;
2
+ export declare const fieldLeftPadding: number;
3
+ export declare const fieldRightPadding: number;
4
+ export declare const fieldElementsGap = 12;
5
+ export declare const iconSize: string;
6
+ export declare const iconButtonSize: string;
7
+ export declare const mobileFontSize: string;
8
+ export declare const desktopFontSize: string;
9
+ export declare const labelLineHeight: string;
10
+ export declare const inputLineHeight: string;
11
+ export declare const shrinkedLabelLineHeight: {
12
+ mobile: string;
13
+ desktop: string;
14
+ };
15
+ export declare const labelFontSize: {
16
+ mobile: string;
17
+ desktop: string;
18
+ };
3
19
  export declare const container: string;
4
20
  export declare const fullWidth: string;
5
21
  export declare const textArea: string;
6
- export declare const textAreaWithLabel: string;
7
- export declare const textAreaWithoutLabel: string;
22
+ export declare const hiddenDatePlaceholder: string;
23
+ export declare const emptyDateValue: string;
8
24
  export declare const input: string;
25
+ /**
26
+ * Firefox: hide value if not valid or focused
27
+ * Only apply when Firefox, otherwise it breaks styles in safari mobile
28
+ */
9
29
  export declare const inputFirefoxStyles: string;
10
30
  export declare const inputWithLabel: string;
11
31
  export declare const inputWithoutLabel: string;
12
- export declare const endIcon: string;
32
+ export declare const textAreaWithLabel: string;
33
+ export declare const textAreaWithoutLabel: string;
34
+ export declare const endIconContainer: string;
13
35
  export declare const startIcon: string;
14
36
  export declare const prefix: string;
15
- export declare const prefixWithLabel: string;
16
- export declare const prefixWithoutLabel: string;
17
37
  export declare const menuItem: string;
18
38
  export declare const menuItemSelected: string;
19
39
  export declare const suggestionsContainer: string;
40
+ export declare const endIcon: string;
41
+ export declare const endIconWithShadow: string;
42
+ export declare const fieldEndIconContainer: string;
@@ -1,5 +1,14 @@
1
1
  import * as React from 'react';
2
+ import type { DataAttributes, IconProps } from './utils/types';
2
3
  import type { FieldValidator } from './form-context';
4
+ interface FieldEndIconProps {
5
+ Icon: React.FC<IconProps>;
6
+ className?: string;
7
+ onPress: (event: React.MouseEvent<HTMLElement>) => void;
8
+ disabled?: boolean;
9
+ 'aria-label'?: string;
10
+ }
11
+ export declare const FieldEndIcon: React.FC<FieldEndIconProps>;
3
12
  /**
4
13
  * Incomplete list, add more if needed
5
14
  * https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
@@ -27,6 +36,7 @@ export interface CommonFormFieldProps<T = HTMLInputElement> {
27
36
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
28
37
  children?: void;
29
38
  readOnly?: boolean;
39
+ dataAttributes?: DataAttributes;
30
40
  }
31
41
  interface TextFieldBaseProps {
32
42
  id?: string;
@@ -71,6 +81,7 @@ interface TextFieldBaseProps {
71
81
  min?: string;
72
82
  max?: string;
73
83
  role?: string;
84
+ dataAttributes?: DataAttributes;
74
85
  }
75
86
  export declare const TextFieldBase: React.ForwardRefExoticComponent<TextFieldBaseProps & React.RefAttributes<any>>;
76
87
  export declare const TextFieldBaseAutosuggest: React.ForwardRefExoticComponent<TextFieldBaseProps & React.RefAttributes<any>>;
@@ -10,11 +10,14 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
+ FieldEndIcon: function() {
14
+ return Ue;
15
+ },
13
16
  TextFieldBase: function() {
14
- return W;
17
+ return F;
15
18
  },
16
19
  TextFieldBaseAutosuggest: function() {
17
- return De;
20
+ return Xe;
18
21
  }
19
22
  });
20
23
  const _jsxruntime = require("react/jsx-runtime");
@@ -27,8 +30,9 @@ const _hooks = require("./hooks.js");
27
30
  const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
28
31
  const _common = require("./utils/common.js");
29
32
  const _textfieldbasecssmistica = require("./text-field-base.css-mistica.js");
30
- const _sprinklescssmistica = require("./sprinkles.css-mistica.js");
31
33
  const _skincontractcssmistica = require("./skins/skin-contract.css-mistica.js");
34
+ const _iconbutton = require("./icon-button.js");
35
+ const _themevariantcontext = require("./theme-variant-context.js");
32
36
  function _interop_require_default(obj) {
33
37
  return obj && obj.__esModule ? obj : {
34
38
  default: obj
@@ -154,8 +158,31 @@ function _object_without_properties_loose(source, excluded) {
154
158
  }
155
159
  return target;
156
160
  }
157
- const W = /*#__PURE__*/ _react.forwardRef((_param, H)=>{
158
- var { error: c, helperText: T, label: n, inputProps: m, inputRef: y, defaultValue: o, value: t, onFocus: u, onBlur: S, inputComponent: g, prefix: h, startIcon: e, endIcon: a, endIconOverlay: L, shrinkLabel: B, multiline: x = !1, focus: C, fieldRef: j, maxLength: p, id: z, autoComplete: D, fullWidth: G } = _param, r = _object_without_properties(_param, [
161
+ const we = (l, u)=>{
162
+ if (!u) return !0;
163
+ const i = document.createElement("input");
164
+ return i.type = u, i.value = l || "", i.value !== "";
165
+ }, Ue = (param)=>{
166
+ let { Icon: l, className: u, onPress: i, disabled: h, "aria-label": m } = param;
167
+ return(/**
168
+ * If we try to add fieldEndIconContainer styles to the BaseIconButton instead,
169
+ * there may be collisions because that component sets margin internally. We
170
+ * create a wrapper around it so that the margin's value won't be overrided.
171
+ */ /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
172
+ className: _textfieldbasecssmistica.fieldEndIconContainer,
173
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_iconbutton.BaseIconButton, {
174
+ disabled: h,
175
+ "aria-label": m,
176
+ onPress: i,
177
+ size: _textfieldbasecssmistica.iconButtonSize,
178
+ className: u,
179
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(l, {
180
+ size: _textfieldbasecssmistica.iconSize
181
+ })
182
+ })
183
+ }));
184
+ }, F = /*#__PURE__*/ _react.forwardRef((_param, Z)=>{
185
+ var { error: l, helperText: u, label: i, inputProps: h, inputRef: m, defaultValue: s, value: r, onFocus: S, onBlur: x, inputComponent: g, prefix: y, startIcon: t, endIcon: f, endIconOverlay: p, shrinkLabel: P, multiline: L = !1, focus: b, fieldRef: J, maxLength: C, id: Q, autoComplete: U, fullWidth: X, dataAttributes: Y } = _param, a = _object_without_properties(_param, [
159
186
  "error",
160
187
  "helperText",
161
188
  "label",
@@ -177,182 +204,190 @@ const W = /*#__PURE__*/ _react.forwardRef((_param, H)=>{
177
204
  "maxLength",
178
205
  "id",
179
206
  "autoComplete",
180
- "fullWidth"
207
+ "fullWidth",
208
+ "dataAttributes"
181
209
  ]);
182
210
  var _ref;
183
- const N = (0, _hooks.useAriaId)(z), [f, d] = _react.useState(o != null && o.length || t != null && t.length ? "filled" : "default"), { isTabletOrSmaller: K } = (0, _hooks.useScreenSize)(), [M, O] = _react.useState((_ref = o == null ? void 0 : o.length) !== null && _ref !== void 0 ? _ref : 0), E = !!n || !r.required, w = B || (r.type === "date" || r.type === "datetime-local" || r.type === "month") && !r.required, [J, Q] = _react.useState("baseline");
211
+ const w = (0, _hooks.useAriaId)(Q), z = (0, _hooks.useAriaId)(), [d, c] = _react.useState(s != null && s.length || r != null && r.length ? "filled" : "default"), { isTabletOrSmaller: V } = (0, _hooks.useScreenSize)(), [B, D] = _react.useState((_ref = s == null ? void 0 : s.length) !== null && _ref !== void 0 ? _ref : 0), I = !!i || !a.required, E = a.type === "date" || a.type === "datetime-local" || a.type === "month", q = _react.useRef(void 0);
184
212
  (0, _hooks.useIsomorphicLayoutEffect)(()=>{
185
- (0, _platform.isSafari)() && Q("initial");
186
- }, []), _react.useEffect(()=>{
187
- f !== "focused" && t != null && t.length && (O(t.length), d("filled")), C && d("focused"), C === !1 && !(t != null && t.length) && d("default"), C === !1 && t != null && t.length && d("filled");
213
+ const e = E && !we(r, a.type) ? "" : r;
214
+ q.current !== r && E && !(e != null && e.length) && d === "filled" && b === void 0 && c("default"), q.current = r, d !== "focused" && e != null && e.length && (D(e.length), c("filled")), b && c("focused"), b === !1 && !(e != null && e.length) && c("default"), b === !1 && e != null && e.length && c("filled");
188
215
  }, [
189
- f,
190
- t,
191
- C
216
+ d,
217
+ r,
218
+ b,
219
+ E,
220
+ a.type
192
221
  ]), _react.useEffect(()=>{
193
- r.autoFocus && d("focused");
222
+ a.autoFocus && c("focused");
194
223
  }, [
195
- r.autoFocus
224
+ a.autoFocus
196
225
  ]);
197
- const U = x ? "textarea" : "input", X = g ? {
198
- inputRef: y
226
+ const ee = L ? "textarea" : "input", te = g ? {
227
+ inputRef: m
199
228
  } : {
200
- ref: (0, _common.combineRefs)(H, y)
201
- }, b = _object_spread(_object_spread_props(_object_spread({}, r), {
202
- maxLength: p,
203
- autoComplete: D
204
- }), m), P = w || f === "focused" || f === "filled", Y = P ? K ? _textfieldcomponentscssmistica.LABEL_SCALE_MOBILE : _textfieldcomponentscssmistica.LABEL_SCALE_DESKTOP : 1, Z = {
205
- left: e ? 48 : _textfieldcomponentscssmistica.LABEL_LEFT_POSITION,
229
+ ref: (0, _common.combineRefs)(Z, m)
230
+ }, R = _object_spread(_object_spread_props(_object_spread({}, a), {
231
+ maxLength: C,
232
+ autoComplete: U
233
+ }), h), v = `calc(${_textfieldbasecssmistica.iconSize} + ${_textfieldbasecssmistica.fieldElementsGap}px)`, O = `calc(${_textfieldbasecssmistica.iconButtonSize} + ${_textfieldbasecssmistica.fieldElementsGap}px)`, ie = P || d === "focused" || d === "filled" ? V ? _textfieldcomponentscssmistica.LABEL_SCALE_MOBILE : _textfieldcomponentscssmistica.LABEL_SCALE_DESKTOP : 1, ne = {
234
+ left: `calc(${_textfieldbasecssmistica.fieldLeftPadding}px + ${t ? v : "0px"})`,
206
235
  // shrinking means applying a scale transformation, so width will be proportionally reduced.
207
236
  // Let's keep the original width.
208
- width: `calc(((100% - ${_textfieldcomponentscssmistica.LABEL_LEFT_POSITION + (e ? 48 : _textfieldcomponentscssmistica.LABEL_LEFT_POSITION)}px)) / ${Y})`,
209
- paddingRight: a && !P ? 36 : 0
210
- }, k = (0, _sprinklescssmistica.sprinkles)({
211
- paddingRight: a ? 0 : 16,
212
- paddingLeft: h ? 0 : e ? 48 : 12
213
- }), $ = r.type === "password" ? "Lucida Grande, Arial, sans-serif" : "inherit";
214
- return /* @__PURE__ */ (0, _jsxruntime.jsxs)(_textfieldcomponents.FieldContainer, {
215
- disabled: r.disabled,
237
+ width: `calc((100% - ${_textfieldbasecssmistica.fieldLeftPadding}px - ${t ? v : "0px"} - ${f || p ? O : `${_textfieldbasecssmistica.fieldRightPadding}px`}) / ${ie})`
238
+ }, re = a.type === "password" && B > 0 ? "Lucida Grande, Arial, sans-serif" : "inherit";
239
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.FieldContainer, {
240
+ disabled: a.disabled,
216
241
  helperText: /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.HelperText, {
217
- error: c,
218
- leftText: T,
219
- rightText: x && p ? `${M}/${p}` : void 0
242
+ error: l,
243
+ leftText: u,
244
+ id: z,
245
+ rightText: L && C ? `${B}/${C}` : void 0
220
246
  }),
221
- multiline: x,
222
- fullWidth: G,
223
- fieldRef: j,
224
- readOnly: r.readOnly,
225
- children: [
226
- e && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
227
- className: _textfieldbasecssmistica.startIcon,
228
- children: e
229
- }),
230
- h && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
231
- className: (0, _classnames.default)(_textfieldbasecssmistica.prefix, E ? _textfieldbasecssmistica.prefixWithLabel : _textfieldbasecssmistica.prefixWithoutLabel),
232
- style: {
233
- opacity: f === "default" ? 0 : 1,
234
- alignSelf: J
235
- },
236
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
237
- color: _skincontractcssmistica.vars.colors.textSecondary,
238
- regular: !0,
239
- wordBreak: !1,
240
- children: h
241
- })
242
- }),
243
- /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
244
- className: _textfieldbasecssmistica.fullWidth,
245
- style: {
246
- alignSelf: h ? "baseline" : "initial"
247
- },
248
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
249
- as: "div",
250
- regular: !0,
251
- children: /*#__PURE__*/ _react.createElement(g || U, _object_spread(_object_spread_props(_object_spread({}, X, b), {
252
- id: N,
253
- style: _object_spread_props(_object_spread({}, b.style), {
254
- fontFamily: $
255
- }),
256
- className: x ? (0, _classnames.default)(_textfieldbasecssmistica.textArea, E ? _textfieldbasecssmistica.textAreaWithLabel : _textfieldbasecssmistica.textAreaWithoutLabel, k) : (0, _classnames.default)(_textfieldbasecssmistica.input, E ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel, k, {
257
- [_textfieldbasecssmistica.inputFirefoxStyles]: (0, _platform.isFirefox)()
258
- }),
259
- onFocus: (l)=>{
260
- d("focused"), u == null || u(l);
261
- },
262
- onBlur: (l)=>{
263
- l.target.value.length > 0 ? d("filled") : d("default"), S == null || S(l);
264
- },
265
- onChange: (l)=>{
266
- var _;
267
- p === void 0 || l.target.value.length <= p ? (O(l.target.value.length), l.target.value.length > 0 && f !== "focused" && d("filled"), (_ = b.onChange) == null || _.call(b, l)) : (l.stopPropagation(), l.preventDefault());
268
- },
269
- defaultValue: o,
270
- value: t
271
- }), c && {
272
- "aria-invalid": !0
273
- }))
274
- })
275
- }),
276
- n && /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.Label, {
277
- style: Z,
278
- error: c,
279
- forId: N,
280
- inputState: f,
281
- shrinkLabel: w,
282
- optional: !r.required,
283
- children: n
284
- }),
285
- a && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
286
- className: _textfieldbasecssmistica.endIcon,
287
- children: a
288
- }),
289
- L
290
- ]
247
+ multiline: L,
248
+ fullWidth: X,
249
+ fieldRef: J,
250
+ readOnly: a.readOnly,
251
+ dataAttributes: Y,
252
+ children: /* @__PURE__ */ (0, _jsxruntime.jsxs)(_themevariantcontext.ThemeVariant, {
253
+ isInverse: !1,
254
+ children: [
255
+ t && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
256
+ className: _textfieldbasecssmistica.startIcon,
257
+ children: t
258
+ }),
259
+ y && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
260
+ className: (0, _classnames.default)(_textfieldbasecssmistica.prefix, I ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel),
261
+ style: {
262
+ opacity: d === "default" ? 0 : 1
263
+ },
264
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
265
+ color: _skincontractcssmistica.vars.colors.textSecondary,
266
+ regular: !0,
267
+ wordBreak: !1,
268
+ children: y
269
+ })
270
+ }),
271
+ /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
272
+ className: _textfieldbasecssmistica.fullWidth,
273
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
274
+ as: "div",
275
+ regular: !0,
276
+ children: /*#__PURE__*/ _react.createElement(g || ee, _object_spread(_object_spread_props(_object_spread({}, te, R), {
277
+ id: w,
278
+ style: _object_spread_props(_object_spread({
279
+ paddingRight: f ? 0 : p ? `calc(${_textfieldbasecssmistica.fieldRightPadding}px + ${O})` : _textfieldbasecssmistica.fieldRightPadding,
280
+ paddingLeft: y ? 0 : t ? `calc(${v} + ${_textfieldbasecssmistica.fieldLeftPadding}px)` : _textfieldbasecssmistica.fieldLeftPadding
281
+ }, R.style), {
282
+ fontFamily: re
283
+ }),
284
+ className: L ? (0, _classnames.default)(_textfieldbasecssmistica.textArea, I ? _textfieldbasecssmistica.textAreaWithLabel : _textfieldbasecssmistica.textAreaWithoutLabel) : (0, _classnames.default)(_textfieldbasecssmistica.input, I ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel, {
285
+ [_textfieldbasecssmistica.inputFirefoxStyles]: (0, _platform.isFirefox)(),
286
+ // Hide webkit placeholder when label is not shrinked and value is empty
287
+ [_textfieldbasecssmistica.hiddenDatePlaceholder]: E && d === "default",
288
+ // Force height of input when value is empty to avoid field from having height 0 in iOS
289
+ [_textfieldbasecssmistica.emptyDateValue]: E && d !== "filled"
290
+ }),
291
+ onFocus: (e)=>{
292
+ c("focused"), S == null || S(e);
293
+ },
294
+ onBlur: (e)=>{
295
+ e.target.value.length > 0 ? c("filled") : c("default"), x == null || x(e);
296
+ },
297
+ onChange: (e)=>{
298
+ var _;
299
+ C === void 0 || e.target.value.length <= C ? (D(e.target.value.length), e.target.value.length > 0 && d !== "focused" && c(e.target.value.length > 0 ? "filled" : "default"), (_ = R.onChange) == null || _.call(R, e)) : (e.stopPropagation(), e.preventDefault());
300
+ },
301
+ defaultValue: s,
302
+ value: r
303
+ }), l && {
304
+ "aria-invalid": !0
305
+ }, u && {
306
+ "aria-describedby": z
307
+ }))
308
+ })
309
+ }),
310
+ i && /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.Label, {
311
+ style: ne,
312
+ error: l,
313
+ forId: w,
314
+ inputState: d,
315
+ shrinkLabel: P,
316
+ optional: !a.required,
317
+ children: i
318
+ }),
319
+ f && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
320
+ className: _textfieldbasecssmistica.endIconContainer,
321
+ children: f
322
+ }),
323
+ p
324
+ ]
325
+ })
291
326
  });
292
- }), Ie = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")))), De = /*#__PURE__*/ _react.forwardRef((_param, m)=>{
293
- var { getSuggestions: c, id: T } = _param, n = _object_without_properties(_param, [
327
+ }), ze = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")))), Xe = /*#__PURE__*/ _react.forwardRef((_param, h)=>{
328
+ var { getSuggestions: l, id: u } = _param, i = _object_without_properties(_param, [
294
329
  "getSuggestions",
295
330
  "id"
296
331
  ]);
297
- const [y, o] = _react.useState([]), t = _react.useRef(null), { platformOverrides: u, texts: S } = (0, _hooks.useTheme)(), g = (0, _hooks.useAriaId)(T), h = (0, _hooks.useAriaId)();
298
- if (c && (n.value === void 0 || n.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
299
- return c ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_react.Suspense, {
300
- fallback: /* @__PURE__ */ (0, _jsxruntime.jsx)(W, _object_spread_props(_object_spread({}, n), {
301
- label: (0, _platform.isRunningAcceptanceTest)(u) ? "" : n.label,
332
+ const [m, s] = _react.useState([]), r = _react.useRef(null), { platformOverrides: S, texts: x } = (0, _hooks.useTheme)(), g = (0, _hooks.useAriaId)(u), y = (0, _hooks.useAriaId)();
333
+ if (l && (i.value === void 0 || i.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
334
+ return l ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_react.Suspense, {
335
+ fallback: /* @__PURE__ */ (0, _jsxruntime.jsx)(F, _object_spread_props(_object_spread({}, i), {
336
+ label: (0, _platform.isRunningAcceptanceTest)(S) ? "" : i.label,
302
337
  autoComplete: "off",
303
- ref: m,
338
+ ref: h,
304
339
  id: g
305
340
  })),
306
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)(Ie, {
307
- id: h,
308
- inputProps: _object_spread_props(_object_spread({}, n), {
341
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(ze, {
342
+ id: y,
343
+ inputProps: _object_spread_props(_object_spread({}, i), {
309
344
  id: g,
310
345
  autoComplete: "off",
311
346
  // @ts-expect-error Autosuggest expects slightly different types
312
- onChange: (e, param)=>{
313
- let { newValue: a } = param;
314
- var L;
315
- e.target = _object_spread_props(_object_spread({}, e.target), {
316
- value: a
317
- }), e.currentTarget = _object_spread_props(_object_spread({}, e.currentTarget), {
318
- value: a
319
- }), (L = n.onChange) == null || L.call(n, e);
347
+ onChange: (t, param)=>{
348
+ let { newValue: f } = param;
349
+ var p;
350
+ t.target = _object_spread_props(_object_spread({}, t.target), {
351
+ value: f
352
+ }), t.currentTarget = _object_spread_props(_object_spread({}, t.currentTarget), {
353
+ value: f
354
+ }), (p = i.onChange) == null || p.call(i, t);
320
355
  }
321
356
  }),
322
- renderInputComponent: (e)=>/* @__PURE__ */ (0, _jsxruntime.jsx)(W, _object_spread_props(_object_spread({}, e), {
323
- inputRef: (0, _common.combineRefs)(t, n.inputRef, m)
357
+ renderInputComponent: (t)=>/* @__PURE__ */ (0, _jsxruntime.jsx)(F, _object_spread_props(_object_spread({}, t), {
358
+ inputRef: (0, _common.combineRefs)(r, i.inputRef, h)
324
359
  })),
325
- suggestions: y,
360
+ suggestions: m,
326
361
  onSuggestionsFetchRequested: (param)=>{
327
- let { value: e } = param;
328
- return o(c(e));
362
+ let { value: t } = param;
363
+ return s(l(t));
329
364
  },
330
- onSuggestionsClearRequested: ()=>o([]),
331
- getSuggestionValue: (e)=>e,
332
- renderSuggestion: (e, param)=>{
333
- let { isHighlighted: a } = param;
365
+ onSuggestionsClearRequested: ()=>s([]),
366
+ getSuggestionValue: (t)=>t,
367
+ renderSuggestion: (t, param)=>{
368
+ let { isHighlighted: f } = param;
334
369
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
335
370
  role: "menuitem",
336
371
  className: (0, _classnames.default)(_textfieldbasecssmistica.menuItem, {
337
- [_textfieldbasecssmistica.menuItemSelected]: a
372
+ [_textfieldbasecssmistica.menuItemSelected]: f
338
373
  }),
339
374
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
340
375
  regular: !0,
341
- children: e
376
+ children: t
342
377
  })
343
378
  });
344
379
  },
345
- renderSuggestionsContainer: (e)=>/* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({}, e.containerProps), {
380
+ renderSuggestionsContainer: (t)=>/* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({}, t.containerProps), {
346
381
  style: {
347
- width: t.current ? t.current.clientWidth + 2 : 0
382
+ width: r.current ? r.current.clientWidth + 2 : 0
348
383
  },
349
384
  className: _textfieldbasecssmistica.suggestionsContainer,
350
- "aria-label": `${n.label} ${S.menuLabelSuffix}`,
351
- children: e.children
385
+ "aria-label": `${i.label} ${x.menuLabelSuffix}`,
386
+ children: t.children
352
387
  }))
353
388
  })
354
- }) : /* @__PURE__ */ (0, _jsxruntime.jsx)(W, _object_spread_props(_object_spread({}, n), {
389
+ }) : /* @__PURE__ */ (0, _jsxruntime.jsx)(F, _object_spread_props(_object_spread({}, i), {
355
390
  id: g,
356
- ref: m
391
+ ref: h
357
392
  }));
358
393
  });