@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.d.mts CHANGED
@@ -312,6 +312,7 @@ declare function WavelengthSnackbar(props: ConfirmationSnackbarProps): React__de
312
312
  interface StandardSnackbarProps {
313
313
  type: "success" | "error" | "disabled";
314
314
  show: boolean;
315
+ closeIcon: ReactNode | React__default.JSX.Element;
315
316
  icon?: ReactNode;
316
317
  toggleShow: (on: boolean) => void;
317
318
  horryAlign?: "left" | "right" | "center";
@@ -321,12 +322,19 @@ interface StandardSnackbarProps {
321
322
  message?: string | ReactNode;
322
323
  customVertyAlign?: string;
323
324
  }
324
- declare function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width, message, customVertyAlign, toggleShow }: StandardSnackbarProps): React__default.JSX.Element;
325
+ declare function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width, message, customVertyAlign, toggleShow, closeIcon }: StandardSnackbarProps): React__default.JSX.Element;
325
326
 
326
- interface TestProps {
327
- openProp: boolean;
328
- toggleOpen: React__default.Dispatch<React__default.SetStateAction<boolean>>;
327
+ interface Testprops {
328
+ isPopUpOpen: boolean;
329
+ type: "success" | "error" | "disabled";
330
+ icon?: ReactNode;
331
+ width?: string | number;
332
+ message?: string | ReactNode;
333
+ img: React__default.JSX.Element | ReactNode;
334
+ toggleOpen: (value: React__default.SetStateAction<boolean>) => void;
335
+ customVertyAlign?: string;
329
336
  }
330
- declare function TestSnackbar({ openProp, toggleOpen }: TestProps): React__default.JSX.Element;
337
+ declare const useOutsideClick: (callback: () => void) => React__default.RefObject<HTMLDivElement>;
338
+ declare function TestSnackbar({ isPopUpOpen, toggleOpen, type, message, customVertyAlign, width, img }: Testprops): React__default.JSX.Element;
331
339
 
332
- export { AceOfSpadesComponent, AppLogo, ArrowIcon, BomberBeeIcon, ButtonIcon, ButtonMenu, DefaultIcon, ManyPlanesComponent, NotAvailablePage, Old563EWSLogo, PortalIcon, RapidrefIcon, type SearchResult, SearchTextField, SquadronIcon, SwarmIcon, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBannerHeader, WavelengthBox, WavelengthButton, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFooter, WavelengthIcon, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthSearch, WavelengthSideBar, WavelengthSnackbar, WavelengthStandardSnackbar, WavelengthTitleBar, add, concat, findBestStringMatch, type menuItemProps, useThemeContext };
340
+ export { AceOfSpadesComponent, AppLogo, ArrowIcon, BomberBeeIcon, ButtonIcon, ButtonMenu, DefaultIcon, ManyPlanesComponent, NotAvailablePage, Old563EWSLogo, PortalIcon, RapidrefIcon, type SearchResult, SearchTextField, SquadronIcon, SwarmIcon, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBannerHeader, WavelengthBox, WavelengthButton, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFooter, WavelengthIcon, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthSearch, WavelengthSideBar, WavelengthSnackbar, WavelengthStandardSnackbar, WavelengthTitleBar, add, concat, findBestStringMatch, type menuItemProps, useOutsideClick, useThemeContext };
package/dist/index.d.ts CHANGED
@@ -312,6 +312,7 @@ declare function WavelengthSnackbar(props: ConfirmationSnackbarProps): React__de
312
312
  interface StandardSnackbarProps {
313
313
  type: "success" | "error" | "disabled";
314
314
  show: boolean;
315
+ closeIcon: ReactNode | React__default.JSX.Element;
315
316
  icon?: ReactNode;
316
317
  toggleShow: (on: boolean) => void;
317
318
  horryAlign?: "left" | "right" | "center";
@@ -321,12 +322,19 @@ interface StandardSnackbarProps {
321
322
  message?: string | ReactNode;
322
323
  customVertyAlign?: string;
323
324
  }
324
- declare function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width, message, customVertyAlign, toggleShow }: StandardSnackbarProps): React__default.JSX.Element;
325
+ declare function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width, message, customVertyAlign, toggleShow, closeIcon }: StandardSnackbarProps): React__default.JSX.Element;
325
326
 
