@woodylab/payload 0.0.8 → 0.0.9

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.
@@ -243,6 +243,365 @@ const fieldContainerProps = (customFields = []) => {
243
243
  };
244
244
  };
245
245
 
246
+ const fieldThemeColor = (override) => ({
247
+ name: override?.name || 'color',
248
+ label: override?.label || 'Colore',
249
+ type: 'select',
250
+ required: override?.required ?? false,
251
+ options: [
252
+ { label: 'Default', value: '' },
253
+ { label: 'Foreground', value: 'foreground' },
254
+ { label: 'Primary', value: 'primary' },
255
+ { label: 'Secondary', value: 'secondary' },
256
+ { label: 'Accent', value: 'accent' },
257
+ { label: 'Dark', value: 'dark' },
258
+ { label: 'Light', value: 'light' },
259
+ { label: 'White', value: 'white' },
260
+ { label: 'Black', value: 'black' },
261
+ ],
262
+ admin: {
263
+ ...override?.admin,
264
+ },
265
+ });
266
+
267
+ const iconsList = [
268
+ { label: 'Academic Cap', value: 'AcademicCapIcon' },
269
+ { label: 'Adjustments Horizontal', value: 'AdjustmentsHorizontalIcon' },
270
+ { label: 'Adjustments Vertical', value: 'AdjustmentsVerticalIcon' },
271
+ { label: 'Archive Box Arrow Down', value: 'ArchiveBoxArrowDownIcon' },
272
+ { label: 'Archive Box X Mark', value: 'ArchiveBoxXMarkIcon' },
273
+ { label: 'Archive Box', value: 'ArchiveBoxIcon' },
274
+ { label: 'Arrow Down Circle', value: 'ArrowDownCircleIcon' },
275
+ { label: 'Arrow Down', value: 'ArrowDownIcon' },
276
+ { label: 'Arrow Left Circle', value: 'ArrowLeftCircleIcon' },
277
+ { label: 'Arrow Left', value: 'ArrowLeftIcon' },
278
+ { label: 'Arrow Right Circle', value: 'ArrowRightCircleIcon' },
279
+ { label: 'Arrow Right', value: 'ArrowRightIcon' },
280
+ { label: 'Arrow Up Circle', value: 'ArrowUpCircleIcon' },
281
+ { label: 'Arrow Up', value: 'ArrowUpIcon' },
282
+ { label: 'Bell Alert', value: 'BellAlertIcon' },
283
+ { label: 'Bell', value: 'BellIcon' },
284
+ { label: 'Bookmark Square', value: 'BookmarkSquareIcon' },
285
+ { label: 'Bookmark', value: 'BookmarkIcon' },
286
+ { label: 'Building Office', value: 'BuildingOfficeIcon' },
287
+ { label: 'Calendar', value: 'CalendarIcon' },
288
+ { label: 'Camera', value: 'CameraIcon' },
289
+ { label: 'Chart Bar', value: 'ChartBarIcon' },
290
+ { label: 'Chat Bubble Left Right', value: 'ChatBubbleLeftRightIcon' },
291
+ { label: 'Chat Bubble Left', value: 'ChatBubbleLeftIcon' },
292
+ { label: 'Check Circle', value: 'CheckCircleIcon' },
293
+ { label: 'Check', value: 'CheckIcon' },
294
+ { label: 'Chevron Down', value: 'ChevronDownIcon' },
295
+ { label: 'Chevron Left', value: 'ChevronLeftIcon' },
296
+ { label: 'Chevron Right', value: 'ChevronRightIcon' },
297
+ { label: 'Chevron Up', value: 'ChevronUpIcon' },
298
+ { label: 'Clock', value: 'ClockIcon' },
299
+ { label: 'Cloud Arrow Up', value: 'CloudArrowUpIcon' },
300
+ { label: 'Cloud', value: 'CloudIcon' },
301
+ { label: 'Code Bracket', value: 'CodeBracketIcon' },
302
+ { label: 'Cog', value: 'CogIcon' },
303
+ { label: 'Command Line', value: 'CommandLineIcon' },
304
+ { label: 'Computer Desktop', value: 'ComputerDesktopIcon' },
305
+ { label: 'Credit Card', value: 'CreditCardIcon' },
306
+ { label: 'Document', value: 'DocumentIcon' },
307
+ { label: 'Envelope', value: 'EnvelopeIcon' },
308
+ { label: 'Exclamation Circle', value: 'ExclamationCircleIcon' },
309
+ { label: 'Exclamation Triangle', value: 'ExclamationTriangleIcon' },
310
+ { label: 'Eye', value: 'EyeIcon' },
311
+ { label: 'Face Smile', value: 'FaceSmileIcon' },
312
+ { label: 'Film', value: 'FilmIcon' },
313
+ { label: 'Finger Print', value: 'FingerPrintIcon' },
314
+ { label: 'Fire', value: 'FireIcon' },
315
+ { label: 'Flag', value: 'FlagIcon' },
316
+ { label: 'Folder Open', value: 'FolderOpenIcon' },
317
+ { label: 'Folder', value: 'FolderIcon' },
318
+ { label: 'Gift', value: 'GiftIcon' },
319
+ { label: 'Globe Alt', value: 'GlobeAltIcon' },
320
+ { label: 'Globe Europe Africa', value: 'GlobeEuropeAfricaIcon' },
321
+ { label: 'Hand Raised', value: 'HandRaisedIcon' },
322
+ { label: 'Heart', value: 'HeartIcon' },
323
+ { label: 'Home', value: 'HomeIcon' },
324
+ { label: 'Identification', value: 'IdentificationIcon' },
325
+ { label: 'Information Circle', value: 'InformationCircleIcon' },
326
+ { label: 'Key', value: 'KeyIcon' },
327
+ { label: 'Link', value: 'LinkIcon' },
328
+ { label: 'List Bullet', value: 'ListBulletIcon' },
329
+ { label: 'Lock Closed', value: 'LockClosedIcon' },
330
+ { label: 'Lock Open', value: 'LockOpenIcon' },
331
+ { label: 'Magnifying Glass Circle', value: 'MagnifyingGlassCircleIcon' },
332
+ { label: 'Magnifying Glass', value: 'MagnifyingGlassIcon' },
333
+ { label: 'Map Pin', value: 'MapPinIcon' },
334
+ { label: 'Map', value: 'MapIcon' },
335
+ { label: 'Moon', value: 'MoonIcon' },
336
+ { label: 'Paper Airplane', value: 'PaperAirplaneIcon' },
337
+ { label: 'Paper Clip', value: 'PaperClipIcon' },
338
+ { label: 'Pause Circle', value: 'PauseCircleIcon' },
339
+ { label: 'Pencil Square', value: 'PencilSquareIcon' },
340
+ { label: 'Pencil', value: 'PencilIcon' },
341
+ { label: 'Phone Arrow Up Right', value: 'PhoneArrowUpRightIcon' },
342
+ { label: 'Phone X Mark', value: 'PhoneXMarkIcon' },
343
+ { label: 'Phone', value: 'PhoneIcon' },
344
+ { label: 'Photo', value: 'PhotoIcon' },
345
+ { label: 'Play Circle', value: 'PlayCircleIcon' },
346
+ { label: 'Play', value: 'PlayIcon' },
347
+ { label: 'Plus Circle', value: 'PlusCircleIcon' },
348
+ { label: 'Plus', value: 'PlusIcon' },
349
+ { label: 'Power', value: 'PowerIcon' },
350
+ { label: 'Question Mark Circle', value: 'QuestionMarkCircleIcon' },
351
+ { label: 'Rocket Launch', value: 'RocketLaunchIcon' },
352
+ { label: 'Rss', value: 'RssIcon' },
353
+ { label: 'Scale', value: 'ScaleIcon' },
354
+ { label: 'Server', value: 'ServerIcon' },
355
+ { label: 'Share', value: 'ShareIcon' },
356
+ { label: 'Shield Check', value: 'ShieldCheckIcon' },
357
+ { label: 'Shield Exclamation', value: 'ShieldExclamationIcon' },
358
+ { label: 'Shopping Bag', value: 'ShoppingBagIcon' },
359
+ { label: 'Shopping Cart', value: 'ShoppingCartIcon' },
360
+ { label: 'Star', value: 'StarIcon' },
361
+ { label: 'Stop Circle', value: 'StopCircleIcon' },
362
+ { label: 'Sun', value: 'SunIcon' },
363
+ { label: 'Tag', value: 'TagIcon' },
364
+ { label: 'Trash', value: 'TrashIcon' },
365
+ { label: 'Trophy', value: 'TrophyIcon' },
366
+ { label: 'User Circle', value: 'UserCircleIcon' },
367
+ { label: 'User Group', value: 'UserGroupIcon' },
368
+ { label: 'User', value: 'UserIcon' },
369
+ { label: 'Users', value: 'UsersIcon' },
370
+ { label: 'Video Camera', value: 'VideoCameraIcon' },
371
+ { label: 'Wifi', value: 'WifiIcon' },
372
+ { label: 'Window', value: 'WindowIcon' },
373
+ { label: 'Wrench Screwdriver', value: 'WrenchScrewdriverIcon' },
374
+ { label: 'Wrench', value: 'WrenchIcon' },
375
+ { label: 'X Circle', value: 'XCircleIcon' },
376
+ { label: 'X Mark', value: 'XMarkIcon' },
377
+ ];
378
+
379
+ const fieldAction = () => ({
380
+ type: 'group',
381
+ label: 'Azione',
382
+ name: 'action',
383
+ fields: [
384
+ fieldCheckbox({ name: 'show', label: 'Mostra azione', defaultValue: false, admin: {
385
+ width: '50%', // TODO CAMBIARE LAYOUT ADMIN
386
+ } }),
387
+ fieldText({
388
+ name: 'label',
389
+ type: 'text',
390
+ label: 'Testo da visualizzare',
391
+ defaultValue: 'Action',
392
+ admin: {
393
+ width: '50%',
394
+ }
395
+ }),
396
+ fieldSelect({
397
+ name: 'actionType',
398
+ label: 'Tipo di azione',
399
+ defaultValue: 'internalLink',
400
+ admin: {
401
+ width: '33%',
402
+ },
403
+ options: [
404
+ {
405
+ label: 'Interno',
406
+ value: 'internalLink',
407
+ },
408
+ {
409
+ label: 'Esterno',
410
+ value: 'externalLink',
411
+ },
412
+ /*
413
+ {
414
+ label: 'Azione',
415
+ value: 'customAction',
416
+ },
417
+ */
418
+ ],
419
+ }),
420
+ {
421
+ name: 'internalLink',
422
+ type: 'relationship',
423
+ label: 'Seleziona una pagina interna',
424
+ admin: {
425
+ condition: (data, siblingData) => {
426
+ return siblingData?.actionType === 'internalLink';
427
+ },
428
+ },
429
+ relationTo: ['pages', 'posts', 'destinations'],
430
+ },
431
+ {
432
+ name: 'externalLink',
433
+ type: 'text',
434
+ label: 'URL esterno',
435
+ admin: {
436
+ condition: (data, siblingData) => {
437
+ return siblingData?.actionType === 'externalLink';
438
+ },
439
+ },
440
+ },
441
+ {
442
+ type: 'collapsible',
443
+ label: 'Stile',
444
+ fields: [
445
+ {
446
+ type: 'row',
447
+ fields: [
448
+ {
449
+ name: 'buttonStyle',
450
+ type: 'select',
451
+ label: 'Stile bottone',
452
+ defaultValue: 'solid',
453
+ admin: {
454
+ width: '33%',
455
+ },
456
+ options: [
457
+ { label: 'Solido', value: 'solid' },
458
+ { label: 'Outline', value: 'outline' },
459
+ { label: 'Ghost', value: 'ghost' },
460
+ { label: 'Link', value: 'link' },
461
+ ],
462
+ },
463
+ {
464
+ name: 'buttonColor',
465
+ type: 'select',
466
+ label: 'Colore bottone',
467
+ defaultValue: 'primary',
468
+ admin: {
469
+ width: '33%',
470
+ },
471
+ options: [
472
+ { label: 'Primary', value: 'primary' },
473
+ { label: 'Secondary', value: 'secondary' },
474
+ { label: 'Accent', value: 'accent' },
475
+ { label: 'Dark', value: 'dark' },
476
+ { label: 'Light', value: 'light' },
477
+ ],
478
+ },
479
+ {
480
+ name: 'buttonSize',
481
+ type: 'select',
482
+ label: 'Dimensione bottone',
483
+ defaultValue: 'default',
484
+ admin: {
485
+ width: '33%',
486
+ },
487
+ options: [
488
+ { label: 'Small', value: 'small' },
489
+ { label: 'Default', value: 'default' },
490
+ { label: 'Medium', value: 'medium' },
491
+ { label: 'Large', value: 'large' },
492
+ { label: 'Extra Large', value: 'xl' },
493
+ ],
494
+ },
495
+ {
496
+ name: 'buttonRounded',
497
+ type: 'select',
498
+ label: 'Arrotondamento',
499
+ defaultValue: 'default',
500
+ admin: {
501
+ width: '33%',
502
+ },
503
+ options: [
504
+ { label: 'Nessuno', value: 'none' },
505
+ { label: 'Piccolo', value: 'sm' },
506
+ { label: 'Standard', value: 'default' },
507
+ { label: 'Grande', value: 'lg' },
508
+ { label: 'Completo', value: 'full' },
509
+ ],
510
+ },
511
+ {
512
+ name: 'alignment',
513
+ type: 'select',
514
+ label: 'Allineamento del Bottone',
515
+ defaultValue: 'left',
516
+ options: [
517
+ {
518
+ label: 'Sinistra',
519
+ value: 'left',
520
+ },
521
+ {
522
+ label: 'Centro',
523
+ value: 'center',
524
+ },
525
+ {
526
+ label: 'Destra',
527
+ value: 'right',
528
+ }
529
+ ],
530
+ admin: {
531
+ width: '33%',
532
+ condition: (data) => true, // Puoi modificare questa condizione se il campo deve essere mostrato solo in determinate circostanze
533
+ }
534
+ },
535
+ fieldThemeColor({
536
+ name: 'textColor',
537
+ label: 'Colore del testo',
538
+ admin: {
539
+ width: '33%',
540
+ }
541
+ }),
542
+ {
543
+ name: 'additionalEffects',
544
+ type: 'select',
545
+ label: 'Effetti aggiuntivi',
546
+ hasMany: true,
547
+ admin: {
548
+ width: '33%',
549
+ },
550
+ options: [
551
+ { label: 'Ombra', value: 'shadow' },
552
+ { label: 'Transizione', value: 'transition' },
553
+ { label: 'Animazione scala', value: 'scale' },
554
+ ],
555
+ }
556
+ ],
557
+ },
558
+ {
559
+ type: 'row',
560
+ fields: [
561
+ {
562
+ name: 'useIcon',
563
+ type: 'checkbox',
564
+ label: 'Usa icona',
565
+ defaultValue: false,
566
+ admin: {
567
+ width: '33%',
568
+ },
569
+ },
570
+ {
571
+ name: 'iconPosition',
572
+ type: 'select',
573
+ label: 'Posizione icona',
574
+ defaultValue: 'left',
575
+ admin: {
576
+ width: '33%',
577
+ condition: (_, siblingData) => siblingData?.useIcon === true,
578
+ },
579
+ options: [
580
+ { label: 'Sinistra', value: 'left' },
581
+ { label: 'Destra', value: 'right' },
582
+ { label: 'Solo icona', value: 'only' },
583
+ ],
584
+ },
585
+ {
586
+ name: 'iconName',
587
+ type: 'select',
588
+ label: 'Icona',
589
+ options: [
590
+ ...iconsList
591
+ ],
592
+ admin: {
593
+ width: '33%',
594
+ condition: (_, siblingData) => siblingData?.useIcon === true,
595
+ },
596
+ // Qui potresti usare un select con le icone disponibili se hai una libreria predefinita
597
+ },
598
+ ]
599
+ }
600
+ ]
601
+ }
602
+ ]
603
+ });
604
+
246
605
  const fieldConfigProps = (customFields = []) => {
247
606
  return {
248
607
  name: 'config',
@@ -925,27 +1284,6 @@ const fieldViewportHeights = () => {
925
1284
  });
926
1285
  };
