@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
29 lines • 1.87 kB
JavaScript
import { __rest } from "tslib";
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React, { useRef } from 'react';
import { warnOnce } from '@awsui/component-toolkit/internal';
import useForwardFocus from '../internal/hooks/forward-focus';
import useBaseComponent from '../internal/hooks/use-base-component';
import { isDevelopment } from '../internal/is-development';
import { applyDisplayName } from '../internal/utils/apply-display-name';
import { getExternalProps } from '../internal/utils/external-props';
import InternalPopover from './internal';
const Popover = React.forwardRef((_a, ref) => {
var { position = 'right', size = 'medium', fixedWidth = false, triggerType = 'text', dismissButton = true, renderWithPortal = false, wrapTriggerText = true, header } = _a, rest = __rest(_a, ["position", "size", "fixedWidth", "triggerType", "dismissButton", "renderWithPortal", "wrapTriggerText", "header"]);
if (isDevelopment) {
if (dismissButton && !header) {
warnOnce('Popover', `You should provide a \`header\` when \`dismissButton\` is true.`);
}
}
const baseComponentProps = useBaseComponent('Popover', {
props: { dismissButton, fixedWidth, position, renderWithPortal, size, triggerType },
});
const externalProps = getExternalProps(rest);
const internalRef = useRef(null);
useForwardFocus(ref, internalRef);
return (React.createElement(InternalPopover, Object.assign({ ref: internalRef, header: header, position: position, size: size, fixedWidth: fixedWidth, triggerType: triggerType, dismissButton: dismissButton, renderWithPortal: renderWithPortal, wrapTriggerText: wrapTriggerText }, externalProps, baseComponentProps)));
});
applyDisplayName(Popover, 'Popover');
export default Popover;
//# sourceMappingURL=index.js.map