@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.
- package/css/mistica.css +1 -1
- package/dist/card.js +107 -105
- package/dist/community/advanced-data-card.d.ts +10 -7
- package/dist/community/blocks.d.ts +3 -3
- package/dist/credit-card-expiration-field.js +57 -50
- package/dist/highlighted-card.js +4 -3
- package/dist/hooks.js +53 -52
- package/dist/maybe-dismissable.js +7 -6
- package/dist/package-version.js +1 -1
- package/dist/responsive-layout.css-mistica.js +7 -10
- package/dist/responsive-layout.css.d.ts +0 -1
- package/dist/responsive-layout.js +17 -17
- package/dist/tabs.css-mistica.js +26 -14
- package/dist/tabs.css.d.ts +3 -1
- package/dist/tabs.js +37 -32
- package/dist/text-field-base.js +33 -33
- package/dist-es/card.js +103 -101
- package/dist-es/credit-card-expiration-field.js +63 -56
- package/dist-es/highlighted-card.js +13 -12
- package/dist-es/hooks.js +49 -48
- package/dist-es/maybe-dismissable.js +16 -15
- package/dist-es/package-version.js +1 -1
- package/dist-es/responsive-layout.css-mistica.js +3 -3
- package/dist-es/responsive-layout.js +21 -21
- package/dist-es/style.css +1 -1
- package/dist-es/tabs.css-mistica.js +14 -8
- package/dist-es/tabs.js +58 -53
- package/dist-es/text-field-base.js +59 -59
- package/package.json +1 -1
|
@@ -77,20 +77,20 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
77
77
|
}
|
|
78
78
|
return target;
|
|
79
79
|
}
|
|
80
|
-
import { jsxs as
|
|
80
|
+
import { jsxs as v, jsx as i } from "react/jsx-runtime";
|
|
81
81
|
import * as s from "react";
|
|
82
|
-
import { FieldContainer as
|
|
83
|
-
import { LABEL_LEFT_POSITION as R, LABEL_SCALE_MOBILE as
|
|
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
|
|
86
|
-
import { useAriaId as
|
|
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
|
|
89
|
-
import { startIcon as
|
|
90
|
-
import { sprinkles as
|
|
91
|
-
import { vars as
|
|
92
|
-
const W = /*#__PURE__*/ s.forwardRef((_param,
|
|
93
|
-
var { error: c , helperText: T , label: n , inputProps: m , inputRef: y , defaultValue: o , value: t , onFocus: u , onBlur: S , inputComponent:
|
|
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
|
|
119
|
-
|
|
120
|
-
|
|
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 && (
|
|
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
|
|
132
|
+
const U = x ? "textarea" : "input", X = g ? {
|
|
133
133
|
inputRef: y
|
|
134
134
|
} : {
|
|
135
|
-
ref:
|
|
135
|
+
ref: q(H, y)
|
|
136
136
|
}, b = _object_spread(_object_spread_props(_object_spread({}, r), {
|
|
137
137
|
maxLength: p,
|
|
138
|
-
autoComplete:
|
|
139
|
-
}), m), P = w || f === "focused" || f === "filled",
|
|
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)) / ${
|
|
143
|
+
width: `calc(((100% - ${R + (e ? 48 : R)}px)) / ${Y})`,
|
|
144
144
|
paddingRight: a && !P ? 36 : 0
|
|
145
|
-
}, k =
|
|
145
|
+
}, k = Re({
|
|
146
146
|
paddingRight: a ? 0 : 16,
|
|
147
|
-
paddingLeft:
|
|
148
|
-
}),
|
|
149
|
-
return /* @__PURE__ */
|
|
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(
|
|
151
|
+
helperText: /* @__PURE__ */ i(ee, {
|
|
152
152
|
error: c,
|
|
153
153
|
leftText: T,
|
|
154
|
-
rightText: x && p ? `${
|
|
154
|
+
rightText: x && p ? `${M}/${p}` : void 0
|
|
155
155
|
}),
|
|
156
156
|
multiline: x,
|
|
157
|
-
fullWidth:
|
|
158
|
-
fieldRef:
|
|
157
|
+
fullWidth: G,
|
|
158
|
+
fieldRef: j,
|
|
159
159
|
readOnly: r.readOnly,
|
|
160
160
|
children: [
|
|
161
161
|
e && /* @__PURE__ */ i("div", {
|
|
162
|
-
className:
|
|
162
|
+
className: ce,
|
|
163
163
|
children: e
|
|
164
164
|
}),
|
|
165
|
-
|
|
166
|
-
className: A(
|
|
165
|
+
h && /* @__PURE__ */ i("div", {
|
|
166
|
+
className: A(fe, E ? ge : he),
|
|
167
167
|
style: {
|
|
168
168
|
opacity: f === "default" ? 0 : 1,
|
|
169
|
-
alignSelf:
|
|
169
|
+
alignSelf: J
|
|
170
170
|
},
|
|
171
171
|
children: /* @__PURE__ */ i(I, {
|
|
172
|
-
color:
|
|
172
|
+
color: We.colors.textSecondary,
|
|
173
173
|
regular: !0,
|
|
174
174
|
wordBreak: !1,
|
|
175
|
-
children:
|
|
175
|
+
children: h
|
|
176
176
|
})
|
|
177
177
|
}),
|
|
178
178
|
/* @__PURE__ */ i("div", {
|
|
179
|
-
className:
|
|
179
|
+
className: me,
|
|
180
180
|
style: {
|
|
181
|
-
alignSelf:
|
|
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(
|
|
187
|
-
id:
|
|
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:
|
|
189
|
+
fontFamily: $
|
|
190
190
|
}),
|
|
191
|
-
className: x ? A(
|
|
192
|
-
[
|
|
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 ? (
|
|
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(
|
|
212
|
-
style:
|
|
211
|
+
n && /* @__PURE__ */ i(te, {
|
|
212
|
+
style: Z,
|
|
213
213
|
error: c,
|
|
214
|
-
forId:
|
|
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:
|
|
221
|
+
className: Ce,
|
|
222
222
|
children: a
|
|
223
223
|
}),
|
|
224
224
|
L
|
|
225
225
|
]
|
|
226
226
|
});
|
|
227
|
-
}),
|
|
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 } =
|
|
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:
|
|
236
|
+
label: le(u) ? "" : n.label,
|
|
237
237
|
autoComplete: "off",
|
|
238
238
|
ref: m,
|
|
239
|
-
id:
|
|
239
|
+
id: g
|
|
240
240
|
})),
|
|
241
|
-
children: /* @__PURE__ */ i(
|
|
242
|
-
id:
|
|
241
|
+
children: /* @__PURE__ */ i(Ie, {
|
|
242
|
+
id: h,
|
|
243
243
|
inputProps: _object_spread_props(_object_spread({}, n), {
|
|
244
|
-
id:
|
|
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:
|
|
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(
|
|
272
|
-
[
|
|
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:
|
|
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:
|
|
290
|
+
id: g,
|
|
291
291
|
ref: m
|
|
292
292
|
}));
|
|
293
293
|
});
|
|
294
|
-
export { W as TextFieldBase,
|
|
294
|
+
export { W as TextFieldBase, De as TextFieldBaseAutosuggest };
|