@casinogate/ui 2.0.5 → 2.0.6
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.
- package/dist/assets/css/root.css +26 -0
- package/dist/components/toast/index.d.ts +2 -1
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toast/styles.d.ts +6 -0
- package/dist/components/toast/styles.js +3 -1
- package/dist/composed/toast/index.d.ts +4 -0
- package/dist/composed/toast/index.js +2 -0
- package/dist/composed/toast/toast.js +55 -0
- package/dist/composed/toast/toaster/index.d.ts +2 -0
- package/dist/composed/toast/toaster/index.js +1 -0
- package/dist/composed/toast/toaster/toaster.svelte +23 -0
- package/dist/composed/toast/toaster/toaster.svelte.d.ts +4 -0
- package/dist/primitives/toast/components/toast.icon.svelte +1 -0
- package/dist/primitives/toast/styles.d.ts +6 -0
- package/dist/primitives/toast/styles.js +3 -1
- package/package.json +2 -1
package/dist/assets/css/root.css
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
--cgui-spacing: 0.25rem;
|
|
11
11
|
--cgui-container-sm: 24rem;
|
|
12
12
|
--cgui-container-xl: 36rem;
|
|
13
|
+
--cgui-container-2xl: 42rem;
|
|
13
14
|
--cgui-text-xs: 0.75rem;
|
|
14
15
|
--cgui-text-xs--line-height: calc(1 / 0.75);
|
|
15
16
|
--cgui-text-sm: 0.875rem;
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
--cgui-font-weight-normal: 400;
|
|
22
23
|
--cgui-font-weight-medium: 500;
|
|
23
24
|
--cgui-font-weight-semibold: 600;
|
|
25
|
+
--cgui-tracking-wide: 0.025em;
|
|
24
26
|
--cgui-leading-relaxed: 1.625;
|
|
25
27
|
--cgui-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
26
28
|
--cgui-animate-spin: spin 1s linear infinite;
|
|
@@ -646,6 +648,9 @@
|
|
|
646
648
|
.cgui\:w-screen {
|
|
647
649
|
width: 100vw;
|
|
648
650
|
}
|
|
651
|
+
.cgui\:max-w-2xl {
|
|
652
|
+
max-width: var(--cgui-container-2xl);
|
|
653
|
+
}
|
|
649
654
|
.cgui\:max-w-32 {
|
|
650
655
|
max-width: calc(var(--cgui-spacing) * 32);
|
|
651
656
|
}
|
|
@@ -724,6 +729,9 @@
|
|
|
724
729
|
.cgui\:min-w-42 {
|
|
725
730
|
min-width: calc(var(--cgui-spacing) * 42);
|
|
726
731
|
}
|
|
732
|
+
.cgui\:min-w-60 {
|
|
733
|
+
min-width: calc(var(--cgui-spacing) * 60);
|
|
734
|
+
}
|
|
727
735
|
.cgui\:min-w-64 {
|
|
728
736
|
min-width: calc(var(--cgui-spacing) * 64);
|
|
729
737
|
}
|
|
@@ -1413,6 +1421,10 @@
|
|
|
1413
1421
|
--tw-font-weight: var(--cgui-font-weight-semibold);
|
|
1414
1422
|
font-weight: var(--cgui-font-weight-semibold);
|
|
1415
1423
|
}
|
|
1424
|
+
.cgui\:tracking-wide {
|
|
1425
|
+
--tw-tracking: var(--cgui-tracking-wide);
|
|
1426
|
+
letter-spacing: var(--cgui-tracking-wide);
|
|
1427
|
+
}
|
|
1416
1428
|
.cgui\:whitespace-nowrap {
|
|
1417
1429
|
white-space: nowrap;
|
|
1418
1430
|
}
|
|
@@ -1473,6 +1485,9 @@
|
|
|
1473
1485
|
.cgui\:text-state-warning {
|
|
1474
1486
|
color: var(--cg-ui-color-state-warning);
|
|
1475
1487
|
}
|
|
1488
|
+
.cgui\:uppercase {
|
|
1489
|
+
text-transform: uppercase;
|
|
1490
|
+
}
|
|
1476
1491
|
.cgui\:underline {
|
|
1477
1492
|
text-decoration-line: underline;
|
|
1478
1493
|
}
|
|
@@ -1747,6 +1762,12 @@
|
|
|
1747
1762
|
border-radius: calc(infinity * 1px);
|
|
1748
1763
|
}
|
|
1749
1764
|
}
|
|
1765
|
+
.cgui\:before\:bg-fg-regular {
|
|
1766
|
+
&::before {
|
|
1767
|
+
content: var(--tw-content);
|
|
1768
|
+
background-color: var(--cg-ui-color-fg-regular);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1750
1771
|
.cgui\:before\:bg-state-error {
|
|
1751
1772
|
&::before {
|
|
1752
1773
|
content: var(--tw-content);
|
|
@@ -3682,6 +3703,10 @@
|
|
|
3682
3703
|
syntax: "*";
|
|
3683
3704
|
inherits: false;
|
|
3684
3705
|
}
|
|
3706
|
+
@property --tw-tracking {
|
|
3707
|
+
syntax: "*";
|
|
3708
|
+
inherits: false;
|
|
3709
|
+
}
|
|
3685
3710
|
@property --tw-shadow {
|
|
3686
3711
|
syntax: "*";
|
|
3687
3712
|
inherits: false;
|
|
@@ -3809,6 +3834,7 @@
|
|
|
3809
3834
|
--tw-gradient-to-position: 100%;
|
|
3810
3835
|
--tw-leading: initial;
|
|
3811
3836
|
--tw-font-weight: initial;
|
|
3837
|
+
--tw-tracking: initial;
|
|
3812
3838
|
--tw-shadow: 0 0 #0000;
|
|
3813
3839
|
--tw-shadow-color: initial;
|
|
3814
3840
|
--tw-shadow-alpha: 100%;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * as ToastPrimitive from './components/index.js';
|
|
2
|
-
export { Toast } from '../../composed/toast/index.js';
|
|
2
|
+
export { Toast, toast, Toaster } from '../../composed/toast/index.js';
|
|
3
|
+
export type { ToastId, ToastVariant, ToastInput, ToastShowInput, ToastPromiseInput, ToasterProps, } from '../../composed/toast/index.js';
|
|
3
4
|
export * from './types.js';
|
|
@@ -5,6 +5,7 @@ export declare const toastPrimitiveRootStyles: import("tailwind-variants").TVRet
|
|
|
5
5
|
warning: string;
|
|
6
6
|
success: string;
|
|
7
7
|
info: string;
|
|
8
|
+
loading: string;
|
|
8
9
|
};
|
|
9
10
|
rounded: {
|
|
10
11
|
xs: string;
|
|
@@ -19,6 +20,7 @@ export declare const toastPrimitiveRootStyles: import("tailwind-variants").TVRet
|
|
|
19
20
|
warning: string;
|
|
20
21
|
success: string;
|
|
21
22
|
info: string;
|
|
23
|
+
loading: string;
|
|
22
24
|
};
|
|
23
25
|
rounded: {
|
|
24
26
|
xs: string;
|
|
@@ -33,6 +35,7 @@ export declare const toastPrimitiveRootStyles: import("tailwind-variants").TVRet
|
|
|
33
35
|
warning: string;
|
|
34
36
|
success: string;
|
|
35
37
|
info: string;
|
|
38
|
+
loading: string;
|
|
36
39
|
};
|
|
37
40
|
rounded: {
|
|
38
41
|
xs: string;
|
|
@@ -61,6 +64,7 @@ export declare const toastPrimitiveInnerIconStyles: import("tailwind-variants").
|
|
|
61
64
|
warning: string;
|
|
62
65
|
success: string;
|
|
63
66
|
info: string;
|
|
67
|
+
loading: string;
|
|
64
68
|
};
|
|
65
69
|
}, undefined, never[], {
|
|
66
70
|
variant: {
|
|
@@ -68,6 +72,7 @@ export declare const toastPrimitiveInnerIconStyles: import("tailwind-variants").
|
|
|
68
72
|
warning: string;
|
|
69
73
|
success: string;
|
|
70
74
|
info: string;
|
|
75
|
+
loading: string;
|
|
71
76
|
};
|
|
72
77
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
73
78
|
variant: {
|
|
@@ -75,6 +80,7 @@ export declare const toastPrimitiveInnerIconStyles: import("tailwind-variants").
|
|
|
75
80
|
warning: string;
|
|
76
81
|
success: string;
|
|
77
82
|
info: string;
|
|
83
|
+
loading: string;
|
|
78
84
|
};
|
|
79
85
|
}, undefined, never[], unknown, unknown, undefined>>;
|
|
80
86
|
export declare const toastPrimitiveBodyStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
2
|
-
const ToastVariants = ['error', 'warning', 'success', 'info'];
|
|
2
|
+
const ToastVariants = ['error', 'warning', 'success', 'info', 'loading'];
|
|
3
3
|
const ToastRoundings = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
4
4
|
export const toastPrimitiveRootStyles = tv({
|
|
5
5
|
base: [
|
|
@@ -15,6 +15,7 @@ export const toastPrimitiveRootStyles = tv({
|
|
|
15
15
|
warning: 'cgui:before:bg-state-warning',
|
|
16
16
|
success: 'cgui:before:bg-state-success',
|
|
17
17
|
info: 'cgui:before:bg-state-info',
|
|
18
|
+
loading: 'cgui:before:bg-fg-regular',
|
|
18
19
|
},
|
|
19
20
|
rounded: {
|
|
20
21
|
xs: 'cgui:rounded-xs',
|
|
@@ -43,6 +44,7 @@ export const toastPrimitiveInnerIconStyles = tv({
|
|
|
43
44
|
warning: 'cgui:text-state-warning',
|
|
44
45
|
success: 'cgui:text-state-success',
|
|
45
46
|
info: 'cgui:text-state-info',
|
|
47
|
+
loading: 'cgui:text-fg-regular cgui:animate-spin',
|
|
46
48
|
},
|
|
47
49
|
},
|
|
48
50
|
});
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export * as Toast from './root/index.js';
|
|
2
|
+
export { toast } from './toast.js';
|
|
3
|
+
export type { ToastId, ToastVariant, ToastInput, ToastShowInput, ToastPromiseInput } from './toast.js';
|
|
4
|
+
export { Toaster } from './toaster/index.js';
|
|
5
|
+
export type { ToasterProps } from './toaster/index.js';
|
|
2
6
|
export type * from './types.js';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { toast as sonnerToast } from 'svelte-sonner';
|
|
2
|
+
import ToastRoot from './root/toast.root.svelte';
|
|
3
|
+
function emit(variant, input) {
|
|
4
|
+
const { title, description, icon, hasIcon, rounded, onClose, ...sonnerOpts } = input;
|
|
5
|
+
let id = sonnerOpts.id ?? '';
|
|
6
|
+
id = sonnerToast.custom(ToastRoot, {
|
|
7
|
+
unstyled: true,
|
|
8
|
+
...sonnerOpts,
|
|
9
|
+
componentProps: {
|
|
10
|
+
variant,
|
|
11
|
+
title,
|
|
12
|
+
description,
|
|
13
|
+
icon,
|
|
14
|
+
hasIcon,
|
|
15
|
+
rounded,
|
|
16
|
+
onClose: () => {
|
|
17
|
+
sonnerToast.dismiss(id);
|
|
18
|
+
onClose?.();
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return id;
|
|
23
|
+
}
|
|
24
|
+
function promise(p, input) {
|
|
25
|
+
const { loading, success, error, finally: onFinally, ...rest } = input;
|
|
26
|
+
const id = emit('loading', { ...rest, ...loading });
|
|
27
|
+
const settle = typeof p === 'function' ? p() : p;
|
|
28
|
+
settle
|
|
29
|
+
.then((data) => {
|
|
30
|
+
const next = typeof success === 'function' ? success(data) : success;
|
|
31
|
+
emit('success', { ...rest, ...next, id });
|
|
32
|
+
})
|
|
33
|
+
.catch((err) => {
|
|
34
|
+
const next = typeof error === 'function' ? error(err) : error;
|
|
35
|
+
emit('error', { ...rest, ...next, id });
|
|
36
|
+
})
|
|
37
|
+
.finally(() => {
|
|
38
|
+
onFinally?.();
|
|
39
|
+
});
|
|
40
|
+
return id;
|
|
41
|
+
}
|
|
42
|
+
export const toast = {
|
|
43
|
+
info: (input) => emit('info', input),
|
|
44
|
+
success: (input) => emit('success', input),
|
|
45
|
+
warning: (input) => emit('warning', input),
|
|
46
|
+
error: (input) => emit('error', input),
|
|
47
|
+
loading: (input) => emit('loading', input),
|
|
48
|
+
message: (input) => emit('info', input),
|
|
49
|
+
show: ({ variant = 'info', ...rest }) => emit(variant, rest),
|
|
50
|
+
update: (id, input) => emit(input.variant ?? 'info', { ...input, id }),
|
|
51
|
+
promise,
|
|
52
|
+
dismiss: (id) => sonnerToast.dismiss(id),
|
|
53
|
+
getActiveToasts: () => sonnerToast.getActiveToasts(),
|
|
54
|
+
custom: sonnerToast.custom,
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Toaster } from './toaster.svelte';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Toaster as SonnerToaster, type ToasterProps } from 'svelte-sonner';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
position = 'bottom-right',
|
|
6
|
+
expand = true,
|
|
7
|
+
visibleToasts = 3,
|
|
8
|
+
duration = 4000,
|
|
9
|
+
closeButton = false,
|
|
10
|
+
toastOptions,
|
|
11
|
+
...restProps
|
|
12
|
+
}: ToasterProps = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<SonnerToaster
|
|
16
|
+
{position}
|
|
17
|
+
{expand}
|
|
18
|
+
{visibleToasts}
|
|
19
|
+
{duration}
|
|
20
|
+
{closeButton}
|
|
21
|
+
toastOptions={{ unstyled: true, ...toastOptions }}
|
|
22
|
+
{...restProps}
|
|
23
|
+
/>
|
|
@@ -5,6 +5,7 @@ export declare const toastPrimitiveRootStyles: import("tailwind-variants").TVRet
|
|
|
5
5
|
warning: string;
|
|
6
6
|
success: string;
|
|
7
7
|
info: string;
|
|
8
|
+
loading: string;
|
|
8
9
|
};
|
|
9
10
|
rounded: {
|
|
10
11
|
xs: string;
|
|
@@ -19,6 +20,7 @@ export declare const toastPrimitiveRootStyles: import("tailwind-variants").TVRet
|
|
|
19
20
|
warning: string;
|
|
20
21
|
success: string;
|
|
21
22
|
info: string;
|
|
23
|
+
loading: string;
|
|
22
24
|
};
|
|
23
25
|
rounded: {
|
|
24
26
|
xs: string;
|
|
@@ -33,6 +35,7 @@ export declare const toastPrimitiveRootStyles: import("tailwind-variants").TVRet
|
|
|
33
35
|
warning: string;
|
|
34
36
|
success: string;
|
|
35
37
|
info: string;
|
|
38
|
+
loading: string;
|
|
36
39
|
};
|
|
37
40
|
rounded: {
|
|
38
41
|
xs: string;
|
|
@@ -61,6 +64,7 @@ export declare const toastPrimitiveInnerIconStyles: import("tailwind-variants").
|
|
|
61
64
|
warning: string;
|
|
62
65
|
success: string;
|
|
63
66
|
info: string;
|
|
67
|
+
loading: string;
|
|
64
68
|
};
|
|
65
69
|
}, undefined, never[], {
|
|
66
70
|
variant: {
|
|
@@ -68,6 +72,7 @@ export declare const toastPrimitiveInnerIconStyles: import("tailwind-variants").
|
|
|
68
72
|
warning: string;
|
|
69
73
|
success: string;
|
|
70
74
|
info: string;
|
|
75
|
+
loading: string;
|
|
71
76
|
};
|
|
72
77
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
73
78
|
variant: {
|
|
@@ -75,6 +80,7 @@ export declare const toastPrimitiveInnerIconStyles: import("tailwind-variants").
|
|
|
75
80
|
warning: string;
|
|
76
81
|
success: string;
|
|
77
82
|
info: string;
|
|
83
|
+
loading: string;
|
|
78
84
|
};
|
|
79
85
|
}, undefined, never[], unknown, unknown, undefined>>;
|
|
80
86
|
export declare const toastPrimitiveBodyStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
2
2
|
export const toastPrimitiveRootStyles = tv({
|
|
3
3
|
base: [
|
|
4
|
-
'cgui:overflow-hidden cgui:relative cgui:min-w-
|
|
4
|
+
'cgui:overflow-hidden cgui:relative cgui:min-w-60 cgui:max-w-80',
|
|
5
5
|
'cgui:flex cgui:items-center cgui:gap-2 cgui:p-3',
|
|
6
6
|
'cgui:shadow-toast cgui:bg-surface-white',
|
|
7
7
|
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
@@ -13,6 +13,7 @@ export const toastPrimitiveRootStyles = tv({
|
|
|
13
13
|
warning: 'cgui:before:bg-state-warning',
|
|
14
14
|
success: 'cgui:before:bg-state-success',
|
|
15
15
|
info: 'cgui:before:bg-state-info',
|
|
16
|
+
loading: 'cgui:before:bg-fg-regular',
|
|
16
17
|
},
|
|
17
18
|
rounded: {
|
|
18
19
|
xs: 'cgui:rounded-xs',
|
|
@@ -41,6 +42,7 @@ export const toastPrimitiveInnerIconStyles = tv({
|
|
|
41
42
|
warning: 'cgui:text-state-warning',
|
|
42
43
|
success: 'cgui:text-state-success',
|
|
43
44
|
info: 'cgui:text-state-info',
|
|
45
|
+
loading: 'cgui:text-fg-regular cgui:animate-spin',
|
|
44
46
|
},
|
|
45
47
|
},
|
|
46
48
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casinogate/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"svelte": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -517,6 +517,7 @@
|
|
|
517
517
|
"@zag-js/collection": "^1.30.0",
|
|
518
518
|
"bits-ui": "2.16.3",
|
|
519
519
|
"runed": "^0.35.1",
|
|
520
|
+
"svelte-sonner": "^1.1.1",
|
|
520
521
|
"svelte-toolbelt": "^0.10.6",
|
|
521
522
|
"tailwind-merge": "^3.3.1",
|
|
522
523
|
"tailwind-variants": "^3.2.2",
|