material-ui-confirm
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -6,6 +6,6 @@ import * as React from 'react'; | ||
export interface ConfirmOptions { | ||
title?: string; | ||
description?: string; | ||
confirmationText?: string; | ||
cancellationText?: string; | ||
title?: React.ReactNode; | ||
description?: React.ReactNode; | ||
confirmationText?: React.ReactNode; | ||
cancellationText?: React.ReactNode; | ||
dialogProps?: DialogProps; | ||
@@ -12,0 +12,0 @@ confirmationButtonProps?: ButtonProps; |
@@ -84,3 +84,3 @@ 'use strict'; | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
@@ -93,6 +93,3 @@ | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
@@ -123,4 +120,21 @@ var _n = true; | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -142,3 +156,3 @@ | ||
cancellationButtonProps = options.cancellationButtonProps; | ||
return React__default.createElement(Dialog, _extends({ | ||
return /*#__PURE__*/React__default.createElement(Dialog, _extends({ | ||
fullWidth: true | ||
@@ -148,5 +162,5 @@ }, dialogProps, { | ||
onClose: onCancel | ||
}), title && React__default.createElement(DialogTitle, null, title), description && React__default.createElement(DialogContent, null, React__default.createElement(DialogContentText, null, description)), React__default.createElement(DialogActions, null, React__default.createElement(Button, _extends({}, cancellationButtonProps, { | ||
}), title && /*#__PURE__*/React__default.createElement(DialogTitle, null, title), description && /*#__PURE__*/React__default.createElement(DialogContent, null, /*#__PURE__*/React__default.createElement(DialogContentText, null, description)), /*#__PURE__*/React__default.createElement(DialogActions, null, /*#__PURE__*/React__default.createElement(Button, _extends({}, cancellationButtonProps, { | ||
onClick: onCancel | ||
}), cancellationText), React__default.createElement(Button, _extends({ | ||
}), cancellationText), /*#__PURE__*/React__default.createElement(Button, _extends({ | ||
color: "primary" | ||
@@ -173,3 +187,3 @@ }, confirmationButtonProps, { | ||
var _useState = React.useState(_objectSpread2({}, _defaultOptions, {}, defaultOptions)), | ||
var _useState = React.useState(_objectSpread2(_objectSpread2({}, _defaultOptions), defaultOptions)), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
@@ -191,3 +205,3 @@ options = _useState2[0], | ||
return new Promise(function (resolve, reject) { | ||
setOptions(_objectSpread2({}, _defaultOptions, {}, defaultOptions, {}, options)); | ||
setOptions(_objectSpread2(_objectSpread2(_objectSpread2({}, _defaultOptions), defaultOptions), options)); | ||
setResolveReject([resolve, reject]); | ||
@@ -207,5 +221,5 @@ }); | ||
}, [resolve, handleClose]); | ||
return React__default.createElement(React.Fragment, null, React__default.createElement(ConfirmContext.Provider, { | ||
return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(ConfirmContext.Provider, { | ||
value: confirm | ||
}, children), React__default.createElement(ConfirmationDialog, { | ||
}, children), /*#__PURE__*/React__default.createElement(ConfirmationDialog, { | ||
open: resolveReject.length === 2, | ||
@@ -212,0 +226,0 @@ options: options, |
@@ -77,3 +77,3 @@ import React, { createContext, useState, useCallback, Fragment, useContext } from 'react'; | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
@@ -86,6 +86,3 @@ | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
@@ -116,4 +113,21 @@ var _n = true; | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -135,3 +149,3 @@ | ||
cancellationButtonProps = options.cancellationButtonProps; | ||
return React.createElement(Dialog, _extends({ | ||
return /*#__PURE__*/React.createElement(Dialog, _extends({ | ||
fullWidth: true | ||
@@ -141,5 +155,5 @@ }, dialogProps, { | ||
onClose: onCancel | ||
}), title && React.createElement(DialogTitle, null, title), description && React.createElement(DialogContent, null, React.createElement(DialogContentText, null, description)), React.createElement(DialogActions, null, React.createElement(Button, _extends({}, cancellationButtonProps, { | ||
}), title && /*#__PURE__*/React.createElement(DialogTitle, null, title), description && /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(DialogContentText, null, description)), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, _extends({}, cancellationButtonProps, { | ||
onClick: onCancel | ||
}), cancellationText), React.createElement(Button, _extends({ | ||
}), cancellationText), /*#__PURE__*/React.createElement(Button, _extends({ | ||
color: "primary" | ||
@@ -166,3 +180,3 @@ }, confirmationButtonProps, { | ||
var _useState = useState(_objectSpread2({}, _defaultOptions, {}, defaultOptions)), | ||
var _useState = useState(_objectSpread2(_objectSpread2({}, _defaultOptions), defaultOptions)), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
@@ -184,3 +198,3 @@ options = _useState2[0], | ||
return new Promise(function (resolve, reject) { | ||
setOptions(_objectSpread2({}, _defaultOptions, {}, defaultOptions, {}, options)); | ||
setOptions(_objectSpread2(_objectSpread2(_objectSpread2({}, _defaultOptions), defaultOptions), options)); | ||
setResolveReject([resolve, reject]); | ||
@@ -200,5 +214,5 @@ }); | ||
}, [resolve, handleClose]); | ||
return React.createElement(Fragment, null, React.createElement(ConfirmContext.Provider, { | ||
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ConfirmContext.Provider, { | ||
value: confirm | ||
}, children), React.createElement(ConfirmationDialog, { | ||
}, children), /*#__PURE__*/React.createElement(ConfirmationDialog, { | ||
open: resolveReject.length === 2, | ||
@@ -205,0 +219,0 @@ options: options, |
{ | ||
"name": "material-ui-confirm", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Higher order component for straightforward use of @material-ui/core confirmation dialogs.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -88,8 +88,8 @@ # Material-UI confirm [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jonatanklosko/material-ui-confirm/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/material-ui-confirm.svg)](https://www.npmjs.com/package/material-ui-confirm) [![Build Status](https://travis-ci.org/jonatanklosko/material-ui-confirm.svg?branch=master)](https://travis-ci.org/jonatanklosko/material-ui-confirm) [![Coverage Status](https://coveralls.io/repos/github/jonatanklosko/material-ui-confirm/badge.svg?branch=master)](https://coveralls.io/github/jonatanklosko/material-ui-confirm?branch=master) | ||
| ---- | ---- | ------- | ----------- | | ||
| **`title`** | `string` | `'Are you sure?'` | Dialog title. | | ||
| **`description`** | `string` | `''` | Dialog content. | | ||
| **`confirmationText`** | `string` | `'Ok'` | Confirmation button caption. | | ||
| **`cancellationText`** | `string` | `'Cancel'` | Cancellation button caption. | | ||
| **`title`** | `ReactNode` | `'Are you sure?'` | Dialog title. | | ||
| **`description`** | `ReactNode` | `''` | Dialog content. | | ||
| **`confirmationText`** | `ReactNode` | `'Ok'` | Confirmation button caption. | | ||
| **`cancellationText`** | `ReactNode` | `'Cancel'` | Cancellation button caption. | | ||
| **`dialogProps`** | `object` | `{}` | Material-UI [Dialog](https://material-ui.com/api/dialog/#props) props. | | ||
| **`confirmationButtonProps`** | `object` | `{}` | Material-UI [Button](https://material-ui.com/api/button/#props) props for the confirmation button. | | ||
| **`cancellationButtonProps`** | `object` | `{}` | Material-UI [Button](https://material-ui.com/api/dialog/#props) props for the cancellation button. | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21395
402