c9aa55ec99
@domi/ui v1.0.4 vendored unchanged in packages/domi-ui by domi-design's tools/vendor.mjs and used as workspace:*, so the Nix build fetches nothing from Gitea (web.nix sources the folder; fetchPnpmDeps hash from the NixOS runner). Its fonts, roles (data-domi-room="ianitor", the same hex) and controls replace Ianitor's copies: Button through Ianitor's adapter (desktop sizes kept), every text field a TextField with its seal, Checkbox, Select, Segmented. Ianitor's 22 role names renamed to --domi-*. <DomiCredit /> on every screen and in About, with the CPAL section 15 note beside the source link; the README names the vendored package. Disabled buttons are natively disabled.
45 lines
1.4 KiB
Svelte
45 lines
1.4 KiB
Svelte
<script lang="ts">
|
|
import Icon from './Icon.svelte';
|
|
import type { DomiOption } from '../types';
|
|
|
|
interface Props {
|
|
/** Left unset, the first option is chosen. */
|
|
value?: string;
|
|
label: string;
|
|
hideLabel?: boolean;
|
|
options: DomiOption[];
|
|
hint?: string;
|
|
name?: string;
|
|
disabled?: boolean;
|
|
required?: boolean;
|
|
onchange?: (value: string) => void;
|
|
force?: string;
|
|
class?: string;
|
|
}
|
|
let { value = $bindable(), label, hideLabel = false, options, hint, name, disabled = false, required = false, onchange, force, class: cls = '' }: Props = $props();
|
|
const uid = $props.id();
|
|
</script>
|
|
|
|
<!-- A native select: on Android and iOS it opens the system picker, which is the right control for a thumb. -->
|
|
<div class={['domi-field', cls]}>
|
|
<label class={['domi-field__label', hideLabel && 'domi-sr']} for={`domi-select-${uid}`}>{label}</label>
|
|
<div class="domi-select" data-force={force}>
|
|
<select
|
|
class="domi-select__input"
|
|
id={`domi-select-${uid}`}
|
|
bind:value
|
|
{name}
|
|
{disabled}
|
|
{required}
|
|
aria-describedby={hint ? `domi-hint-${uid}` : undefined}
|
|
onchange={() => onchange?.(value ?? '')}
|
|
>
|
|
{#each options as o (o.value)}
|
|
<option value={o.value} disabled={o.disabled}>{o.label}</option>
|
|
{/each}
|
|
</select>
|
|
<Icon name="chevron-down" />
|
|
</div>
|
|
{#if hint}<p class="domi-field__hint" id={`domi-hint-${uid}`}>{hint}</p>{/if}
|
|
</div>
|