m3-svelte 5.15.0 → 5.15.2
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/forms/Slider.svelte +17 -14
- package/package.json +1 -1
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
} & Omit<HTMLInputAttributes, "size"> = $props();
|
|
39
39
|
// @ts-expect-error deprecated backwards compatibility with ticks
|
|
40
40
|
let stops = $derived(extra.ticks ? true : _stops);
|
|
41
|
-
let
|
|
41
|
+
let offsetWidth = $state(600);
|
|
42
|
+
let offsetHeight = $state(600);
|
|
43
|
+
let inlineSize = $derived(vertical ? offsetHeight : offsetWidth);
|
|
42
44
|
|
|
43
45
|
const valueDisplayed = new Spring(value, { stiffness: 0.3, damping: 1 });
|
|
44
46
|
const updateValue = (e: Event & { currentTarget: EventTarget & HTMLInputElement }) => {
|
|
@@ -72,7 +74,8 @@
|
|
|
72
74
|
<div
|
|
73
75
|
class="m3-container {size} {vertical ? 'vertical' : ''}"
|
|
74
76
|
style:--handle={handle - 0.5}
|
|
75
|
-
bind:offsetWidth
|
|
77
|
+
bind:offsetWidth
|
|
78
|
+
bind:offsetHeight
|
|
76
79
|
>
|
|
77
80
|
<input
|
|
78
81
|
type="range"
|
|
@@ -97,13 +100,13 @@
|
|
|
97
100
|
{#if leadingIcon}
|
|
98
101
|
<Icon
|
|
99
102
|
icon={leadingIcon}
|
|
100
|
-
class={"leading" + (
|
|
103
|
+
class={"leading" + (inlineSize * handle < (size == "xl" ? 48 : 40) ? " pop" : "")}
|
|
101
104
|
/>
|
|
102
105
|
{/if}
|
|
103
106
|
{#if trailingIcon}
|
|
104
107
|
<Icon
|
|
105
108
|
icon={trailingIcon}
|
|
106
|
-
class={"trailing" + (
|
|
109
|
+
class={"trailing" + (inlineSize * (1 - handle) < (size == "xl" ? 48 : 40) ? " pop" : "")}
|
|
107
110
|
/>
|
|
108
111
|
{/if}
|
|
109
112
|
<div class="handle"></div>
|
|
@@ -133,7 +136,7 @@
|
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
.m3-container.vertical {
|
|
136
|
-
writing-mode:
|
|
139
|
+
writing-mode: sideways-lr;
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
.m3-container.xs {
|
|
@@ -229,7 +232,7 @@
|
|
|
229
232
|
}
|
|
230
233
|
|
|
231
234
|
&:is(.vertical > input) {
|
|
232
|
-
translate: 0
|
|
235
|
+
translate: 0 50%;
|
|
233
236
|
}
|
|
234
237
|
}
|
|
235
238
|
|
|
@@ -254,8 +257,8 @@
|
|
|
254
257
|
}
|
|
255
258
|
&:is(.vertical > .track-1) {
|
|
256
259
|
clip-path: inset(
|
|
257
|
-
|
|
258
|
-
var(--m3-slider-track-in-shape) var(--
|
|
260
|
+
calc(100% - var(--handle-left)) 0 0 0 round var(--m3-slider-track-in-shape)
|
|
261
|
+
var(--m3-slider-track-in-shape) var(--track-radius) var(--track-radius)
|
|
259
262
|
);
|
|
260
263
|
}
|
|
261
264
|
|
|
@@ -283,8 +286,8 @@
|
|
|
283
286
|
}
|
|
284
287
|
&:is(.vertical > .track-2) {
|
|
285
288
|
clip-path: inset(
|
|
286
|
-
var(--handle-right) 0
|
|
287
|
-
var(--m3-slider-track-in-shape) var(--
|
|
289
|
+
0 0 var(--handle-right) 0 round var(--track-radius) var(--track-radius)
|
|
290
|
+
var(--m3-slider-track-in-shape) var(--m3-slider-track-in-shape)
|
|
288
291
|
);
|
|
289
292
|
}
|
|
290
293
|
|
|
@@ -310,7 +313,7 @@
|
|
|
310
313
|
translate: 50% -50%;
|
|
311
314
|
}
|
|
312
315
|
&:is(.vertical .stop) {
|
|
313
|
-
translate: -50%
|
|
316
|
+
translate: -50% 50%;
|
|
314
317
|
}
|
|
315
318
|
&:is(.track-1 > .stop) {
|
|
316
319
|
background-color: rgb(var(--m3-scheme-on-primary));
|
|
@@ -337,7 +340,7 @@
|
|
|
337
340
|
translate: 50% 0;
|
|
338
341
|
}
|
|
339
342
|
&:is(.vertical > .handle) {
|
|
340
|
-
translate: 0
|
|
343
|
+
translate: 0 50%;
|
|
341
344
|
}
|
|
342
345
|
border-radius: 1.25rem;
|
|
343
346
|
background-color: rgb(var(--m3-scheme-primary));
|
|
@@ -385,8 +388,8 @@
|
|
|
385
388
|
}
|
|
386
389
|
|
|
387
390
|
&:is(.vertical > .value) {
|
|
388
|
-
translate: 0
|
|
389
|
-
rotate:
|
|
391
|
+
translate: 0 50%;
|
|
392
|
+
rotate: 90deg;
|
|
390
393
|
}
|
|
391
394
|
}
|
|
392
395
|
|