927
1286
 
928
- const fieldThemeColor = (override) => ({
929
- name: override?.name || 'color',
930
- label: override?.label || 'Colore',
931
- type: 'select',
932
- required: override?.required ?? false,
933
- options: [
934
- { label: 'Default', value: '' },
935
- { label: 'Foreground', value: 'foreground' },
936
- { label: 'Primary', value: 'primary' },
937
- { label: 'Secondary', value: 'secondary' },
938
- { label: 'Accent', value: 'accent' },
939
- { label: 'Dark', value: 'dark' },
940
- { label: 'Light', value: 'light' },
941
- { label: 'White', value: 'white' },
942
- { label: 'Black', value: 'black' },
943
- ],
944
- admin: {
945
- ...override?.admin,
946
- },
947
- });
948
-
949
1287
  const fieldSectionProps = (customFields = []) => {
950
1288
  return {
951
1289
  name: 'sctP',
@@ -1056,6 +1394,18 @@ const fieldContainerWidths = () => {
1056
1394
  });
1057
1395
  };
1058
1396
 
1397
+ const fieldFontSizes = () => {
1398
+ return fieldSelect({
1399
+ name: 'fs',
1400
+ label: 'Dimensione del testo',
1401
+ options: TailwindTextSizes,
1402
+ defaultValue: 'text-base',
1403
+ admin: {
1404
+ description: 'Seleziona una dimensione per il testo (es. Small, Base, Large, ecc.).',
1405
+ },
1406
+ });
1407
+ };
1408
+
1059
1409
  /**
1060
1410
  * Genera un campo per la selezione delle altezze
1061
1411
  * @returns Field - Campo di tipo `select` per PayloadCMS
@@ -1332,62 +1682,148 @@ const fieldPaddings = () => {
1332
1682
  };
1333
1683
  };
1334
1684
 
1685
+ const fieldMenuItems = (override) => ({
1686
+ name: 'menuItems',
1687
+ label: 'Menu items',
1688
+ type: 'array',
1689
+ fields: [
1690
+ {
1691
+ name: 'test',
1692
+ type: 'text'
1693
+ },
1694
+ fieldCheckbox({
1695
+ name: 'is-external',
1696
+ label: 'open in new tab',
1697
+ }),
1698
+ fieldText({ name: 'label', label: 'label' }),
1699
+ {
1700
+ name: 'relationship',
1701
+ type: 'relationship',
1702
+ relationTo: ['destinations'],
1703
+ },
1704
+ //WFieldRelationship(['pages', 'destinations']),
1705
+ fieldArray({
1706
+ name: 'sub-menu',
1707
+ label: 'Sub menu',
1708
+ admin: {
1709
+ description: 'Aggiungere voci figlio a una voce di menù ne disabilita il click di navigazione per permettere l\'apertura del dropdown'
1710
+ },
1711
+ fields: [
1712
+ fieldCheckbox({
1713
+ name: 'is-external',
1714
+ label: 'open in new tab',
1715
+ }),
1716
+ fieldText({ name: 'label', label: 'label' }),
1717
+ {
1718
+ name: 'relationship',
1719
+ type: 'relationship',
1720
+ relationTo: ['pages', 'posts', 'destinations'],
1721
+ },
1722
+ ]
1723
+ })
1724
+ ],
1725
+ });
1726
+
1727
+ var UserRole;
1728
+ (function (UserRole) {
1729
+ UserRole["ADMIN"] = "admin";
1730
+ UserRole["DESIGNER"] = "designer";
1731
+ UserRole["COPY"] = "copy";
1732
+ UserRole["WEBADMIN"] = "webadmin";
1733
+ })(UserRole || (UserRole = {}));
1734
+ const fieldRoles = (override) => ({
1735
+ name: override?.name || 'roles',
1736
+ label: override?.label || 'Ruoli',
1737
+ type: 'select',
1738
+ required: override?.required ?? true,
1739
+ hasMany: override?.hasMany ?? true,
1740
+ options: [
1741
+ ...Object.values(UserRole).map((role) => ({
1742
+ label: role.charAt(0).toUpperCase() + role.slice(1).toLowerCase(),
1743
+ value: role,
1744
+ })),
1745
+ ...(override?.options || []),
1746
+ ],
1747
+ access: {
1748
+ create: () => true,
1749
+ update: () => true,
1750
+ read: () => true,
1751
+ ...override?.access,
1752
+ },
1753
+ admin: {
1754
+ description: 'Seleziona uno o più ruoli utente.',
1755
+ ...override?.admin,
1756
+ },
1757
+ });
1758
+
1335
1759
  // Esportazioni dalle cartelle principali
1336
1760
 
1337
1761
  var index = /*#__PURE__*/Object.freeze({
1338
1762
  __proto__: null,
1763
+ fieldAction: fieldAction,
1339
1764
  fieldArray: fieldArray,
1340
1765
  fieldBlocks: fieldBlocks,
1341
1766
  fieldCheckbox: fieldCheckbox,
1342
1767
  fieldCode: fieldCode,
1768
+ fieldColor: fieldThemeColor,
1343
1769
  fieldConfigProps: fieldConfigProps,
1344
1770
  fieldContainerProps: fieldContainerProps,
1345
1771
  fieldContainerWidths: fieldContainerWidths,
1346
1772
  fieldContentProps: fieldContentProps,
1347
1773
  fieldDate: fieldDate,
1348
1774
  fieldEmail: fieldEmail,
1775
+ fieldFontSizes: fieldFontSizes,
1349
1776
  fieldHeights: fieldHeights,
1350
1777
  fieldJoin: fieldJoin,
1351
1778
  fieldMargins: fieldMargins,
1779
+ fieldMenuItems: fieldMenuItems,
1352
1780
  fieldNumber: fieldNumber,
1353
1781
  fieldPaddings: fieldPaddings,
1354
1782
  fieldPoint: fieldPoint,
1355
1783
  fieldRadioGroup: fieldRadioGroup,
1356
1784
  fieldRelationship: fieldRelationship,
1357
1785
  fieldRichText: fieldRichText,
1786
+ fieldRoles: fieldRoles,
1358
1787
  fieldSectionProps: fieldSectionProps,
1359
1788
  fieldSectionTabs: fieldSectionTabs,
1360
1789
  fieldSelect: fieldSelect,
1361
1790
  fieldText: fieldText,
1362
1791
  fieldTextArea: fieldTextArea,
1363
- fieldUpload: fieldUpload
1792
+ fieldUpload: fieldUpload,
1793
+ fieldViewportHeights: fieldViewportHeights
1364
1794
  });
