@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS
129 lines (120 loc) • 4.65 kB
TypeScript
import { P as PaperProps } from '../../../Paper.types-NMDyV2Rb.js';
export { A as MenuAlternateElevations, E as MenuElevations } from '../../../Paper.types-NMDyV2Rb.js';
import * as react from 'react';
import { AllHTMLAttributes, ReactNode, CSSProperties } from 'react';
import { P as PopoverProps } from '../../../Popover.types-BYrGCnLC.js';
import * as react_jsx_runtime from 'react/jsx-runtime';
import '../../constants.js';
import '@snowball-tech/design-tokens/dist/web/typescript/constants';
import '../../../Typography.constants-DvMtFxBN.js';
import '@radix-ui/react-popover';
declare enum Orientations {
Horizontal = "horizontal",
Vertical = "vertical"
}
declare const DEFAULT_ORIENTATION = Orientations.Vertical;
declare const DEFAULT_ELEVATION = PaperElevations.Elevated;
declare const DEFAULT_SUB_MENU_ELEVATION = PaperElevations.Bordered;
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'];
}
declare const Menu: react.ForwardRefExoticComponent<MenuProps & react.RefAttributes<CombinedRefs>>;
declare const MenuItem: react.ForwardRefExoticComponent<MenuItemProps & react.RefAttributes<HTMLElement | null>>;
declare function MenuItemGroup({ children, condensed, disabled, label, labelElement, rainbow, ...props }: MenuItemGroupProps): react_jsx_runtime.JSX.Element;
declare namespace MenuItemGroup {
var displayName: string;
}
declare function MenuItemSeparator({ ...props }: MenuItemSeparatorProps): react_jsx_runtime.JSX.Element;
declare namespace MenuItemSeparator {
var displayName: string;
}
declare const SubMenu: react.ForwardRefExoticComponent<SubMenuProps & react.RefAttributes<SubMenuCombinedRefs>>;
export { DEFAULT_ELEVATION as DEFAULT_MENU_ELEVATION, DEFAULT_ORIENTATION as DEFAULT_MENU_ORIENTATION, DEFAULT_SUB_MENU_ELEVATION as DEFAULT_MENU_SUB_MENU_ELEVATION, Menu, MenuItem, MenuItemGroup, type MenuItemGroupProps, type MenuItemProps, MenuItemSeparator, type MenuItemSeparatorProps, Orientations as MenuOrientations, type MenuProps, type CombinedRefs as MenuRefs, SubMenu, type SubMenuCombinedRefs as SubMenuRefs };