@lark-apaas/coding-templates 0.1.5 → 0.1.6

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.
Files changed (82) hide show
  1. package/package.json +1 -1
  2. package/template-vite-react/README.md +175 -0
  3. package/template-vite-react/client/index.html +2 -1
  4. package/template-vite-react/client/src/components/layout.tsx +0 -2
  5. package/template-vite-react/client/src/components/ui/README.md +134 -0
  6. package/template-vite-react/client/src/components/ui/accordion.tsx +22 -28
  7. package/template-vite-react/client/src/components/ui/alert-dialog.tsx +34 -64
  8. package/template-vite-react/client/src/components/ui/alert.tsx +10 -15
  9. package/template-vite-react/client/src/components/ui/aspect-ratio.tsx +5 -16
  10. package/template-vite-react/client/src/components/ui/avatar.tsx +11 -67
  11. package/template-vite-react/client/src/components/ui/badge.tsx +21 -31
  12. package/template-vite-react/client/src/components/ui/breadcrumb.tsx +23 -39
  13. package/template-vite-react/client/src/components/ui/button.tsx +36 -25
  14. package/template-vite-react/client/src/components/ui/calendar.tsx +37 -43
  15. package/template-vite-react/client/src/components/ui/card.tsx +73 -94
  16. package/template-vite-react/client/src/components/ui/carousel.tsx +7 -8
  17. package/template-vite-react/client/src/components/ui/chart.tsx +35 -49
  18. package/template-vite-react/client/src/components/ui/checkbox.tsx +10 -7
  19. package/template-vite-react/client/src/components/ui/collapsible.tsx +20 -6
  20. package/template-vite-react/client/src/components/ui/command.tsx +52 -40
  21. package/template-vite-react/client/src/components/ui/context-menu.tsx +170 -117
  22. package/template-vite-react/client/src/components/ui/dialog.tsx +37 -52
  23. package/template-vite-react/client/src/components/ui/drawer.tsx +12 -9
  24. package/template-vite-react/client/src/components/ui/dropdown-menu.tsx +194 -133
  25. package/template-vite-react/client/src/components/ui/hover-card.tsx +24 -29
  26. package/template-vite-react/client/src/components/ui/input-group.tsx +39 -29
  27. package/template-vite-react/client/src/components/ui/input-otp.tsx +7 -17
  28. package/template-vite-react/client/src/components/ui/input.tsx +4 -3
  29. package/template-vite-react/client/src/components/ui/label.tsx +9 -3
  30. package/template-vite-react/client/src/components/ui/menubar.tsx +160 -92
  31. package/template-vite-react/client/src/components/ui/navigation-menu.tsx +45 -45
  32. package/template-vite-react/client/src/components/ui/pagination.tsx +32 -35
  33. package/template-vite-react/client/src/components/ui/popover.tsx +20 -62
  34. package/template-vite-react/client/src/components/ui/progress.tsx +14 -64
  35. package/template-vite-react/client/src/components/ui/radio-group.tsx +20 -13
  36. package/template-vite-react/client/src/components/ui/resizable.tsx +18 -10
  37. package/template-vite-react/client/src/components/ui/scroll-area.tsx +13 -10
  38. package/template-vite-react/client/src/components/ui/select.tsx +122 -78
  39. package/template-vite-react/client/src/components/ui/separator.tsx +7 -4
  40. package/template-vite-react/client/src/components/ui/sheet.tsx +42 -41
  41. package/template-vite-react/client/src/components/ui/sidebar.tsx +162 -156
  42. package/template-vite-react/client/src/components/ui/skeleton.tsx +1 -1
  43. package/template-vite-react/client/src/components/ui/slider.tsx +52 -22
  44. package/template-vite-react/client/src/components/ui/sonner.tsx +44 -26
  45. package/template-vite-react/client/src/components/ui/switch.tsx +9 -8
  46. package/template-vite-react/client/src/components/ui/table.tsx +5 -5
  47. package/template-vite-react/client/src/components/ui/tabs.tsx +24 -38
  48. package/template-vite-react/client/src/components/ui/textarea.tsx +1 -1
  49. package/template-vite-react/client/src/components/ui/toggle-group.tsx +14 -20
  50. package/template-vite-react/client/src/components/ui/toggle.tsx +13 -10
  51. package/template-vite-react/client/src/components/ui/tooltip.tsx +30 -33
  52. package/template-vite-react/client/src/index.css +130 -0
  53. package/template-vite-react/client/src/main.tsx +1 -4
  54. package/template-vite-react/components.json +2 -6
  55. package/template-vite-react/eslint.config.js +11 -0
  56. package/template-vite-react/package.json +27 -2
  57. package/template-vite-react/client/src/components/header.tsx +0 -22
  58. package/template-vite-react/client/src/components/theme-provider.tsx +0 -45
  59. package/template-vite-react/client/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -21
  60. package/template-vite-react/client/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -36
  61. package/template-vite-react/client/src/components/ui/icons/file-android-colorful-icon.tsx +0 -33
  62. package/template-vite-react/client/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -21
  63. package/template-vite-react/client/src/components/ui/icons/file-code-colorful-icon.tsx +0 -28
  64. package/template-vite-react/client/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -21
  65. package/template-vite-react/client/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -29
  66. package/template-vite-react/client/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -25
  67. package/template-vite-react/client/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -29
  68. package/template-vite-react/client/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -29
  69. package/template-vite-react/client/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -21
  70. package/template-vite-react/client/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -21
  71. package/template-vite-react/client/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -21
  72. package/template-vite-react/client/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -29
  73. package/template-vite-react/client/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -23
  74. package/template-vite-react/client/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -27
  75. package/template-vite-react/client/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -20
  76. package/template-vite-react/client/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -21
  77. package/template-vite-react/client/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -12
  78. package/template-vite-react/client/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -14
  79. package/template-vite-react/client/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -23
  80. package/template-vite-react/client/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -38
  81. package/template-vite-react/client/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -21
  82. package/template-vite-react/client/src/types/index.ts +0 -1
