@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,1141 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React6 = require('react');
5
+ var useEmblaCarousel = require('embla-carousel-react');
6
+ var Autoplay = require('embla-carousel-autoplay');
7
+ var clsx = require('clsx');
8
+ var tailwindMerge = require('tailwind-merge');
9
+ var classVarianceAuthority = require('class-variance-authority');
10
+ var jsxRuntime = require('react/jsx-runtime');
11
+ var img = require('@page-speed/img');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default') {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
25
+ });
26
+ }
27
+ });
28
+ }
29
+ n.default = e;
30
+ return Object.freeze(n);
31
+ }
32
+
33
+ var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
34
+ var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
35
+ var Autoplay__default = /*#__PURE__*/_interopDefault(Autoplay);
36
+
37
+ // components/blocks/carousel/carousel-autoplay-progress.tsx
38
+ function cn(...inputs) {
39
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
40
+ }
41
+ function normalizePhoneNumber(input) {
42
+ const trimmed = input.trim();
43
+ if (trimmed.toLowerCase().startsWith("tel:")) {
44
+ return trimmed;
45
+ }
46
+ const match = trimmed.match(/^[\s\+\-\(\)]*(\d[\d\s\-\(\)\.]*\d)[\s\-]*(x|ext\.?|extension)?[\s\-]*(\d+)?$/i);
47
+ if (match) {
48
+ const mainNumber = match[1].replace(/[\s\-\(\)\.]/g, "");
49
+ const extension = match[3];
50
+ const normalized = mainNumber.length >= 10 && !trimmed.startsWith("+") ? `+${mainNumber}` : mainNumber;
51
+ const withExtension = extension ? `${normalized};ext=${extension}` : normalized;
52
+ return `tel:${withExtension}`;
53
+ }
54
+ const cleaned = trimmed.replace(/[\s\-\(\)\.]/g, "");
55
+ return `tel:${cleaned}`;
56
+ }
57
+ function normalizeEmail(input) {
58
+ const trimmed = input.trim();
59
+ if (trimmed.toLowerCase().startsWith("mailto:")) {
60
+ return trimmed;
61
+ }
62
+ return `mailto:${trimmed}`;
63
+ }
64
+ function isEmail(input) {
65
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
66
+ return emailRegex.test(input.trim());
67
+ }
68
+ function isPhoneNumber(input) {
69
+ const trimmed = input.trim();
70
+ if (trimmed.toLowerCase().startsWith("tel:")) {
71
+ return true;
72
+ }
73
+ const phoneRegex = /^[\s\+\-\(\)]*\d[\d\s\-\(\)\.]*\d[\s\-]*(x|ext\.?|extension)?[\s\-]*\d*$/i;
74
+ return phoneRegex.test(trimmed);
75
+ }
76
+ function isInternalUrl(href) {
77
+ if (typeof window === "undefined") {
78
+ return href.startsWith("/") && !href.startsWith("//");
79
+ }
80
+ const trimmed = href.trim();
81
+ if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
82
+ return true;
83
+ }
84
+ try {
85
+ const url = new URL(trimmed, window.location.href);
86
+ const currentOrigin = window.location.origin;
87
+ const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
88
+ return normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin);
89
+ } catch {
90
+ return false;
91
+ }
92
+ }
93
+ function toRelativePath(href) {
94
+ if (typeof window === "undefined") {
95
+ return href;
96
+ }
97
+ const trimmed = href.trim();
98
+ if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
99
+ return trimmed;
100
+ }
101
+ try {
102
+ const url = new URL(trimmed, window.location.href);
103
+ const currentOrigin = window.location.origin;
104
+ const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
105
+ if (normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin)) {
106
+ return url.pathname + url.search + url.hash;
107
+ }
108
+ } catch {
109
+ }
110
+ return trimmed;
111
+ }
112
+ function useNavigation({
113
+ href,
114
+ onClick
115
+ } = {}) {
116
+ const linkType = React6__namespace.useMemo(() => {
117
+ if (!href || href.trim() === "") {
118
+ return onClick ? "none" : "none";
119
+ }
120
+ const trimmed = href.trim();
121
+ if (trimmed.toLowerCase().startsWith("mailto:") || isEmail(trimmed)) {
122
+ return "mailto";
123
+ }
124
+ if (trimmed.toLowerCase().startsWith("tel:") || isPhoneNumber(trimmed)) {
125
+ return "tel";
126
+ }
127
+ if (isInternalUrl(trimmed)) {
128
+ return "internal";
129
+ }
130
+ try {
131
+ new URL(trimmed, typeof window !== "undefined" ? window.location.href : "http://localhost");
132
+ return "external";
133
+ } catch {
134
+ return "internal";
135
+ }
136
+ }, [href, onClick]);
137
+ const normalizedHref = React6__namespace.useMemo(() => {
138
+ if (!href || href.trim() === "") {
139
+ return void 0;
140
+ }
141
+ const trimmed = href.trim();
142
+ switch (linkType) {
143
+ case "tel":
144
+ return normalizePhoneNumber(trimmed);
145
+ case "mailto":
146
+ return normalizeEmail(trimmed);
147
+ case "internal":
148
+ return toRelativePath(trimmed);
149
+ case "external":
150
+ return trimmed;
151
+ default:
152
+ return trimmed;
153
+ }
154
+ }, [href, linkType]);
155
+ const target = React6__namespace.useMemo(() => {
156
+ switch (linkType) {
157
+ case "external":
158
+ return "_blank";
159
+ case "internal":
160
+ return "_self";
161
+ case "mailto":
162
+ case "tel":
163
+ return void 0;
164
+ default:
165
+ return void 0;
166
+ }
167
+ }, [linkType]);
168
+ const rel = React6__namespace.useMemo(() => {
169
+ if (linkType === "external") {
170
+ return "noopener noreferrer";
171
+ }
172
+ return void 0;
173
+ }, [linkType]);
174
+ const isExternal = linkType === "external";
175
+ const isInternal = linkType === "internal";
176
+ const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
177
+ const handleClick = React6__namespace.useCallback(
178
+ (event) => {
179
+ if (onClick) {
180
+ try {
181
+ onClick(event);
182
+ } catch (error) {
183
+ console.error("Error in user onClick handler:", error);
184
+ }
185
+ }
186
+ if (event.defaultPrevented) {
187
+ return;
188
+ }
189
+ if (shouldUseRouter && normalizedHref && event.button === 0 && // left-click only
190
+ !event.metaKey && !event.altKey && !event.ctrlKey && !event.shiftKey) {
191
+ if (typeof window !== "undefined") {
192
+ const handler = window.__opensiteNavigationHandler;
193
+ if (typeof handler === "function") {
194
+ try {
195
+ const handled = handler(normalizedHref, event.nativeEvent || event);
196
+ if (handled !== false) {
197
+ event.preventDefault();
198
+ }
199
+ } catch (error) {
200
+ console.error("Error in navigation handler:", error);
201
+ }
202
+ }
203
+ }
204
+ }
205
+ },
206
+ [onClick, shouldUseRouter, normalizedHref]
207
+ );
208
+ return {
209
+ linkType,
210
+ normalizedHref,
211
+ target,
212
+ rel,
213
+ isExternal,
214
+ isInternal,
215
+ shouldUseRouter,
216
+ handleClick
217
+ };
218
+ }
219
+ var baseStyles = [
220
+ // Layout
221
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap shrink-0",
222
+ // Typography - using CSS variables with sensible defaults
223
+ "font-[var(--button-font-family,inherit)]",
224
+ "font-[var(--button-font-weight,500)]",
225
+ "tracking-[var(--button-letter-spacing,0)]",
226
+ "leading-[var(--button-line-height,1.25)]",
227
+ "[text-transform:var(--button-text-transform,none)]",
228
+ "text-sm",
229
+ // Border radius
230
+ "rounded-[var(--button-radius,var(--radius,0.375rem))]",
231
+ // Smooth transition - using [transition:...] to set full shorthand property (not just transition-property)
232
+ "[transition:var(--button-transition,all_250ms_cubic-bezier(0.4,0,0.2,1))]",
233
+ // Box shadow (master level) - using [box-shadow:...] for complex multi-value shadows
234
+ "[box-shadow:var(--button-shadow,none)]",
235
+ "hover:[box-shadow:var(--button-shadow-hover,var(--button-shadow,none))]",
236
+ // Disabled state
237
+ "disabled:pointer-events-none disabled:opacity-50",
238
+ // SVG handling
239
+ "[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
240
+ // Focus styles
241
+ "outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
242
+ // Invalid state
243
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
244
+ ].join(" ");
245
+ var buttonVariants = classVarianceAuthority.cva(baseStyles, {
246
+ variants: {
247
+ variant: {
248
+ // Default (Primary) variant - full customization
249
+ default: [
250
+ "bg-[var(--button-default-bg,hsl(var(--primary)))]",
251
+ "text-[var(--button-default-fg,hsl(var(--primary-foreground)))]",
252
+ "border-[length:var(--button-default-border-width,0px)]",
253
+ "border-[color:var(--button-default-border,transparent)]",
254
+ "[box-shadow:var(--button-default-shadow,var(--button-shadow,none))]",
255
+ "hover:bg-[var(--button-default-hover-bg,hsl(var(--primary)/0.9))]",
256
+ "hover:text-[var(--button-default-hover-fg,var(--button-default-fg,hsl(var(--primary-foreground))))]",
257
+ "hover:border-[color:var(--button-default-hover-border,var(--button-default-border,transparent))]",
258
+ "hover:[box-shadow:var(--button-default-shadow-hover,var(--button-shadow-hover,var(--button-default-shadow,var(--button-shadow,none))))]"
259
+ ].join(" "),
260
+ // Destructive variant - full customization
261
+ destructive: [
262
+ "bg-[var(--button-destructive-bg,hsl(var(--destructive)))]",
263
+ "text-[var(--button-destructive-fg,white)]",
264
+ "border-[length:var(--button-destructive-border-width,0px)]",
265
+ "border-[color:var(--button-destructive-border,transparent)]",
266
+ "[box-shadow:var(--button-destructive-shadow,var(--button-shadow,none))]",
267
+ "hover:bg-[var(--button-destructive-hover-bg,hsl(var(--destructive)/0.9))]",
268
+ "hover:text-[var(--button-destructive-hover-fg,var(--button-destructive-fg,white))]",
269
+ "hover:border-[color:var(--button-destructive-hover-border,var(--button-destructive-border,transparent))]",
270
+ "hover:[box-shadow:var(--button-destructive-shadow-hover,var(--button-shadow-hover,var(--button-destructive-shadow,var(--button-shadow,none))))]",
271
+ "focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
272
+ "dark:bg-destructive/60"
273
+ ].join(" "),
274
+ // Outline variant - full customization with proper border handling
275
+ outline: [
276
+ "bg-[var(--button-outline-bg,hsl(var(--background)))]",
277
+ "text-[var(--button-outline-fg,inherit)]",
278
+ "border-[length:var(--button-outline-border-width,1px)]",
279
+ "border-[color:var(--button-outline-border,hsl(var(--border)))]",
280
+ "[box-shadow:var(--button-outline-shadow,var(--button-shadow,0_1px_2px_0_rgb(0_0_0/0.05)))]",
281
+ "hover:bg-[var(--button-outline-hover-bg,hsl(var(--accent)))]",
282
+ "hover:text-[var(--button-outline-hover-fg,hsl(var(--accent-foreground)))]",
283
+ "hover:border-[color:var(--button-outline-hover-border,var(--button-outline-border,hsl(var(--border))))]",
284
+ "hover:[box-shadow:var(--button-outline-shadow-hover,var(--button-shadow-hover,var(--button-outline-shadow,var(--button-shadow,none))))]",
285
+ "dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
286
+ ].join(" "),
287
+ // Secondary variant - full customization
288
+ secondary: [
289
+ "bg-[var(--button-secondary-bg,hsl(var(--secondary)))]",
290
+ "text-[var(--button-secondary-fg,hsl(var(--secondary-foreground)))]",
291
+ "border-[length:var(--button-secondary-border-width,0px)]",
292
+ "border-[color:var(--button-secondary-border,transparent)]",
293
+ "[box-shadow:var(--button-secondary-shadow,var(--button-shadow,none))]",
294
+ "hover:bg-[var(--button-secondary-hover-bg,hsl(var(--secondary)/0.8))]",
295
+ "hover:text-[var(--button-secondary-hover-fg,var(--button-secondary-fg,hsl(var(--secondary-foreground))))]",
296
+ "hover:border-[color:var(--button-secondary-hover-border,var(--button-secondary-border,transparent))]",
297
+ "hover:[box-shadow:var(--button-secondary-shadow-hover,var(--button-shadow-hover,var(--button-secondary-shadow,var(--button-shadow,none))))]"
298
+ ].join(" "),
299
+ // Ghost variant - full customization
300
+ ghost: [
301
+ "bg-[var(--button-ghost-bg,transparent)]",
302
+ "text-[var(--button-ghost-fg,inherit)]",
303
+ "border-[length:var(--button-ghost-border-width,0px)]",
304
+ "border-[color:var(--button-ghost-border,transparent)]",
305
+ "[box-shadow:var(--button-ghost-shadow,var(--button-shadow,none))]",
306
+ "hover:bg-[var(--button-ghost-hover-bg,hsl(var(--accent)))]",
307
+ "hover:text-[var(--button-ghost-hover-fg,hsl(var(--accent-foreground)))]",
308
+ "hover:border-[color:var(--button-ghost-hover-border,var(--button-ghost-border,transparent))]",
309
+ "hover:[box-shadow:var(--button-ghost-shadow-hover,var(--button-shadow-hover,var(--button-ghost-shadow,var(--button-shadow,none))))]",
310
+ "dark:hover:bg-accent/50"
311
+ ].join(" "),
312
+ // Link variant - full customization
313
+ link: [
314
+ "bg-[var(--button-link-bg,transparent)]",
315
+ "text-[var(--button-link-fg,hsl(var(--primary)))]",
316
+ "border-[length:var(--button-link-border-width,0px)]",
317
+ "border-[color:var(--button-link-border,transparent)]",
318
+ "[box-shadow:var(--button-link-shadow,none)]",
319
+ "hover:bg-[var(--button-link-hover-bg,transparent)]",
320
+ "hover:text-[var(--button-link-hover-fg,var(--button-link-fg,hsl(var(--primary))))]",
321
+ "hover:[box-shadow:var(--button-link-shadow-hover,none)]",
322
+ "underline-offset-4 hover:underline"
323
+ ].join(" ")
324
+ },
325
+ size: {
326
+ default: [
327
+ "h-[var(--button-height-md,2.25rem)]",
328
+ "px-[var(--button-padding-x-md,1rem)]",
329
+ "py-[var(--button-padding-y-md,0.5rem)]",
330
+ "has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
331
+ ].join(" "),
332
+ sm: [
333
+ "h-[var(--button-height-sm,2rem)]",
334
+ "px-[var(--button-padding-x-sm,0.75rem)]",
335
+ "py-[var(--button-padding-y-sm,0.25rem)]",
336
+ "gap-1.5",
337
+ "has-[>svg]:px-[calc(var(--button-padding-x-sm,0.75rem)*0.83)]"
338
+ ].join(" "),
339
+ md: [
340
+ "h-[var(--button-height-md,2.25rem)]",
341
+ "px-[var(--button-padding-x-md,1rem)]",
342
+ "py-[var(--button-padding-y-md,0.5rem)]",
343
+ "has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
344
+ ].join(" "),
345
+ lg: [
346
+ "h-[var(--button-height-lg,2.5rem)]",
347
+ "px-[var(--button-padding-x-lg,1.5rem)]",
348
+ "py-[var(--button-padding-y-lg,0.5rem)]",
349
+ "has-[>svg]:px-[calc(var(--button-padding-x-lg,1.5rem)*0.67)]"
350
+ ].join(" "),
351
+ icon: "size-[var(--button-height-md,2.25rem)]",
352
+ "icon-sm": "size-[var(--button-height-sm,2rem)]",
353
+ "icon-lg": "size-[var(--button-height-lg,2.5rem)]"
354
+ }
355
+ },
356
+ defaultVariants: {
357
+ variant: "default",
358
+ size: "default"
359
+ }
360
+ });
361
+ var Pressable = React6__namespace.forwardRef(
362
+ ({
363
+ children,
364
+ className,
365
+ href,
366
+ onClick,
367
+ variant,
368
+ size,
369
+ asButton = false,
370
+ fallbackComponentType = "span",
371
+ componentType,
372
+ "aria-label": ariaLabel,
373
+ "aria-describedby": ariaDescribedby,
374
+ id,
375
+ ...props
376
+ }, ref) => {
377
+ const navigation = useNavigation({ href, onClick });
378
+ const {
379
+ normalizedHref,
380
+ target,
381
+ rel,
382
+ linkType,
383
+ isInternal,
384
+ handleClick
385
+ } = navigation;
386
+ const shouldRenderLink = normalizedHref && linkType !== "none";
387
+ const shouldRenderButton = !shouldRenderLink && onClick;
388
+ const effectiveComponentType = componentType || (shouldRenderLink ? "a" : shouldRenderButton ? "button" : fallbackComponentType);
389
+ const finalComponentType = isInternal && shouldRenderLink ? "a" : effectiveComponentType;
390
+ const shouldApplyButtonStyles = asButton || variant || size;
391
+ const combinedClassName = cn(
392
+ shouldApplyButtonStyles && buttonVariants({ variant, size }),
393
+ className
394
+ );
395
+ const dataProps = Object.fromEntries(
396
+ Object.entries(props).filter(([key]) => key.startsWith("data-"))
397
+ );
398
+ const buttonDataAttributes = shouldApplyButtonStyles ? {
399
+ "data-slot": "button",
400
+ "data-variant": variant ?? "default",
401
+ "data-size": size ?? "default"
402
+ } : {};
403
+ const commonProps = {
404
+ className: combinedClassName,
405
+ onClick: handleClick,
406
+ "aria-label": ariaLabel,
407
+ "aria-describedby": ariaDescribedby,
408
+ id,
409
+ ...dataProps,
410
+ ...buttonDataAttributes
411
+ };
412
+ if (finalComponentType === "a" && shouldRenderLink) {
413
+ return /* @__PURE__ */ jsxRuntime.jsx(
414
+ "a",
415
+ {
416
+ ref,
417
+ href: normalizedHref,
418
+ target,
419
+ rel,
420
+ ...commonProps,
421
+ ...props,
422
+ children
423
+ }
424
+ );
425
+ }
426
+ if (finalComponentType === "button") {
427
+ return /* @__PURE__ */ jsxRuntime.jsx(
428
+ "button",
429
+ {
430
+ ref,
431
+ type: props.type || "button",
432
+ ...commonProps,
433
+ ...props,
434
+ children
435
+ }
436
+ );
437
+ }
438
+ if (finalComponentType === "div") {
439
+ return /* @__PURE__ */ jsxRuntime.jsx(
440
+ "div",
441
+ {
442
+ ref,
443
+ ...commonProps,
444
+ children
445
+ }
446
+ );
447
+ }
448
+ return /* @__PURE__ */ jsxRuntime.jsx(
449
+ "span",
450
+ {
451
+ ref,
452
+ ...commonProps,
453
+ children
454
+ }
455
+ );
456
+ }
457
+ );
458
+ Pressable.displayName = "Pressable";
459
+ var svgCache = /* @__PURE__ */ new Map();
460
+ function DynamicIcon({
461
+ name,
462
+ size = 28,
463
+ color,
464
+ className,
465
+ alt
466
+ }) {
467
+ const [svgContent, setSvgContent] = React6__namespace.useState(null);
468
+ const [isLoading, setIsLoading] = React6__namespace.useState(true);
469
+ const [error, setError] = React6__namespace.useState(null);
470
+ const { url, iconName } = React6__namespace.useMemo(() => {
471
+ const separator = name.includes("/") ? "/" : ":";
472
+ const [prefix, iconName2] = name.split(separator);
473
+ const baseUrl = `https://icons.opensite.ai/api/icon/${prefix}/${iconName2}?format=svg&width=${size}&height=${size}`;
474
+ return {
475
+ url: baseUrl,
476
+ iconName: iconName2
477
+ };
478
+ }, [name, size]);
479
+ React6__namespace.useEffect(() => {
480
+ let isMounted = true;
481
+ const fetchSvg = async () => {
482
+ const cached = svgCache.get(url);
483
+ if (cached) {
484
+ if (isMounted) {
485
+ setSvgContent(cached);
486
+ setIsLoading(false);
487
+ }
488
+ return;
489
+ }
490
+ try {
491
+ setIsLoading(true);
492
+ setError(null);
493
+ const response = await fetch(url);
494
+ if (!response.ok) {
495
+ throw new Error(`Failed to fetch icon: ${response.status}`);
496
+ }
497
+ let svg = await response.text();
498
+ svg = processSvgForCurrentColor(svg);
499
+ svgCache.set(url, svg);
500
+ if (isMounted) {
501
+ setSvgContent(svg);
502
+ setIsLoading(false);
503
+ }
504
+ } catch (err) {
505
+ if (isMounted) {
506
+ setError(err instanceof Error ? err.message : "Failed to load icon");
507
+ setIsLoading(false);
508
+ }
509
+ }
510
+ };
511
+ fetchSvg();
512
+ return () => {
513
+ isMounted = false;
514
+ };
515
+ }, [url]);
516
+ if (isLoading) {
517
+ return /* @__PURE__ */ jsxRuntime.jsx(
518
+ "span",
519
+ {
520
+ className: cn("inline-block", className),
521
+ style: { width: size, height: size },
522
+ "aria-hidden": "true"
523
+ }
524
+ );
525
+ }
526
+ if (error || !svgContent) {
527
+ return /* @__PURE__ */ jsxRuntime.jsx(
528
+ "span",
529
+ {
530
+ className: cn("inline-block", className),
531
+ style: { width: size, height: size },
532
+ role: "img",
533
+ "aria-label": alt || iconName
534
+ }
535
+ );
536
+ }
537
+ return /* @__PURE__ */ jsxRuntime.jsx(
538
+ "span",
539
+ {
540
+ className: cn("inline-flex items-center justify-center", className),
541
+ style: {
542
+ width: size,
543
+ height: size,
544
+ color: color || "inherit"
545
+ },
546
+ role: "img",
547
+ "aria-label": alt || iconName,
548
+ dangerouslySetInnerHTML: { __html: svgContent }
549
+ }
550
+ );
551
+ }
552
+ function processSvgForCurrentColor(svg) {
553
+ let processed = svg;
554
+ processed = processed.replace(
555
+ /stroke=["'](#000000|#000|black)["']/gi,
556
+ 'stroke="currentColor"'
557
+ );
558
+ processed = processed.replace(
559
+ /fill=["'](#000000|#000|black)["']/gi,
560
+ 'fill="currentColor"'
561
+ );
562
+ return processed;
563
+ }
564
+ var maxWidthStyles = {
565
+ sm: "max-w-screen-sm",
566
+ md: "max-w-screen-md",
567
+ lg: "max-w-screen-lg",
568
+ xl: "max-w-7xl",
569
+ "2xl": "max-w-screen-2xl",
570
+ "4xl": "max-w-[1536px]",
571
+ full: "max-w-full"
572
+ };
573
+ var Container = React6__namespace.default.forwardRef(
574
+ ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
575
+ const Component = as;
576
+ return /* @__PURE__ */ jsxRuntime.jsx(
577
+ Component,
578
+ {
579
+ ref,
580
+ className: cn(
581
+ "mx-auto w-full px-2 sm:px-4 lg:px-8",
582
+ maxWidthStyles[maxWidth],
583
+ className
584
+ ),
585
+ ...props,
586
+ children
587
+ }
588
+ );
589
+ }
590
+ );
591
+ Container.displayName = "Container";
592
+
593
+ // lib/patternSvgs.ts
594
+ var patternSvgs = {
595
+ squareAltGrid: "https://cdn.ing/assets/files/record/286187/4gpn0yq2ptra8iwlvmwwv860ggwv",
596
+ grid1: "https://cdn.ing/assets/files/record/286186/nbdflpgp4ostrno079hygibsflp3",
597
+ noise: "https://cdn.ing/assets/i/r/286188/zrqcp9hynh3j7p2laihwzfbujgrl/noise.png",
598
+ dots: "https://cdn.ing/assets/files/record/286198/yfsjx9thvtxzhl2qtshxyhkrm524",
599
+ dotPattern: "https://cdn.ing/assets/files/record/286192/7ig0cku8aqbboiza8nuk6hw0nnsr",
600
+ dotPattern2: "https://cdn.ing/assets/files/record/286189/arez6gd2s7isn9i1o6c7sexdq7bl",
601
+ circles: "https://cdn.ing/assets/files/record/286190/gtmia3sncjtzetdshc20zf1d3c17",
602
+ waves: "https://cdn.ing/assets/files/record/286191/mqlb33fzxz9cdth1bx7if0wmpkp1",
603
+ crossPattern: "https://cdn.ing/assets/files/record/286193/9yfqwdbnqaipbp7fsb3wbzzmq472",
604
+ architect: "https://cdn.ing/assets/files/record/286194/vgs88ugpvyhxu13wqgy0acvae6re",
605
+ tinyCheckers: "https://cdn.ing/assets/files/record/286195/65efaknsw8kcpf9o3c2gybytsl5b",
606
+ p6: "https://cdn.ing/assets/i/r/286196/6kl0rqnd6mjk8j7e525fo8fo0vkc/p6.webp"
607
+ };
608
+ var maskTop = "radial-gradient(ellipse 70% 60% at 50% 0%, #000 60%, transparent 100%)";
609
+ var maskBottom = "radial-gradient(ellipse 100% 80% at 50% 100%, #000 50%, transparent 90%)";
610
+ var maskCenter = "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 70%)";
611
+ var maskTopLeft = "radial-gradient(ellipse 80% 80% at 0% 0%, #000 50%, transparent 90%)";
612
+ var maskTopRight = "radial-gradient(ellipse 80% 80% at 100% 0%, #000 50%, transparent 90%)";
613
+ var maskBottomLeft = "radial-gradient(ellipse 80% 80% at 0% 100%, #000 50%, transparent 90%)";
614
+ var maskBottomRight = "radial-gradient(ellipse 80% 80% at 100% 100%, #000 50%, transparent 90%)";
615
+ var circuitBoardPattern = (id, mask) => /* @__PURE__ */ jsxRuntime.jsxs(
616
+ "svg",
617
+ {
618
+ className: "h-full w-full",
619
+ xmlns: "http://www.w3.org/2000/svg",
620
+ style: mask ? {
621
+ maskImage: mask,
622
+ WebkitMaskImage: mask
623
+ } : void 0,
624
+ children: [
625
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
626
+ "pattern",
627
+ {
628
+ id,
629
+ x: "0",
630
+ y: "0",
631
+ width: "100",
632
+ height: "100",
633
+ patternUnits: "userSpaceOnUse",
634
+ children: [
635
+ /* @__PURE__ */ jsxRuntime.jsx(
636
+ "path",
637
+ {
638
+ d: "M0 50h40M60 50h40M50 0v40M50 60v40",
639
+ stroke: "hsl(var(--muted))",
640
+ strokeWidth: "1",
641
+ fill: "none"
642
+ }
643
+ ),
644
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "50", r: "3", fill: "hsl(var(--muted))" }),
645
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "0", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
646
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "100", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
647
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "0", r: "2", fill: "hsl(var(--muted))" }),
648
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "50", cy: "100", r: "2", fill: "hsl(var(--muted))" })
649
+ ]
650
+ }
651
+ ) }),
652
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
653
+ ]
654
+ }
655
+ );
656
+ var gridDotsPattern = (id, mask) => /* @__PURE__ */ jsxRuntime.jsxs(
657
+ "svg",
658
+ {
659
+ className: "h-full w-full",
660
+ xmlns: "http://www.w3.org/2000/svg",
661
+ style: mask ? {
662
+ maskImage: mask,
663
+ WebkitMaskImage: mask
664
+ } : void 0,
665
+ children: [
666
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
667
+ "pattern",
668
+ {
669
+ id,
670
+ x: "0",
671
+ y: "0",
672
+ width: "40",
673
+ height: "40",
674
+ patternUnits: "userSpaceOnUse",
675
+ children: [
676
+ /* @__PURE__ */ jsxRuntime.jsx(
677
+ "path",
678
+ {
679
+ d: "M0 20h40M20 0v40",
680
+ stroke: "hsl(var(--muted))",
681
+ strokeWidth: "0.5",
682
+ fill: "none"
683
+ }
684
+ ),
685
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "20", cy: "20", r: "2", fill: "hsl(var(--muted))" })
686
+ ]
687
+ }
688
+ ) }),
689
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
690
+ ]
691
+ }
692
+ );
693
+ var gridPattern = (size, mask) => /* @__PURE__ */ jsxRuntime.jsx(
694
+ "div",
695
+ {
696
+ 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)]",
697
+ style: {
698
+ backgroundSize: `${size}px ${size}px`,
699
+ ...mask ? {
700
+ maskImage: mask,
701
+ WebkitMaskImage: mask
702
+ } : {}
703
+ }
704
+ }
705
+ );
706
+ var diagonalCrossPattern = (mask) => /* @__PURE__ */ jsxRuntime.jsx(
707
+ "div",
708
+ {
709
+ className: "h-full w-full",
710
+ style: {
711
+ 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)",
712
+ ...mask ? {
713
+ maskImage: mask,
714
+ WebkitMaskImage: mask
715
+ } : {}
716
+ }
717
+ }
718
+ );
719
+ 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)";
720
+ var dashedGridPattern = (fadeMask) => {
721
+ const mask = fadeMask ? `${dashedGridMaskBase}, ${fadeMask}` : dashedGridMaskBase;
722
+ return /* @__PURE__ */ jsxRuntime.jsx(
723
+ "div",
724
+ {
725
+ className: "h-full w-full",
726
+ style: {
727
+ backgroundImage: "linear-gradient(to right, hsl(var(--muted)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--muted)) 1px, transparent 1px)",
728
+ backgroundSize: "20px 20px",
729
+ backgroundPosition: "0 0, 0 0",
730
+ maskImage: mask,
731
+ WebkitMaskImage: mask,
732
+ maskComposite: "intersect",
733
+ WebkitMaskComposite: "source-in"
734
+ }
735
+ }
736
+ );
737
+ };
738
+ var gradientGlow = (position) => /* @__PURE__ */ jsxRuntime.jsx(
739
+ "div",
740
+ {
741
+ className: cn(
742
+ "pointer-events-none absolute left-1/2 z-0 aspect-square w-3/4 -translate-x-1/2 rounded-full opacity-50 blur-3xl",
743
+ position === "top" ? "-top-1/4" : "-bottom-1/4"
744
+ ),
745
+ style: {
746
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
747
+ }
748
+ }
749
+ );
750
+ var spotlight = (position) => /* @__PURE__ */ jsxRuntime.jsx(
751
+ "div",
752
+ {
753
+ className: cn(
754
+ "pointer-events-none absolute top-1/2 z-0 aspect-square w-3/4 -translate-y-1/2 rounded-full opacity-40 blur-3xl",
755
+ position === "left" ? "-left-1/4" : "-right-1/4"
756
+ ),
757
+ style: {
758
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
759
+ }
760
+ }
761
+ );
762
+ var patternOverlays = {
763
+ circuitBoardBasic: () => circuitBoardPattern("circuit-board-basic"),
764
+ circuitBoardFadeTop: () => circuitBoardPattern("circuit-board-fade-top", maskTop),
765
+ circuitBoardFadeBottom: () => circuitBoardPattern("circuit-board-fade-bottom", maskBottom),
766
+ circuitBoardFadeCenter: () => circuitBoardPattern("circuit-board-fade-center", maskCenter),
767
+ circuitBoardFadeTopLeft: () => circuitBoardPattern("circuit-board-fade-top-left", maskTopLeft),
768
+ circuitBoardFadeTopRight: () => circuitBoardPattern("circuit-board-fade-top-right", maskTopRight),
769
+ circuitBoardFadeBottomLeft: () => circuitBoardPattern("circuit-board-fade-bottom-left", maskBottomLeft),
770
+ circuitBoardFadeBottomRight: () => circuitBoardPattern("circuit-board-fade-bottom-right", maskBottomRight),
771
+ dashedGridBasic: () => dashedGridPattern(),
772
+ dashedGridFadeTop: () => dashedGridPattern(maskTop),
773
+ dashedGridFadeBottom: () => dashedGridPattern(maskBottom),
774
+ dashedGridFadeCenter: () => dashedGridPattern(maskCenter),
775
+ dashedGridFadeTopLeft: () => dashedGridPattern(maskTopLeft),
776
+ dashedGridFadeTopRight: () => dashedGridPattern(maskTopRight),
777
+ dashedGridFadeBottomLeft: () => dashedGridPattern(maskBottomLeft),
778
+ dashedGridFadeBottomRight: () => dashedGridPattern(maskBottomRight),
779
+ diagonalCrossBasic: () => diagonalCrossPattern(),
780
+ diagonalCrossFadeTop: () => diagonalCrossPattern(maskTop),
781
+ diagonalCrossFadeBottom: () => diagonalCrossPattern(maskBottom),
782
+ diagonalCrossFadeCenter: () => diagonalCrossPattern(maskCenter),
783
+ diagonalCrossFadeTopLeft: () => diagonalCrossPattern(maskTopLeft),
784
+ diagonalCrossFadeTopRight: () => diagonalCrossPattern(maskTopRight),
785
+ diagonalCrossFadeBottomLeft: () => diagonalCrossPattern(maskBottomLeft),
786
+ diagonalCrossFadeBottomRight: () => diagonalCrossPattern(maskBottomRight),
787
+ gridBasic: () => gridPattern(40),
788
+ gridFadeTop: () => gridPattern(32, maskTop),
789
+ gridFadeBottom: () => gridPattern(32, maskBottom),
790
+ gridFadeCenter: () => gridPattern(40, maskCenter),
791
+ gridFadeTopLeft: () => gridPattern(32, maskTopLeft),
792
+ gridFadeTopRight: () => gridPattern(32, maskTopRight),
793
+ gridFadeBottomLeft: () => gridPattern(32, maskBottomLeft),
794
+ gridFadeBottomRight: () => gridPattern(32, maskBottomRight),
795
+ gridDotsBasic: () => gridDotsPattern("grid-dots-basic"),
796
+ gridDotsFadeCenter: () => gridDotsPattern("grid-dots-fade-center", maskCenter),
797
+ gradientGlowTop: () => gradientGlow("top"),
798
+ gradientGlowBottom: () => gradientGlow("bottom"),
799
+ spotlightLeft: () => spotlight("left"),
800
+ spotlightRight: () => spotlight("right")
801
+ };
802
+ var inlinePatternStyles = {
803
+ radialGradientTop: {
804
+ background: "radial-gradient(125% 125% at 50% 10%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
805
+ },
806
+ radialGradientBottom: {
807
+ background: "radial-gradient(125% 125% at 50% 90%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
808
+ }
809
+ };
810
+ function PatternBackground({
811
+ pattern,
812
+ opacity = 0.08,
813
+ className,
814
+ style
815
+ }) {
816
+ if (!pattern) {
817
+ return null;
818
+ }
819
+ if (pattern in inlinePatternStyles) {
820
+ const inlineStyle = inlinePatternStyles[pattern];
821
+ return /* @__PURE__ */ jsxRuntime.jsx(
822
+ "div",
823
+ {
824
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
825
+ style: { ...inlineStyle, opacity, ...style },
826
+ "aria-hidden": "true"
827
+ }
828
+ );
829
+ }
830
+ if (pattern in patternOverlays) {
831
+ const Overlay = patternOverlays[pattern];
832
+ return /* @__PURE__ */ jsxRuntime.jsx(
833
+ "div",
834
+ {
835
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
836
+ style: { opacity, ...style },
837
+ "aria-hidden": "true",
838
+ children: Overlay()
839
+ }
840
+ );
841
+ }
842
+ const patternUrl = pattern in patternSvgs ? patternSvgs[pattern] : pattern;
843
+ return /* @__PURE__ */ jsxRuntime.jsx(
844
+ "div",
845
+ {
846
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
847
+ style: {
848
+ backgroundImage: `url(${patternUrl})`,
849
+ backgroundRepeat: "repeat",
850
+ backgroundSize: "auto",
851
+ opacity,
852
+ ...style
853
+ },
854
+ "aria-hidden": "true"
855
+ }
856
+ );
857
+ }
858
+ var backgroundStyles = {
859
+ default: "bg-background text-foreground",
860
+ white: "bg-white text-dark",
861
+ gray: "bg-muted/30 text-foreground",
862
+ dark: "bg-foreground text-background",
863
+ transparent: "bg-transparent text-foreground",
864
+ gradient: "bg-linear-to-br from-primary via-primary/90 to-foreground text-primary-foreground",
865
+ primary: "bg-primary text-primary-foreground",
866
+ secondary: "bg-secondary text-secondary-foreground",
867
+ muted: "bg-muted text-muted-foreground"
868
+ };
869
+ var spacingStyles = {
870
+ none: "py-0 md:py-0",
871
+ sm: "py-12 md:py-16",
872
+ md: "py-16 md:py-24",
873
+ lg: "py-20 md:py-32",
874
+ xl: "py-24 md:py-40"
875
+ };
876
+ var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
877
+ var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
878
+ var Section = React6__namespace.default.forwardRef(
879
+ ({
880
+ id,
881
+ title,
882
+ subtitle,
883
+ children,
884
+ className,
885
+ style,
886
+ background = "default",
887
+ spacing = "lg",
888
+ pattern,
889
+ patternOpacity,
890
+ patternClassName,
891
+ containerClassName,
892
+ containerMaxWidth = "xl",
893
+ ...props
894
+ }, ref) => {
895
+ const effectivePatternOpacity = patternOpacity !== void 0 ? patternOpacity : pattern ? 1 : 0;
896
+ return /* @__PURE__ */ jsxRuntime.jsxs(
897
+ "section",
898
+ {
899
+ ref,
900
+ id,
901
+ className: cn(
902
+ "relative",
903
+ pattern ? "overflow-hidden" : null,
904
+ backgroundStyles[background],
905
+ isPredefinedSpacing(spacing) ? spacingStyles[spacing] : spacing,
906
+ className
907
+ ),
908
+ style,
909
+ ...props,
910
+ children: [
911
+ /* @__PURE__ */ jsxRuntime.jsx(
912
+ PatternBackground,
913
+ {
914
+ pattern,
915
+ opacity: effectivePatternOpacity,
916
+ className: patternClassName
917
+ }
918
+ ),
919
+ /* @__PURE__ */ jsxRuntime.jsxs(
920
+ Container,
921
+ {
922
+ maxWidth: containerMaxWidth,
923
+ className: cn("relative z-10", containerClassName),
924
+ children: [
925
+ (title || subtitle) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-12 text-center md:mb-16", children: [
926
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-sm font-semibold uppercase tracking-wider text-primary", children: subtitle }),
927
+ title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl", children: title })
928
+ ] }),
929
+ children
930
+ ]
931
+ }
932
+ )
933
+ ]
934
+ }
935
+ );
936
+ }
937
+ );
938
+ Section.displayName = "Section";
939
+ function useDotButton(emblaApi) {
940
+ const [selectedIndex, setSelectedIndex] = React6__namespace.useState(0);
941
+ const [scrollSnaps, setScrollSnaps] = React6__namespace.useState([]);
942
+ const onDotButtonClick = React6__namespace.useCallback(
943
+ (index) => {
944
+ if (!emblaApi) return;
945
+ emblaApi.scrollTo(index);
946
+ },
947
+ [emblaApi]
948
+ );
949
+ const onInit = React6__namespace.useCallback((api) => {
950
+ setScrollSnaps(api.scrollSnapList());
951
+ }, []);
952
+ const onSelect = React6__namespace.useCallback((api) => {
953
+ setSelectedIndex(api.selectedScrollSnap());
954
+ }, []);
955
+ React6__namespace.useEffect(() => {
956
+ if (!emblaApi) return;
957
+ onInit(emblaApi);
958
+ onSelect(emblaApi);
959
+ emblaApi.on("reInit", onInit).on("reInit", onSelect).on("select", onSelect);
960
+ }, [emblaApi, onInit, onSelect]);
961
+ return { selectedIndex, scrollSnaps, onDotButtonClick };
962
+ }
963
+ function useAutoplay(emblaApi) {
964
+ const [autoplayIsPlaying, setAutoplayIsPlaying] = React6__namespace.useState(false);
965
+ const onAutoplayButtonClick = React6__namespace.useCallback(
966
+ (callback) => {
967
+ const autoplay = emblaApi?.plugins()?.autoplay;
968
+ if (!autoplay) return;
969
+ const resetOrStop = autoplay.options.stopOnInteraction === false ? autoplay.reset : autoplay.stop;
970
+ resetOrStop();
971
+ callback();
972
+ },
973
+ [emblaApi]
974
+ );
975
+ const toggleAutoplay = React6__namespace.useCallback(() => {
976
+ const autoplay = emblaApi?.plugins()?.autoplay;
977
+ if (!autoplay) return;
978
+ const playOrStop = autoplay.isPlaying() ? autoplay.stop : autoplay.play;
979
+ playOrStop();
980
+ }, [emblaApi]);
981
+ React6__namespace.useEffect(() => {
982
+ const autoplay = emblaApi?.plugins()?.autoplay;
983
+ if (!autoplay) return;
984
+ setAutoplayIsPlaying(autoplay.isPlaying());
985
+ emblaApi.on("autoplay:play", () => setAutoplayIsPlaying(true)).on("autoplay:stop", () => setAutoplayIsPlaying(false)).on("reInit", () => setAutoplayIsPlaying(autoplay.isPlaying()));
986
+ }, [emblaApi]);
987
+ return { autoplayIsPlaying, toggleAutoplay, onAutoplayButtonClick };
988
+ }
989
+ function useAutoplayProgress(emblaApi, progressNode) {
990
+ const [showAutoplayProgress, setShowAutoplayProgress] = React6__namespace.useState(false);
991
+ const animationName = React6__namespace.useRef("");
992
+ const timeoutId = React6__namespace.useRef(0);
993
+ const rafId = React6__namespace.useRef(0);
994
+ const startProgress = React6__namespace.useCallback(
995
+ (timeUntilNext) => {
996
+ const node = progressNode.current;
997
+ if (!node || timeUntilNext === null) return;
998
+ if (!animationName.current) {
999
+ const style = window.getComputedStyle(node);
1000
+ animationName.current = style.animationName;
1001
+ }
1002
+ node.style.animationName = "none";
1003
+ node.style.transform = "translate3d(0,0,0)";
1004
+ rafId.current = window.requestAnimationFrame(() => {
1005
+ timeoutId.current = window.setTimeout(() => {
1006
+ node.style.animationName = animationName.current;
1007
+ node.style.animationDuration = `${timeUntilNext}ms`;
1008
+ }, 0);
1009
+ });
1010
+ setShowAutoplayProgress(true);
1011
+ },
1012
+ [progressNode]
1013
+ );
1014
+ React6__namespace.useEffect(() => {
1015
+ const autoplay = emblaApi?.plugins()?.autoplay;
1016
+ if (!autoplay) return;
1017
+ emblaApi.on("autoplay:timerset", () => startProgress(autoplay.timeUntilNext())).on("autoplay:timerstopped", () => setShowAutoplayProgress(false));
1018
+ }, [emblaApi, startProgress]);
1019
+ React6__namespace.useEffect(() => {
1020
+ return () => {
1021
+ cancelAnimationFrame(rafId.current);
1022
+ clearTimeout(timeoutId.current);
1023
+ };
1024
+ }, []);
1025
+ return { showAutoplayProgress };
1026
+ }
1027
+ function CarouselAutoplayProgress({
1028
+ slides,
1029
+ slidesSlot,
1030
+ options,
1031
+ autoplayDelay = 3e3,
1032
+ className,
1033
+ containerClassName,
1034
+ trackClassName,
1035
+ slideClassName,
1036
+ imageClassName,
1037
+ controlsClassName,
1038
+ dotsClassName,
1039
+ progressClassName,
1040
+ optixFlowConfig,
1041
+ background = "white",
1042
+ spacing = "xl",
1043
+ pattern,
1044
+ patternOpacity
1045
+ }) {
1046
+ const progressNode = React6__namespace.useRef(null);
1047
+ const [emblaRef, emblaApi] = useEmblaCarousel__default.default(options, [
1048
+ Autoplay__default.default({ playOnInit: true, delay: autoplayDelay })
1049
+ ]);
1050
+ const { autoplayIsPlaying, toggleAutoplay, onAutoplayButtonClick } = useAutoplay(emblaApi);
1051
+ const { showAutoplayProgress } = useAutoplayProgress(emblaApi, progressNode);
1052
+ const { selectedIndex, scrollSnaps, onDotButtonClick } = useDotButton(emblaApi);
1053
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1054
+ Section,
1055
+ {
1056
+ background,
1057
+ spacing,
1058
+ className: cn(className),
1059
+ pattern,
1060
+ patternOpacity,
1061
+ children: [
1062
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("overflow-hidden", containerClassName), ref: emblaRef, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("ml-auto mr-3 flex touch-pan-y touch-pinch-zoom", trackClassName), children: slidesSlot ? slidesSlot : slides?.map((slide, index) => /* @__PURE__ */ jsxRuntime.jsxs(
1063
+ "div",
1064
+ {
1065
+ className: cn("flex-[0_0_70%] transform-gpu pl-3", slideClassName, slide.className),
1066
+ children: [
1067
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video overflow-hidden rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
1068
+ img.Img,
1069
+ {
1070
+ src: slide.src,
1071
+ alt: typeof slide.alt === "string" ? slide.alt : `Slide ${index + 1}`,
1072
+ className: cn("h-full w-full object-cover", imageClassName, slide.imageClassName),
1073
+ optixFlowConfig
1074
+ }
1075
+ ) }),
1076
+ slide.content && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: slide.content })
1077
+ ]
1078
+ },
1079
+ index
1080
+ )) }) }),
1081
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mx-auto mt-7 flex max-w-80 items-center justify-between gap-3", controlsClassName), children: [
1082
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex justify-center gap-2", dotsClassName), children: scrollSnaps.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
1083
+ "button",
1084
+ {
1085
+ type: "button",
1086
+ onClick: () => onAutoplayButtonClick(() => onDotButtonClick(index)),
1087
+ className: cn(
1088
+ "h-3 w-3 rounded-full border-2 border-border transition-colors duration-200",
1089
+ index === selectedIndex ? "bg-foreground" : "bg-transparent hover:bg-muted"
1090
+ )
1091
+ },
1092
+ index
1093
+ )) }),
1094
+ /* @__PURE__ */ jsxRuntime.jsx(
1095
+ "div",
1096
+ {
1097
+ className: cn(
1098
+ "relative h-2 w-40 max-w-[90%] justify-self-center self-center overflow-hidden rounded-[1.8rem] border-2 border-border bg-background transition-opacity duration-300 ease-in-out",
1099
+ showAutoplayProgress ? "opacity-100" : "opacity-0",
1100
+ progressClassName
1101
+ ),
1102
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1103
+ "div",
1104
+ {
1105
+ className: "absolute bottom-0 top-0 -left-full w-full bg-foreground",
1106
+ ref: progressNode,
1107
+ style: {
1108
+ animation: "autoplay-progress linear 1",
1109
+ animationPlayState: showAutoplayProgress ? "running" : "paused"
1110
+ }
1111
+ }
1112
+ )
1113
+ }
1114
+ ),
1115
+ /* @__PURE__ */ jsxRuntime.jsx(
1116
+ Pressable,
1117
+ {
1118
+ size: "icon",
1119
+ variant: "secondary",
1120
+ onClick: toggleAutoplay,
1121
+ asButton: true,
1122
+ children: autoplayIsPlaying ? /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/pause", size: 16 }) : /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/play", size: 16 })
1123
+ }
1124
+ )
1125
+ ] }),
1126
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1127
+ @keyframes autoplay-progress {
1128
+ from {
1129
+ transform: translateX(0);
1130
+ }
1131
+ to {
1132
+ transform: translateX(100%);
1133
+ }
1134
+ }
1135
+ ` })
1136
+ ]
1137
+ }
1138
+ );
1139
+ }
1140
+
1141
+ exports.CarouselAutoplayProgress = CarouselAutoplayProgress;