99 lines
4.0 KiB
JavaScript
99 lines
4.0 KiB
JavaScript
'use client'
|
|
"use strict";
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// src/alert-context.ts
|
|
var alert_context_exports = {};
|
|
__export(alert_context_exports, {
|
|
AlertProvider: () => AlertProvider,
|
|
AlertStylesProvider: () => AlertStylesProvider,
|
|
getStatusColorScheme: () => getStatusColorScheme,
|
|
getStatusIcon: () => getStatusIcon,
|
|
useAlertContext: () => useAlertContext,
|
|
useAlertStyles: () => useAlertStyles
|
|
});
|
|
module.exports = __toCommonJS(alert_context_exports);
|
|
var import_react_context = require("@chakra-ui/react-context");
|
|
|
|
// src/icons.tsx
|
|
var import_icon = require("@chakra-ui/icon");
|
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
function CheckIcon(props) {
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.Icon, { viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
"path",
|
|
{
|
|
fill: "currentColor",
|
|
d: "M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"
|
|
}
|
|
) });
|
|
}
|
|
function InfoIcon(props) {
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.Icon, { viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
"path",
|
|
{
|
|
fill: "currentColor",
|
|
d: "M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"
|
|
}
|
|
) });
|
|
}
|
|
function WarningIcon(props) {
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.Icon, { viewBox: "0 0 24 24", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
"path",
|
|
{
|
|
fill: "currentColor",
|
|
d: "M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"
|
|
}
|
|
) });
|
|
}
|
|
|
|
// src/alert-context.ts
|
|
var import_spinner = require("@chakra-ui/spinner");
|
|
var [AlertProvider, useAlertContext] = (0, import_react_context.createContext)({
|
|
name: "AlertContext",
|
|
hookName: "useAlertContext",
|
|
providerName: "<Alert />"
|
|
});
|
|
var [AlertStylesProvider, useAlertStyles] = (0, import_react_context.createContext)({
|
|
name: `AlertStylesContext`,
|
|
hookName: `useAlertStyles`,
|
|
providerName: "<Alert />"
|
|
});
|
|
var STATUSES = {
|
|
info: { icon: InfoIcon, colorScheme: "blue" },
|
|
warning: { icon: WarningIcon, colorScheme: "orange" },
|
|
success: { icon: CheckIcon, colorScheme: "green" },
|
|
error: { icon: WarningIcon, colorScheme: "red" },
|
|
loading: { icon: import_spinner.Spinner, colorScheme: "blue" }
|
|
};
|
|
function getStatusColorScheme(status) {
|
|
return STATUSES[status].colorScheme;
|
|
}
|
|
function getStatusIcon(status) {
|
|
return STATUSES[status].icon;
|
|
}
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
AlertProvider,
|
|
AlertStylesProvider,
|
|
getStatusColorScheme,
|
|
getStatusIcon,
|
|
useAlertContext,
|
|
useAlertStyles
|
|
});
|
|
//# sourceMappingURL=alert-context.js.map
|