@symply.io/basic-components 1.4.0-beta.1 → 1.4.0-beta.3
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.js
CHANGED
@@ -20,8 +20,8 @@ function Transition(args) {
|
|
20
20
|
return _jsx(Slide, __assign({}, args, { direction: "up" }));
|
21
21
|
}
|
22
22
|
function Prompt(props) {
|
23
|
-
var open = props.open,
|
23
|
+
var open = props.open, type = props.type, message = props.message, timeout = props.timeout, onClose = props.onClose;
|
24
24
|
var theme = useCustomTheme();
|
25
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: { zIndex: 99999 } }, { children: _jsxs(Alert, __assign({ variant: "filled", security:
|
25
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Snackbar, __assign({ anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: open, onClose: onClose, autoHideDuration: timeout, TransitionComponent: Transition, sx: { zIndex: 99999 } }, { children: _jsxs(Alert, __assign({ variant: "filled", security: type, sx: { width: "100%", fontSize: 14, fontWeight: 700 }, onClose: onClose }, { children: [_jsx(AlertTitle, __assign({ sx: { textTransform: "capitalize", fontSize: 14, fontWeight: 700 } }, { children: type })), message] })) }), "".concat(Date.now() * Math.round(Math.random()))) })));
|
26
26
|
}
|
27
27
|
export default Prompt;
|
package/ToastPrompt/types.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import type { CSSProperties, ReactNode, SyntheticEvent } from "react";
|
2
2
|
import type { SnackbarCloseReason } from "@mui/material/Snackbar";
|
3
3
|
import type { SvgIconComponent } from "@mui/icons-material";
|
4
|
-
export declare type
|
5
|
-
export declare type PromptStyles = Record<
|
4
|
+
export declare type Severity = "success" | "warning" | "info" | "error";
|
5
|
+
export declare type PromptStyles = Record<Severity, {
|
6
6
|
backgroundColor: CSSProperties["color"];
|
7
7
|
}>;
|
8
|
-
export declare type PromptIcons = Record<
|
8
|
+
export declare type PromptIcons = Record<Severity, SvgIconComponent>;
|
9
9
|
declare type PromptArgs = {
|
10
10
|
message: string | 400;
|
11
|
-
|
11
|
+
type: Severity;
|
12
12
|
timeout: number;
|
13
13
|
};
|
14
14
|
export interface InterfaceStates {
|
@@ -2,12 +2,12 @@
|
|
2
2
|
declare function useInteractions(): {
|
3
3
|
promptArgs: {
|
4
4
|
message: string | 400;
|
5
|
-
|
5
|
+
type: import("./types").Severity;
|
6
6
|
timeout: number;
|
7
7
|
} & Record<"open", boolean>;
|
8
8
|
onShow: (args: {
|
9
9
|
message: string | 400;
|
10
|
-
|
10
|
+
type: import("./types").Severity;
|
11
11
|
timeout: number;
|
12
12
|
}) => void;
|
13
13
|
onHide: (event: Event | import("react").SyntheticEvent<Element, Event>, reason?: import("@mui/material").SnackbarCloseReason | undefined) => void;
|
@@ -15,7 +15,7 @@ function useInteractions() {
|
|
15
15
|
var _a = useState({
|
16
16
|
open: false,
|
17
17
|
message: "Saved",
|
18
|
-
|
18
|
+
type: "success",
|
19
19
|
timeout: 3500
|
20
20
|
}), promptArgs = _a[0], setPromptArgs = _a[1];
|
21
21
|
var onHide = useCallback(function (_, reason) {
|
@@ -25,11 +25,11 @@ function useInteractions() {
|
|
25
25
|
setPromptArgs(function (args) { return (__assign(__assign({}, args), { open: false })); });
|
26
26
|
}, []);
|
27
27
|
var onShow = useCallback(function (args) {
|
28
|
-
var _a = args.message, message = _a === void 0 ? "Unknown message" : _a, _b = args.
|
28
|
+
var _a = args.message, message = _a === void 0 ? "Unknown message" : _a, _b = args.type, type = _b === void 0 ? "error" : _b, _c = args.timeout, timeout = _c === void 0 ? 3500 : _c;
|
29
29
|
setPromptArgs({
|
30
30
|
open: true,
|
31
31
|
message: message === 400 ? ERROR_MESSAGE : message,
|
32
|
-
|
32
|
+
type: type,
|
33
33
|
timeout: timeout
|
34
34
|
});
|
35
35
|
}, []);
|