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
@@ -1,79 +1,102 @@
1
- <!-- File generato automaticamente da templates/html/components/form.html. Modificare templates/html/components/form.html e rieseguire npm run docs:generate. -->
1
+ <!-- Automatically generated from templates/html/components/form.html. Edit templates/html/components/form.html and run npm run docs:generate again. -->
2
2
 
3
3
  # Form
4
4
 
5
- Struttura di modulo con etichette, campi testuali, textarea e controllo toggle compatibile con i vincoli HTML e con regole personalizzate di PGS_formValidate.
5
+ Form structure with labels, text fields, a textarea, a checkbox, and a radio group compatible with HTML constraints and custom PGS_formValidate rules.
6
6
 
7
7
  ## PGS
8
8
 
9
- - `form`: identifica il contenitore del modulo e applica il layout dei campi.
10
- - `formValidate`: abilita gli stili associati agli stati di validazione gestiti dalla utility JavaScript.
11
- - `label`: identifica le etichette associate ai controlli.
12
- - `input`: applica lo stile condiviso agli input testuali.
13
- - `textarea`: applica lo stile condiviso all'area di testo.
14
- - `toggle`: presenta una checkbox come controllo a due stati.
9
+ - `form`: identifies the form container and applies the field layout.
10
+ - `formValidate`: enables styles associated with validation states managed by the JavaScript utility.
11
+ - `label`: identifies labels associated with controls.
12
+ - `input`: applies shared styling to text inputs.
13
+ - `textarea`: applies shared styling to the text area.
14
+ - `radio`: styles a group of native radio inputs while preserving their shared name and selection behavior.
15
15
 
16
16
  ## PGS Options
17
17
 
18
- - `message`: definisce il messaggio specifico del campo con la sintassi message[Testo del messaggio].
19
- - `error`: viene applicata a runtime al form e ai campi che non superano la validazione.
20
- - `success`: viene applicata a runtime al form quando la validazione ha esito positivo.
18
+ - `message`: defines a field-specific message with the syntax message[Message text].
19
+ - `error`: is applied at runtime to the form and fields that fail validation.
20
+ - `success`: is applied at runtime to the form after successful validation.
21
21
 
22
- ## API JavaScript
22
+ ## JavaScript API
23
23
 
24
- - `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.
25
- - `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.
26
- - `instance.validate()`: valida i campi required, aggiorna gli attributi di stato e restituisce true o false.
27
- - `instance.success(text)`: valida il form e mostra un toast positivo quando non sono presenti errori.
28
- - `instance.addNewRule(rule)`: aggiunge una funzione che restituisce uno o più campi non validi; validate applica automaticamente addFieldError a ciascun campo.
29
- - `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.
30
- - `instance.removeFieldError(field)`: rimuove lo stato di errore dal campo indicato.
24
+ - `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.
25
+ - `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.
26
+ - `instance.validate()`: validates required fields, updates state attributes, and returns true or false.
27
+ - `instance.success(text)`: validates the form and shows a success toast when there are no errors.
28
+ - `instance.addNewRule(rule)`: adds a function that returns one or more invalid fields; validate automatically applies addFieldError to each field.
29
+ - `instance.addFieldError(field, index, total)`: marks a field as invalid; shows the specific message for one error or a summary message for multiple errors.
30
+ - `instance.removeFieldError(field)`: removes the error state from the specified field.
31
31
 
32
- ## Elementi correlati
32
+ ## Related elements
33
33
 
34
- - `buttonStrong`: presenta l'invio del modulo come azione primaria.
34
+ - `buttonStrong`: presents form submission as the primary action.
35
+ - `flexColumnTexts`: spaces text elements in the radio group.
35
36
 
36
37
  ## Output
37
38
 
38
- Modulo HTML completo con campi required e script di esempio per una regola personalizzata, la validazione e il messaggio di successo.
39
+ Complete HTML form with required fields and an example script for a custom rule, validation, and a success message.
39
40
 
40
- ## Esempio
41
+ ## Example
41
42
 
42
43
  ```html
