@inceptionbg/iui 2.0.32 → 2.0.34
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 +5 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Dialog/Dialog.tsx +6 -3
- package/src/hooks/useLocalPopoverControl.ts +4 -3
- package/src/index.ts +7 -1
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ type BaseProps = {
|
|
|
24
24
|
desc?: string;
|
|
25
25
|
descEl?: ReactNode;
|
|
26
26
|
onFormSubmit?: () => void;
|
|
27
|
+
onCloseCallback?: () => void;
|
|
27
28
|
isLoading?: boolean;
|
|
28
29
|
footer?: IDialogFooterActions;
|
|
29
30
|
isKeyboardDisabled?: boolean;
|
|
@@ -38,7 +39,6 @@ type BaseProps = {
|
|
|
38
39
|
|
|
39
40
|
export type ImperativeDialogProps = {
|
|
40
41
|
control: ILocalPopupControl;
|
|
41
|
-
onCloseCallback?: () => void;
|
|
42
42
|
isOpen?: never;
|
|
43
43
|
onClose?: undefined;
|
|
44
44
|
};
|
|
@@ -46,7 +46,6 @@ export type DeclarativeDialogProps = {
|
|
|
46
46
|
isOpen: boolean;
|
|
47
47
|
onClose: () => void;
|
|
48
48
|
control?: never;
|
|
49
|
-
onCloseCallback?: undefined;
|
|
50
49
|
};
|
|
51
50
|
|
|
52
51
|
type Props = BaseProps & (ImperativeDialogProps | DeclarativeDialogProps);
|
|
@@ -57,6 +56,7 @@ export const Dialog: FC<Props> = ({
|
|
|
57
56
|
desc,
|
|
58
57
|
descEl,
|
|
59
58
|
onFormSubmit,
|
|
59
|
+
onCloseCallback,
|
|
60
60
|
isLoading,
|
|
61
61
|
footer,
|
|
62
62
|
isKeyboardDisabled,
|
|
@@ -71,7 +71,10 @@ export const Dialog: FC<Props> = ({
|
|
|
71
71
|
}) => {
|
|
72
72
|
const formRef = useRef<HTMLFormElement>(null);
|
|
73
73
|
|
|
74
|
-
const { elementRef, isOpen, onClose } = useLocalPopoverControl({
|
|
74
|
+
const { elementRef, isOpen, onClose } = useLocalPopoverControl({
|
|
75
|
+
...rest,
|
|
76
|
+
onCloseCallback,
|
|
77
|
+
});
|
|
75
78
|
|
|
76
79
|
const focusableElements = useGetFocusableElements({
|
|
77
80
|
elementRef,
|
|
@@ -4,7 +4,9 @@ import type {
|
|
|
4
4
|
} from '../components/Dialog/Dialog';
|
|
5
5
|
import { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
type Props = ImperativeDialogProps | DeclarativeDialogProps
|
|
7
|
+
type Props = (ImperativeDialogProps | DeclarativeDialogProps) & {
|
|
8
|
+
onCloseCallback?: () => void;
|
|
9
|
+
};
|
|
8
10
|
|
|
9
11
|
export const useLocalPopoverControl = (props: Props) => {
|
|
10
12
|
const { control, onCloseCallback, isOpen: propsIsOpen, onClose } = props;
|
|
@@ -28,14 +30,13 @@ export const useLocalPopoverControl = (props: Props) => {
|
|
|
28
30
|
timeoutRef.current = setTimeout(() => {
|
|
29
31
|
setIsMounted(false);
|
|
30
32
|
onCloseCallback?.();
|
|
31
|
-
onClose?.();
|
|
32
33
|
}, 200);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
return () => {
|
|
36
37
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
37
38
|
};
|
|
38
|
-
}, [shouldBeOpen, isMounted,
|
|
39
|
+
}, [shouldBeOpen, isMounted, onCloseCallback]);
|
|
39
40
|
|
|
40
41
|
const handleCloseRequest = useCallback(() => {
|
|
41
42
|
if (isImperative) {
|
package/src/index.ts
CHANGED
|
@@ -86,7 +86,12 @@ import { TextAreaInput } from './components/Inputs/TextAreaInput';
|
|
|
86
86
|
import { TextInput } from './components/Inputs/TextInput';
|
|
87
87
|
import { TimeInput } from './components/Inputs/TimeInput/TimeInput';
|
|
88
88
|
import { List } from './components/List/List';
|
|
89
|
-
import {
|
|
89
|
+
import {
|
|
90
|
+
FullScreenLoader,
|
|
91
|
+
LazyLoader,
|
|
92
|
+
Loader,
|
|
93
|
+
SimpleLoader,
|
|
94
|
+
} from './components/Loader/Loader';
|
|
90
95
|
import { ProgressBar } from './components/Loader/ProgressBar';
|
|
91
96
|
import { Menu } from './components/Menu/Menu';
|
|
92
97
|
import { MenuItem } from './components/Menu/MenuItem';
|
|
@@ -215,6 +220,7 @@ export {
|
|
|
215
220
|
TextAreaInput,
|
|
216
221
|
LazyLoader,
|
|
217
222
|
Loader,
|
|
223
|
+
SimpleLoader,
|
|
218
224
|
List,
|
|
219
225
|
Menu,
|
|
220
226
|
MenuItem,
|