@mbao01/common 0.0.20 → 0.0.21

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 (37) hide show
  1. package/dist/types/components/Command/Command.d.ts +5 -5
  2. package/dist/types/components/Menu/ContextMenu/ContextMenu.d.ts +36 -0
  3. package/dist/types/components/Menu/ContextMenu/constants.d.ts +0 -0
  4. package/dist/types/components/Menu/ContextMenu/index.d.ts +1 -0
  5. package/dist/types/components/Menu/ContextMenu/types.d.ts +14 -0
  6. package/dist/types/components/Menu/DropdownMenu/DropdownMenu.d.ts +36 -0
  7. package/dist/types/components/Menu/DropdownMenu/index.d.ts +1 -0
  8. package/dist/types/components/Menu/DropdownMenu/types.d.ts +14 -0
  9. package/dist/types/components/Menu/Menubar/Menubar.d.ts +43 -0
  10. package/dist/types/components/Menu/Menubar/constants.d.ts +25 -0
  11. package/dist/types/components/Menu/Menubar/index.d.ts +1 -0
  12. package/dist/types/components/Menu/Menubar/types.d.ts +15 -0
  13. package/dist/types/components/Menu/NavigationMenu/NavigationMenu.d.ts +17 -0
  14. package/dist/types/components/Menu/NavigationMenu/constants.d.ts +8 -0
  15. package/dist/types/components/Menu/NavigationMenu/index.d.ts +1 -0
  16. package/dist/types/components/Menu/NavigationMenu/types.d.ts +10 -0
  17. package/dist/types/components/Menu/index.d.ts +4 -0
  18. package/dist/types/components/Skeleton/constants.d.ts +2 -2
  19. package/dist/types/index.d.ts +1 -0
  20. package/package.json +6 -2
  21. package/src/components/Menu/ContextMenu/ContextMenu.tsx +180 -0
  22. package/src/components/Menu/ContextMenu/constants.ts +0 -0
  23. package/src/components/Menu/ContextMenu/index.ts +1 -0
  24. package/src/components/Menu/ContextMenu/types.ts +60 -0
  25. package/src/components/Menu/DropdownMenu/DropdownMenu.tsx +183 -0
  26. package/src/components/Menu/DropdownMenu/index.ts +1 -0
  27. package/src/components/Menu/DropdownMenu/types.ts +60 -0
  28. package/src/components/Menu/Menubar/Menubar.tsx +204 -0
  29. package/src/components/Menu/Menubar/constants.ts +107 -0
  30. package/src/components/Menu/Menubar/index.ts +1 -0
  31. package/src/components/Menu/Menubar/types.ts +66 -0
  32. package/src/components/Menu/NavigationMenu/NavigationMenu.tsx +117 -0
  33. package/src/components/Menu/NavigationMenu/constants.ts +47 -0
  34. package/src/components/Menu/NavigationMenu/index.ts +1 -0
  35. package/src/components/Menu/NavigationMenu/types.ts +40 -0
  36. package/src/components/Menu/index.ts +4 -0
  37. package/src/index.ts +1 -0