@@ -1,49 +1,67 @@
1
- "use client"
1
+ 'use client';
2
2
 
3
- import { useTheme } from "next-themes"
4
- import { Toaster as Sonner, type ToasterProps } from "sonner"
5
- import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
3
+ import * as React from 'react';
4
+ import { cn } from '@/lib/utils';
5
+ import {
6
+ CircleAlertIcon,
7
+ CircleCheckIcon,
8
+ CircleXIcon,
9
+ InfoIcon,
10
+ Loader2Icon,
11
+ XIcon,
12
+ } from 'lucide-react';
13
+ import { useTheme } from 'next-themes';
14
+ import { Toaster as Sonner, type ToasterProps } from 'sonner';
6
15
 
7
- const Toaster = ({ ...props }: ToasterProps) => {
8
- const { theme = "system" } = useTheme()
16
+ function Toaster({ className, style, icons, ...props }: ToasterProps) {
17
+ const { theme = 'system' } = useTheme();
9
18
 
10
19
  return (
11
20
  <Sonner
12
- theme={theme as ToasterProps["theme"]}
13
- className="toaster group"
21
+ theme={theme as ToasterProps['theme']}
22
+ className={cn('toaster group', className)}
23
+ position="top-center"
14
24
  icons={{
15
25
  success: (
16
- <CircleCheckIcon className="size-4" />
26
+ <CircleCheckIcon
27
+ fill="currentColor"
28
+ className="size-4 text-success [&>:not(circle)]:stroke-(--normal-bg)"
29
+ />
17
30
  ),
18
31
  info: (
19
- <InfoIcon className="size-4" />
32
+ <InfoIcon
33
+ fill="currentColor"
34
+ className="size-4 text-info [&>:not(circle)]:stroke-(--normal-bg)"
35
+ />
20
36
  ),
21
37
  warning: (
22
- <TriangleAlertIcon className="size-4" />
38
+ <CircleAlertIcon
39
+ fill="currentColor"
40
+ className="size-4 text-warning [&>:not(circle)]:stroke-(--normal-bg)"
41
+ />
23
42
  ),
24
43
  error: (
25
- <OctagonXIcon className="size-4" />
26
- ),
27
- loading: (
28
- <Loader2Icon className="size-4 animate-spin" />
44
+ <CircleXIcon
45
+ fill="currentColor"
46
+ className="size-4 text-destructive [&>:not(circle)]:stroke-(--normal-bg)"
47
+ />
29
48
  ),
49
+ close: <XIcon className="size-4 text-accent-foreground" />,
50
+ loading: <Loader2Icon className="size-4 animate-spin text-primary" />,
51
+ ...icons,
30
52
  }}
31
53
  style={
32
54
  {
33
- "--normal-bg": "var(--popover)",
34
- "--normal-text": "var(--popover-foreground)",
35
- "--normal-border": "var(--border)",
36
- "--border-radius": "var(--radius)",
55
+ '--normal-bg': 'var(--popover)',
56
+ '--normal-text': 'var(--popover-foreground)',
57
+ '--normal-border': 'var(--border)',
58
+ '--border-radius': 'var(--radius)',
59
+ ...style,
37
60
  } as React.CSSProperties
38
61
  }
39
- toastOptions={{
40
- classNames: {
41
- toast: "cn-toast",
42
- },
43
- }}
44
62
  {...props}
45
63
  />
46
- )
64
+ );
47
65
  }
