react-aria-components
Version:
A library of styleable components built using React Aria
68 lines (59 loc) • 3.38 kB
JavaScript
import {FieldInputContext as $4e85f108e88277b8$export$698f465ec27e93df, SelectableCollectionContext as $4e85f108e88277b8$export$b0d3ecf7112093a7} from "./RSPContexts.module.js";
import {Provider as $64fa3d84918910a7$export$2881499e37b75b9a, removeDataAttributes as $64fa3d84918910a7$export$ef03459518577ad4, useSlottedContext as $64fa3d84918910a7$export$fabf2dc03a41866e} from "./utils.module.js";
import {useAutocomplete as $llkzs$useAutocomplete} from "@react-aria/autocomplete";
import {useAutocompleteState as $llkzs$useAutocompleteState} from "@react-stately/autocomplete";
import {mergeProps as $llkzs$mergeProps} from "@react-aria/utils";
import $llkzs$react, {createContext as $llkzs$createContext, useRef as $llkzs$useRef} from "react";
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $d2f53cda644affe3$export$36e687af51cd0967 = /*#__PURE__*/ (0, $llkzs$createContext)(null);
const $d2f53cda644affe3$export$68ee3368b6d68148 = /*#__PURE__*/ (0, $llkzs$createContext)(null);
function $d2f53cda644affe3$export$2f2b9559550c7bbc(props) {
let ctx = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)($d2f53cda644affe3$export$36e687af51cd0967, props.slot);
props = (0, $llkzs$mergeProps)(ctx, props);
let { filter: filter, disableAutoFocusFirst: disableAutoFocusFirst } = props;
let state = (0, $llkzs$useAutocompleteState)(props);
let inputRef = (0, $llkzs$useRef)(null);
let collectionRef = (0, $llkzs$useRef)(null);
let { inputProps: inputProps, collectionProps: collectionProps, collectionRef: mergedCollectionRef, filter: filterFn } = (0, $llkzs$useAutocomplete)({
...(0, $64fa3d84918910a7$export$ef03459518577ad4)(props),
filter: filter,
disableAutoFocusFirst: disableAutoFocusFirst,
inputRef: inputRef,
collectionRef: collectionRef
}, state);
return /*#__PURE__*/ (0, $llkzs$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
values: [
[
$d2f53cda644affe3$export$68ee3368b6d68148,
state
],
[
(0, $4e85f108e88277b8$export$698f465ec27e93df),
{
...inputProps,
ref: inputRef
}
],
[
(0, $4e85f108e88277b8$export$b0d3ecf7112093a7),
{
...collectionProps,
filter: filterFn,
ref: mergedCollectionRef
}
]
]
}, props.children);
}
export {$d2f53cda644affe3$export$36e687af51cd0967 as AutocompleteContext, $d2f53cda644affe3$export$68ee3368b6d68148 as AutocompleteStateContext, $d2f53cda644affe3$export$2f2b9559550c7bbc as Autocomplete};
//# sourceMappingURL=Autocomplete.module.js.map