@travel-match/ui 0.1.0 → 0.3.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.
Files changed (61) hide show
  1. package/README.md +1 -0
  2. package/dist/components/Checkbox/Checkbox.cjs +1 -1
  3. package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
  4. package/dist/components/Checkbox/Checkbox.js +29 -17
  5. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  6. package/dist/components/CtaSentence/CtaSentence.cjs +1 -1
  7. package/dist/components/CtaSentence/CtaSentence.cjs.map +1 -1
  8. package/dist/components/CtaSentence/CtaSentence.js +142 -69
  9. package/dist/components/CtaSentence/CtaSentence.js.map +1 -1
  10. package/dist/components/HeroColumns/heroMotion.cjs +1 -1
  11. package/dist/components/HeroColumns/heroMotion.cjs.map +1 -1
  12. package/dist/components/HeroColumns/heroMotion.js +7 -44
  13. package/dist/components/HeroColumns/heroMotion.js.map +1 -1
  14. package/dist/components/HeroMap/HeroMap.cjs +1 -1
  15. package/dist/components/HeroMap/HeroMap.cjs.map +1 -1
  16. package/dist/components/HeroMap/HeroMap.js +58 -67
  17. package/dist/components/HeroMap/HeroMap.js.map +1 -1
  18. package/dist/components/HeroSwitcher/HeroSwitcher.cjs +1 -1
  19. package/dist/components/HeroSwitcher/HeroSwitcher.cjs.map +1 -1
  20. package/dist/components/HeroSwitcher/HeroSwitcher.js +85 -92
  21. package/dist/components/HeroSwitcher/HeroSwitcher.js.map +1 -1
  22. package/dist/components/HowItWorksSteps/HowItWorksSteps.cjs +1 -1
  23. package/dist/components/HowItWorksSteps/HowItWorksSteps.cjs.map +1 -1
  24. package/dist/components/HowItWorksSteps/HowItWorksSteps.js +84 -102
  25. package/dist/components/HowItWorksSteps/HowItWorksSteps.js.map +1 -1
  26. package/dist/components/Logo/Logo.cjs +1 -1
  27. package/dist/components/Logo/Logo.cjs.map +1 -1
  28. package/dist/components/Logo/Logo.js +14 -13
  29. package/dist/components/Logo/Logo.js.map +1 -1
  30. package/dist/components/Logo/LogoArtwork.cjs +1 -1
  31. package/dist/components/Logo/LogoArtwork.cjs.map +1 -1
  32. package/dist/components/Logo/LogoArtwork.js +9 -2
  33. package/dist/components/Logo/LogoArtwork.js.map +1 -1
  34. package/dist/components/PackageAnimation/PackageAnimation.cjs +1 -1
  35. package/dist/components/PackageAnimation/PackageAnimation.cjs.map +1 -1
  36. package/dist/components/PackageAnimation/PackageAnimation.js +31 -40
  37. package/dist/components/PackageAnimation/PackageAnimation.js.map +1 -1
  38. package/dist/components/PartnerCarousel/PartnerCarousel.cjs +1 -1
  39. package/dist/components/PartnerCarousel/PartnerCarousel.cjs.map +1 -1
  40. package/dist/components/PartnerCarousel/PartnerCarousel.js +94 -101
  41. package/dist/components/PartnerCarousel/PartnerCarousel.js.map +1 -1
  42. package/dist/components/PartnerCarousel/autoplay.cjs +1 -1
  43. package/dist/components/PartnerCarousel/autoplay.cjs.map +1 -1
  44. package/dist/components/PartnerCarousel/autoplay.js +13 -9
  45. package/dist/components/PartnerCarousel/autoplay.js.map +1 -1
  46. package/dist/components/Select/Select.cjs +1 -1
  47. package/dist/components/Select/Select.cjs.map +1 -1
  48. package/dist/components/Select/Select.js +119 -112
  49. package/dist/components/Select/Select.js.map +1 -1
  50. package/dist/components/TextInput/PasswordInput.cjs +1 -1
  51. package/dist/components/TextInput/PasswordInput.cjs.map +1 -1
  52. package/dist/components/TextInput/PasswordInput.js +11 -11
  53. package/dist/components/TextInput/PasswordInput.js.map +1 -1
  54. package/dist/index.d.cts +54 -58
  55. package/dist/index.d.ts +54 -58
  56. package/dist/styles.css +1 -1
  57. package/package.json +17 -1
  58. package/dist/components/PartnerCarousel/AutoplayToggle.cjs +0 -2
  59. package/dist/components/PartnerCarousel/AutoplayToggle.cjs.map +0 -1
  60. package/dist/components/PartnerCarousel/AutoplayToggle.js +0 -36
  61. package/dist/components/PartnerCarousel/AutoplayToggle.js.map +0 -1
