@casinogate/ui 1.6.1 → 1.7.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 +197 -32
- package/dist/assets/css/theme.css +6 -3
- package/dist/components/breadcrumb/styles.d.ts +21 -21
- package/dist/components/button/button.component.svelte +2 -1
- package/dist/components/button/styles.js +4 -4
- package/dist/components/collapsible/styles.d.ts +8 -8
- package/dist/components/data-table/components/flex-render.svelte +1 -1
- package/dist/components/data-table/index.d.ts +0 -1
- package/dist/components/data-table/index.js +0 -1
- package/dist/components/dialog/dialog.stories.svelte +28 -14
- package/dist/components/dropdown/components/dropdown.content.svelte +41 -0
- package/dist/components/dropdown/components/dropdown.content.svelte.d.ts +4 -0
- package/dist/components/dropdown/components/dropdown.group-heading.svelte +16 -0
- package/dist/components/dropdown/components/dropdown.group-heading.svelte.d.ts +4 -0
- package/dist/components/dropdown/components/dropdown.group.svelte +16 -0
- package/dist/components/dropdown/components/dropdown.group.svelte.d.ts +4 -0
- package/dist/components/dropdown/components/dropdown.item.svelte +22 -0
- package/dist/components/dropdown/components/dropdown.item.svelte.d.ts +4 -0
- package/dist/components/dropdown/components/dropdown.portal.svelte +10 -0
- package/dist/components/dropdown/components/dropdown.portal.svelte.d.ts +3 -0
- package/dist/components/dropdown/components/dropdown.root.svelte +10 -0
- package/dist/components/dropdown/components/dropdown.root.svelte.d.ts +3 -0
- package/dist/components/dropdown/components/dropdown.separator.svelte +22 -0
- package/dist/components/dropdown/components/dropdown.separator.svelte.d.ts +4 -0
- package/dist/components/dropdown/components/dropdown.sub-content.svelte +16 -0
- package/dist/components/dropdown/components/dropdown.sub-content.svelte.d.ts +4 -0
- package/dist/components/dropdown/components/dropdown.sub-trigger.svelte +21 -0
- package/dist/components/dropdown/components/dropdown.sub-trigger.svelte.d.ts +4 -0
- package/dist/components/dropdown/components/dropdown.sub.svelte +8 -0
- package/dist/components/dropdown/components/dropdown.sub.svelte.d.ts +3 -0
- package/dist/components/dropdown/components/dropdown.trigger.svelte +16 -0
- package/dist/components/dropdown/components/dropdown.trigger.svelte.d.ts +4 -0
- package/dist/components/dropdown/dropdown.stories.svelte +151 -0
- package/dist/components/dropdown/dropdown.stories.svelte.d.ts +19 -0
- package/dist/components/dropdown/dropdown.svelte +136 -0
- package/dist/components/dropdown/dropdown.svelte.d.ts +6 -0
- package/dist/components/dropdown/exports-primitive.d.ts +11 -0
- package/dist/components/dropdown/exports-primitive.js +11 -0
- package/dist/components/dropdown/exports.d.ts +1 -0
- package/dist/components/dropdown/exports.js +1 -0
- package/dist/components/dropdown/index.d.ts +3 -0
- package/dist/components/dropdown/index.js +2 -0
- package/dist/components/dropdown/styles.d.ts +496 -0
- package/dist/components/dropdown/styles.js +109 -0
- package/dist/components/dropdown/types.d.ts +62 -0
- package/dist/components/dropdown/types.js +1 -0
- package/dist/components/field/styles.d.ts +15 -15
- package/dist/components/popover/components/popover.content.svelte +7 -2
- package/dist/components/popover/components/popover.content.svelte.d.ts +2 -2
- package/dist/components/popover/components/popover.root.svelte +0 -6
- package/dist/components/popover/components/popover.trigger.svelte +6 -2
- package/dist/components/popover/components/popover.trigger.svelte.d.ts +2 -2
- package/dist/components/popover/popover.stories.svelte +112 -52
- package/dist/components/popover/popover.stories.svelte.d.ts +0 -1
- package/dist/components/popover/styles.d.ts +60 -52
- package/dist/components/popover/styles.js +37 -14
- package/dist/components/popover/types.d.ts +4 -4
- package/dist/components/separator/separator.svelte +4 -5
- package/dist/components/separator/separator.svelte.d.ts +2 -2
- package/dist/components/separator/styles.d.ts +18 -0
- package/dist/components/separator/styles.js +10 -0
- package/dist/components/separator/types.d.ts +2 -1
- package/dist/components/spinner/spinner.svelte +1 -6
- package/dist/internal/utils/tailwindcss.d.ts +3 -2
- package/dist/internal/utils/tailwindcss.js +25 -5
- package/package.json +2 -2
- package/dist/components/data-table/utils/render-helper.d.ts +0 -13
- package/dist/components/data-table/utils/render-helper.js +0 -22
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
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, PrimitiveAnchorAttributes, PrimitiveButtonAttributes } from '../../internal/types/html-attributes.js';
|
|
3
|
+
import type { Component, Snippet } from 'svelte';
|
|
4
|
+
import type { DropdownContentVariantsProps, DropdownGroupHeadingVariantsProps, DropdownGroupVariantsProps, DropdownItemVariantsProps, DropdownSeparatorVariantsProps, DropdownSubContentVariantsProps, DropdownSubTriggerVariantsProps, DropdownTriggerVariantsProps } from './styles.js';
|
|
5
|
+
export type DropdownRootProps = DropdownMenuRootPropsPrimitive;
|
|
6
|
+
export type DropdownTriggerProps = DropdownMenuTriggerPropsPrimitive & DropdownTriggerVariantsProps;
|
|
7
|
+
export type DropdownContentProps = DropdownMenuContentPropsPrimitive & DropdownContentVariantsProps;
|
|
8
|
+
export type DropdownGroupProps = DropdownMenuGroupPropsPrimitive & DropdownGroupVariantsProps;
|
|
9
|
+
export type DropdownItemProps = DropdownMenuItemPropsPrimitive & DropdownItemVariantsProps;
|
|
10
|
+
export type DropdownSubProps = DropdownMenuSubPropsPrimitive;
|
|
11
|
+
export type DropdownSubTriggerProps = DropdownMenuSubTriggerPropsPrimitive & DropdownSubTriggerVariantsProps;
|
|
12
|
+
export type DropdownSubContentProps = DropdownMenuSubContentPropsPrimitive & DropdownSubContentVariantsProps;
|
|
13
|
+
export type DropdownPortalProps = DropdownMenuPortalPropsPrimitive;
|
|
14
|
+
export type DropdownGroupHeadingProps = DropdownMenuGroupHeadingPropsPrimitive & DropdownGroupHeadingVariantsProps;
|
|
15
|
+
export type DropdownSeparatorProps = DropdownMenuSeparatorPropsPrimitive & DropdownSeparatorVariantsProps;
|
|
16
|
+
export type DropdownItemBaseValue = {
|
|
17
|
+
key: string | number;
|
|
18
|
+
label: string;
|
|
19
|
+
icon?: Component<{
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
}>;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
onSelect?: () => void;
|
|
25
|
+
textValue?: string;
|
|
26
|
+
closeOnSelect?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type DropdownItemLinkValue = DropdownItemBaseValue & {
|
|
29
|
+
type: 'link';
|
|
30
|
+
href: string;
|
|
31
|
+
} & Partial<ExtractPrimitiveEvents<PrimitiveAnchorAttributes>>;
|
|
32
|
+
export type DropdownItemActionValue = DropdownItemBaseValue & {
|
|
33
|
+
type: 'action';
|
|
34
|
+
} & Partial<ExtractPrimitiveEvents<PrimitiveButtonAttributes>>;
|
|
35
|
+
export type DropdownItemSubValue = DropdownItemBaseValue & {
|
|
36
|
+
type: 'sub';
|
|
37
|
+
children: (DropdownItemLinkValue | DropdownItemActionValue)[];
|
|
38
|
+
};
|
|
39
|
+
export type DropdownSingleItemValue = DropdownItemLinkValue | DropdownItemActionValue | DropdownItemSubValue;
|
|
40
|
+
export type DropdownGroupItemValue = {
|
|
41
|
+
key: string | number;
|
|
42
|
+
type: 'group';
|
|
43
|
+
heading?: string;
|
|
44
|
+
items: DropdownSingleItemValue[];
|
|
45
|
+
};
|
|
46
|
+
export type DropdownSeparatorItemValue = {
|
|
47
|
+
key: string | number;
|
|
48
|
+
type: 'separator';
|
|
49
|
+
};
|
|
50
|
+
export type DropdownItemValue = DropdownSingleItemValue | DropdownGroupItemValue | DropdownSeparatorItemValue;
|
|
51
|
+
export type DropdownProps = DropdownRootProps & {
|
|
52
|
+
trigger?: Snippet<[{
|
|
53
|
+
props: Record<string, unknown>;
|
|
54
|
+
}]> | string;
|
|
55
|
+
item?: Snippet<[{
|
|
56
|
+
item: DropdownSingleItemValue;
|
|
57
|
+
props: Record<string, unknown>;
|
|
58
|
+
}]>;
|
|
59
|
+
contentProps?: Omit<DropdownContentProps, 'class' | 'children' | 'child'>;
|
|
60
|
+
contentClass?: string;
|
|
61
|
+
items: DropdownItemValue[];
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,20 +3,20 @@ import type { ReadableBox } from 'svelte-toolbelt';
|
|
|
3
3
|
import type { VariantProps } from 'tailwind-variants';
|
|
4
4
|
export declare const fieldStyles: import("tailwind-variants").TVReturnType<{
|
|
5
5
|
[key: string]: {
|
|
6
|
-
[key: string]: import("tailwind-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
7
|
+
description?: import("tailwind-merge").ClassNameValue;
|
|
8
|
+
root?: import("tailwind-merge").ClassNameValue;
|
|
9
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
10
|
+
error?: import("tailwind-merge").ClassNameValue;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
} | {
|
|
14
14
|
[x: string]: {
|
|
15
|
-
[x: string]: import("tailwind-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
16
|
+
description?: import("tailwind-merge").ClassNameValue;
|
|
17
|
+
root?: import("tailwind-merge").ClassNameValue;
|
|
18
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
19
|
+
error?: import("tailwind-merge").ClassNameValue;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
} | {}, {
|
|
@@ -26,11 +26,11 @@ export declare const fieldStyles: import("tailwind-variants").TVReturnType<{
|
|
|
26
26
|
description: string;
|
|
27
27
|
}, undefined, {
|
|
28
28
|
[key: string]: {
|
|
29
|
-
[key: string]: import("tailwind-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
30
|
+
description?: import("tailwind-merge").ClassNameValue;
|
|
31
|
+
root?: import("tailwind-merge").ClassNameValue;
|
|
32
|
+
label?: import("tailwind-merge").ClassNameValue;
|
|
33
|
+
error?: import("tailwind-merge").ClassNameValue;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
} | {}, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { cn, useId } from '../../../internal/utils/common.js';
|
|
4
4
|
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
5
5
|
import { boxWith, mergeProps } from 'svelte-toolbelt';
|
|
6
|
-
import {
|
|
6
|
+
import { popoverContentVariants } from '../styles.js';
|
|
7
7
|
import { PopoverContentState } from './popover.svelte.js';
|
|
8
8
|
|
|
9
9
|
const uid = $props.id();
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
side = 'bottom',
|
|
16
16
|
sideOffset = 8,
|
|
17
17
|
align = 'center',
|
|
18
|
+
shadow = true,
|
|
19
|
+
variant = 'default',
|
|
20
|
+
w = 'default',
|
|
21
|
+
rounded = 'default',
|
|
18
22
|
...restProps
|
|
19
23
|
}: PrimitivePopoverContentProps = $props();
|
|
20
24
|
|
|
@@ -30,7 +34,8 @@
|
|
|
30
34
|
</script>
|
|
31
35
|
|
|
32
36
|
<PopoverPrimitive.Content
|
|
33
|
-
|
|
37
|
+
data-slot="popover-content"
|
|
38
|
+
class={cn(popoverContentVariants({ shadow, variant, w, rounded }), className)}
|
|
34
39
|
{side}
|
|
35
40
|
{sideOffset}
|
|
36
41
|
{align}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Popover: import("svelte").Component<
|
|
1
|
+
import type { PrimitivePopoverContentProps } from '../types.js';
|
|
2
|
+
declare const Popover: import("svelte").Component<PrimitivePopoverContentProps, {}, "ref">;
|
|
3
3
|
type Popover = ReturnType<typeof Popover>;
|
|
4
4
|
export default Popover;
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
import { noop } from '../../../internal/utils/common.js';
|
|
3
3
|
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
4
4
|
import { boxWith } from 'svelte-toolbelt';
|
|
5
|
-
import { PopoverStylesContext, popoverVariants } from '../styles.js';
|
|
6
5
|
import type { PrimitivePopoverRootProps } from '../types.js';
|
|
7
6
|
import { PopoverRootState } from './popover.svelte.js';
|
|
8
7
|
|
|
9
8
|
let {
|
|
10
9
|
open = $bindable(false),
|
|
11
10
|
disabled = false,
|
|
12
|
-
shadow = true,
|
|
13
11
|
onOpenChange = noop,
|
|
14
12
|
...restProps
|
|
15
13
|
}: PrimitivePopoverRootProps = $props();
|
|
@@ -24,10 +22,6 @@
|
|
|
24
22
|
),
|
|
25
23
|
disabled: boxWith(() => disabled),
|
|
26
24
|
});
|
|
27
|
-
|
|
28
|
-
const variants = $derived(popoverVariants({ shadow }));
|
|
29
|
-
|
|
30
|
-
PopoverStylesContext.set(boxWith(() => variants));
|
|
31
25
|
</script>
|
|
32
26
|
|
|
33
27
|
<PopoverPrimitive.Root bind:open={rootState.opts.open.current} {...restProps} />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { popoverTriggerVariants } from '../styles.js';
|
|
3
3
|
import type { PrimitivePopoverTriggerProps } from '../types.js';
|
|
4
4
|
import { cn, useId } from '../../../internal/utils/common.js';
|
|
5
5
|
import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
@@ -28,4 +28,8 @@
|
|
|
28
28
|
const mergedProps = $derived(mergeProps(restProps, rootState.props));
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
|
-
<PopoverPrimitive.Trigger
|
|
31
|
+
<PopoverPrimitive.Trigger
|
|
32
|
+
data-slot="popover-trigger"
|
|
33
|
+
class={cn(popoverTriggerVariants(), className)}
|
|
34
|
+
{...mergedProps}
|
|
35
|
+
/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Popover: import("svelte").Component<
|
|
1
|
+
import type { PrimitivePopoverTriggerProps } from '../types.js';
|
|
2
|
+
declare const Popover: import("svelte").Component<PrimitivePopoverTriggerProps, {}, "ref">;
|
|
3
3
|
type Popover = ReturnType<typeof Popover>;
|
|
4
4
|
export default Popover;
|
|
@@ -2,134 +2,194 @@
|
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
3
|
import type { Parameters } from '@storybook/sveltekit';
|
|
4
4
|
import type { ComponentProps } from 'svelte';
|
|
5
|
-
import {
|
|
6
|
-
import PopoverBasic from './popover.svelte';
|
|
5
|
+
import { PopoverPrimitive } from './index.js';
|
|
7
6
|
|
|
8
7
|
const parameters: Parameters = {
|
|
9
|
-
controls: {
|
|
10
|
-
include: ['open', 'disabled', 'side', 'sideOffset', 'align', 'shadow'],
|
|
11
|
-
},
|
|
12
|
-
|
|
13
8
|
layout: 'centered',
|
|
14
9
|
|
|
15
10
|
docs: {
|
|
16
11
|
story: {
|
|
17
12
|
inline: false,
|
|
18
|
-
iframeHeight:
|
|
13
|
+
iframeHeight: 500,
|
|
19
14
|
},
|
|
20
15
|
},
|
|
21
16
|
};
|
|
22
17
|
|
|
23
18
|
const { Story } = defineMeta({
|
|
24
19
|
title: 'UI Kit/Popover',
|
|
25
|
-
|
|
20
|
+
subcomponents: {
|
|
21
|
+
Root: PopoverPrimitive.Root as any,
|
|
22
|
+
Content: PopoverPrimitive.Content as any,
|
|
23
|
+
},
|
|
26
24
|
tags: ['autodocs'],
|
|
27
25
|
|
|
28
26
|
parameters,
|
|
29
27
|
|
|
30
28
|
argTypes: {
|
|
31
|
-
align: {
|
|
32
|
-
control: 'radio',
|
|
33
|
-
options: ['start', 'center', 'end'],
|
|
34
|
-
table: {
|
|
35
|
-
defaultValue: { summary: 'center' },
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
|
|
39
29
|
open: {
|
|
30
|
+
name: 'open',
|
|
31
|
+
control: 'boolean',
|
|
32
|
+
if: { arg: 'disabled', eq: false },
|
|
40
33
|
table: {
|
|
34
|
+
category: 'Root',
|
|
41
35
|
defaultValue: { summary: 'false' },
|
|
42
36
|
},
|
|
43
37
|
},
|
|
44
|
-
|
|
45
38
|
disabled: {
|
|
39
|
+
name: 'disabled',
|
|
40
|
+
control: 'boolean',
|
|
46
41
|
table: {
|
|
42
|
+
category: 'Root',
|
|
47
43
|
defaultValue: { summary: 'false' },
|
|
48
44
|
},
|
|
49
45
|
},
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Content component args
|
|
49
|
+
*/
|
|
50
50
|
side: {
|
|
51
|
+
name: 'side',
|
|
51
52
|
control: 'radio',
|
|
52
53
|
options: ['top', 'bottom', 'left', 'right'],
|
|
53
54
|
table: {
|
|
55
|
+
category: 'Content',
|
|
54
56
|
defaultValue: { summary: 'bottom' },
|
|
55
57
|
},
|
|
56
58
|
},
|
|
57
|
-
|
|
58
59
|
sideOffset: {
|
|
60
|
+
name: 'sideOffset',
|
|
59
61
|
control: 'number',
|
|
60
62
|
table: {
|
|
63
|
+
category: 'Content',
|
|
61
64
|
defaultValue: { summary: '8' },
|
|
62
65
|
},
|
|
63
66
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
control: '
|
|
67
|
+
align: {
|
|
68
|
+
name: 'align',
|
|
69
|
+
control: 'radio',
|
|
70
|
+
options: ['start', 'center', 'end'],
|
|
71
|
+
table: {
|
|
72
|
+
category: 'Content',
|
|
73
|
+
defaultValue: { summary: 'center' },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
w: {
|
|
77
|
+
name: 'w',
|
|
78
|
+
control: 'radio',
|
|
79
|
+
options: ['default', 'auto'],
|
|
67
80
|
table: {
|
|
68
|
-
|
|
81
|
+
category: 'Content',
|
|
82
|
+
defaultValue: { summary: 'default' },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
rounded: {
|
|
86
|
+
name: 'rounded',
|
|
87
|
+
control: 'radio',
|
|
88
|
+
options: ['default', 'md', 'lg', 'xl', 'full', 'clean'],
|
|
89
|
+
table: {
|
|
90
|
+
category: 'Content',
|
|
91
|
+
defaultValue: { summary: 'default' },
|
|
69
92
|
},
|
|
70
93
|
},
|
|
71
94
|
},
|
|
72
95
|
});
|
|
73
96
|
|
|
74
|
-
type
|
|
97
|
+
type ArgsRoot = ComponentProps<typeof PopoverPrimitive.Root>;
|
|
98
|
+
type ArgsContent = ComponentProps<typeof PopoverPrimitive.Content>;
|
|
99
|
+
|
|
100
|
+
type MergedArgs = ArgsRoot & ArgsContent;
|
|
75
101
|
|
|
76
|
-
const
|
|
102
|
+
const rootArgs: ArgsRoot = {
|
|
77
103
|
open: false,
|
|
78
104
|
disabled: false,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const contentArgs: ArgsContent = {
|
|
79
108
|
side: 'bottom',
|
|
80
109
|
sideOffset: 8,
|
|
81
110
|
align: 'center',
|
|
82
|
-
|
|
111
|
+
w: 'default',
|
|
112
|
+
rounded: 'default',
|
|
83
113
|
};
|
|
114
|
+
|
|
115
|
+
const mergedArgs: MergedArgs = { ...rootArgs, ...contentArgs };
|
|
84
116
|
</script>
|
|
85
117
|
|
|
86
118
|
<script lang="ts">
|
|
87
119
|
let customAnchor = $state<HTMLDivElement>();
|
|
88
120
|
</script>
|
|
89
121
|
|
|
90
|
-
{#snippet template(args:
|
|
122
|
+
{#snippet template(args: MergedArgs)}
|
|
91
123
|
{@const rootArgs = { open: args.open, disabled: args.disabled }}
|
|
92
124
|
{@const contentArgs = { side: args.side, sideOffset: args.sideOffset, align: args.align }}
|
|
93
125
|
<PopoverPrimitive.Root {...rootArgs}>
|
|
94
|
-
<PopoverPrimitive.Trigger>
|
|
126
|
+
<PopoverPrimitive.Trigger class="cgui:border cgui:border-stroke-divider cgui:rounded-sm cgui:px-4 cgui:py-2">
|
|
127
|
+
Trigger
|
|
128
|
+
</PopoverPrimitive.Trigger>
|
|
95
129
|
|
|
96
130
|
<PopoverPrimitive.Portal>
|
|
97
|
-
<PopoverPrimitive.Content {...contentArgs}>
|
|
131
|
+
<PopoverPrimitive.Content {...contentArgs}>
|
|
132
|
+
<div class="cgui:p-2">
|
|
133
|
+
<div class="cgui:space-y-2">
|
|
134
|
+
<h3 class="cgui:font-semibold cgui:text-sm">Popover Content</h3>
|
|
135
|
+
<p class="cgui:text-sm cgui:text-fg-medium">This is a simple popover with some example content.</p>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
</PopoverPrimitive.Content>
|
|
98
139
|
</PopoverPrimitive.Portal>
|
|
99
140
|
</PopoverPrimitive.Root>
|
|
100
141
|
{/snippet}
|
|
101
142
|
|
|
102
|
-
<Story name="Primitive" {
|
|
143
|
+
<Story name="Primitive" args={mergedArgs} {template} {parameters} />
|
|
103
144
|
|
|
104
|
-
<Story name="
|
|
105
|
-
{#snippet template(args:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
145
|
+
<Story name="Custom Anchor" args={mergedArgs} {parameters}>
|
|
146
|
+
{#snippet template(args: MergedArgs)}
|
|
147
|
+
{@const rootArgs = { open: args.open, disabled: args.disabled }}
|
|
148
|
+
{@const contentArgs = {
|
|
149
|
+
side: args.side,
|
|
150
|
+
sideOffset: args.sideOffset,
|
|
151
|
+
align: args.align,
|
|
152
|
+
w: args.w,
|
|
153
|
+
rounded: args.rounded,
|
|
154
|
+
}}
|
|
110
155
|
|
|
111
|
-
|
|
112
|
-
</Popover>
|
|
113
|
-
{/snippet}
|
|
114
|
-
</Story>
|
|
115
|
-
|
|
116
|
-
<Story name="Custom Anchor" {args} {parameters}>
|
|
117
|
-
{#snippet template(args: Args)}
|
|
118
|
-
<div class="cgui:flex cgui:items-center cgui:justify-center cgui:h-full cgui:gap-12">
|
|
156
|
+
<div class="cgui:flex cgui:items-center cgui:justify-center cgui:h-full cgui:gap-16">
|
|
119
157
|
<div
|
|
120
158
|
bind:this={customAnchor}
|
|
121
|
-
class="cgui:w-
|
|
159
|
+
class="cgui:w-48 cgui:h-24 cgui:flex cgui:items-center cgui:justify-center cgui:border-2 cgui:border-dashed cgui:text-center cgui:border-stroke-divider cgui:rounded-lg cgui:bg-surface-white cgui:shadow-sm"
|
|
122
160
|
>
|
|
123
|
-
|
|
161
|
+
<div class="cgui:space-y-1">
|
|
162
|
+
<div class="cgui:text-sm cgui:font-semibold cgui:text-fg-darkest">Custom Anchor</div>
|
|
163
|
+
<div class="cgui:text-xs cgui:text-fg-regular">Popover anchors here</div>
|
|
164
|
+
</div>
|
|
124
165
|
</div>
|
|
125
166
|
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
167
|
+
<PopoverPrimitive.Root {...rootArgs}>
|
|
168
|
+
<PopoverPrimitive.Trigger
|
|
169
|
+
class="cgui:border cgui:border-stroke-divider cgui:rounded-sm cgui:px-4 cgui:py-2 cgui:bg-surface-white cgui:hover:bg-surface-hover cgui:transition-colors"
|
|
170
|
+
>
|
|
171
|
+
Open Popover
|
|
172
|
+
</PopoverPrimitive.Trigger>
|
|
173
|
+
|
|
174
|
+
<PopoverPrimitive.Portal>
|
|
175
|
+
<PopoverPrimitive.Content {...contentArgs} side="left" class="cgui:max-w-64" {customAnchor}>
|
|
176
|
+
<div class="cgui:p-4 cgui:min-w-64">
|
|
177
|
+
<div class="cgui:space-y-3">
|
|
178
|
+
<h3 class="cgui:font-semibold cgui:text-base cgui:text-fg-darkest">Anchored Popover</h3>
|
|
179
|
+
<p class="cgui:text-sm cgui:text-fg-medium cgui:leading-relaxed">
|
|
180
|
+
This popover is anchored to the custom anchor element on the left, not the trigger button. This is
|
|
181
|
+
useful when you want to position the popover relative to a different element.
|
|
182
|
+
</p>
|
|
183
|
+
<div class="cgui:pt-2 cgui:border-t cgui:border-stroke-divider">
|
|
184
|
+
<p class="cgui:text-xs cgui:text-fg-semilight">
|
|
185
|
+
Try adjusting the side and align properties to see how the popover positions itself.
|
|
186
|
+
</p>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</PopoverPrimitive.Content>
|
|
191
|
+
</PopoverPrimitive.Portal>
|
|
192
|
+
</PopoverPrimitive.Root>
|
|
133
193
|
</div>
|
|
134
194
|
{/snippet}
|
|
135
195
|
</Story>
|
|
@@ -1,56 +1,64 @@
|
|
|
1
|
-
import { Context } from 'runed';
|
|
2
|
-
import type { ReadableBox } from 'svelte-toolbelt';
|
|
3
1
|
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
-
export declare const popoverVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
export declare const popoverVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, never[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, never[], unknown, unknown, undefined>>;
|
|
3
|
+
export declare const popoverContentVariants: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string[];
|
|
6
|
+
};
|
|
5
7
|
shadow: {
|
|
6
|
-
true:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
true: string[];
|
|
9
|
+
};
|
|
10
|
+
w: {
|
|
11
|
+
default: string[];
|
|
12
|
+
auto: string[];
|
|
13
|
+
};
|
|
14
|
+
rounded: {
|
|
15
|
+
default: string[];
|
|
16
|
+
md: string[];
|
|
17
|
+
lg: string[];
|
|
18
|
+
xl: string[];
|
|
19
|
+
full: string[];
|
|
20
|
+
clean: never[];
|
|
21
|
+
};
|
|
22
|
+
}, undefined, string[], {
|
|
23
|
+
variant: {
|
|
24
|
+
default: string[];
|
|
25
|
+
};
|
|
15
26
|
shadow: {
|
|
16
|
-
true:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
true: string[];
|
|
28
|
+
};
|
|
29
|
+
w: {
|
|
30
|
+
default: string[];
|
|
31
|
+
auto: string[];
|
|
32
|
+
};
|
|
33
|
+
rounded: {
|
|
34
|
+
default: string[];
|
|
35
|
+
md: string[];
|
|
36
|
+
lg: string[];
|
|
37
|
+
xl: string[];
|
|
38
|
+
full: string[];
|
|
39
|
+
clean: never[];
|
|
40
|
+
};
|
|
41
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
42
|
+
variant: {
|
|
43
|
+
default: string[];
|
|
44
|
+
};
|
|
25
45
|
shadow: {
|
|
26
|
-
true:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
46
|
-
} & {
|
|
47
|
-
root: (slotProps?: ({
|
|
48
|
-
shadow?: boolean | undefined;
|
|
49
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
50
|
-
trigger: (slotProps?: ({
|
|
51
|
-
shadow?: boolean | undefined;
|
|
52
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
53
|
-
content: (slotProps?: ({
|
|
54
|
-
shadow?: boolean | undefined;
|
|
55
|
-
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
56
|
-
} & {}>>;
|
|
46
|
+
true: string[];
|
|
47
|
+
};
|
|
48
|
+
w: {
|
|
49
|
+
default: string[];
|
|
50
|
+
auto: string[];
|
|
51
|
+
};
|
|
52
|
+
rounded: {
|
|
53
|
+
default: string[];
|
|
54
|
+
md: string[];
|
|
55
|
+
lg: string[];
|
|
56
|
+
xl: string[];
|
|
57
|
+
full: string[];
|
|
58
|
+
clean: never[];
|
|
59
|
+
};
|
|
60
|
+
}, undefined, string[], unknown, unknown, undefined>>;
|
|
61
|
+
export declare const popoverTriggerVariants: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
62
|
+
export type PopoverRootVariantsProps = VariantProps<typeof popoverVariants>;
|
|
63
|
+
export type PopoverContentVariantsProps = VariantProps<typeof popoverContentVariants>;
|
|
64
|
+
export type PopoverTriggerVariantsProps = VariantProps<typeof popoverTriggerVariants>;
|
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
import { keyWithPrefix } from '../../internal/utils/common.js';
|
|
2
1
|
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
3
|
-
import { Context } from 'runed';
|
|
4
2
|
export const popoverVariants = tv({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
base: [],
|
|
4
|
+
});
|
|
5
|
+
export const popoverContentVariants = tv({
|
|
6
|
+
base: [
|
|
7
|
+
'cgui:z-(--cg-ui-z-index-popover',
|
|
8
|
+
'cgui:origin-(--bits-popover-content-transform-origin) cgui:outline-hidden',
|
|
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
|
+
'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',
|
|
11
|
+
],
|
|
13
12
|
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: ['cgui:bg-surface-white'],
|
|
15
|
+
},
|
|
14
16
|
shadow: {
|
|
15
|
-
true:
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
true: ['cgui:shadow-popover'],
|
|
18
|
+
},
|
|
19
|
+
w: {
|
|
20
|
+
default: ['cgui:min-w-(--bits-popover-anchor-width)'],
|
|
21
|
+
auto: ['cgui:w-auto'],
|
|
18
22
|
},
|
|
23
|
+
rounded: {
|
|
24
|
+
default: ['cgui:rounded-sm'],
|
|
25
|
+
md: ['cgui:rounded-md'],
|
|
26
|
+
lg: ['cgui:rounded-lg'],
|
|
27
|
+
xl: ['cgui:rounded-xl'],
|
|
28
|
+
full: ['cgui:rounded-full'],
|
|
29
|
+
clean: [],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: 'default',
|
|
34
|
+
shadow: true,
|
|
35
|
+
w: 'default',
|
|
36
|
+
rounded: 'default',
|
|
19
37
|
},
|
|
20
38
|
});
|
|
21
|
-
export const
|
|
39
|
+
export const popoverTriggerVariants = tv({
|
|
40
|
+
base: [
|
|
41
|
+
'cgui:cursor-pointer',
|
|
42
|
+
'cgui:disabled:cursor-not-allowed cgui:disabled:pointer-events-none cgui:disabled:opacity-50',
|
|
43
|
+
],
|
|
44
|
+
});
|
|
@@ -2,13 +2,13 @@ import { Popover as PopoverPrimitive } from 'bits-ui';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { WithoutChildrenOrChild } from 'svelte-toolbelt';
|
|
4
4
|
import type { TransitionConfig } from 'svelte/transition';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PopoverContentVariantsProps, PopoverTriggerVariantsProps } from './styles.js';
|
|
6
6
|
export type PrimitivePopoverRootProps = PopoverPrimitive.RootProps & {
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export type PrimitivePopoverContentProps = PopoverPrimitive.ContentProps;
|
|
8
|
+
};
|
|
9
|
+
export type PrimitivePopoverContentProps = PopoverPrimitive.ContentProps & PopoverContentVariantsProps;
|
|
10
10
|
export type PrimitivePopoverPortalProps = PopoverPrimitive.PortalProps;
|
|
11
|
-
export type PrimitivePopoverTriggerProps = PopoverPrimitive.TriggerProps;
|
|
11
|
+
export type PrimitivePopoverTriggerProps = PopoverPrimitive.TriggerProps & PopoverTriggerVariantsProps;
|
|
12
12
|
export type AnimationFn = (node: Element, params?: any) => TransitionConfig;
|
|
13
13
|
export type AnimationDirection = {
|
|
14
14
|
x: number;
|