import { ButtonAppearance, Size } from '../../../types'; import { IconProps } from '../../../components/Icon'; import { ToolbarButtonProps } from './ToolbarButton'; import { ToolbarButtonLinkProps } from './ToolbarButtonLink'; import { ToolbarButtonToggleProps } from './ToolbarButtonToggle'; import { ToolbarSelectProps } from './ToolbarSelect'; /** * Toolbar size options */ export type ToolbarSize = Extract; /** * Toolbar overflow options */ export type ToolbarOverflowTypes = "wrap" | "collapse"; /** * Toolbar item appearance options */ export type ToolbarItemAppearance = Extract; /** * Types of toolbar item */ export type ToolbarItemTypes = "button" | "buttonToggle" | "buttonLink" | "select"; /** * Props for item in the toolbar overflow menu */ export type CombinedToolbarItemProps = ToolbarButtonProps | ToolbarButtonToggleProps | ToolbarButtonLinkProps | ToolbarSelectProps; /** * Props for a toolbar item */ export type ToolbarItemProps = { itemType: ToolbarItemTypes; itemProps: CombinedToolbarItemProps; id?: string; }; /** * TODO: * This should actually be on the Button component itself to enforce the accessibility rules. * This could be a breaking change though, so we should consider moving this to the Button component in the future. * * Generic type that adds accessibility requirements to any base props type. * This enforces proper accessibility for both buttons and toggles. */ export type WithAriaLabelEnforcement = (T & { children?: never; icon: IconProps["svg"] | { before: IconProps["svg"]; } | { after: IconProps["svg"]; }; "aria-label": string; }) | (T & { children: React.ReactNode; "aria-label"?: string; });