ConfirmOkBtn.js 847 B

12345678910111213141516171819202122232425262728293031
  1. "use client";
  2. import React, { useContext } from 'react';
  3. import ActionButton from '../../_util/ActionButton';
  4. import { ModalContext } from '../context';
  5. const ConfirmOkBtn = () => {
  6. const {
  7. autoFocusButton,
  8. close,
  9. isSilent,
  10. okButtonProps,
  11. rootPrefixCls,
  12. okTextLocale,
  13. okType,
  14. onConfirm,
  15. onOk
  16. } = useContext(ModalContext);
  17. return /*#__PURE__*/React.createElement(ActionButton, {
  18. isSilent: isSilent,
  19. type: okType || 'primary',
  20. actionFn: onOk,
  21. close: (...args) => {
  22. close === null || close === void 0 ? void 0 : close.apply(void 0, args);
  23. onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(true);
  24. },
  25. autoFocus: autoFocusButton === 'ok',
  26. buttonProps: okButtonProps,
  27. prefixCls: `${rootPrefixCls}-btn`
  28. }, okTextLocale);
  29. };
  30. export default ConfirmOkBtn;