@woodylab/payload 0.0.9 → 0.0.11

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