@codeandfunction/callaloo 3.21.0 → 3.23.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.
Files changed (33) hide show
  1. package/dist/chunks/{CLButton.vue_vue_type_style_index_0_lang-B3AdartN.js → CLButton.vue_vue_type_style_index_0_lang-kYdsi6-T.js} +1 -1
  2. package/dist/chunks/{CLCard.vue_vue_type_style_index_0_lang-TOjjxtJt.js → CLCard.vue_vue_type_style_index_0_lang-C8dDRXYZ.js} +1 -1
  3. package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-CduBjI1N.js +109 -0
  4. package/dist/chunks/{CLLink.vue_vue_type_style_index_0_lang-M6vqUSDq.js → CLLink.vue_vue_type_style_index_0_lang-BDgJvHNE.js} +1 -1
  5. package/dist/chunks/{CLNavLink.vue_vue_type_script_setup_true_lang-8u8OhF4q.js → CLNavLink.vue_vue_type_script_setup_true_lang-CMUfxGA3.js} +1 -1
  6. package/dist/chunks/{CLPill.vue_vue_type_style_index_0_lang-C8_aZqPJ.js → CLPill.vue_vue_type_style_index_0_lang-BPOoZ5_q.js} +2 -2
  7. package/dist/chunks/{CLToast.vue_vue_type_style_index_0_lang-DIi8ikHj.js → CLToast.vue_vue_type_style_index_0_lang-BH6Tnr-h.js} +2 -2
  8. package/dist/chunks/icons-6Fm4EZ4Y.js +4 -0
  9. package/dist/components/Buttons/CLButton/CLButton.js +1 -1
  10. package/dist/components/CLIcon/CLIcon.js +1 -1
  11. package/dist/components/CLIcon/CLIcon.vue.d.ts +3 -0
  12. package/dist/components/Containers/CLCard/CLCard.js +1 -1
  13. package/dist/components/Containers/CLCarousel/CLCarousel.css +1 -1
  14. package/dist/components/Containers/CLCarousel/CLCarousel.js +411 -302
  15. package/dist/components/Containers/CLCarousel/CLCarousel.vue.d.ts +3 -0
  16. package/dist/components/Containers/CLDisclosure/CLDisclosure.js +2 -2
  17. package/dist/components/Form/CLCheckbox/CLCheckbox.js +1 -1
  18. package/dist/components/Form/CLInput/CLInput.js +3 -3
  19. package/dist/components/Form/CLSelect/CLSelect.js +1 -1
  20. package/dist/components/Indicators/CLBanner/CLBanner.js +1 -1
  21. package/dist/components/Indicators/CLPill/CLPill.js +1 -1
  22. package/dist/components/Modals/CLModal/CLModal.js +1 -1
  23. package/dist/components/Navigation/CLLink/CLLink.js +1 -1
  24. package/dist/components/Navigation/CLNavLink/CLNavLink.js +1 -1
  25. package/dist/components/Navigation/CLNavSection/CLNavSection.js +1 -1
  26. package/dist/components/Popups/CLDropdownMenu/CLDropdownMenu.js +2 -2
  27. package/dist/components/Popups/CLToast/CLToast.js +1 -1
  28. package/dist/components/Providers/CLToastProvider/CLToastProvider.js +1 -1
  29. package/dist/index.js +3 -3
  30. package/dist/types.d.ts +1 -0
  31. package/package.json +1 -1
  32. package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-BBPM6q0l.js +0 -85
  33. package/dist/chunks/icons-DnOYbuR5.js +0 -4
@@ -1,12 +1,12 @@
1
1
  import '../../../assets/core.css';
2
2
  import './CLCarousel.css';
