dune-react 0.0.8 → 0.0.9
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/components/puck-base/article-card.js +1 -1
- package/dist/components/puck-base/container.d.ts +7 -1
- package/dist/components/puck-base/container.js +2 -1
- package/dist/components/puck-base/content.d.ts +1 -4
- package/dist/components/puck-base/content.js +15 -17
- package/dist/components/puck-base/core/types.d.ts +2 -2
- package/dist/components/puck-base/editor-context.d.ts +8 -0
- package/dist/components/puck-base/fields/auto-field.d.ts +1 -0
- package/dist/components/puck-base/fields/auto-field.js +131 -49
- package/dist/components/puck-base/gradient-text.js +12 -3
- package/dist/components/puck-block/banner-sections/announcement-banner-1/announcement-banner.js +1 -1
- package/dist/components/puck-block/contact-sections/api/form-leads.d.ts +16 -0
- package/dist/components/puck-block/contact-sections/api/form-leads.js +25 -0
- package/dist/components/puck-block/contact-sections/contact-us-1/contact-us.js +8 -16
- package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.d.ts +26 -0
- package/dist/components/puck-block/contact-sections/contact-us-2/contact-us-2.js +229 -0
- package/dist/components/puck-block/contact-sections/contact-us-2/index.d.ts +5 -0
- package/dist/components/puck-block/contact-sections/contact-us-2/index.js +72 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.d.ts +29 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/contact-us-3.js +245 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/index.d.ts +5 -0
- package/dist/components/puck-block/contact-sections/contact-us-3/index.js +101 -0
- package/dist/components/puck-block/cta-sections/banner-cta-1/banner-cta.js +9 -8
- package/dist/components/puck-block/cta-sections/gradient-cta-1/gradient-cta.js +3 -3
- package/dist/components/puck-block/cta-sections/gradient-cta-1/index.js +4 -4
- package/dist/components/puck-block/cta-sections/newsletter-signup-1/newsletter-signup.js +5 -4
- package/dist/components/puck-block/cta-sections/promo-section-1/promo-section.js +6 -5
- package/dist/components/puck-block/faq-sections/faq-2/faq-2.d.ts +16 -0
- package/dist/components/puck-block/faq-sections/faq-2/faq-2.js +56 -0
- package/dist/components/puck-block/faq-sections/faq-2/index.d.ts +5 -0
- package/dist/components/puck-block/faq-sections/faq-2/index.js +62 -0
- package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.d.ts +3 -4
- package/dist/components/puck-block/feature-sections/feature-cards-1/feature-cards.js +13 -3
- package/dist/components/puck-block/feature-sections/feature-cards-1/index.js +34 -14
- package/dist/components/puck-block/feature-sections/feature-showcase-1/feature-showcase.js +2 -8
- package/dist/components/puck-block/feature-sections/product-features-1/product-features.js +5 -25
- package/dist/components/puck-block/gallery-sections/gallery-1/gallery.js +3 -2
- package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.d.ts +14 -0
- package/dist/components/puck-block/gallery-sections/gallery-2/gallery-2.js +88 -0
- package/dist/components/puck-block/gallery-sections/gallery-2/index.d.ts +5 -0
- package/dist/components/puck-block/gallery-sections/gallery-2/index.js +44 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.d.ts +17 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/gallery-3.js +121 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/index.d.ts +5 -0
- package/dist/components/puck-block/gallery-sections/gallery-3/index.js +60 -0
- package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.d.ts +6 -1
- package/dist/components/puck-block/hero-sections/fullscreen-hero-1/fullscreen-hero.js +56 -20
- package/dist/components/puck-block/hero-sections/fullscreen-hero-1/index.js +12 -1
- package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.d.ts +1 -1
- package/dist/components/puck-block/hero-sections/gradient-hero-1/gradient-hero.js +9 -6
- package/dist/components/puck-block/hero-sections/gradient-hero-1/index.js +4 -4
- package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.d.ts +4 -1
- package/dist/components/puck-block/hero-sections/image-hero-1/image-hero.js +60 -62
- package/dist/components/puck-block/index.d.ts +15 -0
- package/dist/components/puck-block/location-sections/location-1/index.d.ts +5 -0
- package/dist/components/puck-block/location-sections/location-1/index.js +103 -0
- package/dist/components/puck-block/location-sections/location-1/location.d.ts +27 -0
- package/dist/components/puck-block/location-sections/location-1/location.js +143 -0
- package/dist/components/puck-block/location-sections/location-2/index.d.ts +5 -0
- package/dist/components/puck-block/location-sections/location-2/index.js +111 -0
- package/dist/components/puck-block/location-sections/location-2/location.d.ts +25 -0
- package/dist/components/puck-block/location-sections/location-2/location.js +136 -0
- package/dist/components/puck-block/location-sections/location-3/index.d.ts +5 -0
- package/dist/components/puck-block/location-sections/location-3/index.js +83 -0
- package/dist/components/puck-block/location-sections/location-3/location.d.ts +22 -0
- package/dist/components/puck-block/location-sections/location-3/location.js +129 -0
- package/dist/components/puck-block/metrics-sections/stats-2/index.d.ts +5 -0
- package/dist/components/puck-block/metrics-sections/stats-2/index.js +77 -0
- package/dist/components/puck-block/metrics-sections/stats-2/stats-2.d.ts +16 -0
- package/dist/components/puck-block/metrics-sections/stats-2/stats-2.js +59 -0
- package/dist/components/puck-block/metrics-sections/stats-3/index.d.ts +5 -0
- package/dist/components/puck-block/metrics-sections/stats-3/index.js +94 -0
- package/dist/components/puck-block/metrics-sections/stats-3/stats-3.d.ts +17 -0
- package/dist/components/puck-block/metrics-sections/stats-3/stats-3.js +60 -0
- package/dist/components/puck-block/pricing-sections/pricing-2/index.d.ts +5 -0
- package/dist/components/puck-block/pricing-sections/pricing-2/index.js +152 -0
- package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.d.ts +24 -0
- package/dist/components/puck-block/pricing-sections/pricing-2/pricing-2.js +68 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/before-after.d.ts +20 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/before-after.js +73 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/index.d.ts +5 -0
- package/dist/components/puck-block/showcase-sections/before-after-1/index.js +74 -0
- package/dist/components/puck-block/showcase-sections/case-study-1/case-study.js +2 -8
- package/dist/components/puck-block/team-sections/team-grid-1/team-grid.js +4 -24
- package/dist/components/puck-block/team-sections/team-grid-2/index.d.ts +5 -0
- package/dist/components/puck-block/team-sections/team-grid-2/index.js +63 -0
- package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.d.ts +21 -0
- package/dist/components/puck-block/team-sections/team-grid-2/team-grid-2.js +46 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/index.d.ts +5 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/index.js +54 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.d.ts +21 -0
- package/dist/components/puck-block/team-sections/team-profiles-1/team-profiles.js +107 -0
- package/dist/components/puck-block/testimonial-sections/logo-marquee-1/logo-marquee.js +2 -1
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.d.ts +5 -0
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/index.js +50 -0
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.d.ts +15 -0
- package/dist/components/puck-block/testimonial-sections/logo-wall-1/logo-wall.js +57 -0
- package/dist/components/puck-block/testimonial-sections/review-section-1/review-section.js +3 -2
- package/dist/components/puck-block/text-sections/articles-1/articles.d.ts +1 -0
- package/dist/components/puck-block/text-sections/articles-1/articles.js +19 -6
- package/dist/components/puck-block/text-sections/articles-1/index.js +16 -4
- package/dist/components/puck-block/text-sections/content-section-1/content-section.js +5 -4
- package/dist/components/puck-block/text-sections/tab-section-1/tab-section.js +3 -2
- package/dist/components/shadcn/navigation-menu.d.ts +1 -1
- package/dist/components/shadcn/navigation-menu.js +33 -0
- package/dist/index.js +104 -74
- package/package.json +1 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { cn } from "../../../../utils/css-utils.js";
|
|
6
|
+
import { CompoundContainer } from "../../../puck-base/container.js";
|
|
7
|
+
import { CompoundImage } from "../../../puck-base/image.js";
|
|
8
|
+
import { CompoundButton } from "../../../puck-base/button.js";
|
|
9
|
+
import { Input } from "../../../shadcn/input.js";
|
|
10
|
+
import { Label } from "../../../shadcn/label.js";
|
|
11
|
+
import { Textarea } from "../../../shadcn/textarea.js";
|
|
12
|
+
import { useEditorContext } from "../../../puck-base/editor-context.js";
|
|
13
|
+
import { submitFormLead } from "../api/form-leads.js";
|
|
14
|
+
const ContactUs2 = ({
|
|
15
|
+
heading,
|
|
16
|
+
description,
|
|
17
|
+
nameLabel,
|
|
18
|
+
emailLabel,
|
|
19
|
+
phoneLabel = "Phone",
|
|
20
|
+
companyLabel = "Company",
|
|
21
|
+
messageLabel,
|
|
22
|
+
button,
|
|
23
|
+
image,
|
|
24
|
+
imagePosition = "end",
|
|
25
|
+
padding,
|
|
26
|
+
sectionStyle,
|
|
27
|
+
backgroundColor
|
|
28
|
+
}) => {
|
|
29
|
+
const { isEditor: isEditorMode, siteId, domain } = useEditorContext();
|
|
30
|
+
const [name, setName] = useState("");
|
|
31
|
+
const [email, setEmail] = useState("");
|
|
32
|
+
const [phone, setPhone] = useState("");
|
|
33
|
+
const [company, setCompany] = useState("");
|
|
34
|
+
const [message, setMessage] = useState("");
|
|
35
|
+
const [submitting, setSubmitting] = useState(false);
|
|
36
|
+
const handleSubmit = async (e) => {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
if (isEditorMode) return;
|
|
39
|
+
setSubmitting(true);
|
|
40
|
+
try {
|
|
41
|
+
await submitFormLead(domain, {
|
|
42
|
+
site_id: siteId,
|
|
43
|
+
name: name || "",
|
|
44
|
+
email: email || "",
|
|
45
|
+
phone: phone || "",
|
|
46
|
+
message: message || "",
|
|
47
|
+
source_page: typeof window !== "undefined" ? window.location.pathname : ""
|
|
48
|
+
});
|
|
49
|
+
toast.success("Message sent successfully!");
|
|
50
|
+
setName("");
|
|
51
|
+
setEmail("");
|
|
52
|
+
setPhone("");
|
|
53
|
+
setCompany("");
|
|
54
|
+
setMessage("");
|
|
55
|
+
} catch (err) {
|
|
56
|
+
const msg = err instanceof Error ? err.message : "Failed to send message";
|
|
57
|
+
toast.error(msg);
|
|
58
|
+
} finally {
|
|
59
|
+
setSubmitting(false);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const contentCol = /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col justify-center lg:basis-1/2", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-8", children: [
|
|
63
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
64
|
+
heading && /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold leading-tight text-foreground lg:text-4xl", children: heading }),
|
|
65
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-base text-muted-foreground", children: description })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ jsxs("form", { className: "w-full space-y-4", onSubmit: handleSubmit, children: [
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
Label,
|
|
71
|
+
{
|
|
72
|
+
htmlFor: "contact2-name",
|
|
73
|
+
className: "text-sm font-medium text-foreground",
|
|
74
|
+
children: nameLabel
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
Input,
|
|
79
|
+
{
|
|
80
|
+
id: "contact2-name",
|
|
81
|
+
type: "text",
|
|
82
|
+
name: "name",
|
|
83
|
+
required: true,
|
|
84
|
+
className: "rounded-3xl",
|
|
85
|
+
value: name,
|
|
86
|
+
onChange: (e) => setName(e.target.value)
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
Label,
|
|
93
|
+
{
|
|
94
|
+
htmlFor: "contact2-email",
|
|
95
|
+
className: "text-sm font-medium text-foreground",
|
|
96
|
+
children: emailLabel
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Input,
|
|
101
|
+
{
|
|
102
|
+
id: "contact2-email",
|
|
103
|
+
type: "email",
|
|
104
|
+
name: "email",
|
|
105
|
+
required: true,
|
|
106
|
+
className: "rounded-3xl",
|
|
107
|
+
value: email,
|
|
108
|
+
onChange: (e) => setEmail(e.target.value)
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
Label,
|
|
115
|
+
{
|
|
116
|
+
htmlFor: "contact2-phone",
|
|
117
|
+
className: "text-sm font-medium text-foreground",
|
|
118
|
+
children: phoneLabel
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
Input,
|
|
123
|
+
{
|
|
124
|
+
id: "contact2-phone",
|
|
125
|
+
type: "tel",
|
|
126
|
+
name: "phone",
|
|
127
|
+
className: "rounded-3xl",
|
|
128
|
+
value: phone,
|
|
129
|
+
onChange: (e) => setPhone(e.target.value)
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
] }),
|
|
133
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
134
|
+
/* @__PURE__ */ jsx(
|
|
135
|
+
Label,
|
|
136
|
+
{
|
|
137
|
+
htmlFor: "contact2-company",
|
|
138
|
+
className: "text-sm font-medium text-foreground",
|
|
139
|
+
children: companyLabel
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
Input,
|
|
144
|
+
{
|
|
145
|
+
id: "contact2-company",
|
|
146
|
+
type: "text",
|
|
147
|
+
name: "company",
|
|
148
|
+
className: "rounded-3xl",
|
|
149
|
+
value: company,
|
|
150
|
+
onChange: (e) => setCompany(e.target.value)
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
Label,
|
|
157
|
+
{
|
|
158
|
+
htmlFor: "contact2-message",
|
|
159
|
+
className: "text-sm font-medium text-foreground",
|
|
160
|
+
children: messageLabel
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ jsx(
|
|
164
|
+
Textarea,
|
|
165
|
+
{
|
|
166
|
+
id: "contact2-message",
|
|
167
|
+
name: "message",
|
|
168
|
+
required: true,
|
|
169
|
+
className: "min-h-40 resize-y rounded-3xl",
|
|
170
|
+
value: message,
|
|
171
|
+
onChange: (e) => setMessage(e.target.value)
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
CompoundButton,
|
|
177
|
+
{
|
|
178
|
+
label: submitting ? "Sending..." : (button == null ? void 0 : button.label) ?? "Send Message",
|
|
179
|
+
variant: (button == null ? void 0 : button.variant) ?? "default",
|
|
180
|
+
size: (button == null ? void 0 : button.size) ?? "default",
|
|
181
|
+
icon: submitting ? "loader" : (button == null ? void 0 : button.icon) ?? "none",
|
|
182
|
+
type: "submit",
|
|
183
|
+
disabled: submitting
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] })
|
|
187
|
+
] }) });
|
|
188
|
+
const imageCol = /* @__PURE__ */ jsx(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
className: cn(
|
|
192
|
+
"relative w-full overflow-hidden rounded-3xl lg:basis-1/2 lg:self-stretch",
|
|
193
|
+
"aspect-square lg:aspect-auto"
|
|
194
|
+
),
|
|
195
|
+
children: (image == null ? void 0 : image.src) ? /* @__PURE__ */ jsx(
|
|
196
|
+
CompoundImage,
|
|
197
|
+
{
|
|
198
|
+
src: image.src,
|
|
199
|
+
alt: image.alt ?? "",
|
|
200
|
+
className: "absolute inset-0 h-full w-full object-cover"
|
|
201
|
+
}
|
|
202
|
+
) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: "Image" }) })
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
return /* @__PURE__ */ jsx(
|
|
206
|
+
CompoundContainer,
|
|
207
|
+
{
|
|
208
|
+
padding,
|
|
209
|
+
sectionStyle,
|
|
210
|
+
backgroundColor,
|
|
211
|
+
children: /* @__PURE__ */ jsxs(
|
|
212
|
+
"div",
|
|
213
|
+
{
|
|
214
|
+
className: cn("flex flex-col gap-12 lg:items-stretch", {
|
|
215
|
+
"lg:flex-row": imagePosition === "end",
|
|
216
|
+
"lg:flex-row-reverse": imagePosition === "start"
|
|
217
|
+
}),
|
|
218
|
+
children: [
|
|
219
|
+
contentCol,
|
|
220
|
+
imageCol
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
};
|
|
227
|
+
export {
|
|
228
|
+
ContactUs2
|
|
229
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { paddingDefaults, image1x1Placeholder, backgroundColor, sectionStyle, padding, image } from "../../../puck-base/core/fields.js";
|
|
2
|
+
import { ContactUs2 } from "./contact-us-2.js";
|
|
3
|
+
const conf = {
|
|
4
|
+
fields: {
|
|
5
|
+
heading: { type: "text", contentEditable: true },
|
|
6
|
+
description: { type: "textarea", contentEditable: true },
|
|
7
|
+
nameLabel: { type: "text", contentEditable: true },
|
|
8
|
+
emailLabel: { type: "text", contentEditable: true },
|
|
9
|
+
phoneLabel: { type: "text", contentEditable: true },
|
|
10
|
+
companyLabel: { type: "text", contentEditable: true },
|
|
11
|
+
messageLabel: { type: "text", contentEditable: true },
|
|
12
|
+
button: {
|
|
13
|
+
type: "object",
|
|
14
|
+
objectFields: {
|
|
15
|
+
label: { type: "text" },
|
|
16
|
+
variant: {
|
|
17
|
+
type: "select",
|
|
18
|
+
options: [
|
|
19
|
+
{ label: "Primary", value: "default" },
|
|
20
|
+
{ label: "Secondary", value: "secondary" },
|
|
21
|
+
{ label: "Outline", value: "outline" },
|
|
22
|
+
{ label: "Ghost", value: "ghost" }
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
type: "select",
|
|
27
|
+
options: [
|
|
28
|
+
{ label: "Default", value: "default" },
|
|
29
|
+
{ label: "Small", value: "sm" },
|
|
30
|
+
{ label: "Large", value: "lg" }
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
icon: {
|
|
34
|
+
type: "text"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
image,
|
|
39
|
+
imagePosition: {
|
|
40
|
+
type: "radio",
|
|
41
|
+
options: [
|
|
42
|
+
{ label: "Image Right", value: "end" },
|
|
43
|
+
{ label: "Image Left", value: "start" }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
padding,
|
|
47
|
+
sectionStyle,
|
|
48
|
+
backgroundColor
|
|
49
|
+
},
|
|
50
|
+
defaultProps: {
|
|
51
|
+
heading: "Ready to transform your fitness?",
|
|
52
|
+
description: "Tell us about your goals and we'll reach out within 24 hours to schedule your first session.",
|
|
53
|
+
nameLabel: "Your Name",
|
|
54
|
+
emailLabel: "Email Address",
|
|
55
|
+
phoneLabel: "Phone",
|
|
56
|
+
companyLabel: "Company",
|
|
57
|
+
messageLabel: "Tell us about your fitness goals",
|
|
58
|
+
button: {
|
|
59
|
+
label: "Send Message",
|
|
60
|
+
variant: "default",
|
|
61
|
+
size: "default",
|
|
62
|
+
icon: "none"
|
|
63
|
+
},
|
|
64
|
+
image: image1x1Placeholder,
|
|
65
|
+
imagePosition: "end",
|
|
66
|
+
padding: paddingDefaults
|
|
67
|
+
},
|
|
68
|
+
render: ContactUs2
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
conf
|
|
72
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CompoundContainerProps } from "@/components/puck-base/container";
|
|
2
|
+
export interface ContactUs3Button {
|
|
3
|
+
label: string;
|
|
4
|
+
variant?: string;
|
|
5
|
+
size?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ContactInfoItem {
|
|
9
|
+
icon: "phone" | "mail" | "map-pin" | "clock";
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ContactUs3Props {
|
|
14
|
+
heading?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
panelStyle?: "dark" | "primary" | "muted";
|
|
17
|
+
infoItems?: ContactInfoItem[];
|
|
18
|
+
nameLabel?: string;
|
|
19
|
+
emailLabel?: string;
|
|
20
|
+
phoneLabel?: string;
|
|
21
|
+
companyLabel?: string;
|
|
22
|
+
subjectLabel?: string;
|
|
23
|
+
messageLabel?: string;
|
|
24
|
+
button?: ContactUs3Button;
|
|
25
|
+
padding?: CompoundContainerProps["padding"];
|
|
26
|
+
sectionStyle?: CompoundContainerProps["sectionStyle"];
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const ContactUs3: ({ heading, description, panelStyle, infoItems, nameLabel, emailLabel, phoneLabel, companyLabel, subjectLabel, messageLabel, button, padding, sectionStyle, backgroundColor, }: ContactUs3Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
import { cn } from "../../../../utils/css-utils.js";
|
|
6
|
+
import { CompoundContainer } from "../../../puck-base/container.js";
|
|
7
|
+
import { CompoundButton } from "../../../puck-base/button.js";
|
|
8
|
+
import { Input } from "../../../shadcn/input.js";
|
|
9
|
+
import { Label } from "../../../shadcn/label.js";
|
|
10
|
+
import { Textarea } from "../../../shadcn/textarea.js";
|
|
11
|
+
import { useEditorContext } from "../../../puck-base/editor-context.js";
|
|
12
|
+
import { submitFormLead } from "../api/form-leads.js";
|
|
13
|
+
const ICON_PATHS = {
|
|
14
|
+
phone: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.69 14a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.62 3h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 10.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 17.92Z",
|
|
15
|
+
mail: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z M22 6l-10 7L2 6",
|
|
16
|
+
"map-pin": "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z M12 10m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",
|
|
17
|
+
clock: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Z M12 6v6l4 2"
|
|
18
|
+
};
|
|
19
|
+
const InfoIcon = ({ type }) => /* @__PURE__ */ jsx(
|
|
20
|
+
"svg",
|
|
21
|
+
{
|
|
22
|
+
width: "18",
|
|
23
|
+
height: "18",
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: "1.8",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
className: "shrink-0",
|
|
31
|
+
children: /* @__PURE__ */ jsx("path", { d: ICON_PATHS[type] })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
const PANEL_VARS = {
|
|
35
|
+
dark: {
|
|
36
|
+
wrapper: "bg-foreground text-background",
|
|
37
|
+
heading: "text-background",
|
|
38
|
+
desc: "text-background/70",
|
|
39
|
+
iconBox: "bg-background/10",
|
|
40
|
+
label: "text-background/50",
|
|
41
|
+
value: "text-background"
|
|
42
|
+
},
|
|
43
|
+
primary: {
|
|
44
|
+
wrapper: "bg-primary text-primary-foreground",
|
|
45
|
+
heading: "text-primary-foreground",
|
|
46
|
+
desc: "text-primary-foreground/75",
|
|
47
|
+
iconBox: "bg-primary-foreground/15",
|
|
48
|
+
label: "text-primary-foreground/55",
|
|
49
|
+
value: "text-primary-foreground"
|
|
50
|
+
},
|
|
51
|
+
muted: {
|
|
52
|
+
wrapper: "bg-muted text-foreground",
|
|
53
|
+
heading: "text-foreground",
|
|
54
|
+
desc: "text-muted-foreground",
|
|
55
|
+
iconBox: "bg-background",
|
|
56
|
+
label: "text-muted-foreground",
|
|
57
|
+
value: "text-foreground"
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const ContactUs3 = ({
|
|
61
|
+
heading,
|
|
62
|
+
description,
|
|
63
|
+
panelStyle = "dark",
|
|
64
|
+
infoItems = [],
|
|
65
|
+
nameLabel = "Full Name",
|
|
66
|
+
emailLabel = "Email Address",
|
|
67
|
+
phoneLabel = "Phone",
|
|
68
|
+
companyLabel = "Company",
|
|
69
|
+
subjectLabel = "Subject",
|
|
70
|
+
messageLabel = "Your Message",
|
|
71
|
+
button,
|
|
72
|
+
padding,
|
|
73
|
+
sectionStyle,
|
|
74
|
+
backgroundColor
|
|
75
|
+
}) => {
|
|
76
|
+
const { isEditor: isEditorMode, siteId, domain } = useEditorContext();
|
|
77
|
+
const [values, setValues] = useState({
|
|
78
|
+
name: "",
|
|
79
|
+
email: "",
|
|
80
|
+
phone: "",
|
|
81
|
+
company: "",
|
|
82
|
+
subject: "",
|
|
83
|
+
message: ""
|
|
84
|
+
});
|
|
85
|
+
const [submitting, setSubmitting] = useState(false);
|
|
86
|
+
const vars = PANEL_VARS[panelStyle];
|
|
87
|
+
const setValue = (field) => (e) => setValues((prev) => ({ ...prev, [field]: e.target.value }));
|
|
88
|
+
const handleSubmit = async (e) => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
if (isEditorMode) return;
|
|
91
|
+
const subjectTrim = values.subject.trim();
|
|
92
|
+
const messageForApi = subjectTrim ? `${subjectTrim}
|
|
93
|
+
|
|
94
|
+
${values.message}` : values.message;
|
|
95
|
+
setSubmitting(true);
|
|
96
|
+
try {
|
|
97
|
+
await submitFormLead(domain, {
|
|
98
|
+
site_id: siteId,
|
|
99
|
+
name: values.name || "",
|
|
100
|
+
email: values.email || "",
|
|
101
|
+
phone: values.phone || "",
|
|
102
|
+
message: messageForApi || "",
|
|
103
|
+
source_page: typeof window !== "undefined" ? window.location.pathname : ""
|
|
104
|
+
});
|
|
105
|
+
toast.success("Message sent successfully!");
|
|
106
|
+
setValues({ name: "", email: "", phone: "", company: "", subject: "", message: "" });
|
|
107
|
+
} catch (err) {
|
|
108
|
+
const msg = err instanceof Error ? err.message : "Failed to send message";
|
|
109
|
+
toast.error(msg);
|
|
110
|
+
} finally {
|
|
111
|
+
setSubmitting(false);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
return /* @__PURE__ */ jsx(
|
|
115
|
+
CompoundContainer,
|
|
116
|
+
{
|
|
117
|
+
padding,
|
|
118
|
+
sectionStyle,
|
|
119
|
+
backgroundColor,
|
|
120
|
+
className: "!p-0",
|
|
121
|
+
children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 overflow-hidden rounded-2xl border border-border lg:grid-cols-5", children: [
|
|
122
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-8 p-8 lg:col-span-2 lg:p-10 xl:p-12", vars.wrapper), children: [
|
|
123
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
124
|
+
heading && /* @__PURE__ */ jsx("h2", { className: cn("font-serif text-3xl leading-tight tracking-tighter xl:text-4xl", vars.heading), children: heading }),
|
|
125
|
+
description && /* @__PURE__ */ jsx("p", { className: cn("text-sm leading-relaxed", vars.desc), children: description })
|
|
126
|
+
] }),
|
|
127
|
+
infoItems.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: infoItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
128
|
+
/* @__PURE__ */ jsx("div", { className: cn("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg", vars.iconBox), children: /* @__PURE__ */ jsx(InfoIcon, { type: item.icon }) }),
|
|
129
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: cn("text-xs font-medium uppercase tracking-wide", vars.label), children: item.label }),
|
|
131
|
+
/* @__PURE__ */ jsx("span", { className: cn("whitespace-pre-line text-sm font-medium", vars.value), children: item.value })
|
|
132
|
+
] })
|
|
133
|
+
] }, i)) })
|
|
134
|
+
] }),
|
|
135
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col justify-center p-8 lg:col-span-3 lg:p-10 xl:p-12", children: /* @__PURE__ */ jsxs("form", { className: "flex flex-col gap-5", onSubmit: handleSubmit, children: [
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-5 sm:grid-cols-2", children: [
|
|
137
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
138
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: "cu3-name", className: "text-sm font-medium", children: [
|
|
139
|
+
nameLabel,
|
|
140
|
+
" ",
|
|
141
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "*" })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsx(
|
|
144
|
+
Input,
|
|
145
|
+
{
|
|
146
|
+
id: "cu3-name",
|
|
147
|
+
type: "text",
|
|
148
|
+
required: true,
|
|
149
|
+
value: values.name,
|
|
150
|
+
onChange: setValue("name")
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
155
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: "cu3-email", className: "text-sm font-medium", children: [
|
|
156
|
+
emailLabel,
|
|
157
|
+
" ",
|
|
158
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "*" })
|
|
159
|
+
] }),
|
|
160
|
+
/* @__PURE__ */ jsx(
|
|
161
|
+
Input,
|
|
162
|
+
{
|
|
163
|
+
id: "cu3-email",
|
|
164
|
+
type: "email",
|
|
165
|
+
required: true,
|
|
166
|
+
value: values.email,
|
|
167
|
+
onChange: setValue("email")
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] })
|
|
171
|
+
] }),
|
|
172
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-5 sm:grid-cols-2", children: [
|
|
173
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
174
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "cu3-phone", className: "text-sm font-medium", children: phoneLabel }),
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
Input,
|
|
177
|
+
{
|
|
178
|
+
id: "cu3-phone",
|
|
179
|
+
type: "tel",
|
|
180
|
+
value: values.phone,
|
|
181
|
+
onChange: setValue("phone")
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
] }),
|
|
185
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
186
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "cu3-company", className: "text-sm font-medium", children: companyLabel }),
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
Input,
|
|
189
|
+
{
|
|
190
|
+
id: "cu3-company",
|
|
191
|
+
type: "text",
|
|
192
|
+
value: values.company,
|
|
193
|
+
onChange: setValue("company")
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] })
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
199
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "cu3-subject", className: "text-sm font-medium", children: subjectLabel }),
|
|
200
|
+
/* @__PURE__ */ jsx(
|
|
201
|
+
Input,
|
|
202
|
+
{
|
|
203
|
+
id: "cu3-subject",
|
|
204
|
+
type: "text",
|
|
205
|
+
value: values.subject,
|
|
206
|
+
onChange: setValue("subject")
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
] }),
|
|
210
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
211
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: "cu3-message", className: "text-sm font-medium", children: [
|
|
212
|
+
messageLabel,
|
|
213
|
+
" ",
|
|
214
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "*" })
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
Textarea,
|
|
218
|
+
{
|
|
219
|
+
id: "cu3-message",
|
|
220
|
+
required: true,
|
|
221
|
+
className: "min-h-36 resize-y",
|
|
222
|
+
value: values.message,
|
|
223
|
+
onChange: setValue("message")
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ jsx("div", { className: "pt-1", children: /* @__PURE__ */ jsx(
|
|
228
|
+
CompoundButton,
|
|
229
|
+
{
|
|
230
|
+
label: submitting ? "Sending..." : (button == null ? void 0 : button.label) ?? "Send Message",
|
|
231
|
+
variant: (button == null ? void 0 : button.variant) ?? "default",
|
|
232
|
+
size: (button == null ? void 0 : button.size) ?? "default",
|
|
233
|
+
icon: submitting ? "loader" : (button == null ? void 0 : button.icon) ?? "send",
|
|
234
|
+
type: "submit",
|
|
235
|
+
disabled: submitting
|
|
236
|
+
}
|
|
237
|
+
) })
|
|
238
|
+
] }) })
|
|
239
|
+
] })
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
export {
|
|
244
|
+
ContactUs3
|
|
245
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { paddingDefaults, backgroundColor, sectionStyle, padding } from "../../../puck-base/core/fields.js";
|
|
2
|
+
import { ContactUs3 } from "./contact-us-3.js";
|
|
3
|
+
const defaultInfoItems = [
|
|
4
|
+
{ icon: "phone", label: "Phone", value: "+1 (555) 000-0000" },
|
|
5
|
+
{ icon: "mail", label: "Email", value: "hello@mybusiness.com" },
|
|
6
|
+
{ icon: "map-pin", label: "Address", value: "123 Main Street\nNew York, NY 10001" },
|
|
7
|
+
{ icon: "clock", label: "Hours", value: "Mon–Fri: 9am–6pm\nSat: 10am–4pm" }
|
|
8
|
+
];
|
|
9
|
+
const conf = {
|
|
10
|
+
fields: {
|
|
11
|
+
heading: { type: "textarea", contentEditable: true },
|
|
12
|
+
description: { type: "textarea", contentEditable: true },
|
|
13
|
+
panelStyle: {
|
|
14
|
+
type: "radio",
|
|
15
|
+
label: "Panel Style",
|
|
16
|
+
options: [
|
|
17
|
+
{ label: "Dark", value: "dark" },
|
|
18
|
+
{ label: "Primary", value: "primary" },
|
|
19
|
+
{ label: "Muted", value: "muted" }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
infoItems: {
|
|
23
|
+
type: "array",
|
|
24
|
+
min: 0,
|
|
25
|
+
max: 6,
|
|
26
|
+
getItemSummary: (item, index = 0) => item.label || `Info ${index + 1}`,
|
|
27
|
+
arrayFields: {
|
|
28
|
+
icon: {
|
|
29
|
+
type: "select",
|
|
30
|
+
label: "Icon",
|
|
31
|
+
options: [
|
|
32
|
+
{ label: "Phone", value: "phone" },
|
|
33
|
+
{ label: "Email", value: "mail" },
|
|
34
|
+
{ label: "Location", value: "map-pin" },
|
|
35
|
+
{ label: "Clock", value: "clock" }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
label: { type: "text", contentEditable: true },
|
|
39
|
+
value: { type: "textarea", contentEditable: true }
|
|
40
|
+
},
|
|
41
|
+
defaultItemProps: { icon: "phone", label: "Phone", value: "+1 (555) 000-0000" }
|
|
42
|
+
},
|
|
43
|
+
nameLabel: { type: "text", contentEditable: true },
|
|
44
|
+
emailLabel: { type: "text", contentEditable: true },
|
|
45
|
+
phoneLabel: { type: "text", contentEditable: true },
|
|
46
|
+
companyLabel: { type: "text", contentEditable: true },
|
|
47
|
+
subjectLabel: { type: "text", contentEditable: true },
|
|
48
|
+
messageLabel: { type: "text", contentEditable: true },
|
|
49
|
+
button: {
|
|
50
|
+
type: "object",
|
|
51
|
+
label: "Submit Button",
|
|
52
|
+
objectFields: {
|
|
53
|
+
label: { type: "text" },
|
|
54
|
+
variant: {
|
|
55
|
+
type: "select",
|
|
56
|
+
options: [
|
|
57
|
+
{ label: "Primary", value: "default" },
|
|
58
|
+
{ label: "Secondary", value: "secondary" },
|
|
59
|
+
{ label: "Outline", value: "outline" },
|
|
60
|
+
{ label: "Ghost", value: "ghost" }
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
size: {
|
|
64
|
+
type: "select",
|
|
65
|
+
options: [
|
|
66
|
+
{ label: "Default", value: "default" },
|
|
67
|
+
{ label: "Small", value: "sm" },
|
|
68
|
+
{ label: "Large", value: "lg" }
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
icon: { type: "text" }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
padding,
|
|
75
|
+
sectionStyle,
|
|
76
|
+
backgroundColor
|
|
77
|
+
},
|
|
78
|
+
defaultProps: {
|
|
79
|
+
heading: "Let's start a\nconversation",
|
|
80
|
+
description: "Have a question or ready to get started? Fill out the form and we'll get back to you within 24 hours.",
|
|
81
|
+
panelStyle: "dark",
|
|
82
|
+
infoItems: defaultInfoItems,
|
|
83
|
+
nameLabel: "Full Name",
|
|
84
|
+
emailLabel: "Email Address",
|
|
85
|
+
phoneLabel: "Phone",
|
|
86
|
+
companyLabel: "Company",
|
|
87
|
+
subjectLabel: "Subject",
|
|
88
|
+
messageLabel: "Your Message",
|
|
89
|
+
button: {
|
|
90
|
+
label: "Send Message",
|
|
91
|
+
variant: "default",
|
|
92
|
+
size: "default",
|
|
93
|
+
icon: "send"
|
|
94
|
+
},
|
|
95
|
+
padding: paddingDefaults
|
|
96
|
+
},
|
|
97
|
+
render: ContactUs3
|
|
98
|
+
};
|
|
99
|
+
export {
|
|
100
|
+
conf
|
|
101
|
+
};
|