@italia/timeline 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.
@@ -0,0 +1,276 @@
1
+ import { _ as __decorate, f as __metadata, B as BaseComponent, c as TIMELINE_POINT_COLORS, e as TIMELINE_VARIANTS, d as TIMELINE_POINT_LIST_TAGS } from '../types-zcTWplot.js';
2
+ import { css, html } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
4
+ import { unsafeStatic, html as html$1 } from 'lit/static-html.js';
5
+ import 'lit/directive.js';
6
+
7
+ var styles = css`/***************************** 1 ****************************************/
8
+ /***************************** 2 ****************************************/
9
+ /***************************** 1 ****************************************/
10
+ /***************************** 2 ****************************************/
11
+ /***************************** 1 ****************************************/
12
+ /***************************** 2 ****************************************/
13
+ /***************************** 3 ****************************************/
14
+ /***************************** 1 ****************************************/
15
+ /***************************** 2 ****************************************/
16
+ /***************************** 3 ****************************************/
17
+ /***************************** NEUTRAL 1 ****************************************/
18
+ /***************************** NEUTRAL 2 ****************************************/
19
+ /***************************** NEUTRAL 2 / 3 ****************************************/
20
+ *,
21
+ *::before,
22
+ *::after {
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ :host {
27
+ display: block;
28
+ --it-timeline-point-content-flex-basis: 0%;
29
+ --it-timeline-point-margin-bottom: 24px;
30
+ --it-timeline-point-content-z-index: 1;
31
+ --it-timeline-point-after-content: '';
32
+ --it-timeline-point-stack-mobile-after-content: none;
33
+ }
34
+
35
+ @media (max-width: 767.98px) {
36
+ :host([stack-mobile]) ::slotted(it-timeline-point) {
37
+ --it-timeline-point-content-flex-basis: 100%;
38
+ --it-timeline-point-content-flex-wrap: wrap;
39
+ --it-timeline-point-margin-top: 24px;
40
+ --it-timeline-point-content-z-index: 2;
41
+ --it-timeline-point-after-content: none;
42
+ --it-timeline-point-stack-mobile-after-content: '';
43
+ --it-timeline-point-stack-mobile-after-top: 0;
44
+ }
45
+ }
46
+
47
+ .it-timeline-wrapper {
48
+ display: block;
49
+ }
50
+
51
+ .it-timeline-wrapper.it-timeline-wrapper--classic .row {
52
+ position: relative;
53
+ padding-top: 64px;
54
+ }
55
+ .it-timeline-wrapper.it-timeline-wrapper--classic .row::after {
56
+ position: absolute;
57
+ top: -16px;
58
+ bottom: -16px;
59
+ left: 40px;
60
+ width: var(--bsi-border-thick, 4px);
61
+ background: var(--bsi-color-background-primary-deep);
62
+ content: "";
63
+ }
64
+ @media (min-width: 992px) {
65
+ .it-timeline-wrapper.it-timeline-wrapper--classic .row::after {
66
+ left: calc(50% - 4px);
67
+ }
68
+ }
69
+
70
+ ::slotted(it-timeline-element) {
71
+ position: relative;
72
+ display: block;
73
+ width: 100%;
74
+ }
75
+
76
+ @media (min-width: 992px) {
77
+ ::slotted(it-timeline-element) {
78
+ width: 50%;
79
+ }
80
+ ::slotted(it-timeline-element:nth-child(odd)) {
81
+ --it-timeline-now-label-base-displacement: 68px;
82
+ --it-timeline-now-label-left: -26px;
83
+ --it-timeline-now-label-right: calc(-1 * var(--it-timeline-now-label-base-displacement));
84
+ --it-timeline-pin-left: auto;
85
+ --it-timeline-pin-right: -22px;
86
+ --it-timeline-pin-direction: row-reverse;
87
+ --it-timeline-pin-icon-mr: 0;
88
+ --it-timeline-pin-icon-ml: 16px;
89
+ --it-timeline-pin-arrow-left: auto;
90
+ --it-timeline-pin-arrow-right: -4px;
91
+ --it-timeline-content-padding: 18px 40px 18px 18px;
92
+ }
93
+ ::slotted(it-timeline-element:nth-child(even)) {
94
+ margin-left: 50%;
95
+ --it-timeline-now-label-base-displacement: 80px;
96
+ --it-timeline-now-label-left: calc(-1 * var(--it-timeline-now-label-base-displacement));
97
+ --it-timeline-now-label-right: unset;
98
+ --it-timeline-pin-left: -26px;
99
+ --it-timeline-pin-right: auto;
100
+ --it-timeline-pin-direction: row;
101
+ --it-timeline-pin-icon-mr: 16px;
102
+ --it-timeline-pin-icon-ml: 0;
103
+ --it-timeline-pin-arrow-left: -4px;
104
+ --it-timeline-pin-arrow-right: auto;
105
+ --it-timeline-content-padding: 18px 18px 18px 40px;
106
+ }
107
+ ::slotted(it-timeline-point) {
108
+ --it-timeline-point-content-flex-basis: 0%;
109
+ --it-timeline-point-margin-bottom: 24px;
110
+ --it-timeline-point-content-z-index: 1;
111
+ --it-timeline-point-after-content: '';
112
+ --it-timeline-point-stack-mobile-after-content: none;
113
+ }
114
+ }
115
+ .it-timeline-point-list {
116
+ padding-left: 0;
117
+ }
118
+ .it-timeline-point-list::marker {
119
+ font-size: 0px;
120
+ }
121
+
122
+ ::slotted(it-timeline-point) {
123
+ display: block;
124
+ width: 100%;
125
+ }`;
126
+
127
+ /**
128
+ * Contenitore universale per entrambe le varianti di timeline di Bootstrap Italia.
129
+ *
130
+ * La variante è determinata dall'attributo `variant`:
131
+ * - `classic` (default) — timeline classica con pin e card, layout `.row > .col-12`.
132
+ * - `point-list` — lista compatta temporale, layout `ol/ul.it-timeline-point-list`.
133
+ *
134
+ * Usa **shadow DOM** con slot reali.
135
+ *
136
+ * @attr {string} variant - `classic` (default) o `point-list`.
137
+ * @attr {string} color - Solo per `point-list`: colore predefinito per tutti i punti figlio che non ne specificano uno. Default: `primary`.
138
+ * @attr {string} as - Solo per `point-list`: `ol` (default) o `ul`.
139
+ * @attr {boolean} stack-mobile - Solo per `point-list`: laterale sopra il contenuto su mobile.
140
+ *
141
+ * @slot - Per `classic`: `<it-timeline-element>`. Per `point-list`: `<it-timeline-point>`.
142
+ *
143
+ * @example Timeline classica
144
+ * ```html
145
+ * <it-timeline>
146
+ * <it-timeline-element variant="past" date="MAGGIO 2026">
147
+ * <it-icon slot="pin-icon" name="it-file" aria-hidden="true"></it-icon>
148
+ * <it-card>
149
+ * <a slot="title" href="#">Titolo</a>
150
+ * <span slot="text">Descrizione.</span>
151
+ * </it-card>
152
+ * </it-timeline-element>
153
+ * </it-timeline>
154
+ * ```
155
+ *
156
+ * @example Timeline point list
157
+ * ```html
158
+ * <it-timeline variant="point-list">
159
+ * <it-timeline-point>
160
+ * <time slot="date" datetime="2025-10-14">
161
+ * <span class="visually-hidden">14 ottobre 2025</span>
162
+ * <span class="point-visual" aria-hidden="true">
163
+ * <span class="point-main">14</span>
164
+ * <span class="point-bottom">ott</span>
165
+ * </span>
166
+ * </time>
167
+ * <p slot="content">Lorem ipsum dolor sit amet.</p>
168
+ * </it-timeline-point>
169
+ * </it-timeline>
170
+ * ```
171
+ */
172
+ let ItTimeline = class ItTimeline extends BaseComponent {
173
+ constructor() {
174
+ super(...arguments);
175
+ /** Variante: `classic` (default) o `point-list`. */
176
+ this.variant = 'classic';
177
+ /**
178
+ * Colore predefinito per i punti figlio — solo per `variant="point-list"`.
179
+ * Viene propagato a tutti gli `<it-timeline-point>` che non hanno un attributo
180
+ * `color` esplicito. Default: `primary`.
181
+ */
182
+ this.color = 'primary';
183
+ /** Tag della lista — solo per `variant="point-list"`. Default: `ol`. */
184
+ this.as = 'ol';
185
+ /** Layout mobile verticale — solo per `variant="point-list"`. */
186
+ this.stackMobile = false;
187
+ /**
188
+ * Compatta ogni elemento it-timeline-point figlio se `true` e non ha un compact esplicito. Solo per `variant="point-list"`.
189
+ */
190
+ this.compact = false;
191
+ /** Propagates container color to child points and sets position on elements. */
192
+ this._onSlotChange = () => {
193
+ const slot = this.shadowRoot?.querySelector('slot');
194
+ if (!slot)
195
+ return;
196
+ const nodes = slot.assignedElements();
197
+ if (this._getVariant() !== 'point-list')
198
+ return;
199
+ const defaultColor = TIMELINE_POINT_COLORS.includes(this.color) ? this.color : 'primary';
200
+ for (const node of nodes) {
201
+ if (node.tagName.toLowerCase() === 'it-timeline-point') {
202
+ const point = node;
203
+ if (!point._hasExplicitColor) {
204
+ point.color = defaultColor;
205
+ }
206
+ if (this.compact && !point._hasExplicitCompact) {
207
+ point.compact = this.compact;
208
+ }
209
+ // Propagate stack-mobile so timeline-point.scss can use :host([stack-mobile])
210
+ point.toggleAttribute('stack-mobile', this.stackMobile);
211
+ }
212
+ }
213
+ };
214
+ }
215
+ updated() {
216
+ // Re-propagate color when the color property changes
217
+ this._onSlotChange();
218
+ }
219
+ _getVariant() {
220
+ return TIMELINE_VARIANTS.includes(this.variant) ? this.variant : 'classic';
221
+ }
222
+ render() {
223
+ return this._getVariant() === 'point-list' ? this._renderPointList() : this._renderClassic();
224
+ }
225
+ _renderClassic() {
226
+ return html `
227
+ <div class="it-timeline-wrapper it-timeline-wrapper--classic">
228
+ <div class="row">
229
+ <slot @slotchange=${this._onSlotChange}></slot>
230
+ </div>
231
+ </div>
232
+ `;
233
+ }
234
+ _renderPointList() {
235
+ const tag = unsafeStatic(TIMELINE_POINT_LIST_TAGS.includes(this.as) ? this.as : 'ol');
236
+ const classes = this.composeClass('it-timeline-point-list', {
237
+ 'it-timeline-point-list-stack-mobile': this.stackMobile,
238
+ });
239
+ return html$1 `
240
+ <div class="it-timeline-wrapper">
241
+ <div class="row">
242
+ <${tag} class="${classes}">
243
+ <slot @slotchange=${this._onSlotChange}></slot>
244
+ </${tag}>
245
+ </div>
246
+ </div>
247
+ `;
248
+ }
249
+ };
250
+ ItTimeline.styles = styles;
251
+ __decorate([
252
+ property({ type: String }),
253
+ __metadata("design:type", String)
254
+ ], ItTimeline.prototype, "variant", void 0);
255
+ __decorate([
256
+ property({ type: String }),
257
+ __metadata("design:type", String)
258
+ ], ItTimeline.prototype, "color", void 0);
259
+ __decorate([
260
+ property({ type: String }),
261
+ __metadata("design:type", String)
262
+ ], ItTimeline.prototype, "as", void 0);
263
+ __decorate([
264
+ property({ type: Boolean, attribute: 'stack-mobile', reflect: true }),
265
+ __metadata("design:type", Object)
266
+ ], ItTimeline.prototype, "stackMobile", void 0);
267
+ __decorate([
268
+ property({ type: Boolean, attribute: 'compact', reflect: true }),
269
+ __metadata("design:type", Object)
270
+ ], ItTimeline.prototype, "compact", void 0);
271
+ ItTimeline = __decorate([
272
+ customElement('it-timeline')
273
+ ], ItTimeline);
274
+
275
+ export { ItTimeline };
276
+ //# sourceMappingURL=it-timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it-timeline.js","sources":["../../../src/it-timeline.ts"],"sourcesContent":["import { BaseComponent } from '@italia/globals';\nimport { html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { html as staticHtml, unsafeStatic } from 'lit/static-html.js';\nimport {\n TIMELINE_POINT_COLORS,\n TIMELINE_POINT_LIST_TAGS,\n TIMELINE_VARIANTS,\n type TimelinePointColor,\n type TimelinePointListTag,\n type TimelineVariant,\n} from './types.js';\nimport styles from './timeline.scss';\nimport { ItTimelinePoint } from './it-timeline-point.js';\n\n/**\n * Contenitore universale per entrambe le varianti di timeline di Bootstrap Italia.\n *\n * La variante è determinata dall'attributo `variant`:\n * - `classic` (default) — timeline classica con pin e card, layout `.row > .col-12`.\n * - `point-list` — lista compatta temporale, layout `ol/ul.it-timeline-point-list`.\n *\n * Usa **shadow DOM** con slot reali.\n *\n * @attr {string} variant - `classic` (default) o `point-list`.\n * @attr {string} color - Solo per `point-list`: colore predefinito per tutti i punti figlio che non ne specificano uno. Default: `primary`.\n * @attr {string} as - Solo per `point-list`: `ol` (default) o `ul`.\n * @attr {boolean} stack-mobile - Solo per `point-list`: laterale sopra il contenuto su mobile.\n *\n * @slot - Per `classic`: `<it-timeline-element>`. Per `point-list`: `<it-timeline-point>`.\n *\n * @example Timeline classica\n * ```html\n * <it-timeline>\n * <it-timeline-element variant=\"past\" date=\"MAGGIO 2026\">\n * <it-icon slot=\"pin-icon\" name=\"it-file\" aria-hidden=\"true\"></it-icon>\n * <it-card>\n * <a slot=\"title\" href=\"#\">Titolo</a>\n * <span slot=\"text\">Descrizione.</span>\n * </it-card>\n * </it-timeline-element>\n * </it-timeline>\n * ```\n *\n * @example Timeline point list\n * ```html\n * <it-timeline variant=\"point-list\">\n * <it-timeline-point>\n * <time slot=\"date\" datetime=\"2025-10-14\">\n * <span class=\"visually-hidden\">14 ottobre 2025</span>\n * <span class=\"point-visual\" aria-hidden=\"true\">\n * <span class=\"point-main\">14</span>\n * <span class=\"point-bottom\">ott</span>\n * </span>\n * </time>\n * <p slot=\"content\">Lorem ipsum dolor sit amet.</p>\n * </it-timeline-point>\n * </it-timeline>\n * ```\n */\n@customElement('it-timeline')\nexport class ItTimeline extends BaseComponent {\n static styles = styles;\n\n /** Variante: `classic` (default) o `point-list`. */\n @property({ type: String })\n variant: TimelineVariant = 'classic';\n\n /**\n * Colore predefinito per i punti figlio — solo per `variant=\"point-list\"`.\n * Viene propagato a tutti gli `<it-timeline-point>` che non hanno un attributo\n * `color` esplicito. Default: `primary`.\n */\n @property({ type: String })\n color: TimelinePointColor = 'primary';\n\n /** Tag della lista — solo per `variant=\"point-list\"`. Default: `ol`. */\n @property({ type: String })\n as: TimelinePointListTag = 'ol';\n\n /** Layout mobile verticale — solo per `variant=\"point-list\"`. */\n @property({ type: Boolean, attribute: 'stack-mobile', reflect: true })\n stackMobile = false;\n\n /**\n * Compatta ogni elemento it-timeline-point figlio se `true` e non ha un compact esplicito. Solo per `variant=\"point-list\"`.\n */\n @property({ type: Boolean, attribute: 'compact', reflect: true })\n compact = false;\n\n override updated() {\n // Re-propagate color when the color property changes\n this._onSlotChange();\n }\n\n private _getVariant(): TimelineVariant {\n return TIMELINE_VARIANTS.includes(this.variant) ? this.variant : 'classic';\n }\n\n override render() {\n return this._getVariant() === 'point-list' ? this._renderPointList() : this._renderClassic();\n }\n\n private _renderClassic() {\n return html`\n <div class=\"it-timeline-wrapper it-timeline-wrapper--classic\">\n <div class=\"row\">\n <slot @slotchange=${this._onSlotChange}></slot>\n </div>\n </div>\n `;\n }\n\n private _renderPointList() {\n const tag = unsafeStatic(TIMELINE_POINT_LIST_TAGS.includes(this.as) ? this.as : 'ol');\n const classes = this.composeClass('it-timeline-point-list', {\n 'it-timeline-point-list-stack-mobile': this.stackMobile,\n });\n return staticHtml`\n <div class=\"it-timeline-wrapper\">\n <div class=\"row\">\n <${tag} class=\"${classes}\">\n <slot @slotchange=${this._onSlotChange}></slot>\n </${tag}>\n </div>\n </div>\n `;\n }\n\n /** Propagates container color to child points and sets position on elements. */\n private _onSlotChange = () => {\n const slot = this.shadowRoot?.querySelector('slot') as HTMLSlotElement | null;\n if (!slot) return;\n const nodes = slot.assignedElements();\n\n if (this._getVariant() !== 'point-list') return;\n const defaultColor = TIMELINE_POINT_COLORS.includes(this.color) ? this.color : 'primary';\n for (const node of nodes) {\n if (node.tagName.toLowerCase() === 'it-timeline-point') {\n const point = node as unknown as ItTimelinePoint;\n if (!point._hasExplicitColor) {\n point.color = defaultColor;\n }\n if (this.compact && !point._hasExplicitCompact) {\n point.compact = this.compact;\n }\n // Propagate stack-mobile so timeline-point.scss can use :host([stack-mobile])\n point.toggleAttribute('stack-mobile', this.stackMobile);\n }\n }\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-timeline': ItTimeline;\n }\n}\n"],"names":["staticHtml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,aAAa,CAAA;AAAtC,IAAA,WAAA,GAAA;;;QAKL,IAAA,CAAA,OAAO,GAAoB,SAAS;AAEpC;;;;AAIG;QAEH,IAAA,CAAA,KAAK,GAAuB,SAAS;;QAIrC,IAAA,CAAA,EAAE,GAAyB,IAAI;;QAI/B,IAAA,CAAA,WAAW,GAAG,KAAK;AAEnB;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAG,KAAK;;QA0CP,IAAA,CAAA,aAAa,GAAG,MAAK;YAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAA2B;AAC7E,YAAA,IAAI,CAAC,IAAI;gBAAE;AACX,YAAA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ADtB,aAAa,CAAC,aAAa;AACf,CAAA,EAAA,UAAU,CA0FtB;;;;"}
@@ -0,0 +1,13 @@
1
+ export declare const TIMELINE_VARIANTS: readonly ["classic", "point-list"];
2
+ export type TimelineVariant = (typeof TIMELINE_VARIANTS)[number];
3
+ export declare const TIMELINE_ELEMENT_VARIANTS: readonly ["", "current", "past"];
4
+ export type TimelineElementVariant = (typeof TIMELINE_ELEMENT_VARIANTS)[number];
5
+ /** Variants that have a non-white (dark/colored) pin background, requiring inverse icon color. */
6
+ export declare const TIMELINE_ELEMENT_DARK_VARIANTS: ReadonlyArray<TimelineElementVariant>;
7
+ export declare const TIMELINE_HEADING_LEVELS: readonly ["h2", "h3", "h4", "h5", "h6"];
8
+ export type TimelineHeadingLevel = (typeof TIMELINE_HEADING_LEVELS)[number];
9
+ export declare const TIMELINE_POINT_COLORS: readonly ["primary", "secondary", "success", "danger", "warning", "info", "light", "dark"];
10
+ export type TimelinePointColor = (typeof TIMELINE_POINT_COLORS)[number];
11
+ export declare const TIMELINE_POINT_LIST_TAGS: readonly ["ol", "ul"];
12
+ export type TimelinePointListTag = (typeof TIMELINE_POINT_LIST_TAGS)[number];
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,oCAAqC,CAAC;AACpE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,eAAO,MAAM,yBAAyB,kCAAmC,CAAC;AAC1E,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,kGAAkG;AAClG,eAAO,MAAM,8BAA8B,EAAE,aAAa,CAAC,sBAAsB,CAAuB,CAAC;AAEzG,eAAO,MAAM,uBAAuB,yCAA0C,CAAC;AAC/E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,eAAO,MAAM,qBAAqB,4FASxB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB,uBAAwB,CAAC;AAC9D,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@italia/timeline",
3
+ "description": "Web components it-timeline e it-timeline-point-list 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/timeline"
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-timeline.js": "./dist/src/it-timeline.js",
26
+ "./it-timeline-element.js": "./dist/src/it-timeline-element.js",
27
+ "./it-timeline-point.js": "./dist/src/it-timeline-point.js",
28
+ "./styles/*": "./styles/*"
29
+ },
30
+ "files": [
31
+ "dist/src",
32
+ "styles",
33
+ "README.md",
34
+ "AUTHORS",
35
+ "LICENSE",
36
+ "custom-elements.json"
37
+ ],
38
+ "dependencies": {
39
+ "bootstrap-italia": "3.0.0-alpha.9",
40
+ "lit": "^3.3.0",
41
+ "@italia/globals": "^1.0.0-alpha.10"
42
+ },
43
+ "devDependencies": {
44
+ "@custom-elements-manifest/analyzer": "^0.10.3",
45
+ "@open-wc/testing": "^4.0.0",
46
+ "@rollup/plugin-node-resolve": "^16.0.1",
47
+ "@rollup/plugin-typescript": "^12.1.2",
48
+ "@types/mocha": "^10.0.10",
49
+ "@web/test-runner": "^0.18.2",
50
+ "rimraf": "^6.0.1",
51
+ "rollup": "^4.21.3",
52
+ "rollup-plugin-scss-lit": "^2.1.0",
53
+ "sass": "^1.89.0",
54
+ "stylelint": "^16.20.0",
55
+ "stylelint-config-standard-scss": "^14.0.0",
56
+ "tslib": "^2.6.3",
57
+ "typescript": "^5.5.3",
58
+ "@italia/test-config": "^0.0.0",
59
+ "@italia/typescript-config": "^0.0.0"
60
+ },
61
+ "customElements": "custom-elements.json",
62
+ "scripts": {
63
+ "analyze": "cem analyze --litelement --exclude dist",
64
+ "build": "rollup --config rollup.config.js",
65
+ "clean": "rimraf node_modules .turbo .rollup.cache dist coverage",
66
+ "prepublish": "pnpm build",
67
+ "lint": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && stylelint \"styles/**/*.scss\" \"src/**/*.scss\" && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --check",
68
+ "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\"",
69
+ "test": "wtr --coverage --node-resolve --config web-test-runner.config.js",
70
+ "test:watch": "wtr --coverage --node-resolve --config web-test-runner.config.js --watch"
71
+ }
72
+ }
@@ -0,0 +1,231 @@
1
+ // Stili globali per @italia/timeline
2
+ // Da importare nell'applicazione host tramite dev-kit-italia/styles/index.scss
3
+
4
+ // Bootstrap Italia timeline component styles
5
+ @import 'bootstrap-italia/src/scss/components/timeline';
6
+
7
+ // Queste classi sono nei figli slottati di <it-timeline-point> (light DOM).
8
+ // Il CSS del shadow root non può raggiungerle (limit ::slotted ai figli diretti),
9
+ // quindi le definiamo qui nel foglio globale.
10
+ it-timeline-point {
11
+ .point-visual {
12
+ display: flex;
13
+ flex-direction: column;
14
+ align-items: center;
15
+ }
16
+
17
+ .point-main {
18
+ display: flex;
19
+ min-width: 53px;
20
+ align-items: center;
21
+ justify-content: center;
22
+ font-family: $font-family-sans-serif;
23
+ font-size: 2.75rem;
24
+ line-height: 1.1;
25
+
26
+ @include media-breakpoint-down(md) {
27
+ min-width: 32px;
28
+ font-size: 1.5rem;
29
+ }
30
+
31
+ // Icone slottate dentro point-main (es. it-icon)
32
+ it-icon::part(icon) {
33
+ width: 3rem;
34
+ height: 3rem;
35
+ }
36
+ }
37
+
38
+ .point-top,
39
+ .point-bottom {
40
+ font-family: $font-family-sans-serif;
41
+ font-size: 1rem;
42
+ text-transform: uppercase;
43
+
44
+ @include media-breakpoint-down(md) {
45
+ font-size: 0.875rem;
46
+ }
47
+ }
48
+
49
+ // Compact variant overrides (mirrored from it-timeline-point[compact])
50
+ &[compact] {
51
+ .point-main {
52
+ min-width: 32px;
53
+ font-size: 1.5rem;
54
+ line-height: 1;
55
+ }
56
+
57
+ .point-bottom {
58
+ font-size: 0.875rem;
59
+ }
60
+ }
61
+ }
62
+
63
+ it-timeline-point it-icon::part(icon) {
64
+ vertical-align: unset !important;
65
+ }
66
+
67
+ // ── FOUC prevention: stili per it-timeline e figli non definiti ─────────────
68
+ // Stili FOUC (Flash of Unstyled Content) per it-timeline
69
+ // Questi stili vengono applicati prima che i web component vengano definiti
70
+ // per evitare il flash di contenuto non stilizzato.
71
+
72
+ it-timeline:not(:defined) {
73
+ display: block;
74
+
75
+ // Simula la struttura di base della timeline
76
+ > * {
77
+ display: block;
78
+ }
79
+ }
80
+
81
+ it-timeline-element:not(:defined) {
82
+ position: relative;
83
+ display: block;
84
+ padding-top: 1.5rem;
85
+ padding-bottom: 1.5rem;
86
+ padding-left: 2.5rem;
87
+
88
+ [slot='pin-icon'] {
89
+ display: none;
90
+ }
91
+ }
92
+
93
+ // Timeline point list FOUC
94
+ it-timeline-point-list:not(:defined) {
95
+ display: flex;
96
+ flex-direction: column;
97
+ padding-left: 0;
98
+
99
+ &::marker {
100
+ font-size: 0;
101
+ }
102
+ }
103
+
104
+ it-timeline-point:not(:defined) {
105
+ display: flex;
106
+ align-items: center;
107
+ margin-bottom: 1.5rem;
108
+
109
+ [slot='date'],
110
+ [slot='milestone'] {
111
+ width: 5rem;
112
+ flex-shrink: 0;
113
+ text-align: center;
114
+ }
115
+
116
+ [slot='content'] {
117
+ flex: 1;
118
+ margin-left: 1rem;
119
+ }
120
+ }
121
+
122
+ // Colora gli slot testuali del colore della variante assegnata
123
+ [slot='date'],
124
+ [slot='milestone'] {
125
+ color: var(--point-color, var(--#{$prefix}color-text-primary));
126
+ }
127
+
128
+ // ── Color mapping ─────────────────────────────────────────────────────────────
129
+ // BSI sets --point-color inside .it-timeline-point-list which is in the shadow
130
+ // root of <it-timeline>, not here. We define it on the class directly.
131
+ it-timeline-point[color='primary']:not(:defined),
132
+ it-timeline[color='primary']:not(:defined) {
133
+ --point-color: var(--#{$prefix}color-textprimary);
134
+ }
135
+
136
+ it-timeline-point[color='secondary']:not(:defined),
137
+ it-timeline[color='secondary']:not(:defined) {
138
+ --point-color: var(--#{$prefix}color-textsecondary);
139
+ }
140
+
141
+ it-timeline-point[color='success']:not(:defined),
142
+ it-timeline[color='success']:not(:defined) {
143
+ --point-color: var(--#{$prefix}color-textsuccess);
144
+ }
145
+
146
+ it-timeline-point[color='info']:not(:defined),
147
+ it-timeline[color='info']:not(:defined) {
148
+ --point-color: var(--#{$prefix}color-textinfo);
149
+ }
150
+
151
+ it-timeline-point[color='warning']:not(:defined),
152
+ it-timeline[color='warning']:not(:defined) {
153
+ --point-color: var(--#{$prefix}color-textwarning);
154
+ }
155
+
156
+ it-timeline-point[color='danger']:not(:defined),
157
+ it-timeline[color='danger']:not(:defined) {
158
+ --point-color: var(--#{$prefix}color-textdanger);
159
+ }
160
+
161
+ it-timeline-point[color='light']:not(:defined),
162
+ it-timeline[color='light']:not(:defined) {
163
+ --point-color: var(--#{$prefix}color-textlight);
164
+ }
165
+
166
+ it-timeline-point[color='dark']:not(:defined),
167
+ it-timeline[color='dark']:not(:defined) {
168
+ --point-color: var(--#{$prefix}color-textdark);
169
+ }
170
+
171
+ it-timeline-point[color='black']:not(:defined),
172
+ it-timeline[color='black']:not(:defined) {
173
+ --point-color: var(--#{$prefix}color-textblack);
174
+ }
175
+
176
+ it-timeline-point[color='white']:not(:defined),
177
+ it-timeline[color='white']:not(:defined) {
178
+ --point-color: var(--#{$prefix}color-textwhite);
179
+ }
180
+
181
+ // Desktop: each element takes 50% width, alternating left/right column
182
+ @include media-breakpoint-up(lg) {
183
+ it-timeline-element:not(:defined) {
184
+ width: 50%;
185
+ }
186
+
187
+ // Odd items (1st, 3rd… = left column: pin on the right side near center line
188
+ it-timeline-element:nth-child(odd):not(:defined) {
189
+ --it-timeline-now-label-base-displacement: 68px;
190
+ --it-timeline-now-label-left: calc(4px + #{$timeline-padding} / 2 + $timeline-pin-circle-size + $v-gap * 2);
191
+ --it-timeline-now-label-right: calc(-1 * var(--it-timeline-now-label-base-displacement));
192
+
193
+ --it-timeline-pin-left: auto;
194
+ --it-timeline-pin-right: -22px;
195
+ --it-timeline-pin-direction: row-reverse;
196
+ --it-timeline-pin-icon-mr: 0;
197
+ --it-timeline-pin-icon-ml: #{$v-gap * 2};
198
+ --it-timeline-pin-arrow-left: auto;
199
+ --it-timeline-pin-arrow-right: -4px;
200
+ --it-timeline-content-padding: #{$timeline-content-padding-reverse};
201
+ }
202
+
203
+ // Even items (2nd, 4th…) = right column: offset 50%, pin on the left near center line
204
+ it-timeline-element:nth-child(even):not(:defined) {
205
+ margin-left: 50%;
206
+ --it-timeline-now-label-base-displacement: 80px;
207
+ --it-timeline-now-label-left: calc(-1 * var(--it-timeline-now-label-base-displacement));
208
+ --it-timeline-now-label-right: unset;
209
+
210
+ --it-timeline-pin-left: -34px;
211
+ --it-timeline-pin-right: auto;
212
+ --it-timeline-pin-direction: row;
213
+ --it-timeline-pin-icon-mr: #{$v-gap * 2};
214
+ --it-timeline-pin-icon-ml: 0;
215
+ --it-timeline-pin-arrow-left: -4px;
216
+ --it-timeline-pin-arrow-right: auto;
217
+ --it-timeline-content-padding: #{$timeline-content-padding};
218
+ }
219
+
220
+ it-timeline-point:not(:defined) {
221
+ --it-timeline-point-content-flex-basis: 0%;
222
+ --it-timeline-point-margin-bottom: 24px;
223
+ --it-timeline-point-content-z-index: 1;
224
+ --it-timeline-point-after-content: '';
225
+ --it-timeline-point-stack-mobile-after-content: none;
226
+ }
227
+
228
+ it-timeline-element:not(:defined)::before {
229
+ content: attr(date);
230
+ }
231
+ }