@italia/radio 0.1.0-alpha.2 → 1.0.0-alpha.11
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/custom-elements.json +15 -57
- package/dist/src/index.js +2 -2
- package/dist/src/it-radio-group.d.ts +6 -11
- package/dist/src/it-radio-group.d.ts.map +1 -1
- package/dist/src/it-radio-group.js +149 -162
- package/dist/src/it-radio-group.js.map +1 -1
- package/dist/src/it-radio.d.ts +2 -1
- package/dist/src/it-radio.d.ts.map +1 -1
- package/dist/src/it-radio.js +144 -143
- package/dist/src/it-radio.js.map +1 -1
- package/package.json +8 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as __decorate, a as __metadata, F as FormControl, b as FormControlController } from '../
|
|
1
|
+
import { _ as __decorate, a as __metadata, F as FormControl, b as FormControlController } from '../index-C8PpsVmI.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
|
-
import { property, queryAssignedElements,
|
|
3
|
+
import { property, queryAssignedElements, customElement } from 'lit/decorators.js';
|
|
4
4
|
import 'lit/directive.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -24,6 +24,7 @@ class RovingTabindexController {
|
|
|
24
24
|
wrap: true,
|
|
25
25
|
direction: 'both',
|
|
26
26
|
selectOnFocus: false,
|
|
27
|
+
selectOnHomeEnd: false,
|
|
27
28
|
skipItem: (item) => item.hasAttribute('disabled') || item.disabled === true,
|
|
28
29
|
...config,
|
|
29
30
|
};
|
|
@@ -75,7 +76,7 @@ class RovingTabindexController {
|
|
|
75
76
|
* @returns true if the event was handled, false otherwise
|
|
76
77
|
*/
|
|
77
78
|
handleKeydown(currentItem, event) {
|
|
78
|
-
const
|
|
79
|
+
const direction = typeof this.config.direction === 'function' ? this.config.direction() : this.config.direction;
|
|
79
80
|
const { key } = event;
|
|
80
81
|
// Determine if this key should be handled based on direction
|
|
81
82
|
const isVertical = key === 'ArrowUp' || key === 'ArrowDown';
|
|
@@ -116,16 +117,21 @@ class RovingTabindexController {
|
|
|
116
117
|
nextIndex = this.getNextIndex(items, currentIndex, -1);
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
// Skip disabled items
|
|
120
|
-
|
|
120
|
+
// Skip disabled items — Home always searches forward, End always searches backward
|
|
121
|
+
// eslint-disable-next-line no-nested-ternary
|
|
122
|
+
const searchDirection = isHome ? 1 : isEnd ? -1 : nextIndex > currentIndex ? 1 : -1;
|
|
123
|
+
nextIndex = this.findNextValidIndex(items, nextIndex, searchDirection);
|
|
121
124
|
if (nextIndex !== -1 && nextIndex !== currentIndex) {
|
|
122
125
|
const nextItem = items[nextIndex];
|
|
123
126
|
// Update tabindices
|
|
124
127
|
this.updateTabindices(nextIndex);
|
|
125
128
|
// Focus the next item
|
|
126
129
|
nextItem.focus();
|
|
127
|
-
// Optionally select/activate the item
|
|
128
|
-
|
|
130
|
+
// Optionally select/activate the item.
|
|
131
|
+
// Select when `selectOnFocus` is enabled, or when Home/End keys
|
|
132
|
+
// were used and the consumer explicitly opted in via `selectOnHomeEnd`.
|
|
133
|
+
const shouldSelect = this.config.selectOnFocus === true || ((isHome || isEnd) && this.config.selectOnHomeEnd === true);
|
|
134
|
+
if (shouldSelect && this.config.onSelect) {
|
|
129
135
|
this.config.onSelect(nextItem, event);
|
|
130
136
|
}
|
|
131
137
|
return true;
|
|
@@ -219,7 +225,7 @@ var styles = css`/***************************** 1 ******************************
|
|
|
219
225
|
.form-check [type=checkbox]:focus + label,
|
|
220
226
|
.form-check [type=radio]:focus + label {
|
|
221
227
|
border-color: hsl(0, 0%, 0%) !important;
|
|
222
|
-
box-shadow: 0 0 0 2px var(--
|
|
228
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
223
229
|
outline: 3px solid transparent !important;
|
|
224
230
|
outline-offset: 3px !important;
|
|
225
231
|
}
|
|
@@ -259,7 +265,7 @@ hr {
|
|
|
259
265
|
|
|
260
266
|
p {
|
|
261
267
|
margin-top: 0;
|
|
262
|
-
margin-bottom: var(--
|
|
268
|
+
margin-bottom: var(--bsi-paragraph-spacing);
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
abbr[title] {
|
|
@@ -269,21 +275,21 @@ abbr[title] {
|
|
|
269
275
|
}
|
|
270
276
|
|
|
271
277
|
address {
|
|
272
|
-
margin-bottom: var(--
|
|
278
|
+
margin-bottom: var(--bsi-spacing-s);
|
|
273
279
|
font-style: normal;
|
|
274
280
|
line-height: inherit;
|
|
275
281
|
}
|
|
276
282
|
|
|
277
283
|
ol,
|
|
278
284
|
ul {
|
|
279
|
-
padding-left: var(--
|
|
285
|
+
padding-left: var(--bsi-spacing-l);
|
|
280
286
|
}
|
|
281
287
|
|
|
282
288
|
ol,
|
|
283
289
|
ul,
|
|
284
290
|
dl {
|
|
285
291
|
margin-top: 0;
|
|
286
|
-
margin-bottom: var(--
|
|
292
|
+
margin-bottom: var(--bsi-spacing-s);
|
|
287
293
|
}
|
|
288
294
|
|
|
289
295
|
ol ol,
|
|
@@ -294,22 +300,22 @@ ul ol {
|
|
|
294
300
|
}
|
|
295
301
|
|
|
296
302
|
dt {
|
|
297
|
-
font-weight: var(--
|
|
303
|
+
font-weight: var(--bsi-font-weight-strong);
|
|
298
304
|
}
|
|
299
305
|
|
|
300
306
|
dd {
|
|
301
|
-
margin-bottom: var(--
|
|
307
|
+
margin-bottom: var(--bsi-spacing-xxs);
|
|
302
308
|
margin-left: 0;
|
|
303
309
|
}
|
|
304
310
|
|
|
305
311
|
blockquote {
|
|
306
|
-
margin: 0 0 var(--
|
|
312
|
+
margin: 0 0 var(--bsi-spacing-s);
|
|
307
313
|
}
|
|
308
314
|
|
|
309
315
|
sub,
|
|
310
316
|
sup {
|
|
311
317
|
position: relative;
|
|
312
|
-
font-size: var(--
|
|
318
|
+
font-size: var(--bsi-font-size-1);
|
|
313
319
|
line-height: 0;
|
|
314
320
|
vertical-align: baseline;
|
|
315
321
|
}
|
|
@@ -323,18 +329,14 @@ sup {
|
|
|
323
329
|
}
|
|
324
330
|
|
|
325
331
|
a {
|
|
326
|
-
color: var(--
|
|
332
|
+
color: var(--bsi-color-link);
|
|
327
333
|
text-decoration: underline;
|
|
328
334
|
text-decoration-skip-ink: auto;
|
|
329
335
|
text-underline-offset: 2px;
|
|
330
336
|
}
|
|
331
337
|
a:hover {
|
|
332
|
-
color: var(--
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
|
336
|
-
color: inherit;
|
|
337
|
-
text-decoration: none;
|
|
338
|
+
color: var(--bsi-color-link-hover);
|
|
339
|
+
cursor: pointer;
|
|
338
340
|
}
|
|
339
341
|
|
|
340
342
|
pre,
|
|
@@ -347,7 +349,7 @@ samp {
|
|
|
347
349
|
pre {
|
|
348
350
|
display: block;
|
|
349
351
|
margin-top: 0;
|
|
350
|
-
margin-bottom: var(--
|
|
352
|
+
margin-bottom: var(--bsi-paragraph-spacing);
|
|
351
353
|
overflow: auto;
|
|
352
354
|
}
|
|
353
355
|
pre code {
|
|
@@ -542,26 +544,26 @@ progress {
|
|
|
542
544
|
}
|
|
543
545
|
|
|
544
546
|
:root {
|
|
545
|
-
--
|
|
546
|
-
--
|
|
547
|
-
--
|
|
548
|
-
--
|
|
549
|
-
--
|
|
550
|
-
--
|
|
551
|
-
--
|
|
552
|
-
--
|
|
553
|
-
--
|
|
554
|
-
--
|
|
555
|
-
--
|
|
556
|
-
--
|
|
557
|
-
--
|
|
547
|
+
--bsi-form-control-height: 2.5rem;
|
|
548
|
+
--bsi-form-control-spacing: var(--bsi-spacing-xxs);
|
|
549
|
+
--bsi-form-control-background-color: var(--bsi-color-background-inverse);
|
|
550
|
+
--bsi-form-control-border-color: var(--bsi-color-border-secondary);
|
|
551
|
+
--bsi-form-control-border-radius: var(--bsi-radius-smooth);
|
|
552
|
+
--bsi-form-control-placeholder-color: var(--bsi-color-text-muted);
|
|
553
|
+
--bsi-form-control-label-color: var(--bsi-color-text-base);
|
|
554
|
+
--bsi-form-control-text-color: var(--bsi-color-text-secondary);
|
|
555
|
+
--bsi-form-control-font-size: var(--bsi-body-font-size);
|
|
556
|
+
--bsi-form-group-spacing-y: var(--bsi-spacing-m);
|
|
557
|
+
--bsi-form-checkbox-border-color: var(--bsi-color-border-secondary);
|
|
558
|
+
--bsi-form-checkbox-border-radius: var(--bsi-radius-smooth);
|
|
559
|
+
--bsi-form-checked-color: var(--bsi-color-background-primary);
|
|
558
560
|
}
|
|
559
561
|
|
|
560
562
|
input[readonly],
|
|
561
563
|
textarea[readonly],
|
|
562
564
|
select[readonly] {
|
|
563
|
-
--
|
|
564
|
-
--
|
|
565
|
+
--bsi-form-control-border-color: var(--bsi-color-border-subtle);
|
|
566
|
+
--bsi-form-control-background-color: var(--bsi-color-background-muted);
|
|
565
567
|
cursor: not-allowed;
|
|
566
568
|
}
|
|
567
569
|
|
|
@@ -570,29 +572,30 @@ textarea,
|
|
|
570
572
|
select {
|
|
571
573
|
display: block;
|
|
572
574
|
width: 100%;
|
|
573
|
-
padding: var(--
|
|
574
|
-
border: 1px solid var(--
|
|
575
|
-
border-radius: var(--
|
|
576
|
-
background-color: var(--
|
|
577
|
-
color: var(--
|
|
578
|
-
font-size: var(--
|
|
575
|
+
padding: var(--bsi-form-control-spacing);
|
|
576
|
+
border: 1px solid var(--bsi-form-control-border-color);
|
|
577
|
+
border-radius: var(--bsi-form-control-border-radius);
|
|
578
|
+
background-color: var(--bsi-form-control-background-color);
|
|
579
|
+
color: var(--bsi-form-control-text-color);
|
|
580
|
+
font-size: var(--bsi-form-control-font-size);
|
|
579
581
|
}
|
|
580
582
|
input.disabled, input:disabled,
|
|
581
583
|
textarea.disabled,
|
|
582
584
|
textarea:disabled,
|
|
583
585
|
select.disabled,
|
|
584
586
|
select:disabled {
|
|
585
|
-
border-color: var(--
|
|
587
|
+
border-color: var(--bsi-color-border-disabled);
|
|
586
588
|
opacity: 1;
|
|
587
|
-
background-color: var(--
|
|
588
|
-
color: var(--
|
|
589
|
+
background-color: var(--bsi-color-background-disabled);
|
|
590
|
+
color: var(--bsi-color-text-disabled);
|
|
589
591
|
}
|
|
590
592
|
|
|
593
|
+
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
591
594
|
input:focus,
|
|
592
595
|
textarea:focus {
|
|
593
596
|
outline: 3px solid transparent;
|
|
594
597
|
outline-offset: 3px;
|
|
595
|
-
box-shadow: 0 0 0 2px var(--
|
|
598
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
596
599
|
}
|
|
597
600
|
|
|
598
601
|
input::file-selector-button {
|
|
@@ -630,7 +633,7 @@ input::-webkit-date-and-time-value {
|
|
|
630
633
|
select {
|
|
631
634
|
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");
|
|
632
635
|
background-repeat: no-repeat;
|
|
633
|
-
background-position: right var(--
|
|
636
|
+
background-position: right var(--bsi-form-control-spacing) center;
|
|
634
637
|
background-size: 16px 12px;
|
|
635
638
|
appearance: none;
|
|
636
639
|
}
|
|
@@ -656,6 +659,9 @@ select:-moz-focusring {
|
|
|
656
659
|
select option {
|
|
657
660
|
font-weight: normal;
|
|
658
661
|
}
|
|
662
|
+
select {
|
|
663
|
+
/* stylelint-disable-next-line no-duplicate-selectors */ /* TO DO check these styles */
|
|
664
|
+
}
|
|
659
665
|
select:disabled {
|
|
660
666
|
opacity: 1;
|
|
661
667
|
background-color: hsl(210, 3%, 85%);
|
|
@@ -663,7 +669,7 @@ select:disabled {
|
|
|
663
669
|
|
|
664
670
|
textarea {
|
|
665
671
|
height: auto;
|
|
666
|
-
font-size: var(--
|
|
672
|
+
font-size: var(--bsi-body-font-size);
|
|
667
673
|
line-height: 1.5;
|
|
668
674
|
}
|
|
669
675
|
|
|
@@ -671,13 +677,14 @@ label {
|
|
|
671
677
|
display: inline-block;
|
|
672
678
|
width: auto;
|
|
673
679
|
max-width: 100%;
|
|
674
|
-
margin-bottom: var(--
|
|
675
|
-
color: var(--
|
|
676
|
-
font-size: var(--
|
|
677
|
-
font-weight: var(--
|
|
678
|
-
line-height: var(--
|
|
680
|
+
margin-bottom: var(--bsi-spacing-xxs);
|
|
681
|
+
color: var(--bsi-form-control-label-color);
|
|
682
|
+
font-size: var(--bsi-label-font-size-s);
|
|
683
|
+
font-weight: var(--bsi-font-weight-solid);
|
|
684
|
+
line-height: var(--bsi-label-leading);
|
|
679
685
|
}
|
|
680
686
|
|
|
687
|
+
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
681
688
|
input,
|
|
682
689
|
textarea {
|
|
683
690
|
outline: 0;
|
|
@@ -693,26 +700,26 @@ input[type=time] {
|
|
|
693
700
|
}
|
|
694
701
|
|
|
695
702
|
fieldset legend {
|
|
696
|
-
margin-bottom: var(--
|
|
697
|
-
padding: 0 var(--
|
|
703
|
+
margin-bottom: var(--bsi-spacing-s);
|
|
704
|
+
padding: 0 var(--bsi-form-input-spacing-x);
|
|
698
705
|
background-color: transparent;
|
|
699
|
-
color: var(--
|
|
700
|
-
font-size: var(--
|
|
701
|
-
font-weight: var(--
|
|
706
|
+
color: var(--bsi-form-control-text-color);
|
|
707
|
+
font-size: var(--bsi-label-font-size-s);
|
|
708
|
+
font-weight: var(--bsi-font-weight-solid);
|
|
702
709
|
}
|
|
703
710
|
|
|
704
711
|
::placeholder {
|
|
705
|
-
color: var(--
|
|
712
|
+
color: var(--bsi-form-control-placeholder-color);
|
|
706
713
|
}
|
|
707
714
|
|
|
708
715
|
input::-webkit-datetime-edit {
|
|
709
|
-
background-color: var(--
|
|
710
|
-
color: var(--
|
|
716
|
+
background-color: var(--bsi-color-background-primary-lighter);
|
|
717
|
+
color: var(--bsi-form-contro-text-color);
|
|
711
718
|
}
|
|
712
719
|
|
|
713
720
|
.form-group {
|
|
714
721
|
position: relative;
|
|
715
|
-
margin-bottom: var(--
|
|
722
|
+
margin-bottom: var(--bsi-form-group-spacing-y);
|
|
716
723
|
}
|
|
717
724
|
.form-group label.input-symbol-label:not(.active) {
|
|
718
725
|
left: 2.25rem;
|
|
@@ -726,8 +733,8 @@ input::-webkit-datetime-edit {
|
|
|
726
733
|
}
|
|
727
734
|
|
|
728
735
|
.form-text {
|
|
729
|
-
margin: var(--
|
|
730
|
-
color: var(--
|
|
736
|
+
margin: var(--bsi-spacing-xxs) 0;
|
|
737
|
+
color: var(--bsi-color-text-secondary);
|
|
731
738
|
}
|
|
732
739
|
|
|
733
740
|
.form-group.active .form-file-name {
|
|
@@ -738,7 +745,7 @@ input::-webkit-datetime-edit {
|
|
|
738
745
|
display: none;
|
|
739
746
|
width: 100%;
|
|
740
747
|
margin-top: 0.25rem;
|
|
741
|
-
color: var(--
|
|
748
|
+
color: var(--bsi-color-text-warning);
|
|
742
749
|
font-size: 0.75rem;
|
|
743
750
|
}
|
|
744
751
|
|
|
@@ -749,7 +756,7 @@ input::-webkit-datetime-edit {
|
|
|
749
756
|
}
|
|
750
757
|
|
|
751
758
|
.input-group .input-group-text .btn {
|
|
752
|
-
border-radius: var(--
|
|
759
|
+
border-radius: var(--bsi-form-control-border-radius) 0 0 var(--bsi-form-control-border-radius);
|
|
753
760
|
}
|
|
754
761
|
.input-group .input-group-append {
|
|
755
762
|
margin-left: 0;
|
|
@@ -759,21 +766,21 @@ input::-webkit-datetime-edit {
|
|
|
759
766
|
padding-top: 0;
|
|
760
767
|
padding-bottom: 0;
|
|
761
768
|
border-bottom: 1px solid hsl(210, 17%, 44%);
|
|
762
|
-
border-radius: 0 var(--
|
|
769
|
+
border-radius: 0 var(--bsi-form-control-border-radius) var(--bsi-form-control-border-radius) 0;
|
|
763
770
|
}
|
|
764
771
|
|
|
765
772
|
.form-check {
|
|
766
773
|
position: relative;
|
|
767
|
-
padding-left: 0;
|
|
768
|
-
align-items: center;
|
|
769
774
|
}
|
|
770
775
|
.form-check + .form-check {
|
|
771
|
-
margin-top: var(--
|
|
776
|
+
margin-top: var(--bsi-spacing-s);
|
|
772
777
|
}
|
|
773
778
|
.form-check [type=checkbox],
|
|
774
779
|
.form-check [type=radio] {
|
|
775
780
|
position: absolute;
|
|
776
|
-
|
|
781
|
+
top: 9px;
|
|
782
|
+
left: 9px;
|
|
783
|
+
width: auto;
|
|
777
784
|
margin-top: 0;
|
|
778
785
|
margin-left: 0;
|
|
779
786
|
opacity: 0;
|
|
@@ -781,19 +788,17 @@ input::-webkit-datetime-edit {
|
|
|
781
788
|
.form-check [type=checkbox] + label,
|
|
782
789
|
.form-check [type=radio] + label {
|
|
783
790
|
position: relative;
|
|
784
|
-
|
|
785
|
-
align-items: center;
|
|
791
|
+
margin-bottom: 0;
|
|
786
792
|
padding-left: 28px;
|
|
787
|
-
font-size: var(--
|
|
788
|
-
font-weight: var(--
|
|
793
|
+
font-size: var(--bsi-label-font-size);
|
|
794
|
+
font-weight: var(--bsi-font-weight-solid);
|
|
789
795
|
cursor: pointer;
|
|
790
|
-
margin-bottom: 0;
|
|
791
796
|
user-select: none;
|
|
792
797
|
}
|
|
793
798
|
@media (min-width: 576px) {
|
|
794
799
|
.form-check [type=checkbox] + label,
|
|
795
800
|
.form-check [type=radio] + label {
|
|
796
|
-
font-size: var(--
|
|
801
|
+
font-size: var(--bsi-label-font-size-l);
|
|
797
802
|
}
|
|
798
803
|
}
|
|
799
804
|
.form-check input[type=checkbox] + label::after,
|
|
@@ -804,13 +809,13 @@ input::-webkit-datetime-edit {
|
|
|
804
809
|
content: "";
|
|
805
810
|
border-width: 2px;
|
|
806
811
|
border-style: solid;
|
|
807
|
-
transition: all var(--
|
|
812
|
+
transition: all var(--bsi-transition-instant) ease-out;
|
|
808
813
|
}
|
|
809
814
|
.form-check input[type=checkbox] + label::after {
|
|
810
815
|
top: 0;
|
|
811
816
|
width: 20px;
|
|
812
817
|
height: 20px;
|
|
813
|
-
border-radius: var(--
|
|
818
|
+
border-radius: var(--bsi-form-control-border-radius);
|
|
814
819
|
}
|
|
815
820
|
.form-check input[type=checkbox]:checked + label::before {
|
|
816
821
|
top: 3px;
|
|
@@ -819,7 +824,7 @@ input::-webkit-datetime-edit {
|
|
|
819
824
|
height: 12px;
|
|
820
825
|
border-width: 2px;
|
|
821
826
|
border-style: solid;
|
|
822
|
-
border-color: transparent var(--
|
|
827
|
+
border-color: transparent var(--bsi-color-border-inverse) var(--bsi-color-border-inverse) transparent;
|
|
823
828
|
opacity: 1;
|
|
824
829
|
transform: rotate(40deg);
|
|
825
830
|
transform-origin: 100% 100%;
|
|
@@ -827,12 +832,12 @@ input::-webkit-datetime-edit {
|
|
|
827
832
|
}
|
|
828
833
|
.form-check input[type=checkbox]:checked + label::after {
|
|
829
834
|
z-index: 0;
|
|
830
|
-
border-color: var(--
|
|
831
|
-
background-color: var(--
|
|
835
|
+
border-color: var(--bsi-form-checked-color);
|
|
836
|
+
background-color: var(--bsi-form-checked-color);
|
|
832
837
|
}
|
|
833
838
|
.form-check input[type=checkbox]:not(:checked) + label::after {
|
|
834
839
|
z-index: 0;
|
|
835
|
-
border-color: var(--
|
|
840
|
+
border-color: var(--bsi-form-checkbox-border-color);
|
|
836
841
|
background-color: transparent;
|
|
837
842
|
}
|
|
838
843
|
.form-check input[type=checkbox]:not(:checked) + label::before {
|
|
@@ -847,12 +852,12 @@ input::-webkit-datetime-edit {
|
|
|
847
852
|
cursor: not-allowed;
|
|
848
853
|
}
|
|
849
854
|
.form-check input[type=checkbox]:disabled:not(:checked) + label::after {
|
|
850
|
-
border-color: var(--
|
|
855
|
+
border-color: var(--bsi-color-border-disabled);
|
|
851
856
|
background-color: transparent;
|
|
852
857
|
}
|
|
853
858
|
.form-check input[type=checkbox]:disabled:checked + label::after {
|
|
854
|
-
border-color: var(--
|
|
855
|
-
background-color: var(--
|
|
859
|
+
border-color: var(--bsi-color-border-disabled);
|
|
860
|
+
background-color: var(--bsi-color-border-disabled);
|
|
856
861
|
}
|
|
857
862
|
.form-check input[type=radio] + label::after, .form-check input[type=radio] + label::before {
|
|
858
863
|
position: absolute;
|
|
@@ -864,11 +869,11 @@ input::-webkit-datetime-edit {
|
|
|
864
869
|
height: 20px;
|
|
865
870
|
border-width: 2px;
|
|
866
871
|
border-style: solid;
|
|
867
|
-
border-radius: var(--
|
|
868
|
-
transition: all var(--
|
|
872
|
+
border-radius: var(--bsi-radius-rounded);
|
|
873
|
+
transition: all var(--bsi-transition-instant) ease-out;
|
|
869
874
|
}
|
|
870
875
|
.form-check input[type=radio]:not(:checked) + label::after, .form-check input[type=radio]:not(:checked) + label::before {
|
|
871
|
-
border-color: var(--
|
|
876
|
+
border-color: var(--bsi-form-checkbox-border-color);
|
|
872
877
|
}
|
|
873
878
|
.form-check input[type=radio]:not(:checked) + label:after {
|
|
874
879
|
z-index: -1;
|
|
@@ -876,25 +881,30 @@ input::-webkit-datetime-edit {
|
|
|
876
881
|
}
|
|
877
882
|
.form-check input[type=radio]:checked + label::after {
|
|
878
883
|
z-index: 0;
|
|
879
|
-
border-color: var(--
|
|
880
|
-
background-color: var(--
|
|
884
|
+
border-color: var(--bsi-form-checked-color);
|
|
885
|
+
background-color: var(--bsi-form-checked-color);
|
|
881
886
|
transform: scale(0.64);
|
|
882
887
|
}
|
|
883
888
|
.form-check input[type=radio]:checked + label::before {
|
|
884
|
-
border-color: var(--
|
|
889
|
+
border-color: var(--bsi-form-checked-color);
|
|
885
890
|
}
|
|
886
891
|
.form-check input[type=radio]:disabled + label {
|
|
887
892
|
cursor: not-allowed;
|
|
888
893
|
}
|
|
889
894
|
.form-check input[type=radio]:disabled:not(:checked) + label::after, .form-check input[type=radio]:disabled:not(:checked) + label::before {
|
|
890
|
-
border-color: var(--
|
|
895
|
+
border-color: var(--bsi-color-border-disabled);
|
|
891
896
|
}
|
|
892
897
|
.form-check input[type=radio]:disabled:checked + label::after {
|
|
893
|
-
border-color: var(--
|
|
894
|
-
background-color: var(--
|
|
898
|
+
border-color: var(--bsi-color-border-disabled);
|
|
899
|
+
background-color: var(--bsi-color-border-disabled);
|
|
895
900
|
}
|
|
896
901
|
.form-check input[type=radio]:disabled:checked + label::before {
|
|
897
|
-
border-color: var(--
|
|
902
|
+
border-color: var(--bsi-color-border-disabled);
|
|
903
|
+
}
|
|
904
|
+
.form-check .form-text {
|
|
905
|
+
display: block;
|
|
906
|
+
margin-bottom: 0.5rem;
|
|
907
|
+
padding-right: 3.25rem;
|
|
898
908
|
}
|
|
899
909
|
.form-check.form-check-group {
|
|
900
910
|
margin-bottom: 1rem;
|
|
@@ -903,6 +913,7 @@ input::-webkit-datetime-edit {
|
|
|
903
913
|
}
|
|
904
914
|
.form-check.form-check-group input[type=checkbox] + label,
|
|
905
915
|
.form-check.form-check-group input[type=radio] + label {
|
|
916
|
+
position: static;
|
|
906
917
|
padding-right: 3.25rem;
|
|
907
918
|
padding-left: 0;
|
|
908
919
|
}
|
|
@@ -918,17 +929,12 @@ input::-webkit-datetime-edit {
|
|
|
918
929
|
.form-check.form-check-group input[type=radio]:checked + label::before {
|
|
919
930
|
right: 0;
|
|
920
931
|
}
|
|
921
|
-
.form-check.form-check-group .form-text {
|
|
922
|
-
display: block;
|
|
923
|
-
margin-bottom: 0.5rem;
|
|
924
|
-
padding-right: 3.25rem;
|
|
925
|
-
}
|
|
926
932
|
.form-check.form-check-group input.semi-checked:not(:checked) + label::before {
|
|
927
933
|
right: 4px;
|
|
928
934
|
left: auto;
|
|
929
935
|
}
|
|
930
936
|
.form-check input.semi-checked:not(:checked) + label::before {
|
|
931
|
-
top:
|
|
937
|
+
top: 12px;
|
|
932
938
|
left: 4px;
|
|
933
939
|
width: 12px;
|
|
934
940
|
height: 2px;
|
|
@@ -936,21 +942,21 @@ input::-webkit-datetime-edit {
|
|
|
936
942
|
border-style: none;
|
|
937
943
|
border-color: transparent;
|
|
938
944
|
opacity: 1;
|
|
939
|
-
background: var(--
|
|
945
|
+
background: var(--bsi-color-background-inverse);
|
|
940
946
|
transform: none;
|
|
941
947
|
backface-visibility: hidden;
|
|
942
948
|
}
|
|
943
949
|
.form-check input.semi-checked:not(:checked) + label::after {
|
|
944
950
|
z-index: 0;
|
|
945
|
-
border-color: var(--
|
|
946
|
-
background-color: var(--
|
|
951
|
+
border-color: var(--bsi-form-checked-color);
|
|
952
|
+
background-color: var(--bsi-form-checked-color);
|
|
947
953
|
}
|
|
948
954
|
|
|
949
955
|
.form-check-inline {
|
|
950
956
|
display: inline-block;
|
|
951
957
|
}
|
|
952
958
|
.form-check-inline:not(:last-child) {
|
|
953
|
-
margin-right: var(--
|
|
959
|
+
margin-right: var(--bsi-spacing-m);
|
|
954
960
|
}
|
|
955
961
|
|
|
956
962
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -971,7 +977,7 @@ input::-webkit-datetime-edit {
|
|
|
971
977
|
.form-check [type=checkbox]:focus + label,
|
|
972
978
|
.form-check [type=radio]:focus + label {
|
|
973
979
|
border-color: hsl(0, 0%, 0%) !important;
|
|
974
|
-
box-shadow: 0 0 0 2px var(--
|
|
980
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
975
981
|
outline: 3px solid transparent !important;
|
|
976
982
|
outline-offset: 3px !important;
|
|
977
983
|
}
|
|
@@ -985,10 +991,10 @@ input::-webkit-datetime-edit {
|
|
|
985
991
|
|
|
986
992
|
.form-control-plaintext {
|
|
987
993
|
border: 0;
|
|
988
|
-
--
|
|
989
|
-
--
|
|
990
|
-
--
|
|
991
|
-
--
|
|
994
|
+
--bsi-form-control-border-color: transparent;
|
|
995
|
+
--bsi-form-control-border-radius: 0;
|
|
996
|
+
--bsi-form-control-background-color: transparent;
|
|
997
|
+
--bsi-form-control-spacing: 0;
|
|
992
998
|
}
|
|
993
999
|
.form-control-plaintext:focus {
|
|
994
1000
|
outline: 0;
|
|
@@ -1005,28 +1011,28 @@ input::-webkit-datetime-edit {
|
|
|
1005
1011
|
}
|
|
1006
1012
|
.form-control:disabled {
|
|
1007
1013
|
cursor: not-allowed;
|
|
1008
|
-
background: var(--
|
|
1014
|
+
background: var(--bsi-color-background-disabled);
|
|
1009
1015
|
border: 0;
|
|
1010
|
-
color: var(--
|
|
1016
|
+
color: var(--bsi-color-text-disabled);
|
|
1011
1017
|
}
|
|
1012
1018
|
.was-validated .form-control:valid, .form-control.is-valid {
|
|
1013
1019
|
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");
|
|
1014
1020
|
}
|
|
1015
1021
|
.was-validated .form-control:invalid, .form-control.is-invalid {
|
|
1016
1022
|
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");
|
|
1017
|
-
border-color: var(--
|
|
1023
|
+
border-color: var(--bsi-color-border-danger);
|
|
1018
1024
|
}
|
|
1019
1025
|
.form-control.warning {
|
|
1020
1026
|
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;
|
|
1021
|
-
border-color: var(--
|
|
1027
|
+
border-color: var(--bsi-color-border-warning);
|
|
1022
1028
|
}
|
|
1023
1029
|
.form-control.is-valid ~ .warning-feedback {
|
|
1024
1030
|
display: block;
|
|
1025
1031
|
}
|
|
1026
1032
|
|
|
1027
1033
|
.form-control-sm {
|
|
1028
|
-
--
|
|
1029
|
-
--
|
|
1034
|
+
--bsi-form-control-spacing: var(--bsi-spacing-xxs) var(--bsi-spacing-3xs);
|
|
1035
|
+
--bsi-form-control-font-size: var(--bsi-label-font-size);
|
|
1030
1036
|
}
|
|
1031
1037
|
.form-control-sm::file-selector-button {
|
|
1032
1038
|
padding: 0.25rem 0.5rem;
|
|
@@ -1035,7 +1041,7 @@ input::-webkit-datetime-edit {
|
|
|
1035
1041
|
}
|
|
1036
1042
|
|
|
1037
1043
|
.form-control-lg {
|
|
1038
|
-
--
|
|
1044
|
+
--bsi-form-control-font-size: var(--bsi-lead-font-size);
|
|
1039
1045
|
}
|
|
1040
1046
|
.form-control-lg::file-selector-button {
|
|
1041
1047
|
padding: 0.5rem 1rem;
|
|
@@ -1193,7 +1199,7 @@ textarea.form-control-lg {
|
|
|
1193
1199
|
font-size: 0.75rem;
|
|
1194
1200
|
}
|
|
1195
1201
|
.form-feedback.just-validate-error-label {
|
|
1196
|
-
color: var(--
|
|
1202
|
+
color: var(--bsi-color-text-danger);
|
|
1197
1203
|
}
|
|
1198
1204
|
|
|
1199
1205
|
.input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
|
|
@@ -1209,7 +1215,7 @@ button:has(~ [data-focus-mouse=true]:not(.btn)),
|
|
|
1209
1215
|
.is-invalid ~ .input-group-text,
|
|
1210
1216
|
button:has(~ .is-invalid),
|
|
1211
1217
|
.is-invalid + button {
|
|
1212
|
-
border-color: var(--
|
|
1218
|
+
border-color: var(--bsi-color-border-danger) !important;
|
|
1213
1219
|
}
|
|
1214
1220
|
|
|
1215
1221
|
.sr-only-justvalidate-bi {
|
|
@@ -1217,7 +1223,7 @@ button:has(~ .is-invalid),
|
|
|
1217
1223
|
}
|
|
1218
1224
|
|
|
1219
1225
|
.just-validate-success-field {
|
|
1220
|
-
border-color: var(--
|
|
1226
|
+
border-color: var(--bsi-color-border-success) !important;
|
|
1221
1227
|
padding-right: calc(1.5em + 0.75rem) !important;
|
|
1222
1228
|
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");
|
|
1223
1229
|
}
|
|
@@ -1226,7 +1232,7 @@ button:has(~ .is-invalid),
|
|
|
1226
1232
|
.just-validate-success-field ~ .input-group-text,
|
|
1227
1233
|
button:has(~ .just-validate-success-field),
|
|
1228
1234
|
.just-validate-success-field + button {
|
|
1229
|
-
border-color: var(--
|
|
1235
|
+
border-color: var(--bsi-color-border-success);
|
|
1230
1236
|
}
|
|
1231
1237
|
|
|
1232
1238
|
.just-validate-success-field + .input-group-text.align-buttons,
|
|
@@ -1257,45 +1263,39 @@ textarea.just-validate-success-field {
|
|
|
1257
1263
|
|
|
1258
1264
|
input[type=checkbox].is-invalid,
|
|
1259
1265
|
input[type=radio].is-invalid {
|
|
1260
|
-
--
|
|
1266
|
+
--bsi-form-checkbox-border-color: var(--bsi-color-border-danger);
|
|
1261
1267
|
}
|
|
1262
1268
|
|
|
1263
1269
|
select.is-invalid {
|
|
1264
|
-
border: 1px solid var(--
|
|
1270
|
+
border: 1px solid var(--bsi-color-border-danger);
|
|
1265
1271
|
}
|
|
1266
1272
|
select.just-validate-success-field {
|
|
1267
|
-
border: 1px solid var(--
|
|
1273
|
+
border: 1px solid var(--bsi-color-border-success);
|
|
1268
1274
|
}
|
|
1269
1275
|
|
|
1270
1276
|
::slotted([slot=label]) {
|
|
1271
1277
|
display: block;
|
|
1272
|
-
padding: 0 var(--
|
|
1273
|
-
margin-bottom: var(--
|
|
1278
|
+
padding: 0 var(--bsi-form-input-spacing-x);
|
|
1279
|
+
margin-bottom: var(--bsi-spacing-s);
|
|
1274
1280
|
background-color: rgba(0, 0, 0, 0);
|
|
1275
|
-
color: var(--
|
|
1276
|
-
font-size: var(--
|
|
1277
|
-
font-weight: var(--
|
|
1281
|
+
color: var(--bsi-form-control-text-color);
|
|
1282
|
+
font-size: var(--bsi-label-sm);
|
|
1283
|
+
font-weight: var(--bsi-font-weight-solid);
|
|
1278
1284
|
}
|
|
1279
1285
|
|
|
1280
1286
|
.it-radio-group {
|
|
1281
|
-
margin-bottom: var(--
|
|
1287
|
+
margin-bottom: var(--bsi-spacing-xs);
|
|
1282
1288
|
}
|
|
1283
1289
|
|
|
1284
1290
|
.it-radio-group-inline {
|
|
1285
1291
|
display: flex;
|
|
1286
1292
|
flex-wrap: wrap;
|
|
1287
1293
|
align-items: center;
|
|
1288
|
-
gap: var(--
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
.just-validate-success-field ::slotted(it-radio) {
|
|
1292
|
-
--it-radio-label-color: var(--bs-color-text-success);
|
|
1294
|
+
gap: var(--bsi-spacing-s);
|
|
1293
1295
|
}
|
|
1294
1296
|
|
|
1295
|
-
.
|
|
1296
|
-
|
|
1297
|
-
border: none !important;
|
|
1298
|
-
background-image: none !important;
|
|
1297
|
+
.form-feedaback {
|
|
1298
|
+
font-weight: bold;
|
|
1299
1299
|
}`;
|
|
1300
1300
|
|
|
1301
1301
|
/**
|
|
@@ -1332,11 +1332,6 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1332
1332
|
* Whether the radios are displayed inline (horizontally) or stacked (vertically)
|
|
1333
1333
|
*/
|
|
1334
1334
|
this.inline = false;
|
|
1335
|
-
/**
|
|
1336
|
-
* Track if validation has been triggered (via reportValidity or setCustomValidity)
|
|
1337
|
-
* ARIA best practice: don't show aria-invalid until user attempts submission
|
|
1338
|
-
*/
|
|
1339
|
-
this._validationTriggered = false;
|
|
1340
1335
|
/**
|
|
1341
1336
|
* Roving tabindex controller for keyboard navigation
|
|
1342
1337
|
*/
|
|
@@ -1405,7 +1400,6 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1405
1400
|
* Override: Report validity for radio group
|
|
1406
1401
|
*/
|
|
1407
1402
|
reportValidity() {
|
|
1408
|
-
this._validationTriggered = true; // Mark that validation has been attempted
|
|
1409
1403
|
const isValid = this.checkValidity();
|
|
1410
1404
|
this.handleValidationMessages();
|
|
1411
1405
|
this._updateInvalidState();
|
|
@@ -1415,9 +1409,6 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1415
1409
|
setCustomValidity(message) {
|
|
1416
1410
|
// Only trigger validation state if message is non-empty (actual error)
|
|
1417
1411
|
// Empty message during init or after correction should not trigger invalid state initially
|
|
1418
|
-
if (message && message.length > 0) {
|
|
1419
|
-
this._validationTriggered = true;
|
|
1420
|
-
}
|
|
1421
1412
|
this.validationMessage = message;
|
|
1422
1413
|
this.formControlController.updateValidity();
|
|
1423
1414
|
// Update aria-invalid on group and children immediately
|
|
@@ -1435,7 +1426,7 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1435
1426
|
}
|
|
1436
1427
|
_updateInvalidState() {
|
|
1437
1428
|
// Only show aria-invalid if validation has been triggered (ARIA best practice)
|
|
1438
|
-
if (!this.
|
|
1429
|
+
if (!this.formControlController.submittedOnce) {
|
|
1439
1430
|
return;
|
|
1440
1431
|
}
|
|
1441
1432
|
const invalid = this.checkValidity() === false || !!this.validationMessage;
|
|
@@ -1469,7 +1460,7 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1469
1460
|
}
|
|
1470
1461
|
// Update message content and attributes
|
|
1471
1462
|
messageEl.id = messageId;
|
|
1472
|
-
messageEl.className = '
|
|
1463
|
+
messageEl.className = 'form-feedback just-validate-error-label';
|
|
1473
1464
|
messageEl.setAttribute('role', 'alert');
|
|
1474
1465
|
messageEl.removeAttribute('hidden');
|
|
1475
1466
|
const labelText = this._label?.[0]?.textContent || '';
|
|
@@ -1556,7 +1547,7 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1556
1547
|
}
|
|
1557
1548
|
});
|
|
1558
1549
|
// If validation was already triggered, update state after selection
|
|
1559
|
-
if (this.
|
|
1550
|
+
if (this.formControlController.submittedOnce) {
|
|
1560
1551
|
// For native validation, clear error if now valid
|
|
1561
1552
|
if (!this.customValidation) {
|
|
1562
1553
|
this.handleValidationMessages();
|
|
@@ -1647,9 +1638,9 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1647
1638
|
// Update radios when value or name changes
|
|
1648
1639
|
if (changed.has('value')) {
|
|
1649
1640
|
this._updateRadiosState();
|
|
1650
|
-
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
1641
|
+
this.dispatchEvent(new Event('it-change', { bubbles: true }));
|
|
1651
1642
|
// Re-validate after value change (for native validation) only if validation was already triggered
|
|
1652
|
-
if (!this.customValidation && this.
|
|
1643
|
+
if (!this.customValidation && this.formControlController.submittedOnce) {
|
|
1653
1644
|
this.handleValidationMessages();
|
|
1654
1645
|
this._updateInvalidState();
|
|
1655
1646
|
}
|
|
@@ -1671,7 +1662,7 @@ let ItRadioGroup = class ItRadioGroup extends FormControl {
|
|
|
1671
1662
|
render() {
|
|
1672
1663
|
const validityMessage = this.validationMessage;
|
|
1673
1664
|
const invalid = validityMessage?.length > 0 || (!this.customValidation && this?.checkValidity() === false);
|
|
1674
|
-
const groupWrapperClasses = this.composeClass('it-radio-group', 'it-form__control', this.inline && !this.grouped ? 'it-radio-group-inline' : '', this.grouped && !this.inline ? 'it-radio-group-stacked' : '', invalid ? 'is-invalid' : ''
|
|
1665
|
+
const groupWrapperClasses = this.composeClass('it-radio-group', 'it-form__control', this.inline && !this.grouped ? 'it-radio-group-inline' : '', this.grouped && !this.inline ? 'it-radio-group-stacked' : '', invalid ? 'is-invalid' : '');
|
|
1675
1666
|
return html `<slot name="label" @slotchange=${this._handleLabelSlotChange}></slot>
|
|
1676
1667
|
<div class=${groupWrapperClasses}>
|
|
1677
1668
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
@@ -1713,10 +1704,6 @@ __decorate([
|
|
|
1713
1704
|
queryAssignedElements({ slot: 'label' }),
|
|
1714
1705
|
__metadata("design:type", Array)
|
|
1715
1706
|
], ItRadioGroup.prototype, "_label", void 0);
|
|
1716
|
-
__decorate([
|
|
1717
|
-
state(),
|
|
1718
|
-
__metadata("design:type", Object)
|
|
1719
|
-
], ItRadioGroup.prototype, "_validationTriggered", void 0);
|
|
1720
1707
|
ItRadioGroup = __decorate([
|
|
1721
1708
|
customElement('it-radio-group')
|
|
1722
1709
|
], ItRadioGroup);
|