@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.
@@ -78,23 +78,24 @@ function _object_without_properties_loose(source, excluded) {
78
78
  }
79
79
  return target;
80
80
  }
81
- import { jsxs as A, jsx as i } from "react/jsx-runtime";
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 H from "./screen-reader-only.js";
85
- import { notTouchable as K, touchable as j, base as B, marginReset as S } from "./touchable.css-mistica.js";
86
- import { useTheme as V } from "./hooks.js";
87
- import { isInsideNovumNativeApp as W } from "./utils/platform.js";
88
- import { ENTER as _, SPACE as L } from "./utils/keys.js";
89
- import { getPrefixedDataAttributes as $ } from "./utils/dom.js";
90
- import { redirect as q } from "./utils/browser.js";
91
- const P = /*#__PURE__*/ c.forwardRef((e, t)=>{
92
- const { texts: f, analytics: w, platformOverrides: E, Link: R, useHrefDecorator: x } = V(), O = x(), u = c.useRef(!1);
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 o = e.children, n = _object_spread({
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
- }, $(e.dataAttributes, "Touchable")), s = e.type ? e.type : "button", r = !!e.href && !!e.newTab, h = !r && !!e.href && !!e.loadOnTop, b = (a)=>{
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 ? O(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 : "" : "";
118
- }, k = ()=>Promise.all(l.map((a)=>w.logEvent(a))), v = (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
- }, C = (a)=>{
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
- }, D = (a)=>{
129
+ }, H = (a)=>{
129
130
  var T;
130
131
  b(a);
131
- const d = !!(e.href && e.onNavigate);
132
- !l.length && !d || (a.preventDefault(), Promise.resolve(d ? (T = e.onNavigate) == null ? void 0 : T.call(e) : void 0).finally(()=>{
133
- v(()=>q(y(), r, h));
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
- }, I = (a)=>{
136
+ }, K = (a)=>{
136
137
  b(a), e.to && e.onNavigate && e.onNavigate(), k();
137
138
  }, N = (a)=>{
138
- (a.key === _ || a.key === L) && (a.preventDefault(), a.currentTarget.click());
139
+ (a.key === $ || a.key === q) && (a.preventDefault(), a.currentTarget.click());
139
140
  };
140
- if (e.href || e.to && e.fullPageOnWebView && W(E)) return /* @__PURE__ */ A("a", _object_spread_props(_object_spread({}, n), {
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: D,
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
- o,
154
- r && /* @__PURE__ */ i(H, {
155
- children: /* @__PURE__ */ i("span", {
156
- children: f.linkOpensInNewTab
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__ */ i(R, _object_spread_props(_object_spread({}, n), {
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: I,
172
+ onClick: K,
168
173
  onKeyDown: N,
169
- children: o
174
+ children: d
170
175
  }));
171
176
  if (e.onPress) {
172
- var _e_as, _n_role;
173
- const a = (_e_as = e.as) !== null && _e_as !== void 0 ? _e_as : "button", d = (_n_role = n.role) !== null && _n_role !== void 0 ? _n_role : e.as === "a" ? "button" : void 0;
174
- return /*#__PURE__*/ c.createElement(a, _object_spread_props(_object_spread({}, n), {
175
- role: d,
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: C,
186
- children: o
190
+ onClick: A,
191
+ children: d
187
192
  }));
188
193
  }
189
- return /* @__PURE__ */ i("div", _object_spread_props(_object_spread({}, n), {
194
+ return /* @__PURE__ */ n("div", _object_spread_props(_object_spread({}, i), {
190
195
  ref: t,
191
- className: m(n.className, K),
192
- children: o
196
+ className: m(i.className, j),
197
+ children: d
193
198
  }));
194
- }), z = /*#__PURE__*/ c.forwardRef((e, t)=>/* @__PURE__ */ i(P, _object_spread_props(_object_spread({}, e), {
195
- className: m(j, e.className),
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
- }))), p = /*#__PURE__*/ c.forwardRef((_param, f)=>{
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__ */ i(P, _object_spread_props(_object_spread({}, t), {
202
- className: m(B, t.className, {
203
- [S]: e
206
+ return /* @__PURE__ */ n(E, _object_spread_props(_object_spread({}, t), {
207
+ className: m(S, t.className, {
208
+ [V]: e
204
209
  }),
205
- ref: f
210
+ ref: o
206
211
  }));
207
- }), ee = z;
208
- export { p as BaseTouchable, ee as default };
212
+ }), te = G;
213
+ export { ae as BaseTouchable, te as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "15.1.0",
3
+ "version": "15.2.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",