| 1 |
import { Component } from 'react'; |
| 2 |
import { OUIAProps } from '../../helpers'; |
| 3 |
export interface SwitchProps extends Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'onChange' | 'disabled' | 'label'>, OUIAProps { |
| 4 |
/** id for the label. */ |
| 5 |
id?: string; |
| 6 |
/** Additional classes added to the switch */ |
| 7 |
className?: string; |
| 8 |
/** Text value for the visible label */ |
| 9 |
label?: React.ReactNode; |
| 10 |
/** Adds an accessible name to the switch when the label prop is not passed, and must describe the isChecked="true" state. */ |
| 11 |
'aria-label'?: string; |
| 12 |
/** Adds an accessible name to the switch via one or more referenced id(s). The computed accessible name must describe the isChecked="true" state. */ |
| 13 |
'aria-labelledby'?: string; |
| 14 |
/** Flag to show if the switch is checked when it is controlled by React state. |
| 15 |
* To make the switch uncontrolled instead use the defaultChecked prop, but do not use both. |
| 16 |
*/ |
| 17 |
isChecked?: boolean; |
| 18 |
/** Flag to set the default checked value of the switch when it is uncontrolled by React state. |
| 19 |
* To make the switch controlled instead use the isChecked prop, but do not use both. |
| 20 |
*/ |
| 21 |
defaultChecked?: boolean; |
| 22 |
/** Flag to show if the switch has a check icon. */ |
| 23 |
hasCheckIcon?: boolean; |
| 24 |
/** Flag to show if the switch is disabled. */ |
| 25 |
isDisabled?: boolean; |
| 26 |
/** A callback for when the switch selection changes. (event, isChecked) => {} */ |
| 27 |
onChange?: (event: React.FormEvent<HTMLInputElement>, checked: boolean) => void; |
| 28 |
/** Flag to reverse the layout of toggle and label (label at start, toggle at end). */ |
| 29 |
isReversed?: boolean; |
| 30 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 31 |
ouiaId?: number | string; |
| 32 |
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 33 |
ouiaSafe?: boolean; |
| 34 |
} |
| 35 |
declare class Switch extends Component<SwitchProps & OUIAProps> { |
| 36 |
static displayName: string; |
| 37 |
static defaultProps: SwitchProps; |
| 38 |
constructor(props: SwitchProps & OUIAProps); |
| 39 |
render(): import("react/jsx-runtime").JSX.Element; |
| 40 |
} |
| 41 |
export { Switch }; |
| 42 |
//# sourceMappingURL=Switch.d.ts.map |