@italia/toggle 1.0.0-beta.7 → 1.0.0-beta.8

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.
@@ -319,6 +319,7 @@ progress {
319
319
  --bsi-form-control-label-color: var(--bsi-color-text-base);
320
320
  --bsi-form-control-text-color: var(--bsi-color-text-secondary);
321
321
  --bsi-form-control-font-size: var(--bsi-body-font-size);
322
+ --bsi-form-select-indicator: 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");
322
323
  --bsi-form-group-spacing-y: var(--bsi-spacing-m);
323
324
  --bsi-form-checkbox-border-color: var(--bsi-color-border-secondary);
324
325
  --bsi-form-checkbox-border-radius: var(--bsi-radius-smooth);
@@ -345,6 +346,7 @@ select {
345
346
  background-color: var(--bsi-form-control-background-color);
346
347
  color: var(--bsi-form-control-text-color);
347
348
  font-size: var(--bsi-form-control-font-size);
349
+ line-height: var(--bsi-font-leading-2);
348
350
  }
349
351
  input.disabled, input:disabled,
350
352
  textarea.disabled,
@@ -357,48 +359,44 @@ select:disabled {
357
359
  color: var(--bsi-color-text-disabled);
358
360
  }
359
361
 
362
+ input,
363
+ select {
364
+ padding-block: var(--bsi-spacing-3xs);
365
+ }
366
+
360
367
  /* stylelint-disable-next-line no-duplicate-selectors */
361
368
  input:focus,
362
369
  textarea:focus {
363
- outline: 3px solid transparent;
370
+ outline: var(--bsi-focus-outer-width) solid transparent;
364
371
  outline-offset: 3px;
365
- box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
372
+ box-shadow: 0 0 0 var(--bsi-focus-inner-width) var(--bsi-focus-inner-color), 0 0 0 calc(var(--bsi-focus-inner-width) + var(--bsi-focus-outer-width)) var(--bsi-focus-outer-color) !important;
366
373
  }
367
374
 
368
375
  input::file-selector-button {
369
- margin: -0.375rem -0.75rem;
370
- padding: 0.375rem 0.75rem;
371
- border-width: 0;
372
- border-style: solid;
376
+ margin: 0;
377
+ padding: 0;
378
+ padding-inline-end: var(--bsi-spacing-m);
379
+ border: 0;
373
380
  border-radius: 0;
374
- border-color: inherit;
375
- color: hsl(0, 0%, 10%);
381
+ color: var(--bsi-color-text-base);
382
+ background-color: transparent;
376
383
  pointer-events: none;
377
- margin-inline-end: 0.75rem;
378
- border-inline-end-width: 0;
379
- background-color: hsl(0, 0%, 100%);
380
- transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
381
- }
382
- @media (prefers-reduced-motion: reduce) {
383
- input::file-selector-button {
384
- transition: none;
385
- }
386
- }
387
- input:hover:not(:disabled):not([readonly])::file-selector-button {
388
- background-color: rgb(95%, 95%, 95%);
389
384
  }
390
385
  input[type=file] {
391
386
  overflow: hidden;
387
+ padding-block: max(0px, (var(--bsi-form-control-height) - 1lh - 2px) / 2);
392
388
  }
393
389
  input[type=file]:not(:disabled):not([readonly]) {
394
390
  cursor: pointer;
395
391
  }
396
392
  input::-webkit-date-and-time-value {
397
- height: 1.5em;
393
+ height: 1lh;
394
+ padding-block: max(0px, (var(--bsi-form-control-height) - 2px - 2 * var(--bsi-spacing-3xs) - 1lh) / 2);
395
+ text-align: start;
398
396
  }
399
397
 
400
398
  select {
401
- 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");
399
+ background-image: var(--bsi-form-select-indicator, 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"));
402
400
  background-repeat: no-repeat;
403
401
  background-position: right var(--bsi-form-control-spacing) center;
404
402
  background-size: 16px 12px;
@@ -569,9 +567,9 @@ input::-webkit-datetime-edit {
569
567
  }
570
568
  .form-check [type=checkbox]:focus + label,
571
569
  .form-check [type=radio]:focus + label {
572
- border-color: hsl(0, 0%, 0%) !important;
573
- box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
574
- outline: 3px solid transparent !important;
570
+ border-color: var(--bsi-focus-outer-color) !important;
571
+ box-shadow: 0 0 0 var(--bsi-focus-inner-width) var(--bsi-focus-inner-color), 0 0 0 calc(var(--bsi-focus-inner-width) + var(--bsi-focus-outer-width)) var(--bsi-focus-outer-color) !important;
572
+ outline: var(--bsi-focus-outer-width) solid transparent !important;
575
573
  outline-offset: 3px !important;
576
574
  }
577
575
  .form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
@@ -592,12 +590,14 @@ input::-webkit-datetime-edit {
592
590
  }
593
591
  .form-check input[type=checkbox] + label::after {
594
592
  top: 0;
593
+ top: max(0px, (1lh - 20px) / 2);
595
594
  width: 20px;
596
595
  height: 20px;
597
596
  border-radius: var(--bsi-form-checkbox-border-radius);
598
597
  }
599
598
  .form-check input[type=checkbox]:checked + label::before {
600
599
  top: 3px;
600
+ top: calc(3px + max(0px, (1lh - 20px) / 2));
601
601
  left: 3px;
602
602
  width: 6px;
603
603
  height: 12px;
@@ -621,6 +621,7 @@ input::-webkit-datetime-edit {
621
621
  }
622
622
  .form-check input[type=checkbox]:not(:checked) + label::before {
623
623
  top: 10px;
624
+ top: calc(10px + max(0px, (1lh - 20px) / 2));
624
625
  left: 6px;
625
626
  width: 0;
626
627
  height: 0;
@@ -644,6 +645,7 @@ input::-webkit-datetime-edit {
644
645
  .form-check input[type=radio] + label::after, .form-check input[type=radio] + label::before {
645
646
  position: absolute;
646
647
  top: 0;
648
+ top: max(0px, (1lh - 20px) / 2);
647
649
  left: 0;
648
650
  z-index: 0;
649
651
  content: "";
@@ -656,6 +658,7 @@ input::-webkit-datetime-edit {
656
658
  }
657
659
  .form-check input[type=radio] + label::after {
658
660
  top: 4px;
661
+ top: calc(4px + max(0px, (1lh - 20px) / 2));
659
662
  left: 4px;
660
663
  width: 12px;
661
664
  height: 12px;
@@ -730,6 +733,7 @@ input::-webkit-datetime-edit {
730
733
  }
731
734
  .form-check input.semi-checked:not(:checked) + label::before {
732
735
  top: 12px;
736
+ top: calc(12px + max(0px, (1lh - 20px) / 2));
733
737
  left: 4px;
734
738
  width: 12px;
735
739
  height: 2px;
@@ -800,52 +804,12 @@ input::-webkit-datetime-edit {
800
804
  --bsi-form-control-spacing: var(--bsi-spacing-xxs) var(--bsi-spacing-3xs);
801
805
  --bsi-form-control-font-size: var(--bsi-label-font-size);
802
806
  }
803
- .form-control-sm::file-selector-button {
804
- padding: 0.25rem 0.5rem;
805
- margin: -0.25rem -0.5rem;
806
- margin-inline-end: 0.5rem;
807
- }
808
807
 
809
808
  .form-control-lg {
810
809
  --bsi-form-control-font-size: var(--bsi-lead-font-size);
811
810
  }
812
- .form-control-lg::file-selector-button {
813
- padding: 0.5rem 1rem;
814
- margin: -0.5rem -1rem;
815
- margin-inline-end: 1rem;
816
- }
817
-
818
- textarea.form-control {
819
- min-height: 2.5rem;
820
- border: 1px solid hsl(210, 17%, 44%);
821
- }
822
- textarea.form-control-sm {
823
- min-height: calc(1.5em + 0.5rem);
824
- }
825
- textarea.form-control-lg {
826
- min-height: calc(1.5em + 1rem);
827
- }
828
-
829
- .form-control-color {
830
- width: 3rem;
831
- height: 2.5rem;
832
- padding: 0.375rem;
833
- }
834
- .form-control-color:not(:disabled):not([readonly]) {
835
- cursor: pointer;
836
- }
837
- .form-control-color::-moz-color-swatch {
838
- border: 0 !important;
839
- border-radius: 0;
840
- }
841
- .form-control-color::-webkit-color-swatch {
842
- border-radius: 0;
843
- }
844
- .form-control-color.form-control-sm {
845
- height: calc(1.5em + 0.5rem);
846
- }
847
- .form-control-color.form-control-lg {
848
- height: calc(1.5em + 1rem);
811
+ .form-control-lg, .form-control-lg + .password-icon {
812
+ --bsi-form-control-height: 3rem;
849
813
  }
850
814
 
851
815
  .toggles {
@@ -853,10 +817,10 @@ textarea.form-control-lg {
853
817
  --bsi-toggle-track-height: 32px;
854
818
  --bsi-toggle-track-border-radius: var(--bsi-radius-rounded);
855
819
  --bsi-toggle-track-background: var(--bsi-color-background-secondary-light);
856
- --bsi-toggle-track-background-checked: var(
820
+ --bsi-toggle-track-checked-background: var(
857
821
  --bsi-color-background-primary
858
822
  );
859
- --bsi-toggle-track-background-disabled: var(
823
+ --bsi-toggle-track-disabled-background: var(
860
824
  --bsi-color-background-disabled
861
825
  );
862
826
  --bsi-toggle-track-transition: background 0.3s ease;
@@ -865,10 +829,10 @@ textarea.form-control-lg {
865
829
  --bsi-toggle-knob-border-radius: 50%;
866
830
  --bsi-toggle-knob-background: var(--bsi-color-background-inverse);
867
831
  --bsi-toggle-knob-shadow-color: hsla(210, 100%, 40%, 0.15);
868
- --bsi-toggle-knob-background-disabled: var(
832
+ --bsi-toggle-knob-disabled-background: var(
869
833
  --bsi-color-background-secondary
870
834
  );
871
- --bsi-toggle-knob-offset-checked: 28px;
835
+ --bsi-toggle-knob-checked-offset: 28px;
872
836
  --bsi-toggle-knob-transition: left 0.3s ease, background 0.1s ease, transform 0.1s ease;
873
837
  --bsi-toggle-label-spacing: var(--bsi-spacing-xs);
874
838
  }
@@ -897,9 +861,9 @@ textarea.form-control-lg {
897
861
  left: 0;
898
862
  }
899
863
  .toggles label input[type=checkbox]:focus + .lever {
900
- border-color: hsl(0, 0%, 0%) !important;
901
- box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
902
- outline: 3px solid transparent !important;
864
+ border-color: var(--bsi-focus-outer-color) !important;
865
+ box-shadow: 0 0 0 var(--bsi-focus-inner-width) var(--bsi-focus-inner-color), 0 0 0 calc(var(--bsi-focus-inner-width) + var(--bsi-focus-outer-width)) var(--bsi-focus-outer-color) !important;
866
+ outline: var(--bsi-focus-outer-width) solid transparent !important;
903
867
  outline-offset: 3px !important;
904
868
  }
905
869
  .toggles label input[type=checkbox]:focus[data-focus-mouse=true] + .lever {
@@ -935,20 +899,20 @@ textarea.form-control-lg {
935
899
  background-color: var(--bsi-toggle-knob-background);
936
900
  }
937
901
  .toggles label input[type=checkbox]:checked + .lever {
938
- background-color: var(--bsi-toggle-track-background-checked);
902
+ background-color: var(--bsi-toggle-track-checked-background);
939
903
  }
940
904
  .toggles label input[type=checkbox]:checked + .lever:before, .toggles label input[type=checkbox]:checked + .lever:after {
941
- left: var(--bsi-toggle-knob-offset-checked);
905
+ left: var(--bsi-toggle-knob-checked-offset);
942
906
  }
943
907
  [disabled] .toggles label input[type=checkbox] + .lever, .toggles label input[type=checkbox][disabled] + .lever {
944
- background-color: var(--bsi-toggle-track-background-disabled);
908
+ background-color: var(--bsi-toggle-track-disabled-background);
945
909
  cursor: default;
946
910
  }
947
911
  [disabled] .toggles label input[type=checkbox] + .lever:after, .toggles label input[type=checkbox][disabled] + .lever:after {
948
- background-color: var(--bsi-toggle-knob-background-disabled);
912
+ background-color: var(--bsi-toggle-knob-disabled-background);
949
913
  }
950
914
  [disabled] .toggles label input[type=checkbox]:checked + .lever:after, .toggles label input[type=checkbox][disabled]:checked + .lever:after {
951
- background-color: var(--bsi-toggle-knob-background-disabled);
915
+ background-color: var(--bsi-toggle-knob-disabled-background);
952
916
  }
953
917
 
954
918
  .form-feedback {
@@ -957,21 +921,26 @@ textarea.form-control-lg {
957
921
  font-size: 0.75rem;
958
922
  }
959
923
 
960
- .input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
961
- [data-focus-mouse=true]:not(.btn) ~ .input-group-text,
962
- button:has(~ [data-focus-mouse=true]:not(.btn)),
963
- [data-focus-mouse=true]:not(.btn) + button {
924
+ .input-group .input-group-text:has(~ [data-focus-mouse=true]:not(.btn)),
925
+ .input-group [data-focus-mouse=true]:not(.btn) ~ .input-group-text,
926
+ .input-group button:has(~ [data-focus-mouse=true]:not(.btn)),
927
+ .input-group [data-focus-mouse=true]:not(.btn) + button {
964
928
  border-color: inherit !important;
965
929
  box-shadow: none !important;
966
930
  outline: none !important;
967
931
  }
968
-
969
- .input-group-text:has(~ .is-invalid),
970
- .is-invalid ~ .input-group-text,
971
- button:has(~ .is-invalid),
972
- .is-invalid + button {
932
+ .input-group .input-group-text:has(~ .is-invalid),
933
+ .input-group .is-invalid ~ .input-group-text,
934
+ .input-group button:has(~ .is-invalid),
935
+ .input-group .is-invalid + button {
973
936
  border-color: var(--bsi-color-border-danger) !important;
974
937
  }
938
+ .input-group .input-group-text:has(~ .is-valid),
939
+ .input-group .is-valid ~ .input-group-text,
940
+ .input-group button:has(~ .is-valid),
941
+ .input-group .is-valid + button {
942
+ border-color: var(--bsi-color-border-success);
943
+ }
975
944
 
976
945
  .sr-only-justvalidate-bi {
977
946
  display: none;
@@ -1010,13 +979,6 @@ button:has(~ .is-invalid),
1010
979
  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>');
1011
980
  }
1012
981
 
1013
- .input-group-text:has(~ .is-valid),
1014
- .is-valid ~ .input-group-text,
1015
- button:has(~ .is-valid),
1016
- .is-valid + button {
1017
- border-color: var(--bsi-color-border-success);
1018
- }
1019
-
1020
982
  .is-valid + .input-group-text.align-buttons,
1021
983
  .is-invalid + .input-group-text.align-buttons {
1022
984
  right: 30px;
@@ -1052,9 +1014,9 @@ textarea.form-control {
1052
1014
  outline: none !important;
1053
1015
  }
1054
1016
  .toggles label:has(input[type=checkbox]:focus-visible) {
1055
- border-color: hsl(0, 0%, 0%) !important;
1056
- box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
1057
- outline: 3px solid transparent !important;
1017
+ border-color: var(--bsi-focus-outer-color) !important;
1018
+ box-shadow: 0 0 0 var(--bsi-focus-inner-width) var(--bsi-focus-inner-color), 0 0 0 calc(var(--bsi-focus-inner-width) + var(--bsi-focus-outer-width)) var(--bsi-focus-outer-color) !important;
1019
+ outline: var(--bsi-focus-outer-width) solid transparent !important;
1058
1020
  outline-offset: 3px !important;
1059
1021
  }
1060
1022
  .toggles label:has(input[type=checkbox]:focus-visible) input,
@@ -1 +1 @@
1
- {"version":3,"file":"it-toggle.js","sources":["../../../src/it-toggle.ts"],"sourcesContent":["import { customElement } from 'lit/decorators.js';\nimport { html } from 'lit';\nimport { ItCheckboxBase } from '@italia/checkbox/it-checkbox-base.js';\n\nimport styles from './toggle.scss';\n\n/**\n * @element it-toggle\n */\n@customElement('it-toggle')\nexport class ItToggle extends ItCheckboxBase {\n static override styles = [ItCheckboxBase.styles, styles];\n\n type = 'checkbox'; // Toggle is still a checkbox input type\n\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 return html`\n <div class=\"${wrapperClasses}\" part=\"toggle-wrapper input-wrapper\">\n <div class=\"toggles\">\n <label for=\"${this._id}\" part=\"label focusable\">\n <slot name=\"label\"></slot>\n ${this._renderInput(supportTextId, invalid, validityMessage)}\n <span class=\"lever\"></span>\n </label>\n </div>\n ${validityMessageRender} ${supportTextRender}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-toggle': ItToggle;\n }\n}\n"],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ourcesContent":["import { customElement } from 'lit/decorators.js';\nimport { html } from 'lit';\nimport { ItCheckboxBase } from '@italia/checkbox/it-checkbox-base.js';\n\nimport styles from './toggle.scss';\n\n/**\n * @element it-toggle\n */\n@customElement('it-toggle')\nexport class ItToggle extends ItCheckboxBase {\n static override styles = [ItCheckboxBase.styles, styles];\n\n type = 'checkbox'; // Toggle is still a checkbox input type\n\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 return html`\n <div class=\"${wrapperClasses}\" part=\"toggle-wrapper input-wrapper\">\n <div class=\"toggles\">\n <label for=\"${this._id}\" part=\"label focusable\">\n <slot name=\"label\"></slot>\n ${this._renderInput(supportTextId, invalid, validityMessage)}\n <span class=\"lever\"></span>\n </label>\n </div>\n ${validityMessageRender} ${supportTextRender}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'it-toggle': ItToggle;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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cAAc,IAAI,IAAI,CAAC,iBAAiB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE;QAEpF,MAAM,OAAO,GACX,eAAe,EAAE,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,KAAK,CAAC;QAEzG,MAAM,qBAAqB,GAAG,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC;AAE5E,QAAA,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE;AAC/C,QAAA,OAAO,IAAI,CAAA;oBACK,cAAc,CAAA;;AAEV,sBAAA,EAAA,IAAI,CAAC,GAAG,CAAA;;cAElB,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC;;;;AAI9D,QAAA,EAAA,qBAAqB,IAAI,iBAAiB;;KAE/C;IACH;;AA9BgB,QAAA,CAAA,MAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAjC;AADX,QAAQ,GAAA,UAAA,CAAA;IADpB,aAAa,CAAC,WAAW;AACb,CAAA,EAAA,QAAQ,CAgCpB;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@italia/toggle",
3
3
  "description": "Web component it-toggle del Design system .italia",
4
- "version": "1.0.0-beta.7",
4
+ "version": "1.0.0-beta.8",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -35,11 +35,11 @@
35
35
  "styles"
36
36
  ],
37
37
  "dependencies": {
38
- "bootstrap-italia": "3.0.0-beta.8",
38
+ "bootstrap-italia": "3.0.0-beta.9",
39
39
  "lit": "^3.3.0",
40
- "@italia/checkbox": "^1.0.0-beta.7",
41
- "@italia/globals": "^1.0.0-beta.7",
42
- "@italia/i18n": "^1.0.0-beta.7"
40
+ "@italia/checkbox": "^1.0.0-beta.8",
41
+ "@italia/globals": "^1.0.0-beta.8",
42
+ "@italia/i18n": "^1.0.0-beta.8"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@custom-elements-manifest/analyzer": "^0.10.3",