@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260702085048 → 0.8.1-dev.20260706110649
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/CopyButton-UPJPMJUB.mjs +57 -0
- package/dist/DateTimeViewClient-R3M6ISVK.mjs +16 -0
- package/dist/DateViewClient-VLTRN47D.mjs +9 -0
- package/dist/{chunk-SDNYBQSI.mjs → HlsPlayer-57543DTW.mjs} +3 -2
- package/dist/HlsPlayer-5AWFZ2P6.mjs +601 -0
- package/dist/IframeClient-RGJFZ5P2.mjs +98 -0
- package/dist/InputControlClient-NJV6B65M.mjs +604 -0
- package/dist/InputControlClient-OQDLYA4S.mjs +604 -0
- package/dist/InputControlClient-TW664WIJ.mjs +602 -0
- package/dist/{LinkNodeButton-WDDPNYWI.mjs → LinkNodeButton-FUL3J5HR.mjs} +6 -5
- package/dist/LinkNodeButton-IGJOGOKI.mjs +362 -0
- package/dist/LinkNodeButton-ZONM74OO.mjs +174 -0
- package/dist/Pagination-6OFACRMQ.mjs +229 -0
- package/dist/Pagination-FSYLYKUA.mjs +181 -0
- package/dist/Pagination-YCD5CU2L.mjs +183 -0
- package/dist/Slider-554BKC7N.mjs +322 -0
- package/dist/Slider-PEIVH6A5.mjs +320 -0
- package/dist/chunk-2GSYECIS.mjs +109 -0
- package/dist/chunk-3GWLDT7C.mjs +204 -0
- package/dist/chunk-3R4VVVNK.mjs +903 -0
- package/dist/chunk-47HD7QP7.mjs +199 -0
- package/dist/chunk-56HSDML5.mjs +22 -0
- package/dist/chunk-67IG5NBU.mjs +200 -0
- package/dist/chunk-7ZFZLN56.mjs +903 -0
- package/dist/chunk-CM7LUGCH.mjs +107 -0
- package/dist/chunk-IKIXEQPV.mjs +198 -0
- package/dist/chunk-IMNQO57B.mjs +25 -0
- package/dist/chunk-R2HV35IB.mjs +201 -0
- package/dist/chunk-SPRVN5IM.mjs +118 -0
- package/dist/chunk-TVL6KVD5.mjs +229 -0
- package/dist/chunk-WEV5U33G.mjs +207 -0
- package/dist/chunk-YG6FKKQJ.mjs +900 -0
- package/dist/index.d.mts +57 -170
- package/dist/index.d.ts +57 -170
- package/dist/index.js +3945 -3808
- package/dist/index.mjs +596 -2924
- package/dist/server.d.mts +72 -0
- package/dist/server.d.ts +72 -0
- package/dist/server.js +5126 -0
- package/dist/server.mjs +2698 -0
- package/package.json +18 -4
- package/dist/HlsPlayer-DZNDKG2P.mjs +0 -7
- package/dist/chunk-DOKQUUH3.mjs +0 -414
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
|
|
5
|
+
// src/components/Slider.tsx
|
|
6
|
+
import React, { useState, useEffect, Children, cloneElement } from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var Slider = ({
|
|
9
|
+
children,
|
|
10
|
+
slidesToShow = 4,
|
|
11
|
+
infinite_scroll = false,
|
|
12
|
+
autoplay = false,
|
|
13
|
+
autoplay_speed = 3e3,
|
|
14
|
+
show_arrows = false,
|
|
15
|
+
show_dots = false,
|
|
16
|
+
scaleOnHover = false,
|
|
17
|
+
className = "",
|
|
18
|
+
arrowClassName = "bg-black/50 hover:bg-black/80 text-white rounded-full w-10 h-10 flex items-center justify-center",
|
|
19
|
+
dotActiveClassName = "bg-gray-300",
|
|
20
|
+
dotInactiveClassName = "bg-gray-600",
|
|
21
|
+
gap,
|
|
22
|
+
pillStyle = "cumulative",
|
|
23
|
+
progressPosition = "bottom"
|
|
24
|
+
}) => {
|
|
25
|
+
const [currentSlide, setCurrentSlide] = useState(0);
|
|
26
|
+
const [transition, setTransition] = useState(true);
|
|
27
|
+
const [slidesToShowState, setSlidesToShowState] = useState(
|
|
28
|
+
typeof slidesToShow === "number" ? slidesToShow : slidesToShow.large
|
|
29
|
+
);
|
|
30
|
+
const [isPlaying, setIsPlaying] = useState(autoplay);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (typeof slidesToShow === "number") return;
|
|
33
|
+
const handleResize = () => {
|
|
34
|
+
if (window.innerWidth >= 1024) {
|
|
35
|
+
setSlidesToShowState(slidesToShow.large);
|
|
36
|
+
} else if (window.innerWidth >= 768) {
|
|
37
|
+
setSlidesToShowState(slidesToShow.medium);
|
|
38
|
+
} else {
|
|
39
|
+
setSlidesToShowState(slidesToShow.small);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
handleResize();
|
|
43
|
+
window.addEventListener("resize", handleResize);
|
|
44
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
45
|
+
}, [slidesToShow]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!autoplay) return;
|
|
48
|
+
const timer = setInterval(() => {
|
|
49
|
+
if (isPlaying) {
|
|
50
|
+
nextSlide();
|
|
51
|
+
}
|
|
52
|
+
}, autoplay_speed);
|
|
53
|
+
return () => clearInterval(timer);
|
|
54
|
+
}, [autoplay, autoplay_speed, currentSlide, isPlaying]);
|
|
55
|
+
const totalSlides = Children.count(children);
|
|
56
|
+
const maxSlide = totalSlides - slidesToShowState;
|
|
57
|
+
const nextSlide = () => {
|
|
58
|
+
if (currentSlide >= maxSlide) {
|
|
59
|
+
if (infinite_scroll) {
|
|
60
|
+
setTransition(true);
|
|
61
|
+
setCurrentSlide(0);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
setTransition(true);
|
|
65
|
+
setCurrentSlide(currentSlide + 1);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const prevSlide = () => {
|
|
69
|
+
if (currentSlide <= 0) {
|
|
70
|
+
if (infinite_scroll) {
|
|
71
|
+
setTransition(true);
|
|
72
|
+
setCurrentSlide(maxSlide);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
setTransition(true);
|
|
76
|
+
setCurrentSlide(currentSlide - 1);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const goToSlide = (index) => {
|
|
80
|
+
setTransition(true);
|
|
81
|
+
setCurrentSlide(index);
|
|
82
|
+
};
|
|
83
|
+
const handlePillClick = (index) => {
|
|
84
|
+
goToSlide(index);
|
|
85
|
+
if (autoplay) {
|
|
86
|
+
setIsPlaying(true);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const handleMouseEnter = () => {
|
|
90
|
+
if (autoplay) {
|
|
91
|
+
setIsPlaying(false);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const handleMouseLeave = () => {
|
|
95
|
+
if (autoplay) {
|
|
96
|
+
setIsPlaying(true);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const translateX = -currentSlide * (100 / slidesToShowState);
|
|
100
|
+
const slides = Children.map(children, (child, index) => {
|
|
101
|
+
if (!React.isValidElement(child)) return null;
|
|
102
|
+
const childProps = child.props;
|
|
103
|
+
const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
|
|
108
|
+
style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
|
|
109
|
+
children: cloneElement(child, {
|
|
110
|
+
className: mergedClassName
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
index
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
const getProgressPositionClass = () => {
|
|
117
|
+
switch (progressPosition) {
|
|
118
|
+
case "top":
|
|
119
|
+
return "top-4";
|
|
120
|
+
case "bottom-outside":
|
|
121
|
+
return "bottom-4 translate-y-full mt-4";
|
|
122
|
+
case "bottom":
|
|
123
|
+
default:
|
|
124
|
+
return "bottom-4";
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ jsxs(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
className: `relative w-full overflow-hidden ${className}`,
|
|
131
|
+
onMouseEnter: handleMouseEnter,
|
|
132
|
+
onMouseLeave: handleMouseLeave,
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
className: "flex h-full",
|
|
138
|
+
style: {
|
|
139
|
+
transition: transition ? "transform 0.5s ease" : "none",
|
|
140
|
+
transform: `translateX(${translateX}%)`
|
|
141
|
+
},
|
|
142
|
+
children: slides
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
show_arrows && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
ArrowButton,
|
|
148
|
+
{
|
|
149
|
+
direction: "left",
|
|
150
|
+
onClick: prevSlide,
|
|
151
|
+
visible: infinite_scroll || currentSlide > 0,
|
|
152
|
+
className: arrowClassName,
|
|
153
|
+
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5 8.25 12l7.5-7.5" }) })
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ jsxs(
|
|
157
|
+
ArrowButton,
|
|
158
|
+
{
|
|
159
|
+
direction: "right",
|
|
160
|
+
onClick: nextSlide,
|
|
161
|
+
visible: infinite_scroll || currentSlide < maxSlide,
|
|
162
|
+
className: arrowClassName,
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m8.25 4.5 7.5 7.5-7.5 7.5" }) }),
|
|
165
|
+
" "
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] }),
|
|
170
|
+
show_dots && /* @__PURE__ */ jsx("div", { className: `absolute left-1/2 -translate-x-1/2 flex justify-center space-x-1.5 ${getProgressPositionClass()}`, children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ jsx(
|
|
171
|
+
ProgressPill,
|
|
172
|
+
{
|
|
173
|
+
active: index === currentSlide,
|
|
174
|
+
duration: autoplay_speed,
|
|
175
|
+
index,
|
|
176
|
+
onClick: () => handlePillClick(index),
|
|
177
|
+
isPlaying: isPlaying && index === currentSlide && autoplay,
|
|
178
|
+
style: pillStyle,
|
|
179
|
+
activeClassName: dotActiveClassName,
|
|
180
|
+
inactiveClassName: dotInactiveClassName,
|
|
181
|
+
currentSlide,
|
|
182
|
+
totalSlides
|
|
183
|
+
},
|
|
184
|
+
index
|
|
185
|
+
)) })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
var ArrowButton = ({
|
|
191
|
+
direction,
|
|
192
|
+
onClick,
|
|
193
|
+
visible,
|
|
194
|
+
children,
|
|
195
|
+
className = ""
|
|
196
|
+
}) => /* @__PURE__ */ jsx(
|
|
197
|
+
"button",
|
|
198
|
+
{
|
|
199
|
+
className: `
|
|
200
|
+
absolute top-1/2 -translate-y-1/2 z-10
|
|
201
|
+
${direction === "left" ? "left-2.5" : "right-2.5"}
|
|
202
|
+
${!visible && "hidden"}
|
|
203
|
+
${className}
|
|
204
|
+
`,
|
|
205
|
+
onClick,
|
|
206
|
+
"aria-label": direction === "left" ? "Previous slide" : "Next slide",
|
|
207
|
+
children
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
var ProgressPill = ({
|
|
211
|
+
active,
|
|
212
|
+
duration,
|
|
213
|
+
index,
|
|
214
|
+
onClick,
|
|
215
|
+
isPlaying,
|
|
216
|
+
style = "modern",
|
|
217
|
+
activeClassName = "",
|
|
218
|
+
inactiveClassName = "",
|
|
219
|
+
currentSlide,
|
|
220
|
+
totalSlides
|
|
221
|
+
}) => {
|
|
222
|
+
const [progress, setProgress] = useState(0);
|
|
223
|
+
useEffect(() => {
|
|
224
|
+
if (active) {
|
|
225
|
+
setProgress(0);
|
|
226
|
+
}
|
|
227
|
+
}, [active, index]);
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
if (!active || !isPlaying) {
|
|
230
|
+
if (!active) {
|
|
231
|
+
setProgress(0);
|
|
232
|
+
}
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const startTime = Date.now();
|
|
236
|
+
const interval = setInterval(() => {
|
|
237
|
+
const elapsed = Date.now() - startTime;
|
|
238
|
+
const newProgress = elapsed / duration * 100;
|
|
239
|
+
if (newProgress >= 100) {
|
|
240
|
+
setProgress(100);
|
|
241
|
+
clearInterval(interval);
|
|
242
|
+
} else {
|
|
243
|
+
setProgress(newProgress);
|
|
244
|
+
}
|
|
245
|
+
}, 50);
|
|
246
|
+
return () => clearInterval(interval);
|
|
247
|
+
}, [active, isPlaying, duration, index]);
|
|
248
|
+
const isFilled = index < currentSlide;
|
|
249
|
+
const isActive = index === currentSlide;
|
|
250
|
+
const shouldShowProgress = isActive || style === "cumulative" && isFilled;
|
|
251
|
+
const baseClasses = "cursor-pointer transition-all duration-300 ease-out";
|
|
252
|
+
const getStyleClasses = () => {
|
|
253
|
+
switch (style) {
|
|
254
|
+
case "minimal":
|
|
255
|
+
return `
|
|
256
|
+
${isActive ? "w-8" : "w-2"} h-2 rounded-full
|
|
257
|
+
${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
|
|
258
|
+
hover:scale-110
|
|
259
|
+
`;
|
|
260
|
+
case "cumulative":
|
|
261
|
+
return `
|
|
262
|
+
w-4 h-1 rounded-full overflow-hidden relative
|
|
263
|
+
${isFilled ? activeClassName || "bg-white" : inactiveClassName || "bg-white/30"}
|
|
264
|
+
`;
|
|
265
|
+
case "modern":
|
|
266
|
+
return `
|
|
267
|
+
w-8 h-1.5 rounded-full overflow-hidden relative
|
|
268
|
+
${isActive ? inactiveClassName || "bg-white/30" : inactiveClassName || "bg-white/30"}
|
|
269
|
+
hover:h-2
|
|
270
|
+
`;
|
|
271
|
+
case "default":
|
|
272
|
+
default:
|
|
273
|
+
return `
|
|
274
|
+
w-6 h-1.5 rounded-full
|
|
275
|
+
${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
|
|
276
|
+
hover:w-8
|
|
277
|
+
`;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const renderProgressBar = () => {
|
|
281
|
+
if (style === "modern" && isActive || style === "cumulative" && shouldShowProgress) {
|
|
282
|
+
const displayProgress = style === "cumulative" && isFilled ? 100 : progress;
|
|
283
|
+
return /* @__PURE__ */ jsx(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
className: `absolute top-0 left-0 h-full rounded-full ${style === "cumulative" && isFilled ? activeClassName || "bg-white" : activeClassName || "bg-white"} transition-all duration-50 ease-linear`,
|
|
287
|
+
style: { width: `${displayProgress}%` }
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
return null;
|
|
292
|
+
};
|
|
293
|
+
const renderCumulativeFill = () => {
|
|
294
|
+
if (style === "cumulative" && isFilled && !isActive) {
|
|
295
|
+
return /* @__PURE__ */ jsx(
|
|
296
|
+
"div",
|
|
297
|
+
{
|
|
298
|
+
className: `absolute top-0 left-0 h-full rounded-full ${activeClassName || "bg-white"} transition-all duration-300`,
|
|
299
|
+
style: { width: "100%" }
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
};
|
|
305
|
+
return /* @__PURE__ */ jsxs(
|
|
306
|
+
"button",
|
|
307
|
+
{
|
|
308
|
+
className: `${baseClasses} ${getStyleClasses()}`,
|
|
309
|
+
onClick,
|
|
310
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
311
|
+
"aria-current": isActive ? "true" : "false",
|
|
312
|
+
children: [
|
|
313
|
+
renderProgressBar(),
|
|
314
|
+
renderCumulativeFill()
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
};
|
|
319
|
+
var Slider_default = Slider;
|
|
320
|
+
export {
|
|
321
|
+
Slider_default as default
|
|
322
|
+
};
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/Slider.tsx
|
|
4
|
+
import React, { useState, useEffect, Children, cloneElement } from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var Slider = ({
|
|
7
|
+
children,
|
|
8
|
+
slidesToShow = 4,
|
|
9
|
+
infinite_scroll = false,
|
|
10
|
+
autoplay = false,
|
|
11
|
+
autoplay_speed = 3e3,
|
|
12
|
+
show_arrows = false,
|
|
13
|
+
show_dots = false,
|
|
14
|
+
scaleOnHover = false,
|
|
15
|
+
className = "",
|
|
16
|
+
arrowClassName = "bg-black/50 hover:bg-black/80 text-white rounded-full w-10 h-10 flex items-center justify-center",
|
|
17
|
+
dotActiveClassName = "bg-gray-300",
|
|
18
|
+
dotInactiveClassName = "bg-gray-600",
|
|
19
|
+
gap,
|
|
20
|
+
pillStyle = "cumulative",
|
|
21
|
+
progressPosition = "bottom"
|
|
22
|
+
}) => {
|
|
23
|
+
const [currentSlide, setCurrentSlide] = useState(0);
|
|
24
|
+
const [transition, setTransition] = useState(true);
|
|
25
|
+
const [slidesToShowState, setSlidesToShowState] = useState(
|
|
26
|
+
typeof slidesToShow === "number" ? slidesToShow : slidesToShow.large
|
|
27
|
+
);
|
|
28
|
+
const [isPlaying, setIsPlaying] = useState(autoplay);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (typeof slidesToShow === "number") return;
|
|
31
|
+
const handleResize = () => {
|
|
32
|
+
if (window.innerWidth >= 1024) {
|
|
33
|
+
setSlidesToShowState(slidesToShow.large);
|
|
34
|
+
} else if (window.innerWidth >= 768) {
|
|
35
|
+
setSlidesToShowState(slidesToShow.medium);
|
|
36
|
+
} else {
|
|
37
|
+
setSlidesToShowState(slidesToShow.small);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
handleResize();
|
|
41
|
+
window.addEventListener("resize", handleResize);
|
|
42
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
43
|
+
}, [slidesToShow]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!autoplay) return;
|
|
46
|
+
const timer = setInterval(() => {
|
|
47
|
+
if (isPlaying) {
|
|
48
|
+
nextSlide();
|
|
49
|
+
}
|
|
50
|
+
}, autoplay_speed);
|
|
51
|
+
return () => clearInterval(timer);
|
|
52
|
+
}, [autoplay, autoplay_speed, currentSlide, isPlaying]);
|
|
53
|
+
const totalSlides = Children.count(children);
|
|
54
|
+
const maxSlide = totalSlides - slidesToShowState;
|
|
55
|
+
const nextSlide = () => {
|
|
56
|
+
if (currentSlide >= maxSlide) {
|
|
57
|
+
if (infinite_scroll) {
|
|
58
|
+
setTransition(true);
|
|
59
|
+
setCurrentSlide(0);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
setTransition(true);
|
|
63
|
+
setCurrentSlide(currentSlide + 1);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const prevSlide = () => {
|
|
67
|
+
if (currentSlide <= 0) {
|
|
68
|
+
if (infinite_scroll) {
|
|
69
|
+
setTransition(true);
|
|
70
|
+
setCurrentSlide(maxSlide);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
setTransition(true);
|
|
74
|
+
setCurrentSlide(currentSlide - 1);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const goToSlide = (index) => {
|
|
78
|
+
setTransition(true);
|
|
79
|
+
setCurrentSlide(index);
|
|
80
|
+
};
|
|
81
|
+
const handlePillClick = (index) => {
|
|
82
|
+
goToSlide(index);
|
|
83
|
+
if (autoplay) {
|
|
84
|
+
setIsPlaying(true);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const handleMouseEnter = () => {
|
|
88
|
+
if (autoplay) {
|
|
89
|
+
setIsPlaying(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const handleMouseLeave = () => {
|
|
93
|
+
if (autoplay) {
|
|
94
|
+
setIsPlaying(true);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const translateX = -currentSlide * (100 / slidesToShowState);
|
|
98
|
+
const slides = Children.map(children, (child, index) => {
|
|
99
|
+
if (!React.isValidElement(child)) return null;
|
|
100
|
+
const childProps = child.props;
|
|
101
|
+
const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
|
|
106
|
+
style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
|
|
107
|
+
children: cloneElement(child, {
|
|
108
|
+
className: mergedClassName
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
index
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
const getProgressPositionClass = () => {
|
|
115
|
+
switch (progressPosition) {
|
|
116
|
+
case "top":
|
|
117
|
+
return "top-4";
|
|
118
|
+
case "bottom-outside":
|
|
119
|
+
return "bottom-4 translate-y-full mt-4";
|
|
120
|
+
case "bottom":
|
|
121
|
+
default:
|
|
122
|
+
return "bottom-4";
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return /* @__PURE__ */ jsxs(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
className: `relative w-full overflow-hidden ${className}`,
|
|
129
|
+
onMouseEnter: handleMouseEnter,
|
|
130
|
+
onMouseLeave: handleMouseLeave,
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: "flex h-full",
|
|
136
|
+
style: {
|
|
137
|
+
transition: transition ? "transform 0.5s ease" : "none",
|
|
138
|
+
transform: `translateX(${translateX}%)`
|
|
139
|
+
},
|
|
140
|
+
children: slides
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
show_arrows && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
ArrowButton,
|
|
146
|
+
{
|
|
147
|
+
direction: "left",
|
|
148
|
+
onClick: prevSlide,
|
|
149
|
+
visible: infinite_scroll || currentSlide > 0,
|
|
150
|
+
className: arrowClassName,
|
|
151
|
+
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5 8.25 12l7.5-7.5" }) })
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ jsxs(
|
|
155
|
+
ArrowButton,
|
|
156
|
+
{
|
|
157
|
+
direction: "right",
|
|
158
|
+
onClick: nextSlide,
|
|
159
|
+
visible: infinite_scroll || currentSlide < maxSlide,
|
|
160
|
+
className: arrowClassName,
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m8.25 4.5 7.5 7.5-7.5 7.5" }) }),
|
|
163
|
+
" "
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
] }),
|
|
168
|
+
show_dots && /* @__PURE__ */ jsx("div", { className: `absolute left-1/2 -translate-x-1/2 flex justify-center space-x-1.5 ${getProgressPositionClass()}`, children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ jsx(
|
|
169
|
+
ProgressPill,
|
|
170
|
+
{
|
|
171
|
+
active: index === currentSlide,
|
|
172
|
+
duration: autoplay_speed,
|
|
173
|
+
index,
|
|
174
|
+
onClick: () => handlePillClick(index),
|
|
175
|
+
isPlaying: isPlaying && index === currentSlide && autoplay,
|
|
176
|
+
style: pillStyle,
|
|
177
|
+
activeClassName: dotActiveClassName,
|
|
178
|
+
inactiveClassName: dotInactiveClassName,
|
|
179
|
+
currentSlide,
|
|
180
|
+
totalSlides
|
|
181
|
+
},
|
|
182
|
+
index
|
|
183
|
+
)) })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
var ArrowButton = ({
|
|
189
|
+
direction,
|
|
190
|
+
onClick,
|
|
191
|
+
visible,
|
|
192
|
+
children,
|
|
193
|
+
className = ""
|
|
194
|
+
}) => /* @__PURE__ */ jsx(
|
|
195
|
+
"button",
|
|
196
|
+
{
|
|
197
|
+
className: `
|
|
198
|
+
absolute top-1/2 -translate-y-1/2 z-10
|
|
199
|
+
${direction === "left" ? "left-2.5" : "right-2.5"}
|
|
200
|
+
${!visible && "hidden"}
|
|
201
|
+
${className}
|
|
202
|
+
`,
|
|
203
|
+
onClick,
|
|
204
|
+
"aria-label": direction === "left" ? "Previous slide" : "Next slide",
|
|
205
|
+
children
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
var ProgressPill = ({
|
|
209
|
+
active,
|
|
210
|
+
duration,
|
|
211
|
+
index,
|
|
212
|
+
onClick,
|
|
213
|
+
isPlaying,
|
|
214
|
+
style = "modern",
|
|
215
|
+
activeClassName = "",
|
|
216
|
+
inactiveClassName = "",
|
|
217
|
+
currentSlide,
|
|
218
|
+
totalSlides
|
|
219
|
+
}) => {
|
|
220
|
+
const [progress, setProgress] = useState(0);
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (active) {
|
|
223
|
+
setProgress(0);
|
|
224
|
+
}
|
|
225
|
+
}, [active, index]);
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
if (!active || !isPlaying) {
|
|
228
|
+
if (!active) {
|
|
229
|
+
setProgress(0);
|
|
230
|
+
}
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const startTime = Date.now();
|
|
234
|
+
const interval = setInterval(() => {
|
|
235
|
+
const elapsed = Date.now() - startTime;
|
|
236
|
+
const newProgress = elapsed / duration * 100;
|
|
237
|
+
if (newProgress >= 100) {
|
|
238
|
+
setProgress(100);
|
|
239
|
+
clearInterval(interval);
|
|
240
|
+
} else {
|
|
241
|
+
setProgress(newProgress);
|
|
242
|
+
}
|
|
243
|
+
}, 50);
|
|
244
|
+
return () => clearInterval(interval);
|
|
245
|
+
}, [active, isPlaying, duration, index]);
|
|
246
|
+
const isFilled = index < currentSlide;
|
|
247
|
+
const isActive = index === currentSlide;
|
|
248
|
+
const shouldShowProgress = isActive || style === "cumulative" && isFilled;
|
|
249
|
+
const baseClasses = "cursor-pointer transition-all duration-300 ease-out";
|
|
250
|
+
const getStyleClasses = () => {
|
|
251
|
+
switch (style) {
|
|
252
|
+
case "minimal":
|
|
253
|
+
return `
|
|
254
|
+
${isActive ? "w-8" : "w-2"} h-2 rounded-full
|
|
255
|
+
${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
|
|
256
|
+
hover:scale-110
|
|
257
|
+
`;
|
|
258
|
+
case "cumulative":
|
|
259
|
+
return `
|
|
260
|
+
w-4 h-1 rounded-full overflow-hidden relative
|
|
261
|
+
${isFilled ? activeClassName || "bg-white" : inactiveClassName || "bg-white/30"}
|
|
262
|
+
`;
|
|
263
|
+
case "modern":
|
|
264
|
+
return `
|
|
265
|
+
w-8 h-1.5 rounded-full overflow-hidden relative
|
|
266
|
+
${isActive ? inactiveClassName || "bg-white/30" : inactiveClassName || "bg-white/30"}
|
|
267
|
+
hover:h-2
|
|
268
|
+
`;
|
|
269
|
+
case "default":
|
|
270
|
+
default:
|
|
271
|
+
return `
|
|
272
|
+
w-6 h-1.5 rounded-full
|
|
273
|
+
${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
|
|
274
|
+
hover:w-8
|
|
275
|
+
`;
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
const renderProgressBar = () => {
|
|
279
|
+
if (style === "modern" && isActive || style === "cumulative" && shouldShowProgress) {
|
|
280
|
+
const displayProgress = style === "cumulative" && isFilled ? 100 : progress;
|
|
281
|
+
return /* @__PURE__ */ jsx(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
className: `absolute top-0 left-0 h-full rounded-full ${style === "cumulative" && isFilled ? activeClassName || "bg-white" : activeClassName || "bg-white"} transition-all duration-50 ease-linear`,
|
|
285
|
+
style: { width: `${displayProgress}%` }
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
return null;
|
|
290
|
+
};
|
|
291
|
+
const renderCumulativeFill = () => {
|
|
292
|
+
if (style === "cumulative" && isFilled && !isActive) {
|
|
293
|
+
return /* @__PURE__ */ jsx(
|
|
294
|
+
"div",
|
|
295
|
+
{
|
|
296
|
+
className: `absolute top-0 left-0 h-full rounded-full ${activeClassName || "bg-white"} transition-all duration-300`,
|
|
297
|
+
style: { width: "100%" }
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
return null;
|
|
302
|
+
};
|
|
303
|
+
return /* @__PURE__ */ jsxs(
|
|
304
|
+
"button",
|
|
305
|
+
{
|
|
306
|
+
className: `${baseClasses} ${getStyleClasses()}`,
|
|
307
|
+
onClick,
|
|
308
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
309
|
+
"aria-current": isActive ? "true" : "false",
|
|
310
|
+
children: [
|
|
311
|
+
renderProgressBar(),
|
|
312
|
+
renderCumulativeFill()
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
};
|
|
317
|
+
var Slider_default = Slider;
|
|
318
|
+
export {
|
|
319
|
+
Slider_default as default
|
|
320
|
+
};
|