@onewelcome/react-lib-components 1.6.0 → 1.7.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/README.md +4 -4
- package/dist/Form/FileUpload/FileItem/FileItem.d.ts +17 -0
- package/dist/Form/FileUpload/FileUpload.d.ts +26 -0
- package/dist/Icon/Icon.d.ts +4 -1
- package/dist/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/_BaseStyling_/BaseStyling.d.ts +3 -0
- package/dist/hooks/useUploadFile.d.ts +22 -0
- package/dist/react-lib-components.cjs.development.js +60 -53
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +60 -53
- package/dist/react-lib-components.esm.js.map +1 -1
- package/dist/util/helper.d.ts +5 -0
- package/package.json +24 -21
- package/src/Form/FileUpload/FileItem/FileItem.modules.scss +75 -0
- package/src/Form/FileUpload/FileItem/FileItem.test.tsx +103 -0
- package/src/Form/FileUpload/FileItem/FileItem.tsx +141 -0
- package/src/Form/FileUpload/FileUpload.module.scss +106 -0
- package/src/Form/FileUpload/FileUpload.test.tsx +374 -0
- package/src/Form/FileUpload/FileUpload.tsx +251 -0
- package/src/Form/Input/Input.module.scss +0 -1
- package/src/Icon/Icon.module.scss +12 -0
- package/src/Icon/Icon.tsx +4 -1
- package/src/ProgressBar/ProgressBar.module.scss +11 -9
- package/src/ProgressBar/ProgressBar.test.tsx +21 -0
- package/src/ProgressBar/ProgressBar.tsx +7 -2
- package/src/Typography/Typography.module.scss +2 -2
- package/src/_BaseStyling_/BaseStyling.tsx +9 -3
- package/src/hooks/useUploadFile.test.ts +211 -0
- package/src/hooks/useUploadFile.tsx +136 -0
- package/src/mixins.module.scss +24 -5
- package/src/util/helper.test.tsx +156 -1
- package/src/util/helper.tsx +33 -0
package/src/util/helper.tsx
CHANGED
|
@@ -143,3 +143,36 @@ export const throttle = (fn: (...args: unknown[]) => unknown, delay: number) =>
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
};
|
|
146
|
+
|
|
147
|
+
export const isEqual = (x: any, y: any): boolean => {
|
|
148
|
+
const typesCoincide = x && y && typeof x === "object" && typeof y === "object";
|
|
149
|
+
return typesCoincide
|
|
150
|
+
? Object.keys(x).length === Object.keys(y).length &&
|
|
151
|
+
Object.keys(x).every(key => isEqual(x[key], y[key]))
|
|
152
|
+
: x === y;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const areArraysDifferent = (
|
|
156
|
+
arr1: Record<string, any>[],
|
|
157
|
+
arr2: Record<string, any>[],
|
|
158
|
+
key: string
|
|
159
|
+
) => {
|
|
160
|
+
if (arr1.length !== arr2.length) {
|
|
161
|
+
return true;
|
|
162
|
+
} else {
|
|
163
|
+
const firstFilteredArray = arr1.filter(arr1Item =>
|
|
164
|
+
arr2.some((arr2Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))
|
|
165
|
+
);
|
|
166
|
+
const secondFilteredArray = arr2.filter(arr2Item =>
|
|
167
|
+
arr1.some((arr1Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
return !!firstFilteredArray.length || !!secondFilteredArray.length;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const getValueByPath = (obj: { [key: string]: any }, path: string): any => {
|
|
175
|
+
return path.split(".").reduce((res, prop) => {
|
|
176
|
+
return res[prop];
|
|
177
|
+
}, obj);
|
|
178
|
+
};
|