import { default as React } from 'react'; import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types.js'; export type StickySlots = 'root' | 'placeholder' | 'content'; export interface StickyProps extends HtmlProps { children?: React.ReactNode; /** Distance (px) from the top of the viewport the content sticks to. Default 0. Ignored if `offsetElement` is set. */ offsetTop?: number; /** Element (e.g. a pinned header) to stick below instead of a fixed `offsetTop` — its live height is used as the offset. */ offsetElement?: React.RefObject; /** Stick to the top of the nearest scrollable ancestor instead of the browser viewport. Falls back to the viewport if no scrollable ancestor is found. */ stickToScrollParent?: boolean; /** * Element the content is confined to, normally the one it labels. Once that * element's bottom edge reaches the pinned content, the content is pushed up * with it and scrolls away, instead of staying pinned over whatever follows. * Without it the content pins for as long as the page scrolls. */ boundary?: React.RefObject; /** * How much of the boundary's lower end stays uncovered as the content leaves, * in px. At 0 the content rests on the very bottom edge, which means the last * stretch of the boundary, as tall as the pinned content, spends the whole * exit hidden underneath it. Set it to how much you want to stay in sight: * for a table header, a few rows. Default 0. Ignored without `boundary`. */ boundaryInset?: number; /** z-index applied to the content while stuck. Default 20. */ zIndex?: number; /** Disable sticking entirely — content stays in normal flow. */ disabled?: boolean; /** Fired whenever the stuck state flips. */ onStuckChange?: (isStuck: boolean) => void; className?: string; style?: React.CSSProperties; classNames?: SlotClassNames; styles?: SlotStyles; }