43
44
  <form pgs="form formValidate" action="#" method="post">
44
45
  <label pgs="label" for="form-name">
45
- Nome
46
+ Name
46
47
  </label>
47
- <input id="form-name" pgs="input" pgs-option="message[Inserisci il nome]" type="text" name="name" placeholder="Mario Rossi" required>
48
+ <input id="form-name" pgs="input" pgs-option="message[Enter your name]" type="text" name="name" placeholder="John Smith" required>
48
49
 
49
50
  <label pgs="label" for="form-email">
50
51
  Email
51
52
  </label>
52
- <input id="form-email" pgs="input" pgs-option="message[Inserisci una email valida]" type="email" name="email" placeholder="nome@example.com" required>
53
+ <input id="form-email" pgs="input" pgs-option="message[Enter a valid email address]" type="email" name="email" placeholder="name@example.com" required>
53
54
 
54
55
  <label pgs="label" for="form-password">
55
56
  Password
56
57
  </label>
57
- <input id="form-password" pgs="input" pgs-option="message[Inserisci una password]" type="password" name="password" autocomplete="new-password" required>
58
+ <input id="form-password" pgs="input" pgs-option="message[Enter a password]" type="password" name="password" autocomplete="new-password" required>
58
59
 
59
60
  <label pgs="label" for="form-confirm-password">
60
- Conferma password
61
+ Confirm password
61
62
  </label>
62
- <input id="form-confirm-password" pgs="input" pgs-option="message[Conferma la password]" type="password" name="confirmPassword" autocomplete="new-password" required>
63
+ <input id="form-confirm-password" pgs="input" pgs-option="message[Confirm your password]" type="password" name="confirmPassword" autocomplete="new-password" required>
63
64
 
64
65
  <label pgs="label" for="form-message">
65
- Messaggio
66
+ Message
66
67
  </label>
67
- <textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="Scrivi il messaggio" required></textarea>
68
-
69
- <label pgs="toggle">
70
- <span>Accetto la privacy policy</span>
68
+ <textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="Write your message" required></textarea>
69
+
70
+ <br>
71
+ <fieldset pgs="radio flexColumnTexts">
72
+ <legend>Preferred contact method</legend>
73
+
74
+ <label>
75
+ <input type="radio" name="contactMethod" value="email" pgs-option="message[Choose a contact method]" required>
76
+ <span>Email</span>
77
+ </label>
78
+
79
+ <label>
80
+ <input type="radio" name="contactMethod" value="phone">
81
+ <span>Phone</span>
82
+ </label>
83
+
84
+ <label>
85
+ <input type="radio" name="contactMethod" value="message">
86
+ <span>Direct message</span>
87
+ </label>
88
+ </fieldset>
89
+ <br>
90
+
91
+ <label>
71
92
  <input type="checkbox" name="privacy" required>
93
+ <span>I accept the privacy policy</span>
72
94
  </label>
95
+ <br>
73
96
 
74
97
  <button pgs="buttonStrong" type="submit">
75
98
  <i class="fa-solid fa-paper-plane" aria-hidden="true"></i>
76
- Invia
99
+ Submit
77
100
  </button>
78
101
  </form>
79
102
 
@@ -88,16 +111,16 @@ Modulo HTML completo con campi required e script di esempio per una regola perso
88
111
 
89
112
  const formValidate = new pgs.formValidate(form, {
90
113
  message: {
91
- fieldError: "Completa questo campo",
92
- fieldsError: "Completa tutti i campi obbligatori",
93
- success: "Inviato con successo"
114
+ fieldError: "Please complete this field",
115
+ fieldsError: "Please complete all required fields",
116
+ success: "Submitted successfully"
94
117
  }
95
118
  });
96
119
 
97
120
  //== new roules
98
121
  formValidate.addNewRule(() => {
99
122
  if (password.value && confirmPassword.value && password.value !== confirmPassword.value) {
100
- pgs(confirmPassword).option.setValueBrackets("message", "Le password non coincidono");
123
+ pgs(confirmPassword).option.setValueBrackets("message", "Passwords do not match");
101
124
  return [confirmPassword, password];
102
125
  }
103
126
  });
