@panneau/form-resource 4.0.2 → 4.0.3

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 (2) hide show
  1. package/es/index.js +147 -126
  2. package/package.json +3 -3
package/es/index.js CHANGED
@@ -12,6 +12,7 @@ import { FormattedMessage } from 'react-intl';
12
12
  import Button from '@panneau/element-button';
13
13
  import Form from '@panneau/element-form';
14
14
  import { useResourceValues } from '@panneau/intl';
15
+ import { jsx, jsxs } from 'react/jsx-runtime';
15
16
 
16
17
  var _excluded$2 = ["resource", "action", "previous", "status", "value", "onSubmit", "errors", "generalError", "loading", "className"];
17
18
  function DeleteForm(_ref) {
@@ -41,7 +42,7 @@ function DeleteForm(_ref) {
41
42
  });
42
43
  // const { text, background } = usePanneauColorScheme();
43
44
 
44
- return /*#__PURE__*/React.createElement(Form, Object.assign({
45
+ return /*#__PURE__*/jsx(Form, _objectSpread(_objectSpread({
45
46
  className: classNames(['form', _defineProperty({
46
47
  'invalid-feedback': generalError !== null
47
48
  }, className, className !== null)]),
@@ -50,62 +51,70 @@ function DeleteForm(_ref) {
50
51
  withoutActions: true,
51
52
  withoutErrors: true,
52
53
  disabled: loading
53
- }, props), /*#__PURE__*/React.createElement("div", {
54
- className: classNames(['card', _defineProperty({}, className, className !== null)])
55
- }, /*#__PURE__*/React.createElement("div", {
56
- className: "card-body"
57
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
58
- values: resourceValues,
59
- id: "yzfiXJ",
60
- defaultMessage: [{
61
- "type": 0,
62
- "value": "Are you sure you want to delete "
63
- }, {
64
- "type": 1,
65
- "value": "the_singular"
66
- }, {
67
- "type": 0,
68
- "value": " #"
69
- }, {
70
- "type": 1,
71
- "value": "id"
72
- }, {
73
- "type": 0,
74
- "value": "?"
75
- }]
76
- }), generalError ? /*#__PURE__*/React.createElement("p", {
77
- className: "text-danger"
78
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
79
- id: "y9zauY",
80
- defaultMessage: [{
81
- "type": 0,
82
- "value": "An error occured and we could not delete this item successfully."
83
- }]
84
- })) : null), /*#__PURE__*/React.createElement("div", {
85
- className: "card-body d-flex"
86
- }, previous !== null ? /*#__PURE__*/React.createElement(Button, {
87
- href: previous,
88
- className: "me-2",
89
- theme: "secondary",
90
- outline: true
91
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
92
- id: "PyxZY2",
93
- defaultMessage: [{
94
- "type": 0,
95
- "value": "Cancel"
96
- }]
97
- })) : null, /*#__PURE__*/React.createElement(Button, {
98
- type: "submit",
99
- className: "ms-auto",
100
- theme: "danger",
101
- disabled: loading
102
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
103
- id: "Bhu3B2",
104
- defaultMessage: [{
105
- "type": 0,
106
- "value": "Delete"
107
- }]
108
- })))));
54
+ }, props), {}, {
55
+ children: /*#__PURE__*/jsxs("div", {
56
+ className: classNames(['card', _defineProperty({}, className, className !== null)]),
57
+ children: [/*#__PURE__*/jsxs("div", {
58
+ className: "card-body",
59
+ children: [/*#__PURE__*/jsx(FormattedMessage, {
60
+ values: resourceValues,
61
+ id: "yzfiXJ",
62
+ defaultMessage: [{
63
+ "type": 0,
64
+ "value": "Are you sure you want to delete "
65
+ }, {
66
+ "type": 1,
67
+ "value": "the_singular"
68
+ }, {
69
+ "type": 0,
70
+ "value": " #"
71
+ }, {
72
+ "type": 1,
73
+ "value": "id"
74
+ }, {
75
+ "type": 0,
76
+ "value": "?"
77
+ }]
78
+ }), generalError ? /*#__PURE__*/jsx("p", {
79
+ className: "text-danger",
80
+ children: /*#__PURE__*/jsx(FormattedMessage, {
81
+ id: "y9zauY",
82
+ defaultMessage: [{
83
+ "type": 0,
84
+ "value": "An error occured and we could not delete this item successfully."
85
+ }]
86
+ })
87
+ }) : null]
88
+ }), /*#__PURE__*/jsxs("div", {
89
+ className: "card-body d-flex",
90
+ children: [previous !== null ? /*#__PURE__*/jsx(Button, {
91
+ href: previous,
92
+ className: "me-2",
93
+ theme: "secondary",
94
+ outline: true,
95
+ children: /*#__PURE__*/jsx(FormattedMessage, {
96
+ id: "PyxZY2",
97
+ defaultMessage: [{
98
+ "type": 0,
99
+ "value": "Cancel"
100
+ }]
101
+ })
102
+ }) : null, /*#__PURE__*/jsx(Button, {
103
+ type: "submit",
104
+ className: "ms-auto",
105
+ theme: "danger",
106
+ disabled: loading,
107
+ children: /*#__PURE__*/jsx(FormattedMessage, {
108
+ id: "Bhu3B2",
109
+ defaultMessage: [{
110
+ "type": 0,
111
+ "value": "Delete"
112
+ }]
113
+ })
114
+ })]
115
+ })]
116
+ })
117
+ }));
109
118
  }
