mypgs 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -25
- package/assets/scss/components/_accordion.scss +0 -2
- package/assets/scss/components/_button.scss +1 -1
- package/assets/scss/components/_form.scss +0 -16
- package/assets/scss/components/_formAddon.scss +18 -0
- package/assets/scss/components/_modals.scss +5 -3
- package/assets/scss/components/_search.scss +2 -2
- 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 +6 -2
- 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 +3 -5
- 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/demo/demo.js +4 -3
- package/dist/css/index.css +1166 -1517
- package/dist/css/index.css.map +1 -1
- package/dist/css/index.min.css +1 -1
- package/docs/componenti-e-markup.md +6 -5
- package/docs/components/accordion.md +22 -22
- package/docs/components/badges.md +19 -19
- package/docs/components/breadcumbs.md +8 -8
- package/docs/components/button.md +17 -17
- package/docs/components/card.md +19 -19
- package/docs/components/dropdown.md +29 -29
- package/docs/components/form.md +63 -40
- package/docs/components/formAddon.md +79 -0
- package/docs/components/logo.md +11 -11
- package/docs/components/menu.md +20 -20
- package/docs/components/modal.md +46 -46
- package/docs/components/notification.md +34 -34
- package/docs/components/search.md +51 -50
- package/docs/components/slides.md +39 -39
- package/docs/components/stepTabs.md +41 -41
- 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 +22 -22
- package/docs/convenzioni.md +11 -11
- package/docs/export-e-sviluppo.md +3 -3
- package/docs/helper-javascript.md +7 -7
- package/docs/layout/body.md +11 -11
- package/docs/layout/flex.md +44 -44
- package/docs/layout/footer.md +23 -23
- package/docs/layout/grid.md +44 -44
- package/docs/layout/header.md +34 -34
- package/docs/layout/pageShell.md +11 -11
- package/docs/layout/section.md +26 -26
- package/docs/patterns/cookieConsent.md +38 -38
- package/docs/utilizzo-css-scss.md +8 -8
- package/package.json +1 -1
- package/scripts/generate-component-docs.js +5 -5
- package/templates/html/components/accordion.html +19 -19
- package/templates/html/components/badges.html +17 -17
- package/templates/html/components/breadcumbs.html +6 -6
- package/templates/html/components/button.html +15 -15
- package/templates/html/components/card.html +17 -17
- package/templates/html/components/dropdown.html +25 -25
- package/templates/html/components/form.html +58 -35
- package/templates/html/components/formAddon.html +72 -0
- package/templates/html/components/logo.html +9 -9
- package/templates/html/components/menu.html +16 -16
- package/templates/html/components/modal.html +42 -42
- package/templates/html/components/notification.html +30 -30
- package/templates/html/components/search.html +43 -42
- package/templates/html/components/slides.html +31 -31
- package/templates/html/components/stepTabs.html +37 -37
- package/templates/html/components/steps.html +13 -13
- package/templates/html/components/summary.html +17 -17
- package/templates/html/components/table.html +5 -5
- package/templates/html/components/tooltip.html +18 -18
- package/templates/html/layout/body.html +9 -10
- package/templates/html/layout/flex.html +42 -42
- package/templates/html/layout/footer.html +20 -20
- package/templates/html/layout/grid.html +42 -42
- package/templates/html/layout/header.html +32 -32
- package/templates/html/layout/pageShell.html +8 -8
- package/templates/html/layout/section.html +24 -24
- package/templates/html/patterns/cookieConsent.html +33 -33
- 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 +2 -2
- package/templates/react/components/modal.jsx +14 -14
- package/templates/react/components/notification.jsx +3 -3
- 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 +3 -3
- package/templates/react/patterns/header.jsx +3 -3
package/docs/components/form.md
CHANGED
|
@@ -1,79 +1,102 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from templates/html/components/form.html. Edit templates/html/components/form.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Form
|
|
4
4
|
|
|
5
|
-
|
|
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
21
|
|
|
22
|
-
## API
|
|
22
|
+
## JavaScript API
|
|
23
23
|
|
|
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)`:
|
|
24
|
+
- `new pgs.formValidate(form, options)`: creates a utility associated directly with the form, automatically adds novalidate, and accepts fieldError, fieldsError, and success in options.message; messages remain editable through instance.message.
|
|
25
|
+
- `instance.validator(callback, eventName)`: intercepts the specified event, prevents its default behavior, validates the form, shows the success message, and invokes callback only when valid; eventName defaults to submit.
|
|
26
|
+
- `instance.validate()`: validates required fields, updates state attributes, and returns true or false.
|
|
27
|
+
- `instance.success(text)`: validates the form and shows a success toast when there are no errors.
|
|
28
|
+
- `instance.addNewRule(rule)`: adds a function that returns one or more invalid fields; validate automatically applies addFieldError to each field.
|
|
29
|
+
- `instance.addFieldError(field, index, total)`: marks a field as invalid; shows the specific message for one error or a summary message for multiple errors.
|
|
30
|
+
- `instance.removeFieldError(field)`: removes the error state from the specified field.
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Related elements
|
|
33
33
|
|
|
34
|
-
- `buttonStrong`:
|
|
34
|
+
- `buttonStrong`: presents form submission as the primary action.
|
|
35
|
+
- `flexColumnTexts`: spaces text elements in the radio group.
|
|
35
36
|
|
|
36
37
|
## Output
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
Complete HTML form with required fields and an example script for a custom rule, validation, and a success message.
|
|
39
40
|
|
|
40
|
-
##
|
|
41
|
+
## Example
|
|
41
42
|
|
|
42
43
|
```html
|
|
43
44
|
<form pgs="form formValidate" action="#" method="post">
|
|
44
45
|
<label pgs="label" for="form-name">
|
|
45
|
-
|
|
46
|
+
Name
|
|
46
47
|
</label>
|
|
47
|
-
<input id="form-name" pgs="input" pgs-option="message[
|
|
48
|
+
<input id="form-name" pgs="input" pgs-option="message[Enter your name]" type="text" name="name" placeholder="John Smith" required>
|
|
48
49
|
|
|
49
50
|
<label pgs="label" for="form-email">
|
|
50
51
|
Email
|
|
51
52
|
</label>
|
|
52
|
-
<input id="form-email" pgs="input" pgs-option="message[
|
|
53
|
+
<input id="form-email" pgs="input" pgs-option="message[Enter a valid email address]" type="email" name="email" placeholder="name@example.com" required>
|
|
53
54
|
|
|
54
55
|
<label pgs="label" for="form-password">
|
|
55
56
|
Password
|
|
56
57
|
</label>
|
|
57
|
-
<input id="form-password" pgs="input" pgs-option="message[
|
|
58
|
+
<input id="form-password" pgs="input" pgs-option="message[Enter a password]" type="password" name="password" autocomplete="new-password" required>
|
|
58
59
|
|
|
59
60
|
<label pgs="label" for="form-confirm-password">
|
|
60
|
-
|
|
61
|
+
Confirm password
|
|
61
62
|
</label>
|
|
62
|
-
<input id="form-confirm-password" pgs="input" pgs-option="message[
|
|
63
|
+
<input id="form-confirm-password" pgs="input" pgs-option="message[Confirm your password]" type="password" name="confirmPassword" autocomplete="new-password" required>
|
|
63
64
|
|
|
64
65
|
<label pgs="label" for="form-message">
|
|
65
|
-
|
|
66
|
+
Message
|
|
66
67
|
</label>
|
|
67
|
-
<textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
68
|
+
<textarea id="form-message" pgs="textarea" name="message" rows="5" placeholder="Write your message" required></textarea>
|
|
69
|
+
|
|
70
|
+
<br>
|
|
71
|
+
<fieldset pgs="radio flexColumnTexts">
|
|
72
|
+
<legend>Preferred contact method</legend>
|
|
73
|
+
|
|
74
|
+
<label>
|
|
75
|
+
<input type="radio" name="contactMethod" value="email" pgs-option="message[Choose a contact method]" required>
|
|
76
|
+
<span>Email</span>
|
|
77
|
+
</label>
|
|
78
|
+
|
|
79
|
+
<label>
|
|
80
|
+
<input type="radio" name="contactMethod" value="phone">
|
|
81
|
+
<span>Phone</span>
|
|
82
|
+
</label>
|
|
83
|
+
|
|
84
|
+
<label>
|
|
85
|
+
<input type="radio" name="contactMethod" value="message">
|
|
86
|
+
<span>Direct message</span>
|
|
87
|
+
</label>
|
|
88
|
+
</fieldset>
|
|
89
|
+
<br>
|
|
90
|
+
|
|
91
|
+
<label>
|
|
71
92
|
<input type="checkbox" name="privacy" required>
|
|
93
|
+
<span>I accept the privacy policy</span>
|
|
72
94
|
</label>
|
|
95
|
+
<br>
|
|
73
96
|
|
|
74
97
|
<button pgs="buttonStrong" type="submit">
|
|
75
98
|
<i class="fa-solid fa-paper-plane" aria-hidden="true"></i>
|
|
76
|
-
|
|
99
|
+
Submit
|
|
77
100
|
</button>
|
|
78
101
|
</form>
|
|
79
102
|
|
|
@@ -88,16 +111,16 @@ Modulo HTML completo con campi required e script di esempio per una regola perso
|
|
|
88
111
|
|
|
89
112
|
const formValidate = new pgs.formValidate(form, {
|
|
90
113
|
message: {
|
|
91
|
-
fieldError: "
|
|
92
|
-
fieldsError: "
|
|
93
|
-
success: "
|
|
114
|
+
fieldError: "Please complete this field",
|
|
115
|
+
fieldsError: "Please complete all required fields",
|
|
116
|
+
success: "Submitted successfully"
|
|
94
117
|
}
|
|
95
118
|
});
|
|
96
119
|
|
|
97
120
|
//== new roules
|
|
98
121
|
formValidate.addNewRule(() => {
|
|
99
122
|
if (password.value && confirmPassword.value && password.value !== confirmPassword.value) {
|
|
100
|
-
pgs(confirmPassword).option.setValueBrackets("message", "
|
|
123
|
+
pgs(confirmPassword).option.setValueBrackets("message", "Passwords do not match");
|
|
101
124
|
return [confirmPassword, password];
|
|
102
125
|
}
|
|
103
126
|
});
|
|
@@ -106,7 +129,7 @@ Modulo HTML completo con campi required e script di esempio per una regola perso
|
|
|
106
129
|
formValidate.validator(event => {
|
|
107
130
|
const values = Object.fromEntries(new FormData(form));
|
|
108
131
|
|
|
109
|
-
//
|
|
132
|
+
// Replace this log with a request to your backend.
|
|
110
133
|
console.log(values);
|
|
111
134
|
}, "submit");
|
|
112
135
|
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!-- Automatically generated from templates/html/components/formAddon.html. Edit templates/html/components/formAddon.html and run npm run docs:generate again. -->
|
|
2
|
+
|
|
3
|
+
# Form Add-ons
|
|
4
|
+
|
|
5
|
+
Additional form controls for selectable cards, two-state buttons, switches, and compact chip groups.
|
|
6
|
+
|
|
7
|
+
## PGS
|
|
8
|
+
|
|
9
|
+
- `checkboxBackground`: presents a checkbox as a selectable container with a highlighted checked state.
|
|
10
|
+
- `twoState`: presents checkbox or radio labels as buttons whose appearance changes when selected.
|
|
11
|
+
- `toggle`: presents a checkbox as a switch with a rail and movable thumb.
|
|
12
|
+
- `chips`: groups twoState controls into a compact segmented selector.
|
|
13
|
+
|
|
14
|
+
## Related elements
|
|
15
|
+
|
|
16
|
+
- `flexColumnElements`: vertically arranges the form add-on examples.
|
|
17
|
+
- `flexColumnTexts`: groups each example with its heading and control.
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
|
|
21
|
+
HTML examples of the checkboxBackground, twoState, toggle, and chips form controls using native checkbox and radio inputs.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<div pgs="flexColumnElements">
|
|
27
|
+
<section pgs="flexColumnTexts">
|
|
28
|
+
<strong>Checkbox with background</strong>
|
|
29
|
+
|
|
30
|
+
<label pgs="checkboxBackground">
|
|
31
|
+
<input type="checkbox" name="notifications" value="enabled">
|
|
32
|
+
<span>
|
|
33
|
+
<strong>Enable notifications</strong><br>
|
|
34
|
+
Receive important account updates.
|
|
35
|
+
</span>
|
|
36
|
+
</label>
|
|
37
|
+
</section>
|
|
38
|
+
|
|
39
|
+
<section pgs="flexColumnTexts">
|
|
40
|
+
<strong>Two-state controls</strong>
|
|
41
|
+
|
|
42
|
+
<label pgs="twoState">
|
|
43
|
+
<input type="checkbox" name="favorite" value="yes">
|
|
44
|
+
<i class="fa-solid fa-star" aria-hidden="true"></i>
|
|
45
|
+
Add to favorites
|
|
46
|
+
</label>
|
|
47
|
+
</section>
|
|
48
|
+
|
|
49
|
+
<section pgs="flexColumnTexts">
|
|
50
|
+
<strong>Toggle</strong>
|
|
51
|
+
|
|
52
|
+
<label pgs="toggle">
|
|
53
|
+
<span>Enable dark mode</span>
|
|
54
|
+
<input type="checkbox" name="darkMode" value="enabled">
|
|
55
|
+
</label>
|
|
56
|
+
</section>
|
|
57
|
+
|
|
58
|
+
<section pgs="flexColumnTexts">
|
|
59
|
+
<strong>Chips</strong>
|
|
60
|
+
|
|
61
|
+
<div pgs="chips" role="group" aria-label="Select a plan">
|
|
62
|
+
<label pgs="twoState">
|
|
63
|
+
<input type="radio" name="plan" value="basic" checked>
|
|
64
|
+
Basic
|
|
65
|
+
</label>
|
|
66
|
+
|
|
67
|
+
<label pgs="twoState">
|
|
68
|
+
<input type="radio" name="plan" value="pro">
|
|
69
|
+
Pro
|
|
70
|
+
</label>
|
|
71
|
+
|
|
72
|
+
<label pgs="twoState">
|
|
73
|
+
<input type="radio" name="plan" value="enterprise">
|
|
74
|
+
Enterprise
|
|
75
|
+
</label>
|
|
76
|
+
</div>
|
|
77
|
+
</section>
|
|
78
|
+
</div>
|
|
79
|
+
```
|
package/docs/components/logo.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from templates/html/components/logo.html. Edit templates/html/components/logo.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Logo
|
|
4
4
|
|
|
5
|
-
|
|
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
|
```
|
package/docs/components/menu.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from templates/html/components/menu.html. Edit templates/html/components/menu.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Menu
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Menu markup, configuration, behavior, and usage example.
|
|
6
6
|
|
|
7
7
|
## PGS
|
|
8
8
|
|
|
9
|
-
- `menu`:
|
|
10
|
-
- `menu-buttonIcon`:
|
|
9
|
+
- `menu`: identifies the menu element used by Menu.
|
|
10
|
+
- `menu-buttonIcon`: identifies the menu-buttonIcon element used by Menu.
|
|
11
11
|
|
|
12
12
|
## PGS Options
|
|
13
13
|
|
|
14
|
-
- `horizontal`:
|
|
15
|
-
- `vertical`:
|
|
16
|
-
- `menuHeader`:
|
|
17
|
-
- `position`:
|
|
14
|
+
- `horizontal`: identifies the horizontal element used by Menu.
|
|
15
|
+
- `vertical`: identifies the vertical element used by Menu.
|
|
16
|
+
- `menuHeader`: identifies the menuHeader element used by Menu.
|
|
17
|
+
- `position`: identifies the position element used by Menu.
|
|
18
18
|
|
|
19
19
|
## PGS States
|
|
20
20
|
|
|
21
|
-
- `open`:
|
|
21
|
+
- `open`: identifies the open element used by Menu.
|
|
22
22
|
|
|
23
|
-
## API
|
|
23
|
+
## JavaScript API
|
|
24
24
|
|
|
25
|
-
- `pgs.menu.init(root)`:
|
|
26
|
-
- `pgs.menu.api(element)`:
|
|
27
|
-
- `instance.refresh()`:
|
|
25
|
+
- `pgs.menu.init(root)`: initializes matching elements within the specified root.
|
|
26
|
+
- `pgs.menu.api(element)`: returns the instance associated with the specified initialized element.
|
|
27
|
+
- `instance.refresh()`: refreshes the component and returns its updated instance.
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Related elements
|
|
30
30
|
|
|
31
|
-
- `dropdown`:
|
|
32
|
-
- `dropdown-button`:
|
|
33
|
-
- `buttonNohover`:
|
|
34
|
-
- `dropdown-content`:
|
|
31
|
+
- `dropdown`: uses the related dropdown component or utility in this example.
|
|
32
|
+
- `dropdown-button`: uses the related dropdown-button component or utility in this example.
|
|
33
|
+
- `buttonNohover`: uses the related buttonNohover component or utility in this example.
|
|
34
|
+
- `dropdown-content`: uses the related dropdown-content component or utility in this example.
|
|
35
35
|
|
|
36
36
|
## Output
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Complete HTML markup and usage example for Menu.
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Example
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
43
|
<nav pgs="menu" pgs-option="horizontal" aria-label="Menu orizzontale">
|
package/docs/components/modal.md
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!-- Automatically generated from templates/html/components/modal.html. Edit templates/html/components/modal.html and run npm run docs:generate again. -->
|
|
2
2
|
|
|
3
3
|
# Modal
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Modal markup, configuration, behavior, and usage example.
|
|
6
6
|
|
|
7
7
|
## PGS
|
|
8
8
|
|
|
9
|
-
- `modal`:
|
|
10
|
-
- `modal-button`:
|
|
9
|
+
- `modal`: identifies the modal element used by Modal.
|
|
10
|
+
- `modal-button`: identifies the modal-button element used by Modal.
|
|
11
11
|
- `dialog`: token aggiunto dinamicamente all'elemento dialog inizializzato.
|
|
12
|
-
- `modal-dialog`:
|
|
13
|
-
- `modal-dialog-content`:
|
|
14
|
-
- `modal-dialog-content-header`:
|
|
15
|
-
- `modal-dialog-content-scroll`:
|
|
16
|
-
- `modal-close`:
|
|
12
|
+
- `modal-dialog`: identifies the modal-dialog element used by Modal.
|
|
13
|
+
- `modal-dialog-content`: identifies the modal-dialog-content element used by Modal.
|
|
14
|
+
- `modal-dialog-content-header`: identifies the modal-dialog-content-header element used by Modal.
|
|
15
|
+
- `modal-dialog-content-scroll`: identifies the modal-dialog-content-scroll element used by Modal.
|
|
16
|
+
- `modal-close`: identifies the modal-close element used by Modal.
|
|
17
17
|
|
|
18
18
|
## PGS Options
|
|
19
19
|
|
|
20
|
-
- `containerID`:
|
|
21
|
-
- `containerPGS`:
|
|
22
|
-
- `disableBackdropClose`:
|
|
23
|
-
- `history`:
|
|
24
|
-
- `topLevel`:
|
|
25
|
-
- `left`:
|
|
26
|
-
- `right`:
|
|
20
|
+
- `containerID`: identifies the containerID element used by Modal.
|
|
21
|
+
- `containerPGS`: identifies the containerPGS element used by Modal.
|
|
22
|
+
- `disableBackdropClose`: identifies the disableBackdropClose element used by Modal.
|
|
23
|
+
- `history`: identifies the history element used by Modal.
|
|
24
|
+
- `topLevel`: identifies the topLevel element used by Modal.
|
|
25
|
+
- `left`: identifies the left element used by Modal.
|
|
26
|
+
- `right`: identifies the right element used by Modal.
|
|
27
27
|
|
|
28
|
-
## API
|
|
28
|
+
## JavaScript API
|
|
29
29
|
|
|
30
|
-
- `pgs.modal.init(root)`:
|
|
31
|
-
- `pgs.modal.api(element)`:
|
|
32
|
-
- `instance.open()`:
|
|
33
|
-
- `instance.close()`:
|
|
34
|
-
- `instance.toggle()`:
|
|
35
|
-
- `instance.refresh()`:
|
|
36
|
-
- `instance.isOpen()`:
|
|
30
|
+
- `pgs.modal.init(root)`: initializes matching elements within the specified root.
|
|
31
|
+
- `pgs.modal.api(element)`: returns the instance associated with the specified initialized element.
|
|
32
|
+
- `instance.open()`: opens the component.
|
|
33
|
+
- `instance.close()`: closes the component.
|
|
34
|
+
- `instance.toggle()`: toggles the component state.
|
|
35
|
+
- `instance.refresh()`: refreshes the component and returns its updated instance.
|
|
36
|
+
- `instance.isOpen()`: returns true when the component is open.
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## Related elements
|
|
39
39
|
|
|
40
|
-
- `button`:
|
|
41
|
-
- `buttonStrong`:
|
|
42
|
-
- `buttonClose`:
|
|
43
|
-
- `flexColumnElements`:
|
|
44
|
-
- `flexRow`:
|
|
40
|
+
- `button`: uses the related button component or utility in this example.
|
|
41
|
+
- `buttonStrong`: uses the related buttonStrong component or utility in this example.
|
|
42
|
+
- `buttonClose`: uses the related buttonClose component or utility in this example.
|
|
43
|
+
- `flexColumnElements`: uses the related flexColumnElements component or utility in this example.
|
|
44
|
+
- `flexRow`: uses the related flexRow component or utility in this example.
|
|
45
45
|
|
|
46
46
|
## Output
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Complete HTML markup and usage example for Modal.
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## Example
|
|
51
51
|
|
|
52
52
|
```html
|
|
53
53
|
<div pgs="modal" pgs-option="containerID[modal-container]">
|
|
54
54
|
<button pgs="modal-button button" type="button">
|
|
55
|
-
<i class="fa-solid fa-window-maximize"></i>
|
|
55
|
+
<i class="fa-solid fa-window-maximize"></i> Open modal
|
|
56
56
|
</button>
|
|
57
57
|
|
|
58
58
|
<dialog>
|
|
59
59
|
<div pgs="modal-dialog-content">
|
|
60
60
|
<div pgs="modal-dialog-content-header">
|
|
61
|
-
<h3>
|
|
61
|
+
<h3>Example modal</h3>
|
|
62
62
|
</div>
|
|
63
63
|
|
|
64
64
|
<div pgs="modal-dialog-content-scroll">
|
|
65
|
-
<p>
|
|
65
|
+
<p>Modal content. The close button is added automatically when missing.</p>
|
|
66
66
|
</div>
|
|
67
67
|
</div>
|
|
68
68
|
</dialog>
|
|
@@ -70,17 +70,17 @@ Quattro esempi basati su dialog nativo e un contenitore opzionale usato da conta
|
|
|
70
70
|
|
|
71
71
|
<div pgs="modal" pgs-option="containerID[modal-container]">
|
|
72
72
|
<button pgs="modal-button button" type="button">
|
|
73
|
-
<i class="fa-solid fa-window-maximize"></i>
|
|
73
|
+
<i class="fa-solid fa-window-maximize"></i> Open modal right
|
|
74
74
|
</button>
|
|
75
75
|
|
|
76
76
|
<dialog pgs-option="right">
|
|
77
77
|
<div pgs="modal-dialog-content">
|
|
78
78
|
<div pgs="modal-dialog-content-header">
|
|
79
|
-
<h3>
|
|
79
|
+
<h3>Side modal</h3>
|
|
80
80
|
</div>
|
|
81
81
|
|
|
82
82
|
<div pgs="modal-dialog-content-scroll">
|
|
83
|
-
<p>
|
|
83
|
+
<p>Modal content with <code>pgs-option="right"</code>.</p>
|
|
84
84
|
</div>
|
|
85
85
|
</div>
|
|
86
86
|
</dialog>
|
|
@@ -88,17 +88,17 @@ Quattro esempi basati su dialog nativo e un contenitore opzionale usato da conta
|
|
|
88
88
|
|
|
89
89
|
<div pgs="modal" pgs-option="containerID[modal-container]">
|
|
90
90
|
<button pgs="modal-button button" type="button">
|
|
91
|
-
<i class="fa-solid fa-window-maximize"></i>
|
|
91
|
+
<i class="fa-solid fa-window-maximize"></i> Open modal left
|
|
92
92
|
</button>
|
|
93
93
|
|
|
94
94
|
<dialog pgs-option="left">
|
|
95
95
|
<div pgs="modal-dialog-content">
|
|
96
96
|
<div pgs="modal-dialog-content-header">
|
|
97
|
-
<h3>
|
|
97
|
+
<h3>Left-side modal</h3>
|
|
98
98
|
</div>
|
|
99
99
|
|
|
100
100
|
<div pgs="modal-dialog-content-scroll">
|
|
101
|
-
<p>
|
|
101
|
+
<p>Modal content with <code>pgs-option="left"</code>.</p>
|
|
102
102
|
</div>
|
|
103
103
|
</div>
|
|
104
104
|
</dialog>
|
|
@@ -106,21 +106,21 @@ Quattro esempi basati su dialog nativo e un contenitore opzionale usato da conta
|
|
|
106
106
|
|
|
107
107
|
<div pgs="modal">
|
|
108
108
|
<button pgs="modal-button button" type="button">
|
|
109
|
-
<i class="fa-solid fa-floppy-disk"></i>
|
|
109
|
+
<i class="fa-solid fa-floppy-disk"></i> Confirmation salvataggio
|
|
110
110
|
</button>
|
|
111
111
|
|
|
112
112
|
<dialog pgs-option="topLevel">
|
|
113
113
|
<div pgs="modal-dialog-content">
|
|
114
114
|
<div pgs="modal-dialog-content-header">
|
|
115
|
-
<h3>
|
|
115
|
+
<h3>Save changes?</h3>
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div pgs="modal-dialog-content-scroll flexColumnElements">
|
|
119
|
-
<p>
|
|
119
|
+
<p>You have unsaved changes. Confirm to apply them or cancel to return to the page.</p>
|
|
120
120
|
|
|
121
121
|
<div pgs="flexRow">
|
|
122
|
-
<button pgs="button modal-close" type="button">
|
|
123
|
-
<button pgs="buttonStrong" type="button">
|
|
122
|
+
<button pgs="button modal-close" type="button">Cancel</button>
|
|
123
|
+
<button pgs="buttonStrong" type="button">Save changes</button>
|
|
124
124
|
</div>
|
|
125
125
|
</div>
|
|
126
126
|
</div>
|