@@ -106,7 +129,7 @@ Modulo HTML completo con campi required e script di esempio per una regola perso
106
129
  formValidate.validator(event => {
107
130
  const values = Object.fromEntries(new FormData(form));
108
131
 
109
- // Sostituisci questo log con l'invio dei dati al tuo backend.
132
+ // Replace this log with a request to your backend.
110
133
  console.log(values);
111
134
  }, "submit");
112
135
  </script>
@@ -0,0 +1,79 @@
1
+ <!-- Automatically generated from templates/html/components/formAddon.html. Edit templates/html/components/formAddon.html and run npm run docs:generate again. -->
2
+
3
+ # Form Add-ons
4
+
5
+ Additional form controls for selectable cards, two-state buttons, switches, and compact chip groups.
6
+
7
+ ## PGS
8
+
9
+ - `checkboxBackground`: presents a checkbox as a selectable container with a highlighted checked state.
10
+ - `twoState`: presents checkbox or radio labels as buttons whose appearance changes when selected.
11
+ - `toggle`: presents a checkbox as a switch with a rail and movable thumb.
12
+ - `chips`: groups twoState controls into a compact segmented selector.
13
+
14
+ ## Related elements
15
+
16
+ - `flexColumnElements`: vertically arranges the form add-on examples.
17
+ - `flexColumnTexts`: groups each example with its heading and control.
18
+
19
+ ## Output
20
+
21
+ HTML examples of the checkboxBackground, twoState, toggle, and chips form controls using native checkbox and radio inputs.
22
+
23
+ ## Example
24
+
25
+ ```html
26
+ <div pgs="flexColumnElements">
27
+ <section pgs="flexColumnTexts">
28
+ <strong>Checkbox with background</strong>
29
+
30
+ <label pgs="checkboxBackground">
31
+ <input type="checkbox" name="notifications" value="enabled">
32
+ <span>
33
+ <strong>Enable notifications</strong><br>
34
+ Receive important account updates.
35
+ </span>
36
+ </label>
37
+ </section>
38
+
39
+ <section pgs="flexColumnTexts">
40
+ <strong>Two-state controls</strong>
41
+
42
+ <label pgs="twoState">
43
+ <input type="checkbox" name="favorite" value="yes">
44
+ <i class="fa-solid fa-star" aria-hidden="true"></i>
45
+ Add to favorites
46
+ </label>
47
+ </section>
48
+
49
+ <section pgs="flexColumnTexts">
50
+ <strong>Toggle</strong>
51
+
52
+ <label pgs="toggle">
53
+ <span>Enable dark mode</span>
54
+ <input type="checkbox" name="darkMode" value="enabled">
55
+ </label>
56
+ </section>
57
+
58
+ <section pgs="flexColumnTexts">
59
+ <strong>Chips</strong>
60
+
61
+ <div pgs="chips" role="group" aria-label="Select a plan">
62
+ <label pgs="twoState">
63
+ <input type="radio" name="plan" value="basic" checked>
64
+ Basic
65
+ </label>
66
+
67
+ <label pgs="twoState">
68
+ <input type="radio" name="plan" value="pro">
69
+ Pro
70
+ </label>
71
+
72
+ <label pgs="twoState">
73
+ <input type="radio" name="plan" value="enterprise">
74
+ Enterprise
75
+ </label>
76
+ </div>
77
+ </section>
78
+ </div>
79
+ ```
@@ -1,36 +1,36 @@
1
- <!-- File generato automaticamente da templates/html/components/logo.html. Modificare templates/html/components/logo.html e rieseguire npm run docs:generate. -->
1
+ <!-- Automatically generated from templates/html/components/logo.html. Edit templates/html/components/logo.html and run npm run docs:generate again. -->
2
2
 
3
3
  # Logo
4
4
 
