import { type PropertyValues } from 'lit'; import { UiElement } from '../shared/element.js'; import type { CloseDetail } from '../shared/events.js'; import '../layer/layer.js'; export type TearsheetCloseReason = 'escape' | 'close-button' | 'outside'; /** * Carbon for IBM Products `Tearsheet` (`c4p-tearsheet`): a large modal that rises from the bottom of the screen * (240ms) over the dimmed page — `width="narrow"` (Carbon's small modal: 60% / 42% / 36% of the screen from md / * lg / xlg, 130px from the top) or `wide` (all but 64px each side, 90px from the top). Header: `label`, `heading` * (heading-04 wide, heading-03 narrow), `description` (or `slot="description"`), and in a wide one * `slot="header-actions"` and `slot="header-navigation"` (tabs); a wide one may have an `slot="influencer"` pane * (`influencer-placement` left / right, `influencer-width` narrow 256px / wide 320px). Content on the background * (wide, layer 0) or the layer (narrow, layer 1). `slot="actions"`: up to four ``s laid out as Carbon's * ActionSet (64px; 80px wide). The × shows with `has-close-icon` or when there are no actions. Esc, × and a click * outside (unless `prevent-close-on-click-outside`) ask to close; Tab stays inside. Opening another tearsheet over it * scales this one back (95%, then 90%) and dims the page less, up to three deep. * * @fires ui-request-close - Cancelable; detail: { reason: 'escape' | 'close-button' | 'outside' } * @fires ui-close - After it closed * @slot - The content * @slot label - Rich label (instead of `label`) * @slot description - Rich description (instead of `description`), e.g. a `` * @slot header-actions - Small buttons in the header (wide) * @slot header-navigation - Tabs under the header text (wide) * @slot influencer - A side pane beside the content (wide) * @slot actions - Up to four action buttons * @csspart dialog - The full-screen dialog * @csspart container - The sheet * @csspart header - The header * @csspart heading - The heading * @csspart close-button - The × * @csspart influencer - The side pane * @csspart content - The content's box * @csspart actions - The row of action buttons * @cssprop --ui-tearsheet-radius - Corner radius of the top corners (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) * @cssprop --ui-close-size - Size of the × button (default 48px; Kanok: 32px) * @cssprop --ui-close-inset - Margin that sets the × in from the corner (default 0; Kanok: 8px) * @cssprop --ui-icon-control-radius - Corners of the ×, its hover fill and its ring (default 0; Kanok: round) * @cssprop --ui-focus-offset - `outline-offset` of the ×'s focus ring (default -2px: inside; Kanok: 2px outside) */ export declare class UiTearsheet extends UiElement { static readonly styles: import("lit").CSSResult[]; open: boolean; /** narrow: Carbon's small modal; wide: the whole screen but 64px each side. */ width: 'narrow' | 'wide'; /** How far from the top the sheet starts: normal 90px, lower 130px (default lower for a narrow one). */ verticalPosition?: 'normal' | 'lower'; heading: string; /** A small label above the heading. */ label: string; description: string; influencerPlacement: 'left' | 'right'; influencerWidth: 'narrow' | 'wide'; /** Show the × even with actions (it always shows without them). */ hasCloseIcon: boolean; /** The ×'s name (default "Close", translated). */ closeIconDescription: string; preventCloseOnClickOutside: boolean; /** What takes focus on open (a selector in the content), else × or the first control. */ selectorInitialFocus: string; private slotted; private actionCount; private readonly dialog?; private readonly container?; private readonly actionsEl?; private readonly localize; private launcher; private closeTimer?; /** Its place on the page's overlay stack: Esc reaches it only while it is the topmost layer. */ private readonly layer; private pointerDownOutside; private get wide(); private get showsClose(); /** Called by the stack: this sheet's place among the open ones (position 1 = oldest) and how many show. */ placeInStack(position: number, depth: number): void; disconnectedCallback(): void; protected willUpdate(changed: PropertyValues): void; protected updated(changed: PropertyValues): void; private duration; private opened; private closed; private leaveStack; /** Off the overlay stack, and its hold on the page's scrolling let go (the page scrolls once the last overlay has). */ private release; private deepActive; /** Rises from below (240ms, entrance expressive) or sinks back (exit expressive) and fades the backdrop; returns how long. */ private rise; /** * The rise / sink animations: kept, because a running animation holds its element, and the shadow root's * getAnimations() lists neither the ::backdrop one nor any once the sheet is off the page. */ private animations; private stopAnimations; private layout; private focusInitial; /** Asks to close (cancelable `ui-request-close`), then closes. */ requestClose(reason: TearsheetCloseReason): void; /** A close request the page's Esc listener didn't take (core/overlay.ts; e.g. Android's back gesture): only for the topmost layer. */ private onCancel; /** The dialog closed while still `open`: the browser closed it without asking (its close watcher). That's a request; vetoed, it opens again. */ private onClose; private onPointerDown; private onClick; /** Tab stays inside the sheet (Carbon). */ private onKeydown; private onSlotChange; private onActionsChange; private renderInfluencer; private renderHeader; render(): import("lit-html").TemplateResult<1>; } export interface UiTearsheetEventMap extends HTMLElementEventMap { 'ui-request-close': CustomEvent>; 'ui-close': Event; } export interface UiTearsheet { addEventListener(type: K, listener: (this: UiTearsheet, event: UiTearsheetEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiTearsheet, event: UiTearsheetEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-tearsheet': UiTearsheet; } }