@italia/toggle 1.0.0-alpha.9 → 1.0.0-beta.0
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/dist/src/it-toggle.js +38 -52
- package/dist/src/it-toggle.js.map +1 -1
- package/package.json +7 -7
- package/styles/globals.scss +1 -0
package/dist/src/it-toggle.js
CHANGED
|
@@ -3,35 +3,7 @@ import { customElement } from 'lit/decorators.js';
|
|
|
3
3
|
import { css, html } from 'lit';
|
|
4
4
|
import { ItCheckboxBase } from '@italia/checkbox/it-checkbox-base.js';
|
|
5
5
|
|
|
6
|
-
var styles = css
|
|
7
|
-
/***************************** 2 ****************************************/
|
|
8
|
-
/***************************** 1 ****************************************/
|
|
9
|
-
/***************************** 2 ****************************************/
|
|
10
|
-
/***************************** 1 ****************************************/
|
|
11
|
-
/***************************** 2 ****************************************/
|
|
12
|
-
/***************************** 3 ****************************************/
|
|
13
|
-
/***************************** 1 ****************************************/
|
|
14
|
-
/***************************** 2 ****************************************/
|
|
15
|
-
/***************************** 3 ****************************************/
|
|
16
|
-
/***************************** NEUTRAL 1 ****************************************/
|
|
17
|
-
/***************************** NEUTRAL 2 ****************************************/
|
|
18
|
-
/***************************** NEUTRAL 2 / 3 ****************************************/
|
|
19
|
-
.toggles label:has(input[type=checkbox]:focus-visible), .toggles label input[type=checkbox]:focus + .lever, .form-check [type=checkbox]:focus + label,
|
|
20
|
-
.form-check [type=radio]:focus + label {
|
|
21
|
-
border-color: hsl(0, 0%, 0%) !important;
|
|
22
|
-
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
23
|
-
outline: 3px solid transparent !important;
|
|
24
|
-
outline-offset: 3px !important;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.toggles label input[type=checkbox]:focus[data-focus-mouse=true] + .lever, .form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
28
|
-
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
29
|
-
border-color: inherit !important;
|
|
30
|
-
box-shadow: none !important;
|
|
31
|
-
outline: none !important;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
*,
|
|
6
|
+
var styles = css`*,
|
|
35
7
|
*::before,
|
|
36
8
|
*::after {
|
|
37
9
|
box-sizing: border-box;
|
|
@@ -425,7 +397,7 @@ input::-webkit-date-and-time-value {
|
|
|
425
397
|
}
|
|
426
398
|
|
|
427
399
|
select {
|
|
428
|
-
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%,
|
|
400
|
+
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");
|
|
429
401
|
background-repeat: no-repeat;
|
|
430
402
|
background-position: right var(--bsi-form-control-spacing) center;
|
|
431
403
|
background-size: 16px 12px;
|
|
@@ -438,7 +410,6 @@ select:focus {
|
|
|
438
410
|
}
|
|
439
411
|
select[multiple], select[size]:not([size="1"]) {
|
|
440
412
|
padding-right: 0.75rem;
|
|
441
|
-
background-image: none;
|
|
442
413
|
}
|
|
443
414
|
select:disabled {
|
|
444
415
|
background-color: hsl(0, 0%, 90%);
|
|
@@ -595,6 +566,19 @@ input::-webkit-datetime-edit {
|
|
|
595
566
|
font-size: var(--bsi-label-font-size-l);
|
|
596
567
|
}
|
|
597
568
|
}
|
|
569
|
+
.form-check [type=checkbox]:focus + label,
|
|
570
|
+
.form-check [type=radio]:focus + label {
|
|
571
|
+
border-color: hsl(0, 0%, 0%) !important;
|
|
572
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
573
|
+
outline: 3px solid transparent !important;
|
|
574
|
+
outline-offset: 3px !important;
|
|
575
|
+
}
|
|
576
|
+
.form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
577
|
+
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
578
|
+
border-color: inherit !important;
|
|
579
|
+
box-shadow: none !important;
|
|
580
|
+
outline: none !important;
|
|
581
|
+
}
|
|
598
582
|
.form-check input[type=checkbox] + label::after,
|
|
599
583
|
.form-check input[type=checkbox] + label::before {
|
|
600
584
|
position: absolute;
|
|
@@ -768,21 +752,6 @@ input::-webkit-datetime-edit {
|
|
|
768
752
|
transition: none !important;
|
|
769
753
|
}
|
|
770
754
|
}
|
|
771
|
-
.toggles label:has(input[type=checkbox]:focus-visible), .toggles label input[type=checkbox]:focus + .lever, .form-check [type=checkbox]:focus + label,
|
|
772
|
-
.form-check [type=radio]:focus + label {
|
|
773
|
-
border-color: hsl(0, 0%, 0%) !important;
|
|
774
|
-
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
775
|
-
outline: 3px solid transparent !important;
|
|
776
|
-
outline-offset: 3px !important;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
.toggles label input[type=checkbox]:focus[data-focus-mouse=true] + .lever, .form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
780
|
-
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
781
|
-
border-color: inherit !important;
|
|
782
|
-
box-shadow: none !important;
|
|
783
|
-
outline: none !important;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
755
|
.form-control-plaintext {
|
|
787
756
|
border: 0;
|
|
788
757
|
--bsi-form-control-border-color: transparent;
|
|
@@ -919,15 +888,15 @@ textarea.form-control-lg {
|
|
|
919
888
|
border-color: hsl(210, 100%, 40%);
|
|
920
889
|
}
|
|
921
890
|
.form-check-input:checked[type=checkbox] {
|
|
922
|
-
background-image: url("data:image/svg+xml
|
|
891
|
+
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>"));
|
|
923
892
|
}
|
|
924
893
|
.form-check-input:checked[type=radio] {
|
|
925
|
-
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='-4 -4 8 8'><circle r='2' fill='hsl(0, 0%, 100%)'/></svg>"));
|
|
926
895
|
}
|
|
927
896
|
.form-check-input[type=checkbox]:indeterminate {
|
|
928
897
|
background-color: hsl(210, 100%, 40%);
|
|
929
898
|
border-color: hsl(210, 100%, 40%);
|
|
930
|
-
background-image: url("data:image/svg+xml
|
|
899
|
+
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>"));
|
|
931
900
|
}
|
|
932
901
|
.form-check-input:disabled {
|
|
933
902
|
pointer-events: none;
|
|
@@ -945,7 +914,7 @@ textarea.form-control-lg {
|
|
|
945
914
|
.form-switch .form-check-input {
|
|
946
915
|
width: 2em;
|
|
947
916
|
margin-left: -2.5em;
|
|
948
|
-
background-image: url("data:image/svg+xml
|
|
917
|
+
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>"));
|
|
949
918
|
background-position: left center;
|
|
950
919
|
border-radius: 2em;
|
|
951
920
|
transition: background-position 0.15s ease-in-out;
|
|
@@ -956,11 +925,11 @@ textarea.form-control-lg {
|
|
|
956
925
|
}
|
|
957
926
|
}
|
|
958
927
|
.form-switch .form-check-input:focus {
|
|
959
|
-
background-image: url("data:image/svg+xml
|
|
928
|
+
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>"));
|
|
960
929
|
}
|
|
961
930
|
.form-switch .form-check-input:checked {
|
|
962
931
|
background-position: right center;
|
|
963
|
-
background-image: url("data:image/svg+xml
|
|
932
|
+
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>"));
|
|
964
933
|
}
|
|
965
934
|
.form-switch.form-check-reverse {
|
|
966
935
|
padding-right: 2.5em;
|
|
@@ -1035,6 +1004,17 @@ textarea.form-control-lg {
|
|
|
1035
1004
|
top: 0;
|
|
1036
1005
|
left: 0;
|
|
1037
1006
|
}
|
|
1007
|
+
.toggles label input[type=checkbox]:focus + .lever {
|
|
1008
|
+
border-color: hsl(0, 0%, 0%) !important;
|
|
1009
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
1010
|
+
outline: 3px solid transparent !important;
|
|
1011
|
+
outline-offset: 3px !important;
|
|
1012
|
+
}
|
|
1013
|
+
.toggles label input[type=checkbox]:focus[data-focus-mouse=true] + .lever {
|
|
1014
|
+
border-color: inherit !important;
|
|
1015
|
+
box-shadow: none !important;
|
|
1016
|
+
outline: none !important;
|
|
1017
|
+
}
|
|
1038
1018
|
.toggles label input[type=checkbox] + .lever {
|
|
1039
1019
|
position: relative;
|
|
1040
1020
|
content: "";
|
|
@@ -1176,6 +1156,12 @@ select.just-validate-success-field {
|
|
|
1176
1156
|
box-shadow: none !important;
|
|
1177
1157
|
outline: none !important;
|
|
1178
1158
|
}
|
|
1159
|
+
.toggles label:has(input[type=checkbox]:focus-visible) {
|
|
1160
|
+
border-color: hsl(0, 0%, 0%) !important;
|
|
1161
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
1162
|
+
outline: 3px solid transparent !important;
|
|
1163
|
+
outline-offset: 3px !important;
|
|
1164
|
+
}
|
|
1179
1165
|
.toggles label:has(input[type=checkbox]:focus-visible) input,
|
|
1180
1166
|
.toggles label:has(input[type=checkbox]:focus-visible) .lever {
|
|
1181
1167
|
border-color: inherit !important;
|
|
@@ -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"],"names":[],"mappings":"
|
|
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"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC,oBAAoB,CAAC,aAAa,CAAC;QAElE,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,aAAa,IAAI,IAAI,CAAC,gBAAgB;QACxF,MAAM,eAAe,GAAG,CAAC,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-
|
|
4
|
+
"version": "1.0.0-beta.0",
|
|
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-
|
|
38
|
+
"bootstrap-italia": "3.0.0-beta.1",
|
|
39
39
|
"lit": "^3.3.0",
|
|
40
|
-
"@italia/checkbox": "^1.0.0-
|
|
41
|
-
"@italia/globals": "^1.0.0-
|
|
42
|
-
"@italia/i18n": "^1.0.0-
|
|
40
|
+
"@italia/checkbox": "^1.0.0-beta.0",
|
|
41
|
+
"@italia/globals": "^1.0.0-beta.0",
|
|
42
|
+
"@italia/i18n": "^1.0.0-beta.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@custom-elements-manifest/analyzer": "^0.10.3",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"sass": "^1.89.0",
|
|
55
55
|
"tslib": "^2.6.3",
|
|
56
56
|
"typescript": "^5.5.3",
|
|
57
|
-
"@italia/test-config": "^0.0.0",
|
|
58
|
-
"@italia/typescript-config": "^0.0.0"
|
|
57
|
+
"@italia/test-config": "^1.0.0-beta.0",
|
|
58
|
+
"@italia/typescript-config": "^1.0.0-beta.0"
|
|
59
59
|
},
|
|
60
60
|
"customElements": "custom-elements.json",
|
|
61
61
|
"scripts": {
|
package/styles/globals.scss
CHANGED