1 line
1.6 KiB
JSON
1 line
1.6 KiB
JSON
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useContext } from 'react';\nimport useEventCallback from '@restart/hooks/useEventCallback';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport CloseButton from './CloseButton';\nimport ModalContext from './ModalContext';\nvar defaultProps = {\n closeLabel: 'Close',\n closeButton: false\n};\nvar ModalHeader = React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n closeLabel = _ref.closeLabel,\n closeButton = _ref.closeButton,\n onHide = _ref.onHide,\n className = _ref.className,\n children = _ref.children,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"closeLabel\", \"closeButton\", \"onHide\", \"className\", \"children\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'modal-header');\n var context = useContext(ModalContext);\n var handleClick = useEventCallback(function () {\n if (context) context.onHide();\n if (onHide) onHide();\n });\n return React.createElement(\"div\", _extends({\n ref: ref\n }, props, {\n className: classNames(className, bsPrefix)\n }), children, closeButton && React.createElement(CloseButton, {\n label: closeLabel,\n onClick: handleClick\n }));\n});\nModalHeader.displayName = 'ModalHeader';\nModalHeader.defaultProps = defaultProps;\nexport default ModalHeader;","map":null,"metadata":{},"sourceType":"module"} |