@opensite/ui 2.0.8 → 2.1.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/hero-agency-animated-images.cjs +4 -4
- package/dist/hero-agency-animated-images.js +4 -4
- package/dist/hero-business-carousel-dots.cjs +46 -36
- package/dist/hero-business-carousel-dots.js +46 -36
- package/dist/hero-coming-soon-countdown.cjs +93 -54
- package/dist/hero-coming-soon-countdown.d.cts +31 -6
- package/dist/hero-coming-soon-countdown.d.ts +31 -6
- package/dist/hero-coming-soon-countdown.js +93 -54
- package/dist/hero-creative-studio-stacked.cjs +9 -6
- package/dist/hero-creative-studio-stacked.d.cts +5 -1
- package/dist/hero-creative-studio-stacked.d.ts +5 -1
- package/dist/hero-creative-studio-stacked.js +9 -6
- package/dist/hero-customer-support-layered.cjs +1 -1
- package/dist/hero-customer-support-layered.js +1 -1
- package/dist/hero-developer-tools-code.cjs +2 -2
- package/dist/hero-developer-tools-code.js +2 -2
- package/dist/hero-digital-agency-fullscreen.cjs +14 -12
- package/dist/hero-digital-agency-fullscreen.d.cts +1 -1
- package/dist/hero-digital-agency-fullscreen.d.ts +1 -1
- package/dist/hero-digital-agency-fullscreen.js +14 -12
- package/dist/hero-ecommerce-product-showcase.cjs +76 -57
- package/dist/hero-ecommerce-product-showcase.js +76 -57
- package/dist/hero-enterprise-security.cjs +81 -60
- package/dist/hero-enterprise-security.js +81 -60
- package/dist/hero-event-registration.cjs +43 -10
- package/dist/hero-event-registration.js +43 -10
- package/dist/hero-hiring-animated-text.cjs +661 -639
- package/dist/hero-hiring-animated-text.d.cts +1 -9
- package/dist/hero-hiring-animated-text.d.ts +1 -9
- package/dist/hero-hiring-animated-text.js +657 -635
- package/dist/hero-saas-dashboard-preview.cjs +88 -46
- package/dist/hero-saas-dashboard-preview.d.cts +34 -19
- package/dist/hero-saas-dashboard-preview.d.ts +34 -19
- package/dist/hero-saas-dashboard-preview.js +89 -47
- package/dist/hero-split-image-newsletter.cjs +91 -49
- package/dist/hero-split-image-newsletter.d.cts +33 -18
- package/dist/hero-split-image-newsletter.d.ts +33 -18
- package/dist/hero-split-image-newsletter.js +92 -50
- package/dist/hero-startup-launch-cta.cjs +2 -2
- package/dist/hero-startup-launch-cta.js +2 -2
- package/dist/registry.cjs +556 -345
- package/dist/registry.js +556 -345
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@ var classVarianceAuthority = require('class-variance-authority');
|
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var icon = require('@page-speed/icon');
|
|
10
10
|
var img = require('@page-speed/img');
|
|
11
|
+
var forms = require('@page-speed/forms');
|
|
12
|
+
var integration = require('@page-speed/forms/integration');
|
|
11
13
|
|
|
12
14
|
function _interopNamespace(e) {
|
|
13
15
|
if (e && e.__esModule) return e;
|
|
@@ -455,22 +457,6 @@ var DEFAULT_ICON_API_KEY = "au382bi7fsh96w9h9xlrnat2jglx";
|
|
|
455
457
|
function DynamicIcon({ apiKey, ...props }) {
|
|
456
458
|
return /* @__PURE__ */ jsxRuntime.jsx(icon.Icon, { ...props, apiKey: apiKey ?? DEFAULT_ICON_API_KEY });
|
|
457
459
|
}
|
|
458
|
-
function Input({ className, type, ...props }) {
|
|
459
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
460
|
-
"input",
|
|
461
|
-
{
|
|
462
|
-
type,
|
|
463
|
-
"data-slot": "input",
|
|
464
|
-
className: cn(
|
|
465
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
466
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
467
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
468
|
-
className
|
|
469
|
-
),
|
|
470
|
-
...props
|
|
471
|
-
}
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
460
|
var maxWidthStyles = {
|
|
475
461
|
sm: "max-w-screen-sm",
|
|
476
462
|
md: "max-w-screen-md",
|
|
@@ -846,14 +832,31 @@ var Section = React__namespace.default.forwardRef(
|
|
|
846
832
|
}
|
|
847
833
|
);
|
|
848
834
|
Section.displayName = "Section";
|
|
835
|
+
var DEFAULT_FORM_FIELDS = [
|
|
836
|
+
{
|
|
837
|
+
name: "email",
|
|
838
|
+
type: "email",
|
|
839
|
+
label: "Email Address",
|
|
840
|
+
placeholder: "Enter your email",
|
|
841
|
+
required: true,
|
|
842
|
+
columnSpan: 12
|
|
843
|
+
}
|
|
844
|
+
];
|
|
849
845
|
function HeroSaasDashboardPreview({
|
|
850
846
|
badgeText,
|
|
851
847
|
badgeIcon,
|
|
852
848
|
badgeSlot,
|
|
853
849
|
heading,
|
|
854
850
|
description,
|
|
855
|
-
|
|
856
|
-
|
|
851
|
+
formFields = DEFAULT_FORM_FIELDS,
|
|
852
|
+
formConfig,
|
|
853
|
+
onSubmit,
|
|
854
|
+
onSuccess,
|
|
855
|
+
onError,
|
|
856
|
+
successMessage,
|
|
857
|
+
buttonAction,
|
|
858
|
+
helperText,
|
|
859
|
+
formSlot,
|
|
857
860
|
browserPreview,
|
|
858
861
|
browserPreviewSlot,
|
|
859
862
|
background,
|
|
@@ -868,6 +871,18 @@ function HeroSaasDashboardPreview({
|
|
|
868
871
|
previewClassName,
|
|
869
872
|
optixFlowConfig
|
|
870
873
|
}) {
|
|
874
|
+
const { uploadTokens, uploadProgress, isUploading, uploadFiles, removeFile, resetUpload } = integration.useFileUpload({ onError });
|
|
875
|
+
const { form, submissionError, formMethod, resetSubmissionState } = integration.useContactForm({
|
|
876
|
+
formFields,
|
|
877
|
+
formConfig,
|
|
878
|
+
onSubmit,
|
|
879
|
+
onSuccess: (data) => {
|
|
880
|
+
resetUpload();
|
|
881
|
+
onSuccess?.(data);
|
|
882
|
+
},
|
|
883
|
+
onError,
|
|
884
|
+
uploadTokens
|
|
885
|
+
});
|
|
871
886
|
const renderBadge = React.useMemo(() => {
|
|
872
887
|
if (badgeSlot) return badgeSlot;
|
|
873
888
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -883,33 +898,60 @@ function HeroSaasDashboardPreview({
|
|
|
883
898
|
}
|
|
884
899
|
);
|
|
885
900
|
}, [badgeSlot, badgeIcon, badgeText]);
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
901
|
+
const renderForm = React.useMemo(() => {
|
|
902
|
+
if (formSlot) return formSlot;
|
|
903
|
+
const defaultButtonAction = {
|
|
904
|
+
label: "Start Free Trial",
|
|
905
|
+
variant: "default",
|
|
906
|
+
className: "h-12"
|
|
907
|
+
};
|
|
908
|
+
const action = buttonAction || defaultButtonAction;
|
|
909
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
910
|
+
forms.Form,
|
|
911
|
+
{
|
|
912
|
+
form,
|
|
913
|
+
notificationConfig: {
|
|
914
|
+
submissionError,
|
|
915
|
+
successMessage
|
|
916
|
+
},
|
|
917
|
+
formConfig: {
|
|
918
|
+
endpoint: formConfig?.endpoint,
|
|
919
|
+
method: formMethod,
|
|
920
|
+
submissionConfig: formConfig?.submissionConfig
|
|
921
|
+
},
|
|
922
|
+
onNewSubmission: () => {
|
|
923
|
+
resetUpload();
|
|
924
|
+
resetSubmissionState();
|
|
925
|
+
},
|
|
926
|
+
children: [
|
|
927
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-10 flex flex-col items-center gap-4 sm:flex-row sm:justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-md items-center gap-2", children: [
|
|
928
|
+
formFields.map((field) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
929
|
+
integration.DynamicFormField,
|
|
930
|
+
{
|
|
931
|
+
field,
|
|
932
|
+
uploadProgress,
|
|
933
|
+
onFileUpload: uploadFiles,
|
|
934
|
+
onFileRemove: removeFile,
|
|
935
|
+
isUploading
|
|
936
|
+
}
|
|
937
|
+
) }, field.name)),
|
|
938
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
939
|
+
Pressable,
|
|
940
|
+
{
|
|
941
|
+
onClick: form.handleSubmit,
|
|
942
|
+
asButton: true,
|
|
943
|
+
variant: action.variant,
|
|
944
|
+
className: cn("h-12", action.className),
|
|
945
|
+
disabled: form.isSubmitting,
|
|
946
|
+
children: action.label
|
|
947
|
+
}
|
|
948
|
+
)
|
|
949
|
+
] }) }),
|
|
950
|
+
helperText && (typeof helperText === "string" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("text-sm text-center mt-4"), children: helperText }) : helperText)
|
|
951
|
+
]
|
|
952
|
+
}
|
|
953
|
+
);
|
|
954
|
+
}, [formSlot, formFields, form, formConfig, formMethod, buttonAction, uploadProgress, uploadFiles, removeFile, isUploading, submissionError, successMessage, helperText, resetUpload, resetSubmissionState]);
|
|
913
955
|
const renderBrowserPreview = React.useMemo(() => {
|
|
914
956
|
if (browserPreviewSlot) return browserPreviewSlot;
|
|
915
957
|
if (!browserPreview) return null;
|
|
@@ -993,7 +1035,7 @@ function HeroSaasDashboardPreview({
|
|
|
993
1035
|
children: description
|
|
994
1036
|
}
|
|
995
1037
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: descriptionClassName, children: description })),
|
|
996
|
-
|
|
1038
|
+
renderForm
|
|
997
1039
|
] }),
|
|
998
1040
|
renderBrowserPreview
|
|
999
1041
|
] })
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bz_A5vLU.cjs';
|
|
3
|
+
import { FormFieldConfig, PageSpeedFormConfig } from '@page-speed/forms/integration';
|
|
3
4
|
import { A as ActionConfig, I as ImageItem, O as OptixFlowConfig } from './blocks-Cohq4eio.cjs';
|
|
4
5
|
import 'react/jsx-runtime';
|
|
5
6
|
import 'class-variance-authority';
|
|
6
7
|
import './button-variants-lRElsmTc.cjs';
|
|
7
8
|
import 'class-variance-authority/types';
|
|
8
9
|
|
|
9
|
-
interface EmailFormConfig {
|
|
10
|
-
/**
|
|
11
|
-
* Input placeholder text
|
|
12
|
-
*/
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Submit button action
|
|
16
|
-
*/
|
|
17
|
-
action?: ActionConfig;
|
|
18
|
-
/**
|
|
19
|
-
* Helper text below form
|
|
20
|
-
*/
|
|
21
|
-
helperText?: React.ReactNode;
|
|
22
|
-
}
|
|
23
10
|
interface BrowserPreviewConfig {
|
|
24
11
|
/**
|
|
25
12
|
* URL displayed in browser bar
|
|
@@ -52,13 +39,41 @@ interface HeroSaasDashboardPreviewProps {
|
|
|
52
39
|
*/
|
|
53
40
|
description?: React.ReactNode;
|
|
54
41
|
/**
|
|
55
|
-
*
|
|
42
|
+
* Form field configuration
|
|
43
|
+
*/
|
|
44
|
+
formFields?: FormFieldConfig[];
|
|
45
|
+
/**
|
|
46
|
+
* Form configuration for submission
|
|
47
|
+
*/
|
|
48
|
+
formConfig?: PageSpeedFormConfig;
|
|
49
|
+
/**
|
|
50
|
+
* Custom submit handler
|
|
56
51
|
*/
|
|
57
|
-
|
|
52
|
+
onSubmit?: (values: Record<string, any>) => void | Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Success callback
|
|
55
|
+
*/
|
|
56
|
+
onSuccess?: (data: unknown) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Error callback
|
|
59
|
+
*/
|
|
60
|
+
onError?: (error: Error) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Success message to display
|
|
63
|
+
*/
|
|
64
|
+
successMessage?: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Submit button configuration
|
|
67
|
+
*/
|
|
68
|
+
buttonAction?: ActionConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Helper text below form
|
|
71
|
+
*/
|
|
72
|
+
helperText?: React.ReactNode;
|
|
58
73
|
/**
|
|
59
|
-
* Custom slot for
|
|
74
|
+
* Custom slot for form (overrides form props)
|
|
60
75
|
*/
|
|
61
|
-
|
|
76
|
+
formSlot?: React.ReactNode;
|
|
62
77
|
/**
|
|
63
78
|
* Browser preview configuration
|
|
64
79
|
*/
|
|
@@ -111,6 +126,6 @@ interface HeroSaasDashboardPreviewProps {
|
|
|
111
126
|
*/
|
|
112
127
|
optixFlowConfig?: OptixFlowConfig;
|
|
113
128
|
}
|
|
114
|
-
declare function HeroSaasDashboardPreview({ badgeText, badgeIcon, badgeSlot, heading, description,
|
|
129
|
+
declare function HeroSaasDashboardPreview({ badgeText, badgeIcon, badgeSlot, heading, description, formFields, formConfig, onSubmit, onSuccess, onError, successMessage, buttonAction, helperText, formSlot, browserPreview, browserPreviewSlot, background, containerClassName, spacing, pattern, patternOpacity, className, headerClassName, headingClassName, descriptionClassName, previewClassName, optixFlowConfig, }: HeroSaasDashboardPreviewProps): React.JSX.Element;
|
|
115
130
|
|
|
116
131
|
export { HeroSaasDashboardPreview, type HeroSaasDashboardPreviewProps };
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bi_ClKrO.js';
|
|
3
|
+
import { FormFieldConfig, PageSpeedFormConfig } from '@page-speed/forms/integration';
|
|
3
4
|
import { A as ActionConfig, I as ImageItem, O as OptixFlowConfig } from './blocks-k17uluAz.js';
|
|
4
5
|
import 'react/jsx-runtime';
|
|
5
6
|
import 'class-variance-authority';
|
|
6
7
|
import './button-variants-lRElsmTc.js';
|
|
7
8
|
import 'class-variance-authority/types';
|
|
8
9
|
|
|
9
|
-
interface EmailFormConfig {
|
|
10
|
-
/**
|
|
11
|
-
* Input placeholder text
|
|
12
|
-
*/
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Submit button action
|
|
16
|
-
*/
|
|
17
|
-
action?: ActionConfig;
|
|
18
|
-
/**
|
|
19
|
-
* Helper text below form
|
|
20
|
-
*/
|
|
21
|
-
helperText?: React.ReactNode;
|
|
22
|
-
}
|
|
23
10
|
interface BrowserPreviewConfig {
|
|
24
11
|
/**
|
|
25
12
|
* URL displayed in browser bar
|
|
@@ -52,13 +39,41 @@ interface HeroSaasDashboardPreviewProps {
|
|
|
52
39
|
*/
|
|
53
40
|
description?: React.ReactNode;
|
|
54
41
|
/**
|
|
55
|
-
*
|
|
42
|
+
* Form field configuration
|
|
43
|
+
*/
|
|
44
|
+
formFields?: FormFieldConfig[];
|
|
45
|
+
/**
|
|
46
|
+
* Form configuration for submission
|
|
47
|
+
*/
|
|
48
|
+
formConfig?: PageSpeedFormConfig;
|
|
49
|
+
/**
|
|
50
|
+
* Custom submit handler
|
|
56
51
|
*/
|
|
57
|
-
|
|
52
|
+
onSubmit?: (values: Record<string, any>) => void | Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Success callback
|
|
55
|
+
*/
|
|
56
|
+
onSuccess?: (data: unknown) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Error callback
|
|
59
|
+
*/
|
|
60
|
+
onError?: (error: Error) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Success message to display
|
|
63
|
+
*/
|
|
64
|
+
successMessage?: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Submit button configuration
|
|
67
|
+
*/
|
|
68
|
+
buttonAction?: ActionConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Helper text below form
|
|
71
|
+
*/
|
|
72
|
+
helperText?: React.ReactNode;
|
|
58
73
|
/**
|
|
59
|
-
* Custom slot for
|
|
74
|
+
* Custom slot for form (overrides form props)
|
|
60
75
|
*/
|
|
61
|
-
|
|
76
|
+
formSlot?: React.ReactNode;
|
|
62
77
|
/**
|
|
63
78
|
* Browser preview configuration
|
|
64
79
|
*/
|
|
@@ -111,6 +126,6 @@ interface HeroSaasDashboardPreviewProps {
|
|
|
111
126
|
*/
|
|
112
127
|
optixFlowConfig?: OptixFlowConfig;
|
|
113
128
|
}
|
|
114
|
-
declare function HeroSaasDashboardPreview({ badgeText, badgeIcon, badgeSlot, heading, description,
|
|
129
|
+
declare function HeroSaasDashboardPreview({ badgeText, badgeIcon, badgeSlot, heading, description, formFields, formConfig, onSubmit, onSuccess, onError, successMessage, buttonAction, helperText, formSlot, browserPreview, browserPreviewSlot, background, containerClassName, spacing, pattern, patternOpacity, className, headerClassName, headingClassName, descriptionClassName, previewClassName, optixFlowConfig, }: HeroSaasDashboardPreviewProps): React.JSX.Element;
|
|
115
130
|
|
|
116
131
|
export { HeroSaasDashboardPreview, type HeroSaasDashboardPreviewProps };
|
|
@@ -4,9 +4,11 @@ import React__default, { useMemo } from 'react';
|
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
|
-
import { jsx, jsxs
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { Icon } from '@page-speed/icon';
|
|
9
9
|
import { Img } from '@page-speed/img';
|
|
10
|
+
import { Form } from '@page-speed/forms';
|
|
11
|
+
import { useFileUpload, useContactForm, DynamicFormField } from '@page-speed/forms/integration';
|
|
10
12
|
|
|
11
13
|
// components/blocks/hero/hero-saas-dashboard-preview.tsx
|
|
12
14
|
function cn(...inputs) {
|
|
@@ -434,22 +436,6 @@ var DEFAULT_ICON_API_KEY = "au382bi7fsh96w9h9xlrnat2jglx";
|
|
|
434
436
|
function DynamicIcon({ apiKey, ...props }) {
|
|
435
437
|
return /* @__PURE__ */ jsx(Icon, { ...props, apiKey: apiKey ?? DEFAULT_ICON_API_KEY });
|
|
436
438
|
}
|
|
437
|
-
function Input({ className, type, ...props }) {
|
|
438
|
-
return /* @__PURE__ */ jsx(
|
|
439
|
-
"input",
|
|
440
|
-
{
|
|
441
|
-
type,
|
|
442
|
-
"data-slot": "input",
|
|
443
|
-
className: cn(
|
|
444
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
445
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
446
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
447
|
-
className
|
|
448
|
-
),
|
|
449
|
-
...props
|
|
450
|
-
}
|
|
451
|
-
);
|
|
452
|
-
}
|
|
453
439
|
var maxWidthStyles = {
|
|
454
440
|
sm: "max-w-screen-sm",
|
|
455
441
|
md: "max-w-screen-md",
|
|
@@ -825,14 +811,31 @@ var Section = React__default.forwardRef(
|
|
|
825
811
|
}
|
|
826
812
|
);
|
|
827
813
|
Section.displayName = "Section";
|
|
814
|
+
var DEFAULT_FORM_FIELDS = [
|
|
815
|
+
{
|
|
816
|
+
name: "email",
|
|
817
|
+
type: "email",
|
|
818
|
+
label: "Email Address",
|
|
819
|
+
placeholder: "Enter your email",
|
|
820
|
+
required: true,
|
|
821
|
+
columnSpan: 12
|
|
822
|
+
}
|
|
823
|
+
];
|
|
828
824
|
function HeroSaasDashboardPreview({
|
|
829
825
|
badgeText,
|
|
830
826
|
badgeIcon,
|
|
831
827
|
badgeSlot,
|
|
832
828
|
heading,
|
|
833
829
|
description,
|
|
834
|
-
|
|
835
|
-
|
|
830
|
+
formFields = DEFAULT_FORM_FIELDS,
|
|
831
|
+
formConfig,
|
|
832
|
+
onSubmit,
|
|
833
|
+
onSuccess,
|
|
834
|
+
onError,
|
|
835
|
+
successMessage,
|
|
836
|
+
buttonAction,
|
|
837
|
+
helperText,
|
|
838
|
+
formSlot,
|
|
836
839
|
browserPreview,
|
|
837
840
|
browserPreviewSlot,
|
|
838
841
|
background,
|
|
@@ -847,6 +850,18 @@ function HeroSaasDashboardPreview({
|
|
|
847
850
|
previewClassName,
|
|
848
851
|
optixFlowConfig
|
|
849
852
|
}) {
|
|
853
|
+
const { uploadTokens, uploadProgress, isUploading, uploadFiles, removeFile, resetUpload } = useFileUpload({ onError });
|
|
854
|
+
const { form, submissionError, formMethod, resetSubmissionState } = useContactForm({
|
|
855
|
+
formFields,
|
|
856
|
+
formConfig,
|
|
857
|
+
onSubmit,
|
|
858
|
+
onSuccess: (data) => {
|
|
859
|
+
resetUpload();
|
|
860
|
+
onSuccess?.(data);
|
|
861
|
+
},
|
|
862
|
+
onError,
|
|
863
|
+
uploadTokens
|
|
864
|
+
});
|
|
850
865
|
const renderBadge = useMemo(() => {
|
|
851
866
|
if (badgeSlot) return badgeSlot;
|
|
852
867
|
return /* @__PURE__ */ jsxs(
|
|
@@ -862,33 +877,60 @@ function HeroSaasDashboardPreview({
|
|
|
862
877
|
}
|
|
863
878
|
);
|
|
864
879
|
}, [badgeSlot, badgeIcon, badgeText]);
|
|
865
|
-
const
|
|
866
|
-
if (
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
880
|
+
const renderForm = useMemo(() => {
|
|
881
|
+
if (formSlot) return formSlot;
|
|
882
|
+
const defaultButtonAction = {
|
|
883
|
+
label: "Start Free Trial",
|
|
884
|
+
variant: "default",
|
|
885
|
+
className: "h-12"
|
|
886
|
+
};
|
|
887
|
+
const action = buttonAction || defaultButtonAction;
|
|
888
|
+
return /* @__PURE__ */ jsxs(
|
|
889
|
+
Form,
|
|
890
|
+
{
|
|
891
|
+
form,
|
|
892
|
+
notificationConfig: {
|
|
893
|
+
submissionError,
|
|
894
|
+
successMessage
|
|
895
|
+
},
|
|
896
|
+
formConfig: {
|
|
897
|
+
endpoint: formConfig?.endpoint,
|
|
898
|
+
method: formMethod,
|
|
899
|
+
submissionConfig: formConfig?.submissionConfig
|
|
900
|
+
},
|
|
901
|
+
onNewSubmission: () => {
|
|
902
|
+
resetUpload();
|
|
903
|
+
resetSubmissionState();
|
|
904
|
+
},
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ jsx("div", { className: "mt-10 flex flex-col items-center gap-4 sm:flex-row sm:justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-md items-center gap-2", children: [
|
|
907
|
+
formFields.map((field) => /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
908
|
+
DynamicFormField,
|
|
909
|
+
{
|
|
910
|
+
field,
|
|
911
|
+
uploadProgress,
|
|
912
|
+
onFileUpload: uploadFiles,
|
|
913
|
+
onFileRemove: removeFile,
|
|
914
|
+
isUploading
|
|
915
|
+
}
|
|
916
|
+
) }, field.name)),
|
|
917
|
+
/* @__PURE__ */ jsx(
|
|
918
|
+
Pressable,
|
|
919
|
+
{
|
|
920
|
+
onClick: form.handleSubmit,
|
|
921
|
+
asButton: true,
|
|
922
|
+
variant: action.variant,
|
|
923
|
+
className: cn("h-12", action.className),
|
|
924
|
+
disabled: form.isSubmitting,
|
|
925
|
+
children: action.label
|
|
926
|
+
}
|
|
927
|
+
)
|
|
928
|
+
] }) }),
|
|
929
|
+
helperText && (typeof helperText === "string" ? /* @__PURE__ */ jsx("p", { className: cn("text-sm text-center mt-4"), children: helperText }) : helperText)
|
|
930
|
+
]
|
|
931
|
+
}
|
|
932
|
+
);
|
|
933
|
+
}, [formSlot, formFields, form, formConfig, formMethod, buttonAction, uploadProgress, uploadFiles, removeFile, isUploading, submissionError, successMessage, helperText, resetUpload, resetSubmissionState]);
|
|
892
934
|
const renderBrowserPreview = useMemo(() => {
|
|
893
935
|
if (browserPreviewSlot) return browserPreviewSlot;
|
|
894
936
|
if (!browserPreview) return null;
|
|
@@ -972,7 +1014,7 @@ function HeroSaasDashboardPreview({
|
|
|
972
1014
|
children: description
|
|
973
1015
|
}
|
|
974
1016
|
) : /* @__PURE__ */ jsx("div", { className: descriptionClassName, children: description })),
|
|
975
|
-
|
|
1017
|
+
renderForm
|
|
976
1018
|
] }),
|
|
977
1019
|
renderBrowserPreview
|
|
978
1020
|
] })
|