import type React from 'react'; import type { CheckedDetail, FocusDetail, KeyboardDetail } from './types.js'; export interface SwitchRef extends HTMLElement { /** Focuses the switch input. */ focus(): void; /** Returns "true" or "false". */ getValue(): string; /** Sets the switch state ("true" or "false"). */ setValue(value: string): void; } /** * Sets `role="switch"` on the host element for screen readers. * The `checked` prop is boolean (unlike Checkbox which supports indeterminate). * Labels are passed as a `label` string prop, not as children. * * In React, reach the imperative methods through a ref: * `const api = useRef(null)`, pass `ref={api}`, then `api.current?.focus()`. * Available: focus(), getValue(), setValue(). * * @csspart track */ export interface SwitchOwnProps { /** * Unique identifier for the element. * @example 'example-id' */ id?: string; /** * Visible label text. * @example 'Example label' */ label: string; /** * Corner radius style. Allowed values: `sharp`, `rounded`, `pill`. * @example 'sharp' */ shape?: 'sharp' | 'rounded' | 'pill'; /** * Component size. Allowed values: `xs`, `sm`, `md`, `lg`, `xl`. * @example 'xs' */ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; /** * Boolean checked state (unlike Checkbox, which uses a string). * @defaultValue false * @example true */ checked?: boolean; /** * Disables the component, preventing interaction. * @defaultValue false * @example true */ disabled?: boolean; /** * Marks the field as required for form validation. * @defaultValue false * @example true */ required?: boolean; /** * Helper text displayed below the input. * @example 'example' */ helperText?: string; /** * Error message text. When set, shows validation error styling. * @example 'This field is invalid' */ error?: string; /** * Secondary descriptive text rendered inside Shadow DOM. Not the same as React children — use the `description` prop for helper text. * @example 'Additional context' */ description?: string; /** * Renders the input without a visible label (still requires aria-label). * @defaultValue false * @example true */ unlabeled?: boolean; /** * Fires on each user edit before the value is committed. Detail: `CheckedDetail`. * @example (event) => console.log(event.detail.checked) */ onInput?: (event: CustomEvent) => void; /** * Fires when the committed component value or state changes. Detail: `CheckedDetail`. * @example (event) => console.log(event.detail.checked) */ onChange?: (event: CustomEvent) => void; /** * Fires when focus enters the component. Detail: `FocusDetail`. * @example (event) => console.log(event.detail.relatedTarget) */ onFocus?: (event: CustomEvent) => void; /** * Fires when focus leaves the component. Detail: `FocusDetail`. * @example (event) => console.log(event.detail.relatedTarget) */ onBlur?: (event: CustomEvent) => void; /** * Fires when a key is pressed inside the component. Detail: `KeyboardDetail`. * @example (event) => console.log(event.detail.key) */ onKeydown?: (event: CustomEvent) => void; /** * Fires when a key is released inside the component. Detail: `KeyboardDetail`. * @example (event) => console.log(event.detail.key) */ onKeyup?: (event: CustomEvent) => void; /** CSS class applied to the Custom Element host. * @example 'my-component' */ className?: string; /** Inline styles applied to the Custom Element host. * @example { marginTop: 8 } */ style?: React.CSSProperties; } /** * Props for ``: the component's own API plus every standard DOM * attribute and native React event handler, forwarded verbatim to the * `` host — `id`, `data-*`, `aria-*`, `title`, `tabIndex`, * `slot`, `onMouseEnter`, and the rest. Own props always win over a * same-named DOM attribute. */ export type SwitchProps = SwitchOwnProps & Omit, keyof SwitchOwnProps | 'children' | 'dangerouslySetInnerHTML'>; export declare const Switch: React.ForwardRefExoticComponent, "children" | "dangerouslySetInnerHTML" | keyof SwitchOwnProps> & React.RefAttributes>;