import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type CarbonTableOfContentsContext = { selectedId: import("svelte/store").Writable; register: (item: { id: string; node: HTMLElement }) => () => void; select: (id: string, event: MouseEvent) => void; registerGroup: () => void; }; type $RestProps = SvelteHTMLElements["nav"]; type $Props = { /** * Specify the id of the active section. * Tracks the scroll position unless `noScrollSpy` is `true`. */ selectedId?: string | undefined; /** * Set to `true` to stop updating `selectedId` from the scroll position. * Clicking an item still selects it. * @default false */ noScrollSpy?: boolean; /** * Specify the distance in pixels from the top of the scroll container at * which a section becomes active. Match the height of a sticky header. * Defaults to the scroll container's `scroll-padding-top`, where a native * hash jump lands a section. */ scrollOffset?: number | undefined; /** * Specify where a section becomes active, as a fraction of the scroll * container's visible height below `scrollOffset`: `0` when the section's * top reaches the top, `0.5` when it reaches the middle, `1` as soon as it * scrolls into view. * @default 0 */ activationLine?: number; /** * Specify the element that scrolls the sections. * Defaults to the window. * @default null */ scrollContainer?: HTMLElement | null; /** * Specify the row size. * @default "md" */ size?: "sm" | "md"; /** * Specify the ARIA label for the nav * @default "Table of contents" */ labelText?: string; /** * Obtain a reference to the nav HTML element. * @default null */ ref?: null | HTMLElement; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type TableOfContentsProps = Omit<$RestProps, keyof $Props> & $Props; export default class TableOfContents extends SvelteComponentTyped< TableOfContentsProps, { change: CustomEvent }, { default: Record } > {}