@bluemarble/bm-components 0.0.94 → 0.0.96
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +54 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4001,9 +4001,61 @@ import { createContext as createContext2, useState as useState3 } from "react";
|
|
|
4001
4001
|
import React26 from "react";
|
|
4002
4002
|
import { Alert, IconButton as IconButton4, Snackbar } from "@mui/material";
|
|
4003
4003
|
import { MdClose as MdClose2 } from "react-icons/md";
|
|
4004
|
+
var Toast = ({ open, onClose, severity, message }) => {
|
|
4005
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(
|
|
4006
|
+
Snackbar,
|
|
4007
|
+
{
|
|
4008
|
+
open,
|
|
4009
|
+
autoHideDuration: 6e3,
|
|
4010
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
4011
|
+
sx: { zIndex: 99999999 }
|
|
4012
|
+
},
|
|
4013
|
+
/* @__PURE__ */ React26.createElement(
|
|
4014
|
+
Alert,
|
|
4015
|
+
{
|
|
4016
|
+
severity,
|
|
4017
|
+
elevation: 2,
|
|
4018
|
+
sx: { mb: 2 },
|
|
4019
|
+
action: /* @__PURE__ */ React26.createElement(
|
|
4020
|
+
IconButton4,
|
|
4021
|
+
{
|
|
4022
|
+
"aria-label": "close",
|
|
4023
|
+
color: "inherit",
|
|
4024
|
+
size: "small",
|
|
4025
|
+
onClick: onClose
|
|
4026
|
+
},
|
|
4027
|
+
/* @__PURE__ */ React26.createElement(MdClose2, { fontSize: "inherit" })
|
|
4028
|
+
)
|
|
4029
|
+
},
|
|
4030
|
+
message
|
|
4031
|
+
)
|
|
4032
|
+
));
|
|
4033
|
+
};
|
|
4004
4034
|
|
|
4005
4035
|
// src/contexts/AlertContext.tsx
|
|
4006
4036
|
var AlertContext = createContext2({});
|
|
4037
|
+
var AlertProvider = ({ children }) => {
|
|
4038
|
+
const [severity, setSeverity] = useState3("info");
|
|
4039
|
+
const [message, setMessage] = useState3("");
|
|
4040
|
+
const [isVisible, setIsVisible] = useState3(false);
|
|
4041
|
+
const createAlert = (newMessage, severity2) => {
|
|
4042
|
+
setMessage(newMessage);
|
|
4043
|
+
setSeverity(severity2);
|
|
4044
|
+
setIsVisible(true);
|
|
4045
|
+
};
|
|
4046
|
+
function onCloseToast() {
|
|
4047
|
+
setIsVisible(false);
|
|
4048
|
+
}
|
|
4049
|
+
return /* @__PURE__ */ React27.createElement(AlertContext.Provider, { value: { createAlert } }, children, /* @__PURE__ */ React27.createElement(
|
|
4050
|
+
Toast,
|
|
4051
|
+
{
|
|
4052
|
+
open: isVisible,
|
|
4053
|
+
onClose: onCloseToast,
|
|
4054
|
+
severity,
|
|
4055
|
+
message
|
|
4056
|
+
}
|
|
4057
|
+
));
|
|
4058
|
+
};
|
|
4007
4059
|
|
|
4008
4060
|
// src/hooks/useAlert.ts
|
|
4009
4061
|
var useAlert = () => {
|
|
@@ -4329,6 +4381,7 @@ function useEvent(event, handler, passive = false) {
|
|
|
4329
4381
|
}
|
|
4330
4382
|
export {
|
|
4331
4383
|
AlertContext,
|
|
4384
|
+
AlertProvider,
|
|
4332
4385
|
ApiHelper,
|
|
4333
4386
|
Autocomplete2 as Autocomplete,
|
|
4334
4387
|
BaseGrid,
|