@enos5/enos-vue-default 1.4.0 → 1.4.2

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.
@@ -2,11 +2,15 @@ export interface ToastMessage {
2
2
  id: string;
3
3
  title: string;
4
4
  message: string;
5
- variant: "default" | "destructive";
5
+ variant: "success" | "error";
6
6
  duration?: number;
7
7
  }
8
8
  declare const __VLS_export: import("vue").DefineComponent<{}, {
9
- addToast: (message: string, type?: "success" | "error", duration?: number) => void;
9
+ addToast: (message: string, options?: {
10
+ variant?: "success" | "error";
11
+ duration?: number;
12
+ title?: string;
13
+ }) => void;
10
14
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
15
  declare const _default: typeof __VLS_export;
12
16
  export default _default;
package/dist/index.js CHANGED
@@ -4727,13 +4727,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4727
4727
  __name: "ToastContainer",
4728
4728
  setup(__props, { expose: __expose }) {
4729
4729
  const toasts = ref([]);
4730
- const addToast = (message, type = "success", duration = 5e3) => {
4730
+ const addToast = (message, options = {}) => {
4731
+ const {
4732
+ variant = "success",
4733
+ duration = 5e3,
4734
+ title
4735
+ } = options;
4731
4736
  const id = Date.now().toString();
4732
4737
  const toast = {
4733
4738
  id,
4734
- title: type === "error" ? "Error" : "Success",
4739
+ title: title || (variant === "error" ? "Error" : "Success"),
4735
4740
  message,
4736
- variant: type === "error" ? "destructive" : "default",
4741
+ variant,
4737
4742
  duration
4738
4743
  };
4739
4744
  toasts.value.push(toast);