@casinogate/ui 1.11.6 → 1.11.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.
- package/dist/components/combobox/presets/async/combobox.async.svelte +8 -7
- package/dist/components/combobox/presets/async/combobox.async.svelte.d.ts +24 -2
- package/dist/components/combobox/presets/root/combobox.svelte +3 -2
- package/dist/components/combobox/types.d.ts +16 -9
- package/dist/components/command/types.d.ts +1 -0
- package/dist/components/toast/components/toast.body.svelte +1 -6
- package/dist/components/toast/components/toast.close.svelte +1 -5
- package/dist/components/toast/components/toast.description.svelte +7 -7
- package/dist/components/toast/components/toast.icon.svelte +6 -7
- package/dist/components/toast/components/toast.root.svelte +6 -1
- package/dist/components/toast/components/toast.title.svelte +1 -6
- package/dist/components/toast/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script lang="ts" generics="TItem extends CommandItem">
|
|
2
2
|
import type { CommandCollection, CommandItem } from '../../../command/index.js';
|
|
3
3
|
import type { ComboboxAsyncProps } from '../../types.js';
|
|
4
4
|
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
portalDisabled = false,
|
|
36
36
|
allowDeselect = true,
|
|
37
37
|
triggerClass,
|
|
38
|
+
contentClass,
|
|
38
39
|
size = 'default',
|
|
39
40
|
variant = 'default',
|
|
40
41
|
rounded = 'default',
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
onSelect = noop,
|
|
57
58
|
|
|
58
59
|
...restProps
|
|
59
|
-
}: ComboboxAsyncProps = $props();
|
|
60
|
+
}: ComboboxAsyncProps<TItem> = $props();
|
|
60
61
|
|
|
61
62
|
const isMultiple = type === 'multiple';
|
|
62
63
|
|
|
@@ -267,7 +268,7 @@
|
|
|
267
268
|
behavior: 'smooth',
|
|
268
269
|
});
|
|
269
270
|
};
|
|
270
|
-
function onSelectItem(item:
|
|
271
|
+
function onSelectItem(item: CommandItem) {
|
|
271
272
|
if (Array.isArray(value)) {
|
|
272
273
|
let result = value;
|
|
273
274
|
if (value.includes(item.value)) {
|
|
@@ -275,7 +276,7 @@
|
|
|
275
276
|
} else {
|
|
276
277
|
result = [...value, item.value];
|
|
277
278
|
}
|
|
278
|
-
onSelect(result, item);
|
|
279
|
+
onSelect(result, item as TItem);
|
|
279
280
|
value = result;
|
|
280
281
|
} else {
|
|
281
282
|
let result = value;
|
|
@@ -284,7 +285,7 @@
|
|
|
284
285
|
} else {
|
|
285
286
|
result = item.value;
|
|
286
287
|
}
|
|
287
|
-
onSelect(result, item);
|
|
288
|
+
onSelect(result, item as TItem);
|
|
288
289
|
value = result;
|
|
289
290
|
}
|
|
290
291
|
|
|
@@ -359,7 +360,7 @@
|
|
|
359
360
|
{#if itemSnippet}
|
|
360
361
|
<CommandPrimitive.Item {...itemAttrs} data-selected={boolAttr(isSelected(itemValue))}>
|
|
361
362
|
{#snippet child({ props })}
|
|
362
|
-
{@render itemSnippet?.({ item, props })}
|
|
363
|
+
{@render itemSnippet?.({ item: item as TItem, props })}
|
|
363
364
|
{/snippet}
|
|
364
365
|
</CommandPrimitive.Item>
|
|
365
366
|
{:else}
|
|
@@ -412,7 +413,7 @@
|
|
|
412
413
|
{@render renderTrigger()}
|
|
413
414
|
|
|
414
415
|
<PopoverPrimitive.Portal disabled={portalDisabled}>
|
|
415
|
-
<PopoverPrimitive.Content class=
|
|
416
|
+
<PopoverPrimitive.Content class={cn('cgui:overflow-hidden cgui:rounded-md', contentClass)}>
|
|
416
417
|
<CommandPrimitive.Root shouldFilter={false} class="cgui:max-h-80">
|
|
417
418
|
<CommandPrimitive.Input bind:value={searchValue} placeholder={searchPlaceholder} />
|
|
418
419
|
|
|
@@ -1,4 +1,26 @@
|
|
|
1
|
+
import type { CommandItem } from '../../../command/index.js';
|
|
1
2
|
import type { ComboboxAsyncProps } from '../../types.js';
|
|
2
|
-
declare
|
|
3
|
-
|
|
3
|
+
declare function $$render<TItem extends CommandItem>(): {
|
|
4
|
+
props: ComboboxAsyncProps<TItem>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "value" | "open" | "items" | "searchValue";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<TItem extends CommandItem> {
|
|
11
|
+
props(): ReturnType<typeof $$render<TItem>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<TItem>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<TItem>>['slots'];
|
|
14
|
+
bindings(): "value" | "open" | "items" | "searchValue";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <TItem extends CommandItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TItem>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TItem>['props']>, ReturnType<__sveltets_Render<TItem>['events']>, ReturnType<__sveltets_Render<TItem>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<TItem>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<TItem>['exports']>;
|
|
21
|
+
<TItem extends CommandItem>(internal: unknown, props: ReturnType<__sveltets_Render<TItem>['props']> & {}): ReturnType<__sveltets_Render<TItem>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const Combobox: $$IsomorphicComponent;
|
|
25
|
+
type Combobox<TItem extends CommandItem> = InstanceType<typeof Combobox<TItem>>;
|
|
4
26
|
export default Combobox;
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
fullWidth = true,
|
|
39
39
|
closeOnSelect,
|
|
40
40
|
maxContentHeight,
|
|
41
|
+
contentClass,
|
|
41
42
|
onSelect = noop,
|
|
42
43
|
...restProps
|
|
43
44
|
}: ComboboxProps = $props();
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
return typeof value === 'string' && value.trim() !== '';
|
|
84
85
|
});
|
|
85
86
|
|
|
86
|
-
function onSelectItem(item:
|
|
87
|
+
function onSelectItem(item: CommandItem) {
|
|
87
88
|
if (Array.isArray(value)) {
|
|
88
89
|
let result = value;
|
|
89
90
|
if (value.includes(item.value)) {
|
|
@@ -208,7 +209,7 @@
|
|
|
208
209
|
{@render renderTrigger()}
|
|
209
210
|
|
|
210
211
|
<PopoverPrimitive.Portal disabled={portalDisabled}>
|
|
211
|
-
<PopoverPrimitive.Content class=
|
|
212
|
+
<PopoverPrimitive.Content class={cn('cgui:overflow-hidden cgui:rounded-md', contentClass)}>
|
|
212
213
|
<CommandPrimitive.Root>
|
|
213
214
|
<CommandPrimitive.Input bind:value={searchValue} placeholder={searchPlaceholder} />
|
|
214
215
|
|
|
@@ -16,6 +16,7 @@ type ComboboxBaseProps = PrimitivePopoverRootProps & ComboboxTriggerVariantsProp
|
|
|
16
16
|
portalDisabled?: boolean;
|
|
17
17
|
allowDeselect?: boolean;
|
|
18
18
|
triggerClass?: string;
|
|
19
|
+
contentClass?: string;
|
|
19
20
|
closeOnSelect?: boolean;
|
|
20
21
|
maxContentHeight?: string;
|
|
21
22
|
clearable?: boolean;
|
|
@@ -50,13 +51,19 @@ export type ComboboxAsyncCallbackParams = {
|
|
|
50
51
|
pageSize: number;
|
|
51
52
|
search: string;
|
|
52
53
|
};
|
|
53
|
-
export type ComboboxAsyncCallbackResult = {
|
|
54
|
-
items:
|
|
54
|
+
export type ComboboxAsyncCallbackResult<TItem extends CommandItem> = {
|
|
55
|
+
items: TItem[];
|
|
55
56
|
hasMore: boolean;
|
|
56
57
|
};
|
|
57
|
-
export type ComboboxAsyncCallback = (params: ComboboxAsyncCallbackParams) => Promise<ComboboxAsyncCallbackResult
|
|
58
|
-
type ComboboxAsyncBaseProps = Omit<ComboboxBaseProps, 'collection'> & {
|
|
59
|
-
items?:
|
|
58
|
+
export type ComboboxAsyncCallback<TItem extends CommandItem = CommandItem> = (params: ComboboxAsyncCallbackParams) => Promise<ComboboxAsyncCallbackResult<TItem>>;
|
|
59
|
+
type ComboboxAsyncBaseProps<TItem extends CommandItem> = Omit<ComboboxBaseProps, 'collection' | 'item' | 'onSelect'> & {
|
|
60
|
+
items?: TItem[];
|
|
61
|
+
item?: Snippet<[{
|
|
62
|
+
item: TItem;
|
|
63
|
+
props: Record<string, unknown>;
|
|
64
|
+
}]>;
|
|
65
|
+
/** Callback when selection changes */
|
|
66
|
+
onSelect?: (value: string | string[], item: TItem | null) => void;
|
|
60
67
|
/** Loading state renderer */
|
|
61
68
|
loading?: Snippet;
|
|
62
69
|
/** Current page (default: 1) */
|
|
@@ -64,7 +71,7 @@ type ComboboxAsyncBaseProps = Omit<ComboboxBaseProps, 'collection'> & {
|
|
|
64
71
|
/** Page size for pagination (default: 20) */
|
|
65
72
|
pageSize?: number;
|
|
66
73
|
/** Async data callback */
|
|
67
|
-
callback: ComboboxAsyncCallback
|
|
74
|
+
callback: ComboboxAsyncCallback<TItem>;
|
|
68
75
|
/** Load immediate data when combobox is mounted (default: true) */
|
|
69
76
|
loadImmediate?: boolean;
|
|
70
77
|
/** Group definitions (for labels/ordering) */
|
|
@@ -82,15 +89,15 @@ type ComboboxAsyncBaseProps = Omit<ComboboxBaseProps, 'collection'> & {
|
|
|
82
89
|
*/
|
|
83
90
|
clearOnDependencyChange?: boolean;
|
|
84
91
|
};
|
|
85
|
-
type ComboboxAsyncSingleProps = ComboboxAsyncBaseProps & {
|
|
92
|
+
type ComboboxAsyncSingleProps<TItem extends CommandItem> = ComboboxAsyncBaseProps<TItem> & {
|
|
86
93
|
/** Selection mode (default: 'single') */
|
|
87
94
|
type?: 'single';
|
|
88
95
|
value?: string;
|
|
89
96
|
};
|
|
90
|
-
type ComboboxAsyncMultipleProps = ComboboxAsyncBaseProps & {
|
|
97
|
+
type ComboboxAsyncMultipleProps<TItem extends CommandItem> = ComboboxAsyncBaseProps<TItem> & {
|
|
91
98
|
/** Selection mode */
|
|
92
99
|
type: 'multiple';
|
|
93
100
|
value?: string[];
|
|
94
101
|
};
|
|
95
|
-
export type ComboboxAsyncProps = ComboboxAsyncSingleProps | ComboboxAsyncMultipleProps
|
|
102
|
+
export type ComboboxAsyncProps<TItem extends CommandItem> = ComboboxAsyncSingleProps<TItem> | ComboboxAsyncMultipleProps<TItem>;
|
|
96
103
|
export {};
|
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
import { toastPrimitiveBodyStyles } from '../styles.js';
|
|
4
4
|
import type { ToastPrimitiveBodyProps } from '../types.js';
|
|
5
5
|
|
|
6
|
-
let {
|
|
7
|
-
ref = $bindable(null),
|
|
8
|
-
children,
|
|
9
|
-
class: className,
|
|
10
|
-
...restProps
|
|
11
|
-
}: ToastPrimitiveBodyProps = $props();
|
|
6
|
+
let { ref = $bindable(null), children, class: className, ...restProps }: ToastPrimitiveBodyProps = $props();
|
|
12
7
|
</script>
|
|
13
8
|
|
|
14
9
|
<div bind:this={ref} class={cn(toastPrimitiveBodyStyles(), className)} data-slot="toast-body" {...restProps}>
|
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
import { toastPrimitiveCloseStyles } from '../styles.js';
|
|
5
5
|
import type { ToastPrimitiveCloseProps } from '../types.js';
|
|
6
6
|
|
|
7
|
-
let {
|
|
8
|
-
ref = $bindable(null),
|
|
9
|
-
class: className,
|
|
10
|
-
...restProps
|
|
11
|
-
}: ToastPrimitiveCloseProps = $props();
|
|
7
|
+
let { ref = $bindable(null), class: className, ...restProps }: ToastPrimitiveCloseProps = $props();
|
|
12
8
|
</script>
|
|
13
9
|
|
|
14
10
|
<button
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import { toastPrimitiveDescriptionStyles } from '../styles.js';
|
|
4
4
|
import type { ToastPrimitiveDescriptionProps } from '../types.js';
|
|
5
5
|
|
|
6
|
-
let {
|
|
7
|
-
ref = $bindable(null),
|
|
8
|
-
children,
|
|
9
|
-
class: className,
|
|
10
|
-
...restProps
|
|
11
|
-
}: ToastPrimitiveDescriptionProps = $props();
|
|
6
|
+
let { ref = $bindable(null), children, class: className, ...restProps }: ToastPrimitiveDescriptionProps = $props();
|
|
12
7
|
</script>
|
|
13
8
|
|
|
14
|
-
<p
|
|
9
|
+
<p
|
|
10
|
+
bind:this={ref}
|
|
11
|
+
class={cn(toastPrimitiveDescriptionStyles(), className)}
|
|
12
|
+
data-slot="toast-description"
|
|
13
|
+
{...restProps}
|
|
14
|
+
>
|
|
15
15
|
{@render children?.()}
|
|
16
16
|
</p>
|
|
@@ -5,12 +5,7 @@
|
|
|
5
5
|
import type { ToastPrimitiveIconProps } from '../types.js';
|
|
6
6
|
import { ToastRootContext } from './toast.svelte.js';
|
|
7
7
|
|
|
8
|
-
let {
|
|
9
|
-
ref = $bindable(null),
|
|
10
|
-
icon,
|
|
11
|
-
class: className,
|
|
12
|
-
...restProps
|
|
13
|
-
}: ToastPrimitiveIconProps = $props();
|
|
8
|
+
let { ref = $bindable(null), icon, class: className, ...restProps }: ToastPrimitiveIconProps = $props();
|
|
14
9
|
|
|
15
10
|
const rootState = ToastRootContext.get();
|
|
16
11
|
|
|
@@ -32,6 +27,10 @@
|
|
|
32
27
|
{#if icon}
|
|
33
28
|
{@render icon()}
|
|
34
29
|
{:else}
|
|
35
|
-
<InnerIcon
|
|
30
|
+
<InnerIcon
|
|
31
|
+
class={toastPrimitiveInnerIconStyles({ variant: rootState.opts.variant.current })}
|
|
32
|
+
width={16}
|
|
33
|
+
height={16}
|
|
34
|
+
/>
|
|
36
35
|
{/if}
|
|
37
36
|
</div>
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
});
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
bind:this={ref}
|
|
26
|
+
class={cn(toastPrimitiveRootStyles({ variant, rounded }), className)}
|
|
27
|
+
data-slot="toast-root"
|
|
28
|
+
{...restProps}
|
|
29
|
+
>
|
|
25
30
|
{@render children?.()}
|
|
26
31
|
</div>
|
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
import { toastPrimitiveTitleStyles } from '../styles.js';
|
|
4
4
|
import type { ToastPrimitiveTitleProps } from '../types.js';
|
|
5
5
|
|
|
6
|
-
let {
|
|
7
|
-
ref = $bindable(null),
|
|
8
|
-
children,
|
|
9
|
-
class: className,
|
|
10
|
-
...restProps
|
|
11
|
-
}: ToastPrimitiveTitleProps = $props();
|
|
6
|
+
let { ref = $bindable(null), children, class: className, ...restProps }: ToastPrimitiveTitleProps = $props();
|
|
12
7
|
</script>
|
|
13
8
|
|
|
14
9
|
<p bind:this={ref} class={cn(toastPrimitiveTitleStyles(), className)} data-slot="toast-title" {...restProps}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PrimitiveButtonAttributes, PrimitiveDivAttributes, PrimitiveParagraphAttributes } from '../../internal/types/html-attributes.js';
|
|
2
1
|
import type { Without } from '../../internal/types/common.js';
|
|
2
|
+
import type { PrimitiveButtonAttributes, PrimitiveDivAttributes, PrimitiveParagraphAttributes } from '../../internal/types/html-attributes.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { WithChildren, WithElementRef } from 'svelte-toolbelt';
|
|
5
5
|
import type { ToastPrimitiveRootVariants } from './styles.js';
|