@opensite/ui 1.3.2 → 1.3.4

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 (167) hide show
  1. package/dist/footer-accordion-social.cjs +1344 -0
  2. package/dist/footer-accordion-social.d.cts +154 -0
  3. package/dist/footer-accordion-social.d.ts +154 -0
  4. package/dist/footer-accordion-social.js +1322 -0
  5. package/dist/footer-info-cards-accordion.cjs +1427 -0
  6. package/dist/footer-info-cards-accordion.d.cts +278 -0
  7. package/dist/footer-info-cards-accordion.d.ts +278 -0
  8. package/dist/footer-info-cards-accordion.js +1404 -0
  9. package/dist/footer-newsletter-contact.cjs +1281 -0
  10. package/dist/footer-newsletter-contact.d.cts +163 -0
  11. package/dist/footer-newsletter-contact.d.ts +163 -0
  12. package/dist/footer-newsletter-contact.js +1259 -0
  13. package/dist/footer-split-image-accordion.cjs +1395 -0
  14. package/dist/footer-split-image-accordion.d.cts +236 -0
  15. package/dist/footer-split-image-accordion.d.ts +236 -0
  16. package/dist/footer-split-image-accordion.js +1372 -0
  17. package/dist/list-achievements-showcase.cjs +1141 -0
  18. package/dist/list-achievements-showcase.d.cts +131 -0
  19. package/dist/list-achievements-showcase.d.ts +131 -0
  20. package/dist/list-achievements-showcase.js +1119 -0
  21. package/dist/list-career-timeline.cjs +531 -0
  22. package/dist/list-career-timeline.d.cts +153 -0
  23. package/dist/list-career-timeline.d.ts +153 -0
  24. package/dist/list-career-timeline.js +509 -0
  25. package/dist/list-feature-comparison.cjs +1211 -0
  26. package/dist/list-feature-comparison.d.cts +189 -0
  27. package/dist/list-feature-comparison.d.ts +189 -0
  28. package/dist/list-feature-comparison.js +1190 -0
  29. package/dist/list-metrics-dashboard.cjs +1402 -0
  30. package/dist/list-metrics-dashboard.d.cts +191 -0
  31. package/dist/list-metrics-dashboard.d.ts +191 -0
  32. package/dist/list-metrics-dashboard.js +1379 -0
  33. package/dist/list-service-category-table.cjs +762 -0
  34. package/dist/list-service-category-table.d.cts +135 -0
  35. package/dist/list-service-category-table.d.ts +135 -0
  36. package/dist/list-service-category-table.js +741 -0
  37. package/dist/offer-modal-membership-image.cjs +1361 -0
  38. package/dist/offer-modal-membership-image.d.cts +194 -0
  39. package/dist/offer-modal-membership-image.d.ts +194 -0
  40. package/dist/offer-modal-membership-image.js +1339 -0
  41. package/dist/offer-modal-newsletter-discount.cjs +1296 -0
  42. package/dist/offer-modal-newsletter-discount.d.cts +164 -0
  43. package/dist/offer-modal-newsletter-discount.d.ts +164 -0
  44. package/dist/offer-modal-newsletter-discount.js +1274 -0
  45. package/dist/offer-modal-sheet-newsletter.cjs +1360 -0
  46. package/dist/offer-modal-sheet-newsletter.d.cts +221 -0
  47. package/dist/offer-modal-sheet-newsletter.d.ts +221 -0
  48. package/dist/offer-modal-sheet-newsletter.js +1337 -0
  49. package/dist/pricing-addons-cards.cjs +1143 -0
  50. package/dist/pricing-addons-cards.d.cts +203 -0
  51. package/dist/pricing-addons-cards.d.ts +203 -0
  52. package/dist/pricing-addons-cards.js +1122 -0
  53. package/dist/pricing-addons-featured.cjs +1224 -0
  54. package/dist/pricing-addons-featured.d.cts +271 -0
  55. package/dist/pricing-addons-featured.d.ts +271 -0
  56. package/dist/pricing-addons-featured.js +1203 -0
  57. package/dist/pricing-collapsible-plans.cjs +1315 -0
  58. package/dist/pricing-collapsible-plans.d.cts +258 -0
  59. package/dist/pricing-collapsible-plans.d.ts +258 -0
  60. package/dist/pricing-collapsible-plans.js +1294 -0
  61. package/dist/pricing-columns-toggle.cjs +1234 -0
  62. package/dist/pricing-columns-toggle.d.cts +251 -0
  63. package/dist/pricing-columns-toggle.d.ts +251 -0
  64. package/dist/pricing-columns-toggle.js +1212 -0
  65. package/dist/pricing-comparison-headers.cjs +1235 -0
  66. package/dist/pricing-comparison-headers.d.cts +245 -0
  67. package/dist/pricing-comparison-headers.d.ts +245 -0
  68. package/dist/pricing-comparison-headers.js +1213 -0
  69. package/dist/pricing-comparison-table.cjs +1374 -0
  70. package/dist/pricing-comparison-table.d.cts +280 -0
  71. package/dist/pricing-comparison-table.d.ts +280 -0
  72. package/dist/pricing-comparison-table.js +1352 -0
  73. package/dist/pricing-discount-card.cjs +1217 -0
  74. package/dist/pricing-discount-card.d.cts +195 -0
  75. package/dist/pricing-discount-card.d.ts +195 -0
  76. package/dist/pricing-discount-card.js +1195 -0
  77. package/dist/pricing-enterprise-contact.cjs +1094 -0
  78. package/dist/pricing-enterprise-contact.d.cts +170 -0
  79. package/dist/pricing-enterprise-contact.d.ts +170 -0
  80. package/dist/pricing-enterprise-contact.js +1073 -0
  81. package/dist/pricing-feature-matrix.cjs +1197 -0
  82. package/dist/pricing-feature-matrix.d.cts +56 -0
  83. package/dist/pricing-feature-matrix.d.ts +56 -0
  84. package/dist/pricing-feature-matrix.js +1174 -0
  85. package/dist/pricing-four-tier-toggle.cjs +1320 -0
  86. package/dist/pricing-four-tier-toggle.d.cts +266 -0
  87. package/dist/pricing-four-tier-toggle.d.ts +266 -0
  88. package/dist/pricing-four-tier-toggle.js +1297 -0
  89. package/dist/pricing-full-comparison.cjs +1301 -0
  90. package/dist/pricing-full-comparison.d.cts +265 -0
  91. package/dist/pricing-full-comparison.d.ts +265 -0
  92. package/dist/pricing-full-comparison.js +1279 -0
  93. package/dist/pricing-gradient-cards.cjs +1248 -0
  94. package/dist/pricing-gradient-cards.d.cts +258 -0
  95. package/dist/pricing-gradient-cards.d.ts +258 -0
  96. package/dist/pricing-gradient-cards.js +1226 -0
  97. package/dist/pricing-icon-headers.cjs +1163 -0
  98. package/dist/pricing-icon-headers.d.cts +218 -0
  99. package/dist/pricing-icon-headers.d.ts +218 -0
  100. package/dist/pricing-icon-headers.js +1142 -0
  101. package/dist/pricing-minimal-cards.cjs +1146 -0
  102. package/dist/pricing-minimal-cards.d.cts +210 -0
  103. package/dist/pricing-minimal-cards.d.ts +210 -0
  104. package/dist/pricing-minimal-cards.js +1125 -0
  105. package/dist/pricing-packages-radio.cjs +1203 -0
  106. package/dist/pricing-packages-radio.d.cts +243 -0
  107. package/dist/pricing-packages-radio.d.ts +243 -0
  108. package/dist/pricing-packages-radio.js +1182 -0
  109. package/dist/pricing-popular-highlight.cjs +1293 -0
  110. package/dist/pricing-popular-highlight.d.cts +255 -0
  111. package/dist/pricing-popular-highlight.d.ts +255 -0
  112. package/dist/pricing-popular-highlight.js +1271 -0
  113. package/dist/pricing-radio-toggle.cjs +1277 -0
  114. package/dist/pricing-radio-toggle.d.cts +251 -0
  115. package/dist/pricing-radio-toggle.d.ts +251 -0
  116. package/dist/pricing-radio-toggle.js +1255 -0
  117. package/dist/pricing-responsive-table.cjs +1229 -0
  118. package/dist/pricing-responsive-table.d.cts +55 -0
  119. package/dist/pricing-responsive-table.d.ts +55 -0
  120. package/dist/pricing-responsive-table.js +1206 -0
  121. package/dist/pricing-services-cards.cjs +1209 -0
  122. package/dist/pricing-services-cards.d.cts +230 -0
  123. package/dist/pricing-services-cards.d.ts +230 -0
  124. package/dist/pricing-services-cards.js +1188 -0
  125. package/dist/pricing-simple-card.cjs +1102 -0
  126. package/dist/pricing-simple-card.d.cts +174 -0
  127. package/dist/pricing-simple-card.d.ts +174 -0
  128. package/dist/pricing-simple-card.js +1081 -0
  129. package/dist/pricing-single-card.cjs +1174 -0
  130. package/dist/pricing-single-card.d.cts +201 -0
  131. package/dist/pricing-single-card.d.ts +201 -0
  132. package/dist/pricing-single-card.js +1152 -0
  133. package/dist/pricing-split-layout.cjs +1001 -0
  134. package/dist/pricing-split-layout.d.cts +44 -0
  135. package/dist/pricing-split-layout.d.ts +44 -0
  136. package/dist/pricing-split-layout.js +980 -0
  137. package/dist/pricing-spotlight-card.cjs +1157 -0
  138. package/dist/pricing-spotlight-card.d.cts +201 -0
  139. package/dist/pricing-spotlight-card.d.ts +201 -0
  140. package/dist/pricing-spotlight-card.js +1136 -0
  141. package/dist/pricing-switch-cards.cjs +1274 -0
  142. package/dist/pricing-switch-cards.d.cts +254 -0
  143. package/dist/pricing-switch-cards.d.ts +254 -0
  144. package/dist/pricing-switch-cards.js +1252 -0
  145. package/dist/pricing-tabs-toggle.cjs +1314 -0
  146. package/dist/pricing-tabs-toggle.d.cts +274 -0
  147. package/dist/pricing-tabs-toggle.d.ts +274 -0
  148. package/dist/pricing-tabs-toggle.js +1291 -0
  149. package/dist/pricing-tier-grid.cjs +1190 -0
  150. package/dist/pricing-tier-grid.d.cts +224 -0
  151. package/dist/pricing-tier-grid.d.ts +224 -0
  152. package/dist/pricing-tier-grid.js +1169 -0
  153. package/dist/pricing-toggle-cards.cjs +1330 -0
  154. package/dist/pricing-toggle-cards.d.cts +267 -0
  155. package/dist/pricing-toggle-cards.d.ts +267 -0
  156. package/dist/pricing-toggle-cards.js +1307 -0
  157. package/dist/pricing-toggle-period.cjs +1251 -0
  158. package/dist/pricing-toggle-period.d.cts +265 -0
  159. package/dist/pricing-toggle-period.d.ts +265 -0
  160. package/dist/pricing-toggle-period.js +1230 -0
  161. package/dist/pricing-two-column-basic.cjs +1243 -0
  162. package/dist/pricing-two-column-basic.d.cts +244 -0
  163. package/dist/pricing-two-column-basic.d.ts +244 -0
  164. package/dist/pricing-two-column-basic.js +1222 -0
  165. package/dist/registry.cjs +109 -85
  166. package/dist/registry.js +931 -907
  167. package/package.json +1 -1
