@opensite/ui 0.7.0 → 0.7.2

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 (71) hide show
  1. package/dist/blog-cards-read-time.cjs +1 -1
  2. package/dist/blog-cards-read-time.js +1 -1
  3. package/dist/blog-cards-tagline-cta.cjs +1 -1
  4. package/dist/blog-cards-tagline-cta.js +1 -1
  5. package/dist/blog-category-overlay.cjs +1 -1
  6. package/dist/blog-category-overlay.js +1 -1
  7. package/dist/blog-featured-popular.cjs +1 -1
  8. package/dist/blog-featured-popular.js +1 -1
  9. package/dist/blog-grid-author-cards.cjs +1 -1
  10. package/dist/blog-grid-author-cards.js +1 -1
  11. package/dist/blog-grid-nine-posts.cjs +1 -1
  12. package/dist/blog-grid-nine-posts.js +1 -1
  13. package/dist/blog-horizontal-cards.cjs +1 -1
  14. package/dist/blog-horizontal-cards.js +1 -1
  15. package/dist/blog-tech-insights.cjs +54 -45
  16. package/dist/blog-tech-insights.js +54 -45
  17. package/dist/carousel-animated-sections.cjs +1224 -0
  18. package/dist/carousel-animated-sections.d.cts +154 -0
  19. package/dist/carousel-animated-sections.d.ts +154 -0
  20. package/dist/carousel-animated-sections.js +1203 -0
  21. package/dist/carousel-auto-progress-slides.cjs +1156 -0
  22. package/dist/carousel-auto-progress-slides.d.cts +122 -0
  23. package/dist/carousel-auto-progress-slides.d.ts +122 -0
  24. package/dist/carousel-auto-progress-slides.js +1135 -0
  25. package/dist/carousel-autoplay-progress.cjs +1141 -0
  26. package/dist/carousel-autoplay-progress.d.cts +119 -0
  27. package/dist/carousel-autoplay-progress.d.ts +119 -0
  28. package/dist/carousel-autoplay-progress.js +1116 -0
  29. package/dist/carousel-feature-badge.cjs +1216 -0
  30. package/dist/carousel-feature-badge.d.cts +99 -0
  31. package/dist/carousel-feature-badge.d.ts +99 -0
  32. package/dist/carousel-feature-badge.js +1192 -0
  33. package/dist/carousel-fullscreen-scroll-fx.cjs +526 -0
  34. package/dist/carousel-fullscreen-scroll-fx.d.cts +122 -0
  35. package/dist/carousel-fullscreen-scroll-fx.d.ts +122 -0
  36. package/dist/carousel-fullscreen-scroll-fx.js +505 -0
  37. package/dist/carousel-gallery-thumbnails.cjs +1059 -0
  38. package/dist/carousel-gallery-thumbnails.d.cts +122 -0
  39. package/dist/carousel-gallery-thumbnails.d.ts +122 -0
  40. package/dist/carousel-gallery-thumbnails.js +1038 -0
  41. package/dist/carousel-horizontal-cards.cjs +1083 -0
  42. package/dist/carousel-horizontal-cards.d.cts +126 -0
  43. package/dist/carousel-horizontal-cards.d.ts +126 -0
  44. package/dist/carousel-horizontal-cards.js +1062 -0
  45. package/dist/carousel-image-hero.cjs +1075 -0
  46. package/dist/carousel-image-hero.d.cts +116 -0
  47. package/dist/carousel-image-hero.d.ts +116 -0
  48. package/dist/carousel-image-hero.js +1054 -0
  49. package/dist/carousel-multi-step-showcase.cjs +1146 -0
  50. package/dist/carousel-multi-step-showcase.d.cts +142 -0
  51. package/dist/carousel-multi-step-showcase.d.ts +142 -0
  52. package/dist/carousel-multi-step-showcase.js +1125 -0
  53. package/dist/carousel-portfolio-hero.cjs +1063 -0
  54. package/dist/carousel-portfolio-hero.d.cts +134 -0
  55. package/dist/carousel-portfolio-hero.d.ts +134 -0
  56. package/dist/carousel-portfolio-hero.js +1042 -0
  57. package/dist/carousel-product-feature-showcase.cjs +1127 -0
  58. package/dist/carousel-product-feature-showcase.d.cts +161 -0
  59. package/dist/carousel-product-feature-showcase.d.ts +161 -0
  60. package/dist/carousel-product-feature-showcase.js +1106 -0
  61. package/dist/carousel-progress-slider.cjs +597 -0
  62. package/dist/carousel-progress-slider.d.cts +122 -0
  63. package/dist/carousel-progress-slider.d.ts +122 -0
  64. package/dist/carousel-progress-slider.js +576 -0
  65. package/dist/carousel-scrolling-feature-showcase.cjs +530 -0
  66. package/dist/carousel-scrolling-feature-showcase.d.cts +126 -0
  67. package/dist/carousel-scrolling-feature-showcase.d.ts +126 -0
  68. package/dist/carousel-scrolling-feature-showcase.js +509 -0
  69. package/dist/registry.cjs +349 -238
  70. package/dist/registry.js +349 -238
  71. package/package.json +3 -2
