UNPKG

@arcgis/map-components

Version:
229 lines (228 loc) • 9.87 kB
/// <reference path="../../index.d.ts" /> import type LinkChartView from "@arcgis/core/views/LinkChartView.js"; import type MapView from "@arcgis/core/views/MapView.js"; import type SceneView from "@arcgis/core/views/SceneView.js"; import type { ArcgisReferenceElement, IconName } from "../types.js"; import type { PublicLitElement as LitElement } from "@arcgis/lumina"; import type { T9nMeta } from "@arcgis/lumina/controllers"; import type { ExpandState } from "./types.js"; import type { Panel as Panel } from "@esri/calcite-components/components/calcite-panel"; import type { Action as Action } from "@esri/calcite-components/components/calcite-action"; /** * Expand acts as a clickable button for displaying interactive content, most commonly other components. * * @see [Samples with the Expand component](https://developers.arcgis.com/javascript/latest/sample-code/?tagged=arcgis-expand) * @since 4.28 * @example * ```html * <arcgis-map item-id="45b3b2fb35e94ab09381d0caa0da5946"> * <arcgis-expand slot="top-right"> * <arcgis-layer-list></arcgis-layer-list> * </arcgis-expand> * </arcgis-map> * ``` */ export abstract class ArcgisExpand extends LitElement { /** * Automatically collapses the Expand component when the * [viewpoint](https://developers.arcgis.com/javascript/latest/references/core/views/View/#viewpoint) updates. * * @default false */ accessor autoCollapse: boolean; /** * If true, the component will not be destroyed automatically when it is * disconnected from the document. This is useful when you want to move the * component to a different place on the page, or temporarily hide it. If this * is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-expand/#destroy) method when you are done to * prevent memory leaks. * * @default false */ accessor autoDestroyDisabled: boolean; /** * When `true`, the Expand component will not close itself if the Escape key is pressed while its content has keyboard focus. * This property can also be set to a function that returns a boolean, allowing for more customization for when to allow the * Expand component to be closed via the Escape key. * * @default false * @since 4.34 * @example * ```html * <arcgis-expand slot="top-right" close-on-esc-disabled> * <arcgis-search></arcgis-search> * </arcgis-expand> * ``` * @example * ```html * <arcgis-expand slot="top-right"> * <arcgis-search></arcgis-search> * </arcgis-expand> * * <script> * const expandElement = document.querySelector("arcgis-expand"); * const searchElement = document.querySelector("arcgis-search"); * // don't close the expand if the search is active * expandElement.closeOnEscDisabled = () => searchElement.activeMenu !== "none"; * </script> * ``` */ accessor closeOnEscDisabled: boolean | ((event: KeyboardEvent) => boolean); /** * Calcite icon used to style the Expand when it can be collapsed. * * @default "chevrons-right" * @see [Calcite Icon Search](https://developers.arcgis.com/calcite-design-system/icons/) */ get collapseIcon(): IconName; set collapseIcon(value: IconName | null | undefined); /** * Tooltip to display to indicate the Expand can be collapsed. * * @default "Collapse" (English locale) */ accessor collapseTooltip: string; /** * Indicates whether the component is currently expanded or not. * * @default false */ accessor expanded: boolean; /** * Calcite icon used to style the Expand when it can be expanded. * The component will automatically use the icon of the component placed within the Expand if it has one. * * @default "chevrons-left" * @see [Calcite Icon Search](https://developers.arcgis.com/calcite-design-system/icons/) */ accessor expandIcon: IconName | null | undefined; /** * Tooltip to display to indicate Expand can be expanded. * * @default "Expand" (English locale) */ accessor expandTooltip: string; /** * Whether the user's keyboard focus should be trapped in the expanded panel state. If `true`, tabbing * forward or backward will cycle through elements only within the panel content. * * @default false */ accessor focusTrapDisabled: boolean; /** * This value associates two or more Expand components with each other, allowing one * component to auto collapse when another in the same group is expanded. For auto collapsing * to take effect, all components in the group must be included in the same Map, Scene, or Link Chart component. * * For example, if you place multiple Expand components in the `top-left` slot of the Map, you can assign them to a * group called `top-left`. If one Expand component is expanded and the user clicks on a different component in the * `top-left` group, then the first component is collapsed, allowing the content of the second component to be * fully visible. * * @example * ```html * <arcgis-map basemap="topo-vector"> * <arcgis-expand slot="top-left" group="top-left" expanded> * <arcgis-layer-list></arcgis-layer-list> * </arcgis-expand> * <arcgis-expand slot="top-left" group="top-left"> * <arcgis-basemap-gallery></arcgis-basemap-gallery> * </arcgis-expand> * </arcgis-map> */ accessor group: string | undefined; /** * A number to display at the corner of the component to indicate the number of, for example, open issues or unread notices. * * ![expand component icon number](https://developers.arcgis.com/javascript/latest/assets/img/apiref/widgets/expand-with-iconnumber.avif) * * @default 0 */ accessor iconNumber: number; /** The component's default label. */ accessor label: string | undefined; /** * Replace localized message strings with your own strings. * * _**Note**: Individual message keys may change between releases._ * * @since 4.34 */ accessor messageOverrides: { expand?: string | undefined; collapse?: string | undefined; }; /** @internal */ protected messages: Partial<{ expand: string; collapse: string; }> & T9nMeta<{ expand: string; collapse: string; }>; /** * The mode in which the component displays. These modes are listed below: * * - `auto`: This is the default mode. It is responsive to browser size changes and will update based on whether the component is viewed in a desktop or mobile application. * - `floating`: Use this mode if you wish to always display the component as floating in a [Calcite Popover component](https://developers.arcgis.com/calcite-design-system/components/popover/) regardless of browser size. * - `drawer`: Use this mode if you wish to always display the component in a [Calcite Sheet component](https://developers.arcgis.com/calcite-design-system/components/sheet/) regardless of browser size. * * @default "auto" */ accessor mode: "auto" | "drawer" | "floating"; /** * The placement used by the [Calcite Popover](https://developers.arcgis.com/calcite-design-system/components/popover/) when the component is expanded. * This property has no effect when the component is in `drawer` mode. */ accessor placement: Panel["menuPlacement"] | undefined; /** * By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene. * * @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component) */ accessor referenceElement: ArcgisReferenceElement | string | undefined; /** * The current state of the component. * * @default "disabled" * @since 4.34 */ get state(): ExpandState; /** * When true, disables rendering in the top layer (above overlays and modals). * This can be useful for controlling stacking context in complex UI layouts. * * @default false * @since 5.0 */ accessor topLayerDisabled: boolean; /** * The view associated with the component. * > **Note:** The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this `view` property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-expand component will be associated with a map or scene component rather than using the `view` property. */ accessor view: LinkChartView | MapView | SceneView | null | undefined; /** * Specifies the size of the component. * * @default "m" * @since 5.0 */ accessor visualScale: Action["scale"]; /** Collapse the component. */ collapse(): Promise<void>; /** Permanently destroy the component. */ destroy(): Promise<void>; /** Expand the component. */ expand(): Promise<void>; "@setterTypes": { collapseIcon?: IconName | null | undefined; }; /** Emitted when the value of a property is changed. Use this to listen to changes to properties. */ readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "expanded"; }>; /** Emitted when the component associated with a map or scene view is ready to be interacted with. */ readonly arcgisReady: import("@arcgis/lumina").TargetedEvent<this, void>; readonly "@eventTypes": { arcgisPropertyChange: ArcgisExpand["arcgisPropertyChange"]["detail"]; arcgisReady: ArcgisExpand["arcgisReady"]["detail"]; }; }