UNPKG

@snowball-tech/fractal

Version:

Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS

103 lines (100 loc) 3.16 kB
import { AllHTMLAttributes, ReactNode, CSSProperties } from 'react'; import { PaperProps } from '../Paper/Paper.types.js'; import { PopoverProps } from '../Popover/Popover.types.js'; import { Orientations } from './Menu.constants.js'; import '../constants-QFINMz1u.js'; import '../Paper/Paper.constants.js'; import '../Typography/Typography.constants.js'; import '@radix-ui/react-popover'; type CombinedRefs = { container: HTMLDivElement | null; menu: HTMLDivElement | null; }; type SubMenuCombinedRefs = { content: HTMLDivElement | null; trigger: HTMLDivElement | null; }; interface MenuProps extends AllHTMLAttributes<HTMLDivElement> { children: ReactNode; condensed?: boolean; disabled?: boolean; elevation?: PaperProps['elevation']; embedded?: boolean; fullWidth?: boolean; menu?: { className?: string; style?: CSSProperties; }; orientation?: `${Orientations}`; rainbow?: boolean; } interface MenuItemProps extends Omit<AllHTMLAttributes<HTMLDivElement>, 'label'> { active?: boolean; children?: ReactNode; condensed?: boolean; disabled?: boolean; href?: string; icon?: ReactNode; label?: ReactNode; rainbow?: boolean; target?: HTMLAnchorElement['target']; onActivate?: () => void; } interface MenuItemGroupProps extends Omit<AllHTMLAttributes<HTMLDivElement>, 'label'> { children: ReactNode; label: ReactNode; condensed?: boolean; disabled?: boolean; labelElement?: keyof HTMLElementTagNameMap; rainbow?: boolean; } type MenuItemSeparatorProps = AllHTMLAttributes<HTMLDivElement>; interface SubMenuProps extends Omit<AllHTMLAttributes<HTMLDivElement>, 'content' | 'label' | 'popover'> { children: ReactNode; active?: boolean; align?: PopoverProps['align']; condensed?: boolean; condensedItems?: boolean; defaultOpen?: boolean; disabled?: boolean; elevation?: PaperProps['elevation']; icon?: ReactNode; label?: ReactNode; labelElement?: keyof HTMLElementTagNameMap; open?: boolean; popover?: boolean; popup?: { className?: string; content?: { className?: string; positionner?: { className?: string; style?: CSSProperties; }; style?: CSSProperties; wrapper?: { className?: string; style?: CSSProperties; }; }; style?: CSSProperties; trigger?: { className?: string; style?: CSSProperties; wrapper?: { className?: string; style?: CSSProperties; }; }; }; rainbow?: boolean; side?: PopoverProps['side']; triggerOnHover?: boolean; withIndicator?: boolean; withScroll?: boolean; onClose?: () => void; onInteractOutside?: PopoverProps['onInteractOutside']; onOpen?: () => void; onSubMenuOpenChange?: PopoverProps['onOpenChange']; } export type { CombinedRefs, MenuItemGroupProps, MenuItemProps, MenuItemSeparatorProps, MenuProps, SubMenuCombinedRefs, SubMenuProps };