48
66
 
49
- export { Toaster }
67
+ export { Toaster };
@@ -1,27 +1,28 @@
1
- import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SwitchPrimitive from "@radix-ui/react-switch"
2
5
 
3
6
  import { cn } from "@/lib/utils"
4
7
 
5
8
  function Switch({
6
9
  className,
7
- size = "default",
8
10
  ...props
9
- }: SwitchPrimitive.Root.Props & {
10
- size?: "sm" | "default"
11
- }) {
11
+ }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
12
12
  return (
13
13
  <SwitchPrimitive.Root
14
14
  data-slot="switch"
15
- data-size={size}
16
15
  className={cn(
17
- "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:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
16
+ "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/20 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:data-state:bg-muted",
18
17
  className
19
18
  )}
20
19
  {...props}
21
20
  >
22
21
  <SwitchPrimitive.Thumb
23
22
  data-slot="switch-thumb"
24
- className="pointer-events-none block rounded-full bg-background 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)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
23
+ className={cn(
24
+ "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 data-disabled:opacity-60"
25
+ )}
25
26
  />
26
27
  </SwitchPrimitive.Root>
27
28
  )
@@ -44,7 +44,7 @@ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
44
44
  <tfoot
45
45
  data-slot="table-footer"
46
46
  className={cn(
47
- "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
47
+ "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
48
48
  className
49
49
  )}
50
50
  {...props}
@@ -57,7 +57,7 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
57
57
  <tr
58
58
  data-slot="table-row"
59
59
  className={cn(
60
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
60
+ "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
61
61
  className
62
62
  )}
63
63
  {...props}
@@ -70,7 +70,7 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
70
70
  <th
71
71
  data-slot="table-head"
72
72
  className={cn(
73
- "h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
73
+ "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
74
74
  className
75
75
  )}
76
76
  {...props}
@@ -83,7 +83,7 @@ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
83
83
  <td
84
84
  data-slot="table-cell"
85
85
  className={cn(
86
- "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
86
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
87
87
  className
88
88
  )}
89
89
  {...props}
@@ -98,7 +98,7 @@ function TableCaption({
98
98
  return (
99
99
  <caption
100
100
  data-slot="table-caption"
101
- className={cn("mt-4 text-sm text-muted-foreground", className)}
101
+ className={cn("text-muted-foreground mt-4 text-sm", className)}
102
102
  {...props}
103
103
  />
104
104
  )
@@ -1,65 +1,48 @@
1
- import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
2
- import { cva, type VariantProps } from "class-variance-authority"
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as TabsPrimitive from "@radix-ui/react-tabs"
3
5
 
4
6
  import { cn } from "@/lib/utils"
5
7
 
6
8
  function Tabs({
7
9
  className,
8
- orientation = "horizontal",
9
10
  ...props
10
- }: TabsPrimitive.Root.Props) {
11
+ }: React.ComponentProps<typeof TabsPrimitive.Root>) {
11
12
  return (
12
13
  <TabsPrimitive.Root
13
14
  data-slot="tabs"
14
- data-orientation={orientation}
15
- className={cn(
16
- "group/tabs flex gap-2 data-horizontal:flex-col",
17
- className
18
- )}
15
+ className={cn("flex flex-col gap-2", className)}
19
16
  {...props}
20
17
  />
21
18
  )
22
19
  }
23
20
 
24
- const tabsListVariants = cva(
25
- "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",
26
- {
27
- variants: {
28
- variant: {
29
- default: "bg-muted",
30
- line: "gap-1 bg-transparent",
31
- },
32
- },
33
- defaultVariants: {
34
- variant: "default",
35
- },
36
- }
37
- )
38
-
39
21
  function TabsList({
40
22
  className,
41
- variant = "default",
42
23
  ...props
43
- }: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
24
+ }: React.ComponentProps<typeof TabsPrimitive.List>) {
44
25
  return (
45
26
  <TabsPrimitive.List
46
27
  data-slot="tabs-list"
47
- data-variant={variant}
48
- className={cn(tabsListVariants({ variant }), className)}
28
+ className={cn(
29
+ "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
30
+ className
31
+ )}
49
32
  {...props}
50
33
  />
51
34
  )
52
35
  }
