@italia/rating 1.0.0-alpha.5

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,566 @@
1
+ import { _ as __decorate, a as __metadata } from '../tslib.es6-Cv888lzs.js';
2
+ import { queryAssignedElements, property, customElement } from 'lit/decorators.js';
3
+ import { ItRadioGroup } from '@italia/radio';
4
+ import { registerTranslation } from '@italia/i18n';
5
+ import { css } from 'lit';
6
+
7
+ const translation = {
8
+ $code: 'it',
9
+ $name: 'Italiano',
10
+ $dir: 'ltr',
11
+ noRating: 'Nessuna valutazione',
12
+ ratingLabelSingle: (rating, max) => `${rating} stella su ${max}`,
13
+ ratingLabelPlural: (rating, max) => `${rating} stelle su ${max}`,
14
+ };
15
+
16
+ var styles = css`/***************************** 1 ****************************************/
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
+ *,
30
+ *::before,
31
+ *::after {
32
+ box-sizing: border-box;
33
+ }
34
+
35
+ @media (prefers-reduced-motion: no-preference) {
36
+ :root {
37
+ scroll-behavior: smooth;
38
+ }
39
+ }
40
+
41
+ body {
42
+ margin: 0;
43
+ -webkit-text-size-adjust: 100%;
44
+ -webkit-tap-highlight-color: hsla(0, 0%, 0%, 0);
45
+ }
46
+
47
+ hr {
48
+ margin: 1rem 0;
49
+ color: inherit;
50
+ border: 0;
51
+ border-top: 1px solid;
52
+ opacity: 0.25;
53
+ }
54
+
55
+ p {
56
+ margin-top: 0;
57
+ margin-bottom: var(--bsi-paragraph-spacing);
58
+ }
59
+
60
+ abbr[title] {
61
+ text-decoration: underline dotted;
62
+ cursor: help;
63
+ text-decoration-skip-ink: none;
64
+ }
65
+
66
+ address {
67
+ margin-bottom: var(--bsi-spacing-s);
68
+ font-style: normal;
69
+ line-height: inherit;
70
+ }
71
+
72
+ ol,
73
+ ul {
74
+ padding-left: var(--bsi-spacing-l);
75
+ }
76
+
77
+ ol,
78
+ ul,
79
+ dl {
80
+ margin-top: 0;
81
+ margin-bottom: var(--bsi-spacing-s);
82
+ }
83
+
84
+ ol ol,
85
+ ul ul,
86
+ ol ul,
87
+ ul ol {
88
+ margin-bottom: 0;
89
+ }
90
+
91
+ dt {
92
+ font-weight: var(--bsi-font-weight-strong);
93
+ }
94
+
95
+ dd {
96
+ margin-bottom: var(--bsi-spacing-xxs);
97
+ margin-left: 0;
98
+ }
99
+
100
+ blockquote {
101
+ margin: 0 0 var(--bsi-spacing-s);
102
+ }
103
+
104
+ sub,
105
+ sup {
106
+ position: relative;
107
+ font-size: var(--bsi-font-size-1);
108
+ line-height: 0;
109
+ vertical-align: baseline;
110
+ }
111
+
112
+ sub {
113
+ bottom: -0.25em;
114
+ }
115
+
116
+ sup {
117
+ top: -0.5em;
118
+ }
119
+
120
+ a {
121
+ color: var(--bsi-color-link);
122
+ text-decoration: underline;
123
+ text-decoration-skip-ink: auto;
124
+ text-underline-offset: 2px;
125
+ }
126
+ a:hover {
127
+ color: var(--bsi-color-link-hover);
128
+ }
129
+
130
+ pre,
131
+ code,
132
+ kbd,
133
+ samp {
134
+ font-size: 1em;
135
+ }
136
+
137
+ pre {
138
+ display: block;
139
+ margin-top: 0;
140
+ margin-bottom: var(--bsi-paragraph-spacing);
141
+ overflow: auto;
142
+ }
143
+ pre code {
144
+ word-break: normal;
145
+ }
146
+
147
+ a > code {
148
+ color: inherit;
149
+ }
150
+
151
+ figure {
152
+ margin: 0 0 1rem;
153
+ }
154
+
155
+ img,
156
+ svg {
157
+ vertical-align: middle;
158
+ }
159
+
160
+ table {
161
+ caption-side: bottom;
162
+ border-collapse: collapse;
163
+ }
164
+
165
+ caption {
166
+ padding-top: 0.5rem;
167
+ padding-bottom: 0.5rem;
168
+ color: hsl(210, 17%, 44%);
169
+ text-align: left;
170
+ }
171
+
172
+ th {
173
+ text-align: inherit;
174
+ text-align: -webkit-match-parent;
175
+ }
176
+
177
+ thead,
178
+ tbody,
179
+ tfoot,
180
+ tr,
181
+ td,
182
+ th {
183
+ border-color: inherit;
184
+ border-style: solid;
185
+ border-width: 0;
186
+ }
187
+
188
+ label {
189
+ display: inline-block;
190
+ }
191
+
192
+ button {
193
+ border-radius: 0;
194
+ }
195
+
196
+ button:focus:not(:focus-visible) {
197
+ outline: 0;
198
+ }
199
+
200
+ input,
201
+ button,
202
+ select,
203
+ optgroup,
204
+ textarea {
205
+ margin: 0;
206
+ font-family: inherit;
207
+ font-size: inherit;
208
+ line-height: inherit;
209
+ }
210
+
211
+ button,
212
+ select {
213
+ text-transform: none;
214
+ }
215
+
216
+ [role=button] {
217
+ cursor: pointer;
218
+ }
219
+
220
+ select {
221
+ word-wrap: normal;
222
+ }
223
+ select:disabled {
224
+ opacity: 1;
225
+ }
226
+
227
+ [list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
228
+ display: none !important;
229
+ }
230
+
231
+ button,
232
+ [type=button],
233
+ [type=reset],
234
+ [type=submit] {
235
+ -webkit-appearance: button;
236
+ }
237
+ button:not(:disabled),
238
+ [type=button]:not(:disabled),
239
+ [type=reset]:not(:disabled),
240
+ [type=submit]:not(:disabled) {
241
+ cursor: pointer;
242
+ }
243
+
244
+ ::-moz-focus-inner {
245
+ padding: 0;
246
+ border-style: none;
247
+ }
248
+
249
+ textarea {
250
+ resize: vertical;
251
+ }
252
+
253
+ fieldset {
254
+ min-width: 0;
255
+ padding: 0;
256
+ margin: 0;
257
+ border: 0;
258
+ }
259
+
260
+ ::-webkit-datetime-edit-fields-wrapper,
261
+ ::-webkit-datetime-edit-text,
262
+ ::-webkit-datetime-edit-minute,
263
+ ::-webkit-datetime-edit-hour-field,
264
+ ::-webkit-datetime-edit-day-field,
265
+ ::-webkit-datetime-edit-month-field,
266
+ ::-webkit-datetime-edit-year-field {
267
+ padding: 0;
268
+ }
269
+
270
+ ::-webkit-inner-spin-button {
271
+ height: auto;
272
+ }
273
+
274
+ [type=search] {
275
+ outline-offset: -2px;
276
+ -webkit-appearance: textfield;
277
+ }
278
+
279
+ /* rtl:raw:
280
+ [type="tel"],
281
+ [type="url"],
282
+ [type="email"],
283
+ [type="number"] {
284
+ direction: ltr;
285
+ }
286
+ */
287
+ ::-webkit-search-decoration {
288
+ -webkit-appearance: none;
289
+ }
290
+
291
+ ::-webkit-color-swatch-wrapper {
292
+ padding: 0;
293
+ }
294
+
295
+ ::file-selector-button {
296
+ font: inherit;
297
+ -webkit-appearance: button;
298
+ }
299
+
300
+ output {
301
+ display: inline-block;
302
+ }
303
+
304
+ iframe {
305
+ border: 0;
306
+ }
307
+
308
+ summary {
309
+ display: list-item;
310
+ cursor: pointer;
311
+ }
312
+
313
+ progress {
314
+ vertical-align: baseline;
315
+ }
316
+
317
+ [hidden] {
318
+ display: none !important;
319
+ }
320
+
321
+ .visually-hidden,
322
+ .visually-hidden-focusable:not(:focus):not(:focus-within) {
323
+ position: absolute !important;
324
+ width: 1px !important;
325
+ height: 1px !important;
326
+ padding: 0 !important;
327
+ margin: -1px !important;
328
+ overflow: hidden !important;
329
+ clip: rect(0, 0, 0, 0) !important;
330
+ white-space: nowrap !important;
331
+ border: 0 !important;
332
+ }
333
+
334
+ .rating {
335
+ --bsi-rating-font-size: var(--bsi-label-font-size-s);
336
+ --bsi-rating-font-weight: var(--bsi-font-weight-solid);
337
+ --bsi-rating-icon-fill: var(--bsi-color-background-secondary-light);
338
+ --bsi-rating-line-height: var(--bsi-label-line-height);
339
+ --bsi-rating-text: var(--bsi-color-text-secondary);
340
+ }
341
+
342
+ /* stylelint-disable-next-line no-duplicate-selectors */
343
+ .rating {
344
+ border: none;
345
+ display: flex;
346
+ flex-direction: row-reverse;
347
+ justify-content: flex-end;
348
+ align-items: center;
349
+ }
350
+ .rating > input {
351
+ position: absolute;
352
+ left: -9999px;
353
+ }
354
+ .rating > label {
355
+ margin: 0;
356
+ padding-right: 2px;
357
+ }
358
+ .rating > label:hover {
359
+ cursor: pointer;
360
+ }
361
+ .rating > label:hover svg {
362
+ transform: scale(1.2);
363
+ }
364
+ .rating > label svg {
365
+ fill: var(--bsi-rating-icon-fill);
366
+ position: relative;
367
+ transform-origin: center center;
368
+ transition: transform var(--bsi-transition-instant);
369
+ }
370
+ .rating > legend {
371
+ color: var(--bsi-rating-text);
372
+ font-size: var(--bsi-rating-font-size);
373
+ float: right;
374
+ width: auto;
375
+ margin-left: var(--bsi-spacing-xxs);
376
+ font-weight: var(--bsi-rating-font-weight);
377
+ line-height: var(--bsi-rating-line-height);
378
+ }
379
+ .rating.rating-read-only > input, .rating.rating-read-only > label {
380
+ pointer-events: none;
381
+ }
382
+
383
+ .rating > input:checked ~ label,
384
+ .rating:not(:checked) > label:hover,
385
+ .rating:not(:checked) > label:hover ~ label {
386
+ --bsi-rating-icon-fill: var(--bsi-icon-primary);
387
+ }
388
+
389
+ .rating > input:checked + label:hover svg,
390
+ .rating > input:checked ~ label:hover svg,
391
+ .rating > label:hover ~ input:checked ~ label svg,
392
+ .rating > input:checked ~ label:hover ~ label svg {
393
+ --bsi-rating-icon-fill: var(--bsi-icon-primary);
394
+ }
395
+
396
+ :host {
397
+ display: flex;
398
+ flex-direction: row-reverse;
399
+ flex-wrap: wrap;
400
+ align-items: center;
401
+ --bsi-rating-icon-fill: var(--bsi-icon-disabled);
402
+ --bsi-rating-text: var(--bsi-color-text-secondary);
403
+ --bsi-rating-font-size: var(--bsi-label-font-size-s);
404
+ --bsi-rating-line-height: var(--bsi-label-line-height);
405
+ --bsi-rating-font-weight: var(--bsi-font-weight-solid);
406
+ }
407
+
408
+ div.it-radio-group {
409
+ display: flex;
410
+ }
411
+
412
+ ::slotted([slot=label]) {
413
+ width: auto;
414
+ margin-left: var(--bsi-spacing-xxs);
415
+ color: var(--bsi-rating-text);
416
+ float: right;
417
+ font-size: var(--bsi-rating-font-size);
418
+ font-weight: var(--bsi-rating-font-weight);
419
+ line-height: var(--bsi-rating-line-height);
420
+ }`;
421
+
422
+ registerTranslation(translation);
423
+ /**
424
+ * Rating component - extends it-radio-group for star rating
425
+ *
426
+ * @element it-rating
427
+ *
428
+ * @slot - Contains the `<it-rating-item>` elements
429
+ * @slot label - The label/legend text for the rating
430
+ *
431
+ * @fires {CustomEvent} change - Emitted when the rating value changes
432
+ */
433
+ let ItRating = class ItRating extends ItRadioGroup {
434
+ constructor() {
435
+ super(...arguments);
436
+ /**
437
+ * Maximum number of stars (to calculate "X out of Y")
438
+ */
439
+ this.maxElements = 5;
440
+ /**
441
+ * Whether the rating is read-only (non-interactive)
442
+ */
443
+ this.readOnly = false;
444
+ /**
445
+ * The icon name to use for the rating item
446
+ * @default 'it-star-outline'
447
+ */
448
+ this.icon = 'it-star-outline';
449
+ }
450
+ /**
451
+ * Sync read-only state to all rating items
452
+ */
453
+ _syncReadOnlyToItems() {
454
+ const items = this.querySelectorAll('it-rating-item');
455
+ items.forEach((item) => {
456
+ if (this.readOnly) {
457
+ item.setAttribute('disabled', '');
458
+ }
459
+ else {
460
+ item.removeAttribute('disabled');
461
+ }
462
+ });
463
+ }
464
+ /**
465
+ * Get the localized rating announcement for screen readers
466
+ */
467
+ _getRatingAnnouncement() {
468
+ const currentValue = parseInt(this.value || '0', 10);
469
+ if (!currentValue || currentValue === 0) {
470
+ return this.localize.term('noRating');
471
+ }
472
+ // Use singular or plural form based on rating value
473
+ const termKey = currentValue === 1 ? 'ratingLabelSingle' : 'ratingLabelPlural';
474
+ // Pass parameters directly to the translation function
475
+ return this.localize.term(termKey, currentValue, this.maxElements);
476
+ }
477
+ /**
478
+ * Override updated to refresh the rating items and announcement when value changes
479
+ */
480
+ updated(changedProperties) {
481
+ super.updated(changedProperties);
482
+ // Sync disabled state to all rating items when readOnly changes
483
+ if (changedProperties.has('readOnly')) {
484
+ this._syncReadOnlyToItems();
485
+ }
486
+ // Update aria-readonly attribute
487
+ if (this.readOnly) {
488
+ this.setAttribute('aria-readonly', 'true');
489
+ }
490
+ else {
491
+ this.removeAttribute('aria-readonly');
492
+ }
493
+ // When value changes, force re-render of all rating items AND update their display
494
+ if (changedProperties.has('value')) {
495
+ this._updateRadiosState();
496
+ this._updateRatingItemsDisplay();
497
+ this._ensureAnnouncement();
498
+ }
499
+ if (changedProperties.has('icon')) {
500
+ this._updateRatingItemsDisplay();
501
+ }
502
+ // When maxElements changes, update the announcement
503
+ if (changedProperties.has('maxElements')) {
504
+ this._ensureAnnouncement();
505
+ }
506
+ }
507
+ /**
508
+ * Force re-render of all rating items to update star colors
509
+ * This ensures star colors reflect the current value
510
+ */
511
+ _updateRatingItemsDisplay() {
512
+ const items = this.querySelectorAll('it-rating-item');
513
+ items.forEach((item) => {
514
+ item.requestUpdate();
515
+ });
516
+ }
517
+ /**
518
+ * Create or update the visually-hidden announcement element
519
+ * Following BSI pattern: announcement placed directly in the label slot
520
+ */
521
+ _ensureAnnouncement() {
522
+ // Find the label slot elements (assigned nodes)
523
+ const labelSlot = this.shadowRoot?.querySelector('slot[name="label"]');
524
+ if (!labelSlot)
525
+ return;
526
+ // Get the first element in the label slot (the legend/label container)
527
+ const labelElements = labelSlot.assignedElements();
528
+ if (labelElements.length === 0)
529
+ return;
530
+ const labelContainer = labelElements[0];
531
+ // Look for existing announcement span
532
+ let announcement = labelContainer.querySelector('.rating-announcement');
533
+ if (!announcement) {
534
+ // Create the announcement element if it doesn't exist
535
+ announcement = document.createElement('span');
536
+ announcement.className = 'visually-hidden rating-announcement';
537
+ // Append to the label container
538
+ labelContainer.appendChild(announcement);
539
+ }
540
+ // Update the text content
541
+ announcement.textContent = ` ${this._getRatingAnnouncement()}`;
542
+ }
543
+ };
544
+ ItRating.styles = styles;
545
+ __decorate([
546
+ queryAssignedElements(),
547
+ __metadata("design:type", Array)
548
+ ], ItRating.prototype, "_radios", void 0);
549
+ __decorate([
550
+ property({ type: Number, attribute: 'max-elements', reflect: true }),
551
+ __metadata("design:type", Object)
552
+ ], ItRating.prototype, "maxElements", void 0);
553
+ __decorate([
554
+ property({ type: Boolean, reflect: true, attribute: 'read-only' }),
555
+ __metadata("design:type", Object)
556
+ ], ItRating.prototype, "readOnly", void 0);
557
+ __decorate([
558
+ property({ type: String, reflect: true }),
559
+ __metadata("design:type", Object)
560
+ ], ItRating.prototype, "icon", void 0);
561
+ ItRating = __decorate([
562
+ customElement('it-rating')
563
+ ], ItRating);
564
+
565
+ export { ItRating };
566
+ //# sourceMappingURL=it-rating.js.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,QAAQ,GAAA,UAAA,CAAA;IADpB,aAAa,CAAC,WAAW;AACb,CAAA,EAAA,QAAQ,CAoIpB;;;;"}
@@ -0,0 +1,4 @@
1
+ import type { DefaultTranslation } from '@italia/i18n';
2
+ declare const translation: DefaultTranslation;
3
+ export default translation;
4
+ //# sourceMappingURL=it.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"it.d.ts","sourceRoot":"","sources":["../../../src/locales/it.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,QAAA,MAAM,WAAW,EAAE,kBAQlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@italia/rating",
3
+ "description": "Web component it-rating del Design system .italia",
4
+ "version": "1.0.0-alpha.5",
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/rating"
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-rating.js": "./dist/src/it-rating.js",
26
+ "./it-rating-item.js": "./dist/src/it-rating-item.js",
27
+ "./styles/*": "./styles/*"
28
+ },
29
+ "files": [
30
+ "dist/src",
31
+ "README.md",
32
+ "AUTHORS",
33
+ "LICENSE",
34
+ "custom-elements.json"
35
+ ],
36
+ "dependencies": {
37
+ "bootstrap-italia": "3.0.0-alpha.0",
38
+ "lit": "^3.3.0",
39
+ "@italia/globals": "^1.0.0-alpha.5",
40
+ "@italia/i18n": "^1.0.0-alpha.5",
41
+ "@italia/icon": "^1.0.0-alpha.5",
42
+ "@italia/radio": "^1.0.0-alpha.5"
43
+ },
44
+ "devDependencies": {
45
+ "@custom-elements-manifest/analyzer": "^0.10.3",
46
+ "@open-wc/testing": "^4.0.0",
47
+ "@rollup/plugin-node-resolve": "^15.3.0",
48
+ "@rollup/plugin-typescript": "^12.1.1",
49
+ "@web/test-runner": "^0.19.0",
50
+ "rollup": "^4.42.0",
51
+ "rollup-plugin-scss-lit": "^2.1.0",
52
+ "sass": "^1.89.0",
53
+ "tslib": "^2.6.3",
54
+ "typescript": "^5.5.3",
55
+ "@italia/test-config": "^0.0.0",
56
+ "@italia/input": "^1.0.0-alpha.5",
57
+ "@italia/typescript-config": "^0.0.0"
58
+ },
59
+ "customElements": "custom-elements.json",
60
+ "scripts": {
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
+ }