110
119
 
111
120
  var _excluded$1 = ["resource", "action", "previous", "status", "value", "onSubmit", "errors", "generalError", "loading", "className"];
@@ -134,7 +143,7 @@ function DuplicateForm(_ref) {
134
143
  var resourceValues = useResourceValues(resource, {
135
144
  id: id
136
145
  });
137
- return /*#__PURE__*/React.createElement(Form, Object.assign({
146
+ return /*#__PURE__*/jsx(Form, _objectSpread(_objectSpread({
138
147
  className: classNames(['form', _defineProperty({
139
148
  'invalid-feedback': generalError !== null
140
149
  }, className, className !== null)]),
@@ -143,62 +152,70 @@ function DuplicateForm(_ref) {
143
152
  withoutActions: true,
144
153
  withoutErrors: true,
145
154
  disabled: loading
146
- }, props), /*#__PURE__*/React.createElement("div", {
147
- className: classNames(['card', _defineProperty({}, className, className !== null)])
148
- }, /*#__PURE__*/React.createElement("div", {
149
- className: "card-body"
150
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
151
- values: resourceValues,
152
- id: "ZhnMCD",
153
- defaultMessage: [{
154
- "type": 0,
155
- "value": "Are you sure you want to duplicate "
156
- }, {
157
- "type": 1,
158
- "value": "the_singular"
159
- }, {
160
- "type": 0,
161
- "value": " #"
162
- }, {
163
- "type": 1,
164
- "value": "id"
165
- }, {
166
- "type": 0,
167
- "value": "?"
168
- }]
169
- }), generalError ? /*#__PURE__*/React.createElement("p", {
170
- className: "text-danger"
171
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
172
- id: "y9zauY",
173
- defaultMessage: [{
174
- "type": 0,
175
- "value": "An error occured and we could not delete this item successfully."
176
- }]
177
- })) : null), /*#__PURE__*/React.createElement("div", {
178
- className: "card-body d-flex"
179
- }, previous !== null ? /*#__PURE__*/React.createElement(Button, {
180
- href: previous,
181
- className: "me-2",
182
- theme: "secondary",
183
- outline: true
184
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
185
- id: "PyxZY2",
186
- defaultMessage: [{
187
- "type": 0,
188
- "value": "Cancel"
189
- }]
190
- })) : null, /*#__PURE__*/React.createElement(Button, {
191
- type: "submit",
192
- className: "ms-auto",
193
- theme: "warning",
194
- disabled: loading
195
- }, /*#__PURE__*/React.createElement(FormattedMessage, {
196
- id: "HzCxmr",
197
- defaultMessage: [{
198
- "type": 0,
199
- "value": "Duplicate"
200
- }]
201
- })))));
155
+ }, props), {}, {
156
+ children: /*#__PURE__*/jsxs("div", {
157
+ className: classNames(['card', _defineProperty({}, className, className !== null)]),
158
+ children: [/*#__PURE__*/jsxs("div", {
159
+ className: "card-body",
160
+ children: [/*#__PURE__*/jsx(FormattedMessage, {
161
+ values: resourceValues,
162
+ id: "ZhnMCD",
163
+ defaultMessage: [{
164
+ "type": 0,
165
+ "value": "Are you sure you want to duplicate "
166
+ }, {
167
+ "type": 1,
168
+ "value": "the_singular"
169
+ }, {
170
+ "type": 0,
171
+ "value": " #"
172
+ }, {
173
+ "type": 1,
174
+ "value": "id"
175
+ }, {
176
+ "type": 0,
177
+ "value": "?"
178
+ }]
179
+ }), generalError ? /*#__PURE__*/jsx("p", {
180
+ className: "text-danger",
181
+ children: /*#__PURE__*/jsx(FormattedMessage, {
182
+ id: "y9zauY",
183
+ defaultMessage: [{
184
+ "type": 0,
185
+ "value": "An error occured and we could not delete this item successfully."
186
+ }]
187
+ })
188
+ }) : null]
189
+ }), /*#__PURE__*/jsxs("div", {
190
+ className: "card-body d-flex",
191
+ children: [previous !== null ? /*#__PURE__*/jsx(Button, {
192
+ href: previous,
193
+ className: "me-2",
194
+ theme: "secondary",
195
+ outline: true,
196
+ children: /*#__PURE__*/jsx(FormattedMessage, {
197
+ id: "PyxZY2",
198
+ defaultMessage: [{
199
+ "type": 0,
200
+ "value": "Cancel"
201
+ }]
202
+ })
203
+ }) : null, /*#__PURE__*/jsx(Button, {
204
+ type: "submit",
205
+ className: "ms-auto",
206
+ theme: "warning",
207
+ disabled: loading,
208
+ children: /*#__PURE__*/jsx(FormattedMessage, {
209
+ id: "HzCxmr",
210
+ defaultMessage: [{
211
+ "type": 0,
212
+ "value": "Duplicate"
213
+ }]
214
+ })
215
+ })]
216
+ })]
217
+ })
218
+ }));
202
219
  }