53
36
 
54
- function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
37
+ function TabsTrigger({
38
+ className,
39
+ ...props
40
+ }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
55
41
  return (
56
- <TabsPrimitive.Tab
42
+ <TabsPrimitive.Trigger
57
43
  data-slot="tabs-trigger"
58
44
  className={cn(
59
- "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 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground 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",
60
- "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",
61
- "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
62
- "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-active:after:opacity-100",
45
+ "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm data-[state=active]:font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:cursor-not-allowed disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
63
46
  className
64
47
  )}
65
48
  {...props}
@@ -67,14 +50,17 @@ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
67
50
  )
68
51
  }
69
52
 
70
- function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
53
+ function TabsContent({
54
+ className,
55
+ ...props
56
+ }: React.ComponentProps<typeof TabsPrimitive.Content>) {
71
57
  return (
72
- <TabsPrimitive.Panel
58
+ <TabsPrimitive.Content
73
59
  data-slot="tabs-content"
74
- className={cn("flex-1 text-sm outline-none", className)}
60
+ className={cn("flex-1 outline-none", className)}
75
61
  {...props}
76
62
  />
77
63
  )
78
64
  }
79
65
 
80
- export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
66
+ export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
7
7
  <textarea
8
8
  data-slot="textarea"
9
9
  className={cn(
10
- "flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
10
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base transition-[color,box-shadow] outline-none focus-visible:ring-[3px] enabled:hover:border-primary disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
11
11
  className
12
12
  )}
13
13
  {...props}
@@ -1,8 +1,7 @@
1
1
  "use client"
2
2
 
3
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"
4
+ import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
6
5
  import { type VariantProps } from "class-variance-authority"
7
6
 
8
7
  import { cn } from "@/lib/utils"
@@ -11,13 +10,11 @@ import { toggleVariants } from "@/components/ui/toggle"
11
10
  const ToggleGroupContext = React.createContext<
12
11
  VariantProps<typeof toggleVariants> & {
13
12
  spacing?: number
14
- orientation?: "horizontal" | "vertical"
15
13
  }
16
14
  >({
17
15
  size: "default",
18
16
  variant: "default",
19
17
  spacing: 0,
20
- orientation: "horizontal",
21
18
  })
22
19
 
