mypgs 1.3.6 → 1.3.7

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 (56) hide show
  1. package/{AI_GUIDELINES.md → AGENTS.md} +17 -15
  2. package/README.md +8 -172
  3. package/assets/scss/mixin/_mx-responsive.scss +11 -10
  4. package/dist/css/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/react/components/accordion.jsx +27 -0
  7. package/templates/react/components/breadcumbs.jsx +27 -0
  8. package/templates/react/components/button.jsx +33 -0
  9. package/templates/react/components/card.jsx +27 -0
  10. package/templates/react/components/dropdown.jsx +29 -0
  11. package/templates/react/components/form.jsx +30 -0
  12. package/templates/react/components/logo.jsx +14 -0
  13. package/templates/react/components/menu.jsx +37 -0
  14. package/templates/react/components/modal.jsx +84 -0
  15. package/templates/react/components/notification.jsx +31 -0
  16. package/templates/react/components/searchbar.jsx +34 -0
  17. package/templates/react/components/slides.jsx +25 -0
  18. package/templates/react/components/stepTabs.jsx +40 -0
  19. package/templates/react/components/steps.jsx +21 -0
  20. package/templates/react/components/table.jsx +28 -0
  21. package/templates/react/components/tooltip.jsx +12 -0
  22. package/templates/react/layout/body.jsx +7 -0
  23. package/templates/react/layout/flex.jsx +36 -0
  24. package/templates/react/layout/grid.jsx +36 -0
  25. package/templates/react/layout/pageShell.jsx +48 -0
  26. package/templates/react/layout/section.jsx +44 -0
  27. package/templates/react/patterns/cookieConsent.jsx +62 -0
  28. package/templates/react/patterns/footer.jsx +40 -0
  29. package/templates/react/patterns/header.jsx +62 -0
  30. /package/templates/{components → html/components}/accordion.html +0 -0
  31. /package/templates/{components → html/components}/breadcumbs.html +0 -0
  32. /package/templates/{components → html/components}/button.html +0 -0
  33. /package/templates/{components → html/components}/card.html +0 -0
  34. /package/templates/{components → html/components}/dropdown.html +0 -0
  35. /package/templates/{components → html/components}/form.html +0 -0
  36. /package/templates/{components → html/components}/logo.html +0 -0
  37. /package/templates/{components → html/components}/menu.html +0 -0
  38. /package/templates/{components → html/components}/modal.html +0 -0
  39. /package/templates/{components → html/components}/notification.html +0 -0
  40. /package/templates/{components → html/components}/searchbar.html +0 -0
  41. /package/templates/{components → html/components}/slides.html +0 -0
  42. /package/templates/{components → html/components}/stepTabs.html +0 -0
  43. /package/templates/{components → html/components}/steps.html +0 -0
  44. /package/templates/{components → html/components}/table.html +0 -0
  45. /package/templates/{components → html/components}/tooltip.html +0 -0
  46. /package/templates/{demo.css → html/demo.css} +0 -0
  47. /package/templates/{demo.html → html/demo.html} +0 -0
  48. /package/templates/{demo.js → html/demo.js} +0 -0
  49. /package/templates/{layout → html/layout}/body.html +0 -0
  50. /package/templates/{layout → html/layout}/flex.html +0 -0
  51. /package/templates/{layout → html/layout}/grid.html +0 -0
  52. /package/templates/{layout → html/layout}/pageShell.html +0 -0
  53. /package/templates/{layout → html/layout}/section.html +0 -0
  54. /package/templates/{patterns → html/patterns}/cookieConsent.html +0 -0
  55. /package/templates/{patterns → html/patterns}/footer.html +0 -0
  56. /package/templates/{patterns → html/patterns}/header.html +0 -0
@@ -62,16 +62,16 @@ Files analyzed:
62
62
  - `assets/scss/components/*`
63
63
  - `assets/scss/patterns/*`
64
64
  - `assets/scss/mixin/*`
65
- - `templates/components/*`
66
- - `templates/layout/*`
67
- - `templates/patterns/*`
65
+ - `templates/html/components/*`
66
+ - `templates/html/layout/*`
67
+ - `templates/html/patterns/*`
68
68
 
69
69
  Patterns found:
70
70
 
71
71
  - `pgs` is the main attribute: tokens are separated by spaces, for example `pgs="button modal-button"`.