@@ -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,mBACA,cAAW,IACX,QACA,eACA,WACA,eACA,aACA,oBAAoBI,IACpB,mBAAmBC,GACnB,GAAGC,KAEL,IACA;CACA,IAAMC,IAAMC,EAAYC,IAAI,GAAQC,KAASC,E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,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,IAAyB,kBAA2C,SAC/E,EACE,UACA,eACA,UACA,cACA,cACA,UAAO,MACP,YACA,kBAAc,iBACd,SACA,SAASC,IACT,gBAAa,IACb,uBAAoB,UACpB,gBAAY,cACZ,eACA,iB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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>>;
@@ -2799,26 +2817,22 @@ export interface HeroSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>,
2799
2817
  defaultValue?: string;
2800
2818
  /** Called with the new value when the user picks a segment or autoplay advances. */
2801
2819
  onValueChange?: (value: string) => void;
2802
- /** Advances to the next item on its own until the user picks a segment or presses pause. */
2820
+ /** Advances to the next item on its own, in an endless loop; after the user picks a segment it carries on from that item. */
2803
2821
  autoPlay?: boolean;
2804
2822
  /** Milliseconds each item stays before autoplay moves on (Figma prototype: 3s delay + 0.6s transition). */
2805
2823
  interval?: number;
2806
- /** Holds autoplay from outside (the selected item stays as it is). */
2824
+ /** Holds autoplay from outside (the selected item stays as it is); it carries on once this is `false` again. */
2807
2825
  paused?: boolean;
2808
2826
  /** Accessible name of the switch (tab list). */
2809
2827
  "aria-label"?: string;
2810
2828
  /** Heading level of the card title; pick the one that fits the page outline. */
2811
2829
  headingLevel?: 2 | 3 | 4 | 5 | 6;
2812
- /** Accessible name of the pause button shown while autoplay runs. */
2813
- pauseLabel?: string;
2814
- /** Accessible name of the same button once autoplay is stopped. */
2815
- playLabel?: string;
2816
2830
  }
2817
2831
  /**
2818
2832
  * Photo, segmented switch and a sample request card that change together (Figma component set
2819
2833
  * "Travel Requests / Hero switcher"). The switch is a real tab list — click or use the arrow keys — and autoplay
2820
- * stops for good once the user takes over, pauses on hover and focus, off-screen, in hidden tabs and never starts
2821
- * for users who prefer reduced motion.
2834
+ * is an endless loop: it carries on from the segment the user picked, holds on hover and keyboard focus, off-screen
2835
+ * and in hidden tabs, and never starts for users who prefer reduced motion.
2822
2836
  */
2823
2837
  export declare const HeroSwitcher: import("react").ForwardRefExoticComponent<HeroSwitcherProps & import("react").RefAttributes<HTMLDivElement>>;