203
220
 
204
221
  var _excluded = ["component", "header", "resource", "onSuccess", "item", "type", "isDelete", "isDuplicate", "isModal", "withContainer"];
@@ -379,7 +396,7 @@ function ResourceForm(_ref) {
379
396
  useEffect(function () {
380
397
  setValue(getInitialValue());
381
398
  }, [getInitialValue, setValue]);
382
- var element = /*#__PURE__*/React.createElement(FormComponent, Object.assign({}, props, {
399
+ var element = /*#__PURE__*/jsx(FormComponent, _objectSpread(_objectSpread({}, props), {}, {
383
400
  status: status,
384
401
  resource: resource,
385
402
  item: item,
@@ -393,18 +410,22 @@ function ResourceForm(_ref) {
393
410
  onChange: setValue,
394
411
  loading: loading
395
412
  }));
396
- return /*#__PURE__*/React.createElement(FormProvider, {
413
+ return /*#__PURE__*/jsxs(FormProvider, {
397
414
  value: value,
398
- setValue: setValue
399
- }, finalWithHeader ? header : /*#__PURE__*/React.createElement("div", {
400
- className: "w-100 mb-3"
401
- }), finalWithContainer ? /*#__PURE__*/React.createElement("div", {
402
- className: "container-sm py-4"
403
- }, /*#__PURE__*/React.createElement("div", {
404
- className: "row justify-content-center"
405
- }, /*#__PURE__*/React.createElement("div", {
406
- className: "col-12 col-md-8 col-lg-7"
407
- }, element))) : element);
415
+ setValue: setValue,
416
+ children: [finalWithHeader ? header : /*#__PURE__*/jsx("div", {
417
+ className: "w-100 mb-3"
418
+ }), finalWithContainer ? /*#__PURE__*/jsx("div", {
419
+ className: "container-sm py-4",
420
+ children: /*#__PURE__*/jsx("div", {
421
+ className: "row justify-content-center",
422
+ children: /*#__PURE__*/jsx("div", {
423
+ className: "col-12 col-md-8 col-lg-7",
424
+ children: element
425
+ })
426
+ })
427
+ }) : element]
428
+ });
408
429
  }
409
430
 
410
431
  export { ResourceForm as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/form-resource",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Default resource forms",
5
5
  "keywords": [
6
6
  "javascript"
@@ -54,7 +54,7 @@
54
54
  "@panneau/element-button": "^4.0.2",
55
55
  "@panneau/element-form": "^4.0.2",
56
56
  "@panneau/field-fields": "^4.0.2",
57
- "@panneau/intl": "^4.0.2",
57
+ "@panneau/intl": "^4.0.3",
58
58
  "@panneau/themes": "^4.0.2",
59
59
  "classnames": "^2.5.1",
60
60
  "lodash-es": "^4.17.21",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "53ad0f27e467992c23158732e0f7d39d8615780b"
67
+ "gitHead": "26b5ab7536b0e8c3197d40d302fc2681e7c7122e"
68
68
  }