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AAA,GAAA,mDAAW,GACX;QAGJ,YAAY;QACZ,SAAS;QACT,iBAAiB;QACjB,WAAW,eAAgB,CAAA,UAAU,gBAAgB,YAAY,iBAAiB,SAAQ;QAC1F,kBAAkB,gBAAgB,OAAO,gBAAgB;QACzD,MAAM;QACN,iBAAiB,AAAC,CAAA,eAAe,MAAM,iBAAiB,eAAe,mBAAmB,IAAG,KAAM,CAAC,aAAa,cAAc;QAC/H,kBAAA;;AAIV;AAEA,IAAI,8DAA0B,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;AAG/C;;CAEC,GACD,IAAI,0DAA4B,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@adobe/react-spectrum/src/autocomplete/SearchAutocomplete.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {AriaButtonProps} from 'react-aria/useButton';\n\nimport {AriaSearchAutocompleteProps, useSearchAutocomplete} from 'react-aria/private/autocomplete/useSearchAutocomplete';\nimport {AsyncLoadable, DimensionValue, DOMRefValue, FocusableRef, LoadingState, SpectrumFieldValidation, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps} from '@react-types/shared';\nimport {classNames} from '../utils/classNames';\nimport {ClearButton} from '../button/ClearButton';\nimport {dimensionValue} from '../utils/styleProps';\nimport {Field} from '../label/Field';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport intlMessages from '../../intl/autocomplete/*.json';\nimport {ListBoxBase, useListBoxLayout} from '../listbox/ListBoxBase';\nimport Magnifier from '@spectrum-icons/ui/Magnifier';\nimport {MenuTriggerAction, useComboBoxState} from 'react-stately/useComboBoxState';\n// @ts-ignore\nimport {MobileSearchAutocomplete} from './MobileSearchAutocomplete';\nimport {Popover} from '../overlays/Popover';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n  forwardRef,\n  InputHTMLAttributes,\n  ReactElement,\n  RefObject,\n  useCallback,\n  useEffect,\n  useRef,\n  useState\n} from 'react';\nimport searchAutocompleteStyles from './searchautocomplete.css';\nimport searchStyles from '@adobe/spectrum-css-temp/components/search/vars.css';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TextFieldBase} from '../textfield/TextFieldBase';\nimport textfieldStyles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFilter} from 'react-aria/useFilter';\nimport {useFocusableRef, useUnwrapDOMRef} from '../utils/useDOMRef';\nimport {useFormProps} from '../form/Form';\nimport {useHover} from 'react-aria/useHover';\nimport {useIsMobileDevice} from '../utils/useIsMobileDevice';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProvider, useProviderProps} from '../provider/Provider';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\nexport interface SpectrumSearchAutocompleteProps<T> extends SpectrumTextInputBase, Omit<AriaSearchAutocompleteProps<T>, 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'>, SpectrumFieldValidation<string>, SpectrumLabelableProps, StyleProps, Omit<AsyncLoadable, 'isLoading'> {\n  /**\n   * The interaction required to display the SearchAutocomplete menu. Note that this prop has no effect on the mobile SearchAutocomplete experience.\n   * @default 'input'\n   */\n  menuTrigger?: MenuTriggerAction,\n  /** Whether the SearchAutocomplete should be displayed with a quiet style. */\n  isQuiet?: boolean,\n  /** Alignment of the menu relative to the input target.\n   * @default 'start'\n   */\n  align?: 'start' | 'end',\n  /**\n   * Direction the menu will render relative to the SearchAutocomplete.\n   * @default 'bottom'\n   */\n  direction?: 'bottom' | 'top',\n  /** The current loading state of the SearchAutocomplete. Determines whether or not the progress circle should be shown. */\n  loadingState?: LoadingState,\n  /**\n   * Whether the menu should automatically flip direction when space is limited.\n   * @default true\n   */\n  shouldFlip?: boolean,\n  /** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */\n  menuWidth?: DimensionValue,\n  onLoadMore?: () => void,\n  /** An icon to display at the start of the input. */\n  icon?: ReactElement | null\n}\n\nfunction SearchAutocomplete<T extends object>(props: SpectrumSearchAutocompleteProps<T>, ref: FocusableRef<HTMLElement>) {\n  props = useProviderProps(props);\n  props = useFormProps(props);\n\n  let hasWarned = useRef(false);\n  useEffect(() => {\n    if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n      console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead.');\n      hasWarned.current = true;\n    }\n  }, [props.placeholder]);\n\n  let isMobile = useIsMobileDevice();\n  if (isMobile) {\n    // menuTrigger=focus/manual don't apply to mobile searchwithin\n    return <MobileSearchAutocomplete {...props} menuTrigger=\"input\" ref={ref} />;\n  } else {\n    return <SearchAutocompleteBase {...props} ref={ref} />;\n  }\n}\n\nfunction ForwardSearchAutocompleteBase<T extends object>(props: SpectrumSearchAutocompleteProps<T>, ref: FocusableRef<HTMLElement>) {\n  props = useProviderProps(props);\n\n  let {\n    menuTrigger = 'input',\n    shouldFlip = true,\n    direction = 'bottom',\n    align = 'start',\n    isQuiet,\n    menuWidth: customMenuWidth,\n    loadingState,\n    onLoadMore,\n    onSubmit = () => {},\n    validate\n  } = props;\n\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n  let isAsync = loadingState != null;\n  let popoverRef = useRef<DOMRefValue<HTMLDivElement>>(null);\n  let unwrappedPopoverRef = useUnwrapDOMRef(popoverRef);\n  let listBoxRef = useRef(null);\n  let inputRef = useRef<HTMLInputElement>(null);\n  let domRef = useFocusableRef(ref, inputRef);\n\n  let {contains} = useFilter({sensitivity: 'base'});\n  let state = useComboBoxState(\n    {\n      ...props,\n      defaultFilter: contains,\n      allowsEmptyCollection: isAsync,\n      allowsCustomValue: true,\n      onSelectionChange: (key) => key !== null && onSubmit(null, key),\n      selectedKey: undefined,\n      defaultSelectedKey: undefined,\n      validate: useCallback(v => validate?.(v.inputValue), [validate])\n    }\n  );\n  let layout = useListBoxLayout();\n\n  let {inputProps, listBoxProps, labelProps, clearButtonProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useSearchAutocomplete(\n    {\n      ...props,\n      layoutDelegate: layout,\n      popoverRef: unwrappedPopoverRef,\n      listBoxRef,\n      inputRef,\n      menuTrigger\n    },\n    state\n  );\n\n  // Measure the width of the inputfield to inform the width of the menu (below).\n  let [menuWidth, setMenuWidth] = useState<number>(0);\n  let {scale} = useProvider();\n\n  let onResize = useCallback(() => {\n    if (inputRef.current) {\n      let inputWidth = inputRef.current.offsetWidth;\n      setMenuWidth(inputWidth);\n    }\n  }, [inputRef, setMenuWidth]);\n\n  useResizeObserver({\n    ref: domRef,\n    onResize: onResize\n  });\n\n  useLayoutEffect(onResize, [scale, onResize]);\n\n  let width = isQuiet ? undefined : menuWidth;\n  let style = {\n    width: customMenuWidth ? dimensionValue(customMenuWidth) : width,\n    minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth\n  };\n\n  return (\n    <>\n      <Field\n        {...props}\n        descriptionProps={descriptionProps}\n        errorMessageProps={errorMessageProps}\n        labelProps={labelProps}\n        isInvalid={isInvalid}\n        validationErrors={validationErrors}\n        validationDetails={validationDetails}\n        ref={domRef}>\n        <SearchAutocompleteInput\n          {...props}\n          isOpen={state.isOpen}\n          loadingState={loadingState}\n          inputProps={inputProps}\n          inputRef={inputRef}\n          clearButtonProps={clearButtonProps}\n          validationState={props.validationState || (isInvalid ? 'invalid' : undefined)} />\n      </Field>\n      <Popover\n        state={state}\n        UNSAFE_style={style}\n        UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {'spectrum-InputGroup-popover--quiet': isQuiet})}\n        ref={popoverRef}\n        triggerRef={inputRef}\n        placement={`${direction} ${align}`}\n        hideArrow\n        isNonModal\n        shouldFlip={shouldFlip}>\n        <ListBoxBase\n          {...listBoxProps}\n          ref={listBoxRef}\n          disallowEmptySelection\n          autoFocus={state.focusStrategy ?? undefined}\n          shouldSelectOnPressUp\n          focusOnPointerEnter\n          layout={layout}\n          state={state}\n          shouldUseVirtualFocus\n          isLoading={loadingState === 'loading' || loadingState === 'loadingMore'}\n          showLoadingSpinner={loadingState === 'loadingMore'}\n          onLoadMore={onLoadMore}\n          renderEmptyState={() => isAsync && (\n            <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n              {stringFormatter.format('noResults')}\n            </span>\n          )} />\n      </Popover>\n    </>\n  );\n}\n\nlet SearchAutocompleteBase = React.forwardRef(ForwardSearchAutocompleteBase) as <T>(props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n\n\ninterface SearchAutocompleteInputProps<T> extends SpectrumSearchAutocompleteProps<T> {\n  inputProps: InputHTMLAttributes<HTMLInputElement>,\n  inputRef: RefObject<HTMLInputElement | null>,\n  style?: React.CSSProperties,\n  className?: string,\n  isOpen?: boolean,\n  clearButtonProps: AriaButtonProps\n}\n\n// any type is because we don't want to call useObjectRef because this is an internal component and we know\n// we are always passing an object ref\nfunction ForwardSearchAutocompleteInput<T>(props: SearchAutocompleteInputProps<T>, ref: any) {\n  let searchIcon = (\n    <Magnifier data-testid=\"searchicon\" />\n  );\n\n  let {\n    icon = searchIcon,\n    isQuiet,\n    isDisabled,\n    isReadOnly,\n    validationState,\n    inputProps,\n    inputRef,\n    autoFocus,\n    style,\n    className,\n    loadingState,\n    isOpen,\n    menuTrigger,\n    clearButtonProps\n  } = props;\n  let {hoverProps, isHovered} = useHover({});\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n  let domProps = filterDOMProps(props);\n  let timeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n  let [showLoading, setShowLoading] = useState(false);\n\n  let loadingCircle = (\n    <ProgressCircle\n      aria-label={stringFormatter.format('loading')}\n      size=\"S\"\n      isIndeterminate\n      UNSAFE_className={classNames(\n        textfieldStyles,\n        'spectrum-Textfield-circleLoader',\n        classNames(\n          styles,\n          'spectrum-InputGroup-input-circleLoader'\n        ),\n        classNames(\n          searchStyles,\n          'spectrum-Search-circleLoader'\n        )\n      )} />\n  );\n\n  let clearButton = (\n    <ClearButton\n      {...clearButtonProps}\n      preventFocus\n      UNSAFE_className={\n        classNames(\n          searchStyles,\n          'spectrum-ClearButton'\n        )\n      }\n      isDisabled={isDisabled} />\n  );\n\n  let isLoading = loadingState === 'loading' || loadingState === 'filtering';\n  let inputValue = inputProps.value;\n  let lastInputValue = useRef(inputValue);\n  useEffect(() => {\n    if (isLoading && !showLoading) {\n      if (timeout.current === null) {\n        timeout.current = setTimeout(() => {\n          setShowLoading(true);\n        }, 500);\n      }\n\n      // If user is typing, clear the timer and restart since it is a new request\n      if (inputValue !== lastInputValue.current) {\n        clearTimeout(timeout.current);\n        timeout.current = setTimeout(() => {\n          setShowLoading(true);\n        }, 500);\n      }\n    } else if (!isLoading) {\n      // If loading is no longer happening, clear any timers and hide the loading circle\n      if (timeout.current != null) {\n        clearTimeout(timeout.current);\n        timeout.current = null;\n      }\n    }\n\n    lastInputValue.current = inputValue;\n  }, [isLoading, showLoading, inputValue]);\n  let [prevIsLoading, setPrevIsLoading] = useState(isLoading);\n  if (prevIsLoading !== isLoading && !isLoading) {\n    setShowLoading(false);\n    setPrevIsLoading(isLoading);\n  }\n\n  return (\n    (<FocusRing\n      within\n      isTextInput\n      focusClass={classNames(styles, 'is-focused')}\n      focusRingClass={classNames(styles, 'focus-ring')}\n      autoFocus={autoFocus}>\n      <div\n        {...hoverProps}\n        ref={ref as RefObject<HTMLDivElement | null>}\n        style={style}\n        className={\n          classNames(\n            styles,\n            'spectrum-InputGroup',\n            {\n              'spectrum-InputGroup--quiet': isQuiet,\n              'is-disabled': isDisabled,\n              'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,\n              'is-hovered': isHovered\n            },\n            classNames(\n              searchAutocompleteStyles,\n              'searchautocomplete'\n            ),\n            className\n          )\n        }>\n        <TextFieldBase\n          {...domProps}\n          inputProps={inputProps}\n          inputRef={inputRef}\n          UNSAFE_className={\n            classNames(\n              searchStyles,\n              'spectrum-Search',\n              'spectrum-Search--loadable',\n              'spectrum-Textfield',\n              {\n                'is-disabled': isDisabled,\n                'is-quiet': isQuiet,\n                'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,\n                'spectrum-Search--valid': validationState === 'valid' && !isDisabled\n              },\n              classNames(\n                styles,\n                'spectrum-InputGroup-field'\n              )\n            )\n          }\n          inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n          validationIconClassName={\n            classNames(\n              searchStyles,\n              'spectrum-Search-validationIcon'\n            )\n          }\n          isDisabled={isDisabled}\n          isQuiet={isQuiet}\n          validationState={validationState}\n          isLoading={showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')}\n          loadingIndicator={loadingState != null ? loadingCircle : undefined}\n          icon={icon}\n          wrapperChildren={(inputValue !== '' || loadingState === 'filtering' || validationState != null) && !isReadOnly ? clearButton : undefined}\n          disableFocusRing />\n      </div>\n    </FocusRing>)\n  );\n}\n\nlet SearchAutocompleteInput = React.forwardRef(ForwardSearchAutocompleteInput) as <T>(props: SearchAutocompleteInputProps<T> & {ref?: any}) => ReactElement;\n\n\n/**\n * A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.\n */\nlet ForwardSearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {ForwardSearchAutocomplete as SearchAutocomplete};\n"],"names":[],"version":3,"file":"SearchAutocomplete.cjs.map"}