@telefonica/mistica 14.41.0 → 14.42.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.
Files changed (142) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/boxed.css-mistica.js +14 -5
  3. package/dist/boxed.css.d.ts +1 -0
  4. package/dist/boxed.d.ts +1 -0
  5. package/dist/boxed.js +11 -9
  6. package/dist/button-fixed-footer-layout.d.ts +1 -0
  7. package/dist/button-fixed-footer-layout.js +19 -14
  8. package/dist/button-layout.css-mistica.js +16 -13
  9. package/dist/button-layout.css.d.ts +1 -0
  10. package/dist/button-layout.js +15 -15
  11. package/dist/button.js +43 -35
  12. package/dist/carousel.d.ts +13 -0
  13. package/dist/carousel.js +325 -223
  14. package/dist/credit-card-expiration-field.js +30 -26
  15. package/dist/credit-card-number-field.css-mistica.js +7 -7
  16. package/dist/credit-card-number-field.js +59 -45
  17. package/dist/cvv-field.js +46 -41
  18. package/dist/date-field.css-mistica.js +14 -0
  19. package/dist/date-field.css.d.ts +1 -0
  20. package/dist/date-field.css.ts.vanilla.css-mistica.js +11 -0
  21. package/dist/date-field.js +41 -35
  22. package/dist/date-time-field.js +40 -34
  23. package/dist/date-time-picker.js +43 -45
  24. package/dist/decimal-field.js +26 -22
  25. package/dist/dialog-context.d.ts +24 -0
  26. package/dist/dialog-context.js +192 -0
  27. package/dist/dialog.css-mistica.js +15 -12
  28. package/dist/dialog.css.d.ts +1 -0
  29. package/dist/dialog.d.ts +14 -44
  30. package/dist/dialog.js +163 -246
  31. package/dist/double-field.css-mistica.js +3 -2
  32. package/dist/email-field.js +15 -11
  33. package/dist/feedback.css-mistica.js +23 -14
  34. package/dist/feedback.css.d.ts +7 -4
  35. package/dist/feedback.js +157 -143
  36. package/dist/fixed-footer-layout.css-mistica.js +1 -1
  37. package/dist/fixed-footer-layout.js +9 -8
  38. package/dist/iban-field.js +31 -27
  39. package/dist/icons/icon-amex.d.ts +1 -1
  40. package/dist/icons/icon-cvv-amex.d.ts +1 -1
  41. package/dist/icons/icon-cvv-visa-mc.d.ts +1 -1
  42. package/dist/icons/icon-mastercard.d.ts +1 -1
  43. package/dist/icons/icon-visa.d.ts +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.js +16 -4
  46. package/dist/inline.css-mistica.js +9 -6
  47. package/dist/inline.css.d.ts +1 -1
  48. package/dist/inline.js +9 -9
  49. package/dist/integer-field.js +17 -13
  50. package/dist/loading-bar.css-mistica.js +4 -7
  51. package/dist/loading-bar.css.d.ts +0 -2
  52. package/dist/loading-bar.js +3 -6
  53. package/dist/month-field.js +39 -33
  54. package/dist/package-version.js +1 -1
  55. package/dist/password-field.js +46 -44
  56. package/dist/phone-number-field.js +50 -46
  57. package/dist/pin-field.css-mistica.js +12 -6
  58. package/dist/pin-field.css.d.ts +2 -0
  59. package/dist/pin-field.d.ts +3 -1
  60. package/dist/pin-field.js +129 -95
  61. package/dist/responsive-layout.css-mistica.js +10 -7
  62. package/dist/responsive-layout.css.d.ts +2 -1
  63. package/dist/responsive-layout.d.ts +1 -1
  64. package/dist/responsive-layout.js +20 -17
  65. package/dist/search-field.js +36 -35
  66. package/dist/select.css-mistica.js +16 -15
  67. package/dist/select.css.d.ts +1 -0
  68. package/dist/select.js +138 -143
  69. package/dist/text-field-base.css-mistica.js +45 -21
  70. package/dist/text-field-base.css.d.ts +30 -7
  71. package/dist/text-field-base.d.ts +11 -0
  72. package/dist/text-field-base.js +175 -140
  73. package/dist/text-field-components.css-mistica.js +13 -21
  74. package/dist/text-field-components.css.d.ts +0 -3
  75. package/dist/text-field-components.d.ts +3 -0
  76. package/dist/text-field-components.js +38 -35
  77. package/dist/text-field.js +26 -22
  78. package/dist/text.css-mistica.js +7 -7
  79. package/dist/text.css.d.ts +0 -1
  80. package/dist/text.js +24 -24
  81. package/dist/theme-context-provider.js +2 -2
  82. package/dist/utils/platform.js +8 -11
  83. package/dist-es/boxed.css-mistica.js +3 -2
  84. package/dist-es/boxed.js +17 -15
  85. package/dist-es/button-fixed-footer-layout.js +29 -24
  86. package/dist-es/button-layout.css-mistica.js +7 -7
  87. package/dist-es/button-layout.js +23 -23
  88. package/dist-es/button.js +65 -57
  89. package/dist-es/carousel.js +373 -280
  90. package/dist-es/credit-card-expiration-field.js +34 -30
  91. package/dist-es/credit-card-number-field.css-mistica.js +4 -4
  92. package/dist-es/credit-card-number-field.js +84 -70
  93. package/dist-es/cvv-field.js +68 -63
  94. package/dist-es/date-field.css-mistica.js +5 -0
  95. package/dist-es/date-field.css.ts.vanilla.css-mistica.js +2 -0
  96. package/dist-es/date-field.js +46 -40
  97. package/dist-es/date-time-field.js +47 -41
  98. package/dist-es/date-time-picker.js +55 -57
  99. package/dist-es/decimal-field.js +31 -27
  100. package/dist-es/dialog-context.js +125 -0
  101. package/dist-es/dialog.css-mistica.js +3 -3
  102. package/dist-es/dialog.js +193 -262
  103. package/dist-es/double-field.css-mistica.js +3 -2
  104. package/dist-es/email-field.js +16 -12
  105. package/dist-es/feedback.css-mistica.js +2 -2
  106. package/dist-es/feedback.js +196 -182
  107. package/dist-es/fixed-footer-layout.css-mistica.js +1 -1
  108. package/dist-es/fixed-footer-layout.js +21 -20
  109. package/dist-es/iban-field.js +42 -38
  110. package/dist-es/index.js +1778 -1778
  111. package/dist-es/inline.css-mistica.js +3 -3
  112. package/dist-es/inline.js +18 -18
  113. package/dist-es/integer-field.js +21 -17
  114. package/dist-es/loading-bar.css-mistica.js +2 -2
  115. package/dist-es/loading-bar.js +10 -13
  116. package/dist-es/month-field.js +47 -41
  117. package/dist-es/package-version.js +1 -1
  118. package/dist-es/password-field.js +54 -52
  119. package/dist-es/phone-number-field.js +53 -49
  120. package/dist-es/pin-field.css-mistica.js +2 -2
  121. package/dist-es/pin-field.js +145 -111
  122. package/dist-es/responsive-layout.css-mistica.js +3 -3
  123. package/dist-es/responsive-layout.js +27 -24
  124. package/dist-es/search-field.js +45 -44
  125. package/dist-es/select.css-mistica.js +8 -7
  126. package/dist-es/select.js +167 -172
  127. package/dist-es/style.css +1 -1
  128. package/dist-es/text-field-base.css-mistica.js +2 -2
  129. package/dist-es/text-field-base.js +189 -157
  130. package/dist-es/text-field-components.css-mistica.js +3 -2
  131. package/dist-es/text-field-components.js +52 -49
  132. package/dist-es/text-field.js +31 -27
  133. package/dist-es/text.css-mistica.js +3 -3
  134. package/dist-es/text.js +32 -32
  135. package/dist-es/theme-context-provider.js +1 -1
  136. package/dist-es/utils/platform.js +6 -6
  137. package/package.json +1 -1
  138. package/dist/password-field.css-mistica.js +0 -13
  139. package/dist/password-field.css.d.ts +0 -1
  140. package/dist-es/password-field.css-mistica.js +0 -4
  141. /package/dist/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
  142. /package/dist-es/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
