@opensite/ui 2.1.2 → 2.1.3
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/contact-faq.cjs +35 -522
- package/dist/contact-faq.d.cts +2 -10
- package/dist/contact-faq.d.ts +2 -10
- package/dist/contact-faq.js +34 -524
- package/dist/contact-vendor.cjs +33 -535
- package/dist/contact-vendor.js +32 -519
- package/dist/hero-newsletter-minimal.cjs +42 -492
- package/dist/hero-newsletter-minimal.js +44 -494
- package/dist/hero-saas-dashboard-preview.cjs +36 -36
- package/dist/hero-saas-dashboard-preview.js +36 -36
- package/dist/registry.cjs +146 -311
- package/dist/registry.js +147 -312
- package/package.json +2 -2
package/dist/contact-vendor.js
CHANGED
|
@@ -1,435 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import React__default, { useMemo } from 'react';
|
|
4
|
-
import { Form } from '@page-speed/forms';
|
|
5
|
-
import { useFileUpload, useContactForm, getColumnSpanClass, DynamicFormField } from '@page-speed/forms/integration';
|
|
2
|
+
import { useFileUpload, FormEngine } from '@page-speed/forms/integration';
|
|
6
3
|
import { clsx } from 'clsx';
|
|
7
4
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import { cva } from 'class-variance-authority';
|
|
9
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
import React from 'react';
|
|
10
7
|
|
|
11
8
|
// components/blocks/contact/contact-vendor.tsx
|
|
12
9
|
function cn(...inputs) {
|
|
13
10
|
return twMerge(clsx(inputs));
|
|
14
11
|
}
|
|
15
|
-
function normalizePhoneNumber(input) {
|
|
16
|
-
const trimmed = input.trim();
|
|
17
|
-
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
18
|
-
return trimmed;
|
|
19
|
-
}
|
|
20
|
-
const match = trimmed.match(/^[\s\+\-\(\)]*(\d[\d\s\-\(\)\.]*\d)[\s\-]*(x|ext\.?|extension)?[\s\-]*(\d+)?$/i);
|
|
21
|
-
if (match) {
|
|
22
|
-
const mainNumber = match[1].replace(/[\s\-\(\)\.]/g, "");
|
|
23
|
-
const extension = match[3];
|
|
24
|
-
const normalized = mainNumber.length >= 10 && !trimmed.startsWith("+") ? `+${mainNumber}` : mainNumber;
|
|
25
|
-
const withExtension = extension ? `${normalized};ext=${extension}` : normalized;
|
|
26
|
-
return `tel:${withExtension}`;
|
|
27
|
-
}
|
|
28
|
-
const cleaned = trimmed.replace(/[\s\-\(\)\.]/g, "");
|
|
29
|
-
return `tel:${cleaned}`;
|
|
30
|
-
}
|
|
31
|
-
function normalizeEmail(input) {
|
|
32
|
-
const trimmed = input.trim();
|
|
33
|
-
if (trimmed.toLowerCase().startsWith("mailto:")) {
|
|
34
|
-
return trimmed;
|
|
35
|
-
}
|
|
36
|
-
return `mailto:${trimmed}`;
|
|
37
|
-
}
|
|
38
|
-
function isEmail(input) {
|
|
39
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
40
|
-
return emailRegex.test(input.trim());
|
|
41
|
-
}
|
|
42
|
-
function isPhoneNumber(input) {
|
|
43
|
-
const trimmed = input.trim();
|
|
44
|
-
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
const phoneRegex = /^[\s\+\-\(\)]*\d[\d\s\-\(\)\.]*\d[\s\-]*(x|ext\.?|extension)?[\s\-]*\d*$/i;
|
|
48
|
-
return phoneRegex.test(trimmed);
|
|
49
|
-
}
|
|
50
|
-
function isInternalUrl(href) {
|
|
51
|
-
if (typeof window === "undefined") {
|
|
52
|
-
return href.startsWith("/") && !href.startsWith("//");
|
|
53
|
-
}
|
|
54
|
-
const trimmed = href.trim();
|
|
55
|
-
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
try {
|
|
59
|
-
const url = new URL(trimmed, window.location.href);
|
|
60
|
-
const currentOrigin = window.location.origin;
|
|
61
|
-
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
62
|
-
return normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin);
|
|
63
|
-
} catch {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function toRelativePath(href) {
|
|
68
|
-
if (typeof window === "undefined") {
|
|
69
|
-
return href;
|
|
70
|
-
}
|
|
71
|
-
const trimmed = href.trim();
|
|
72
|
-
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
73
|
-
return trimmed;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
const url = new URL(trimmed, window.location.href);
|
|
77
|
-
const currentOrigin = window.location.origin;
|
|
78
|
-
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
79
|
-
if (normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin)) {
|
|
80
|
-
return url.pathname + url.search + url.hash;
|
|
81
|
-
}
|
|
82
|
-
} catch {
|
|
83
|
-
}
|
|
84
|
-
return trimmed;
|
|
85
|
-
}
|
|
86
|
-
function useNavigation({
|
|
87
|
-
href,
|
|
88
|
-
onClick
|
|
89
|
-
} = {}) {
|
|
90
|
-
const linkType = React.useMemo(() => {
|
|
91
|
-
if (!href || href.trim() === "") {
|
|
92
|
-
return onClick ? "none" : "none";
|
|
93
|
-
}
|
|
94
|
-
const trimmed = href.trim();
|
|
95
|
-
if (trimmed.toLowerCase().startsWith("mailto:") || isEmail(trimmed)) {
|
|
96
|
-
return "mailto";
|
|
97
|
-
}
|
|
98
|
-
if (trimmed.toLowerCase().startsWith("tel:") || isPhoneNumber(trimmed)) {
|
|
99
|
-
return "tel";
|
|
100
|
-
}
|
|
101
|
-
if (isInternalUrl(trimmed)) {
|
|
102
|
-
return "internal";
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
new URL(trimmed, typeof window !== "undefined" ? window.location.href : "http://localhost");
|
|
106
|
-
return "external";
|
|
107
|
-
} catch {
|
|
108
|
-
return "internal";
|
|
109
|
-
}
|
|
110
|
-
}, [href, onClick]);
|
|
111
|
-
const normalizedHref = React.useMemo(() => {
|
|
112
|
-
if (!href || href.trim() === "") {
|
|
113
|
-
return void 0;
|
|
114
|
-
}
|
|
115
|
-
const trimmed = href.trim();
|
|
116
|
-
switch (linkType) {
|
|
117
|
-
case "tel":
|
|
118
|
-
return normalizePhoneNumber(trimmed);
|
|
119
|
-
case "mailto":
|
|
120
|
-
return normalizeEmail(trimmed);
|
|
121
|
-
case "internal":
|
|
122
|
-
return toRelativePath(trimmed);
|
|
123
|
-
case "external":
|
|
124
|
-
return trimmed;
|
|
125
|
-
default:
|
|
126
|
-
return trimmed;
|
|
127
|
-
}
|
|
128
|
-
}, [href, linkType]);
|
|
129
|
-
const target = React.useMemo(() => {
|
|
130
|
-
switch (linkType) {
|
|
131
|
-
case "external":
|
|
132
|
-
return "_blank";
|
|
133
|
-
case "internal":
|
|
134
|
-
return "_self";
|
|
135
|
-
case "mailto":
|
|
136
|
-
case "tel":
|
|
137
|
-
return void 0;
|
|
138
|
-
default:
|
|
139
|
-
return void 0;
|
|
140
|
-
}
|
|
141
|
-
}, [linkType]);
|
|
142
|
-
const rel = React.useMemo(() => {
|
|
143
|
-
if (linkType === "external") {
|
|
144
|
-
return "noopener noreferrer";
|
|
145
|
-
}
|
|
146
|
-
return void 0;
|
|
147
|
-
}, [linkType]);
|
|
148
|
-
const isExternal = linkType === "external";
|
|
149
|
-
const isInternal = linkType === "internal";
|
|
150
|
-
const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
|
|
151
|
-
const handleClick = React.useCallback(
|
|
152
|
-
(event) => {
|
|
153
|
-
if (onClick) {
|
|
154
|
-
try {
|
|
155
|
-
onClick(event);
|
|
156
|
-
} catch (error) {
|
|
157
|
-
console.error("Error in user onClick handler:", error);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (event.defaultPrevented) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (shouldUseRouter && normalizedHref && event.button === 0 && // left-click only
|
|
164
|
-
!event.metaKey && !event.altKey && !event.ctrlKey && !event.shiftKey) {
|
|
165
|
-
if (typeof window !== "undefined") {
|
|
166
|
-
const handler = window.__opensiteNavigationHandler;
|
|
167
|
-
if (typeof handler === "function") {
|
|
168
|
-
try {
|
|
169
|
-
const handled = handler(normalizedHref, event.nativeEvent || event);
|
|
170
|
-
if (handled !== false) {
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
}
|
|
173
|
-
} catch (error) {
|
|
174
|
-
console.error("Error in navigation handler:", error);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
[onClick, shouldUseRouter, normalizedHref]
|
|
181
|
-
);
|
|
182
|
-
return {
|
|
183
|
-
linkType,
|
|
184
|
-
normalizedHref,
|
|
185
|
-
target,
|
|
186
|
-
rel,
|
|
187
|
-
isExternal,
|
|
188
|
-
isInternal,
|
|
189
|
-
shouldUseRouter,
|
|
190
|
-
handleClick
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
var baseStyles = [
|
|
194
|
-
// Layout
|
|
195
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap shrink-0",
|
|
196
|
-
// Typography - using CSS variables with sensible defaults
|
|
197
|
-
"font-[var(--button-font-family,inherit)]",
|
|
198
|
-
"font-[var(--button-font-weight,500)]",
|
|
199
|
-
"tracking-[var(--button-letter-spacing,0)]",
|
|
200
|
-
"leading-[var(--button-line-height,1.25)]",
|
|
201
|
-
"[text-transform:var(--button-text-transform,none)]",
|
|
202
|
-
"text-sm",
|
|
203
|
-
// Border radius
|
|
204
|
-
"rounded-[var(--button-radius,var(--radius,0.375rem))]",
|
|
205
|
-
// Smooth transition - using [transition:...] to set full shorthand property (not just transition-property)
|
|
206
|
-
"[transition:var(--button-transition,all_250ms_cubic-bezier(0.4,0,0.2,1))]",
|
|
207
|
-
// Box shadow (master level) - using [box-shadow:...] for complex multi-value shadows
|
|
208
|
-
"[box-shadow:var(--button-shadow,none)]",
|
|
209
|
-
"hover:[box-shadow:var(--button-shadow-hover,var(--button-shadow,none))]",
|
|
210
|
-
// Disabled state
|
|
211
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
212
|
-
// SVG handling
|
|
213
|
-
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
|
|
214
|
-
// Focus styles
|
|
215
|
-
"outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
216
|
-
// Invalid state
|
|
217
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
|
|
218
|
-
].join(" ");
|
|
219
|
-
var buttonVariants = cva(baseStyles, {
|
|
220
|
-
variants: {
|
|
221
|
-
variant: {
|
|
222
|
-
// Default (Primary) variant - full customization
|
|
223
|
-
default: [
|
|
224
|
-
"bg-[var(--button-default-bg,hsl(var(--primary)))]",
|
|
225
|
-
"text-[var(--button-default-fg,hsl(var(--primary-foreground)))]",
|
|
226
|
-
"border-[length:var(--button-default-border-width,0px)]",
|
|
227
|
-
"border-[color:var(--button-default-border,transparent)]",
|
|
228
|
-
"[box-shadow:var(--button-default-shadow,var(--button-shadow,none))]",
|
|
229
|
-
"hover:bg-[var(--button-default-hover-bg,hsl(var(--primary)/0.9))]",
|
|
230
|
-
"hover:text-[var(--button-default-hover-fg,var(--button-default-fg,hsl(var(--primary-foreground))))]",
|
|
231
|
-
"hover:border-[color:var(--button-default-hover-border,var(--button-default-border,transparent))]",
|
|
232
|
-
"hover:[box-shadow:var(--button-default-shadow-hover,var(--button-shadow-hover,var(--button-default-shadow,var(--button-shadow,none))))]"
|
|
233
|
-
].join(" "),
|
|
234
|
-
// Destructive variant - full customization
|
|
235
|
-
destructive: [
|
|
236
|
-
"bg-[var(--button-destructive-bg,hsl(var(--destructive)))]",
|
|
237
|
-
"text-[var(--button-destructive-fg,white)]",
|
|
238
|
-
"border-[length:var(--button-destructive-border-width,0px)]",
|
|
239
|
-
"border-[color:var(--button-destructive-border,transparent)]",
|
|
240
|
-
"[box-shadow:var(--button-destructive-shadow,var(--button-shadow,none))]",
|
|
241
|
-
"hover:bg-[var(--button-destructive-hover-bg,hsl(var(--destructive)/0.9))]",
|
|
242
|
-
"hover:text-[var(--button-destructive-hover-fg,var(--button-destructive-fg,white))]",
|
|
243
|
-
"hover:border-[color:var(--button-destructive-hover-border,var(--button-destructive-border,transparent))]",
|
|
244
|
-
"hover:[box-shadow:var(--button-destructive-shadow-hover,var(--button-shadow-hover,var(--button-destructive-shadow,var(--button-shadow,none))))]",
|
|
245
|
-
"focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
246
|
-
"dark:bg-destructive/60"
|
|
247
|
-
].join(" "),
|
|
248
|
-
// Outline variant - full customization with proper border handling
|
|
249
|
-
outline: [
|
|
250
|
-
"bg-[var(--button-outline-bg,hsl(var(--background)))]",
|
|
251
|
-
"text-[var(--button-outline-fg,inherit)]",
|
|
252
|
-
"border-[length:var(--button-outline-border-width,1px)]",
|
|
253
|
-
"border-[color:var(--button-outline-border,hsl(var(--border)))]",
|
|
254
|
-
"[box-shadow:var(--button-outline-shadow,var(--button-shadow,0_1px_2px_0_rgb(0_0_0/0.05)))]",
|
|
255
|
-
"hover:bg-[var(--button-outline-hover-bg,hsl(var(--accent)))]",
|
|
256
|
-
"hover:text-[var(--button-outline-hover-fg,hsl(var(--accent-foreground)))]",
|
|
257
|
-
"hover:border-[color:var(--button-outline-hover-border,var(--button-outline-border,hsl(var(--border))))]",
|
|
258
|
-
"hover:[box-shadow:var(--button-outline-shadow-hover,var(--button-shadow-hover,var(--button-outline-shadow,var(--button-shadow,none))))]",
|
|
259
|
-
"dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
|
|
260
|
-
].join(" "),
|
|
261
|
-
// Secondary variant - full customization
|
|
262
|
-
secondary: [
|
|
263
|
-
"bg-[var(--button-secondary-bg,hsl(var(--secondary)))]",
|
|
264
|
-
"text-[var(--button-secondary-fg,hsl(var(--secondary-foreground)))]",
|
|
265
|
-
"border-[length:var(--button-secondary-border-width,0px)]",
|
|
266
|
-
"border-[color:var(--button-secondary-border,transparent)]",
|
|
267
|
-
"[box-shadow:var(--button-secondary-shadow,var(--button-shadow,none))]",
|
|
268
|
-
"hover:bg-[var(--button-secondary-hover-bg,hsl(var(--secondary)/0.8))]",
|
|
269
|
-
"hover:text-[var(--button-secondary-hover-fg,var(--button-secondary-fg,hsl(var(--secondary-foreground))))]",
|
|
270
|
-
"hover:border-[color:var(--button-secondary-hover-border,var(--button-secondary-border,transparent))]",
|
|
271
|
-
"hover:[box-shadow:var(--button-secondary-shadow-hover,var(--button-shadow-hover,var(--button-secondary-shadow,var(--button-shadow,none))))]"
|
|
272
|
-
].join(" "),
|
|
273
|
-
// Ghost variant - full customization
|
|
274
|
-
ghost: [
|
|
275
|
-
"bg-[var(--button-ghost-bg,transparent)]",
|
|
276
|
-
"text-[var(--button-ghost-fg,inherit)]",
|
|
277
|
-
"border-[length:var(--button-ghost-border-width,0px)]",
|
|
278
|
-
"border-[color:var(--button-ghost-border,transparent)]",
|
|
279
|
-
"[box-shadow:var(--button-ghost-shadow,var(--button-shadow,none))]",
|
|
280
|
-
"hover:bg-[var(--button-ghost-hover-bg,hsl(var(--accent)))]",
|
|
281
|
-
"hover:text-[var(--button-ghost-hover-fg,hsl(var(--accent-foreground)))]",
|
|
282
|
-
"hover:border-[color:var(--button-ghost-hover-border,var(--button-ghost-border,transparent))]",
|
|
283
|
-
"hover:[box-shadow:var(--button-ghost-shadow-hover,var(--button-shadow-hover,var(--button-ghost-shadow,var(--button-shadow,none))))]",
|
|
284
|
-
"dark:hover:bg-accent/50"
|
|
285
|
-
].join(" "),
|
|
286
|
-
// Link variant - full customization
|
|
287
|
-
link: [
|
|
288
|
-
"bg-[var(--button-link-bg,transparent)]",
|
|
289
|
-
"text-[var(--button-link-fg,hsl(var(--primary)))]",
|
|
290
|
-
"border-[length:var(--button-link-border-width,0px)]",
|
|
291
|
-
"border-[color:var(--button-link-border,transparent)]",
|
|
292
|
-
"[box-shadow:var(--button-link-shadow,none)]",
|
|
293
|
-
"hover:bg-[var(--button-link-hover-bg,transparent)]",
|
|
294
|
-
"hover:text-[var(--button-link-hover-fg,var(--button-link-fg,hsl(var(--primary))))]",
|
|
295
|
-
"hover:[box-shadow:var(--button-link-shadow-hover,none)]",
|
|
296
|
-
"underline-offset-4 hover:underline"
|
|
297
|
-
].join(" ")
|
|
298
|
-
},
|
|
299
|
-
size: {
|
|
300
|
-
default: [
|
|
301
|
-
"h-[var(--button-height-md,2.25rem)]",
|
|
302
|
-
"px-[var(--button-padding-x-md,1rem)]",
|
|
303
|
-
"py-[var(--button-padding-y-md,0.5rem)]",
|
|
304
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
|
|
305
|
-
].join(" "),
|
|
306
|
-
sm: [
|
|
307
|
-
"h-[var(--button-height-sm,2rem)]",
|
|
308
|
-
"px-[var(--button-padding-x-sm,0.75rem)]",
|
|
309
|
-
"py-[var(--button-padding-y-sm,0.25rem)]",
|
|
310
|
-
"gap-1.5",
|
|
311
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-sm,0.75rem)*0.83)]"
|
|
312
|
-
].join(" "),
|
|
313
|
-
md: [
|
|
314
|
-
"h-[var(--button-height-md,2.25rem)]",
|
|
315
|
-
"px-[var(--button-padding-x-md,1rem)]",
|
|
316
|
-
"py-[var(--button-padding-y-md,0.5rem)]",
|
|
317
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
|
|
318
|
-
].join(" "),
|
|
319
|
-
lg: [
|
|
320
|
-
"h-[var(--button-height-lg,2.5rem)]",
|
|
321
|
-
"px-[var(--button-padding-x-lg,1.5rem)]",
|
|
322
|
-
"py-[var(--button-padding-y-lg,0.5rem)]",
|
|
323
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-lg,1.5rem)*0.67)]"
|
|
324
|
-
].join(" "),
|
|
325
|
-
icon: "size-[var(--button-height-md,2.25rem)]",
|
|
326
|
-
"icon-sm": "size-[var(--button-height-sm,2rem)]",
|
|
327
|
-
"icon-lg": "size-[var(--button-height-lg,2.5rem)]"
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
defaultVariants: {
|
|
331
|
-
variant: "default",
|
|
332
|
-
size: "default"
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
var Pressable = React.forwardRef(
|
|
336
|
-
({
|
|
337
|
-
children,
|
|
338
|
-
className,
|
|
339
|
-
href,
|
|
340
|
-
onClick,
|
|
341
|
-
variant,
|
|
342
|
-
size,
|
|
343
|
-
asButton = false,
|
|
344
|
-
fallbackComponentType = "span",
|
|
345
|
-
componentType,
|
|
346
|
-
"aria-label": ariaLabel,
|
|
347
|
-
"aria-describedby": ariaDescribedby,
|
|
348
|
-
id,
|
|
349
|
-
...props
|
|
350
|
-
}, ref) => {
|
|
351
|
-
const navigation = useNavigation({ href, onClick });
|
|
352
|
-
const {
|
|
353
|
-
normalizedHref,
|
|
354
|
-
target,
|
|
355
|
-
rel,
|
|
356
|
-
linkType,
|
|
357
|
-
isInternal,
|
|
358
|
-
handleClick
|
|
359
|
-
} = navigation;
|
|
360
|
-
const shouldRenderLink = normalizedHref && linkType !== "none";
|
|
361
|
-
const shouldRenderButton = !shouldRenderLink && onClick;
|
|
362
|
-
const effectiveComponentType = componentType || (shouldRenderLink ? "a" : shouldRenderButton ? "button" : fallbackComponentType);
|
|
363
|
-
const finalComponentType = isInternal && shouldRenderLink ? "a" : effectiveComponentType;
|
|
364
|
-
const shouldApplyButtonStyles = asButton || variant || size;
|
|
365
|
-
const combinedClassName = cn(
|
|
366
|
-
shouldApplyButtonStyles && buttonVariants({ variant, size }),
|
|
367
|
-
className
|
|
368
|
-
);
|
|
369
|
-
const dataProps = Object.fromEntries(
|
|
370
|
-
Object.entries(props).filter(([key]) => key.startsWith("data-"))
|
|
371
|
-
);
|
|
372
|
-
const buttonDataAttributes = shouldApplyButtonStyles ? {
|
|
373
|
-
"data-slot": "button",
|
|
374
|
-
"data-variant": variant ?? "default",
|
|
375
|
-
"data-size": size ?? "default"
|
|
376
|
-
} : {};
|
|
377
|
-
const commonProps = {
|
|
378
|
-
className: combinedClassName,
|
|
379
|
-
onClick: handleClick,
|
|
380
|
-
"aria-label": ariaLabel,
|
|
381
|
-
"aria-describedby": ariaDescribedby,
|
|
382
|
-
id,
|
|
383
|
-
...dataProps,
|
|
384
|
-
...buttonDataAttributes
|
|
385
|
-
};
|
|
386
|
-
if (finalComponentType === "a" && shouldRenderLink) {
|
|
387
|
-
return /* @__PURE__ */ jsx(
|
|
388
|
-
"a",
|
|
389
|
-
{
|
|
390
|
-
ref,
|
|
391
|
-
href: normalizedHref,
|
|
392
|
-
target,
|
|
393
|
-
rel,
|
|
394
|
-
...commonProps,
|
|
395
|
-
...props,
|
|
396
|
-
children
|
|
397
|
-
}
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
if (finalComponentType === "button") {
|
|
401
|
-
return /* @__PURE__ */ jsx(
|
|
402
|
-
"button",
|
|
403
|
-
{
|
|
404
|
-
ref,
|
|
405
|
-
type: props.type || "button",
|
|
406
|
-
...commonProps,
|
|
407
|
-
...props,
|
|
408
|
-
children
|
|
409
|
-
}
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
if (finalComponentType === "div") {
|
|
413
|
-
return /* @__PURE__ */ jsx(
|
|
414
|
-
"div",
|
|
415
|
-
{
|
|
416
|
-
ref,
|
|
417
|
-
...commonProps,
|
|
418
|
-
children
|
|
419
|
-
}
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
return /* @__PURE__ */ jsx(
|
|
423
|
-
"span",
|
|
424
|
-
{
|
|
425
|
-
ref,
|
|
426
|
-
...commonProps,
|
|
427
|
-
children
|
|
428
|
-
}
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
);
|
|
432
|
-
Pressable.displayName = "Pressable";
|
|
433
12
|
function Card({ className, ...props }) {
|
|
434
13
|
return /* @__PURE__ */ jsx(
|
|
435
14
|
"div",
|
|
@@ -462,7 +41,7 @@ var maxWidthStyles = {
|
|
|
462
41
|
"4xl": "max-w-[1536px]",
|
|
463
42
|
full: "max-w-full"
|
|
464
43
|
};
|
|
465
|
-
var Container =
|
|
44
|
+
var Container = React.forwardRef(
|
|
466
45
|
({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
|
|
467
46
|
const Component = as;
|
|
468
47
|
return /* @__PURE__ */ jsx(
|
|
@@ -767,7 +346,7 @@ var spacingStyles = {
|
|
|
767
346
|
};
|
|
768
347
|
var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
|
|
769
348
|
var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
|
|
770
|
-
var Section =
|
|
349
|
+
var Section = React.forwardRef(
|
|
771
350
|
({
|
|
772
351
|
id,
|
|
773
352
|
title,
|
|
@@ -908,48 +487,6 @@ function ContactVendor({
|
|
|
908
487
|
removeFile,
|
|
909
488
|
resetUpload
|
|
910
489
|
} = useFileUpload({ onError });
|
|
911
|
-
const { form, submissionError, formMethod, resetSubmissionState } = useContactForm({
|
|
912
|
-
formFields,
|
|
913
|
-
formConfig,
|
|
914
|
-
onSubmit,
|
|
915
|
-
onSuccess: (data) => {
|
|
916
|
-
resetUpload();
|
|
917
|
-
onSuccess?.(data);
|
|
918
|
-
},
|
|
919
|
-
onError,
|
|
920
|
-
resetOnSuccess: formConfig?.resetOnSuccess !== false,
|
|
921
|
-
uploadTokens
|
|
922
|
-
});
|
|
923
|
-
const actionsContent = useMemo(() => {
|
|
924
|
-
if (actionsSlot) return actionsSlot;
|
|
925
|
-
if (actions && actions.length > 0) {
|
|
926
|
-
return actions.map((action, index) => {
|
|
927
|
-
const {
|
|
928
|
-
label,
|
|
929
|
-
icon,
|
|
930
|
-
iconAfter,
|
|
931
|
-
children,
|
|
932
|
-
className: actionClassName,
|
|
933
|
-
...pressableProps
|
|
934
|
-
} = action;
|
|
935
|
-
return /* @__PURE__ */ jsx(
|
|
936
|
-
Pressable,
|
|
937
|
-
{
|
|
938
|
-
asButton: true,
|
|
939
|
-
className: actionClassName,
|
|
940
|
-
...pressableProps,
|
|
941
|
-
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
942
|
-
icon,
|
|
943
|
-
label,
|
|
944
|
-
iconAfter
|
|
945
|
-
] })
|
|
946
|
-
},
|
|
947
|
-
index
|
|
948
|
-
);
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
return null;
|
|
952
|
-
}, [actionsSlot, actions]);
|
|
953
490
|
return /* @__PURE__ */ jsx(
|
|
954
491
|
Section,
|
|
955
492
|
{
|
|
@@ -982,62 +519,38 @@ function ContactVendor({
|
|
|
982
519
|
}
|
|
983
520
|
) : /* @__PURE__ */ jsx("div", { className: descriptionClassName, children: description }))
|
|
984
521
|
] }),
|
|
985
|
-
/* @__PURE__ */ jsx(Card, { className: cn("mx-auto max-w-xl", cardClassName), children: /* @__PURE__ */ jsx(CardContent, { className: cn("p-6 lg:p-8", cardContentClassName), children: /* @__PURE__ */
|
|
986
|
-
|
|
522
|
+
/* @__PURE__ */ jsx(Card, { className: cn("mx-auto max-w-xl", cardClassName), children: /* @__PURE__ */ jsx(CardContent, { className: cn("p-6 lg:p-8", cardContentClassName), children: /* @__PURE__ */ jsx(
|
|
523
|
+
FormEngine,
|
|
987
524
|
{
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
525
|
+
api: formConfig,
|
|
526
|
+
fields: formFields,
|
|
527
|
+
formLayoutSettings: {
|
|
528
|
+
formLayout: "standard",
|
|
529
|
+
submitButtonSetup: {
|
|
530
|
+
submitLabel: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
531
|
+
buttonIcon,
|
|
532
|
+
buttonText
|
|
533
|
+
] })
|
|
534
|
+
},
|
|
535
|
+
styleRules: {
|
|
536
|
+
formClassName: cn("space-y-4", formClassName),
|
|
537
|
+
successMessageClassName,
|
|
538
|
+
errorMessageClassName
|
|
539
|
+
}
|
|
1002
540
|
},
|
|
1003
|
-
|
|
541
|
+
successMessage,
|
|
542
|
+
onSubmit,
|
|
543
|
+
onSuccess: (data) => {
|
|
1004
544
|
resetUpload();
|
|
1005
|
-
|
|
545
|
+
onSuccess?.(data);
|
|
1006
546
|
},
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
{
|
|
1015
|
-
field,
|
|
1016
|
-
uploadProgress,
|
|
1017
|
-
onFileUpload: uploadFiles,
|
|
1018
|
-
onFileRemove: removeFile,
|
|
1019
|
-
isUploading
|
|
1020
|
-
}
|
|
1021
|
-
)
|
|
1022
|
-
},
|
|
1023
|
-
field.name
|
|
1024
|
-
)) }),
|
|
1025
|
-
actionsSlot || actions && actions.length > 0 ? actionsContent : /* @__PURE__ */ jsxs(
|
|
1026
|
-
Pressable,
|
|
1027
|
-
{
|
|
1028
|
-
componentType: "button",
|
|
1029
|
-
type: "submit",
|
|
1030
|
-
className: cn("w-full", submitClassName),
|
|
1031
|
-
size: "lg",
|
|
1032
|
-
asButton: true,
|
|
1033
|
-
disabled: form.isSubmitting,
|
|
1034
|
-
children: [
|
|
1035
|
-
buttonIcon,
|
|
1036
|
-
buttonText
|
|
1037
|
-
]
|
|
1038
|
-
}
|
|
1039
|
-
)
|
|
1040
|
-
]
|
|
547
|
+
onError,
|
|
548
|
+
resetOnSuccess: formConfig?.resetOnSuccess !== false,
|
|
549
|
+
uploadTokens,
|
|
550
|
+
uploadProgress,
|
|
551
|
+
onFileUpload: uploadFiles,
|
|
552
|
+
onFileRemove: removeFile,
|
|
553
|
+
isUploading
|
|
1041
554
|
}
|
|
1042
555
|
) }) })
|
|
1043
556
|
] })
|