@betterstart/cli 0.1.27 → 0.1.29
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/{chunk-SAPJG4NO.js → chunk-6JCWMKSY.js} +7 -4
- package/dist/{chunk-SAPJG4NO.js.map → chunk-6JCWMKSY.js.map} +1 -1
- package/dist/cli.js +987 -1035
- package/dist/cli.js.map +1 -1
- package/dist/drizzle-config-EDKOEZ6G.js +7 -0
- package/package.json +1 -1
- package/templates/ui/accordion.tsx +73 -42
- package/templates/ui/alert-dialog.tsx +155 -90
- package/templates/ui/alert.tsx +46 -26
- package/templates/ui/aspect-ratio.tsx +4 -2
- package/templates/ui/avatar.tsx +92 -43
- package/templates/ui/badge.tsx +27 -12
- package/templates/ui/breadcrumb.tsx +63 -60
- package/templates/ui/button-group.tsx +8 -8
- package/templates/ui/button.tsx +44 -26
- package/templates/ui/calendar.tsx +43 -34
- package/templates/ui/card.tsx +71 -34
- package/templates/ui/carousel.tsx +111 -115
- package/templates/ui/chart.tsx +197 -207
- package/templates/ui/checkbox.tsx +21 -20
- package/templates/ui/collapsible.tsx +14 -4
- package/templates/ui/combobox.tsx +272 -0
- package/templates/ui/command.tsx +139 -101
- package/templates/ui/context-menu.tsx +214 -156
- package/templates/ui/dialog.tsx +118 -77
- package/templates/ui/direction.tsx +20 -0
- package/templates/ui/drawer.tsx +89 -69
- package/templates/ui/dropdown-menu.tsx +228 -164
- package/templates/ui/empty.tsx +8 -5
- package/templates/ui/field.tsx +25 -32
- package/templates/ui/hover-card.tsx +29 -20
- package/templates/ui/input-group.tsx +20 -37
- package/templates/ui/input-otp.tsx +57 -42
- package/templates/ui/input.tsx +14 -17
- package/templates/ui/item.tsx +27 -17
- package/templates/ui/kbd.tsx +1 -3
- package/templates/ui/label.tsx +14 -14
- package/templates/ui/markdown-editor.tsx +1 -1
- package/templates/ui/menubar.tsx +220 -188
- package/templates/ui/native-select.tsx +42 -0
- package/templates/ui/navigation-menu.tsx +130 -90
- package/templates/ui/pagination.tsx +88 -73
- package/templates/ui/popover.tsx +67 -26
- package/templates/ui/progress.tsx +24 -18
- package/templates/ui/radio-group.tsx +26 -20
- package/templates/ui/resizable.tsx +29 -29
- package/templates/ui/scroll-area.tsx +47 -38
- package/templates/ui/select.tsx +158 -125
- package/templates/ui/separator.tsx +21 -19
- package/templates/ui/sheet.tsx +104 -95
- package/templates/ui/sidebar.tsx +77 -183
- package/templates/ui/skeleton.tsx +8 -2
- package/templates/ui/slider.tsx +46 -17
- package/templates/ui/sonner.tsx +19 -9
- package/templates/ui/spinner.tsx +2 -2
- package/templates/ui/switch.tsx +24 -20
- package/templates/ui/table.tsx +68 -73
- package/templates/ui/tabs.tsx +71 -46
- package/templates/ui/textarea.tsx +13 -16
- package/templates/ui/toggle-group.tsx +57 -28
- package/templates/ui/toggle.tsx +21 -20
- package/templates/ui/tooltip.tsx +44 -23
- package/dist/drizzle-config-KISB26BA.js +0 -7
- package/templates/ui/use-mobile.tsx +0 -19
- /package/dist/{drizzle-config-KISB26BA.js.map → drizzle-config-EDKOEZ6G.js.map} +0 -0
package/templates/ui/switch.tsx
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { cn } from '@cms/utils/cn'
|
|
4
|
-
import
|
|
5
|
-
import * as React from 'react'
|
|
4
|
+
import { Switch as SwitchPrimitive } from 'radix-ui'
|
|
5
|
+
import type * as React from 'react'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
<SwitchPrimitives.Thumb
|
|
7
|
+
function Switch({
|
|
8
|
+
className,
|
|
9
|
+
size = 'default',
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
12
|
+
size?: 'sm' | 'default'
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<SwitchPrimitive.Root
|
|
16
|
+
data-slot="switch"
|
|
17
|
+
data-size={size}
|
|
20
18
|
className={cn(
|
|
21
|
-
'
|
|
19
|
+
'data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]',
|
|
20
|
+
className
|
|
22
21
|
)}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
<SwitchPrimitive.Thumb
|
|
25
|
+
data-slot="switch-thumb"
|
|
26
|
+
className="bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"
|
|
27
|
+
/>
|
|
28
|
+
</SwitchPrimitive.Root>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
27
31
|
|
|
28
32
|
export { Switch }
|
package/templates/ui/table.tsx
CHANGED
|
@@ -1,93 +1,88 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
1
3
|
import { cn } from '@cms/utils/cn'
|
|
2
|
-
import * as React from 'react'
|
|
4
|
+
import type * as React from 'react'
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<div className="relative w-full overflow-auto">
|
|
7
|
-
<table
|
|
6
|
+
function Table({ className, ...props }: React.ComponentProps<'table'>) {
|
|
7
|
+
return (
|
|
8
|
+
<div data-slot="table-container" className="relative w-full overflow-x-auto">
|
|
9
|
+
<table
|
|
10
|
+
data-slot="table"
|
|
11
|
+
className={cn('w-full caption-bottom text-sm', className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
8
14
|
</div>
|
|
9
15
|
)
|
|
10
|
-
|
|
11
|
-
Table.displayName = 'Table'
|
|
16
|
+
}
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
>(({ className, ...props }, ref) => (
|
|
17
|
-
<thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />
|
|
18
|
-
))
|
|
19
|
-
TableHeader.displayName = 'TableHeader'
|
|
18
|
+
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
|
|
19
|
+
return <thead data-slot="table-header" className={cn('[&_tr]:border-b', className)} {...props} />
|
|
20
|
+
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
|
|
23
|
+
return (
|
|
24
|
+
<tbody
|
|
25
|
+
data-slot="table-body"
|
|
26
|
+
className={cn('[&_tr:last-child]:border-0', className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
))
|
|
39
|
-
TableFooter.displayName = 'TableFooter'
|
|
32
|
+
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
|
|
33
|
+
return (
|
|
34
|
+
<tfoot
|
|
35
|
+
data-slot="table-footer"
|
|
36
|
+
className={cn('bg-muted/50 border-t font-medium [&>tr]:last:border-b-0', className)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
|
|
43
|
+
return (
|
|
43
44
|
<tr
|
|
44
|
-
|
|
45
|
+
data-slot="table-row"
|
|
45
46
|
className={cn(
|
|
46
|
-
'
|
|
47
|
+
'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
|
|
47
48
|
className
|
|
48
49
|
)}
|
|
49
50
|
{...props}
|
|
50
51
|
/>
|
|
51
52
|
)
|
|
52
|
-
|
|
53
|
-
TableRow.displayName = 'TableRow'
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
))
|
|
68
|
-
TableHead.displayName = 'TableHead'
|
|
55
|
+
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
|
|
56
|
+
return (
|
|
57
|
+
<th
|
|
58
|
+
data-slot="table-head"
|
|
59
|
+
className={cn(
|
|
60
|
+
'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0',
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
)}
|
|
80
|
-
{...props}
|
|
81
|
-
/>
|
|
82
|
-
))
|
|
83
|
-
TableCell.displayName = 'TableCell'
|
|
68
|
+
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
|
|
69
|
+
return (
|
|
70
|
+
<td
|
|
71
|
+
data-slot="table-cell"
|
|
72
|
+
className={cn('p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0', className)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
84
77
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
78
|
+
function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
|
|
79
|
+
return (
|
|
80
|
+
<caption
|
|
81
|
+
data-slot="table-caption"
|
|
82
|
+
className={cn('text-muted-foreground mt-4 text-sm', className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
92
87
|
|
|
93
88
|
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption }
|
package/templates/ui/tabs.tsx
CHANGED
|
@@ -1,54 +1,79 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { cn } from '@cms/utils/cn'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
import { Tabs as TabsPrimitive } from 'radix-ui'
|
|
6
|
+
import type * as React from 'react'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
function Tabs({
|
|
9
|
+
className,
|
|
10
|
+
orientation = 'horizontal',
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
|
|
13
|
+
return (
|
|
14
|
+
<TabsPrimitive.Root
|
|
15
|
+
data-slot="tabs"
|
|
16
|
+
data-orientation={orientation}
|
|
17
|
+
className={cn('group/tabs flex gap-2 data-horizontal:flex-col', className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
8
22
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
const tabsListVariants = cva(
|
|
24
|
+
'rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col',
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
variant: {
|
|
28
|
+
default: 'bg-muted',
|
|
29
|
+
line: 'gap-1 bg-transparent'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: 'default'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
)
|
|
23
37
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
+
function TabsList({
|
|
39
|
+
className,
|
|
40
|
+
variant = 'default',
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>) {
|
|
43
|
+
return (
|
|
44
|
+
<TabsPrimitive.List
|
|
45
|
+
data-slot="tabs-list"
|
|
46
|
+
data-variant={variant}
|
|
47
|
+
className={cn(tabsListVariants({ variant }), className)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
|
|
54
|
+
return (
|
|
55
|
+
<TabsPrimitive.Trigger
|
|
56
|
+
data-slot="tabs-trigger"
|
|
57
|
+
className={cn(
|
|
58
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground 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 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
59
|
+
'group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent',
|
|
60
|
+
'data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground',
|
|
61
|
+
'after:bg-foreground after:absolute 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-active:after:opacity-100',
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
53
68
|
|
|
54
|
-
|
|
69
|
+
function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
|
70
|
+
return (
|
|
71
|
+
<TabsPrimitive.Content
|
|
72
|
+
data-slot="tabs-content"
|
|
73
|
+
className={cn('flex-1 text-sm outline-none', className)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { cn } from '@cms/utils/cn'
|
|
2
|
-
import * as React from 'react'
|
|
2
|
+
import type * as React from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
)
|
|
18
|
-
Textarea.displayName = 'Textarea'
|
|
4
|
+
function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
|
5
|
+
return (
|
|
6
|
+
<textarea
|
|
7
|
+
data-slot="textarea"
|
|
8
|
+
className={cn(
|
|
9
|
+
'border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full rounded-lg border bg-transparent px-2.5 py-2 text-base transition-colors outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm',
|
|
10
|
+
className
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
19
16
|
|
|
20
17
|
export { Textarea }
|
|
@@ -1,43 +1,74 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import { toggleVariants } from '@cms/components/ui/toggle'
|
|
3
4
|
import { cn } from '@cms/utils/cn'
|
|
4
|
-
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'
|
|
5
5
|
import type { VariantProps } from 'class-variance-authority'
|
|
6
|
+
import { ToggleGroup as ToggleGroupPrimitive } from 'radix-ui'
|
|
6
7
|
import * as React from 'react'
|
|
7
|
-
import { toggleVariants } from './toggle'
|
|
8
8
|
|
|
9
|
-
const ToggleGroupContext = React.createContext<
|
|
9
|
+
const ToggleGroupContext = React.createContext<
|
|
10
|
+
VariantProps<typeof toggleVariants> & {
|
|
11
|
+
spacing?: number
|
|
12
|
+
orientation?: 'horizontal' | 'vertical'
|
|
13
|
+
}
|
|
14
|
+
>({
|
|
10
15
|
size: 'default',
|
|
11
|
-
variant: 'default'
|
|
16
|
+
variant: 'default',
|
|
17
|
+
spacing: 0,
|
|
18
|
+
orientation: 'horizontal'
|
|
12
19
|
})
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
function ToggleGroup({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
size,
|
|
25
|
+
spacing = 0,
|
|
26
|
+
orientation = 'horizontal',
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
|
30
|
+
VariantProps<typeof toggleVariants> & {
|
|
31
|
+
spacing?: number
|
|
32
|
+
orientation?: 'horizontal' | 'vertical'
|
|
33
|
+
}) {
|
|
34
|
+
return (
|
|
35
|
+
<ToggleGroupPrimitive.Root
|
|
36
|
+
data-slot="toggle-group"
|
|
37
|
+
data-variant={variant}
|
|
38
|
+
data-size={size}
|
|
39
|
+
data-spacing={spacing}
|
|
40
|
+
data-orientation={orientation}
|
|
41
|
+
style={{ '--gap': spacing } as React.CSSProperties}
|
|
42
|
+
className={cn(
|
|
43
|
+
'group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-vertical:flex-col data-vertical:items-stretch data-[size=sm]:rounded-[min(var(--radius-md),10px)]',
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
<ToggleGroupContext.Provider value={{ variant, size, spacing, orientation }}>
|
|
49
|
+
{children}
|
|
50
|
+
</ToggleGroupContext.Provider>
|
|
51
|
+
</ToggleGroupPrimitive.Root>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
29
54
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
function ToggleGroupItem({
|
|
56
|
+
className,
|
|
57
|
+
children,
|
|
58
|
+
variant = 'default',
|
|
59
|
+
size = 'default',
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>) {
|
|
35
62
|
const context = React.useContext(ToggleGroupContext)
|
|
36
63
|
|
|
37
64
|
return (
|
|
38
65
|
<ToggleGroupPrimitive.Item
|
|
39
|
-
|
|
66
|
+
data-slot="toggle-group-item"
|
|
67
|
+
data-variant={context.variant || variant}
|
|
68
|
+
data-size={context.size || size}
|
|
69
|
+
data-spacing={context.spacing}
|
|
40
70
|
className={cn(
|
|
71
|
+
'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-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',
|
|
41
72
|
toggleVariants({
|
|
42
73
|
variant: context.variant || variant,
|
|
43
74
|
size: context.size || size
|
|
@@ -49,8 +80,6 @@ const ToggleGroupItem = React.forwardRef<
|
|
|
49
80
|
{children}
|
|
50
81
|
</ToggleGroupPrimitive.Item>
|
|
51
82
|
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
|
|
83
|
+
}
|
|
55
84
|
|
|
56
85
|
export { ToggleGroup, ToggleGroupItem }
|
package/templates/ui/toggle.tsx
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { cn } from '@cms/utils/cn'
|
|
4
|
-
import * as TogglePrimitive from '@radix-ui/react-toggle'
|
|
5
4
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
6
|
-
import
|
|
5
|
+
import { Toggle as TogglePrimitive } from 'radix-ui'
|
|
6
|
+
import type * as React from 'react'
|
|
7
7
|
|
|
8
8
|
const toggleVariants = cva(
|
|
9
|
-
|
|
9
|
+
"hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[state=on]:bg-muted gap-1 rounded-lg text-sm font-medium transition-all [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
variant: {
|
|
13
13
|
default: 'bg-transparent',
|
|
14
|
-
outline:
|
|
15
|
-
'border border-input-border bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground'
|
|
14
|
+
outline: 'border-input hover:bg-muted border bg-transparent'
|
|
16
15
|
},
|
|
17
16
|
size: {
|
|
18
|
-
default: 'h-
|
|
19
|
-
sm: 'h-
|
|
20
|
-
lg: 'h-
|
|
17
|
+
default: 'h-8 min-w-8 px-2',
|
|
18
|
+
sm: 'h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]',
|
|
19
|
+
lg: 'h-9 min-w-9 px-2.5'
|
|
21
20
|
}
|
|
22
21
|
},
|
|
23
22
|
defaultVariants: {
|
|
@@ -27,17 +26,19 @@ const toggleVariants = cva(
|
|
|
27
26
|
}
|
|
28
27
|
)
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
))
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
function Toggle({
|
|
30
|
+
className,
|
|
31
|
+
variant = 'default',
|
|
32
|
+
size = 'default',
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>) {
|
|
35
|
+
return (
|
|
36
|
+
<TogglePrimitive.Root
|
|
37
|
+
data-slot="toggle"
|
|
38
|
+
className={cn(toggleVariants({ variant, size, className }))}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
42
43
|
|
|
43
44
|
export { Toggle, toggleVariants }
|
package/templates/ui/tooltip.tsx
CHANGED
|
@@ -1,31 +1,52 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { cn } from '@cms/utils/cn'
|
|
4
|
-
import
|
|
5
|
-
import * as React from 'react'
|
|
4
|
+
import { Tooltip as TooltipPrimitive } from 'radix-ui'
|
|
5
|
+
import type * as React from 'react'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function TooltipProvider({
|
|
8
|
+
delayDuration = 0,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
11
|
+
return (
|
|
12
|
+
<TooltipPrimitive.Provider
|
|
13
|
+
data-slot="tooltip-provider"
|
|
14
|
+
delayDuration={delayDuration}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
21
|
+
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
22
|
+
}
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
25
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
26
|
+
}
|
|
12
27
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
function TooltipContent({
|
|
29
|
+
className,
|
|
30
|
+
sideOffset = 0,
|
|
31
|
+
children,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
34
|
+
return (
|
|
35
|
+
<TooltipPrimitive.Portal>
|
|
36
|
+
<TooltipPrimitive.Content
|
|
37
|
+
data-slot="tooltip-content"
|
|
38
|
+
sideOffset={sideOffset}
|
|
39
|
+
className={cn(
|
|
40
|
+
'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-foreground text-background z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs',
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
<TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
|
47
|
+
</TooltipPrimitive.Content>
|
|
48
|
+
</TooltipPrimitive.Portal>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
30
51
|
|
|
31
|
-
export { Tooltip,
|
|
52
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }
|