tokka-ui 0.1.0 → 0.2.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.
Files changed (157) hide show
  1. package/dist/accordion.d.ts +9 -0
  2. package/dist/accordion.js +51 -0
  3. package/dist/alert-dialog.d.ts +23 -0
  4. package/dist/alert-dialog.js +122 -0
  5. package/dist/alert.d.ts +11 -0
  6. package/dist/alert.js +55 -0
  7. package/dist/aspect-ratio.d.ts +6 -0
  8. package/dist/aspect-ratio.js +6 -0
  9. package/dist/avatar.d.ts +8 -0
  10. package/dist/avatar.js +46 -0
  11. package/dist/badge.d.ts +13 -0
  12. package/dist/badge.js +31 -0
  13. package/dist/breadcrumb.d.ts +22 -0
  14. package/dist/breadcrumb.js +97 -0
  15. package/dist/button.d.ts +1 -1
  16. package/dist/button.js +4 -51
  17. package/dist/calendar.d.ts +11 -0
  18. package/dist/calendar.js +8 -0
  19. package/dist/carousel.d.ts +23 -0
  20. package/dist/carousel.js +200 -0
  21. package/dist/chart.d.ts +1 -0
  22. package/dist/chart.js +2 -0
  23. package/dist/checkbox.d.ts +6 -0
  24. package/dist/checkbox.js +31 -0
  25. package/dist/chunk-63HUTNB3.js +92 -0
  26. package/dist/chunk-7BHODGBN.js +25 -0
  27. package/dist/chunk-A4HW2TQU.js +66 -0
  28. package/dist/chunk-BOKKBA25.js +30 -0
  29. package/dist/chunk-DVPPDIDA.js +57 -0
  30. package/dist/chunk-FJGEWLIV.js +109 -0
  31. package/dist/chunk-KDTBFEE2.js +123 -0
  32. package/dist/chunk-PLLTYLGO.js +120 -0
  33. package/dist/chunk-QBAV4RWS.js +43 -0
  34. package/dist/collapsible.d.ts +8 -0
  35. package/dist/collapsible.js +10 -0
  36. package/dist/combobox.d.ts +6 -0
  37. package/dist/combobox.js +32 -0
  38. package/dist/command.d.ts +85 -0
  39. package/dist/command.js +24 -0
  40. package/dist/context-menu.d.ts +30 -0
  41. package/dist/context-menu.js +157 -0
  42. package/dist/data-table.d.ts +2 -0
  43. package/dist/data-table.js +21 -0
  44. package/dist/date-picker.d.ts +6 -0
  45. package/dist/date-picker.js +16 -0
  46. package/dist/dialog.d.ts +22 -0
  47. package/dist/dialog.js +25 -0
  48. package/dist/drawer.d.ts +27 -0
  49. package/dist/drawer.js +105 -0
  50. package/dist/dropdown-menu.d.ts +30 -0
  51. package/dist/dropdown-menu.js +155 -0
  52. package/dist/form.d.ts +28 -0
  53. package/dist/form.js +120 -0
  54. package/dist/hover-card.d.ts +8 -0
  55. package/dist/hover-card.js +29 -0
  56. package/dist/input-otp.d.ts +37 -0
  57. package/dist/input-otp.js +53 -0
  58. package/dist/label.d.ts +8 -0
  59. package/dist/label.js +7 -0
  60. package/dist/menubar.d.ts +31 -0
  61. package/dist/menubar.js +186 -0
  62. package/dist/native-select.d.ts +7 -0
  63. package/dist/native-select.js +31 -0
  64. package/dist/navigation-menu.d.ts +15 -0
  65. package/dist/navigation-menu.js +111 -0
  66. package/dist/pagination.d.ts +33 -0
  67. package/dist/pagination.js +111 -0
  68. package/dist/popover.d.ts +8 -0
  69. package/dist/popover.js +11 -0
  70. package/dist/progress.d.ts +6 -0
  71. package/dist/progress.js +30 -0
  72. package/dist/radio-group.d.ts +7 -0
  73. package/dist/radio-group.js +39 -0
  74. package/dist/resizable.d.ts +27 -0
  75. package/dist/resizable.js +42 -0
  76. package/dist/scroll-area.d.ts +7 -0
  77. package/dist/scroll-area.js +42 -0
  78. package/dist/select.d.ts +15 -0
  79. package/dist/select.js +128 -0
  80. package/dist/separator.d.ts +6 -0
  81. package/dist/separator.js +28 -0
  82. package/dist/sheet.d.ts +29 -0
  83. package/dist/sheet.js +25 -0
  84. package/dist/sidebar.d.ts +30 -0
  85. package/dist/sidebar.js +203 -0
  86. package/dist/skeleton.d.ts +5 -0
  87. package/dist/skeleton.js +21 -0
  88. package/dist/slider.d.ts +6 -0
  89. package/dist/slider.js +27 -0
  90. package/dist/sonner.d.ts +7 -0
  91. package/dist/sonner.js +23 -0
  92. package/dist/spinner.d.ts +12 -0
  93. package/dist/spinner.js +29 -0
  94. package/dist/switch.d.ts +6 -0
  95. package/dist/switch.js +31 -0
  96. package/dist/table.d.ts +12 -0
  97. package/dist/table.js +21 -0
  98. package/dist/tabs.d.ts +9 -0
  99. package/dist/tabs.js +51 -0
  100. package/dist/textarea.d.ts +7 -0
  101. package/dist/textarea.js +26 -0
  102. package/dist/toggle-group.d.ts +15 -0
  103. package/dist/toggle-group.js +49 -0
  104. package/dist/toggle.d.ts +15 -0
  105. package/dist/toggle.js +9 -0
  106. package/dist/tooltip.d.ts +9 -0
  107. package/dist/tooltip.js +30 -0
  108. package/package.json +237 -8
  109. package/src/accordion.tsx +55 -0
  110. package/src/alert-dialog.tsx +138 -0
  111. package/src/alert.tsx +58 -0
  112. package/src/aspect-ratio.tsx +5 -0
  113. package/src/avatar.tsx +47 -0
  114. package/src/badge.tsx +35 -0
  115. package/src/breadcrumb.tsx +114 -0
  116. package/src/calendar.tsx +63 -0
  117. package/src/carousel.tsx +259 -0
  118. package/src/chart.tsx +9 -0
  119. package/src/checkbox.tsx +27 -0
  120. package/src/collapsible.tsx +9 -0
  121. package/src/combobox.tsx +8 -0
  122. package/src/command.tsx +152 -0
  123. package/src/context-menu.tsx +197 -0
  124. package/src/data-table.tsx +9 -0
  125. package/src/date-picker.tsx +8 -0
  126. package/src/dialog.tsx +119 -0
  127. package/src/drawer.tsx +115 -0
  128. package/src/dropdown-menu.tsx +197 -0
  129. package/src/form.tsx +175 -0
  130. package/src/hover-card.tsx +26 -0
  131. package/src/input-otp.tsx +68 -0
  132. package/src/label.tsx +23 -0
  133. package/src/menubar.tsx +233 -0
  134. package/src/native-select.tsx +29 -0
  135. package/src/navigation-menu.tsx +127 -0
  136. package/src/pagination.tsx +116 -0
  137. package/src/popover.tsx +28 -0
  138. package/src/progress.tsx +25 -0
  139. package/src/radio-group.tsx +41 -0
  140. package/src/resizable.tsx +42 -0
  141. package/src/scroll-area.tsx +45 -0
  142. package/src/select.tsx +157 -0
  143. package/src/separator.tsx +28 -0
  144. package/src/sheet.tsx +137 -0
  145. package/src/sidebar.tsx +249 -0
  146. package/src/skeleton.tsx +15 -0
  147. package/src/slider.tsx +25 -0
  148. package/src/sonner.tsx +25 -0
  149. package/src/spinner.tsx +33 -0
  150. package/src/switch.tsx +26 -0
  151. package/src/table.tsx +116 -0
  152. package/src/tabs.tsx +52 -0
  153. package/src/textarea.tsx +23 -0
  154. package/src/toggle-group.tsx +58 -0
  155. package/src/toggle.tsx +42 -0
  156. package/src/tooltip.tsx +27 -0
  157. package/LICENSE +0 -21
