@defikitdotnet/education-module-ai
Version:
AI Education Module using Agent Framework
45 lines (44 loc) • 1.91 kB
JavaScript
;
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useToast = useToast;
// Adapted from https://ui.shadcn.com/docs/components/toast
var sonner_1 = require("sonner");
function useToast() {
return {
toast: function (_a) {
var _b = _a.variant, variant = _b === void 0 ? "default" : _b, props = __rest(_a, ["variant"]);
// Extract title (or message) and the rest of the options
var title = props.title, options = __rest(props, ["title"]);
// Ensure a title/message is provided for the base toast call
if (title === undefined) {
console.warn("useToast called without a 'title' or message.");
return; // Or handle appropriately, e.g., throw error or use default
}
return (0, sonner_1.toast)(title, options);
},
dismiss: function (toastId) { return sonner_1.toast.dismiss(toastId); },
error: function (message, props) {
return sonner_1.toast.error(message, props);
},
success: function (message, props) {
return sonner_1.toast.success(message, props);
},
warning: function (message, props) {
return sonner_1.toast.warning(message, props);
},
info: function (message, props) {
return sonner_1.toast.info(message, props);
},
};
}