@panneau/modal-resource-form 2.0.79

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 +83 -0
  3. package/package.json +62 -0
package/es/index.js ADDED
@@ -0,0 +1,72 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { FormattedMessage } from 'react-intl';
4
+ import ResourceForm from '@panneau/form-resource';
5
+ import { useResourceValues } from '@panneau/intl';
6
+ import Dialog from '@panneau/modal-dialog';
7
+
8
+ var propTypes = {
9
+ resource: PropTypes.string,
10
+ type: PropTypes.string,
11
+ item: PropTypes.shape({
12
+ id: PropTypes.string
13
+ }),
14
+ isCreate: PropTypes.bool,
15
+ onSuccess: PropTypes.func,
16
+ onClose: PropTypes.func,
17
+ className: PropTypes.string
18
+ };
19
+ var defaultProps = {
20
+ resource: null,
21
+ type: null,
22
+ item: null,
23
+ isCreate: null,
24
+ onSuccess: null,
25
+ onClose: null,
26
+ className: null
27
+ };
28
+ var ModalResourceForm = function ModalResourceForm(_ref) {
29
+ var resource = _ref.resource,
30
+ type = _ref.type,
31
+ item = _ref.item,
32
+ isCreate = _ref.isCreate,
33
+ onSuccess = _ref.onSuccess,
34
+ onClose = _ref.onClose,
35
+ className = _ref.className;
36
+ var resourceValues = useResourceValues(resource);
37
+ return /*#__PURE__*/React.createElement(Dialog, {
38
+ title: !isCreate !== null ? /*#__PURE__*/React.createElement(FormattedMessage, {
39
+ values: resourceValues,
40
+ id: "mCfzkJ",
41
+ defaultMessage: [{
42
+ "type": 0,
43
+ "value": "Edit "
44
+ }, {
45
+ "type": 1,
46
+ "value": "a_singular"
47
+ }]
48
+ }) : /*#__PURE__*/React.createElement(FormattedMessage, {
49
+ values: resourceValues,
50
+ id: "6viUpq",
51
+ defaultMessage: [{
52
+ "type": 0,
53
+ "value": "Create "
54
+ }, {
55
+ "type": 1,
56
+ "value": "a_singular"
57
+ }]
58
+ }),
59
+ size: "lg",
60
+ onClose: onClose,
61
+ className: className
62
+ }, /*#__PURE__*/React.createElement(ResourceForm, {
63
+ resource: resource,
64
+ type: type,
65
+ item: item,
66
+ onSuccess: onSuccess
67
+ }));
68
+ };
69
+ ModalResourceForm.propTypes = propTypes;
70
+ ModalResourceForm.defaultProps = defaultProps;
71
+
72
+ export { ModalResourceForm as default };
package/lib/index.js ADDED
@@ -0,0 +1,83 @@
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 ResourceForm = require('@panneau/form-resource');
9
+ var intl = require('@panneau/intl');
10
+ var Dialog = require('@panneau/modal-dialog');
11
+
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
15
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
+ var ResourceForm__default = /*#__PURE__*/_interopDefaultLegacy(ResourceForm);
17
+ var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
18
+
19
+ var propTypes = {
20
+ resource: PropTypes__default["default"].string,
21
+ type: PropTypes__default["default"].string,
22
+ item: PropTypes__default["default"].shape({
23
+ id: PropTypes__default["default"].string
24
+ }),
25
+ isCreate: PropTypes__default["default"].bool,
26
+ onSuccess: PropTypes__default["default"].func,
27
+ onClose: PropTypes__default["default"].func,
28
+ className: PropTypes__default["default"].string
29
+ };
30
+ var defaultProps = {
31
+ resource: null,
32
+ type: null,
33
+ item: null,
34
+ isCreate: null,
35
+ onSuccess: null,
36
+ onClose: null,
37
+ className: null
38
+ };
39
+ var ModalResourceForm = function ModalResourceForm(_ref) {
40
+ var resource = _ref.resource,
41
+ type = _ref.type,
42
+ item = _ref.item,
43
+ isCreate = _ref.isCreate,
44
+ onSuccess = _ref.onSuccess,
45
+ onClose = _ref.onClose,
46
+ className = _ref.className;
47
+ var resourceValues = intl.useResourceValues(resource);
48
+ return /*#__PURE__*/React__default["default"].createElement(Dialog__default["default"], {
49
+ title: !isCreate !== null ? /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
50
+ values: resourceValues,
51
+ id: "mCfzkJ",
52
+ defaultMessage: [{
53
+ "type": 0,
54
+ "value": "Edit "
55
+ }, {
56
+ "type": 1,
57
+ "value": "a_singular"
58
+ }]
59
+ }) : /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
60
+ values: resourceValues,
61
+ id: "6viUpq",
62
+ defaultMessage: [{
63
+ "type": 0,
64
+ "value": "Create "
65
+ }, {
66
+ "type": 1,
67
+ "value": "a_singular"
68
+ }]
69
+ }),
70
+ size: "lg",
71
+ onClose: onClose,
72
+ className: className
73
+ }, /*#__PURE__*/React__default["default"].createElement(ResourceForm__default["default"], {
74
+ resource: resource,
75
+ type: type,
76
+ item: item,
77
+ onSuccess: onSuccess
78
+ }));
79
+ };
80
+ ModalResourceForm.propTypes = propTypes;
81
+ ModalResourceForm.defaultProps = defaultProps;
82
+
83
+ exports["default"] = ModalResourceForm;
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@panneau/modal-resource-form",
3
+ "version": "2.0.79",
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
+ "prepare": "../../scripts/prepare-package.sh"
37
+ },
38
+ "devDependencies": {
39
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
40
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
41
+ },
42
+ "peerDependencies": {
43
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
44
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
45
+ },
46
+ "dependencies": {
47
+ "@babel/runtime": "^7.12.5",
48
+ "@panneau/core": "^2.0.75",
49
+ "@panneau/form-resource": "^2.0.79",
50
+ "@panneau/intl": "^2.0.79",
51
+ "@panneau/modal-dialog": "^2.0.79",
52
+ "@panneau/themes": "^2.0.75",
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": "b3bfbc84de833d32a4939542aba6e010d3672ffa"
62
+ }