mypgs 1.1.5 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/AI_GUIDELINES.md +353 -0
  2. package/README.md +483 -53
  3. package/assets/javascript/_imports.js +26 -0
  4. package/assets/javascript/_pgs.js +53 -2
  5. package/assets/javascript/components/_accordion.js +114 -66
  6. package/assets/javascript/components/_dropdown.js +199 -98
  7. package/assets/javascript/components/_menu.js +33 -69
  8. package/assets/javascript/components/_modals.js +44 -3
  9. package/assets/javascript/components/_notifications.js +162 -0
  10. package/assets/javascript/components/_slides.js +11 -1
  11. package/assets/javascript/components/_stepTabs.js +16 -4
  12. package/assets/javascript/components/_steps.js +32 -6
  13. package/assets/javascript/functions/_formValidate.js +4 -5
  14. package/assets/javascript/index.js +8 -4
  15. package/assets/javascript/patterns/_cookieConsent.js +8 -2
  16. package/assets/javascript/patterns/_header.js +1 -1
  17. package/assets/javascript/pgs.d.ts +17 -2
  18. package/assets/scss/base/_html.scss +23 -1
  19. package/assets/scss/components/_dropdown.scss +24 -88
  20. package/assets/scss/components/_logo.scss +1 -1
  21. package/assets/scss/components/_menu.scss +129 -15
  22. package/assets/scss/components/_modals.scss +15 -3
  23. package/assets/scss/components/_notification.scss +11 -14
  24. package/assets/scss/components/_tooltip.scss +2 -9
  25. package/assets/scss/index.scss +0 -1
  26. package/assets/scss/layout/_gap.scss +7 -1
  27. package/assets/scss/layout/_layout.scss +0 -12
  28. package/assets/scss/layout/_pageShell.scss +102 -108
  29. package/assets/scss/mixin/_mx-form.scss +1 -3
  30. package/assets/scss/mixin/_mx-responsive.scss +2 -2
  31. package/assets/scss/mixin/_mx-semantic.scss +0 -60
  32. package/assets/scss/mixin/mixin.scss +0 -1
  33. package/assets/scss/patterns/_footer.scss +1 -0
  34. package/assets/scss/patterns/_header.scss +20 -18
  35. package/dist/css/index.css +325 -1161
  36. package/dist/css/index.css.map +1 -1
  37. package/dist/css/index.min.css +1 -1
  38. package/dist/index.d.ts +17 -2
  39. package/dist/javascript/index.js +985 -412
  40. package/dist/javascript/index.js.map +1 -1
  41. package/dist/javascript/index.min.js +1 -1
  42. package/package.json +7 -2
  43. package/templates/components/{md-accordion.html → accordion.html} +2 -2
  44. package/templates/components/dropdown.html +91 -0
  45. package/templates/components/menu.html +41 -0
  46. package/templates/components/modal.html +78 -0
  47. package/templates/components/notification.html +35 -0
  48. package/templates/components/{md-slides.html → slides.html} +5 -5
  49. package/templates/components/{md-steps.html → steps.html} +7 -7
  50. package/templates/components/{md-tooltip.html → tooltip.html} +4 -2
  51. package/templates/demo.css +18 -0
  52. package/templates/demo.html +4 -5
  53. package/templates/demo.js +53 -52
  54. package/templates/layout/flex.html +89 -0
  55. package/templates/layout/grid.html +89 -0
  56. package/templates/layout/pageShell.html +59 -0
  57. package/templates/layout/section.html +40 -0
  58. package/templates/{layout/md-footer.html → patterns/footer.html} +1 -0
  59. package/templates/{layout/md-header.html → patterns/header.html} +6 -9
  60. package/assets/javascript/components/_exeNotifications.js +0 -85
  61. package/assets/javascript/functions/_notifications.js +0 -74
  62. package/assets/javascript/functions/_sendForm.js +0 -100
  63. package/assets/scss/base/_reset.scss +0 -15
  64. package/assets/scss/mixin/_mx-menu.scss +0 -154
  65. package/templates/components/md-dropdown.html +0 -16
  66. package/templates/components/md-menu.html +0 -40
  67. package/templates/components/md-modal.html +0 -19
  68. package/templates/components/md-notification.html +0 -13
  69. package/templates/layout/md-pageShell.html +0 -22
  70. package/templates/layout/md-section.html +0 -25
  71. /package/templates/components/{md-breadcumbs.html → breadcumbs.html} +0 -0
  72. /package/templates/components/{md-button.html → button.html} +0 -0
  73. /package/templates/components/{md-card.html → card.html} +0 -0
  74. /package/templates/components/{md-form.html → form.html} +0 -0
  75. /package/templates/components/{md-logo.html → logo.html} +0 -0
  76. /package/templates/components/{md-searchbar.html → searchbar.html} +0 -0
  77. /package/templates/components/{md-stepTabs.html → stepTabs.html} +0 -0
  78. /package/templates/components/{md-table.html → table.html} +0 -0
  79. /package/templates/layout/{md-body.html → body.html} +0 -0
  80. /package/templates/{layout/md-cookieConsent.html → patterns/cookieConsent.html} +0 -0