5
- Componente per mostrare un logo grafico o testuale, con supporto alle varianti dell'immagine legate al tema scuro.
5
+ Component for displaying a graphical or text logo, with image variants that support dark mode.
6
6
 
7
7
  ## PGS
8
8
 
9
- - `logo`: identifica il collegamento contenitore del marchio.
10
- - `logo-image`: identifica l'immagine grafica del logo.
11
- - `logo-text`: identifica la variante testuale del marchio.
9
+ - `logo`: identifies the brand link container.
10
+ - `logo-image`: identifies the graphical logo image.
11
+ - `logo-text`: identifies the text-based brand variant.
12
12
 
13
13
  ## PGS Options
14
14
 
15
- - `logoDarkmode`: inverte l'immagine del logo quando lo stato globale darkmode è attivo.
16
- - `logoDarkmodeFixed`: mantiene applicata l'inversione dell'immagine indipendentemente dal tema corrente.
15
+ - `logoDarkmode`: inverts the logo image when the global darkmode state is active.
16
+ - `logoDarkmodeFixed`: keeps the image inversion enabled regardless of the current theme.
17
17
 
18
18
  ## PGS States
19
19
 
20
- - `darkmode`: stato globale applicato al documento che attiva la variante logoDarkmode.
20
+ - `darkmode`: global document state that activates the logoDarkmode variant.
21
21
 
22
22
  ## Output
23
23
 
24
- Esempi HTML del logo grafico sensibile al tema e del logo testuale.
24
+ HTML examples of the theme-aware graphical logo and the text logo.
25
25
 
26
- ## Esempio
26
+ ## Example
27
27
 
28
28
  ```html
29
29
  <a aria-label="Logo" pgs="logo" pgs-option="logoDarkmode" href="/">
30
30
  <img pgs="logo-image" src="https://placehold.co/240x80?text=MyPGS" alt="MyPGS">
31
31
  </a>
32
32
 
33
- <a aria-label="Logo testuale" pgs="logo" href="/">
33
+ <a aria-label="Text logo" pgs="logo" href="/">
34
34
  <span pgs="logo-text">MyPGS</span>
35
35
  </a>
36
36
  ```
@@ -1,43 +1,43 @@
1
- <!-- File generato automaticamente da templates/html/components/menu.html. Modificare templates/html/components/menu.html e rieseguire npm run docs:generate. -->
1
+ <!-- Automatically generated from templates/html/components/menu.html. Edit templates/html/components/menu.html and run npm run docs:generate again. -->
2
2
 
3
3
  # Menu
4
4
 
5
- Navigazione orizzontale o verticale che trasforma le voci con sottomenu in dropdown accessibili e inizializzati automaticamente.
5
+ Menu markup, configuration, behavior, and usage example.
6
6
 
7
7
  ## PGS
8
8
 
9
- - `menu`: identifica il contenitore di navigazione elaborato dal modulo menu.
10
- - `menu-buttonIcon`: identifica il controllo creato dinamicamente accanto alle voci con sottomenu.
9
+ - `menu`: identifies the menu element used by Menu.
10
+ - `menu-buttonIcon`: identifies the menu-buttonIcon element used by Menu.
11
11
 
12
12
  ## PGS Options
13
13
 
14
- - `horizontal`: dispone il menu e i suoi elementi in orizzontale.
15
- - `vertical`: dispone il menu e i suoi elementi in verticale.
16
- - `menuHeader`: adatta spaziature e comportamento del menu quando è inserito nell'header.
17
- - `position`: viene impostata come position[bottom right] sui dropdown creati per i sottomenu.
14
+ - `horizontal`: identifies the horizontal element used by Menu.
15
+ - `vertical`: identifies the vertical element used by Menu.
16
+ - `menuHeader`: identifies the menuHeader element used by Menu.
17
+ - `position`: identifies the position element used by Menu.
18
18
 
19
19
  ## PGS States
20
20
 
21
- - `open`: indica il sottomenu trasformato in dropdown attualmente aperto.
21
+ - `open`: identifies the open element used by Menu.
22
22
 
