@@ -4,123 +4,11 @@ const KEY = require('../../lib/KEY');
44 */
55
66window . addEventListener ( 'WebComponentsReady' , function ( ) {
7+ const tagName = 'hx-checkbox' ;
78 const template = document . createElement ( 'template' ) ;
89
910 template . innerHTML = `
10- <style>
11- :host {
12- background-color: #ffffff;
13- border-color: currentColor;
14- border-radius: 2px;
15- border-style: solid;
16- border-width: 1px;
17- color: #bdbdbd;
18- display: inline-block;
19- height: 1rem;
20- vertical-align: middle;
21- width: 1rem;
22- }
23-
24- :host([hidden]) { display: none; }
25-
26- /* default unchecked */
27-
28- :host(:hover) {
29- background-color: #e4f9f9;
30- color: #16b9d4;
31- }
32-
33- /* default checked */
34-
35- :host([checked]) {
36- color: #0c7c84;
37- }
38-
39- :host([checked]:hover) {
40- background-color: #e4f9f9;
41- color: #16b9d4;
42- }
43-
44- /* default indeterminate (checked or unchecked) */
45-
46- :host([indeterminate]) {
47- color: #0c7c84;
48- }
49-
50- :host([indeterminate]:hover) {
51- color: #16b9d4;
52- }
53-
54- /* invalid unchecked */
55-
56- :host([invalid]) {
57- border-width: 2px;
58- color: #d32f2f;
59- }
60-
61- :host([invalid]:hover) {
62- background-color: #FFCDD2;
63- color: #d32f2f;
64- }
65-
66- /* invalid checked */
67-
68- /* invalid indeterminate (checked or unchecked) */
69-
70- /* disabled unchecked */
71-
72- :host([disabled]) {
73- background-color: #eeeeee;
74- color: #bdbdbd;
75- cursor: not-allowed;
76- }
77-
78- :host([disabled]:hover) {
79- background-color: #eeeeee;
80- color: #bdbdbd;
81- }
82-
83- /* disabled checked */
84-
85- /* disabled indeterminate (checked or unchecked) */
86- :host([disabled][indeterminate]) {
87- color: #bdbdbd;
88- }
89-
90- /* ^^ light dom overridable ^^ */
91- #container {
92- align-content: center;
93- align-items: center;
94- display: flex;
95- font-size: 0.625em; /* ~10px */
96- height: 100%;
97- justify-content: center;
98- width: 100%;
99- }
100-
101- #minus,
102- #tick {
103- display: none;
104- height: 1em;
105- line-height: 1;
106- width: 1em;
107- }
108-
109- /* FIXME: redefine due to bug in hxIcon */
110- hx-icon svg {
111- fill: currentColor;
112- stroke: none;
113- }
114-
115- :host([checked]:not([indeterminate])) #tick {
116- display: block;
117- }
118-
119- :host([indeterminate]) #minus {
120- display: block;
121- }
122- </style>
123-
11+ <style>${ require ( './HxCheckbox.less' ) } </style>
12412 <div id="container">
12513 <hx-icon type="checkmark" id="tick"></hx-icon>
12614 <hx-icon type="minus" id="minus"></hx-icon>
@@ -135,7 +23,7 @@ window.addEventListener('WebComponentsReady', function () {
13523
13624 class HxCheckbox extends HTMLElement {
13725 static get is ( ) {
138- return 'hx-checkbox' ;
26+ return tagName ;
13927 }
14028
14129 static get observedAttributes ( ) {
@@ -150,7 +38,7 @@ window.addEventListener('WebComponentsReady', function () {
15038 super ( ) ;
15139 this . attachShadow ( { mode : 'open' } ) ;
15240 if ( window . ShadyCSS ) {
153- ShadyCSS . prepareTemplate ( template , 'hx-checkbox' ) ;
41+ ShadyCSS . prepareTemplate ( template , tagName ) ;
15442 ShadyCSS . styleElement ( this ) ;
15543 }
15644 this . shadowRoot . appendChild ( template . content . cloneNode ( true ) ) ;
0 commit comments