mypgs 1.6.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 (125) hide show
  1. package/AGENTS.md +2 -2
  2. package/README.md +25 -25
  3. package/assets/javascript/components/_accordion.js +2 -2
  4. package/assets/javascript/components/_modals.js +159 -136
  5. package/assets/javascript/components/_notifications.js +19 -9
  6. package/assets/javascript/components/_search.js +2 -2
  7. package/assets/javascript/components/_slides.js +66 -32
  8. package/assets/javascript/components/_stepTabs.js +4 -4
  9. package/assets/javascript/components/_steps.js +2 -2
  10. package/assets/javascript/components/_summary.js +2 -2
  11. package/assets/javascript/functions/_formValidate.js +97 -53
  12. package/assets/javascript/functions/_scrollY.js +10 -10
  13. package/assets/javascript/layout/_header.js +3 -0
  14. package/assets/scss/base/_html.scss +2 -2
  15. package/assets/scss/base/_variables.scss +2 -2
  16. package/assets/scss/components/_accordion.scss +0 -2
  17. package/assets/scss/components/_button.scss +1 -1
  18. package/assets/scss/components/_form.scss +2 -18
  19. package/assets/scss/components/_formAddon.scss +18 -0
  20. package/assets/scss/components/_modals.scss +5 -3
  21. package/assets/scss/components/_notification.scss +23 -30
  22. package/assets/scss/components/_search.scss +29 -23
  23. package/assets/scss/components/_slides.scss +0 -1
  24. package/assets/scss/components/_tooltip.scss +0 -1
  25. package/assets/scss/index.scss +1 -0
  26. package/assets/scss/layout/_footer.scss +0 -2
  27. package/assets/scss/layout/_header.scss +9 -1
  28. package/assets/scss/layout/_pageShell.scss +24 -17
  29. package/assets/scss/mixin/_mx-button.scss +30 -76
  30. package/assets/scss/mixin/_mx-card.scss +11 -9
  31. package/assets/scss/mixin/_mx-form.scss +10 -12
  32. package/assets/scss/mixin/{_mx-form-addon.scss → _mx-formAddon.scss} +23 -26
  33. package/assets/scss/mixin/_mx-hover.scss +75 -0
  34. package/assets/scss/mixin/_settings.scss +2 -1
  35. package/assets/scss/mixin/mixin.scss +2 -1
  36. package/{templates/html → demo}/demo.html +1 -1
  37. package/demo/demo.js +241 -0
  38. package/dist/css/index.css +1317 -1674
  39. package/dist/css/index.css.map +1 -1
  40. package/dist/css/index.min.css +1 -1
  41. package/dist/javascript/index.js +356 -255
  42. package/dist/javascript/index.js.map +1 -1
  43. package/dist/javascript/index.min.js +1 -1
  44. package/docs/componenti-e-markup.md +32 -32
  45. package/docs/components/accordion.md +61 -0
  46. package/docs/components/badges.md +67 -0
  47. package/docs/components/breadcumbs.md +43 -0
  48. package/docs/components/button.md +59 -0
  49. package/docs/components/card.md +50 -0
  50. package/docs/components/dropdown.md +135 -0
  51. package/docs/components/form.md +136 -0
  52. package/docs/components/formAddon.md +79 -0
  53. package/docs/components/logo.md +36 -0
  54. package/docs/components/menu.md +90 -0
  55. package/docs/components/modal.md +131 -0
  56. package/docs/components/notification.md +81 -0
  57. package/docs/components/search.md +118 -0
  58. package/docs/components/slides.md +85 -0
  59. package/docs/components/stepTabs.md +93 -0
  60. package/docs/components/steps.md +56 -0
  61. package/docs/components/summary.md +49 -0
  62. package/docs/components/table.md +42 -0
  63. package/docs/components/tooltip.md +53 -0
  64. package/docs/convenzioni.md +11 -11
  65. package/docs/export-e-sviluppo.md +3 -3
  66. package/docs/helper-javascript.md +73 -8
  67. package/docs/layout/body.md +41 -0
  68. package/docs/layout/flex.md +116 -0
  69. package/docs/layout/footer.md +71 -0
  70. package/docs/layout/grid.md +116 -0
  71. package/docs/layout/header.md +116 -0
  72. package/docs/layout/pageShell.md +94 -0
  73. package/docs/layout/section.md +69 -0
  74. package/docs/patterns/cookieConsent.md +89 -0
  75. package/docs/utilizzo-css-scss.md +8 -8
  76. package/package.json +2 -1
  77. package/scripts/generate-component-docs.js +557 -0
  78. package/templates/html/components/accordion.html +36 -7
  79. package/templates/html/components/badges.html +28 -5
  80. package/templates/html/components/breadcumbs.html +15 -1
  81. package/templates/html/components/button.html +28 -6
  82. package/templates/html/components/card.html +28 -8
  83. package/templates/html/components/dropdown.html +42 -8
  84. package/templates/html/components/form.html +110 -9
  85. package/templates/html/components/formAddon.html +72 -0
  86. package/templates/html/components/logo.html +22 -1
  87. package/templates/html/components/menu.html +33 -6
  88. package/templates/html/components/modal.html +58 -14
  89. package/templates/html/components/notification.html +68 -32
  90. package/templates/html/components/search.html +85 -8
  91. package/templates/html/components/slides.html +46 -3
  92. package/templates/html/components/stepTabs.html +55 -8
  93. package/templates/html/components/steps.html +24 -0
  94. package/templates/html/components/summary.html +30 -3
  95. package/templates/html/components/table.html +14 -2
  96. package/templates/html/components/tooltip.html +35 -0
  97. package/templates/html/layout/body.html +20 -6
  98. package/templates/html/layout/flex.html +53 -33
  99. package/templates/html/layout/footer.html +32 -4
  100. package/templates/html/layout/grid.html +53 -33
  101. package/templates/html/layout/header.html +47 -6
  102. package/templates/html/layout/pageShell.html +19 -0
  103. package/templates/html/layout/section.html +41 -19
  104. package/templates/html/patterns/cookieConsent.html +44 -13
  105. package/templates/react/components/accordion.jsx +4 -4
  106. package/templates/react/components/breadcumbs.jsx +1 -1
  107. package/templates/react/components/button.jsx +5 -5
  108. package/templates/react/components/card.jsx +4 -4
  109. package/templates/react/components/dropdown.jsx +8 -8
  110. package/templates/react/components/form.jsx +5 -5
  111. package/templates/react/components/modal.jsx +14 -14
  112. package/templates/react/components/notification.jsx +7 -7
  113. package/templates/react/components/search.jsx +5 -5
  114. package/templates/react/components/slides.jsx +3 -3
  115. package/templates/react/components/stepTabs.jsx +8 -8
  116. package/templates/react/components/summary.jsx +3 -3
  117. package/templates/react/components/table.jsx +2 -2
  118. package/templates/react/layout/flex.jsx +8 -8
  119. package/templates/react/layout/grid.jsx +8 -8
  120. package/templates/react/layout/section.jsx +12 -12
  121. package/templates/react/patterns/cookieConsent.jsx +8 -8
  122. package/templates/react/patterns/footer.jsx +4 -4
  123. package/templates/react/patterns/header.jsx +3 -3
  124. package/templates/html/demo.js +0 -130
  125. /package/{templates/html → demo}/demo.css +0 -0
