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.
- package/AGENTS.md +2 -2
- package/README.md +25 -25
- package/assets/javascript/components/_accordion.js +2 -2
- package/assets/javascript/components/_modals.js +159 -136
- package/assets/javascript/components/_notifications.js +19 -9
- package/assets/javascript/components/_search.js +2 -2
- package/assets/javascript/components/_slides.js +66 -32
- package/assets/javascript/components/_stepTabs.js +4 -4
- package/assets/javascript/components/_steps.js +2 -2
- package/assets/javascript/components/_summary.js +2 -2
- package/assets/javascript/functions/_formValidate.js +97 -53
- package/assets/javascript/functions/_scrollY.js +10 -10
- package/assets/javascript/layout/_header.js +3 -0
- package/assets/scss/base/_html.scss +2 -2
- package/assets/scss/base/_variables.scss +2 -2
- package/assets/scss/components/_accordion.scss +0 -2
- package/assets/scss/components/_button.scss +1 -1
- package/assets/scss/components/_form.scss +2 -18
- package/assets/scss/components/_formAddon.scss +18 -0
- package/assets/scss/components/_modals.scss +5 -3
- package/assets/scss/components/_notification.scss +23 -30
- package/assets/scss/components/_search.scss +29 -23
- package/assets/scss/components/_slides.scss +0 -1
- package/assets/scss/components/_tooltip.scss +0 -1
- package/assets/scss/index.scss +1 -0
- package/assets/scss/layout/_footer.scss +0 -2
- package/assets/scss/layout/_header.scss +9 -1
- package/assets/scss/layout/_pageShell.scss +24 -17
- package/assets/scss/mixin/_mx-button.scss +30 -76
- package/assets/scss/mixin/_mx-card.scss +11 -9
- package/assets/scss/mixin/_mx-form.scss +10 -12
- package/assets/scss/mixin/{_mx-form-addon.scss → _mx-formAddon.scss} +23 -26
- package/assets/scss/mixin/_mx-hover.scss +75 -0
- package/assets/scss/mixin/_settings.scss +2 -1
- package/assets/scss/mixin/mixin.scss +2 -1
- package/{templates/html → demo}/demo.html +1 -1
- package/demo/demo.js +241 -0
- package/dist/css/index.css +1317 -1674
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/javascript/index.js +356 -255
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/index.min.js +1 -1
- package/docs/componenti-e-markup.md +32 -32
- package/docs/components/accordion.md +61 -0
- package/docs/components/badges.md +67 -0
- package/docs/components/breadcumbs.md +43 -0
- package/docs/components/button.md +59 -0
- package/docs/components/card.md +50 -0
- package/docs/components/dropdown.md +135 -0
- package/docs/components/form.md +136 -0
- package/docs/components/formAddon.md +79 -0
- package/docs/components/logo.md +36 -0
- package/docs/components/menu.md +90 -0
- package/docs/components/modal.md +131 -0
- package/docs/components/notification.md +81 -0
- package/docs/components/search.md +118 -0
- package/docs/components/slides.md +85 -0
- package/docs/components/stepTabs.md +93 -0
- package/docs/components/steps.md +56 -0
- package/docs/components/summary.md +49 -0
- package/docs/components/table.md +42 -0
- package/docs/components/tooltip.md +53 -0
- package/docs/convenzioni.md +11 -11
- package/docs/export-e-sviluppo.md +3 -3
- package/docs/helper-javascript.md +73 -8
- package/docs/layout/body.md +41 -0
- package/docs/layout/flex.md +116 -0
- package/docs/layout/footer.md +71 -0
- package/docs/layout/grid.md +116 -0
- package/docs/layout/header.md +116 -0
- package/docs/layout/pageShell.md +94 -0
- package/docs/layout/section.md +69 -0
- package/docs/patterns/cookieConsent.md +89 -0
- package/docs/utilizzo-css-scss.md +8 -8
- package/package.json +2 -1
- package/scripts/generate-component-docs.js +557 -0
- package/templates/html/components/accordion.html +36 -7
- package/templates/html/components/badges.html +28 -5
- package/templates/html/components/breadcumbs.html +15 -1
- package/templates/html/components/button.html +28 -6
- package/templates/html/components/card.html +28 -8
- package/templates/html/components/dropdown.html +42 -8
- package/templates/html/components/form.html +110 -9
- package/templates/html/components/formAddon.html +72 -0
- package/templates/html/components/logo.html +22 -1
- package/templates/html/components/menu.html +33 -6
- package/templates/html/components/modal.html +58 -14
- package/templates/html/components/notification.html +68 -32
- package/templates/html/components/search.html +85 -8
- package/templates/html/components/slides.html +46 -3
- package/templates/html/components/stepTabs.html +55 -8
- package/templates/html/components/steps.html +24 -0
- package/templates/html/components/summary.html +30 -3
- package/templates/html/components/table.html +14 -2
- package/templates/html/components/tooltip.html +35 -0
- package/templates/html/layout/body.html +20 -6
- package/templates/html/layout/flex.html +53 -33
- package/templates/html/layout/footer.html +32 -4
- package/templates/html/layout/grid.html +53 -33
- package/templates/html/layout/header.html +47 -6
- package/templates/html/layout/pageShell.html +19 -0
- package/templates/html/layout/section.html +41 -19
- package/templates/html/patterns/cookieConsent.html +44 -13
- package/templates/react/components/accordion.jsx +4 -4
- package/templates/react/components/breadcumbs.jsx +1 -1
- package/templates/react/components/button.jsx +5 -5
- package/templates/react/components/card.jsx +4 -4
- package/templates/react/components/dropdown.jsx +8 -8
- package/templates/react/components/form.jsx +5 -5
- package/templates/react/components/modal.jsx +14 -14
- package/templates/react/components/notification.jsx +7 -7
- package/templates/react/components/search.jsx +5 -5
- package/templates/react/components/slides.jsx +3 -3
- package/templates/react/components/stepTabs.jsx +8 -8
- package/templates/react/components/summary.jsx +3 -3
- package/templates/react/components/table.jsx +2 -2
- package/templates/react/layout/flex.jsx +8 -8
- package/templates/react/layout/grid.jsx +8 -8
- package/templates/react/layout/section.jsx +12 -12
- package/templates/react/patterns/cookieConsent.jsx +8 -8
- package/templates/react/patterns/footer.jsx +4 -4
- package/templates/react/patterns/header.jsx +3 -3
- package/templates/html/demo.js +0 -130
- /package/{templates/html → demo}/demo.css +0 -0
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Breadcrumb
|
|
4
|
+
* @description Hierarchical navigation that shows the current page path with links, separators, and a semantic indication of the active item.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
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
|
+
*
|
|
11
|
+
* @return Semantic breadcrumb HTML structure wrapped in a nav element.
|
|
12
|
+
*/
|
|
13
|
+
-->
|
|
14
|
+
|
|
1
15
|
<nav aria-label="Breadcrumb">
|
|
2
16
|
<ul pgs="breadcrumb">
|
|
3
17
|
<li pgs="breadcrumb-item">
|
|
@@ -16,7 +30,7 @@
|
|
|
16
30
|
|
|
17
31
|
<li pgs="breadcrumb-item">
|
|
18
32
|
<span aria-current="page">
|
|
19
|
-
|
|
33
|
+
Sample article
|
|
20
34
|
</span>
|
|
21
35
|
</li>
|
|
22
36
|
</ul>
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Button
|
|
4
|
+
* @description Button and action-link variants with sizes, emphasis, and icon-text composition defined by the design system.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
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
|
+
*
|
|
13
|
+
* @pgs-option
|
|
14
|
+
* - buttonReverse: reverses the visual order of the text and icon on the button.
|
|
15
|
+
*
|
|
16
|
+
* @related
|
|
17
|
+
* - flexRow: arranges the button examples in a flexible row.
|
|
18
|
+
*
|
|
19
|
+
* @return HTML collection of the main button variants.
|
|
20
|
+
*/
|
|
21
|
+
-->
|
|
22
|
+
|
|
1
23
|
<div pgs="flexRow">
|
|
2
24
|
<a pgs="button" href="#">
|
|
3
25
|
<i class="fa-duotone fa-solid fa-store"></i>
|
|
@@ -5,7 +27,7 @@
|
|
|
5
27
|
</a>
|
|
6
28
|
|
|
7
29
|
<button pgs="button" type="button" pgs-option="buttonReverse">
|
|
8
|
-
|
|
30
|
+
Next
|
|
9
31
|
<i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
|
|
10
32
|
</button>
|
|
11
33
|
|
|
@@ -14,16 +36,16 @@
|
|
|
14
36
|
Submit
|
|
15
37
|
</button>
|
|
16
38
|
|
|
17
|
-
<button pgs="buttonIcon" type="button" aria-label="
|
|
39
|
+
<button pgs="buttonIcon" type="button" aria-label="Settings">
|
|
18
40
|
<i class="fa-solid fa-gear" aria-hidden="true"></i>
|
|
19
41
|
</button>
|
|
20
42
|
|
|
21
|
-
<button pgs="buttonMini" type="button" aria-label="
|
|
43
|
+
<button pgs="buttonMini" type="button" aria-label="Information">
|
|
22
44
|
<i class="fa-solid fa-info" aria-hidden="true"></i>
|
|
23
45
|
</button>
|
|
24
46
|
|
|
25
|
-
<button pgs="buttonBig" type="button" aria-label="
|
|
47
|
+
<button pgs="buttonBig" type="button" aria-label="Large button">
|
|
26
48
|
<i class="fa-solid fa-rocket" aria-hidden="true"></i>
|
|
27
|
-
|
|
49
|
+
Large button
|
|
28
50
|
</button>
|
|
29
|
-
</div>
|
|
51
|
+
</div>
|
|
@@ -1,23 +1,43 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Card
|
|
4
|
+
* @description Reusable container for grouping an image, title, text, and actions in responsive previews or collections.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
7
|
+
* - card: identifies the main card container.
|
|
8
|
+
* - card-img: identifies the main card image.
|
|
9
|
+
*
|
|
10
|
+
* @related
|
|
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
|
+
*
|
|
17
|
+
* @return Two card HTML structures, one with a separate action and one that is fully clickable.
|
|
18
|
+
*/
|
|
19
|
+
-->
|
|
20
|
+
|
|
1
21
|
<div pgs="flex-2">
|
|
2
22
|
|
|
3
23
|
<article pgs="card flexColumn">
|
|
4
|
-
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="
|
|
24
|
+
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Placeholder image">
|
|
5
25
|
|
|
6
26
|
<div pgs="flexColumnTexts">
|
|
7
|
-
<h3>
|
|
8
|
-
<p>
|
|
9
|
-
<a pgs="button" href="#">
|
|
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>
|
|
10
30
|
</div>
|
|
11
31
|
</article>
|
|
12
32
|
|
|
13
33
|
<article pgs="card">
|
|
14
34
|
<a pgs="flexColumn" href="">
|
|
15
|
-
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="
|
|
35
|
+
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Placeholder image">
|
|
16
36
|
|
|
17
37
|
<div pgs="flexColumnTexts">
|
|
18
|
-
<h3>
|
|
19
|
-
<p>
|
|
38
|
+
<h3>Reusable card</h3>
|
|
39
|
+
<p>Descriptive card content suitable for lists, previews, and grids.</p>
|
|
20
40
|
</div>
|
|
21
41
|
</a>
|
|
22
42
|
</article>
|
|
23
|
-
</div>
|
|
43
|
+
</div>
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Dropdown
|
|
4
|
+
* @description Popup component that connects a control to content positioned relative to its trigger and handles opening, closing, outside clicks, and Escape.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
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
|
+
*
|
|
11
|
+
* @pgs-option
|
|
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
|
+
*
|
|
15
|
+
* @pgs-state
|
|
16
|
+
* - open: indicates that the dropdown is open and its content is visible.
|
|
17
|
+
*
|
|
18
|
+
* @api
|
|
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
|
+
*
|
|
27
|
+
* @related
|
|
28
|
+
* - flexRow: arranges the placement examples on the same flexible row.
|
|
29
|
+
* - button: applies standard styling to dropdown controls.
|
|
30
|
+
*
|
|
31
|
+
* @return Series of HTML dropdowns demonstrating the supported placement directions.
|
|
32
|
+
*/
|
|
33
|
+
-->
|
|
34
|
+
|
|
1
35
|
<div pgs="flexRow">
|
|
2
36
|
|
|
3
37
|
<span pgs="dropdown">
|
|
@@ -7,7 +41,7 @@
|
|
|
7
41
|
</button>
|
|
8
42
|
|
|
9
43
|
<div pgs="dropdown-content">
|
|
10
|
-
|
|
44
|
+
bottom center content
|
|
11
45
|
</div>
|
|
12
46
|
</span>
|
|
13
47
|
|
|
@@ -18,7 +52,7 @@
|
|
|
18
52
|
</button>
|
|
19
53
|
|
|
20
54
|
<div pgs="dropdown-content">
|
|
21
|
-
|
|
55
|
+
top left content
|
|
22
56
|
</div>
|
|
23
57
|
</span>
|
|
24
58
|
|
|
@@ -29,7 +63,7 @@
|
|
|
29
63
|
</button>
|
|
30
64
|
|
|
31
65
|
<div pgs="dropdown-content">
|
|
32
|
-
|
|
66
|
+
top center content
|
|
33
67
|
</div>
|
|
34
68
|
</span>
|
|
35
69
|
|
|
@@ -40,7 +74,7 @@
|
|
|
40
74
|
</button>
|
|
41
75
|
|
|
42
76
|
<div pgs="dropdown-content">
|
|
43
|
-
|
|
77
|
+
top right content
|
|
44
78
|
</div>
|
|
45
79
|
</span>
|
|
46
80
|
|
|
@@ -51,7 +85,7 @@
|
|
|
51
85
|
</button>
|
|
52
86
|
|
|
53
87
|
<div pgs="dropdown-content">
|
|
54
|
-
|
|
88
|
+
bottom left content
|
|
55
89
|
</div>
|
|
56
90
|
</span>
|
|
57
91
|
|
|
@@ -62,7 +96,7 @@
|
|
|
62
96
|
</button>
|
|
63
97
|
|
|
64
98
|
<div pgs="dropdown-content">
|
|
65
|
-
|
|
99
|
+
bottom right content
|
|
66
100
|
</div>
|
|
67
101
|
</span>
|
|
68
102
|
|
|
@@ -73,7 +107,7 @@
|
|
|
73
107
|
</button>
|
|
74
108
|
|
|
75
109
|
<div pgs="dropdown-content">
|
|
76
|
-
|
|
110
|
+
left center content
|
|
77
111
|
</div>
|
|
78
112
|
</span>
|
|
79
113
|
|
|
@@ -84,7 +118,7 @@
|
|
|
84
118
|
</button>
|
|
85
119
|
|
|
86
120
|
<div pgs="dropdown-content">
|
|
87
|
-
|
|
121
|
+
right center content
|
|
88
122
|
</div>
|
|
89
123
|
</span>
|
|
90
124
|
|
|
@@ -1,26 +1,127 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Form
|
|
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
|
+
*
|
|
6
|
+
* @pgs
|
|
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
|
+
*
|
|
14
|
+
* @pgs-option
|
|
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
|
+
*
|
|
19
|
+
* @api
|
|
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
|
+
*
|
|
28
|
+
* @related
|
|
29
|
+
* - buttonStrong: presents form submission as the primary action.
|
|
30
|
+
* - flexColumnTexts: spaces text elements in the radio group.
|
|
31
|
+
*
|
|
32
|
+
* @return Complete HTML form with required fields and an example script for a custom rule, validation, and a success message.
|
|
33
|
+
*/
|
|
34
|
+
-->
|
|
35
|
+
|
|
36
|
+
<form pgs="form formValidate" action="#" method="post">
|
|
2
37
|
<label pgs="label" for="form-name">
|
|
3
|
-
|
|
38
|
+
Name
|
|
4
39
|
</label>
|
|
5
|
-
<input id="form-name" pgs="input" type="text" name="name" placeholder="
|
|
40
|
+
<input id="form-name" pgs="input" pgs-option="message[Enter your name]" type="text" name="name" placeholder="John Smith" required>
|
|
6
41
|
|
|
7
42
|
<label pgs="label" for="form-email">
|
|
8
43
|
Email
|
|
9
44
|
</label>
|
|
10
|
-
<input id="form-email" pgs="input" type="email" name="email" placeholder="
|
|
45
|
+
<input id="form-email" pgs="input" pgs-option="message[Enter a valid email address]" type="email" name="email" placeholder="name@example.com" required>
|
|
46
|
+
|
|
47
|
+
<label pgs="label" for="form-password">
|
|
48
|
+
Password
|
|
49
|
+
</label>
|
|
50
|
+
<input id="form-password" pgs="input" pgs-option="message[Enter a password]" type="password" name="password" autocomplete="new-password" required>
|
|
51
|
+
|
|
52
|
+
<label pgs="label" for="form-confirm-password">
|
|
53
|
+
Confirm password
|
|
54
|
+
</label>
|
|
55
|
+
<input id="form-confirm-password" pgs="input" pgs-option="message[Confirm your password]" type="password" name="confirmPassword" autocomplete="new-password" required>
|
|
11
56
|
|
|
12
57
|
<label pgs="label" for="form-message">
|
|
13
|
-
|
|
58
|
+
Message
|
|
14
59
|
</label>
|
|
15
|
-
<textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="
|
|
60
|
+
<textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="Write your message" required></textarea>
|
|
61
|
+
|
|
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>
|
|
16
75
|
|
|
17
|
-
|
|
18
|
-
|
|
76
|
+
<label>
|
|
77
|
+
<input type="radio" name="contactMethod" value="message">
|
|
78
|
+
<span>Direct message</span>
|
|
79
|
+
</label>
|
|
80
|
+
</fieldset>
|
|
81
|
+
<br>
|
|
82
|
+
|
|
83
|
+
<label>
|
|
19
84
|
<input type="checkbox" name="privacy" required>
|
|
85
|
+
<span>I accept the privacy policy</span>
|
|
20
86
|
</label>
|
|
87
|
+
<br>
|
|
21
88
|
|
|
22
89
|
<button pgs="buttonStrong" type="submit">
|
|
23
90
|
<i class="fa-solid fa-paper-plane" aria-hidden="true"></i>
|
|
24
|
-
|
|
91
|
+
Submit
|
|
25
92
|
</button>
|
|
26
93
|
</form>
|
|
94
|
+
|
|
95
|
+
<script type="module">
|
|
96
|
+
import { pgs } from "mypgs";
|
|
97
|
+
|
|
98
|
+
const form = pgs(document).querySelector("form");
|
|
99
|
+
|
|
100
|
+
const password = form.querySelector('input[name="password"]');
|
|
101
|
+
const confirmPassword = form.querySelector('input[name="confirmPassword"]');
|
|
102
|
+
if (!password || !confirmPassword) return;
|
|
103
|
+
|
|
104
|
+
const formValidate = new pgs.formValidate(form, {
|
|
105
|
+
message: {
|
|
106
|
+
fieldError: "Please complete this field",
|
|
107
|
+
fieldsError: "Please complete all required fields",
|
|
108
|
+
success: "Submitted successfully"
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
//== new roules
|
|
113
|
+
formValidate.addNewRule(() => {
|
|
114
|
+
if (password.value && confirmPassword.value && password.value !== confirmPassword.value) {
|
|
115
|
+
pgs(confirmPassword).option.setValueBrackets("message", "Passwords do not match");
|
|
116
|
+
return [confirmPassword, password];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
//== validate
|
|
121
|
+
formValidate.validator(event => {
|
|
122
|
+
const values = Object.fromEntries(new FormData(form));
|
|
123
|
+
|
|
124
|
+
// Replace this log with a request to your backend.
|
|
125
|
+
console.log(values);
|
|
126
|
+
}, "submit");
|
|
127
|
+
</script>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Form Add-ons
|
|
4
|
+
* @description Additional form controls for selectable cards, two-state buttons, switches, and compact chip groups.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
7
|
+
* - checkboxBackground: presents a checkbox as a selectable container with a highlighted checked state.
|
|
8
|
+
* - twoState: presents checkbox or radio labels as buttons whose appearance changes when selected.
|
|
9
|
+
* - toggle: presents a checkbox as a switch with a rail and movable thumb.
|
|
10
|
+
* - chips: groups twoState controls into a compact segmented selector.
|
|
11
|
+
*
|
|
12
|
+
* @related
|
|
13
|
+
* - flexColumnElements: vertically arranges the form add-on examples.
|
|
14
|
+
* - flexColumnTexts: groups each example with its heading and control.
|
|
15
|
+
*
|
|
16
|
+
* @return HTML examples of the checkboxBackground, twoState, toggle, and chips form controls using native checkbox and radio inputs.
|
|
17
|
+
*/
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
<div pgs="flexColumnElements">
|
|
21
|
+
<section pgs="flexColumnTexts">
|
|
22
|
+
<strong>Checkbox with background</strong>
|
|
23
|
+
|
|
24
|
+
<label pgs="checkboxBackground">
|
|
25
|
+
<input type="checkbox" name="notifications" value="enabled">
|
|
26
|
+
<span>
|
|
27
|
+
<strong>Enable notifications</strong><br>
|
|
28
|
+
Receive important account updates.
|
|
29
|
+
</span>
|
|
30
|
+
</label>
|
|
31
|
+
</section>
|
|
32
|
+
|
|
33
|
+
<section pgs="flexColumnTexts">
|
|
34
|
+
<strong>Two-state controls</strong>
|
|
35
|
+
|
|
36
|
+
<label pgs="twoState">
|
|
37
|
+
<input type="checkbox" name="favorite" value="yes">
|
|
38
|
+
<i class="fa-solid fa-star" aria-hidden="true"></i>
|
|
39
|
+
Add to favorites
|
|
40
|
+
</label>
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<section pgs="flexColumnTexts">
|
|
44
|
+
<strong>Toggle</strong>
|
|
45
|
+
|
|
46
|
+
<label pgs="toggle">
|
|
47
|
+
<span>Enable dark mode</span>
|
|
48
|
+
<input type="checkbox" name="darkMode" value="enabled">
|
|
49
|
+
</label>
|
|
50
|
+
</section>
|
|
51
|
+
|
|
52
|
+
<section pgs="flexColumnTexts">
|
|
53
|
+
<strong>Chips</strong>
|
|
54
|
+
|
|
55
|
+
<div pgs="chips" role="group" aria-label="Select a plan">
|
|
56
|
+
<label pgs="twoState">
|
|
57
|
+
<input type="radio" name="plan" value="basic" checked>
|
|
58
|
+
Basic
|
|
59
|
+
</label>
|
|
60
|
+
|
|
61
|
+
<label pgs="twoState">
|
|
62
|
+
<input type="radio" name="plan" value="pro">
|
|
63
|
+
Pro
|
|
64
|
+
</label>
|
|
65
|
+
|
|
66
|
+
<label pgs="twoState">
|
|
67
|
+
<input type="radio" name="plan" value="enterprise">
|
|
68
|
+
Enterprise
|
|
69
|
+
</label>
|
|
70
|
+
</div>
|
|
71
|
+
</section>
|
|
72
|
+
</div>
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Logo
|
|
4
|
+
* @description Component for displaying a graphical or text logo, with image variants that support dark mode.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
7
|
+
* - logo: identifies the brand link container.
|
|
8
|
+
* - logo-image: identifies the graphical logo image.
|
|
9
|
+
* - logo-text: identifies the text-based brand variant.
|
|
10
|
+
*
|
|
11
|
+
* @pgs-option
|
|
12
|
+
* - logoDarkmode: inverts the logo image when the global darkmode state is active.
|
|
13
|
+
* - logoDarkmodeFixed: keeps the image inversion enabled regardless of the current theme.
|
|
14
|
+
*
|
|
15
|
+
* @pgs-state
|
|
16
|
+
* - darkmode: global document state that activates the logoDarkmode variant.
|
|
17
|
+
*
|
|
18
|
+
* @return HTML examples of the theme-aware graphical logo and the text logo.
|
|
19
|
+
*/
|
|
20
|
+
-->
|
|
21
|
+
|
|
1
22
|
<a aria-label="Logo" pgs="logo" pgs-option="logoDarkmode" href="/">
|
|
2
23
|
<img pgs="logo-image" src="https://placehold.co/240x80?text=MyPGS" alt="MyPGS">
|
|
3
24
|
</a>
|
|
4
25
|
|
|
5
|
-
<a aria-label="
|
|
26
|
+
<a aria-label="Text logo" pgs="logo" href="/">
|
|
6
27
|
<span pgs="logo-text">MyPGS</span>
|
|
7
28
|
</a>
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Menu
|
|
4
|
+
* @description Menu markup, configuration, behavior, and usage example.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
7
|
+
* - menu: identifies the menu element used by Menu.
|
|
8
|
+
* - menu-buttonIcon: identifies the menu-buttonIcon element used by Menu.
|
|
9
|
+
*
|
|
10
|
+
* @pgs-option
|
|
11
|
+
* - horizontal: identifies the horizontal element used by Menu.
|
|
12
|
+
* - vertical: identifies the vertical element used by Menu.
|
|
13
|
+
* - menuHeader: identifies the menuHeader element used by Menu.
|
|
14
|
+
* - position: identifies the position element used by Menu.
|
|
15
|
+
*
|
|
16
|
+
* @pgs-state
|
|
17
|
+
* - open: identifies the open element used by Menu.
|
|
18
|
+
*
|
|
19
|
+
* @api
|
|
20
|
+
* - pgs.menu.init(root): initializes matching elements within the specified root.
|
|
21
|
+
* - pgs.menu.api(element): returns the instance associated with the specified initialized element.
|
|
22
|
+
* - instance.refresh(): refreshes the component and returns its updated instance.
|
|
23
|
+
*
|
|
24
|
+
* @related
|
|
25
|
+
* - dropdown: uses the related dropdown component or utility in this example.
|
|
26
|
+
* - dropdown-button: uses the related dropdown-button component or utility in this example.
|
|
27
|
+
* - buttonNohover: uses the related buttonNohover component or utility in this example.
|
|
28
|
+
* - dropdown-content: uses the related dropdown-content component or utility in this example.
|
|
29
|
+
*
|
|
30
|
+
* @return Complete HTML markup and usage example for Menu.
|
|
31
|
+
*/
|
|
32
|
+
-->
|
|
33
|
+
|
|
1
34
|
<nav pgs="menu" pgs-option="horizontal" aria-label="Menu orizzontale">
|
|
2
35
|
<ul>
|
|
3
36
|
<li>
|
|
@@ -16,12 +49,6 @@
|
|
|
16
49
|
<li><a href="/servizi/due">Servizio due</a></li>
|
|
17
50
|
</ul>
|
|
18
51
|
</li>
|
|
19
|
-
<li>
|
|
20
|
-
<a href="/about">
|
|
21
|
-
<i class="fa-solid fa-info-circle" aria-hidden="true"></i>
|
|
22
|
-
<span>about</span>
|
|
23
|
-
</a>
|
|
24
|
-
</li>
|
|
25
52
|
</ul>
|
|
26
53
|
</nav>
|
|
27
54
|
|
|
@@ -1,16 +1,60 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* @title Modal
|
|
4
|
+
* @description Modal markup, configuration, behavior, and usage example.
|
|
5
|
+
*
|
|
6
|
+
* @pgs
|
|
7
|
+
* - modal: identifies the modal element used by Modal.
|
|
8
|
+
* - modal-button: identifies the modal-button element used by Modal.
|
|
9
|
+
* - dialog: token aggiunto dinamicamente all'elemento dialog inizializzato.
|
|
10
|
+
* - modal-dialog: identifies the modal-dialog element used by Modal.
|
|
11
|
+
* - modal-dialog-content: identifies the modal-dialog-content element used by Modal.
|
|
12
|
+
* - modal-dialog-content-header: identifies the modal-dialog-content-header element used by Modal.
|
|
13
|
+
* - modal-dialog-content-scroll: identifies the modal-dialog-content-scroll element used by Modal.
|
|
14
|
+
* - modal-close: identifies the modal-close element used by Modal.
|
|
15
|
+
*
|
|
16
|
+
* @pgs-option
|
|
17
|
+
* - containerID: identifies the containerID element used by Modal.
|
|
18
|
+
* - containerPGS: identifies the containerPGS element used by Modal.
|
|
19
|
+
* - disableBackdropClose: identifies the disableBackdropClose element used by Modal.
|
|
20
|
+
* - history: identifies the history element used by Modal.
|
|
21
|
+
* - topLevel: identifies the topLevel element used by Modal.
|
|
22
|
+
* - left: identifies the left element used by Modal.
|
|
23
|
+
* - right: identifies the right element used by Modal.
|
|
24
|
+
*
|
|
25
|
+
* @api
|
|
26
|
+
* - pgs.modal.init(root): initializes matching elements within the specified root.
|
|
27
|
+
* - pgs.modal.api(element): returns the instance associated with the specified initialized element.
|
|
28
|
+
* - instance.open(): opens the component.
|
|
29
|
+
* - instance.close(): closes the component.
|
|
30
|
+
* - instance.toggle(): toggles the component state.
|
|
31
|
+
* - instance.refresh(): refreshes the component and returns its updated instance.
|
|
32
|
+
* - instance.isOpen(): returns true when the component is open.
|
|
33
|
+
*
|
|
34
|
+
* @related
|
|
35
|
+
* - button: uses the related button component or utility in this example.
|
|
36
|
+
* - buttonStrong: uses the related buttonStrong component or utility in this example.
|
|
37
|
+
* - buttonClose: uses the related buttonClose component or utility in this example.
|
|
38
|
+
* - flexColumnElements: uses the related flexColumnElements component or utility in this example.
|
|
39
|
+
* - flexRow: uses the related flexRow component or utility in this example.
|
|
40
|
+
*
|
|
41
|
+
* @return Complete HTML markup and usage example for Modal.
|
|
42
|
+
*/
|
|
43
|
+
-->
|
|
44
|
+
|
|
1
45
|
<div pgs="modal" pgs-option="containerID[modal-container]">
|
|
2
46
|
<button pgs="modal-button button" type="button">
|
|
3
|
-
<i class="fa-solid fa-window-maximize"></i>
|
|
47
|
+
<i class="fa-solid fa-window-maximize"></i> Open modal
|
|
4
48
|
</button>
|
|
5
49
|
|
|
6
50
|
<dialog>
|
|
7
51
|
<div pgs="modal-dialog-content">
|
|
8
52
|
<div pgs="modal-dialog-content-header">
|
|
9
|
-
<h3>
|
|
53
|
+
<h3>Example modal</h3>
|
|
10
54
|
</div>
|
|
11
55
|
|
|
12
56
|
<div pgs="modal-dialog-content-scroll">
|
|
13
|
-
<p>
|
|
57
|
+
<p>Modal content. The close button is added automatically when missing.</p>
|
|
14
58
|
</div>
|
|
15
59
|
</div>
|
|
16
60
|
</dialog>
|
|
@@ -18,17 +62,17 @@
|
|
|
18
62
|
|
|
19
63
|
<div pgs="modal" pgs-option="containerID[modal-container]">
|
|
20
64
|
<button pgs="modal-button button" type="button">
|
|
21
|
-
<i class="fa-solid fa-window-maximize"></i>
|
|
65
|
+
<i class="fa-solid fa-window-maximize"></i> Open modal right
|
|
22
66
|
</button>
|
|
23
67
|
|
|
24
68
|
<dialog pgs-option="right">
|
|
25
69
|
<div pgs="modal-dialog-content">
|
|
26
70
|
<div pgs="modal-dialog-content-header">
|
|
27
|
-
<h3>
|
|
71
|
+
<h3>Side modal</h3>
|
|
28
72
|
</div>
|
|
29
73
|
|
|
30
74
|
<div pgs="modal-dialog-content-scroll">
|
|
31
|
-
<p>
|
|
75
|
+
<p>Modal content with <code>pgs-option="right"</code>.</p>
|
|
32
76
|
</div>
|
|
33
77
|
</div>
|
|
34
78
|
</dialog>
|
|
@@ -36,17 +80,17 @@
|
|
|
36
80
|
|
|
37
81
|
<div pgs="modal" pgs-option="containerID[modal-container]">
|
|
38
82
|
<button pgs="modal-button button" type="button">
|
|
39
|
-
<i class="fa-solid fa-window-maximize"></i>
|
|
83
|
+
<i class="fa-solid fa-window-maximize"></i> Open modal left
|
|
40
84
|
</button>
|
|
41
85
|
|
|
42
86
|
<dialog pgs-option="left">
|
|
43
87
|
<div pgs="modal-dialog-content">
|
|
44
88
|
<div pgs="modal-dialog-content-header">
|
|
45
|
-
<h3>
|
|
89
|
+
<h3>Left-side modal</h3>
|
|
46
90
|
</div>
|
|
47
91
|
|
|
48
92
|
<div pgs="modal-dialog-content-scroll">
|
|
49
|
-
<p>
|
|
93
|
+
<p>Modal content with <code>pgs-option="left"</code>.</p>
|
|
50
94
|
</div>
|
|
51
95
|
</div>
|
|
52
96
|
</dialog>
|
|
@@ -54,21 +98,21 @@
|
|
|
54
98
|
|
|
55
99
|
<div pgs="modal">
|
|
56
100
|
<button pgs="modal-button button" type="button">
|
|
57
|
-
<i class="fa-solid fa-floppy-disk"></i>
|
|
101
|
+
<i class="fa-solid fa-floppy-disk"></i> Confirmation salvataggio
|
|
58
102
|
</button>
|
|
59
103
|
|
|
60
104
|
<dialog pgs-option="topLevel">
|
|
61
105
|
<div pgs="modal-dialog-content">
|
|
62
106
|
<div pgs="modal-dialog-content-header">
|
|
63
|
-
<h3>
|
|
107
|
+
<h3>Save changes?</h3>
|
|
64
108
|
</div>
|
|
65
109
|
|
|
66
110
|
<div pgs="modal-dialog-content-scroll flexColumnElements">
|
|
67
|
-
<p>
|
|
111
|
+
<p>You have unsaved changes. Confirm to apply them or cancel to return to the page.</p>
|
|
68
112
|
|
|
69
113
|
<div pgs="flexRow">
|
|
70
|
-
<button pgs="button modal-close" type="button">
|
|
71
|
-
<button pgs="buttonStrong" type="button">
|
|
114
|
+
<button pgs="button modal-close" type="button">Cancel</button>
|
|
115
|
+
<button pgs="buttonStrong" type="button">Save changes</button>
|
|
72
116
|
</div>
|
|
73
117
|
</div>
|
|
74
118
|
</div>
|