react-aria-components
Version:
A library of styleable components built using React Aria
80 lines (69 loc) • 3.9 kB
JavaScript
import {InputContext as $3985021b0ad6602f$export$37fb8590cf2c088c} from "./Input.mjs";
import {Provider as $64fa3d84918910a7$export$2881499e37b75b9a, removeDataAttributes as $64fa3d84918910a7$export$ef03459518577ad4, useSlottedContext as $64fa3d84918910a7$export$fabf2dc03a41866e} from "./utils.mjs";
import {SearchFieldContext as $440f4836bcb56932$export$d1c4e4c63cb03a11} from "./SearchField.mjs";
import {TextFieldContext as $bcdf0525bf22703d$export$2129e27b3ef0d483} from "./TextField.mjs";
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);
const $d2f53cda644affe3$export$65d2a03b8800d6e3 = /*#__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 { textFieldProps: textFieldProps, 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, $440f4836bcb56932$export$d1c4e4c63cb03a11),
textFieldProps
],
[
(0, $bcdf0525bf22703d$export$2129e27b3ef0d483),
textFieldProps
],
[
(0, $3985021b0ad6602f$export$37fb8590cf2c088c),
{
ref: inputRef
}
],
[
$d2f53cda644affe3$export$65d2a03b8800d6e3,
{
filter: filterFn,
collectionProps: collectionProps,
collectionRef: mergedCollectionRef
}
]
]
}, props.children);
}
export {$d2f53cda644affe3$export$36e687af51cd0967 as AutocompleteContext, $d2f53cda644affe3$export$68ee3368b6d68148 as AutocompleteStateContext, $d2f53cda644affe3$export$65d2a03b8800d6e3 as UNSTABLE_InternalAutocompleteContext, $d2f53cda644affe3$export$2f2b9559550c7bbc as Autocomplete};
//# sourceMappingURL=Autocomplete.module.js.map