3
- import { defineComponent as re, computed as u, createElementBlock as c, openBlock as s, Fragment as F, createCommentVNode as C, unref as e, normalizeClass as l, renderList as me, createBlock as he, createElementVNode as y, createVNode as x, withCtx as X, createTextVNode as Y, toDisplayString as q, useCssVars as be, ref as r, onMounted as we, onUnmounted as pe, watch as Ce, renderSlot as Z, nextTick as se } from "vue";
4
- import { _ as E } from "../../../chunks/CLButton.vue_vue_type_style_index_0_lang-B3AdartN.js";
5
- import { _ as ce } from "../../../chunks/CLText.vue_vue_type_style_index_0_lang-DVwTAVXM.js";
6
- import { CLPaginationType as $, CLColorVariants as B, CLSizes as W, CLIconSizes as D, CLIconNames as O, CLTextTypes as xe, CLAlign as A, CLOrder as R, CLColors as ye } from "../../../index.js";
7
- import { i as H, d as Pe, e as $e } from "../../../chunks/helper-BYpahJAh.js";
8
- import { useHasSlotContent as Te } from "../../../composables/useHasSlotContent.js";
9
- const Q = /* @__PURE__ */ re({
3
+ import { defineComponent as xe, computed as w, createElementBlock as h, openBlock as f, Fragment as te, createCommentVNode as P, unref as e, normalizeClass as r, renderList as ke, createBlock as ze, createElementVNode as x, createVNode as y, withCtx as de, createTextVNode as ue, toDisplayString as ee, useCssVars as Ie, ref as v, onMounted as Ee, nextTick as Y, onUnmounted as We, watch as Be, renderSlot as ve } from "vue";
4
+ import { _ as M } from "../../../chunks/CLButton.vue_vue_type_style_index_0_lang-kYdsi6-T.js";
5
+ import { _ as Te } from "../../../chunks/CLText.vue_vue_type_style_index_0_lang-DVwTAVXM.js";
6
+ import { CLPaginationType as E, CLColorVariants as A, CLSizes as D, CLIconSizes as j, CLIconNames as q, CLTextTypes as Ne, CLAlign as Q, CLOrder as Z, CLColors as Me } from "../../../index.js";
7
+ import { i as _, d as Ae, e as Ve } from "../../../chunks/helper-BYpahJAh.js";
8
+ import { useHasSlotContent as Oe } from "../../../composables/useHasSlotContent.js";
9
+ const ce = /* @__PURE__ */ xe({
10
10
  name: "CLCarouselNavigation",
11
11
  __name: "CLCarouselNavigation",
12
12
  props: {
@@ -26,412 +26,521 @@ const Q = /* @__PURE__ */ re({
26
26
  totalPages: {},
27
27
  variant: {}
28
28
  },
29
- setup(a) {
30
- const o = a, i = u(() => [
31
- `${o.prefix}__dots-container`
32
- ]), I = u(() => [
33
- `${o.prefix}__numbered-container`
34
- ]), T = u(() => [
35
- `${o.prefix}__inline-container`
36
- ]), f = u(() => [
37
- `${o.prefix}__prev-page`
38
- ]), g = u(() => [
39
- `${o.prefix}__next-page`
40
- ]), N = u(() => [
41
- `${o.prefix}__page-indicator`
42
- ]), k = u(() => [
43
- `${o.prefix}__show-more`
44
- ]), L = (m) => o.currentPage === m, v = u(() => !o.enabled || !o.prevPageEnabled), w = u(() => !o.enabled || !o.nextPageEnabled);
45
- return (m, h) => (s(), c(F, null, [
46
- a.paginationType === e($).Dots ? (s(), c("div", {
29
+ setup(t) {
30
+ const l = t, n = w(() => [
31
+ `${l.prefix}__dots-container`
32
+ ]), V = w(() => [
33
+ `${l.prefix}__arrows-container`
34
+ ]), B = w(() => [
35
+ `${l.prefix}__numbered-container`
36
+ ]), p = w(() => [
37
+ `${l.prefix}__inline-container`
38
+ ]), c = w(() => [
39
+ `${l.prefix}__prev-page`
40
+ ]), $ = w(() => [
41
+ `${l.prefix}__next-page`
42
+ ]), F = w(() => [
43
+ `${l.prefix}__page-indicator`
44
+ ]), W = w(() => [
45
+ `${l.prefix}__show-more`
46
+ ]), L = (k) => l.currentPage === k, C = w(() => !l.enabled || !l.prevPageEnabled), m = w(() => !l.enabled || !l.nextPageEnabled);
47
+ return (k, R) => (f(), h(te, null, [
48
+ t.paginationType === e(E).Dots ? (f(), h("div", {
47
49
  key: 0,
48
- class: l(e(i))
50
+ class: r(e(n))
49
51
  }, [
50
- (s(!0), c(F, null, me(a.totalPages, (b) => (s(), he(e(E), {
52
+ (f(!0), h(te, null, ke(t.totalPages, (b) => (f(), ze(e(M), {
51
53
  key: `dot-${b}`,
52
54
  "aria-label": `Show page ${b}`,
53
- color: a.color,
55
+ color: t.color,
54
56
  disabled: L(b),
55
57
  height: "0.75rem",
56
- "on-click": () => a.gotoPage(b),
58
+ "on-click": () => t.gotoPage(b),
57
59
  width: "0.75rem",
58
- variant: L(b) ? e(B).Outline : a.variant,
60
+ variant: L(b) ? e(A).Outline : t.variant,
59
61
  wrap: ""
60
62
  }, null, 8, ["aria-label", "color", "disabled", "on-click", "variant"]))), 128))
61
- ], 2)) : C("", !0),
62
- a.paginationType === e($).Numbered ? (s(), c("div", {
63
+ ], 2)) : P("", !0),
64
+ t.paginationType === e(E).Numbered ? (f(), h("div", {
63
65
  key: 1,
64
- class: l(e(I))
66
+ class: r(e(B))
65
67
  }, [
66
- y("div", {
67
- class: l(e(f))
68
+ x("div", {
69
+ class: r(e(c))
68
70
  }, [
69
- x(e(E), {
71
+ y(e(M), {
70
72
  "aria-label": "Show previous page of slides",
71
- color: a.color,
72
- disabled: e(v),
73
- "icon-before": e(O).ChevronLeft,
74
- "icon-size": e(D).Tiny,
75
- size: e(W).Tiny,
76
- "on-click": a.showPrevItems,
77
- variant: e(v) ? e(B).Text : a.variant
73
+ color: t.color,
74
+ disabled: e(C),
75
+ "icon-before": e(q).ChevronLeft,
76
+ "icon-size": e(j).Tiny,
77
+ size: e(D).Tiny,
78
+ "on-click": t.showPrevItems,
79
+ variant: e(C) ? e(A).Text : t.variant
78
80
  }, null, 8, ["color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
79
81
  ], 2),
80
- y("div", {
81
- class: l(e(N))
82
+ x("div", {
83
+ class: r(e(F))
82
84
  }, [
83
- x(e(ce), {
84
- type: e(xe).Small
85
+ y(e(Te), {
86
+ type: e(Ne).Small
85
87
  }, {
86
- default: X(() => [
87
- Y(q(a.currentPage) + " / " + q(a.totalPages), 1)
88
+ default: de(() => [
89
+ ue(ee(t.currentPage) + " / " + ee(t.totalPages), 1)
88
90
  ]),
89
91
  _: 1
90
92
  }, 8, ["type"])
91
93
  ], 2),
92
- y("div", {
93
- class: l(e(g))
94
+ x("div", {
95
+ class: r(e($))
94
96
  }, [
95
- x(e(E), {
97
+ y(e(M), {
96
98
  "aria-label": "Show next page of slides",
97
- color: a.color,
98
- disabled: e(w),
99
- "icon-before": e(O).ChevronRight,
100
- "icon-size": e(D).Tiny,
101
- size: e(W).Tiny,
102
- "on-click": a.showNextItems,
103
- variant: e(w) ? e(B).Text : a.variant
99
+ color: t.color,
100
+ disabled: e(m),
101
+ "icon-before": e(q).ChevronRight,
102
+ "icon-size": e(j).Tiny,
103
+ size: e(D).Tiny,
104
+ "on-click": t.showNextItems,
105
+ variant: e(m) ? e(A).Text : t.variant
104
106
  }, null, 8, ["color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
105
107
  ], 2),
106
- a.showMore ? (s(), c("div", {
108
+ t.showMore ? (f(), h("div", {
107
109
  key: 0,
108
- class: l(e(k))
110
+ class: r(e(W))
109
111
  }, [
110
- x(e(E), {
111
- "aria-label": a.moreAriaLabel,
112
- color: a.color,
113
- size: e(W).Small,
114
- "on-click": a.showMore,
115
- variant: a.variant
112
+ y(e(M), {
113
+ "aria-label": t.moreAriaLabel,
114
+ color: t.color,
115
+ size: e(D).Small,
116
+ "on-click": t.showMore,
117
+ variant: t.variant
116
118
  }, {
117
- default: X(() => [
118
- Y(q(a.moreLabel), 1)
119
+ default: de(() => [
120
+ ue(ee(t.moreLabel), 1)
119
121
  ]),
120
122
  _: 1
121
123
  }, 8, ["aria-label", "color", "size", "on-click", "variant"])
122
- ], 2)) : C("", !0)
123
- ], 2)) : C("", !0),
124
- a.paginationType === e($).Inline ? (s(), c("div", {
124
+ ], 2)) : P("", !0)
125
+ ], 2)) : P("", !0),
126
+ t.paginationType === e(E).Arrows ? (f(), h("div", {
125
127
  key: 2,
126
- class: l(e(T))
128
+ class: r(e(V))
127
129
  }, [
128
- y("div", {
129
- class: l(e(f))
130
+ x("div", {
131
+ class: r(e(c))
130
132
  }, [
131
- x(e(E), {
133
+ y(e(M), {
132
134
  "aria-label": "Show previous page of slides",
133
- "align-content": e(A).Center,
134
- color: a.color,
135
- disabled: e(v),
136
- "icon-before": e(O).ChevronLeft,
137
- "icon-size": e(D).Small,
138
- size: e(W).Tiny,
139
- "on-click": a.showPrevItems,
140
- variant: e(v) ? e(B).Text : a.variant,
135
+ color: t.color,
136
+ disabled: e(C),
137
+ "icon-before": e(q).ChevronLeft,
138
+ "icon-size": e(j).Tiny,
139
+ size: e(D).Tiny,
140
+ "on-click": t.showPrevItems,
141
+ variant: e(C) ? e(A).Text : t.variant
142
+ }, null, 8, ["color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
143
+ ], 2),
144
+ x("div", {
145
+ class: r(e($))
146
+ }, [
147
+ y(e(M), {
148
+ "aria-label": "Show next page of slides",
149
+ color: t.color,
150
+ disabled: e(m),
151
+ "icon-before": e(q).ChevronRight,
152
+ "icon-size": e(j).Tiny,
153
+ size: e(D).Tiny,
154
+ "on-click": t.showNextItems,
155
+ variant: e(m) ? e(A).Text : t.variant
156
+ }, null, 8, ["color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
157
+ ], 2)
158
+ ], 2)) : P("", !0),
159
+ t.paginationType === e(E).Inline ? (f(), h("div", {
160
+ key: 3,
161
+ class: r(e(p))
162
+ }, [
163
+ x("div", {
164
+ class: r(e(c))
165
+ }, [
166
+ y(e(M), {
167
+ "aria-label": "Show previous page of slides",
168
+ "align-content": e(Q).Center,
169
+ color: t.color,
170
+ disabled: e(C),
171
+ "icon-before": e(q).ChevronLeft,
172
+ "icon-size": e(j).Small,
173
+ size: e(D).Tiny,
174
+ "on-click": t.showPrevItems,
175
+ variant: e(C) ? e(A).Text : t.variant,
141
176
  width: "30px",
142
177
  height: "30px",
143
178
  wrap: ""
144
179
  }, null, 8, ["align-content", "color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
145
180
  ], 2),
146
- y("div", {
147
- class: l(e(g))
181
+ x("div", {
182
+ class: r(e($))
148
183
  }, [
149
- x(e(E), {
184
+ y(e(M), {
150
185
  "aria-label": "Show next page of slides",
151
- "align-content": e(A).Center,
152
- color: a.color,
153
- disabled: e(w),
154
- "icon-before": e(O).ChevronRight,
155
- "icon-size": e(D).Small,
156
- size: e(W).Tiny,
157
- "on-click": a.showNextItems,
158
- variant: e(w) ? e(B).Text : a.variant,
186
+ "align-content": e(Q).Center,
187
+ color: t.color,
188
+ disabled: e(m),
189
+ "icon-before": e(q).ChevronRight,
190
+ "icon-size": e(j).Small,
191
+ size: e(D).Tiny,
192
+ "on-click": t.showNextItems,
193
+ variant: e(m) ? e(A).Text : t.variant,
159
194
  width: "30px",
160
195
  height: "30px",
161
196
  wrap: ""
162
197
  }, null, 8, ["align-content", "color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
163
198
  ], 2)
164
- ], 2)) : C("", !0)
199
+ ], 2)) : P("", !0)
165
200
  ], 64));
166
201
  }
167
- }), ke = ["data-testid"], Le = ["hidden"], Se = /* @__PURE__ */ re({
202
+ }), De = ["data-testid"], Re = ["hidden"], He = /* @__PURE__ */ xe({
168
203
  name: "CLCarousel",
169
204
  __name: "CLCarousel",
170
205
  props: {
171
- color: { default: ye.Neutral },
172
- controlAlign: { default: A.Right },
173
- controlPosition: { default: R.Before },
206
+ color: { default: Me.Neutral },
207
+ controlAlign: { default: Q.Right },
208
+ controlPosition: { default: Z.Before },
174
209
  enabled: { type: Boolean, default: !0 },
210
+ infinite: { type: Boolean, default: !1 },
175
211
  moreLabel: { default: "More" },
176
212
  onShowMore: {},
177
- paginationType: { default: $.Numbered },
213
+ paginationType: { default: E.Numbered },
178
214
  perPage: { default: 3 },
179
215
  perPageByBreakpoints: {},
180
216
  testId: { default: "clll-carousel" },
181
217
  title: {},
182
- variant: { default: B.Soft },
218
+ variant: { default: A.Soft },
183
219
  width: { default: "100%" }
184
220
  },
185
- setup(a) {
186
- be((t) => ({
187
- v512ef87c: t.width,
188
- v34e944c2: e(U)
221
+ setup(t) {
222
+ Ie((o) => ({
223
+ v3ba68b74: o.width,
224
+ v1ab12a15: e(oe)
189
225
  }));
190
- const o = "clll-carousel", i = a, I = r(), T = r(!1), f = r(1), g = r(i.perPage), N = Te("title"), k = r(!1), L = r(!1), v = r(!1), w = r(), m = r(!1), h = r(), b = r(), U = r("100%"), P = r(0), S = r(0), _ = () => {
191
- if (i.perPageByBreakpoints?.length) {
192
- g.value = i.perPage;
193
- for (const [t, n] of i.perPageByBreakpoints)
194
- window.matchMedia(`(min-width: ${t}px)`).matches && (g.value = n);
226
+ const l = "clll-carousel", n = t, V = v(), B = v(!1), p = v(1), c = v(n.perPage), $ = v(0), F = Oe("title"), W = v(!1), L = v(!1), C = v(!1), m = v(0), k = v(!1), R = v(), b = v(!1), z = v(), J = v(), oe = v("100%"), T = v(0), N = v(0), fe = () => {
227
+ if (n.perPageByBreakpoints?.length) {
228
+ c.value = n.perPage;
229
+ for (const [o, a] of n.perPageByBreakpoints)
230
+ window.matchMedia(`(min-width: ${o}px)`).matches && (c.value = a);
195
231
  }
196
- }, ee = () => {
197
- if (h?.value && S.value) {
198
- const n = Math.ceil(S.value / g.value);
199
- P.value = n, n > 1 && (k.value = !0);
232
+ }, ge = () => {
233
+ if (z?.value && N.value) {
234
+ const a = Math.ceil(N.value / c.value);
235
+ T.value = a, n.infinite ? (L.value = !0, C.value = !0) : a > 1 && (L.value = !0);
200
236
  }
201
- }, de = () => {
202
- se(() => {
203
- let t, n;
204
- const d = h?.value;
205
- if (d) {
206
- const p = d?.querySelectorAll(
207
- `div[class="${o}__slides"] > *`
208
- ) ?? [], z = S.value - 1;
209
- for (let M = 0; M < P.value; M++) {
210
- const V = g.value * (M + 1) - 1, ge = V < z ? p[V] : p[z], ie = V < z ? V : z;
211
- $e({ parent: d, child: ge, leftOffset: 40, rightOffset: 40, threshold: 0.5 }) && (ie === z ? (n = z, t = M + 1) : (n = ie, t = M + 1));
237
+ }, Se = () => {
238
+ W.value || Y(() => {
239
+ let o, a;
240
+ const i = z?.value;
241
+ if (i) {
242
+ const s = i?.querySelectorAll(
243
+ `div[class="${l}__slides"] > *`
244
+ ) ?? [];
245
+ if (n.infinite && n.enabled && m.value > 0) {
246
+ const u = i.offsetWidth, g = u / c.value, d = i.scrollLeft, S = $.value / 2, I = g * S, O = g * m.value;
247
+ let U = d - I;
248
+ U < 0 && (U = O + U);
249
+ const G = Math.floor(U / u) + 1;
250
+ if (G < 1 ? p.value = T.value : G > T.value ? p.value = 1 : p.value = G, !W.value) {
251
+ if (d < I) {
252
+ W.value = !0;
253
+ const K = d + O;
254
+ i.scrollTo({ left: K, behavior: "auto" }), setTimeout(() => {
255
+ W.value = !1;
256
+ }, 50);
257
+ } else if (d >= I + O) {
258
+ W.value = !0;
259
+ const K = d - O;
260
+ i.scrollTo({ left: K, behavior: "auto" }), setTimeout(() => {
261
+ W.value = !1;
262
+ }, 50);
263
+ }
264
+ }
265
+ } else {
266
+ const u = N.value - 1;
267
+ for (let g = 0; g < T.value; g++) {
268
+ const d = c.value * (g + 1) - 1, S = d < u ? s[d] : s[u], I = d < u ? d : u;
269
+ Ve({ parent: i, child: S, leftOffset: 40, rightOffset: 40, threshold: 0.5 }) && (I === u ? (a = u, o = g + 1) : (a = I, o = g + 1));
270
+ }
271
+ a !== void 0 && a > -1 && o && (p.value = o, o > 1 && (C.value = !0), o === 1 && (C.value = !1), o < T.value && (L.value = !0), o === T.value && (L.value = !1));
212
272
  }
213
- n !== void 0 && n > -1 && t && (f.value = t, t > 1 && (L.value = !0), t === 1 && (L.value = !1), t < P.value && (k.value = !0), t === P.value && (k.value = !1));
214
273
  }
215
274
  });
216
- }, ae = (t) => {
217
- I.value && se(() => {
218
- const n = Pe(I.value) && !N.value;
219
- !n && (t.title || t.controlPosition === R.Before) ? T.value = !1 : T.value = n;
275
+ }, he = (o) => {
276
+ V.value && Y(() => {
277
+ const a = Ae(V.value) && !F.value;
278
+ !a && (o.title || o.controlPosition === Z.Before) ? B.value = !1 : B.value = a;
220
279
  });
221
- }, j = (t) => {
222
- const n = h?.value, d = n.offsetWidth;
223
- if (n && d) {
224
- const p = t - 1, z = d * p;
225
- n.scrollTo({ left: z, behavior: "smooth" });
226
- }
227
- }, te = () => {
228
- v.value = !0, f.value = 1, _(), ne(), ee();
229
- const t = h?.value, n = t.offsetWidth;
230
- if (t) {
231
- const d = f.value - 1, p = n * d;
232
- t.scrollLeft = p;
233
- }
234
- H && v.value && (window.clearTimeout(w.value), w.value = window.setTimeout(() => {
235
- v.value && (v.value = !1), window.clearTimeout(w.value);
280
+ }, le = (o) => {
281
+ const a = z?.value, i = a.offsetWidth;
282
+ if (a && i)
283
+ if (n.infinite && n.enabled && m.value > 0) {
284
+ const s = i / c.value, u = $.value / 2, g = s * u, d = o - 1, S = g + i * d;
285
+ a.scrollTo({ left: S, behavior: "smooth" });
286
+ } else {
287
+ const s = o - 1, u = i * s;
288
+ a.scrollTo({ left: u, behavior: "smooth" });
289
+ }
290
+ }, me = () => {
291
+ k.value = !0;
292
+ const o = c.value;
293
+ fe(), we(), ge();
294
+ const a = z?.value, i = a.offsetWidth;
295
+ if (a)
296
+ if (n.infinite && n.enabled && m.value > 0) {
297
+ const s = i / c.value, u = i / o, g = $.value / 2, d = u * g, I = a.scrollLeft - d;
298
+ if (o !== c.value) {
299
+ const K = a.querySelectorAll(
300
+ `div[class="${l}__slides"] > *`
301
+ ), Ce = Array.from(K), H = Ce.slice(g, Ce.length - g);
302
+ a.innerHTML = "", H.forEach((ye) => a.appendChild(ye));
303
+ const X = Math.min(c.value, H.length);
304
+ X > 0 && H.length > 0 && (H.slice(-X).forEach((se) => {
305
+ const re = se.cloneNode(!0);
306
+ a.insertBefore(re, H[0]);
307
+ }), H.slice(0, X).forEach((se) => {
308
+ const re = se.cloneNode(!0);
309
+ a.appendChild(re);
310
+ }), $.value = X * 2);
311
+ }
312
+ const O = $.value / 2, G = s * O + I;
313
+ Y(() => {
314
+ a.scrollLeft = G;
315
+ });
316
+ } else {
317
+ p.value = 1;
318
+ const s = p.value - 1, u = i * s;
319
+ a.scrollLeft = u;
320
+ }
321
+ _ && k.value && (window.clearTimeout(R.value), R.value = window.setTimeout(() => {
322
+ k.value && (k.value = !1), window.clearTimeout(R.value);
236
323
  }, 300));
237
- }, oe = () => {
238
- v.value || (m.value = !0, H && m.value && (window.clearTimeout(b.value), b.value = window.setTimeout(() => {
239
- m.value && G(), window.clearTimeout(b.value);
324
+ }, be = () => {
325
+ k.value || (b.value = !0, _ && b.value && (window.clearTimeout(J.value), J.value = window.setTimeout(() => {
326
+ b.value && ae(), window.clearTimeout(J.value);
240
327
  }, 200)));
241
- }, G = () => {
242
- v.value || (m.value = !1, de());
243
- }, ne = () => {
244
- const t = h?.value;
245
- if (t) {
246
- const n = t.offsetWidth;
247
- S.value >= g.value ? U.value = `${n / g.value}px` : U.value = `${n / S.value}px`;
248
- }
249
- }, J = () => {
250
- const t = h?.value, n = t.offsetWidth;
251
- if (t && n) {
252
- const d = f.value, p = n * d;
253
- t.scrollTo({ left: p, behavior: "smooth" });
254
- }
255
- }, K = () => {
256
- const t = h?.value, n = t.offsetWidth;
257
- if (t && n) {
258
- const d = f.value - 1, p = n * (d - 1);
259
- t.scrollTo({ left: p, behavior: "smooth" });
328
+ }, ae = () => {
329
+ k.value || (b.value = !1, Se());
330
+ }, we = () => {
331
+ const o = z?.value;
332
+ if (o) {
333
+ const a = o.offsetWidth;
334
+ N.value >= c.value ? oe.value = `${a / c.value}px` : oe.value = `${a / N.value}px`;
260
335
  }
336
+ }, ne = () => {
337
+ const o = z?.value, a = o.offsetWidth;
338
+ if (o && a)
339
+ if (n.infinite && n.enabled && m.value > 0) {
340
+ const s = o.scrollLeft + a;
341
+ o.scrollTo({ left: s, behavior: "smooth" });
342
+ } else {
343
+ const i = p.value, s = a * i;
344
+ o.scrollTo({ left: s, behavior: "smooth" });
345
+ }
346
+ }, ie = () => {
347
+ const o = z?.value, a = o.offsetWidth;
348
+ if (o && a)
349
+ if (n.infinite && n.enabled && m.value > 0) {
350
+ const s = o.scrollLeft - a;
351
+ o.scrollTo({ left: s, behavior: "smooth" });
352
+ } else {
353
+ const i = p.value - 1, s = a * (i - 1);
354
+ o.scrollTo({ left: s, behavior: "smooth" });
355
+ }
261
356
  };
262
- we(() => {
263
- if (H) {
264
- window.addEventListener("resize", te);
265
- const t = h?.value;
266
- if (t) {
267
- const n = t?.querySelectorAll(
268
- `div[class="${o}__slides"] > *`
357
+ Ee(() => {
358
+ if (_) {
359
+ window.addEventListener("resize", me);
360
+ const o = z?.value;
361
+ if (o) {
362
+ const a = o?.querySelectorAll(
363
+ `div[class="${l}__slides"] > *`
269
364
  ) ?? [];
270
- S.value = n.length, t.addEventListener("scroll", oe), t.addEventListener("scrollend", G);
365
+ if (m.value = a.length, N.value = a.length, n.infinite && n.enabled && a.length > 0) {
366
+ const i = Array.from(a), s = Math.min(c.value, i.length);
367
+ i.slice(-s).forEach((d) => {
368
+ const S = d.cloneNode(!0);
369
+ o.insertBefore(S, i[0]);
370
+ }), i.slice(0, s).forEach((d) => {
371
+ const S = d.cloneNode(!0);
372
+ o.appendChild(S);
373
+ }), $.value = s * 2, Y(() => {
374
+ const I = o.offsetWidth / c.value * s;
375
+ o.scrollLeft = I;
376
+ });
377
+ }
378
+ o.addEventListener("scroll", be), o.addEventListener("scrollend", ae);
271
379
  }
272
- ae(i), _(), ne(), ee();
380
+ he(n), fe(), we(), ge();
273
381
  }
274
- }), pe(() => {
275
- if (H) {
276
- window.removeEventListener("resize", te), w.value && window.clearTimeout(w.value), b.value && window.clearTimeout(b.value);
277
- const t = h?.value;
278
- t && (t.removeEventListener("scroll", oe), t.removeEventListener("scrollend", G));
382
+ }), We(() => {
383
+ if (_) {
384
+ window.removeEventListener("resize", me), R.value && window.clearTimeout(R.value), J.value && window.clearTimeout(J.value);
385
+ const o = z?.value;
386
+ o && (o.removeEventListener("scroll", be), o.removeEventListener("scrollend", ae));
279
387
  }
280
388
  });
281
- const ue = u(() => [
282
- o,
283
- `${o}--${i.controlAlign}`,
284
- `${o}--${i.controlPosition}`,
285
- `${o}--${i.paginationType}`,
286
- i.enabled ? `${o}--enabled` : `${o}--disabled`,
287
- T.value ? "" : `${o}--hastitle`,
288
- i.onShowMore ? `${o}--has-more` : ""
289
- ]), ve = u(() => [
290
- `${o}__slide-controls`,
291
- N.value ? `${o}__slide-controls--hascustomtitle` : ""
292
- ]), fe = u(() => [
293
- `${o}__slides`,
294
- v.value ? `${o}__slides--resizing` : "",
295
- m.value ? `${o}__slides--scrolling` : ""
296
- ]), le = u(() => [
297
- `${o}__navigation`,
298
- `${o}__navigation--${i.controlAlign}`,
299
- `${o}__navigation--${i.controlPosition}`
389
+ const Pe = w(() => [
390
+ l,
391
+ `${l}--${n.controlAlign}`,
392
+ `${l}--${n.controlPosition}`,
393
+ `${l}--${n.paginationType}`,
394
+ n.enabled ? `${l}--enabled` : `${l}--disabled`,
395
+ B.value ? "" : `${l}--hastitle`,
396
+ n.onShowMore ? `${l}--has-more` : ""
397
+ ]), $e = w(() => [
398
+ `${l}__slide-controls`,
399
+ F.value ? `${l}__slide-controls--hascustomtitle` : ""
400
+ ]), Le = w(() => [
401
+ `${l}__slides`,
402
+ k.value ? `${l}__slides--resizing` : "",
403
+ b.value ? `${l}__slides--scrolling` : "",
404
+ W.value ? `${l}__slides--jumping` : ""
405
+ ]), pe = w(() => [
406
+ `${l}__navigation`,
407
+ `${l}__navigation--${n.controlAlign}`,
408
+ `${l}__navigation--${n.controlPosition}`
300
409
  ]);
301
- return Ce(i, (t) => {
302
- ae(t);
303
- }), (t, n) => (s(), c("div", {
304
- class: l(e(ue)),
305
- "data-testid": a.testId
410
+ return Be(n, (o) => {
411
+ he(o);
412
+ }), (o, a) => (f(), h("div", {
413
+ class: r(e(Pe)),
414
+ "data-testid": t.testId
306
415
  }, [
307
- y("div", {
416
+ x("div", {
308
417
  ref_key: "beforeControls",
309
- ref: I,
310
- class: l(e(ve)),
311
- hidden: e(T)
418
+ ref: V,
419
+ class: r(e($e)),
420
+ hidden: e(B)
312
421
  }, [
313
- y("div", {
314
- class: l(`${o}__custom-title`)
422
+ x("div", {
423
+ class: r(`${l}__custom-title`)
315
424
  }, [
316
- Z(t.$slots, "title")
425
+ ve(o.$slots, "title")
317
426
  ], 2),
318
- a.title ? (s(), c("div", {
427
+ t.title ? (f(), h("div", {
319
428
  key: 0,
320
- class: l(`${o}__title`)
429
+ class: r(`${l}__title`)
321
430
  }, [
322
- x(e(ce), {
323
- align: e(N) ? e(A).Center : e(A).Left,
431
+ y(e(Te), {
432
+ align: e(F) ? e(Q).Center : e(Q).Left,
324
433
  label: "",
325
434
  truncate: ""
326
435
  }, {
327
- default: X(() => [
328
- Y(q(a.title), 1)
436
+ default: de(() => [
437
+ ue(ee(t.title), 1)
329
438
  ]),
330
439
  _: 1
331
440
  }, 8, ["align"])
332
- ], 2)) : C("", !0),
333
- a.controlPosition === e(R).Before && ![e($).Inline, e($).Hidden].includes(a.paginationType) ? (s(), c(F, { key: 1 }, [
334
- e(P) && e(S) > e(g) ? (s(), c("div", {
441
+ ], 2)) : P("", !0),
442
+ t.controlPosition === e(Z).Before && ![e(E).Inline, e(E).Hidden].includes(t.paginationType) ? (f(), h(te, { key: 1 }, [
443
+ e(T) && e(N) > e(c) ? (f(), h("div", {
335
444
  key: 0,
336
- class: l(e(le))
445
+ class: r(e(pe))
337
446
  }, [
338
- x(Q, {
339
- color: a.color,
340
- "current-page": e(f),
341
- enabled: !e(m),
342
- "goto-page": j,
343
- "more-label": a.moreLabel,
344
- "next-page-enabled": e(k),
345
- "pagination-type": a.paginationType,
346
- "prev-page-enabled": e(L),
347
- prefix: o,
348
- "show-more": a.onShowMore,
349
- "show-next-items": J,
350
- "show-prev-items": K,
351
- "total-pages": e(P),
352
- variant: a.variant
447
+ y(ce, {
448
+ color: t.color,
449
+ "current-page": e(p),
450
+ enabled: !e(b),
451
+ "goto-page": le,
452
+ "more-label": t.moreLabel,
453
+ "next-page-enabled": e(L),
454
+ "pagination-type": t.paginationType,
455
+ "prev-page-enabled": e(C),
456
+ prefix: l,
457
+ "show-more": t.onShowMore,
458
+ "show-next-items": ne,
459
+ "show-prev-items": ie,
460
+ "total-pages": e(T),
461
+ variant: t.variant
353
462
  }, null, 8, ["color", "current-page", "enabled", "more-label", "next-page-enabled", "pagination-type", "prev-page-enabled", "show-more", "total-pages", "variant"])
354
- ], 2)) : C("", !0)
355
- ], 64)) : C("", !0)
356
- ], 10, Le),
357
- y("div", {
463
+ ], 2)) : P("", !0)
464
+ ], 64)) : P("", !0)
465
+ ], 10, Re),
466
+ x("div", {
358
467
  ref_key: "scrollContainer",
359
- ref: h,
360
- class: l(e(fe)),
468
+ ref: z,
469
+ class: r(e(Le)),
361
470
  tabindex: "0"
362
471
  }, [
363
- Z(t.$slots, "default")
472
+ ve(o.$slots, "default")
364
473
  ], 2),
365
- a.controlPosition === e(R).After && ![e($).Inline, e($).Hidden].includes(a.paginationType) ? (s(), c(F, { key: 0 }, [
366
- e(P) && e(S) > e(g) ? (s(), c("div", {
474
+ t.controlPosition === e(Z).After && ![e(E).Inline, e(E).Hidden].includes(t.paginationType) ? (f(), h(te, { key: 0 }, [
475
+ e(T) && e(N) > e(c) ? (f(), h("div", {
367
476
  key: 0,
368
- class: l(`${o}__slide-controls`)
477
+ class: r(`${l}__slide-controls`)
369
478
  }, [
370
- y("div", {
371
- class: l(e(le))
479
+ x("div", {
480
+ class: r(e(pe))
372
481
  }, [
373
- x(Q, {
374
- color: a.color,
375
- "current-page": e(f),
376
- enabled: !e(m),
377
- "goto-page": j,
378
- "more-label": a.moreLabel,
379
- "next-page-enabled": e(k),
380
- "pagination-type": a.paginationType,
381
- prefix: o,
382
- "prev-page-enabled": e(L),
383
- "show-more": a.onShowMore,
384
- "show-next-items": J,
385
- "show-prev-items": K,
386
- "total-pages": e(P),
387
- variant: a.variant
482
+ y(ce, {
483
+ color: t.color,
484
+ "current-page": e(p),
485
+ enabled: !e(b),
486
+ "goto-page": le,
487
+ "more-label": t.moreLabel,
488
+ "next-page-enabled": e(L),
489
+ "pagination-type": t.paginationType,
490
+ prefix: l,
491
+ "prev-page-enabled": e(C),
492
+ "show-more": t.onShowMore,
493
+ "show-next-items": ne,
494
+ "show-prev-items": ie,
495
+ "total-pages": e(T),
496
+ variant: t.variant
388
497
  }, null, 8, ["color", "current-page", "enabled", "more-label", "next-page-enabled", "pagination-type", "prev-page-enabled", "show-more", "total-pages", "variant"])
389
498
  ], 2)
390
- ], 2)) : C("", !0)
391
- ], 64)) : C("", !0),
392
- a.paginationType === e($).Inline ? (s(), c("div", {
499
+ ], 2)) : P("", !0)
500
+ ], 64)) : P("", !0),
501
+ t.paginationType === e(E).Inline ? (f(), h("div", {
393
502
  key: 1,
394
- class: l(`${o}__slide-controls ${o}__slide-controls--inline`)
503
+ class: r(`${l}__slide-controls ${l}__slide-controls--inline`)
395
504
  }, [
396
- y("div", {
397
- class: l(`${o}__navigation`)
505
+ x("div", {
506
+ class: r(`${l}__navigation`)
398
507
  }, [
399
- x(Q, {
400
- color: a.color,
401
- "current-page": e(f),
402
- enabled: !e(m),
403
- "goto-page": j,
404
- "more-label": a.moreLabel,
405
- "next-page-enabled": e(k),
406
- "pagination-type": a.paginationType,
407
- prefix: o,
408
- "prev-page-enabled": e(L),
409
- "show-more": a.onShowMore,
410
- "show-next-items": J,
411
- "show-prev-items": K,
412
- "total-pages": e(P),
413
- variant: a.variant
508
+ y(ce, {
509
+ color: t.color,
510
+ "current-page": e(p),
511
+ enabled: !e(b),
512
+ "goto-page": le,
513
+ "more-label": t.moreLabel,
514
+ "next-page-enabled": e(L),
515
+ "pagination-type": t.paginationType,
516
+ prefix: l,
517
+ "prev-page-enabled": e(C),
518
+ "show-more": t.onShowMore,
519
+ "show-next-items": ne,
520
+ "show-prev-items": ie,
521
+ "total-pages": e(T),
522
+ variant: t.variant
414
523
  }, null, 8, ["color", "current-page", "enabled", "more-label", "next-page-enabled", "pagination-type", "prev-page-enabled", "show-more", "total-pages", "variant"])
415
524
  ], 2)
416
- ], 2)) : C("", !0)
417
- ], 10, ke));
525
+ ], 2)) : P("", !0)
526
+ ], 10, De));
418
527
  }
419
- }), ze = (a, o) => {
420
- const i = a.__vccOpts || a;
421
- for (const [I, T] of o)
422
- i[I] = T;
423
- return i;
424
- }, Ie = {}, Ee = {
425
- class: /* @__PURE__ */ l(["clll-carousel__slide"])
528
+ }), je = (t, l) => {
529
+ const n = t.__vccOpts || t;
530
+ for (const [V, B] of l)
531
+ n[V] = B;
532
+ return n;
533
+ }, qe = {}, Fe = {
534
+ class: /* @__PURE__ */ r(["clll-carousel__slide"])
426
535
  };
427
- function Be(a, o) {
428
- return s(), c("div", Ee, [
429
- Z(a.$slots, "default")
536
+ function Je(t, l) {
537
+ return f(), h("div", Fe, [
538
+ ve(t.$slots, "default")
430
539
  ]);
431
540
  }
432
- const Ne = /* @__PURE__ */ ze(Ie, [["render", Be]]), Me = Se;
433
- Me.Slide = Ne;
541
+ const Ue = /* @__PURE__ */ je(qe, [["render", Je]]), Ge = He;
542
+ Ge.Slide = Ue;
434
543
  export {
435
- Me as CLCarousel,
436
- Me as default
544
+ Ge as CLCarousel,
545
+ Ge as default
437
546
  };