mypgs 2.0.0 → 2.1.0

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.
Files changed (104) hide show
  1. package/README.md +25 -25
  2. package/assets/scss/components/_accordion.scss +0 -2
  3. package/assets/scss/components/_button.scss +1 -1
  4. package/assets/scss/components/_form.scss +0 -16
  5. package/assets/scss/components/_formAddon.scss +18 -0
  6. package/assets/scss/components/_modals.scss +5 -3
  7. package/assets/scss/components/_search.scss +2 -2
  8. package/assets/scss/components/_slides.scss +0 -1
  9. package/assets/scss/components/_tooltip.scss +0 -1
  10. package/assets/scss/index.scss +1 -0
  11. package/assets/scss/layout/_footer.scss +0 -2
  12. package/assets/scss/layout/_header.scss +9 -1
  13. package/assets/scss/layout/_pageShell.scss +6 -2
  14. package/assets/scss/mixin/_mx-button.scss +30 -76
  15. package/assets/scss/mixin/_mx-card.scss +11 -9
  16. package/assets/scss/mixin/_mx-form.scss +3 -5
  17. package/assets/scss/mixin/{_mx-form-addon.scss → _mx-formAddon.scss} +23 -26
  18. package/assets/scss/mixin/_mx-hover.scss +75 -0
  19. package/assets/scss/mixin/_settings.scss +2 -1
  20. package/assets/scss/mixin/mixin.scss +2 -1
  21. package/demo/demo.js +4 -3
  22. package/dist/css/index.css +1166 -1517
  23. package/dist/css/index.css.map +1 -1
  24. package/dist/css/index.min.css +1 -1
  25. package/docs/componenti-e-markup.md +6 -5
  26. package/docs/components/accordion.md +22 -22
  27. package/docs/components/badges.md +19 -19
  28. package/docs/components/breadcumbs.md +8 -8
  29. package/docs/components/button.md +17 -17
  30. package/docs/components/card.md +19 -19
  31. package/docs/components/dropdown.md +29 -29
  32. package/docs/components/form.md +63 -40
  33. package/docs/components/formAddon.md +79 -0
  34. package/docs/components/logo.md +11 -11
  35. package/docs/components/menu.md +20 -20
  36. package/docs/components/modal.md +46 -46
  37. package/docs/components/notification.md +34 -34
  38. package/docs/components/search.md +51 -50
  39. package/docs/components/slides.md +39 -39
  40. package/docs/components/stepTabs.md +41 -41
  41. package/docs/components/steps.md +16 -16
  42. package/docs/components/summary.md +20 -20
  43. package/docs/components/table.md +7 -7
  44. package/docs/components/tooltip.md +22 -22
  45. package/docs/convenzioni.md +11 -11
  46. package/docs/export-e-sviluppo.md +3 -3
  47. package/docs/helper-javascript.md +7 -7
  48. package/docs/layout/body.md +11 -11
  49. package/docs/layout/flex.md +44 -44
  50. package/docs/layout/footer.md +23 -23
  51. package/docs/layout/grid.md +44 -44
  52. package/docs/layout/header.md +34 -34
  53. package/docs/layout/pageShell.md +11 -11
  54. package/docs/layout/section.md +26 -26
  55. package/docs/patterns/cookieConsent.md +38 -38
  56. package/docs/utilizzo-css-scss.md +8 -8
  57. package/package.json +1 -1
  58. package/scripts/generate-component-docs.js +5 -5
  59. package/templates/html/components/accordion.html +19 -19
  60. package/templates/html/components/badges.html +17 -17
  61. package/templates/html/components/breadcumbs.html +6 -6
  62. package/templates/html/components/button.html +15 -15
  63. package/templates/html/components/card.html +17 -17
  64. package/templates/html/components/dropdown.html +25 -25
  65. package/templates/html/components/form.html +58 -35
  66. package/templates/html/components/formAddon.html +72 -0
  67. package/templates/html/components/logo.html +9 -9
  68. package/templates/html/components/menu.html +16 -16
  69. package/templates/html/components/modal.html +42 -42
  70. package/templates/html/components/notification.html +30 -30
  71. package/templates/html/components/search.html +43 -42
  72. package/templates/html/components/slides.html +31 -31
  73. package/templates/html/components/stepTabs.html +37 -37
  74. package/templates/html/components/steps.html +13 -13
  75. package/templates/html/components/summary.html +17 -17
  76. package/templates/html/components/table.html +5 -5
  77. package/templates/html/components/tooltip.html +18 -18
  78. package/templates/html/layout/body.html +9 -10
  79. package/templates/html/layout/flex.html +42 -42
  80. package/templates/html/layout/footer.html +20 -20
  81. package/templates/html/layout/grid.html +42 -42
  82. package/templates/html/layout/header.html +32 -32
  83. package/templates/html/layout/pageShell.html +8 -8
  84. package/templates/html/layout/section.html +24 -24
  85. package/templates/html/patterns/cookieConsent.html +33 -33
  86. package/templates/react/components/accordion.jsx +4 -4
  87. package/templates/react/components/breadcumbs.jsx +1 -1
  88. package/templates/react/components/button.jsx +5 -5
  89. package/templates/react/components/card.jsx +4 -4
  90. package/templates/react/components/dropdown.jsx +8 -8
  91. package/templates/react/components/form.jsx +2 -2
  92. package/templates/react/components/modal.jsx +14 -14
  93. package/templates/react/components/notification.jsx +3 -3
  94. package/templates/react/components/search.jsx +5 -5
  95. package/templates/react/components/slides.jsx +3 -3
  96. package/templates/react/components/stepTabs.jsx +8 -8
  97. package/templates/react/components/summary.jsx +3 -3
  98. package/templates/react/components/table.jsx +2 -2
  99. package/templates/react/layout/flex.jsx +8 -8
  100. package/templates/react/layout/grid.jsx +8 -8
  101. package/templates/react/layout/section.jsx +12 -12
  102. package/templates/react/patterns/cookieConsent.jsx +8 -8
  103. package/templates/react/patterns/footer.jsx +3 -3
  104. package/templates/react/patterns/header.jsx +3 -3
