@italia/checkbox 1.0.0-alpha.9 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -70
- package/dist/src/index.js +1 -1
- package/dist/src/it-checkbox-base.js +180 -99
- package/dist/src/it-checkbox-base.js.map +1 -1
- package/dist/src/it-checkbox-group-base.js +173 -92
- package/dist/src/it-checkbox-group-base.js.map +1 -1
- package/dist/src/it-checkbox-group.js +1 -1
- package/dist/src/it-checkbox.js +1 -1
- package/package.json +23 -23
package/README.md
CHANGED
|
@@ -1,75 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# <it-checkbox>
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package is part of [dev-kit-italia](https://italia.github.io/dev-kit-italia), a Web Components kit for the **.italia** design-system.
|
|
4
4
|
|
|
5
|
-
## Installation
|
|
5
|
+
## Installation and usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm i @italia/checkbox
|
|
9
|
-
```
|
|
7
|
+
Most users want to install the full kit by installing [`@italia/dev-kit-italia`](https://npmjs.com/package/@italia/dev-kit-italia), but you have the option of installing this single Web Component separately if needed. Please find detailed installation and usage instructions in the [official documentation](https://italia.github.io/dev-kit-italia/?path=/docs/introduzione--documentazione).
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## Documentation
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
<script type="module">
|
|
15
|
-
import '@italia/checkbox';
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<it-checkbox></it-checkbox>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Linting and formatting
|
|
22
|
-
|
|
23
|
-
To scan the project for linting and formatting errors, run
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm run lint
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
To automatically fix linting and formatting errors, run
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm run format
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Testing with Web Test Runner
|
|
36
|
-
|
|
37
|
-
To execute a single test run:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm run test
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
To run the tests in interactive watch mode run:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npm run test:watch
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Demoing with Storybook
|
|
50
|
-
|
|
51
|
-
To run a local instance of Storybook for your component, run
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npm run storybook
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
To build a production version of Storybook, run
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
npm run storybook:build
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Tooling configs
|
|
64
|
-
|
|
65
|
-
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
66
|
-
|
|
67
|
-
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
68
|
-
|
|
69
|
-
## Local Demo with `web-dev-server`
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
npm start
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
11
|
+
Find the usage instructions for this specific component in its [dedicated documentation page](https://italia.github.io/dev-kit-italia/?path=/docs/componenti-form-checkbox--documentazione).
|
package/dist/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ItCheckbox } from './it-checkbox.js';
|
|
2
2
|
export { ItCheckboxGroup } from './it-checkbox-group.js';
|
|
3
3
|
import './it-checkbox-base.js';
|
|
4
|
-
import '../index-
|
|
4
|
+
import '../index-BEse4_RX.js';
|
|
5
5
|
import 'lit/directive.js';
|
|
6
6
|
import 'lit';
|
|
7
7
|
import 'lit/decorators.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __decorate, a as __metadata, F as FormControl, b as FormControlController, s as setAttributes } from '../index-
|
|
1
|
+
import { _ as __decorate, a as __metadata, F as FormControl, b as FormControlController, s as setAttributes } from '../index-BEse4_RX.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { property, queryAssignedElements } from 'lit/decorators.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
@@ -6,35 +6,7 @@ import { when } from 'lit/directives/when.js';
|
|
|
6
6
|
import { live } from 'lit/directives/live.js';
|
|
7
7
|
import 'lit/directive.js';
|
|
8
8
|
|
|
9
|
-
var styles = css
|
|
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(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-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
|
-
*,
|
|
9
|
+
var styles = css`*,
|
|
38
10
|
*::before,
|
|
39
11
|
*::after {
|
|
40
12
|
box-sizing: border-box;
|
|
@@ -428,7 +400,7 @@ input::-webkit-date-and-time-value {
|
|
|
428
400
|
}
|
|
429
401
|
|
|
430
402
|
select {
|
|
431
|
-
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%,
|
|
403
|
+
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%, 32%%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
|
|
432
404
|
background-repeat: no-repeat;
|
|
433
405
|
background-position: right var(--bsi-form-control-spacing) center;
|
|
434
406
|
background-size: 16px 12px;
|
|
@@ -441,7 +413,6 @@ select:focus {
|
|
|
441
413
|
}
|
|
442
414
|
select[multiple], select[size]:not([size="1"]) {
|
|
443
415
|
padding-right: 0.75rem;
|
|
444
|
-
background-image: none;
|
|
445
416
|
}
|
|
446
417
|
select:disabled {
|
|
447
418
|
background-color: hsl(0, 0%, 90%);
|
|
@@ -575,8 +546,8 @@ input::-webkit-datetime-edit {
|
|
|
575
546
|
.form-check [type=checkbox],
|
|
576
547
|
.form-check [type=radio] {
|
|
577
548
|
position: absolute;
|
|
578
|
-
top:
|
|
579
|
-
left:
|
|
549
|
+
top: 0;
|
|
550
|
+
left: 0;
|
|
580
551
|
width: auto;
|
|
581
552
|
margin-top: 0;
|
|
582
553
|
margin-left: 0;
|
|
@@ -598,6 +569,19 @@ input::-webkit-datetime-edit {
|
|
|
598
569
|
font-size: var(--bsi-label-font-size-l);
|
|
599
570
|
}
|
|
600
571
|
}
|
|
572
|
+
.form-check [type=checkbox]:focus + label,
|
|
573
|
+
.form-check [type=radio]:focus + label {
|
|
574
|
+
border-color: hsl(0, 0%, 0%) !important;
|
|
575
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
576
|
+
outline: 3px solid transparent !important;
|
|
577
|
+
outline-offset: 3px !important;
|
|
578
|
+
}
|
|
579
|
+
.form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
580
|
+
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
581
|
+
border-color: inherit !important;
|
|
582
|
+
box-shadow: none !important;
|
|
583
|
+
outline: none !important;
|
|
584
|
+
}
|
|
601
585
|
.form-check input[type=checkbox] + label::after,
|
|
602
586
|
.form-check input[type=checkbox] + label::before {
|
|
603
587
|
position: absolute;
|
|
@@ -644,6 +628,9 @@ input::-webkit-datetime-edit {
|
|
|
644
628
|
height: 0;
|
|
645
629
|
border-color: transparent;
|
|
646
630
|
}
|
|
631
|
+
.form-check input[type=checkbox] + label:hover::after {
|
|
632
|
+
border-color: var(--bsi-color-border-secondary-hover);
|
|
633
|
+
}
|
|
647
634
|
.form-check input[type=checkbox]:disabled + label {
|
|
648
635
|
opacity: 1;
|
|
649
636
|
cursor: not-allowed;
|
|
@@ -685,6 +672,9 @@ input::-webkit-datetime-edit {
|
|
|
685
672
|
.form-check input[type=radio]:checked + label::before {
|
|
686
673
|
border-color: var(--bsi-form-checked-color);
|
|
687
674
|
}
|
|
675
|
+
.form-check input[type=radio] + label:hover::before {
|
|
676
|
+
border-color: var(--bsi-color-border-secondary-hover);
|
|
677
|
+
}
|
|
688
678
|
.form-check input[type=radio]:disabled + label {
|
|
689
679
|
cursor: not-allowed;
|
|
690
680
|
}
|
|
@@ -771,21 +761,6 @@ input::-webkit-datetime-edit {
|
|
|
771
761
|
transition: none !important;
|
|
772
762
|
}
|
|
773
763
|
}
|
|
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(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-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
764
|
.form-control-plaintext {
|
|
790
765
|
border: 0;
|
|
791
766
|
--bsi-form-control-border-color: transparent;
|
|
@@ -804,7 +779,7 @@ input::-webkit-datetime-edit {
|
|
|
804
779
|
.form-control {
|
|
805
780
|
background-repeat: no-repeat;
|
|
806
781
|
background-position: center right;
|
|
807
|
-
background-size: 45px
|
|
782
|
+
background-size: 45px 20px;
|
|
808
783
|
}
|
|
809
784
|
.form-control:disabled {
|
|
810
785
|
cursor: not-allowed;
|
|
@@ -812,20 +787,6 @@ input::-webkit-datetime-edit {
|
|
|
812
787
|
border: 0;
|
|
813
788
|
color: var(--bsi-color-text-disabled);
|
|
814
789
|
}
|
|
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(--bsi-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(--bsi-color-border-warning);
|
|
825
|
-
}
|
|
826
|
-
.form-control.is-valid ~ .warning-feedback {
|
|
827
|
-
display: block;
|
|
828
|
-
}
|
|
829
790
|
|
|
830
791
|
.form-control-sm {
|
|
831
792
|
--bsi-form-control-spacing: var(--bsi-spacing-xxs) var(--bsi-spacing-3xs);
|
|
@@ -922,15 +883,15 @@ textarea.form-control-lg {
|
|
|
922
883
|
border-color: hsl(210, 100%, 40%);
|
|
923
884
|
}
|
|
924
885
|
.form-check-input:checked[type=checkbox] {
|
|
925
|
-
background-image: url("data:image/svg+xml
|
|
886
|
+
background-image: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='hsl(0, 0%, 100%)' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/></svg>"));
|
|
926
887
|
}
|
|
927
888
|
.form-check-input:checked[type=radio] {
|
|
928
|
-
background-image: url("data:image/svg+xml
|
|
889
|
+
background-image: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='2' fill='hsl(0, 0%, 100%)'/></svg>"));
|
|
929
890
|
}
|
|
930
891
|
.form-check-input[type=checkbox]:indeterminate {
|
|
931
892
|
background-color: hsl(210, 100%, 40%);
|
|
932
893
|
border-color: hsl(210, 100%, 40%);
|
|
933
|
-
background-image: url("data:image/svg+xml
|
|
894
|
+
background-image: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='hsl(0, 0%, 100%)' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/></svg>"));
|
|
934
895
|
}
|
|
935
896
|
.form-check-input:disabled {
|
|
936
897
|
pointer-events: none;
|
|
@@ -948,7 +909,7 @@ textarea.form-control-lg {
|
|
|
948
909
|
.form-switch .form-check-input {
|
|
949
910
|
width: 2em;
|
|
950
911
|
margin-left: -2.5em;
|
|
951
|
-
background-image: url("data:image/svg+xml
|
|
912
|
+
background-image: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='rgba(0, 0, 0, 0.25)'/></svg>"));
|
|
952
913
|
background-position: left center;
|
|
953
914
|
border-radius: 2em;
|
|
954
915
|
transition: background-position 0.15s ease-in-out;
|
|
@@ -959,11 +920,11 @@ textarea.form-control-lg {
|
|
|
959
920
|
}
|
|
960
921
|
}
|
|
961
922
|
.form-switch .form-check-input:focus {
|
|
962
|
-
background-image: url("data:image/svg+xml
|
|
923
|
+
background-image: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='hsl(210, 17%, 44%)'/></svg>"));
|
|
963
924
|
}
|
|
964
925
|
.form-switch .form-check-input:checked {
|
|
965
926
|
background-position: right center;
|
|
966
|
-
background-image: url("data:image/svg+xml
|
|
927
|
+
background-image: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='hsl(0, 0%, 100%)'/></svg>"));
|
|
967
928
|
}
|
|
968
929
|
.form-switch.form-check-reverse {
|
|
969
930
|
padding-right: 2.5em;
|
|
@@ -995,9 +956,6 @@ textarea.form-control-lg {
|
|
|
995
956
|
margin-top: 0.25rem;
|
|
996
957
|
font-size: 0.75rem;
|
|
997
958
|
}
|
|
998
|
-
.form-feedback.just-validate-error-label {
|
|
999
|
-
color: var(--bsi-color-text-danger);
|
|
1000
|
-
}
|
|
1001
959
|
|
|
1002
960
|
.input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
|
|
1003
961
|
[data-focus-mouse=true]:not(.btn) ~ .input-group-text,
|
|
@@ -1019,20 +977,44 @@ button:has(~ .is-invalid),
|
|
|
1019
977
|
display: none;
|
|
1020
978
|
}
|
|
1021
979
|
|
|
1022
|
-
.
|
|
1023
|
-
|
|
980
|
+
.is-valid,
|
|
981
|
+
.is-invalid {
|
|
1024
982
|
padding-right: calc(1.5em + 0.75rem) !important;
|
|
1025
|
-
|
|
983
|
+
}
|
|
984
|
+
.is-valid[type=number],
|
|
985
|
+
.is-invalid[type=number] {
|
|
986
|
+
padding-right: calc(1.5em + 0.75rem + var(--bsi-form-control-spacing) + 1rem) !important;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
.was-validated &:valid,
|
|
990
|
+
.is-valid {
|
|
991
|
+
border-color: var(--bsi-color-border-success) !important;
|
|
992
|
+
background-image: url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="%23008055" xmlns="http://www.w3.org/2000/svg"><path d="M9.6,16.9L4,11.4l0.8-0.7l4.8,4.8l8.5-8.4l0.7,0.7L9.6,16.9z" /></svg>');
|
|
993
|
+
}
|
|
994
|
+
.was-validated &:valid ~ .warning-feedback,
|
|
995
|
+
.is-valid ~ .warning-feedback {
|
|
996
|
+
display: block;
|
|
1026
997
|
}
|
|
1027
998
|
|
|
1028
|
-
.
|
|
1029
|
-
.
|
|
1030
|
-
|
|
1031
|
-
.
|
|
999
|
+
.was-validated &:invalid,
|
|
1000
|
+
.is-invalid {
|
|
1001
|
+
border-color: var(--bsi-color-border-danger) !important;
|
|
1002
|
+
background-image: url('data:image/svg+xml,<svg width="24" fill="%23cc334d" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.7,12l6.7,6.6l-0.8,0.8L12,12.7l-6.6,6.7l-0.8-0.8l6.7-6.6L4.6,5.4l0.8-0.8l6.6,6.7l6.6-6.7l0.8,0.8L12.7,12z" /></svg>');
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
.form-control.warning {
|
|
1006
|
+
border-color: var(--bsi-color-border-warning) !important;
|
|
1007
|
+
background-image: url('data:image/svg+xml,<svg width="24" height="24" fill="%23995c00" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.5,17h-1V2h1V17z M12.5,20h-1v2h1V20z" /></svg>');
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
.input-group-text:has(~ .is-valid),
|
|
1011
|
+
.is-valid ~ .input-group-text,
|
|
1012
|
+
button:has(~ .is-valid),
|
|
1013
|
+
.is-valid + button {
|
|
1032
1014
|
border-color: var(--bsi-color-border-success);
|
|
1033
1015
|
}
|
|
1034
1016
|
|
|
1035
|
-
.
|
|
1017
|
+
.is-valid + .input-group-text.align-buttons,
|
|
1036
1018
|
.is-invalid + .input-group-text.align-buttons {
|
|
1037
1019
|
right: 30px;
|
|
1038
1020
|
}
|
|
@@ -1041,33 +1023,132 @@ button:has(~ .just-validate-success-field),
|
|
|
1041
1023
|
bottom: 22px;
|
|
1042
1024
|
}
|
|
1043
1025
|
|
|
1044
|
-
.autocomplete__wrapper .form-feedback
|
|
1026
|
+
.autocomplete__wrapper .form-feedback {
|
|
1045
1027
|
position: absolute;
|
|
1046
1028
|
}
|
|
1047
1029
|
|
|
1048
1030
|
textarea.form-control {
|
|
1049
|
-
background-position: top 0.
|
|
1050
|
-
|
|
1031
|
+
background-position: top 0.5em right !important;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
.text-primary {
|
|
1035
|
+
--bsi-text-opacity: 1;
|
|
1036
|
+
color: rgba(var(--bsi-primary-rgb), var(--bsi-text-opacity)) !important;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
.text-secondary {
|
|
1040
|
+
--bsi-text-opacity: 1;
|
|
1041
|
+
color: hsl(210, 33%, 28%) !important;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
.text-success {
|
|
1045
|
+
--bsi-text-opacity: 1;
|
|
1046
|
+
color: rgba(var(--bsi-success-rgb), var(--bsi-text-opacity)) !important;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
.text-info {
|
|
1050
|
+
--bsi-text-opacity: 1;
|
|
1051
|
+
color: rgba(var(--bsi-info-rgb), var(--bsi-text-opacity)) !important;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
.text-warning {
|
|
1055
|
+
--bsi-text-opacity: 1;
|
|
1056
|
+
color: rgba(var(--bsi-warning-rgb), var(--bsi-text-opacity)) !important;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
.text-danger {
|
|
1060
|
+
--bsi-text-opacity: 1;
|
|
1061
|
+
color: rgba(var(--bsi-danger-rgb), var(--bsi-text-opacity)) !important;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
.text-light {
|
|
1065
|
+
--bsi-text-opacity: 1;
|
|
1066
|
+
color: rgba(var(--bsi-light-rgb), var(--bsi-text-opacity)) !important;
|
|
1051
1067
|
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1068
|
+
|
|
1069
|
+
.text-dark {
|
|
1070
|
+
--bsi-text-opacity: 1;
|
|
1071
|
+
color: rgba(var(--bsi-dark-rgb), var(--bsi-text-opacity)) !important;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
.text-black {
|
|
1075
|
+
--bsi-text-opacity: 1;
|
|
1076
|
+
color: rgba(var(--bsi-black-rgb), var(--bsi-text-opacity)) !important;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.text-white {
|
|
1080
|
+
--bsi-text-opacity: 1;
|
|
1081
|
+
color: rgba(var(--bsi-white-rgb), var(--bsi-text-opacity)) !important;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
.text-100 {
|
|
1085
|
+
--bsi-text-opacity: 1;
|
|
1086
|
+
color: rgba(var(--bsi-100-rgb), var(--bsi-text-opacity)) !important;
|
|
1055
1087
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1088
|
+
|
|
1089
|
+
.text-200 {
|
|
1090
|
+
--bsi-text-opacity: 1;
|
|
1091
|
+
color: rgba(var(--bsi-200-rgb), var(--bsi-text-opacity)) !important;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
.text-300 {
|
|
1095
|
+
--bsi-text-opacity: 1;
|
|
1096
|
+
color: rgba(var(--bsi-300-rgb), var(--bsi-text-opacity)) !important;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
.text-400 {
|
|
1100
|
+
--bsi-text-opacity: 1;
|
|
1101
|
+
color: rgba(var(--bsi-400-rgb), var(--bsi-text-opacity)) !important;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
.text-500 {
|
|
1105
|
+
--bsi-text-opacity: 1;
|
|
1106
|
+
color: rgba(var(--bsi-500-rgb), var(--bsi-text-opacity)) !important;
|
|
1059
1107
|
}
|
|
1060
1108
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
--bsi-
|
|
1109
|
+
.text-600 {
|
|
1110
|
+
--bsi-text-opacity: 1;
|
|
1111
|
+
color: rgba(var(--bsi-600-rgb), var(--bsi-text-opacity)) !important;
|
|
1064
1112
|
}
|
|
1065
1113
|
|
|
1066
|
-
|
|
1067
|
-
|
|
1114
|
+
.text-700 {
|
|
1115
|
+
--bsi-text-opacity: 1;
|
|
1116
|
+
color: rgba(var(--bsi-700-rgb), var(--bsi-text-opacity)) !important;
|
|
1068
1117
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1118
|
+
|
|
1119
|
+
.text-800 {
|
|
1120
|
+
--bsi-text-opacity: 1;
|
|
1121
|
+
color: rgba(var(--bsi-800-rgb), var(--bsi-text-opacity)) !important;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
.text-900 {
|
|
1125
|
+
--bsi-text-opacity: 1;
|
|
1126
|
+
color: rgba(var(--bsi-900-rgb), var(--bsi-text-opacity)) !important;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
.text-body {
|
|
1130
|
+
--bsi-text-opacity: 1;
|
|
1131
|
+
color: rgba(var(--bsi-body-color-rgb), var(--bsi-text-opacity)) !important;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
.text-muted {
|
|
1135
|
+
--bsi-text-opacity: 1;
|
|
1136
|
+
color: hsl(210, 17%, 44%) !important;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
.text-black-50 {
|
|
1140
|
+
--bsi-text-opacity: 1;
|
|
1141
|
+
color: rgba(0, 0, 0, 0.5) !important;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
.text-white-50 {
|
|
1145
|
+
--bsi-text-opacity: 1;
|
|
1146
|
+
color: rgba(255, 255, 255, 0.5) !important;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.text-reset {
|
|
1150
|
+
--bsi-text-opacity: 1;
|
|
1151
|
+
color: inherit !important;
|
|
1071
1152
|
}
|
|
1072
1153
|
|
|
1073
1154
|
.form-check input:focus:not(:focus-visible) + label {
|
|
@@ -1143,7 +1224,7 @@ class ItCheckboxBase extends FormControl {
|
|
|
1143
1224
|
}
|
|
1144
1225
|
_renderInput(supportTextId, invalid, validityMessage) {
|
|
1145
1226
|
const ariaDescribedBy = this.composeClass(this.supportText?.length > 0 ? supportTextId : '', this._ariaAttributes['aria-describedby']?.length > 0 ? this._ariaAttributes['aria-describedby'] : '', validityMessage?.length > 0 ? `invalid-feedback-${this._id}` : '');
|
|
1146
|
-
const inputClasses = this.composeClass('it-form__control', invalid ? 'is-invalid' : '', !invalid && this._touched ? '
|
|
1227
|
+
const inputClasses = this.composeClass('it-form__control', invalid ? 'is-invalid' : '', !invalid && this._touched ? 'is-valid' : '', this.indeterminate ? 'semi-checked' : '');
|
|
1147
1228
|
const inputIsRequired = this.required && !this.isInGroup; // Disabilita il 'required' nativo se siamo in un gruppo
|
|
1148
1229
|
const inputRender = html `
|
|
1149
1230
|
<input
|
|
@@ -1180,7 +1261,7 @@ class ItCheckboxBase extends FormControl {
|
|
|
1180
1261
|
return html `<div
|
|
1181
1262
|
role="alert"
|
|
1182
1263
|
id="invalid-feedback-${this._id}"
|
|
1183
|
-
class="
|
|
1264
|
+
class="form-feedback text-danger"
|
|
1184
1265
|
?hidden=${!(validityMessage?.length > 0)}
|
|
1185
1266
|
>
|
|
1186
1267
|
<span class="visually-hidden"><slot name="label"></slot>: </span>${validityMessage}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-checkbox-base.js","sources":["../../../src/it-checkbox-base.ts"],"sourcesContent":["import { setAttributes, FormControl, FormControlController } from '@italia/globals';\n\n// import { registerTranslation } from '@italia/i18n';\nimport { html } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { when } from 'lit/directives/when.js';\nimport { live } from 'lit/directives/live.js';\n\nimport styles from './checkbox.scss';\n\nexport class ItCheckboxBase extends FormControl {\n static styles = styles;\n\n protected readonly formControlController: FormControlController = new FormControlController(this, {\n value: (control: FormControl) =>\n (control as ItCheckboxBase).checked ? (control as ItCheckboxBase).value || 'true' : undefined,\n setValue: (control: FormControl, value: unknown) => {\n const checkbox = control as ItCheckboxBase;\n checkbox.checked = Boolean(value);\n },\n });\n\n /**\n * The type of input. Works the same as a native `<input>` element, but only a subset of types are supported. Defaults\n * to `text`.\n */\n type = 'checkbox';\n\n /** Draws the checkbox in a checked state. */\n @property({ type: Boolean, reflect: true })\n checked = false;\n\n /** Draws checkboxes inline, side by side. */\n @property({ type: Boolean, reflect: true })\n inline = false;\n\n /** Draws checkboxes in groups. */\n @property({ type: Boolean, reflect: true })\n group = false;\n\n /**\n * Draws the checkbox in an indeterminate state. This is usually applied to checkboxes that represents a \"select\n * all/none\" behavior when associated checkboxes have a mix of checked and unchecked states.\n */\n @property({ type: Boolean, reflect: true }) indeterminate = false;\n\n @queryAssignedElements({ slot: 'label' })\n labelElements!: HTMLElement[];\n\n get label(): string {\n if (this.labelElements.length > 0) {\n return this.labelElements[0].innerText.trim();\n }\n return '';\n }\n\n /** The input's help text. */\n @property({ type: String, attribute: 'support-text' })\n supportText = '';\n\n /** Simulates a click on the checkbox. */\n click() {\n this.inputElement.click();\n }\n\n override connectedCallback() {\n super.connectedCallback?.();\n this._handleReady();\n // 🔍 Verifica se il parent è un it-checkbox-group\n this.isInGroup = !!this.closest('it-checkbox-group');\n }\n\n override updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated?.(changedProperties);\n\n // logger\n if (!this.label || this.label?.length === 0) {\n this.logger.warn(\n `Label is required to ensure accessibility. Please, define a label for <it-checkbox name=\"${this.name}\" ... /> .`,\n );\n }\n }\n\n protected override _handleClick(e: Event): void {\n this.checked = !this.checked;\n this.indeterminate = false;\n super._handleClick(e);\n this._handleChange(e);\n // ✅ Evento standard per compatibilità\n this.dispatchEvent(new Event('change', { bubbles: true }));\n }\n\n protected _renderInput(supportTextId: string, invalid: boolean, validityMessage: string) {\n const ariaDescribedBy = this.composeClass(\n this.supportText?.length > 0 ? supportTextId : '',\n this._ariaAttributes['aria-describedby']?.length > 0 ? this._ariaAttributes['aria-describedby'] : '',\n validityMessage?.length > 0 ? `invalid-feedback-${this._id}` : '',\n );\n\n const inputClasses = this.composeClass(\n 'it-form__control',\n invalid ? 'is-invalid' : '',\n !invalid && this._touched ? 'just-validate-success-field' : '',\n this.indeterminate ? 'semi-checked' : '',\n );\n\n const inputIsRequired = this.required && !this.isInGroup; // Disabilita il 'required' nativo se siamo in un gruppo\n\n const inputRender = html`\n <input\n part=\"checkbox focusable\"\n ${setAttributes(this._ariaAttributes)}\n aria-describedby=${ifDefined(ariaDescribedBy || undefined)}\n aria-invalid=${ifDefined(invalid ? 'true' : undefined)}\n @input=\"${this._handleInput}\"\n @blur=${this._handleBlur}\n @focus=${this._handleFocus}\n @click=${this._handleClick}\n @invalid=${this._handleInvalid}\n type=\"${this.type}\"\n id=\"${this._id}\"\n name=\"${this.name}\"\n .checked=${live(this.checked)}\n .indeterminate=${live(this.indeterminate)}\n .disabled=${this.disabled}\n .required=${inputIsRequired}\n ?formNoValidate=${this.customValidation}\n .value=\"${live(this.value)}\"\n class=\"${inputClasses}\"\n />\n `;\n\n return inputRender;\n }\n\n protected getWrapperClasses() {\n return this.composeClass(\n 'form-check',\n this.inline ? 'form-check-inline' : '',\n this.group ? 'form-check-group' : '',\n );\n }\n\n protected getSupportTextRender(supportTextId: string) {\n return html` ${when(\n this.supportText,\n () => html` <small class=\"form-text\" id=\"${supportTextId}\">${this.supportText}</small> `,\n )}`;\n }\n\n protected getValidityMessageRender(validityMessage: string) {\n return html`<div\n role=\"alert\"\n id=\"invalid-feedback-${this._id}\"\n class=\"invalid-feedback form-feedback form-text form-feedback just-validate-error-label\"\n ?hidden=${!(validityMessage?.length > 0)}\n >\n <span class=\"visually-hidden\"><slot name=\"label\"></slot>: </span>${validityMessage}\n </div>`;\n }\n\n // Render the UI as a function of component state\n override render() {\n const supportTextId = `${this._id}-support-text`;\n\n const supportTextRender = this.getSupportTextRender(supportTextId);\n\n const showValidation = this.formControlController.submittedOnce || this.customValidation; // true; // this._touched || this.customValidation ;\n const validityMessage = (showValidation ? (this.validationMessage ?? '') : '') ?? '';\n\n const invalid =\n validityMessage?.length > 0 || (!this.customValidation && this.inputElement?.checkValidity() === false);\n\n const validityMessageRender = this.getValidityMessageRender(validityMessage);\n\n const wrapperClasses = this.getWrapperClasses();\n\n const labelClasses = this.composeClass(this.disabled ? 'disabled' : '');\n\n return html`\n <div class=\"${wrapperClasses}\" part=\"input-wrapper\">\n ${this._renderInput(supportTextId, invalid, validityMessage)}\n <label for=\"${ifDefined(this._id || undefined)}\" part=\"label\" class=\"${labelClasses}\"\n ><slot name=\"label\"></slot\n ></label>\n ${validityMessageRender} ${supportTextRender}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAO,EAAE,IAAI,EAAE,CAAC;;AAC5B,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAIf,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC7B,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAM8B,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAAuB,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAGlE,UAAA,CAAA;AADC,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;AACX,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAW9B,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;AACrC,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"it-checkbox-base.js","sources":["../../../src/it-checkbox-base.ts"],"sourcesContent":["import { setAttributes, FormControl, FormControlController } from '@italia/globals';\n\n// import { registerTranslation } from '@italia/i18n';\nimport { html } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { when } from 'lit/directives/when.js';\nimport { live } from 'lit/directives/live.js';\n\nimport styles from './checkbox.scss';\n\nexport class ItCheckboxBase extends FormControl {\n static styles = styles;\n\n protected readonly formControlController: FormControlController = new FormControlController(this, {\n value: (control: FormControl) =>\n (control as ItCheckboxBase).checked ? (control as ItCheckboxBase).value || 'true' : undefined,\n setValue: (control: FormControl, value: unknown) => {\n const checkbox = control as ItCheckboxBase;\n checkbox.checked = Boolean(value);\n },\n });\n\n /**\n * The type of input. Works the same as a native `<input>` element, but only a subset of types are supported. Defaults\n * to `text`.\n */\n type = 'checkbox';\n\n /** Draws the checkbox in a checked state. */\n @property({ type: Boolean, reflect: true })\n checked = false;\n\n /** Draws checkboxes inline, side by side. */\n @property({ type: Boolean, reflect: true })\n inline = false;\n\n /** Draws checkboxes in groups. */\n @property({ type: Boolean, reflect: true })\n group = false;\n\n /**\n * Draws the checkbox in an indeterminate state. This is usually applied to checkboxes that represents a \"select\n * all/none\" behavior when associated checkboxes have a mix of checked and unchecked states.\n */\n @property({ type: Boolean, reflect: true }) indeterminate = false;\n\n @queryAssignedElements({ slot: 'label' })\n labelElements!: HTMLElement[];\n\n get label(): string {\n if (this.labelElements.length > 0) {\n return this.labelElements[0].innerText.trim();\n }\n return '';\n }\n\n /** The input's help text. */\n @property({ type: String, attribute: 'support-text' })\n supportText = '';\n\n /** Simulates a click on the checkbox. */\n click() {\n this.inputElement.click();\n }\n\n override connectedCallback() {\n super.connectedCallback?.();\n this._handleReady();\n // 🔍 Verifica se il parent è un it-checkbox-group\n this.isInGroup = !!this.closest('it-checkbox-group');\n }\n\n override updated(changedProperties: Map<string | number | symbol, unknown>) {\n super.updated?.(changedProperties);\n\n // logger\n if (!this.label || this.label?.length === 0) {\n this.logger.warn(\n `Label is required to ensure accessibility. Please, define a label for <it-checkbox name=\"${this.name}\" ... /> .`,\n );\n }\n }\n\n protected override _handleClick(e: Event): void {\n this.checked = !this.checked;\n this.indeterminate = false;\n super._handleClick(e);\n this._handleChange(e);\n // ✅ Evento standard per compatibilità\n this.dispatchEvent(new Event('change', { bubbles: true }));\n }\n\n protected _renderInput(supportTextId: string, invalid: boolean, validityMessage: string) {\n const ariaDescribedBy = this.composeClass(\n this.supportText?.length > 0 ? supportTextId : '',\n this._ariaAttributes['aria-describedby']?.length > 0 ? this._ariaAttributes['aria-describedby'] : '',\n validityMessage?.length > 0 ? `invalid-feedback-${this._id}` : '',\n );\n\n const inputClasses = this.composeClass(\n 'it-form__control',\n invalid ? 'is-invalid' : '',\n !invalid && this._touched ? 'is-valid' : '',\n this.indeterminate ? 'semi-checked' : '',\n );\n\n const inputIsRequired = this.required && !this.isInGroup; // Disabilita il 'required' nativo se siamo in un gruppo\n\n const inputRender = html`\n <input\n part=\"checkbox focusable\"\n ${setAttributes(this._ariaAttributes)}\n aria-describedby=${ifDefined(ariaDescribedBy || undefined)}\n aria-invalid=${ifDefined(invalid ? 'true' : undefined)}\n @input=\"${this._handleInput}\"\n @blur=${this._handleBlur}\n @focus=${this._handleFocus}\n @click=${this._handleClick}\n @invalid=${this._handleInvalid}\n type=\"${this.type}\"\n id=\"${this._id}\"\n name=\"${this.name}\"\n .checked=${live(this.checked)}\n .indeterminate=${live(this.indeterminate)}\n .disabled=${this.disabled}\n .required=${inputIsRequired}\n ?formNoValidate=${this.customValidation}\n .value=\"${live(this.value)}\"\n class=\"${inputClasses}\"\n />\n `;\n\n return inputRender;\n }\n\n protected getWrapperClasses() {\n return this.composeClass(\n 'form-check',\n this.inline ? 'form-check-inline' : '',\n this.group ? 'form-check-group' : '',\n );\n }\n\n protected getSupportTextRender(supportTextId: string) {\n return html` ${when(\n this.supportText,\n () => html` <small class=\"form-text\" id=\"${supportTextId}\">${this.supportText}</small> `,\n )}`;\n }\n\n protected getValidityMessageRender(validityMessage: string) {\n return html`<div\n role=\"alert\"\n id=\"invalid-feedback-${this._id}\"\n class=\"form-feedback text-danger\"\n ?hidden=${!(validityMessage?.length > 0)}\n >\n <span class=\"visually-hidden\"><slot name=\"label\"></slot>: </span>${validityMessage}\n </div>`;\n }\n\n // Render the UI as a function of component state\n override render() {\n const supportTextId = `${this._id}-support-text`;\n\n const supportTextRender = this.getSupportTextRender(supportTextId);\n\n const showValidation = this.formControlController.submittedOnce || this.customValidation; // true; // this._touched || this.customValidation ;\n const validityMessage = (showValidation ? (this.validationMessage ?? '') : '') ?? '';\n\n const invalid =\n validityMessage?.length > 0 || (!this.customValidation && this.inputElement?.checkValidity() === false);\n\n const validityMessageRender = this.getValidityMessageRender(validityMessage);\n\n const wrapperClasses = this.getWrapperClasses();\n\n const labelClasses = this.composeClass(this.disabled ? 'disabled' : '');\n\n return html`\n <div class=\"${wrapperClasses}\" part=\"input-wrapper\">\n ${this._renderInput(supportTextId, invalid, validityMessage)}\n <label for=\"${ifDefined(this._id || undefined)}\" part=\"label\" class=\"${labelClasses}\"\n ><slot name=\"label\"></slot\n ></label>\n ${validityMessageRender} ${supportTextRender}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAA,MAAA,CAAA;AAGlE,UAAA,CAAA;AADC,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;AACX,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAW9B,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;;AACrC,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;;;;"}
|
|
@@ -1,39 +1,11 @@
|
|
|
1
|
-
import { _ as __decorate, a as __metadata, F as FormControl, b as FormControlController } from '../index-
|
|
1
|
+
import { _ as __decorate, a as __metadata, F as FormControl, b as FormControlController } from '../index-BEse4_RX.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { property, queryAssignedElements, state } from 'lit/decorators.js';
|
|
4
4
|
import { when } from 'lit/directives/when.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
6
|
import 'lit/directive.js';
|
|
7
7
|
|
|
8
|
-
var styles = css
|
|
9
|
-
/***************************** 2 ****************************************/
|
|
10
|
-
/***************************** 1 ****************************************/
|
|
11
|
-
/***************************** 2 ****************************************/
|
|
12
|
-
/***************************** 1 ****************************************/
|
|
13
|
-
/***************************** 2 ****************************************/
|
|
14
|
-
/***************************** 3 ****************************************/
|
|
15
|
-
/***************************** 1 ****************************************/
|
|
16
|
-
/***************************** 2 ****************************************/
|
|
17
|
-
/***************************** 3 ****************************************/
|
|
18
|
-
/***************************** NEUTRAL 1 ****************************************/
|
|
19
|
-
/***************************** NEUTRAL 2 ****************************************/
|
|
20
|
-
/***************************** NEUTRAL 2 / 3 ****************************************/
|
|
21
|
-
.form-check [type=checkbox]:focus + label,
|
|
22
|
-
.form-check [type=radio]:focus + label {
|
|
23
|
-
border-color: hsl(0, 0%, 0%) !important;
|
|
24
|
-
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
25
|
-
outline: 3px solid transparent !important;
|
|
26
|
-
outline-offset: 3px !important;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
30
|
-
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
31
|
-
border-color: inherit !important;
|
|
32
|
-
box-shadow: none !important;
|
|
33
|
-
outline: none !important;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
*,
|
|
8
|
+
var styles = css`*,
|
|
37
9
|
*::before,
|
|
38
10
|
*::after {
|
|
39
11
|
box-sizing: border-box;
|
|
@@ -427,7 +399,7 @@ input::-webkit-date-and-time-value {
|
|
|
427
399
|
}
|
|
428
400
|
|
|
429
401
|
select {
|
|
430
|
-
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%,
|
|
402
|
+
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%, 32%%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
|
|
431
403
|
background-repeat: no-repeat;
|
|
432
404
|
background-position: right var(--bsi-form-control-spacing) center;
|
|
433
405
|
background-size: 16px 12px;
|
|
@@ -440,7 +412,6 @@ select:focus {
|
|
|
440
412
|
}
|
|
441
413
|
select[multiple], select[size]:not([size="1"]) {
|
|
442
414
|
padding-right: 0.75rem;
|
|
443
|
-
background-image: none;
|
|
444
415
|
}
|
|
445
416
|
select:disabled {
|
|
446
417
|
background-color: hsl(0, 0%, 90%);
|
|
@@ -574,8 +545,8 @@ input::-webkit-datetime-edit {
|
|
|
574
545
|
.form-check [type=checkbox],
|
|
575
546
|
.form-check [type=radio] {
|
|
576
547
|
position: absolute;
|
|
577
|
-
top:
|
|
578
|
-
left:
|
|
548
|
+
top: 0;
|
|
549
|
+
left: 0;
|
|
579
550
|
width: auto;
|
|
580
551
|
margin-top: 0;
|
|
581
552
|
margin-left: 0;
|
|
@@ -597,6 +568,19 @@ input::-webkit-datetime-edit {
|
|
|
597
568
|
font-size: var(--bsi-label-font-size-l);
|
|
598
569
|
}
|
|
599
570
|
}
|
|
571
|
+
.form-check [type=checkbox]:focus + label,
|
|
572
|
+
.form-check [type=radio]:focus + label {
|
|
573
|
+
border-color: hsl(0, 0%, 0%) !important;
|
|
574
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
575
|
+
outline: 3px solid transparent !important;
|
|
576
|
+
outline-offset: 3px !important;
|
|
577
|
+
}
|
|
578
|
+
.form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
579
|
+
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
580
|
+
border-color: inherit !important;
|
|
581
|
+
box-shadow: none !important;
|
|
582
|
+
outline: none !important;
|
|
583
|
+
}
|
|
600
584
|
.form-check input[type=checkbox] + label::after,
|
|
601
585
|
.form-check input[type=checkbox] + label::before {
|
|
602
586
|
position: absolute;
|
|
@@ -643,6 +627,9 @@ input::-webkit-datetime-edit {
|
|
|
643
627
|
height: 0;
|
|
644
628
|
border-color: transparent;
|
|
645
629
|
}
|
|
630
|
+
.form-check input[type=checkbox] + label:hover::after {
|
|
631
|
+
border-color: var(--bsi-color-border-secondary-hover);
|
|
632
|
+
}
|
|
646
633
|
.form-check input[type=checkbox]:disabled + label {
|
|
647
634
|
opacity: 1;
|
|
648
635
|
cursor: not-allowed;
|
|
@@ -684,6 +671,9 @@ input::-webkit-datetime-edit {
|
|
|
684
671
|
.form-check input[type=radio]:checked + label::before {
|
|
685
672
|
border-color: var(--bsi-form-checked-color);
|
|
686
673
|
}
|
|
674
|
+
.form-check input[type=radio] + label:hover::before {
|
|
675
|
+
border-color: var(--bsi-color-border-secondary-hover);
|
|
676
|
+
}
|
|
687
677
|
.form-check input[type=radio]:disabled + label {
|
|
688
678
|
cursor: not-allowed;
|
|
689
679
|
}
|
|
@@ -770,21 +760,6 @@ input::-webkit-datetime-edit {
|
|
|
770
760
|
transition: none !important;
|
|
771
761
|
}
|
|
772
762
|
}
|
|
773
|
-
.form-check [type=checkbox]:focus + label,
|
|
774
|
-
.form-check [type=radio]:focus + label {
|
|
775
|
-
border-color: hsl(0, 0%, 0%) !important;
|
|
776
|
-
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
777
|
-
outline: 3px solid transparent !important;
|
|
778
|
-
outline-offset: 3px !important;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
.form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
782
|
-
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
783
|
-
border-color: inherit !important;
|
|
784
|
-
box-shadow: none !important;
|
|
785
|
-
outline: none !important;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
763
|
.form-control-plaintext {
|
|
789
764
|
border: 0;
|
|
790
765
|
--bsi-form-control-border-color: transparent;
|
|
@@ -803,7 +778,7 @@ input::-webkit-datetime-edit {
|
|
|
803
778
|
.form-control {
|
|
804
779
|
background-repeat: no-repeat;
|
|
805
780
|
background-position: center right;
|
|
806
|
-
background-size: 45px
|
|
781
|
+
background-size: 45px 20px;
|
|
807
782
|
}
|
|
808
783
|
.form-control:disabled {
|
|
809
784
|
cursor: not-allowed;
|
|
@@ -811,20 +786,6 @@ input::-webkit-datetime-edit {
|
|
|
811
786
|
border: 0;
|
|
812
787
|
color: var(--bsi-color-text-disabled);
|
|
813
788
|
}
|
|
814
|
-
.was-validated .form-control:valid, .form-control.is-valid {
|
|
815
|
-
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");
|
|
816
|
-
}
|
|
817
|
-
.was-validated .form-control:invalid, .form-control.is-invalid {
|
|
818
|
-
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");
|
|
819
|
-
border-color: var(--bsi-color-border-danger);
|
|
820
|
-
}
|
|
821
|
-
.form-control.warning {
|
|
822
|
-
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;
|
|
823
|
-
border-color: var(--bsi-color-border-warning);
|
|
824
|
-
}
|
|
825
|
-
.form-control.is-valid ~ .warning-feedback {
|
|
826
|
-
display: block;
|
|
827
|
-
}
|
|
828
789
|
|
|
829
790
|
.form-control-sm {
|
|
830
791
|
--bsi-form-control-spacing: var(--bsi-spacing-xxs) var(--bsi-spacing-3xs);
|
|
@@ -883,9 +844,6 @@ textarea.form-control-lg {
|
|
|
883
844
|
margin-top: 0.25rem;
|
|
884
845
|
font-size: 0.75rem;
|
|
885
846
|
}
|
|
886
|
-
.form-feedback.just-validate-error-label {
|
|
887
|
-
color: var(--bsi-color-text-danger);
|
|
888
|
-
}
|
|
889
847
|
|
|
890
848
|
.input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
|
|
891
849
|
[data-focus-mouse=true]:not(.btn) ~ .input-group-text,
|
|
@@ -907,20 +865,44 @@ button:has(~ .is-invalid),
|
|
|
907
865
|
display: none;
|
|
908
866
|
}
|
|
909
867
|
|
|
910
|
-
.
|
|
911
|
-
|
|
868
|
+
.is-valid,
|
|
869
|
+
.is-invalid {
|
|
912
870
|
padding-right: calc(1.5em + 0.75rem) !important;
|
|
913
|
-
|
|
871
|
+
}
|
|
872
|
+
.is-valid[type=number],
|
|
873
|
+
.is-invalid[type=number] {
|
|
874
|
+
padding-right: calc(1.5em + 0.75rem + var(--bsi-form-control-spacing) + 1rem) !important;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
.was-validated &:valid,
|
|
878
|
+
.is-valid {
|
|
879
|
+
border-color: var(--bsi-color-border-success) !important;
|
|
880
|
+
background-image: url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="%23008055" xmlns="http://www.w3.org/2000/svg"><path d="M9.6,16.9L4,11.4l0.8-0.7l4.8,4.8l8.5-8.4l0.7,0.7L9.6,16.9z" /></svg>');
|
|
881
|
+
}
|
|
882
|
+
.was-validated &:valid ~ .warning-feedback,
|
|
883
|
+
.is-valid ~ .warning-feedback {
|
|
884
|
+
display: block;
|
|
914
885
|
}
|
|
915
886
|
|
|
916
|
-
.
|
|
917
|
-
.
|
|
918
|
-
|
|
919
|
-
.
|
|
887
|
+
.was-validated &:invalid,
|
|
888
|
+
.is-invalid {
|
|
889
|
+
border-color: var(--bsi-color-border-danger) !important;
|
|
890
|
+
background-image: url('data:image/svg+xml,<svg width="24" fill="%23cc334d" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.7,12l6.7,6.6l-0.8,0.8L12,12.7l-6.6,6.7l-0.8-0.8l6.7-6.6L4.6,5.4l0.8-0.8l6.6,6.7l6.6-6.7l0.8,0.8L12.7,12z" /></svg>');
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
.form-control.warning {
|
|
894
|
+
border-color: var(--bsi-color-border-warning) !important;
|
|
895
|
+
background-image: url('data:image/svg+xml,<svg width="24" height="24" fill="%23995c00" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.5,17h-1V2h1V17z M12.5,20h-1v2h1V20z" /></svg>');
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
.input-group-text:has(~ .is-valid),
|
|
899
|
+
.is-valid ~ .input-group-text,
|
|
900
|
+
button:has(~ .is-valid),
|
|
901
|
+
.is-valid + button {
|
|
920
902
|
border-color: var(--bsi-color-border-success);
|
|
921
903
|
}
|
|
922
904
|
|
|
923
|
-
.
|
|
905
|
+
.is-valid + .input-group-text.align-buttons,
|
|
924
906
|
.is-invalid + .input-group-text.align-buttons {
|
|
925
907
|
right: 30px;
|
|
926
908
|
}
|
|
@@ -929,33 +911,132 @@ button:has(~ .just-validate-success-field),
|
|
|
929
911
|
bottom: 22px;
|
|
930
912
|
}
|
|
931
913
|
|
|
932
|
-
.autocomplete__wrapper .form-feedback
|
|
914
|
+
.autocomplete__wrapper .form-feedback {
|
|
933
915
|
position: absolute;
|
|
934
916
|
}
|
|
935
917
|
|
|
936
918
|
textarea.form-control {
|
|
937
|
-
background-position: top 0.
|
|
938
|
-
|
|
919
|
+
background-position: top 0.5em right !important;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
.text-primary {
|
|
923
|
+
--bsi-text-opacity: 1;
|
|
924
|
+
color: rgba(var(--bsi-primary-rgb), var(--bsi-text-opacity)) !important;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.text-secondary {
|
|
928
|
+
--bsi-text-opacity: 1;
|
|
929
|
+
color: hsl(210, 33%, 28%) !important;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
.text-success {
|
|
933
|
+
--bsi-text-opacity: 1;
|
|
934
|
+
color: rgba(var(--bsi-success-rgb), var(--bsi-text-opacity)) !important;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
.text-info {
|
|
938
|
+
--bsi-text-opacity: 1;
|
|
939
|
+
color: rgba(var(--bsi-info-rgb), var(--bsi-text-opacity)) !important;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
.text-warning {
|
|
943
|
+
--bsi-text-opacity: 1;
|
|
944
|
+
color: rgba(var(--bsi-warning-rgb), var(--bsi-text-opacity)) !important;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
.text-danger {
|
|
948
|
+
--bsi-text-opacity: 1;
|
|
949
|
+
color: rgba(var(--bsi-danger-rgb), var(--bsi-text-opacity)) !important;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
.text-light {
|
|
953
|
+
--bsi-text-opacity: 1;
|
|
954
|
+
color: rgba(var(--bsi-light-rgb), var(--bsi-text-opacity)) !important;
|
|
939
955
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
956
|
+
|
|
957
|
+
.text-dark {
|
|
958
|
+
--bsi-text-opacity: 1;
|
|
959
|
+
color: rgba(var(--bsi-dark-rgb), var(--bsi-text-opacity)) !important;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.text-black {
|
|
963
|
+
--bsi-text-opacity: 1;
|
|
964
|
+
color: rgba(var(--bsi-black-rgb), var(--bsi-text-opacity)) !important;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
.text-white {
|
|
968
|
+
--bsi-text-opacity: 1;
|
|
969
|
+
color: rgba(var(--bsi-white-rgb), var(--bsi-text-opacity)) !important;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
.text-100 {
|
|
973
|
+
--bsi-text-opacity: 1;
|
|
974
|
+
color: rgba(var(--bsi-100-rgb), var(--bsi-text-opacity)) !important;
|
|
943
975
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
976
|
+
|
|
977
|
+
.text-200 {
|
|
978
|
+
--bsi-text-opacity: 1;
|
|
979
|
+
color: rgba(var(--bsi-200-rgb), var(--bsi-text-opacity)) !important;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
.text-300 {
|
|
983
|
+
--bsi-text-opacity: 1;
|
|
984
|
+
color: rgba(var(--bsi-300-rgb), var(--bsi-text-opacity)) !important;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
.text-400 {
|
|
988
|
+
--bsi-text-opacity: 1;
|
|
989
|
+
color: rgba(var(--bsi-400-rgb), var(--bsi-text-opacity)) !important;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.text-500 {
|
|
993
|
+
--bsi-text-opacity: 1;
|
|
994
|
+
color: rgba(var(--bsi-500-rgb), var(--bsi-text-opacity)) !important;
|
|
947
995
|
}
|
|
948
996
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
--bsi-
|
|
997
|
+
.text-600 {
|
|
998
|
+
--bsi-text-opacity: 1;
|
|
999
|
+
color: rgba(var(--bsi-600-rgb), var(--bsi-text-opacity)) !important;
|
|
952
1000
|
}
|
|
953
1001
|
|
|
954
|
-
|
|
955
|
-
|
|
1002
|
+
.text-700 {
|
|
1003
|
+
--bsi-text-opacity: 1;
|
|
1004
|
+
color: rgba(var(--bsi-700-rgb), var(--bsi-text-opacity)) !important;
|
|
956
1005
|
}
|
|
957
|
-
|
|
958
|
-
|
|
1006
|
+
|
|
1007
|
+
.text-800 {
|
|
1008
|
+
--bsi-text-opacity: 1;
|
|
1009
|
+
color: rgba(var(--bsi-800-rgb), var(--bsi-text-opacity)) !important;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.text-900 {
|
|
1013
|
+
--bsi-text-opacity: 1;
|
|
1014
|
+
color: rgba(var(--bsi-900-rgb), var(--bsi-text-opacity)) !important;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
.text-body {
|
|
1018
|
+
--bsi-text-opacity: 1;
|
|
1019
|
+
color: rgba(var(--bsi-body-color-rgb), var(--bsi-text-opacity)) !important;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
.text-muted {
|
|
1023
|
+
--bsi-text-opacity: 1;
|
|
1024
|
+
color: hsl(210, 17%, 44%) !important;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.text-black-50 {
|
|
1028
|
+
--bsi-text-opacity: 1;
|
|
1029
|
+
color: rgba(0, 0, 0, 0.5) !important;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
.text-white-50 {
|
|
1033
|
+
--bsi-text-opacity: 1;
|
|
1034
|
+
color: rgba(255, 255, 255, 0.5) !important;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
.text-reset {
|
|
1038
|
+
--bsi-text-opacity: 1;
|
|
1039
|
+
color: inherit !important;
|
|
959
1040
|
}
|
|
960
1041
|
|
|
961
1042
|
:host {
|
|
@@ -1137,7 +1218,7 @@ class ItCheckboxGroupBase extends FormControl {
|
|
|
1137
1218
|
const validityMessageRender = html `<div
|
|
1138
1219
|
role="alert"
|
|
1139
1220
|
id="${errorId}"
|
|
1140
|
-
class="form-feedback
|
|
1221
|
+
class="form-feedback text-danger"
|
|
1141
1222
|
?hidden=${!(validityMessage?.length > 0)}
|
|
1142
1223
|
>
|
|
1143
1224
|
<span class="visually-hidden">${this._label?.[0]?.textContent || ''}: </span>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-checkbox-group-base.js","sources":["../../../src/it-checkbox-group-base.ts"],"sourcesContent":["import { FormControl, FormControlController } from '@italia/globals';\nimport { html, PropertyValues } from 'lit';\nimport { property, queryAssignedElements, state } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { ItCheckboxBase } from './it-checkbox-base.js';\nimport styles from './checkbox-group.scss';\n\nexport class ItCheckboxGroupBase extends FormControl {\n static styles = styles;\n\n @property({ type: Boolean, reflect: true })\n required = false;\n\n /** Draws checkboxes inline, side by side. */\n @property({ type: Boolean, reflect: true })\n inline = false;\n\n /** Draws checkboxes in groups. */\n @property({ type: Boolean, reflect: true })\n group = false;\n\n @property({ type: String, reflect: true })\n name = ''; // Il name del gruppo\n\n // Query per le checkbox assegnate nello slot\n @queryAssignedElements({ selector: 'it-checkbox' })\n checkboxes!: ItCheckboxBase[];\n\n @queryAssignedElements({ slot: 'legend' })\n private _label!: HTMLElement[];\n\n // Override del controller per usare le funzioni di validazione di gruppo\n protected override readonly formControlController: FormControlController = new FormControlController(this, {\n // Il valore è un array dei valori delle checkbox selezionate\n value: (control: FormControl) =>\n (control as ItCheckboxGroupBase).checkboxes.filter((cb) => cb.checked).map((cb) => cb.value || 'true'),\n // Il name è quello del gruppo\n name: (control: FormControl) => (control as ItCheckboxGroupBase).name,\n // La validità è gestita da noi con checkValidity di gruppo\n checkValidity: (control: FormControl) => (control as ItCheckboxGroupBase).checkValidity(),\n reportValidity: (control: FormControl) => (control as ItCheckboxGroupBase).reportValidity(),\n // Non implementiamo setValue qui, gestito dalle singole checkbox\n setValue: () => {},\n // Ascoltiamo l'input su tutti i cambi di stato delle checkbox\n assumeInteractionOn: ['it-change'],\n });\n\n // Questo state servirà per forzare il re-render del messaggio di errore\n @state()\n private _groupValid = true;\n\n get selectedValues(): string[] {\n if (!this.value) return [];\n try {\n return JSON.parse(this.value);\n } catch {\n return [];\n }\n }\n\n set selectedValues(vals: string[]) {\n this.value = JSON.stringify(vals);\n }\n\n public has(v: string) {\n return this.selectedValues.indexOf(v) >= 0;\n }\n\n override connectedCallback() {\n super.connectedCallback?.();\n this.addEventListener('it-change', this._handleGroupChange);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback?.();\n this.removeEventListener('it-change', this._handleGroupChange);\n }\n\n /**\n * Override: Custom validity check for radio group\n */\n override get validity(): ValidityState {\n // Fallback: create a custom ValidityState-like object\n const valid = !this.required || !!this.value;\n return {\n valid,\n valueMissing: this.required && !this.value,\n typeMismatch: false,\n patternMismatch: false,\n tooLong: false,\n tooShort: false,\n rangeUnderflow: false,\n rangeOverflow: false,\n stepMismatch: false,\n badInput: false,\n customError: this.customValidation && this.validationText?.length > 0,\n } as ValidityState;\n }\n\n // Ascolta gli 'it-change' bubblati dalle singole checkbox\n private _handleGroupChange() {\n // Aggiorna this.value con l'array corrente delle checkbox selezionate\n const selected = this.checkboxes.filter((cb) => cb.checked).map((cb) => cb.value || 'true');\n\n this.value = JSON.stringify(selected);\n\n // Quando qualcosa cambia, ricalcola la validità\n this.handleValidationMessages();\n this.requestUpdate(); // Aggiorna la vista\n }\n\n /**\n * Override di checkValidity per la logica di gruppo.\n */\n override checkValidity(): boolean {\n if (!this.required) {\n return true; // Non è obbligatorio\n }\n\n // Almeno una checkbox deve essere selezionata\n const atLeastOneChecked = this.checkboxes.some((cb) => cb.checked);\n\n // Aggiorna lo stato di validità del gruppo\n this._groupValid = atLeastOneChecked;\n\n return atLeastOneChecked;\n }\n\n /**\n * Override di reportValidity per mostrare l'errore a livello di gruppo.\n */\n override reportValidity(): boolean {\n // Chiama la logica di validazione personalizzata\n const isValid = this.checkValidity();\n\n // Aggiorna il messaggio di validazione se invalido\n if (!isValid) {\n this.validationMessage = this.$t('validityGroupRequired'); // Usa la tua chiave di traduzione per \"Campo obbligatorio\"\n } else {\n this.validationMessage = '';\n }\n\n // Forzare l'aggiornamento di FormControlController che gestirà data-invalid/data-valid\n this.formControlController.updateValidity();\n this.requestUpdate();\n\n return isValid;\n }\n\n /**\n * Il tuo FormControl ha già un handleValidationMessages che\n * setta this.validationMessage. Aggiorniamolo per la logica di gruppo.\n */\n protected override handleValidationMessages() {\n if (!this.customValidation && this.formControlController.submittedOnce) {\n this.validationMessage = this.checkValidity() ? '' : this.$t('validityGroupRequired');\n }\n if (this.customValidation) {\n this.validationMessage = this.inputElement.validationMessage;\n }\n }\n\n /**\n * Sync group state (name, grouped, inline, required, disabled, checked) to child checkboxes\n * This replaces the need for requestUpdate() calls\n */\n private _syncGroupStateToChildren() {\n if (!this.checkboxes || this.checkboxes.length === 0) {\n return;\n }\n\n this.checkboxes.forEach((cb) => {\n // eslint-disable-next-line no-param-reassign\n cb.name = this.name;\n // eslint-disable-next-line no-param-reassign\n cb.group = this.group || !this.inline;\n // eslint-disable-next-line no-param-reassign\n cb.inline = this.inline;\n // eslint-disable-next-line no-param-reassign\n cb.required = this.required;\n\n if (this.disabled) {\n // eslint-disable-next-line no-param-reassign\n cb.disabled = this.disabled;\n }\n if (!cb.hasAttribute('checked')) {\n // eslint-disable-next-line no-param-reassign\n cb.checked = this.has(cb.value);\n }\n });\n }\n\n updated(changed: PropertyValues) {\n super.updated(changed);\n\n // Update radios when value or name changes\n if (changed.has('value') || (changed.has('validationText') && this.customValidation)) {\n // Re-validate after value change (for native validation) only if validation was already triggered\n\n this.handleValidationMessages();\n }\n\n // If relevant group properties changed, sync to child checkboxes\n const relevant = ['group', 'inline', 'name', 'required', 'disabled', 'value'];\n const hasChanged = Array.from(changed.keys()).some((k) => relevant.includes(String(k)));\n if (hasChanged && this.checkboxes?.length) {\n this._syncGroupStateToChildren();\n }\n }\n\n // Render per mostrare l'errore (usa la tua logica di rendering dell'errore)\n // All'interno di ItCheckboxGroup (metodo render)\n\n override render() {\n const showValidation = this.formControlController.submittedOnce || this.customValidation; // true; // this._touched || this.customValidation;\n const validityMessage = (showValidation ? this.validationMessage : '') ?? '';\n\n // Determina lo stato di invalidità in base alla validazione di gruppo\n const invalid = validityMessage?.length > 0 || !this._groupValid;\n\n const errorId = `invalid-feedback-${this._id}`;\n\n // Messaggio di validazione per il gruppo\n const validityMessageRender = html`<div\n role=\"alert\"\n id=\"${errorId}\"\n class=\"form-feedback just-validate-error-label\"\n ?hidden=${!(validityMessage?.length > 0)}\n >\n <span class=\"visually-hidden\">${this._label?.[0]?.textContent || ''}: </span>\n ${validityMessage}\n </div>`;\n\n // il pattern per errori nel form è stato preso da qui https://design-system.w3.org/styles/form-errors.html\n return html`\n <fieldset\n class=\"it-checkbox-group it-form__control\"\n id=\"${this._id}\"\n aria-describedby=${ifDefined(invalid ? errorId : undefined)}\n aria-required=${ifDefined(this.required ? 'true' : undefined)}\n part=\"fieldset\"\n >\n <legend part=\"legend\">\n <slot name=\"legend\"></slot>\n </legend>\n\n <slot @slotchange=${this._handleSlotChange}></slot>\n ${when(invalid, () => validityMessageRender)}\n </fieldset>\n `;\n }\n\n public override setCustomValidity(message: string) {\n if (!this.customValidation) {\n this.inputElement.setCustomValidity(message);\n this.validationMessage = this.inputElement.validationMessage;\n } else {\n this.validationMessage = message;\n }\n this.formControlController.updateValidity();\n }\n\n // Metodo per gestire l'assegnazione iniziale e re-assegnazione delle checkbox\n private _handleSlotChange() {\n // Dopo l'assegnazione, forziamo un controllo di validità per inizializzare _groupValid\n this.handleValidationMessages();\n this.requestUpdate();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAC1B,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAIjB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC5B,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAIf,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC7B,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAGd,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAChC,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAIV,UAAA,CAAA;AADC,IAAA,qBAAqB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;;AACrB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAGtB,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;AACX,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAoBvB,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;;AACmB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"it-checkbox-group-base.js","sources":["../../../src/it-checkbox-group-base.ts"],"sourcesContent":["import { FormControl, FormControlController } from '@italia/globals';\nimport { html, PropertyValues } from 'lit';\nimport { property, queryAssignedElements, state } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { ItCheckboxBase } from './it-checkbox-base.js';\nimport styles from './checkbox-group.scss';\n\nexport class ItCheckboxGroupBase extends FormControl {\n static styles = styles;\n\n @property({ type: Boolean, reflect: true })\n required = false;\n\n /** Draws checkboxes inline, side by side. */\n @property({ type: Boolean, reflect: true })\n inline = false;\n\n /** Draws checkboxes in groups. */\n @property({ type: Boolean, reflect: true })\n group = false;\n\n @property({ type: String, reflect: true })\n name = ''; // Il name del gruppo\n\n // Query per le checkbox assegnate nello slot\n @queryAssignedElements({ selector: 'it-checkbox' })\n checkboxes!: ItCheckboxBase[];\n\n @queryAssignedElements({ slot: 'legend' })\n private _label!: HTMLElement[];\n\n // Override del controller per usare le funzioni di validazione di gruppo\n protected override readonly formControlController: FormControlController = new FormControlController(this, {\n // Il valore è un array dei valori delle checkbox selezionate\n value: (control: FormControl) =>\n (control as ItCheckboxGroupBase).checkboxes.filter((cb) => cb.checked).map((cb) => cb.value || 'true'),\n // Il name è quello del gruppo\n name: (control: FormControl) => (control as ItCheckboxGroupBase).name,\n // La validità è gestita da noi con checkValidity di gruppo\n checkValidity: (control: FormControl) => (control as ItCheckboxGroupBase).checkValidity(),\n reportValidity: (control: FormControl) => (control as ItCheckboxGroupBase).reportValidity(),\n // Non implementiamo setValue qui, gestito dalle singole checkbox\n setValue: () => {},\n // Ascoltiamo l'input su tutti i cambi di stato delle checkbox\n assumeInteractionOn: ['it-change'],\n });\n\n // Questo state servirà per forzare il re-render del messaggio di errore\n @state()\n private _groupValid = true;\n\n get selectedValues(): string[] {\n if (!this.value) return [];\n try {\n return JSON.parse(this.value);\n } catch {\n return [];\n }\n }\n\n set selectedValues(vals: string[]) {\n this.value = JSON.stringify(vals);\n }\n\n public has(v: string) {\n return this.selectedValues.indexOf(v) >= 0;\n }\n\n override connectedCallback() {\n super.connectedCallback?.();\n this.addEventListener('it-change', this._handleGroupChange);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback?.();\n this.removeEventListener('it-change', this._handleGroupChange);\n }\n\n /**\n * Override: Custom validity check for radio group\n */\n override get validity(): ValidityState {\n // Fallback: create a custom ValidityState-like object\n const valid = !this.required || !!this.value;\n return {\n valid,\n valueMissing: this.required && !this.value,\n typeMismatch: false,\n patternMismatch: false,\n tooLong: false,\n tooShort: false,\n rangeUnderflow: false,\n rangeOverflow: false,\n stepMismatch: false,\n badInput: false,\n customError: this.customValidation && this.validationText?.length > 0,\n } as ValidityState;\n }\n\n // Ascolta gli 'it-change' bubblati dalle singole checkbox\n private _handleGroupChange() {\n // Aggiorna this.value con l'array corrente delle checkbox selezionate\n const selected = this.checkboxes.filter((cb) => cb.checked).map((cb) => cb.value || 'true');\n\n this.value = JSON.stringify(selected);\n\n // Quando qualcosa cambia, ricalcola la validità\n this.handleValidationMessages();\n this.requestUpdate(); // Aggiorna la vista\n }\n\n /**\n * Override di checkValidity per la logica di gruppo.\n */\n override checkValidity(): boolean {\n if (!this.required) {\n return true; // Non è obbligatorio\n }\n\n // Almeno una checkbox deve essere selezionata\n const atLeastOneChecked = this.checkboxes.some((cb) => cb.checked);\n\n // Aggiorna lo stato di validità del gruppo\n this._groupValid = atLeastOneChecked;\n\n return atLeastOneChecked;\n }\n\n /**\n * Override di reportValidity per mostrare l'errore a livello di gruppo.\n */\n override reportValidity(): boolean {\n // Chiama la logica di validazione personalizzata\n const isValid = this.checkValidity();\n\n // Aggiorna il messaggio di validazione se invalido\n if (!isValid) {\n this.validationMessage = this.$t('validityGroupRequired'); // Usa la tua chiave di traduzione per \"Campo obbligatorio\"\n } else {\n this.validationMessage = '';\n }\n\n // Forzare l'aggiornamento di FormControlController che gestirà data-invalid/data-valid\n this.formControlController.updateValidity();\n this.requestUpdate();\n\n return isValid;\n }\n\n /**\n * Il tuo FormControl ha già un handleValidationMessages che\n * setta this.validationMessage. Aggiorniamolo per la logica di gruppo.\n */\n protected override handleValidationMessages() {\n if (!this.customValidation && this.formControlController.submittedOnce) {\n this.validationMessage = this.checkValidity() ? '' : this.$t('validityGroupRequired');\n }\n if (this.customValidation) {\n this.validationMessage = this.inputElement.validationMessage;\n }\n }\n\n /**\n * Sync group state (name, grouped, inline, required, disabled, checked) to child checkboxes\n * This replaces the need for requestUpdate() calls\n */\n private _syncGroupStateToChildren() {\n if (!this.checkboxes || this.checkboxes.length === 0) {\n return;\n }\n\n this.checkboxes.forEach((cb) => {\n // eslint-disable-next-line no-param-reassign\n cb.name = this.name;\n // eslint-disable-next-line no-param-reassign\n cb.group = this.group || !this.inline;\n // eslint-disable-next-line no-param-reassign\n cb.inline = this.inline;\n // eslint-disable-next-line no-param-reassign\n cb.required = this.required;\n\n if (this.disabled) {\n // eslint-disable-next-line no-param-reassign\n cb.disabled = this.disabled;\n }\n if (!cb.hasAttribute('checked')) {\n // eslint-disable-next-line no-param-reassign\n cb.checked = this.has(cb.value);\n }\n });\n }\n\n updated(changed: PropertyValues) {\n super.updated(changed);\n\n // Update radios when value or name changes\n if (changed.has('value') || (changed.has('validationText') && this.customValidation)) {\n // Re-validate after value change (for native validation) only if validation was already triggered\n\n this.handleValidationMessages();\n }\n\n // If relevant group properties changed, sync to child checkboxes\n const relevant = ['group', 'inline', 'name', 'required', 'disabled', 'value'];\n const hasChanged = Array.from(changed.keys()).some((k) => relevant.includes(String(k)));\n if (hasChanged && this.checkboxes?.length) {\n this._syncGroupStateToChildren();\n }\n }\n\n // Render per mostrare l'errore (usa la tua logica di rendering dell'errore)\n // All'interno di ItCheckboxGroup (metodo render)\n\n override render() {\n const showValidation = this.formControlController.submittedOnce || this.customValidation; // true; // this._touched || this.customValidation;\n const validityMessage = (showValidation ? this.validationMessage : '') ?? '';\n\n // Determina lo stato di invalidità in base alla validazione di gruppo\n const invalid = validityMessage?.length > 0 || !this._groupValid;\n\n const errorId = `invalid-feedback-${this._id}`;\n\n // Messaggio di validazione per il gruppo\n const validityMessageRender = html`<div\n role=\"alert\"\n id=\"${errorId}\"\n class=\"form-feedback text-danger\"\n ?hidden=${!(validityMessage?.length > 0)}\n >\n <span class=\"visually-hidden\">${this._label?.[0]?.textContent || ''}: </span>\n ${validityMessage}\n </div>`;\n\n // il pattern per errori nel form è stato preso da qui https://design-system.w3.org/styles/form-errors.html\n return html`\n <fieldset\n class=\"it-checkbox-group it-form__control\"\n id=\"${this._id}\"\n aria-describedby=${ifDefined(invalid ? errorId : undefined)}\n aria-required=${ifDefined(this.required ? 'true' : undefined)}\n part=\"fieldset\"\n >\n <legend part=\"legend\">\n <slot name=\"legend\"></slot>\n </legend>\n\n <slot @slotchange=${this._handleSlotChange}></slot>\n ${when(invalid, () => validityMessageRender)}\n </fieldset>\n `;\n }\n\n public override setCustomValidity(message: string) {\n if (!this.customValidation) {\n this.inputElement.setCustomValidity(message);\n this.validationMessage = this.inputElement.validationMessage;\n } else {\n this.validationMessage = message;\n }\n this.formControlController.updateValidity();\n }\n\n // Metodo per gestire l'assegnazione iniziale e re-assegnazione delle checkbox\n private _handleSlotChange() {\n // Dopo l'assegnazione, forziamo un controllo di validità per inizializzare _groupValid\n this.handleValidationMessages();\n this.requestUpdate();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,IAAI,EAAE,CAAC;;AAC7B,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAGd,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAChC,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAIV,UAAA,CAAA;AADC,IAAA,qBAAqB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;;AACrB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAGtB,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;AACX,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAoBvB,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;;AACmB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;;;;"}
|
package/dist/src/it-checkbox.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@italia/checkbox",
|
|
3
3
|
"description": "Web component it-checkbox del Design system .italia",
|
|
4
|
-
"version": "1.0.0-
|
|
4
|
+
"version": "1.0.0-beta.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -36,36 +36,36 @@
|
|
|
36
36
|
"custom-elements.json",
|
|
37
37
|
"styles"
|
|
38
38
|
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"analyze": "cem analyze --litelement --exclude dist",
|
|
41
|
+
"build": "rollup --config rollup.config.js",
|
|
42
|
+
"clean": "rimraf node_modules .turbo .rollup.cache dist coverage",
|
|
43
|
+
"prepublish": "pnpm build",
|
|
44
|
+
"lint": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && stylelint \"src/**/*.scss\" && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --check",
|
|
45
|
+
"format": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --fix && stylelint \"src/**/*.scss\" --fix && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --write",
|
|
46
|
+
"test": "wtr --coverage --node-resolve --config web-test-runner.config.js"
|
|
47
|
+
},
|
|
39
48
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
49
|
+
"@italia/globals": "workspace:^",
|
|
50
|
+
"@italia/i18n": "workspace:^",
|
|
51
|
+
"bootstrap-italia": "catalog:",
|
|
52
|
+
"lit": "catalog:"
|
|
44
53
|
},
|
|
45
54
|
"devDependencies": {
|
|
46
55
|
"@custom-elements-manifest/analyzer": "^0.10.3",
|
|
47
|
-
"@
|
|
56
|
+
"@italia/test-config": "workspace:^",
|
|
57
|
+
"@italia/typescript-config": "workspace:^",
|
|
58
|
+
"@open-wc/testing": "catalog:",
|
|
48
59
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
49
60
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
50
|
-
"@types/mocha": "
|
|
51
|
-
"@web/test-runner": "
|
|
61
|
+
"@types/mocha": "catalog:",
|
|
62
|
+
"@web/test-runner": "catalog:",
|
|
52
63
|
"rimraf": "^6.0.1",
|
|
53
64
|
"rollup": "^4.42.0",
|
|
54
65
|
"rollup-plugin-scss-lit": "^2.1.0",
|
|
55
|
-
"sass": "
|
|
66
|
+
"sass": "catalog:",
|
|
56
67
|
"tslib": "^2.6.3",
|
|
57
|
-
"typescript": "
|
|
58
|
-
"@italia/test-config": "^0.0.0",
|
|
59
|
-
"@italia/typescript-config": "^0.0.0"
|
|
68
|
+
"typescript": "catalog:"
|
|
60
69
|
},
|
|
61
|
-
"customElements": "custom-elements.json"
|
|
62
|
-
|
|
63
|
-
"analyze": "cem analyze --litelement --exclude dist",
|
|
64
|
-
"build": "rollup --config rollup.config.js",
|
|
65
|
-
"clean": "rimraf node_modules .turbo .rollup.cache dist coverage",
|
|
66
|
-
"prepublish": "pnpm build",
|
|
67
|
-
"lint": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" && stylelint \"src/**/*.scss\" && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --check",
|
|
68
|
-
"format": "eslint --ext .ts \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --fix && stylelint \"src/**/*.scss\" --fix && prettier \"src/**/*.ts\" \"stories/**/*.ts\" \"test/**/*.ts\" --write",
|
|
69
|
-
"test": "wtr --coverage --node-resolve --config web-test-runner.config.js"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
70
|
+
"customElements": "custom-elements.json"
|
|
71
|
+
}
|