@symply.io/basic-components 1.3.11-alpha.6 → 1.3.11-alpha.8
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/ToastPrompt/Prompt.d.ts +2 -3
- package/ToastPrompt/Prompt.js +1 -2
- package/ToastPrompt/index.d.ts +1 -3
- package/ToastPrompt/index.js +1 -2
- package/ToastPrompt/types.d.ts +4 -4
- package/ToastPrompt/useInteractions.d.ts +2 -2
- package/ToastPrompt/useInteractions.js +6 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -1
package/ToastPrompt/Prompt.d.ts
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
import { PromptProps } from "./types";
|
2
|
-
export
|
3
|
-
export default Prompt;
|
1
|
+
import type { PromptProps } from "./types";
|
2
|
+
export default function Prompt(props: PromptProps): JSX.Element;
|
package/ToastPrompt/Prompt.js
CHANGED
@@ -14,7 +14,7 @@ import useCustomTheme from "../useCustomTheme";
|
|
14
14
|
const Transition = (args) => {
|
15
15
|
return _jsx(Slide, { ...args, direction: "up" });
|
16
16
|
};
|
17
|
-
export function Prompt(props) {
|
17
|
+
export default function Prompt(props) {
|
18
18
|
const { open, icon, variant, message, timeout, onClose } = props;
|
19
19
|
const theme = useCustomTheme();
|
20
20
|
const styles = useMemo(() => ({
|
@@ -60,4 +60,3 @@ export function Prompt(props) {
|
|
60
60
|
marginRight: theme.spacing(1)
|
61
61
|
} })) : (_jsx(_Fragment, { children: icon })), message] }) }) }, `${Date.now() * Math.round(Math.random())}`) }));
|
62
62
|
}
|
63
|
-
export default Prompt;
|
package/ToastPrompt/index.d.ts
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
import {
|
2
|
-
import { PromptProviderProps, PromptContextProps } from "./types";
|
1
|
+
import type { PromptProviderProps, PromptContextProps } from "./types";
|
3
2
|
export declare function PromptProvider(props: PromptProviderProps): JSX.Element;
|
4
3
|
export declare function usePrompt(): PromptContextProps;
|
5
|
-
export default Prompt;
|
package/ToastPrompt/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { createContext, useContext } from "react";
|
3
|
-
import
|
3
|
+
import Prompt from "./Prompt";
|
4
4
|
import useInteractions from "./useInteractions";
|
5
5
|
const PromptContext = createContext({
|
6
6
|
showPrompt: () => { }
|
@@ -13,4 +13,3 @@ export function PromptProvider(props) {
|
|
13
13
|
export function usePrompt() {
|
14
14
|
return useContext(PromptContext);
|
15
15
|
}
|
16
|
-
export default Prompt;
|
package/ToastPrompt/types.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import { CSSProperties, ReactNode } from "react";
|
2
|
-
import { SnackbarCloseReason } from "@mui/material/Snackbar";
|
3
|
-
import { SvgIconComponent } from "@mui/icons-material";
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
2
|
+
import type { SnackbarCloseReason } from "@mui/material/Snackbar";
|
3
|
+
import type { SvgIconComponent } from "@mui/icons-material";
|
4
4
|
export declare type Variant = "success" | "warning" | "info" | "error";
|
5
5
|
export declare type PromptStyles = Record<Variant, {
|
6
6
|
backgroundColor: CSSProperties["color"];
|
7
7
|
}>;
|
8
8
|
export declare type PromptIcons = Record<Variant, SvgIconComponent>;
|
9
9
|
declare type PromptArgs = {
|
10
|
-
message: string;
|
10
|
+
message: string | 400;
|
11
11
|
variant: Variant;
|
12
12
|
timeout: number;
|
13
13
|
};
|
@@ -1,11 +1,11 @@
|
|
1
1
|
declare function useInteractions(): {
|
2
2
|
promptArgs: {
|
3
|
-
message: string;
|
3
|
+
message: string | 400;
|
4
4
|
variant: import("./types").Variant;
|
5
5
|
timeout: number;
|
6
6
|
} & Record<"open", boolean>;
|
7
7
|
onShow: (args: {
|
8
|
-
message: string;
|
8
|
+
message: string | 400;
|
9
9
|
variant: import("./types").Variant;
|
10
10
|
timeout: number;
|
11
11
|
}) => void;
|
@@ -15,7 +15,12 @@ function useInteractions() {
|
|
15
15
|
}, []);
|
16
16
|
const onShow = useCallback(args => {
|
17
17
|
const { message = "Unknown message", variant = "info", timeout = 3500 } = args;
|
18
|
-
setPromptArgs({
|
18
|
+
setPromptArgs({
|
19
|
+
open: true,
|
20
|
+
message: message === 400 ? ERROR_MESSAGE : message,
|
21
|
+
variant,
|
22
|
+
timeout
|
23
|
+
});
|
19
24
|
}, []);
|
20
25
|
return { promptArgs, onShow, onHide };
|
21
26
|
}
|
package/index.d.ts
CHANGED
@@ -48,5 +48,4 @@ export { default as SocialInput } from "./SocialInput";
|
|
48
48
|
export { default as TabGroup } from "./TabGroup";
|
49
49
|
export { default as TablePagination } from "./TablePagination";
|
50
50
|
export { default as TextInput } from "./TextInput";
|
51
|
-
export { default as ToastPrompt } from "./ToastPrompt";
|
52
51
|
export { default as VideoPlayerModal } from "./VideoPlayerModal";
|
package/index.js
CHANGED
@@ -48,5 +48,4 @@ export { default as SocialInput } from "./SocialInput";
|
|
48
48
|
export { default as TabGroup } from "./TabGroup";
|
49
49
|
export { default as TablePagination } from "./TablePagination";
|
50
50
|
export { default as TextInput } from "./TextInput";
|
51
|
-
export { default as ToastPrompt } from "./ToastPrompt";
|
52
51
|
export { default as VideoPlayerModal } from "./VideoPlayerModal";
|