@adea-ai/ui 0.22.2 → 0.23.1
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/README.md +6 -3
- package/dist/components/account-drawer.d.ts +3 -3
- package/dist/components/account-drawer.js +119 -19
- package/dist/components/on-screen-controls.d.ts +2 -1
- package/dist/components/on-screen-controls.js +158 -46
- package/dist/components/scene-settings.d.ts +3 -3
- package/dist/components/scene-settings.js +247 -28
- package/dist/components/theme-provider.d.ts +27 -5
- package/dist/components/theme-provider.js +96 -7
- package/dist/components/theme-toggle.d.ts +4 -4
- package/dist/components/theme-toggle.js +62 -18
- package/dist/components/ui/badge.d.ts +4 -3
- package/dist/components/ui/badge.js +31 -30
- package/dist/components/ui/button.d.ts +4 -3
- package/dist/components/ui/button.js +49 -32
- package/dist/components/ui/card.d.ts +3 -3
- package/dist/components/ui/card.js +25 -6
- package/dist/components/ui/dialog.d.ts +13 -13
- package/dist/components/ui/dialog.js +94 -26
- package/dist/components/ui/drawer.d.ts +23 -15
- package/dist/components/ui/drawer.js +109 -64
- package/dist/components/ui/dropdown-menu.d.ts +28 -22
- package/dist/components/ui/dropdown-menu.js +165 -36
- package/dist/components/ui/empty.d.ts +7 -6
- package/dist/components/ui/empty.js +78 -26
- package/dist/components/ui/field.d.ts +15 -14
- package/dist/components/ui/field.js +177 -55
- package/dist/components/ui/input.d.ts +2 -2
- package/dist/components/ui/input.js +20 -5
- package/dist/components/ui/label.d.ts +2 -2
- package/dist/components/ui/label.js +15 -5
- package/dist/components/ui/radio-group.d.ts +4 -4
- package/dist/components/ui/radio-group.js +36 -9
- package/dist/components/ui/separator.d.ts +6 -2
- package/dist/components/ui/separator.js +18 -6
- package/dist/components/ui/skeleton.d.ts +2 -1
- package/dist/components/ui/skeleton.js +15 -4
- package/dist/components/ui/spinner.d.ts +4 -3
- package/dist/components/ui/spinner.js +15 -5
- package/dist/components/ui/switch.d.ts +6 -3
- package/dist/components/ui/switch.js +57 -6
- package/dist/components/ui/tabs.d.ts +6 -5
- package/dist/components/ui/tabs.js +52 -24
- package/dist/components/ui/toggle-group.d.ts +10 -8
- package/dist/components/ui/toggle-group.js +91 -20
- package/dist/components/ui/toggle.d.ts +4 -2
- package/dist/components/ui/toggle.js +38 -23
- package/dist/components/ui/tooltip.d.ts +13 -6
- package/dist/components/ui/tooltip.js +51 -14
- package/dist/components/version-dialog.d.ts +2 -2
- package/dist/components/version-dialog.js +322 -129
- package/dist/components/workspace-brand.d.ts +1 -1
- package/dist/components/workspace-brand.js +12 -3
- package/dist/components/workspace-logo.d.ts +2 -2
- package/dist/components/workspace-logo.js +15 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -19
- package/dist/lib/utils.js +7 -4
- package/dist/lib/version-notes.js +14 -29
- package/package.json +18 -16
- package/src/components/account-drawer.tsx +48 -67
- package/src/components/on-screen-controls.tsx +55 -62
- package/src/components/scene-settings.tsx +97 -100
- package/src/components/theme-provider.tsx +122 -22
- package/src/components/theme-toggle.tsx +29 -54
- package/src/components/ui/badge.tsx +14 -23
- package/src/components/ui/button.tsx +9 -11
- package/src/components/ui/card.tsx +9 -6
- package/src/components/ui/dialog.tsx +58 -55
- package/src/components/ui/drawer.tsx +84 -125
- package/src/components/ui/dropdown-menu.tsx +130 -153
- package/src/components/ui/empty.tsx +29 -26
- package/src/components/ui/field.tsx +83 -87
- package/src/components/ui/input.tsx +8 -8
- package/src/components/ui/label.tsx +6 -7
- package/src/components/ui/radio-group.tsx +22 -19
- package/src/components/ui/separator.tsx +16 -9
- package/src/components/ui/skeleton.tsx +6 -3
- package/src/components/ui/spinner.tsx +9 -5
- package/src/components/ui/switch.tsx +47 -20
- package/src/components/ui/tabs.tsx +31 -30
- package/src/components/ui/toggle-group.tsx +65 -54
- package/src/components/ui/toggle.tsx +9 -12
- package/src/components/ui/tooltip.tsx +41 -36
- package/src/components/version-dialog.tsx +144 -144
- package/src/components/workspace-brand.tsx +5 -5
- package/src/components/workspace-logo.tsx +9 -8
- package/src/index.tsx +7 -1
- package/src/styles/base.css +637 -0
- package/src/styles/globals.css +1 -1
- package/tsconfig.json +2 -1
- package/components.json +0 -19
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Tabs as TabsPrimitive } from '@base-ui/react/tabs'
|
|
1
|
+
import { Tabs as TabsPrimitive } from '@kobalte/core/tabs'
|
|
4
2
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import { splitProps, type ComponentProps } from 'solid-js'
|
|
5
4
|
|
|
6
5
|
import { cn } from '#lib/utils'
|
|
7
6
|
|
|
8
|
-
function Tabs(
|
|
7
|
+
function Tabs(props: ComponentProps<typeof TabsPrimitive>) {
|
|
8
|
+
const [local, rest] = splitProps(props, ['class', 'orientation'])
|
|
9
9
|
return (
|
|
10
|
-
<TabsPrimitive
|
|
10
|
+
<TabsPrimitive
|
|
11
11
|
data-slot="tabs"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{...
|
|
12
|
+
orientation={local.orientation}
|
|
13
|
+
class={cn('group/tabs flex gap-2 data-[orientation=horizontal]:flex-col', local.class)}
|
|
14
|
+
{...rest}
|
|
15
15
|
/>
|
|
16
16
|
)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const tabsListVariants = cva(
|
|
20
|
-
'group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none',
|
|
20
|
+
'group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-8 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none',
|
|
21
21
|
{
|
|
22
22
|
variants: {
|
|
23
23
|
variant: {
|
|
@@ -31,43 +31,44 @@ const tabsListVariants = cva(
|
|
|
31
31
|
}
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
-
function TabsList(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
|
|
34
|
+
function TabsList(
|
|
35
|
+
props: ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>
|
|
36
|
+
) {
|
|
37
|
+
const [local, rest] = splitProps(props, ['class', 'variant'])
|
|
39
38
|
return (
|
|
40
39
|
<TabsPrimitive.List
|
|
41
40
|
data-slot="tabs-list"
|
|
42
|
-
data-variant={variant}
|
|
43
|
-
|
|
44
|
-
{...
|
|
41
|
+
data-variant={local.variant ?? 'default'}
|
|
42
|
+
class={cn(tabsListVariants({ variant: local.variant }), local.class)}
|
|
43
|
+
{...rest}
|
|
45
44
|
/>
|
|
46
45
|
)
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
function TabsTrigger(
|
|
48
|
+
function TabsTrigger(props: ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
49
|
+
const [local, rest] = splitProps(props, ['class'])
|
|
50
50
|
return (
|
|
51
|
-
<TabsPrimitive.
|
|
51
|
+
<TabsPrimitive.Trigger
|
|
52
52
|
data-slot="tabs-trigger"
|
|
53
|
-
|
|
54
|
-
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-
|
|
55
|
-
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-
|
|
56
|
-
'data-
|
|
57
|
-
'after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-
|
|
58
|
-
|
|
53
|
+
class={cn(
|
|
54
|
+
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-selected:shadow-sm group-data-[variant=line]/tabs-list:data-selected:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
55
|
+
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-selected:bg-transparent dark:group-data-[variant=line]/tabs-list:data-selected:border-transparent dark:group-data-[variant=line]/tabs-list:data-selected:bg-transparent',
|
|
56
|
+
'data-selected:bg-background data-selected:text-foreground dark:data-selected:border-input dark:data-selected:bg-input/30 dark:data-selected:text-foreground',
|
|
57
|
+
'after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-selected:after:opacity-100',
|
|
58
|
+
local.class
|
|
59
59
|
)}
|
|
60
|
-
{...
|
|
60
|
+
{...rest}
|
|
61
61
|
/>
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
function TabsContent(
|
|
65
|
+
function TabsContent(props: ComponentProps<typeof TabsPrimitive.Content>) {
|
|
66
|
+
const [local, rest] = splitProps(props, ['class'])
|
|
66
67
|
return (
|
|
67
|
-
<TabsPrimitive.
|
|
68
|
+
<TabsPrimitive.Content
|
|
68
69
|
data-slot="tabs-content"
|
|
69
|
-
|
|
70
|
-
{...
|
|
70
|
+
class={cn('flex-1 text-sm outline-none', local.class)}
|
|
71
|
+
{...rest}
|
|
71
72
|
/>
|
|
72
73
|
)
|
|
73
74
|
}
|
|
@@ -1,87 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
import { Toggle as TogglePrimitive } from '@base-ui/react/toggle'
|
|
5
|
-
import { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group'
|
|
1
|
+
import { ToggleGroup as ToggleGroupPrimitive } from '@kobalte/core/toggle-group'
|
|
6
2
|
import { type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import { createContext, splitProps, useContext, type ComponentProps } from 'solid-js'
|
|
7
4
|
|
|
8
5
|
import { cn } from '#lib/utils'
|
|
9
6
|
import { toggleVariants } from '#components/ui/toggle'
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
>({
|
|
8
|
+
type ToggleGroupContextValue = VariantProps<typeof toggleVariants> & {
|
|
9
|
+
spacing: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ToggleGroupContext = createContext<ToggleGroupContextValue>({
|
|
17
13
|
size: 'default',
|
|
18
14
|
variant: 'default',
|
|
19
15
|
spacing: 2,
|
|
20
|
-
orientation: 'horizontal',
|
|
21
16
|
})
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
spacing = 2,
|
|
28
|
-
orientation = 'horizontal',
|
|
29
|
-
children,
|
|
30
|
-
...props
|
|
31
|
-
}: ToggleGroupPrimitive.Props &
|
|
18
|
+
type ToggleGroupProps = Omit<
|
|
19
|
+
ComponentProps<typeof ToggleGroupPrimitive>,
|
|
20
|
+
'multiple' | 'onChange' | 'value'
|
|
21
|
+
> &
|
|
32
22
|
VariantProps<typeof toggleVariants> & {
|
|
33
23
|
spacing?: number
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
value?: string[]
|
|
25
|
+
onChange?: (value: string[]) => void
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function ToggleGroup(props: ToggleGroupProps) {
|
|
29
|
+
const [local, rest] = splitProps(props, [
|
|
30
|
+
'class',
|
|
31
|
+
'variant',
|
|
32
|
+
'size',
|
|
33
|
+
'spacing',
|
|
34
|
+
'orientation',
|
|
35
|
+
'children',
|
|
36
|
+
'value',
|
|
37
|
+
'onChange',
|
|
38
|
+
])
|
|
39
|
+
|
|
36
40
|
return (
|
|
37
41
|
<ToggleGroupPrimitive
|
|
38
42
|
data-slot="toggle-group"
|
|
39
|
-
data-variant={variant}
|
|
40
|
-
data-size={size}
|
|
41
|
-
data-spacing={spacing}
|
|
42
|
-
data-orientation={orientation}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
data-variant={local.variant ?? 'default'}
|
|
44
|
+
data-size={local.size ?? 'default'}
|
|
45
|
+
data-spacing={local.spacing ?? 2}
|
|
46
|
+
data-orientation={local.orientation ?? 'horizontal'}
|
|
47
|
+
multiple
|
|
48
|
+
value={local.value}
|
|
49
|
+
onChange={local.onChange}
|
|
50
|
+
style={{ '--gap': local.spacing ?? 2 }}
|
|
51
|
+
class={cn(
|
|
52
|
+
'group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch',
|
|
53
|
+
local.class
|
|
47
54
|
)}
|
|
48
|
-
{...
|
|
55
|
+
{...rest}
|
|
49
56
|
>
|
|
50
|
-
<ToggleGroupContext.Provider
|
|
51
|
-
{
|
|
57
|
+
<ToggleGroupContext.Provider
|
|
58
|
+
value={{
|
|
59
|
+
variant: local.variant,
|
|
60
|
+
size: local.size,
|
|
61
|
+
spacing: local.spacing ?? 2,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{local.children}
|
|
52
65
|
</ToggleGroupContext.Provider>
|
|
53
66
|
</ToggleGroupPrimitive>
|
|
54
67
|
)
|
|
55
68
|
}
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {
|
|
64
|
-
const context = React.useContext(ToggleGroupContext)
|
|
70
|
+
type ToggleGroupItemProps = ComponentProps<typeof ToggleGroupPrimitive.Item> &
|
|
71
|
+
VariantProps<typeof toggleVariants>
|
|
72
|
+
|
|
73
|
+
function ToggleGroupItem(props: ToggleGroupItemProps) {
|
|
74
|
+
const [local, rest] = splitProps(props, ['class', 'children', 'variant', 'size'])
|
|
75
|
+
const context = useContext(ToggleGroupContext)
|
|
65
76
|
|
|
66
77
|
return (
|
|
67
|
-
<
|
|
78
|
+
<ToggleGroupPrimitive.Item
|
|
68
79
|
data-slot="toggle-group-item"
|
|
69
|
-
data-variant={context.variant
|
|
70
|
-
data-size={context.size
|
|
80
|
+
data-variant={context.variant ?? local.variant}
|
|
81
|
+
data-size={context.size ?? local.size}
|
|
71
82
|
data-spacing={context.spacing}
|
|
72
|
-
|
|
73
|
-
'shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t',
|
|
83
|
+
class={cn(
|
|
84
|
+
'shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t',
|
|
74
85
|
toggleVariants({
|
|
75
|
-
variant: context.variant
|
|
76
|
-
size: context.size
|
|
86
|
+
variant: context.variant ?? local.variant,
|
|
87
|
+
size: context.size ?? local.size,
|
|
77
88
|
}),
|
|
78
|
-
|
|
89
|
+
local.class
|
|
79
90
|
)}
|
|
80
|
-
{...
|
|
91
|
+
{...rest}
|
|
81
92
|
>
|
|
82
|
-
{children}
|
|
83
|
-
</
|
|
93
|
+
{local.children}
|
|
94
|
+
</ToggleGroupPrimitive.Item>
|
|
84
95
|
)
|
|
85
96
|
}
|
|
86
97
|
|
|
87
|
-
export { ToggleGroup, ToggleGroupItem }
|
|
98
|
+
export { ToggleGroup, ToggleGroupItem, type ToggleGroupItemProps, type ToggleGroupProps }
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Toggle as TogglePrimitive } from '@base-ui/react/toggle'
|
|
1
|
+
import { ToggleButton as TogglePrimitive } from '@kobalte/core/toggle-button'
|
|
4
2
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import { splitProps, type ComponentProps } from 'solid-js'
|
|
5
4
|
|
|
6
5
|
import { cn } from '#lib/utils'
|
|
7
6
|
|
|
8
7
|
const toggleVariants = cva(
|
|
9
|
-
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-
|
|
8
|
+
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-pressed:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
10
9
|
{
|
|
11
10
|
variants: {
|
|
12
11
|
variant: {
|
|
@@ -27,17 +26,15 @@ const toggleVariants = cva(
|
|
|
27
26
|
}
|
|
28
27
|
)
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
...props
|
|
35
|
-
}: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {
|
|
29
|
+
type ToggleProps = ComponentProps<typeof TogglePrimitive> & VariantProps<typeof toggleVariants>
|
|
30
|
+
|
|
31
|
+
function Toggle(props: ToggleProps) {
|
|
32
|
+
const [local, rest] = splitProps(props, ['class', 'variant', 'size'])
|
|
36
33
|
return (
|
|
37
34
|
<TogglePrimitive
|
|
38
35
|
data-slot="toggle"
|
|
39
|
-
|
|
40
|
-
{...
|
|
36
|
+
class={cn(toggleVariants({ variant: local.variant, size: local.size }), local.class)}
|
|
37
|
+
{...rest}
|
|
41
38
|
/>
|
|
42
39
|
)
|
|
43
40
|
}
|
|
@@ -1,54 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Tooltip as TooltipPrimitive } from '@kobalte/core/tooltip'
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
splitProps,
|
|
5
|
+
useContext,
|
|
6
|
+
type ComponentProps,
|
|
7
|
+
type ParentProps,
|
|
8
|
+
} from 'solid-js'
|
|
5
9
|
|
|
6
10
|
import { cn } from '#lib/utils'
|
|
7
11
|
|
|
8
12
|
const TOOLTIP_DELAY = 200
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
const TooltipDelayContext = createContext<number>(TOOLTIP_DELAY)
|
|
15
|
+
|
|
16
|
+
function TooltipProvider(props: ParentProps<{ delay?: number }>) {
|
|
17
|
+
return (
|
|
18
|
+
<TooltipDelayContext.Provider value={props.delay ?? TOOLTIP_DELAY}>
|
|
19
|
+
{props.children}
|
|
20
|
+
</TooltipDelayContext.Provider>
|
|
21
|
+
)
|
|
12
22
|
}
|
|
13
23
|
|
|
14
|
-
function Tooltip(
|
|
15
|
-
|
|
24
|
+
function Tooltip(props: ComponentProps<typeof TooltipPrimitive>) {
|
|
25
|
+
const delay = useContext(TooltipDelayContext)
|
|
26
|
+
return <TooltipPrimitive openDelay={delay} data-slot="tooltip" {...props} />
|
|
16
27
|
}
|
|
17
28
|
|
|
18
|
-
function TooltipTrigger(
|
|
29
|
+
function TooltipTrigger(props: ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
19
30
|
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
20
31
|
}
|
|
21
32
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
type TooltipContentProps = ComponentProps<typeof TooltipPrimitive.Content> & {
|
|
34
|
+
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
35
|
+
sideOffset?: number
|
|
36
|
+
align?: 'start' | 'center' | 'end'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function TooltipContent(props: TooltipContentProps) {
|
|
40
|
+
const [local, rest] = splitProps(props, ['class', 'side', 'sideOffset', 'align', 'children'])
|
|
41
|
+
const placement = () => `${local.side ?? 'top'}${local.align ? `-${local.align}` : ''}`
|
|
42
|
+
|
|
32
43
|
return (
|
|
33
44
|
<TooltipPrimitive.Portal>
|
|
34
|
-
<TooltipPrimitive.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
<TooltipPrimitive.Content
|
|
46
|
+
data-slot="tooltip-content"
|
|
47
|
+
placement={placement()}
|
|
48
|
+
gutter={local.sideOffset ?? 4}
|
|
49
|
+
class={cn(
|
|
50
|
+
'z-[160] max-w-72 rounded-md bg-popover px-2.5 py-1.5 text-sm leading-5 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-closed:animate-out data-closed:fade-out-0 data-expanded:animate-in data-expanded:fade-in-0',
|
|
51
|
+
local.class
|
|
52
|
+
)}
|
|
53
|
+
{...rest}
|
|
40
54
|
>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className={cn(
|
|
44
|
-
'max-w-72 rounded-md bg-popover px-2.5 py-1.5 text-sm leading-5 text-popover-foreground shadow-md ring-1 ring-foreground/10',
|
|
45
|
-
className
|
|
46
|
-
)}
|
|
47
|
-
{...props}
|
|
48
|
-
>
|
|
49
|
-
{children}
|
|
50
|
-
</TooltipPrimitive.Popup>
|
|
51
|
-
</TooltipPrimitive.Positioner>
|
|
55
|
+
{local.children}
|
|
56
|
+
</TooltipPrimitive.Content>
|
|
52
57
|
</TooltipPrimitive.Portal>
|
|
53
58
|
)
|
|
54
59
|
}
|