react-aria-components
Version:
A library of styleable components built using React Aria
79 lines (67 loc) • 3.45 kB
JavaScript
var $525402dfec7da5bc$exports = require("./RSPContexts.main.js");
var $c5ccf687772c0422$exports = require("./utils.main.js");
var $5lGAV$reactariaautocomplete = require("@react-aria/autocomplete");
var $5lGAV$reactstatelyautocomplete = require("@react-stately/autocomplete");
var $5lGAV$reactariautils = require("@react-aria/utils");
var $5lGAV$react = require("react");
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "AutocompleteContext", () => $33f48720060787fa$export$36e687af51cd0967);
$parcel$export(module.exports, "AutocompleteStateContext", () => $33f48720060787fa$export$68ee3368b6d68148);
$parcel$export(module.exports, "Autocomplete", () => $33f48720060787fa$export$2f2b9559550c7bbc);
/*
* 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 $33f48720060787fa$export$36e687af51cd0967 = /*#__PURE__*/ (0, $5lGAV$react.createContext)(null);
const $33f48720060787fa$export$68ee3368b6d68148 = /*#__PURE__*/ (0, $5lGAV$react.createContext)(null);
function $33f48720060787fa$export$2f2b9559550c7bbc(props) {
let ctx = (0, $c5ccf687772c0422$exports.useSlottedContext)($33f48720060787fa$export$36e687af51cd0967, props.slot);
props = (0, $5lGAV$reactariautils.mergeProps)(ctx, props);
let { filter: filter, disableAutoFocusFirst: disableAutoFocusFirst } = props;
let state = (0, $5lGAV$reactstatelyautocomplete.useAutocompleteState)(props);
let inputRef = (0, $5lGAV$react.useRef)(null);
let collectionRef = (0, $5lGAV$react.useRef)(null);
let { inputProps: inputProps, collectionProps: collectionProps, collectionRef: mergedCollectionRef, filter: filterFn } = (0, $5lGAV$reactariaautocomplete.useAutocomplete)({
...(0, $c5ccf687772c0422$exports.removeDataAttributes)(props),
filter: filter,
disableAutoFocusFirst: disableAutoFocusFirst,
inputRef: inputRef,
collectionRef: collectionRef
}, state);
return /*#__PURE__*/ (0, ($parcel$interopDefault($5lGAV$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
values: [
[
$33f48720060787fa$export$68ee3368b6d68148,
state
],
[
(0, $525402dfec7da5bc$exports.FieldInputContext),
{
...inputProps,
ref: inputRef
}
],
[
(0, $525402dfec7da5bc$exports.SelectableCollectionContext),
{
...collectionProps,
filter: filterFn,
ref: mergedCollectionRef
}
]
]
}, props.children);
}
//# sourceMappingURL=Autocomplete.main.js.map