import { type CSSResultGroup } from 'lit'; import { LocalizeController } from '../shared/localize.js'; import { UiElement } from '../shared/element.js'; import '../checkbox/checkbox.js'; import '../radio/radio.js'; import type { TableExpandoDetail, TableSelectionDetail } from './defs.js'; /** * What a body row and the header row share (Carbon's header row extends its row): a `role=row` table row as tall as * the table's size, with the cells the table adds before the author's — the expand chevron and the selection * checkbox or radio. * * @slot - The row's cells * @csspart expand-cell - The cell of the expand chevron * @csspart expand-button - The chevron button * @csspart selection-cell - The cell of the checkbox or radio */ export declare class UiTableRowBase extends UiElement { static readonly styles: CSSResultGroup; /** Chosen (Carbon `selected`); the table keeps the header's select-all and the batch actions in step. */ selected: boolean; /** Can't be chosen. */ disabled: boolean; /** A single-choice radio instead of a checkbox (the table's `radio` sets it). */ radio: boolean; /** No checkbox in the selection cell (the header row of a radio table). */ hideCheckbox: boolean; /** Shows the selection cell: the checkbox's name (the table's `is-selectable` sets one). */ selectionName: string; /** The checkbox's value. */ selectionValue: string; /** The checkbox's accessible name; default "Select row" with the row's first cell. */ selectionLabel: string; /** Has a `` after it (the table's `expandable` sets it). */ expandable: boolean; /** Its expanded row is open. */ expanded: boolean; /** The header row's chevron opens and closes every row (the table's `batch-expansion` sets it). */ batchExpansion: boolean; /** Left out by the table's search. */ filtered: boolean; /** Hovered with its expanded row (the two tint together). */ highlighted: boolean; /** The table has an expand column: every row gets the cell, expandable ones the chevron. */ expandColumn: boolean; /** The header's select-all is partly checked (some rows chosen); the table sets it. */ indeterminate: boolean; /** The radio of a radio table that takes Tab (the chosen row, else the first); the table sets it. */ tabStop: boolean; /** On another page of the table's pagination (the table sets it). */ pagedOut: boolean; /** The first column is pinned: the chevron and checkbox cells stick too (the table sets it). */ pinStart: boolean; /** A filler cell after the cells takes the rest of the row once the columns are resized (the table sets it). */ filler: boolean; /** The table is a grid (an editable column): grid cells, the body's cells and controls out of the Tab order (the table sets it). */ grid: boolean; protected readonly localize: LocalizeController; /** The header row: select-all / expand-all instead of the row's own. */ protected readonly header: boolean; connectedCallback(): void; disconnectedCallback(): void; /** The expanded row after this one, if any. */ protected get expandedRow(): (HTMLElement & { expanded: boolean; selected: boolean; highlighted: boolean; }) | null; protected updated(changed: Map): void; /** Hovering a row tints its expanded row too (Carbon). */ private readonly onPointer; /** Opens or closes, unless the cancelable `ui-table-row-expando-beingtoggled` is canceled. */ toggleExpanded(expanded?: boolean): void; /** The row's first cell as text, which tells its controls apart for screen readers ("Select row, Lease"). */ private get rowName(); private renderExpandCell; /** The checkbox (or radio) changed: ask with a cancelable event, then keep the new state or put the old one back. */ private readonly onSelectionChange; /** Arrow keys between the rows' radios (as native radios, ← / → mirrored right-to-left): the table moves the choice. */ private readonly onRadioKeydown; private get cellRole(); /** A body row's cells and controls in a grid: out of the Tab order (the grid moves its one stop among the cells). */ private get bodyGridIndex(); /** The cells the grid's arrow keys move through: the chevron and checkbox cells, then the shown author cells. */ gridCells(): HTMLElement[]; /** Focuses this row's selection control (a radio the arrow keys moved to). */ focusSelection(): void; /** The header's select-all checkbox (none in a radio table). */ private renderSelectAll; /** A body row's checkbox or radio, named with the row's first cell. */ private renderRowSelection; private renderSelectCell; render(): import("lit-html").TemplateResult<1>; } /** * Carbon `cds-table-row`: a body row of ``s. Hovering it tints the row and its rules. With * `use-zebra-styles` on the table, its body marks every second row `even` (striped) and the others `odd`. * * Selection (the table's `is-selectable` / `radio`): a checkbox (or radio) cell before the cells; choosing fires * the cancelable `ui-table-row-change-selection` and sets `selected`. Expansion (the table's `expandable`): a * chevron cell that opens the `` right after it, through the cancelable * `ui-table-row-expando-beingtoggled`, then `ui-table-row-expando-toggled`. * * @slot - The row's ``s * @fires ui-table-row-change-selection - cancelable; detail: { selected } before the row is chosen or released * @fires ui-table-row-expando-beingtoggled - cancelable; detail: { expanded } before the row opens or closes * @fires ui-table-row-expando-toggled - detail: { expanded } after the row opened or closed * @cssprop --ui-table-row-selected - Fill of a chosen row (default `--ui-layer-accent`; Kanok: `--ui-highlight`) * @cssprop --ui-table-row-thread - `background-image` of a chosen row's first cell, for a mark on its start edge (default none; Kanok: a 3px `--ui-border-interactive` mark) * @cssprop --ui-icon-control-radius - Corners of its small icon buttons, their hover fill and ring (default 0; Kanok: round) */ export declare class UiTableRow extends UiTableRowBase { static readonly styles: CSSResultGroup[]; /** A striped row (set by the body with `use-zebra-styles`). */ even: boolean; /** An unstriped row of a zebra table (set by the body). */ odd: boolean; } export interface UiTableRowEventMap extends HTMLElementEventMap { 'ui-table-row-change-selection': CustomEvent; 'ui-table-row-expando-beingtoggled': CustomEvent; 'ui-table-row-expando-toggled': CustomEvent; } /** Typed listeners for UiTableRow's events (declaration merging with the class). */ export interface UiTableRow { addEventListener(type: K, listener: (this: UiTableRow, event: UiTableRowEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiTableRow, event: UiTableRowEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-table-row': UiTableRow; } }