@@ -51,34 +51,34 @@ function _object_spread_props(target, source) {
51
51
  }
52
52
  return target;
53
53
  }
54
- import { jsx as s, jsxs as J } from "react/jsx-runtime";
55
- import * as c from "react";
56
- import le from "./generated/mistica-icons/icon-chevron-left-regular.js";
57
- import re from "./generated/mistica-icons/icon-chevron-right-regular.js";
58
- import { useScreenSize as ne, useTheme as ce, useIsInViewport as Pe } from "./hooks.js";
59
- import Ne from "./inline.js";
60
- import { BaseTouchable as T } from "./touchable.js";
61
- import F from "classnames";
62
- import { useIsInverseVariant as Be, ThemeVariant as R } from "./theme-variant-context.js";
63
- import { listenResize as ie, getPrefixedDataAttributes as ae } from "./utils/dom.js";
64
- import { isAndroid as ue, isIos as Le, isRunningAcceptanceTest as Re } from "./utils/platform.js";
65
- import { useDocumentVisibility as Te } from "./utils/document-visibility.js";
66
- import { bulletButton as Ae, bulletButtonMobile as Ee, bulletButtonTablet as ye, bulletButtonDesktop as We, slideshowContainer as De, slideshowPrevArrowButton as Oe, slideshow as Ve, slideshowItem as ze, slideshowNextArrowButton as _e, slideshowBullets as je, bulletActiveInverse as Fe, bulletInverse as Ue, bulletActive as qe, bullet as Ke, carouselContainer as Ye, carouselPrevArrowButton as $e, carousel as Ge, centeredCarousel as He, carouselWithScrollMobile as Je, carouselWithScrollTablet as Qe, vars as P, carouselItem as Xe, carouselNextArrowButton as Ze, carouselBullets as et, noCarouselBulletsDesktop as tt, noCarouselBulletsTablet as ot, noCarouselBulletsMobile as st } from "./carousel.css-mistica.js";
67
- import { vars as lt } from "./image.css-mistica.js";
68
- import { useDesktopContainerType as rt } from "./desktop-container-type-context.js";
69
- import { VIVO_NEW_SKIN as nt } from "./skins/constants.js";
70
- import { applyCssVars as fe } from "./utils/css.js";
71
- const de = (e, t)=>{
72
- const o = Te();
73
- return Pe(t, !1) && o && !!e;
74
- }, he = (param)=>{
75
- let { currentIndex: e, numPages: t, onPress: o } = param;
54
+ import { jsx as n, jsxs as te } from "react/jsx-runtime";
55
+ import * as o from "react";
56
+ import ue from "./generated/mistica-icons/icon-chevron-left-regular.js";
57
+ import fe from "./generated/mistica-icons/icon-chevron-right-regular.js";
58
+ import { useScreenSize as de, useTheme as he, useIsInViewport as We } from "./hooks.js";
59
+ import De from "./inline.js";
60
+ import { BaseTouchable as _ } from "./touchable.js";
61
+ import H from "classnames";
62
+ import { useIsInverseVariant as Ge, ThemeVariant as z } from "./theme-variant-context.js";
63
+ import { listenResize as me, getPrefixedDataAttributes as pe } from "./utils/dom.js";
64
+ import { isAndroid as be, isIos as Oe, isRunningAcceptanceTest as Ve } from "./utils/platform.js";
65
+ import { useDocumentVisibility as ze } from "./utils/document-visibility.js";
66
+ import { bulletButton as _e, bulletButtonMobile as je, bulletButtonTablet as Fe, bulletButtonDesktop as Ue, slideshowContainer as Ye, slideshowPrevArrowButton as qe, slideshow as Ke, slideshowItem as $e, slideshowNextArrowButton as He, slideshowBullets as Je, bulletActiveInverse as Qe, bulletInverse as Xe, bulletActive as Ze, bullet as et, carouselContainer as tt, carouselPrevArrowButton as ot, carousel as st, centeredCarousel as rt, carouselWithScrollMobile as lt, carouselWithScrollTablet as nt, vars as L, carouselItem as ct, carouselNextArrowButton as at, carouselBullets as it, noCarouselBulletsDesktop as ut, noCarouselBulletsTablet as ft, noCarouselBulletsMobile as dt } from "./carousel.css-mistica.js";
67
+ import { vars as ht } from "./image.css-mistica.js";
68
+ import { useDesktopContainerType as mt } from "./desktop-container-type-context.js";
69
+ import { VIVO_NEW_SKIN as pt } from "./skins/constants.js";
70
+ import { applyCssVars as ge } from "./utils/css.js";
71
+ const ve = (e, t)=>{
72
+ const s = ze();
73
+ return We(t, !1) && s && !!e;
74
+ }, xe = (param)=>{
75
+ let { currentIndex: e, numPages: t, onPress: s } = param;
76
76
  var _t_tablet;
77
- const l = Be(), { isDesktopOrBigger: h } = ne(), m = (p)=>{
78
- const n = p === e;
79
- return l ? n ? Fe : Ue : n ? qe : Ke;
77
+ const r = Ge(), { isDesktopOrBigger: f } = de(), h = (i)=>{
78
+ const d = i === e;
79
+ return r ? d ? Qe : Xe : d ? Ze : et;
80
80
  }, I = typeof t == "number" ? t : Math.max(t.mobile, (_t_tablet = t.tablet) !== null && _t_tablet !== void 0 ? _t_tablet : t.mobile, t.desktop);
81
- return /* @__PURE__ */ s(Ne, {
81
+ return /* @__PURE__ */ n(De, {
82
82
  space: 0,
83
83
  alignItems: "center",
84
84
  dataAttributes: {
@@ -86,27 +86,72 @@ const de = (e, t)=>{
86
86
  },
87
87
  children: Array.from({
88
88
  length: I
89
- }, (p, n)=>/* @__PURE__ */ {
89
+ }, (i, d)=>/* @__PURE__ */ {
90
90
  var _t_tablet;
91
- return s(T, {
92
- className: F(typeof t == "number" ? Ae : {
93
- [Ee]: n < t.mobile,
94
- [ye]: n < ((_t_tablet = t.tablet) !== null && _t_tablet !== void 0 ? _t_tablet : t.mobile),
95
- [We]: n < t.desktop
91
+ return n(_, {
92
+ className: H(typeof t == "number" ? _e : {
93
+ [je]: d < t.mobile,
94
+ [Fe]: d < ((_t_tablet = t.tablet) !== null && _t_tablet !== void 0 ? _t_tablet : t.mobile),
95
+ [Ue]: d < t.desktop
96
96
  }),
97
- style: n === 0 ? {
97
+ style: d === 0 ? {
98
98
  paddingLeft: 0
99
99
  } : {},
100
100
  maybe: !0,
101
- onPress: h && o ? ()=>o(n) : void 0,
102
- children: /* @__PURE__ */ s("div", {
103
- className: m(n)
101
+ onPress: f && s ? ()=>s(d) : void 0,
102
+ children: /* @__PURE__ */ n("div", {
103
+ className: h(d)
104
104
  })
105
- }, n);
105
+ }, d);
106
106
  })
107
107
  });
108
- }, oe = (e, t, o)=>o ? typeof o == "number" ? o : o[e] || t[e] : t[e], ct = (e, t)=>{
109
- const o = {
108
+ }, oe = ()=>{
109
+ throw new Error("You must wrap your component with a CarouselContextProvider to use CarouselContext");
110
+ }, Ce = oe, Pe = oe, Ie = oe, Me = {
111
+ currentIndex: 0,
112
+ numPages: 0
113
+ }, se = /*#__PURE__*/ o.createContext({
114
+ goPrev: Ce,
115
+ goNext: Pe,
116
+ goToPage: Ie,
117
+ bulletsProps: Me
118
+ }), re = /*#__PURE__*/ o.createContext(null), Wt = (param)=>{
119
+ let { children: e } = param;
120
+ const [t, s] = o.useState(Me), r = o.useRef(Ce), f = o.useRef(Pe), h = o.useRef(Ie), I = o.useMemo(()=>({
121
+ goPrev: ()=>{
122
+ r.current();
123
+ },
124
+ goNext: ()=>{
125
+ f.current();
126
+ },
127
+ goToPage: function(i) {
128
+ let d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
129
+ h.current(i, d);
130
+ },
131
+ bulletsProps: t
132
+ }), [
133
+ t
134
+ ]);
135
+ return /* @__PURE__ */ n(se.Provider, {
136
+ value: I,
137
+ children: /* @__PURE__ */ n(re.Provider, {
138
+ value: {
139
+ setGoPrev: (i)=>{
140
+ r.current = i;
141
+ },
142
+ setGoNext: (i)=>{
143
+ f.current = i;
144
+ },
145
+ setGoToPage: (i)=>{
146
+ h.current = i;
147
+ },
148
+ setBulletsProps: s
149
+ },
150
+ children: e
151
+ })
152
+ });
153
+ }, Dt = ()=>o.useContext(se), Gt = se.Consumer, ae = (e, t, s)=>s ? typeof s == "number" ? s : s[e] || t[e] : t[e], bt = (e, t)=>{
154
+ const s = {
110
155
  mobile: 1,
111
156
  tablet: 2,
112
157
  desktop: {
@@ -115,247 +160,263 @@ const de = (e, t)=>{
115
160
  large: 3
116
161
  }
117
162
  };
118
- if (!t) return _object_spread_props(_object_spread({}, o), {
119
- desktop: oe(e, o.desktop)
163
+ if (!t) return _object_spread_props(_object_spread({}, s), {
164
+ desktop: ae(e, s.desktop)
120
165
  });
121
166
  if (typeof t == "number") return {
122
167
  mobile: t,
123
168
  tablet: t,
124
169
  desktop: t
125
170
  };
126
- const l = oe(e, o.desktop, t.desktop);
127
- return _object_spread_props(_object_spread({}, o, t), {
128
- desktop: l
171
+ const r = ae(e, s.desktop, t.desktop);
172
+ return _object_spread_props(_object_spread({}, s, t), {
173
+ desktop: r
129
174
  });
130
- }, se = (e, t)=>{
175
+ }, ie = (e, t)=>{
131
176
  if (e.length === 0) return [];
132
- const o = Math.ceil(e.length / t), l = [];
133
- for(let h = 0; h < e.length; h += o)l.push(e[h]);
134
- return l[l.length - 1] = e[e.length - o], l;
135
- }, it = (e, t)=>{
136
- const o = [];
137
- for(let l = 0; l < t.length; l++)l === 0 ? o.push(t[0]) : o.push((t[l] + t[l - 1]) / 2);
138
- for(let l = o.length - 1; l >= 0; l--)if (e - o[l] >= -1) return l;
177
+ const s = Math.ceil(e.length / t), r = [];
178
+ for(let f = 0; f < e.length; f += s)r.push(e[f]);
179
+ return r[r.length - 1] = e[e.length - s], r;
180
+ }, gt = (e, t)=>{
181
+ const s = [];
182
+ for(let r = 0; r < t.length; r++)r === 0 ? s.push(t[0]) : s.push((t[r] + t[r - 1]) / 2);
183
+ for(let r = s.length - 1; r >= 0; r--)if (e - s[r] >= -1) return r;
139
184
  return 0;
140
- }, me = 5e3, be = (param)=>{
141
- let { items: e, itemStyle: t, itemClassName: o, withBullets: l, renderBullets: h, initialActiveItem: m, itemsPerPage: I, itemsToScroll: p, mobilePageOffset: n, gap: S, free: N, centered: B, autoplay: g, onPageChange: x, dataAttributes: U } = param;
142
- const { texts: A, platformOverrides: M, skinName: E } = ce(), a = rt(), i = ct(a || "large", I), { isDesktopOrBigger: C, isTablet: k } = ne(), q = k ? i.tablet : i.mobile, v = Math.max(Math.floor(C ? i.desktop : q), 1), b = c.useRef(null), K = Math.ceil(e.length / Math.max(Math.floor(i.mobile), 1)), Y = Math.ceil(e.length / Math.max(Math.floor(i.tablet), 1)), Q = Math.ceil(e.length / Math.max(Math.floor(i.desktop), 1)), y = Math.ceil(e.length / v), [{ scrollLeft: X, scrollRight: $ }, ge] = c.useState({
185
+ }, we = 5e3, Ne = (param)=>{
186
+ let { items: e, itemStyle: t, itemClassName: s, withBullets: r, renderBullets: f, initialActiveItem: h, itemsPerPage: I, itemsToScroll: i, mobilePageOffset: d, gap: C, free: b, centered: S, autoplay: x, onPageChange: A, dataAttributes: y } = param;
187
+ const { texts: M, platformOverrides: k, skinName: J } = he(), Q = mt(), a = bt(Q || "large", I), { isDesktopOrBigger: R, isTablet: W } = de(), j = W ? a.tablet : a.mobile, P = Math.max(Math.floor(R ? a.desktop : j), 1), l = o.useRef(null), m = Math.ceil(e.length / Math.max(Math.floor(a.mobile), 1)), v = Math.ceil(e.length / Math.max(Math.floor(a.tablet), 1)), w = Math.ceil(e.length / Math.max(Math.floor(a.desktop), 1)), B = Math.ceil(e.length / P), [{ scrollLeft: D, scrollRight: G }, ke] = o.useState({
143
188
  scrollLeft: 0,
144
189
  scrollRight: 0
145
- }), [G, ve] = c.useState([]), W = c.useMemo(()=>se(G, y), [
146
- G,
147
- y
148
- ]), D = p ? se(G, Math.ceil(e.length / p)) : W, Ie = $ !== 0, xe = X !== 0;
149
- c.useEffect(()=>{
150
- if (b.current) {
151
- const r = b.current, u = ()=>{
152
- const { scrollWidth: z, clientWidth: L } = r, _ = Math.round(r.scrollLeft), j = Math.round(z - (_ + L));
153
- ge({
154
- scrollLeft: _,
155
- scrollRight: j
190
+ }), [X, Re] = o.useState([]), F = o.useMemo(()=>ie(X, B), [
191
+ X,
192
+ B
193
+ ]), U = i ? ie(X, Math.ceil(e.length / i)) : F, Be = G !== 0, Te = D !== 0;
194
+ o.useEffect(()=>{
195
+ if (l.current) {
196
+ const c = l.current, u = ()=>{
197
+ const { scrollWidth: q, clientWidth: V } = c, K = Math.round(c.scrollLeft), $ = Math.round(q - (K + V));
198
+ ke({
199
+ scrollLeft: K,
200
+ scrollRight: $
156
201
  });
157
- }, f = ()=>{
158
- const z = r.scrollWidth - r.clientWidth;
159
- ve(Array.from(r.querySelectorAll("[data-item]")).map((L, _)=>{
160
- if (_ === e.length - 1) return z;
161
- const j = L.offsetLeft, Se = parseInt(getComputedStyle(L).scrollMargin), ke = B && !C ? j - L.clientWidth / 2 : j;
162
- return Math.min(ke - Se - r.offsetLeft, z);
202
+ }, p = ()=>{
203
+ const q = c.scrollWidth - c.clientWidth;
204
+ Re(Array.from(c.querySelectorAll("[data-item]")).map((V, K)=>{
205
+ if (K === e.length - 1) return q;
206
+ const $ = V.offsetLeft, Ae = parseInt(getComputedStyle(V).scrollMargin), ye = S && !R ? $ - V.clientWidth / 2 : $;
207
+ return Math.min(ye - Ae - c.offsetLeft, q);
163
208
  }));
164
209
  };
165
- u(), f(), r.addEventListener("scroll", u);
166
- const d = ie(r, ()=>{
167
- u(), f();
210
+ u(), p(), c.addEventListener("scroll", u);
211
+ const g = me(c, ()=>{
212
+ u(), p();
168
213
  });
169
214
  return ()=>{
170
- r.removeEventListener("scroll", u), d();
215
+ c.removeEventListener("scroll", u), g();
171
216
  };
172
217
  }
173
218
  return ()=>{};
174
219
  }, [
175
- i.desktop,
176
- i.tablet,
177
- i.mobile,
178
- y,
179
- S,
220
+ a.desktop,
221
+ a.tablet,
222
+ a.mobile,
180
223
  B,
181
224
  C,
225
+ S,
226
+ R,
182
227
  e.length
183
228
  ]);
184
- const O = c.useCallback(function(r) {
229
+ const T = o.useCallback(function(c) {
185
230
  let u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
186
- const f = b.current;
187
- if (f) {
188
- const d = W[r];
189
- f.scrollTo({
190
- left: d,
231
+ const p = l.current;
232
+ if (p) {
233
+ const g = F[c];
234
+ p.scrollTo({
235
+ left: g,
191
236
  behavior: u ? "smooth" : "auto"
192
237
  });
193
238
  }
194
239
  }, [
195
- W
196
- ]), Me = c.useCallback(()=>{
197
- const r = b.current;
198
- if (r) {
199
- const { scrollLeft: u } = r, f = [
200
- ...D
201
- ].reverse().find((d)=>d - u < -1);
202
- r.scrollTo({
203
- left: f,
240
+ F
241
+ ]), Z = o.useCallback(()=>{
242
+ const c = l.current;
243
+ if (c) {
244
+ const { scrollLeft: u } = c, p = [
245
+ ...U
246
+ ].reverse().find((g)=>g - u < -1);
247
+ c.scrollTo({
248
+ left: p,
204
249
  behavior: "smooth"
205
250
  });
206
251
  }
207
252
  }, [
208
- D
209
- ]), H = c.useCallback(()=>{
210
- const r = b.current;
211
- if (r) {
212
- const { scrollLeft: u } = r, f = D.find((d)=>d - u > 1);
213
- r.scrollTo({
214
- left: f,
253
+ U
254
+ ]), O = o.useCallback(()=>{
255
+ const c = l.current;
256
+ if (c) {
257
+ const { scrollLeft: u } = c, p = U.find((g)=>g - u > 1);
258
+ c.scrollTo({
259
+ left: p,
215
260
  behavior: "smooth"
216
261
  });
217
262
  }
218
263
  }, [
219
- D
220
- ]), Z = de(!!g, b);
221
- c.useEffect(()=>{
222
- m !== void 0 && O(Math.floor(m / v), !1);
264
+ U
265
+ ]), le = ve(!!x, l);
266
+ o.useEffect(()=>{
267
+ h !== void 0 && T(Math.floor(h / P), !1);
223
268
  }, [
224
- m,
225
- O,
226
- v
227
- ]), c.useEffect(()=>{
228
- if (Z && g) {
229
- const r = typeof g == "boolean" ? me : g.time, u = typeof g == "object" && g.loop, f = setInterval(()=>{
230
- var d;
231
- $ !== 0 ? H() : u && ((d = b.current) == null || d.scrollTo({
269
+ h,
270
+ T,
271
+ P
272
+ ]), o.useEffect(()=>{
273
+ if (le && x) {
274
+ const c = typeof x == "boolean" ? we : x.time, u = typeof x == "object" && x.loop, p = setInterval(()=>{
275
+ var g;
276
+ G !== 0 ? O() : u && ((g = l.current) == null || g.scrollTo({
232
277
  left: 0,
233
278
  behavior: "smooth"
234
279
  }));
235
- }, r);
236
- return ()=>clearInterval(f);
280
+ }, c);
281
+ return ()=>clearInterval(p);
237
282
  }
238
283
  }, [
239
- g,
240
- H,
241
- $,
242
- Z
284
+ x,
285
+ O,
286
+ G,
287
+ le
243
288
  ]);
244
- const w = it(X, W), ee = c.useRef(!m), te = c.useRef(0);
245
- c.useEffect(()=>{
246
- if (x) {
247
- const r = Math.min((w + 1) * v - 1, e.length - 1), u = [];
248
- for(let f = 0; f < v; f++){
249
- const d = r - f;
250
- d >= 0 && u.unshift(d);
289
+ const N = gt(D, F), ne = o.useRef(!h), ce = o.useRef(0);
290
+ o.useEffect(()=>{
291
+ if (A) {
292
+ const c = Math.min((N + 1) * P - 1, e.length - 1), u = [];
293
+ for(let p = 0; p < P; p++){
294
+ const g = c - p;
295
+ g >= 0 && u.unshift(g);
251
296
  }
252
- ee.current ? te.current !== w && x({
253
- pageIndex: w,
297
+ ne.current ? ce.current !== N && A({
298
+ pageIndex: N,
254
299
  shownItemIndexes: u
255
- }) : ee.current = u.includes(m || 0), te.current = w;
300
+ }) : ne.current = u.includes(h || 0), ce.current = N;
256
301
  }
257
302
  }, [
258
- w,
303
+ N,
259
304
  e.length,
260
- v,
305
+ P,
306
+ h,
307
+ A
308
+ ]);
309
+ const E = o.useContext(re), ee = o.useMemo(()=>({
310
+ currentIndex: N,
311
+ numPages: {
312
+ mobile: m,
313
+ tablet: v,
314
+ desktop: w
315
+ }
316
+ }), [
317
+ N,
318
+ w,
261
319
  m,
262
- x
320
+ v
263
321
  ]);
264
- let V = null;
265
- h ? V = h({
266
- numPages: y,
267
- currentIndex: w,
268
- onPress: O
269
- }) : l && (V = /* @__PURE__ */ s(he, {
270
- numPages: {
271
- mobile: K,
272
- tablet: Y,
273
- desktop: Q
274
- },
275
- currentIndex: w,
276
- onPress: O
277
- }));
278
- const Ce = "64px", we = "36px";
279
- return /* @__PURE__ */ J("div", _object_spread_props(_object_spread({}, ae(_object_spread({
322
+ o.useEffect(()=>{
323
+ E && (E.setGoPrev(Z), E.setGoNext(O), E.setGoToPage(T), E.setBulletsProps(ee));
324
+ }, [
325
+ E,
326
+ O,
327
+ Z,
328
+ ee,
329
+ T
330
+ ]);
331
+ let Y = null;
332
+ f ? Y = f({
333
+ numPages: B,
334
+ currentIndex: N,
335
+ onPress: T
336
+ }) : r && (Y = /* @__PURE__ */ n(xe, _object_spread_props(_object_spread({}, ee), {
337
+ onPress: T
338
+ })));
339
+ const Ee = "64px", Le = "36px";
340
+ return /* @__PURE__ */ te("div", _object_spread_props(_object_spread({}, pe(_object_spread({
280
341
  "component-name": "Carousel"
281
- }, U))), {
342
+ }, y))), {
282
343
  children: [
283
- /* @__PURE__ */ J("div", {
284
- className: Ye,
344
+ /* @__PURE__ */ te("div", {
345
+ className: tt,
285
346
  children: [
286
- /* @__PURE__ */ s(R, {
347
+ /* @__PURE__ */ n(z, {
287
348
  isInverse: !1,
288
- children: /* @__PURE__ */ s(T, {
289
- className: $e,
290
- "aria-label": A.carouselPrevButton,
291
- onPress: Me,
292
- disabled: !xe,
293
- children: /* @__PURE__ */ s(le, {})
349
+ children: /* @__PURE__ */ n(_, {
350
+ className: ot,
351
+ "aria-label": M.carouselPrevButton,
352
+ onPress: Z,
353
+ disabled: !Te,
354
+ children: /* @__PURE__ */ n(ue, {})
294
355
  })
295
356
  }),
296
- /* @__PURE__ */ s("div", {
297
- className: F(Ge, {
298
- [He]: B,
299
- [Je]: K > 1,
300
- [Qe]: Y > 1
357
+ /* @__PURE__ */ n("div", {
358
+ className: H(st, {
359
+ [rt]: S,
360
+ [lt]: m > 1,
361
+ [nt]: v > 1
301
362
  }),
302
- style: _object_spread_props(_object_spread({}, fe(_object_spread({
303
- [P.itemsPerPageDesktop]: String(i.desktop),
304
- [P.itemsPerPageTablet]: String(i.tablet),
305
- [P.itemsPerPageMobile]: String(i.mobile)
306
- }, n === "large" ? {
307
- [P.mobilePageOffset]: Ce
308
- } : E === nt ? {
309
- [P.mobilePageOffset]: we
310
- } : {}, S !== void 0 ? {
311
- [P.gap]: String(S)
363
+ style: _object_spread_props(_object_spread({}, ge(_object_spread({
364
+ [L.itemsPerPageDesktop]: String(a.desktop),
365
+ [L.itemsPerPageTablet]: String(a.tablet),
366
+ [L.itemsPerPageMobile]: String(a.mobile)
367
+ }, d === "large" ? {
368
+ [L.mobilePageOffset]: Ee
369
+ } : J === pt ? {
370
+ [L.mobilePageOffset]: Le
371
+ } : {}, C !== void 0 ? {
372
+ [L.gap]: String(C)
312
373
  } : {}))), {
313
- scrollSnapType: N ? "initial" : "x mandatory",
374
+ scrollSnapType: b ? "initial" : "x mandatory",
314
375
  // Hack to fix https://jira.tid.es/browse/NOVUMCC-8988
315
376
  // there is a webkit rendering bug that causes a half pixel white line to appear at
316
377
  // the bottom of the scrollable area in retina displays when it has a height with
317
378
  // decimals. This extra padding avoids that line to partially cover the carousel
318
379
  // slides border:
319
- paddingBottom: Le(M) && !Re(M) ? 0.5 : void 0
380
+ paddingBottom: Oe(k) && !Ve(k) ? 0.5 : void 0
320
381
  }),
321
- ref: b,
322
- children: e.map((r, u)=>/* @__PURE__ */ s("div", {
323
- className: F(Xe, o),
382
+ ref: l,
383
+ children: e.map((c, u)=>/* @__PURE__ */ n("div", {
384
+ className: H(ct, s),
324
385
  style: _object_spread_props(_object_spread({}, t), {
325
- scrollSnapStop: ue(M) ? "always" : "normal"
386
+ scrollSnapStop: be(k) ? "always" : "normal"
326
387
  }),
327
388
  "data-item": !0,
328
- children: r
389
+ children: c
329
390
  }, u))
330
391
  }),
331
- /* @__PURE__ */ s(R, {
392
+ /* @__PURE__ */ n(z, {
332
393
  isInverse: !1,
333
- children: /* @__PURE__ */ s(T, {
334
- className: Ze,
335
- "aria-label": A.carouselNextButton,
336
- onPress: H,
337
- disabled: !Ie,
338
- children: /* @__PURE__ */ s(re, {})
394
+ children: /* @__PURE__ */ n(_, {
395
+ className: at,
396
+ "aria-label": M.carouselNextButton,
397
+ onPress: O,
398
+ disabled: !Be,
399
+ children: /* @__PURE__ */ n(fe, {})
339
400
  })
340
401
  })
341
402
  ]
342
403
  }),
343
- V && /* @__PURE__ */ s("div", {
344
- className: F(et, {
345
- [tt]: Q <= 1,
346
- [ot]: Y <= 1,
347
- [st]: K <= 1
404
+ Y && /* @__PURE__ */ n("div", {
405
+ className: H(it, {
406
+ [ut]: w <= 1,
407
+ [ft]: v <= 1,
408
+ [dt]: m <= 1
348
409
  }),
349
- children: V
410
+ children: Y
350
411
  })
351
412
  ]
352
413
  }));
353
- }, Pt = (e)=>/* @__PURE__ */ s(be, _object_spread({}, e)), Nt = (param)=>{
354
- let { items: e, itemStyle: t, itemClassName: o, withBullets: l, renderBullets: h, initialActiveItem: m, onPageChange: I, dataAttributes: p } = param;
355
- return /* @__PURE__ */ s(be, {
414
+ }, Ot = (e)=>/* @__PURE__ */ n(Ne, _object_spread({}, e)), Vt = (param)=>{
415
+ let { items: e, itemStyle: t, itemClassName: s, withBullets: r, renderBullets: f, initialActiveItem: h, onPageChange: I, dataAttributes: i } = param;
416
+ return /* @__PURE__ */ n(Ne, {
356
417
  items: e,
357
418
  itemStyle: t,
358
- itemClassName: o,
419
+ itemClassName: s,
359
420
  itemsPerPage: {
360
421
  mobile: 1,
361
422
  tablet: 1,
@@ -364,130 +425,162 @@ const de = (e, t)=>{
364
425
  centered: !0,
365
426
  itemsToScroll: 1,
366
427
  gap: 0,
367
- withBullets: l,
368
- renderBullets: h,
369
- initialActiveItem: m,
428
+ withBullets: r,
429
+ renderBullets: f,
430
+ initialActiveItem: h,
370
431
  onPageChange: I,
371
- dataAttributes: p
432
+ dataAttributes: i
372
433
  });
373
- }, pe = /*#__PURE__*/ c.createContext(!1), Bt = ()=>c.useContext(pe), at = (param)=>{
434
+ }, Se = /*#__PURE__*/ o.createContext(!1), zt = ()=>o.useContext(Se), vt = (param)=>{
374
435
  let { children: e } = param;
375
- return /* @__PURE__ */ s(pe.Provider, {
436
+ return /* @__PURE__ */ n(Se.Provider, {
376
437
  value: !0,
377
438
  children: e
378
439
  });
379
- }, Lt = (param)=>{
380
- let { items: e, withBullets: t, autoplay: o, onPageChange: l, dataAttributes: h, inverseBullets: m = !0 } = param;
381
- const { texts: I, platformOverrides: p } = ce(), n = c.useRef(null), [{ scrollLeft: S, scrollRight: N }, B] = c.useState({
440
+ }, _t = (param)=>{
441
+ let { items: e, withBullets: t, autoplay: s, initialPageIndex: r = 0, onPageChange: f, dataAttributes: h, inverseBullets: I = !0 } = param;
442
+ const { texts: i, platformOverrides: d } = he(), C = o.useContext(re), b = o.useRef(null), [{ scrollLeft: S, scrollRight: x }, A] = o.useState({
382
443
  scrollLeft: 0,
383
444
  scrollRight: 0
384
- }), g = c.useCallback(()=>{
385
- const a = n.current;
386
- a && a.scrollBy({
387
- left: -a.clientWidth,
445
+ }), y = o.useCallback(()=>{
446
+ const l = b.current;
447
+ l && l.scrollBy({
448
+ left: -l.clientWidth,
388
449
  behavior: "smooth"
389
450
  });
390
- }, []), x = c.useCallback(()=>{
391
- const a = n.current;
392
- a && a.scrollBy({
393
- left: a.clientWidth,
451
+ }, []), M = o.useCallback(()=>{
452
+ const l = b.current;
453
+ l && l.scrollBy({
454
+ left: l.clientWidth,
394
455
  behavior: "smooth"
395
456
  });
396
- }, []), U = N !== 0, A = S !== 0, M = n.current ? Math.floor((S + n.current.clientWidth / 2) / n.current.clientWidth) : 0;
397
- c.useLayoutEffect(()=>{
398
- const a = n.current;
399
- if (a) {
400
- const i = ()=>{
401
- const { scrollWidth: k, clientWidth: q } = a, v = Math.round(a.scrollLeft), b = Math.round(k - (v + q));
402
- B({
403
- scrollLeft: v,
404
- scrollRight: b
457
+ }, []), k = o.useCallback(function(l) {
458
+ let m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
459
+ const v = b.current;
460
+ v && v.scrollTo({
461
+ left: v.clientWidth * l,
462
+ behavior: m ? "smooth" : "auto"
463
+ });
464
+ }, [
465
+ b
466
+ ]), J = x !== 0, Q = S !== 0, a = b.current ? Math.floor((S + b.current.clientWidth / 2) / b.current.clientWidth) : 0;
467
+ o.useLayoutEffect(()=>{
468
+ const l = b.current;
469
+ if (l) {
470
+ const m = ()=>{
471
+ const { scrollWidth: w, clientWidth: B } = l, D = Math.round(l.scrollLeft), G = Math.round(w - (D + B));
472
+ A({
473
+ scrollLeft: D,
474
+ scrollRight: G
405
475
  });
406
476
  };
407
- i(), a.addEventListener("scroll", i);
408
- const C = ie(a, i);
477
+ m(), l.addEventListener("scroll", m);
478
+ const v = me(l, m);
409
479
  return ()=>{
410
- a.removeEventListener("scroll", i), C();
480
+ l.removeEventListener("scroll", m), v();
411
481
  };
412
482
  }
413
483
  }, [
414
484
  e.length
415
485
  ]);
416
- const E = de(!!o, n);
417
- return c.useEffect(()=>{
418
- if (E && o) {
419
- const a = typeof o == "boolean" ? me : o.time, i = typeof o == "object" && o.loop, C = setInterval(()=>{
420
- var k;
421
- N !== 0 ? x() : i && ((k = n.current) == null || k.scrollTo({
486
+ const R = ve(!!s, b);
487
+ o.useEffect(()=>{
488
+ if (R && s) {
489
+ const l = typeof s == "boolean" ? we : s.time, m = typeof s == "object" && s.loop, v = setInterval(()=>{
490
+ var w;
491
+ x !== 0 ? M() : m && ((w = b.current) == null || w.scrollTo({
422
492
  left: 0,
423
493
  behavior: "smooth"
424
494
  }));
425
- }, a);
426
- return ()=>clearInterval(C);
495
+ }, l);
496
+ return ()=>clearInterval(v);
427
497
  }
428
498
  }, [
429
- o,
499
+ s,
500
+ M,
430
501
  x,
431
- N,
432
- E
433
- ]), c.useEffect(()=>{
434
- l && l(M);
502
+ R
503
+ ]);
504
+ const W = o.useRef(!1), j = o.useRef(0);
505
+ o.useEffect(()=>{
506
+ f && (W.current ? j.current !== a && f(a) : W.current = r === a), j.current = a;
435
507
  }, [
508
+ a,
509
+ r,
510
+ f
511
+ ]), o.useEffect(()=>{
512
+ const l = b.current;
513
+ r !== void 0 && l && !W.current && l.scrollTo({
514
+ left: l.clientWidth * r
515
+ });
516
+ }, [
517
+ r
518
+ ]);
519
+ const P = o.useMemo(()=>({
520
+ currentIndex: a,
521
+ numPages: e.length
522
+ }), [
523
+ a,
524
+ e.length
525
+ ]);
526
+ return o.useEffect(()=>{
527
+ C && (C.setGoPrev(y), C.setGoNext(M), C.setGoToPage(k), C.setBulletsProps(P));
528
+ }, [
529
+ C,
436
530
  M,
437
- l
438
- ]), /* @__PURE__ */ s(at, {
439
- children: /* @__PURE__ */ J("div", _object_spread_props(_object_spread({
440
- className: De
441
- }, ae(h, "SlideShow")), {
531
+ y,
532
+ P,
533
+ k
534
+ ]), /* @__PURE__ */ n(vt, {
535
+ children: /* @__PURE__ */ te("div", _object_spread_props(_object_spread({
536
+ className: Ye
537
+ }, pe(h, "SlideShow")), {
442
538
  children: [
443
- /* @__PURE__ */ s(R, {
539
+ /* @__PURE__ */ n(z, {
444
540
  isInverse: !1,
445
- children: /* @__PURE__ */ s(T, {
446
- className: Oe,
447
- "aria-label": I.carouselPrevButton,
448
- onPress: g,
449
- disabled: !A,
450
- children: /* @__PURE__ */ s(le, {})
541
+ children: /* @__PURE__ */ n(_, {
542
+ className: qe,
543
+ "aria-label": i.carouselPrevButton,
544
+ onPress: y,
545
+ disabled: !Q,
546
+ children: /* @__PURE__ */ n(ue, {})
451
547
  })
452
548
  }),
453
- /* @__PURE__ */ s("div", {
454
- style: fe({
455
- [lt.mediaBorderRadius]: "0px"
549
+ /* @__PURE__ */ n("div", {
550
+ style: ge({
551
+ [ht.mediaBorderRadius]: "0px"
456
552
  }),
457
- children: /* @__PURE__ */ s("div", {
458
- className: Ve,
459
- ref: n,
460
- children: e.map((a, i)=>/* @__PURE__ */ s("div", {
461
- className: ze,
553
+ children: /* @__PURE__ */ n("div", {
554
+ className: Ke,
555
+ ref: b,
556
+ children: e.map((l, m)=>/* @__PURE__ */ n("div", {
557
+ className: $e,
462
558
  style: {
463
- scrollSnapStop: ue(p) ? "always" : "normal"
559
+ scrollSnapStop: be(d) ? "always" : "normal"
464
560
  },
465
- children: a
466
- }, i))
561
+ children: l
562
+ }, m))
467
563
  })
468
564
  }),
469
- /* @__PURE__ */ s(R, {
565
+ /* @__PURE__ */ n(z, {
470
566
  isInverse: !1,
471
- children: /* @__PURE__ */ s(T, {
472
- className: _e,
473
- "aria-label": I.carouselNextButton,
474
- onPress: x,
475
- disabled: !U,
476
- children: /* @__PURE__ */ s(re, {})
567
+ children: /* @__PURE__ */ n(_, {
568
+ className: He,
569
+ "aria-label": i.carouselNextButton,
570
+ onPress: M,
571
+ disabled: !J,
572
+ children: /* @__PURE__ */ n(fe, {})
477
573
  })
478
574
  }),
479
- t && e.length > 1 && /* @__PURE__ */ s(R, {
480
- isInverse: m,
481
- children: /* @__PURE__ */ s("div", {
482
- className: je,
483
- children: /* @__PURE__ */ s(he, {
484
- numPages: e.length,
485
- currentIndex: M
486
- })
575
+ t && e.length > 1 && /* @__PURE__ */ n(z, {
576
+ isInverse: I,
577
+ children: /* @__PURE__ */ n("div", {
578
+ className: Je,
579
+ children: /* @__PURE__ */ n(xe, _object_spread({}, P))
487
580
  })
488
581
  })
489
582
  ]
490
583
  }))
491
584
  });
492
585
  };
493
- export { Pt as Carousel, Nt as CenteredCarousel, at as IsInsideSlideshowProvider, he as PageBullets, Lt as Slideshow, Bt as useIsInsideSlideshowContext };
586
+ export { Ot as Carousel, Gt as CarouselContextConsummer, Wt as CarouselContextProvider, Vt as CenteredCarousel, vt as IsInsideSlideshowProvider, xe as PageBullets, _t as Slideshow, Dt as useCarouselContext, zt as useIsInsideSlideshowContext };