@enos5/enos-vue-default 1.4.1 → 1.4.3
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,15 +2,20 @@ export interface ToastMessage {
|
|
|
2
2
|
id: string;
|
|
3
3
|
title: string;
|
|
4
4
|
message: string;
|
|
5
|
-
variant: "
|
|
5
|
+
variant: "success" | "error";
|
|
6
6
|
duration?: number;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
maxToasts?: number;
|
|
10
|
+
position?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
11
|
+
variant?: "success" | "error";
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
9
14
|
addToast: (message: string, options?: {
|
|
10
|
-
variant?: "
|
|
15
|
+
variant?: "success" | "error";
|
|
11
16
|
duration?: number;
|
|
12
17
|
title?: string;
|
|
13
18
|
}) => void;
|
|
14
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
19
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
20
|
declare const _default: typeof __VLS_export;
|
|
16
21
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -4725,7 +4725,13 @@ const _hoisted_2 = { class: "font-semibold" };
|
|
|
4725
4725
|
const _hoisted_3 = { class: "text-sm opacity-90" };
|
|
4726
4726
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4727
4727
|
__name: "ToastContainer",
|
|
4728
|
+
props: {
|
|
4729
|
+
maxToasts: {},
|
|
4730
|
+
position: {},
|
|
4731
|
+
variant: {}
|
|
4732
|
+
},
|
|
4728
4733
|
setup(__props, { expose: __expose }) {
|
|
4734
|
+
const props = __props;
|
|
4729
4735
|
const toasts = ref([]);
|
|
4730
4736
|
const addToast = (message, options = {}) => {
|
|
4731
4737
|
const {
|
|
@@ -4736,7 +4742,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4736
4742
|
const id = Date.now().toString();
|
|
4737
4743
|
const toast = {
|
|
4738
4744
|
id,
|
|
4739
|
-
title: title || (variant === "error"
|
|
4745
|
+
title: title || (variant === "error" ? "Error" : "Success"),
|
|
4740
4746
|
message,
|
|
4741
4747
|
variant,
|
|
4742
4748
|
duration
|
|
@@ -4754,6 +4760,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4754
4760
|
toasts.value.splice(index, 1);
|
|
4755
4761
|
}
|
|
4756
4762
|
};
|
|
4763
|
+
onMounted(() => {
|
|
4764
|
+
console.log("ToastContainer mounted");
|
|
4765
|
+
});
|
|
4757
4766
|
__expose({
|
|
4758
4767
|
addToast
|
|
4759
4768
|
});
|
|
@@ -4762,7 +4771,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4762
4771
|
(openBlock(true), createElementBlock(Fragment, null, renderList(toasts.value, (toast) => {
|
|
4763
4772
|
return openBlock(), createBlock(_sfc_main$1, {
|
|
4764
4773
|
key: toast.id,
|
|
4765
|
-
variant: toast.variant,
|
|
4774
|
+
variant: toast.variant || props.variant,
|
|
4766
4775
|
onClose: ($event) => removeToast(toast.id)
|
|
4767
4776
|
}, {
|
|
4768
4777
|
default: withCtx(() => [
|