@telefonica/mistica 14.2.0 → 14.4.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.
@@ -52,19 +52,19 @@ function _objectSpreadProps(target, source) {
52
52
  }
53
53
  import * as c from "react";
54
54
  import b from "classnames";
55
- import A from "./screen-reader-only.js";
56
- import { notTouchable as I, touchable as _, base as H } from "./touchable.css-mistica.js";
57
- import { useTheme as K } from "./hooks.js";
58
- import { isInsideNovumNativeApp as j } from "./utils/platform.js";
59
- import { ENTER as B, SPACE as S } from "./utils/key-codes.js";
60
- import { getPrefixedDataAttributes as V } from "./utils/dom.js";
61
- import { jsxs as W, jsx as l } from "./_virtual/jsx-runtime.js";
62
- const L = function(e) {
55
+ import _ from "./screen-reader-only.js";
56
+ import { notTouchable as H, touchable as K, base as j } from "./touchable.css-mistica.js";
57
+ import { useTheme as B } from "./hooks.js";
58
+ import { isInsideNovumNativeApp as S } from "./utils/platform.js";
59
+ import { ENTER as V, SPACE as W } from "./utils/key-codes.js";
60
+ import { getPrefixedDataAttributes as L } from "./utils/dom.js";
61
+ import { jsxs as q, jsx as l } from "./_virtual/jsx-runtime.js";
62
+ const z = function(e) {
63
63
  let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, d = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
64
64
  t ? window.open(e, "_blank") : d ? window.open(e, "_top") : document.location.href = e;
65
- }, T = /*#__PURE__*/ c.forwardRef((e, t)=>{
66
- var w, g;
67
- const { texts: d , analytics: N , platformOverrides: E , Link: P , useHrefDecorator: x } = K(), C = x(), f = c.useRef(!1);
65
+ }, N = /*#__PURE__*/ c.forwardRef((e, t)=>{
66
+ var T, v;
67
+ const { texts: d , analytics: P , platformOverrides: E , Link: C , useHrefDecorator: x } = B(), R = x(), f = c.useRef(!1);
68
68
  let i = [];
69
69
  e.trackingEvent && (Array.isArray(e.trackingEvent) ? i = e.trackingEvent : i = [
70
70
  e.trackingEvent
@@ -81,32 +81,36 @@ const L = function(e) {
81
81
  "aria-selected": e["aria-selected"],
82
82
  "aria-live": e["aria-live"],
83
83
  tabIndex: e.tabIndex
84
- }, V(e.dataAttributes, "Touchable")), m = e.type ? e.type : "button", r = !!e.href && !!e.newTab, u = !r && !!e.href && !!e.loadOnTop, s = (a)=>{
84
+ }, L(e.dataAttributes, "Touchable")), m = e.type ? e.type : "button", r = !!e.href && !!e.newTab, u = !r && !!e.href && !!e.loadOnTop, s = (a)=>{
85
+ e.stopPropagation && a.stopPropagation();
86
+ }, h = (a)=>{
85
87
  e.onPress && e.onPress(a);
86
- }, h = ()=>{
88
+ }, k = ()=>{
87
89
  var a;
88
- return e.href ? C(e.href) : e.to && e.fullPageOnWebView ? typeof e.to == "string" ? e.to : (a = e.to.pathname) != null ? a : "" : "";
89
- }, y = ()=>Promise.all(i.map((a)=>N.logEvent(a))), k = (a)=>{
90
+ return e.href ? R(e.href) : e.to && e.fullPageOnWebView ? typeof e.to == "string" ? e.to : (a = e.to.pathname) != null ? a : "" : "";
91
+ }, y = ()=>Promise.all(i.map((a)=>P.logEvent(a))), g = (a)=>{
90
92
  f.current || (f.current = !0, y().finally(()=>{
91
93
  f.current = !1, a();
92
94
  }));
93
- }, R = (a)=>{
94
- if (!i.length) {
95
- s(a);
95
+ }, D = (a)=>{
96
+ if (s(a), !i.length) {
97
+ h(a);
96
98
  return;
97
99
  }
98
- k(()=>s(a));
99
- }, D = (a)=>{
100
- !i.length || (a.preventDefault(), k(()=>L(h(), r, u)));
101
- }, v = (a)=>{
102
- (a.keyCode === B || a.keyCode === S) && (a.preventDefault(), a.currentTarget.click());
100
+ g(()=>h(a));
101
+ }, O = (a)=>{
102
+ s(a), i.length && (a.preventDefault(), g(()=>z(k(), r, u)));
103
+ }, I = (a)=>{
104
+ s(a), y();
105
+ }, w = (a)=>{
106
+ (a.keyCode === V || a.keyCode === W) && (a.preventDefault(), a.currentTarget.click());
103
107
  };
104
- if (!!e.href || e.to && e.fullPageOnWebView && j(E)) return /* @__PURE__ */ W("a", _objectSpreadProps(_objectSpread({}, n), {
108
+ if (!!e.href || e.to && e.fullPageOnWebView && S(E)) return /* @__PURE__ */ q("a", _objectSpreadProps(_objectSpread({}, n), {
105
109
  "aria-label": e["aria-label"],
106
110
  "aria-labelledby": e["aria-labelledby"],
107
- onClick: D,
108
- onKeyDown: v,
109
- href: e.disabled ? void 0 : h(),
111
+ onClick: O,
112
+ onKeyDown: w,
113
+ href: e.disabled ? void 0 : k(),
110
114
  target: (()=>{
111
115
  if (r) return "_blank";
112
116
  if (u) return "_top";
@@ -115,46 +119,46 @@ const L = function(e) {
115
119
  ref: t,
116
120
  children: [
117
121
  o,
118
- r && /* @__PURE__ */ l(A, {
122
+ r && /* @__PURE__ */ l(_, {
119
123
  children: /* @__PURE__ */ l("span", {
120
124
  children: d.linkOpensInNewTab
121
125
  })
122
126
  })
123
127
  ]
124
128
  }));
125
- if (e.to) return /* @__PURE__ */ l(P, _objectSpreadProps(_objectSpread({}, n), {
129
+ if (e.to) return /* @__PURE__ */ l(C, _objectSpreadProps(_objectSpread({}, n), {
126
130
  "aria-label": e["aria-label"],
127
131
  "aria-labelledby": e["aria-labelledby"],
128
132
  innerRef: t,
129
133
  to: e.disabled ? "" : e.to,
130
134
  replace: e.replace,
131
- onClick: y,
132
- onKeyDown: v,
135
+ onClick: I,
136
+ onKeyDown: w,
133
137
  children: o
134
138
  }));
135
139
  if (e.onPress) {
136
- const a = (w = e.as) != null ? w : "button", O = (g = n.role) != null ? g : e.as === "a" ? "button" : void 0;
140
+ const a = (T = e.as) != null ? T : "button", A = (v = n.role) != null ? v : e.as === "a" ? "button" : void 0;
137
141
  return /*#__PURE__*/ c.createElement(a, _objectSpreadProps(_objectSpread({}, n), {
138
- role: O,
142
+ role: A,
139
143
  form: m === "submit" && e.formId ? e.formId : void 0,
140
144
  "aria-label": e["aria-label"],
141
145
  "aria-labelledby": e["aria-labelledby"],
142
146
  type: m,
143
147
  ref: t,
144
- onClick: R,
148
+ onClick: D,
145
149
  children: o
146
150
  }));
147
151
  }
148
152
  return /* @__PURE__ */ l("div", _objectSpreadProps(_objectSpread({}, n), {
149
153
  ref: t,
150
- className: b(n.className, I),
154
+ className: b(n.className, H),
151
155
  children: o
152
156
  }));
153
- }), X = /*#__PURE__*/ c.forwardRef((e, t)=>/* @__PURE__ */ l(T, _objectSpreadProps(_objectSpread({}, e), {
154
- className: b(_, e.className),
157
+ }), Z = /*#__PURE__*/ c.forwardRef((e, t)=>/* @__PURE__ */ l(N, _objectSpreadProps(_objectSpread({}, e), {
158
+ className: b(K, e.className),
155
159
  ref: t
156
- }))), Y = /*#__PURE__*/ c.forwardRef((e, t)=>/* @__PURE__ */ l(T, _objectSpreadProps(_objectSpread({}, e), {
157
- className: b(H, e.className),
160
+ }))), $ = /*#__PURE__*/ c.forwardRef((e, t)=>/* @__PURE__ */ l(N, _objectSpreadProps(_objectSpread({}, e), {
161
+ className: b(j, e.className),
158
162
  ref: t
159
163
  })));
160
- export { Y as BaseTouchable, X as default };
164
+ export { $ as BaseTouchable, Z as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "14.2.0",
3
+ "version": "14.4.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",