import { cx } from '../internal/cx.js' import { useLabels } from './labels.js' const SearchIcon = () => ( ) const ClearIcon = () => ( ) /** * A search box: icon, input, a clear button while there is text. Same heights as . * * onChange receives the text (not an event). Grows to fill a . */ export function SearchInput({ value = '', onChange, placeholder, size = 'md', className, 'aria-label': ariaLabel, ...rest }) { const labels = useLabels() return (
onChange?.(e.target.value)} {...rest} /> {value && ( )}
) } /** * A toggle filter in a toolbar: a state, a status… with an optional coloured dot and a count. * tone: 'success' | 'info' | 'accent' | 'warning' | 'danger' | 'neutral' (the dot and the "on" look). */ export function FilterChip({ pressed = false, tone = 'neutral', count, size = 'md', className, children, ...rest }) { return ( ) } /** * A few mutually exclusive views (List / Map). options: [{ value, label, icon?, ariaLabel? }] * (ariaLabel: the name of an option shown as an icon only). fill: as wide as its column, the options sharing it. * */ export function Segmented({ options = [], value, onChange, size = 'md', fill = false, className, ...rest }) { return (
{options.map(o => ( ))}
) } /** * Tabs with an underline: a page's or a dialog's sections. Scrolls sideways when they don't fit, * never up and down. tabs: [{ id, label, badge?, warn?, testId? }]. * * end: an element at the right end of the strip (a refresh button…). * inset: the strip is the header of a card / panel: the card's padding at the sides, and the same * room above and below `end` (a button never touches the card's edge or the line). * fill: the tabs share the width equally, each label centred (a narrow column's tabs). */ export function Tabs({ tabs = [], value, onChange, size = 'md', end, inset = false, fill = false, className, ...rest }) { return (
{tabs.map(tb => ( ))}
{end &&
{end}
}
) }