@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 CHANGED
@@ -146,7 +146,7 @@ declare const DropdownElement: {
146
146
 
147
147
  type TProps$b = {
148
148
  accessor: IconName;
149
- type?: 'brands' | 'light' | 'regular' | 'solid';
149
+ type?: 'brands' | 'light' | 'regular' | 'solid' | 'thin';
150
150
  className?: string;
151
151
  };
152
152
  declare const IconElement: FC<TProps$b>;
@@ -1039,12 +1039,13 @@ type TFileInputGroupFormProps = {
1039
1039
  isDisabled?: boolean;
1040
1040
  isRequired?: boolean;
1041
1041
  isTouched?: boolean;
1042
+ isMulti?: boolean;
1042
1043
  children?: (props: {
1043
1044
  value?: TFileType;
1044
1045
  isDragging: boolean;
1045
1046
  }) => ReactNode;
1046
- onChange: any;
1047
- onBlur: any;
1047
+ onChange: (files: TFileType[]) => void;
1048
+ onBlur: FocusEventHandler<HTMLInputElement>;
1048
1049
  styles?: TFileInputGroupFormStyles;
1049
1050
  };
1050
1051
  declare const FileInputGroupForm: FC<TFileInputGroupFormProps>;
package/dist/index.esm.js CHANGED
@@ -8,6 +8,7 @@ import { fab } from '@fortawesome/free-brands-svg-icons';
8
8
  import { fal } from '@fortawesome/pro-light-svg-icons';
9
9
  import { far } from '@fortawesome/pro-regular-svg-icons';
10
10
  import { fas } from '@fortawesome/pro-solid-svg-icons';
11
+ import { fat } from '@fortawesome/pro-thin-svg-icons';
11
12
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
12
13
  import { Menu, Transition, Dialog, Popover, Switch } from '@headlessui/react';
13
14
  import { useMask } from '@react-input/mask';
@@ -297,6 +298,12 @@ var IconElement = function (props) {
297
298
  }
298
299
  component = (jsx(FontAwesomeIcon, { icon: ['fas', accessor], className: className }));
299
300
  break;
301
+ case 'thin':
302
+ if (!(library === null || library === void 0 ? void 0 : library.definitions.fat)) {
303
+ library.add(fat);
304
+ }
305
+ component = (jsx(FontAwesomeIcon, { icon: ['fat', accessor], className: className }));
306
+ break;
300
307
  }
301
308
  return component;
302
309
  };
@@ -4717,34 +4724,40 @@ function reducer(state, action) {
4717
4724
  function noop() {}
4718
4725
 
4719
4726
  var FileInputGroupForm = function (props) {
4720
- 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;
4727
+ 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;
4721
4728
  var isValid = error === undefined;
4722
- var _d = useState(false), isDragging = _d[0], setIsDragging = _d[1];
4723
- var handleChangeInput = useCallback(function (file) {
4724
- var reader = new FileReader();
4725
- reader === null || reader === void 0 ? void 0 : reader.readAsDataURL(file);
4726
- reader.onload = function () {
4727
- var result = {
4728
- name: file.name,
4729
- size: file.size,
4730
- type: file.type,
4731
- blob: reader === null || reader === void 0 ? void 0 : reader.result,
4732
- file: file,
4729
+ var _e = useState(false), isDragging = _e[0], setIsDragging = _e[1];
4730
+ var handleChangeInput = useCallback(function (files) {
4731
+ var results = [];
4732
+ forEach(files, function (file, index, files) {
4733
+ var reader = new FileReader();
4734
+ reader === null || reader === void 0 ? void 0 : reader.readAsDataURL(file);
4735
+ reader.onload = function () {
4736
+ var result = {
4737
+ name: file.name,
4738
+ size: file.size,
4739
+ type: file.type,
4740
+ blob: reader === null || reader === void 0 ? void 0 : reader.result,
4741
+ file: file,
4742
+ };
4743
+ // eg. 10 * 1024 * 1024
4744
+ if (max && max * 1024 * 1024 < result.size) {
4745
+ return;
4746
+ }
4747
+ results.push(result);
4748
+ if (index === files.length - 1) {
4749
+ onChange(results);
4750
+ }
4733
4751
  };
4734
- // eg. 10 * 1024 * 1024
4735
- if (max && max * 1024 * 1024 < result.size) {
4736
- return;
4737
- }
4738
- onChange(result);
4739
- };
4752
+ });
4740
4753
  }, [max, onChange]);
4741
4754
  var onDrop = useCallback(function (files) {
4742
4755
  setIsDragging(false);
4743
- handleChangeInput(files[0]);
4756
+ handleChangeInput(files);
4744
4757
  }, [handleChangeInput]);
4745
- var _e = useDropzone({
4758
+ var _f = useDropzone({
4746
4759
  onDrop: onDrop,
4747
- multiple: false,
4760
+ multiple: isMulti,
4748
4761
  onError: function () {
4749
4762
  // console.log('error');
4750
4763
  // setFieldError('file', t('component.form.error.multipleFiles') as string);
@@ -4755,7 +4768,7 @@ var FileInputGroupForm = function (props) {
4755
4768
  onDragLeave: function () {
4756
4769
  setIsDragging(false);
4757
4770
  },
4758
- }), getRootProps = _e.getRootProps, getInputProps = _e.getInputProps;
4771
+ }), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps;
4759
4772
  var handleGenerateStyle = function () {
4760
4773
  var result = deepCopyObject(styles$3.base);
4761
4774
  var keys = calculateNestedKeys(styles$3.base);