@@ -0,0 +1,116 @@
1
+ import * as React from "react"
2
+ import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
3
+ import { cn } from "./lib/utils"
4
+ import { type ButtonProps, buttonVariants } from "./button"
5
+
6
+ const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
7
+ <nav
8
+ role="navigation"
9
+ aria-label="pagination"
10
+ className={cn("mx-auto flex w-full justify-center", className)}
11
+ {...props}
12
+ />
13
+ )
14
+ Pagination.displayName = "Pagination"
15
+
16
+ const PaginationContent = React.forwardRef<
17
+ HTMLUListElement,
18
+ React.ComponentProps<"ul">
19
+ >(({ className, ...props }, ref) => (
20
+ <ul
21
+ ref={ref}
22
+ className={cn("flex flex-row items-center gap-1", className)}
23
+ {...props}
24
+ />
25
+ ))
26
+ PaginationContent.displayName = "PaginationContent"
27
+
28
+ const PaginationItem = React.forwardRef<
29
+ HTMLLIElement,
30
+ React.ComponentProps<"li">
31
+ >(({ className, ...props }, ref) => (
32
+ <li ref={ref} className={cn("", className)} {...props} />
33
+ ))
34
+ PaginationItem.displayName = "PaginationItem"
35
+
36
+ type PaginationLinkProps = {
37
+ isActive?: boolean
38
+ } & Pick<ButtonProps, "size"> &
39
+ React.ComponentProps<"a">
40
+
41
+ const PaginationLink = ({
42
+ className,
43
+ isActive,
44
+ size = "icon",
45
+ ...props
46
+ }: PaginationLinkProps) => (
47
+ <a
48
+ aria-current={isActive ? "page" : undefined}
49
+ className={cn(
50
+ buttonVariants({
51
+ variant: isActive ? "outline" : "ghost",
52
+ size,
53
+ }),
54
+ className
55
+ )}
56
+ {...props}
57
+ />
58
+ )
59
+ PaginationLink.displayName = "PaginationLink"
60
+
61
+ const PaginationPrevious = ({
62
+ className,
63
+ ...props
64
+ }: React.ComponentProps<typeof PaginationLink>) => (
65
+ <PaginationLink
66
+ aria-label="Go to previous page"
67
+ size="default"
68
+ className={cn("gap-1 pl-2.5", className)}
69
+ {...props}
70
+ >
71
+ <ChevronLeft className="size-4" />
72
+ <span>Previous</span>
73
+ </PaginationLink>
74
+ )
75
+ PaginationPrevious.displayName = "PaginationPrevious"
76
+
77
+ const PaginationNext = ({
78
+ className,
79
+ ...props
80
+ }: React.ComponentProps<typeof PaginationLink>) => (
81
+ <PaginationLink
82
+ aria-label="Go to next page"
83
+ size="default"
84
+ className={cn("gap-1 pr-2.5", className)}
85
+ {...props}
86
+ >
87
+ <span>Next</span>
88
+ <ChevronRight className="size-4" />
89
+ </PaginationLink>
90
+ )
91
+ PaginationNext.displayName = "PaginationNext"
92
+
93
+ const PaginationEllipsis = ({
94
+ className,
95
+ ...props
96
+ }: React.ComponentProps<"span">) => (
97
+ <span
98
+ aria-hidden
99
+ className={cn("flex size-9 items-center justify-center", className)}
100
+ {...props}
101
+ >
102
+ <MoreHorizontal className="size-4" />
103
+ <span className="sr-only">More pages</span>
104
+ </span>
105
+ )
106
+ PaginationEllipsis.displayName = "PaginationEllipsis"
107
+
108
+ export {
109
+ Pagination,
110
+ PaginationContent,
111
+ PaginationEllipsis,
112
+ PaginationItem,
113
+ PaginationLink,
114
+ PaginationNext,
115
+ PaginationPrevious,
116
+ }
@@ -0,0 +1,28 @@
1
+ import * as React from "react"
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Popover = PopoverPrimitive.Root
6
+
7
+ const PopoverTrigger = PopoverPrimitive.Trigger
8
+
9
+ const PopoverContent = React.forwardRef<
10
+ React.ElementRef<typeof PopoverPrimitive.Content>,
11
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
12
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
13
+ <PopoverPrimitive.Portal>
14
+ <PopoverPrimitive.Content
15
+ ref={ref}
16
+ align={align}
17
+ sideOffset={sideOffset}
18
+ className={cn(
19
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ </PopoverPrimitive.Portal>
25
+ ))
26
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName
27
+
28
+ export { Popover, PopoverTrigger, PopoverContent }
@@ -0,0 +1,25 @@
1
+ import * as React from "react"
2
+ import * as ProgressPrimitive from "@radix-ui/react-progress"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Progress = React.forwardRef<
6
+ React.ElementRef<typeof ProgressPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
8
+ >(({ className, value, ...props }, ref) => (
9
+ <ProgressPrimitive.Root
10
+ ref={ref}
11
+ className={cn(
12
+ "relative h-4 w-full overflow-hidden rounded-full bg-secondary",
13
+ className
14
+ )}
15
+ {...props}
16
+ >
17
+ <ProgressPrimitive.Indicator
18
+ className="h-full w-full flex-1 bg-primary transition-all"
19
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
20
+ />
21
+ </ProgressPrimitive.Root>
22
+ ))
23
+ Progress.displayName = ProgressPrimitive.Root.displayName
24
+
25
+ export { Progress }
@@ -0,0 +1,41 @@
1
+ import * as React from "react"
2
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
3
+ import { Circle } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const RadioGroup = React.forwardRef<
7
+ React.ElementRef<typeof RadioGroupPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
9
+ >(({ className, ...props }, ref) => {
10
+ return (
11
+ <RadioGroupPrimitive.Root
12
+ className={cn("grid gap-2", className)}
13
+ {...props}
14
+ ref={ref}
15
+ />
16
+ )
17
+ })
18
+ RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
19
+
20
+ const RadioGroupItem = React.forwardRef<
21
+ React.ElementRef<typeof RadioGroupPrimitive.Item>,
22
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
23
+ >(({ className, ...props }, ref) => {
24
+ return (
25
+ <RadioGroupPrimitive.Item
26
+ ref={ref}
27
+ className={cn(
28
+ "aspect-square size-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
29
+ className
30
+ )}
31
+ {...props}
32
+ >
33
+ <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
34
+ <Circle className="size-2.5 fill-current text-current" />
35
+ </RadioGroupPrimitive.Indicator>
36
+ </RadioGroupPrimitive.Item>
37
+ )
38
+ })
39
+ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
40
+
41
+ export { RadioGroup, RadioGroupItem }
@@ -0,0 +1,42 @@
1
+ import { GripVertical } from "lucide-react"
2
+ import * as ResizablePrimitive from "react-resizable-panels"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const ResizablePanelGroup = ({
6
+ className,
7
+ ...props
8
+ }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
9
+ <ResizablePrimitive.PanelGroup
10
+ className={cn(
11
+ "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
12
+ className
13
+ )}
14
+ {...props}
15
+ />
16
+ )
17
+
18
+ const ResizablePanel = ResizablePrimitive.Panel
19
+
20
+ const ResizableHandle = ({
21
+ withHandle,
22
+ className,
23
+ ...props
24
+ }: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
25
+ withHandle?: boolean
26
+ }) => (
27
+ <ResizablePrimitive.PanelResizeHandle
28
+ className={cn(
29
+ "relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
30
+ className
31
+ )}
32
+ {...props}
33
+ >
34
+ {withHandle && (
35
+ <div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
36
+ <GripVertical className="size-2.5" />
37
+ </div>
38
+ )}
39
+ </ResizablePrimitive.PanelResizeHandle>
40
+ )
41
+
42
+ export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
@@ -0,0 +1,45 @@
1
+ import * as React from "react"
2
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const ScrollArea = React.forwardRef<
6
+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
8
+ >(({ className, children, ...props }, ref) => (
9
+ <ScrollAreaPrimitive.Root
10
+ ref={ref}
11
+ className={cn("relative overflow-hidden", className)}
12
+ {...props}
13
+ >
14
+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
15
+ {children}
16
+ </ScrollAreaPrimitive.Viewport>
17
+ <ScrollBar />
18
+ <ScrollAreaPrimitive.Corner />
19
+ </ScrollAreaPrimitive.Root>
20
+ ))
21
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
22
+
23
+ const ScrollBar = React.forwardRef<
24
+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
25
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
26
+ >(({ className, orientation = "vertical", ...props }, ref) => (
27
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
28
+ ref={ref}
29
+ orientation={orientation}
30
+ className={cn(
31
+ "flex touch-none select-none transition-colors",
32
+ orientation === "vertical" &&
33
+ "h-full w-2.5 border-l border-l-transparent p-[1px]",
34
+ orientation === "horizontal" &&
35
+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",
36
+ className
37
+ )}
38
+ {...props}
39
+ >
40
+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
41
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
42
+ ))
43
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
44
+
45
+ export { ScrollArea, ScrollBar }
package/src/select.tsx ADDED
@@ -0,0 +1,157 @@
1
+ import * as React from "react"
2
+ import * as SelectPrimitive from "@radix-ui/react-select"
3
+ import { Check, ChevronDown, ChevronUp } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const Select = SelectPrimitive.Root
7
+
8
+ const SelectGroup = SelectPrimitive.Group
9
+
10
+ const SelectValue = SelectPrimitive.Value
11
+
12
+ const SelectTrigger = React.forwardRef<
13
+ React.ElementRef<typeof SelectPrimitive.Trigger>,
14
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
15
+ >(({ className, children, ...props }, ref) => (
16
+ <SelectPrimitive.Trigger
17
+ ref={ref}
18
+ className={cn(
19
+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
20
+ className
21
+ )}
22
+ {...props}
23
+ >
24
+ {children}
25
+ <SelectPrimitive.Icon asChild>
26
+ <ChevronDown className="size-4 opacity-50" />
27
+ </SelectPrimitive.Icon>
28
+ </SelectPrimitive.Trigger>
29
+ ))
30
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
31
+
32
+ const SelectScrollUpButton = React.forwardRef<
33
+ React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
34
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
35
+ >(({ className, ...props }, ref) => (
36
+ <SelectPrimitive.ScrollUpButton
37
+ ref={ref}
38
+ className={cn(
39
+ "flex cursor-default items-center justify-center py-1",
40
+ className
41
+ )}
42
+ {...props}
43
+ >
44
+ <ChevronUp className="size-4" />
45
+ </SelectPrimitive.ScrollUpButton>
46
+ ))
47
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
48
+
49
+ const SelectScrollDownButton = React.forwardRef<
50
+ React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
51
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
52
+ >(({ className, ...props }, ref) => (
53
+ <SelectPrimitive.ScrollDownButton
54
+ ref={ref}
55
+ className={cn(
56
+ "flex cursor-default items-center justify-center py-1",
57
+ className
58
+ )}
59
+ {...props}
60
+ >
61
+ <ChevronDown className="size-4" />
62
+ </SelectPrimitive.ScrollDownButton>
63
+ ))
64
+ SelectScrollDownButton.displayName =
65
+ SelectPrimitive.ScrollDownButton.displayName
66
+
67
+ const SelectContent = React.forwardRef<
68
+ React.ElementRef<typeof SelectPrimitive.Content>,
69
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
70
+ >(({ className, children, position = "popper", ...props }, ref) => (
71
+ <SelectPrimitive.Portal>
72
+ <SelectPrimitive.Content
73
+ ref={ref}
74
+ className={cn(
75
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
76
+ position === "popper" &&
77
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
78
+ className
79
+ )}
80
+ position={position}
81
+ {...props}
82
+ >
83
+ <SelectScrollUpButton />
84
+ <SelectPrimitive.Viewport
85
+ className={cn(
86
+ "p-1",
87
+ position === "popper" &&
88
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
89
+ )}
90
+ >
91
+ {children}
92
+ </SelectPrimitive.Viewport>
93
+ <SelectScrollDownButton />
94
+ </SelectPrimitive.Content>
95
+ </SelectPrimitive.Portal>
96
+ ))
97
+ SelectContent.displayName = SelectPrimitive.Content.displayName
98
+
99
+ const SelectLabel = React.forwardRef<
100
+ React.ElementRef<typeof SelectPrimitive.Label>,
101
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
102
+ >(({ className, ...props }, ref) => (
103
+ <SelectPrimitive.Label
104
+ ref={ref}
105
+ className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ SelectLabel.displayName = SelectPrimitive.Label.displayName
110
+
111
+ const SelectItem = React.forwardRef<
112
+ React.ElementRef<typeof SelectPrimitive.Item>,
113
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
114
+ >(({ className, children, ...props }, ref) => (
115
+ <SelectPrimitive.Item
116
+ ref={ref}
117
+ className={cn(
118
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
119
+ className
120
+ )}
121
+ {...props}
122
+ >
123
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
124
+ <SelectPrimitive.ItemIndicator>
125
+ <Check className="size-4" />
126
+ </SelectPrimitive.ItemIndicator>
127
+ </span>
128
+
129
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
130
+ </SelectPrimitive.Item>
131
+ ))
132
+ SelectItem.displayName = SelectPrimitive.Item.displayName
133
+
134
+ const SelectSeparator = React.forwardRef<
135
+ React.ElementRef<typeof SelectPrimitive.Separator>,
136
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
137
+ >(({ className, ...props }, ref) => (
138
+ <SelectPrimitive.Separator
139
+ ref={ref}
140
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
141
+ {...props}
142
+ />
143
+ ))
144
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName
145
+
146
+ export {
147
+ Select,
148
+ SelectGroup,
149
+ SelectValue,
150
+ SelectTrigger,
151
+ SelectContent,
152
+ SelectLabel,
153
+ SelectItem,
154
+ SelectSeparator,
155
+ SelectScrollUpButton,
156
+ SelectScrollDownButton,
157
+ }
@@ -0,0 +1,28 @@
1
+ import * as React from "react"
2
+ import * as SeparatorPrimitive from "@radix-ui/react-separator"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Separator = React.forwardRef<
6
+ React.ElementRef<typeof SeparatorPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
8
+ >(
9
+ (
10
+ { className, orientation = "horizontal", decorative = true, ...props },
11
+ ref
12
+ ) => (
13
+ <SeparatorPrimitive.Root
14
+ ref={ref}
15
+ decorative={decorative}
16
+ orientation={orientation}
17
+ className={cn(
18
+ "shrink-0 bg-border",
19
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ )
25
+ )
26
+ Separator.displayName = SeparatorPrimitive.Root.displayName
27
+
28
+ export { Separator }
package/src/sheet.tsx ADDED
@@ -0,0 +1,137 @@
1
+ import * as React from "react"
2
+ import * as SheetPrimitive from "@radix-ui/react-dialog"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+ import { X } from "lucide-react"
5
+ import { cn } from "./lib/utils"
6
+
7
+ const Sheet = SheetPrimitive.Root
8
+
9
+ const SheetTrigger = SheetPrimitive.Trigger
10
+
11
+ const SheetClose = SheetPrimitive.Close
12
+
13
+ const SheetPortal = SheetPrimitive.Portal
14
+
15
+ const SheetOverlay = React.forwardRef<
16
+ React.ElementRef<typeof SheetPrimitive.Overlay>,
17
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
18
+ >(({ className, ...props }, ref) => (
19
+ <SheetPrimitive.Overlay
20
+ className={cn(
21
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
22
+ className
23
+ )}
24
+ {...props}
25
+ ref={ref}
26
+ />
27
+ ))
28
+ SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
29
+
30
+ const sheetVariants = cva(
31
+ "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
32
+ {
33
+ variants: {
34
+ side: {
35
+ top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
36
+ bottom:
37
+ "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
38
+ left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
39
+ right:
40
+ "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
41
+ },
42
+ },
43
+ defaultVariants: {
44
+ side: "right",
45
+ },
46
+ }
47
+ )
48
+
49
+ interface SheetContentProps
50
+ extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
51
+ VariantProps<typeof sheetVariants> {}
52
+
53
+ const SheetContent = React.forwardRef<
54
+ React.ElementRef<typeof SheetPrimitive.Content>,
55
+ SheetContentProps
56
+ >(({ side = "right", className, children, ...props }, ref) => (
57
+ <SheetPortal>
58
+ <SheetOverlay />
59
+ <SheetPrimitive.Content
60
+ ref={ref}
61
+ className={cn(sheetVariants({ side }), className)}
62
+ {...props}
63
+ >
64
+ {children}
65
+ <SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
66
+ <X className="size-4" />
67
+ <span className="sr-only">Close</span>
68
+ </SheetPrimitive.Close>
69
+ </SheetPrimitive.Content>
70
+ </SheetPortal>
71
+ ))
72
+ SheetContent.displayName = SheetPrimitive.Content.displayName
73
+
74
+ const SheetHeader = ({
75
+ className,
76
+ ...props
77
+ }: React.HTMLAttributes<HTMLDivElement>) => (
78
+ <div
79
+ className={cn(
80
+ "flex flex-col space-y-2 text-center sm:text-left",
81
+ className
82
+ )}
83
+ {...props}
84
+ />
85
+ )
86
+ SheetHeader.displayName = "SheetHeader"
87
+
88
+ const SheetFooter = ({
89
+ className,
90
+ ...props
91
+ }: React.HTMLAttributes<HTMLDivElement>) => (
92
+ <div
93
+ className={cn(
94
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
95
+ className
96
+ )}
97
+ {...props}
98
+ />
99
+ )
100
+ SheetFooter.displayName = "SheetFooter"
101
+
102
+ const SheetTitle = React.forwardRef<
103
+ React.ElementRef<typeof SheetPrimitive.Title>,
104
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
105
+ >(({ className, ...props }, ref) => (
106
+ <SheetPrimitive.Title
107
+ ref={ref}
108
+ className={cn("text-lg font-semibold text-foreground", className)}
109
+ {...props}
110
+ />
111
+ ))
112
+ SheetTitle.displayName = SheetPrimitive.Title.displayName
113
+
114
+ const SheetDescription = React.forwardRef<
115
+ React.ElementRef<typeof SheetPrimitive.Description>,
116
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
117
+ >(({ className, ...props }, ref) => (
118
+ <SheetPrimitive.Description
119
+ ref={ref}
120
+ className={cn("text-sm text-muted-foreground", className)}
121
+ {...props}
122
+ />
123
+ ))
124
+ SheetDescription.displayName = SheetPrimitive.Description.displayName
125
+
126
+ export {
127
+ Sheet,
128
+ SheetPortal,
129
+ SheetOverlay,
130
+ SheetTrigger,
131
+ SheetClose,
132
+ SheetContent,
133
+ SheetHeader,
134
+ SheetFooter,
135
+ SheetTitle,
136
+ SheetDescription,
137
+ }