@spark-ui/components 10.0.5 → 10.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/alert-dialog/index.js +1 -1
  3. package/dist/alert-dialog/index.js.map +1 -1
  4. package/dist/alert-dialog/index.mjs +1 -1
  5. package/dist/alert-dialog/index.mjs.map +1 -1
  6. package/dist/checkbox/index.js +2 -2
  7. package/dist/checkbox/index.js.map +1 -1
  8. package/dist/checkbox/index.mjs +2 -2
  9. package/dist/checkbox/index.mjs.map +1 -1
  10. package/dist/chip/index.js +1 -1
  11. package/dist/chip/index.js.map +1 -1
  12. package/dist/chip/index.mjs +1 -1
  13. package/dist/chip/index.mjs.map +1 -1
  14. package/dist/{chunk-7BTJUYP3.mjs → chunk-TUFNIIZE.mjs} +3 -3
  15. package/dist/chunk-TUFNIIZE.mjs.map +1 -0
  16. package/dist/combobox/index.js +8 -9
  17. package/dist/combobox/index.js.map +1 -1
  18. package/dist/combobox/index.mjs +8 -9
  19. package/dist/combobox/index.mjs.map +1 -1
  20. package/dist/dropdown/index.js +3 -3
  21. package/dist/dropdown/index.js.map +1 -1
  22. package/dist/dropdown/index.mjs +3 -3
  23. package/dist/dropdown/index.mjs.map +1 -1
  24. package/dist/input/index.js +2 -2
  25. package/dist/input/index.js.map +1 -1
  26. package/dist/input/index.mjs +1 -1
  27. package/dist/progress/index.js +1 -1
  28. package/dist/progress/index.js.map +1 -1
  29. package/dist/progress/index.mjs +1 -1
  30. package/dist/progress/index.mjs.map +1 -1
  31. package/dist/rating/index.js +1 -1
  32. package/dist/rating/index.js.map +1 -1
  33. package/dist/rating/index.mjs +1 -1
  34. package/dist/rating/index.mjs.map +1 -1
  35. package/dist/select/index.js +1 -1
  36. package/dist/select/index.js.map +1 -1
  37. package/dist/select/index.mjs +1 -1
  38. package/dist/select/index.mjs.map +1 -1
  39. package/dist/stepper/index.js +3 -3
  40. package/dist/stepper/index.js.map +1 -1
  41. package/dist/stepper/index.mjs +2 -2
  42. package/dist/stepper/index.mjs.map +1 -1
  43. package/dist/switch/index.js +1 -1
  44. package/dist/switch/index.js.map +1 -1
  45. package/dist/switch/index.mjs +1 -1
  46. package/dist/switch/index.mjs.map +1 -1
  47. package/dist/textarea/index.js +2 -2
  48. package/dist/textarea/index.js.map +1 -1
  49. package/dist/textarea/index.mjs +1 -1
  50. package/package.json +5 -6
  51. package/dist/chunk-7BTJUYP3.mjs.map +0 -1
  52. package/tsconfig.build.json +0 -9
@@ -18,7 +18,7 @@ import "../chunk-4F5DOL57.mjs";
18
18
 
19
19
  // src/combobox/ComboboxContext.tsx
20
20
  import { useFormFieldControl } from "@spark-ui/components/form-field";
21
- import { useCombinedState } from "@spark-ui/use-combined-state";
21
+ import { useCombinedState } from "@spark-ui/hooks/use-combined-state";
22
22
  import { useCombobox as useCombobox3, useMultipleSelection } from "downshift";
