@onewelcome/react-lib-components 8.3.0 → 8.5.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/cjs/Button/BaseButton.cjs.js +1 -1
- package/dist/cjs/Button/BaseButton.cjs.js.map +1 -1
- package/dist/cjs/Button/Spinner.cjs.js +1 -1
- package/dist/cjs/Button/Spinner.cjs.js.map +1 -1
- package/dist/cjs/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.cjs.js +1 -1
- package/dist/cjs/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.cjs.js +1 -1
- package/dist/cjs/DataGrid/DataGridFilters/DataGridFilters.interfaces.cjs.js.map +1 -1
- package/dist/cjs/DataGrid/DataGridFilters/DataGridSearchbar.cjs.js.map +1 -1
- package/dist/cjs/DataGrid/DataGridFilters/FilterKeyMapper.cjs.js +2 -0
- package/dist/cjs/DataGrid/DataGridFilters/FilterKeyMapper.cjs.js.map +1 -0
- package/dist/cjs/DataGrid/DataGridHeader/DataGridHeader.module.scss.cjs.js +1 -1
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.cjs.js +1 -1
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.cjs.js.map +1 -1
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.module.scss.cjs.js +1 -1
- package/dist/cjs/Form/FileUpload/FileUpload.cjs.js +1 -1
- package/dist/cjs/Form/FileUpload/FileUpload.cjs.js.map +1 -1
- package/dist/cjs/Form/FileUpload/FileUpload.module.scss.cjs.js +1 -1
- package/dist/cjs/Icon/Icon.cjs.js +1 -1
- package/dist/cjs/Icon/Icon.cjs.js.map +1 -1
- package/dist/cjs/Icon/Icon.module.scss.cjs.js +1 -1
- package/dist/cjs/Notifications/BaseModal/BaseModal.cjs.js +1 -1
- package/dist/cjs/Notifications/BaseModal/BaseModal.cjs.js.map +1 -1
- package/dist/cjs/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.cjs.js +1 -1
- package/dist/cjs/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.cjs.js.map +1 -1
- package/dist/cjs/Notifications/SideSheet/SideSheet.cjs.js +2 -0
- package/dist/cjs/Notifications/SideSheet/SideSheet.cjs.js.map +1 -0
- package/dist/cjs/Notifications/SideSheet/SideSheet.module.scss.cjs.js +2 -0
- package/dist/cjs/Notifications/SideSheet/SideSheet.module.scss.cjs.js.map +1 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetContent/SideSheetContent.cjs.js +2 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetContent/SideSheetContent.cjs.js.map +1 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.cjs.js +2 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.cjs.js.map +1 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.cjs.js +2 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.cjs.js.map +1 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.cjs.js +2 -0
- package/dist/cjs/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.cjs.js.map +1 -0
- package/dist/cjs/Notifications/SlideInModal/SlideInModal.cjs.js.map +1 -1
- package/dist/cjs/Spinner/Spinner.cjs.js +2 -0
- package/dist/cjs/Spinner/Spinner.cjs.js.map +1 -0
- package/dist/cjs/Spinner/Spinner.module.scss.cjs.js +2 -0
- package/dist/cjs/Spinner/Spinner.module.scss.cjs.js.map +1 -0
- package/dist/cjs/_BaseStyling_/BaseStyling.cjs.js +1 -1
- package/dist/cjs/_BaseStyling_/BaseStyling.cjs.js.map +1 -1
- package/dist/cjs/src/components/Button/Spinner.d.ts +1 -1
- package/dist/cjs/src/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.d.ts +4 -0
- package/dist/cjs/src/components/DataGrid/DataGridFilters/DataGridSearchbar.d.ts +1 -1
- package/dist/cjs/src/components/DataGrid/DataGridFilters/FilterKeyMapper.d.ts +14 -0
- package/dist/cjs/src/components/DataGrid/DataGridFilters/FilterKeyMapper.test.d.ts +1 -0
- package/dist/cjs/src/components/DataGrid/testUtils.d.ts +3 -1
- package/dist/cjs/src/components/Form/Select/MultiSelect/MultiSelect.test.d.ts +1 -2
- package/dist/cjs/src/components/Form/Select/SingleSelect/Select.test.d.ts +1 -2
- package/dist/cjs/src/components/Icon/Icon.d.ts +4 -1
- package/dist/cjs/src/components/Notifications/BaseModal/BaseModal.d.ts +1 -0
- package/dist/cjs/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +1 -0
- package/dist/cjs/src/components/Notifications/SideSheet/SideSheet.d.ts +10 -0
- package/dist/cjs/src/components/Notifications/SideSheet/SideSheet.test.d.ts +1 -0
- package/dist/cjs/src/components/Notifications/SideSheet/SideSheetActions/SideSheetActions.d.ts +2 -0
- package/dist/cjs/src/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.d.ts +4 -0
- package/dist/cjs/src/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.d.ts +4 -0
- package/dist/cjs/src/components/Spinner/Spinner.d.ts +6 -0
- package/dist/cjs/src/components/Spinner/Spinner.test.d.ts +1 -0
- package/dist/cjs/src/components/Typography/Typography.d.ts +1 -1
- package/dist/cjs/src/components/_BaseStyling_/BaseStyling.d.ts +2 -0
- package/dist/cjs/src/hooks/useUploadFile.cjs.js +2 -0
- package/dist/cjs/src/hooks/useUploadFile.cjs.js.map +1 -0
- package/dist/cjs/src/hooks/useUploadFile.d.ts +10 -4
- package/dist/cjs/src/index.cjs.js +1 -1
- package/dist/cjs/src/index.d.ts +19 -2
- package/dist/cjs/src/util/helper.cjs.js +1 -1
- package/dist/cjs/src/util/helper.cjs.js.map +1 -1
- package/dist/cjs/src/util/helper.d.ts +0 -3
- package/dist/esm/Button/BaseButton.esm.js +2 -2
- package/dist/esm/Button/BaseButton.esm.js.map +1 -1
- package/dist/esm/Button/Spinner.esm.js +2 -2
- package/dist/esm/Button/Spinner.esm.js.map +1 -1
- package/dist/esm/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss.esm.js +1 -1
- package/dist/esm/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss.esm.js +1 -1
- package/dist/esm/DataGrid/DataGridFilters/DataGridFilters.interfaces.esm.js.map +1 -1
- package/dist/esm/DataGrid/DataGridFilters/DataGridSearchbar.esm.js.map +1 -1
- package/dist/esm/DataGrid/DataGridFilters/FilterKeyMapper.esm.js +46 -0
- package/dist/esm/DataGrid/DataGridFilters/FilterKeyMapper.esm.js.map +1 -0
- package/dist/esm/DataGrid/DataGridHeader/DataGridHeader.module.scss.esm.js +2 -2
- package/dist/esm/Form/FileUpload/FileItem/FileItem.esm.js +4 -3
- package/dist/esm/Form/FileUpload/FileItem/FileItem.esm.js.map +1 -1
- package/dist/esm/Form/FileUpload/FileItem/FileItem.module.scss.esm.js +1 -1
- package/dist/esm/Form/FileUpload/FileUpload.esm.js +8 -7
- package/dist/esm/Form/FileUpload/FileUpload.esm.js.map +1 -1
- package/dist/esm/Form/FileUpload/FileUpload.module.scss.esm.js +2 -2
- package/dist/esm/Icon/Icon.esm.js +3 -0
- package/dist/esm/Icon/Icon.esm.js.map +1 -1
- package/dist/esm/Icon/Icon.module.scss.esm.js +2 -2
- package/dist/esm/Notifications/BaseModal/BaseModal.esm.js +2 -2
- package/dist/esm/Notifications/BaseModal/BaseModal.esm.js.map +1 -1
- package/dist/esm/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.esm.js +4 -3
- package/dist/esm/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.esm.js.map +1 -1
- package/dist/esm/Notifications/SideSheet/SideSheet.esm.js +59 -0
- package/dist/esm/Notifications/SideSheet/SideSheet.esm.js.map +1 -0
- package/dist/esm/Notifications/SideSheet/SideSheet.module.scss.esm.js +8 -0
- package/dist/esm/Notifications/SideSheet/SideSheet.module.scss.esm.js.map +1 -0
- package/dist/esm/Notifications/SideSheet/SideSheetContent/SideSheetContent.esm.js +23 -0
- package/dist/esm/Notifications/SideSheet/SideSheetContent/SideSheetContent.esm.js.map +1 -0
- package/dist/esm/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.esm.js +8 -0
- package/dist/esm/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss.esm.js.map +1 -0
- package/dist/esm/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.esm.js +23 -0
- package/dist/esm/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.esm.js.map +1 -0
- package/dist/esm/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.esm.js +8 -0
- package/dist/esm/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss.esm.js.map +1 -0
- package/dist/esm/Notifications/SlideInModal/SlideInModal.esm.js +3 -0
- package/dist/esm/Notifications/SlideInModal/SlideInModal.esm.js.map +1 -1
- package/dist/esm/Spinner/Spinner.esm.js +29 -0
- package/dist/esm/Spinner/Spinner.esm.js.map +1 -0
- package/dist/esm/Spinner/Spinner.module.scss.esm.js +8 -0
- package/dist/esm/Spinner/Spinner.module.scss.esm.js.map +1 -0
- package/dist/esm/_BaseStyling_/BaseStyling.esm.js +2 -0
- package/dist/esm/_BaseStyling_/BaseStyling.esm.js.map +1 -1
- package/dist/esm/src/components/Button/Spinner.d.ts +1 -1
- package/dist/esm/src/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.d.ts +4 -0
- package/dist/esm/src/components/DataGrid/DataGridFilters/DataGridSearchbar.d.ts +1 -1
- package/dist/esm/src/components/DataGrid/DataGridFilters/FilterKeyMapper.d.ts +14 -0
- package/dist/esm/src/components/DataGrid/DataGridFilters/FilterKeyMapper.test.d.ts +1 -0
- package/dist/esm/src/components/DataGrid/testUtils.d.ts +3 -1
- package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelect.test.d.ts +1 -2
- package/dist/esm/src/components/Form/Select/SingleSelect/Select.test.d.ts +1 -2
- package/dist/esm/src/components/Icon/Icon.d.ts +4 -1
- package/dist/esm/src/components/Notifications/BaseModal/BaseModal.d.ts +1 -0
- package/dist/esm/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +1 -0
- package/dist/esm/src/components/Notifications/SideSheet/SideSheet.d.ts +10 -0
- package/dist/esm/src/components/Notifications/SideSheet/SideSheet.test.d.ts +1 -0
- package/dist/esm/src/components/Notifications/SideSheet/SideSheetActions/SideSheetActions.d.ts +2 -0
- package/dist/esm/src/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.d.ts +4 -0
- package/dist/esm/src/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.d.ts +4 -0
- package/dist/esm/src/components/Spinner/Spinner.d.ts +6 -0
- package/dist/esm/src/components/Spinner/Spinner.test.d.ts +1 -0
- package/dist/esm/src/components/Typography/Typography.d.ts +1 -1
- package/dist/esm/src/components/_BaseStyling_/BaseStyling.d.ts +2 -0
- package/dist/esm/src/hooks/useUploadFile.d.ts +10 -4
- package/dist/esm/src/hooks/useUploadFile.esm.js +101 -0
- package/dist/esm/src/hooks/useUploadFile.esm.js.map +1 -0
- package/dist/esm/src/index.d.ts +19 -2
- package/dist/esm/src/index.esm.js +8 -1
- package/dist/esm/src/index.esm.js.map +1 -1
- package/dist/esm/src/util/helper.d.ts +0 -3
- package/dist/esm/src/util/helper.esm.js +10 -1
- package/dist/esm/src/util/helper.esm.js.map +1 -1
- package/dist/lib/style-inject.js +48 -41
- package/dist/lib/style-inject.js.map +1 -1
- package/package.json +22 -22
- package/src/components/Button/BaseButton.tsx +2 -2
- package/src/components/Button/Spinner.tsx +1 -1
- package/src/components/DataGrid/DataGridBody/DataGridCell/DataGridCell.module.scss +1 -1
- package/src/components/DataGrid/DataGridBody/DataGridRow/DataGridRow.module.scss +8 -24
- package/src/components/DataGrid/DataGridFilters/DataGridFilters.interfaces.ts +5 -0
- package/src/components/DataGrid/DataGridFilters/DataGridSearchbar.tsx +5 -2
- package/src/components/DataGrid/DataGridFilters/FilterKeyMapper.ts +48 -0
- package/src/components/DataGrid/DataGridHeader/DataGridHeader.module.scss +9 -8
- package/src/components/DataGrid/dataGridMixins.module.scss +33 -0
- package/src/components/DataGrid/testUtils.ts +39 -32
- package/src/components/Form/FileUpload/FileItem/FileItem.module.scss +6 -3
- package/src/components/Form/FileUpload/FileItem/FileItem.tsx +3 -1
- package/src/components/Form/FileUpload/FileUpload.module.scss +12 -5
- package/src/components/Form/FileUpload/FileUpload.tsx +10 -7
- package/src/components/Icon/Icon.module.scss +12 -0
- package/src/components/Icon/Icon.tsx +4 -1
- package/src/components/Notifications/BaseModal/BaseModal.tsx +10 -6
- package/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +14 -2
- package/src/components/Notifications/SideSheet/SideSheet.module.scss +96 -0
- package/src/components/Notifications/SideSheet/SideSheet.tsx +114 -0
- package/src/components/Notifications/SideSheet/SideSheetActions/SideSheetActions.tsx +18 -0
- package/src/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.module.scss +19 -0
- package/src/components/Notifications/SideSheet/SideSheetContent/SideSheetContent.tsx +25 -0
- package/src/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.module.scss +19 -0
- package/src/components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader.tsx +25 -0
- package/src/components/Notifications/SlideInModal/SlideInModal.tsx +3 -0
- package/src/components/Spinner/Spinner.module.scss +33 -0
- package/src/components/Spinner/Spinner.tsx +61 -0
- package/src/components/_BaseStyling_/BaseStyling.tsx +4 -0
- package/src/font/icomoon.eot +0 -0
- package/src/font/icomoon.svg +3 -0
- package/src/font/icomoon.ttf +0 -0
- package/src/font/icomoon.woff +0 -0
- package/src/font/selection.json +1 -1
- package/src/hooks/useUploadFile.tsx +27 -25
- package/src/index.ts +29 -2
- package/src/util/helper.tsx +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,9 @@ import { Filter } from "./DataGridFilters/DataGridFilters.interfaces";
|
|
|
3
3
|
* @scope .
|
|
4
4
|
* @scopeException stories/DataGrid/DataGrid.stories.tsx
|
|
5
5
|
*/
|
|
6
|
-
export declare const useMockFilteringLogic: <T
|
|
6
|
+
export declare const useMockFilteringLogic: <T extends {
|
|
7
|
+
[k: string]: string;
|
|
8
|
+
}>(data: T[], filterValues: Filter[] | undefined) => {
|
|
7
9
|
onFilterAdd: (filter: Filter) => void;
|
|
8
10
|
onFilterEdit: (filter: Filter) => void;
|
|
9
11
|
onFilterDelete: (id: string) => void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { MultiSelectProps } from "../Select.interfaces";
|
|
3
2
|
export declare const createMultiSelect: (params?: (defaultParams: MultiSelectProps) => MultiSelectProps) => {
|
|
4
3
|
select: HTMLElement;
|
|
@@ -7,7 +6,7 @@ export declare const createMultiSelect: (params?: (defaultParams: MultiSelectPro
|
|
|
7
6
|
dropdownWrapper: Element | null;
|
|
8
7
|
container: HTMLElement;
|
|
9
8
|
baseElement: HTMLElement;
|
|
10
|
-
debug: (baseElement?: import("react-dom/client").Container | (Element | Document) | Array<import("react-dom/client").Container | (Element | Document)
|
|
9
|
+
debug: (baseElement?: import("react-dom/client").Container | (Element | Document) | Array<import("react-dom/client").Container | (Element | Document)>, maxLength?: number, options?: import("pretty-format").OptionsReceived) => void;
|
|
11
10
|
rerender: (ui: React.ReactNode) => void;
|
|
12
11
|
unmount: () => void;
|
|
13
12
|
asFragment: () => DocumentFragment;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { SingleSelectProps } from "../Select.interfaces";
|
|
3
2
|
export declare const defaultParams: SingleSelectProps;
|
|
4
3
|
export declare const createSelect: (params?: (defaultParams: SingleSelectProps) => SingleSelectProps) => {
|
|
@@ -8,7 +7,7 @@ export declare const createSelect: (params?: (defaultParams: SingleSelectProps)
|
|
|
8
7
|
dropdownWrapper: Element | null;
|
|
9
8
|
container: HTMLElement;
|
|
10
9
|
baseElement: HTMLElement;
|
|
11
|
-
debug: (baseElement?: import("react-dom/client").Container | (Element | Document) | Array<import("react-dom/client").Container | (Element | Document)
|
|
10
|
+
debug: (baseElement?: import("react-dom/client").Container | (Element | Document) | Array<import("react-dom/client").Container | (Element | Document)>, maxLength?: number, options?: import("pretty-format").OptionsReceived) => void;
|
|
12
11
|
rerender: (ui: React.ReactNode) => void;
|
|
13
12
|
unmount: () => void;
|
|
14
13
|
asFragment: () => DocumentFragment;
|
|
@@ -82,7 +82,10 @@ export declare enum Icons {
|
|
|
82
82
|
ZoomIn = "zoom-in",
|
|
83
83
|
ZoomOut = "zoom-out",
|
|
84
84
|
ArrowUp = "arrow-up",
|
|
85
|
-
ExternalLink = "external-link"
|
|
85
|
+
ExternalLink = "external-link",
|
|
86
|
+
SideSheetHandle = "sidesheet-handle",
|
|
87
|
+
PendingCircle = "pending-circle",
|
|
88
|
+
MinusCircle = "minus-circle"
|
|
86
89
|
}
|
|
87
90
|
type Tag = "span" | "div" | "i";
|
|
88
91
|
export interface Props extends ComponentPropsWithRef<"div"> {
|
package/dist/esm/src/components/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React, { ComponentPropsWithRef } from "react";
|
|
|
2
2
|
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
3
3
|
id: string;
|
|
4
4
|
title: string;
|
|
5
|
+
description?: string;
|
|
5
6
|
children?: React.ReactNode;
|
|
6
7
|
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
7
8
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Props as ModalProps } from "../Modal/Modal";
|
|
3
|
+
export interface Props extends Omit<ModalProps, "hideBackdrop" | "disableBackdrop"> {
|
|
4
|
+
handleButtonProps?: {
|
|
5
|
+
onOpen: () => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
title?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare const SideSheet: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,5 +10,5 @@ export interface Props extends ComponentPropsWithRef<any> {
|
|
|
10
10
|
spacing?: Spacing;
|
|
11
11
|
align?: "left" | "center" | "right";
|
|
12
12
|
}
|
|
13
|
-
export declare const Typography: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<any>>;
|
|
13
|
+
export declare const Typography: React.ForwardRefExoticComponent<Omit<Omit<Props, "ref">, "ref"> & React.RefAttributes<any>>;
|
|
14
14
|
export {};
|
|
@@ -98,6 +98,8 @@ interface CSSProperties {
|
|
|
98
98
|
modalShadowColor?: string;
|
|
99
99
|
modalBackgroundColor?: string;
|
|
100
100
|
modalBackdropColor?: string;
|
|
101
|
+
sideSheetShadowColorOne?: string;
|
|
102
|
+
sideSheetShadowColorTwo?: string;
|
|
101
103
|
skeletonBackgroundColor?: string;
|
|
102
104
|
skeletonAnimationColorRgb?: string;
|
|
103
105
|
alertTextColor?: string;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { FileType } from "../components/Form/FileUpload/FileUpload";
|
|
2
|
+
export type UploadResponseStatus = XMLHttpRequest["status"];
|
|
3
|
+
export type UploadResponseJson = Record<string, unknown>;
|
|
2
4
|
export interface UploadResponseType {
|
|
3
5
|
fileList: FileType[];
|
|
4
|
-
status:
|
|
6
|
+
status: UploadResponseStatus;
|
|
7
|
+
responseJson: UploadResponseJson;
|
|
8
|
+
}
|
|
9
|
+
export interface OnErrorMessageMapperType {
|
|
10
|
+
responseStatus: UploadResponseStatus;
|
|
11
|
+
responseJson: UploadResponseJson;
|
|
5
12
|
}
|
|
6
13
|
export interface UseUploadFileCallback {
|
|
7
14
|
onComplete?: (response: UploadResponseType) => void;
|
|
8
|
-
onProgress?:
|
|
15
|
+
onProgress?: (fileName: string, progress: number) => void;
|
|
16
|
+
onErrorMessageMapper?: (args: OnErrorMessageMapperType) => string | undefined;
|
|
9
17
|
}
|
|
10
18
|
export interface UploadFileRequestParams {
|
|
11
19
|
url: string;
|
|
12
20
|
headers?: Headers;
|
|
13
|
-
responseErrorPath?: string;
|
|
14
|
-
networkErrorText?: string;
|
|
15
21
|
withCredentials?: boolean;
|
|
16
22
|
}
|
|
17
23
|
export declare const useUploadFile: (files: FileType[], request: UploadFileRequestParams, callbacks?: UseUploadFileCallback) => {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { isJsonString } from '../util/helper.esm.js';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2022 OneWelcome B.V.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const useUploadFile = (files, request, callbacks) => {
|
|
20
|
+
const { url, headers, withCredentials } = request;
|
|
21
|
+
const { onComplete, onProgress, onErrorMessageMapper } = callbacks !== null && callbacks !== void 0 ? callbacks : {};
|
|
22
|
+
const [uploadingFiles, setUploadingFiles] = useState([]);
|
|
23
|
+
const [updatedFiles, setUpdatedFiles] = useState([...files]);
|
|
24
|
+
const getUpdatedList = (fileName, fileStatus, progress, error) => {
|
|
25
|
+
return files.map(file => {
|
|
26
|
+
if (file.name === fileName) {
|
|
27
|
+
file.progress = progress;
|
|
28
|
+
file.error = error;
|
|
29
|
+
file.status = fileStatus;
|
|
30
|
+
}
|
|
31
|
+
return { ...file };
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const recordProgress = (e, fileName) => {
|
|
35
|
+
const progress = (e.loaded / e.total) * 100;
|
|
36
|
+
const updatedData = getUpdatedList(fileName, "uploading", progress);
|
|
37
|
+
setUpdatedFiles(updatedData);
|
|
38
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress(fileName, progress);
|
|
39
|
+
};
|
|
40
|
+
const getFileStatus = (responseStatus, responseJson) => {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
let fileStatus = undefined;
|
|
43
|
+
let error = "";
|
|
44
|
+
if (responseStatus >= 200 && responseStatus < 400) {
|
|
45
|
+
fileStatus = "completed";
|
|
46
|
+
}
|
|
47
|
+
else if (responseStatus === 0) {
|
|
48
|
+
fileStatus = "retry";
|
|
49
|
+
error =
|
|
50
|
+
(_a = onErrorMessageMapper === null || onErrorMessageMapper === void 0 ? void 0 : onErrorMessageMapper({ responseStatus, responseJson })) !== null && _a !== void 0 ? _a : "Network error. Check internet connection and retry uploading the file";
|
|
51
|
+
}
|
|
52
|
+
else if (responseStatus >= 400 && responseStatus < 500) {
|
|
53
|
+
fileStatus = "error";
|
|
54
|
+
error = (_b = onErrorMessageMapper === null || onErrorMessageMapper === void 0 ? void 0 : onErrorMessageMapper({ responseStatus, responseJson })) !== null && _b !== void 0 ? _b : "Bad request";
|
|
55
|
+
}
|
|
56
|
+
else if (responseStatus >= 500) {
|
|
57
|
+
fileStatus = "error";
|
|
58
|
+
error = (_c = onErrorMessageMapper === null || onErrorMessageMapper === void 0 ? void 0 : onErrorMessageMapper({ responseStatus, responseJson })) !== null && _c !== void 0 ? _c : "Server Error";
|
|
59
|
+
}
|
|
60
|
+
return { fileStatus, error };
|
|
61
|
+
};
|
|
62
|
+
const handleOnComplete = (xhr, fileName) => {
|
|
63
|
+
const { status, readyState, responseText } = xhr;
|
|
64
|
+
if (readyState === xhr.DONE) {
|
|
65
|
+
const responseJson = responseText && isJsonString(responseText) && JSON.parse(responseText);
|
|
66
|
+
const { fileStatus, error } = getFileStatus(status, responseJson);
|
|
67
|
+
const updatedList = getUpdatedList(fileName, fileStatus, undefined, error);
|
|
68
|
+
setUpdatedFiles(updatedList);
|
|
69
|
+
const response = { fileList: updatedList, status, responseJson };
|
|
70
|
+
setUploadingFiles(prevState => prevState.filter(selected => selected.name === fileName));
|
|
71
|
+
onComplete === null || onComplete === void 0 ? void 0 : onComplete(response);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const uploadFile = (file) => {
|
|
75
|
+
const xhr = new XMLHttpRequest();
|
|
76
|
+
xhr.upload.addEventListener("progress", e => recordProgress(e, file.name));
|
|
77
|
+
xhr.addEventListener("readystatechange", () => handleOnComplete(xhr, file.name));
|
|
78
|
+
withCredentials && (xhr.withCredentials = true);
|
|
79
|
+
xhr.open("POST", url, true);
|
|
80
|
+
headers === null || headers === void 0 ? void 0 : headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
81
|
+
const formData = new FormData();
|
|
82
|
+
formData.append("file", file.data);
|
|
83
|
+
formData.append("name", file.name);
|
|
84
|
+
xhr.send(formData);
|
|
85
|
+
};
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!url || !files.length) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
files.forEach(file => {
|
|
91
|
+
if (!file.status && !uploadingFiles.find(selected => selected.name === file.name)) {
|
|
92
|
+
setUploadingFiles(prevState => [...prevState, file]);
|
|
93
|
+
uploadFile(file);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}, [url, files]);
|
|
97
|
+
return { updatedFiles, setUpdatedFiles, uploadingFiles };
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { useUploadFile };
|
|
101
|
+
//# sourceMappingURL=useUploadFile.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploadFile.esm.js","sources":["../../../../../../src/hooks/useUploadFile.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FileType } from \"../components/Form/FileUpload/FileUpload\";\nimport { useEffect, useState } from \"react\";\nimport { isJsonString } from \"../util/helper\";\n\nexport type UploadResponseStatus = XMLHttpRequest[\"status\"];\nexport type UploadResponseJson = Record<string, unknown>;\nexport interface UploadResponseType {\n fileList: FileType[];\n status: UploadResponseStatus;\n responseJson: UploadResponseJson;\n}\nexport interface OnErrorMessageMapperType {\n responseStatus: UploadResponseStatus;\n responseJson: UploadResponseJson;\n}\nexport interface UseUploadFileCallback {\n onComplete?: (response: UploadResponseType) => void;\n onProgress?: (fileName: string, progress: number) => void;\n onErrorMessageMapper?: (args: OnErrorMessageMapperType) => string | undefined;\n}\nexport interface UploadFileRequestParams {\n url: string;\n headers?: Headers;\n withCredentials?: boolean;\n}\n\nexport const useUploadFile = (\n files: FileType[],\n request: UploadFileRequestParams,\n callbacks?: UseUploadFileCallback\n) => {\n const { url, headers, withCredentials } = request;\n\n const { onComplete, onProgress, onErrorMessageMapper } = callbacks ?? {};\n\n const [uploadingFiles, setUploadingFiles] = useState<FileType[]>([]);\n const [updatedFiles, setUpdatedFiles] = useState<FileType[]>([...files]);\n\n const getUpdatedList = (\n fileName: string,\n fileStatus: FileType[\"status\"],\n progress?: number,\n error?: string\n ) => {\n return files.map(file => {\n if (file.name === fileName) {\n file.progress = progress;\n file.error = error;\n file.status = fileStatus;\n }\n return { ...file };\n });\n };\n\n const recordProgress = (e: ProgressEvent<XMLHttpRequestEventTarget>, fileName: string) => {\n const progress = (e.loaded / e.total) * 100;\n const updatedData = getUpdatedList(fileName, \"uploading\", progress);\n setUpdatedFiles(updatedData);\n onProgress?.(fileName, progress);\n };\n\n const getFileStatus = (\n responseStatus: UploadResponseStatus,\n responseJson: UploadResponseJson\n ) => {\n let fileStatus: FileType[\"status\"] = undefined;\n let error = \"\";\n if (responseStatus >= 200 && responseStatus < 400) {\n fileStatus = \"completed\";\n } else if (responseStatus === 0) {\n fileStatus = \"retry\";\n error =\n onErrorMessageMapper?.({ responseStatus, responseJson }) ??\n \"Network error. Check internet connection and retry uploading the file\";\n } else if (responseStatus >= 400 && responseStatus < 500) {\n fileStatus = \"error\";\n error = onErrorMessageMapper?.({ responseStatus, responseJson }) ?? \"Bad request\";\n } else if (responseStatus >= 500) {\n fileStatus = \"error\";\n error = onErrorMessageMapper?.({ responseStatus, responseJson }) ?? \"Server Error\";\n }\n return { fileStatus, error };\n };\n\n const handleOnComplete = (xhr: XMLHttpRequest, fileName: string) => {\n const { status, readyState, responseText } = xhr;\n if (readyState === xhr.DONE) {\n const responseJson = responseText && isJsonString(responseText) && JSON.parse(responseText);\n const { fileStatus, error } = getFileStatus(status, responseJson);\n const updatedList = getUpdatedList(fileName, fileStatus, undefined, error);\n setUpdatedFiles(updatedList);\n const response = { fileList: updatedList, status, responseJson };\n setUploadingFiles(prevState => prevState.filter(selected => selected.name === fileName));\n onComplete?.(response);\n }\n };\n\n const uploadFile = (file: FileType) => {\n const xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", e => recordProgress(e, file.name));\n xhr.addEventListener(\"readystatechange\", () => handleOnComplete(xhr, file.name));\n withCredentials && (xhr.withCredentials = true);\n xhr.open(\"POST\", url, true);\n headers?.forEach((value, key) => xhr.setRequestHeader(key, value));\n const formData = new FormData();\n formData.append(\"file\", file.data as File);\n formData.append(\"name\", file.name);\n xhr.send(formData);\n };\n\n useEffect(() => {\n if (!url || !files.length) {\n return;\n }\n\n files.forEach(file => {\n if (!file.status && !uploadingFiles.find(selected => selected.name === file.name)) {\n setUploadingFiles(prevState => [...prevState, file]);\n uploadFile(file);\n }\n });\n }, [url, files]);\n\n return { updatedFiles, setUpdatedFiles, uploadingFiles };\n};\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;AAcG;AA4BU,MAAA,aAAa,GAAG,CAC3B,KAAiB,EACjB,OAAgC,EAChC,SAAiC,KAC/B;IACF,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;AAElD,IAAA,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,SAAS,aAAT,SAAS,KAAA,KAAA,CAAA,GAAT,SAAS,GAAI,EAAE,CAAC;IAEzE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAa,EAAE,CAAC,CAAC;AACrE,IAAA,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAa,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAEzE,MAAM,cAAc,GAAG,CACrB,QAAgB,EAChB,UAA8B,EAC9B,QAAiB,EACjB,KAAc,KACZ;AACF,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,IAAG;AACtB,YAAA,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;AAC1B,gBAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,gBAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,gBAAA,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;aAC1B;AACD,YAAA,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;AACrB,SAAC,CAAC,CAAC;AACL,KAAC,CAAC;AAEF,IAAA,MAAM,cAAc,GAAG,CAAC,CAA2C,EAAE,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AI,CAAC,EAAE;AACjF,gBAAA,iBAAiB,CAAC,SAAS,IAAI,CAAC,GAAG,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;gBACrD,UAAU,CAAC,IAAI,CAAC,CAAC;aAClB;AACH,SAAC,CAAC,CAAC;AACL,KAAC,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAEjB,IAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC3D;;;;"}
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export { ProgressBar } from "./components/ProgressBar/ProgressBar";
|
|
|
34
34
|
export type { Props as ProgressBarProps } from "./components/ProgressBar/ProgressBar";
|
|
35
35
|
export { Skeleton } from "./components/Skeleton/Skeleton";
|
|
36
36
|
export type { Props as SkeletonProps } from "./components/Skeleton/Skeleton";
|
|
37
|
+
export { Spinner } from "./components/Spinner/Spinner";
|
|
38
|
+
export type { SpinnerProps } from "./components/Spinner/Spinner";
|
|
37
39
|
export { Stepper } from "./components/Stepper/Stepper";
|
|
38
40
|
export type { Props as StepperProps } from "./components/Stepper/Stepper";
|
|
39
41
|
export type { Props as StepProps } from "./components/Stepper/Step";
|
|
@@ -41,8 +43,11 @@ export { Pagination } from "./components/Pagination/Pagination";
|
|
|
41
43
|
export type { Props as PaginationProps, PageChangeLabels, PaginationTranslations, PageSize } from "./components/Pagination/Pagination";
|
|
42
44
|
export { useRepeater } from "./hooks/useRepeater";
|
|
43
45
|
export { useFullHeightCollapse } from "./hooks/useFullHeightCollapse";
|
|
44
|
-
export { usePosition
|
|
46
|
+
export { usePosition } from "./hooks/usePosition";
|
|
47
|
+
export type { Placement } from "./hooks/usePosition";
|
|
45
48
|
export { useDebouncedCallback } from "./hooks/useDebouncedCallback";
|
|
49
|
+
export { useUploadFile } from "./hooks/useUploadFile";
|
|
50
|
+
export type { UploadResponseStatus, UploadResponseJson, UploadResponseType, UseUploadFileCallback, UploadFileRequestParams } from "./hooks/useUploadFile";
|
|
46
51
|
export { generateID, debounce, throttle } from "./util/helper";
|
|
47
52
|
export { Modal } from "./components/Notifications/Modal/Modal";
|
|
48
53
|
export type { Props as ModalProps } from "./components/Notifications/Modal/Modal";
|
|
@@ -65,6 +70,15 @@ export type { Props as NotificationProviderProps } from "./components/Notificati
|
|
|
65
70
|
export type { AddNotification, RemoveNotification, Translations } from "./components/Notifications/NotificationProvider/notification.interfaces";
|
|
66
71
|
export { SlideInModal } from "./components/Notifications/SlideInModal/SlideInModal";
|
|
67
72
|
export type { Props as SlideInModalProps } from "./components/Notifications/SlideInModal/SlideInModal";
|
|
73
|
+
/** SideSheet */
|
|
74
|
+
export { SideSheet } from "./components/Notifications/SideSheet/SideSheet";
|
|
75
|
+
export type { Props as SideSheetProps } from "./components/Notifications/SideSheet/SideSheet";
|
|
76
|
+
export { SideSheetActions } from "./components/Notifications/SideSheet/SideSheetActions/SideSheetActions";
|
|
77
|
+
export type { Props as SideSheetActionsProps } from "./components/Notifications/SideSheet/SideSheetActions/SideSheetActions";
|
|
78
|
+
export { SideSheetContent } from "./components/Notifications/SideSheet/SideSheetContent/SideSheetContent";
|
|
79
|
+
export type { Props as SideSheetContentProps } from "./components/Notifications/SideSheet/SideSheetContent/SideSheetContent";
|
|
80
|
+
export { SideSheetHeader } from "./components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader";
|
|
81
|
+
export type { Props as SideSheetHeaderProps } from "./components/Notifications/SideSheet/SideSheetHeader/SideSheetHeader";
|
|
68
82
|
/** Form components */
|
|
69
83
|
export { Checkbox } from "./components/Form/Checkbox/Checkbox";
|
|
70
84
|
export type { Props as CheckboxProps } from "./components/Form/Checkbox/Checkbox";
|
|
@@ -106,7 +120,8 @@ export type { Props as TextareaWrapperProps } from "./components/Form/Wrapper/Te
|
|
|
106
120
|
export { SelectWrapper } from "./components/Form/Wrapper/SelectWrapper/SelectWrapper";
|
|
107
121
|
export type { Props as SelectWrapperProps } from "./components/Form/Wrapper/SelectWrapper/SelectWrapper";
|
|
108
122
|
export { FileUpload } from "./components/Form/FileUpload/FileUpload";
|
|
109
|
-
export type { Props as FileUploadProps } from "./components/Form/FileUpload/FileUpload";
|
|
123
|
+
export type { Props as FileUploadProps, FileType } from "./components/Form/FileUpload/FileUpload";
|
|
124
|
+
export { FILE_ACTION, ACTION_STATUS } from "./components/Form/FileUpload/FileItem/FileItem";
|
|
110
125
|
export { MultiSelectWrapper } from "./components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper";
|
|
111
126
|
export type { Props as MultiSelectWrapperProps } from "./components/Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper";
|
|
112
127
|
export { ContentHeader } from "./components/Layout/ContentHeader/ContentHeader";
|
|
@@ -127,6 +142,8 @@ export { DataGridDrawerItem } from "./components/DataGrid/DataGridBody/DataGridD
|
|
|
127
142
|
export type { Props as DataGridDrawerItemProps } from "./components/DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem";
|
|
128
143
|
export { DataGridCell } from "./components/DataGrid/DataGridBody/DataGridCell/DataGridCell";
|
|
129
144
|
export type { Props as DataGridCellProps } from "./components/DataGrid/DataGridBody/DataGridCell/DataGridCell";
|
|
145
|
+
export { Filter } from "./components/DataGrid/DataGridFilters/DataGridFilters.interfaces";
|
|
146
|
+
export { FilterKeyMapper } from "./components/DataGrid/DataGridFilters/FilterKeyMapper";
|
|
130
147
|
export { useFiltersReducer } from "./components/DataGrid/DataGridFilters/useFiltersReducer";
|
|
131
148
|
/** Banner */
|
|
132
149
|
export { Banner } from "./components/Notifications/Banner/Banner";
|
|
@@ -16,12 +16,14 @@ export { Tooltip } from '../Tooltip/Tooltip.esm.js';
|
|
|
16
16
|
export { Typography } from '../Typography/Typography.esm.js';
|
|
17
17
|
export { ProgressBar } from '../ProgressBar/ProgressBar.esm.js';
|
|
18
18
|
export { Skeleton } from '../Skeleton/Skeleton.esm.js';
|
|
19
|
+
export { Spinner } from '../Spinner/Spinner.esm.js';
|
|
19
20
|
export { Stepper } from '../Stepper/Stepper.esm.js';
|
|
20
21
|
export { Pagination } from '../Pagination/Pagination.esm.js';
|
|
21
22
|
export { useRepeater } from './hooks/useRepeater.esm.js';
|
|
22
23
|
export { useFullHeightCollapse } from './hooks/useFullHeightCollapse.esm.js';
|
|
23
24
|
export { usePosition } from './hooks/usePosition.esm.js';
|
|
24
25
|
export { useDebouncedCallback } from './hooks/useDebouncedCallback.esm.js';
|
|
26
|
+
export { useUploadFile } from './hooks/useUploadFile.esm.js';
|
|
25
27
|
export { debounce, generateID, throttle } from './util/helper.esm.js';
|
|
26
28
|
export { BaseModal as Modal } from '../Notifications/BaseModal/BaseModal.esm.js';
|
|
27
29
|
export { useAlert } from '../Notifications/Alert/useAlert.esm.js';
|
|
@@ -29,11 +31,14 @@ export { AlertProvider } from '../Notifications/Alert/AlertProvider/AlertProvide
|
|
|
29
31
|
export { AlertItem } from '../Notifications/Alert/AlertItem/AlertItem.esm.js';
|
|
30
32
|
export { Dialog } from '../Notifications/Dialog/Dialog.esm.js';
|
|
31
33
|
export { DiscardChangesModal } from '../Notifications/DiscardChangesModal/DiscardChangesModal.esm.js';
|
|
32
|
-
export { BaseModalActions as ModalActions } from '../Notifications/BaseModal/BaseModalActions/BaseModalActions.esm.js';
|
|
34
|
+
export { BaseModalActions as ModalActions, BaseModalActions as SideSheetActions } from '../Notifications/BaseModal/BaseModalActions/BaseModalActions.esm.js';
|
|
33
35
|
export { BaseModalContent as ModalContent } from '../Notifications/BaseModal/BaseModalContent/BaseModalContent.esm.js';
|
|
34
36
|
export { BaseModalHeader as ModalHeader } from '../Notifications/BaseModal/BaseModalHeader/BaseModalHeader.esm.js';
|
|
35
37
|
export { NotificationProvider, useNotificationContext } from '../Notifications/NotificationProvider/NotificationContext.esm.js';
|
|
36
38
|
export { SlideInModal } from '../Notifications/SlideInModal/SlideInModal.esm.js';
|
|
39
|
+
export { SideSheet } from '../Notifications/SideSheet/SideSheet.esm.js';
|
|
40
|
+
export { SideSheetContent } from '../Notifications/SideSheet/SideSheetContent/SideSheetContent.esm.js';
|
|
41
|
+
export { SideSheetHeader } from '../Notifications/SideSheet/SideSheetHeader/SideSheetHeader.esm.js';
|
|
37
42
|
export { Checkbox } from '../Form/Checkbox/Checkbox.esm.js';
|
|
38
43
|
export { Fieldset } from '../Form/Fieldset/Fieldset.esm.js';
|
|
39
44
|
export { Form } from '../Form/Form.esm.js';
|
|
@@ -55,6 +60,7 @@ export { CheckboxWrapper } from '../Form/Wrapper/CheckboxWrapper/CheckboxWrapper
|
|
|
55
60
|
export { TextareaWrapper } from '../Form/Wrapper/TextareaWrapper/TextareaWrapper.esm.js';
|
|
56
61
|
export { SelectWrapper } from '../Form/Wrapper/SelectWrapper/SelectWrapper.esm.js';
|
|
57
62
|
export { FileUpload } from '../Form/FileUpload/FileUpload.esm.js';
|
|
63
|
+
export { ACTION_STATUS, FILE_ACTION } from '../Form/FileUpload/FileItem/FileItem.esm.js';
|
|
58
64
|
export { MultiSelectWrapper } from '../Form/Wrapper/MultiSelectWrapper/MultiSelectWrapper.esm.js';
|
|
59
65
|
export { ContentHeader } from '../Layout/ContentHeader/ContentHeader.esm.js';
|
|
60
66
|
export { FormStepper } from '../Layout/FormPage/FormWithStepper/FormStepper/FormStepper.esm.js';
|
|
@@ -64,6 +70,7 @@ export { DataGrid } from '../DataGrid/DataGrid.esm.js';
|
|
|
64
70
|
export { DataGridRow } from '../DataGrid/DataGridBody/DataGridRow/DataGridRow.esm.js';
|
|
65
71
|
export { DataGridDrawerItem } from '../DataGrid/DataGridBody/DataGridDrawer/DataGridDrawerItem.esm.js';
|
|
66
72
|
export { DataGridCell } from '../DataGrid/DataGridBody/DataGridCell/DataGridCell.esm.js';
|
|
73
|
+
export { FilterKeyMapper } from '../DataGrid/DataGridFilters/FilterKeyMapper.esm.js';
|
|
67
74
|
export { useFiltersReducer } from '../DataGrid/DataGridFilters/useFiltersReducer.esm.js';
|
|
68
75
|
export { Banner } from '../Notifications/Banner/Banner.esm.js';
|
|
69
76
|
export { DatePicker } from '../DatePicker/DatePicker.esm.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,9 +4,6 @@ export declare const debounce: (fn: (...args: unknown[]) => unknown, delay: numb
|
|
|
4
4
|
export declare const throttle: (fn: (...args: unknown[]) => unknown, delay: number) => () => void;
|
|
5
5
|
export declare const isEqual: (x: any, y: any) => boolean;
|
|
6
6
|
export declare const areArraysDifferent: (arr1: Record<string, any>[], arr2: Record<string, any>[], key: string) => boolean;
|
|
7
|
-
export declare const getValueByPath: (obj: {
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}, path: string) => any;
|
|
10
7
|
/** Source: https://stackoverflow.com/a/42769683/5084110 */
|
|
11
8
|
export declare const remToPx: (rem: number) => number;
|
|
12
9
|
export declare const isJsonString: (str: any) => boolean;
|
|
@@ -131,6 +131,15 @@ const throttle = (fn, delay) => {
|
|
|
131
131
|
const remToPx = (rem) => {
|
|
132
132
|
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
133
133
|
};
|
|
134
|
+
const isJsonString = (str) => {
|
|
135
|
+
try {
|
|
136
|
+
JSON.parse(str);
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
134
143
|
const deepMerge = (obj1, obj2) => {
|
|
135
144
|
if (!obj2)
|
|
136
145
|
return obj1;
|
|
@@ -152,5 +161,5 @@ const deepMerge = (obj1, obj2) => {
|
|
|
152
161
|
};
|
|
153
162
|
const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
154
163
|
|
|
155
|
-
export { debounce, deepMerge, escapeRegExp, filterProps, generateID, remToPx, throttle };
|
|
164
|
+
export { debounce, deepMerge, escapeRegExp, filterProps, generateID, isJsonString, remToPx, throttle };
|
|
156
165
|
//# sourceMappingURL=helper.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.esm.js","sources":["../../../../../../src/util/helper.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype KeyValuePair = { [key: string]: unknown };\n\nexport const generateID = (length = 15, stringToWeaveIn?: string) => {\n /** We will make sure to mesh the generate id and name property together to basically create a unique ID */\n let hashCharacters = [\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"0\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\"\n ];\n\n let id = \"\";\n\n /** Generate an id of x characters in length */\n for (let i = 0; i < length && id.length < length; i++) {\n let stringCharacter =\n typeof stringToWeaveIn === \"string\" &&\n stringToWeaveIn?.[i] !== undefined &&\n !/\\s/.test(stringToWeaveIn[i])\n ? stringToWeaveIn[i]\n : \"\";\n id = id + stringCharacter + hashCharacters[Math.floor(Math.random() * hashCharacters.length)];\n }\n\n return id.slice(0, length);\n};\n\nexport const filterProps = (props: any, regexPattern: RegExp, returnFiltered: boolean = true) => {\n if (returnFiltered) {\n return Object.keys(props).reduce((acc: KeyValuePair, key) => {\n if (regexPattern.test(key)) {\n acc[key] = props[key];\n }\n\n return acc;\n }, {});\n } else {\n return Object.entries(props)\n .filter(([key]) => !regexPattern.test(key))\n .reduce(\n (prevObj, currKeyValPair) => ({ ...prevObj, [currKeyValPair[0]]: currKeyValPair[1] }),\n {}\n );\n }\n};\n\nexport const debounce = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let timeout: undefined | ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: unknown[]) {\n const later = () => {\n clearTimeout(timeout);\n fn(...args);\n };\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, delay);\n };\n};\n\nexport const throttle = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let lastTime = 0;\n\n return function () {\n let now = Date.now();\n\n if (now - lastTime >= delay) {\n fn();\n lastTime = now;\n }\n };\n};\n\nexport const isEqual = (x: any, y: any): boolean => {\n const typesCoincide = x && y && typeof x === \"object\" && typeof y === \"object\";\n return typesCoincide\n ? Object.keys(x).length === Object.keys(y).length &&\n Object.keys(x).every(key => isEqual(x[key], y[key]))\n : x === y;\n};\n\nexport const areArraysDifferent = (\n arr1: Record<string, any>[],\n arr2: Record<string, any>[],\n key: string\n) => {\n if (arr1.length !== arr2.length) {\n return true;\n } else {\n const firstFilteredArray = arr1.filter(arr1Item =>\n arr2.some((arr2Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n const secondFilteredArray = arr2.filter(arr2Item =>\n arr1.some((arr1Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n\n return !!firstFilteredArray.length || !!secondFilteredArray.length;\n }\n};\n\
|
|
1
|
+
{"version":3,"file":"helper.esm.js","sources":["../../../../../../src/util/helper.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype KeyValuePair = { [key: string]: unknown };\n\nexport const generateID = (length = 15, stringToWeaveIn?: string) => {\n /** We will make sure to mesh the generate id and name property together to basically create a unique ID */\n let hashCharacters = [\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"0\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\"\n ];\n\n let id = \"\";\n\n /** Generate an id of x characters in length */\n for (let i = 0; i < length && id.length < length; i++) {\n let stringCharacter =\n typeof stringToWeaveIn === \"string\" &&\n stringToWeaveIn?.[i] !== undefined &&\n !/\\s/.test(stringToWeaveIn[i])\n ? stringToWeaveIn[i]\n : \"\";\n id = id + stringCharacter + hashCharacters[Math.floor(Math.random() * hashCharacters.length)];\n }\n\n return id.slice(0, length);\n};\n\nexport const filterProps = (props: any, regexPattern: RegExp, returnFiltered: boolean = true) => {\n if (returnFiltered) {\n return Object.keys(props).reduce((acc: KeyValuePair, key) => {\n if (regexPattern.test(key)) {\n acc[key] = props[key];\n }\n\n return acc;\n }, {});\n } else {\n return Object.entries(props)\n .filter(([key]) => !regexPattern.test(key))\n .reduce(\n (prevObj, currKeyValPair) => ({ ...prevObj, [currKeyValPair[0]]: currKeyValPair[1] }),\n {}\n );\n }\n};\n\nexport const debounce = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let timeout: undefined | ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: unknown[]) {\n const later = () => {\n clearTimeout(timeout);\n fn(...args);\n };\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, delay);\n };\n};\n\nexport const throttle = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let lastTime = 0;\n\n return function () {\n let now = Date.now();\n\n if (now - lastTime >= delay) {\n fn();\n lastTime = now;\n }\n };\n};\n\nexport const isEqual = (x: any, y: any): boolean => {\n const typesCoincide = x && y && typeof x === \"object\" && typeof y === \"object\";\n return typesCoincide\n ? Object.keys(x).length === Object.keys(y).length &&\n Object.keys(x).every(key => isEqual(x[key], y[key]))\n : x === y;\n};\n\nexport const areArraysDifferent = (\n arr1: Record<string, any>[],\n arr2: Record<string, any>[],\n key: string\n) => {\n if (arr1.length !== arr2.length) {\n return true;\n } else {\n const firstFilteredArray = arr1.filter(arr1Item =>\n arr2.some((arr2Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n const secondFilteredArray = arr2.filter(arr2Item =>\n arr1.some((arr1Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n\n return !!firstFilteredArray.length || !!secondFilteredArray.length;\n }\n};\n\n/** Source: https://stackoverflow.com/a/42769683/5084110 */\nexport const remToPx = (rem: number): number => {\n return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);\n};\n\nexport const isJsonString = (str: any) => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n};\n\ntype ObjectType = { [key: string]: any };\n\nexport const deepMerge = <T extends {}>(obj1: ObjectType, obj2: ObjectType | false): T => {\n if (!obj2) return obj1 as T;\n\n let result: ObjectType = { ...obj1 };\n\n for (let key in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, key)) {\n if (\n typeof obj2[key] === \"object\" &&\n obj2[key] !== null &&\n Object.prototype.hasOwnProperty.call(obj1, key) &&\n !Array.isArray(obj2[key])\n ) {\n result[key] = deepMerge(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result as T;\n};\n\nexport const escapeRegExp = (str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;AAcG;AAIU,MAAA,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,EAAE,eAAwB,KAAI;;AAElE,IAAA,IAAI,cAAc,GAAG;QACnB,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAAG;QACH,GAA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dist/lib/style-inject.js
CHANGED
|
@@ -2,51 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
|
-
|
|
7
5
|
function getDefaultExportFromCjs (x) {
|
|
8
6
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
var styleInject$
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
9
|
+
var styleInject$2 = {exports: {}};
|
|
10
|
+
|
|
11
|
+
var styleInject$1 = styleInject$2.exports;
|
|
12
|
+
|
|
13
|
+
var hasRequiredStyleInject;
|
|
14
|
+
|
|
15
|
+
function requireStyleInject () {
|
|
16
|
+
if (hasRequiredStyleInject) return styleInject$2.exports;
|
|
17
|
+
hasRequiredStyleInject = 1;
|
|
18
|
+
(function (module, exports) {
|
|
19
|
+
(function (global, factory) {
|
|
20
|
+
module.exports = factory() ;
|
|
21
|
+
}(styleInject$1, (function () {
|
|
22
|
+
function styleInject(css, ref) {
|
|
23
|
+
if ( ref === void 0 ) ref = {};
|
|
24
|
+
var insertAt = ref.insertAt;
|
|
25
|
+
|
|
26
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
27
|
+
|
|
28
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
29
|
+
var style = document.createElement('style');
|
|
30
|
+
style.type = 'text/css';
|
|
31
|
+
|
|
32
|
+
if (insertAt === 'top') {
|
|
33
|
+
if (head.firstChild) {
|
|
34
|
+
head.insertBefore(style, head.firstChild);
|
|
35
|
+
} else {
|
|
36
|
+
head.appendChild(style);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
head.appendChild(style);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (style.styleSheet) {
|
|
43
|
+
style.styleSheet.cssText = css;
|
|
44
|
+
} else {
|
|
45
|
+
style.appendChild(document.createTextNode(css));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return styleInject;
|
|
50
|
+
|
|
51
|
+
})));
|
|
52
|
+
} (styleInject$2));
|
|
53
|
+
return styleInject$2.exports;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var styleInjectExports = requireStyleInject();
|
|
50
57
|
var styleInject = /*@__PURE__*/getDefaultExportFromCjs(styleInjectExports);
|
|
51
58
|
|
|
52
59
|
exports.default = styleInject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-inject.js","sources":["../../node_modules/style-inject/dist/style-inject.js"],"sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.styleInject = factory());\n}(this, (function () { 'use strict';\n\nfunction styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nreturn styleInject;\n\n})));\n"],"names":["this"],"mappings":"
|
|
1
|
+
{"version":3,"file":"style-inject.js","sources":["../../node_modules/style-inject/dist/style-inject.js","../../node_modules/style-inject/dist/style-inject.js?commonjs-entry"],"sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.styleInject = factory());\n}(this, (function () { 'use strict';\n\nfunction styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nreturn styleInject;\n\n})));\n","import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireStyleInject } from \"/home/circleci/project/node_modules/style-inject/dist/style-inject.js\";\nvar styleInjectExports = requireStyleInject();\nexport { styleInjectExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(styleInjectExports);"],"names":["this"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,EAAA,CAAC,UAAU,MAAM,EAAE,OAAO,EAAE;GACoC,MAAiB,CAAA,OAAA,GAAA,OAAO,EAAE,CAEzD,CAAC;AAClC,GAAC,CAACA,aAAI,GAAG,YAAY,CACrB;AACA,EAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;IAC7B,KAAK,GAAG,KAAK,KA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