@casinogate/ui 1.11.4 → 1.11.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.
Files changed (34) hide show
  1. package/dist/components/data-table/data-table.svelte +2 -3
  2. package/dist/components/data-table/styles.js +1 -0
  3. package/dist/components/toast/components/index.d.ts +6 -0
  4. package/dist/components/toast/components/index.js +6 -0
  5. package/dist/components/toast/components/toast.body.svelte +16 -0
  6. package/dist/components/toast/components/toast.body.svelte.d.ts +4 -0
  7. package/dist/components/toast/components/toast.close.svelte +22 -0
  8. package/dist/components/toast/components/toast.close.svelte.d.ts +4 -0
  9. package/dist/components/toast/components/toast.description.svelte +16 -0
  10. package/dist/components/toast/components/toast.description.svelte.d.ts +4 -0
  11. package/dist/components/toast/components/toast.icon.svelte +37 -0
  12. package/dist/components/toast/components/toast.icon.svelte.d.ts +4 -0
  13. package/dist/components/toast/components/toast.root.svelte +26 -0
  14. package/dist/components/toast/components/toast.root.svelte.d.ts +4 -0
  15. package/dist/components/toast/components/toast.svelte.d.ts +14 -0
  16. package/dist/components/toast/components/toast.svelte.js +12 -0
  17. package/dist/components/toast/components/toast.title.svelte +16 -0
  18. package/dist/components/toast/components/toast.title.svelte.d.ts +4 -0
  19. package/dist/components/toast/composed/index.d.ts +1 -0
  20. package/dist/components/toast/composed/index.js +1 -0
  21. package/dist/components/toast/composed/root/index.d.ts +1 -0
  22. package/dist/components/toast/composed/root/index.js +1 -0
  23. package/dist/components/toast/composed/root/toast.root.svelte +47 -0
  24. package/dist/components/toast/composed/root/toast.root.svelte.d.ts +4 -0
  25. package/dist/components/toast/index.d.ts +3 -2
  26. package/dist/components/toast/index.js +3 -1
  27. package/dist/components/toast/styles.d.ts +74 -136
  28. package/dist/components/toast/styles.js +55 -52
  29. package/dist/components/toast/types.d.ts +27 -8
  30. package/package.json +1 -1
  31. package/dist/components/toast/exports.d.ts +0 -1
  32. package/dist/components/toast/exports.js +0 -1
  33. package/dist/components/toast/toast.component.svelte +0 -58
  34. package/dist/components/toast/toast.component.svelte.d.ts +0 -4
@@ -38,7 +38,7 @@
38
38
  </script>
39
39
 
40
40
  <DataTableRoot bind:ref {table} class={cn(className, { 'cgui:h-full': isEmpty })} {...restProps}>
41
- <DataTableTable class={cn({ 'cgui:h-full': isEmpty })}>
41
+ <DataTableTable class={cn({ 'cgui:h-full cgui:flex-1': isEmpty })}>
42
42
  <DataTableHeader>
43
43
  {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
44
44
  <DataTableRow>
@@ -64,7 +64,7 @@
64
64
  return typeof val === 'boolean' ? null : val;
65
65
  })}
66
66
 
67
- <DataTableSortButton direction={dir} />
67
+ <DataTableSortButton direction={dir} disabled={isEmpty} />
68
68
  {/if}
69
69
 
