blocks-dusted 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/package.json +5 -2
- package/src/cli.js +39 -3
- package/src/commands/shop.js +59 -0
- package/src/commands/warehouse.js +73 -0
- package/src/utils/paths.js +13 -13
- package/templates/blocks/DD-Accordion/Component.tsx +229 -0
- package/templates/blocks/DD-Accordion/README.md +3 -0
- package/templates/blocks/DD-Accordion/config.ts +73 -0
- package/templates/blocks/DD-Accordion/manifest.json +75 -0
- package/templates/blocks/DD-AnimText/Component.tsx +788 -0
- package/templates/blocks/DD-AnimText/README.md +3 -0
- package/templates/blocks/DD-AnimText/config.ts +295 -0
- package/templates/blocks/DD-AnimText/manifest.json +85 -0
- package/templates/blocks/DD-AsideNav/Component.tsx +321 -0
- package/templates/blocks/DD-AsideNav/config.ts +204 -0
- package/templates/blocks/DD-AsideNav/manifest.json +80 -0
- package/templates/blocks/DD-Banner/Component.tsx +51 -0
- package/templates/blocks/DD-Banner/config.ts +57 -0
- package/templates/blocks/DD-Banner/manifest.json +72 -0
- package/templates/blocks/DD-BgLightning/Component.tsx +44 -0
- package/templates/blocks/DD-BgLightning/README.md +3 -0
- package/templates/blocks/DD-BgLightning/config.ts +97 -0
- package/templates/blocks/DD-BgLightning/manifest.json +79 -0
- package/templates/blocks/DD-BookCall/Component.tsx +535 -535
- package/templates/blocks/DD-BookCall/config.ts +238 -238
- package/templates/blocks/DD-ButtonPop/Component.tsx +117 -0
- package/templates/blocks/DD-ButtonPop/config.ts +105 -0
- package/templates/blocks/DD-ButtonPop/manifest.json +88 -0
- package/templates/blocks/DD-ButtonPop/svg-icons/Dust2.tsx +167 -0
- package/templates/blocks/DD-Card/Component.tsx +251 -0
- package/templates/blocks/DD-Card/README.md +4 -0
- package/templates/blocks/DD-Card/config.ts +154 -0
- package/templates/blocks/DD-Card/manifest.json +82 -0
- package/templates/blocks/DD-CardTemplate01/Component.tsx +140 -140
- package/templates/blocks/DD-CardTemplate01/config.ts +106 -106
- package/templates/blocks/DD-Carousel-A/Component.tsx +249 -249
- package/templates/blocks/DD-Carousel-B/Component.tsx +403 -403
- package/templates/blocks/DD-Chip/Component.tsx +250 -0
- package/templates/blocks/DD-Chip/EXAMPLES.md +313 -0
- package/templates/blocks/DD-Chip/README.md +202 -0
- package/templates/blocks/DD-Chip/config.ts +369 -0
- package/templates/blocks/DD-Chip/manifest.json +74 -0
- package/templates/blocks/DD-ComparisonTable/Component.tsx +256 -256
- package/templates/blocks/DD-Contact/Component.tsx +435 -434
- package/templates/blocks/DD-Contact/config.ts +22 -22
- package/templates/blocks/DD-Counter/Component.tsx +190 -0
- package/templates/blocks/DD-Counter/README.md +4 -0
- package/templates/blocks/DD-Counter/config.ts +291 -0
- package/templates/blocks/DD-Counter/manifest.json +74 -0
- package/templates/blocks/DD-CustomCSS/Component.tsx +8 -0
- package/templates/blocks/DD-CustomCSS/README.md +4 -0
- package/templates/blocks/DD-CustomCSS/addToLayout.md +5 -0
- package/templates/blocks/DD-CustomCSS/config.ts +22 -0
- package/templates/blocks/DD-CustomCSS/manifest.json +72 -0
- package/templates/blocks/DD-CustomCSS/renderCustomCSS.md +7 -0
- package/templates/blocks/DD-FeatCat/Component.tsx +302 -302
- package/templates/blocks/DD-FeatCat/config.ts +201 -201
- package/templates/blocks/DD-FeatStrip/Component.tsx +585 -585
- package/templates/blocks/DD-FeatStrip/config.ts +134 -134
- package/templates/blocks/DD-FluidBtn/ButtonsEyeCatching.tsx +628 -0
- package/templates/blocks/DD-FluidBtn/Component.tsx +43 -0
- package/templates/blocks/DD-FluidBtn/README.md +6 -0
- package/templates/blocks/DD-FluidBtn/config.ts +102 -0
- package/templates/blocks/DD-FluidBtn/manifest.json +86 -0
- package/templates/blocks/DD-GooeyInfo/Component.tsx +149 -0
- package/templates/blocks/DD-GooeyInfo/config.ts +135 -0
- package/templates/blocks/DD-GooeyInfo/manifest.json +72 -0
- package/templates/blocks/DD-Hero/Component.tsx +297 -297
- package/templates/blocks/DD-Hero/config.ts +267 -267
- package/templates/blocks/DD-HorizontalScroll/Component.tsx +936 -936
- package/templates/blocks/DD-HorizontalScroll/config.ts +231 -231
- package/templates/blocks/DD-Icon/Component.tsx +287 -0
- package/templates/blocks/DD-Icon/README.md +4 -0
- package/templates/blocks/DD-Icon/config.ts +258 -0
- package/templates/blocks/DD-Icon/hooks/revalidateBlockIds.ts +66 -0
- package/templates/blocks/DD-Icon/manifest.json +82 -0
- package/templates/blocks/DD-IconButton/Component.tsx +455 -0
- package/templates/blocks/DD-IconButton/README.md +326 -0
- package/templates/blocks/DD-IconButton/config.ts +239 -0
- package/templates/blocks/DD-IconButton/manifest.json +85 -0
- package/templates/blocks/DD-IdTag/Component.tsx +21 -0
- package/templates/blocks/DD-IdTag/README.md +4 -0
- package/templates/blocks/DD-IdTag/config.ts +41 -0
- package/templates/blocks/DD-IdTag/manifest.json +72 -0
- package/templates/blocks/DD-Iframe/Component.tsx +45 -0
- package/templates/blocks/DD-Iframe/README.md +4 -0
- package/templates/blocks/DD-Iframe/config.ts +47 -0
- package/templates/blocks/DD-Iframe/manifest.json +72 -0
- package/templates/blocks/DD-IframeMedia/Component.tsx +133 -0
- package/templates/blocks/DD-IframeMedia/README.md +4 -0
- package/templates/blocks/DD-IframeMedia/config.ts +79 -0
- package/templates/blocks/DD-IframeMedia/manifest.json +72 -0
- package/templates/blocks/DD-LineAnim/Component.tsx +36 -0
- package/templates/blocks/DD-LineAnim/README.md +4 -0
- package/templates/blocks/DD-LineAnim/config.ts +90 -0
- package/templates/blocks/DD-LineAnim/manifest.json +80 -0
- package/templates/blocks/DD-LinkGrid/Component.tsx +119 -0
- package/templates/blocks/DD-LinkGrid/README.md +4 -0
- package/templates/blocks/DD-LinkGrid/config.ts +51 -0
- package/templates/blocks/DD-LinkGrid/manifest.json +74 -0
- package/templates/blocks/DD-LogoMarq/Component.tsx +132 -0
- package/templates/blocks/DD-LogoMarq/README.md +4 -0
- package/templates/blocks/DD-LogoMarq/config.ts +264 -0
- package/templates/blocks/DD-LogoMarq/manifest.json +82 -0
- package/templates/blocks/DD-Lottie/Component.tsx +459 -0
- package/templates/blocks/DD-Lottie/README.md +4 -0
- package/templates/blocks/DD-Lottie/config.ts +379 -0
- package/templates/blocks/DD-Lottie/index.tsx +28 -0
- package/templates/blocks/DD-Lottie/manifest.json +83 -0
- package/templates/blocks/DD-MagicBento/Component.tsx +777 -0
- package/templates/blocks/DD-MagicBento/README.md +4 -0
- package/templates/blocks/DD-MagicBento/config.ts +264 -0
- package/templates/blocks/DD-MagicBento/manifest.json +74 -0
- package/templates/blocks/DD-MasonaryMedia/Component.tsx +545 -545
- package/templates/blocks/DD-MasonaryMedia/config.ts +2 -2
- package/templates/blocks/DD-MasonaryMedia/vendor.d.ts +2 -2
- package/templates/blocks/DD-Masonry/Component.tsx +645 -0
- package/templates/blocks/DD-Masonry/README.md +4 -0
- package/templates/blocks/DD-Masonry/config.ts +475 -0
- package/templates/blocks/DD-Masonry/manifest.json +82 -0
- package/templates/blocks/DD-Pricing/Component.tsx +2 -5
- package/templates/blocks/DD-Process/Component.tsx +2 -4
- package/templates/blocks/DD-Process/config.ts +150 -150
- package/templates/blocks/DD-Progress/Component.tsx +156 -0
- package/templates/blocks/DD-Progress/README.md +4 -0
- package/templates/blocks/DD-Progress/config.ts +175 -0
- package/templates/blocks/DD-Progress/manifest.json +74 -0
- package/templates/blocks/DD-ProjHeader/Component.tsx +91 -0
- package/templates/blocks/DD-ProjHeader/README.md +4 -0
- package/templates/blocks/DD-ProjHeader/config.ts +96 -0
- package/templates/blocks/DD-ProjHeader/manifest.json +72 -0
- package/templates/blocks/DD-ProjSlider/Component.tsx +123 -0
- package/templates/blocks/DD-ProjSlider/README.md +4 -0
- package/templates/blocks/DD-ProjSlider/config.ts +64 -0
- package/templates/blocks/DD-ProjSlider/manifest.json +72 -0
- package/templates/blocks/DD-ScrollText/Component.tsx +114 -0
- package/templates/blocks/DD-ScrollText/README.md +4 -0
- package/templates/blocks/DD-ScrollText/config.ts +58 -0
- package/templates/blocks/DD-ScrollText/manifest.json +72 -0
- package/templates/blocks/DD-Section/Component.tsx +266 -266
- package/templates/blocks/DD-Separator/Component.tsx +66 -0
- package/templates/blocks/DD-Separator/README.md +4 -0
- package/templates/blocks/DD-Separator/config.ts +58 -0
- package/templates/blocks/DD-Separator/manifest.json +72 -0
- package/templates/blocks/DD-Services/Component.tsx +176 -176
- package/templates/blocks/DD-Services/config.ts +149 -149
- package/templates/blocks/DD-ShowcaseGrid/Component.tsx +307 -307
- package/templates/blocks/DD-Slider-A/Component.tsx +1 -1
- package/templates/blocks/DD-StackCards/Component.tsx +1 -1
- package/templates/blocks/DD-StackCards/config.ts +399 -399
- package/templates/blocks/DD-Team/Component.tsx +247 -247
- package/templates/blocks/DD-Team/config.ts +173 -173
- package/templates/blocks/DD-TeamCards/Component.tsx +251 -0
- package/templates/blocks/DD-TeamCards/README.md +4 -0
- package/templates/blocks/DD-TeamCards/config.ts +302 -0
- package/templates/blocks/DD-TeamCards/manifest.json +74 -0
- package/templates/blocks/DD-TechStack/Component.tsx +174 -174
- package/templates/blocks/DD-TechStack/config.ts +153 -153
- package/templates/blocks/DD-TestMarq/Component.tsx +132 -0
- package/templates/blocks/DD-TestMarq/README.md +4 -0
- package/templates/blocks/DD-TestMarq/RowLabel.tsx +9 -0
- package/templates/blocks/DD-TestMarq/config.ts +88 -0
- package/templates/blocks/DD-TestMarq/manifest.json +72 -0
- package/templates/blocks/DD-Testim/Component.tsx +247 -0
- package/templates/blocks/DD-Testim/README.md +4 -0
- package/templates/blocks/DD-Testim/config.ts +101 -0
- package/templates/blocks/DD-Testim/manifest.json +75 -0
- package/templates/blocks/DD-Testim2/Component.tsx +256 -0
- package/templates/blocks/DD-Testim2/README.md +4 -0
- package/templates/blocks/DD-Testim2/config.ts +100 -0
- package/templates/blocks/DD-Testim2/manifest.json +74 -0
- package/templates/blocks/DD-Testimonials/Component.tsx +139 -147
- package/templates/blocks/DD-Testimonials/config.ts +120 -120
- package/templates/blocks/DD-TextMarq/Component.tsx +157 -0
- package/templates/blocks/DD-TextMarq/README.md +4 -0
- package/templates/blocks/DD-TextMarq/config.ts +237 -0
- package/templates/blocks/DD-TextMarq/manifest.json +82 -0
- package/templates/blocks/DD-Thanks/Component.tsx +501 -0
- package/templates/blocks/DD-Thanks/README.md +4 -0
- package/templates/blocks/DD-Thanks/config.ts +224 -0
- package/templates/blocks/DD-Thanks/manifest.json +72 -0
- package/templates/blocks/DD-VertMarq/Component.tsx +154 -0
- package/templates/blocks/DD-VertMarq/README.md +4 -0
- package/templates/blocks/DD-VertMarq/config.ts +236 -0
- package/templates/blocks/DD-VertMarq/dist/index.css +6 -0
- package/templates/blocks/DD-VertMarq/dist/index.min.css +1 -0
- package/templates/blocks/DD-VertMarq/manifest.json +74 -0
- package/templates/blocks/DD-Work/Component.tsx +318 -315
- package/templates/blocks/DD-Work/config.ts +165 -165
- package/templates/blocks/DD-Work-B/Component.tsx +294 -294
- package/templates/blocks/DDHG-CTASection2/Component.tsx +185 -0
- package/templates/blocks/DDHG-CTASection2/config.ts +140 -0
- package/templates/blocks/DDHG-CTASection2/manifest.json +45 -0
- package/templates/blocks/DDHG-HighlightArc/Component.tsx +243 -0
- package/templates/blocks/DDHG-HighlightArc/config.ts +85 -0
- package/templates/blocks/DDHG-HighlightArc/manifest.json +46 -0
- package/templates/blocks/DDHG-LogoMarquee/Component.tsx +143 -0
- package/templates/blocks/DDHG-LogoMarquee/config.ts +154 -0
- package/templates/blocks/DDHG-LogoMarquee/manifest.json +39 -0
- package/templates/blocks/DDHG-NavCodeGrid/Component.tsx +227 -0
- package/templates/blocks/DDHG-NavCodeGrid/config.ts +64 -0
- package/templates/blocks/DDHG-NavCodeGrid/manifest.json +45 -0
- package/templates/blocks/DDHG-ProcessSec/Component.tsx +574 -0
- package/templates/blocks/DDHG-ProcessSec/config.ts +170 -0
- package/templates/blocks/DDHG-ProcessSec/manifest.json +56 -0
- package/templates/blocks/DDHG-ServiceDetails/Component.tsx +164 -0
- package/templates/blocks/DDHG-ServiceDetails/ServiceDetailCard.tsx +390 -0
- package/templates/blocks/DDHG-ServiceDetails/config.ts +77 -0
- package/templates/blocks/DDHG-ServiceDetails/manifest.json +50 -0
- package/templates/blocks/DDHG-ServiceHero/Component.tsx +234 -0
- package/templates/blocks/DDHG-ServiceHero/config.ts +49 -0
- package/templates/blocks/DDHG-ServiceHero/manifest.json +26 -0
- package/templates/blocks/DDHG-ServiceOverview/Component.tsx +277 -0
- package/templates/blocks/DDHG-ServiceOverview/config.ts +64 -0
- package/templates/blocks/DDHG-ServiceOverview/manifest.json +44 -0
- package/templates/blocks/DDHG-StatsFAQ/Component.tsx +389 -0
- package/templates/blocks/DDHG-StatsFAQ/config.ts +204 -0
- package/templates/blocks/DDHG-StatsFAQ/manifest.json +45 -0
- package/templates/blocks/DDHG-TeamCards/Component.tsx +169 -0
- package/templates/blocks/DDHG-TeamCards/config.ts +48 -0
- package/templates/blocks/DDHG-TeamCards/manifest.json +29 -0
- package/templates/shared/src/components/BgLightning/index.tsx +242 -0
- package/templates/shared/src/components/ui/ShareButton/index.tsx +80 -0
- package/templates/shared/src/components/ui/anims/FadeOnScroll.tsx +48 -0
- package/templates/shared/src/components/ui/anims/FadeUpOnInView.tsx +63 -0
- package/templates/shared/src/components/ui/anims/GlareHover.tsx +111 -0
- package/templates/shared/src/components/ui/anims/LineAnims.tsx +81 -0
- package/templates/shared/src/components/ui/anims/TitleAnims01.tsx +54 -0
- package/templates/shared/src/components/ui/anims/animation-container.tsx +29 -0
- package/templates/shared/src/components/ui/anims/blur-in.tsx +26 -0
- package/templates/shared/src/components/ui/anims/counter.tsx +53 -0
- package/templates/shared/src/components/ui/anims/fade.tsx +83 -0
- package/templates/shared/src/components/ui/anims/gradual-spacing.tsx +39 -0
- package/templates/shared/src/components/ui/anims/pull-up.tsx +93 -0
- package/templates/shared/src/components/ui/anims/reveal-text.tsx +76 -0
- package/templates/shared/src/components/ui/anims/rotate-words.tsx +43 -0
- package/templates/shared/src/components/ui/anims/shiny-text.tsx +58 -0
- package/templates/shared/src/components/ui/anims/shuffle-text.tsx +85 -0
- package/templates/shared/src/components/ui/anims/split-text.tsx +211 -0
- package/templates/shared/src/components/ui/anims/staggered-fade.tsx +133 -0
- package/templates/shared/src/components/ui/anims/text-scroll.tsx +111 -0
- package/templates/shared/src/components/ui/anims/typing-effect.tsx +112 -0
- package/templates/shared/src/components/ui/button-dusted-fluid/index.tsx +1521 -0
- package/templates/shared/src/components/ui/separator.tsx +85 -0
- package/templates/shared/src/hooks/useBodyScrollLock.ts +97 -0
- package/templates/shared/src/hooks/useClickOutside.ts +28 -0
- package/templates/shared/src/utilities/renderCustomCSS.ts +5 -0
- package/templates/shared/src/utilities/smoothScroll.ts +65 -0
|
@@ -24,7 +24,7 @@ export const DDContact: Block = {
|
|
|
24
24
|
name: 'headlineMain',
|
|
25
25
|
type: 'text',
|
|
26
26
|
label: 'Headline (Main)',
|
|
27
|
-
required: true,
|
|
27
|
+
required: true,
|
|
28
28
|
defaultValue: "Let's build"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
@@ -118,27 +118,27 @@ export const DDContact: Block = {
|
|
|
118
118
|
}
|
|
119
119
|
]
|
|
120
120
|
},
|
|
121
|
-
{
|
|
122
|
-
label: 'Form',
|
|
123
|
-
fields: [
|
|
124
|
-
// Reconnect option:
|
|
125
|
-
// If the target project has Payload Form Builder enabled with a forms
|
|
126
|
-
// collection, uncomment this relationship field. Without it, the block
|
|
127
|
-
// renders as a standalone contact composition and does not submit to Payload.
|
|
128
|
-
// {
|
|
129
|
-
// name: 'form',
|
|
130
|
-
// type: 'relationship',
|
|
131
|
-
// relationTo: 'forms',
|
|
132
|
-
// label: 'Payload Form',
|
|
133
|
-
// required: false,
|
|
134
|
-
// admin: {
|
|
135
|
-
// description:
|
|
136
|
-
// 'Select the Payload Form Builder form used to store Studio Contact submissions.'
|
|
137
|
-
// }
|
|
138
|
-
// },
|
|
139
|
-
{
|
|
140
|
-
name: 'serviceOptions',
|
|
141
|
-
type: 'array',
|
|
121
|
+
{
|
|
122
|
+
label: 'Form',
|
|
123
|
+
fields: [
|
|
124
|
+
// Reconnect option:
|
|
125
|
+
// If the target project has Payload Form Builder enabled with a forms
|
|
126
|
+
// collection, uncomment this relationship field. Without it, the block
|
|
127
|
+
// renders as a standalone contact composition and does not submit to Payload.
|
|
128
|
+
// {
|
|
129
|
+
// name: 'form',
|
|
130
|
+
// type: 'relationship',
|
|
131
|
+
// relationTo: 'forms',
|
|
132
|
+
// label: 'Payload Form',
|
|
133
|
+
// required: false,
|
|
134
|
+
// admin: {
|
|
135
|
+
// description:
|
|
136
|
+
// 'Select the Payload Form Builder form used to store Studio Contact submissions.'
|
|
137
|
+
// }
|
|
138
|
+
// },
|
|
139
|
+
{
|
|
140
|
+
name: 'serviceOptions',
|
|
141
|
+
type: 'array',
|
|
142
142
|
label: 'Service Options',
|
|
143
143
|
fields: [
|
|
144
144
|
{
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { animate, useInView, useIsomorphicLayoutEffect } from 'framer-motion'
|
|
5
|
+
import RichText from '@/components/RichText'
|
|
6
|
+
|
|
7
|
+
export interface CounterItem {
|
|
8
|
+
id: string
|
|
9
|
+
from?: number
|
|
10
|
+
to: number
|
|
11
|
+
duration?: number
|
|
12
|
+
className?: string
|
|
13
|
+
counterContId?: string
|
|
14
|
+
counterId?: string
|
|
15
|
+
prefix?: string
|
|
16
|
+
suffix?: string
|
|
17
|
+
prefixClass?: string
|
|
18
|
+
suffixClass?: string
|
|
19
|
+
beforeCounter?: any // Rich text content before counter
|
|
20
|
+
label?: any // Rich text content after counter
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface CounterBlockProps {
|
|
24
|
+
counters: CounterItem[]
|
|
25
|
+
containerClass?: string
|
|
26
|
+
counterContId?: string
|
|
27
|
+
counterId?: string
|
|
28
|
+
// Layout props
|
|
29
|
+
layoutType?: 'flex' | 'grid' | 'block'
|
|
30
|
+
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse'
|
|
31
|
+
justifyContent?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'
|
|
32
|
+
alignItems?: 'stretch' | 'start' | 'center' | 'end' | 'baseline'
|
|
33
|
+
gap?: '0' | '4' | '6' | '8' | '12'
|
|
34
|
+
gridColumns?: '1' | '2' | '3' | '4' | '6' | 'auto-fit' | 'auto-fill'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Counter: React.FC<CounterItem> = ({
|
|
38
|
+
from = 0,
|
|
39
|
+
to,
|
|
40
|
+
duration,
|
|
41
|
+
className,
|
|
42
|
+
prefix,
|
|
43
|
+
suffix,
|
|
44
|
+
prefixClass,
|
|
45
|
+
suffixClass,
|
|
46
|
+
}) => {
|
|
47
|
+
const ref = React.useRef<HTMLSpanElement>(null)
|
|
48
|
+
const inView = useInView(ref, { once: false })
|
|
49
|
+
|
|
50
|
+
useIsomorphicLayoutEffect(() => {
|
|
51
|
+
const element = ref.current
|
|
52
|
+
if (!element) return
|
|
53
|
+
if (!inView) return
|
|
54
|
+
|
|
55
|
+
element.textContent = String(from)
|
|
56
|
+
|
|
57
|
+
if (window.matchMedia('(prefers-reduced-motion)').matches) {
|
|
58
|
+
element.textContent = String(to)
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const controls = animate(from, to, {
|
|
63
|
+
duration,
|
|
64
|
+
ease: 'easeOut',
|
|
65
|
+
onUpdate(value) {
|
|
66
|
+
if (element && typeof value === 'number') {
|
|
67
|
+
element.textContent = value.toFixed(0)
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return () => {
|
|
73
|
+
controls.stop()
|
|
74
|
+
}
|
|
75
|
+
}, [ref, inView, from, to, duration])
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div className="counter-wrapper flex items-center justify-center">
|
|
79
|
+
{prefix && (
|
|
80
|
+
<span className={prefixClass || 'text-xl font-bold sm:text-2xl md:text-4xl'}>{prefix}</span>
|
|
81
|
+
)}
|
|
82
|
+
<span ref={ref} className={className || 'text-xl font-bold sm:text-2xl md:text-4xl'} />
|
|
83
|
+
{suffix && (
|
|
84
|
+
<span className={suffixClass || 'text-md font-base sm:text-lg md:text-xl ml-2'}>
|
|
85
|
+
{suffix}
|
|
86
|
+
</span>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const DDCounter: React.FC<CounterBlockProps> = ({
|
|
93
|
+
counters,
|
|
94
|
+
containerClass,
|
|
95
|
+
counterContId,
|
|
96
|
+
counterId,
|
|
97
|
+
layoutType = 'flex',
|
|
98
|
+
flexDirection = 'row',
|
|
99
|
+
justifyContent = 'center',
|
|
100
|
+
alignItems = 'center',
|
|
101
|
+
gap = '6',
|
|
102
|
+
gridColumns = '2',
|
|
103
|
+
}) => {
|
|
104
|
+
// Generate layout classes based on configuration
|
|
105
|
+
const getLayoutClasses = () => {
|
|
106
|
+
// If custom containerClass is provided, use it
|
|
107
|
+
if (containerClass) return containerClass
|
|
108
|
+
|
|
109
|
+
const classes: string[] = []
|
|
110
|
+
|
|
111
|
+
// Base layout type
|
|
112
|
+
if (layoutType === 'flex') {
|
|
113
|
+
classes.push('flex')
|
|
114
|
+
|
|
115
|
+
// Flex direction
|
|
116
|
+
const flexDirMap = {
|
|
117
|
+
row: 'flex-row',
|
|
118
|
+
column: 'flex-col',
|
|
119
|
+
'row-reverse': 'flex-row-reverse',
|
|
120
|
+
'column-reverse': 'flex-col-reverse',
|
|
121
|
+
}
|
|
122
|
+
classes.push(flexDirMap[flexDirection])
|
|
123
|
+
|
|
124
|
+
// Add flex-wrap for responsive behavior
|
|
125
|
+
classes.push('flex-wrap')
|
|
126
|
+
|
|
127
|
+
// Justify content
|
|
128
|
+
const justifyMap = {
|
|
129
|
+
start: 'justify-start',
|
|
130
|
+
center: 'justify-center',
|
|
131
|
+
end: 'justify-end',
|
|
132
|
+
between: 'justify-between',
|
|
133
|
+
around: 'justify-around',
|
|
134
|
+
evenly: 'justify-evenly',
|
|
135
|
+
}
|
|
136
|
+
classes.push(justifyMap[justifyContent])
|
|
137
|
+
|
|
138
|
+
// Align items
|
|
139
|
+
const alignMap = {
|
|
140
|
+
stretch: 'items-stretch',
|
|
141
|
+
start: 'items-start',
|
|
142
|
+
center: 'items-center',
|
|
143
|
+
end: 'items-end',
|
|
144
|
+
baseline: 'items-baseline',
|
|
145
|
+
}
|
|
146
|
+
classes.push(alignMap[alignItems])
|
|
147
|
+
} else if (layoutType === 'grid') {
|
|
148
|
+
classes.push('grid')
|
|
149
|
+
|
|
150
|
+
// Grid columns
|
|
151
|
+
if (gridColumns === 'auto-fit') {
|
|
152
|
+
classes.push('grid-cols-[repeat(auto-fit,minmax(200px,1fr))]')
|
|
153
|
+
} else if (gridColumns === 'auto-fill') {
|
|
154
|
+
classes.push('grid-cols-[repeat(auto-fill,minmax(200px,1fr))]')
|
|
155
|
+
} else {
|
|
156
|
+
classes.push(`grid-cols-${gridColumns}`)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Gap (works for both flex and grid)
|
|
161
|
+
if (layoutType === 'flex' || layoutType === 'grid') {
|
|
162
|
+
classes.push(`gap-${gap}`)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return classes.join(' ')
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<div className={getLayoutClasses()} id={counterContId}>
|
|
170
|
+
{counters.map((counter) => (
|
|
171
|
+
<div key={counter.id} className="counter-item" id={counterId}>
|
|
172
|
+
<RichText
|
|
173
|
+
data={counter.beforeCounter}
|
|
174
|
+
enableGutter={false}
|
|
175
|
+
className="counter_label-before"
|
|
176
|
+
/>
|
|
177
|
+
|
|
178
|
+
<Counter {...counter} />
|
|
179
|
+
|
|
180
|
+
<RichText
|
|
181
|
+
data={counter.label}
|
|
182
|
+
enableProse={false}
|
|
183
|
+
enableGutter={false}
|
|
184
|
+
className="counter_label-after scale-80 origin-top"
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
))}
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import type { Block } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { BlocksFeature } from '@payloadcms/richtext-lexical'
|
|
4
|
+
import { DDIcon } from '@/blocks/DD-Icon/config'
|
|
5
|
+
import { defaultLexical } from '@/fields/defaultLexical'
|
|
6
|
+
|
|
7
|
+
export const DDCounter: Block = {
|
|
8
|
+
slug: 'DD-Counter',
|
|
9
|
+
interfaceName: 'DDCounter',
|
|
10
|
+
labels: {
|
|
11
|
+
singular: 'Counter',
|
|
12
|
+
plural: 'Counters'
|
|
13
|
+
},
|
|
14
|
+
// Add flex or grid classes to the container
|
|
15
|
+
fields: [
|
|
16
|
+
// Layout Configuration
|
|
17
|
+
{
|
|
18
|
+
admin: {
|
|
19
|
+
initCollapsed: true,
|
|
20
|
+
className: 'layout-configuration custom-css-class'
|
|
21
|
+
},
|
|
22
|
+
type: 'collapsible',
|
|
23
|
+
label: 'Container Layout Configuration',
|
|
24
|
+
fields: [
|
|
25
|
+
{
|
|
26
|
+
name: 'layoutType',
|
|
27
|
+
label: 'Layout Type',
|
|
28
|
+
type: 'select',
|
|
29
|
+
defaultValue: 'flex',
|
|
30
|
+
options: [
|
|
31
|
+
{
|
|
32
|
+
label: 'Flexbox',
|
|
33
|
+
value: 'flex'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Grid',
|
|
37
|
+
value: 'grid'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Block (Default)',
|
|
41
|
+
value: 'block'
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
// Flex-specific options
|
|
47
|
+
{
|
|
48
|
+
name: 'flexDirection',
|
|
49
|
+
label: 'Flex Direction',
|
|
50
|
+
type: 'select',
|
|
51
|
+
defaultValue: 'row',
|
|
52
|
+
options: [
|
|
53
|
+
{ label: 'Row (Horizontal)', value: 'row' },
|
|
54
|
+
{ label: 'Column (Vertical)', value: 'column' },
|
|
55
|
+
{ label: 'Row Reverse', value: 'row-reverse' },
|
|
56
|
+
{ label: 'Column Reverse', value: 'column-reverse' }
|
|
57
|
+
],
|
|
58
|
+
admin: {
|
|
59
|
+
condition: (data, siblingData) => siblingData?.layoutType === 'flex'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'justifyContent',
|
|
64
|
+
label: 'Justify Content',
|
|
65
|
+
type: 'select',
|
|
66
|
+
defaultValue: 'center',
|
|
67
|
+
options: [
|
|
68
|
+
{ label: 'Start', value: 'start' },
|
|
69
|
+
{ label: 'Center', value: 'center' },
|
|
70
|
+
{ label: 'End', value: 'end' },
|
|
71
|
+
{ label: 'Space Between', value: 'between' },
|
|
72
|
+
{ label: 'Space Around', value: 'around' },
|
|
73
|
+
{ label: 'Space Evenly', value: 'evenly' }
|
|
74
|
+
],
|
|
75
|
+
admin: {
|
|
76
|
+
condition: (data, siblingData) => siblingData?.layoutType === 'flex'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'alignItems',
|
|
81
|
+
label: 'Align Items',
|
|
82
|
+
type: 'select',
|
|
83
|
+
defaultValue: 'center',
|
|
84
|
+
options: [
|
|
85
|
+
{ label: 'Stretch', value: 'stretch' },
|
|
86
|
+
{ label: 'Start', value: 'start' },
|
|
87
|
+
{ label: 'Center', value: 'center' },
|
|
88
|
+
{ label: 'End', value: 'end' },
|
|
89
|
+
{ label: 'Baseline', value: 'baseline' }
|
|
90
|
+
],
|
|
91
|
+
admin: {
|
|
92
|
+
condition: (data, siblingData) => siblingData?.layoutType === 'flex'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'gap',
|
|
97
|
+
label: 'Gap',
|
|
98
|
+
type: 'select',
|
|
99
|
+
defaultValue: '6',
|
|
100
|
+
options: [
|
|
101
|
+
{ label: 'None', value: '0' },
|
|
102
|
+
{ label: 'Small (1rem)', value: '4' },
|
|
103
|
+
{ label: 'Medium (1.5rem)', value: '6' },
|
|
104
|
+
{ label: 'Large (2rem)', value: '8' },
|
|
105
|
+
{ label: 'Extra Large (3rem)', value: '12' }
|
|
106
|
+
],
|
|
107
|
+
admin: {
|
|
108
|
+
condition: (data, siblingData) =>
|
|
109
|
+
siblingData?.layoutType === 'flex' || siblingData?.layoutType === 'grid'
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
// Grid-specific options
|
|
113
|
+
{
|
|
114
|
+
name: 'gridColumns',
|
|
115
|
+
label: 'Grid Columns',
|
|
116
|
+
type: 'select',
|
|
117
|
+
defaultValue: '2',
|
|
118
|
+
options: [
|
|
119
|
+
{ label: '1 Column', value: '1' },
|
|
120
|
+
{ label: '2 Columns', value: '2' },
|
|
121
|
+
{ label: '3 Columns', value: '3' },
|
|
122
|
+
{ label: '4 Columns', value: '4' },
|
|
123
|
+
{ label: '6 Columns', value: '6' },
|
|
124
|
+
{ label: 'Auto Fit', value: 'auto-fit' },
|
|
125
|
+
{ label: 'Auto Fill', value: 'auto-fill' }
|
|
126
|
+
],
|
|
127
|
+
admin: {
|
|
128
|
+
condition: (data, siblingData) => siblingData?.layoutType === 'grid'
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'containerClass',
|
|
133
|
+
label: 'Container CSS Classes',
|
|
134
|
+
type: 'text',
|
|
135
|
+
required: false,
|
|
136
|
+
admin: {
|
|
137
|
+
description:
|
|
138
|
+
'Custom CSS classes for the counter container. Leave empty to use layout-generated classes.',
|
|
139
|
+
placeholder: 'flex flex-wrap gap-6 justify-center items-center'
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'counters',
|
|
146
|
+
type: 'array',
|
|
147
|
+
label: 'Counters',
|
|
148
|
+
minRows: 1,
|
|
149
|
+
fields: [
|
|
150
|
+
{
|
|
151
|
+
name: 'counterContId',
|
|
152
|
+
type: 'text',
|
|
153
|
+
label: 'Counter ID',
|
|
154
|
+
hidden: false,
|
|
155
|
+
required: false,
|
|
156
|
+
admin: {
|
|
157
|
+
description: 'Unique ID for the counter',
|
|
158
|
+
width: '50%'
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'from',
|
|
163
|
+
label: 'From',
|
|
164
|
+
type: 'number',
|
|
165
|
+
required: true,
|
|
166
|
+
admin: {
|
|
167
|
+
description: 'Starting number for the counter',
|
|
168
|
+
width: '50%'
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'to',
|
|
173
|
+
label: 'To',
|
|
174
|
+
type: 'number',
|
|
175
|
+
required: true,
|
|
176
|
+
admin: {
|
|
177
|
+
description: 'End number for the counter',
|
|
178
|
+
width: '50%'
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'duration',
|
|
183
|
+
label: 'Animation Duration (seconds)',
|
|
184
|
+
type: 'number',
|
|
185
|
+
required: false,
|
|
186
|
+
defaultValue: 3,
|
|
187
|
+
admin: {
|
|
188
|
+
description: 'Duration of the animation in seconds'
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'className',
|
|
193
|
+
label: 'Counter Text Class',
|
|
194
|
+
type: 'text',
|
|
195
|
+
required: false,
|
|
196
|
+
admin: {
|
|
197
|
+
description:
|
|
198
|
+
'Custom CSS classes for the counter number. Default: "text-xl font-bold sm:text-2xl md:text-3xl"',
|
|
199
|
+
placeholder: 'text-2xl font-extrabold text-blue-500'
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: 'beforeCounter',
|
|
204
|
+
label: 'Before Counter Text',
|
|
205
|
+
type: 'richText',
|
|
206
|
+
editor: defaultLexical,
|
|
207
|
+
required: false,
|
|
208
|
+
admin: {
|
|
209
|
+
description: 'Rich text content that appears before the counter'
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'label',
|
|
214
|
+
label: 'Counter Label',
|
|
215
|
+
type: 'richText',
|
|
216
|
+
editor: defaultLexical,
|
|
217
|
+
required: false,
|
|
218
|
+
admin: {
|
|
219
|
+
description: 'Rich text label that appears below the counter'
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
admin: {
|
|
224
|
+
initCollapsed: true
|
|
225
|
+
},
|
|
226
|
+
type: 'collapsible',
|
|
227
|
+
label: 'Prefix & Suffix',
|
|
228
|
+
fields: [
|
|
229
|
+
{
|
|
230
|
+
type: 'row',
|
|
231
|
+
fields: [
|
|
232
|
+
{
|
|
233
|
+
name: 'prefix',
|
|
234
|
+
label: 'Prefix Text/Symbol',
|
|
235
|
+
type: 'text',
|
|
236
|
+
required: false,
|
|
237
|
+
admin: {
|
|
238
|
+
description: 'Text or symbol to show before the counter (e.g., "$", "+", "≈")',
|
|
239
|
+
placeholder: '$',
|
|
240
|
+
width: '50%'
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'suffix',
|
|
245
|
+
label: 'Suffix Text/Symbol',
|
|
246
|
+
type: 'text',
|
|
247
|
+
required: false,
|
|
248
|
+
admin: {
|
|
249
|
+
description:
|
|
250
|
+
'Text or symbol to show after the counter (e.g., "%", "+", "K", "M")',
|
|
251
|
+
placeholder: '%',
|
|
252
|
+
width: '50%'
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
type: 'row',
|
|
259
|
+
fields: [
|
|
260
|
+
{
|
|
261
|
+
name: 'prefixClass',
|
|
262
|
+
label: 'Prefix CSS Classes',
|
|
263
|
+
type: 'text',
|
|
264
|
+
required: false,
|
|
265
|
+
admin: {
|
|
266
|
+
description:
|
|
267
|
+
'Custom CSS classes for the prefix. Uses counter class as default.',
|
|
268
|
+
placeholder: 'text-lg text-green-500',
|
|
269
|
+
width: '50%'
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: 'suffixClass',
|
|
274
|
+
label: 'Suffix CSS Classes',
|
|
275
|
+
type: 'text',
|
|
276
|
+
required: false,
|
|
277
|
+
admin: {
|
|
278
|
+
description:
|
|
279
|
+
'Custom CSS classes for the suffix. Uses counter class as default.',
|
|
280
|
+
placeholder: 'text-lg text-blue-500',
|
|
281
|
+
width: '50%'
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "block",
|
|
3
|
+
"name": "DD-Counter",
|
|
4
|
+
"label": "Counter",
|
|
5
|
+
"sourceName": "CounterBlock",
|
|
6
|
+
"portableName": "DD-Counter",
|
|
7
|
+
"slug": "DD-Counter",
|
|
8
|
+
"version": "0.0.1",
|
|
9
|
+
"source": {
|
|
10
|
+
"repo": "Hadizainal/DesignsDustedv3",
|
|
11
|
+
"originalPath": "src/blocks/ROUND-TWO-CONVERSION/CounterBlock",
|
|
12
|
+
"originalSlug": "counterBlock",
|
|
13
|
+
"originalConfigExport": "CounterBlock",
|
|
14
|
+
"originalComponentExport": "CounterBlock",
|
|
15
|
+
"originalInterfaceName": "DDCounter"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
{
|
|
19
|
+
"from": "Component.tsx",
|
|
20
|
+
"to": "src/blocks/DD-Counter/Component.tsx"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"from": "config.ts",
|
|
24
|
+
"to": "src/blocks/DD-Counter/config.ts"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"dependencies": [
|
|
28
|
+
"framer-motion"
|
|
29
|
+
],
|
|
30
|
+
"sharedFiles": [],
|
|
31
|
+
"requiredProjectFiles": [],
|
|
32
|
+
"optionalProjectFiles": [],
|
|
33
|
+
"collectionRegistration": {
|
|
34
|
+
"enabled": true,
|
|
35
|
+
"collections": [
|
|
36
|
+
"Pages",
|
|
37
|
+
"Posts"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"renderBlocksRegistration": {
|
|
41
|
+
"enabled": true
|
|
42
|
+
},
|
|
43
|
+
"renderBlocksBehavior": {
|
|
44
|
+
"wrapperless": false
|
|
45
|
+
},
|
|
46
|
+
"pageRouteIntegration": {
|
|
47
|
+
"required": false,
|
|
48
|
+
"manualSteps": []
|
|
49
|
+
},
|
|
50
|
+
"manual": [
|
|
51
|
+
"Register DDCounter in Pages/Posts blocks arrays if automatic registration was skipped.",
|
|
52
|
+
"Register DD-Counter in RenderBlocks if automatic registration was skipped.",
|
|
53
|
+
"Run payload generate:types after schema changes."
|
|
54
|
+
],
|
|
55
|
+
"manualSteps": [
|
|
56
|
+
"Register DDCounter in Pages/Posts blocks arrays if automatic registration was skipped.",
|
|
57
|
+
"Register DD-Counter in RenderBlocks if automatic registration was skipped.",
|
|
58
|
+
"Run payload generate:types after schema changes."
|
|
59
|
+
],
|
|
60
|
+
"patchTargets": {
|
|
61
|
+
"blockConfigRegistration": {
|
|
62
|
+
"description": "Installer can add import { DDCounter } from '@/blocks/DD-Counter/config' and add DDCounter to clear Pages/Posts block arrays."
|
|
63
|
+
},
|
|
64
|
+
"renderBlocksRegistration": {
|
|
65
|
+
"description": "Installer can register DD-Counter in RenderBlocks."
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"notes": [
|
|
69
|
+
"Converted from ROUND-TWO-CONVERSION as a portable Dusted template.",
|
|
70
|
+
"Project-specific imports were replaced with local, dependency-light rendering where required."
|
|
71
|
+
],
|
|
72
|
+
"exportName": "DDCounter",
|
|
73
|
+
"interfaceName": "DDCounter"
|
|
74
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
type Props = { css?: string | null; customCSS?: string | null }
|
|
4
|
+
export const DDCustomCSS: React.FC<Props> = ({ css, customCSS }) => {
|
|
5
|
+
const value = css || customCSS
|
|
6
|
+
return value ? <style dangerouslySetInnerHTML={{ __html: value }} /> : null
|
|
7
|
+
}
|
|
8
|
+
export default DDCustomCSS
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//src/blocks/DDCustomCSS/config.ts
|
|
2
|
+
|
|
3
|
+
import { Block } from 'payload'
|
|
4
|
+
|
|
5
|
+
export const DDCustomCSS: Block = {
|
|
6
|
+
slug: 'DD-CustomCSS',
|
|
7
|
+
interfaceName: 'DDCustomCSS',
|
|
8
|
+
labels: {
|
|
9
|
+
singular: 'Custom CSS',
|
|
10
|
+
plural: 'Custom CSS Blocks',
|
|
11
|
+
},
|
|
12
|
+
fields: [
|
|
13
|
+
{
|
|
14
|
+
name: 'css',
|
|
15
|
+
type: 'code',
|
|
16
|
+
admin: {
|
|
17
|
+
language: 'css',
|
|
18
|
+
description: 'Write custom CSS to override styles on production application.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|