bos-settings/frontend/src/lib/components/SliderField.svelte
Breadway dce2031743 Settings redesign: hub-based navigation, plus hardening and bug fixes
Rework the settings app around hub pages (home, network, displays, input,
apps, privacy, system) with a redesigned sidebar, shared nav state, and new
hub view components. Alongside the redesign: validate webview inputs into
root commands (users, firewall, snapshots, wifi), fix set_charge_threshold
writing the percentage via tee stdin, prevent streaming installs from
hanging on inherited stdin, add frontend type fixes, sync versions to
0.8.2, and clean up clippy/svelte-check warnings.
2026-08-31 16:04:02 +08:00

44 lines
793 B
Svelte

<script lang="ts">
import Row from "./Row.svelte";
let {
label,
hint,
value = $bindable(),
min,
max,
step = 1,
suffix = "",
onChange,
}: {
label: string;
hint?: string;
value: number;
min: number;
max: number;
step?: number;
suffix?: string;
onChange?: () => void;
} = $props();
let shown = $derived(step < 1 ? Number(value).toFixed(2).replace(/0+$/, "").replace(/\.$/, "") : String(Math.round(value)));
</script>
<Row {label} {hint}>
<input type="range" {min} {max} {step} bind:value oninput={() => onChange?.()} />
<span class="val">{shown}{suffix}</span>
</Row>
<style>
input[type="range"] {
width: 160px;
accent-color: var(--accent);
}
.val {
min-width: 4.5ch;
text-align: right;
font-size: 12px;
color: var(--muted);
}
</style>