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,197 @@
1
+ import * as React from "react"
2
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
3
+ import { Check, ChevronRight, Circle } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const ContextMenu = ContextMenuPrimitive.Root
7
+
8
+ const ContextMenuTrigger = ContextMenuPrimitive.Trigger
9
+
10
+ const ContextMenuGroup = ContextMenuPrimitive.Group
11
+
12
+ const ContextMenuPortal = ContextMenuPrimitive.Portal
13
+
14
+ const ContextMenuSub = ContextMenuPrimitive.Sub
15
+
16
+ const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
17
+
18
+ const ContextMenuSubTrigger = React.forwardRef<
19
+ React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
20
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
21
+ inset?: boolean
22
+ }
23
+ >(({ className, inset, children, ...props }, ref) => (
24
+ <ContextMenuPrimitive.SubTrigger
25
+ ref={ref}
26
+ className={cn(
27
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
28
+ inset && "pl-8",
29
+ className
30
+ )}
31
+ {...props}
32
+ >
33
+ {children}
34
+ <ChevronRight className="ml-auto size-4" />
35
+ </ContextMenuPrimitive.SubTrigger>
36
+ ))
37
+ ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
38
+
39
+ const ContextMenuSubContent = React.forwardRef<
40
+ React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
41
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
42
+ >(({ className, ...props }, ref) => (
43
+ <ContextMenuPrimitive.SubContent
44
+ ref={ref}
45
+ className={cn(
46
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ ))
52
+ ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
53
+
54
+ const ContextMenuContent = React.forwardRef<
55
+ React.ElementRef<typeof ContextMenuPrimitive.Content>,
56
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
57
+ >(({ className, ...props }, ref) => (
58
+ <ContextMenuPrimitive.Portal>
59
+ <ContextMenuPrimitive.Content
60
+ ref={ref}
61
+ className={cn(
62
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ </ContextMenuPrimitive.Portal>
68
+ ))
69
+ ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
70
+
71
+ const ContextMenuItem = React.forwardRef<
72
+ React.ElementRef<typeof ContextMenuPrimitive.Item>,
73
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
74
+ inset?: boolean
75
+ }
76
+ >(({ className, inset, ...props }, ref) => (
77
+ <ContextMenuPrimitive.Item
78
+ ref={ref}
79
+ className={cn(
80
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
81
+ inset && "pl-8",
82
+ className
83
+ )}
84
+ {...props}
85
+ />
86
+ ))
87
+ ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
88
+
89
+ const ContextMenuCheckboxItem = React.forwardRef<
90
+ React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
91
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
92
+ >(({ className, children, checked, ...props }, ref) => (
93
+ <ContextMenuPrimitive.CheckboxItem
94
+ ref={ref}
95
+ className={cn(
96
+ "relative flex 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",
97
+ className
98
+ )}
99
+ checked={checked}
100
+ {...props}
101
+ >
102
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
103
+ <ContextMenuPrimitive.ItemIndicator>
104
+ <Check className="size-4" />
105
+ </ContextMenuPrimitive.ItemIndicator>
106
+ </span>
107
+ {children}
108
+ </ContextMenuPrimitive.CheckboxItem>
109
+ ))
110
+ ContextMenuCheckboxItem.displayName =
111
+ ContextMenuPrimitive.CheckboxItem.displayName
112
+
113
+ const ContextMenuRadioItem = React.forwardRef<
114
+ React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
115
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
116
+ >(({ className, children, ...props }, ref) => (
117
+ <ContextMenuPrimitive.RadioItem
118
+ ref={ref}
119
+ className={cn(
120
+ "relative flex 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",
121
+ className
122
+ )}
123
+ {...props}
124
+ >
125
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
126
+ <ContextMenuPrimitive.ItemIndicator>
127
+ <Circle className="size-2 fill-current" />
128
+ </ContextMenuPrimitive.ItemIndicator>
129
+ </span>
130
+ {children}
131
+ </ContextMenuPrimitive.RadioItem>
132
+ ))
133
+ ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
134
+
135
+ const ContextMenuLabel = React.forwardRef<
136
+ React.ElementRef<typeof ContextMenuPrimitive.Label>,
137
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
138
+ inset?: boolean
139
+ }
140
+ >(({ className, inset, ...props }, ref) => (
141
+ <ContextMenuPrimitive.Label
142
+ ref={ref}
143
+ className={cn(
144
+ "px-2 py-1.5 text-sm font-semibold text-foreground",
145
+ inset && "pl-8",
146
+ className
147
+ )}
148
+ {...props}
149
+ />
150
+ ))
151
+ ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
152
+
153
+ const ContextMenuSeparator = React.forwardRef<
154
+ React.ElementRef<typeof ContextMenuPrimitive.Separator>,
155
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
156
+ >(({ className, ...props }, ref) => (
157
+ <ContextMenuPrimitive.Separator
158
+ ref={ref}
159
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
160
+ {...props}
161
+ />
162
+ ))
163
+ ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
164
+
165
+ const ContextMenuShortcut = ({
166
+ className,
167
+ ...props
168
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
169
+ return (
170
+ <span
171
+ className={cn(
172
+ "ml-auto text-xs tracking-widest text-muted-foreground",
173
+ className
174
+ )}
175
+ {...props}
176
+ />
177
+ )
178
+ }
179
+ ContextMenuShortcut.displayName = "ContextMenuShortcut"
180
+
181
+ export {
182
+ ContextMenu,
183
+ ContextMenuTrigger,
184
+ ContextMenuContent,
185
+ ContextMenuItem,
186
+ ContextMenuCheckboxItem,
187
+ ContextMenuRadioItem,
188
+ ContextMenuLabel,
189
+ ContextMenuSeparator,
190
+ ContextMenuShortcut,
191
+ ContextMenuGroup,
192
+ ContextMenuPortal,
193
+ ContextMenuSub,
194
+ ContextMenuSubContent,
195
+ ContextMenuSubTrigger,
196
+ ContextMenuRadioGroup,
197
+ }
@@ -0,0 +1,9 @@
1
+ // Note: Data Table is a pattern that combines Table with @tanstack/react-table
2
+ // This is a simplified placeholder. Full implementation would be very large.
3
+ // Users should refer to https://ui.shadcn.com/docs/components/data-table for the complete pattern.
4
+
5
+ export * from "./table"
6
+
7
+ // Re-export table components as data-table components
8
+ // The data table pattern is documented separately as it's a comprehensive example
9
+ // rather than a single component
@@ -0,0 +1,8 @@
1
+ // Date Picker is a composition of Calendar + Popover
2
+ // This provides the building blocks - users compose them together
3
+
4
+ export * from "./calendar"
5
+ export * from "./popover"
6
+
7
+ // Example usage documented at: https://ui.shadcn.com/docs/components/date-picker
8
+ // DatePicker = Popover + Calendar + Button
package/src/dialog.tsx ADDED
@@ -0,0 +1,119 @@
1
+ import * as React from "react"
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
3
+ import { X } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const Dialog = DialogPrimitive.Root
7
+
8
+ const DialogTrigger = DialogPrimitive.Trigger
9
+
10
+ const DialogPortal = DialogPrimitive.Portal
11
+
12
+ const DialogClose = DialogPrimitive.Close
13
+
14
+ const DialogOverlay = React.forwardRef<
15
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
16
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
17
+ >(({ className, ...props }, ref) => (
18
+ <DialogPrimitive.Overlay
19
+ ref={ref}
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
+ />
26
+ ))
27
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
28
+
29
+ const DialogContent = React.forwardRef<
30
+ React.ElementRef<typeof DialogPrimitive.Content>,
31
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
32
+ >(({ className, children, ...props }, ref) => (
33
+ <DialogPortal>
34
+ <DialogOverlay />
35
+ <DialogPrimitive.Content
36
+ ref={ref}
37
+ className={cn(
38
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
39
+ className
40
+ )}
41
+ {...props}
42
+ >
43
+ {children}
44
+ <DialogPrimitive.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-accent data-[state=open]:text-muted-foreground">
45
+ <X className="size-4" />
46
+ <span className="sr-only">Close</span>
47
+ </DialogPrimitive.Close>
48
+ </DialogPrimitive.Content>
49
+ </DialogPortal>
50
+ ))
51
+ DialogContent.displayName = DialogPrimitive.Content.displayName
52
+
53
+ const DialogHeader = ({
54
+ className,
55
+ ...props
56
+ }: React.HTMLAttributes<HTMLDivElement>) => (
57
+ <div
58
+ className={cn(
59
+ "flex flex-col space-y-1.5 text-center sm:text-left",
60
+ className
61
+ )}
62
+ {...props}
63
+ />
64
+ )
65
+ DialogHeader.displayName = "DialogHeader"
66
+
67
+ const DialogFooter = ({
68
+ className,
69
+ ...props
70
+ }: React.HTMLAttributes<HTMLDivElement>) => (
71
+ <div
72
+ className={cn(
73
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
74
+ className
75
+ )}
76
+ {...props}
77
+ />
78
+ )
79
+ DialogFooter.displayName = "DialogFooter"
80
+
81
+ const DialogTitle = React.forwardRef<
82
+ React.ElementRef<typeof DialogPrimitive.Title>,
83
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
84
+ >(({ className, ...props }, ref) => (
85
+ <DialogPrimitive.Title
86
+ ref={ref}
87
+ className={cn(
88
+ "text-lg font-semibold leading-none tracking-tight",
89
+ className
90
+ )}
91
+ {...props}
92
+ />
93
+ ))
94
+ DialogTitle.displayName = DialogPrimitive.Title.displayName
95
+
96
+ const DialogDescription = React.forwardRef<
97
+ React.ElementRef<typeof DialogPrimitive.Description>,
98
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
99
+ >(({ className, ...props }, ref) => (
100
+ <DialogPrimitive.Description
101
+ ref={ref}
102
+ className={cn("text-sm text-muted-foreground", className)}
103
+ {...props}
104
+ />
105
+ ))
106
+ DialogDescription.displayName = DialogPrimitive.Description.displayName
107
+
108
+ export {
109
+ Dialog,
110
+ DialogPortal,
111
+ DialogOverlay,
112
+ DialogClose,
113
+ DialogTrigger,
114
+ DialogContent,
115
+ DialogHeader,
116
+ DialogFooter,
117
+ DialogTitle,
118
+ DialogDescription,
119
+ }
package/src/drawer.tsx ADDED
@@ -0,0 +1,115 @@
1
+ import * as React from "react"
2
+ import { Drawer as DrawerPrimitive } from "vaul"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Drawer = ({
6
+ shouldScaleBackground = true,
7
+ ...props
8
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
9
+ <DrawerPrimitive.Root
10
+ shouldScaleBackground={shouldScaleBackground}
11
+ {...props}
12
+ />
13
+ )
14
+ Drawer.displayName = "Drawer"
15
+
16
+ const DrawerTrigger = DrawerPrimitive.Trigger
17
+
18
+ const DrawerPortal = DrawerPrimitive.Portal
19
+
20
+ const DrawerClose = DrawerPrimitive.Close
21
+
22
+ const DrawerOverlay = React.forwardRef<
23
+ React.ElementRef<typeof DrawerPrimitive.Overlay>,
24
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
25
+ >(({ className, ...props }, ref) => (
26
+ <DrawerPrimitive.Overlay
27
+ ref={ref}
28
+ className={cn("fixed inset-0 z-50 bg-black/80", className)}
29
+ {...props}
30
+ />
31
+ ))
32
+ DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
33
+
34
+ const DrawerContent = React.forwardRef<
35
+ React.ElementRef<typeof DrawerPrimitive.Content>,
36
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
37
+ >(({ className, children, ...props }, ref) => (
38
+ <DrawerPortal>
39
+ <DrawerOverlay />
40
+ <DrawerPrimitive.Content
41
+ ref={ref}
42
+ className={cn(
43
+ "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
44
+ className
45
+ )}
46
+ {...props}
47
+ >
48
+ <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
49
+ {children}
50
+ </DrawerPrimitive.Content>
51
+ </DrawerPortal>
52
+ ))
53
+ DrawerContent.displayName = "DrawerContent"
54
+
55
+ const DrawerHeader = ({
56
+ className,
57
+ ...props
58
+ }: React.HTMLAttributes<HTMLDivElement>) => (
59
+ <div
60
+ className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
61
+ {...props}
62
+ />
63
+ )
64
+ DrawerHeader.displayName = "DrawerHeader"
65
+
66
+ const DrawerFooter = ({
67
+ className,
68
+ ...props
69
+ }: React.HTMLAttributes<HTMLDivElement>) => (
70
+ <div
71
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
72
+ {...props}
73
+ />
74
+ )
75
+ DrawerFooter.displayName = "DrawerFooter"
76
+
77
+ const DrawerTitle = React.forwardRef<
78
+ React.ElementRef<typeof DrawerPrimitive.Title>,
79
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
80
+ >(({ className, ...props }, ref) => (
81
+ <DrawerPrimitive.Title
82
+ ref={ref}
83
+ className={cn(
84
+ "text-lg font-semibold leading-none tracking-tight",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ ))
90
+ DrawerTitle.displayName = DrawerPrimitive.Title.displayName
91
+
92
+ const DrawerDescription = React.forwardRef<
93
+ React.ElementRef<typeof DrawerPrimitive.Description>,
94
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
95
+ >(({ className, ...props }, ref) => (
96
+ <DrawerPrimitive.Description
97
+ ref={ref}
98
+ className={cn("text-sm text-muted-foreground", className)}
99
+ {...props}
100
+ />
101
+ ))
102
+ DrawerDescription.displayName = DrawerPrimitive.Description.displayName
103
+
104
+ export {
105
+ Drawer,
106
+ DrawerPortal,
107
+ DrawerOverlay,
108
+ DrawerTrigger,
109
+ DrawerClose,
110
+ DrawerContent,
111
+ DrawerHeader,
112
+ DrawerFooter,
113
+ DrawerTitle,
114
+ DrawerDescription,
115
+ }
@@ -0,0 +1,197 @@
1
+ import * as React from "react"
2
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
3
+ import { Check, ChevronRight, Circle } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const DropdownMenu = DropdownMenuPrimitive.Root
7
+
8
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
9
+
10
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group
11
+
12
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal
13
+
14
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub
15
+
16
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
17
+
18
+ const DropdownMenuSubTrigger = React.forwardRef<
19
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
20
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
21
+ inset?: boolean
22
+ }
23
+ >(({ className, inset, children, ...props }, ref) => (
24
+ <DropdownMenuPrimitive.SubTrigger
25
+ ref={ref}
26
+ className={cn(
27
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
28
+ inset && "pl-8",
29
+ className
30
+ )}
31
+ {...props}
32
+ >
33
+ {children}
34
+ <ChevronRight className="ml-auto size-4" />
35
+ </DropdownMenuPrimitive.SubTrigger>
36
+ ))
37
+ DropdownMenuSubTrigger.displayName =
38
+ DropdownMenuPrimitive.SubTrigger.displayName
39
+
40
+ const DropdownMenuSubContent = React.forwardRef<
41
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
42
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
43
+ >(({ className, ...props }, ref) => (
44
+ <DropdownMenuPrimitive.SubContent
45
+ ref={ref}
46
+ className={cn(
47
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",
48
+ className
49
+ )}
50
+ {...props}
51
+ />
52
+ ))
53
+ DropdownMenuSubContent.displayName =
54
+ DropdownMenuPrimitive.SubContent.displayName
55
+
56
+ const DropdownMenuContent = React.forwardRef<
57
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
58
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
59
+ >(({ className, sideOffset = 4, ...props }, ref) => (
60
+ <DropdownMenuPrimitive.Portal>
61
+ <DropdownMenuPrimitive.Content
62
+ ref={ref}
63
+ sideOffset={sideOffset}
64
+ className={cn(
65
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",
66
+ className
67
+ )}
68
+ {...props}
69
+ />
70
+ </DropdownMenuPrimitive.Portal>
71
+ ))
72
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
73
+
74
+ const DropdownMenuItem = React.forwardRef<
75
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
76
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
77
+ inset?: boolean
78
+ }
79
+ >(({ className, inset, ...props }, ref) => (
80
+ <DropdownMenuPrimitive.Item
81
+ ref={ref}
82
+ className={cn(
83
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
84
+ inset && "pl-8",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ ))
90
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
91
+
92
+ const DropdownMenuCheckboxItem = React.forwardRef<
93
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
94
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
95
+ >(({ className, children, checked, ...props }, ref) => (
96
+ <DropdownMenuPrimitive.CheckboxItem
97
+ ref={ref}
98
+ className={cn(
99
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
100
+ className
101
+ )}
102
+ checked={checked}
103
+ {...props}
104
+ >
105
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
106
+ <DropdownMenuPrimitive.ItemIndicator>
107
+ <Check className="size-4" />
108
+ </DropdownMenuPrimitive.ItemIndicator>
109
+ </span>
110
+ {children}
111
+ </DropdownMenuPrimitive.CheckboxItem>
112
+ ))
113
+ DropdownMenuCheckboxItem.displayName =
114
+ DropdownMenuPrimitive.CheckboxItem.displayName
115
+
116
+ const DropdownMenuRadioItem = React.forwardRef<
117
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
118
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
119
+ >(({ className, children, ...props }, ref) => (
120
+ <DropdownMenuPrimitive.RadioItem
121
+ ref={ref}
122
+ className={cn(
123
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
124
+ className
125
+ )}
126
+ {...props}
127
+ >
128
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
129
+ <DropdownMenuPrimitive.ItemIndicator>
130
+ <Circle className="size-2 fill-current" />
131
+ </DropdownMenuPrimitive.ItemIndicator>
132
+ </span>
133
+ {children}
134
+ </DropdownMenuPrimitive.RadioItem>
135
+ ))
136
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
137
+
138
+ const DropdownMenuLabel = React.forwardRef<
139
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
140
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
141
+ inset?: boolean
142
+ }
143
+ >(({ className, inset, ...props }, ref) => (
144
+ <DropdownMenuPrimitive.Label
145
+ ref={ref}
146
+ className={cn(
147
+ "px-2 py-1.5 text-sm font-semibold",
148
+ inset && "pl-8",
149
+ className
150
+ )}
151
+ {...props}
152
+ />
153
+ ))
154
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
155
+
156
+ const DropdownMenuSeparator = React.forwardRef<
157
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
158
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
159
+ >(({ className, ...props }, ref) => (
160
+ <DropdownMenuPrimitive.Separator
161
+ ref={ref}
162
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
163
+ {...props}
164
+ />
165
+ ))
166
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
167
+
168
+ const DropdownMenuShortcut = ({
169
+ className,
170
+ ...props
171
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
172
+ return (
173
+ <span
174
+ className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
175
+ {...props}
176
+ />
177
+ )
178
+ }
179
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
180
+
181
+ export {
182
+ DropdownMenu,
183
+ DropdownMenuTrigger,
184
+ DropdownMenuContent,
185
+ DropdownMenuItem,
186
+ DropdownMenuCheckboxItem,
187
+ DropdownMenuRadioItem,
188
+ DropdownMenuLabel,
189
+ DropdownMenuSeparator,
190
+ DropdownMenuShortcut,
191
+ DropdownMenuGroup,
192
+ DropdownMenuPortal,
193
+ DropdownMenuSub,
194
+ DropdownMenuSubContent,
195
+ DropdownMenuSubTrigger,
196
+ DropdownMenuRadioGroup,
197
+ }