23
20
  function ToggleGroup({
@@ -25,64 +22,61 @@ function ToggleGroup({
25
22
  variant,
26
23
  size,
27
24
  spacing = 0,
28
- orientation = "horizontal",
29
25
  children,
30
26
  ...props
31
- }: ToggleGroupPrimitive.Props &
27
+ }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
32
28
  VariantProps<typeof toggleVariants> & {
33
29
  spacing?: number
34
- orientation?: "horizontal" | "vertical"
35
30
  }) {
36
31
  return (
37
- <ToggleGroupPrimitive
32
+ <ToggleGroupPrimitive.Root
38
33
  data-slot="toggle-group"
39
34
  data-variant={variant}
40
35
  data-size={size}
41
36
  data-spacing={spacing}
42
- data-orientation={orientation}
43
37
  style={{ "--gap": spacing } as React.CSSProperties}
44
38
  className={cn(
45
- "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-vertical:flex-col data-vertical:items-stretch",
39
+ "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
46
40
  className
47
41
  )}
48
42
  {...props}
49
43
  >
50
- <ToggleGroupContext.Provider
51
- value={{ variant, size, spacing, orientation }}
52
- >
44
+ <ToggleGroupContext.Provider value={{ variant, size, spacing }}>
53
45
  {children}
54
46
  </ToggleGroupContext.Provider>
55
- </ToggleGroupPrimitive>
47
+ </ToggleGroupPrimitive.Root>
56
48
  )
57
49
  }
58
50
 
59
51
  function ToggleGroupItem({
60
52
  className,
61
53
  children,
62
- variant = "default",
63
- size = "default",
54
+ variant,
55
+ size,
64
56
  ...props
65
- }: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {
57
+ }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
58
+ VariantProps<typeof toggleVariants>) {
66
59
  const context = React.useContext(ToggleGroupContext)
67
60
 
68
61
  return (
69
- <TogglePrimitive
62
+ <ToggleGroupPrimitive.Item
70
63
  data-slot="toggle-group-item"
71
64
  data-variant={context.variant || variant}
72
65
  data-size={context.size || size}
73
66
  data-spacing={context.spacing}
74
67
  className={cn(
75
- "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",
76
68
  toggleVariants({
77
69
  variant: context.variant || variant,
78
70
  size: context.size || size,
79
71
  }),
72
+ "w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10",
73
+ "data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",
80
74
  className
81
75
  )}
82
76
  {...props}
83
77
  >
84
78
  {children}
85
- </TogglePrimitive>
79
+ </ToggleGroupPrimitive.Item>
86
80
  )
87
81
  }
88
82
 
@@ -1,22 +1,24 @@
1
1
  "use client"
2
2
 
3
- import { Toggle as TogglePrimitive } from "@base-ui/react/toggle"
3
+ import * as React from "react"
4
+ import * as TogglePrimitive from "@radix-ui/react-toggle"
4
5
  import { cva, type VariantProps } from "class-variance-authority"
5
6
 
6
7
  import { cn } from "@/lib/utils"
7
8
 
8
9
  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-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
10
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-normal enabled:hover:bg-muted enabled:hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/20 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
10
11
  {
11
12
  variants: {
12
13
  variant: {
13
14
  default: "bg-transparent",
14
- outline: "border border-input bg-transparent hover:bg-muted",
15
+ outline:
16
+ "border border-input bg-transparent enabled:hover:bg-accent enabled:hover:text-accent-foreground",
15
17
  },
16
18
  size: {
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",
19
+ default: "h-9 px-2 min-w-9",
20
+ sm: "h-8 px-1.5 min-w-8",
21
+ lg: "h-10 px-2.5 min-w-10",
20
22
  },
21
23
  },
22
24
  defaultVariants: {
@@ -28,12 +30,13 @@ const toggleVariants = cva(
28
30
 
29
31
  function Toggle({
30
32
  className,
31
- variant = "default",
32
- size = "default",
33
+ variant,
34
+ size,
33
35
  ...props
34
- }: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {
36
+ }: React.ComponentProps<typeof TogglePrimitive.Root> &
37
+ VariantProps<typeof toggleVariants>) {
35
38
  return (
36
- <TogglePrimitive
39
+ <TogglePrimitive.Root
37
40
  data-slot="toggle"
38
41
  className={cn(toggleVariants({ variant, size, className }))}
39
42
  {...props}
@@ -1,62 +1,59 @@
1
- import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip"
2
5
 
3
6
  import { cn } from "@/lib/utils"
4
7
 
5
8
  function TooltipProvider({
6
- delay = 0,
9
+ delayDuration = 0,
7
10
  ...props
8
- }: TooltipPrimitive.Provider.Props) {
11
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
9
12
  return (
10
13
  <TooltipPrimitive.Provider
11
14
  data-slot="tooltip-provider"
12
- delay={delay}
15
+ delayDuration={delayDuration}
13
16
  {...props}
14
17
  />
15
18
  )
16
19
  }
17
20
 
18
- function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
19
- return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
21
+ function Tooltip({
22
+ ...props
23
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
24
+ return (
25
+ <TooltipProvider>
26
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
27
+ </TooltipProvider>
28
+ )
20
29
  }
21
30
 
22
- function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
31
+ function TooltipTrigger({
32
+ ...props
33
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
23
34
  return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
24
35
  }
25
36
 
26
37
  function TooltipContent({
27
38
  className,
28
- side = "top",
29
- sideOffset = 4,
30
- align = "center",
31
- alignOffset = 0,
39
+ sideOffset = 0,
32
40
  children,
33
41
  ...props
34
- }: TooltipPrimitive.Popup.Props &
35
- Pick<
36
- TooltipPrimitive.Positioner.Props,
37
- "align" | "alignOffset" | "side" | "sideOffset"
38
- >) {
42
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
39
43
  return (
40
44
  <TooltipPrimitive.Portal>
41
- <TooltipPrimitive.Positioner
42
- align={align}
43
- alignOffset={alignOffset}
44
- side={side}
45
+ <TooltipPrimitive.Content
46
+ data-slot="tooltip-content"
45
47
  sideOffset={sideOffset}
46
- className="isolate z-50"
48
+ className={cn(
49
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance shadow-md",
50
+ className
51
+ )}
52
+ {...props}
47
53
  >
48
- <TooltipPrimitive.Popup
49
- data-slot="tooltip-content"
50
- className={cn(
51
- "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
52
- className
53
- )}
54
- {...props}
55
- >
56
- {children}
57
- <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" />
58
- </TooltipPrimitive.Popup>
59
- </TooltipPrimitive.Positioner>
54
+ {children}
55
+ <TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
56
+ </TooltipPrimitive.Content>
60
57
  </TooltipPrimitive.Portal>
61
58
  )
62
59
  }