You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte-kit-vice/web/routes/uix/components/time-range-picker/+page.svelte

744 lines
28 KiB

<script lang="ts">
import {
TimeRangePicker,
type TimeRangePickerColor,
type TimeRangePickerSize,
type TimeRangePickerVariant,
type InputSnippetProps
} from '$uix/eidos/components/time-range-picker';
import { compileMorfo } from '$uix/morfo';
import { timeRangePickerMorfo } from '@/uix/morfo/components/time-range-picker';
import { timeRangeFieldMorfo } from '@/uix/morfo/components/time-range-field';
import { popoverMorfo } from '@/uix/morfo/components/popover';
import { getActiveUix } from '$active-uix';
import {
Time,
type TimeValue,
type TimeRange,
type TimeGranularity,
type HourCycle,
type EditableTimeSegmentPart
} from '$libs/days';
const uix = getActiveUix();
type Tab = 'live' | 'api' | 'morfo' | 'sema' | 'recipe' | 'a11y';
type TraceEntry = { event: string; family: string; intent?: string; at: number };
const businessRange: TimeRange = {
start: new Time(9, 0, 0),
end: new Time(17, 0, 0)
};
const lunchRange: TimeRange = {
start: new Time(13, 0, 0),
end: new Time(14, 30, 0)
};
let tab = $state<Tab>('live');
let trace = $state<TraceEntry[]>([]);
let stageRef = $state<HTMLElement | null>(null);
let value = $state<TimeRange | undefined>(businessRange);
let placeholder = $state<TimeValue>(new Time(9, 0, 0));
let open = $state(false);
let mode = $state<'inline' | 'modal'>('inline');
let required = $state(false);
let disabled = $state(false);
let readonly = $state(false);
let lockSeconds = $state(false);
let ruler = $state(true);
let granularity = $state<TimeGranularity>('minute');
let hourCycle = $state<HourCycle>(24);
let bounds = $state(false);
let closeOnRangeComplete = $state(false);
let locale = $state('en-US');
let size = $state<TimeRangePickerSize>('md');
let variant = $state<TimeRangePickerVariant>('surface');
let color = $state<TimeRangePickerColor>('primary');
// Footer composition toggles
let showFooter = $state(true);
let showClear = $state(true);
let showCancel = $state(true);
let showClose = $state(true);
const compiled = compileMorfo(timeRangePickerMorfo);
const fieldCompiled = compileMorfo(timeRangeFieldMorfo);
const popoverCompiled = compileMorfo(popoverMorfo);
const partsList = $derived([...compiled.parts.byKebab.values()]);
const events = $derived([...compiled.actions.byName.values()]);
const fieldEvents = $derived([...fieldCompiled.actions.byName.values()]);
const popoverEvents = $derived([...popoverCompiled.actions.byName.values()]);
const eventRows = $derived([
...events.map((action) => ({ owner: 'TimeRangePicker', action })),
...fieldEvents.map((action) => ({ owner: 'TimeRangeField', action })),
...popoverEvents.map((action) => ({ owner: 'Popover', action }))
]);
const readonlySegments = $derived<EditableTimeSegmentPart[]>(lockSeconds ? ['second'] : []);
const valueLabel = $derived(
value?.start && value?.end
? `${value.start.toString()} → ${value.end.toString()}`
: 'empty'
);
const minValue: TimeValue = new Time(8, 0, 0);
const maxValue: TimeValue = new Time(20, 0, 0);
function sameRange(a: TimeRange | undefined, b: TimeRange): boolean {
return (
a?.start?.toString() === b.start?.toString() && a?.end?.toString() === b.end?.toString()
);
}
function setDemoValue(kind: 'business' | 'lunch' | 'empty'): void {
if (kind === 'empty') {
value = undefined;
return;
}
value = kind === 'business' ? businessRange : lunchRange;
}
function fmtTime(at: number): string {
return new Intl.DateTimeFormat(undefined, {
minute: '2-digit',
second: '2-digit',
fractionalSecondDigits: 2
}).format(at);
}
$effect(() => {
const el = stageRef;
if (!el) return;
const obs = new MutationObserver((mutations) => {
for (const m of mutations) {
if (m.attributeName !== 'data-event') continue;
const target = m.target as Element;
const ev = target.getAttribute('data-event');
if (!ev) continue;
trace = [
{
event: ev,
family: target.getAttribute('data-event-family') ?? '—',
intent: target.getAttribute('data-event-intent') ?? undefined,
at: Date.now()
},
...trace
].slice(0, 6);
}
});
obs.observe(el, { attributes: true, subtree: true, attributeFilter: ['data-event'] });
return () => obs.disconnect();
});
const somaSnippet = $derived(
[
"<script lang='ts'>",
" import * as TimeRangePicker from '$soma/components/time-range-picker';",
" import { Time, type TimeRange } from '$libs/days';",
'',
' let value = $state<TimeRange | undefined>({',
' start: new Time(9, 0, 0),',
' end: new Time(17, 0, 0)',
' });',
' let open = $state(false);',
'</' + 'script>',
'',
'<TimeRangePicker.Provider',
' bind:value bind:open',
mode !== 'inline' && ` mode="${mode}"`,
granularity !== 'minute' && ` granularity="${granularity}"`,
hourCycle !== 24 && ` hourCycle={${hourCycle}}`,
closeOnRangeComplete && ' closeOnRangeComplete',
required && ' required',
disabled && ' disabled',
readonly && ' readonly',
'>',
' <TimeRangePicker.Input type="start">…</TimeRangePicker.Input>',
' <TimeRangePicker.Input type="end">…<TimeRangePicker.Trigger /></TimeRangePicker.Input>',
' <TimeRangePicker.Clock>',
' <TimeRangePicker.HourSlider type="start" />',
' <TimeRangePicker.MinuteSlider type="start" />',
' <TimeRangePicker.HourSlider type="end" />',
' <TimeRangePicker.MinuteSlider type="end" />',
' </TimeRangePicker.Clock>',
'</TimeRangePicker.Provider>'
]
.filter(Boolean)
.join('\n')
);
const eidosSnippet = $derived(
[
"<script lang='ts'>",
" import { TimeRangePicker } from '$uix/eidos/components/time-range-picker';",
" import { Time, type TimeRange } from '$libs/days';",
'',
' let value = $state<TimeRange | undefined>({',
' start: new Time(9, 0, 0),',
' end: new Time(17, 0, 0)',
' });',
' let open = $state(false);',
'</' + 'script>',
'',
'<TimeRangePicker',
' bind:value bind:open',
size !== 'md' && ` size="${size}"`,
variant !== 'surface' && ` variant="${variant}"`,
color !== 'primary' && ` color="${color}"`,
mode !== 'inline' && ` mode="${mode}"`,
granularity !== 'minute' && ` granularity="${granularity}"`,
hourCycle !== 24 && ` hourCycle={${hourCycle}}`,
closeOnRangeComplete && ' closeOnRangeComplete',
required && ' required',
disabled && ' disabled',
readonly && ' readonly',
lockSeconds && " startReadonlySegments={['second']} endReadonlySegments={['second']}",
bounds && ' minValue={new Time(8, 0, 0)} maxValue={new Time(20, 0, 0)}',
'>',
' <TimeRangePicker.Input type="start">',
' {#snippet children({ segments })}',
' {#each segments as { part, value }, i (`${part}-${i}`)}',
' <TimeRangePicker.Segment {part}>{value}</TimeRangePicker.Segment>',
' {/each}',
' {/snippet}',
' </TimeRangePicker.Input>',
' <TimeRangePicker.Input type="end">',
' {#snippet children({ segments })}',
' {#each segments as { part, value }, i (`${part}-${i}`)}',
' <TimeRangePicker.Segment {part}>{value}</TimeRangePicker.Segment>',
' {/each}',
' <TimeRangePicker.Trigger />',
' {/snippet}',
' </TimeRangePicker.Input>',
' <TimeRangePicker.Portal>',
' <TimeRangePicker.Content>',
' <TimeRangePicker.Clock>',
' <div class="time-range-picker-endpoint">',
' <span class="time-range-picker-endpoint-label">Start</span>',
' <TimeRangePicker.HourSlider type="start" />',
' <TimeRangePicker.MinuteSlider type="start" />',
granularity === 'second' && ' <TimeRangePicker.SecondSlider type="start" />',
hourCycle === 12 && ' <TimeRangePicker.DayPeriodToggle type="start" />',
' </div>',
' <div class="time-range-picker-endpoint">',
' <span class="time-range-picker-endpoint-label">End</span>',
' <TimeRangePicker.HourSlider type="end" />',
' <TimeRangePicker.MinuteSlider type="end" />',
granularity === 'second' && ' <TimeRangePicker.SecondSlider type="end" />',
hourCycle === 12 && ' <TimeRangePicker.DayPeriodToggle type="end" />',
' </div>',
showFooter &&
(showClear || showCancel || showClose) &&
' <TimeRangePicker.Footer>',
showFooter && showClear && ' <TimeRangePicker.Clear />',
showFooter && showCancel && ' <TimeRangePicker.Cancel />',
showFooter && showClose && ' <TimeRangePicker.Close />',
showFooter &&
(showClear || showCancel || showClose) &&
' </TimeRangePicker.Footer>',
' </TimeRangePicker.Clock>',
' </TimeRangePicker.Content>',
' </TimeRangePicker.Portal>',
'</TimeRangePicker>'
]
.filter(Boolean)
.join('\n')
);
</script>
<div data-uix-canvas-inner>
<header>
<div data-uix-eyebrow>Forms · TimeRangePicker</div>
<h1 data-uix-page-title>TimeRangePicker</h1>
<p data-uix-page-lede>
A pair of segmented time inputs (start + end) plus a popover Clock with per-endpoint
sliders + AM/PM toggles. Soma owns the range state machine (empty → pending → complete)
and the open state; Eidos adds size, variant, intent color, the popover shell and the
canonical Footer parts.
</p>
<div data-uix-page-meta>
<span data-uix-meta-pill
><span data-uix-meta-key>parts</span>{compiled.parts.order.length}</span
>
<span data-uix-meta-pill><span data-uix-meta-key>events</span>{eventRows.length}</span>
<span data-uix-meta-pill><span data-uix-meta-key>variants</span>3</span>
<span data-uix-meta-pill><span data-uix-meta-key>sizes</span>3</span>
</div>
</header>
<div data-uix-stage>
<div data-uix-stage-area bind:this={stageRef}>
<div style="inline-size: min(32rem, 100%);">
<TimeRangePicker
bind:value
bind:placeholder
bind:open
{mode}
{required}
{disabled}
{readonly}
startReadonlySegments={readonlySegments}
endReadonlySegments={readonlySegments}
{granularity}
{hourCycle}
{locale}
{ruler}
{closeOnRangeComplete}
{size}
{variant}
{color}
minValue={bounds ? minValue : undefined}
maxValue={bounds ? maxValue : undefined}
>
<TimeRangePicker.Label>Working hours</TimeRangePicker.Label>
<TimeRangePicker.Input type="start" aria-label="Start time">
{#snippet children({ segments }: InputSnippetProps)}
{#each segments as { part, value }, i (`${part}-${i}`)}
<TimeRangePicker.Segment {part}>{value}</TimeRangePicker.Segment>
{/each}
{/snippet}
</TimeRangePicker.Input>
<TimeRangePicker.Input type="end" aria-label="End time">
{#snippet children({ segments }: InputSnippetProps)}
{#each segments as { part, value }, i (`${part}-${i}`)}
<TimeRangePicker.Segment {part}>{value}</TimeRangePicker.Segment>
{/each}
<TimeRangePicker.Trigger />
{/snippet}
</TimeRangePicker.Input>
<TimeRangePicker.Portal>
<TimeRangePicker.Content>
<TimeRangePicker.Clock>
<div class="time-range-picker-endpoint">
<span class="time-range-picker-endpoint-label">Start</span>
<TimeRangePicker.HourSlider type="start" />
<TimeRangePicker.MinuteSlider type="start" />
{#if granularity === 'second'}
<TimeRangePicker.SecondSlider type="start" />
{/if}
{#if hourCycle === 12}
<TimeRangePicker.DayPeriodToggle type="start" />
{/if}
</div>
<div class="time-range-picker-endpoint">
<span class="time-range-picker-endpoint-label">End</span>
<TimeRangePicker.HourSlider type="end" />
<TimeRangePicker.MinuteSlider type="end" />
{#if granularity === 'second'}
<TimeRangePicker.SecondSlider type="end" />
{/if}
{#if hourCycle === 12}
<TimeRangePicker.DayPeriodToggle type="end" />
{/if}
</div>
{#if showFooter && (showClear || showCancel || showClose)}
<TimeRangePicker.Footer>
{#if showClear}<TimeRangePicker.Clear />{/if}
{#if showCancel}<TimeRangePicker.Cancel />{/if}
{#if showClose}<TimeRangePicker.Close />{/if}
</TimeRangePicker.Footer>
{/if}
</TimeRangePicker.Clock>
</TimeRangePicker.Content>
</TimeRangePicker.Portal>
</TimeRangePicker>
</div>
</div>
<div data-uix-stage-trace>
<span data-uix-stage-trace-key>trace</span>
{#if trace.length === 0}
<span>edit, open the clock or play an event to see sema stamps</span>
{:else}
{#each trace.slice(0, 3) as entry}
<span
><span data-uix-stage-trace-event>{entry.event}</span> · {entry.family}{entry.intent
? ' · ' + entry.intent
: ''}</span
>
<span style="color: var(--uix-text-faint)">{fmtTime(entry.at)}</span>
{/each}
{/if}
<span style="margin-inline-start: auto;">
<span data-uix-stage-trace-key>value</span>
{valueLabel}
</span>
</div>
</div>
<div data-uix-tabs role="tablist">
<button data-uix-tab data-active={tab === 'live'} onclick={() => (tab = 'live')}>Live</button>
<button data-uix-tab data-active={tab === 'api'} onclick={() => (tab = 'api')}>API</button>
<button data-uix-tab data-active={tab === 'morfo'} onclick={() => (tab = 'morfo')}>
<span data-uix-layer-badge="morfo">morfo</span>
<span data-uix-tab-count>{partsList.length}p · {events.length}e</span>
</button>
<button data-uix-tab data-active={tab === 'sema'} onclick={() => (tab = 'sema')}>
<span data-uix-layer-badge="sema">sema</span>
<span data-uix-tab-count>{eventRows.length}</span>
</button>
<button data-uix-tab data-active={tab === 'recipe'} onclick={() => (tab = 'recipe')}
>Recipe</button
>
<button data-uix-tab data-active={tab === 'a11y'} onclick={() => (tab = 'a11y')}>A11y</button>
</div>
{#if tab === 'live'}
<section data-uix-section>
<h2 data-uix-section-title>Controls</h2>
<p data-uix-section-desc>
<span data-uix-layer-badge="soma">soma</span> owns the range state machine, segment
editing, validation and the open state.
<span data-uix-layer-badge="eidos">eidos</span> owns visual treatment.
</p>
<div data-uix-subsection-head>
<span data-uix-layer-badge="soma">soma</span> props · value + behaviour
</div>
<div data-uix-controls>
<label data-uix-control>
<span data-uix-control-label>value</span>
<span data-uix-chips role="group">
<button
data-uix-chip
data-active={value && sameRange(value, businessRange)}
onclick={() => setDemoValue('business')}>business</button
>
<button
data-uix-chip
data-active={value && sameRange(value, lunchRange)}
onclick={() => setDemoValue('lunch')}>lunch</button
>
<button
data-uix-chip
data-active={value === undefined}
onclick={() => setDemoValue('empty')}>empty</button
>
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>mode</span>
<span data-uix-chips role="radiogroup">
{#each ['inline', 'modal'] as v}
<button
data-uix-chip
data-active={mode === v}
onclick={() => (mode = v as 'inline' | 'modal')}>{v}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>granularity</span>
<span data-uix-chips role="radiogroup">
{#each ['hour', 'minute', 'second'] as v}
<button
data-uix-chip
data-active={granularity === v}
onclick={() => (granularity = v as TimeGranularity)}>{v}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>hour cycle</span>
<span data-uix-chips role="radiogroup">
{#each [12, 24] as v}
<button
data-uix-chip
data-active={hourCycle === v}
onclick={() => (hourCycle = v as HourCycle)}>{v}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>locale</span>
<select bind:value={locale}>
<option value="en-US">en-US</option>
<option value="es-ES">es-ES</option>
<option value="fr-FR">fr-FR</option>
</select>
</label>
<label data-uix-control>
<span data-uix-control-label>states</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={required} />
<span data-uix-switch-label>required</span>
</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={disabled} />
<span data-uix-switch-label>disabled</span>
</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={readonly} />
<span data-uix-switch-label>readonly</span>
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>constraints</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={bounds} />
<span data-uix-switch-label>min 08:00 · max 20:00</span>
</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={lockSeconds} />
<span data-uix-switch-label>seconds readonly</span>
</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={closeOnRangeComplete} />
<span data-uix-switch-label>close on range complete</span>
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>clock</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={ruler} />
<span data-uix-switch-label>show ruler scale</span>
</span>
</label>
</div>
<div data-uix-subsection-head>Footer composition</div>
<p data-uix-section-desc>
Each switch decides whether the part is <em>included</em> in the markup. The parts
never read these flags — omitting the part hides it, including it always renders.
</p>
<div data-uix-controls>
<label data-uix-control>
<span data-uix-control-label>visibility</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={showFooter} />
<span data-uix-switch-label>render footer</span>
</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={showClear} disabled={!showFooter} />
<span data-uix-switch-label>clear</span>
</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={showCancel} disabled={!showFooter} />
<span data-uix-switch-label>cancel</span>
</span>
<span data-uix-switch>
<input type="checkbox" bind:checked={showClose} disabled={!showFooter} />
<span data-uix-switch-label>close</span>
</span>
</label>
</div>
<div data-uix-subsection-head>
<span data-uix-layer-badge="eidos">eidos</span> props · visual treatment
</div>
<div data-uix-controls>
<label data-uix-control>
<span data-uix-control-label>size</span>
<span data-uix-chips role="radiogroup">
{#each ['sm', 'md', 'lg'] as v}
<button
data-uix-chip
data-active={size === v}
onclick={() => (size = v as TimeRangePickerSize)}>{v}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>variant</span>
<span data-uix-chips role="radiogroup">
{#each ['surface', 'outline', 'ghost'] as v}
<button
data-uix-chip
data-active={variant === v}
onclick={() => (variant = v as TimeRangePickerVariant)}>{v}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>color</span>
<span data-uix-chips role="radiogroup">
{#each ['primary', 'secondary', 'neutral', 'affirm', 'fulfill', 'risk', 'threat', 'loss'] as v}
<button
data-uix-chip
data-active={color === v}
onclick={() => (color = v as TimeRangePickerColor)}>{v}</button
>
{/each}
</span>
</label>
</div>
<div data-uix-code>
<div data-uix-code-head>
<span data-uix-layer-badge="soma">soma</span>
<span>headless · provider + sliders</span>
<span data-uix-code-lang>svelte</span>
</div>
<pre><code>{somaSnippet}</code></pre>
</div>
<div data-uix-code style="margin-top: var(--uix-space-3);">
<div data-uix-code-head>
<span data-uix-layer-badge="eidos">eidos</span>
<span>visual · root + attached parts</span>
<span data-uix-code-lang>svelte</span>
</div>
<pre><code>{eidosSnippet}</code></pre>
</div>
</section>
{/if}
{#if tab === 'api'}
<section data-uix-section>
<h2 data-uix-section-title>API + reference comparison</h2>
<div data-uix-table-wrap>
<table data-uix-table>
<thead>
<tr><th>Feature</th><th>React Aria</th><th>Ark</th><th>Chakra</th><th>UIX</th><th>Decision</th></tr>
</thead>
<tbody>
<tr><td class="name">Paired segmented inputs</td><td>yes (Date)</td><td>no</td><td>no</td><td>yes</td><td>Soma owns start/end editors.</td></tr>
<tr><td class="name">Per-endpoint sliders</td><td>no</td><td>no</td><td>no</td><td>yes</td><td>Two slider columns; share generic Slider.</td></tr>
<tr><td class="name">Range state machine</td><td>yes (Date)</td><td>n/a</td><td>n/a</td><td>yes</td><td>Empty → pending → complete coordinated in soma.</td></tr>
<tr><td class="name">mode='inline' | 'modal'</td><td>no</td><td>no</td><td>no</td><td>yes</td><td>Same contract as date / time / color pickers.</td></tr>
<tr><td class="name">Footer = composition</td><td>no</td><td>no</td><td>no</td><td>yes</td><td>No *Button root props — pure composition.</td></tr>
<tr><td class="name">commit/cancel/clear helpers</td><td>manual</td><td>manual</td><td>manual</td><td>yes</td><td>Wired by Footer parts via picker-shell context.</td></tr>
<tr><td class="name">closeOnRangeComplete</td><td>no</td><td>no</td><td>no</td><td>yes</td><td>Auto-dismiss when both endpoints set.</td></tr>
</tbody>
</table>
</div>
<div data-uix-table-wrap>
<table data-uix-table>
<thead><tr><th>Prop</th><th>Owner</th><th>Default</th><th>Notes</th></tr></thead>
<tbody>
<tr><td class="name">value / placeholder</td><td>soma</td><td class="default">—</td><td>Bindable <code>TimeRange</code>.</td></tr>
<tr><td class="name">open</td><td>soma</td><td class="default">false</td><td>Bindable popover state.</td></tr>
<tr><td class="name">mode</td><td>soma</td><td class="default">inline</td><td><code>inline</code> closes on outside-click; <code>modal</code> requires footer action.</td></tr>
<tr><td class="name">closeOnRangeComplete</td><td>soma</td><td class="default">false</td><td>Auto-close once both endpoints are set.</td></tr>
<tr><td class="name">minValue / maxValue</td><td>soma</td><td class="default">—</td><td>Validation bounds applied to both endpoints.</td></tr>
<tr><td class="name">granularity</td><td>soma</td><td class="default">minute</td><td>Hour / minute / second.</td></tr>
<tr><td class="name">hourCycle</td><td>soma</td><td class="default">locale</td><td>12h adds dayPeriod toggle per endpoint.</td></tr>
<tr><td class="name">start / endReadonlySegments</td><td>soma</td><td class="default">[]</td><td>Lock segments per endpoint.</td></tr>
<tr><td class="name">size / variant / color</td><td>eidos</td><td class="default">md / surface / primary</td><td>Visual-only data attrs.</td></tr>
</tbody>
</table>
</div>
</section>
{/if}
{#if tab === 'morfo'}
<section data-uix-section>
<h2 data-uix-section-title>Morfo contract</h2>
<div data-uix-table-wrap>
<table data-uix-table>
<thead><tr><th>Part</th><th>Marker</th><th>Element</th><th>Role</th><th>Optional</th></tr></thead>
<tbody>
{#each partsList as part}
<tr>
<td class="name">{part.kebab}</td>
<td><code data-uix-part-marker>[{part.marker}]</code></td>
<td class="type">&lt;{part.defaultElement}&gt;</td>
<td class="type">{part.role ?? '—'}</td>
<td class="default">{part.optional ? 'yes' : 'no'}</td>
</tr>
{/each}
</tbody>
</table>
</div>
</section>
{/if}
{#if tab === 'sema'}
<section data-uix-section>
<h2 data-uix-section-title>
<span data-uix-layer-badge="sema">sema</span> · events + perceptual signature
</h2>
<p data-uix-section-desc>
TimeRangePicker declares open / dismiss / commit / clear events on its own surface.
The underlying TimeRangeField and Popover contribute their own events too.
</p>
<div data-uix-table-wrap>
<table data-uix-table>
<thead><tr><th>Owner</th><th>Name</th><th>Family</th><th>Verb</th><th>Sequence</th><th>Target</th><th>Play</th></tr></thead>
<tbody>
{#each eventRows as row}
<tr>
<td class="default">{row.owner}</td>
<td class="name">{row.action.name}</td>
<td class="type">{row.action.semantic.family}</td>
<td>{row.action.semantic.verb ?? '—'}</td>
<td>{row.action.semantic.sequence ?? 'pre'}</td>
<td>{row.action.target}</td>
<td>
<button
data-uix-play
onclick={() => {
const selector =
row.owner === 'TimeRangePicker'
? '[data-time-range-picker]'
: row.owner === 'TimeRangeField'
? '[data-time-range-field]'
: '[data-popover-content]';
const target = stageRef?.querySelector(
selector
) as HTMLElement | null;
if (!target) return;
void uix.events?.emit({
name: row.action.name,
family: row.action.semantic.family,
target
});
}}>▶ play</button
>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
</section>
{/if}
{#if tab === 'recipe'}
<section data-uix-section>
<h2 data-uix-section-title>Eidos recipe</h2>
<p data-uix-section-desc>
Selectors live in
<code>src/uix/eidos/components/time-range-picker/time-range-picker.css</code> and reuse
the time-field tokens for the field portion. The clock body lays out two endpoint
columns (start / end) and inherits slider chrome from the slider recipe.
</p>
<div data-uix-table-wrap>
<table data-uix-table>
<thead><tr><th>Selector</th><th>Owner</th><th>Purpose</th></tr></thead>
<tbody>
<tr><td class="name"><code>[data-time-range-picker]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Root visual scope + size/variant/color tokens.</td></tr>
<tr><td class="name"><code>[data-time-range-picker-trigger]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Open-clock button. Has embedded variant inside the input.</td></tr>
<tr><td class="name"><code>[data-time-range-picker-clock][data-state]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Popover dialog surface. 2-column endpoint grid.</td></tr>
<tr><td class="name"><code>[data-time-range-picker-hour-slider][data-endpoint]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Per-endpoint slider wrapper. Composes generic Slider chrome.</td></tr>
<tr><td class="name"><code>[data-picker-footer][data-mode]</code></td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Footer action row shared via picker-shell.</td></tr>
</tbody>
</table>
</div>
</section>
{/if}
{#if tab === 'a11y'}
<section data-uix-section>
<h2 data-uix-section-title>Accessibility</h2>
<div data-uix-table-wrap>
<table data-uix-table>
<thead><tr><th>Concern</th><th>Contract</th></tr></thead>
<tbody>
<tr><td class="name">Dialog</td><td>Clock exposes <code>role="dialog"</code> with an accessible name.</td></tr>
<tr><td class="name">Trigger</td><td><code>aria-haspopup="dialog"</code> + <code>aria-expanded</code> + <code>aria-controls</code>.</td></tr>
<tr><td class="name">Segments</td><td>Editable segments expose <code>role="spinbutton"</code> with min/max/value per endpoint.</td></tr>
<tr><td class="name">Sliders</td><td>Native slider semantics — keyboard arrow/page/home/end per endpoint.</td></tr>
<tr><td class="name">Modal</td><td><code>mode='modal'</code> blocks outside-click + Escape; consumer must wire Close/Cancel.</td></tr>
<tr><td class="name">Form</td><td>Hidden inputs submit ISO strings for both endpoints when <code>name</code> is set.</td></tr>
</tbody>
</table>
</div>
</section>
{/if}
</div>

Powered by TurnKey Linux.