@panneau/action-upload 4.0.39 → 4.0.40-alpha.1

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/dist/index.js +120 -46
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,53 +1,127 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
- import { useCallback } from 'react';
1
+ import { c } from 'react/compiler-runtime';
4
2
  import { FormattedMessage } from 'react-intl';
5
3
  import { useFieldsComponentsManager } from '@panneau/core/contexts';
6
4
  import { jsx } from 'react/jsx-runtime';
7
5
 
8
- var _excluded = ["endpoint", "action", "label", "value", "icon", "theme", "disabled", "onConfirmed", "fieldComponent", "className"];
9
- function UploadAction(_ref) {
10
- _ref.endpoint;
11
- _ref.action;
12
- var _ref$label = _ref.label,
13
- label = _ref$label === void 0 ? null : _ref$label;
14
- _ref.value;
15
- var _ref$icon = _ref.icon,
16
- icon = _ref$icon === void 0 ? 'upload' : _ref$icon,
17
- _ref$theme = _ref.theme,
18
- theme = _ref$theme === void 0 ? 'primary' : _ref$theme,
19
- _ref$disabled = _ref.disabled,
20
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21
- _ref$onConfirmed = _ref.onConfirmed,
22
- onConfirmed = _ref$onConfirmed === void 0 ? null : _ref$onConfirmed,
23
- _ref$fieldComponent = _ref.fieldComponent,
24
- fieldComponent = _ref$fieldComponent === void 0 ? 'upload' : _ref$fieldComponent,
25
- _ref$className = _ref.className,
26
- className = _ref$className === void 0 ? null : _ref$className,
27
- props = _objectWithoutProperties(_ref, _excluded);
28
- var FieldComponents = useFieldsComponentsManager();
29
- var FieldComponent = FieldComponents.getComponent(fieldComponent);
30
- var onComplete = useCallback(function (data) {
31
- if (onConfirmed !== null) {
32
- onConfirmed(data);
33
- }
34
- }, [onConfirmed]);
35
- return /*#__PURE__*/jsx(FieldComponent, _objectSpread({
36
- withButton: true,
37
- outline: false,
38
- theme: theme,
39
- addButtonIcon: icon,
40
- addButtonLabel: label || /*#__PURE__*/jsx(FormattedMessage, {
41
- id: "eL+nIp",
42
- defaultMessage: [{
43
- "type": 0,
44
- "value": "Add file"
45
- }]
46
- }),
47
- onChange: onComplete,
48
- disabled: disabled,
49
- className: className
50
- }, props));
6
+ function UploadAction(t0) {
7
+ const $ = c(28);
8
+ let props;
9
+ let t1;
10
+ let t10;
11
+ let t2;
12
+ let t3;
13
+ let t4;
14
+ let t5;
15
+ let t6;
16
+ let t7;
17
+ let t8;
18
+ let t9;
19
+ if ($[0] !== t0) {
20
+ ({
21
+ endpoint: t1,
22
+ action: t2,
23
+ label: t3,
24
+ value: t4,
25
+ icon: t5,
26
+ theme: t6,
27
+ disabled: t7,
28
+ onConfirmed: t8,
29
+ fieldComponent: t9,
30
+ className: t10,
31
+ ...props
32
+ } = t0);
33
+ $[0] = t0;
34
+ $[1] = props;
35
+ $[2] = t1;
36
+ $[3] = t10;
37
+ $[4] = t2;
38
+ $[5] = t3;
39
+ $[6] = t4;
40
+ $[7] = t5;
41
+ $[8] = t6;
42
+ $[9] = t7;
43
+ $[10] = t8;
44
+ $[11] = t9;
45
+ } else {
46
+ props = $[1];
47
+ t1 = $[2];
48
+ t10 = $[3];
49
+ t2 = $[4];
50
+ t3 = $[5];
51
+ t4 = $[6];
52
+ t5 = $[7];
53
+ t6 = $[8];
54
+ t7 = $[9];
55
+ t8 = $[10];
56
+ t9 = $[11];
57
+ }
58
+ const label = t3 === undefined ? null : t3;
59
+ const icon = t5 === undefined ? "upload" : t5;
60
+ const theme = t6 === undefined ? "primary" : t6;
61
+ const disabled = t7 === undefined ? false : t7;
62
+ const onConfirmed = t8 === undefined ? null : t8;
63
+ const fieldComponent = t9 === undefined ? "upload" : t9;
64
+ const className = t10 === undefined ? null : t10;
65
+ const FieldComponents = useFieldsComponentsManager();
66
+ let t11;
67
+ if ($[12] !== FieldComponents || $[13] !== fieldComponent) {
68
+ t11 = FieldComponents.getComponent(fieldComponent);
69
+ $[12] = FieldComponents;
70
+ $[13] = fieldComponent;
71
+ $[14] = t11;
72
+ } else {
73
+ t11 = $[14];
74
+ }
75
+ const FieldComponent = t11;
76
+ let t12;
77
+ if ($[15] !== onConfirmed) {
78
+ t12 = data => {
79
+ if (onConfirmed !== null) {
80
+ onConfirmed(data);
81
+ }
82
+ };
83
+ $[15] = onConfirmed;
84
+ $[16] = t12;
85
+ } else {
86
+ t12 = $[16];
87
+ }
88
+ const onComplete = t12;
89
+ let t13;
90
+ if ($[17] !== label) {
91
+ t13 = label || /*#__PURE__*/jsx(FormattedMessage, {
92
+ id: "eL+nIp"
93
+ });
94
+ $[17] = label;
95
+ $[18] = t13;
96
+ } else {
97
+ t13 = $[18];
98
+ }
99
+ let t14;
100
+ if ($[19] !== FieldComponent || $[20] !== className || $[21] !== disabled || $[22] !== icon || $[23] !== onComplete || $[24] !== props || $[25] !== t13 || $[26] !== theme) {
101
+ t14 = /*#__PURE__*/jsx(FieldComponent, {
102
+ withButton: true,
103
+ outline: false,
104
+ theme: theme,
105
+ addButtonIcon: icon,
106
+ addButtonLabel: t13,
107
+ onChange: onComplete,
108
+ disabled: disabled,
109
+ className: className,
110
+ ...props
111
+ });
112
+ $[19] = FieldComponent;
113
+ $[20] = className;
114
+ $[21] = disabled;
115
+ $[22] = icon;
116
+ $[23] = onComplete;
117
+ $[24] = props;
118
+ $[25] = t13;
119
+ $[26] = theme;
120
+ $[27] = t14;
121
+ } else {
122
+ t14 = $[27];
123
+ }
124
+ return t14;
51
125
  }
52
126
 
53
127
  export { UploadAction as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/action-upload",
3
- "version": "4.0.39",
3
+ "version": "4.0.40-alpha.1",
4
4
  "description": "Upload action",
5
5
  "keywords": [
6
6
  "javascript"
@@ -52,15 +52,15 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@babel/runtime": "^7.28.6",
55
- "@panneau/core": "^4.0.38",
56
- "@panneau/element-button": "^4.0.39",
57
- "@panneau/field-upload": "^4.0.39",
58
- "@panneau/themes": "^4.0.38",
55
+ "@panneau/core": "^4.0.40-alpha.1",
56
+ "@panneau/element-button": "^4.0.40-alpha.1",
57
+ "@panneau/field-upload": "^4.0.40-alpha.1",
58
+ "@panneau/themes": "^4.0.40-alpha.1",
59
59
  "classnames": "^2.5.1",
60
60
  "react-intl": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "621c5233f083c1ba95cd46cd427c38361723d5d6"
65
+ "gitHead": "66520f92373b3aa371222b354d60ed3cf3d20c96"
66
66
  }