@open-tender/utils 0.1.15 → 0.1.16

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.
@@ -5,7 +5,7 @@ export declare const useAddressForm: (address: Address, loading: RequestStatus,
5
5
  data: Address;
6
6
  errors: any;
7
7
  submitting: boolean;
8
- handleChange: (name: string, type: string, value: string | null, checked: boolean | null) => void;
8
+ handleChange: (name: string, value: string | number | boolean) => void;
9
9
  handleSubmit: (evt?: any) => void;
10
10
  submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
11
11
  inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
@@ -51,12 +51,8 @@ const useAddressForm = (address, loading, error, update, callback) => {
51
51
  }
52
52
  }
53
53
  }, [loading, error]);
54
- const handleChange = (name, type, value, checked) => {
55
- const inputValue = type === 'checkbox'
56
- ? checked
57
- : name === 'phone'
58
- ? (0, utils_1.makePhone)(value !== null && value !== void 0 ? value : '')
59
- : value;
54
+ const handleChange = (name, value) => {
55
+ const inputValue = name === 'phone' ? (0, utils_1.makePhone)((value !== null && value !== void 0 ? value : '')) : value;
60
56
  setData(Object.assign(Object.assign({}, data), { [name]: inputValue }));
61
57
  };
62
58
  const handleSubmit = (evt) => {
@@ -5,7 +5,7 @@ export declare const useAddressForm: (address: Address, loading: RequestStatus,
5
5
  data: Address;
6
6
  errors: any;
7
7
  submitting: boolean;
8
- handleChange: (name: string, type: string, value: string | null, checked: boolean | null) => void;
8
+ handleChange: (name: string, value: string | number | boolean) => void;
9
9
  handleSubmit: (evt?: any) => void;
10
10
  submitRef: import("react").MutableRefObject<HTMLButtonElement | null>;
11
11
  inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
@@ -48,12 +48,8 @@ export const useAddressForm = (address, loading, error, update, callback) => {
48
48
  }
49
49
  }
50
50
  }, [loading, error]);
51
- const handleChange = (name, type, value, checked) => {
52
- const inputValue = type === 'checkbox'
53
- ? checked
54
- : name === 'phone'
55
- ? makePhone(value !== null && value !== void 0 ? value : '')
56
- : value;
51
+ const handleChange = (name, value) => {
52
+ const inputValue = name === 'phone' ? makePhone((value !== null && value !== void 0 ? value : '')) : value;
57
53
  setData(Object.assign(Object.assign({}, data), { [name]: inputValue }));
58
54
  };
59
55
  const handleSubmit = (evt) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",