UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

48 lines (47 loc) 1.88 kB
import type { MouseEvent as ReactMouseEvent, ReactNode } from 'react'; import type { ListVariant } from './ListContext'; import type { ItemContentProps } from './ItemContent'; import type { IconIcon } from '../icon/Icon'; export type ItemAccordionIconPosition = 'left' | 'right'; export type ItemAccordionProps = { variant?: ListVariant; open?: boolean; /** * When `true`, keeps the accordion content in the DOM when closed. Defaults to `false`. * Default: `false` */ keepInDOM?: boolean; /** * If set to `true`, the accordion is visually dimmed and interaction is prevented. Sets `aria-disabled`, removes tabbing, and disables click/keyboard handlers. * Default: `false` */ disabled?: boolean; /** * Called when the accordion open state changes. Receives an object with the `expanded` state. */ onChange?: (args: { expanded: boolean; }) => void; chevronPosition?: ItemAccordionIconPosition; icon?: IconIcon; title?: ReactNode; id?: string; } & Omit<ItemContentProps, 'title' | 'onChange'>; declare function ItemAccordion(props: ItemAccordionProps): import("react/jsx-runtime").JSX.Element; declare namespace ItemAccordion { var _supportsSpacingProps: boolean; var Header: typeof AccordionHeader; var Content: typeof AccordionContent; } export type AccordionHeaderProps = { onClick?: (event: ReactMouseEvent<HTMLDivElement, MouseEvent>) => void; } & ItemContentProps; declare function AccordionHeader(props: AccordionHeaderProps): import("react/jsx-runtime").JSX.Element; declare namespace AccordionHeader { var _supportsSpacingProps: boolean; } declare function AccordionContent(props: ItemContentProps): import("react/jsx-runtime").JSX.Element; declare namespace AccordionContent { var _supportsSpacingProps: boolean; } export default ItemAccordion;