{"version":3,"file":"index.mjs","sources":["../src/components/Collection.tsx","../src/hooks/useCollator.ts","../src/hooks/useFilter.ts","../src/hooks/usePrev.ts","../src/components/Combobox/Combobox.tsx","../src/hooks/useCallbackRef.ts","../src/components/Select/Select.tsx","../src/helpers/events.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * An internal fork of Radix UI's `Collection` component.\n *\n * We've added a subscription API to allow us to subscribe to changes in the collection via the useCollection hook.\n */\nimport * as React from 'react';\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype SlotProps = Radix.ComponentPropsWithoutRef;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\ninterface CollectionProviderProps {\n children?: React.ReactNode;\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like ``.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = `${name}CollectionProvider`;\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ItemMapValue = { ref: React.RefObject } & ItemData;\n\n type ContextValue = {\n collectionRef: React.RefObject;\n itemMap: Map, ItemMapValue>;\n listeners: Set;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {\n collectionRef: { current: null },\n itemMap: new Map(),\n listeners: new Set(),\n });\n\n const CollectionProvider = (props: CollectionProviderProps) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(new Map()).current;\n const listeners = React.useRef(new Set()).current;\n\n return (\n \n {children}\n \n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = `${name}CollectionSlot`;\n\n const CollectionSlot = React.forwardRef((props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n\n return {children};\n });\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = `${name}CollectionItemSlot`;\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlot = React.forwardRef((props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n const previousMap = Array.from(context.itemMap.values());\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n\n context.listeners.forEach((listener) => listener(Array.from(context.itemMap.values()), previousMap));\n\n return () => {\n const previousMap = Array.from(context.itemMap.values());\n context.itemMap.delete(ref);\n context.listeners.forEach((listener) => listener(Array.from(context.itemMap.values()), previousMap));\n };\n });\n\n return (\n \n {children}\n \n );\n });\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n type Listener = (newState: ItemMapValue[], prevState: ItemMapValue[]) => void;\n\n function useCollection(scope: any) {\n const context = useCollectionContext(`${name}CollectionConsumer`, scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n const subscribe = React.useCallback(\n (listener: Listener) => {\n context.listeners.add(listener);\n\n // Unsubscribe\n return () => context.listeners.delete(listener);\n },\n [context.listeners],\n );\n\n return { getItems, subscribe };\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps, CollectionProviderProps };\n","/**\n * Stolen from @react-aria/i18n\n */\n\nconst cache = new Map();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator {\n const cacheKey =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\n\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey)!;\n }\n\n const formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n\n return formatter;\n}\n","/**\n * Stolen from @react-aria/i18n\n */\n\nimport { useCollator } from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean;\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean;\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean;\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(locale: string, options?: Intl.CollatorOptions): Filter {\n const collator = useCollator(locale, {\n usage: 'search',\n ...options,\n });\n\n return {\n startsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n },\n endsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n return collator.compare(string.slice(-substring.length), substring) === 0;\n },\n contains(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n const sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n const slice = string.slice(scan, scan + sliceLen);\n\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n },\n };\n}\n","import * as React from 'react';\n\nexport const usePrev = (value: T): T | undefined => {\n const ref = React.useRef();\n\n React.useEffect(() => {\n ref.current = value;\n });\n\n return ref.current;\n};\n","import * as React from 'react';\n\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { hideOthers } from 'aria-hidden';\nimport * as ReactDOM from 'react-dom';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport { useFilter } from '../../hooks/useFilter';\nimport { usePrev } from '../../hooks/usePrev';\nimport { createCollection } from '../Collection';\n\nimport type { ComponentPropsWithoutRef } from '@radix-ui/react-primitive';\n\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\nconst SELECTION_KEYS = ['Enter'];\n\nconst defaultIsPrintableCharacter = (str: string): boolean => {\n return Boolean(str.length === 1 && str.match(/\\S| /));\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Combobox\n * -----------------------------------------------------------------------------------------------*/\n\nconst COMBOBOX_NAME = 'Combobox';\n\nconst [Collection, useCollection] = createCollection(COMBOBOX_NAME);\n\ntype CollectionData = OptionData | CreateData;\n\ninterface Data {\n value: string;\n disabled: boolean;\n textValue: string;\n isVisible?: boolean;\n}\n\ninterface OptionData extends Data {\n type: 'option';\n}\n\ninterface CreateData extends Data {\n type: 'create';\n}\n\ntype AutocompleteObject =\n | { type: 'none'; filter?: never }\n | { type: 'list'; filter: 'contains' | 'startsWith' }\n | { type: 'both'; filter: 'startsWith' };\n\ntype Autocomplete = 'none' | 'list' | 'both' | AutocompleteObject;\n\ntype ComboboxContextValue = {\n allowCustomValue: boolean;\n autocomplete: AutocompleteObject;\n contentId: string;\n disabled?: boolean;\n locale: string;\n onOpenChange(open: boolean): void;\n onTriggerChange(node: ComboboxInputElement | null): void;\n onValueChange(value: string | undefined): void;\n open: boolean;\n required: boolean;\n trigger: ComboboxInputElement | null;\n value?: string;\n focusFirst: (\n candidates: Array,\n items: Array }>,\n ) => void;\n textValue?: string;\n onTextValueChange(textValue: string): void;\n onViewportChange(node: ComboboxViewportElement | null): void;\n onContentChange(node: ComboboxContentImplElement | null): void;\n visuallyFocussedItem: HTMLDivElement | null;\n filterValue: string | undefined;\n onFilterValueChange: (value: string | undefined) => void;\n onVisuallyFocussedItemChange: (item: HTMLDivElement | null) => void;\n isPrintableCharacter: (str: string) => boolean;\n visible?: boolean;\n};\n\nconst [ComboboxProvider, useComboboxContext] = createContext(COMBOBOX_NAME);\n\ninterface RootProps {\n allowCustomValue?: boolean;\n autocomplete?: Autocomplete;\n children?: React.ReactNode;\n defaultOpen?: boolean;\n defaultValue?: string;\n defaultTextValue?: string;\n disabled?: boolean;\n locale?: string;\n onOpenChange?(open: boolean): void;\n onValueChange?(value: string): void;\n onTextValueChange?(textValue: string): void;\n textValue?: string;\n open?: boolean;\n required?: boolean;\n value?: string;\n defaultFilterValue?: string;\n filterValue?: string;\n onFilterValueChange?(value: string): void;\n isPrintableCharacter?: (str: string) => boolean;\n visible?: boolean;\n}\n\n/**\n * @internal don't expose this. It's only used to access the `useCollection` hook.\n */\nconst ComboboxProviders = ({ children }: { children: React.ReactNode }) => (\n \n {children}\n \n);\n\nconst formatAutocomplete = (autocomplete: Autocomplete) => {\n if (typeof autocomplete === 'string') {\n if (autocomplete === 'none') {\n return {\n type: autocomplete,\n filter: undefined,\n };\n }\n return {\n type: autocomplete,\n filter: 'startsWith' as const,\n };\n }\n return autocomplete;\n};\n\nconst Combobox = (props: RootProps) => {\n const {\n allowCustomValue = false,\n autocomplete = 'none',\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n disabled,\n required = false,\n locale = 'en-EN',\n onTextValueChange,\n textValue: textValueProp,\n defaultTextValue,\n filterValue: filterValueProp,\n defaultFilterValue,\n onFilterValueChange,\n isPrintableCharacter = defaultIsPrintableCharacter,\n visible = false,\n } = props;\n\n const [trigger, setTrigger] = React.useState(null);\n const [viewport, setViewport] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const [visuallyFocussedItem, setVisuallyFocussedItem] = React.useState(null);\n\n /**\n * Lets state either be handled externally or internally.\n */\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n const [textValue, setTextValue] = useControllableState({\n prop: textValueProp,\n defaultProp: allowCustomValue && !defaultTextValue ? valueProp : defaultTextValue,\n onChange: onTextValueChange,\n });\n const [filterValue, setFilterValue] = useControllableState({\n prop: filterValueProp,\n defaultProp: defaultFilterValue,\n onChange: onFilterValueChange,\n });\n\n const id = useId();\n\n const focusFirst: ComboboxContextValue['focusFirst'] = React.useCallback(\n (candidates, items) => {\n const allItems = items.map((item) => item.ref.current);\n const [firstItem, ...restItems] = allItems;\n const [lastItem] = restItems.slice(-1);\n\n const PREVIOUSLY_FOCUSED_ELEMENT =\n visuallyFocussedItem ?? items.find((item) => item.value === value)?.ref.current;\n // eslint-disable-next-line no-restricted-syntax\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate?.scrollIntoView({ block: 'nearest' });\n\n // viewport might have padding so scroll to its edges when focusing first/last items.\n if (candidate === firstItem && viewport) viewport.scrollTop = 0;\n\n if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;\n\n setVisuallyFocussedItem(candidate);\n\n if (autocomplete === 'both') {\n const item = items.find((item) => item.ref.current === candidate);\n\n if (item) {\n setTextValue(item.textValue);\n }\n }\n\n if (candidate !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n },\n [autocomplete, setTextValue, viewport, visuallyFocussedItem, value],\n );\n\n const autocompleteObject: AutocompleteObject = formatAutocomplete(autocomplete);\n\n React.useEffect(() => {\n if (autocomplete !== 'both') {\n setVisuallyFocussedItem(null);\n }\n }, [textValue, autocomplete]);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (content && trigger) return hideOthers([content, trigger]);\n }, [content, trigger]);\n\n return (\n \n \n {children}\n \n \n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxTrigger\n * -----------------------------------------------------------------------------------------------*/\n\ntype TriggerProps = PrimitiveDivProps;\n\nconst TRIGGER_NAME = 'ComboboxTrigger';\ntype ComboboxTriggerElement = React.ElementRef<'div'>;\n\nconst ComboboxTrigger = React.forwardRef((props, forwardedRef) => {\n const { ...triggerProps } = props;\n const context = useComboboxContext(TRIGGER_NAME);\n\n const handleOpen = () => {\n if (!context.disabled) {\n context.onOpenChange(true);\n }\n };\n\n return (\n \n {\n // we prevent open autofocus because we manually focus the selected item\n event.preventDefault();\n }}\n onUnmountAutoFocus={(event) => {\n context.trigger?.focus({ preventScroll: true });\n /**\n * In firefox there's a some kind of selection happening after\n * unmounting all of this, so we make sure we clear that.\n */\n document.getSelection()?.empty();\n event.preventDefault();\n }}\n >\n {\n // To prevent focus() calls from Slot, it causes unexpected focus states on UI\n // ref: https://github.com/strapi/design-system/issues/1330\n if (context.disabled) {\n event.preventDefault();\n return;\n }\n\n // Whilst browsers generally have no issue focusing the trigger when clicking\n // on a label, Safari seems to struggle with the fact that there's no `onClick`.\n // We force `focus` in this case. Note: this doesn't create any other side-effect\n // because we are preventing default in `onPointerDown` so effectively\n // this only runs for a label \"click\"\n context.trigger?.focus();\n })}\n onPointerDown={composeEventHandlers(triggerProps.onPointerDown, (event) => {\n // To prevent focus() calls from Slot, it causes unexpected focus states on UI\n // ref: https://github.com/strapi/design-system/issues/1330\n if (context.disabled) {\n event.preventDefault();\n return;\n }\n\n // prevent implicit pointer capture\n // https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture\n const target = event.target as HTMLElement;\n\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n\n /**\n * This has been added to allow events inside the trigger to be easily fired\n * e.g. the clear button or removing a tag\n */\n const buttonTarg = target.closest('button') ?? target.closest('div');\n\n if (buttonTarg !== event.currentTarget) {\n return;\n }\n\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (event.button === 0 && event.ctrlKey === false) {\n handleOpen();\n /**\n * Firefox had issues focussing the input correctly.\n */\n context.trigger?.focus();\n }\n })}\n />\n \n \n );\n});\n\nComboboxTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst INPUT_NAME = 'ComboboxInput';\n\ntype TextInputProps = React.InputHTMLAttributes;\ntype ComboboxInputElement = React.ElementRef<'input'>;\n\nconst ComboxboxTextInput = React.forwardRef((props, forwardedRef) => {\n const context = useComboboxContext(INPUT_NAME);\n const inputRef = React.useRef(null);\n const { getItems } = useCollection(undefined);\n\n const { startsWith } = useFilter(context.locale, { sensitivity: 'base' });\n\n const isDisabled = context.disabled;\n const composedRefs = useComposedRefs(inputRef, forwardedRef, context.onTriggerChange);\n\n const handleOpen = () => {\n if (!isDisabled) {\n context.onOpenChange(true);\n }\n };\n\n const previousFilter = usePrev(context.filterValue);\n\n /**\n * If you suddenly get a match it pushes you right to the end.\n */\n useLayoutEffect(() => {\n const timeout = setTimeout(() => {\n if (\n context.textValue === '' ||\n context.textValue === undefined ||\n context.filterValue === '' ||\n context.filterValue === undefined\n )\n return;\n\n const firstItem = getItems().find(\n (item) => item.type === 'option' && startsWith(item.textValue, context.textValue!),\n );\n\n const characterChangedAtIndex = findChangedIndex(previousFilter ?? '', context.filterValue);\n\n /**\n * If there's a match, we want to select the text after the match.\n */\n if (firstItem && !context.visuallyFocussedItem && characterChangedAtIndex === context.filterValue.length) {\n inputRef.current?.setSelectionRange(context.filterValue.length, context.textValue.length);\n }\n });\n\n return () => clearTimeout(timeout);\n }, [context.textValue, context.filterValue, startsWith, context.visuallyFocussedItem, getItems, previousFilter]);\n\n return (\n {\n if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {\n if (!context.open) {\n handleOpen();\n }\n\n setTimeout(() => {\n const items = getItems().filter((item) => !item.disabled && item.isVisible);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (['ArrowUp', 'End'].includes(event.key)) {\n candidateNodes = candidateNodes.slice().reverse();\n }\n if (['ArrowUp', 'ArrowDown'].includes(event.key)) {\n const currentElement =\n context.visuallyFocussedItem ?? getItems().find((item) => item.value === context.value)?.ref.current;\n\n if (currentElement) {\n let currentIndex = candidateNodes.indexOf(currentElement);\n\n /**\n * This lets us go around the items in one big loop.\n */\n if (currentIndex === candidateNodes.length - 1) {\n currentIndex = -1;\n }\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n }\n if (\n ['ArrowDown'].includes(event.key) &&\n context.autocomplete.type === 'both' &&\n candidateNodes.length > 1\n ) {\n const [firstItem, ...restItems] = candidateNodes;\n const firstItemText = getItems().find((item) => item.ref.current === firstItem)!.textValue;\n\n if (context.textValue === firstItemText) {\n candidateNodes = restItems;\n }\n }\n context.focusFirst(candidateNodes, getItems());\n });\n event.preventDefault();\n } else if (['Tab'].includes(event.key) && context.open) {\n event.preventDefault();\n } else if (['Escape'].includes(event.key)) {\n if (context.open) {\n context.onOpenChange(false);\n } else {\n context.onValueChange(undefined);\n context.onTextValueChange('');\n }\n event.preventDefault();\n } else if (SELECTION_KEYS.includes(event.key)) {\n if (context.visuallyFocussedItem) {\n const focussedItem = getItems().find((item) => item.ref.current === context.visuallyFocussedItem);\n\n if (focussedItem) {\n context.onValueChange(focussedItem.value);\n context.onTextValueChange(focussedItem.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(focussedItem.textValue);\n }\n\n focussedItem.ref.current?.click();\n }\n } else {\n const matchedItem = getItems().find(\n (item) => item.type === 'option' && !item.disabled && item.textValue === context.textValue,\n );\n\n if (matchedItem) {\n context.onValueChange(matchedItem.value);\n context.onTextValueChange(matchedItem.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(matchedItem.textValue);\n }\n\n matchedItem.ref.current?.click();\n }\n }\n\n context.onOpenChange(false);\n event.preventDefault();\n } else {\n context.onVisuallyFocussedItemChange(null);\n }\n })}\n onChange={composeEventHandlers(props.onChange, (event) => {\n context.onTextValueChange(event.currentTarget.value);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(event.currentTarget.value);\n }\n })}\n onKeyUp={composeEventHandlers(props.onKeyUp, (event) => {\n if (!context.open && (context.isPrintableCharacter(event.key) || ['Backspace'].includes(event.key))) {\n handleOpen();\n }\n\n setTimeout(() => {\n if (\n context.autocomplete.type === 'both' &&\n context.isPrintableCharacter(event.key) &&\n context.filterValue !== undefined\n ) {\n const value = context.filterValue;\n const firstItem = getItems().find((item) => startsWith(item.textValue, value));\n\n if (firstItem) {\n context.onTextValueChange(firstItem.textValue);\n }\n }\n });\n\n if (context.autocomplete.type === 'none' && context.isPrintableCharacter(event.key)) {\n const value = context.textValue ?? '';\n\n const nextItem = getItems().find((item) => startsWith(item.textValue, value));\n\n if (nextItem) {\n context.onVisuallyFocussedItemChange(nextItem.ref.current);\n nextItem.ref.current?.scrollIntoView();\n }\n }\n })}\n onBlur={composeEventHandlers(props.onBlur, () => {\n if (context.open) {\n return;\n }\n\n context.onVisuallyFocussedItemChange(null);\n\n const [activeItem] = getItems().filter(\n (item) => item.textValue === context.textValue && item.type === 'option',\n );\n\n if (activeItem) {\n context.onValueChange(activeItem.value);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(activeItem.textValue);\n }\n\n return;\n }\n\n /**\n * If we allow custom values and we didn't find an active item\n * we just want to set it to the text value.\n */\n if (context.allowCustomValue) {\n context.onValueChange(context.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(context.textValue);\n }\n\n return;\n }\n\n const [previousItem] = getItems().filter((item) => item.value === context.value && item.type === 'option');\n\n /**\n * If we've succesfully typed a value that matches an item, we want to\n * update the value to that item's value. Otherwise, we want to update\n * the value to the previous value.\n *\n * If theres no previous value and we've typed a value that doesn't match\n * an item, we want to clear the value.\n */\n\n if (previousItem && context.textValue !== '') {\n context.onTextValueChange(previousItem.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(previousItem.textValue);\n }\n } else {\n context.onValueChange(undefined);\n context.onTextValueChange('');\n }\n })}\n />\n );\n});\n\nComboxboxTextInput.displayName = 'ComboboxTextInput';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxIcon\n * -----------------------------------------------------------------------------------------------*/\n\ntype ComboboxIconElement = React.ElementRef;\ntype PrimitiveButtonProps = ComponentPropsWithoutRef;\ntype IconProps = PrimitiveButtonProps;\n\nconst ComboboxIcon = React.forwardRef((props, forwardedRef) => {\n const { children, ...iconProps } = props;\n\n const context = useComboboxContext(INPUT_NAME);\n\n const isDisabled = context.disabled;\n\n const handleOpen = () => {\n if (!isDisabled) {\n context.onOpenChange(true);\n /**\n * We should be focussing the trigger here not this button.\n */\n context.trigger?.focus();\n }\n };\n\n return (\n {\n // Whilst browsers generally have no issue focusing the trigger when clicking\n // on a label, Safari seems to struggle with the fact that there's no `onClick`.\n // We force `focus` in this case. Note: this doesn't create any other side-effect\n // because we are preventing default in `onPointerDown` so effectively\n // this only runs for a label \"click\"\n context.trigger?.focus();\n })}\n onPointerDown={composeEventHandlers(iconProps.onPointerDown, (event) => {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (event.button === 0 && event.ctrlKey === false) {\n handleOpen();\n // prevent trigger from stealing focus from the active item after opening.\n event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(iconProps.onKeyDown, (event) => {\n if (OPEN_KEYS.includes(event.key)) {\n handleOpen();\n event.preventDefault();\n }\n })}\n >\n {children || '▼'}\n \n );\n});\n\nComboboxIcon.displayName = 'ComboboxIcon';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'ComboboxPortal';\n\ntype IPortalProps = React.ComponentPropsWithoutRef;\ninterface PortalProps extends Omit {\n children?: React.ReactNode;\n}\n\nconst ComboboxPortal = (props: PortalProps) => {\n return ;\n};\n\nComboboxPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ComboboxContent';\n\ntype ComboboxContentElement = ComboboxContentImplElement;\ntype ContentProps = ComboboxContentImplProps;\n\nconst ComboboxContent = React.forwardRef((props, forwardedRef) => {\n const context = useComboboxContext(CONTENT_NAME);\n const { getItems } = useCollection(undefined);\n const [fragment, setFragment] = React.useState();\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n useLayoutEffect(() => {\n if (context.open && context.autocomplete.type === 'none') {\n setTimeout(() => {\n const activeItem = getItems().find((item) => item.value === context.value);\n activeItem?.ref.current?.scrollIntoView({ block: 'nearest' });\n });\n }\n }, [getItems, context.autocomplete, context.value, context.open]);\n\n if (!context.open) {\n const frag = fragment as Element | undefined;\n\n return frag\n ? ReactDOM.createPortal(\n \n
{props.children}
\n
,\n frag,\n )\n : null;\n }\n\n return ;\n});\n\nComboboxContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxContentImpl\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_MARGIN = 10;\n\ntype ComboboxContentImplElement = ComboboxPopperPositionElement;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\n\ntype ComboboxPopperPrivateProps = { onPlaced?: PopperContentProps['onPlaced'] };\n\ninterface ComboboxContentImplProps extends Omit {\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n}\n\n/**\n * @internal This is the implementation of the `ComboboxContent` component. But should not be used on it's own\n * for accessibility reasons. Use `ComboboxContent` instead.\n */\nconst ComboboxContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const { onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;\n const context = useComboboxContext(CONTENT_NAME);\n const composedRefs = useComposedRefs(forwardedRef, (node) => context.onContentChange(node));\n\n // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`\n // and close on `pointerup` outside.\n const { onOpenChange } = context;\n\n useFocusGuards();\n\n React.useEffect(() => {\n const close = () => {\n onOpenChange(false);\n };\n window.addEventListener('blur', close);\n window.addEventListener('resize', close);\n\n return () => {\n window.removeEventListener('blur', close);\n window.removeEventListener('resize', close);\n };\n }, [onOpenChange]);\n\n return (\n \n {\n event.preventDefault();\n }}\n onDismiss={() => {\n context.onOpenChange(false);\n context.trigger?.focus({ preventScroll: true });\n }}\n >\n event.preventDefault()}\n {...contentProps}\n ref={composedRefs}\n style={{\n // flex layout so we can place the scroll buttons properly\n display: 'flex',\n flexDirection: 'column',\n // reset the outline by default as the content MAY get focused\n outline: 'none',\n ...contentProps.style,\n }}\n />\n \n \n );\n },\n);\n\nComboboxContentImpl.displayName = 'ComboboxContentImpl';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxPopperPosition\n * -----------------------------------------------------------------------------------------------*/\n\ntype ComboboxPopperPositionElement = React.ElementRef;\ntype PopperContentProps = React.ComponentPropsWithoutRef;\ninterface ComboboxPopperPositionProps extends PopperContentProps, ComboboxPopperPrivateProps {}\n\nconst ComboboxPopperPosition = React.forwardRef(\n (props, forwardedRef) => {\n const { align = 'start', collisionPadding = CONTENT_MARGIN, ...popperProps } = props;\n\n return (\n \n );\n },\n);\n\nComboboxPopperPosition.displayName = 'ComboboxPopperPosition';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ComboboxViewport';\n\ntype ComboboxViewportElement = React.ElementRef;\ntype PrimitiveDivProps = ComponentPropsWithoutRef;\ntype ViewportProps = PrimitiveDivProps;\n\nconst ComboboxViewport = React.forwardRef((props, forwardedRef) => {\n const comboboxContext = useComboboxContext(VIEWPORT_NAME);\n const composedRefs = useComposedRefs(forwardedRef, comboboxContext.onViewportChange);\n\n return (\n <>\n {/* Hide scrollbars cross-browser and enable momentum scroll for touch devices */}\n \n \n \n \n \n );\n});\n\nComboboxViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemContext\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ComboboxItem';\n\ninterface ComboboxItemContextValue {\n onTextValueChange(node: HTMLSpanElement | null): void;\n textId: string;\n isSelected: boolean;\n textValue: string;\n}\n\nconst [ComboboxItemProvider, useComboboxItemContext] = createContext(ITEM_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype ComboboxItemElement = ComboboxItemImplElement;\n\ninterface ItemProps extends ItemImplProps {\n textValue?: string;\n}\n\nexport const ComboboxItem = React.forwardRef((props, forwardedRef) => {\n const { value, disabled = false, textValue: textValueProp, ...restProps } = props;\n const [fragment, setFragment] = React.useState();\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n const { onTextValueChange, textValue: contextTextValue, ...context } = useComboboxContext(ITEM_NAME);\n\n const textId = useId();\n\n const [textValue, setTextValue] = React.useState(textValueProp ?? '');\n\n const isSelected = context.value === value;\n\n const { startsWith, contains } = useFilter(context.locale, { sensitivity: 'base' });\n\n const handleTextValueChange = React.useCallback((node: HTMLSpanElement | null) => {\n setTextValue((prevTextValue) => {\n return prevTextValue || (node?.textContent ?? '').trim();\n });\n }, []);\n\n React.useEffect(() => {\n /**\n * This effect is designed to run when the value prop is\n * controlled and we need to update the text value accordingly.\n */\n if (isSelected && contextTextValue === undefined && textValue !== '') {\n onTextValueChange(textValue);\n }\n }, [textValue, isSelected, contextTextValue, onTextValueChange]);\n\n if (\n (context.autocomplete.type === 'both' &&\n textValue &&\n context.filterValue &&\n !startsWith(textValue, context.filterValue)) ||\n (context.autocomplete.type === 'list' &&\n context.autocomplete.filter === 'startsWith' &&\n textValue &&\n contextTextValue &&\n !startsWith(textValue, contextTextValue)) ||\n (context.autocomplete.type === 'list' &&\n context.autocomplete.filter === 'contains' &&\n textValue &&\n contextTextValue &&\n !contains(textValue, contextTextValue))\n ) {\n return fragment\n ? ReactDOM.createPortal(\n \n \n \n \n ,\n fragment,\n )\n : null;\n }\n\n return (\n \n \n \n \n \n );\n});\n\nComboboxItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemImpl\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_IMPL_NAME = 'ComboboxItemImpl';\n\ntype ComboboxItemImplElement = React.ElementRef;\n\ninterface ItemImplProps extends PrimitiveDivProps {\n value: string;\n disabled?: boolean;\n}\n\nconst ComboboxItemImpl = React.forwardRef((props, forwardedRef) => {\n const { value, disabled = false, ...restProps } = props;\n const itemRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, itemRef);\n\n const { getItems } = useCollection(undefined);\n const { onTextValueChange, visuallyFocussedItem, ...context } = useComboboxContext(ITEM_NAME);\n const { isSelected, textValue, textId } = useComboboxItemContext(ITEM_IMPL_NAME);\n\n const handleSelect = () => {\n if (!disabled) {\n context.onValueChange(value);\n onTextValueChange(textValue);\n context.onOpenChange(false);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(textValue);\n }\n\n context.trigger?.focus({ preventScroll: true });\n }\n };\n\n const isFocused = React.useMemo(() => {\n return visuallyFocussedItem === getItems().find((item) => item.ref.current === itemRef.current)?.ref.current;\n }, [getItems, visuallyFocussedItem]);\n\n const id = useId();\n\n return (\n \n );\n});\n\nComboboxItemImpl.displayName = ITEM_IMPL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'ComboboxItemText';\n\ntype PrimitiveSpanProps = ComponentPropsWithoutRef;\ntype ItemTextProps = PrimitiveSpanProps;\n\nconst ComboboxItemText = React.forwardRef((props, forwardedRef) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { className: _unusedClassName, style: _unusedStyle, ...itemTextProps } = props;\n const itemContext = useComboboxItemContext(ITEM_TEXT_NAME);\n const composedRefs = useComposedRefs(forwardedRef, itemContext.onTextValueChange);\n\n return ;\n});\n\nComboboxItemText.displayName = ITEM_TEXT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'ComboboxItemIndicator';\ntype ItemIndicatorProps = PrimitiveSpanProps;\n\nconst ComboboxItemIndicator = React.forwardRef((props, forwardedRef) => {\n const { isSelected } = useComboboxItemContext(ITEM_INDICATOR_NAME);\n\n return isSelected ? : null;\n});\n\nComboboxItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxNoValueFound\n * -----------------------------------------------------------------------------------------------*/\n\nconst NO_VALUE_FOUND_NAME = 'ComboboxNoValueFound';\n\ntype NoValueFoundProps = PrimitiveDivProps;\n\nconst ComboboxNoValueFound = React.forwardRef((props, ref) => {\n const {\n textValue = '',\n filterValue = '',\n visible = false,\n locale,\n autocomplete,\n } = useComboboxContext(NO_VALUE_FOUND_NAME);\n const [items, setItems] = React.useState([]);\n const { subscribe } = useCollection(undefined);\n\n const { startsWith, contains } = useFilter(locale, { sensitivity: 'base' });\n\n /**\n * We need to use a subscription here so we know *exactly*\n * what items are in the collection whenever they update\n */\n React.useEffect(() => {\n const unsub = subscribe((state) => {\n // Filter out the input value unless it's explicitly required for \"creatable\" options\n if (visible) {\n const filteredItems = state.filter((item) => item.type !== 'create');\n setItems(filteredItems);\n } else {\n setItems(state);\n }\n });\n\n return () => {\n unsub();\n };\n }, [visible, subscribe]);\n\n if (autocomplete.type === 'none' && items.length > 0) return null;\n\n if (\n autocomplete.type === 'list' &&\n autocomplete.filter === 'startsWith' &&\n items.some((item) => startsWith(item.textValue, textValue))\n ) {\n return null;\n }\n\n if (autocomplete.type === 'both' && items.some((item) => startsWith(item.textValue, filterValue))) {\n return null;\n }\n\n if (\n autocomplete.type === 'list' &&\n autocomplete.filter === 'contains' &&\n items.some((item) => contains(item.textValue, textValue))\n ) {\n return null;\n }\n\n return ;\n});\n\nComboboxNoValueFound.displayName = NO_VALUE_FOUND_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxCreateItem\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CreateItemProps extends PrimitiveDivProps {\n disabled?: boolean;\n}\n\nconst ComboboxCreateItem = React.forwardRef((props, ref) => {\n const { disabled = false, ...restProps } = props;\n const context = useComboboxContext(NO_VALUE_FOUND_NAME);\n const { textValue, visuallyFocussedItem } = context;\n const { getItems, subscribe } = useCollection(undefined);\n const itemRef = React.useRef(null);\n const [show, setShow] = React.useState(false);\n\n const composedRefs = useComposedRefs(ref, itemRef);\n\n const isFocused = React.useMemo(() => {\n return visuallyFocussedItem === getItems().find((item) => item.ref.current === itemRef.current)?.ref.current;\n }, [getItems, visuallyFocussedItem]);\n\n const id = useId();\n\n const handleSelect = () => {\n if (!disabled && textValue) {\n context.onValueChange(textValue);\n context.onTextValueChange(textValue);\n context.onOpenChange(false);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(textValue);\n }\n\n context.trigger?.focus({ preventScroll: true });\n }\n };\n\n useLayoutEffect(() => {\n const unsub = subscribe((state) => {\n setShow(!state.some((item) => item.textValue === textValue && item.type !== 'create'));\n });\n\n if (getItems().length === 0) {\n setShow(true);\n }\n\n return () => {\n unsub();\n };\n }, [textValue, subscribe, getItems]);\n\n if ((!textValue || !show) && !context.visible) {\n return null;\n }\n\n return (\n \n \n \n );\n});\n\nComboboxCreateItem.displayName = 'ComboboxCreateItem';\n\nconst Root = Combobox;\nconst Trigger = ComboboxTrigger;\nconst TextInput = ComboxboxTextInput;\nconst Icon = ComboboxIcon;\nconst Portal = ComboboxPortal;\nconst Content = ComboboxContent;\nconst Viewport = ComboboxViewport;\nconst Item = ComboboxItem;\nconst ItemText = ComboboxItemText;\nconst ItemIndicator = ComboboxItemIndicator;\nconst NoValueFound = ComboboxNoValueFound;\nconst CreateItem = ComboboxCreateItem;\n\nexport {\n Root,\n Trigger,\n TextInput,\n Icon,\n Portal,\n Content,\n Viewport,\n Item,\n ItemText,\n ItemIndicator,\n NoValueFound,\n CreateItem,\n};\n\nexport type {\n RootProps,\n TriggerProps,\n TextInputProps,\n IconProps,\n PortalProps,\n ContentProps,\n ViewportProps,\n ItemProps,\n ItemTextProps,\n ItemIndicatorProps,\n NoValueFoundProps,\n CreateItemProps,\n Autocomplete,\n AutocompleteObject,\n};\n\n/**\n * Given two strings find the exact index of the character that changed\n */\nfunction findChangedIndex(a: string, b: string) {\n const length = Math.min(a.length, b.length);\n\n for (let i = 0; i < length; i++) {\n if (a[i] !== b[i]) {\n return i;\n }\n }\n\n return length;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nfunction useCallbackRef any>(callback: T | undefined): T {\n const callbackRef = React.useRef(callback);\n\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n\n // https://github.com/facebook/react/issues/19240\n return React.useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []);\n}\n\nexport { useCallbackRef };\n","/**\n * We've forked this from RadixUI to add primarily support for multi-select.\n * This is on their roadmap – https://github.com/radix-ui/primitives/issues/1193\n *\n * The changes are dotted around the codebase but all linked to a primary objective:\n * 1. The Select `value` can now be a string or an array of strings\n * 2. The Select `onValueChange` callback now receives a string or an array of strings\n *\n * Therefore, anywhere you see code handling values. It will accept and manage `string | string[]`,\n * thankfully Typescript is very helpful with this.\n *\n * Hopefully in the future we can remove this fork ✌🏼\n */\n\nimport * as React from 'react';\n\nimport { clamp } from '@radix-ui/number';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\nimport { hideOthers } from 'aria-hidden';\nimport * as ReactDOM from 'react-dom';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport { useCallbackRef } from '../../hooks/useCallbackRef';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype Direction = 'ltr' | 'rtl';\n\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\nconst SELECTION_KEYS = [' ', 'Enter'];\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nconst SELECT_NAME = 'Select';\n\ntype ItemData = { value: string | string[]; disabled: boolean; textValue: string };\nconst [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);\n\ntype ScopedProps

= P & { __scopeSelect?: Scope };\nconst [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [\n createCollectionScope,\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface SelectContextValue {\n trigger: SelectTriggerElement | null;\n onTriggerChange(node: SelectTriggerElement | null): void;\n valueNode: SelectValueElement | null;\n onValueNodeChange(node: SelectValueElement): void;\n valueNodeHasChildren: boolean;\n onValueNodeHasChildrenChange(hasChildren: boolean): void;\n contentId: string;\n open: boolean;\n required?: boolean;\n onOpenChange(open: boolean): void;\n dir: SelectProps['dir'];\n triggerPointerDownPosRef: React.MutableRefObject<{ x: number; y: number } | null>;\n disabled?: boolean;\n value?: string | string[];\n onValueChange(value: string | string[]): void;\n multi: boolean;\n}\n\nconst [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);\n\ntype NativeOption = React.ReactElement>;\n\ntype SelectNativeOptionsContextValue = {\n onNativeOptionAdd(option: NativeOption): void;\n onNativeOptionRemove(option: NativeOption): void;\n};\nconst [SelectNativeOptionsProvider, useSelectNativeOptionsContext] =\n createSelectContext(SELECT_NAME);\n\ninterface SharedSelectProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n name?: string;\n autoComplete?: string;\n disabled?: boolean;\n required?: boolean;\n}\n\ninterface SingleSelectProps extends SharedSelectProps {\n onValueChange?(value: string): void;\n value?: string;\n defaultValue?: string;\n multi?: false;\n}\n\ninterface MultiSelectProps extends SharedSelectProps {\n onValueChange?(value: string[]): void;\n value?: string[];\n defaultValue?: string[];\n multi: true;\n}\n\ntype SelectProps = SingleSelectProps | MultiSelectProps;\n\nconst Select = (props: ScopedProps) => {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n dir,\n // name,\n // autoComplete,\n disabled,\n required,\n multi = false,\n } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const [trigger, setTrigger] = React.useState(null);\n const [valueNode, setValueNode] = React.useState(null);\n const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);\n const direction = useDirection(dir);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange(value: string | string[]) {\n if (onValueChange) {\n if (Array.isArray(value)) {\n // @ts-expect-error the type for `onValueChange` is a join of the possible types, this should be fixed...\n onValueChange(value);\n } else {\n // @ts-expect-error the type for `onValueChange` is a join of the possible types, this should be fixed...\n onValueChange(value);\n }\n }\n },\n });\n\n const triggerPointerDownPosRef = React.useRef<{ x: number; y: number } | null>(null);\n\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const [_nativeOptionsSet, setNativeOptionsSet] = React.useState(new Set());\n\n // The native `select` only associates the correct default value if the corresponding\n // `option` is rendered as a child **at the same time** as itself.\n // Because it might take a few renders for our items to gather the information to build\n // the native `option`(s), we generate a key on the `select` to make sure React re-builds it\n // each time the options change.\n // const nativeSelectKey = Array.from(nativeOptionsSet)\n // .map((option) => option.props.value)\n // .join(';');\n\n return (\n \n \n \n {\n setNativeOptionsSet((prev) => new Set(prev).add(option));\n }, [])}\n onNativeOptionRemove={React.useCallback((option) => {\n setNativeOptionsSet((prev) => {\n const optionsSet = new Set(prev);\n optionsSet.delete(option);\n\n return optionsSet;\n });\n }, [])}\n >\n {children}\n \n \n {/* {isFormControl ? (\n setValue(event.target.value)}\n disabled={disabled}\n >\n {value === undefined ? \n );\n};\n\nSelect.displayName = SELECT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SelectTrigger';\n\ntype SelectTriggerElement = React.ElementRef;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef;\ntype SelectTriggerProps = PrimitiveButtonProps;\n\nconst SelectTrigger = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, ...triggerProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect);\n const isDisabled = context.disabled;\n const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);\n const getItems = useCollection(__scopeSelect);\n\n const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.value === context.value);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n\n if (nextItem !== undefined && !Array.isArray(nextItem.value)) {\n const newValue = context.multi ? [nextItem.value] : nextItem.value;\n context.onValueChange(newValue);\n }\n });\n\n const handleOpen = () => {\n if (!isDisabled) {\n context.onOpenChange(true);\n // reset typeahead when we open\n resetTypeahead();\n }\n };\n\n /**\n * The `combobox` was a `button` element, instead it is now a `div` element\n * this avoids events issues with nesting the DesignSystem Tags inside the Select Trigger\n */\n return (\n \n {\n // Whilst browsers generally have no issue focusing the trigger when clicking\n // on a label, Safari seems to struggle with the fact that there's no `onClick`.\n // We force `focus` in this case. Note: this doesn't create any other side-effect\n // because we are preventing default in `onPointerDown` so effectively\n // this only runs for a label \"click\"\n event.currentTarget.focus();\n })}\n onPointerDown={composeEventHandlers(triggerProps.onPointerDown, (event) => {\n // prevent implicit pointer capture\n // https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture\n const target = event.target as HTMLElement;\n\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n\n /**\n * This has been added to allow events inside the trigger to be easily fired\n * e.g. the clear button or removing a tag\n */\n const buttonTarg = target.closest('button') ?? target.closest('div');\n\n if (buttonTarg !== event.currentTarget) {\n return;\n }\n\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (event.button === 0 && event.ctrlKey === false) {\n handleOpen();\n context.triggerPointerDownPosRef.current = {\n x: Math.round(event.pageX),\n y: Math.round(event.pageY),\n };\n // prevent trigger from stealing focus from the active item after opening.\n event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(triggerProps.onKeyDown, (event) => {\n const isTypingAhead = searchRef.current !== '';\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n const target = event.target as HTMLElement;\n\n const buttonTarg = target.closest('button') ?? target.closest('div');\n\n if (buttonTarg !== event.currentTarget) {\n return;\n }\n\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);\n\n if (isTypingAhead && event.key === ' ') return;\n\n if (OPEN_KEYS.includes(event.key)) {\n handleOpen();\n event.preventDefault();\n }\n })}\n />\n \n );\n },\n);\n\nSelectTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectValue\n * -----------------------------------------------------------------------------------------------*/\n\nconst VALUE_NAME = 'SelectValue';\n\ntype SelectValueElement = React.ElementRef;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef;\ntype SelectValueRenderFn = {\n ({ value, textValue }: { value?: string; textValue?: string }): React.ReactNode;\n (value?: string): React.ReactNode;\n};\ninterface SelectValueProps extends Omit {\n placeholder?: React.ReactNode;\n children?: React.ReactNode | SelectValueRenderFn;\n}\n\nconst SelectValue = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, children, placeholder, ...valueProps } = props;\n const context = useSelectContext(VALUE_NAME, __scopeSelect);\n const { onValueNodeHasChildrenChange } = context;\n const hasChildren = children !== undefined;\n const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n const [valuedItems, setValuedItems] = React.useState([]);\n\n const getItems = useCollection(__scopeSelect);\n\n useLayoutEffect(() => {\n onValueNodeHasChildrenChange(hasChildren);\n }, [onValueNodeHasChildrenChange, hasChildren]);\n\n /**\n * SelectValue can now receive a function as a child. This allows\n * us to render the Tags inside the Trigger based on the item values\n *\n * Because of the imperative nature of `getItems` we store the items in state\n * based on changes to the select value, if an item's value is in `getItems`\n * it's essentially memoized for the render function.\n */\n\n React.useLayoutEffect(() => {\n if (Array.isArray(context.value) && valuedItems.length !== context.value.length) {\n const timeout = setTimeout(() => {\n const valuedItems = getItems().filter((item) =>\n !Array.isArray(item.value) ? context.value?.includes(item.value) : false,\n );\n\n setValuedItems(valuedItems);\n });\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [context.value, getItems, valuedItems]);\n\n let renderValue: React.ReactNode;\n\n if ((context.value === undefined || context.value.length === 0) && placeholder !== undefined) {\n renderValue = {placeholder};\n } else if (typeof children === 'function') {\n if (Array.isArray(context.value)) {\n const childrenArray = context.value.map((value) => {\n const valueItem = valuedItems.find((item) => item.value === value);\n\n if (!valueItem) {\n return null;\n }\n\n return children({ value, textValue: valueItem?.textValue });\n });\n\n renderValue = childrenArray.every((child) => child === null) ? placeholder : childrenArray;\n } else {\n renderValue = children(context.value);\n }\n } else {\n renderValue = children;\n }\n\n /**\n * Wrap the renderValue in it's own span so react knows to re-render this.\n * Otherwise it will render the incorrect thing on clear – nothing.\n */\n return (\n \n {renderValue || null}\n \n );\n },\n);\n\nSelectValue.displayName = VALUE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectIcon\n * -----------------------------------------------------------------------------------------------*/\n\nconst ICON_NAME = 'SelectIcon';\n\ntype SelectIconElement = React.ElementRef;\ntype SelectIconProps = PrimitiveSpanProps;\n\nconst SelectIcon = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, children, ...iconProps } = props;\n\n return (\n \n {children || '▼'}\n \n );\n },\n);\n\nSelectIcon.displayName = ICON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'SelectPortal';\n\ntype PortalProps = React.ComponentPropsWithoutRef;\ninterface SelectPortalProps extends Omit {\n children?: React.ReactNode;\n}\n\nconst SelectPortal = (props: ScopedProps) => {\n return ;\n};\n\nSelectPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent';\n\ntype SelectContentElement = SelectContentImplElement;\ntype SelectContentProps = SelectContentImplProps;\n\nconst SelectContent = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const context = useSelectContext(CONTENT_NAME, props.__scopeSelect);\n const [fragment, setFragment] = React.useState();\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n if (!context.open) {\n const frag = fragment as Element | undefined;\n\n return frag\n ? ReactDOM.createPortal(\n \n \n

{props.children}
\n \n ,\n frag,\n )\n : null;\n }\n\n return ;\n },\n);\n\nSelectContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContentImpl\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_MARGIN = 10;\n\ntype SelectContentContextValue = {\n content?: SelectContentElement | null;\n viewport?: SelectViewportElement | null;\n onViewportChange?: (node: SelectViewportElement | null) => void;\n itemRefCallback?: (node: SelectItemElement | null, value: string | string[], disabled: boolean) => void;\n selectedItem?: SelectItemElement | null;\n onItemLeave?: () => void;\n itemTextRefCallback?: (node: SelectItemTextElement | null, value: string | string[], disabled: boolean) => void;\n focusSelectedItem?: () => void;\n selectedItemText?: SelectItemTextElement | null;\n position?: SelectContentProps['position'];\n isPositioned?: boolean;\n searchRef?: React.RefObject;\n};\n\nconst [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME);\n\nconst CONTENT_IMPL_NAME = 'SelectContentImpl';\n\ntype SelectContentImplElement = SelectPopperPositionElement | SelectItemAlignedPositionElement;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef;\n\ntype SelectPopperPrivateProps = { onPlaced?: PopperContentProps['onPlaced'] };\n\ninterface SelectContentImplProps\n extends Omit,\n Omit {\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n\n position?: 'item-aligned' | 'popper';\n}\n\nconst SelectContentImpl = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const {\n __scopeSelect,\n position = 'item-aligned',\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n //\n // PopperContent props\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n //\n ...contentProps\n } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const [content, setContent] = React.useState(null);\n const [viewport, setViewport] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n const [selectedItem, setSelectedItem] = React.useState(null);\n const [selectedItemText, setSelectedItemText] = React.useState(null);\n const getItems = useCollection(__scopeSelect);\n const [isPositioned, setIsPositioned] = React.useState(false);\n const firstValidItemFoundRef = React.useRef(false);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (content) return hideOthers(content);\n }, [content]);\n\n // Make sure the whole tree has focus guards as our `Select` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n const focusFirst = React.useCallback(\n (candidates: Array) => {\n const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);\n const [lastItem] = restItems.slice(-1);\n\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n // eslint-disable-next-line no-restricted-syntax\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate?.scrollIntoView({ block: 'nearest' });\n\n // viewport might have padding so scroll to its edges when focusing first/last items.\n if (candidate === firstItem && viewport) viewport.scrollTop = 0;\n\n if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;\n\n candidate?.focus();\n\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n },\n [getItems, viewport],\n );\n\n const focusSelectedItem = React.useCallback(\n () => focusFirst([selectedItem, content]),\n [focusFirst, selectedItem, content],\n );\n\n // Since this is not dependent on layout, we want to ensure this runs at the same time as\n // other effects across components. Hence why we don't call `focusSelectedItem` inside `position`.\n React.useEffect(() => {\n if (isPositioned) {\n focusSelectedItem();\n }\n }, [isPositioned, focusSelectedItem]);\n\n // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`\n // and close on `pointerup` outside.\n const { onOpenChange, triggerPointerDownPosRef } = context;\n React.useEffect(() => {\n if (content) {\n let pointerMoveDelta = { x: 0, y: 0 };\n\n const handlePointerMove = (event: PointerEvent) => {\n pointerMoveDelta = {\n x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)),\n y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0)),\n };\n };\n const handlePointerUp = (event: PointerEvent) => {\n // If the pointer hasn't moved by a certain threshold then we prevent selecting item on `pointerup`.\n if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) {\n event.preventDefault();\n } else if (!content.contains(event.target as HTMLElement)) {\n // otherwise, if the event was outside the content, close.\n onOpenChange(false);\n }\n document.removeEventListener('pointermove', handlePointerMove);\n triggerPointerDownPosRef.current = null;\n };\n\n if (triggerPointerDownPosRef.current !== null) {\n document.addEventListener('pointermove', handlePointerMove);\n document.addEventListener('pointerup', handlePointerUp, { capture: true, once: true });\n }\n\n return () => {\n document.removeEventListener('pointermove', handlePointerMove);\n document.removeEventListener('pointerup', handlePointerUp, { capture: true });\n };\n }\n }, [content, onOpenChange, triggerPointerDownPosRef]);\n\n React.useEffect(() => {\n const close = () => onOpenChange(false);\n window.addEventListener('blur', close);\n window.addEventListener('resize', close);\n\n return () => {\n window.removeEventListener('blur', close);\n window.removeEventListener('resize', close);\n };\n }, [onOpenChange]);\n\n const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n\n if (nextItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (nextItem.ref.current as HTMLElement).focus());\n }\n });\n\n const itemRefCallback = React.useCallback(\n (node: SelectItemElement | null, value: string | string[], disabled: boolean) => {\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem = context.value !== undefined && context.value === value;\n\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItem(node);\n\n if (isFirstValidItem) firstValidItemFoundRef.current = true;\n }\n },\n [context.value],\n );\n const handleItemLeave = React.useCallback(() => content?.focus(), [content]);\n const itemTextRefCallback = React.useCallback(\n (node: SelectItemTextElement | null, value: string | string[], disabled: boolean) => {\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem =\n context.value !== undefined &&\n (Array.isArray(value) ? value.every((v) => context.value?.includes(v)) : context.value === value);\n\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItemText(node);\n }\n },\n [context.value],\n );\n\n const SelectPosition = position === 'popper' ? SelectPopperPosition : SelectItemAlignedPosition;\n\n // Silently ignore props that are not supported by `SelectItemAlignedPosition`\n const popperContentProps =\n SelectPosition === SelectPopperPosition\n ? {\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n }\n : {};\n\n return (\n \n \n {\n // we prevent open autofocus because we manually focus the selected item\n event.preventDefault();\n }}\n onUnmountAutoFocus={composeEventHandlers(onCloseAutoFocus, (event) => {\n context.trigger?.focus({ preventScroll: true });\n /**\n * In firefox there's a some kind of selection happening after\n * unmounting all of this, so we make sure we clear that.\n */\n document.getSelection()?.empty();\n event.preventDefault();\n })}\n >\n event.preventDefault()}\n onDismiss={() => context.onOpenChange(false)}\n >\n event.preventDefault()}\n {...contentProps}\n {...popperContentProps}\n onPlaced={() => setIsPositioned(true)}\n ref={composedRefs}\n style={{\n // flex layout so we can place the scroll buttons properly\n display: 'flex',\n flexDirection: 'column',\n // reset the outline by default as the content MAY get focused\n outline: 'none',\n ...contentProps.style,\n }}\n onKeyDown={composeEventHandlers(contentProps.onKeyDown, (event) => {\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n\n // select should not be navigated using tab key so we prevent it\n if (event.key === 'Tab') event.preventDefault();\n\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);\n\n if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {\n const items = getItems().filter((item) => !item.disabled);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (['ArrowUp', 'End'].includes(event.key)) {\n candidateNodes = candidateNodes.slice().reverse();\n }\n if (['ArrowUp', 'ArrowDown'].includes(event.key)) {\n const currentElement = event.target as SelectItemElement;\n const currentIndex = candidateNodes.indexOf(currentElement);\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n\n event.preventDefault();\n }\n })}\n />\n \n \n \n \n );\n },\n);\n\nSelectContentImpl.displayName = CONTENT_IMPL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemAlignedPosition\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_ALIGNED_POSITION_NAME = 'SelectItemAlignedPosition';\n\ntype SelectItemAlignedPositionElement = React.ElementRef;\ninterface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {}\n\nconst SelectItemAlignedPosition = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, onPlaced, ...popperProps } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(CONTENT_NAME, __scopeSelect);\n const [contentWrapper, setContentWrapper] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n const getItems = useCollection(__scopeSelect);\n const shouldExpandOnScrollRef = React.useRef(false);\n const shouldRepositionRef = React.useRef(true);\n\n const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;\n const position = React.useCallback(() => {\n if (\n context.trigger &&\n context.valueNode &&\n contentWrapper &&\n content &&\n viewport &&\n selectedItem &&\n selectedItemText\n ) {\n const triggerRect = context.trigger.getBoundingClientRect();\n\n // -----------------------------------------------------------------------------------------\n // Horizontal positioning\n // -----------------------------------------------------------------------------------------\n const contentRect = content.getBoundingClientRect();\n const valueNodeRect = context.valueNode.getBoundingClientRect();\n const itemTextRect = selectedItemText.getBoundingClientRect();\n\n if (context.dir !== 'rtl') {\n const itemTextOffset = itemTextRect.left - contentRect.left;\n const left = valueNodeRect.left - itemTextOffset;\n const leftDelta = triggerRect.left - left;\n const minContentWidth = triggerRect.width + leftDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const rightEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedLeft = clamp(left, [CONTENT_MARGIN, rightEdge - contentWidth]);\n\n contentWrapper.style.minWidth = `${minContentWidth}px`;\n contentWrapper.style.left = `${clampedLeft}px`;\n } else {\n const itemTextOffset = contentRect.right - itemTextRect.right;\n const right = window.innerWidth - valueNodeRect.right - itemTextOffset;\n const rightDelta = window.innerWidth - triggerRect.right - right;\n const minContentWidth = triggerRect.width + rightDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const leftEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedRight = clamp(right, [CONTENT_MARGIN, leftEdge - contentWidth]);\n\n contentWrapper.style.minWidth = `${minContentWidth}px`;\n contentWrapper.style.right = `${clampedRight}px`;\n }\n\n // -----------------------------------------------------------------------------------------\n // Vertical positioning\n // -----------------------------------------------------------------------------------------\n const items = getItems();\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const itemsHeight = viewport.scrollHeight;\n\n const contentStyles = window.getComputedStyle(content);\n const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);\n const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);\n const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);\n const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);\n const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; // prettier-ignore\n const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);\n\n const viewportStyles = window.getComputedStyle(viewport);\n const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);\n const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);\n\n const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;\n const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;\n\n const selectedItemHalfHeight = selectedItem.offsetHeight / 2;\n const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;\n const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;\n const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;\n\n const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;\n\n if (willAlignWithoutTopOverflow) {\n const isLastItem = selectedItem === items[items.length - 1].ref.current;\n contentWrapper.style.bottom = `${0}px`;\n const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;\n const clampedTriggerMiddleToBottomEdge = Math.max(\n triggerMiddleToBottomEdge,\n selectedItemHalfHeight +\n // viewport might have padding bottom, include it to avoid a scrollable viewport\n (isLastItem ? viewportPaddingBottom : 0) +\n viewportOffsetBottom +\n contentBorderBottomWidth,\n );\n const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;\n contentWrapper.style.height = `${height}px`;\n } else {\n const isFirstItem = selectedItem === items[0].ref.current;\n contentWrapper.style.top = `${0}px`;\n const clampedTopEdgeToTriggerMiddle = Math.max(\n topEdgeToTriggerMiddle,\n contentBorderTopWidth +\n viewport.offsetTop +\n // viewport might have padding top, include it to avoid a scrollable viewport\n (isFirstItem ? viewportPaddingTop : 0) +\n selectedItemHalfHeight,\n );\n const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;\n contentWrapper.style.height = `${height}px`;\n viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;\n }\n\n contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;\n contentWrapper.style.minHeight = `${minContentHeight}px`;\n contentWrapper.style.maxHeight = `${availableHeight}px`;\n // -----------------------------------------------------------------------------------------\n\n onPlaced?.();\n\n // we don't want the initial scroll position adjustment to trigger \"expand on scroll\"\n // so we explicitly turn it on only after they've registered.\n requestAnimationFrame(() => (shouldExpandOnScrollRef.current = true));\n }\n }, [\n getItems,\n context.trigger,\n context.valueNode,\n contentWrapper,\n content,\n viewport,\n selectedItem,\n selectedItemText,\n context.dir,\n onPlaced,\n ]);\n\n useLayoutEffect(() => position(), [position]);\n\n // copy z-index from content to wrapper\n const [contentZIndex, setContentZIndex] = React.useState();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n\n // When the viewport becomes scrollable at the top, the scroll up button will mount.\n // Because it is part of the normal flow, it will push down the viewport, thus throwing our\n // trigger => selectedItem alignment off by the amount the viewport was pushed down.\n // We wait for this to happen and then re-run the positining logic one more time to account for it.\n const handleScrollButtonChange = React.useCallback(\n (node: SelectScrollButtonImplElement | null) => {\n if (node && shouldRepositionRef.current === true) {\n position();\n focusSelectedItem?.();\n shouldRepositionRef.current = false;\n }\n },\n [position, focusSelectedItem],\n );\n\n return (\n \n \n \n \n \n );\n },\n);\n\nSelectItemAlignedPosition.displayName = ITEM_ALIGNED_POSITION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectPopperPosition\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPPER_POSITION_NAME = 'SelectPopperPosition';\n\ntype SelectPopperPositionElement = React.ElementRef;\ntype PopperContentProps = React.ComponentPropsWithoutRef;\ninterface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps {}\n\nconst SelectPopperPosition = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, align = 'start', collisionPadding = CONTENT_MARGIN, ...popperProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n\n return (\n \n );\n },\n);\n\nSelectPopperPosition.displayName = POPPER_POSITION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectViewport\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectViewportContextValue = {\n contentWrapper?: HTMLDivElement | null;\n shouldExpandOnScrollRef?: React.RefObject;\n onScrollButtonChange?: (node: SelectScrollButtonImplElement | null) => void;\n};\n\nconst [SelectViewportProvider, useSelectViewportContext] = createSelectContext(\n CONTENT_NAME,\n {},\n);\n\nconst VIEWPORT_NAME = 'SelectViewport';\n\ntype SelectViewportElement = React.ElementRef;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef;\ntype SelectViewportProps = PrimitiveDivProps;\n\nconst SelectViewport = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, ...viewportProps } = props;\n const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect);\n const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect);\n const composedRefs = useComposedRefs(forwardedRef, contentContext.onViewportChange);\n const prevScrollTopRef = React.useRef(0);\n\n return (\n <>\n {/* Hide scrollbars cross-browser and enable momentum scroll for touch devices */}\n \n \n {\n const viewport = event.currentTarget;\n const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;\n\n if (shouldExpandOnScrollRef?.current && contentWrapper) {\n const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);\n\n if (scrolledBy > 0) {\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const cssMinHeight = parseFloat(contentWrapper.style.minHeight);\n const cssHeight = parseFloat(contentWrapper.style.height);\n const prevHeight = Math.max(cssMinHeight, cssHeight);\n\n if (prevHeight < availableHeight) {\n const nextHeight = prevHeight + scrolledBy;\n const clampedNextHeight = Math.min(availableHeight, nextHeight);\n const heightDiff = nextHeight - clampedNextHeight;\n\n contentWrapper.style.height = `${clampedNextHeight}px`;\n\n if (contentWrapper.style.bottom === '0px') {\n viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;\n // ensure the content stays pinned to the bottom\n contentWrapper.style.justifyContent = 'flex-end';\n }\n }\n }\n }\n prevScrollTopRef.current = viewport.scrollTop;\n })}\n />\n \n \n );\n },\n);\n\nSelectViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'SelectGroup';\n\ntype SelectGroupContextValue = { id: string };\n\nconst [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);\n\ntype SelectGroupElement = React.ElementRef;\ntype SelectGroupProps = PrimitiveDivProps;\n\nconst SelectGroup = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, ...groupProps } = props;\n const groupId = useId();\n\n return (\n \n \n \n );\n },\n);\n\nSelectGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'SelectLabel';\n\ntype SelectLabelElement = React.ElementRef;\ntype SelectLabelProps = PrimitiveDivProps;\n\nconst SelectLabel = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, ...labelProps } = props;\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);\n\n return ;\n },\n);\n\nSelectLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'SelectItem';\n\ntype SelectItemContextValue = {\n value: string | string[];\n disabled: boolean;\n textId: string;\n isSelected: boolean;\n isIntermediate: boolean;\n onItemTextChange(node: SelectItemTextElement | null): void;\n};\n\nconst [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);\n\ntype SelectItemElement = React.ElementRef;\ninterface SelectItemProps extends PrimitiveDivProps {\n value: string | string[];\n disabled?: boolean;\n textValue?: string;\n}\n\nconst SelectItem = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, value, disabled = false, textValue: textValueProp, ...itemProps } = props;\n const context = useSelectContext(ITEM_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);\n const isSelected =\n typeof value === 'string'\n ? Array.isArray(context.value)\n ? context.value.includes(value)\n : context.value === value\n : value.every((v) => context.value?.includes(v));\n\n const isIntermediate =\n Array.isArray(context.value) && Array.isArray(value) && value.some((v) => context.value?.includes(v));\n const [textValue, setTextValue] = React.useState(textValueProp ?? '');\n const [isFocused, setIsFocused] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, (node) =>\n contentContext.itemRefCallback?.(node, value, disabled),\n );\n const textId = useId();\n\n const handleSelect = () => {\n if (!disabled) {\n let newValue: string | string[] = context.multi && typeof value === 'string' ? [value] : value;\n\n if (isIntermediate && !isSelected) {\n context.onValueChange(newValue);\n } else if (Array.isArray(context.value)) {\n newValue = toggleArrayValue(value, context.value);\n }\n\n context.onValueChange(newValue);\n\n if (!context.multi) {\n context.onOpenChange(false);\n }\n }\n };\n\n if (!context.multi && Array.isArray(value)) {\n throw new Error('You can only pass an array of values in multi selects');\n }\n\n return (\n {\n setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? '').trim());\n }, [])}\n >\n \n setIsFocused(true))}\n onBlur={composeEventHandlers(itemProps.onBlur, () => setIsFocused(false))}\n onPointerUp={composeEventHandlers(itemProps.onPointerUp, handleSelect)}\n onPointerMove={composeEventHandlers(itemProps.onPointerMove, (event) => {\n if (disabled) {\n contentContext.onItemLeave?.();\n } else {\n // even though safari doesn't support this option, it's acceptable\n // as it only means it might scroll a few pixels when using the pointer.\n event.currentTarget.focus({ preventScroll: true });\n }\n })}\n onPointerLeave={composeEventHandlers(itemProps.onPointerLeave, (event) => {\n if (event.currentTarget === document.activeElement) {\n contentContext.onItemLeave?.();\n }\n })}\n onKeyDown={composeEventHandlers(itemProps.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef?.current !== '';\n\n if (isTypingAhead && event.key === ' ') return;\n\n if (SELECTION_KEYS.includes(event.key)) handleSelect();\n\n // prevent page scroll if using the space key to select an item\n if (event.key === ' ') event.preventDefault();\n })}\n />\n \n \n );\n },\n);\n\nSelectItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'SelectItemText';\n\ntype SelectItemTextElement = React.ElementRef;\ntype SelectItemTextProps = PrimitiveSpanProps;\n\nconst SelectItemText = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { __scopeSelect, className: _className, style: _style, ...itemTextProps } = props;\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);\n const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);\n const [itemTextNode, setItemTextNode] = React.useState(null);\n const composedRefs = useComposedRefs(\n forwardedRef,\n (node) => setItemTextNode(node),\n itemContext.onItemTextChange,\n (node) => contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled),\n );\n\n const textContent = itemTextNode?.textContent;\n const nativeOption = React.useMemo(\n () => (\n \n {textContent}\n \n ),\n [itemContext.disabled, itemContext.value, textContent],\n );\n\n const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;\n useLayoutEffect(() => {\n onNativeOptionAdd(nativeOption);\n\n return () => onNativeOptionRemove(nativeOption);\n }, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);\n\n return (\n <>\n \n\n {/* Portal the select item text into the trigger value node */}\n {itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren\n ? ReactDOM.createPortal(itemTextProps.children, context.valueNode)\n : null}\n \n );\n },\n);\n\nSelectItemText.displayName = ITEM_TEXT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'SelectItemIndicator';\n\ntype SelectItemIndicatorElement = React.ElementRef;\ninterface SelectItemIndicatorProps extends Omit {\n children?: React.ReactNode | ((state: { isSelected: boolean; isIntermediate: boolean }) => React.ReactNode);\n}\n\nconst SelectItemIndicator = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, children, ...itemIndicatorProps } = props;\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);\n\n /**\n * Children for SelectItemIndicator can be a render prop function which in a multi-select\n * allows us to render an empty or full checkbox depending on the state of the item.\n *\n * Because the SelectItem can recieve an array of values, isIntermediate is true when\n * at least one of those values is selected, it's passed to the ItemContext similarly\n * to how isSelected is passed. So for \"group parents\", they can be correctly styled.\n */\n\n if (typeof children === 'function') {\n return (\n \n {children({\n isSelected: itemContext.isSelected,\n isIntermediate: itemContext.isIntermediate,\n })}\n \n );\n }\n\n return itemContext.isSelected ? (\n \n {children}\n \n ) : null;\n },\n);\n\nSelectItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollUpButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';\n\ntype SelectScrollUpButtonElement = SelectScrollButtonImplElement;\ntype SelectScrollUpButtonProps = Omit;\n\nconst SelectScrollUpButton = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const [canScrollUp, setCanScrollUp] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n const viewport = contentContext.viewport;\n const handleScroll = () => {\n const canScrollUp = viewport.scrollTop > 0;\n setCanScrollUp(canScrollUp);\n };\n handleScroll();\n viewport.addEventListener('scroll', handleScroll);\n\n return () => viewport.removeEventListener('scroll', handleScroll);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n\n return canScrollUp ? (\n {\n const { viewport, selectedItem } = contentContext;\n\n if (viewport && selectedItem) {\n viewport.scrollTop -= selectedItem.offsetHeight;\n }\n }}\n />\n ) : null;\n },\n);\n\nSelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollDownButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';\n\ntype SelectScrollDownButtonElement = SelectScrollButtonImplElement;\ntype SelectScrollDownButtonProps = Omit;\n\nconst SelectScrollDownButton = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const [canScrollDown, setCanScrollDown] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n const viewport = contentContext.viewport;\n const handleScroll = () => {\n const maxScroll = viewport.scrollHeight - viewport.clientHeight;\n // we use Math.ceil here because if the UI is zoomed-in\n // `scrollTop` is not always reported as an integer\n const canScrollDown = Math.ceil(viewport.scrollTop) < maxScroll;\n setCanScrollDown(canScrollDown);\n };\n handleScroll();\n viewport.addEventListener('scroll', handleScroll);\n\n return () => viewport.removeEventListener('scroll', handleScroll);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n\n return canScrollDown ? (\n {\n const { viewport, selectedItem } = contentContext;\n\n if (viewport && selectedItem) {\n viewport.scrollTop += selectedItem.offsetHeight;\n }\n }}\n />\n ) : null;\n },\n);\n\nSelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;\n\ntype SelectScrollButtonImplElement = React.ElementRef;\ninterface SelectScrollButtonImplProps extends PrimitiveDivProps {\n onAutoScroll(): void;\n}\n\nconst SelectScrollButtonImpl = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;\n const contentContext = useSelectContentContext('SelectScrollButton', __scopeSelect);\n const autoScrollTimerRef = React.useRef(null);\n const getItems = useCollection(__scopeSelect);\n\n const clearAutoScrollTimer = React.useCallback(() => {\n if (autoScrollTimerRef.current !== null) {\n window.clearInterval(autoScrollTimerRef.current);\n autoScrollTimerRef.current = null;\n }\n }, []);\n\n React.useEffect(() => {\n return () => clearAutoScrollTimer();\n }, [clearAutoScrollTimer]);\n\n // When the viewport becomes scrollable on either side, the relevant scroll button will mount.\n // Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)\n // the viewport, potentially causing the active item to now be partially out of view.\n // We re-run the `scrollIntoView` logic to make sure it stays within the viewport.\n useLayoutEffect(() => {\n const activeItem = getItems().find((item) => item.ref.current === document.activeElement);\n activeItem?.ref.current?.scrollIntoView({ block: 'nearest' });\n }, [getItems]);\n\n return (\n {\n contentContext.onItemLeave?.();\n\n if (autoScrollTimerRef.current === null) {\n autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);\n }\n })}\n onPointerLeave={composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {\n clearAutoScrollTimer();\n })}\n />\n );\n },\n);\n\nSelectScrollButtonImpl.displayName = 'SelectScrollButtonImpl';\n\n/* -------------------------------------------------------------------------------------------------\n * SelectSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'SelectSeparator';\n\ntype SelectSeparatorElement = React.ElementRef;\ntype SelectSeparatorProps = PrimitiveDivProps;\n\nconst SelectSeparator = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, ...separatorProps } = props;\n\n return ;\n },\n);\n\nSelectSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'SelectArrow';\n\ntype SelectArrowElement = React.ElementRef;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef;\ntype SelectArrowProps = PopperArrowProps;\n\nconst SelectArrow = React.forwardRef(\n (props: ScopedProps, forwardedRef) => {\n const { __scopeSelect, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const context = useSelectContext(ARROW_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);\n\n return context.open && contentContext.position === 'popper' ? (\n \n ) : null;\n },\n);\n\nSelectArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_SELECT_NAME = 'BubbleSelect';\n\nconst BubbleSelect = React.forwardRef>(\n (props, forwardedRef) => {\n const { value, ...selectProps } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const prevValue = usePrevious(value);\n const context = useSelectContext(BUBBLE_SELECT_NAME, undefined);\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!;\n const selectProto = window.HTMLSelectElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value') as PropertyDescriptor;\n const setValue = descriptor.set;\n\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true });\n setValue.call(select, value);\n select.dispatchEvent(event);\n }\n }, [prevValue, value]);\n\n let defaultValue = value;\n\n if (context.multi && !Array.isArray(value)) {\n defaultValue = [];\n }\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n return (\n \n \n \n );\n },\n);\n\nBubbleSelect.displayName = 'BubbleSelect';\n\nfunction useTypeaheadSearch(onSearchChange: (search: string) => void) {\n const handleSearchChange = useCallbackRef(onSearchChange);\n const searchRef = React.useRef('');\n const timerRef = React.useRef(0);\n\n const handleTypeaheadSearch = React.useCallback(\n (key: string) => {\n const search = searchRef.current + key;\n handleSearchChange(search);\n\n (function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n\n // Reset `searchRef` 1 second after it was last updated\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n })(search);\n },\n [handleSearchChange],\n );\n\n const resetTypeahead = React.useCallback(() => {\n searchRef.current = '';\n window.clearTimeout(timerRef.current);\n }, []);\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n return [searchRef, handleTypeaheadSearch, resetTypeahead] as const;\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in a list of items,\n * the search and the current item, and returns the next item (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through items starting with that character)\n *\n * We also reorder the items by wrapping the array around the current item.\n * This is so we always look forward from the current item, and picking the first\n * item will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current item from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current item still matches.\n */\nfunction findNextItem(items: T[], search: string, currentItem?: T) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;\n let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));\n const excludeCurrentItem = normalizedSearch.length === 1;\n\n if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem);\n const nextItem = wrappedItems.find((item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase()));\n\n return nextItem !== currentItem ? nextItem : undefined;\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\n\nconst toggleArrayValue = (value: string | string[], array: string[] = []): string[] => {\n if (Array.isArray(value)) {\n return value.reduce((acc, val) => toggleArrayValue(val, acc), array);\n }\n\n const index = array.indexOf(value);\n\n if (index === -1) {\n return [...array, value];\n }\n\n return [...array.slice(0, index), ...array.slice(index + 1)];\n};\n\nconst Root = Select;\nconst Trigger = SelectTrigger;\nconst Value = SelectValue;\nconst Icon = SelectIcon;\nconst Portal = SelectPortal;\nconst Content = SelectContent;\nconst Viewport = SelectViewport;\nconst Group = SelectGroup;\nconst Label = SelectLabel;\nconst Item = SelectItem;\nconst ItemText = SelectItemText;\nconst ItemIndicator = SelectItemIndicator;\nconst ScrollUpButton = SelectScrollUpButton;\nconst ScrollDownButton = SelectScrollDownButton;\nconst Separator = SelectSeparator;\nconst Arrow = SelectArrow;\n\nexport {\n createSelectScope,\n //\n Select,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectPortal,\n SelectContent,\n SelectViewport,\n SelectGroup,\n SelectLabel,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n SelectSeparator,\n SelectArrow,\n //\n Root,\n Trigger,\n Value,\n Icon,\n Portal,\n Content,\n Viewport,\n Group,\n Label,\n Item,\n ItemText,\n ItemIndicator,\n ScrollUpButton,\n ScrollDownButton,\n Separator,\n Arrow,\n};\nexport type {\n SingleSelectProps,\n MultiSelectProps,\n SelectProps,\n SelectTriggerProps,\n SelectValueProps,\n SelectValueRenderFn,\n SelectIconProps,\n SelectPortalProps,\n SelectContentProps,\n SelectContentImplProps,\n SelectViewportProps,\n SelectGroupProps,\n SelectLabelProps,\n SelectItemProps,\n SelectItemTextProps,\n SelectItemIndicatorProps,\n SelectScrollUpButtonProps,\n SelectScrollDownButtonProps,\n SelectSeparatorProps,\n SelectArrowProps,\n};\n","function composeEventHandlers(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {},\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !(event as unknown as Event).defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport { composeEventHandlers };\n"],"names":["createCollectionScope","previousMap","useCollection","OPEN_KEYS","SELECTION_KEYS","Collection","item","TRIGGER_NAME","composeEventHandlers","PORTAL_NAME","PortalPrimitive","CONTENT_NAME","CONTENT_MARGIN","VIEWPORT_NAME","ITEM_NAME","ITEM_TEXT_NAME","ITEM_INDICATOR_NAME","Root","Trigger","Icon","Portal","Content","Viewport","Item","ItemText","ItemIndicator","createCollection","value","valuedItems","canScrollUp","canScrollDown"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,iBAAqE,MAAc;AAK1F,QAAM,gBAAgB,GAAG,IAAI;AAC7B,QAAM,CAAC,yBAAyBA,sBAAqB,IAAI,mBAAmB,aAAa;AAUzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI,wBAAsC,eAAe;AAAA,IAC1G,eAAe,EAAE,SAAS,KAAA;AAAA,IAC1B,6BAAa,IAAA;AAAA,IACb,+BAAe,IAAA;AAAA,EAAc,CAC9B;AAED,QAAM,qBAAqB,CAAC,UAAmC;AAC7D,UAAM,EAAE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