@italia/toggle 1.0.0-alpha.11 → 1.0.0-alpha.13
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 -51
- package/dist/src/it-toggle.js.map +1 -1
- package/package.json +5 -5
- 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
|
|
400
|
+
background-image: escape-svg(url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='hsl(0, 0%, 15%)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>"));
|
|
429
401
|
background-repeat: no-repeat;
|
|
430
402
|
background-position: right var(--bsi-form-control-spacing) center;
|
|
431
403
|
background-size: 16px 12px;
|
|
@@ -595,6 +567,19 @@ input::-webkit-datetime-edit {
|
|
|
595
567
|
font-size: var(--bsi-label-font-size-l);
|
|
596
568
|
}
|
|
597
569
|
}
|
|
570
|
+
.form-check [type=checkbox]:focus + label,
|
|
571
|
+
.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;
|
|
575
|
+
outline-offset: 3px !important;
|
|
576
|
+
}
|
|
577
|
+
.form-check [type=checkbox]:focus[data-focus-mouse=true] + label,
|
|
578
|
+
.form-check [type=radio]:focus[data-focus-mouse=true] + label {
|
|
579
|
+
border-color: inherit !important;
|
|
580
|
+
box-shadow: none !important;
|
|
581
|
+
outline: none !important;
|
|
582
|
+
}
|
|
598
583
|
.form-check input[type=checkbox] + label::after,
|
|
599
584
|
.form-check input[type=checkbox] + label::before {
|
|
600
585
|
position: absolute;
|
|
@@ -768,21 +753,6 @@ input::-webkit-datetime-edit {
|
|
|
768
753
|
transition: none !important;
|
|
769
754
|
}
|
|
770
755
|
}
|
|
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
756
|
.form-control-plaintext {
|
|
787
757
|
border: 0;
|
|
788
758
|
--bsi-form-control-border-color: transparent;
|
|
@@ -919,15 +889,15 @@ textarea.form-control-lg {
|
|
|
919
889
|
border-color: hsl(210, 100%, 40%);
|
|
920
890
|
}
|
|
921
891
|
.form-check-input:checked[type=checkbox] {
|
|
922
|
-
background-image: url("data:image/svg+xml
|
|
892
|
+
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
893
|
}
|
|
924
894
|
.form-check-input:checked[type=radio] {
|
|
925
|
-
background-image: url("data:image/svg+xml
|
|
895
|
+
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
896
|
}
|
|
927
897
|
.form-check-input[type=checkbox]:indeterminate {
|
|
928
898
|
background-color: hsl(210, 100%, 40%);
|
|
929
899
|
border-color: hsl(210, 100%, 40%);
|
|
930
|
-
background-image: url("data:image/svg+xml
|
|
900
|
+
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
901
|
}
|
|
932
902
|
.form-check-input:disabled {
|
|
933
903
|
pointer-events: none;
|
|
@@ -945,7 +915,7 @@ textarea.form-control-lg {
|
|
|
945
915
|
.form-switch .form-check-input {
|
|
946
916
|
width: 2em;
|
|
947
917
|
margin-left: -2.5em;
|
|
948
|
-
background-image: url("data:image/svg+xml
|
|
918
|
+
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
919
|
background-position: left center;
|
|
950
920
|
border-radius: 2em;
|
|
951
921
|
transition: background-position 0.15s ease-in-out;
|
|
@@ -956,11 +926,11 @@ textarea.form-control-lg {
|
|
|
956
926
|
}
|
|
957
927
|
}
|
|
958
928
|
.form-switch .form-check-input:focus {
|
|
959
|
-
background-image: url("data:image/svg+xml
|
|
929
|
+
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
930
|
}
|
|
961
931
|
.form-switch .form-check-input:checked {
|
|
962
932
|
background-position: right center;
|
|
963
|
-
background-image: url("data:image/svg+xml
|
|
933
|
+
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
934
|
}
|
|
965
935
|
.form-switch.form-check-reverse {
|
|
966
936
|
padding-right: 2.5em;
|
|
@@ -1035,6 +1005,17 @@ textarea.form-control-lg {
|
|
|
1035
1005
|
top: 0;
|
|
1036
1006
|
left: 0;
|
|
1037
1007
|
}
|
|
1008
|
+
.toggles label input[type=checkbox]:focus + .lever {
|
|
1009
|
+
border-color: hsl(0, 0%, 0%) !important;
|
|
1010
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
1011
|
+
outline: 3px solid transparent !important;
|
|
1012
|
+
outline-offset: 3px !important;
|
|
1013
|
+
}
|
|
1014
|
+
.toggles label input[type=checkbox]:focus[data-focus-mouse=true] + .lever {
|
|
1015
|
+
border-color: inherit !important;
|
|
1016
|
+
box-shadow: none !important;
|
|
1017
|
+
outline: none !important;
|
|
1018
|
+
}
|
|
1038
1019
|
.toggles label input[type=checkbox] + .lever {
|
|
1039
1020
|
position: relative;
|
|
1040
1021
|
content: "";
|
|
@@ -1176,6 +1157,12 @@ select.just-validate-success-field {
|
|
|
1176
1157
|
box-shadow: none !important;
|
|
1177
1158
|
outline: none !important;
|
|
1178
1159
|
}
|
|
1160
|
+
.toggles label:has(input[type=checkbox]:focus-visible) {
|
|
1161
|
+
border-color: hsl(0, 0%, 0%) !important;
|
|
1162
|
+
box-shadow: 0 0 0 2px var(--bsi-color-border-inverse), 0 0 0 5px var(--bsi-color-outline-focus) !important;
|
|
1163
|
+
outline: 3px solid transparent !important;
|
|
1164
|
+
outline-offset: 3px !important;
|
|
1165
|
+
}
|
|
1179
1166
|
.toggles label:has(input[type=checkbox]:focus-visible) input,
|
|
1180
1167
|
.toggles label:has(input[type=checkbox]:focus-visible) .lever {
|
|
1181
1168
|
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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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-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.13",
|
|
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.0",
|
|
39
39
|
"lit": "^3.3.0",
|
|
40
|
-
"@italia/checkbox": "^1.0.0-alpha.
|
|
41
|
-
"@italia/globals": "^1.0.0-alpha.
|
|
42
|
-
"@italia/i18n": "^1.0.0-alpha.
|
|
40
|
+
"@italia/checkbox": "^1.0.0-alpha.13",
|
|
41
|
+
"@italia/globals": "^1.0.0-alpha.13",
|
|
42
|
+
"@italia/i18n": "^1.0.0-alpha.13"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@custom-elements-manifest/analyzer": "^0.10.3",
|
package/styles/globals.scss
CHANGED