welcome-ui 10.6.1 → 10.6.3

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/dist/Swiper.js CHANGED
@@ -1,96 +1,19 @@
1
1
  "use client";
2
2
  import './Swiper.css';
3
- import { jsx as $ } from "react/jsx-runtime";
4
- import { a as z, g as pe, c as K, u as fe } from "./index-B6iGEm-i.js";
5
- import { useRef as Z, useEffect as W, Children as se, cloneElement as ge, createContext as me, useContext as be, useState as H, useMemo as ee, useCallback as A } from "react";
3
+ import { jsx as E } from "react/jsx-runtime";
4
+ import { c as U, a as G, g as fe, u as pe } from "./index-B6iGEm-i.js";
5
+ import { createContext as me, useContext as ge, useRef as W, useEffect as M, Children as ie, cloneElement as be, useCallback as R, useState as K, useMemo as Z } from "react";
6
+ import { Button as ae } from "./Button.js";
7
+ import { Icon as oe } from "./Icon.js";
6
8
  import { u as we } from "./use-viewport-DuW6YjHT.js";
7
- import { Button as oe } from "./Button.js";
8
- import { Icon as le } from "./Icon.js";
9
- var Y, ae;
10
- function he() {
11
- if (ae) return Y;
12
- ae = 1;
13
- var i = "Expected a function", l = NaN, f = "[object Symbol]", o = /^\s+|\s+$/g, s = /^[-+]0x[0-9a-f]+$/i, m = /^0b[01]+$/i, t = /^0o[0-7]+$/i, n = parseInt, b = typeof z == "object" && z && z.Object === Object && z, r = typeof self == "object" && self && self.Object === Object && self, c = b || r || Function("return this")(), v = Object.prototype, E = v.toString, V = Math.max, M = Math.min, S = function() {
14
- return c.Date.now();
15
- };
16
- function N(e, u, w) {
17
- var _, L, B, O, a, g, p = 0, I = !1, P = !1, k = !0;
18
- if (typeof e != "function")
19
- throw new TypeError(i);
20
- u = j(u) || 0, x(w) && (I = !!w.leading, P = "maxWait" in w, B = P ? V(j(w.maxWait) || 0, u) : B, k = "trailing" in w ? !!w.trailing : k);
21
- function C(d) {
22
- var T = _, F = L;
23
- return _ = L = void 0, p = d, O = e.apply(F, T), O;
24
- }
25
- function J(d) {
26
- return p = d, a = setTimeout(q, u), I ? C(d) : O;
27
- }
28
- function ne(d) {
29
- var T = d - g, F = d - p, ie = u - T;
30
- return P ? M(ie, B - F) : ie;
31
- }
32
- function R(d) {
33
- var T = d - g, F = d - p;
34
- return g === void 0 || T >= u || T < 0 || P && F >= B;
35
- }
36
- function q() {
37
- var d = S();
38
- if (R(d))
39
- return re(d);
40
- a = setTimeout(q, ne(d));
41
- }
42
- function re(d) {
43
- return a = void 0, k && _ ? C(d) : (_ = L = void 0, O);
44
- }
45
- function de() {
46
- a !== void 0 && clearTimeout(a), p = 0, _ = g = L = a = void 0;
47
- }
48
- function ue() {
49
- return a === void 0 ? O : re(S());
50
- }
51
- function Q() {
52
- var d = S(), T = R(d);
53
- if (_ = arguments, L = this, g = d, T) {
54
- if (a === void 0)
55
- return J(g);
56
- if (P)
57
- return a = setTimeout(q, u), C(g);
58
- }
59
- return a === void 0 && (a = setTimeout(q, u)), O;
60
- }
61
- return Q.cancel = de, Q.flush = ue, Q;
62
- }
63
- function x(e) {
64
- var u = typeof e;
65
- return !!e && (u == "object" || u == "function");
66
- }
67
- function y(e) {
68
- return !!e && typeof e == "object";
69
- }
70
- function D(e) {
71
- return typeof e == "symbol" || y(e) && E.call(e) == f;
72
- }
73
- function j(e) {
74
- if (typeof e == "number")
75
- return e;
76
- if (D(e))
77
- return l;
78
- if (x(e)) {
79
- var u = typeof e.valueOf == "function" ? e.valueOf() : e;
80
- e = x(u) ? u + "" : u;
81
- }
82
- if (typeof e != "string")
83
- return e === 0 ? e : +e;
84
- e = e.replace(o, "");
85
- var w = m.test(e);
86
- return w || t.test(e) ? n(e.slice(2), w ? 2 : 8) : s.test(e) ? l : +e;
87
- }
88
- return Y = N, Y;
89
- }
90
- var Se = he();
91
- const xe = /* @__PURE__ */ pe(Se), ve = "_root_eam2c_3", _e = "_container_eam2c_11", Pe = "_arrow_eam2c_77", U = {
92
- root: ve,
93
- container: _e,
9
+ const ce = me(null), ee = () => {
10
+ const i = ge(ce);
11
+ if (!i)
12
+ throw new Error("Swiper components must be used within a Swiper component");
13
+ return i;
14
+ }, he = "_root_eam2c_3", Se = "_container_eam2c_11", xe = "_arrow_eam2c_77", X = {
15
+ root: he,
16
+ container: Se,
94
17
  "container-mobile": "_container-mobile_eam2c_41",
95
18
  "container-tablet": "_container-tablet_eam2c_50",
96
19
  "container-desktop": "_container-desktop_eam2c_59",
@@ -99,151 +22,147 @@ const xe = /* @__PURE__ */ pe(Se), ve = "_root_eam2c_3", _e = "_container_eam2c_
99
22
  "arrow-placement-side-left": "_arrow-placement-side-left_eam2c_84",
100
23
  "arrow-placement-side-right": "_arrow-placement-side-right_eam2c_87",
101
24
  "arrow-mobile": "_arrow-mobile_eam2c_90",
102
- arrow: Pe,
25
+ arrow: xe,
103
26
  "arrow-desktop": "_arrow-desktop_eam2c_99",
104
27
  "arrow-background": "_arrow-background_eam2c_104"
105
- }, ke = K(U), ye = ({
28
+ }, ve = U(X), _e = ({
106
29
  children: i,
107
- className: l,
108
- placement: f = "side",
109
- size: o = "md",
110
- variant: s,
111
- ...m
30
+ className: o,
31
+ placement: t = "side",
32
+ size: s = "md",
33
+ variant: e,
34
+ ...a
112
35
  }) => {
113
36
  const {
114
- navigation: { desktop: t, goNext: n, isNextDisabled: b, mobile: r }
115
- } = te();
116
- return /* @__PURE__ */ $(
117
- oe,
37
+ navigation: { desktop: g, goNext: r, isNextDisabled: l, mobile: d }
38
+ } = ee();
39
+ return /* @__PURE__ */ E(
40
+ ae,
118
41
  {
119
42
  "aria-label": "Next slide",
120
- className: ke(
43
+ className: ve(
121
44
  "arrow",
122
- t && "arrow-desktop",
123
- r && "arrow-mobile",
124
- f === "side" && "arrow-placement-side",
125
- f === "side" && "arrow-placement-side-right",
126
- l
45
+ g && "arrow-desktop",
46
+ d && "arrow-mobile",
47
+ t === "side" && "arrow-placement-side",
48
+ t === "side" && "arrow-placement-side-right",
49
+ o
127
50
  ),
128
- disabled: b,
129
- onClick: n,
130
- size: o,
131
- variant: s ?? "secondary",
132
- ...m,
133
- children: i ?? /* @__PURE__ */ $(le, { name: "angle-right-b" })
51
+ disabled: l,
52
+ onClick: r,
53
+ size: s,
54
+ variant: e ?? "secondary",
55
+ ...a,
56
+ children: i ?? /* @__PURE__ */ E(oe, { name: "angle-right-b" })
134
57
  }
135
58
  );
136
- }, Le = K(U), Ie = ({
59
+ }, ke = U(X), Pe = ({
137
60
  children: i,
138
- className: l,
139
- placement: f = "side",
140
- size: o = "md",
141
- variant: s,
142
- ...m
61
+ className: o,
62
+ placement: t = "side",
63
+ size: s = "md",
64
+ variant: e,
65
+ ...a
143
66
  }) => {
144
67
  const {
145
- navigation: { desktop: t, goPrev: n, isPrevDisabled: b, mobile: r }
146
- } = te();
147
- return /* @__PURE__ */ $(
148
- oe,
68
+ navigation: { desktop: g, goPrev: r, isPrevDisabled: l, mobile: d }
69
+ } = ee();
70
+ return /* @__PURE__ */ E(
71
+ ae,
149
72
  {
150
73
  "aria-label": "Previous slide",
151
- className: Le(
74
+ className: ke(
152
75
  "arrow",
153
- t && "arrow-mobile",
154
- r && "arrow-desktop",
155
- f === "side" && "arrow-placement-side",
156
- f === "side" && "arrow-placement-side-left",
157
- l
76
+ g && "arrow-mobile",
77
+ d && "arrow-desktop",
78
+ t === "side" && "arrow-placement-side",
79
+ t === "side" && "arrow-placement-side-left",
80
+ o
158
81
  ),
159
- disabled: b,
160
- onClick: n,
161
- size: o,
162
- variant: s ?? "secondary",
163
- ...m,
164
- children: i ?? /* @__PURE__ */ $(le, { name: "angle-left-b" })
82
+ disabled: l,
83
+ onClick: r,
84
+ size: s,
85
+ variant: e ?? "secondary",
86
+ ...a,
87
+ children: i ?? /* @__PURE__ */ E(oe, { name: "angle-left-b" })
165
88
  }
166
89
  );
167
- }, Ve = (i, l) => {
168
- const f = Z();
169
- W(() => {
170
- f.current = i;
171
- }, [i]), W(() => {
172
- function o() {
173
- f.current();
90
+ }, ye = (i, o) => {
91
+ const t = W();
92
+ M(() => {
93
+ t.current = i;
94
+ }, [i]), M(() => {
95
+ function s() {
96
+ var e;
97
+ (e = t.current) == null || e.call(t);
174
98
  }
175
- if (l !== null) {
176
- const s = setInterval(o, l);
177
- return () => clearInterval(s);
99
+ if (o !== null) {
100
+ const e = setInterval(s, o);
101
+ return () => clearInterval(e);
178
102
  }
179
- }, [l]);
180
- }, G = (i, l) => {
181
- if (l === 0)
103
+ }, [o]);
104
+ }, H = (i, o) => {
105
+ if (o === 0)
182
106
  return `${100 / i}%`;
183
- const o = l * (i === 1 ? 4 : 2) / 16;
184
- return `calc(${100 / i}% - ${o}rem)`;
185
- }, Oe = K(U), Ce = ({ children: i, className: l }) => {
107
+ const s = o * (i === 1 ? 4 : 2) / 16;
108
+ return `calc(${100 / i}% - ${s}rem)`;
109
+ }, Ie = U(X), Le = ({ children: i, className: o }) => {
186
110
  const {
187
111
  slides: {
188
- currentPage: f,
189
- currentSlidesPerView: o,
190
- expandOnLargeScreens: s,
191
- gap: m,
192
- handleScroll: t,
193
- id: n,
194
- isLastPage: b,
195
- length: r,
196
- perView: c,
197
- ref: v,
198
- setLength: E
112
+ currentPage: t,
113
+ currentSlidesPerView: s,
114
+ expandOnLargeScreens: e,
115
+ gap: a,
116
+ handleScroll: g,
117
+ id: r,
118
+ isLastPage: l,
119
+ length: d,
120
+ perView: u,
121
+ ref: _,
122
+ setLength: L
199
123
  }
200
- } = te(), V = se.toArray(i);
201
- W(() => {
202
- E(V.length);
203
- }, [V.length, E]);
204
- const M = se.map(V, (S, N) => {
205
- const x = `${n}-${N}`, y = N + 1, D = Math.ceil(y / o) - 1, j = b ? r - y >= o : D !== f;
206
- return typeof S == "object" && S && "props" in S ? ge(S, {
207
- ...S.props,
208
- "aria-hidden": j,
209
- "aria-label": `${y} of ${r}`,
124
+ } = ee(), y = ie.toArray(i);
125
+ M(() => {
126
+ L(y.length);
127
+ }, [y.length, L]);
128
+ const k = ie.map(y, (f, V) => {
129
+ const x = `${r}-${V}`, T = V + 1, j = Math.ceil(T / s) - 1, $ = l ? d - T >= s : j !== t;
130
+ return typeof f == "object" && f && "props" in f ? be(f, {
131
+ ...f.props,
132
+ "aria-hidden": $,
133
+ "aria-label": `${T} of ${d}`,
210
134
  "aria-roledescription": "slide",
211
135
  id: x,
212
136
  key: x
213
- }) : S;
137
+ }) : f;
214
138
  });
215
- return /* @__PURE__ */ $(
139
+ return /* @__PURE__ */ E(
216
140
  "ul",
217
141
  {
218
- className: Oe(
142
+ className: Ie(
219
143
  "container",
220
- c.mobile && "container-mobile",
221
- c.desktop && "container-desktop",
222
- c.tablet && "container-tablet",
223
- c.desktop && s && "container-full-width",
224
- l
144
+ u.mobile && "container-mobile",
145
+ u.desktop && "container-desktop",
146
+ u.tablet && "container-tablet",
147
+ u.desktop && e && "container-full-width",
148
+ o
225
149
  ),
226
- onScroll: t,
227
- ref: v,
150
+ onScroll: g,
151
+ ref: _,
228
152
  style: {
229
- "--slideDesktop": c.desktop,
230
- "--slideMobile": c.mobile,
231
- "--slideTablet": c.tablet,
232
- "--slideWidthDesktop": G(c.desktop, m),
233
- "--slideWidthMobile": G(c.mobile, m),
234
- "--slideWidthTablet": G(c.tablet, m),
235
- "--slideWithDesktopFullWidth": G(c.desktop + 2, m),
236
- "--spaceBetween": `${m / 16}rem`
153
+ "--slideDesktop": u.desktop,
154
+ "--slideMobile": u.mobile,
155
+ "--slideTablet": u.tablet,
156
+ "--slideWidthDesktop": H(u.desktop, a),
157
+ "--slideWidthMobile": H(u.mobile, a),
158
+ "--slideWidthTablet": H(u.tablet, a),
159
+ "--slideWithDesktopFullWidth": H(u.desktop + 2, a),
160
+ "--spaceBetween": `${a / 16}rem`
237
161
  },
238
- children: M
162
+ children: k
239
163
  }
240
164
  );
241
- }, Te = K(U), ce = me(null), te = () => {
242
- const i = be(ce);
243
- if (!i)
244
- throw new Error("Swiper components must be used within a Swiper component");
245
- return i;
246
- }, h = {
165
+ }, v = {
247
166
  autoplay: { duration: 5e3, enabled: !1, loop: !1 },
248
167
  navigation: { desktop: !0, mobile: !0 },
249
168
  slides: {
@@ -254,168 +173,281 @@ const xe = /* @__PURE__ */ pe(Se), ve = "_root_eam2c_3", _e = "_container_eam2c_
254
173
  initialIndex: 0,
255
174
  perView: { desktop: 1, mobile: 1, tablet: 1 }
256
175
  }
257
- }, Ne = {
258
- autoplay: h.autoplay,
259
- navigation: h.navigation,
176
+ }, Ve = {
177
+ autoplay: v.autoplay,
178
+ navigation: v.navigation,
260
179
  slides: {
261
- alignment: h.slides.alignment,
180
+ alignment: v.slides.alignment,
262
181
  currentPage: 0,
263
- currentSlidesPerView: h.slides.perView.desktop,
264
- expandOnLargeScreens: h.slides.expandOnLargeScreens,
265
- gap: h.slides.gap,
266
- id: h.slides.id,
267
- initialIndex: h.slides.initialIndex,
268
- perView: h.slides.perView,
182
+ currentSlidesPerView: v.slides.perView.desktop,
183
+ expandOnLargeScreens: v.slides.expandOnLargeScreens,
184
+ gap: v.slides.gap,
185
+ id: v.slides.id,
186
+ initialIndex: v.slides.initialIndex,
187
+ perView: v.slides.perView,
269
188
  setCurrentPage: () => {
270
189
  }
271
190
  }
272
- }, Be = (i = h) => {
273
- var v;
274
- const [l, f] = H(0), o = {
275
- autoplay: { ...h.autoplay, ...i.autoplay },
276
- navigation: { ...h.navigation, ...i.navigation },
277
- slides: {
278
- ...h.slides,
279
- ...i.slides,
280
- perView: {
281
- ...h.slides.perView,
282
- ...(v = i.slides) == null ? void 0 : v.perView
191
+ };
192
+ var Y, se;
193
+ function Oe() {
194
+ if (se) return Y;
195
+ se = 1;
196
+ var i = "Expected a function", o = NaN, t = "[object Symbol]", s = /^\s+|\s+$/g, e = /^[-+]0x[0-9a-f]+$/i, a = /^0b[01]+$/i, g = /^0o[0-7]+$/i, r = parseInt, l = typeof G == "object" && G && G.Object === Object && G, d = typeof self == "object" && self && self.Object === Object && self, u = l || d || Function("return this")(), _ = Object.prototype, L = _.toString, y = Math.max, k = Math.min, f = function() {
197
+ return u.Date.now();
198
+ };
199
+ function V(n, p, w) {
200
+ var I, F, h, b, c, S, P = 0, O = !1, N = !1, B = !0;
201
+ if (typeof n != "function")
202
+ throw new TypeError(i);
203
+ p = $(p) || 0, x(w) && (O = !!w.leading, N = "maxWait" in w, h = N ? y($(w.maxWait) || 0, p) : h, B = "trailing" in w ? !!w.trailing : B);
204
+ function A(m) {
205
+ var C = I, D = F;
206
+ return I = F = void 0, P = m, b = n.apply(D, C), b;
207
+ }
208
+ function q(m) {
209
+ return P = m, c = setTimeout(z, p), O ? A(m) : b;
210
+ }
211
+ function le(m) {
212
+ var C = m - S, D = m - P, re = p - C;
213
+ return N ? k(re, h - D) : re;
214
+ }
215
+ function te(m) {
216
+ var C = m - S, D = m - P;
217
+ return S === void 0 || C >= p || C < 0 || N && D >= h;
218
+ }
219
+ function z() {
220
+ var m = f();
221
+ if (te(m))
222
+ return ne(m);
223
+ c = setTimeout(z, le(m));
224
+ }
225
+ function ne(m) {
226
+ return c = void 0, B && I ? A(m) : (I = F = void 0, b);
227
+ }
228
+ function de() {
229
+ c !== void 0 && clearTimeout(c), P = 0, I = S = F = c = void 0;
230
+ }
231
+ function ue() {
232
+ return c === void 0 ? b : ne(f());
233
+ }
234
+ function Q() {
235
+ var m = f(), C = te(m);
236
+ if (I = arguments, F = this, S = m, C) {
237
+ if (c === void 0)
238
+ return q(S);
239
+ if (N)
240
+ return c = setTimeout(z, p), A(S);
283
241
  }
242
+ return c === void 0 && (c = setTimeout(z, p)), b;
284
243
  }
285
- }, {
286
- autoplay: s,
287
- navigation: m,
288
- slides: { expandOnLargeScreens: t, perView: n }
289
- } = o, { width: b } = we(), r = fe(), c = ee(() => b <= r.md ? n.mobile : b <= r.lg ? n.tablet : b >= r["4xl"] && t ? n.desktop + 2 : n.desktop, [b, r, t, n]);
290
- return {
291
- autoplay: s,
292
- navigation: m,
293
- slides: {
294
- alignment: o.slides.alignment,
295
- currentPage: l,
296
- currentSlidesPerView: c,
297
- expandOnLargeScreens: o.slides.expandOnLargeScreens,
298
- gap: o.slides.gap,
299
- id: o.slides.id,
300
- initialIndex: o.slides.initialIndex,
301
- perView: n,
302
- setCurrentPage: f
244
+ return Q.cancel = de, Q.flush = ue, Q;
245
+ }
246
+ function x(n) {
247
+ var p = typeof n;
248
+ return !!n && (p == "object" || p == "function");
249
+ }
250
+ function T(n) {
251
+ return !!n && typeof n == "object";
252
+ }
253
+ function j(n) {
254
+ return typeof n == "symbol" || T(n) && L.call(n) == t;
255
+ }
256
+ function $(n) {
257
+ if (typeof n == "number")
258
+ return n;
259
+ if (j(n))
260
+ return o;
261
+ if (x(n)) {
262
+ var p = typeof n.valueOf == "function" ? n.valueOf() : n;
263
+ n = x(p) ? p + "" : p;
303
264
  }
304
- };
305
- }, X = ({
306
- children: i,
307
- className: l,
308
- store: f = Ne,
309
- ...o
265
+ if (typeof n != "string")
266
+ return n === 0 ? n : +n;
267
+ n = n.replace(s, "");
268
+ var w = a.test(n);
269
+ return w || g.test(n) ? r(n.slice(2), w ? 2 : 8) : e.test(n) ? o : +n;
270
+ }
271
+ return Y = V, Y;
272
+ }
273
+ var Ne = Oe();
274
+ const Te = /* @__PURE__ */ fe(Ne), je = ({
275
+ alignment: i,
276
+ currentPage: o,
277
+ currentSlidesPerView: t,
278
+ goTo: s,
279
+ initialIndex: e,
280
+ numberOfPage: a,
281
+ setCurrentPage: g,
282
+ slidesLength: r
310
283
  }) => {
311
- const { autoplay: s, navigation: m, slides: t } = f, { currentPage: n, setCurrentPage: b } = t, r = Z(), c = Z(!1), [v, E] = H(0), [V, M] = H(!1), [S, N] = H(!1), x = Math.ceil(v / t.currentSlidesPerView) || 1, y = A(() => {
312
- const a = r == null ? void 0 : r.current;
313
- if (a && !s.enabled) {
314
- const { offsetWidth: g, scrollLeft: p, scrollWidth: I } = a, P = !(p > t.gap), k = !(I - (p + g) > t.gap);
315
- M(P), N(k);
284
+ const l = W(!1), d = W(), u = W(!1), _ = W(!1), L = W(0), y = i === "center" ? (
285
+ // if centeredSlides is true, we calculate which number is the middle page
286
+ Math.floor(a / 2)
287
+ ) : (
288
+ // if centeredSlides is false, we calculate on which page the number in firstSlideToShow props is
289
+ Math.ceil(e / t) - 1
290
+ ), k = Number.isFinite(y) ? Math.min(Math.max(y, 0), a - 1) : 0;
291
+ return L.current = k, M(() => {
292
+ if (!(!r || l.current))
293
+ return l.current = !0, d.current = requestAnimationFrame(() => {
294
+ d.current = requestAnimationFrame(() => {
295
+ d.current = void 0;
296
+ const f = L.current;
297
+ f <= 0 || (u.current = !0, s(f, !0), g((V) => V === f ? V : (_.current = !0, f)));
298
+ });
299
+ }), () => {
300
+ d.current !== void 0 && (cancelAnimationFrame(d.current), d.current = void 0, l.current = !1);
301
+ };
302
+ }, [r]), M(() => {
303
+ if (_.current) {
304
+ _.current = !1;
305
+ return;
306
+ }
307
+ l.current && s(o);
308
+ }, [o, s]), R(() => u.current ? (u.current = !1, !0) : !1, []);
309
+ }, Ce = ({ children: i, store: o }) => {
310
+ const { autoplay: t, navigation: s, slides: e } = o, { currentPage: a, setCurrentPage: g } = e, r = W(null), [l, d] = K(0), [u, _] = K(!1), [L, y] = K(!1), k = Math.ceil(l / e.currentSlidesPerView) || 1, f = R(() => {
311
+ const h = r == null ? void 0 : r.current;
312
+ if (h && !t.enabled) {
313
+ const { offsetWidth: b, scrollLeft: c, scrollWidth: S } = h, P = !(c > e.gap), O = !(S - (c + b) > e.gap);
314
+ _(P), y(O);
316
315
  } else
317
- M(!1), N(!1);
318
- }, [s.enabled, t.gap]), D = A(() => {
319
- var g, p;
320
- const a = r == null ? void 0 : r.current;
321
- if (a) {
322
- const { children: I, offsetWidth: P, scrollLeft: k, scrollWidth: C } = a, J = (p = (g = I == null ? void 0 : I[0]) == null ? void 0 : g.getBoundingClientRect()) == null ? void 0 : p.width, R = !(C - (k + P) > t.gap) ? x - 1 : Math.round(k / ((J + t.gap) * t.currentSlidesPerView));
323
- R !== n && b(R);
316
+ _(!1), y(!1);
317
+ }, [t.enabled, e.gap]), V = R(() => {
318
+ var b, c;
319
+ const h = r == null ? void 0 : r.current;
320
+ if (h) {
321
+ const { children: S, offsetWidth: P, scrollLeft: O, scrollWidth: N } = h, B = (c = (b = S == null ? void 0 : S[0]) == null ? void 0 : b.getBoundingClientRect()) == null ? void 0 : c.width, q = !(N - (O + P) > e.gap) ? k - 1 : Math.round(O / ((B + e.gap) * e.currentSlidesPerView));
322
+ q !== a && g(q);
324
323
  }
325
- }, [x, n, t.currentSlidesPerView, r, b, t.gap]), j = ee(
326
- () => xe(() => {
327
- y(), D();
328
- }, 100),
329
- [y, D]
330
- ), e = A(
331
- (a, g = !1) => {
332
- var P, k, C;
333
- const p = r == null ? void 0 : r.current, I = (C = (k = (P = p == null ? void 0 : p.children) == null ? void 0 : P[0]) == null ? void 0 : k.getBoundingClientRect()) == null ? void 0 : C.width;
334
- p == null || p.scrollTo({
324
+ }, [k, a, e.currentSlidesPerView, r, g, e.gap]), x = R(
325
+ (h, b = !1) => {
326
+ var P, O, N;
327
+ const c = r == null ? void 0 : r.current, S = ((N = (O = (P = c == null ? void 0 : c.children) == null ? void 0 : P[0]) == null ? void 0 : O.getBoundingClientRect()) == null ? void 0 : N.width) || 0;
328
+ c == null || c.scrollTo({
335
329
  // We don't want to have a scroll effect when we first render the swiper
336
- behavior: g ? "auto" : "smooth",
337
- left: a * (I + t.gap) * t.currentSlidesPerView,
330
+ behavior: b ? "auto" : "smooth",
331
+ left: h * (S + e.gap) * e.currentSlidesPerView,
338
332
  top: 0
339
333
  });
340
334
  },
341
- [t.currentSlidesPerView, t.gap, r]
342
- ), u = n === 0, w = n === x - 1, _ = A(() => {
343
- s.enabled && s.loop && w ? e(0) : e(n + 1);
344
- }, [n, e, w, s.enabled, s.loop]), L = A(() => {
345
- u && s.enabled && s.loop ? e(x - 1) : e(n - 1);
346
- }, [x, n, e, u, s.enabled, s.loop]);
347
- Ve(
335
+ [e.currentSlidesPerView, e.gap, r]
336
+ ), T = je({
337
+ alignment: e.alignment,
338
+ currentPage: a,
339
+ currentSlidesPerView: e.currentSlidesPerView,
340
+ goTo: x,
341
+ initialIndex: e.initialIndex,
342
+ numberOfPage: k,
343
+ setCurrentPage: g,
344
+ slidesLength: l
345
+ }), j = Z(
346
+ () => Te(() => {
347
+ f(), !T() && V();
348
+ }, 100),
349
+ [f, V, T]
350
+ ), $ = W(j);
351
+ $.current = j, M(() => () => $.current.cancel(), []);
352
+ const n = a === 0, p = a === k - 1, w = R(() => {
353
+ t.enabled && t.loop && p ? x(0) : x(a + 1);
354
+ }, [a, x, p, t.enabled, t.loop]), I = R(() => {
355
+ n && t.enabled && t.loop ? x(k - 1) : x(a - 1);
356
+ }, [k, a, x, n, t.enabled, t.loop]);
357
+ return ye(
348
358
  () => {
349
- s.enabled && _();
359
+ t.enabled && w();
350
360
  },
351
- s.enabled ? s.duration : null
352
- ), W(() => {
353
- const a = (g) => {
354
- g.code === "ArrowLeft" && L(), g.code === "ArrowRight" && _();
361
+ t.enabled ? t.duration : null
362
+ ), M(() => {
363
+ const h = (b) => {
364
+ b.code === "ArrowLeft" && I(), b.code === "ArrowRight" && w();
355
365
  };
356
- return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
357
- }, [L, _]);
358
- const B = t.alignment === "center" ? (
359
- // if centeredSlides is true, we calculate which number is the middle page
360
- Math.floor(x / 2)
361
- ) : (
362
- // if centeredSlides is false, we calculate on which page the number in firstSlideToShow props is
363
- Math.ceil(t.initialIndex / t.currentSlidesPerView) - 1
364
- );
365
- W(() => {
366
- v > 0 && !c.current && (e(B, !0), c.current = !0);
367
- }, [v]), W(() => {
368
- y();
369
- }, [y, i]), W(() => {
370
- c.current && e(n);
371
- }, [n, e]);
372
- const O = ee(
366
+ return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
367
+ }, [I, w]), M(() => {
368
+ f();
369
+ }, [f, i]), Z(
373
370
  () => ({
374
371
  navigation: {
375
- goNext: _,
376
- goPrev: L,
377
- isNextDisabled: S,
378
- isPrevDisabled: V,
379
- ...m
372
+ goNext: w,
373
+ goPrev: I,
374
+ isNextDisabled: L,
375
+ isPrevDisabled: u,
376
+ ...s
380
377
  },
381
378
  slides: {
382
- alignment: t.alignment,
383
- currentPage: n,
384
- currentSlidesPerView: t.currentSlidesPerView,
385
- expandOnLargeScreens: t.expandOnLargeScreens,
386
- gap: t.gap,
379
+ alignment: e.alignment,
380
+ currentPage: a,
381
+ currentSlidesPerView: e.currentSlidesPerView,
382
+ expandOnLargeScreens: e.expandOnLargeScreens,
383
+ gap: e.gap,
387
384
  handleScroll: j,
388
- id: t.id,
389
- initialIndex: t.initialIndex,
390
- isLastPage: w,
391
- length: v,
392
- perView: t.perView,
385
+ id: e.id,
386
+ initialIndex: e.initialIndex,
387
+ isLastPage: p,
388
+ length: l,
389
+ perView: e.perView,
393
390
  ref: r,
394
- setLength: E
391
+ setLength: d
395
392
  }
396
393
  }),
397
394
  [
398
- _,
395
+ w,
396
+ I,
399
397
  L,
400
- S,
401
- V,
402
- m,
403
- n,
398
+ u,
399
+ s,
400
+ a,
404
401
  j,
405
- w,
406
- v,
407
- t
402
+ p,
403
+ l,
404
+ e
408
405
  ]
409
406
  );
410
- return /* @__PURE__ */ $(ce.Provider, { value: O, children: /* @__PURE__ */ $("div", { className: Te("root", l), ...o, children: i }) });
407
+ }, De = (i = v) => {
408
+ var _;
409
+ const [o, t] = K(0), s = {
410
+ autoplay: { ...v.autoplay, ...i.autoplay },
411
+ navigation: { ...v.navigation, ...i.navigation },
412
+ slides: {
413
+ ...v.slides,
414
+ ...i.slides,
415
+ perView: {
416
+ ...v.slides.perView,
417
+ ...(_ = i.slides) == null ? void 0 : _.perView
418
+ }
419
+ }
420
+ }, {
421
+ autoplay: e,
422
+ navigation: a,
423
+ slides: { expandOnLargeScreens: g, perView: r }
424
+ } = s, { width: l } = we(), d = pe(), u = Z(() => l <= d.md ? r.mobile : l <= d.lg ? r.tablet : l >= d["4xl"] && g ? r.desktop + 2 : r.desktop, [l, d, g, r]);
425
+ return {
426
+ autoplay: e,
427
+ navigation: a,
428
+ slides: {
429
+ alignment: s.slides.alignment,
430
+ currentPage: o,
431
+ currentSlidesPerView: u,
432
+ expandOnLargeScreens: s.slides.expandOnLargeScreens,
433
+ gap: s.slides.gap,
434
+ id: s.slides.id,
435
+ initialIndex: s.slides.initialIndex,
436
+ perView: r,
437
+ setCurrentPage: t
438
+ }
439
+ };
440
+ }, We = U(X), J = ({ children: i, className: o, store: t = Ve, ...s }) => {
441
+ const e = Ce({ children: i, store: t });
442
+ return /* @__PURE__ */ E(ce.Provider, { value: e, children: /* @__PURE__ */ E("div", { className: We("root", o), ...s, children: i }) });
411
443
  };
412
- X.PrevButton = Ie;
413
- X.NextButton = ye;
414
- X.Slides = Ce;
415
- X.displayName = "Swiper";
444
+ J.PrevButton = Pe;
445
+ J.NextButton = _e;
446
+ J.Slides = Le;
447
+ J.displayName = "Swiper";
416
448
  export {
417
- X as Swiper,
418
- U as swiperClasses,
419
- Be as useSwiper,
420
- te as useSwiperContext
449
+ J as Swiper,
450
+ X as swiperClasses,
451
+ De as useSwiper,
452
+ ee as useSwiperContext
421
453
  };
package/dist/Window.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import './Window.css';
3
- import { jsx as o, jsxs as x } from "react/jsx-runtime";
3
+ import { jsx as o, jsxs as _ } from "react/jsx-runtime";
4
4
  import { c as d } from "./index-B6iGEm-i.js";
5
5
  import { f as b } from "./forwardRefWithAs-8eP3ZN15.js";
6
- import { forwardRef as l, useState as B } from "react";
6
+ import { forwardRef as m, useState as B } from "react";
7
7
  import { T as I, a as g, b as j } from "./tab-panel-Cc3MfOBM.js";
8
8
  import { b as A } from "./Q5W46E73-5xQblshY.js";
9
9
  import { Badge as S } from "./Badge.js";
10
- import { Icon as m } from "./Icon.js";
10
+ import { Icon as x } from "./Icon.js";
11
11
  import { Text as u } from "./Text.js";
12
12
  const H = "_root_17x8z_2", P = "_header_17x8z_11", R = "_media_17x8z_125", c = {
13
13
  root: H,
@@ -26,17 +26,17 @@ const H = "_root_17x8z_2", P = "_header_17x8z_11", R = "_media_17x8z_125", c = {
26
26
  "size-md": "_size-md_17x8z_149",
27
27
  "size-sm": "_size-sm_17x8z_153",
28
28
  "size-xs": "_size-xs_17x8z_157"
29
- }, k = d(c), h = l(
30
- ({ children: t, className: a, size: e = "md", ...s }, n) => /* @__PURE__ */ o("div", { className: k("body", `size-${e}`, a), ref: n, ...s, children: t })
29
+ }, k = d(c), h = m(
30
+ ({ children: a, className: t, size: e = "md", ...s }, n) => /* @__PURE__ */ o("div", { className: k("body", `size-${e}`, t), ref: n, ...s, children: a })
31
31
  );
32
32
  h.displayName = "Window.Body";
33
- const L = d(c), z = l(
34
- ({ children: t, className: a, ...e }, s) => /* @__PURE__ */ o("div", { className: L("box-text", a), ref: s, ...e, children: t })
33
+ const L = d(c), z = m(
34
+ ({ children: a, className: t, ...e }, s) => /* @__PURE__ */ o("div", { className: L("box-text", t), ref: s, ...e, children: a })
35
35
  );
36
36
  z.displayName = "Window.BoxText";
37
37
  const i = d(c), p = ({
38
- "aria-label": t,
39
- className: a,
38
+ "aria-label": a,
39
+ className: t,
40
40
  icon: e,
41
41
  isActive: s,
42
42
  onClick: n,
@@ -44,74 +44,81 @@ const i = d(c), p = ({
44
44
  }) => /* @__PURE__ */ o(
45
45
  "button",
46
46
  {
47
- "aria-label": t,
47
+ "aria-label": a,
48
48
  "aria-pressed": s,
49
- className: i("header-action-button", a),
49
+ className: i("header-action-button", t),
50
50
  onClick: n,
51
51
  type: "button",
52
52
  ...r,
53
- children: /* @__PURE__ */ o(m, { name: e })
53
+ children: /* @__PURE__ */ o(x, { name: e })
54
54
  }
55
55
  ), w = ({
56
- as: t,
57
- className: a,
56
+ as: a,
57
+ className: t,
58
58
  onClick: e
59
59
  }) => /* @__PURE__ */ o(
60
60
  p,
61
61
  {
62
62
  "aria-label": "Close window",
63
- as: t,
64
- className: i("header-close-button", a),
63
+ as: a,
64
+ className: i("header-close-button", t),
65
65
  icon: "times",
66
66
  onClick: e
67
67
  }
68
- ), M = ({ children: t, className: a, store: e, ...s }) => /* @__PURE__ */ o(g, { className: i("header-tabs", a), store: e, ...s, children: t }), O = b(
69
- ({ as: t, badge: a, children: e, className: s, icon: n, id: r, store: _, ...v }, W) => {
70
- const $ = A(_, "selectedId") === r;
71
- return /* @__PURE__ */ x(
68
+ ), M = ({ children: a, className: t, store: e, ...s }) => /* @__PURE__ */ o(g, { className: i("header-tabs", t), store: e, ...s, children: a }), O = b(
69
+ ({ as: a, badge: t, children: e, className: s, icon: n, id: r, store: l, ...v }, W) => {
70
+ const $ = A(l, "selectedId") === r;
71
+ return /* @__PURE__ */ _(
72
72
  I,
73
73
  {
74
74
  className: i("header-tab-item", s),
75
75
  id: r,
76
76
  ref: W,
77
- render: t ? /* @__PURE__ */ o(t, {}) : void 0,
78
- store: _,
77
+ render: a ? /* @__PURE__ */ o(a, {}) : void 0,
78
+ store: l,
79
79
  ...v,
80
80
  children: [
81
- n ? /* @__PURE__ */ o(m, { name: n }) : null,
81
+ n ? /* @__PURE__ */ o(x, { name: n }) : null,
82
82
  /* @__PURE__ */ o(u, { variant: "label-sm", children: e }),
83
- a ? /* @__PURE__ */ o(S, { variant: $ ? "neutral" : "warm", children: a }) : null
83
+ t ? /* @__PURE__ */ o(S, { variant: $ ? "neutral" : "warm", children: t }) : null
84
84
  ]
85
85
  },
86
86
  r
87
87
  );
88
88
  }
89
- ), E = ({ children: t, isClosable: a = !1, onClose: e }) => {
89
+ ), E = ({ children: a, isClosable: t = !1, onClose: e }) => {
90
90
  const s = () => {
91
91
  e == null || e();
92
92
  };
93
- return /* @__PURE__ */ x("div", { className: i("header-actions"), children: [
94
- t,
95
- a ? /* @__PURE__ */ o(w, { onClick: s }) : null
93
+ return /* @__PURE__ */ _("div", { className: i("header-actions"), children: [
94
+ a,
95
+ t ? /* @__PURE__ */ o(w, { onClick: s }) : null
96
96
  ] });
97
- }, q = ({ isExpandable: t = !1, onExpandChange: a }) => {
98
- const [e, s] = B(!1), n = () => {
99
- const r = !e;
100
- s(r), a == null || a(r);
97
+ }, q = ({
98
+ children: a,
99
+ isExpandable: t = !1,
100
+ onExpandChange: e
101
+ }) => {
102
+ const [s, n] = B(!1), r = () => {
103
+ const l = !s;
104
+ n(l), e == null || e(l);
101
105
  };
102
- return /* @__PURE__ */ o("div", { className: i("header-actions"), children: t ? /* @__PURE__ */ o(
103
- "button",
104
- {
105
- "aria-expanded": e,
106
- "aria-label": e ? "Collapse window" : "Expand window",
107
- className: i("header-action-button"),
108
- onClick: n,
109
- type: "button",
110
- children: /* @__PURE__ */ o(m, { name: e ? "compress-alt" : "arrow-resize-diagonal" })
111
- }
112
- ) : null });
113
- }, C = ({ as: t, className: a, title: e }) => /* @__PURE__ */ o(u, { as: t, className: i("header-title", a), variant: "body-md-strong", children: e }), N = l(
114
- ({ children: t, className: a, ...e }, s) => /* @__PURE__ */ o("header", { className: i("header", a), ref: s, ...e, children: t })
106
+ return /* @__PURE__ */ _("div", { className: i("header-actions"), children: [
107
+ t ? /* @__PURE__ */ o(
108
+ "button",
109
+ {
110
+ "aria-expanded": s,
111
+ "aria-label": s ? "Collapse window" : "Expand window",
112
+ className: i("header-action-button"),
113
+ onClick: r,
114
+ type: "button",
115
+ children: /* @__PURE__ */ o(x, { name: s ? "compress-alt" : "arrow-resize-diagonal" })
116
+ }
117
+ ) : null,
118
+ a
119
+ ] });
120
+ }, C = ({ as: a, className: t, title: e }) => /* @__PURE__ */ o(u, { as: a, className: i("header-title", t), variant: "body-md-strong", children: e }), N = m(
121
+ ({ children: a, className: t, ...e }, s) => /* @__PURE__ */ o("header", { className: i("header", t), ref: s, ...e, children: a })
115
122
  );
116
123
  N.displayName = "Window.Header";
117
124
  const D = Object.assign(N, {
@@ -122,16 +129,16 @@ const D = Object.assign(N, {
122
129
  Tab: O,
123
130
  Tabs: M,
124
131
  Title: C
125
- }), F = d(c), f = l(
126
- ({ children: t, className: a, ...e }, s) => /* @__PURE__ */ o("div", { className: F("media", a), ref: s, ...e, children: t })
132
+ }), F = d(c), f = m(
133
+ ({ children: a, className: t, ...e }, s) => /* @__PURE__ */ o("div", { className: F("media", t), ref: s, ...e, children: a })
127
134
  );
128
135
  f.displayName = "Window.Media";
129
- const G = d(c), y = l(
130
- ({ children: t, store: a, tabId: e, ...s }, n) => /* @__PURE__ */ o(j, { className: G("tab-panel"), ref: n, store: a, tabId: e, ...s, children: t })
136
+ const G = d(c), y = m(
137
+ ({ children: a, store: t, tabId: e, ...s }, n) => /* @__PURE__ */ o(j, { className: G("tab-panel"), ref: n, store: t, tabId: e, ...s, children: a })
131
138
  );
132
139
  y.displayName = "Window.TabPanel";
133
140
  const J = d(c), T = b(
134
- ({ as: t = "div", children: a, className: e, role: s = "region", ...n }, r) => /* @__PURE__ */ o(t, { className: J("root", e), ref: r, role: s, ...n, children: a })
141
+ ({ as: a = "div", children: t, className: e, role: s = "region", ...n }, r) => /* @__PURE__ */ o(a, { className: J("root", e), ref: r, role: s, ...n, children: t })
135
142
  );
136
143
  T.displayName = "Window";
137
144
  const se = Object.assign(T, {
@@ -20,7 +20,7 @@ export declare const Drawer: import('react').ForwardRefExoticComponent<Omit<Draw
20
20
  } & import('react').RefAttributes<HTMLDivElement>> & {
21
21
  Button: ({ "aria-label": ariaLabel, className, icon, isActive, onClick, ...rest }: import('../../utils').PropsWithAs<import('../../utils').As, import('../Window/types').ActionButtonProps>) => import("react/jsx-runtime").JSX.Element;
22
22
  CloseButton: ({ as, className, onClick, }: import('../../utils').PropsWithAs<import('../../utils').As, Omit<import('../Window/types').ActionButtonProps, "icon">>) => import("react/jsx-runtime").JSX.Element;
23
- LeftActions: ({ isExpandable, onExpandChange }: import('../Window/types').HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
23
+ LeftActions: ({ children, isExpandable, onExpandChange, }: import('../Window/types').HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
24
24
  RightActions: ({ children, isClosable, onClose }: import('../Window/types').HeaderRightActionsProps) => import("react/jsx-runtime").JSX.Element;
25
25
  Tab: import('../../utils').FunctionComponentWithAs<"button", import('../Window/types').HeaderTabItem>;
26
26
  Tabs: ({ children, className, store, ...rest }: import('../Window/types').HeaderTabsProps) => import("react/jsx-runtime").JSX.Element;
@@ -35,7 +35,7 @@ export declare const Modal: import('../../utils').FunctionComponentWithAs<"div",
35
35
  } & import('react').RefAttributes<HTMLDivElement>> & {
36
36
  Button: ({ "aria-label": ariaLabel, className, icon, isActive, onClick, ...rest }: import('../../utils').PropsWithAs<import('../../utils').As, import('../Window/types').ActionButtonProps>) => import("react/jsx-runtime").JSX.Element;
37
37
  CloseButton: ({ as, className, onClick, }: import('../../utils').PropsWithAs<import('../../utils').As, Omit<import('../Window/types').ActionButtonProps, "icon">>) => import("react/jsx-runtime").JSX.Element;
38
- LeftActions: ({ isExpandable, onExpandChange }: import('../Window/types').HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
38
+ LeftActions: ({ children, isExpandable, onExpandChange, }: import('../Window/types').HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
39
39
  RightActions: ({ children, isClosable, onClose }: import('../Window/types').HeaderRightActionsProps) => import("react/jsx-runtime").JSX.Element;
40
40
  Tab: import('../../utils').FunctionComponentWithAs<"button", import('../Window/types').HeaderTabItem>;
41
41
  Tabs: ({ children, className, store, ...rest }: import('../Window/types').HeaderTabsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ export declare const defaultOptions: {
2
+ autoplay: {
3
+ duration: number;
4
+ enabled: false;
5
+ loop: false;
6
+ };
7
+ navigation: {
8
+ desktop: true;
9
+ mobile: true;
10
+ };
11
+ slides: {
12
+ alignment: "default";
13
+ expandOnLargeScreens: false;
14
+ gap: number;
15
+ id: string;
16
+ initialIndex: number;
17
+ perView: {
18
+ desktop: number;
19
+ mobile: number;
20
+ tablet: number;
21
+ };
22
+ };
23
+ };
24
+ export declare const defaultStore: {
25
+ autoplay: {
26
+ duration: number;
27
+ enabled: false;
28
+ loop: false;
29
+ };
30
+ navigation: {
31
+ desktop: true;
32
+ mobile: true;
33
+ };
34
+ slides: {
35
+ alignment: "default";
36
+ currentPage: number;
37
+ currentSlidesPerView: number;
38
+ expandOnLargeScreens: false;
39
+ gap: number;
40
+ id: string;
41
+ initialIndex: number;
42
+ perView: {
43
+ desktop: number;
44
+ mobile: number;
45
+ tablet: number;
46
+ };
47
+ setCurrentPage: () => void;
48
+ };
49
+ };
@@ -0,0 +1,3 @@
1
+ import { SwiperContextValue } from './types';
2
+ export declare const SwiperContext: import('react').Context<SwiperContextValue>;
3
+ export declare const useSwiperContext: () => SwiperContextValue;
@@ -1,60 +1,13 @@
1
1
  import { default as swiperStyles } from './swiper.module.scss';
2
- import { SwiperComponent, UseSwiperOptions } from './types';
2
+ import { SwiperProps } from './types';
3
3
  export { swiperStyles as swiperClasses };
4
- type SwiperContextValue = {
5
- navigation: {
6
- desktop: boolean;
7
- goNext: () => void;
8
- goPrev: () => void;
9
- isNextDisabled: boolean;
10
- isPrevDisabled: boolean;
11
- mobile: boolean;
12
- };
13
- slides: {
14
- alignment: 'center' | 'default';
15
- currentPage: number;
16
- currentSlidesPerView: number;
17
- expandOnLargeScreens: boolean;
18
- gap: number;
19
- handleScroll: () => void;
20
- id: string;
21
- initialIndex: number;
22
- isLastPage: boolean;
23
- length: number;
24
- perView: {
25
- desktop: number;
26
- mobile: number;
27
- tablet: number;
28
- };
29
- ref: React.RefObject<HTMLUListElement>;
30
- setLength: (length: number) => void;
31
- };
4
+ export { useSwiperContext } from './context';
5
+ export type { SwiperContextValue } from './types';
6
+ export { useSwiper } from './useSwiper';
7
+ export declare const Swiper: {
8
+ ({ children, className, store, ...rest }: SwiperProps): import("react/jsx-runtime").JSX.Element;
9
+ PrevButton: ({ children, className, placement, size, variant, ...rest }: import('./types').SwiperPrevButtonProps) => import("react/jsx-runtime").JSX.Element;
10
+ NextButton: ({ children, className, placement, size, variant, ...rest }: import('./types').SwiperNextButtonProps) => import("react/jsx-runtime").JSX.Element;
11
+ Slides: ({ children, className }: import('./types').SwiperSlidesProps) => import("react/jsx-runtime").JSX.Element;
12
+ displayName: string;
32
13
  };
33
- export declare const useSwiperContext: () => SwiperContextValue;
34
- export declare const useSwiper: (options?: UseSwiperOptions) => {
35
- autoplay: {
36
- duration: number;
37
- enabled: boolean;
38
- loop: boolean;
39
- };
40
- navigation: {
41
- desktop: boolean;
42
- mobile: boolean;
43
- };
44
- slides: {
45
- alignment: "center" | "default";
46
- currentPage: number;
47
- currentSlidesPerView: number;
48
- expandOnLargeScreens: boolean;
49
- gap: number;
50
- id: string;
51
- initialIndex: number;
52
- perView: {
53
- desktop: number;
54
- mobile: number;
55
- tablet: number;
56
- };
57
- setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
58
- };
59
- };
60
- export declare const Swiper: SwiperComponent;
@@ -1,11 +1,35 @@
1
- import { ComponentProps, FC, ReactNode } from 'react';
1
+ import { ComponentProps, ReactNode, RefObject } from 'react';
2
2
  import { ButtonProps } from '../Button/types';
3
- import { useSwiper } from '.';
4
- export interface SwiperComponent extends FC<SwiperProps> {
5
- NextButton: FC<SwiperNextButtonProps>;
6
- PrevButton: FC<SwiperPrevButtonProps>;
7
- Slides: FC<SwiperSlidesProps>;
8
- }
3
+ import { useSwiper } from './useSwiper';
4
+ export type SwiperContextValue = {
5
+ navigation: {
6
+ desktop: boolean;
7
+ goNext: () => void;
8
+ goPrev: () => void;
9
+ isNextDisabled: boolean;
10
+ isPrevDisabled: boolean;
11
+ mobile: boolean;
12
+ };
13
+ slides: {
14
+ alignment: 'center' | 'default';
15
+ currentPage: number;
16
+ currentSlidesPerView: number;
17
+ expandOnLargeScreens: boolean;
18
+ gap: number;
19
+ handleScroll: () => void;
20
+ id: string;
21
+ initialIndex: number;
22
+ isLastPage: boolean;
23
+ length: number;
24
+ perView: {
25
+ desktop: number;
26
+ mobile: number;
27
+ tablet: number;
28
+ };
29
+ ref: RefObject<HTMLUListElement | null>;
30
+ setLength: (length: number) => void;
31
+ };
32
+ };
9
33
  export type SwiperNextButtonProps = Omit<ButtonProps, 'aria-label' | 'disabled' | 'onClick'> & {
10
34
  placement?: 'inline' | 'side';
11
35
  };
@@ -0,0 +1,18 @@
1
+ type UseInitialScrollOptions = {
2
+ alignment: 'center' | 'default';
3
+ currentPage: number;
4
+ currentSlidesPerView: number;
5
+ goTo: (page: number, isFirstInit?: boolean) => void;
6
+ initialIndex: number;
7
+ numberOfPage: number;
8
+ setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
9
+ slidesLength: number;
10
+ };
11
+ /**
12
+ * Owns the deferred, one-shot scroll to the initial page and the state flags
13
+ * that keep it from fighting the scroll handler. Returns `consumeSnapBackSkip`,
14
+ * which the scroll handler calls once to swallow the scroll-snap correction
15
+ * that follows our own initial scroll.
16
+ */
17
+ export declare const useInitialScroll: ({ alignment, currentPage, currentSlidesPerView, goTo, initialIndex, numberOfPage, setCurrentPage, slidesLength, }: UseInitialScrollOptions) => (() => boolean);
18
+ export {};
@@ -0,0 +1,27 @@
1
+ import { UseSwiperOptions } from './types';
2
+ export declare const useSwiper: (options?: UseSwiperOptions) => {
3
+ autoplay: {
4
+ duration: number;
5
+ enabled: boolean;
6
+ loop: boolean;
7
+ };
8
+ navigation: {
9
+ desktop: boolean;
10
+ mobile: boolean;
11
+ };
12
+ slides: {
13
+ alignment: "center" | "default";
14
+ currentPage: number;
15
+ currentSlidesPerView: number;
16
+ expandOnLargeScreens: boolean;
17
+ gap: number;
18
+ id: string;
19
+ initialIndex: number;
20
+ perView: {
21
+ desktop: number;
22
+ mobile: number;
23
+ tablet: number;
24
+ };
25
+ setCurrentPage: import('react').Dispatch<import('react').SetStateAction<number>>;
26
+ };
27
+ };
@@ -0,0 +1,2 @@
1
+ import { SwiperContextValue, SwiperProps } from './types';
2
+ export declare const useSwiperViewModel: ({ children, store }: SwiperProps) => SwiperContextValue;
@@ -1,2 +1,2 @@
1
- export declare const useInterval: (callback: () => void, delay: number) => void;
1
+ export declare const useInterval: (callback: () => void, delay: null | number) => void;
2
2
  export declare const getSlideWidth: (slidesPerView: number, spaceBetween: number) => string;
@@ -8,7 +8,7 @@ export declare const Header: import('react').ForwardRefExoticComponent<import('r
8
8
  } & import('react').RefAttributes<HTMLDivElement>> & {
9
9
  Button: ({ "aria-label": ariaLabel, className, icon, isActive, onClick, ...rest }: PropsWithAs<As, ActionButtonProps>) => import("react/jsx-runtime").JSX.Element;
10
10
  CloseButton: ({ as, className, onClick, }: PropsWithAs<As, Omit<ActionButtonProps, "icon">>) => import("react/jsx-runtime").JSX.Element;
11
- LeftActions: ({ isExpandable, onExpandChange }: HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
11
+ LeftActions: ({ children, isExpandable, onExpandChange, }: HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
12
12
  RightActions: ({ children, isClosable, onClose }: HeaderRightActionsProps) => import("react/jsx-runtime").JSX.Element;
13
13
  Tab: import('../../../utils').FunctionComponentWithAs<"button", HeaderTabItem>;
14
14
  Tabs: ({ children, className, store, ...rest }: HeaderTabsProps) => import("react/jsx-runtime").JSX.Element;
@@ -13,7 +13,7 @@ export declare const Window: import('../../utils').FunctionComponentWithAs<"div"
13
13
  } & import('react').RefAttributes<HTMLDivElement>> & {
14
14
  Button: ({ "aria-label": ariaLabel, className, icon, isActive, onClick, ...rest }: import('../../utils').PropsWithAs<import('../../utils').As, import('./types').ActionButtonProps>) => import("react/jsx-runtime").JSX.Element;
15
15
  CloseButton: ({ as, className, onClick, }: import('../../utils').PropsWithAs<import('../../utils').As, Omit<import('./types').ActionButtonProps, "icon">>) => import("react/jsx-runtime").JSX.Element;
16
- LeftActions: ({ isExpandable, onExpandChange }: import('./types').HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
16
+ LeftActions: ({ children, isExpandable, onExpandChange, }: import('./types').HeaderLeftActionsProps) => import("react/jsx-runtime").JSX.Element;
17
17
  RightActions: ({ children, isClosable, onClose }: import('./types').HeaderRightActionsProps) => import("react/jsx-runtime").JSX.Element;
18
18
  Tab: import('../../utils').FunctionComponentWithAs<"button", import('./types').HeaderTabItem>;
19
19
  Tabs: ({ children, className, store, ...rest }: import('./types').HeaderTabsProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "welcome-ui",
3
- "version": "10.6.1",
3
+ "version": "10.6.3",
4
4
  "description": "Customizable design system with react, typescript, tailwindcss and ariakit.",
5
5
  "files": [
6
6
  "dist"