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,249 @@
1
+ import * as React from "react"
2
+ import { PanelLeft } from "lucide-react"
3
+ import { cn } from "./lib/utils"
4
+ import { Button } from "./button"
5
+ import { Sheet, SheetContent } from "./sheet"
6
+
7
+ const SIDEBAR_WIDTH = "16rem"
8
+ const SIDEBAR_WIDTH_MOBILE = "18rem"
9
+ const SIDEBAR_WIDTH_ICON = "3rem"
10
+
11
+ type SidebarContext = {
12
+ state: "expanded" | "collapsed"
13
+ open: boolean
14
+ setOpen: (open: boolean) => void
15
+ openMobile: boolean
16
+ setOpenMobile: (open: boolean) => void
17
+ isMobile: boolean
18
+ toggleSidebar: () => void
19
+ }
20
+
21
+ const SidebarContext = React.createContext<SidebarContext | null>(null)
22
+
23
+ function useSidebar() {
24
+ const context = React.useContext(SidebarContext)
25
+ if (!context) {
26
+ throw new Error("useSidebar must be used within a SidebarProvider.")
27
+ }
28
+
29
+ return context
30
+ }
31
+
32
+ const SidebarProvider = React.forwardRef<
33
+ HTMLDivElement,
34
+ React.ComponentProps<"div"> & {
35
+ defaultOpen?: boolean
36
+ open?: boolean
37
+ onOpenChange?: (open: boolean) => void
38
+ }
39
+ >(
40
+ (
41
+ {
42
+ defaultOpen = true,
43
+ open: openProp,
44
+ onOpenChange: setOpenProp,
45
+ className,
46
+ style,
47
+ children,
48
+ ...props
49
+ },
50
+ ref
51
+ ) => {
52
+ const [openMobile, setOpenMobile] = React.useState(false)
53
+ const [_open, _setOpen] = React.useState(defaultOpen)
54
+ const open = openProp ?? _open
55
+ const setOpen = React.useCallback(
56
+ (value: boolean | ((value: boolean) => boolean)) => {
57
+ const openState = typeof value === "function" ? value(open) : value
58
+ if (setOpenProp) {
59
+ setOpenProp(openState)
60
+ } else {
61
+ _setOpen(openState)
62
+ }
63
+ },
64
+ [setOpenProp, open]
65
+ )
66
+
67
+ const isMobile = false // Note: In real implementation, use window.matchMedia
68
+
69
+ const state = open ? "expanded" : "collapsed"
70
+
71
+ const contextValue = React.useMemo<SidebarContext>(
72
+ () => ({
73
+ state,
74
+ open,
75
+ setOpen,
76
+ isMobile,
77
+ openMobile,
78
+ setOpenMobile,
79
+ toggleSidebar: () => setOpen(!open),
80
+ }),
81
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile]
82
+ )
83
+
84
+ return (
85
+ <SidebarContext.Provider value={contextValue}>
86
+ <div
87
+ style={
88
+ {
89
+ "--sidebar-width": SIDEBAR_WIDTH,
90
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
91
+ ...style,
92
+ } as React.CSSProperties
93
+ }
94
+ className={cn(
95
+ "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
96
+ className
97
+ )}
98
+ ref={ref}
99
+ {...props}
100
+ >
101
+ {children}
102
+ </div>
103
+ </SidebarContext.Provider>
104
+ )
105
+ }
106
+ )
107
+ SidebarProvider.displayName = "SidebarProvider"
108
+
109
+ const Sidebar = React.forwardRef<
110
+ HTMLDivElement,
111
+ React.ComponentProps<"div"> & {
112
+ side?: "left" | "right"
113
+ variant?: "sidebar" | "floating" | "inset"
114
+ collapsible?: "offcanvas" | "icon" | "none"
115
+ }
116
+ >(
117
+ (
118
+ {
119
+ side = "left",
120
+ variant = "sidebar",
121
+ collapsible = "offcanvas",
122
+ className,
123
+ children,
124
+ ...props
125
+ },
126
+ ref
127
+ ) => {
128
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
129
+
130
+ if (collapsible === "none") {
131
+ return (
132
+ <div
133
+ className={cn(
134
+ "flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",
135
+ className
136
+ )}
137
+ ref={ref}
138
+ {...props}
139
+ >
140
+ {children}
141
+ </div>
142
+ )
143
+ }
144
+
145
+ if (isMobile) {
146
+ return (
147
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
148
+ <SheetContent
149
+ data-sidebar="sidebar"
150
+ data-mobile="true"
151
+ className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
152
+ style={
153
+ {
154
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
155
+ } as React.CSSProperties
156
+ }
157
+ side={side}
158
+ >
159
+ <div className="flex h-full w-full flex-col">{children}</div>
160
+ </SheetContent>
161
+ </Sheet>
162
+ )
163
+ }
164
+
165
+ return (
166
+ <div
167
+ ref={ref}
168
+ className="group peer hidden md:block"
169
+ data-state={state}
170
+ data-collapsible={state === "collapsed" ? collapsible : ""}
171
+ data-variant={variant}
172
+ data-side={side}
173
+ >
174
+ <div
175
+ className={cn(
176
+ "duration-200 relative h-svh w-[--sidebar-width] bg-sidebar transition-[width] ease-linear",
177
+ "group-data-[collapsible=offcanvas]:w-0",
178
+ "group-data-[side=right]:rotate-180",
179
+ variant === "floating" || variant === "inset"
180
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
181
+ : "group-data-[collapsible=icon]:w-[--sidebar-width-icon]",
182
+ className
183
+ )}
184
+ {...props}
185
+ >
186
+ <div
187
+ data-sidebar="sidebar"
188
+ className="duration-200 flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
189
+ >
190
+ {children}
191
+ </div>
192
+ </div>
193
+ </div>
194
+ )
195
+ }
196
+ )
197
+ Sidebar.displayName = "Sidebar"
198
+
199
+ const SidebarTrigger = React.forwardRef<
200
+ React.ElementRef<typeof Button>,
201
+ React.ComponentProps<typeof Button>
202
+ >(({ className, onClick, ...props }, ref) => {
203
+ const { toggleSidebar } = useSidebar()
204
+
205
+ return (
206
+ <Button
207
+ ref={ref}
208
+ data-sidebar="trigger"
209
+ variant="ghost"
210
+ size="icon"
211
+ className={cn("size-7", className)}
212
+ onClick={(event) => {
213
+ onClick?.(event)
214
+ toggleSidebar()
215
+ }}
216
+ {...props}
217
+ >
218
+ <PanelLeft />
219
+ <span className="sr-only">Toggle Sidebar</span>
220
+ </Button>
221
+ )
222
+ })
223
+ SidebarTrigger.displayName = "SidebarTrigger"
224
+
225
+ const SidebarContent = React.forwardRef<
226
+ HTMLDivElement,
227
+ React.ComponentProps<"div">
228
+ >(({ className, ...props }, ref) => {
229
+ return (
230
+ <div
231
+ data-sidebar="content"
232
+ ref={ref}
233
+ className={cn(
234
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
235
+ className
236
+ )}
237
+ {...props}
238
+ />
239
+ )
240
+ })
241
+ SidebarContent.displayName = "SidebarContent"
242
+
243
+ export {
244
+ Sidebar,
245
+ SidebarContent,
246
+ SidebarProvider,
247
+ SidebarTrigger,
248
+ useSidebar,
249
+ }
@@ -0,0 +1,15 @@
1
+ import { cn } from "./lib/utils"
2
+
3
+ function Skeleton({
4
+ className,
5
+ ...props
6
+ }: React.HTMLAttributes<HTMLDivElement>) {
7
+ return (
8
+ <div
9
+ className={cn("animate-pulse rounded-md bg-muted", className)}
10
+ {...props}
11
+ />
12
+ )
13
+ }
14
+
15
+ export { Skeleton }
package/src/slider.tsx ADDED
@@ -0,0 +1,25 @@
1
+ import * as React from "react"
2
+ import * as SliderPrimitive from "@radix-ui/react-slider"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Slider = React.forwardRef<
6
+ React.ElementRef<typeof SliderPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
8
+ >(({ className, ...props }, ref) => (
9
+ <SliderPrimitive.Root
10
+ ref={ref}
11
+ className={cn(
12
+ "relative flex w-full touch-none select-none items-center",
13
+ className
14
+ )}
15
+ {...props}
16
+ >
17
+ <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
18
+ <SliderPrimitive.Range className="absolute h-full bg-primary" />
19
+ </SliderPrimitive.Track>
20
+ <SliderPrimitive.Thumb className="block size-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
21
+ </SliderPrimitive.Root>
22
+ ))
23
+ Slider.displayName = SliderPrimitive.Root.displayName
24
+
25
+ export { Slider }
package/src/sonner.tsx ADDED
@@ -0,0 +1,25 @@
1
+ import { Toaster as Sonner } from "sonner"
2
+
3
+ type ToasterProps = React.ComponentProps<typeof Sonner>
4
+
5
+ const Toaster = ({ ...props }: ToasterProps) => {
6
+ return (
7
+ <Sonner
8
+ className="toaster group"
9
+ toastOptions={{
10
+ classNames: {
11
+ toast:
12
+ "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
13
+ description: "group-[.toast]:text-muted-foreground",
14
+ actionButton:
15
+ "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
16
+ cancelButton:
17
+ "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
18
+ },
19
+ }}
20
+ {...props}
21
+ />
22
+ )
23
+ }
24
+
25
+ export { Toaster }
@@ -0,0 +1,33 @@
1
+ import * as React from "react"
2
+ import { Loader2 } from "lucide-react"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const spinnerVariants = cva("animate-spin text-muted-foreground", {
7
+ variants: {
8
+ size: {
9
+ default: "size-4",
10
+ sm: "size-3",
11
+ lg: "size-6",
12
+ xl: "size-8",
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ size: "default",
17
+ },
18
+ })
19
+
20
+ export interface SpinnerProps
21
+ extends React.HTMLAttributes<HTMLDivElement>,
22
+ VariantProps<typeof spinnerVariants> {}
23
+
24
+ const Spinner = React.forwardRef<HTMLDivElement, SpinnerProps>(
25
+ ({ className, size, ...props }, ref) => (
26
+ <div ref={ref} {...props}>
27
+ <Loader2 className={cn(spinnerVariants({ size }), className)} />
28
+ </div>
29
+ )
30
+ )
31
+ Spinner.displayName = "Spinner"
32
+
33
+ export { Spinner }
package/src/switch.tsx ADDED
@@ -0,0 +1,26 @@
1
+ import * as React from "react"
2
+ import * as SwitchPrimitives from "@radix-ui/react-switch"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Switch = React.forwardRef<
6
+ React.ElementRef<typeof SwitchPrimitives.Root>,
7
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
8
+ >(({ className, ...props }, ref) => (
9
+ <SwitchPrimitives.Root
10
+ className={cn(
11
+ "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
12
+ className
13
+ )}
14
+ {...props}
15
+ ref={ref}
16
+ >
17
+ <SwitchPrimitives.Thumb
18
+ className={cn(
19
+ "pointer-events-none block size-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
20
+ )}
21
+ />
22
+ </SwitchPrimitives.Root>
23
+ ))
24
+ Switch.displayName = SwitchPrimitives.Root.displayName
25
+
26
+ export { Switch }
package/src/table.tsx ADDED
@@ -0,0 +1,116 @@
1
+ import * as React from "react"
2
+ import { cn } from "./lib/utils"
3
+
4
+ const Table = React.forwardRef<
5
+ HTMLTableElement,
6
+ React.HTMLAttributes<HTMLTableElement>
7
+ >(({ className, ...props }, ref) => (
8
+ <div className="relative w-full overflow-auto">
9
+ <table
10
+ ref={ref}
11
+ className={cn("w-full caption-bottom text-sm", className)}
12
+ {...props}
13
+ />
14
+ </div>
15
+ ))
16
+ Table.displayName = "Table"
17
+
18
+ const TableHeader = React.forwardRef<
19
+ HTMLTableSectionElement,
20
+ React.HTMLAttributes<HTMLTableSectionElement>
21
+ >(({ className, ...props }, ref) => (
22
+ <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
23
+ ))
24
+ TableHeader.displayName = "TableHeader"
25
+
26
+ const TableBody = React.forwardRef<
27
+ HTMLTableSectionElement,
28
+ React.HTMLAttributes<HTMLTableSectionElement>
29
+ >(({ className, ...props }, ref) => (
30
+ <tbody
31
+ ref={ref}
32
+ className={cn("[&_tr:last-child]:border-0", className)}
33
+ {...props}
34
+ />
35
+ ))
36
+ TableBody.displayName = "TableBody"
37
+
38
+ const TableFooter = React.forwardRef<
39
+ HTMLTableSectionElement,
40
+ React.HTMLAttributes<HTMLTableSectionElement>
41
+ >(({ className, ...props }, ref) => (
42
+ <tfoot
43
+ ref={ref}
44
+ className={cn(
45
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ ))
51
+ TableFooter.displayName = "TableFooter"
52
+
53
+ const TableRow = React.forwardRef<
54
+ HTMLTableRowElement,
55
+ React.HTMLAttributes<HTMLTableRowElement>
56
+ >(({ className, ...props }, ref) => (
57
+ <tr
58
+ ref={ref}
59
+ className={cn(
60
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
61
+ className
62
+ )}
63
+ {...props}
64
+ />
65
+ ))
66
+ TableRow.displayName = "TableRow"
67
+
68
+ const TableHead = React.forwardRef<
69
+ HTMLTableCellElement,
70
+ React.ThHTMLAttributes<HTMLTableCellElement>
71
+ >(({ className, ...props }, ref) => (
72
+ <th
73
+ ref={ref}
74
+ className={cn(
75
+ "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ ))
81
+ TableHead.displayName = "TableHead"
82
+
83
+ const TableCell = React.forwardRef<
84
+ HTMLTableCellElement,
85
+ React.TdHTMLAttributes<HTMLTableCellElement>
86
+ >(({ className, ...props }, ref) => (
87
+ <td
88
+ ref={ref}
89
+ className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
90
+ {...props}
91
+ />
92
+ ))
93
+ TableCell.displayName = "TableCell"
94
+
95
+ const TableCaption = React.forwardRef<
96
+ HTMLTableCaptionElement,
97
+ React.HTMLAttributes<HTMLTableCaptionElement>
98
+ >(({ className, ...props }, ref) => (
99
+ <caption
100
+ ref={ref}
101
+ className={cn("mt-4 text-sm text-muted-foreground", className)}
102
+ {...props}
103
+ />
104
+ ))
105
+ TableCaption.displayName = "TableCaption"
106
+
107
+ export {
108
+ Table,
109
+ TableHeader,
110
+ TableBody,
111
+ TableFooter,
112
+ TableHead,
113
+ TableRow,
114
+ TableCell,
115
+ TableCaption,
116
+ }
package/src/tabs.tsx ADDED
@@ -0,0 +1,52 @@
1
+ import * as React from "react"
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Tabs = TabsPrimitive.Root
6
+
7
+ const TabsList = React.forwardRef<
8
+ React.ElementRef<typeof TabsPrimitive.List>,
9
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
10
+ >(({ className, ...props }, ref) => (
11
+ <TabsPrimitive.List
12
+ ref={ref}
13
+ className={cn(
14
+ "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
15
+ className
16
+ )}
17
+ {...props}
18
+ />
19
+ ))
20
+ TabsList.displayName = TabsPrimitive.List.displayName
21
+
22
+ const TabsTrigger = React.forwardRef<
23
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
24
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
25
+ >(({ className, ...props }, ref) => (
26
+ <TabsPrimitive.Trigger
27
+ ref={ref}
28
+ className={cn(
29
+ "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
30
+ className
31
+ )}
32
+ {...props}
33
+ />
34
+ ))
35
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
36
+
37
+ const TabsContent = React.forwardRef<
38
+ React.ElementRef<typeof TabsPrimitive.Content>,
39
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
40
+ >(({ className, ...props }, ref) => (
41
+ <TabsPrimitive.Content
42
+ ref={ref}
43
+ className={cn(
44
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
45
+ className
46
+ )}
47
+ {...props}
48
+ />
49
+ ))
50
+ TabsContent.displayName = TabsPrimitive.Content.displayName
51
+
52
+ export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -0,0 +1,23 @@
1
+ import * as React from "react"
2
+ import { cn } from "./lib/utils"
3
+
4
+ export interface TextareaProps
5
+ extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
6
+
7
+ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
8
+ ({ className, ...props }, ref) => {
9
+ return (
10
+ <textarea
11
+ className={cn(
12
+ "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
13
+ className
14
+ )}
15
+ ref={ref}
16
+ {...props}
17
+ />
18
+ )
19
+ }
20
+ )
21
+ Textarea.displayName = "Textarea"
22
+
23
+ export { Textarea }
@@ -0,0 +1,58 @@
1
+ import * as React from "react"
2
+ import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
3
+ import { type VariantProps } from "class-variance-authority"
4
+ import { cn } from "./lib/utils"
5
+ import { toggleVariants } from "./toggle"
6
+
7
+ const ToggleGroupContext = React.createContext<
8
+ VariantProps<typeof toggleVariants>
9
+ >({
10
+ size: "default",
11
+ variant: "default",
12
+ })
13
+
14
+ const ToggleGroup = React.forwardRef<
15
+ React.ElementRef<typeof ToggleGroupPrimitive.Root>,
16
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
17
+ VariantProps<typeof toggleVariants>
18
+ >(({ className, variant, size, children, ...props }, ref) => (
19
+ <ToggleGroupPrimitive.Root
20
+ ref={ref}
21
+ className={cn("flex items-center justify-center gap-1", className)}
22
+ {...props}
23
+ >
24
+ <ToggleGroupContext.Provider value={{ variant, size }}>
25
+ {children}
26
+ </ToggleGroupContext.Provider>
27
+ </ToggleGroupPrimitive.Root>
28
+ ))
29
+
30
+ ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
31
+
32
+ const ToggleGroupItem = React.forwardRef<
33
+ React.ElementRef<typeof ToggleGroupPrimitive.Item>,
34
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
35
+ VariantProps<typeof toggleVariants>
36
+ >(({ className, children, variant, size, ...props }, ref) => {
37
+ const context = React.useContext(ToggleGroupContext)
38
+
39
+ return (
40
+ <ToggleGroupPrimitive.Item
41
+ ref={ref}
42
+ className={cn(
43
+ toggleVariants({
44
+ variant: context.variant || variant,
45
+ size: context.size || size,
46
+ }),
47
+ className
48
+ )}
49
+ {...props}
50
+ >
51
+ {children}
52
+ </ToggleGroupPrimitive.Item>
53
+ )
54
+ })
55
+
56
+ ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
57
+
58
+ export { ToggleGroup, ToggleGroupItem }
package/src/toggle.tsx ADDED
@@ -0,0 +1,42 @@
1
+ import * as React from "react"
2
+ import * as TogglePrimitive from "@radix-ui/react-toggle"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const toggleVariants = cva(
7
+ "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-transparent",
12
+ outline:
13
+ "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
14
+ },
15
+ size: {
16
+ default: "h-10 px-3",
17
+ sm: "h-9 px-2.5",
18
+ lg: "h-11 px-5",
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ variant: "default",
23
+ size: "default",
24
+ },
25
+ }
26
+ )
27
+
28
+ const Toggle = React.forwardRef<
29
+ React.ElementRef<typeof TogglePrimitive.Root>,
30
+ React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
31
+ VariantProps<typeof toggleVariants>
32
+ >(({ className, variant, size, ...props }, ref) => (
33
+ <TogglePrimitive.Root
34
+ ref={ref}
35
+ className={cn(toggleVariants({ variant, size, className }))}
36
+ {...props}
37
+ />
38
+ ))
39
+
40
+ Toggle.displayName = TogglePrimitive.Root.displayName
41
+
42
+ export { Toggle, toggleVariants }