@enos5/enos-vue-default 1.4.2 → 1.4.4

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.
@@ -1,16 +1,22 @@
1
1
  export interface ToastMessage {
2
2
  id: string;
3
- title: string;
3
+ title?: string;
4
4
  message: string;
5
5
  variant: "success" | "error";
6
6
  duration?: number;
7
7
  }
8
- declare const __VLS_export: import("vue").DefineComponent<{}, {
8
+ type __VLS_Props = {
9
+ maxToasts?: number;
10
+ position?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
11
+ variant?: "success" | "error";
12
+ defaultTitle?: string;
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
9
15
  addToast: (message: string, options?: {
10
16
  variant?: "success" | "error";
11
17
  duration?: number;
12
18
  title?: string;
13
19
  }) => void;
14
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
21
  declare const _default: typeof __VLS_export;
16
22
  export default _default;
package/dist/index.js CHANGED
@@ -659,7 +659,7 @@ const _sfc_main$J = /* @__PURE__ */ Object.assign({
659
659
  return sizeClasses[props.size] ? props.size : "default";
660
660
  });
661
661
  const buttonClasses = computed(() => [
662
- "inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
662
+ "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
663
663
  variantClasses[resolvedVariant.value],
664
664
  sizeClasses[resolvedSize.value],
665
665
  attrs.class
@@ -2967,7 +2967,7 @@ const _sfc_main$l = /* @__PURE__ */ Object.assign({
2967
2967
  return variantClasses[props.variant] ? props.variant : "primary";
2968
2968
  });
2969
2969
  const linkClasses = computed(() => [
2970
- "inline-flex h-9 min-w-[40px] shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium shadow-xs outline-none transition-all aria-invalid:border-red-500 aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
2970
+ "inline-flex h-9 min-w-[40px] shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium shadow-xs outline-none transition-all aria-invalid:border-red-500 aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
2971
2971
  variantClasses[resolvedVariant.value],
2972
2972
  attrs.class
2973
2973
  ]);
@@ -4721,11 +4721,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4721
4721
  }
4722
4722
  });
4723
4723
  const _hoisted_1 = { class: "fixed top-4 right-4 z-50 space-y-2" };
4724
- const _hoisted_2 = { class: "font-semibold" };
4724
+ const _hoisted_2 = {
4725
+ key: 0,
4726
+ class: "font-semibold"
4727
+ };
4725
4728
  const _hoisted_3 = { class: "text-sm opacity-90" };
4726
4729
  const _sfc_main = /* @__PURE__ */ defineComponent({
4727
4730
  __name: "ToastContainer",
4731
+ props: {
4732
+ maxToasts: {},
4733
+ position: {},
4734
+ variant: {},
4735
+ defaultTitle: {}
4736
+ },
4728
4737
  setup(__props, { expose: __expose }) {
4738
+ const props = __props;
4729
4739
  const toasts = ref([]);
4730
4740
  const addToast = (message, options = {}) => {
4731
4741
  const {
@@ -4736,7 +4746,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4736
4746
  const id = Date.now().toString();
4737
4747
  const toast = {
4738
4748
  id,
4739
- title: title || (variant === "error" ? "Error" : "Success"),
4749
+ title: title ?? (props.defaultTitle || void 0),
4740
4750
  message,
4741
4751
  variant,
4742
4752
  duration
@@ -4762,11 +4772,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4762
4772
  (openBlock(true), createElementBlock(Fragment, null, renderList(toasts.value, (toast) => {
4763
4773
  return openBlock(), createBlock(_sfc_main$1, {
4764
4774
  key: toast.id,
4765
- variant: toast.variant,
4775
+ variant: toast.variant || props.variant,
4766
4776
  onClose: ($event) => removeToast(toast.id)
4767
4777
  }, {
4768
4778
  default: withCtx(() => [
4769
- createElementVNode("div", _hoisted_2, toDisplayString(toast.title), 1),
4779
+ toast.title ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(toast.title), 1)) : createCommentVNode("", true),
4770
4780
  createElementVNode("div", _hoisted_3, toDisplayString(toast.message), 1)
4771
4781
  ]),
4772
4782
  _: 2