@telefonica/mistica 14.24.1 → 14.25.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,22 +77,22 @@ function _object_without_properties_loose(source, excluded) {
77
77
  }
78
78
  return target;
79
79
  }
80
- import { jsxs as P, Fragment as tt, jsx as w } from "react/jsx-runtime";
80
+ import { jsxs as P, Fragment as et, jsx as w } from "react/jsx-runtime";
81
81
  import * as o from "react";
82
82
  import E from "classnames";
83
- import { CSSTransition as et } from "react-transition-group";
84
- import { useTheme as rt, useScreenSize as nt, useAriaId as ot } from "./hooks.js";
85
- import { Portal as it } from "./portal.js";
86
- import at from "./overlay.js";
83
+ import { CSSTransition as rt } from "react-transition-group";
84
+ import { useTheme as nt, useScreenSize as ot, useAriaId as it } from "./hooks.js";
85
+ import { Portal as at } from "./portal.js";
86
+ import ct from "./overlay.js";
87
87
  import { Text2 as I } from "./text.js";
88
- import { TAB as ct } from "./utils/key-codes.js";
89
- import st from "./stack.js";
90
- import { vars as s, wrapper as ut, enter as lt, enterActive as dt, enterDone as ft, exit as ht, exitActive as wt, container as mt, textAlign as pt, arrowWrapper as gt, arrow as xt, fadeInTopKeyframes as Tt, fadeInBottomKeyframes as vt, fadeInXKeyframes as bt, arrowTop as At, arrowBottom as Pt, arrowLeft as St, arrowRight as Yt } from "./tooltip.css-mistica.js";
91
- import { assignInlineVars as Ot } from "@vanilla-extract/dynamic";
92
- import { getPrefixedDataAttributes as Rt } from "./utils/dom.js";
93
- import { isClientSide as yt, isServerSide as Ct } from "./utils/environment.js";
94
- const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500, M = ()=>{}, It = (r)=>r === "bottom" ? `translateY(${v}px)` : r === "top" ? `translateY(calc(-100% - ${v}px))` : r === "right" ? `translateX(${v}px) translateY(-50%)` : r === "left" ? `translateX(-${v}px) translateY(-50%)` : `translateY(-${v}px)`, Mt = (r)=>r === "top" ? "translateY(-100%)" : r === "bottom" ? "translateY(0)" : "translateY(-50%)", Nt = (r)=>r === "bottom" ? "translateY(0)" : r === "top" ? "translateY(-100%)" : r === "right" || r === "left" ? "translateX(0px) translateY(-50%)" : "translateY(0px)", kt = (r)=>r === "top" ? Tt : r === "bottom" ? vt : bt, Lt = (r)=>r ? "1" : "0.2", Vt = (r)=>r === "top" ? `2px 2px 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "right" ? `0 0 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "left" ? `0 0 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "bottom" ? `-1px -1px 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : "", jt = (_param)=>{
95
- var { children: r , extra: N , description: S , target: k , title: Y , targetLabel: L , delay: V = !0 , dataAttributes: j , targetStyle: K , unstable_offsetX: f } = _param, C = _object_without_properties(_param, [
88
+ import { TAB as st } from "./utils/key-codes.js";
89
+ import ut from "./stack.js";
90
+ import { vars as s, wrapper as lt, enter as dt, enterActive as ft, enterDone as ht, exit as wt, exitActive as mt, container as pt, textAlign as gt, textCenter as xt, arrowWrapper as Tt, arrow as vt, fadeInTopKeyframes as bt, fadeInBottomKeyframes as At, fadeInXKeyframes as Pt, arrowTop as St, arrowBottom as Yt, arrowLeft as Ct, arrowRight as Ot } from "./tooltip.css-mistica.js";
91
+ import { assignInlineVars as Rt } from "@vanilla-extract/dynamic";
92
+ import { getPrefixedDataAttributes as yt } from "./utils/dom.js";
93
+ import { isClientSide as Dt, isServerSide as Wt } from "./utils/environment.js";
94
+ const $t = "bottom", Bt = "top", Et = 12, m = 4 + Et, It = 500, v = 12, Mt = 500, M = ()=>{}, Nt = (r)=>r === "bottom" ? `translateY(${v}px)` : r === "top" ? `translateY(calc(-100% - ${v}px))` : r === "right" ? `translateX(${v}px) translateY(-50%)` : r === "left" ? `translateX(-${v}px) translateY(-50%)` : `translateY(-${v}px)`, kt = (r)=>r === "top" ? "translateY(-100%)" : r === "bottom" ? "translateY(0)" : "translateY(-50%)", Lt = (r)=>r === "bottom" ? "translateY(0)" : r === "top" ? "translateY(-100%)" : r === "right" || r === "left" ? "translateX(0px) translateY(-50%)" : "translateY(0px)", Vt = (r)=>r === "top" ? bt : r === "bottom" ? At : Pt, jt = (r)=>r ? "1" : "0.2", Kt = (r)=>r === "top" ? `2px 2px 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "right" ? `0 0 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "left" ? `0 0 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "bottom" ? `-1px -1px 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : "", zt = (_param)=>{
95
+ var { children: r , extra: N , description: S , target: k , title: Y , targetLabel: L , delay: V = !0 , dataAttributes: j , targetStyle: K , unstable_offsetX: f , textCenter: z } = _param, y = _object_without_properties(_param, [
96
96
  "children",
97
97
  "extra",
98
98
  "description",
@@ -102,16 +102,17 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
102
102
  "delay",
103
103
  "dataAttributes",
104
104
  "targetStyle",
105
- "unstable_offsetX"
105
+ "unstable_offsetX",
106
+ "textCenter"
106
107
  ]);
107
- const { isDarkMode: z } = rt(), [a, O] = o.useState(!1), { isTabletOrSmaller: F } = nt(), D = ot(), h = o.useRef(!1), c = o.useRef(null), g = o.useRef(null), R = o.useRef(null), x = o.useRef(null), t = o.useRef({
108
+ const { isDarkMode: F } = nt(), [a, C] = o.useState(!1), { isTabletOrSmaller: H } = ot(), D = it(), h = o.useRef(!1), c = o.useRef(null), g = o.useRef(null), O = o.useRef(null), x = o.useRef(null), t = o.useRef({
108
109
  top: 0,
109
110
  right: 0,
110
111
  left: 0,
111
112
  bottom: 0,
112
113
  width: 0,
113
114
  height: 0
114
- }), [H, X] = o.useState({}), q = (n)=>F ? n || Wt : n || Dt, [e, G] = o.useState(void 0), i = ((n)=>{
115
+ }), [X, q] = o.useState({}), G = (n)=>H ? n || Bt : n || $t, [e, J] = o.useState(void 0), i = ((n)=>{
115
116
  if (!e) return n;
116
117
  const u = (d)=>{
117
118
  const p = t.current.top > e.height;
@@ -123,28 +124,28 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
123
124
  left: t.current.left < e.width ? t.current.right + e.width > window.innerWidth ? t.current.top < e.height ? "bottom" : "top" : "right" : n,
124
125
  bottom: t.current.bottom + e.height > window.innerHeight ? l("top") : l(n)
125
126
  })[n];
126
- })(q(C.position)), y = yt() ? window.matchMedia("(pointer: coarse)").matches : !1, W = ()=>{
127
- a && O(!1);
127
+ })(G(y.position)), R = Dt() ? window.matchMedia("(pointer: coarse)").matches : !1, W = ()=>{
128
+ a && C(!1);
128
129
  };
129
130
  o.useEffect(()=>(window.addEventListener("resize", W), ()=>{
130
131
  window.removeEventListener("resize", W);
131
132
  }));
132
133
  const $ = ()=>{
133
- O(!1);
134
+ C(!1);
134
135
  }, T = ()=>{
135
- R.current && (t.current = R.current.getBoundingClientRect(), O(!a));
136
- }, J = ()=>{
136
+ O.current && (t.current = O.current.getBoundingClientRect(), C(!a));
137
+ }, Q = ()=>{
137
138
  a || T();
138
- }, Q = (n)=>{
139
- n.keyCode === ct && $();
140
139
  }, U = (n)=>{
140
+ n.keyCode === st && $();
141
+ }, Z = (n)=>{
141
142
  if (!e) return {};
142
143
  const u = e.width > t.current.width && t.current.left + t.current.width / 2 < e.width / 2 + 16 ? t.current.width / 2 : "50%";
143
144
  return n === "bottom" || n === "top" ? {
144
145
  left: u
145
146
  } : {};
146
147
  }, B = o.useCallback((n, u)=>{
147
- if (Ct() || !e) return {};
148
+ if (Wt() || !e) return {};
148
149
  const l = e.width > t.current.width && t.current.left + t.current.width / 2 < e.width / 2 + 16 ? Math.round(e.width / 2 - t.current.width / 2) : 0, A = f || (u ? window.pageXOffset + t.current.left + t.current.width / 2 - u / 2 : window.pageXOffset + t.current.left + l + t.current.width / 2 - e.width / 2), d = t.current.left < e.width ? A : u ? t.current.left - u - m : t.current.left - e.width - m, p = t.current.left < e.width ? t.current.top < e.height ? window.pageYOffset + t.current.bottom + m : window.pageYOffset + t.current.top - m : f || window.pageYOffset + t.current.top + t.current.height / 2;
149
150
  return ({
150
151
  right: {
@@ -167,42 +168,42 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
167
168
  }, [
168
169
  f,
169
170
  e
170
- ]), b = (()=>C.width)(), Z = {
171
- top: At,
172
- bottom: Pt,
173
- left: St,
174
- right: Yt
175
- }, _ = i && Ot({
176
- [s.enterTransform]: It(i),
177
- [s.exitTransform]: Nt(i),
178
- [s.enterActiveAnimationName]: kt(i),
179
- [s.enterDoneTransform]: Mt(i),
180
- [s.shadowAlpha]: Lt(z),
181
- [s.arrowBoxShadow]: Vt(i)
171
+ ]), b = (()=>y.width)(), _ = {
172
+ top: St,
173
+ bottom: Yt,
174
+ left: Ct,
175
+ right: Ot
176
+ }, tt = i && Rt({
177
+ [s.enterTransform]: Nt(i),
178
+ [s.exitTransform]: Lt(i),
179
+ [s.enterActiveAnimationName]: Vt(i),
180
+ [s.enterDoneTransform]: kt(i),
181
+ [s.shadowAlpha]: jt(F),
182
+ [s.arrowBoxShadow]: Kt(i)
182
183
  });
183
184
  return o.useEffect(()=>{
184
- i && x.current && a && X(B(i, b || 0));
185
+ i && x.current && a && q(B(i, b || 0));
185
186
  }, [
186
187
  a,
187
188
  B,
188
189
  i,
189
190
  b
190
191
  ]), o.useEffect(()=>{
191
- x.current && (x.current.getBoundingClientRect(), a && G(x.current.getBoundingClientRect()));
192
+ x.current && (x.current.getBoundingClientRect(), a && J(x.current.getBoundingClientRect()));
192
193
  }, [
193
194
  a
194
- ]), /* @__PURE__ */ P(tt, {
195
+ ]), /* @__PURE__ */ P(et, {
195
196
  children: [
196
197
  /* @__PURE__ */ w("div", {
197
- ref: R,
198
+ ref: O,
198
199
  style: K,
199
- className: ut,
200
+ className: lt,
200
201
  onPointerOver: ()=>{
201
202
  c.current && (clearTimeout(c.current), c.current = null), !h.current && (h.current = !0, V ? g.current = setTimeout(()=>{
202
203
  g.current = null, T();
203
- }, Et) : T());
204
+ }, Mt) : T());
204
205
  },
205
- onPointerLeave: y ? M : ()=>{
206
+ onPointerLeave: R ? M : ()=>{
206
207
  if (g.current) {
207
208
  clearTimeout(g.current), g.current = null, h.current = !1;
208
209
  return;
@@ -211,8 +212,8 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
211
212
  h.current && (c.current = null, h.current = !1, T());
212
213
  }, 100);
213
214
  },
214
- onFocus: J,
215
- onKeyDown: Q,
215
+ onFocus: Q,
216
+ onKeyDown: U,
216
217
  "touch-action": "auto",
217
218
  role: "button",
218
219
  tabIndex: 0,
@@ -221,48 +222,48 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
221
222
  "aria-label": L,
222
223
  children: k
223
224
  }),
224
- /* @__PURE__ */ P(it, {
225
+ /* @__PURE__ */ P(at, {
225
226
  children: [
226
- a && y && /* @__PURE__ */ w(at, {
227
+ a && R && /* @__PURE__ */ w(ct, {
227
228
  onPress: $
228
229
  }),
229
- /* @__PURE__ */ w(et, {
230
+ /* @__PURE__ */ w(rt, {
230
231
  in: a,
231
- timeout: Bt,
232
+ timeout: It,
232
233
  classNames: {
233
- enter: lt,
234
- enterActive: dt,
235
- enterDone: ft,
236
- exit: ht,
237
- exitActive: wt
234
+ enter: dt,
235
+ enterActive: ft,
236
+ enterDone: ht,
237
+ exit: wt,
238
+ exitActive: mt
238
239
  },
239
240
  unmountOnExit: !0,
240
241
  children: /* @__PURE__ */ P("div", _object_spread_props(_object_spread({
241
242
  ref: x
242
- }, Rt(j, "Tooltip")), {
243
+ }, yt(j, "Tooltip")), {
243
244
  role: "tooltip",
244
245
  id: D,
245
- className: E(mt, pt),
246
+ className: E(pt, gt, z ? xt : ""),
246
247
  style: _object_spread({
247
248
  width: b
248
- }, H, _),
249
+ }, X, tt),
249
250
  onPointerOver: ()=>{
250
251
  c.current && (clearTimeout(c.current), c.current = null);
251
252
  },
252
- onPointerLeave: y ? M : ()=>{
253
+ onPointerLeave: R ? M : ()=>{
253
254
  c.current = setTimeout(()=>{
254
255
  h.current && (c.current = null, h.current = !1, T());
255
256
  }, 100);
256
257
  },
257
258
  children: [
258
259
  /* @__PURE__ */ w("div", {
259
- style: U(i),
260
- className: E(gt, Z[i]),
260
+ style: Z(i),
261
+ className: E(Tt, _[i]),
261
262
  children: /* @__PURE__ */ w("div", {
262
- className: xt
263
+ className: vt
263
264
  })
264
265
  }),
265
- (Y || S) && /* @__PURE__ */ P(st, {
266
+ (Y || S) && /* @__PURE__ */ P(ut, {
266
267
  space: 4,
267
268
  children: [
268
269
  Y && /* @__PURE__ */ w(I, {
@@ -283,5 +284,5 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
283
284
  })
284
285
  ]
285
286
  });
286
- }, oe = jt;
287
- export { oe as default };
287
+ }, ae = zt;
288
+ export { ae as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "14.24.1",
3
+ "version": "14.25.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",