23
- ## API JavaScript
23
+ ## JavaScript API
24
24
 
25
- - `pgs.menu.init(root)`: inizializza i menu non ancora registrati dentro Document o Element indicato e prepara i sottomenu.
26
- - `pgs.menu.api(element)`: restituisce l'istanza associata a un root menu inizializzato.
27
- - `instance.refresh()`: riesegue l'inizializzazione nel contenitore del menu e restituisce l'istanza.
25
+ - `pgs.menu.init(root)`: initializes matching elements within the specified root.
26
+ - `pgs.menu.api(element)`: returns the instance associated with the specified initialized element.
27
+ - `instance.refresh()`: refreshes the component and returns its updated instance.
28
28
 
29
- ## Elementi correlati
29
+ ## Related elements
30
30
 
31
- - `dropdown`: viene aggiunto dinamicamente alle voci che contengono una lista annidata.
32
- - `dropdown-button`: identifica il controllo dinamico del sottomenu.
33
- - `buttonNohover`: neutralizza lo stile hover del controllo dinamico.
34
- - `dropdown-content`: identifica la lista annidata mostrata come pannello dropdown.
31
+ - `dropdown`: uses the related dropdown component or utility in this example.
32
+ - `dropdown-button`: uses the related dropdown-button component or utility in this example.
33
+ - `buttonNohover`: uses the related buttonNohover component or utility in this example.
34
+ - `dropdown-content`: uses the related dropdown-content component or utility in this example.
35
35
 
36
36
  ## Output
37
37
 
38
- Due strutture nav complete per le varianti orizzontale e verticale del menu.
38
+ Complete HTML markup and usage example for Menu.
39
39
 
40
- ## Esempio
40
+ ## Example
41
41
 
