UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

59 lines (58 loc) 2.14 kB
/** * MSKCC DSM 2021, 2023 */ import React, { type WeakValidationMap, type ElementType } from 'react'; import { type PolymorphicProps } from '../../types/common'; export type PopoverAlignment = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top'; interface PopoverBaseProps { /** * Specify how the popover should align with the trigger element */ align?: PopoverAlignment; /** * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes. */ autoAlign?: boolean; /** * Specify whether a caret should be rendered */ caret?: boolean; /** * Provide elements to be rendered inside of the component */ children?: React.ReactNode; /** * Provide a custom class name to be added to the outermost node in the * component */ className?: string; /** * Specify whether a drop shadow should be rendered on the popover */ dropShadow?: boolean; /** * Render the component using the high-contrast variant */ highContrast?: boolean; /** * Render the component using the tab tip variant */ isTabTip?: boolean; /** * Specify a handler for closing popover. * The handler should take care of closing the popover, e.g. changing the `open` prop. */ onRequestClose?: () => void; /** * Specify whether the component is currently open or closed */ open: boolean; } export type PopoverProps<E extends ElementType> = PolymorphicProps<E, PopoverBaseProps>; export declare const Popover: (<E extends React.ElementType<any> = "span">(props: PopoverProps<E>) => JSX.Element) & { displayName?: string | undefined; propTypes?: WeakValidationMap<PopoverProps<any>> | undefined; }; export type PopoverContentProps = React.HTMLAttributes<HTMLSpanElement>; export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLSpanElement>>; export {};