@@ -1,100 +0,0 @@
1
- import { PGS_toast } from "../functions/_notifications.js";
2
- export async function PGS_sendForm(
3
- append = {
4
- formAppend: [
5
- { name: "", value: "" }
6
- ],
7
- wpnonce: {
8
- name: "",
9
- value: ""
10
- },
11
- action: ""
12
- },
13
- tost = {
14
- succesText: "Inviato con succeso",
15
- errorGenericText: "Si è verificato un errore",
16
- infoText: "Invio in corso..."
17
- }, log = true) {
18
-
19
- PGS_toast.info(tost.infoText, -1)
20
-
21
- //== FORM DATA
22
- const formData = new FormData();
23
-
24
- //=== Mandatory data
25
- formData.append(append.wpnonce.name, append.wpnonce.value);
26
- formData.append('action', append.action);
27
-
28
- //=== append esempio
29
- append.formAppend.forEach(item => formData.append(item.name, item.value));
30
-
31
- let status
32
-
33
- try {
34
- const response = await fetch('/wp-admin/admin-ajax.php', {
35
- method: 'POST',
36
- body: formData
37
- });
38
-
39
- if (!response.ok) {
40
- PGS_toast.error(`Errore: ${response.status}`)
41
- status = { success: false, data: [], response: response };
42
- throw new Error(`HTTP error! status: ${response.status}`);
43
- }
44
-
45
- const result = await response.json();
46
-
47
- if (result.success) {
48
- status = result;
49
- PGS_toast.success(tost.succesText)
50
-
51
- } else {
52
- status = result;
53
- PGS_toast.error(result.data ? result.data.message : 'Errore sconosciuto')
54
- console.error(result);
55
- }
56
-
57
- } catch (error) {
58
- status = status ? status : { success: false, data: []};
59
- PGS_toast.error(`Si è verificato un errore nella richiesta.`)
60
- console.error('Errore:', error);
61
- }
62
-
63
- if (log) console.log("Status:", status);
64
- if (log) console.log("formData:", Array.from(formData.entries()));
65
- return status;
66
- }
67
-
68
- /*
69
- let documentForm = document.querySelector("#formExample");
70
- if (documentForm) {
71
- documentForm.addEventListener("submit", function (e) {
72
- e.preventDefault();
73
-
74
- let appendMandatory = {
75
- formAppend: [
76
- {
77
- name: "",
78
- value: ""
79
- },
80
- {
81
- name: "",
82
- value: ""
83
- },
84
- ],
85
- wpnonce: {
86
- name: "testName",
87
- value: "testValue"
88
- },
89
- action: "test_submit_form"
90
- };
91
- let tost = {
92
- succesText: "inviato ottimo",
93
- errorGenericText: "errore invio",
94
- infoText: "Invio in corso...",
95
-
96
- }
97
-
98
- sendBooking(appendMandatory, tost)
99
- })
100
- } */
@@ -1,15 +0,0 @@
1
- //= Reset properties
2
- * {
3
- margin: 0;
4
- padding: 0;
5
- box-sizing: border-box;
6
- scroll-margin-top: calc(var(--heightOfHeader) + 5vh);
7
- }
8
-
9
- :root {
10
- interpolate-size: allow-keywords;
11
- }
12
-
13
- @view-transition {
14
- navigation: auto;
15
- }
@@ -1,154 +0,0 @@
1
- //# MENU
2
- @mixin menu($direction: row, $isHeader: true) {
3
-
4
- >ul {
5
- display: flex;
6
- font-weight: 600;
7
- align-items: center;
8
- flex-direction: $direction;
9
- column-gap: var(--gap-texts);
10
- row-gap: 1.0rem;
11
- // width: 100%;
12
- isolation: isolate;
13
- flex-wrap: nowrap;
14
-
15
- //= Content
16
- >li {
17
-
18
- >a {
19
- flex-grow: 1;
20
- min-width: fit-content;
21
-
22
- @include button();
23
- @if($isHeader) {
24
- @include button_header();
25
- }
26
- span {
27
- line-height: 1.6;
28
- flex-grow: 1;
29
- }
30
- }
31
- }
32
- }
33
-
34
- //= ROW
35
- @if($direction ==row) {
36
- ul {
37
- >li>a {
38
- width: max-content;
39
- }
40
-
41
- //== Sub menu
42
- >li.menu-item-has-children {
43
- display: flex;
44
- gap: 0.2rem;
45
- flex-wrap: nowrap;
46
- isolation: isolate;
47
-
48
- >a {
49
- border-radius: var(--border-radius-input);
50
- // box-shadow: var(--box-shadow);
51
- }
52
-
53
- ul.sub-menu {
54
- &:not([popover]) {
55
- display: none;
56
-
57
- li a {
58
- min-width: 100% !important;
59
- }
60
- }
61
-
62
- &[pgs-state~=open] {
63
- display: flex;
64
- }
65
- }
66
-
67
- //== ICON
68
- button.icon-down {
69
- --button-size: 0.9rem;
70
- margin-right: -15px;
71
- margin-block: auto;
72
- scale: 0.9;
73
- height: min-content;
74
- cursor: pointer;
75
- translate: -15px;
76
- z-index: -1;
77
-
78
- &[aria-expanded="true"] {
79
- span {
80
- rotate: 180deg;
81
- }
82
- }
83
- }
84
- }
85
- }
86
- }
87
-
88
- //= COLUMN
89
- @if($direction ==column) {
90
- ul {
91
- li {
92
- width: -webkit-fill-available;
93
-
94
- >a {
95
- width: 100%;
96
- padding: 1.5rem;
97
- --button-background: transaprent;
98
- }
99
- }
100
-
101
- //== Sub menu
102
- >li:has(ul.sub-menu) {
103
- @include flexRow;
104
- align-items: center;
105
-
106
- button.icon-down {
107
- --button-background: var(--color-boxDark);
108
- --button-color: var(--color-white);
109
- max-height: max-content;
110
- justify-content: center;
111
-
112
- span {
113
- transition: all 300ms;
114
- }
115
-
116
- &[aria-expanded="true"] span {
117
- rotate: 180deg;
118
- }
119
- }
120
-
121
- a {
122
- max-width: calc(90% - var(--gap-texts));
123
- }
124
-
125
- >ul {
126
- flex-basis: 100%;
127
-
128
- &.sub-menu:not([pgs-state~=open]) {
129
- display: none;
130
- }
131
-
132
- &.sub-menu[pgs-state~=open] {
133
- padding-left: 2rem;
134
- margin-left: 2rem;
135
- border-left: solid 2px var(--color-gray);
136
- }
137
- }
138
- }
139
- }
140
- }
141
- }
142
-
143
- @mixin menuFooter() {
144
- ul {
145
- @include flexColumn();
146
-
147
- li {
148
- a {
149
- color: var(--color-text);
150
- font-weight: 600;
151
- }
152
- }
153
- }
154
- }
@@ -1,16 +0,0 @@
1
- <span pgs="dropdown">
2
- <button pgs="dropdown-button button" pgs-option="buttonReverse" type="button">
3
- Apri menu
4
- <i class="fa-solid fa-chevron-down" aria-hidden="true"></i>
5
- </button>
6
-
7
- <div pgs="dropdown-content">
8
- <nav aria-label="Menu dropdown">
9
- <ul>
10
- <li><a href="#">Voce uno</a></li>
11
- <li><a href="#">Voce due</a></li>
12
- <li><a href="#">Voce tre</a></li>
13
- </ul>
14
- </nav>
15
- </div>
16
- </span>
@@ -1,40 +0,0 @@
1
- <nav pgs="menuHorizontal" aria-label="Menu orizzontale">
2
- <ul class="primary-menu">
3
- <li class="menu-item current-menu-item">
4
- <a href="/" aria-current="page">
5
- <i class="fa-solid fa-house" aria-hidden="true"></i>
6
- <span>Home</span>
7
- </a>
8
- </li>
9
- <li class="menu-item menu-item-has-children">
10
- <a href="/servizi">
11
- <i class="fa-solid fa-layer-group" aria-hidden="true"></i>
12
- <span>Servizi</span>
13
- </a>
14
- <ul class="sub-menu">
15
- <li class="menu-item"><a href="/servizi/uno">Servizio uno</a></li>
16
- <li class="menu-item"><a href="/servizi/due">Servizio due</a></li>
17
- </ul>
18
- </li>
19
- <li class="menu-item">
20
- <a href="/contatti">
21
- <i class="fa-solid fa-envelope" aria-hidden="true"></i>
22
- <span>Contatti</span>
23
- </a>
24
- </li>
25
- </ul>
26
- </nav>
27
-
28
- <nav pgs="menuVertical" aria-label="Menu verticale">
29
- <ul>
30
- <li class="menu-item"><a href="#">Voce verticale uno</a></li>
31
- <li class="menu-item"><a href="#">Voce verticale due</a></li>
32
- </ul>
33
- </nav>
34
-
35
- <nav pgs="menuFooter" aria-label="Menu footer">
36
- <ul>
37
- <li class="menu-item"><a href="/privacy-policy">Privacy Policy</a></li>
38
- <li class="menu-item"><a href="/cookie-policy">Cookie Policy</a></li>
39
- </ul>
40
- </nav>
@@ -1,19 +0,0 @@
1
- <div pgs="modal" pgs-option="containerID[modal-container]">
2
- <button pgs="modal-button button" type="button">
3
- <i class="fa-solid fa-window-maximize"></i> Apri modale
4
- </button>
5
-
6
- <dialog>
7
- <div pgs="modal-dialog-content">
8
- <div pgs="modal-dialog-content-header">
9
- <h3>Modale di esempio</h3>
10
- </div>
11
-
12
- <div pgs="modal-dialog-content-scroll">
13
- <p>Contenuto della modale. Il bottone di chiusura viene aggiunto automaticamente se non presente.</p>
14
- </div>
15
- </div>
16
- </dialog>
17
- </div>
18
-
19
- <div id="modal-container"></div>
@@ -1,13 +0,0 @@
1
- <div pgs="notification" aria-live="polite"></div>
2
- <div pgs="toast" aria-live="polite"></div>
3
-
4
- <div pgs="hidden notificationTrigger" data-notification='{
5
- "title":"Titolo",
6
- "message":"Messaggio",
7
- "element":"notification",
8
- "type":"info",
9
- "icon":null,
10
- "duration":"-1",
11
- "link":null
12
- }'>
13
- </div>
@@ -1,22 +0,0 @@
1
- <div pgs="pageShell">
2
- <aside pgs="pageShell-asideLeft aside">
3
- <nav pgs="menuVertical" aria-label="Navigazione laterale">
4
- <ul>
5
- <li><a href="#sezione-uno">Sezione uno</a></li>
6
- <li><a href="#sezione-due">Sezione due</a></li>
7
- </ul>
8
- </nav>
9
- </aside>
10
-
11
- <main pgs="pageShell-content main">
12
- <section pgs="section flexColumnElements" id="sezione-uno">
13
- <p>Contenuto principale della pagina.</p>
14
- </section>
15
- </main>
16
-
17
- <aside pgs="pageShell-asideRight aside">
18
- <div pgs="card flexColumnTexts">
19
- <p>Box laterale</p>
20
- </div>
21
- </aside>
22
- </div>
@@ -1,25 +0,0 @@
1
- <section pgs="section flexColumnElements">
2
- <div pgs="container flexColumnTexts">
3
- <h2>Sezione standard</h2>
4
- <p>Contenuto centrato dentro una sezione MyPGS.</p>
5
- </div>
6
- </section>
7
-
8
- <section pgs="sectionFull flexColumnElements">
9
- <div pgs="grid-3">
10
- <article pgs="card flexColumnTexts">
11
- <h3>Colonna uno</h3>
12
- <p>Contenuto della prima colonna.</p>
13
- </article>
14
-
15
- <article pgs="card flexColumnTexts">
16
- <h3>Colonna due</h3>
17
- <p>Contenuto della seconda colonna.</p>
18
- </article>
19
-
20
- <article pgs="card flexColumnTexts">
21
- <h3>Colonna tre</h3>
22
- <p>Contenuto della terza colonna.</p>
23
- </article>
24
- </div>
25
- </section>
File without changes