@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PageSpeedFormConfig } from '@page-speed/forms/integration';
|
|
2
|
+
import { FormFieldConfig, PageSpeedFormConfig } from '@page-speed/forms/integration';
|
|
3
3
|
import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bz_A5vLU.cjs';
|
|
4
4
|
import { A as ActionConfig } from './blocks-Cohq4eio.cjs';
|
|
5
5
|
import 'react/jsx-runtime';
|
|
@@ -7,71 +7,52 @@ import 'class-variance-authority';
|
|
|
7
7
|
import './button-variants-lRElsmTc.cjs';
|
|
8
8
|
import 'class-variance-authority/types';
|
|
9
9
|
|
|
10
|
-
interface ContactFeedbackFormValues {
|
|
11
|
-
email: string;
|
|
12
|
-
feedback: string;
|
|
13
|
-
}
|
|
14
10
|
interface ContactFeedbackProps {
|
|
15
|
-
/**
|
|
16
|
-
* Main heading text
|
|
17
|
-
*/
|
|
11
|
+
/** Main heading text */
|
|
18
12
|
heading?: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Description text below heading
|
|
21
|
-
*/
|
|
13
|
+
/** Description text below heading */
|
|
22
14
|
description?: React.ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Submit button text
|
|
25
|
-
*/
|
|
15
|
+
/** Submit button text */
|
|
26
16
|
buttonText?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Icon to display in submit button
|
|
29
|
-
*/
|
|
17
|
+
/** Icon to display in submit button */
|
|
30
18
|
buttonIcon?: React.ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Array of action configurations for custom buttons
|
|
33
|
-
*/
|
|
19
|
+
/** Array of action configurations for custom buttons */
|
|
34
20
|
actions?: ActionConfig[];
|
|
35
|
-
/**
|
|
36
|
-
* Custom slot for rendering actions (overrides actions array)
|
|
37
|
-
*/
|
|
21
|
+
/** Custom slot for rendering actions (overrides actions array) */
|
|
38
22
|
actionsSlot?: React.ReactNode;
|
|
39
23
|
/**
|
|
40
|
-
*
|
|
24
|
+
* Array of form field configurations
|
|
25
|
+
* If not provided, defaults to: first_name, last_name, email, phone, message
|
|
41
26
|
*/
|
|
42
|
-
|
|
27
|
+
formFields?: FormFieldConfig[];
|
|
43
28
|
/**
|
|
44
|
-
*
|
|
29
|
+
* Success message to display after form submission
|
|
30
|
+
* @default "Thank you! Your message has been sent successfully."
|
|
45
31
|
*/
|
|
32
|
+
successMessage?: React.ReactNode;
|
|
33
|
+
/** Additional CSS classes for the section */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Additional CSS classes for the container */
|
|
46
36
|
containerClassName?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Additional CSS classes for the header
|
|
49
|
-
*/
|
|
37
|
+
/** Additional CSS classes for the header */
|
|
50
38
|
headerClassName?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Additional CSS classes for the heading
|
|
53
|
-
*/
|
|
39
|
+
/** Additional CSS classes for the heading */
|
|
54
40
|
headingClassName?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Additional CSS classes for the description
|
|
57
|
-
*/
|
|
41
|
+
/** Additional CSS classes for the description */
|
|
58
42
|
descriptionClassName?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Additional CSS classes for the card
|
|
61
|
-
*/
|
|
43
|
+
/** Additional CSS classes for the card */
|
|
62
44
|
cardClassName?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Additional CSS classes for the card content
|
|
65
|
-
*/
|
|
45
|
+
/** Additional CSS classes for the card content */
|
|
66
46
|
cardContentClassName?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Additional CSS classes for the form
|
|
69
|
-
*/
|
|
47
|
+
/** Additional CSS classes for the form */
|
|
70
48
|
formClassName?: string;
|
|
49
|
+
/** Additional CSS classes for the submit button */
|
|
50
|
+
submitClassName?: string;
|
|
51
|
+
/** Additional CSS classes for the success message */
|
|
52
|
+
successMessageClassName?: string;
|
|
53
|
+
/** Additional CSS classes for the error message */
|
|
54
|
+
errorMessageClassName?: string;
|
|
71
55
|
/**
|
|
72
|
-
* Additional CSS classes for the submit button
|
|
73
|
-
*/
|
|
74
|
-
submitClassName?: string; /**
|
|
75
56
|
* Background style for the section
|
|
76
57
|
*/
|
|
77
58
|
background?: SectionBackground;
|
|
@@ -87,34 +68,26 @@ interface ContactFeedbackProps {
|
|
|
87
68
|
* Pattern overlay opacity (0-1)
|
|
88
69
|
*/
|
|
89
70
|
patternOpacity?: number;
|
|
90
|
-
/**
|
|
91
|
-
* Form configuration for PageSpeed forms
|
|
92
|
-
*/
|
|
71
|
+
/** Form configuration for PageSpeed forms */
|
|
93
72
|
formConfig?: PageSpeedFormConfig;
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
onSubmit?: (values: ContactFeedbackFormValues) => void | Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* Success callback
|
|
100
|
-
*/
|
|
73
|
+
/** Custom submit handler */
|
|
74
|
+
onSubmit?: (values: Record<string, any>) => void | Promise<void>;
|
|
75
|
+
/** Success callback */
|
|
101
76
|
onSuccess?: (data: unknown) => void;
|
|
102
|
-
/**
|
|
103
|
-
* Error callback
|
|
104
|
-
*/
|
|
77
|
+
/** Error callback */
|
|
105
78
|
onError?: (error: Error) => void;
|
|
106
79
|
}
|
|
107
80
|
/**
|
|
108
|
-
* ContactFeedback -
|
|
81
|
+
* ContactFeedback - Contact form with flexible field configuration
|
|
109
82
|
*
|
|
110
83
|
* @example
|
|
111
84
|
* ```tsx
|
|
112
85
|
* <ContactFeedback
|
|
113
86
|
* heading="Share Your Feedback"
|
|
114
|
-
* formConfig={{ endpoint: "/api/
|
|
87
|
+
* formConfig={{ endpoint: "/api/contact", format: "json" }}
|
|
115
88
|
* />
|
|
116
89
|
* ```
|
|
117
90
|
*/
|
|
118
|
-
declare function ContactFeedback({ heading, description, buttonText, buttonIcon, actions, actionsSlot, className, headerClassName, headingClassName, descriptionClassName, cardClassName, cardContentClassName, formClassName, submitClassName, background, spacing,
|
|
91
|
+
declare function ContactFeedback({ heading, description, buttonText, buttonIcon, actions, actionsSlot, formFields, successMessage, className, containerClassName, headerClassName, headingClassName, descriptionClassName, cardClassName, cardContentClassName, formClassName, submitClassName, successMessageClassName, errorMessageClassName, background, spacing, pattern, patternOpacity, formConfig, onSubmit, onSuccess, onError, }: ContactFeedbackProps): React.JSX.Element;
|
|
119
92
|
|
|
120
93
|
export { ContactFeedback, type ContactFeedbackProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PageSpeedFormConfig } from '@page-speed/forms/integration';
|
|
2
|
+
import { FormFieldConfig, PageSpeedFormConfig } from '@page-speed/forms/integration';
|
|
3
3
|
import { f as SectionBackground, g as SectionSpacing, t as PatternName } from './community-initiatives-Bi_ClKrO.js';
|
|
4
4
|
import { A as ActionConfig } from './blocks-k17uluAz.js';
|
|
5
5
|
import 'react/jsx-runtime';
|
|
@@ -7,71 +7,52 @@ import 'class-variance-authority';
|
|
|
7
7
|
import './button-variants-lRElsmTc.js';
|
|
8
8
|
import 'class-variance-authority/types';
|
|
9
9
|
|
|
10
|
-
interface ContactFeedbackFormValues {
|
|
11
|
-
email: string;
|
|
12
|
-
feedback: string;
|
|
13
|
-
}
|
|
14
10
|
interface ContactFeedbackProps {
|
|
15
|
-
/**
|
|
16
|
-
* Main heading text
|
|
17
|
-
*/
|
|
11
|
+
/** Main heading text */
|
|
18
12
|
heading?: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Description text below heading
|
|
21
|
-
*/
|
|
13
|
+
/** Description text below heading */
|
|
22
14
|
description?: React.ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Submit button text
|
|
25
|
-
*/
|
|
15
|
+
/** Submit button text */
|
|
26
16
|
buttonText?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Icon to display in submit button
|
|
29
|
-
*/
|
|
17
|
+
/** Icon to display in submit button */
|
|
30
18
|
buttonIcon?: React.ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Array of action configurations for custom buttons
|
|
33
|
-
*/
|
|
19
|
+
/** Array of action configurations for custom buttons */
|
|
34
20
|
actions?: ActionConfig[];
|
|
35
|
-
/**
|
|
36
|
-
* Custom slot for rendering actions (overrides actions array)
|
|
37
|
-
*/
|
|
21
|
+
/** Custom slot for rendering actions (overrides actions array) */
|
|
38
22
|
actionsSlot?: React.ReactNode;
|
|
39
23
|
/**
|
|
40
|
-
*
|
|
24
|
+
* Array of form field configurations
|
|
25
|
+
* If not provided, defaults to: first_name, last_name, email, phone, message
|
|
41
26
|
*/
|
|
42
|
-
|
|
27
|
+
formFields?: FormFieldConfig[];
|
|
43
28
|
/**
|
|
44
|
-
*
|
|
29
|
+
* Success message to display after form submission
|
|
30
|
+
* @default "Thank you! Your message has been sent successfully."
|
|
45
31
|
*/
|
|
32
|
+
successMessage?: React.ReactNode;
|
|
33
|
+
/** Additional CSS classes for the section */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Additional CSS classes for the container */
|
|
46
36
|
containerClassName?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Additional CSS classes for the header
|
|
49
|
-
*/
|
|
37
|
+
/** Additional CSS classes for the header */
|
|
50
38
|
headerClassName?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Additional CSS classes for the heading
|
|
53
|
-
*/
|
|
39
|
+
/** Additional CSS classes for the heading */
|
|
54
40
|
headingClassName?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Additional CSS classes for the description
|
|
57
|
-
*/
|
|
41
|
+
/** Additional CSS classes for the description */
|
|
58
42
|
descriptionClassName?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Additional CSS classes for the card
|
|
61
|
-
*/
|
|
43
|
+
/** Additional CSS classes for the card */
|
|
62
44
|
cardClassName?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Additional CSS classes for the card content
|
|
65
|
-
*/
|
|
45
|
+
/** Additional CSS classes for the card content */
|
|
66
46
|
cardContentClassName?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Additional CSS classes for the form
|
|
69
|
-
*/
|
|
47
|
+
/** Additional CSS classes for the form */
|
|
70
48
|
formClassName?: string;
|
|
49
|
+
/** Additional CSS classes for the submit button */
|
|
50
|
+
submitClassName?: string;
|
|
51
|
+
/** Additional CSS classes for the success message */
|
|
52
|
+
successMessageClassName?: string;
|
|
53
|
+
/** Additional CSS classes for the error message */
|
|
54
|
+
errorMessageClassName?: string;
|
|
71
55
|
/**
|
|
72
|
-
* Additional CSS classes for the submit button
|
|
73
|
-
*/
|
|
74
|
-
submitClassName?: string; /**
|
|
75
56
|
* Background style for the section
|
|
76
57
|
*/
|
|
77
58
|
background?: SectionBackground;
|
|
@@ -87,34 +68,26 @@ interface ContactFeedbackProps {
|
|
|
87
68
|
* Pattern overlay opacity (0-1)
|
|
88
69
|
*/
|
|
89
70
|
patternOpacity?: number;
|
|
90
|
-
/**
|
|
91
|
-
* Form configuration for PageSpeed forms
|
|
92
|
-
*/
|
|
71
|
+
/** Form configuration for PageSpeed forms */
|
|
93
72
|
formConfig?: PageSpeedFormConfig;
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
onSubmit?: (values: ContactFeedbackFormValues) => void | Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* Success callback
|
|
100
|
-
*/
|
|
73
|
+
/** Custom submit handler */
|
|
74
|
+
onSubmit?: (values: Record<string, any>) => void | Promise<void>;
|
|
75
|
+
/** Success callback */
|
|
101
76
|
onSuccess?: (data: unknown) => void;
|
|
102
|
-
/**
|
|
103
|
-
* Error callback
|
|
104
|
-
*/
|
|
77
|
+
/** Error callback */
|
|
105
78
|
onError?: (error: Error) => void;
|
|
106
79
|
}
|
|
107
80
|
/**
|
|
108
|
-
* ContactFeedback -
|
|
81
|
+
* ContactFeedback - Contact form with flexible field configuration
|
|
109
82
|
*
|
|
110
83
|
* @example
|
|
111
84
|
* ```tsx
|
|
112
85
|
* <ContactFeedback
|
|
113
86
|
* heading="Share Your Feedback"
|
|
114
|
-
* formConfig={{ endpoint: "/api/
|
|
87
|
+
* formConfig={{ endpoint: "/api/contact", format: "json" }}
|
|
115
88
|
* />
|
|
116
89
|
* ```
|
|
117
90
|
*/
|
|
118
|
-
declare function ContactFeedback({ heading, description, buttonText, buttonIcon, actions, actionsSlot, className, headerClassName, headingClassName, descriptionClassName, cardClassName, cardContentClassName, formClassName, submitClassName, background, spacing,
|
|
91
|
+
declare function ContactFeedback({ heading, description, buttonText, buttonIcon, actions, actionsSlot, formFields, successMessage, className, containerClassName, headerClassName, headingClassName, descriptionClassName, cardClassName, cardContentClassName, formClassName, submitClassName, successMessageClassName, errorMessageClassName, background, spacing, pattern, patternOpacity, formConfig, onSubmit, onSuccess, onError, }: ContactFeedbackProps): React.JSX.Element;
|
|
119
92
|
|
|
120
93
|
export { ContactFeedback, type ContactFeedbackProps };
|
package/dist/contact-feedback.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default from 'react';
|
|
4
|
-
import {
|
|
5
|
-
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';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
11
|
-
import { submitPageSpeedForm, PageSpeedFormSubmissionError } from '@page-speed/forms/integration';
|
|
12
10
|
|
|
13
11
|
// components/blocks/contact/contact-feedback.tsx
|
|
14
|
-
var TextInput = TextInput$1;
|
|
15
|
-
var TextArea = TextArea$1;
|
|
16
12
|
function cn(...inputs) {
|
|
17
13
|
return twMerge(clsx(inputs));
|
|
18
14
|
}
|
|
@@ -457,22 +453,6 @@ function CardContent({ className, ...props }) {
|
|
|
457
453
|
}
|
|
458
454
|
);
|
|
459
455
|
}
|
|
460
|
-
function Label({
|
|
461
|
-
className,
|
|
462
|
-
...props
|
|
463
|
-
}) {
|
|
464
|
-
return /* @__PURE__ */ jsx(
|
|
465
|
-
LabelPrimitive.Root,
|
|
466
|
-
{
|
|
467
|
-
"data-slot": "label",
|
|
468
|
-
className: cn(
|
|
469
|
-
"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",
|
|
470
|
-
className
|
|
471
|
-
),
|
|
472
|
-
...props
|
|
473
|
-
}
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
456
|
var maxWidthStyles = {
|
|
477
457
|
sm: "max-w-screen-sm",
|
|
478
458
|
md: "max-w-screen-md",
|
|
@@ -848,14 +828,60 @@ var Section = React__default.forwardRef(
|
|
|
848
828
|
}
|
|
849
829
|
);
|
|
850
830
|
Section.displayName = "Section";
|
|
831
|
+
var DEFAULT_FORM_FIELDS = [
|
|
832
|
+
{
|
|
833
|
+
name: "first_name",
|
|
834
|
+
type: "text",
|
|
835
|
+
label: "First Name",
|
|
836
|
+
placeholder: "John",
|
|
837
|
+
required: true,
|
|
838
|
+
columnSpan: 6
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
name: "last_name",
|
|
842
|
+
type: "text",
|
|
843
|
+
label: "Last Name",
|
|
844
|
+
placeholder: "Doe",
|
|
845
|
+
required: true,
|
|
846
|
+
columnSpan: 6
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
name: "email",
|
|
850
|
+
type: "email",
|
|
851
|
+
label: "Email",
|
|
852
|
+
placeholder: "john@example.com",
|
|
853
|
+
required: true,
|
|
854
|
+
columnSpan: 12
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
name: "phone",
|
|
858
|
+
type: "tel",
|
|
859
|
+
label: "Phone",
|
|
860
|
+
placeholder: "+1 (555) 000-0000",
|
|
861
|
+
required: true,
|
|
862
|
+
columnSpan: 12
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
name: "message",
|
|
866
|
+
type: "textarea",
|
|
867
|
+
label: "Message",
|
|
868
|
+
placeholder: "Your message...",
|
|
869
|
+
required: true,
|
|
870
|
+
rows: 4,
|
|
871
|
+
columnSpan: 12
|
|
872
|
+
}
|
|
873
|
+
];
|
|
851
874
|
function ContactFeedback({
|
|
852
875
|
heading,
|
|
853
876
|
description,
|
|
854
|
-
buttonText,
|
|
877
|
+
buttonText = "Submit",
|
|
855
878
|
buttonIcon,
|
|
856
879
|
actions,
|
|
857
880
|
actionsSlot,
|
|
881
|
+
formFields = DEFAULT_FORM_FIELDS,
|
|
882
|
+
successMessage = "Thank you! Your message has been sent successfully.",
|
|
858
883
|
className,
|
|
884
|
+
containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
|
|
859
885
|
headerClassName,
|
|
860
886
|
headingClassName,
|
|
861
887
|
descriptionClassName,
|
|
@@ -863,60 +889,38 @@ function ContactFeedback({
|
|
|
863
889
|
cardContentClassName,
|
|
864
890
|
formClassName,
|
|
865
891
|
submitClassName,
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
892
|
+
successMessageClassName,
|
|
893
|
+
errorMessageClassName,
|
|
894
|
+
background = "white",
|
|
895
|
+
spacing = "xl",
|
|
869
896
|
pattern,
|
|
870
|
-
patternOpacity,
|
|
897
|
+
patternOpacity = 0.1,
|
|
871
898
|
formConfig,
|
|
872
899
|
onSubmit,
|
|
873
900
|
onSuccess,
|
|
874
901
|
onError
|
|
875
902
|
}) {
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
903
|
+
const {
|
|
904
|
+
uploadTokens,
|
|
905
|
+
uploadProgress,
|
|
906
|
+
isUploading,
|
|
907
|
+
uploadFiles,
|
|
908
|
+
removeFile,
|
|
909
|
+
resetUpload
|
|
910
|
+
} = useFileUpload({ onError });
|
|
911
|
+
const { form, submissionError, formMethod, resetSubmissionState } = useContactForm({
|
|
912
|
+
formFields,
|
|
913
|
+
formConfig,
|
|
914
|
+
onSubmit,
|
|
915
|
+
onSuccess: (data) => {
|
|
916
|
+
resetUpload();
|
|
917
|
+
onSuccess?.(data);
|
|
880
918
|
},
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value))
|
|
885
|
-
return "Please enter a valid email address";
|
|
886
|
-
return void 0;
|
|
887
|
-
},
|
|
888
|
-
feedback: (value) => !value ? "Feedback is required" : void 0
|
|
889
|
-
},
|
|
890
|
-
onSubmit: async (values, helpers) => {
|
|
891
|
-
const shouldAutoSubmit = Boolean(formConfig?.endpoint);
|
|
892
|
-
if (!shouldAutoSubmit && !onSubmit) {
|
|
893
|
-
return;
|
|
894
|
-
}
|
|
895
|
-
try {
|
|
896
|
-
let result;
|
|
897
|
-
if (shouldAutoSubmit) {
|
|
898
|
-
result = await submitPageSpeedForm(values, formConfig);
|
|
899
|
-
}
|
|
900
|
-
if (onSubmit) {
|
|
901
|
-
await onSubmit(values);
|
|
902
|
-
}
|
|
903
|
-
if (shouldAutoSubmit || onSubmit) {
|
|
904
|
-
if (formConfig?.resetOnSuccess !== false) {
|
|
905
|
-
helpers.resetForm();
|
|
906
|
-
}
|
|
907
|
-
onSuccess?.(result);
|
|
908
|
-
}
|
|
909
|
-
} catch (error) {
|
|
910
|
-
if (error instanceof PageSpeedFormSubmissionError && error.formErrors) {
|
|
911
|
-
helpers.setErrors(error.formErrors);
|
|
912
|
-
}
|
|
913
|
-
onError?.(error);
|
|
914
|
-
throw error;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
919
|
+
onError,
|
|
920
|
+
resetOnSuccess: formConfig?.resetOnSuccess !== false,
|
|
921
|
+
uploadTokens
|
|
917
922
|
});
|
|
918
|
-
const
|
|
919
|
-
const actionsContent = React.useMemo(() => {
|
|
923
|
+
const actionsContent = useMemo(() => {
|
|
920
924
|
if (actionsSlot) return actionsSlot;
|
|
921
925
|
if (actions && actions.length > 0) {
|
|
922
926
|
return actions.map((action, index) => {
|
|
@@ -953,9 +957,9 @@ function ContactFeedback({
|
|
|
953
957
|
spacing,
|
|
954
958
|
pattern,
|
|
955
959
|
patternOpacity,
|
|
956
|
-
className,
|
|
960
|
+
className: cn("py-12", className),
|
|
957
961
|
containerClassName,
|
|
958
|
-
children: /* @__PURE__ */ jsxs("div", { className: "
|
|
962
|
+
children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-4xl", children: [
|
|
959
963
|
/* @__PURE__ */ jsxs("div", { className: cn("mb-10 text-center", headerClassName), children: [
|
|
960
964
|
heading && (typeof heading === "string" ? /* @__PURE__ */ jsx(
|
|
961
965
|
"h2",
|
|
@@ -982,38 +986,42 @@ function ContactFeedback({
|
|
|
982
986
|
Form,
|
|
983
987
|
{
|
|
984
988
|
form,
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
989
|
+
notificationConfig: {
|
|
990
|
+
submissionError,
|
|
991
|
+
successMessage
|
|
992
|
+
},
|
|
993
|
+
styleConfig: {
|
|
994
|
+
formClassName: cn("space-y-4", formClassName),
|
|
995
|
+
successMessageClassName,
|
|
996
|
+
errorMessageClassName
|
|
997
|
+
},
|
|
998
|
+
formConfig: {
|
|
999
|
+
endpoint: formConfig?.endpoint,
|
|
1000
|
+
method: formMethod,
|
|
1001
|
+
submissionConfig: formConfig?.submissionConfig
|
|
1002
|
+
},
|
|
1003
|
+
onNewSubmission: () => {
|
|
1004
|
+
resetUpload();
|
|
1005
|
+
resetSubmissionState();
|
|
1006
|
+
},
|
|
988
1007
|
children: [
|
|
989
|
-
/* @__PURE__ */ jsx(
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
TextArea,
|
|
1007
|
-
{
|
|
1008
|
-
...field,
|
|
1009
|
-
id: "feedback",
|
|
1010
|
-
placeholder: "Tell us what you think...",
|
|
1011
|
-
rows: 6,
|
|
1012
|
-
error: meta.touched && !!meta.error,
|
|
1013
|
-
"aria-label": "Feedback"
|
|
1014
|
-
}
|
|
1015
|
-
)
|
|
1016
|
-
] }) }),
|
|
1008
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-12 gap-6", children: formFields.map((field) => /* @__PURE__ */ jsx(
|
|
1009
|
+
"div",
|
|
1010
|
+
{
|
|
1011
|
+
className: getColumnSpanClass(field.columnSpan),
|
|
1012
|
+
children: /* @__PURE__ */ jsx(
|
|
1013
|
+
DynamicFormField,
|
|
1014
|
+
{
|
|
1015
|
+
field,
|
|
1016
|
+
uploadProgress,
|
|
1017
|
+
onFileUpload: uploadFiles,
|
|
1018
|
+
onFileRemove: removeFile,
|
|
1019
|
+
isUploading
|
|
1020
|
+
}
|
|
1021
|
+
)
|
|
1022
|
+
},
|
|
1023
|
+
field.name
|
|
1024
|
+
)) }),
|
|
1017
1025
|
actionsSlot || actions && actions.length > 0 ? actionsContent : /* @__PURE__ */ jsxs(
|
|
1018
1026
|
Pressable,
|
|
1019
1027
|
{
|