@decidables/decidables-elements 0.5.7 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decidables/decidables-elements",
3
- "version": "0.5.7",
3
+ "version": "0.6.0",
4
4
  "description": "decidables-elements: Basic UI Web Components for the decidables project",
5
5
  "keywords": [
6
6
  "web component",
@@ -37,6 +37,7 @@
37
37
  "lib"
38
38
  ],
39
39
  "scripts": {
40
+ "clean": "gulp clean",
40
41
  "lint": "gulp lint",
41
42
  "test": "gulp test -X \"$@\"",
42
43
  "build": "gulp build"
@@ -48,5 +49,5 @@
48
49
  "d3": "^7.9.0",
49
50
  "lit": "^3.3.2"
50
51
  },
51
- "gitHead": "6fcd31a19c082ec41bde7d351bcb52161c5b654b"
52
+ "gitHead": "72981c711111354170ece1e403d497073da7be96"
52
53
  }
package/src/button.js CHANGED
@@ -35,49 +35,58 @@ export default class DecidablesButton extends DecidablesElement {
35
35
  button {
36
36
  width: 100%;
37
37
  height: 100%;
38
+
38
39
  padding: 0.375rem 0.75rem;
39
40
 
40
41
  font-family: var(---font-family-base);
41
42
  font-size: 1.125rem;
43
+
42
44
  line-height: 1.5;
45
+
43
46
  color: var(---color-text-inverse);
44
47
 
48
+ outline: none;
49
+
45
50
  border: 0;
46
51
  border-radius: var(---border-radius);
47
- outline: none;
48
52
  }
49
53
 
50
54
  button:disabled {
51
- background-color: var(---decidables-button-background-color-disabled);
52
55
  outline: none;
56
+
57
+ background-color: var(---decidables-button-background-color-disabled);
53
58
  box-shadow: none;
54
59
  }
55
60
 
56
61
  button:enabled {
57
62
  cursor: pointer;
63
+ outline: none;
58
64
 
59
65
  background-color: var(---decidables-button-background-color-enabled);
60
- outline: none;
61
66
  box-shadow: var(---shadow-2);
62
67
  }
63
68
 
64
69
  button:enabled:hover {
65
70
  outline: none;
71
+
66
72
  box-shadow: var(---shadow-4);
67
73
  }
68
74
 
69
75
  button:enabled:active {
70
76
  outline: none;
77
+
71
78
  box-shadow: var(---shadow-8);
72
79
  }
73
80
 
74
- :host(.keyboard) button:enabled:focus {
81
+ button:enabled:focus-visible {
75
82
  outline: none;
83
+
76
84
  box-shadow: var(---shadow-4);
77
85
  }
78
86
 
79
- :host(.keyboard) button:enabled:focus:active {
87
+ button:enabled:focus-visible:active {
80
88
  outline: none;
89
+
81
90
  box-shadow: var(---shadow-8);
82
91
  }
83
92
  `,
@@ -16,26 +16,6 @@ export default class DecidablesElement extends LitElement {
16
16
  return getComputedStyle(this).getPropertyValue(property).trim();
17
17
  }
18
18
 
19
- firstUpdated(changedProperties) {
20
- super.firstUpdated(changedProperties);
21
-
22
- // Use focus highlighting if keyboard is used at all
23
- d3.select(this.renderRoot.host)
24
- .classed('keyboard', true)
25
- .on('mousemove.keyboard touchstart.keyboard', (event) => {
26
- const element = event.currentTarget;
27
- d3.select(element.renderRoot.host)
28
- .classed('keyboard', false)
29
- .on('mousemove.keyboard touchstart.keyboard', null);
30
- })
31
- .on('keydown.keyboard', (event) => {
32
- const element = event.currentTarget;
33
- d3.select(element.renderRoot.host)
34
- .classed('keyboard', true)
35
- .on('keydown.keyboard mousemove.keyboard touchstart.keyboard', null);
36
- });
37
- }
38
-
39
19
  static get greys() {
40
20
  const grey = '#999999';
41
21
  const greys = {};
@@ -92,7 +72,7 @@ export default class DecidablesElement extends LitElement {
92
72
  /* eslint-enable key-spacing, object-curly-newline */
93
73
  }
94
74
 
95
- static cssBoxShadow(elevation, rotate = false, inverse = false) {
75
+ static cssBoxShadow(elevation, inverse = false) {
96
76
  const umbraO = this.shadows.opacityUmbra + this.shadows.opacityBoost;
97
77
  const penumbraO = this.shadows.opacityPenumbra + this.shadows.opacityBoost;
98
78
  const ambientO = this.shadows.opacityAmbient + this.shadows.opacityBoost;
@@ -111,15 +91,9 @@ export default class DecidablesElement extends LitElement {
111
91
  const penumbraM = this.shadows.mapPenumbra[elevation];
112
92
  const ambientM = this.shadows.mapAmbient[elevation];
113
93
 
114
- const umbraS = (rotate)
115
- ? `${-umbraM.y}px ${umbraM.y / 2}px ${umbraM.b}px ${umbraM.s}px`
116
- : `${umbraM.y / 2}px ${umbraM.y}px ${umbraM.b}px ${umbraM.s}px`;
117
- const penumbraS = (rotate)
118
- ? `${-penumbraM.y}px ${penumbraM.y / 2}px ${penumbraM.b}px ${penumbraM.s}px`
119
- : `${penumbraM.y / 2}px ${penumbraM.y}px ${penumbraM.b}px ${penumbraM.s}px`;
120
- const ambientS = (rotate)
121
- ? `${-ambientM.y}px ${ambientM.y / 2}px ${ambientM.b}px ${ambientM.s}px`
122
- : `${ambientM.y / 2}px ${ambientM.y}px ${ambientM.b}px ${ambientM.s}px`;
94
+ const umbraS = `${umbraM.y / 2}px ${umbraM.y}px ${umbraM.b}px ${umbraM.s}px`;
95
+ const penumbraS = `${penumbraM.y / 2}px ${penumbraM.y}px ${penumbraM.b}px ${penumbraM.s}px`;
96
+ const ambientS = `${ambientM.y / 2}px ${ambientM.y}px ${ambientM.b}px ${ambientM.s}px`;
123
97
 
124
98
  return `${umbraS} ${umbraC}, ${penumbraS} ${penumbraC}, ${ambientS} ${ambientC}`;
125
99
  }
package/src/slider.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import {ifDefined} from 'lit/directives/if-defined.js'; /* eslint-disable-line import/extensions */
3
- import {html, css, unsafeCSS} from 'lit';
3
+ import {css, html} from 'lit';
4
4
 
5
5
  import DecidablesElement from './decidables-element';
6
6
 
@@ -131,10 +131,6 @@ export default class DecidablesSlider extends DecidablesElement {
131
131
  ---decidables-slider-color: var(--decidables-slider-color, var(---color-element-enabled));
132
132
  ---decidables-spinner-background-color: var(--decidables-slider-background-color, none);
133
133
 
134
- ---shadow-2-rotate: var(--shadow-2-rotate, ${unsafeCSS(this.cssBoxShadow(2, true, false))});
135
- ---shadow-4-rotate: var(--shadow-4-rotate, ${unsafeCSS(this.cssBoxShadow(4, true, false))});
136
- ---shadow-8-rotate: var(--shadow-8-rotate, ${unsafeCSS(this.cssBoxShadow(8, true, false))});
137
-
138
134
  display: flex;
139
135
 
140
136
  flex-direction: column;
@@ -149,12 +145,14 @@ export default class DecidablesSlider extends DecidablesElement {
149
145
 
150
146
  .range {
151
147
  position: relative;
148
+
152
149
  display: flex;
153
150
 
154
151
  flex-direction: row;
155
152
 
156
153
  width: 3.5rem;
157
154
  height: 4.75rem;
155
+
158
156
  margin: 0 0.25rem 0.25rem;
159
157
  }
160
158
 
@@ -166,21 +164,20 @@ export default class DecidablesSlider extends DecidablesElement {
166
164
  background: var(---decidables-spinner-background-color);
167
165
  }
168
166
 
169
- /* Adapted from http://danielstern.ca/range.css/#/ */
170
167
  /* Overall */
171
168
  input[type=range] {
172
- width: 4.75rem;
173
- height: 3.5rem;
169
+ width: 3.5rem;
170
+ height: 4.75rem;
171
+
174
172
  padding: 0;
175
173
  margin: 0;
174
+
175
+ appearance: none;
176
176
 
177
177
  background-color: unset;
178
178
 
179
- transform: rotate(-90deg);
180
- transform-origin: 2.375rem 2.375rem;
181
-
182
- /* stylelint-disable-next-line property-no-vendor-prefix */
183
- -webkit-appearance: none;
179
+ direction: rtl;
180
+ writing-mode: vertical-lr;
184
181
  }
185
182
 
186
183
  input[type=range]:enabled {
@@ -191,16 +188,10 @@ export default class DecidablesSlider extends DecidablesElement {
191
188
  outline: none;
192
189
  }
193
190
 
194
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
195
- input[type=range]::-ms-tooltip {
196
- display: none;
197
- }
198
-
199
191
  /* Track */
200
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
201
192
  input[type=range]::-webkit-slider-runnable-track {
202
- width: 100%;
203
- height: 4px;
193
+ width: 4px;
194
+ height: 100%;
204
195
 
205
196
  background: var(---decidables-slider-background-color);
206
197
  border: 0;
@@ -212,10 +203,9 @@ export default class DecidablesSlider extends DecidablesElement {
212
203
  background: var(---decidables-slider-background-color);
213
204
  }
214
205
 
215
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
216
206
  input[type=range]::-moz-range-track {
217
- width: 100%;
218
- height: 4px;
207
+ width: 4px;
208
+ height: 100%;
219
209
 
220
210
  background: var(---decidables-slider-background-color);
221
211
  border: 0;
@@ -223,57 +213,17 @@ export default class DecidablesSlider extends DecidablesElement {
223
213
  box-shadow: none;
224
214
  }
225
215
 
226
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
227
- input[type=range]::-ms-track {
228
- width: 100%;
229
- height: 4px;
230
-
231
- color: transparent;
232
-
233
- background: transparent;
234
- border-color: transparent;
235
- }
236
-
237
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
238
- input[type=range]::-ms-fill-lower {
239
- background: #cccccc;
240
- /* background: var(---decidables-slider-background-color); */
241
- border: 0;
242
- border-radius: 2px;
243
- box-shadow: none;
244
- }
245
-
246
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
247
- input[type=range]::-ms-fill-upper {
248
- background: #cccccc;
249
- /* background: var(---decidables-slider-background-color); */
250
- border: 0;
251
- border-radius: 2px;
252
- box-shadow: none;
253
- }
254
-
255
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
256
- input[type=range]:focus::-ms-fill-lower {
257
- background: var(---decidables-slider-background-color);
258
- }
259
-
260
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
261
- input[type=range]:focus::-ms-fill-upper {
262
- background: var(---decidables-slider-background-color);
263
- }
264
-
265
216
  /* Thumb */
266
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
267
217
  input[type=range]::-webkit-slider-thumb {
268
- width: 10px;
269
- height: 20px;
270
- margin-top: -8px;
218
+ width: 20px;
219
+ height: 10px;
220
+
221
+ margin-left: -8px;
222
+
223
+ appearance: none;
271
224
 
272
225
  border: 0;
273
226
  border-radius: 4px;
274
-
275
- /* stylelint-disable-next-line property-no-vendor-prefix */
276
- -webkit-appearance: none;
277
227
  }
278
228
 
279
229
  input[type=range]:disabled::-webkit-slider-thumb {
@@ -283,112 +233,65 @@ export default class DecidablesSlider extends DecidablesElement {
283
233
 
284
234
  input[type=range]:enabled::-webkit-slider-thumb {
285
235
  background: var(---decidables-slider-color);
286
- box-shadow: var(---shadow-2-rotate);
236
+ box-shadow: var(---shadow-2);
287
237
  }
288
238
 
289
239
  input[type=range]:enabled:hover::-webkit-slider-thumb {
290
- box-shadow: var(---shadow-4-rotate);
240
+ box-shadow: var(---shadow-4);
291
241
  }
292
242
 
293
243
  input[type=range]:enabled:active::-webkit-slider-thumb {
294
- box-shadow: var(---shadow-8-rotate);
244
+ box-shadow: var(---shadow-8);
295
245
  }
296
246
 
297
- :host(.keyboard) input[type=range]:enabled:focus::-webkit-slider-thumb {
298
- box-shadow: var(---shadow-4-rotate);
247
+ input[type=range]:enabled:focus-visible::-webkit-slider-thumb {
248
+ box-shadow: var(---shadow-4);
299
249
  }
300
250
 
301
- :host(.keyboard) input[type=range]:focus:active::-webkit-slider-thumb {
302
- box-shadow: var(---shadow-8-rotate);
251
+ input[type=range]:enabled:focus-visible:active::-webkit-slider-thumb {
252
+ box-shadow: var(---shadow-8);
303
253
  }
304
254
 
305
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
306
255
  input[type=range]::-moz-range-thumb {
307
- width: 10px;
308
- height: 20px;
256
+ width: 20px;
257
+ height: 10px;
309
258
 
310
259
  border: 0;
311
260
  border-radius: 4px;
312
261
  }
313
262
 
314
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
315
263
  input[type=range]:disabled::-moz-range-thumb {
316
264
  background: var(---decidables-slider-background-color);
317
265
  box-shadow: none;
318
266
  }
319
267
 
320
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
321
268
  input[type=range]:enabled::-moz-range-thumb {
322
269
  background: var(---decidables-slider-color);
323
- box-shadow: var(---shadow-2-rotate);
270
+ box-shadow: var(---shadow-2);
324
271
  }
325
272
 
326
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
327
273
  input[type=range]:enabled:hover::-moz-range-thumb {
328
- box-shadow: var(---shadow-4-rotate);
274
+ box-shadow: var(---shadow-4);
329
275
  }
330
276
 
331
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
332
277
  input[type=range]:enabled:active::-moz-range-thumb {
333
- box-shadow: var(---shadow-8-rotate);
334
- }
335
-
336
- :host(.keyboard) input[type=range]:enabled:focus::-moz-range-thumb {
337
- box-shadow: var(---shadow-4-rotate);
338
- }
339
-
340
- :host(.keyboard) input[type=range]:enabled:focus:active::-moz-range-thumb {
341
- box-shadow: var(---shadow-8-rotate);
342
- }
343
-
344
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
345
- input[type=range]::-ms-thumb {
346
- width: 10px;
347
- height: 20px;
348
- margin-top: 0;
349
-
350
- background: #999999;
351
- /* background: var(---color-element-enabled); */
352
- border: 0;
353
- border-radius: 4px;
354
- box-shadow: var(---shadow-2-rotate);
355
- }
356
-
357
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
358
- input[type=range]:disabled::-ms-thumb {
359
- background: var(---decidables-slider-background-color);
360
- box-shadow: none;
361
- }
362
-
363
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
364
- input[type=range]:enabled::-ms-thumb {
365
- background: var(---decidables-slider-color);
366
- box-shadow: var(---shadow-2-rotate);
367
- }
368
-
369
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
370
- input[type=range]:enabled:hover::-ms-thumb {
371
- box-shadow: var(---shadow-4-rotate);
372
- }
373
-
374
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
375
- input[type=range]:enabled:active::-ms-thumb {
376
- box-shadow: var(---shadow-8-rotate);
278
+ box-shadow: var(---shadow-8);
377
279
  }
378
280
 
379
- /* stylelint-disable-next-line no-descending-specificity */ /* stylelint ERROR */
380
- :host(.keyboard) input[type=range]:enabled:focus::-ms-thumb {
381
- box-shadow: var(---shadow-4-rotate);
281
+ input[type=range]:enabled:focus-visible::-moz-range-thumb {
282
+ box-shadow: var(---shadow-4);
382
283
  }
383
284
 
384
- :host(.keyboard) input[type=range]:enabled:focus:active::-ms-thumb {
385
- box-shadow: var(---shadow-8-rotate);
285
+ input[type=range]:enabled:focus-visible:active::-moz-range-thumb {
286
+ box-shadow: var(---shadow-8);
386
287
  }
387
288
 
388
- datalist {
289
+ /* Tick marks */
290
+ .datalist {
389
291
  position: absolute;
390
292
  left: 2rem;
391
293
  z-index: -1;
294
+
392
295
  display: flex;
393
296
 
394
297
  flex-direction: column;
@@ -401,14 +304,13 @@ export default class DecidablesSlider extends DecidablesElement {
401
304
  font-size: 0.75rem;
402
305
  }
403
306
 
404
- option {
405
- padding: 0;
406
-
307
+ .option {
407
308
  line-height: 0.8;
408
- min-block-size: 0;
309
+
310
+ white-space: nowrap;
409
311
  }
410
312
 
411
- option::before {
313
+ .option::before {
412
314
  content: "– ";
413
315
  }
414
316
  `,
@@ -424,10 +326,10 @@ export default class DecidablesSlider extends DecidablesElement {
424
326
  <input ?disabled=${this.disabled} type="range" id="slider" min=${ifDefined(this.rangeMin)} max=${ifDefined(this.rangeMax)} step=${ifDefined(this.rangeStep)} .value=${this.rangeValue} @change=${this.rangeChanged.bind(this)} @input=${this.rangeInputted.bind(this)}>
425
327
  ${this.scale
426
328
  ? html`
427
- <datalist id="ticks">
428
- <option value=${ifDefined(this.rangeMax)} label=${ifDefined(this.max)}></option>
429
- <option value=${ifDefined(this.rangeMin)} label=${ifDefined(this.min)}></option>
430
- </datalist>
329
+ <div class="datalist">
330
+ <div class="option">${ifDefined(this.max)}</div>
331
+ <div class="option">${ifDefined(this.min)}</div>
332
+ </div>
431
333
  `
432
334
  : html``
433
335
  }
package/src/spinner.js CHANGED
@@ -60,13 +60,14 @@ export default class DecidablesSpinner extends DecidablesElement {
60
60
  ---decidables-spinner-prefix: var(--decidables-spinner-prefix, "");
61
61
 
62
62
  ---decidables-spinner-postfix: var(--decidables-spinner-postfix, "");
63
- ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0);
63
+ ---decidables-spinner-postfix-padding: var(--decidables-spinner-postfix-padding, 0rem);
64
64
 
65
65
  display: block;
66
66
  }
67
67
 
68
68
  label {
69
69
  position: relative;
70
+
70
71
  display: flex;
71
72
 
72
73
  flex-direction: column;
@@ -84,6 +85,7 @@ export default class DecidablesSpinner extends DecidablesElement {
84
85
  left: calc(50% - var(---decidables-spinner-input-width) / 2 + 0.25rem);
85
86
 
86
87
  font-size: var(---decidables-spinner-font-size);
88
+
87
89
  line-height: normal;
88
90
 
89
91
  content: var(---decidables-spinner-prefix);
@@ -95,6 +97,7 @@ export default class DecidablesSpinner extends DecidablesElement {
95
97
  bottom: 1px;
96
98
 
97
99
  font-size: var(---decidables-spinner-font-size);
100
+
98
101
  line-height: normal;
99
102
 
100
103
  content: var(---decidables-spinner-postfix);
@@ -102,20 +105,24 @@ export default class DecidablesSpinner extends DecidablesElement {
102
105
 
103
106
  input[type=number] {
104
107
  width: var(---decidables-spinner-input-width);
105
- padding-right: var(---decidables-spinner-postfix-padding);
108
+
109
+ padding: 1px var(---decidables-spinner-postfix-padding) 1px 2px;
110
+ margin: 0;
106
111
 
107
112
  font-family: var(---font-family-base);
108
113
  font-size: var(---decidables-spinner-font-size);
114
+
109
115
  color: inherit;
116
+
110
117
  text-align: right;
111
118
 
119
+ appearance: none;
120
+ outline: none;
121
+
112
122
  background: none;
113
123
  border: 0;
114
124
  border-radius: 0;
115
- outline: none;
116
125
  box-shadow: var(---shadow-2);
117
-
118
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
119
126
  }
120
127
 
121
128
  input[type=number]:hover {
@@ -132,20 +139,54 @@ export default class DecidablesSpinner extends DecidablesElement {
132
139
 
133
140
  border: 0;
134
141
  box-shadow: none;
142
+ }
143
+
144
+ /* HACK: Manage spinners in Firefox */
145
+ @supports (-moz-appearance: textfield) {
146
+ input[type=number] {
147
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
135
148
 
136
- /* HACK: Use correct text color in Safari */
137
- -webkit-opacity: 1;
138
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
139
- -moz-appearance: textfield; /* stylelint-disable-line property-no-vendor-prefix */
140
- /* HACK: Use correct text color in Safari */
141
- -webkit-text-fill-color: var(---color-text);
149
+ appearance: textfield;
150
+ }
151
+
152
+ input[type=number]:hover,
153
+ input[type=number]:focus,
154
+ input[type=number]:active {
155
+ padding-right: var(---decidables-spinner-postfix-padding);
156
+
157
+ appearance: none;
158
+ }
159
+
160
+ input[type=number]:disabled {
161
+ padding-right: calc(18px + var(---decidables-spinner-postfix-padding));
162
+
163
+ appearance: textfield;
164
+ }
165
+ }
166
+
167
+ /* HACK: Manage spinners in Chrome/Edge/Safari */
168
+ input[type=number]::-webkit-inner-spin-button {
169
+ /* Avoid oversized spinners in Safari */
170
+ font-size: 1.125rem;
171
+
172
+ opacity: 0;
173
+ }
174
+
175
+ input[type=number]:hover::-webkit-inner-spin-button,
176
+ input[type=number]:focus::-webkit-inner-spin-button,
177
+ input[type=number]:active::-webkit-inner-spin-button {
178
+ opacity: 1;
142
179
  }
143
180
 
144
- /* HACK: Hide spinners in disabled input for Firefox and Safari */
145
- input[type=number]:disabled::-webkit-outer-spin-button,
146
181
  input[type=number]:disabled::-webkit-inner-spin-button {
147
- margin: 0;
148
- -webkit-appearance: none; /* stylelint-disable-line property-no-vendor-prefix */
182
+ opacity: 0;
183
+ }
184
+
185
+ /* HACK: Adjust padding on mobile w/o spinners */
186
+ @media only screen and (hover: none) and (pointer: coarse) {
187
+ input[type=number] {
188
+ padding-right: calc(1.125rem + var(---decidables-spinner-postfix-padding));
189
+ }
149
190
  }
150
191
  `,
151
192
  ];
package/src/switch.js CHANGED
@@ -57,13 +57,16 @@ export default class DecidablesSwitch extends DecidablesElement {
57
57
 
58
58
  width: 1px;
59
59
  height: 1px;
60
+
60
61
  padding: 0;
61
62
  margin: -1px;
63
+
62
64
  overflow: hidden;
63
65
 
64
66
  white-space: nowrap;
65
67
 
66
68
  border: 0;
69
+
67
70
  clip-path: inset(100%); /* May cause a performance issue: https://github.com/h5bp/html5-boilerplate/issues/2021 */
68
71
  }
69
72
 
@@ -79,6 +82,7 @@ export default class DecidablesSwitch extends DecidablesElement {
79
82
  position: relative;
80
83
 
81
84
  min-width: 24px;
85
+
82
86
  padding: 0 0 36px;
83
87
  margin: 0.25rem 0.25rem 0;
84
88
 
@@ -90,17 +94,17 @@ export default class DecidablesSwitch extends DecidablesElement {
90
94
  input[type=checkbox] + label + label::before,
91
95
  input[type=checkbox] + label + label::after {
92
96
  position: absolute;
93
-
94
97
  left: 50%;
95
98
 
96
99
  margin: 0;
97
100
 
98
- content: "";
99
-
100
101
  outline: 0;
101
102
 
102
- transition: all var(---transition-duration) ease;
103
+ content: "";
104
+
103
105
  transform: translate(-50%, 0);
106
+
107
+ transition: all var(---transition-duration) ease;
104
108
  }
105
109
 
106
110
  input[type=checkbox] + label + label::before {
@@ -148,17 +152,14 @@ export default class DecidablesSwitch extends DecidablesElement {
148
152
  box-shadow: var(---shadow-8);
149
153
  }
150
154
 
151
- /* stylelint-disable-next-line selector-max-compound-selectors */
152
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label::after {
155
+ input[type=checkbox]:enabled:focus-visible + label + label::after {
153
156
  box-shadow: var(---shadow-4);
154
157
  }
155
158
 
156
- /* stylelint-disable selector-max-compound-selectors */
157
- :host(.keyboard) input[type=checkbox]:enabled:focus + label + label:active::after,
158
- :host(.keyboard) input[type=checkbox]:enabled:focus:active + label + label::after {
159
+ input[type=checkbox]:enabled:focus-visible + label + label:active::after,
160
+ input[type=checkbox]:enabled:focus-visible:active + label + label::after {
159
161
  box-shadow: var(---shadow-8);
160
162
  }
161
- /* stylelint-enable selector-max-compound-selectors */
162
163
  `,
163
164
  ];
164
165
  }