@@ -18,7 +18,7 @@ const SOURCE_ROOTS = [
18
18
  const TAG_ORDER = ["title", "description", "pgs", "pgs-option", "pgs-state", "api", "related", "return"];
19
19
  const LIST_TAGS = new Set(["pgs", "pgs-option", "pgs-state", "api", "related"]);
20
20
  const REQUIRED_TAGS = ["title", "description", "pgs"];
21
- const GENERATED_MARKER = /^<!-- File generato automaticamente da (templates\/html\/.+\.html)\. Modificare \1 e rieseguire npm run docs:generate\. -->$/;
21
+ const GENERATED_MARKER = /^<!-- (?:Automatically generated from (templates\/html\/.+\.html)\. Edit \1 and run npm run docs:generate again\.|File generato automaticamente da (templates\/html\/.+\.html)\. Modificare \2 e rieseguire npm run docs:generate\.) -->$/;
22
22
 
23
23
  function toPosix(value) {
24
24
  return value.split(path.sep).join("/");
@@ -441,14 +441,14 @@ function renderList(items) {
441
441
 
442
442
  function renderMarkdown(template, documentation, markup) {
443
443
  const relativeTemplate = relativeToProject(template);
444
- const marker = `<!-- File generato automaticamente da ${relativeTemplate}. Modificare ${relativeTemplate} e rieseguire npm run docs:generate. -->`;
444
+ const marker = `<!-- Automatically generated from ${relativeTemplate}. Edit ${relativeTemplate} and run npm run docs:generate again. -->`;
445
445
  const sections = [marker, "", `# ${documentation.title}`, "", documentation.description];
446
446
  const sectionMap = [
447
447
  ["PGS", documentation.pgs],
448
448
  ["PGS Options", documentation["pgs-option"]],
449
449
  ["PGS States", documentation["pgs-state"]],
450
- ["API JavaScript", documentation.api],
451
- ["Elementi correlati", documentation.related],
450
+ ["JavaScript API", documentation.api],
451
+ ["Related elements", documentation.related],
452
452
  ];
453
453
 
454
454
  sectionMap.forEach(([title, items]) => {
@@ -460,7 +460,7 @@ function renderMarkdown(template, documentation, markup) {
460
460
 
461
461
  const runs = [...markup.matchAll(/`+/g)].map(match => match[0].length);
462
462
  const fence = "`".repeat(Math.max(3, (runs.length ? Math.max(...runs) : 0) + 1));
463
- sections.push("", "## Esempio", "", `${fence}html`, markup, fence, "");
463
+ sections.push("", "## Example", "", `${fence}html`, markup, fence, "");
464
464
  return sections.join("\n");
465
465
  }
466
466
 
@@ -1,29 +1,29 @@
1
1
  <!--
2
2
  /**
3
3
  * @title Accordion
4
- * @description Componente interattivo che espande un pannello alla volta, sincronizzando visibilità, attributi ARIA e navigazione da tastiera.
4
+ * @description Interactive component that expands one panel at a time while synchronizing visibility, ARIA attributes, and keyboard navigation.
5
5
  *
6
6
  * @pgs
7
- * - accordion: identifica ogni elemento espandibile inizializzato dal modulo JavaScript.
8
- * - accordion-button: identifica il controllo che apre o chiude il pannello associato.
9
- * - accordion-content: identifica il pannello di contenuto gestito tramite l'attributo hidden.
7
+ * - accordion: identifies each expandable element initialized by the JavaScript module.
8
+ * - accordion-button: identifies the control that opens or closes the associated panel.
9
+ * - accordion-content: identifies the content panel managed through the hidden attribute.
10
10
  *
11
11
  * @pgs-state
12
- * - open: indica l'elemento accordion attualmente aperto e visibile.
12
+ * - open: indicates the accordion element that is currently open and visible.
13
13
  *
14
14
  * @api
15
- * - pgs.accordion.init(root): inizializza gli accordion non ancora registrati dentro Document o Element indicato.
16
- * - pgs.accordion.api(element): restituisce l'istanza associata a un root accordion inizializzato.
17
- * - instance.open(): apre il pannello e chiude gli altri accordion presenti nella pagina.
18
- * - instance.close(): chiude il pannello corrente.
19
- * - instance.toggle(): inverte lo stato aperto o chiuso del pannello.
20
- * - instance.refresh(): riesegue l'inizializzazione nel contenitore dell'accordion e restituisce l'istanza.
21
- * - instance.isOpen(): restituisce true quando lo stato open è attivo.
15
+ * - pgs.accordion.init(root): initializes unregistered accordions within the specified Document or Element.
16
+ * - pgs.accordion.api(element): returns the instance associated with an initialized accordion root.
17
+ * - instance.open(): opens the panel and closes any other accordions on the page.
18
+ * - instance.close(): closes the current panel.
19
+ * - instance.toggle(): toggles the panel between its open and closed states.
20
+ * - instance.refresh(): reruns initialization within the accordion container and returns the instance.
21
+ * - instance.isOpen(): returns true when the open state is active.
22
22
  *
23
23
  * @related
24
- * - flexColumnTexts: applica la spaziatura testuale tra gli elementi della lista.
24
+ * - flexColumnTexts: applies text spacing between the list items.
25
25
  *
26
- * @return Lista HTML di elementi accordion accessibili con pulsante e pannello associato.
26
+ * @return HTML list of accessible accordion items with an associated button and panel.
27
27
  */
28
28
  -->
29
29
 
@@ -31,22 +31,22 @@
31
31
  <li pgs="accordion">
32
32
  <button pgs="accordion-button" type="button">
33
33
  <i class="fa-solid fa-circle-question" aria-hidden="true"></i>
34
- <span>Domanda frequente</span>
34
+ <span>Frequently asked question</span>
35
35
  </button>
36
36
 
37
37
  <div pgs="accordion-content" hidden>
38
- <p>Risposta di esempio con contenuto testuale riutilizzabile.</p>
38
+ <p>Example answer with reusable text content.</p>
39
39
  </div>
40
40
  </li>
41
41
 
42
42
  <li pgs="accordion">
43
43
  <button pgs="accordion-button" type="button">
44
44
  <i class="fa-solid fa-circle-info" aria-hidden="true"></i>
45
- <span>Seconda sezione</span>
45
+ <span>Second section</span>
46
46
  </button>
47
47
 
48
48
  <div pgs="accordion-content" hidden>
49
- <p>Altro contenuto del pannello accordion.</p>
49
+ <p>Additional accordion panel content.</p>
50
50
  </div>
51
51
  </li>
52
- </ul>
52
+ </ul>
@@ -1,23 +1,23 @@
1
1
  <!--
2
2
  /**
3
3
  * @title Badge
4
- * @description Raccolta di indicatori compatti per mostrare categorie, priorità e stati visivi con varianti cromatiche coerenti.
4
+ * @description Collection of compact indicators for displaying categories, priorities, and visual states with consistent color variants.
5
5
  *
6
6
  * @pgs
7
- * - badge: identifica la variante base del badge.
8
- * - badgePrimary: applica la variante con colore primario.
9
- * - badgeStrong: applica la variante ad alto contrasto.
10
- * - badgeSuccess: rappresenta un esito positivo.
11
- * - badgeDot: aggiunge un indicatore puntiforme al badge.
12
- * - badgeWarning: rappresenta un avviso.
13
- * - badgeError: rappresenta un errore.
14
- * - badgeInfo: rappresenta un'informazione.
15
- * - badgeNeutral: applica la variante neutra.
7
+ * - badge: identifies the base badge variant.
8
+ * - badgePrimary: applies the primary color variant.
9
+ * - badgeStrong: applies the high-contrast variant.
10
+ * - badgeSuccess: represents a successful result.
11
+ * - badgeDot: adds a dot indicator to the badge.
12
+ * - badgeWarning: represents a warning.
13
+ * - badgeError: represents an error.
14
+ * - badgeInfo: represents informational content.
15
+ * - badgeNeutral: applies the neutral variant.
16
16
  *
17
17
  * @related
18
- * - flexRow: dispone i badge orizzontalmente consentendo il ritorno a capo.
18
+ * - flexRow: arranges badges horizontally and allows them to wrap.
19
19
  *
20
- * @return Esempi HTML delle varianti badge disponibili.
20
+ * @return HTML examples of the available badge variants.
21
21
  */
22
22
  -->
23
23
 
@@ -35,17 +35,17 @@
35
35
  </span>
36
36
 
37
37
  <span pgs="badgeSuccess badgeDot">
38
- Attivo
38
+ Active
39
39
  </span>
40
40
 
41
41
  <span pgs="badgeWarning">
42
42
  <i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i>
43
- Attenzione
43
+ Warning
44
44
  </span>
45
45
 
46
46
  <span pgs="badgeError">
47
47
  <i class="fa-solid fa-xmark" aria-hidden="true"></i>
48
- Errore
48
+ Error
49
49
  </span>
50
50
 
51
51
  <span pgs="badgeInfo">
@@ -54,7 +54,7 @@
54
54
  </span>
55
55
 
56
56
  <span pgs="badgeNeutral" href="#">
57
- Neutrale
57
+ Neutral
58
58
  </span>
59
59
 
60
- </div>
60
+ </div>
@@ -1,14 +1,14 @@
1
1
  <!--
2
2
  /**
3
3
  * @title Breadcrumb
4
- * @description Navigazione gerarchica che mostra il percorso della pagina corrente con collegamenti, separatori e indicazione semantica dell'elemento attivo.
4
+ * @description Hierarchical navigation that shows the current page path with links, separators, and a semantic indication of the active item.
5
5
  *
6
6
  * @pgs
7
- * - breadcrumb: identifica la lista principale del percorso di navigazione.
8
- * - breadcrumb-item: identifica ogni livello del percorso.
9
- * - breadcrumb-item-separator: identifica il separatore decorativo nascosto alle tecnologie assistive.
7
+ * - breadcrumb: identifies the main navigation path list.
8
+ * - breadcrumb-item: identifies each level in the path.
9
+ * - breadcrumb-item-separator: identifies the decorative separator hidden from assistive technologies.
10
10
  *
11
- * @return Struttura HTML semantica di una breadcrumb racchiusa in un elemento nav.
11
+ * @return Semantic breadcrumb HTML structure wrapped in a nav element.
12
12
  */
13
13
  -->
14
14
 
@@ -30,7 +30,7 @@
30
30
 
31
31
  <li pgs="breadcrumb-item">
32
32
  <span aria-current="page">
33
- Articolo di prova
33
+ Sample article
34
34
  </span>
35
35
  </li>
36
36
  </ul>
@@ -1,22 +1,22 @@
1
1
  <!--
2
2
  /**
3
3
  * @title Button
4
- * @description Varianti di pulsante e collegamento d'azione con dimensioni, enfasi e composizione icona-testo definite dal design system.
4
+ * @description Button and action-link variants with sizes, emphasis, and icon-text composition defined by the design system.
5
5
  *
6
6
  * @pgs
7
- * - button: identifica il pulsante standard utilizzabile anche su elementi a.
8
- * - buttonStrong: applica la variante con maggiore enfasi visiva.
9
- * - buttonIcon: identifica un pulsante compatto composto principalmente da un'icona.
10
- * - buttonMini: applica la variante di dimensione minima.
11
- * - buttonBig: applica la variante di dimensione ampia.
7
+ * - button: identifies the standard button, which can also be used on anchor elements.
8
+ * - buttonStrong: applies the variant with stronger visual emphasis.
9
+ * - buttonIcon: identifies a compact button composed primarily of an icon.
10
+ * - buttonMini: applies the smallest size variant.
11
+ * - buttonBig: applies the large size variant.
12
12
  *
13
13
  * @pgs-option
14
- * - buttonReverse: inverte l'ordine visivo di testo e icona sul pulsante a cui è applicata.
14
+ * - buttonReverse: reverses the visual order of the text and icon on the button.
15
15
  *
16
16
  * @related
17
- * - flexRow: dispone gli esempi di pulsante su una riga flessibile.
17
+ * - flexRow: arranges the button examples in a flexible row.
18
18
  *
19
- * @return Raccolta HTML delle principali varianti di button.
19
+ * @return HTML collection of the main button variants.
20
20
  */
21
21
  -->
22
22
 
@@ -27,7 +27,7 @@
27
27
  </a>
28
28
 
29
29
  <button pgs="button" type="button" pgs-option="buttonReverse">
30
- Avanti
30
+ Next
31
31
  <i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
32
32
  </button>
33
33
 
@@ -36,16 +36,16 @@
36
36
  Submit
37
37
  </button>
38
38
 
39
- <button pgs="buttonIcon" type="button" aria-label="Impostazioni">
39
+ <button pgs="buttonIcon" type="button" aria-label="Settings">
40
40
  <i class="fa-solid fa-gear" aria-hidden="true"></i>
41
41
  </button>
42
42
 
43
- <button pgs="buttonMini" type="button" aria-label="Informazioni">
43
+ <button pgs="buttonMini" type="button" aria-label="Information">
44
44
  <i class="fa-solid fa-info" aria-hidden="true"></i>
45
45
  </button>
46
46
 
47
- <button pgs="buttonBig" type="button" aria-label="Bottone grande">
47
+ <button pgs="buttonBig" type="button" aria-label="Large button">
48
48
  <i class="fa-solid fa-rocket" aria-hidden="true"></i>
49
- Bottone grande
49
+ Large button
50
50
  </button>
51
- </div>
51
+ </div>
@@ -1,43 +1,43 @@
1
1
  <!--
2
2
  /**
3
3
  * @title Card
4
- * @description Contenitore riutilizzabile per raggruppare immagine, titolo, testo e azioni in anteprime o raccolte responsive.
4
+ * @description Reusable container for grouping an image, title, text, and actions in responsive previews or collections.
5
5
  *
6
6
  * @pgs
7
- * - card: identifica il contenitore principale della scheda.
8
- * - card-img: identifica l'immagine principale della card.
7
+ * - card: identifies the main card container.
8
+ * - card-img: identifies the main card image.
9
9
  *
10
10
  * @related
11
- * - flex-2: dispone le card in un layout responsive a due elementi.
12
- * - flexColumn: organizza verticalmente il contenuto della card o del relativo link.
13
- * - imgCover: adatta l'immagine riempiendo l'area disponibile.
14
- * - flexColumnTexts: applica la spaziatura verticale ai contenuti testuali.
15
- * - button: presenta il collegamento finale come pulsante standard.
11
+ * - flex-2: arranges the cards in a responsive two-item layout.
12
+ * - flexColumn: organizes the card or link content vertically.
13
+ * - imgCover: scales the image to fill the available area.
14
+ * - flexColumnTexts: applies vertical spacing to text content.
15
+ * - button: presents the final link as a standard button.
16
16
  *
17
- * @return Due strutture HTML di card, una con azione separata e una interamente cliccabile.
17
+ * @return Two card HTML structures, one with a separate action and one that is fully clickable.
18
18
  */
19
19
  -->
20
20
 
21
21
  <div pgs="flex-2">
22
22
 
23
23
  <article pgs="card flexColumn">
24
- <img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Immagine segnaposto">
24
+ <img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Placeholder image">
25
25
 
26
26
  <div pgs="flexColumnTexts">
27
- <h3>Card riutilizzabile</h3>
28
- <p>Contenuto descrittivo della card, adatto a liste, anteprime e griglie.</p>
29
- <a pgs="button" href="#">Leggi di piu</a>
27
+ <h3>Reusable card</h3>
28
+ <p>Descriptive card content suitable for lists, previews, and grids.</p>
29
+ <a pgs="button" href="#">Read more</a>
30
30
  </div>
31
31
  </article>
32
32
 
33
33
  <article pgs="card">
34
34
  <a pgs="flexColumn" href="">
35
- <img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Immagine segnaposto">
35
+ <img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Placeholder image">
36
36
 
37
37
  <div pgs="flexColumnTexts">
38
- <h3>Card riutilizzabile</h3>
39
- <p>Contenuto descrittivo della card, adatto a liste, anteprime e griglie.</p>
38
+ <h3>Reusable card</h3>
39
+ <p>Descriptive card content suitable for lists, previews, and grids.</p>
40
40
  </div>
41
41
  </a>
42
42
  </article>
43
- </div>
43
+ </div>
@@ -1,34 +1,34 @@
1
1
  <!--
2
2
  /**
3
3
  * @title Dropdown
4
- * @description Componente a comparsa che associa un controllo a un contenuto posizionato rispetto al trigger e gestisce apertura, chiusura, click esterno ed Escape.
4
+ * @description Popup component that connects a control to content positioned relative to its trigger and handles opening, closing, outside clicks, and Escape.
5
5
  *
6
6
  * @pgs
7
- * - dropdown: identifica il contenitore inizializzato dal modulo dropdown.
8
- * - dropdown-button: identifica il controllo che apre o chiude il contenuto.
9
- * - dropdown-content: identifica il pannello posizionato rispetto al controllo.
7
+ * - dropdown: identifies the container initialized by the dropdown module.
8
+ * - dropdown-button: identifies the control that opens or closes the content.
9
+ * - dropdown-content: identifies the panel positioned relative to the control.
10
10
  *
11
11
  * @pgs-option
12
- * - position: configura il root come position[lato allineamento]; lato accetta top, right, bottom o left e l'allineamento compatibile accetta top, right, bottom, left o center. Il valore predefinito è bottom center.
13
- * - buttonReverse: inverte testo e icona sui pulsanti di esempio e appartiene al componente button.
12
+ * - position: configures the root as position[side alignment]; side accepts top, right, bottom, or left, while compatible alignment values are top, right, bottom, left, or center. The default is bottom center.
13
+ * - buttonReverse: reverses text and icon on the example buttons and belongs to the button component.
14
14
  *
15
15
  * @pgs-state
16
- * - open: indica che il dropdown è aperto e che il contenuto è visibile.
16
+ * - open: indicates that the dropdown is open and its content is visible.
17
17
  *
18
18
  * @api
19
- * - pgs.dropdown.init(root): inizializza i dropdown non ancora registrati dentro Document o Element indicato.
20
- * - pgs.dropdown.api(element): restituisce l'istanza associata a un root dropdown inizializzato.
21
- * - instance.open(): apre il dropdown, chiudendo eventuali altri dropdown aperti.
22
- * - instance.close(): chiude il dropdown corrente.
23
- * - instance.toggle(): inverte lo stato aperto o chiuso.
24
- * - instance.refresh(): reinizializza il contesto e ricalcola il posizionamento del contenuto.
25
- * - instance.isOpen(): restituisce true quando il dropdown è aperto.
19
+ * - pgs.dropdown.init(root): initializes unregistered dropdowns within the specified Document or Element.
20
+ * - pgs.dropdown.api(element): returns the instance associated with an initialized dropdown root.
21
+ * - instance.open(): opens the dropdown and closes any other open dropdowns.
22
+ * - instance.close(): closes the current dropdown.
23
+ * - instance.toggle(): toggles between the open and closed states.
24
+ * - instance.refresh(): reinitializes the context and recalculates content positioning.
25
+ * - instance.isOpen(): returns true when the dropdown is open.
26
26
  *
27
27
  * @related
28
- * - flexRow: dispone i diversi esempi di posizionamento sulla stessa riga flessibile.
29
- * - button: applica lo stile standard ai controlli del dropdown.
28
+ * - flexRow: arranges the placement examples on the same flexible row.
29
+ * - button: applies standard styling to dropdown controls.
30
30
  *
31
- * @return Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
31
+ * @return Series of HTML dropdowns demonstrating the supported placement directions.
32
32
  */
33
33
  -->
34
34
 
@@ -41,7 +41,7 @@
41
41
  </button>
42
42
 
43
43
  <div pgs="dropdown-content">
44
- Contenuto bottom center
44
+ bottom center content
45
45
  </div>
46
46
  </span>
47
47
 
@@ -52,7 +52,7 @@
52
52
  </button>
53
53
 
54
54
  <div pgs="dropdown-content">
55
- Contenuto top left
55
+ top left content
56
56
  </div>
57
57
  </span>
58
58
 
@@ -63,7 +63,7 @@
63
63
  </button>
64
64
 
65
65
  <div pgs="dropdown-content">
66
- Contenuto top center
66
+ top center content
67
67
  </div>
68
68
  </span>
69
69
 
@@ -74,7 +74,7 @@
74
74
  </button>
75
75
 
76
76
  <div pgs="dropdown-content">
77
- Contenuto top right
77
+ top right content
78
78
  </div>
79
79
  </span>
80
80
 
@@ -85,7 +85,7 @@
85
85
  </button>
86
86
 
87
87
  <div pgs="dropdown-content">
88
- Contenuto bottom left
88
+ bottom left content
89
89
  </div>
90
90
  </span>
91
91
 
@@ -96,7 +96,7 @@
96
96
  </button>
97
97
 
98
98
  <div pgs="dropdown-content">
99
- Contenuto bottom right
99
+ bottom right content
100
100
  </div>
101
101
  </span>
102
102
 
@@ -107,7 +107,7 @@
107
107
  </button>
108
108
 
109
109
  <div pgs="dropdown-content">
110
- Contenuto left center
110
+ left center content
111
111
  </div>
112
112
  </span>
113
113
 
@@ -118,7 +118,7 @@
118
118
  </button>
119
119
 
120
120
  <div pgs="dropdown-content">
121
- Contenuto right center
121
+ right center content
122
122
  </div>
123
123
  </span>
124
124
 
@@ -1,71 +1,94 @@
1
1
  <!--
2
2
  /**
3
3
  * @title Form
4
- * @description Struttura di modulo con etichette, campi testuali, textarea e controllo toggle compatibile con i vincoli HTML e con regole personalizzate di PGS_formValidate.
4
+ * @description Form structure with labels, text fields, a textarea, a checkbox, and a radio group compatible with HTML constraints and custom PGS_formValidate rules.
5
5
  *
6
6
  * @pgs
7
- * - form: identifica il contenitore del modulo e applica il layout dei campi.
8
- * - formValidate: abilita gli stili associati agli stati di validazione gestiti dalla utility JavaScript.
9
- * - label: identifica le etichette associate ai controlli.
10
- * - input: applica lo stile condiviso agli input testuali.
11
- * - textarea: applica lo stile condiviso all'area di testo.
12
- * - toggle: presenta una checkbox come controllo a due stati.
7
+ * - form: identifies the form container and applies the field layout.
8
+ * - formValidate: enables styles associated with validation states managed by the JavaScript utility.
9
+ * - label: identifies labels associated with controls.
10
+ * - input: applies shared styling to text inputs.
11
+ * - textarea: applies shared styling to the text area.
12
+ * - radio: styles a group of native radio inputs while preserving their shared name and selection behavior.
13
13
  *
14
14
  * @pgs-option
15
- * - message: definisce il messaggio specifico del campo con la sintassi message[Testo del messaggio].
16
- * - error: viene applicata a runtime al form e ai campi che non superano la validazione.
17
- * - success: viene applicata a runtime al form quando la validazione ha esito positivo.
15
+ * - message: defines a field-specific message with the syntax message[Message text].
16
+ * - error: is applied at runtime to the form and fields that fail validation.
17
+ * - success: is applied at runtime to the form after successful validation.
18
18
  *
19
19
  * @api
20
- * - new pgs.formValidate(form, options): crea una utility associata direttamente al form, aggiunge automaticamente novalidate e accetta fieldError, fieldsError e success in options.message; i messaggi restano modificabili tramite instance.message.
21
- * - instance.validator(callback, eventName): intercetta l'evento indicato, previene il comportamento predefinito, valida il form, mostra il messaggio di successo e richiama callback solo quando è valido; eventName usa submit come valore predefinito.
22
- * - instance.validate(): valida i campi required, aggiorna gli attributi di stato e restituisce true o false.
23
- * - instance.success(text): valida il form e mostra un toast positivo quando non sono presenti errori.
24
- * - instance.addNewRule(rule): aggiunge una funzione che restituisce uno o più campi non validi; validate applica automaticamente addFieldError a ciascun campo.
25
- * - instance.addFieldError(field, index, total): marca un campo come non valido; mostra il messaggio specifico per un solo errore o un messaggio riepilogativo per più errori.
26
- * - instance.removeFieldError(field): rimuove lo stato di errore dal campo indicato.
20
+ * - new pgs.formValidate(form, options): creates a utility associated directly with the form, automatically adds novalidate, and accepts fieldError, fieldsError, and success in options.message; messages remain editable through instance.message.
21
+ * - instance.validator(callback, eventName): intercepts the specified event, prevents its default behavior, validates the form, shows the success message, and invokes callback only when valid; eventName defaults to submit.
22
+ * - instance.validate(): validates required fields, updates state attributes, and returns true or false.
23
+ * - instance.success(text): validates the form and shows a success toast when there are no errors.
24
+ * - instance.addNewRule(rule): adds a function that returns one or more invalid fields; validate automatically applies addFieldError to each field.
25
+ * - instance.addFieldError(field, index, total): marks a field as invalid; shows the specific message for one error or a summary message for multiple errors.
26
+ * - instance.removeFieldError(field): removes the error state from the specified field.
27
27
  *
28
28
  * @related
29
- * - buttonStrong: presenta l'invio del modulo come azione primaria.
29
+ * - buttonStrong: presents form submission as the primary action.
30
+ * - flexColumnTexts: spaces text elements in the radio group.
30
31
  *
31
- * @return Modulo HTML completo con campi required e script di esempio per una regola personalizzata, la validazione e il messaggio di successo.
32
+ * @return Complete HTML form with required fields and an example script for a custom rule, validation, and a success message.
32
33
  */
33
34
  -->
34
35
 
35
36
  <form pgs="form formValidate" action="#" method="post">
36
37
  <label pgs="label" for="form-name">
37
- Nome
38
+ Name
38
39
  </label>
39
- <input id="form-name" pgs="input" pgs-option="message[Inserisci il nome]" type="text" name="name" placeholder="Mario Rossi" required>
40
+ <input id="form-name" pgs="input" pgs-option="message[Enter your name]" type="text" name="name" placeholder="John Smith" required>
40
41
 
41
42
  <label pgs="label" for="form-email">
42
43
  Email
43
44
  </label>
44
- <input id="form-email" pgs="input" pgs-option="message[Inserisci una email valida]" type="email" name="email" placeholder="nome@example.com" required>
45
+ <input id="form-email" pgs="input" pgs-option="message[Enter a valid email address]" type="email" name="email" placeholder="name@example.com" required>
45
46
 
46
47
  <label pgs="label" for="form-password">
47
48
  Password
48
49
  </label>
49
- <input id="form-password" pgs="input" pgs-option="message[Inserisci una password]" type="password" name="password" autocomplete="new-password" required>
50
+ <input id="form-password" pgs="input" pgs-option="message[Enter a password]" type="password" name="password" autocomplete="new-password" required>
50
51
 
51
52
  <label pgs="label" for="form-confirm-password">
52
- Conferma password
53
+ Confirm password
53
54
  </label>
54
- <input id="form-confirm-password" pgs="input" pgs-option="message[Conferma la password]" type="password" name="confirmPassword" autocomplete="new-password" required>
55
+ <input id="form-confirm-password" pgs="input" pgs-option="message[Confirm your password]" type="password" name="confirmPassword" autocomplete="new-password" required>
55
56
 
56
57
  <label pgs="label" for="form-message">
57
- Messaggio
58
+ Message
58
59
  </label>
59
- <textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="Scrivi il messaggio" required></textarea>
60
+ <textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="Write your message" required></textarea>
60
61
 
61
- <label pgs="toggle">
62
- <span>Accetto la privacy policy</span>
62
+ <br>
63
+ <fieldset pgs="radio flexColumnTexts">
64
+ <legend>Preferred contact method</legend>
65
+
66
+ <label>
67
+ <input type="radio" name="contactMethod" value="email" pgs-option="message[Choose a contact method]" required>
68
+ <span>Email</span>
69
+ </label>
70
+
71
+ <label>
72
+ <input type="radio" name="contactMethod" value="phone">
73
+ <span>Phone</span>
74
+ </label>
75
+
76
+ <label>
77
+ <input type="radio" name="contactMethod" value="message">
78
+ <span>Direct message</span>
79
+ </label>
80
+ </fieldset>
81
+ <br>
82
+
83
+ <label>
63
84
  <input type="checkbox" name="privacy" required>
85
+ <span>I accept the privacy policy</span>
64
86
  </label>
87
+ <br>
65
88
 
66
89
  <button pgs="buttonStrong" type="submit">
67
90
  <i class="fa-solid fa-paper-plane" aria-hidden="true"></i>
68
- Invia
91
+ Submit
69
92
  </button>
70
93
  </form>
71
94
 
@@ -80,16 +103,16 @@
80
103
 
81
104
  const formValidate = new pgs.formValidate(form, {
82
105
  message: {
83
- fieldError: "Completa questo campo",
84
- fieldsError: "Completa tutti i campi obbligatori",
85
- success: "Inviato con successo"
106
+ fieldError: "Please complete this field",
107
+ fieldsError: "Please complete all required fields",
108
+ success: "Submitted successfully"
86
109
  }
87
110
  });
88
111
 
89
112
  //== new roules
90
113
  formValidate.addNewRule(() => {
91
114
  if (password.value && confirmPassword.value && password.value !== confirmPassword.value) {
92
- pgs(confirmPassword).option.setValueBrackets("message", "Le password non coincidono");
115
+ pgs(confirmPassword).option.setValueBrackets("message", "Passwords do not match");
93
116
  return [confirmPassword, password];
94
117
  }
95
118
  });
@@ -98,7 +121,7 @@
98
121
  formValidate.validator(event => {
99
122
  const values = Object.fromEntries(new FormData(form));
100
123
 
101
- // Sostituisci questo log con l'invio dei dati al tuo backend.
124
+ // Replace this log with a request to your backend.
102
125
  console.log(values);
103
126
  }, "submit");
104
127
  </script>