@casinogate/ui 2.0.6 → 2.0.7

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.
@@ -0,0 +1,37 @@
1
+ import { type ExternalToast } from 'svelte-sonner';
2
+ import type { Component, ComponentProps } from 'svelte';
3
+ import type { ToastRootProps } from './types.js';
4
+ type ToastContent = Pick<ToastRootProps, 'title' | 'description' | 'icon' | 'hasIcon' | 'rounded' | 'onClose'>;
5
+ type ToastSonnerOptions = Pick<ExternalToast, 'id' | 'duration' | 'position' | 'dismissible' | 'important' | 'onDismiss' | 'onAutoClose' | 'class' | 'classes' | 'descriptionClass' | 'style' | 'unstyled' | 'invert' | 'richColors'>;
6
+ export type ToastId = number | string;
7
+ export type ToastVariant = NonNullable<ToastRootProps['variant']>;
8
+ export type ToastInput = ToastContent & ToastSonnerOptions;
9
+ export type ToastShowInput = ToastInput & {
10
+ variant?: ToastVariant;
11
+ };
12
+ export type ToastPromiseInput<T> = Omit<ToastInput, 'title' | 'description'> & {
13
+ loading: Pick<ToastInput, 'title' | 'description'>;
14
+ success: Pick<ToastInput, 'title' | 'description'> | ((data: T) => Pick<ToastInput, 'title' | 'description'>);
15
+ error: Pick<ToastInput, 'title' | 'description'> | ((err: unknown) => Pick<ToastInput, 'title' | 'description'>);
16
+ finally?: () => void | Promise<void>;
17
+ };
18
+ type ToastApi = {
19
+ info: (input: ToastInput) => ToastId;
20
+ success: (input: ToastInput) => ToastId;
21
+ warning: (input: ToastInput) => ToastId;
22
+ error: (input: ToastInput) => ToastId;
23
+ loading: (input: ToastInput) => ToastId;
24
+ message: (input: ToastInput) => ToastId;
25
+ show: (input: ToastShowInput) => ToastId;
26
+ update: (id: ToastId, input: ToastShowInput) => ToastId;
27
+ promise: <T>(p: Promise<T> | (() => Promise<T>), input: ToastPromiseInput<T>) => ToastId;
28
+ dismiss: (id?: ToastId) => ToastId | undefined;
29
+ getActiveToasts: () => Array<{
30
+ id: ToastId;
31
+ }>;
32
+ custom: <C extends Component<any, any, any>>(component: C, data?: ExternalToast<C> & {
33
+ componentProps?: ComponentProps<C>;
34
+ }) => ToastId;
35
+ };
36
+ export declare const toast: ToastApi;
37
+ export {};
@@ -51,5 +51,5 @@ export const toast = {
51
51
  promise,
52
52
  dismiss: (id) => sonnerToast.dismiss(id),
53
53
  getActiveToasts: () => sonnerToast.getActiveToasts(),
54
- custom: sonnerToast.custom,
54
+ custom: (component, data) => sonnerToast.custom(component, data),
55
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casinogate/ui",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "svelte": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",