@@ -0,0 +1,183 @@
1
+ "use client";
2
+
3
+ import { forwardRef } from "react";
4
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
+ import {
6
+ CheckIcon,
7
+ ChevronRightIcon,
8
+ DotFilledIcon,
9
+ } from "@radix-ui/react-icons";
10
+ import type {
11
+ DropdownMenuCheckboxItemProps,
12
+ DropdownMenuContentProps,
13
+ DropdownMenuItemProps,
14
+ DropdownMenuLabelProps,
15
+ DropdownMenuProps,
16
+ DropdownMenuRadioItemProps,
17
+ DropdownMenuSeparatorProps,
18
+ DropdownMenuShortcutProps,
19
+ DropdownMenuSubContentProps,
20
+ DropdownMenuSubTriggerProps,
21
+ } from "./types";
22
+ import { cn } from "../../../utilities";
23
+ import {
24
+ getMenubarCheckboxItemClasses,
25
+ getMenubarContentClasses,
26
+ getMenubarItemClasses,
27
+ getMenubarLabelClasses,
28
+ getMenubarRadioItemClasses,
29
+ getMenubarSeparatorClasses,
30
+ getMenubarShortcutClasses,
31
+ getMenubarSubContentClasses,
32
+ getMenubarSubTriggerClasses,
33
+ } from "../Menubar/constants";
34
+
35
+ const DropdownMenu = (props: DropdownMenuProps) => (
36
+ <DropdownMenuPrimitive.Root {...props} />
37
+ );
38
+
39
+ const DropdownMenuSubTrigger = forwardRef<
40
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
41
+ DropdownMenuSubTriggerProps
42
+ >(({ className, inset, variant, children, ...props }, ref) => (
43
+ <DropdownMenuPrimitive.SubTrigger
44
+ ref={ref}
45
+ className={cn(getMenubarSubTriggerClasses({ inset, variant }), className)}
46
+ {...props}
47
+ >
48
+ {children}
49
+ <ChevronRightIcon className="ml-auto h-4 w-4" />
50
+ </DropdownMenuPrimitive.SubTrigger>
51
+ ));
52
+ DropdownMenuSubTrigger.displayName =
53
+ DropdownMenuPrimitive.SubTrigger.displayName;
54
+
55
+ const DropdownMenuSubContent = forwardRef<
56
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
57
+ DropdownMenuSubContentProps
58
+ >(({ className, ...props }, ref) => (
59
+ <DropdownMenuPrimitive.SubContent
60
+ ref={ref}
61
+ className={cn(getMenubarSubContentClasses(), className)}
62
+ {...props}
63
+ />
64
+ ));
65
+ DropdownMenuSubContent.displayName =
66
+ DropdownMenuPrimitive.SubContent.displayName;
67
+
68
+ const DropdownMenuContent = forwardRef<
69
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
70
+ DropdownMenuContentProps
71
+ >(({ className, sideOffset = 4, ...props }, ref) => (
72
+ <DropdownMenuPrimitive.Portal>
73
+ <DropdownMenuPrimitive.Content
74
+ ref={ref}
75
+ sideOffset={sideOffset}
76
+ className={cn(getMenubarContentClasses(), className)}
77
+ {...props}
78
+ />
79
+ </DropdownMenuPrimitive.Portal>
80
+ ));
81
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
82
+
83
+ const DropdownMenuItem = forwardRef<
84
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
85
+ DropdownMenuItemProps
86
+ >(({ className, inset, variant, ...props }, ref) => (
87
+ <DropdownMenuPrimitive.Item
88
+ ref={ref}
89
+ className={cn(getMenubarItemClasses({ inset, variant }), className)}
90
+ {...props}
91
+ />
92
+ ));
93
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
94
+
95
+ const DropdownMenuCheckboxItem = forwardRef<
96
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
97
+ DropdownMenuCheckboxItemProps
98
+ >(({ className, children, variant, ...props }, ref) => (
99
+ <DropdownMenuPrimitive.CheckboxItem
100
+ ref={ref}
101
+ className={cn(getMenubarCheckboxItemClasses({ variant }), className)}
102
+ {...props}
103
+ >
104
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
105
+ <DropdownMenuPrimitive.ItemIndicator>
106
+ <CheckIcon className="h-4 w-4" />
107
+ </DropdownMenuPrimitive.ItemIndicator>
108
+ </span>
109
+ {children}
110
+ </DropdownMenuPrimitive.CheckboxItem>
111
+ ));
112
+ DropdownMenuCheckboxItem.displayName =
113
+ DropdownMenuPrimitive.CheckboxItem.displayName;
114
+
115
+ const DropdownMenuRadioItem = forwardRef<
116
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
117
+ DropdownMenuRadioItemProps
118
+ >(({ className, children, variant, ...props }, ref) => (
119
+ <DropdownMenuPrimitive.RadioItem
120
+ ref={ref}
121
+ className={cn(getMenubarRadioItemClasses({ variant }), className)}
122
+ {...props}
123
+ >
124
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
125
+ <DropdownMenuPrimitive.ItemIndicator>
126
+ <DotFilledIcon className="h-4 w-4 fill-current" />
127
+ </DropdownMenuPrimitive.ItemIndicator>
128
+ </span>
129
+ {children}
130
+ </DropdownMenuPrimitive.RadioItem>
131
+ ));
132
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
133
+
134
+ const DropdownMenuLabel = forwardRef<
135
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
136
+ DropdownMenuLabelProps
137
+ >(({ className, inset, ...props }, ref) => (
138
+ <DropdownMenuPrimitive.Label
139
+ ref={ref}
140
+ className={cn(getMenubarLabelClasses({ inset }), className)}
141
+ {...props}
142
+ />
143
+ ));
144
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
145
+
146
+ const DropdownMenuSeparator = forwardRef<
147
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
148
+ DropdownMenuSeparatorProps
149
+ >(({ className, ...props }, ref) => (
150
+ <DropdownMenuPrimitive.Separator
151
+ ref={ref}
152
+ className={cn(getMenubarSeparatorClasses(), className)}
153
+ {...props}
154
+ />
155
+ ));
156
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
157
+
158
+ const DropdownMenuShortcut = ({
159
+ className,
160
+ ...props
161
+ }: DropdownMenuShortcutProps) => {
162
+ return (
163
+ <span className={cn(getMenubarShortcutClasses(), className)} {...props} />
164
+ );
165
+ };
166
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
167
+
168
+ DropdownMenu.Trigger = DropdownMenuPrimitive.Trigger;
169
+ DropdownMenu.Content = DropdownMenuContent;
170
+ DropdownMenu.Item = DropdownMenuItem;
171
+ DropdownMenu.CheckboxItem = DropdownMenuCheckboxItem;
172
+ DropdownMenu.RadioItem = DropdownMenuRadioItem;
173
+ DropdownMenu.Label = DropdownMenuLabel;
174
+ DropdownMenu.Separator = DropdownMenuSeparator;
175
+ DropdownMenu.Shortcut = DropdownMenuShortcut;
176
+ DropdownMenu.Group = DropdownMenuPrimitive.Group;
177
+ DropdownMenu.Portal = DropdownMenuPrimitive.Portal;
178
+ DropdownMenu.Sub = DropdownMenuPrimitive.Sub;
179
+ DropdownMenu.SubContent = DropdownMenuSubContent;
180
+ DropdownMenu.SubTrigger = DropdownMenuSubTrigger;
181
+ DropdownMenu.RadioGroup = DropdownMenuPrimitive.RadioGroup;
182
+
183
+ export { DropdownMenu };
@@ -0,0 +1 @@
1
+ export { DropdownMenu } from "./DropdownMenu";
@@ -0,0 +1,60 @@
1
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
+ import { type VariantProps } from "../../../libs";
3
+ import {
4
+ getMenubarCheckboxItemClasses,
5
+ getMenubarContentClasses,
6
+ getMenubarItemClasses,
7
+ getMenubarLabelClasses,
8
+ getMenubarRadioItemClasses,
9
+ getMenubarSeparatorClasses,
10
+ getMenubarShortcutClasses,
11
+ getMenubarSubContentClasses,
12
+ getMenubarSubTriggerClasses,
13
+ } from "../Menubar/constants";
14
+
15
+ export type DropdownMenuProps = React.ComponentPropsWithoutRef<
16
+ typeof DropdownMenuPrimitive.Root
17
+ >;
18
+
19
+ export type DropdownMenuSubTriggerProps = React.ComponentPropsWithoutRef<
20
+ typeof DropdownMenuPrimitive.SubTrigger
21
+ > &
22
+ VariantProps<typeof getMenubarSubTriggerClasses>;
23
+
24
+ export type DropdownMenuContentProps = React.ComponentPropsWithoutRef<
25
+ typeof DropdownMenuPrimitive.Content
26
+ > &
27
+ VariantProps<typeof getMenubarContentClasses>;
28
+
29
+ export type DropdownMenuSubContentProps = React.ComponentPropsWithoutRef<
30
+ typeof DropdownMenuPrimitive.SubContent
31
+ > &
32
+ VariantProps<typeof getMenubarSubContentClasses>;
33
+
34
+ export type DropdownMenuItemProps = React.ComponentPropsWithoutRef<
35
+ typeof DropdownMenuPrimitive.Item
36
+ > &
37
+ VariantProps<typeof getMenubarItemClasses>;
38
+
39
+ export type DropdownMenuCheckboxItemProps = React.ComponentPropsWithoutRef<
40
+ typeof DropdownMenuPrimitive.CheckboxItem
41
+ > &
42
+ VariantProps<typeof getMenubarCheckboxItemClasses>;
43
+
44
+ export type DropdownMenuRadioItemProps = React.ComponentPropsWithoutRef<
45
+ typeof DropdownMenuPrimitive.RadioItem
46
+ > &
47
+ VariantProps<typeof getMenubarRadioItemClasses>;
48
+
49
+ export type DropdownMenuLabelProps = React.ComponentPropsWithoutRef<
50
+ typeof DropdownMenuPrimitive.Label
51
+ > &
52
+ VariantProps<typeof getMenubarLabelClasses>;
53
+
54
+ export type DropdownMenuSeparatorProps = React.ComponentPropsWithoutRef<
55
+ typeof DropdownMenuPrimitive.Separator
56
+ > &
57
+ VariantProps<typeof getMenubarSeparatorClasses>;
58
+
59
+ export type DropdownMenuShortcutProps = React.HTMLAttributes<HTMLSpanElement> &
60
+ VariantProps<typeof getMenubarShortcutClasses>;
@@ -0,0 +1,204 @@
1
+ "use client";
2
+
3
+ import { forwardRef } from "react";
4
+ import {
5
+ CheckIcon,
6
+ ChevronRightIcon,
7
+ DotFilledIcon,
8
+ } from "@radix-ui/react-icons";
9
+ import * as MenubarPrimitive from "@radix-ui/react-menubar";
10
+ import type {
11
+ MenubarCheckboxItemProps,
12
+ MenubarContentProps,
13
+ MenubarItemProps,
14
+ MenubarLabelProps,
15
+ MenubarProps,
16
+ MenubarRadioItemProps,
17
+ MenubarSeparatorProps,
18
+ MenubarShortcutProps,
19
+ MenubarSubContentProps,
20
+ MenubarSubTriggerProps,
21
+ MenubarTriggerProps,
22
+ } from "./types";
23
+ import { cn } from "../../../utilities";
24
+ import {
25
+ getMenubarCheckboxItemClasses,
26
+ getMenubarClasses,
27
+ getMenubarContentClasses,
28
+ getMenubarItemClasses,
29
+ getMenubarLabelClasses,
30
+ getMenubarRadioItemClasses,
31
+ getMenubarSeparatorClasses,
32
+ getMenubarShortcutClasses,
33
+ getMenubarSubContentClasses,
34
+ getMenubarSubTriggerClasses,
35
+ getMenubarTriggerClasses,
36
+ } from "./constants";
37
+
38
+ const Menubar = ({ className, ...props }: MenubarProps) => (
39
+ <MenubarPrimitive.Root
40
+ className={cn(getMenubarClasses(), className)}
41
+ {...props}
42
+ />
43
+ );
44
+ Menubar.displayName = MenubarPrimitive.Root.displayName;
45
+
46
+ const MenubarTrigger = forwardRef<
47
+ React.ElementRef<typeof MenubarPrimitive.Trigger>,
48
+ MenubarTriggerProps
49
+ >(({ className, variant, ...props }, ref) => (
50
+ <MenubarPrimitive.Trigger
51
+ ref={ref}
52
+ className={cn(getMenubarTriggerClasses({ variant }), className)}
53
+ {...props}
54
+ />
55
+ ));
56
+ MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
57
+
58
+ const MenubarSubTrigger = forwardRef<
59
+ React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
60
+ MenubarSubTriggerProps
61
+ >(({ className, inset, variant, children, ...props }, ref) => (
62
+ <MenubarPrimitive.SubTrigger
63
+ ref={ref}
64
+ className={cn(getMenubarSubTriggerClasses({ inset, variant }), className)}
65
+ {...props}
66
+ >
67
+ {children}
68
+ <ChevronRightIcon className="ml-auto h-4 w-4" />
69
+ </MenubarPrimitive.SubTrigger>
70
+ ));
71
+ MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
72
+
73
+ const MenubarSubContent = forwardRef<
74
+ React.ElementRef<typeof MenubarPrimitive.SubContent>,
75
+ MenubarSubContentProps
76
+ >(({ className, ...props }, ref) => (
77
+ <MenubarPrimitive.SubContent
78
+ ref={ref}
79
+ className={cn(getMenubarSubContentClasses(), className)}
80
+ {...props}
81
+ />
82
+ ));
83
+ MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
84
+
85
+ const MenubarContent = forwardRef<
86
+ React.ElementRef<typeof MenubarPrimitive.Content>,
87
+ MenubarContentProps
88
+ >(
89
+ (
90
+ { className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
91
+ ref
92
+ ) => (
93
+ <MenubarPrimitive.Portal>
94
+ <MenubarPrimitive.Content
95
+ ref={ref}
96
+ align={align}
97
+ alignOffset={alignOffset}
98
+ sideOffset={sideOffset}
99
+ className={cn(getMenubarContentClasses(), className)}
100
+ {...props}
101
+ />
102
+ </MenubarPrimitive.Portal>
103
+ )
104
+ );
105
+ MenubarContent.displayName = MenubarPrimitive.Content.displayName;
106
+
107
+ const MenubarItem = forwardRef<
108
+ React.ElementRef<typeof MenubarPrimitive.Item>,
109
+ MenubarItemProps
110
+ >(({ className, inset, variant, ...props }, ref) => (
111
+ <MenubarPrimitive.Item
112
+ ref={ref}
113
+ className={cn(getMenubarItemClasses({ inset, variant }), className)}
114
+ {...props}
115
+ />
116
+ ));
117
+ MenubarItem.displayName = MenubarPrimitive.Item.displayName;
118
+
119
+ const MenubarCheckboxItem = forwardRef<
120
+ React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
121
+ MenubarCheckboxItemProps
122
+ >(({ className, children, variant, ...props }, ref) => (
123
+ <MenubarPrimitive.CheckboxItem
124
+ ref={ref}
125
+ className={cn(getMenubarCheckboxItemClasses({ variant }), className)}
126
+ {...props}
127
+ >
128
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
129
+ <MenubarPrimitive.ItemIndicator>
130
+ <CheckIcon className="h-4 w-4" />
131
+ </MenubarPrimitive.ItemIndicator>
132
+ </span>
133
+ {children}
134
+ </MenubarPrimitive.CheckboxItem>
135
+ ));
136
+ MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
137
+
138
+ const MenubarRadioItem = forwardRef<
139
+ React.ElementRef<typeof MenubarPrimitive.RadioItem>,
140
+ MenubarRadioItemProps
141
+ >(({ className, children, variant, ...props }, ref) => (
142
+ <MenubarPrimitive.RadioItem
143
+ ref={ref}
144
+ className={cn(getMenubarRadioItemClasses({ variant }), className)}
145
+ {...props}
146
+ >
147
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
148
+ <MenubarPrimitive.ItemIndicator>
149
+ <DotFilledIcon className="h-4 w-4 fill-current" />
150
+ </MenubarPrimitive.ItemIndicator>
151
+ </span>
152
+ {children}
153
+ </MenubarPrimitive.RadioItem>
154
+ ));
155
+ MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
156
+
157
+ const MenubarLabel = forwardRef<
158
+ React.ElementRef<typeof MenubarPrimitive.Label>,
159
+ MenubarLabelProps
160
+ >(({ className, inset, ...props }, ref) => (
161
+ <MenubarPrimitive.Label
162
+ ref={ref}
163
+ className={cn(getMenubarLabelClasses({ inset }), className)}
164
+ {...props}
165
+ />
166
+ ));
167
+ MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
168
+
169
+ const MenubarSeparator = forwardRef<
170
+ React.ElementRef<typeof MenubarPrimitive.Separator>,
171
+ MenubarSeparatorProps
172
+ >(({ className, ...props }, ref) => (
173
+ <MenubarPrimitive.Separator
174
+ ref={ref}
175
+ className={cn(getMenubarSeparatorClasses(), className)}
176
+ {...props}
177
+ />
178
+ ));
179
+ MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName;
180
+
181
+ const MenubarShortcut = ({ className, ...props }: MenubarShortcutProps) => {
182
+ return (
183
+ <span className={cn(getMenubarShortcutClasses(), className)} {...props} />
184
+ );
185
+ };
186
+ MenubarShortcut.displayname = "MenubarShortcut";
187
+
188
+ Menubar.Menu = MenubarPrimitive.Menu;
189
+ Menubar.Group = MenubarPrimitive.Group;
190
+ Menubar.Portal = MenubarPrimitive.Portal;
191
+ Menubar.Sub = MenubarPrimitive.Sub;
192
+ Menubar.RadioGroup = MenubarPrimitive.RadioGroup;
193
+ Menubar.Trigger = MenubarTrigger;
194
+ Menubar.Content = MenubarContent;
195
+ Menubar.Item = MenubarItem;
196
+ Menubar.Separator = MenubarSeparator;
197
+ Menubar.Label = MenubarLabel;
198
+ Menubar.CheckboxItem = MenubarCheckboxItem;
199
+ Menubar.RadioItem = MenubarRadioItem;
200
+ Menubar.SubContent = MenubarSubContent;
201
+ Menubar.SubTrigger = MenubarSubTrigger;
202
+ Menubar.Shortcut = MenubarShortcut;
203
+
204
+ export { Menubar };
@@ -0,0 +1,107 @@
1
+ import { cva } from "../../../libs";
2
+
3
+ const itemVariant = {
4
+ primary: "focus:bg-primary focus:text-primary-content",
5
+ secondary: "focus:bg-secondary focus:text-secondary-content",
6
+ accent: "focus:bg-accent focus:text-accent-content",
7
+ neutral: "focus:bg-neutral focus:text-neutral-content",
8
+ base: "focus:bg-base-300 focus:text-base-content",
9
+ info: "focus:bg-info focus:text-info-content",
10
+ success: "focus:bg-success focus:text-success-content",
11
+ warning: "focus:bg-warning focus:text-warning-content",
12
+ error: "focus:bg-error focus:text-error-content",
13
+ };
14
+
15
+ const triggerVariant = {
16
+ primary:
17
+ "focus:bg-primary focus:text-primary-content data-[state=open]:bg-primary data-[state=open]:text-primary-content",
18
+ secondary:
19
+ "focus:bg-secondary focus:text-secondary-content data-[state=open]:bg-secondary data-[state=open]:text-secondary-content",
20
+ accent:
21
+ "focus:bg-accent focus:text-accent-content data-[state=open]:bg-accent data-[state=open]:text-accent-content",
22
+ neutral:
23
+ "focus:bg-neutral focus:text-neutral-content data-[state=open]:bg-neutral data-[state=open]:text-neutral-content",
24
+ base: "focus:bg-base-300 focus:text-base-content data-[state=open]:bg-base-300 data-[state=open]:text-base-content",
25
+ info: "focus:bg-info focus:text-info-content data-[state=open]:bg-info data-[state=open]:text-info-content",
26
+ success:
27
+ "focus:bg-success focus:text-success-content data-[state=open]:bg-success data-[state=open]:text-success-content",
28
+ warning:
29
+ "focus:bg-warning focus:text-warning-content data-[state=open]:bg-warning data-[state=open]:text-warning-content",
30
+ error:
31
+ "focus:bg-error focus:text-error-content data-[state=open]:bg-error data-[state=open]:text-error-content",
32
+ };
33
+
34
+ export const getMenubarClasses = cva(
35
+ "flex h-9 items-center space-x-1 rounded-md border bg-base-100 p-1 shadow-sm"
36
+ );
37
+
38
+ export const getMenubarTriggerClasses = cva(
39
+ "flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none",
40
+ {
41
+ variants: {
42
+ variant: triggerVariant,
43
+ },
44
+ }
45
+ );
46
+
47
+ export const getMenubarSubTriggerClasses = cva(
48
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
49
+ {
50
+ variants: {
51
+ variant: triggerVariant,
52
+ inset: {
53
+ true: "pl-8",
54
+ },
55
+ },
56
+ }
57
+ );
58
+
59
+ export const getMenubarContentClasses = cva(
60
+ "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-base-100 p-1 text-base-content 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"
61
+ );
62
+
63
+ export const getMenubarSubContentClasses = cva(
64
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-base-100 p-1 text-base-content 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"
65
+ );
66
+
67
+ export const getMenubarItemClasses = cva(
68
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
69
+ {
70
+ variants: {
71
+ variant: itemVariant,
72
+ inset: {
73
+ true: "pl-8",
74
+ },
75
+ },
76
+ }
77
+ );
78
+
79
+ export const getMenubarCheckboxItemClasses = cva(
80
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
81
+ {
82
+ variants: {
83
+ variant: itemVariant,
84
+ },
85
+ }
86
+ );
87
+
88
+ export const getMenubarRadioItemClasses = cva(
89
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
90
+ {
91
+ variants: {
92
+ variant: itemVariant,
93
+ },
94
+ }
95
+ );
96
+
97
+ export const getMenubarLabelClasses = cva("px-2 py-1.5 text-sm font-semibold", {
98
+ variants: {
99
+ inset: {
100
+ true: "pl-8",
101
+ },
102
+ },
103
+ });
104
+
105
+ export const getMenubarSeparatorClasses = cva("-mx-1 my-1 h-px bg-base-200");
106
+
107
+ export const getMenubarShortcutClasses = cva("ml-auto text-xs tracking-widest");
@@ -0,0 +1 @@
1
+ export { Menubar } from "./Menubar";
@@ -0,0 +1,66 @@
1
+ import * as MenubarPrimitive from "@radix-ui/react-menubar";
2
+ import { type VariantProps } from "../../../libs";
3
+ import {
4
+ getMenubarCheckboxItemClasses,
5
+ getMenubarContentClasses,
6
+ getMenubarItemClasses,
7
+ getMenubarLabelClasses,
8
+ getMenubarRadioItemClasses,
9
+ getMenubarSeparatorClasses,
10
+ getMenubarShortcutClasses,
11
+ getMenubarSubContentClasses,
12
+ getMenubarSubTriggerClasses,
13
+ getMenubarTriggerClasses,
14
+ } from "./constants";
15
+
16
+ export type MenubarProps = React.ComponentPropsWithoutRef<
17
+ typeof MenubarPrimitive.Root
18
+ >;
19
+
20
+ export type MenubarTriggerProps = React.ComponentPropsWithoutRef<
21
+ typeof MenubarPrimitive.Trigger
22
+ > &
23
+ VariantProps<typeof getMenubarTriggerClasses>;
24
+
25
+ export type MenubarSubTriggerProps = React.ComponentPropsWithoutRef<
26
+ typeof MenubarPrimitive.SubTrigger
27
+ > &
28
+ VariantProps<typeof getMenubarSubTriggerClasses>;
29
+
30
+ export type MenubarContentProps = React.ComponentPropsWithoutRef<
31
+ typeof MenubarPrimitive.Content
32
+ > &
33
+ VariantProps<typeof getMenubarContentClasses>;
34
+
35
+ export type MenubarSubContentProps = React.ComponentPropsWithoutRef<
36
+ typeof MenubarPrimitive.SubContent
37
+ > &
38
+ VariantProps<typeof getMenubarSubContentClasses>;
39
+
40
+ export type MenubarItemProps = React.ComponentPropsWithoutRef<
41
+ typeof MenubarPrimitive.Item
42
+ > &
43
+ VariantProps<typeof getMenubarItemClasses>;
44
+
45
+ export type MenubarCheckboxItemProps = React.ComponentPropsWithoutRef<
46
+ typeof MenubarPrimitive.CheckboxItem
47
+ > &
48
+ VariantProps<typeof getMenubarCheckboxItemClasses>;
49
+
50
+ export type MenubarRadioItemProps = React.ComponentPropsWithoutRef<
51
+ typeof MenubarPrimitive.RadioItem
52
+ > &
53
+ VariantProps<typeof getMenubarRadioItemClasses>;
54
+
55
+ export type MenubarLabelProps = React.ComponentPropsWithoutRef<
56
+ typeof MenubarPrimitive.Label
57
+ > &
58
+ VariantProps<typeof getMenubarLabelClasses>;
59
+
60
+ export type MenubarSeparatorProps = React.ComponentPropsWithoutRef<
61
+ typeof MenubarPrimitive.Separator
62
+ > &
63
+ VariantProps<typeof getMenubarSeparatorClasses>;
64
+
65
+ export type MenubarShortcutProps = React.HTMLAttributes<HTMLSpanElement> &
66
+ VariantProps<typeof getMenubarShortcutClasses>;