@telefonica/mistica 15.1.0 → 15.2.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.
- package/css/mistica.css +1 -1
- package/dist/list.js +19 -15
- package/dist/package-version.js +1 -1
- package/dist/text-link.d.ts +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +13 -9
- package/dist/touchable.js +41 -36
- package/dist-es/list.js +15 -11
- package/dist-es/package-version.js +1 -1
- package/dist-es/style.css +1 -1
- package/dist-es/theme.js +12 -8
- package/dist-es/touchable.js +54 -49
- package/package.json +1 -1
package/dist-es/touchable.js
CHANGED
|
@@ -78,23 +78,24 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
}
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
|
-
import { jsxs as
|
|
81
|
+
import { jsxs as W, jsx as n } from "react/jsx-runtime";
|
|
82
82
|
import * as c from "react";
|
|
83
83
|
import m from "classnames";
|
|
84
|
-
import
|
|
85
|
-
import { notTouchable as
|
|
86
|
-
import { useTheme as
|
|
87
|
-
import { isInsideNovumNativeApp as
|
|
88
|
-
import { ENTER as
|
|
89
|
-
import { getPrefixedDataAttributes as
|
|
90
|
-
import { redirect as
|
|
91
|
-
const
|
|
92
|
-
|
|
84
|
+
import w from "./screen-reader-only.js";
|
|
85
|
+
import { notTouchable as j, touchable as B, base as S, marginReset as V } from "./touchable.css-mistica.js";
|
|
86
|
+
import { useTheme as _ } from "./hooks.js";
|
|
87
|
+
import { isInsideNovumNativeApp as L } from "./utils/platform.js";
|
|
88
|
+
import { ENTER as $, SPACE as q } from "./utils/keys.js";
|
|
89
|
+
import { getPrefixedDataAttributes as z } from "./utils/dom.js";
|
|
90
|
+
import { redirect as F } from "./utils/browser.js";
|
|
91
|
+
const E = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
92
|
+
var P;
|
|
93
|
+
const { texts: o, analytics: C, platformOverrides: O, Link: R, useHrefDecorator: x } = _(), I = x(), u = c.useRef(!1);
|
|
93
94
|
let l = [];
|
|
94
95
|
e.trackingEvent && (Array.isArray(e.trackingEvent) ? l = e.trackingEvent : l = [
|
|
95
96
|
e.trackingEvent
|
|
96
97
|
]);
|
|
97
|
-
const
|
|
98
|
+
const d = e.children, i = _object_spread({
|
|
98
99
|
className: e.className,
|
|
99
100
|
disabled: e.disabled,
|
|
100
101
|
style: e.style,
|
|
@@ -108,39 +109,39 @@ const P = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
|
108
109
|
"aria-selected": e["aria-selected"],
|
|
109
110
|
"aria-live": e["aria-live"],
|
|
110
111
|
tabIndex: e.tabIndex
|
|
111
|
-
},
|
|
112
|
+
}, z(e.dataAttributes, "Touchable")), s = e.type ? e.type : "button", r = !!e.href && !!e.newTab, D = (P = e.href) == null ? void 0 : P.startsWith("#"), h = !r && !!e.href && !!e.loadOnTop, b = (a)=>{
|
|
112
113
|
e.stopPropagation && a.stopPropagation();
|
|
113
114
|
}, g = (a)=>{
|
|
114
115
|
e.onPress && e.onPress(a);
|
|
115
116
|
}, y = ()=>{
|
|
116
117
|
var _e_to_pathname;
|
|
117
|
-
return e.href ?
|
|
118
|
-
}, k = ()=>Promise.all(l.map((a)=>
|
|
118
|
+
return e.href ? I(e.href) : e.to && e.fullPageOnWebView ? typeof e.to == "string" ? e.to : (_e_to_pathname = e.to.pathname) !== null && _e_to_pathname !== void 0 ? _e_to_pathname : "" : "";
|
|
119
|
+
}, k = ()=>Promise.all(l.map((a)=>C.logEvent(a))), v = (a)=>{
|
|
119
120
|
u.current || (u.current = !0, k().finally(()=>{
|
|
120
121
|
u.current = !1, a();
|
|
121
122
|
}));
|
|
122
|
-
},
|
|
123
|
+
}, A = (a)=>{
|
|
123
124
|
if (b(a), !l.length) {
|
|
124
125
|
g(a);
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
128
|
v(()=>g(a));
|
|
128
|
-
},
|
|
129
|
+
}, H = (a)=>{
|
|
129
130
|
var T;
|
|
130
131
|
b(a);
|
|
131
|
-
const
|
|
132
|
-
!l.length && !
|
|
133
|
-
v(()=>
|
|
132
|
+
const f = !!(e.href && e.onNavigate);
|
|
133
|
+
!l.length && !f || (a.preventDefault(), Promise.resolve(f ? (T = e.onNavigate) == null ? void 0 : T.call(e) : void 0).finally(()=>{
|
|
134
|
+
v(()=>F(y(), r, h));
|
|
134
135
|
}));
|
|
135
|
-
},
|
|
136
|
+
}, K = (a)=>{
|
|
136
137
|
b(a), e.to && e.onNavigate && e.onNavigate(), k();
|
|
137
138
|
}, N = (a)=>{
|
|
138
|
-
(a.key ===
|
|
139
|
+
(a.key === $ || a.key === q) && (a.preventDefault(), a.currentTarget.click());
|
|
139
140
|
};
|
|
140
|
-
if (e.href || e.to && e.fullPageOnWebView &&
|
|
141
|
+
if (e.href || e.to && e.fullPageOnWebView && L(O)) return /* @__PURE__ */ W("a", _object_spread_props(_object_spread({}, i), {
|
|
141
142
|
"aria-label": e["aria-label"],
|
|
142
143
|
"aria-labelledby": e["aria-labelledby"],
|
|
143
|
-
onClick:
|
|
144
|
+
onClick: H,
|
|
144
145
|
onKeyDown: N,
|
|
145
146
|
href: e.disabled ? void 0 : y(),
|
|
146
147
|
target: (()=>{
|
|
@@ -150,29 +151,33 @@ const P = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
|
150
151
|
rel: r ? "noopener noreferrer" : void 0,
|
|
151
152
|
ref: t,
|
|
152
153
|
children: [
|
|
153
|
-
|
|
154
|
-
r
|
|
155
|
-
children: /* @__PURE__ */
|
|
156
|
-
children:
|
|
154
|
+
d,
|
|
155
|
+
r ? /* @__PURE__ */ n(w, {
|
|
156
|
+
children: /* @__PURE__ */ n("span", {
|
|
157
|
+
children: o.linkOpensInNewTab
|
|
157
158
|
})
|
|
158
|
-
})
|
|
159
|
+
}) : D ? /* @__PURE__ */ n(w, {
|
|
160
|
+
children: /* @__PURE__ */ n("span", {
|
|
161
|
+
children: o.linkOpensInCurrentPage
|
|
162
|
+
})
|
|
163
|
+
}) : null
|
|
159
164
|
]
|
|
160
165
|
}));
|
|
161
|
-
if (e.to) return /* @__PURE__ */
|
|
166
|
+
if (e.to) return /* @__PURE__ */ n(R, _object_spread_props(_object_spread({}, i), {
|
|
162
167
|
"aria-label": e["aria-label"],
|
|
163
168
|
"aria-labelledby": e["aria-labelledby"],
|
|
164
169
|
innerRef: t,
|
|
165
170
|
to: e.disabled ? "" : e.to,
|
|
166
171
|
replace: e.replace,
|
|
167
|
-
onClick:
|
|
172
|
+
onClick: K,
|
|
168
173
|
onKeyDown: N,
|
|
169
|
-
children:
|
|
174
|
+
children: d
|
|
170
175
|
}));
|
|
171
176
|
if (e.onPress) {
|
|
172
|
-
var _e_as,
|
|
173
|
-
const a = (_e_as = e.as) !== null && _e_as !== void 0 ? _e_as : "button",
|
|
174
|
-
return /*#__PURE__*/ c.createElement(a, _object_spread_props(_object_spread({},
|
|
175
|
-
role:
|
|
177
|
+
var _e_as, _i_role;
|
|
178
|
+
const a = (_e_as = e.as) !== null && _e_as !== void 0 ? _e_as : "button", f = (_i_role = i.role) !== null && _i_role !== void 0 ? _i_role : e.as === "a" ? "button" : void 0;
|
|
179
|
+
return /*#__PURE__*/ c.createElement(a, _object_spread_props(_object_spread({}, i), {
|
|
180
|
+
role: f,
|
|
176
181
|
// this "form" attribute is useful when the form's submit button
|
|
177
182
|
// is located outside the <form> element, for example if you use
|
|
178
183
|
// a ButtonFixedFooter layout inside a form with the submit
|
|
@@ -182,27 +187,27 @@ const P = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
|
182
187
|
"aria-labelledby": e["aria-labelledby"],
|
|
183
188
|
type: s,
|
|
184
189
|
ref: t,
|
|
185
|
-
onClick:
|
|
186
|
-
children:
|
|
190
|
+
onClick: A,
|
|
191
|
+
children: d
|
|
187
192
|
}));
|
|
188
193
|
}
|
|
189
|
-
return /* @__PURE__ */
|
|
194
|
+
return /* @__PURE__ */ n("div", _object_spread_props(_object_spread({}, i), {
|
|
190
195
|
ref: t,
|
|
191
|
-
className: m(
|
|
192
|
-
children:
|
|
196
|
+
className: m(i.className, j),
|
|
197
|
+
children: d
|
|
193
198
|
}));
|
|
194
|
-
}),
|
|
195
|
-
className: m(
|
|
199
|
+
}), G = /*#__PURE__*/ c.forwardRef((e, t)=>/* @__PURE__ */ n(E, _object_spread_props(_object_spread({}, e), {
|
|
200
|
+
className: m(B, e.className),
|
|
196
201
|
ref: t
|
|
197
|
-
}))),
|
|
202
|
+
}))), ae = /*#__PURE__*/ c.forwardRef((_param, o)=>{
|
|
198
203
|
var { resetMargin: e = !0 } = _param, t = _object_without_properties(_param, [
|
|
199
204
|
"resetMargin"
|
|
200
205
|
]);
|
|
201
|
-
return /* @__PURE__ */
|
|
202
|
-
className: m(
|
|
203
|
-
[
|
|
206
|
+
return /* @__PURE__ */ n(E, _object_spread_props(_object_spread({}, t), {
|
|
207
|
+
className: m(S, t.className, {
|
|
208
|
+
[V]: e
|
|
204
209
|
}),
|
|
205
|
-
ref:
|
|
210
|
+
ref: o
|
|
206
211
|
}));
|
|
207
|
-
}),
|
|
208
|
-
export {
|
|
212
|
+
}), te = G;
|
|
213
|
+
export { ae as BaseTouchable, te as default };
|