@casinogate/ui 2.0.3 → 2.0.5
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,23 +1,23 @@
|
|
|
1
1
|
<script lang="ts" generics="TItem extends ComboboxItem">
|
|
2
2
|
import type { ComboboxAsyncProps, ComboboxItem } from '../types.js';
|
|
3
3
|
|
|
4
|
+
import { Icon, Icon as IconComponent } from '../../../atomic/icons/index.js';
|
|
4
5
|
import { SELECTION_TYPE } from '../../../internal/constants/selection-type.js';
|
|
5
6
|
import { boolAttr } from '../../../internal/utils/attrs.js';
|
|
6
7
|
import { cn, noop } from '../../../internal/utils/common.js';
|
|
8
|
+
import { Command as CommandPrimitive } from '../../../primitives/command/index.js';
|
|
9
|
+
import { Kbd } from '../../../primitives/kbd/index.js';
|
|
10
|
+
import { Popover as PopoverPrimitive } from '../../../primitives/popover/index.js';
|
|
11
|
+
import { Spinner } from '../../../primitives/spinner/index.js';
|
|
7
12
|
import { watch } from 'runed';
|
|
8
13
|
import { afterTick, boxWith } from 'svelte-toolbelt';
|
|
9
14
|
import type { Attachment } from 'svelte/attachments';
|
|
10
15
|
import { cubicInOut } from 'svelte/easing';
|
|
11
16
|
import { fly } from 'svelte/transition';
|
|
12
|
-
import { Icon, Icon as IconComponent } from '../../../atomic/icons/index.js';
|
|
13
|
-
import { Command as CommandPrimitive } from '../../../primitives/command/index.js';
|
|
14
|
-
import { Kbd } from '../../../primitives/kbd/index.js';
|
|
15
|
-
import { Popover as PopoverPrimitive } from '../../../primitives/popover/index.js';
|
|
16
|
-
import { Spinner } from '../../../primitives/spinner/index.js';
|
|
17
|
-
import { comboboxTriggerVariants } from '../styles.js';
|
|
18
17
|
import { useDisplayValue } from '../model/use-display-value.svelte.js';
|
|
19
18
|
import { useGroupedItems } from '../model/use-grouped-items.svelte.js';
|
|
20
19
|
import { useSelectedItems } from '../model/use-selected-items.svelte.js';
|
|
20
|
+
import { comboboxTriggerVariants } from '../styles.js';
|
|
21
21
|
import { useAsyncComboboxData } from './use-async-combobox-data.svelte.js';
|
|
22
22
|
|
|
23
23
|
let {
|
|
@@ -50,11 +50,9 @@
|
|
|
50
50
|
|
|
51
51
|
loading: loadingSnippet,
|
|
52
52
|
pageSize = 10,
|
|
53
|
-
callback,
|
|
54
53
|
loadItems,
|
|
55
54
|
loadImmediate = true,
|
|
56
|
-
debounceMs,
|
|
57
|
-
searchDebounce = 300,
|
|
55
|
+
debounceMs = 300,
|
|
58
56
|
dependsOn,
|
|
59
57
|
clearOnDependencyChange = true,
|
|
60
58
|
onDependencyChange,
|
|
@@ -114,7 +112,7 @@
|
|
|
114
112
|
const hasResults = $derived(items.length > 0);
|
|
115
113
|
|
|
116
114
|
const resolvedLoadItems = $derived.by(() => {
|
|
117
|
-
const loader = loadItems
|
|
115
|
+
const loader = loadItems;
|
|
118
116
|
if (!loader) {
|
|
119
117
|
throw new Error('Combobox.Async requires either loadItems or callback');
|
|
120
118
|
}
|
|
@@ -137,7 +135,7 @@
|
|
|
137
135
|
}
|
|
138
136
|
),
|
|
139
137
|
pageSize: boxWith(() => pageSize),
|
|
140
|
-
debounceMs: boxWith(() => debounceMs
|
|
138
|
+
debounceMs: boxWith(() => debounceMs),
|
|
141
139
|
loadImmediate: boxWith(() => loadImmediate),
|
|
142
140
|
dependency: boxWith(() => dependsOn?.()),
|
|
143
141
|
onDependencyReset: (dependency) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" generics="TItem extends ComboboxItem">
|
|
2
2
|
import { Icon } from '../../../atomic/icons/index.js';
|
|
3
3
|
import { SELECTION_TYPE } from '../../../internal/constants/selection-type.js';
|
|
4
|
-
import { noop } from '../../../internal/utils/common.js';
|
|
4
|
+
import { noop, noopPromise } from '../../../internal/utils/common.js';
|
|
5
5
|
import { Combobox as ComboboxPrimitive } from '../../../primitives/combobox/index.js';
|
|
6
6
|
import { Kbd } from '../../../primitives/kbd/index.js';
|
|
7
7
|
import { boxWith } from 'svelte-toolbelt';
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
label: labelSnippet,
|
|
43
43
|
createLabel = (inputValue) => `Create "${inputValue}"`,
|
|
44
44
|
isCreatable = defaultIsCreatable,
|
|
45
|
-
onCreate,
|
|
45
|
+
onCreate = noopPromise,
|
|
46
46
|
onSelect = noop,
|
|
47
47
|
...restProps
|
|
48
48
|
}: ComboboxCreatableProps<TItem> = $props();
|
|
@@ -53,7 +53,7 @@ export type ComboboxProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxS
|
|
|
53
53
|
type ComboboxCreatableBaseProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxBaseProps<TItem> & {
|
|
54
54
|
createLabel?: (inputValue: string) => string;
|
|
55
55
|
isCreatable?: (inputValue: string, items: TItem[]) => boolean;
|
|
56
|
-
onCreate
|
|
56
|
+
onCreate?: (inputValue: string) => TItem | Promise<TItem>;
|
|
57
57
|
};
|
|
58
58
|
export type ComboboxCreatableSingleProps<TItem extends ComboboxItem = ComboboxItem> = ComboboxCreatableBaseProps<TItem> & {
|
|
59
59
|
type: typeof SELECTION_TYPE.SINGLE;
|
|
@@ -79,20 +79,9 @@ export type ComboboxAsyncLoadResult<TItem extends ComboboxItem> = {
|
|
|
79
79
|
hasMore: boolean;
|
|
80
80
|
};
|
|
81
81
|
export type ComboboxAsyncLoader<TItem extends ComboboxItem = ComboboxItem> = (params: ComboboxAsyncLoadParams) => Promise<ComboboxAsyncLoadResult<TItem>>;
|
|
82
|
-
/** @deprecated Use ComboboxAsyncLoadParams instead. */
|
|
83
|
-
export type ComboboxAsyncCallbackParams = ComboboxAsyncLoadParams;
|
|
84
|
-
/** @deprecated Use ComboboxAsyncLoadResult instead. */
|
|
85
|
-
export type ComboboxAsyncCallbackResult<TItem extends ComboboxItem> = ComboboxAsyncLoadResult<TItem>;
|
|
86
|
-
/** @deprecated Use ComboboxAsyncLoader instead. */
|
|
87
|
-
export type ComboboxAsyncCallback<TItem extends ComboboxItem = ComboboxItem> = ComboboxAsyncLoader<TItem>;
|
|
88
82
|
type ComboboxAsyncLoadProp<TItem extends ComboboxItem> = {
|
|
89
83
|
/** Preferred async loader API */
|
|
90
84
|
loadItems: ComboboxAsyncLoader<TItem>;
|
|
91
|
-
callback?: never;
|
|
92
|
-
} | {
|
|
93
|
-
/** @deprecated Use loadItems instead. Kept for backwards compatibility. */
|
|
94
|
-
callback: ComboboxAsyncLoader<TItem>;
|
|
95
|
-
loadItems?: never;
|
|
96
85
|
};
|
|
97
86
|
type ComboboxAsyncBaseProps<TItem extends ComboboxItem> = Omit<ComboboxBaseProps<TItem>, 'items' | 'item' | 'onSelect'> & ComboboxAsyncLoadProp<TItem> & {
|
|
98
87
|
items?: TItem[];
|
|
@@ -109,8 +98,6 @@ type ComboboxAsyncBaseProps<TItem extends ComboboxItem> = Omit<ComboboxBaseProps
|
|
|
109
98
|
groups?: CommandGroup[];
|
|
110
99
|
/** Preferred name */
|
|
111
100
|
debounceMs?: number;
|
|
112
|
-
/** @deprecated Use debounceMs instead. */
|
|
113
|
-
searchDebounce?: number;
|
|
114
101
|
dependsOn?: () => unknown;
|
|
115
102
|
clearOnDependencyChange?: boolean;
|
|
116
103
|
onDependencyChange?: (value: unknown) => void;
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
export * from './app-shell/index.js';
|
|
2
|
-
export * from './button/index.js';
|
|
3
2
|
export * from './badge/index.js';
|
|
4
3
|
export * from './breadcrumb/index.js';
|
|
5
4
|
export * from './button-group/index.js';
|
|
5
|
+
export * from './button/index.js';
|
|
6
|
+
export * from './calendar/index.js';
|
|
6
7
|
export * from './checkbox/index.js';
|
|
7
8
|
export * from './chip/index.js';
|
|
8
9
|
export * from './collapsible/index.js';
|
|
9
10
|
export * from './combobox/index.js';
|
|
10
11
|
export * from './command/index.js';
|
|
12
|
+
export * from './date-picker/index.js';
|
|
11
13
|
export * from './dialog/index.js';
|
|
12
14
|
export * from './drawer/index.js';
|
|
13
15
|
export * from './dropdown/index.js';
|
|
14
16
|
export * from './field/index.js';
|
|
15
17
|
export * from './file-upload/index.js';
|
|
16
|
-
export * from './input/index.js';
|
|
17
18
|
export * from './input-password/index.js';
|
|
19
|
+
export * from './input/index.js';
|
|
18
20
|
export * from './kbd/index.js';
|
|
19
21
|
export * from './navigation/index.js';
|
|
20
22
|
export * from './number-input/index.js';
|
|
21
23
|
export * from './pagination/index.js';
|
|
22
24
|
export * from './pill/index.js';
|
|
23
25
|
export * from './popover/index.js';
|
|
24
|
-
export * from './separator/index.js';
|
|
25
26
|
export * from './segment/index.js';
|
|
26
27
|
export * from './select/index.js';
|
|
28
|
+
export * from './separator/index.js';
|
|
27
29
|
export * from './skeleton/index.js';
|
|
28
30
|
export * from './slider/index.js';
|
|
29
31
|
export * from './spinner/index.js';
|
package/dist/primitives/index.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
export * from './app-shell/index.js';
|
|
2
|
-
export * from './button/index.js';
|
|
3
2
|
export * from './badge/index.js';
|
|
4
3
|
export * from './breadcrumb/index.js';
|
|
5
4
|
export * from './button-group/index.js';
|
|
5
|
+
export * from './button/index.js';
|
|
6
|
+
export * from './calendar/index.js';
|
|
6
7
|
export * from './checkbox/index.js';
|
|
7
8
|
export * from './chip/index.js';
|
|
8
9
|
export * from './collapsible/index.js';
|
|
9
10
|
export * from './combobox/index.js';
|
|
10
11
|
export * from './command/index.js';
|
|
12
|
+
export * from './date-picker/index.js';
|
|
11
13
|
export * from './dialog/index.js';
|
|
12
14
|
export * from './drawer/index.js';
|
|
13
15
|
export * from './dropdown/index.js';
|
|
14
16
|
export * from './field/index.js';
|
|
15
17
|
export * from './file-upload/index.js';
|
|
16
|
-
export * from './input/index.js';
|
|
17
18
|
export * from './input-password/index.js';
|
|
19
|
+
export * from './input/index.js';
|
|
18
20
|
export * from './kbd/index.js';
|
|
19
21
|
export * from './navigation/index.js';
|
|
20
22
|
export * from './number-input/index.js';
|
|
21
23
|
export * from './pagination/index.js';
|
|
22
24
|
export * from './pill/index.js';
|
|
23
25
|
export * from './popover/index.js';
|
|
24
|
-
export * from './separator/index.js';
|
|
25
26
|
export * from './segment/index.js';
|
|
26
27
|
export * from './select/index.js';
|
|
28
|
+
export * from './separator/index.js';
|
|
27
29
|
export * from './skeleton/index.js';
|
|
28
30
|
export * from './slider/index.js';
|
|
29
31
|
export * from './spinner/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casinogate/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"svelte": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -341,6 +341,16 @@
|
|
|
341
341
|
"svelte": "./dist/primitives/toast/index.js",
|
|
342
342
|
"default": "./dist/primitives/toast/index.js"
|
|
343
343
|
},
|
|
344
|
+
"./primitives/date-picker": {
|
|
345
|
+
"types": "./dist/primitives/date-picker/index.d.ts",
|
|
346
|
+
"svelte": "./dist/primitives/date-picker/index.js",
|
|
347
|
+
"default": "./dist/primitives/date-picker/index.js"
|
|
348
|
+
},
|
|
349
|
+
"./primitives/calendar": {
|
|
350
|
+
"types": "./dist/primitives/calendar/index.d.ts",
|
|
351
|
+
"svelte": "./dist/primitives/calendar/index.js",
|
|
352
|
+
"default": "./dist/primitives/calendar/index.js"
|
|
353
|
+
},
|
|
344
354
|
"./composed": {
|
|
345
355
|
"types": "./dist/composed/index.d.ts",
|
|
346
356
|
"svelte": "./dist/composed/index.js",
|
|
@@ -440,6 +450,16 @@
|
|
|
440
450
|
"types": "./dist/composed/toast/index.d.ts",
|
|
441
451
|
"svelte": "./dist/composed/toast/index.js",
|
|
442
452
|
"default": "./dist/composed/toast/index.js"
|
|
453
|
+
},
|
|
454
|
+
"./composed/calendar": {
|
|
455
|
+
"types": "./dist/composed/calendar/index.d.ts",
|
|
456
|
+
"svelte": "./dist/composed/calendar/index.js",
|
|
457
|
+
"default": "./dist/composed/calendar/index.js"
|
|
458
|
+
},
|
|
459
|
+
"./composed/date-picker": {
|
|
460
|
+
"types": "./dist/composed/date-picker/index.d.ts",
|
|
461
|
+
"svelte": "./dist/composed/date-picker/index.js",
|
|
462
|
+
"default": "./dist/composed/date-picker/index.js"
|
|
443
463
|
}
|
|
444
464
|
},
|
|
445
465
|
"files": [
|