@opensite/ui 2.2.3 → 2.2.5
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/about-culture-tabs.cjs +83 -17
- package/dist/about-culture-tabs.js +83 -17
- package/dist/components.cjs +83 -17
- package/dist/components.js +83 -17
- package/dist/contact-callback.cjs +38 -552
- package/dist/contact-callback.d.cts +6 -74
- package/dist/contact-callback.d.ts +6 -74
- package/dist/contact-callback.js +36 -535
- package/dist/contact-careers.cjs +19 -555
- package/dist/contact-careers.d.cts +6 -62
- package/dist/contact-careers.d.ts +6 -62
- package/dist/contact-careers.js +18 -539
- package/dist/contact-catering.cjs +19 -531
- package/dist/contact-catering.d.cts +6 -61
- package/dist/contact-catering.d.ts +6 -61
- package/dist/contact-catering.js +18 -515
- package/dist/contact-consultation.cjs +87 -543
- package/dist/contact-consultation.d.cts +6 -61
- package/dist/contact-consultation.d.ts +6 -61
- package/dist/contact-consultation.js +88 -544
- package/dist/contact-demo.cjs +20 -563
- package/dist/contact-demo.d.cts +10 -50
- package/dist/contact-demo.d.ts +10 -50
- package/dist/contact-demo.js +19 -547
- package/dist/contact-emergency.cjs +1 -1
- package/dist/contact-emergency.js +1 -1
- package/dist/contact-event.cjs +19 -562
- package/dist/contact-event.d.cts +10 -50
- package/dist/contact-event.d.ts +10 -50
- package/dist/contact-event.js +19 -547
- package/dist/contact-feedback.cjs +19 -562
- package/dist/contact-feedback.d.cts +10 -50
- package/dist/contact-feedback.d.ts +10 -50
- package/dist/contact-feedback.js +19 -547
- package/dist/contact-fitness.cjs +19 -562
- package/dist/contact-fitness.d.cts +10 -50
- package/dist/contact-fitness.d.ts +10 -50
- package/dist/contact-fitness.js +19 -547
- package/dist/contact-guest.cjs +19 -562
- package/dist/contact-guest.d.cts +10 -50
- package/dist/contact-guest.d.ts +10 -50
- package/dist/contact-guest.js +19 -547
- package/dist/contact-insurance.cjs +19 -562
- package/dist/contact-insurance.d.cts +10 -50
- package/dist/contact-insurance.d.ts +10 -50
- package/dist/contact-insurance.js +19 -547
- package/dist/contact-interview.cjs +19 -562
- package/dist/contact-interview.d.cts +11 -51
- package/dist/contact-interview.d.ts +11 -51
- package/dist/contact-interview.js +19 -547
- package/dist/contact-locations.cjs +19 -562
- package/dist/contact-locations.d.cts +11 -51
- package/dist/contact-locations.d.ts +11 -51
- package/dist/contact-locations.js +19 -547
- package/dist/contact-maintenance.cjs +19 -562
- package/dist/contact-maintenance.d.cts +10 -50
- package/dist/contact-maintenance.d.ts +10 -50
- package/dist/contact-maintenance.js +19 -547
- package/dist/contact-map.cjs +19 -562
- package/dist/contact-map.d.cts +11 -51
- package/dist/contact-map.d.ts +11 -51
- package/dist/contact-map.js +19 -547
- package/dist/contact-minimal.cjs +19 -562
- package/dist/contact-minimal.d.cts +10 -50
- package/dist/contact-minimal.d.ts +10 -50
- package/dist/contact-minimal.js +19 -547
- package/dist/contact-moving.cjs +19 -562
- package/dist/contact-moving.d.cts +11 -51
- package/dist/contact-moving.d.ts +11 -51
- package/dist/contact-moving.js +19 -547
- package/dist/contact-multistep.cjs +19 -562
- package/dist/contact-multistep.d.cts +11 -51
- package/dist/contact-multistep.d.ts +11 -51
- package/dist/contact-multistep.js +19 -547
- package/dist/contact-partnership.cjs +22 -565
- package/dist/contact-partnership.d.cts +10 -50
- package/dist/contact-partnership.d.ts +10 -50
- package/dist/contact-partnership.js +22 -550
- package/dist/contact-photography.cjs +19 -562
- package/dist/contact-photography.d.cts +7 -50
- package/dist/contact-photography.d.ts +7 -50
- package/dist/contact-photography.js +18 -546
- package/dist/contact-press.cjs +19 -562
- package/dist/contact-press.d.cts +10 -50
- package/dist/contact-press.d.ts +10 -50
- package/dist/contact-press.js +19 -547
- package/dist/contact-quote.cjs +19 -562
- package/dist/contact-quote.d.cts +11 -51
- package/dist/contact-quote.d.ts +11 -51
- package/dist/contact-quote.js +19 -547
- package/dist/contact-referral.cjs +19 -562
- package/dist/contact-referral.d.cts +10 -50
- package/dist/contact-referral.d.ts +10 -50
- package/dist/contact-referral.js +19 -547
- package/dist/contact-report.cjs +19 -562
- package/dist/contact-report.d.cts +10 -50
- package/dist/contact-report.d.ts +10 -50
- package/dist/contact-report.js +19 -547
- package/dist/contact-reservation.cjs +19 -562
- package/dist/contact-reservation.d.cts +10 -50
- package/dist/contact-reservation.d.ts +10 -50
- package/dist/contact-reservation.js +19 -547
- package/dist/contact-retreat.cjs +88 -567
- package/dist/contact-retreat.d.cts +11 -51
- package/dist/contact-retreat.d.ts +11 -51
- package/dist/contact-retreat.js +90 -569
- package/dist/contact-rsvp.cjs +19 -562
- package/dist/contact-rsvp.d.cts +11 -51
- package/dist/contact-rsvp.d.ts +11 -51
- package/dist/contact-rsvp.js +19 -547
- package/dist/contact-sales.cjs +19 -562
- package/dist/contact-sales.d.cts +10 -50
- package/dist/contact-sales.d.ts +10 -50
- package/dist/contact-sales.js +19 -547
- package/dist/contact-schedule.cjs +19 -562
- package/dist/contact-schedule.d.cts +11 -51
- package/dist/contact-schedule.d.ts +11 -51
- package/dist/contact-schedule.js +19 -547
- package/dist/contact-sponsorship.cjs +19 -562
- package/dist/contact-sponsorship.d.cts +11 -51
- package/dist/contact-sponsorship.d.ts +11 -51
- package/dist/contact-sponsorship.js +19 -547
- package/dist/contact-support.cjs +19 -562
- package/dist/contact-support.d.cts +11 -51
- package/dist/contact-support.d.ts +11 -51
- package/dist/contact-support.js +19 -547
- package/dist/contact-tenant.cjs +19 -562
- package/dist/contact-tenant.d.cts +11 -51
- package/dist/contact-tenant.d.ts +11 -51
- package/dist/contact-tenant.js +19 -547
- package/dist/contact-volunteer.cjs +19 -562
- package/dist/contact-volunteer.d.cts +11 -51
- package/dist/contact-volunteer.d.ts +11 -51
- package/dist/contact-volunteer.js +19 -547
- package/dist/contact-warranty.cjs +19 -562
- package/dist/contact-warranty.d.cts +10 -50
- package/dist/contact-warranty.d.ts +10 -50
- package/dist/contact-warranty.js +19 -547
- package/dist/contact-wedding.cjs +19 -562
- package/dist/contact-wedding.d.cts +10 -50
- package/dist/contact-wedding.d.ts +10 -50
- package/dist/contact-wedding.js +19 -547
- package/dist/hero-presentation-platform-video.cjs +76 -27
- package/dist/hero-presentation-platform-video.js +76 -27
- package/dist/index.cjs +83 -17
- package/dist/index.js +83 -17
- package/dist/registry.cjs +768 -4196
- package/dist/registry.js +769 -4197
- package/package.json +12 -2
package/dist/contact-demo.js
CHANGED
|
@@ -1,436 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import React__default, { useMemo, useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { Form } from '@page-speed/forms';
|
|
5
|
-
import { useFileUpload, useContactForm, getColumnSpanClass, DynamicFormField } from '@page-speed/forms/integration';
|
|
2
|
+
import { FormEngine } from '@page-speed/forms/integration';
|
|
6
3
|
import { clsx } from 'clsx';
|
|
7
4
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import {
|
|
9
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import React, { useMemo, useState, useRef, useEffect } from 'react';
|
|
10
6
|
import { motion } from 'framer-motion';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
8
|
|
|
12
9
|
// components/blocks/contact/contact-demo.tsx
|
|
13
10
|
function cn(...inputs) {
|
|
14
11
|
return twMerge(clsx(inputs));
|
|
15
12
|
}
|
|
16
|
-
function normalizePhoneNumber(input) {
|
|
17
|
-
const trimmed = input.trim();
|
|
18
|
-
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
19
|
-
return trimmed;
|
|
20
|
-
}
|
|
21
|
-
const match = trimmed.match(/^[\s\+\-\(\)]*(\d[\d\s\-\(\)\.]*\d)[\s\-]*(x|ext\.?|extension)?[\s\-]*(\d+)?$/i);
|
|
22
|
-
if (match) {
|
|
23
|
-
const mainNumber = match[1].replace(/[\s\-\(\)\.]/g, "");
|
|
24
|
-
const extension = match[3];
|
|
25
|
-
const normalized = mainNumber.length >= 10 && !trimmed.startsWith("+") ? `+${mainNumber}` : mainNumber;
|
|
26
|
-
const withExtension = extension ? `${normalized};ext=${extension}` : normalized;
|
|
27
|
-
return `tel:${withExtension}`;
|
|
28
|
-
}
|
|
29
|
-
const cleaned = trimmed.replace(/[\s\-\(\)\.]/g, "");
|
|
30
|
-
return `tel:${cleaned}`;
|
|
31
|
-
}
|
|
32
|
-
function normalizeEmail(input) {
|
|
33
|
-
const trimmed = input.trim();
|
|
34
|
-
if (trimmed.toLowerCase().startsWith("mailto:")) {
|
|
35
|
-
return trimmed;
|
|
36
|
-
}
|
|
37
|
-
return `mailto:${trimmed}`;
|
|
38
|
-
}
|
|
39
|
-
function isEmail(input) {
|
|
40
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
41
|
-
return emailRegex.test(input.trim());
|
|
42
|
-
}
|
|
43
|
-
function isPhoneNumber(input) {
|
|
44
|
-
const trimmed = input.trim();
|
|
45
|
-
if (trimmed.toLowerCase().startsWith("tel:")) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
const phoneRegex = /^[\s\+\-\(\)]*\d[\d\s\-\(\)\.]*\d[\s\-]*(x|ext\.?|extension)?[\s\-]*\d*$/i;
|
|
49
|
-
return phoneRegex.test(trimmed);
|
|
50
|
-
}
|
|
51
|
-
function isInternalUrl(href) {
|
|
52
|
-
if (typeof window === "undefined") {
|
|
53
|
-
return href.startsWith("/") && !href.startsWith("//");
|
|
54
|
-
}
|
|
55
|
-
const trimmed = href.trim();
|
|
56
|
-
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
const url = new URL(trimmed, window.location.href);
|
|
61
|
-
const currentOrigin = window.location.origin;
|
|
62
|
-
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
63
|
-
return normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin);
|
|
64
|
-
} catch {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function toRelativePath(href) {
|
|
69
|
-
if (typeof window === "undefined") {
|
|
70
|
-
return href;
|
|
71
|
-
}
|
|
72
|
-
const trimmed = href.trim();
|
|
73
|
-
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
74
|
-
return trimmed;
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
const url = new URL(trimmed, window.location.href);
|
|
78
|
-
const currentOrigin = window.location.origin;
|
|
79
|
-
const normalizeOrigin = (origin) => origin.replace(/^(https?:\/\/)(www\.)?/, "$1");
|
|
80
|
-
if (normalizeOrigin(url.origin) === normalizeOrigin(currentOrigin)) {
|
|
81
|
-
return url.pathname + url.search + url.hash;
|
|
82
|
-
}
|
|
83
|
-
} catch {
|
|
84
|
-
}
|
|
85
|
-
return trimmed;
|
|
86
|
-
}
|
|
87
|
-
function useNavigation({
|
|
88
|
-
href,
|
|
89
|
-
onClick
|
|
90
|
-
} = {}) {
|
|
91
|
-
const linkType = React.useMemo(() => {
|
|
92
|
-
if (!href || href.trim() === "") {
|
|
93
|
-
return onClick ? "none" : "none";
|
|
94
|
-
}
|
|
95
|
-
const trimmed = href.trim();
|
|
96
|
-
if (trimmed.toLowerCase().startsWith("mailto:") || isEmail(trimmed)) {
|
|
97
|
-
return "mailto";
|
|
98
|
-
}
|
|
99
|
-
if (trimmed.toLowerCase().startsWith("tel:") || isPhoneNumber(trimmed)) {
|
|
100
|
-
return "tel";
|
|
101
|
-
}
|
|
102
|
-
if (isInternalUrl(trimmed)) {
|
|
103
|
-
return "internal";
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
new URL(trimmed, typeof window !== "undefined" ? window.location.href : "http://localhost");
|
|
107
|
-
return "external";
|
|
108
|
-
} catch {
|
|
109
|
-
return "internal";
|
|
110
|
-
}
|
|
111
|
-
}, [href, onClick]);
|
|
112
|
-
const normalizedHref = React.useMemo(() => {
|
|
113
|
-
if (!href || href.trim() === "") {
|
|
114
|
-
return void 0;
|
|
115
|
-
}
|
|
116
|
-
const trimmed = href.trim();
|
|
117
|
-
switch (linkType) {
|
|
118
|
-
case "tel":
|
|
119
|
-
return normalizePhoneNumber(trimmed);
|
|
120
|
-
case "mailto":
|
|
121
|
-
return normalizeEmail(trimmed);
|
|
122
|
-
case "internal":
|
|
123
|
-
return toRelativePath(trimmed);
|
|
124
|
-
case "external":
|
|
125
|
-
return trimmed;
|
|
126
|
-
default:
|
|
127
|
-
return trimmed;
|
|
128
|
-
}
|
|
129
|
-
}, [href, linkType]);
|
|
130
|
-
const target = React.useMemo(() => {
|
|
131
|
-
switch (linkType) {
|
|
132
|
-
case "external":
|
|
133
|
-
return "_blank";
|
|
134
|
-
case "internal":
|
|
135
|
-
return "_self";
|
|
136
|
-
case "mailto":
|
|
137
|
-
case "tel":
|
|
138
|
-
return void 0;
|
|
139
|
-
default:
|
|
140
|
-
return void 0;
|
|
141
|
-
}
|
|
142
|
-
}, [linkType]);
|
|
143
|
-
const rel = React.useMemo(() => {
|
|
144
|
-
if (linkType === "external") {
|
|
145
|
-
return "noopener noreferrer";
|
|
146
|
-
}
|
|
147
|
-
return void 0;
|
|
148
|
-
}, [linkType]);
|
|
149
|
-
const isExternal = linkType === "external";
|
|
150
|
-
const isInternal = linkType === "internal";
|
|
151
|
-
const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
|
|
152
|
-
const handleClick = React.useCallback(
|
|
153
|
-
(event) => {
|
|
154
|
-
if (onClick) {
|
|
155
|
-
try {
|
|
156
|
-
onClick(event);
|
|
157
|
-
} catch (error) {
|
|
158
|
-
console.error("Error in user onClick handler:", error);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (event.defaultPrevented) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (shouldUseRouter && normalizedHref && event.button === 0 && // left-click only
|
|
165
|
-
!event.metaKey && !event.altKey && !event.ctrlKey && !event.shiftKey) {
|
|
166
|
-
if (typeof window !== "undefined") {
|
|
167
|
-
const handler = window.__opensiteNavigationHandler;
|
|
168
|
-
if (typeof handler === "function") {
|
|
169
|
-
try {
|
|
170
|
-
const handled = handler(normalizedHref, event.nativeEvent || event);
|
|
171
|
-
if (handled !== false) {
|
|
172
|
-
event.preventDefault();
|
|
173
|
-
}
|
|
174
|
-
} catch (error) {
|
|
175
|
-
console.error("Error in navigation handler:", error);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
[onClick, shouldUseRouter, normalizedHref]
|
|
182
|
-
);
|
|
183
|
-
return {
|
|
184
|
-
linkType,
|
|
185
|
-
normalizedHref,
|
|
186
|
-
target,
|
|
187
|
-
rel,
|
|
188
|
-
isExternal,
|
|
189
|
-
isInternal,
|
|
190
|
-
shouldUseRouter,
|
|
191
|
-
handleClick
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
var baseStyles = [
|
|
195
|
-
// Layout
|
|
196
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap shrink-0",
|
|
197
|
-
// Typography - using CSS variables with sensible defaults
|
|
198
|
-
"font-[var(--button-font-family,inherit)]",
|
|
199
|
-
"font-[var(--button-font-weight,500)]",
|
|
200
|
-
"tracking-[var(--button-letter-spacing,0)]",
|
|
201
|
-
"leading-[var(--button-line-height,1.25)]",
|
|
202
|
-
"[text-transform:var(--button-text-transform,none)]",
|
|
203
|
-
"text-sm",
|
|
204
|
-
// Border radius
|
|
205
|
-
"rounded-[var(--button-radius,var(--radius,0.375rem))]",
|
|
206
|
-
// Smooth transition - using [transition:...] to set full shorthand property (not just transition-property)
|
|
207
|
-
"[transition:var(--button-transition,all_250ms_cubic-bezier(0.4,0,0.2,1))]",
|
|
208
|
-
// Box shadow (master level) - using [box-shadow:...] for complex multi-value shadows
|
|
209
|
-
"[box-shadow:var(--button-shadow,none)]",
|
|
210
|
-
"hover:[box-shadow:var(--button-shadow-hover,var(--button-shadow,none))]",
|
|
211
|
-
// Disabled state
|
|
212
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
213
|
-
// SVG handling
|
|
214
|
-
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
|
|
215
|
-
// Focus styles
|
|
216
|
-
"outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
217
|
-
// Invalid state
|
|
218
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
|
|
219
|
-
].join(" ");
|
|
220
|
-
var buttonVariants = cva(baseStyles, {
|
|
221
|
-
variants: {
|
|
222
|
-
variant: {
|
|
223
|
-
// Default (Primary) variant - full customization
|
|
224
|
-
default: [
|
|
225
|
-
"bg-[var(--button-default-bg,hsl(var(--primary)))]",
|
|
226
|
-
"text-[var(--button-default-fg,hsl(var(--primary-foreground)))]",
|
|
227
|
-
"border-[length:var(--button-default-border-width,0px)]",
|
|
228
|
-
"border-[color:var(--button-default-border,transparent)]",
|
|
229
|
-
"[box-shadow:var(--button-default-shadow,var(--button-shadow,none))]",
|
|
230
|
-
"hover:bg-[var(--button-default-hover-bg,hsl(var(--primary)/0.9))]",
|
|
231
|
-
"hover:text-[var(--button-default-hover-fg,var(--button-default-fg,hsl(var(--primary-foreground))))]",
|
|
232
|
-
"hover:border-[color:var(--button-default-hover-border,var(--button-default-border,transparent))]",
|
|
233
|
-
"hover:[box-shadow:var(--button-default-shadow-hover,var(--button-shadow-hover,var(--button-default-shadow,var(--button-shadow,none))))]"
|
|
234
|
-
].join(" "),
|
|
235
|
-
// Destructive variant - full customization
|
|
236
|
-
destructive: [
|
|
237
|
-
"bg-[var(--button-destructive-bg,hsl(var(--destructive)))]",
|
|
238
|
-
"text-[var(--button-destructive-fg,white)]",
|
|
239
|
-
"border-[length:var(--button-destructive-border-width,0px)]",
|
|
240
|
-
"border-[color:var(--button-destructive-border,transparent)]",
|
|
241
|
-
"[box-shadow:var(--button-destructive-shadow,var(--button-shadow,none))]",
|
|
242
|
-
"hover:bg-[var(--button-destructive-hover-bg,hsl(var(--destructive)/0.9))]",
|
|
243
|
-
"hover:text-[var(--button-destructive-hover-fg,var(--button-destructive-fg,white))]",
|
|
244
|
-
"hover:border-[color:var(--button-destructive-hover-border,var(--button-destructive-border,transparent))]",
|
|
245
|
-
"hover:[box-shadow:var(--button-destructive-shadow-hover,var(--button-shadow-hover,var(--button-destructive-shadow,var(--button-shadow,none))))]",
|
|
246
|
-
"focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
247
|
-
"dark:bg-destructive/60"
|
|
248
|
-
].join(" "),
|
|
249
|
-
// Outline variant - full customization with proper border handling
|
|
250
|
-
outline: [
|
|
251
|
-
"bg-[var(--button-outline-bg,hsl(var(--background)))]",
|
|
252
|
-
"text-[var(--button-outline-fg,inherit)]",
|
|
253
|
-
"border-[length:var(--button-outline-border-width,1px)]",
|
|
254
|
-
"border-[color:var(--button-outline-border,hsl(var(--border)))]",
|
|
255
|
-
"[box-shadow:var(--button-outline-shadow,var(--button-shadow,0_1px_2px_0_rgb(0_0_0/0.05)))]",
|
|
256
|
-
"hover:bg-[var(--button-outline-hover-bg,hsl(var(--accent)))]",
|
|
257
|
-
"hover:text-[var(--button-outline-hover-fg,hsl(var(--accent-foreground)))]",
|
|
258
|
-
"hover:border-[color:var(--button-outline-hover-border,var(--button-outline-border,hsl(var(--border))))]",
|
|
259
|
-
"hover:[box-shadow:var(--button-outline-shadow-hover,var(--button-shadow-hover,var(--button-outline-shadow,var(--button-shadow,none))))]",
|
|
260
|
-
"dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
|
|
261
|
-
].join(" "),
|
|
262
|
-
// Secondary variant - full customization
|
|
263
|
-
secondary: [
|
|
264
|
-
"bg-[var(--button-secondary-bg,hsl(var(--secondary)))]",
|
|
265
|
-
"text-[var(--button-secondary-fg,hsl(var(--secondary-foreground)))]",
|
|
266
|
-
"border-[length:var(--button-secondary-border-width,0px)]",
|
|
267
|
-
"border-[color:var(--button-secondary-border,transparent)]",
|
|
268
|
-
"[box-shadow:var(--button-secondary-shadow,var(--button-shadow,none))]",
|
|
269
|
-
"hover:bg-[var(--button-secondary-hover-bg,hsl(var(--secondary)/0.8))]",
|
|
270
|
-
"hover:text-[var(--button-secondary-hover-fg,var(--button-secondary-fg,hsl(var(--secondary-foreground))))]",
|
|
271
|
-
"hover:border-[color:var(--button-secondary-hover-border,var(--button-secondary-border,transparent))]",
|
|
272
|
-
"hover:[box-shadow:var(--button-secondary-shadow-hover,var(--button-shadow-hover,var(--button-secondary-shadow,var(--button-shadow,none))))]"
|
|
273
|
-
].join(" "),
|
|
274
|
-
// Ghost variant - full customization
|
|
275
|
-
ghost: [
|
|
276
|
-
"bg-[var(--button-ghost-bg,transparent)]",
|
|
277
|
-
"text-[var(--button-ghost-fg,inherit)]",
|
|
278
|
-
"border-[length:var(--button-ghost-border-width,0px)]",
|
|
279
|
-
"border-[color:var(--button-ghost-border,transparent)]",
|
|
280
|
-
"[box-shadow:var(--button-ghost-shadow,var(--button-shadow,none))]",
|
|
281
|
-
"hover:bg-[var(--button-ghost-hover-bg,hsl(var(--accent)))]",
|
|
282
|
-
"hover:text-[var(--button-ghost-hover-fg,hsl(var(--accent-foreground)))]",
|
|
283
|
-
"hover:border-[color:var(--button-ghost-hover-border,var(--button-ghost-border,transparent))]",
|
|
284
|
-
"hover:[box-shadow:var(--button-ghost-shadow-hover,var(--button-shadow-hover,var(--button-ghost-shadow,var(--button-shadow,none))))]",
|
|
285
|
-
"dark:hover:bg-accent/50"
|
|
286
|
-
].join(" "),
|
|
287
|
-
// Link variant - full customization
|
|
288
|
-
link: [
|
|
289
|
-
"bg-[var(--button-link-bg,transparent)]",
|
|
290
|
-
"text-[var(--button-link-fg,hsl(var(--primary)))]",
|
|
291
|
-
"border-[length:var(--button-link-border-width,0px)]",
|
|
292
|
-
"border-[color:var(--button-link-border,transparent)]",
|
|
293
|
-
"[box-shadow:var(--button-link-shadow,none)]",
|
|
294
|
-
"hover:bg-[var(--button-link-hover-bg,transparent)]",
|
|
295
|
-
"hover:text-[var(--button-link-hover-fg,var(--button-link-fg,hsl(var(--primary))))]",
|
|
296
|
-
"hover:[box-shadow:var(--button-link-shadow-hover,none)]",
|
|
297
|
-
"underline-offset-4 hover:underline"
|
|
298
|
-
].join(" ")
|
|
299
|
-
},
|
|
300
|
-
size: {
|
|
301
|
-
default: [
|
|
302
|
-
"h-[var(--button-height-md,2.25rem)]",
|
|
303
|
-
"px-[var(--button-padding-x-md,1rem)]",
|
|
304
|
-
"py-[var(--button-padding-y-md,0.5rem)]",
|
|
305
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
|
|
306
|
-
].join(" "),
|
|
307
|
-
sm: [
|
|
308
|
-
"h-[var(--button-height-sm,2rem)]",
|
|
309
|
-
"px-[var(--button-padding-x-sm,0.75rem)]",
|
|
310
|
-
"py-[var(--button-padding-y-sm,0.25rem)]",
|
|
311
|
-
"gap-1.5",
|
|
312
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-sm,0.75rem)*0.83)]"
|
|
313
|
-
].join(" "),
|
|
314
|
-
md: [
|
|
315
|
-
"h-[var(--button-height-md,2.25rem)]",
|
|
316
|
-
"px-[var(--button-padding-x-md,1rem)]",
|
|
317
|
-
"py-[var(--button-padding-y-md,0.5rem)]",
|
|
318
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-md,1rem)*0.75)]"
|
|
319
|
-
].join(" "),
|
|
320
|
-
lg: [
|
|
321
|
-
"h-[var(--button-height-lg,2.5rem)]",
|
|
322
|
-
"px-[var(--button-padding-x-lg,1.5rem)]",
|
|
323
|
-
"py-[var(--button-padding-y-lg,0.5rem)]",
|
|
324
|
-
"has-[>svg]:px-[calc(var(--button-padding-x-lg,1.5rem)*0.67)]"
|
|
325
|
-
].join(" "),
|
|
326
|
-
icon: "size-[var(--button-height-md,2.25rem)]",
|
|
327
|
-
"icon-sm": "size-[var(--button-height-sm,2rem)]",
|
|
328
|
-
"icon-lg": "size-[var(--button-height-lg,2.5rem)]"
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
defaultVariants: {
|
|
332
|
-
variant: "default",
|
|
333
|
-
size: "default"
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
var Pressable = React.forwardRef(
|
|
337
|
-
({
|
|
338
|
-
children,
|
|
339
|
-
className,
|
|
340
|
-
href,
|
|
341
|
-
onClick,
|
|
342
|
-
variant,
|
|
343
|
-
size,
|
|
344
|
-
asButton = false,
|
|
345
|
-
fallbackComponentType = "span",
|
|
346
|
-
componentType,
|
|
347
|
-
"aria-label": ariaLabel,
|
|
348
|
-
"aria-describedby": ariaDescribedby,
|
|
349
|
-
id,
|
|
350
|
-
...props
|
|
351
|
-
}, ref) => {
|
|
352
|
-
const navigation = useNavigation({ href, onClick });
|
|
353
|
-
const {
|
|
354
|
-
normalizedHref,
|
|
355
|
-
target,
|
|
356
|
-
rel,
|
|
357
|
-
linkType,
|
|
358
|
-
isInternal,
|
|
359
|
-
handleClick
|
|
360
|
-
} = navigation;
|
|
361
|
-
const shouldRenderLink = normalizedHref && linkType !== "none";
|
|
362
|
-
const shouldRenderButton = !shouldRenderLink && onClick;
|
|
363
|
-
const effectiveComponentType = componentType || (shouldRenderLink ? "a" : shouldRenderButton ? "button" : fallbackComponentType);
|
|
364
|
-
const finalComponentType = isInternal && shouldRenderLink ? "a" : effectiveComponentType;
|
|
365
|
-
const shouldApplyButtonStyles = asButton || variant || size;
|
|
366
|
-
const combinedClassName = cn(
|
|
367
|
-
shouldApplyButtonStyles && buttonVariants({ variant, size }),
|
|
368
|
-
className
|
|
369
|
-
);
|
|
370
|
-
const dataProps = Object.fromEntries(
|
|
371
|
-
Object.entries(props).filter(([key]) => key.startsWith("data-"))
|
|
372
|
-
);
|
|
373
|
-
const buttonDataAttributes = shouldApplyButtonStyles ? {
|
|
374
|
-
"data-slot": "button",
|
|
375
|
-
"data-variant": variant ?? "default",
|
|
376
|
-
"data-size": size ?? "default"
|
|
377
|
-
} : {};
|
|
378
|
-
const commonProps = {
|
|
379
|
-
className: combinedClassName,
|
|
380
|
-
onClick: handleClick,
|
|
381
|
-
"aria-label": ariaLabel,
|
|
382
|
-
"aria-describedby": ariaDescribedby,
|
|
383
|
-
id,
|
|
384
|
-
...dataProps,
|
|
385
|
-
...buttonDataAttributes
|
|
386
|
-
};
|
|
387
|
-
if (finalComponentType === "a" && shouldRenderLink) {
|
|
388
|
-
return /* @__PURE__ */ jsx(
|
|
389
|
-
"a",
|
|
390
|
-
{
|
|
391
|
-
ref,
|
|
392
|
-
href: normalizedHref,
|
|
393
|
-
target,
|
|
394
|
-
rel,
|
|
395
|
-
...commonProps,
|
|
396
|
-
...props,
|
|
397
|
-
children
|
|
398
|
-
}
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
if (finalComponentType === "button") {
|
|
402
|
-
return /* @__PURE__ */ jsx(
|
|
403
|
-
"button",
|
|
404
|
-
{
|
|
405
|
-
ref,
|
|
406
|
-
type: props.type || "button",
|
|
407
|
-
...commonProps,
|
|
408
|
-
...props,
|
|
409
|
-
children
|
|
410
|
-
}
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
if (finalComponentType === "div") {
|
|
414
|
-
return /* @__PURE__ */ jsx(
|
|
415
|
-
"div",
|
|
416
|
-
{
|
|
417
|
-
ref,
|
|
418
|
-
...commonProps,
|
|
419
|
-
children
|
|
420
|
-
}
|
|
421
|
-
);
|
|
422
|
-
}
|
|
423
|
-
return /* @__PURE__ */ jsx(
|
|
424
|
-
"span",
|
|
425
|
-
{
|
|
426
|
-
ref,
|
|
427
|
-
...commonProps,
|
|
428
|
-
children
|
|
429
|
-
}
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
);
|
|
433
|
-
Pressable.displayName = "Pressable";
|
|
434
13
|
var buildKeyframes = (from, steps) => {
|
|
435
14
|
const keys = /* @__PURE__ */ new Set([
|
|
436
15
|
...Object.keys(from),
|
|
@@ -579,7 +158,7 @@ var maxWidthStyles = {
|
|
|
579
158
|
"4xl": "max-w-[1536px]",
|
|
580
159
|
full: "max-w-full"
|
|
581
160
|
};
|
|
582
|
-
var Container =
|
|
161
|
+
var Container = React.forwardRef(
|
|
583
162
|
({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
|
|
584
163
|
const Component = as;
|
|
585
164
|
return /* @__PURE__ */ jsx(
|
|
@@ -884,7 +463,7 @@ var spacingStyles = {
|
|
|
884
463
|
};
|
|
885
464
|
var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
|
|
886
465
|
var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
|
|
887
|
-
var Section =
|
|
466
|
+
var Section = React.forwardRef(
|
|
888
467
|
({
|
|
889
468
|
id,
|
|
890
469
|
title,
|
|
@@ -945,6 +524,12 @@ var Section = React__default.forwardRef(
|
|
|
945
524
|
}
|
|
946
525
|
);
|
|
947
526
|
Section.displayName = "Section";
|
|
527
|
+
var DEFAULT_STYLE_RULES = {
|
|
528
|
+
formContainer: "",
|
|
529
|
+
fieldsContainer: "",
|
|
530
|
+
fieldClassName: "",
|
|
531
|
+
formClassName: "space-y-6"
|
|
532
|
+
};
|
|
948
533
|
var DEFAULT_FORM_FIELDS = [
|
|
949
534
|
{
|
|
950
535
|
name: "first_name",
|
|
@@ -991,82 +576,19 @@ var DEFAULT_FORM_FIELDS = [
|
|
|
991
576
|
function ContactDemo({
|
|
992
577
|
heading,
|
|
993
578
|
description,
|
|
994
|
-
buttonText = "Submit",
|
|
995
|
-
buttonIcon,
|
|
996
|
-
actions,
|
|
997
|
-
actionsSlot,
|
|
998
|
-
formFields = DEFAULT_FORM_FIELDS,
|
|
999
|
-
successMessage = "Thank you! Your message has been sent successfully.",
|
|
1000
579
|
className,
|
|
580
|
+
formEngineSetup,
|
|
1001
581
|
containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
|
|
1002
582
|
headerClassName,
|
|
1003
583
|
headingClassName,
|
|
1004
584
|
descriptionClassName,
|
|
1005
585
|
cardClassName,
|
|
1006
586
|
cardContentClassName,
|
|
1007
|
-
formClassName,
|
|
1008
|
-
submitClassName,
|
|
1009
|
-
successMessageClassName,
|
|
1010
|
-
errorMessageClassName,
|
|
1011
587
|
background,
|
|
1012
588
|
spacing = "xl",
|
|
1013
589
|
pattern,
|
|
1014
|
-
patternOpacity
|
|
1015
|
-
formConfig,
|
|
1016
|
-
onSubmit,
|
|
1017
|
-
onSuccess,
|
|
1018
|
-
onError
|
|
590
|
+
patternOpacity
|
|
1019
591
|
}) {
|
|
1020
|
-
const {
|
|
1021
|
-
uploadTokens,
|
|
1022
|
-
uploadProgress,
|
|
1023
|
-
isUploading,
|
|
1024
|
-
uploadFiles,
|
|
1025
|
-
removeFile,
|
|
1026
|
-
resetUpload
|
|
1027
|
-
} = useFileUpload({ onError });
|
|
1028
|
-
const { form, submissionError, formMethod, resetSubmissionState } = useContactForm({
|
|
1029
|
-
formFields,
|
|
1030
|
-
formConfig,
|
|
1031
|
-
onSubmit,
|
|
1032
|
-
onSuccess: (data) => {
|
|
1033
|
-
resetUpload();
|
|
1034
|
-
onSuccess?.(data);
|
|
1035
|
-
},
|
|
1036
|
-
onError,
|
|
1037
|
-
resetOnSuccess: formConfig?.resetOnSuccess !== false,
|
|
1038
|
-
uploadTokens
|
|
1039
|
-
});
|
|
1040
|
-
const actionsContent = useMemo(() => {
|
|
1041
|
-
if (actionsSlot) return actionsSlot;
|
|
1042
|
-
if (actions && actions.length > 0) {
|
|
1043
|
-
return actions.map((action, index) => {
|
|
1044
|
-
const {
|
|
1045
|
-
label,
|
|
1046
|
-
icon,
|
|
1047
|
-
iconAfter,
|
|
1048
|
-
children,
|
|
1049
|
-
className: actionClassName,
|
|
1050
|
-
...pressableProps
|
|
1051
|
-
} = action;
|
|
1052
|
-
return /* @__PURE__ */ jsx(
|
|
1053
|
-
Pressable,
|
|
1054
|
-
{
|
|
1055
|
-
asButton: true,
|
|
1056
|
-
className: actionClassName,
|
|
1057
|
-
...pressableProps,
|
|
1058
|
-
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1059
|
-
icon,
|
|
1060
|
-
label,
|
|
1061
|
-
iconAfter
|
|
1062
|
-
] })
|
|
1063
|
-
},
|
|
1064
|
-
index
|
|
1065
|
-
);
|
|
1066
|
-
});
|
|
1067
|
-
}
|
|
1068
|
-
return null;
|
|
1069
|
-
}, [actionsSlot, actions]);
|
|
1070
592
|
return /* @__PURE__ */ jsx(
|
|
1071
593
|
Section,
|
|
1072
594
|
{
|
|
@@ -1112,64 +634,14 @@ function ContactDemo({
|
|
|
1112
634
|
]
|
|
1113
635
|
}
|
|
1114
636
|
),
|
|
1115
|
-
/* @__PURE__ */ jsx(Card, { className: cn("rounded-2xl shadow-2xl", cardClassName), children: /* @__PURE__ */ jsx(CardContent, { className: cn("p-6 lg:p-8", cardContentClassName), children: /* @__PURE__ */
|
|
1116
|
-
|
|
637
|
+
/* @__PURE__ */ jsx(Card, { className: cn("rounded-2xl shadow-2xl", cardClassName), children: /* @__PURE__ */ jsx(CardContent, { className: cn("p-6 lg:p-8", cardContentClassName), children: formEngineSetup ? /* @__PURE__ */ jsx(
|
|
638
|
+
FormEngine,
|
|
1117
639
|
{
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
successMessage
|
|
1122
|
-
},
|
|
1123
|
-
styleConfig: {
|
|
1124
|
-
formClassName: cn("space-y-4", formClassName),
|
|
1125
|
-
successMessageClassName,
|
|
1126
|
-
errorMessageClassName
|
|
1127
|
-
},
|
|
1128
|
-
formConfig: {
|
|
1129
|
-
endpoint: formConfig?.endpoint,
|
|
1130
|
-
method: formMethod,
|
|
1131
|
-
submissionConfig: formConfig?.submissionConfig
|
|
1132
|
-
},
|
|
1133
|
-
onNewSubmission: () => {
|
|
1134
|
-
resetUpload();
|
|
1135
|
-
resetSubmissionState();
|
|
1136
|
-
},
|
|
1137
|
-
children: [
|
|
1138
|
-
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-12 gap-6", children: formFields.map((field) => /* @__PURE__ */ jsx(
|
|
1139
|
-
"div",
|
|
1140
|
-
{
|
|
1141
|
-
className: getColumnSpanClass(field.columnSpan),
|
|
1142
|
-
children: /* @__PURE__ */ jsx(
|
|
1143
|
-
DynamicFormField,
|
|
1144
|
-
{
|
|
1145
|
-
field,
|
|
1146
|
-
uploadProgress,
|
|
1147
|
-
onFileUpload: uploadFiles,
|
|
1148
|
-
onFileRemove: removeFile,
|
|
1149
|
-
isUploading
|
|
1150
|
-
}
|
|
1151
|
-
)
|
|
1152
|
-
},
|
|
1153
|
-
field.name
|
|
1154
|
-
)) }),
|
|
1155
|
-
actionsSlot || actions && actions.length > 0 ? actionsContent : /* @__PURE__ */ jsxs(
|
|
1156
|
-
Pressable,
|
|
1157
|
-
{
|
|
1158
|
-
componentType: "button",
|
|
1159
|
-
type: "submit",
|
|
1160
|
-
className: cn("w-full", submitClassName),
|
|
1161
|
-
size: "lg",
|
|
1162
|
-
asButton: true,
|
|
1163
|
-
disabled: form.isSubmitting,
|
|
1164
|
-
children: [
|
|
1165
|
-
buttonIcon,
|
|
1166
|
-
buttonText
|
|
1167
|
-
]
|
|
1168
|
-
}
|
|
1169
|
-
)
|
|
1170
|
-
]
|
|
640
|
+
formEngineSetup,
|
|
641
|
+
defaultFields: DEFAULT_FORM_FIELDS,
|
|
642
|
+
defaultStyleRules: DEFAULT_STYLE_RULES
|
|
1171
643
|
}
|
|
1172
|
-
) }) })
|
|
644
|
+
) : null }) })
|
|
1173
645
|
] })
|
|
1174
646
|
}
|
|
1175
647
|
);
|
|
@@ -992,7 +992,7 @@ function ContactEmergency({
|
|
|
992
992
|
index
|
|
993
993
|
)) })
|
|
994
994
|
] }) }),
|
|
995
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
995
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-6 md:py-0 md:px-6", children: formEngineSetup ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
996
996
|
integration.FormEngine,
|
|
997
997
|
{
|
|
998
998
|
formEngineSetup,
|
|
@@ -971,7 +971,7 @@ function ContactEmergency({
|
|
|
971
971
|
index
|
|
972
972
|
)) })
|
|
973
973
|
] }) }),
|
|
974
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
974
|
+
/* @__PURE__ */ jsx("div", { className: "py-6 md:py-0 md:px-6", children: formEngineSetup ? /* @__PURE__ */ jsx(
|
|
975
975
|
FormEngine,
|
|
976
976
|
{
|
|
977
977
|
formEngineSetup,
|