@casinogate/ui 1.8.8 → 1.9.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 +75 -39
- package/dist/components/navigation/components/navigation.content.svelte +3 -4
- package/dist/components/navigation/components/navigation.item.svelte +19 -17
- package/dist/components/navigation/components/navigation.root.svelte +10 -12
- package/dist/components/navigation/components/navigation.sub-content.svelte +27 -28
- package/dist/components/navigation/components/navigation.sub-trigger.svelte +107 -0
- package/dist/components/navigation/components/navigation.sub-trigger.svelte.d.ts +4 -0
- package/dist/components/navigation/components/navigation.sub.svelte +55 -0
- package/dist/components/navigation/components/navigation.sub.svelte.d.ts +4 -0
- package/dist/components/navigation/components/navigation.svelte.d.ts +45 -15
- package/dist/components/navigation/components/navigation.svelte.js +68 -28
- package/dist/components/navigation/components/navigation.trigger.svelte +36 -80
- package/dist/components/navigation/exports-primitive.d.ts +2 -0
- package/dist/components/navigation/exports-primitive.js +2 -0
- package/dist/components/navigation/exports.d.ts +1 -1
- package/dist/components/navigation/exports.js +1 -1
- package/dist/components/navigation/index.d.ts +2 -1
- package/dist/components/navigation/index.js +1 -0
- package/dist/components/navigation/navigation.svelte +114 -29
- package/dist/components/navigation/navigation.svelte.d.ts +3 -0
- package/dist/components/navigation/styles.d.ts +19 -28
- package/dist/components/navigation/styles.js +45 -28
- package/dist/components/navigation/types.d.ts +59 -20
- package/dist/components/popover/popover.svelte +12 -3
- package/dist/components/popover/styles.js +1 -1
- package/dist/components/popover/types.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,35 +1,52 @@
|
|
|
1
|
-
import { keyWithPrefix } from '../../internal/utils/common.js';
|
|
2
1
|
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
10
|
-
],
|
|
11
|
-
content: ['cgui:overflow-hidden'],
|
|
12
|
-
item: [],
|
|
13
|
-
subContent: [
|
|
14
|
-
'cgui:data-[compact=false]:pl-10',
|
|
15
|
-
'cgui:data-[compact=false]:[&_[data-slot="trigger"]]:pl-0',
|
|
16
|
-
'cgui:data-[popover-content]:bg-surface-darkest cgui:data-[popover-content]:rounded-md',
|
|
17
|
-
],
|
|
18
|
-
trigger: [
|
|
19
|
-
'cgui:flex cgui:items-center cgui:gap-2',
|
|
20
|
-
'cgui:overflow-hidden cgui:truncate',
|
|
21
|
-
'cgui:w-full cgui:px-3 cgui:py-4',
|
|
22
|
-
'cgui:group-data-[compact=true]/navigation:py-3 cgui:data-[sub-content="false"]:group-data-[compact=true]/navigation:justify-center',
|
|
23
|
-
'cgui:text-fg-semilight cgui:text-body',
|
|
24
|
-
'cgui:cursor-pointer cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
25
|
-
'cgui:[data-disabled]:cursor-not-allowed cgui:[data-disabled]:opacity-50',
|
|
26
|
-
'cgui:[&_[data-slot="icon"]]:size-6',
|
|
27
|
-
],
|
|
28
|
-
},
|
|
2
|
+
export const navigationRootStyles = tv({
|
|
3
|
+
base: [
|
|
4
|
+
'cgui:group/navigation',
|
|
5
|
+
'cgui:data-[compact=true]:w-fit cgui:min-w-px cgui:w-full',
|
|
6
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
7
|
+
],
|
|
29
8
|
variants: {
|
|
30
9
|
compact: {
|
|
31
10
|
true: {},
|
|
32
11
|
},
|
|
33
12
|
},
|
|
34
13
|
});
|
|
35
|
-
export const
|
|
14
|
+
export const navigationContentStyles = tv({
|
|
15
|
+
base: ['cgui:overflow-hidden'],
|
|
16
|
+
});
|
|
17
|
+
export const navigationItemStyles = tv({
|
|
18
|
+
base: [],
|
|
19
|
+
});
|
|
20
|
+
export const navigationTriggerStyles = tv({
|
|
21
|
+
base: [
|
|
22
|
+
'cgui:flex cgui:items-center cgui:gap-2',
|
|
23
|
+
'cgui:overflow-hidden cgui:truncate',
|
|
24
|
+
'cgui:w-full cgui:px-3 cgui:py-4',
|
|
25
|
+
'cgui:group-data-[compact=true]/navigation:py-3 cgui:group-data-[compact=true]/navigation:justify-center',
|
|
26
|
+
'cgui:text-fg-semilight cgui:text-body',
|
|
27
|
+
'cgui:cursor-pointer cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
28
|
+
'cgui:data-[disabled]:cursor-not-allowed cgui:data-[disabled]:opacity-50',
|
|
29
|
+
'cgui:[&_svg]:size-6 cgui:[&_[data-slot="icon"]]:me-auto',
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
export const navigationSubStyles = tv({
|
|
33
|
+
base: [],
|
|
34
|
+
});
|
|
35
|
+
export const navigationSubTriggerStyles = tv({
|
|
36
|
+
extend: navigationTriggerStyles,
|
|
37
|
+
base: ['cgui:group-data-[compact=false]/navigation:data-[state=open]:[&_[data-slot="chevron"]]:rotate-180'],
|
|
38
|
+
});
|
|
39
|
+
export const navigationSubContentStyles = tv({
|
|
40
|
+
base: ['cgui:data-[compact=false]:pl-10', 'cgui:data-[compact=false]:[&_[data-slot="trigger"]]:pl-0'],
|
|
41
|
+
});
|
|
42
|
+
export const navigationDropdownContentStyles = tv({
|
|
43
|
+
base: [
|
|
44
|
+
'cgui:bg-surface-darkest cgui:rounded-md',
|
|
45
|
+
'cgui:min-w-40 cgui:p-1',
|
|
46
|
+
'cgui:[&_[data-slot="trigger"]]:px-2 cgui:[&_[data-slot="trigger"]]:py-2',
|
|
47
|
+
'cgui:[&_[data-slot="trigger"]]:text-sm',
|
|
48
|
+
'cgui:[&_[data-slot="trigger"]]:rounded-sm',
|
|
49
|
+
'cgui:[&_svg]:size-4',
|
|
50
|
+
'cgui:[&_[data-slot="trigger"]_[data-slot="icon"]]:size-4',
|
|
51
|
+
],
|
|
52
|
+
});
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import type { PrimitiveElementAttributes } from '../../internal/types/html-attributes.js';
|
|
2
|
+
import type { ListCollection } from '@zag-js/collection';
|
|
2
3
|
import type { Component, Snippet } from 'svelte';
|
|
3
4
|
import type { WithChild, WithElementRef, Without, WithoutChildren, WithoutChildrenOrChild } from 'svelte-toolbelt';
|
|
4
|
-
import type {
|
|
5
|
+
import type { NavigationContentVariantsProps, NavigationItemVariantsProps, NavigationRootVariantsProps, NavigationSubContentVariantsProps, NavigationSubTriggerVariantsProps, NavigationSubVariantsProps, NavigationTriggerVariantsProps } from './styles.js';
|
|
5
6
|
type NavigationRootPropsWithoutHTML = WithElementRef<WithChild<{
|
|
6
|
-
|
|
7
|
+
dropdownProps?: {
|
|
7
8
|
sideOffset?: number;
|
|
8
9
|
alignOffset?: number;
|
|
9
10
|
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
10
11
|
};
|
|
11
12
|
}, {
|
|
12
13
|
compact: boolean;
|
|
13
|
-
}>> &
|
|
14
|
+
}>> & NavigationRootVariantsProps;
|
|
14
15
|
export type NavigationRootProps = NavigationRootPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationRootPropsWithoutHTML>;
|
|
15
|
-
type
|
|
16
|
-
export type NavigationItemProps = NavigationItemPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationItemPropsWithoutHTML>;
|
|
17
|
-
type NavigationContentPropsWithoutHTML = WithElementRef<WithChild<{}>>;
|
|
16
|
+
type NavigationContentPropsWithoutHTML = WithElementRef<WithChild<{}>> & NavigationContentVariantsProps;
|
|
18
17
|
export type NavigationContentProps = NavigationContentPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationContentPropsWithoutHTML>;
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
-
}>>;
|
|
22
|
-
export type NavigationSubContentProps = NavigationSubContentPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationSubContentPropsWithoutHTML>;
|
|
18
|
+
type NavigationItemPropsWithoutHTML = WithElementRef<WithChild<{}>> & NavigationItemVariantsProps;
|
|
19
|
+
export type NavigationItemProps = NavigationItemPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationItemPropsWithoutHTML>;
|
|
23
20
|
type NavigationTriggerPropsWithoutHTML = WithElementRef<WithoutChildren<WithChild<{
|
|
24
21
|
href?: string;
|
|
25
22
|
disabled?: boolean;
|
|
@@ -29,26 +26,68 @@ type NavigationTriggerPropsWithoutHTML = WithElementRef<WithoutChildren<WithChil
|
|
|
29
26
|
}]>;
|
|
30
27
|
}, {
|
|
31
28
|
compact: boolean;
|
|
32
|
-
}
|
|
29
|
+
}>>> & NavigationTriggerVariantsProps;
|
|
33
30
|
export type NavigationTriggerProps = NavigationTriggerPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationTriggerPropsWithoutHTML>;
|
|
34
|
-
type
|
|
35
|
-
|
|
31
|
+
type NavigationSubPropsWithoutHTML = WithElementRef<WithChild<{
|
|
32
|
+
open?: boolean;
|
|
33
|
+
}, {
|
|
34
|
+
open: boolean;
|
|
35
|
+
}>> & NavigationSubVariantsProps;
|
|
36
|
+
export type NavigationSubProps = NavigationSubPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationSubPropsWithoutHTML>;
|
|
37
|
+
type NavigationSubTriggerPropsWithoutHTML = WithElementRef<WithoutChildren<WithChild<{
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
icon?: Snippet;
|
|
40
|
+
label?: string | Snippet<[{
|
|
41
|
+
props: Record<string, unknown>;
|
|
42
|
+
}]>;
|
|
43
|
+
}, {
|
|
44
|
+
compact: boolean;
|
|
45
|
+
open: boolean;
|
|
46
|
+
}>>> & NavigationSubTriggerVariantsProps;
|
|
47
|
+
export type NavigationSubTriggerProps = NavigationSubTriggerPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationSubTriggerPropsWithoutHTML>;
|
|
48
|
+
type NavigationSubContentPropsWithoutHTML = WithElementRef<WithChild<{}, {
|
|
49
|
+
compact: boolean;
|
|
50
|
+
}>> & NavigationSubContentVariantsProps;
|
|
51
|
+
export type NavigationSubContentProps = NavigationSubContentPropsWithoutHTML & Without<PrimitiveElementAttributes, NavigationSubContentPropsWithoutHTML>;
|
|
52
|
+
export type NavigationItemBase = {
|
|
53
|
+
/** Unique identifier for the item */
|
|
54
|
+
key: string;
|
|
55
|
+
/** Display label */
|
|
36
56
|
label: string;
|
|
57
|
+
/** Optional icon component */
|
|
37
58
|
icon?: Component<{
|
|
38
59
|
width?: number;
|
|
39
60
|
height?: number;
|
|
40
61
|
}>;
|
|
62
|
+
/** Whether the item is disabled */
|
|
63
|
+
disabled?: boolean;
|
|
41
64
|
};
|
|
42
|
-
type
|
|
65
|
+
export type NavigationItemLink = NavigationItemBase & {
|
|
66
|
+
type: 'link';
|
|
43
67
|
href: string;
|
|
44
|
-
|
|
68
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
69
|
+
rel?: string;
|
|
70
|
+
};
|
|
71
|
+
export type NavigationItemAction = NavigationItemBase & {
|
|
72
|
+
type: 'action';
|
|
73
|
+
onClick?: () => void;
|
|
74
|
+
};
|
|
75
|
+
export type NavigationItemSub = NavigationItemBase & {
|
|
76
|
+
type: 'sub';
|
|
77
|
+
children: NavigationSelectableItem[];
|
|
45
78
|
};
|
|
46
|
-
type
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
export type NavigationItem = NavigationItemLink | NavigationItemAction | NavigationItemSub;
|
|
80
|
+
export type NavigationSelectableItem = NavigationItem;
|
|
81
|
+
export type NavigationCollection = ListCollection<NavigationItem>;
|
|
82
|
+
export type NavigationCollectionOptions = {
|
|
83
|
+
items: NavigationItem[];
|
|
49
84
|
};
|
|
50
|
-
export type NavigationItemValue = NavigationItemValueWithHref | NavigationItemValueWithChildren;
|
|
51
85
|
export type NavigationProps = WithoutChildrenOrChild<NavigationRootProps> & {
|
|
52
|
-
|
|
86
|
+
collection: NavigationCollection;
|
|
87
|
+
item?: Snippet<[{
|
|
88
|
+
item: NavigationSelectableItem;
|
|
89
|
+
props: Record<string, unknown>;
|
|
90
|
+
}]>;
|
|
91
|
+
contentClass?: string;
|
|
53
92
|
};
|
|
54
93
|
export {};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { fly } from 'svelte/transition';
|
|
10
10
|
import Content from './components/popover.content.svelte';
|
|
11
11
|
import Root from './components/popover.root.svelte';
|
|
12
|
+
import * as Primitive from './exports-primitive.js';
|
|
12
13
|
|
|
13
14
|
let {
|
|
14
15
|
open = $bindable(false),
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
side = 'bottom',
|
|
21
22
|
animationFn,
|
|
22
23
|
animationParams,
|
|
23
|
-
forceMount =
|
|
24
|
+
forceMount = false,
|
|
24
25
|
...restProps
|
|
25
26
|
}: PopoverProps<T> = $props();
|
|
26
27
|
|
|
@@ -47,8 +48,16 @@
|
|
|
47
48
|
</script>
|
|
48
49
|
|
|
49
50
|
<Root bind:open {onOpenChange} {onOpenChangeComplete}>
|
|
50
|
-
{#if trigger}
|
|
51
|
-
{
|
|
51
|
+
{#if trigger !== undefined}
|
|
52
|
+
{#if typeof trigger === 'string'}
|
|
53
|
+
<Primitive.Trigger>{trigger}</Primitive.Trigger>
|
|
54
|
+
{:else}
|
|
55
|
+
<Primitive.Trigger>
|
|
56
|
+
{#snippet child({ props })}
|
|
57
|
+
{@render trigger?.({ props })}
|
|
58
|
+
{/snippet}
|
|
59
|
+
</Primitive.Trigger>
|
|
60
|
+
{/if}
|
|
52
61
|
{/if}
|
|
53
62
|
|
|
54
63
|
{#if forceMount}
|
|
@@ -4,7 +4,7 @@ export const popoverVariants = tv({
|
|
|
4
4
|
});
|
|
5
5
|
export const popoverContentVariants = tv({
|
|
6
6
|
base: [
|
|
7
|
-
'cgui:z-(--cg-ui-z-index-popover',
|
|
7
|
+
'cgui:z-(--cg-ui-z-index-popover)',
|
|
8
8
|
'cgui:origin-(--bits-popover-content-transform-origin) cgui:outline-hidden',
|
|
9
9
|
'cgui:data-[state=open]:animate-in cgui:data-[state=closed]:animate-out cgui:data-[state=closed]:fade-out-0 cgui:data-[state=open]:fade-in-0 cgui:data-[state=closed]:zoom-out-95 cgui:data-[state=open]:zoom-in-95',
|
|
10
10
|
'cgui:data-[side=bottom]:slide-in-from-top-2 cgui:data-[side=left]:slide-in-from-end-2 cgui:data-[side=right]:slide-in-from-start-2 cgui:data-[side=top]:slide-in-from-bottom-2',
|
|
@@ -19,7 +19,9 @@ export type AnimationDirection = {
|
|
|
19
19
|
y: number;
|
|
20
20
|
};
|
|
21
21
|
export type PopoverProps<TAnimationFn extends AnimationFn = AnimationFn> = WithoutChildrenOrChild<PrimitivePopoverRootProps> & Pick<PrimitivePopoverContentProps, 'ref' | 'class' | 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'preventScroll' | 'customAnchor' | 'forceMount'> & {
|
|
22
|
-
trigger?: Snippet
|
|
22
|
+
trigger?: Snippet<[{
|
|
23
|
+
props: Record<string, unknown>;
|
|
24
|
+
}]>;
|
|
23
25
|
children?: Snippet;
|
|
24
26
|
animationFn?: TAnimationFn;
|
|
25
27
|
animationParams?: Parameters<TAnimationFn>[1];
|