You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.0 KiB

import * as React from 'react';
import { useContext } from 'react';
import useEventCallback from '@restart/hooks/useEventCallback';
import CloseButton from './CloseButton';
import ModalContext from './ModalContext';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const defaultProps = {
closeLabel: 'Close',
closeButton: false
};
const AbstractModalHeader = /*#__PURE__*/React.forwardRef(({
closeLabel,
closeVariant,
closeButton,
onHide,
children,
...props
}, ref) => {
const context = useContext(ModalContext);
const handleClick = useEventCallback(() => {
context == null ? void 0 : context.onHide();
onHide == null ? void 0 : onHide();
});
return /*#__PURE__*/_jsxs("div", {
ref: ref,
...props,
children: [children, closeButton && /*#__PURE__*/_jsx(CloseButton, {
"aria-label": closeLabel,
variant: closeVariant,
onClick: handleClick
})]
});
});
AbstractModalHeader.defaultProps = defaultProps;
export default AbstractModalHeader;