[ui] Domi UI: vendor @domi/ui v1.0.2 (domi-design tools/vendor.mjs, MPL-2.0, unedited)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
checked?: boolean;
|
||||
/** Says what is on: "Sync over mobile data". The switch reads as on or off after it. */
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
onchange?: (checked: boolean) => void;
|
||||
force?: string;
|
||||
class?: string;
|
||||
}
|
||||
let { checked = $bindable(false), label, disabled = false, onchange, force, class: cls = '' }: Props = $props();
|
||||
|
||||
function toggle() {
|
||||
if (disabled) return;
|
||||
checked = !checked;
|
||||
onchange?.(checked);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button type="button" role="switch" class={['domi-switch', cls]} aria-checked={checked} {disabled} data-force={force} onclick={toggle}>
|
||||
<span class="domi-switch__track" aria-hidden="true"><span class="domi-switch__knob"></span></span>
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
Reference in New Issue
Block a user