blocks-dusted 0.1.2 → 0.1.3
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/templates/components/HeaderDD02/MobileBottomNav/index.tsx +545 -0
- package/templates/components/HeaderDD02/README.md +45 -0
- package/templates/components/HeaderDD02/RowLabel.tsx +33 -0
- package/templates/components/HeaderDD02/config.ts +302 -0
- package/templates/components/HeaderDD02/index.tsx +517 -0
- package/templates/components/HeaderDD02/manifest.json +123 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import type { Field } from 'payload'
|
|
2
|
+
|
|
3
|
+
import { BlocksFeature, HeadingFeature } from '@payloadcms/richtext-lexical'
|
|
4
|
+
|
|
5
|
+
import { defaultLexical } from '@/fields/defaultLexical'
|
|
6
|
+
import { link } from '@/fields/link'
|
|
7
|
+
import { iconPicker } from '@/fields/lucide-icon-picker/field'
|
|
8
|
+
|
|
9
|
+
const headerRichTextEditor = defaultLexical({
|
|
10
|
+
features: [
|
|
11
|
+
HeadingFeature({
|
|
12
|
+
enabledHeadingSizes: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
|
|
13
|
+
}),
|
|
14
|
+
BlocksFeature({
|
|
15
|
+
blocks: [],
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const HeaderDD02: Field[] = [
|
|
21
|
+
{
|
|
22
|
+
admin: {
|
|
23
|
+
initCollapsed: true,
|
|
24
|
+
className: 'custom-css-class',
|
|
25
|
+
position: 'sidebar',
|
|
26
|
+
},
|
|
27
|
+
type: 'collapsible',
|
|
28
|
+
label: 'Scroll Behavior',
|
|
29
|
+
fields: [
|
|
30
|
+
{
|
|
31
|
+
name: 'enableHideOnScroll',
|
|
32
|
+
type: 'checkbox',
|
|
33
|
+
defaultValue: true,
|
|
34
|
+
admin: {
|
|
35
|
+
description:
|
|
36
|
+
'Enable hiding the header when scrolling down and showing it when scrolling up',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'row',
|
|
41
|
+
fields: [
|
|
42
|
+
{
|
|
43
|
+
name: 'scrollThreshold',
|
|
44
|
+
type: 'number',
|
|
45
|
+
defaultValue: 100,
|
|
46
|
+
admin: {
|
|
47
|
+
width: '50%',
|
|
48
|
+
description: 'Scroll distance in pixels before the header hides when scrolling down',
|
|
49
|
+
condition: (_, siblingData) => Boolean(siblingData?.enableHideOnScroll),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'animationDuration',
|
|
54
|
+
type: 'number',
|
|
55
|
+
defaultValue: 0.3,
|
|
56
|
+
admin: {
|
|
57
|
+
width: '50%',
|
|
58
|
+
description: 'Duration of the hide/show animation in seconds',
|
|
59
|
+
condition: (_, siblingData) => Boolean(siblingData?.enableHideOnScroll),
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
admin: {
|
|
68
|
+
initCollapsed: true,
|
|
69
|
+
className: 'custom-css-class',
|
|
70
|
+
position: 'sidebar',
|
|
71
|
+
},
|
|
72
|
+
type: 'collapsible',
|
|
73
|
+
label: 'Mobile Navigation',
|
|
74
|
+
fields: [
|
|
75
|
+
{
|
|
76
|
+
name: 'mobileNavVariant',
|
|
77
|
+
type: 'select',
|
|
78
|
+
defaultValue: 'standard',
|
|
79
|
+
options: [
|
|
80
|
+
{ label: 'Standard', value: 'standard' },
|
|
81
|
+
{ label: 'Header03 Style', value: 'header03' },
|
|
82
|
+
],
|
|
83
|
+
admin: {
|
|
84
|
+
hidden: false,
|
|
85
|
+
description: 'Select the mobile navigation style',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'mobileNavHeader03',
|
|
90
|
+
type: 'ui',
|
|
91
|
+
admin: {
|
|
92
|
+
position: 'main',
|
|
93
|
+
components: {
|
|
94
|
+
Field: '@/components/Admin/ui/componentInfo.tsx#MobileNavHeader03',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'showMobileLabels',
|
|
100
|
+
type: 'checkbox',
|
|
101
|
+
defaultValue: true,
|
|
102
|
+
admin: {
|
|
103
|
+
description: 'Show labels under icons in the mobile bottom navigation bar',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'navItems',
|
|
110
|
+
type: 'array',
|
|
111
|
+
fields: [
|
|
112
|
+
{
|
|
113
|
+
name: 'type',
|
|
114
|
+
type: 'select',
|
|
115
|
+
options: [
|
|
116
|
+
{ label: 'Simple Link', value: 'link' },
|
|
117
|
+
{ label: 'Dropdown with RichText + Links', value: 'dropdown-richtext' },
|
|
118
|
+
{ label: 'Dropdown - Single Column with Description', value: 'dropdown-single-desc' },
|
|
119
|
+
{ label: 'Dropdown - Single Column no Description', value: 'dropdown-single' },
|
|
120
|
+
{ label: 'Dropdown - Single Column with Icons', value: 'dropdown-icons' },
|
|
121
|
+
],
|
|
122
|
+
defaultValue: 'link',
|
|
123
|
+
},
|
|
124
|
+
link({
|
|
125
|
+
appearances: false,
|
|
126
|
+
overrides: {
|
|
127
|
+
admin: {
|
|
128
|
+
condition: (_, siblingData) => siblingData?.type === 'link',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
{
|
|
133
|
+
name: 'showLabel',
|
|
134
|
+
label: 'Show label',
|
|
135
|
+
type: 'checkbox',
|
|
136
|
+
defaultValue: true,
|
|
137
|
+
admin: {
|
|
138
|
+
description: 'Toggle the label text for this nav item (useful for icon-only links).',
|
|
139
|
+
condition: (_, siblingData) => siblingData?.type === 'link',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'label',
|
|
144
|
+
type: 'text',
|
|
145
|
+
required: true,
|
|
146
|
+
admin: {
|
|
147
|
+
description: 'Dropdown trigger label',
|
|
148
|
+
condition: (_, siblingData) => siblingData?.type !== 'link',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
iconPicker({
|
|
152
|
+
name: 'triggerIcon',
|
|
153
|
+
description: 'Optional icon for dropdown trigger',
|
|
154
|
+
required: false,
|
|
155
|
+
overrides: (field) => ({
|
|
156
|
+
...field,
|
|
157
|
+
admin: {
|
|
158
|
+
...field.admin,
|
|
159
|
+
condition: (_, siblingData) => siblingData?.type !== 'link',
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
}),
|
|
163
|
+
{
|
|
164
|
+
name: 'triggerIconPosition',
|
|
165
|
+
type: 'select',
|
|
166
|
+
defaultValue: 'before',
|
|
167
|
+
options: [
|
|
168
|
+
{ label: 'Before', value: 'before' },
|
|
169
|
+
{ label: 'After', value: 'after' },
|
|
170
|
+
],
|
|
171
|
+
admin: {
|
|
172
|
+
description: 'Icon position for dropdown trigger',
|
|
173
|
+
condition: (_, siblingData) => siblingData?.type !== 'link',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'richTextContent',
|
|
178
|
+
type: 'richText',
|
|
179
|
+
admin: {
|
|
180
|
+
description: 'Rich text content for the featured column',
|
|
181
|
+
condition: (_, siblingData) => siblingData?.type === 'dropdown-richtext',
|
|
182
|
+
},
|
|
183
|
+
editor: headerRichTextEditor,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'v1_children',
|
|
187
|
+
label: 'Menu Items on Column 2',
|
|
188
|
+
type: 'array',
|
|
189
|
+
admin: {
|
|
190
|
+
description: 'Add dropdown menu items for RichText variant',
|
|
191
|
+
initCollapsed: true,
|
|
192
|
+
components: {
|
|
193
|
+
RowLabel: '/Header/RowLabel.tsx#RowLabel',
|
|
194
|
+
},
|
|
195
|
+
condition: (_, siblingData) => siblingData?.type === 'dropdown-richtext',
|
|
196
|
+
},
|
|
197
|
+
fields: [
|
|
198
|
+
link({ appearances: false }),
|
|
199
|
+
{
|
|
200
|
+
name: 'description',
|
|
201
|
+
label: 'Description',
|
|
202
|
+
type: 'text',
|
|
203
|
+
admin: {
|
|
204
|
+
description: 'Short description for menu items',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'v4_children',
|
|
211
|
+
label: 'Menu Items with Description',
|
|
212
|
+
type: 'array',
|
|
213
|
+
admin: {
|
|
214
|
+
description: 'Add dropdown menu items for single column with description',
|
|
215
|
+
initCollapsed: true,
|
|
216
|
+
components: {
|
|
217
|
+
RowLabel: '/Header/RowLabel.tsx#RowLabel',
|
|
218
|
+
},
|
|
219
|
+
condition: (_, siblingData) => siblingData?.type === 'dropdown-single-desc',
|
|
220
|
+
},
|
|
221
|
+
fields: [
|
|
222
|
+
link({ appearances: false }),
|
|
223
|
+
{
|
|
224
|
+
name: 'description',
|
|
225
|
+
label: 'Description',
|
|
226
|
+
type: 'text',
|
|
227
|
+
admin: {
|
|
228
|
+
description: 'Short description for menu items',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'v5_children',
|
|
235
|
+
label: 'Menu Items no Description',
|
|
236
|
+
type: 'array',
|
|
237
|
+
admin: {
|
|
238
|
+
description: 'Add dropdown menu items for single column without description',
|
|
239
|
+
initCollapsed: true,
|
|
240
|
+
components: {
|
|
241
|
+
RowLabel: '/Header/RowLabel.tsx#RowLabel',
|
|
242
|
+
},
|
|
243
|
+
condition: (_, siblingData) => siblingData?.type === 'dropdown-single',
|
|
244
|
+
},
|
|
245
|
+
fields: [link({ appearances: false })],
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: 'v6_children',
|
|
249
|
+
label: 'Menu Items with Icons',
|
|
250
|
+
type: 'array',
|
|
251
|
+
admin: {
|
|
252
|
+
description: 'Add dropdown menu items with icons',
|
|
253
|
+
initCollapsed: true,
|
|
254
|
+
components: {
|
|
255
|
+
RowLabel: '/Header/RowLabel.tsx#RowLabel',
|
|
256
|
+
},
|
|
257
|
+
condition: (_, siblingData) => siblingData?.type === 'dropdown-icons',
|
|
258
|
+
},
|
|
259
|
+
fields: [
|
|
260
|
+
link({
|
|
261
|
+
appearances: false,
|
|
262
|
+
overrides: {
|
|
263
|
+
admin: {
|
|
264
|
+
description: 'Link with icon support (icon field included in link)',
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
],
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
admin: {
|
|
272
|
+
initCollapsed: true,
|
|
273
|
+
components: {
|
|
274
|
+
RowLabel: '/Header/RowLabel.tsx#RowLabel',
|
|
275
|
+
},
|
|
276
|
+
description:
|
|
277
|
+
'Add navigation items here. Each can be a simple link or different types of dropdown menus.',
|
|
278
|
+
},
|
|
279
|
+
maxRows: 8,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'showFloatingContent',
|
|
283
|
+
label: 'Show Floating Content',
|
|
284
|
+
type: 'checkbox',
|
|
285
|
+
defaultValue: false,
|
|
286
|
+
admin: {
|
|
287
|
+
condition: (_, siblingData) => siblingData?.mobileNavVariant === 'header03',
|
|
288
|
+
description: 'Toggle to show/hide the floating content panel',
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'floatingContent',
|
|
293
|
+
label: 'Floating Content (Above Drawer)',
|
|
294
|
+
type: 'richText',
|
|
295
|
+
admin: {
|
|
296
|
+
condition: (_, siblingData) =>
|
|
297
|
+
siblingData?.mobileNavVariant === 'header03' && siblingData?.showFloatingContent === true,
|
|
298
|
+
description: 'Content that appears in the floating panel above the drawer',
|
|
299
|
+
},
|
|
300
|
+
editor: headerRichTextEditor,
|
|
301
|
+
},
|
|
302
|
+
]
|