UNPKG

5.29 kBSource Map (JSON)View Raw
1{"version":3,"file":"OverflowSet.types.js","sourceRoot":"../src/","sources":["components/OverflowSet/OverflowSet.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nimport { IFocusZoneProps } from '@fluentui/react-focus';\nimport { IKeytipProps } from '../../Keytip';\nimport { IStyle } from '../../Styling';\nimport { IRefObject, IRenderFunction, IStyleFunctionOrObject } from '../../Utilities';\nimport { OverflowSetBase } from './OverflowSet.base';\n\n/**\n * {@docCategory OverflowSet}\n */\nexport interface IOverflowSet {\n /**\n * Sets focus to the first tabbable item in the zone.\n * @param forceIntoFirstElement - If true, focus will be forced into the first element, even if\n * focus is already in the focus zone.\n * @returns True if focus could be set to an active element, false if no operation was taken.\n */\n focus(forceIntoFirstElement?: boolean): boolean;\n\n /**\n * Sets focus to a specific child element within the zone. This can be used in conjunction with\n * shouldReceiveFocus to created delayed focus scenarios (like animate the scroll position to the correct\n * location and then focus.)\n * @param childElement - The child element within the zone to focus.\n * @returns True if focus could be set to an active element, false if no operation was taken.\n */\n focusElement(childElement?: HTMLElement): boolean;\n}\n\n/**\n * {@docCategory OverflowSet}\n */\nexport interface IOverflowSetProps extends React.ClassAttributes<OverflowSetBase> {\n /**\n * Gets the component ref.\n */\n componentRef?: IRefObject<IOverflowSet>;\n\n /**\n * Class name\n */\n className?: string;\n\n /**\n * An array of items to be rendered by your onRenderItem function in the primary content area\n */\n items?: IOverflowSetItemProps[];\n\n /**\n * Change item layout direction to vertical/stacked.\n * If role is set to `menubar`, `vertical={true}` will also add proper `aria-orientation`.\n * @defaultvalue false\n */\n vertical?: boolean;\n\n /**\n * Controls wether or not the overflow button is placed at the start or end of the items.\n * This gives a reveresed visual behavior but maintains correct keyboard navigation.\n * @defaultValue 'end'\n */\n overflowSide?: 'start' | 'end';\n\n /**\n * An array of items to be passed to overflow contextual menu\n */\n overflowItems?: IOverflowSetItemProps[];\n\n /**\n * Method to call when trying to render an item.\n */\n onRenderItem: (item: IOverflowSetItemProps) => any;\n\n /**\n * Rendering method for overflow button and contextual menu. The argument to the function is\n * the overflowItems passed in as props to this function.\n */\n onRenderOverflowButton: IRenderFunction<any[]>;\n\n /**\n * Custom properties for OverflowSet's FocusZone.\n * If doNotContainWithinFocusZone is set to true focusZoneProps will be ignored.\n * Use one or the other.\n * @deprecated In 8.0 the OverflowSet will no longer be wrapped in a FocusZone\n */\n focusZoneProps?: IFocusZoneProps;\n\n /**\n * If true do not contain the OverflowSet inside of a FocusZone,\n * otherwise the OverflowSet will contain a FocusZone.\n * If this is set to true focusZoneProps will be ignored.\n * Use one or the other.\n * @deprecated In 8.0 the OverflowSet will no longer be wrapped in a FocusZone\n */\n doNotContainWithinFocusZone?: boolean;\n\n /**\n * The role for the OverflowSet.\n * @defaultvalue 'group'\n */\n role?: string;\n\n /**\n * Optional full keytip sequence for the overflow button, if it will have a keytip.\n */\n keytipSequences?: string[];\n\n /**\n * Function that will take in an IOverflowSetItemProps and return the subMenu for that item.\n * If not provided, will use 'item.subMenuProps.items' by default.\n * Alternatively accepts a boolean, return True if the item has a menu and False if not\n * This is only used if your overflow set has keytips.\n */\n itemSubMenuProvider?: (item: IOverflowSetItemProps) => any[] | boolean | undefined;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IOverflowSetProps, IOverflowSetStyles>;\n}\n\n/**\n * {@docCategory OverflowSet}\n */\nexport interface IOverflowSetStyles {\n /** The style that is layered onto the root element of OverflowSet. */\n root?: IStyle;\n /** The style that is layered onto each individual item in the overflow set. */\n item?: IStyle;\n /** The style that is layered onto the overflow button for the overflow set. */\n overflowButton?: IStyle;\n}\n\n/**\n * The props needed to construct styles.\n * This represents the simplified set of immutable things which control the class names.\n * {@docCategory OverflowSet}\n */\nexport type IOverflowSetStyleProps = Pick<IOverflowSetProps, 'vertical' | 'className'>;\n\n/**\n * {@docCategory OverflowSet}\n */\nexport interface IOverflowSetItemProps {\n /**\n * Unique id to identify the item.\n */\n key: string;\n\n /**\n * Optional keytip for the overflowSetItem.\n */\n keytipProps?: IKeytipProps;\n\n /**\n * Any additional properties to use when custom rendering menu items.\n */\n [propertyName: string]: any;\n}\n"]}
\No newline at end of file