@@ -0,0 +1,135 @@
1
+ <!-- Automatically generated from templates/html/components/dropdown.html. Edit templates/html/components/dropdown.html and run npm run docs:generate again. -->
2
+
3
+ # Dropdown
4
+
5
+ Popup component that connects a control to content positioned relative to its trigger and handles opening, closing, outside clicks, and Escape.
6
+
7
+ ## PGS
8
+
9
+ - `dropdown`: identifies the container initialized by the dropdown module.
10
+ - `dropdown-button`: identifies the control that opens or closes the content.
11
+ - `dropdown-content`: identifies the panel positioned relative to the control.
12
+
13
+ ## PGS Options
14
+
15
+ - `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.
16
+ - `buttonReverse`: reverses text and icon on the example buttons and belongs to the button component.
17
+
18
+ ## PGS States
19
+
20
+ - `open`: indicates that the dropdown is open and its content is visible.
21
+
22
+ ## JavaScript API
23
+
24
+ - `pgs.dropdown.init(root)`: initializes unregistered dropdowns within the specified Document or Element.
25
+ - `pgs.dropdown.api(element)`: returns the instance associated with an initialized dropdown root.
26
+ - `instance.open()`: opens the dropdown and closes any other open dropdowns.
27
+ - `instance.close()`: closes the current dropdown.
28
+ - `instance.toggle()`: toggles between the open and closed states.
29
+ - `instance.refresh()`: reinitializes the context and recalculates content positioning.
30
+ - `instance.isOpen()`: returns true when the dropdown is open.
31
+
32
+ ## Related elements
33
+
34
+ - `flexRow`: arranges the placement examples on the same flexible row.
35
+ - `button`: applies standard styling to dropdown controls.
36
+
37
+ ## Output
38
+
39
+ Series of HTML dropdowns demonstrating the supported placement directions.
40
+
41
+ ## Example
42
+
43
+ ```html
44
+ <div pgs="flexRow">
45
+
46
+ <span pgs="dropdown">
47
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
48
+ Bottom center
49
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
50
+ </button>
51
+
52
+ <div pgs="dropdown-content">
53
+ bottom center content
54
+ </div>
55
+ </span>
56
+
57
+ <span pgs="dropdown" pgs-option="position[top left]">
58
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
59
+ Top left
60
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
61
+ </button>
62
+
63
+ <div pgs="dropdown-content">
64
+ top left content
65
+ </div>
66
+ </span>
67
+
68
+ <span pgs="dropdown" pgs-option="position[top center]">
69
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
70
+ Top center
71
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
72
+ </button>
73
+
74
+ <div pgs="dropdown-content">
75
+ top center content
76
+ </div>
77
+ </span>
78
+
79
+ <span pgs="dropdown" pgs-option="position[top right]">
80
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
81
+ Top right
82
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
83
+ </button>
84
+
85
+ <div pgs="dropdown-content">
86
+ top right content
87
+ </div>
88
+ </span>
89
+
90
+ <span pgs="dropdown" pgs-option="position[bottom left]">
91
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
92
+ Bottom left
93
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
94
+ </button>
95
+
96
+ <div pgs="dropdown-content">
97
+ bottom left content
98
+ </div>
99
+ </span>
100
+
101
+ <span pgs="dropdown" pgs-option="position[bottom right]">
102
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
103
+ Bottom right
104
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
105
+ </button>
106
+
107
+ <div pgs="dropdown-content">
108
+ bottom right content
109
+ </div>
110
+ </span>
111
+
112
+ <span pgs="dropdown" pgs-option="position[left center]">
113
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
114
+ Left center
115
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
116
+ </button>
117
+
118
+ <div pgs="dropdown-content">
119
+ left center content
120
+ </div>
121
+ </span>
122
+
123
+ <span pgs="dropdown" pgs-option="position[right center]">
124
+ <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
125
+ Right center
126
+ <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
127
+ </button>
128
+
129
+ <div pgs="dropdown-content">
130
+ right center content
131
+ </div>
132
+ </span>
133
+
134
+ </div>
135
+ ```
@@ -0,0 +1,136 @@
1
+ <!-- Automatically generated from templates/html/components/form.html. Edit templates/html/components/form.html and run npm run docs:generate again. -->
2
+
3
+ # Form
4
+
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
+
7
+ ## PGS
8
+
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
+
16
+ ## PGS Options
17
+
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
+
22
+ ## JavaScript API
23
+
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
+
32
+ ## Related elements
33
+
34
+ - `buttonStrong`: presents form submission as the primary action.
35
+ - `flexColumnTexts`: spaces text elements in the radio group.
36
+
37
+ ## Output
38
+
39
+ Complete HTML form with required fields and an example script for a custom rule, validation, and a success message.
40
+
41
+ ## Example
42
+
43
+ ```html
44
+ <form pgs="form formValidate" action="#" method="post">
45
+ <label pgs="label" for="form-name">
46
+ Name
47
+ </label>
48
+ <input id="form-name" pgs="input" pgs-option="message[Enter your name]" type="text" name="name" placeholder="John Smith" required>
49
+
50
+ <label pgs="label" for="form-email">
51
+ Email
52
+ </label>
53
+ <input id="form-email" pgs="input" pgs-option="message[Enter a valid email address]" type="email" name="email" placeholder="name@example.com" required>
54
+
55
+ <label pgs="label" for="form-password">
56
+ Password
57
+ </label>
58
+ <input id="form-password" pgs="input" pgs-option="message[Enter a password]" type="password" name="password" autocomplete="new-password" required>
59
+
60
+ <label pgs="label" for="form-confirm-password">
61
+ Confirm password
62
+ </label>
63
+ <input id="form-confirm-password" pgs="input" pgs-option="message[Confirm your password]" type="password" name="confirmPassword" autocomplete="new-password" required>
64
+
65
+ <label pgs="label" for="form-message">
66
+ Message
67
+ </label>
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>
92
+ <input type="checkbox" name="privacy" required>
93
+ <span>I accept the privacy policy</span>
94
+ </label>
95
+ <br>
96
+
97
+ <button pgs="buttonStrong" type="submit">
98
+ <i class="fa-solid fa-paper-plane" aria-hidden="true"></i>
99
+ Submit
100
+ </button>
101
+ </form>
102
+
103
+ <script type="module">
104
+ import { pgs } from "mypgs";
105
+
106
+ const form = pgs(document).querySelector("form");
107
+
108
+ const password = form.querySelector('input[name="password"]');
109
+ const confirmPassword = form.querySelector('input[name="confirmPassword"]');
110
+ if (!password || !confirmPassword) return;
111
+
112
+ const formValidate = new pgs.formValidate(form, {
113
+ message: {
114
+ fieldError: "Please complete this field",
115
+ fieldsError: "Please complete all required fields",
116
+ success: "Submitted successfully"
117
+ }
118
+ });
119
+
120
+ //== new roules
121
+ formValidate.addNewRule(() => {
122
+ if (password.value && confirmPassword.value && password.value !== confirmPassword.value) {
123
+ pgs(confirmPassword).option.setValueBrackets("message", "Passwords do not match");
124
+ return [confirmPassword, password];
125
+ }
126
+ });
127
+
128
+ //== validate
129
+ formValidate.validator(event => {
130
+ const values = Object.fromEntries(new FormData(form));
131
+
132
+ // Replace this log with a request to your backend.
133
+ console.log(values);
134
+ }, "submit");
135
+ </script>
136
+ ```
@@ -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
+ ```
@@ -0,0 +1,36 @@
1
+ <!-- Automatically generated from templates/html/components/logo.html. Edit templates/html/components/logo.html and run npm run docs:generate again. -->
2
+
3
+ # Logo
4
+
5
+ Component for displaying a graphical or text logo, with image variants that support dark mode.
6
+
7
+ ## PGS
8
+
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
+
13
+ ## PGS Options
14
+
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
+
18
+ ## PGS States
19
+
20
+ - `darkmode`: global document state that activates the logoDarkmode variant.
21
+
22
+ ## Output
23
+
24
+ HTML examples of the theme-aware graphical logo and the text logo.
25
+
26
+ ## Example
27
+
28
+ ```html
29
+ <a aria-label="Logo" pgs="logo" pgs-option="logoDarkmode" href="/">
30
+ <img pgs="logo-image" src="https://placehold.co/240x80?text=MyPGS" alt="MyPGS">
31
+ </a>
32
+
33
+ <a aria-label="Text logo" pgs="logo" href="/">
34
+ <span pgs="logo-text">MyPGS</span>
35
+ </a>
36
+ ```
@@ -0,0 +1,90 @@
1
+ <!-- Automatically generated from templates/html/components/menu.html. Edit templates/html/components/menu.html and run npm run docs:generate again. -->
2
+
3
+ # Menu
4
+
5
+ Menu markup, configuration, behavior, and usage example.
6
+
7
+ ## PGS
8
+
9
+ - `menu`: identifies the menu element used by Menu.
10
+ - `menu-buttonIcon`: identifies the menu-buttonIcon element used by Menu.
11
+
12
+ ## PGS Options
13
+
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
+
19
+ ## PGS States
20
+
21
+ - `open`: identifies the open element used by Menu.
22
+
23
+ ## JavaScript API
24
+
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
+
29
+ ## Related elements
30
+
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
+
36
+ ## Output
37
+
38
+ Complete HTML markup and usage example for Menu.
39
+
40
+ ## Example
41
+
42
+ ```html
43
+ <nav pgs="menu" pgs-option="horizontal" aria-label="Menu orizzontale">
44
+ <ul>
45
+ <li>
46
+ <a href="/" aria-current="page">
47
+ <i class="fa-solid fa-house" aria-hidden="true"></i>
48
+ <span>Home</span>
49
+ </a>
50
+ </li>
51
+ <li>
52
+ <a href="/servizi">
53
+ <i class="fa-solid fa-layer-group" aria-hidden="true"></i>
54
+ <span>Servizi</span>
55
+ </a>
56
+ <ul>
57
+ <li><a href="/servizi/uno">Servizio uno</a></li>
58
+ <li><a href="/servizi/due">Servizio due</a></li>
59
+ </ul>
60
+ </li>
61
+ </ul>
62
+ </nav>
63
+
64
+ <nav pgs="menu" pgs-option="vertical" aria-label="Menu verticale">
65
+ <ul>
66
+ <li>
67
+ <a href="/" aria-current="page">
68
+ <i class="fa-solid fa-house" aria-hidden="true"></i>
69
+ <span>Home</span>
70
+ </a>
71
+ </li>
72
+ <li>
73
+ <a href="/servizi">
74
+ <i class="fa-solid fa-layer-group" aria-hidden="true"></i>
75
+ <span>Servizi</span>
76
+ </a>
77
+ <ul>
78
+ <li><a href="/servizi/uno">Servizio uno</a></li>
79
+ <li><a href="/servizi/due">Servizio due</a></li>
80
+ </ul>
81
+ </li>
82
+ <li>
83
+ <a href="/about">
84
+ <i class="fa-solid fa-info-circle" aria-hidden="true"></i>
85
+ <span>about</span>
86
+ </a>
87
+ </li>
88
+ </ul>
89
+ </nav>
90
+ ```
@@ -0,0 +1,131 @@
1
+ <!-- Automatically generated from templates/html/components/modal.html. Edit templates/html/components/modal.html and run npm run docs:generate again. -->
2
+
3
+ # Modal
4
+
5
+ Modal markup, configuration, behavior, and usage example.
6
+
7
+ ## PGS
8
+
9
+ - `modal`: identifies the modal element used by Modal.
10
+ - `modal-button`: identifies the modal-button element used by Modal.
11
+ - `dialog`: token aggiunto dinamicamente all'elemento dialog inizializzato.
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
+
18
+ ## PGS Options
19
+
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
+
28
+ ## JavaScript API
29
+
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
+
38
+ ## Related elements
39
+
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
+
46
+ ## Output
47
+
48
+ Complete HTML markup and usage example for Modal.
49
+
50
+ ## Example
51
+
52
+ ```html
53
+ <div pgs="modal" pgs-option="containerID[modal-container]">
54
+ <button pgs="modal-button button" type="button">
55
+ <i class="fa-solid fa-window-maximize"></i> Open modal
56
+ </button>
57
+
58
+ <dialog>
59
+ <div pgs="modal-dialog-content">
60
+ <div pgs="modal-dialog-content-header">
61
+ <h3>Example modal</h3>
62
+ </div>
63
+
64
+ <div pgs="modal-dialog-content-scroll">
65
+ <p>Modal content. The close button is added automatically when missing.</p>
66
+ </div>
67
+ </div>
68
+ </dialog>
69
+ </div>
70
+
71
+ <div pgs="modal" pgs-option="containerID[modal-container]">
72
+ <button pgs="modal-button button" type="button">
73
+ <i class="fa-solid fa-window-maximize"></i> Open modal right
74
+ </button>
75
+
76
+ <dialog pgs-option="right">
77
+ <div pgs="modal-dialog-content">
78
+ <div pgs="modal-dialog-content-header">
79
+ <h3>Side modal</h3>
80
+ </div>
81
+
82
+ <div pgs="modal-dialog-content-scroll">
83
+ <p>Modal content with <code>pgs-option="right"</code>.</p>
84
+ </div>
85
+ </div>
86
+ </dialog>
87
+ </div>
88
+
89
+ <div pgs="modal" pgs-option="containerID[modal-container]">
90
+ <button pgs="modal-button button" type="button">
91
+ <i class="fa-solid fa-window-maximize"></i> Open modal left
92
+ </button>
93
+
94
+ <dialog pgs-option="left">
95
+ <div pgs="modal-dialog-content">
96
+ <div pgs="modal-dialog-content-header">
97
+ <h3>Left-side modal</h3>
98
+ </div>
99
+
100
+ <div pgs="modal-dialog-content-scroll">
101
+ <p>Modal content with <code>pgs-option="left"</code>.</p>
102
+ </div>
103
+ </div>
104
+ </dialog>
105
+ </div>
106
+
107
+ <div pgs="modal">
108
+ <button pgs="modal-button button" type="button">
109
+ <i class="fa-solid fa-floppy-disk"></i> Confirmation salvataggio
110
+ </button>
111
+
112
+ <dialog pgs-option="topLevel">
113
+ <div pgs="modal-dialog-content">
114
+ <div pgs="modal-dialog-content-header">
115
+ <h3>Save changes?</h3>
116
+ </div>
117
+
118
+ <div pgs="modal-dialog-content-scroll flexColumnElements">
119
+ <p>You have unsaved changes. Confirm to apply them or cancel to return to the page.</p>
120
+
121
+ <div pgs="flexRow">
122
+ <button pgs="button modal-close" type="button">Cancel</button>
123
+ <button pgs="buttonStrong" type="button">Save changes</button>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ </dialog>
128
+ </div>
129
+
130
+ <div id="modal-container"></div>
131
+ ```