2824
2838
  export interface HeroOrbitItem {
@@ -2926,22 +2940,18 @@ export interface HeroMapProps extends Omit<HTMLAttributes<HTMLDivElement>, "onCh
2926
2940
  defaultActiveIndex?: number;
2927
2941
  /** Called with the new index when autoplay advances. */
2928
2942
  onActiveIndexChange?: (index: number) => void;
2929
- /** Moves on to the next destination on its own. */
2943
+ /** Moves on to the next destination on its own, in an endless loop. */
2930
2944
  autoPlay?: boolean;
2931
2945
  /** Milliseconds each destination stays highlighted (Figma prototype: 2.2s delay + 0.5s transition). */
2932
2946
  interval?: number;
2933
- /** Holds autoplay from outside (the highlighted destination stays as it is). */
2947
+ /** Holds autoplay from outside (the highlighted destination stays as it is); it carries on once this is `false` again. */
2934
2948
  paused?: boolean;
2935
- /** Accessible name of the pause button shown while autoplay runs. */
2936
- pauseLabel?: string;
2937
- /** Accessible name of the same button once autoplay is stopped. */
2938
- playLabel?: string;
2939
2949
  }
2940
2950
  /**
2941
2951
  * Dotted map with a route from the origin to one sample request at a time (Figma component set "Join / Hero map").
2942
2952
  * Every destination is a list item with its tag as real text, so the content does not depend on the animation;
2943
- * autoplay can be paused with the built-in button, holds on hover, off-screen and in hidden tabs, and does not start
2944
- * for users who prefer reduced motion.
2953
+ * autoplay loops endlessly, holds on hover, off-screen and in hidden tabs, and does not start for users who prefer
2954
+ * reduced motion.
2945
2955
  */
2946
2956
  export declare const HeroMap: import("react").ForwardRefExoticComponent<HeroMapProps & import("react").RefAttributes<HTMLDivElement>>;
2947
2957
  export interface HowItWorksStepItem {
@@ -2965,18 +2975,14 @@ export interface HowItWorksStepsProps extends Omit<HTMLAttributes<HTMLDivElement
2965
2975
  defaultValue?: string;
2966
2976
  /** Called with the `value` of the step that became current, by a click or by auto-play. */
2967
2977
  onValueChange?: (value: string) => void;
2968
- /** Advances to the next step on a timer and loops. Stops for good once the user picks a step or presses pause. */
2978
+ /** Advances to the next step on a timer, in an endless loop; after the user picks a step it carries on from that step. */
2969
2979
  autoPlay?: boolean;
2970
2980
  /** Time a step rests once its 500ms transition has finished, in ms (Figma: 2200 — a new step every 2.7s). */
2971
2981
  interval?: number;
2972
- /** Holds auto-play without unmounting it (e.g. while a dialog is open). */
2982
+ /** Holds auto-play without unmounting it (e.g. while a dialog is open); it carries on once this is `false` again. */
2973
2983
  paused?: boolean;
2974
2984
  /** Accessible name of the list of steps, e.g. "How it works". */
2975
2985
  label?: string;
2976
- /** Accessible name of the pause button shown while auto-playing. Translate it in the app. */
2977
- pauseLabel?: string;
2978
- /** Accessible name of the same button once auto-play is paused. Translate it in the app. */
2979
- playLabel?: string;
2980
2986
  /** Width of the component in px below which the steps stack (the Figma mobile layout). Default: 136px per step plus the gaps, at least 480. */
2981
2987
  collapseBelow?: number;
2982
2988
  }
@@ -2989,8 +2995,9 @@ export declare const HowItWorksStepTag: import("react").ForwardRefExoticComponen
2989
2995
  /**
2990
2996
  * The request journey as a numbered rail over a row of step cards, one of which is current
2991
2997
  * (Figma "How it works / Steps"; its "Step=1…7" variants are the `value`). Every card is a button that makes its step
2992
- * current; with `autoPlay` the steps also advance on a timer until the user takes over. Below `collapseBelow` the
2993
- * cards stack and the rail is dropped (Figma "Mobile / How it works / Steps").
2998
+ * current; with `autoPlay` the steps also advance on a timer in an endless loop, which holds while the pointer or
2999
+ * keyboard focus is inside and carries on from the step the user picked. Below `collapseBelow` the cards stack and the
3000
+ * rail is dropped (Figma "Mobile / How it works / Steps").
2994
3001
  */
