@vaadin/slider 25.4.0-alpha5 → 25.4.0-alpha7
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 +11 -11
- package/src/vaadin-range-slider.js +73 -74
- package/src/vaadin-slider.js +46 -47
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/slider",
|
|
3
|
-
"version": "25.4.0-
|
|
3
|
+
"version": "25.4.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,24 +35,24 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.4.0-
|
|
39
|
-
"@vaadin/component-base": "25.4.0-
|
|
40
|
-
"@vaadin/field-base": "25.4.0-
|
|
41
|
-
"@vaadin/overlay": "25.4.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "25.4.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.4.0-alpha7",
|
|
39
|
+
"@vaadin/component-base": "25.4.0-alpha7",
|
|
40
|
+
"@vaadin/field-base": "25.4.0-alpha7",
|
|
41
|
+
"@vaadin/overlay": "25.4.0-alpha7",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-alpha7",
|
|
43
43
|
"lit": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@vaadin/aura": "25.4.0-
|
|
47
|
-
"@vaadin/chai-plugins": "25.4.0-
|
|
48
|
-
"@vaadin/test-runner-commands": "25.4.0-
|
|
46
|
+
"@vaadin/aura": "25.4.0-alpha7",
|
|
47
|
+
"@vaadin/chai-plugins": "25.4.0-alpha7",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.4.0-alpha7",
|
|
49
49
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-alpha7"
|
|
51
51
|
},
|
|
52
52
|
"customElements": "custom-elements.json",
|
|
53
53
|
"web-types": [
|
|
54
54
|
"web-types.json",
|
|
55
55
|
"web-types.lit.json"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "368fb0f0df09ec6f51766d9c44047c8d7620d6bd"
|
|
58
58
|
}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-slider-bubble.js';
|
|
7
|
-
import { css, html, LitElement
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
10
10
|
import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
11
11
|
import { isElementFocused } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
12
12
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
|
+
import { slotContent } from '@vaadin/component-base/src/directives/slot-content.js';
|
|
13
14
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
14
15
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
15
16
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
@@ -327,8 +328,8 @@ class RangeSlider extends FieldMixin(
|
|
|
327
328
|
</div>
|
|
328
329
|
<div part="thumb thumb-start"></div>
|
|
329
330
|
<div part="thumb thumb-end"></div>
|
|
330
|
-
<slot name="input"></slot>
|
|
331
|
-
<slot name="bubble"></slot>
|
|
331
|
+
<slot name="input" ${slotContent(this.__renderInputs())}></slot>
|
|
332
|
+
<slot name="bubble" ${slotContent(this.__renderBubbles())}></slot>
|
|
332
333
|
</div>
|
|
333
334
|
|
|
334
335
|
<div part="marks" aria-hidden="true">
|
|
@@ -347,6 +348,75 @@ class RangeSlider extends FieldMixin(
|
|
|
347
348
|
`;
|
|
348
349
|
}
|
|
349
350
|
|
|
351
|
+
/** @private */
|
|
352
|
+
__renderInputs() {
|
|
353
|
+
const [startValue, endValue] = this.__value;
|
|
354
|
+
const { min, max, step } = this.__getConstraints();
|
|
355
|
+
|
|
356
|
+
return html`
|
|
357
|
+
<input
|
|
358
|
+
type="range"
|
|
359
|
+
id="${this.__inputId0}"
|
|
360
|
+
slot="input"
|
|
361
|
+
aria-label="${this.accessibleNameStart || this.__getAriaLabel('min')}"
|
|
362
|
+
.min="${min}"
|
|
363
|
+
.max="${max}"
|
|
364
|
+
.step="${step}"
|
|
365
|
+
.value="${startValue}"
|
|
366
|
+
.disabled="${this.disabled}"
|
|
367
|
+
tabindex="${this.disabled ? -1 : 0}"
|
|
368
|
+
@pointerenter="${this.__onStartPointerEnter}"
|
|
369
|
+
@pointermove="${this.__onStartPointerMove}"
|
|
370
|
+
@pointerleave="${this.__onStartPointerLeave}"
|
|
371
|
+
@keydown="${this.__onKeyDown}"
|
|
372
|
+
@input="${this.__onStartInput}"
|
|
373
|
+
@change="${this.__onChange}"
|
|
374
|
+
/>
|
|
375
|
+
<input
|
|
376
|
+
type="range"
|
|
377
|
+
id="${this.__inputId1}"
|
|
378
|
+
slot="input"
|
|
379
|
+
aria-label="${this.accessibleNameEnd || this.__getAriaLabel('max')}"
|
|
380
|
+
.min="${min}"
|
|
381
|
+
.max="${max}"
|
|
382
|
+
.step="${step}"
|
|
383
|
+
.value="${endValue}"
|
|
384
|
+
.disabled="${this.disabled}"
|
|
385
|
+
tabindex="${this.disabled ? -1 : 0}"
|
|
386
|
+
@pointerenter="${this.__onEndPointerEnter}"
|
|
387
|
+
@pointermove="${this.__onEndPointerMove}"
|
|
388
|
+
@pointerleave="${this.__onEndPointerLeave}"
|
|
389
|
+
@keydown="${this.__onKeyDown}"
|
|
390
|
+
@input="${this.__onEndInput}"
|
|
391
|
+
@change="${this.__onChange}"
|
|
392
|
+
/>
|
|
393
|
+
`;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** @private */
|
|
397
|
+
__renderBubbles() {
|
|
398
|
+
const [startValue, endValue] = this.__value;
|
|
399
|
+
|
|
400
|
+
return html`
|
|
401
|
+
<vaadin-slider-bubble
|
|
402
|
+
slot="bubble"
|
|
403
|
+
.positionTarget="${this.__thumbStartElement}"
|
|
404
|
+
.opened="${this.valueAlwaysVisible || this.__startBubbleOpened}"
|
|
405
|
+
theme="${ifDefined(this._theme)}"
|
|
406
|
+
>
|
|
407
|
+
${startValue}
|
|
408
|
+
</vaadin-slider-bubble>
|
|
409
|
+
<vaadin-slider-bubble
|
|
410
|
+
slot="bubble"
|
|
411
|
+
.positionTarget="${this.__thumbEndElement}"
|
|
412
|
+
.opened="${this.valueAlwaysVisible || this.__endBubbleOpened}"
|
|
413
|
+
theme="${ifDefined(this._theme)}"
|
|
414
|
+
>
|
|
415
|
+
${endValue}
|
|
416
|
+
</vaadin-slider-bubble>
|
|
417
|
+
`;
|
|
418
|
+
}
|
|
419
|
+
|
|
350
420
|
constructor() {
|
|
351
421
|
super();
|
|
352
422
|
|
|
@@ -393,77 +463,6 @@ class RangeSlider extends FieldMixin(
|
|
|
393
463
|
this.removeAttribute('end-active');
|
|
394
464
|
}
|
|
395
465
|
|
|
396
|
-
/**
|
|
397
|
-
* Override update to render slotted `<input type="range" />`
|
|
398
|
-
* into light DOM after rendering shadow DOM.
|
|
399
|
-
* @protected
|
|
400
|
-
*/
|
|
401
|
-
update(props) {
|
|
402
|
-
super.update(props);
|
|
403
|
-
|
|
404
|
-
const [startValue, endValue] = this.__value;
|
|
405
|
-
const { min, max, step } = this.__getConstraints();
|
|
406
|
-
|
|
407
|
-
render(
|
|
408
|
-
html`
|
|
409
|
-
<input
|
|
410
|
-
type="range"
|
|
411
|
-
id="${this.__inputId0}"
|
|
412
|
-
slot="input"
|
|
413
|
-
aria-label="${this.accessibleNameStart || this.__getAriaLabel('min')}"
|
|
414
|
-
.min="${min}"
|
|
415
|
-
.max="${max}"
|
|
416
|
-
.step="${step}"
|
|
417
|
-
.value="${startValue}"
|
|
418
|
-
.disabled="${this.disabled}"
|
|
419
|
-
tabindex="${this.disabled ? -1 : 0}"
|
|
420
|
-
@pointerenter="${this.__onStartPointerEnter}"
|
|
421
|
-
@pointermove="${this.__onStartPointerMove}"
|
|
422
|
-
@pointerleave="${this.__onStartPointerLeave}"
|
|
423
|
-
@keydown="${this.__onKeyDown}"
|
|
424
|
-
@input="${this.__onStartInput}"
|
|
425
|
-
@change="${this.__onChange}"
|
|
426
|
-
/>
|
|
427
|
-
<input
|
|
428
|
-
type="range"
|
|
429
|
-
id="${this.__inputId1}"
|
|
430
|
-
slot="input"
|
|
431
|
-
aria-label="${this.accessibleNameEnd || this.__getAriaLabel('max')}"
|
|
432
|
-
.min="${min}"
|
|
433
|
-
.max="${max}"
|
|
434
|
-
.step="${step}"
|
|
435
|
-
.value="${endValue}"
|
|
436
|
-
.disabled="${this.disabled}"
|
|
437
|
-
tabindex="${this.disabled ? -1 : 0}"
|
|
438
|
-
@pointerenter="${this.__onEndPointerEnter}"
|
|
439
|
-
@pointermove="${this.__onEndPointerMove}"
|
|
440
|
-
@pointerleave="${this.__onEndPointerLeave}"
|
|
441
|
-
@keydown="${this.__onKeyDown}"
|
|
442
|
-
@input="${this.__onEndInput}"
|
|
443
|
-
@change="${this.__onChange}"
|
|
444
|
-
/>
|
|
445
|
-
<vaadin-slider-bubble
|
|
446
|
-
slot="bubble"
|
|
447
|
-
.positionTarget="${this.__thumbStartElement}"
|
|
448
|
-
.opened="${this.valueAlwaysVisible || this.__startBubbleOpened}"
|
|
449
|
-
theme="${ifDefined(this._theme)}"
|
|
450
|
-
>
|
|
451
|
-
${startValue}
|
|
452
|
-
</vaadin-slider-bubble>
|
|
453
|
-
<vaadin-slider-bubble
|
|
454
|
-
slot="bubble"
|
|
455
|
-
.positionTarget="${this.__thumbEndElement}"
|
|
456
|
-
.opened="${this.valueAlwaysVisible || this.__endBubbleOpened}"
|
|
457
|
-
theme="${ifDefined(this._theme)}"
|
|
458
|
-
>
|
|
459
|
-
${endValue}
|
|
460
|
-
</vaadin-slider-bubble>
|
|
461
|
-
`,
|
|
462
|
-
this,
|
|
463
|
-
{ host: this },
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
466
|
/** @protected */
|
|
468
467
|
willUpdate(props) {
|
|
469
468
|
super.willUpdate(props);
|
package/src/vaadin-slider.js
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-slider-bubble.js';
|
|
7
|
-
import { css, html, LitElement
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
10
10
|
import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
11
11
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
12
|
+
import { slotContent } from '@vaadin/component-base/src/directives/slot-content.js';
|
|
12
13
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
13
14
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
14
15
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
@@ -229,8 +230,8 @@ class Slider extends FieldMixin(
|
|
|
229
230
|
<div part="track-fill"></div>
|
|
230
231
|
</div>
|
|
231
232
|
<div part="thumb"></div>
|
|
232
|
-
<slot name="input"></slot>
|
|
233
|
-
<slot name="bubble"></slot>
|
|
233
|
+
<slot name="input" ${slotContent(this.__renderInput())}></slot>
|
|
234
|
+
<slot name="bubble" ${slotContent(this.__renderBubble())}></slot>
|
|
234
235
|
</div>
|
|
235
236
|
|
|
236
237
|
<div part="marks" aria-hidden="true">
|
|
@@ -249,6 +250,48 @@ class Slider extends FieldMixin(
|
|
|
249
250
|
`;
|
|
250
251
|
}
|
|
251
252
|
|
|
253
|
+
/** @private */
|
|
254
|
+
__renderInput() {
|
|
255
|
+
const [value] = this.__value;
|
|
256
|
+
const { min, max, step } = this.__getConstraints();
|
|
257
|
+
|
|
258
|
+
return html`
|
|
259
|
+
<input
|
|
260
|
+
type="range"
|
|
261
|
+
id="${this.__inputId}"
|
|
262
|
+
slot="input"
|
|
263
|
+
.min="${min}"
|
|
264
|
+
.max="${max}"
|
|
265
|
+
.value="${value}"
|
|
266
|
+
.step="${step}"
|
|
267
|
+
.disabled="${this.disabled}"
|
|
268
|
+
tabindex="${this.disabled ? -1 : 0}"
|
|
269
|
+
@pointerenter="${this.__onPointerEnter}"
|
|
270
|
+
@pointermove="${this.__onPointerMove}"
|
|
271
|
+
@pointerleave="${this.__onPointerLeave}"
|
|
272
|
+
@keydown="${this.__onKeyDown}"
|
|
273
|
+
@input="${this.__onInput}"
|
|
274
|
+
@change="${this.__onChange}"
|
|
275
|
+
/>
|
|
276
|
+
`;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** @private */
|
|
280
|
+
__renderBubble() {
|
|
281
|
+
const [value] = this.__value;
|
|
282
|
+
|
|
283
|
+
return html`
|
|
284
|
+
<vaadin-slider-bubble
|
|
285
|
+
slot="bubble"
|
|
286
|
+
.positionTarget="${this.__thumbElement}"
|
|
287
|
+
.opened="${this.valueAlwaysVisible || this.__bubbleOpened}"
|
|
288
|
+
theme="${ifDefined(this._theme)}"
|
|
289
|
+
>
|
|
290
|
+
${value}
|
|
291
|
+
</vaadin-slider-bubble>
|
|
292
|
+
`;
|
|
293
|
+
}
|
|
294
|
+
|
|
252
295
|
constructor() {
|
|
253
296
|
super();
|
|
254
297
|
|
|
@@ -290,50 +333,6 @@ class Slider extends FieldMixin(
|
|
|
290
333
|
this.removeAttribute('active');
|
|
291
334
|
}
|
|
292
335
|
|
|
293
|
-
/**
|
|
294
|
-
* Override update to render slotted `<input type="range" />`
|
|
295
|
-
* into light DOM after rendering shadow DOM.
|
|
296
|
-
* @protected
|
|
297
|
-
*/
|
|
298
|
-
update(props) {
|
|
299
|
-
super.update(props);
|
|
300
|
-
|
|
301
|
-
const [value] = this.__value;
|
|
302
|
-
const { min, max, step } = this.__getConstraints();
|
|
303
|
-
|
|
304
|
-
render(
|
|
305
|
-
html`
|
|
306
|
-
<input
|
|
307
|
-
type="range"
|
|
308
|
-
id="${this.__inputId}"
|
|
309
|
-
slot="input"
|
|
310
|
-
.min="${min}"
|
|
311
|
-
.max="${max}"
|
|
312
|
-
.value="${value}"
|
|
313
|
-
.step="${step}"
|
|
314
|
-
.disabled="${this.disabled}"
|
|
315
|
-
tabindex="${this.disabled ? -1 : 0}"
|
|
316
|
-
@pointerenter="${this.__onPointerEnter}"
|
|
317
|
-
@pointermove="${this.__onPointerMove}"
|
|
318
|
-
@pointerleave="${this.__onPointerLeave}"
|
|
319
|
-
@keydown="${this.__onKeyDown}"
|
|
320
|
-
@input="${this.__onInput}"
|
|
321
|
-
@change="${this.__onChange}"
|
|
322
|
-
/>
|
|
323
|
-
<vaadin-slider-bubble
|
|
324
|
-
slot="bubble"
|
|
325
|
-
.positionTarget="${this.__thumbElement}"
|
|
326
|
-
.opened="${this.valueAlwaysVisible || this.__bubbleOpened}"
|
|
327
|
-
theme="${ifDefined(this._theme)}"
|
|
328
|
-
>
|
|
329
|
-
${value}
|
|
330
|
-
</vaadin-slider-bubble>
|
|
331
|
-
`,
|
|
332
|
-
this,
|
|
333
|
-
{ host: this },
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
336
|
/** @protected */
|
|
338
337
|
willUpdate(props) {
|
|
339
338
|
super.willUpdate(props);
|
package/web-types.json
CHANGED