@vaadin/slider 25.1.0-alpha5 → 25.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/slider",
3
- "version": "25.1.0-alpha5",
3
+ "version": "25.1.0-alpha7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,6 +23,7 @@
23
23
  "src",
24
24
  "vaadin-*.d.ts",
25
25
  "vaadin-*.js",
26
+ "custom-elements.json",
26
27
  "web-types.json",
27
28
  "web-types.lit.json"
28
29
  ],
@@ -34,21 +35,23 @@
34
35
  ],
35
36
  "dependencies": {
36
37
  "@open-wc/dedupe-mixin": "^1.3.0",
37
- "@vaadin/a11y-base": "25.1.0-alpha5",
38
- "@vaadin/component-base": "25.1.0-alpha5",
39
- "@vaadin/field-base": "25.1.0-alpha5",
40
- "@vaadin/vaadin-themable-mixin": "25.1.0-alpha5",
38
+ "@vaadin/a11y-base": "25.1.0-alpha7",
39
+ "@vaadin/component-base": "25.1.0-alpha7",
40
+ "@vaadin/field-base": "25.1.0-alpha7",
41
+ "@vaadin/overlay": "25.1.0-alpha7",
42
+ "@vaadin/vaadin-themable-mixin": "25.1.0-alpha7",
41
43
  "lit": "^3.0.0"
42
44
  },
43
45
  "devDependencies": {
44
- "@vaadin/chai-plugins": "25.1.0-alpha5",
45
- "@vaadin/test-runner-commands": "25.1.0-alpha5",
46
+ "@vaadin/chai-plugins": "25.1.0-alpha7",
47
+ "@vaadin/test-runner-commands": "25.1.0-alpha7",
46
48
  "@vaadin/testing-helpers": "^2.0.0",
47
- "@vaadin/vaadin-lumo-styles": "25.1.0-alpha5"
49
+ "@vaadin/vaadin-lumo-styles": "25.1.0-alpha7"
48
50
  },
51
+ "customElements": "custom-elements.json",
49
52
  "web-types": [
50
53
  "web-types.json",
51
54
  "web-types.lit.json"
52
55
  ],
53
- "gitHead": "9681e63d220c9e8d9d7c58cee272e5820b8ced19"
56
+ "gitHead": "98c586125f769c8fefd307536965293668fda81d"
54
57
  }
@@ -22,17 +22,30 @@ export const sliderStyles = css`
22
22
  :host([disabled]) {
23
23
  cursor: var(--vaadin-disabled-cursor);
24
24
  --vaadin-slider-fill-background: linear-gradient(
25
- var(--vaadin-text-color-disabled),
26
- var(--vaadin-text-color-disabled)
25
+ var(--vaadin-border-color-secondary),
26
+ var(--vaadin-border-color-secondary)
27
27
  )
28
28
  var(--vaadin-background-color);
29
+ --vaadin-slider-thumb-background: var(--vaadin-slider-fill-background);
30
+ --vaadin-slider-thumb-border-color: transparent;
29
31
  }
30
32
 
31
33
  :host([readonly]) {
32
- --vaadin-slider-fill-background: var(--vaadin-background-color);
34
+ --vaadin-slider-fill-background: var(--vaadin-border-color);
35
+ --vaadin-slider-thumb-background: var(--vaadin-background-color);
36
+ --vaadin-slider-thumb-border-color: var(--vaadin-border-color);
33
37
  --_outline-style: dashed;
34
38
  }
35
39
 
40
+ :host([min-max-visible]) {
41
+ grid-template:
42
+ 'label' auto var(--_helper-above-field, 'helper' auto) 'baseline' 0 'input' 1fr 'marks' auto var(
43
+ --_helper-below-field,
44
+ 'helper' auto
45
+ )
46
+ 'error' auto / 100%;
47
+ }
48
+
36
49
  #controls {
37
50
  grid-area: input;
38
51
  display: inline-grid;
@@ -40,7 +53,6 @@ export const sliderStyles = css`
40
53
  width: var(--vaadin-field-default-width, 12em);
41
54
  max-width: 100%;
42
55
  min-width: 100%;
43
- min-height: var(--_thumb-height);
44
56
  --_track-width: calc(100% - var(--_thumb-width));
45
57
  }
46
58
 
@@ -60,6 +72,8 @@ export const sliderStyles = css`
60
72
  height: var(--vaadin-slider-track-height, 0.25lh);
61
73
  background: var(--vaadin-slider-track-background, var(--vaadin-background-container));
62
74
  border-radius: var(--vaadin-slider-track-border-radius, var(--vaadin-radius-m));
75
+ border: var(--vaadin-slider-track-border-width, 0) solid
76
+ var(--vaadin-slider-track-border-color, var(--vaadin-border-color-secondary));
63
77
  }
64
78
 
65
79
  [part='track-fill'] {
@@ -67,6 +81,8 @@ export const sliderStyles = css`
67
81
  grid-column: fill-start / fill-end;
