@italia/rating 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 -161
- package/custom-elements.json +2 -2
- package/dist/src/it-rating-item.js +0 -13
- package/dist/src/it-rating-item.js.map +1 -1
- package/dist/src/it-rating.js +1 -14
- package/dist/src/it-rating.js.map +1 -1
- package/package.json +24 -24
package/README.md
CHANGED
|
@@ -1,166 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# <it-rating>
|
|
2
2
|
|
|
3
|
-
[
|
|
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
|
-
|
|
5
|
+
## Installation and usage
|
|
6
6
|
|
|
7
|
-
|
|
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).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
npm install @italia/rating
|
|
11
|
-
```
|
|
9
|
+
## Documentation
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<script type="module">
|
|
17
|
-
import '@italia/rating';
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<it-rating name="rating" value="3">
|
|
21
|
-
<span slot="legend">Valuta questo servizio</span>
|
|
22
|
-
</it-rating>
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Con Label
|
|
26
|
-
|
|
27
|
-
```html
|
|
28
|
-
<it-rating name="rating" value="4" label="Valutazione">
|
|
29
|
-
</it-rating>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Sola Lettura
|
|
33
|
-
|
|
34
|
-
```html
|
|
35
|
-
<it-rating name="rating" value="4" read-only>
|
|
36
|
-
</it-rating>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Disabilitato
|
|
40
|
-
|
|
41
|
-
```html
|
|
42
|
-
<it-rating name="rating" value="3" disabled>
|
|
43
|
-
<span slot="legend">Valutazione</span>
|
|
44
|
-
</it-rating>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Obbligatorio
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<form>
|
|
51
|
-
<it-rating name="rating" required>
|
|
52
|
-
<span slot="legend">Valuta questo contenuto (obbligatorio)</span>
|
|
53
|
-
</it-rating>
|
|
54
|
-
<button type="submit">Invia</button>
|
|
55
|
-
</form>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Proprietà
|
|
59
|
-
|
|
60
|
-
| Proprietà | Tipo | Default | Descrizione |
|
|
61
|
-
|-----------|------|---------|-------------|
|
|
62
|
-
| `name` | `string` | `''` | Nome del campo per l'invio del form |
|
|
63
|
-
| `value` | `number` | `0` | Valore corrente della valutazione (1-5) |
|
|
64
|
-
| `label` | `string` | `''` | Etichetta del rating |
|
|
65
|
-
| `disabled` | `boolean` | `false` | Se il rating è disabilitato |
|
|
66
|
-
| `read-only` | `boolean` | `false` | Se il rating è in sola lettura (non interattivo) |
|
|
67
|
-
| `required` | `boolean` | `false` | Se la selezione è obbligatoria |
|
|
68
|
-
| `max-stars` | `number` | `5` | Numero massimo di stelle |
|
|
69
|
-
|
|
70
|
-
## Eventi
|
|
71
|
-
|
|
72
|
-
### `change`
|
|
73
|
-
|
|
74
|
-
Emesso quando cambia il valore della valutazione.
|
|
75
|
-
|
|
76
|
-
```javascript
|
|
77
|
-
const rating = document.querySelector('it-rating');
|
|
78
|
-
rating.addEventListener('change', (event) => {
|
|
79
|
-
console.log('Nuovo valore:', event.detail.value);
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Slot
|
|
84
|
-
|
|
85
|
-
### `legend`
|
|
86
|
-
|
|
87
|
-
Contenuto della legend del fieldset (label del rating).
|
|
88
|
-
|
|
89
|
-
```html
|
|
90
|
-
<it-rating name="rating">
|
|
91
|
-
<span slot="legend">Valuta questo servizio</span>
|
|
92
|
-
</it-rating>
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Accessibilità
|
|
96
|
-
|
|
97
|
-
Il componente implementa le best practice di accessibilità:
|
|
98
|
-
|
|
99
|
-
- Utilizza `role="radiogroup"` per il gruppo di stelle
|
|
100
|
-
- Ogni stella ha `role="radio"` (quando interattivo) o `role="img"` (quando read-only)
|
|
101
|
-
- Supporto completo per la navigazione da tastiera:
|
|
102
|
-
- `Tab`: entra/esce dal rating
|
|
103
|
-
- `Frecce`: naviga tra le stelle
|
|
104
|
-
- `Home`: vai alla prima stella
|
|
105
|
-
- `End`: vai all'ultima stella
|
|
106
|
-
- `Spazio/Enter`: seleziona la stella corrente
|
|
107
|
-
- Etichette aria-label appropriate per ogni stella
|
|
108
|
-
- Supporto per screen reader con testo nascosto visualmente
|
|
109
|
-
|
|
110
|
-
## Integrazione con Form
|
|
111
|
-
|
|
112
|
-
Il componente si integra nativamente con i form HTML:
|
|
113
|
-
|
|
114
|
-
```html
|
|
115
|
-
<form id="reviewForm">
|
|
116
|
-
<it-rating name="rating" value="3" required>
|
|
117
|
-
<span slot="legend">Valutazione</span>
|
|
118
|
-
</it-rating>
|
|
119
|
-
|
|
120
|
-
<button type="submit">Invia recensione</button>
|
|
121
|
-
</form>
|
|
122
|
-
|
|
123
|
-
<script>
|
|
124
|
-
document.getElementById('reviewForm').addEventListener('submit', (e) => {
|
|
125
|
-
e.preventDefault();
|
|
126
|
-
const formData = new FormData(e.target);
|
|
127
|
-
console.log('Rating:', formData.get('rating'));
|
|
128
|
-
});
|
|
129
|
-
</script>
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Validazione
|
|
133
|
-
|
|
134
|
-
Il componente supporta la validazione HTML5:
|
|
135
|
-
|
|
136
|
-
```javascript
|
|
137
|
-
const rating = document.querySelector('it-rating');
|
|
138
|
-
|
|
139
|
-
// Verifica validità
|
|
140
|
-
if (rating.checkValidity()) {
|
|
141
|
-
console.log('Rating valido');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Mostra errori di validazione
|
|
145
|
-
rating.reportValidity();
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Personalizzazione CSS
|
|
149
|
-
|
|
150
|
-
```css
|
|
151
|
-
it-rating {
|
|
152
|
-
--rating-star-size: 1.5rem;
|
|
153
|
-
--rating-star-color: #ffc107;
|
|
154
|
-
--rating-star-empty-color: #e0e0e0;
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Browser Support
|
|
159
|
-
|
|
160
|
-
- Chrome/Edge (ultimo + 1 versione precedente)
|
|
161
|
-
- Firefox (ultimo + 1 versione precedente)
|
|
162
|
-
- Safari (ultimo + 1 versione precedente)
|
|
163
|
-
|
|
164
|
-
## Licenza
|
|
165
|
-
|
|
166
|
-
BSD-3-Clause © Presidenza del Consiglio dei Ministri
|
|
11
|
+
Find the usage instructions for this specific component in its [dedicated documentation page](https://italia.github.io/dev-kit-italia/?path=/docs/componenti-rating--documentazione).
|
package/custom-elements.json
CHANGED
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
{
|
|
257
257
|
"kind": "variable",
|
|
258
258
|
"name": "meta",
|
|
259
|
-
"default": "{ title: 'Componenti/Rating', tags: ['web-component', 'a11y-ok'], component: 'it-rating', args: { name: 'rating', value: 0, disabled: false, readOnly: false, required: false, icon: 'it-star-outline', maxElements: 5, }, argTypes: { name: { control: 'text', description: \"Nome del campo per l'invio del form\", }, value: { control: { type: 'number', min: 0, max: 5, step: 1 }, description: 'Valore corrente della valutazione (0-5, 0 = nessuna stella selezionata)', }, icon: { control: 'text', description: \"Nome dell'icona da utilizzare per gli item del rating\", table: { defaultValue: { summary: 'it-star-outline' } }, }, disabled: { control: 'boolean', type: 'boolean', description: 'Se il rating è disabilitato', table: { defaultValue: { summary: 'false' } }, }, readOnly: { name: 'read-only', control: 'boolean', type: 'boolean', description: 'Se il rating è in sola lettura (non interattivo)', table: { defaultValue: { summary: 'false' } }, }, required: { control: 'boolean', type: 'boolean', description: 'Se la selezione è obbligatoria', table: { defaultValue: { summary: 'false' } }, }, maxElements: { name: 'max-elements', control: { type: 'number', min: 1, step: 1 }, description: 'Numero massimo di elementi nel rating, per messaggi di supporto e accessibilità, modificare rispetto al default solo se si cambia il numero di elementi visualizzati rispetto al default di 5', table: { defaultValue: { summary: '5' } }, }, }, } satisfies Meta<RatingProps>"
|
|
259
|
+
"default": "{ title: 'Componenti/Rating', tags: ['web-component', 'a11y-ok'], component: 'it-rating', args: { name: 'rating', value: 0, disabled: false, readOnly: false, required: false, icon: 'it-star-outline', maxElements: 5, form: '', customValidation: false, validityMessage: '', }, argTypes: { name: { control: 'text', description: \"Nome del campo per l'invio del form\", }, value: { control: { type: 'number', min: 0, max: 5, step: 1 }, description: 'Valore corrente della valutazione (0-5, 0 = nessuna stella selezionata)', }, icon: { control: 'text', description: \"Nome dell'icona da utilizzare per gli item del rating\", table: { defaultValue: { summary: 'it-star-outline' } }, }, disabled: { control: 'boolean', type: 'boolean', description: 'Se il rating è disabilitato', table: { defaultValue: { summary: 'false' } }, }, readOnly: { name: 'read-only', control: 'boolean', type: 'boolean', description: 'Se il rating è in sola lettura (non interattivo)', table: { defaultValue: { summary: 'false' } }, }, required: { control: 'boolean', type: 'boolean', description: 'Se la selezione è obbligatoria', table: { defaultValue: { summary: 'false' } }, }, maxElements: { name: 'max-elements', control: { type: 'number', min: 1, step: 1 }, description: 'Numero massimo di elementi nel rating, per messaggi di supporto e accessibilità, modificare rispetto al default solo se si cambia il numero di elementi visualizzati rispetto al default di 5', table: { defaultValue: { summary: '5' } }, }, form: { control: 'text', description: \"ID html del form a cui è associato il componente it-radio-group, se non si trova all'interno di una form \", }, customValidation: { name: 'custom-validation', control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, description: 'Se la validazione del radio group è fatta esternamente (lato server o con plugin js - validazione custom), impostare questo attributo a `true`.', }, validityMessage: { name: 'validity-message', control: 'text', description: \"Messaggio da mostrare quando il radio group è invalido nel caso di validazione esterna (validazione custom). Se impostato a '' (stringa vuota) il campo viene considerato valido.\", }, }, } satisfies Meta<RatingProps>"
|
|
260
260
|
},
|
|
261
261
|
{
|
|
262
262
|
"kind": "variable",
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
"type": {
|
|
265
265
|
"text": "Story"
|
|
266
266
|
},
|
|
267
|
-
"default": "{ ...meta, name: 'Esempio interattivo', tags: ['!autodocs', '!dev'], parameters: { docs: { canvas: { sourceState: 'shown', }, }, }, render: (args) => html` <it-rating name=${ifDefined(args.name || undefined)} value=${args.value.toString()} ?disabled=${args.disabled} ?read-only=${args.readOnly} ?required=${args.required} @change=${(e: CustomEvent) => { console.log('Rating changed:', (e.target as HTMLElement).getAttribute('value')); }} icon=${ifDefined(args.icon || undefined)} max-elements=${args.maxElements.toString()} > <span slot=\"label\">Valuta questo contenuto</span> <it-rating-item value=\"1\" ?checked=${args.value === 1}> <span slot=\"label\">1 stella</span> </it-rating-item> <it-rating-item value=\"2\" ?checked=${args.value === 2}> <span slot=\"label\">2 stelle</span> </it-rating-item> <it-rating-item value=\"3\" ?checked=${args.value === 3}> <span slot=\"label\">3 stelle</span> </it-rating-item> <it-rating-item value=\"4\" ?checked=${args.value === 4}> <span slot=\"label\">4 stelle</span> </it-rating-item> <it-rating-item value=\"5\" ?checked=${args.value === 5}> <span slot=\"label\">5 stelle</span> </it-rating-item> </it-rating> `, }"
|
|
267
|
+
"default": "{ ...meta, name: 'Esempio interattivo', tags: ['!autodocs', '!dev'], parameters: { docs: { canvas: { sourceState: 'shown', }, }, }, render: (args) => html` <it-rating name=${ifDefined(args.name || undefined)} value=${args.value.toString()} ?disabled=${args.disabled} ?read-only=${args.readOnly} ?required=${args.required} @change=${(e: CustomEvent) => { console.log('Rating changed:', (e.target as HTMLElement).getAttribute('value')); }} icon=${ifDefined(args.icon || undefined)} max-elements=${args.maxElements.toString()} form=\"${ifDefined(args.form || undefined)}\" ?custom-validation=\"${args.customValidation}\" validity-message=\"${ifDefined(args.validityMessage || undefined)}\" > <span slot=\"label\">Valuta questo contenuto</span> <it-rating-item value=\"1\" ?checked=${args.value === 1}> <span slot=\"label\">1 stella</span> </it-rating-item> <it-rating-item value=\"2\" ?checked=${args.value === 2}> <span slot=\"label\">2 stelle</span> </it-rating-item> <it-rating-item value=\"3\" ?checked=${args.value === 3}> <span slot=\"label\">3 stelle</span> </it-rating-item> <it-rating-item value=\"4\" ?checked=${args.value === 4}> <span slot=\"label\">4 stelle</span> </it-rating-item> <it-rating-item value=\"5\" ?checked=${args.value === 5}> <span slot=\"label\">5 stelle</span> </it-rating-item> </it-rating> `, }"
|
|
268
268
|
},
|
|
269
269
|
{
|
|
270
270
|
"kind": "variable",
|
|
@@ -5,19 +5,6 @@ import { ItRadio } from '@italia/radio';
|
|
|
5
5
|
import '@italia/icon';
|
|
6
6
|
|
|
7
7
|
var styles = css`@charset "UTF-8";
|
|
8
|
-
/***************************** 1 ****************************************/
|
|
9
|
-
/***************************** 2 ****************************************/
|
|
10
|
-
/***************************** 1 ****************************************/
|
|
11
|
-
/***************************** 2 ****************************************/
|
|
12
|
-
/***************************** 1 ****************************************/
|
|
13
|
-
/***************************** 2 ****************************************/
|
|
14
|
-
/***************************** 3 ****************************************/
|
|
15
|
-
/***************************** 1 ****************************************/
|
|
16
|
-
/***************************** 2 ****************************************/
|
|
17
|
-
/***************************** 3 ****************************************/
|
|
18
|
-
/***************************** NEUTRAL 1 ****************************************/
|
|
19
|
-
/***************************** NEUTRAL 2 ****************************************/
|
|
20
|
-
/***************************** NEUTRAL 2 / 3 ****************************************/
|
|
21
8
|
*,
|
|
22
9
|
*::before,
|
|
23
10
|
*::after {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-rating-item.js","sources":["../../../src/it-rating-item.ts"],"sourcesContent":["import { html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { ItRadio } from '@italia/radio';\nimport '@italia/icon';\n\nimport styles from './rating-item.scss';\n\n/**\n * Rating item component - extends it-radio to render a star icon\n *\n * @element it-rating-item\n *\n * @slot label - The accessibility label for the star (e.g., \"Valuta 3 stelle su 5\")\n */\n@customElement('it-rating-item')\nexport class ItRatingItem extends ItRadio {\n static override styles = styles;\n\n /**\n * Override group getter to find parent it-rating instead of it-radio-group\n */\n override get group() {\n return this.closest('it-rating');\n }\n\n get icon(): string {\n return this.group?.icon || 'it-star-outline';\n }\n\n /**\n * Override _renderInput to render icon instead of radio circle\n * Now that _renderInput is protected in parent, we can override it\n */\n protected override _renderInput() {\n // Get the parent rating to determine which items should be filled\n const rating = this.closest('it-rating');\n const ratingValue = rating ? parseInt((rating as any).value || '0', 10) : 0;\n const thisValue = parseInt(this.value || '0', 10);\n\n // Icon should be filled if its value is <= the rating value\n const isFilled = thisValue <= ratingValue;\n\n // Use primary color only for filled icons\n const iconColor = isFilled ? 'primary' : 'secondary';\n let renderedIcon = this.icon;\n if (isFilled && this.icon === 'it-star-outline') {\n renderedIcon = 'it-star-full';\n }\n\n return html`\n <div id=\"input\" part=\"input\"></div>\n <it-icon id=\"star\" part=\"star\" name=\"${renderedIcon}\" size=\"sm\" aria-hidden=\"true\" color=\"${iconColor}\"></it-icon>\n `;\n }\n\n private handleSlotChange() {\n // Notify assistive technologies of label change\n this.labelElements.forEach((el) => {\n el.classList.add('visually-hidden');\n });\n }\n\n /**\n * Override render to use rating-specific structure\n */\n override render() {\n return html`\n <div class=\"rating-item-control\">\n ${this._renderInput()}\n <slot name=\"label\" @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-rating-item': ItRatingItem;\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"it-rating-item.js","sources":["../../../src/it-rating-item.ts"],"sourcesContent":["import { html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { ItRadio } from '@italia/radio';\nimport '@italia/icon';\n\nimport styles from './rating-item.scss';\n\n/**\n * Rating item component - extends it-radio to render a star icon\n *\n * @element it-rating-item\n *\n * @slot label - The accessibility label for the star (e.g., \"Valuta 3 stelle su 5\")\n */\n@customElement('it-rating-item')\nexport class ItRatingItem extends ItRadio {\n static override styles = styles;\n\n /**\n * Override group getter to find parent it-rating instead of it-radio-group\n */\n override get group() {\n return this.closest('it-rating');\n }\n\n get icon(): string {\n return this.group?.icon || 'it-star-outline';\n }\n\n /**\n * Override _renderInput to render icon instead of radio circle\n * Now that _renderInput is protected in parent, we can override it\n */\n protected override _renderInput() {\n // Get the parent rating to determine which items should be filled\n const rating = this.closest('it-rating');\n const ratingValue = rating ? parseInt((rating as any).value || '0', 10) : 0;\n const thisValue = parseInt(this.value || '0', 10);\n\n // Icon should be filled if its value is <= the rating value\n const isFilled = thisValue <= ratingValue;\n\n // Use primary color only for filled icons\n const iconColor = isFilled ? 'primary' : 'secondary';\n let renderedIcon = this.icon;\n if (isFilled && this.icon === 'it-star-outline') {\n renderedIcon = 'it-star-full';\n }\n\n return html`\n <div id=\"input\" part=\"input\"></div>\n <it-icon id=\"star\" part=\"star\" name=\"${renderedIcon}\" size=\"sm\" aria-hidden=\"true\" color=\"${iconColor}\"></it-icon>\n `;\n }\n\n private handleSlotChange() {\n // Notify assistive technologies of label change\n this.labelElements.forEach((el) => {\n el.classList.add('visually-hidden');\n });\n }\n\n /**\n * Override render to use rating-specific structure\n */\n override render() {\n return html`\n <div class=\"rating-item-control\">\n ${this._renderInput()}\n <slot name=\"label\" @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-rating-item': ItRatingItem;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,CAAA;;AAE8B,2CAAA,EAAA,YAAY,yCAAyC,SAAS,CAAA;KACtG;IACH;IAEQ,gBAAgB,GAAA;;QAEtB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,KAAI;AAChC,YAAA,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACrC,QAAA,CAAC,CAAC;IACJ;AAEA;;AAEG;IACM,MAAM,GAAA;AACb,QAAA,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,YAAY,EAAE;AACY,uCAAA,EAAA,IAAI,CAAC,gBAAgB,CAAA;;KAEzD;IACH;;AAxDgB,YAAA,CAAA,MAAM,GAAG,MAAH;AADX,YAAY,GAAA,UAAA,CAAA;IADxB,aAAa,CAAC,gBAAgB;AAClB,CAAA,EAAA,YAAY,CA0DxB;;;;"}
|
package/dist/src/it-rating.js
CHANGED
|
@@ -13,20 +13,7 @@ const translation = {
|
|
|
13
13
|
ratingLabelPlural: (rating, max) => `${rating} stelle su ${max}`,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
var styles = css
|
|
17
|
-
/***************************** 2 ****************************************/
|
|
18
|
-
/***************************** 1 ****************************************/
|
|
19
|
-
/***************************** 2 ****************************************/
|
|
20
|
-
/***************************** 1 ****************************************/
|
|
21
|
-
/***************************** 2 ****************************************/
|
|
22
|
-
/***************************** 3 ****************************************/
|
|
23
|
-
/***************************** 1 ****************************************/
|
|
24
|
-
/***************************** 2 ****************************************/
|
|
25
|
-
/***************************** 3 ****************************************/
|
|
26
|
-
/***************************** NEUTRAL 1 ****************************************/
|
|
27
|
-
/***************************** NEUTRAL 2 ****************************************/
|
|
28
|
-
/***************************** NEUTRAL 2 / 3 ****************************************/
|
|
29
|
-
*,
|
|
16
|
+
var styles = css`*,
|
|
30
17
|
*::before,
|
|
31
18
|
*::after {
|
|
32
19
|
box-sizing: border-box;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-rating.js","sources":["../../../src/locales/it.ts","../../../src/it-rating.ts"],"sourcesContent":["import type { DefaultTranslation } from '@italia/i18n';\n\nconst translation: DefaultTranslation = {\n $code: 'it',\n $name: 'Italiano',\n $dir: 'ltr',\n\n noRating: 'Nessuna valutazione',\n ratingLabelSingle: (rating: number, max: number) => `${rating} stella su ${max}`,\n ratingLabelPlural: (rating: number, max: number) => `${rating} stelle su ${max}`,\n};\n\nexport default translation;\n","import { type PropertyValues } from 'lit';\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js';\nimport { ItRadioGroup } from '@italia/radio'; // eslint-disable-line import/no-extraneous-dependencies\nimport { registerTranslation } from '@italia/i18n';\nimport { type ItRatingItem } from '@italia/rating';\nimport it from './locales/it.js';\n\nimport styles from './rating.scss';\n\nregisterTranslation(it);\n\n/**\n * Rating component - extends it-radio-group for star rating\n *\n * @element it-rating\n *\n * @slot - Contains the `<it-rating-item>` elements\n * @slot label - The label/legend text for the rating\n *\n * @fires {CustomEvent} change - Emitted when the rating value changes\n */\n@customElement('it-rating')\nexport class ItRating extends ItRadioGroup {\n static override styles = styles;\n\n /**\n * Get all slotted rating items\n */\n @queryAssignedElements()\n protected _radios!: ItRatingItem[];\n\n /**\n * Maximum number of stars (to calculate \"X out of Y\")\n */\n @property({ type: Number, attribute: 'max-elements', reflect: true })\n maxElements = 5;\n\n /**\n * Whether the rating is read-only (non-interactive)\n */\n @property({ type: Boolean, reflect: true, attribute: 'read-only' })\n readOnly = false;\n\n /**\n * The icon name to use for the rating item\n * @default 'it-star-outline'\n */\n @property({ type: String, reflect: true })\n icon = 'it-star-outline';\n\n /**\n * Sync read-only state to all rating items\n */\n private _syncReadOnlyToItems() {\n const items = this.querySelectorAll('it-rating-item');\n items.forEach((item) => {\n if (this.readOnly) {\n item.setAttribute('disabled', '');\n } else {\n item.removeAttribute('disabled');\n }\n });\n }\n\n /**\n * Get the localized rating announcement for screen readers\n */\n private _getRatingAnnouncement(): string {\n const currentValue = parseInt(this.value || '0', 10);\n\n if (!currentValue || currentValue === 0) {\n return this.localize.term('noRating');\n }\n // Use singular or plural form based on rating value\n const termKey = currentValue === 1 ? 'ratingLabelSingle' : 'ratingLabelPlural';\n\n // Pass parameters directly to the translation function\n return this.localize.term(termKey, currentValue, this.maxElements);\n }\n\n /**\n * Override updated to refresh the rating items and announcement when value changes\n */\n override updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n\n // Sync disabled state to all rating items when readOnly changes\n if (changedProperties.has('readOnly')) {\n this._syncReadOnlyToItems();\n }\n\n // Update aria-readonly attribute\n if (this.readOnly) {\n this.setAttribute('aria-readonly', 'true');\n } else {\n this.removeAttribute('aria-readonly');\n }\n\n // When value changes, force re-render of all rating items AND update their display\n if (changedProperties.has('value')) {\n this._updateRadiosState();\n this._updateRatingItemsDisplay();\n this._ensureAnnouncement();\n }\n if (changedProperties.has('icon')) {\n this._updateRatingItemsDisplay();\n }\n\n // When maxElements changes, update the announcement\n if (changedProperties.has('maxElements')) {\n this._ensureAnnouncement();\n }\n }\n\n /**\n * Force re-render of all rating items to update star colors\n * This ensures star colors reflect the current value\n */\n private _updateRatingItemsDisplay() {\n const items = this.querySelectorAll('it-rating-item');\n items.forEach((item) => {\n item.requestUpdate();\n });\n }\n\n /**\n * Create or update the visually-hidden announcement element\n * Following BSI pattern: announcement placed directly in the label slot\n */\n private _ensureAnnouncement() {\n // Find the label slot elements (assigned nodes)\n const labelSlot = this.shadowRoot?.querySelector('slot[name=\"label\"]') as HTMLSlotElement;\n if (!labelSlot) return;\n\n // Get the first element in the label slot (the legend/label container)\n const labelElements = labelSlot.assignedElements();\n if (labelElements.length === 0) return;\n\n const labelContainer = labelElements[0];\n\n // Look for existing announcement span\n let announcement = labelContainer.querySelector('.rating-announcement') as HTMLElement;\n\n if (!announcement) {\n // Create the announcement element if it doesn't exist\n announcement = document.createElement('span');\n announcement.className = 'visually-hidden rating-announcement';\n\n // Append to the label container\n labelContainer.appendChild(announcement);\n }\n // Update the text content\n announcement.textContent = ` ${this._getRatingAnnouncement()}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-rating': ItRating;\n }\n}\n"],"names":["it"],"mappings":";;;;;;AAEA,MAAM,WAAW,GAAuB;AACtC,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,UAAU;AACjB,IAAA,IAAI,EAAE,KAAK;AAEX,IAAA,QAAQ,EAAE,qBAAqB;AAC/B,IAAA,iBAAiB,EAAE,CAAC,MAAc,EAAE,GAAW,KAAK,CAAA,EAAG,MAAM,CAAA,WAAA,EAAc,GAAG,CAAA,CAAE;AAChF,IAAA,iBAAiB,EAAE,CAAC,MAAc,EAAE,GAAW,KAAK,CAAA,EAAG,MAAM,CAAA,WAAA,EAAc,GAAG,CAAA,CAAE;CACjF
|
|
1
|
+
{"version":3,"file":"it-rating.js","sources":["../../../src/locales/it.ts","../../../src/it-rating.ts"],"sourcesContent":["import type { DefaultTranslation } from '@italia/i18n';\n\nconst translation: DefaultTranslation = {\n $code: 'it',\n $name: 'Italiano',\n $dir: 'ltr',\n\n noRating: 'Nessuna valutazione',\n ratingLabelSingle: (rating: number, max: number) => `${rating} stella su ${max}`,\n ratingLabelPlural: (rating: number, max: number) => `${rating} stelle su ${max}`,\n};\n\nexport default translation;\n","import { type PropertyValues } from 'lit';\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js';\nimport { ItRadioGroup } from '@italia/radio'; // eslint-disable-line import/no-extraneous-dependencies\nimport { registerTranslation } from '@italia/i18n';\nimport { type ItRatingItem } from '@italia/rating';\nimport it from './locales/it.js';\n\nimport styles from './rating.scss';\n\nregisterTranslation(it);\n\n/**\n * Rating component - extends it-radio-group for star rating\n *\n * @element it-rating\n *\n * @slot - Contains the `<it-rating-item>` elements\n * @slot label - The label/legend text for the rating\n *\n * @fires {CustomEvent} change - Emitted when the rating value changes\n */\n@customElement('it-rating')\nexport class ItRating extends ItRadioGroup {\n static override styles = styles;\n\n /**\n * Get all slotted rating items\n */\n @queryAssignedElements()\n protected _radios!: ItRatingItem[];\n\n /**\n * Maximum number of stars (to calculate \"X out of Y\")\n */\n @property({ type: Number, attribute: 'max-elements', reflect: true })\n maxElements = 5;\n\n /**\n * Whether the rating is read-only (non-interactive)\n */\n @property({ type: Boolean, reflect: true, attribute: 'read-only' })\n readOnly = false;\n\n /**\n * The icon name to use for the rating item\n * @default 'it-star-outline'\n */\n @property({ type: String, reflect: true })\n icon = 'it-star-outline';\n\n /**\n * Sync read-only state to all rating items\n */\n private _syncReadOnlyToItems() {\n const items = this.querySelectorAll('it-rating-item');\n items.forEach((item) => {\n if (this.readOnly) {\n item.setAttribute('disabled', '');\n } else {\n item.removeAttribute('disabled');\n }\n });\n }\n\n /**\n * Get the localized rating announcement for screen readers\n */\n private _getRatingAnnouncement(): string {\n const currentValue = parseInt(this.value || '0', 10);\n\n if (!currentValue || currentValue === 0) {\n return this.localize.term('noRating');\n }\n // Use singular or plural form based on rating value\n const termKey = currentValue === 1 ? 'ratingLabelSingle' : 'ratingLabelPlural';\n\n // Pass parameters directly to the translation function\n return this.localize.term(termKey, currentValue, this.maxElements);\n }\n\n /**\n * Override updated to refresh the rating items and announcement when value changes\n */\n override updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n\n // Sync disabled state to all rating items when readOnly changes\n if (changedProperties.has('readOnly')) {\n this._syncReadOnlyToItems();\n }\n\n // Update aria-readonly attribute\n if (this.readOnly) {\n this.setAttribute('aria-readonly', 'true');\n } else {\n this.removeAttribute('aria-readonly');\n }\n\n // When value changes, force re-render of all rating items AND update their display\n if (changedProperties.has('value')) {\n this._updateRadiosState();\n this._updateRatingItemsDisplay();\n this._ensureAnnouncement();\n }\n if (changedProperties.has('icon')) {\n this._updateRatingItemsDisplay();\n }\n\n // When maxElements changes, update the announcement\n if (changedProperties.has('maxElements')) {\n this._ensureAnnouncement();\n }\n }\n\n /**\n * Force re-render of all rating items to update star colors\n * This ensures star colors reflect the current value\n */\n private _updateRatingItemsDisplay() {\n const items = this.querySelectorAll('it-rating-item');\n items.forEach((item) => {\n item.requestUpdate();\n });\n }\n\n /**\n * Create or update the visually-hidden announcement element\n * Following BSI pattern: announcement placed directly in the label slot\n */\n private _ensureAnnouncement() {\n // Find the label slot elements (assigned nodes)\n const labelSlot = this.shadowRoot?.querySelector('slot[name=\"label\"]') as HTMLSlotElement;\n if (!labelSlot) return;\n\n // Get the first element in the label slot (the legend/label container)\n const labelElements = labelSlot.assignedElements();\n if (labelElements.length === 0) return;\n\n const labelContainer = labelElements[0];\n\n // Look for existing announcement span\n let announcement = labelContainer.querySelector('.rating-announcement') as HTMLElement;\n\n if (!announcement) {\n // Create the announcement element if it doesn't exist\n announcement = document.createElement('span');\n announcement.className = 'visually-hidden rating-announcement';\n\n // Append to the label container\n labelContainer.appendChild(announcement);\n }\n // Update the text content\n announcement.textContent = ` ${this._getRatingAnnouncement()}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-rating': ItRating;\n }\n}\n"],"names":["it"],"mappings":";;;;;;AAEA,MAAM,WAAW,GAAuB;AACtC,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,UAAU;AACjB,IAAA,IAAI,EAAE,KAAK;AAEX,IAAA,QAAQ,EAAE,qBAAqB;AAC/B,IAAA,iBAAiB,EAAE,CAAC,MAAc,EAAE,GAAW,KAAK,CAAA,EAAG,MAAM,CAAA,WAAA,EAAc,GAAG,CAAA,CAAE;AAChF,IAAA,iBAAiB,EAAE,CAAC,MAAc,EAAE,GAAW,KAAK,CAAA,EAAG,MAAM,CAAA,WAAA,EAAc,GAAG,CAAA,CAAE;CACjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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1Bd,QAAQ,GAAA,UAAA,CAAA;IADpB,aAAa,CAAC,WAAW;AACb,CAAA,EAAA,QAAQ,CAoIpB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@italia/rating",
|
|
3
3
|
"description": "Web component it-rating del Design system .italia",
|
|
4
|
-
"version": "1.0.0-
|
|
4
|
+
"version": "1.0.0-beta.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -33,38 +33,38 @@
|
|
|
33
33
|
"LICENSE",
|
|
34
34
|
"custom-elements.json"
|
|
35
35
|
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"analyze": "cem analyze --litelement --exclude dist",
|
|
38
|
+
"build": "rollup --config rollup.config.js",
|
|
39
|
+
"clean": "rimraf node_modules .turbo .rollup.cache dist coverage",
|
|
40
|
+
"prepublish": "pnpm build",
|
|
41
|
+
"lint": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && stylelint \"styles/**/*.scss\" \"src/**/*.scss\" && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --check",
|
|
42
|
+
"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\"",
|
|
43
|
+
"test": "wtr --coverage --node-resolve --config web-test-runner.config.js",
|
|
44
|
+
"test:watch": "wtr --coverage --node-resolve --config web-test-runner.config.js --watch"
|
|
45
|
+
},
|
|
36
46
|
"dependencies": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"@italia/
|
|
40
|
-
"@italia/
|
|
41
|
-
"
|
|
42
|
-
"
|
|
47
|
+
"@italia/globals": "workspace:^",
|
|
48
|
+
"@italia/i18n": "workspace:^",
|
|
49
|
+
"@italia/icon": "workspace:^",
|
|
50
|
+
"@italia/radio": "workspace:^",
|
|
51
|
+
"bootstrap-italia": "catalog:",
|
|
52
|
+
"lit": "catalog:"
|
|
43
53
|
},
|
|
44
54
|
"devDependencies": {
|
|
45
55
|
"@custom-elements-manifest/analyzer": "^0.10.3",
|
|
56
|
+
"@italia/test-config": "workspace:^",
|
|
57
|
+
"@italia/input": "workspace:^",
|
|
58
|
+
"@italia/typescript-config": "workspace:^",
|
|
46
59
|
"@open-wc/testing": "^4.0.0",
|
|
47
60
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
48
61
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
49
62
|
"@web/test-runner": "^0.19.0",
|
|
50
63
|
"rollup": "^4.42.0",
|
|
51
64
|
"rollup-plugin-scss-lit": "^2.1.0",
|
|
52
|
-
"sass": "
|
|
65
|
+
"sass": "catalog:",
|
|
53
66
|
"tslib": "^2.6.3",
|
|
54
|
-
"typescript": "
|
|
55
|
-
"@italia/test-config": "^0.0.0",
|
|
56
|
-
"@italia/input": "^1.0.0-alpha.9",
|
|
57
|
-
"@italia/typescript-config": "^0.0.0"
|
|
67
|
+
"typescript": "catalog:"
|
|
58
68
|
},
|
|
59
|
-
"customElements": "custom-elements.json"
|
|
60
|
-
|
|
61
|
-
"analyze": "cem analyze --litelement --exclude dist",
|
|
62
|
-
"build": "rollup --config rollup.config.js",
|
|
63
|
-
"clean": "rimraf node_modules .turbo .rollup.cache dist coverage",
|
|
64
|
-
"prepublish": "pnpm build",
|
|
65
|
-
"lint": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && stylelint \"styles/**/*.scss\" \"src/**/*.scss\" && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --check",
|
|
66
|
-
"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\"",
|
|
67
|
-
"test": "wtr --coverage --node-resolve --config web-test-runner.config.js",
|
|
68
|
-
"test:watch": "wtr --coverage --node-resolve --config web-test-runner.config.js --watch"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
69
|
+
"customElements": "custom-elements.json"
|
|
70
|
+
}
|