@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
20 lines • 1.05 kB
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React, { useImperativeHandle, useRef } from 'react';
import InternalLiveRegion from '../live-region/internal';
import styles from './styles.css.js';
// Debounce delay for live region (based on testing with VoiceOver)
const LIVE_REGION_DELAY = 2000;
export const SearchResults = React.forwardRef(({ id, renderLiveRegion, children }, ref) => {
const liveRegionRef = useRef(null);
useImperativeHandle(ref, () => ({
reannounce: () => {
var _a;
(_a = liveRegionRef.current) === null || _a === void 0 ? void 0 : _a.reannounce();
},
}), []);
return (React.createElement(React.Fragment, null,
React.createElement("span", { className: styles.results, id: id }, children),
renderLiveRegion && (React.createElement(InternalLiveRegion, { delay: LIVE_REGION_DELAY, tagName: "span", hidden: true, ref: liveRegionRef }, children))));
});
//# sourceMappingURL=search-results.js.map