2995
3002
  export declare const HowItWorksSteps: import("react").ForwardRefExoticComponent<HowItWorksStepsProps & import("react").RefAttributes<HTMLDivElement>>;
2996
3003
  export type ExampleRequestsHeadingLevel = 2 | 3 | 4 | 5 | 6;
@@ -3127,16 +3134,12 @@ export interface PackageAnimationProps extends Omit<HTMLAttributes<HTMLDivElemen
3127
3134
  defaultValue?: number;
3128
3135
  /** Called with the index of the card that comes to the front (click, keyboard focus or autoplay). */
3129
3136
  onValueChange?: (value: number) => void;
3130
- /** Swaps the cards by itself (the Figma prototype swaps on click only). Stops for hover, focus, a hidden tab, an off-screen stack and reduced motion. */
3137
+ /** Swaps the cards by itself, in an endless loop (the Figma prototype swaps on click only). Holds for hover, keyboard focus, a hidden tab, an off-screen stack and reduced motion. */
3131
3138
  autoPlay?: boolean;
3132
3139
  /** Time a card stays in front before the next swap, in ms. */
3133
3140
  interval?: number;
3134
- /** Holds the autoplay (the pause control stays available). */
3141
+ /** Holds the autoplay from outside; it carries on once this is `false` again. */
3135
3142
  paused?: boolean;
3136
- /** Name of the pause button shown with `autoPlay` — translate it. */
3137
- pauseLabel?: string;
3138
- /** Name of the play button shown with `autoPlay` — translate it. */
3139
- playLabel?: string;
3140
3143
  }
3141
3144
  /**
3142
3145
  * Two overlapping, tilted package cards that swap places (Figma component set "Package animation").
@@ -3155,15 +3158,15 @@ export interface PartnerCarouselProps extends Omit<HTMLAttributes<HTMLElement>,
3155
3158
  defaultValue?: number;
3156
3159
  /** Called with the new index when the carousel moves (swipe, dots or autoplay). */
3157
3160
  onValueChange?: (value: number) => void;
3158
- /** Moves one slide at a time by itself. Stops for hover, focus, a hidden tab, an off-screen carousel and reduced motion. */
3161
+ /** Moves one slide at a time by itself, in an endless loop. Holds for hover, keyboard focus, a hidden tab, an off-screen carousel and reduced motion. */
3159
3162
  autoPlay?: boolean;
3160
3163
  /** Time a slide rests before the next move, in ms (Figma: 3000). */
3161
3164
  interval?: number;
3162
- /** Holds the autoplay (the pause control stays available). */
3165
+ /** Holds the autoplay from outside; it carries on once this is `false` again. */
3163
3166
  paused?: boolean;
3164
3167
  /** After the last slide the first one follows seamlessly, as in the Figma prototype. Needs more than two slides. */
3165
3168
  loop?: boolean;
3166
- /** Shows the dots and, with `autoPlay`, the pause / play button. */
3169
+ /** Shows the dots. */
3167
3170
  controls?: boolean;
3168
3171
  /** Accessible name of a slide — translate it. */
3169
3172
  getSlideLabel?: (index: number, count: number) => string;
@@ -3171,10 +3174,6 @@ export interface PartnerCarouselProps extends Omit<HTMLAttributes<HTMLElement>,
3171
3174
  getPageLabel?: (page: number, pageCount: number) => string;
3172
3175
  /** Name of the dots navigation — translate it. */
3173
3176
  paginationLabel?: string;
3174
- /** Name of the pause button — translate it. */
3175
- pauseLabel?: string;
3176
- /** Name of the play button — translate it. */
3177
- playLabel?: string;
3178
3177
  }
