@panneau/modal-form 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 +82 -0
  2. package/lib/index.js +86 -0
  3. package/package.json +63 -0
package/es/index.js ADDED
@@ -0,0 +1,82 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { FormattedMessage } from 'react-intl';
4
+ import Form from '@panneau/form';
5
+ import Dialog from '@panneau/modal-dialog';
6
+
7
+ var propTypes = {
8
+ title: PropTypes.node,
9
+ name: PropTypes.string,
10
+ fields: PropTypes.arrayOf(PropTypes.shape({})),
11
+ action: PropTypes.string,
12
+ type: PropTypes.string,
13
+ item: PropTypes.shape({
14
+ id: PropTypes.string
15
+ }),
16
+ onComplete: PropTypes.func,
17
+ onClose: PropTypes.func,
18
+ submitButtonLabel: PropTypes.node,
19
+ className: PropTypes.string,
20
+ children: PropTypes.node
21
+ };
22
+ var defaultProps = {
23
+ title: null,
24
+ name: null,
25
+ fields: null,
26
+ action: null,
27
+ type: 'normal',
28
+ item: null,
29
+ onComplete: null,
30
+ onClose: null,
31
+ submitButtonLabel: null,
32
+ className: null,
33
+ children: null
34
+ };
35
+ function ModalForm(_ref) {
36
+ var title = _ref.title,
37
+ name = _ref.name,
38
+ fields = _ref.fields,
39
+ action = _ref.action,
40
+ type = _ref.type,
41
+ item = _ref.item,
42
+ onComplete = _ref.onComplete,
43
+ onClose = _ref.onClose,
44
+ submitButtonLabel = _ref.submitButtonLabel,
45
+ className = _ref.className,
46
+ children = _ref.children;
47
+ return /*#__PURE__*/React.createElement(Dialog, {
48
+ title: title || (name !== null ? /*#__PURE__*/React.createElement(FormattedMessage, {
49
+ id: "smqUAV",
50
+ defaultMessage: [{
51
+ "type": 0,
52
+ "value": "Edit "
53
+ }, {
54
+ "type": 1,
55
+ "value": "name"
56
+ }],
57
+ values: {
58
+ name: name
59
+ }
60
+ }) : /*#__PURE__*/React.createElement(FormattedMessage, {
61
+ id: "T/NPHK",
62
+ defaultMessage: [{
63
+ "type": 0,
64
+ "value": "Edit"
65
+ }]
66
+ })),
67
+ size: "lg",
68
+ onClose: onClose,
69
+ className: className
70
+ }, children, /*#__PURE__*/React.createElement(Form, {
71
+ fields: fields,
72
+ action: action,
73
+ type: type,
74
+ item: item,
75
+ onComplete: onComplete,
76
+ submitButtonLabel: submitButtonLabel
77
+ }));
78
+ }
79
+ ModalForm.propTypes = propTypes;
80
+ ModalForm.defaultProps = defaultProps;
81
+
82
+ export { ModalForm as default };
package/lib/index.js ADDED
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var PropTypes = require('prop-types');
6
+ var React = require('react');
7
+ var reactIntl = require('react-intl');
8
+ var Form = require('@panneau/form');
9
+ var Dialog = require('@panneau/modal-dialog');
10
+
11
+ var propTypes = {
12
+ title: PropTypes.node,
13
+ name: PropTypes.string,
14
+ fields: PropTypes.arrayOf(PropTypes.shape({})),
15
+ action: PropTypes.string,
16
+ type: PropTypes.string,
17
+ item: PropTypes.shape({
18
+ id: PropTypes.string
19
+ }),
20
+ onComplete: PropTypes.func,
21
+ onClose: PropTypes.func,
22
+ submitButtonLabel: PropTypes.node,
23
+ className: PropTypes.string,
24
+ children: PropTypes.node
25
+ };
26
+ var defaultProps = {
27
+ title: null,
28
+ name: null,
29
+ fields: null,
30
+ action: null,
31
+ type: 'normal',
32
+ item: null,
33
+ onComplete: null,
34
+ onClose: null,
35
+ submitButtonLabel: null,
36
+ className: null,
37
+ children: null
38
+ };
39
+ function ModalForm(_ref) {
40
+ var title = _ref.title,
41
+ name = _ref.name,
42
+ fields = _ref.fields,
43
+ action = _ref.action,
44
+ type = _ref.type,
45
+ item = _ref.item,
46
+ onComplete = _ref.onComplete,
47
+ onClose = _ref.onClose,
48
+ submitButtonLabel = _ref.submitButtonLabel,
49
+ className = _ref.className,
50
+ children = _ref.children;
51
+ return /*#__PURE__*/React.createElement(Dialog, {
52
+ title: title || (name !== null ? /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
53
+ id: "smqUAV",
54
+ defaultMessage: [{
55
+ "type": 0,
56
+ "value": "Edit "
57
+ }, {
58
+ "type": 1,
59
+ "value": "name"
60
+ }],
61
+ values: {
62
+ name: name
63
+ }
64
+ }) : /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
65
+ id: "T/NPHK",
66
+ defaultMessage: [{
67
+ "type": 0,
68
+ "value": "Edit"
69
+ }]
70
+ })),
71
+ size: "lg",
72
+ onClose: onClose,
73
+ className: className
74
+ }, children, /*#__PURE__*/React.createElement(Form, {
75
+ fields: fields,
76
+ action: action,
77
+ type: type,
78
+ item: item,
79
+ onComplete: onComplete,
80
+ submitButtonLabel: submitButtonLabel
81
+ }));
82
+ }
83
+ ModalForm.propTypes = propTypes;
84
+ ModalForm.defaultProps = defaultProps;
85
+
86
+ exports.default = ModalForm;
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@panneau/modal-form",
3
+ "version": "3.0.130",
4
+ "description": "Resource form 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/form": "^3.0.130",
51
+ "@panneau/intl": "^3.0.130",
52
+ "@panneau/modal-dialog": "^3.0.130",
53
+ "@panneau/themes": "^3.0.130",
54
+ "classnames": "^2.2.6",
55
+ "lodash": "^4.17.21",
56
+ "prop-types": "^15.7.2",
57
+ "react-intl": "^5.15.8||^6.0.0"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public"
61
+ },
62
+ "gitHead": "e6070daacb45351ccbef67ae8006f1a293ca8e2b"
63
+ }