blocks-dusted 0.1.12 → 0.1.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.
Files changed (148) hide show
  1. package/package.json +1 -1
  2. package/src/installers/patchRenderBlocks.js +1 -1
  3. package/src/registry/validateTemplateManifest.js +2 -1
  4. package/templates/blocks/BannerDD790432/Component.tsx +63 -0
  5. package/templates/blocks/BannerDD790432/config.ts +54 -0
  6. package/templates/blocks/BannerDD790432/manifest.json +80 -0
  7. package/templates/blocks/Button47/Component.tsx +124 -0
  8. package/templates/blocks/Button47/config.ts +75 -0
  9. package/templates/blocks/Button47/link.ts +22 -0
  10. package/templates/blocks/Button47/manifest.json +105 -0
  11. package/templates/blocks/Button47/styles.module.scss +75 -0
  12. package/templates/blocks/DD-Accordion/Component.tsx +55 -36
  13. package/templates/blocks/DD-Accordion/config.ts +71 -59
  14. package/templates/blocks/DD-AnimText/Component.tsx +50 -32
  15. package/templates/blocks/DD-AnimText/config.ts +296 -295
  16. package/templates/blocks/DD-AsideNav/Component.tsx +323 -319
  17. package/templates/blocks/DD-Banner/Component.tsx +54 -51
  18. package/templates/blocks/DD-BookCall/Component.tsx +535 -535
  19. package/templates/blocks/DD-ButtonPop/Component.tsx +118 -117
  20. package/templates/blocks/DD-Card/Component.tsx +4 -4
  21. package/templates/blocks/DD-CardTemplate01/Component.tsx +139 -140
  22. package/templates/blocks/DD-CardsWithVariantV3/Component.tsx +472 -0
  23. package/templates/blocks/DD-CardsWithVariantV3/ElectricBorder/index.tsx +203 -0
  24. package/templates/blocks/DD-CardsWithVariantV3/ElectricBorder/styles.ts +87 -0
  25. package/templates/blocks/DD-CardsWithVariantV3/ElectricBorder/useInjectStyle.ts +39 -0
  26. package/templates/blocks/DD-CardsWithVariantV3/config.ts +326 -0
  27. package/templates/blocks/DD-CardsWithVariantV3/manifest.json +110 -0
  28. package/templates/blocks/DD-Carousel-A/Component.tsx +251 -249
  29. package/templates/blocks/DD-Carousel-B/Component.tsx +405 -403
  30. package/templates/blocks/DD-ComparisonTable/Component.tsx +255 -256
  31. package/templates/blocks/DD-Contact/Component.tsx +433 -435
  32. package/templates/blocks/DD-Counter/Component.tsx +11 -6
  33. package/templates/blocks/DD-DeliCard/Component.tsx +303 -0
  34. package/templates/blocks/DD-DeliCard/config.ts +186 -0
  35. package/templates/blocks/DD-DeliCard/manifest.json +94 -0
  36. package/templates/blocks/DD-FeatCat/Component.tsx +302 -302
  37. package/templates/blocks/DD-FeatProd/CircularGallery.tsx +1179 -0
  38. package/templates/blocks/DD-FeatProd/Component.tsx +484 -0
  39. package/templates/blocks/DD-FeatProd/config.ts +173 -0
  40. package/templates/blocks/DD-FeatProd/manifest.json +93 -0
  41. package/templates/blocks/DD-FeatServ/Component.tsx +607 -0
  42. package/templates/blocks/DD-FeatServ/config.ts +213 -0
  43. package/templates/blocks/DD-FeatServ/manifest.json +113 -0
  44. package/templates/blocks/DD-FeatStrip/Component.tsx +584 -585
  45. package/templates/blocks/DD-FluidBtn/ButtonsEyeCatching.tsx +627 -628
  46. package/templates/blocks/DD-FluidBtn/Component.tsx +46 -43
  47. package/templates/blocks/DD-GooeyInfo/Component.tsx +150 -149
  48. package/templates/blocks/DD-GooeyInfo/config.ts +136 -135
  49. package/templates/blocks/DD-Hero/Component.tsx +296 -297
  50. package/templates/blocks/DD-HeroPlas/Component.tsx +50 -0
  51. package/templates/blocks/DD-HeroPlas/ThreeScene.tsx +109 -0
  52. package/templates/blocks/DD-HeroPlas/config.ts +33 -0
  53. package/templates/blocks/DD-HeroPlas/manifest.json +88 -0
  54. package/templates/blocks/DD-HorizontalScroll/Component.tsx +937 -936
  55. package/templates/blocks/DD-Icon/Component.tsx +46 -81
  56. package/templates/blocks/DD-IconButton/Component.tsx +13 -20
  57. package/templates/blocks/DD-IdTag/Component.tsx +22 -21
  58. package/templates/blocks/DD-LineAnim/Component.tsx +42 -36
  59. package/templates/blocks/DD-LogoMarq/Component.tsx +38 -48
  60. package/templates/blocks/DD-Lottie/Component.tsx +11 -3
  61. package/templates/blocks/DD-MasonaryMedia/Component.tsx +544 -545
  62. package/templates/blocks/DD-MasonaryMedia/config.ts +389 -389
  63. package/templates/blocks/DD-Masonry/Component.tsx +654 -644
  64. package/templates/blocks/DD-Masonry/config.ts +475 -475
  65. package/templates/blocks/DD-MaterialSwatches/Component.tsx +85 -0
  66. package/templates/blocks/DD-MaterialSwatches/config.ts +232 -0
  67. package/templates/blocks/DD-MaterialSwatches/manifest.json +84 -0
  68. package/templates/blocks/DD-MaterialSwatches/material.ts +107 -0
  69. package/templates/blocks/DD-NineCanvas/Component.tsx +129 -0
  70. package/templates/blocks/DD-NineCanvas/RenderBlocks.tsx +244 -0
  71. package/templates/blocks/DD-NineCanvas/allowedCanvasBlocks.ts +6 -0
  72. package/templates/blocks/DD-NineCanvas/blockComponents.tsx +8 -0
  73. package/templates/blocks/DD-NineCanvas/canvas/CanvasGrid.tsx +316 -0
  74. package/templates/blocks/DD-NineCanvas/canvas/RadialNav.tsx +432 -0
  75. package/templates/blocks/DD-NineCanvas/canvas/canvas-panels.css +889 -0
  76. package/templates/blocks/DD-NineCanvas/canvas/icons/custom-icons.tsx +364 -0
  77. package/templates/blocks/DD-NineCanvas/config.ts +61 -0
  78. package/templates/blocks/DD-NineCanvas/manifest.json +165 -0
  79. package/templates/blocks/DD-NineCanvas/styles.scss +152 -0
  80. package/templates/blocks/DD-NineCanvas/tooltip/get-strict-context.tsx +26 -0
  81. package/templates/blocks/DD-NineCanvas/tooltip/primitives.tsx +178 -0
  82. package/templates/blocks/DD-NineCanvas/tooltip/tooltip.tsx +71 -0
  83. package/templates/blocks/DD-NineCanvas/tooltip/use-controlled-state.tsx +33 -0
  84. package/templates/blocks/DD-NineCanvas/utilities/FadeOnScroll.tsx +68 -0
  85. package/templates/blocks/DD-NineCanvas/utilities/ParallaxWrapper.tsx +157 -0
  86. package/templates/blocks/DD-NineCanvas/utilities/renderCustomCSS.ts +5 -0
  87. package/templates/blocks/DD-NineCanvas/utilities/webglCleanup.ts +27 -0
  88. package/templates/blocks/DD-PayloadAIAssistant/Component.tsx +78 -0
  89. package/templates/blocks/DD-PayloadAIAssistant/DustedBot.tsx +590 -0
  90. package/templates/blocks/DD-PayloadAIAssistant/config.ts +37 -0
  91. package/templates/blocks/DD-PayloadAIAssistant/demo.css +125 -0
  92. package/templates/blocks/DD-PayloadAIAssistant/manifest.json +93 -0
  93. package/templates/blocks/DD-PayloadAIAssistant/source-defaults.ts +17 -0
  94. package/templates/blocks/DD-PayloadAIAssistant/styles.ts +306 -0
  95. package/templates/blocks/DD-Pricing/Component.tsx +2 -3
  96. package/templates/blocks/DD-Pricing/config.ts +215 -215
  97. package/templates/blocks/DD-Process/Component.tsx +2 -2
  98. package/templates/blocks/DD-ProjHeader/Component.tsx +93 -91
  99. package/templates/blocks/DD-ProjSlider/Component.tsx +1 -1
  100. package/templates/blocks/DD-Section/Component.tsx +265 -266
  101. package/templates/blocks/DD-Separator/Component.tsx +66 -66
  102. package/templates/blocks/DD-Services/Component.tsx +176 -176
  103. package/templates/blocks/DD-ShowcaseGrid/Component.tsx +306 -307
  104. package/templates/blocks/DD-Slider-A/Component.tsx +2 -2
  105. package/templates/blocks/DD-StackCards/Component.tsx +172 -171
  106. package/templates/blocks/DD-Team/Component.tsx +247 -247
  107. package/templates/blocks/DD-TeamCards/Component.tsx +251 -251
  108. package/templates/blocks/DD-TechStack/Component.tsx +173 -174
  109. package/templates/blocks/DD-TestMarq/Component.tsx +158 -132
  110. package/templates/blocks/DD-Testim/Component.tsx +247 -247
  111. package/templates/blocks/DD-Testim2/Component.tsx +265 -256
  112. package/templates/blocks/DD-Testimonials/Component.tsx +139 -139
  113. package/templates/blocks/DD-Thanks/Component.tsx +1 -1
  114. package/templates/blocks/DD-Work/Component.tsx +318 -318
  115. package/templates/blocks/DD-Work-B/Component.tsx +294 -294
  116. package/templates/blocks/DDHG-CTASection2/Component.tsx +183 -184
  117. package/templates/blocks/DDHG-HighlightArc/Component.tsx +6 -3
  118. package/templates/blocks/DDHG-LogoMarquee/Component.tsx +45 -8
  119. package/templates/blocks/DDHG-NavCodeGrid/Component.tsx +1 -3
  120. package/templates/blocks/DDHG-ServiceDetails/ServiceDetailCard.tsx +9 -22
  121. package/templates/blocks/DDHG-ServiceHero/Component.tsx +10 -10
  122. package/templates/blocks/DDHG-TeamCards/Component.tsx +6 -35
  123. package/templates/blocks/Form/Checkbox/index.tsx +45 -0
  124. package/templates/blocks/Form/Component.tsx +163 -0
  125. package/templates/blocks/Form/Country/index.tsx +65 -0
  126. package/templates/blocks/Form/Country/options.ts +982 -0
  127. package/templates/blocks/Form/Email/index.tsx +38 -0
  128. package/templates/blocks/Form/Error/index.tsx +15 -0
  129. package/templates/blocks/Form/Message/index.tsx +13 -0
  130. package/templates/blocks/Form/Number/index.tsx +36 -0
  131. package/templates/blocks/Form/Select/index.tsx +63 -0
  132. package/templates/blocks/Form/State/index.tsx +64 -0
  133. package/templates/blocks/Form/State/options.ts +52 -0
  134. package/templates/blocks/Form/Text/index.tsx +32 -0
  135. package/templates/blocks/Form/Textarea/index.tsx +40 -0
  136. package/templates/blocks/Form/Width/index.tsx +13 -0
  137. package/templates/blocks/Form/config.ts +51 -0
  138. package/templates/blocks/Form/fields.tsx +21 -0
  139. package/templates/blocks/Form/manifest.json +168 -0
  140. package/templates/blocks/MediaBlock/Component.tsx +67 -0
  141. package/templates/blocks/MediaBlock/config.ts +14 -0
  142. package/templates/blocks/MediaBlock/manifest.json +92 -0
  143. package/templates/blocks/TransitionsDustedShowcase/Component.tsx +9 -0
  144. package/templates/blocks/TransitionsDustedShowcase/config.ts +13 -0
  145. package/templates/blocks/TransitionsDustedShowcase/manifest.json +80 -0
  146. package/templates/blocks/rawHtml/Component.tsx +25 -0
  147. package/templates/blocks/rawHtml/config.ts +56 -0
  148. package/templates/blocks/rawHtml/manifest.json +80 -0
