@casinogate/ui 1.9.2 → 1.9.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.
- package/dist/assets/css/root.css +75 -1
- package/dist/assets/css/theme.css +157 -155
- package/dist/components/button/styles.d.ts +18 -0
- package/dist/components/button/styles.js +6 -0
- package/dist/components/combobox/api/create-collection.d.ts +1 -0
- package/dist/components/combobox/api/create-collection.js +2 -0
- package/dist/components/combobox/api/index.d.ts +1 -0
- package/dist/components/combobox/api/index.js +1 -0
- package/dist/components/combobox/combobox.svelte +160 -0
- package/dist/components/combobox/combobox.svelte.d.ts +4 -0
- package/dist/components/combobox/exports.d.ts +1 -0
- package/dist/components/combobox/exports.js +1 -0
- package/dist/components/combobox/index.d.ts +3 -0
- package/dist/components/combobox/index.js +3 -0
- package/dist/components/combobox/styles.d.ts +60 -0
- package/dist/components/combobox/styles.js +49 -0
- package/dist/components/combobox/types.d.ts +22 -0
- package/dist/components/combobox/types.js +1 -0
- package/dist/components/command/api/create-collection.d.ts +2 -0
- package/dist/components/command/api/create-collection.js +25 -0
- package/dist/components/command/api/index.d.ts +1 -0
- package/dist/components/command/api/index.js +1 -0
- package/dist/components/command/command.svelte +94 -0
- package/dist/components/command/command.svelte.d.ts +4 -0
- package/dist/components/command/components/command.empty.svelte +15 -0
- package/dist/components/command/components/command.empty.svelte.d.ts +4 -0
- package/dist/components/command/components/command.group-heading.svelte +10 -0
- package/dist/components/command/components/command.group-heading.svelte.d.ts +4 -0
- package/dist/components/command/components/command.group-items.svelte +8 -0
- package/dist/components/command/components/command.group-items.svelte.d.ts +4 -0
- package/dist/components/command/components/command.group.svelte +23 -0
- package/dist/components/command/components/command.group.svelte.d.ts +4 -0
- package/dist/components/command/components/command.input.svelte +23 -0
- package/dist/components/command/components/command.input.svelte.d.ts +4 -0
- package/dist/components/command/components/command.item.svelte +10 -0
- package/dist/components/command/components/command.item.svelte.d.ts +4 -0
- package/dist/components/command/components/command.list.svelte +16 -0
- package/dist/components/command/components/command.list.svelte.d.ts +4 -0
- package/dist/components/command/components/command.loading.svelte +8 -0
- package/dist/components/command/components/command.loading.svelte.d.ts +4 -0
- package/dist/components/command/components/command.root.svelte +26 -0
- package/dist/components/command/components/command.root.svelte.d.ts +4 -0
- package/dist/components/command/components/command.viewport.svelte +8 -0
- package/dist/components/command/components/command.viewport.svelte.d.ts +4 -0
- package/dist/components/command/exports-primitive.d.ts +12 -0
- package/dist/components/command/exports-primitive.js +12 -0
- package/dist/components/command/exports.d.ts +1 -0
- package/dist/components/command/exports.js +1 -0
- package/dist/components/command/index.d.ts +4 -0
- package/dist/components/command/index.js +4 -0
- package/dist/components/command/styles.d.ts +81 -0
- package/dist/components/command/styles.js +69 -0
- package/dist/components/command/types.d.ts +64 -0
- package/dist/components/command/types.js +1 -0
- package/dist/components/icons/exports.d.ts +2 -0
- package/dist/components/icons/exports.js +2 -0
- package/dist/components/icons/magnifier.svelte +12 -0
- package/dist/components/icons/magnifier.svelte.d.ts +3 -0
- package/dist/components/icons/plus.svelte +9 -0
- package/dist/components/icons/plus.svelte.d.ts +3 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/kbd/components/kbd.group.svelte +11 -0
- package/dist/components/kbd/components/kbd.group.svelte.d.ts +4 -0
- package/dist/components/kbd/components/kbd.root.svelte +20 -0
- package/dist/components/kbd/components/kbd.root.svelte.d.ts +4 -0
- package/dist/components/kbd/exports.d.ts +2 -0
- package/dist/components/kbd/exports.js +2 -0
- package/dist/components/kbd/index.d.ts +2 -0
- package/dist/components/kbd/index.js +2 -0
- package/dist/components/kbd/styles.d.ts +5 -0
- package/dist/components/kbd/styles.js +12 -0
- package/dist/components/kbd/types.d.ts +8 -0
- package/dist/components/kbd/types.js +1 -0
- package/dist/components/number-input/components/number-input.root.svelte +102 -0
- package/dist/components/number-input/components/number-input.root.svelte.d.ts +4 -0
- package/dist/components/number-input/exports.d.ts +1 -0
- package/dist/components/number-input/exports.js +1 -0
- package/dist/components/number-input/index.d.ts +2 -0
- package/dist/components/number-input/index.js +2 -0
- package/dist/components/number-input/types.d.ts +9 -0
- package/dist/components/number-input/types.js +1 -0
- package/dist/components/popover/index.d.ts +1 -1
- package/dist/components/select/select.async.svelte +28 -5
- package/dist/components/select/select.svelte +4 -1
- package/dist/components/select/styles.d.ts +1 -1
- package/dist/components/select/styles.js +6 -7
- package/dist/components/select/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Command as CommandPrimitive } from 'bits-ui';
|
|
3
|
+
import type { CommandViewportProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
let { ref = $bindable(null), ...restProps }: CommandViewportProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<CommandPrimitive.Viewport bind:ref data-slot="command-viewport" {...restProps} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Separator } from '../separator/index.js';
|
|
2
|
+
export { default as Empty } from './components/command.empty.svelte';
|
|
3
|
+
export { default as GroupHeading } from './components/command.group-heading.svelte';
|
|
4
|
+
export { default as GroupItems } from './components/command.group-items.svelte';
|
|
5
|
+
export { default as Group } from './components/command.group.svelte';
|
|
6
|
+
export { default as Input } from './components/command.input.svelte';
|
|
7
|
+
export { default as Item } from './components/command.item.svelte';
|
|
8
|
+
export { default as List } from './components/command.list.svelte';
|
|
9
|
+
export { default as Loading } from './components/command.loading.svelte';
|
|
10
|
+
export { default as Root } from './components/command.root.svelte';
|
|
11
|
+
export { default as Viewport } from './components/command.viewport.svelte';
|
|
12
|
+
export { Separator };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Separator } from '../separator/index.js';
|
|
2
|
+
export { default as Empty } from './components/command.empty.svelte';
|
|
3
|
+
export { default as GroupHeading } from './components/command.group-heading.svelte';
|
|
4
|
+
export { default as GroupItems } from './components/command.group-items.svelte';
|
|
5
|
+
export { default as Group } from './components/command.group.svelte';
|
|
6
|
+
export { default as Input } from './components/command.input.svelte';
|
|
7
|
+
export { default as Item } from './components/command.item.svelte';
|
|
8
|
+
export { default as List } from './components/command.list.svelte';
|
|
9
|
+
export { default as Loading } from './components/command.loading.svelte';
|
|
10
|
+
export { default as Root } from './components/command.root.svelte';
|
|
11
|
+
export { default as Viewport } from './components/command.viewport.svelte';
|
|
12
|
+
export { Separator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Root } from './command.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Root } from './command.svelte';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const commandRootVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
rounded: {
|
|
4
|
+
default: string[];
|
|
5
|
+
sm: string[];
|
|
6
|
+
lg: string[];
|
|
7
|
+
xl: string[];
|
|
8
|
+
clean: string[];
|
|
9
|
+
};
|
|
10
|
+
border: {
|
|
11
|
+
true: string[];
|
|
12
|
+
};
|
|
13
|
+
shadow: {
|
|
14
|
+
true: string[];
|
|
15
|
+
};
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
rounded: string;
|
|
18
|
+
shadow: boolean;
|
|
19
|
+
};
|
|
20
|
+
}, undefined, string[], {
|
|
21
|
+
rounded: {
|
|
22
|
+
default: string[];
|
|
23
|
+
sm: string[];
|
|
24
|
+
lg: string[];
|
|
25
|
+
xl: string[];
|
|
26
|
+
clean: string[];
|
|
27
|
+
};
|
|
28
|
+
border: {
|
|
29
|
+
true: string[];
|
|
30
|
+
};
|
|
31
|
+
shadow: {
|
|
32
|
+
true: string[];
|
|
33
|
+
};
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
rounded: string;
|
|
36
|
+
shadow: boolean;
|
|
37
|
+
};
|
|
38
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
39
|
+
rounded: {
|
|
40
|
+
default: string[];
|
|
41
|
+
sm: string[];
|
|
42
|
+
lg: string[];
|
|
43
|
+
xl: string[];
|
|
44
|
+
clean: string[];
|
|
45
|
+
};
|
|
46
|
+
border: {
|
|
47
|
+
true: string[];
|
|
48
|
+
};
|
|
49
|
+
shadow: {
|
|
50
|
+
true: string[];
|
|
51
|
+
};
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
rounded: string;
|
|
54
|
+
shadow: boolean;
|
|
55
|
+
};
|
|
56
|
+
}, undefined, string[], unknown, unknown, undefined>>;
|
|
57
|
+
export declare const commandInputVariants: import("tailwind-variants").TVReturnType<{}, {
|
|
58
|
+
wrapper: string[];
|
|
59
|
+
icon: string[];
|
|
60
|
+
input: string[];
|
|
61
|
+
}, undefined, {}, {
|
|
62
|
+
wrapper: string[];
|
|
63
|
+
icon: string[];
|
|
64
|
+
input: string[];
|
|
65
|
+
}, import("tailwind-variants").TVReturnType<{}, {
|
|
66
|
+
wrapper: string[];
|
|
67
|
+
icon: string[];
|
|
68
|
+
input: string[];
|
|
69
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
70
|
+
export declare const commandListVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
71
|
+
export declare const commandGroupVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
72
|
+
export declare const commandGroupHeadingVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
73
|
+
export declare const commandItemVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
74
|
+
export declare const commandEmptyVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
75
|
+
export type CommandRootVariantProps = VariantProps<typeof commandRootVariants>;
|
|
76
|
+
export type CommandInputVariantProps = VariantProps<typeof commandInputVariants>;
|
|
77
|
+
export type CommandListVariantProps = VariantProps<typeof commandListVariants>;
|
|
78
|
+
export type CommandGroupVariantProps = VariantProps<typeof commandGroupVariants>;
|
|
79
|
+
export type CommandGroupHeadingVariantProps = VariantProps<typeof commandGroupHeadingVariants>;
|
|
80
|
+
export type CommandItemVariantProps = VariantProps<typeof commandItemVariants>;
|
|
81
|
+
export type CommandEmptyVariantProps = VariantProps<typeof commandEmptyVariants>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
2
|
+
export const commandRootVariants = tv({
|
|
3
|
+
base: ['cgui:text-fg-dark cgui:bg-surface-white cgui:flex cgui:size-full cgui:flex-col cgui:overflow-hidden'],
|
|
4
|
+
variants: {
|
|
5
|
+
rounded: {
|
|
6
|
+
default: ['cgui:rounded-md'],
|
|
7
|
+
sm: ['cgui:rounded-sm'],
|
|
8
|
+
lg: ['cgui:rounded-lg'],
|
|
9
|
+
xl: ['cgui:rounded-xl'],
|
|
10
|
+
clean: [''],
|
|
11
|
+
},
|
|
12
|
+
border: {
|
|
13
|
+
true: ['cgui:border cgui:border-stroke-default'],
|
|
14
|
+
},
|
|
15
|
+
shadow: {
|
|
16
|
+
true: ['cgui:shadow-popover'],
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
rounded: 'default',
|
|
20
|
+
shadow: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
export const commandInputVariants = tv({
|
|
25
|
+
slots: {
|
|
26
|
+
wrapper: [
|
|
27
|
+
'cgui:flex cgui:h-9 cgui:items-center cgui:gap-2 cgui:pe-8 cgui:ps-3',
|
|
28
|
+
'cgui:border-b cgui:border-stroke-divider cgui:rounded-inherit',
|
|
29
|
+
],
|
|
30
|
+
icon: [
|
|
31
|
+
'cgui:shrink-0 cgui:size-4 cgui:flex cgui:items-center cgui:opacity-50 cgui:justify-center cgui:select-none',
|
|
32
|
+
],
|
|
33
|
+
input: [
|
|
34
|
+
'cgui:flex cgui:h-10 cgui:items-center cgui:rounded-inherit cgui:py-2 cgui:px-0',
|
|
35
|
+
'cgui:outline-none cgui:bg-transparent cgui:shadow-none cgui:text-fg-dark cgui:border-none cgui:text-body',
|
|
36
|
+
'cgui:placeholder:text-fg-regular/70',
|
|
37
|
+
'cgui:focus-visible:ring-0 cgui:focus-visible:ring-offset-0',
|
|
38
|
+
'cgui:disabled:opacity-50 cgui:disabled:cursor-not-allowed',
|
|
39
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
variants: {},
|
|
43
|
+
});
|
|
44
|
+
export const commandListVariants = tv({
|
|
45
|
+
base: [
|
|
46
|
+
'cgui:scrollbar-thin cgui:scrollbar-thumb-surface-regular cgui:scrollbar-track-surface-lightest cgui:scrollbar-thumb-rounded-full cgui:scrollbar-track-rounded-full',
|
|
47
|
+
'cgui:max-h-75 cgui:scroll-py-1 cgui:overflow-y-auto cgui:overflow-x-hidden',
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
export const commandGroupVariants = tv({
|
|
51
|
+
base: ['cgui:text-fg-dark cgui:p-1 cgui:overflow-hidden'],
|
|
52
|
+
});
|
|
53
|
+
export const commandGroupHeadingVariants = tv({
|
|
54
|
+
base: ['cgui:text-fg-semilight cgui:px-2 cgui:py-1.5 cgui:text-caption cgui:font-medium'],
|
|
55
|
+
});
|
|
56
|
+
export const commandItemVariants = tv({
|
|
57
|
+
base: [
|
|
58
|
+
'cgui:flex cgui:items-center cgui:gap-2 cgui:px-2 cgui:py-1.5',
|
|
59
|
+
'cgui:aria-selected:bg-surface-lightest cgui:aria-selected:text-fg-primary',
|
|
60
|
+
'cgui:cursor-default cgui:text-body cgui:select-none cgui:outline-hidden cgui:rounded-xs',
|
|
61
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
62
|
+
'cgui:[&_svg:not([class*="text-"])]:text-muted-foreground cgui:relative',
|
|
63
|
+
'cgui:[&_kbd]:ml-auto',
|
|
64
|
+
'cgui:data-[disabled]:pointer-events-none cgui:data-[disabled]:opacity-50 cgui:[&_svg]:pointer-events-none cgui:[&_svg]:shrink-0 cgui:[&_svg:not([class*="size-"])]:size-4',
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
export const commandEmptyVariants = tv({
|
|
68
|
+
base: ['cgui:py-6 cgui:text-center cgui:text-body'],
|
|
69
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ListCollection } from '../../internal/index.js';
|
|
2
|
+
import { Command as CommandPrimitive } from 'bits-ui';
|
|
3
|
+
import type { Component, Snippet } from 'svelte';
|
|
4
|
+
import type { Without, WithoutChildrenOrChild } from 'svelte-toolbelt';
|
|
5
|
+
import type { SeparatorProps } from '../separator/index.js';
|
|
6
|
+
import type { CommandEmptyVariantProps, CommandGroupHeadingVariantProps, CommandGroupVariantProps, CommandInputVariantProps, CommandItemVariantProps, CommandListVariantProps, CommandRootVariantProps } from './styles.js';
|
|
7
|
+
export type CommandRootApi = CommandPrimitive.Root;
|
|
8
|
+
export type CommandRootProps = CommandPrimitive.RootProps & CommandRootVariantProps & {
|
|
9
|
+
api?: CommandRootApi | null;
|
|
10
|
+
};
|
|
11
|
+
export type CommandInputProps = CommandPrimitive.InputProps & CommandInputVariantProps;
|
|
12
|
+
export type CommandListProps = CommandListVariantProps & Without<CommandPrimitive.ListProps, CommandListVariantProps>;
|
|
13
|
+
export type CommandGroupProps = CommandPrimitive.GroupProps & CommandGroupVariantProps;
|
|
14
|
+
export type CommandGroupHeadingProps = CommandPrimitive.GroupHeadingProps & CommandGroupHeadingVariantProps;
|
|
15
|
+
export type CommandGroupItemsProps = CommandPrimitive.GroupItemsProps;
|
|
16
|
+
export type CommandItemProps = CommandPrimitive.ItemProps & CommandItemVariantProps;
|
|
17
|
+
export type CommandEmptyProps = CommandPrimitive.EmptyProps & CommandEmptyVariantProps;
|
|
18
|
+
export type CommandSeparatorProps = SeparatorProps;
|
|
19
|
+
export type CommandViewportProps = CommandPrimitive.ViewportProps;
|
|
20
|
+
export type CommandLoadingProps = CommandPrimitive.LoadingProps;
|
|
21
|
+
export type CommandItem = {
|
|
22
|
+
value: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
keywords?: string[];
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
icon?: Component<{
|
|
27
|
+
width?: number;
|
|
28
|
+
height?: number;
|
|
29
|
+
}>;
|
|
30
|
+
shortcut?: string[];
|
|
31
|
+
class?: string;
|
|
32
|
+
/** Group key for grouping */
|
|
33
|
+
group?: string;
|
|
34
|
+
onSelect?: () => void;
|
|
35
|
+
};
|
|
36
|
+
export type CommandGroup = {
|
|
37
|
+
value: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
order?: number;
|
|
40
|
+
separator?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type CommandCollectionOptions = {
|
|
43
|
+
items: CommandItem[];
|
|
44
|
+
groups?: CommandGroup[];
|
|
45
|
+
groupSort?: 'asc' | 'desc' | ((a: string, b: string) => number);
|
|
46
|
+
};
|
|
47
|
+
export type CommandCollection = ListCollection<CommandItem> & {
|
|
48
|
+
groups: CommandGroup[];
|
|
49
|
+
};
|
|
50
|
+
export type CommandProps = WithoutChildrenOrChild<CommandRootProps> & {
|
|
51
|
+
collection: CommandCollection;
|
|
52
|
+
placeholder?: string;
|
|
53
|
+
searchValue?: string;
|
|
54
|
+
listClass?: string;
|
|
55
|
+
viewportClass?: string;
|
|
56
|
+
item?: Snippet<[{
|
|
57
|
+
item: CommandItem;
|
|
58
|
+
props: Record<string, unknown>;
|
|
59
|
+
}]>;
|
|
60
|
+
empty?: Snippet<[{
|
|
61
|
+
props: Record<string, unknown>;
|
|
62
|
+
}]> | string;
|
|
63
|
+
maxContentHeight?: string;
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Command as CommandPrimitive } from 'bits-ui';
|
|
@@ -17,7 +17,9 @@ export { default as Error } from './error.svelte';
|
|
|
17
17
|
export { default as EyeCrossed } from './eye-crossed.svelte';
|
|
18
18
|
export { default as Eye } from './eye.svelte';
|
|
19
19
|
export { default as Info } from './info.svelte';
|
|
20
|
+
export { default as Magnifier } from './magnifier.svelte';
|
|
20
21
|
export { default as Minus } from './minus.svelte';
|
|
22
|
+
export { default as Plus } from './plus.svelte';
|
|
21
23
|
export { default as SidebarToggle } from './sidebar-toggle.svelte';
|
|
22
24
|
export { default as Slash } from './slash.svelte';
|
|
23
25
|
export { default as Sort } from './sort.svelte';
|
|
@@ -17,7 +17,9 @@ export { default as Error } from './error.svelte';
|
|
|
17
17
|
export { default as EyeCrossed } from './eye-crossed.svelte';
|
|
18
18
|
export { default as Eye } from './eye.svelte';
|
|
19
19
|
export { default as Info } from './info.svelte';
|
|
20
|
+
export { default as Magnifier } from './magnifier.svelte';
|
|
20
21
|
export { default as Minus } from './minus.svelte';
|
|
22
|
+
export { default as Plus } from './plus.svelte';
|
|
21
23
|
export { default as SidebarToggle } from './sidebar-toggle.svelte';
|
|
22
24
|
export { default as Slash } from './slash.svelte';
|
|
23
25
|
export { default as Sort } from './sort.svelte';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { IconProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { width = 24, height = 24, color = 'currentColor', ...props }: IconProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {width} {height} {...props}>
|
|
8
|
+
<path
|
|
9
|
+
d="M5.12241 15.3665C6.36939 16.6149 8.02996 17.3643 9.7913 17.4736C11.5526 17.5828 13.2932 17.0444 14.685 15.9598L19.4739 20.7473C19.6437 20.9113 19.8712 21.002 20.1073 21C20.3434 20.9979 20.5693 20.9032 20.7362 20.7363C20.9032 20.5694 20.9979 20.3436 21 20.1076C21.002 19.8715 20.9113 19.6441 20.7472 19.4743L15.9583 14.6868C17.0914 13.2331 17.6271 11.4019 17.4562 9.56689C17.2852 7.73184 16.4205 6.03109 15.0384 4.81149C13.6563 3.5919 11.8608 2.94532 10.0182 3.00363C8.17559 3.06193 6.42464 3.82073 5.12241 5.12526C4.44955 5.79759 3.91578 6.59586 3.55161 7.47448C3.18744 8.35309 3 9.29483 3 10.2459C3 11.1969 3.18744 12.1387 3.55161 13.0173C3.91578 13.8959 4.44955 14.6942 5.12241 15.3665ZM6.39574 6.40002C7.28596 5.51007 8.4573 4.95623 9.71019 4.83286C10.9631 4.70949 12.22 5.02421 13.2668 5.72341C14.3136 6.42261 15.0855 7.46303 15.451 8.6674C15.8165 9.87177 15.753 11.1656 15.2713 12.3284C14.7896 13.4912 13.9196 14.4511 12.8093 15.0445C11.6991 15.6379 10.4174 15.8281 9.18258 15.5827C7.94779 15.3373 6.83631 14.6714 6.03751 13.6986C5.23872 12.7258 4.80202 11.5063 4.80183 10.2477C4.79936 9.5325 4.93898 8.82395 5.2126 8.16314C5.48621 7.50233 5.88837 6.90242 6.39574 6.39822V6.40002Z"
|
|
10
|
+
fill={color}
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { IconProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { width = 24, height = 24, color = 'currentColor', ...props }: IconProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" {width} {height} {...props}>
|
|
8
|
+
<path fill={color} d="M18 12.998h-5v5a1 1 0 0 1-2 0v-5H6a1 1 0 0 1 0-2h5v-5a1 1 0 0 1 2 0v5h5a1 1 0 0 1 0 2" />
|
|
9
|
+
</svg>
|
|
@@ -5,13 +5,17 @@ export * from './button-group/index.js';
|
|
|
5
5
|
export * from './button/index.js';
|
|
6
6
|
export * from './checkbox/index.js';
|
|
7
7
|
export * from './collapsible/index.js';
|
|
8
|
+
export * from './combobox/index.js';
|
|
9
|
+
export * from './command/index.js';
|
|
8
10
|
export * from './data-table/index.js';
|
|
9
11
|
export * from './dialog/index.js';
|
|
10
12
|
export * from './dropdown/index.js';
|
|
11
13
|
export * from './field/index.js';
|
|
12
14
|
export * from './icons/index.js';
|
|
13
15
|
export * from './input/index.js';
|
|
16
|
+
export * from './kbd/index.js';
|
|
14
17
|
export * from './navigation/index.js';
|
|
18
|
+
export * from './number-input/index.js';
|
|
15
19
|
export * from './pagination/index.js';
|
|
16
20
|
export * from './popover/index.js';
|
|
17
21
|
export * from './segment/index.js';
|
package/dist/components/index.js
CHANGED
|
@@ -5,13 +5,17 @@ export * from './button-group/index.js';
|
|
|
5
5
|
export * from './button/index.js';
|
|
6
6
|
export * from './checkbox/index.js';
|
|
7
7
|
export * from './collapsible/index.js';
|
|
8
|
+
export * from './combobox/index.js';
|
|
9
|
+
export * from './command/index.js';
|
|
8
10
|
export * from './data-table/index.js';
|
|
9
11
|
export * from './dialog/index.js';
|
|
10
12
|
export * from './dropdown/index.js';
|
|
11
13
|
export * from './field/index.js';
|
|
12
14
|
export * from './icons/index.js';
|
|
13
15
|
export * from './input/index.js';
|
|
16
|
+
export * from './kbd/index.js';
|
|
14
17
|
export * from './navigation/index.js';
|
|
18
|
+
export * from './number-input/index.js';
|
|
15
19
|
export * from './pagination/index.js';
|
|
16
20
|
export * from './popover/index.js';
|
|
17
21
|
export * from './segment/index.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/common.js';
|
|
3
|
+
import { kbdGroupVariants } from '../styles.js';
|
|
4
|
+
import type { KbdGroupProps } from '../types.js';
|
|
5
|
+
|
|
6
|
+
let { ref = $bindable(null), class: className, children, ...restProps }: KbdGroupProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<kbd bind:this={ref} data-slot="kbd-group" class={cn(kbdGroupVariants(), className)} {...restProps}>
|
|
10
|
+
{@render children?.()}
|
|
11
|
+
</kbd>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/common.js';
|
|
3
|
+
import { kbdRootVariants } from '../styles.js';
|
|
4
|
+
import type { KbdRootProps } from '../types.js';
|
|
5
|
+
|
|
6
|
+
let { ref = $bindable(null), class: className, children, ...restProps }: KbdRootProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<kbd
|
|
10
|
+
bind:this={ref}
|
|
11
|
+
data-slot="kbd"
|
|
12
|
+
class={cn(
|
|
13
|
+
kbdRootVariants(),
|
|
14
|
+
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</kbd>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const kbdRootVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
3
|
+
export declare const kbdGroupVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
4
|
+
export type KbdRootVariantProps = VariantProps<typeof kbdRootVariants>;
|
|
5
|
+
export type KbdGroupVariantProps = VariantProps<typeof kbdGroupVariants>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
2
|
+
export const kbdRootVariants = tv({
|
|
3
|
+
base: [
|
|
4
|
+
'cgui:px-1 cgui:min-w-5 cgui:h-5 cgui:w-fit',
|
|
5
|
+
'cgui:inline-flex cgui:items-center cgui:justify-center cgui:gap-1 cgui:text-center cgui:overflow-hidden cgui:shrink-0 cgui:w-fit cgui:whitespace-nowrap',
|
|
6
|
+
'cgui:bg-surface-regular cgui:text-fg-white cgui:pointer-events-none cgui:font-sans cgui:text-caption cgui:font-normal cgui:select-none cgui:rounded-xs cgui:border cgui:border-stroke-default',
|
|
7
|
+
'cgui:[&_svg:not([class*="size-"])]:size-3',
|
|
8
|
+
],
|
|
9
|
+
});
|
|
10
|
+
export const kbdGroupVariants = tv({
|
|
11
|
+
base: ['cgui:inline-flex cgui:items-center cgui:gap-1'],
|
|
12
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PrimitiveElementAttributes } from '../../internal/types/html-attributes.js';
|
|
2
|
+
import type { WithChildren, WithElementRef, Without } from 'svelte-toolbelt';
|
|
3
|
+
import type { KbdGroupVariantProps, KbdRootVariantProps } from './styles.js';
|
|
4
|
+
type KbdRootPropsWithoutHTML = WithElementRef<WithChildren<{}>> & KbdRootVariantProps;
|
|
5
|
+
export type KbdRootProps = KbdRootPropsWithoutHTML & Without<PrimitiveElementAttributes, KbdRootPropsWithoutHTML>;
|
|
6
|
+
type KbdGroupPropsWithoutHTML = WithElementRef<WithChildren<{}>> & KbdGroupVariantProps;
|
|
7
|
+
export type KbdGroupProps = KbdGroupPropsWithoutHTML & Without<PrimitiveElementAttributes, KbdGroupPropsWithoutHTML>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../internal/utils/common.js';
|
|
3
|
+
import { untrack } from 'svelte';
|
|
4
|
+
import { boxWith } from 'svelte-toolbelt';
|
|
5
|
+
import { ButtonGroupPrimitive } from '../../button-group/index.js';
|
|
6
|
+
import { Button } from '../../button/index.js';
|
|
7
|
+
import { Icon } from '../../icons/index.js';
|
|
8
|
+
import { Input } from '../../input/index.js';
|
|
9
|
+
import type { NumberInputProps } from '../types.js';
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
ref = $bindable(null),
|
|
13
|
+
value = $bindable(),
|
|
14
|
+
min = 0,
|
|
15
|
+
max = Infinity,
|
|
16
|
+
step = 1,
|
|
17
|
+
allowFloat = false,
|
|
18
|
+
class: className,
|
|
19
|
+
containerClass,
|
|
20
|
+
...restProps
|
|
21
|
+
}: NumberInputProps = $props();
|
|
22
|
+
|
|
23
|
+
const onlyNumberPattern = $derived(allowFloat ? /^\d*\.?\d*$/ : /^\d*$/);
|
|
24
|
+
|
|
25
|
+
let internalValue = $state(value?.toString() ?? '');
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
const externalStr = value?.toString() ?? '';
|
|
29
|
+
|
|
30
|
+
untrack(() => {
|
|
31
|
+
if (parseFloat(internalValue) !== value) {
|
|
32
|
+
internalValue = externalStr;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
let internalValueBox = boxWith(
|
|
38
|
+
() => internalValue,
|
|
39
|
+
(v) => {
|
|
40
|
+
if (!onlyNumberPattern.test(v)) return;
|
|
41
|
+
|
|
42
|
+
if (v === '') {
|
|
43
|
+
internalValue = '';
|
|
44
|
+
value = undefined;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const vNum = parseFloat(v);
|
|
49
|
+
|
|
50
|
+
if (Number.isNaN(vNum)) {
|
|
51
|
+
internalValue = v;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (vNum > max) return;
|
|
56
|
+
if (vNum < min) return;
|
|
57
|
+
|
|
58
|
+
internalValue = v;
|
|
59
|
+
value = vNum;
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const onPlusClick = () => {
|
|
64
|
+
const currentVal = internalValue ? parseFloat(internalValue) : 0;
|
|
65
|
+
const base = Number.isNaN(currentVal) ? 0 : currentVal;
|
|
66
|
+
const newValue = base + step;
|
|
67
|
+
if (newValue > max) return;
|
|
68
|
+
internalValueBox.current = newValue.toString();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const onMinusClick = () => {
|
|
72
|
+
const currentVal = internalValue ? parseFloat(internalValue) : 0;
|
|
73
|
+
const base = Number.isNaN(currentVal) ? 0 : currentVal;
|
|
74
|
+
const newValue = base - step;
|
|
75
|
+
if (newValue < min) return;
|
|
76
|
+
internalValueBox.current = newValue.toString();
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<ButtonGroupPrimitive.Root class={cn('cgui:w-full', containerClass)}>
|
|
81
|
+
<Button
|
|
82
|
+
variant="clean"
|
|
83
|
+
w="clean"
|
|
84
|
+
class="cgui:border cgui:w-9 cgui:border-r-0 cgui:border-stroke-default cgui:text-fg-dark cgui:bg-surface-lightest"
|
|
85
|
+
size="clean"
|
|
86
|
+
onclick={onMinusClick}
|
|
87
|
+
>
|
|
88
|
+
<Icon.Minus width={16} height={16} />
|
|
89
|
+
</Button>
|
|
90
|
+
|
|
91
|
+
<Input bind:value={internalValueBox.current} class={cn('cgui:border-r cgui:border-l!', className)} {...restProps} />
|
|
92
|
+
|
|
93
|
+
<Button
|
|
94
|
+
variant="clean"
|
|
95
|
+
w="clean"
|
|
96
|
+
class="cgui:border cgui:w-9 cgui:border-stroke-default cgui:text-fg-dark cgui:bg-surface-lightest"
|
|
97
|
+
size="clean"
|
|
98
|
+
onclick={onPlusClick}
|
|
99
|
+
>
|
|
100
|
+
<Icon.Plus width={16} height={16} />
|
|
101
|
+
</Button>
|
|
102
|
+
</ButtonGroupPrimitive.Root>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Root } from './components/number-input.root.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Root } from './components/number-input.root.svelte';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InputProps } from '../input/index.js';
|
|
2
|
+
export type NumberInputProps = Omit<InputProps, 'value' | 'min' | 'max' | 'step' | 'type'> & {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
value?: number;
|
|
7
|
+
allowFloat?: boolean;
|
|
8
|
+
containerClass?: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * as PopoverPrimitive from './exports-primitive.js';
|
|
2
2
|
export * from './exports.js';
|
|
3
|
-
export type
|
|
3
|
+
export type * from './types.js';
|