import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type CarbonModalContext = Record; export type CarbonLayerContext = import("svelte/store").Readable; export type CarbonSectionContext = import("svelte/store").Writable; type $RestProps = SvelteHTMLElements["div"] & SvelteHTMLElements["aside"]; type $Props = { /** * Set to `true` to open the panel. Opening it moves focus into it; a * panel already open when it mounts leaves focus where it is, unless it * is modal. * @default false */ open?: boolean; /** * Set the panel width. * @default "md" */ size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl"; /** * Set the edge the panel docks to. `"end"` is the right edge in a * left-to-right layout and the left edge in a right-to-left one. * Also accepts Carbon React's `"right"` and `"left"`, which map to * `"end"` and `"start"`. * @default "end" */ placement?: "start" | "end" | "left" | "right"; /** * Set to `true` to push the page content aside instead of covering it. * Set `selectorPageContent` to the element to push. A slide-in panel * does not move focus, trap it, or close on Escape. * @default false */ slideIn?: boolean; /** * Specify a CSS selector for the page content that a `slideIn` panel * pushes aside. Without a match, the panel covers the content. */ selectorPageContent?: string | undefined; /** * Set to `true` to dim the page behind the panel. The panel is then * modal: it traps focus and locks page scroll. Has no effect when * `slideIn` is `true`. * @default false */ includeOverlay?: boolean; /** * Control whether clicking the overlay closes the panel. * By default, a panel without `actions` closes and a panel with * `actions` stays open, as modals do in Carbon v11. * Set to `true` to always keep the panel open, or `false` to always * close it. */ preventCloseOnClickOutside?: boolean | undefined; /** * Specify the title. It names the panel. A `title` attribute passes * through to the panel element. */ titleText?: string | undefined; /** * Specify the subtitle. It describes the panel. */ subtitleText?: string | undefined; /** * Specify a label above the title. Renders only with a `titleText`. */ labelText?: string | undefined; /** * Set to `true` to hide the close button * @default false */ hideCloseButton?: boolean; /** * Specify the close button's accessible name * @default "Close" */ closeIconDescription?: string; /** * Specify the step of a multi-step panel. A step greater than `0` * shows a back button, which fires `back`. * @default 0 */ currentStep?: number; /** * Specify the back button's accessible name * @default "Back" */ navigationBackIconDescription?: string; /** * Set to `true` for 48px footer buttons instead of 64px * @default false */ condensedActions?: boolean; /** * Set to `true` to let the user resize the panel by dragging its free * edge, or with the arrow keys once the edge has focus. The handle * hides below the `md` breakpoint. * @default false */ resizable?: boolean; /** * The width in pixels the user resized the panel to, or `undefined` to * follow `size`. Rendered clamped between the `xs` width and 75% of the * window. Has no effect unless `resizable` is `true`. */ width?: number | undefined; /** * Specify the ARIA label for the resize handle * @default "Resize side panel" */ resizeHandleLabel?: string; /** * Specify the delay in milliseconds before hovering the resize handle * highlights it and shows the resize cursor. * @default 150 */ resizeEnterDelayMs?: number; /** * Specify a selector for the element to focus when the panel opens. * Without a match, focus goes to the first form field, then the close * button. Set to `null` to leave focus where it is. A `slideIn` panel * focuses only a match. * @default "[data-modal-primary-focus]" */ selectorPrimaryFocus?: null | string; /** * Set an id for the panel. * The title and subtitle ids derive from it as `{id}-title` and * `{id}-subtitle`. * @default uniqueId() */ id?: string; /** * Obtain a reference to the panel element. * @default null */ ref?: null | HTMLElement; /** Footer buttons. The panel lays them out in an `ActionSet` sized to the panel. */ actions?: (this: void) => void; /** An `AILabel`, beside the close button. */ decorator?: (this: void) => void; /** Rich subtitle content. Overrides `subtitleText`. */ subtitleChildren?: (this: void) => void; /** Buttons in the header's action toolbar, below the title. */ toolbar?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type SidePanelProps = Omit<$RestProps, keyof $Props> & $Props; export default class SidePanel extends SvelteComponentTyped< SidePanelProps, { /** Fires when the back button is clicked. It shows while `currentStep` is greater than `0`. */ back: CustomEvent; close: CustomEvent<{ trigger: "escape-key" | "outside-click" | "close-button" | "programmatic"; }>; keydown: WindowEventMap["keydown"]; open: CustomEvent; /** Fires once the user finishes resizing (drag release, key press or double click) and the width changed. `width` is `undefined` after a double click restores the `size` width. */ resize: CustomEvent<{ width: number | undefined }>; }, { default: Record; /** Footer buttons. The panel lays them out in an `ActionSet` sized to the panel. */ actions: Record; /** An `AILabel`, beside the close button. */ decorator: Record; /** Rich subtitle content. Overrides `subtitleText`. */ subtitleChildren: Record; /** Buttons in the header's action toolbar, below the title. */ toolbar: Record; } > {}