@@ -1,435 +1,433 @@
1
- 'use client'
2
- import React, { type FormEvent, useMemo, useState } from 'react'
3
- import * as LucideIcons from 'lucide-react'
4
- import { Check, Loader2, Send } from 'lucide-react'
5
- import { Input } from '@/components/ui/input'
6
- import { getClientSideURL } from '@/utilities/getURL'
7
-
8
- type Status = 'idle' | 'submitting' | 'success' | 'error'
9
- export type DDContactProps = {
10
- eyebrow?: string | null
11
- headlineMain?: string | null
12
- headlineAccent?: string | null
13
- description?: string | null
14
- infoItems?: Array<{
15
- iconName?: string | null
16
- title: string
17
- description: string
18
- }> | null
19
- availabilityActive?: boolean | null
20
- availabilityLabel?: string | null
21
- availabilitySubtext?: string | null
22
- form?: string | number | { id?: string | number } | null
23
- serviceOptions?: Array<{ label: string }> | null
24
- budgetOptions?: Array<{ label: string }> | null
25
- timelineOptions?: Array<{ label: string }> | null
26
- sectionId?: string | null
27
- customCSS?: string | null
28
- }
29
- function DynamicIcon({
30
- name,
31
- size = 16,
32
- ...props
33
- }: { name?: string | null } & Omit<LucideIcons.LucideProps, 'name'>) {
34
- if (!name) return null
35
- const Icon = (LucideIcons as unknown as Record<string, React.FC<LucideIcons.LucideProps>>)[name]
36
- if (!Icon) return null
37
- return <Icon size={size} {...props} />
38
- }
39
-
40
- export const DDContact: React.FC<DDContactProps> = ({
41
- eyebrow,
42
- headlineMain,
43
- headlineAccent,
44
- description,
45
- infoItems,
46
- availabilityActive,
47
- availabilityLabel,
48
- availabilitySubtext,
49
- form,
50
- serviceOptions,
51
- budgetOptions,
52
- timelineOptions,
53
- sectionId,
54
- customCSS,
55
- }) => {
56
- const [status, setStatus] = useState<Status>('idle')
57
- const [charCount, setCharCount] = useState(0)
58
-
59
- const formID = typeof form === 'object' && form !== null ? form.id : form
60
-
61
- const formIdentifier = useMemo(() => {
62
- const safeSection = (sectionId || 'contact').toLowerCase().replace(/[^a-z0-9-_]/g, '-')
63
-
64
- return `studio-contact-${String(formID || 'unknown')}-${safeSection}`
65
- }, [formID, sectionId])
66
-
67
- const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
68
- e.preventDefault()
69
- const formElement = e.currentTarget
70
- const data = new FormData(formElement)
71
-
72
- const message = data.get('message') as string
73
- if (message && message.length > 500) return
74
-
75
- setStatus('submitting')
76
-
77
- const submissionData = [
78
- { field: 'name', value: data.get('name') },
79
- { field: 'email', value: data.get('email') },
80
- { field: 'company', value: data.get('company') },
81
- { field: 'service', value: data.get('service') },
82
- { field: 'budget', value: data.get('budget') },
83
- { field: 'timeline', value: data.get('timeline') },
84
- { field: 'message', value: data.get('message') },
85
- ]
86
-
87
- if (!formID) {
88
- setStatus('success')
89
- formElement.reset()
90
- setCharCount(0)
91
- return
92
- }
93
-
94
- try {
95
- const res = await fetch(`${getClientSideURL()}/api/form-submissions`, {
96
- method: 'POST',
97
- headers: {
98
- 'Content-Type': 'application/json',
99
- },
100
- body: JSON.stringify({
101
- form: formID,
102
- submissionData,
103
- }),
104
- })
105
-
106
- if (res.ok) {
107
- setStatus('success')
108
- formElement.reset()
109
- setCharCount(0)
110
- } else {
111
- setStatus('error')
112
- }
113
- } catch {
114
- setStatus('error')
115
- }
116
- }
117
-
118
- return (
119
- <>
120
- {customCSS && <style dangerouslySetInnerHTML={{ __html: customCSS }} />}
121
-
122
- <div id={sectionId ?? 'contact'} className="py-24">
123
- <div className="max-w-6xl lg:max-w-7xl mx-auto px-4 md:px-6">
124
- #BlockName-DDContact
125
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-16 items-start">
126
- <div>
127
- {eyebrow && (
128
- <p className="text-[11.5px] font-semibold text-stone-400 tracking-widest uppercase mb-3 top-caption">
129
- {eyebrow}
130
- </p>
131
- )}
132
-
133
- <h2 className="text-4xl md:text-5xl font-semibold text-stone-900 dark:text-stone-50 leading-tight mb-6">
134
- {headlineMain}
135
- <br />
136
- <span className="text-stone-400">{headlineAccent}</span>
137
- </h2>
138
-
139
- {description && (
140
- <p className="text-stone-700 dark:text-stone-300 text-base leading-relaxed mb-10">
141
- {description}
142
- </p>
143
- )}
144
-
145
- {infoItems && infoItems.length > 0 && (
146
- <div className="space-y-4 mb-10">
147
- {infoItems.map((item, i) => (
148
- <div key={i} className="flex gap-4">
149
- <div className="w-9 h-9 flex items-center justify-center rounded-lg lime-glass border border-indigo-400 bg-stone-100/50 dark:bg-stone-900/80 shrink-0 mt-0.5">
150
- <DynamicIcon
151
- className="text-indigo-500 dark:text-lime-500"
152
- name={item.iconName}
153
- size={15}
154
- />
155
- </div>
156
- <div>
157
- <div className="text-sm font-semibold text-stone-800 dark:text-stone-50 mb-0.5">
158
- {item.title}
159
- </div>
160
- <div className="text-xs text-stone-600 dark:text-stone-300">
161
- {item.description}
162
- </div>
163
- </div>
164
- </div>
165
- ))}
166
- </div>
167
- )}
168
-
169
- {availabilityActive && (
170
- <div
171
- className="flex items-center gap-3 p-4 bg-indigo-50 dark:bg-indigo-950/80 border border-indigo-200 dark:border-indigo-500 shadow-sm dark:shadow-xl backdrop-blur-sm rounded-2xl pressable relative z-10 h-full w-full text-[32px] font-medium tracking-[.001em] transition-all duration-300"
172
- style={{ cornerShape: 'squircle' } as React.CSSProperties}
173
- >
174
- <div className="w-3.5 h-3.5 rounded-full bg-lime-700 border-2 border-lime-500 animate-pulse shrink-0 shadow-2xl" />
175
- <div>
176
- {availabilityLabel && (
177
- <div className="text-md font-semibold text-indigo-900 dark:text-stone-50">
178
- {availabilityLabel}
179
- </div>
180
- )}
181
-
182
- {availabilitySubtext && (
183
- <div className="text-xs font-normal! text-stone-600 dark:text-stone-300 pt-1">
184
- {availabilitySubtext}
185
- </div>
186
- )}
187
- </div>
188
- </div>
189
- )}
190
- </div>
191
-
192
- <div className="rounded-2xl bg-stone-100 dark:bg-stone-950 border border-stone-100 dark:border-stone-800 dark:hover:border-indigo-800 px-3 md:px-8 py-8 shadow-sm hover:shadow-2xl transition-all duration-300">
193
- {status === 'success' ? (
194
- <div className="flex flex-col items-center justify-center text-center py-12">
195
- <div className="w-16 h-16 flex items-center justify-center rounded-full bg-lime-400/10 border border-emerald-400/30 mb-5">
196
- <Check size={28} className="text-lime-400" />
197
- </div>
198
-
199
- <h3 className="text-xl font-semibold text-stone-900 dark:text-stone-50 mb-2">
200
- Message sent!
201
- </h3>
202
-
203
- <p className="text-sm text-stone-600 dark:text-stone-400 max-w-xs">
204
- Thanks for reaching out. We'll review your project details and get back to you
205
- within one business day.
206
- </p>
207
-
208
- <button
209
- onClick={() => setStatus('idle')}
210
- className="mt-6 px-5 py-2.5 rounded-lg bg-stone-900 text-stone-50 dark:bg-stone-700 dark:text-stone-200 text-sm font-medium hover:bg-stone-800 dark:hover:bg-stone-600 transition-colors cursor-pointer"
211
- >
212
- Send another message
213
- </button>
214
- </div>
215
- ) : (
216
- <form
217
- id={formIdentifier}
218
- name={formIdentifier}
219
- data-form-id={String(formID || '')}
220
- onSubmit={handleSubmit}
221
- className="space-y-5"
222
- >
223
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
224
- <div>
225
- <label
226
- htmlFor={`${formIdentifier}-name`}
227
- className="block text-xs font-medium text-stone-400 mb-1.5"
228
- >
229
- Your Name *
230
- </label>
231
-
232
- <Input
233
- id={`${formIdentifier}-name`}
234
- type="text"
235
- name="name"
236
- autoComplete="name"
237
- required
238
- placeholder="Marcus Holt"
239
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
240
- />
241
- </div>
242
-
243
- <div>
244
- <label
245
- htmlFor={`${formIdentifier}-email`}
246
- className="block text-xs font-medium text-stone-400 mb-1.5"
247
- >
248
- Email Address *
249
- </label>
250
-
251
- <Input
252
- id={`${formIdentifier}-email`}
253
- type="email"
254
- name="email"
255
- autoComplete="email"
256
- required
257
- placeholder="you@company.com"
258
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
259
- />
260
- </div>
261
- </div>
262
-
263
- <div>
264
- <label
265
- htmlFor={`${formIdentifier}-company`}
266
- className="block text-xs font-medium text-stone-400 mb-1.5"
267
- >
268
- Company / Project Name
269
- </label>
270
-
271
- <Input
272
- id={`${formIdentifier}-company`}
273
- type="text"
274
- name="company"
275
- autoComplete="organization"
276
- placeholder="Acme Inc."
277
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
278
- />
279
- </div>
280
-
281
- {serviceOptions && serviceOptions.length > 0 && (
282
- <div>
283
- <label
284
- htmlFor={`${formIdentifier}-service`}
285
- className="block text-xs font-medium text-stone-400 mb-1.5"
286
- >
287
- Service Needed *
288
- </label>
289
-
290
- <select
291
- id={`${formIdentifier}-service`}
292
- name="service"
293
- autoComplete="off"
294
- required
295
- defaultValue=""
296
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
297
- >
298
- <option value="" disabled>
299
- Select a service...
300
- </option>
301
-
302
- {serviceOptions.map((s, i) => (
303
- <option key={i} value={s.label}>
304
- {s.label}
305
- </option>
306
- ))}
307
- </select>
308
- </div>
309
- )}
310
-
311
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
312
- {budgetOptions && budgetOptions.length > 0 && (
313
- <div>
314
- <label
315
- htmlFor={`${formIdentifier}-budget`}
316
- className="block text-xs font-medium text-stone-400 mb-1.5"
317
- >
318
- Budget Range *
319
- </label>
320
-
321
- <select
322
- id={`${formIdentifier}-budget`}
323
- name="budget"
324
- autoComplete="off"
325
- required
326
- defaultValue=""
327
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
328
- >
329
- <option value="" disabled>
330
- Select budget...
331
- </option>
332
-
333
- {budgetOptions.map((b, i) => (
334
- <option key={i} value={b.label}>
335
- {b.label}
336
- </option>
337
- ))}
338
- </select>
339
- </div>
340
- )}
341
-
342
- {timelineOptions && timelineOptions.length > 0 && (
343
- <div>
344
- <label
345
- htmlFor={`${formIdentifier}-timeline`}
346
- className="block text-xs font-medium text-stone-400 mb-1.5"
347
- >
348
- Timeline
349
- </label>
350
-
351
- <select
352
- id={`${formIdentifier}-timeline`}
353
- name="timeline"
354
- autoComplete="off"
355
- defaultValue=""
356
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
357
- >
358
- <option value="" disabled>
359
- Select timeline...
360
- </option>
361
-
362
- {timelineOptions.map((t, i) => (
363
- <option key={i} value={t.label}>
364
- {t.label}
365
- </option>
366
- ))}
367
- </select>
368
- </div>
369
- )}
370
- </div>
371
-
372
- <div>
373
- <label
374
- htmlFor={`${formIdentifier}-message`}
375
- className="block text-xs font-medium text-stone-400 mb-1.5"
376
- >
377
- Project Description *
378
- <span
379
- className={`ml-2 font-normal ${charCount > 500 ? 'text-red-400' : 'text-stone-400'}`}
380
- >
381
- {charCount}/500
382
- </span>
383
- </label>
384
-
385
- <textarea
386
- id={`${formIdentifier}-message`}
387
- name="message"
388
- autoComplete="off"
389
- required
390
- rows={4}
391
- maxLength={500}
392
- placeholder="Tell us about your project — what you're building, what problem it solves, and any technical constraints..."
393
- onChange={(e) => setCharCount(e.target.value.length)}
394
- className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
395
- />
396
- </div>
397
-
398
- {status === 'error' && (
399
- <p className="text-xs text-red-400">Something went wrong. Please try again.</p>
400
- )}
401
-
402
- <button
403
- type="submit"
404
- disabled={status === 'submitting' || charCount > 500}
405
- className="glass-button-white group relative isolate flex w-full cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-4xl! border border-stone-300 dark:border-white bg-stone-950/90 dark:bg-stone-100/80 px-6 py-3 text-sm font-semibold text-stone-50 dark:text-stone-900 outline-offset-0 hover:bg-stone-900 dark:hover:bg-stone-100 hover:shadow-2xl hover:-translate-y-0.5 hover:outline-4 hover:outline-indigo-500 hover:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 transition-all duration-300"
406
- style={{ cornerShape: 'squircle' } as React.CSSProperties}
407
- >
408
- <span className="relative z-2 flex items-center gap-2">
409
- {status === 'submitting' ? (
410
- <>
411
- <Loader2 size={15} className="animate-spin" />
412
- Sending...
413
- </>
414
- ) : (
415
- <>
416
- <Send size={15} />
417
- Send Project Brief
418
- </>
419
- )}
420
- </span>
421
- </button>
422
-
423
- <p className="text-xs text-stone-700 dark:text-stone-400 text-center">
424
- We'll respond within 1 business day. No spam, ever.
425
- </p>
426
- </form>
427
- )}
428
- </div>
429
- </div>
430
- </div>
431
- </div>
432
- </>
433
- )
434
- }
435
-
1
+ 'use client'
2
+ import React, { type FormEvent, useMemo, useState } from 'react'
3
+ import * as LucideIcons from 'lucide-react'
4
+ import { Check, Loader2, Send } from 'lucide-react'
5
+ import { Input } from '@/components/ui/input'
6
+ import { getClientSideURL } from '@/utilities/getURL'
7
+
8
+ type Status = 'idle' | 'submitting' | 'success' | 'error'
9
+ export type DDContactProps = {
10
+ eyebrow?: string | null
11
+ headlineMain?: string | null
12
+ headlineAccent?: string | null
13
+ description?: string | null
14
+ infoItems?: Array<{
15
+ iconName?: string | null
16
+ title: string
17
+ description: string
18
+ }> | null
19
+ availabilityActive?: boolean | null
20
+ availabilityLabel?: string | null
21
+ availabilitySubtext?: string | null
22
+ form?: string | number | { id?: string | number } | null
23
+ serviceOptions?: Array<{ label: string }> | null
24
+ budgetOptions?: Array<{ label: string }> | null
25
+ timelineOptions?: Array<{ label: string }> | null
26
+ sectionId?: string | null
27
+ customCSS?: string | null
28
+ }
29
+ function DynamicIcon({
30
+ name,
31
+ size = 16,
32
+ ...props
33
+ }: { name?: string | null } & Omit<LucideIcons.LucideProps, 'name'>) {
34
+ if (!name) return null
35
+ const Icon = (LucideIcons as unknown as Record<string, React.FC<LucideIcons.LucideProps>>)[name]
36
+ if (!Icon) return null
37
+ return <Icon size={size} {...props} />
38
+ }
39
+
40
+ export const DDContact: React.FC<DDContactProps> = ({
41
+ eyebrow,
42
+ headlineMain,
43
+ headlineAccent,
44
+ description,
45
+ infoItems,
46
+ availabilityActive,
47
+ availabilityLabel,
48
+ availabilitySubtext,
49
+ form,
50
+ serviceOptions,
51
+ budgetOptions,
52
+ timelineOptions,
53
+ sectionId,
54
+ customCSS,
55
+ }) => {
56
+ const [status, setStatus] = useState<Status>('idle')
57
+ const [charCount, setCharCount] = useState(0)
58
+
59
+ const formID = typeof form === 'object' && form !== null ? form.id : form
60
+
61
+ const formIdentifier = useMemo(() => {
62
+ const safeSection = (sectionId || 'contact').toLowerCase().replace(/[^a-z0-9-_]/g, '-')
63
+
64
+ return `studio-contact-${String(formID || 'unknown')}-${safeSection}`
65
+ }, [formID, sectionId])
66
+
67
+ const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
68
+ e.preventDefault()
69
+ const formElement = e.currentTarget
70
+ const data = new FormData(formElement)
71
+
72
+ const message = data.get('message') as string
73
+ if (message && message.length > 500) return
74
+
75
+ setStatus('submitting')
76
+
77
+ const submissionData = [
78
+ { field: 'name', value: data.get('name') },
79
+ { field: 'email', value: data.get('email') },
80
+ { field: 'company', value: data.get('company') },
81
+ { field: 'service', value: data.get('service') },
82
+ { field: 'budget', value: data.get('budget') },
83
+ { field: 'timeline', value: data.get('timeline') },
84
+ { field: 'message', value: data.get('message') },
85
+ ]
86
+
87
+ if (!formID) {
88
+ setStatus('success')
89
+ formElement.reset()
90
+ setCharCount(0)
91
+ return
92
+ }
93
+
94
+ try {
95
+ const res = await fetch(`${getClientSideURL()}/api/form-submissions`, {
96
+ method: 'POST',
97
+ headers: {
98
+ 'Content-Type': 'application/json',
99
+ },
100
+ body: JSON.stringify({
101
+ form: formID,
102
+ submissionData,
103
+ }),
104
+ })
105
+
106
+ if (res.ok) {
107
+ setStatus('success')
108
+ formElement.reset()
109
+ setCharCount(0)
110
+ } else {
111
+ setStatus('error')
112
+ }
113
+ } catch {
114
+ setStatus('error')
115
+ }
116
+ }
117
+
118
+ return (
119
+ <>
120
+ {customCSS && <style dangerouslySetInnerHTML={{ __html: customCSS }} />}
121
+
122
+ <div id={sectionId ?? 'contact'} className="py-4">
123
+ <div className="max-w-6xl lg:max-w-7xl mx-auto px-4 md:px-6">
124
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-16 items-start">
125
+ <div>
126
+ {eyebrow && (
127
+ <p className="text-[11.5px] font-semibold text-stone-400 tracking-widest uppercase mb-3 top-caption">
128
+ {eyebrow}
129
+ </p>
130
+ )}
131
+
132
+ <h2 className="text-4xl md:text-5xl font-semibold text-stone-900 dark:text-stone-50 leading-tight mb-6">
133
+ {headlineMain}
134
+ <br />
135
+ <span className="text-stone-400">{headlineAccent}</span>
136
+ </h2>
137
+
138
+ {description && (
139
+ <p className="text-stone-700 dark:text-stone-300 text-base leading-relaxed mb-10">
140
+ {description}
141
+ </p>
142
+ )}
143
+
144
+ {infoItems && infoItems.length > 0 && (
145
+ <div className="space-y-4 mb-10">
146
+ {infoItems.map((item, i) => (
147
+ <div key={i} className="flex gap-4">
148
+ <div className="w-9 h-9 flex items-center justify-center rounded-lg lime-glass border border-indigo-400 bg-stone-100/50 dark:bg-stone-900/80 shrink-0 mt-0.5">
149
+ <DynamicIcon
150
+ className="text-indigo-500 dark:text-lime-500"
151
+ name={item.iconName}
152
+ size={15}
153
+ />
154
+ </div>
155
+ <div>
156
+ <div className="text-sm font-semibold text-stone-800 dark:text-stone-50 mb-0.5">
157
+ {item.title}
158
+ </div>
159
+ <div className="text-xs text-stone-600 dark:text-stone-300">
160
+ {item.description}
161
+ </div>
162
+ </div>
163
+ </div>
164
+ ))}
165
+ </div>
166
+ )}
167
+
168
+ {availabilityActive && (
169
+ <div
170
+ className="flex items-center gap-3 p-4 bg-indigo-50 dark:bg-indigo-950/80 border border-indigo-200 dark:border-indigo-500 shadow-sm dark:shadow-xl backdrop-blur-sm rounded-2xl pressable relative z-10 h-full w-full text-[32px] font-medium tracking-[.001em] transition-all duration-300"
171
+ style={{ cornerShape: 'squircle' } as React.CSSProperties}
172
+ >
173
+ <div className="w-3.5 h-3.5 rounded-full bg-lime-700 border-2 border-lime-500 animate-pulse shrink-0 shadow-2xl" />
174
+ <div>
175
+ {availabilityLabel && (
176
+ <div className="text-md font-semibold text-indigo-900 dark:text-stone-50">
177
+ {availabilityLabel}
178
+ </div>
179
+ )}
180
+
181
+ {availabilitySubtext && (
182
+ <div className="text-xs font-normal! text-stone-600 dark:text-stone-300 pt-1">
183
+ {availabilitySubtext}
184
+ </div>
185
+ )}
186
+ </div>
187
+ </div>
188
+ )}
189
+ </div>
190
+
191
+ <div className="rounded-2xl bg-stone-100 dark:bg-stone-950 border border-stone-100 dark:border-stone-800 dark:hover:border-indigo-800 px-3 md:px-8 py-8 shadow-sm hover:shadow-2xl transition-all duration-300">
192
+ {status === 'success' ? (
193
+ <div className="flex flex-col items-center justify-center text-center py-12">
194
+ <div className="w-16 h-16 flex items-center justify-center rounded-full bg-lime-400/10 border border-emerald-400/30 mb-5">
195
+ <Check size={28} className="text-lime-400" />
196
+ </div>
197
+
198
+ <h3 className="text-xl font-semibold text-stone-900 dark:text-stone-50 mb-2">
199
+ Message sent!
200
+ </h3>
201
+
202
+ <p className="text-sm text-stone-600 dark:text-stone-400 max-w-xs">
203
+ Thanks for reaching out. We'll review your project details and get back to you
204
+ within one business day.
205
+ </p>
206
+
207
+ <button
208
+ onClick={() => setStatus('idle')}
209
+ className="mt-6 px-5 py-2.5 rounded-lg bg-stone-900 text-stone-50 dark:bg-stone-700 dark:text-stone-200 text-sm font-medium hover:bg-stone-800 dark:hover:bg-stone-600 transition-colors cursor-pointer"
210
+ >
211
+ Send another message
212
+ </button>
213
+ </div>
214
+ ) : (
215
+ <form
216
+ id={formIdentifier}
217
+ name={formIdentifier}
218
+ data-form-id={String(formID || '')}
219
+ onSubmit={handleSubmit}
220
+ className="space-y-5"
221
+ >
222
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
223
+ <div>
224
+ <label
225
+ htmlFor={`${formIdentifier}-name`}
226
+ className="block text-xs font-medium text-stone-400 mb-1.5"
227
+ >
228
+ Your Name *
229
+ </label>
230
+
231
+ <Input
232
+ id={`${formIdentifier}-name`}
233
+ type="text"
234
+ name="name"
235
+ autoComplete="name"
236
+ required
237
+ placeholder="Marcus Holt"
238
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
239
+ />
240
+ </div>
241
+
242
+ <div>
243
+ <label
244
+ htmlFor={`${formIdentifier}-email`}
245
+ className="block text-xs font-medium text-stone-400 mb-1.5"
246
+ >
247
+ Email Address *
248
+ </label>
249
+
250
+ <Input
251
+ id={`${formIdentifier}-email`}
252
+ type="email"
253
+ name="email"
254
+ autoComplete="email"
255
+ required
256
+ placeholder="you@company.com"
257
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
258
+ />
259
+ </div>
260
+ </div>
261
+
262
+ <div>
263
+ <label
264
+ htmlFor={`${formIdentifier}-company`}
265
+ className="block text-xs font-medium text-stone-400 mb-1.5"
266
+ >
267
+ Company / Project Name
268
+ </label>
269
+
270
+ <Input
271
+ id={`${formIdentifier}-company`}
272
+ type="text"
273
+ name="company"
274
+ autoComplete="organization"
275
+ placeholder="Acme Inc."
276
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
277
+ />
278
+ </div>
279
+
280
+ {serviceOptions && serviceOptions.length > 0 && (
281
+ <div>
282
+ <label
283
+ htmlFor={`${formIdentifier}-service`}
284
+ className="block text-xs font-medium text-stone-400 mb-1.5"
285
+ >
286
+ Service Needed *
287
+ </label>
288
+
289
+ <select
290
+ id={`${formIdentifier}-service`}
291
+ name="service"
292
+ autoComplete="off"
293
+ required
294
+ defaultValue=""
295
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
296
+ >
297
+ <option value="" disabled>
298
+ Select a service...
299
+ </option>
300
+
301
+ {serviceOptions.map((s, i) => (
302
+ <option key={i} value={s.label}>
303
+ {s.label}
304
+ </option>
305
+ ))}
306
+ </select>
307
+ </div>
308
+ )}
309
+
310
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
311
+ {budgetOptions && budgetOptions.length > 0 && (
312
+ <div>
313
+ <label
314
+ htmlFor={`${formIdentifier}-budget`}
315
+ className="block text-xs font-medium text-stone-400 mb-1.5"
316
+ >
317
+ Budget Range *
318
+ </label>
319
+
320
+ <select
321
+ id={`${formIdentifier}-budget`}
322
+ name="budget"
323
+ autoComplete="off"
324
+ required
325
+ defaultValue=""
326
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
327
+ >
328
+ <option value="" disabled>
329
+ Select budget...
330
+ </option>
331
+
332
+ {budgetOptions.map((b, i) => (
333
+ <option key={i} value={b.label}>
334
+ {b.label}
335
+ </option>
336
+ ))}
337
+ </select>
338
+ </div>
339
+ )}
340
+
341
+ {timelineOptions && timelineOptions.length > 0 && (
342
+ <div>
343
+ <label
344
+ htmlFor={`${formIdentifier}-timeline`}
345
+ className="block text-xs font-medium text-stone-400 mb-1.5"
346
+ >
347
+ Timeline
348
+ </label>
349
+
350
+ <select
351
+ id={`${formIdentifier}-timeline`}
352
+ name="timeline"
353
+ autoComplete="off"
354
+ defaultValue=""
355
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
356
+ >
357
+ <option value="" disabled>
358
+ Select timeline...
359
+ </option>
360
+
361
+ {timelineOptions.map((t, i) => (
362
+ <option key={i} value={t.label}>
363
+ {t.label}
364
+ </option>
365
+ ))}
366
+ </select>
367
+ </div>
368
+ )}
369
+ </div>
370
+
371
+ <div>
372
+ <label
373
+ htmlFor={`${formIdentifier}-message`}
374
+ className="block text-xs font-medium text-stone-400 mb-1.5"
375
+ >
376
+ Project Description *
377
+ <span
378
+ className={`ml-2 font-normal ${charCount > 500 ? 'text-red-400' : 'text-stone-400'}`}
379
+ >
380
+ {charCount}/500
381
+ </span>
382
+ </label>
383
+
384
+ <textarea
385
+ id={`${formIdentifier}-message`}
386
+ name="message"
387
+ autoComplete="off"
388
+ required
389
+ rows={4}
390
+ maxLength={500}
391
+ placeholder="Tell us about your project — what you're building, what problem it solves, and any technical constraints..."
392
+ onChange={(e) => setCharCount(e.target.value.length)}
393
+ className="glass-input squircle relative flex w-full items-center overflow-hidden rounded-sm border border-stone-300 dark:border-stone-700 bg-white dark:bg-black/80 px-3 py-2 text-sm text-stone-800 dark:text-stone-50 placeholder:text-stone-400 outline-none backdrop-blur-[22px] transition-all duration-300 focus:border-stone-400 dark:focus:border-lime-500 focus:ring-2 focus:ring-offset-2 focus:ring-stone-300/50 dark:focus:ring-lime-500/10"
394
+ />
395
+ </div>
396
+
397
+ {status === 'error' && (
398
+ <p className="text-xs text-red-400">Something went wrong. Please try again.</p>
399
+ )}
400
+
401
+ <button
402
+ type="submit"
403
+ disabled={status === 'submitting' || charCount > 500}
404
+ className="glass-button-white group relative isolate flex w-full cursor-pointer items-center justify-center gap-2 overflow-hidden rounded-4xl! border border-stone-300 dark:border-white bg-stone-950/90 dark:bg-stone-100/80 px-6 py-3 text-sm font-semibold text-stone-50 dark:text-stone-900 outline-offset-0 hover:bg-stone-900 dark:hover:bg-stone-100 hover:shadow-2xl hover:-translate-y-0.5 hover:outline-4 hover:outline-indigo-500 hover:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 transition-all duration-300"
405
+ style={{ cornerShape: 'squircle' } as React.CSSProperties}
406
+ >
407
+ <span className="relative z-2 flex items-center gap-2">
408
+ {status === 'submitting' ? (
409
+ <>
410
+ <Loader2 size={15} className="animate-spin" />
411
+ Sending...
412
+ </>
413
+ ) : (
414
+ <>
415
+ <Send size={15} />
416
+ Send Project Brief
417
+ </>
418
+ )}
419
+ </span>
420
+ </button>
421
+
422
+ <p className="text-xs text-stone-700 dark:text-stone-400 text-center">
423
+ We'll respond within 1 business day. No spam, ever.
424
+ </p>
425
+ </form>
426
+ )}
427
+ </div>
428
+ </div>
429
+ </div>
430
+ </div>
431
+ </>
432
+ )
433
+ }