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
package/src/form.tsx ADDED
@@ -0,0 +1,175 @@
1
+ import * as React from "react"
2
+ import * as LabelPrimitive from "@radix-ui/react-label"
3
+ import { Slot } from "@radix-ui/react-slot"
4
+ import {
5
+ Controller,
6
+ type ControllerProps,
7
+ type FieldPath,
8
+ type FieldValues,
9
+ FormProvider,
10
+ useFormContext,
11
+ } from "react-hook-form"
12
+ import { cn } from "./lib/utils"
13
+ import { Label } from "./label"
14
+
15
+ const Form = FormProvider
16
+
17
+ type FormFieldContextValue<
18
+ TFieldValues extends FieldValues = FieldValues,
19
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
20
+ > = {
21
+ name: TName
22
+ }
23
+
24
+ const FormFieldContext = React.createContext<FormFieldContextValue>(
25
+ {} as FormFieldContextValue
26
+ )
27
+
28
+ const FormField = <
29
+ TFieldValues extends FieldValues = FieldValues,
30
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
31
+ >({
32
+ ...props
33
+ }: ControllerProps<TFieldValues, TName>) => {
34
+ return (
35
+ <FormFieldContext.Provider value={{ name: props.name }}>
36
+ <Controller {...props} />
37
+ </FormFieldContext.Provider>
38
+ )
39
+ }
40
+
41
+ const useFormField = () => {
42
+ const fieldContext = React.useContext(FormFieldContext)
43
+ const itemContext = React.useContext(FormItemContext)
44
+ const { getFieldState, formState } = useFormContext()
45
+
46
+ const fieldState = getFieldState(fieldContext.name, formState)
47
+
48
+ if (!fieldContext) {
49
+ throw new Error("useFormField should be used within <FormField>")
50
+ }
51
+
52
+ const { id } = itemContext
53
+
54
+ return {
55
+ id,
56
+ name: fieldContext.name,
57
+ formItemId: `${id}-form-item`,
58
+ formDescriptionId: `${id}-form-item-description`,
59
+ formMessageId: `${id}-form-item-message`,
60
+ ...fieldState,
61
+ }
62
+ }
63
+
64
+ type FormItemContextValue = {
65
+ id: string
66
+ }
67
+
68
+ const FormItemContext = React.createContext<FormItemContextValue>(
69
+ {} as FormItemContextValue
70
+ )
71
+
72
+ const FormItem = React.forwardRef<
73
+ HTMLDivElement,
74
+ React.HTMLAttributes<HTMLDivElement>
75
+ >(({ className, ...props }, ref) => {
76
+ const id = React.useId()
77
+
78
+ return (
79
+ <FormItemContext.Provider value={{ id }}>
80
+ <div ref={ref} className={cn("space-y-2", className)} {...props} />
81
+ </FormItemContext.Provider>
82
+ )
83
+ })
84
+ FormItem.displayName = "FormItem"
85
+
86
+ const FormLabel = React.forwardRef<
87
+ React.ElementRef<typeof LabelPrimitive.Root>,
88
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
89
+ >(({ className, ...props }, ref) => {
90
+ const { error, formItemId } = useFormField()
91
+
92
+ return (
93
+ <Label
94
+ ref={ref}
95
+ className={cn(error && "text-destructive", className)}
96
+ htmlFor={formItemId}
97
+ {...props}
98
+ />
99
+ )
100
+ })
101
+ FormLabel.displayName = "FormLabel"
102
+
103
+ const FormControl = React.forwardRef<
104
+ React.ElementRef<typeof Slot>,
105
+ React.ComponentPropsWithoutRef<typeof Slot>
106
+ >(({ ...props }, ref) => {
107
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
108
+
109
+ return (
110
+ <Slot
111
+ ref={ref}
112
+ id={formItemId}
113
+ aria-describedby={
114
+ !error
115
+ ? `${formDescriptionId}`
116
+ : `${formDescriptionId} ${formMessageId}`
117
+ }
118
+ aria-invalid={!!error}
119
+ {...props}
120
+ />
121
+ )
122
+ })
123
+ FormControl.displayName = "FormControl"
124
+
125
+ const FormDescription = React.forwardRef<
126
+ HTMLParagraphElement,
127
+ React.HTMLAttributes<HTMLParagraphElement>
128
+ >(({ className, ...props }, ref) => {
129
+ const { formDescriptionId } = useFormField()
130
+
131
+ return (
132
+ <p
133
+ ref={ref}
134
+ id={formDescriptionId}
135
+ className={cn("text-sm text-muted-foreground", className)}
136
+ {...props}
137
+ />
138
+ )
139
+ })
140
+ FormDescription.displayName = "FormDescription"
141
+
142
+ const FormMessage = React.forwardRef<
143
+ HTMLParagraphElement,
144
+ React.HTMLAttributes<HTMLParagraphElement>
145
+ >(({ className, children, ...props }, ref) => {
146
+ const { error, formMessageId } = useFormField()
147
+ const body = error ? String(error?.message) : children
148
+
149
+ if (!body) {
150
+ return null
151
+ }
152
+
153
+ return (
154
+ <p
155
+ ref={ref}
156
+ id={formMessageId}
157
+ className={cn("text-sm font-medium text-destructive", className)}
158
+ {...props}
159
+ >
160
+ {body}
161
+ </p>
162
+ )
163
+ })
164
+ FormMessage.displayName = "FormMessage"
165
+
166
+ export {
167
+ useFormField,
168
+ Form,
169
+ FormItem,
170
+ FormLabel,
171
+ FormControl,
172
+ FormDescription,
173
+ FormMessage,
174
+ FormField,
175
+ }
@@ -0,0 +1,26 @@
1
+ import * as React from "react"
2
+ import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const HoverCard = HoverCardPrimitive.Root
6
+
7
+ const HoverCardTrigger = HoverCardPrimitive.Trigger
8
+
9
+ const HoverCardContent = React.forwardRef<
10
+ React.ElementRef<typeof HoverCardPrimitive.Content>,
11
+ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
12
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
13
+ <HoverCardPrimitive.Content
14
+ ref={ref}
15
+ align={align}
16
+ sideOffset={sideOffset}
17
+ className={cn(
18
+ "z-50 w-64 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",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ ))
24
+ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
25
+
26
+ export { HoverCard, HoverCardTrigger, HoverCardContent }
@@ -0,0 +1,68 @@
1
+ import * as React from "react"
2
+ import { OTPInput, OTPInputContext } from "input-otp"
3
+ import { Dot } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const InputOTP = React.forwardRef<
7
+ React.ElementRef<typeof OTPInput>,
8
+ React.ComponentPropsWithoutRef<typeof OTPInput>
9
+ >(({ className, containerClassName, ...props }, ref) => (
10
+ <OTPInput
11
+ ref={ref}
12
+ containerClassName={cn(
13
+ "flex items-center gap-2 has-[:disabled]:opacity-50",
14
+ containerClassName
15
+ )}
16
+ className={cn("disabled:cursor-not-allowed", className)}
17
+ {...props}
18
+ />
19
+ ))
20
+ InputOTP.displayName = "InputOTP"
21
+
22
+ const InputOTPGroup = React.forwardRef<
23
+ React.ElementRef<"div">,
24
+ React.ComponentPropsWithoutRef<"div">
25
+ >(({ className, ...props }, ref) => (
26
+ <div ref={ref} className={cn("flex items-center", className)} {...props} />
27
+ ))
28
+ InputOTPGroup.displayName = "InputOTPGroup"
29
+
30
+ const InputOTPSlot = React.forwardRef<
31
+ React.ElementRef<"div">,
32
+ React.ComponentPropsWithoutRef<"div"> & { index: number }
33
+ >(({ index, className, ...props }, ref) => {
34
+ const inputOTPContext = React.useContext(OTPInputContext)
35
+ const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
36
+
37
+ return (
38
+ <div
39
+ ref={ref}
40
+ className={cn(
41
+ "relative flex size-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
42
+ isActive && "z-10 ring-2 ring-ring ring-offset-background",
43
+ className
44
+ )}
45
+ {...props}
46
+ >
47
+ {char}
48
+ {hasFakeCaret && (
49
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
50
+ <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
51
+ </div>
52
+ )}
53
+ </div>
54
+ )
55
+ })
56
+ InputOTPSlot.displayName = "InputOTPSlot"
57
+
58
+ const InputOTPSeparator = React.forwardRef<
59
+ React.ElementRef<"div">,
60
+ React.ComponentPropsWithoutRef<"div">
61
+ >(({ ...props }, ref) => (
62
+ <div ref={ref} role="separator" {...props}>
63
+ <Dot />
64
+ </div>
65
+ ))
66
+ InputOTPSeparator.displayName = "InputOTPSeparator"
67
+
68
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
package/src/label.tsx ADDED
@@ -0,0 +1,23 @@
1
+ import * as React from "react"
2
+ import * as LabelPrimitive from "@radix-ui/react-label"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const labelVariants = cva(
7
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
8
+ )
9
+
10
+ const Label = React.forwardRef<
11
+ React.ElementRef<typeof LabelPrimitive.Root>,
12
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
13
+ VariantProps<typeof labelVariants>
14
+ >(({ className, ...props }, ref) => (
15
+ <LabelPrimitive.Root
16
+ ref={ref}
17
+ className={cn(labelVariants(), className)}
18
+ {...props}
19
+ />
20
+ ))
21
+ Label.displayName = LabelPrimitive.Root.displayName
22
+
23
+ export { Label }
@@ -0,0 +1,233 @@
1
+ import * as React from "react"
2
+ import * as MenubarPrimitive from "@radix-ui/react-menubar"
3
+ import { Check, ChevronRight, Circle } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const MenubarMenu: typeof MenubarPrimitive.Menu = MenubarPrimitive.Menu
7
+
8
+ const MenubarGroup: typeof MenubarPrimitive.Group = MenubarPrimitive.Group
9
+
10
+ const MenubarPortal: typeof MenubarPrimitive.Portal = MenubarPrimitive.Portal
11
+
12
+ const MenubarSub: typeof MenubarPrimitive.Sub = MenubarPrimitive.Sub
13
+
14
+ const MenubarRadioGroup: typeof MenubarPrimitive.RadioGroup = MenubarPrimitive.RadioGroup
15
+
16
+ const Menubar = React.forwardRef<
17
+ React.ElementRef<typeof MenubarPrimitive.Root>,
18
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
19
+ >(({ className, ...props }, ref) => (
20
+ <MenubarPrimitive.Root
21
+ ref={ref}
22
+ className={cn(
23
+ "flex h-10 items-center space-x-1 rounded-md border bg-background p-1",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ ))
29
+ Menubar.displayName = MenubarPrimitive.Root.displayName
30
+
31
+ const MenubarTrigger = React.forwardRef<
32
+ React.ElementRef<typeof MenubarPrimitive.Trigger>,
33
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
34
+ >(({ className, ...props }, ref) => (
35
+ <MenubarPrimitive.Trigger
36
+ ref={ref}
37
+ className={cn(
38
+ "flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
39
+ className
40
+ )}
41
+ {...props}
42
+ />
43
+ ))
44
+ MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName
45
+
46
+ const MenubarSubTrigger = React.forwardRef<
47
+ React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
48
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
49
+ inset?: boolean
50
+ }
51
+ >(({ className, inset, children, ...props }, ref) => (
52
+ <MenubarPrimitive.SubTrigger
53
+ ref={ref}
54
+ className={cn(
55
+ "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",
56
+ inset && "pl-8",
57
+ className
58
+ )}
59
+ {...props}
60
+ >
61
+ {children}
62
+ <ChevronRight className="ml-auto size-4" />
63
+ </MenubarPrimitive.SubTrigger>
64
+ ))
65
+ MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
66
+
67
+ const MenubarSubContent = React.forwardRef<
68
+ React.ElementRef<typeof MenubarPrimitive.SubContent>,
69
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
70
+ >(({ className, ...props }, ref) => (
71
+ <MenubarPrimitive.SubContent
72
+ ref={ref}
73
+ className={cn(
74
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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",
75
+ className
76
+ )}
77
+ {...props}
78
+ />
79
+ ))
80
+ MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName
81
+
82
+ const MenubarContent = React.forwardRef<
83
+ React.ElementRef<typeof MenubarPrimitive.Content>,
84
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
85
+ >(
86
+ (
87
+ { className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
88
+ ref
89
+ ) => (
90
+ <MenubarPrimitive.Portal>
91
+ <MenubarPrimitive.Content
92
+ ref={ref}
93
+ align={align}
94
+ alignOffset={alignOffset}
95
+ sideOffset={sideOffset}
96
+ className={cn(
97
+ "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in 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",
98
+ className
99
+ )}
100
+ {...props}
101
+ />
102
+ </MenubarPrimitive.Portal>
103
+ )
104
+ )
105
+ MenubarContent.displayName = MenubarPrimitive.Content.displayName
106
+
107
+ const MenubarItem = React.forwardRef<
108
+ React.ElementRef<typeof MenubarPrimitive.Item>,
109
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
110
+ inset?: boolean
111
+ }
112
+ >(({ className, inset, ...props }, ref) => (
113
+ <MenubarPrimitive.Item
114
+ ref={ref}
115
+ className={cn(
116
+ "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",
117
+ inset && "pl-8",
118
+ className
119
+ )}
120
+ {...props}
121
+ />
122
+ ))
123
+ MenubarItem.displayName = MenubarPrimitive.Item.displayName
124
+
125
+ const MenubarCheckboxItem = React.forwardRef<
126
+ React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
127
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
128
+ >(({ className, children, checked, ...props }, ref) => (
129
+ <MenubarPrimitive.CheckboxItem
130
+ ref={ref}
131
+ className={cn(
132
+ "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",
133
+ className
134
+ )}
135
+ checked={checked}
136
+ {...props}
137
+ >
138
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
139
+ <MenubarPrimitive.ItemIndicator>
140
+ <Check className="size-4" />
141
+ </MenubarPrimitive.ItemIndicator>
142
+ </span>
143
+ {children}
144
+ </MenubarPrimitive.CheckboxItem>
145
+ ))
146
+ MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName
147
+
148
+ const MenubarRadioItem = React.forwardRef<
149
+ React.ElementRef<typeof MenubarPrimitive.RadioItem>,
150
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
151
+ >(({ className, children, ...props }, ref) => (
152
+ <MenubarPrimitive.RadioItem
153
+ ref={ref}
154
+ className={cn(
155
+ "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",
156
+ className
157
+ )}
158
+ {...props}
159
+ >
160
+ <span className="absolute left-2 flex size-3.5 items-center justify-center">
161
+ <MenubarPrimitive.ItemIndicator>
162
+ <Circle className="size-2 fill-current" />
163
+ </MenubarPrimitive.ItemIndicator>
164
+ </span>
165
+ {children}
166
+ </MenubarPrimitive.RadioItem>
167
+ ))
168
+ MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName
169
+
170
+ const MenubarLabel = React.forwardRef<
171
+ React.ElementRef<typeof MenubarPrimitive.Label>,
172
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
173
+ inset?: boolean
174
+ }
175
+ >(({ className, inset, ...props }, ref) => (
176
+ <MenubarPrimitive.Label
177
+ ref={ref}
178
+ className={cn(
179
+ "px-2 py-1.5 text-sm font-semibold",
180
+ inset && "pl-8",
181
+ className
182
+ )}
183
+ {...props}
184
+ />
185
+ ))
186
+ MenubarLabel.displayName = MenubarPrimitive.Label.displayName
187
+
188
+ const MenubarSeparator = React.forwardRef<
189
+ React.ElementRef<typeof MenubarPrimitive.Separator>,
190
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
191
+ >(({ className, ...props }, ref) => (
192
+ <MenubarPrimitive.Separator
193
+ ref={ref}
194
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
195
+ {...props}
196
+ />
197
+ ))
198
+ MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName
199
+
200
+ const MenubarShortcut = ({
201
+ className,
202
+ ...props
203
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
204
+ return (
205
+ <span
206
+ className={cn(
207
+ "ml-auto text-xs tracking-widest text-muted-foreground",
208
+ className
209
+ )}
210
+ {...props}
211
+ />
212
+ )
213
+ }
214
+ MenubarShortcut.displayname = "MenubarShortcut"
215
+
216
+ export {
217
+ Menubar,
218
+ MenubarMenu,
219
+ MenubarTrigger,
220
+ MenubarContent,
221
+ MenubarItem,
222
+ MenubarSeparator,
223
+ MenubarLabel,
224
+ MenubarCheckboxItem,
225
+ MenubarRadioGroup,
226
+ MenubarRadioItem,
227
+ MenubarPortal,
228
+ MenubarSubContent,
229
+ MenubarSubTrigger,
230
+ MenubarGroup,
231
+ MenubarSub,
232
+ MenubarShortcut,
233
+ }
@@ -0,0 +1,29 @@
1
+ import * as React from "react"
2
+ import { ChevronDown } from "lucide-react"
3
+ import { cn } from "./lib/utils"
4
+
5
+ export interface NativeSelectProps
6
+ extends React.SelectHTMLAttributes<HTMLSelectElement> {}
7
+
8
+ const NativeSelect = React.forwardRef<HTMLSelectElement, NativeSelectProps>(
9
+ ({ className, children, ...props }, ref) => {
10
+ return (
11
+ <div className="relative">
12
+ <select
13
+ className={cn(
14
+ "flex h-10 w-full appearance-none items-center justify-between rounded-md border border-input bg-background px-3 py-2 pr-8 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",
15
+ className
16
+ )}
17
+ ref={ref}
18
+ {...props}
19
+ >
20
+ {children}
21
+ </select>
22
+ <ChevronDown className="pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 opacity-50" />
23
+ </div>
24
+ )
25
+ }
26
+ )
27
+ NativeSelect.displayName = "NativeSelect"
28
+
29
+ export { NativeSelect }
@@ -0,0 +1,127 @@
1
+ import * as React from "react"
2
+ import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
3
+ import { cva } from "class-variance-authority"
4
+ import { ChevronDown } from "lucide-react"
5
+ import { cn } from "./lib/utils"
6
+
7
+ const NavigationMenu = React.forwardRef<
8
+ React.ElementRef<typeof NavigationMenuPrimitive.Root>,
9
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
10
+ >(({ className, children, ...props }, ref) => (
11
+ <NavigationMenuPrimitive.Root
12
+ ref={ref}
13
+ className={cn(
14
+ "relative z-10 flex max-w-max flex-1 items-center justify-center",
15
+ className
16
+ )}
17
+ {...props}
18
+ >
19
+ {children}
20
+ <NavigationMenuViewport />
21
+ </NavigationMenuPrimitive.Root>
22
+ ))
23
+ NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
24
+
25
+ const NavigationMenuList = React.forwardRef<
26
+ React.ElementRef<typeof NavigationMenuPrimitive.List>,
27
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
28
+ >(({ className, ...props }, ref) => (
29
+ <NavigationMenuPrimitive.List
30
+ ref={ref}
31
+ className={cn(
32
+ "group flex flex-1 list-none items-center justify-center space-x-1",
33
+ className
34
+ )}
35
+ {...props}
36
+ />
37
+ ))
38
+ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
39
+
40
+ const NavigationMenuItem = NavigationMenuPrimitive.Item
41
+
42
+ const navigationMenuTriggerStyle = cva(
43
+ "group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"
44
+ )
45
+
46
+ const NavigationMenuTrigger = React.forwardRef<
47
+ React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
48
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
49
+ >(({ className, children, ...props }, ref) => (
50
+ <NavigationMenuPrimitive.Trigger
51
+ ref={ref}
52
+ className={cn(navigationMenuTriggerStyle(), "group", className)}
53
+ {...props}
54
+ >
55
+ {children}{" "}
56
+ <ChevronDown
57
+ className="relative top-[1px] ml-1 size-3 transition duration-200 group-data-[state=open]:rotate-180"
58
+ aria-hidden="true"
59
+ />
60
+ </NavigationMenuPrimitive.Trigger>
61
+ ))
62
+ NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
63
+
64
+ const NavigationMenuContent = React.forwardRef<
65
+ React.ElementRef<typeof NavigationMenuPrimitive.Content>,
66
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
67
+ >(({ className, ...props }, ref) => (
68
+ <NavigationMenuPrimitive.Content
69
+ ref={ref}
70
+ className={cn(
71
+ "left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",
72
+ className
73
+ )}
74
+ {...props}
75
+ />
76
+ ))
77
+ NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
78
+
79
+ const NavigationMenuLink = NavigationMenuPrimitive.Link
80
+
81
+ const NavigationMenuViewport = React.forwardRef<
82
+ React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
83
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
84
+ >(({ className, ...props }, ref) => (
85
+ <div className={cn("absolute left-0 top-full flex justify-center")}>
86
+ <NavigationMenuPrimitive.Viewport
87
+ className={cn(
88
+ "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
89
+ className
90
+ )}
91
+ ref={ref}
92
+ {...props}
93
+ />
94
+ </div>
95
+ ))
96
+ NavigationMenuViewport.displayName =
97
+ NavigationMenuPrimitive.Viewport.displayName
98
+
99
+ const NavigationMenuIndicator = React.forwardRef<
100
+ React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
101
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
102
+ >(({ className, ...props }, ref) => (
103
+ <NavigationMenuPrimitive.Indicator
104
+ ref={ref}
105
+ className={cn(
106
+ "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
107
+ className
108
+ )}
109
+ {...props}
110
+ >
111
+ <div className="relative top-[60%] size-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
112
+ </NavigationMenuPrimitive.Indicator>
113
+ ))
114
+ NavigationMenuIndicator.displayName =
115
+ NavigationMenuPrimitive.Indicator.displayName
116
+
117
+ export {
118
+ navigationMenuTriggerStyle,
119
+ NavigationMenu,
120
+ NavigationMenuList,
121
+ NavigationMenuItem,
122
+ NavigationMenuContent,
123
+ NavigationMenuTrigger,
124
+ NavigationMenuLink,
125
+ NavigationMenuIndicator,
126
+ NavigationMenuViewport,
127
+ }