| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; |
| 3 |
import { css } from '@patternfly/react-styles'; |
| 4 |
import backgroundImage from '@patternfly/react-tokens/dist/esm/c_about_modal_box_BackgroundImage'; |
| 5 |
import { AboutModalBoxContent } from './AboutModalBoxContent'; |
| 6 |
import { AboutModalBoxHeader } from './AboutModalBoxHeader'; |
| 7 |
import { AboutModalBoxBrand } from './AboutModalBoxBrand'; |
| 8 |
import { AboutModalBoxCloseButton } from './AboutModalBoxCloseButton'; |
| 9 |
import { AboutModalBox } from './AboutModalBox'; |
| 10 |
import { Modal, ModalVariant } from '../Modal'; |
| 11 |
import { useSSRSafeId } from '../../helpers'; |
| 12 |
export const AboutModal = (_a) => { |
| 13 |
var { children, className, isOpen = false, onClose = (_e) => undefined, productName, trademark, backgroundImageSrc, brandImageSrc, brandImageAlt, hasNoContentContainer = false, appendTo, closeButtonAriaLabel, 'aria-label': ariaLabel, disableFocusTrap } = _a, props = __rest(_a, ["children", "className", "isOpen", "onClose", "productName", "trademark", "backgroundImageSrc", "brandImageSrc", "brandImageAlt", "hasNoContentContainer", "appendTo", "closeButtonAriaLabel", 'aria-label', "disableFocusTrap"]); |
| 14 |
const ariaLabelledBy = useSSRSafeId('pf-about-modal-title-'); |
| 15 |
if (brandImageSrc && !brandImageAlt) { |
| 16 |
// eslint-disable-next-line no-console |
| 17 |
console.error('AboutModal:', 'brandImageAlt is required when a brandImageSrc is specified, and should not be an empty string.'); |
| 18 |
} |
| 19 |
if (!productName && !ariaLabel) { |
| 20 |
// eslint-disable-next-line no-console |
| 21 |
console.error('AboutModal:', 'Either productName or ariaLabel is required for component to be accessible'); |
| 22 |
} |
| 23 |
if (!isOpen) { |
| 24 |
return null; |
| 25 |
} |
| 26 |
return (_jsx(Modal, Object.assign({ isOpen: isOpen, variant: ModalVariant.large }, (productName && { 'aria-labelledby': ariaLabelledBy }), { "aria-label": ariaLabel, onEscapePress: onClose, appendTo: appendTo, disableFocusTrap: disableFocusTrap, children: _jsxs(AboutModalBox, { style: backgroundImageSrc ? { [backgroundImage.name]: `url(${backgroundImageSrc})` } : {}, className: css(className), children: [_jsx(AboutModalBoxBrand, { src: brandImageSrc, alt: brandImageAlt }), _jsx(AboutModalBoxCloseButton, { "aria-label": closeButtonAriaLabel, onClose: onClose }), productName && _jsx(AboutModalBoxHeader, { id: ariaLabelledBy, productName: productName }), _jsx(AboutModalBoxContent, Object.assign({ trademark: trademark, hasNoContentContainer: hasNoContentContainer }, props, { children: children }))] }) }))); |
| 27 |
}; |
| 28 |
AboutModal.displayName = 'AboutModal'; |
| 29 |
//# sourceMappingURL=AboutModal.js.map |