@codeandfunction/callaloo 4.9.4 → 4.9.5
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/callaloo.global.js +1 -1
- package/dist/chunks/CLA11yButton.vue_vue_type_style_index_0_lang-BHF3fJsf.js +2 -0
- package/dist/chunks/CLButton.vue_vue_type_style_index_0_lang-3vGTMU-k.js +2 -0
- package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-BAfGE35e.js +2 -0
- package/dist/chunks/CLCard.vue_vue_type_style_index_0_lang-DPQxSLkQ.js +2 -0
- package/dist/chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-BYHbqaf0.js +2 -0
- package/dist/chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-BPwFZq94.js +1 -0
- package/dist/chunks/CLHeading.vue_vue_type_style_index_0_lang-CsmrsD6c.js +2 -0
- package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-yF4CdZbV.js +2 -0
- package/dist/chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DCByJ7MB.js +2 -0
- package/dist/chunks/CLLink.vue_vue_type_style_index_0_lang-CCyY39MJ.js +2 -0
- package/dist/chunks/CLModal.vue_vue_type_style_index_0_lang-CwdYGfO9.js +2 -0
- package/dist/chunks/CLNavLink.vue_vue_type_script_setup_true_lang-Ds2aJNK9.js +1 -0
- package/dist/chunks/CLPill.vue_vue_type_style_index_0_lang-BVsLNnfE.js +2 -0
- package/dist/chunks/CLSkeleton.vue_vue_type_style_index_0_lang-BmjT9fQ_.js +2 -0
- package/dist/chunks/CLSpinner.vue_vue_type_style_index_0_lang-DgZLt9T1.js +2 -0
- package/dist/chunks/CLText.vue_vue_type_style_index_0_lang-CMXJdE-D.js +2 -0
- package/dist/chunks/CLToast.vue_vue_type_style_index_0_lang-BIehrtqC.js +2 -0
- package/dist/chunks/context-CRxE5KWX.js +1 -0
- package/dist/chunks/context-JmPivI9V.js +1 -0
- package/dist/chunks/floating-ui.vue-C0JWy0Dz.js +1 -0
- package/dist/chunks/helper-C542dSLs.js +1 -0
- package/dist/chunks/icons-6SVrmx7c.js +1 -0
- package/dist/chunks/utils-C1iUBPIL.js +1 -0
- package/dist/chunks/utils-CCWSWRuR.js +1 -0
- package/dist/chunks/utils-CYywa195.js +1 -0
- package/dist/chunks/utils-DVxwAjJ4.js +1 -0
- package/dist/chunks/utils-Dst7nzvj.js +1 -0
- package/dist/chunks/utils-MElq6rY3.js +1 -0
- package/dist/components/Buttons/CLA11yButton/CLA11yButton.js +1 -5
- package/dist/components/Buttons/CLButton/CLButton.js +1 -5
- package/dist/components/CLIcon/CLIcon.js +1 -5
- package/dist/components/CLTable/CLTable.js +1 -192
- package/dist/components/Containers/CLCard/CLCard.js +1 -5
- package/dist/components/Containers/CLCarousel/CLCarousel.js +1 -544
- package/dist/components/Containers/CLDisclosure/CLDisclosure.js +1 -139
- package/dist/components/Containers/CLDrawer/CLDrawer.js +1 -119
- package/dist/components/Form/CLCalendar/CLCalendar.js +1 -5
- package/dist/components/Form/CLCheckbox/CLCheckbox.js +1 -150
- package/dist/components/Form/CLInput/CLInput.js +1 -450
- package/dist/components/Form/CLInputDatePicker/CLInputDatePicker.js +1 -178
- package/dist/components/Form/CLRadioButton/CLRadioButton.js +1 -135
- package/dist/components/Form/CLSelect/CLSelect.js +1 -140
- package/dist/components/Form/CLTextArea/CLTextArea.js +1 -149
- package/dist/components/Indicators/CLBadge/CLBadge.js +1 -40
- package/dist/components/Indicators/CLBanner/CLBanner.js +1 -145
- package/dist/components/Indicators/CLPill/CLPill.js +1 -5
- package/dist/components/Indicators/CLProgress/CLProgress.js +1 -64
- package/dist/components/Loading/CLSkeleton/CLSkeleton.js +1 -5
- package/dist/components/Loading/CLSpinner/CLSpinner.js +1 -5
- package/dist/components/Modals/CLModal/CLModal.js +1 -5
- package/dist/components/Modals/CLModalDatePicker/CLModalDatePicker.js +1 -182
- package/dist/components/Navigation/CLLink/CLLink.js +1 -5
- package/dist/components/Navigation/CLNavLink/CLNavLink.js +1 -5
- package/dist/components/Navigation/CLNavSection/CLNavSection.js +1 -54
- package/dist/components/Popups/CLDropdownMenu/CLDropdownMenu.js +1 -150
- package/dist/components/Popups/CLToast/CLToast.js +1 -5
- package/dist/components/Providers/CLThemeProvider/CLThemeProvider.js +1 -8
- package/dist/components/Providers/CLToastProvider/CLToastProvider.js +1 -7
- package/dist/components/Typography/CLHeading/CLHeading.js +1 -5
- package/dist/components/Typography/CLText/CLText.js +1 -5
- package/dist/composables/useDateInputMask.js +1 -38
- package/dist/composables/useDatePicker.js +1 -140
- package/dist/composables/useDropdown.js +1 -49
- package/dist/composables/useElementSize.js +1 -73
- package/dist/composables/useEsc.js +1 -19
- package/dist/composables/useHasSlotContent.js +1 -14
- package/dist/composables/useTheme.js +1 -40
- package/dist/composables/useToast.js +1 -17
- package/dist/index.js +1 -30
- package/package.json +20 -20
- package/dist/chunks/CLA11yButton.vue_vue_type_style_index_0_lang-zGLnnSIW.js +0 -47
- package/dist/chunks/CLButton.vue_vue_type_style_index_0_lang-MvhnNzVW.js +0 -136
- package/dist/chunks/CLCalendar.vue_vue_type_style_index_0_lang-Bz1JdT1A.js +0 -163
- package/dist/chunks/CLCard.vue_vue_type_style_index_0_lang-Sre7UYZd.js +0 -263
- package/dist/chunks/CLFormCharCounter.vue_vue_type_style_index_0_lang-CJ4VrvmR.js +0 -39
- package/dist/chunks/CLFormLabel.vue_vue_type_script_setup_true_lang-CIQxM6aH.js +0 -46
- package/dist/chunks/CLHeading.vue_vue_type_style_index_0_lang-DH5oJc1C.js +0 -52
- package/dist/chunks/CLIcon.vue_vue_type_style_index_0_lang-Dhr2tI-g.js +0 -113
- package/dist/chunks/CLInputMessages.vue_vue_type_style_index_0_lang-DTWvAACK.js +0 -149
- package/dist/chunks/CLLink.vue_vue_type_style_index_0_lang-BXysZqLn.js +0 -69
- package/dist/chunks/CLModal.vue_vue_type_style_index_0_lang-BDyONfaQ.js +0 -176
- package/dist/chunks/CLNavLink.vue_vue_type_script_setup_true_lang-Dhnmfa9W.js +0 -44
- package/dist/chunks/CLPill.vue_vue_type_style_index_0_lang-BQim03ge.js +0 -94
- package/dist/chunks/CLSkeleton.vue_vue_type_style_index_0_lang-DduoX6Cu.js +0 -31
- package/dist/chunks/CLSpinner.vue_vue_type_style_index_0_lang-DlXqnsi8.js +0 -55
- package/dist/chunks/CLText.vue_vue_type_style_index_0_lang-B-L8ECJL.js +0 -48
- package/dist/chunks/CLThemeProvider.vue_vue_type_script_setup_true_lang-jaJYKZL8.js +0 -59
- package/dist/chunks/CLToast.vue_vue_type_style_index_0_lang-CzSDeL_X.js +0 -202
- package/dist/chunks/CLToastProvider.vue_vue_type_script_setup_true_lang-DkGK0H4Z.js +0 -35
- package/dist/chunks/context-CEvx70FY.js +0 -264
- package/dist/chunks/context-dkA4VoF7.js +0 -4
- package/dist/chunks/floating-ui.vue-Fx4CxKut.js +0 -1057
- package/dist/chunks/helper-qUkciePY.js +0 -81
- package/dist/chunks/icons-DllZKtC2.js +0 -4
- package/dist/chunks/magic-string.es-uPKorP4O.js +0 -663
- package/dist/chunks/utils-BfOa9ckr.js +0 -24
- package/dist/chunks/utils-BjZURPWx.js +0 -51
- package/dist/chunks/utils-C1xiySYN.js +0 -41
- package/dist/chunks/utils-D00IXMTR.js +0 -25
- package/dist/chunks/utils-eBt2zUZl.js +0 -17
- package/dist/chunks/utils-nD3K7jh9.js +0 -85
- package/dist/chunks/vue-test-utils.esm-bundler-BeQTU4qG.js +0 -18679
- package/dist/composables/useDatePicker.spec.js +0 -232
- package/dist/composables/useTheme.spec.js +0 -88
- package/dist/composables/useToast.spec.js +0 -45
|
@@ -1,546 +1,3 @@
|
|
|
1
1
|
import '../../../assets/core.css';
|
|
2
2
|
import './CLCarousel.css';
|
|
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-MvhnNzVW.js";
|
|
5
|
-
import { _ as Te } from "../../../chunks/CLText.vue_vue_type_style_index_0_lang-B-L8ECJL.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-qUkciePY.js";
|
|
8
|
-
import { useHasSlotContent as Oe } from "../../../composables/useHasSlotContent.js";
|
|
9
|
-
const ce = /* @__PURE__ */ xe({
|
|
10
|
-
name: "CLCarouselNavigation",
|
|
11
|
-
__name: "CLCarouselNavigation",
|
|
12
|
-
props: {
|
|
13
|
-
color: {},
|
|
14
|
-
currentPage: {},
|
|
15
|
-
enabled: { type: Boolean },
|
|
16
|
-
gotoPage: {},
|
|
17
|
-
moreAriaLabel: { default: "Navigate to page to see more results" },
|
|
18
|
-
moreLabel: {},
|
|
19
|
-
nextPageEnabled: { type: Boolean },
|
|
20
|
-
paginationType: {},
|
|
21
|
-
prefix: {},
|
|
22
|
-
prevPageEnabled: { type: Boolean },
|
|
23
|
-
showMore: {},
|
|
24
|
-
showNextItems: {},
|
|
25
|
-
showPrevItems: {},
|
|
26
|
-
totalPages: {},
|
|
27
|
-
variant: {}
|
|
28
|
-
},
|
|
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", {
|
|
49
|
-
key: 0,
|
|
50
|
-
class: r(e(n))
|
|
51
|
-
}, [
|
|
52
|
-
(f(!0), h(te, null, ke(t.totalPages, (b) => (f(), ze(e(M), {
|
|
53
|
-
key: `dot-${b}`,
|
|
54
|
-
"aria-label": `Show page ${b}`,
|
|
55
|
-
color: t.color,
|
|
56
|
-
disabled: L(b),
|
|
57
|
-
height: "0.75rem",
|
|
58
|
-
"on-click": () => t.gotoPage(b),
|
|
59
|
-
width: "0.75rem",
|
|
60
|
-
variant: L(b) ? e(A).Outline : t.variant,
|
|
61
|
-
wrap: ""
|
|
62
|
-
}, null, 8, ["aria-label", "color", "disabled", "on-click", "variant"]))), 128))
|
|
63
|
-
], 2)) : P("", !0),
|
|
64
|
-
t.paginationType === e(E).Numbered ? (f(), h("div", {
|
|
65
|
-
key: 1,
|
|
66
|
-
class: r(e(B))
|
|
67
|
-
}, [
|
|
68
|
-
x("div", {
|
|
69
|
-
class: r(e(c))
|
|
70
|
-
}, [
|
|
71
|
-
y(e(M), {
|
|
72
|
-
"aria-label": "Show previous page of slides",
|
|
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
|
|
80
|
-
}, null, 8, ["color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
|
|
81
|
-
], 2),
|
|
82
|
-
x("div", {
|
|
83
|
-
class: r(e(F))
|
|
84
|
-
}, [
|
|
85
|
-
y(e(Te), {
|
|
86
|
-
type: e(Ne).Small
|
|
87
|
-
}, {
|
|
88
|
-
default: de(() => [
|
|
89
|
-
ue(ee(t.currentPage) + " / " + ee(t.totalPages), 1)
|
|
90
|
-
]),
|
|
91
|
-
_: 1
|
|
92
|
-
}, 8, ["type"])
|
|
93
|
-
], 2),
|
|
94
|
-
x("div", {
|
|
95
|
-
class: r(e($))
|
|
96
|
-
}, [
|
|
97
|
-
y(e(M), {
|
|
98
|
-
"aria-label": "Show next page of slides",
|
|
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
|
|
106
|
-
}, null, 8, ["color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
|
|
107
|
-
], 2),
|
|
108
|
-
t.showMore ? (f(), h("div", {
|
|
109
|
-
key: 0,
|
|
110
|
-
class: r(e(W))
|
|
111
|
-
}, [
|
|
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
|
|
118
|
-
}, {
|
|
119
|
-
default: de(() => [
|
|
120
|
-
ue(ee(t.moreLabel), 1)
|
|
121
|
-
]),
|
|
122
|
-
_: 1
|
|
123
|
-
}, 8, ["aria-label", "color", "size", "on-click", "variant"])
|
|
124
|
-
], 2)) : P("", !0)
|
|
125
|
-
], 2)) : P("", !0),
|
|
126
|
-
t.paginationType === e(E).Arrows ? (f(), h("div", {
|
|
127
|
-
key: 2,
|
|
128
|
-
class: r(e(V))
|
|
129
|
-
}, [
|
|
130
|
-
x("div", {
|
|
131
|
-
class: r(e(c))
|
|
132
|
-
}, [
|
|
133
|
-
y(e(M), {
|
|
134
|
-
"aria-label": "Show previous page of slides",
|
|
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,
|
|
176
|
-
width: "30px",
|
|
177
|
-
height: "30px",
|
|
178
|
-
wrap: ""
|
|
179
|
-
}, null, 8, ["align-content", "color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
|
|
180
|
-
], 2),
|
|
181
|
-
x("div", {
|
|
182
|
-
class: r(e($))
|
|
183
|
-
}, [
|
|
184
|
-
y(e(M), {
|
|
185
|
-
"aria-label": "Show next page of slides",
|
|
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,
|
|
194
|
-
width: "30px",
|
|
195
|
-
height: "30px",
|
|
196
|
-
wrap: ""
|
|
197
|
-
}, null, 8, ["align-content", "color", "disabled", "icon-before", "icon-size", "size", "on-click", "variant"])
|
|
198
|
-
], 2)
|
|
199
|
-
], 2)) : P("", !0)
|
|
200
|
-
], 64));
|
|
201
|
-
}
|
|
202
|
-
}), De = ["data-testid"], Re = ["hidden"], He = /* @__PURE__ */ xe({
|
|
203
|
-
name: "CLCarousel",
|
|
204
|
-
__name: "CLCarousel",
|
|
205
|
-
props: {
|
|
206
|
-
color: { default: Me.Neutral },
|
|
207
|
-
controlAlign: { default: Q.Right },
|
|
208
|
-
controlPosition: { default: Z.Before },
|
|
209
|
-
enabled: { type: Boolean, default: !0 },
|
|
210
|
-
infinite: { type: Boolean, default: !1 },
|
|
211
|
-
moreLabel: { default: "More" },
|
|
212
|
-
onShowMore: {},
|
|
213
|
-
paginationType: { default: E.Numbered },
|
|
214
|
-
perPage: { default: 3 },
|
|
215
|
-
perPageByBreakpoints: {},
|
|
216
|
-
testId: { default: "clll-carousel" },
|
|
217
|
-
title: {},
|
|
218
|
-
variant: { default: A.Soft },
|
|
219
|
-
width: { default: "100%" }
|
|
220
|
-
},
|
|
221
|
-
setup(t) {
|
|
222
|
-
Ie((o) => ({
|
|
223
|
-
v3ba68b74: o.width,
|
|
224
|
-
v1ab12a15: e(oe)
|
|
225
|
-
}));
|
|
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);
|
|
231
|
-
}
|
|
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);
|
|
236
|
-
}
|
|
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));
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
});
|
|
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;
|
|
279
|
-
});
|
|
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);
|
|
323
|
-
}, 300));
|
|
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);
|
|
327
|
-
}, 200)));
|
|
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`;
|
|
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
|
-
}
|
|
356
|
-
};
|
|
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"] > *`
|
|
364
|
-
) ?? [];
|
|
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);
|
|
379
|
-
}
|
|
380
|
-
he(n), fe(), we(), ge();
|
|
381
|
-
}
|
|
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));
|
|
387
|
-
}
|
|
388
|
-
});
|
|
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}`
|
|
409
|
-
]);
|
|
410
|
-
return Be(n, (o) => {
|
|
411
|
-
he(o);
|
|
412
|
-
}), (o, a) => (f(), h("div", {
|
|
413
|
-
class: r(e(Pe)),
|
|
414
|
-
"data-testid": t.testId
|
|
415
|
-
}, [
|
|
416
|
-
x("div", {
|
|
417
|
-
ref_key: "beforeControls",
|
|
418
|
-
ref: V,
|
|
419
|
-
class: r(e($e)),
|
|
420
|
-
hidden: e(B)
|
|
421
|
-
}, [
|
|
422
|
-
x("div", {
|
|
423
|
-
class: r(`${l}__custom-title`)
|
|
424
|
-
}, [
|
|
425
|
-
ve(o.$slots, "title")
|
|
426
|
-
], 2),
|
|
427
|
-
t.title ? (f(), h("div", {
|
|
428
|
-
key: 0,
|
|
429
|
-
class: r(`${l}__title`)
|
|
430
|
-
}, [
|
|
431
|
-
y(e(Te), {
|
|
432
|
-
align: e(F) ? e(Q).Center : e(Q).Left,
|
|
433
|
-
label: "",
|
|
434
|
-
truncate: ""
|
|
435
|
-
}, {
|
|
436
|
-
default: de(() => [
|
|
437
|
-
ue(ee(t.title), 1)
|
|
438
|
-
]),
|
|
439
|
-
_: 1
|
|
440
|
-
}, 8, ["align"])
|
|
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", {
|
|
444
|
-
key: 0,
|
|
445
|
-
class: r(e(pe))
|
|
446
|
-
}, [
|
|
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
|
|
462
|
-
}, null, 8, ["color", "current-page", "enabled", "more-label", "next-page-enabled", "pagination-type", "prev-page-enabled", "show-more", "total-pages", "variant"])
|
|
463
|
-
], 2)) : P("", !0)
|
|
464
|
-
], 64)) : P("", !0)
|
|
465
|
-
], 10, Re),
|
|
466
|
-
x("div", {
|
|
467
|
-
ref_key: "scrollContainer",
|
|
468
|
-
ref: z,
|
|
469
|
-
class: r(e(Le)),
|
|
470
|
-
tabindex: "0"
|
|
471
|
-
}, [
|
|
472
|
-
ve(o.$slots, "default")
|
|
473
|
-
], 2),
|
|
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", {
|
|
476
|
-
key: 0,
|
|
477
|
-
class: r(`${l}__slide-controls`)
|
|
478
|
-
}, [
|
|
479
|
-
x("div", {
|
|
480
|
-
class: r(e(pe))
|
|
481
|
-
}, [
|
|
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
|
|
497
|
-
}, null, 8, ["color", "current-page", "enabled", "more-label", "next-page-enabled", "pagination-type", "prev-page-enabled", "show-more", "total-pages", "variant"])
|
|
498
|
-
], 2)
|
|
499
|
-
], 2)) : P("", !0)
|
|
500
|
-
], 64)) : P("", !0),
|
|
501
|
-
t.paginationType === e(E).Inline ? (f(), h("div", {
|
|
502
|
-
key: 1,
|
|
503
|
-
class: r(`${l}__slide-controls ${l}__slide-controls--inline`)
|
|
504
|
-
}, [
|
|
505
|
-
x("div", {
|
|
506
|
-
class: r(`${l}__navigation`)
|
|
507
|
-
}, [
|
|
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
|
|
523
|
-
}, null, 8, ["color", "current-page", "enabled", "more-label", "next-page-enabled", "pagination-type", "prev-page-enabled", "show-more", "total-pages", "variant"])
|
|
524
|
-
], 2)
|
|
525
|
-
], 2)) : P("", !0)
|
|
526
|
-
], 10, De));
|
|
527
|
-
}
|
|
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"])
|
|
535
|
-
};
|
|
536
|
-
function Je(t, l) {
|
|
537
|
-
return f(), h("div", Fe, [
|
|
538
|
-
ve(t.$slots, "default")
|
|
539
|
-
]);
|
|
540
|
-
}
|
|
541
|
-
const Ue = /* @__PURE__ */ je(qe, [["render", Je]]), Ge = He;
|
|
542
|
-
Ge.Slide = Ue;
|
|
543
|
-
export {
|
|
544
|
-
Ge as CLCarousel,
|
|
545
|
-
Ge as default
|
|
546
|
-
};
|
|
3
|
+
import{defineComponent as e,computed as a,createElementBlock as l,openBlock as o,Fragment as i,createCommentVNode as t,unref as n,normalizeClass as s,renderList as r,createBlock as c,createElementVNode as v,createVNode as d,withCtx as u,createTextVNode as p,toDisplayString as f,useCssVars as g,ref as h,onMounted as b,nextTick as m,onUnmounted as _,watch as w,renderSlot as y}from"vue";import{_ as x}from"../../../chunks/CLButton.vue_vue_type_style_index_0_lang-3vGTMU-k.js";import{_ as T}from"../../../chunks/CLText.vue_vue_type_style_index_0_lang-CMXJdE-D.js";import{CLPaginationType as $,CLColorVariants as k,CLSizes as L,CLIconSizes as z,CLIconNames as P,CLTextTypes as C,CLAlign as S,CLOrder as B,CLColors as E}from"../../../index.js";import{i as M,d as I,e as N}from"../../../chunks/helper-C542dSLs.js";import{useHasSlotContent as A}from"../../../composables/useHasSlotContent.js";const W=/* @__PURE__ */e({name:"CLCarouselNavigation",__name:"CLCarouselNavigation",props:{color:{},currentPage:{},enabled:{type:Boolean},gotoPage:{},moreAriaLabel:{default:"Navigate to page to see more results"},moreLabel:{},nextPageEnabled:{type:Boolean},paginationType:{},prefix:{},prevPageEnabled:{type:Boolean},showMore:{},showNextItems:{},showPrevItems:{},totalPages:{},variant:{}},setup(e){const g=e,h=a(()=>[`${g.prefix}__dots-container`]),b=a(()=>[`${g.prefix}__arrows-container`]),m=a(()=>[`${g.prefix}__numbered-container`]),_=a(()=>[`${g.prefix}__inline-container`]),w=a(()=>[`${g.prefix}__prev-page`]),y=a(()=>[`${g.prefix}__next-page`]),B=a(()=>[`${g.prefix}__page-indicator`]),E=a(()=>[`${g.prefix}__show-more`]),M=e=>g.currentPage===e,I=a(()=>!g.enabled||!g.prevPageEnabled),N=a(()=>!g.enabled||!g.nextPageEnabled);return(a,g)=>(o(),l(i,null,[e.paginationType===n($).Dots?(o(),l("div",{key:0,class:s(n(h))},[(o(!0),l(i,null,r(e.totalPages,a=>(o(),c(n(x),{key:`dot-${a}`,"aria-label":`Show page ${a}`,color:e.color,disabled:M(a),height:"0.75rem","on-click":()=>e.gotoPage(a),width:"0.75rem",variant:M(a)?n(k).Outline:e.variant,wrap:""},null,8,["aria-label","color","disabled","on-click","variant"]))),128))],2)):t("",!0),e.paginationType===n($).Numbered?(o(),l("div",{key:1,class:s(n(m))},[v("div",{class:s(n(w))},[d(n(x),{"aria-label":"Show previous page of slides",color:e.color,disabled:n(I),"icon-before":n(P).ChevronLeft,"icon-size":n(z).Tiny,size:n(L).Tiny,"on-click":e.showPrevItems,variant:n(I)?n(k).Text:e.variant},null,8,["color","disabled","icon-before","icon-size","size","on-click","variant"])],2),v("div",{class:s(n(B))},[d(n(T),{type:n(C).Small},{default:u(()=>[p(f(e.currentPage)+" / "+f(e.totalPages),1)]),_:1},8,["type"])],2),v("div",{class:s(n(y))},[d(n(x),{"aria-label":"Show next page of slides",color:e.color,disabled:n(N),"icon-before":n(P).ChevronRight,"icon-size":n(z).Tiny,size:n(L).Tiny,"on-click":e.showNextItems,variant:n(N)?n(k).Text:e.variant},null,8,["color","disabled","icon-before","icon-size","size","on-click","variant"])],2),e.showMore?(o(),l("div",{key:0,class:s(n(E))},[d(n(x),{"aria-label":e.moreAriaLabel,color:e.color,size:n(L).Small,"on-click":e.showMore,variant:e.variant},{default:u(()=>[p(f(e.moreLabel),1)]),_:1},8,["aria-label","color","size","on-click","variant"])],2)):t("",!0)],2)):t("",!0),e.paginationType===n($).Arrows?(o(),l("div",{key:2,class:s(n(b))},[v("div",{class:s(n(w))},[d(n(x),{"aria-label":"Show previous page of slides",color:e.color,disabled:n(I),"icon-before":n(P).ChevronLeft,"icon-size":n(z).Tiny,size:n(L).Tiny,"on-click":e.showPrevItems,variant:n(I)?n(k).Text:e.variant},null,8,["color","disabled","icon-before","icon-size","size","on-click","variant"])],2),v("div",{class:s(n(y))},[d(n(x),{"aria-label":"Show next page of slides",color:e.color,disabled:n(N),"icon-before":n(P).ChevronRight,"icon-size":n(z).Tiny,size:n(L).Tiny,"on-click":e.showNextItems,variant:n(N)?n(k).Text:e.variant},null,8,["color","disabled","icon-before","icon-size","size","on-click","variant"])],2)],2)):t("",!0),e.paginationType===n($).Inline?(o(),l("div",{key:3,class:s(n(_))},[v("div",{class:s(n(w))},[d(n(x),{"aria-label":"Show previous page of slides","align-content":n(S).Center,color:e.color,disabled:n(I),"icon-before":n(P).ChevronLeft,"icon-size":n(z).Small,size:n(L).Tiny,"on-click":e.showPrevItems,variant:n(I)?n(k).Text:e.variant,width:"30px",height:"30px",wrap:""},null,8,["align-content","color","disabled","icon-before","icon-size","size","on-click","variant"])],2),v("div",{class:s(n(y))},[d(n(x),{"aria-label":"Show next page of slides","align-content":n(S).Center,color:e.color,disabled:n(N),"icon-before":n(P).ChevronRight,"icon-size":n(z).Small,size:n(L).Tiny,"on-click":e.showNextItems,variant:n(N)?n(k).Text:e.variant,width:"30px",height:"30px",wrap:""},null,8,["align-content","color","disabled","icon-before","icon-size","size","on-click","variant"])],2)],2)):t("",!0)],64))}}),j=["data-testid"],H=["hidden"],O=/* @__PURE__ */e({name:"CLCarousel",__name:"CLCarousel",props:{color:{default:E.Neutral},controlAlign:{default:S.Right},controlPosition:{default:B.Before},enabled:{type:Boolean,default:!0},infinite:{type:Boolean,default:!1},moreLabel:{default:"More"},onShowMore:{},paginationType:{default:$.Numbered},perPage:{default:3},perPageByBreakpoints:{},testId:{default:"clll-carousel"},title:{},variant:{default:k.Soft},width:{default:"100%"}},setup(e){g(e=>({v3ba68b74:e.width,v1ab12a15:n(Q)}));const r="clll-carousel",c=e,x=h(),k=h(!1),L=h(1),z=h(c.perPage),P=h(0),C=A("title"),E=h(!1),O=h(!1),R=h(!1),q=h(0),D=h(!1),F=h(),G=h(!1),J=h(),K=h(),Q=h("100%"),U=h(0),V=h(0),X=()=>{if(c.perPageByBreakpoints?.length){z.value=c.perPage;for(const[e,a]of c.perPageByBreakpoints){window.matchMedia(`(min-width: ${e}px)`).matches&&(z.value=a)}}},Y=()=>{const e=J?.value;if(e&&V.value){const e=Math.ceil(V.value/z.value);U.value=e,c.infinite?(O.value=!0,R.value=!0):e>1&&(O.value=!0)}},Z=e=>{x.value&&m(()=>{const a=I(x.value)&&!C.value;a||!e.title&&e.controlPosition!==B.Before?k.value=a:k.value=!1})},ee=e=>{const a=J?.value,l=a.offsetWidth;if(a&&l)if(c.infinite&&c.enabled&&q.value>0){const o=l/z.value*(P.value/2)+l*(e-1);a.scrollTo({left:o,behavior:"smooth"})}else{const o=l*(e-1);a.scrollTo({left:o,behavior:"smooth"})}},ae=()=>{D.value=!0;const e=z.value;X(),ie(),Y();const a=J?.value,l=a.offsetWidth;if(a)if(c.infinite&&c.enabled&&q.value>0){const o=l/z.value,i=l/e,t=P.value/2,n=i*t,s=a.scrollLeft-n;if(e!==z.value){const e=a.querySelectorAll(`div[class="${r}__slides"] > *`),l=Array.from(e),o=l.slice(t,l.length-t);a.innerHTML="",o.forEach(e=>a.appendChild(e));const i=Math.min(z.value,o.length);if(i>0&&o.length>0){o.slice(-i).forEach(e=>{const l=e.cloneNode(!0);a.insertBefore(l,o[0])});o.slice(0,i).forEach(e=>{const l=e.cloneNode(!0);a.appendChild(l)}),P.value=2*i}}const c=o*(P.value/2)+s;m(()=>{a.scrollLeft=c})}else{L.value=1;const e=l*(L.value-1);a.scrollLeft=e}M&&D.value&&(window.clearTimeout(F.value),F.value=window.setTimeout(()=>{D.value&&(D.value=!1),window.clearTimeout(F.value)},300))},le=()=>{D.value||(G.value=!0,M&&G.value&&(window.clearTimeout(K.value),K.value=window.setTimeout(()=>{G.value&&oe(),window.clearTimeout(K.value)},200)))},oe=()=>{D.value||(G.value=!1,E.value||m(()=>{let e,a;const l=J?.value;if(l){const o=l?.querySelectorAll(`div[class="${r}__slides"] > *`)??[];if(c.infinite&&c.enabled&&q.value>0){const e=l.offsetWidth,a=e/z.value,o=l.scrollLeft,i=a*(P.value/2),t=a*q.value;let n=o-i;n<0&&(n=t+n);const s=Math.floor(n/e)+1;if(s<1?L.value=U.value:s>U.value?L.value=1:L.value=s,!E.value)if(o<i){E.value=!0;const e=o+t;l.scrollTo({left:e,behavior:"auto"}),setTimeout(()=>{E.value=!1},50)}else if(o>=i+t){E.value=!0;const e=o-t;l.scrollTo({left:e,behavior:"auto"}),setTimeout(()=>{E.value=!1},50)}}else{const i=V.value-1;for(let t=0;t<U.value;t++){const n=z.value*(t+1)-1,s=n<i?o[n]:o[i],r=n<i?n:i;N({parent:l,child:s,leftOffset:40,rightOffset:40,threshold:.5})&&(r===i?(a=i,e=t+1):(a=r,e=t+1))}void 0!==a&&a>-1&&e&&(L.value=e,e>1&&(R.value=!0),1===e&&(R.value=!1),e<U.value&&(O.value=!0),e===U.value&&(O.value=!1))}}}))},ie=()=>{const e=J?.value;if(e){const a=e.offsetWidth;V.value>=z.value?Q.value=a/z.value+"px":Q.value=a/V.value+"px"}},te=()=>{const e=J?.value,a=e.offsetWidth;if(e&&a)if(c.infinite&&c.enabled&&q.value>0){const l=e.scrollLeft+a;e.scrollTo({left:l,behavior:"smooth"})}else{const l=a*L.value;e.scrollTo({left:l,behavior:"smooth"})}},ne=()=>{const e=J?.value,a=e.offsetWidth;if(e&&a)if(c.infinite&&c.enabled&&q.value>0){const l=e.scrollLeft-a;e.scrollTo({left:l,behavior:"smooth"})}else{const l=a*(L.value-1-1);e.scrollTo({left:l,behavior:"smooth"})}};b(()=>{if(M){window.addEventListener("resize",ae);const e=J?.value;if(e){const a=e?.querySelectorAll(`div[class="${r}__slides"] > *`)??[];if(q.value=a.length,V.value=a.length,c.infinite&&c.enabled&&a.length>0){const l=Array.from(a),o=Math.min(z.value,l.length);l.slice(-o).forEach(a=>{const o=a.cloneNode(!0);e.insertBefore(o,l[0])});l.slice(0,o).forEach(a=>{const l=a.cloneNode(!0);e.appendChild(l)}),P.value=2*o,m(()=>{const a=e.offsetWidth/z.value*o;e.scrollLeft=a})}e.addEventListener("scroll",le),e.addEventListener("scrollend",oe)}Z(c),X(),ie(),Y()}}),_(()=>{if(M){window.removeEventListener("resize",ae),F.value&&window.clearTimeout(F.value),K.value&&window.clearTimeout(K.value);const e=J?.value;e&&(e.removeEventListener("scroll",le),e.removeEventListener("scrollend",oe))}});const se=a(()=>[r,`${r}--${c.controlAlign}`,`${r}--${c.controlPosition}`,`${r}--${c.paginationType}`,c.enabled?`${r}--enabled`:`${r}--disabled`,k.value?"":`${r}--hastitle`,c.onShowMore?`${r}--has-more`:""]),re=a(()=>[`${r}__slide-controls`,C.value?`${r}__slide-controls--hascustomtitle`:""]),ce=a(()=>[`${r}__slides`,D.value?`${r}__slides--resizing`:"",G.value?`${r}__slides--scrolling`:"",E.value?`${r}__slides--jumping`:""]),ve=a(()=>[`${r}__navigation`,`${r}__navigation--${c.controlAlign}`,`${r}__navigation--${c.controlPosition}`]);return w(c,e=>{Z(e)}),(a,c)=>(o(),l("div",{class:s(n(se)),"data-testid":e.testId},[v("div",{ref_key:"beforeControls",ref:x,class:s(n(re)),hidden:n(k)},[v("div",{class:s(`${r}__custom-title`)},[y(a.$slots,"title")],2),e.title?(o(),l("div",{key:0,class:s(`${r}__title`)},[d(n(T),{align:n(C)?n(S).Center:n(S).Left,label:"",truncate:""},{default:u(()=>[p(f(e.title),1)]),_:1},8,["align"])],2)):t("",!0),e.controlPosition!==n(B).Before||[n($).Inline,n($).Hidden].includes(e.paginationType)?t("",!0):(o(),l(i,{key:1},[n(U)&&n(V)>n(z)?(o(),l("div",{key:0,class:s(n(ve))},[d(W,{color:e.color,"current-page":n(L),enabled:!n(G),"goto-page":ee,"more-label":e.moreLabel,"next-page-enabled":n(O),"pagination-type":e.paginationType,"prev-page-enabled":n(R),prefix:r,"show-more":e.onShowMore,"show-next-items":te,"show-prev-items":ne,"total-pages":n(U),variant:e.variant},null,8,["color","current-page","enabled","more-label","next-page-enabled","pagination-type","prev-page-enabled","show-more","total-pages","variant"])],2)):t("",!0)],64))],10,H),v("div",{ref_key:"scrollContainer",ref:J,class:s(n(ce)),tabindex:"0"},[y(a.$slots,"default")],2),e.controlPosition!==n(B).After||[n($).Inline,n($).Hidden].includes(e.paginationType)?t("",!0):(o(),l(i,{key:0},[n(U)&&n(V)>n(z)?(o(),l("div",{key:0,class:s(`${r}__slide-controls`)},[v("div",{class:s(n(ve))},[d(W,{color:e.color,"current-page":n(L),enabled:!n(G),"goto-page":ee,"more-label":e.moreLabel,"next-page-enabled":n(O),"pagination-type":e.paginationType,prefix:r,"prev-page-enabled":n(R),"show-more":e.onShowMore,"show-next-items":te,"show-prev-items":ne,"total-pages":n(U),variant:e.variant},null,8,["color","current-page","enabled","more-label","next-page-enabled","pagination-type","prev-page-enabled","show-more","total-pages","variant"])],2)],2)):t("",!0)],64)),e.paginationType===n($).Inline?(o(),l("div",{key:1,class:s(`${r}__slide-controls ${r}__slide-controls--inline`)},[v("div",{class:s(`${r}__navigation`)},[d(W,{color:e.color,"current-page":n(L),enabled:!n(G),"goto-page":ee,"more-label":e.moreLabel,"next-page-enabled":n(O),"pagination-type":e.paginationType,prefix:r,"prev-page-enabled":n(R),"show-more":e.onShowMore,"show-next-items":te,"show-prev-items":ne,"total-pages":n(U),variant:e.variant},null,8,["color","current-page","enabled","more-label","next-page-enabled","pagination-type","prev-page-enabled","show-more","total-pages","variant"])],2)],2)):t("",!0)],10,j))}}),R=(e,a)=>{const l=e.__vccOpts||e;for(const[o,i]of a)l[o]=i;return l},q={},D={class:/*@__PURE__*/s(["clll-carousel__slide"])};const F=/*#__PURE__*/R(q,[["render",function(e,a){return o(),l("div",D,[y(e.$slots,"default")])}]]),G=O;G.Slide=F;export{G as CLCarousel,G as default};
|