1365
1795
 
1796
+ exports.fieldAction = fieldAction;
1366
1797
  exports.fieldArray = fieldArray;
1367
1798
  exports.fieldBlocks = fieldBlocks;
1368
1799
  exports.fieldCheckbox = fieldCheckbox;
1369
1800
  exports.fieldCode = fieldCode;
1801
+ exports.fieldColor = fieldThemeColor;
1370
1802
  exports.fieldConfigProps = fieldConfigProps;
1371
1803
  exports.fieldContainerProps = fieldContainerProps;
1372
1804
  exports.fieldContainerWidths = fieldContainerWidths;
1373
1805
  exports.fieldContentProps = fieldContentProps;
1374
1806
  exports.fieldDate = fieldDate;
1375
1807
  exports.fieldEmail = fieldEmail;
1808
+ exports.fieldFontSizes = fieldFontSizes;
1376
1809
  exports.fieldHeights = fieldHeights;
1377
1810
  exports.fieldJoin = fieldJoin;
1378
1811
  exports.fieldMargins = fieldMargins;
1812
+ exports.fieldMenuItems = fieldMenuItems;
1379
1813
  exports.fieldNumber = fieldNumber;
1380
1814
  exports.fieldPaddings = fieldPaddings;
1381
1815
  exports.fieldPoint = fieldPoint;
1382
1816
  exports.fieldRadioGroup = fieldRadioGroup;
1383
1817
  exports.fieldRelationship = fieldRelationship;
1384
1818
  exports.fieldRichText = fieldRichText;
1819
+ exports.fieldRoles = fieldRoles;
1385
1820
  exports.fieldSectionProps = fieldSectionProps;
1386
1821
  exports.fieldSectionTabs = fieldSectionTabs;
1387
1822
  exports.fieldSelect = fieldSelect;
1388
1823
  exports.fieldText = fieldText;
1389
1824
  exports.fieldTextArea = fieldTextArea;
1390
1825
  exports.fieldUpload = fieldUpload;
1826
+ exports.fieldViewportHeights = fieldViewportHeights;
1391
1827
  exports.index = index;
1392
1828
  exports.index$1 = index$1;
1393
1829
  //# sourceMappingURL=index.cjs.js.map