@telefonica/mistica 14.32.0 → 14.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,20 +77,20 @@ function _object_without_properties_loose(source, excluded) {
77
77
  }
78
78
  return target;
79
79
  }
80
- import { jsxs as te, jsx as i } from "react/jsx-runtime";
80
+ import { jsxs as v, jsx as i } from "react/jsx-runtime";
81
81
  import * as s from "react";
82
- import { FieldContainer as ie, HelperText as ne, Label as re } from "./text-field-components.js";
83
- import { LABEL_LEFT_POSITION as R, LABEL_SCALE_MOBILE as se, LABEL_SCALE_DESKTOP as le } from "./text-field-components.css-mistica.js";
82
+ import { FieldContainer as V, HelperText as ee, Label as te } from "./text-field-components.js";
83
+ import { LABEL_LEFT_POSITION as R, LABEL_SCALE_MOBILE as ie, LABEL_SCALE_DESKTOP as ne } from "./text-field-components.css-mistica.js";
84
84
  import { Text3 as I } from "./text.js";
85
- import { isSafari as oe, isRunningAcceptanceTest as q, isFirefox as ae } from "./utils/platform.js";
86
- import { useAriaId as O, useScreenSize as de, useTheme as B, useIsomorphicLayoutEffect as ce } from "./hooks.js";
85
+ import { isSafari as re, isFirefox as se, isRunningAcceptanceTest as le } from "./utils/platform.js";
86
+ import { useAriaId as F, useScreenSize as oe, useIsomorphicLayoutEffect as ae, useTheme as de } from "./hooks.js";
87
87
  import A from "classnames";