68
82
  height: 100%;
69
83
  background: var(--vaadin-slider-fill-background, var(--vaadin-text-color));
84
+ box-shadow: inset 0 0 0 var(--vaadin-slider-fill-border-width, 1px)
85
+ var(--vaadin-slider-fill-border-color, transparent);
70
86
  }
71
87
 
72
88
  [part~='thumb'] {
@@ -75,16 +91,13 @@ export const sliderStyles = css`
75
91
  grid-column: thumb1;
76
92
  width: var(--_thumb-width);
77
93
  height: var(--_thumb-height);
78
- background: var(--vaadin-slider-fill-background, var(--vaadin-text-color));
79
- border-radius: 50%;
94
+ background: var(--vaadin-slider-thumb-background, var(--vaadin-background-color));
95
+ border: var(--vaadin-slider-thumb-border-width, 1px) solid
96
+ var(--vaadin-slider-thumb-border-color, var(--vaadin-text-color));
97
+ border-radius: var(--vaadin-slider-thumb-border-radius, var(--vaadin-radius-l));
80
98
  touch-action: none;
81
99
  }
82
100
 
83
- :host([readonly]) [part~='thumb'],
84
- :host([readonly]) [part='track-fill'] {
85
- border: dashed 1px var(--vaadin-border-color);
86
- }
87
-
88
101
  :host([readonly]) [part='track-fill'] {
89
102
  border-inline-end: none;
90
103
  }
@@ -100,5 +113,20 @@ export const sliderStyles = css`
100
113
  background: transparent;
101
114
  outline: 0;
102
115
  -webkit-tap-highlight-color: transparent;
116
+ cursor: inherit;
117
+ z-index: 999;
118
+ }
119
+
120
+ [part='marks'] {
121
+ display: none;
122
+ font-size: var(--vaadin-slider-marks-font-size, 0.75em);
123
+ font-weight: var(--vaadin-slider-marks-font-weight, inherit);
124
+ color: var(--vaadin-slider-marks-color, var(--vaadin-text-color-secondary));
125
+ }
126
+
127
+ :host([min-max-visible]) [part='marks'] {
128
+ grid-area: marks;
129
+ display: flex;
130
+ justify-content: space-between;
103
131
  }
