UNPKG

beta-parity-react

Version:

Beta Parity React Components

256 lines 7.37 kB
import React from 'react'; import { Placement } from '@floating-ui/react'; import './index.css'; import './variables.css'; declare const sizeMap: Record<'sm' | 'md', string>; declare const colorMap: Record<'neutral' | 'accent', string>; declare const prominenceMap: Record<'subtle' | 'pronounced', string>; declare const themeMap: Record<'default' | 'alternative', string>; /** * Props for the Menu component. * * Extends properties from the `div` element. */ export interface MenuProps extends React.HTMLAttributes<HTMLDivElement> { /** * The position of the menu relative to the anchor. * Placements of floating ui react library * * @default 'bottom-start' * @see {@link https://floating-ui.com/docs/tutorial#placements Placement Floating UI} */ position?: Placement; /** * The size of the menu * * @default 'sm' * @memberof MenuProps */ size?: keyof typeof sizeMap; /** * The color of the menu * * @default 'neutral' * @memberof MenuProps */ menuColor?: keyof typeof colorMap; /** * The prominence of the menu, defining its visual hierarchy. * * @default 'subtle' * @memberof MenuProps */ prominence?: keyof typeof prominenceMap; /** * The theme of the menu * * @default 'default' * @memberof MenuProps */ theme?: keyof typeof themeMap; /** * The anchor element or selector to which the menu is attached. * Can be an HTMLElement Ref or a CSS selector string. * * @memberof MenuProps */ anchor?: HTMLElement | string; /** * The maximum number of items before the menu applies overflow behavior. * * @memberof MenuProps */ menuItemsLimit?: number; /** * Whether to show scroll indicators when the menu is scrollable. * * @default false * @memberof MenuProps */ scrollIndicator?: boolean; /** * Whether the menu includes a search input for filtering items. * * @default false * @memberof MenuProps */ searchable?: boolean; /** * The default value for the search input when the menu is rendered. * * @memberof MenuProps */ defaultSearch?: string; /** * The placeholder text for the search input. * * @memberof MenuProps */ searchPlaceholder?: string; /** * The text displayed when no results are found in the menu search. * * @memberof MenuProps */ noResultsText?: string; /** * Whether the menu is rendered using a portal (outside of the DOM hierarchy of its parent). * * @memberof MenuProps */ usePortal?: boolean; /** * Whether the menu is open. * * @default false * @memberof MenuProps */ isOpen?: boolean; /** * Whether the menu is in a loading state, typically showing a loading indicator. * * @default false * @memberof MenuProps */ isLoading?: boolean; /** * Whether the menu is disabled and cannot be interacted with. * * @default false * @memberof MenuProps */ disabled?: boolean; /** * Callback function invoked when the menu is opened. * * @memberof MenuProps */ onOpen?: () => void; /** * Callback function invoked when the menu is closed. * * @memberof MenuProps */ onClose?: () => void; } /** * **Parity Menu**. * * @see {@link https://beta-parity-react.vercel.app/menu Parity Menu} */ export declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLDivElement>>; /** * Props for the MenuItem component. * * Extends properties from the `div` or `label` element. */ export interface MenuItemProps extends Omit<React.HTMLAttributes<HTMLDivElement | HTMLLabelElement>, 'onChange'> { /** * Whether the menu item is in a loading state. */ isLoading?: boolean; /** * Whether the menu item is disabled. */ disabled?: boolean; /** * The value of the menu item. */ value?: string; /** * The label of the menu item. */ label?: string; /** * The position of the checkmark, either left or right. */ checkmarkSide?: 'left' | 'right'; /** * The color of the menu item. */ color?: keyof typeof colorMap; /** * The prominence level of the menu item. */ prominence?: keyof typeof prominenceMap; /** * Whether the menu item is checked. */ checked?: boolean; /** * An optional icon for the menu item. */ icon?: React.ReactNode; /** * The name attribute of the menu item (for form usage). */ name?: string; /** * Whether multiple selections are allowed. */ multiselect?: boolean; /** * Whether the menu item can be deselected. */ deselectable?: boolean; /** * Whether the menu item uses an input element. */ useInput?: boolean; /** * Change event handler for the menu item. */ onChange?: (({ value, checked }: { value: string | number; checked: boolean; }) => void) | ((e: React.ChangeEvent<HTMLInputElement>) => void); } /** * **Parity MenuItem**. * * @see {@link https://beta-parity-react.vercel.app/menu Parity MenuItem} */ export declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement | HTMLLabelElement>>; export interface MenuTriggerProps extends React.HTMLAttributes<HTMLButtonElement> { } /** * **Parity MenuTrigger**. * * @see {@link https://beta-parity-react.vercel.app/menu Parity MenuTrigger} */ export declare const MenuTrigger: React.ForwardRefExoticComponent<MenuTriggerProps & React.RefAttributes<HTMLButtonElement>>; export interface MenuHeaderProps extends React.HTMLAttributes<HTMLDivElement> { } /** * **Parity MenuHeader**. * * @see {@link https://beta-parity-react.vercel.app/menu Parity MenuHeader} */ export declare const MenuHeader: React.ForwardRefExoticComponent<MenuHeaderProps & React.RefAttributes<HTMLDivElement>>; export interface MenuFooterProps extends React.HTMLAttributes<HTMLDivElement> { } /** * **Parity MenuFooter**. * * @see {@link https://beta-parity-react.vercel.app/menu Parity MenuFooter} */ export declare const MenuFooter: React.ForwardRefExoticComponent<MenuFooterProps & React.RefAttributes<HTMLDivElement>>; export interface MenuIndicatorProps extends React.HTMLAttributes<HTMLButtonElement> { position: 'top' | 'bottom'; isActive: boolean; onClick: () => void; className?: string; disabled?: boolean; } export declare const MenuIndicator: React.ForwardRefExoticComponent<MenuIndicatorProps & React.RefAttributes<HTMLButtonElement>>; export interface MenuDividerProps extends React.HTMLAttributes<HTMLDivElement> { isLoading?: boolean; disabled?: boolean; } export declare const MenuDivider: React.ForwardRefExoticComponent<MenuDividerProps & React.RefAttributes<HTMLDivElement>>; export interface MenuGroupProps extends React.HTMLAttributes<HTMLDivElement> { groupLabel: string; } export declare const MenuGroup: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>; export {}; //# sourceMappingURL=index.d.ts.map