mypgs 2.0.0 → 3.0.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/.vscode/tasks.json +39 -0
- package/AGENTS.md +22 -21
- package/README.md +25 -25
- package/assets/javascript/components/_menu.js +2 -1
- package/assets/javascript/components/_modals.js +1 -1
- package/assets/javascript/components/_notifications.js +2 -1
- package/assets/javascript/components/_slides.js +2 -2
- package/assets/scss/base/_body.scss +5 -5
- package/assets/scss/base/_general.scss +27 -18
- package/assets/scss/base/_variables.scss +1 -1
- package/assets/scss/components/_accordion.scss +9 -9
- package/assets/scss/components/_alerts.scss +71 -0
- package/assets/scss/components/_badges.scss +40 -48
- package/assets/scss/components/_button.scss +28 -20
- package/assets/scss/components/_card.scss +9 -4
- package/assets/scss/components/_form.scss +0 -16
- package/assets/scss/components/_formAddon.scss +22 -0
- package/assets/scss/components/_logo.scss +3 -4
- package/assets/scss/components/_menu.scss +26 -3
- package/assets/scss/components/_modals.scss +6 -4
- package/assets/scss/components/_search.scss +2 -2
- package/assets/scss/components/_slides.scss +0 -1
- package/assets/scss/components/_stepTabs.scss +2 -1
- package/assets/scss/components/_tooltip.scss +0 -1
- package/assets/scss/index.scss +3 -3
- package/assets/scss/layout/_footer.scss +0 -2
- package/assets/scss/layout/_header.scss +10 -2
- package/assets/scss/layout/_pageShell.scss +6 -2
- package/assets/scss/layout/_responsive.scss +63 -0
- package/assets/scss/mixin/_mx-base.scss +4 -8
- package/assets/scss/mixin/_mx-button.scss +73 -115
- package/assets/scss/mixin/_mx-card.scss +39 -40
- package/assets/scss/mixin/_mx-form.scss +13 -10
- package/assets/scss/mixin/{_mx-form-addon.scss → _mx-formAddon.scss} +103 -64
- package/assets/scss/mixin/_mx-hover.scss +81 -0
- package/assets/scss/mixin/_mx-responsive.scss +81 -201
- package/assets/scss/mixin/_settings.scss +2 -1
- package/assets/scss/mixin/mixin.scss +2 -1
- package/demo/demo.css +9 -6
- package/demo/demo.html +7 -5
- package/demo/demo.js +37 -34
- package/dist/css/index.css +2469 -3825
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/dist/javascript/index.js +7 -5
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/index.min.js +1 -1
- package/docs/componenti-e-markup.md +9 -8
- package/docs/components/accordion.md +23 -23
- package/docs/components/alerts.md +67 -0
- package/docs/components/badges.md +29 -26
- package/docs/components/breadcumbs.md +8 -8
- package/docs/components/button.md +18 -18
- package/docs/components/card.md +25 -22
- package/docs/components/dropdown.md +29 -29
- package/docs/components/form.md +65 -41
- package/docs/components/formAddon.md +116 -0
- package/docs/components/logo.md +11 -11
- package/docs/components/menu.md +20 -20
- package/docs/components/modal.md +52 -51
- package/docs/components/notification.md +34 -34
- package/docs/components/search.md +54 -52
- package/docs/components/slides.md +41 -42
- package/docs/components/stepTabs.md +45 -45
- package/docs/components/steps.md +16 -16
- package/docs/components/summary.md +20 -20
- package/docs/components/table.md +7 -7
- package/docs/components/tooltip.md +24 -23
- package/docs/convenzioni.md +11 -11
- package/docs/export-e-sviluppo.md +4 -4
- package/docs/helper-javascript.md +8 -8
- package/docs/layout/body.md +11 -11
- package/docs/layout/footer.md +28 -24
- package/docs/layout/header.md +36 -35
- package/docs/layout/pageShell.md +19 -19
- package/docs/layout/responsive.md +90 -0
- package/docs/layout/section.md +38 -38
- package/docs/patterns/cookieConsent.md +42 -39
- package/docs/utilizzo-css-scss.md +33 -9
- package/package.json +1 -1
- package/reference/html/components/accordion.html +52 -0
- package/reference/html/components/alerts.html +59 -0
- package/reference/html/components/badges.html +62 -0
- package/{templates → reference}/html/components/breadcumbs.html +6 -6
- package/reference/html/components/button.html +51 -0
- package/reference/html/components/card.html +45 -0
- package/{templates → reference}/html/components/dropdown.html +25 -25
- package/reference/html/components/form.html +128 -0
- package/reference/html/components/formAddon.html +109 -0
- package/reference/html/components/logo.html +28 -0
- package/{templates → reference}/html/components/menu.html +17 -17
- package/reference/html/components/modal.html +123 -0
- package/reference/html/components/notification.html +71 -0
- package/reference/html/components/search.html +109 -0
- package/reference/html/components/slides.html +75 -0
- package/reference/html/components/stepTabs.html +83 -0
- package/reference/html/components/steps.html +49 -0
- package/reference/html/components/summary.html +41 -0
- package/{templates → reference}/html/components/table.html +5 -5
- package/reference/html/components/tooltip.html +44 -0
- package/reference/html/layout/body.html +34 -0
- package/reference/html/layout/footer.html +67 -0
- package/reference/html/layout/header.html +108 -0
- package/{templates → reference}/html/layout/pageShell.html +16 -16
- package/reference/html/layout/responsive.html +83 -0
- package/reference/html/layout/section.html +62 -0
- package/reference/html/patterns/cookieConsent.html +84 -0
- package/{templates → reference}/react/components/accordion.jsx +5 -5
- package/reference/react/components/alerts.jsx +46 -0
- package/{templates → reference}/react/components/breadcumbs.jsx +1 -1
- package/{templates → reference}/react/components/button.jsx +6 -6
- package/{templates → reference}/react/components/card.jsx +6 -6
- package/{templates → reference}/react/components/dropdown.jsx +8 -8
- package/{templates → reference}/react/components/form.jsx +3 -3
- package/{templates → reference}/react/components/modal.jsx +15 -15
- package/{templates → reference}/react/components/notification.jsx +3 -3
- package/{templates → reference}/react/components/search.jsx +8 -8
- package/{templates → reference}/react/components/slides.jsx +4 -4
- package/{templates → reference}/react/components/stepTabs.jsx +12 -12
- package/reference/react/components/summary.jsx +18 -0
- package/{templates → reference}/react/components/table.jsx +2 -2
- package/{templates → reference}/react/components/tooltip.jsx +1 -1
- package/{templates → reference}/react/layout/pageShell.jsx +2 -2
- package/reference/react/layout/responsive.jsx +61 -0
- package/reference/react/layout/section.jsx +44 -0
- package/{templates → reference}/react/patterns/cookieConsent.jsx +9 -9
- package/{templates → reference}/react/patterns/footer.jsx +4 -4
- package/{templates → reference}/react/patterns/header.jsx +4 -4
- package/scripts/generate-component-docs.js +12 -12
- package/assets/scss/layout/_flex.scss +0 -49
- package/assets/scss/layout/_gap.scss +0 -21
- package/assets/scss/layout/_grid.scss +0 -13
- package/docs/layout/flex.md +0 -116
- package/docs/layout/grid.md +0 -116
- package/templates/html/components/accordion.html +0 -52
- package/templates/html/components/badges.html +0 -60
- package/templates/html/components/button.html +0 -51
- package/templates/html/components/card.html +0 -43
- package/templates/html/components/form.html +0 -104
- package/templates/html/components/logo.html +0 -28
- package/templates/html/components/modal.html +0 -122
- package/templates/html/components/notification.html +0 -71
- package/templates/html/components/search.html +0 -107
- package/templates/html/components/slides.html +0 -76
- package/templates/html/components/stepTabs.html +0 -83
- package/templates/html/components/steps.html +0 -49
- package/templates/html/components/summary.html +0 -41
- package/templates/html/components/tooltip.html +0 -43
- package/templates/html/layout/body.html +0 -35
- package/templates/html/layout/flex.html +0 -109
- package/templates/html/layout/footer.html +0 -64
- package/templates/html/layout/grid.html +0 -109
- package/templates/html/layout/header.html +0 -107
- package/templates/html/layout/section.html +0 -62
- package/templates/html/patterns/cookieConsent.html +0 -82
- package/templates/react/components/summary.jsx +0 -18
- package/templates/react/layout/flex.jsx +0 -36
- package/templates/react/layout/grid.jsx +0 -36
- package/templates/react/layout/section.jsx +0 -44
- /package/{templates → reference}/react/components/logo.jsx +0 -0
- /package/{templates → reference}/react/components/menu.jsx +0 -0
- /package/{templates → reference}/react/components/steps.jsx +0 -0
- /package/{templates → reference}/react/layout/body.jsx +0 -0
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from reference/html/components/button.html. Edit reference/html/components/button.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Button
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Button and action-link variants with sizes, emphasis, and icon-text composition defined by the design system.
|
|
6
6
|
|
|
7
7
|
## PGS
|
|
8
8
|
|
|
9
|
-
- `button`:
|
|
10
|
-
- `buttonStrong`: applica la variante con maggiore enfasi visiva.
|
|
11
|
-
- `buttonIcon`: identifica un pulsante compatto composto principalmente da un'icona.
|
|
12
|
-
- `buttonMini`: applica la variante di dimensione minima.
|
|
13
|
-
- `buttonBig`: applica la variante di dimensione ampia.
|
|
9
|
+
- `button`: identifies the standard button, which can also be used on anchor elements.
|
|
14
10
|
|
|
15
11
|
## PGS Options
|
|
16
12
|
|
|
17
|
-
- `buttonReverse`:
|
|
13
|
+
- `buttonReverse`: reverses the visual order of the text and icon on the button.
|
|
14
|
+
- `buttonStrong`: applies the variant with stronger visual emphasis.
|
|
15
|
+
- `buttonIcon`: identifies a compact button composed primarily of an icon.
|
|
16
|
+
- `buttonMini`: applies the smallest size variant.
|
|
17
|
+
- `buttonBig`: applies the large size variant.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Related elements
|
|
20
20
|
|
|
21
|
-
- `flexRow`:
|
|
21
|
+
- `flexRow`: arranges the button examples in a flexible row.
|
|
22
22
|
|
|
23
23
|
## Output
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
HTML collection of the main button variants.
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## Example
|
|
28
28
|
|
|
29
29
|
```html
|
|
30
30
|
<div pgs="flexRow">
|
|
@@ -34,26 +34,26 @@ Raccolta HTML delle principali varianti di button.
|
|
|
34
34
|
</a>
|
|
35
35
|
|
|
36
36
|
<button pgs="button" type="button" pgs-option="buttonReverse">
|
|
37
|
-
|
|
37
|
+
Next
|
|
38
38
|
<i class="fa-solid fa-arrow-right" aria-hidden="true"></i>
|
|
39
39
|
</button>
|
|
40
40
|
|
|
41
|
-
<button pgs="buttonStrong" type="button">
|
|
41
|
+
<button pgs="button" pgs-option="buttonStrong" type="button">
|
|
42
42
|
<i class="fa-solid fa-check" aria-hidden="true"></i>
|
|
43
43
|
Submit
|
|
44
44
|
</button>
|
|
45
45
|
|
|
46
|
-
<button pgs="buttonIcon" type="button" aria-label="
|
|
46
|
+
<button pgs="button" pgs-option="buttonIcon" type="button" aria-label="Settings">
|
|
47
47
|
<i class="fa-solid fa-gear" aria-hidden="true"></i>
|
|
48
48
|
</button>
|
|
49
49
|
|
|
50
|
-
<button pgs="buttonMini" type="button" aria-label="
|
|
50
|
+
<button pgs="button" pgs-option="buttonMini" type="button" aria-label="Information">
|
|
51
51
|
<i class="fa-solid fa-info" aria-hidden="true"></i>
|
|
52
52
|
</button>
|
|
53
53
|
|
|
54
|
-
<button pgs="buttonBig" type="button" aria-label="
|
|
54
|
+
<button pgs="button" pgs-option="buttonBig" type="button" aria-label="Large button">
|
|
55
55
|
<i class="fa-solid fa-rocket" aria-hidden="true"></i>
|
|
56
|
-
|
|
56
|
+
Large button
|
|
57
57
|
</button>
|
|
58
58
|
</div>
|
|
59
59
|
```
|
package/docs/components/card.md
CHANGED
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from reference/html/components/card.html. Edit reference/html/components/card.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Card
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Reusable container for grouping an image, title, text, and actions in responsive previews or collections.
|
|
6
6
|
|
|
7
7
|
## PGS
|
|
8
8
|
|
|
9
|
-
- `card`:
|
|
10
|
-
- `card-img`:
|
|
9
|
+
- `card`: identifies the main card container.
|
|
10
|
+
- `card-img`: identifies the main card image.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## PGS Options
|
|
13
13
|
|
|
14
|
-
- `
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- `
|
|
14
|
+
- `column-2`: configures the related flex layout with two columns.
|
|
15
|
+
|
|
16
|
+
## Related elements
|
|
17
|
+
|
|
18
|
+
- `flexRow`: arranges the cards in a responsive layout.
|
|
19
|
+
- `flexColumn`: organizes the card or link content vertically.
|
|
20
|
+
- `imgCover`: scales the image to fill the available area.
|
|
21
|
+
- `button`: presents the final link as a standard button.
|
|
19
22
|
|
|
20
23
|
## Output
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
Two card HTML structures, one with a separate action and one that is fully clickable.
|
|
23
26
|
|
|
24
|
-
##
|
|
27
|
+
## Example
|
|
25
28
|
|
|
26
29
|
```html
|
|
27
|
-
<div pgs="
|
|
30
|
+
<div pgs="flexRow" pgs-option="column-2">
|
|
28
31
|
|
|
29
32
|
<article pgs="card flexColumn">
|
|
30
|
-
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="
|
|
33
|
+
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Placeholder image">
|
|
31
34
|
|
|
32
|
-
<div pgs="
|
|
33
|
-
<h3>
|
|
34
|
-
<p>
|
|
35
|
-
<a pgs="button" href="#">
|
|
35
|
+
<div pgs="flexColumn">
|
|
36
|
+
<h3>Reusable card</h3>
|
|
37
|
+
<p>Descriptive card content suitable for lists, previews, and grids.</p>
|
|
38
|
+
<a pgs="button" href="#">Read more</a>
|
|
36
39
|
</div>
|
|
37
40
|
</article>
|
|
38
41
|
|
|
39
42
|
<article pgs="card">
|
|
40
43
|
<a pgs="flexColumn" href="">
|
|
41
|
-
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="
|
|
44
|
+
<img pgs="card-img imgCover" src="https://placehold.co/800x500" alt="Placeholder image">
|
|
42
45
|
|
|
43
|
-
<div pgs="
|
|
44
|
-
<h3>
|
|
45
|
-
<p>
|
|
46
|
+
<div pgs="flexColumn">
|
|
47
|
+
<h3>Reusable card</h3>
|
|
48
|
+
<p>Descriptive card content suitable for lists, previews, and grids.</p>
|
|
46
49
|
</div>
|
|
47
50
|
</a>
|
|
48
51
|
</article>
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from reference/html/components/dropdown.html. Edit reference/html/components/dropdown.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Dropdown
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Popup component that connects a control to content positioned relative to its trigger and handles opening, closing, outside clicks, and Escape.
|
|
6
6
|
|
|
7
7
|
## PGS
|
|
8
8
|
|
|
9
|
-
- `dropdown`:
|
|
10
|
-
- `dropdown-button`:
|
|
11
|
-
- `dropdown-content`:
|
|
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
12
|
|
|
13
13
|
## PGS Options
|
|
14
14
|
|
|
15
|
-
- `position`:
|
|
16
|
-
- `buttonReverse`:
|
|
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
17
|
|
|
18
18
|
## PGS States
|
|
19
19
|
|
|
20
|
-
- `open`:
|
|
20
|
+
- `open`: indicates that the dropdown is open and its content is visible.
|
|
21
21
|
|
|
22
|
-
## API
|
|
22
|
+
## JavaScript API
|
|
23
23
|
|
|
24
|
-
- `pgs.dropdown.init(root)`:
|
|
25
|
-
- `pgs.dropdown.api(element)`:
|
|
26
|
-
- `instance.open()`:
|
|
27
|
-
- `instance.close()`:
|
|
28
|
-
- `instance.toggle()`:
|
|
29
|
-
- `instance.refresh()`:
|
|
30
|
-
- `instance.isOpen()`:
|
|
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
31
|
|
|
32
|
-
##
|
|
32
|
+
## Related elements
|
|
33
33
|
|
|
34
|
-
- `flexRow`:
|
|
35
|
-
- `button`:
|
|
34
|
+
- `flexRow`: arranges the placement examples on the same flexible row.
|
|
35
|
+
- `button`: applies standard styling to dropdown controls.
|
|
36
36
|
|
|
37
37
|
## Output
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Series of HTML dropdowns demonstrating the supported placement directions.
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Example
|
|
42
42
|
|
|
43
43
|
```html
|
|
44
44
|
<div pgs="flexRow">
|
|
@@ -50,7 +50,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
50
50
|
</button>
|
|
51
51
|
|
|
52
52
|
<div pgs="dropdown-content">
|
|
53
|
-
|
|
53
|
+
bottom center content
|
|
54
54
|
</div>
|
|
55
55
|
</span>
|
|
56
56
|
|
|
@@ -61,7 +61,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
61
61
|
</button>
|
|
62
62
|
|
|
63
63
|
<div pgs="dropdown-content">
|
|
64
|
-
|
|
64
|
+
top left content
|
|
65
65
|
</div>
|
|
66
66
|
</span>
|
|
67
67
|
|
|
@@ -72,7 +72,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
72
72
|
</button>
|
|
73
73
|
|
|
74
74
|
<div pgs="dropdown-content">
|
|
75
|
-
|
|
75
|
+
top center content
|
|
76
76
|
</div>
|
|
77
77
|
</span>
|
|
78
78
|
|
|
@@ -83,7 +83,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
83
83
|
</button>
|
|
84
84
|
|
|
85
85
|
<div pgs="dropdown-content">
|
|
86
|
-
|
|
86
|
+
top right content
|
|
87
87
|
</div>
|
|
88
88
|
</span>
|
|
89
89
|
|
|
@@ -94,7 +94,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
94
94
|
</button>
|
|
95
95
|
|
|
96
96
|
<div pgs="dropdown-content">
|
|
97
|
-
|
|
97
|
+
bottom left content
|
|
98
98
|
</div>
|
|
99
99
|
</span>
|
|
100
100
|
|
|
@@ -105,7 +105,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
105
105
|
</button>
|
|
106
106
|
|
|
107
107
|
<div pgs="dropdown-content">
|
|
108
|
-
|
|
108
|
+
bottom right content
|
|
109
109
|
</div>
|
|
110
110
|
</span>
|
|
111
111
|
|
|
@@ -116,7 +116,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
116
116
|
</button>
|
|
117
117
|
|
|
118
118
|
<div pgs="dropdown-content">
|
|
119
|
-
|
|
119
|
+
left center content
|
|
120
120
|
</div>
|
|
121
121
|
</span>
|
|
122
122
|
|
|
@@ -127,7 +127,7 @@ Serie di dropdown HTML che dimostra le direzioni di posizionamento supportate.
|
|
|
127
127
|
</button>
|
|
128
128
|
|
|
129
129
|
<div pgs="dropdown-content">
|
|
130
|
-
|
|
130
|
+
right center content
|
|
131
131
|
</div>
|
|
132
132
|
</span>
|
|
133
133
|
|
package/docs/components/form.md
CHANGED
|
@@ -1,79 +1,103 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from reference/html/components/form.html. Edit reference/html/components/form.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Form
|
|
4
4
|
|
|
5
|
-
|
|
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`:
|
|
10
|
-
- `formValidate`:
|
|
11
|
-
- `label`:
|
|
12
|
-
- `input`:
|
|
13
|
-
- `textarea`:
|
|
14
|
-
- `
|
|
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`:
|
|
19
|
-
- `error`:
|
|
20
|
-
- `success`:
|
|
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
|
+
- `buttonStrong`: presents form submission as the primary action.
|
|
21
22
|
|
|
22
|
-
## API
|
|
23
|
+
## JavaScript API
|
|
23
24
|
|
|
24
|
-
- `new pgs.formValidate(form, options)`:
|
|
25
|
-
- `instance.validator(callback, eventName)`:
|
|
26
|
-
- `instance.validate()`:
|
|
27
|
-
- `instance.success(text)`:
|
|
28
|
-
- `instance.addNewRule(rule)`:
|
|
29
|
-
- `instance.addFieldError(field, index, total)`:
|
|
30
|
-
- `instance.removeFieldError(field)`:
|
|
25
|
+
- `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.
|
|
26
|
+
- `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.
|
|
27
|
+
- `instance.validate()`: validates required fields, updates state attributes, and returns true or false.
|
|
28
|
+
- `instance.success(text)`: validates the form and shows a success toast when there are no errors.
|
|
29
|
+
- `instance.addNewRule(rule)`: adds a function that returns one or more invalid fields; validate automatically applies addFieldError to each field.
|
|
30
|
+
- `instance.addFieldError(field, index, total)`: marks a field as invalid; shows the specific message for one error or a summary message for multiple errors.
|
|
31
|
+
- `instance.removeFieldError(field)`: removes the error state from the specified field.
|
|
31
32
|
|
|
32
|
-
##
|
|
33
|
+
## Related elements
|
|
33
34
|
|
|
34
|
-
- `
|
|
35
|
+
- `button`: provides the base styling for the primary submit action.
|
|
36
|
+
- `flexColumn`: spaces text elements in the radio group.
|
|
35
37
|
|
|
36
38
|
## Output
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
Complete HTML form with required fields and an example script for a custom rule, validation, and a success message.
|
|
39
41
|
|
|
40
|
-
##
|
|
42
|
+
## Example
|
|
41
43
|
|
|
42
44
|
```html
|
|
43
45
|
<form pgs="form formValidate" action="#" method="post">
|
|
44
46
|
<label pgs="label" for="form-name">
|
|
45
|
-
|
|
47
|
+
Name
|
|
46
48
|
</label>
|
|
47
|
-
<input id="form-name" pgs="input" pgs-option="message[
|
|
49
|
+
<input id="form-name" pgs="input" pgs-option="message[Enter your name]" type="text" name="name" placeholder="John Smith" required>
|
|
48
50
|
|
|
49
51
|
<label pgs="label" for="form-email">
|
|
50
52
|
Email
|
|
51
53
|
</label>
|
|
52
|
-
<input id="form-email" pgs="input" pgs-option="message[
|
|
54
|
+
<input id="form-email" pgs="input" pgs-option="message[Enter a valid email address]" type="email" name="email" placeholder="name@example.com" required>
|
|
53
55
|
|
|
54
56
|
<label pgs="label" for="form-password">
|
|
55
57
|
Password
|
|
56
58
|
</label>
|
|
57
|
-
<input id="form-password" pgs="input" pgs-option="message[
|
|
59
|
+
<input id="form-password" pgs="input" pgs-option="message[Enter a password]" type="password" name="password" autocomplete="new-password" required>
|
|
58
60
|
|
|
59
61
|
<label pgs="label" for="form-confirm-password">
|
|
60
|
-
|
|
62
|
+
Confirm password
|
|
61
63
|
</label>
|
|
62
|
-
<input id="form-confirm-password" pgs="input" pgs-option="message[
|
|
64
|
+
<input id="form-confirm-password" pgs="input" pgs-option="message[Confirm your password]" type="password" name="confirmPassword" autocomplete="new-password" required>
|
|
63
65
|
|
|
64
66
|
<label pgs="label" for="form-message">
|
|
65
|
-
|
|
67
|
+
Message
|
|
66
68
|
</label>
|
|
67
|
-
<textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
69
|
+
<textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="Write your message" required></textarea>
|
|
70
|
+
|
|
71
|
+
<br>
|
|
72
|
+
<fieldset pgs="radio flexColumn">
|
|
73
|
+
<legend>Preferred contact method</legend>
|
|
74
|
+
|
|
75
|
+
<label>
|
|
76
|
+
<input type="radio" name="contactMethod" value="email" pgs-option="message[Choose a contact method]" required>
|
|
77
|
+
<span>Email</span>
|
|
78
|
+
</label>
|
|
79
|
+
|
|
80
|
+
<label>
|
|
81
|
+
<input type="radio" name="contactMethod" value="phone">
|
|
82
|
+
<span>Phone</span>
|
|
83
|
+
</label>
|
|
84
|
+
|
|
85
|
+
<label>
|
|
86
|
+
<input type="radio" name="contactMethod" value="message">
|
|
87
|
+
<span>Direct message</span>
|
|
88
|
+
</label>
|
|
89
|
+
</fieldset>
|
|
90
|
+
<br>
|
|
91
|
+
|
|
92
|
+
<label>
|
|
71
93
|
<input type="checkbox" name="privacy" required>
|
|
94
|
+
<span>I accept the privacy policy</span>
|
|
72
95
|
</label>
|
|
96
|
+
<br>
|
|
73
97
|
|
|
74
|
-
<button pgs="buttonStrong" type="submit">
|
|
98
|
+
<button pgs="button" pgs-option="buttonStrong" type="submit">
|
|
75
99
|
<i class="fa-solid fa-paper-plane" aria-hidden="true"></i>
|
|
76
|
-
|
|
100
|
+
Submit
|
|
77
101
|
</button>
|
|
78
102
|
</form>
|
|
79
103
|
|
|
@@ -88,16 +112,16 @@ Modulo HTML completo con campi required e script di esempio per una regola perso
|
|
|
88
112
|
|
|
89
113
|
const formValidate = new pgs.formValidate(form, {
|
|
90
114
|
message: {
|
|
91
|
-
fieldError: "
|
|
92
|
-
fieldsError: "
|
|
93
|
-
success: "
|
|
115
|
+
fieldError: "Please complete this field",
|
|
116
|
+
fieldsError: "Please complete all required fields",
|
|
117
|
+
success: "Submitted successfully"
|
|
94
118
|
}
|
|
95
119
|
});
|
|
96
120
|
|
|
97
121
|
//== new roules
|
|
98
122
|
formValidate.addNewRule(() => {
|
|
99
123
|
if (password.value && confirmPassword.value && password.value !== confirmPassword.value) {
|
|
100
|
-
pgs(confirmPassword).option.setValueBrackets("message", "
|
|
124
|
+
pgs(confirmPassword).option.setValueBrackets("message", "Passwords do not match");
|
|
101
125
|
return [confirmPassword, password];
|
|
102
126
|
}
|
|
103
127
|
});
|
|
@@ -106,7 +130,7 @@ Modulo HTML completo con campi required e script di esempio per una regola perso
|
|
|
106
130
|
formValidate.validator(event => {
|
|
107
131
|
const values = Object.fromEntries(new FormData(form));
|
|
108
132
|
|
|
109
|
-
//
|
|
133
|
+
// Replace this log with a request to your backend.
|
|
110
134
|
console.log(values);
|
|
111
135
|
}, "submit");
|
|
112
136
|
</script>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<!-- Automatically generated from reference/html/components/formAddon.html. Edit reference/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
|
+
- `chip`: presents an individual checkbox or radio option as a compact selectable button.
|
|
13
|
+
- `chips`: groups twoState controls into a compact segmented selector.
|
|
14
|
+
|
|
15
|
+
## Related elements
|
|
16
|
+
|
|
17
|
+
- `form`: applies the base form styles to the complete add-on example.
|
|
18
|
+
- `flexColumn`: vertically arranges each example with its heading and control.
|
|
19
|
+
- `flexRow`: horizontally arranges standalone chip controls.
|
|
20
|
+
- `gapElements`: applies element spacing between the form add-on examples.
|
|
21
|
+
|
|
22
|
+
## Output
|
|
23
|
+
|
|
24
|
+
HTML examples of the checkboxBackground, twoState, toggle, and chips form controls using native checkbox and radio inputs.
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<form pgs="form flexColumn gapElements">
|
|
30
|
+
<section pgs="flexColumn">
|
|
31
|
+
<strong>Checkbox with background</strong>
|
|
32
|
+
|
|
33
|
+
<label pgs="checkboxBackground">
|
|
34
|
+
<input type="checkbox" name="notifications" value="enabled">
|
|
35
|
+
<span>
|
|
36
|
+
<strong>Enable notifications</strong><br>
|
|
37
|
+
Receive important account updates.
|
|
38
|
+
</span>
|
|
39
|
+
</label>
|
|
40
|
+
</section>
|
|
41
|
+
|
|
42
|
+
<section pgs="flexColumn">
|
|
43
|
+
<strong>Two-state controls</strong>
|
|
44
|
+
|
|
45
|
+
<label pgs="twoState">
|
|
46
|
+
<input type="checkbox" name="favorite" value="yes">
|
|
47
|
+
<i class="fa-solid fa-star" aria-hidden="true"></i>
|
|
48
|
+
Add to favorites
|
|
49
|
+
</label>
|
|
50
|
+
</section>
|
|
51
|
+
|
|
52
|
+
<section pgs="flexColumn">
|
|
53
|
+
<strong>Toggle</strong>
|
|
54
|
+
|
|
55
|
+
<label pgs="toggle">
|
|
56
|
+
<span>Enable Wi-Fi</span>
|
|
57
|
+
<input type="checkbox" name="darkMode" value="enabled">
|
|
58
|
+
</label>
|
|
59
|
+
</section>
|
|
60
|
+
|
|
61
|
+
<section pgs="flexColumn">
|
|
62
|
+
<strong>Chips checkbox</strong>
|
|
63
|
+
<div pgs="flexRow" role="group" aria-label="Chip actions">
|
|
64
|
+
<label pgs="chip">
|
|
65
|
+
<input type="checkbox" name="like" value="basic">
|
|
66
|
+
<i class="fa-solid fa-heart"></i>
|
|
67
|
+
Like
|
|
68
|
+
</label>
|
|
69
|
+
<label pgs="chip">
|
|
70
|
+
<input type="checkbox" name="share" value="basic">
|
|
71
|
+
<i class="fa-solid fa-share"></i>
|
|
72
|
+
Share
|
|
73
|
+
</label>
|
|
74
|
+
</div>
|
|
75
|
+
</section>
|
|
76
|
+
|
|
77
|
+
<section pgs="flexColumn gapElements">
|
|
78
|
+
<fieldset pgs="chips">
|
|
79
|
+
<legend>Chip checkbox</legend>
|
|
80
|
+
<label>
|
|
81
|
+
<input type="checkbox" name="plan" value="basic" checked>
|
|
82
|
+
Basic
|
|
83
|
+
</label>
|
|
84
|
+
|
|
85
|
+
<label>
|
|
86
|
+
<input type="checkbox" name="plan" value="pro">
|
|
87
|
+
Pro
|
|
88
|
+
</label>
|
|
89
|
+
|
|
90
|
+
<label>
|
|
91
|
+
<input type="checkbox" name="plan" value="enterprise">
|
|
92
|
+
Enterprise
|
|
93
|
+
</label>
|
|
94
|
+
</fieldset>
|
|
95
|
+
|
|
96
|
+
<fieldset pgs="chips">
|
|
97
|
+
<legend>Chips radio</legend>
|
|
98
|
+
<label>
|
|
99
|
+
<input type="radio" name="characters" value="basic" checked>
|
|
100
|
+
<i class="fa-solid fa-crow"></i>
|
|
101
|
+
Crow
|
|
102
|
+
</label>
|
|
103
|
+
|
|
104
|
+
<label>
|
|
105
|
+
<i class="fa-solid fa-dove"></i> <input type="radio" name="characters" value="pro">
|
|
106
|
+
Dove
|
|
107
|
+
</label>
|
|
108
|
+
|
|
109
|
+
<label>
|
|
110
|
+
<i class="fa-solid fa-dragon"></i> <input type="radio" name="characters" value="enterprise">
|
|
111
|
+
dragon
|
|
112
|
+
</label>
|
|
113
|
+
</fieldset>
|
|
114
|
+
</section>
|
|
115
|
+
</form>
|
|
116
|
+
```
|
package/docs/components/logo.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from reference/html/components/logo.html. Edit reference/html/components/logo.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Logo
|
|
4
4
|
|
|
5
|
-
|
|
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`:
|
|
10
|
-
- `logo-image`:
|
|
11
|
-
- `logo-text`:
|
|
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`:
|
|
16
|
-
- `logoDarkmodeFixed`:
|
|
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`:
|
|
20
|
+
- `darkmode`: global document state that activates the logoDarkmode variant.
|
|
21
21
|
|
|
22
22
|
## Output
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
HTML examples of the theme-aware graphical logo and the text logo.
|
|
25
25
|
|
|
26
|
-
##
|
|
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="
|
|
33
|
+
<a aria-label="Text logo" pgs="logo" href="/">
|
|
34
34
|
<span pgs="logo-text">MyPGS</span>
|
|
35
35
|
</a>
|
|
36
36
|
```
|