42
42
  ```html
43
43
  <nav pgs="menu" pgs-option="horizontal" aria-label="Menu orizzontale">
@@ -1,68 +1,68 @@
1
- <!-- File generato automaticamente da templates/html/components/modal.html. Modificare templates/html/components/modal.html e rieseguire npm run docs:generate. -->
1
+ <!-- Automatically generated from templates/html/components/modal.html. Edit templates/html/components/modal.html and run npm run docs:generate again. -->
2
2
 
3
3
  # Modal
4
4
 
5
- Componente che collega un pulsante a un dialog nativo, ne gestisce apertura e chiusura e può spostarlo in un contenitore configurato.
5
+ Modal markup, configuration, behavior, and usage example.
6
6
 
7
7
  ## PGS
8
8
 
9
- - `modal`: identifica il contenitore logico inizializzato dal modulo modal.
10
- - `modal-button`: identifica il controllo di apertura della finestra.
9
+ - `modal`: identifies the modal element used by Modal.
10
+ - `modal-button`: identifies the modal-button element used by Modal.
11
11
  - `dialog`: token aggiunto dinamicamente all'elemento dialog inizializzato.
12
- - `modal-dialog`: identifica il dialog nativo dopo l'inizializzazione JavaScript.
13
- - `modal-dialog-content`: identifica il contenitore visivo della finestra.
14
- - `modal-dialog-content-header`: identifica l'intestazione che può ricevere il pulsante di chiusura automatico.
15
- - `modal-dialog-content-scroll`: identifica l'area interna scorrevole.
16
- - `modal-close`: identifica un controllo che chiude la finestra.
12
+ - `modal-dialog`: identifies the modal-dialog element used by Modal.
13
+ - `modal-dialog-content`: identifies the modal-dialog-content element used by Modal.
14
+ - `modal-dialog-content-header`: identifies the modal-dialog-content-header element used by Modal.
15
+ - `modal-dialog-content-scroll`: identifies the modal-dialog-content-scroll element used by Modal.
16
+ - `modal-close`: identifies the modal-close element used by Modal.
17
17
 
18
18
  ## PGS Options
19
19
 
20
- - `containerID`: sul root usa containerID[id] per spostare il dialog nell'elemento con l'id indicato.
21
- - `containerPGS`: sul root usa containerPGS[token] per spostare il dialog nel primo elemento con quel token pgs.
22
- - `disableBackdropClose`: sul root impedisce la chiusura tramite click sul backdrop.
23
- - `history`: sul root sincronizza l'apertura con il parametro modal nella cronologia del browser e richiede un id sul pulsante.
24
- - `topLevel`: sul dialog mantiene la finestra nel componente e usa showModal per una modale top-level.
25
- - `left`: sul dialog posiziona e anima il contenuto dal lato sinistro.
26
- - `right`: sul dialog posiziona e anima il contenuto dal lato destro.
20
+ - `containerID`: identifies the containerID element used by Modal.
21
+ - `containerPGS`: identifies the containerPGS element used by Modal.
22
+ - `disableBackdropClose`: identifies the disableBackdropClose element used by Modal.
23
+ - `history`: identifies the history element used by Modal.
24
+ - `topLevel`: identifies the topLevel element used by Modal.
25
+ - `left`: identifies the left element used by Modal.
26
+ - `right`: identifies the right element used by Modal.
27
27
 
28
- ## API JavaScript
28
+ ## JavaScript API
29
29
 
30
- - `pgs.modal.init(root)`: inizializza le modali presenti nel Document o Element indicato; il valore predefinito è document.
31
- - `pgs.modal.api(element)`: restituisce l'istanza associata a un root modal inizializzato.
32
- - `instance.open()`: apre la finestra se non è già aperta.
33
- - `instance.close()`: chiude la finestra se è aperta.
34
- - `instance.toggle()`: apre la finestra oppure la chiude quando è già aperta.
35
- - `instance.refresh()`: rilegge opzioni e collegamenti della modale, sostituisce listener e observer precedenti e restituisce la nuova API.
36
- - `instance.isOpen()`: restituisce true quando l'elemento dialog possiede lo stato nativo open.
30
+ - `pgs.modal.init(root)`: initializes matching elements within the specified root.
31
+ - `pgs.modal.api(element)`: returns the instance associated with the specified initialized element.
32
+ - `instance.open()`: opens the component.
33
+ - `instance.close()`: closes the component.
34
+ - `instance.toggle()`: toggles the component state.
35
+ - `instance.refresh()`: refreshes the component and returns its updated instance.
36
+ - `instance.isOpen()`: returns true when the component is open.
37
37
 
38
- ## Elementi correlati
38
+ ## Related elements
39
39
 
40
- - `button`: presenta i controlli di apertura, chiusura e annullamento come pulsanti standard.
41
- - `buttonStrong`: presenta l'azione di conferma con maggiore enfasi.
42
- - `buttonClose`: viene aggiunto automaticamente al controllo di chiusura quando manca nel markup.
43
- - `flexColumnElements`: organizza verticalmente il contenuto della modale di conferma.
44
- - `flexRow`: dispone affiancate le azioni della modale di conferma.
40
+ - `button`: uses the related button component or utility in this example.
41
+ - `buttonStrong`: uses the related buttonStrong component or utility in this example.
42
+ - `buttonClose`: uses the related buttonClose component or utility in this example.
43
+ - `flexColumnElements`: uses the related flexColumnElements component or utility in this example.
44
+ - `flexRow`: uses the related flexRow component or utility in this example.
45
45
 
46
46
  ## Output
47
47
 
48
- Quattro esempi basati su dialog nativo e un contenitore opzionale usato da containerID.
48
+ Complete HTML markup and usage example for Modal.
49
49
 
50
- ## Esempio
50
+ ## Example
51
51
 
52
52
  ```html
53
53
  <div pgs="modal" pgs-option="containerID[modal-container]">
54
54
  <button pgs="modal-button button" type="button">
55
- <i class="fa-solid fa-window-maximize"></i> Apri modale
55
+ <i class="fa-solid fa-window-maximize"></i> Open modal
56
56
  </button>
57
57
 
58
58
  <dialog>
59
59
  <div pgs="modal-dialog-content">
60
60
  <div pgs="modal-dialog-content-header">