@@ -0,0 +1,1337 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import React__default from 'react';
4
+ import { useForm, Form, Field } from '@page-speed/forms';
5
+ import { TextInput as TextInput$1 } from '@page-speed/forms/inputs';
6
+ import { clsx } from 'clsx';
7
+ import { twMerge } from 'tailwind-merge';
8
+ import { cva } from 'class-variance-authority';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
+ import { Img } from '@page-speed/img';
11
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
12
+ import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
13
+ import { serializeForRails, deserializeErrors } from '@page-speed/forms/integration';
14
+
15
+ // components/blocks/offer-modal/offer-modal-sheet-newsletter.tsx
16
+ var TextInput = TextInput$1;
17
+ function cn(...inputs) {
18
+ return twMerge(clsx(inputs));
19
+ }
20
+ function normalizePhoneNumber(input) {
21
+ const trimmed = input.trim();
22
+ if (trimmed.toLowerCase().startsWith("tel:")) {
23
+ return trimmed;
24
+ }
25
+ const match = trimmed.match(/^[\s\+\-\(\)]*(\d[\d\s\-\(\)\.]*\d)[\s\-]*(x|ext\.?|extension)?[\s\-]*(\d+)?$/i);
26
+ if (match) {
27
+ const mainNumber = match[1].replace(/[\s\-\(\)\.]/g, "");
28
+ const extension = match[3];
29
+ const normalized = mainNumber.length >= 10 && !trimmed.startsWith("+") ? `+${mainNumber}` : mainNumber;
30
+ const withExtension = extension ? `${normalized};ext=${extension}` : normalized;
31
+ return `tel:${withExtension}`;
32
+ }
33
+ const cleaned = trimmed.replace(/[\s\-\(\)\.]/g, "");
34
+ return `tel:${cleaned}`;
35
+ }
36
+ function normalizeEmail(input) {
37
+ const trimmed = input.trim();
38
+ if (trimmed.toLowerCase().startsWith("mailto:")) {
39
+ return trimmed;
40
+ }
41
+ return `mailto:${trimmed}`;
42
+ }
43
+ function isEmail(input) {
44
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
45
+ return emailRegex.test(input.trim());
46
+ }
47
+ function isPhoneNumber(input) {
48
+ const trimmed = input.trim();
49
+ if (trimmed.toLowerCase().startsWith("tel:")) {
50
+ return true;
51
+ }
52
+ const phoneRegex = /^[\s\+\-\(\)]*\d[\d\s\-\(\)\.]*\d[\s\-]*(x|ext\.?|extension)?[\s\-]*\d*$/i;
53
+ return phoneRegex.test(trimmed);
54
+ }
55
+ function isInternalUrl(href) {
56
+ if (typeof window === "undefined") {
57
+ return href.startsWith("/") && !href.startsWith("//");
58
+ }
59
+ const trimmed = href.trim();
60
+ if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
61
+ return true;
62
+ }
63
+ try {
64
+ const url = new URL(trimmed, window.location.href);
65
+ const currentOrigin = window.location.origin;
66
+ const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
67
+ return normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin);
68
+ } catch {
69
+ return false;
70
+ }
71
+ }
72
+ function toRelativePath(href) {
73
+ if (typeof window === "undefined") {
74
+ return href;
75
+ }
76
+ const trimmed = href.trim();
77
+ if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
78
+ return trimmed;
79
+ }
80
+ try {
81
+ const url = new URL(trimmed, window.location.href);
82
+ const currentOrigin = window.location.origin;
83
+ const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
84
+ if (normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin)) {
85
+ return url.pathname + url.search + url.hash;
86
+ }
87
+ } catch {
88
+ }
89
+ return trimmed;
90
+ }
91
+ function useNavigation({
92
+ href,
93
+ onClick
94
+ } = {}) {
95
+ const linkType = React.useMemo(() => {
96
+ if (!href || href.trim() === "") {
97
+ return onClick ? "none" : "none";
98
+ }
99
+ const trimmed = href.trim();
100
+ if (trimmed.toLowerCase().startsWith("mailto:") || isEmail(trimmed)) {
101
+ return "mailto";
102
+ }
103
+ if (trimmed.toLowerCase().startsWith("tel:") || isPhoneNumber(trimmed)) {
104
+ return "tel";
105
+ }
106
+ if (isInternalUrl(trimmed)) {
107
+ return "internal";
108
+ }
109
+ try {
110
+ new URL(trimmed, typeof window !== "undefined" ? window.location.href : "http://localhost");
111
+ return "external";
112
+ } catch {
113
+ return "internal";
114
+ }
115
+ }, [href, onClick]);
116
+ const normalizedHref = React.useMemo(() => {
117
+ if (!href || href.trim() === "") {
118
+ return void 0;
119
+ }
120
+ const trimmed = href.trim();
121
+ switch (linkType) {
122
+ case "tel":
123
+ return normalizePhoneNumber(trimmed);
124
+ case "mailto":
125
+ return normalizeEmail(trimmed);
126
+ case "internal":
127
+ return toRelativePath(trimmed);
128
+ case "external":
129
+ return trimmed;
130
+ default:
131
+ return trimmed;
132
+ }
133
+ }, [href, linkType]);
134
+ const target = React.useMemo(() => {
135
+ switch (linkType) {
136
+ case "external":
137
+ return "_blank";
138
+ case "internal":
139
+ return "_self";
140
+ case "mailto":
141
+ case "tel":
142
+ return void 0;
143
+ default:
144
+ return void 0;
145
+ }
146
+ }, [linkType]);
147
+ const rel = React.useMemo(() => {
148
+ if (linkType === "external") {
149
+ return "noopener noreferrer";
150
+ }
151
+ return void 0;
152
+ }, [linkType]);
153
+ const isExternal = linkType === "external";
154
+ const isInternal = linkType === "internal";
155
+ const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
156
+ const handleClick = React.useCallback(
157
+ (event) => {
158
+ if (onClick) {
159
+ try {
160
+ onClick(event);
161
+ } catch (error) {
162
+ console.error("Error in user onClick handler:", error);
163
+ }
164
+ }
165
+ if (event.defaultPrevented) {
166
+ return;
167
+ }
168
+ if (shouldUseRouter && normalizedHref && event.button === 0 && // left-click only
169
+ !event.metaKey && !event.altKey && !event.ctrlKey && !event.shiftKey) {
170
+ if (typeof window !== "undefined") {
171
+ const handler = window.__opensiteNavigationHandler;
172
+ if (typeof handler === "function") {
173
+ try {
174
+ const handled = handler(normalizedHref, event.nativeEvent || event);
175
+ if (handled !== false) {
176
+ event.preventDefault();
177
+ }
178
+ } catch (error) {
179
+ console.error("Error in navigation handler:", error);
180
+ }
181
+ }
182
+ }
183
+ }
184
+ },
185
+ [onClick, shouldUseRouter, normalizedHref]
186
+ );
187
+ return {
188
+ linkType,
189
+ normalizedHref,
190
+ target,
191
+ rel,
192
+ isExternal,
193
+ isInternal,
194
+ shouldUseRouter,
195
+ handleClick
196
+ };
197
+ }
198
+ var baseStyles = [
199
+ // Layout
200
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap shrink-0",
201
+ // Typography - using CSS variables with sensible defaults
202
+ "font-[var(--button-font-family,inherit)]",
203
+ "font-[var(--button-font-weight,500)]",
204
+ "tracking-[var(--button-letter-spacing,0)]",
205
+ "leading-[var(--button-line-height,1.25)]",
206
+ "[text-transform:var(--button-text-transform,none)]",
207
+ "text-sm",
208
+ // Border radius
209
+ "rounded-[var(--button-radius,var(--radius,0.375rem))]",
210
+ // Smooth transition - using [transition:...] to set full shorthand property (not just transition-property)
211
+ "[transition:var(--button-transition,all_250ms_cubic-bezier(0.4,0,0.2,1))]",
212
+ // Box shadow (master level) - using [box-shadow:...] for complex multi-value shadows
213
+ "[box-shadow:var(--button-shadow,none)]",
214
+ "hover:[box-shadow:var(--button-shadow-hover,var(--button-shadow,none))]",
215
+ // Disabled state
216
+ "disabled:pointer-events-none disabled:opacity-50",
217
+ // SVG handling
218
+ "[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
219
+ // Focus styles
220
+ "outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
221
+ // Invalid state
222
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
223
+ ].join(" ");
224
+ var buttonVariants = cva(baseStyles, {
225
+ variants: {
226
+ variant: {
227
+ // Default (Primary) variant - full customization
228
+ default: [
229
+ "bg-[var(--button-default-bg,hsl(var(--primary)))]",
230
+ "text-[var(--button-default-fg,hsl(var(--primary-foreground)))]",
231
+ "border-[length:var(--button-default-border-width,0px)]",
232
+ "border-[color:var(--button-default-border,transparent)]",
233
+ "[box-shadow:var(--button-default-shadow,var(--button-shadow,none))]",
234
+ "hover:bg-[var(--button-default-hover-bg,hsl(var(--primary)/0.9))]",
235
+ "hover:text-[var(--button-default-hover-fg,var(--button-default-fg,hsl(var(--primary-foreground))))]",
236
+ "hover:border-[color:var(--button-default-hover-border,var(--button-default-border,transparent))]",
237
+ "hover:[box-shadow:var(--button-default-shadow-hover,var(--button-shadow-hover,var(--button-default-shadow,var(--button-shadow,none))))]"
238
+ ].join(" "),
239
+ // Destructive variant - full customization
240
+ destructive: [
241
+ "bg-[var(--button-destructive-bg,hsl(var(--destructive)))]",
242
+ "text-[var(--button-destructive-fg,white)]",
243
+ "border-[length:var(--button-destructive-border-width,0px)]",
244
+ "border-[color:var(--button-destructive-border,transparent)]",
245
+ "[box-shadow:var(--button-destructive-shadow,var(--button-shadow,none))]",
246
+ "hover:bg-[var(--button-destructive-hover-bg,hsl(var(--destructive)/0.9))]",
247
+ "hover:text-[var(--button-destructive-hover-fg,var(--button-destructive-fg,white))]",
248
+ "hover:border-[color:var(--button-destructive-hover-border,var(--button-destructive-border,transparent))]",
249
+ "hover:[box-shadow:var(--button-destructive-shadow-hover,var(--button-shadow-hover,var(--button-destructive-shadow,var(--button-shadow,none))))]",
250
+ "focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
251
+ "dark:bg-destructive/60"
252
+ ].join(" "),
253
+ // Outline variant - full customization with proper border handling
254
+ outline: [
255
+ "bg-[var(--button-outline-bg,hsl(var(--background)))]",
256
+ "text-[var(--button-outline-fg,inherit)]",
257
+ "border-[length:var(--button-outline-border-width,1px)]",
258
+ "border-[color:var(--button-outline-border,hsl(var(--border)))]",
259
+ "[box-shadow:var(--button-outline-shadow,var(--button-shadow,0_1px_2px_0_rgb(0_0_0/0.05)))]",
260
+ "hover:bg-[var(--button-outline-hover-bg,hsl(var(--accent)))]",
261
+ "hover:text-[var(--button-outline-hover-fg,hsl(var(--accent-foreground)))]",
262
+ "hover:border-[color:var(--button-outline-hover-border,var(--button-outline-border,hsl(var(--border))))]",
263
+ "hover:[box-shadow:var(--button-outline-shadow-hover,var(--button-shadow-hover,var(--button-outline-shadow,var(--button-shadow,none))))]",
264
+ "dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
265
+ ].join(" "),
266
+ // Secondary variant - full customization
267
+ secondary: [
268
+ "bg-[var(--button-secondary-bg,hsl(var(--secondary)))]",
269
+ "text-[var(--button-secondary-fg,hsl(var(--secondary-foreground)))]",
270
+ "border-[length:var(--button-secondary-border-width,0px)]",
271
+ "border-[color:var(--button-secondary-border,transparent)]",
272
+ "[box-shadow:var(--button-secondary-shadow,var(--button-shadow,none))]",
273
+ "hover:bg-[var(--button-secondary-hover-bg,hsl(var(--secondary)/0.8))]",
274
+ "hover:text-[var(--button-secondary-hover-fg,var(--button-secondary-fg,hsl(var(--secondary-foreground))))]",
275
+ "hover:border-[color:var(--button-secondary-hover-border,var(--button-secondary-border,transparent))]",
276
+ "hover:[box-shadow:var(--button-secondary-shadow-hover,var(--button-shadow-hover,var(--button-secondary-shadow,var(--button-shadow,none))))]"
277
+ ].join(" "),
278
+ // Ghost variant - full customization
279
+ ghost: [
280
+ "bg-[var(--button-ghost-bg,transparent)]",
281
+ "text-[var(--button-ghost-fg,inherit)]",
282
+ "border-[length:var(--button-ghost-border-width,0px)]",
283
+ "border-[color:var(--button-ghost-border,transparent)]",
284
+ "[box-shadow:var(--button-ghost-shadow,var(--button-shadow,none))]",
285
+ "hover:bg-[var(--button-ghost-hover-bg,hsl(var(--accent)))]",
286
+ "hover:text-[var(--button-ghost-hover-fg,hsl(var(--accent-foreground)))]",
287
+ "hover:border-[color:var(--button-ghost-hover-border,var(--button-ghost-border,transparent))]",
288
+ "hover:[box-shadow:var(--button-ghost-shadow-hover,var(--button-shadow-hover,var(--button-ghost-shadow,var(--button-shadow,none))))]",
289
+ "dark:hover:bg-accent/50"
290
+ ].join(" "),
291
+ // Link variant - full customization
292
+ link: [
293
+ "bg-[var(--button-link-bg,transparent)]",
294
+ "text-[var(--button-link-fg,hsl(var(--primary)))]",
295
+ "border-[length:var(--button-link-border-width,0px)]",
296
+ "border-[color:var(--button-link-border,transparent)]",
297
+ "[box-shadow:var(--button-link-shadow,none)]",
298
+ "hover:bg-[var(--button-link-hover-bg,transparent)]",
299
+ "hover:text-[var(--button-link-hover-fg,var(--button-link-fg,hsl(var(--primary))))]",
300
+ "hover:[box-shadow:var(--button-link-shadow-hover,none)]",
301
+ "underline-offset-4 hover:underline"
302
+ ].join(" ")
303
+ },
304
+ size: {
305
+ default: [
306
+ "h-[var(--button-height-md,2.25rem)]",
307
+ "px-[var(--button-padding-x-md,1rem)]",
308
+ "py-[var(--button-padding-y-md,0.5rem)]",
309
+ "has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
310
+ ].join(" "),
311
+ sm: [
312
+ "h-[var(--button-height-sm,2rem)]",
313
+ "px-[var(--button-padding-x-sm,0.75rem)]",
314
+ "py-[var(--button-padding-y-sm,0.25rem)]",
315
+ "gap-1.5",
316
+ "has-[>svg]:px-[calc(var(--button-padding-x-sm,0.75rem)*0.83)]"
317
+ ].join(" "),
318
+ md: [
319
+ "h-[var(--button-height-md,2.25rem)]",
320
+ "px-[var(--button-padding-x-md,1rem)]",
321
+ "py-[var(--button-padding-y-md,0.5rem)]",
322
+ "has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
323
+ ].join(" "),
324
+ lg: [
325
+ "h-[var(--button-height-lg,2.5rem)]",
326
+ "px-[var(--button-padding-x-lg,1.5rem)]",
327
+ "py-[var(--button-padding-y-lg,0.5rem)]",
328
+ "has-[>svg]:px-[calc(var(--button-padding-x-lg,1.5rem)*0.67)]"
329
+ ].join(" "),
330
+ icon: "size-[var(--button-height-md,2.25rem)]",
331
+ "icon-sm": "size-[var(--button-height-sm,2rem)]",
332
+ "icon-lg": "size-[var(--button-height-lg,2.5rem)]"
333
+ }
334
+ },
335
+ defaultVariants: {
336
+ variant: "default",
337
+ size: "default"
338
+ }
339
+ });
340
+ var Pressable = React.forwardRef(
341
+ ({
342
+ children,
343
+ className,
344
+ href,
345
+ onClick,
346
+ variant,
347
+ size,
348
+ asButton = false,
349
+ fallbackComponentType = "span",
350
+ componentType,
351
+ "aria-label": ariaLabel,
352
+ "aria-describedby": ariaDescribedby,
353
+ id,
354
+ ...props
355
+ }, ref) => {
356
+ const navigation = useNavigation({ href, onClick });
357
+ const {
358
+ normalizedHref,
359
+ target,
360
+ rel,
361
+ linkType,
362
+ isInternal,
363
+ handleClick
364
+ } = navigation;
365
+ const shouldRenderLink = normalizedHref && linkType !== "none";
366
+ const shouldRenderButton = !shouldRenderLink && onClick;
367
+ const effectiveComponentType = componentType || (shouldRenderLink ? "a" : shouldRenderButton ? "button" : fallbackComponentType);
368
+ const finalComponentType = isInternal && shouldRenderLink ? "a" : effectiveComponentType;
369
+ const shouldApplyButtonStyles = asButton || variant || size;
370
+ const combinedClassName = cn(
371
+ shouldApplyButtonStyles && buttonVariants({ variant, size }),
372
+ className
373
+ );
374
+ const dataProps = Object.fromEntries(
375
+ Object.entries(props).filter(([key]) => key.startsWith("data-"))
376
+ );
377
+ const buttonDataAttributes = shouldApplyButtonStyles ? {
378
+ "data-slot": "button",
379
+ "data-variant": variant ?? "default",
380
+ "data-size": size ?? "default"
381
+ } : {};
382
+ const commonProps = {
383
+ className: combinedClassName,
384
+ onClick: handleClick,
385
+ "aria-label": ariaLabel,
386
+ "aria-describedby": ariaDescribedby,
387
+ id,
388
+ ...dataProps,
389
+ ...buttonDataAttributes
390
+ };
391
+ if (finalComponentType === "a" && shouldRenderLink) {
392
+ return /* @__PURE__ */ jsx(
393
+ "a",
394
+ {
395
+ ref,
396
+ href: normalizedHref,
397
+ target,
398
+ rel,
399
+ ...commonProps,
400
+ ...props,
401
+ children
402
+ }
403
+ );
404
+ }
405
+ if (finalComponentType === "button") {
406
+ return /* @__PURE__ */ jsx(
407
+ "button",
408
+ {
409
+ ref,
410
+ type: props.type || "button",
411
+ ...commonProps,
412
+ ...props,
413
+ children
414
+ }
415
+ );
416
+ }
417
+ if (finalComponentType === "div") {
418
+ return /* @__PURE__ */ jsx(
419
+ "div",
420
+ {
421
+ ref,
422
+ ...commonProps,
423
+ children
424
+ }
425
+ );
426
+ }
427
+ return /* @__PURE__ */ jsx(
428
+ "span",
429
+ {
430
+ ref,
431
+ ...commonProps,
432
+ children
433
+ }
434
+ );
435
+ }
436
+ );
437
+ Pressable.displayName = "Pressable";
438
+ var maxWidthStyles = {
439
+ sm: "max-w-screen-sm",
440
+ md: "max-w-screen-md",
441
+ lg: "max-w-screen-lg",
442
+ xl: "max-w-7xl",
443
+ "2xl": "max-w-screen-2xl",
444
+ "4xl": "max-w-[1536px]",
445
+ full: "max-w-full"
446
+ };
447
+ var Container = React__default.forwardRef(
448
+ ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
449
+ const Component = as;
450
+ return /* @__PURE__ */ jsx(
451
+ Component,
452
+ {
453
+ ref,
454
+ className: cn(
455
+ "mx-auto w-full px-2 sm:px-4 lg:px-8",
456
+ maxWidthStyles[maxWidth],
457
+ className
458
+ ),
459
+ ...props,
460
+ children
461
+ }
462
+ );
463
+ }
464
+ );
465
+ Container.displayName = "Container";
466
+
467
+ // lib/patternSvgs.ts
468
+ var patternSvgs = {
469
+ squareAltGrid: "https://cdn.ing/assets/files/record/286187/4gpn0yq2ptra8iwlvmwwv860ggwv",
470
+ grid1: "https://cdn.ing/assets/files/record/286186/nbdflpgp4ostrno079hygibsflp3",
471
+ noise: "https://cdn.ing/assets/i/r/286188/zrqcp9hynh3j7p2laihwzfbujgrl/noise.png",
472
+ dots: "https://cdn.ing/assets/files/record/286198/yfsjx9thvtxzhl2qtshxyhkrm524",
473
+ dotPattern: "https://cdn.ing/assets/files/record/286192/7ig0cku8aqbboiza8nuk6hw0nnsr",
474
+ dotPattern2: "https://cdn.ing/assets/files/record/286189/arez6gd2s7isn9i1o6c7sexdq7bl",
475
+ circles: "https://cdn.ing/assets/files/record/286190/gtmia3sncjtzetdshc20zf1d3c17",
476
+ waves: "https://cdn.ing/assets/files/record/286191/mqlb33fzxz9cdth1bx7if0wmpkp1",
477
+ crossPattern: "https://cdn.ing/assets/files/record/286193/9yfqwdbnqaipbp7fsb3wbzzmq472",
478
+ architect: "https://cdn.ing/assets/files/record/286194/vgs88ugpvyhxu13wqgy0acvae6re",
479
+ tinyCheckers: "https://cdn.ing/assets/files/record/286195/65efaknsw8kcpf9o3c2gybytsl5b",
480
+ p6: "https://cdn.ing/assets/i/r/286196/6kl0rqnd6mjk8j7e525fo8fo0vkc/p6.webp"
481
+ };
482
+ var maskTop = "radial-gradient(ellipse 70% 60% at 50% 0%, #000 60%, transparent 100%)";
483
+ var maskBottom = "radial-gradient(ellipse 100% 80% at 50% 100%, #000 50%, transparent 90%)";
484
+ var maskCenter = "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 70%)";
485
+ var maskTopLeft = "radial-gradient(ellipse 80% 80% at 0% 0%, #000 50%, transparent 90%)";
486
+ var maskTopRight = "radial-gradient(ellipse 80% 80% at 100% 0%, #000 50%, transparent 90%)";
487
+ var maskBottomLeft = "radial-gradient(ellipse 80% 80% at 0% 100%, #000 50%, transparent 90%)";
488
+ var maskBottomRight = "radial-gradient(ellipse 80% 80% at 100% 100%, #000 50%, transparent 90%)";
489
+ var circuitBoardPattern = (id, mask) => /* @__PURE__ */ jsxs(
490
+ "svg",
491
+ {
492
+ className: "h-full w-full",
493
+ xmlns: "http://www.w3.org/2000/svg",
494
+ style: mask ? {
495
+ maskImage: mask,
496
+ WebkitMaskImage: mask
497
+ } : void 0,
498
+ children: [
499
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
500
+ "pattern",
501
+ {
502
+ id,
503
+ x: "0",
504
+ y: "0",
505
+ width: "100",
506
+ height: "100",
507
+ patternUnits: "userSpaceOnUse",
508
+ children: [
509
+ /* @__PURE__ */ jsx(
510
+ "path",
511
+ {
512
+ d: "M0 50h40M60 50h40M50 0v40M50 60v40",
513
+ stroke: "hsl(var(--muted))",
514
+ strokeWidth: "1",
515
+ fill: "none"
516
+ }
517
+ ),
518
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "50", r: "3", fill: "hsl(var(--muted))" }),
519
+ /* @__PURE__ */ jsx("circle", { cx: "0", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
520
+ /* @__PURE__ */ jsx("circle", { cx: "100", cy: "50", r: "2", fill: "hsl(var(--muted))" }),
521
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "0", r: "2", fill: "hsl(var(--muted))" }),
522
+ /* @__PURE__ */ jsx("circle", { cx: "50", cy: "100", r: "2", fill: "hsl(var(--muted))" })
523
+ ]
524
+ }
525
+ ) }),
526
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
527
+ ]
528
+ }
529
+ );
530
+ var gridDotsPattern = (id, mask) => /* @__PURE__ */ jsxs(
531
+ "svg",
532
+ {
533
+ className: "h-full w-full",
534
+ xmlns: "http://www.w3.org/2000/svg",
535
+ style: mask ? {
536
+ maskImage: mask,
537
+ WebkitMaskImage: mask
538
+ } : void 0,
539
+ children: [
540
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
541
+ "pattern",
542
+ {
543
+ id,
544
+ x: "0",
545
+ y: "0",
546
+ width: "40",
547
+ height: "40",
548
+ patternUnits: "userSpaceOnUse",
549
+ children: [
550
+ /* @__PURE__ */ jsx(
551
+ "path",
552
+ {
553
+ d: "M0 20h40M20 0v40",
554
+ stroke: "hsl(var(--muted))",
555
+ strokeWidth: "0.5",
556
+ fill: "none"
557
+ }
558
+ ),
559
+ /* @__PURE__ */ jsx("circle", { cx: "20", cy: "20", r: "2", fill: "hsl(var(--muted))" })
560
+ ]
561
+ }
562
+ ) }),
563
+ /* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` })
564
+ ]
565
+ }
566
+ );
567
+ var gridPattern = (size, mask) => /* @__PURE__ */ jsx(
568
+ "div",
569
+ {
570
+ 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)]",
571
+ style: {
572
+ backgroundSize: `${size}px ${size}px`,
573
+ ...mask ? {
574
+ maskImage: mask,
575
+ WebkitMaskImage: mask
576
+ } : {}
577
+ }
578
+ }
579
+ );
580
+ var diagonalCrossPattern = (mask) => /* @__PURE__ */ jsx(
581
+ "div",
582
+ {
583
+ className: "h-full w-full",
584
+ style: {
585
+ 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)",
586
+ ...mask ? {
587
+ maskImage: mask,
588
+ WebkitMaskImage: mask
589
+ } : {}
590
+ }
591
+ }
592
+ );
593
+ 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)";
594
+ var dashedGridPattern = (fadeMask) => {
595
+ const mask = fadeMask ? `${dashedGridMaskBase}, ${fadeMask}` : dashedGridMaskBase;
596
+ return /* @__PURE__ */ jsx(
597
+ "div",
598
+ {
599
+ className: "h-full w-full",
600
+ style: {
601
+ backgroundImage: "linear-gradient(to right, hsl(var(--muted)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--muted)) 1px, transparent 1px)",
602
+ backgroundSize: "20px 20px",
603
+ backgroundPosition: "0 0, 0 0",
604
+ maskImage: mask,
605
+ WebkitMaskImage: mask,
606
+ maskComposite: "intersect",
607
+ WebkitMaskComposite: "source-in"
608
+ }
609
+ }
610
+ );
611
+ };
612
+ var gradientGlow = (position) => /* @__PURE__ */ jsx(
613
+ "div",
614
+ {
615
+ className: cn(
616
+ "pointer-events-none absolute left-1/2 z-0 aspect-square w-3/4 -translate-x-1/2 rounded-full opacity-50 blur-3xl",
617
+ position === "top" ? "-top-1/4" : "-bottom-1/4"
618
+ ),
619
+ style: {
620
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
621
+ }
622
+ }
623
+ );
624
+ var spotlight = (position) => /* @__PURE__ */ jsx(
625
+ "div",
626
+ {
627
+ className: cn(
628
+ "pointer-events-none absolute top-1/2 z-0 aspect-square w-3/4 -translate-y-1/2 rounded-full opacity-40 blur-3xl",
629
+ position === "left" ? "-left-1/4" : "-right-1/4"
630
+ ),
631
+ style: {
632
+ background: "radial-gradient(circle, hsl(var(--primary)) 0%, transparent 70%)"
633
+ }
634
+ }
635
+ );
636
+ var patternOverlays = {
637
+ circuitBoardBasic: () => circuitBoardPattern("circuit-board-basic"),
638
+ circuitBoardFadeTop: () => circuitBoardPattern("circuit-board-fade-top", maskTop),
639
+ circuitBoardFadeBottom: () => circuitBoardPattern("circuit-board-fade-bottom", maskBottom),
640
+ circuitBoardFadeCenter: () => circuitBoardPattern("circuit-board-fade-center", maskCenter),
641
+ circuitBoardFadeTopLeft: () => circuitBoardPattern("circuit-board-fade-top-left", maskTopLeft),
642
+ circuitBoardFadeTopRight: () => circuitBoardPattern("circuit-board-fade-top-right", maskTopRight),
643
+ circuitBoardFadeBottomLeft: () => circuitBoardPattern("circuit-board-fade-bottom-left", maskBottomLeft),
644
+ circuitBoardFadeBottomRight: () => circuitBoardPattern("circuit-board-fade-bottom-right", maskBottomRight),
645
+ dashedGridBasic: () => dashedGridPattern(),
646
+ dashedGridFadeTop: () => dashedGridPattern(maskTop),
647
+ dashedGridFadeBottom: () => dashedGridPattern(maskBottom),
648
+ dashedGridFadeCenter: () => dashedGridPattern(maskCenter),
649
+ dashedGridFadeTopLeft: () => dashedGridPattern(maskTopLeft),
650
+ dashedGridFadeTopRight: () => dashedGridPattern(maskTopRight),
651
+ dashedGridFadeBottomLeft: () => dashedGridPattern(maskBottomLeft),
652
+ dashedGridFadeBottomRight: () => dashedGridPattern(maskBottomRight),
653
+ diagonalCrossBasic: () => diagonalCrossPattern(),
654
+ diagonalCrossFadeTop: () => diagonalCrossPattern(maskTop),
655
+ diagonalCrossFadeBottom: () => diagonalCrossPattern(maskBottom),
656
+ diagonalCrossFadeCenter: () => diagonalCrossPattern(maskCenter),
657
+ diagonalCrossFadeTopLeft: () => diagonalCrossPattern(maskTopLeft),
658
+ diagonalCrossFadeTopRight: () => diagonalCrossPattern(maskTopRight),
659
+ diagonalCrossFadeBottomLeft: () => diagonalCrossPattern(maskBottomLeft),
660
+ diagonalCrossFadeBottomRight: () => diagonalCrossPattern(maskBottomRight),
661
+ gridBasic: () => gridPattern(40),
662
+ gridFadeTop: () => gridPattern(32, maskTop),
663
+ gridFadeBottom: () => gridPattern(32, maskBottom),
664
+ gridFadeCenter: () => gridPattern(40, maskCenter),
665
+ gridFadeTopLeft: () => gridPattern(32, maskTopLeft),
666
+ gridFadeTopRight: () => gridPattern(32, maskTopRight),
667
+ gridFadeBottomLeft: () => gridPattern(32, maskBottomLeft),
668
+ gridFadeBottomRight: () => gridPattern(32, maskBottomRight),
669
+ gridDotsBasic: () => gridDotsPattern("grid-dots-basic"),
670
+ gridDotsFadeCenter: () => gridDotsPattern("grid-dots-fade-center", maskCenter),
671
+ gradientGlowTop: () => gradientGlow("top"),
672
+ gradientGlowBottom: () => gradientGlow("bottom"),
673
+ spotlightLeft: () => spotlight("left"),
674
+ spotlightRight: () => spotlight("right")
675
+ };
676
+ var inlinePatternStyles = {
677
+ radialGradientTop: {
678
+ background: "radial-gradient(125% 125% at 50% 10%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
679
+ },
680
+ radialGradientBottom: {
681
+ background: "radial-gradient(125% 125% at 50% 90%, hsl(var(--background)) 40%, hsl(var(--primary)) 100%)"
682
+ }
683
+ };
684
+ function PatternBackground({
685
+ pattern,
686
+ opacity = 0.08,
687
+ className,
688
+ style
689
+ }) {
690
+ if (!pattern) {
691
+ return null;
692
+ }
693
+ if (pattern in inlinePatternStyles) {
694
+ const inlineStyle = inlinePatternStyles[pattern];
695
+ return /* @__PURE__ */ jsx(
696
+ "div",
697
+ {
698
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
699
+ style: { ...inlineStyle, opacity, ...style },
700
+ "aria-hidden": "true"
701
+ }
702
+ );
703
+ }
704
+ if (pattern in patternOverlays) {
705
+ const Overlay2 = patternOverlays[pattern];
706
+ return /* @__PURE__ */ jsx(
707
+ "div",
708
+ {
709
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
710
+ style: { opacity, ...style },
711
+ "aria-hidden": "true",
712
+ children: Overlay2()
713
+ }
714
+ );
715
+ }
716
+ const patternUrl = pattern in patternSvgs ? patternSvgs[pattern] : pattern;
717
+ return /* @__PURE__ */ jsx(
718
+ "div",
719
+ {
720
+ className: cn("pointer-events-none absolute inset-0 z-0", className),
721
+ style: {
722
+ backgroundImage: `url(${patternUrl})`,
723
+ backgroundRepeat: "repeat",
724
+ backgroundSize: "auto",
725
+ opacity,
726
+ ...style
727
+ },
728
+ "aria-hidden": "true"
729
+ }
730
+ );
731
+ }
732
+ var backgroundStyles = {
733
+ default: "bg-background text-foreground",
734
+ white: "bg-white text-dark",
735
+ gray: "bg-muted/30 text-foreground",
736
+ dark: "bg-foreground text-background",
737
+ transparent: "bg-transparent text-foreground",
738
+ gradient: "bg-linear-to-br from-primary via-primary/90 to-foreground text-primary-foreground",
739
+ primary: "bg-primary text-primary-foreground",
740
+ secondary: "bg-secondary text-secondary-foreground",
741
+ muted: "bg-muted text-muted-foreground"
742
+ };
743
+ var spacingStyles = {
744
+ none: "py-0 md:py-0",
745
+ sm: "py-12 md:py-16",
746
+ md: "py-16 md:py-24",
747
+ lg: "py-20 md:py-32",
748
+ xl: "py-24 md:py-40"
749
+ };
750
+ var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
751
+ var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
752
+ var Section = React__default.forwardRef(
753
+ ({
754
+ id,
755
+ title,
756
+ subtitle,
757
+ children,
758
+ className,
759
+ style,
760
+ background = "default",
761
+ spacing = "lg",
762
+ pattern,
763
+ patternOpacity,
764
+ patternClassName,
765
+ containerClassName,
766
+ containerMaxWidth = "xl",
767
+ ...props
768
+ }, ref) => {
769
+ const effectivePatternOpacity = patternOpacity !== void 0 ? patternOpacity : pattern ? 1 : 0;
770
+ return /* @__PURE__ */ jsxs(
771
+ "section",
772
+ {
773
+ ref,
774
+ id,
775
+ className: cn(
776
+ "relative",
777
+ pattern ? "overflow-hidden" : null,
778
+ backgroundStyles[background],
779
+ isPredefinedSpacing(spacing) ? spacingStyles[spacing] : spacing,
780
+ className
781
+ ),
782
+ style,
783
+ ...props,
784
+ children: [
785
+ /* @__PURE__ */ jsx(
786
+ PatternBackground,
787
+ {
788
+ pattern,
789
+ opacity: effectivePatternOpacity,
790
+ className: patternClassName
791
+ }
792
+ ),
793
+ /* @__PURE__ */ jsxs(
794
+ Container,
795
+ {
796
+ maxWidth: containerMaxWidth,
797
+ className: cn("relative z-10", containerClassName),
798
+ children: [
799
+ (title || subtitle) && /* @__PURE__ */ jsxs("div", { className: "mb-6 text-center md:mb-16", children: [
800
+ subtitle && /* @__PURE__ */ jsx("p", { className: "mb-2 text-sm font-semibold uppercase tracking-wider", children: subtitle }),
801
+ title && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl", children: title })
802
+ ] }),
803
+ children
804
+ ]
805
+ }
806
+ )
807
+ ]
808
+ }
809
+ );
810
+ }
811
+ );
812
+ Section.displayName = "Section";
813
+ var svgCache = /* @__PURE__ */ new Map();
814
+ function DynamicIcon({
815
+ name,
816
+ size = 28,
817
+ color,
818
+ className,
819
+ alt
820
+ }) {
821
+ const [svgContent, setSvgContent] = React.useState(null);
822
+ const [isLoading, setIsLoading] = React.useState(true);
823
+ const [error, setError] = React.useState(null);
824
+ const { url, iconName } = React.useMemo(() => {
825
+ const separator = name.includes("/") ? "/" : ":";
826
+ const [prefix, iconName2] = name.split(separator);
827
+ const baseUrl = `https://icons.opensite.ai/api/icon/${prefix}/${iconName2}?format=svg&width=${size}&height=${size}`;
828
+ return {
829
+ url: baseUrl,
830
+ iconName: iconName2
831
+ };
832
+ }, [name, size]);
833
+ React.useEffect(() => {
834
+ let isMounted = true;
835
+ const fetchSvg = async () => {
836
+ const cached = svgCache.get(url);
837
+ if (cached) {
838
+ if (isMounted) {
839
+ setSvgContent(cached);
840
+ setIsLoading(false);
841
+ }
842
+ return;
843
+ }
844
+ try {
845
+ setIsLoading(true);
846
+ setError(null);
847
+ const response = await fetch(url);
848
+ if (!response.ok) {
849
+ throw new Error(`Failed to fetch icon: ${response.status}`);
850
+ }
851
+ let svg = await response.text();
852
+ svg = processSvgForCurrentColor(svg);
853
+ svgCache.set(url, svg);
854
+ if (isMounted) {
855
+ setSvgContent(svg);
856
+ setIsLoading(false);
857
+ }
858
+ } catch (err) {
859
+ if (isMounted) {
860
+ setError(err instanceof Error ? err.message : "Failed to load icon");
861
+ setIsLoading(false);
862
+ }
863
+ }
864
+ };
865
+ fetchSvg();
866
+ return () => {
867
+ isMounted = false;
868
+ };
869
+ }, [url]);
870
+ if (isLoading) {
871
+ return /* @__PURE__ */ jsx(
872
+ "span",
873
+ {
874
+ className: cn("inline-block", className),
875
+ style: { width: size, height: size },
876
+ "aria-hidden": "true"
877
+ }
878
+ );
879
+ }
880
+ if (error || !svgContent) {
881
+ return /* @__PURE__ */ jsx(
882
+ "span",
883
+ {
884
+ className: cn("inline-block", className),
885
+ style: { width: size, height: size },
886
+ role: "img",
887
+ "aria-label": alt || iconName
888
+ }
889
+ );
890
+ }
891
+ return /* @__PURE__ */ jsx(
892
+ "span",
893
+ {
894
+ className: cn("inline-flex items-center justify-center", className),
895
+ style: {
896
+ width: size,
897
+ height: size,
898
+ color: color || "inherit"
899
+ },
900
+ role: "img",
901
+ "aria-label": alt || iconName,
902
+ dangerouslySetInnerHTML: { __html: svgContent }
903
+ }
904
+ );
905
+ }
906
+ function processSvgForCurrentColor(svg) {
907
+ let processed = svg;
908
+ processed = processed.replace(
909
+ /stroke=["'](#000000|#000|black)["']/gi,
910
+ 'stroke="currentColor"'
911
+ );
912
+ processed = processed.replace(
913
+ /fill=["'](#000000|#000|black)["']/gi,
914
+ 'fill="currentColor"'
915
+ );
916
+ return processed;
917
+ }
918
+ function Sheet({ ...props }) {
919
+ return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
920
+ }
921
+ function SheetPortal({
922
+ ...props
923
+ }) {
924
+ return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
925
+ }
926
+ function SheetOverlay({
927
+ className,
928
+ ...props
929
+ }) {
930
+ return /* @__PURE__ */ jsx(
931
+ SheetPrimitive.Overlay,
932
+ {
933
+ "data-slot": "sheet-overlay",
934
+ className: cn(
935
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
936
+ className
937
+ ),
938
+ ...props
939
+ }
940
+ );
941
+ }
942
+ function SheetContent({
943
+ className,
944
+ children,
945
+ side = "right",
946
+ ...props
947
+ }) {
948
+ return /* @__PURE__ */ jsxs(SheetPortal, { children: [
949
+ /* @__PURE__ */ jsx(SheetOverlay, {}),
950
+ /* @__PURE__ */ jsxs(
951
+ SheetPrimitive.Content,
952
+ {
953
+ "data-slot": "sheet-content",
954
+ className: cn(
955
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
956
+ side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
957
+ side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
958
+ side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
959
+ side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
960
+ className
961
+ ),
962
+ ...props,
963
+ children: [
964
+ children,
965
+ /* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
966
+ /* @__PURE__ */ jsx(DynamicIcon, { name: "lucide/x", className: "size-4" }),
967
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
968
+ ] })
969
+ ]
970
+ }
971
+ )
972
+ ] });
973
+ }
974
+ function SheetHeader({ className, ...props }) {
975
+ return /* @__PURE__ */ jsx(
976
+ "div",
977
+ {
978
+ "data-slot": "sheet-header",
979
+ className: cn("flex flex-col gap-1.5 p-4", className),
980
+ ...props
981
+ }
982
+ );
983
+ }
984
+ function SheetTitle({
985
+ className,
986
+ ...props
987
+ }) {
988
+ return /* @__PURE__ */ jsx(
989
+ SheetPrimitive.Title,
990
+ {
991
+ "data-slot": "sheet-title",
992
+ className: cn("text-foreground font-semibold", className),
993
+ ...props
994
+ }
995
+ );
996
+ }
997
+ function SheetDescription({
998
+ className,
999
+ ...props
1000
+ }) {
1001
+ return /* @__PURE__ */ jsx(
1002
+ SheetPrimitive.Description,
1003
+ {
1004
+ "data-slot": "sheet-description",
1005
+ className: cn("text-muted-foreground text-sm", className),
1006
+ ...props
1007
+ }
1008
+ );
1009
+ }
1010
+ function AspectRatio({
1011
+ ...props
1012
+ }) {
1013
+ return /* @__PURE__ */ jsx(AspectRatioPrimitive.Root, { "data-slot": "aspect-ratio", ...props });
1014
+ }
1015
+ var PageSpeedFormSubmissionError = class extends Error {
1016
+ constructor(message, options = {}) {
1017
+ super(message);
1018
+ this.name = "PageSpeedFormSubmissionError";
1019
+ this.formErrors = options.formErrors;
1020
+ this.status = options.status;
1021
+ }
1022
+ };
1023
+ var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1024
+ function isValidEmail(value) {
1025
+ return EMAIL_REGEX.test(value);
1026
+ }
1027
+ function buildUrlWithParams(endpoint, values) {
1028
+ const base = typeof window === "undefined" ? "http://localhost" : window.location.origin;
1029
+ const url = new URL(endpoint, base);
1030
+ Object.entries(values).forEach(([key, value]) => {
1031
+ if (value === void 0 || value === null) {
1032
+ return;
1033
+ }
1034
+ if (Array.isArray(value)) {
1035
+ value.forEach((item) => {
1036
+ if (item !== void 0 && item !== null) {
1037
+ url.searchParams.append(key, String(item));
1038
+ }
1039
+ });
1040
+ return;
1041
+ }
1042
+ url.searchParams.set(key, String(value));
1043
+ });
1044
+ return url.toString();
1045
+ }
1046
+ function normalizeMethod(method) {
1047
+ return (method || "post").toUpperCase();
1048
+ }
1049
+ function resolveFormat(config) {
1050
+ if (config?.format) {
1051
+ return config.format;
1052
+ }
1053
+ return config?.apiKey ? "rails" : "json";
1054
+ }
1055
+ function mergeValues(values, config) {
1056
+ return {
1057
+ ...config?.values ?? {},
1058
+ ...values
1059
+ };
1060
+ }
1061
+ async function submitPageSpeedForm(values, config) {
1062
+ if (!config?.endpoint) {
1063
+ return null;
1064
+ }
1065
+ const payload = mergeValues(values, config);
1066
+ const method = normalizeMethod(config.method);
1067
+ const format = resolveFormat(config);
1068
+ const headers = { ...config.headers ?? {} };
1069
+ if (format === "rails") {
1070
+ if (!config.apiKey) {
1071
+ throw new PageSpeedFormSubmissionError(
1072
+ "Missing apiKey for Rails form submission."
1073
+ );
1074
+ }
1075
+ const railsConfig = {
1076
+ apiKey: config.apiKey,
1077
+ contactCategoryToken: config.contactCategoryToken,
1078
+ locationId: config.locationId,
1079
+ websiteId: config.websiteId,
1080
+ websiteFormAssignmentId: config.websiteFormAssignmentId,
1081
+ visitorIpAddress: config.visitorIpAddress
1082
+ };
1083
+ const serialized = serializeForRails(payload, railsConfig);
1084
+ if (serialized.contact.contact_form_upload_tokens) {
1085
+ serialized.contact.contact_form_upload_tokens = serialized.contact.contact_form_upload_tokens.map((token) => token.replace(/^upload_/, ""));
1086
+ }
1087
+ headers["Content-Type"] ?? (headers["Content-Type"] = "application/json");
1088
+ const response2 = await fetch(config.endpoint, {
1089
+ method,
1090
+ headers,
1091
+ body: JSON.stringify(serialized)
1092
+ });
1093
+ const data2 = await response2.json().catch(() => null);
1094
+ if (!response2.ok || data2 && data2.errors) {
1095
+ const errorResponse = {
1096
+ errors: data2?.errors ?? { base: ["Form submission failed"] },
1097
+ status: data2?.status ?? response2.status
1098
+ };
1099
+ const formErrors = deserializeErrors(errorResponse);
1100
+ throw new PageSpeedFormSubmissionError("Form submission failed.", {
1101
+ formErrors,
1102
+ status: errorResponse.status
1103
+ });
1104
+ }
1105
+ return data2;
1106
+ }
1107
+ if (method === "GET") {
1108
+ const url = buildUrlWithParams(config.endpoint, payload);
1109
+ const response2 = await fetch(url, { method, headers });
1110
+ const data2 = await response2.json().catch(() => null);
1111
+ if (!response2.ok) {
1112
+ throw new PageSpeedFormSubmissionError(
1113
+ data2?.message || "Form submission failed.",
1114
+ { status: response2.status }
1115
+ );
1116
+ }
1117
+ return data2;
1118
+ }
1119
+ headers["Content-Type"] ?? (headers["Content-Type"] = "application/json");
1120
+ const response = await fetch(config.endpoint, {
1121
+ method,
1122
+ headers,
1123
+ body: JSON.stringify(payload)
1124
+ });
1125
+ const data = await response.json().catch(() => null);
1126
+ if (!response.ok) {
1127
+ throw new PageSpeedFormSubmissionError(
1128
+ data?.message || "Form submission failed.",
1129
+ { status: response.status }
1130
+ );
1131
+ }
1132
+ return data;
1133
+ }
1134
+ var { useMemo: useMemo3 } = React;
1135
+ function OfferModalSheetNewsletter({
1136
+ logo,
1137
+ logoSlot,
1138
+ title,
1139
+ description,
1140
+ image,
1141
+ imageSlot,
1142
+ emailPlaceholder,
1143
+ buttonText,
1144
+ termsUrl,
1145
+ termsText,
1146
+ privacyUrl,
1147
+ privacyText,
1148
+ legalSlot,
1149
+ closeButtonSlot,
1150
+ formSlot,
1151
+ headerSlot,
1152
+ open,
1153
+ onOpenChange,
1154
+ defaultOpen = true,
1155
+ onSubmit,
1156
+ formConfig,
1157
+ onSuccess,
1158
+ onError,
1159
+ className,
1160
+ contentClassName,
1161
+ headerClassName,
1162
+ logoClassName,
1163
+ titleClassName,
1164
+ descriptionClassName,
1165
+ formClassName,
1166
+ inputClassName,
1167
+ submitClassName,
1168
+ legalClassName,
1169
+ imageWrapperClassName,
1170
+ imageClassName,
1171
+ optixFlowConfig,
1172
+ background = "default"
1173
+ }) {
1174
+ const form = useForm({
1175
+ initialValues: {
1176
+ email: ""
1177
+ },
1178
+ validationSchema: {
1179
+ email: (value) => {
1180
+ if (!value) return "Please enter an email address";
1181
+ if (!isValidEmail(value)) {
1182
+ return "Please enter a valid email address";
1183
+ }
1184
+ return void 0;
1185
+ }
1186
+ },
1187
+ onSubmit: async (values, helpers) => {
1188
+ const shouldAutoSubmit = Boolean(formConfig?.endpoint);
1189
+ if (!shouldAutoSubmit && !onSubmit) {
1190
+ return;
1191
+ }
1192
+ try {
1193
+ let result;
1194
+ if (shouldAutoSubmit) {
1195
+ result = await submitPageSpeedForm(values, formConfig);
1196
+ }
1197
+ if (onSubmit) {
1198
+ await onSubmit(values.email);
1199
+ }
1200
+ if (shouldAutoSubmit || onSubmit) {
1201
+ if (formConfig?.resetOnSuccess !== false) {
1202
+ helpers.resetForm();
1203
+ }
1204
+ onSuccess?.(result);
1205
+ }
1206
+ } catch (error) {
1207
+ if (error instanceof PageSpeedFormSubmissionError && error.formErrors) {
1208
+ helpers.setErrors(error.formErrors);
1209
+ }
1210
+ onError?.(error);
1211
+ throw error;
1212
+ }
1213
+ }
1214
+ });
1215
+ const formMethod = formConfig?.method?.toLowerCase() === "get" ? "get" : "post";
1216
+ const sheetProps = open !== void 0 ? { open, onOpenChange } : { defaultOpen };
1217
+ const renderLogo = useMemo3(() => {
1218
+ if (logoSlot) return logoSlot;
1219
+ if (!logo) return null;
1220
+ const logoSrc = typeof logo.src === "string" ? logo.src : logo.src.light;
1221
+ return /* @__PURE__ */ jsx(
1222
+ Img,
1223
+ {
1224
+ src: logoSrc,
1225
+ alt: logo.alt,
1226
+ className: cn("size-11 lg:size-16 dark:invert", logoClassName),
1227
+ optixFlowConfig
1228
+ }
1229
+ );
1230
+ }, [logoSlot, logo, logoClassName, optixFlowConfig]);
1231
+ const renderHeader = useMemo3(() => {
1232
+ if (headerSlot) return headerSlot;
1233
+ return /* @__PURE__ */ jsxs(SheetHeader, { className: cn("gap-8 p-0", headerClassName), children: [
1234
+ renderLogo,
1235
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1236
+ title && /* @__PURE__ */ jsx(SheetTitle, { className: cn("text-2xl font-medium leading-tight md:text-3xl lg:text-4xl", titleClassName), children: title }),
1237
+ description && /* @__PURE__ */ jsx(SheetDescription, { className: cn("text-xl leading-tight", descriptionClassName), children: description })
1238
+ ] })
1239
+ ] });
1240
+ }, [headerSlot, renderLogo, headerClassName, title, titleClassName, description, descriptionClassName]);
1241
+ const renderForm = useMemo3(() => {
1242
+ if (formSlot) return formSlot;
1243
+ return /* @__PURE__ */ jsx(
1244
+ Form,
1245
+ {
1246
+ form,
1247
+ action: formConfig?.endpoint,
1248
+ method: formMethod,
1249
+ className: formClassName,
1250
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 max-sm:flex-col", children: [
1251
+ /* @__PURE__ */ jsx(
1252
+ Field,
1253
+ {
1254
+ name: "email",
1255
+ className: "w-full flex-1",
1256
+ children: ({ field, meta }) => /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
1257
+ /* @__PURE__ */ jsx(
1258
+ TextInput,
1259
+ {
1260
+ ...field,
1261
+ type: "email",
1262
+ className: cn("h-10 w-full rounded-full px-6", inputClassName),
1263
+ placeholder: emailPlaceholder,
1264
+ error: (meta.touched || form.status === "error") && !!meta.error,
1265
+ "aria-label": emailPlaceholder || "Email address"
1266
+ }
1267
+ ),
1268
+ (meta.touched || form.status === "error") && meta.error && /* @__PURE__ */ jsx("div", { className: "text-destructive mt-1 text-xs", children: meta.error })
1269
+ ] })
1270
+ }
1271
+ ),
1272
+ /* @__PURE__ */ jsx(
1273
+ Pressable,
1274
+ {
1275
+ size: "lg",
1276
+ variant: "default",
1277
+ className: cn("sm:basis-30 rounded-full max-sm:w-full", submitClassName),
1278
+ asButton: true,
1279
+ componentType: "button",
1280
+ type: "submit",
1281
+ disabled: form.isSubmitting,
1282
+ children: buttonText
1283
+ }
1284
+ )
1285
+ ] })
1286
+ }
1287
+ );
1288
+ }, [formSlot, form, formConfig, formMethod, emailPlaceholder, inputClassName, submitClassName, buttonText, formClassName]);
1289
+ const renderLegal = useMemo3(() => {
1290
+ if (legalSlot) return legalSlot;
1291
+ if (!termsUrl || !termsText || !privacyUrl || !privacyText) return null;
1292
+ return /* @__PURE__ */ jsxs("p", { className: cn("text-muted-foreground text-xs", legalClassName), children: [
1293
+ "By signing up, you consent to our",
1294
+ " ",
1295
+ /* @__PURE__ */ jsx(Pressable, { href: termsUrl, className: "underline-offset-3 underline", children: termsText }),
1296
+ " ",
1297
+ "and",
1298
+ " ",
1299
+ /* @__PURE__ */ jsx(Pressable, { href: privacyUrl, className: "underline-offset-3 underline", children: privacyText }),
1300
+ "."
1301
+ ] });
1302
+ }, [legalSlot, termsUrl, termsText, privacyUrl, privacyText, legalClassName]);
1303
+ const renderImage = useMemo3(() => {
1304
+ if (imageSlot) return imageSlot;
1305
+ if (!image) return null;
1306
+ return /* @__PURE__ */ jsx("div", { className: cn("h-1/2 basis-1/2", imageWrapperClassName), children: /* @__PURE__ */ jsx(AspectRatio, { ratio: 1, className: "overflow-hidden", children: /* @__PURE__ */ jsx(
1307
+ Img,
1308
+ {
1309
+ src: image.src,
1310
+ alt: image.alt,
1311
+ className: cn("block size-full object-cover object-center", imageClassName),
1312
+ optixFlowConfig
1313
+ }
1314
+ ) }) });
1315
+ }, [imageSlot, image, imageWrapperClassName, imageClassName, optixFlowConfig]);
1316
+ return /* @__PURE__ */ jsx(Sheet, { ...sheetProps, children: /* @__PURE__ */ jsx(
1317
+ SheetContent,
1318
+ {
1319
+ className: cn(
1320
+ "md:max-w-[600px] w-full max-md:max-w-[calc(100dvw-2.5rem)]! [&>button:hover>svg]:rotate-180 [&>button>svg]:size-5 [&>button>svg]:transition-all",
1321
+ className
1322
+ ),
1323
+ children: /* @__PURE__ */ jsx(Section, { background, spacing: "none", children: /* @__PURE__ */ jsxs("div", { className: cn("max-h-full overflow-y-auto", contentClassName), children: [
1324
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 p-6 md:p-16", children: [
1325
+ /* @__PURE__ */ jsxs("div", { className: "basis-1/2 space-y-8", children: [
1326
+ renderHeader,
1327
+ renderForm
1328
+ ] }),
1329
+ renderLegal
1330
+ ] }),
1331
+ renderImage
1332
+ ] }) })
1333
+ }
1334
+ ) });
1335
+ }
1336
+
1337
+ export { OfferModalSheetNewsletter };