| 1 |
/// <reference types="react" /> |
| 2 |
import { TooltipPosition } from '../Tooltip'; |
| 3 |
/** Semantic status for labels (default icon and status styling). */ |
| 4 |
export declare enum LabelStatus { |
| 5 |
success = "success", |
| 6 |
warning = "warning", |
| 7 |
danger = "danger", |
| 8 |
info = "info", |
| 9 |
custom = "custom" |
| 10 |
} |
| 11 |
/** Label palette color when not using the `status` prop. */ |
| 12 |
export declare enum LabelColor { |
| 13 |
blue = "blue", |
| 14 |
teal = "teal", |
| 15 |
green = "green", |
| 16 |
orange = "orange", |
| 17 |
purple = "purple", |
| 18 |
red = "red", |
| 19 |
orangered = "orangered", |
| 20 |
grey = "grey", |
| 21 |
yellow = "yellow" |
| 22 |
} |
| 23 |
export interface LabelProps extends React.HTMLProps<HTMLSpanElement> { |
| 24 |
/** Content rendered inside the label. */ |
| 25 |
children?: React.ReactNode; |
| 26 |
/** Additional classes added to the label. */ |
| 27 |
className?: string; |
| 28 |
/** Color of the label. */ |
| 29 |
color?: 'blue' | 'teal' | 'green' | 'orange' | 'purple' | 'red' | 'orangered' | 'grey' | 'yellow' | LabelColor; |
| 30 |
/** Variant of the label. */ |
| 31 |
variant?: 'outline' | 'filled' | 'overflow' | 'add'; |
| 32 |
/** Status of the label with a respective icon and color. Overrides the color set by the color property. */ |
| 33 |
status?: 'success' | 'warning' | 'danger' | 'info' | 'custom'; |
| 34 |
/** Flag indicating the label is compact. */ |
| 35 |
isCompact?: boolean; |
| 36 |
/** Flag indicating the label is disabled. Works only on clickable labels, so either href or onClick props must be passed in. */ |
| 37 |
isDisabled?: boolean; |
| 38 |
/** Flag indicating the label is editable. */ |
| 39 |
isEditable?: boolean; |
| 40 |
/** Flag indicating the label is clickable. This flag will automatically be set if a href is passed, or if an onClick handler is passed and the label is not an overflow or add variant. This should be manually set when using the render prop. */ |
| 41 |
isClickable?: boolean; |
| 42 |
/** Additional props passed to the editable label text div. Optionally passing onInput and onBlur callbacks will allow finer custom text input control. */ |
| 43 |
editableProps?: any; |
| 44 |
/** Callback when an editable label completes an edit. */ |
| 45 |
onEditComplete?: (event: MouseEvent | KeyboardEvent, newText: string) => void; |
| 46 |
/** Callback when an editable label cancels an edit. */ |
| 47 |
onEditCancel?: (event: KeyboardEvent, previousText: string) => void; |
| 48 |
/** The max width of the label before it is truncated. Can be any valid CSS unit, such as '100%', '100px', or '16ch'. */ |
| 49 |
textMaxWidth?: string; |
| 50 |
/** Position of the tooltip which is displayed if text is truncated */ |
| 51 |
tooltipPosition?: TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end'; |
| 52 |
/** Icon added to the left of the label text. Overrides the icon set by the status property. */ |
| 53 |
icon?: React.ReactNode; |
| 54 |
/** Close click callback for removable labels. If present, label will have a close button. */ |
| 55 |
onClose?: (event: React.MouseEvent) => void; |
| 56 |
/** Node for custom close button. */ |
| 57 |
closeBtn?: React.ReactNode; |
| 58 |
/** Aria label for close button */ |
| 59 |
closeBtnAriaLabel?: string; |
| 60 |
/** Additional properties for the default close button. */ |
| 61 |
closeBtnProps?: any; |
| 62 |
/** Href for a label that is a link. If present, the label will change to an anchor element. This should not be passed in if the onClick prop is also passed in. */ |
| 63 |
href?: string; |
| 64 |
/** Callback for when the label is clicked. This should not be passed in if the href or isEditable props are also passed in. */ |
| 65 |
onClick?: (event: React.MouseEvent) => void; |
| 66 |
/** Forwards the label content and className to rendered function. Use this prop for react router support.*/ |
| 67 |
render?: ({ className, content, componentRef }: { |
| 68 |
className: string; |
| 69 |
content: React.ReactNode; |
| 70 |
componentRef: any; |
| 71 |
}) => React.ReactNode; |
| 72 |
} |
| 73 |
export declare const Label: React.FunctionComponent<LabelProps>; |
| 74 |
//# sourceMappingURL=Label.d.ts.map |