72
72
  - `assets/scss/index.scss` imports base, layout, components, and patterns; layouts/components/patterns are almost all scoped under `[pgs~=initP]`.
73
- - The main markup must enable the library with `htmlBase initP`, and the body with base body tokens. Use `templates/demo.html` and `templates/layout/body.html` as the canonical references.
74
- - Components use a root token and child tokens with a consistent prefix. Use `templates/components/` as the canonical markup source.
73
+ - The main markup must enable the library with `htmlBase initP`, and the body with base body tokens. Use `templates/demo.html` and `templates/html/layout/body.html` as the canonical references.
74
+ - Components use a root token and child tokens with a consistent prefix. Use `templates/html/components/` as the canonical markup source.
75
75
 
76
76
  - Runtime states use `pgs-state`, for example `open`, `is-active`, `is-completed`, `is-locked`, `success`, `error`, `warning`, and `info`.
77
77
  - Configurable options use `pgs-option`, with simple tokens or values inside square brackets. Prefer copying the current option syntax from the relevant template rather than duplicating examples in this guide.
@@ -84,14 +84,15 @@ Patterns found:
84
84
  Recommended imports in a project that consumes the library:
85
85
 
86
86
  ```scss
87
- @import "../../node_modules/mypgs/assets/scss/mixin/mixin.scss";
88
- @import "../../node_modules/mypgs/assets/scss/index.scss";
87
+ @use "sass:meta";
88
+ @use "../../node_modules/mypgs/assets/scss/mixin/mixin.scss" as * ;
89
+ @include meta.load-css("../../node_modules/mypgs/assets/scss/index.scss");
89
90
  ```
90
91
 
91
92
  If you only need the mixins:
92
93
 
93
94
  ```scss
94
- @import "../../node_modules/mypgs/assets/scss/mixin/mixin.scss";
95
+ @use "../../node_modules/mypgs/assets/scss/mixin/mixin.scss" as * ;
95
96
  ```
96
97
 
97
98
  Direct usage of the compiled CSS:
@@ -222,9 +223,9 @@ Use the templates as the single source of truth for component and layout markup.
222
223
 
223
224
  Canonical template references:
224
225
 
225
- - Layouts: `templates/layout/body.html`, `templates/layout/flex.html`, `templates/layout/grid.html`, `templates/layout/pageShell.html`, `templates/layout/section.html`
226
- - Components: `templates/components/accordion.html`, `templates/components/breadcumbs.html`, `templates/components/button.html`, `templates/components/card.html`, `templates/components/dropdown.html`, `templates/components/form.html`, `templates/components/logo.html`, `templates/components/menu.html`, `templates/components/modal.html`, `templates/components/notification.html`, `templates/components/searchbar.html`, `templates/components/slides.html`, `templates/components/stepTabs.html`, `templates/components/steps.html`, `templates/components/table.html`, `templates/components/tooltip.html`
227
- - Patterns: `templates/patterns/cookieConsent.html`, `templates/patterns/footer.html`, `templates/patterns/header.html`
226
+ - Layouts: `templates/html/layout/body.html`, `templates/html/layout/flex.html`, `templates/html/layout/grid.html`, `templates/html/layout/pageShell.html`, `templates/html/layout/section.html`
227
+ - Components: `templates/html/components/accordion.html`, `templates/html/components/breadcumbs.html`, `templates/html/components/button.html`, `templates/html/components/card.html`, `templates/html/components/dropdown.html`, `templates/html/components/form.html`, `templates/html/components/logo.html`, `templates/html/components/menu.html`, `templates/html/components/modal.html`, `templates/html/components/notification.html`, `templates/html/components/searchbar.html`, `templates/html/components/slides.html`, `templates/html/components/stepTabs.html`, `templates/html/components/steps.html`, `templates/html/components/table.html`, `templates/html/components/tooltip.html`
228
+ - Patterns: `templates/html/patterns/cookieConsent.html`, `templates/html/patterns/footer.html`, `templates/html/patterns/header.html`
228
229
  - Complete demo assembly. DO NOT use this for inspiration. It is only used to show all the modules: `templates/demo.html`
229
230
 
230
231
  Before creating markup, open the relevant template and reuse its current structure, tokens, ARIA attributes, and `pgs-option` syntax.
