@blips/ui 0.0.1
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.
- package/dist/index.cjs +2675 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +514 -0
- package/dist/index.d.ts +514 -0
- package/dist/index.js +2418 -0
- package/dist/index.js.map +1 -0
- package/package.json +153 -0
- package/src/components/accordion.tsx +56 -0
- package/src/components/alert-dialog.tsx +138 -0
- package/src/components/alert.tsx +59 -0
- package/src/components/aspect-ratio.tsx +5 -0
- package/src/components/avatar.tsx +50 -0
- package/src/components/badge.tsx +36 -0
- package/src/components/breadcrumb.tsx +115 -0
- package/src/components/button.tsx +56 -0
- package/src/components/calendar.tsx +216 -0
- package/src/components/card.tsx +86 -0
- package/src/components/carousel.tsx +259 -0
- package/src/components/checkbox.tsx +28 -0
- package/src/components/collapsible.tsx +11 -0
- package/src/components/command.tsx +150 -0
- package/src/components/context-menu.tsx +198 -0
- package/src/components/dialog.tsx +122 -0
- package/src/components/drawer.tsx +116 -0
- package/src/components/dropdown-menu.tsx +200 -0
- package/src/components/hover-card.tsx +27 -0
- package/src/components/input-otp.tsx +69 -0
- package/src/components/input.tsx +22 -0
- package/src/components/label.tsx +26 -0
- package/src/components/menubar.tsx +254 -0
- package/src/components/navigation-menu.tsx +128 -0
- package/src/components/pagination.tsx +116 -0
- package/src/components/popover.tsx +29 -0
- package/src/components/progress.tsx +28 -0
- package/src/components/radio-group.tsx +42 -0
- package/src/components/resizable.tsx +45 -0
- package/src/components/scroll-area.tsx +46 -0
- package/src/components/select.tsx +160 -0
- package/src/components/separator.tsx +29 -0
- package/src/components/sheet.tsx +140 -0
- package/src/components/skeleton.tsx +15 -0
- package/src/components/slider.tsx +26 -0
- package/src/components/sonner.tsx +45 -0
- package/src/components/switch.tsx +27 -0
- package/src/components/table.tsx +117 -0
- package/src/components/tabs.tsx +53 -0
- package/src/components/textarea.tsx +22 -0
- package/src/components/toggle-group.tsx +60 -0
- package/src/components/toggle.tsx +43 -0
- package/src/components/tooltip.tsx +30 -0
- package/src/globals.css +77 -0
- package/src/index.ts +322 -0
- package/src/lib/utils.ts +6 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
10
|
+
|
|
11
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
12
|
+
|
|
13
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
14
|
+
|
|
15
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
16
|
+
|
|
17
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
18
|
+
|
|
19
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
20
|
+
|
|
21
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
24
|
+
inset?: boolean;
|
|
25
|
+
}
|
|
26
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
27
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(
|
|
30
|
+
"flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
31
|
+
inset && "pl-8",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<ChevronRight className="ml-auto" />
|
|
38
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
39
|
+
));
|
|
40
|
+
DropdownMenuSubTrigger.displayName =
|
|
41
|
+
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
42
|
+
|
|
43
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
44
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
46
|
+
>(({ className, ...props }, ref) => (
|
|
47
|
+
<DropdownMenuPrimitive.SubContent
|
|
48
|
+
ref={ref}
|
|
49
|
+
className={cn(
|
|
50
|
+
"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 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
51
|
+
className
|
|
52
|
+
)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
));
|
|
56
|
+
DropdownMenuSubContent.displayName =
|
|
57
|
+
DropdownMenuPrimitive.SubContent.displayName;
|
|
58
|
+
|
|
59
|
+
const DropdownMenuContent = React.forwardRef<
|
|
60
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
61
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
62
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
63
|
+
<DropdownMenuPrimitive.Portal>
|
|
64
|
+
<DropdownMenuPrimitive.Content
|
|
65
|
+
ref={ref}
|
|
66
|
+
sideOffset={sideOffset}
|
|
67
|
+
className={cn(
|
|
68
|
+
"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
</DropdownMenuPrimitive.Portal>
|
|
74
|
+
));
|
|
75
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
76
|
+
|
|
77
|
+
const DropdownMenuItem = React.forwardRef<
|
|
78
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
79
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
80
|
+
inset?: boolean;
|
|
81
|
+
}
|
|
82
|
+
>(({ className, inset, ...props }, ref) => (
|
|
83
|
+
<DropdownMenuPrimitive.Item
|
|
84
|
+
ref={ref}
|
|
85
|
+
className={cn(
|
|
86
|
+
"relative flex cursor-default select-none items-center gap-2 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 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
87
|
+
inset && "pl-8",
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
));
|
|
93
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
94
|
+
|
|
95
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
96
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
97
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
98
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
99
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn(
|
|
102
|
+
"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",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
checked={checked}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
109
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
110
|
+
<Check className="h-4 w-4" />
|
|
111
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
112
|
+
</span>
|
|
113
|
+
{children}
|
|
114
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
115
|
+
));
|
|
116
|
+
DropdownMenuCheckboxItem.displayName =
|
|
117
|
+
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
118
|
+
|
|
119
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
120
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
121
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
122
|
+
>(({ className, children, ...props }, ref) => (
|
|
123
|
+
<DropdownMenuPrimitive.RadioItem
|
|
124
|
+
ref={ref}
|
|
125
|
+
className={cn(
|
|
126
|
+
"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",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
>
|
|
131
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
132
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
133
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
134
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
135
|
+
</span>
|
|
136
|
+
{children}
|
|
137
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
138
|
+
));
|
|
139
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
140
|
+
|
|
141
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
142
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
143
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
144
|
+
inset?: boolean;
|
|
145
|
+
}
|
|
146
|
+
>(({ className, inset, ...props }, ref) => (
|
|
147
|
+
<DropdownMenuPrimitive.Label
|
|
148
|
+
ref={ref}
|
|
149
|
+
className={cn(
|
|
150
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
151
|
+
inset && "pl-8",
|
|
152
|
+
className
|
|
153
|
+
)}
|
|
154
|
+
{...props}
|
|
155
|
+
/>
|
|
156
|
+
));
|
|
157
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
158
|
+
|
|
159
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
160
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
161
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
162
|
+
>(({ className, ...props }, ref) => (
|
|
163
|
+
<DropdownMenuPrimitive.Separator
|
|
164
|
+
ref={ref}
|
|
165
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
));
|
|
169
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
170
|
+
|
|
171
|
+
const DropdownMenuShortcut = ({
|
|
172
|
+
className,
|
|
173
|
+
...props
|
|
174
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
175
|
+
return (
|
|
176
|
+
<span
|
|
177
|
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
DropdownMenu,
|
|
186
|
+
DropdownMenuTrigger,
|
|
187
|
+
DropdownMenuContent,
|
|
188
|
+
DropdownMenuItem,
|
|
189
|
+
DropdownMenuCheckboxItem,
|
|
190
|
+
DropdownMenuRadioItem,
|
|
191
|
+
DropdownMenuLabel,
|
|
192
|
+
DropdownMenuSeparator,
|
|
193
|
+
DropdownMenuShortcut,
|
|
194
|
+
DropdownMenuGroup,
|
|
195
|
+
DropdownMenuPortal,
|
|
196
|
+
DropdownMenuSub,
|
|
197
|
+
DropdownMenuSubContent,
|
|
198
|
+
DropdownMenuSubTrigger,
|
|
199
|
+
DropdownMenuRadioGroup,
|
|
200
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
|
|
6
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
9
|
+
|
|
10
|
+
const HoverCardContent = React.forwardRef<
|
|
11
|
+
React.ElementRef<typeof HoverCardPrimitive.Content>,
|
|
12
|
+
React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
|
|
13
|
+
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
|
|
14
|
+
<HoverCardPrimitive.Content
|
|
15
|
+
ref={ref}
|
|
16
|
+
align={align}
|
|
17
|
+
sideOffset={sideOffset}
|
|
18
|
+
className={cn(
|
|
19
|
+
"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 origin-[--radix-hover-card-content-transform-origin]",
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
));
|
|
25
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
26
|
+
|
|
27
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
2
|
+
import { Dot } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
|
|
7
|
+
const InputOTP = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof OTPInput>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof OTPInput>
|
|
10
|
+
>(({ className, containerClassName, ...props }, ref) => (
|
|
11
|
+
<OTPInput
|
|
12
|
+
ref={ref}
|
|
13
|
+
containerClassName={cn(
|
|
14
|
+
"flex items-center gap-2 has-[:disabled]:opacity-50",
|
|
15
|
+
containerClassName
|
|
16
|
+
)}
|
|
17
|
+
className={cn("disabled:cursor-not-allowed", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
));
|
|
21
|
+
InputOTP.displayName = "InputOTP";
|
|
22
|
+
|
|
23
|
+
const InputOTPGroup = React.forwardRef<
|
|
24
|
+
React.ElementRef<"div">,
|
|
25
|
+
React.ComponentPropsWithoutRef<"div">
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<div ref={ref} className={cn("flex items-center", className)} {...props} />
|
|
28
|
+
));
|
|
29
|
+
InputOTPGroup.displayName = "InputOTPGroup";
|
|
30
|
+
|
|
31
|
+
const InputOTPSlot = React.forwardRef<
|
|
32
|
+
React.ElementRef<"div">,
|
|
33
|
+
React.ComponentPropsWithoutRef<"div"> & { index: number }
|
|
34
|
+
>(({ index, className, ...props }, ref) => {
|
|
35
|
+
const inputOTPContext = React.useContext(OTPInputContext);
|
|
36
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={cn(
|
|
42
|
+
"relative flex h-10 w-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",
|
|
43
|
+
isActive && "z-10 ring-2 ring-ring ring-offset-background",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
{char}
|
|
49
|
+
{hasFakeCaret && (
|
|
50
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
51
|
+
<div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
InputOTPSlot.displayName = "InputOTPSlot";
|
|
58
|
+
|
|
59
|
+
const InputOTPSeparator = React.forwardRef<
|
|
60
|
+
React.ElementRef<"div">,
|
|
61
|
+
React.ComponentPropsWithoutRef<"div">
|
|
62
|
+
>(({ ...props }, ref) => (
|
|
63
|
+
<div ref={ref} role="separator" {...props}>
|
|
64
|
+
<Dot />
|
|
65
|
+
</div>
|
|
66
|
+
));
|
|
67
|
+
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
68
|
+
|
|
69
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
|
6
|
+
({ className, type, ...props }, ref) => {
|
|
7
|
+
return (
|
|
8
|
+
<input
|
|
9
|
+
type={type}
|
|
10
|
+
className={cn(
|
|
11
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground 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 md:text-sm",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
ref={ref}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
Input.displayName = "Input";
|
|
21
|
+
|
|
22
|
+
export { Input };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
const labelVariants = cva(
|
|
10
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const Label = React.forwardRef<
|
|
14
|
+
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
|
16
|
+
VariantProps<typeof labelVariants>
|
|
17
|
+
>(({ className, ...props }, ref) => (
|
|
18
|
+
<LabelPrimitive.Root
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(labelVariants(), className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
));
|
|
24
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
25
|
+
|
|
26
|
+
export { Label };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
2
|
+
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
|
|
7
|
+
function MenubarMenu({
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
|
|
10
|
+
return <MenubarPrimitive.Menu {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function MenubarGroup({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Group>) {
|
|
16
|
+
return <MenubarPrimitive.Group {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function MenubarPortal({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
|
|
22
|
+
return <MenubarPrimitive.Portal {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function MenubarRadioGroup({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
|
|
28
|
+
return <MenubarPrimitive.RadioGroup {...props} />;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function MenubarSub({
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
|
|
34
|
+
return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const Menubar = React.forwardRef<
|
|
38
|
+
React.ElementRef<typeof MenubarPrimitive.Root>,
|
|
39
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
|
|
40
|
+
>(({ className, ...props }, ref) => (
|
|
41
|
+
<MenubarPrimitive.Root
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn(
|
|
44
|
+
"flex h-10 items-center space-x-1 rounded-md border bg-background p-1",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
));
|
|
50
|
+
Menubar.displayName = MenubarPrimitive.Root.displayName;
|
|
51
|
+
|
|
52
|
+
const MenubarTrigger = React.forwardRef<
|
|
53
|
+
React.ElementRef<typeof MenubarPrimitive.Trigger>,
|
|
54
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
|
|
55
|
+
>(({ className, ...props }, ref) => (
|
|
56
|
+
<MenubarPrimitive.Trigger
|
|
57
|
+
ref={ref}
|
|
58
|
+
className={cn(
|
|
59
|
+
"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",
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
));
|
|
65
|
+
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
|
|
66
|
+
|
|
67
|
+
const MenubarSubTrigger = React.forwardRef<
|
|
68
|
+
React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
|
|
69
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
|
|
70
|
+
inset?: boolean;
|
|
71
|
+
}
|
|
72
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
73
|
+
<MenubarPrimitive.SubTrigger
|
|
74
|
+
ref={ref}
|
|
75
|
+
className={cn(
|
|
76
|
+
"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",
|
|
77
|
+
inset && "pl-8",
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
84
|
+
</MenubarPrimitive.SubTrigger>
|
|
85
|
+
));
|
|
86
|
+
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
|
|
87
|
+
|
|
88
|
+
const MenubarSubContent = React.forwardRef<
|
|
89
|
+
React.ElementRef<typeof MenubarPrimitive.SubContent>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
|
|
91
|
+
>(({ className, ...props }, ref) => (
|
|
92
|
+
<MenubarPrimitive.SubContent
|
|
93
|
+
ref={ref}
|
|
94
|
+
className={cn(
|
|
95
|
+
"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 origin-[--radix-menubar-content-transform-origin]",
|
|
96
|
+
className
|
|
97
|
+
)}
|
|
98
|
+
{...props}
|
|
99
|
+
/>
|
|
100
|
+
));
|
|
101
|
+
MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
|
|
102
|
+
|
|
103
|
+
const MenubarContent = React.forwardRef<
|
|
104
|
+
React.ElementRef<typeof MenubarPrimitive.Content>,
|
|
105
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
|
|
106
|
+
>(
|
|
107
|
+
(
|
|
108
|
+
{ className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
|
|
109
|
+
ref
|
|
110
|
+
) => (
|
|
111
|
+
<MenubarPrimitive.Portal>
|
|
112
|
+
<MenubarPrimitive.Content
|
|
113
|
+
ref={ref}
|
|
114
|
+
align={align}
|
|
115
|
+
alignOffset={alignOffset}
|
|
116
|
+
sideOffset={sideOffset}
|
|
117
|
+
className={cn(
|
|
118
|
+
"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 origin-[--radix-menubar-content-transform-origin]",
|
|
119
|
+
className
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
</MenubarPrimitive.Portal>
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
MenubarContent.displayName = MenubarPrimitive.Content.displayName;
|
|
127
|
+
|
|
128
|
+
const MenubarItem = React.forwardRef<
|
|
129
|
+
React.ElementRef<typeof MenubarPrimitive.Item>,
|
|
130
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
|
|
131
|
+
inset?: boolean;
|
|
132
|
+
}
|
|
133
|
+
>(({ className, inset, ...props }, ref) => (
|
|
134
|
+
<MenubarPrimitive.Item
|
|
135
|
+
ref={ref}
|
|
136
|
+
className={cn(
|
|
137
|
+
"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",
|
|
138
|
+
inset && "pl-8",
|
|
139
|
+
className
|
|
140
|
+
)}
|
|
141
|
+
{...props}
|
|
142
|
+
/>
|
|
143
|
+
));
|
|
144
|
+
MenubarItem.displayName = MenubarPrimitive.Item.displayName;
|
|
145
|
+
|
|
146
|
+
const MenubarCheckboxItem = React.forwardRef<
|
|
147
|
+
React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
|
|
148
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
|
|
149
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
150
|
+
<MenubarPrimitive.CheckboxItem
|
|
151
|
+
ref={ref}
|
|
152
|
+
className={cn(
|
|
153
|
+
"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",
|
|
154
|
+
className
|
|
155
|
+
)}
|
|
156
|
+
checked={checked}
|
|
157
|
+
{...props}
|
|
158
|
+
>
|
|
159
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
160
|
+
<MenubarPrimitive.ItemIndicator>
|
|
161
|
+
<Check className="h-4 w-4" />
|
|
162
|
+
</MenubarPrimitive.ItemIndicator>
|
|
163
|
+
</span>
|
|
164
|
+
{children}
|
|
165
|
+
</MenubarPrimitive.CheckboxItem>
|
|
166
|
+
));
|
|
167
|
+
MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
|
|
168
|
+
|
|
169
|
+
const MenubarRadioItem = React.forwardRef<
|
|
170
|
+
React.ElementRef<typeof MenubarPrimitive.RadioItem>,
|
|
171
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
|
|
172
|
+
>(({ className, children, ...props }, ref) => (
|
|
173
|
+
<MenubarPrimitive.RadioItem
|
|
174
|
+
ref={ref}
|
|
175
|
+
className={cn(
|
|
176
|
+
"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",
|
|
177
|
+
className
|
|
178
|
+
)}
|
|
179
|
+
{...props}
|
|
180
|
+
>
|
|
181
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
182
|
+
<MenubarPrimitive.ItemIndicator>
|
|
183
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
184
|
+
</MenubarPrimitive.ItemIndicator>
|
|
185
|
+
</span>
|
|
186
|
+
{children}
|
|
187
|
+
</MenubarPrimitive.RadioItem>
|
|
188
|
+
));
|
|
189
|
+
MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
|
|
190
|
+
|
|
191
|
+
const MenubarLabel = React.forwardRef<
|
|
192
|
+
React.ElementRef<typeof MenubarPrimitive.Label>,
|
|
193
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
|
|
194
|
+
inset?: boolean;
|
|
195
|
+
}
|
|
196
|
+
>(({ className, inset, ...props }, ref) => (
|
|
197
|
+
<MenubarPrimitive.Label
|
|
198
|
+
ref={ref}
|
|
199
|
+
className={cn(
|
|
200
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
201
|
+
inset && "pl-8",
|
|
202
|
+
className
|
|
203
|
+
)}
|
|
204
|
+
{...props}
|
|
205
|
+
/>
|
|
206
|
+
));
|
|
207
|
+
MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
|
|
208
|
+
|
|
209
|
+
const MenubarSeparator = React.forwardRef<
|
|
210
|
+
React.ElementRef<typeof MenubarPrimitive.Separator>,
|
|
211
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
|
|
212
|
+
>(({ className, ...props }, ref) => (
|
|
213
|
+
<MenubarPrimitive.Separator
|
|
214
|
+
ref={ref}
|
|
215
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
216
|
+
{...props}
|
|
217
|
+
/>
|
|
218
|
+
));
|
|
219
|
+
MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName;
|
|
220
|
+
|
|
221
|
+
const MenubarShortcut = ({
|
|
222
|
+
className,
|
|
223
|
+
...props
|
|
224
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
225
|
+
return (
|
|
226
|
+
<span
|
|
227
|
+
className={cn(
|
|
228
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
229
|
+
className
|
|
230
|
+
)}
|
|
231
|
+
{...props}
|
|
232
|
+
/>
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
MenubarShortcut.displayname = "MenubarShortcut";
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
Menubar,
|
|
239
|
+
MenubarMenu,
|
|
240
|
+
MenubarTrigger,
|
|
241
|
+
MenubarContent,
|
|
242
|
+
MenubarItem,
|
|
243
|
+
MenubarSeparator,
|
|
244
|
+
MenubarLabel,
|
|
245
|
+
MenubarCheckboxItem,
|
|
246
|
+
MenubarRadioGroup,
|
|
247
|
+
MenubarRadioItem,
|
|
248
|
+
MenubarPortal,
|
|
249
|
+
MenubarSubContent,
|
|
250
|
+
MenubarSubTrigger,
|
|
251
|
+
MenubarGroup,
|
|
252
|
+
MenubarSub,
|
|
253
|
+
MenubarShortcut,
|
|
254
|
+
};
|