@evixcard/evx-ui-kit 1.11.1 → 1.11.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.
@@ -1,8 +1,21 @@
1
- import { EvToastVariant } from './types';
1
+ import { EvToastAppearance, EvToastVariant } from './types';
2
2
  export interface EvToastProps {
3
3
  variant?: EvToastVariant;
4
4
  title?: string;
5
5
  description?: string;
6
+ /**
7
+ * Card look. `default` = compact card with a leading status icon (admin style);
8
+ * `plain` = larger, icon-less card with a display-size title (customer style).
9
+ */
10
+ appearance?: EvToastAppearance;
11
+ /**
12
+ * Force the leading status icon on/off. Defaults to on for `default` and off for
13
+ * `plain`. Set `true` on a `plain` toast to keep the white card but add a colored
14
+ * status icon (e.g. a red icon for errors).
15
+ */
16
+ icon?: boolean;
17
+ /** Show a spinner in place of the status icon (even in `plain`). */
18
+ loading?: boolean;
6
19
  class?: string;
7
20
  }
8
21
  declare function __VLS_template(): {
@@ -21,6 +34,8 @@ declare const __VLS_component: import('vue').DefineComponent<EvToastProps, {}, {
21
34
  onDismiss?: (() => any) | undefined;
22
35
  }>, {
23
36
  variant: EvToastVariant;
37
+ icon: boolean;
38
+ appearance: EvToastAppearance;
24
39
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
25
40
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
26
41
  export default _default;
@@ -1,2 +1,12 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
1
+ import { EvToastAppearance, EvToastPlacement } from './types';
2
+ export interface EvToastContainerProps {
3
+ /** Where the stack is anchored. Default `bottom-right` (admin). */
4
+ placement?: EvToastPlacement;
5
+ /** Card look applied to every toast in the stack. Default `default` (admin). */
6
+ appearance?: EvToastAppearance;
7
+ }
8
+ declare const _default: import('vue').DefineComponent<EvToastContainerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<EvToastContainerProps> & Readonly<{}>, {
9
+ appearance: EvToastAppearance;
10
+ placement: EvToastPlacement;
11
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
2
12
  export default _default;
@@ -2,6 +2,7 @@ export { default } from './EvToast.vue';
2
2
  export { default as EvToast } from './EvToast.vue';
3
3
  export type { EvToastProps } from './EvToast.vue';
4
4
  export { default as EvToastContainer } from './EvToastContainer.vue';
5
+ export type { EvToastContainerProps } from './EvToastContainer.vue';
5
6
  export { useToast } from './useToast';
6
7
  export type { UseToastReturn } from './useToast';
7
- export type { EvToastVariant, EvToastOptions, EvToastItem } from './types';
8
+ export type { EvToastVariant, EvToastAppearance, EvToastPlacement, EvToastOptions, EvToastItem, } from './types';
@@ -1,4 +1,11 @@
1
1
  export type EvToastVariant = 'info' | 'success' | 'warning' | 'error';
2
+ /**
3
+ * Card look. `default` = compact card with a leading status icon (admin style);
4
+ * `plain` = larger, icon-less card with a display-size title (customer style).
5
+ */
6
+ export type EvToastAppearance = 'default' | 'plain';
7
+ /** Where the toast stack is anchored on screen. */
8
+ export type EvToastPlacement = 'bottom-right' | 'top-center';
2
9
  export interface EvToastOptions {
3
10
  /** Optional bold title line. */
4
11
  title?: string;
@@ -8,9 +15,48 @@ export interface EvToastOptions {
8
15
  variant?: EvToastVariant;
9
16
  /** Auto-dismiss delay in ms. `0` (or negative) disables auto-dismiss. Default `4000`. */
10
17
  duration?: number;
18
+ /**
19
+ * Force the leading status icon on/off. Defaults to `true` for the `default`
20
+ * appearance and `false` for `plain`. Set `true` on a `plain` toast to keep the
21
+ * white card but add a colored status icon (e.g. a red icon for errors).
22
+ */
23
+ icon?: boolean;
24
+ /**
25
+ * Show a spinner in place of the status icon (even in `plain`) and keep the
26
+ * toast sticky — auto-dismiss is disabled until it is `update()`d or dismissed.
27
+ * Default `false`.
28
+ */
29
+ loading?: boolean;
11
30
  }
12
31
  export interface EvToastItem extends Required<Pick<EvToastOptions, 'variant' | 'duration'>> {
13
32
  id: number;
14
33
  title?: string;
15
34
  description?: string;
35
+ icon?: boolean;
36
+ loading?: boolean;
37
+ }
38
+ /**
39
+ * Content for one state of a promise-toast: a plain title string, a
40
+ * `{ title, description }` object, or a function of the resolved value / error
41
+ * returning either.
42
+ */
43
+ export type EvToastContent<T = unknown> = string | {
44
+ title?: string;
45
+ description?: string;
46
+ } | ((arg: T) => string | {
47
+ title?: string;
48
+ description?: string;
49
+ });
50
+ export interface EvToastPromiseOptions<T = unknown> {
51
+ /** Shown immediately with a spinner while the promise is pending. */
52
+ loading: string | {
53
+ title?: string;
54
+ description?: string;
55
+ };
56
+ /** Shown when the promise resolves. Receives the resolved value. */
57
+ success: EvToastContent<T>;
58
+ /** Shown when the promise rejects. Receives the thrown error. */
59
+ error: EvToastContent<unknown>;
60
+ /** Auto-dismiss delay (ms) for the resolved success/error toast. Default `4000`. */
61
+ duration?: number;
16
62
  }
@@ -1,10 +1,12 @@
1
1
  import { DeepReadonly, Ref } from 'vue';
2
- import { EvToastItem, EvToastOptions } from './types';
2
+ import { EvToastItem, EvToastOptions, EvToastPromiseOptions } from './types';
3
3
  export interface UseToastReturn {
4
4
  /** Reactive, read-only list of currently visible toasts. */
5
5
  items: DeepReadonly<Ref<EvToastItem[]>>;
6
6
  /** Push a toast; returns its id. */
7
7
  push: (toast?: EvToastOptions) => number;
8
+ /** Merge a patch into an existing toast (re-arms auto-dismiss if `duration` is set). */
9
+ update: (id: number, patch?: Partial<EvToastOptions>) => void;
8
10
  /** Dismiss a toast by id. */
9
11
  dismiss: (id: number) => void;
10
12
  /** Dismiss every toast. */
@@ -13,5 +15,9 @@ export interface UseToastReturn {
13
15
  showSuccess: (titleOrOptions?: string | EvToastOptions, description?: string, options?: EvToastOptions) => number;
14
16
  showWarning: (titleOrOptions?: string | EvToastOptions, description?: string, options?: EvToastOptions) => number;
15
17
  showError: (titleOrOptions?: string | EvToastOptions, description?: string, options?: EvToastOptions) => number;
18
+ /** Push a sticky loading toast (spinner, no auto-dismiss); returns its id. */
19
+ showLoading: (titleOrOptions?: string | EvToastOptions, description?: string, options?: EvToastOptions) => number;
20
+ /** Bind a promise to a loading toast that resolves in place to success/error. */
21
+ promise: <T>(promise: Promise<T>, options: EvToastPromiseOptions<T>) => Promise<T>;
16
22
  }
17
23
  export declare function useToast(): UseToastReturn;