blob: aec8f4e950fd0e073095954bfc7db85c65961aaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<script lang="ts">
import type { InvokeMessage } from "@dispatch/ui-contract";
import type { ToggleFieldView } from "../logic/types";
let {
field,
surfaceId,
onInvoke,
}: { field: ToggleFieldView; surfaceId: string; onInvoke: (msg: InvokeMessage) => void } =
$props();
function handleChange() {
onInvoke({
type: "invoke",
surfaceId,
actionId: field.action.actionId,
payload: !field.value,
});
}
</script>
<label>
<input type="checkbox" checked={field.value} onchange={handleChange} />
{field.label}
</label>
|