@italia/modal 1.0.0-alpha.9 → 1.0.0-beta.1
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 +6 -54
- package/custom-elements.json +103 -15
- package/dist/src/index.js.map +1 -1
- package/dist/src/it-modal.d.ts +17 -0
- package/dist/src/it-modal.d.ts.map +1 -1
- package/dist/src/it-modal.js +908 -171
- package/dist/src/it-modal.js.map +1 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +27 -27
- package/styles/globals.scss +2 -2
package/README.md
CHANGED
|
@@ -1,59 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# <it-modal>
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package is part of [dev-kit-italia](https://italia.github.io/dev-kit-italia), a Web Components kit for the **.italia** design-system.
|
|
4
4
|
|
|
5
|
-
## Installation
|
|
5
|
+
## Installation and usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm i @italia/modal
|
|
9
|
-
```
|
|
7
|
+
Most users want to install the full kit by installing [`@italia/dev-kit-italia`](https://npmjs.com/package/@italia/dev-kit-italia), but you have the option of installing this single Web Component separately if needed. Please find detailed installation and usage instructions in the [official documentation](https://italia.github.io/dev-kit-italia/?path=/docs/introduzione--documentazione).
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## Documentation
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
<script type="module">
|
|
15
|
-
import '@italia/modal';
|
|
16
|
-
</script>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Running locally
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm start
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
26
|
-
|
|
27
|
-
## Testing
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm run test
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Linting and formatting
|
|
34
|
-
|
|
35
|
-
To scan the project for linting and formatting errors, run
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm run lint
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
To automatically fix linting and formatting errors, run
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npm run format
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Tooling configs
|
|
48
|
-
|
|
49
|
-
For most of the tools, the configuration is in the `package.json` to minimize the amount of files in your project.
|
|
50
|
-
|
|
51
|
-
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
52
|
-
|
|
53
|
-
## Local Demo with `web-dev-server`
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm start
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
11
|
+
Find the usage instructions for this specific component in its [dedicated documentation page](https://italia.github.io/dev-kit-italia/?path=/docs/componenti-modal--documentazione).
|
package/custom-elements.json
CHANGED
|
@@ -73,6 +73,16 @@
|
|
|
73
73
|
"attribute": "modal-description",
|
|
74
74
|
"reflects": true
|
|
75
75
|
},
|
|
76
|
+
{
|
|
77
|
+
"kind": "field",
|
|
78
|
+
"name": "customHeader",
|
|
79
|
+
"type": {
|
|
80
|
+
"text": "boolean"
|
|
81
|
+
},
|
|
82
|
+
"default": "false",
|
|
83
|
+
"attribute": "custom-header",
|
|
84
|
+
"reflects": true
|
|
85
|
+
},
|
|
76
86
|
{
|
|
77
87
|
"kind": "field",
|
|
78
88
|
"name": "size",
|
|
@@ -122,6 +132,16 @@
|
|
|
122
132
|
"attribute": "hide-close-button",
|
|
123
133
|
"reflects": true
|
|
124
134
|
},
|
|
135
|
+
{
|
|
136
|
+
"kind": "field",
|
|
137
|
+
"name": "closeButtonPlacement",
|
|
138
|
+
"type": {
|
|
139
|
+
"text": "| 'header'\n | 'backdrop'"
|
|
140
|
+
},
|
|
141
|
+
"default": "'header'",
|
|
142
|
+
"attribute": "close-button-placement",
|
|
143
|
+
"reflects": true
|
|
144
|
+
},
|
|
125
145
|
{
|
|
126
146
|
"kind": "field",
|
|
127
147
|
"name": "variant",
|
|
@@ -170,6 +190,16 @@
|
|
|
170
190
|
"attribute": "footer-shadow",
|
|
171
191
|
"reflects": true
|
|
172
192
|
},
|
|
193
|
+
{
|
|
194
|
+
"kind": "field",
|
|
195
|
+
"name": "defaultFocusClose",
|
|
196
|
+
"type": {
|
|
197
|
+
"text": "boolean"
|
|
198
|
+
},
|
|
199
|
+
"default": "false",
|
|
200
|
+
"attribute": "default-focus-close",
|
|
201
|
+
"reflects": true
|
|
202
|
+
},
|
|
173
203
|
{
|
|
174
204
|
"kind": "field",
|
|
175
205
|
"name": "_modalElement",
|
|
@@ -218,6 +248,22 @@
|
|
|
218
248
|
},
|
|
219
249
|
"privacy": "private"
|
|
220
250
|
},
|
|
251
|
+
{
|
|
252
|
+
"kind": "field",
|
|
253
|
+
"name": "_contentElement",
|
|
254
|
+
"type": {
|
|
255
|
+
"text": "HTMLElement"
|
|
256
|
+
},
|
|
257
|
+
"privacy": "private"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"kind": "field",
|
|
261
|
+
"name": "_closeButton",
|
|
262
|
+
"type": {
|
|
263
|
+
"text": "HTMLElement"
|
|
264
|
+
},
|
|
265
|
+
"privacy": "private"
|
|
266
|
+
},
|
|
221
267
|
{
|
|
222
268
|
"kind": "field",
|
|
223
269
|
"name": "_titleId",
|
|
@@ -352,7 +398,7 @@
|
|
|
352
398
|
"text": "FocusTrapController"
|
|
353
399
|
},
|
|
354
400
|
"privacy": "private",
|
|
355
|
-
"default": "new FocusTrapController(this, { getContainer: () => this._modalElement, initialFocus: () => this.
|
|
401
|
+
"default": "new FocusTrapController(this, { getContainer: () => this._modalElement, initialFocus: () => this._entryPoint(), getTrigger: () => this._triggerElement, onEscape: () => { this._safariMouseInteraction = false; this.hide(); }, })"
|
|
356
402
|
},
|
|
357
403
|
{
|
|
358
404
|
"kind": "field",
|
|
@@ -362,6 +408,17 @@
|
|
|
362
408
|
},
|
|
363
409
|
"readonly": true
|
|
364
410
|
},
|
|
411
|
+
{
|
|
412
|
+
"kind": "method",
|
|
413
|
+
"name": "_entryPoint",
|
|
414
|
+
"privacy": "private",
|
|
415
|
+
"return": {
|
|
416
|
+
"type": {
|
|
417
|
+
"text": "HTMLElement | null"
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"description": "Element the focus enters on when the modal opens.\n\nDeliberately not the `[role=\"dialog\"]` element: NVDA doesn't announce the role when focus\nlands on the dialog element itself (nvaccess/nvda#8620), so the user is told the name of the\nmodal but never that it is a dialog — unlike VoiceOver, JAWS and Narrator, which announce it.\nEntering on a descendant instead has the dialog announced as its ancestor, role included.\n`.modal-content` is a container and not a control, so its content is still read out after the\nannouncement, exactly as it was when focus landed on the dialog."
|
|
421
|
+
},
|
|
365
422
|
{
|
|
366
423
|
"kind": "method",
|
|
367
424
|
"name": "show",
|
|
@@ -503,20 +560,11 @@
|
|
|
503
560
|
"name": "_modalBodyClasses",
|
|
504
561
|
"privacy": "private",
|
|
505
562
|
"readonly": true
|
|
506
|
-
}
|
|
507
|
-
],
|
|
508
|
-
"events": [
|
|
509
|
-
{
|
|
510
|
-
"name": "it-modal-open",
|
|
511
|
-
"type": {
|
|
512
|
-
"text": "CustomEvent"
|
|
513
|
-
}
|
|
514
563
|
},
|
|
515
564
|
{
|
|
516
|
-
"
|
|
517
|
-
"
|
|
518
|
-
|
|
519
|
-
}
|
|
565
|
+
"kind": "method",
|
|
566
|
+
"name": "_renderCloseButton",
|
|
567
|
+
"privacy": "private"
|
|
520
568
|
}
|
|
521
569
|
],
|
|
522
570
|
"attributes": [
|
|
@@ -544,6 +592,14 @@
|
|
|
544
592
|
"default": "''",
|
|
545
593
|
"fieldName": "modalDescription"
|
|
546
594
|
},
|
|
595
|
+
{
|
|
596
|
+
"name": "custom-header",
|
|
597
|
+
"type": {
|
|
598
|
+
"text": "boolean"
|
|
599
|
+
},
|
|
600
|
+
"default": "false",
|
|
601
|
+
"fieldName": "customHeader"
|
|
602
|
+
},
|
|
547
603
|
{
|
|
548
604
|
"name": "size",
|
|
549
605
|
"type": {
|
|
@@ -583,6 +639,14 @@
|
|
|
583
639
|
"default": "false",
|
|
584
640
|
"fieldName": "hideCloseButton"
|
|
585
641
|
},
|
|
642
|
+
{
|
|
643
|
+
"name": "close-button-placement",
|
|
644
|
+
"type": {
|
|
645
|
+
"text": "| 'header'\n | 'backdrop'"
|
|
646
|
+
},
|
|
647
|
+
"default": "'header'",
|
|
648
|
+
"fieldName": "closeButtonPlacement"
|
|
649
|
+
},
|
|
586
650
|
{
|
|
587
651
|
"name": "variant",
|
|
588
652
|
"type": {
|
|
@@ -621,6 +685,14 @@
|
|
|
621
685
|
},
|
|
622
686
|
"default": "false",
|
|
623
687
|
"fieldName": "footerShadow"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
"name": "default-focus-close",
|
|
691
|
+
"type": {
|
|
692
|
+
"text": "boolean"
|
|
693
|
+
},
|
|
694
|
+
"default": "false",
|
|
695
|
+
"fieldName": "defaultFocusClose"
|
|
624
696
|
}
|
|
625
697
|
],
|
|
626
698
|
"superclass": {
|
|
@@ -713,7 +785,7 @@
|
|
|
713
785
|
{
|
|
714
786
|
"kind": "variable",
|
|
715
787
|
"name": "meta",
|
|
716
|
-
"default": "{ title: 'Componenti/Modal', component: 'it-modal', tags: ['
|
|
788
|
+
"default": "{ title: 'Componenti/Modal', component: 'it-modal', tags: ['a11y-ok', 'web-component'], parameters: { layout: 'fullscreen', docs: { story: { inline: false, iframeHeight: 420, }, }, }, args: { 'modal-title': 'Titolo modale', 'modal-description': 'Descrizione della modale', 'custom-header': false, size: '', position: undefined, scrollable: false, 'static-backdrop': false, 'hide-close-button': false, 'close-button-placement': 'header', variant: '', 'close-label': 'Chiudi finestra modale', 'default-focus-close': false, 'disable-animation': false, 'footer-shadow': false, triggerLabel: 'Apri modale', bodyContent: 'Contenuto della modale. Può includere testo, form, o qualsiasi altro elemento.', }, argTypes: { 'modal-title': { control: 'text', description: 'Titolo della modale (usa slot `header` per contenuto custom)', }, 'modal-description': { control: 'text', description: 'Descrizione della modale (usa slot `description` per contenuto custom), verrrà inserita in un elemento visivamente nascosto per i lettori di schermo.', }, 'custom-header': { control: 'boolean', description: \"Abilita header custom. In questo modo è possibile inserire un header personalizzato tramite slot, altrimenti lo slot header verrà inserito all'interno di un `h2` con classi predefinite per garantire la corretta semantica e accessibilità.\", table: { defaultValue: { summary: 'false' } }, }, size: { control: 'select', options: MODAL_SIZES, description: 'Dimensione della modale', table: { defaultValue: { summary: undefined } }, }, position: { control: 'select', options: MODAL_POSITIONS, description: 'Posizionamento della modale', table: { defaultValue: { summary: undefined } }, }, scrollable: { control: 'boolean', description: 'Abilita scroll interno al body', table: { defaultValue: { summary: 'false' } }, }, 'static-backdrop': { control: 'boolean', description: 'Disabilita chiusura su click backdrop', table: { defaultValue: { summary: 'false' } }, }, 'hide-close-button': { control: 'boolean', description: 'Nasconde il pulsante di chiusura', }, 'close-button-placement': { control: 'select', options: ['header', 'backdrop'], description: 'Posizione del pulsante di chiusura: `header` (default) o `backdrop`', table: { defaultValue: { summary: 'header' } }, }, variant: { control: 'select', options: MODAL_VARIANTS, description: 'Variante della modale', table: { defaultValue: { summary: undefined } }, }, 'close-label': { control: 'text', description: 'Etichetta accessibile per il pulsante di chiusura', table: { defaultValue: { summary: 'Chiudi finestra modale' } }, }, 'default-focus-close': { control: 'boolean', description: \"Forza il focus sul pulsante di chiusura all'apertura della modale\", table: { defaultValue: { summary: 'false' } }, }, 'disable-animation': { control: 'boolean', description: 'Disabilita animazione fade', }, 'footer-shadow': { control: 'boolean', description: 'Ombra sul footer per contenuti lunghi', table: { defaultValue: { summary: 'false' } }, }, triggerLabel: { table: { disable: true }, }, bodyContent: { table: { disable: true }, }, }, } satisfies Meta<ModalProps>"
|
|
717
789
|
},
|
|
718
790
|
{
|
|
719
791
|
"kind": "variable",
|
|
@@ -721,7 +793,7 @@
|
|
|
721
793
|
"type": {
|
|
722
794
|
"text": "Story"
|
|
723
795
|
},
|
|
724
|
-
"default": "{ name: 'Esempio interattivo', tags: ['!dev'], parameters: { docs: { canvas: { sourceState: 'hidden' }, }, }, render: (args) => html` <it-modal ?hide-close-button=\"${args['hide-close-button']}\" ?disable-animation=\"${args['disable-animation']}\" size=\"${ifDefined(args.size || undefined)}\" position=\"${args.position}\" variant=\"${ifDefined(args.variant || undefined)}\" ?scrollable=\"${args.scrollable}\" ?static-backdrop=\"${args['static-backdrop']}\" ?footer-shadow=\"${args['footer-shadow']}\" close-label=\"${args['close-label']}\" modal-title=\"${args['modal-title']}\" modal-description=\"${args['modal-description']}\" > <it-button variant=\"primary\" slot=\"trigger\">Lancia la demo della modale</it-button> <span slot=\"header\">${args['modal-title']}</span> <span slot=\"description\">${args['modal-description']}</span> <p slot=\"content\">${args.bodyContent}</p> <it-button slot=\"footer\" variant=\"outline-primary\" @click=\"${closeModal}\">Annulla</it-button> <it-button slot=\"footer\" variant=\"primary\" @click=\"${closeModal}\">Conferma</it-button> </it-modal> `, }"
|
|
796
|
+
"default": "{ name: 'Esempio interattivo', tags: ['!dev'], parameters: { docs: { canvas: { sourceState: 'hidden' }, }, }, render: (args) => html` <it-modal ?hide-close-button=\"${args['hide-close-button']}\" ?disable-animation=\"${args['disable-animation']}\" size=\"${ifDefined(args.size || undefined)}\" position=\"${args.position}\" variant=\"${ifDefined(args.variant || undefined)}\" ?scrollable=\"${args.scrollable}\" ?static-backdrop=\"${args['static-backdrop']}\" ?footer-shadow=\"${args['footer-shadow']}\" close-label=\"${args['close-label']}\" close-button-placement=\"${args['close-button-placement']}\" modal-title=\"${args['modal-title']}\" modal-description=\"${args['modal-description']}\" custom-header=\"${args['custom-header']}\" > <it-button variant=\"primary\" slot=\"trigger\">Lancia la demo della modale</it-button> <span slot=\"header\">${args['modal-title']}</span> <span slot=\"description\">${args['modal-description']}</span> <p slot=\"content\">${args.bodyContent}</p> <it-button slot=\"footer\" variant=\"outline-primary\" @click=\"${closeModal}\">Annulla</it-button> <it-button slot=\"footer\" variant=\"primary\" @click=\"${closeModal}\">Conferma</it-button> </it-modal> `, }"
|
|
725
797
|
},
|
|
726
798
|
{
|
|
727
799
|
"kind": "variable",
|
|
@@ -842,6 +914,14 @@
|
|
|
842
914
|
"text": "Story"
|
|
843
915
|
},
|
|
844
916
|
"default": "{ name: 'Attivazione manuale via JS', decorators: [ (story) => html` <div style=\"display:flex; height:100%; align-items:center; gap:2rem;\">${story()}</div> `, ], parameters: { docs: { source: { excludeDecorators: true, code: ` <it-modal disable-animation close-label=\"Chiudi finestra modale\"> <it-button slot=\"trigger\" variant=\"primary\">Modale con apertura manuale (show)</it-button> <span slot=\"header\">Modale con apertura manuale</span> <p slot=\"content\">Questa modale appare immediatamente senza animazione di dissolvenza.</p> <it-button slot=\"footer\" variant=\"outline-primary\">Annulla</it-button> <it-button slot=\"footer\" variant=\"primary\">Conferma</it-button> </it-modal> <it-modal disable-animation close-label=\"Chiudi finestra modale\"> <it-button slot=\"trigger\" variant=\"primary\">Modale con apertura manuale (toggle)</it-button > <span slot=\"header\">Modale con toggle manuale</span> <p slot=\"content\">Questa modale appare immediatamente senza animazione di dissolvenza.</p> <it-button slot=\"footer\" variant=\"outline-primary\">Annulla</it-button> <it-button slot=\"footer\" variant=\"primary\">Conferma</it-button> </it-modal> <script> // Script di esempio per mostrare come attivare la modale via JS utilizzando i metodi show(), hide() e toggle() const modals = document.querySelectorAll('it-modal'); const [modalShow, modalToggle] = modals; const openModal = (event) => { const el = event.currentTarget; const modal = el.closest('it-modal'); console.log('openModal -> modal', modal); modal?.show(); }; const closeModal = (event) => { const el = event.currentTarget; const modal = el.closest('it-modal'); console.log('closeModal -> modal', modal); modal?.hide(); }; const toggleModal = (event) => { const el = event.currentTarget; const modal = el.closest('it-modal'); console.log('toggleModal -> modal', modal); modal?.toggle(); }; // Assegna gli event listener ai bottoni di trigger e footer modalShow.querySelector('[slot=\"trigger\"]').addEventListener('click', openModal); modalShow.querySelectorAll('[slot=\"footer\"] it-button').forEach((btn) => btn.addEventListener('click', closeModal)); modalToggle.querySelector('[slot=\"trigger\"]').addEventListener('click', toggleModal); modalToggle.querySelectorAll('[slot=\"footer\"] it-button').forEach((btn) => btn.addEventListener('click', toggleModal)); </script> `, }, }, }, render: () => html` <it-modal disable-animation close-label=\"Chiudi finestra modale\"> <it-button slot=\"trigger\" variant=\"primary\" @click=\"${openModal}\">Modale con apertura manuale (show)</it-button> <span slot=\"header\">Modale con apertura manuale</span> <p slot=\"content\">Questa modale appare immediatamente senza animazione di dissolvenza.</p> <it-button slot=\"footer\" variant=\"outline-primary\" @click=\"${closeModal}\">Annulla</it-button> <it-button slot=\"footer\" variant=\"primary\" @click=\"${closeModal}\">Conferma</it-button> </it-modal> <it-modal disable-animation close-label=\"Chiudi finestra modale\"> <it-button slot=\"trigger\" variant=\"primary\" @click=\"${toggleModal}\" >Modale con apertura manuale (toggle)</it-button > <span slot=\"header\">Modale con toggle manuale</span> <p slot=\"content\">Questa modale appare immediatamente senza animazione di dissolvenza.</p> <it-button slot=\"footer\" variant=\"outline-primary\" @click=\"${toggleModal}\">Annulla</it-button> <it-button slot=\"footer\" variant=\"primary\" @click=\"${toggleModal}\">Conferma</it-button> </it-modal> `, }"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"kind": "variable",
|
|
920
|
+
"name": "ChiusuraConConferma",
|
|
921
|
+
"type": {
|
|
922
|
+
"text": "Story"
|
|
923
|
+
},
|
|
924
|
+
"default": "{ name: 'Chiusura con logica personalizzata', parameters: { docs: { description: { story: `L'evento \\`it-modal-close\\` è **cancelable**. Chiamando \\`event.preventDefault()\\` puoi intercettare la chiusura, eseguire una logica personalizzata — in questo esempio viene mostrato un messaggio informativo — e poi richiamare \\`hide()\\` per chiudere effettivamente la modale. Lo stesso schema si applica a \\`it-modal-open\\`.`, }, source: { code: `<it-modal id=\"modal-custom-close\"> <it-button variant=\"primary\" slot=\"trigger\">Apri modale</it-button> <span slot=\"header\">Chiusura con logica personalizzata</span> <p slot=\"content\">Prova a chiudere la modale: verrà eseguita una logica personalizzata prima della chiusura effettiva.</p> <it-button slot=\"footer\" variant=\"primary\" id=\"modal-custom-close-footer\">Chiudi</it-button> </it-modal> <div id=\"modal-close-alert\" class=\"alert alert-info\" role=\"alert\" style=\"display:none\"> <strong>Operazione completata.</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </div> <script type=\"module\"> const modal = document.getElementById('modal-custom-close'); const alertEl = document.getElementById('modal-close-alert'); let _closing = false; modal.addEventListener('it-modal-close', (e) => { if (_closing) return; e.preventDefault(); alertEl.style.display = ''; _closing = true; modal.hide(); _closing = false; }); document.getElementById('modal-custom-close-footer') ?.addEventListener('click', () => modal.hide()); </script>`, }, }, }, render: () => { let _closing = false; return html` <it-modal id=\"modal-custom-close\" @it-modal-close=${(e: Event) => { if (_closing) return; e.preventDefault(); const alertEl = document.getElementById('modal-close-alert'); if (alertEl) alertEl.style.display = ''; _closing = true; (e.currentTarget as HTMLElement & { hide(): void }).hide(); _closing = false; }} > <it-button variant=\"primary\" slot=\"trigger\">Apri modale</it-button> <span slot=\"header\">Chiusura con logica personalizzata</span> <p slot=\"content\"> Prova a chiudere la modale: verrà eseguita una logica personalizzata prima della chiusura effettiva. </p> <it-button slot=\"footer\" variant=\"primary\" @click=${(e: Event) => { (e.currentTarget as HTMLElement).closest<HTMLElement & { hide(): void }>('it-modal')?.hide(); }} >Chiudi</it-button > </it-modal> <div id=\"modal-close-alert\" class=\"alert alert-info\" role=\"alert\" style=\"display:none\"> <strong>Operazione completata.</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </div> `; }, }"
|
|
845
925
|
}
|
|
846
926
|
],
|
|
847
927
|
"exports": [
|
|
@@ -980,6 +1060,14 @@
|
|
|
980
1060
|
"name": "AttivazioneViaJS",
|
|
981
1061
|
"module": "stories/it-modal.stories.ts"
|
|
982
1062
|
}
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
"kind": "js",
|
|
1066
|
+
"name": "ChiusuraConConferma",
|
|
1067
|
+
"declaration": {
|
|
1068
|
+
"name": "ChiusuraConConferma",
|
|
1069
|
+
"module": "stories/it-modal.stories.ts"
|
|
1070
|
+
}
|
|
983
1071
|
}
|
|
984
1072
|
]
|
|
985
1073
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/types.ts"],"sourcesContent":["export const MODAL_SIZES = ['sm', 'lg', 'xl'] as const;\nexport const MODAL_POSITIONS = ['center', 'left', 'right'] as const;\nexport const MODAL_VARIANTS = ['alert', 'popconfirm', 'link-list'] as const;\n\nexport type ModalSize = (typeof MODAL_SIZES)[number] | '';\nexport type ModalPosition = (typeof MODAL_POSITIONS)[number];\nexport type ModalVariant = (typeof MODAL_VARIANTS)[number];\n\nexport interface ModalEventDetail {\n /** Riferimento all'elemento modale */\n modal: HTMLElement;\n}\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI;AACrC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO;AAClD,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/types.ts"],"sourcesContent":["export const MODAL_SIZES = ['sm', 'lg', 'xl'] as const;\nexport const MODAL_POSITIONS = ['center', 'left', 'right'] as const;\nexport const MODAL_VARIANTS = ['alert', 'popconfirm', 'link-list'] as const;\n\nexport type ModalSize = (typeof MODAL_SIZES)[number] | '';\nexport type ModalPosition = (typeof MODAL_POSITIONS)[number];\nexport type ModalVariant = (typeof MODAL_VARIANTS)[number];\n\n/**\n * Detail degli eventi `it-modal-open` / `it-modal-close`.\n * Entrambi gli eventi sono cancelable: `event.preventDefault()` impedisce\n * rispettivamente l'apertura e la chiusura della modale.\n */\nexport interface ModalEventDetail {\n /** Riferimento all'elemento modale */\n modal: HTMLElement;\n}\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI;AACrC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO;AAClD,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW;;;;"}
|
package/dist/src/it-modal.d.ts
CHANGED
|
@@ -14,22 +14,27 @@ export declare class ItModal extends BaseComponent {
|
|
|
14
14
|
open: boolean | undefined;
|
|
15
15
|
modalTitle: string;
|
|
16
16
|
modalDescription: string;
|
|
17
|
+
customHeader: boolean;
|
|
17
18
|
size: ModalSize;
|
|
18
19
|
position?: ModalPosition;
|
|
19
20
|
scrollable: boolean;
|
|
20
21
|
staticBackdrop: boolean;
|
|
21
22
|
hideCloseButton: boolean;
|
|
23
|
+
closeButtonPlacement: 'header' | 'backdrop';
|
|
22
24
|
variant?: ModalVariant;
|
|
23
25
|
itAriaLabel: string;
|
|
24
26
|
closeLabel: string;
|
|
25
27
|
disableAnimation: boolean;
|
|
26
28
|
footerShadow: boolean;
|
|
29
|
+
defaultFocusClose: boolean;
|
|
27
30
|
private _modalElement;
|
|
28
31
|
private _triggerSlot;
|
|
29
32
|
private _headerSlot;
|
|
30
33
|
private _descriptionSlot;
|
|
31
34
|
private _backdropElement;
|
|
32
35
|
private _dialogElement;
|
|
36
|
+
private _contentElement;
|
|
37
|
+
private _closeButton;
|
|
33
38
|
private _titleId;
|
|
34
39
|
private _triggerId;
|
|
35
40
|
private _descriptionId;
|
|
@@ -50,6 +55,17 @@ export declare class ItModal extends BaseComponent {
|
|
|
50
55
|
get _triggerElement(): HTMLElement | null;
|
|
51
56
|
constructor();
|
|
52
57
|
connectedCallback(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Element the focus enters on when the modal opens.
|
|
60
|
+
*
|
|
61
|
+
* Deliberately not the `[role="dialog"]` element: NVDA doesn't announce the role when focus
|
|
62
|
+
* lands on the dialog element itself (nvaccess/nvda#8620), so the user is told the name of the
|
|
63
|
+
* modal but never that it is a dialog — unlike VoiceOver, JAWS and Narrator, which announce it.
|
|
64
|
+
* Entering on a descendant instead has the dialog announced as its ancestor, role included.
|
|
65
|
+
* `.modal-content` is a container and not a control, so its content is still read out after the
|
|
66
|
+
* announcement, exactly as it was when focus landed on the dialog.
|
|
67
|
+
*/
|
|
68
|
+
private _entryPoint;
|
|
53
69
|
disconnectedCallback(): void;
|
|
54
70
|
show(): void;
|
|
55
71
|
hide(): void;
|
|
@@ -70,6 +86,7 @@ export declare class ItModal extends BaseComponent {
|
|
|
70
86
|
private _onTriggerKeydown;
|
|
71
87
|
private get _modalClasses();
|
|
72
88
|
private get _modalBodyClasses();
|
|
89
|
+
private _renderCloseButton;
|
|
73
90
|
render(): import("lit").TemplateResult<1>;
|
|
74
91
|
}
|
|
75
92
|
//# sourceMappingURL=it-modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-modal.d.ts","sourceRoot":"","sources":["../../src/it-modal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"it-modal.d.ts","sourceRoot":"","sources":["../../src/it-modal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA0D,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAI3C,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAyB,MAAM,YAAY,CAAC;AAqB1G,qBACa,OAAQ,SAAQ,aAAa;IACxC,MAAM,CAAC,MAAM,+BAAU;IAEvB,OAAgB,iBA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