@panneau/action-duplicate 4.0.1 → 4.0.4

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 +61 -54
  2. package/package.json +5 -5
package/es/index.js CHANGED
@@ -1,13 +1,15 @@
1
+ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
1
2
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
4
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
5
  import { postJSON, getCSRFHeaders } from '@folklore/fetch';
5
6
  import classNames from 'classnames';
6
- import React, { useState, useCallback } from 'react';
7
+ import { useState, useCallback } from 'react';
7
8
  import { FormattedMessage } from 'react-intl';
8
9
  import { useModalsComponentsManager } from '@panneau/core/contexts';
9
10
  import { useActionProps } from '@panneau/core/hooks';
10
11
  import Button from '@panneau/element-button';
12
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
11
13
 
12
14
  var _excluded = ["id", "title", "description", "endpoint", "action", "label", "icon", "value", "theme", "disabled", "onChange", "onConfirmed", "valueLabelPath", "modalComponent", "withConfirmation", "className"];
13
15
  function DuplicateAction(_ref) {
@@ -43,7 +45,7 @@ function DuplicateAction(_ref) {
43
45
  _ref$className = _ref.className,
44
46
  className = _ref$className === void 0 ? null : _ref$className,
45
47
  props = _objectWithoutProperties(_ref, _excluded);
46
- var label = initialLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
48
+ var label = initialLabel || /*#__PURE__*/jsx(FormattedMessage, {
47
49
  id: "HzCxmr",
48
50
  defaultMessage: [{
49
51
  "type": 0,
@@ -88,65 +90,70 @@ function DuplicateAction(_ref) {
88
90
  setError(err);
89
91
  });
90
92
  }, [ids, endpoint, action, onChange, onClose, setError, onConfirmed]);
91
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, Object.assign({
92
- className: classNames([_defineProperty({}, className, className !== null)]),
93
- label: label,
94
- icon: icon,
95
- onClick: withConfirmation ? onOpen : null,
96
- disabled: disabled,
97
- theme: disabled ? 'secondary' : theme
98
- }, props)), modalOpen ? /*#__PURE__*/React.createElement(ModalComponent, {
99
- id: modalKey,
100
- title: title || /*#__PURE__*/React.createElement(FormattedMessage, {
101
- id: "8T+JE7",
102
- defaultMessage: [{
103
- "type": 0,
104
- "value": "Duplicate"
105
- }]
106
- }),
107
- onConfirm: onConfirm,
108
- onClose: onClose,
109
- confirmButton: {
110
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
111
- id: "UaVu03",
93
+ return /*#__PURE__*/jsxs(Fragment, {
94
+ children: [/*#__PURE__*/jsx(Button, _objectSpread({
95
+ className: classNames([_defineProperty({}, className, className !== null)]),
96
+ label: label,
97
+ icon: icon,
98
+ onClick: withConfirmation ? onOpen : null,
99
+ disabled: disabled,
100
+ theme: disabled ? 'secondary' : theme
101
+ }, props)), modalOpen ? /*#__PURE__*/jsxs(ModalComponent, {
102
+ id: modalKey,
103
+ title: title || /*#__PURE__*/jsx(FormattedMessage, {
104
+ id: "8T+JE7",
112
105
  defaultMessage: [{
113
106
  "type": 0,
114
- "value": "Confirm"
107
+ "value": "Duplicate"
115
108
  }]
116
109
  }),
117
- theme: 'danger'
118
- },
119
- cancelButton: {
120
- label: /*#__PURE__*/React.createElement(FormattedMessage, {
121
- id: "PyxZY2",
110
+ onConfirm: onConfirm,
111
+ onClose: onClose,
112
+ confirmButton: {
113
+ label: /*#__PURE__*/jsx(FormattedMessage, {
114
+ id: "UaVu03",
115
+ defaultMessage: [{
116
+ "type": 0,
117
+ "value": "Confirm"
118
+ }]
119
+ }),
120
+ theme: 'danger'
121
+ },
122
+ cancelButton: {
123
+ label: /*#__PURE__*/jsx(FormattedMessage, {
124
+ id: "PyxZY2",
125
+ defaultMessage: [{
126
+ "type": 0,
127
+ "value": "Cancel"
128
+ }]
129
+ })
130
+ },
131
+ children: [description !== null ? description : /*#__PURE__*/jsx("p", {
132
+ children: /*#__PURE__*/jsx(FormattedMessage, {
133
+ id: "XmY7D8",
134
+ defaultMessage: [{
135
+ "type": 0,
136
+ "value": "The following items will be duplicated: "
137
+ }, {
138
+ "type": 1,
139
+ "value": "ids"
140
+ }, {
141
+ "type": 0,
142
+ "value": ". Are you sure you want to continue?"
143
+ }],
144
+ values: {
145
+ ids: idLabels
146
+ }
147
+ })
148
+ }), error !== null ? /*#__PURE__*/jsx(FormattedMessage, {
149
+ id: "cutyQH",
122
150
  defaultMessage: [{
123
151
  "type": 0,
124
- "value": "Cancel"
152
+ "value": "An error has occured."
125
153
  }]
126
- })
127
- }
128
- }, description !== null ? description : /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(FormattedMessage, {
129
- id: "XmY7D8",
130
- defaultMessage: [{
131
- "type": 0,
132
- "value": "The following items will be duplicated: "
133
- }, {
134
- "type": 1,
135
- "value": "ids"
136
- }, {
137
- "type": 0,
138
- "value": ". Are you sure you want to continue?"
139
- }],
140
- values: {
141
- ids: idLabels
142
- }
143
- })), error !== null ? /*#__PURE__*/React.createElement(FormattedMessage, {
144
- id: "cutyQH",
145
- defaultMessage: [{
146
- "type": 0,
147
- "value": "An error has occured."
148
- }]
149
- }) : null) : null);
154
+ }) : null]
155
+ }) : null]
156
+ });
150
157
  }
151
158
 
152
159
  export { DuplicateAction as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/action-duplicate",
3
- "version": "4.0.1",
3
+ "version": "4.0.4",
4
4
  "description": "Duplicate action",
5
5
  "keywords": [
6
6
  "javascript"
@@ -50,9 +50,9 @@
50
50
  "dependencies": {
51
51
  "@babel/runtime": "^7.12.5",
52
52
  "@folklore/fetch": "^0.1.21",
53
- "@panneau/core": "^4.0.1",
54
- "@panneau/element-button": "^4.0.1",
55
- "@panneau/themes": "^4.0.1",
53
+ "@panneau/core": "^4.0.4",
54
+ "@panneau/element-button": "^4.0.4",
55
+ "@panneau/themes": "^4.0.4",
56
56
  "classnames": "^2.5.1",
57
57
  "prop-types": "^15.7.2",
58
58
  "react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "dbdf65640625c027ecd56cf2b816b80a5c38cb8d"
63
+ "gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
64
64
  }