@@ -0,0 +1,576 @@
1
+ "use client";
2
+ import * as React3 from 'react';
3
+ import React3__default from 'react';
4
+ import { AnimatePresence, motion } from 'framer-motion';
5
+ import { clsx } from 'clsx';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import { Img } from '@page-speed/img';
8
+ import { jsx, jsxs } from 'react/jsx-runtime';
9
+
10
+ // components/blocks/carousel/carousel-progress-slider.tsx
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+ var maxWidthStyles = {
15
+ sm: "max-w-screen-sm",
16
+ md: "max-w-screen-md",
17
+ lg: "max-w-screen-lg",
18
+ xl: "max-w-7xl",
19
+ "2xl": "max-w-screen-2xl",
20
+ "4xl": "max-w-[1536px]",
21
+ full: "max-w-full"
22
+ };
23
+ var Container = React3__default.forwardRef(
24
+ ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
25
+ const Component = as;
26
+ return /* @__PURE__ */ jsx(
27
+ Component,
28
+ {
29
+ ref,
30
+ className: cn(
31
+ "mx-auto w-full px-2 sm:px-4 lg:px-8",
32
+ maxWidthStyles[maxWidth],
33
+ className
34
+ ),
35
+ ...props,
36
+ children
37
+ }
38
+ );
39
+ }
40
+ );
41
+ Container.displayName = "Container";
42
+
43
+ // lib/patternSvgs.ts
44
+ var patternSvgs = {
45
+ squareAltGrid: "https://cdn.ing/assets/files/record/286187/4gpn0yq2ptra8iwlvmwwv860ggwv",
46
+ grid1: "https://cdn.ing/assets/files/record/286186/nbdflpgp4ostrno079hygibsflp3",
47
+ noise: "https://cdn.ing/assets/i/r/286188/zrqcp9hynh3j7p2laihwzfbujgrl/noise.png",
48
+ dots: "https://cdn.ing/assets/files/record/286198/yfsjx9thvtxzhl2qtshxyhkrm524",
49
+ dotPattern: "https://cdn.ing/assets/files/record/286192/7ig0cku8aqbboiza8nuk6hw0nnsr",
50
+ dotPattern2: "https://cdn.ing/assets/files/record/286189/arez6gd2s7isn9i1o6c7sexdq7bl",
51
+ circles: "https://cdn.ing/assets/files/record/286190/gtmia3sncjtzetdshc20zf1d3c17",
52
+ waves: "https://cdn.ing/assets/files/record/286191/mqlb33fzxz9cdth1bx7if0wmpkp1",
53
+ crossPattern: "https://cdn.ing/assets/files/record/286193/9yfqwdbnqaipbp7fsb3wbzzmq472",
54
+ architect: "https://cdn.ing/assets/files/record/286194/vgs88ugpvyhxu13wqgy0acvae6re",
55
+ tinyCheckers: "https://cdn.ing/assets/files/record/286195/65efaknsw8kcpf9o3c2gybytsl5b",
56
+ p6: "https://cdn.ing/assets/i/r/286196/6kl0rqnd6mjk8j7e525fo8fo0vkc/p6.webp"
57
+ };
58
+ var maskTop = "radial-gradient(ellipse 70% 60% at 50% 0%, #000 60%, transparent 100%)";
59
+ var maskBottom = "radial-gradient(ellipse 100% 80% at 50% 100%, #000 50%, transparent 90%)";
60
+ var maskCenter = "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 70%)";
61
+ var maskTopLeft = "radial-gradient(ellipse 80% 80% at 0% 0%, #000 50%, transparent 90%)";
62
+ var maskTopRight = "radial-gradient(ellipse 80% 80% at 100% 0%, #000 50%, transparent 90%)";
63
+ var maskBottomLeft = "radial-gradient(ellipse 80% 80% at 0% 100%, #000 50%, transparent 90%)";
64
+ var maskBottomRight = "radial-gradient(ellipse 80% 80% at 100% 100%, #000 50%, transparent 90%)";
65
+ var circuitBoardPattern = (id, mask) => /* @__PURE__ */ jsxs(
66
+ "svg",
67
+ {
68
+ className: "h-full w-full",
69
+ xmlns: "http://www.w3.org/2000/svg",
70
+ style: mask ? {
71
+ maskImage: mask,
72
+ WebkitMaskImage: mask
73
+ } : void 0,
74
+ children: [
75
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
76
+ "pattern",
77
+ {
78
+ id,
79
+ x: "0",
80
+ y: "0",
81
+ width: "100",
82
+ height: "100",
83
+ patternUnits: "userSpaceOnUse",
84
+ children: [
85
+ /* @__PURE__ */ jsx(
86
+ "path",
87
+ {
88
+ d: "M0 50h40M60 50h40M50 0v40M50 60v40",
89
+ stroke: "hsl(var(--muted))",
90
+ strokeWidth: "1",
91
+ fill: "none"
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "50", r: "3", fill: "hsl(var(--muted))" }),
95
+ /* @__PURE__ */ jsx("circle", { cx: "0", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
96
+ /* @__PURE__ */ jsx("circle", { cx: "100", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
97
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "0", r: "2", fill: "hsl(var(--muted))" }),
98
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "100", r: "2", fill: "hsl(var(--muted))" })
99
+ ]
100
+ }
101
+ ) }),
102
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
103
+ ]
104
+ }
105
+ );
106
+ var gridDotsPattern = (id, mask) => /* @__PURE__ */ jsxs(
107
+ "svg",
108
+ {
109
+ className: "h-full w-full",
110
+ xmlns: "http://www.w3.org/2000/svg",
111
+ style: mask ? {
112
+ maskImage: mask,
113
+ WebkitMaskImage: mask
114
+ } : void 0,
115
+ children: [
116
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
117
+ "pattern",
118
+ {
119
+ id,
120
+ x: "0",
121
+ y: "0",
122
+ width: "40",
123
+ height: "40",
124
+ patternUnits: "userSpaceOnUse",
125
+ children: [
126
+ /* @__PURE__ */ jsx(
127
+ "path",
128
+ {
129
+ d: "M0 20h40M20 0v40",
130
+ stroke: "hsl(var(--muted))",
131
+ strokeWidth: "0.5",
132
+ fill: "none"
133
+ }
134
+ ),
135
+ /* @__PURE__ */ jsx("circle", { cx: "20", cy: "20", r: "2", fill: "hsl(var(--muted))" })
136
+ ]
137
+ }
138
+ ) }),
139
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
140
+ ]
141
+ }
142
+ );
143
+ var gridPattern = (size, mask) => /* @__PURE__ */ jsx(
144
+ "div",
145
+ {
146
+ className: "h-full w-full bg-[linear-gradient(to_right,_hsl(var(--muted))_1px,_transparent_1px),linear-gradient(to_bottom,_hsl(var(--muted))_1px,_transparent_1px)]",
147
+ style: {
148
+ backgroundSize: `${size}px ${size}px`,
149
+ ...mask ? {
150
+ maskImage: mask,
151
+ WebkitMaskImage: mask
152
+ } : {}
153
+ }
154
+ }
155
+ );
156
+ var diagonalCrossPattern = (mask) => /* @__PURE__ */ jsx(
157
+ "div",
158
+ {
159
+ className: "h-full w-full",
160
+ style: {
161
+ backgroundImage: "repeating-linear-gradient(45deg, transparent, transparent 32px, hsl(var(--muted)) 32px, hsl(var(--muted)) 33px), repeating-linear-gradient(135deg, transparent, transparent 32px, hsl(var(--muted)) 32px, hsl(var(--muted)) 33px)",
162
+ ...mask ? {
163
+ maskImage: mask,
164
+ WebkitMaskImage: mask
165
+ } : {}
166
+ }
167
+ }
168
+ );
169
+ var dashedGridMaskBase = "repeating-linear-gradient(to right, black 0px, black 3px, transparent 3px, transparent 8px), repeating-linear-gradient(to bottom, black 0px, black 3px, transparent 3px, transparent 8px)";
170
+ var dashedGridPattern = (fadeMask) => {
171
+ const mask = fadeMask ? `${dashedGridMaskBase}, ${fadeMask}` : dashedGridMaskBase;
172
+ return /* @__PURE__ */ jsx(
173
+ "div",
174
+ {
175
+ className: "h-full w-full",
176
+ style: {
177
+ backgroundImage: "linear-gradient(to right, hsl(var(--muted)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--muted)) 1px, transparent 1px)",
178
+ backgroundSize: "20px 20px",
179
+ backgroundPosition: "0 0, 0 0",
180
+ maskImage: mask,
181
+ WebkitMaskImage: mask,
182
+ maskComposite: "intersect",
183
+ WebkitMaskComposite: "source-in"
184
+ }
185
+ }
186
+ );
187
+ };
188
+ var gradientGlow = (position) => /* @__PURE__ */ jsx(
189
+ "div",
190
+ {
191
+ className: cn(
192
+ "pointer-events-none absolute left-1/2 z-0 aspect-square w-3/4 -translate-x-1/2 rounded-full opacity-50 blur-3xl",
193
+ position === "top" ? "-top-1/4" : "-bottom-1/4"
194
+ ),
195
+ style: {
196
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
197
+ }
198
+ }
199
+ );
200
+ var spotlight = (position) => /* @__PURE__ */ jsx(
201
+ "div",
202
+ {
203
+ className: cn(
204
+ "pointer-events-none absolute top-1/2 z-0 aspect-square w-3/4 -translate-y-1/2 rounded-full opacity-40 blur-3xl",
205
+ position === "left" ? "-left-1/4" : "-right-1/4"
206
+ ),
207
+ style: {
208
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
209
+ }
210
+ }
211
+ );
212
+ var patternOverlays = {
213
+ circuitBoardBasic: () => circuitBoardPattern("circuit-board-basic"),
214
+ circuitBoardFadeTop: () => circuitBoardPattern("circuit-board-fade-top", maskTop),
215
+ circuitBoardFadeBottom: () => circuitBoardPattern("circuit-board-fade-bottom", maskBottom),
216
+ circuitBoardFadeCenter: () => circuitBoardPattern("circuit-board-fade-center", maskCenter),
217
+ circuitBoardFadeTopLeft: () => circuitBoardPattern("circuit-board-fade-top-left", maskTopLeft),
218
+ circuitBoardFadeTopRight: () => circuitBoardPattern("circuit-board-fade-top-right", maskTopRight),
219
+ circuitBoardFadeBottomLeft: () => circuitBoardPattern("circuit-board-fade-bottom-left", maskBottomLeft),
220
+ circuitBoardFadeBottomRight: () => circuitBoardPattern("circuit-board-fade-bottom-right", maskBottomRight),
221
+ dashedGridBasic: () => dashedGridPattern(),
222
+ dashedGridFadeTop: () => dashedGridPattern(maskTop),
223
+ dashedGridFadeBottom: () => dashedGridPattern(maskBottom),
224
+ dashedGridFadeCenter: () => dashedGridPattern(maskCenter),
225
+ dashedGridFadeTopLeft: () => dashedGridPattern(maskTopLeft),
226
+ dashedGridFadeTopRight: () => dashedGridPattern(maskTopRight),
227
+ dashedGridFadeBottomLeft: () => dashedGridPattern(maskBottomLeft),
228
+ dashedGridFadeBottomRight: () => dashedGridPattern(maskBottomRight),
229
+ diagonalCrossBasic: () => diagonalCrossPattern(),
230
+ diagonalCrossFadeTop: () => diagonalCrossPattern(maskTop),
231
+ diagonalCrossFadeBottom: () => diagonalCrossPattern(maskBottom),
232
+ diagonalCrossFadeCenter: () => diagonalCrossPattern(maskCenter),
233
+ diagonalCrossFadeTopLeft: () => diagonalCrossPattern(maskTopLeft),
234
+ diagonalCrossFadeTopRight: () => diagonalCrossPattern(maskTopRight),
235
+ diagonalCrossFadeBottomLeft: () => diagonalCrossPattern(maskBottomLeft),
236
+ diagonalCrossFadeBottomRight: () => diagonalCrossPattern(maskBottomRight),
237
+ gridBasic: () => gridPattern(40),
238
+ gridFadeTop: () => gridPattern(32, maskTop),
239
+ gridFadeBottom: () => gridPattern(32, maskBottom),
240
+ gridFadeCenter: () => gridPattern(40, maskCenter),
241
+ gridFadeTopLeft: () => gridPattern(32, maskTopLeft),
242
+ gridFadeTopRight: () => gridPattern(32, maskTopRight),
243
+ gridFadeBottomLeft: () => gridPattern(32, maskBottomLeft),
244
+ gridFadeBottomRight: () => gridPattern(32, maskBottomRight),
245
+ gridDotsBasic: () => gridDotsPattern("grid-dots-basic"),
246
+ gridDotsFadeCenter: () => gridDotsPattern("grid-dots-fade-center", maskCenter),
247
+ gradientGlowTop: () => gradientGlow("top"),
248
+ gradientGlowBottom: () => gradientGlow("bottom"),
249
+ spotlightLeft: () => spotlight("left"),
250
+ spotlightRight: () => spotlight("right")
251
+ };
252
+ var inlinePatternStyles = {
253
+ radialGradientTop: {
254
+ background: "radial-gradient(125% 125% at 50% 10%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
255
+ },
256
+ radialGradientBottom: {
257
+ background: "radial-gradient(125% 125% at 50% 90%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
258
+ }
259
+ };
260
+ function PatternBackground({
261
+ pattern,
262
+ opacity = 0.08,
263
+ className,
264
+ style
265
+ }) {
266
+ if (!pattern) {
267
+ return null;
268
+ }
269
+ if (pattern in inlinePatternStyles) {
270
+ const inlineStyle = inlinePatternStyles[pattern];
271
+ return /* @__PURE__ */ jsx(
272
+ "div",
273
+ {
274
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
275
+ style: { ...inlineStyle, opacity, ...style },
276
+ "aria-hidden": "true"
277
+ }
278
+ );
279
+ }
280
+ if (pattern in patternOverlays) {
281
+ const Overlay = patternOverlays[pattern];
282
+ return /* @__PURE__ */ jsx(
283
+ "div",
284
+ {
285
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
286
+ style: { opacity, ...style },
287
+ "aria-hidden": "true",
288
+ children: Overlay()
289
+ }
290
+ );
291
+ }
292
+ const patternUrl = pattern in patternSvgs ? patternSvgs[pattern] : pattern;
293
+ return /* @__PURE__ */ jsx(
294
+ "div",
295
+ {
296
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
297
+ style: {
298
+ backgroundImage: `url(${patternUrl})`,
299
+ backgroundRepeat: "repeat",
300
+ backgroundSize: "auto",
301
+ opacity,
302
+ ...style
303
+ },
304
+ "aria-hidden": "true"
305
+ }
306
+ );
307
+ }
308
+ var backgroundStyles = {
309
+ default: "bg-background text-foreground",
310
+ white: "bg-white text-dark",
311
+ gray: "bg-muted/30 text-foreground",
312
+ dark: "bg-foreground text-background",
313
+ transparent: "bg-transparent text-foreground",
314
+ gradient: "bg-linear-to-br from-primary via-primary/90 to-foreground text-primary-foreground",
315
+ primary: "bg-primary text-primary-foreground",
316
+ secondary: "bg-secondary text-secondary-foreground",
317
+ muted: "bg-muted text-muted-foreground"
318
+ };
319
+ var spacingStyles = {
320
+ none: "py-0 md:py-0",
321
+ sm: "py-12 md:py-16",
322
+ md: "py-16 md:py-24",
323
+ lg: "py-20 md:py-32",
324
+ xl: "py-24 md:py-40"
325
+ };
326
+ var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
327
+ var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
328
+ var Section = React3__default.forwardRef(
329
+ ({
330
+ id,
331
+ title,
332
+ subtitle,
333
+ children,
334
+ className,
335
+ style,
336
+ background = "default",
337
+ spacing = "lg",
338
+ pattern,
339
+ patternOpacity,
340
+ patternClassName,
341
+ containerClassName,
342
+ containerMaxWidth = "xl",
343
+ ...props
344
+ }, ref) => {
345
+ const effectivePatternOpacity = patternOpacity !== void 0 ? patternOpacity : pattern ? 1 : 0;
346
+ return /* @__PURE__ */ jsxs(
347
+ "section",
348
+ {
349
+ ref,
350
+ id,
351
+ className: cn(
352
+ "relative",
353
+ pattern ? "overflow-hidden" : null,
354
+ backgroundStyles[background],
355
+ isPredefinedSpacing(spacing) ? spacingStyles[spacing] : spacing,
356
+ className
357
+ ),
358
+ style,
359
+ ...props,
360
+ children: [
361
+ /* @__PURE__ */ jsx(
362
+ PatternBackground,
363
+ {
364
+ pattern,
365
+ opacity: effectivePatternOpacity,
366
+ className: patternClassName
367
+ }
368
+ ),
369
+ /* @__PURE__ */ jsxs(
370
+ Container,
371
+ {
372
+ maxWidth: containerMaxWidth,
373
+ className: cn("relative z-10", containerClassName),
374
+ children: [
375
+ (title || subtitle) && /* @__PURE__ */ jsxs("div", { className: "mb-12 text-center md:mb-16", children: [
376
+ subtitle && /* @__PURE__ */ jsx("p", { className: "mb-2 text-sm font-semibold uppercase tracking-wider text-primary", children: subtitle }),
377
+ title && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl", children: title })
378
+ ] }),
379
+ children
380
+ ]
381
+ }
382
+ )
383
+ ]
384
+ }
385
+ );
386
+ }
387
+ );
388
+ Section.displayName = "Section";
389
+ var ProgressSliderContext = React3.createContext(void 0);
390
+ function useProgressSliderContext() {
391
+ const context = React3.useContext(ProgressSliderContext);
392
+ if (!context) {
393
+ throw new Error(
394
+ "useProgressSliderContext must be used within a ProgressSlider"
395
+ );
396
+ }
397
+ return context;
398
+ }
399
+ function SliderBtn({
400
+ children,
401
+ value,
402
+ className,
403
+ progressBarClass
404
+ }) {
405
+ const { active, progress, handleButtonClick, vertical } = useProgressSliderContext();
406
+ return /* @__PURE__ */ jsxs(
407
+ "button",
408
+ {
409
+ className: cn(
410
+ "relative",
411
+ active === value ? "opacity-100" : "opacity-50",
412
+ className
413
+ ),
414
+ onClick: () => handleButtonClick(value),
415
+ children: [
416
+ children,
417
+ /* @__PURE__ */ jsx(
418
+ "div",
419
+ {
420
+ className: "absolute inset-0 -z-10 max-h-full max-w-full overflow-hidden",
421
+ role: "progressbar",
422
+ "aria-valuenow": active === value ? progress : 0,
423
+ children: /* @__PURE__ */ jsx(
424
+ "span",
425
+ {
426
+ className: cn("absolute left-0", progressBarClass),
427
+ style: {
428
+ [vertical ? "height" : "width"]: active === value ? `${progress}%` : "0%"
429
+ }
430
+ }
431
+ )
432
+ }
433
+ )
434
+ ]
435
+ }
436
+ );
437
+ }
438
+ function SliderWrapper({ children, value, className }) {
439
+ const { active } = useProgressSliderContext();
440
+ return /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: active === value && /* @__PURE__ */ jsx(
441
+ motion.div,
442
+ {
443
+ initial: { opacity: 0 },
444
+ animate: { opacity: 1 },
445
+ exit: { opacity: 0 },
446
+ className: cn("", className),
447
+ children
448
+ },
449
+ value
450
+ ) });
451
+ }
452
+ function CarouselProgressSlider({
453
+ slides,
454
+ slidesSlot,
455
+ duration = 5e3,
456
+ fastDuration = 400,
457
+ vertical = false,
458
+ className,
459
+ containerClassName,
460
+ contentClassName,
461
+ imageClassName,
462
+ navigationClassName,
463
+ buttonClassName,
464
+ progressBarClassName,
465
+ optixFlowConfig,
466
+ background = "white",
467
+ spacing = "xl",
468
+ pattern,
469
+ patternOpacity
470
+ }) {
471
+ const [active, setActive] = React3.useState(slides?.[0]?.id ?? "");
472
+ const [progress, setProgress] = React3.useState(0);
473
+ const [isFastForward, setIsFastForward] = React3.useState(false);
474
+ const frame = React3.useRef(0);
475
+ const firstFrameTime = React3.useRef(performance.now());
476
+ const targetValue = React3.useRef(null);
477
+ const sliderValues = React3.useMemo(
478
+ () => slides?.map((slide) => slide.id),
479
+ [slides]
480
+ );
481
+ React3.useEffect(() => {
482
+ if ((sliderValues?.length ?? 0) > 0) {
483
+ firstFrameTime.current = performance.now();
484
+ frame.current = requestAnimationFrame(animate);
485
+ }
486
+ return () => {
487
+ cancelAnimationFrame(frame.current);
488
+ };
489
+ }, [sliderValues, active, isFastForward]);
490
+ const animate = (now) => {
491
+ const currentDuration = isFastForward ? fastDuration : duration;
492
+ const elapsedTime = now - firstFrameTime.current;
493
+ const timeFraction = elapsedTime / currentDuration;
494
+ if (timeFraction <= 1) {
495
+ setProgress(
496
+ isFastForward ? progress + (100 - progress) * timeFraction : timeFraction * 100
497
+ );
498
+ frame.current = requestAnimationFrame(animate);
499
+ } else {
500
+ if (isFastForward) {
501
+ setIsFastForward(false);
502
+ if (targetValue.current !== null) {
503
+ setActive(targetValue.current);
504
+ targetValue.current = null;
505
+ }
506
+ } else {
507
+ const currentIndex = sliderValues?.indexOf(active) ?? -1;
508
+ const nextIndex = (currentIndex + 1) % (sliderValues?.length ?? 1);
509
+ const nextValue = sliderValues?.[nextIndex];
510
+ if (nextValue) setActive(nextValue);
511
+ }
512
+ setProgress(0);
513
+ firstFrameTime.current = performance.now();
514
+ }
515
+ };
516
+ const handleButtonClick = (value) => {
517
+ if (value !== active) {
518
+ const elapsedTime = performance.now() - firstFrameTime.current;
519
+ const currentProgress = elapsedTime / duration * 100;
520
+ setProgress(currentProgress);
521
+ targetValue.current = value;
522
+ setIsFastForward(true);
523
+ firstFrameTime.current = performance.now();
524
+ }
525
+ };
526
+ return /* @__PURE__ */ jsx(
527
+ ProgressSliderContext.Provider,
528
+ {
529
+ value: { active, progress, handleButtonClick, vertical },
530
+ children: /* @__PURE__ */ jsx(
531
+ Section,
532
+ {
533
+ background,
534
+ spacing,
535
+ className: cn(className),
536
+ pattern,
537
+ patternOpacity,
538
+ children: /* @__PURE__ */ jsx("div", { className: cn("container mx-auto px-4", containerClassName), children: /* @__PURE__ */ jsxs("div", { className: cn("grid gap-8 lg:grid-cols-2", contentClassName), children: [
539
+ /* @__PURE__ */ jsx("div", { className: cn("relative min-h-[300px]", imageClassName), children: slidesSlot ? slidesSlot : slides?.map((slide) => /* @__PURE__ */ jsx(
540
+ SliderWrapper,
541
+ {
542
+ value: slide.id,
543
+ className: cn("absolute inset-0", slide.className),
544
+ children: /* @__PURE__ */ jsx("div", { className: "aspect-video overflow-hidden rounded-lg", children: /* @__PURE__ */ jsx(
545
+ Img,
546
+ {
547
+ src: slide.image,
548
+ alt: typeof slide.title === "string" ? slide.title : `Slide ${slide.id}`,
549
+ className: cn("h-full w-full object-cover", slide.imageClassName),
550
+ optixFlowConfig
551
+ }
552
+ ) })
553
+ },
554
+ slide.id
555
+ )) }),
556
+ /* @__PURE__ */ jsx("div", { className: cn("flex flex-col justify-center gap-4", navigationClassName), children: slides?.map((slide) => /* @__PURE__ */ jsxs(
557
+ SliderBtn,
558
+ {
559
+ value: slide.id,
560
+ className: cn("rounded-lg border p-4 text-left transition-colors hover:bg-muted", buttonClassName),
561
+ progressBarClass: cn("bottom-0 h-1 bg-primary", progressBarClassName),
562
+ children: [
563
+ slide.title && (typeof slide.title === "string" ? /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: slide.title }) : /* @__PURE__ */ jsx("div", { children: slide.title })),
564
+ slide.description && (typeof slide.description === "string" ? /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: slide.description }) : /* @__PURE__ */ jsx("div", { className: "mt-1", children: slide.description }))
565
+ ]
566
+ },
567
+ slide.id
568
+ )) })
569
+ ] }) })
570
+ }
571
+ )
572
+ }
573
+ );
574
+ }
575
+
576
+ export { CarouselProgressSlider };