@travel-match/ui 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":["_Fragment","Fragment$1","Popover","toArray","value","asText","node","optionText","option","matches","text","query","isPrintable","event","defaultRemoveLabel","Select","invalidProp","openProp","ariaDescribedBy","ariaLabelledBy","props","ids","useFieldIds","id","error","helperText","listId","optionId","index","internalOpen","setInternalOpen","useState","defaultOpen","internalValue","setInternalValue","defaultValue","setQuery","activeValue","setActiveValue","searchRef","useRef","keepFocusOnClose","typed","isOpen","disabled","selectedValues","selectedOptions","options","selected","invalid","needle","searchable","visible","enabled","activeOption","activeId","useEffect","setOpen","next","candidates","initial","focus","onOpenChange","emit","notify","onValueChange","multiple","toggle","optionValue","commit","move","current","to","typeAhead","state","char","repeated","letter","term","from","match","handleListKeys","source","handleTriggerKeyDown","onKeyDown","search","single","hasChips","Chevron","UpArrowIcon","DownArrowIcon","control","size","SelectedItem","removeLabel","label","cn","required","onKeyUp","startIcon","renderValue","placeholder","FormField","className","fullWidth","panelAnchor","name","portalContainer","panelClassName","SearchIcon","searchPlaceholder","OptionList","Option","checkmark","emptyText"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { DownArrowIcon, SearchIcon, UpArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { FormField, useFieldIds, type FieldSize, type FormFieldProps } from '../Field';\nimport { Option, OptionList } from '../OptionList';\nimport { SelectedItem } from './SelectedItem';\nimport './Select.css';\n\nexport interface SelectOption {\n /** What `value` / `onValueChange` carry and what a form submits. */\n value: string;\n /** Text in the list and in the field, e.g. \"Armenia\", \"EN\", \"AMD\". */\n label: ReactNode;\n /** Regular-weight text after the label in the list only, e.g. \"English\" after \"EN\". */\n detail?: ReactNode;\n /** Small second line in the list (Figma \"Caption\"). */\n description?: ReactNode;\n /** Icon or flag before the label in the list (Figma \"Icon\"). */\n icon?: ReactNode;\n /** The option is shown but cannot be chosen. */\n disabled?: boolean;\n /** Plain text for type-ahead, search and the remove button when `label` is not a string. */\n textValue?: string;\n}\n\ntype TriggerProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children' | 'type' | 'name' | 'role'>;\n\ninterface SelectBaseProps extends FormFieldProps, TriggerProps {\n /** The options, in display order. */\n options: SelectOption[];\n /** Shown in the field while nothing is selected. */\n placeholder?: ReactNode;\n /** Figma \"Size\": `lg` 52px · `md` 46px (default) · `sm` 42px. */\n size?: FieldSize;\n /** Adds hidden inputs so the value is submitted with a native form (one per value when `multiple`). */\n name?: string;\n /** Invalid look without a message of its own — for composite fields that show one message for several controls. */\n invalid?: boolean;\n /** Adds a search box above the list (Figma \"Type=Currency, State=Open\"); typing filters by label, detail and description. */\n searchable?: boolean;\n /** Placeholder and accessible name of the search box. */\n searchPlaceholder?: string;\n /** Shown instead of the list when the search matches nothing. */\n emptyText?: ReactNode;\n /** Icon in front of the value, e.g. `<LanguageIcon />`. */\n startIcon?: ReactNode;\n /** Custom content for the selected option in the field (single select), e.g. flag + dial code. Defaults to its `label`. */\n renderValue?: (option: SelectOption) => ReactNode;\n /** Shows the check mark on the selected option (Figma \"Done\"). Ignored when `multiple`, which uses checkboxes. */\n checkmark?: boolean;\n /** `false` makes the field hug its content (Figma \"Both-icon-drop-down\", \"Language\", \"Type=Currency\"); the list is then as wide as its options. */\n fullWidth?: boolean;\n /** How the list lines up with the field. */\n align?: 'start' | 'center' | 'end';\n /** Whether the list is open (controlled; Figma \"State=Clicked\" / \"Open\"). */\n open?: boolean;\n /** Opens the list initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Element the list is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Element the list aligns to and takes its width from, when that is not the field itself (e.g. a whole phone-number row). */\n panelAnchor?: RefObject<HTMLElement | null>;\n /** Class for the list panel, which is rendered in a portal outside the root. */\n panelClassName?: string;\n /** Accessible name of a chip's × button (`multiple`), given the option's text. */\n removeLabel?: (optionText: string) => string;\n}\n\nexport interface SelectSingleProps extends SelectBaseProps {\n /** `true` turns the field into a multi-select (Figma \"Type=Checkbox\"): checkboxes in the list, removable chips in the field. */\n multiple?: false;\n /** Selected option value (controlled); `null` or `''` for none. */\n value?: string | null;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string | null;\n /** Called with the chosen option's value. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface SelectMultipleProps extends SelectBaseProps {\n multiple: true;\n /** Selected option values (controlled). */\n value?: string[];\n /** Initially selected values (uncontrolled). */\n defaultValue?: string[];\n /** Called with all selected values after one is added or removed. */\n onValueChange?: (value: string[]) => void;\n}\n\nexport type SelectProps = SelectSingleProps | SelectMultipleProps;\n\nconst toArray = (value: string | string[] | null | undefined): string[] => (Array.isArray(value) ? value : value == null || value === '' ? [] : [value]);\nconst asText = (node: ReactNode): string => (typeof node === 'string' || typeof node === 'number' ? String(node) : '');\nconst optionText = (option: SelectOption): string => option.textValue ?? (asText(option.label) || option.value);\nconst matches = (option: SelectOption, query: string): boolean =>\n [optionText(option), asText(option.detail), asText(option.description)].some((text) => text.toLowerCase().includes(query));\nconst isPrintable = (event: KeyboardEvent): boolean => event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;\nconst defaultRemoveLabel = (optionText: string) => `Remove ${optionText}`;\n\ntype InitialFocus = 'selected' | 'first' | 'last' | 'none';\n\n/**\n * Figma component set \"Drop down inputs\" (Type=Select · Checkbox, and the base of Language · Phone · Currency):\n * a field that opens a list of options. Keyboard support follows the WAI-ARIA select-only combobox pattern.\n * The ref and any extra props go to the trigger `<button role=\"combobox\">`; `className` goes to the root.\n */\nexport const Select = /* @__PURE__ */ forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n label,\n helperText,\n error,\n required,\n optional,\n size = 'md',\n options,\n placeholder = 'Select option',\n name,\n invalid: invalidProp,\n searchable = false,\n searchPlaceholder = 'Search',\n emptyText = 'No results',\n startIcon,\n renderValue,\n checkmark = true,\n fullWidth = true,\n align = 'start',\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n portalContainer,\n panelAnchor,\n panelClassName,\n removeLabel = defaultRemoveLabel,\n multiple = false,\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n id,\n className,\n style,\n onKeyDown,\n onKeyUp,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n) {\n const ids = useFieldIds(id, Boolean(error || helperText));\n const listId = `${ids.controlId}-list`;\n const optionId = (index: number) => `${ids.controlId}-option-${index}`;\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalValue, setInternalValue] = useState<string[]>(() => toArray(defaultValue));\n const [query, setQuery] = useState('');\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const keepFocusOnClose = useRef(false);\n const typed = useRef({ text: '', timer: 0 });\n\n const isOpen = (openProp ?? internalOpen) && !disabled;\n const selectedValues = value !== undefined ? toArray(value) : internalValue;\n const selectedOptions = selectedValues.map((selected) => options.find((option) => option.value === selected)).filter((option) => option !== undefined);\n const invalid = Boolean(error) || Boolean(invalidProp);\n\n const needle = searchable ? query.trim().toLowerCase() : '';\n const visible = needle ? options.filter((option) => matches(option, needle)) : options;\n const enabled = visible.filter((option) => !option.disabled);\n const activeOption = enabled.find((option) => option.value === activeValue);\n const activeId = activeOption ? optionId(options.indexOf(activeOption)) : undefined;\n\n useEffect(() => {\n if (isOpen && activeId) document.getElementById(activeId)?.scrollIntoView?.({ block: 'nearest' });\n }, [isOpen, activeId]);\n\n useEffect(() => () => window.clearTimeout(typed.current.timer), []);\n\n const setOpen = (next: boolean, focus: InitialFocus = 'none') => {\n if (next) {\n const candidates = options.filter((option) => !option.disabled);\n const selected = candidates.find((option) => selectedValues.includes(option.value));\n const initial = focus === 'none' ? undefined : focus === 'last' ? candidates[candidates.length - 1] : focus === 'first' ? candidates[0] : (selected ?? candidates[0]);\n setQuery('');\n setActiveValue(initial?.value ?? null);\n }\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const emit = (next: string[]) => {\n if (value === undefined) setInternalValue(next);\n const notify = onValueChange as ((next: string | string[]) => void) | undefined;\n if (multiple) notify?.(next);\n else if (next[0] !== undefined) notify?.(next[0]);\n };\n\n const toggle = (optionValue: string) =>\n emit(selectedValues.includes(optionValue) ? selectedValues.filter((selected) => selected !== optionValue) : [...selectedValues, optionValue]);\n\n const commit = (option: SelectOption) => {\n if (option.disabled) return;\n if (multiple) {\n toggle(option.value);\n setActiveValue(option.value);\n return;\n }\n if (selectedValues[0] !== option.value) emit([option.value]);\n setOpen(false);\n };\n\n const move = (to: 1 | -1 | 'first' | 'last') => {\n if (enabled.length === 0) return;\n const current = activeOption ? enabled.indexOf(activeOption) : -1;\n let next: number;\n if (to === 'first') next = 0;\n else if (to === 'last') next = enabled.length - 1;\n else if (current === -1) {\n // Opened with the pointer: start from the selected option, like a native select.\n const selected = enabled.findIndex((option) => selectedValues.includes(option.value));\n next = selected !== -1 ? selected : to === 1 ? 0 : enabled.length - 1;\n } else next = Math.min(enabled.length - 1, Math.max(0, current + to));\n setActiveValue(enabled[next].value);\n };\n\n /** Type-ahead: the typed characters jump to the next option starting with them; repeating one letter cycles. */\n const typeAhead = (char: string) => {\n const state = typed.current;\n window.clearTimeout(state.timer);\n state.text += char.toLowerCase();\n state.timer = window.setTimeout(() => (state.text = ''), 500);\n const candidates = options.filter((option) => !option.disabled);\n const current = candidates.findIndex((option) => option.value === activeValue);\n const repeated = state.text.split('').every((letter) => letter === state.text[0]);\n const term = repeated ? state.text[0] : state.text;\n const from = repeated || state.text.length === 1 ? current + 1 : Math.max(current, 0);\n const ordered = [...candidates.slice(from), ...candidates.slice(0, from)];\n const match = ordered.find((option) => optionText(option).toLowerCase().startsWith(term));\n if (match) setActiveValue(match.value);\n };\n\n const handleListKeys = (event: KeyboardEvent<HTMLElement>, source: 'trigger' | 'search') => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) setOpen(false);\n else move(-1);\n break;\n case 'Home':\n case 'End':\n // In the search box these keys move the caret.\n if (source === 'trigger') {\n event.preventDefault();\n move(event.key === 'Home' ? 'first' : 'last');\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (activeOption) commit(activeOption);\n break;\n case 'Tab':\n if (source === 'search') {\n // The panel lives in a portal at the end of the document: go back to the field instead of tabbing out of the page.\n event.preventDefault();\n } else keepFocusOnClose.current = true;\n setOpen(false);\n break;\n default:\n }\n };\n\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' ', 'Home', 'End'].includes(event.key)) {\n event.preventDefault();\n setOpen(true, event.key === 'Home' ? 'first' : event.key === 'End' ? 'last' : 'selected');\n } else if (isPrintable(event)) {\n event.preventDefault();\n setOpen(true);\n if (searchable) search(event.key);\n else typeAhead(event.key);\n }\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n // A space while typing ahead belongs to the search text (\"New York\").\n if (typed.current.text) typeAhead(' ');\n else if (activeOption) commit(activeOption);\n } else if (isPrintable(event) && !searchable) {\n event.preventDefault();\n typeAhead(event.key);\n } else handleListKeys(event, 'trigger');\n };\n\n /** Filters the list and puts the keyboard on the first match. */\n const search = (next: string) => {\n const term = next.trim().toLowerCase();\n setQuery(next);\n setActiveValue(options.find((option) => !option.disabled && (!term || matches(option, term)))?.value ?? null);\n };\n\n const single = !multiple ? selectedOptions[0] : undefined;\n const hasChips = multiple && selectedOptions.length > 0;\n const Chevron = isOpen ? UpArrowIcon : DownArrowIcon;\n\n const control = (\n <div\n className=\"tm-field tm-select__control\"\n data-size={size}\n data-tm-icon-size={size}\n data-invalid={invalid ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n data-focus={isOpen ? '' : undefined}\n data-has-chips={hasChips ? '' : undefined}\n >\n {hasChips ? (\n <span className=\"tm-select__chips\">\n {selectedOptions.map((option) => (\n <SelectedItem\n key={option.value}\n size={size}\n disabled={disabled}\n removeLabel={removeLabel(optionText(option))}\n onRemove={() => toggle(option.value)}\n >\n {option.label}\n </SelectedItem>\n ))}\n </span>\n ) : null}\n <Popover.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n id={ids.controlId}\n className=\"tm-select__trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && !searchable ? activeId : undefined}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-describedby={cn(ariaDescribedBy, ids.messageId) || undefined}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n disabled={disabled}\n onKeyDown={handleTriggerKeyDown}\n onKeyUp={(event) => {\n onKeyUp?.(event);\n // Firefox clicks a button on Space keyup; the keydown handler has already acted on it.\n if (event.key === ' ') event.preventDefault();\n }}\n {...props}\n >\n {startIcon}\n {single ? (\n <span className=\"tm-select__value\">{renderValue ? renderValue(single) : single.label}</span>\n ) : hasChips ? (\n // The chips sit outside the button; this keeps the selection in the combobox's own text for assistive technology.\n <span className=\"tm-select__value tm-select__value--hidden\">{selectedOptions.map(optionText).join(', ')}</span>\n ) : (\n <span className=\"tm-select__value\" data-placeholder=\"\">\n {placeholder}\n </span>\n )}\n <Chevron className=\"tm-select__chevron\" />\n </button>\n </Popover.Trigger>\n </div>\n );\n\n return (\n <Popover.Root open={isOpen} onOpenChange={(next) => setOpen(next)}>\n <FormField\n ids={ids}\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n optional={optional}\n size={size}\n className={cn('tm-select', className)}\n style={style}\n data-full-width={fullWidth ? '' : undefined}\n >\n {panelAnchor ? (\n <>\n <Popover.Anchor virtualRef={panelAnchor as RefObject<HTMLElement>} />\n {control}\n </>\n ) : (\n <Popover.Anchor asChild>{control}</Popover.Anchor>\n )}\n {name\n ? (multiple ? selectedValues : [selectedValues[0] ?? '']).map((selected) => (\n <input key={selected} type=\"hidden\" name={name} value={selected} disabled={disabled} />\n ))\n : null}\n </FormField>\n <Popover.Portal container={portalContainer}>\n <Popover.Content\n // The combobox owns the listbox directly; the popover wrapper is only a surface.\n role=\"presentation\"\n className={cn('tm-option-panel tm-select__panel', panelClassName)}\n data-size={size}\n data-fit={fullWidth ? 'field' : 'content'}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n onOpenAutoFocus={(event) => {\n // Select-only combobox: focus stays on the field (or moves to the search box) and the active option is announced through aria-activedescendant.\n event.preventDefault();\n searchRef.current?.focus();\n }}\n onCloseAutoFocus={(event) => {\n if (keepFocusOnClose.current) event.preventDefault();\n keepFocusOnClose.current = false;\n }}\n >\n {searchable ? (\n <div className=\"tm-select__search\">\n <SearchIcon size=\"sm\" />\n <input\n ref={searchRef}\n className=\"tm-select__search-input\"\n type=\"text\"\n role=\"combobox\"\n aria-label={searchPlaceholder}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={activeId}\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchPlaceholder}\n value={query}\n onChange={(event) => search(event.target.value)}\n onKeyDown={(event) => handleListKeys(event, 'search')}\n />\n </div>\n ) : null}\n <OptionList\n id={listId}\n size={size}\n multiple={multiple}\n surface={false}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : props['aria-label']}\n // Keeps focus on the field (or the search box) while the pointer picks an option.\n onMouseDown={(event) => event.preventDefault()}\n >\n {visible.map((option) => (\n <Option\n key={option.value}\n id={optionId(options.indexOf(option))}\n selected={selectedValues.includes(option.value)}\n active={option === activeOption}\n disabled={option.disabled}\n icon={option.icon}\n detail={option.detail}\n description={option.description}\n indicator={multiple ? 'checkbox' : checkmark ? 'check' : 'none'}\n onClick={() => commit(option)}\n >\n {option.label}\n </Option>\n ))}\n </OptionList>\n {visible.length === 0 ? (\n <p className=\"tm-select__empty\" role=\"status\">\n {emptyText}\n </p>\n ) : null}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":";;;;;;;;;;;;;AAuGA,IAAMG,MAAW,MAA2D,MAAM,QAAQC,CAAK,IAAIA,IAAQA,KAAS,QAAQA,MAAU,KAAK,CAAC,IAAI,CAACA,CAAK,GAChJC,KAAU,MAA6B,OAAOC,KAAS,YAAY,OAAOA,KAAS,WAAW,OAAOA,CAAI,IAAI,IAC7GC,KAAc,MAAiCC,EAAO,cAAcH,EAAOG,EAAO,KAAK,KAAKA,EAAO,QACnGC,KAAW,GAAsB,MACrC;CAACF,EAAWC,CAAM;CAAGH,EAAOG,EAAO,MAAM;CAAGH,EAAOG,EAAO,WAAW;AAAC,CAAC,CAAC,MAAM,MAASE,EAAK,YAAY,CAAC,CAAC,SAASC,CAAK,CAAC,GACrHC,KAAe,MAAkCC,EAAM,IAAI,WAAW,KAAK,CAACA,EAAM,WAAW,CAACA,EAAM,WAAW,CAACA,EAAM,QACtHC,MAAsB,MAAuB,UAAUP,KAShDQ,IAAyB,kBAA2C,SAC/E,EACE,UACA,eACA,UACA,aACA,cACA,UAAO,MACP,YACA,kBAAc,iBACd,UACA,SAASC,IACT,gBAAa,IACb,wBAAoB,UACpB,gBAAY,cACZ,eACA,iBACA,gBAAY,IACZ,gBAAY,IACZ,YAAQ,SACR,MAAMC,IACN,kBAAc,IACd,kBACA,qBACA,gBACA,oBACA,kBAAcH,IACd,cAAW,IACX,UACA,kBACA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ACE,kBAAC0D,GAAD,EAAY,MAAK,KAAM,CAAA,GACvB,kBAAC,SAAD;OACE,KAAKtE;OACL,WAAU;OACV,MAAK;OACL,MAAK;OACL,cAAYuE;OACZ,iBAAc;OACd,iBAAepF;OACf,qBAAkB;OAClB,yBAAuB6B;OACvB,cAAa;OACb,YAAY;OACZ,aAAauD;OACb,OAAOnG;OACP,WAAW,MAAU0E,EAAOxE,EAAM,OAAO,KAAK;OAC9C,YAAY,MAAUoE,GAAepE,GAAO,QAAQ;MACrD,CAAA,CACE;KACH,CAAA,IAAA;KACJ,kBAACkG,GAAD;MACE,IAAIrF;MACE;MACI;MACV,SAAS;MACT,mBAAiBP,MAAmB4E,IAAQ1E,EAAI,UAAU,KAAA;MAC1D,cAAYF,KAAkB4E,IAAQ,KAAA,IAAY3E,EAAM;MAExD,cAAc,MAAUP,EAAM,eAAe;MAE5C,UAAAuC,EAAQ,KAAK,MACZ,kBAAC4D,GAAD;OAEE,IAAIrF,EAASoB,EAAQ,QAAQvC,CAAM,CAAC;OACpC,UAAUqC,EAAe,SAASrC,EAAO,KAAK;OAC9C,QAAQA,MAAW8C;OACnB,UAAU9C,EAAO;OACjB,MAAMA,EAAO;OACb,QAAQA,EAAO;OACf,aAAaA,EAAO;OACpB,WAAW0D,IAAW,aAAa+C,KAAY,UAAU;OACzD,eAAe5C,EAAO7D,CAAM;OAE3B,UAAAA,EAAO;MACF,GAZDA,EAAO,KAYN,CACT;KACS,CAAA;KACX4C,EAAQ,WAAW,IAClB,kBAAC,KAAD;MAAG,WAAU;MAAmB,MAAK;MAClC,UAAA8D;KACA,CAAA,IACD;IACW;;EACH,CAAA,CACJ;;AAElB,CAAC"}
1
+ {"version":3,"file":"Select.js","names":["_Fragment","Fragment$1","Popover","toArray","value","asText","node","optionText","option","matches","text","query","isPrintable","event","defaultRemoveLabel","Select","invalidProp","openProp","ariaDescribedBy","ariaLabelledBy","props","ids","useFieldIds","id","error","helperText","listId","optionId","index","internalOpen","setInternalOpen","useState","defaultOpen","internalValue","setInternalValue","defaultValue","setQuery","activeValue","setActiveValue","searchRef","useRef","keepFocusOnClose","typed","isOpen","disabled","anchorVersion","setAnchorVersion","panelAnchor","version","virtualAnchor","useMemo","selectedValues","selectedOptions","options","selected","invalid","needle","searchable","visible","enabled","activeOption","activeId","useEffect","setOpen","next","candidates","initial","focus","onOpenChange","emit","notify","onValueChange","multiple","toggle","optionValue","commit","move","current","to","typeAhead","state","char","repeated","letter","term","from","match","handleListKeys","source","handleTriggerKeyDown","onKeyDown","search","single","hasChips","Chevron","UpArrowIcon","DownArrowIcon","control","size","SelectedItem","removeLabel","label","cn","required","onKeyUp","startIcon","renderValue","placeholder","FormField","className","fullWidth","name","portalContainer","panelClassName","SearchIcon","searchPlaceholder","OptionList","Option","checkmark","emptyText"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport { DownArrowIcon, SearchIcon, UpArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { FormField, useFieldIds, type FieldSize, type FormFieldProps } from '../Field';\nimport { Option, OptionList } from '../OptionList';\nimport { SelectedItem } from './SelectedItem';\nimport './Select.css';\n\nexport interface SelectOption {\n /** What `value` / `onValueChange` carry and what a form submits. */\n value: string;\n /** Text in the list and in the field, e.g. \"Armenia\", \"EN\", \"AMD\". */\n label: ReactNode;\n /** Regular-weight text after the label in the list only, e.g. \"English\" after \"EN\". */\n detail?: ReactNode;\n /** Small second line in the list (Figma \"Caption\"). */\n description?: ReactNode;\n /** Icon or flag before the label in the list (Figma \"Icon\"). */\n icon?: ReactNode;\n /** The option is shown but cannot be chosen. */\n disabled?: boolean;\n /** Plain text for type-ahead, search and the remove button when `label` is not a string. */\n textValue?: string;\n}\n\ntype TriggerProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'defaultValue' | 'onChange' | 'children' | 'type' | 'name' | 'role'>;\n\ninterface SelectBaseProps extends FormFieldProps, TriggerProps {\n /** The options, in display order. */\n options: SelectOption[];\n /** Shown in the field while nothing is selected. */\n placeholder?: ReactNode;\n /** Figma \"Size\": `lg` 52px · `md` 46px (default) · `sm` 42px. */\n size?: FieldSize;\n /** Adds hidden inputs so the value is submitted with a native form (one per value when `multiple`). */\n name?: string;\n /** Invalid look without a message of its own — for composite fields that show one message for several controls. */\n invalid?: boolean;\n /** Adds a search box above the list (Figma \"Type=Currency, State=Open\"); typing filters by label, detail and description. */\n searchable?: boolean;\n /** Placeholder and accessible name of the search box. */\n searchPlaceholder?: string;\n /** Shown instead of the list when the search matches nothing. */\n emptyText?: ReactNode;\n /** Icon in front of the value, e.g. `<LanguageIcon />`. */\n startIcon?: ReactNode;\n /** Custom content for the selected option in the field (single select), e.g. flag + dial code. Defaults to its `label`. */\n renderValue?: (option: SelectOption) => ReactNode;\n /** Shows the check mark on the selected option (Figma \"Done\"). Ignored when `multiple`, which uses checkboxes. */\n checkmark?: boolean;\n /** `false` makes the field hug its content (Figma \"Both-icon-drop-down\", \"Language\", \"Type=Currency\"); the list is then as wide as its options. */\n fullWidth?: boolean;\n /** How the list lines up with the field. */\n align?: 'start' | 'center' | 'end';\n /** Whether the list is open (controlled; Figma \"State=Clicked\" / \"Open\"). */\n open?: boolean;\n /** Opens the list initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the list opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** Element the list is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Element the list aligns to and takes its width from, when that is not the field itself (e.g. a whole phone-number row). */\n panelAnchor?: RefObject<HTMLElement | null>;\n /** Class for the list panel, which is rendered in a portal outside the root. */\n panelClassName?: string;\n /** Accessible name of a chip's × button (`multiple`), given the option's text. */\n removeLabel?: (optionText: string) => string;\n}\n\nexport interface SelectSingleProps extends SelectBaseProps {\n /** `true` turns the field into a multi-select (Figma \"Type=Checkbox\"): checkboxes in the list, removable chips in the field. */\n multiple?: false;\n /** Selected option value (controlled); `null` or `''` for none. */\n value?: string | null;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string | null;\n /** Called with the chosen option's value. */\n onValueChange?: (value: string) => void;\n}\n\nexport interface SelectMultipleProps extends SelectBaseProps {\n multiple: true;\n /** Selected option values (controlled). */\n value?: string[];\n /** Initially selected values (uncontrolled). */\n defaultValue?: string[];\n /** Called with all selected values after one is added or removed. */\n onValueChange?: (value: string[]) => void;\n}\n\nexport type SelectProps = SelectSingleProps | SelectMultipleProps;\n\nconst toArray = (value: string | string[] | null | undefined): string[] => (Array.isArray(value) ? value : value == null || value === '' ? [] : [value]);\nconst asText = (node: ReactNode): string => (typeof node === 'string' || typeof node === 'number' ? String(node) : '');\nconst optionText = (option: SelectOption): string => option.textValue ?? (asText(option.label) || option.value);\nconst matches = (option: SelectOption, query: string): boolean =>\n [optionText(option), asText(option.detail), asText(option.description)].some((text) => text.toLowerCase().includes(query));\nconst isPrintable = (event: KeyboardEvent): boolean => event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey;\nconst defaultRemoveLabel = (optionText: string) => `Remove ${optionText}`;\n\ntype InitialFocus = 'selected' | 'first' | 'last' | 'none';\n\n/**\n * Figma component set \"Drop down inputs\" (Type=Select · Checkbox, and the base of Language · Phone · Currency):\n * a field that opens a list of options. Keyboard support follows the WAI-ARIA select-only combobox pattern.\n * The ref and any extra props go to the trigger `<button role=\"combobox\">`; `className` goes to the root.\n */\nexport const Select = /* @__PURE__ */ forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n label,\n helperText,\n error,\n required,\n optional,\n size = 'md',\n options,\n placeholder = 'Select option',\n name,\n invalid: invalidProp,\n searchable = false,\n searchPlaceholder = 'Search',\n emptyText = 'No results',\n startIcon,\n renderValue,\n checkmark = true,\n fullWidth = true,\n align = 'start',\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n portalContainer,\n panelAnchor,\n panelClassName,\n removeLabel = defaultRemoveLabel,\n multiple = false,\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n id,\n className,\n style,\n onKeyDown,\n onKeyUp,\n 'aria-describedby': ariaDescribedBy,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n) {\n const ids = useFieldIds(id, Boolean(error || helperText));\n const listId = `${ids.controlId}-list`;\n const optionId = (index: number) => `${ids.controlId}-option-${index}`;\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalValue, setInternalValue] = useState<string[]>(() => toArray(defaultValue));\n const [query, setQuery] = useState('');\n const [activeValue, setActiveValue] = useState<string | null>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const keepFocusOnClose = useRef(false);\n const typed = useRef({ text: '', timer: 0 });\n\n const isOpen = (openProp ?? internalOpen) && !disabled;\n\n // `panelAnchor`: the list is positioned against a \"virtual\" element that measures the anchor each time it is asked.\n // Radix registers a virtual anchor only when its object changes, and it can end up holding the trigger instead:\n // on mount the trigger briefly registers itself as the anchor and is then replaced by a new button, which leaves\n // a removed element (measured as 0 × 0 at the top left of the page, so the list opened there; seen with React\n // Strict Mode and server rendering). A fresh object after mount and whenever the list opens or closes makes Radix\n // take the right anchor again.\n const [anchorVersion, setAnchorVersion] = useState(0);\n useEffect(() => {\n if (panelAnchor) setAnchorVersion((version) => version + 1);\n }, [panelAnchor, isOpen]);\n const virtualAnchor = useMemo(\n () => ({\n current: {\n getBoundingClientRect: () => panelAnchor?.current?.getBoundingClientRect() ?? new DOMRect(),\n // lets the positioning follow the anchor's scrolling ancestors\n contextElement: panelAnchor?.current ?? undefined,\n },\n }),\n // anchorVersion is listed on purpose: a new object per version\n [panelAnchor, anchorVersion],\n );\n const selectedValues = value !== undefined ? toArray(value) : internalValue;\n const selectedOptions = selectedValues.map((selected) => options.find((option) => option.value === selected)).filter((option) => option !== undefined);\n const invalid = Boolean(error) || Boolean(invalidProp);\n\n const needle = searchable ? query.trim().toLowerCase() : '';\n const visible = needle ? options.filter((option) => matches(option, needle)) : options;\n const enabled = visible.filter((option) => !option.disabled);\n const activeOption = enabled.find((option) => option.value === activeValue);\n const activeId = activeOption ? optionId(options.indexOf(activeOption)) : undefined;\n\n useEffect(() => {\n if (isOpen && activeId) document.getElementById(activeId)?.scrollIntoView?.({ block: 'nearest' });\n }, [isOpen, activeId]);\n\n useEffect(() => () => window.clearTimeout(typed.current.timer), []);\n\n const setOpen = (next: boolean, focus: InitialFocus = 'none') => {\n if (next) {\n const candidates = options.filter((option) => !option.disabled);\n const selected = candidates.find((option) => selectedValues.includes(option.value));\n const initial = focus === 'none' ? undefined : focus === 'last' ? candidates[candidates.length - 1] : focus === 'first' ? candidates[0] : (selected ?? candidates[0]);\n setQuery('');\n setActiveValue(initial?.value ?? null);\n }\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n const emit = (next: string[]) => {\n if (value === undefined) setInternalValue(next);\n const notify = onValueChange as ((next: string | string[]) => void) | undefined;\n if (multiple) notify?.(next);\n else if (next[0] !== undefined) notify?.(next[0]);\n };\n\n const toggle = (optionValue: string) =>\n emit(selectedValues.includes(optionValue) ? selectedValues.filter((selected) => selected !== optionValue) : [...selectedValues, optionValue]);\n\n const commit = (option: SelectOption) => {\n if (option.disabled) return;\n if (multiple) {\n toggle(option.value);\n setActiveValue(option.value);\n return;\n }\n if (selectedValues[0] !== option.value) emit([option.value]);\n setOpen(false);\n };\n\n const move = (to: 1 | -1 | 'first' | 'last') => {\n if (enabled.length === 0) return;\n const current = activeOption ? enabled.indexOf(activeOption) : -1;\n let next: number;\n if (to === 'first') next = 0;\n else if (to === 'last') next = enabled.length - 1;\n else if (current === -1) {\n // Opened with the pointer: start from the selected option, like a native select.\n const selected = enabled.findIndex((option) => selectedValues.includes(option.value));\n next = selected !== -1 ? selected : to === 1 ? 0 : enabled.length - 1;\n } else next = Math.min(enabled.length - 1, Math.max(0, current + to));\n setActiveValue(enabled[next].value);\n };\n\n /** Type-ahead: the typed characters jump to the next option starting with them; repeating one letter cycles. */\n const typeAhead = (char: string) => {\n const state = typed.current;\n window.clearTimeout(state.timer);\n state.text += char.toLowerCase();\n state.timer = window.setTimeout(() => (state.text = ''), 500);\n const candidates = options.filter((option) => !option.disabled);\n const current = candidates.findIndex((option) => option.value === activeValue);\n const repeated = state.text.split('').every((letter) => letter === state.text[0]);\n const term = repeated ? state.text[0] : state.text;\n const from = repeated || state.text.length === 1 ? current + 1 : Math.max(current, 0);\n const ordered = [...candidates.slice(from), ...candidates.slice(0, from)];\n const match = ordered.find((option) => optionText(option).toLowerCase().startsWith(term));\n if (match) setActiveValue(match.value);\n };\n\n const handleListKeys = (event: KeyboardEvent<HTMLElement>, source: 'trigger' | 'search') => {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n move(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (event.altKey) setOpen(false);\n else move(-1);\n break;\n case 'Home':\n case 'End':\n // In the search box these keys move the caret.\n if (source === 'trigger') {\n event.preventDefault();\n move(event.key === 'Home' ? 'first' : 'last');\n }\n break;\n case 'Enter':\n event.preventDefault();\n if (activeOption) commit(activeOption);\n break;\n case 'Tab':\n if (source === 'search') {\n // The panel lives in a portal at the end of the document: go back to the field instead of tabbing out of the page.\n event.preventDefault();\n } else keepFocusOnClose.current = true;\n setOpen(false);\n break;\n default:\n }\n };\n\n const handleTriggerKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n if (!isOpen) {\n if (['ArrowDown', 'ArrowUp', 'Enter', ' ', 'Home', 'End'].includes(event.key)) {\n event.preventDefault();\n setOpen(true, event.key === 'Home' ? 'first' : event.key === 'End' ? 'last' : 'selected');\n } else if (isPrintable(event)) {\n event.preventDefault();\n setOpen(true);\n if (searchable) search(event.key);\n else typeAhead(event.key);\n }\n return;\n }\n if (event.key === ' ') {\n event.preventDefault();\n // A space while typing ahead belongs to the search text (\"New York\").\n if (typed.current.text) typeAhead(' ');\n else if (activeOption) commit(activeOption);\n } else if (isPrintable(event) && !searchable) {\n event.preventDefault();\n typeAhead(event.key);\n } else handleListKeys(event, 'trigger');\n };\n\n /** Filters the list and puts the keyboard on the first match. */\n const search = (next: string) => {\n const term = next.trim().toLowerCase();\n setQuery(next);\n setActiveValue(options.find((option) => !option.disabled && (!term || matches(option, term)))?.value ?? null);\n };\n\n const single = !multiple ? selectedOptions[0] : undefined;\n const hasChips = multiple && selectedOptions.length > 0;\n const Chevron = isOpen ? UpArrowIcon : DownArrowIcon;\n\n const control = (\n <div\n className=\"tm-field tm-select__control\"\n data-size={size}\n data-tm-icon-size={size}\n data-invalid={invalid ? '' : undefined}\n data-disabled={disabled ? '' : undefined}\n data-focus={isOpen ? '' : undefined}\n data-has-chips={hasChips ? '' : undefined}\n >\n {hasChips ? (\n <span className=\"tm-select__chips\">\n {selectedOptions.map((option) => (\n <SelectedItem\n key={option.value}\n size={size}\n disabled={disabled}\n removeLabel={removeLabel(optionText(option))}\n onRemove={() => toggle(option.value)}\n >\n {option.label}\n </SelectedItem>\n ))}\n </span>\n ) : null}\n <Popover.Trigger asChild>\n <button\n ref={ref}\n type=\"button\"\n id={ids.controlId}\n className=\"tm-select__trigger\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n aria-controls={isOpen ? listId : undefined}\n aria-activedescendant={isOpen && !searchable ? activeId : undefined}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-describedby={cn(ariaDescribedBy, ids.messageId) || undefined}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n disabled={disabled}\n onKeyDown={handleTriggerKeyDown}\n onKeyUp={(event) => {\n onKeyUp?.(event);\n // Firefox clicks a button on Space keyup; the keydown handler has already acted on it.\n if (event.key === ' ') event.preventDefault();\n }}\n {...props}\n >\n {startIcon}\n {single ? (\n <span className=\"tm-select__value\">{renderValue ? renderValue(single) : single.label}</span>\n ) : hasChips ? (\n // The chips sit outside the button; this keeps the selection in the combobox's own text for assistive technology.\n <span className=\"tm-select__value tm-select__value--hidden\">{selectedOptions.map(optionText).join(', ')}</span>\n ) : (\n <span className=\"tm-select__value\" data-placeholder=\"\">\n {placeholder}\n </span>\n )}\n <Chevron className=\"tm-select__chevron\" />\n </button>\n </Popover.Trigger>\n </div>\n );\n\n return (\n <Popover.Root open={isOpen} onOpenChange={(next) => setOpen(next)}>\n <FormField\n ids={ids}\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n optional={optional}\n size={size}\n className={cn('tm-select', className)}\n style={style}\n data-full-width={fullWidth ? '' : undefined}\n >\n {panelAnchor ? (\n <>\n <Popover.Anchor virtualRef={virtualAnchor} />\n {control}\n </>\n ) : (\n <Popover.Anchor asChild>{control}</Popover.Anchor>\n )}\n {name\n ? (multiple ? selectedValues : [selectedValues[0] ?? '']).map((selected) => (\n <input key={selected} type=\"hidden\" name={name} value={selected} disabled={disabled} />\n ))\n : null}\n </FormField>\n <Popover.Portal container={portalContainer}>\n <Popover.Content\n // The combobox owns the listbox directly; the popover wrapper is only a surface.\n role=\"presentation\"\n className={cn('tm-option-panel tm-select__panel', panelClassName)}\n data-size={size}\n data-fit={fullWidth ? 'field' : 'content'}\n align={align}\n sideOffset={8}\n collisionPadding={8}\n onOpenAutoFocus={(event) => {\n // Select-only combobox: focus stays on the field (or moves to the search box) and the active option is announced through aria-activedescendant.\n event.preventDefault();\n searchRef.current?.focus();\n }}\n onCloseAutoFocus={(event) => {\n if (keepFocusOnClose.current) event.preventDefault();\n keepFocusOnClose.current = false;\n }}\n >\n {searchable ? (\n <div className=\"tm-select__search\">\n <SearchIcon size=\"sm\" />\n <input\n ref={searchRef}\n className=\"tm-select__search-input\"\n type=\"text\"\n role=\"combobox\"\n aria-label={searchPlaceholder}\n aria-expanded=\"true\"\n aria-controls={listId}\n aria-autocomplete=\"list\"\n aria-activedescendant={activeId}\n autoComplete=\"off\"\n spellCheck={false}\n placeholder={searchPlaceholder}\n value={query}\n onChange={(event) => search(event.target.value)}\n onKeyDown={(event) => handleListKeys(event, 'search')}\n />\n </div>\n ) : null}\n <OptionList\n id={listId}\n size={size}\n multiple={multiple}\n surface={false}\n aria-labelledby={ariaLabelledBy ?? (label ? ids.labelId : undefined)}\n aria-label={ariaLabelledBy || label ? undefined : props['aria-label']}\n // Keeps focus on the field (or the search box) while the pointer picks an option.\n onMouseDown={(event) => event.preventDefault()}\n >\n {visible.map((option) => (\n <Option\n key={option.value}\n id={optionId(options.indexOf(option))}\n selected={selectedValues.includes(option.value)}\n active={option === activeOption}\n disabled={option.disabled}\n icon={option.icon}\n detail={option.detail}\n description={option.description}\n indicator={multiple ? 'checkbox' : checkmark ? 'check' : 'none'}\n onClick={() => commit(option)}\n >\n {option.label}\n </Option>\n ))}\n </OptionList>\n {visible.length === 0 ? (\n <p className=\"tm-select__empty\" role=\"status\">\n {emptyText}\n </p>\n ) : null}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":";;;;;;;;;;;;;AAwGA,IAAMG,KAAW,MAA2D,MAAM,QAAQC,CAAK,IAAIA,IAAQA,KAAS,QAAQA,MAAU,KAAK,CAAC,IAAI,CAACA,CAAK,GAChJC,KAAU,MAA6B,OAAOC,KAAS,YAAY,OAAOA,KAAS,WAAW,OAAOA,CAAI,IAAI,IAC7GC,KAAc,MAAiCC,EAAO,cAAcH,EAAOG,EAAO,KAAK,KAAKA,EAAO,QACnGC,KAAW,GAAsB,MACrC;CAACF,EAAWC,CAAM;CAAGH,EAAOG,EAAO,MAAM;CAAGH,EAAOG,EAAO,WAAW;AAAC,CAAC,CAAC,MAAM,MAASE,EAAK,YAAY,CAAC,CAAC,SAASC,CAAK,CAAC,GACrHC,KAAe,MAAkCC,EAAM,IAAI,WAAW,KAAK,CAACA,EAAM,WAAW,CAACA,EAAM,WAAW,CAACA,EAAM,QACtHC,MAAsB,MAAuB,UAAUP,KAShDQ,IAAy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ACpC,UAAU2C,EAAe,SAAS3C,EAAO,KAAK;OAC9C,QAAQA,MAAWoD;OACnB,UAAUpD,EAAO;OACjB,MAAMA,EAAO;OACb,QAAQA,EAAO;OACf,aAAaA,EAAO;OACpB,WAAWgE,IAAW,aAAa8C,KAAY,UAAU;OACzD,eAAe3C,EAAOnE,CAAM;OAE3B,UAAAA,EAAO;MACF,GAZDA,EAAO,KAYN,CACT;KACS,CAAA;KACXkD,EAAQ,WAAW,IAClB,kBAAC,KAAD;MAAG,WAAU;MAAmB,MAAK;MAClC,UAAA6D;KACA,CAAA,IACD;IACW;;EACH,CAAA,CACJ;;AAElB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../icons/generated/EyeOpenIcon.cjs"),t=require("../../icons/generated/EyeSlashedIcon.cjs"),n=require("./TextInput.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)(function({showPasswordLabel:a=`Show password`,hidePasswordLabel:o=`Hide password`,defaultVisible:s=!1,onVisibleChange:c,disabled:l,...u},d){let[f,p]=(0,r.useState)(s),m=()=>{p(!f),c?.(!f)};return(0,i.jsx)(n.TextInput,{ref:d,...u,type:f?`text`:`password`,disabled:l,endIcon:(0,i.jsx)(`button`,{type:`button`,className:`tm-text-input__toggle`,"aria-label":f?o:a,disabled:l,onClick:m,children:f?(0,i.jsx)(t.EyeSlashedIcon,{}):(0,i.jsx)(e.EyeOpenIcon,{})})})});exports.PasswordInput=a;
1
+ "use client";const e=require("../../icons/generated/EyeOpenIcon.cjs"),t=require("../../icons/generated/EyeSlashedIcon.cjs"),n=require("./TextInput.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)(function({showPasswordLabel:a=`Show password`,hidePasswordLabel:o=`Hide password`,defaultVisible:s=!1,toggleIcon:c=`action`,onVisibleChange:l,disabled:u,...d},f){let[p,m]=(0,r.useState)(s),h=()=>{m(!p),l?.(!p)};return(0,i.jsx)(n.TextInput,{ref:f,...d,type:p?`text`:`password`,disabled:u,endIcon:(0,i.jsx)(`button`,{type:`button`,className:`tm-text-input__toggle`,"aria-label":p?o:a,disabled:u,onClick:h,children:p===(c===`action`)?(0,i.jsx)(t.EyeSlashedIcon,{}):(0,i.jsx)(e.EyeOpenIcon,{})})})});exports.PasswordInput=a;
2
2
  //# sourceMappingURL=PasswordInput.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordInput.cjs","names":["useState","TextInput","EyeSlashedIcon","EyeOpenIcon","require_EyeOpenIcon","require_EyeSlashedIcon","require_TextInput","react","react_jsx_runtime","PasswordInput","props","visible","setVisible","defaultVisible","toggle","onVisibleChange","hidePasswordLabel","showPasswordLabel"],"sources":["../../../src/components/TextInput/PasswordInput.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\nimport { EyeOpenIcon, EyeSlashedIcon } from '../../icons';\nimport { TextInput, type TextInputProps } from './TextInput';\n\nexport interface PasswordInputProps extends Omit<TextInputProps, 'type' | 'endIcon'> {\n /** Accessible name of the toggle while the password is hidden. Translate it. */\n showPasswordLabel?: string;\n /** Accessible name of the toggle while the password is visible. Translate it. */\n hidePasswordLabel?: string;\n /** Start with the password visible (Figma \"Type=Password-eye-slashed\"). */\n defaultVisible?: boolean;\n /** Called when the user shows or hides the password. */\n onVisibleChange?: (visible: boolean) => void;\n}\n\n/**\n * Figma \"Text inputs / Type=Password-eye-open · Password-eye-slashed\": a `TextInput` with a show/hide toggle.\n * The eye shows while the password is hidden, the slashed eye while it is readable. Figma also puts a\n * lock in front — pass `startIcon={<LockIcon />}` for that.\n */\nexport const PasswordInput = /* @__PURE__ */ forwardRef<HTMLInputElement, PasswordInputProps>(function PasswordInput(\n { showPasswordLabel = 'Show password', hidePasswordLabel = 'Hide password', defaultVisible = false, onVisibleChange, disabled, ...props },\n ref,\n) {\n const [visible, setVisible] = useState(defaultVisible);\n\n const toggle = () => {\n setVisible(!visible);\n onVisibleChange?.(!visible);\n };\n\n return (\n <TextInput\n ref={ref}\n {...props}\n type={visible ? 'text' : 'password'}\n disabled={disabled}\n endIcon={\n <button\n type=\"button\"\n className=\"tm-text-input__toggle\"\n aria-label={visible ? hidePasswordLabel : showPasswordLabel}\n disabled={disabled}\n onClick={toggle}\n >\n {visible ? <EyeSlashedIcon /> : <EyeOpenIcon />}\n </button>\n }\n />\n );\n});\n"],"mappings":"A,+MAoBA,IAAaS,GAAgC,EAAAF,EAAA,WAAA,CAAiD,SAC5F,CAAE,oBAAoB,gBAAiB,oBAAoB,gBAAiB,iBAAiB,GAAO,kBAAiB,WAAU,GAAGG,GAClI,EACA,CACA,GAAM,CAACC,EAASC,IAAA,EAAcZ,EAAAA,SAAAA,CAASa,CAAc,EAE/CC,MAAe,CACnBF,EAAW,CAACD,CAAO,EACnBI,IAAkB,CAACJ,CAAO,CAC5B,EAEA,OACE,EAAAH,EAAA,IAAA,CAACP,EAAAA,UAAD,CACO,MACL,GAAIS,EACJ,KAAMC,EAAU,OAAS,WACf,WACV,SACE,EAAAH,EAAA,IAAA,CAAC,SAAD,CACE,KAAK,SACL,UAAU,wBACV,aAAYG,EAAUK,EAAoBC,EAChC,WACV,QAASH,EAER,SAAAH,GAAU,EAAAH,EAAA,IAAA,CAACN,EAAAA,eAAD,CAAiB,CAAA,GAAI,EAAAM,EAAA,IAAA,CAACL,EAAAA,YAAD,CAAc,CAAA,CACxC,CAAA,CAEX,CAAA,CAEL,CAAC,E"}
1
+ {"version":3,"file":"PasswordInput.cjs","names":["useState","TextInput","EyeSlashedIcon","EyeOpenIcon","require_EyeOpenIcon","require_EyeSlashedIcon","require_TextInput","react","react_jsx_runtime","PasswordInput","props","visible","setVisible","defaultVisible","toggle","onVisibleChange","hidePasswordLabel","showPasswordLabel","toggleIcon"],"sources":["../../../src/components/TextInput/PasswordInput.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\nimport { EyeOpenIcon, EyeSlashedIcon } from '../../icons';\nimport { TextInput, type TextInputProps } from './TextInput';\n\nexport interface PasswordInputProps extends Omit<TextInputProps, 'type' | 'endIcon'> {\n /** Accessible name of the toggle while the password is hidden. Translate it. */\n showPasswordLabel?: string;\n /** Accessible name of the toggle while the password is visible. Translate it. */\n hidePasswordLabel?: string;\n /** Start with the password visible (Figma \"Type=Password-eye-slashed\"). */\n defaultVisible?: boolean;\n /**\n * What the toggle's icon stands for. `action` (default, as the component set draws its filled examples): the eye\n * while the password is hidden (\"show it\"), the slashed eye while it is readable. `state`, as the Authentication\n * screens use the same two variants: the slashed eye while the password is hidden, the eye while it is readable.\n */\n toggleIcon?: 'action' | 'state';\n /** Called when the user shows or hides the password. */\n onVisibleChange?: (visible: boolean) => void;\n}\n\n/**\n * Figma \"Text inputs / Type=Password-eye-open · Password-eye-slashed\": a `TextInput` with a show/hide toggle.\n * By default the eye shows while the password is hidden and the slashed eye while it is readable; `toggleIcon=\"state\"`\n * swaps them. Figma also puts a lock in front — pass `startIcon={<LockIcon />}` for that.\n */\nexport const PasswordInput = /* @__PURE__ */ forwardRef<HTMLInputElement, PasswordInputProps>(function PasswordInput(\n {\n showPasswordLabel = 'Show password',\n hidePasswordLabel = 'Hide password',\n defaultVisible = false,\n toggleIcon = 'action',\n onVisibleChange,\n disabled,\n ...props\n },\n ref,\n) {\n const [visible, setVisible] = useState(defaultVisible);\n\n const toggle = () => {\n setVisible(!visible);\n onVisibleChange?.(!visible);\n };\n\n return (\n <TextInput\n ref={ref}\n {...props}\n type={visible ? 'text' : 'password'}\n disabled={disabled}\n endIcon={\n <button\n type=\"button\"\n className=\"tm-text-input__toggle\"\n aria-label={visible ? hidePasswordLabel : showPasswordLabel}\n disabled={disabled}\n onClick={toggle}\n >\n {visible === (toggleIcon === 'action') ? <EyeSlashedIcon /> : <EyeOpenIcon />}\n </button>\n }\n />\n );\n});\n"],"mappings":"A,+MA0BA,IAAaS,GAAgC,EAAAF,EAAA,WAAA,CAAiD,SAC5F,CACE,oBAAoB,gBACpB,oBAAoB,gBACpB,iBAAiB,GACjB,aAAa,SACb,kBACA,WACA,GAAGG,GAEL,EACA,CACA,GAAM,CAACC,EAASC,IAAA,EAAcZ,EAAAA,SAAAA,CAASa,CAAc,EAE/CC,MAAe,CACnBF,EAAW,CAACD,CAAO,EACnBI,IAAkB,CAACJ,CAAO,CAC5B,EAEA,OACE,EAAAH,EAAA,IAAA,CAACP,EAAAA,UAAD,CACO,MACL,GAAIS,EACJ,KAAMC,EAAU,OAAS,WACf,WACV,SACE,EAAAH,EAAA,IAAA,CAAC,SAAD,CACE,KAAK,SACL,UAAU,wBACV,aAAYG,EAAUK,EAAoBC,EAChC,WACV,QAASH,EAER,SAAAH,KAAaO,IAAe,WAAY,EAAAV,EAAA,IAAA,CAACN,EAAAA,eAAD,CAAiB,CAAA,GAAI,EAAAM,EAAA,IAAA,CAACL,EAAAA,YAAD,CAAc,CAAA,CACtE,CAAA,CAEX,CAAA,CAEL,CAAC,E"}
@@ -5,22 +5,22 @@ import { TextInput as n } from "./TextInput.js";
5
5
  import { forwardRef as r, useState as i } from "react";
6
6
  import { jsx as a } from "react/jsx-runtime";
7
7
  // src/components/TextInput/PasswordInput.tsx
8
- var o = /* @__PURE__ */ r(function({ showPasswordLabel: r = "Show password", hidePasswordLabel: o = "Hide password", defaultVisible: s = !1, onVisibleChange: c, disabled: l, ...u }, d) {
9
- let [f, p] = i(s), m = () => {
10
- p(!f), c?.(!f);
8
+ var o = /* @__PURE__ */ r(function({ showPasswordLabel: r = "Show password", hidePasswordLabel: o = "Hide password", defaultVisible: s = !1, toggleIcon: c = "action", onVisibleChange: l, disabled: u, ...d }, f) {
9
+ let [p, m] = i(s), h = () => {
10
+ m(!p), l?.(!p);
11
11
  };
12
12
  return /* @__PURE__ */ a(n, {
13
- ref: d,
14
- ...u,
15
- type: f ? "text" : "password",
16
- disabled: l,
13
+ ref: f,
14
+ ...d,
15
+ type: p ? "text" : "password",
16
+ disabled: u,
17
17
  endIcon: /* @__PURE__ */ a("button", {
18
18
  type: "button",
19
19
  className: "tm-text-input__toggle",
20
- "aria-label": f ? o : r,
21
- disabled: l,
22
- onClick: m,
23
- children: a(f ? t : e, {})
20
+ "aria-label": p ? o : r,
21
+ disabled: u,
22
+ onClick: h,
23
+ children: a(p === (c === "action") ? t : e, {})
24
24
  })
25
25
  });
26
26
  });
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordInput.js","names":["PasswordInput","props","visible","setVisible","useState","defaultVisible","toggle","onVisibleChange","TextInput","hidePasswordLabel","showPasswordLabel","jsx","EyeSlashedIcon","EyeOpenIcon"],"sources":["../../../src/components/TextInput/PasswordInput.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\nimport { EyeOpenIcon, EyeSlashedIcon } from '../../icons';\nimport { TextInput, type TextInputProps } from './TextInput';\n\nexport interface PasswordInputProps extends Omit<TextInputProps, 'type' | 'endIcon'> {\n /** Accessible name of the toggle while the password is hidden. Translate it. */\n showPasswordLabel?: string;\n /** Accessible name of the toggle while the password is visible. Translate it. */\n hidePasswordLabel?: string;\n /** Start with the password visible (Figma \"Type=Password-eye-slashed\"). */\n defaultVisible?: boolean;\n /** Called when the user shows or hides the password. */\n onVisibleChange?: (visible: boolean) => void;\n}\n\n/**\n * Figma \"Text inputs / Type=Password-eye-open · Password-eye-slashed\": a `TextInput` with a show/hide toggle.\n * The eye shows while the password is hidden, the slashed eye while it is readable. Figma also puts a\n * lock in front — pass `startIcon={<LockIcon />}` for that.\n */\nexport const PasswordInput = /* @__PURE__ */ forwardRef<HTMLInputElement, PasswordInputProps>(function PasswordInput(\n { showPasswordLabel = 'Show password', hidePasswordLabel = 'Hide password', defaultVisible = false, onVisibleChange, disabled, ...props },\n ref,\n) {\n const [visible, setVisible] = useState(defaultVisible);\n\n const toggle = () => {\n setVisible(!visible);\n onVisibleChange?.(!visible);\n };\n\n return (\n <TextInput\n ref={ref}\n {...props}\n type={visible ? 'text' : 'password'}\n disabled={disabled}\n endIcon={\n <button\n type=\"button\"\n className=\"tm-text-input__toggle\"\n aria-label={visible ? hidePasswordLabel : showPasswordLabel}\n disabled={disabled}\n onClick={toggle}\n >\n {visible ? <EyeSlashedIcon /> : <EyeOpenIcon />}\n </button>\n }\n />\n );\n});\n"],"mappings":";;;;;;;AAoBA,IAAaA,IAAgC,kBAAiD,SAC5F,EAAE,uBAAoB,iBAAiB,uBAAoB,iBAAiB,oBAAiB,IAAO,oBAAiB,aAAU,GAAGC,KAClI,GACA;CACA,IAAM,CAACC,GAASC,KAAcC,EAASC,CAAc,GAE/CC,UAAe;EAEnB,AADAH,EAAW,CAACD,CAAO,GACnBK,IAAkB,CAACL,CAAO;CAC5B;CAEA,OACE,kBAACM,GAAD;EACO;EACL,GAAIP;EACJ,MAAMC,IAAU,SAAS;EACf;EACV,SACE,kBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,cAAYA,IAAUO,IAAoBC;GAChC;GACV,SAASJ;GAER,UAAUK,EAAVT,IAAWU,IAAqBC,GAAtB,CAAiB,CAAkB;EACxC,CAAA;CAEX,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"PasswordInput.js","names":["PasswordInput","props","visible","setVisible","useState","defaultVisible","toggle","onVisibleChange","TextInput","hidePasswordLabel","showPasswordLabel","jsx","toggleIcon","EyeSlashedIcon","EyeOpenIcon"],"sources":["../../../src/components/TextInput/PasswordInput.tsx"],"sourcesContent":["import { forwardRef, useState } from 'react';\nimport { EyeOpenIcon, EyeSlashedIcon } from '../../icons';\nimport { TextInput, type TextInputProps } from './TextInput';\n\nexport interface PasswordInputProps extends Omit<TextInputProps, 'type' | 'endIcon'> {\n /** Accessible name of the toggle while the password is hidden. Translate it. */\n showPasswordLabel?: string;\n /** Accessible name of the toggle while the password is visible. Translate it. */\n hidePasswordLabel?: string;\n /** Start with the password visible (Figma \"Type=Password-eye-slashed\"). */\n defaultVisible?: boolean;\n /**\n * What the toggle's icon stands for. `action` (default, as the component set draws its filled examples): the eye\n * while the password is hidden (\"show it\"), the slashed eye while it is readable. `state`, as the Authentication\n * screens use the same two variants: the slashed eye while the password is hidden, the eye while it is readable.\n */\n toggleIcon?: 'action' | 'state';\n /** Called when the user shows or hides the password. */\n onVisibleChange?: (visible: boolean) => void;\n}\n\n/**\n * Figma \"Text inputs / Type=Password-eye-open · Password-eye-slashed\": a `TextInput` with a show/hide toggle.\n * By default the eye shows while the password is hidden and the slashed eye while it is readable; `toggleIcon=\"state\"`\n * swaps them. Figma also puts a lock in front — pass `startIcon={<LockIcon />}` for that.\n */\nexport const PasswordInput = /* @__PURE__ */ forwardRef<HTMLInputElement, PasswordInputProps>(function PasswordInput(\n {\n showPasswordLabel = 'Show password',\n hidePasswordLabel = 'Hide password',\n defaultVisible = false,\n toggleIcon = 'action',\n onVisibleChange,\n disabled,\n ...props\n },\n ref,\n) {\n const [visible, setVisible] = useState(defaultVisible);\n\n const toggle = () => {\n setVisible(!visible);\n onVisibleChange?.(!visible);\n };\n\n return (\n <TextInput\n ref={ref}\n {...props}\n type={visible ? 'text' : 'password'}\n disabled={disabled}\n endIcon={\n <button\n type=\"button\"\n className=\"tm-text-input__toggle\"\n aria-label={visible ? hidePasswordLabel : showPasswordLabel}\n disabled={disabled}\n onClick={toggle}\n >\n {visible === (toggleIcon === 'action') ? <EyeSlashedIcon /> : <EyeOpenIcon />}\n </button>\n }\n />\n );\n});\n"],"mappings":";;;;;;;AA0BA,IAAaA,IAAgC,kBAAiD,SAC5F,EACE,uBAAoB,iBACpB,uBAAoB,iBACpB,oBAAiB,IACjB,gBAAa,UACb,oBACA,aACA,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAASC,KAAcC,EAASC,CAAc,GAE/CC,UAAe;EAEnB,AADAH,EAAW,CAACD,CAAO,GACnBK,IAAkB,CAACL,CAAO;CAC5B;CAEA,OACE,kBAACM,GAAD;EACO;EACL,GAAIP;EACJ,MAAMC,IAAU,SAAS;EACf;EACV,SACE,kBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,cAAYA,IAAUO,IAAoBC;GAChC;GACV,SAASJ;GAER,UAAwCK,EAAxCT,OAAaU,MAAe,YAAaC,IAAqBC,GAAtB,CAAiB,CAAkB;EACtE,CAAA;CAEX,CAAA;AAEL,CAAC"}
package/dist/index.d.cts CHANGED
@@ -213,6 +213,12 @@ export interface LogoProps extends Omit<SVGProps<SVGSVGElement>, "ref" | "childr
213
213
  variant?: LogoVariant;
214
214
  /** Height in px, or any CSS length. The width follows the artwork's aspect ratio. */
215
215
  height?: number | string;
216
+ /**
217
+ * Draws the whole logo (mark, "Travel" and "Match") in the variant's ink colour instead of the brand gradient.
218
+ * Figma's Authentication screens use the `white` logo this way on their photo panel, where the gradient would not
219
+ * read. The colour follows `color`, so it can be set with a class.
220
+ */
221
+ mono?: boolean;
216
222
  /** Accessible name. Pass an empty string when the logo is decorative (for example inside a link that already has a label). */
217
223
  title?: string;
218
224
  }
@@ -487,13 +493,19 @@ export interface PasswordInputProps extends Omit<TextInputProps, "type" | "endIc
487
493
  hidePasswordLabel?: string;
488
494
  /** Start with the password visible (Figma "Type=Password-eye-slashed"). */
489
495
  defaultVisible?: boolean;
496
+ /**
497
+ * What the toggle's icon stands for. `action` (default, as the component set draws its filled examples): the eye
498
+ * while the password is hidden ("show it"), the slashed eye while it is readable. `state`, as the Authentication
499
+ * screens use the same two variants: the slashed eye while the password is hidden, the eye while it is readable.
500
+ */
501
+ toggleIcon?: "action" | "state";
490
502
  /** Called when the user shows or hides the password. */
491
503
  onVisibleChange?: (visible: boolean) => void;
492
504
  }
493
505
  /**
494
506
  * Figma "Text inputs / Type=Password-eye-open · Password-eye-slashed": a `TextInput` with a show/hide toggle.
495
- * The eye shows while the password is hidden, the slashed eye while it is readable. Figma also puts a
496
- * lock in front — pass `startIcon={<LockIcon />}` for that.
507
+ * By default the eye shows while the password is hidden and the slashed eye while it is readable; `toggleIcon="state"`
508
+ * swaps them. Figma also puts a lock in front — pass `startIcon={<LockIcon />}` for that.
497
509
  */
498
510
  export declare const PasswordInput: import("react").ForwardRefExoticComponent<PasswordInputProps & import("react").RefAttributes<HTMLInputElement>>;
499
511
  export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement>, FormFieldProps {
@@ -810,13 +822,19 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement
810
822
  size?: CheckboxSize;
811
823
  /** Label shown next to the box. Without it pass `aria-label` or `aria-labelledby`. */
812
824
  children?: ReactNode;
825
+ /**
826
+ * Error text shown under the checkbox (Figma "Checkbox field / State=Error" with a "Field message" below it).
827
+ * Also marks the input invalid and describes it with the message.
828
+ */
829
+ error?: ReactNode;
813
830
  /** Class for the root `<label>`; every other prop (and the ref) goes to the native `<input>`. */
814
831
  className?: string;
815
832
  /** Inline style for the root `<label>`. */
816
833
  style?: CSSProperties;
817
834
  }
818
835
  /**
819
- * Figma component set "Checkbox" (State=Default → unchecked, State=Clicked → checked).
836
+ * Figma component set "Checkbox" (State=Default → unchecked, State=Clicked → checked) and "Checkbox field" (the box
837
+ * with its label; State=Error adds a message underneath).
820
838
  * A native `<input type="checkbox">`, so `checked` / `defaultChecked` / `onChange` / `name` / `required` work as usual.
821
839
  */
822
840
  export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
package/dist/index.d.ts CHANGED
@@ -213,6 +213,12 @@ export interface LogoProps extends Omit<SVGProps<SVGSVGElement>, "ref" | "childr
213
213
  variant?: LogoVariant;
214
214
  /** Height in px, or any CSS length. The width follows the artwork's aspect ratio. */
215
215
  height?: number | string;
216
+ /**
217
+ * Draws the whole logo (mark, "Travel" and "Match") in the variant's ink colour instead of the brand gradient.
218
+ * Figma's Authentication screens use the `white` logo this way on their photo panel, where the gradient would not
219
+ * read. The colour follows `color`, so it can be set with a class.
220
+ */
221
+ mono?: boolean;
216
222
  /** Accessible name. Pass an empty string when the logo is decorative (for example inside a link that already has a label). */
217
223
  title?: string;
218
224
  }
@@ -487,13 +493,19 @@ export interface PasswordInputProps extends Omit<TextInputProps, "type" | "endIc
487
493
  hidePasswordLabel?: string;
488
494
  /** Start with the password visible (Figma "Type=Password-eye-slashed"). */
489
495
  defaultVisible?: boolean;
496
+ /**
497
+ * What the toggle's icon stands for. `action` (default, as the component set draws its filled examples): the eye
498
+ * while the password is hidden ("show it"), the slashed eye while it is readable. `state`, as the Authentication
499
+ * screens use the same two variants: the slashed eye while the password is hidden, the eye while it is readable.
500
+ */
501
+ toggleIcon?: "action" | "state";
490
502
  /** Called when the user shows or hides the password. */
491
503
  onVisibleChange?: (visible: boolean) => void;
492
504
  }
493
505
  /**
494
506
  * Figma "Text inputs / Type=Password-eye-open · Password-eye-slashed": a `TextInput` with a show/hide toggle.
495
- * The eye shows while the password is hidden, the slashed eye while it is readable. Figma also puts a
496
- * lock in front — pass `startIcon={<LockIcon />}` for that.
507
+ * By default the eye shows while the password is hidden and the slashed eye while it is readable; `toggleIcon="state"`
508
+ * swaps them. Figma also puts a lock in front — pass `startIcon={<LockIcon />}` for that.
497
509
  */
498
510
  export declare const PasswordInput: import("react").ForwardRefExoticComponent<PasswordInputProps & import("react").RefAttributes<HTMLInputElement>>;
499
511
  export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement>, FormFieldProps {
@@ -810,13 +822,19 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement
810
822
  size?: CheckboxSize;
811
823
  /** Label shown next to the box. Without it pass `aria-label` or `aria-labelledby`. */
812
824
  children?: ReactNode;
825
+ /**
826
+ * Error text shown under the checkbox (Figma "Checkbox field / State=Error" with a "Field message" below it).
827
+ * Also marks the input invalid and describes it with the message.
828
+ */
829
+ error?: ReactNode;
813
830
  /** Class for the root `<label>`; every other prop (and the ref) goes to the native `<input>`. */
814
831
  className?: string;
815
832
  /** Inline style for the root `<label>`. */
816
833
  style?: CSSProperties;
817
834
  }
818
835
  /**
819
- * Figma component set "Checkbox" (State=Default → unchecked, State=Clicked → checked).
836
+ * Figma component set "Checkbox" (State=Default → unchecked, State=Clicked → checked) and "Checkbox field" (the box
837
+ * with its label; State=Error adds a message underneath).
820
838
  * A native `<input type="checkbox">`, so `checked` / `defaultChecked` / `onChange` / `name` / `required` work as usual.
821
839
  */
822
840
  export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;