import { nothing, type PropertyValues } from 'lit'; import type { Placement } from '../../core/position.js'; import { UiElement } from '../shared/element.js'; import type { CloseDetail } from '../shared/events.js'; import '../layer/layer.js'; import '../icon-button/icon-button.js'; export type SidePanelSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; export type SidePanelCloseReason = 'escape' | 'close-button' | 'overlay'; /** * Carbon for IBM Products `SidePanel` (`c4p-side-panel`): a panel that slides in from the right (or `placement="left"`) * under the 48px UI shell header — `size` xs 16rem, sm 20rem, md 30rem, lg 40rem, xl 65rem, 2xl 80rem (at most 75vw * from md screens). Slide-over (default) covers the page and keeps Tab inside it; `include-overlay` dims the page and a * click on it closes the panel; `slide-in` instead pushes the page aside (`selector-page-content`), takes no focus * and no Esc. Header: `label-text` (label-01), `heading` (heading-03), `slot="subtitle"` (body-compact-01), the × * button (tooltip left), `current-step` > 0 a back button, `slot="action-toolbar"` small buttons under it. As the * content scrolls, the label and subtitle fade and the heading shrinks to heading-compact-02 (`animate-title`, Carbon's * default; off with reduced motion). `slot="actions"`: up to four ``s, laid out as Carbon's ActionSet for * the panel's size (64px; 48px `condensed-actions`). The content sits on layer 1 (fields are field-02). A slide-over * panel is on the page's overlay stack: one Esc closes only the topmost layer (a modal opened from the panel closes * first), and a panel opened from a modal opens over it, as a modal dialog of its own, so it can be used. * * @fires ui-request-close - Cancelable; detail: { reason: 'escape' | 'close-button' | 'overlay' } * @fires ui-close - After it closed * @fires ui-navigate-back - The back button (`current-step` > 0) was pressed * @slot - The content * @slot subtitle - Text under the heading * @slot above-title - Content above the label and heading * @slot below-title - Content under the subtitle * @slot action-toolbar - Small buttons under the header (the first one with its label) * @slot actions - The action buttons * @csspart panel - The panel * @csspart overlay - The overlay of `include-overlay` * @csspart header - The header * @csspart heading - The heading * @csspart body - The content's box * @csspart actions - The row of action buttons * @cssprop --ui-side-panel-top - Where the panel starts (default 3rem, under the UI shell header) * @cssprop --ui-side-panel-radius - Corner radius of the edge facing the page (default 0; Kanok: 12px) * @cssprop --ui-actions-gap / --ui-actions-padding - Gap between the action buttons and padding round them (default none: full-bleed buttons that touch; Kanok: 8px / 16px 20px) * @cssprop --ui-actions-button-flex - `flex` of each action button (default: Carbon's widths by count; Kanok: their own width) * @cssprop --ui-actions-button-align / --ui-actions-button-padding-top - Where a button's label sits (default: at the top, 16px in) * @cssprop --ui-actions-stacked-direction / --ui-actions-stacked-wrap / --ui-actions-stacked-width - Where Carbon stacks the actions (narrow): `flex-direction`, `flex-wrap` and each button's width (default column-reverse, nowrap, 100%; Kanok: one row that wraps) */ export declare class UiSidePanel extends UiElement { static readonly styles: import("lit").CSSResult[]; open: boolean; placement: 'right' | 'left'; /** xs 16rem, sm 20rem, md 30rem, lg 40rem, xl 65rem, 2xl 80rem. */ size: SidePanelSize; /** The heading (Carbon `title`); also the panel's accessible name. */ heading: string; /** A small label above the heading. */ labelText: string; /** Push the page aside (`selector-page-content`) instead of covering it; no focus trap, no Esc. */ slideIn: boolean; /** Dim the page; a click on it closes the panel (unless `prevent-close-on-click-outside`). */ includeOverlay: boolean; preventCloseOnClickOutside: boolean; /** What takes focus on open (a selector in the content), else the first control. */ selectorInitialFocus: string; /** The page element a slide-in panel pushes aside. */ selectorPageContent: string; hideCloseButton: boolean; /** The × button's name and tooltip (default "Close", translated). */ closeIconDescription: string; closeIconTooltipAlignment: Placement; /** The back button's name and tooltip (default "Back", translated). */ navigationBackIconDescription: string; /** Above 0 shows the back button (a panel with steps). */ currentStep: number; /** 48px action buttons instead of 64px. */ condensedActions: boolean; /** Shrink the heading as the content scrolls (Carbon's default). */ animateTitle: boolean; /** Rendered: open, or animating closed. */ private shown; private animated; private hasSubtitle; private hasToolbar; private actionCount; /** Opened over a modal dialog: rendered in a modal `` of its own, in the top layer above it. */ private overModal; private readonly panel?; private readonly overlay?; private readonly scroller?; private readonly body?; private readonly labelEl?; private readonly subtitleEl?; private readonly titleEl?; private readonly actionsEl?; private readonly layerDialog?; private readonly localize; private launcher; /** The page element pushed aside on open, so close resets the same one. */ private pushedPage; /** Its place on the page's overlay stack while open (a slide-over panel): Esc reaches it only as the topmost layer. */ private layer; private closeTimer?; private resizeObserver?; disconnectedCallback(): void; private get actionSize(); private duration; protected willUpdate(changed: PropertyValues): void; protected updated(changed: PropertyValues): void; private opened; private closed; /** Undo what an open panel set up on the page. */ private release; /** * Carbon for IBM Products 2.x: 320px in from its edge while it fades in (150ms, entrance), or out the same way * (150ms, exit), the overlay fading with it; reduced motion: none. Returns the panel's animation. */ private slide; /** * The slide and fade animations: kept, because a running animation holds its element, and once the panel is off the * page its shadow root's getAnimations() no longer lists them. */ private animations; /** The page element a slide-in panel pushes aside: in the panel's own tree first (a micro app's shadow root), else the document. */ private pageContent; /** A slide-in panel makes room for itself beside the page content. */ private pushPage; private layout; /** How far the content scrolls before the header is collapsed: the label, the subtitle (and the title's gap with a toolbar). */ private distance; /** Carbon animates the title only when there is something to fade and enough to scroll. */ private measureTitle; private readonly onScroll; /** The browser's own close request for the dialog over a modal (Esc itself goes through core/overlay.ts): a request, as Esc. */ private onLayerCancel; /** Tab stays inside a slide-over panel (Carbon). */ private readonly onKeydown; private focusInitial; /** Asks to close (cancelable `ui-request-close`), then closes. */ requestClose(reason: SidePanelCloseReason): void; private onOverlayClick; private onBack; private onActionsChange; private renderTitle; private renderHeader; render(): typeof nothing | import("lit-html").TemplateResult<1>; } export interface UiSidePanelEventMap extends HTMLElementEventMap { 'ui-request-close': CustomEvent>; 'ui-close': Event; 'ui-navigate-back': Event; } export interface UiSidePanel { addEventListener(type: K, listener: (this: UiSidePanel, event: UiSidePanelEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiSidePanel, event: UiSidePanelEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-side-panel': UiSidePanel; } }