import Component from "../Component"; import { Block, List } from "../"; import { ComponentFactory, ValueOrAsync } from "../ComponentFactory"; import { ComponentRenderHtmlOutput } from "../ComponentRenderOutput"; /** Represents a container with vertically stacked blocks */ export declare class Container extends Component { /** Create a container with given content, if any */ constructor(content?: Block[]); /** Initialize a container factory with given values */ static with(values: Container.Initializer): ComponentFactory; /** Initialize a container factory with given content */ static withContent(content: ComponentFactory.SpecList2): ComponentFactory; /** Initialize with given (observable) values; returns this */ initializeWith: (values: Container.Initializer) => this; /** Initialize with given (observable) content; returns this */ initializeWithContent(content: ComponentFactory.SpecList2): this; /** Rendered output for this component (observable) */ out: ComponentRenderHtmlOutput; /** Array of main area blocks, stacked vertically (observed) */ content: (Block | null)[]; /** Vertical alignment of main content (observed) */ vertAlign: Container.VertAlign; /** Max width of main content (observed) */ maxContentWidth: string; /** True to make content within container scrollable (overflow: auto); defaults to false (observed) */ scrollable: boolean; /** Object with options to be used when displaying this container as (modal) screen foreground component (NOT observed) */ displayOptions: Container.DisplayOptions; /** True if mouse is hovering over this container (read-only, observable) */ readonly hoverState: boolean | undefined; /** True if any inner control element has focus (read-only, observable) */ readonly hasFocus: boolean | undefined; /** Focus first focusable element within this container, or last element that had focus before; does not immediately update hasFocus; returns this */ restoreFocus(): this; /** Remove focus from the element within this container that currently has input focus; does not immediately update hasFocus; returns this */ removeFocus(): this; /** Returns true if this container contains a List component without items, optionally of given type (observable if used in getter); useful as a shortcut in a getter for .hidden on a "blank-slate" block */ hasEmptyList(listComponentClass?: typeof List): boolean; /** Display this container on screen; uses displayOptions to determine position and modality, otherwise fills entire screen by default; returns this */ display(): this; /** Returns an array of directly contained UI components (observable) */ getChildren(): Component[]; private _lastFocused; private _hasFocus; private _hoverState; private _mainWrapper; private _cellWrapper; } export declare namespace Container { /** Container/content vertical alignment options */ enum VertAlign { /** Align container/content at the top */ Top = 0, /** Align container/content in the middle */ Middle = 1, /** Align container/content at the bottom */ Bottom = 2, } } export declare namespace Container { /** Container display horizontal alignment options */ enum HorzAlign { /** Align container to the left */ Left = 0, /** Center the container horizontally */ Center = 1, /** Align container to the right */ Right = 2, } } export declare namespace Container { /** Options to be set on a Container to define its positioning and behavior when displayed using Screen.display */ interface DisplayOptions { /** Set to true to disallow interaction with background components */ modal?: boolean; /** Set to true to add a dark backdrop behind this component */ shade?: boolean; /** Vertical alignment of the container relative to the screen (default top); only has an effect on containers that explicitly set their height to something other than 100% (e.g. DialogContainer, CardContainer) */ vertAlign?: VertAlign; /** Horizontal alignment of the container relative to the screen (default center); only has an effect on containers that explicitly set their width to something other than 100% (e.g. DialogContainer, CardContainer) */ horzAlign?: HorzAlign; /** Margin around component when displayed left, right, top or bottom; (CSS length value) */ margin?: string; /** Callback invoked when the user clicked outside of the container, clicked a modal-close element, or pressed the escape key */ onEsc?: () => void; } } export declare namespace Container { /** Initializer for .with({ ... }) */ interface Initializer extends Component.Initializer { /** Property initializer */ content: ComponentFactory.SpecList2; /** Property initializer */ htmlContent?: ValueOrAsync; /** Property initializer */ vertAlign?: ValueOrAsync; /** Property initializer */ maxContentWidth?: ValueOrAsync; /** Property initializer */ scrollable?: ValueOrAsync; /** Property initializer */ focusFirst?: ValueOrAsync; } } export default Container;