/** * Form controls. * * Every control here is a real, focusable element with correct ARIA — the * switch is a `button[role=switch]`, not a styled div, so keyboard and screen * reader users get the same affordances as everyone else. */ import { IconCheck, IconSearch } from '../icons'; /** * Toggle for a single boolean. * * @param {Object} props * @param {boolean} props.checked * @param {Function} props.onChange Receives the next boolean. * @param {string} props.label Accessible name (visually hidden here when * a visible label sits elsewhere). * @return {Element} Switch. */ export function Switch( { checked, onChange, label, id, disabled } ) { return ( ); } /** * Checkbox for multi-select lists, where a column of switches would * over-weight what is really one grouped choice. * * @param {Object} props * @param {boolean} props.checked * @param {Function} props.onChange * @return {Element} Checkbox with its label. */ export function Checkbox( { checked, onChange, children, disabled } ) { return ( ); } /** * Segmented control for 2–3 mutually exclusive options. * * @param {Object} props * @param {Array} props.options `[{ value, label }]`. * @param {string} props.value * @param {Function} props.onChange * @param {string} props.label Accessible group name. * @return {Element} Segmented control. */ export function Segmented( { options, value, onChange, label } ) { return (
{ options.map( ( option ) => ( ) ) }
); } /** * Text input with an optional label and hint. * * @return {Element} Field. */ export function Field( { label, hint, id, className = '', ...props } ) { return (
{ label && ( ) } { hint &&

{ hint }

}
); } /** * Search input with a leading icon and a clear affordance. * * @return {Element} Search field. */ export function SearchInput( { value, onChange, placeholder, label } ) { return (
onChange( e.target.value ) } className="c-input tw-pl-9" />
); } /** * Select styled to match the rest of the control set (the native chevron is * replaced with our own so it matches at every OS/zoom level). * * @return {Element} Select. */ export function Select( { label, hint, id, children, className = '', ...props } ) { return (
{ label && ( ) } { hint &&

{ hint }

}
); } /** * Monospace textarea, for content that is code-shaped (llms.txt overrides). * * @return {Element} Textarea. */ export function Textarea( { label, hint, id, className = '', ...props } ) { return (
{ label && ( ) }