@woodylab/payload 0.0.12 → 0.0.14

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.
@@ -1,1103 +0,0 @@
1
- 'use strict';
2
-
3
- var fieldRoles = require('./fieldRoles-R8Vcp6gr.js');
4
-
5
- const fieldTextArea = (override) => ({
6
- name: 'textarea',
7
- label: 'Textarea',
8
- type: 'textarea',
9
- required: false,
10
- ...override,
11
- });
12
-
13
- const fieldBlocks = (override) => ({
14
- name: 'blocks',
15
- label: 'Blocks',
16
- type: 'blocks',
17
- blocks: [],
18
- required: false,
19
- ...override,
20
- });
21
-
22
- const fieldCode = (override) => ({
23
- name: 'code',
24
- label: 'Code',
25
- type: 'code',
26
- required: false,
27
- ...override,
28
- });
29
-
30
- const fieldDate = (override) => ({
31
- name: 'date',
32
- label: 'Date',
33
- type: 'date',
34
- required: false,
35
- admin: {
36
- description: 'Select a date',
37
- date: {
38
- pickerAppearance: 'dayOnly',
39
- displayFormat: 'yyyy-MM-dd',
40
- },
41
- },
42
- ...override,
43
- });
44
-
45
- const fieldEmail = (override) => ({
46
- name: 'email',
47
- label: 'Email',
48
- type: 'email',
49
- required: false,
50
- ...override,
51
- });
52
-
53
- const fieldJoin = (collection, on, override) => ({
54
- name: 'join',
55
- label: 'join',
56
- type: 'join',
57
- collection,
58
- on,
59
- ...override,
60
- });
61
-
62
- const fieldNumber = (override) => ({
63
- name: 'number',
64
- label: 'Number',
65
- type: 'number',
66
- required: false,
67
- ...override,
68
- });
69
-
70
- const fieldPoint = (override) => ({
71
- name: 'point',
72
- label: 'Point',
73
- type: 'point',
74
- required: false,
75
- ...override,
76
- });
77
-
78
- const fieldRadioGroup = (override) => ({
79
- name: 'radio',
80
- label: 'Radio',
81
- type: 'boolean',
82
- required: false,
83
- options: [
84
- {
85
- label: 'true',
86
- value: true
87
- },
88
- {
89
- label: 'true',
90
- value: false
91
- }
92
- ],
93
- ...override,
94
- });
95
-
96
- const fieldRelationship = (relationTo, override) => ({
97
- name: 'relationship',
98
- label: 'Relationship',
99
- type: 'relationship',
100
- relationTo,
101
- required: false,
102
- ...override,
103
- });
104
-
105
- const fieldRichText = (override) => ({
106
- name: 'richText',
107
- label: 'Rich Text',
108
- type: 'richText',
109
- required: false,
110
- admin: {
111
- placeholder: 'Insert text here',
112
- rows: 5,
113
- },
114
- ...override,
115
- });
116
-
117
- const fieldContainerProps = (customFields = []) => {
118
- return {
119
- name: 'ctrP',
120
- label: 'Proprietà container',
121
- type: 'group',
122
- fields: [
123
- ...customFields,
124
- fieldRichText({ name: 'body', label: 'Contenuto', required: false }),
125
- fieldContainerWidths(),
126
- {
127
- type: 'tabs',
128
- tabs: [
129
- {
130
- label: 'Stile',
131
- fields: [
132
- fieldRoles.fieldUpload('media', { name: 'bgi', label: 'Immagine di sfondo' }),
133
- //WFieldColor({name:'bgc', label:'Colore di sfondo', required:false}),
134
- {
135
- name: 'borderRadius',
136
- type: 'select',
137
- label: 'Angoli arrotondati',
138
- defaultValue: 'rounded-none',
139
- options: [
140
- { label: 'Nessuno', value: 'rounded-none' },
141
- { label: 'Piccolo', value: 'rounded-sm' },
142
- { label: 'Medio', value: 'rounded-md' },
143
- { label: 'Grande', value: 'rounded-lg' },
144
- { label: 'Extra Grande', value: 'rounded-xl' },
145
- { label: 'Massimo', value: 'rounded-full' },
146
- ],
147
- admin: {
148
- width: '50%',
149
- description: 'Imposta lo stile degli angoli arrotondati del contenitore.',
150
- },
151
- },
152
- {
153
- name: 'boxShadow',
154
- type: 'select',
155
- label: 'Ombra contenitore',
156
- defaultValue: 'shadow-none', // Default: nessuna ombra
157
- options: [
158
- { label: 'Nessuna', value: 'shadow-none' },
159
- { label: 'Piccola', value: 'shadow-sm' },
160
- { label: 'Normale', value: 'shadow' },
161
- { label: 'Media', value: 'shadow-md' },
162
- { label: 'Grande', value: 'shadow-lg' },
163
- { label: 'Extra Grande', value: 'shadow-xl' },
164
- { label: 'Massima', value: 'shadow-2xl' },
165
- ],
166
- admin: {
167
- width: '50%',
168
- description: 'Imposta lo stile dell\'ombra per il contenitore.',
169
- },
170
- }
171
- ]
172
- },
173
- {
174
- label: 'Dimensioni',
175
- fields: [
176
- fieldHeights(),
177
- {
178
- type: 'tabs',
179
- tabs: [
180
- {
181
- label: 'Margini',
182
- fields: [
183
- fieldMargins()
184
- ]
185
- },
186
- {
187
- label: 'Paddings',
188
- fields: [
189
- fieldPaddings()
190
- ]
191
- }
192
- ]
193
- }
194
- ]
195
- }
196
- ]
197
- },
198
- ]
199
- };
200
- };
201
-
202
- const fieldThemeColor = (override) => ({
203
- name: override?.name || 'color',
204
- label: override?.label || 'Colore',
205
- type: 'select',
206
- required: override?.required ?? false,
207
- options: [
208
- { label: 'Default', value: '' },
209
- { label: 'Foreground', value: 'foreground' },
210
- { label: 'Primary', value: 'primary' },
211
- { label: 'Secondary', value: 'secondary' },
212
- { label: 'Accent', value: 'accent' },
213
- { label: 'Dark', value: 'dark' },
214
- { label: 'Light', value: 'light' },
215
- { label: 'White', value: 'white' },
216
- { label: 'Black', value: 'black' },
217
- ],
218
- admin: {
219
- ...override?.admin,
220
- },
221
- });
222
-
223
- const iconsList = [
224
- { label: 'Academic Cap', value: 'AcademicCapIcon' },
225
- { label: 'Adjustments Horizontal', value: 'AdjustmentsHorizontalIcon' },
226
- { label: 'Adjustments Vertical', value: 'AdjustmentsVerticalIcon' },
227
- { label: 'Archive Box Arrow Down', value: 'ArchiveBoxArrowDownIcon' },
228
- { label: 'Archive Box X Mark', value: 'ArchiveBoxXMarkIcon' },
229
- { label: 'Archive Box', value: 'ArchiveBoxIcon' },
230
- { label: 'Arrow Down Circle', value: 'ArrowDownCircleIcon' },
231
- { label: 'Arrow Down', value: 'ArrowDownIcon' },
232
- { label: 'Arrow Left Circle', value: 'ArrowLeftCircleIcon' },
233
- { label: 'Arrow Left', value: 'ArrowLeftIcon' },
234
- { label: 'Arrow Right Circle', value: 'ArrowRightCircleIcon' },
235
- { label: 'Arrow Right', value: 'ArrowRightIcon' },
236
- { label: 'Arrow Up Circle', value: 'ArrowUpCircleIcon' },
237
- { label: 'Arrow Up', value: 'ArrowUpIcon' },
238
- { label: 'Bell Alert', value: 'BellAlertIcon' },
239
- { label: 'Bell', value: 'BellIcon' },
240
- { label: 'Bookmark Square', value: 'BookmarkSquareIcon' },
241
- { label: 'Bookmark', value: 'BookmarkIcon' },
242
- { label: 'Building Office', value: 'BuildingOfficeIcon' },
243
- { label: 'Calendar', value: 'CalendarIcon' },
244
- { label: 'Camera', value: 'CameraIcon' },
245
- { label: 'Chart Bar', value: 'ChartBarIcon' },
246
- { label: 'Chat Bubble Left Right', value: 'ChatBubbleLeftRightIcon' },
247
- { label: 'Chat Bubble Left', value: 'ChatBubbleLeftIcon' },
248
- { label: 'Check Circle', value: 'CheckCircleIcon' },
249
- { label: 'Check', value: 'CheckIcon' },
250
- { label: 'Chevron Down', value: 'ChevronDownIcon' },
251
- { label: 'Chevron Left', value: 'ChevronLeftIcon' },
252
- { label: 'Chevron Right', value: 'ChevronRightIcon' },
253
- { label: 'Chevron Up', value: 'ChevronUpIcon' },
254
- { label: 'Clock', value: 'ClockIcon' },
255
- { label: 'Cloud Arrow Up', value: 'CloudArrowUpIcon' },
256
- { label: 'Cloud', value: 'CloudIcon' },
257
- { label: 'Code Bracket', value: 'CodeBracketIcon' },
258
- { label: 'Cog', value: 'CogIcon' },
259
- { label: 'Command Line', value: 'CommandLineIcon' },
260
- { label: 'Computer Desktop', value: 'ComputerDesktopIcon' },
261
- { label: 'Credit Card', value: 'CreditCardIcon' },
262
- { label: 'Document', value: 'DocumentIcon' },
263
- { label: 'Envelope', value: 'EnvelopeIcon' },
264
- { label: 'Exclamation Circle', value: 'ExclamationCircleIcon' },
265
- { label: 'Exclamation Triangle', value: 'ExclamationTriangleIcon' },
266
- { label: 'Eye', value: 'EyeIcon' },
267
- { label: 'Face Smile', value: 'FaceSmileIcon' },
268
- { label: 'Film', value: 'FilmIcon' },
269
- { label: 'Finger Print', value: 'FingerPrintIcon' },
270
- { label: 'Fire', value: 'FireIcon' },
271
- { label: 'Flag', value: 'FlagIcon' },
272
- { label: 'Folder Open', value: 'FolderOpenIcon' },
273
- { label: 'Folder', value: 'FolderIcon' },
274
- { label: 'Gift', value: 'GiftIcon' },
275
- { label: 'Globe Alt', value: 'GlobeAltIcon' },
276
- { label: 'Globe Europe Africa', value: 'GlobeEuropeAfricaIcon' },
277
- { label: 'Hand Raised', value: 'HandRaisedIcon' },
278
- { label: 'Heart', value: 'HeartIcon' },
279
- { label: 'Home', value: 'HomeIcon' },
280
- { label: 'Identification', value: 'IdentificationIcon' },
281
- { label: 'Information Circle', value: 'InformationCircleIcon' },
282
- { label: 'Key', value: 'KeyIcon' },
283
- { label: 'Link', value: 'LinkIcon' },
284
- { label: 'List Bullet', value: 'ListBulletIcon' },
285
- { label: 'Lock Closed', value: 'LockClosedIcon' },
286
- { label: 'Lock Open', value: 'LockOpenIcon' },
287
- { label: 'Magnifying Glass Circle', value: 'MagnifyingGlassCircleIcon' },
288
- { label: 'Magnifying Glass', value: 'MagnifyingGlassIcon' },
289
- { label: 'Map Pin', value: 'MapPinIcon' },
290
- { label: 'Map', value: 'MapIcon' },
291
- { label: 'Moon', value: 'MoonIcon' },
292
- { label: 'Paper Airplane', value: 'PaperAirplaneIcon' },
293
- { label: 'Paper Clip', value: 'PaperClipIcon' },
294
- { label: 'Pause Circle', value: 'PauseCircleIcon' },
295
- { label: 'Pencil Square', value: 'PencilSquareIcon' },
296
- { label: 'Pencil', value: 'PencilIcon' },
297
- { label: 'Phone Arrow Up Right', value: 'PhoneArrowUpRightIcon' },
298
- { label: 'Phone X Mark', value: 'PhoneXMarkIcon' },
299
- { label: 'Phone', value: 'PhoneIcon' },
300
- { label: 'Photo', value: 'PhotoIcon' },
301
- { label: 'Play Circle', value: 'PlayCircleIcon' },
302
- { label: 'Play', value: 'PlayIcon' },
303
- { label: 'Plus Circle', value: 'PlusCircleIcon' },
304
- { label: 'Plus', value: 'PlusIcon' },
305
- { label: 'Power', value: 'PowerIcon' },
306
- { label: 'Question Mark Circle', value: 'QuestionMarkCircleIcon' },
307
- { label: 'Rocket Launch', value: 'RocketLaunchIcon' },
308
- { label: 'Rss', value: 'RssIcon' },
309
- { label: 'Scale', value: 'ScaleIcon' },
310
- { label: 'Server', value: 'ServerIcon' },
311
- { label: 'Share', value: 'ShareIcon' },
312
- { label: 'Shield Check', value: 'ShieldCheckIcon' },
313
- { label: 'Shield Exclamation', value: 'ShieldExclamationIcon' },
314
- { label: 'Shopping Bag', value: 'ShoppingBagIcon' },
315
- { label: 'Shopping Cart', value: 'ShoppingCartIcon' },
316
- { label: 'Star', value: 'StarIcon' },
317
- { label: 'Stop Circle', value: 'StopCircleIcon' },
318
- { label: 'Sun', value: 'SunIcon' },
319
- { label: 'Tag', value: 'TagIcon' },
320
- { label: 'Trash', value: 'TrashIcon' },
321
- { label: 'Trophy', value: 'TrophyIcon' },
322
- { label: 'User Circle', value: 'UserCircleIcon' },
323
- { label: 'User Group', value: 'UserGroupIcon' },
324
- { label: 'User', value: 'UserIcon' },
325
- { label: 'Users', value: 'UsersIcon' },
326
- { label: 'Video Camera', value: 'VideoCameraIcon' },
327
- { label: 'Wifi', value: 'WifiIcon' },
328
- { label: 'Window', value: 'WindowIcon' },
329
- { label: 'Wrench Screwdriver', value: 'WrenchScrewdriverIcon' },
330
- { label: 'Wrench', value: 'WrenchIcon' },
331
- { label: 'X Circle', value: 'XCircleIcon' },
332
- { label: 'X Mark', value: 'XMarkIcon' },
333
- ];
334
-
335
- const fieldAction = () => ({
336
- type: 'group',
337
- label: 'Azione',
338
- name: 'action',
339
- fields: [
340
- fieldRoles.fieldCheckbox({ name: 'show', label: 'Mostra azione', defaultValue: false, admin: {
341
- width: '50%', // TODO CAMBIARE LAYOUT ADMIN
342
- } }),
343
- fieldRoles.fieldText({
344
- name: 'label',
345
- type: 'text',
346
- label: 'Testo da visualizzare',
347
- defaultValue: 'Action',
348
- admin: {
349
- width: '50%',
350
- }
351
- }),
352
- fieldRoles.fieldSelect({
353
- name: 'actionType',
354
- label: 'Tipo di azione',
355
- defaultValue: 'internalLink',
356
- admin: {
357
- width: '33%',
358
- },
359
- options: [
360
- {
361
- label: 'Interno',
362
- value: 'internalLink',
363
- },
364
- {
365
- label: 'Esterno',
366
- value: 'externalLink',
367
- },
368
- /*
369
- {
370
- label: 'Azione',
371
- value: 'customAction',
372
- },
373
- */
374
- ],
375
- }),
376
- {
377
- name: 'internalLink',
378
- type: 'relationship',
379
- label: 'Seleziona una pagina interna',
380
- admin: {
381
- condition: (data, siblingData) => {
382
- return siblingData?.actionType === 'internalLink';
383
- },
384
- },
385
- relationTo: ['pages', 'posts', 'destinations'],
386
- },
387
- {
388
- name: 'externalLink',
389
- type: 'text',
390
- label: 'URL esterno',
391
- admin: {
392
- condition: (data, siblingData) => {
393
- return siblingData?.actionType === 'externalLink';
394
- },
395
- },
396
- },
397
- {
398
- type: 'collapsible',
399
- label: 'Stile',
400
- fields: [
401
- {
402
- type: 'row',
403
- fields: [
404
- {
405
- name: 'buttonStyle',
406
- type: 'select',
407
- label: 'Stile bottone',
408
- defaultValue: 'solid',
409
- admin: {
410
- width: '33%',
411
- },
412
- options: [
413
- { label: 'Solido', value: 'solid' },
414
- { label: 'Outline', value: 'outline' },
415
- { label: 'Ghost', value: 'ghost' },
416
- { label: 'Link', value: 'link' },
417
- ],
418
- },
419
- {
420
- name: 'buttonColor',
421
- type: 'select',
422
- label: 'Colore bottone',
423
- defaultValue: 'primary',
424
- admin: {
425
- width: '33%',
426
- },
427
- options: [
428
- { label: 'Primary', value: 'primary' },
429
- { label: 'Secondary', value: 'secondary' },
430
- { label: 'Accent', value: 'accent' },
431
- { label: 'Dark', value: 'dark' },
432
- { label: 'Light', value: 'light' },
433
- ],
434
- },
435
- {
436
- name: 'buttonSize',
437
- type: 'select',
438
- label: 'Dimensione bottone',
439
- defaultValue: 'default',
440
- admin: {
441
- width: '33%',
442
- },
443
- options: [
444
- { label: 'Small', value: 'small' },
445
- { label: 'Default', value: 'default' },
446
- { label: 'Medium', value: 'medium' },
447
- { label: 'Large', value: 'large' },
448
- { label: 'Extra Large', value: 'xl' },
449
- ],
450
- },
451
- {
452
- name: 'buttonRounded',
453
- type: 'select',
454
- label: 'Arrotondamento',
455
- defaultValue: 'default',
456
- admin: {
457
- width: '33%',
458
- },
459
- options: [
460
- { label: 'Nessuno', value: 'none' },
461
- { label: 'Piccolo', value: 'sm' },
462
- { label: 'Standard', value: 'default' },
463
- { label: 'Grande', value: 'lg' },
464
- { label: 'Completo', value: 'full' },
465
- ],
466
- },
467
- {
468
- name: 'alignment',
469
- type: 'select',
470
- label: 'Allineamento del Bottone',
471
- defaultValue: 'left',
472
- options: [
473
- {
474
- label: 'Sinistra',
475
- value: 'left',
476
- },
477
- {
478
- label: 'Centro',
479
- value: 'center',
480
- },
481
- {
482
- label: 'Destra',
483
- value: 'right',
484
- }
485
- ],
486
- admin: {
487
- width: '33%',
488
- condition: (data) => true, // Puoi modificare questa condizione se il campo deve essere mostrato solo in determinate circostanze
489
- }
490
- },
491
- fieldThemeColor({
492
- name: 'textColor',
493
- label: 'Colore del testo',
494
- admin: {
495
- width: '33%',
496
- }
497
- }),
498
- {
499
- name: 'additionalEffects',
500
- type: 'select',
501
- label: 'Effetti aggiuntivi',
502
- hasMany: true,
503
- admin: {
504
- width: '33%',
505
- },
506
- options: [
507
- { label: 'Ombra', value: 'shadow' },
508
- { label: 'Transizione', value: 'transition' },
509
- { label: 'Animazione scala', value: 'scale' },
510
- ],
511
- }
512
- ],
513
- },
514
- {
515
- type: 'row',
516
- fields: [
517
- {
518
- name: 'useIcon',
519
- type: 'checkbox',
520
- label: 'Usa icona',
521
- defaultValue: false,
522
- admin: {
523
- width: '33%',
524
- },
525
- },
526
- {
527
- name: 'iconPosition',
528
- type: 'select',
529
- label: 'Posizione icona',
530
- defaultValue: 'left',
531
- admin: {
532
- width: '33%',
533
- condition: (_, siblingData) => siblingData?.useIcon === true,
534
- },
535
- options: [
536
- { label: 'Sinistra', value: 'left' },
537
- { label: 'Destra', value: 'right' },
538
- { label: 'Solo icona', value: 'only' },
539
- ],
540
- },
541
- {
542
- name: 'iconName',
543
- type: 'select',
544
- label: 'Icona',
545
- options: [
546
- ...iconsList
547
- ],
548
- admin: {
549
- width: '33%',
550
- condition: (_, siblingData) => siblingData?.useIcon === true,
551
- },
552
- // Qui potresti usare un select con le icone disponibili se hai una libreria predefinita
553
- },
554
- ]
555
- }
556
- ]
557
- }
558
- ]
559
- });
560
-
561
- const fieldConfigProps = (customFields = []) => {
562
- return {
563
- name: 'config',
564
- label: 'Configurazione',
565
- type: 'group',
566
- fields: [
567
- ...customFields,
568
- ],
569
- };
570
- };
571
-
572
- const fieldContentProps = (customFields = []) => {
573
- return {
574
- name: 'cntP',
575
- label: 'Contenuto',
576
- type: 'group',
577
- fields: [
578
- ...customFields,
579
- ],
580
- };
581
- };
582
-
583
- /**
584
- * Genera un campo per la selezione delle altezze
585
- * @returns Field - Campo di tipo `select` per PayloadCMS
586
- */
587
- const fieldViewportHeights = () => {
588
- return fieldRoles.fieldSelect({
589
- name: 'h',
590
- label: 'Altezza',
591
- type: 'select',
592
- options: [{ value: '', label: '(Nessuno)' }, ...fieldRoles.TailwindViewportHeights.map(h => ({ value: `h-${h}`, label: h }))],
593
- admin: {
594
- description: 'Definisce l’altezza dell’elemento.',
595
- width: '50%'
596
- },
597
- });
598
- };
599
-
600
- const fieldSectionProps = (customFields = []) => {
601
- return {
602
- name: 'sctP',
603
- label: 'Proprietà sezione',
604
- type: 'group',
605
- fields: [
606
- ...customFields,
607
- fieldRichText({ name: 'body', label: 'Contenuto', required: false }),
608
- {
609
- type: 'tabs',
610
- tabs: [
611
- {
612
- label: 'Stile',
613
- fields: [
614
- fieldRoles.fieldUpload('media', { name: 'bgi', label: 'Immagine di sfondo' }),
615
- fieldThemeColor({ name: 'bgc', label: 'Colore di sfondo', required: false }),
616
- ]
617
- }
618
- ]
619
- },
620
- {
621
- type: 'tabs',
622
- tabs: [
623
- {
624
- label: 'Dimensioni',
625
- fields: [
626
- fieldViewportHeights(),
627
- {
628
- type: 'tabs',
629
- tabs: [{
630
- label: 'Margini',
631
- fields: [
632
- fieldMargins()
633
- ]
634
- },
635
- {
636
- label: 'Paddings',
637
- fields: [
638
- fieldPaddings()
639
- ]
640
- }
641
- ]
642
- }
643
- ]
644
- }
645
- ]
646
- },
647
- ],
648
- };
649
- };
650
-
651
- const fieldSectionTabs = (options = {}) => {
652
- const { config = true, section = true, container = true, content = true, configFields = [], sectionFields = [], containerFields = [], contentFields = [] } = options;
653
- const tabs = [];
654
- if (config) {
655
- tabs.push({
656
- label: 'Configurazione',
657
- fields: [
658
- fieldConfigProps(configFields)
659
- ],
660
- });
661
- }
662
- // Tab per la sezione
663
- if (section) {
664
- tabs.push({
665
- label: 'Sezione',
666
- fields: [
667
- fieldSectionProps(sectionFields)
668
- ],
669
- });
670
- }
671
- // Tab per il container
672
- if (container) {
673
- tabs.push({
674
- label: 'Container',
675
- fields: [
676
- fieldContainerProps(containerFields)
677
- ],
678
- });
679
- }
680
- // Tab per il contenuto
681
- if (content) {
682
- tabs.push({
683
- label: 'Contenuto',
684
- fields: [
685
- fieldContentProps(contentFields)
686
- ],
687
- });
688
- }
689
- return {
690
- type: 'tabs',
691
- tabs: tabs,
692
- };
693
- };
694
-
695
- /**
696
- * Genera un campo per la selezione delle larghezze del container
697
- * @returns Field - Campo di tipo `select` per PayloadCMS
698
- */
699
- const fieldContainerWidths = () => {
700
- return fieldRoles.fieldSelect({
701
- name: 'container',
702
- label: 'Larghezza del container',
703
- options: [{ value: '', label: '(Nessuno)' }, ...fieldRoles.TailwindContainerWidths],
704
- admin: {
705
- description: 'Seleziona una larghezza massima per il container. Usa "None" per una larghezza a schermo intero.',
706
- },
707
- });
708
- };
709
-
710
- const fieldFontSizes = () => {
711
- return fieldRoles.fieldSelect({
712
- name: 'fs',
713
- label: 'Dimensione del testo',
714
- options: fieldRoles.TailwindTextSizes,
715
- defaultValue: 'text-base',
716
- admin: {
717
- description: 'Seleziona una dimensione per il testo (es. Small, Base, Large, ecc.).',
718
- },
719
- });
720
- };
721
-
722
- /**
723
- * Genera un campo per la selezione delle altezze
724
- * @returns Field - Campo di tipo `select` per PayloadCMS
725
- */
726
- const fieldHeights = () => {
727
- return fieldRoles.fieldSelect({
728
- name: 'h',
729
- label: 'Altezza',
730
- type: 'select',
731
- defaultValue: 'h-full',
732
- options: [{ value: '', label: '(Nessuno)' }, ...fieldRoles.TailwindHeights.map(h => ({ value: `h-${h}`, label: h }))],
733
- admin: {
734
- description: 'Definisce l’altezza dell’elemento.',
735
- },
736
- });
737
- };
738
-
739
- const concatMarginFields = (args) => {
740
- const { value, siblingData, operation, } = args;
741
- if (operation === 'create' || operation === 'update') {
742
- const margins = siblingData || {};
743
- const { all, x, y, t, r, b, l } = margins;
744
- const classes = [];
745
- if (all)
746
- classes.push(`m-${all}`);
747
- if (x)
748
- classes.push(`mx-${x}`);
749
- if (y)
750
- classes.push(`my-${y}`);
751
- if (t)
752
- classes.push(`mt-${t}`);
753
- if (r)
754
- classes.push(`mr-${r}`);
755
- if (b)
756
- classes.push(`mb-${b}`);
757
- if (l)
758
- classes.push(`ml-${l}`);
759
- return classes.join(' ');
760
- }
761
- return value;
762
- };
763
- /**
764
- * Genera un campo per la selezione dinamica dei margini
765
- * @returns Field - Campo di tipo `group` per PayloadCMS
766
- */
767
- const fieldMargins = () => {
768
- return {
769
- name: 'm',
770
- label: 'Margini',
771
- type: 'group',
772
- fields: [
773
- {
774
- name: 'className',
775
- label: 'Classi CSS Margini',
776
- type: 'text',
777
- hooks: {
778
- beforeChange: [concatMarginFields],
779
- },
780
- admin: {
781
- readOnly: true,
782
- description: 'Questa stringa verrà generata automaticamente in base ai campi sottostanti.',
783
- },
784
- },
785
- {
786
- type: 'row',
787
- fields: [
788
- fieldNumber({
789
- name: 'all',
790
- label: 'Tutti i lati',
791
- type: 'number',
792
- min: 0,
793
- max: 96,
794
- admin: {
795
- width: '33%'
796
- }
797
- }),
798
- fieldNumber({
799
- name: 'x',
800
- label: 'Orizzontale',
801
- type: 'number',
802
- min: 0,
803
- max: 96,
804
- admin: {
805
- width: '33%'
806
- }
807
- }),
808
- fieldNumber({
809
- name: 'y',
810
- label: 'Verticale',
811
- type: 'number',
812
- min: 0,
813
- max: 96,
814
- admin: {
815
- width: '33%'
816
- }
817
- }),
818
- fieldNumber({
819
- name: 't',
820
- label: 'Top',
821
- type: 'number',
822
- min: 0,
823
- max: 96,
824
- admin: {
825
- width: '25%'
826
- }
827
- }),
828
- fieldNumber({
829
- name: 'r',
830
- label: 'Right',
831
- type: 'number',
832
- min: 0,
833
- max: 96,
834
- admin: {
835
- width: '25%'
836
- }
837
- }),
838
- fieldNumber({
839
- name: 'b',
840
- label: 'Bottom',
841
- type: 'number',
842
- min: 0,
843
- max: 96,
844
- admin: {
845
- width: '25%'
846
- }
847
- }),
848
- fieldNumber({
849
- name: 'l',
850
- label: 'Left',
851
- type: 'number',
852
- min: 0,
853
- max: 96,
854
- admin: {
855
- width: '25%'
856
- }
857
- }),
858
- ]
859
- }
860
- ],
861
- admin: {
862
- description: 'Definisce lo spazio esterno generale, orizzontale, verticale o per ciascun lato.',
863
- },
864
- };
865
- };
866
-
867
- /**
868
- * Hook per concatenare le classi CSS di padding
869
- */
870
- const concatPaddingFields = (args) => {
871
- const { value, siblingData, operation, } = args;
872
- if (operation === 'create' || operation === 'update') {
873
- const paddings = siblingData || {};
874
- const { all, x, y, t, r, b, l } = paddings;
875
- const classes = [];
876
- if (all)
877
- classes.push(`p-${all}`);
878
- if (x)
879
- classes.push(`px-${x}`);
880
- if (y)
881
- classes.push(`py-${y}`);
882
- if (t)
883
- classes.push(`pt-${t}`);
884
- if (r)
885
- classes.push(`pr-${r}`);
886
- if (b)
887
- classes.push(`pb-${b}`);
888
- if (l)
889
- classes.push(`pl-${l}`);
890
- return classes.join(' ');
891
- }
892
- return value;
893
- };
894
- /**
895
- * Genera un campo per la selezione dinamica dei padding
896
- * @returns Field - Campo di tipo `group` per PayloadCMS
897
- */
898
- const fieldPaddings = () => {
899
- return {
900
- name: 'p',
901
- label: 'Padding',
902
- type: 'group',
903
- fields: [
904
- {
905
- name: 'className',
906
- label: 'Classi CSS Padding',
907
- type: 'text',
908
- hooks: {
909
- beforeChange: [concatPaddingFields],
910
- },
911
- admin: {
912
- readOnly: true,
913
- description: 'Questa stringa verrà generata automaticamente in base ai campi sottostanti.',
914
- },
915
- },
916
- {
917
- type: 'row',
918
- fields: [
919
- fieldNumber({
920
- name: 'all',
921
- label: 'Tutti i lati',
922
- type: 'number',
923
- min: 0,
924
- max: 96,
925
- admin: {
926
- width: '33%'
927
- }
928
- }),
929
- fieldNumber({
930
- name: 'x',
931
- label: 'Orizzontale',
932
- type: 'number',
933
- min: 0,
934
- max: 96,
935
- admin: {
936
- width: '33%'
937
- }
938
- }),
939
- fieldNumber({
940
- name: 'y',
941
- label: 'Verticale',
942
- type: 'number',
943
- min: 0,
944
- max: 96,
945
- admin: {
946
- width: '33%'
947
- }
948
- }),
949
- fieldNumber({
950
- name: 't',
951
- label: 'Top',
952
- type: 'number',
953
- min: 0,
954
- max: 96,
955
- admin: {
956
- width: '25%'
957
- }
958
- }),
959
- fieldNumber({
960
- name: 'r',
961
- label: 'Right',
962
- type: 'number',
963
- min: 0,
964
- max: 96,
965
- admin: {
966
- width: '25%'
967
- }
968
- }),
969
- fieldNumber({
970
- name: 'b',
971
- label: 'Bottom',
972
- type: 'number',
973
- min: 0,
974
- max: 96,
975
- admin: {
976
- width: '25%'
977
- }
978
- }),
979
- fieldNumber({
980
- name: 'l',
981
- label: 'Left',
982
- type: 'number',
983
- min: 0,
984
- max: 96,
985
- admin: {
986
- width: '25%'
987
- }
988
- }),
989
- ]
990
- }
991
- ],
992
- admin: {
993
- description: 'Definisce lo spazio interno generale, orizzontale, verticale o per ciascun lato.',
994
- },
995
- };
996
- };
997
-
998
- const fieldMenuItems = (override) => ({
999
- name: 'menuItems',
1000
- label: 'Menu items',
1001
- type: 'array',
1002
- fields: [
1003
- {
1004
- name: 'test',
1005
- type: 'text'
1006
- },
1007
- fieldRoles.fieldCheckbox({
1008
- name: 'is-external',
1009
- label: 'open in new tab',
1010
- }),
1011
- fieldRoles.fieldText({ name: 'label', label: 'label' }),
1012
- {
1013
- name: 'relationship',
1014
- type: 'relationship',
1015
- relationTo: ['destinations'],
1016
- },
1017
- //WFieldRelationship(['pages', 'destinations']),
1018
- fieldRoles.fieldArray({
1019
- name: 'sub-menu',
1020
- label: 'Sub menu',
1021
- admin: {
1022
- description: 'Aggiungere voci figlio a una voce di menù ne disabilita il click di navigazione per permettere l\'apertura del dropdown'
1023
- },
1024
- fields: [
1025
- fieldRoles.fieldCheckbox({
1026
- name: 'is-external',
1027
- label: 'open in new tab',
1028
- }),
1029
- fieldRoles.fieldText({ name: 'label', label: 'label' }),
1030
- {
1031
- name: 'relationship',
1032
- type: 'relationship',
1033
- relationTo: ['pages', 'posts', 'destinations'],
1034
- },
1035
- ]
1036
- })
1037
- ],
1038
- });
1039
-
1040
- // Esportazioni dalle cartelle principali
1041
-
1042
- var index = /*#__PURE__*/Object.freeze({
1043
- __proto__: null,
1044
- fieldAction: fieldAction,
1045
- fieldArray: fieldRoles.fieldArray,
1046
- fieldBlocks: fieldBlocks,
1047
- fieldCheckbox: fieldRoles.fieldCheckbox,
1048
- fieldCode: fieldCode,
1049
- fieldColor: fieldThemeColor,
1050
- fieldConfigProps: fieldConfigProps,
1051
- fieldContainerProps: fieldContainerProps,
1052
- fieldContainerWidths: fieldContainerWidths,
1053
- fieldContentProps: fieldContentProps,
1054
- fieldDate: fieldDate,
1055
- fieldEmail: fieldEmail,
1056
- fieldFontSizes: fieldFontSizes,
1057
- fieldHeights: fieldHeights,
1058
- fieldJoin: fieldJoin,
1059
- fieldMargins: fieldMargins,
1060
- fieldMenuItems: fieldMenuItems,
1061
- fieldNumber: fieldNumber,
1062
- fieldPaddings: fieldPaddings,
1063
- fieldPoint: fieldPoint,
1064
- fieldRadioGroup: fieldRadioGroup,
1065
- fieldRelationship: fieldRelationship,
1066
- fieldRichText: fieldRichText,
1067
- fieldRoles: fieldRoles.fieldRoles,
1068
- fieldSectionProps: fieldSectionProps,
1069
- fieldSectionTabs: fieldSectionTabs,
1070
- fieldSelect: fieldRoles.fieldSelect,
1071
- fieldText: fieldRoles.fieldText,
1072
- fieldTextArea: fieldTextArea,
1073
- fieldUpload: fieldRoles.fieldUpload,
1074
- fieldViewportHeights: fieldViewportHeights
1075
- });
1076
-
1077
- exports.fieldAction = fieldAction;
1078
- exports.fieldBlocks = fieldBlocks;
1079
- exports.fieldCode = fieldCode;
1080
- exports.fieldConfigProps = fieldConfigProps;
1081
- exports.fieldContainerProps = fieldContainerProps;
1082
- exports.fieldContainerWidths = fieldContainerWidths;
1083
- exports.fieldContentProps = fieldContentProps;
1084
- exports.fieldDate = fieldDate;
1085
- exports.fieldEmail = fieldEmail;
1086
- exports.fieldFontSizes = fieldFontSizes;
1087
- exports.fieldHeights = fieldHeights;
1088
- exports.fieldJoin = fieldJoin;
1089
- exports.fieldMargins = fieldMargins;
1090
- exports.fieldMenuItems = fieldMenuItems;
1091
- exports.fieldNumber = fieldNumber;
1092
- exports.fieldPaddings = fieldPaddings;
1093
- exports.fieldPoint = fieldPoint;
1094
- exports.fieldRadioGroup = fieldRadioGroup;
1095
- exports.fieldRelationship = fieldRelationship;
1096
- exports.fieldRichText = fieldRichText;
1097
- exports.fieldSectionProps = fieldSectionProps;
1098
- exports.fieldSectionTabs = fieldSectionTabs;
1099
- exports.fieldTextArea = fieldTextArea;
1100
- exports.fieldThemeColor = fieldThemeColor;
1101
- exports.fieldViewportHeights = fieldViewportHeights;
1102
- exports.index = index;
1103
- //# sourceMappingURL=index-BlpaAHg6.js.map