Closes #133. Eidos wrapper + types + recipe + canonical-depth demo. 4 parts: Provider, Row, Cell, SelectionCheckbox. Soma owns selection (none/single/multiple), 2D keyboard nav (Up/Down rows + Left/Right cells), Shift/Ctrl range/toggle, Ctrl+A select-all, Escape-clear, typeahead, hidden form input, Field merge. Eidos adds variant + size + color + defaultValue (uncontrolled init). Reference parity (no air baseline): | Feature | soma | react-aria GridList | this port | |---|---|---|---| | selectionMode none/single/multiple | ✓ | ✓ | ✓ | | bind:value (controlled) | ✓ | ✓ | ✓ | | defaultValue (uncontrolled init) | ✗ | ✓ | ✓ added (parity with Combobox/Select) | | Item with interactive descendants | ✓ | ✓ | ✓ | | 2D keyboard nav (Up/Down rows, L/R cells) | ✓ | ✓ | ✓ | | Shift/Ctrl range/toggle | ✓ | ✓ | ✓ | | Ctrl+A select-all (multiple) | ✓ | ✓ | ✓ | | Escape-clear | ✓ | ✓ | ✓ | | Typeahead | ✓ | ✓ | ✓ | | ARIA grid/row/gridcell | ✓ | ✓ | ✓ | | Field merge (disabled/invalid/required/readonly) | ✓ | ✗ | ✓ | | Form participation (hidden input) | ✓ | ✗ | ✓ | | Drag-to-reorder | ✗ | ✓ | ⚠ deferred (compose w/ future DragDrop) | | onAction (row click → navigate) | ✗ | ✓ | ⚠ deferred (use button/link inside Cell) | | selectionBehavior toggle/replace | ✗ implicit | ✓ | ⚠ deferred | | disabledBehavior 'selection'/'all' | ✗ skip-only | ✓ | ⚠ deferred | | Async / infinite loading | ✗ | ✓ | ⚠ deferred | | Empty state slot | ✗ | ✓ | ⚠ document `data-empty` styling | Naming: keeps soma's part names (Provider, Row, Cell, SelectionCheckbox). react-aria's "GridListItem" maps to `Row`; soma's vocabulary is more precise and consistent with future Table / TreeGrid in the same family. Variant set: - variant: ControlVariant (surface/outline/ghost), default 'surface' - size: xs..xl (5-step, mirrors Combobox/Listbox) - color: ColorRole (primary/secondary/neutral/affirm/fulfill/risk/threat/loss) - block: stretch to container width Disambiguation (in index.ts comment): use GridList for rows with interactive children; use Listbox for atomic text options (ARIA forbids interactive descendants inside role="listbox"); use Select/Combobox for closed-picker patterns; use Table for tabular data with columns + sort. Visual reuse: - SelectionCheckbox uses the same `mask-image: url(svg-check)` pattern as the shared menu-indicator partial (commitactive-uixa2709476). Filled accent box → white ✓ on `[data-state='checked']`. - Row hover/highlight tokens mirror Combobox.Item / Listbox.Item so the form-control surface family stays coherent. - Same `max-block-size: min(60vh, 22rem) + overflow-y: auto` scroll contract as Listbox (commit830025b4). Sidebar entry under Forms (between Listbox and Calendar). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
parent
52627e60bb
commit
065cc6a369
@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import * as GridList from '$soma/components/grid-list';
|
||||
import type { GridListCellProps } from './types';
|
||||
let { children, ...rest }: GridListCellProps = $props();
|
||||
</script>
|
||||
|
||||
<GridList.Cell {...rest}>{@render children?.()}</GridList.Cell>
|
||||
@ -0,0 +1,11 @@
|
||||
<script lang="ts">
|
||||
import * as GridList from '$soma/components/grid-list';
|
||||
import type { GridListRowProps } from './types';
|
||||
let { children: bodyContent, ...rest }: GridListRowProps = $props();
|
||||
</script>
|
||||
|
||||
<GridList.Row {...rest}>
|
||||
{#snippet children(snippetProps)}
|
||||
{@render bodyContent?.(snippetProps)}
|
||||
{/snippet}
|
||||
</GridList.Row>
|
||||
@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import * as GridList from '$soma/components/grid-list';
|
||||
import type { GridListSelectionCheckboxProps } from './types';
|
||||
let { children, ...rest }: GridListSelectionCheckboxProps = $props();
|
||||
</script>
|
||||
|
||||
<GridList.SelectionCheckbox {...rest}>{@render children?.()}</GridList.SelectionCheckbox>
|
||||
@ -0,0 +1,235 @@
|
||||
/*
|
||||
* GridList recipe — role="grid" list with interactive row children.
|
||||
*
|
||||
* [data-grid-list] → root container
|
||||
* [data-grid-list-row] → row, focusable, [data-selected]
|
||||
* [data-grid-list-cell] → cell slot
|
||||
* [data-grid-list-selection-checkbox] → per-row selection box
|
||||
*
|
||||
* Sizes — xs..xl drive row height + font-size.
|
||||
* Variant `'surface' | 'outline' | 'ghost'` (ControlVariant).
|
||||
* Color cascades the accent for selected rows + focus ring.
|
||||
*
|
||||
* Cross-component reuse: SelectionCheckbox uses the menu-indicator
|
||||
* recipe family (see `lib/menu-indicator.css`) — the indicator inside
|
||||
* the soma part will pick up that visual when the row is selected.
|
||||
* Row hover/highlight tokens mirror Combobox.Item + Listbox.Item.
|
||||
*
|
||||
* Disambiguation: use GridList for rows with interactive children
|
||||
* (buttons / links / checkbox). Use Listbox for atomic text options
|
||||
* (ARIA forbids interactive descendants inside role="listbox").
|
||||
*/
|
||||
|
||||
[data-grid-list] {
|
||||
--_grid-list-row-height: var(--control-height-md);
|
||||
--_grid-list-row-px: var(--space-3);
|
||||
--_grid-list-font-size: var(--font-size-sm);
|
||||
--_grid-list-max-height: min(60vh, 22rem);
|
||||
--_grid-list-accent: var(--color-primary-solid);
|
||||
--_grid-list-accent-soft: var(--color-primary-element);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
padding: var(--space-1);
|
||||
border: 1px solid var(--color-border-default);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--color-surface-default);
|
||||
color: var(--color-content-primary);
|
||||
font-family: var(--font-ui);
|
||||
font-size: var(--_grid-list-font-size);
|
||||
line-height: var(--leading-ui);
|
||||
outline: none;
|
||||
max-block-size: var(--_grid-list-max-height);
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
[data-grid-list][data-block] {
|
||||
inline-size: 100%;
|
||||
}
|
||||
|
||||
/* ── Variant ─ */
|
||||
[data-grid-list][data-variant='outline'] {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
[data-grid-list][data-variant='ghost'] {
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
/* ── Sizes ─ */
|
||||
[data-grid-list][data-size='xs'] {
|
||||
--_grid-list-row-height: var(--control-height-xs);
|
||||
--_grid-list-row-px: var(--space-2);
|
||||
--_grid-list-font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
[data-grid-list][data-size='sm'] {
|
||||
--_grid-list-row-height: var(--control-height-sm);
|
||||
--_grid-list-row-px: var(--space-2);
|
||||
--_grid-list-font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
[data-grid-list][data-size='lg'] {
|
||||
--_grid-list-row-height: var(--control-height-lg);
|
||||
--_grid-list-row-px: var(--space-4);
|
||||
--_grid-list-font-size: var(--font-size-md);
|
||||
}
|
||||
|
||||
[data-grid-list][data-size='xl'] {
|
||||
--_grid-list-row-height: var(--control-height-xl);
|
||||
--_grid-list-row-px: var(--space-5);
|
||||
--_grid-list-font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
/* ── Color cascades ─ */
|
||||
[data-grid-list][data-color='secondary'] {
|
||||
--_grid-list-accent: var(--color-secondary-solid);
|
||||
--_grid-list-accent-soft: var(--color-secondary-element);
|
||||
}
|
||||
[data-grid-list][data-color='affirm'] {
|
||||
--_grid-list-accent: var(--color-affirm-solid);
|
||||
--_grid-list-accent-soft: var(--color-affirm-element);
|
||||
}
|
||||
[data-grid-list][data-color='risk'] {
|
||||
--_grid-list-accent: var(--color-risk-solid);
|
||||
--_grid-list-accent-soft: var(--color-risk-element);
|
||||
}
|
||||
[data-grid-list][data-color='threat'] {
|
||||
--_grid-list-accent: var(--color-threat-solid);
|
||||
--_grid-list-accent-soft: var(--color-threat-element);
|
||||
}
|
||||
[data-grid-list][data-color='fulfill'] {
|
||||
--_grid-list-accent: var(--color-fulfill-solid);
|
||||
--_grid-list-accent-soft: var(--color-fulfill-element);
|
||||
}
|
||||
[data-grid-list][data-color='loss'] {
|
||||
--_grid-list-accent: var(--color-loss-solid);
|
||||
--_grid-list-accent-soft: var(--color-loss-element);
|
||||
}
|
||||
[data-grid-list][data-color='neutral'] {
|
||||
--_grid-list-accent: var(--color-neutral-solid);
|
||||
--_grid-list-accent-soft: var(--color-neutral-element);
|
||||
}
|
||||
|
||||
[data-grid-list][data-disabled] {
|
||||
opacity: 0.55;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
[data-grid-list][data-invalid] {
|
||||
border-color: var(--color-threat-element);
|
||||
}
|
||||
|
||||
[data-grid-list]:focus-visible,
|
||||
[data-grid-list][data-focused] {
|
||||
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
||||
outline-offset: var(--focus-ring-offset);
|
||||
}
|
||||
|
||||
/* ── Row ─ */
|
||||
[data-grid-list-row] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
min-block-size: var(--_grid-list-row-height);
|
||||
padding-block: var(--space-1);
|
||||
padding-inline: var(--_grid-list-row-px);
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--color-content-primary);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition:
|
||||
background var(--duration-fast) var(--ease-default),
|
||||
color var(--duration-fast) var(--ease-default);
|
||||
}
|
||||
|
||||
[data-grid-list-row]:hover:not([data-disabled]),
|
||||
[data-grid-list-row][data-highlighted]:not([data-disabled]) {
|
||||
background: var(--color-surface-overlay);
|
||||
}
|
||||
|
||||
[data-grid-list-row][data-selected]:not([data-disabled]) {
|
||||
background: var(--_grid-list-accent-soft);
|
||||
}
|
||||
|
||||
[data-grid-list-row][data-disabled] {
|
||||
color: var(--color-content-muted);
|
||||
cursor: default;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
[data-grid-list-row]:focus-visible {
|
||||
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
/* ── Cell ─ */
|
||||
[data-grid-list-cell] {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
[data-grid-list-cell]:first-of-type {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
[data-grid-list-cell]:nth-of-type(2) {
|
||||
flex: 1 1 auto;
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
[data-grid-list-cell]:last-of-type:not(:first-of-type):not(:nth-of-type(2)) {
|
||||
flex: 0 0 auto;
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
/* ── SelectionCheckbox ─
|
||||
*
|
||||
* Soma renders a `[data-grid-list-selection-checkbox]` element with
|
||||
* `data-state="checked"` / "unchecked". Reuse the menu-indicator visual
|
||||
* pattern: empty outlined square → filled accent + white ✓.
|
||||
*/
|
||||
[data-grid-list-selection-checkbox] {
|
||||
--_grid-list-checkbox-size: 0.875rem;
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
inline-size: var(--_grid-list-checkbox-size);
|
||||
block-size: var(--_grid-list-checkbox-size);
|
||||
border: 1px solid var(--color-border-default);
|
||||
border-radius: 0.2rem;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition:
|
||||
background var(--duration-fast) var(--ease-default),
|
||||
border-color var(--duration-fast) var(--ease-default);
|
||||
}
|
||||
|
||||
[data-grid-list-selection-checkbox][data-state='checked'] {
|
||||
border-color: var(--_grid-list-accent);
|
||||
background: var(--_grid-list-accent);
|
||||
}
|
||||
|
||||
[data-grid-list-selection-checkbox][data-state='checked']::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-color: var(--color-content-on-solid, #fff);
|
||||
mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.5L10 17.5L19 7'/></svg>");
|
||||
-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.5L10 17.5L19 7'/></svg>");
|
||||
mask-repeat: no-repeat;
|
||||
mask-position: center;
|
||||
mask-size: contain;
|
||||
-webkit-mask-repeat: no-repeat;
|
||||
-webkit-mask-position: center;
|
||||
-webkit-mask-size: contain;
|
||||
}
|
||||
|
||||
[data-grid-list-selection-checkbox]:focus-visible {
|
||||
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
<script lang="ts">
|
||||
/**
|
||||
* Eidos `<GridList>` — selectable list with `role="grid"` semantics.
|
||||
*
|
||||
* <GridList bind:value selectionMode="multiple">
|
||||
* <GridList.Row value="r1">
|
||||
* <GridList.Cell><GridList.SelectionCheckbox /></GridList.Cell>
|
||||
* <GridList.Cell>Row label</GridList.Cell>
|
||||
* <GridList.Cell><button>Edit</button></GridList.Cell>
|
||||
* </GridList.Row>
|
||||
* </GridList>
|
||||
*
|
||||
* Use GridList (not Listbox) when rows contain interactive children
|
||||
* (buttons / links / per-row checkboxes) — `role="grid"` lets AT
|
||||
* navigate inner controls with Tab + cell-level commands. Listbox
|
||||
* is for atomic options only.
|
||||
*
|
||||
* Soma owns 2D keyboard nav (Up/Down rows + Left/Right cells),
|
||||
* Shift/Ctrl range/toggle, Ctrl+A, Escape-clear, typeahead, hidden
|
||||
* form input, Field merge. Eidos adds variant + size + color +
|
||||
* defaultValue (uncontrolled init).
|
||||
*/
|
||||
import { ActiveEidos } from '$uix/eidos';
|
||||
import * as GridList from '$soma/components/grid-list';
|
||||
import type { GridListProps } from './types';
|
||||
|
||||
let {
|
||||
size = 'md',
|
||||
variant = 'surface',
|
||||
color = 'primary',
|
||||
block = false,
|
||||
defaultValue,
|
||||
value = $bindable(defaultValue ?? []),
|
||||
children: bodyContent,
|
||||
...rest
|
||||
}: GridListProps = $props();
|
||||
|
||||
const eidos = ActiveEidos.require();
|
||||
const resolvedSize = $derived(eidos.resolve(size, 'md'));
|
||||
const resolvedVariant = $derived(eidos.resolve(variant, 'surface'));
|
||||
const resolvedColor = $derived(eidos.resolve(color, 'primary'));
|
||||
const resolvedBlock = $derived(eidos.resolve(block, false));
|
||||
</script>
|
||||
|
||||
<GridList.Provider
|
||||
{...rest}
|
||||
bind:value
|
||||
data-size={resolvedSize}
|
||||
data-variant={resolvedVariant}
|
||||
data-color={resolvedColor}
|
||||
data-block={resolvedBlock ? '' : undefined}
|
||||
>
|
||||
{#snippet children(snippetProps)}
|
||||
{@render bodyContent?.(snippetProps)}
|
||||
{/snippet}
|
||||
</GridList.Provider>
|
||||
@ -0,0 +1,56 @@
|
||||
// GridList — eidos compound API.
|
||||
//
|
||||
// import { GridList } from '$uix/eidos/components/grid-list';
|
||||
//
|
||||
// <GridList bind:value selectionMode="multiple">
|
||||
// <GridList.Row value="r1">
|
||||
// <GridList.Cell><GridList.SelectionCheckbox /></GridList.Cell>
|
||||
// <GridList.Cell>Row label</GridList.Cell>
|
||||
// <GridList.Cell><button onclick={…}>Edit</button></GridList.Cell>
|
||||
// </GridList.Row>
|
||||
// </GridList>
|
||||
//
|
||||
// Disambiguation:
|
||||
// - Use GridList for rows with interactive children (button / link /
|
||||
// checkbox inside the row). `role="grid"` + 2D nav (Up/Down rows,
|
||||
// Left/Right inner controls) lets AT navigate those properly.
|
||||
// - Use Listbox for atomic options (text rows only). ARIA forbids
|
||||
// interactive descendants inside `role="listbox"`.
|
||||
// - Use Select / Combobox for closed-picker patterns.
|
||||
// - Use Table for tabular data with columns + sort.
|
||||
//
|
||||
// Soma owns selection (single/multiple), 2D keyboard nav,
|
||||
// Shift/Ctrl/Cmd+A range and toggle helpers, Escape-clear, typeahead,
|
||||
// hidden form input, Field merge. Eidos adds variant + size + color +
|
||||
// defaultValue (uncontrolled init, parity with Combobox/Select).
|
||||
import GridListRoot from './grid-list.svelte';
|
||||
import Row from './grid-list-row.svelte';
|
||||
import Cell from './grid-list-cell.svelte';
|
||||
import SelectionCheckbox from './grid-list-selection-checkbox.svelte';
|
||||
|
||||
type GridListNamespace = typeof GridListRoot & {
|
||||
Row: typeof Row;
|
||||
Cell: typeof Cell;
|
||||
SelectionCheckbox: typeof SelectionCheckbox;
|
||||
};
|
||||
|
||||
const GridList = GridListRoot as GridListNamespace;
|
||||
GridList.Row = Row;
|
||||
GridList.Cell = Cell;
|
||||
GridList.SelectionCheckbox = SelectionCheckbox;
|
||||
|
||||
export { GridList };
|
||||
export default GridList;
|
||||
|
||||
export type {
|
||||
GridListProps,
|
||||
GridListRowProps as RowProps,
|
||||
GridListCellProps as CellProps,
|
||||
GridListSelectionCheckboxProps as SelectionCheckboxProps,
|
||||
GridListSize,
|
||||
GridListVariant,
|
||||
GridListColor,
|
||||
GridListSelectionMode,
|
||||
GridListProviderSnippetProps,
|
||||
GridListRowSnippetProps
|
||||
} from './types';
|
||||
@ -0,0 +1,46 @@
|
||||
import type { ColorRole, ControlVariant, ResponsiveProp, Size } from '$uix/eidos/lib/types';
|
||||
import type {
|
||||
ProviderProps,
|
||||
RowProps,
|
||||
CellProps,
|
||||
SelectionCheckboxProps,
|
||||
ProviderSnippetProps,
|
||||
RowSnippetProps,
|
||||
GridListSelectionMode
|
||||
} from '$soma/components/grid-list';
|
||||
|
||||
/**
|
||||
* GridList visual size — five-step subset matching the form-control
|
||||
* family (Combobox / Listbox / Select). Row height + font-size cascade
|
||||
* from this token.
|
||||
*/
|
||||
export type GridListSize = Extract<Size, 'xs' | 'sm' | 'md' | 'lg' | 'xl'>;
|
||||
|
||||
export type GridListVariant = ControlVariant;
|
||||
export type GridListColor = ColorRole;
|
||||
|
||||
export type GridListProps = ProviderProps & {
|
||||
/** Visual size — row height + font-size. @default 'md' */
|
||||
size?: ResponsiveProp<GridListSize>;
|
||||
/** Container chrome variant. @default 'surface' */
|
||||
variant?: GridListVariant;
|
||||
/** Accent palette for selected rows + focus ring. @default 'primary' */
|
||||
color?: GridListColor;
|
||||
/** Stretch to fill the container's inline-size. @default false */
|
||||
block?: boolean;
|
||||
/**
|
||||
* Uncontrolled initial selection. Mirrors Combobox/Select pattern;
|
||||
* ignored when `value` is bound by the consumer.
|
||||
*/
|
||||
defaultValue?: string[];
|
||||
};
|
||||
|
||||
export type GridListRowProps = RowProps;
|
||||
export type GridListCellProps = CellProps;
|
||||
export type GridListSelectionCheckboxProps = SelectionCheckboxProps;
|
||||
|
||||
export type {
|
||||
ProviderSnippetProps as GridListProviderSnippetProps,
|
||||
RowSnippetProps as GridListRowSnippetProps,
|
||||
GridListSelectionMode
|
||||
};
|
||||
@ -0,0 +1,522 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
GridList,
|
||||
type GridListSize,
|
||||
type GridListVariant,
|
||||
type GridListColor,
|
||||
type GridListSelectionMode
|
||||
} from '$uix/eidos/components/grid-list';
|
||||
import { compileMorfo } from '$uix/morfo';
|
||||
import { gridListMorfo } from '@/uix/morfo/components/grid-list';
|
||||
import { getActiveUix } from '$active-uix';
|
||||
|
||||
const uix = getActiveUix();
|
||||
|
||||
type Tab = 'live' | 'api' | 'morfo' | 'sema' | 'recipe' | 'a11y';
|
||||
let tab = $state<Tab>('live');
|
||||
|
||||
// ── Live state ────────────────────────────────────────────────────────
|
||||
let value = $state<string[]>(['r2']);
|
||||
let selectionMode = $state<GridListSelectionMode>('multiple');
|
||||
let size = $state<GridListSize>('md');
|
||||
let variant = $state<GridListVariant>('surface');
|
||||
let color = $state<GridListColor>('primary');
|
||||
let loop = $state(false);
|
||||
let disabled = $state(false);
|
||||
let invalid = $state(false);
|
||||
|
||||
let lastAction = $state<string | null>(null);
|
||||
function trigger(label: string) {
|
||||
return () => {
|
||||
lastAction = label;
|
||||
};
|
||||
}
|
||||
|
||||
type TraceEntry = { event: string; family: string; intent?: string; at: number };
|
||||
let trace = $state<TraceEntry[]>([]);
|
||||
let stageRef = $state<HTMLElement | null>(null);
|
||||
|
||||
$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 compiled = compileMorfo(gridListMorfo);
|
||||
const partsList = $derived([...compiled.parts.byKebab.values()]);
|
||||
const events = $derived([...compiled.actions.byName.values()]);
|
||||
|
||||
function fmtTime(at: number): string {
|
||||
const d = new Date(at);
|
||||
return `${String(d.getSeconds()).padStart(2, '0')}.${String(d.getMilliseconds()).padStart(3, '0')}`;
|
||||
}
|
||||
|
||||
const rows = [
|
||||
{ value: 'r1', label: 'Acme Industries', meta: 'Enterprise · 240 users' },
|
||||
{ value: 'r2', label: 'Globex Corporation', meta: 'Pro · 80 users' },
|
||||
{ value: 'r3', label: 'Initech Systems', meta: 'Free · 5 users' },
|
||||
{ value: 'r4', label: 'Soylent Foods', meta: 'Enterprise · 1.2k users' },
|
||||
{ value: 'r5', label: 'Umbrella Inc.', meta: 'Pro · 42 users', disabled: true },
|
||||
{ value: 'r6', label: 'Wonka Confections', meta: 'Free · 12 users' }
|
||||
];
|
||||
|
||||
const eidosSnippet = $derived(
|
||||
[
|
||||
"<script lang='ts'>",
|
||||
" import { GridList } from '$uix/eidos/components/grid-list';",
|
||||
' let value = $state<string[]>([]);',
|
||||
'</' + 'script>',
|
||||
'',
|
||||
'<GridList',
|
||||
' bind:value',
|
||||
selectionMode !== 'single' && ` selectionMode="${selectionMode}"`,
|
||||
size !== 'md' && ` size="${size}"`,
|
||||
variant !== 'surface' && ` variant="${variant}"`,
|
||||
color !== 'primary' && ` color="${color}"`,
|
||||
loop && ' loop',
|
||||
disabled && ' disabled',
|
||||
invalid && ' invalid',
|
||||
'>',
|
||||
' <GridList.Row value="r1">',
|
||||
' <GridList.Cell><GridList.SelectionCheckbox /></GridList.Cell>',
|
||||
' <GridList.Cell>Acme Industries</GridList.Cell>',
|
||||
' <GridList.Cell><button onclick={…}>Edit</button></GridList.Cell>',
|
||||
' </GridList.Row>',
|
||||
'</GridList>'
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('\n')
|
||||
);
|
||||
</script>
|
||||
|
||||
<div data-uix-canvas-inner>
|
||||
<header>
|
||||
<div data-uix-eyebrow>Forms · GridList</div>
|
||||
<h1 data-uix-page-title>GridList</h1>
|
||||
<p data-uix-page-lede>
|
||||
Selectable list with <code>role="grid"</code> semantics — rows
|
||||
that can contain interactive children (buttons, links, per-row
|
||||
checkboxes). 2D keyboard nav (Up/Down between rows + Left/Right
|
||||
between cells / inner controls) lets assistive tech reach the
|
||||
row-level actions properly. Use over <code>Listbox</code> when
|
||||
rows aren't atomic options — ARIA forbids interactive descendants
|
||||
inside <code>role="listbox"</code>.
|
||||
</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>{events.length}
|
||||
</span>
|
||||
<span data-uix-meta-pill>
|
||||
<span data-uix-meta-key>sizes</span>5
|
||||
</span>
|
||||
<span data-uix-meta-pill>
|
||||
<span data-uix-meta-key>apg</span>
|
||||
<a href={gridListMorfo.apg} target="_blank" rel="noreferrer">grid ↗</a>
|
||||
</span>
|
||||
<span data-uix-meta-pill>
|
||||
<span data-uix-meta-key>selected</span> {value.join(', ') || '—'}
|
||||
</span>
|
||||
{#if lastAction}
|
||||
<span data-uix-meta-pill>
|
||||
<span data-uix-meta-key>last</span> {lastAction}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div data-uix-stage>
|
||||
<div data-uix-stage-area bind:this={stageRef} style="padding: var(--uix-space-3); display: flex; justify-content: center;">
|
||||
<div style="inline-size: min(32rem, 100%);">
|
||||
<GridList
|
||||
bind:value
|
||||
{selectionMode}
|
||||
{size}
|
||||
{variant}
|
||||
{color}
|
||||
{loop}
|
||||
{disabled}
|
||||
{invalid}
|
||||
block
|
||||
>
|
||||
{#each rows as row (row.value)}
|
||||
<GridList.Row value={row.value} disabled={row.disabled}>
|
||||
<GridList.Cell>
|
||||
<GridList.SelectionCheckbox />
|
||||
</GridList.Cell>
|
||||
<GridList.Cell>
|
||||
<div style="display: flex; flex-direction: column; gap: 2px; min-inline-size: 0;">
|
||||
<strong style="line-height: 1.2;">{row.label}</strong>
|
||||
<span style="color: var(--color-content-secondary); font-size: var(--font-size-xs);">{row.meta}</span>
|
||||
</div>
|
||||
</GridList.Cell>
|
||||
<GridList.Cell>
|
||||
<button
|
||||
type="button"
|
||||
onclick={trigger(`Edit ${row.label}`)}
|
||||
disabled={row.disabled}
|
||||
style="padding: 0.125rem 0.5rem; border: 1px solid var(--color-border-default); border-radius: var(--radius-sm); background: var(--color-surface-overlay); cursor: pointer; font-size: var(--font-size-xs);"
|
||||
>
|
||||
Edit
|
||||
</button>
|
||||
</GridList.Cell>
|
||||
</GridList.Row>
|
||||
{/each}
|
||||
</GridList>
|
||||
</div>
|
||||
</div>
|
||||
<div data-uix-stage-trace>
|
||||
<span data-uix-stage-trace-key>trace</span>
|
||||
{#if trace.length === 0}
|
||||
<span>click row body to select; Tab into row to reach inner button</span>
|
||||
{:else}
|
||||
{#each trace.slice(0, 3) as entry (entry.at)}
|
||||
<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> [{value.join(', ')}]
|
||||
</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 <span data-uix-tab-count>4</span>
|
||||
</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>{events.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>
|
||||
Soma owns selection + 2D nav + Shift/Ctrl range/toggle + Ctrl+A select-all + Escape-clear + typeahead.
|
||||
Eidos adds variant/size/color chrome.
|
||||
</p>
|
||||
|
||||
<div data-uix-subsection-head>
|
||||
<span data-uix-layer-badge="soma">soma</span> Provider props
|
||||
</div>
|
||||
<div data-uix-controls>
|
||||
<label data-uix-control>
|
||||
<span data-uix-control-label>selectionMode</span>
|
||||
<span data-uix-chips role="radiogroup">
|
||||
{#each ['none', 'single', 'multiple'] as m (m)}
|
||||
<button data-uix-chip data-active={selectionMode === m} onclick={() => (selectionMode = m as GridListSelectionMode)}>{m}</button>
|
||||
{/each}
|
||||
</span>
|
||||
</label>
|
||||
<label data-uix-control>
|
||||
<span data-uix-control-label>loop</span>
|
||||
<span data-uix-switch>
|
||||
<input type="checkbox" bind:checked={loop} />
|
||||
<span data-uix-switch-label>{loop ? 'on' : 'off'}</span>
|
||||
</span>
|
||||
</label>
|
||||
<label data-uix-control>
|
||||
<span data-uix-control-label>disabled</span>
|
||||
<span data-uix-switch>
|
||||
<input type="checkbox" bind:checked={disabled} />
|
||||
<span data-uix-switch-label>{disabled ? 'on' : 'off'}</span>
|
||||
</span>
|
||||
</label>
|
||||
<label data-uix-control>
|
||||
<span data-uix-control-label>invalid</span>
|
||||
<span data-uix-switch>
|
||||
<input type="checkbox" bind:checked={invalid} />
|
||||
<span data-uix-switch-label>{invalid ? 'on' : 'off'}</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div data-uix-subsection-head>
|
||||
<span data-uix-layer-badge="eidos">eidos</span> visual props
|
||||
</div>
|
||||
<div data-uix-controls>
|
||||
<label data-uix-control>
|
||||
<span data-uix-control-label>variant</span>
|
||||
<span data-uix-chips role="radiogroup">
|
||||
{#each ['surface', 'outline', 'ghost'] as v (v)}
|
||||
<button data-uix-chip data-active={variant === v} onclick={() => (variant = v as GridListVariant)}>{v}</button>
|
||||
{/each}
|
||||
</span>
|
||||
</label>
|
||||
<label data-uix-control>
|
||||
<span data-uix-control-label>size</span>
|
||||
<span data-uix-chips role="radiogroup">
|
||||
{#each ['xs', 'sm', 'md', 'lg', 'xl'] as s (s)}
|
||||
<button data-uix-chip data-active={size === s} onclick={() => (size = s as GridListSize)}>{s}</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 c (c)}
|
||||
<button data-uix-chip data-active={color === c} onclick={() => (color = c as GridListColor)}>{c}</button>
|
||||
{/each}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div data-uix-code>
|
||||
<div data-uix-code-head>
|
||||
<span data-uix-layer-badge="eidos">eidos</span>
|
||||
<span>visual · variant + size + color + defaultValue</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</h2>
|
||||
<p data-uix-section-desc>4 parts: Provider, Row, Cell, SelectionCheckbox.</p>
|
||||
|
||||
<div data-uix-subsection-head>Provider (GridList)</div>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td class="name">value <span data-uix-tag data-kind="bindable">bindable</span></td><td class="type">string[]</td><td class="default">[]</td><td>Selected row values.</td></tr>
|
||||
<tr><td class="name">defaultValue <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">string[]</td><td class="default empty">—</td><td>Uncontrolled initial selection. Ignored when value is bound.</td></tr>
|
||||
<tr><td class="name">selectionMode</td><td class="type">'none' | 'single' | 'multiple'</td><td class="default">'single'</td><td>—</td></tr>
|
||||
<tr><td class="name">loop</td><td class="type">boolean</td><td class="default">false</td><td>Wrap arrow nav at edges.</td></tr>
|
||||
<tr><td class="name">typeahead</td><td class="type">boolean</td><td class="default">true</td><td>Letter typing jumps to matching row.</td></tr>
|
||||
<tr><td class="name">disabled · readonly · required · invalid</td><td class="type">boolean</td><td class="default">false</td><td>OR-merged with Field.Provider.</td></tr>
|
||||
<tr><td class="name">name</td><td class="type">string</td><td class="default empty">—</td><td>Form name → hidden input.</td></tr>
|
||||
<tr><td class="name">variant <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">ControlVariant: 'surface' | 'outline' | 'ghost'</td><td class="default">'surface'</td><td>Container chrome.</td></tr>
|
||||
<tr><td class="name">size <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">'xs' | 'sm' | 'md' | 'lg' | 'xl'</td><td class="default">'md'</td><td>Row height + font.</td></tr>
|
||||
<tr><td class="name">color <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">ColorRole</td><td class="default">'primary'</td><td>Selected-row + focus accent.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div data-uix-subsection-head>Row</div>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td class="name">value</td><td class="type">string</td><td class="default empty">required</td><td>Unique row identifier.</td></tr>
|
||||
<tr><td class="name">textValue</td><td class="type">string</td><td class="default empty">textContent</td><td>Override for typeahead search.</td></tr>
|
||||
<tr><td class="name">disabled</td><td class="type">boolean</td><td class="default">false</td><td>Skip from selection + 2D nav.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div data-uix-subsection-head>Cell · SelectionCheckbox</div>
|
||||
<p data-uix-section-desc style="margin-top: 0.25rem;">
|
||||
<code>Cell</code> renders <code>role="gridcell"</code> as a content slot — wrap any interactive children inside. <code>SelectionCheckbox</code> is a per-row toggle that participates in <code>selectionMode='multiple'</code>; click toggles the row in <code>value</code>. Visual matches the shared menu-indicator pattern (filled accent + white ✓).
|
||||
</p>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if tab === 'morfo'}
|
||||
<section data-uix-section>
|
||||
<h2 data-uix-section-title>
|
||||
<span data-uix-layer-badge="morfo">morfo</span>
|
||||
· declarative contract
|
||||
</h2>
|
||||
<p data-uix-section-desc>Source: <code>src/uix/morfo/components/grid-list.ts</code>.</p>
|
||||
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Field</th><th>Value</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td class="name">name</td><td class="type">"{gridListMorfo.name}"</td></tr>
|
||||
<tr><td class="name">kebab</td><td class="type">"{gridListMorfo.kebab}"</td></tr>
|
||||
<tr><td class="name">apg</td><td><a href={gridListMorfo.apg} target="_blank" rel="noreferrer">{gridListMorfo.apg}</a></td></tr>
|
||||
<tr><td class="name">parts.length</td><td class="default">{gridListMorfo.parts.length}</td></tr>
|
||||
<tr><td class="name">events.length</td><td class="default">{events.length}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div data-uix-subsection-head>Parts</div>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Part</th><th>Marker</th><th>Element</th><th>Role</th><th>Archetype</th><th>States</th><th>Optional</th></tr></thead>
|
||||
<tbody>
|
||||
{#each partsList as part (part.kebab)}
|
||||
<tr>
|
||||
<td class="name">{part.kebab}</td>
|
||||
<td><code data-uix-part-marker>[{part.marker}]</code></td>
|
||||
<td class="type"><{part.defaultElement}></td>
|
||||
<td class="type">{part.role ?? '—'}</td>
|
||||
<td class="default">{part.archetype ?? '—'}</td>
|
||||
<td class="default">{part.states.length ? part.states.join(' | ') : '—'}</td>
|
||||
<td class="default">{part.optional ? 'yes' : 'no'}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div data-uix-subsection-head>Events declaration</div>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>name</th><th>family</th><th>verb</th><th>sequence</th><th>intent</th><th>target</th></tr></thead>
|
||||
<tbody>
|
||||
{#each events as action (action.name)}
|
||||
{@const sem = action.semantic}
|
||||
{@const intentDecl = 'intent' in sem ? sem.intent : undefined}
|
||||
{@const intentStr = typeof intentDecl === 'string' ? intentDecl : intentDecl ? `fromProp:${(intentDecl as { fromProp?: string }).fromProp ?? '?'}` : '—'}
|
||||
<tr>
|
||||
<td class="name">{action.name}</td>
|
||||
<td class="type">{sem.family}</td>
|
||||
<td>{sem.verb ?? '—'}</td>
|
||||
<td>{sem.sequence ?? 'pre'}</td>
|
||||
<td class="default">{intentStr}</td>
|
||||
<td>{action.target}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if tab === 'sema'}
|
||||
<section data-uix-section id="sema">
|
||||
<h2 data-uix-section-title>
|
||||
<span data-uix-layer-badge="sema">sema</span>
|
||||
· events
|
||||
</h2>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Name</th><th>Family</th><th>Verb</th><th>Sequence</th><th>Intent</th><th>Play</th></tr></thead>
|
||||
<tbody>
|
||||
{#each events as action (action.name)}
|
||||
{@const intentDecl = 'intent' in action.semantic ? action.semantic.intent : undefined}
|
||||
{@const effectiveIntent = typeof intentDecl === 'string' ? intentDecl : undefined}
|
||||
<tr>
|
||||
<td class="name">{action.name}</td>
|
||||
<td class="type">{action.semantic.family}</td>
|
||||
<td>{action.semantic.verb ?? '—'}</td>
|
||||
<td>{action.semantic.sequence ?? 'pre'}</td>
|
||||
<td class="default">{effectiveIntent ?? '—'}</td>
|
||||
<td>
|
||||
<button
|
||||
data-uix-play
|
||||
onclick={() => {
|
||||
const target = (stageRef?.querySelector('[data-grid-list-row]') ?? stageRef) as HTMLElement | null;
|
||||
if (!target) return;
|
||||
void uix.events?.emit({
|
||||
name: action.name,
|
||||
family: action.semantic.family,
|
||||
target,
|
||||
...(effectiveIntent ? { intent: effectiveIntent } : {})
|
||||
});
|
||||
}}
|
||||
>▶ 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 at <code>src/uix/eidos/components/grid-list/grid-list.css</code>.</p>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Selector</th><th>Source</th><th>What it paints</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td class="name">[data-grid-list]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Container — flex column, border, padding, scroll cap.</td></tr>
|
||||
<tr><td class="name">[data-grid-list][data-size]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Row height + font-size scale.</td></tr>
|
||||
<tr><td class="name">[data-grid-list][data-variant]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Container chrome (surface / outline / ghost).</td></tr>
|
||||
<tr><td class="name">[data-grid-list][data-color]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Accent palette for selected rows + focus ring.</td></tr>
|
||||
<tr><td class="name">[data-grid-list-row]</td><td><span data-uix-tag data-kind="soma">morfo</span></td><td>Row — flex layout, padding, hover/highlight states.</td></tr>
|
||||
<tr><td class="name">[data-grid-list-row][data-selected]</td><td><span data-uix-tag data-kind="soma">morfo</span></td><td>Selected-row accent-soft fill.</td></tr>
|
||||
<tr><td class="name">[data-grid-list-cell]</td><td><span data-uix-tag data-kind="soma">morfo</span></td><td>Cell slot — first/last child get special flex treatment.</td></tr>
|
||||
<tr><td class="name">[data-grid-list-selection-checkbox][data-state]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>0.875rem outlined box → filled accent + white ✓.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if tab === 'a11y'}
|
||||
<section data-uix-section>
|
||||
<h2 data-uix-section-title>Accessibility</h2>
|
||||
<p data-uix-section-desc>
|
||||
Follows the APG <a href={gridListMorfo.apg} target="_blank" rel="noreferrer">grid pattern</a>.
|
||||
Container is <code>role="grid"</code>; each Row is
|
||||
<code>role="row"</code>; each Cell is <code>role="gridcell"</code>.
|
||||
Roving tabindex on rows; arrow nav handles cell-level focus too
|
||||
so inner buttons / links are reachable.
|
||||
</p>
|
||||
|
||||
<div data-uix-subsection-head>Keyboard</div>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Key</th><th>Action</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><span data-uix-kbd>ArrowDown</span> / <span data-uix-kbd>ArrowUp</span></td><td>Move row focus ±1.</td></tr>
|
||||
<tr><td><span data-uix-kbd>ArrowRight</span> / <span data-uix-kbd>ArrowLeft</span></td><td>Move cell focus within the row (lets you reach inner buttons / links).</td></tr>
|
||||
<tr><td><span data-uix-kbd>Home</span> / <span data-uix-kbd>End</span></td><td>First / last row.</td></tr>
|
||||
<tr><td><span data-uix-kbd>Enter</span> / <span data-uix-kbd>Space</span></td><td>Toggle row selection.</td></tr>
|
||||
<tr><td><span data-uix-kbd>Shift+Click</span> / <span data-uix-kbd>Shift+ArrowUp/Down</span></td><td>Extend range (multiple mode).</td></tr>
|
||||
<tr><td><span data-uix-kbd>Ctrl/Cmd+A</span></td><td>Select all (multiple mode).</td></tr>
|
||||
<tr><td><span data-uix-kbd>Escape</span></td><td>Clear selection.</td></tr>
|
||||
<tr><td>Letter / digit</td><td>Typeahead — jump to next row whose textValue starts with that character.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div data-uix-subsection-head>ARIA contract</div>
|
||||
<div data-uix-table-wrap>
|
||||
<table data-uix-table>
|
||||
<thead><tr><th>Part</th><th>Attribute</th><th>Value</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td class="name">grid-list</td><td>role</td><td class="type">"grid"</td></tr>
|
||||
<tr><td class="name">grid-list</td><td>aria-multiselectable</td><td class="type">"true" (multiple mode)</td></tr>
|
||||
<tr><td class="name">row</td><td>role</td><td class="type">"row"</td></tr>
|
||||
<tr><td class="name">row</td><td>aria-selected</td><td class="type">"true" | "false"</td></tr>
|
||||
<tr><td class="name">row</td><td>aria-disabled</td><td class="type">"true" (disabled)</td></tr>
|
||||
<tr><td class="name">cell</td><td>role</td><td class="type">"gridcell"</td></tr>
|
||||
<tr><td class="name">selection-checkbox</td><td>role / aria-checked</td><td class="type">"checkbox" / "true|false"</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
</div>
|
||||
Loading…
Reference in new issue