office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
1,314 lines (1,251 loc) • 695 kB
TypeScript
import { BaseComponent } from '@uifabric/utilities';
import { EventGroup } from '@uifabric/utilities';
import { IBaseProps } from '@uifabric/utilities';
import { IComponent } from '@uifabric/foundation';
import { IComponentAs } from '@uifabric/utilities';
import { IComponentStyles } from '@uifabric/foundation';
import { ICSSPixelUnitRule } from '@uifabric/merge-styles/lib/IRawStyleBase';
import { ICSSRule } from '@uifabric/merge-styles/lib/IRawStyleBase';
import { IFontStyles } from '@uifabric/styling';
import { IHTMLSlot } from '@uifabric/foundation';
import { IObjectWithKey } from '@uifabric/utilities';
import { IPoint } from '@uifabric/utilities';
import { IRawStyle } from '@uifabric/styling';
import { IRectangle } from '@uifabric/utilities';
import { IRefObject } from '@uifabric/utilities';
import { IRenderComponent } from '@uifabric/utilities';
import { IRenderFunction } from '@uifabric/utilities';
import { ISelection } from '@uifabric/utilities';
import { ISelectionOptions } from '@uifabric/utilities';
import { ISlotProp } from '@uifabric/foundation';
import { ISlottableProps } from '@uifabric/foundation';
import { IStyle } from '@uifabric/styling';
import { IStyleableComponentProps } from '@uifabric/foundation';
import { IStyleFunction } from '@uifabric/utilities';
import { IStyleFunctionOrObject } from '@uifabric/utilities';
import { IStyleSet } from '@uifabric/styling';
import { ITheme } from '@uifabric/styling';
import { KeyCodes } from '@uifabric/utilities';
import { Omit } from '@uifabric/utilities';
import * as PropTypes from 'prop-types';
import * as React from 'react';
import { Selection } from '@uifabric/utilities';
import { SELECTION_CHANGE } from '@uifabric/utilities';
import { SelectionDirection } from '@uifabric/utilities';
import { SelectionMode } from '@uifabric/utilities';
/**
* {@docCategory Button}
*/
export declare class ActionButton extends BaseComponent<IButtonProps, {}> {
/**
* Tell BaseComponent to bypass resolution of componentRef.
*/
protected _skipComponentRefResolution: boolean;
render(): JSX.Element;
}
/**
* {@docCategory ActivityItem}
*/
export declare class ActivityItem extends React.Component<IActivityItemProps, {}> {
constructor(props: IActivityItemProps);
render(): JSX.Element;
private _onRenderIcon;
private _onRenderActivityDescription;
private _onRenderComments;
private _onRenderTimeStamp;
private _onRenderPersonaArray;
private _getClassNames;
}
/**
* Defines a type made by the union of the different values that the align-items and justify-content flexbox
* properties can take.
* {@docCategory Stack}
*/
export declare type Alignment = 'start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'baseline' | 'stretch';
export declare const Announced: React.StatelessComponent<IAnnouncedProps>;
/**
* {@docCategory Announced}
*/
export declare class AnnouncedBase extends React.Component<IAnnouncedProps> {
static defaultProps: Partial<IAnnouncedProps>;
render(): JSX.Element;
}
/**
* {@docCategory Autofill}
*/
export declare class Autofill extends BaseComponent<IAutofillProps, IAutofillState> implements IAutofill {
static defaultProps: {
enableAutofillOnKeyPress: number[];
};
private _inputElement;
private _autoFillEnabled;
private _value;
private _isComposing;
constructor(props: IAutofillProps);
readonly cursorLocation: number | null;
readonly isValueSelected: boolean;
readonly value: string;
readonly selectionStart: number | null;
readonly selectionEnd: number | null;
readonly inputElement: HTMLInputElement | null;
UNSAFE_componentWillReceiveProps(nextProps: IAutofillProps): void;
componentDidUpdate(): void;
render(): JSX.Element;
focus(): void;
clear(): void;
private _onCompositionStart;
private _onCompositionUpdate;
private _onCompositionEnd;
private _onClick;
private _onKeyDown;
private _onInputChanged;
private _onChanged;
private _getCurrentInputValue;
/**
* Attempts to enable autofill. Whether or not autofill is enabled depends on the input value,
* whether or not any text is selected, and only if the new input value is longer than the old input value.
* Autofill should never be set to true if the value is composing. Once compositionEnd is called, then
* it should be completed.
* See https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent for more information on composition.
* @param newValue - new input value
* @param oldValue - old input value
* @param isComposing - if true then the text is actively being composed and it has not completed.
* @param isComposed - if the text is a composed text value.
*/
private _tryEnableAutofill;
private _notifyInputChange;
/**
* Updates the current input value as well as getting a new display value.
* @param newValue - The new value from the input
*/
private _updateValue;
/**
* Returns a string that should be used as the display value.
* It evaluates this based on whether or not the suggested value starts with the input value
* and whether or not autofill is enabled.
* @param inputValue - the value that the input currently has.
* @param suggestedDisplayValue - the possible full value
*/
private _getDisplayValue;
private _doesTextStartWith;
}
/**
* @deprecated do not use.
* {@docCategory Autofill}
*/
export declare class BaseAutoFill extends Autofill {
}
/**
* {@docCategory Button}
*/
export declare class BaseButton extends BaseComponent<IBaseButtonProps, IBaseButtonState> implements IButton {
private readonly _isSplitButton;
static defaultProps: Partial<IBaseButtonProps>;
private _buttonElement;
private _splitButtonContainer;
private _labelId;
private _descriptionId;
private _ariaDescriptionId;
private _classNames;
private _processingTouch;
private _lastTouchTimeoutId;
private _renderedVisibleMenu;
private _menuShouldFocusOnContainer;
private _menuShouldFocusOnMount;
private _getMemoizedMenuButtonKeytipProps;
constructor(props: IBaseButtonProps, rootClassName: string);
render(): JSX.Element;
componentDidMount(): void;
componentDidUpdate(prevProps: IBaseButtonProps, prevState: IBaseButtonState): void;
focus(): void;
dismissMenu(): void;
openMenu(shouldFocusOnContainer?: boolean, shouldFocusOnMount?: boolean): void;
private _onRenderContent;
/**
* Method to help determine if the menu's component tree should
* be rendered. It takes into account whether the menu is expanded,
* whether it is a persisted menu and whether it has been shown to the user.
*/
private _shouldRenderMenu;
private _onRenderIcon;
private _onRenderTextContents;
private _onRenderText;
private _hasText;
private _onRenderChildren;
private _onRenderDescription;
private _onRenderAriaDescription;
private _onRenderMenuIcon;
private _onRenderMenu;
private _onDismissMenu;
private _dismissMenu;
private _openMenu;
private _onToggleMenu;
private _onRenderSplitButtonContent;
private _onSplitContainerFocusCapture;
private _onSplitButtonPrimaryClick;
private _onRenderSplitButtonDivider;
private _onRenderSplitButtonMenuButton;
private _onKeyDown;
private _onKeyUp;
private _onKeyPress;
private _onMouseUp;
private _onMouseDown;
private _onClick;
private _onSplitButtonContainerKeyDown;
private _onMenuKeyDown;
private _onTouchStart;
private _onPointerDown;
private _handleTouchAndPointerEvent;
/**
* Returns if the user hits a valid keyboard key to open the menu
* @param ev - the keyboard event
* @returns True if user clicks on custom trigger key if enabled or alt + down arrow if not. False otherwise.
*/
private _isValidMenuOpenKey;
private _onMenuClick;
}
/**
* {@docCategory ExtendedPeoplePicker}
*/
export declare class BaseExtendedPeoplePicker extends BaseExtendedPicker<IPersonaProps, IExtendedPeoplePickerProps> {
}
export declare class BaseExtendedPicker<T, P extends IBaseExtendedPickerProps<T>> extends BaseComponent<P, IBaseExtendedPickerState<T>> implements IBaseExtendedPicker<T> {
floatingPicker: React.RefObject<BaseFloatingPicker<T, IBaseFloatingPickerProps<T>>>;
selectedItemsList: React.RefObject<BaseSelectedItemsList<T, IBaseSelectedItemsListProps<T>>>;
protected root: React.RefObject<HTMLDivElement>;
protected input: React.RefObject<Autofill>;
protected selection: Selection;
protected floatingPickerProps: IBaseFloatingPickerProps<T>;
protected selectedItemsListProps: IBaseSelectedItemsListProps<T>;
constructor(basePickerProps: P);
readonly items: any;
componentDidMount(): void;
UNSAFE_componentWillReceiveProps(newProps: P): void;
focus(): void;
clearInput(): void;
readonly inputElement: HTMLInputElement | null;
readonly highlightedItems: T[];
render(): JSX.Element;
protected onSelectionChange: () => void;
protected canAddItems(): boolean;
protected renderFloatingPicker(): JSX.Element;
protected renderSelectedItemsList(): JSX.Element;
protected onInputChange: (value: string) => void;
protected onInputFocus: (ev: React.FocusEvent<HTMLInputElement | Autofill>) => void;
protected onInputClick: (ev: React.MouseEvent<HTMLInputElement | Autofill, MouseEvent>) => void;
protected onBackspace: (ev: React.KeyboardEvent<HTMLElement>) => void;
protected onCopy: (ev: React.ClipboardEvent<HTMLElement>) => void;
protected onPaste: (ev: React.ClipboardEvent<HTMLInputElement | Autofill>) => void;
protected _onSuggestionSelected: (item: T) => void;
protected _onSelectedItemsChanged: () => void;
/**
* The floating picker is the source of truth for if the menu has been opened or not.
*
* Because this isn't tracked inside the state of this component, we need to
* force an update here to keep the rendered output that depends on the picker being open
* in sync with the state
*
* Called when the suggestions is shown or closed
*/
private _onSuggestionsShownOrHidden;
private _addProcessedItem;
}
/**
* {@docCategory FloatingPeoplePicker}
*/
export declare class BaseFloatingPeoplePicker extends BaseFloatingPicker<IPersonaProps, IPeopleFloatingPickerProps> {
}
export declare class BaseFloatingPicker<T, P extends IBaseFloatingPickerProps<T>> extends BaseComponent<P, IBaseFloatingPickerState> implements IBaseFloatingPicker {
protected selection: Selection;
protected root: React.RefObject<HTMLDivElement>;
protected suggestionStore: SuggestionsStore<T>;
protected suggestionsControl: React.RefObject<SuggestionsControl<T>>;
protected SuggestionsControlOfProperType: new (props: ISuggestionsControlProps<T>) => SuggestionsControl<T>;
protected currentPromise: PromiseLike<T[]>;
protected isComponentMounted: boolean;
constructor(basePickerProps: P);
readonly inputText: string;
readonly suggestions: any[];
forceResolveSuggestion(): void;
readonly currentSelectedSuggestionIndex: number;
readonly isSuggestionsShown: boolean;
onQueryStringChanged: (queryString: string) => void;
hidePicker: () => void;
showPicker: (updateValue?: boolean) => void;
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
UNSAFE_componentWillReceiveProps(newProps: IBaseFloatingPickerProps<T>): void;
completeSuggestion: () => void;
updateSuggestions(suggestions: T[], forceUpdate?: boolean): void;
render(): JSX.Element;
protected renderSuggestions(): JSX.Element | null;
protected onSelectionChange(): void;
protected updateValue(updatedValue: string): void;
protected updateSuggestionWithZeroState(): void;
protected updateSuggestionsList(suggestions: T[] | PromiseLike<T[]>): void;
protected onChange(item: T): void;
protected onSuggestionClick: (ev: React.MouseEvent<HTMLElement, MouseEvent>, item: T, index: number) => void;
protected onSuggestionRemove: (ev: React.MouseEvent<HTMLElement, MouseEvent>, item: T, index: number) => void;
protected onKeyDown: (ev: MouseEvent) => void;
private _updateActiveDescendant;
private _onResolveSuggestions;
private _onValidateInput;
private _updateSuggestionsVisible;
private _bindToInputElement;
private _unbindFromInputElement;
}
/**
* {@docCategory PeoplePicker}
*/
export declare class BasePeoplePicker extends BasePicker<IPersonaProps, IPeoplePickerProps> {
}
/**
* {@docCategory SelectedPeopleList}
*/
export declare class BasePeopleSelectedItemsList extends BaseSelectedItemsList<IExtendedPersonaProps, ISelectedPeopleProps> {
}
/**
* {@docCategory Pickers}
*/
export declare class BasePicker<T, P extends IBasePickerProps<T>> extends BaseComponent<P, IBasePickerState> implements IBasePicker<T> {
protected root: React.RefObject<HTMLDivElement>;
protected input: React.RefObject<IAutofill>;
protected focusZone: React.RefObject<IFocusZone>;
protected suggestionElement: React.RefObject<ISuggestions<T>>;
protected selection: Selection;
protected suggestionStore: SuggestionsController<T>;
/**
* @deprecated this is no longer necessary as typescript now supports generic elements
*/
protected SuggestionOfProperType: new (props: ISuggestionsProps<T>) => Suggestions<T>;
protected currentPromise: PromiseLike<any> | undefined;
protected _ariaMap: IPickerAriaIds;
private _styledSuggestions;
private _id;
private _requestSuggestionsOnClick;
constructor(basePickerProps: P);
readonly items: T[];
UNSAFE_componentWillUpdate(newProps: P, newState: IBasePickerState): void;
componentDidMount(): void;
UNSAFE_componentWillReceiveProps(newProps: P): void;
componentWillUnmount(): void;
focus(): void;
focusInput(): void;
dismissSuggestions: (ev?: any) => void;
completeSuggestion(): void;
refocusSuggestions: (keyCode: number) => void;
render(): JSX.Element;
protected canAddItems(): boolean;
protected renderSuggestions(): JSX.Element | null;
protected renderItems(): JSX.Element[];
protected resetFocus(index?: number): void;
protected onSuggestionSelect(): void;
protected onSelectionChange(): void;
protected updateSuggestions(suggestions: any[]): void;
protected onEmptyInputFocus(): void;
protected updateValue(updatedValue: string): void;
protected updateSuggestionsList(suggestions: T[] | PromiseLike<T[]>, updatedValue?: string): void;
protected resolveNewValue(updatedValue: string, suggestions: T[]): void;
protected onChange(items?: T[]): void;
protected onInputChange: (value: string) => void;
protected onSuggestionClick: (ev: React.MouseEvent<HTMLElement, MouseEvent>, item: any, index: number) => void;
protected onSuggestionRemove: (ev: React.MouseEvent<HTMLElement, MouseEvent>, item: T, index: number) => void;
protected onInputFocus: (ev: React.FocusEvent<HTMLInputElement | Autofill>) => void;
protected onInputBlur: (ev: React.FocusEvent<HTMLInputElement | Autofill>) => void;
protected onBlur: (ev: React.FocusEvent<HTMLElement | Autofill>) => void;
/**
* Reveals suggestions any time the user clicks on the input element
* without shifting focus.
*/
protected onClick: (ev: React.MouseEvent<HTMLInputElement, MouseEvent>) => void;
protected onKeyDown: (ev: React.KeyboardEvent<HTMLElement>) => void;
protected onItemChange: (changedItem: T, index: number) => void;
protected onGetMoreResults: () => void;
protected addItemByIndex: (index: number) => void;
protected addItem: (item: T) => void;
protected removeItem: (item: IPickerItemProps<T>, focusNextItem?: boolean | undefined) => void;
protected removeItems: (itemsToRemove: any[]) => void;
protected onBackspace(ev: React.KeyboardEvent<HTMLElement>): void;
protected _isFocusZoneInnerKeystroke: (ev: React.KeyboardEvent<HTMLElement>) => boolean;
protected getActiveDescendant(): string | undefined;
protected getSuggestionsAlert(suggestionAlertClassName?: string): JSX.Element | undefined;
/**
* Takes in the current updated value and either resolves it with the new suggestions
* or if updated value is undefined then it clears out currently suggested items
*/
private _updateAndResolveValue;
/**
* Controls what happens whenever there is an action that impacts the selected items.
* If selectedItems is provided as a property then this will act as a controlled component and it will not update it's own state.
*/
private _updateSelectedItems;
private _onSelectedItemsUpdated;
/**
* Suggestions are normally shown after the user updates text and the text
* is non-empty, but also when the user clicks on the input element.
* @returns True if suggestions should be shown.
*/
private _getShowSuggestions;
private _onResolveSuggestions;
private _onValidateInput;
private _getTextFromItem;
}
export declare class BasePickerListBelow<T, P extends IBasePickerProps<T>> extends BasePicker<T, P> {
render(): JSX.Element;
protected onBackspace(ev: React.KeyboardEvent<HTMLElement>): void;
}
export declare class BaseSelectedItemsList<T, P extends IBaseSelectedItemsListProps<T>> extends BaseComponent<P, IBaseSelectedItemsListState<T>> implements IBaseSelectedItemsList<T> {
protected root: HTMLElement;
protected selection: Selection;
constructor(basePickerProps: P);
readonly items: T[];
addItems: (items: T[]) => void;
removeItemAt: (index: number) => void;
removeItem: (item: T) => void;
replaceItem: (itemToReplace: T, itemsToReplaceWith: T[]) => void;
removeItems: (itemsToRemove: any[]) => void;
removeSelectedItems(): void;
/**
* Controls what happens whenever there is an action that impacts the selected items.
* If selectedItems is provided as a property then this will act as a controlled component and it will not update it's own state.
*/
updateItems(items: T[], focusIndex?: number): void;
onCopy: (ev: React.ClipboardEvent<HTMLElement>) => void;
hasSelectedItems(): boolean;
unselectAll(): void;
highlightedItems(): T[];
UNSAFE_componentWillUpdate(newProps: P, newState: IBaseSelectedItemsListState): void;
componentDidMount(): void;
UNSAFE_componentWillReceiveProps(newProps: P): void;
render(): any;
protected renderItems: () => JSX.Element[];
protected onSelectionChanged: () => void;
protected onChange(items?: T[]): void;
protected onItemChange: (changedItem: T, index: number) => void;
protected copyItems(items: T[]): void;
private _onSelectedItemsUpdated;
private _canRemoveItem;
}
export declare enum BaseSlots {
primaryColor = 0,
backgroundColor = 1,
foregroundColor = 2
}
export declare const Breadcrumb: React.StatelessComponent<IBreadcrumbProps>;
/**
* {@docCategory Breadcrumb}
*/
export declare class BreadcrumbBase extends React.Component<IBreadcrumbProps, any> {
static defaultProps: IBreadcrumbProps;
private _classNames;
private _focusZone;
constructor(props: IBreadcrumbProps);
/**
* Sets focus to the first breadcrumb link.
*/
focus(): void;
render(): JSX.Element;
private _onReduceData;
private _onRenderBreadcrumb;
private _onRenderItem;
private _onBreadcrumbClicked;
/**
* Validate incoming props
* @param props - Props to validate
*/
private _validateProps;
}
export declare function buildColumns(items: any[], canResizeColumns?: boolean, onColumnClick?: (ev: React.MouseEvent<HTMLElement>, column: IColumn) => void, sortedColumnKey?: string, isSortedDescending?: boolean, groupedColumnKey?: string, isMultiline?: boolean): IColumn[];
/**
* This class is deprecated. Use the individual *Button components instead.
* @deprecated Use the individual *Button components instead.
* {@docCategory Button}
*/
export declare class Button extends BaseComponent<IButtonProps, {}> {
/**
* Set this BaseComponent._skipComponentRefResolution to true, bypassing resolution of componentRef.
*/
protected _skipComponentRefResolution: boolean;
constructor(props: IButtonProps);
render(): JSX.Element;
}
/**
* {@docCategory Button}
*/
export declare enum ButtonType {
normal = 0,
primary = 1,
hero = 2,
compound = 3,
command = 4,
icon = 5,
default = 6
}
export declare class Calendar extends BaseComponent<ICalendarProps, ICalendarState> implements ICalendar {
static defaultProps: ICalendarProps;
private _dayPicker;
private _monthPicker;
private _focusOnUpdate;
constructor(props: ICalendarProps);
UNSAFE_componentWillReceiveProps(nextProps: ICalendarProps): void;
componentDidUpdate(): void;
render(): JSX.Element;
focus(): void;
private _navigateDayPickerDay;
private _navigateMonthPickerDay;
private _onNavigateDayDate;
private _onNavigateMonthDate;
private _onSelectDate;
private _onHeaderSelect;
private _onGotoToday;
private _onGotoTodayClick;
private _onGotoTodayKeyDown;
private _onDatePickerPopupKeyDown;
private _handleEscKey;
}
export declare class Callout extends React.Component<ICalloutProps, ICalloutState> {
render(): JSX.Element;
}
/**
* Returns true if a list of menu items can contain a checkbox
*/
export declare function canAnyMenuItemsCheck(items: IContextualMenuItem[]): boolean;
export declare const Check: React.FunctionComponent<ICheckProps>;
export declare const CheckBase: React.FunctionComponent<ICheckProps>;
export declare const Checkbox: React.StatelessComponent<ICheckboxProps>;
export declare class CheckboxBase extends React.Component<ICheckboxProps, ICheckboxState> implements ICheckbox {
static defaultProps: ICheckboxProps;
private _checkBox;
private _id;
private _classNames;
static getDerivedStateFromProps(nextProps: Readonly<ICheckboxProps>, prevState: Readonly<ICheckboxState>): ICheckboxState | null;
/**
* Initialize a new instance of the Checkbox
* @param props - Props for the component
* @param context - Context or initial state for the base component.
*/
constructor(props: ICheckboxProps, context?: any);
/**
* Render the Checkbox based on passed props
*/
render(): JSX.Element;
readonly indeterminate: boolean;
readonly checked: boolean;
focus(): void;
private _onFocus;
private _onBlur;
private _onChange;
private _onRenderLabel;
}
/**
* {@docCategory DetailsList}
*/
export declare enum CheckboxVisibility {
/**
* Visible on hover.
*/
onHover = 0,
/**
* Visible always.
*/
always = 1,
/**
* Hide checkboxes.
*/
hidden = 2
}
export declare const ChoiceGroup: React.StatelessComponent<IChoiceGroupProps>;
/**
* {@docCategory ChoiceGroup}
*/
export declare class ChoiceGroupBase extends React.Component<IChoiceGroupProps, IChoiceGroupState> implements IChoiceGroup {
private _id;
private _labelId;
private _focusCallbacks;
private _changeCallbacks;
constructor(props: IChoiceGroupProps);
/**
* Gets the current checked option.
*/
readonly checkedOption: IChoiceGroupOption | undefined;
componentDidUpdate(prevProps: IChoiceGroupProps, prevState: IChoiceGroupState): void;
render(): JSX.Element;
focus(): void;
private _onFocus;
private _onBlur;
private _onChange;
/**
* Returns `selectedKey` if provided, or the key of the first option with the `checked` prop set.
*/
private _getKeyChecked;
private _getOptionId;
}
export declare const ChoiceGroupOption: React.StatelessComponent<IChoiceGroupOptionProps>;
/** Clamp a value to ensure it falls within a given range. */
export declare function clamp(value: number, max: number, min?: number): number;
export declare const Coachmark: React.StatelessComponent<ICoachmarkProps>;
export declare const COACHMARK_ATTRIBUTE_NAME = "data-coachmarkid";
export declare class CoachmarkBase extends BaseComponent<ICoachmarkProps, ICoachmarkState> implements ICoachmark {
static defaultProps: Partial<ICoachmarkProps>;
/**
* The cached HTMLElement reference to the Entity Inner Host
* element.
*/
private _entityHost;
private _entityInnerHostElement;
private _translateAnimationContainer;
private _ariaAlertContainer;
private _childrenContainer;
private _positioningContainer;
/**
* The target element the mouse would be in
* proximity to
*/
private _targetElementRect;
constructor(props: ICoachmarkProps);
private readonly _beakDirection;
render(): JSX.Element;
UNSAFE_componentWillReceiveProps(newProps: ICoachmarkProps): void;
shouldComponentUpdate(newProps: ICoachmarkProps, newState: ICoachmarkState): boolean;
componentDidUpdate(prevProps: ICoachmarkProps, prevState: ICoachmarkState): void;
componentDidMount(): void;
dismiss: (ev?: Event | React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement, MouseEvent> | undefined) => void;
private _addListeners;
private _dismissOnLostFocus;
private _onKeyDown;
private _onFocusHandler;
private _onPositioned;
private _getBounds;
private _setBeakPosition;
private _openCoachmark;
private _addProximityHandler;
private _setTargetElementRect;
private _isInsideElement;
}
/**
* {@docCategory GroupedList}
*/
export declare enum CollapseAllVisibility {
hidden = 0,
visible = 1
}
export declare const ColorPicker: React.StatelessComponent<IColorPickerProps>;
/**
* {@docCategory ColorPicker}
*/
export declare class ColorPickerBase extends React.Component<IColorPickerProps, IColorPickerState> implements IColorPicker {
static defaultProps: Partial<IColorPickerProps>;
private _textChangeHandlers;
/**
* Strings displayed in the UI as text field labels (these are in a separate object for convenient
* indexing by short color component name).
*/
private _textLabels;
/** Strings besides red/green/blue/alpha/hex */
private _strings;
constructor(props: IColorPickerProps);
readonly color: IColor;
componentDidUpdate(prevProps: Readonly<IColorPickerProps>, prevState: Readonly<IColorPickerState>): void;
render(): JSX.Element;
private _getDisplayValue;
private _onSVChanged;
private _onHChanged;
private _onAChanged;
private _onTextChange;
private _onBlur;
/**
* Update the displayed color and call change handlers if appropriate.
* @param ev - Event if call was triggered by an event (undefined if triggered by props change)
* @param newColor - Updated color
*/
private _updateColor;
}
export declare const ColorPickerGridCell: React.StatelessComponent<IColorPickerGridCellProps>;
export declare class ColorPickerGridCellBase extends React.PureComponent<IColorPickerGridCellProps, {}> {
static defaultProps: IColorPickerGridCellProps;
private _classNames;
render(): JSX.Element;
/**
* Render the core of a color cell
* @returns - Element representing the core of the item
*/
private _onRenderColorOption;
/**
* Validate if the cell's color is white or not to apply whiteCell style
* @param inputColor - The color of the current cell
* @returns - Whether the cell's color is white or not.
*/
private _isWhiteCell;
}
/**
* Enum to describe how a particular column header behaves.... This enum is used to
* to specify the property IColumn:columnActionsMode.
* If IColumn:columnActionsMode is undefined, then it's equivalent to ColumnActionsMode.clickable
* {@docCategory DetailsList}
*/
export declare enum ColumnActionsMode {
/**
* Renders the column header as disabled.
*/
disabled = 0,
/**
* Renders the column header is clickable.
*/
clickable = 1,
/**
* Renders the column header ias clickable and displays the dropdown cheveron.
*/
hasDropdown = 2
}
/**
* Enum to describe where the column has been dropped, after starting the drag
* {@docCategory DetailsList}
*/
export declare enum ColumnDragEndLocation {
/**
* Drag ended outside of current list
*/
outside = 0,
/**
* Drag ended on current List
*/
surface = 1,
/**
* Drag ended on Header
*/
header = 2
}
export declare class ComboBox extends BaseComponent<IComboBoxProps, IComboBoxState> {
static defaultProps: IComboBoxProps;
private _root;
/** The input aspect of the comboBox */
private _autofill;
/** The wrapping div of the input and button */
private _comboBoxWrapper;
/** The callout element */
private _comboBoxMenu;
/** The menu item element that is currently selected */
private _selectedElement;
/** The base id for the ComboBox */
private _id;
/**
* After a character is inserted when autocomplete is true and allowFreeform is false,
* remember the task that will clear the pending string of characters.
*/
private _lastReadOnlyAutoCompleteChangeTimeoutId;
/** Promise used when resolving the comboBox options */
private _currentPromise;
/** The current visible value sent to the auto fill on render */
private _currentVisibleValue;
private _classNames;
private _isScrollIdle;
private _hasPendingValue;
private _scrollIdleTimeoutId;
private _processingTouch;
private _lastTouchTimeoutId;
/** True if the most recent keydown event was for alt (option) or meta (command). */
private _lastKeyDownWasAltOrMeta;
/**
* Determines if we should be setting focus back to the input when the menu closes.
* The general rule of thumb is if the menu was launched via the keyboard focus should go back
* to the input, if it was dropped via the mouse focus should not be forced back to the input.
*/
private _focusInputAfterClose;
/** Flag for when we get the first mouseMove */
private _gotMouseMove;
private _processingClearPendingInfo;
constructor(props: IComboBoxProps);
/**
* All selected options
*/
readonly selectedOptions: IComboBoxOption[];
componentDidMount(): void;
UNSAFE_componentWillReceiveProps(newProps: IComboBoxProps): void;
componentDidUpdate(prevProps: IComboBoxProps, prevState: IComboBoxState): void;
componentWillUnmount(): void;
render(): JSX.Element;
/**
* {@inheritdoc}
*/
focus: (shouldOpenOnFocus?: boolean | undefined, useFocusAsync?: boolean | undefined) => void;
/**
* Close menu callout if it is open
*/
dismissMenu: () => void;
/**
* componentWillReceiveProps handler for the auto fill component
* Checks/updates the iput value to set, if needed
* @param defaultVisibleValue - the defaultVisibleValue that got passed
* in to the auto fill's componentWillReceiveProps
* @returns - the updated value to set, if needed
*/
private _onUpdateValueInAutofillWillReceiveProps;
/**
* componentDidUpdate handler for the auto fill component
*
* @param defaultVisibleValue - the current defaultVisibleValue in the auto fill's componentDidUpdate
* @param suggestedDisplayValue - the current suggestedDisplayValue in the auto fill's componentDidUpdate
* @returns - should the full value of the input be selected?
* True if the defaultVisibleValue equals the suggestedDisplayValue, false otherwise
*/
private _onShouldSelectFullInputValueInAutofillComponentDidUpdate;
/**
* Get the correct value to pass to the input
* to show to the user based off of the current props and state
* @returns the value to pass to the input
*/
private _getVisibleValue;
/**
* Is the index within the bounds of the array?
* @param options - options to check if the index is valid for
* @param index - the index to check
* @returns - true if the index is valid for the given options, false otherwise
*/
private _indexWithinBounds;
/**
* Handler for typing changes on the input
* @param updatedValue - the newly changed value
*/
private _onInputChange;
/**
* Process the new input's new value when the comboBox
* allows freeform entry
* @param updatedValue - the input's newly changed value
*/
private _processInputChangeWithFreeform;
/**
* Process the new input's new value when the comboBox
* does not allow freeform entry
* @param updatedValue - the input's newly changed value
*/
private _processInputChangeWithoutFreeform;
private _getFirstSelectedIndex;
/**
* Walk along the options starting at the index, stepping by the delta (positive or negative)
* looking for the next valid selectable index (e.g. skipping headings and dividers)
* @param index - the index to get the next selectable index from
* @param delta - optional delta to step by when finding the next index, defaults to 0
* @returns - the next valid selectable index. If the new index is outside of the bounds,
* it will snap to the edge of the options array. If delta == 0 and the given index is not selectable
*/
private _getNextSelectableIndex;
/**
* Set the selected index. Note, this is
* the "real" selected index, not the pending selected index
* @param index - the index to set (or the index to set from if a search direction is provided)
* @param searchDirection - the direction to search along the options from the given index
*/
private _setSelectedIndex;
/**
* Focus (and select) the content of the input
* and set the focused state
*/
private _select;
/**
* Callback issued when the options should be resolved, if they have been updated or
* if they need to be passed in the first time. This only does work if an onResolveOptions
* callback was passed in
*/
private _onResolveOptions;
/**
* OnBlur handler. Set the focused state to false
* and submit any pending value
*/
private _onBlur;
/**
* Submit a pending value if there is one
*/
private _submitPendingValue;
private _onRenderContainer;
private _onCalloutLayerMounted;
private _onLayerMounted;
private _onRenderList;
private _onRenderItem;
private _onRenderLowerContent;
private _onRenderUpperContent;
private _renderSeparator;
private _renderHeader;
private _renderOption;
/**
* If we are coming from a mouseOut:
* there is no visible selected option.
*
* Else if We are hovering over an item:
* that gets the selected look.
*
* Else:
* Use the current valid pending index if it exists OR
* we do not have a valid index and we currently have a pending input value,
* otherwise use the selected index
* */
private _isOptionSelected;
/**
* Gets the pending selected index taking into account hover, valueValidIndex, and selectedIndex
* @param includeCurrentPendingValue - Should we include the currentPendingValue when
* finding the index
*/
private _getPendingSelectedIndex;
/**
* Scroll handler for the callout to make sure the mouse events
* for updating focus are not interacting during scroll
*/
private _onScroll;
/**
* Scroll the selected element into view
*/
private _scrollIntoView;
private _onRenderOptionContent;
/**
* Click handler for the menu items
* to select the item and also close the menu
* @param index - the index of the item that was clicked
*/
private _onItemClick;
/**
* Handles dismissing (cancelling) the menu
*/
private _onDismiss;
/**
* Get the indices of the options that are marked as selected
* @param options - the comboBox options
* @param selectedKeys - the known selected keys to find
* @returns - an array of the indices of the selected options, empty array if nothing is selected
*/
private _getSelectedIndices;
/**
* Reset the selected index by clearing the
* input (of any pending text), clearing the pending state,
* and setting the suggested display value to the last
* selected state text
*/
private _resetSelectedIndex;
/**
* Clears the pending info state
*/
private _clearPendingInfo;
private _onAfterClearPendingInfo;
/**
* Set the pending info
* @param currentPendingValue - new pending value to set
* @param currentPendingValueValidIndex - new pending value index to set
* @param suggestedDisplayValue - new suggest display value to set
*/
private _setPendingInfo;
/**
* Set the pending info from the given index
* @param index - the index to set the pending info from
*/
private _setPendingInfoFromIndex;
/**
* Sets the pending info for the comboBox
* @param index - the index to search from
* @param searchDirection - the direction to search
*/
private _setPendingInfoFromIndexAndDirection;
private _notifyPendingValueChanged;
/**
* Sets the isOpen state and updates focusInputAfterClose
*/
private _setOpenStateAndFocusOnClose;
/**
* Handle keydown on the input
* @param ev - The keyboard event that was fired
*/
private _onInputKeyDown;
/**
* Returns true if the key for the event is alt (Mac option) or meta (Mac command).
*/
private _isAltOrMeta;
/**
* Handle keyup on the input
* @param ev - the keyboard event that was fired
*/
private _onInputKeyUp;
private _onOptionMouseEnter;
private _onOptionMouseMove;
private _onOptionMouseLeave;
private _shouldIgnoreMouseEvent;
/**
* Handle dismissing the menu and
* eating the required key event when disabled
* @param ev - the keyboard event that was fired
*/
private _handleInputWhenDisabled;
/**
* Click handler for the button of the comboBox
* and the input when not allowing freeform. This
* toggles the expand/collapse state of the comboBox (if enbled)
*/
private _onComboBoxClick;
/**
* Click handler for the autofill.
*/
private _onAutofillClick;
private _onTouchStart;
private _onPointerDown;
private _handleTouchAndPointerEvent;
/**
* Get the styles for the current option.
* @param item - Item props for the current option
*/
private _getCaretButtonStyles;
/**
* Get the styles for the current option.
* @param item - Item props for the current option
*/
private _getCurrentOptionStyles;
/**
* Get the aria-activedescendant value for the comboxbox.
* @returns the id of the current focused combo item, otherwise the id of the currently selected element, null otherwise
*/
private _getAriaActiveDescentValue;
/**
* Get the aria autocomplete value for the Combobox
* @returns 'inline' if auto-complete automatically dynamic, 'both' if we have a list of possible values to pick from and can
* dynamically populate input, and 'none' if auto-complete is not enabled as we can't give user inputs.
*/
private _getAriaAutoCompleteValue;
private _isPendingOption;
/**
* Given default selected key(s) and selected key(s), return the selected keys(s).
* When default selected key(s) are available, they take precedence and return them instead of selected key(s).
*
* @returns No matter what specific types the input parameters are, always return an array of
* either strings or numbers instead of premitive type. This normlization makes caller's logic easier.
*/
private _buildDefaultSelectedKeys;
private _buildSelectedKeys;
private _getPreviewText;
private _normalizeToString;
private _removeZeroWidthSpaces;
}
export declare const CommandBar: React.StatelessComponent<ICommandBarProps>;
export declare class CommandBarBase extends BaseComponent<ICommandBarProps, {}> implements ICommandBar {
static defaultProps: ICommandBarProps;
private _overflowSet;
private _resizeGroup;
private _classNames;
render(): JSX.Element;
focus(): void;
remeasure(): void;
private _onRenderData;
private _onRenderItem;
private _commandButton;
private _onButtonClick;
private _onRenderOverflowButton;
private _computeCacheKey;
private _onReduceData;
private _onGrowData;
}
/**
* {@docCategory Button}
*/
export declare class CommandBarButton extends BaseComponent<IButtonProps, {}> {
/**
* Tell BaseComponent to bypass resolution of componentRef.
*/
protected _skipComponentRefResolution: boolean;
render(): JSX.Element;
}
/**
* {@docCategory Button}
*/
export declare const CommandButton: typeof ActionButton;
export declare const CompactPeoplePicker: React.FunctionComponent<IPeoplePickerProps>;
/**
* Compact layout. It uses personas without secondary text when displaying search results.
* {@docCategory PeoplePicker}
*/
export declare class CompactPeoplePickerBase extends BasePeoplePicker {
/** Default props for CompactPeoplePicker. */
static defaultProps: {
onRenderItem: (props: IPeoplePickerItemSelectedProps) => JSX.Element;
onRenderSuggestionsItem: (personaProps: IPersonaProps, suggestionsProps?: IBasePickerSuggestionsProps<any> | undefined) => JSX.Element;
createGenericItem: typeof createGenericItem;
};
}
/**
* {@docCategory Button}
*/
export declare class CompoundButton extends BaseComponent<IButtonProps, {}> {
/**
* Tell BaseComponent to bypass resolution of componentRef.
*/
protected _skipComponentRefResolution: boolean;
render(): JSX.Element;
}
/**
* {@docCategory DetailsList}
*/
export declare enum ConstrainMode {
/** If specified, lets the content grow which allows the page to manage scrolling. */
unconstrained = 0,
/**
* If specified, constrains the list to the given layout space.
*/
horizontalConstrained = 1
}
/**
* ContextualMenu description
*/
export declare const ContextualMenu: React.StatelessComponent<IContextualMenuProps>;
export declare class ContextualMenuBase extends BaseComponent<IContextualMenuProps, IContextualMenuState> {
static defaultProps: IContextualMenuProps;
private _host;
private _previousActiveElement;
private _isFocusingPreviousElement;
private _enterTimerId;
private _targetWindow;
private _target;
private _isScrollIdle;
private _scrollIdleTimeoutId;
/** True if the most recent keydown event was for alt (option) or meta (command). */
private _lastKeyDownWasAltOrMeta;
private _shouldUpdateFocusOnMouseEvent;
private _gotMouseMove;
private _mounted;
private _adjustedFocusZoneProps;
private _classNames;
constructor(props: IContextualMenuProps);
dismiss: (ev?: any, dismissAll?: boolean | undefined) => void;
shouldComponentUpdate(newProps: IContextualMenuProps, newState: IContextualMenuState): boolean;
UNSAFE_componentWillUpdate(newProps: IContextualMenuProps): void;
UNSAFE_componentWillMount(): void;
componentDidMount(): void;
componentWillUnmount(): void;
render(): JSX.Element | null;
/**
* Return whether the contextual menu is hidden.
* Undefined value for hidden is equivalent to hidden being false.
* @param props - Props for the component
*/
private _isHidden;
private _onMenuOpened;
private _onMenuClosed;
private _tryFocusPreviousActiveElement;
/**
* Gets the focusZoneDirection by using the arrowDirection if specified,
* the direction specificed in the focusZoneProps, or defaults to FocusZoneDirection.vertical
*/
private _getFocusZoneDirection;
private _onRenderSubMenu;
private _onRenderMenuList;
private _renderMenuItem;
private _renderSectionItem;
private _renderListItem;
private _renderSeparator;
private _renderNormalItem;
private _renderHeaderMenuItem;
private _renderAnchorMenuItem;
private _renderButtonItem;
private _renderSplitButton;
private _onKeyDown;
private _shouldHandleKeyDown;
private _onMenuFocusCapture;
private _onKeyUp;
/**
* We close the menu on key up only if ALL of the following are true:
* - Most recent key down was alt or meta (command)
* - The alt/meta key down was NOT followed by some other key (such as down/up arrow to
* expand/collapse the menu)
* - We're not on a Mac (or iOS)
*
* This is because on Windows, pressing alt moves focus to the application menu bar or similar,
* closing any open context menus. There is not a similar behavior on Macs.
*/
private _shouldHandleKeyUp;
/**
* Returns true if the key for the event is alt (Mac option) or meta (Mac command).
*/
private _isAltOrMeta;
/**
* Calls `shouldHandleKey` to determine whether the keyboard event should be handled;
* if so, stops event propagation and dismisses menu(s).
* @param ev - The keyboard event.
* @param shouldHandleKey - Returns whether we should handle this keyboard event.
* @param dismissAllMenus - If true, dismiss all menus. Otherwise, dismiss only the current menu.
* Only does anything if `shouldHandleKey` returns true.
* @returns Whether the event was handled.
*/
private _keyHandler;
/**
* Checks if the submenu should be closed
*/
private _shouldCloseSubMenu;
private _onMenuKeyDown;
/**
* Scroll handler for the callout to make sure the mouse events
* for updating focus are not interacting during scroll
*/
private _onScroll;
private _onItemMouseEnterBase;
private _onItemMouseMoveBase;
private _shouldIgnoreMouseEvent;
private _onMouseItemLeave;
/**
* Handles updating focus when mouseEnter or mouseMove fire.
* As part of updating focus, This function will also update
* the expand/collapse state accordingly.
*/
private _updateFocusOnMouseEvent;
private _onItemMouseDown;
private _onItemClick;
private _onItemClickBase;
private _onAnchorClick;
private _executeItemClick;
private _onItemKeyDown;
private _cancelSubMenuTimer;
private _onItemSubMenuExpand;
private _getSubmenuProps;
private _findItemByKey;
/**
* Returns the item that mathes a given key if any.
* @param key - The key of the item to match
* @param items - The items to look for the key
*/
private _findItemByKeyFromItems;
/**
* This function is called ASYNCHRONOUSLY, and so there is a chance it is called
* after the component is unmounted. The _mounted property is added to prevent
* from calling setState() after unmount. Do NOT copy this pattern in synchronous
* code.
*/
private _onSubMenuDismiss;
private _setTargetWindowAndElement;
private _getSubMenuId;
private _onPointerAndTouchEvent;
}
/**
* ContextualMenuItem description
*/
export declare const ContextualMenuItem: React.StatelessComponent<IContextualMenuItemProps>;
export declare class ContextualMenuItemBase extends BaseComponent<IContextualMenuItemProps, {}> {
render(): JSX.Element;
openSubMenu: () => void;
dismissSubMenu: () => void;
dismissMenu: (dismissAll?: boolean | undefined) => void;
}
/**
* {@docCategory ContextualMenu}
*/
export declare enum ContextualMenuItemType {
Normal = 0,
Divider = 1,
Header = 2,
Section = 3
}
/**
* Corrects a hex color to have length 3 or 6. Defaults to white if too short.
* Does NOT check anything besides the length (such as valid characters) and does NOT handle
* hex values starting with # sign.
*/
export declare function correctHex(hex: string): string;
/** Corrects an HSV color to fall within the valid range. */
export declare function correctHSV(color: IHSV): IHSV;
/** Corrects an RGB color to fall within the valid range. */
export declare function correctRGB(color: IRGB): IRGB;
/**
* {@docCategory PeoplePicker}
*/
e