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