1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import * as React from 'react';
|
3 | import Button from '../button';
|
4 | import { convertLegacyProps } from '../button/button';
|
5 | import ActionButton from '../_util/ActionButton';
|
6 | import LocaleReceiver from '../locale-provider/LocaleReceiver';
|
7 | import defaultLocale from '../locale/default';
|
8 | import { getRenderPropValue } from '../_util/getRenderPropValue';
|
9 | import { ConfigContext } from '../config-provider';
|
10 | export function Overlay(props) {
|
11 | var prefixCls = props.prefixCls,
|
12 | okButtonProps = props.okButtonProps,
|
13 | cancelButtonProps = props.cancelButtonProps,
|
14 | title = props.title,
|
15 | cancelText = props.cancelText,
|
16 | okText = props.okText,
|
17 | okType = props.okType,
|
18 | icon = props.icon,
|
19 | _props$showCancel = props.showCancel,
|
20 | showCancel = _props$showCancel === void 0 ? true : _props$showCancel,
|
21 | close = props.close,
|
22 | onConfirm = props.onConfirm,
|
23 | onCancel = props.onCancel;
|
24 |
|
25 | var _React$useContext = React.useContext(ConfigContext),
|
26 | getPrefixCls = _React$useContext.getPrefixCls;
|
27 |
|
28 | return React.createElement(LocaleReceiver, {
|
29 | componentName: "Popconfirm",
|
30 | defaultLocale: defaultLocale.Popconfirm
|
31 | }, function (popconfirmLocale) {
|
32 | return React.createElement("div", {
|
33 | className: "".concat(prefixCls, "-inner-content")
|
34 | }, React.createElement("div", {
|
35 | className: "".concat(prefixCls, "-message")
|
36 | }, icon, React.createElement("div", {
|
37 | className: "".concat(prefixCls, "-message-title")
|
38 | }, getRenderPropValue(title))), React.createElement("div", {
|
39 | className: "".concat(prefixCls, "-buttons")
|
40 | }, showCancel && React.createElement(Button, _extends({
|
41 | onClick: onCancel,
|
42 | size: "small"
|
43 | }, cancelButtonProps), cancelText || popconfirmLocale.cancelText), React.createElement(ActionButton, {
|
44 | buttonProps: _extends(_extends({
|
45 | size: 'small'
|
46 | }, convertLegacyProps(okType)), okButtonProps),
|
47 | actionFn: onConfirm,
|
48 | close: close,
|
49 | prefixCls: getPrefixCls('btn'),
|
50 | quitOnNullishReturnValue: true,
|
51 | emitEvent: true
|
52 | }, okText || popconfirmLocale.okText)));
|
53 | });
|
54 | } |
\ | No newline at end of file |