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G,WAAW;QACf,oBAAkB,MAAM,aAAa,CAAC,MAAM,KAAK,KAAK;;AAG5D","sources":["packages/react-aria-components/src/ComboBox.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {AriaComboBoxProps, useComboBox} from 'react-aria/useComboBox';\n\nimport {ButtonContext} from './Button';\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  Provider,\n  RACValidation,\n  removeDataAttributes,\n  RenderProps,\n  SlotProps,\n  useContextProps,\n  useRenderProps,\n  useSlot,\n  useSlottedContext\n} from './utils';\nimport {Collection, Node} from '@react-types/shared';\nimport {CollectionBuilder} from 'react-aria/CollectionBuilder';\nimport {ComboBoxState, useComboBoxState} from 'react-stately/useComboBoxState';\nimport {createHideableComponent} from 'react-aria/private/collections/Hidden';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {GlobalDOMAttributes, Key, RefObject} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {ListBoxContext, ListStateContext} from './ListBox';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport React, {\n  createContext,\n  ForwardedRef,\n  HTMLAttributes,\n  ReactElement,\n  ReactNode,\n  useCallback,\n  useContext,\n  useMemo,\n  useRef,\n  useState\n} from 'react';\nimport {TextContext} from './Text';\nimport {useFilter} from 'react-aria/useFilter';\nimport {useListFormatter} from 'react-aria/useListFormatter';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\ntype SelectionMode = 'single' | 'multiple';\n\nexport interface ComboBoxRenderProps {\n  /**\n   * Whether the combobox is currently open.\n   *\n   * @selector [data-open]\n   */\n  isOpen: boolean;\n  /**\n   * Whether the combobox is disabled.\n   *\n   * @selector [data-disabled]\n   */\n  isDisabled: boolean;\n  /**\n   * Whether the combobox is invalid.\n   *\n   * @selector [data-invalid]\n   */\n  isInvalid: boolean;\n  /**\n   * Whether the combobox is required.\n   *\n   * @selector [data-required]\n   */\n  isRequired: boolean;\n  /**\n   * Whether the combobox is read only.\n   *\n   * @selector [data-readonly]\n   */\n  isReadOnly: boolean;\n}\n\nexport interface ComboBoxProps<T, M extends SelectionMode = 'single'>\n  extends\n    Omit<\n      AriaComboBoxProps<T, M>,\n      | 'children'\n      | 'placeholder'\n      | 'label'\n      | 'description'\n      | 'errorMessage'\n      | 'validationState'\n      | 'validationBehavior'\n    >,\n    RACValidation,\n    RenderProps<ComboBoxRenderProps>,\n    SlotProps,\n    GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-ComboBox'\n   */\n  className?: ClassNameOrFunction<ComboBoxRenderProps>;\n  /** The filter function used to determine if a option should be included in the combo box list. */\n  defaultFilter?: (textValue: string, inputValue: string) => boolean;\n  /**\n   * Whether the text or key of the selected item is submitted as part of an HTML form. When\n   * `allowsCustomValue` is `true`, this option does not apply and the text is always submitted.\n   *\n   * @default 'key'\n   */\n  formValue?: 'text' | 'key';\n  /** Whether the combo box allows the menu to be open when the collection is empty. */\n  allowsEmptyCollection?: boolean;\n}\n\nexport const ComboBoxContext =\n  createContext<ContextValue<ComboBoxProps<any, SelectionMode>, HTMLDivElement>>(null);\nexport const ComboBoxStateContext = createContext<ComboBoxState<any, SelectionMode> | null>(null);\n\n/**\n * A combo box combines a text input with a listbox, allowing users to filter a list of options to\n * items matching a query.\n */\nexport const ComboBox = /*#__PURE__*/ createHideableComponent(function ComboBox<\n  T,\n  M extends SelectionMode = 'single'\n>(props: ComboBoxProps<T, M>, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, ComboBoxContext);\n  let {\n    children,\n    isDisabled = false,\n    isInvalid = false,\n    isRequired = false,\n    isReadOnly = false\n  } = props;\n  let content = useMemo(\n    () => (\n      <ListBoxContext.Provider value={{items: props.items ?? props.defaultItems}}>\n        {typeof children === 'function'\n          ? children({\n              isOpen: false,\n              isDisabled,\n              isInvalid,\n              isRequired,\n              defaultChildren: null,\n              isReadOnly\n            })\n          : children}\n      </ListBoxContext.Provider>\n    ),\n    [children, isDisabled, isInvalid, isRequired, isReadOnly, props.items, props.defaultItems]\n  );\n\n  return (\n    <CollectionBuilder content={content}>\n      {collection => <ComboBoxInner props={props} collection={collection} comboBoxRef={ref} />}\n    </CollectionBuilder>\n  );\n});\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [LabelContext, ButtonContext, InputContext, GroupContext, TextContext];\n\ninterface ComboBoxInnerProps<T> {\n  props: ComboBoxProps<T, SelectionMode>;\n  collection: Collection<Node<T>>;\n  comboBoxRef: RefObject<HTMLDivElement | null>;\n}\n\nfunction ComboBoxInner<T>({props, collection, comboBoxRef: ref}: ComboBoxInnerProps<T>) {\n  let {name, formValue = 'key', allowsCustomValue} = props;\n  if (allowsCustomValue) {\n    formValue = 'text';\n  }\n\n  let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n  let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n  let {contains} = useFilter({sensitivity: 'base'});\n  let state = useComboBoxState({\n    ...props,\n    defaultFilter: props.defaultFilter || contains,\n    // If props.items isn't provided, rely on collection filtering (aka listbox.items is provided or defaultItems provided to Combobox)\n    items: props.items,\n    children: undefined,\n    collection,\n    validationBehavior\n  });\n\n  let buttonRef = useRef<HTMLButtonElement>(null);\n  let inputRef = useRef<HTMLInputElement>(null);\n  let groupRef = useRef<HTMLDivElement>(null);\n  let listBoxRef = useRef<HTMLDivElement>(null);\n  let popoverRef = useRef<HTMLDivElement>(null);\n  let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n  let {\n    buttonProps,\n    inputProps,\n    listBoxProps,\n    labelProps,\n    descriptionProps,\n    errorMessageProps,\n    valueProps,\n    ...validation\n  } = useComboBox(\n    {\n      ...removeDataAttributes(props),\n      label,\n      inputRef,\n      buttonRef,\n      listBoxRef,\n      popoverRef,\n      name: formValue === 'text' ? name : undefined,\n      validationBehavior\n    },\n    state\n  );\n\n  // Make menu width match input + button\n  // Left for backward compatibility in case a <Group> is not rendered.\n  let [menuWidth, setMenuWidth] = useState<string | null>(null);\n  let onResize = useCallback(() => {\n    if (inputRef.current && !groupRef.current) {\n      let buttonRect = buttonRef.current?.getBoundingClientRect();\n      let inputRect = inputRef.current.getBoundingClientRect();\n      let minX = buttonRect ? Math.min(buttonRect.left, inputRect.left) : inputRect.left;\n      let maxX = buttonRect ? Math.max(buttonRect.right, inputRect.right) : inputRect.right;\n      setMenuWidth(maxX - minX + 'px');\n    }\n  }, [buttonRef, inputRef, setMenuWidth]);\n\n  useResizeObserver({\n    ref: inputRef,\n    onResize: onResize\n  });\n\n  // Position popover relative to group if available, otherwise input.\n  let triggerRef = useMemo(\n    () => ({\n      get current() {\n        return groupRef.current || inputRef.current;\n      }\n    }),\n    [groupRef, inputRef]\n  );\n\n  // Only expose a subset of state to renderProps function to avoid infinite render loop\n  let renderPropsState = useMemo(\n    () => ({\n      isOpen: state.isOpen,\n      isDisabled: props.isDisabled || false,\n      isInvalid: validation.isInvalid || false,\n      isRequired: props.isRequired || false,\n      isReadOnly: props.isReadOnly || false\n    }),\n    [state.isOpen, props.isDisabled, validation.isInvalid, props.isRequired, props.isReadOnly]\n  );\n\n  let renderProps = useRenderProps({\n    ...props,\n    values: renderPropsState,\n    defaultClassName: 'react-aria-ComboBox'\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n  delete DOMProps.id;\n\n  let inputs: ReactElement[] = [];\n  if (name && formValue === 'key') {\n    let values: (Key | null)[] = Array.isArray(state.value) ? state.value : [state.value];\n    if (values.length === 0) {\n      values = [null];\n    }\n\n    inputs = values.map((value, i) => (\n      <input key={i} type=\"hidden\" name={name} form={props.form} value={value ?? ''} />\n    ));\n  }\n\n  return (\n    <Provider\n      values={[\n        [ComboBoxStateContext, state],\n        [LabelContext, {...labelProps, ref: labelRef}],\n        [ButtonContext, {...buttonProps, ref: buttonRef, isPressed: state.isOpen}],\n        [InputContext, {...inputProps, ref: inputRef}],\n        [OverlayTriggerStateContext, state],\n        [\n          PopoverContext,\n          {\n            ref: popoverRef,\n            triggerRef,\n            scrollRef: listBoxRef,\n            placement: 'bottom start',\n            isNonModal: true,\n            trigger: 'ComboBox',\n            style: {'--trigger-width': menuWidth} as React.CSSProperties,\n            clearContexts: CLEAR_CONTEXTS\n          }\n        ],\n        [ListBoxContext, {...listBoxProps, ref: listBoxRef}],\n        [ListStateContext, state],\n        [\n          TextContext,\n          {\n            slots: {\n              description: descriptionProps,\n              errorMessage: errorMessageProps\n            }\n          }\n        ],\n        [\n          GroupContext,\n          {ref: groupRef, isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}\n        ],\n        [FieldErrorContext, validation],\n        [ComboBoxValueContext, valueProps]\n      ]}>\n      <dom.div\n        {...DOMProps}\n        {...renderProps}\n        ref={ref}\n        slot={props.slot || undefined}\n        data-focused={state.isFocused || undefined}\n        data-open={state.isOpen || undefined}\n        data-disabled={props.isDisabled || undefined}\n        data-readonly={props.isReadOnly || undefined}\n        data-invalid={validation.isInvalid || undefined}\n        data-required={props.isRequired || undefined}>\n        {renderProps.children}\n        {inputs}\n      </dom.div>\n    </Provider>\n  );\n}\n\nexport interface ComboBoxValueRenderProps<T> {\n  /**\n   * Whether the value is a placeholder.\n   *\n   * @selector [data-placeholder]\n   */\n  isPlaceholder: boolean;\n  /** The object values of the currently selected items. */\n  selectedItems: (T | null)[];\n  /** The textValue of the currently selected items. */\n  selectedText: string;\n  /** The state of the ComboBox. */\n  state: ComboBoxState<T, 'single' | 'multiple'>;\n}\n\nexport interface ComboBoxValueProps<T>\n  extends\n    Omit<HTMLAttributes<HTMLElement>, keyof RenderProps<unknown>>,\n    RenderProps<ComboBoxValueRenderProps<T>, 'div'> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-ComboBoxValue'\n   */\n  className?: ClassNameOrFunction<ComboBoxValueRenderProps<T>>;\n  /** A value to display when no items are selected. */\n  placeholder?: ReactNode;\n}\n\nexport const ComboBoxValueContext =\n  createContext<ContextValue<ComboBoxValueProps<any>, HTMLDivElement>>(null);\n\n/**\n * ComboBoxValue renders the selected values of a ComboBox, or a placeholder if no value is\n * selected. By default, the items are rendered as a comma separated list. Use the render function\n * to customize this.\n */\nexport const ComboBoxValue = /*#__PURE__*/ createHideableComponent(function ComboBoxValue<T>(\n  props: ComboBoxValueProps<T>,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  [props, ref] = useContextProps(props, ref, ComboBoxValueContext);\n  let state = useContext(ComboBoxStateContext)!;\n  let formatter = useListFormatter();\n  let selectedText = useMemo(\n    () =>\n      formatter.format(\n        state.selectedItems.map(item => item?.textValue || '').filter(v => v !== '')\n      ),\n    [formatter, state.selectedItems]\n  );\n\n  let renderProps = useRenderProps({\n    ...props,\n    defaultChildren: selectedText || props.placeholder,\n    defaultClassName: 'react-aria-ComboBoxValue',\n    values: {\n      selectedItems: useMemo(\n        () => state.selectedItems.map(item => (item.value as T) ?? null),\n        [state.selectedItems]\n      ),\n      selectedText,\n      isPlaceholder: state.selectedItems.length === 0,\n      state\n    }\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  return (\n    <dom.div\n      ref={ref}\n      {...DOMProps}\n      {...renderProps}\n      data-placeholder={state.selectedItems.length === 0 || undefined}\n    />\n  );\n});\n"],"names":[],"version":3,"file":"ComboBox.cjs.map"}