@ballistix.digital/react-components 0.8.2 → 0.9.0
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/dist/index.d.ts +4 -3
- package/dist/index.esm.js +35 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +35 -22
- package/dist/index.js.map +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var freeBrandsSvgIcons = require('@fortawesome/free-brands-svg-icons');
|
|
|
10
10
|
var proLightSvgIcons = require('@fortawesome/pro-light-svg-icons');
|
|
11
11
|
var proRegularSvgIcons = require('@fortawesome/pro-regular-svg-icons');
|
|
12
12
|
var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
13
|
+
var proThinSvgIcons = require('@fortawesome/pro-thin-svg-icons');
|
|
13
14
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
14
15
|
var react = require('@headlessui/react');
|
|
15
16
|
var mask = require('@react-input/mask');
|
|
@@ -299,6 +300,12 @@ var IconElement = function (props) {
|
|
|
299
300
|
}
|
|
300
301
|
component = (jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: ['fas', accessor], className: className }));
|
|
301
302
|
break;
|
|
303
|
+
case 'thin':
|
|
304
|
+
if (!(fontawesomeSvgCore.library === null || fontawesomeSvgCore.library === void 0 ? void 0 : fontawesomeSvgCore.library.definitions.fat)) {
|
|
305
|
+
fontawesomeSvgCore.library.add(proThinSvgIcons.fat);
|
|
306
|
+
}
|
|
307
|
+
component = (jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: ['fat', accessor], className: className }));
|
|
308
|
+
break;
|
|
302
309
|
}
|
|
303
310
|
return component;
|
|
304
311
|
};
|
|
@@ -4719,34 +4726,40 @@ function reducer(state, action) {
|
|
|
4719
4726
|
function noop() {}
|
|
4720
4727
|
|
|
4721
4728
|
var FileInputGroupForm = function (props) {
|
|
4722
|
-
var _a = props.name, name = _a === void 0 ? 'multiple-file-input' : _a, label = props.label, description = props.description, required = props.required, value = props.value, max = props.max, error = props.error, isDisabled = props.isDisabled, _b = props.isRequired, isRequired = _b === void 0 ? false : _b, _c = props.isTouched, isTouched = _c === void 0 ? false : _c, children = props.children, onChange = props.onChange, onBlur = props.onBlur, stylesOverrides = props.styles;
|
|
4729
|
+
var _a = props.name, name = _a === void 0 ? 'multiple-file-input' : _a, label = props.label, description = props.description, required = props.required, value = props.value, max = props.max, error = props.error, isDisabled = props.isDisabled, _b = props.isRequired, isRequired = _b === void 0 ? false : _b, _c = props.isTouched, isTouched = _c === void 0 ? false : _c, _d = props.isMulti, isMulti = _d === void 0 ? false : _d, children = props.children, onChange = props.onChange, onBlur = props.onBlur, stylesOverrides = props.styles;
|
|
4723
4730
|
var isValid = error === undefined;
|
|
4724
|
-
var
|
|
4725
|
-
var handleChangeInput = React.useCallback(function (
|
|
4726
|
-
var
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4731
|
+
var _e = React.useState(false), isDragging = _e[0], setIsDragging = _e[1];
|
|
4732
|
+
var handleChangeInput = React.useCallback(function (files) {
|
|
4733
|
+
var results = [];
|
|
4734
|
+
lodash.forEach(files, function (file, index, files) {
|
|
4735
|
+
var reader = new FileReader();
|
|
4736
|
+
reader === null || reader === void 0 ? void 0 : reader.readAsDataURL(file);
|
|
4737
|
+
reader.onload = function () {
|
|
4738
|
+
var result = {
|
|
4739
|
+
name: file.name,
|
|
4740
|
+
size: file.size,
|
|
4741
|
+
type: file.type,
|
|
4742
|
+
blob: reader === null || reader === void 0 ? void 0 : reader.result,
|
|
4743
|
+
file: file,
|
|
4744
|
+
};
|
|
4745
|
+
// eg. 10 * 1024 * 1024
|
|
4746
|
+
if (max && max * 1024 * 1024 < result.size) {
|
|
4747
|
+
return;
|
|
4748
|
+
}
|
|
4749
|
+
results.push(result);
|
|
4750
|
+
if (index === files.length - 1) {
|
|
4751
|
+
onChange(results);
|
|
4752
|
+
}
|
|
4735
4753
|
};
|
|
4736
|
-
|
|
4737
|
-
if (max && max * 1024 * 1024 < result.size) {
|
|
4738
|
-
return;
|
|
4739
|
-
}
|
|
4740
|
-
onChange(result);
|
|
4741
|
-
};
|
|
4754
|
+
});
|
|
4742
4755
|
}, [max, onChange]);
|
|
4743
4756
|
var onDrop = React.useCallback(function (files) {
|
|
4744
4757
|
setIsDragging(false);
|
|
4745
|
-
handleChangeInput(files
|
|
4758
|
+
handleChangeInput(files);
|
|
4746
4759
|
}, [handleChangeInput]);
|
|
4747
|
-
var
|
|
4760
|
+
var _f = useDropzone({
|
|
4748
4761
|
onDrop: onDrop,
|
|
4749
|
-
multiple:
|
|
4762
|
+
multiple: isMulti,
|
|
4750
4763
|
onError: function () {
|
|
4751
4764
|
// console.log('error');
|
|
4752
4765
|
// setFieldError('file', t('component.form.error.multipleFiles') as string);
|
|
@@ -4757,7 +4770,7 @@ var FileInputGroupForm = function (props) {
|
|
|
4757
4770
|
onDragLeave: function () {
|
|
4758
4771
|
setIsDragging(false);
|
|
4759
4772
|
},
|
|
4760
|
-
}), getRootProps =
|
|
4773
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps;
|
|
4761
4774
|
var handleGenerateStyle = function () {
|
|
4762
4775
|
var result = deepCopyObject(styles$3.base);
|
|
4763
4776
|
var keys = calculateNestedKeys(styles$3.base);
|