@casinogate/ui 1.7.0 → 1.8.0
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 +43 -4
- package/dist/components/breadcrumb/breadcrumb.svelte +2 -2
- package/dist/components/breadcrumb/types.d.ts +2 -2
- package/dist/components/button/styles.d.ts +15 -0
- package/dist/components/button/styles.js +9 -4
- package/dist/components/button-group/components/button-group.root.svelte +1 -3
- package/dist/components/collapsible/components/collapsaible.svelte.js +3 -3
- package/dist/components/data-table/data-table.svelte +1 -1
- package/dist/components/data-table/utils/pagination-state.svelte.js +3 -3
- package/dist/components/data-table/utils/resize-state.svelte.js +3 -3
- package/dist/components/data-table/utils/row-selection-state.svelte.js +3 -3
- package/dist/components/dialog/components/dialog.overlay.svelte +1 -7
- package/dist/components/dropdown/components/dropdown.content.svelte +0 -2
- package/dist/components/dropdown/dropdown.svelte +127 -67
- package/dist/components/dropdown/dropdown.svelte.d.ts +3 -2
- package/dist/components/dropdown/exports.d.ts +1 -1
- package/dist/components/dropdown/exports.js +1 -1
- package/dist/components/dropdown/index.d.ts +1 -1
- package/dist/components/dropdown/styles.js +5 -3
- package/dist/components/dropdown/types.d.ts +47 -23
- package/dist/components/field/field.svelte +0 -1
- package/dist/components/segment/components/segment.root.svelte +2 -1
- package/dist/components/segment/components/segmet.svelte.d.ts +0 -1
- package/dist/components/segment/components/segmet.svelte.js +0 -1
- package/dist/components/segment/styles.d.ts +18 -0
- package/dist/components/segment/styles.js +7 -1
- package/dist/components/select/components/select.content.svelte +2 -4
- package/dist/components/select/components/select.group-heading.svelte +2 -4
- package/dist/components/select/components/select.group-heading.svelte.d.ts +2 -2
- package/dist/components/select/components/select.group.svelte.d.ts +2 -2
- package/dist/components/select/components/select.item.svelte +5 -13
- package/dist/components/select/components/select.item.svelte.d.ts +2 -2
- package/dist/components/select/components/select.root.svelte +1 -17
- package/dist/components/select/components/select.root.svelte.d.ts +1 -2
- package/dist/components/select/components/select.trigger.svelte +17 -5
- package/dist/components/select/components/select.viewport.svelte +2 -4
- package/dist/components/select/components/select.viewport.svelte.d.ts +2 -2
- package/dist/components/select/exports.d.ts +1 -1
- package/dist/components/select/exports.js +1 -1
- package/dist/components/select/select.async.svelte +146 -83
- package/dist/components/select/select.async.svelte.d.ts +1 -1
- package/dist/components/select/select.svelte +107 -62
- package/dist/components/select/select.svelte.d.ts +4 -2
- package/dist/components/select/styles.d.ts +48 -139
- package/dist/components/select/styles.js +74 -101
- package/dist/components/select/types.d.ts +69 -29
- package/dist/components/select/types.js +0 -1
- package/dist/components/select/utils/get-item-key.d.ts +1 -1
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/lib/collection/grid-collection.d.ts +3 -0
- package/dist/internal/lib/collection/grid-collection.js +2 -0
- package/dist/internal/lib/collection/index.d.ts +5 -0
- package/dist/internal/lib/collection/index.js +5 -0
- package/dist/internal/lib/collection/list-collection.d.ts +3 -0
- package/dist/internal/lib/collection/list-collection.js +2 -0
- package/dist/internal/lib/collection/tree-collection.d.ts +4 -0
- package/dist/internal/lib/collection/tree-collection.js +3 -0
- package/dist/internal/lib/collection/use-list-collection.svelte.d.ts +88 -0
- package/dist/internal/lib/collection/use-list-collection.svelte.js +94 -0
- package/dist/internal/lib/collection/use-list-selection.svelte.d.ts +92 -0
- package/dist/internal/lib/collection/use-list-selection.svelte.js +80 -0
- package/dist/internal/lib/index.d.ts +1 -0
- package/dist/internal/lib/index.js +1 -0
- package/dist/internal/utils/equal.d.ts +3 -0
- package/dist/internal/utils/equal.js +56 -0
- package/dist/internal/utils/functions.d.ts +2 -0
- package/dist/internal/utils/functions.js +4 -0
- package/dist/internal/utils/guard.d.ts +5 -0
- package/dist/internal/utils/guard.js +5 -0
- package/package.json +5 -3
- package/dist/components/app-shell/app-shell.stories.svelte +0 -107
- package/dist/components/app-shell/app-shell.stories.svelte.d.ts +0 -18
- package/dist/components/badge/badge.stories.svelte +0 -81
- package/dist/components/badge/badge.stories.svelte.d.ts +0 -19
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +0 -67
- package/dist/components/breadcrumb/breadcrumb.stories.svelte.d.ts +0 -4
- package/dist/components/button/button.stories.svelte +0 -106
- package/dist/components/button/button.stories.svelte.d.ts +0 -19
- package/dist/components/button-group/button-group.stories.svelte +0 -59
- package/dist/components/button-group/button-group.stories.svelte.d.ts +0 -18
- package/dist/components/checkbox/checkbox.stories.svelte +0 -52
- package/dist/components/checkbox/checkbox.stories.svelte.d.ts +0 -18
- package/dist/components/collapsible/collapsible.stories.svelte +0 -69
- package/dist/components/collapsible/collapsible.stories.svelte.d.ts +0 -18
- package/dist/components/data-table/data-table.stories.svelte +0 -327
- package/dist/components/data-table/data-table.stories.svelte.d.ts +0 -4
- package/dist/components/dialog/dialog.stories.svelte +0 -116
- package/dist/components/dialog/dialog.stories.svelte.d.ts +0 -3
- package/dist/components/dropdown/dropdown.stories.svelte +0 -151
- package/dist/components/dropdown/dropdown.stories.svelte.d.ts +0 -19
- package/dist/components/field/field.stories.svelte +0 -56
- package/dist/components/field/field.stories.svelte.d.ts +0 -19
- package/dist/components/input/input.stories.svelte +0 -41
- package/dist/components/input/input.stories.svelte.d.ts +0 -19
- package/dist/components/navigation/navigation.stories.svelte +0 -99
- package/dist/components/navigation/navigation.stories.svelte.d.ts +0 -19
- package/dist/components/pagination/pagination.stories.svelte +0 -69
- package/dist/components/pagination/pagination.stories.svelte.d.ts +0 -19
- package/dist/components/popover/popover.stories.svelte +0 -195
- package/dist/components/popover/popover.stories.svelte.d.ts +0 -3
- package/dist/components/segment/segment.stories.svelte +0 -57
- package/dist/components/segment/segment.stories.svelte.d.ts +0 -19
- package/dist/components/select/select.stories.svelte +0 -263
- package/dist/components/select/select.stories.svelte.d.ts +0 -4
- package/dist/components/separator/separator.stories.svelte +0 -44
- package/dist/components/separator/separator.stories.svelte.d.ts +0 -19
- package/dist/components/skeleton/skeleton.stories.svelte +0 -129
- package/dist/components/skeleton/skeleton.stories.svelte.d.ts +0 -19
- package/dist/components/spinner/spinner.stories.svelte +0 -29
- package/dist/components/spinner/spinner.stories.svelte.d.ts +0 -19
- package/dist/components/switch/switch.stories.svelte +0 -55
- package/dist/components/switch/switch.stories.svelte.d.ts +0 -19
- package/dist/components/textarea/textarea.stories.svelte +0 -36
- package/dist/components/textarea/textarea.stories.svelte.d.ts +0 -19
- package/dist/components/toast/toast.stories.svelte +0 -96
- package/dist/components/toast/toast.stories.svelte.d.ts +0 -19
- package/dist/internal/utils/arrays.d.ts +0 -1
- package/dist/internal/utils/arrays.js +0 -30
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ListCollection } from '../../internal/lib/collection/index.js';
|
|
1
2
|
import type { DropdownMenuContentProps as DropdownMenuContentPropsPrimitive, DropdownMenuGroupHeadingProps as DropdownMenuGroupHeadingPropsPrimitive, DropdownMenuGroupProps as DropdownMenuGroupPropsPrimitive, DropdownMenuItemProps as DropdownMenuItemPropsPrimitive, DropdownMenuPortalProps as DropdownMenuPortalPropsPrimitive, DropdownMenuRootProps as DropdownMenuRootPropsPrimitive, DropdownMenuSeparatorProps as DropdownMenuSeparatorPropsPrimitive, DropdownMenuSubContentProps as DropdownMenuSubContentPropsPrimitive, DropdownMenuSubProps as DropdownMenuSubPropsPrimitive, DropdownMenuSubTriggerProps as DropdownMenuSubTriggerPropsPrimitive, DropdownMenuTriggerProps as DropdownMenuTriggerPropsPrimitive } from 'bits-ui';
|
|
2
|
-
import type { ExtractPrimitiveEvents
|
|
3
|
+
import type { ExtractPrimitiveEvents } from '../../internal/types/html-attributes.js';
|
|
3
4
|
import type { Component, Snippet } from 'svelte';
|
|
4
5
|
import type { DropdownContentVariantsProps, DropdownGroupHeadingVariantsProps, DropdownGroupVariantsProps, DropdownItemVariantsProps, DropdownSeparatorVariantsProps, DropdownSubContentVariantsProps, DropdownSubTriggerVariantsProps, DropdownTriggerVariantsProps } from './styles.js';
|
|
5
6
|
export type DropdownRootProps = DropdownMenuRootPropsPrimitive;
|
|
@@ -13,50 +14,73 @@ export type DropdownSubContentProps = DropdownMenuSubContentPropsPrimitive & Dro
|
|
|
13
14
|
export type DropdownPortalProps = DropdownMenuPortalPropsPrimitive;
|
|
14
15
|
export type DropdownGroupHeadingProps = DropdownMenuGroupHeadingPropsPrimitive & DropdownGroupHeadingVariantsProps;
|
|
15
16
|
export type DropdownSeparatorProps = DropdownMenuSeparatorPropsPrimitive & DropdownSeparatorVariantsProps;
|
|
16
|
-
export type
|
|
17
|
-
|
|
17
|
+
export type DropdownItemEvents = ExtractPrimitiveEvents<DropdownItemProps>;
|
|
18
|
+
export type DropdownItemBase = {
|
|
19
|
+
/** Unique identifier for the item */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Display label */
|
|
18
22
|
label: string;
|
|
23
|
+
/** Optional icon component */
|
|
19
24
|
icon?: Component<{
|
|
20
25
|
width?: number;
|
|
21
26
|
height?: number;
|
|
22
27
|
}>;
|
|
28
|
+
/** Whether the item is disabled */
|
|
23
29
|
disabled?: boolean;
|
|
24
|
-
|
|
30
|
+
/** Text value for typeahead (defaults to label if not provided) */
|
|
25
31
|
textValue?: string;
|
|
32
|
+
/** Group key for grouping items */
|
|
33
|
+
group?: string;
|
|
34
|
+
/** Called when item is selected */
|
|
35
|
+
onSelect?: () => void;
|
|
36
|
+
/** Whether to close dropdown on select (default: true) */
|
|
26
37
|
closeOnSelect?: boolean;
|
|
27
38
|
};
|
|
28
|
-
export type
|
|
39
|
+
export type DropdownItemAction = DropdownItemBase & DropdownItemEvents & {
|
|
40
|
+
type: 'action';
|
|
41
|
+
};
|
|
42
|
+
export type DropdownItemLink = DropdownItemBase & DropdownItemEvents & {
|
|
29
43
|
type: 'link';
|
|
30
44
|
href: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
46
|
+
rel?: string;
|
|
47
|
+
};
|
|
48
|
+
export type DropdownItemSeparator = {
|
|
49
|
+
key: string;
|
|
50
|
+
type: 'separator';
|
|
51
|
+
/** Optional group - separator appears at end of this group */
|
|
52
|
+
group?: string;
|
|
53
|
+
};
|
|
54
|
+
export type DropdownItemSub = DropdownItemBase & {
|
|
36
55
|
type: 'sub';
|
|
37
|
-
children:
|
|
56
|
+
children: DropdownItem[];
|
|
38
57
|
};
|
|
39
|
-
export type
|
|
40
|
-
export type
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
58
|
+
export type DropdownItem = DropdownItemAction | DropdownItemLink | DropdownItemSeparator | DropdownItemSub;
|
|
59
|
+
export type DropdownSelectableItem = Exclude<DropdownItem, DropdownItemSeparator>;
|
|
60
|
+
export type DropdownGroup = {
|
|
61
|
+
key: string;
|
|
62
|
+
label?: string;
|
|
63
|
+
/** Sort order (lower = first) */
|
|
64
|
+
order?: number;
|
|
45
65
|
};
|
|
46
|
-
export type
|
|
47
|
-
|
|
48
|
-
|
|
66
|
+
export type DropdownCollectionOptions = {
|
|
67
|
+
items: DropdownItem[];
|
|
68
|
+
/** Group definitions for custom headers/ordering */
|
|
69
|
+
groups?: DropdownGroup[];
|
|
70
|
+
/** Custom group sort (default: by order, then alphabetically) */
|
|
71
|
+
groupSort?: 'asc' | 'desc' | ((a: string, b: string) => number);
|
|
49
72
|
};
|
|
50
|
-
export type
|
|
73
|
+
export type DropdownCollection = ListCollection<DropdownItem>;
|
|
51
74
|
export type DropdownProps = DropdownRootProps & {
|
|
75
|
+
collection: DropdownCollection;
|
|
76
|
+
groups?: DropdownGroup[];
|
|
52
77
|
trigger?: Snippet<[{
|
|
53
78
|
props: Record<string, unknown>;
|
|
54
79
|
}]> | string;
|
|
55
80
|
item?: Snippet<[{
|
|
56
|
-
item:
|
|
81
|
+
item: DropdownSelectableItem;
|
|
57
82
|
props: Record<string, unknown>;
|
|
58
83
|
}]>;
|
|
59
84
|
contentProps?: Omit<DropdownContentProps, 'class' | 'children' | 'child'>;
|
|
60
85
|
contentClass?: string;
|
|
61
|
-
items: DropdownItemValue[];
|
|
62
86
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { WithoutChildrenOrChild } from 'svelte-toolbelt';
|
|
3
2
|
import FieldControl from './components/field.control.svelte';
|
|
4
3
|
import FieldDescription from './components/field.description.svelte';
|
|
5
4
|
import FieldError from './components/field.error.svelte';
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
size = 'md',
|
|
20
20
|
spacingX = 'md',
|
|
21
21
|
onValueChange,
|
|
22
|
+
fullWidth = false,
|
|
22
23
|
...restProps
|
|
23
24
|
}: SegmentRootProps = $props();
|
|
24
25
|
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
disabled: box.with(() => disabled),
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
const variants = $derived(segmentVariants({ variant, rounded, size, spacingX }));
|
|
42
|
+
const variants = $derived(segmentVariants({ variant, rounded, size, spacingX, fullWidth }));
|
|
42
43
|
|
|
43
44
|
SegmentStylesContext.set(box.with(() => variants));
|
|
44
45
|
|
|
@@ -15,7 +15,6 @@ export declare class SegmentRootState {
|
|
|
15
15
|
readonly 'data-disabled': "" | undefined;
|
|
16
16
|
readonly "data-slot": "root";
|
|
17
17
|
};
|
|
18
|
-
registerItem(id: string, value: string): void;
|
|
19
18
|
setValue(value: string): void;
|
|
20
19
|
}
|
|
21
20
|
type SegmentItemStateOpts = WithRefProps<ReadableBoxedValues<{
|
|
@@ -30,6 +30,12 @@ export declare const segmentVariants: import("tailwind-variants").TVReturnType<{
|
|
|
30
30
|
item: string[];
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
fullWidth: {
|
|
34
|
+
true: {
|
|
35
|
+
root: string[];
|
|
36
|
+
item: string[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
33
39
|
spacingX: {
|
|
34
40
|
sm: {
|
|
35
41
|
item: string[];
|
|
@@ -75,6 +81,12 @@ export declare const segmentVariants: import("tailwind-variants").TVReturnType<{
|
|
|
75
81
|
item: string[];
|
|
76
82
|
};
|
|
77
83
|
};
|
|
84
|
+
fullWidth: {
|
|
85
|
+
true: {
|
|
86
|
+
root: string[];
|
|
87
|
+
item: string[];
|
|
88
|
+
};
|
|
89
|
+
};
|
|
78
90
|
spacingX: {
|
|
79
91
|
sm: {
|
|
80
92
|
item: string[];
|
|
@@ -120,6 +132,12 @@ export declare const segmentVariants: import("tailwind-variants").TVReturnType<{
|
|
|
120
132
|
item: string[];
|
|
121
133
|
};
|
|
122
134
|
};
|
|
135
|
+
fullWidth: {
|
|
136
|
+
true: {
|
|
137
|
+
root: string[];
|
|
138
|
+
item: string[];
|
|
139
|
+
};
|
|
140
|
+
};
|
|
123
141
|
spacingX: {
|
|
124
142
|
sm: {
|
|
125
143
|
item: string[];
|
|
@@ -4,7 +4,7 @@ import { Context } from 'runed';
|
|
|
4
4
|
export const segmentVariants = tv({
|
|
5
5
|
slots: {
|
|
6
6
|
root: [
|
|
7
|
-
'cgui:flex cgui:items-center cgui:p-1',
|
|
7
|
+
'cgui:flex cgui:items-center cgui:p-1 cgui:w-fit',
|
|
8
8
|
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
9
9
|
'cgui:data-[disabled=""]:opacity-50 cgui:data-[disabled=""]:cursor-not-allowed cgui:data-[disabled=""]:pointer-events-none',
|
|
10
10
|
],
|
|
@@ -53,6 +53,12 @@ export const segmentVariants = tv({
|
|
|
53
53
|
item: ['cgui:h-11'],
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
|
+
fullWidth: {
|
|
57
|
+
true: {
|
|
58
|
+
root: ['cgui:w-full'],
|
|
59
|
+
item: ['cgui:flex-1'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
56
62
|
spacingX: {
|
|
57
63
|
sm: {
|
|
58
64
|
item: ['cgui:px-2'],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cn } from '../../../internal/utils/common.js';
|
|
3
3
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
4
4
|
import type { Attachment } from 'svelte/attachments';
|
|
5
|
-
import {
|
|
5
|
+
import { selectContentStyles } from '../styles.js';
|
|
6
6
|
import type { SelectContentProps } from '../types.js';
|
|
7
7
|
|
|
8
8
|
let {
|
|
@@ -16,11 +16,9 @@
|
|
|
16
16
|
...restProps
|
|
17
17
|
}: SelectContentProps = $props();
|
|
18
18
|
|
|
19
|
-
const variants = SelectStylesContext.get();
|
|
20
|
-
|
|
21
19
|
const attrs = $derived({
|
|
22
20
|
'data-slot': 'select-content',
|
|
23
|
-
class: cn(
|
|
21
|
+
class: cn(selectContentStyles(), className),
|
|
24
22
|
sideOffset,
|
|
25
23
|
forceMount,
|
|
26
24
|
side,
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { selectGroupHeadingStyles } from '../styles.js';
|
|
3
3
|
import { cn } from '../../../internal/utils/common.js';
|
|
4
4
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
5
5
|
import type { SelectGroupHeadingProps } from '../types.js';
|
|
6
6
|
|
|
7
7
|
let { ref = $bindable(null), class: className, children, ...restProps }: SelectGroupHeadingProps = $props();
|
|
8
|
-
|
|
9
|
-
const variants = SelectStylesContext.get();
|
|
10
8
|
</script>
|
|
11
9
|
|
|
12
10
|
<SelectPrimitive.GroupHeading
|
|
13
11
|
bind:ref
|
|
14
12
|
data-slot="select-group-heading"
|
|
15
|
-
class={cn(
|
|
13
|
+
class={cn(selectGroupHeadingStyles(), className)}
|
|
16
14
|
{...restProps}
|
|
17
15
|
>
|
|
18
16
|
{@render children?.()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Select: import("svelte").Component<
|
|
1
|
+
import type { SelectGroupHeadingProps } from '../types.js';
|
|
2
|
+
declare const Select: import("svelte").Component<SelectGroupHeadingProps, {}, "ref">;
|
|
3
3
|
type Select = ReturnType<typeof Select>;
|
|
4
4
|
export default Select;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Select: import("svelte").Component<
|
|
1
|
+
import type { SelectGroupProps } from '../types.js';
|
|
2
|
+
declare const Select: import("svelte").Component<SelectGroupProps, {}, "ref">;
|
|
3
3
|
type Select = ReturnType<typeof Select>;
|
|
4
4
|
export default Select;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Icon } from '../../icons/index.js';
|
|
3
3
|
import { cn } from '../../../internal/utils/common.js';
|
|
4
4
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
5
|
-
import {
|
|
5
|
+
import { selectItemStyles } from '../styles.js';
|
|
6
6
|
import type { SelectItemProps } from '../types.js';
|
|
7
7
|
|
|
8
8
|
let {
|
|
@@ -10,23 +10,15 @@
|
|
|
10
10
|
class: className,
|
|
11
11
|
value,
|
|
12
12
|
label,
|
|
13
|
-
children:
|
|
13
|
+
children: childrenSnippet,
|
|
14
14
|
...restProps
|
|
15
15
|
}: SelectItemProps = $props();
|
|
16
|
-
|
|
17
|
-
const variants = SelectStylesContext.get();
|
|
18
16
|
</script>
|
|
19
17
|
|
|
20
|
-
<SelectPrimitive.Item
|
|
21
|
-
bind:ref
|
|
22
|
-
{value}
|
|
23
|
-
data-slot="select-item"
|
|
24
|
-
class={cn(variants.current.item(), className)}
|
|
25
|
-
{...restProps}
|
|
26
|
-
>
|
|
18
|
+
<SelectPrimitive.Item bind:ref {value} data-slot="select-item" class={cn(selectItemStyles(), className)} {...restProps}>
|
|
27
19
|
{#snippet children({ selected, highlighted })}
|
|
28
|
-
{#if
|
|
29
|
-
{@render
|
|
20
|
+
{#if childrenSnippet}
|
|
21
|
+
{@render childrenSnippet({ selected, highlighted })}
|
|
30
22
|
{:else}
|
|
31
23
|
{label || value}
|
|
32
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Select: import("svelte").Component<
|
|
1
|
+
import type { SelectItemProps } from '../types.js';
|
|
2
|
+
declare const Select: import("svelte").Component<SelectItemProps, {}, "ref">;
|
|
3
3
|
type Select = ReturnType<typeof Select>;
|
|
4
4
|
export default Select;
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { box } from 'svelte-toolbelt';
|
|
3
|
-
|
|
4
|
-
import { SelectStylesContext, selectVariants } from '../styles.js';
|
|
5
|
-
|
|
6
2
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
7
3
|
import type { SelectRootProps } from '../types.js';
|
|
8
4
|
|
|
9
|
-
let {
|
|
10
|
-
value = $bindable(''),
|
|
11
|
-
open = $bindable(false),
|
|
12
|
-
size = 'md',
|
|
13
|
-
variant = 'primary',
|
|
14
|
-
rounded = 'sm',
|
|
15
|
-
w = 'full',
|
|
16
|
-
...restProps
|
|
17
|
-
}: SelectRootProps = $props();
|
|
18
|
-
|
|
19
|
-
const variants = $derived(selectVariants({ size, variant, rounded, w }));
|
|
20
|
-
|
|
21
|
-
SelectStylesContext.set(box.with(() => variants));
|
|
5
|
+
let { value = $bindable(''), open = $bindable(false), ...restProps }: SelectRootProps = $props();
|
|
22
6
|
</script>
|
|
23
7
|
|
|
24
8
|
<SelectPrimitive.Root bind:value={value as never} bind:open {...restProps} />
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const Select: import("svelte").Component<SelectRootProps, {}, "value" | "open">;
|
|
1
|
+
declare const Select: import("svelte").Component<import("bits-ui").SelectRootPropsWithoutHTML, {}, "value" | "open">;
|
|
3
2
|
type Select = ReturnType<typeof Select>;
|
|
4
3
|
export default Select;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Icon } from '../../icons/index.js';
|
|
3
3
|
import { cn } from '../../../internal/utils/common.js';
|
|
4
4
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
5
|
-
import {
|
|
5
|
+
import { selectTriggerStyles } from '../styles.js';
|
|
6
6
|
import type { SelectTriggerProps } from '../types.js';
|
|
7
7
|
|
|
8
8
|
let {
|
|
@@ -11,14 +11,24 @@
|
|
|
11
11
|
child,
|
|
12
12
|
children,
|
|
13
13
|
hasChevron = true,
|
|
14
|
+
size = 'md',
|
|
15
|
+
variant = 'primary',
|
|
16
|
+
rounded = 'sm',
|
|
17
|
+
fullWidth = true,
|
|
14
18
|
...restProps
|
|
15
19
|
}: SelectTriggerProps = $props();
|
|
16
20
|
|
|
17
|
-
const styles = SelectStylesContext.get();
|
|
18
|
-
|
|
19
21
|
const attrs = $derived({
|
|
20
22
|
'data-slot': 'trigger',
|
|
21
|
-
class: cn(
|
|
23
|
+
class: cn(
|
|
24
|
+
selectTriggerStyles({
|
|
25
|
+
size,
|
|
26
|
+
variant,
|
|
27
|
+
rounded,
|
|
28
|
+
fullWidth,
|
|
29
|
+
}),
|
|
30
|
+
className
|
|
31
|
+
),
|
|
22
32
|
...restProps,
|
|
23
33
|
});
|
|
24
34
|
</script>
|
|
@@ -33,8 +43,10 @@
|
|
|
33
43
|
<span
|
|
34
44
|
data-slot="chevron"
|
|
35
45
|
class={cn(
|
|
46
|
+
'cgui:absolute cgui:top-1/2 cgui:-translate-y-1/2 cgui:right-2',
|
|
36
47
|
'cgui:transition-transform cgui:duration-250 cgui:ease-in-out',
|
|
37
|
-
'cgui:group-data-[state=open]/select-trigger:-rotate-180'
|
|
48
|
+
'cgui:group-data-[state=open]/select-trigger:-rotate-180',
|
|
49
|
+
'cgui:ms-auto'
|
|
38
50
|
)}
|
|
39
51
|
>
|
|
40
52
|
<Icon.ChevronDown width={18} height={18} />
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn } from '../../../internal/utils/common.js';
|
|
3
3
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
4
|
-
import {
|
|
4
|
+
import { selectViewportStyles } from '../styles.js';
|
|
5
5
|
import type { SelectViewportProps } from '../types.js';
|
|
6
6
|
|
|
7
7
|
let { ref = $bindable(null), class: className, children, child, ...restProps }: SelectViewportProps = $props();
|
|
8
8
|
|
|
9
|
-
const variants = SelectStylesContext.get();
|
|
10
|
-
|
|
11
9
|
const attrs = $derived({
|
|
12
10
|
'data-slot': 'select-viewport',
|
|
13
|
-
class: cn(
|
|
11
|
+
class: cn(selectViewportStyles(), className),
|
|
14
12
|
...restProps,
|
|
15
13
|
});
|
|
16
14
|
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Select: import("svelte").Component<
|
|
1
|
+
import type { SelectViewportProps } from '../types.js';
|
|
2
|
+
declare const Select: import("svelte").Component<SelectViewportProps, {}, "ref">;
|
|
3
3
|
type Select = ReturnType<typeof Select>;
|
|
4
4
|
export default Select;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Async } from './select.async.svelte';
|
|
2
|
-
export { default as Root } from './select.svelte';
|
|
2
|
+
export { createSelectCollection, default as Root } from './select.svelte';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Async } from './select.async.svelte';
|
|
2
|
-
export { default as Root } from './select.svelte';
|
|
2
|
+
export { createSelectCollection, default as Root } from './select.svelte';
|