UNPKG

@fluentui/react-northstar

Version:
109 lines (108 loc) 3.91 kB
import * as PropTypes from 'prop-types'; import * as React from 'react'; import { Accessibility, AriaRole, PillBehaviorProps } from '@fluentui/accessibility'; import { UIComponentProps, ContentComponentProps, SizeValue } from '../../utils'; import { ShorthandValue, FluentComponentStaticProps, ComponentEventHandler } from '../../types'; import { BoxProps } from '../Box/Box'; import { PillActionProps } from './PillAction'; import { PillImageProps } from './PillImage'; import { PillIconProps } from './PillIcon'; export interface PillProps extends UIComponentProps, ContentComponentProps<ShorthandValue<BoxProps>> { /** * Accessibility behavior if overridden by the user. */ accessibility?: Accessibility<PillBehaviorProps>; /** * A Pill can be sized. */ size?: Extract<SizeValue, 'smaller' | 'small' | 'medium'>; /** * A Pill can be rectangular */ rectangular?: boolean; /** * A Pill can be filled, inverted or outline */ appearance?: 'filled' | 'inverted' | 'outline'; /** * A Pill can be disbled */ disabled?: boolean; /** * A Pill can be actionable */ actionable?: boolean; /** * A PillAction shorthand for the action slot. */ action?: ShorthandValue<PillActionProps>; /** * A PillAction shorthand for the action slot. */ icon?: ShorthandValue<PillIconProps>; /** * A PillImage shorthand for the image slot. */ image?: ShorthandValue<PillImageProps>; /** * Called after user will dismiss the Pill. * @param event - React's original SyntheticEvent. * @param data - All props. */ onDismiss?: ComponentEventHandler<PillProps>; /** * A Pill can be selectable */ selectable?: boolean; /** * A Pill state for selection */ selected?: boolean; /** * A Pill can be selected by default */ defaultSelected?: boolean; /** * A Pill can have custom selected indicator */ selectedIndicator?: ShorthandValue<PillIconProps>; /** * Called after user change selected state * @param event - React's original SyntheticEvent. * @param data - All props. */ onSelectionChange?: ComponentEventHandler<PillProps>; /** * Role to be set in the pill root element */ role?: AriaRole; } export declare type PillStylesProps = Required<Pick<PillProps, 'appearance' | 'size' | 'rectangular' | 'disabled' | 'selectable' | 'selected' | 'actionable'>>; export declare const pillClassName = "ui-pill"; /** * Pills should be used when representing an input, as a way to filter content, or to represent an attribute. */ export declare const Pill: (<TExtendedElementType extends React.ElementType<any> = "span">(props: React.RefAttributes<HTMLSpanElement> & Omit<import("@fluentui/react-bindings").PropsOfElement<TExtendedElementType>, "as" | keyof PillProps> & { as?: TExtendedElementType; } & PillProps) => JSX.Element) & { propTypes?: React.WeakValidationMap<PillProps> & { as: React.Requireable<string | ((props: any, context?: any) => any) | (new (props: any, context?: any) => any)>; }; contextTypes?: PropTypes.ValidationMap<any>; defaultProps?: Partial<PillProps & { as: "span"; }>; /** * Called after user will dismiss the Pill. * @param event - React's original SyntheticEvent. * @param data - All props. */ displayName?: string; readonly __PRIVATE_PROPS?: React.RefAttributes<HTMLSpanElement> & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & { ref?: React.Ref<HTMLSpanElement>; }, "as" | keyof PillProps> & { as?: "span"; } & PillProps; /** * A Pill can be selected by default */ } & FluentComponentStaticProps<PillProps>;