nextworks 0.2.0-alpha.11 → 0.2.0-alpha.13
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/README.md +283 -282
- package/dist/cli_manifests/blocks_manifest.json +198 -175
- package/dist/kits/blocks/.nextworks/docs/BLOCKS_QUICKSTART.md +101 -100
- package/dist/kits/blocks/.nextworks/docs/BLOCKS_README.md +105 -104
- package/dist/kits/blocks/.nextworks/docs/THEME_GUIDE.md +1 -1
- package/dist/kits/blocks/app/templates/aiworkflow/PresetThemeVars.tsx +58 -0
- package/dist/kits/blocks/app/templates/aiworkflow/README.md +46 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/CTA.tsx +44 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Contact.tsx +105 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/FAQ.tsx +63 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Features.tsx +65 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Footer.tsx +109 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Hero.tsx +636 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Navbar.tsx +90 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Pricing.tsx +86 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/ProcessTimeline.tsx +103 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/Testimonials.tsx +56 -0
- package/dist/kits/blocks/app/templates/aiworkflow/components/TrustBadges.tsx +59 -0
- package/dist/kits/blocks/app/templates/aiworkflow/page.tsx +43 -0
- package/dist/kits/blocks/app/templates/digitalagency/PresetThemeVars.tsx +80 -80
- package/dist/kits/blocks/app/templates/digitalagency/README.md +42 -42
- package/dist/kits/blocks/app/templates/digitalagency/components/Pricing.tsx +114 -114
- package/dist/kits/blocks/app/templates/digitalagency/components/Process.tsx +59 -59
- package/dist/kits/blocks/app/templates/digitalagency/components/Services.tsx +55 -55
- package/dist/kits/blocks/app/templates/digitalagency/components/Team.tsx +28 -28
- package/dist/kits/blocks/app/templates/digitalagency/components/Testimonials.tsx +65 -65
- package/dist/kits/blocks/app/templates/digitalagency/page.tsx +38 -38
- package/dist/kits/blocks/app/templates/gallery/PresetThemeVars.tsx +84 -84
- package/dist/kits/blocks/app/templates/productlaunch/PresetThemeVars.tsx +75 -75
- package/dist/kits/blocks/app/templates/productlaunch/README.md +62 -62
- package/dist/kits/blocks/app/templates/productlaunch/components/About.tsx +84 -84
- package/dist/kits/blocks/app/templates/productlaunch/components/CTA.tsx +50 -50
- package/dist/kits/blocks/app/templates/productlaunch/components/Contact.tsx +231 -231
- package/dist/kits/blocks/app/templates/productlaunch/components/FAQ.tsx +86 -86
- package/dist/kits/blocks/app/templates/productlaunch/components/Features.tsx +83 -83
- package/dist/kits/blocks/app/templates/productlaunch/components/Footer.tsx +132 -132
- package/dist/kits/blocks/app/templates/productlaunch/components/Hero.tsx +88 -88
- package/dist/kits/blocks/app/templates/productlaunch/components/Navbar.tsx +116 -116
- package/dist/kits/blocks/app/templates/productlaunch/components/Pricing.tsx +106 -106
- package/dist/kits/blocks/app/templates/productlaunch/components/ProcessTimeline.tsx +110 -110
- package/dist/kits/blocks/app/templates/productlaunch/components/ServicesGrid.tsx +68 -68
- package/dist/kits/blocks/app/templates/productlaunch/components/Team.tsx +104 -104
- package/dist/kits/blocks/app/templates/productlaunch/components/Testimonials.tsx +90 -90
- package/dist/kits/blocks/app/templates/productlaunch/components/TrustBadges.tsx +76 -76
- package/dist/kits/blocks/app/templates/productlaunch/page.tsx +43 -43
- package/dist/kits/blocks/app/templates/saasdashboard/PresetThemeVars.tsx +80 -80
- package/dist/kits/blocks/app/templates/saasdashboard/README.md +44 -44
- package/dist/kits/blocks/app/templates/saasdashboard/components/Contact.tsx +129 -129
- package/dist/kits/blocks/app/templates/saasdashboard/components/Dashboard.tsx +293 -293
- package/dist/kits/blocks/app/templates/saasdashboard/components/FAQ.tsx +55 -55
- package/dist/kits/blocks/app/templates/saasdashboard/components/Features.tsx +90 -90
- package/dist/kits/blocks/app/templates/saasdashboard/components/Footer.tsx +77 -77
- package/dist/kits/blocks/app/templates/saasdashboard/components/Hero.tsx +104 -104
- package/dist/kits/blocks/app/templates/saasdashboard/components/Hero_mask.tsx +126 -126
- package/dist/kits/blocks/app/templates/saasdashboard/components/Navbar.tsx +117 -117
- package/dist/kits/blocks/app/templates/saasdashboard/components/Pricing.tsx +90 -90
- package/dist/kits/blocks/app/templates/saasdashboard/components/SmoothScroll.tsx +96 -96
- package/dist/kits/blocks/app/templates/saasdashboard/components/Testimonials.tsx +72 -72
- package/dist/kits/blocks/app/templates/saasdashboard/components/TrustBadges.tsx +53 -53
- package/dist/kits/blocks/app/templates/saasdashboard/page.tsx +39 -39
- package/dist/kits/blocks/components/enhanced-theme-provider.tsx +195 -195
- package/dist/kits/blocks/components/providers/BlocksAppProviders.tsx +27 -27
- package/dist/kits/blocks/components/sections/About.tsx +291 -291
- package/dist/kits/blocks/components/sections/CTA.tsx +257 -257
- package/dist/kits/blocks/components/sections/Contact.tsx +267 -267
- package/dist/kits/blocks/components/sections/FAQ.tsx +214 -214
- package/dist/kits/blocks/components/sections/Features.tsx +268 -268
- package/dist/kits/blocks/components/sections/Footer.tsx +302 -302
- package/dist/kits/blocks/components/sections/HeroMotion.tsx +308 -308
- package/dist/kits/blocks/components/sections/HeroOverlay.tsx +358 -358
- package/dist/kits/blocks/components/sections/HeroProductDemo.tsx +236 -0
- package/dist/kits/blocks/components/sections/HeroSplit.tsx +352 -352
- package/dist/kits/blocks/components/sections/Navbar.tsx +350 -350
- package/dist/kits/blocks/components/sections/PortfolioSimple.tsx +549 -549
- package/dist/kits/blocks/components/sections/Pricing.tsx +264 -264
- package/dist/kits/blocks/components/sections/ProcessTimeline.tsx +325 -325
- package/dist/kits/blocks/components/sections/ServicesGrid.tsx +210 -210
- package/dist/kits/blocks/components/sections/Team.tsx +309 -309
- package/dist/kits/blocks/components/sections/Testimonials.tsx +158 -158
- package/dist/kits/blocks/components/sections/TrustBadges.tsx +162 -162
- package/dist/kits/blocks/components/sections/product-demo/ApprovalInboxPanel.tsx +125 -0
- package/dist/kits/blocks/components/sections/product-demo/DemoStage.tsx +397 -0
- package/dist/kits/blocks/components/sections/product-demo/DemoWindow.tsx +128 -0
- package/dist/kits/blocks/components/sections/product-demo/KnowledgePanel.tsx +127 -0
- package/dist/kits/blocks/components/sections/product-demo/RunConsolePanel.tsx +150 -0
- package/dist/kits/blocks/components/sections/product-demo/WorkflowStudioPanel.tsx +191 -0
- package/dist/kits/blocks/components/sections/product-demo/types.ts +193 -0
- package/dist/kits/blocks/components/theme-provider.tsx +1 -1
- package/dist/kits/blocks/components/ui/alert-dialog.tsx +134 -134
- package/dist/kits/blocks/components/ui/brand-node.tsx +121 -121
- package/dist/kits/blocks/components/ui/button.tsx +122 -122
- package/dist/kits/blocks/components/ui/card.tsx +95 -95
- package/dist/kits/blocks/components/ui/checkbox.tsx +30 -30
- package/dist/kits/blocks/components/ui/cta-button.tsx +125 -125
- package/dist/kits/blocks/components/ui/dropdown-menu.tsx +201 -201
- package/dist/kits/blocks/components/ui/feature-card.tsx +91 -91
- package/dist/kits/blocks/components/ui/input.tsx +27 -27
- package/dist/kits/blocks/components/ui/label.tsx +29 -29
- package/dist/kits/blocks/components/ui/pricing-card.tsx +120 -120
- package/dist/kits/blocks/components/ui/select.tsx +25 -25
- package/dist/kits/blocks/components/ui/skeleton.tsx +13 -13
- package/dist/kits/blocks/components/ui/table.tsx +98 -98
- package/dist/kits/blocks/components/ui/testimonial-card.tsx +108 -108
- package/dist/kits/blocks/components/ui/textarea.tsx +26 -26
- package/dist/kits/blocks/components/ui/theme-selector.tsx +243 -243
- package/dist/kits/blocks/components/ui/theme-toggle.tsx +74 -74
- package/dist/kits/blocks/components/ui/toaster.tsx +7 -7
- package/dist/kits/blocks/lib/themes.ts +400 -400
- package/dist/kits/blocks/lib/utils.ts +6 -6
- package/dist/kits/blocks/package-deps.json +3 -3
- package/package.json +1 -1
|
@@ -1,267 +1,267 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { cn } from "@/lib/utils";
|
|
5
|
-
import { Button } from "@/components/ui/button";
|
|
6
|
-
import { Input } from "@/components/ui/input";
|
|
7
|
-
import { Textarea } from "@/components/ui/textarea";
|
|
8
|
-
import { Label } from "@/components/ui/label";
|
|
9
|
-
|
|
10
|
-
// Supported field types
|
|
11
|
-
type FieldType = "text" | "email" | "tel" | "textarea";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Configuration for a single form field in the Contact section.
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface ContactField {
|
|
18
|
-
/** Unique id/name for the field. Used for htmlFor and form submission. */
|
|
19
|
-
id: string;
|
|
20
|
-
/** Visible label text for the field */
|
|
21
|
-
label: string;
|
|
22
|
-
/** Placeholder text rendered inside the input */
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
/** Whether the field is required for form submission */
|
|
25
|
-
required?: boolean;
|
|
26
|
-
/** Type of field to render (text, email, tel, textarea). */
|
|
27
|
-
type?: FieldType;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Props for the Contact section component.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* - Styling: exposes slot-style className overrides (section, container,
|
|
35
|
-
* headerWrapper, headerText, subheaderText, form, fieldsWrapper, field,
|
|
36
|
-
* label, input, textarea, submitButtonWrapper, submitButtonStyle). Consumer
|
|
37
|
-
* classes are merged after defaults via cn().
|
|
38
|
-
* - Behavior: onSubmit is called with the form event after default
|
|
39
|
-
* prevention. Provide your own handler to integrate with APIs.
|
|
40
|
-
* - Motion: controlled by enableMotion; when false, removes button hover lift.
|
|
41
|
-
* - Accessibility: rendered as a semantic <section> with aria-label.
|
|
42
|
-
*/
|
|
43
|
-
export interface ContactProps {
|
|
44
|
-
/** Array of fields to render in the form. @defaultValue defaultFormData */
|
|
45
|
-
fields?: ContactField[];
|
|
46
|
-
/** Heading text above the form. @defaultValue "Ready to Grow Your Business?" */
|
|
47
|
-
contactHeaderText?: string;
|
|
48
|
-
/** Subheading under the header. @defaultValue "Schedule a free consultation with our experts." */
|
|
49
|
-
contactSubHeaderText?: string;
|
|
50
|
-
|
|
51
|
-
/** Optional id to attach to the root section element. @defaultValue "contact" */
|
|
52
|
-
id?: string;
|
|
53
|
-
/** Optional top-level class to override the section root */
|
|
54
|
-
className?: string;
|
|
55
|
-
|
|
56
|
-
/** Styling configuration objects (slots) */
|
|
57
|
-
section?: { className?: string };
|
|
58
|
-
container?: { className?: string };
|
|
59
|
-
headerWrapper?: { className?: string };
|
|
60
|
-
headerText?: { className?: string };
|
|
61
|
-
subheaderText?: { className?: string };
|
|
62
|
-
form?: { className?: string };
|
|
63
|
-
fieldsWrapper?: { className?: string };
|
|
64
|
-
field?: { className?: string };
|
|
65
|
-
label?: { className?: string };
|
|
66
|
-
input?: { className?: string };
|
|
67
|
-
textarea?: { className?: string };
|
|
68
|
-
submitButtonWrapper?: { className?: string };
|
|
69
|
-
submitButtonStyle?: {
|
|
70
|
-
unstyled?: boolean;
|
|
71
|
-
style?: React.CSSProperties;
|
|
72
|
-
variant?:
|
|
73
|
-
| "default"
|
|
74
|
-
| "destructive"
|
|
75
|
-
| "outline"
|
|
76
|
-
| "secondary"
|
|
77
|
-
| "ghost"
|
|
78
|
-
| "link";
|
|
79
|
-
size?: "default" | "sm" | "lg" | "icon";
|
|
80
|
-
className?: string;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/** Text for the submit button. @defaultValue "Schedule Free Consultation" */
|
|
84
|
-
submitButtonText?: string;
|
|
85
|
-
/** Callback fired on submit; default prevented. */
|
|
86
|
-
onSubmit?: (e: React.FormEvent<HTMLFormElement>) => void;
|
|
87
|
-
/** ARIA label for the section. @defaultValue "Contact section" */
|
|
88
|
-
ariaLabel?: string;
|
|
89
|
-
|
|
90
|
-
/** When false, removes hover lift/transition on the submit button */
|
|
91
|
-
enableMotion?: boolean;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const defaultFormData: ContactField[] = [
|
|
95
|
-
{
|
|
96
|
-
id: "name",
|
|
97
|
-
label: "Your Full Name",
|
|
98
|
-
placeholder: "John Doe",
|
|
99
|
-
required: true,
|
|
100
|
-
type: "text",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: "email",
|
|
104
|
-
label: "Email Address",
|
|
105
|
-
placeholder: "you@example.com",
|
|
106
|
-
required: true,
|
|
107
|
-
type: "email",
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: "phone",
|
|
111
|
-
label: "Phone Number",
|
|
112
|
-
placeholder: "Enter your phone number",
|
|
113
|
-
required: false,
|
|
114
|
-
type: "tel",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: "company",
|
|
118
|
-
label: "Company",
|
|
119
|
-
placeholder: "Enter your company name",
|
|
120
|
-
required: false,
|
|
121
|
-
type: "text",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
id: "message",
|
|
125
|
-
label: "Message",
|
|
126
|
-
placeholder: "Tell us about your project...",
|
|
127
|
-
required: true,
|
|
128
|
-
type: "textarea",
|
|
129
|
-
},
|
|
130
|
-
];
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Contact section with a configurable form and submit action.
|
|
134
|
-
*
|
|
135
|
-
* @remarks
|
|
136
|
-
* - Styling: slot-style className overrides are merged via cn().
|
|
137
|
-
* - Behavior: onSubmit is invoked with the form event after calling
|
|
138
|
-
* preventDefault().
|
|
139
|
-
* - Motion: enableMotion toggles the button hover lift/transition.
|
|
140
|
-
* - Accessibility: Uses a semantic <section> with aria-label.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* <Contact onSubmit={(e) => { // send to your API }} />
|
|
144
|
-
*/
|
|
145
|
-
export function Contact({
|
|
146
|
-
fields = defaultFormData,
|
|
147
|
-
contactHeaderText = "Ready to Grow Your Business?",
|
|
148
|
-
contactSubHeaderText = "Schedule a free consultation with our experts.",
|
|
149
|
-
id = "contact",
|
|
150
|
-
className,
|
|
151
|
-
section = { className: "py-16 px-4 bg-primary" },
|
|
152
|
-
container = { className: "mx-auto max-w-4xl" },
|
|
153
|
-
headerWrapper = { className: "mb-8 text-center" },
|
|
154
|
-
headerText = {
|
|
155
|
-
className: "text-2xl font-bold font-poppins text-primary-foreground",
|
|
156
|
-
},
|
|
157
|
-
subheaderText = {
|
|
158
|
-
className: "mt-2 text-lg font-inter text-primary-foreground px-4 md:px-14",
|
|
159
|
-
},
|
|
160
|
-
form = {
|
|
161
|
-
className:
|
|
162
|
-
"bg-card p-8 rounded-lg shadow-md border border-border bg-[var(--card-bg)] text-[var(--card-fg)] border-[var(--card-border)] shadow-[var(--card-shadow)]",
|
|
163
|
-
},
|
|
164
|
-
fieldsWrapper = { className: "space-y-4" },
|
|
165
|
-
field = { className: "space-y-2" },
|
|
166
|
-
label = {
|
|
167
|
-
className:
|
|
168
|
-
"text-card-foreground text-sm font-medium font-poppins block text-[var(--label-fg)]",
|
|
169
|
-
},
|
|
170
|
-
input = {
|
|
171
|
-
className:
|
|
172
|
-
"w-full p-3 border border-input rounded-md bg-background text-foreground placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent font-inter border-[var(--input-border)] bg-[var(--input-bg)] text-[var(--input-fg)] placeholder:text-[var(--input-placeholder)] focus-visible:ring-[var(--input-focus-ring)] focus-visible:ring-offset-[var(--input-ring-offset)]",
|
|
173
|
-
},
|
|
174
|
-
textarea = {
|
|
175
|
-
className:
|
|
176
|
-
"w-full p-3 border border-input rounded-md bg-background text-foreground placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent resize-vertical min-h-[120px] font-inter border-[var(--input-border)] bg-[var(--input-bg)] text-[var(--input-fg)] placeholder:text-[var(--input-placeholder)] focus-visible:ring-[var(--input-focus-ring)] focus-visible:ring-offset-[var(--input-ring-offset)]",
|
|
177
|
-
},
|
|
178
|
-
submitButtonWrapper = { className: "pt-2" },
|
|
179
|
-
submitButtonStyle = {
|
|
180
|
-
variant: "default",
|
|
181
|
-
size: "lg",
|
|
182
|
-
className:
|
|
183
|
-
"w-full shadow-lg hover:shadow-xl transition-all duration-200 hover:-translate-y-0.5 border-[var(--btn-border)] focus-visible:ring-[var(--btn-ring)]",
|
|
184
|
-
},
|
|
185
|
-
submitButtonText = "Schedule Free Consultation",
|
|
186
|
-
onSubmit,
|
|
187
|
-
ariaLabel = "Contact section",
|
|
188
|
-
enableMotion = true,
|
|
189
|
-
}: ContactProps) {
|
|
190
|
-
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
191
|
-
e.preventDefault();
|
|
192
|
-
onSubmit?.(e);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
return (
|
|
196
|
-
<section
|
|
197
|
-
id={id}
|
|
198
|
-
className={cn("w-full", section.className, className)}
|
|
199
|
-
aria-label={ariaLabel}
|
|
200
|
-
>
|
|
201
|
-
<div className={cn(container.className)}>
|
|
202
|
-
<div className={cn(headerWrapper.className)}>
|
|
203
|
-
{contactHeaderText && (
|
|
204
|
-
<h2 className={cn(headerText.className)}>{contactHeaderText}</h2>
|
|
205
|
-
)}
|
|
206
|
-
{contactSubHeaderText && (
|
|
207
|
-
<p className={cn(subheaderText.className)}>
|
|
208
|
-
{contactSubHeaderText}
|
|
209
|
-
</p>
|
|
210
|
-
)}
|
|
211
|
-
</div>
|
|
212
|
-
<form onSubmit={handleSubmit} className={cn(form.className)}>
|
|
213
|
-
<div className={cn(fieldsWrapper.className)}>
|
|
214
|
-
{fields.map((f) => {
|
|
215
|
-
const isTextarea = f.type === "textarea";
|
|
216
|
-
return (
|
|
217
|
-
<div key={f.id} className={cn(field.className)}>
|
|
218
|
-
<Label htmlFor={f.id} className={cn(label.className)}>
|
|
219
|
-
{f.label}
|
|
220
|
-
{f.required && (
|
|
221
|
-
<span className="text-destructive ml-1">*</span>
|
|
222
|
-
)}
|
|
223
|
-
</Label>
|
|
224
|
-
{isTextarea ? (
|
|
225
|
-
<Textarea
|
|
226
|
-
id={f.id}
|
|
227
|
-
name={f.id}
|
|
228
|
-
placeholder={f.placeholder}
|
|
229
|
-
required={f.required}
|
|
230
|
-
rows={4}
|
|
231
|
-
className={cn(textarea.className)}
|
|
232
|
-
/>
|
|
233
|
-
) : (
|
|
234
|
-
<Input
|
|
235
|
-
type={f.type ?? "text"}
|
|
236
|
-
id={f.id}
|
|
237
|
-
name={f.id}
|
|
238
|
-
placeholder={f.placeholder}
|
|
239
|
-
required={f.required}
|
|
240
|
-
className={cn(input.className)}
|
|
241
|
-
/>
|
|
242
|
-
)}
|
|
243
|
-
</div>
|
|
244
|
-
);
|
|
245
|
-
})}
|
|
246
|
-
<div className={cn(submitButtonWrapper.className)}>
|
|
247
|
-
<Button
|
|
248
|
-
type="submit"
|
|
249
|
-
unstyled={submitButtonStyle.unstyled}
|
|
250
|
-
variant={submitButtonStyle.variant}
|
|
251
|
-
size={submitButtonStyle.size}
|
|
252
|
-
className={cn(
|
|
253
|
-
submitButtonStyle.className,
|
|
254
|
-
!enableMotion &&
|
|
255
|
-
"transition-none hover:!translate-y-0 hover:shadow-none",
|
|
256
|
-
)}
|
|
257
|
-
style={submitButtonStyle.style}
|
|
258
|
-
>
|
|
259
|
-
{submitButtonText}
|
|
260
|
-
</Button>
|
|
261
|
-
</div>
|
|
262
|
-
</div>
|
|
263
|
-
</form>
|
|
264
|
-
</div>
|
|
265
|
-
</section>
|
|
266
|
-
);
|
|
267
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import { Input } from "@/components/ui/input";
|
|
7
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
8
|
+
import { Label } from "@/components/ui/label";
|
|
9
|
+
|
|
10
|
+
// Supported field types
|
|
11
|
+
type FieldType = "text" | "email" | "tel" | "textarea";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for a single form field in the Contact section.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface ContactField {
|
|
18
|
+
/** Unique id/name for the field. Used for htmlFor and form submission. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Visible label text for the field */
|
|
21
|
+
label: string;
|
|
22
|
+
/** Placeholder text rendered inside the input */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** Whether the field is required for form submission */
|
|
25
|
+
required?: boolean;
|
|
26
|
+
/** Type of field to render (text, email, tel, textarea). */
|
|
27
|
+
type?: FieldType;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Props for the Contact section component.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* - Styling: exposes slot-style className overrides (section, container,
|
|
35
|
+
* headerWrapper, headerText, subheaderText, form, fieldsWrapper, field,
|
|
36
|
+
* label, input, textarea, submitButtonWrapper, submitButtonStyle). Consumer
|
|
37
|
+
* classes are merged after defaults via cn().
|
|
38
|
+
* - Behavior: onSubmit is called with the form event after default
|
|
39
|
+
* prevention. Provide your own handler to integrate with APIs.
|
|
40
|
+
* - Motion: controlled by enableMotion; when false, removes button hover lift.
|
|
41
|
+
* - Accessibility: rendered as a semantic <section> with aria-label.
|
|
42
|
+
*/
|
|
43
|
+
export interface ContactProps {
|
|
44
|
+
/** Array of fields to render in the form. @defaultValue defaultFormData */
|
|
45
|
+
fields?: ContactField[];
|
|
46
|
+
/** Heading text above the form. @defaultValue "Ready to Grow Your Business?" */
|
|
47
|
+
contactHeaderText?: string;
|
|
48
|
+
/** Subheading under the header. @defaultValue "Schedule a free consultation with our experts." */
|
|
49
|
+
contactSubHeaderText?: string;
|
|
50
|
+
|
|
51
|
+
/** Optional id to attach to the root section element. @defaultValue "contact" */
|
|
52
|
+
id?: string;
|
|
53
|
+
/** Optional top-level class to override the section root */
|
|
54
|
+
className?: string;
|
|
55
|
+
|
|
56
|
+
/** Styling configuration objects (slots) */
|
|
57
|
+
section?: { className?: string };
|
|
58
|
+
container?: { className?: string };
|
|
59
|
+
headerWrapper?: { className?: string };
|
|
60
|
+
headerText?: { className?: string };
|
|
61
|
+
subheaderText?: { className?: string };
|
|
62
|
+
form?: { className?: string };
|
|
63
|
+
fieldsWrapper?: { className?: string };
|
|
64
|
+
field?: { className?: string };
|
|
65
|
+
label?: { className?: string };
|
|
66
|
+
input?: { className?: string };
|
|
67
|
+
textarea?: { className?: string };
|
|
68
|
+
submitButtonWrapper?: { className?: string };
|
|
69
|
+
submitButtonStyle?: {
|
|
70
|
+
unstyled?: boolean;
|
|
71
|
+
style?: React.CSSProperties;
|
|
72
|
+
variant?:
|
|
73
|
+
| "default"
|
|
74
|
+
| "destructive"
|
|
75
|
+
| "outline"
|
|
76
|
+
| "secondary"
|
|
77
|
+
| "ghost"
|
|
78
|
+
| "link";
|
|
79
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
80
|
+
className?: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** Text for the submit button. @defaultValue "Schedule Free Consultation" */
|
|
84
|
+
submitButtonText?: string;
|
|
85
|
+
/** Callback fired on submit; default prevented. */
|
|
86
|
+
onSubmit?: (e: React.FormEvent<HTMLFormElement>) => void;
|
|
87
|
+
/** ARIA label for the section. @defaultValue "Contact section" */
|
|
88
|
+
ariaLabel?: string;
|
|
89
|
+
|
|
90
|
+
/** When false, removes hover lift/transition on the submit button */
|
|
91
|
+
enableMotion?: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const defaultFormData: ContactField[] = [
|
|
95
|
+
{
|
|
96
|
+
id: "name",
|
|
97
|
+
label: "Your Full Name",
|
|
98
|
+
placeholder: "John Doe",
|
|
99
|
+
required: true,
|
|
100
|
+
type: "text",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "email",
|
|
104
|
+
label: "Email Address",
|
|
105
|
+
placeholder: "you@example.com",
|
|
106
|
+
required: true,
|
|
107
|
+
type: "email",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "phone",
|
|
111
|
+
label: "Phone Number",
|
|
112
|
+
placeholder: "Enter your phone number",
|
|
113
|
+
required: false,
|
|
114
|
+
type: "tel",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "company",
|
|
118
|
+
label: "Company",
|
|
119
|
+
placeholder: "Enter your company name",
|
|
120
|
+
required: false,
|
|
121
|
+
type: "text",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "message",
|
|
125
|
+
label: "Message",
|
|
126
|
+
placeholder: "Tell us about your project...",
|
|
127
|
+
required: true,
|
|
128
|
+
type: "textarea",
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Contact section with a configurable form and submit action.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* - Styling: slot-style className overrides are merged via cn().
|
|
137
|
+
* - Behavior: onSubmit is invoked with the form event after calling
|
|
138
|
+
* preventDefault().
|
|
139
|
+
* - Motion: enableMotion toggles the button hover lift/transition.
|
|
140
|
+
* - Accessibility: Uses a semantic <section> with aria-label.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* <Contact onSubmit={(e) => { // send to your API }} />
|
|
144
|
+
*/
|
|
145
|
+
export function Contact({
|
|
146
|
+
fields = defaultFormData,
|
|
147
|
+
contactHeaderText = "Ready to Grow Your Business?",
|
|
148
|
+
contactSubHeaderText = "Schedule a free consultation with our experts.",
|
|
149
|
+
id = "contact",
|
|
150
|
+
className,
|
|
151
|
+
section = { className: "py-16 px-4 bg-primary" },
|
|
152
|
+
container = { className: "mx-auto max-w-4xl" },
|
|
153
|
+
headerWrapper = { className: "mb-8 text-center" },
|
|
154
|
+
headerText = {
|
|
155
|
+
className: "text-2xl font-bold font-poppins text-primary-foreground",
|
|
156
|
+
},
|
|
157
|
+
subheaderText = {
|
|
158
|
+
className: "mt-2 text-lg font-inter text-primary-foreground px-4 md:px-14",
|
|
159
|
+
},
|
|
160
|
+
form = {
|
|
161
|
+
className:
|
|
162
|
+
"bg-card p-8 rounded-lg shadow-md border border-border bg-[var(--card-bg)] text-[var(--card-fg)] border-[var(--card-border)] shadow-[var(--card-shadow)]",
|
|
163
|
+
},
|
|
164
|
+
fieldsWrapper = { className: "space-y-4" },
|
|
165
|
+
field = { className: "space-y-2" },
|
|
166
|
+
label = {
|
|
167
|
+
className:
|
|
168
|
+
"text-card-foreground text-sm font-medium font-poppins block text-[var(--label-fg)]",
|
|
169
|
+
},
|
|
170
|
+
input = {
|
|
171
|
+
className:
|
|
172
|
+
"w-full p-3 border border-input rounded-md bg-background text-foreground placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent font-inter border-[var(--input-border)] bg-[var(--input-bg)] text-[var(--input-fg)] placeholder:text-[var(--input-placeholder)] focus-visible:ring-[var(--input-focus-ring)] focus-visible:ring-offset-[var(--input-ring-offset)]",
|
|
173
|
+
},
|
|
174
|
+
textarea = {
|
|
175
|
+
className:
|
|
176
|
+
"w-full p-3 border border-input rounded-md bg-background text-foreground placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent resize-vertical min-h-[120px] font-inter border-[var(--input-border)] bg-[var(--input-bg)] text-[var(--input-fg)] placeholder:text-[var(--input-placeholder)] focus-visible:ring-[var(--input-focus-ring)] focus-visible:ring-offset-[var(--input-ring-offset)]",
|
|
177
|
+
},
|
|
178
|
+
submitButtonWrapper = { className: "pt-2" },
|
|
179
|
+
submitButtonStyle = {
|
|
180
|
+
variant: "default",
|
|
181
|
+
size: "lg",
|
|
182
|
+
className:
|
|
183
|
+
"w-full shadow-lg hover:shadow-xl transition-all duration-200 hover:-translate-y-0.5 border-[var(--btn-border)] focus-visible:ring-[var(--btn-ring)]",
|
|
184
|
+
},
|
|
185
|
+
submitButtonText = "Schedule Free Consultation",
|
|
186
|
+
onSubmit,
|
|
187
|
+
ariaLabel = "Contact section",
|
|
188
|
+
enableMotion = true,
|
|
189
|
+
}: ContactProps) {
|
|
190
|
+
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
onSubmit?.(e);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<section
|
|
197
|
+
id={id}
|
|
198
|
+
className={cn("w-full", section.className, className)}
|
|
199
|
+
aria-label={ariaLabel}
|
|
200
|
+
>
|
|
201
|
+
<div className={cn(container.className)}>
|
|
202
|
+
<div className={cn(headerWrapper.className)}>
|
|
203
|
+
{contactHeaderText && (
|
|
204
|
+
<h2 className={cn(headerText.className)}>{contactHeaderText}</h2>
|
|
205
|
+
)}
|
|
206
|
+
{contactSubHeaderText && (
|
|
207
|
+
<p className={cn(subheaderText.className)}>
|
|
208
|
+
{contactSubHeaderText}
|
|
209
|
+
</p>
|
|
210
|
+
)}
|
|
211
|
+
</div>
|
|
212
|
+
<form onSubmit={handleSubmit} className={cn(form.className)}>
|
|
213
|
+
<div className={cn(fieldsWrapper.className)}>
|
|
214
|
+
{fields.map((f) => {
|
|
215
|
+
const isTextarea = f.type === "textarea";
|
|
216
|
+
return (
|
|
217
|
+
<div key={f.id} className={cn(field.className)}>
|
|
218
|
+
<Label htmlFor={f.id} className={cn(label.className)}>
|
|
219
|
+
{f.label}
|
|
220
|
+
{f.required && (
|
|
221
|
+
<span className="text-destructive ml-1">*</span>
|
|
222
|
+
)}
|
|
223
|
+
</Label>
|
|
224
|
+
{isTextarea ? (
|
|
225
|
+
<Textarea
|
|
226
|
+
id={f.id}
|
|
227
|
+
name={f.id}
|
|
228
|
+
placeholder={f.placeholder}
|
|
229
|
+
required={f.required}
|
|
230
|
+
rows={4}
|
|
231
|
+
className={cn(textarea.className)}
|
|
232
|
+
/>
|
|
233
|
+
) : (
|
|
234
|
+
<Input
|
|
235
|
+
type={f.type ?? "text"}
|
|
236
|
+
id={f.id}
|
|
237
|
+
name={f.id}
|
|
238
|
+
placeholder={f.placeholder}
|
|
239
|
+
required={f.required}
|
|
240
|
+
className={cn(input.className)}
|
|
241
|
+
/>
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
244
|
+
);
|
|
245
|
+
})}
|
|
246
|
+
<div className={cn(submitButtonWrapper.className)}>
|
|
247
|
+
<Button
|
|
248
|
+
type="submit"
|
|
249
|
+
unstyled={submitButtonStyle.unstyled}
|
|
250
|
+
variant={submitButtonStyle.variant}
|
|
251
|
+
size={submitButtonStyle.size}
|
|
252
|
+
className={cn(
|
|
253
|
+
submitButtonStyle.className,
|
|
254
|
+
!enableMotion &&
|
|
255
|
+
"transition-none hover:!translate-y-0 hover:shadow-none",
|
|
256
|
+
)}
|
|
257
|
+
style={submitButtonStyle.style}
|
|
258
|
+
>
|
|
259
|
+
{submitButtonText}
|
|
260
|
+
</Button>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
</form>
|
|
264
|
+
</div>
|
|
265
|
+
</section>
|
|
266
|
+
);
|
|
267
|
+
}
|