@italia/radio 0.1.0-alpha.2

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,1459 @@
1
+ import { _ as __decorate, a as __metadata, B as BaseComponent } from '../form-control-CdxVvcex.js';
2
+ import { css, html } from 'lit';
3
+ import { property, state, queryAssignedElements, customElement } from 'lit/decorators.js';
4
+ import { when } from 'lit/directives/when.js';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
6
+ import 'lit/directive.js';
7
+
8
+ var styles = css`@charset "UTF-8";
9
+ /***************************** 1 ****************************************/
10
+ /***************************** 2 ****************************************/
11
+ /***************************** 1 ****************************************/
12
+ /***************************** 2 ****************************************/
13
+ /***************************** 1 ****************************************/
14
+ /***************************** 2 ****************************************/
15
+ /***************************** 3 ****************************************/
16
+ /***************************** 1 ****************************************/
17
+ /***************************** 2 ****************************************/
18
+ /***************************** 3 ****************************************/
19
+ /***************************** NEUTRAL 1 ****************************************/
20
+ /***************************** NEUTRAL 2 ****************************************/
21
+ /***************************** NEUTRAL 2 / 3 ****************************************/
22
+ .form-check [type=checkbox]:focus + label,
23
+ .form-check [type=radio]:focus + label {
24
+ border-color: hsl(0, 0%, 0%) !important;
25
+ box-shadow: 0 0 0 2px var(--bs-color-border-inverse), 0 0 0 5px var(--bs-color-outline-focus) !important;
26
+ outline: 3px solid transparent !important;
27
+ outline-offset: 3px !important;
28
+ }
29
+
30
+ .form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
31
+ .form-check [type=radio]:focus[data-focus-mouse=true] + label {
32
+ border-color: inherit !important;
33
+ box-shadow: none !important;
34
+ outline: none !important;
35
+ }
36
+
37
+ *,
38
+ *::before,
39
+ *::after {
40
+ box-sizing: border-box;
41
+ }
42
+
43
+ @media (prefers-reduced-motion: no-preference) {
44
+ :root {
45
+ scroll-behavior: smooth;
46
+ }
47
+ }
48
+
49
+ body {
50
+ margin: 0;
51
+ -webkit-text-size-adjust: 100%;
52
+ -webkit-tap-highlight-color: hsla(0, 0%, 0%, 0);
53
+ }
54
+
55
+ hr {
56
+ margin: 1rem 0;
57
+ color: inherit;
58
+ border: 0;
59
+ border-top: 1px solid;
60
+ opacity: 0.25;
61
+ }
62
+
63
+ p {
64
+ margin-top: 0;
65
+ margin-bottom: var(--bs-paragraph-spacing);
66
+ }
67
+
68
+ abbr[title] {
69
+ text-decoration: underline dotted;
70
+ cursor: help;
71
+ text-decoration-skip-ink: none;
72
+ }
73
+
74
+ address {
75
+ margin-bottom: var(--bs-spacing-s);
76
+ font-style: normal;
77
+ line-height: inherit;
78
+ }
79
+
80
+ ol,
81
+ ul {
82
+ padding-left: var(--bs-spacing-l);
83
+ }
84
+
85
+ ol,
86
+ ul,
87
+ dl {
88
+ margin-top: 0;
89
+ margin-bottom: var(--bs-spacing-s);
90
+ }
91
+
92
+ ol ol,
93
+ ul ul,
94
+ ol ul,
95
+ ul ol {
96
+ margin-bottom: 0;
97
+ }
98
+
99
+ dt {
100
+ font-weight: var(--bs-font-weight-strong);
101
+ }
102
+
103
+ dd {
104
+ margin-bottom: var(--bs-spacing-xxs);
105
+ margin-left: 0;
106
+ }
107
+
108
+ blockquote {
109
+ margin: 0 0 var(--bs-spacing-s);
110
+ }
111
+
112
+ sub,
113
+ sup {
114
+ position: relative;
115
+ font-size: var(--bs-font-size-1);
116
+ line-height: 0;
117
+ vertical-align: baseline;
118
+ }
119
+
120
+ sub {
121
+ bottom: -0.25em;
122
+ }
123
+
124
+ sup {
125
+ top: -0.5em;
126
+ }
127
+
128
+ a {
129
+ color: var(--bs-color-link);
130
+ text-decoration: underline;
131
+ text-decoration-skip-ink: auto;
132
+ text-underline-offset: 2px;
133
+ }
134
+ a:hover {
135
+ color: var(--bs-color-link-hover);
136
+ }
137
+
138
+ a:not([href]):not([class]), a:not([href]):not([class]):hover {
139
+ color: inherit;
140
+ text-decoration: none;
141
+ }
142
+
143
+ pre,
144
+ code,
145
+ kbd,
146
+ samp {
147
+ font-size: 1em;
148
+ }
149
+
150
+ pre {
151
+ display: block;
152
+ margin-top: 0;
153
+ margin-bottom: var(--bs-paragraph-spacing);
154
+ overflow: auto;
155
+ }
156
+ pre code {
157
+ word-break: normal;
158
+ }
159
+
160
+ a > code {
161
+ color: inherit;
162
+ }
163
+
164
+ figure {
165
+ margin: 0 0 1rem;
166
+ }
167
+
168
+ img,
169
+ svg {
170
+ vertical-align: middle;
171
+ }
172
+
173
+ table {
174
+ caption-side: bottom;
175
+ border-collapse: collapse;
176
+ }
177
+
178
+ caption {
179
+ padding-top: 0.5rem;
180
+ padding-bottom: 0.5rem;
181
+ color: hsl(210, 17%, 44%);
182
+ text-align: left;
183
+ }
184
+
185
+ th {
186
+ text-align: inherit;
187
+ text-align: -webkit-match-parent;
188
+ }
189
+
190
+ thead,
191
+ tbody,
192
+ tfoot,
193
+ tr,
194
+ td,
195
+ th {
196
+ border-color: inherit;
197
+ border-style: solid;
198
+ border-width: 0;
199
+ }
200
+
201
+ label {
202
+ display: inline-block;
203
+ }
204
+
205
+ button {
206
+ border-radius: 0;
207
+ }
208
+
209
+ button:focus:not(:focus-visible) {
210
+ outline: 0;
211
+ }
212
+
213
+ input,
214
+ button,
215
+ select,
216
+ optgroup,
217
+ textarea {
218
+ margin: 0;
219
+ font-family: inherit;
220
+ font-size: inherit;
221
+ line-height: inherit;
222
+ }
223
+
224
+ button,
225
+ select {
226
+ text-transform: none;
227
+ }
228
+
229
+ [role=button] {
230
+ cursor: pointer;
231
+ }
232
+
233
+ select {
234
+ word-wrap: normal;
235
+ }
236
+ select:disabled {
237
+ opacity: 1;
238
+ }
239
+
240
+ [list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
241
+ display: none !important;
242
+ }
243
+
244
+ button,
245
+ [type=button],
246
+ [type=reset],
247
+ [type=submit] {
248
+ -webkit-appearance: button;
249
+ }
250
+ button:not(:disabled),
251
+ [type=button]:not(:disabled),
252
+ [type=reset]:not(:disabled),
253
+ [type=submit]:not(:disabled) {
254
+ cursor: pointer;
255
+ }
256
+
257
+ ::-moz-focus-inner {
258
+ padding: 0;
259
+ border-style: none;
260
+ }
261
+
262
+ textarea {
263
+ resize: vertical;
264
+ }
265
+
266
+ fieldset {
267
+ min-width: 0;
268
+ padding: 0;
269
+ margin: 0;
270
+ border: 0;
271
+ }
272
+
273
+ ::-webkit-datetime-edit-fields-wrapper,
274
+ ::-webkit-datetime-edit-text,
275
+ ::-webkit-datetime-edit-minute,
276
+ ::-webkit-datetime-edit-hour-field,
277
+ ::-webkit-datetime-edit-day-field,
278
+ ::-webkit-datetime-edit-month-field,
279
+ ::-webkit-datetime-edit-year-field {
280
+ padding: 0;
281
+ }
282
+
283
+ ::-webkit-inner-spin-button {
284
+ height: auto;
285
+ }
286
+
287
+ [type=search] {
288
+ outline-offset: -2px;
289
+ -webkit-appearance: textfield;
290
+ }
291
+
292
+ /* rtl:raw:
293
+ [type="tel"],
294
+ [type="url"],
295
+ [type="email"],
296
+ [type="number"] {
297
+ direction: ltr;
298
+ }
299
+ */
300
+ ::-webkit-search-decoration {
301
+ -webkit-appearance: none;
302
+ }
303
+
304
+ ::-webkit-color-swatch-wrapper {
305
+ padding: 0;
306
+ }
307
+
308
+ ::file-selector-button {
309
+ font: inherit;
310
+ -webkit-appearance: button;
311
+ }
312
+
313
+ output {
314
+ display: inline-block;
315
+ }
316
+
317
+ iframe {
318
+ border: 0;
319
+ }
320
+
321
+ summary {
322
+ display: list-item;
323
+ cursor: pointer;
324
+ }
325
+
326
+ progress {
327
+ vertical-align: baseline;
328
+ }
329
+
330
+ [hidden] {
331
+ display: none !important;
332
+ }
333
+
334
+ .visually-hidden,
335
+ .visually-hidden-focusable:not(:focus):not(:focus-within) {
336
+ position: absolute !important;
337
+ width: 1px !important;
338
+ height: 1px !important;
339
+ padding: 0 !important;
340
+ margin: -1px !important;
341
+ overflow: hidden !important;
342
+ clip: rect(0, 0, 0, 0) !important;
343
+ white-space: nowrap !important;
344
+ border: 0 !important;
345
+ }
346
+
347
+ :root {
348
+ --bs-form-control-height: 2.5rem;
349
+ --bs-form-control-spacing: var(--bs-spacing-xxs);
350
+ --bs-form-control-background-color: var(--bs-color-background-inverse);
351
+ --bs-form-control-border-color: var(--bs-color-border-secondary);
352
+ --bs-form-control-border-radius: var(--bs-radius-smooth);
353
+ --bs-form-control-placeholder-color: var(--bs-color-text-muted);
354
+ --bs-form-control-label-color: var(--bs-color-text-base);
355
+ --bs-form-control-text-color: var(--bs-color-text-secondary);
356
+ --bs-form-control-font-size: var(--bs-body-font-size);
357
+ --bs-form-group-spacing-y: var(--bs-spacing-m);
358
+ --bs-form-checkbox-border-color: var(--bs-color-border-secondary);
359
+ --bs-form-checkbox-border-radius: var(--bs-radius-smooth);
360
+ --bs-form-checked-color: var(--bs-color-background-primary);
361
+ }
362
+
363
+ input[readonly],
364
+ textarea[readonly],
365
+ select[readonly] {
366
+ --bs-form-control-border-color: var(--bs-color-border-subtle);
367
+ --bs-form-control-background-color: var(--bs-color-background-muted);
368
+ cursor: not-allowed;
369
+ }
370
+
371
+ input,
372
+ textarea,
373
+ select {
374
+ display: block;
375
+ width: 100%;
376
+ padding: var(--bs-form-control-spacing);
377
+ border: 1px solid var(--bs-form-control-border-color);
378
+ border-radius: var(--bs-form-control-border-radius);
379
+ background-color: var(--bs-form-control-background-color);
380
+ color: var(--bs-form-control-text-color);
381
+ font-size: var(--bs-form-control-font-size);
382
+ }
383
+ input.disabled, input:disabled,
384
+ textarea.disabled,
385
+ textarea:disabled,
386
+ select.disabled,
387
+ select:disabled {
388
+ border-color: var(--bs-color-border-disabled);
389
+ opacity: 1;
390
+ background-color: var(--bs-color-background-disabled);
391
+ color: var(--bs-color-text-disabled);
392
+ }
393
+
394
+ input:focus,
395
+ textarea:focus {
396
+ outline: 3px solid transparent;
397
+ outline-offset: 3px;
398
+ box-shadow: 0 0 0 2px var(--bs-color-border-inverse), 0 0 0 5px var(--bs-color-outline-focus) !important;
399
+ }
400
+
401
+ input::file-selector-button {
402
+ margin: -0.375rem -0.75rem;
403
+ padding: 0.375rem 0.75rem;
404
+ border-width: 0;
405
+ border-style: solid;
406
+ border-radius: 0;
407
+ border-color: inherit;
408
+ color: hsl(0, 0%, 10%);
409
+ pointer-events: none;
410
+ margin-inline-end: 0.75rem;
411
+ border-inline-end-width: 0;
412
+ background-color: hsl(0, 0%, 100%);
413
+ transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
414
+ }
415
+ @media (prefers-reduced-motion: reduce) {
416
+ input::file-selector-button {
417
+ transition: none;
418
+ }
419
+ }
420
+ input:hover:not(:disabled):not([readonly])::file-selector-button {
421
+ background-color: rgb(242.25, 242.25, 242.25);
422
+ }
423
+ input[type=file] {
424
+ overflow: hidden;
425
+ }
426
+ input[type=file]:not(:disabled):not([readonly]) {
427
+ cursor: pointer;
428
+ }
429
+ input::-webkit-date-and-time-value {
430
+ height: 1.5em;
431
+ }
432
+
433
+ select {
434
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='hsl%280, 0%, 15%%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
435
+ background-repeat: no-repeat;
436
+ background-position: right var(--bs-form-control-spacing) center;
437
+ background-size: 16px 12px;
438
+ appearance: none;
439
+ }
440
+ select:focus {
441
+ border-color: hsl(210, 17%, 44%);
442
+ outline: 0;
443
+ box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
444
+ }
445
+ select[multiple], select[size]:not([size="1"]) {
446
+ padding-right: 0.75rem;
447
+ background-image: none;
448
+ }
449
+ select:disabled {
450
+ background-color: hsl(0, 0%, 90%);
451
+ }
452
+ select:disabled:hover {
453
+ cursor: not-allowed;
454
+ }
455
+ select:-moz-focusring {
456
+ color: transparent;
457
+ text-shadow: 0 0 0 hsl(0, 0%, 10%);
458
+ }
459
+ select option {
460
+ font-weight: normal;
461
+ }
462
+ select:disabled {
463
+ opacity: 1;
464
+ background-color: hsl(210, 3%, 85%);
465
+ }
466
+
467
+ textarea {
468
+ height: auto;
469
+ font-size: var(--bs-body-font-size);
470
+ line-height: 1.5;
471
+ }
472
+
473
+ label {
474
+ display: inline-block;
475
+ width: auto;
476
+ max-width: 100%;
477
+ margin-bottom: var(--bs-spacing-xxs);
478
+ color: var(--bs-form-control-label-color);
479
+ font-size: var(--bs-label-font-size-s);
480
+ font-weight: var(--bs-font-weight-solid);
481
+ line-height: var(--bs-label-line-height);
482
+ }
483
+
484
+ input,
485
+ textarea {
486
+ outline: 0;
487
+ box-shadow: none;
488
+ transition: none;
489
+ appearance: none;
490
+ }
491
+
492
+ input[type=date],
493
+ input[type=datetime-local],
494
+ input[type=time] {
495
+ display: flex;
496
+ }
497
+
498
+ fieldset legend {
499
+ margin-bottom: var(--bs-spacing-s);
500
+ padding: 0 var(--bs-form-input-spacing-x);
501
+ background-color: transparent;
502
+ color: var(--bs-form-control-text-color);
503
+ font-size: var(--bs-label-sm);
504
+ font-weight: var(--bs-font-weight-solid);
505
+ }
506
+
507
+ ::placeholder {
508
+ color: var(--bs-form-control-placeholder-color);
509
+ }
510
+
511
+ input::-webkit-datetime-edit {
512
+ background-color: var(--bs-color-background-primary-lighter);
513
+ color: var(--bs-form-contro-text-color);
514
+ }
515
+
516
+ .form-group {
517
+ position: relative;
518
+ margin-bottom: var(--bs-form-group-spacing-y);
519
+ }
520
+ .form-group label.input-symbol-label:not(.active) {
521
+ left: 2.25rem;
522
+ }
523
+ .form-group small.form-text {
524
+ margin: 0;
525
+ font-size: 0.875rem;
526
+ }
527
+ .form-group input[type=time] ~ label {
528
+ font-size: 0.875rem;
529
+ }
530
+
531
+ .form-text {
532
+ margin: var(--bs-spacing-xxs) 0;
533
+ color: var(--bs-color-text-secondary);
534
+ }
535
+
536
+ .form-group.active .form-file-name {
537
+ padding-bottom: 1.95rem;
538
+ }
539
+
540
+ .warning-feedback {
541
+ display: none;
542
+ width: 100%;
543
+ margin-top: 0.25rem;
544
+ color: var(--bs-color-text-warning);
545
+ font-size: 0.75rem;
546
+ }
547
+
548
+ .valid-feedback,
549
+ .invalid-feedback,
550
+ .warning-feedback {
551
+ margin-left: 0.5rem;
552
+ }
553
+
554
+ .input-group .input-group-text .btn {
555
+ border-radius: var(--bs-form-control-border-radius) 0 0 var(--bs-form-control-border-radius);
556
+ }
557
+ .input-group .input-group-append {
558
+ margin-left: 0;
559
+ }
560
+ .input-group .input-group-append .btn {
561
+ height: 100%;
562
+ padding-top: 0;
563
+ padding-bottom: 0;
564
+ border-bottom: 1px solid hsl(210, 17%, 44%);
565
+ border-radius: 0 var(--bs-form-control-border-radius) var(--bs-form-control-border-radius) 0;
566
+ }
567
+
568
+ .form-check {
569
+ position: relative;
570
+ padding-left: 0;
571
+ align-items: center;
572
+ }
573
+ .form-check + .form-check {
574
+ margin-top: var(--bs-spacing-s);
575
+ }
576
+ .form-check [type=checkbox],
577
+ .form-check [type=radio] {
578
+ position: absolute;
579
+ height: 100%;
580
+ margin-top: 0;
581
+ margin-left: 0;
582
+ opacity: 0;
583
+ }
584
+ .form-check [type=checkbox] + label,
585
+ .form-check [type=radio] + label {
586
+ position: relative;
587
+ display: flex;
588
+ align-items: center;
589
+ padding-left: 28px;
590
+ font-size: var(--bs-label-font-size);
591
+ font-weight: var(--bs-font-weight-solid);
592
+ cursor: pointer;
593
+ margin-bottom: 0;
594
+ user-select: none;
595
+ }
596
+ @media (min-width: 576px) {
597
+ .form-check [type=checkbox] + label,
598
+ .form-check [type=radio] + label {
599
+ font-size: var(--bs-label-font-size-m);
600
+ }
601
+ }
602
+ .form-check input[type=checkbox] + label::after,
603
+ .form-check input[type=checkbox] + label::before {
604
+ position: absolute;
605
+ left: 0;
606
+ z-index: 1;
607
+ content: "";
608
+ border-width: 2px;
609
+ border-style: solid;
610
+ transition: all var(--bs-transition-instant) ease-out;
611
+ }
612
+ .form-check input[type=checkbox] + label::after {
613
+ top: 0;
614
+ width: 20px;
615
+ height: 20px;
616
+ border-radius: var(--bs-form-control-border-radius);
617
+ }
618
+ .form-check input[type=checkbox]:checked + label::before {
619
+ top: 3px;
620
+ left: 3px;
621
+ width: 6px;
622
+ height: 12px;
623
+ border-width: 2px;
624
+ border-style: solid;
625
+ border-color: transparent var(--bs-color-border-inverse) var(--bs-color-border-inverse) transparent;
626
+ opacity: 1;
627
+ transform: rotate(40deg);
628
+ transform-origin: 100% 100%;
629
+ backface-visibility: hidden;
630
+ }
631
+ .form-check input[type=checkbox]:checked + label::after {
632
+ z-index: 0;
633
+ border-color: var(--bs-form-checked-color);
634
+ background-color: var(--bs-form-checked-color);
635
+ }
636
+ .form-check input[type=checkbox]:not(:checked) + label::after {
637
+ z-index: 0;
638
+ border-color: var(--bs-form-checkbox-border-color);
639
+ background-color: transparent;
640
+ }
641
+ .form-check input[type=checkbox]:not(:checked) + label::before {
642
+ top: 10px;
643
+ left: 6px;
644
+ width: 0;
645
+ height: 0;
646
+ border-color: transparent;
647
+ }
648
+ .form-check input[type=checkbox]:disabled + label {
649
+ opacity: 1;
650
+ cursor: not-allowed;
651
+ }
652
+ .form-check input[type=checkbox]:disabled:not(:checked) + label::after {
653
+ border-color: var(--bs-color-border-disabled);
654
+ background-color: transparent;
655
+ }
656
+ .form-check input[type=checkbox]:disabled:checked + label::after {
657
+ border-color: var(--bs-color-border-disabled);
658
+ background-color: var(--bs-color-border-disabled);
659
+ }
660
+ .form-check input[type=radio] + label::after, .form-check input[type=radio] + label::before {
661
+ position: absolute;
662
+ top: 0;
663
+ left: 0;
664
+ z-index: 0;
665
+ content: "";
666
+ width: 20px;
667
+ height: 20px;
668
+ border-width: 2px;
669
+ border-style: solid;
670
+ border-radius: var(--bs-radius-rounded);
671
+ transition: all var(--bs-transition-instant) ease-out;
672
+ }
673
+ .form-check input[type=radio]:not(:checked) + label::after, .form-check input[type=radio]:not(:checked) + label::before {
674
+ border-color: var(--bs-form-checkbox-border-color);
675
+ }
676
+ .form-check input[type=radio]:not(:checked) + label:after {
677
+ z-index: -1;
678
+ transform: scale(0);
679
+ }
680
+ .form-check input[type=radio]:checked + label::after {
681
+ z-index: 0;
682
+ border-color: var(--bs-form-checked-color);
683
+ background-color: var(--bs-form-checked-color);
684
+ transform: scale(0.64);
685
+ }
686
+ .form-check input[type=radio]:checked + label::before {
687
+ border-color: var(--bs-form-checked-color);
688
+ }
689
+ .form-check input[type=radio]:disabled + label {
690
+ cursor: not-allowed;
691
+ }
692
+ .form-check input[type=radio]:disabled:not(:checked) + label::after, .form-check input[type=radio]:disabled:not(:checked) + label::before {
693
+ border-color: var(--bs-color-border-disabled);
694
+ }
695
+ .form-check input[type=radio]:disabled:checked + label::after {
696
+ border-color: var(--bs-color-border-disabled);
697
+ background-color: var(--bs-color-border-disabled);
698
+ }
699
+ .form-check input[type=radio]:disabled:checked + label::before {
700
+ border-color: var(--bs-color-border-disabled);
701
+ }
702
+ .form-check.form-check-group {
703
+ margin-bottom: 1rem;
704
+ padding: 0 0 1rem 0;
705
+ box-shadow: inset 0 -1px 0 0 rgba(1, 1, 1, 0.1);
706
+ }
707
+ .form-check.form-check-group input[type=checkbox] + label,
708
+ .form-check.form-check-group input[type=radio] + label {
709
+ padding-right: 3.25rem;
710
+ padding-left: 0;
711
+ }
712
+ .form-check.form-check-group input[type=checkbox] + label::after, .form-check.form-check-group input[type=checkbox] + label::before,
713
+ .form-check.form-check-group input[type=radio] + label::after,
714
+ .form-check.form-check-group input[type=radio] + label::before {
715
+ right: 0;
716
+ left: auto;
717
+ }
718
+ .form-check.form-check-group input[type=checkbox]:checked + label::before {
719
+ right: 11px;
720
+ }
721
+ .form-check.form-check-group input[type=radio]:checked + label::before {
722
+ right: 0;
723
+ }
724
+ .form-check.form-check-group .form-text {
725
+ display: block;
726
+ margin-bottom: 0.5rem;
727
+ padding-right: 3.25rem;
728
+ }
729
+ .form-check.form-check-group input.semi-checked:not(:checked) + label::before {
730
+ right: 4px;
731
+ left: auto;
732
+ }
733
+ .form-check input.semi-checked:not(:checked) + label::before {
734
+ top: 9px;
735
+ left: 4px;
736
+ width: 12px;
737
+ height: 2px;
738
+ border-width: 0;
739
+ border-style: none;
740
+ border-color: transparent;
741
+ opacity: 1;
742
+ background: var(--bs-color-background-inverse);
743
+ transform: none;
744
+ backface-visibility: hidden;
745
+ }
746
+ .form-check input.semi-checked:not(:checked) + label::after {
747
+ z-index: 0;
748
+ border-color: var(--bs-form-checked-color);
749
+ background-color: var(--bs-form-checked-color);
750
+ }
751
+
752
+ .form-check-inline {
753
+ display: inline-block;
754
+ }
755
+ .form-check-inline:not(:last-child) {
756
+ margin-right: var(--bs-spacing-m);
757
+ }
758
+
759
+ @media (prefers-reduced-motion: reduce) {
760
+ fieldset legend,
761
+ .form-group label,
762
+ textarea,
763
+ .form-check [type=checkbox],
764
+ .form-check [type=radio],
765
+ .form-check [type=checkbox] + label::after,
766
+ .form-check [type=checkbox] + label::before,
767
+ .form-check [type=radio] + label::after,
768
+ .form-check [type=radio] + label::before,
769
+ .toggles label input[type=checkbox] + .lever::before,
770
+ .toggles label input[type=checkbox] + .lever::after {
771
+ transition: none !important;
772
+ }
773
+ }
774
+ .form-check [type=checkbox]:focus + label,
775
+ .form-check [type=radio]:focus + label {
776
+ border-color: hsl(0, 0%, 0%) !important;
777
+ box-shadow: 0 0 0 2px var(--bs-color-border-inverse), 0 0 0 5px var(--bs-color-outline-focus) !important;
778
+ outline: 3px solid transparent !important;
779
+ outline-offset: 3px !important;
780
+ }
781
+
782
+ .form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
783
+ .form-check [type=radio]:focus[data-focus-mouse=true] + label {
784
+ border-color: inherit !important;
785
+ box-shadow: none !important;
786
+ outline: none !important;
787
+ }
788
+
789
+ .form-control-plaintext {
790
+ border: 0;
791
+ --bs-form-control-border-color: transparent;
792
+ --bs-form-control-border-radius: 0;
793
+ --bs-form-control-background-color: transparent;
794
+ --bs-form-control-spacing: 0;
795
+ }
796
+ .form-control-plaintext:focus {
797
+ outline: 0;
798
+ box-shadow: none !important;
799
+ }
800
+ .form-control-plaintext + label {
801
+ cursor: text;
802
+ }
803
+
804
+ .form-control {
805
+ background-repeat: no-repeat;
806
+ background-position: center right;
807
+ background-size: 45px 30%;
808
+ }
809
+ .form-control:disabled {
810
+ cursor: not-allowed;
811
+ background: var(--bs-color-background-disabled);
812
+ border: 0;
813
+ color: var(--bs-color-text-disabled);
814
+ }
815
+ .was-validated .form-control:valid, .form-control.is-valid {
816
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23008055' viewBox='0 0 192 512'%3E%3Cpath d='M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z'/%3E%3C/svg%3E");
817
+ }
818
+ .was-validated .form-control:invalid, .form-control.is-invalid {
819
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23cc334d' viewBox='0 0 384 512'%3E%3Cpath d='M231.6 256l130.1-130.1c4.7-4.7 4.7-12.3 0-17l-22.6-22.6c-4.7-4.7-12.3-4.7-17 0L192 216.4 61.9 86.3c-4.7-4.7-12.3-4.7-17 0l-22.6 22.6c-4.7 4.7-4.7 12.3 0 17L152.4 256 22.3 386.1c-4.7 4.7-4.7 12.3 0 17l22.6 22.6c4.7 4.7 12.3 4.7 17 0L192 295.6l130.1 130.1c4.7 4.7 12.3 4.7 17 0l22.6-22.6c4.7-4.7 4.7-12.3 0-17L231.6 256z'/%3E%3C/svg%3E");
820
+ border-color: var(--bs-color-border-danger);
821
+ }
822
+ .form-control.warning {
823
+ background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M2%2012C2%206.47715%206.47715%202%2012%202C14.6522%202%2017.1957%203.05357%2019.0711%204.92893C20.9464%206.8043%2022%209.34784%2022%2012C22%2017.5228%2017.5228%2022%2012%2022C6.47715%2022%202%2017.5228%202%2012ZM3%2012C3%2016.9706%207.02944%2021%2012%2021C16.9706%2021%2021%2016.9706%2021%2012C21%207.02944%2016.9706%203%2012%203C7.02944%203%203%207.02944%203%2012ZM11.5%2014.2V5.7H12.7V14.2H11.5ZM12.6%2018.3V16.5H11.4V18.3H12.6Z%22/%3E%0A%3C/svg%3E") no-repeat;
824
+ border-color: var(--bs-color-border-warning);
825
+ }
826
+ .form-control.is-valid ~ .warning-feedback {
827
+ display: block;
828
+ }
829
+
830
+ .form-control-sm {
831
+ --bs-form-control-spacing: var(--bs-spacing-xxs) var(--bs-spacing-3xs);
832
+ --bs-form-control-font-size: var(--bs-label-font-size);
833
+ }
834
+ .form-control-sm::file-selector-button {
835
+ padding: 0.25rem 0.5rem;
836
+ margin: -0.25rem -0.5rem;
837
+ margin-inline-end: 0.5rem;
838
+ }
839
+
840
+ .form-control-lg {
841
+ --bs-form-control-font-size: var(--bs-lead-font-size);
842
+ }
843
+ .form-control-lg::file-selector-button {
844
+ padding: 0.5rem 1rem;
845
+ margin: -0.5rem -1rem;
846
+ margin-inline-end: 1rem;
847
+ }
848
+
849
+ textarea.form-control {
850
+ min-height: 2.5rem;
851
+ border: 1px solid hsl(210, 17%, 44%);
852
+ }
853
+ textarea.form-control-sm {
854
+ min-height: calc(1.5em + 0.5rem);
855
+ }
856
+ textarea.form-control-lg {
857
+ min-height: calc(1.5em + 1rem);
858
+ }
859
+
860
+ .form-control-color {
861
+ width: 3rem;
862
+ height: 2.5rem;
863
+ padding: 0.375rem;
864
+ }
865
+ .form-control-color:not(:disabled):not([readonly]) {
866
+ cursor: pointer;
867
+ }
868
+ .form-control-color::-moz-color-swatch {
869
+ border: 0 !important;
870
+ border-radius: 0;
871
+ }
872
+ .form-control-color::-webkit-color-swatch {
873
+ border-radius: 0;
874
+ }
875
+ .form-control-color.form-control-sm {
876
+ height: calc(1.5em + 0.5rem);
877
+ }
878
+ .form-control-color.form-control-lg {
879
+ height: calc(1.5em + 1rem);
880
+ }
881
+
882
+ .form-check-reverse {
883
+ padding-right: 1.5em;
884
+ padding-left: 0;
885
+ text-align: right;
886
+ }
887
+ .form-check-reverse .form-check-input {
888
+ float: right;
889
+ margin-right: -1.5em;
890
+ margin-left: 0;
891
+ }
892
+
893
+ .form-check-input {
894
+ width: 1em;
895
+ height: 1em;
896
+ margin-top: 0.25em;
897
+ vertical-align: top;
898
+ background-color: hsl(0, 0%, 100%);
899
+ background-repeat: no-repeat;
900
+ background-position: center;
901
+ background-size: contain;
902
+ border: 1px solid rgba(0, 0, 0, 0.25);
903
+ appearance: none;
904
+ print-color-adjust: exact;
905
+ }
906
+ .form-check-input[type=checkbox] {
907
+ border-radius: 0.25em;
908
+ }
909
+ .form-check-input[type=radio] {
910
+ border-radius: 50%;
911
+ }
912
+ .form-check-input:active {
913
+ filter: brightness(90%);
914
+ }
915
+ .form-check-input:focus {
916
+ border-color: hsl(210, 17%, 44%);
917
+ outline: 0;
918
+ box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
919
+ }
920
+ .form-check-input:checked {
921
+ background-color: hsl(210, 100%, 40%);
922
+ border-color: hsl(210, 100%, 40%);
923
+ }
924
+ .form-check-input:checked[type=checkbox] {
925
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='hsl%280, 0%, 100%%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
926
+ }
927
+ .form-check-input:checked[type=radio] {
928
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='hsl%280, 0%, 100%%29'/%3e%3c/svg%3e");
929
+ }
930
+ .form-check-input[type=checkbox]:indeterminate {
931
+ background-color: hsl(210, 100%, 40%);
932
+ border-color: hsl(210, 100%, 40%);
933
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='hsl%280, 0%, 100%%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
934
+ }
935
+ .form-check-input:disabled {
936
+ pointer-events: none;
937
+ filter: none;
938
+ opacity: 0.5;
939
+ }
940
+ .form-check-input[disabled] ~ .form-check-label, .form-check-input:disabled ~ .form-check-label {
941
+ cursor: default;
942
+ opacity: 0.5;
943
+ }
944
+
945
+ .form-switch {
946
+ padding-left: 2.5em;
947
+ }
948
+ .form-switch .form-check-input {
949
+ width: 2em;
950
+ margin-left: -2.5em;
951
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
952
+ background-position: left center;
953
+ border-radius: 2em;
954
+ transition: background-position 0.15s ease-in-out;
955
+ }
956
+ @media (prefers-reduced-motion: reduce) {
957
+ .form-switch .form-check-input {
958
+ transition: none;
959
+ }
960
+ }
961
+ .form-switch .form-check-input:focus {
962
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='hsl%28210, 17%, 44%%29'/%3e%3c/svg%3e");
963
+ }
964
+ .form-switch .form-check-input:checked {
965
+ background-position: right center;
966
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='hsl%280, 0%, 100%%29'/%3e%3c/svg%3e");
967
+ }
968
+ .form-switch.form-check-reverse {
969
+ padding-right: 2.5em;
970
+ padding-left: 0;
971
+ }
972
+ .form-switch.form-check-reverse .form-check-input {
973
+ margin-right: -2.5em;
974
+ margin-left: 0;
975
+ }
976
+
977
+ .form-check-inline {
978
+ display: inline-block;
979
+ margin-right: 1rem;
980
+ }
981
+
982
+ .btn-check {
983
+ position: absolute;
984
+ clip: rect(0, 0, 0, 0);
985
+ pointer-events: none;
986
+ }
987
+ .btn-check[disabled] + .btn, .btn-check:disabled + .btn {
988
+ pointer-events: none;
989
+ filter: none;
990
+ opacity: 0.65;
991
+ }
992
+
993
+ .form-feedback {
994
+ width: 100%;
995
+ margin-top: 0.25rem;
996
+ font-size: 0.75rem;
997
+ }
998
+ .form-feedback.just-validate-error-label {
999
+ color: var(--bs-color-text-danger);
1000
+ }
1001
+
1002
+ .input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
1003
+ [data-focus-mouse=true]:not(.btn) ~ .input-group-text,
1004
+ button:has(~ [data-focus-mouse=true]:not(.btn)),
1005
+ [data-focus-mouse=true]:not(.btn) + button {
1006
+ border-color: inherit !important;
1007
+ box-shadow: none !important;
1008
+ outline: none !important;
1009
+ }
1010
+
1011
+ .input-group-text:has(~ .is-invalid),
1012
+ .is-invalid ~ .input-group-text,
1013
+ button:has(~ .is-invalid),
1014
+ .is-invalid + button {
1015
+ border-color: var(--bs-color-border-danger) !important;
1016
+ }
1017
+
1018
+ .sr-only-justvalidate-bi {
1019
+ display: none;
1020
+ }
1021
+
1022
+ .just-validate-success-field {
1023
+ border-color: var(--bs-color-border-success) !important;
1024
+ padding-right: calc(1.5em + 0.75rem) !important;
1025
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23008055' viewBox='0 0 192 512'%3E%3Cpath d='M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z'/%3E%3C/svg%3E");
1026
+ }
1027
+
1028
+ .input-group-text:has(~ .just-validate-success-field),
1029
+ .just-validate-success-field ~ .input-group-text,
1030
+ button:has(~ .just-validate-success-field),
1031
+ .just-validate-success-field + button {
1032
+ border-color: var(--bs-color-border-success);
1033
+ }
1034
+
1035
+ .just-validate-success-field + .input-group-text.align-buttons,
1036
+ .is-invalid + .input-group-text.align-buttons {
1037
+ right: 30px;
1038
+ }
1039
+
1040
+ .is-invalid + .input-group-text.align-buttons {
1041
+ bottom: 22px;
1042
+ }
1043
+
1044
+ .autocomplete__wrapper .form-feedback.just-validate-error-label {
1045
+ position: absolute;
1046
+ }
1047
+
1048
+ textarea.form-control {
1049
+ background-position: top 0.3em right 0.3em !important;
1050
+ background-size: 37px 30% !important;
1051
+ }
1052
+ textarea.is-invalid {
1053
+ border-bottom-style: solid;
1054
+ border-bottom-width: 1px;
1055
+ }
1056
+ textarea.just-validate-success-field {
1057
+ border-bottom-style: solid;
1058
+ border-bottom-width: 1px;
1059
+ }
1060
+
1061
+ input[type=checkbox].is-invalid,
1062
+ input[type=radio].is-invalid {
1063
+ --bs-form-checkbox-border-color: var(--bs-color-border-danger);
1064
+ }
1065
+
1066
+ select.is-invalid {
1067
+ border: 1px solid var(--bs-color-border-danger);
1068
+ }
1069
+ select.just-validate-success-field {
1070
+ border: 1px solid var(--bs-color-border-success);
1071
+ }
1072
+
1073
+ :host {
1074
+ display: block;
1075
+ margin-bottom: var(--bs-spacing-xs);
1076
+ box-shadow: none !important;
1077
+ -webkit-focus-ring-color: transparent; /* Chrome/Safari */
1078
+ outline: none !important;
1079
+ }
1080
+
1081
+ /* Mostra il ring sul controllo interno in questi casi:
1082
+ - host stesso è :focus-visible (keyboard)
1083
+ - host contiene il focus (qualunque elemento figlio sia focalizzato)
1084
+ - fallback: anche quando host ha semplicemente :focus (utile per alcuni casi) */
1085
+ :host(:focus-visible) .radio-control {
1086
+ box-shadow: 0 0 0 2px hsl(0, 0%, 100%), 0 0 0 5px hsl(0, 0%, 0%) !important;
1087
+ /* assicurati che il controllo non abbia outline propio che interferisca */
1088
+ outline: none;
1089
+ }
1090
+
1091
+ .radio-control {
1092
+ display: flex;
1093
+ width: fit-content;
1094
+ align-items: center;
1095
+ padding: var(--bs-form-input-padding-y) var(--bs-form-input-padding-x);
1096
+ cursor: pointer;
1097
+ }
1098
+
1099
+ .radio-control-label {
1100
+ display: block;
1101
+ width: 100%;
1102
+ color: var(--it-radio-label-color, var(--bs-form-control-label-color));
1103
+ font-size: var(--bs-label-sm);
1104
+ font-weight: var(--bs-font-weight-solid);
1105
+ }
1106
+ @media (min-width: 576px) {
1107
+ .radio-control-label {
1108
+ font-size: var(--bs-label-font-size-m);
1109
+ }
1110
+ }
1111
+
1112
+ .radio-control-grouped {
1113
+ width: 100%;
1114
+ flex-direction: row-reverse;
1115
+ }
1116
+
1117
+ :host([inline]) {
1118
+ display: inline-block;
1119
+ margin-right: 1rem;
1120
+ margin-bottom: 0;
1121
+ }
1122
+
1123
+ :host(:not([group])).form-check label {
1124
+ margin-bottom: var(--bs-spacing-xxs);
1125
+ }
1126
+
1127
+ #button {
1128
+ position: relative;
1129
+ display: inline-flex;
1130
+ width: 20px;
1131
+ height: 20px;
1132
+ flex-shrink: 0;
1133
+ border: none !important;
1134
+ margin-top: 0 !important;
1135
+ margin-right: 0.5rem;
1136
+ }
1137
+ #button::before {
1138
+ position: absolute;
1139
+ z-index: 0;
1140
+ top: 0;
1141
+ left: 0;
1142
+ width: 20px;
1143
+ height: 20px;
1144
+ border-width: 2px;
1145
+ border-style: solid;
1146
+ border-color: var(--bs-form-control-label-color);
1147
+ border-radius: var(--bs-radius-rounded);
1148
+ content: "";
1149
+ transition: all var(--bs-transition-instant) ease-out;
1150
+ }
1151
+ #button::after {
1152
+ position: absolute;
1153
+ z-index: -1;
1154
+ top: 0;
1155
+ left: 0;
1156
+ width: 20px;
1157
+ height: 20px;
1158
+ border-width: 0;
1159
+ border-style: solid;
1160
+ border-color: transparent;
1161
+ border-radius: var(--bs-radius-rounded);
1162
+ background-color: transparent;
1163
+ content: "";
1164
+ transform: scale(0);
1165
+ transition: all var(--bs-transition-instant) ease-out;
1166
+ }
1167
+
1168
+ :host(:not([aria-checked=true])) #button::before {
1169
+ border-color: var(--bs-form-checkbox-border-color);
1170
+ }
1171
+ :host(:not([aria-checked=true])) #button::after {
1172
+ z-index: -1;
1173
+ border-width: 0;
1174
+ border-color: transparent;
1175
+ background-color: transparent;
1176
+ transform: scale(0);
1177
+ }
1178
+
1179
+ :host([aria-checked=true]) #button::before {
1180
+ border-color: var(--bs-form-checked-color);
1181
+ }
1182
+ :host([aria-checked=true]) #button::after {
1183
+ z-index: 0;
1184
+ border-width: 2px;
1185
+ border-color: var(--bs-form-checked-color);
1186
+ background-color: var(--bs-form-checked-color);
1187
+ transform: scale(0.64);
1188
+ }
1189
+
1190
+ :host([aria-disabled=true]) .radio-control {
1191
+ cursor: not-allowed;
1192
+ }
1193
+ :host([aria-disabled=true]) #button::before,
1194
+ :host([aria-disabled=true]) #button::after {
1195
+ border-color: var(--bs-color-border-disabled);
1196
+ }
1197
+
1198
+ :host([aria-disabled=true][aria-checked=true]) #button::after {
1199
+ background-color: var(--bs-color-border-disabled);
1200
+ }
1201
+
1202
+ :host([aria-invalid=true]) #button::before, :host([aria-invalid=true]) #button::after {
1203
+ border-color: var(--bs-color-feedback-error);
1204
+ }
1205
+ :host([aria-invalid=true]) #button[aria-checked=true]::after {
1206
+ background-color: var(--bs-color-feedback-error);
1207
+ }
1208
+
1209
+ .form-text {
1210
+ display: block;
1211
+ margin-top: var(--bs-spacing-xxs);
1212
+ margin-bottom: 0;
1213
+ }`;
1214
+
1215
+ let ItRadio = class ItRadio extends BaseComponent {
1216
+ constructor() {
1217
+ super(...arguments);
1218
+ /** The radio's value attribute */
1219
+ this.value = '';
1220
+ /** Whether the radio is disabled */
1221
+ this.disabled = false;
1222
+ /** Draws the radio in a checked state. */
1223
+ this.checked = false;
1224
+ /** The input's help text. */
1225
+ this.supportText = '';
1226
+ /**
1227
+ * Internal reactive state synced from group
1228
+ * These replace the old getters that read from this.group
1229
+ */
1230
+ this._name = '';
1231
+ this._grouped = false;
1232
+ this._required = false;
1233
+ this._inline = false;
1234
+ /**
1235
+ * Handle keyup for Space key
1236
+ */
1237
+ this.handleKeyup = (event) => {
1238
+ if (event.code === 'Space') {
1239
+ event.preventDefault();
1240
+ this.activate(event);
1241
+ }
1242
+ };
1243
+ /**
1244
+ * Handle keydown - delegate arrow keys to the group
1245
+ */
1246
+ this.handleKeydown = (event) => {
1247
+ // Prevent Space from scrolling the page
1248
+ if (event.code === 'Space') {
1249
+ event.preventDefault();
1250
+ return;
1251
+ }
1252
+ // Let Tab and Shift+Tab work normally for navigation
1253
+ if (event.key === 'Tab') {
1254
+ this.group?.handleRadioKeyDown(this, event);
1255
+ return;
1256
+ }
1257
+ // Only prevent default for arrow keys (to prevent page scrolling)
1258
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {
1259
+ event.preventDefault();
1260
+ }
1261
+ // Delegate keyboard navigation to the group's public API
1262
+ this.group?.handleRadioKeyDown(this, event);
1263
+ };
1264
+ /**
1265
+ * Handle click on the host
1266
+ */
1267
+ this.handleClick = (event) => {
1268
+ this.activate(event);
1269
+ };
1270
+ }
1271
+ get label() {
1272
+ if (this.labelElements.length > 0) {
1273
+ return this.labelElements[0].innerText.trim();
1274
+ }
1275
+ return '';
1276
+ }
1277
+ get group() {
1278
+ return this.closest('it-radio-group');
1279
+ }
1280
+ // Public getters now read from internal state (reactive)
1281
+ get name() {
1282
+ return this._name || this.group?.name || '';
1283
+ }
1284
+ get grouped() {
1285
+ return this._grouped;
1286
+ }
1287
+ get required() {
1288
+ return this._required;
1289
+ }
1290
+ get inline() {
1291
+ return this._inline;
1292
+ }
1293
+ get invalid() {
1294
+ // Read aria-invalid explicitly from the group: only the string "true" should be considered invalid
1295
+ const aria = this.group?.getAttribute ? this.group.getAttribute('aria-invalid') : null;
1296
+ return aria === 'true';
1297
+ }
1298
+ /**
1299
+ * PUBLIC API: Called by group to sync state
1300
+ * This replaces the need for requestUpdate() calls
1301
+ */
1302
+ syncFromGroup(groupState) {
1303
+ if (groupState.name !== undefined)
1304
+ this._name = groupState.name;
1305
+ if (groupState.grouped !== undefined)
1306
+ this._grouped = groupState.grouped;
1307
+ if (groupState.required !== undefined)
1308
+ this._required = groupState.required;
1309
+ if (groupState.inline !== undefined)
1310
+ this._inline = groupState.inline;
1311
+ }
1312
+ /**
1313
+ * Activate the radio via the group's public API
1314
+ */
1315
+ activate(event) {
1316
+ if (this.checked || this.disabled) {
1317
+ return;
1318
+ }
1319
+ // Use the group's public API if available
1320
+ if (this.group) {
1321
+ this.group.selectRadio(this, event);
1322
+ }
1323
+ else {
1324
+ // Fallback if no group (shouldn't happen in normal usage)
1325
+ this.checked = true;
1326
+ }
1327
+ }
1328
+ connectedCallback() {
1329
+ super.connectedCallback?.();
1330
+ // Set role on host for screen reader context
1331
+ this.setAttribute('role', 'radio');
1332
+ // Set initial tabindex if not already set (roving tabindex will be managed by group)
1333
+ if (!this.hasAttribute('tabindex')) {
1334
+ this.tabIndex = 0;
1335
+ }
1336
+ // Add event listeners on host
1337
+ this.addEventListener('click', this.handleClick);
1338
+ this.addEventListener('keydown', this.handleKeydown, { capture: true });
1339
+ this.addEventListener('keyup', this.handleKeyup, { capture: true });
1340
+ }
1341
+ disconnectedCallback() {
1342
+ super.disconnectedCallback?.();
1343
+ this.removeEventListener('click', this.handleClick);
1344
+ this.removeEventListener('keydown', this.handleKeydown, { capture: true });
1345
+ this.removeEventListener('keyup', this.handleKeyup, { capture: true });
1346
+ }
1347
+ updated(changedProperties) {
1348
+ super.updated?.(changedProperties);
1349
+ // Update ARIA attributes on host
1350
+ if (changedProperties.has('checked')) {
1351
+ this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
1352
+ }
1353
+ if (changedProperties.has('disabled')) {
1354
+ if (this.disabled) {
1355
+ this.setAttribute('aria-disabled', 'true');
1356
+ }
1357
+ else {
1358
+ this.removeAttribute('aria-disabled');
1359
+ }
1360
+ }
1361
+ // Sync name attribute from internal state
1362
+ if (changedProperties.has('_name')) {
1363
+ if (this._name) {
1364
+ this.setAttribute('name', this._name);
1365
+ }
1366
+ else {
1367
+ this.removeAttribute('name');
1368
+ }
1369
+ }
1370
+ // Sync aria-required from internal state
1371
+ if (changedProperties.has('_required')) {
1372
+ if (this._required) {
1373
+ this.setAttribute('aria-required', 'true');
1374
+ }
1375
+ else {
1376
+ this.removeAttribute('aria-required');
1377
+ }
1378
+ }
1379
+ // logger
1380
+ if (!this.label) {
1381
+ this.logger.warn(`Label is required to ensure accessibility. Please, define a label for <it-radio/> .`);
1382
+ }
1383
+ }
1384
+ /**
1385
+ * Render internal structure (like Spectrum)
1386
+ * Just visual elements, no role/aria/events here (they're on the host)
1387
+ */
1388
+ // eslint-disable-next-line class-methods-use-this
1389
+ _renderInput() {
1390
+ // Render visual elements like Spectrum does
1391
+ // #input = container, #button = visual circle
1392
+ const inputRender = html `
1393
+ <div id="input" part="input"></div>
1394
+ <span id="button" part="button" class="form-check-input"></span>
1395
+ `;
1396
+ return inputRender;
1397
+ }
1398
+ // Render the UI as a function of component state
1399
+ render() {
1400
+ const supportTextId = `${this._id}-support-text`;
1401
+ const supportTextRender = html ` ${when(this.supportText, () => html `<slot name="helpText"><small class="form-text" id="${supportTextId}">${this.supportText}</small></slot>`)}`;
1402
+ const wrapperClasses = this.composeClass('form-check', this.inline && !this.grouped ? 'form-check-inline' : '', this.grouped && !this.inline ? 'form-check-group' : '');
1403
+ const ariaDescribedBy = this.composeClass(this.supportText?.length > 0 ? supportTextId : '', this._ariaAttributes['aria-describedby']?.length > 0 ? this._ariaAttributes['aria-describedby'] : '');
1404
+ const controlClasses = this.composeClass('radio-control', this.grouped ? 'radio-control-grouped' : '');
1405
+ const labelClasses = this.composeClass('radio-control-label', this.disabled ? 'disabled' : '');
1406
+ return html `
1407
+ <div class="${wrapperClasses}" part="input-wrapper" aria-describedby="${ifDefined(ariaDescribedBy || undefined)}">
1408
+ <div id="radio-control" part="radio-control" class="${controlClasses}">
1409
+ ${this._renderInput()}
1410
+ <span part="label" class="${labelClasses}"><slot name="label">${this.label}</slot></span>
1411
+ </div>
1412
+ ${supportTextRender}
1413
+ </div>
1414
+ `;
1415
+ }
1416
+ };
1417
+ ItRadio.styles = styles;
1418
+ __decorate([
1419
+ property({ type: String, reflect: true }),
1420
+ __metadata("design:type", Object)
1421
+ ], ItRadio.prototype, "value", void 0);
1422
+ __decorate([
1423
+ property({ type: Boolean, reflect: true }),
1424
+ __metadata("design:type", Object)
1425
+ ], ItRadio.prototype, "disabled", void 0);
1426
+ __decorate([
1427
+ property({ type: Boolean, reflect: true }),
1428
+ __metadata("design:type", Object)
1429
+ ], ItRadio.prototype, "checked", void 0);
1430
+ __decorate([
1431
+ property({ type: String, attribute: 'support-text' }),
1432
+ __metadata("design:type", Object)
1433
+ ], ItRadio.prototype, "supportText", void 0);
1434
+ __decorate([
1435
+ state(),
1436
+ __metadata("design:type", Object)
1437
+ ], ItRadio.prototype, "_name", void 0);
1438
+ __decorate([
1439
+ state(),
1440
+ __metadata("design:type", Object)
1441
+ ], ItRadio.prototype, "_grouped", void 0);
1442
+ __decorate([
1443
+ state(),
1444
+ __metadata("design:type", Object)
1445
+ ], ItRadio.prototype, "_required", void 0);
1446
+ __decorate([
1447
+ state(),
1448
+ __metadata("design:type", Object)
1449
+ ], ItRadio.prototype, "_inline", void 0);
1450
+ __decorate([
1451
+ queryAssignedElements({ slot: 'label' }),
1452
+ __metadata("design:type", Array)
1453
+ ], ItRadio.prototype, "labelElements", void 0);
1454
+ ItRadio = __decorate([
1455
+ customElement('it-radio')
1456
+ ], ItRadio);
1457
+
1458
+ export { ItRadio };
1459
+ //# sourceMappingURL=it-radio.js.map