UNPKG

@spark-ui/components

Version:

Spark (Leboncoin design system) components.

65 lines (60 loc) 2.26 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { ComponentPropsWithRef, ReactNode } from 'react'; import * as class_variance_authority_types from 'class-variance-authority/types'; import { VariantProps } from 'class-variance-authority'; declare const styles: (props?: ({ size?: "sm" | "md" | null | undefined; intent?: "main" | "alert" | "error" | "success" | "support" | "accent" | "basic" | "info" | "neutral" | null | undefined; } & class_variance_authority_types.ClassProp) | undefined) => string; type StylesProps = VariantProps<typeof styles>; interface SwitchInputProps extends StylesProps, Omit<ComponentPropsWithRef<'button'>, 'value'> { /** * The state of the switch when it is initially rendered. Use when you do not need to control its state. */ defaultChecked?: boolean; /** * The controlled state of the switch. Must be used in conjunction with `onCheckedChange`. */ checked?: boolean; /** * When true, prevents the user from interacting with the switch. */ /** * Event handler called when the state of the switch changes. */ onCheckedChange?: (checked: boolean) => void; /** * When `true`, prevents the user from interacting with the switch. */ disabled?: boolean; /** * When true, indicates that the user must check the switch before the owning form can be submitted. */ required?: boolean; /** * The name of the switch. Submitted with its owning form as part of a name/value pair. */ name?: string; /** * The value given as data when submitted with a name. */ value?: string; /** * Icon shown inside the thumb of the Switch whenever it is checked */ checkedIcon?: ReactNode; /** * Icon shown inside the thumb of the Switch whenever it is unchecked */ uncheckedIcon?: ReactNode; /** * When true, the label will be placed on the left side of the Switch */ reverse?: boolean; } type SwitchProps = SwitchInputProps; declare const Switch: { ({ size, children, className, id, disabled, reverse, ref, ...rest }: SwitchProps): react_jsx_runtime.JSX.Element; displayName: string; }; export { Switch, type SwitchProps };