3179
3178
  /**
3180
3179
  * Carousel of partner cards (Figma component set "Home / Partner carousel"): a native scroll-snap track — so touch
@@ -3248,41 +3247,38 @@ export interface CtaSentenceExample {
3248
3247
  key?: string;
3249
3248
  /** Words and pills in reading order, e.g. `["I’d like", { value: "a Flight" }, "to", { value: "Paris" }]`. */
3250
3249
  parts: CtaSentencePart[];
3251
- /** Insets the sentence by `spacing/3xl` on both sides so its lines break evenly (Figma does this on Example 2). */
3250
+ /**
3251
+ * Insets the sentence by `spacing/3xl` on both sides so its lines break evenly. When the examples share one sentence
3252
+ * (see `CtaSentence`), the first example decides for all of them.
3253
+ */
3252
3254
  padded?: boolean;
3253
3255
  }
3254
3256
  export interface CtaSentenceProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
3255
- /** The example sentences the component cycles through. Any number. */
3257
+ /** The example requests the sentence cycles through. Any number. */
3256
3258
  examples: CtaSentenceExample[];
3257
3259
  /** Index (0-based) of the example shown — Figma "Example". Makes the component controlled. */
3258
3260
  value?: number;
3259
3261
  /** Example shown first when uncontrolled. */
3260
3262
  defaultValue?: number;
3261
- /** Called with the new index when the example changes (autoplay or dots). */
3263
+ /** Called with the new index each time the sentence moves on to the next example. */
3262
3264
  onValueChange?: (value: number) => void;
3263
- /** Cycles through the examples by itself. Stops for hover, focus, a hidden tab, an off-screen sentence and reduced motion. */
3265
+ /** Cycles through the examples by itself, endlessly. Holds for hover, focus, a hidden tab, an off-screen sentence and reduced motion. */
3264
3266
  autoPlay?: boolean;
3265
3267
  /** Time an example rests before the next one, in ms (Figma: 2600). */
3266
3268
  interval?: number;
3267
- /** Holds the autoplay (the pause control stays available). */
3269
+ /** Holds the autoplay. */
3268
3270
  paused?: boolean;
3269
- /** Shows the dots that pick an example and, with `autoPlay`, the pause / play button. */
3270
- controls?: boolean;
3271
3271
  /** Makes the pills buttons and is called with the example and part index of the pressed one, e.g. to open the request form. */
3272
3272
  onPillClick?: (exampleIndex: number, partIndex: number) => void;
3273
- /** Accessible name of a dot — translate it. */
3274
- getPageLabel?: (page: number, pageCount: number) => string;
3275
- /** Name of the dots navigation — translate it. */
3276
- paginationLabel?: string;
3277
- /** Name of the pause button — translate it. */
3278
- pauseLabel?: string;
3279
- /** Name of the play button — translate it. */
3280
- playLabel?: string;
3281
3273
  }
3282
3274
  /**
3283
- * A request written as a sentence whose values are pills, cycling through examples
3284
- * (Figma component set "How it works / CTA sentence"). Every example is real text; the one on show is the only one
3285
- * exposed to assistive technology, and the dots reach the others.
3275
+ * A request written as one sentence whose values are pills that look like selects (Figma component set
3276
+ * "How it works / CTA sentence"). The sentence stays where it is; every few seconds the values in the pills roll over
3277
+ * to the next example, one pill after another, endlessly. Each pill is as wide as its longest value, so nothing around
3278
+ * it moves. Only the values on show are exposed to assistive technology.
3279
+ *
3280
+ * The examples are expected to be the same sentence with different values (the same words and pills in the same
3281
+ * order). Examples built differently are shown one whole sentence at a time, fading from one to the next.
3286
3282
  */
3287
3283
  export declare const CtaSentence: import("react").ForwardRefExoticComponent<CtaSentenceProps & import("react").RefAttributes<HTMLDivElement>>;
3288
3284
  export interface SheetProps extends Omit<DialogProps, "size" | "placement" | "mobilePlacement" | "eyebrow" | "role"> {