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