@@ -257,11 +258,12 @@ import "mypgs/style.css";
257
258
  Source SCSS import:
258
259
 
259
260
  ```scss
260
- @import "../../node_modules/mypgs/assets/scss/mixin/mixin.scss";
261
- @import "../../node_modules/mypgs/assets/scss/index.scss";
261
+ @use "sass:meta";
262
+ @use "../../node_modules/mypgs/assets/scss/mixin/mixin.scss" as * ;
263
+ @include meta.load-css("../../node_modules/mypgs/assets/scss/index.scss");
262
264
  ```
263
265
 
264
- Recommended: use PGS layout tokens from `templates/layout/`.
266
+ Recommended: use PGS layout tokens from `templates/html/layout/`.
265
267
 
266
268
  Avoid: equivalent custom layout with ad hoc classes when a PGS layout token already exists.
267
269
 
@@ -326,7 +328,7 @@ For a new reusable component:
326
328
  - create JS in `assets/javascript/components/` or `assets/javascript/patterns/` only if behavior is needed;
327
329
  - export an object with `init` and/or `api` when the module needs a public API;
328
330
  - register it in `assets/javascript/_imports.js` with `pgs.registerModules` if it must be available as `pgs.moduleName`;
329
- - add a template in `templates/components/` or `templates/layout/`;
331
+ - add a template in `templates/html/components/` or `templates/html/layout/`;
330
332
  - update `README.md` and this guide if the usage changes.
331
333
 
332
334
  Example for a new module:
package/README.md CHANGED
@@ -56,14 +56,15 @@ Markup minimo consigliato:
56
56
  Se il progetto vuole compilare un CSS unico, importa gli SCSS sorgenti:
57
57
 
58
58
  ```scss
59
- @import "../../node_modules/mypgs/assets/scss/mixin/mixin.scss";
60
- @import "../../node_modules/mypgs/assets/scss/index.scss";
59
+ @use "sass:meta";
60
+ @use "../../node_modules/mypgs/assets/scss/mixin/mixin.scss" as * ;
61
+ @include meta.load-css("../../node_modules/mypgs/assets/scss/index.scss");
61
62
  ```
62
63
 
63
64
  Se servono solo i mixin:
64
65
 
65
66
  ```scss
66
- @import "../../node_modules/mypgs/assets/scss/mixin/mixin.scss";
67
+ @use "../../node_modules/mypgs/assets/scss/mixin/mixin.scss" as * ;
67
68
  ```
68
69
 
69
70
  La libreria espone molte custom properties da preferire agli hardcode, per esempio:
@@ -228,173 +229,7 @@ pgs.modal.api(modalEl)?.open();
228
229
 
229
230
  ## Componenti e markup
230
231
 