23
23
  import {
24
24
  createContext,
@@ -527,8 +527,8 @@ var ClearButton = ({
527
527
  ClearButton.displayName = "Combobox.ClearButton";
528
528
 
529
529
  // src/combobox/ComboboxDisclosure.tsx
530
+ import { useMergeRefs } from "@spark-ui/hooks/use-merge-refs";
530
531
  import { ArrowHorizontalDown } from "@spark-ui/icons/ArrowHorizontalDown";
531
- import { useMergeRefs } from "@spark-ui/use-merge-refs";
532
532
  import { cx as cx2 } from "class-variance-authority";
533
533
  import { jsx as jsx4 } from "react/jsx-runtime";
534
534
  var Disclosure = ({
@@ -640,8 +640,8 @@ Group.displayName = "Combobox.Group";
640
640
 
641
641
  // src/combobox/ComboboxInput.tsx
642
642
  import { useFormFieldControl as useFormFieldControl2 } from "@spark-ui/components/form-field";
643
- import { useCombinedState as useCombinedState2 } from "@spark-ui/use-combined-state";
644
- import { useMergeRefs as useMergeRefs2 } from "@spark-ui/use-merge-refs";
643
+ import { useCombinedState as useCombinedState2 } from "@spark-ui/hooks/use-combined-state";
644
+ import { useMergeRefs as useMergeRefs2 } from "@spark-ui/hooks/use-merge-refs";
645
645
  import { cx as cx5 } from "class-variance-authority";
646
646
  import {
647
647
  Fragment as Fragment2,
@@ -661,7 +661,7 @@ var Input = ({
661
661
  const ctx = useComboboxContext();
662
662
  const field = useFormFieldControl2();
663
663
  const [inputValue] = useCombinedState2(value, defaultValue);
664
- const { isInvalid, isRequired, description } = field;
664
+ const { isInvalid, description } = field;
665
665
  useEffect2(() => {
666
666
  if (inputValue != null) {
667
667
  ctx.setInputValue(inputValue);
@@ -733,7 +733,6 @@ var Input = ({
733
733
  disabled: ctx.disabled,
734
734
  readOnly: ctx.readOnly,
735
735
  "aria-invalid": isInvalid,
736
- required: isRequired,
737
736
  "aria-describedby": description
738
737
  }
739
738
  ) })
@@ -742,7 +741,7 @@ var Input = ({
742
741
  Input.displayName = "Combobox.Input";
743
742
 
744
743
  // src/combobox/ComboboxItem.tsx
745
- import { useMergeRefs as useMergeRefs3 } from "@spark-ui/use-merge-refs";
744
+ import { useMergeRefs as useMergeRefs3 } from "@spark-ui/hooks/use-merge-refs";
746
745
  import { cva, cx as cx6 } from "class-variance-authority";
747
746
 
748
747
  // src/combobox/ComboboxItemContext.tsx
@@ -878,7 +877,7 @@ var ItemIndicator = ({
878
877
  ItemIndicator.displayName = "Combobox.ItemIndicator";
879
878
 
880
879
  // src/combobox/ComboboxItems.tsx
881
- import { useMergeRefs as useMergeRefs4 } from "@spark-ui/use-merge-refs";
880
+ import { useMergeRefs as useMergeRefs4 } from "@spark-ui/hooks/use-merge-refs";
882
881
  import { cx as cx8 } from "class-variance-authority";
883
882
  import { useLayoutEffect, useRef as useRef2 } from "react";
884
883
  import { jsx as jsx12 } from "react/jsx-runtime";
@@ -1084,7 +1083,7 @@ SelectedItems.displayName = "Combobox.SelectedItems";
1084
1083
 
1085
1084
  // src/combobox/ComboboxTrigger.tsx
1086
1085
  import { useFormFieldControl as useFormFieldControl3 } from "@spark-ui/components/form-field";
1087
- import { useMergeRefs as useMergeRefs5 } from "@spark-ui/use-merge-refs";
1086
+ import { useMergeRefs as useMergeRefs5 } from "@spark-ui/hooks/use-merge-refs";
1088
1087
  import { cx as cx13 } from "class-variance-authority";
1089
1088
  import { Fragment as Fragment5, useEffect as useEffect6, useRef as useRef4 } from "react";
1090
1089
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/combobox/ComboboxContext.tsx","../../src/combobox/useCombobox/multipleSelectionReducer.ts","../../src/combobox/utils/index.ts","../../src/combobox/useCombobox/singleSelectionReducer.ts","../../src/combobox/Combobox.tsx","../../src/combobox/ComboboxClearButton.tsx","../../src/combobox/ComboboxDisclosure.tsx","../../src/combobox/ComboboxEmpty.tsx","../../src/combobox/ComboboxGroup.tsx","../../src/combobox/ComboboxItemsGroupContext.tsx","../../src/combobox/ComboboxInput.tsx","../../src/combobox/ComboboxItem.tsx","../../src/combobox/ComboboxItemContext.tsx","../../src/combobox/ComboboxItemIndicator.tsx","../../src/combobox/ComboboxItems.tsx","../../src/combobox/ComboboxItemText.tsx","../../src/combobox/ComboboxLabel.tsx","../../src/combobox/ComboboxLeadingIcon.tsx","../../src/combobox/ComboboxPopover.tsx","../../src/combobox/ComboboxPortal.tsx","../../src/combobox/ComboboxSelectedItems.tsx","../../src/combobox/ComboboxTrigger.tsx","../../src/combobox/ComboboxTrigger.styles.tsx","../../src/combobox/utils/useWidthIncreaseCallback.ts","../../src/combobox/index.ts"],"sourcesContent":["/* eslint-disable complexity */\n/* eslint-disable max-lines-per-function */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { useCombobox, useMultipleSelection } from 'downshift'\nimport {\n createContext,\n Dispatch,\n Fragment,\n PropsWithChildren,\n RefObject,\n SetStateAction,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react'\n\nimport { Popover } from '../popover'\nimport { type ComboboxItem, type DownshiftState, type ItemsMap } from './types'\nimport { multipleSelectionReducer } from './useCombobox/multipleSelectionReducer'\nimport { singleSelectionReducer } from './useCombobox/singleSelectionReducer'\nimport { getElementByIndex, getItemsFromChildren, hasChildComponent } from './utils'\n\nexport interface ComboboxContextState extends DownshiftState {\n itemsMap: ItemsMap\n filteredItemsMap: ItemsMap\n highlightedItem: ComboboxItem | undefined\n hasPopover: boolean\n multiple: boolean\n disabled: boolean\n readOnly: boolean\n wrap?: boolean\n state?: 'error' | 'alert' | 'success'\n lastInteractionType: 'mouse' | 'keyboard'\n setHasPopover: Dispatch<SetStateAction<boolean>>\n setLastInteractionType: (type: 'mouse' | 'keyboard') => void\n setOnInputValueChange: Dispatch<SetStateAction<((v: string) => void) | null>>\n innerInputRef: RefObject<HTMLInputElement | null>\n triggerAreaRef: RefObject<HTMLDivElement | null>\n isLoading?: boolean\n isTyping?: boolean\n setIsTyping: Dispatch<SetStateAction<boolean>>\n}\n\nexport type ComboboxContextCommonProps = PropsWithChildren<{\n /**\n * The controlled open state of the select. Must be used in conjunction with `onOpenChange`.\n */\n open?: boolean\n /**\n * Event handler called when the open state of the select changes.\n */\n onOpenChange?: (isOpen: boolean) => void\n /**\n * The open state of the select when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultOpen?: boolean\n /**\n * Use `state` prop to assign a specific state to the combobox, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * When true, prevents the user from interacting with the combobox.\n */\n disabled?: boolean\n /**\n * Sets the combobox as interactive or not.\n */\n readOnly?: boolean\n /**\n * When true, the items will be filtered depending on the value of the input (not case-sensitive).\n */\n filtering?: 'none' | 'auto' | 'strict'\n /**\n * By default, the combobox will clear or restore the input value to the selected item value on blur.\n */\n allowCustomValue?: boolean\n /**\n * In multiple selection, many selected items might be displayed. Be default, the combobox trigger will expand vertically to display them all.\n * If you wish to keep every item on a single line, disabled this property.\n */\n wrap?: boolean\n /**\n * Display a spinner to indicate to the user that the combobox is loading results for .\n */\n isLoading?: boolean\n}>\n\ninterface ComboboxPropsSingle {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple?: false\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string | null\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n}\n\ninterface ComboboxPropsMultiple {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple: true\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string[]\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string[]\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string[]) => void\n}\n\nexport type ComboboxContextProps = ComboboxContextCommonProps &\n (ComboboxPropsSingle | ComboboxPropsMultiple)\n\nconst ComboboxContext = createContext<ComboboxContextState | null>(null)\n\nconst getFilteredItemsMap = (map: ItemsMap, inputValue: string | undefined): ItemsMap => {\n if (!inputValue) return map\n\n return new Map(\n Array.from(map).filter(([_, { text }]) => text.toLowerCase().includes(inputValue.toLowerCase()))\n )\n}\n\nexport const ID_PREFIX = ':combobox'\n\nexport const ComboboxProvider = ({\n children,\n state: stateProp,\n allowCustomValue = false,\n filtering = 'auto',\n disabled: disabledProp = false,\n multiple = false,\n readOnly: readOnlyProp = false,\n wrap = true,\n // Value\n value: controlledValue,\n defaultValue,\n onValueChange,\n // Open\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n isLoading,\n}: ComboboxContextProps) => {\n const isMounted = useRef(false)\n\n // Input state\n const [inputValue, setInputValue] = useState<string | undefined>('')\n const [isTyping, setIsTyping] = useState<boolean>(filtering === 'strict')\n const triggerAreaRef = useRef<HTMLDivElement>(null)\n const innerInputRef = useRef<HTMLInputElement>(null)\n const [onInputValueChange, setOnInputValueChange] = useState<((v: string) => void) | null>(null)\n\n const [comboboxValue] = useCombinedState(controlledValue, defaultValue)\n\n const shouldFilterItems = filtering === 'strict' || (filtering === 'auto' && isTyping)\n\n // Items state\n const [itemsMap, setItemsMap] = useState<ItemsMap>(getItemsFromChildren(children))\n const [filteredItemsMap, setFilteredItems] = useState(\n shouldFilterItems ? getFilteredItemsMap(itemsMap, inputValue) : itemsMap\n )\n\n const [selectedItem, setSelectedItem] = useState<ComboboxItem | null>(\n itemsMap.get(comboboxValue as string) || null\n )\n\n const [selectedItems, setSelectedItems] = useState<ComboboxItem[]>(\n comboboxValue\n ? [...itemsMap.values()].filter(item => (comboboxValue as string[]).includes(item.value))\n : []\n )\n\n const onInternalSelectedItemChange = (item: ComboboxItem | null) => {\n setIsTyping(false)\n\n if (item?.value !== selectedItem?.value) {\n setSelectedItem(item)\n setTimeout(() => {\n onValueChange?.(item?.value as string & string[])\n }, 0)\n }\n }\n\n const onInternalSelectedItemsChange = (items: ComboboxItem[]) => {\n setSelectedItems(items)\n setTimeout(() => {\n onValueChange?.(items.map(i => i.value) as string & string[])\n }, 0)\n }\n\n // Sync internal state with controlled value\n useEffect(() => {\n if (!isMounted.current) {\n isMounted.current = true\n\n return\n }\n\n if (multiple) {\n const newSelectedItems = (comboboxValue as string[]).reduce(\n (accum: ComboboxItem[], value) => {\n const match = itemsMap.get(value)\n\n return match ? [...accum, match] : accum\n },\n []\n )\n\n setSelectedItems(comboboxValue ? newSelectedItems : [])\n } else {\n setSelectedItem(itemsMap.get(comboboxValue as string) || null)\n }\n }, [multiple ? JSON.stringify(comboboxValue) : comboboxValue])\n\n // Form field state\n const field = useFormFieldControl()\n\n const internalFieldLabelID = `${ID_PREFIX}-label-${useId()}`\n const internalFieldID = `${ID_PREFIX}-field-${useId()}`\n const id = field.id || internalFieldID\n const labelId = field.labelId || internalFieldLabelID\n\n const state = field.state || stateProp\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n\n const [hasPopover, setHasPopover] = useState<boolean>(\n hasChildComponent(children, 'Combobox.Popover')\n )\n const [lastInteractionType, setLastInteractionType] = useState<'mouse' | 'keyboard'>('mouse')\n\n useEffect(() => {\n setFilteredItems(shouldFilterItems ? getFilteredItemsMap(itemsMap, inputValue) : itemsMap)\n }, [inputValue, itemsMap])\n\n const multiselect = useMultipleSelection<ComboboxItem>({\n selectedItems,\n stateReducer: (state, { type, changes }) => {\n const types = useMultipleSelection.stateChangeTypes\n\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (type) {\n case types.SelectedItemKeyDownBackspace:\n case types.SelectedItemKeyDownDelete: {\n onInternalSelectedItemsChange(changes.selectedItems || [])\n\n let activeIndex\n\n if (type === types.SelectedItemKeyDownDelete) {\n const isLastItem = state?.activeIndex === changes.selectedItems?.length\n activeIndex = isLastItem ? -1 : state.activeIndex\n } else {\n const hasItemBefore = (changes?.activeIndex || 0) - 1 >= 0\n activeIndex = hasItemBefore ? state.activeIndex - 1 : changes?.activeIndex\n }\n\n return {\n ...changes,\n activeIndex,\n }\n }\n case types.SelectedItemClick:\n if (innerInputRef.current) {\n innerInputRef.current.focus()\n }\n\n return {\n ...changes,\n activeIndex: -1, // the focus will remain on the input\n }\n case types.FunctionRemoveSelectedItem:\n return {\n ...changes,\n activeIndex: -1, // the focus will remain on the input\n }\n case types.DropdownKeyDownNavigationPrevious:\n downshift.closeMenu()\n\n return changes\n default:\n return changes\n }\n },\n })\n\n const filteredItems = Array.from(filteredItemsMap.values())\n\n useEffect(() => {\n onInputValueChange?.(inputValue || '')\n }, [inputValue])\n\n /**\n * - props: https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#basic-props\n * - state (for state reducer): https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#statechangetypes\n * - output: https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#returned-props\n */\n const downshift = useCombobox<ComboboxItem>({\n inputId: id,\n items: filteredItems,\n selectedItem: multiple ? undefined : selectedItem,\n id,\n labelId,\n // Input\n inputValue,\n onInputValueChange: ({ inputValue: newInputValue }) => {\n setInputValue(newInputValue)\n\n if (shouldFilterItems) {\n const filtered = getFilteredItemsMap(itemsMap, newInputValue || '')\n setFilteredItems(filtered)\n }\n },\n // Open\n initialIsOpen: defaultOpen,\n ...(controlledOpen != null && { isOpen: controlledOpen }),\n onIsOpenChange: changes => {\n if (changes.isOpen != null) {\n onOpenChange?.(changes.isOpen)\n }\n },\n // Custom Spark item object parsing\n itemToString: item => {\n return (item as ComboboxItem)?.text\n },\n isItemDisabled: item => {\n const isFilteredOut =\n !!inputValue &&\n !filteredItems.some(filteredItem => {\n return item.value === filteredItem.value\n })\n\n return item.disabled || isFilteredOut\n },\n // Main reducer\n stateReducer: multiple\n ? multipleSelectionReducer({\n multiselect,\n selectedItems,\n allowCustomValue,\n setSelectedItems: onInternalSelectedItemsChange,\n triggerAreaRef,\n items: itemsMap,\n })\n : singleSelectionReducer({\n allowCustomValue,\n setSelectedItem: onInternalSelectedItemChange,\n filteredItems: [...filteredItemsMap.values()],\n }),\n /**\n * Downshift default behaviour is to scroll into view the highlighted item when the dropdown opens. This behaviour is not stable and scrolls the dropdown to the bottom of the screen.\n */\n scrollIntoView: node => {\n if (node) {\n node.scrollIntoView({ block: 'nearest' })\n }\n\n return undefined\n },\n })\n\n /**\n * Indices in a Map are set when an element is added to the Map.\n * If for some reason, in the Combobox:\n * - items order changes\n * - items are added\n * - items are removed\n *\n * The Map must be rebuilt from the new children in order to preserve logical indices.\n *\n * Downshift is heavily indices based for keyboard navigation, so it it important.\n */\n useEffect(() => {\n const newMap = getItemsFromChildren(children)\n\n const previousItems = [...itemsMap.values()]\n const newItems = [...newMap.values()]\n\n const hasItemsChanges =\n previousItems.length !== newItems.length ||\n previousItems.some((item, index) => {\n const hasUpdatedValue = item.value !== newItems[index]?.value\n const hasUpdatedText = item.text !== newItems[index]?.text\n\n return hasUpdatedValue || hasUpdatedText\n })\n\n if (hasItemsChanges) {\n setItemsMap(newMap)\n }\n }, [children])\n\n /**\n * Warning:\n * Downshift is expecting the items list to always be rendered, as per a11y guidelines.\n * This is why the `Popover` is always opened in this component, but visually hidden instead from Combobox.Popover.\n */\n const [WrapperComponent, wrapperProps] = hasPopover ? [Popover, { open: true }] : [Fragment, {}]\n\n return (\n <ComboboxContext.Provider\n value={{\n // Data\n itemsMap,\n filteredItemsMap,\n highlightedItem: getElementByIndex(filteredItemsMap, downshift.highlightedIndex),\n // State\n multiple,\n disabled,\n readOnly,\n hasPopover,\n setHasPopover,\n state,\n lastInteractionType,\n setLastInteractionType,\n wrap,\n // Refs\n innerInputRef,\n triggerAreaRef,\n // Downshift state\n ...downshift,\n ...multiselect,\n setInputValue,\n selectItem: onInternalSelectedItemChange,\n setSelectedItems: onInternalSelectedItemsChange,\n isLoading,\n setOnInputValueChange,\n isTyping,\n setIsTyping,\n }}\n >\n <WrapperComponent {...wrapperProps}>{children}</WrapperComponent>\n </ComboboxContext.Provider>\n )\n}\n\nexport const useComboboxContext = () => {\n const context = useContext(ComboboxContext)\n\n if (!context) {\n throw Error('useComboboxContext must be used within a Combobox provider')\n }\n\n return context\n}\n","import { useCombobox, UseComboboxProps, UseMultipleSelectionReturnValue } from 'downshift'\nimport { RefObject } from 'react'\n\nimport { ComboboxItem, ItemsMap } from '../types'\nimport { getIndexByKey } from '../utils'\n\ninterface Props {\n allowCustomValue?: boolean\n items: ItemsMap\n selectedItems: ComboboxItem[]\n multiselect: UseMultipleSelectionReturnValue<ComboboxItem>\n setSelectedItems: (items: ComboboxItem[]) => void\n triggerAreaRef: RefObject<HTMLDivElement | null>\n}\n\nexport const multipleSelectionReducer = ({\n multiselect,\n selectedItems,\n allowCustomValue = false,\n setSelectedItems,\n triggerAreaRef,\n items,\n}: Props) => {\n const reducer: UseComboboxProps<ComboboxItem>['stateReducer'] = (_, { changes, type }) => {\n const isFocusInsideTriggerArea = triggerAreaRef.current?.contains?.(document.activeElement)\n\n switch (type) {\n case useCombobox.stateChangeTypes.InputClick:\n return {\n ...changes,\n isOpen: true, // keep menu opened\n }\n case useCombobox.stateChangeTypes.InputKeyDownEnter:\n case useCombobox.stateChangeTypes.ItemClick: {\n const newState = { ...changes }\n\n if (changes.selectedItem != null) {\n newState.inputValue = '' // keep input value after selection\n newState.isOpen = true // keep menu opened after selection\n\n const highlightedIndex = getIndexByKey(items, changes.selectedItem.value)\n\n newState.highlightedIndex = highlightedIndex // preserve highlighted item index after selection\n\n const isAlreadySelected = multiselect.selectedItems.some(\n selectedItem => selectedItem.value === changes.selectedItem?.value\n )\n\n const updatedItems = isAlreadySelected\n ? selectedItems.filter(item => item.value !== changes.selectedItem?.value)\n : [...selectedItems, changes.selectedItem]\n\n setSelectedItems(updatedItems)\n }\n\n return newState\n }\n\n case useCombobox.stateChangeTypes.ToggleButtonClick:\n return {\n ...changes,\n inputValue: allowCustomValue ? changes.inputValue : '',\n }\n case useCombobox.stateChangeTypes.InputChange:\n return {\n ...changes,\n selectedItem: changes.highlightedIndex === -1 ? null : changes.selectedItem,\n }\n case useCombobox.stateChangeTypes.InputBlur:\n return {\n ...changes,\n inputValue: allowCustomValue ? changes.inputValue : '',\n isOpen: isFocusInsideTriggerArea,\n }\n\n default:\n return changes\n }\n }\n\n return reducer\n}\n","import { type FC, isValidElement, type ReactElement, type ReactNode, Children } from 'react'\n\nimport { type ItemProps } from '../ComboboxItem'\nimport { type ItemTextProps } from '../ComboboxItemText'\nimport { type ComboboxItem, type ItemsMap } from '../types'\n\nexport function getIndexByKey(map: ItemsMap, targetKey: string) {\n let index = 0\n for (const [key] of map.entries()) {\n if (key === targetKey) {\n return index\n }\n index++\n }\n\n return -1\n}\n\nconst getKeyAtIndex = (map: ItemsMap, index: number) => {\n let i = 0\n for (const key of map.keys()) {\n if (i === index) return key\n i++\n }\n\n return undefined\n}\n\nexport const getElementByIndex = (map: ItemsMap, index: number) => {\n const key = getKeyAtIndex(map, index)\n\n return key !== undefined ? map.get(key) : undefined\n}\n\nconst getElementDisplayName = (element?: ReactElement) => {\n return element ? (element.type as FC & { displayName?: string }).displayName : ''\n}\n\nexport const getOrderedItems = (\n children: ReactNode,\n result: ComboboxItem[] = []\n): ComboboxItem[] => {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n\n if (getElementDisplayName(child) === 'Combobox.Item') {\n const childProps = child.props as ItemProps\n result.push({\n value: childProps.value,\n disabled: !!childProps.disabled,\n text: getItemText(childProps.children),\n })\n }\n\n if ((child.props as ItemProps).children) {\n getOrderedItems((child.props as ItemProps).children, result)\n }\n })\n\n return result\n}\n\nconst findNestedItemText = (children: ReactNode): string => {\n if (!children) return ''\n\n for (const child of Children.toArray(children)) {\n if (isValidElement(child)) {\n const childElement = child as ReactElement\n\n if (getElementDisplayName(childElement) === 'Combobox.ItemText') {\n return (childElement.props as ItemTextProps).children\n }\n\n const foundText = findNestedItemText((childElement.props as ItemTextProps).children)\n\n if (foundText) return foundText\n }\n }\n\n return ''\n}\n\n/**\n * If Combobox.Item children:\n * - is a string, then the string is used.\n * - is JSX markup, then we look for Combobox.ItemText to get its string value.\n */\nexport const getItemText = (children: ReactNode): string => {\n return typeof children === 'string' ? children : findNestedItemText(children)\n}\n\nexport const getItemsFromChildren = (children: ReactNode): ItemsMap => {\n const newMap: ItemsMap = new Map()\n\n getOrderedItems(children).forEach(itemData => {\n newMap.set(itemData.value, itemData)\n })\n\n return newMap\n}\n\nexport const hasChildComponent = (children: ReactNode, displayName: string): boolean => {\n return Children.toArray(children).some(child => {\n if (!isValidElement(child)) return false\n\n if (getElementDisplayName(child) === displayName) {\n return true\n } else if ((child.props as { children: ReactNode }).children) {\n return hasChildComponent((child.props as { children: ReactNode }).children, displayName)\n }\n\n return false\n })\n}\n\nexport const findElement = (children: ReactNode, value: string) => {\n return Children.toArray(children)\n .filter(isValidElement)\n .find(child => value === getElementDisplayName(child) || '')\n}\n","import { useCombobox, UseComboboxProps } from 'downshift'\n\nimport { ComboboxItem } from '../types'\n\ninterface Props {\n allowCustomValue?: boolean\n filteredItems: ComboboxItem[]\n setSelectedItem: (value: ComboboxItem | null) => void\n}\n\nexport const singleSelectionReducer = ({\n filteredItems,\n allowCustomValue = false,\n setSelectedItem,\n}: Props) => {\n const reducer: UseComboboxProps<ComboboxItem>['stateReducer'] = (state, { changes, type }) => {\n const exactMatch = filteredItems.find(\n item => item.text.toLowerCase() === state.inputValue.toLowerCase()\n )\n\n switch (type) {\n case useCombobox.stateChangeTypes.InputKeyDownEscape:\n if (!changes.selectedItem) {\n setSelectedItem(null)\n }\n\n return changes\n case useCombobox.stateChangeTypes.ItemClick:\n case useCombobox.stateChangeTypes.InputKeyDownEnter:\n if (changes.selectedItem) {\n setSelectedItem(changes.selectedItem)\n }\n\n return changes\n case useCombobox.stateChangeTypes.InputClick:\n return { ...changes, isOpen: true }\n case useCombobox.stateChangeTypes.ToggleButtonClick:\n case useCombobox.stateChangeTypes.InputBlur:\n if (allowCustomValue) return changes\n\n if (state.inputValue === '') {\n setSelectedItem(null)\n\n return { ...changes, selectedItem: null }\n }\n\n if (exactMatch) {\n setSelectedItem(exactMatch)\n\n return { ...changes, selectedItem: exactMatch, inputValue: exactMatch.text }\n }\n\n if (state.selectedItem) {\n return { ...changes, inputValue: state.selectedItem.text }\n }\n\n return { ...changes, inputValue: '' }\n default:\n return changes\n }\n }\n\n return reducer\n}\n","import { type ComboboxContextProps, ComboboxProvider } from './ComboboxContext'\n\nexport type ComboboxProps = ComboboxContextProps\n\nexport const Combobox = ({ children, ...props }: ComboboxProps) => {\n return <ComboboxProvider {...props}>{children}</ComboboxProvider>\n}\n\nCombobox.displayName = 'Combobox'\n","import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, MouseEventHandler, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useComboboxContext } from './ComboboxContext'\n\nexport interface ClearButtonProps extends ComponentPropsWithoutRef<'button'> {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const ClearButton = ({\n className,\n tabIndex = -1,\n onClick,\n ref,\n ...others\n}: ClearButtonProps) => {\n const ctx = useComboboxContext()\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n event.stopPropagation()\n\n if (ctx.multiple) {\n ctx.setSelectedItems([])\n } else {\n ctx.selectItem(null)\n }\n\n ctx.setInputValue('')\n\n if (ctx.innerInputRef.current) {\n ctx.innerInputRef.current.focus()\n }\n\n if (onClick) {\n onClick(event)\n }\n }\n\n return (\n <button\n ref={ref}\n className={cx(className, 'h-sz-44 text-neutral hover:text-neutral-hovered')}\n tabIndex={tabIndex}\n onClick={handleClick}\n type=\"button\"\n {...others}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )\n}\n\nClearButton.displayName = 'Combobox.ClearButton'\n","import { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface DisclosureProps extends Omit<ComponentProps<typeof IconButton>, 'aria-label'> {\n className?: string\n closedLabel: string\n openedLabel: string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Disclosure = ({\n className,\n closedLabel,\n openedLabel,\n intent = 'neutral',\n design = 'ghost',\n size = 'sm',\n ref: forwardedRef,\n ...props\n}: DisclosureProps) => {\n const ctx = useComboboxContext()\n\n const { ref: downshiftRef, ...downshiftDisclosureProps } = ctx.getToggleButtonProps({\n disabled: ctx.disabled || ctx.readOnly,\n onClick: event => {\n event.stopPropagation()\n },\n })\n const isExpanded = downshiftDisclosureProps['aria-expanded']\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n return (\n <IconButton\n ref={ref}\n className={cx(className, 'mt-[calc((44px-32px)/2)]')}\n intent={intent}\n design={design}\n size={size}\n {...downshiftDisclosureProps}\n {...props}\n aria-label={isExpanded ? openedLabel : closedLabel}\n disabled={ctx.disabled}\n >\n <Icon\n className={cx('shrink-0', 'rotate-0 transition duration-100 ease-in', {\n 'rotate-180': isExpanded,\n })}\n size=\"sm\"\n >\n <ArrowHorizontalDown />\n </Icon>\n </IconButton>\n )\n}\n\nDisclosure.displayName = 'Combobox.Disclosure'\n","import { cx } from 'class-variance-authority'\nimport { type ReactNode, Ref } from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface EmptyProps {\n className?: string\n children: ReactNode\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Empty = ({ className, children, ref: forwardedRef }: EmptyProps) => {\n const ctx = useComboboxContext()\n const hasNoItemVisible = ctx.filteredItemsMap.size === 0\n\n return hasNoItemVisible ? (\n <div\n ref={forwardedRef}\n className={cx('px-lg py-md text-body-1 text-on-surface/dim-1', className)}\n >\n {children}\n </div>\n ) : null\n}\n\nEmpty.displayName = 'Combobox.Empty'\n","import { cx } from 'class-variance-authority'\nimport { Children, isValidElement, ReactNode, Ref } from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxGroupProvider, useComboboxGroupContext } from './ComboboxItemsGroupContext'\n\ninterface GroupProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Group = ({ children, ref: forwardedRef, ...props }: GroupProps) => {\n return (\n <ComboboxGroupProvider>\n <GroupContent ref={forwardedRef} {...props}>\n {children}\n </GroupContent>\n </ComboboxGroupProvider>\n )\n}\n\nconst GroupContent = ({ children, className, ref: forwardedRef }: GroupProps) => {\n const ctx = useComboboxContext()\n const groupCtx = useComboboxGroupContext()\n\n const hasVisibleOptions = Children.toArray(children).some(child => {\n return (\n isValidElement(child) && ctx.filteredItemsMap.get((child.props as { value: string }).value)\n )\n })\n\n return hasVisibleOptions ? (\n <div\n ref={forwardedRef}\n role=\"group\"\n aria-labelledby={groupCtx.groupLabelId}\n className={cx(className)}\n >\n {children}\n </div>\n ) : null\n}\n\nGroup.displayName = 'Combobox.Group'\n","import { createContext, type PropsWithChildren, useContext, useId } from 'react'\n\nimport { ID_PREFIX } from './ComboboxContext'\n\nexport interface ComboboxContextState {\n groupLabelId: string\n}\n\ntype ComboboxContextProps = PropsWithChildren\n\nconst ComboboxGroupContext = createContext<ComboboxContextState | null>(null)\n\nexport const ComboboxGroupProvider = ({ children }: ComboboxContextProps) => {\n const groupLabelId = `${ID_PREFIX}-group-label-${useId()}`\n\n return (\n <ComboboxGroupContext.Provider value={{ groupLabelId }}>\n {children}\n </ComboboxGroupContext.Provider>\n )\n}\n\nexport const useComboboxGroupContext = () => {\n const context = useContext(ComboboxGroupContext)\n\n if (!context) {\n throw Error('useComboboxGroupContext must be used within a ComboboxGroup provider')\n }\n\n return context\n}\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport {\n ChangeEvent,\n ComponentPropsWithoutRef,\n Fragment,\n Ref,\n SyntheticEvent,\n useEffect,\n} from 'react'\n\nimport { Popover } from '../popover'\nimport { VisuallyHidden } from '../visually-hidden'\nimport { useComboboxContext } from './ComboboxContext'\n\ntype InputPrimitiveProps = ComponentPropsWithoutRef<'input'>\n\ninterface InputProps extends Omit<InputPrimitiveProps, 'value' | 'placeholder'> {\n className?: string\n placeholder?: string\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n ref?: Ref<HTMLInputElement>\n}\n\nexport const Input = ({\n 'aria-label': ariaLabel,\n className,\n placeholder,\n value,\n defaultValue,\n onValueChange,\n ref: forwardedRef,\n ...props\n}: InputProps) => {\n const ctx = useComboboxContext()\n const field = useFormFieldControl()\n const [inputValue] = useCombinedState(value, defaultValue)\n\n const { isInvalid, isRequired, description } = field\n\n useEffect(() => {\n if (inputValue != null) {\n ctx.setInputValue(inputValue)\n }\n }, [inputValue])\n\n useEffect(() => {\n if (onValueChange) {\n ctx.setOnInputValueChange(() => onValueChange)\n }\n\n // Sync input with combobox default value\n if (!ctx.multiple && ctx.selectedItem) {\n ctx.setInputValue(ctx.selectedItem.text)\n }\n }, [])\n\n const [PopoverTrigger, popoverTriggerProps] = ctx.hasPopover\n ? [Popover.Trigger, { asChild: true, type: undefined }]\n : [Fragment, {}]\n\n const multiselectInputProps = ctx.getDropdownProps()\n const inputRef = useMergeRefs(forwardedRef, ctx.innerInputRef, multiselectInputProps.ref)\n const downshiftInputProps = ctx.getInputProps({\n disabled: ctx.disabled || ctx.readOnly,\n ...multiselectInputProps,\n onKeyDown: event => {\n multiselectInputProps.onKeyDown?.(event)\n ctx.setLastInteractionType('keyboard')\n ctx.setIsTyping(true)\n },\n /**\n *\n * Important:\n * - without this, the input cursor is moved to the end after every change.\n * @see https://github.com/downshift-js/downshift/issues/1108#issuecomment-674180157\n */\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n ctx.setInputValue(e.target.value)\n },\n ref: inputRef,\n })\n\n const hasPlaceholder = ctx.multiple ? ctx.selectedItems.length === 0 : ctx.selectedItem === null\n\n function mergeHandlers<T extends SyntheticEvent>(\n handlerA?: (event: T) => void,\n handlerB?: (event: T) => void\n ) {\n return (event: T) => {\n handlerA?.(event)\n handlerB?.(event)\n }\n }\n\n /**\n * Downshift has its own callbacks set for a few events types.\n * We must merge the event handlers with the (optional) forwarded props if consumer wish to use the same events for alernate purposes (ex: tracking)\n */\n const mergedEventProps = {\n onBlur: mergeHandlers(props.onBlur, downshiftInputProps.onBlur),\n onChange: mergeHandlers(props.onChange, downshiftInputProps.onChange),\n onClick: mergeHandlers(props.onClick, downshiftInputProps.onClick),\n onKeyDown: mergeHandlers(props.onKeyDown, downshiftInputProps.onKeyDown),\n }\n\n return (\n <>\n {ariaLabel && (\n <VisuallyHidden>\n <label {...ctx.getLabelProps()}>{ariaLabel}</label>\n </VisuallyHidden>\n )}\n <PopoverTrigger {...popoverTriggerProps}>\n <input\n data-spark-component=\"combobox-input\"\n type=\"text\"\n {...(hasPlaceholder && { placeholder })}\n className={cx(\n 'max-w-full shrink-0 grow basis-[80px]',\n 'h-sz-28 bg-surface px-sm text-body-1 text-ellipsis outline-hidden',\n 'disabled:text-on-surface/dim-3 disabled:cursor-not-allowed disabled:bg-transparent',\n 'read-only:text-on-surface read-only:cursor-default read-only:bg-transparent',\n className\n )}\n {...props}\n {...downshiftInputProps}\n {...mergedEventProps}\n value={ctx.inputValue}\n aria-label={ariaLabel}\n disabled={ctx.disabled}\n readOnly={ctx.readOnly}\n // FormField\n aria-invalid={isInvalid}\n required={isRequired}\n aria-describedby={description}\n />\n </PopoverTrigger>\n </>\n )\n}\n\nInput.displayName = 'Combobox.Input'\n","import { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cva, cx } from 'class-variance-authority'\nimport { type HTMLAttributes, type ReactNode, Ref } from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxItemProvider, useComboboxItemContext } from './ComboboxItemContext'\n\nexport interface ItemProps extends HTMLAttributes<HTMLLIElement> {\n disabled?: boolean\n value: string\n children: ReactNode\n className?: string\n ref?: Ref<HTMLLIElement>\n}\n\nexport const Item = ({ children, ref: forwardedRef, ...props }: ItemProps) => {\n const { value, disabled } = props\n\n return (\n <ComboboxItemProvider value={value} disabled={disabled}>\n <ItemContent ref={forwardedRef} {...props}>\n {children}\n </ItemContent>\n </ComboboxItemProvider>\n )\n}\n\nconst styles = cva('px-lg py-md text-body-1', {\n variants: {\n selected: {\n true: 'font-bold',\n },\n disabled: {\n true: 'opacity-dim-3 cursor-not-allowed',\n false: 'cursor-pointer',\n },\n highlighted: {\n true: '',\n },\n interactionType: {\n mouse: '',\n keyboard: '',\n },\n },\n compoundVariants: [\n {\n highlighted: true,\n interactionType: 'mouse',\n class: 'bg-surface-hovered',\n },\n {\n highlighted: true,\n interactionType: 'keyboard',\n class: 'u-outline',\n },\n ],\n})\n\nconst ItemContent = ({\n className,\n disabled = false,\n value,\n children,\n ref: forwardedRef,\n}: ItemProps) => {\n const ctx = useComboboxContext()\n const itemCtx = useComboboxItemContext()\n\n const isVisible = !!ctx.filteredItemsMap.get(value)\n\n const { ref: downshiftRef, ...downshiftItemProps } = ctx.getItemProps({\n item: itemCtx.itemData,\n index: itemCtx.index,\n })\n\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n if (!isVisible) return null\n\n return (\n <li\n ref={ref}\n className={cx(\n styles({\n selected: itemCtx.isSelected,\n disabled,\n highlighted: ctx.highlightedItem?.value === value,\n interactionType: ctx.lastInteractionType,\n className,\n })\n )}\n key={value}\n {...downshiftItemProps}\n aria-selected={itemCtx.isSelected}\n aria-labelledby={itemCtx.textId}\n >\n {children}\n </li>\n )\n}\n\nItem.displayName = 'Combobox.Item'\n","import {\n createContext,\n Dispatch,\n type PropsWithChildren,\n SetStateAction,\n useContext,\n useState,\n} from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxItem } from './types'\nimport { getIndexByKey, getItemText } from './utils'\n\ntype ItemTextId = string | undefined\n\ninterface ComboboxItemContextState {\n textId: ItemTextId\n setTextId: Dispatch<SetStateAction<ItemTextId>>\n isSelected: boolean\n itemData: ComboboxItem\n index: number\n disabled: boolean\n}\n\nconst ComboboxItemContext = createContext<ComboboxItemContextState | null>(null)\n\nexport const ComboboxItemProvider = ({\n value,\n disabled = false,\n children,\n}: PropsWithChildren<{ value: string; disabled?: boolean }>) => {\n const ctx = useComboboxContext()\n\n const [textId, setTextId] = useState<ItemTextId>(undefined)\n\n const index = getIndexByKey(ctx.filteredItemsMap, value)\n const itemData: ComboboxItem = { disabled, value, text: getItemText(children) }\n\n const isSelected = ctx.multiple\n ? ctx.selectedItems.some(selectedItem => selectedItem.value === value)\n : ctx.selectedItem?.value === value\n\n return (\n <ComboboxItemContext.Provider\n value={{ textId, setTextId, isSelected, itemData, index, disabled }}\n >\n {children}\n </ComboboxItemContext.Provider>\n )\n}\n\nexport const useComboboxItemContext = () => {\n const context = useContext(ComboboxItemContext)\n\n if (!context) {\n throw Error('useComboboxItemContext must be used within a ComboboxItem provider')\n }\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useComboboxItemContext } from './ComboboxItemContext'\n\nexport interface ItemIndicatorProps {\n children?: ReactNode\n className?: string\n label?: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemIndicator = ({\n className,\n children,\n label,\n ref: forwardedRef,\n}: ItemIndicatorProps) => {\n const { disabled, isSelected } = useComboboxItemContext()\n\n const childElement = children || (\n <Icon size=\"sm\">\n <Check aria-label={label} />\n </Icon>\n )\n\n return (\n <span\n ref={forwardedRef}\n className={cx('min-h-sz-16 min-w-sz-16 flex', disabled && 'opacity-dim-3', className)}\n >\n {isSelected && childElement}\n </span>\n )\n}\n\nItemIndicator.displayName = 'Combobox.ItemIndicator'\n","import { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, ReactNode, Ref, useLayoutEffect, useRef } from 'react'\n\nimport { Spinner } from '../spinner'\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface ItemsProps extends ComponentPropsWithoutRef<'ul'> {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLUListElement>\n}\n\nexport const Items = ({ children, className, ref: forwardedRef, ...props }: ItemsProps) => {\n const ctx = useComboboxContext()\n\n const { ref: downshiftRef, ...downshiftMenuProps } = ctx.getMenuProps({\n onMouseMove: () => {\n ctx.setLastInteractionType('mouse')\n },\n })\n\n const innerRef = useRef<HTMLElement>(null)\n\n const ref = useMergeRefs(forwardedRef, downshiftRef, innerRef)\n\n const isOpen = ctx.hasPopover ? ctx.isOpen : true\n\n const isPointerEventsDisabled = ctx.hasPopover && !isOpen\n\n useLayoutEffect(() => {\n if (innerRef.current?.parentElement) {\n innerRef.current.parentElement.style.pointerEvents = isPointerEventsDisabled ? 'none' : ''\n innerRef.current.style.pointerEvents = isPointerEventsDisabled ? 'none' : ''\n }\n }, [isPointerEventsDisabled])\n\n return (\n <ul\n ref={ref}\n className={cx(\n className,\n 'flex flex-col',\n isOpen ? 'block' : 'pointer-events-none invisible opacity-0',\n ctx.hasPopover && 'p-lg',\n ctx.isLoading && 'items-center overflow-y-auto'\n )}\n {...props}\n {...downshiftMenuProps}\n aria-busy={ctx.isLoading}\n data-spark-component=\"combobox-items\"\n >\n {ctx.isLoading ? <Spinner size=\"sm\" /> : children}\n </ul>\n )\n}\n\nItems.displayName = 'Combobox.Items'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useEffect, useId } from 'react'\n\nimport { ID_PREFIX } from './ComboboxContext'\nimport { useComboboxItemContext } from './ComboboxItemContext'\n\nexport interface ItemTextProps {\n children: string\n className?: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemText = ({ children, className, ref: forwardedRef }: ItemTextProps) => {\n const id = `${ID_PREFIX}-item-text-${useId()}`\n\n const { setTextId } = useComboboxItemContext()\n\n useEffect(() => {\n setTextId(id)\n\n return () => setTextId(undefined)\n })\n\n return (\n <span id={id} className={cx('inline', className)} ref={forwardedRef}>\n {children}\n </span>\n )\n}\n\nItemText.displayName = 'Combobox.ItemText'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { useComboboxGroupContext } from './ComboboxItemsGroupContext'\n\ninterface LabelProps {\n children: string\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Label = ({ children, className, ref: forwardedRef }: LabelProps) => {\n const groupCtx = useComboboxGroupContext()\n\n return (\n <div\n ref={forwardedRef}\n id={groupCtx.groupLabelId}\n className={cx('px-md py-sm text-body-2 text-neutral italic', className)}\n >\n {children}\n </div>\n )\n}\n\nLabel.displayName = 'Combobox.Label'\n","import { ReactElement } from 'react'\n\nimport { Icon } from '../icon'\n\nexport const LeadingIcon = ({ children }: { children: ReactElement }) => {\n return (\n <Icon size={'sm'} className=\"h-sz-44 shrink-0\">\n {children}\n </Icon>\n )\n}\n\nLeadingIcon.displayName = 'Combobox.LeadingIcon'\n","import { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref, useEffect } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface PopoverProps extends ComponentProps<typeof SparkPopover.Content> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Popover = ({\n children,\n matchTriggerWidth = true,\n sideOffset = 4,\n className,\n ref: forwardedRef,\n ...props\n}: PopoverProps) => {\n const ctx = useComboboxContext()\n\n useEffect(() => {\n ctx.setHasPopover(true)\n\n return () => ctx.setHasPopover(false)\n }, [])\n\n return (\n <SparkPopover.Content\n ref={forwardedRef}\n inset\n asChild\n matchTriggerWidth={matchTriggerWidth}\n className={cx('z-dropdown! relative', className)}\n sideOffset={sideOffset}\n onOpenAutoFocus={e => {\n /**\n * With a combobox pattern, the focus should remain on the trigger at all times.\n * Passing the focus to the combobox popover would break keyboard navigation.\n */\n e.preventDefault()\n }}\n {...props}\n data-spark-component=\"combobox-popover\"\n >\n {children}\n </SparkPopover.Content>\n )\n}\n\nPopover.displayName = 'Combobox.Popover'\n","import { ReactElement } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\n\nexport const Portal: typeof SparkPopover.Portal = ({ children, ...rest }): ReactElement => (\n <SparkPopover.Portal {...rest}>{children}</SparkPopover.Portal>\n)\n\nPortal.displayName = 'Combobox.Portal'\n","import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { FocusEvent } from 'react'\n\nimport { Icon } from '../icon'\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxItem } from './types'\n\nconst SelectedItem = ({ item: selectedItem, index }: { item: ComboboxItem; index: number }) => {\n const ctx = useComboboxContext()\n\n const isCleanable = !ctx.disabled && !ctx.readOnly\n\n const handleFocus = (e: FocusEvent<HTMLSpanElement>) => {\n const element = e.target as HTMLSpanElement\n if (ctx.lastInteractionType === 'keyboard') {\n element.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n })\n }\n }\n\n const { disabled, ...selectedItemProps } = ctx.getSelectedItemProps({\n disabled: ctx.disabled || ctx.readOnly,\n selectedItem,\n index,\n })\n\n const Element = disabled ? 'button' : 'span'\n\n return (\n <Element\n role=\"presentation\"\n data-spark-component=\"combobox-selected-item\"\n key={`selected-item-${index}`}\n className={cx(\n 'h-sz-28 bg-neutral-container flex items-center rounded-md align-middle',\n 'text-body-2 text-on-neutral-container',\n 'disabled:opacity-dim-3 disabled:cursor-not-allowed',\n 'focus-visible:u-outline-inset outline-hidden',\n { 'px-md': !isCleanable, 'pl-md': isCleanable }\n )}\n {...selectedItemProps}\n tabIndex={-1}\n {...(disabled && { disabled: true })}\n onFocus={handleFocus}\n >\n <span\n className={cx('line-clamp-1 overflow-x-hidden leading-normal break-all text-ellipsis', {\n 'w-max': !ctx.wrap,\n })}\n >\n {selectedItem.text}\n </span>\n {ctx.disabled}\n {isCleanable && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden\n className=\"px-md h-full cursor-pointer\"\n onClick={e => {\n e.stopPropagation()\n\n const updatedSelectedItems = ctx.selectedItems.filter(\n item => item.value !== selectedItem.value\n )\n\n ctx.setSelectedItems(updatedSelectedItems)\n\n if (ctx.innerInputRef.current) {\n ctx.innerInputRef.current.focus({ preventScroll: true })\n }\n }}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )}\n </Element>\n )\n}\n\nexport const SelectedItems = () => {\n const ctx = useComboboxContext()\n\n return ctx.multiple && ctx.selectedItems.length ? (\n <>\n {ctx.selectedItems.map((item, index) => (\n <SelectedItem key={item.value} item={item} index={index} />\n ))}\n </>\n ) : null\n}\n\nSelectedItems.displayName = 'Combobox.SelectedItems'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Fragment, ReactNode, Ref, useEffect, useRef } from 'react'\n\nimport { Popover } from '../popover'\nimport { useComboboxContext } from './ComboboxContext'\nimport { styles } from './ComboboxTrigger.styles'\nimport { findElement } from './utils'\nimport { useWidthIncreaseCallback } from './utils/useWidthIncreaseCallback'\n\ninterface TriggerProps {\n className?: string\n children: ReactNode\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Trigger = ({ className, children, ref: forwardedRef }: TriggerProps) => {\n const ctx = useComboboxContext()\n const field = useFormFieldControl()\n\n // Trigger compound elements\n const leadingIcon = findElement(children, 'Combobox.LeadingIcon')\n const selectedItems = findElement(children, 'Combobox.SelectedItems')\n const input = findElement(children, 'Combobox.Input')\n const clearButton = findElement(children, 'Combobox.ClearButton')\n const disclosure = findElement(children, 'Combobox.Disclosure')\n\n const [PopoverAnchor, popoverAnchorProps] = ctx.hasPopover\n ? [Popover.Anchor, { asChild: true, type: undefined }]\n : [Fragment, {}]\n\n const ref = useMergeRefs(forwardedRef, ctx.triggerAreaRef)\n const scrollableAreaRef = useRef<HTMLDivElement>(null)\n\n const disabled = field.disabled || ctx.disabled\n const readOnly = field.readOnly || ctx.readOnly\n\n const hasClearButton = !!clearButton && !disabled && !readOnly\n\n /**\n * In case wrap behaviour is disabled, we sometimes need to scroll to the right-side of the trigger:\n * - when a selected item chip is added.\n * - when the component width changes (window resizing, etc.)\n *\n * The goal is that the typing area remains visible at all times.\n */\n const scrollToRight = () => {\n if (scrollableAreaRef.current && !ctx.wrap) {\n const { scrollWidth, clientWidth } = scrollableAreaRef.current\n // Scroll to the rightmost position\n scrollableAreaRef.current.scrollLeft = scrollWidth - clientWidth\n }\n }\n\n useWidthIncreaseCallback(scrollableAreaRef, scrollToRight)\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(scrollToRight)\n\n if (scrollableAreaRef.current) {\n resizeObserver.observe(scrollableAreaRef.current)\n }\n\n return () => {\n resizeObserver.disconnect()\n }\n }, [])\n\n return (\n <>\n <PopoverAnchor {...popoverAnchorProps}>\n <div\n ref={ref}\n className={styles({\n className,\n state: ctx.state,\n disabled,\n readOnly,\n allowWrap: ctx.wrap,\n })}\n onClick={() => {\n if (!ctx.isOpen && !disabled && !readOnly) {\n ctx.openMenu()\n if (ctx.innerInputRef.current) {\n ctx.innerInputRef.current.focus()\n }\n }\n }}\n >\n {leadingIcon}\n <div\n ref={scrollableAreaRef}\n className={cx(\n 'min-w-none gap-sm py-md inline-flex grow items-start',\n ctx.wrap ? 'flex-wrap' : 'u-no-scrollbar overflow-x-auto p-[2px]'\n )}\n >\n {selectedItems}\n {input}\n </div>\n\n {hasClearButton && clearButton}\n\n {disclosure}\n </div>\n </PopoverAnchor>\n </>\n )\n}\n\nTrigger.displayName = 'Combobox.Trigger'\n","import { cva } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'flex items-start gap-md min-h-sz-44 text-body-1',\n 'h-fit rounded-lg px-lg',\n // outline styles\n 'ring-1 outline-hidden ring-inset focus-within:ring-2',\n ],\n {\n variants: {\n allowWrap: {\n true: '',\n false: 'h-sz-44',\n },\n state: {\n undefined: 'ring-outline focus-within:ring-outline-high',\n error: 'ring-error',\n alert: 'ring-alert',\n success: 'ring-success',\n },\n disabled: {\n true: 'cursor-not-allowed border-outline bg-on-surface/dim-5 text-on-surface/dim-3',\n },\n readOnly: {\n true: 'cursor-default bg-on-surface/dim-5 text-on-surface',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n state: undefined,\n class: 'hover:ring-outline-high',\n },\n {\n disabled: false,\n readOnly: false,\n class: 'bg-surface text-on-surface cursor-text',\n },\n ],\n defaultVariants: {\n state: undefined,\n disabled: false,\n readOnly: false,\n },\n }\n)\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport const useWidthIncreaseCallback = (\n elementRef: RefObject<HTMLDivElement | null>,\n callback: () => void\n): void => {\n const prevWidthRef = useRef<number | null>(null)\n\n useEffect(() => {\n const checkWidthIncrease = () => {\n const currentWidth = elementRef.current?.scrollWidth || null\n\n if (prevWidthRef.current && currentWidth && currentWidth > prevWidthRef.current) {\n callback()\n }\n\n prevWidthRef.current = currentWidth\n requestAnimationFrame(checkWidthIncrease)\n }\n\n const interval = requestAnimationFrame(checkWidthIncrease)\n\n return () => cancelAnimationFrame(interval)\n }, [elementRef])\n}\n","import { Combobox as Root } from './Combobox'\nimport { ClearButton } from './ComboboxClearButton'\nimport { ComboboxProvider, useComboboxContext } from './ComboboxContext'\nimport { Disclosure } from './ComboboxDisclosure'\nimport { Empty } from './ComboboxEmpty'\nimport { Group } from './ComboboxGroup'\nimport { Input } from './ComboboxInput'\nimport { Item } from './ComboboxItem'\nimport { ItemIndicator } from './ComboboxItemIndicator'\nimport { Items } from './ComboboxItems'\nimport { ItemText } from './ComboboxItemText'\nimport { Label } from './ComboboxLabel'\nimport { LeadingIcon } from './ComboboxLeadingIcon'\nimport { Popover } from './ComboboxPopover'\nimport { Portal } from './ComboboxPortal'\nimport { SelectedItems } from './ComboboxSelectedItems'\nimport { Trigger } from './ComboboxTrigger'\n\nexport { useComboboxContext, ComboboxProvider }\n\nexport const Combobox: typeof Root & {\n Group: typeof Group\n Item: typeof Item\n Items: typeof Items\n ItemText: typeof ItemText\n ItemIndicator: typeof ItemIndicator\n Label: typeof Label\n Popover: typeof Popover\n Trigger: typeof Trigger\n LeadingIcon: typeof LeadingIcon\n Empty: typeof Empty\n Input: typeof Input\n Disclosure: typeof Disclosure\n SelectedItems: typeof SelectedItems\n ClearButton: typeof ClearButton\n Portal: typeof Portal\n} = Object.assign(Root, {\n Group,\n Item,\n Items,\n ItemText,\n ItemIndicator,\n Label,\n Popover,\n Trigger,\n LeadingIcon,\n Empty,\n Input,\n Disclosure,\n SelectedItems,\n ClearButton,\n Portal,\n})\n\nCombobox.displayName = 'Combobox'\nGroup.displayName = 'Combobox.Group'\nItems.displayName = 'Combobox.Items'\nItem.displayName = 'Combobox.Item'\nItemText.displayName = 'Combobox.ItemText'\nItemIndicator.displayName = 'Combobox.ItemIndicator'\nLabel.displayName = 'Combobox.Label'\nPopover.displayName = 'Combobox.Popover'\nTrigger.displayName = 'Combobox.Trigger'\nLeadingIcon.displayName = 'Combobox.LeadingIcon'\nEmpty.displayName = 'Combobox.Empty'\nInput.displayName = 'Combobox.Input'\nDisclosure.displayName = 'Combobox.Disclosure'\nSelectedItems.displayName = 'Combobox.SelectedItems'\nClearButton.displayName = 'Combobox.ClearButton'\nPortal.displayName = 'Combobox.Portal'\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AACjC,SAAS,eAAAA,cAAa,4BAA4B;AAClD;AAAA,EACE;AAAA,EAEA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACjBP,SAAS,mBAAsE;;;ACA/E,SAAkB,gBAAmD,gBAAgB;AAM9E,SAAS,cAAc,KAAe,WAAmB;AAC9D,MAAI,QAAQ;AACZ,aAAW,CAAC,GAAG,KAAK,IAAI,QAAQ,GAAG;AACjC,QAAI,QAAQ,WAAW;AACrB,aAAO;AAAA,IACT;AACA;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAM,gBAAgB,CAAC,KAAe,UAAkB;AACtD,MAAI,IAAI;AACR,aAAW,OAAO,IAAI,KAAK,GAAG;AAC5B,QAAI,MAAM,MAAO,QAAO;AACxB;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,oBAAoB,CAAC,KAAe,UAAkB;AACjE,QAAM,MAAM,cAAc,KAAK,KAAK;AAEpC,SAAO,QAAQ,SAAY,IAAI,IAAI,GAAG,IAAI;AAC5C;AAEA,IAAM,wBAAwB,CAAC,YAA2B;AACxD,SAAO,UAAW,QAAQ,KAAuC,cAAc;AACjF;AAEO,IAAM,kBAAkB,CAC7B,UACA,SAAyB,CAAC,MACP;AACnB,WAAS,QAAQ,UAAU,WAAS;AAClC,QAAI,CAAC,eAAe,KAAK,EAAG;AAE5B,QAAI,sBAAsB,KAAK,MAAM,iBAAiB;AACpD,YAAM,aAAa,MAAM;AACzB,aAAO,KAAK;AAAA,QACV,OAAO,WAAW;AAAA,QA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U;AACzC,cAAI,SAAS;AACb,cAAI,IAAI,cAAc,SAAS;AAC7B,gBAAI,cAAc,QAAQ,MAAM;AAAA,UAClC;AAAA,QACF;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,QACD,gBAAAL;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,WAAWM;AAAA,cACT;AAAA,cACA,IAAI,OAAO,cAAc;AAAA,YAC3B;AAAA,YAEC;AAAA;AAAA,cACA;AAAA;AAAA;AAAA,QACH;AAAA,QAEC,kBAAkB;AAAA,QAElB;AAAA;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEA,QAAQ,cAAc;;;AG3Ff,IAAMC,YAgBT,OAAO,OAAO,UAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDD,UAAS,cAAc;AACvB,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,KAAK,cAAc;AACnB,SAAS,cAAc;AACvB,cAAc,cAAc;AAC5B,MAAM,cAAc;AACpBC,SAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,YAAY,cAAc;AAC1B,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,WAAW,cAAc;AACzB,cAAc,cAAc;AAC5B,YAAY,cAAc;AAC1B,OAAO,cAAc;","names":["useCombobox","useCombobox","state","useCombobox","jsx","jsx","cx","jsx","cx","cx","jsx","cx","cx","Children","isValidElement","createContext","useContext","useId","jsx","createContext","useId","useContext","jsx","Children","isValidElement","cx","useFormFieldControl","useCombinedState","useMergeRefs","cx","Fragment","useEffect","Fragment","jsx","useFormFieldControl","useCombinedState","useEffect","useMergeRefs","cx","useMergeRefs","cx","createContext","useContext","useState","jsx","createContext","useState","useContext","jsx","useMergeRefs","cx","cx","jsx","cx","useMergeRefs","cx","useRef","jsx","useRef","useMergeRefs","cx","cx","useEffect","useId","jsx","useId","useEffect","cx","cx","jsx","cx","jsx","cx","useEffect","jsx","Popover","useEffect","cx","jsx","DeleteOutline","cx","Fragment","jsx","jsxs","cx","DeleteOutline","useFormFieldControl","useMergeRefs","cx","Fragment","useEffect","useRef","cva","styles","useEffect","useRef","Fragment","jsx","jsxs","useFormFieldControl","useMergeRefs","useRef","useEffect","styles","cx","Combobox","Popover"]}
1
+ {"version":3,"sources":["../../src/combobox/ComboboxContext.tsx","../../src/combobox/useCombobox/multipleSelectionReducer.ts","../../src/combobox/utils/index.ts","../../src/combobox/useCombobox/singleSelectionReducer.ts","../../src/combobox/Combobox.tsx","../../src/combobox/ComboboxClearButton.tsx","../../src/combobox/ComboboxDisclosure.tsx","../../src/combobox/ComboboxEmpty.tsx","../../src/combobox/ComboboxGroup.tsx","../../src/combobox/ComboboxItemsGroupContext.tsx","../../src/combobox/ComboboxInput.tsx","../../src/combobox/ComboboxItem.tsx","../../src/combobox/ComboboxItemContext.tsx","../../src/combobox/ComboboxItemIndicator.tsx","../../src/combobox/ComboboxItems.tsx","../../src/combobox/ComboboxItemText.tsx","../../src/combobox/ComboboxLabel.tsx","../../src/combobox/ComboboxLeadingIcon.tsx","../../src/combobox/ComboboxPopover.tsx","../../src/combobox/ComboboxPortal.tsx","../../src/combobox/ComboboxSelectedItems.tsx","../../src/combobox/ComboboxTrigger.tsx","../../src/combobox/ComboboxTrigger.styles.tsx","../../src/combobox/utils/useWidthIncreaseCallback.ts","../../src/combobox/index.ts"],"sourcesContent":["/* eslint-disable complexity */\n/* eslint-disable max-lines-per-function */\nimport { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { useCombobox, useMultipleSelection } from 'downshift'\nimport {\n createContext,\n Dispatch,\n Fragment,\n PropsWithChildren,\n RefObject,\n SetStateAction,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react'\n\nimport { Popover } from '../popover'\nimport { type ComboboxItem, type DownshiftState, type ItemsMap } from './types'\nimport { multipleSelectionReducer } from './useCombobox/multipleSelectionReducer'\nimport { singleSelectionReducer } from './useCombobox/singleSelectionReducer'\nimport { getElementByIndex, getItemsFromChildren, hasChildComponent } from './utils'\n\nexport interface ComboboxContextState extends DownshiftState {\n itemsMap: ItemsMap\n filteredItemsMap: ItemsMap\n highlightedItem: ComboboxItem | undefined\n hasPopover: boolean\n multiple: boolean\n disabled: boolean\n readOnly: boolean\n wrap?: boolean\n state?: 'error' | 'alert' | 'success'\n lastInteractionType: 'mouse' | 'keyboard'\n setHasPopover: Dispatch<SetStateAction<boolean>>\n setLastInteractionType: (type: 'mouse' | 'keyboard') => void\n setOnInputValueChange: Dispatch<SetStateAction<((v: string) => void) | null>>\n innerInputRef: RefObject<HTMLInputElement | null>\n triggerAreaRef: RefObject<HTMLDivElement | null>\n isLoading?: boolean\n isTyping?: boolean\n setIsTyping: Dispatch<SetStateAction<boolean>>\n}\n\nexport type ComboboxContextCommonProps = PropsWithChildren<{\n /**\n * The controlled open state of the select. Must be used in conjunction with `onOpenChange`.\n */\n open?: boolean\n /**\n * Event handler called when the open state of the select changes.\n */\n onOpenChange?: (isOpen: boolean) => void\n /**\n * The open state of the select when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultOpen?: boolean\n /**\n * Use `state` prop to assign a specific state to the combobox, choosing from: `error`, `alert` and `success`. By doing so, the outline styles will be updated.\n */\n state?: 'error' | 'alert' | 'success'\n /**\n * When true, prevents the user from interacting with the combobox.\n */\n disabled?: boolean\n /**\n * Sets the combobox as interactive or not.\n */\n readOnly?: boolean\n /**\n * When true, the items will be filtered depending on the value of the input (not case-sensitive).\n */\n filtering?: 'none' | 'auto' | 'strict'\n /**\n * By default, the combobox will clear or restore the input value to the selected item value on blur.\n */\n allowCustomValue?: boolean\n /**\n * In multiple selection, many selected items might be displayed. Be default, the combobox trigger will expand vertically to display them all.\n * If you wish to keep every item on a single line, disabled this property.\n */\n wrap?: boolean\n /**\n * Display a spinner to indicate to the user that the combobox is loading results for .\n */\n isLoading?: boolean\n}>\n\ninterface ComboboxPropsSingle {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple?: false\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string | null\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n}\n\ninterface ComboboxPropsMultiple {\n /**\n * Prop 'multiple' indicating whether multiple values are allowed.\n */\n multiple: true\n /**\n * The value of the select when initially rendered. Use when you do not need to control the state of the select.\n */\n defaultValue?: string[]\n /**\n * The controlled value of the select. Should be used in conjunction with `onValueChange`.\n */\n value?: string[]\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string[]) => void\n}\n\nexport type ComboboxContextProps = ComboboxContextCommonProps &\n (ComboboxPropsSingle | ComboboxPropsMultiple)\n\nconst ComboboxContext = createContext<ComboboxContextState | null>(null)\n\nconst getFilteredItemsMap = (map: ItemsMap, inputValue: string | undefined): ItemsMap => {\n if (!inputValue) return map\n\n return new Map(\n Array.from(map).filter(([_, { text }]) => text.toLowerCase().includes(inputValue.toLowerCase()))\n )\n}\n\nexport const ID_PREFIX = ':combobox'\n\nexport const ComboboxProvider = ({\n children,\n state: stateProp,\n allowCustomValue = false,\n filtering = 'auto',\n disabled: disabledProp = false,\n multiple = false,\n readOnly: readOnlyProp = false,\n wrap = true,\n // Value\n value: controlledValue,\n defaultValue,\n onValueChange,\n // Open\n open: controlledOpen,\n defaultOpen,\n onOpenChange,\n isLoading,\n}: ComboboxContextProps) => {\n const isMounted = useRef(false)\n\n // Input state\n const [inputValue, setInputValue] = useState<string | undefined>('')\n const [isTyping, setIsTyping] = useState<boolean>(filtering === 'strict')\n const triggerAreaRef = useRef<HTMLDivElement>(null)\n const innerInputRef = useRef<HTMLInputElement>(null)\n const [onInputValueChange, setOnInputValueChange] = useState<((v: string) => void) | null>(null)\n\n const [comboboxValue] = useCombinedState(controlledValue, defaultValue)\n\n const shouldFilterItems = filtering === 'strict' || (filtering === 'auto' && isTyping)\n\n // Items state\n const [itemsMap, setItemsMap] = useState<ItemsMap>(getItemsFromChildren(children))\n const [filteredItemsMap, setFilteredItems] = useState(\n shouldFilterItems ? getFilteredItemsMap(itemsMap, inputValue) : itemsMap\n )\n\n const [selectedItem, setSelectedItem] = useState<ComboboxItem | null>(\n itemsMap.get(comboboxValue as string) || null\n )\n\n const [selectedItems, setSelectedItems] = useState<ComboboxItem[]>(\n comboboxValue\n ? [...itemsMap.values()].filter(item => (comboboxValue as string[]).includes(item.value))\n : []\n )\n\n const onInternalSelectedItemChange = (item: ComboboxItem | null) => {\n setIsTyping(false)\n\n if (item?.value !== selectedItem?.value) {\n setSelectedItem(item)\n setTimeout(() => {\n onValueChange?.(item?.value as string & string[])\n }, 0)\n }\n }\n\n const onInternalSelectedItemsChange = (items: ComboboxItem[]) => {\n setSelectedItems(items)\n setTimeout(() => {\n onValueChange?.(items.map(i => i.value) as string & string[])\n }, 0)\n }\n\n // Sync internal state with controlled value\n useEffect(() => {\n if (!isMounted.current) {\n isMounted.current = true\n\n return\n }\n\n if (multiple) {\n const newSelectedItems = (comboboxValue as string[]).reduce(\n (accum: ComboboxItem[], value) => {\n const match = itemsMap.get(value)\n\n return match ? [...accum, match] : accum\n },\n []\n )\n\n setSelectedItems(comboboxValue ? newSelectedItems : [])\n } else {\n setSelectedItem(itemsMap.get(comboboxValue as string) || null)\n }\n }, [multiple ? JSON.stringify(comboboxValue) : comboboxValue])\n\n // Form field state\n const field = useFormFieldControl()\n\n const internalFieldLabelID = `${ID_PREFIX}-label-${useId()}`\n const internalFieldID = `${ID_PREFIX}-field-${useId()}`\n const id = field.id || internalFieldID\n const labelId = field.labelId || internalFieldLabelID\n\n const state = field.state || stateProp\n const disabled = field.disabled ?? disabledProp\n const readOnly = field.readOnly ?? readOnlyProp\n\n const [hasPopover, setHasPopover] = useState<boolean>(\n hasChildComponent(children, 'Combobox.Popover')\n )\n const [lastInteractionType, setLastInteractionType] = useState<'mouse' | 'keyboard'>('mouse')\n\n useEffect(() => {\n setFilteredItems(shouldFilterItems ? getFilteredItemsMap(itemsMap, inputValue) : itemsMap)\n }, [inputValue, itemsMap])\n\n const multiselect = useMultipleSelection<ComboboxItem>({\n selectedItems,\n stateReducer: (state, { type, changes }) => {\n const types = useMultipleSelection.stateChangeTypes\n\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (type) {\n case types.SelectedItemKeyDownBackspace:\n case types.SelectedItemKeyDownDelete: {\n onInternalSelectedItemsChange(changes.selectedItems || [])\n\n let activeIndex\n\n if (type === types.SelectedItemKeyDownDelete) {\n const isLastItem = state?.activeIndex === changes.selectedItems?.length\n activeIndex = isLastItem ? -1 : state.activeIndex\n } else {\n const hasItemBefore = (changes?.activeIndex || 0) - 1 >= 0\n activeIndex = hasItemBefore ? state.activeIndex - 1 : changes?.activeIndex\n }\n\n return {\n ...changes,\n activeIndex,\n }\n }\n case types.SelectedItemClick:\n if (innerInputRef.current) {\n innerInputRef.current.focus()\n }\n\n return {\n ...changes,\n activeIndex: -1, // the focus will remain on the input\n }\n case types.FunctionRemoveSelectedItem:\n return {\n ...changes,\n activeIndex: -1, // the focus will remain on the input\n }\n case types.DropdownKeyDownNavigationPrevious:\n downshift.closeMenu()\n\n return changes\n default:\n return changes\n }\n },\n })\n\n const filteredItems = Array.from(filteredItemsMap.values())\n\n useEffect(() => {\n onInputValueChange?.(inputValue || '')\n }, [inputValue])\n\n /**\n * - props: https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#basic-props\n * - state (for state reducer): https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#statechangetypes\n * - output: https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#returned-props\n */\n const downshift = useCombobox<ComboboxItem>({\n inputId: id,\n items: filteredItems,\n selectedItem: multiple ? undefined : selectedItem,\n id,\n labelId,\n // Input\n inputValue,\n onInputValueChange: ({ inputValue: newInputValue }) => {\n setInputValue(newInputValue)\n\n if (shouldFilterItems) {\n const filtered = getFilteredItemsMap(itemsMap, newInputValue || '')\n setFilteredItems(filtered)\n }\n },\n // Open\n initialIsOpen: defaultOpen,\n ...(controlledOpen != null && { isOpen: controlledOpen }),\n onIsOpenChange: changes => {\n if (changes.isOpen != null) {\n onOpenChange?.(changes.isOpen)\n }\n },\n // Custom Spark item object parsing\n itemToString: item => {\n return (item as ComboboxItem)?.text\n },\n isItemDisabled: item => {\n const isFilteredOut =\n !!inputValue &&\n !filteredItems.some(filteredItem => {\n return item.value === filteredItem.value\n })\n\n return item.disabled || isFilteredOut\n },\n // Main reducer\n stateReducer: multiple\n ? multipleSelectionReducer({\n multiselect,\n selectedItems,\n allowCustomValue,\n setSelectedItems: onInternalSelectedItemsChange,\n triggerAreaRef,\n items: itemsMap,\n })\n : singleSelectionReducer({\n allowCustomValue,\n setSelectedItem: onInternalSelectedItemChange,\n filteredItems: [...filteredItemsMap.values()],\n }),\n /**\n * Downshift default behaviour is to scroll into view the highlighted item when the dropdown opens. This behaviour is not stable and scrolls the dropdown to the bottom of the screen.\n */\n scrollIntoView: node => {\n if (node) {\n node.scrollIntoView({ block: 'nearest' })\n }\n\n return undefined\n },\n })\n\n /**\n * Indices in a Map are set when an element is added to the Map.\n * If for some reason, in the Combobox:\n * - items order changes\n * - items are added\n * - items are removed\n *\n * The Map must be rebuilt from the new children in order to preserve logical indices.\n *\n * Downshift is heavily indices based for keyboard navigation, so it it important.\n */\n useEffect(() => {\n const newMap = getItemsFromChildren(children)\n\n const previousItems = [...itemsMap.values()]\n const newItems = [...newMap.values()]\n\n const hasItemsChanges =\n previousItems.length !== newItems.length ||\n previousItems.some((item, index) => {\n const hasUpdatedValue = item.value !== newItems[index]?.value\n const hasUpdatedText = item.text !== newItems[index]?.text\n\n return hasUpdatedValue || hasUpdatedText\n })\n\n if (hasItemsChanges) {\n setItemsMap(newMap)\n }\n }, [children])\n\n /**\n * Warning:\n * Downshift is expecting the items list to always be rendered, as per a11y guidelines.\n * This is why the `Popover` is always opened in this component, but visually hidden instead from Combobox.Popover.\n */\n const [WrapperComponent, wrapperProps] = hasPopover ? [Popover, { open: true }] : [Fragment, {}]\n\n return (\n <ComboboxContext.Provider\n value={{\n // Data\n itemsMap,\n filteredItemsMap,\n highlightedItem: getElementByIndex(filteredItemsMap, downshift.highlightedIndex),\n // State\n multiple,\n disabled,\n readOnly,\n hasPopover,\n setHasPopover,\n state,\n lastInteractionType,\n setLastInteractionType,\n wrap,\n // Refs\n innerInputRef,\n triggerAreaRef,\n // Downshift state\n ...downshift,\n ...multiselect,\n setInputValue,\n selectItem: onInternalSelectedItemChange,\n setSelectedItems: onInternalSelectedItemsChange,\n isLoading,\n setOnInputValueChange,\n isTyping,\n setIsTyping,\n }}\n >\n <WrapperComponent {...wrapperProps}>{children}</WrapperComponent>\n </ComboboxContext.Provider>\n )\n}\n\nexport const useComboboxContext = () => {\n const context = useContext(ComboboxContext)\n\n if (!context) {\n throw Error('useComboboxContext must be used within a Combobox provider')\n }\n\n return context\n}\n","import { useCombobox, UseComboboxProps, UseMultipleSelectionReturnValue } from 'downshift'\nimport { RefObject } from 'react'\n\nimport { ComboboxItem, ItemsMap } from '../types'\nimport { getIndexByKey } from '../utils'\n\ninterface Props {\n allowCustomValue?: boolean\n items: ItemsMap\n selectedItems: ComboboxItem[]\n multiselect: UseMultipleSelectionReturnValue<ComboboxItem>\n setSelectedItems: (items: ComboboxItem[]) => void\n triggerAreaRef: RefObject<HTMLDivElement | null>\n}\n\nexport const multipleSelectionReducer = ({\n multiselect,\n selectedItems,\n allowCustomValue = false,\n setSelectedItems,\n triggerAreaRef,\n items,\n}: Props) => {\n const reducer: UseComboboxProps<ComboboxItem>['stateReducer'] = (_, { changes, type }) => {\n const isFocusInsideTriggerArea = triggerAreaRef.current?.contains?.(document.activeElement)\n\n switch (type) {\n case useCombobox.stateChangeTypes.InputClick:\n return {\n ...changes,\n isOpen: true, // keep menu opened\n }\n case useCombobox.stateChangeTypes.InputKeyDownEnter:\n case useCombobox.stateChangeTypes.ItemClick: {\n const newState = { ...changes }\n\n if (changes.selectedItem != null) {\n newState.inputValue = '' // keep input value after selection\n newState.isOpen = true // keep menu opened after selection\n\n const highlightedIndex = getIndexByKey(items, changes.selectedItem.value)\n\n newState.highlightedIndex = highlightedIndex // preserve highlighted item index after selection\n\n const isAlreadySelected = multiselect.selectedItems.some(\n selectedItem => selectedItem.value === changes.selectedItem?.value\n )\n\n const updatedItems = isAlreadySelected\n ? selectedItems.filter(item => item.value !== changes.selectedItem?.value)\n : [...selectedItems, changes.selectedItem]\n\n setSelectedItems(updatedItems)\n }\n\n return newState\n }\n\n case useCombobox.stateChangeTypes.ToggleButtonClick:\n return {\n ...changes,\n inputValue: allowCustomValue ? changes.inputValue : '',\n }\n case useCombobox.stateChangeTypes.InputChange:\n return {\n ...changes,\n selectedItem: changes.highlightedIndex === -1 ? null : changes.selectedItem,\n }\n case useCombobox.stateChangeTypes.InputBlur:\n return {\n ...changes,\n inputValue: allowCustomValue ? changes.inputValue : '',\n isOpen: isFocusInsideTriggerArea,\n }\n\n default:\n return changes\n }\n }\n\n return reducer\n}\n","import { type FC, isValidElement, type ReactElement, type ReactNode, Children } from 'react'\n\nimport { type ItemProps } from '../ComboboxItem'\nimport { type ItemTextProps } from '../ComboboxItemText'\nimport { type ComboboxItem, type ItemsMap } from '../types'\n\nexport function getIndexByKey(map: ItemsMap, targetKey: string) {\n let index = 0\n for (const [key] of map.entries()) {\n if (key === targetKey) {\n return index\n }\n index++\n }\n\n return -1\n}\n\nconst getKeyAtIndex = (map: ItemsMap, index: number) => {\n let i = 0\n for (const key of map.keys()) {\n if (i === index) return key\n i++\n }\n\n return undefined\n}\n\nexport const getElementByIndex = (map: ItemsMap, index: number) => {\n const key = getKeyAtIndex(map, index)\n\n return key !== undefined ? map.get(key) : undefined\n}\n\nconst getElementDisplayName = (element?: ReactElement) => {\n return element ? (element.type as FC & { displayName?: string }).displayName : ''\n}\n\nexport const getOrderedItems = (\n children: ReactNode,\n result: ComboboxItem[] = []\n): ComboboxItem[] => {\n Children.forEach(children, child => {\n if (!isValidElement(child)) return\n\n if (getElementDisplayName(child) === 'Combobox.Item') {\n const childProps = child.props as ItemProps\n result.push({\n value: childProps.value,\n disabled: !!childProps.disabled,\n text: getItemText(childProps.children),\n })\n }\n\n if ((child.props as ItemProps).children) {\n getOrderedItems((child.props as ItemProps).children, result)\n }\n })\n\n return result\n}\n\nconst findNestedItemText = (children: ReactNode): string => {\n if (!children) return ''\n\n for (const child of Children.toArray(children)) {\n if (isValidElement(child)) {\n const childElement = child as ReactElement\n\n if (getElementDisplayName(childElement) === 'Combobox.ItemText') {\n return (childElement.props as ItemTextProps).children\n }\n\n const foundText = findNestedItemText((childElement.props as ItemTextProps).children)\n\n if (foundText) return foundText\n }\n }\n\n return ''\n}\n\n/**\n * If Combobox.Item children:\n * - is a string, then the string is used.\n * - is JSX markup, then we look for Combobox.ItemText to get its string value.\n */\nexport const getItemText = (children: ReactNode): string => {\n return typeof children === 'string' ? children : findNestedItemText(children)\n}\n\nexport const getItemsFromChildren = (children: ReactNode): ItemsMap => {\n const newMap: ItemsMap = new Map()\n\n getOrderedItems(children).forEach(itemData => {\n newMap.set(itemData.value, itemData)\n })\n\n return newMap\n}\n\nexport const hasChildComponent = (children: ReactNode, displayName: string): boolean => {\n return Children.toArray(children).some(child => {\n if (!isValidElement(child)) return false\n\n if (getElementDisplayName(child) === displayName) {\n return true\n } else if ((child.props as { children: ReactNode }).children) {\n return hasChildComponent((child.props as { children: ReactNode }).children, displayName)\n }\n\n return false\n })\n}\n\nexport const findElement = (children: ReactNode, value: string) => {\n return Children.toArray(children)\n .filter(isValidElement)\n .find(child => value === getElementDisplayName(child) || '')\n}\n","import { useCombobox, UseComboboxProps } from 'downshift'\n\nimport { ComboboxItem } from '../types'\n\ninterface Props {\n allowCustomValue?: boolean\n filteredItems: ComboboxItem[]\n setSelectedItem: (value: ComboboxItem | null) => void\n}\n\nexport const singleSelectionReducer = ({\n filteredItems,\n allowCustomValue = false,\n setSelectedItem,\n}: Props) => {\n const reducer: UseComboboxProps<ComboboxItem>['stateReducer'] = (state, { changes, type }) => {\n const exactMatch = filteredItems.find(\n item => item.text.toLowerCase() === state.inputValue.toLowerCase()\n )\n\n switch (type) {\n case useCombobox.stateChangeTypes.InputKeyDownEscape:\n if (!changes.selectedItem) {\n setSelectedItem(null)\n }\n\n return changes\n case useCombobox.stateChangeTypes.ItemClick:\n case useCombobox.stateChangeTypes.InputKeyDownEnter:\n if (changes.selectedItem) {\n setSelectedItem(changes.selectedItem)\n }\n\n return changes\n case useCombobox.stateChangeTypes.InputClick:\n return { ...changes, isOpen: true }\n case useCombobox.stateChangeTypes.ToggleButtonClick:\n case useCombobox.stateChangeTypes.InputBlur:\n if (allowCustomValue) return changes\n\n if (state.inputValue === '') {\n setSelectedItem(null)\n\n return { ...changes, selectedItem: null }\n }\n\n if (exactMatch) {\n setSelectedItem(exactMatch)\n\n return { ...changes, selectedItem: exactMatch, inputValue: exactMatch.text }\n }\n\n if (state.selectedItem) {\n return { ...changes, inputValue: state.selectedItem.text }\n }\n\n return { ...changes, inputValue: '' }\n default:\n return changes\n }\n }\n\n return reducer\n}\n","import { type ComboboxContextProps, ComboboxProvider } from './ComboboxContext'\n\nexport type ComboboxProps = ComboboxContextProps\n\nexport const Combobox = ({ children, ...props }: ComboboxProps) => {\n return <ComboboxProvider {...props}>{children}</ComboboxProvider>\n}\n\nCombobox.displayName = 'Combobox'\n","import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, MouseEventHandler, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useComboboxContext } from './ComboboxContext'\n\nexport interface ClearButtonProps extends ComponentPropsWithoutRef<'button'> {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const ClearButton = ({\n className,\n tabIndex = -1,\n onClick,\n ref,\n ...others\n}: ClearButtonProps) => {\n const ctx = useComboboxContext()\n\n const handleClick: MouseEventHandler<HTMLButtonElement> = event => {\n event.stopPropagation()\n\n if (ctx.multiple) {\n ctx.setSelectedItems([])\n } else {\n ctx.selectItem(null)\n }\n\n ctx.setInputValue('')\n\n if (ctx.innerInputRef.current) {\n ctx.innerInputRef.current.focus()\n }\n\n if (onClick) {\n onClick(event)\n }\n }\n\n return (\n <button\n ref={ref}\n className={cx(className, 'h-sz-44 text-neutral hover:text-neutral-hovered')}\n tabIndex={tabIndex}\n onClick={handleClick}\n type=\"button\"\n {...others}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )\n}\n\nClearButton.displayName = 'Combobox.ClearButton'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface DisclosureProps extends Omit<ComponentProps<typeof IconButton>, 'aria-label'> {\n className?: string\n closedLabel: string\n openedLabel: string\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Disclosure = ({\n className,\n closedLabel,\n openedLabel,\n intent = 'neutral',\n design = 'ghost',\n size = 'sm',\n ref: forwardedRef,\n ...props\n}: DisclosureProps) => {\n const ctx = useComboboxContext()\n\n const { ref: downshiftRef, ...downshiftDisclosureProps } = ctx.getToggleButtonProps({\n disabled: ctx.disabled || ctx.readOnly,\n onClick: event => {\n event.stopPropagation()\n },\n })\n const isExpanded = downshiftDisclosureProps['aria-expanded']\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n return (\n <IconButton\n ref={ref}\n className={cx(className, 'mt-[calc((44px-32px)/2)]')}\n intent={intent}\n design={design}\n size={size}\n {...downshiftDisclosureProps}\n {...props}\n aria-label={isExpanded ? openedLabel : closedLabel}\n disabled={ctx.disabled}\n >\n <Icon\n className={cx('shrink-0', 'rotate-0 transition duration-100 ease-in', {\n 'rotate-180': isExpanded,\n })}\n size=\"sm\"\n >\n <ArrowHorizontalDown />\n </Icon>\n </IconButton>\n )\n}\n\nDisclosure.displayName = 'Combobox.Disclosure'\n","import { cx } from 'class-variance-authority'\nimport { type ReactNode, Ref } from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface EmptyProps {\n className?: string\n children: ReactNode\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Empty = ({ className, children, ref: forwardedRef }: EmptyProps) => {\n const ctx = useComboboxContext()\n const hasNoItemVisible = ctx.filteredItemsMap.size === 0\n\n return hasNoItemVisible ? (\n <div\n ref={forwardedRef}\n className={cx('px-lg py-md text-body-1 text-on-surface/dim-1', className)}\n >\n {children}\n </div>\n ) : null\n}\n\nEmpty.displayName = 'Combobox.Empty'\n","import { cx } from 'class-variance-authority'\nimport { Children, isValidElement, ReactNode, Ref } from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxGroupProvider, useComboboxGroupContext } from './ComboboxItemsGroupContext'\n\ninterface GroupProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Group = ({ children, ref: forwardedRef, ...props }: GroupProps) => {\n return (\n <ComboboxGroupProvider>\n <GroupContent ref={forwardedRef} {...props}>\n {children}\n </GroupContent>\n </ComboboxGroupProvider>\n )\n}\n\nconst GroupContent = ({ children, className, ref: forwardedRef }: GroupProps) => {\n const ctx = useComboboxContext()\n const groupCtx = useComboboxGroupContext()\n\n const hasVisibleOptions = Children.toArray(children).some(child => {\n return (\n isValidElement(child) && ctx.filteredItemsMap.get((child.props as { value: string }).value)\n )\n })\n\n return hasVisibleOptions ? (\n <div\n ref={forwardedRef}\n role=\"group\"\n aria-labelledby={groupCtx.groupLabelId}\n className={cx(className)}\n >\n {children}\n </div>\n ) : null\n}\n\nGroup.displayName = 'Combobox.Group'\n","import { createContext, type PropsWithChildren, useContext, useId } from 'react'\n\nimport { ID_PREFIX } from './ComboboxContext'\n\nexport interface ComboboxContextState {\n groupLabelId: string\n}\n\ntype ComboboxContextProps = PropsWithChildren\n\nconst ComboboxGroupContext = createContext<ComboboxContextState | null>(null)\n\nexport const ComboboxGroupProvider = ({ children }: ComboboxContextProps) => {\n const groupLabelId = `${ID_PREFIX}-group-label-${useId()}`\n\n return (\n <ComboboxGroupContext.Provider value={{ groupLabelId }}>\n {children}\n </ComboboxGroupContext.Provider>\n )\n}\n\nexport const useComboboxGroupContext = () => {\n const context = useContext(ComboboxGroupContext)\n\n if (!context) {\n throw Error('useComboboxGroupContext must be used within a ComboboxGroup provider')\n }\n\n return context\n}\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useCombinedState } from '@spark-ui/hooks/use-combined-state'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport {\n ChangeEvent,\n ComponentPropsWithoutRef,\n Fragment,\n Ref,\n SyntheticEvent,\n useEffect,\n} from 'react'\n\nimport { Popover } from '../popover'\nimport { VisuallyHidden } from '../visually-hidden'\nimport { useComboboxContext } from './ComboboxContext'\n\ntype InputPrimitiveProps = ComponentPropsWithoutRef<'input'>\n\ninterface InputProps extends Omit<InputPrimitiveProps, 'value' | 'placeholder'> {\n className?: string\n placeholder?: string\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n ref?: Ref<HTMLInputElement>\n}\n\nexport const Input = ({\n 'aria-label': ariaLabel,\n className,\n placeholder,\n value,\n defaultValue,\n onValueChange,\n ref: forwardedRef,\n ...props\n}: InputProps) => {\n const ctx = useComboboxContext()\n const field = useFormFieldControl()\n const [inputValue] = useCombinedState(value, defaultValue)\n\n const { isInvalid, description } = field\n\n useEffect(() => {\n if (inputValue != null) {\n ctx.setInputValue(inputValue)\n }\n }, [inputValue])\n\n useEffect(() => {\n if (onValueChange) {\n ctx.setOnInputValueChange(() => onValueChange)\n }\n\n // Sync input with combobox default value\n if (!ctx.multiple && ctx.selectedItem) {\n ctx.setInputValue(ctx.selectedItem.text)\n }\n }, [])\n\n const [PopoverTrigger, popoverTriggerProps] = ctx.hasPopover\n ? [Popover.Trigger, { asChild: true, type: undefined }]\n : [Fragment, {}]\n\n const multiselectInputProps = ctx.getDropdownProps()\n const inputRef = useMergeRefs(forwardedRef, ctx.innerInputRef, multiselectInputProps.ref)\n const downshiftInputProps = ctx.getInputProps({\n disabled: ctx.disabled || ctx.readOnly,\n ...multiselectInputProps,\n onKeyDown: event => {\n multiselectInputProps.onKeyDown?.(event)\n ctx.setLastInteractionType('keyboard')\n ctx.setIsTyping(true)\n },\n /**\n *\n * Important:\n * - without this, the input cursor is moved to the end after every change.\n * @see https://github.com/downshift-js/downshift/issues/1108#issuecomment-674180157\n */\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n ctx.setInputValue(e.target.value)\n },\n ref: inputRef,\n })\n\n const hasPlaceholder = ctx.multiple ? ctx.selectedItems.length === 0 : ctx.selectedItem === null\n\n function mergeHandlers<T extends SyntheticEvent>(\n handlerA?: (event: T) => void,\n handlerB?: (event: T) => void\n ) {\n return (event: T) => {\n handlerA?.(event)\n handlerB?.(event)\n }\n }\n\n /**\n * Downshift has its own callbacks set for a few events types.\n * We must merge the event handlers with the (optional) forwarded props if consumer wish to use the same events for alernate purposes (ex: tracking)\n */\n const mergedEventProps = {\n onBlur: mergeHandlers(props.onBlur, downshiftInputProps.onBlur),\n onChange: mergeHandlers(props.onChange, downshiftInputProps.onChange),\n onClick: mergeHandlers(props.onClick, downshiftInputProps.onClick),\n onKeyDown: mergeHandlers(props.onKeyDown, downshiftInputProps.onKeyDown),\n }\n\n return (\n <>\n {ariaLabel && (\n <VisuallyHidden>\n <label {...ctx.getLabelProps()}>{ariaLabel}</label>\n </VisuallyHidden>\n )}\n <PopoverTrigger {...popoverTriggerProps}>\n <input\n data-spark-component=\"combobox-input\"\n type=\"text\"\n {...(hasPlaceholder && { placeholder })}\n className={cx(\n 'max-w-full shrink-0 grow basis-[80px]',\n 'h-sz-28 bg-surface px-sm text-body-1 text-ellipsis outline-hidden',\n 'disabled:text-on-surface/dim-3 disabled:cursor-not-allowed disabled:bg-transparent',\n 'read-only:text-on-surface read-only:cursor-default read-only:bg-transparent',\n className\n )}\n {...props}\n {...downshiftInputProps}\n {...mergedEventProps}\n value={ctx.inputValue}\n aria-label={ariaLabel}\n disabled={ctx.disabled}\n readOnly={ctx.readOnly}\n // FormField\n aria-invalid={isInvalid}\n aria-describedby={description}\n />\n </PopoverTrigger>\n </>\n )\n}\n\nInput.displayName = 'Combobox.Input'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cva, cx } from 'class-variance-authority'\nimport { type HTMLAttributes, type ReactNode, Ref } from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxItemProvider, useComboboxItemContext } from './ComboboxItemContext'\n\nexport interface ItemProps extends HTMLAttributes<HTMLLIElement> {\n disabled?: boolean\n value: string\n children: ReactNode\n className?: string\n ref?: Ref<HTMLLIElement>\n}\n\nexport const Item = ({ children, ref: forwardedRef, ...props }: ItemProps) => {\n const { value, disabled } = props\n\n return (\n <ComboboxItemProvider value={value} disabled={disabled}>\n <ItemContent ref={forwardedRef} {...props}>\n {children}\n </ItemContent>\n </ComboboxItemProvider>\n )\n}\n\nconst styles = cva('px-lg py-md text-body-1', {\n variants: {\n selected: {\n true: 'font-bold',\n },\n disabled: {\n true: 'opacity-dim-3 cursor-not-allowed',\n false: 'cursor-pointer',\n },\n highlighted: {\n true: '',\n },\n interactionType: {\n mouse: '',\n keyboard: '',\n },\n },\n compoundVariants: [\n {\n highlighted: true,\n interactionType: 'mouse',\n class: 'bg-surface-hovered',\n },\n {\n highlighted: true,\n interactionType: 'keyboard',\n class: 'u-outline',\n },\n ],\n})\n\nconst ItemContent = ({\n className,\n disabled = false,\n value,\n children,\n ref: forwardedRef,\n}: ItemProps) => {\n const ctx = useComboboxContext()\n const itemCtx = useComboboxItemContext()\n\n const isVisible = !!ctx.filteredItemsMap.get(value)\n\n const { ref: downshiftRef, ...downshiftItemProps } = ctx.getItemProps({\n item: itemCtx.itemData,\n index: itemCtx.index,\n })\n\n const ref = useMergeRefs(forwardedRef, downshiftRef)\n\n if (!isVisible) return null\n\n return (\n <li\n ref={ref}\n className={cx(\n styles({\n selected: itemCtx.isSelected,\n disabled,\n highlighted: ctx.highlightedItem?.value === value,\n interactionType: ctx.lastInteractionType,\n className,\n })\n )}\n key={value}\n {...downshiftItemProps}\n aria-selected={itemCtx.isSelected}\n aria-labelledby={itemCtx.textId}\n >\n {children}\n </li>\n )\n}\n\nItem.displayName = 'Combobox.Item'\n","import {\n createContext,\n Dispatch,\n type PropsWithChildren,\n SetStateAction,\n useContext,\n useState,\n} from 'react'\n\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxItem } from './types'\nimport { getIndexByKey, getItemText } from './utils'\n\ntype ItemTextId = string | undefined\n\ninterface ComboboxItemContextState {\n textId: ItemTextId\n setTextId: Dispatch<SetStateAction<ItemTextId>>\n isSelected: boolean\n itemData: ComboboxItem\n index: number\n disabled: boolean\n}\n\nconst ComboboxItemContext = createContext<ComboboxItemContextState | null>(null)\n\nexport const ComboboxItemProvider = ({\n value,\n disabled = false,\n children,\n}: PropsWithChildren<{ value: string; disabled?: boolean }>) => {\n const ctx = useComboboxContext()\n\n const [textId, setTextId] = useState<ItemTextId>(undefined)\n\n const index = getIndexByKey(ctx.filteredItemsMap, value)\n const itemData: ComboboxItem = { disabled, value, text: getItemText(children) }\n\n const isSelected = ctx.multiple\n ? ctx.selectedItems.some(selectedItem => selectedItem.value === value)\n : ctx.selectedItem?.value === value\n\n return (\n <ComboboxItemContext.Provider\n value={{ textId, setTextId, isSelected, itemData, index, disabled }}\n >\n {children}\n </ComboboxItemContext.Provider>\n )\n}\n\nexport const useComboboxItemContext = () => {\n const context = useContext(ComboboxItemContext)\n\n if (!context) {\n throw Error('useComboboxItemContext must be used within a ComboboxItem provider')\n }\n\n return context\n}\n","import { Check } from '@spark-ui/icons/Check'\nimport { cx } from 'class-variance-authority'\nimport { ReactNode, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useComboboxItemContext } from './ComboboxItemContext'\n\nexport interface ItemIndicatorProps {\n children?: ReactNode\n className?: string\n label?: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemIndicator = ({\n className,\n children,\n label,\n ref: forwardedRef,\n}: ItemIndicatorProps) => {\n const { disabled, isSelected } = useComboboxItemContext()\n\n const childElement = children || (\n <Icon size=\"sm\">\n <Check aria-label={label} />\n </Icon>\n )\n\n return (\n <span\n ref={forwardedRef}\n className={cx('min-h-sz-16 min-w-sz-16 flex', disabled && 'opacity-dim-3', className)}\n >\n {isSelected && childElement}\n </span>\n )\n}\n\nItemIndicator.displayName = 'Combobox.ItemIndicator'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, ReactNode, Ref, useLayoutEffect, useRef } from 'react'\n\nimport { Spinner } from '../spinner'\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface ItemsProps extends ComponentPropsWithoutRef<'ul'> {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLUListElement>\n}\n\nexport const Items = ({ children, className, ref: forwardedRef, ...props }: ItemsProps) => {\n const ctx = useComboboxContext()\n\n const { ref: downshiftRef, ...downshiftMenuProps } = ctx.getMenuProps({\n onMouseMove: () => {\n ctx.setLastInteractionType('mouse')\n },\n })\n\n const innerRef = useRef<HTMLElement>(null)\n\n const ref = useMergeRefs(forwardedRef, downshiftRef, innerRef)\n\n const isOpen = ctx.hasPopover ? ctx.isOpen : true\n\n const isPointerEventsDisabled = ctx.hasPopover && !isOpen\n\n useLayoutEffect(() => {\n if (innerRef.current?.parentElement) {\n innerRef.current.parentElement.style.pointerEvents = isPointerEventsDisabled ? 'none' : ''\n innerRef.current.style.pointerEvents = isPointerEventsDisabled ? 'none' : ''\n }\n }, [isPointerEventsDisabled])\n\n return (\n <ul\n ref={ref}\n className={cx(\n className,\n 'flex flex-col',\n isOpen ? 'block' : 'pointer-events-none invisible opacity-0',\n ctx.hasPopover && 'p-lg',\n ctx.isLoading && 'items-center overflow-y-auto'\n )}\n {...props}\n {...downshiftMenuProps}\n aria-busy={ctx.isLoading}\n data-spark-component=\"combobox-items\"\n >\n {ctx.isLoading ? <Spinner size=\"sm\" /> : children}\n </ul>\n )\n}\n\nItems.displayName = 'Combobox.Items'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useEffect, useId } from 'react'\n\nimport { ID_PREFIX } from './ComboboxContext'\nimport { useComboboxItemContext } from './ComboboxItemContext'\n\nexport interface ItemTextProps {\n children: string\n className?: string\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const ItemText = ({ children, className, ref: forwardedRef }: ItemTextProps) => {\n const id = `${ID_PREFIX}-item-text-${useId()}`\n\n const { setTextId } = useComboboxItemContext()\n\n useEffect(() => {\n setTextId(id)\n\n return () => setTextId(undefined)\n })\n\n return (\n <span id={id} className={cx('inline', className)} ref={forwardedRef}>\n {children}\n </span>\n )\n}\n\nItemText.displayName = 'Combobox.ItemText'\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { useComboboxGroupContext } from './ComboboxItemsGroupContext'\n\ninterface LabelProps {\n children: string\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Label = ({ children, className, ref: forwardedRef }: LabelProps) => {\n const groupCtx = useComboboxGroupContext()\n\n return (\n <div\n ref={forwardedRef}\n id={groupCtx.groupLabelId}\n className={cx('px-md py-sm text-body-2 text-neutral italic', className)}\n >\n {children}\n </div>\n )\n}\n\nLabel.displayName = 'Combobox.Label'\n","import { ReactElement } from 'react'\n\nimport { Icon } from '../icon'\n\nexport const LeadingIcon = ({ children }: { children: ReactElement }) => {\n return (\n <Icon size={'sm'} className=\"h-sz-44 shrink-0\">\n {children}\n </Icon>\n )\n}\n\nLeadingIcon.displayName = 'Combobox.LeadingIcon'\n","import { cx } from 'class-variance-authority'\nimport { ComponentProps, Ref, useEffect } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\nimport { useComboboxContext } from './ComboboxContext'\n\ninterface PopoverProps extends ComponentProps<typeof SparkPopover.Content> {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Popover = ({\n children,\n matchTriggerWidth = true,\n sideOffset = 4,\n className,\n ref: forwardedRef,\n ...props\n}: PopoverProps) => {\n const ctx = useComboboxContext()\n\n useEffect(() => {\n ctx.setHasPopover(true)\n\n return () => ctx.setHasPopover(false)\n }, [])\n\n return (\n <SparkPopover.Content\n ref={forwardedRef}\n inset\n asChild\n matchTriggerWidth={matchTriggerWidth}\n className={cx('z-dropdown! relative', className)}\n sideOffset={sideOffset}\n onOpenAutoFocus={e => {\n /**\n * With a combobox pattern, the focus should remain on the trigger at all times.\n * Passing the focus to the combobox popover would break keyboard navigation.\n */\n e.preventDefault()\n }}\n {...props}\n data-spark-component=\"combobox-popover\"\n >\n {children}\n </SparkPopover.Content>\n )\n}\n\nPopover.displayName = 'Combobox.Popover'\n","import { ReactElement } from 'react'\n\nimport { Popover as SparkPopover } from '../popover'\n\nexport const Portal: typeof SparkPopover.Portal = ({ children, ...rest }): ReactElement => (\n <SparkPopover.Portal {...rest}>{children}</SparkPopover.Portal>\n)\n\nPortal.displayName = 'Combobox.Portal'\n","import { DeleteOutline } from '@spark-ui/icons/DeleteOutline'\nimport { cx } from 'class-variance-authority'\nimport { FocusEvent } from 'react'\n\nimport { Icon } from '../icon'\nimport { useComboboxContext } from './ComboboxContext'\nimport { ComboboxItem } from './types'\n\nconst SelectedItem = ({ item: selectedItem, index }: { item: ComboboxItem; index: number }) => {\n const ctx = useComboboxContext()\n\n const isCleanable = !ctx.disabled && !ctx.readOnly\n\n const handleFocus = (e: FocusEvent<HTMLSpanElement>) => {\n const element = e.target as HTMLSpanElement\n if (ctx.lastInteractionType === 'keyboard') {\n element.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n })\n }\n }\n\n const { disabled, ...selectedItemProps } = ctx.getSelectedItemProps({\n disabled: ctx.disabled || ctx.readOnly,\n selectedItem,\n index,\n })\n\n const Element = disabled ? 'button' : 'span'\n\n return (\n <Element\n role=\"presentation\"\n data-spark-component=\"combobox-selected-item\"\n key={`selected-item-${index}`}\n className={cx(\n 'h-sz-28 bg-neutral-container flex items-center rounded-md align-middle',\n 'text-body-2 text-on-neutral-container',\n 'disabled:opacity-dim-3 disabled:cursor-not-allowed',\n 'focus-visible:u-outline-inset outline-hidden',\n { 'px-md': !isCleanable, 'pl-md': isCleanable }\n )}\n {...selectedItemProps}\n tabIndex={-1}\n {...(disabled && { disabled: true })}\n onFocus={handleFocus}\n >\n <span\n className={cx('line-clamp-1 overflow-x-hidden leading-normal break-all text-ellipsis', {\n 'w-max': !ctx.wrap,\n })}\n >\n {selectedItem.text}\n </span>\n {ctx.disabled}\n {isCleanable && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden\n className=\"px-md h-full cursor-pointer\"\n onClick={e => {\n e.stopPropagation()\n\n const updatedSelectedItems = ctx.selectedItems.filter(\n item => item.value !== selectedItem.value\n )\n\n ctx.setSelectedItems(updatedSelectedItems)\n\n if (ctx.innerInputRef.current) {\n ctx.innerInputRef.current.focus({ preventScroll: true })\n }\n }}\n >\n <Icon size=\"sm\">\n <DeleteOutline />\n </Icon>\n </button>\n )}\n </Element>\n )\n}\n\nexport const SelectedItems = () => {\n const ctx = useComboboxContext()\n\n return ctx.multiple && ctx.selectedItems.length ? (\n <>\n {ctx.selectedItems.map((item, index) => (\n <SelectedItem key={item.value} item={item} index={index} />\n ))}\n </>\n ) : null\n}\n\nSelectedItems.displayName = 'Combobox.SelectedItems'\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { cx } from 'class-variance-authority'\nimport { Fragment, ReactNode, Ref, useEffect, useRef } from 'react'\n\nimport { Popover } from '../popover'\nimport { useComboboxContext } from './ComboboxContext'\nimport { styles } from './ComboboxTrigger.styles'\nimport { findElement } from './utils'\nimport { useWidthIncreaseCallback } from './utils/useWidthIncreaseCallback'\n\ninterface TriggerProps {\n className?: string\n children: ReactNode\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Trigger = ({ className, children, ref: forwardedRef }: TriggerProps) => {\n const ctx = useComboboxContext()\n const field = useFormFieldControl()\n\n // Trigger compound elements\n const leadingIcon = findElement(children, 'Combobox.LeadingIcon')\n const selectedItems = findElement(children, 'Combobox.SelectedItems')\n const input = findElement(children, 'Combobox.Input')\n const clearButton = findElement(children, 'Combobox.ClearButton')\n const disclosure = findElement(children, 'Combobox.Disclosure')\n\n const [PopoverAnchor, popoverAnchorProps] = ctx.hasPopover\n ? [Popover.Anchor, { asChild: true, type: undefined }]\n : [Fragment, {}]\n\n const ref = useMergeRefs(forwardedRef, ctx.triggerAreaRef)\n const scrollableAreaRef = useRef<HTMLDivElement>(null)\n\n const disabled = field.disabled || ctx.disabled\n const readOnly = field.readOnly || ctx.readOnly\n\n const hasClearButton = !!clearButton && !disabled && !readOnly\n\n /**\n * In case wrap behaviour is disabled, we sometimes need to scroll to the right-side of the trigger:\n * - when a selected item chip is added.\n * - when the component width changes (window resizing, etc.)\n *\n * The goal is that the typing area remains visible at all times.\n */\n const scrollToRight = () => {\n if (scrollableAreaRef.current && !ctx.wrap) {\n const { scrollWidth, clientWidth } = scrollableAreaRef.current\n // Scroll to the rightmost position\n scrollableAreaRef.current.scrollLeft = scrollWidth - clientWidth\n }\n }\n\n useWidthIncreaseCallback(scrollableAreaRef, scrollToRight)\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(scrollToRight)\n\n if (scrollableAreaRef.current) {\n resizeObserver.observe(scrollableAreaRef.current)\n }\n\n return () => {\n resizeObserver.disconnect()\n }\n }, [])\n\n return (\n <>\n <PopoverAnchor {...popoverAnchorProps}>\n <div\n ref={ref}\n className={styles({\n className,\n state: ctx.state,\n disabled,\n readOnly,\n allowWrap: ctx.wrap,\n })}\n onClick={() => {\n if (!ctx.isOpen && !disabled && !readOnly) {\n ctx.openMenu()\n if (ctx.innerInputRef.current) {\n ctx.innerInputRef.current.focus()\n }\n }\n }}\n >\n {leadingIcon}\n <div\n ref={scrollableAreaRef}\n className={cx(\n 'min-w-none gap-sm py-md inline-flex grow items-start',\n ctx.wrap ? 'flex-wrap' : 'u-no-scrollbar overflow-x-auto p-[2px]'\n )}\n >\n {selectedItems}\n {input}\n </div>\n\n {hasClearButton && clearButton}\n\n {disclosure}\n </div>\n </PopoverAnchor>\n </>\n )\n}\n\nTrigger.displayName = 'Combobox.Trigger'\n","import { cva } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'flex items-start gap-md min-h-sz-44 text-body-1',\n 'h-fit rounded-lg px-lg',\n // outline styles\n 'ring-1 outline-hidden ring-inset focus-within:ring-2',\n ],\n {\n variants: {\n allowWrap: {\n true: '',\n false: 'h-sz-44',\n },\n state: {\n undefined: 'ring-outline focus-within:ring-outline-high',\n error: 'ring-error',\n alert: 'ring-alert',\n success: 'ring-success',\n },\n disabled: {\n true: 'cursor-not-allowed border-outline bg-on-surface/dim-5 text-on-surface/dim-3',\n },\n readOnly: {\n true: 'cursor-default bg-on-surface/dim-5 text-on-surface',\n },\n },\n compoundVariants: [\n {\n disabled: false,\n state: undefined,\n class: 'hover:ring-outline-high',\n },\n {\n disabled: false,\n readOnly: false,\n class: 'bg-surface text-on-surface cursor-text',\n },\n ],\n defaultVariants: {\n state: undefined,\n disabled: false,\n readOnly: false,\n },\n }\n)\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport const useWidthIncreaseCallback = (\n elementRef: RefObject<HTMLDivElement | null>,\n callback: () => void\n): void => {\n const prevWidthRef = useRef<number | null>(null)\n\n useEffect(() => {\n const checkWidthIncrease = () => {\n const currentWidth = elementRef.current?.scrollWidth || null\n\n if (prevWidthRef.current && currentWidth && currentWidth > prevWidthRef.current) {\n callback()\n }\n\n prevWidthRef.current = currentWidth\n requestAnimationFrame(checkWidthIncrease)\n }\n\n const interval = requestAnimationFrame(checkWidthIncrease)\n\n return () => cancelAnimationFrame(interval)\n }, [elementRef])\n}\n","import { Combobox as Root } from './Combobox'\nimport { ClearButton } from './ComboboxClearButton'\nimport { ComboboxProvider, useComboboxContext } from './ComboboxContext'\nimport { Disclosure } from './ComboboxDisclosure'\nimport { Empty } from './ComboboxEmpty'\nimport { Group } from './ComboboxGroup'\nimport { Input } from './ComboboxInput'\nimport { Item } from './ComboboxItem'\nimport { ItemIndicator } from './ComboboxItemIndicator'\nimport { Items } from './ComboboxItems'\nimport { ItemText } from './ComboboxItemText'\nimport { Label } from './ComboboxLabel'\nimport { LeadingIcon } from './ComboboxLeadingIcon'\nimport { Popover } from './ComboboxPopover'\nimport { Portal } from './ComboboxPortal'\nimport { SelectedItems } from './ComboboxSelectedItems'\nimport { Trigger } from './ComboboxTrigger'\n\nexport { useComboboxContext, ComboboxProvider }\n\nexport const Combobox: typeof Root & {\n Group: typeof Group\n Item: typeof Item\n Items: typeof Items\n ItemText: typeof ItemText\n ItemIndicator: typeof ItemIndicator\n Label: typeof Label\n Popover: typeof Popover\n Trigger: typeof Trigger\n LeadingIcon: typeof LeadingIcon\n Empty: typeof Empty\n Input: typeof Input\n Disclosure: typeof Disclosure\n SelectedItems: typeof SelectedItems\n ClearButton: typeof ClearButton\n Portal: typeof Portal\n} = Object.assign(Root, {\n Group,\n Item,\n Items,\n ItemText,\n ItemIndicator,\n Label,\n Popover,\n Trigger,\n LeadingIcon,\n Empty,\n Input,\n Disclosure,\n SelectedItems,\n ClearButton,\n Portal,\n})\n\nCombobox.displayName = 'Combobox'\nGroup.displayName = 'Combobox.Group'\nItems.displayName = 'Combobox.Items'\nItem.displayName = 'Combobox.Item'\nItemText.displayName = 'Combobox.ItemText'\nItemIndicator.displayName = 'Combobox.ItemIndicator'\nLabel.displayName = 'Combobox.Label'\nPopover.displayName = 'Combobox.Popover'\nTrigger.displayName = 'Combobox.Trigger'\nLeadingIcon.displayName = 'Combobox.LeadingIcon'\nEmpty.displayName = 'Combobox.Empty'\nInput.displayName = 'Combobox.Input'\nDisclosure.displayName = 'Combobox.Disclosure'\nSelectedItems.displayName = 'Combobox.SelectedItems'\nClearButton.displayName = 'Combobox.ClearButton'\nPortal.displayName = 'Combobox.Portal'\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AACjC,SAAS,eAAAA,cAAa,4BAA4B;AAClD;AAAA,EACE;AAAA,EAEA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACjBP,SAAS,mBAAsE;;;ACA/E,SAAkB,gBAAmD,gBAAgB;AAM9E,SAAS,cAAc,KAAe,WAAmB;AAC9D,MAAI,QAAQ;AACZ,aAAW,CAAC,GAAG,KAAK,IAAI,QAAQ,GAAG;AACjC,QAAI,QAAQ,WAAW;AACrB,aAAO;AAAA,IACT;AACA;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAM,gBAAgB,CAAC,KAAe,UAAkB;AACtD,MAAI,IAAI;AACR,aAAW,OAAO,IAAI,KAAK,GAAG;AAC5B,QAAI,MAAM,MAAO,QAAO;AACxB;AAAA,EACF;AAEA,SAAO;AACT;AAEO,IAAM,oBAAoB,CAAC,KAAe,UAAkB;AACjE,QAAM,MAAM,cAAc,KAAK,KAAK;AAEpC,SAAO,QAAQ,SAAY,IAAI,IAAI,GAAG,IAAI;AAC5C;AAEA,IAAM,wBAAwB,CAAC,YAA2B;AACxD,SAAO,UAAW,QAAQ,KAAuC,cAAc;AACjF;AAEO,IAAM,kBAAkB,CAC7B,UACA,SAAyB,CAAC,MACP;AACnB,WAAS,QAAQ,UAAU,WAAS;AAClC,QAAI,CAAC,eAAe,KAAK,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W,IAAI;AAAA,MACjB,CAAC;AAAA,MACD,SAAS,MAAM;AACb,YAAI,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,UAAU;AACzC,cAAI,SAAS;AACb,cAAI,IAAI,cAAc,SAAS;AAC7B,gBAAI,cAAc,QAAQ,MAAM;AAAA,UAClC;AAAA,QACF;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,QACD,gBAAAL;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,WAAWM;AAAA,cACT;AAAA,cACA,IAAI,OAAO,cAAc;AAAA,YAC3B;AAAA,YAEC;AAAA;AAAA,cACA;AAAA;AAAA;AAAA,QACH;AAAA,QAEC,kBAAkB;AAAA,QAElB;AAAA;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEA,QAAQ,cAAc;;;AG3Ff,IAAMC,YAgBT,OAAO,OAAO,UAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDD,UAAS,cAAc;AACvB,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,KAAK,cAAc;AACnB,SAAS,cAAc;AACvB,cAAc,cAAc;AAC5B,MAAM,cAAc;AACpBC,SAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,YAAY,cAAc;AAC1B,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,WAAW,cAAc;AACzB,cAAc,cAAc;AAC5B,YAAY,cAAc;AAC1B,OAAO,cAAc;","names":["useCombobox","useCombobox","state","useCombobox","jsx","jsx","cx","jsx","cx","cx","jsx","cx","cx","Children","isValidElement","createContext","useContext","useId","jsx","createContext","useId","useContext","jsx","Children","isValidElement","cx","useFormFieldControl","useCombinedState","useMergeRefs","cx","Fragment","useEffect","Fragment","jsx","useFormFieldControl","useCombinedState","useEffect","useMergeRefs","cx","useMergeRefs","cx","createContext","useContext","useState","jsx","createContext","useState","useContext","jsx","useMergeRefs","cx","cx","jsx","cx","useMergeRefs","cx","useRef","jsx","useRef","useMergeRefs","cx","cx","useEffect","useId","jsx","useId","useEffect","cx","cx","jsx","cx","jsx","cx","useEffect","jsx","Popover","useEffect","cx","jsx","DeleteOutline","cx","Fragment","jsx","jsxs","cx","DeleteOutline","useFormFieldControl","useMergeRefs","cx","Fragment","useEffect","useRef","cva","styles","useEffect","useRef","Fragment","jsx","jsxs","useFormFieldControl","useMergeRefs","useRef","useEffect","styles","cx","Combobox","Popover"]}
@@ -1582,7 +1582,7 @@ var GroupContent = ({ children, className, ref: forwardedRef }) => {
1582
1582
  Group.displayName = "Dropdown.Group";
1583
1583
 
1584
1584
  // src/dropdown/DropdownItem.tsx
1585
- var import_use_merge_refs = require("@spark-ui/use-merge-refs");
1585
+ var import_use_merge_refs = require("@spark-ui/hooks/use-merge-refs");
1586
1586
  var import_class_variance_authority12 = require("class-variance-authority");
1587
1587
 
1588
1588
  // src/dropdown/DropdownItemContext.tsx
@@ -1710,7 +1710,7 @@ var ItemIndicator = ({
1710
1710
  ItemIndicator.displayName = "Dropdown.ItemIndicator";
1711
1711
 
1712
1712
  // src/dropdown/DropdownItems.tsx
1713
- var import_use_merge_refs2 = require("@spark-ui/use-merge-refs");
1713
+ var import_use_merge_refs2 = require("@spark-ui/hooks/use-merge-refs");
1714
1714
  var import_class_variance_authority14 = require("class-variance-authority");
1715
1715
  var import_react10 = require("react");
1716
1716
  var import_jsx_runtime24 = require("react/jsx-runtime");
@@ -1834,8 +1834,8 @@ var Portal2 = ({ children, ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime2
1834
1834
  Portal2.displayName = "Dropdown.Portal";
1835
1835
 
1836
1836
  // src/dropdown/DropdownTrigger.tsx
1837
+ var import_use_merge_refs3 = require("@spark-ui/hooks/use-merge-refs");
1837
1838
  var import_ArrowHorizontalDown = require("@spark-ui/icons/ArrowHorizontalDown");
1838
- var import_use_merge_refs3 = require("@spark-ui/use-merge-refs");
1839
1839
  var import_class_variance_authority19 = require("class-variance-authority");
1840
1840
  var import_react13 = require("react");
1841
1841