Vue kit: UiCheckbox for the Visual, voice, Data Library and welcome checkboxes

UiCheckbox is a label wrapping a native checkbox and its words; trailing
puts the box after them, as the Visual panel's rows have it. v-model shows
the value and emits the checked state, and change is emitted with its event;
without a modelValue the box is the browser's own, as the welcome card's
"Don't show this again" is. restore puts the box back to modelValue once a
change has rendered without the owner taking it, which is what the voice
panel's v-checked directive did for a refused preference. Attributes go to
the label; inputId and inputAttrs to the box.

checkbox.css holds the centred flex row, moved out of the two labels that
hold only a checkbox (first-run.css, library.css) and loaded before them.
Each box keeps its skin's size, margin and accent colour. checkboxes.test.mjs
fails if a view writes a checkbox by hand; Story Explore's filters are not
converted yet.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-19 01:05:12 -08:00
1 parent 52dd576769
commit 2d7b7be890
18 files changed
+385 -41

No files matched your search

+7 -9
View File
@@ -11,6 +11,7 @@ import UiSegmented from '../../kit/UiSegmented.vue';
import UiSlider from '../../kit/UiSlider.js';
import { useDisplayStore } from '../../stores/display.js';
import UiButton from '../../kit/UiButton.vue';
import UiCheckbox from '../../kit/UiCheckbox.vue';
import UiSelect from '../../kit/UiSelect.js';
import { StyleParameterRows } from '../../styleParameters.js';
import VisualPresets from './VisualPresets.vue';
@@ -182,11 +183,10 @@ const allocationOptions = computed(() => [
</div>
</Teleport>
<div class="pp-toggle-group">
<label class="pp-toggle-btn pp-scope-toggle" :title="t('Scope — the circular viewport mask')">
<UiCheckbox class="pp-toggle-btn pp-scope-toggle" :title="t('Scope — the circular viewport mask')" input-id="scope-toggle" trailing :model-value="scopeOn" @update:model-value="act('setScopeEnabled', $event)">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">adjust</span>
<span class="pp-label">{{ t('Scope') }}</span>
<input type="checkbox" id="scope-toggle" @change="act('setScopeEnabled', $event.target.checked)" :checked="scopeOn" />
</label>
</UiCheckbox>
<div class="pp-slider-row visible" id="scope-slider-row">
<span class="pp-slider-mini-label">{{ t('Feather') }}</span>
<UiSlider class="pp-slider" id="scope-feather-slider" @update:model-value="act('setScopeFeather', $event)" min="0" max="200" :model-value="scopeFeather" :disabled="!scopeOn" :aria-label="t('Scope edge feather')" :title="t('Scope edge feather as a percentage of the keyhole radius')" />
@@ -211,11 +211,10 @@ const allocationOptions = computed(() => [
</div>
<!-- Sky: only where the renderer has a sky to set. -->
<div v-if="sky" class="pp-toggle-group" id="sky-group">
<label v-for="row in skyRows" :key="row.key" class="pp-toggle-btn pp-scope-toggle" :id="`sky-${row.key}-row`">
<UiCheckbox v-for="row in skyRows" :key="row.key" class="pp-toggle-btn pp-scope-toggle" :id="`sky-${row.key}-row`" :input-id="`sky-${row.key}-toggle`" trailing :model-value="sky.switches[row.key]" @update:model-value="act('setSkySwitch', row.key, $event)">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
<span class="pp-label">{{ row.label }}</span>
<input type="checkbox" :id="`sky-${row.key}-toggle`" @change="act('setSkySwitch', row.key, $event.target.checked)" :checked="sky.switches[row.key]" />
</label>
</UiCheckbox>
<div class="pp-slider-row visible" id="sky-milkyway-row">
<span class="pp-slider-mini-label">{{ t('Milky Way') }}</span>
<UiSlider class="pp-slider" id="sky-milkyway-slider" @update:model-value="act('setSkyMilkyWay', $event)" min="0" max="100" :model-value="sky.milkyWay" :aria-label="t('Milky Way')" />
@@ -225,11 +224,10 @@ const allocationOptions = computed(() => [
<!-- Groups the application adds (store `publishGroup`). -->
<div v-for="group in groups" :key="group.id" class="pp-toggle-group" :id="`${group.id}-group`">
<template v-for="row in group.rows" :key="row.id">
<label v-if="row.kind === 'toggle'" class="pp-toggle-btn pp-scope-toggle" :title="row.title">
<UiCheckbox v-if="row.kind === 'toggle'" class="pp-toggle-btn pp-scope-toggle" :title="row.title" :input-id="`${group.id}-${row.id}-toggle`" trailing :model-value="row.checked" @update:model-value="row.onChange?.($event)">
<span v-if="row.icon" class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
<span class="pp-label">{{ row.label }}</span>
<input type="checkbox" :id="`${group.id}-${row.id}-toggle`" @change="row.onChange?.($event.target.checked)" :checked="row.checked" />
</label>
</UiCheckbox>
<div v-else-if="row.kind === 'note'" class="pp-slider-row visible" :id="`${group.id}-${row.id}`">
<span class="pp-slider-mini-label">{{ row.text }}</span>
</div>