88
- import { combineRefs as j } from "./utils/common.js";
89
- import { startIcon as fe, prefix as he, prefixWithLabel as ge, prefixWithoutLabel as me, fullWidth as ue, textArea as Se, textAreaWithLabel as pe, textAreaWithoutLabel as be, input as ye, inputWithLabel as Le, inputWithoutLabel as xe, inputFirefoxStyles as Ce, endIcon as Ae, menuItem as Te, menuItemSelected as Ee, suggestionsContainer as Re } from "./text-field-base.css-mistica.js";
90
- import { sprinkles as We } from "./sprinkles.css-mistica.js";
91
- import { vars as Ie } from "./skins/skin-contract.css-mistica.js";
92
- const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
93
- var { error: c , helperText: T , label: n , inputProps: m , inputRef: y , defaultValue: o , value: t , onFocus: u , onBlur: S , inputComponent: h , prefix: g , startIcon: e , endIcon: a , endIconOverlay: L , shrinkLabel: z , multiline: x = !1 , focus: C , fieldRef: D , maxLength: p , id: G , autoComplete: H , fullWidth: K } = _param, r = _object_without_properties(_param, [
88
+ import { combineRefs as q } from "./utils/common.js";
89
+ 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";
90
+ import { sprinkles as Re } from "./sprinkles.css-mistica.js";
91
+ import { vars as We } from "./skins/skin-contract.css-mistica.js";
92
+ const W = /*#__PURE__*/ s.forwardRef((_param, H)=>{
93
+ 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, [
94
94
  "error",
95
95
  "helperText",
96
96
  "label",
@@ -115,11 +115,11 @@ const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
115
115
  "fullWidth"
116
116
  ]);
117
117
  var _ref;
118
- const F = O(G), [f, d] = s.useState(o != null && o.length || t != null && t.length ? "filled" : "default"), { isTabletOrSmaller: J } = de(), [Q, N] = s.useState((_ref = o == null ? void 0 : o.length) !== null && _ref !== void 0 ? _ref : 0), E = !!n || !r.required, U = B(), w = z || (r.type === "date" || r.type === "datetime-local" || r.type === "month") && !r.required, [X, Y] = s.useState("baseline");
119
- ce(()=>{
120
- oe() && Y("initial");
118
+ 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");
119
+ ae(()=>{
120
+ re() && Q("initial");
121
121
  }, []), s.useEffect(()=>{
122
- f !== "focused" && t != null && t.length && (N(t.length), d("filled")), C && d("focused"), C === !1 && !(t != null && t.length) && d("default"), C === !1 && t != null && t.length && d("filled");
122
+ 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");
123
123
  }, [
124
124
  f,
125
125
  t,
@@ -129,67 +129,67 @@ const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
129
129
  }, [
130
130
  r.autoFocus
131
131
  ]);
132
- const Z = x ? "textarea" : "input", $ = h ? {
132
+ const U = x ? "textarea" : "input", X = g ? {
133
133
  inputRef: y
134
134
  } : {
135
- ref: j(M, y)
135
+ ref: q(H, y)
136
136
  }, b = _object_spread(_object_spread_props(_object_spread({}, r), {
137
137
  maxLength: p,
138
- autoComplete: H
139
- }), m), P = w || f === "focused" || f === "filled", v = P ? J ? se : le : 1, V = {
138
+ autoComplete: D
139
+ }), m), P = w || f === "focused" || f === "filled", Y = P ? K ? ie : ne : 1, Z = {
140
140
  left: e ? 48 : R,
141
141
  // shrinking means applying a scale transformation, so width will be proportionally reduced.
142
142
  // Let's keep the original width.
143
- width: `calc(((100% - ${R + (e ? 48 : R)}px)) / ${v})`,
143
+ width: `calc(((100% - ${R + (e ? 48 : R)}px)) / ${Y})`,
144
144
  paddingRight: a && !P ? 36 : 0
145
- }, k = We({
145
+ }, k = Re({
146
146
  paddingRight: a ? 0 : 16,
147
- paddingLeft: g ? 0 : e ? 48 : 12
148
- }), ee = r.type === "password" && !q(U.platformOverrides) ? "Lucida Grande, Arial, sans-serif" : "inherit";
149
- return /* @__PURE__ */ te(ie, {
147
+ paddingLeft: h ? 0 : e ? 48 : 12
148
+ }), $ = r.type === "password" ? "Lucida Grande, Arial, sans-serif" : "inherit";
149
+ return /* @__PURE__ */ v(V, {
150
150
  disabled: r.disabled,
151
- helperText: /* @__PURE__ */ i(ne, {
151
+ helperText: /* @__PURE__ */ i(ee, {
152
152
  error: c,
153
153
  leftText: T,
154
- rightText: x && p ? `${Q}/${p}` : void 0
154
+ rightText: x && p ? `${M}/${p}` : void 0
155
155
  }),
156
156
  multiline: x,
157
- fullWidth: K,
158
- fieldRef: D,
157
+ fullWidth: G,
158
+ fieldRef: j,
159
159
  readOnly: r.readOnly,
160
160
  children: [
161
161
  e && /* @__PURE__ */ i("div", {
162
- className: fe,
162
+ className: ce,
163
163
  children: e
164
164
  }),
165
- g && /* @__PURE__ */ i("div", {
166
- className: A(he, E ? ge : me),
165
+ h && /* @__PURE__ */ i("div", {
166
+ className: A(fe, E ? ge : he),
167
167
  style: {
168
168
  opacity: f === "default" ? 0 : 1,
169
- alignSelf: X
169
+ alignSelf: J
170
170
  },
171
171
  children: /* @__PURE__ */ i(I, {
172
- color: Ie.colors.textSecondary,
172
+ color: We.colors.textSecondary,
173
173
  regular: !0,
174
174
  wordBreak: !1,
175
- children: g
175
+ children: h
176
176
  })
177
177
  }),
178
178
  /* @__PURE__ */ i("div", {
179
- className: ue,
179
+ className: me,
180
180
  style: {
181
- alignSelf: g ? "baseline" : "initial"
181
+ alignSelf: h ? "baseline" : "initial"
182
182
  },
183
183
  children: /* @__PURE__ */ i(I, {
184
184
  as: "div",
185
185
  regular: !0,
186
- children: /*#__PURE__*/ s.createElement(h || Z, _object_spread(_object_spread_props(_object_spread({}, $, b), {
187
- id: F,
186
+ children: /*#__PURE__*/ s.createElement(g || U, _object_spread(_object_spread_props(_object_spread({}, X, b), {
187
+ id: N,
188
188
  style: _object_spread_props(_object_spread({}, b.style), {
189
- fontFamily: ee
189
+ fontFamily: $
190
190
  }),
191
- className: x ? A(Se, E ? pe : be, k) : A(ye, E ? Le : xe, k, {
192
- [Ce]: ae()
191
+ className: x ? A(ue, E ? Se : pe, k) : A(be, E ? ye : Le, k, {
192
+ [xe]: se()
193
193
  }),
194
194
  onFocus: (l)=>{
195
195
  d("focused"), u == null || u(l);
@@ -199,7 +199,7 @@ const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
199
199
  },
200
200
  onChange: (l)=>{
201
201
  var _;
202
- p === void 0 || l.target.value.length <= p ? (N(l.target.value.length), l.target.value.length > 0 && f !== "focused" && d("filled"), (_ = b.onChange) == null || _.call(b, l)) : (l.stopPropagation(), l.preventDefault());
202
+ 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());
203
203
  },
204
204
  defaultValue: o,
205
205
  value: t
@@ -208,40 +208,40 @@ const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
208
208
  }))
209
209
  })
210
210
  }),
211
- n && /* @__PURE__ */ i(re, {
212
- style: V,
211
+ n && /* @__PURE__ */ i(te, {
212
+ style: Z,
213
213
  error: c,
214
- forId: F,
214
+ forId: N,
215
215
  inputState: f,
216
216
  shrinkLabel: w,
217
217
  optional: !r.required,
218
218
  children: n
219
219
  }),
220
220
  a && /* @__PURE__ */ i("div", {
221
- className: Ae,
221
+ className: Ce,
222
222
  children: a
223
223
  }),
224
224
  L
225
225
  ]
226
226
  });
227
- }), Oe = /*#__PURE__*/ s.lazy(()=>import(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")), Ge = /*#__PURE__*/ s.forwardRef((_param, m)=>{
227
+ }), Ie = /*#__PURE__*/ s.lazy(()=>import(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")), De = /*#__PURE__*/ s.forwardRef((_param, m)=>{
228
228
  var { getSuggestions: c , id: T } = _param, n = _object_without_properties(_param, [
229
229
  "getSuggestions",
230
230
  "id"
231
231
  ]);
232
- const [y, o] = s.useState([]), t = s.useRef(null), { platformOverrides: u , texts: S } = B(), h = O(T), g = O();
232
+ const [y, o] = s.useState([]), t = s.useRef(null), { platformOverrides: u , texts: S } = de(), g = F(T), h = F();
233
233
  if (c && (n.value === void 0 || n.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
234
234
  return c ? /* @__PURE__ */ i(s.Suspense, {
235
235
  fallback: /* @__PURE__ */ i(W, _object_spread_props(_object_spread({}, n), {
236
- label: q(u) ? "" : n.label,
236
+ label: le(u) ? "" : n.label,
237
237
  autoComplete: "off",
238
238
  ref: m,
239
- id: h
239
+ id: g
240
240
  })),
241
- children: /* @__PURE__ */ i(Oe, {
242
- id: g,
241
+ children: /* @__PURE__ */ i(Ie, {
242
+ id: h,
243
243
  inputProps: _object_spread_props(_object_spread({}, n), {
244
- id: h,
244
+ id: g,
245
245
  autoComplete: "off",
246
246
  // @ts-expect-error Autosuggest expects slightly different types
247
247
  onChange: (e, param)=>{
@@ -255,7 +255,7 @@ const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
255
255
  }
256
256
  }),
257
257
  renderInputComponent: (e)=>/* @__PURE__ */ i(W, _object_spread_props(_object_spread({}, e), {
258
- inputRef: j(t, n.inputRef, m)
258
+ inputRef: q(t, n.inputRef, m)
259
259
  })),
260
260
  suggestions: y,
261
261
  onSuggestionsFetchRequested: (param)=>{
@@ -268,8 +268,8 @@ const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
268
268
  let { isHighlighted: a } = param;
269
269
  return i("div", {
270
270
  role: "menuitem",
271
- className: A(Te, {
272
- [Ee]: a
271
+ className: A(Ae, {
272
+ [Te]: a
273
273
  }),
274
274
  children: /* @__PURE__ */ i(I, {
275
275
  regular: !0,
@@ -281,14 +281,14 @@ const W = /*#__PURE__*/ s.forwardRef((_param, M)=>{
281
281
  style: {
282
282
  width: t.current ? t.current.clientWidth + 2 : 0
283
283
  },
284
- className: Re,
284
+ className: Ee,
285
285
  "aria-label": `${n.label} ${S.menuLabelSuffix}`,
286
286
  children: e.children
287
287
  }))
288
288
  })
289
289
  }) : /* @__PURE__ */ i(W, _object_spread_props(_object_spread({}, n), {
290
- id: h,
290
+ id: g,
291
291
  ref: m
292
292
  }));
293
293
  });
294
- export { W as TextFieldBase, Ge as TextFieldBaseAutosuggest };
294
+ export { W as TextFieldBase, De as TextFieldBaseAutosuggest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "14.32.0",
3
+ "version": "14.33.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",