@wavelengthusaf/components 1.2.4 → 1.2.6

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.mjs CHANGED
@@ -4992,10 +4992,8 @@ function WavelengthSnackbar(props) {
4992
4992
  // src/components/snackbars/WavelengthStandardSnackbar.tsx
4993
4993
  import React31 from "react";
4994
4994
  import Snackbar2 from "@mui/material/Snackbar";
4995
- import IconButton5 from "@mui/material/IconButton";
4996
- import CloseIcon3 from "@mui/icons-material/Close";
4997
4995
  import SnackbarContent2 from "@mui/material/SnackbarContent";
4998
- function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width: width2, message, customVertyAlign, toggleShow }) {
4996
+ function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width: width2, message, customVertyAlign, toggleShow, closeIcon }) {
4999
4997
  const handleClose = () => {
5000
4998
  toggleShow(false);
5001
4999
  };
@@ -5040,7 +5038,7 @@ function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign,
5040
5038
  }
5041
5039
  },
5042
5040
  /* @__PURE__ */ React31.createElement("div", { style: { marginTop: 4, gridColumnStart: 2, gridColumnEnd: 5, textAlign: "center", display: "flex", flexDirection: "row", justifyContent: "center" }, id: "snackbar" }, /* @__PURE__ */ React31.createElement("div", null, sIcon), /* @__PURE__ */ React31.createElement("div", { style: { fontSize: "1rem", marginLeft: "10px" } }, message ? message : "Insert Message Here")),
5043
- /* @__PURE__ */ React31.createElement("div", { style: { gridColumnStart: 6 } }, " ", /* @__PURE__ */ React31.createElement(IconButton5, { size: "small", "aria-label": "close", color: "inherit" }, /* @__PURE__ */ React31.createElement(CloseIcon3, { fontSize: "small" })))
5041
+ /* @__PURE__ */ React31.createElement("div", { style: { gridColumnStart: 6 }, onClick: handleClose }, closeIcon)
5044
5042
  )
5045
5043
  }
5046
5044
  )
@@ -5048,19 +5046,69 @@ function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign,
5048
5046
  }
5049
5047
 
5050
5048
  // src/components/snackbars/TestSnackbar.tsx
5051
- import { Button as Button5, IconButton as IconButton6, Snackbar as Snackbar3 } from "@mui/material";
5052
- import React32 from "react";
5053
- import CloseIcon4 from "@mui/icons-material/Close";
5054
- function TestSnackbar({ openProp, toggleOpen }) {
5055
- const [open, setOpen] = React32.useState(openProp);
5056
- const handleClose = (event, reason) => {
5057
- if (reason === "clickaway") {
5058
- return;
5059
- }
5049
+ import React32, { useEffect, useRef as useRef2 } from "react";
5050
+ import { Box as Box5, Button as Button5 } from "@mui/material";
5051
+ var useOutsideClick = (callback) => {
5052
+ const ref = useRef2(null);
5053
+ useEffect(() => {
5054
+ const handleClickOutside = (event) => {
5055
+ if (ref.current && !ref.current.contains(event.target)) {
5056
+ callback();
5057
+ }
5058
+ };
5059
+ document.addEventListener("mouseup", handleClickOutside);
5060
+ document.addEventListener("touchend", handleClickOutside);
5061
+ return () => {
5062
+ document.removeEventListener("mouseup", handleClickOutside);
5063
+ document.removeEventListener("touchend", handleClickOutside);
5064
+ };
5065
+ }, [callback]);
5066
+ return ref;
5067
+ };
5068
+ function TestSnackbar({ isPopUpOpen, toggleOpen, type, message, customVertyAlign, width: width2, img }) {
5069
+ const ref = useOutsideClick(() => {
5060
5070
  toggleOpen(false);
5061
- };
5062
- const action = /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Button5, { color: "secondary", size: "small", onClick: handleClose }, "UNDO"), /* @__PURE__ */ React32.createElement(IconButton6, { size: "small", "aria-label": "close", color: "inherit", onClick: handleClose }, /* @__PURE__ */ React32.createElement(CloseIcon4, { fontSize: "small" })));
5063
- return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Snackbar3, { open: openProp, autoHideDuration: 6e3, onClose: handleClose, message: "Note archived", action }));
5071
+ });
5072
+ let bgColor = "";
5073
+ if (type == "success") {
5074
+ bgColor = "#25ab21";
5075
+ } else if (type == "error") {
5076
+ bgColor = "#FF4646";
5077
+ } else if (type == "disabled") {
5078
+ bgColor = "#737373";
5079
+ }
5080
+ return /* @__PURE__ */ React32.createElement(React32.Fragment, null, isPopUpOpen && /* @__PURE__ */ React32.createElement(
5081
+ Box5,
5082
+ {
5083
+ sx: { position: "fixed", right: "auto", top: "24px", left: "50%", transform: "translateX(-50%)" },
5084
+ ref,
5085
+ style: {
5086
+ height: "50px",
5087
+ width: width2,
5088
+ backgroundColor: bgColor,
5089
+ borderRadius: "1px",
5090
+ display: "flex",
5091
+ justifyContent: "space-between",
5092
+ alignItems: "center",
5093
+ paddingRight: "20px",
5094
+ paddingLeft: "20px",
5095
+ zIndex: 2800,
5096
+ marginTop: customVertyAlign ? `${customVertyAlign}` : ""
5097
+ }
5098
+ },
5099
+ /* @__PURE__ */ React32.createElement("div", { style: { backgroundColor: "red" } }),
5100
+ /* @__PURE__ */ React32.createElement("div", { style: { color: "white", fontSize: "1rem" } }, message),
5101
+ /* @__PURE__ */ React32.createElement(
5102
+ Button5,
5103
+ {
5104
+ variant: "text",
5105
+ onClick: () => {
5106
+ toggleOpen(false);
5107
+ }
5108
+ },
5109
+ img
5110
+ )
5111
+ ));
5064
5112
  }
5065
5113
  export {
5066
5114
  AceOfSpadesComponent,
@@ -5101,6 +5149,7 @@ export {
5101
5149
  add,
5102
5150
  concat,
5103
5151
  findBestStringMatch,
5152
+ useOutsideClick,
5104
5153
  useThemeContext
5105
5154
  };
5106
5155
  /*! Bundled license information: