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.
60 lines
1.6 KiB
Svelte
60 lines
1.6 KiB
Svelte
<script lang="ts">
|
|
import type { Snippet } from 'svelte';
|
|
import { icons } from '../lib/icons';
|
|
|
|
interface Props {
|
|
checked?: boolean;
|
|
/** Part of a group is chosen: shows a bar and reads as "mixed". */
|
|
indeterminate?: boolean;
|
|
label?: string;
|
|
hint?: string;
|
|
name?: string;
|
|
value?: string;
|
|
disabled?: boolean;
|
|
required?: boolean;
|
|
onchange?: (checked: boolean) => void;
|
|
force?: string;
|
|
class?: string;
|
|
children?: Snippet;
|
|
}
|
|
let {
|
|
checked = $bindable(false),
|
|
indeterminate = $bindable(false),
|
|
label,
|
|
hint,
|
|
name,
|
|
value,
|
|
disabled = false,
|
|
required = false,
|
|
onchange,
|
|
force,
|
|
class: cls = '',
|
|
children,
|
|
}: Props = $props();
|
|
const uid = $props.id();
|
|
</script>
|
|
|
|
<label class={['domi-choice', cls]} data-force={force}>
|
|
<span class="domi-choice__control">
|
|
<input
|
|
class="domi-choice__input"
|
|
type="checkbox"
|
|
bind:checked
|
|
bind:indeterminate
|
|
{name}
|
|
{value}
|
|
{disabled}
|
|
{required}
|
|
aria-describedby={hint ? `domi-hint-${uid}` : undefined}
|
|
onchange={() => onchange?.(checked)}
|
|
/>
|
|
<svg class="domi-choice__mark" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
<path d={indeterminate ? icons.minus : icons.check} />
|
|
</svg>
|
|
</span>
|
|
<span class="domi-choice__text">
|
|
<span>{#if children}{@render children()}{:else}{label}{/if}</span>
|
|
{#if hint}<span class="domi-choice__hint" id={`domi-hint-${uid}`}>{hint}</span>{/if}
|
|
</span>
|
|
</label>
|