231
- I template completi sono in `templates/components/` e `templates/layout/`. Usa quei file come sorgente di riferimento prima di creare markup nuovo.
232
-
233
- ### Layout
234
-
235
- ```html
236
- <main pgs="main">
237
- <section pgs="section flexColumnElements">
238
- <div pgs="flexColumnTexts">
239
- <h2>Titolo</h2>
240
- <p>Contenuto.</p>
241
- </div>
242
- </section>
243
- </main>
244
- ```
245
-
246
- ```html
247
- <section pgs="sectionFull flexColumnElements">
248
- <div pgs="grid-3">
249
- <article pgs="card flexColumnTexts">
250
- <h3>Colonna uno</h3>
251
- <p>Contenuto.</p>
252
- </article>
253
- </div>
254
- </section>
255
- ```
256
-
257
- ### Bottoni
258
-
259
- ```html
260
- <button pgs="button" type="button">Base</button>
261
- <button pgs="buttonStrong" type="button">Primario</button>
262
- <button pgs="buttonIcon" type="button" aria-label="Impostazioni">
263
- <i class="fa-solid fa-gear" aria-hidden="true"></i>
264
- </button>
265
- ```
266
-
267
- ### Accordion
268
-
269
- ```html
270
- <div pgs="accordion">
271
- <button pgs="accordion-button" type="button">Domanda</button>
272
- <div pgs="accordion-content">Risposta</div>
273
- </div>
274
- ```
275
-
276
- ### Dropdown
277
-
278
- ```html
279
- <span pgs="dropdown">
280
- <button pgs="dropdown-button button" type="button">Apri menu</button>
281
- <div pgs="dropdown-content">
282
- <nav aria-label="Menu dropdown"></nav>
283
- </div>
284
- </span>
285
- ```
286
-
287
- ### Modal
288
-
289
- ```html
290
- <div pgs="modal" pgs-option="containerID[modal-container]">
291
- <button pgs="modal-button button" type="button">Apri modale</button>
292
- <dialog>
293
- <div pgs="modal-dialog-content">
294
- <div pgs="modal-dialog-content-header">
295
- <h3>Modale</h3>
296
- </div>
297
- <div pgs="modal-dialog-content-scroll">
298
- <p>Contenuto della modale.</p>
299
- </div>
300
- </div>
301
- </dialog>
302
- </div>
303
- <div id="modal-container"></div>
304
- ```
305
-
306
- ### Slides
307
-
308
- ```html
309
- <div pgs="slides" pgs-option="singleScroll shadowDesktop">
310
- <ul pgs="slides-container">
311
- <li>
312
- <article pgs="card flexColumn">
313
- <img pgs="card-img imgCover" src="image.jpg" alt="">
314
- <div pgs="flexColumnTexts">
315
- <h3>Slide uno</h3>
316
- </div>
317
- </article>
318
- </li>
319
- </ul>
320
- </div>
321
- ```
322
-
323
- ### Step tabs
324
-
325
- ```html
326
- <div pgs="stepTabs flexColumnElements">
327
- <div pgs="stepTabs-dots" aria-label="Avanzamento"></div>
328
- <div pgs="stepTabs-container">
329
- <section pgs="tab flexColumnTexts" tabindex="-1" pgs-option="tabIcon[fa-user]"></section>
330
- </div>
331
- <div pgs="flexRow">
332
- <button pgs="stepTabs-prev button" type="button">Indietro</button>
333
- <button pgs="stepTabs-next button" pgs-option="buttonReverse" type="button">Avanti</button>
334
- </div>
335
- </div>
336
- ```
337
-
338
- ### Form
339
-
340
- ```html
341
- <form pgs="form" action="#" method="post">
342
- <label pgs="label" for="form-email">Email</label>
343
- <input id="form-email" pgs="input" type="email" name="email" required data-form-field-message="Inserisci una email valida">
344
- <button pgs="buttonStrong" type="submit">Invia</button>
345
- </form>
346
- ```
347
-
348
- Validazione programmatica:
349
-
350
- ```js
351
- const form = document.querySelector("form");
352
- const validator = new pgs.formValidate({ form });
353
-
354
- if (validator.validate()) {
355
- pgs.notification.toast.success("Inviato con successo");
356
- }
357
- ```
358
-
359
- ### Notifiche
360
-
361
- ```html
362
- <div pgs="notification" aria-live="polite"></div>
363
- <div pgs="toast" aria-live="polite"></div>
364
- ```
365
-
366
- ```js
367
- pgs.notification.toast.success("Salvato");
368
- pgs.notification.alert.error("Errore", null, 0);
369
- ```
370
-
371
- Trigger da markup:
372
-
373
- ```html
374
- <div pgs="hidden notificationTrigger" data-notification='{
375
- "title":"Titolo",
376
- "message":"Messaggio",
377
- "element":"notification",
378
- "type":"info",
379
- "duration":"-1"
380
- }'></div>
381
- ```
382
-
383
- ### Menu
384
-
385
- ```html
386
- <nav pgs="menuHorizontal" aria-label="Menu principale">
387
- <ul>
388
- <li class="menu-item"><a href="/">Home</a></li>
389
- <li class="menu-item menu-item-has-children">
390
- <a href="/servizi">Servizi</a>
391
- <ul class="sub-menu">
392
- <li class="menu-item"><a href="/servizi/uno">Servizio uno</a></li>
393
- </ul>
394
- </li>
395
- </ul>
396
- </nav>
397
- ```
232
+ I template completi sono in `templates/html/components/`, `templates/html/patterns/` e `templates/html/layout/`. Usa quei file come sorgente di riferimento prima di creare markup nuovo.
398
233
 
399
234
  ## Componenti disponibili
400
235
 
@@ -484,8 +319,9 @@ import "mypgs/style.css";
484
319
  Uso sorgente SCSS:
