@geoffcox/sterling-svelte 0.0.30 → 1.0.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/@types/clickOutside.d.ts +11 -7
- package/Button.svelte +11 -183
- package/Button.svelte.d.ts +2 -6
- package/Callout.svelte +188 -0
- package/Callout.svelte.d.ts +54 -0
- package/Checkbox.svelte +15 -177
- package/Checkbox.svelte.d.ts +2 -2
- package/ColorPicker.svelte +204 -223
- package/ColorPicker.svelte.d.ts +1 -2
- package/Dialog.svelte +91 -187
- package/Dialog.svelte.d.ts +3 -1
- package/Dropdown.svelte +52 -219
- package/Dropdown.svelte.d.ts +4 -8
- package/HexColorSliders.svelte +77 -145
- package/HexColorSliders.svelte.d.ts +28 -1
- package/HslColorSliders.svelte +99 -179
- package/HslColorSliders.svelte.d.ts +28 -1
- package/Input.svelte +27 -136
- package/Input.svelte.d.ts +2 -3
- package/Label.constants.d.ts +1 -0
- package/Label.constants.js +1 -0
- package/Label.svelte +96 -169
- package/Label.svelte.d.ts +6 -1
- package/Label.types.d.ts +3 -1
- package/Link.svelte +9 -106
- package/Link.svelte.d.ts +0 -1
- package/List.svelte +142 -230
- package/List.svelte.d.ts +2 -3
- package/List.types.d.ts +6 -1
- package/ListItem.svelte +25 -94
- package/ListItem.svelte.d.ts +2 -0
- package/Menu.svelte +48 -64
- package/Menu.svelte.d.ts +4 -1
- package/MenuBar.svelte +84 -86
- package/MenuBar.svelte.d.ts +4 -1
- package/MenuButton.svelte +67 -74
- package/MenuButton.svelte.d.ts +7 -3
- package/MenuItem.svelte +256 -288
- package/MenuItem.svelte.d.ts +2 -2
- package/MenuItemDisplay.svelte +12 -116
- package/MenuItemDisplay.svelte.d.ts +21 -7
- package/MenuSeparator.svelte +6 -45
- package/MenuSeparator.svelte.d.ts +8 -78
- package/Popover.constants.d.ts +2 -0
- package/{floating-ui.constants.js → Popover.constants.js} +10 -9
- package/Popover.svelte +72 -82
- package/Popover.svelte.d.ts +10 -5
- package/Popover.types.d.ts +4 -0
- package/Progress.svelte +28 -126
- package/Progress.svelte.d.ts +4 -3
- package/Radio.svelte +49 -192
- package/Radio.svelte.d.ts +2 -2
- package/RgbColorSliders.svelte +48 -137
- package/RgbColorSliders.svelte.d.ts +5 -5
- package/Select.svelte +124 -251
- package/Select.svelte.d.ts +6 -2
- package/Slider.svelte +90 -259
- package/Slider.svelte.d.ts +1 -2
- package/Switch.svelte +24 -259
- package/Switch.svelte.d.ts +3 -1
- package/Tab.svelte +27 -175
- package/Tab.svelte.d.ts +6 -4
- package/TabList.svelte +146 -171
- package/TabList.svelte.d.ts +3 -2
- package/TabList.types.d.ts +6 -1
- package/TextArea.svelte +32 -129
- package/TextArea.svelte.d.ts +1 -1
- package/Tooltip.svelte +88 -222
- package/Tooltip.svelte.d.ts +21 -13
- package/Tree.constants.d.ts +0 -1
- package/Tree.constants.js +0 -1
- package/Tree.svelte +35 -119
- package/Tree.svelte.d.ts +4 -4
- package/Tree.types.d.ts +1 -3
- package/TreeChevron.svelte +18 -98
- package/TreeChevron.svelte.d.ts +1 -0
- package/TreeItem.constants.d.ts +1 -0
- package/TreeItem.constants.js +1 -0
- package/TreeItem.svelte +251 -211
- package/TreeItem.svelte.d.ts +7 -3
- package/TreeItem.types.d.ts +1 -1
- package/TreeItemDisplay.svelte +20 -104
- package/TreeItemDisplay.svelte.d.ts +2 -2
- package/actions/applyLightDarkMode.d.ts +10 -0
- package/actions/applyLightDarkMode.js +36 -0
- package/actions/forwardEvents.js +3 -3
- package/css/Button.base.css +74 -0
- package/css/Button.colorful.css +17 -0
- package/css/Button.css +7 -0
- package/css/Button.secondary.colorful.css +15 -0
- package/css/Button.secondary.css +11 -0
- package/css/Button.shapes.css +14 -0
- package/css/Button.tool.colorful.css +13 -0
- package/css/Button.tool.css +18 -0
- package/css/Callout.base.css +43 -0
- package/css/Callout.colorful.css +5 -0
- package/css/Callout.css +2 -0
- package/css/Checkbox.base.css +145 -0
- package/css/Checkbox.colorful.css +17 -0
- package/css/Checkbox.css +2 -0
- package/css/ColorPicker.base.css +23 -0
- package/css/ColorPicker.css +1 -0
- package/css/Dialog.base.css +116 -0
- package/css/Dialog.css +1 -0
- package/css/Dropdown.base.css +147 -0
- package/css/Dropdown.colorful.css +23 -0
- package/css/Dropdown.css +2 -0
- package/css/HexColorSliders.base.css +106 -0
- package/css/HexColorSliders.css +1 -0
- package/css/HslColorSliders.base.css +124 -0
- package/css/HslColorSliders.css +1 -0
- package/css/Input.base.css +100 -0
- package/css/Input.colorful.css +22 -0
- package/css/Input.composed.css +8 -0
- package/css/Input.css +3 -0
- package/css/Label.base.css +119 -0
- package/css/Label.boxed.colorful.css +21 -0
- package/css/Label.boxed.css +31 -0
- package/css/Label.colorful.css +3 -0
- package/css/Label.css +4 -0
- package/css/Link.base.css +52 -0
- package/css/Link.colorful.css +15 -0
- package/css/Link.css +6 -0
- package/css/Link.ghost.colorful.css +7 -0
- package/css/Link.ghost.css +11 -0
- package/css/Link.undecorated.colorful.css +6 -0
- package/css/Link.undecorated.css +6 -0
- package/css/List.base.css +98 -0
- package/css/List.css +1 -0
- package/css/ListItem.base.css +59 -0
- package/css/ListItem.css +1 -0
- package/css/Menu.base.css +21 -0
- package/css/Menu.css +1 -0
- package/css/MenuBar.base.css +9 -0
- package/css/MenuBar.css +1 -0
- package/css/MenuButton.base.css +13 -0
- package/css/MenuButton.css +1 -0
- package/css/MenuItem.base.css +48 -0
- package/css/MenuItem.css +1 -0
- package/css/MenuItemDisplay.base.css +104 -0
- package/css/MenuItemDisplay.css +1 -0
- package/css/MenuSeparator.base.css +5 -0
- package/css/MenuSeparator.css +1 -0
- package/css/Popover copy.css +21 -0
- package/css/Popover.css +21 -0
- package/css/Progress.base.css +99 -0
- package/css/Progress.css +1 -0
- package/css/Radio.base.css +135 -0
- package/css/Radio.colorful.css +18 -0
- package/css/Radio.css +2 -0
- package/css/RgbColorSliders.base.css +94 -0
- package/css/RgbColorSliders.css +1 -0
- package/css/Select.base.css +127 -0
- package/css/Select.colorful.css +24 -0
- package/css/Select.composed.css +12 -0
- package/css/Select.css +3 -0
- package/css/Slider.base.css +182 -0
- package/css/Slider.colorful.css +11 -0
- package/css/Slider.composed.css +8 -0
- package/css/Slider.css +3 -0
- package/css/Switch.base.css +193 -0
- package/css/Switch.colorful.css +39 -0
- package/css/Switch.css +2 -0
- package/css/Tab.base.css +135 -0
- package/css/Tab.colorful.css +13 -0
- package/css/Tab.css +2 -0
- package/css/TabList.base.css +34 -0
- package/css/TabList.css +1 -0
- package/css/TextArea.base.css +85 -0
- package/css/TextArea.colorful.css +17 -0
- package/css/TextArea.composed.css +8 -0
- package/css/TextArea.css +3 -0
- package/css/Tooltip.base.css +6 -0
- package/css/Tooltip.css +1 -0
- package/css/Tree.base.css +74 -0
- package/css/Tree.composed.css +8 -0
- package/css/Tree.css +2 -0
- package/css/TreeChevron.base.css +86 -0
- package/css/TreeChevron.css +1 -0
- package/css/TreeItem.base.css +3 -0
- package/css/TreeItem.css +1 -0
- package/css/TreeItemDisplay.base.css +74 -0
- package/css/TreeItemDisplay.colorful.css +9 -0
- package/css/TreeItemDisplay.css +1 -0
- package/css/dark-mode.css +134 -0
- package/css/light-mode.css +134 -0
- package/css/sterling.css +37 -0
- package/index.d.ts +13 -18
- package/index.js +11 -15
- package/mediaQueries/prefersColorSchemeDark.d.ts +2 -0
- package/mediaQueries/prefersColorSchemeDark.js +10 -0
- package/{stores → mediaQueries}/prefersReducedMotion.d.ts +1 -0
- package/{stores → mediaQueries}/usingKeyboard.d.ts +1 -0
- package/package.json +136 -19
- package/Link.constants.d.ts +0 -1
- package/Link.constants.js +0 -1
- package/Link.types.d.ts +0 -4
- package/Tooltip.constants.d.ts +0 -1
- package/Tooltip.constants.js +0 -1
- package/Tooltip.types.d.ts +0 -4
- package/Tooltip.types.js +0 -1
- package/floating-ui.constants.d.ts +0 -1
- package/floating-ui.types.d.ts +0 -4
- package/floating-ui.types.js +0 -1
- package/theme/applyDarkTheme.d.ts +0 -7
- package/theme/applyDarkTheme.js +0 -11
- package/theme/applyLightTheme.d.ts +0 -7
- package/theme/applyLightTheme.js +0 -11
- package/theme/applyTheme.d.ts +0 -7
- package/theme/applyTheme.js +0 -20
- package/theme/colors.d.ts +0 -54
- package/theme/colors.js +0 -82
- package/theme/darkTheme.d.ts +0 -2
- package/theme/darkTheme.js +0 -142
- package/theme/lightTheme.d.ts +0 -2
- package/theme/lightTheme.js +0 -119
- package/theme/toggleDarkTheme.d.ts +0 -18
- package/theme/toggleDarkTheme.js +0 -53
- package/theme/types.d.ts +0 -21
- package/theme/types.js +0 -1
- /package/{Link.types.js → Popover.types.js} +0 -0
- /package/{stores → mediaQueries}/prefersReducedMotion.js +0 -0
- /package/{stores → mediaQueries}/usingKeyboard.js +0 -0
package/Slider.svelte
CHANGED
|
@@ -1,98 +1,128 @@
|
|
|
1
|
-
<script>import { createEventDispatcher } from
|
|
2
|
-
import { round } from
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
import { round } from 'lodash-es';
|
|
3
|
+
// ----- Props ----- //
|
|
4
|
+
/** When true, the slider is disabled. */
|
|
5
5
|
export let disabled = false;
|
|
6
|
+
/** The minimum value of the slider. */
|
|
6
7
|
export let min = 0;
|
|
8
|
+
/** The maximum value of the slider. */
|
|
7
9
|
export let max = 100;
|
|
8
|
-
|
|
10
|
+
/** The number of decimal places for rounding the value. */
|
|
11
|
+
export let precision = undefined;
|
|
12
|
+
/** The amount the value changes by pressing arrow keys. */
|
|
9
13
|
export let step = 1;
|
|
14
|
+
/** The value of the slider. */
|
|
10
15
|
export let value = 0;
|
|
16
|
+
/** Additional class names to apply. */
|
|
17
|
+
export let variant = '';
|
|
18
|
+
/** When true, the slider is displayed vertically. */
|
|
11
19
|
export let vertical = false;
|
|
20
|
+
// ----- State ----- //
|
|
12
21
|
let sliderRef;
|
|
22
|
+
// ----- Methods ----- //
|
|
13
23
|
export const blur = () => {
|
|
14
|
-
|
|
24
|
+
sliderRef?.blur();
|
|
15
25
|
};
|
|
16
26
|
export const click = () => {
|
|
17
|
-
|
|
27
|
+
sliderRef?.click();
|
|
18
28
|
};
|
|
19
29
|
export const focus = (options) => {
|
|
20
|
-
|
|
30
|
+
sliderRef?.focus();
|
|
21
31
|
};
|
|
32
|
+
// -----Events----- //
|
|
22
33
|
const dispatch = createEventDispatcher();
|
|
34
|
+
//TODO: have change and input events for parity with input type=slider
|
|
35
|
+
// or use input internally within this component.
|
|
23
36
|
const raiseChange = (newValue) => {
|
|
24
|
-
|
|
37
|
+
dispatch('change', { value: newValue });
|
|
25
38
|
};
|
|
39
|
+
// ----- Value tracking ----- //
|
|
40
|
+
// const getPrecision = (value?: number): number => {
|
|
41
|
+
// if (value !== undefined && Number !== null && !Number.isNaN(value)) {
|
|
42
|
+
// const text = value.toString();
|
|
43
|
+
// const position = text.indexOf('.');
|
|
44
|
+
// if (position !== -1) {
|
|
45
|
+
// const fraction = text.substring(position + 1);
|
|
46
|
+
// if (fraction) {
|
|
47
|
+
// return fraction.length;
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// return 0;
|
|
52
|
+
// };
|
|
26
53
|
const setValue = (newValue) => {
|
|
27
|
-
|
|
28
|
-
|
|
54
|
+
const clamped = Math.max(min, Math.min(max, newValue));
|
|
55
|
+
value = precision !== undefined ? round(clamped, precision) : clamped;
|
|
29
56
|
};
|
|
57
|
+
// ensure min <= max
|
|
30
58
|
$: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
59
|
+
if (min > max) {
|
|
60
|
+
min = max;
|
|
61
|
+
}
|
|
34
62
|
}
|
|
35
|
-
$:
|
|
36
|
-
|
|
37
|
-
$:
|
|
38
|
-
ratio = (value - min) / (max - min);
|
|
63
|
+
$: min, max, precision, setValue(value);
|
|
64
|
+
// Compute the ratio of the value to the range
|
|
65
|
+
$: ratio = (value - min) / (max - min);
|
|
39
66
|
const setValueByOffset = (offset) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
if (sliderSize > 0) {
|
|
68
|
+
const positionRatio = Math.max(0, Math.min(1, offset / sliderSize));
|
|
69
|
+
const newValue = min + positionRatio * (max - min);
|
|
70
|
+
setValue(newValue);
|
|
71
|
+
}
|
|
45
72
|
};
|
|
73
|
+
// Raise change event when value changes
|
|
46
74
|
$: {
|
|
47
|
-
|
|
75
|
+
raiseChange(value);
|
|
48
76
|
}
|
|
77
|
+
// ----- Size tracking ----- //
|
|
49
78
|
let sliderWidth;
|
|
50
79
|
let sliderHeight;
|
|
51
|
-
$:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
valueOffset = sliderSize * ratio;
|
|
80
|
+
$: sliderSize = vertical ? sliderHeight : sliderWidth;
|
|
81
|
+
$: valueOffset = sliderSize * ratio;
|
|
82
|
+
// ----- Event handlers ----- //
|
|
55
83
|
const onPointerDown = (event) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
if (!disabled) {
|
|
85
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
86
|
+
if (vertical) {
|
|
87
|
+
setValueByOffset(sliderRef.getBoundingClientRect().bottom - event.y);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
setValueByOffset(event.x - sliderRef.getBoundingClientRect().left);
|
|
91
|
+
}
|
|
62
92
|
}
|
|
63
|
-
}
|
|
64
93
|
};
|
|
65
94
|
const onPointerMove = (event) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
95
|
+
if (!disabled && event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
96
|
+
if (vertical) {
|
|
97
|
+
setValueByOffset(sliderRef.getBoundingClientRect().bottom - event.y);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
setValueByOffset(event.x - sliderRef.getBoundingClientRect().left);
|
|
101
|
+
}
|
|
71
102
|
}
|
|
72
|
-
}
|
|
73
103
|
};
|
|
74
104
|
const onPointerUp = (event) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
if (!disabled) {
|
|
106
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
107
|
+
}
|
|
78
108
|
};
|
|
79
109
|
const onKeyDown = (event) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
110
|
+
if (!disabled && !event.ctrlKey && !event.shiftKey && !event.altKey) {
|
|
111
|
+
switch (event.code) {
|
|
112
|
+
case 'ArrowDown':
|
|
113
|
+
case 'ArrowLeft':
|
|
114
|
+
setValue(value - step);
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
event.stopPropagation();
|
|
117
|
+
return;
|
|
118
|
+
case 'ArrowRight':
|
|
119
|
+
case 'ArrowUp':
|
|
120
|
+
setValue(value + step);
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
event.stopPropagation();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
94
125
|
}
|
|
95
|
-
}
|
|
96
126
|
};
|
|
97
127
|
</script>
|
|
98
128
|
|
|
@@ -104,9 +134,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
104
134
|
aria-valuemin={0}
|
|
105
135
|
aria-valuenow={value}
|
|
106
136
|
aria-valuemax={max}
|
|
107
|
-
class=
|
|
108
|
-
class:colorful
|
|
109
|
-
class:composed
|
|
137
|
+
class={`sterling-slider ${variant}`}
|
|
110
138
|
class:disabled
|
|
111
139
|
class:horizontal={!vertical}
|
|
112
140
|
class:vertical
|
|
@@ -160,200 +188,3 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
160
188
|
<div class="thumb" style={vertical ? `bottom: ${valueOffset}px` : `left: ${valueOffset}px`} />
|
|
161
189
|
</div>
|
|
162
190
|
</div>
|
|
163
|
-
|
|
164
|
-
<style>
|
|
165
|
-
.sterling-slider {
|
|
166
|
-
box-sizing: border-box;
|
|
167
|
-
outline: none;
|
|
168
|
-
padding: 0;
|
|
169
|
-
overflow: visible;
|
|
170
|
-
display: grid;
|
|
171
|
-
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.sterling-slider.horizontal {
|
|
175
|
-
height: 2em;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.sterling-slider.vertical {
|
|
179
|
-
height: 100%;
|
|
180
|
-
width: 2em;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.sterling-slider.composed,
|
|
184
|
-
.sterling-slider.composed:hover,
|
|
185
|
-
.sterling-slider.composed.focus,
|
|
186
|
-
.sterling-slider.composed.disabled {
|
|
187
|
-
background: none;
|
|
188
|
-
border: none;
|
|
189
|
-
outline: none;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/* ----- container ----- */
|
|
193
|
-
|
|
194
|
-
.container {
|
|
195
|
-
position: relative;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.sterling-slider.horizontal .container {
|
|
199
|
-
margin: 0 0.75em;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.sterling-slider.vertical .container {
|
|
203
|
-
margin: 0.75em 0;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/* ----- track ----- */
|
|
207
|
-
|
|
208
|
-
.track {
|
|
209
|
-
position: absolute;
|
|
210
|
-
background: var(--stsv-common__background-color--secondary);
|
|
211
|
-
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.sterling-slider.horizontal .track {
|
|
215
|
-
left: 0;
|
|
216
|
-
right: 0;
|
|
217
|
-
top: 50%;
|
|
218
|
-
height: 3px;
|
|
219
|
-
transform: translate(0, -50%);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.sterling-slider.vertical .track {
|
|
223
|
-
bottom: 0;
|
|
224
|
-
left: 50%;
|
|
225
|
-
top: 0;
|
|
226
|
-
transform: translate(-50%, 0);
|
|
227
|
-
width: 3px;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.sterling-slider:focus-visible {
|
|
231
|
-
outline-color: var(--stsv-common__outline-color);
|
|
232
|
-
outline-offset: var(--stsv-common__outline-offset);
|
|
233
|
-
outline-style: var(--stsv-common__outline-style);
|
|
234
|
-
outline-width: var(--stsv-common__outline-width);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/* ----- fill ----- */
|
|
238
|
-
|
|
239
|
-
.fill {
|
|
240
|
-
background: var(--stsv-common__color);
|
|
241
|
-
position: absolute;
|
|
242
|
-
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.sterling-slider.horizontal .fill {
|
|
246
|
-
height: 3px;
|
|
247
|
-
top: 50%;
|
|
248
|
-
transform: translate(0, -50%);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.sterling-slider.vertical .fill {
|
|
252
|
-
bottom: 0;
|
|
253
|
-
left: 50%;
|
|
254
|
-
transform: translate(-50%, 0);
|
|
255
|
-
width: 3px;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
.sterling-slider.colorful .fill {
|
|
259
|
-
background: var(--stsv-input--colorful__border-color--selected);
|
|
260
|
-
position: absolute;
|
|
261
|
-
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/* ----- thumb ----- */
|
|
265
|
-
|
|
266
|
-
.thumb {
|
|
267
|
-
background-color: var(--stsv-button__background-color);
|
|
268
|
-
border-color: var(--stsv-button__border-color);
|
|
269
|
-
border-radius: 10000px;
|
|
270
|
-
border-style: var(--stsv-button__border-style);
|
|
271
|
-
border-width: var(--stsv-button__border-width);
|
|
272
|
-
box-sizing: border-box;
|
|
273
|
-
color: var(--stsv-button__color);
|
|
274
|
-
cursor: pointer;
|
|
275
|
-
display: block;
|
|
276
|
-
font: inherit;
|
|
277
|
-
height: 1.5em;
|
|
278
|
-
overflow: hidden;
|
|
279
|
-
padding: 0;
|
|
280
|
-
position: relative;
|
|
281
|
-
text-decoration: none;
|
|
282
|
-
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
283
|
-
white-space: nowrap;
|
|
284
|
-
position: absolute;
|
|
285
|
-
width: 1.5em;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.sterling-slider.horizontal .thumb {
|
|
289
|
-
top: 50%;
|
|
290
|
-
transform: translate(-50%, -50%);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.sterling-slider.vertical .thumb {
|
|
294
|
-
left: 50%;
|
|
295
|
-
transform: translate(-50%, 50%);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.thumb:hover {
|
|
299
|
-
background-color: var(--stsv-button__background-color--hover);
|
|
300
|
-
border-color: var(--stsv-button__border-color--hover);
|
|
301
|
-
color: var(--stsv-button__color--hover);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.thumb:active {
|
|
305
|
-
background-color: var(--stsv-button__background-color--active);
|
|
306
|
-
border-color: var(--stsv-button__border-color--active);
|
|
307
|
-
color: var(--stsv-button__color--active);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/* ----- thumb colorful ----- */
|
|
311
|
-
|
|
312
|
-
.sterling-slider.colorful .thumb {
|
|
313
|
-
background-color: var(--stsv-button--colorful__background-color);
|
|
314
|
-
border-color: var(--stsv-button--colorful__border-color);
|
|
315
|
-
color: var(--stsv-button--colorful__color);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/* ----- thumb disabled ----- */
|
|
319
|
-
|
|
320
|
-
.sterling-slider.disabled .thumb {
|
|
321
|
-
cursor: not-allowed;
|
|
322
|
-
outline: none;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.sterling-slider .thumb::after {
|
|
326
|
-
background: repeating-linear-gradient(
|
|
327
|
-
var(--stsv-common--disabled__stripe-angle),
|
|
328
|
-
var(--stsv-common--disabled__stripe-color),
|
|
329
|
-
var(--stsv-common--disabled__stripe-color) 3px,
|
|
330
|
-
var(--stsv-common__background-color2_disabled) 3px,
|
|
331
|
-
var(--stsv-common__background-color2_disabled) 6px
|
|
332
|
-
);
|
|
333
|
-
bottom: 0;
|
|
334
|
-
content: '';
|
|
335
|
-
left: 0;
|
|
336
|
-
opacity: 0;
|
|
337
|
-
position: absolute;
|
|
338
|
-
right: 0;
|
|
339
|
-
top: 0;
|
|
340
|
-
pointer-events: none;
|
|
341
|
-
transition: opacity 250ms;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.sterling-slider.disabled .thumb::after {
|
|
345
|
-
opacity: 1;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/* ----- reduced motion ----- */
|
|
349
|
-
|
|
350
|
-
@media (prefers-reduced-motion) {
|
|
351
|
-
.sterling-slider,
|
|
352
|
-
.track,
|
|
353
|
-
.fill,
|
|
354
|
-
.thumb,
|
|
355
|
-
.thumb::after {
|
|
356
|
-
transition: none;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
</style>
|
package/Slider.svelte.d.ts
CHANGED
|
@@ -2,14 +2,13 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
colorful?: boolean | undefined;
|
|
6
|
-
composed?: boolean | undefined;
|
|
7
5
|
disabled?: boolean | undefined;
|
|
8
6
|
min?: number | undefined;
|
|
9
7
|
max?: number | undefined;
|
|
10
8
|
precision?: number | undefined;
|
|
11
9
|
step?: number | undefined;
|
|
12
10
|
value?: number | undefined;
|
|
11
|
+
variant?: string | undefined;
|
|
13
12
|
vertical?: boolean | undefined;
|
|
14
13
|
blur?: (() => void) | undefined;
|
|
15
14
|
click?: (() => void) | undefined;
|