- Migrate all DaisyUI 4 form markup (form-control, label-text, *-bordered — removed in v5) to v5 fieldset/legend; labels sat inline beside inputs and inputs fell back to a fixed 20rem width. - One Modal component (native <dialog>: Escape, focus trap) for page, event, item and slot editors; destructive actions confirmed everywhere. The page Delete confirm was ignored — returning false from onsubmit doesn't cancel — so Cancel still deleted the page. - Block editor follows the background-picker style throughout: SegmentedControl rows (title-cased options, clearer selected state) and a new ColorField row with reset; image position is Left/Right like the alignment controls. - Globals keep their layout; readable field labels, save feedback without reload, hints wrap. - Pages list: fixed broken Preview link (VITE_PUBLIC_SITE_URL was undefined → "undefined/slug"), shown for published pages only; action column no longer breaks row alignment; empty states on all tables. - Items: image picker instead of a raw media-id field, upload errors shown (were swallowed), prices in the shop currency instead of hard-coded EUR. - Slots/orders/calendar: times shown in the site timezone with a fixed locale (server and browser render the same text). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
46 lines
1.4 KiB
Svelte
46 lines
1.4 KiB
Svelte
<script lang="ts">
|
|
// One row of mutually exclusive options with an optional label column on
|
|
// the left — the standard "setting row" in the block editors (see
|
|
// ColorField for the colour variant; both share the label column width).
|
|
let {
|
|
label,
|
|
options,
|
|
value,
|
|
onChange,
|
|
formatLabel = (v: string | number) => {
|
|
const text = String(v);
|
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
},
|
|
strong = false,
|
|
class: className = ''
|
|
}: {
|
|
label?: string;
|
|
options: (string | number)[];
|
|
value: string | number;
|
|
onChange: (value: string | number) => void;
|
|
formatLabel?: (value: string | number) => string;
|
|
/** Bold label, for section-level settings like Background/Foreground. */
|
|
strong?: boolean;
|
|
class?: string;
|
|
} = $props();
|
|
</script>
|
|
|
|
<div class="flex items-center gap-3 {className}" role="group" aria-label={label}>
|
|
{#if label}
|
|
<span class="w-28 shrink-0 text-sm" class:font-bold={strong} class:font-medium={!strong}>{label}</span>
|
|
{/if}
|
|
<div class="join grid flex-1" style="grid-template-columns: repeat({options.length}, minmax(0, 1fr))">
|
|
{#each options as option}
|
|
<button
|
|
type="button"
|
|
class="btn btn-sm join-item px-1"
|
|
class:btn-active={value === option}
|
|
class:btn-primary={value === option}
|
|
aria-pressed={value === option}
|
|
onclick={() => onChange(option)}
|
|
>
|
|
{formatLabel(option)}
|
|
</button>
|
|
{/each}
|
|
</div>
|
|
</div>
|