import React from 'react'; import { ComponentProps } from '../utils/types'; type ItemFocusHandler = (event: React.FocusEvent, data: { itemKey?: number; }) => void; interface ItemPropsBase { /** * Active shows a temporarily selected state, similar to that of focus. This is used when filtering the * `Menu` items in Multiselect, Select, and ComboBox and when navigating with arrows. */ active?: boolean; /** Becomes the label. Must be a string if using `matchRanges`. */ children?: React.ReactNode; /** * Additional information to explain the option. */ description?: string; /** * The description text might appear to the right of the label or under the label. */ descriptionPosition?: 'right' | 'bottom'; /** * Prevents user interaction and adds disabled styling. * If set to `dimmed`, the component is able to be focused, and is more easily located. * If set to `disabled`, the disabled attribute is set which makes the component unable to be focused and more difficult to locate. * The default behavior when `disabled={true}` is `dimmed`. */ disabled?: boolean | 'dimmed' | 'disabled'; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** Adornment after the label. */ endAdornment?: React.ReactNode; /** * Adds an icon to the right to show that there is a submenu. To implement submenus, use the `SlidingPanels` component. */ hasSubmenu?: boolean; /** * @private. The internal key of the item */ itemKey?: number; /** * Sections of the label string to highlight as a match. */ matchRanges?: { start: number; end: number; }[]; /** * Callback for click events. */ onClick?: React.MouseEventHandler; onFocus?: ItemFocusHandler; /** * Open the "to" link in a new context, which is usually a new tab or window based on browser settings. * * An icon and a screen reader message is added to indicate this behavior to users. * The default message is "(Opens new window)"; this can be customized by passing * a string instead of boolean to `openInNewContext`. */ openInNewContext?: boolean | string; /** * @private * Prevents the element from becoming focused. Used to keep the focus inside the filter box * in ,