326
- interface TestProps {
327
- openProp: boolean;
328
- toggleOpen: React__default.Dispatch<React__default.SetStateAction<boolean>>;
327
+ interface Testprops {
328
+ isPopUpOpen: boolean;
329
+ type: "success" | "error" | "disabled";
330
+ icon?: ReactNode;
331
+ width?: string | number;
332
+ message?: string | ReactNode;
333
+ img: React__default.JSX.Element | ReactNode;
334
+ toggleOpen: (value: React__default.SetStateAction<boolean>) => void;
335
+ customVertyAlign?: string;
329
336
  }
330
- declare function TestSnackbar({ openProp, toggleOpen }: TestProps): React__default.JSX.Element;
337
+ declare const useOutsideClick: (callback: () => void) => React__default.RefObject<HTMLDivElement>;
338
+ declare function TestSnackbar({ isPopUpOpen, toggleOpen, type, message, customVertyAlign, width, img }: Testprops): React__default.JSX.Element;
331
339
 
332
- export { AceOfSpadesComponent, AppLogo, ArrowIcon, BomberBeeIcon, ButtonIcon, ButtonMenu, DefaultIcon, ManyPlanesComponent, NotAvailablePage, Old563EWSLogo, PortalIcon, RapidrefIcon, type SearchResult, SearchTextField, SquadronIcon, SwarmIcon, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBannerHeader, WavelengthBox, WavelengthButton, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFooter, WavelengthIcon, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthSearch, WavelengthSideBar, WavelengthSnackbar, WavelengthStandardSnackbar, WavelengthTitleBar, add, concat, findBestStringMatch, type menuItemProps, useThemeContext };
340
+ export { AceOfSpadesComponent, AppLogo, ArrowIcon, BomberBeeIcon, ButtonIcon, ButtonMenu, DefaultIcon, ManyPlanesComponent, NotAvailablePage, Old563EWSLogo, PortalIcon, RapidrefIcon, type SearchResult, SearchTextField, SquadronIcon, SwarmIcon, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBannerHeader, WavelengthBox, WavelengthButton, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFooter, WavelengthIcon, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthSearch, WavelengthSideBar, WavelengthSnackbar, WavelengthStandardSnackbar, WavelengthTitleBar, add, concat, findBestStringMatch, type menuItemProps, useOutsideClick, useThemeContext };
package/dist/index.js CHANGED
@@ -1341,6 +1341,7 @@ __export(src_exports, {
1341
1341
  add: () => add,
1342
1342
  concat: () => concat,
1343
1343
  findBestStringMatch: () => findBestStringMatch,
1344
+ useOutsideClick: () => useOutsideClick,
1344
1345
  useThemeContext: () => useThemeContext
1345
1346
  });
1346
1347
  module.exports = __toCommonJS(src_exports);
@@ -5034,10 +5035,8 @@ function WavelengthSnackbar(props) {
5034
5035
  // src/components/snackbars/WavelengthStandardSnackbar.tsx
5035
5036
  var import_react35 = __toESM(require("react"));
5036
5037
  var import_Snackbar = __toESM(require("@mui/material/Snackbar"));
5037
- var import_IconButton2 = __toESM(require("@mui/material/IconButton"));
5038
- var import_Close3 = __toESM(require("@mui/icons-material/Close"));
5039
5038
  var import_SnackbarContent = __toESM(require("@mui/material/SnackbarContent"));
5040
- function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width: width2, message, customVertyAlign, toggleShow }) {
5039
+ function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign, durationSb, width: width2, message, customVertyAlign, toggleShow, closeIcon }) {
5041
5040
  const handleClose = () => {
5042
5041
  toggleShow(false);
5043
5042
  };
@@ -5082,7 +5081,7 @@ function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign,
5082
5081
  }
5083
5082
  },
5084
5083
  /* @__PURE__ */ import_react35.default.createElement("div", { style: { marginTop: 4, gridColumnStart: 2, gridColumnEnd: 5, textAlign: "center", display: "flex", flexDirection: "row", justifyContent: "center" }, id: "snackbar" }, /* @__PURE__ */ import_react35.default.createElement("div", null, sIcon), /* @__PURE__ */ import_react35.default.createElement("div", { style: { fontSize: "1rem", marginLeft: "10px" } }, message ? message : "Insert Message Here")),
5085
- /* @__PURE__ */ import_react35.default.createElement("div", { style: { gridColumnStart: 6 } }, " ", /* @__PURE__ */ import_react35.default.createElement(import_IconButton2.default, { size: "small", "aria-label": "close", color: "inherit" }, /* @__PURE__ */ import_react35.default.createElement(import_Close3.default, { fontSize: "small" })))
5084
+ /* @__PURE__ */ import_react35.default.createElement("div", { style: { gridColumnStart: 6 }, onClick: handleClose }, closeIcon)
5086
5085
  )
5087
5086
  }
5088
5087
  )
