@opensite/ui 1.9.8 → 2.0.0
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-demo.cjs +106 -406
- package/dist/contact-demo.d.cts +36 -111
- package/dist/contact-demo.d.ts +36 -111
- package/dist/contact-demo.js +108 -405
- package/dist/contact-emergency.cjs +129 -158
- package/dist/contact-emergency.d.cts +23 -12
- package/dist/contact-emergency.d.ts +23 -12
- package/dist/contact-emergency.js +131 -159
- package/dist/contact-event.cjs +106 -147
- package/dist/contact-event.d.cts +36 -66
- package/dist/contact-event.d.ts +36 -66
- package/dist/contact-event.js +108 -148
- package/dist/contact-feedback.cjs +109 -102
- package/dist/contact-feedback.d.cts +36 -63
- package/dist/contact-feedback.d.ts +36 -63
- package/dist/contact-feedback.js +111 -103
- package/dist/contact-fitness.cjs +107 -148
- package/dist/contact-fitness.d.cts +36 -66
- package/dist/contact-fitness.d.ts +36 -66
- package/dist/contact-fitness.js +109 -149
- package/dist/contact-guest.cjs +107 -148
- package/dist/contact-guest.d.cts +35 -65
- package/dist/contact-guest.d.ts +35 -65
- package/dist/contact-guest.js +109 -149
- package/dist/contact-image.cjs +108 -149
- package/dist/contact-image.d.cts +35 -65
- package/dist/contact-image.d.ts +35 -65
- package/dist/contact-image.js +110 -150
- package/dist/contact-insurance.cjs +107 -148
- package/dist/contact-insurance.d.cts +36 -66
- package/dist/contact-insurance.d.ts +36 -66
- package/dist/contact-insurance.js +109 -149
- package/dist/contact-interview.cjs +106 -147
- package/dist/contact-interview.d.cts +20 -12
- package/dist/contact-interview.d.ts +20 -12
- package/dist/contact-interview.js +108 -148
- package/dist/contact-locations.cjs +106 -147
- package/dist/contact-locations.d.cts +21 -13
- package/dist/contact-locations.d.ts +21 -13
- package/dist/contact-locations.js +108 -148
- package/dist/contact-maintenance.cjs +103 -143
- package/dist/contact-maintenance.d.cts +21 -13
- package/dist/contact-maintenance.d.ts +21 -13
- package/dist/contact-maintenance.js +105 -144
- package/dist/contact-map.cjs +103 -143
- package/dist/contact-map.d.cts +20 -12
- package/dist/contact-map.d.ts +20 -12
- package/dist/contact-map.js +105 -144
- package/dist/contact-minimal.cjs +126 -242
- package/dist/contact-minimal.d.cts +36 -70
- package/dist/contact-minimal.d.ts +36 -70
- package/dist/contact-minimal.js +128 -243
- package/dist/contact-moving.cjs +103 -143
- package/dist/contact-moving.d.cts +20 -12
- package/dist/contact-moving.d.ts +20 -12
- package/dist/contact-moving.js +105 -144
- package/dist/contact-multistep.cjs +104 -144
- package/dist/contact-multistep.d.cts +21 -13
- package/dist/contact-multistep.d.ts +21 -13
- package/dist/contact-multistep.js +106 -145
- package/dist/contact-partnership.cjs +103 -143
- package/dist/contact-partnership.d.cts +19 -11
- package/dist/contact-partnership.d.ts +19 -11
- package/dist/contact-partnership.js +105 -144
- package/dist/contact-press.cjs +144 -150
- package/dist/contact-press.d.cts +21 -13
- package/dist/contact-press.d.ts +21 -13
- package/dist/contact-press.js +146 -151
- package/dist/contact-quote.cjs +144 -150
- package/dist/contact-quote.d.cts +19 -11
- package/dist/contact-quote.d.ts +19 -11
- package/dist/contact-quote.js +146 -151
- package/dist/contact-referral.cjs +144 -150
- package/dist/contact-referral.d.cts +20 -12
- package/dist/contact-referral.d.ts +20 -12
- package/dist/contact-referral.js +146 -151
- package/dist/contact-report.cjs +144 -150
- package/dist/contact-report.d.cts +21 -13
- package/dist/contact-report.d.ts +21 -13
- package/dist/contact-report.js +146 -151
- package/dist/contact-reservation.cjs +144 -150
- package/dist/contact-reservation.d.cts +20 -12
- package/dist/contact-reservation.d.ts +20 -12
- package/dist/contact-reservation.js +146 -151
- package/dist/contact-retreat.cjs +144 -150
- package/dist/contact-retreat.d.cts +21 -13
- package/dist/contact-retreat.d.ts +21 -13
- package/dist/contact-retreat.js +146 -151
- package/dist/contact-rsvp.cjs +144 -150
- package/dist/contact-rsvp.d.cts +20 -12
- package/dist/contact-rsvp.d.ts +20 -12
- package/dist/contact-rsvp.js +146 -151
- package/dist/contact-sales.cjs +131 -146
- package/dist/contact-sales.d.cts +34 -65
- package/dist/contact-sales.d.ts +34 -65
- package/dist/contact-sales.js +133 -147
- package/dist/contact-schedule.cjs +144 -150
- package/dist/contact-schedule.d.cts +20 -12
- package/dist/contact-schedule.d.ts +20 -12
- package/dist/contact-schedule.js +146 -151
- package/dist/contact-sponsorship.cjs +144 -150
- package/dist/contact-sponsorship.d.cts +21 -13
- package/dist/contact-sponsorship.d.ts +21 -13
- package/dist/contact-sponsorship.js +146 -151
- package/dist/contact-support.cjs +147 -120
- package/dist/contact-support.d.cts +21 -12
- package/dist/contact-support.d.ts +21 -12
- package/dist/contact-support.js +149 -121
- package/dist/contact-tenant.cjs +144 -150
- package/dist/contact-tenant.d.cts +20 -12
- package/dist/contact-tenant.d.ts +20 -12
- package/dist/contact-tenant.js +146 -151
- package/dist/contact-vendor.cjs +144 -150
- package/dist/contact-vendor.d.cts +20 -12
- package/dist/contact-vendor.d.ts +20 -12
- package/dist/contact-vendor.js +146 -151
- package/dist/contact-volunteer.cjs +144 -150
- package/dist/contact-volunteer.d.cts +20 -12
- package/dist/contact-volunteer.d.ts +20 -12
- package/dist/contact-volunteer.js +146 -151
- package/dist/contact-warranty.cjs +144 -150
- package/dist/contact-warranty.d.cts +20 -12
- package/dist/contact-warranty.d.ts +20 -12
- package/dist/contact-warranty.js +146 -151
- package/dist/contact-wedding.cjs +144 -150
- package/dist/contact-wedding.d.cts +20 -12
- package/dist/contact-wedding.d.ts +20 -12
- package/dist/contact-wedding.js +146 -151
- package/dist/registry.cjs +5791 -5883
- package/dist/registry.js +4527 -4619
- package/package.json +2 -2
package/dist/contact-demo.cjs
CHANGED
|
@@ -3,15 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var forms = require('@page-speed/forms');
|
|
6
|
-
var
|
|
6
|
+
var integration = require('@page-speed/forms/integration');
|
|
7
7
|
var clsx = require('clsx');
|
|
8
8
|
var tailwindMerge = require('tailwind-merge');
|
|
9
9
|
var classVarianceAuthority = require('class-variance-authority');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
-
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
12
|
-
var LabelPrimitive = require('@radix-ui/react-label');
|
|
13
|
-
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
14
|
-
var integration = require('@page-speed/forms/integration');
|
|
15
11
|
|
|
16
12
|
function _interopNamespace(e) {
|
|
17
13
|
if (e && e.__esModule) return e;
|
|
@@ -32,12 +28,8 @@ function _interopNamespace(e) {
|
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
35
|
-
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
36
|
-
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
37
|
-
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
38
31
|
|
|
39
32
|
// components/blocks/contact/contact-demo.tsx
|
|
40
|
-
var TextInput = inputs.TextInput;
|
|
41
33
|
function cn(...inputs) {
|
|
42
34
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
43
35
|
}
|
|
@@ -459,111 +451,6 @@ var Pressable = React__namespace.forwardRef(
|
|
|
459
451
|
}
|
|
460
452
|
);
|
|
461
453
|
Pressable.displayName = "Pressable";
|
|
462
|
-
var svgCache = /* @__PURE__ */ new Map();
|
|
463
|
-
function DynamicIcon({
|
|
464
|
-
name,
|
|
465
|
-
size = 28,
|
|
466
|
-
color,
|
|
467
|
-
className,
|
|
468
|
-
alt
|
|
469
|
-
}) {
|
|
470
|
-
const [svgContent, setSvgContent] = React__namespace.useState(null);
|
|
471
|
-
const [isLoading, setIsLoading] = React__namespace.useState(true);
|
|
472
|
-
const [error, setError] = React__namespace.useState(null);
|
|
473
|
-
const { url, iconName } = React__namespace.useMemo(() => {
|
|
474
|
-
const separator = name.includes("/") ? "/" : ":";
|
|
475
|
-
const [prefix, iconName2] = name.split(separator);
|
|
476
|
-
const baseUrl = `https://icons.opensite.ai/api/icon/${prefix}/${iconName2}?format=svg&width=${size}&height=${size}&key=au382bi7fsh96w9h9xlrnat2jglx`;
|
|
477
|
-
return {
|
|
478
|
-
url: baseUrl,
|
|
479
|
-
iconName: iconName2
|
|
480
|
-
};
|
|
481
|
-
}, [name, size]);
|
|
482
|
-
React__namespace.useEffect(() => {
|
|
483
|
-
let isMounted = true;
|
|
484
|
-
const fetchSvg = async () => {
|
|
485
|
-
const cached = svgCache.get(url);
|
|
486
|
-
if (cached) {
|
|
487
|
-
if (isMounted) {
|
|
488
|
-
setSvgContent(cached);
|
|
489
|
-
setIsLoading(false);
|
|
490
|
-
}
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
try {
|
|
494
|
-
setIsLoading(true);
|
|
495
|
-
setError(null);
|
|
496
|
-
const response = await fetch(url);
|
|
497
|
-
if (!response.ok) {
|
|
498
|
-
throw new Error(`Failed to fetch icon: ${response.status}`);
|
|
499
|
-
}
|
|
500
|
-
let svg = await response.text();
|
|
501
|
-
svg = processSvgForCurrentColor(svg);
|
|
502
|
-
svgCache.set(url, svg);
|
|
503
|
-
if (isMounted) {
|
|
504
|
-
setSvgContent(svg);
|
|
505
|
-
setIsLoading(false);
|
|
506
|
-
}
|
|
507
|
-
} catch (err) {
|
|
508
|
-
if (isMounted) {
|
|
509
|
-
setError(err instanceof Error ? err.message : "Failed to load icon");
|
|
510
|
-
setIsLoading(false);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
fetchSvg();
|
|
515
|
-
return () => {
|
|
516
|
-
isMounted = false;
|
|
517
|
-
};
|
|
518
|
-
}, [url]);
|
|
519
|
-
if (isLoading) {
|
|
520
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
521
|
-
"span",
|
|
522
|
-
{
|
|
523
|
-
className: cn("inline-block", className),
|
|
524
|
-
style: { width: size, height: size },
|
|
525
|
-
"aria-hidden": "true"
|
|
526
|
-
}
|
|
527
|
-
);
|
|
528
|
-
}
|
|
529
|
-
if (error || !svgContent) {
|
|
530
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
531
|
-
"span",
|
|
532
|
-
{
|
|
533
|
-
className: cn("inline-block", className),
|
|
534
|
-
style: { width: size, height: size },
|
|
535
|
-
role: "img",
|
|
536
|
-
"aria-label": alt || iconName
|
|
537
|
-
}
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
541
|
-
"span",
|
|
542
|
-
{
|
|
543
|
-
className: cn("inline-flex items-center justify-center", className),
|
|
544
|
-
style: {
|
|
545
|
-
width: size,
|
|
546
|
-
height: size,
|
|
547
|
-
color: color || "inherit"
|
|
548
|
-
},
|
|
549
|
-
role: "img",
|
|
550
|
-
"aria-label": alt || iconName,
|
|
551
|
-
dangerouslySetInnerHTML: { __html: svgContent }
|
|
552
|
-
}
|
|
553
|
-
);
|
|
554
|
-
}
|
|
555
|
-
function processSvgForCurrentColor(svg) {
|
|
556
|
-
let processed = svg;
|
|
557
|
-
processed = processed.replace(
|
|
558
|
-
/stroke=["'](#000000|#000|black)["']/gi,
|
|
559
|
-
'stroke="currentColor"'
|
|
560
|
-
);
|
|
561
|
-
processed = processed.replace(
|
|
562
|
-
/fill=["'](#000000|#000|black)["']/gi,
|
|
563
|
-
'fill="currentColor"'
|
|
564
|
-
);
|
|
565
|
-
return processed;
|
|
566
|
-
}
|
|
567
454
|
function Card({ className, ...props }) {
|
|
568
455
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
569
456
|
"div",
|
|
@@ -587,66 +474,6 @@ function CardContent({ className, ...props }) {
|
|
|
587
474
|
}
|
|
588
475
|
);
|
|
589
476
|
}
|
|
590
|
-
function Checkbox({
|
|
591
|
-
className,
|
|
592
|
-
...props
|
|
593
|
-
}) {
|
|
594
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
595
|
-
CheckboxPrimitive__namespace.Root,
|
|
596
|
-
{
|
|
597
|
-
"data-slot": "checkbox",
|
|
598
|
-
className: cn(
|
|
599
|
-
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
600
|
-
className
|
|
601
|
-
),
|
|
602
|
-
...props,
|
|
603
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
604
|
-
CheckboxPrimitive__namespace.Indicator,
|
|
605
|
-
{
|
|
606
|
-
"data-slot": "checkbox-indicator",
|
|
607
|
-
className: "grid place-content-center text-current transition-none",
|
|
608
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: "lucide/check", size: 14 })
|
|
609
|
-
}
|
|
610
|
-
)
|
|
611
|
-
}
|
|
612
|
-
);
|
|
613
|
-
}
|
|
614
|
-
function Label({
|
|
615
|
-
className,
|
|
616
|
-
...props
|
|
617
|
-
}) {
|
|
618
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
619
|
-
LabelPrimitive__namespace.Root,
|
|
620
|
-
{
|
|
621
|
-
"data-slot": "label",
|
|
622
|
-
className: cn(
|
|
623
|
-
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
624
|
-
className
|
|
625
|
-
),
|
|
626
|
-
...props
|
|
627
|
-
}
|
|
628
|
-
);
|
|
629
|
-
}
|
|
630
|
-
function Separator({
|
|
631
|
-
className,
|
|
632
|
-
orientation = "horizontal",
|
|
633
|
-
decorative = true,
|
|
634
|
-
...props
|
|
635
|
-
}) {
|
|
636
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
637
|
-
SeparatorPrimitive__namespace.Root,
|
|
638
|
-
{
|
|
639
|
-
"data-slot": "separator",
|
|
640
|
-
decorative,
|
|
641
|
-
orientation,
|
|
642
|
-
className: cn(
|
|
643
|
-
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
644
|
-
className
|
|
645
|
-
),
|
|
646
|
-
...props
|
|
647
|
-
}
|
|
648
|
-
);
|
|
649
|
-
}
|
|
650
477
|
var maxWidthStyles = {
|
|
651
478
|
sm: "max-w-screen-sm",
|
|
652
479
|
md: "max-w-screen-md",
|
|
@@ -1022,36 +849,60 @@ var Section = React__namespace.default.forwardRef(
|
|
|
1022
849
|
}
|
|
1023
850
|
);
|
|
1024
851
|
Section.displayName = "Section";
|
|
1025
|
-
var
|
|
1026
|
-
{ value: "automation", label: "Workflow Automation", icon: "lucide/zap" },
|
|
852
|
+
var DEFAULT_FORM_FIELDS = [
|
|
1027
853
|
{
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
854
|
+
name: "first_name",
|
|
855
|
+
type: "text",
|
|
856
|
+
label: "First Name",
|
|
857
|
+
placeholder: "John",
|
|
858
|
+
required: true,
|
|
859
|
+
columnSpan: 6
|
|
1031
860
|
},
|
|
1032
|
-
{
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
861
|
+
{
|
|
862
|
+
name: "last_name",
|
|
863
|
+
type: "text",
|
|
864
|
+
label: "Last Name",
|
|
865
|
+
placeholder: "Doe",
|
|
866
|
+
required: true,
|
|
867
|
+
columnSpan: 6
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
name: "email",
|
|
871
|
+
type: "email",
|
|
872
|
+
label: "Email",
|
|
873
|
+
placeholder: "john@example.com",
|
|
874
|
+
required: true,
|
|
875
|
+
columnSpan: 12
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
name: "phone",
|
|
879
|
+
type: "tel",
|
|
880
|
+
label: "Phone",
|
|
881
|
+
placeholder: "+1 (555) 000-0000",
|
|
882
|
+
required: true,
|
|
883
|
+
columnSpan: 12
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
name: "message",
|
|
887
|
+
type: "textarea",
|
|
888
|
+
label: "Message",
|
|
889
|
+
placeholder: "Your message...",
|
|
890
|
+
required: true,
|
|
891
|
+
rows: 4,
|
|
892
|
+
columnSpan: 12
|
|
893
|
+
}
|
|
1046
894
|
];
|
|
1047
895
|
function ContactDemo({
|
|
1048
896
|
heading,
|
|
1049
897
|
description,
|
|
1050
|
-
buttonText,
|
|
898
|
+
buttonText = "Submit",
|
|
1051
899
|
buttonIcon,
|
|
1052
900
|
actions,
|
|
1053
901
|
actionsSlot,
|
|
902
|
+
formFields = DEFAULT_FORM_FIELDS,
|
|
903
|
+
successMessage = "Thank you! Your message has been sent successfully.",
|
|
1054
904
|
className,
|
|
905
|
+
containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
|
|
1055
906
|
headerClassName,
|
|
1056
907
|
headingClassName,
|
|
1057
908
|
descriptionClassName,
|
|
@@ -1059,72 +910,38 @@ function ContactDemo({
|
|
|
1059
910
|
cardContentClassName,
|
|
1060
911
|
formClassName,
|
|
1061
912
|
submitClassName,
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
background,
|
|
913
|
+
successMessageClassName,
|
|
914
|
+
errorMessageClassName,
|
|
915
|
+
background = "white",
|
|
916
|
+
spacing = "xl",
|
|
1065
917
|
pattern,
|
|
1066
|
-
patternOpacity,
|
|
918
|
+
patternOpacity = 0.1,
|
|
1067
919
|
formConfig,
|
|
1068
920
|
onSubmit,
|
|
1069
921
|
onSuccess,
|
|
1070
922
|
onError
|
|
1071
923
|
}) {
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
timeline: (value) => !value ? "Please select a timeline" : void 0,
|
|
1088
|
-
firstName: (value) => !value ? "First name is required" : void 0,
|
|
1089
|
-
lastName: (value) => !value ? "Last name is required" : void 0,
|
|
1090
|
-
email: (value) => {
|
|
1091
|
-
if (!value) return "Email is required";
|
|
1092
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value))
|
|
1093
|
-
return "Please enter a valid email address";
|
|
1094
|
-
return void 0;
|
|
1095
|
-
},
|
|
1096
|
-
company: (value) => !value ? "Company is required" : void 0
|
|
924
|
+
const {
|
|
925
|
+
uploadTokens,
|
|
926
|
+
uploadProgress,
|
|
927
|
+
isUploading,
|
|
928
|
+
uploadFiles,
|
|
929
|
+
removeFile,
|
|
930
|
+
resetUpload
|
|
931
|
+
} = integration.useFileUpload({ onError });
|
|
932
|
+
const { form, submissionError, formMethod, resetSubmissionState } = integration.useContactForm({
|
|
933
|
+
formFields,
|
|
934
|
+
formConfig,
|
|
935
|
+
onSubmit,
|
|
936
|
+
onSuccess: (data) => {
|
|
937
|
+
resetUpload();
|
|
938
|
+
onSuccess?.(data);
|
|
1097
939
|
},
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
try {
|
|
1104
|
-
let result;
|
|
1105
|
-
if (shouldAutoSubmit) {
|
|
1106
|
-
result = await integration.submitPageSpeedForm(values, formConfig);
|
|
1107
|
-
}
|
|
1108
|
-
if (onSubmit) {
|
|
1109
|
-
await onSubmit(values);
|
|
1110
|
-
}
|
|
1111
|
-
if (shouldAutoSubmit || onSubmit) {
|
|
1112
|
-
if (formConfig?.resetOnSuccess !== false) {
|
|
1113
|
-
helpers.resetForm();
|
|
1114
|
-
}
|
|
1115
|
-
onSuccess?.(result);
|
|
1116
|
-
}
|
|
1117
|
-
} catch (error) {
|
|
1118
|
-
if (error instanceof integration.PageSpeedFormSubmissionError && error.formErrors) {
|
|
1119
|
-
helpers.setErrors(error.formErrors);
|
|
1120
|
-
}
|
|
1121
|
-
onError?.(error);
|
|
1122
|
-
throw error;
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
940
|
+
onError,
|
|
941
|
+
resetOnSuccess: formConfig?.resetOnSuccess !== false,
|
|
942
|
+
uploadTokens
|
|
1125
943
|
});
|
|
1126
|
-
const
|
|
1127
|
-
const actionsContent = React__namespace.useMemo(() => {
|
|
944
|
+
const actionsContent = React.useMemo(() => {
|
|
1128
945
|
if (actionsSlot) return actionsSlot;
|
|
1129
946
|
if (actions && actions.length > 0) {
|
|
1130
947
|
return actions.map((action, index) => {
|
|
@@ -1161,9 +978,9 @@ function ContactDemo({
|
|
|
1161
978
|
spacing,
|
|
1162
979
|
pattern,
|
|
1163
980
|
patternOpacity,
|
|
1164
|
-
className,
|
|
981
|
+
className: cn("py-12", className),
|
|
1165
982
|
containerClassName,
|
|
1166
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
983
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto max-w-4xl", children: [
|
|
1167
984
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mb-10 text-center", headerClassName), children: [
|
|
1168
985
|
heading && (typeof heading === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1169
986
|
"h2",
|
|
@@ -1186,174 +1003,57 @@ function ContactDemo({
|
|
|
1186
1003
|
}
|
|
1187
1004
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: descriptionClassName, children: description }))
|
|
1188
1005
|
] }),
|
|
1189
|
-
/* @__PURE__ */ jsxRuntime.jsx(Card, { className: cardClassName, children: /* @__PURE__ */ jsxRuntime.jsx(CardContent, { className: cn("p-6 lg:p-8", cardContentClassName), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx(Card, { className: cn("mx-auto max-w-xl", cardClassName), children: /* @__PURE__ */ jsxRuntime.jsx(CardContent, { className: cn("p-6 lg:p-8", cardContentClassName), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1190
1007
|
forms.Form,
|
|
1191
1008
|
{
|
|
1192
1009
|
form,
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1010
|
+
notificationConfig: {
|
|
1011
|
+
submissionError,
|
|
1012
|
+
successMessage
|
|
1013
|
+
},
|
|
1014
|
+
styleConfig: {
|
|
1015
|
+
formClassName: cn("space-y-4", formClassName),
|
|
1016
|
+
successMessageClassName,
|
|
1017
|
+
errorMessageClassName
|
|
1018
|
+
},
|
|
1019
|
+
formConfig: {
|
|
1020
|
+
endpoint: formConfig?.endpoint,
|
|
1021
|
+
method: formMethod,
|
|
1022
|
+
submissionConfig: formConfig?.submissionConfig
|
|
1023
|
+
},
|
|
1024
|
+
onNewSubmission: () => {
|
|
1025
|
+
resetUpload();
|
|
1026
|
+
resetSubmissionState();
|
|
1027
|
+
},
|
|
1196
1028
|
children: [
|
|
1197
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
id: "use-case",
|
|
1204
|
-
error: meta.touched && !!meta.error,
|
|
1205
|
-
"aria-label": "Use Case",
|
|
1206
|
-
children: [
|
|
1207
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select a use case" }),
|
|
1208
|
-
USE_CASES.map((useCase) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: useCase.value, children: useCase.label }, useCase.value))
|
|
1209
|
-
]
|
|
1210
|
-
}
|
|
1211
|
-
) }) })
|
|
1212
|
-
] }),
|
|
1213
|
-
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
1214
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 sm:grid-cols-2", children: [
|
|
1215
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "teamSize", children: ({ field, meta }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1216
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "team-size", children: "Team Size" }),
|
|
1217
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1218
|
-
inputs.Select,
|
|
1219
|
-
{
|
|
1220
|
-
...field,
|
|
1221
|
-
id: "team-size",
|
|
1222
|
-
error: meta.touched && !!meta.error,
|
|
1223
|
-
"aria-label": "Team Size",
|
|
1224
|
-
children: [
|
|
1225
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select team size" }),
|
|
1226
|
-
TEAM_SIZES.map((size) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: size.value, children: size.label }, size.value))
|
|
1227
|
-
]
|
|
1228
|
-
}
|
|
1229
|
-
)
|
|
1230
|
-
] }) }),
|
|
1231
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "timeline", children: ({ field, meta }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1232
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "timeline", children: "When do you need this?" }),
|
|
1233
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1234
|
-
inputs.Select,
|
|
1235
|
-
{
|
|
1236
|
-
...field,
|
|
1237
|
-
id: "timeline",
|
|
1238
|
-
error: meta.touched && !!meta.error,
|
|
1239
|
-
"aria-label": "Timeline",
|
|
1240
|
-
children: [
|
|
1241
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select timeline" }),
|
|
1242
|
-
TIMELINES.map((time) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: time.value, children: time.label }, time.value))
|
|
1243
|
-
]
|
|
1244
|
-
}
|
|
1245
|
-
)
|
|
1246
|
-
] }) })
|
|
1247
|
-
] }),
|
|
1248
|
-
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
1249
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
1250
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold", children: "Your Information" }),
|
|
1251
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
1252
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "firstName", children: ({ field, meta }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1253
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "first-name", children: "First Name" }),
|
|
1254
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1255
|
-
TextInput,
|
|
1256
|
-
{
|
|
1257
|
-
...field,
|
|
1258
|
-
id: "first-name",
|
|
1259
|
-
placeholder: "John",
|
|
1260
|
-
error: meta.touched && !!meta.error,
|
|
1261
|
-
"aria-label": "First Name"
|
|
1262
|
-
}
|
|
1263
|
-
)
|
|
1264
|
-
] }) }),
|
|
1265
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "lastName", children: ({ field, meta }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1266
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "last-name", children: "Last Name" }),
|
|
1267
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1268
|
-
TextInput,
|
|
1269
|
-
{
|
|
1270
|
-
...field,
|
|
1271
|
-
id: "last-name",
|
|
1272
|
-
placeholder: "Doe",
|
|
1273
|
-
error: meta.touched && !!meta.error,
|
|
1274
|
-
"aria-label": "Last Name"
|
|
1275
|
-
}
|
|
1276
|
-
)
|
|
1277
|
-
] }) })
|
|
1278
|
-
] }),
|
|
1279
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "email", children: ({ field, meta }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1280
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "email", children: "Work Email" }),
|
|
1281
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1282
|
-
TextInput,
|
|
1283
|
-
{
|
|
1284
|
-
...field,
|
|
1285
|
-
id: "email",
|
|
1286
|
-
type: "email",
|
|
1287
|
-
placeholder: "john@company.com",
|
|
1288
|
-
error: meta.touched && !!meta.error,
|
|
1289
|
-
"aria-label": "Work Email"
|
|
1290
|
-
}
|
|
1291
|
-
)
|
|
1292
|
-
] }) }),
|
|
1293
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
1294
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "company", children: ({ field, meta }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1295
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "company", children: "Company" }),
|
|
1296
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1297
|
-
TextInput,
|
|
1298
|
-
{
|
|
1299
|
-
...field,
|
|
1300
|
-
id: "company",
|
|
1301
|
-
placeholder: "Acme Inc.",
|
|
1302
|
-
error: meta.touched && !!meta.error,
|
|
1303
|
-
"aria-label": "Company"
|
|
1304
|
-
}
|
|
1305
|
-
)
|
|
1306
|
-
] }) }),
|
|
1307
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "jobTitle", children: ({ field, meta }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1308
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "job-title", children: "Job Title (Optional)" }),
|
|
1309
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1310
|
-
TextInput,
|
|
1311
|
-
{
|
|
1312
|
-
...field,
|
|
1313
|
-
id: "job-title",
|
|
1314
|
-
placeholder: "Product Manager",
|
|
1315
|
-
error: meta.touched && !!meta.error,
|
|
1316
|
-
"aria-label": "Job Title"
|
|
1317
|
-
}
|
|
1318
|
-
)
|
|
1319
|
-
] }) })
|
|
1320
|
-
] }),
|
|
1321
|
-
/* @__PURE__ */ jsxRuntime.jsx(forms.Field, { name: "updates", children: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1322
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1323
|
-
Checkbox,
|
|
1324
|
-
{
|
|
1325
|
-
id: "updates",
|
|
1326
|
-
checked: field.value,
|
|
1327
|
-
onCheckedChange: (checked) => field.onChange(checked === true)
|
|
1328
|
-
}
|
|
1329
|
-
),
|
|
1330
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1331
|
-
Label,
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-12 gap-6", children: formFields.map((field) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1030
|
+
"div",
|
|
1031
|
+
{
|
|
1032
|
+
className: integration.getColumnSpanClass(field.columnSpan),
|
|
1033
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
|
+
integration.DynamicFormField,
|
|
1332
1035
|
{
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1036
|
+
field,
|
|
1037
|
+
uploadProgress,
|
|
1038
|
+
onFileUpload: uploadFiles,
|
|
1039
|
+
onFileRemove: removeFile,
|
|
1040
|
+
isUploading
|
|
1336
1041
|
}
|
|
1337
1042
|
)
|
|
1338
|
-
|
|
1339
|
-
|
|
1043
|
+
},
|
|
1044
|
+
field.name
|
|
1045
|
+
)) }),
|
|
1340
1046
|
actionsSlot || actions && actions.length > 0 ? actionsContent : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1341
1047
|
Pressable,
|
|
1342
1048
|
{
|
|
1343
1049
|
componentType: "button",
|
|
1344
1050
|
type: "submit",
|
|
1345
1051
|
className: cn("w-full", submitClassName),
|
|
1052
|
+
size: "lg",
|
|
1346
1053
|
asButton: true,
|
|
1347
1054
|
disabled: form.isSubmitting,
|
|
1348
1055
|
children: [
|
|
1349
|
-
buttonIcon
|
|
1350
|
-
DynamicIcon,
|
|
1351
|
-
{
|
|
1352
|
-
name: "lucide/calendar",
|
|
1353
|
-
size: 16,
|
|
1354
|
-
className: "mr-2"
|
|
1355
|
-
}
|
|
1356
|
-
),
|
|
1056
|
+
buttonIcon,
|
|
1357
1057
|
buttonText
|
|
1358
1058
|
]
|
|
1359
1059
|
}
|