485
320
 
486
321
  ```scss
487
- @import "../../node_modules/mypgs/assets/scss/mixin/mixin.scss";
488
- @import "../../node_modules/mypgs/assets/scss/index.scss";
322
+ @use "sass:meta";
323
+ @use "../../node_modules/mypgs/assets/scss/mixin/mixin.scss" as * ;
324
+ @include meta.load-css("../../node_modules/mypgs/assets/scss/index.scss");
489
325
  ```
490
326
 
491
327
  ## Sviluppo
@@ -1,3 +1,4 @@
1
+ @use "sass:math";
1
2
  @use "settings" as *;
2
3
 
3
4
  //= FLEX
@@ -52,7 +53,7 @@
52
53
 
53
54
  //= FLEX
54
55
  @function _basis($ratio, $gap, $columns) {
55
- $cols: ceil($columns * $ratio);
56
+ $cols: math.ceil($columns * $ratio);
56
57
  @return calc((100% - ($gap * ($cols - 1))) / $cols);
57
58
  }
58
59
 
@@ -196,17 +197,17 @@
196
197
 
197
198
  //-( laptop
198
199
  @container (max-width: #{$laptop}) {
199
- grid-template-columns: repeat(ceil($columns * 0.75), 1fr); // 75% delle colonne originali
200
+ grid-template-columns: repeat(math.ceil($columns * 0.75), 1fr); // 75% delle colonne originali
200
201
  }
201
202
 
202
203
  //-( big-tablet
203
204
  @container (max-width: #{$big-tablet}) {
204
- grid-template-columns: repeat(ceil($columns * 0.5), 1fr); // 50% delle colonne originali
205
+ grid-template-columns: repeat(math.ceil($columns * 0.5), 1fr); // 50% delle colonne originali
205
206
  }
206
207
 
207
208
  //-( tablet
208
209
  @container (max-width: #{$tablet}) {
209
- grid-template-columns: repeat(ceil($columns * 0.33), 1fr); // 33% delle colonne originali
210
+ grid-template-columns: repeat(math.ceil($columns * 0.33), 1fr); // 33% delle colonne originali
210
211
  }
211
212
  }
212
213
 
@@ -214,17 +215,17 @@
214
215
 
215
216
  //-( laptop
216
217
  @container (max-width: #{$laptop}) {
217
- grid-template-columns: repeat(ceil($columns * 0.75), 1fr); // 75% delle colonne originali
218
+ grid-template-columns: repeat(math.ceil($columns * 0.75), 1fr); // 75% delle colonne originali
218
219
  }
219
220
 
220
221
  //-( big-tablet
221
222
  @container (max-width: #{$big-tablet}) {
222
- grid-template-columns: repeat(ceil($columns * 0.5), 1fr); // 50% delle colonne originali
223
+ grid-template-columns: repeat(math.ceil($columns * 0.5), 1fr); // 50% delle colonne originali
223
224
  }
224
225
 
225
226
  //-( tablet
226
227
  @container (max-width: #{$tablet}) {
227
- grid-template-columns: repeat(ceil($columns * 0.33), 1fr); // 33% delle colonne originali
228
+ grid-template-columns: repeat(math.ceil($columns * 0.33), 1fr); // 33% delle colonne originali
228
229
  }
229
230
  }
230
231
 
@@ -261,17 +262,17 @@
261
262
 
262
263
  //-( da 1500px
263
264
  @container (max-width: #{$start}) {
264
- grid-template-columns: repeat(ceil($columns * 0.75), 1fr);
265
+ grid-template-columns: repeat(math.ceil($columns * 0.75), 1fr);
265
266
  }
266
267
 
267
268
  //-( circa tablet landscape
268
269
  @container (max-width: #{calc($start * 0.75)}) {
269
- grid-template-columns: repeat(ceil($columns * 0.5), 1fr);
270
+ grid-template-columns: repeat(math.ceil($columns * 0.5), 1fr);
270
271
  }
271
272
 
272
273
  //-( tablet
273
274
  @container (max-width: #{calc($start * 0.5)}) {
274
- grid-template-columns: repeat(ceil($columns * 0.33), 1fr);
275
+ grid-template-columns: repeat(math.ceil($columns * 0.33), 1fr);
275
276
  }
276
277
 
277
278
  //-( mobile