70
70
  {#if restProps.resizable && header.column.getCanResize()}
@@ -96,7 +96,6 @@
96
96
  {/if}
97
97
  <DataTableRow>
98
98
  {#each row.getVisibleCells() as cell (cell.id)}
99
- {console.log(row.depth)}
100
99
  <DataTableCell {cell} depth={row.depth}>
101
100
  <FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />
102
101
  </DataTableCell>
@@ -4,6 +4,7 @@ import { Context } from 'runed';
4
4
  export const dataTableVariants = tv({
5
5
  slots: {
6
6
  root: [
7
+ 'cgui:flex cgui:flex-col',
7
8
  'cgui:scrollbar-thin cgui:scrollbar-thumb-surface-regular cgui:scrollbar-track-surface-lightest cgui:scrollbar-thumb-rounded-full cgui:scrollbar-track-rounded-full',
8
9
  'cgui:overflow-auto cgui:w-full',
9
10
  'cgui:border cgui:border-stroke-divider',
@@ -0,0 +1,6 @@
1
+ export { default as Root } from './toast.root.svelte';
2
+ export { default as Icon } from './toast.icon.svelte';
3
+ export { default as Body } from './toast.body.svelte';
4
+ export { default as Title } from './toast.title.svelte';
5
+ export { default as Description } from './toast.description.svelte';
6
+ export { default as Close } from './toast.close.svelte';
@@ -0,0 +1,6 @@
1
+ export { default as Root } from './toast.root.svelte';
2
+ export { default as Icon } from './toast.icon.svelte';
3
+ export { default as Body } from './toast.body.svelte';
4
+ export { default as Title } from './toast.title.svelte';
5
+ export { default as Description } from './toast.description.svelte';
6
+ export { default as Close } from './toast.close.svelte';
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { toastPrimitiveBodyStyles } from '../styles.js';
4
+ import type { ToastPrimitiveBodyProps } from '../types.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ children,
9
+ class: className,
10
+ ...restProps
11
+ }: ToastPrimitiveBodyProps = $props();
12
+ </script>
13
+
14
+ <div bind:this={ref} class={cn(toastPrimitiveBodyStyles(), className)} data-slot="toast-body" {...restProps}>
15
+ {@render children?.()}
16
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ToastPrimitiveBodyProps } from '../types.js';
2
+ declare const Toast: import("svelte").Component<ToastPrimitiveBodyProps, {}, "ref">;
3
+ type Toast = ReturnType<typeof Toast>;
4
+ export default Toast;
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import { Icon } from '../../icons/index.js';
3
+ import { cn } from '../../../internal/utils/common.js';
4
+ import { toastPrimitiveCloseStyles } from '../styles.js';
5
+ import type { ToastPrimitiveCloseProps } from '../types.js';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ class: className,
10
+ ...restProps
11
+ }: ToastPrimitiveCloseProps = $props();
12
+ </script>
13
+
14
+ <button
15
+ bind:this={ref}
16
+ type="button"
17
+ class={cn(toastPrimitiveCloseStyles(), className)}
18
+ data-slot="toast-close"
19
+ {...restProps}
20
+ >
21
+ <Icon.Cross width={12} height={12} />
22
+ </button>
@@ -0,0 +1,4 @@
1
+ import type { ToastPrimitiveCloseProps } from '../types.js';
2
+ declare const Toast: import("svelte").Component<ToastPrimitiveCloseProps, {}, "ref">;
3
+ type Toast = ReturnType<typeof Toast>;
4
+ export default Toast;
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { toastPrimitiveDescriptionStyles } from '../styles.js';
4
+ import type { ToastPrimitiveDescriptionProps } from '../types.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ children,
9
+ class: className,
10
+ ...restProps
11
+ }: ToastPrimitiveDescriptionProps = $props();
12
+ </script>
13
+
14
+ <p bind:this={ref} class={cn(toastPrimitiveDescriptionStyles(), className)} data-slot="toast-description" {...restProps}>
15
+ {@render children?.()}
16
+ </p>
@@ -0,0 +1,4 @@
1
+ import type { ToastPrimitiveDescriptionProps } from '../types.js';
2
+ declare const Toast: import("svelte").Component<ToastPrimitiveDescriptionProps, {}, "ref">;
3
+ type Toast = ReturnType<typeof Toast>;
4
+ export default Toast;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import { Icon } from '../../icons/index.js';
3
+ import { cn } from '../../../internal/utils/common.js';
4
+ import { toastPrimitiveIconWrapperStyles, toastPrimitiveInnerIconStyles } from '../styles.js';
5
+ import type { ToastPrimitiveIconProps } from '../types.js';
6
+ import { ToastRootContext } from './toast.svelte.js';
7
+
8
+ let {
9
+ ref = $bindable(null),
10
+ icon,
11
+ class: className,
12
+ ...restProps
13
+ }: ToastPrimitiveIconProps = $props();
14
+
15
+ const rootState = ToastRootContext.get();
16
+
17
+ const InnerIcon = $derived.by(() => {
18
+ const variant = rootState.opts.variant.current;
19
+ if (variant === 'error') return Icon.Error;
20
+ if (variant === 'warning') return Icon.Warning;
21
+ if (variant === 'success') return Icon.Success;
22
+ return Icon.Info;
23
+ });
24
+ </script>
25
+
26
+ <div
27
+ bind:this={ref}
28
+ class={cn(toastPrimitiveIconWrapperStyles({ hasIcon: rootState.opts.hasIcon.current }), className)}
29
+ data-slot="toast-icon"
30
+ {...restProps}
31
+ >
32
+ {#if icon}
33
+ {@render icon()}
34
+ {:else}
35
+ <InnerIcon class={toastPrimitiveInnerIconStyles({ variant: rootState.opts.variant.current })} width={16} height={16} />
36
+ {/if}
37
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ToastPrimitiveIconProps } from '../types.js';
2
+ declare const Toast: import("svelte").Component<ToastPrimitiveIconProps, {}, "ref">;
3
+ type Toast = ReturnType<typeof Toast>;
4
+ export default Toast;
@@ -0,0 +1,26 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { box } from 'svelte-toolbelt';
4
+ import { toastPrimitiveRootStyles } from '../styles.js';
5
+ import type { ToastPrimitiveRootProps } from '../types.js';
6
+ import { ToastRootState } from './toast.svelte.js';
7
+
8
+ let {
9
+ ref = $bindable(null),
10
+ variant = 'info',
11
+ rounded = 'xs',
12
+ hasIcon = true,
13
+ children,
14
+ class: className,
15
+ ...restProps
16
+ }: ToastPrimitiveRootProps = $props();
17
+
18
+ ToastRootState.create({
19
+ variant: box.with(() => variant),
20
+ hasIcon: box.with(() => hasIcon),
21
+ });
22
+ </script>
23
+
24
+ <div bind:this={ref} class={cn(toastPrimitiveRootStyles({ variant, rounded }), className)} data-slot="toast-root" {...restProps}>
25
+ {@render children?.()}
26
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { ToastPrimitiveRootProps } from '../types.js';
2
+ declare const Toast: import("svelte").Component<ToastPrimitiveRootProps, {}, "ref">;
3
+ type Toast = ReturnType<typeof Toast>;
4
+ export default Toast;
@@ -0,0 +1,14 @@
1
+ import { Context } from 'runed';
2
+ import type { ReadableBoxedValues } from 'svelte-toolbelt';
3
+ import type { ToastPrimitiveRootProps } from '../types.js';
4
+ export declare const ToastRootContext: Context<ToastRootState>;
5
+ type ToastRootStateOpts = ReadableBoxedValues<{
6
+ variant: NonNullable<ToastPrimitiveRootProps['variant']>;
7
+ hasIcon: boolean;
8
+ }>;
9
+ export declare class ToastRootState {
10
+ static create(opts: ToastRootStateOpts): ToastRootState;
11
+ readonly opts: ToastRootStateOpts;
12
+ constructor(opts: ToastRootStateOpts);
13
+ }
14
+ export {};
@@ -0,0 +1,12 @@
1
+ import { keyWithPrefix } from '../../../internal/utils/common.js';
2
+ import { Context } from 'runed';
3
+ export const ToastRootContext = new Context(keyWithPrefix('toast-root'));
4
+ export class ToastRootState {
5
+ static create(opts) {
6
+ return ToastRootContext.set(new ToastRootState(opts));
7
+ }
8
+ opts;
9
+ constructor(opts) {
10
+ this.opts = opts;
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { cn } from '../../../internal/utils/common.js';
3
+ import { toastPrimitiveTitleStyles } from '../styles.js';
4
+ import type { ToastPrimitiveTitleProps } from '../types.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ children,
9
+ class: className,
10
+ ...restProps
11
+ }: ToastPrimitiveTitleProps = $props();
12
+ </script>
13
+
14
+ <p bind:this={ref} class={cn(toastPrimitiveTitleStyles(), className)} data-slot="toast-title" {...restProps}>
15
+ {@render children?.()}
16
+ </p>
@@ -0,0 +1,4 @@
1
+ import type { ToastPrimitiveTitleProps } from '../types.js';
2
+ declare const Toast: import("svelte").Component<ToastPrimitiveTitleProps, {}, "ref">;
3
+ type Toast = ReturnType<typeof Toast>;
4
+ export default Toast;
@@ -0,0 +1 @@
1
+ export { Root } from './root/index.js';
@@ -0,0 +1 @@
1
+ export { Root } from './root/index.js';
@@ -0,0 +1 @@
1
+ export { default as Root } from './toast.root.svelte';
@@ -0,0 +1 @@
1
+ export { default as Root } from './toast.root.svelte';
@@ -0,0 +1,47 @@
1
+ <script lang="ts">
2
+ import * as ToastPrimitive from '../../components/index.js';
3
+ import type { ToastRootProps } from '../../types.js';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ variant = 'info',
8
+ rounded = 'xs',
9
+ hasIcon = true,
10
+ title,
11
+ description,
12
+ icon,
13
+ onClose,
14
+ class: className,
15
+ ...restProps
16
+ }: ToastRootProps = $props();
17
+ </script>
18
+
19
+ <ToastPrimitive.Root bind:ref {variant} {rounded} {hasIcon} class={className} {...restProps}>
20
+ <ToastPrimitive.Icon {icon} />
21
+
22
+ <ToastPrimitive.Body>
23
+ {#if title}
24
+ <ToastPrimitive.Title>
25
+ {#if typeof title === 'string'}
26
+ {title}
27
+ {:else}
28
+ {@render title()}
29
+ {/if}
30
+ </ToastPrimitive.Title>
31
+ {/if}
32
+
33
+ {#if description}
34
+ <ToastPrimitive.Description>
35
+ {#if typeof description === 'string'}
36
+ {description}
37
+ {:else}
38
+ {@render description()}
39
+ {/if}
40
+ </ToastPrimitive.Description>
41
+ {/if}
42
+ </ToastPrimitive.Body>
43
+
44
+ {#if onClose}
45
+ <ToastPrimitive.Close onclick={onClose} />
46
+ {/if}
47
+ </ToastPrimitive.Root>
@@ -0,0 +1,4 @@
1
+ import type { ToastRootProps } from '../../types.js';
2
+ declare const Toast: import("svelte").Component<ToastRootProps, {}, "ref">;
3
+ type Toast = ReturnType<typeof Toast>;
4
+ export default Toast;
@@ -1,2 +1,3 @@
1
- export * from './exports.js';
2
- export type { ToastProps } from './types.js';
1
+ export * as ToastPrimitive from './components/index.js';
2
+ export * as Toast from './composed/index.js';
3
+ export * from './types.js';
@@ -1 +1,3 @@
1
- export * from './exports.js';
1
+ export * as ToastPrimitive from './components/index.js';
2
+ export * as Toast from './composed/index.js';
3
+ export * from './types.js';
@@ -1,152 +1,90 @@
1
- import { Context } from 'runed';
2
- import type { ReadableBox } from 'svelte-toolbelt';
3
1
  import type { VariantProps } from 'tailwind-variants';
4
- export declare const toastVariants: import("tailwind-variants").TVReturnType<{
2
+ export declare const toastPrimitiveRootStyles: import("tailwind-variants").TVReturnType<{
5
3
  variant: {
6
- error: {
7
- root: string;
8
- innerIcon: string;
9
- };
10
- warning: {
11
- root: string;
12
- innerIcon: string;
13
- };
14
- success: {
15
- root: string;
16
- innerIcon: string;
17
- };
18
- info: {
19
- root: string;
20
- innerIcon: string;
21
- };
4
+ error: string;
5
+ warning: string;
6
+ success: string;
7
+ info: string;
22
8
  };
23
9
  rounded: {
24
- xs: {
25
- root: string;
26
- };
27
- sm: {
28
- root: string;
29
- };
30
- md: {
31
- root: string;
32
- };
33
- lg: {
34
- root: string;
35
- };
36
- xl: {
37
- root: string;
38
- };
10
+ xs: string;
11
+ sm: string;
12
+ md: string;
13
+ lg: string;
14
+ xl: string;
39
15
  };
40
- hasIcon: {
41
- false: {
42
- iconWrapper: string;
43
- };
16
+ }, undefined, string[], {
17
+ variant: {
18
+ error: string;
19
+ warning: string;
20
+ success: string;
21
+ info: string;
22
+ };
23
+ rounded: {
24
+ xs: string;
25
+ sm: string;
26
+ md: string;
27
+ lg: string;
28
+ xl: string;
44
29
  };
45
- }, {
46
- root: string[];
47
- iconWrapper: string[];
48
- innerIcon: never[];
49
- body: string[];
50
- title: string[];
51
- description: string[];
52
- }, undefined, {
30
+ }, undefined, import("tailwind-variants").TVReturnType<{
53
31
  variant: {
54
- error: {
55
- root: string;
56
- innerIcon: string;
57
- };
58
- warning: {
59
- root: string;
60
- innerIcon: string;
61
- };
62
- success: {
63
- root: string;
64
- innerIcon: string;
65
- };
66
- info: {
67
- root: string;
68
- innerIcon: string;
69
- };
32
+ error: string;
33
+ warning: string;
34
+ success: string;
35
+ info: string;
70
36
  };
71
37
  rounded: {
72
- xs: {
73
- root: string;
74
- };
75
- sm: {
76
- root: string;
77
- };
78
- md: {
79
- root: string;
80
- };
81
- lg: {
82
- root: string;
83
- };
84
- xl: {
85
- root: string;
86
- };
38
+ xs: string;
39
+ sm: string;
40
+ md: string;
41
+ lg: string;
42
+ xl: string;
43
+ };
44
+ }, undefined, string[], unknown, unknown, undefined>>;
45
+ export declare const toastPrimitiveIconWrapperStyles: import("tailwind-variants").TVReturnType<{
46
+ hasIcon: {
47
+ false: string;
87
48
  };
49
+ }, undefined, string[], {
88
50
  hasIcon: {
89
- false: {
90
- iconWrapper: string;
91
- };
51
+ false: string;
92
52
  };
93
- }, {
94
- root: string[];
95
- iconWrapper: string[];
96
- innerIcon: never[];
97
- body: string[];
98
- title: string[];
99
- description: string[];
100
- }, import("tailwind-variants").TVReturnType<{
53
+ }, undefined, import("tailwind-variants").TVReturnType<{
54
+ hasIcon: {
55
+ false: string;
56
+ };
57
+ }, undefined, string[], unknown, unknown, undefined>>;
58
+ export declare const toastPrimitiveInnerIconStyles: import("tailwind-variants").TVReturnType<{
101
59
  variant: {
102
- error: {
103
- root: string;
104
- innerIcon: string;
105
- };
106
- warning: {
107
- root: string;
108
- innerIcon: string;
109
- };
110
- success: {
111
- root: string;
112
- innerIcon: string;
113
- };
114
- info: {
115
- root: string;
116
- innerIcon: string;
117
- };
60
+ error: string;
61
+ warning: string;
62
+ success: string;
63
+ info: string;
118
64
  };
119
- rounded: {
120
- xs: {
121
- root: string;
122
- };
123
- sm: {
124
- root: string;
125
- };
126
- md: {
127
- root: string;
128
- };
129
- lg: {
130
- root: string;
131
- };
132
- xl: {
133
- root: string;
134
- };
65
+ }, undefined, never[], {
66
+ variant: {
67
+ error: string;
68
+ warning: string;
69
+ success: string;
70
+ info: string;
135
71
  };
136
- hasIcon: {
137
- false: {
138
- iconWrapper: string;
139
- };
72
+ }, undefined, import("tailwind-variants").TVReturnType<{
73
+ variant: {
74
+ error: string;
75
+ warning: string;
76
+ success: string;
77
+ info: string;
140
78
  };
141
- }, {
142
- root: string[];
143
- iconWrapper: string[];
144
- innerIcon: never[];
145
- body: string[];
146
- title: string[];
147
- description: string[];
148
- }, undefined, unknown, unknown, undefined>>;
149
- export type SegmentVariantsProps = VariantProps<typeof toastVariants>;
150
- type ToastStylesContextValues = ReadableBox<ReturnType<typeof toastVariants>>;
151
- export declare const ToastStylesContext: Context<ToastStylesContextValues>;
152
- export {};
79
+ }, undefined, never[], unknown, unknown, undefined>>;
80
+ export declare const toastPrimitiveBodyStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
81
+ export declare const toastPrimitiveTitleStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
82
+ export declare const toastPrimitiveDescriptionStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
83
+ export declare const toastPrimitiveCloseStyles: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
84
+ export type ToastPrimitiveRootVariants = VariantProps<typeof toastPrimitiveRootStyles>;
85
+ export type ToastPrimitiveIconWrapperVariants = VariantProps<typeof toastPrimitiveIconWrapperStyles>;
86
+ export type ToastPrimitiveInnerIconVariants = VariantProps<typeof toastPrimitiveInnerIconStyles>;
87
+ export type ToastPrimitiveBodyVariants = VariantProps<typeof toastPrimitiveBodyStyles>;
88
+ export type ToastPrimitiveTitleVariants = VariantProps<typeof toastPrimitiveTitleStyles>;
89
+ export type ToastPrimitiveDescriptionVariants = VariantProps<typeof toastPrimitiveDescriptionStyles>;
90
+ export type ToastPrimitiveCloseVariants = VariantProps<typeof toastPrimitiveCloseStyles>;
@@ -1,62 +1,65 @@
1
- import { keyWithPrefix } from '../../internal/utils/common.js';
2
1
  import { tv } from '../../internal/utils/tailwindcss.js';
3
- import { Context } from 'runed';
4
- export const toastVariants = tv({
5
- slots: {
6
- root: [
7
- 'cgui:overflow-hidden cgui:relative cgui:min-w-42 cgui:max-w-80',
8
- 'cgui:flex cgui:items-center cgui:gap-2 cgui:p-3',
9
- 'cgui:shadow-toast cgui:bg-surface-white',
10
- 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
11
- 'cgui:before:content-[""] cgui:before:pointer-events-none cgui:before:absolute cgui:before:top-0 cgui:before:inset-x-0 cgui:before:h-1.5 cgui:before:block',
12
- ],
13
- iconWrapper: ['cgui:shrink-0 cgui:size-6 cgui:flex cgui:items-center cgui:justify-center cgui:select-none'],
14
- innerIcon: [],
15
- body: ['cgui:flex cgui:flex-col cgui:gap-1 cgui:flex-1 cgui:text-left'],
16
- title: ['cgui:text-body-2 cgui:text-fg-darkest'],
17
- description: ['cgui:text-caption-2 cgui:text-fg-darkest'],
18
- },
2
+ const ToastVariants = ['error', 'warning', 'success', 'info'];
3
+ const ToastRoundings = ['xs', 'sm', 'md', 'lg', 'xl'];
4
+ export const toastPrimitiveRootStyles = tv({
5
+ base: [
6
+ 'cgui:overflow-hidden cgui:relative cgui:min-w-42 cgui:max-w-80',
7
+ 'cgui:flex cgui:items-center cgui:gap-2 cgui:p-3',
8
+ 'cgui:shadow-toast cgui:bg-surface-white',
9
+ 'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
10
+ 'cgui:before:content-[""] cgui:before:pointer-events-none cgui:before:absolute cgui:before:top-0 cgui:before:inset-x-0 cgui:before:h-1.5 cgui:before:block',
11
+ ],
19
12
  variants: {
20
13
  variant: {
21
- error: {
22
- root: 'cgui:before:bg-state-error',
23
- innerIcon: 'cgui:text-state-error',
24
- },
25
- warning: {
26
- root: 'cgui:before:bg-state-warning',
27
- innerIcon: 'cgui:text-state-warning',
28
- },
29
- success: {
30
- root: 'cgui:before:bg-state-success',
31
- innerIcon: 'cgui:text-state-success',
32
- },
33
- info: {
34
- root: 'cgui:before:bg-state-info',
35
- innerIcon: 'cgui:text-state-info',
36
- },
14
+ error: 'cgui:before:bg-state-error',
15
+ warning: 'cgui:before:bg-state-warning',
16
+ success: 'cgui:before:bg-state-success',
17
+ info: 'cgui:before:bg-state-info',
37
18
  },
38
19
  rounded: {
39
- xs: {
40
- root: 'cgui:rounded-xs',
41
- },
42
- sm: {
43
- root: 'cgui:rounded-sm',
44
- },
45
- md: {
46
- root: 'cgui:rounded-md',
47
- },
48
- lg: {
49
- root: 'cgui:rounded-lg',
50
- },
51
- xl: {
52
- root: 'cgui:rounded-xl',
53
- },
20
+ xs: 'cgui:rounded-xs',
21
+ sm: 'cgui:rounded-sm',
22
+ md: 'cgui:rounded-md',
23
+ lg: 'cgui:rounded-lg',
24
+ xl: 'cgui:rounded-xl',
54
25
  },
26
+ },
27
+ });
28
+ export const toastPrimitiveIconWrapperStyles = tv({
29
+ base: [
30
+ 'cgui:shrink-0 cgui:[&_svg]:size-6 cgui:[&_svg]:shrink-0 cgui:flex cgui:items-center cgui:justify-center cgui:select-none',
31
+ ],
32
+ variants: {
55
33
  hasIcon: {
56
- false: {
57
- iconWrapper: 'cgui:hidden',
58
- },
34
+ false: 'cgui:hidden',
59
35
  },
60
36
  },
61
37
  });
62
- export const ToastStylesContext = new Context(keyWithPrefix('toast-styles'));
38
+ export const toastPrimitiveInnerIconStyles = tv({
39
+ base: [],
40
+ variants: {
41
+ variant: {
42
+ error: 'cgui:text-state-error',
43
+ warning: 'cgui:text-state-warning',
44
+ success: 'cgui:text-state-success',
45
+ info: 'cgui:text-state-info',
46
+ },
47
+ },
48
+ });
49
+ export const toastPrimitiveBodyStyles = tv({
50
+ base: ['cgui:flex cgui:flex-col cgui:gap-1 cgui:flex-1 cgui:text-left'],
51
+ });
52
+ export const toastPrimitiveTitleStyles = tv({
53
+ base: ['cgui:text-body-2 cgui:text-fg-darkest'],
54
+ });
55
+ export const toastPrimitiveDescriptionStyles = tv({
56
+ base: ['cgui:text-caption-2 cgui:text-fg-darkest'],
57
+ });
58
+ export const toastPrimitiveCloseStyles = tv({
59
+ base: [
60
+ 'cgui:shrink-0 cgui:size-6 cgui:flex cgui:items-center cgui:justify-center',
61
+ 'cgui:rounded-xs cgui:cursor-pointer cgui:select-none',
62
+ 'cgui:text-fg-regular cgui:hover:text-fg-darkest',
63
+ 'cgui:transition-colors cgui:duration-200',
64
+ ],
65
+ });
@@ -1,11 +1,30 @@
1
- import type { PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
1
+ import type { PrimitiveButtonAttributes, PrimitiveDivAttributes, PrimitiveParagraphAttributes } from '../../internal/types/html-attributes.js';
2
+ import type { Without } from '../../internal/types/common.js';
2
3
  import type { Snippet } from 'svelte';
3
- import type { WithElementRef, Without } from 'svelte-toolbelt';
4
- import type { SegmentVariantsProps } from './styles.js';
5
- type ToastPropsWithoutHTML = WithElementRef<{
6
- title?: Snippet | string;
7
- description?: Snippet | string;
4
+ import type { WithChildren, WithElementRef } from 'svelte-toolbelt';
5
+ import type { ToastPrimitiveRootVariants } from './styles.js';
6
+ type ToastPrimitiveRootPropsWithoutHTML = WithElementRef<WithChildren<{
7
+ hasIcon?: boolean;
8
+ }>> & ToastPrimitiveRootVariants;
9
+ export type ToastPrimitiveRootProps = ToastPrimitiveRootPropsWithoutHTML & Without<PrimitiveDivAttributes, ToastPrimitiveRootPropsWithoutHTML>;
10
+ type ToastPrimitiveIconPropsWithoutHTML = WithElementRef<{
8
11
  icon?: Snippet;
9
- }> & SegmentVariantsProps;
10
- export type ToastProps = ToastPropsWithoutHTML & Without<PrimitiveDivAttributes, ToastPropsWithoutHTML>;
12
+ }>;
13
+ export type ToastPrimitiveIconProps = ToastPrimitiveIconPropsWithoutHTML & Without<PrimitiveDivAttributes, ToastPrimitiveIconPropsWithoutHTML>;
14
+ type ToastPrimitiveBodyPropsWithoutHTML = WithElementRef<WithChildren<{}>>;
15
+ export type ToastPrimitiveBodyProps = ToastPrimitiveBodyPropsWithoutHTML & Without<PrimitiveDivAttributes, ToastPrimitiveBodyPropsWithoutHTML>;
16
+ type ToastPrimitiveTitlePropsWithoutHTML = WithElementRef<WithChildren<{}>>;
17
+ export type ToastPrimitiveTitleProps = ToastPrimitiveTitlePropsWithoutHTML & Without<PrimitiveParagraphAttributes, ToastPrimitiveTitlePropsWithoutHTML>;
18
+ type ToastPrimitiveDescriptionPropsWithoutHTML = WithElementRef<WithChildren<{}>>;
19
+ export type ToastPrimitiveDescriptionProps = ToastPrimitiveDescriptionPropsWithoutHTML & Without<PrimitiveParagraphAttributes, ToastPrimitiveDescriptionPropsWithoutHTML>;
20
+ type ToastPrimitiveClosePropsWithoutHTML = WithElementRef<{}>;
21
+ export type ToastPrimitiveCloseProps = ToastPrimitiveClosePropsWithoutHTML & Without<PrimitiveButtonAttributes, ToastPrimitiveClosePropsWithoutHTML>;
22
+ type ToastRootPropsWithoutHTML = WithElementRef<{
23
+ title?: string | Snippet;
24
+ description?: string | Snippet;
25
+ icon?: Snippet;
26
+ onClose?: () => void;
27
+ hasIcon?: boolean;
28
+ }> & ToastPrimitiveRootVariants;
29
+ export type ToastRootProps = ToastRootPropsWithoutHTML & Without<PrimitiveDivAttributes, ToastRootPropsWithoutHTML>;
11
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casinogate/ui",
3
- "version": "1.11.4",
3
+ "version": "1.11.6",
4
4
  "svelte": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- export { default as Toast } from './toast.component.svelte';
@@ -1 +0,0 @@
1
- export { default as Toast } from './toast.component.svelte';
@@ -1,58 +0,0 @@
1
- <script lang="ts">
2
- import { Icon } from '../icons/index.js';
3
- import { cn } from '../../internal/utils/common.js';
4
- import { toastVariants } from './styles.js';
5
- import type { ToastProps } from './types.js';
6
-
7
- let {
8
- variant = 'info',
9
- rounded = 'xs',
10
- hasIcon = true,
11
- title,
12
- description,
13
- icon,
14
- class: className,
15
- ref = $bindable(null),
16
- ...props
17
- }: ToastProps = $props();
18
-
19
- const styles = $derived(toastVariants({ variant, rounded, hasIcon }));
20
-
21
- const InnerIcon = $derived.by(() => {
22
- if (variant === 'error') return Icon.Error;
23
-
24
- if (variant === 'warning') return Icon.Warning;
25
-
26
- if (variant === 'success') return Icon.Success;
27
-
28
- return Icon.Info;
29
- });
30
- </script>
31
-
32
- <div bind:this={ref} class={cn(styles.root(), className)} {...props}>
33
- <div class={styles.iconWrapper()}>
34
- {#if icon}
35
- {@render icon()}
36
- {:else}
37
- <InnerIcon class={styles.innerIcon()} width={16} height={16} />
38
- {/if}
39
- </div>
40
-
41
- <div class={styles.body()}>
42
- {#if typeof title === 'string'}
43
- {#if title.trim().length}
44
- <p class={styles.title()}>{title}</p>
45
- {/if}
46
- {:else}
47
- {@render title?.()}
48
- {/if}
49
-
50
- {#if typeof description === 'string'}
51
- {#if description.trim().length}
52
- <p class={styles.description()}>{description}</p>
53
- {/if}
54
- {:else}
55
- {@render description?.()}
56
- {/if}
57
- </div>
58
- </div>
@@ -1,4 +0,0 @@
1
- import type { ToastProps } from './types.js';
2
- declare const Toast: import("svelte").Component<ToastProps, {}, "ref">;
3
- type Toast = ReturnType<typeof Toast>;
4
- export default Toast;