@italia/breadcrumbs 1.0.0-alpha.10

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/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,29 @@
1
+ # Breadcrumbs Web Component
2
+
3
+ Questo package contiene il web component `<it-breadcrumbs>`, conforme agli standard del progetto e con stili Bootstrap Italia.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @italia/breadcrumbs
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <it-breadcrumbs it-aria-label="Percorso di navigazione">
15
+ <it-breadcrumb-item><a href="#">Home</a></it-breadcrumb-item>
16
+ <it-breadcrumb-item><a href="#">Sezione</a></it-breadcrumb-item>
17
+ <it-breadcrumb-item>Voce corrente</it-breadcrumb-item>
18
+ </it-breadcrumbs>
19
+ ```
20
+
21
+ ## Sviluppo
22
+
23
+ - Stili: solo SCSS, no CSS inline
24
+ - Test: web-test-runner
25
+ - Storie: Storybook
26
+
27
+ ## License
28
+
29
+ Vedi LICENSE.
@@ -0,0 +1,314 @@
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": "ItBreadcrumb",
13
+ "declaration": {
14
+ "name": "ItBreadcrumb",
15
+ "module": "./it-breadcrumbs.js"
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "ItBreadcrumbItem",
21
+ "declaration": {
22
+ "name": "ItBreadcrumbItem",
23
+ "module": "./it-breadcrumb-item.js"
24
+ }
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ "kind": "javascript-module",
30
+ "path": "src/it-breadcrumb-item.ts",
31
+ "declarations": [
32
+ {
33
+ "kind": "class",
34
+ "description": "Breadcrumb item component representing a single item in the breadcrumb trail.\n- Wraps slotted content (typically an anchor or text)\n- Adds a separator after the item\n- Supports progressive enhancement: links work even without JavaScript",
35
+ "name": "ItBreadcrumbItem",
36
+ "members": [
37
+ {
38
+ "kind": "field",
39
+ "name": "current",
40
+ "type": {
41
+ "text": "boolean"
42
+ },
43
+ "privacy": "private",
44
+ "default": "false"
45
+ },
46
+ {
47
+ "kind": "method",
48
+ "name": "setCurrent",
49
+ "privacy": "public",
50
+ "parameters": [
51
+ {
52
+ "name": "value",
53
+ "type": {
54
+ "text": "boolean"
55
+ }
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ "kind": "field",
61
+ "name": "separator",
62
+ "type": {
63
+ "text": "string"
64
+ },
65
+ "privacy": "private",
66
+ "default": "'/'"
67
+ },
68
+ {
69
+ "kind": "method",
70
+ "name": "setSeparator",
71
+ "privacy": "public",
72
+ "parameters": [
73
+ {
74
+ "name": "value",
75
+ "type": {
76
+ "text": "string"
77
+ }
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "kind": "method",
83
+ "name": "_getSeparatorClasses",
84
+ "privacy": "private"
85
+ }
86
+ ],
87
+ "superclass": {
88
+ "name": "BaseComponent",
89
+ "package": "@italia/globals"
90
+ },
91
+ "tagName": "it-breadcrumb-item",
92
+ "customElement": true
93
+ }
94
+ ],
95
+ "exports": [
96
+ {
97
+ "kind": "js",
98
+ "name": "ItBreadcrumbItem",
99
+ "declaration": {
100
+ "name": "ItBreadcrumbItem",
101
+ "module": "src/it-breadcrumb-item.ts"
102
+ }
103
+ },
104
+ {
105
+ "kind": "custom-element-definition",
106
+ "name": "it-breadcrumb-item",
107
+ "declaration": {
108
+ "name": "ItBreadcrumbItem",
109
+ "module": "src/it-breadcrumb-item.ts"
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "kind": "javascript-module",
116
+ "path": "src/it-breadcrumbs.ts",
117
+ "declarations": [
118
+ {
119
+ "kind": "class",
120
+ "description": "Simple breadcrumbs component following repository conventions.\n- Renders a list of slotted anchors or items\n- Dark mode variant",
121
+ "name": "ItBreadcrumb",
122
+ "members": [
123
+ {
124
+ "kind": "field",
125
+ "name": "itAriaLabel",
126
+ "type": {
127
+ "text": "string"
128
+ },
129
+ "default": "'Breadcrumbs'",
130
+ "attribute": "it-aria-label",
131
+ "reflects": true
132
+ },
133
+ {
134
+ "kind": "field",
135
+ "name": "separator",
136
+ "type": {
137
+ "text": "string"
138
+ },
139
+ "default": "'/'",
140
+ "attribute": "separator",
141
+ "reflects": true
142
+ },
143
+ {
144
+ "kind": "field",
145
+ "name": "dark",
146
+ "type": {
147
+ "text": "boolean"
148
+ },
149
+ "default": "false",
150
+ "attribute": "dark",
151
+ "reflects": true
152
+ },
153
+ {
154
+ "kind": "method",
155
+ "name": "_setChildrenProperties",
156
+ "privacy": "private"
157
+ }
158
+ ],
159
+ "attributes": [
160
+ {
161
+ "name": "it-aria-label",
162
+ "type": {
163
+ "text": "string"
164
+ },
165
+ "default": "'Breadcrumbs'",
166
+ "fieldName": "itAriaLabel"
167
+ },
168
+ {
169
+ "name": "separator",
170
+ "type": {
171
+ "text": "string"
172
+ },
173
+ "default": "'/'",
174
+ "fieldName": "separator"
175
+ },
176
+ {
177
+ "name": "dark",
178
+ "type": {
179
+ "text": "boolean"
180
+ },
181
+ "default": "false",
182
+ "fieldName": "dark"
183
+ }
184
+ ],
185
+ "superclass": {
186
+ "name": "BaseComponent",
187
+ "package": "@italia/globals"
188
+ },
189
+ "tagName": "it-breadcrumbs",
190
+ "customElement": true
191
+ }
192
+ ],
193
+ "exports": [
194
+ {
195
+ "kind": "js",
196
+ "name": "ItBreadcrumb",
197
+ "declaration": {
198
+ "name": "ItBreadcrumb",
199
+ "module": "src/it-breadcrumbs.ts"
200
+ }
201
+ },
202
+ {
203
+ "kind": "custom-element-definition",
204
+ "name": "it-breadcrumbs",
205
+ "declaration": {
206
+ "name": "ItBreadcrumb",
207
+ "module": "src/it-breadcrumbs.ts"
208
+ }
209
+ }
210
+ ]
211
+ },
212
+ {
213
+ "kind": "javascript-module",
214
+ "path": "stories/it-breadcrumbs.stories.ts",
215
+ "declarations": [
216
+ {
217
+ "kind": "variable",
218
+ "name": "meta",
219
+ "default": "{ title: 'Componenti/Breadcrumbs', tags: ['web-component', 'a11y-ok'], component: 'it-breadcrumbs', parameters: { a11y: { config: { rules: [ { id: 'list', enabled: false, }, { id: 'listitem', enabled: false, }, ], }, }, }, args: { 'it-aria-label': 'Percorso di navigazione', dark: false, }, argTypes: { 'it-aria-label': { control: 'text', description: 'Testo usato come `aria-label` sul contenitore di navigazione (es. \"Percorso di navigazione\").', }, dark: { control: 'boolean', description: 'Imposta la variante a tema scuro.', }, }, } satisfies Meta<BreadcrumbProps>"
220
+ },
221
+ {
222
+ "kind": "variable",
223
+ "name": "EsempioInterattivo",
224
+ "type": {
225
+ "text": "Story"
226
+ },
227
+ "default": "{ name: 'Esempio interattivo', tags: ['!autodocs', '!dev'], parameters: { docs: { canvas: { sourceState: 'hidden' } } }, render: (args) => html` <it-breadcrumbs it-aria-label=${args['it-aria-label']} ?dark=\"${ifDefined(args.dark)}\"> <it-breadcrumb-item><a href=\"#\">Home</a></it-breadcrumb-item> <it-breadcrumb-item><a href=\"#\">Sezione</a></it-breadcrumb-item> <it-breadcrumb-item>Voce corrente</it-breadcrumb-item> </it-breadcrumbs> `, }"
228
+ },
229
+ {
230
+ "kind": "variable",
231
+ "name": "ConLink",
232
+ "type": {
233
+ "text": "Story"
234
+ },
235
+ "default": "{ tags: ['!autodocs', '!dev'], args: { 'it-aria-label': 'Breadcrumb con link', }, render: (args) => html` <it-breadcrumbs it-aria-label=${args['it-aria-label']}> <it-breadcrumb-item><a href=\"#\">Home</a></it-breadcrumb-item> <it-breadcrumb-item><a href=\"#\">Sezione</a></it-breadcrumb-item> <it-breadcrumb-item>Voce corrente</it-breadcrumb-item> </it-breadcrumbs> `, }"
236
+ },
237
+ {
238
+ "kind": "variable",
239
+ "name": "ConIcona",
240
+ "type": {
241
+ "text": "Story"
242
+ },
243
+ "default": "{ name: 'Con icona', render: () => html` <it-breadcrumbs it-aria-label=\"Percorso di navigazione\"> <it-breadcrumb-item> <a href=\"#\"><it-icon name=\"it-link\" color=\"secondary\" size=\"sm\" class=\"me-1\"></it-icon>Home</a> </it-breadcrumb-item> <it-breadcrumb-item> <a href=\"#\"><it-icon name=\"it-link\" color=\"secondary\" size=\"sm\" class=\"me-1\"></it-icon>Sezione</a> </it-breadcrumb-item> <it-breadcrumb-item> <a href=\"#\"><it-icon name=\"it-link\" color=\"secondary\" size=\"sm\" class=\"me-1\"></it-icon>Voce corrente</a> </it-breadcrumb-item> </it-breadcrumbs> `, }"
244
+ },
245
+ {
246
+ "kind": "variable",
247
+ "name": "SeparatorePersonalizzato",
248
+ "type": {
249
+ "text": "Story"
250
+ },
251
+ "default": "{ args: { 'it-aria-label': 'Breadcrumb con separatore personalizzato', separator: '>', }, render: (args) => html` <it-breadcrumbs label=${args['it-aria-label']} separator=${args.separator}> <it-breadcrumb-item><a href=\"#\">Home</a></it-breadcrumb-item> <it-breadcrumb-item><a href=\"#\">Sezione</a></it-breadcrumb-item> <it-breadcrumb-item>Voce corrente</it-breadcrumb-item> </it-breadcrumbs> <it-breadcrumbs it-aria-label=\"Percorso di navigazione con icona come separatore\" class=\"mt-3\"> <it-breadcrumb-item> <a href=\"#\">Home</a> <it-icon name=\"it-chevron-right\" color=\"secondary\" size=\"sm\" slot=\"separator\" class=\"my-separator\"></it-icon> </it-breadcrumb-item> <it-breadcrumb-item> <a href=\"#\">Sezione</a> <it-icon name=\"it-chevron-right\" color=\"secondary\" size=\"sm\" slot=\"separator\" class=\"my-separator\"></it-icon> </it-breadcrumb-item> <it-breadcrumb-item>Voce corrente</it-breadcrumb-item> </it-breadcrumbs> <style> .my-separator { margin-inline: -4px; } </style> `, }"
252
+ },
253
+ {
254
+ "kind": "variable",
255
+ "name": "Sfondo",
256
+ "type": {
257
+ "text": "Story"
258
+ },
259
+ "default": "{ name: 'Sfondo scuro', render: () => html` <it-breadcrumbs it-aria-label=\"Percorso di navigazione\" dark> <it-breadcrumb-item><a href=\"#\">Home</a></it-breadcrumb-item> <it-breadcrumb-item><a href=\"#\">Sezione</a></it-breadcrumb-item> <it-breadcrumb-item>Voce corrente</it-breadcrumb-item> </it-breadcrumbs> <it-breadcrumbs it-aria-label=\"Percorso di navigazione2\" dark> <it-breadcrumb-item> <a href=\"#\">Home</a> <it-icon name=\"it-chevron-right\" color=\"inverse\" size=\"sm\" slot=\"separator\" class=\"my-separator\"></it-icon> </it-breadcrumb-item> <it-breadcrumb-item> <a href=\"#\">Sezione</a> <it-icon name=\"it-chevron-right\" color=\"inverse\" size=\"sm\" slot=\"separator\" class=\"my-separator\"></it-icon> </it-breadcrumb-item> <it-breadcrumb-item>Voce corrente</it-breadcrumb-item> </it-breadcrumbs> <it-breadcrumbs it-aria-label=\"Percorso di navigazione3\" dark> <it-breadcrumb-item> <a href=\"#\"> <it-icon name=\"it-link\" color=\"inverse\" size=\"sm\" class=\"me-1\"></it-icon> Home </a> </it-breadcrumb-item> <it-breadcrumb-item> <a href=\"#\"> <it-icon name=\"it-link\" color=\"inverse\" size=\"sm\" class=\"me-1\"></it-icon> Sezione </a> </it-breadcrumb-item> <it-breadcrumb-item> <it-icon name=\"it-link\" color=\"inverse\" size=\"sm\" class=\"me-1\"></it-icon> Voce corrente </it-breadcrumb-item> </it-breadcrumbs> <style> .my-separator { margin-inline: -4px; } </style> `, }"
260
+ }
261
+ ],
262
+ "exports": [
263
+ {
264
+ "kind": "js",
265
+ "name": "default",
266
+ "declaration": {
267
+ "name": "meta",
268
+ "module": "stories/it-breadcrumbs.stories.ts"
269
+ }
270
+ },
271
+ {
272
+ "kind": "js",
273
+ "name": "EsempioInterattivo",
274
+ "declaration": {
275
+ "name": "EsempioInterattivo",
276
+ "module": "stories/it-breadcrumbs.stories.ts"
277
+ }
278
+ },
279
+ {
280
+ "kind": "js",
281
+ "name": "ConLink",
282
+ "declaration": {
283
+ "name": "ConLink",
284
+ "module": "stories/it-breadcrumbs.stories.ts"
285
+ }
286
+ },
287
+ {
288
+ "kind": "js",
289
+ "name": "ConIcona",
290
+ "declaration": {
291
+ "name": "ConIcona",
292
+ "module": "stories/it-breadcrumbs.stories.ts"
293
+ }
294
+ },
295
+ {
296
+ "kind": "js",
297
+ "name": "SeparatorePersonalizzato",
298
+ "declaration": {
299
+ "name": "SeparatorePersonalizzato",
300
+ "module": "stories/it-breadcrumbs.stories.ts"
301
+ }
302
+ },
303
+ {
304
+ "kind": "js",
305
+ "name": "Sfondo",
306
+ "declaration": {
307
+ "name": "Sfondo",
308
+ "module": "stories/it-breadcrumbs.stories.ts"
309
+ }
310
+ }
311
+ ]
312
+ }
313
+ ]
314
+ }
@@ -0,0 +1,3 @@
1
+ export { ItBreadcrumb } from './it-breadcrumbs.js';
2
+ export { ItBreadcrumbItem } from './it-breadcrumb-item.js';
3
+ //# 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,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { ItBreadcrumb } from './it-breadcrumbs.js';
2
+ export { I as ItBreadcrumbItem } from '../it-breadcrumb-item-Cvx6w0id.js';
3
+ import 'lit';
4
+ import 'lit/decorators.js';
5
+ import 'lit/directive.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,23 @@
1
+ import { BaseComponent } from '@italia/globals';
2
+ /**
3
+ * Breadcrumb item component representing a single item in the breadcrumb trail.
4
+ * - Wraps slotted content (typically an anchor or text)
5
+ * - Adds a separator after the item
6
+ * - Supports progressive enhancement: links work even without JavaScript
7
+ *
8
+ */
9
+ export declare class ItBreadcrumbItem extends BaseComponent {
10
+ static styles: import("lit").CSSResultGroup;
11
+ private current;
12
+ setCurrent(value: boolean): void;
13
+ private separator;
14
+ setSeparator(value: string): void;
15
+ private _getSeparatorClasses;
16
+ render(): import("lit").TemplateResult<1>;
17
+ }
18
+ declare global {
19
+ interface HTMLElementTagNameMap {
20
+ 'it-breadcrumb-item': ItBreadcrumbItem;
21
+ }
22
+ }
23
+ //# sourceMappingURL=it-breadcrumb-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-breadcrumb-item.d.ts","sourceRoot":"","sources":["../../src/it-breadcrumb-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD;;;;;;GAMG;AACH,qBACa,gBAAiB,SAAQ,aAAa;IACjD,MAAM,CAAC,MAAM,+BAAU;IAEd,OAAO,CAAC,OAAO,CAAS;IAE1B,UAAU,CAAC,KAAK,EAAE,OAAO;IAIvB,OAAO,CAAC,SAAS,CAAO;IAE1B,YAAY,CAAC,KAAK,EAAE,MAAM;IAIjC,OAAO,CAAC,oBAAoB;IAoBnB,MAAM;CAgBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
@@ -0,0 +1,5 @@
1
+ export { I as ItBreadcrumbItem } from '../it-breadcrumb-item-Cvx6w0id.js';
2
+ import 'lit';
3
+ import 'lit/decorators.js';
4
+ import 'lit/directive.js';
5
+ //# sourceMappingURL=it-breadcrumb-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-breadcrumb-item.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,20 @@
1
+ import { BaseComponent } from '@italia/globals';
2
+ /**
3
+ * Simple breadcrumbs component following repository conventions.
4
+ * - Renders a list of slotted anchors or items
5
+ * - Dark mode variant
6
+ */
7
+ export declare class ItBreadcrumb extends BaseComponent {
8
+ static styles: import("lit").CSSResultGroup;
9
+ itAriaLabel: string;
10
+ separator: string;
11
+ dark: boolean;
12
+ private _setChildrenProperties;
13
+ render(): import("lit").TemplateResult<1>;
14
+ }
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'it-breadcrumbs': ItBreadcrumb;
18
+ }
19
+ }
20
+ //# sourceMappingURL=it-breadcrumbs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/it-breadcrumbs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMhD;;;;GAIG;AACH,qBACa,YAAa,SAAQ,aAAa;IAC7C,MAAM,CAAC,MAAM,+BAAU;IAEgD,WAAW,SAAiB;IAExD,SAAS,SAAO;IAEf,IAAI,UAAS;IAEzD,OAAO,CAAC,sBAAsB;IAarB,MAAM;CAUhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
@@ -0,0 +1,150 @@
1
+ import { _ as __decorate, a as __metadata, B as BaseComponent, I as ItBreadcrumbItem } from '../it-breadcrumb-item-Cvx6w0id.js';
2
+ import { css, html } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
4
+ import 'lit/directive.js';
5
+
6
+ var styles = css`/***************************** 1 ****************************************/
7
+ /***************************** 2 ****************************************/
8
+ /***************************** 1 ****************************************/
9
+ /***************************** 2 ****************************************/
10
+ /***************************** 1 ****************************************/
11
+ /***************************** 2 ****************************************/
12
+ /***************************** 3 ****************************************/
13
+ /***************************** 1 ****************************************/
14
+ /***************************** 2 ****************************************/
15
+ /***************************** 3 ****************************************/
16
+ /***************************** NEUTRAL 1 ****************************************/
17
+ /***************************** NEUTRAL 2 ****************************************/
18
+ /***************************** NEUTRAL 2 / 3 ****************************************/
19
+ .breadcrumb {
20
+ --bsi-breadcrumb-background: transparent;
21
+ --bsi-breadcrumb-border-radius: 0;
22
+ --bsi-breadcrumb-divider: '/';
23
+ --bsi-breadcrumb-divider-color: var(--bsi-color-border-secondary);
24
+ --bsi-breadcrumb-divider-flipped: var(--bsi-breadcrumb-divider);
25
+ --bsi-breadcrumb-font-size: var(--bsi-label-font-size);
26
+ --bsi-breadcrumb-item-padding-x: var(--bsi-spacing-xs);
27
+ --bsi-breadcrumb-link-color: var(--bsi-color-text-secondary);
28
+ --bsi-breadcrumb-link-font-weight: var(--bsi-font-weight-solid);
29
+ --bsi-breadcrumb-margin: var(--bsi-spacing-s);
30
+ --bsi-breadcrumb-padding: var(--bsi-spacing-3xs);
31
+ --bsi-breadcrumb-separator-color: var(--bsi-color-background-secondary);
32
+ --bsi-breadcrumb-separator-spacing: var(--bsi-spacing-xxs);
33
+ }
34
+
35
+ /* stylelint-disable-next-line no-duplicate-selectors */
36
+ .breadcrumb {
37
+ display: flex;
38
+ flex-wrap: wrap;
39
+ margin-bottom: var(--bsi-breadcrumb-margin);
40
+ padding: var(--bsi-breadcrumb-padding);
41
+ background-color: var(--bsi-breadcrumb-background, transparent);
42
+ list-style: none;
43
+ font-size: var(--bsi-breadcrumb-font-size);
44
+ }
45
+ .breadcrumb.dark {
46
+ --bsi-breadcrumb-background: var(--bsi-color-background-emphasis);
47
+ --bsi-breadcrumb-link-color: var(--bsi-color-text-inverse);
48
+ --bsi-breadcrumb-item-active-color: var(--bsi-color-text-inverse);
49
+ --bsi-breadcrumb-divider-color: var(--bsi-color-text-inverse);
50
+ }
51
+ .breadcrumb.dark .breadcrumb-item a:hover {
52
+ --bsi-breadcrumb-link-color: var(--bsi-color-text-inverse);
53
+ }
54
+ .breadcrumb.dark .breadcrumb-item .separator {
55
+ color: var(--bsi-breadcrumb-link-color);
56
+ }
57
+
58
+ .breadcrumb-item {
59
+ padding-left: 0;
60
+ }
61
+ .breadcrumb-item + .breadcrumb-item::before {
62
+ content: var(--bsi-breadcrumb-divider, "/") /* rtl: var(--bsi-breadcrumb-divider, "/") */;
63
+ padding-right: var(--bsi-breadcrumb-item-padding-x);
64
+ float: left;
65
+ color: var(--bsi-breadcrumb-divider-color);
66
+ }
67
+ .breadcrumb-item + .breadcrumb-item:before {
68
+ display: none;
69
+ }
70
+ .breadcrumb-item a {
71
+ color: var(--bsi-breadcrumb-link-color);
72
+ font-weight: var(--bsi-breadcrumb-link-font-weight);
73
+ }
74
+ .breadcrumb-item a:hover {
75
+ --bsi-breadcrumb-link-color: var(--bsi-color-link-secondary-hover);
76
+ }
77
+ .breadcrumb-item.active {
78
+ color: var(--bsi-breadcrumb-item-active-color);
79
+ font-weight: var(--bsi-font-weight-regular);
80
+ pointer-events: none;
81
+ }
82
+ .breadcrumb-item .separator {
83
+ display: inline-block;
84
+ padding: 0 var(--bsi-breadcrumb-separator-spacing);
85
+ color: var(--bsi-breadcrumb-separator-color);
86
+ }
87
+
88
+ .breadcrumb.dark {
89
+ --bsi-breadcrumb-padding: var(--bsi-spacing-3xs) var(--bsi-spacing-s);
90
+ }
91
+ .breadcrumb.dark ::slotted(it-breadcrumb-item) {
92
+ --bsi-breadcrumb-link-color: #fff;
93
+ --bsi-breadcrumb-item-active-color: #fff;
94
+ --bsi-breadcrumb-separator-color: #fff;
95
+ }`;
96
+
97
+ /**
98
+ * Simple breadcrumbs component following repository conventions.
99
+ * - Renders a list of slotted anchors or items
100
+ * - Dark mode variant
101
+ */
102
+ let ItBreadcrumb = class ItBreadcrumb extends BaseComponent {
103
+ constructor() {
104
+ super(...arguments);
105
+ this.itAriaLabel = 'Breadcrumbs';
106
+ this.separator = '/';
107
+ this.dark = false;
108
+ }
109
+ _setChildrenProperties() {
110
+ const slot = this.shadowRoot?.querySelector('slot');
111
+ const assignedElements = slot?.assignedElements({ flatten: true }) || [];
112
+ assignedElements.forEach((el, index) => {
113
+ if (el instanceof ItBreadcrumbItem) {
114
+ const current = index === assignedElements.length - 1;
115
+ el.setCurrent(current);
116
+ el.setSeparator(this.separator);
117
+ // No need for requestUpdate() because current and separator are reactive @state() properties
118
+ }
119
+ });
120
+ }
121
+ render() {
122
+ const olClasses = this.dark ? 'breadcrumb dark' : 'breadcrumb';
123
+ return html `
124
+ <nav aria-label="${this.itAriaLabel}" part="breadcrumbs-container" class="breadcrumb-container">
125
+ <ol class="${olClasses}" part="breadcrumbs">
126
+ <slot @slotchange=${this._setChildrenProperties}></slot>
127
+ </ol>
128
+ </nav>
129
+ `;
130
+ }
131
+ };
132
+ ItBreadcrumb.styles = styles;
133
+ __decorate([
134
+ property({ type: String, reflect: true, attribute: 'it-aria-label' }),
135
+ __metadata("design:type", Object)
136
+ ], ItBreadcrumb.prototype, "itAriaLabel", void 0);
137
+ __decorate([
138
+ property({ type: String, reflect: true }),
139
+ __metadata("design:type", Object)
140
+ ], ItBreadcrumb.prototype, "separator", void 0);
141
+ __decorate([
142
+ property({ type: Boolean, reflect: true }),
143
+ __metadata("design:type", Object)
144
+ ], ItBreadcrumb.prototype, "dark", void 0);
145
+ ItBreadcrumb = __decorate([
146
+ customElement('it-breadcrumbs')
147
+ ], ItBreadcrumb);
148
+
149
+ export { ItBreadcrumb };
150
+ //# sourceMappingURL=it-breadcrumbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-breadcrumbs.js","sources":["../../../src/it-breadcrumbs.ts"],"sourcesContent":["/* eslint-disable lit-a11y/list */\nimport { BaseComponent } from '@italia/globals';\nimport { html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ItBreadcrumbItem } from '@italia/breadcrumbs';\nimport styles from './breadcrumbs.scss';\n\n/**\n * Simple breadcrumbs component following repository conventions.\n * - Renders a list of slotted anchors or items\n * - Dark mode variant\n */\n@customElement('it-breadcrumbs')\nexport class ItBreadcrumb extends BaseComponent {\n static styles = styles;\n\n @property({ type: String, reflect: true, attribute: 'it-aria-label' }) itAriaLabel = 'Breadcrumbs';\n\n @property({ type: String, reflect: true }) separator = '/';\n\n @property({ type: Boolean, reflect: true }) dark = false;\n\n private _setChildrenProperties() {\n const slot = this.shadowRoot?.querySelector('slot');\n const assignedElements = slot?.assignedElements({ flatten: true }) || [];\n assignedElements.forEach((el, index) => {\n if (el instanceof ItBreadcrumbItem) {\n const current = index === assignedElements.length - 1;\n el.setCurrent(current);\n el.setSeparator(this.separator);\n // No need for requestUpdate() because current and separator are reactive @state() properties\n }\n });\n }\n\n override render() {\n const olClasses = this.dark ? 'breadcrumb dark' : 'breadcrumb';\n return html`\n <nav aria-label=\"${this.itAriaLabel}\" part=\"breadcrumbs-container\" class=\"breadcrumb-container\">\n <ol class=\"${olClasses}\" part=\"breadcrumbs\">\n <slot @slotchange=${this._setChildrenProperties}></slot>\n </ol>\n </nav>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-breadcrumbs': ItBreadcrumb;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;;;;AAIG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,aAAa,CAAA;AAAxC,IAAA,WAAA,GAAA;;QAGkE,IAAA,CAAA,WAAW,GAAG,aAAa;QAEvD,IAAA,CAAA,SAAS,GAAG,GAAG;QAEd,IAAA,CAAA,IAAI,GAAG,KAAK;IAyB1D;IAvBU,sBAAsB,GAAA;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC;AACnD,QAAA,MAAM,gBAAgB,GAAG,IAAI,EAAE,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE;QACxE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,KAAI;AACrC,YAAA,IAAI,EAAE,YAAY,gBAAgB,EAAE;gBAClC,MAAM,OAAO,GAAG,KAAK,KAAK,gBAAgB,CAAC,MAAM,GAAG,CAAC;AACrD,gBAAA,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;AACtB,gBAAA,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;;YAEjC;AACF,QAAA,CAAC,CAAC;IACJ;IAES,MAAM,GAAA;AACb,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,GAAG,iBAAiB,GAAG,YAAY;AAC9D,QAAA,OAAO,IAAI,CAAA;AACU,uBAAA,EAAA,IAAI,CAAC,WAAW,CAAA;qBACpB,SAAS,CAAA;AACA,4BAAA,EAAA,IAAI,CAAC,sBAAsB,CAAA;;;KAGpD;IACH;;AA9BO,YAAA,CAAA,MAAM,GAAG,MAAH;AAE0D,UAAA,CAAA;AAAtE,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;AAA6B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAExD,UAAA,CAAA;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAAiB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAEf,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAAc,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAP9C,YAAY,GAAA,UAAA,CAAA;IADxB,aAAa,CAAC,gBAAgB;AAClB,CAAA,EAAA,YAAY,CAgCxB;;;;"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@italia/breadcrumbs",
3
+ "description": "Web component it-breadcrumbs del Design system .italia",
4
+ "version": "1.0.0-alpha.10",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "license": "BSD-3-Clause",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/italia/dev-kit-italia.git",
12
+ "directory": "packages/breadcrumbs"
13
+ },
14
+ "author": "Presidenza del Consiglio dei Ministri",
15
+ "homepage": "https://italia.github.io/dev-kit-italia",
16
+ "bugs": {
17
+ "url": "https://github.com/italia/dev-kit-italia/issues"
18
+ },
19
+ "type": "module",
20
+ "main": "./dist/src/index.js",
21
+ "module": "./dist/src/index.js",
22
+ "types": "./dist/src/index.d.ts",
23
+ "exports": {
24
+ ".": "./dist/src/index.js",
25
+ "./it-breadcrumbs.js": "./dist/src/it-breadcrumbs.js",
26
+ "./it-breadcrumb-item.js": "./dist/src/it-breadcrumb-item.js",
27
+ "./styles/*": "./styles/*"
28
+ },
29
+ "files": [
30
+ "dist/src",
31
+ "README.md",
32
+ "AUTHORS",
33
+ "LICENSE",
34
+ "custom-elements.json",
35
+ "styles"
36
+ ],
37
+ "dependencies": {
38
+ "bootstrap-italia": "3.0.0-alpha.9",
39
+ "lit": "^3.3.0",
40
+ "@italia/globals": "^1.0.0-alpha.10"
41
+ },
42
+ "devDependencies": {
43
+ "@custom-elements-manifest/analyzer": "^0.10.3",
44
+ "@open-wc/testing": "^4.0.0",
45
+ "@rollup/plugin-node-resolve": "^16.0.1",
46
+ "@rollup/plugin-typescript": "^12.1.2",
47
+ "@types/mocha": "^10.0.10",
48
+ "@web/test-runner": "^0.18.2",
49
+ "rollup": "^4.42.0",
50
+ "rollup-plugin-scss-lit": "^2.1.0",
51
+ "sass": "^1.89.0",
52
+ "tslib": "^2.6.3",
53
+ "typescript": "^5.5.3",
54
+ "@italia/test-config": "^0.0.0",
55
+ "@italia/typescript-config": "^0.0.0",
56
+ "@italia/icon": "^1.0.0-alpha.10"
57
+ },
58
+ "customElements": "custom-elements.json",
59
+ "scripts": {
60
+ "analyze": "cem analyze --litelement --exclude dist",
61
+ "build": "rollup --config rollup.config.js",
62
+ "clean": "rimraf node_modules .turbo .rollup.cache dist coverage",
63
+ "prepublish": "pnpm build",
64
+ "lint": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && stylelint \"styles/**/*.scss\" \"src/**/*.scss\" && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --check",
65
+ "format": "eslint --fix --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && stylelint --fix \"styles/**/*.scss\" \"src/**/*.scss\" && prettier --write \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\"",
66
+ "test": "wtr --coverage --node-resolve --config web-test-runner.config.js",
67
+ "test:watch": "wtr --coverage --node-resolve --config web-test-runner.config.js --watch"
68
+ }
69
+ }
@@ -0,0 +1,72 @@
1
+ @import 'bootstrap-italia/src/scss/base/functions';
2
+ @import 'bootstrap-italia/src/scss/base/variables';
3
+ // TODO: refactor once BSI styles are fixed and updated
4
+ it-breadcrumbs:not(:defined) {
5
+ --it-host-display: flex;
6
+ --it-breadcrumb-background-color: transparent;
7
+ --it-breadcrumb-text-color: inherit;
8
+ display: var(--it-host-display);
9
+
10
+ it-breadcrumb-item:not(:defined) {
11
+ display: inline-flex;
12
+ align-items: center;
13
+
14
+ a {
15
+ display: var(--it-host-display);
16
+ align-items: center;
17
+ color: var(--#{$prefix}breadcrumb-link-color, var(--it-breadcrumb-text-color));
18
+ font-weight: var(--#{$prefix}breadcrumb-link-font-weight, 600);
19
+ }
20
+
21
+ &:not(:last-child)::after {
22
+ padding: 0 0.5rem;
23
+ color: var(--#{$prefix}breadcrumb-separator-color);
24
+ content: '/';
25
+ }
26
+
27
+ &:has([slot='separator'])::after {
28
+ padding: 0;
29
+ content: '';
30
+ }
31
+
32
+ color: var(--#{$prefix}breadcrumb-link-color);
33
+
34
+ [slot='separator'] {
35
+ display: inline-flex;
36
+ align-items: center;
37
+ margin-inline: 0.5rem;
38
+ }
39
+ }
40
+
41
+ it-icon {
42
+ width: 20px;
43
+ height: 20px;
44
+ }
45
+ }
46
+
47
+ it-breadcrumbs[dark]:not(:defined) {
48
+ --it-breadcrumb-background-color: hsl(210, 25%, 35.2%);
49
+ --it-breadcrumb-text-color: #fff;
50
+ padding: 0.75rem 1rem;
51
+ background: var(--it-breadcrumb-background-color);
52
+
53
+ it-breadcrumb-item:not(:defined) {
54
+ a {
55
+ display: var(--it-host-display);
56
+ color: var(--it-breadcrumb-text-color);
57
+ font-weight: var(--#{$prefix}breadcrumb-link-font-weight, 600);
58
+ }
59
+
60
+ &:not(:last-child)::after {
61
+ color: var(--it-breadcrumb-text-color);
62
+ }
63
+
64
+ color: var(--it-breadcrumb-text-color);
65
+
66
+ [slot='separator'] {
67
+ display: inline-flex;
68
+ align-items: center;
69
+ margin-inline: 0.5rem;
70
+ }
71
+ }
72
+ }