104
132
  `;
@@ -0,0 +1,124 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2026 - 2026 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import '@vaadin/component-base/src/styles/style-props.js';
7
+ import { css } from 'lit';
8
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
9
+
10
+ const sliderBubbleOverlay = css`
11
+ :host {
12
+ --_arrow-size: var(--vaadin-slider-bubble-arrow-size, 8px);
13
+ --_border-width: var(
14
+ --vaadin-slider-bubble-border-width,
15
+ var(--vaadin-tooltip-border-width, var(--vaadin-overlay-border-width, 1px))
16
+ );
17
+ --_default-offset: var(--vaadin-slider-bubble-offset, 2px);
18
+ --_rtl-multiplier: 1;
19
+ }
20
+
21
+ :host([dir='rtl']) {
22
+ --_rtl-multiplier: -1;
23
+ }
24
+
25
+ [part='overlay'] {
26
+ position: relative;
27
+ overflow: visible;
28
+ max-width: var(--vaadin-tooltip-max-width, 40ch);
29
+ padding: var(
30
+ --vaadin-slider-bubble-padding,
31
+ var(--vaadin-tooltip-padding, var(--vaadin-padding-block-container) var(--vaadin-padding-inline-container))
32
+ );
33
+ border: var(
34
+ --vaadin-slider-bubble-border-width,
35
+ var(--vaadin-tooltip-border-width, var(--vaadin-overlay-border-width, 1px))
36
+ )
37
+ solid
38
+ var(
39
+ --vaadin-slider-bubble-border-color,
40
+ var(--vaadin-tooltip-border-color, var(--vaadin-overlay-border-color, var(--vaadin-border-color-secondary)))
41
+ );
42
+ border-radius: var(
43
+ --vaadin-slider-bubble-border-radius,
44
+ var(--vaadin-tooltip-border-radius, var(--vaadin-radius-m))
45
+ );
46
+ background: var(
47
+ --vaadin-slider-bubble-background,
48
+ var(--vaadin-tooltip-background, var(--vaadin-background-color))
49
+ );
50
+ color: var(--vaadin-slider-bubble-text-color, var(--vaadin-tooltip-text-color, inherit));
51
+ font-size: var(--vaadin-slider-bubble-font-size, var(--vaadin-tooltip-font-size, 0.9em));
52
+ font-weight: var(--vaadin-slider-bubble-font-weight, var(--vaadin-tooltip-font-weight, inherit));
53
+ line-height: var(--vaadin-slider-bubble-line-height, var(--vaadin-tooltip-line-height, inherit));
54
+ box-shadow: var(--vaadin-slider-bubble-shadow, var(--vaadin-tooltip-shadow, 0 3px 8px -1px rgba(0, 0, 0, 0.2)));
55
+ }
56
+
57
+ :host([top-aligned]) [part='overlay'] {
58
+ margin-top: var(--vaadin-slider-bubble-offset, calc(var(--_arrow-size) + var(--_default-offset)));
59
+ }
60
+
61
+ :host([bottom-aligned]) [part='overlay'] {
62
+ margin-bottom: var(--vaadin-slider-bubble-offset, calc(var(--_arrow-size) + var(--_default-offset)));
63
+ }
64
+
65
+ [part='arrow'] {
66
+ display: block;
67
+ position: absolute;
68
+ background: inherit;
69
+ border: inherit;
70
+ border-start-start-radius: var(--vaadin-slider-bubble-arrow-border-radius, 0);
71
+ inset-inline-start: 50%;
72
+ outline: inherit;
73
+ box-shadow: inherit;
74
+ width: var(--_arrow-size);
75
+ height: var(--_arrow-size);
76
+ rotate: 45deg;
77
+ --o: 20px; /* clip-path outset, how far outward it extends to reveal the outline and box shadow */
78
+ --b: var(--_border-width);
79
+ /* We need this elaborate clip-path to allow the arrow bg and border to cover
80
+ the overlay border but prevent the outline and box-shadow from covering it */
81
+ clip-path: polygon(
82
+ calc(var(--o) * -1) calc(var(--o) * -1),
83
+ calc(100% + var(--o) - var(--b)) calc(var(--o) * -1),
84
+ calc(100% - var(--b) * 1.4) 0,
85
+ 100% 0,
86
+ calc(100% - var(--b)) var(--b),
87
+ calc(100% - var(--b)) calc(var(--b) + var(--ff, 0px)),
88
+ calc(var(--b) + var(--ff, 0px)) calc(100% - var(--b)),
89
+ calc(var(--b)) calc(100% - var(--b)),
90
+ 0 100%,
91
+ 0 calc(100% - var(--b) * 1.4),
92
+ calc(var(--o) * -1) calc(100% + var(--o) - var(--b))
93
+ );
94
+ }
95
+
96
+ /* Firefox renders a blurry edge for a diagonal clip-path + rotation,
97
+ so we need to extend the clip-path slightly further on the diagonal */
98
+ @supports (-moz-appearance: none) {
99
+ [part='arrow'] {
100
+ --ff: 1px;
101
+ }
102
+ }
103
+
104
+ :host([top-aligned]) [part='arrow'] {
105
+ top: 0;
106
+ translate: calc(-50% * var(--_rtl-multiplier)) -50%;
107
+ }
108
+
109
+ :host([end-aligned][top-aligned]) [part='arrow'] {
110
+ translate: calc(50% * var(--_rtl-multiplier)) -50%;
111
+ }
112
+
113
+ :host([bottom-aligned]) [part='arrow'] {
114
+ bottom: 0;
115
+ rotate: 225deg;
116
+ translate: calc(-50% * var(--_rtl-multiplier)) 50%;
117
+ }
118
+
119
+ :host([end-aligned][bottom-aligned]) [part='arrow'] {
120
+ translate: calc(50% * var(--_rtl-multiplier)) 50%;
121
+ }
122
+ `;
123
+
124
+ export const sliderBubbleOverlayStyles = [overlayStyles, sliderBubbleOverlay];
@@ -74,17 +74,23 @@ export interface RangeSliderEventMap extends HTMLElementEventMap, RangeSliderCus
74
74
  * `thumb` | The slider thumb (applies to both thumbs)
75
75
  * `thumb-start` | The start (lower value) thumb
76
76
  * `thumb-end` | The end (upper value) thumb
77
+ * `marks` | Container for min/max labels
78
+ * `min` | Minimum value label
79
+ * `max` | Maximum value label
77
80
  *
78
81
  * The following state attributes are available for styling:
79
82
  *
80
- * Attribute | Description
81
- * ----------------|-------------
82
- * `disabled` | Set when the slider is disabled
83
- * `readonly` | Set when the slider is read-only
84
- * `focused` | Set when the slider has focus
85
- * `focus-ring` | Set when the slider is focused using the keyboard
86
- * `start-focused` | Set when the start thumb has focus
87
- * `end-focused` | Set when the end thumb has focus
83
+ * Attribute | Description
84
+ * -------------------|-------------
85
+ * `disabled` | Set when the slider is disabled
86
+ * `readonly` | Set when the slider is read-only
87
+ * `focused` | Set when the slider has focus
88
+ * `focus-ring` | Set when the slider is focused using the keyboard
89
+ * `start-active` | Set when the start thumb is activated with mouse or touch
90
+ * `end-active` | Set when the end thumb is activated with mouse or touch
91
+ * `start-focused` | Set when the start thumb has focus
92
+ * `end-focused` | Set when the end thumb has focus
93
+ * `min-max-visible` | Set when the min/max labels are displayed
88
94
  *
89
95
  * The following custom CSS properties are available for styling:
90
96
  *
@@ -101,13 +107,45 @@ export interface RangeSliderEventMap extends HTMLElementEventMap, RangeSliderCus
101
107
  * `--vaadin-input-field-label-font-size` |
102
108
  * `--vaadin-input-field-label-font-weight` |
103
109
  * `--vaadin-input-field-required-indicator` |
110
+ * `--vaadin-slider-bubble-arrow-size` |
111
+ * `--vaadin-slider-bubble-background` |
112
+ * `--vaadin-slider-bubble-border-color` |
113
+ * `--vaadin-slider-bubble-border-radius` |
114
+ * `--vaadin-slider-bubble-border-width` |
115
+ * `--vaadin-slider-bubble-offset` |
116
+ * `--vaadin-slider-bubble-padding` |
117
+ * `--vaadin-slider-bubble-shadow` |
118
+ * `--vaadin-slider-bubble-text-color` |
119
+ * `--vaadin-slider-bubble-font-size` |
120
+ * `--vaadin-slider-bubble-font-weight` |
121
+ * `--vaadin-slider-bubble-line-height` |
104
122
  * `--vaadin-slider-fill-background` |
123
+ * `--vaadin-slider-fill-border-color` |
124
+ * `--vaadin-slider-fill-border-width` |
125
+ * `--vaadin-slider-marks-color` |
126
+ * `--vaadin-slider-marks-font-size` |
127
+ * `--vaadin-slider-marks-font-weight` |
128
+ * `--vaadin-slider-thumb-border-color` |
129
+ * `--vaadin-slider-thumb-border-radius` |
130
+ * `--vaadin-slider-thumb-border-width` |
131
+ * `--vaadin-slider-thumb-cursor` |
132
+ * `--vaadin-slider-thumb-cursor-active` |
105
133
  * `--vaadin-slider-thumb-height` |
106
134
  * `--vaadin-slider-thumb-width` |
107
135
  * `--vaadin-slider-track-background` |
136
+ * `--vaadin-slider-track-border-color` |
108
137
  * `--vaadin-slider-track-border-radius` |
138
+ * `--vaadin-slider-track-border-width` |
109
139
  * `--vaadin-slider-track-height` |
110
140
  *
141
+ * In order to style the slider bubble, use `<vaadin-slider-bubble>` shadow DOM parts:
142
+ *
143
+ * Part name | Description
144
+ * -----------------|----------------------
145
+ * `overlay` | The overlay container
146
+ * `content` | The overlay content
147
+ * `arrow` | Arrow pointing to the thumb
148
+ *
111
149
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
112
150
  *
113
151
  * @fires {Event} change - Fired when the user commits a value change.
@@ -120,6 +158,20 @@ declare class RangeSlider extends FieldMixin(SliderMixin(FocusMixin(ThemableMixi
120
158
  */
121
159
  value: number[];
122
160
 
161
+ /**
162
+ * Custom accessible name for the start (minimum) input.
163
+ * When not set, defaults to "${label} min" or "min" if no label.
164
+ * @attr {string} accessible-name-start
165
+ */
166
+ accessibleNameStart: string | null | undefined;
167
+
168
+ /**
169
+ * Custom accessible name for the end (maximum) input.
170
+ * When not set, defaults to "${label} max" or "max" if no label.
171
+ * @attr {string} accessible-name-end
172
+ */
173
+ accessibleNameEnd: string | null | undefined;
174
+
123
175
  addEventListener<K extends keyof RangeSliderEventMap>(
124
176
  type: K,
125
177
  listener: (this: RangeSlider, ev: RangeSliderEventMap[K]) => void,