61
- <h3>Modale di esempio</h3>
61
+ <h3>Example modal</h3>
62
62
  </div>
63
63
 
64
64
  <div pgs="modal-dialog-content-scroll">
65
- <p>Contenuto della modale. Il bottone di chiusura viene aggiunto automaticamente se non presente.</p>
65
+ <p>Modal content. The close button is added automatically when missing.</p>
66
66
  </div>
67
67
  </div>
68
68
  </dialog>
@@ -70,17 +70,17 @@ Quattro esempi basati su dialog nativo e un contenitore opzionale usato da conta
70
70
 
71
71
  <div pgs="modal" pgs-option="containerID[modal-container]">
72
72
  <button pgs="modal-button button" type="button">
73
- <i class="fa-solid fa-window-maximize"></i> Apri modale right
73
+ <i class="fa-solid fa-window-maximize"></i> Open modal right
74
74
  </button>
75
75
 
76
76
  <dialog pgs-option="right">
77
77
  <div pgs="modal-dialog-content">
78
78
  <div pgs="modal-dialog-content-header">
79
- <h3>Modale laterale</h3>
79
+ <h3>Side modal</h3>
80
80
  </div>
81
81
 
82
82
  <div pgs="modal-dialog-content-scroll">
83
- <p>Contenuto della modale con <code>pgs-option="right"</code>.</p>
83
+ <p>Modal content with <code>pgs-option="right"</code>.</p>
84
84
  </div>
85
85
  </div>
86
86
  </dialog>
@@ -88,17 +88,17 @@ Quattro esempi basati su dialog nativo e un contenitore opzionale usato da conta
88
88
 
89
89
  <div pgs="modal" pgs-option="containerID[modal-container]">
90
90
  <button pgs="modal-button button" type="button">
91
- <i class="fa-solid fa-window-maximize"></i> Apri modale left
91
+ <i class="fa-solid fa-window-maximize"></i> Open modal left
92
92
  </button>
93
93
 
94
94
  <dialog pgs-option="left">
95
95
  <div pgs="modal-dialog-content">
96
96
  <div pgs="modal-dialog-content-header">
97
- <h3>Modale laterale sinistra</h3>
97
+ <h3>Left-side modal</h3>
98
98
  </div>
99
99
 
100
100
  <div pgs="modal-dialog-content-scroll">
101
- <p>Contenuto della modale con <code>pgs-option="left"</code>.</p>
101
+ <p>Modal content with <code>pgs-option="left"</code>.</p>
102
102
  </div>
103
103
  </div>
104
104
  </dialog>
@@ -106,21 +106,21 @@ Quattro esempi basati su dialog nativo e un contenitore opzionale usato da conta
106
106
 
107
107
  <div pgs="modal">
108
108
  <button pgs="modal-button button" type="button">
109
- <i class="fa-solid fa-floppy-disk"></i> Conferma salvataggio
109
+ <i class="fa-solid fa-floppy-disk"></i> Confirmation salvataggio
110
110
  </button>
111
111
 
112
112
  <dialog pgs-option="topLevel">
113
113
  <div pgs="modal-dialog-content">
114
114
  <div pgs="modal-dialog-content-header">
115
- <h3>Salvare le modifiche?</h3>
115
+ <h3>Save changes?</h3>
116
116
  </div>
117
117
 
118
118
  <div pgs="modal-dialog-content-scroll flexColumnElements">
119
- <p>Hai modifiche non salvate. Conferma per applicarle oppure annulla per tornare alla pagina.</p>
119
+ <p>You have unsaved changes. Confirm to apply them or cancel to return to the page.</p>
120
120
 
121
121
  <div pgs="flexRow">
122
- <button pgs="button modal-close" type="button">Annulla</button>
123
- <button pgs="buttonStrong" type="button">Salva modifiche</button>
122
+ <button pgs="button modal-close" type="button">Cancel</button>
123
+ <button pgs="buttonStrong" type="button">Save changes</button>
124
124
  </div>
125
125
  </div>
126
126
  </div>