@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
@@ -78,20 +78,44 @@ function _object_without_properties_loose(source, excluded) {
78
78
  }
79
79
  return target;
80
80
  }
81
- import { jsxs as v, jsx as i } from "react/jsx-runtime";
82
- import * as s from "react";
83
- import { FieldContainer as V, HelperText as ee, Label as te } from "./text-field-components.js";
84
- import { LABEL_LEFT_POSITION as R, LABEL_SCALE_MOBILE as ie, LABEL_SCALE_DESKTOP as ne } from "./text-field-components.css-mistica.js";
85
- import { Text3 as I } from "./text.js";
86
- import { isSafari as re, isFirefox as se, isRunningAcceptanceTest as le } from "./utils/platform.js";
87
- import { useAriaId as F, useScreenSize as oe, useIsomorphicLayoutEffect as ae, useTheme as de } from "./hooks.js";
88
- import A from "classnames";
89
- import { combineRefs as q } from "./utils/common.js";
90
- import { startIcon as ce, prefix as fe, prefixWithLabel as ge, prefixWithoutLabel as he, fullWidth as me, textArea as ue, textAreaWithLabel as Se, textAreaWithoutLabel as pe, input as be, inputWithLabel as ye, inputWithoutLabel as Le, inputFirefoxStyles as xe, endIcon as Ce, menuItem as Ae, menuItemSelected as Te, suggestionsContainer as Ee } from "./text-field-base.css-mistica.js";
91
- import { sprinkles as Re } from "./sprinkles.css-mistica.js";
92
- import { vars as We } from "./skins/skin-contract.css-mistica.js";
93
- const W = /*#__PURE__*/ s.forwardRef((_param, H)=>{
94
- 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, [
81
+ import { jsx as n, jsxs as ae } from "react/jsx-runtime";
82
+ import * as o from "react";
83
+ import { FieldContainer as le, HelperText as oe, Label as se } from "./text-field-components.js";
84
+ import { LABEL_SCALE_MOBILE as de, LABEL_SCALE_DESKTOP as ce } from "./text-field-components.css-mistica.js";
85
+ import { Text3 as N } from "./text.js";
86
+ import { isFirefox as ue, isRunningAcceptanceTest as fe } from "./utils/platform.js";
87
+ import { useAriaId as A, useScreenSize as he, useIsomorphicLayoutEffect as me, useTheme as ge } from "./hooks.js";
88
+ import $ from "classnames";
89
+ import { combineRefs as H } from "./utils/common.js";
90
+ import { startIcon as pe, prefix as Se, inputWithLabel as k, inputWithoutLabel as j, fullWidth as xe, fieldRightPadding as W, fieldLeftPadding as T, textArea as ye, textAreaWithLabel as be, textAreaWithoutLabel as Ce, input as Ee, inputFirefoxStyles as Re, hiddenDatePlaceholder as Le, emptyDateValue as Te, endIconContainer as $e, menuItem as Ae, menuItemSelected as Ie, suggestionsContainer as ve, fieldEndIconContainer as We, iconButtonSize as K, iconSize as M, fieldElementsGap as G } from "./text-field-base.css-mistica.js";
91
+ import { vars as Fe } from "./skins/skin-contract.css-mistica.js";
92
+ import { BaseIconButton as Ne } from "./icon-button.js";
93
+ import { ThemeVariant as Pe } from "./theme-variant-context.js";
94
+ const we = (l, u)=>{
95
+ if (!u) return !0;
96
+ const i = document.createElement("input");
97
+ return i.type = u, i.value = l || "", i.value !== "";
98
+ }, Ue = (param)=>{
99
+ let { Icon: l, className: u, onPress: i, disabled: h, "aria-label": m } = param;
100
+ return(/**
101
+ * If we try to add fieldEndIconContainer styles to the BaseIconButton instead,
102
+ * there may be collisions because that component sets margin internally. We
103
+ * create a wrapper around it so that the margin's value won't be overrided.
104
+ */ /* @__PURE__ */ n("div", {
105
+ className: We,
106
+ children: /* @__PURE__ */ n(Ne, {
107
+ disabled: h,
108
+ "aria-label": m,
109
+ onPress: i,
110
+ size: K,
111
+ className: u,
112
+ children: /* @__PURE__ */ n(l, {
113
+ size: M
114
+ })
115
+ })
116
+ }));
117
+ }, F = /*#__PURE__*/ o.forwardRef((_param, Z)=>{
118
+ 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, [
95
119
  "error",
96
120
  "helperText",
97
121
  "label",
@@ -113,183 +137,191 @@ const W = /*#__PURE__*/ s.forwardRef((_param, H)=>{
113
137
  "maxLength",
114
138
  "id",
115
139
  "autoComplete",
116
- "fullWidth"
140
+ "fullWidth",
141
+ "dataAttributes"
117
142
  ]);
118
143
  var _ref;
119
- const N = F(z), [f, d] = s.useState(o != null && o.length || t != null && t.length ? "filled" : "default"), { isTabletOrSmaller: K } = oe(), [M, O] = s.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] = s.useState("baseline");
120
- ae(()=>{
121
- re() && Q("initial");
122
- }, []), s.useEffect(()=>{
123
- 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");
144
+ const w = A(Q), z = A(), [d, c] = o.useState(s != null && s.length || r != null && r.length ? "filled" : "default"), { isTabletOrSmaller: V } = he(), [B, D] = o.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 = o.useRef(void 0);
145
+ me(()=>{
146
+ const e = E && !we(r, a.type) ? "" : r;
147
+ 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");
124
148
  }, [
125
- f,
126
- t,
127
- C
128
- ]), s.useEffect(()=>{
129
- r.autoFocus && d("focused");
149
+ d,
150
+ r,
151
+ b,
152
+ E,
153
+ a.type
154
+ ]), o.useEffect(()=>{
155
+ a.autoFocus && c("focused");
130
156
  }, [
131
- r.autoFocus
157
+ a.autoFocus
132
158
  ]);
133
- const U = x ? "textarea" : "input", X = g ? {
134
- inputRef: y
159
+ const ee = L ? "textarea" : "input", te = g ? {
160
+ inputRef: m
135
161
  } : {
136
- ref: q(H, y)
137
- }, b = _object_spread(_object_spread_props(_object_spread({}, r), {
138
- maxLength: p,
139
- autoComplete: D
140
- }), m), P = w || f === "focused" || f === "filled", Y = P ? K ? ie : ne : 1, Z = {
141
- left: e ? 48 : R,
162
+ ref: H(Z, m)
163
+ }, R = _object_spread(_object_spread_props(_object_spread({}, a), {
164
+ maxLength: C,
165
+ autoComplete: U
166
+ }), h), v = `calc(${M} + ${G}px)`, O = `calc(${K} + ${G}px)`, ie = P || d === "focused" || d === "filled" ? V ? de : ce : 1, ne = {
167
+ left: `calc(${T}px + ${t ? v : "0px"})`,
142
168
  // shrinking means applying a scale transformation, so width will be proportionally reduced.
143
169
  // Let's keep the original width.
144
- width: `calc(((100% - ${R + (e ? 48 : R)}px)) / ${Y})`,
145
- paddingRight: a && !P ? 36 : 0
146
- }, k = Re({
147
- paddingRight: a ? 0 : 16,
148
- paddingLeft: h ? 0 : e ? 48 : 12
149
- }), $ = r.type === "password" ? "Lucida Grande, Arial, sans-serif" : "inherit";
150
- return /* @__PURE__ */ v(V, {
151
- disabled: r.disabled,
152
- helperText: /* @__PURE__ */ i(ee, {
153
- error: c,
154
- leftText: T,
155
- rightText: x && p ? `${M}/${p}` : void 0
170
+ width: `calc((100% - ${T}px - ${t ? v : "0px"} - ${f || p ? O : `${W}px`}) / ${ie})`
171
+ }, re = a.type === "password" && B > 0 ? "Lucida Grande, Arial, sans-serif" : "inherit";
172
+ return /* @__PURE__ */ n(le, {
173
+ disabled: a.disabled,
174
+ helperText: /* @__PURE__ */ n(oe, {
175
+ error: l,
176
+ leftText: u,
177
+ id: z,
178
+ rightText: L && C ? `${B}/${C}` : void 0
156
179
  }),
157
- multiline: x,
158
- fullWidth: G,
159
- fieldRef: j,
160
- readOnly: r.readOnly,
161
- children: [
162
- e && /* @__PURE__ */ i("div", {
163
- className: ce,
164
- children: e
165
- }),
166
- h && /* @__PURE__ */ i("div", {
167
- className: A(fe, E ? ge : he),
168
- style: {
169
- opacity: f === "default" ? 0 : 1,
170
- alignSelf: J
171
- },
172
- children: /* @__PURE__ */ i(I, {
173
- color: We.colors.textSecondary,
174
- regular: !0,
175
- wordBreak: !1,
176
- children: h
177
- })
178
- }),
179
- /* @__PURE__ */ i("div", {
180
- className: me,
181
- style: {
182
- alignSelf: h ? "baseline" : "initial"
183
- },
184
- children: /* @__PURE__ */ i(I, {
185
- as: "div",
186
- regular: !0,
187
- children: /*#__PURE__*/ s.createElement(g || U, _object_spread(_object_spread_props(_object_spread({}, X, b), {
188
- id: N,
189
- style: _object_spread_props(_object_spread({}, b.style), {
190
- fontFamily: $
191
- }),
192
- className: x ? A(ue, E ? Se : pe, k) : A(be, E ? ye : Le, k, {
193
- [xe]: se()
194
- }),
195
- onFocus: (l)=>{
196
- d("focused"), u == null || u(l);
197
- },
198
- onBlur: (l)=>{
199
- l.target.value.length > 0 ? d("filled") : d("default"), S == null || S(l);
200
- },
201
- onChange: (l)=>{
202
- var _;
203
- 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());
204
- },
205
- defaultValue: o,
206
- value: t
207
- }), c && {
208
- "aria-invalid": !0
209
- }))
210
- })
211
- }),
212
- n && /* @__PURE__ */ i(te, {
213
- style: Z,
214
- error: c,
215
- forId: N,
216
- inputState: f,
217
- shrinkLabel: w,
218
- optional: !r.required,
219
- children: n
220
- }),
221
- a && /* @__PURE__ */ i("div", {
222
- className: Ce,
223
- children: a
224
- }),
225
- L
226
- ]
180
+ multiline: L,
181
+ fullWidth: X,
182
+ fieldRef: J,
183
+ readOnly: a.readOnly,
184
+ dataAttributes: Y,
185
+ children: /* @__PURE__ */ ae(Pe, {
186
+ isInverse: !1,
187
+ children: [
188
+ t && /* @__PURE__ */ n("div", {
189
+ className: pe,
190
+ children: t
191
+ }),
192
+ y && /* @__PURE__ */ n("div", {
193
+ className: $(Se, I ? k : j),
194
+ style: {
195
+ opacity: d === "default" ? 0 : 1
196
+ },
197
+ children: /* @__PURE__ */ n(N, {
198
+ color: Fe.colors.textSecondary,
199
+ regular: !0,
200
+ wordBreak: !1,
201
+ children: y
202
+ })
203
+ }),
204
+ /* @__PURE__ */ n("div", {
205
+ className: xe,
206
+ children: /* @__PURE__ */ n(N, {
207
+ as: "div",
208
+ regular: !0,
209
+ children: /*#__PURE__*/ o.createElement(g || ee, _object_spread(_object_spread_props(_object_spread({}, te, R), {
210
+ id: w,
211
+ style: _object_spread_props(_object_spread({
212
+ paddingRight: f ? 0 : p ? `calc(${W}px + ${O})` : W,
213
+ paddingLeft: y ? 0 : t ? `calc(${v} + ${T}px)` : T
214
+ }, R.style), {
215
+ fontFamily: re
216
+ }),
217
+ className: L ? $(ye, I ? be : Ce) : $(Ee, I ? k : j, {
218
+ [Re]: ue(),
219
+ // Hide webkit placeholder when label is not shrinked and value is empty
220
+ [Le]: E && d === "default",
221
+ // Force height of input when value is empty to avoid field from having height 0 in iOS
222
+ [Te]: E && d !== "filled"
223
+ }),
224
+ onFocus: (e)=>{
225
+ c("focused"), S == null || S(e);
226
+ },
227
+ onBlur: (e)=>{
228
+ e.target.value.length > 0 ? c("filled") : c("default"), x == null || x(e);
229
+ },
230
+ onChange: (e)=>{
231
+ var _;
232
+ 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());
233
+ },
234
+ defaultValue: s,
235
+ value: r
236
+ }), l && {
237
+ "aria-invalid": !0
238
+ }, u && {
239
+ "aria-describedby": z
240
+ }))
241
+ })
242
+ }),
243
+ i && /* @__PURE__ */ n(se, {
244
+ style: ne,
245
+ error: l,
246
+ forId: w,
247
+ inputState: d,
248
+ shrinkLabel: P,
249
+ optional: !a.required,
250
+ children: i
251
+ }),
252
+ f && /* @__PURE__ */ n("div", {
253
+ className: $e,
254
+ children: f
255
+ }),
256
+ p
257
+ ]
258
+ })
227
259
  });
228
- }), Ie = /*#__PURE__*/ s.lazy(()=>import(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")), De = /*#__PURE__*/ s.forwardRef((_param, m)=>{
229
- var { getSuggestions: c, id: T } = _param, n = _object_without_properties(_param, [
260
+ }), ze = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")), Xe = /*#__PURE__*/ o.forwardRef((_param, h)=>{
261
+ var { getSuggestions: l, id: u } = _param, i = _object_without_properties(_param, [
230
262
  "getSuggestions",
231
263
  "id"
232
264
  ]);
233
- const [y, o] = s.useState([]), t = s.useRef(null), { platformOverrides: u, texts: S } = de(), g = F(T), h = F();
234
- if (c && (n.value === void 0 || n.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
235
- return c ? /* @__PURE__ */ i(s.Suspense, {
236
- fallback: /* @__PURE__ */ i(W, _object_spread_props(_object_spread({}, n), {
237
- label: le(u) ? "" : n.label,
265
+ const [m, s] = o.useState([]), r = o.useRef(null), { platformOverrides: S, texts: x } = ge(), g = A(u), y = A();
266
+ if (l && (i.value === void 0 || i.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
267
+ return l ? /* @__PURE__ */ n(o.Suspense, {
268
+ fallback: /* @__PURE__ */ n(F, _object_spread_props(_object_spread({}, i), {
269
+ label: fe(S) ? "" : i.label,
238
270
  autoComplete: "off",
239
- ref: m,
271
+ ref: h,
240
272
  id: g
241
273
  })),
242
- children: /* @__PURE__ */ i(Ie, {
243
- id: h,
244
- inputProps: _object_spread_props(_object_spread({}, n), {
274
+ children: /* @__PURE__ */ n(ze, {
275
+ id: y,
276
+ inputProps: _object_spread_props(_object_spread({}, i), {
245
277
  id: g,
246
278
  autoComplete: "off",
247
279
  // @ts-expect-error Autosuggest expects slightly different types
248
- onChange: (e, param)=>{
249
- let { newValue: a } = param;
250
- var L;
251
- e.target = _object_spread_props(_object_spread({}, e.target), {
252
- value: a
253
- }), e.currentTarget = _object_spread_props(_object_spread({}, e.currentTarget), {
254
- value: a
255
- }), (L = n.onChange) == null || L.call(n, e);
280
+ onChange: (t, param)=>{
281
+ let { newValue: f } = param;
282
+ var p;
283
+ t.target = _object_spread_props(_object_spread({}, t.target), {
284
+ value: f
285
+ }), t.currentTarget = _object_spread_props(_object_spread({}, t.currentTarget), {
286
+ value: f
287
+ }), (p = i.onChange) == null || p.call(i, t);
256
288
  }
257
289
  }),
258
- renderInputComponent: (e)=>/* @__PURE__ */ i(W, _object_spread_props(_object_spread({}, e), {
259
- inputRef: q(t, n.inputRef, m)
290
+ renderInputComponent: (t)=>/* @__PURE__ */ n(F, _object_spread_props(_object_spread({}, t), {
291
+ inputRef: H(r, i.inputRef, h)
260
292
  })),
261
- suggestions: y,
293
+ suggestions: m,
262
294
  onSuggestionsFetchRequested: (param)=>{
263
- let { value: e } = param;
264
- return o(c(e));
295
+ let { value: t } = param;
296
+ return s(l(t));
265
297
  },
266
- onSuggestionsClearRequested: ()=>o([]),
267
- getSuggestionValue: (e)=>e,
268
- renderSuggestion: (e, param)=>{
269
- let { isHighlighted: a } = param;
270
- return /* @__PURE__ */ i("div", {
298
+ onSuggestionsClearRequested: ()=>s([]),
299
+ getSuggestionValue: (t)=>t,
300
+ renderSuggestion: (t, param)=>{
301
+ let { isHighlighted: f } = param;
302
+ return /* @__PURE__ */ n("div", {
271
303
  role: "menuitem",
272
- className: A(Ae, {
273
- [Te]: a
304
+ className: $(Ae, {
305
+ [Ie]: f
274
306
  }),
275
- children: /* @__PURE__ */ i(I, {
307
+ children: /* @__PURE__ */ n(N, {
276
308
  regular: !0,
277
- children: e
309
+ children: t
278
310
  })
279
311
  });
280
312
  },
281
- renderSuggestionsContainer: (e)=>/* @__PURE__ */ i("div", _object_spread_props(_object_spread({}, e.containerProps), {
313
+ renderSuggestionsContainer: (t)=>/* @__PURE__ */ n("div", _object_spread_props(_object_spread({}, t.containerProps), {
282
314
  style: {
283
- width: t.current ? t.current.clientWidth + 2 : 0
315
+ width: r.current ? r.current.clientWidth + 2 : 0
284
316
  },
285
- className: Ee,
286
- "aria-label": `${n.label} ${S.menuLabelSuffix}`,
287
- children: e.children
317
+ className: ve,
318
+ "aria-label": `${i.label} ${x.menuLabelSuffix}`,
319
+ children: t.children
288
320
  }))
289
321
  })
290
- }) : /* @__PURE__ */ i(W, _object_spread_props(_object_spread({}, n), {
322
+ }) : /* @__PURE__ */ n(F, _object_spread_props(_object_spread({}, i), {
291
323
  id: g,
292
- ref: m
324
+ ref: h
293
325
  }));
294
326
  });
295
- export { W as TextFieldBase, De as TextFieldBaseAutosuggest };
327
+ export { Ue as FieldEndIcon, F as TextFieldBase, Xe as TextFieldBaseAutosuggest };
@@ -1,4 +1,5 @@
1
1
  import "./sprinkles.css.ts.vanilla.css-mistica.js";
2
+ import "./text-field-base.css.ts.vanilla.css-mistica.js";
2
3
  import "./text-field-components.css.ts.vanilla.css-mistica.js";
3
- var _ = 328, n = 12, f = 0.78, a = 0.75, e = "_15k6ur97", i = "_1y2v1nfjj _1y2v1nfiz _1y2v1nfgi _1y2v1nfj8 _1y2v1nfgc", y = "_15k6ur96 _1y2v1nfgi _1y2v1nfgo", l = "_15k6ur9e", t = "_15k6ur9d _1y2v1nfhy", u = "_1y2v1nfh5", h = "_1y2v1nf95 _1y2v1nfah _1y2v1nfgi", k = "_15k6ur9g", d = "_15k6ur91 _1y2v1nfgd _1y2v1nfjp _1y2v1nfhu _1y2v1nfgi _1y2v1nfgn _1y2v1nfk8", g = "_15k6ur93 _1y2v1nfjj _1y2v1nfh1", L = "_15k6ur9h", E = "_15k6ur99 _1y2v1nfh5", T = "_15k6ur9i", o = "_15k6ur94";
4
- export { _ as DEFAULT_WIDTH, n as LABEL_LEFT_POSITION, f as LABEL_SCALE_DESKTOP, a as LABEL_SCALE_MOBILE, e as disabled, i as field, y as fieldContainer, l as fieldMulti, t as fieldSingle, u as fullWidth, h as helperContainer, k as helperText, d as labelContainer, g as labelText, L as leftText, E as normalWidth, T as rightText, o as shrinked };
4
+ var n = 328, a = 0.78, f = 0.75, e = "_15k6ur97", i = "_1y2v1nfjj _1y2v1nfiz _1y2v1nfgi _1y2v1nfj8 _1y2v1nfgc", y = "_15k6ur96 _1y2v1nfgi _1y2v1nfgo", t = "_1y2v1nfh5", l = "_1y2v1nf95 _1y2v1nfah _1y2v1nfgi", h = "_15k6ur9d", k = "_15k6ur91 _1y2v1nfgd _1y2v1nfgi _1y2v1nfgn", u = "_15k6ur93 _1y2v1nfjj _1y2v1nfh1", d = "_15k6ur9e", g = "_15k6ur99 _1y2v1nfh5", o = "_15k6ur9f", L = "_15k6ur94";
5
+ export { n as DEFAULT_WIDTH, a as LABEL_SCALE_DESKTOP, f as LABEL_SCALE_MOBILE, e as disabled, i as field, y as fieldContainer, t as fullWidth, l as helperContainer, h as helperText, k as labelContainer, u as labelText, d as leftText, g as normalWidth, o as rightText, L as shrinked };
@@ -51,100 +51,103 @@ function _object_spread_props(target, source) {
51
51
  }
52
52
  return target;
53
53
  }
54
- import { jsxs as d, jsx as s, Fragment as y } from "react/jsx-runtime";
55
- import * as p from "react";
56
- import a from "classnames";
54
+ import { jsxs as m, jsx as o, Fragment as y } from "react/jsx-runtime";
55
+ import * as x from "react";
56
+ import c from "classnames";
57
57
  import { useIsInverseVariant as N } from "./theme-variant-context.js";
58
58
  import { useTheme as C } from "./hooks.js";
59
- import { Text1 as x } from "./text.js";
60
- import { labelContainer as S, shrinked as k, labelText as I, helperText as v, leftText as F, rightText as E, fieldContainer as L, fullWidth as W, normalWidth as j, disabled as w, field as O, fieldMulti as P, fieldSingle as V, helperContainer as q } from "./text-field-components.css-mistica.js";
59
+ import { Text1 as v } from "./text.js";
60
+ import { labelContainer as k, shrinked as S, labelText as I, helperText as b, leftText as F, rightText as E, fieldContainer as L, fullWidth as P, normalWidth as W, disabled as j, field as w, helperContainer as A } from "./text-field-components.css-mistica.js";
61
61
  import { sprinkles as T } from "./sprinkles.css-mistica.js";
62
62
  import { vars as e } from "./skins/skin-contract.css-mistica.js";
63
- const G = (param)=>{
64
- let { shrinkLabel: o, forId: l, inputState: r, error: t, children: i, style: n, optional: m } = param;
65
- const f = o || r === "focused" || r === "filled", [u, c] = p.useState("initial"), { texts: b } = C();
66
- p.useEffect(()=>{
63
+ import { getPrefixedDataAttributes as D } from "./utils/dom.js";
64
+ const J = (param)=>{
65
+ let { shrinkLabel: t, forId: s, inputState: r, error: l, children: i, style: n, optional: a } = param;
66
+ const f = t || r === "focused" || r === "filled", [u, h] = x.useState("initial"), { texts: d } = C();
67
+ x.useEffect(()=>{
67
68
  const g = setTimeout(()=>{
68
- process.env.NODE_ENV !== "test" && c("transform 150ms, width 150ms");
69
+ process.env.NODE_ENV !== "test" && h("transform 150ms, width 150ms");
69
70
  });
70
71
  return ()=>{
71
72
  clearTimeout(g);
72
73
  };
73
74
  }, []);
74
- let h = e.colors.textSecondary;
75
- return t && r !== "default" ? h = e.colors.error : r === "focused" && (h = e.colors.controlActivated), /* @__PURE__ */ d("label", {
76
- className: a(S, {
77
- [k]: f
75
+ let p = e.colors.textSecondary;
76
+ return l && r !== "default" ? p = e.colors.error : r === "focused" && (p = e.colors.controlActivated), /* @__PURE__ */ m("label", {
77
+ className: c(k, {
78
+ [S]: f
78
79
  }, T({
79
- color: h
80
+ color: p
80
81
  })),
81
- htmlFor: l,
82
+ htmlFor: s,
82
83
  style: _object_spread_props(_object_spread({}, n), {
83
84
  transition: u
84
85
  }),
85
86
  children: [
86
- /* @__PURE__ */ s("span", {
87
+ /* @__PURE__ */ o("span", {
87
88
  className: I,
88
89
  children: i
89
90
  }),
90
- m ? /* @__PURE__ */ d("span", {
91
+ a ? /* @__PURE__ */ m("span", {
91
92
  children: [
92
93
  "\xa0(",
93
- b.formFieldOptionalLabelSuffix,
94
+ d.formFieldOptionalLabelSuffix,
94
95
  ")"
95
96
  ]
96
97
  }) : null
97
98
  ]
98
99
  });
99
- }, J = (param)=>{
100
- let { leftText: o, rightText: l, error: r } = param;
101
- const t = N(), i = t ? e.colors.textPrimaryInverse : r ? e.colors.error : e.colors.textSecondary, n = t ? e.colors.textPrimaryInverse : e.colors.textSecondary;
102
- return /* @__PURE__ */ d(y, {
100
+ }, K = (param)=>{
101
+ let { leftText: t, rightText: s, error: r, id: l } = param;
102
+ const i = N(), n = i ? e.colors.textPrimaryInverse : r ? e.colors.error : e.colors.textSecondary, a = i ? e.colors.textPrimaryInverse : e.colors.textSecondary;
103
+ return /* @__PURE__ */ m(y, {
103
104
  children: [
104
- o && /* @__PURE__ */ s("div", {
105
- className: a(v, F),
106
- children: /* @__PURE__ */ s(x, {
107
- color: i,
105
+ t && /* @__PURE__ */ o("div", {
106
+ className: c(b, F),
107
+ children: /* @__PURE__ */ o(v, {
108
+ color: n,
108
109
  regular: !0,
109
110
  as: "p",
110
- children: o
111
+ id: l,
112
+ children: t
111
113
  })
112
114
  }),
113
- l && /* @__PURE__ */ s("div", {
114
- className: a(v, E),
115
- children: /* @__PURE__ */ s(x, {
116
- color: n,
115
+ s && /* @__PURE__ */ o("div", {
116
+ className: c(b, E),
117
+ children: /* @__PURE__ */ o(v, {
118
+ color: a,
117
119
  regular: !0,
118
120
  as: "p",
119
- children: l
121
+ children: s
120
122
  })
121
123
  })
122
124
  ]
123
125
  });
124
- }, K = (param)=>{
125
- let { multiline: o, disabled: l, children: r, helperText: t, className: i, fieldRef: n, fullWidth: m, readOnly: f } = param;
126
+ }, M = (param)=>{
127
+ let { multiline: t, disabled: s, children: r, helperText: l, className: i, fieldRef: n, fullWidth: a, readOnly: f, dataAttributes: u } = param;
126
128
  return(// eslint-disable-next-line jsx-a11y/no-static-element-interactions
127
- /* @__PURE__ */ d("div", {
128
- className: a(L, m ? W : j, {
129
- [w]: l
129
+ /* @__PURE__ */ m("div", _object_spread_props(_object_spread({
130
+ className: c(L, a ? P : W, {
131
+ [j]: s
130
132
  }),
131
- onClick: (u)=>{
132
- var c;
133
- o && ((c = u.currentTarget.querySelector("textarea")) == null || c.focus());
134
- },
133
+ onClick: (h)=>{
134
+ var d;
135
+ (d = h.currentTarget.querySelector(t ? "textarea" : "input")) == null || d.focus();
136
+ }
137
+ }, D(u)), {
135
138
  children: [
136
- /* @__PURE__ */ s("div", {
137
- className: a(O, o ? P : V, T({
139
+ /* @__PURE__ */ o("div", {
140
+ className: c(w, T({
138
141
  background: f ? e.colors.neutralLow : e.colors.backgroundContainer
139
142
  }), i),
140
143
  ref: n,
141
144
  children: r
142
145
  }),
143
- t && /* @__PURE__ */ s("div", {
144
- className: q,
145
- children: t
146
+ l && /* @__PURE__ */ o("div", {
147
+ className: A,
148
+ children: l
146
149
  })
147
150
  ]
148
- }));
151
+ })));
149
152
  };
150
- export { K as FieldContainer, J as HelperText, G as Label };
153
+ export { M as FieldContainer, K as HelperText, J as Label };