@cashub/ui 0.12.0 → 0.12.2

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.
package/button/Button.js CHANGED
@@ -13,7 +13,7 @@ var _backgroundColor = _interopRequireDefault(require("../styles/mixin/backgroun
13
13
 
14
14
  var _colorOnBackground = _interopRequireDefault(require("../styles/mixin/colorOnBackground"));
15
15
 
16
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
16
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
@@ -27,7 +27,7 @@ var Button = _styledComponents.default.button.attrs(function () {
27
27
  return {
28
28
  primary: true
29
29
  };
30
- })(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n border: none;\n font-size: var(--font-button);\n line-height: var(--font-body1);\n cursor: ", ";\n border-radius: var(--border-radius-l);\n padding: 10px var(--spacing-s);\n text-transform: uppercase;\n\n > svg {\n margin-right: calc(var(--spacing-s) - 0.25rem);\n font-size: var(--font-body1);\n }\n\n &:hover {\n ", "\n }\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
30
+ })(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n border: none;\n font-size: var(--font-button);\n line-height: var(--font-body1);\n cursor: ", ";\n border-radius: var(--border-radius-l);\n padding: 10px var(--spacing-s);\n text-transform: uppercase;\n\n > svg {\n margin-right: calc(var(--spacing-s) - 0.25rem);\n font-size: var(--font-body1);\n }\n\n &:hover {\n ", "\n }\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
31
31
  var disabled = _ref.disabled;
32
32
  return disabled ? 'no-drop' : 'pointer';
33
33
  }, function (_ref2) {
@@ -51,6 +51,9 @@ var Button = _styledComponents.default.button.attrs(function () {
51
51
  }, function (_ref8) {
52
52
  var alignCenter = _ref8.alignCenter;
53
53
  return alignCenter && 'justify-content: center;';
54
+ }, function (_ref9) {
55
+ var filterFocus = _ref9.filterFocus;
56
+ return filterFocus && (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n border: 2px solid var(--font-on-danger);\n "])));
54
57
  });
55
58
 
56
59
  var _default = Button;
@@ -136,28 +136,33 @@ var ImageDropzone = function ImageDropzone(_ref) {
136
136
  };
137
137
 
138
138
  var handleAddFiles = (0, _react.useCallback)(function (newFiles) {
139
- if (files.length + newFiles.length > maxFiles) {
140
- newFiles.splice(maxFiles - files.length);
141
- }
139
+ setFiles(function (previous) {
140
+ if (previous.length + newFiles.length > maxFiles) {
141
+ newFiles.splice(maxFiles - previous.length);
142
+ }
143
+
144
+ return [].concat(_toConsumableArray(previous), _toConsumableArray(newFiles));
145
+ });
142
146
 
143
147
  for (var index = 0; index < newFiles.length; index += 1) {
144
148
  newFiles[index].url = URL.createObjectURL(newFiles[index]);
145
149
  }
146
150
 
147
- setFiles([].concat(_toConsumableArray(files), _toConsumableArray(newFiles)));
148
151
  setAddedFiles(newFiles);
149
- }, [files, maxFiles]);
152
+ }, [maxFiles]);
150
153
  var handleRemoveFile = (0, _react.useCallback)(function (event, index) {
151
154
  if (event) {
152
155
  event.stopPropagation();
153
156
  }
154
157
 
155
- var newFiles = _toConsumableArray(files);
158
+ setFiles(function (previous) {
159
+ var newFiles = _toConsumableArray(previous);
156
160
 
157
- newFiles.splice(index, 1);
158
- setFiles(newFiles);
161
+ newFiles.splice(index, 1);
162
+ return newFiles;
163
+ });
159
164
  if (onRemovedFile) onRemovedFile(index);
160
- }, [files, onRemovedFile]);
165
+ }, [onRemovedFile]);
161
166
  var handleChangeFile = (0, _react.useCallback)(function (event) {
162
167
  var files = event.target.files;
163
168
  var newFiles = [];
@@ -190,7 +195,7 @@ var ImageDropzone = function ImageDropzone(_ref) {
190
195
  });
191
196
  }
192
197
  });
193
- }, [cropper]);
198
+ }, [width, height, cropper]);
194
199
 
195
200
  var previewItem = function previewItem() {
196
201
  return files.map(function (file, index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "private": false,
5
5
  "author": "CASHUB Team",
6
6
  "description": "CASHUB UI components library",