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YAAY,MAAM,OAAO;YACzB,4BAA4B,oBAAoB,aAAa,CAAC;YAC9D,0BAA0B,oBAAoB,WAAW,CAAC;QAC5D,GACA;QAGJ,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QACnC,KAAK;QACL,UAAU;QACV,YAAY;QACZ,MAAM;QACN,iBAAiB,AAAC,MAAM,KAAK,KAAK,MAAM,CAAC,MAAM,UAAU,GAAI,cAAc;;AAEjF","sources":["packages/@adobe/react-spectrum/src/searchfield/SearchField.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 */\n\nimport {AriaSearchFieldProps, useSearchField} from 'react-aria/useSearchField';\n\nimport {classNames} from '../utils/classNames';\nimport {ClearButton} from '../button/ClearButton';\nimport Magnifier from '@spectrum-icons/ui/Magnifier';\nimport React, {forwardRef, ReactElement, Ref, useEffect, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '../textfield/TextField';\nimport {SpectrumTextInputBase} from '@react-types/shared';\nimport styles from '@adobe/spectrum-css-temp/components/search/vars.css';\nimport {TextFieldBase} from '../textfield/TextFieldBase';\nimport {useFormProps} from '../form/Form';\nimport {useProviderProps} from '../provider/Provider';\nimport {useSearchFieldState} from 'react-stately/useSearchFieldState';\nimport {useSlotProps} from '../utils/Slots';\n\nexport interface SpectrumSearchFieldProps extends SpectrumTextInputBase, Omit<AriaSearchFieldProps, 'isInvalid' | 'validationState'>, SpectrumTextFieldProps {}\n\n/**\n * A SearchField is a text field designed for searches.\n */\nexport const SearchField = forwardRef(function SearchField(props: SpectrumSearchFieldProps, ref: Ref<TextFieldRef>) {\n  props = useSlotProps(props, 'searchfield');\n  props = useProviderProps(props);\n  props = useFormProps(props);\n  let defaultIcon = (\n    <Magnifier data-testid=\"searchicon\" />\n  );\n\n  let {\n    icon = defaultIcon,\n    isDisabled,\n    UNSAFE_className,\n    placeholder,\n    ...otherProps\n  } = props;\n\n  let hasWarned = useRef(false);\n  useEffect(() => {\n    if (placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\n      console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/SearchField.html#help-text');\n      hasWarned.current = true;\n    }\n  }, [placeholder]);\n\n  let state = useSearchFieldState(props);\n  let inputRef = useRef<HTMLInputElement>(null);\n  let {clearButtonProps, ...result} = useSearchField(props, state, inputRef);\n\n  let clearButton = (\n    <ClearButton\n      {...clearButtonProps}\n      preventFocus\n      UNSAFE_className={\n        classNames(\n          styles,\n          'spectrum-ClearButton'\n        )\n      }\n      isDisabled={isDisabled} />\n  );\n\n  let validationState = props.validationState || (result.isInvalid ? 'invalid' : undefined);\n\n  return (\n    <TextFieldBase\n      {...otherProps}\n      {...result}\n      validationState={validationState}\n      UNSAFE_className={\n        classNames(\n          styles,\n          'spectrum-Search',\n          'spectrum-Textfield',\n          {\n            'is-disabled': isDisabled,\n            'is-quiet': props.isQuiet,\n            'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,\n            'spectrum-Search--valid': validationState === 'valid' && !isDisabled\n          },\n          UNSAFE_className\n        )\n      }\n      inputClassName={classNames(styles, 'spectrum-Search-input')}\n      ref={ref}\n      inputRef={inputRef}\n      isDisabled={isDisabled}\n      icon={icon}\n      wrapperChildren={(state.value !== '' && !props.isReadOnly) ? clearButton : undefined} />\n  );\n}) as (props: SpectrumSearchFieldProps & {ref?: Ref<TextFieldRef>}) => ReactElement;\n"],"names":[],"version":3,"file":"SearchField.cjs.map"}