@italia/skiplinks 1.0.0-alpha.4

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/AUTHORS ADDED
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2025 Dipartimento per la trasformazione digitale - Presidenza del Consiglio dei Ministri
2
+
3
+ The version control system provides attribution for specific lines of code.
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2025, the respective contributors, as shown by the AUTHORS file.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # \<it-skiplinks>
2
+
3
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @italia/skiplinks
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import '@italia/it-skiplinks';
16
+ </script>
17
+
18
+ <it-skiplinks></it-skiplinks>
19
+ ```
20
+
21
+ ## Linting and formatting
22
+
23
+ To scan the project for linting and formatting errors, run
24
+
25
+ ```bash
26
+ npm run lint
27
+ ```
28
+
29
+ To automatically fix linting and formatting errors, run
30
+
31
+ ```bash
32
+ npm run format
33
+ ```
34
+
35
+ ## Testing with Web Test Runner
36
+
37
+ To execute a single test run:
38
+
39
+ ```bash
40
+ npm run test
41
+ ```
42
+
43
+ To run the tests in interactive watch mode run:
44
+
45
+ ```bash
46
+ npm run test:watch
47
+ ```
48
+
49
+ ## Demoing with Storybook
50
+
51
+ To run a local instance of Storybook for your component, run
52
+
53
+ ```bash
54
+ npm run storybook
55
+ ```
56
+
57
+ To build a production version of Storybook, run
58
+
59
+ ```bash
60
+ npm run storybook:build
61
+ ```
62
+
63
+ ## Tooling configs
64
+
65
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
66
+
67
+ If you customize the configuration a lot, you can consider moving them to individual files.
68
+
69
+ ## Local Demo with `web-dev-server`
70
+
71
+ ```bash
72
+ npm start
73
+ ```
74
+
75
+ To run a local development server that serves the basic demo located in `demo/index.html`
@@ -0,0 +1,133 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "ItSkiplinks",
13
+ "declaration": {
14
+ "name": "ItSkiplinks",
15
+ "module": "./it-skiplinks.js"
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "kind": "javascript-module",
22
+ "path": "src/it-skiplinks.ts",
23
+ "declarations": [
24
+ {
25
+ "kind": "class",
26
+ "description": "",
27
+ "name": "ItSkiplinks",
28
+ "members": [
29
+ {
30
+ "kind": "field",
31
+ "name": "links",
32
+ "type": {
33
+ "text": "array"
34
+ },
35
+ "privacy": "protected",
36
+ "default": "[]"
37
+ },
38
+ {
39
+ "kind": "method",
40
+ "name": "_onSlotChange",
41
+ "privacy": "private",
42
+ "parameters": [
43
+ {
44
+ "name": "e",
45
+ "type": {
46
+ "text": "any"
47
+ }
48
+ }
49
+ ]
50
+ }
51
+ ],
52
+ "superclass": {
53
+ "name": "BaseComponent",
54
+ "package": "@italia/globals"
55
+ },
56
+ "tagName": "it-skiplinks",
57
+ "customElement": true
58
+ }
59
+ ],
60
+ "exports": [
61
+ {
62
+ "kind": "js",
63
+ "name": "ItSkiplinks",
64
+ "declaration": {
65
+ "name": "ItSkiplinks",
66
+ "module": "src/it-skiplinks.ts"
67
+ }
68
+ },
69
+ {
70
+ "kind": "custom-element-definition",
71
+ "name": "it-skiplinks",
72
+ "declaration": {
73
+ "name": "ItSkiplinks",
74
+ "module": "src/it-skiplinks.ts"
75
+ }
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "kind": "javascript-module",
81
+ "path": "stories/it-skiplinks.stories.ts",
82
+ "declarations": [
83
+ {
84
+ "kind": "variable",
85
+ "name": "meta",
86
+ "default": "{ title: 'Componenti/Skiplinks', tags: ['new', 'a11y-ok', 'web-component'], component: 'it-skiplinks', args: { 'it-aria-label': 'Aria label', }, argTypes: { 'it-aria-label': { control: 'text', description: 'Testo aria-label del wrapper degli skiplinks.', }, }, parameters: { docs: { description: { component: ` <Description>Gli skiplinks sono scorciatoie di navigazione che consentono agli utenti di andare direttamente ai contenuti principali della pagina, soprattutto se questa è particolarmente complessa da navigare.</Description> Questo componente permette a chi naviga sequenzialmente i contenuti di accedere a tutti i contenuti principali della pagina in modo più semplice. È particolarmente utile per chi usa la tastiera o tecnologie assistive come i lettori di schermo. Deve essere il primo contenuto della pagina. Se è presente l’elemento \\`<header>\\` è raccomandato integrarlo come primo suo elemento figlio, così da includerlo sempre in un landmark di pagina. Per navigare tra gli elementi puoi usare il tasto: **TAB** (tabulazione). <div class=\"callout callout-success\"><div class=\"callout-inner\"><div class=\"callout-title\"><span class=\"text\">Accessibilità</span></div> <p> Nel caso in cui il numero di link sia superiore a 2, è necessario passare al componente \\`it-skiplinks\\` l'attributo \\`it-aria-label\\` dedicato che ne spieghi l’uso. In questo caso infatti verrà generato un elemento \\`<nav>\\` a cui verrà applicato l'attributo \\`aria-label\\` per migliorarne l'accessibilità. </p></div></div> Nell’esempio che segue, implementato per il sito Designers Italia, sono inseriti due collegamenti che è utile approfondire: - un salto ad un *modulo per chiedere alle persone come stanno valutando l’esperienza d’uso* della pagina. Il testo dello skiplink anticipa già la domanda; - un *collegamento diretto alla Dichiarazione di accessibilità disponibile sul form AgID*, che accompagnerà il necessario link presente anche nel piede di pagina, per permettere a chi naviga con strumenti assistivi di trovarla facilmente senza dover scansionare tutti i contennuti. È raccomandato di limitare il numero di elementi scorciatoia per evitare che gli utenti debbano saltare le scorciatoie stesse. `, }, }, }, } satisfies Meta<SkiplinksProps>"
87
+ },
88
+ {
89
+ "kind": "variable",
90
+ "name": "EsempioInterattivo",
91
+ "type": {
92
+ "text": "Story"
93
+ },
94
+ "default": "{ ...meta, name: 'Esempio', args: { 'it-aria-label': 'Vai a:', }, parameters: { docs: { className: 'my-wide-story', canvas: { sourceState: 'shown', }, }, }, render: (params) => html` ${renderComponent({ ...params, slot: html`<a href=\"#menu\">Vai al menu</a> <a href=\"#main-content\">Vai al contenuto principale</a> <a href=\"#satisfaction\">Questa pagina ti è stata utile?</a> <a href=\"#footer\">Vai al piè di pagina</a> <a href=\"https://form.agid.gov.it/view/xyz\">Dichiarazione di accessibilità (link esterno su sito AgID</a> `, })}`, }"
95
+ },
96
+ {
97
+ "kind": "variable",
98
+ "name": "PochiLink",
99
+ "type": {
100
+ "text": "Story"
101
+ },
102
+ "default": "{ ...meta, name: 'Numero ridotto di link', args: {}, parameters: { docs: { description: { story: ` Quando sono presenti uno o due link, il componente evita di generare un elemento \\`<nav>\\` al fine di ridurre la complessità di lettura per gli screen reader. `, }, }, }, render: (params) => html` ${renderComponent({ ...params, // eslint-disable-next-line no-useless-computed-key ['it-aria-label']: undefined, slot: html`<a href=\"#menu\">Vai al menu</a> <a href=\"#main-content\">Vai al contenuto principale</a> `, })}`, }"
103
+ }
104
+ ],
105
+ "exports": [
106
+ {
107
+ "kind": "js",
108
+ "name": "default",
109
+ "declaration": {
110
+ "name": "meta",
111
+ "module": "stories/it-skiplinks.stories.ts"
112
+ }
113
+ },
114
+ {
115
+ "kind": "js",
116
+ "name": "EsempioInterattivo",
117
+ "declaration": {
118
+ "name": "EsempioInterattivo",
119
+ "module": "stories/it-skiplinks.stories.ts"
120
+ }
121
+ },
122
+ {
123
+ "kind": "js",
124
+ "name": "PochiLink",
125
+ "declaration": {
126
+ "name": "PochiLink",
127
+ "module": "stories/it-skiplinks.stories.ts"
128
+ }
129
+ }
130
+ ]
131
+ }
132
+ ]
133
+ }
@@ -0,0 +1,2 @@
1
+ export { ItSkiplinks } from './it-skiplinks.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { ItSkiplinks } from './it-skiplinks.js';
2
+ import 'lit';
3
+ import 'lit/decorators.js';
4
+ import 'lit/directive.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,13 @@
1
+ import { BaseComponent } from '@italia/globals';
2
+ export declare class ItSkiplinks extends BaseComponent {
3
+ static styles: import("lit").CSSResultGroup;
4
+ protected links: never[];
5
+ private _onSlotChange;
6
+ render(): import("lit").TemplateResult<1>;
7
+ }
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'it-skiplinks': ItSkiplinks;
11
+ }
12
+ }
13
+ //# sourceMappingURL=it-skiplinks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-skiplinks.d.ts","sourceRoot":"","sources":["../../src/it-skiplinks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAG/D,qBACa,WAAY,SAAQ,aAAa;IAC5C,MAAM,CAAC,MAAM,+BAAU;IAEvB,SAAS,CAAC,KAAK,UAAM;IAErB,OAAO,CAAC,aAAa;IAcrB,MAAM;CAwBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}