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.
- package/package.json +1 -1
- package/src/installers/patchRenderBlocks.js +1 -1
- package/src/registry/validateTemplateManifest.js +2 -1
- package/templates/blocks/BannerDD790432/Component.tsx +63 -0
- package/templates/blocks/BannerDD790432/config.ts +54 -0
- package/templates/blocks/BannerDD790432/manifest.json +80 -0
- package/templates/blocks/Button47/Component.tsx +124 -0
- package/templates/blocks/Button47/config.ts +75 -0
- package/templates/blocks/Button47/link.ts +22 -0
- package/templates/blocks/Button47/manifest.json +105 -0
- package/templates/blocks/Button47/styles.module.scss +75 -0
- package/templates/blocks/DD-Accordion/Component.tsx +55 -36
- package/templates/blocks/DD-Accordion/config.ts +71 -59
- package/templates/blocks/DD-AnimText/Component.tsx +50 -32
- package/templates/blocks/DD-AnimText/config.ts +296 -295
- package/templates/blocks/DD-AsideNav/Component.tsx +323 -319
- package/templates/blocks/DD-Banner/Component.tsx +54 -51
- package/templates/blocks/DD-BookCall/Component.tsx +535 -535
- package/templates/blocks/DD-ButtonPop/Component.tsx +118 -117
- package/templates/blocks/DD-Card/Component.tsx +4 -4
- package/templates/blocks/DD-CardTemplate01/Component.tsx +139 -140
- package/templates/blocks/DD-CardsWithVariantV3/Component.tsx +472 -0
- package/templates/blocks/DD-CardsWithVariantV3/ElectricBorder/index.tsx +203 -0
- package/templates/blocks/DD-CardsWithVariantV3/ElectricBorder/styles.ts +87 -0
- package/templates/blocks/DD-CardsWithVariantV3/ElectricBorder/useInjectStyle.ts +39 -0
- package/templates/blocks/DD-CardsWithVariantV3/config.ts +326 -0
- package/templates/blocks/DD-CardsWithVariantV3/manifest.json +110 -0
- package/templates/blocks/DD-Carousel-A/Component.tsx +251 -249
- package/templates/blocks/DD-Carousel-B/Component.tsx +405 -403
- package/templates/blocks/DD-ComparisonTable/Component.tsx +255 -256
- package/templates/blocks/DD-Contact/Component.tsx +433 -435
- package/templates/blocks/DD-Counter/Component.tsx +11 -6
- package/templates/blocks/DD-DeliCard/Component.tsx +303 -0
- package/templates/blocks/DD-DeliCard/config.ts +186 -0
- package/templates/blocks/DD-DeliCard/manifest.json +94 -0
- package/templates/blocks/DD-FeatCat/Component.tsx +302 -302
- package/templates/blocks/DD-FeatProd/CircularGallery.tsx +1179 -0
- package/templates/blocks/DD-FeatProd/Component.tsx +484 -0
- package/templates/blocks/DD-FeatProd/config.ts +173 -0
- package/templates/blocks/DD-FeatProd/manifest.json +93 -0
- package/templates/blocks/DD-FeatServ/Component.tsx +607 -0
- package/templates/blocks/DD-FeatServ/config.ts +213 -0
- package/templates/blocks/DD-FeatServ/manifest.json +113 -0
- package/templates/blocks/DD-FeatStrip/Component.tsx +584 -585
- package/templates/blocks/DD-FluidBtn/ButtonsEyeCatching.tsx +627 -628
- package/templates/blocks/DD-FluidBtn/Component.tsx +46 -43
- package/templates/blocks/DD-GooeyInfo/Component.tsx +150 -149
- package/templates/blocks/DD-GooeyInfo/config.ts +136 -135
- package/templates/blocks/DD-Hero/Component.tsx +296 -297
- package/templates/blocks/DD-HeroPlas/Component.tsx +50 -0
- package/templates/blocks/DD-HeroPlas/ThreeScene.tsx +109 -0
- package/templates/blocks/DD-HeroPlas/config.ts +33 -0
- package/templates/blocks/DD-HeroPlas/manifest.json +88 -0
- package/templates/blocks/DD-HorizontalScroll/Component.tsx +937 -936
- package/templates/blocks/DD-Icon/Component.tsx +46 -81
- package/templates/blocks/DD-IconButton/Component.tsx +13 -20
- package/templates/blocks/DD-IdTag/Component.tsx +22 -21
- package/templates/blocks/DD-LineAnim/Component.tsx +42 -36
- package/templates/blocks/DD-LogoMarq/Component.tsx +38 -48
- package/templates/blocks/DD-Lottie/Component.tsx +11 -3
- package/templates/blocks/DD-MasonaryMedia/Component.tsx +544 -545
- package/templates/blocks/DD-MasonaryMedia/config.ts +389 -389
- package/templates/blocks/DD-Masonry/Component.tsx +654 -644
- package/templates/blocks/DD-Masonry/config.ts +475 -475
- package/templates/blocks/DD-MaterialSwatches/Component.tsx +85 -0
- package/templates/blocks/DD-MaterialSwatches/config.ts +232 -0
- package/templates/blocks/DD-MaterialSwatches/manifest.json +84 -0
- package/templates/blocks/DD-MaterialSwatches/material.ts +107 -0
- package/templates/blocks/DD-NineCanvas/Component.tsx +129 -0
- package/templates/blocks/DD-NineCanvas/RenderBlocks.tsx +244 -0
- package/templates/blocks/DD-NineCanvas/allowedCanvasBlocks.ts +6 -0
- package/templates/blocks/DD-NineCanvas/blockComponents.tsx +8 -0
- package/templates/blocks/DD-NineCanvas/canvas/CanvasGrid.tsx +316 -0
- package/templates/blocks/DD-NineCanvas/canvas/RadialNav.tsx +432 -0
- package/templates/blocks/DD-NineCanvas/canvas/canvas-panels.css +889 -0
- package/templates/blocks/DD-NineCanvas/canvas/icons/custom-icons.tsx +364 -0
- package/templates/blocks/DD-NineCanvas/config.ts +61 -0
- package/templates/blocks/DD-NineCanvas/manifest.json +165 -0
- package/templates/blocks/DD-NineCanvas/styles.scss +152 -0
- package/templates/blocks/DD-NineCanvas/tooltip/get-strict-context.tsx +26 -0
- package/templates/blocks/DD-NineCanvas/tooltip/primitives.tsx +178 -0
- package/templates/blocks/DD-NineCanvas/tooltip/tooltip.tsx +71 -0
- package/templates/blocks/DD-NineCanvas/tooltip/use-controlled-state.tsx +33 -0
- package/templates/blocks/DD-NineCanvas/utilities/FadeOnScroll.tsx +68 -0
- package/templates/blocks/DD-NineCanvas/utilities/ParallaxWrapper.tsx +157 -0
- package/templates/blocks/DD-NineCanvas/utilities/renderCustomCSS.ts +5 -0
- package/templates/blocks/DD-NineCanvas/utilities/webglCleanup.ts +27 -0
- package/templates/blocks/DD-PayloadAIAssistant/Component.tsx +78 -0
- package/templates/blocks/DD-PayloadAIAssistant/DustedBot.tsx +590 -0
- package/templates/blocks/DD-PayloadAIAssistant/config.ts +37 -0
- package/templates/blocks/DD-PayloadAIAssistant/demo.css +125 -0
- package/templates/blocks/DD-PayloadAIAssistant/manifest.json +93 -0
- package/templates/blocks/DD-PayloadAIAssistant/source-defaults.ts +17 -0
- package/templates/blocks/DD-PayloadAIAssistant/styles.ts +306 -0
- package/templates/blocks/DD-Pricing/Component.tsx +2 -3
- package/templates/blocks/DD-Pricing/config.ts +215 -215
- package/templates/blocks/DD-Process/Component.tsx +2 -2
- package/templates/blocks/DD-ProjHeader/Component.tsx +93 -91
- package/templates/blocks/DD-ProjSlider/Component.tsx +1 -1
- package/templates/blocks/DD-Section/Component.tsx +265 -266
- package/templates/blocks/DD-Separator/Component.tsx +66 -66
- package/templates/blocks/DD-Services/Component.tsx +176 -176
- package/templates/blocks/DD-ShowcaseGrid/Component.tsx +306 -307
- package/templates/blocks/DD-Slider-A/Component.tsx +2 -2
- package/templates/blocks/DD-StackCards/Component.tsx +172 -171
- package/templates/blocks/DD-Team/Component.tsx +247 -247
- package/templates/blocks/DD-TeamCards/Component.tsx +251 -251
- package/templates/blocks/DD-TechStack/Component.tsx +173 -174
- package/templates/blocks/DD-TestMarq/Component.tsx +158 -132
- package/templates/blocks/DD-Testim/Component.tsx +247 -247
- package/templates/blocks/DD-Testim2/Component.tsx +265 -256
- package/templates/blocks/DD-Testimonials/Component.tsx +139 -139
- package/templates/blocks/DD-Thanks/Component.tsx +1 -1
- package/templates/blocks/DD-Work/Component.tsx +318 -318
- package/templates/blocks/DD-Work-B/Component.tsx +294 -294
- package/templates/blocks/DDHG-CTASection2/Component.tsx +183 -184
- package/templates/blocks/DDHG-HighlightArc/Component.tsx +6 -3
- package/templates/blocks/DDHG-LogoMarquee/Component.tsx +45 -8
- package/templates/blocks/DDHG-NavCodeGrid/Component.tsx +1 -3
- package/templates/blocks/DDHG-ServiceDetails/ServiceDetailCard.tsx +9 -22
- package/templates/blocks/DDHG-ServiceHero/Component.tsx +10 -10
- package/templates/blocks/DDHG-TeamCards/Component.tsx +6 -35
- package/templates/blocks/Form/Checkbox/index.tsx +45 -0
- package/templates/blocks/Form/Component.tsx +163 -0
- package/templates/blocks/Form/Country/index.tsx +65 -0
- package/templates/blocks/Form/Country/options.ts +982 -0
- package/templates/blocks/Form/Email/index.tsx +38 -0
- package/templates/blocks/Form/Error/index.tsx +15 -0
- package/templates/blocks/Form/Message/index.tsx +13 -0
- package/templates/blocks/Form/Number/index.tsx +36 -0
- package/templates/blocks/Form/Select/index.tsx +63 -0
- package/templates/blocks/Form/State/index.tsx +64 -0
- package/templates/blocks/Form/State/options.ts +52 -0
- package/templates/blocks/Form/Text/index.tsx +32 -0
- package/templates/blocks/Form/Textarea/index.tsx +40 -0
- package/templates/blocks/Form/Width/index.tsx +13 -0
- package/templates/blocks/Form/config.ts +51 -0
- package/templates/blocks/Form/fields.tsx +21 -0
- package/templates/blocks/Form/manifest.json +168 -0
- package/templates/blocks/MediaBlock/Component.tsx +67 -0
- package/templates/blocks/MediaBlock/config.ts +14 -0
- package/templates/blocks/MediaBlock/manifest.json +92 -0
- package/templates/blocks/TransitionsDustedShowcase/Component.tsx +9 -0
- package/templates/blocks/TransitionsDustedShowcase/config.ts +13 -0
- package/templates/blocks/TransitionsDustedShowcase/manifest.json +80 -0
- package/templates/blocks/rawHtml/Component.tsx +25 -0
- package/templates/blocks/rawHtml/config.ts +56 -0
- package/templates/blocks/rawHtml/manifest.json +80 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { EmailField } from '@payloadcms/plugin-form-builder/types'
|
|
2
|
+
import type { FieldErrorsImpl, FieldValues, UseFormRegister } from 'react-hook-form'
|
|
3
|
+
|
|
4
|
+
import { Input } from '@/components/ui/input'
|
|
5
|
+
import { Label } from '@/components/ui/label'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
import { Error } from '../Error'
|
|
9
|
+
import { Width } from '../Width'
|
|
10
|
+
|
|
11
|
+
export const Email: React.FC<
|
|
12
|
+
EmailField & {
|
|
13
|
+
errors: Partial<FieldErrorsImpl>
|
|
14
|
+
register: UseFormRegister<FieldValues>
|
|
15
|
+
}
|
|
16
|
+
> = ({ name, defaultValue, errors, label, register, required, width }) => {
|
|
17
|
+
return (
|
|
18
|
+
<Width width={width}>
|
|
19
|
+
<Label htmlFor={name}>
|
|
20
|
+
{label}
|
|
21
|
+
|
|
22
|
+
{required && (
|
|
23
|
+
<span className="required">
|
|
24
|
+
* <span className="sr-only">(required)</span>
|
|
25
|
+
</span>
|
|
26
|
+
)}
|
|
27
|
+
</Label>
|
|
28
|
+
<Input
|
|
29
|
+
defaultValue={defaultValue}
|
|
30
|
+
id={name}
|
|
31
|
+
type="text"
|
|
32
|
+
{...register(name, { pattern: /^\S[^\s@]*@\S+$/, required })}
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
{errors[name] && <Error name={name} />}
|
|
36
|
+
</Width>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { useFormContext } from 'react-hook-form'
|
|
5
|
+
|
|
6
|
+
export const Error = ({ name }: { name: string }) => {
|
|
7
|
+
const {
|
|
8
|
+
formState: { errors },
|
|
9
|
+
} = useFormContext()
|
|
10
|
+
return (
|
|
11
|
+
<div className="mt-2 text-red-500 text-sm">
|
|
12
|
+
{(errors[name]?.message as string) || 'This field is required'}
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import RichText from '@/components/RichText'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { Width } from '../Width'
|
|
5
|
+
import { DefaultTypedEditorState } from '@payloadcms/richtext-lexical'
|
|
6
|
+
|
|
7
|
+
export const Message: React.FC<{ message: DefaultTypedEditorState }> = ({ message }) => {
|
|
8
|
+
return (
|
|
9
|
+
<Width className="my-12" width="100">
|
|
10
|
+
{message && <RichText data={message} />}
|
|
11
|
+
</Width>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TextField } from '@payloadcms/plugin-form-builder/types'
|
|
2
|
+
import type { FieldErrorsImpl, FieldValues, UseFormRegister } from 'react-hook-form'
|
|
3
|
+
|
|
4
|
+
import { Input } from '@/components/ui/input'
|
|
5
|
+
import { Label } from '@/components/ui/label'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
import { Error } from '../Error'
|
|
9
|
+
import { Width } from '../Width'
|
|
10
|
+
export const Number: React.FC<
|
|
11
|
+
TextField & {
|
|
12
|
+
errors: Partial<FieldErrorsImpl>
|
|
13
|
+
register: UseFormRegister<FieldValues>
|
|
14
|
+
}
|
|
15
|
+
> = ({ name, defaultValue, errors, label, register, required, width }) => {
|
|
16
|
+
return (
|
|
17
|
+
<Width width={width}>
|
|
18
|
+
<Label htmlFor={name}>
|
|
19
|
+
{label}
|
|
20
|
+
|
|
21
|
+
{required && (
|
|
22
|
+
<span className="required">
|
|
23
|
+
* <span className="sr-only">(required)</span>
|
|
24
|
+
</span>
|
|
25
|
+
)}
|
|
26
|
+
</Label>
|
|
27
|
+
<Input
|
|
28
|
+
defaultValue={defaultValue}
|
|
29
|
+
id={name}
|
|
30
|
+
type="number"
|
|
31
|
+
{...register(name, { required })}
|
|
32
|
+
/>
|
|
33
|
+
{errors[name] && <Error name={name} />}
|
|
34
|
+
</Width>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { SelectField } from '@payloadcms/plugin-form-builder/types'
|
|
2
|
+
import type { Control, FieldErrorsImpl } from 'react-hook-form'
|
|
3
|
+
|
|
4
|
+
import { Label } from '@/components/ui/label'
|
|
5
|
+
import {
|
|
6
|
+
Select as SelectComponent,
|
|
7
|
+
SelectContent,
|
|
8
|
+
SelectItem,
|
|
9
|
+
SelectTrigger,
|
|
10
|
+
SelectValue,
|
|
11
|
+
} from '@/components/ui/select'
|
|
12
|
+
import React from 'react'
|
|
13
|
+
import { Controller } from 'react-hook-form'
|
|
14
|
+
|
|
15
|
+
import { Error } from '../Error'
|
|
16
|
+
import { Width } from '../Width'
|
|
17
|
+
|
|
18
|
+
export const Select: React.FC<
|
|
19
|
+
SelectField & {
|
|
20
|
+
control: Control
|
|
21
|
+
errors: Partial<FieldErrorsImpl>
|
|
22
|
+
}
|
|
23
|
+
> = ({ name, control, errors, label, options, required, width, defaultValue }) => {
|
|
24
|
+
return (
|
|
25
|
+
<Width width={width}>
|
|
26
|
+
<Label htmlFor={name}>
|
|
27
|
+
{label}
|
|
28
|
+
{required && (
|
|
29
|
+
<span className="required">
|
|
30
|
+
* <span className="sr-only">(required)</span>
|
|
31
|
+
</span>
|
|
32
|
+
)}
|
|
33
|
+
</Label>
|
|
34
|
+
<Controller
|
|
35
|
+
control={control}
|
|
36
|
+
defaultValue={defaultValue}
|
|
37
|
+
name={name}
|
|
38
|
+
render={({ field: { onChange, value } }) => {
|
|
39
|
+
const controlledValue = options.find((t) => t.value === value)
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<SelectComponent onValueChange={(val) => onChange(val)} value={controlledValue?.value}>
|
|
43
|
+
<SelectTrigger className="w-full" id={name}>
|
|
44
|
+
<SelectValue placeholder={label} />
|
|
45
|
+
</SelectTrigger>
|
|
46
|
+
<SelectContent>
|
|
47
|
+
{options.map(({ label, value }) => {
|
|
48
|
+
return (
|
|
49
|
+
<SelectItem key={value} value={value}>
|
|
50
|
+
{label}
|
|
51
|
+
</SelectItem>
|
|
52
|
+
)
|
|
53
|
+
})}
|
|
54
|
+
</SelectContent>
|
|
55
|
+
</SelectComponent>
|
|
56
|
+
)
|
|
57
|
+
}}
|
|
58
|
+
rules={{ required }}
|
|
59
|
+
/>
|
|
60
|
+
{errors[name] && <Error name={name} />}
|
|
61
|
+
</Width>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { StateField } from '@payloadcms/plugin-form-builder/types'
|
|
2
|
+
import type { Control, FieldErrorsImpl } from 'react-hook-form'
|
|
3
|
+
|
|
4
|
+
import { Label } from '@/components/ui/label'
|
|
5
|
+
import {
|
|
6
|
+
Select,
|
|
7
|
+
SelectContent,
|
|
8
|
+
SelectItem,
|
|
9
|
+
SelectTrigger,
|
|
10
|
+
SelectValue,
|
|
11
|
+
} from '@/components/ui/select'
|
|
12
|
+
import React from 'react'
|
|
13
|
+
import { Controller } from 'react-hook-form'
|
|
14
|
+
|
|
15
|
+
import { Error } from '../Error'
|
|
16
|
+
import { Width } from '../Width'
|
|
17
|
+
import { stateOptions } from './options'
|
|
18
|
+
|
|
19
|
+
export const State: React.FC<
|
|
20
|
+
StateField & {
|
|
21
|
+
control: Control
|
|
22
|
+
errors: Partial<FieldErrorsImpl>
|
|
23
|
+
}
|
|
24
|
+
> = ({ name, control, errors, label, required, width }) => {
|
|
25
|
+
return (
|
|
26
|
+
<Width width={width}>
|
|
27
|
+
<Label htmlFor={name}>
|
|
28
|
+
{label}
|
|
29
|
+
{required && (
|
|
30
|
+
<span className="required">
|
|
31
|
+
* <span className="sr-only">(required)</span>
|
|
32
|
+
</span>
|
|
33
|
+
)}
|
|
34
|
+
</Label>
|
|
35
|
+
<Controller
|
|
36
|
+
control={control}
|
|
37
|
+
defaultValue=""
|
|
38
|
+
name={name}
|
|
39
|
+
render={({ field: { onChange, value } }) => {
|
|
40
|
+
const controlledValue = stateOptions.find((t) => t.value === value)
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Select onValueChange={(val) => onChange(val)} value={controlledValue?.value}>
|
|
44
|
+
<SelectTrigger className="w-full" id={name}>
|
|
45
|
+
<SelectValue placeholder={label} />
|
|
46
|
+
</SelectTrigger>
|
|
47
|
+
<SelectContent>
|
|
48
|
+
{stateOptions.map(({ label, value }) => {
|
|
49
|
+
return (
|
|
50
|
+
<SelectItem key={value} value={value}>
|
|
51
|
+
{label}
|
|
52
|
+
</SelectItem>
|
|
53
|
+
)
|
|
54
|
+
})}
|
|
55
|
+
</SelectContent>
|
|
56
|
+
</Select>
|
|
57
|
+
)
|
|
58
|
+
}}
|
|
59
|
+
rules={{ required }}
|
|
60
|
+
/>
|
|
61
|
+
{errors[name] && <Error name={name} />}
|
|
62
|
+
</Width>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const stateOptions = [
|
|
2
|
+
{ label: 'Alabama', value: 'AL' },
|
|
3
|
+
{ label: 'Alaska', value: 'AK' },
|
|
4
|
+
{ label: 'Arizona', value: 'AZ' },
|
|
5
|
+
{ label: 'Arkansas', value: 'AR' },
|
|
6
|
+
{ label: 'California', value: 'CA' },
|
|
7
|
+
{ label: 'Colorado', value: 'CO' },
|
|
8
|
+
{ label: 'Connecticut', value: 'CT' },
|
|
9
|
+
{ label: 'Delaware', value: 'DE' },
|
|
10
|
+
{ label: 'Florida', value: 'FL' },
|
|
11
|
+
{ label: 'Georgia', value: 'GA' },
|
|
12
|
+
{ label: 'Hawaii', value: 'HI' },
|
|
13
|
+
{ label: 'Idaho', value: 'ID' },
|
|
14
|
+
{ label: 'Illinois', value: 'IL' },
|
|
15
|
+
{ label: 'Indiana', value: 'IN' },
|
|
16
|
+
{ label: 'Iowa', value: 'IA' },
|
|
17
|
+
{ label: 'Kansas', value: 'KS' },
|
|
18
|
+
{ label: 'Kentucky', value: 'KY' },
|
|
19
|
+
{ label: 'Louisiana', value: 'LA' },
|
|
20
|
+
{ label: 'Maine', value: 'ME' },
|
|
21
|
+
{ label: 'Maryland', value: 'MD' },
|
|
22
|
+
{ label: 'Massachusetts', value: 'MA' },
|
|
23
|
+
{ label: 'Michigan', value: 'MI' },
|
|
24
|
+
{ label: 'Minnesota', value: 'MN' },
|
|
25
|
+
{ label: 'Mississippi', value: 'MS' },
|
|
26
|
+
{ label: 'Missouri', value: 'MO' },
|
|
27
|
+
{ label: 'Montana', value: 'MT' },
|
|
28
|
+
{ label: 'Nebraska', value: 'NE' },
|
|
29
|
+
{ label: 'Nevada', value: 'NV' },
|
|
30
|
+
{ label: 'New Hampshire', value: 'NH' },
|
|
31
|
+
{ label: 'New Jersey', value: 'NJ' },
|
|
32
|
+
{ label: 'New Mexico', value: 'NM' },
|
|
33
|
+
{ label: 'New York', value: 'NY' },
|
|
34
|
+
{ label: 'North Carolina', value: 'NC' },
|
|
35
|
+
{ label: 'North Dakota', value: 'ND' },
|
|
36
|
+
{ label: 'Ohio', value: 'OH' },
|
|
37
|
+
{ label: 'Oklahoma', value: 'OK' },
|
|
38
|
+
{ label: 'Oregon', value: 'OR' },
|
|
39
|
+
{ label: 'Pennsylvania', value: 'PA' },
|
|
40
|
+
{ label: 'Rhode Island', value: 'RI' },
|
|
41
|
+
{ label: 'South Carolina', value: 'SC' },
|
|
42
|
+
{ label: 'South Dakota', value: 'SD' },
|
|
43
|
+
{ label: 'Tennessee', value: 'TN' },
|
|
44
|
+
{ label: 'Texas', value: 'TX' },
|
|
45
|
+
{ label: 'Utah', value: 'UT' },
|
|
46
|
+
{ label: 'Vermont', value: 'VT' },
|
|
47
|
+
{ label: 'Virginia', value: 'VA' },
|
|
48
|
+
{ label: 'Washington', value: 'WA' },
|
|
49
|
+
{ label: 'West Virginia', value: 'WV' },
|
|
50
|
+
{ label: 'Wisconsin', value: 'WI' },
|
|
51
|
+
{ label: 'Wyoming', value: 'WY' },
|
|
52
|
+
]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TextField } from '@payloadcms/plugin-form-builder/types'
|
|
2
|
+
import type { FieldErrorsImpl, FieldValues, UseFormRegister } from 'react-hook-form'
|
|
3
|
+
|
|
4
|
+
import { Input } from '@/components/ui/input'
|
|
5
|
+
import { Label } from '@/components/ui/label'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
import { Error } from '../Error'
|
|
9
|
+
import { Width } from '../Width'
|
|
10
|
+
|
|
11
|
+
export const Text: React.FC<
|
|
12
|
+
TextField & {
|
|
13
|
+
errors: Partial<FieldErrorsImpl>
|
|
14
|
+
register: UseFormRegister<FieldValues>
|
|
15
|
+
}
|
|
16
|
+
> = ({ name, defaultValue, errors, label, register, required, width }) => {
|
|
17
|
+
return (
|
|
18
|
+
<Width width={width}>
|
|
19
|
+
<Label htmlFor={name}>
|
|
20
|
+
{label}
|
|
21
|
+
|
|
22
|
+
{required && (
|
|
23
|
+
<span className="required">
|
|
24
|
+
* <span className="sr-only">(required)</span>
|
|
25
|
+
</span>
|
|
26
|
+
)}
|
|
27
|
+
</Label>
|
|
28
|
+
<Input defaultValue={defaultValue} id={name} type="text" {...register(name, { required })} />
|
|
29
|
+
{errors[name] && <Error name={name} />}
|
|
30
|
+
</Width>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { TextField } from '@payloadcms/plugin-form-builder/types'
|
|
2
|
+
import type { FieldErrorsImpl, FieldValues, UseFormRegister } from 'react-hook-form'
|
|
3
|
+
|
|
4
|
+
import { Label } from '@/components/ui/label'
|
|
5
|
+
import { Textarea as TextAreaComponent } from '@/components/ui/textarea'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
import { Error } from '../Error'
|
|
9
|
+
import { Width } from '../Width'
|
|
10
|
+
|
|
11
|
+
export const Textarea: React.FC<
|
|
12
|
+
TextField & {
|
|
13
|
+
errors: Partial<FieldErrorsImpl>
|
|
14
|
+
register: UseFormRegister<FieldValues>
|
|
15
|
+
rows?: number
|
|
16
|
+
}
|
|
17
|
+
> = ({ name, defaultValue, errors, label, register, required, rows = 3, width }) => {
|
|
18
|
+
return (
|
|
19
|
+
<Width width={width}>
|
|
20
|
+
<Label htmlFor={name}>
|
|
21
|
+
{label}
|
|
22
|
+
|
|
23
|
+
{required && (
|
|
24
|
+
<span className="required">
|
|
25
|
+
* <span className="sr-only">(required)</span>
|
|
26
|
+
</span>
|
|
27
|
+
)}
|
|
28
|
+
</Label>
|
|
29
|
+
|
|
30
|
+
<TextAreaComponent
|
|
31
|
+
defaultValue={defaultValue}
|
|
32
|
+
id={name}
|
|
33
|
+
rows={rows}
|
|
34
|
+
{...register(name, { required: required })}
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
{errors[name] && <Error name={name} />}
|
|
38
|
+
</Width>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
export const Width: React.FC<{
|
|
4
|
+
children: React.ReactNode
|
|
5
|
+
className?: string
|
|
6
|
+
width?: number | string
|
|
7
|
+
}> = ({ children, className, width }) => {
|
|
8
|
+
return (
|
|
9
|
+
<div className={className} style={{ maxWidth: width ? `${width}%` : undefined }}>
|
|
10
|
+
{children}
|
|
11
|
+
</div>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Block } from 'payload'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
FixedToolbarFeature,
|
|
5
|
+
HeadingFeature,
|
|
6
|
+
InlineToolbarFeature,
|
|
7
|
+
lexicalEditor,
|
|
8
|
+
} from '@payloadcms/richtext-lexical'
|
|
9
|
+
|
|
10
|
+
export const FormBlock: Block = {
|
|
11
|
+
slug: 'formBlock',
|
|
12
|
+
interfaceName: 'FormBlock',
|
|
13
|
+
fields: [
|
|
14
|
+
{
|
|
15
|
+
name: 'form',
|
|
16
|
+
type: 'relationship',
|
|
17
|
+
relationTo: 'forms',
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'enableIntro',
|
|
22
|
+
type: 'checkbox',
|
|
23
|
+
label: 'Enable Intro Content',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'introContent',
|
|
27
|
+
type: 'richText',
|
|
28
|
+
admin: {
|
|
29
|
+
condition: (_, { enableIntro }) => Boolean(enableIntro),
|
|
30
|
+
},
|
|
31
|
+
editor: lexicalEditor({
|
|
32
|
+
features: ({ rootFeatures }) => {
|
|
33
|
+
return [
|
|
34
|
+
...rootFeatures,
|
|
35
|
+
HeadingFeature({ enabledHeadingSizes: ['h1', 'h2', 'h3', 'h4'] }),
|
|
36
|
+
FixedToolbarFeature(),
|
|
37
|
+
InlineToolbarFeature(),
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
label: 'Intro Content',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
graphQL: {
|
|
45
|
+
singularName: 'FormBlock',
|
|
46
|
+
},
|
|
47
|
+
labels: {
|
|
48
|
+
plural: 'Form Blocks',
|
|
49
|
+
singular: 'Form Block',
|
|
50
|
+
},
|
|
51
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Checkbox } from './Checkbox'
|
|
2
|
+
import { Country } from './Country'
|
|
3
|
+
import { Email } from './Email'
|
|
4
|
+
import { Message } from './Message'
|
|
5
|
+
import { Number } from './Number'
|
|
6
|
+
import { Select } from './Select'
|
|
7
|
+
import { State } from './State'
|
|
8
|
+
import { Text } from './Text'
|
|
9
|
+
import { Textarea } from './Textarea'
|
|
10
|
+
|
|
11
|
+
export const fields = {
|
|
12
|
+
checkbox: Checkbox,
|
|
13
|
+
country: Country,
|
|
14
|
+
email: Email,
|
|
15
|
+
message: Message,
|
|
16
|
+
number: Number,
|
|
17
|
+
select: Select,
|
|
18
|
+
state: State,
|
|
19
|
+
text: Text,
|
|
20
|
+
textarea: Textarea,
|
|
21
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "block",
|
|
3
|
+
"name": "Form",
|
|
4
|
+
"label": "Form",
|
|
5
|
+
"sourceName": "Form",
|
|
6
|
+
"portableName": "Form",
|
|
7
|
+
"slug": "formBlock",
|
|
8
|
+
"version": "0.0.1",
|
|
9
|
+
"source": {
|
|
10
|
+
"repo": "Hadizainal/Dusted-Payload-Blocks",
|
|
11
|
+
"originalPath": "CLI-TestGround/dusted-blocks-demo/src/blocks/Form",
|
|
12
|
+
"originalSlug": "formBlock",
|
|
13
|
+
"originalConfigExport": "FormBlock",
|
|
14
|
+
"originalComponentExport": "FormBlock",
|
|
15
|
+
"originalInterfaceName": "FormBlock"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"from": "Checkbox/index.tsx",
|
|
20
|
+
"to": "src/blocks/Form/Checkbox/index.tsx"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"from": "Component.tsx",
|
|
24
|
+
"to": "src/blocks/Form/Component.tsx"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"from": "Country/index.tsx",
|
|
28
|
+
"to": "src/blocks/Form/Country/index.tsx"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"from": "Country/options.ts",
|
|
32
|
+
"to": "src/blocks/Form/Country/options.ts"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"from": "Email/index.tsx",
|
|
36
|
+
"to": "src/blocks/Form/Email/index.tsx"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"from": "Error/index.tsx",
|
|
40
|
+
"to": "src/blocks/Form/Error/index.tsx"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"from": "Message/index.tsx",
|
|
44
|
+
"to": "src/blocks/Form/Message/index.tsx"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"from": "Number/index.tsx",
|
|
48
|
+
"to": "src/blocks/Form/Number/index.tsx"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"from": "Select/index.tsx",
|
|
52
|
+
"to": "src/blocks/Form/Select/index.tsx"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"from": "State/index.tsx",
|
|
56
|
+
"to": "src/blocks/Form/State/index.tsx"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"from": "State/options.ts",
|
|
60
|
+
"to": "src/blocks/Form/State/options.ts"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"from": "Text/index.tsx",
|
|
64
|
+
"to": "src/blocks/Form/Text/index.tsx"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"from": "Textarea/index.tsx",
|
|
68
|
+
"to": "src/blocks/Form/Textarea/index.tsx"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"from": "Width/index.tsx",
|
|
72
|
+
"to": "src/blocks/Form/Width/index.tsx"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"from": "config.ts",
|
|
76
|
+
"to": "src/blocks/Form/config.ts"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"from": "fields.tsx",
|
|
80
|
+
"to": "src/blocks/Form/fields.tsx"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"dependencies": [
|
|
84
|
+
"@payloadcms/plugin-form-builder",
|
|
85
|
+
"@payloadcms/richtext-lexical",
|
|
86
|
+
"react-hook-form"
|
|
87
|
+
],
|
|
88
|
+
"sharedFiles": [],
|
|
89
|
+
"requiredProjectFiles": [
|
|
90
|
+
{
|
|
91
|
+
"path": "src/components/RichText/index.tsx",
|
|
92
|
+
"reason": "Form and message fields render Payload rich text."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"path": "src/components/ui/button.tsx",
|
|
96
|
+
"reason": "Form submit action uses the shared Button."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"path": "src/components/ui/checkbox.tsx",
|
|
100
|
+
"reason": "Checkbox field uses the shared Checkbox."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"path": "src/components/ui/input.tsx",
|
|
104
|
+
"reason": "Text, email, and number fields use the shared Input."
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"path": "src/components/ui/label.tsx",
|
|
108
|
+
"reason": "Form fields use the shared Label."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"path": "src/components/ui/select.tsx",
|
|
112
|
+
"reason": "Country, state, and select fields use the shared Select."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"path": "src/components/ui/textarea.tsx",
|
|
116
|
+
"reason": "Textarea field uses the shared Textarea."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"path": "src/utilities/getURL.ts",
|
|
120
|
+
"reason": "Form submission resolves the client-side API URL."
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"optionalProjectFiles": [],
|
|
124
|
+
"collectionRegistration": {
|
|
125
|
+
"enabled": true,
|
|
126
|
+
"collections": [
|
|
127
|
+
"Pages",
|
|
128
|
+
"Posts"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"renderBlocksRegistration": {
|
|
132
|
+
"enabled": true
|
|
133
|
+
},
|
|
134
|
+
"renderBlocksBehavior": {
|
|
135
|
+
"wrapperless": false
|
|
136
|
+
},
|
|
137
|
+
"pageRouteIntegration": {
|
|
138
|
+
"required": false,
|
|
139
|
+
"manualSteps": []
|
|
140
|
+
},
|
|
141
|
+
"manual": [
|
|
142
|
+
"Register FormBlock in Pages/Posts block arrays if automatic registration was skipped.",
|
|
143
|
+
"Register formBlock in RenderBlocks if automatic registration was skipped.",
|
|
144
|
+
"Run payload generate:types after schema changes.",
|
|
145
|
+
"Run payload generate:importmap if admin/component imports changed."
|
|
146
|
+
],
|
|
147
|
+
"manualSteps": [
|
|
148
|
+
"Register FormBlock in Pages/Posts block arrays if automatic registration was skipped.",
|
|
149
|
+
"Register formBlock in RenderBlocks if automatic registration was skipped.",
|
|
150
|
+
"Run payload generate:types after schema changes.",
|
|
151
|
+
"Run payload generate:importmap if admin/component imports changed."
|
|
152
|
+
],
|
|
153
|
+
"patchTargets": {
|
|
154
|
+
"blockConfigRegistration": {
|
|
155
|
+
"description": "Installer can register FormBlock from @/blocks/Form/config."
|
|
156
|
+
},
|
|
157
|
+
"renderBlocksRegistration": {
|
|
158
|
+
"description": "Installer can register formBlock with component export FormBlock."
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"notes": [
|
|
162
|
+
"Promoted from the verified Dusted Blocks demo implementation.",
|
|
163
|
+
"Installer preserves existing destination files and reports project requirements before writing."
|
|
164
|
+
],
|
|
165
|
+
"exportName": "FormBlock",
|
|
166
|
+
"componentExportName": "FormBlock",
|
|
167
|
+
"interfaceName": "FormBlock"
|
|
168
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { StaticImageData } from 'next/image'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/utilities/ui'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import RichText from '@/components/RichText'
|
|
6
|
+
|
|
7
|
+
import type { MediaBlock as MediaBlockProps } from '@/payload-types'
|
|
8
|
+
|
|
9
|
+
import { Media } from '../../components/Media'
|
|
10
|
+
|
|
11
|
+
type Props = MediaBlockProps & {
|
|
12
|
+
breakout?: boolean
|
|
13
|
+
captionClassName?: string
|
|
14
|
+
className?: string
|
|
15
|
+
enableGutter?: boolean
|
|
16
|
+
imgClassName?: string
|
|
17
|
+
staticImage?: StaticImageData
|
|
18
|
+
disableInnerContainer?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const MediaBlock: React.FC<Props> = (props) => {
|
|
22
|
+
const {
|
|
23
|
+
captionClassName,
|
|
24
|
+
className,
|
|
25
|
+
enableGutter = true,
|
|
26
|
+
imgClassName,
|
|
27
|
+
media,
|
|
28
|
+
staticImage,
|
|
29
|
+
disableInnerContainer,
|
|
30
|
+
} = props
|
|
31
|
+
|
|
32
|
+
let caption
|
|
33
|
+
if (media && typeof media === 'object') caption = media.caption
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
className={cn(
|
|
38
|
+
'',
|
|
39
|
+
{
|
|
40
|
+
container: enableGutter,
|
|
41
|
+
},
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
{(media || staticImage) && (
|
|
46
|
+
<Media
|
|
47
|
+
imgClassName={cn('border border-border rounded-[0.8rem]', imgClassName)}
|
|
48
|
+
resource={media}
|
|
49
|
+
src={staticImage}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
{caption && (
|
|
53
|
+
<div
|
|
54
|
+
className={cn(
|
|
55
|
+
'mt-6',
|
|
56
|
+
{
|
|
57
|
+
container: !disableInnerContainer,
|
|
58
|
+
},
|
|
59
|
+
captionClassName,
|
|
60
|
+
)}
|
|
61
|
+
>
|
|
62
|
+
<RichText data={caption} enableGutter={false} />
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|