@geoffcox/sterling-svelte 0.0.26 → 0.0.27
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/Button.svelte +79 -24
- package/Button.svelte.d.ts +1 -0
- package/Checkbox.svelte +44 -19
- package/Checkbox.svelte.d.ts +1 -0
- package/ColorPicker.constants.d.ts +1 -0
- package/ColorPicker.constants.js +1 -0
- package/ColorPicker.svelte +226 -0
- package/ColorPicker.svelte.d.ts +22 -0
- package/ColorPicker.types.d.ts +4 -0
- package/ColorPicker.types.js +1 -0
- package/Dialog.svelte +10 -10
- package/Dropdown.svelte +87 -55
- package/Dropdown.svelte.d.ts +4 -0
- package/Field.svelte +31 -31
- package/HexColorSliders.svelte +150 -0
- package/HexColorSliders.svelte.d.ts +22 -0
- package/HslColorSliders.svelte +187 -0
- package/HslColorSliders.svelte.d.ts +22 -0
- package/Input.svelte +49 -21
- package/Input.svelte.d.ts +2 -1
- package/Label.svelte +3 -3
- package/Link.svelte +63 -17
- package/Link.svelte.d.ts +1 -0
- package/List.svelte +28 -16
- package/List.svelte.d.ts +1 -0
- package/List.types.d.ts +4 -3
- package/ListItem.svelte +29 -10
- package/ListItem.svelte.d.ts +1 -1
- package/Menu.svelte +7 -7
- package/MenuBar.svelte +1 -1
- package/MenuButton.svelte +3 -5
- package/MenuItem.svelte +33 -11
- package/MenuItem.svelte.d.ts +1 -0
- package/MenuItemDisplay.svelte +7 -1
- package/MenuSeparator.svelte +3 -3
- package/Popover.svelte +66 -51
- package/Popover.svelte.d.ts +4 -2
- package/Progress.svelte +14 -14
- package/Radio.svelte +42 -16
- package/Radio.svelte.d.ts +1 -0
- package/RgbColorSliders.svelte +161 -0
- package/RgbColorSliders.svelte.d.ts +22 -0
- package/Select.svelte +30 -24
- package/Slider.svelte +108 -118
- package/Slider.svelte.d.ts +1 -0
- package/Switch.svelte +97 -34
- package/Switch.svelte.d.ts +1 -0
- package/Tab.svelte +52 -29
- package/TabList.svelte +21 -10
- package/TabList.svelte.d.ts +1 -0
- package/TabList.types.d.ts +1 -0
- package/TextArea.svelte +45 -20
- package/TextArea.svelte.d.ts +3 -2
- package/Tooltip.svelte +12 -11
- package/Tree.svelte +34 -21
- package/Tree.svelte.d.ts +2 -0
- package/Tree.types.d.ts +1 -0
- package/TreeChevron.svelte +1 -1
- package/TreeItem.svelte +40 -9
- package/TreeItem.svelte.d.ts +2 -0
- package/TreeItemDisplay.svelte +26 -8
- package/TreeItemDisplay.svelte.d.ts +2 -0
- package/actions/clickOutside.js +1 -1
- package/actions/trapKeyboardFocus.d.ts +3 -0
- package/actions/trapKeyboardFocus.js +52 -0
- package/floating-ui.types.d.ts +2 -0
- package/index.d.ts +8 -3
- package/index.js +7 -2
- package/package.json +10 -1
- package/theme/applyTheme.js +3 -2
- package/theme/colors.d.ts +1 -0
- package/theme/colors.js +28 -13
- package/theme/darkTheme.js +130 -87
- package/theme/lightTheme.js +107 -87
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import Input from "./Input.svelte";
|
|
3
|
+
import Slider from "./Slider.svelte";
|
|
4
|
+
import { round } from "lodash-es";
|
|
5
|
+
export let red = 0;
|
|
6
|
+
export let green = 0;
|
|
7
|
+
export let blue = 0;
|
|
8
|
+
export let alpha = 1;
|
|
9
|
+
export let colorful = false;
|
|
10
|
+
let redText = red.toString();
|
|
11
|
+
let greenText = green.toString();
|
|
12
|
+
let blueText = blue.toString();
|
|
13
|
+
let alphaText = alpha.toString();
|
|
14
|
+
$: {
|
|
15
|
+
redText = red.toString();
|
|
16
|
+
}
|
|
17
|
+
$: {
|
|
18
|
+
greenText = green.toString();
|
|
19
|
+
}
|
|
20
|
+
$: {
|
|
21
|
+
blueText = blue.toString();
|
|
22
|
+
}
|
|
23
|
+
$: {
|
|
24
|
+
alphaText = alpha.toString();
|
|
25
|
+
}
|
|
26
|
+
const dispatcher = createEventDispatcher();
|
|
27
|
+
const raiseChange = () => {
|
|
28
|
+
dispatcher("change", { red, green, blue, alpha });
|
|
29
|
+
};
|
|
30
|
+
$:
|
|
31
|
+
red, green, blue, alpha, raiseChange();
|
|
32
|
+
const parseRgbValue = (text, defaultValue = 0) => {
|
|
33
|
+
if (!text) {
|
|
34
|
+
return defaultValue;
|
|
35
|
+
}
|
|
36
|
+
const newValue = text ? Number.parseFloat(text) : defaultValue;
|
|
37
|
+
if (newValue && newValue !== Number.NaN) {
|
|
38
|
+
return Math.round(Math.max(0, Math.min(255, newValue)));
|
|
39
|
+
}
|
|
40
|
+
return defaultValue;
|
|
41
|
+
};
|
|
42
|
+
const onRedInputChange = (event) => {
|
|
43
|
+
const inputChangeEvent = event;
|
|
44
|
+
red = parseRgbValue(inputChangeEvent?.currentTarget?.value, red);
|
|
45
|
+
};
|
|
46
|
+
const onGreenInputChange = (event) => {
|
|
47
|
+
const inputChangeEvent = event;
|
|
48
|
+
green = parseRgbValue(inputChangeEvent?.currentTarget?.value, green);
|
|
49
|
+
};
|
|
50
|
+
const onBlueInputChange = (event) => {
|
|
51
|
+
const inputChangeEvent = event;
|
|
52
|
+
blue = parseRgbValue(inputChangeEvent?.currentTarget?.value, blue);
|
|
53
|
+
};
|
|
54
|
+
const onAlphaInputchange = (event) => {
|
|
55
|
+
const inputChangeEvent = event;
|
|
56
|
+
const text = inputChangeEvent?.currentTarget?.value;
|
|
57
|
+
const newValue = text ? Number.parseFloat(text) : alpha;
|
|
58
|
+
if (newValue && newValue !== Number.NaN) {
|
|
59
|
+
alpha = round(Math.max(0, Math.min(1, newValue)), 2);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<div class="sterling-rgb-color-sliders">
|
|
65
|
+
<div class="slider red-slider">
|
|
66
|
+
<Slider {colorful} min={0} max={255} precision={0} bind:value={red} />
|
|
67
|
+
</div>
|
|
68
|
+
<Input {colorful} bind:value={redText} on:change={(e) => onRedInputChange(e)} />
|
|
69
|
+
<div class="slider green-slider">
|
|
70
|
+
<Slider {colorful} min={0} max={255} precision={0} bind:value={green} />
|
|
71
|
+
</div>
|
|
72
|
+
<Input {colorful} bind:value={greenText} on:change={(e) => onGreenInputChange(e)} />
|
|
73
|
+
<div class="slider blue-slider">
|
|
74
|
+
<Slider {colorful} min={0} max={255} precision={0} bind:value={blue} />
|
|
75
|
+
</div>
|
|
76
|
+
<Input {colorful} bind:value={blueText} on:change={(e) => onBlueInputChange(e)} />
|
|
77
|
+
<div class="alpha" style={`--red:${red};--green:${green};--blue:${blue}`}>
|
|
78
|
+
<div class="alpha-hatch" />
|
|
79
|
+
<div class="alpha-gradient" />
|
|
80
|
+
<div class="slider alpha-slider">
|
|
81
|
+
<Slider {colorful} min={0} max={1} precision={2} bind:value={alpha} />
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<Input {colorful} bind:value={alphaText} on:change={(e) => onAlphaInputchange(e)} />
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<style>
|
|
88
|
+
.sterling-rgb-color-sliders {
|
|
89
|
+
align-items: center;
|
|
90
|
+
display: grid;
|
|
91
|
+
grid-template-columns: 1fr 4em;
|
|
92
|
+
column-gap: 0.5em;
|
|
93
|
+
row-gap: 0.25em;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.slider :global(.fill),
|
|
97
|
+
.slider :global(.sterling-slider.colorful .fill) {
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.slider :global(.track),
|
|
102
|
+
.slider :global(.sterling-slider.colorful .track) {
|
|
103
|
+
background-color: transparent;
|
|
104
|
+
background-image: linear-gradient(to right, #ffffff, #ffffff 1px, #000000 1px, #000000);
|
|
105
|
+
background-size: 2px 100%;
|
|
106
|
+
opacity: 0.1;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.red-slider {
|
|
110
|
+
background: linear-gradient(to right, black 0%, rgb(255, 0, 0) 100%);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.green-slider {
|
|
114
|
+
background: linear-gradient(to right, black 0%, rgb(0, 255, 0) 100%);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.blue-slider {
|
|
118
|
+
background: linear-gradient(to right, black 0%, rgb(0, 0, 255) 100%);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.alpha {
|
|
122
|
+
display: grid;
|
|
123
|
+
grid-template-columns: 1fr;
|
|
124
|
+
grid-template-rows: 1fr;
|
|
125
|
+
place-content: stretch;
|
|
126
|
+
place-items: stretch;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.alpha-gradient,
|
|
130
|
+
.alpha-hatch,
|
|
131
|
+
.alpha-slider {
|
|
132
|
+
grid-row: 1 / span 1;
|
|
133
|
+
grid-column: 1 / span 1;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.alpha-hatch {
|
|
137
|
+
background-color: #eee;
|
|
138
|
+
opacity: 0.1;
|
|
139
|
+
background-image: repeating-linear-gradient(
|
|
140
|
+
45deg,
|
|
141
|
+
#444 25%,
|
|
142
|
+
transparent 25%,
|
|
143
|
+
transparent 75%,
|
|
144
|
+
#444 75%,
|
|
145
|
+
#444
|
|
146
|
+
),
|
|
147
|
+
repeating-linear-gradient(45deg, #444 25%, #eee 25%, #eee 75%, #444 75%, #444),
|
|
148
|
+
repeating-linear-gradient(-45deg, #444 25%, transparent 25%, transparent 75%, #444 75%, #444),
|
|
149
|
+
repeating-linear-gradient(-45deg, #444 25%, #eee 25%, #eee 75%, #444 75%, #444);
|
|
150
|
+
background-position: 0 0, 4px 4px;
|
|
151
|
+
background-size: 8px 8px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.alpha-gradient {
|
|
155
|
+
background: linear-gradient(
|
|
156
|
+
to right,
|
|
157
|
+
rgba(var(--red), var(--green), var(--blue), 0) 0%,
|
|
158
|
+
rgba(var(--red), var(--green), var(--blue), 100) 100%
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
red?: number | undefined;
|
|
5
|
+
green?: number | undefined;
|
|
6
|
+
blue?: number | undefined;
|
|
7
|
+
alpha?: number | undefined;
|
|
8
|
+
colorful?: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
change: CustomEvent<any>;
|
|
12
|
+
} & {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type RgbColorSlidersProps = typeof __propDef.props;
|
|
18
|
+
export type RgbColorSlidersEvents = typeof __propDef.events;
|
|
19
|
+
export type RgbColorSlidersSlots = typeof __propDef.slots;
|
|
20
|
+
export default class RgbColorSliders extends SvelteComponentTyped<RgbColorSlidersProps, RgbColorSlidersEvents, RgbColorSlidersSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
package/Select.svelte
CHANGED
|
@@ -178,7 +178,7 @@ const onListSelect = (event) => {
|
|
|
178
178
|
on:mouseover
|
|
179
179
|
on:mouseout
|
|
180
180
|
on:mouseup
|
|
181
|
-
on:wheel
|
|
181
|
+
on:wheel|passive
|
|
182
182
|
on:paste
|
|
183
183
|
on:click={onSelectClick}
|
|
184
184
|
on:click_outside={() => (open = false)}
|
|
@@ -199,7 +199,7 @@ const onListSelect = (event) => {
|
|
|
199
199
|
<div class="chevron" />
|
|
200
200
|
</slot>
|
|
201
201
|
</div>
|
|
202
|
-
<Popup reference={selectRef} bind:open id={popupId}>
|
|
202
|
+
<Popup reference={selectRef} bind:open id={popupId} persistent>
|
|
203
203
|
<div class="popup-content">
|
|
204
204
|
<List
|
|
205
205
|
bind:this={listRef}
|
|
@@ -221,12 +221,12 @@ const onListSelect = (event) => {
|
|
|
221
221
|
.sterling-select {
|
|
222
222
|
align-content: center;
|
|
223
223
|
align-items: center;
|
|
224
|
-
background-color: var(--stsv-
|
|
225
|
-
border-color: var(--stsv-
|
|
226
|
-
border-radius: var(--stsv-
|
|
227
|
-
border-style: var(--stsv-
|
|
228
|
-
border-width: var(--stsv-
|
|
229
|
-
color: var(--stsv-
|
|
224
|
+
background-color: var(--stsv-input__background-color);
|
|
225
|
+
border-color: var(--stsv-input__border-color);
|
|
226
|
+
border-radius: var(--stsv-input__border-radius);
|
|
227
|
+
border-style: var(--stsv-input__border-style);
|
|
228
|
+
border-width: var(--stsv-input__border-width);
|
|
229
|
+
color: var(--stsv-input__color);
|
|
230
230
|
cursor: pointer;
|
|
231
231
|
display: grid;
|
|
232
232
|
grid-template-columns: 1fr auto;
|
|
@@ -238,19 +238,19 @@ const onListSelect = (event) => {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
.sterling-select:hover {
|
|
241
|
-
background-color: var(--stsv-
|
|
242
|
-
border-color: var(--stsv-
|
|
243
|
-
color: var(--stsv-
|
|
241
|
+
background-color: var(--stsv-input__background-color--hover);
|
|
242
|
+
border-color: var(--stsv-input__border-color--hover);
|
|
243
|
+
color: var(--stsv-input__color--hover);
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
.sterling-select:focus {
|
|
247
|
-
background-color: var(--stsv-
|
|
248
|
-
border-color: var(--stsv-
|
|
249
|
-
color: var(--stsv-
|
|
250
|
-
outline-color: var(--stsv-
|
|
251
|
-
outline-offset: var(--stsv-
|
|
252
|
-
outline-style: var(--stsv-
|
|
253
|
-
outline-width: var(--stsv-
|
|
247
|
+
background-color: var(--stsv-input__background-color--focus);
|
|
248
|
+
border-color: var(--stsv-input__border-color--focus);
|
|
249
|
+
color: var(--stsv-input__color--focus);
|
|
250
|
+
outline-color: var(--stsv-common__outline-color);
|
|
251
|
+
outline-offset: var(--stsv-common__outline-offset);
|
|
252
|
+
outline-style: var(--stsv-common__outline-style);
|
|
253
|
+
outline-width: var(--stsv-common__outline-width);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
.sterling-select.disabled {
|
|
@@ -259,7 +259,13 @@ const onListSelect = (event) => {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
.sterling-select::after {
|
|
262
|
-
background:
|
|
262
|
+
background: repeating-linear-gradient(
|
|
263
|
+
45deg,
|
|
264
|
+
var(--stsv-common__background-color1--disabled),
|
|
265
|
+
var(--stsv-common__background-color1--disabled) 3px,
|
|
266
|
+
var(--stsv-common__background-color2--disabled) 3px,
|
|
267
|
+
var(--stsv-common__background-color2--disabled) 6px
|
|
268
|
+
);
|
|
263
269
|
bottom: 0;
|
|
264
270
|
content: '';
|
|
265
271
|
left: 0;
|
|
@@ -329,11 +335,11 @@ const onListSelect = (event) => {
|
|
|
329
335
|
}
|
|
330
336
|
|
|
331
337
|
.popup-content {
|
|
332
|
-
background-color: var(--stsv-
|
|
333
|
-
border-color: var(--stsv-
|
|
334
|
-
border-radius: var(--stsv-
|
|
335
|
-
border-style: var(--stsv-
|
|
336
|
-
border-width: var(--stsv-
|
|
338
|
+
background-color: var(--stsv-common__background-color);
|
|
339
|
+
border-color: var(--stsv-common__border-color);
|
|
340
|
+
border-radius: var(--stsv-common__border-radius);
|
|
341
|
+
border-style: var(--stsv-common__border-style);
|
|
342
|
+
border-width: var(--stsv-common__border-width);
|
|
337
343
|
padding: 0.25em;
|
|
338
344
|
display: grid;
|
|
339
345
|
grid-template-columns: 1fr;
|
package/Slider.svelte
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
2
|
import { round } from "lodash-es";
|
|
3
|
+
export let colorful = false;
|
|
3
4
|
export let composed = false;
|
|
4
5
|
export let disabled = false;
|
|
5
6
|
export let min = 0;
|
|
6
7
|
export let max = 100;
|
|
7
|
-
export let precision = 0;
|
|
8
|
+
export let precision = void 0;
|
|
8
9
|
export let step = void 0;
|
|
9
10
|
export let value = 0;
|
|
10
11
|
export let vertical = false;
|
|
@@ -22,48 +23,17 @@ const dispatch = createEventDispatcher();
|
|
|
22
23
|
const raiseChange = (newValue) => {
|
|
23
24
|
dispatch("change", { value: newValue });
|
|
24
25
|
};
|
|
25
|
-
const getPrecision = (value2) => {
|
|
26
|
-
if (value2 !== void 0 && Number !== null && !Number.isNaN(value2)) {
|
|
27
|
-
const text = value2.toString();
|
|
28
|
-
const position = text.indexOf(".");
|
|
29
|
-
if (position !== -1) {
|
|
30
|
-
const fraction = text.substring(position + 1);
|
|
31
|
-
if (fraction) {
|
|
32
|
-
return fraction.length;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return 0;
|
|
37
|
-
};
|
|
38
|
-
$:
|
|
39
|
-
highestPrecision = Math.max(
|
|
40
|
-
precision,
|
|
41
|
-
getPrecision(min),
|
|
42
|
-
getPrecision(max),
|
|
43
|
-
getPrecision(step)
|
|
44
|
-
);
|
|
45
26
|
const setValue = (newValue) => {
|
|
46
|
-
|
|
27
|
+
const clamped = Math.max(min, Math.min(max, newValue));
|
|
28
|
+
value = precision !== void 0 ? round(clamped, precision) : clamped;
|
|
47
29
|
};
|
|
48
30
|
$: {
|
|
49
31
|
if (min > max) {
|
|
50
32
|
min = max;
|
|
51
33
|
}
|
|
52
34
|
}
|
|
53
|
-
$:
|
|
54
|
-
|
|
55
|
-
setValue(value);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
$: {
|
|
59
|
-
if (step) {
|
|
60
|
-
let stepValue = Math.max(min, Math.min(value, max));
|
|
61
|
-
stepValue = Math.round(stepValue / step) * step + min;
|
|
62
|
-
if (stepValue !== value) {
|
|
63
|
-
setValue(stepValue);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
35
|
+
$:
|
|
36
|
+
min, max, precision, setValue(value);
|
|
67
37
|
$:
|
|
68
38
|
ratio = (value - min) / (max - min);
|
|
69
39
|
$:
|
|
@@ -137,6 +107,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
137
107
|
aria-valuenow={value}
|
|
138
108
|
aria-valuemax={max}
|
|
139
109
|
class="sterling-slider"
|
|
110
|
+
class:colorful
|
|
140
111
|
class:composed
|
|
141
112
|
class:disabled
|
|
142
113
|
class:horizontal={!vertical}
|
|
@@ -177,7 +148,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
177
148
|
on:pointerout
|
|
178
149
|
on:pointerup
|
|
179
150
|
on:pointerup={onPointerUp}
|
|
180
|
-
on:wheel
|
|
151
|
+
on:wheel|passive
|
|
181
152
|
{...$$restProps}
|
|
182
153
|
>
|
|
183
154
|
<div
|
|
@@ -202,34 +173,106 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
202
173
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
203
174
|
}
|
|
204
175
|
|
|
176
|
+
.sterling-slider.horizontal {
|
|
177
|
+
height: 2em;
|
|
178
|
+
}
|
|
179
|
+
|
|
205
180
|
.sterling-slider.vertical {
|
|
206
181
|
height: 100%;
|
|
182
|
+
width: 2em;
|
|
207
183
|
}
|
|
208
184
|
|
|
185
|
+
.sterling-slider.composed,
|
|
186
|
+
.sterling-slider.composed:hover,
|
|
187
|
+
.sterling-slider.composed.focus,
|
|
188
|
+
.sterling-slider.composed.disabled {
|
|
189
|
+
background: none;
|
|
190
|
+
border: none;
|
|
191
|
+
outline: none;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ----- container ----- */
|
|
195
|
+
|
|
209
196
|
.container {
|
|
210
197
|
position: relative;
|
|
211
198
|
}
|
|
212
199
|
|
|
200
|
+
.sterling-slider.horizontal .container {
|
|
201
|
+
margin: 0 0.75em;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.sterling-slider.vertical .container {
|
|
205
|
+
margin: 0.75em 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* ----- track ----- */
|
|
209
|
+
|
|
213
210
|
.track {
|
|
214
211
|
position: absolute;
|
|
215
|
-
background: var(--stsv-
|
|
212
|
+
background: var(--stsv-common__background-color--secondary);
|
|
216
213
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
217
214
|
}
|
|
218
215
|
|
|
216
|
+
.sterling-slider.horizontal .track {
|
|
217
|
+
left: 0;
|
|
218
|
+
right: 0;
|
|
219
|
+
top: 50%;
|
|
220
|
+
height: 3px;
|
|
221
|
+
transform: translate(0, -50%);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.sterling-slider.vertical .track {
|
|
225
|
+
bottom: 0;
|
|
226
|
+
left: 50%;
|
|
227
|
+
top: 0;
|
|
228
|
+
transform: translate(-50%, 0);
|
|
229
|
+
width: 3px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.sterling-slider:focus-visible {
|
|
233
|
+
outline-color: var(--stsv-common__outline-color);
|
|
234
|
+
outline-offset: var(--stsv-common__outline-offset);
|
|
235
|
+
outline-style: var(--stsv-common__outline-style);
|
|
236
|
+
outline-width: var(--stsv-common__outline-width);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* ----- fill ----- */
|
|
240
|
+
|
|
219
241
|
.fill {
|
|
220
|
-
background: var(--stsv-
|
|
242
|
+
background: var(--stsv-common__color);
|
|
243
|
+
position: absolute;
|
|
244
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.sterling-slider.horizontal .fill {
|
|
248
|
+
height: 3px;
|
|
249
|
+
top: 50%;
|
|
250
|
+
transform: translate(0, -50%);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.sterling-slider.vertical .fill {
|
|
254
|
+
bottom: 0;
|
|
255
|
+
left: 50%;
|
|
256
|
+
transform: translate(-50%, 0);
|
|
257
|
+
width: 3px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.sterling-slider.colorful .fill {
|
|
261
|
+
background: var(--stsv-input--colorful__border-color--selected);
|
|
221
262
|
position: absolute;
|
|
222
263
|
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
223
264
|
}
|
|
224
265
|
|
|
266
|
+
/* ----- thumb ----- */
|
|
267
|
+
|
|
225
268
|
.thumb {
|
|
226
|
-
background-color: var(--stsv-
|
|
227
|
-
border-color: var(--stsv-
|
|
269
|
+
background-color: var(--stsv-button__background-color);
|
|
270
|
+
border-color: var(--stsv-button__border-color);
|
|
228
271
|
border-radius: 10000px;
|
|
229
|
-
border-style: var(--stsv-
|
|
230
|
-
border-width: var(--stsv-
|
|
272
|
+
border-style: var(--stsv-button__border-style);
|
|
273
|
+
border-width: var(--stsv-button__border-width);
|
|
231
274
|
box-sizing: border-box;
|
|
232
|
-
color: var(--stsv-
|
|
275
|
+
color: var(--stsv-button__color);
|
|
233
276
|
cursor: pointer;
|
|
234
277
|
display: block;
|
|
235
278
|
font: inherit;
|
|
@@ -244,89 +287,37 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
244
287
|
width: 1.5em;
|
|
245
288
|
}
|
|
246
289
|
|
|
247
|
-
/* ----- horizontal ----- */
|
|
248
|
-
|
|
249
|
-
.sterling-slider.horizontal {
|
|
250
|
-
height: 2em;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.sterling-slider.horizontal .container {
|
|
254
|
-
margin: 0 0.75em;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.sterling-slider.horizontal .track {
|
|
258
|
-
left: 0;
|
|
259
|
-
right: 0;
|
|
260
|
-
top: 50%;
|
|
261
|
-
height: 3px;
|
|
262
|
-
transform: translate(0, -50%);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.sterling-slider.horizontal .fill {
|
|
266
|
-
height: 3px;
|
|
267
|
-
top: 50%;
|
|
268
|
-
transform: translate(0, -50%);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
290
|
.sterling-slider.horizontal .thumb {
|
|
272
291
|
top: 50%;
|
|
273
292
|
transform: translate(-50%, -50%);
|
|
274
293
|
}
|
|
275
294
|
|
|
276
|
-
/* ----- vertical ----- */
|
|
277
|
-
|
|
278
|
-
.sterling-slider.vertical {
|
|
279
|
-
width: 2em;
|
|
280
|
-
}
|
|
281
|
-
.sterling-slider.vertical .container {
|
|
282
|
-
margin: 0.75em 0;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
.sterling-slider.vertical .track {
|
|
286
|
-
bottom: 0;
|
|
287
|
-
left: 50%;
|
|
288
|
-
top: 0;
|
|
289
|
-
transform: translate(-50%, 0);
|
|
290
|
-
width: 3px;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.sterling-slider.vertical .fill {
|
|
294
|
-
bottom: 0;
|
|
295
|
-
left: 50%;
|
|
296
|
-
transform: translate(-50%, 0);
|
|
297
|
-
width: 3px;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
295
|
.sterling-slider.vertical .thumb {
|
|
301
296
|
left: 50%;
|
|
302
297
|
transform: translate(-50%, 50%);
|
|
303
298
|
}
|
|
304
299
|
|
|
305
|
-
/* ----- hover ----- */
|
|
306
|
-
|
|
307
300
|
.thumb:hover {
|
|
308
|
-
background-color: var(--stsv-
|
|
309
|
-
border-color: var(--stsv-
|
|
310
|
-
color: var(--stsv-
|
|
301
|
+
background-color: var(--stsv-button__background-color--hover);
|
|
302
|
+
border-color: var(--stsv-button__border-color--hover);
|
|
303
|
+
color: var(--stsv-button__color--hover);
|
|
311
304
|
}
|
|
312
305
|
|
|
313
|
-
/* ----- active ----- */
|
|
314
|
-
|
|
315
306
|
.thumb:active {
|
|
316
|
-
background-color: var(--stsv-
|
|
317
|
-
border-color: var(--stsv-
|
|
318
|
-
color: var(--stsv-
|
|
307
|
+
background-color: var(--stsv-button__background-color--active);
|
|
308
|
+
border-color: var(--stsv-button__border-color--active);
|
|
309
|
+
color: var(--stsv-button__color--active);
|
|
319
310
|
}
|
|
320
311
|
|
|
321
|
-
/* -----
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
312
|
+
/* ----- thumb colorful ----- */
|
|
313
|
+
|
|
314
|
+
.sterling-slider.colorful .thumb {
|
|
315
|
+
background-color: var(--stsv-button--colorful__background-color);
|
|
316
|
+
border-color: var(--stsv-button--colorful__border-color);
|
|
317
|
+
color: var(--stsv-button--colorful__color);
|
|
327
318
|
}
|
|
328
319
|
|
|
329
|
-
/* ----- disabled ----- */
|
|
320
|
+
/* ----- thumb disabled ----- */
|
|
330
321
|
|
|
331
322
|
.sterling-slider.disabled .thumb {
|
|
332
323
|
cursor: not-allowed;
|
|
@@ -334,7 +325,13 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
334
325
|
}
|
|
335
326
|
|
|
336
327
|
.sterling-slider .thumb::after {
|
|
337
|
-
background:
|
|
328
|
+
background: repeating-linear-gradient(
|
|
329
|
+
45deg,
|
|
330
|
+
var(--stsv-common__background-color1--disabled),
|
|
331
|
+
var(--stsv-common__background-color1--disabled) 3px,
|
|
332
|
+
var(--stsv-common__background-color2_disabled) 3px,
|
|
333
|
+
var(--stsv-common__background-color2_disabled) 6px
|
|
334
|
+
);
|
|
338
335
|
bottom: 0;
|
|
339
336
|
content: '';
|
|
340
337
|
left: 0;
|
|
@@ -350,14 +347,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
|
|
|
350
347
|
opacity: 1;
|
|
351
348
|
}
|
|
352
349
|
|
|
353
|
-
|
|
354
|
-
.sterling-slider.composed:hover,
|
|
355
|
-
.sterling-slider.composed.focus,
|
|
356
|
-
.sterling-slider.composed.disabled {
|
|
357
|
-
background: none;
|
|
358
|
-
border: none;
|
|
359
|
-
outline: none;
|
|
360
|
-
}
|
|
350
|
+
/* ----- reduced motion ----- */
|
|
361
351
|
|
|
362
352
|
@media (prefers-reduced-motion) {
|
|
363
353
|
.sterling-slider,
|
package/Slider.svelte.d.ts
CHANGED