@panneau/modal-confirm 3.0.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/es/index.js +72 -0
  2. package/lib/index.js +76 -0
  3. package/package.json +62 -0
package/es/index.js ADDED
@@ -0,0 +1,72 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
+ import PropTypes from 'prop-types';
3
+ import React from 'react';
4
+ import { FormattedMessage } from 'react-intl';
5
+ import Dialog from '@panneau/modal-dialog';
6
+
7
+ var propTypes = {
8
+ title: PropTypes.node,
9
+ onConfirm: PropTypes.func,
10
+ onClose: PropTypes.func,
11
+ confirmButton: PropTypes.shape({
12
+ label: PropTypes.string
13
+ }),
14
+ cancelButton: PropTypes.shape({
15
+ label: PropTypes.string
16
+ }),
17
+ className: PropTypes.string,
18
+ children: PropTypes.node
19
+ };
20
+ var defaultProps = {
21
+ title: null,
22
+ onConfirm: null,
23
+ onClose: null,
24
+ confirmButton: null,
25
+ cancelButton: null,
26
+ className: null,
27
+ children: null
28
+ };
29
+ function ConfirmModal(_ref) {
30
+ var title = _ref.title,
31
+ onConfirm = _ref.onConfirm,
32
+ onClose = _ref.onClose,
33
+ confirmButton = _ref.confirmButton,
34
+ cancelButton = _ref.cancelButton,
35
+ className = _ref.className,
36
+ children = _ref.children;
37
+ return /*#__PURE__*/React.createElement(Dialog, {
38
+ title: title,
39
+ size: "lg",
40
+ onClose: onClose,
41
+ className: className,
42
+ buttons: [_objectSpread({
43
+ id: 'no',
44
+ name: 'no',
45
+ label: /*#__PURE__*/React.createElement(FormattedMessage, {
46
+ id: "yhU8J6",
47
+ defaultMessage: [{
48
+ "type": 0,
49
+ "value": "No"
50
+ }]
51
+ }),
52
+ theme: 'secondary',
53
+ onClick: onClose
54
+ }, cancelButton), _objectSpread({
55
+ id: 'yes',
56
+ name: 'yes',
57
+ label: /*#__PURE__*/React.createElement(FormattedMessage, {
58
+ id: "3ebjtX",
59
+ defaultMessage: [{
60
+ "type": 0,
61
+ "value": "Yes"
62
+ }]
63
+ }),
64
+ theme: 'primary',
65
+ onClick: onConfirm
66
+ }, confirmButton)]
67
+ }, children);
68
+ }
69
+ ConfirmModal.propTypes = propTypes;
70
+ ConfirmModal.defaultProps = defaultProps;
71
+
72
+ export { ConfirmModal as default };
package/lib/index.js ADDED
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
+ var PropTypes = require('prop-types');
7
+ var React = require('react');
8
+ var reactIntl = require('react-intl');
9
+ var Dialog = require('@panneau/modal-dialog');
10
+
11
+ var propTypes = {
12
+ title: PropTypes.node,
13
+ onConfirm: PropTypes.func,
14
+ onClose: PropTypes.func,
15
+ confirmButton: PropTypes.shape({
16
+ label: PropTypes.string
17
+ }),
18
+ cancelButton: PropTypes.shape({
19
+ label: PropTypes.string
20
+ }),
21
+ className: PropTypes.string,
22
+ children: PropTypes.node
23
+ };
24
+ var defaultProps = {
25
+ title: null,
26
+ onConfirm: null,
27
+ onClose: null,
28
+ confirmButton: null,
29
+ cancelButton: null,
30
+ className: null,
31
+ children: null
32
+ };
33
+ function ConfirmModal(_ref) {
34
+ var title = _ref.title,
35
+ onConfirm = _ref.onConfirm,
36
+ onClose = _ref.onClose,
37
+ confirmButton = _ref.confirmButton,
38
+ cancelButton = _ref.cancelButton,
39
+ className = _ref.className,
40
+ children = _ref.children;
41
+ return /*#__PURE__*/React.createElement(Dialog, {
42
+ title: title,
43
+ size: "lg",
44
+ onClose: onClose,
45
+ className: className,
46
+ buttons: [_objectSpread({
47
+ id: 'no',
48
+ name: 'no',
49
+ label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
50
+ id: "yhU8J6",
51
+ defaultMessage: [{
52
+ "type": 0,
53
+ "value": "No"
54
+ }]
55
+ }),
56
+ theme: 'secondary',
57
+ onClick: onClose
58
+ }, cancelButton), _objectSpread({
59
+ id: 'yes',
60
+ name: 'yes',
61
+ label: /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
62
+ id: "3ebjtX",
63
+ defaultMessage: [{
64
+ "type": 0,
65
+ "value": "Yes"
66
+ }]
67
+ }),
68
+ theme: 'primary',
69
+ onClick: onConfirm
70
+ }, confirmButton)]
71
+ }, children);
72
+ }
73
+ ConfirmModal.propTypes = propTypes;
74
+ ConfirmModal.defaultProps = defaultProps;
75
+
76
+ exports.default = ConfirmModal;
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@panneau/modal-confirm",
3
+ "version": "3.0.130",
4
+ "description": "Confirm modal",
5
+ "keywords": [
6
+ "javascript"
7
+ ],
8
+ "homepage": "https://github.com/folkloreinc/panneau-js",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/folkloreinc/panneau-js.git"
12
+ },
13
+ "author": {
14
+ "name": "Folklore",
15
+ "email": "info@folklore.email"
16
+ },
17
+ "contributors": [
18
+ {
19
+ "name": "David Mongeau-Petitpas",
20
+ "email": "dmp@folklore.email"
21
+ },
22
+ {
23
+ "name": "Nicolas Roy-Bourdages",
24
+ "email": "nrb@folklore.email"
25
+ }
26
+ ],
27
+ "license": "ISC",
28
+ "main": "lib/index.js",
29
+ "module": "es/index.js",
30
+ "files": [
31
+ "lib",
32
+ "es",
33
+ "assets"
34
+ ],
35
+ "scripts": {
36
+ "prepublishOnly": "npm run build",
37
+ "build": "../../scripts/prepare-package.sh"
38
+ },
39
+ "devDependencies": {
40
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
41
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
45
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
46
+ },
47
+ "dependencies": {
48
+ "@babel/runtime": "^7.12.5",
49
+ "@panneau/core": "^3.0.130",
50
+ "@panneau/intl": "^3.0.130",
51
+ "@panneau/modal-dialog": "^3.0.130",
52
+ "@panneau/themes": "^3.0.130",
53
+ "classnames": "^2.2.6",
54
+ "lodash": "^4.17.21",
55
+ "prop-types": "^15.7.2",
56
+ "react-intl": "^5.15.8||^6.0.0"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "gitHead": "e6070daacb45351ccbef67ae8006f1a293ca8e2b"
62
+ }