@@ -5090,19 +5089,69 @@ function WavelengthStandardSnackbar({ type, show, icon, horryAlign, vertyAlign,
5090
5089
  }
5091
5090
 
5092
5091
  // src/components/snackbars/TestSnackbar.tsx
5093
- var import_material15 = require("@mui/material");
5094
5092
  var import_react36 = __toESM(require("react"));
5095
- var import_Close4 = __toESM(require("@mui/icons-material/Close"));
5096
- function TestSnackbar({ openProp, toggleOpen }) {
5097
- const [open, setOpen] = import_react36.default.useState(openProp);
5098
- const handleClose = (event, reason) => {
5099
- if (reason === "clickaway") {
5100
- return;
5101
- }
5093
+ var import_material15 = require("@mui/material");
5094
+ var useOutsideClick = (callback) => {
5095
+ const ref = (0, import_react36.useRef)(null);
5096
+ (0, import_react36.useEffect)(() => {
5097
+ const handleClickOutside = (event) => {
5098
+ if (ref.current && !ref.current.contains(event.target)) {
5099
+ callback();
5100
+ }
5101
+ };
5102
+ document.addEventListener("mouseup", handleClickOutside);
5103
+ document.addEventListener("touchend", handleClickOutside);
5104
+ return () => {
5105
+ document.removeEventListener("mouseup", handleClickOutside);
5106
+ document.removeEventListener("touchend", handleClickOutside);
5107
+ };
5108
+ }, [callback]);
5109
+ return ref;
5110
+ };
5111
+ function TestSnackbar({ isPopUpOpen, toggleOpen, type, message, customVertyAlign, width: width2, img }) {
5112
+ const ref = useOutsideClick(() => {
5102
5113
  toggleOpen(false);
5103
- };
5104
- const action = /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(import_material15.Button, { color: "secondary", size: "small", onClick: handleClose }, "UNDO"), /* @__PURE__ */ import_react36.default.createElement(import_material15.IconButton, { size: "small", "aria-label": "close", color: "inherit", onClick: handleClose }, /* @__PURE__ */ import_react36.default.createElement(import_Close4.default, { fontSize: "small" })));
5105
- return /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, /* @__PURE__ */ import_react36.default.createElement(import_material15.Snackbar, { open: openProp, autoHideDuration: 6e3, onClose: handleClose, message: "Note archived", action }));
5114
+ });
5115
+ let bgColor = "";
5116
+ if (type == "success") {
5117
+ bgColor = "#25ab21";
5118
+ } else if (type == "error") {
5119
+ bgColor = "#FF4646";
5120
+ } else if (type == "disabled") {
5121
+ bgColor = "#737373";
5122
+ }
5123
+ return /* @__PURE__ */ import_react36.default.createElement(import_react36.default.Fragment, null, isPopUpOpen && /* @__PURE__ */ import_react36.default.createElement(
5124
+ import_material15.Box,
5125
+ {
5126
+ sx: { position: "fixed", right: "auto", top: "24px", left: "50%", transform: "translateX(-50%)" },
5127
+ ref,
5128
+ style: {
5129
+ height: "50px",
5130
+ width: width2,
5131
+ backgroundColor: bgColor,
5132
+ borderRadius: "1px",
5133
+ display: "flex",
5134
+ justifyContent: "space-between",
5135
+ alignItems: "center",
5136
+ paddingRight: "20px",
5137
+ paddingLeft: "20px",
5138
+ zIndex: 2800,
5139
+ marginTop: customVertyAlign ? `${customVertyAlign}` : ""
5140
+ }
5141
+ },
5142
+ /* @__PURE__ */ import_react36.default.createElement("div", { style: { backgroundColor: "red" } }),
5143
+ /* @__PURE__ */ import_react36.default.createElement("div", { style: { color: "white", fontSize: "1rem" } }, message),
5144
+ /* @__PURE__ */ import_react36.default.createElement(
5145
+ import_material15.Button,
5146
+ {
5147
+ variant: "text",
5148
+ onClick: () => {
5149
+ toggleOpen(false);
5150
+ }
5151
+ },
5152
+ img
5153
+ )
5154
+ ));
5106
5155
  }
5107
5156
  // Annotate the CommonJS export names for ESM import in node:
5108
5157
  0 && (module.exports = {
@@ -5144,6 +5193,7 @@ function TestSnackbar({ openProp, toggleOpen }) {
5144
5193
  add,
5145
5194
  concat,
5146
5195
  findBestStringMatch,
5196
+ useOutsideClick,
5147
5197
  useThemeContext
5148
5198
  });
5149
5199
  /*! Bundled license information: