UNPKG

@sandlada/mdc

Version:

@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.

116 lines 5.02 kB
/** * @license * Copyright 2026 Kai-Orion & Sandlada * SPDX-License-Identifier: MIT * * @fileoverview * Internal base class for `mdc-list-item` — a single MD3 list row. * * The item renders one of three native roots depending on `type`: * * - `link` → `<a>` (navigates to `href`, forced when `href` is set) * - `button` → `<button>` (activates on Enter / Space / click) * - `text` → `<li>` (non-interactive; hosts a `control` slot, e.g. checkbox) * * Interactive items wire `mixinRippleOptions` / `mixinFocusRingOptions` to the * root element. On activation the item dispatches a composed * `request-activation` event so the parent `mdc-list` can promote it to the * roving tabindex slot. * * Visual structure (mirrors @material/web `<md-item>`): * * [leading: control + start] [content: overline / headline / supporting-text / * trailing-supporting-text] [end] */ import { LitElement, type PropertyValues, type TemplateResult } from 'lit'; import { type IListItem } from '../list.interface'; declare const BaseListItem_base: Omit<typeof LitElement, "prototype"> & (new () => LitElement & object & import("../../ripple/ripple-options.mixin").IMixinRippleOptions & import("../../ripple/ripple-options.mixin").IMixinRippleAttributes & import("../../focus-ring/focus-ring-options.mixin").IMixinFocusRingOption); export declare abstract class BaseListItem extends BaseListItem_base implements IListItem { static styles: import("lit").CSSResult; static shadowRootOptions: { clonable?: boolean; customElementRegistry?: CustomElementRegistry | null; mode: ShadowRootMode; serializable?: boolean; slotAssignment?: SlotAssignmentMode; delegatesFocus: boolean; }; /** The interactive role of the item. */ type: 'text' | 'button' | 'link'; /** Disables the item. Link items are never disabled. */ disabled: boolean; /** The destination URL. Forces `type` to `link` when set. */ href: string; /** The target of the link (e.g. `_blank`). */ target: string; /** Marks the item as selected (MD3 secondary-container highlight). */ selected: boolean; /** Roving tabindex value assigned by the parent `mdc-list`. */ listTabIndex: number; /** Set when the `control` slot is populated. */ hasControl: boolean; /** Set when the `start` slot is populated. */ hasStart: boolean; /** Set when the `overline` slot is populated. */ hasOverline: boolean; /** Set when the `headline` slot is populated. */ hasHeadline: boolean; /** Set when the `supporting-text` slot is populated. */ hasSupportingText: boolean; /** Set when the `trailing-supporting-text` slot is populated. */ hasTrailingSupportingText: boolean; /** Set when the `end` slot is populated. */ hasEnd: boolean; protected readonly rootElement: HTMLElement | null; private readonly assignedControls; private readonly assignedStarts; private readonly assignedOverlines; private readonly assignedHeadlines; private readonly assignedSupportingTexts; private readonly assignedTrailingSupportingTexts; private readonly assignedEnds; private readonly assignedDefaultNodes; /** Whether the item is interactive (`button` or `link` type). */ get isInteractive(): boolean; /** Whether the item is disabled (always false for `link` items). */ get isDisabled(): boolean; get rippleControl(): HTMLElement | null; get focusRingControl(): HTMLElement | null; constructor(); protected willUpdate(changedProperties: PropertyValues<this>): void; protected getRenderClasses(): { [x: string]: boolean; container: boolean; disabled: boolean; selected: boolean; 'one-line': boolean; 'two-line': boolean; 'three-line': boolean; 'has-control': boolean; 'has-start': boolean; 'has-overline': boolean; 'has-headline': boolean; 'has-supporting-text': boolean; 'has-trailing-supporting-text': boolean; 'has-end': boolean; }; protected render(): TemplateResult; /** Ripple + focus-ring, rendered only on interactive (button / link) roots. */ protected renderSurface(): TemplateResult; /** The `md-item`-style three-part body: leading / content / trailing. */ protected renderBody(): TemplateResult; protected renderTouchTarget(): TemplateResult; focus(): void; click(): void; private readonly handleControlSlotChange; private readonly handleStartSlotChange; private readonly handleOverlineSlotChange; private readonly handleHeadlineSlotChange; private readonly handleSupportingTextSlotChange; private readonly handleTrailingSupportingTextSlotChange; private readonly handleEndSlotChange; private readonly handleDefaultSlotChange; private readonly handleActivation; } export {}; //# sourceMappingURL=base-list-item.d.ts.map