@symply.io/basic-components 1.4.0-beta.2 → 1.4.0-beta.4

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.
@@ -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, variant = props.variant, message = props.message, timeout = props.timeout, onClose = props.onClose;
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: variant, sx: { width: "100%", fontSize: 14, fontWeight: 700 }, onClose: onClose }, { children: [_jsx(AlertTitle, __assign({ sx: { textTransform: "capitalize" } }, { children: variant })), message] })) }), "".concat(Date.now() * Math.round(Math.random()))) })));
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;
@@ -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 Variant = "success" | "warning" | "info" | "error";
5
- export declare type PromptStyles = Record<Variant, {
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<Variant, SvgIconComponent>;
8
+ export declare type PromptIcons = Record<Severity, SvgIconComponent>;
9
9
  declare type PromptArgs = {
10
10
  message: string | 400;
11
- variant: Variant;
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
- variant: import("./types").Variant;
5
+ type: import("./types").Severity;
6
6
  timeout: number;
7
7
  } & Record<"open", boolean>;
8
8
  onShow: (args: {
9
9
  message: string | 400;
10
- variant: import("./types").Variant;
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;
@@ -12,10 +12,11 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { useState, useCallback } from "react";
13
13
  function useInteractions() {
14
14
  var ERROR_MESSAGE = "Internal Server Error";
15
+ var UNKNOWN_MESSAGE = "Unknown Message";
15
16
  var _a = useState({
16
17
  open: false,
17
- message: "Saved",
18
- variant: "success",
18
+ message: UNKNOWN_MESSAGE,
19
+ type: "error",
19
20
  timeout: 3500
20
21
  }), promptArgs = _a[0], setPromptArgs = _a[1];
21
22
  var onHide = useCallback(function (_, reason) {
@@ -25,12 +26,12 @@ function useInteractions() {
25
26
  setPromptArgs(function (args) { return (__assign(__assign({}, args), { open: false })); });
26
27
  }, []);
27
28
  var onShow = useCallback(function (args) {
28
- var _a = args.message, message = _a === void 0 ? "Unknown message" : _a, _b = args.variant, variant = _b === void 0 ? "info" : _b, _c = args.timeout, timeout = _c === void 0 ? 3500 : _c;
29
+ 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
30
  setPromptArgs({
30
- open: true,
31
31
  message: message === 400 ? ERROR_MESSAGE : message,
32
- variant: variant,
33
- timeout: timeout
32
+ type: type,
33
+ timeout: timeout,
34
+ open: true
34
35
  });
35
36
  }, []);
36
37
  return { promptArgs: promptArgs, onShow: onShow, onHide: onHide };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.4.0-beta.2",
3
+ "version": "1.4.0-beta.4",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",