@adobe/react-spectrum 3.47.1 → 3.47.2
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.
- package/dist/private/accordion_vars.css +66 -48
- package/dist/private/accordion_vars.css.map +1 -1
- package/dist/private/actionbar/ActionBar.cjs.map +1 -1
- package/dist/private/actionbar/ActionBar.js.map +1 -1
- package/dist/private/actionbar/ActionBar.mjs.map +1 -1
- package/dist/private/actionbar/actionbar.css +59 -57
- package/dist/private/actionbar/actionbar.css.map +1 -1
- package/dist/private/actiongroup/ActionGroup.cjs +1 -1
- package/dist/private/actiongroup/ActionGroup.cjs.map +1 -1
- package/dist/private/actiongroup/ActionGroup.js +1 -1
- package/dist/private/actiongroup/ActionGroup.js.map +1 -1
- package/dist/private/actiongroup/ActionGroup.mjs +1 -1
- package/dist/private/actiongroup/ActionGroup.mjs.map +1 -1
- package/dist/private/actiongroup_vars.css +124 -114
- package/dist/private/actiongroup_vars.css.map +1 -1
- package/dist/private/autocomplete/MobileSearchAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/MobileSearchAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/MobileSearchAutocomplete.mjs.map +1 -1
- package/dist/private/autocomplete/SearchAutocomplete.cjs.map +1 -1
- package/dist/private/autocomplete/SearchAutocomplete.js.map +1 -1
- package/dist/private/autocomplete/SearchAutocomplete.mjs.map +1 -1
- package/dist/private/autocomplete/searchautocomplete.css +6 -6
- package/dist/private/autocomplete/searchautocomplete.css.map +1 -1
- package/dist/private/avatar_vars.css +12 -7
- package/dist/private/avatar_vars.css.map +1 -1
- package/dist/private/badge_vars.css +76 -68
- package/dist/private/badge_vars.css.map +1 -1
- package/dist/private/barloader_vars.css +132 -112
- package/dist/private/barloader_vars.css.map +1 -1
- package/dist/private/breadcrumb_vars.css +182 -148
- package/dist/private/breadcrumb_vars.css.map +1 -1
- package/dist/private/button/Button.cjs.map +1 -1
- package/dist/private/button/Button.js.map +1 -1
- package/dist/private/button/Button.mjs.map +1 -1
- package/dist/private/button_vars.css +822 -785
- package/dist/private/button_vars.css.map +1 -1
- package/dist/private/buttongroup_vars.css +25 -24
- package/dist/private/buttongroup_vars.css.map +1 -1
- package/dist/private/buttongroup_vars_css.cjs +5 -5
- package/dist/private/buttongroup_vars_css.mjs +5 -5
- package/dist/private/calendar/CalendarBase.cjs.map +1 -1
- package/dist/private/calendar/CalendarBase.js.map +1 -1
- package/dist/private/calendar/CalendarBase.mjs.map +1 -1
- package/dist/private/calendar_vars.css +280 -256
- package/dist/private/calendar_vars.css.map +1 -1
- package/dist/private/card/BaseLayout.cjs +2 -2
- package/dist/private/card/BaseLayout.cjs.map +1 -1
- package/dist/private/card/BaseLayout.js +2 -2
- package/dist/private/card/BaseLayout.js.map +1 -1
- package/dist/private/card/BaseLayout.mjs +2 -2
- package/dist/private/card/BaseLayout.mjs.map +1 -1
- package/dist/private/card/CardView.cjs.map +1 -1
- package/dist/private/card/CardView.js.map +1 -1
- package/dist/private/card/CardView.mjs.map +1 -1
- package/dist/private/card_vars.css +995 -907
- package/dist/private/card_vars.css.map +1 -1
- package/dist/private/checkbox_vars.css +318 -219
- package/dist/private/checkbox_vars.css.map +1 -1
- package/dist/private/circleloader_vars.css +99 -85
- package/dist/private/circleloader_vars.css.map +1 -1
- package/dist/private/color/ColorEditor.cjs.map +1 -1
- package/dist/private/color/ColorEditor.js.map +1 -1
- package/dist/private/color/ColorEditor.mjs.map +1 -1
- package/dist/private/color/ColorPicker.css +28 -14
- package/dist/private/color/ColorPicker.css.map +1 -1
- package/dist/private/color/colorfield.css +3 -3
- package/dist/private/color/colorfield.css.map +1 -1
- package/dist/private/colorarea_vars.css +36 -29
- package/dist/private/colorarea_vars.css.map +1 -1
- package/dist/private/colorhandle_vars.css +23 -23
- package/dist/private/colorloupe_vars.css +5 -5
- package/dist/private/colorloupe_vars.css.map +1 -1
- package/dist/private/colorslider_vars.css +34 -34
- package/dist/private/colorslider_vars.css.map +1 -1
- package/dist/private/colorwheel_vars.css +44 -38
- package/dist/private/colorwheel_vars.css.map +1 -1
- package/dist/private/combobox/ComboBox.cjs.map +1 -1
- package/dist/private/combobox/ComboBox.js.map +1 -1
- package/dist/private/combobox/ComboBox.mjs.map +1 -1
- package/dist/private/combobox/MobileComboBox.cjs.map +1 -1
- package/dist/private/combobox/MobileComboBox.js.map +1 -1
- package/dist/private/combobox/MobileComboBox.mjs.map +1 -1
- package/dist/private/combobox/combobox.css +6 -6
- package/dist/private/combobox/combobox.css.map +1 -1
- package/dist/private/contextualhelp/ContextualHelp.cjs.map +1 -1
- package/dist/private/contextualhelp/ContextualHelp.js.map +1 -1
- package/dist/private/contextualhelp/ContextualHelp.mjs.map +1 -1
- package/dist/private/contextualhelp_vars.css +13 -13
- package/dist/private/contextualhelp_vars.css.map +1 -1
- package/dist/private/datepicker/DatePicker.cjs.map +1 -1
- package/dist/private/datepicker/DatePicker.js.map +1 -1
- package/dist/private/datepicker/DatePicker.mjs.map +1 -1
- package/dist/private/datepicker/DateRangePicker.cjs.map +1 -1
- package/dist/private/datepicker/DateRangePicker.js.map +1 -1
- package/dist/private/datepicker/DateRangePicker.mjs.map +1 -1
- package/dist/private/datepicker/styles.css +33 -31
- package/dist/private/datepicker/styles.css.map +1 -1
- package/dist/private/dialog/AlertDialog.cjs.map +1 -1
- package/dist/private/dialog/AlertDialog.js.map +1 -1
- package/dist/private/dialog/AlertDialog.mjs.map +1 -1
- package/dist/private/dialog/Dialog.cjs.map +1 -1
- package/dist/private/dialog/Dialog.js.map +1 -1
- package/dist/private/dialog/Dialog.mjs.map +1 -1
- package/dist/private/dialog_vars.css +216 -180
- package/dist/private/dialog_vars.css.map +1 -1
- package/dist/private/dropdown_vars.css +150 -114
- package/dist/private/dropdown_vars.css.map +1 -1
- package/dist/private/dropzone/DropZone.cjs.map +1 -1
- package/dist/private/dropzone/DropZone.js.map +1 -1
- package/dist/private/dropzone/DropZone.mjs.map +1 -1
- package/dist/private/dropzone_vars.css +114 -85
- package/dist/private/dropzone_vars.css.map +1 -1
- package/dist/private/fieldgroup_vars.css +54 -46
- package/dist/private/fieldgroup_vars.css.map +1 -1
- package/dist/private/fieldlabel_vars.css +183 -169
- package/dist/private/fieldlabel_vars.css.map +1 -1
- package/dist/private/helptext_vars.css +83 -69
- package/dist/private/helptext_vars.css.map +1 -1
- package/dist/private/icon_vars.css +52 -36
- package/dist/private/icon_vars.css.map +1 -1
- package/dist/private/illustratedmessage_vars.css +33 -31
- package/dist/private/illustratedmessage_vars.css.map +1 -1
- package/dist/private/inlinealert/InlineAlert.cjs.map +1 -1
- package/dist/private/inlinealert/InlineAlert.js.map +1 -1
- package/dist/private/inlinealert/InlineAlert.mjs.map +1 -1
- package/dist/private/inlinealert_vars.css +54 -46
- package/dist/private/inlinealert_vars.css.map +1 -1
- package/dist/private/inputgroup_vars.css +499 -319
- package/dist/private/inputgroup_vars.css.map +1 -1
- package/dist/private/label/Label.cjs.map +1 -1
- package/dist/private/label/Label.js.map +1 -1
- package/dist/private/label/Label.mjs.map +1 -1
- package/dist/private/link_vars.css +101 -85
- package/dist/private/link_vars.css.map +1 -1
- package/dist/private/list/ListView.cjs.map +1 -1
- package/dist/private/list/ListView.js.map +1 -1
- package/dist/private/list/ListView.mjs.map +1 -1
- package/dist/private/list/styles.css +425 -333
- package/dist/private/list/styles.css.map +1 -1
- package/dist/private/listbox/ListBoxBase.cjs.map +1 -1
- package/dist/private/listbox/ListBoxBase.js.map +1 -1
- package/dist/private/listbox/ListBoxBase.mjs.map +1 -1
- package/dist/private/menu/ActionMenu.cjs.map +1 -1
- package/dist/private/menu/ActionMenu.js.map +1 -1
- package/dist/private/menu/ActionMenu.mjs.map +1 -1
- package/dist/private/menu/Menu.cjs.map +1 -1
- package/dist/private/menu/Menu.js.map +1 -1
- package/dist/private/menu/Menu.mjs.map +1 -1
- package/dist/private/menu/MenuItem.cjs.map +1 -1
- package/dist/private/menu/MenuItem.js.map +1 -1
- package/dist/private/menu/MenuItem.mjs.map +1 -1
- package/dist/private/menu_vars.css +178 -160
- package/dist/private/menu_vars.css.map +1 -1
- package/dist/private/modal_vars.css +64 -54
- package/dist/private/modal_vars.css.map +1 -1
- package/dist/private/overlays/overlays.css +7 -5
- package/dist/private/overlays/overlays.css.map +1 -1
- package/dist/private/package.cjs +1 -1
- package/dist/private/package.cjs.map +1 -1
- package/dist/private/package.js +1 -1
- package/dist/private/package.js.map +1 -1
- package/dist/private/package.mjs +1 -1
- package/dist/private/package.mjs.map +1 -1
- package/dist/private/page_vars.css +54 -46
- package/dist/private/page_vars.css.map +1 -1
- package/dist/private/picker/Picker.cjs.map +1 -1
- package/dist/private/picker/Picker.js.map +1 -1
- package/dist/private/picker/Picker.mjs.map +1 -1
- package/dist/private/popover_vars.css +105 -83
- package/dist/private/popover_vars.css.map +1 -1
- package/dist/private/radio_vars.css +257 -163
- package/dist/private/radio_vars.css.map +1 -1
- package/dist/private/rule_vars.css +73 -63
- package/dist/private/rule_vars.css.map +1 -1
- package/dist/private/search_vars.css +95 -87
- package/dist/private/search_vars.css.map +1 -1
- package/dist/private/slider/RangeSlider.cjs.map +1 -1
- package/dist/private/slider/RangeSlider.js.map +1 -1
- package/dist/private/slider/RangeSlider.mjs.map +1 -1
- package/dist/private/slider_vars.css +516 -402
- package/dist/private/slider_vars.css.map +1 -1
- package/dist/private/statuslight_vars.css +76 -68
- package/dist/private/statuslight_vars.css.map +1 -1
- package/dist/private/steplist/StepListItem.cjs.map +1 -1
- package/dist/private/steplist/StepListItem.js.map +1 -1
- package/dist/private/steplist/StepListItem.mjs.map +1 -1
- package/dist/private/steplist_vars.css +371 -297
- package/dist/private/steplist_vars.css.map +1 -1
- package/dist/private/stepper_vars.css +557 -438
- package/dist/private/stepper_vars.css.map +1 -1
- package/dist/private/table/Resizer.cjs.map +1 -1
- package/dist/private/table/Resizer.js.map +1 -1
- package/dist/private/table/Resizer.mjs.map +1 -1
- package/dist/private/table/TableViewBase.cjs.map +1 -1
- package/dist/private/table/TableViewBase.js.map +1 -1
- package/dist/private/table/TableViewBase.mjs.map +1 -1
- package/dist/private/table/table.css +103 -95
- package/dist/private/table/table.css.map +1 -1
- package/dist/private/table_vars.css +458 -350
- package/dist/private/table_vars.css.map +1 -1
- package/dist/private/tabs_vars.css +319 -281
- package/dist/private/tabs_vars.css.map +1 -1
- package/dist/private/tag/TagGroup.cjs.map +1 -1
- package/dist/private/tag/TagGroup.js.map +1 -1
- package/dist/private/tag/TagGroup.mjs.map +1 -1
- package/dist/private/tags_vars.css +167 -149
- package/dist/private/tags_vars.css.map +1 -1
- package/dist/private/textfield/TextFieldBase.cjs.map +1 -1
- package/dist/private/textfield/TextFieldBase.js.map +1 -1
- package/dist/private/textfield/TextFieldBase.mjs.map +1 -1
- package/dist/private/textfield_vars.css +278 -250
- package/dist/private/textfield_vars.css.map +1 -1
- package/dist/private/toast/Toast.cjs.map +1 -1
- package/dist/private/toast/Toast.js.map +1 -1
- package/dist/private/toast/Toast.mjs.map +1 -1
- package/dist/private/toast/toastContainer.css +64 -56
- package/dist/private/toast/toastContainer.css.map +1 -1
- package/dist/private/toast_vars.css +5 -3
- package/dist/private/toast_vars.css.map +1 -1
- package/dist/private/toggle_vars.css +287 -211
- package/dist/private/toggle_vars.css.map +1 -1
- package/dist/private/tooltip_vars.css +150 -127
- package/dist/private/tooltip_vars.css.map +1 -1
- package/dist/private/tray_vars.css +54 -46
- package/dist/private/tray_vars.css.map +1 -1
- package/dist/private/typography_index.css +54 -46
- package/dist/private/typography_index.css.map +1 -1
- package/dist/private/underlay_vars.css +58 -50
- package/dist/private/underlay_vars.css.map +1 -1
- package/dist/private/well_vars.css +54 -46
- package/dist/private/well_vars.css.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDD,SAAS,sD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U;QACR,GAAG,YAAY;QAChB,UAAU;0BAAC;wBAAc;QAAU;QACnC,wBAAA;QACA,uBAAA;QACA,qBAAA;QACA,QAAQ;QACR,OAAO;QACP,uBAAA;QACA,kBAAkB,IAChB,iBAAiB,2BACf,gCAAC;gBAAK,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,0DAAuB,GAAG;eACnD,gBAAgB,MAAM,CAAC;QAI9B,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,0DAAuB,GAAG;QACvD,KAAK;QACL,UAAU;QACV,YAAY;QACZ,WAAW;sBAEb,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW;;AAIlC","sources":["packages/@adobe/react-spectrum/src/autocomplete/MobileSearchAutocomplete.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames} from '../utils/classNames';\nimport {ClearButton} from '../button/ClearButton';\nimport {ComboBoxState, useComboBoxState} from 'react-stately/useComboBoxState';\nimport {DismissButton} from 'react-aria/Overlay';\nimport {Field} from '../label/Field';\nimport {FocusableRef, ValidationState} from '@react-types/shared';\nimport {focusSafely} from 'react-aria/private/interactions/focusSafely';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport {getActiveElement} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/autocomplete/*.json';\nimport {ListBoxBase, useListBoxLayout} from '../listbox/ListBoxBase';\nimport Magnifier from '@spectrum-icons/ui/Magnifier';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n HTMLAttributes,\n InputHTMLAttributes,\n ReactElement,\n ReactNode,\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';\n// @ts-ignore\nimport {setInteractionModality} from 'react-aria/private/interactions/useFocusVisible';\nimport {SpectrumSearchAutocompleteProps} from './SearchAutocomplete';\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 {Tray} from '../overlays/Tray';\nimport {useDialog} from 'react-aria/useDialog';\nimport {useField} from 'react-aria/useField';\nimport {useFilter} from 'react-aria/useFilter';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useFormReset} from 'react-aria/private/utils/useFormReset';\nimport {useFormValidation} from 'react-aria/private/form/useFormValidation';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\nimport {useProviderProps} from '../provider/Provider';\nimport {useSearchAutocomplete} from 'react-aria/private/autocomplete/useSearchAutocomplete';\n\nfunction ForwardMobileSearchAutocomplete<T extends object>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n\n let {\n isQuiet,\n isDisabled,\n isRequired,\n validationBehavior,\n validate,\n name,\n isReadOnly,\n onSubmit = () => {}\n } = props;\n\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState({\n ...props,\n defaultFilter: contains,\n allowsEmptyCollection: true,\n // Needs to be false here otherwise we double up on commitSelection/commitCustomValue calls when\n // user taps on underlay (i.e. initial tap will call setFocused(false) -> commitSelection/commitCustomValue via onBlur,\n // then the closing of the tray will call setFocused(false) again due to cleanup effect)\n shouldCloseOnBlur: false,\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 buttonRef = useRef<HTMLDivElement>(null);\n let domRef = useFocusableRef(ref, buttonRef);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'listbox'}, state, buttonRef);\n\n let inputRef = useRef<HTMLInputElement>(null);\n useFormValidation(\n {\n ...props,\n focus: () => buttonRef.current?.focus()\n },\n state,\n inputRef\n );\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);\n let errorMessage = props.errorMessage ?? validationErrors.join(' ');\n\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage\n });\n\n // Focus the button and show focus ring when clicking on the label\n labelProps.onClick = () => {\n if (!props.isDisabled && buttonRef.current) {\n buttonRef.current.focus();\n setInteractionModality('keyboard');\n }\n };\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name,\n value: state.inputValue\n };\n\n if (validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n useFormReset(inputRef, state.defaultInputValue, state.setInputValue);\n\n return (\n <>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n elementType=\"span\"\n ref={domRef}\n includeNecessityIndicatorInAccessibilityName>\n <SearchAutocompleteButton\n {...mergeProps(triggerProps, fieldProps, {autoFocus: props.autoFocus, icon: props.icon})}\n ref={buttonRef}\n isQuiet={isQuiet}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isPlaceholder={!state.inputValue}\n validationState={validationState}\n inputValue={state.inputValue}\n clearInput={() => state.setInputValue('')}\n onPress={() => !isReadOnly && state.open(null, 'manual')}>\n {state.inputValue || props.placeholder || ''}\n </SearchAutocompleteButton>\n </Field>\n <input {...inputProps} ref={inputRef} />\n <Tray state={state} isFixedHeight {...overlayProps}>\n <SearchAutocompleteTray\n {...props}\n onClose={state.close}\n overlayProps={overlayProps}\n state={state}\n />\n </Tray>\n </>\n );\n}\n\nexport let MobileSearchAutocomplete = React.forwardRef(ForwardMobileSearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n\ninterface SearchAutocompleteButtonProps extends AriaButtonProps {\n icon?: ReactElement | null;\n isQuiet?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n isPlaceholder?: boolean;\n validationState?: ValidationState;\n inputValue?: string;\n clearInput?: () => void;\n children?: ReactNode;\n style?: React.CSSProperties;\n className?: string;\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\nconst SearchAutocompleteButton = React.forwardRef(function SearchAutocompleteButton(\n props: SearchAutocompleteButtonProps,\n ref: any\n) {\n let searchIcon = <Magnifier data-testid=\"searchicon\" />;\n\n let {\n icon = searchIcon,\n isQuiet,\n isDisabled,\n isReadOnly,\n isPlaceholder,\n validationState,\n inputValue,\n clearInput,\n children,\n style,\n className\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n let valueId = useId();\n let invalidId = useId();\n let validationIcon =\n validationState === 'invalid' ? (\n <AlertMedium id={invalidId} aria-label={stringFormatter.format('invalid')} />\n ) : (\n <CheckmarkMedium />\n );\n\n if (icon) {\n icon = React.cloneElement(icon, {\n UNSAFE_className: classNames(textfieldStyles, 'spectrum-Textfield-icon'),\n size: 'S'\n });\n }\n\n let clearButton = (\n <ClearButton\n onPress={e => {\n clearInput?.();\n props?.onPress?.(e);\n }}\n preventFocus\n aria-label={stringFormatter.format('clear')}\n excludeFromTabOrder\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\n );\n\n let validation = React.cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n textfieldStyles,\n 'spectrum-Textfield-validationIcon',\n classNames(styles, 'spectrum-InputGroup-input-validationIcon'),\n classNames(searchStyles, 'spectrum-Search-validationIcon')\n )\n });\n\n let {hoverProps, isHovered} = useHover({});\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let {buttonProps} = useButton(\n {\n ...props,\n 'aria-labelledby': [\n props['aria-labelledby'],\n props['aria-label'] && !props['aria-labelledby'] ? props.id : null,\n valueId,\n validationState === 'invalid' ? invalidId : null\n ]\n .filter(Boolean)\n .join(' '),\n elementType: 'div'\n },\n ref\n );\n\n return (\n <div\n {...mergeProps(hoverProps, focusProps, buttonProps)}\n aria-haspopup=\"dialog\"\n ref={ref}\n style={{...style, outline: 'none'}}\n className={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 'is-focused': isFocused,\n 'focus-ring': isFocusVisible\n },\n classNames(searchAutocompleteStyles, 'searchautocomplete', 'mobile-searchautocomplete'),\n className\n )}>\n <div\n className={classNames(\n textfieldStyles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': validationState === 'invalid' && !isDisabled,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--quiet': isQuiet\n },\n classNames(searchStyles, 'spectrum-Search', 'spectrum-Search--loadable', {\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(styles, 'spectrum-InputGroup-field')\n )}>\n <div\n className={classNames(\n textfieldStyles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': !!icon,\n 'is-hovered': isHovered,\n 'is-placeholder': isPlaceholder,\n 'is-disabled': isDisabled,\n 'is-quiet': isQuiet,\n 'is-focused': isFocused\n },\n classNames(searchStyles, 'spectrum-Search-input'),\n classNames(searchAutocompleteStyles, 'mobile-input')\n )}>\n {icon}\n <span id={valueId} className={classNames(searchAutocompleteStyles, 'mobile-value')}>\n {children}\n </span>\n </div>\n {validationState && !isDisabled ? validation : null}\n {(inputValue !== '' || validationState != null) && !isReadOnly && clearButton}\n </div>\n </div>\n );\n});\n\ninterface SearchAutocompleteTrayProps<T> extends SpectrumSearchAutocompleteProps<T> {\n state: ComboBoxState<T>;\n overlayProps: HTMLAttributes<HTMLElement>;\n loadingIndicator?: ReactElement;\n onClose: () => void;\n}\n\nfunction SearchAutocompleteTray<T>(props: SearchAutocompleteTrayProps<T>) {\n let searchIcon = <Magnifier data-testid=\"searchicon\" />;\n\n let {\n // completionMode = 'suggest',\n state,\n icon = searchIcon,\n isDisabled,\n validationState,\n label,\n overlayProps,\n loadingState,\n onLoadMore,\n onClose,\n onSubmit\n } = props;\n\n let timeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let [showLoading, setShowLoading] = useState(false);\n let inputRef = useRef<HTMLInputElement>(null);\n let popoverRef = useRef<HTMLDivElement>(null);\n let listBoxRef = useRef<HTMLDivElement>(null);\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n let layout = useListBoxLayout();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n\n let {inputProps, listBoxProps, labelProps, clearButtonProps} = useSearchAutocomplete<T>(\n {\n ...props,\n layoutDelegate: layout,\n popoverRef: popoverRef,\n listBoxRef,\n inputRef,\n // Handled outside the tray.\n name: undefined\n },\n state\n );\n\n React.useEffect(() => {\n if (inputRef.current) {\n focusSafely(inputRef.current);\n }\n }, []);\n\n React.useEffect(() => {\n // When the tray closes, set state.isFocused (i.e. the tray input's focus tracker) to false.\n // This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay\n // (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to \"contain\")\n // Have to do this manually since React doesn't call onBlur when a component is unmounted: https://github.com/facebook/react/issues/12363\n if (!state.isOpen && state.isFocused) {\n state.setFocused(false);\n }\n });\n\n let {dialogProps} = useDialog(\n {\n 'aria-labelledby': useId(labelProps.id)\n },\n popoverRef\n );\n\n // Override the role of the input to \"searchbox\" instead of \"combobox\".\n // Since the listbox is always visible, the combobox role doesn't really give us anything.\n // VoiceOver on iOS reads \"double tap to collapse\" when focused on the input rather than\n // \"double tap to edit text\", as with a textbox or searchbox. We'd like double tapping to\n // open the virtual keyboard rather than closing the tray.\n inputProps.role = 'searchbox';\n inputProps['aria-haspopup'] = 'listbox';\n delete inputProps.onTouchEnd;\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n aria-label={stringFormatter.format('clear')}\n excludeFromTabOrder\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\n );\n\n let loadingCircle = (\n <ProgressCircle\n aria-label={stringFormatter.format('loading')}\n size=\"S\"\n isIndeterminate\n UNSAFE_className={classNames(\n searchStyles,\n 'spectrum-Search-circleLoader',\n classNames(textfieldStyles, 'spectrum-Textfield-circleLoader')\n )}\n />\n );\n\n // Close the software keyboard on scroll to give the user a bigger area to scroll.\n // But only do this if scrolling with touch, otherwise it can cause issues with touch\n // screen readers.\n let isTouchDown = useRef(false);\n let onTouchStart = () => {\n isTouchDown.current = true;\n };\n\n let onTouchEnd = () => {\n isTouchDown.current = false;\n };\n\n let onScroll = useCallback(() => {\n if (!inputRef.current || getActiveElement() !== inputRef.current || !isTouchDown.current) {\n return;\n }\n\n if (popoverRef.current) {\n popoverRef.current.focus();\n }\n }, [inputRef, popoverRef, isTouchDown]);\n\n let inputValue = inputProps.value;\n let lastInputValue = useRef(inputValue);\n useEffect(() => {\n if (loadingState === 'filtering' && !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 (loadingState !== 'filtering') {\n // If loading is no longer happening, clear any timers and hide the loading circle\n setShowLoading(false);\n if (timeout.current !== null) {\n clearTimeout(timeout.current);\n timeout.current = null;\n }\n }\n\n lastInputValue.current = inputValue;\n }, [loadingState, inputValue, showLoading]);\n\n let onKeyDown = e => {\n // Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options\n if (e.key === 'Enter' && state.selectionManager.focusedKey == null) {\n popoverRef.current?.focus();\n if (onClose) {\n onClose();\n }\n if (onSubmit) {\n onSubmit(inputValue == null ? null : inputValue.toString(), null);\n }\n } else {\n if (inputProps.onKeyDown) {\n inputProps.onKeyDown(e);\n }\n }\n };\n\n if (icon) {\n icon = React.cloneElement(icon, {\n UNSAFE_className: classNames(textfieldStyles, 'spectrum-Textfield-icon'),\n size: 'S'\n });\n }\n\n return (\n <FocusScope restoreFocus contain>\n <div\n {...mergeProps(overlayProps, dialogProps)}\n ref={popoverRef}\n className={classNames(searchAutocompleteStyles, 'tray-dialog')}>\n <DismissButton onDismiss={onClose} />\n <TextFieldBase\n label={label}\n labelProps={labelProps}\n inputProps={{...inputProps, onKeyDown}}\n inputRef={inputRef}\n isDisabled={isDisabled}\n isLoading={showLoading && loadingState === 'filtering'}\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n validationState={validationState}\n wrapperChildren={\n (state.inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !props.isReadOnly\n ? clearButton\n : undefined\n }\n icon={icon}\n UNSAFE_className={classNames(\n searchStyles,\n 'spectrum-Search',\n 'spectrum-Textfield',\n 'spectrum-Search--loadable',\n {\n 'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,\n 'spectrum-Search--valid': validationState === 'valid' && !isDisabled\n },\n classNames(searchAutocompleteStyles, 'tray-textfield', {\n 'has-label': !!props.label\n })\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n />\n <ListBoxBase\n {...listBoxProps}\n domProps={{onTouchStart, onTouchEnd}}\n disallowEmptySelection\n shouldSelectOnPressUp\n focusOnPointerEnter\n layout={layout}\n state={state}\n shouldUseVirtualFocus\n renderEmptyState={() =>\n loadingState !== 'loading' && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n UNSAFE_className={classNames(searchAutocompleteStyles, 'tray-listbox')}\n ref={listBoxRef}\n onScroll={onScroll}\n onLoadMore={onLoadMore}\n isLoading={isLoading}\n />\n <DismissButton onDismiss={onClose} />\n </div>\n </FocusScope>\n );\n}\n"],"names":[],"version":3,"file":"MobileSearchAutocomplete.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDD,SAAS,sDACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IAEzB,IAAI,WACF,OAAO,cACP,UAAU,cACV,UAAU,sBACV,kBAAkB,YAClB,QAAQ,QACR,IAAI,cACJ,UAAU,YACV,WAAW,KAAO,GACnB,GAAG;IAEJ,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,G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,gBAAgB,MAAM,CAAC;QAI9B,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,0DAAuB,GAAG;QACvD,KAAK;QACL,UAAU;QACV,YAAY;QACZ,WAAW;sBAEb,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW;;AAIlC","sources":["packages/@adobe/react-spectrum/src/autocomplete/MobileSearchAutocomplete.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport {AriaButtonProps, useButton} from 'react-aria/useButton';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames} from '../utils/classNames';\nimport {ClearButton} from '../button/ClearButton';\nimport {ComboBoxState, useComboBoxState} from 'react-stately/useComboBoxState';\nimport {DismissButton} from 'react-aria/Overlay';\nimport {Field} from '../label/Field';\nimport {FocusableRef, ValidationState} from '@react-types/shared';\nimport {focusSafely} from 'react-aria/private/interactions/focusSafely';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport {getActiveElement} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport intlMessages from '../../intl/autocomplete/*.json';\nimport {ListBoxBase, useListBoxLayout} from '../listbox/ListBoxBase';\nimport Magnifier from '@spectrum-icons/ui/Magnifier';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {ProgressCircle} from '../progress/ProgressCircle';\nimport React, {\n HTMLAttributes,\n InputHTMLAttributes,\n ReactElement,\n ReactNode,\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 {setInteractionModality} from 'react-aria/private/interactions/useFocusVisible';\nimport {SpectrumSearchAutocompleteProps} from './SearchAutocomplete';\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 {Tray} from '../overlays/Tray';\nimport {useDialog} from 'react-aria/useDialog';\nimport {useField} from 'react-aria/useField';\nimport {useFilter} from 'react-aria/useFilter';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useFormReset} from 'react-aria/private/utils/useFormReset';\nimport {useFormValidation} from 'react-aria/private/form/useFormValidation';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\nimport {useProviderProps} from '../provider/Provider';\nimport {useSearchAutocomplete} from 'react-aria/private/autocomplete/useSearchAutocomplete';\n\nfunction ForwardMobileSearchAutocomplete<T extends object>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\n props = useProviderProps(props);\n\n let {\n isQuiet,\n isDisabled,\n isRequired,\n validationBehavior,\n validate,\n name,\n isReadOnly,\n onSubmit = () => {}\n } = props;\n\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState({\n ...props,\n defaultFilter: contains,\n allowsEmptyCollection: true,\n // Needs to be false here otherwise we double up on commitSelection/commitCustomValue calls when\n // user taps on underlay (i.e. initial tap will call setFocused(false) -> commitSelection/commitCustomValue via onBlur,\n // then the closing of the tray will call setFocused(false) again due to cleanup effect)\n shouldCloseOnBlur: false,\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 buttonRef = useRef<HTMLDivElement>(null);\n let domRef = useFocusableRef(ref, buttonRef);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'listbox'}, state, buttonRef);\n\n let inputRef = useRef<HTMLInputElement>(null);\n useFormValidation(\n {\n ...props,\n focus: () => buttonRef.current?.focus()\n },\n state,\n inputRef\n );\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);\n let errorMessage = props.errorMessage ?? validationErrors.join(' ');\n\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage\n });\n\n // Focus the button and show focus ring when clicking on the label\n labelProps.onClick = () => {\n if (!props.isDisabled && buttonRef.current) {\n buttonRef.current.focus();\n setInteractionModality('keyboard');\n }\n };\n\n let inputProps: InputHTMLAttributes<HTMLInputElement> = {\n type: 'hidden',\n name,\n value: state.inputValue\n };\n\n if (validationBehavior === 'native') {\n // Use a hidden <input type=\"text\"> rather than <input type=\"hidden\">\n // so that an empty value blocks HTML form submission when the field is required.\n inputProps.type = 'text';\n inputProps.hidden = true;\n inputProps.required = isRequired;\n // Ignore react warning.\n inputProps.onChange = () => {};\n }\n\n useFormReset(inputRef, state.defaultInputValue, state.setInputValue);\n\n return (\n <>\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n elementType=\"span\"\n ref={domRef}\n includeNecessityIndicatorInAccessibilityName>\n <SearchAutocompleteButton\n {...mergeProps(triggerProps, fieldProps, {autoFocus: props.autoFocus, icon: props.icon})}\n ref={buttonRef}\n isQuiet={isQuiet}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isPlaceholder={!state.inputValue}\n validationState={validationState}\n inputValue={state.inputValue}\n clearInput={() => state.setInputValue('')}\n onPress={() => !isReadOnly && state.open(null, 'manual')}>\n {state.inputValue || props.placeholder || ''}\n </SearchAutocompleteButton>\n </Field>\n <input {...inputProps} ref={inputRef} />\n <Tray state={state} isFixedHeight {...overlayProps}>\n <SearchAutocompleteTray\n {...props}\n onClose={state.close}\n overlayProps={overlayProps}\n state={state}\n />\n </Tray>\n </>\n );\n}\n\nexport let MobileSearchAutocomplete = React.forwardRef(ForwardMobileSearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n\ninterface SearchAutocompleteButtonProps extends AriaButtonProps {\n icon?: ReactElement | null;\n isQuiet?: boolean;\n isDisabled?: boolean;\n isReadOnly?: boolean;\n isPlaceholder?: boolean;\n validationState?: ValidationState;\n inputValue?: string;\n clearInput?: () => void;\n children?: ReactNode;\n style?: React.CSSProperties;\n className?: string;\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\nconst SearchAutocompleteButton = React.forwardRef(function SearchAutocompleteButton(\n props: SearchAutocompleteButtonProps,\n ref: any\n) {\n let searchIcon = <Magnifier data-testid=\"searchicon\" />;\n\n let {\n icon = searchIcon,\n isQuiet,\n isDisabled,\n isReadOnly,\n isPlaceholder,\n validationState,\n inputValue,\n clearInput,\n children,\n style,\n className\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n let valueId = useId();\n let invalidId = useId();\n let validationIcon =\n validationState === 'invalid' ? (\n <AlertMedium id={invalidId} aria-label={stringFormatter.format('invalid')} />\n ) : (\n <CheckmarkMedium />\n );\n\n if (icon) {\n icon = React.cloneElement(icon, {\n UNSAFE_className: classNames(textfieldStyles, 'spectrum-Textfield-icon'),\n size: 'S'\n });\n }\n\n let clearButton = (\n <ClearButton\n onPress={e => {\n clearInput?.();\n props?.onPress?.(e);\n }}\n preventFocus\n aria-label={stringFormatter.format('clear')}\n excludeFromTabOrder\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\n );\n\n let validation = React.cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n textfieldStyles,\n 'spectrum-Textfield-validationIcon',\n classNames(styles, 'spectrum-InputGroup-input-validationIcon'),\n classNames(searchStyles, 'spectrum-Search-validationIcon')\n )\n });\n\n let {hoverProps, isHovered} = useHover({});\n let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n let {buttonProps} = useButton(\n {\n ...props,\n 'aria-labelledby': [\n props['aria-labelledby'],\n props['aria-label'] && !props['aria-labelledby'] ? props.id : null,\n valueId,\n validationState === 'invalid' ? invalidId : null\n ]\n .filter(Boolean)\n .join(' '),\n elementType: 'div'\n },\n ref\n );\n\n return (\n <div\n {...mergeProps(hoverProps, focusProps, buttonProps)}\n aria-haspopup=\"dialog\"\n ref={ref}\n style={{...style, outline: 'none'}}\n className={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 'is-focused': isFocused,\n 'focus-ring': isFocusVisible\n },\n classNames(searchAutocompleteStyles, 'searchautocomplete', 'mobile-searchautocomplete'),\n className\n )}>\n <div\n className={classNames(\n textfieldStyles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': validationState === 'invalid' && !isDisabled,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--quiet': isQuiet\n },\n classNames(searchStyles, 'spectrum-Search', 'spectrum-Search--loadable', {\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(styles, 'spectrum-InputGroup-field')\n )}>\n <div\n className={classNames(\n textfieldStyles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': !!icon,\n 'is-hovered': isHovered,\n 'is-placeholder': isPlaceholder,\n 'is-disabled': isDisabled,\n 'is-quiet': isQuiet,\n 'is-focused': isFocused\n },\n classNames(searchStyles, 'spectrum-Search-input'),\n classNames(searchAutocompleteStyles, 'mobile-input')\n )}>\n {icon}\n <span id={valueId} className={classNames(searchAutocompleteStyles, 'mobile-value')}>\n {children}\n </span>\n </div>\n {validationState && !isDisabled ? validation : null}\n {(inputValue !== '' || validationState != null) && !isReadOnly && clearButton}\n </div>\n </div>\n );\n});\n\ninterface SearchAutocompleteTrayProps<T> extends SpectrumSearchAutocompleteProps<T> {\n state: ComboBoxState<T>;\n overlayProps: HTMLAttributes<HTMLElement>;\n loadingIndicator?: ReactElement;\n onClose: () => void;\n}\n\nfunction SearchAutocompleteTray<T>(props: SearchAutocompleteTrayProps<T>) {\n let searchIcon = <Magnifier data-testid=\"searchicon\" />;\n\n let {\n // completionMode = 'suggest',\n state,\n icon = searchIcon,\n isDisabled,\n validationState,\n label,\n overlayProps,\n loadingState,\n onLoadMore,\n onClose,\n onSubmit\n } = props;\n\n let timeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let [showLoading, setShowLoading] = useState(false);\n let inputRef = useRef<HTMLInputElement>(null);\n let popoverRef = useRef<HTMLDivElement>(null);\n let listBoxRef = useRef<HTMLDivElement>(null);\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n let layout = useListBoxLayout();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/autocomplete');\n\n let {inputProps, listBoxProps, labelProps, clearButtonProps} = useSearchAutocomplete<T>(\n {\n ...props,\n layoutDelegate: layout,\n popoverRef: popoverRef,\n listBoxRef,\n inputRef,\n // Handled outside the tray.\n name: undefined\n },\n state\n );\n\n React.useEffect(() => {\n if (inputRef.current) {\n focusSafely(inputRef.current);\n }\n }, []);\n\n React.useEffect(() => {\n // When the tray closes, set state.isFocused (i.e. the tray input's focus tracker) to false.\n // This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay\n // (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to \"contain\")\n // Have to do this manually since React doesn't call onBlur when a component is unmounted: https://github.com/facebook/react/issues/12363\n if (!state.isOpen && state.isFocused) {\n state.setFocused(false);\n }\n });\n\n let {dialogProps} = useDialog(\n {\n 'aria-labelledby': useId(labelProps.id)\n },\n popoverRef\n );\n\n // Override the role of the input to \"searchbox\" instead of \"combobox\".\n // Since the listbox is always visible, the combobox role doesn't really give us anything.\n // VoiceOver on iOS reads \"double tap to collapse\" when focused on the input rather than\n // \"double tap to edit text\", as with a textbox or searchbox. We'd like double tapping to\n // open the virtual keyboard rather than closing the tray.\n inputProps.role = 'searchbox';\n inputProps['aria-haspopup'] = 'listbox';\n delete inputProps.onTouchEnd;\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n aria-label={stringFormatter.format('clear')}\n excludeFromTabOrder\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\n );\n\n let loadingCircle = (\n <ProgressCircle\n aria-label={stringFormatter.format('loading')}\n size=\"S\"\n isIndeterminate\n UNSAFE_className={classNames(\n searchStyles,\n 'spectrum-Search-circleLoader',\n classNames(textfieldStyles, 'spectrum-Textfield-circleLoader')\n )}\n />\n );\n\n // Close the software keyboard on scroll to give the user a bigger area to scroll.\n // But only do this if scrolling with touch, otherwise it can cause issues with touch\n // screen readers.\n let isTouchDown = useRef(false);\n let onTouchStart = () => {\n isTouchDown.current = true;\n };\n\n let onTouchEnd = () => {\n isTouchDown.current = false;\n };\n\n let onScroll = useCallback(() => {\n if (!inputRef.current || getActiveElement() !== inputRef.current || !isTouchDown.current) {\n return;\n }\n\n if (popoverRef.current) {\n popoverRef.current.focus();\n }\n }, [inputRef, popoverRef, isTouchDown]);\n\n let inputValue = inputProps.value;\n let lastInputValue = useRef(inputValue);\n useEffect(() => {\n if (loadingState === 'filtering' && !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 (loadingState !== 'filtering') {\n // If loading is no longer happening, clear any timers and hide the loading circle\n setShowLoading(false);\n if (timeout.current !== null) {\n clearTimeout(timeout.current);\n timeout.current = null;\n }\n }\n\n lastInputValue.current = inputValue;\n }, [loadingState, inputValue, showLoading]);\n\n let onKeyDown = e => {\n // Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options\n if (e.key === 'Enter' && state.selectionManager.focusedKey == null) {\n popoverRef.current?.focus();\n if (onClose) {\n onClose();\n }\n if (onSubmit) {\n onSubmit(inputValue == null ? null : inputValue.toString(), null);\n }\n } else {\n if (inputProps.onKeyDown) {\n inputProps.onKeyDown(e);\n }\n }\n };\n\n if (icon) {\n icon = React.cloneElement(icon, {\n UNSAFE_className: classNames(textfieldStyles, 'spectrum-Textfield-icon'),\n size: 'S'\n });\n }\n\n return (\n <FocusScope restoreFocus contain>\n <div\n {...mergeProps(overlayProps, dialogProps)}\n ref={popoverRef}\n className={classNames(searchAutocompleteStyles, 'tray-dialog')}>\n <DismissButton onDismiss={onClose} />\n <TextFieldBase\n label={label}\n labelProps={labelProps}\n inputProps={{...inputProps, onKeyDown}}\n inputRef={inputRef}\n isDisabled={isDisabled}\n isLoading={showLoading && loadingState === 'filtering'}\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n validationState={validationState}\n wrapperChildren={\n (state.inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !props.isReadOnly\n ? clearButton\n : undefined\n }\n icon={icon}\n UNSAFE_className={classNames(\n searchStyles,\n 'spectrum-Search',\n 'spectrum-Textfield',\n 'spectrum-Search--loadable',\n {\n 'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,\n 'spectrum-Search--valid': validationState === 'valid' && !isDisabled\n },\n classNames(searchAutocompleteStyles, 'tray-textfield', {\n 'has-label': !!props.label\n })\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n />\n <ListBoxBase\n {...listBoxProps}\n domProps={{onTouchStart, onTouchEnd}}\n disallowEmptySelection\n shouldSelectOnPressUp\n focusOnPointerEnter\n layout={layout}\n state={state}\n shouldUseVirtualFocus\n renderEmptyState={() =>\n loadingState !== 'loading' && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n UNSAFE_className={classNames(searchAutocompleteStyles, 'tray-listbox')}\n ref={listBoxRef}\n onScroll={onScroll}\n onLoadMore={onLoadMore}\n isLoading={isLoading}\n />\n <DismissButton onDismiss={onClose} />\n </div>\n </FocusScope>\n );\n}\n"],"names":[],"version":3,"file":"MobileSearchAutocomplete.mjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GD,SAAS,yCACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE;IAErB,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,UACF,8DAA8D;IAC9D,qBAAO,0DAAC,CAAA,GAAA,kDAAuB;QAAG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;QACL,OAAO;QACP,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,uBACA;YACE,8BAA8B;YAC9B,eAAe;YACf,gCAAgC,oBAAoB,aAAa,CAAC;YAClE,cAAc;QAChB,GACA,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAuB,GAAG,uBACrC;qBAEF,0DAAC,CAAA,GAAA,uCAAY;QACV,GAAG,QAAQ;QACZ,YAAY;QACZ,UAAU;QACV,kBAAkB,CAAA,GAAA,oCAAS,EACzB,CAAA,GAAA,mDAAW,GACX,mBACA,6BACA,sBACA;YACE,eAAe;YACf,YAAY;YACZ,4BAA4B,oBAAoB,aAAa,CAAC;YAC9D,0BAA0B,oBAAoB,WAAW,CAAC;QAC5D,GACA,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAErB,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAW,GAAG;QACzC,yBAAyB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAW,GAAG;QAClD,YAAY;QACZ,SAAS;QACT,iBAAiB;QACjB,WACE,eAAgB,CAAA,UAAU,gBAAgB,YAAY,iBAAiB,SAAQ;QAEjF,kBAAkB,gBAAgB,OAAO,gBAAgB;QACzD,MAAM;QACN,iBACE,AAAC,CAAA,eAAe,MAAM,iBAAiB,eAAe,mBAAmB,IAAG,KAC5E,CAAC,aACG,cACA;QAEN,kBAAA;;AAKV;AAEA,IAAI,8DAA0B,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;AAI/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 {\n AriaSearchAutocompleteProps,\n useSearchAutocomplete\n} from 'react-aria/private/autocomplete/useSearchAutocomplete';\nimport {\n AsyncLoadable,\n DimensionValue,\n DOMRefValue,\n FocusableRef,\n LoadingState,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} 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>\n extends\n SpectrumTextInputBase,\n Omit<\n AriaSearchAutocompleteProps<T>,\n 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * The interaction required to display the SearchAutocomplete menu. Note that this prop has no\n * effect on the mobile SearchAutocomplete experience.\n *\n * @default 'input'\n */\n menuTrigger?: MenuTriggerAction;\n /** Whether the SearchAutocomplete should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end';\n /**\n * Direction the menu will render relative to the SearchAutocomplete.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top';\n /**\n * The current loading state of the SearchAutocomplete. Determines whether or not the progress\n * circle should be shown.\n */\n loadingState?: LoadingState;\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean;\n /**\n * Width of the menu. By default, matches width of the trigger. Note that the minimum width of the\n * dropdown is always equal to the trigger's width.\n */\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead.'\n );\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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 ...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 let layout = useListBoxLayout();\n\n let {\n inputProps,\n listBoxProps,\n labelProps,\n clearButtonProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n } = 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\n ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))`\n : 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 />\n </Field>\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {\n 'spectrum-InputGroup-popover--quiet': isQuiet\n })}\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={() =>\n isAsync && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n />\n </Popover>\n </>\n );\n}\n\nlet SearchAutocompleteBase = React.forwardRef(ForwardSearchAutocompleteBase) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\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 = <Magnifier data-testid=\"searchicon\" />;\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(styles, 'spectrum-InputGroup-input-circleLoader'),\n classNames(searchStyles, 'spectrum-Search-circleLoader')\n )}\n />\n );\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\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={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(searchAutocompleteStyles, 'searchautocomplete'),\n className\n )}>\n <TextFieldBase\n {...domProps}\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={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(styles, 'spectrum-InputGroup-field')\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n isLoading={\n showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')\n }\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n icon={icon}\n wrapperChildren={\n (inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !isReadOnly\n ? clearButton\n : undefined\n }\n disableFocusRing\n />\n </div>\n </FocusRing>\n );\n}\n\nlet SearchAutocompleteInput = React.forwardRef(ForwardSearchAutocompleteInput) as <T>(\n props: SearchAutocompleteInputProps<T> & {ref?: any}\n) => ReactElement;\n\n/**\n * A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.\n */\nlet ForwardSearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\nexport {ForwardSearchAutocomplete as SearchAutocomplete};\n"],"names":[],"version":3,"file":"SearchAutocomplete.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4GD,SAAS,yCACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE;IAErB,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,UACF,8DAA8D;IAC9D,qBAAO,0DAAC,CAAA,GAAA,kDAAuB;QAAG,GAAG,KAAK;QAAE,aAAY;QAAQ,KAAK;;SAErE,qBAAO,0DAAC;QAAwB,GAAG,KAAK;QAAE,KAAK;;AAEnD;AAEA,SAAS,oDACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,0CAAe,EAAE;IAEzB,IAAI,eACF,cAAc,qBACd,aAAa,iBACb,YAAY,iBAC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AAC,CAAA,GAAA,uCAAY;QACV,GAAG,QAAQ;QACZ,YAAY;QACZ,UAAU;QACV,kBAAkB,CAAA,GAAA,oCAAS,EACzB,CAAA,GAAA,mDAAW,GACX,mBACA,6BACA,sBACA;YACE,eAAe;YACf,YAAY;YACZ,4BAA4B,oBAAoB,aAAa,CAAC;YAC9D,0BAA0B,oBAAoB,WAAW,CAAC;QAC5D,GACA,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAErB,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAW,GAAG;QACzC,yBAAyB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAW,GAAG;QAClD,YAAY;QACZ,SAAS;QACT,iBAAiB;QACjB,WACE,eAAgB,CAAA,UAAU,gBAAgB,YAAY,iBAAiB,SAAQ;QAEjF,kBAAkB,gBAAgB,OAAO,gBAAgB;QACzD,MAAM;QACN,iBACE,AAAC,CAAA,eAAe,MAAM,iBAAiB,eAAe,mBAAmB,IAAG,KAC5E,CAAC,aACG,cACA;QAEN,kBAAA;;AAKV;AAEA,IAAI,8DAA0B,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;AAI/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';\nimport {\n AriaSearchAutocompleteProps,\n useSearchAutocomplete\n} from 'react-aria/private/autocomplete/useSearchAutocomplete';\nimport {\n AsyncLoadable,\n DimensionValue,\n DOMRefValue,\n FocusableRef,\n LoadingState,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} 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';\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>\n extends\n SpectrumTextInputBase,\n Omit<\n AriaSearchAutocompleteProps<T>,\n 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * The interaction required to display the SearchAutocomplete menu. Note that this prop has no\n * effect on the mobile SearchAutocomplete experience.\n *\n * @default 'input'\n */\n menuTrigger?: MenuTriggerAction;\n /** Whether the SearchAutocomplete should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end';\n /**\n * Direction the menu will render relative to the SearchAutocomplete.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top';\n /**\n * The current loading state of the SearchAutocomplete. Determines whether or not the progress\n * circle should be shown.\n */\n loadingState?: LoadingState;\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean;\n /**\n * Width of the menu. By default, matches width of the trigger. Note that the minimum width of the\n * dropdown is always equal to the trigger's width.\n */\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead.'\n );\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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 ...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 let layout = useListBoxLayout();\n\n let {\n inputProps,\n listBoxProps,\n labelProps,\n clearButtonProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n } = 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\n ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))`\n : 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 />\n </Field>\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {\n 'spectrum-InputGroup-popover--quiet': isQuiet\n })}\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={() =>\n isAsync && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n />\n </Popover>\n </>\n );\n}\n\nlet SearchAutocompleteBase = React.forwardRef(ForwardSearchAutocompleteBase) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\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 = <Magnifier data-testid=\"searchicon\" />;\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(styles, 'spectrum-InputGroup-input-circleLoader'),\n classNames(searchStyles, 'spectrum-Search-circleLoader')\n )}\n />\n );\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\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={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(searchAutocompleteStyles, 'searchautocomplete'),\n className\n )}>\n <TextFieldBase\n {...domProps}\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={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(styles, 'spectrum-InputGroup-field')\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n isLoading={\n showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')\n }\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n icon={icon}\n wrapperChildren={\n (inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !isReadOnly\n ? clearButton\n : undefined\n }\n disableFocusRing\n />\n </div>\n </FocusRing>\n );\n}\n\nlet SearchAutocompleteInput = React.forwardRef(ForwardSearchAutocompleteInput) as <T>(\n props: SearchAutocompleteInputProps<T> & {ref?: any}\n) => ReactElement;\n\n/**\n * A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.\n */\nlet ForwardSearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\nexport {ForwardSearchAutocomplete as SearchAutocomplete};\n"],"names":[],"version":3,"file":"SearchAutocomplete.cjs.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GD,SAAS,yCACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IAErB,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,WAAW,CAAA,GAAA,yCAAgB;IAC/B,IAAI,UACF,8DAA8D;IAC9D,qBAAO,gCAAC,CAAA,GAAA,yCAAuB;QAAG,GAAG,KAAK;QAAE,aAAY;QAAQ,KAAK;;SAErE,qBAAO,gCAAC;QAAwB,GAAG,KAAK;QAAE,KAAK;;AAEnD;AAEA,SAAS,oDACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IAEzB,IAAI,eACF,cAAc,qBACd,aAAa,iBACb,YAAY,iBACZ,QAAQ,kBACR,OAAO,EACP,WAAW,eAAe,gBAC1B,YAAY,cACZ,UAAU,YACV,WAAW,KAAO,aAClB,QAAQ,EACT,GAAG;IAEJ,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,8CAAW,GAAG;IAChE,IAAI,UAAU,gBAAgB;IAC9B,IAAI,aAAa,CAAA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B,aAAa,CAAC;YAC9D,0BAA0B,oBAAoB,WAAW,CAAC;QAC5D,GACA,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,uDAAK,GAAG;QAErB,gBAAgB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAW,GAAG;QACzC,yBAAyB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,mDAAW,GAAG;QAClD,YAAY;QACZ,SAAS;QACT,iBAAiB;QACjB,WACE,eAAgB,CAAA,UAAU,gBAAgB,YAAY,iBAAiB,SAAQ;QAEjF,kBAAkB,gBAAgB,OAAO,gBAAgB;QACzD,MAAM;QACN,iBACE,AAAC,CAAA,eAAe,MAAM,iBAAiB,eAAe,mBAAmB,IAAG,KAC5E,CAAC,aACG,cACA;QAEN,kBAAA;;AAKV;AAEA,IAAI,8DAA0B,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;AAI/C;;CAEC,GACD,IAAI,0DAA4B,CAAA,GAAA,iBAAS,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 {\n AriaSearchAutocompleteProps,\n useSearchAutocomplete\n} from 'react-aria/private/autocomplete/useSearchAutocomplete';\nimport {\n AsyncLoadable,\n DimensionValue,\n DOMRefValue,\n FocusableRef,\n LoadingState,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} 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>\n extends\n SpectrumTextInputBase,\n Omit<\n AriaSearchAutocompleteProps<T>,\n 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * The interaction required to display the SearchAutocomplete menu. Note that this prop has no\n * effect on the mobile SearchAutocomplete experience.\n *\n * @default 'input'\n */\n menuTrigger?: MenuTriggerAction;\n /** Whether the SearchAutocomplete should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end';\n /**\n * Direction the menu will render relative to the SearchAutocomplete.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top';\n /**\n * The current loading state of the SearchAutocomplete. Determines whether or not the progress\n * circle should be shown.\n */\n loadingState?: LoadingState;\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean;\n /**\n * Width of the menu. By default, matches width of the trigger. Note that the minimum width of the\n * dropdown is always equal to the trigger's width.\n */\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead.'\n );\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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 ...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 let layout = useListBoxLayout();\n\n let {\n inputProps,\n listBoxProps,\n labelProps,\n clearButtonProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n } = 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\n ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))`\n : 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 />\n </Field>\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {\n 'spectrum-InputGroup-popover--quiet': isQuiet\n })}\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={() =>\n isAsync && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n />\n </Popover>\n </>\n );\n}\n\nlet SearchAutocompleteBase = React.forwardRef(ForwardSearchAutocompleteBase) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\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 = <Magnifier data-testid=\"searchicon\" />;\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(styles, 'spectrum-InputGroup-input-circleLoader'),\n classNames(searchStyles, 'spectrum-Search-circleLoader')\n )}\n />\n );\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\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={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(searchAutocompleteStyles, 'searchautocomplete'),\n className\n )}>\n <TextFieldBase\n {...domProps}\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={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(styles, 'spectrum-InputGroup-field')\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n isLoading={\n showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')\n }\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n icon={icon}\n wrapperChildren={\n (inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !isReadOnly\n ? clearButton\n : undefined\n }\n disableFocusRing\n />\n </div>\n </FocusRing>\n );\n}\n\nlet SearchAutocompleteInput = React.forwardRef(ForwardSearchAutocompleteInput) as <T>(\n props: SearchAutocompleteInputProps<T> & {ref?: any}\n) => ReactElement;\n\n/**\n * A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.\n */\nlet ForwardSearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\nexport {ForwardSearchAutocomplete as SearchAutocomplete};\n"],"names":[],"version":3,"file":"SearchAutocomplete.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;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AAA,yCAAS,EAAE,CAAA,GAAA,mDAAW,GAAG;QAClD,YAAY;QACZ,SAAS;QACT,iBAAiB;QACjB,WACE,eAAgB,CAAA,UAAU,gBAAgB,YAAY,iBAAiB,SAAQ;QAEjF,kBAAkB,gBAAgB,OAAO,gBAAgB;QACzD,MAAM;QACN,iBACE,AAAC,CAAA,eAAe,MAAM,iBAAiB,eAAe,mBAAmB,IAAG,KAC5E,CAAC,aACG,cACA;QAEN,kBAAA;;AAKV;AAEA,IAAI,8DAA0B,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;AAI/C;;CAEC,GACD,IAAI,0DAA4B,CAAA,GAAA,iBAAS,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';\nimport {\n AriaSearchAutocompleteProps,\n useSearchAutocomplete\n} from 'react-aria/private/autocomplete/useSearchAutocomplete';\nimport {\n AsyncLoadable,\n DimensionValue,\n DOMRefValue,\n FocusableRef,\n LoadingState,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} 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';\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>\n extends\n SpectrumTextInputBase,\n Omit<\n AriaSearchAutocompleteProps<T>,\n 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * The interaction required to display the SearchAutocomplete menu. Note that this prop has no\n * effect on the mobile SearchAutocomplete experience.\n *\n * @default 'input'\n */\n menuTrigger?: MenuTriggerAction;\n /** Whether the SearchAutocomplete should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end';\n /**\n * Direction the menu will render relative to the SearchAutocomplete.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top';\n /**\n * The current loading state of the SearchAutocomplete. Determines whether or not the progress\n * circle should be shown.\n */\n loadingState?: LoadingState;\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean;\n /**\n * Width of the menu. By default, matches width of the trigger. Note that the minimum width of the\n * dropdown is always equal to the trigger's width.\n */\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead.'\n );\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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 ...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 let layout = useListBoxLayout();\n\n let {\n inputProps,\n listBoxProps,\n labelProps,\n clearButtonProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n } = 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\n ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))`\n : 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 />\n </Field>\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {\n 'spectrum-InputGroup-popover--quiet': isQuiet\n })}\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={() =>\n isAsync && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n />\n </Popover>\n </>\n );\n}\n\nlet SearchAutocompleteBase = React.forwardRef(ForwardSearchAutocompleteBase) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\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 = <Magnifier data-testid=\"searchicon\" />;\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(styles, 'spectrum-InputGroup-input-circleLoader'),\n classNames(searchStyles, 'spectrum-Search-circleLoader')\n )}\n />\n );\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\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={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(searchAutocompleteStyles, 'searchautocomplete'),\n className\n )}>\n <TextFieldBase\n {...domProps}\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={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(styles, 'spectrum-InputGroup-field')\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n isLoading={\n showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')\n }\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n icon={icon}\n wrapperChildren={\n (inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !isReadOnly\n ? clearButton\n : undefined\n }\n disableFocusRing\n />\n </div>\n </FocusRing>\n );\n}\n\nlet SearchAutocompleteInput = React.forwardRef(ForwardSearchAutocompleteInput) as <T>(\n props: SearchAutocompleteInputProps<T> & {ref?: any}\n) => ReactElement;\n\n/**\n * A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.\n */\nlet ForwardSearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\nexport {ForwardSearchAutocomplete as SearchAutocomplete};\n"],"names":[],"version":3,"file":"SearchAutocomplete.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GD,SAAS,yCACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yC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B,IAAG,KAC5E,CAAC,aACG,cACA;QAEN,kBAAA;;AAKV;AAEA,IAAI,8DAA0B,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;AAI/C;;CAEC,GACD,IAAI,0DAA4B,CAAA,GAAA,iBAAS,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 {\n AriaSearchAutocompleteProps,\n useSearchAutocomplete\n} from 'react-aria/private/autocomplete/useSearchAutocomplete';\nimport {\n AsyncLoadable,\n DimensionValue,\n DOMRefValue,\n FocusableRef,\n LoadingState,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} 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>\n extends\n SpectrumTextInputBase,\n Omit<\n AriaSearchAutocompleteProps<T>,\n 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * The interaction required to display the SearchAutocomplete menu. Note that this prop has no\n * effect on the mobile SearchAutocomplete experience.\n *\n * @default 'input'\n */\n menuTrigger?: MenuTriggerAction;\n /** Whether the SearchAutocomplete should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end';\n /**\n * Direction the menu will render relative to the SearchAutocomplete.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top';\n /**\n * The current loading state of the SearchAutocomplete. Determines whether or not the progress\n * circle should be shown.\n */\n loadingState?: LoadingState;\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean;\n /**\n * Width of the menu. By default, matches width of the trigger. Note that the minimum width of the\n * dropdown is always equal to the trigger's width.\n */\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead.'\n );\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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 ...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 let layout = useListBoxLayout();\n\n let {\n inputProps,\n listBoxProps,\n labelProps,\n clearButtonProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n } = 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\n ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))`\n : 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 />\n </Field>\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {\n 'spectrum-InputGroup-popover--quiet': isQuiet\n })}\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={() =>\n isAsync && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n />\n </Popover>\n </>\n );\n}\n\nlet SearchAutocompleteBase = React.forwardRef(ForwardSearchAutocompleteBase) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\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 = <Magnifier data-testid=\"searchicon\" />;\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(styles, 'spectrum-InputGroup-input-circleLoader'),\n classNames(searchStyles, 'spectrum-Search-circleLoader')\n )}\n />\n );\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\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={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(searchAutocompleteStyles, 'searchautocomplete'),\n className\n )}>\n <TextFieldBase\n {...domProps}\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={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(styles, 'spectrum-InputGroup-field')\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n isLoading={\n showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')\n }\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n icon={icon}\n wrapperChildren={\n (inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !isReadOnly\n ? clearButton\n : undefined\n }\n disableFocusRing\n />\n </div>\n </FocusRing>\n );\n}\n\nlet SearchAutocompleteInput = React.forwardRef(ForwardSearchAutocompleteInput) as <T>(\n props: SearchAutocompleteInputProps<T> & {ref?: any}\n) => ReactElement;\n\n/**\n * A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.\n */\nlet ForwardSearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\nexport {ForwardSearchAutocomplete as SearchAutocomplete};\n"],"names":[],"version":3,"file":"SearchAutocomplete.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4GD,SAAS,yCACP,KAAyC,EACzC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,yCAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,yCAAW,EAAE;IAErB,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CACV;YAEF,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAA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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';\nimport {\n AriaSearchAutocompleteProps,\n useSearchAutocomplete\n} from 'react-aria/private/autocomplete/useSearchAutocomplete';\nimport {\n AsyncLoadable,\n DimensionValue,\n DOMRefValue,\n FocusableRef,\n LoadingState,\n SpectrumFieldValidation,\n SpectrumLabelableProps,\n SpectrumTextInputBase,\n StyleProps\n} 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';\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>\n extends\n SpectrumTextInputBase,\n Omit<\n AriaSearchAutocompleteProps<T>,\n 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'\n >,\n SpectrumFieldValidation<string>,\n SpectrumLabelableProps,\n StyleProps,\n Omit<AsyncLoadable, 'isLoading'> {\n /**\n * The interaction required to display the SearchAutocomplete menu. Note that this prop has no\n * effect on the mobile SearchAutocomplete experience.\n *\n * @default 'input'\n */\n menuTrigger?: MenuTriggerAction;\n /** Whether the SearchAutocomplete should be displayed with a quiet style. */\n isQuiet?: boolean;\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end';\n /**\n * Direction the menu will render relative to the SearchAutocomplete.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top';\n /**\n * The current loading state of the SearchAutocomplete. Determines whether or not the progress\n * circle should be shown.\n */\n loadingState?: LoadingState;\n /**\n * Whether the menu should automatically flip direction when space is limited.\n *\n * @default true\n */\n shouldFlip?: boolean;\n /**\n * Width of the menu. By default, matches width of the trigger. Note that the minimum width of the\n * dropdown is always equal to the trigger's width.\n */\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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(\n 'Placeholders are deprecated due to accessibility issues. Please use help text instead.'\n );\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>(\n props: SpectrumSearchAutocompleteProps<T>,\n ref: FocusableRef<HTMLElement>\n) {\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 ...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 let layout = useListBoxLayout();\n\n let {\n inputProps,\n listBoxProps,\n labelProps,\n clearButtonProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n } = 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\n ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))`\n : 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 />\n </Field>\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {\n 'spectrum-InputGroup-popover--quiet': isQuiet\n })}\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={() =>\n isAsync && (\n <span className={classNames(searchAutocompleteStyles, 'no-results')}>\n {stringFormatter.format('noResults')}\n </span>\n )\n }\n />\n </Popover>\n </>\n );\n}\n\nlet SearchAutocompleteBase = React.forwardRef(ForwardSearchAutocompleteBase) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\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 = <Magnifier data-testid=\"searchicon\" />;\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(styles, 'spectrum-InputGroup-input-circleLoader'),\n classNames(searchStyles, 'spectrum-Search-circleLoader')\n )}\n />\n );\n\n let clearButton = (\n <ClearButton\n {...clearButtonProps}\n preventFocus\n UNSAFE_className={classNames(searchStyles, 'spectrum-ClearButton')}\n isDisabled={isDisabled}\n />\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={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(searchAutocompleteStyles, 'searchautocomplete'),\n className\n )}>\n <TextFieldBase\n {...domProps}\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={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(styles, 'spectrum-InputGroup-field')\n )}\n inputClassName={classNames(searchStyles, 'spectrum-Search-input')}\n validationIconClassName={classNames(searchStyles, 'spectrum-Search-validationIcon')}\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n isLoading={\n showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')\n }\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n icon={icon}\n wrapperChildren={\n (inputValue !== '' || loadingState === 'filtering' || validationState != null) &&\n !isReadOnly\n ? clearButton\n : undefined\n }\n disableFocusRing\n />\n </div>\n </FocusRing>\n );\n}\n\nlet SearchAutocompleteInput = React.forwardRef(ForwardSearchAutocompleteInput) as <T>(\n props: SearchAutocompleteInputProps<T> & {ref?: any}\n) => ReactElement;\n\n/**\n * A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.\n */\nlet ForwardSearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(\n props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\nexport {ForwardSearchAutocomplete as SearchAutocomplete};\n"],"names":[],"version":3,"file":"SearchAutocomplete.mjs.map"}
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
margin-bottom: var(--spectrum-global-dimension-size-50);
|
|
39
39
|
flex-shrink: 0;
|
|
40
40
|
width: initial !important;
|
|
41
|
-
}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
42
|
+
&.-qgzQa_has-label {
|
|
43
|
+
margin-top: var(--spectrum-global-dimension-size-50);
|
|
44
|
+
}
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
& .-qgzQa_tray-textfield-input {
|
|
47
|
+
padding-inline-start: var(--spectrum-textfield-padding-x, var(--spectrum-global-dimension-size-150));
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.-qgzQa_tray-listbox {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAYA;;;;;;;;AAcA;;;;;AAKA;;;;AAIA;;;;;AAKA;;;;;;AAMA;;;;;;;AAOA
|
|
1
|
+
{"mappings":"AAYA;;;;;;;;AAcA;;;;;AAKA;;;;AAIA;;;;;AAKA;;;;;;AAMA;;;;;;;AAOA;;;;;;EAME;;;;EAIA;;;;;AAKF","sources":["packages/@adobe/react-spectrum/src/autocomplete/searchautocomplete.css"],"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\n.no-results {\n display: block;\n /*\n Renamed from padding-y to padding-height to fix docs issue where fallback var replaced this value\n (due to old spectrum-css postcss-custom-properties-custom-mapping plugin).\n */\n padding-top: var(--spectrum-selectlist-option-padding-height);\n padding-inline-start: var(--spectrum-selectlist-option-padding);\n font-size: var(--spectrum-selectlist-option-text-size);\n font-weight: var(--spectrum-selectlist-option-text-font-weight);\n}\n\n/* override .spectrum-InputGroup */\n.searchautocomplete.searchautocomplete {\n border-radius: var(--spectrum-search-border-radius);\n --spectrum-focus-ring-border-radius: var(--spectrum-search-border-radius);\n}\n\n.mobile-searchautocomplete {\n outline: none;\n}\n\n.mobile-input {\n display: flex;\n align-items: center;\n}\n\n.mobile-value {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.tray-dialog {\n display: flex;\n flex-direction: column;\n height: 100%;\n outline: none;\n}\n\n.tray-textfield {\n margin: var(--spectrum-global-dimension-size-150);\n margin-bottom: var(--spectrum-global-dimension-size-50);\n flex-shrink: 0;\n width: initial !important;\n\n &.has-label {\n margin-top: var(--spectrum-global-dimension-size-50);\n }\n\n .tray-textfield-input {\n padding-inline-start: var(--spectrum-textfield-padding-x);\n }\n}\n\n.tray-listbox {\n width: 100%;\n flex: 1;\n}\n"],"names":[],"version":3,"file":"searchautocomplete.css.map"}
|
|
@@ -5,20 +5,25 @@
|
|
|
5
5
|
-webkit-user-drag: none;
|
|
6
6
|
-webkit-user-select: none;
|
|
7
7
|
user-select: none;
|
|
8
|
+
border-style: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.jilAbW_spectrum-Avatar {
|
|
8
12
|
opacity: var(--spectrum-avatar-small-opacity, 1);
|
|
9
13
|
transition: box-shadow var(--spectrum-global-animation-duration-100, .13s) ease-out;
|
|
10
|
-
border-style: none;
|
|
11
14
|
outline: none;
|
|
12
|
-
}
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
&.jilAbW_is-disabled {
|
|
17
|
+
opacity: var(--spectrum-avatar-small-opacity-disabled, .3);
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
@media (forced-colors: active) {
|
|
19
|
-
.jilAbW_spectrum-Avatar
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
.jilAbW_spectrum-Avatar {
|
|
23
|
+
&.jilAbW_is-disabled {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
border: 2px solid graytext;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
/*# sourceMappingURL=avatar_vars.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAwBA
|
|
1
|
+
{"mappings":"AAwBA;;;;;;;;;;AAuBA;;;;;EAKE;;;;;AAKF;EACE;IACE","sources":["packages/@adobe/spectrum-css-temp/components/avatar/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"avatar_vars.css.map"}
|