@gv-tech/ui-web 2.6.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.
- package/package.json +88 -0
- package/src/accordion.tsx +58 -0
- package/src/alert-dialog.tsx +121 -0
- package/src/alert.tsx +49 -0
- package/src/aspect-ratio.tsx +7 -0
- package/src/avatar.tsx +40 -0
- package/src/badge.tsx +34 -0
- package/src/breadcrumb.tsx +105 -0
- package/src/button.tsx +47 -0
- package/src/calendar.tsx +163 -0
- package/src/card.tsx +46 -0
- package/src/carousel.tsx +234 -0
- package/src/chart.tsx +296 -0
- package/src/checkbox.tsx +31 -0
- package/src/collapsible.tsx +15 -0
- package/src/command.tsx +154 -0
- package/src/context-menu.tsx +208 -0
- package/src/dialog.tsx +95 -0
- package/src/drawer.tsx +110 -0
- package/src/dropdown-menu.tsx +212 -0
- package/src/form.tsx +160 -0
- package/src/hooks/use-theme.ts +15 -0
- package/src/hooks/use-toast.ts +189 -0
- package/src/hover-card.tsx +35 -0
- package/src/index.ts +474 -0
- package/src/input.tsx +23 -0
- package/src/label.tsx +21 -0
- package/src/lib/utils.ts +6 -0
- package/src/menubar.tsx +244 -0
- package/src/navigation-menu.tsx +143 -0
- package/src/pagination.tsx +107 -0
- package/src/popover.tsx +45 -0
- package/src/progress.tsx +28 -0
- package/src/radio-group.tsx +41 -0
- package/src/resizable.tsx +59 -0
- package/src/scroll-area.tsx +42 -0
- package/src/search.tsx +87 -0
- package/src/select.tsx +169 -0
- package/src/separator.tsx +24 -0
- package/src/setupTests.ts +114 -0
- package/src/sheet.tsx +136 -0
- package/src/skeleton.tsx +10 -0
- package/src/slider.tsx +27 -0
- package/src/sonner.tsx +32 -0
- package/src/switch.tsx +31 -0
- package/src/table.tsx +104 -0
- package/src/tabs.tsx +62 -0
- package/src/text.tsx +55 -0
- package/src/textarea.tsx +25 -0
- package/src/theme-provider.tsx +15 -0
- package/src/theme-toggle.tsx +92 -0
- package/src/toast.tsx +111 -0
- package/src/toaster.tsx +27 -0
- package/src/toggle-group.tsx +55 -0
- package/src/toggle.tsx +24 -0
- package/src/tooltip.tsx +51 -0
package/src/menubar.tsx
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as MenubarPrimitive from '@radix-ui/react-menubar';
|
|
4
|
+
import { Check, ChevronRight, Circle } from 'lucide-react';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
MenubarBaseProps,
|
|
9
|
+
MenubarCheckboxItemBaseProps,
|
|
10
|
+
MenubarContentBaseProps,
|
|
11
|
+
MenubarItemBaseProps,
|
|
12
|
+
MenubarLabelBaseProps,
|
|
13
|
+
MenubarMenuBaseProps,
|
|
14
|
+
MenubarRadioItemBaseProps,
|
|
15
|
+
MenubarSeparatorBaseProps,
|
|
16
|
+
MenubarShortcutBaseProps,
|
|
17
|
+
MenubarSubBaseProps,
|
|
18
|
+
MenubarSubContentBaseProps,
|
|
19
|
+
MenubarSubTriggerBaseProps,
|
|
20
|
+
MenubarTriggerBaseProps,
|
|
21
|
+
} from '@gv-tech/ui-core';
|
|
22
|
+
import { cn } from './lib/utils';
|
|
23
|
+
|
|
24
|
+
function MenubarMenu({ ...props }: MenubarPrimitive.MenubarMenuProps & MenubarMenuBaseProps) {
|
|
25
|
+
return <MenubarPrimitive.Menu {...props} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function MenubarGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Group>) {
|
|
29
|
+
return <MenubarPrimitive.Group {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function MenubarPortal({ ...props }: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
|
|
33
|
+
return <MenubarPrimitive.Portal {...props} />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function MenubarRadioGroup({ ...props }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
|
|
37
|
+
return <MenubarPrimitive.RadioGroup {...props} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function MenubarSub({ ...props }: MenubarPrimitive.MenubarSubProps & MenubarSubBaseProps) {
|
|
41
|
+
return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const Menubar = React.forwardRef<
|
|
45
|
+
React.ElementRef<typeof MenubarPrimitive.Root>,
|
|
46
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root> & MenubarBaseProps
|
|
47
|
+
>(({ className, ...props }, ref) => (
|
|
48
|
+
<MenubarPrimitive.Root
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn('flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm', className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
));
|
|
54
|
+
Menubar.displayName = MenubarPrimitive.Root.displayName;
|
|
55
|
+
|
|
56
|
+
const MenubarTrigger = React.forwardRef<
|
|
57
|
+
React.ElementRef<typeof MenubarPrimitive.Trigger>,
|
|
58
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger> & MenubarTriggerBaseProps
|
|
59
|
+
>(({ className, ...props }, ref) => (
|
|
60
|
+
<MenubarPrimitive.Trigger
|
|
61
|
+
ref={ref}
|
|
62
|
+
className={cn(
|
|
63
|
+
'flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
));
|
|
69
|
+
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
|
|
70
|
+
|
|
71
|
+
const MenubarSubTrigger = React.forwardRef<
|
|
72
|
+
React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
|
|
73
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & MenubarSubTriggerBaseProps
|
|
74
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
75
|
+
<MenubarPrimitive.SubTrigger
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(
|
|
78
|
+
'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',
|
|
79
|
+
inset && 'pl-8',
|
|
80
|
+
className,
|
|
81
|
+
)}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
86
|
+
</MenubarPrimitive.SubTrigger>
|
|
87
|
+
));
|
|
88
|
+
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
|
|
89
|
+
|
|
90
|
+
const MenubarSubContent = React.forwardRef<
|
|
91
|
+
React.ElementRef<typeof MenubarPrimitive.SubContent>,
|
|
92
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent> & MenubarSubContentBaseProps
|
|
93
|
+
>(({ className, ...props }, ref) => (
|
|
94
|
+
<MenubarPrimitive.SubContent
|
|
95
|
+
ref={ref}
|
|
96
|
+
className={cn(
|
|
97
|
+
'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-menubar-content-transform-origin]',
|
|
98
|
+
className,
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
));
|
|
103
|
+
MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
|
|
104
|
+
|
|
105
|
+
const MenubarContent = React.forwardRef<
|
|
106
|
+
React.ElementRef<typeof MenubarPrimitive.Content>,
|
|
107
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content> & MenubarContentBaseProps
|
|
108
|
+
>(({ className, align = 'start', alignOffset = -4, sideOffset = 8, ...props }, ref) => (
|
|
109
|
+
<MenubarPrimitive.Portal>
|
|
110
|
+
<MenubarPrimitive.Content
|
|
111
|
+
ref={ref}
|
|
112
|
+
align={align}
|
|
113
|
+
alignOffset={alignOffset}
|
|
114
|
+
sideOffset={sideOffset}
|
|
115
|
+
className={cn(
|
|
116
|
+
'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]',
|
|
117
|
+
className,
|
|
118
|
+
)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
</MenubarPrimitive.Portal>
|
|
122
|
+
));
|
|
123
|
+
MenubarContent.displayName = MenubarPrimitive.Content.displayName;
|
|
124
|
+
|
|
125
|
+
const MenubarItem = React.forwardRef<
|
|
126
|
+
React.ElementRef<typeof MenubarPrimitive.Item>,
|
|
127
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & MenubarItemBaseProps
|
|
128
|
+
>(({ className, inset, ...props }, ref) => (
|
|
129
|
+
<MenubarPrimitive.Item
|
|
130
|
+
ref={ref}
|
|
131
|
+
className={cn(
|
|
132
|
+
'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',
|
|
133
|
+
inset && 'pl-8',
|
|
134
|
+
className,
|
|
135
|
+
)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
));
|
|
139
|
+
MenubarItem.displayName = MenubarPrimitive.Item.displayName;
|
|
140
|
+
|
|
141
|
+
const MenubarCheckboxItem = React.forwardRef<
|
|
142
|
+
React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
|
|
143
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem> & MenubarCheckboxItemBaseProps
|
|
144
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
145
|
+
<MenubarPrimitive.CheckboxItem
|
|
146
|
+
ref={ref}
|
|
147
|
+
className={cn(
|
|
148
|
+
'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',
|
|
149
|
+
className,
|
|
150
|
+
)}
|
|
151
|
+
checked={checked}
|
|
152
|
+
{...props}
|
|
153
|
+
>
|
|
154
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
155
|
+
<MenubarPrimitive.ItemIndicator>
|
|
156
|
+
<Check className="h-4 w-4" />
|
|
157
|
+
</MenubarPrimitive.ItemIndicator>
|
|
158
|
+
</span>
|
|
159
|
+
{children}
|
|
160
|
+
</MenubarPrimitive.CheckboxItem>
|
|
161
|
+
));
|
|
162
|
+
MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
|
|
163
|
+
|
|
164
|
+
const MenubarRadioItem = React.forwardRef<
|
|
165
|
+
React.ElementRef<typeof MenubarPrimitive.RadioItem>,
|
|
166
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem> & MenubarRadioItemBaseProps
|
|
167
|
+
>(({ className, children, ...props }, ref) => (
|
|
168
|
+
<MenubarPrimitive.RadioItem
|
|
169
|
+
ref={ref}
|
|
170
|
+
className={cn(
|
|
171
|
+
'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',
|
|
172
|
+
className,
|
|
173
|
+
)}
|
|
174
|
+
{...props}
|
|
175
|
+
>
|
|
176
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
177
|
+
<MenubarPrimitive.ItemIndicator>
|
|
178
|
+
<Circle className="h-4 w-4 fill-current" />
|
|
179
|
+
</MenubarPrimitive.ItemIndicator>
|
|
180
|
+
</span>
|
|
181
|
+
{children}
|
|
182
|
+
</MenubarPrimitive.RadioItem>
|
|
183
|
+
));
|
|
184
|
+
MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
|
|
185
|
+
|
|
186
|
+
const MenubarLabel = React.forwardRef<
|
|
187
|
+
React.ElementRef<typeof MenubarPrimitive.Label>,
|
|
188
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & MenubarLabelBaseProps
|
|
189
|
+
>(({ className, inset, ...props }, ref) => (
|
|
190
|
+
<MenubarPrimitive.Label
|
|
191
|
+
ref={ref}
|
|
192
|
+
className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
|
|
193
|
+
{...props}
|
|
194
|
+
/>
|
|
195
|
+
));
|
|
196
|
+
MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
|
|
197
|
+
|
|
198
|
+
const MenubarSeparator = React.forwardRef<
|
|
199
|
+
React.ElementRef<typeof MenubarPrimitive.Separator>,
|
|
200
|
+
React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator> & MenubarSeparatorBaseProps
|
|
201
|
+
>(({ className, ...props }, ref) => (
|
|
202
|
+
<MenubarPrimitive.Separator ref={ref} className={cn('-mx-1 my-1 h-px bg-muted', className)} {...props} />
|
|
203
|
+
));
|
|
204
|
+
MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName;
|
|
205
|
+
|
|
206
|
+
const MenubarShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement> & MenubarShortcutBaseProps) => {
|
|
207
|
+
return <span className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)} {...props} />;
|
|
208
|
+
};
|
|
209
|
+
MenubarShortcut.displayname = 'MenubarShortcut';
|
|
210
|
+
|
|
211
|
+
export {
|
|
212
|
+
Menubar,
|
|
213
|
+
MenubarCheckboxItem,
|
|
214
|
+
MenubarContent,
|
|
215
|
+
MenubarGroup,
|
|
216
|
+
MenubarItem,
|
|
217
|
+
MenubarLabel,
|
|
218
|
+
MenubarMenu,
|
|
219
|
+
MenubarPortal,
|
|
220
|
+
MenubarRadioGroup,
|
|
221
|
+
MenubarRadioItem,
|
|
222
|
+
MenubarSeparator,
|
|
223
|
+
MenubarShortcut,
|
|
224
|
+
MenubarSub,
|
|
225
|
+
MenubarSubContent,
|
|
226
|
+
MenubarSubTrigger,
|
|
227
|
+
MenubarTrigger,
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export type {
|
|
231
|
+
MenubarCheckboxItemBaseProps as MenubarCheckboxItemProps,
|
|
232
|
+
MenubarContentBaseProps as MenubarContentProps,
|
|
233
|
+
MenubarItemBaseProps as MenubarItemProps,
|
|
234
|
+
MenubarLabelBaseProps as MenubarLabelProps,
|
|
235
|
+
MenubarMenuBaseProps as MenubarMenuProps,
|
|
236
|
+
MenubarBaseProps as MenubarProps,
|
|
237
|
+
MenubarRadioItemBaseProps as MenubarRadioItemProps,
|
|
238
|
+
MenubarSeparatorBaseProps as MenubarSeparatorProps,
|
|
239
|
+
MenubarShortcutBaseProps as MenubarShortcutProps,
|
|
240
|
+
MenubarSubContentBaseProps as MenubarSubContentProps,
|
|
241
|
+
MenubarSubBaseProps as MenubarSubProps,
|
|
242
|
+
MenubarSubTriggerBaseProps as MenubarSubTriggerProps,
|
|
243
|
+
MenubarTriggerBaseProps as MenubarTriggerProps,
|
|
244
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { ChevronDown } from 'lucide-react';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
NavigationMenuBaseProps,
|
|
10
|
+
NavigationMenuContentBaseProps,
|
|
11
|
+
NavigationMenuIndicatorBaseProps,
|
|
12
|
+
NavigationMenuItemBaseProps,
|
|
13
|
+
NavigationMenuLinkBaseProps,
|
|
14
|
+
NavigationMenuListBaseProps,
|
|
15
|
+
NavigationMenuTriggerBaseProps,
|
|
16
|
+
NavigationMenuViewportBaseProps,
|
|
17
|
+
} from '@gv-tech/ui-core';
|
|
18
|
+
import { cn } from './lib/utils';
|
|
19
|
+
|
|
20
|
+
const NavigationMenu = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
|
|
22
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root> & NavigationMenuBaseProps
|
|
23
|
+
>(({ className, children, ...props }, ref) => (
|
|
24
|
+
<NavigationMenuPrimitive.Root
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn('relative z-10 flex max-w-max flex-1 items-center justify-center', className)}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
<NavigationMenuViewport />
|
|
31
|
+
</NavigationMenuPrimitive.Root>
|
|
32
|
+
));
|
|
33
|
+
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;
|
|
34
|
+
|
|
35
|
+
const NavigationMenuList = React.forwardRef<
|
|
36
|
+
React.ElementRef<typeof NavigationMenuPrimitive.List>,
|
|
37
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List> & NavigationMenuListBaseProps
|
|
38
|
+
>(({ className, ...props }, ref) => (
|
|
39
|
+
<NavigationMenuPrimitive.List
|
|
40
|
+
ref={ref}
|
|
41
|
+
className={cn('group flex flex-1 list-none items-center justify-center space-x-1', className)}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
));
|
|
45
|
+
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
|
|
46
|
+
|
|
47
|
+
const NavigationMenuItem = NavigationMenuPrimitive.Item;
|
|
48
|
+
|
|
49
|
+
const navigationMenuTriggerStyle = cva(
|
|
50
|
+
'group inline-flex h-9 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-[state=open]:text-accent-foreground data-[state=open]:bg-accent/50 data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent',
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const NavigationMenuTrigger = React.forwardRef<
|
|
54
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
|
|
55
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger> & NavigationMenuTriggerBaseProps
|
|
56
|
+
>(({ className, children, ...props }, ref) => (
|
|
57
|
+
<NavigationMenuPrimitive.Trigger
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={cn(navigationMenuTriggerStyle(), 'group', className)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
{children}{' '}
|
|
63
|
+
<ChevronDown
|
|
64
|
+
className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
65
|
+
aria-hidden="true"
|
|
66
|
+
/>
|
|
67
|
+
</NavigationMenuPrimitive.Trigger>
|
|
68
|
+
));
|
|
69
|
+
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;
|
|
70
|
+
|
|
71
|
+
const NavigationMenuContent = React.forwardRef<
|
|
72
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Content>,
|
|
73
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content> & NavigationMenuContentBaseProps
|
|
74
|
+
>(({ className, ...props }, ref) => (
|
|
75
|
+
<NavigationMenuPrimitive.Content
|
|
76
|
+
ref={ref}
|
|
77
|
+
className={cn(
|
|
78
|
+
'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 ',
|
|
79
|
+
className,
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
));
|
|
84
|
+
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;
|
|
85
|
+
|
|
86
|
+
const NavigationMenuLink = NavigationMenuPrimitive.Link;
|
|
87
|
+
|
|
88
|
+
const NavigationMenuViewport = React.forwardRef<
|
|
89
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport> & NavigationMenuViewportBaseProps
|
|
91
|
+
>(({ className, ...props }, ref) => (
|
|
92
|
+
<div className={cn('absolute left-0 top-full flex justify-center')}>
|
|
93
|
+
<NavigationMenuPrimitive.Viewport
|
|
94
|
+
className={cn(
|
|
95
|
+
'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 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)]',
|
|
96
|
+
className,
|
|
97
|
+
)}
|
|
98
|
+
ref={ref}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
));
|
|
103
|
+
NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName;
|
|
104
|
+
|
|
105
|
+
const NavigationMenuIndicator = React.forwardRef<
|
|
106
|
+
React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
|
|
107
|
+
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator> & NavigationMenuIndicatorBaseProps
|
|
108
|
+
>(({ className, ...props }, ref) => (
|
|
109
|
+
<NavigationMenuPrimitive.Indicator
|
|
110
|
+
ref={ref}
|
|
111
|
+
className={cn(
|
|
112
|
+
'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',
|
|
113
|
+
className,
|
|
114
|
+
)}
|
|
115
|
+
{...props}
|
|
116
|
+
>
|
|
117
|
+
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
|
|
118
|
+
</NavigationMenuPrimitive.Indicator>
|
|
119
|
+
));
|
|
120
|
+
NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
NavigationMenu,
|
|
124
|
+
NavigationMenuContent,
|
|
125
|
+
NavigationMenuIndicator,
|
|
126
|
+
NavigationMenuItem,
|
|
127
|
+
NavigationMenuLink,
|
|
128
|
+
NavigationMenuList,
|
|
129
|
+
NavigationMenuTrigger,
|
|
130
|
+
navigationMenuTriggerStyle,
|
|
131
|
+
NavigationMenuViewport,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export type {
|
|
135
|
+
NavigationMenuContentBaseProps as NavigationMenuContentProps,
|
|
136
|
+
NavigationMenuIndicatorBaseProps as NavigationMenuIndicatorProps,
|
|
137
|
+
NavigationMenuItemBaseProps as NavigationMenuItemProps,
|
|
138
|
+
NavigationMenuLinkBaseProps as NavigationMenuLinkProps,
|
|
139
|
+
NavigationMenuListBaseProps as NavigationMenuListProps,
|
|
140
|
+
NavigationMenuBaseProps as NavigationMenuProps,
|
|
141
|
+
NavigationMenuTriggerBaseProps as NavigationMenuTriggerProps,
|
|
142
|
+
NavigationMenuViewportBaseProps as NavigationMenuViewportProps,
|
|
143
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
PaginationBaseProps,
|
|
6
|
+
PaginationContentBaseProps,
|
|
7
|
+
PaginationEllipsisBaseProps,
|
|
8
|
+
PaginationItemBaseProps,
|
|
9
|
+
PaginationLinkBaseProps,
|
|
10
|
+
PaginationNextBaseProps,
|
|
11
|
+
PaginationPreviousBaseProps,
|
|
12
|
+
} from '@gv-tech/ui-core';
|
|
13
|
+
import { ButtonProps, buttonVariants } from './button';
|
|
14
|
+
import { cn } from './lib/utils';
|
|
15
|
+
|
|
16
|
+
const Pagination = ({ className, ...props }: React.ComponentProps<'nav'> & PaginationBaseProps) => (
|
|
17
|
+
<nav
|
|
18
|
+
role="navigation"
|
|
19
|
+
aria-label="pagination"
|
|
20
|
+
className={cn('mx-auto flex w-full justify-center', className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
Pagination.displayName = 'Pagination';
|
|
25
|
+
|
|
26
|
+
const PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'> & PaginationContentBaseProps>(
|
|
27
|
+
({ className, ...props }, ref) => (
|
|
28
|
+
<ul ref={ref} className={cn('flex flex-row items-center gap-1', className)} {...props} />
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
PaginationContent.displayName = 'PaginationContent';
|
|
32
|
+
|
|
33
|
+
const PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li'> & PaginationItemBaseProps>(
|
|
34
|
+
({ className, ...props }, ref) => <li ref={ref} className={cn('', className)} {...props} />,
|
|
35
|
+
);
|
|
36
|
+
PaginationItem.displayName = 'PaginationItem';
|
|
37
|
+
|
|
38
|
+
type PaginationLinkProps = {
|
|
39
|
+
isActive?: boolean;
|
|
40
|
+
} & Pick<ButtonProps, 'size'> &
|
|
41
|
+
React.ComponentProps<'a'> &
|
|
42
|
+
PaginationLinkBaseProps;
|
|
43
|
+
|
|
44
|
+
const PaginationLink = ({ className, isActive, size = 'icon', ...props }: PaginationLinkProps) => (
|
|
45
|
+
<a
|
|
46
|
+
aria-current={isActive ? 'page' : undefined}
|
|
47
|
+
className={cn(
|
|
48
|
+
buttonVariants({
|
|
49
|
+
variant: isActive ? 'outline' : 'ghost',
|
|
50
|
+
size,
|
|
51
|
+
}),
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
PaginationLink.displayName = 'PaginationLink';
|
|
58
|
+
|
|
59
|
+
const PaginationPrevious = ({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}: React.ComponentProps<typeof PaginationLink> & PaginationPreviousBaseProps) => (
|
|
63
|
+
<PaginationLink aria-label="Go to previous page" size="default" className={cn('gap-1 pl-2.5', className)} {...props}>
|
|
64
|
+
<ChevronLeft className="h-4 w-4" />
|
|
65
|
+
<span>Previous</span>
|
|
66
|
+
</PaginationLink>
|
|
67
|
+
);
|
|
68
|
+
PaginationPrevious.displayName = 'PaginationPrevious';
|
|
69
|
+
|
|
70
|
+
const PaginationNext = ({
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}: React.ComponentProps<typeof PaginationLink> & PaginationNextBaseProps) => (
|
|
74
|
+
<PaginationLink aria-label="Go to next page" size="default" className={cn('gap-1 pr-2.5', className)} {...props}>
|
|
75
|
+
<span>Next</span>
|
|
76
|
+
<ChevronRight className="h-4 w-4" />
|
|
77
|
+
</PaginationLink>
|
|
78
|
+
);
|
|
79
|
+
PaginationNext.displayName = 'PaginationNext';
|
|
80
|
+
|
|
81
|
+
const PaginationEllipsis = ({ className, ...props }: React.ComponentProps<'span'> & PaginationEllipsisBaseProps) => (
|
|
82
|
+
<span aria-hidden className={cn('flex h-9 w-9 items-center justify-center', className)} {...props}>
|
|
83
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
84
|
+
<span className="sr-only">More pages</span>
|
|
85
|
+
</span>
|
|
86
|
+
);
|
|
87
|
+
PaginationEllipsis.displayName = 'PaginationEllipsis';
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
Pagination,
|
|
91
|
+
PaginationContent,
|
|
92
|
+
PaginationEllipsis,
|
|
93
|
+
PaginationItem,
|
|
94
|
+
PaginationLink,
|
|
95
|
+
PaginationNext,
|
|
96
|
+
PaginationPrevious,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type {
|
|
100
|
+
PaginationContentBaseProps as PaginationContentProps,
|
|
101
|
+
PaginationEllipsisBaseProps as PaginationEllipsisProps,
|
|
102
|
+
PaginationItemBaseProps as PaginationItemProps,
|
|
103
|
+
PaginationLinkProps,
|
|
104
|
+
PaginationNextBaseProps as PaginationNextProps,
|
|
105
|
+
PaginationPreviousBaseProps as PaginationPreviousProps,
|
|
106
|
+
PaginationBaseProps as PaginationProps,
|
|
107
|
+
};
|
package/src/popover.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
PopoverAnchorBaseProps,
|
|
8
|
+
PopoverBaseProps,
|
|
9
|
+
PopoverContentBaseProps,
|
|
10
|
+
PopoverTriggerBaseProps,
|
|
11
|
+
} from '@gv-tech/ui-core';
|
|
12
|
+
import { cn } from './lib/utils';
|
|
13
|
+
|
|
14
|
+
const Popover = PopoverPrimitive.Root;
|
|
15
|
+
|
|
16
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
17
|
+
|
|
18
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
19
|
+
|
|
20
|
+
const PopoverContent = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
22
|
+
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & PopoverContentBaseProps
|
|
23
|
+
>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
|
|
24
|
+
<PopoverPrimitive.Portal>
|
|
25
|
+
<PopoverPrimitive.Content
|
|
26
|
+
ref={ref}
|
|
27
|
+
align={align}
|
|
28
|
+
sideOffset={sideOffset}
|
|
29
|
+
className={cn(
|
|
30
|
+
'z-50 w-72 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-popover-content-transform-origin]',
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
</PopoverPrimitive.Portal>
|
|
36
|
+
));
|
|
37
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
38
|
+
|
|
39
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
40
|
+
export type {
|
|
41
|
+
PopoverAnchorBaseProps as PopoverAnchorProps,
|
|
42
|
+
PopoverContentBaseProps as PopoverContentProps,
|
|
43
|
+
PopoverBaseProps as PopoverProps,
|
|
44
|
+
PopoverTriggerBaseProps as PopoverTriggerProps,
|
|
45
|
+
};
|
package/src/progress.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
import { ProgressBaseProps } from '@gv-tech/ui-core';
|
|
7
|
+
import { cn } from './lib/utils';
|
|
8
|
+
|
|
9
|
+
const Progress = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & ProgressBaseProps
|
|
12
|
+
>(({ className, value, ...props }, ref) => (
|
|
13
|
+
<ProgressPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn('relative h-2 w-full overflow-hidden rounded-full bg-primary/20', className)}
|
|
16
|
+
value={value}
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
<ProgressPrimitive.Indicator
|
|
20
|
+
className="h-full w-full flex-1 bg-primary transition-all"
|
|
21
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
22
|
+
/>
|
|
23
|
+
</ProgressPrimitive.Root>
|
|
24
|
+
));
|
|
25
|
+
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
26
|
+
|
|
27
|
+
export { Progress };
|
|
28
|
+
export type { ProgressBaseProps as ProgressProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
2
|
+
import { Circle } from 'lucide-react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import type { RadioGroupBaseProps, RadioGroupItemBaseProps } from '@gv-tech/ui-core';
|
|
6
|
+
import { cn } from './lib/utils';
|
|
7
|
+
|
|
8
|
+
export interface RadioGroupProps
|
|
9
|
+
extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, RadioGroupBaseProps {}
|
|
10
|
+
|
|
11
|
+
const RadioGroup = React.forwardRef<React.ElementRef<typeof RadioGroupPrimitive.Root>, RadioGroupProps>(
|
|
12
|
+
({ className, ...props }, ref) => {
|
|
13
|
+
return <RadioGroupPrimitive.Root className={cn('grid gap-2', className)} {...props} ref={ref} />;
|
|
14
|
+
},
|
|
15
|
+
);
|
|
16
|
+
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
17
|
+
|
|
18
|
+
export interface RadioGroupItemProps
|
|
19
|
+
extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, RadioGroupItemBaseProps {}
|
|
20
|
+
|
|
21
|
+
const RadioGroupItem = React.forwardRef<React.ElementRef<typeof RadioGroupPrimitive.Item>, RadioGroupItemProps>(
|
|
22
|
+
({ className, ...props }, ref) => {
|
|
23
|
+
return (
|
|
24
|
+
<RadioGroupPrimitive.Item
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn(
|
|
27
|
+
'aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
|
28
|
+
className,
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
33
|
+
<Circle className="h-3.5 w-3.5 fill-primary" />
|
|
34
|
+
</RadioGroupPrimitive.Indicator>
|
|
35
|
+
</RadioGroupPrimitive.Item>
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
40
|
+
|
|
41
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { GripVertical } from 'lucide-react';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { Group, Panel, Separator } from 'react-resizable-panels';
|
|
6
|
+
|
|
7
|
+
import { ResizableHandleBaseProps, ResizablePanelBaseProps, ResizablePanelGroupBaseProps } from '@gv-tech/ui-core';
|
|
8
|
+
import { cn } from './lib/utils';
|
|
9
|
+
|
|
10
|
+
// Assuming newer version uses PanelGroup/PanelResizeHandle, but user code used Group/Separator.
|
|
11
|
+
// Let's check if PanelGroup exists, if not fallback to Group.
|
|
12
|
+
// Actually, I should inspect the user's code again.
|
|
13
|
+
// User code:
|
|
14
|
+
// const ResizablePanelGroup = ({ ... }: React.ComponentProps<typeof Group> ...
|
|
15
|
+
// const ResizableHandle = ({ ... }: React.ComponentProps<typeof Separator> ...
|
|
16
|
+
|
|
17
|
+
// It seems the user is using an older version or a specific version where Group and Separator are the exports.
|
|
18
|
+
// I will align with user's code.
|
|
19
|
+
|
|
20
|
+
const ResizablePanelGroup = ({
|
|
21
|
+
className,
|
|
22
|
+
direction,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<typeof Group> & ResizablePanelGroupBaseProps) => (
|
|
25
|
+
<Group
|
|
26
|
+
orientation={direction}
|
|
27
|
+
className={cn('flex h-full w-full data-[panel-group-direction=vertical]:flex-col', className)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const ResizablePanel = Panel;
|
|
33
|
+
|
|
34
|
+
const ResizableHandle = ({
|
|
35
|
+
withHandle,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}: React.ComponentProps<typeof Separator> & ResizableHandleBaseProps) => (
|
|
39
|
+
<Separator
|
|
40
|
+
className={cn(
|
|
41
|
+
'relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90',
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
{withHandle && (
|
|
47
|
+
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
|
|
48
|
+
<GripVertical className="h-2.5 w-2.5" />
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
</Separator>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
55
|
+
export type {
|
|
56
|
+
ResizableHandleBaseProps as ResizableHandleProps,
|
|
57
|
+
ResizablePanelGroupBaseProps as ResizablePanelGroupProps,
|
|
58
|
+
ResizablePanelBaseProps as ResizablePanelProps,
|
|
59
|
+
};
|