office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
58 lines (57 loc) • 2.18 kB
TypeScript
import { BaseComponent } from '../../Utilities';
import { ISwatchColorPicker, ISwatchColorPickerProps } from './SwatchColorPicker.Props';
export interface ISwatchColorPickerState {
selectedIndex?: number;
}
export declare class SwatchColorPicker extends BaseComponent<ISwatchColorPickerProps, ISwatchColorPickerState> implements ISwatchColorPicker {
static defaultProps: {
cellShape: string;
disabled: boolean;
shouldFocusCircularNavigate: boolean;
};
private _id;
constructor(props: ISwatchColorPickerProps);
componentWillReceiveProps(newProps: ISwatchColorPickerProps): void;
render(): JSX.Element;
/**
* When the whole swatchColorPicker is blurred,
* make sure to clear the pending focused stated
*/
private _onSwatchColorPickerBlur();
/**
* Get the selected item's index
* @param items - The items to search
* @param selectedId - The selected item's id to find
* @returns {number} - The index of the selected item's id, -1 if there was no match
*/
private _getSelectedIndex(items, selectedId);
/**
* Render a color cell
* @param item - The item to render
* @returns {JSX.Element} - Element representing the item
*/
private _renderOption(item);
/**
* Callback passed to the GridCell class that will trigger the onCellHovered callback of the SwatchColorPicker
*/
private _onGridCellHovered(item?);
/**
* Callback passed to the GridCell class that will trigger the onCellFocus callback of the SwatchColorPicker
*/
private _onGridCellFocused(item?);
/**
* Render the core of a color cell
* @returns {JSX.Element} - Element representing the core of the item
*/
private _onRenderColorOption(colorOption);
/**
* Handle the click on a cell
* @param item - The cell that the click was fired against
*/
private _onCellClick(item);
/**
* Clear the colors by calling the given callbacks
* @param callbacks - The callbacks to handle the clear operation
*/
private _clearColors(callbacks);
}