@@ -58,31 +58,36 @@ export class FormControlElement extends LitElement {
5858 :host {
5959 display: inline-block;
6060 flex-shrink: 0;
61- padding-left: var(--form-switch-padding-x);
62- padding-right: var(--form-switch-padding-x);
61+ padding: var(--form-control-padding-y) var(--form-control-padding-x);
6362 }
64- input {
65- width: var(--form-switch-width);
66- height: var(--form-switch-height);
67- border-radius: var(--form-switch-border-radius);
68- vertical-align: middle;
69- appearance: none;
70- transition: background-position .15s ease-in-out;
71- background-image: var(--form-switch-background-image);
72- background-color: var(--form-switch-background-color);
73- background-repeat: no-repeat;
74- background-position: left center;
75- background-size: contain;
63+ label {
64+ cursor: pointer;
65+ user-select: none;
7666 }
77- input:checked {
78- background-position: right center;
67+ label.switch {
68+ & input {
69+ width: var(--form-switch-width);
70+ height: var(--form-switch-height);
71+ border-radius: var(--form-switch-border-radius);
72+ vertical-align: middle;
73+ appearance: none;
74+ transition: background-position var(--form-switch-transition) ease-in-out;
75+ background-image: var(--form-switch-background-image);
76+ background-color: var(--form-switch-background-color);
77+ background-repeat: no-repeat;
78+ background-position: left center;
79+ background-size: contain;
80+ }
81+ & input:checked {
82+ background-position: right center;
83+ }
7984 }
8085 ` ;
8186 }
8287
8388 render ( ) {
8489 return html `
85- < label class =${ this . className || nothing } >
90+ < label class =${ this . classes . join ( ' ' ) || nothing } >
8691 < input
8792 name =${ this . name || nothing }
8893 value =${ this . value || nothing }
@@ -106,11 +111,6 @@ export class FormControlElement extends LitElement {
106111 return classes ;
107112 }
108113
109- // Return class name for the classes
110- get className ( ) {
111- return this . classes . join ( ' ' ) ;
112- }
113-
114114 // Form control properties
115115 get form ( ) { return this . internals ? this . internals . form : null ; }
116116
0 commit comments