import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["button"] & SvelteHTMLElements["div"]; type $Props = { /** * Set to `true` to expand the tile. * @default false */ expanded?: boolean; /** * Specify the collapsed height of the above-the-fold content (number of * pixels). Overrides the measured height when greater than 0. * @default 0 */ tileMaxHeight?: number; /** * Specify the vertical padding of the tile (number of pixels). * Overrides the measured padding when greater than 0. * @default 0 */ tilePadding?: number; /** * Specify the icon text of the collapsed tile * @default "Interact to expand Tile" */ tileCollapsedIconText?: string; /** * Specify the icon text of the expanded tile * @default "Interact to collapse Tile" */ tileExpandedIconText?: string; /** * Specify the icon label of the expanded tile * @default "" */ tileExpandedLabel?: string; /** * Specify the icon label of the collapsed tile * @default "" */ tileCollapsedLabel?: string; /** * Set to `true` to round the tile's corners when it has a `decorator`, * such as an `AILabel`. Carbon reserves rounded tiles for AI content. * @default false */ rounded?: boolean; /** * Specify the tabindex of the toggle: the tile itself, or the * chevron button when the tile has interactive content. * @default "0" */ tabindex?: number | string | undefined; /** * Set an id for the top-level element * @default uniqueId() */ id?: string; /** * Set to `true` if the tile contains interactive content, such as links, * buttons, or inputs. The tile renders a `div` instead of a `button` to * avoid invalid HTML nesting, and the chevron button becomes the toggle. * By default, the tile looks for interactive content once it mounts and * switches then. Set to `true` to render the `div` from the start, such * as on the server, or `false` to keep the `button` without looking. */ hasInteractiveContent?: boolean | undefined; /** * Obtain a reference to the top-level element. * @default null */ ref?: null | HTMLElement; above?: (this: void) => void; below?: (this: void) => void; decorator?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type ExpandableTileProps = Omit<$RestProps, keyof $Props> & $Props; export default class ExpandableTile extends SvelteComponentTyped< ExpandableTileProps, { blur: WindowEventMap["blur"]; click: WindowEventMap["click"]; focus: WindowEventMap["focus"]; keydown: WindowEventMap["keydown"]; keypress: WindowEventMap["keypress"]; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; /** Dispatched with the next expanded state when the user toggles the tile. Call `preventDefault()` to keep the current state. */ toggle: CustomEvent<{ expanded: boolean }>; }, { above: Record; below: Record; decorator: Record; } > {}