/** @module @airtable/blocks/ui: Switch */ /** */ import PropTypes from 'prop-types'; import React from 'react'; import { EnumType } from '../private_utils'; import { MaxWidthProps, MinWidthProps, WidthProps, FlexItemSetProps, PositionSetProps, SpacingSetProps, BackgroundColorProps } from './system'; import { OptionalResponsiveProp } from './system/utils/types'; import { TooltipAnchorProps } from './types/tooltip_anchor_props'; import { ControlSizeProp } from './control_sizes'; /** * Variants for the {@link Switch} component: * * • **default** * * Green switch for toggling a setting or other boolean property. * * • **danger** * * Red switch for toggling a dangerous or infrequently-used setting. */ type SwitchVariant = EnumType; declare const SwitchVariant: { default: "default"; danger: "danger"; }; /** * Props shared between the {@link Switch} and {@link SwitchSynced} components. * * @noInheritDoc */ export interface SharedSwitchProps extends TooltipAnchorProps, SwitchStyleProps { /** Additional class names to apply to the switch. */ className?: string; /** If set to `true`, the user cannot interact with the switch. */ disabled?: boolean; /** The label node for the switch. */ label?: React.ReactNode | string; /** A function to be called when the switch is toggled. */ onChange?: (newValue: boolean) => unknown; /** Indicates if the switch can be focused and if/where it participates in sequential keyboard navigation. */ tabIndex?: number; /** The variant of the switch. Defaults to `default` (green). */ variant?: SwitchVariant; /** The size of the switch. Defaults to `default`. */ size?: ControlSizeProp; /** The ID of the switch element. */ id?: string; /** Additional styles to apply to the switch. */ style?: React.CSSProperties; /** The label for the switch. Use this if the switch lacks a visible text label. */ ['aria-label']?: string; /** A space separated list of label element IDs. */ ['aria-labelledby']?: string; /** A space separated list of description element IDs. */ ['aria-describedby']?: string; } /** * Props for the {@link Switch} component. Also accepts: * * {@link SwitchStyleProps} * * @docsPath UI/components/Switch */ export interface SwitchProps extends SharedSwitchProps { /** If set to `true`, the switch will be switchd on. */ value: boolean; } export declare const switchStylePropTypes: { [x: string]: PropTypes.Validator; }; export declare const sharedSwitchPropTypes: { onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>; onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>; onClick: PropTypes.Requireable<(...args: any[]) => any>; hasOnClick: PropTypes.Requireable; disabled: PropTypes.Requireable; id: PropTypes.Requireable; label: PropTypes.Requireable; onChange: PropTypes.Requireable<(...args: any[]) => any>; tabIndex: PropTypes.Requireable; variant: PropTypes.Requireable<"default" | "danger">; className: PropTypes.Requireable; style: PropTypes.Requireable; 'aria-label': PropTypes.Requireable; 'aria-labelledby': PropTypes.Requireable; 'aria-describedby': PropTypes.Requireable; }; /** * Style props for the {@link Switch} component. Also accepts: * * {@link BackgroundColorProps} * * {@link FlexItemSetProps} * * {@link MinWidthProps} * * {@link MaxWidthProps} * * {@link PositionSetProps} * * {@link SpacingSetProps} * * {@link WidthProps} * * @noInheritDoc */ export interface SwitchStyleProps extends MaxWidthProps, MinWidthProps, WidthProps, FlexItemSetProps, PositionSetProps, SpacingSetProps, BackgroundColorProps { /** */ display?: OptionalResponsiveProp<'flex' | 'inline-flex'>; } declare const ForwardedRefSwitch: React.ForwardRefExoticComponent>; export default ForwardedRefSwitch; //# sourceMappingURL=switch.d.ts.map