@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/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gv-tech/ui-web",
|
|
3
|
+
"version": "2.6.0",
|
|
4
|
+
"description": "Web (DOM/Radix) implementations of the GV Tech design system components",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Garcia-Ventures/gvtech-design.git",
|
|
8
|
+
"directory": "packages/ui-web"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "Eric N. Garcia <eng618@garciaericn.com>",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./src/index.ts",
|
|
15
|
+
"default": "./src/index.ts"
|
|
16
|
+
},
|
|
17
|
+
"./*": {
|
|
18
|
+
"types": "./src/*/index.ts",
|
|
19
|
+
"default": "./src/*/index.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"main": "src/index.ts",
|
|
23
|
+
"types": "src/index.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"!src/**/*.test.*",
|
|
27
|
+
"!src/**/*.spec.*"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "echo 'No build step — consumed as TS source by sibling packages'",
|
|
31
|
+
"lint": "echo 'Linted from workspace root'",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"typecheck": "npx tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@gv-tech/design-tokens": "2.6.0",
|
|
37
|
+
"@gv-tech/ui-core": "2.6.0",
|
|
38
|
+
"@hookform/resolvers": "^5.2.2",
|
|
39
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
40
|
+
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
41
|
+
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
|
42
|
+
"@radix-ui/react-avatar": "^1.1.11",
|
|
43
|
+
"@radix-ui/react-checkbox": "^1.3.3",
|
|
44
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
45
|
+
"@radix-ui/react-context-menu": "^2.2.16",
|
|
46
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
47
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
48
|
+
"@radix-ui/react-hover-card": "^1.1.15",
|
|
49
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
50
|
+
"@radix-ui/react-menubar": "^1.1.16",
|
|
51
|
+
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
52
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
53
|
+
"@radix-ui/react-progress": "^1.1.8",
|
|
54
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
55
|
+
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
56
|
+
"@radix-ui/react-select": "^2.2.6",
|
|
57
|
+
"@radix-ui/react-separator": "^1.1.8",
|
|
58
|
+
"@radix-ui/react-slider": "^1.3.6",
|
|
59
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
60
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
61
|
+
"@radix-ui/react-tabs": "^1.1.13",
|
|
62
|
+
"@radix-ui/react-toast": "^1.2.15",
|
|
63
|
+
"@radix-ui/react-toggle": "^1.1.10",
|
|
64
|
+
"@radix-ui/react-toggle-group": "^1.1.11",
|
|
65
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
66
|
+
"class-variance-authority": "^0.7.1",
|
|
67
|
+
"clsx": "^2.1.1",
|
|
68
|
+
"cmdk": "^1.1.1",
|
|
69
|
+
"date-fns": "^4.1.0",
|
|
70
|
+
"embla-carousel-react": "^8.6.0",
|
|
71
|
+
"lucide-react": "^0.563.0",
|
|
72
|
+
"react-day-picker": "^9.13.2",
|
|
73
|
+
"react-hook-form": "^7.71.1",
|
|
74
|
+
"react-resizable-panels": "^4.6.4",
|
|
75
|
+
"recharts": "2.15.4",
|
|
76
|
+
"sonner": "^2.0.7",
|
|
77
|
+
"tailwind-merge": "^3.4.1",
|
|
78
|
+
"vaul": "^1.1.2",
|
|
79
|
+
"zod": "^4.3.6"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"react": ">=18",
|
|
83
|
+
"react-dom": ">=18"
|
|
84
|
+
},
|
|
85
|
+
"publishConfig": {
|
|
86
|
+
"access": "public"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
|
+
import { ChevronDown } from 'lucide-react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
AccordionBaseProps,
|
|
7
|
+
AccordionContentBaseProps,
|
|
8
|
+
AccordionItemBaseProps,
|
|
9
|
+
AccordionTriggerBaseProps,
|
|
10
|
+
} from '@gv-tech/ui-core';
|
|
11
|
+
import { cn } from './lib/utils';
|
|
12
|
+
|
|
13
|
+
const Accordion = AccordionPrimitive.Root;
|
|
14
|
+
|
|
15
|
+
const AccordionItem = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
17
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> & AccordionItemBaseProps
|
|
18
|
+
>(({ className, ...props }, ref) => (
|
|
19
|
+
<AccordionPrimitive.Item ref={ref} className={cn('border-b', className)} {...props} />
|
|
20
|
+
));
|
|
21
|
+
AccordionItem.displayName = 'AccordionItem';
|
|
22
|
+
|
|
23
|
+
const AccordionTrigger = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> & AccordionTriggerBaseProps
|
|
26
|
+
>(({ className, children, ...props }, ref) => (
|
|
27
|
+
<AccordionPrimitive.Header className="flex">
|
|
28
|
+
<AccordionPrimitive.Trigger
|
|
29
|
+
ref={ref}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180',
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
|
|
38
|
+
</AccordionPrimitive.Trigger>
|
|
39
|
+
</AccordionPrimitive.Header>
|
|
40
|
+
));
|
|
41
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
42
|
+
|
|
43
|
+
const AccordionContent = React.forwardRef<
|
|
44
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> & AccordionContentBaseProps
|
|
46
|
+
>(({ className, children, ...props }, ref) => (
|
|
47
|
+
<AccordionPrimitive.Content
|
|
48
|
+
ref={ref}
|
|
49
|
+
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
<div className={cn('pb-4 pt-0', className)}>{children}</div>
|
|
53
|
+
</AccordionPrimitive.Content>
|
|
54
|
+
));
|
|
55
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
56
|
+
|
|
57
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
58
|
+
export type { AccordionBaseProps as AccordionProps };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AlertDialogActionBaseProps,
|
|
6
|
+
AlertDialogBaseProps,
|
|
7
|
+
AlertDialogCancelBaseProps,
|
|
8
|
+
AlertDialogContentBaseProps,
|
|
9
|
+
AlertDialogDescriptionBaseProps,
|
|
10
|
+
AlertDialogFooterBaseProps,
|
|
11
|
+
AlertDialogHeaderBaseProps,
|
|
12
|
+
AlertDialogTitleBaseProps,
|
|
13
|
+
} from '@gv-tech/ui-core';
|
|
14
|
+
import { buttonVariants } from './button';
|
|
15
|
+
import { cn } from './lib/utils';
|
|
16
|
+
|
|
17
|
+
const AlertDialog = AlertDialogPrimitive.Root;
|
|
18
|
+
|
|
19
|
+
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
20
|
+
|
|
21
|
+
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
22
|
+
|
|
23
|
+
const AlertDialogOverlay = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
26
|
+
>(({ className, ...props }, ref) => (
|
|
27
|
+
<AlertDialogPrimitive.Overlay
|
|
28
|
+
className={cn(
|
|
29
|
+
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
ref={ref}
|
|
34
|
+
/>
|
|
35
|
+
));
|
|
36
|
+
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
37
|
+
|
|
38
|
+
const AlertDialogContent = React.forwardRef<
|
|
39
|
+
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
40
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> & AlertDialogContentBaseProps
|
|
41
|
+
>(({ className, ...props }, ref) => (
|
|
42
|
+
<AlertDialogPortal>
|
|
43
|
+
<AlertDialogOverlay />
|
|
44
|
+
<AlertDialogPrimitive.Content
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn(
|
|
47
|
+
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
|
48
|
+
className,
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
</AlertDialogPortal>
|
|
53
|
+
));
|
|
54
|
+
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
55
|
+
|
|
56
|
+
const AlertDialogHeader = ({
|
|
57
|
+
className,
|
|
58
|
+
...props
|
|
59
|
+
}: React.HTMLAttributes<HTMLDivElement> & AlertDialogHeaderBaseProps) => (
|
|
60
|
+
<div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />
|
|
61
|
+
);
|
|
62
|
+
AlertDialogHeader.displayName = 'AlertDialogHeader';
|
|
63
|
+
|
|
64
|
+
const AlertDialogFooter = ({
|
|
65
|
+
className,
|
|
66
|
+
...props
|
|
67
|
+
}: React.HTMLAttributes<HTMLDivElement> & AlertDialogFooterBaseProps) => (
|
|
68
|
+
<div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
|
|
69
|
+
);
|
|
70
|
+
AlertDialogFooter.displayName = 'AlertDialogFooter';
|
|
71
|
+
|
|
72
|
+
const AlertDialogTitle = React.forwardRef<
|
|
73
|
+
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
74
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title> & AlertDialogTitleBaseProps
|
|
75
|
+
>(({ className, ...props }, ref) => (
|
|
76
|
+
<AlertDialogPrimitive.Title ref={ref} className={cn('text-lg font-semibold', className)} {...props} />
|
|
77
|
+
));
|
|
78
|
+
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
79
|
+
|
|
80
|
+
const AlertDialogDescription = React.forwardRef<
|
|
81
|
+
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
82
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description> & AlertDialogDescriptionBaseProps
|
|
83
|
+
>(({ className, ...props }, ref) => (
|
|
84
|
+
<AlertDialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
85
|
+
));
|
|
86
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
87
|
+
|
|
88
|
+
const AlertDialogAction = React.forwardRef<
|
|
89
|
+
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
90
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> & AlertDialogActionBaseProps
|
|
91
|
+
>(({ className, ...props }, ref) => (
|
|
92
|
+
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
93
|
+
));
|
|
94
|
+
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
95
|
+
|
|
96
|
+
const AlertDialogCancel = React.forwardRef<
|
|
97
|
+
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
98
|
+
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> & AlertDialogCancelBaseProps
|
|
99
|
+
>(({ className, ...props }, ref) => (
|
|
100
|
+
<AlertDialogPrimitive.Cancel
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
));
|
|
106
|
+
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
AlertDialog,
|
|
110
|
+
AlertDialogAction,
|
|
111
|
+
AlertDialogCancel,
|
|
112
|
+
AlertDialogContent,
|
|
113
|
+
AlertDialogDescription,
|
|
114
|
+
AlertDialogFooter,
|
|
115
|
+
AlertDialogHeader,
|
|
116
|
+
AlertDialogOverlay,
|
|
117
|
+
AlertDialogPortal,
|
|
118
|
+
AlertDialogTitle,
|
|
119
|
+
AlertDialogTrigger,
|
|
120
|
+
};
|
|
121
|
+
export type { AlertDialogBaseProps as AlertDialogProps };
|
package/src/alert.tsx
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { AlertBaseProps, AlertDescriptionBaseProps, AlertTitleBaseProps } from '@gv-tech/ui-core';
|
|
5
|
+
import { cn } from './lib/utils';
|
|
6
|
+
|
|
7
|
+
const alertVariants = cva(
|
|
8
|
+
'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: 'bg-background text-foreground',
|
|
13
|
+
destructive: 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive',
|
|
14
|
+
warning:
|
|
15
|
+
'border-amber-500/50 bg-amber-500/10 text-amber-600 dark:text-amber-400 [&>svg]:text-amber-600 dark:[&>svg]:text-amber-400',
|
|
16
|
+
info: 'border-blue-500/50 bg-blue-500/10 text-blue-600 dark:text-blue-400 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-400',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: 'default',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const Alert = React.forwardRef<
|
|
26
|
+
HTMLDivElement,
|
|
27
|
+
React.HTMLAttributes<HTMLDivElement> & AlertBaseProps & VariantProps<typeof alertVariants>
|
|
28
|
+
>(({ className, variant, ...props }, ref) => (
|
|
29
|
+
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
|
|
30
|
+
));
|
|
31
|
+
Alert.displayName = 'Alert';
|
|
32
|
+
|
|
33
|
+
const AlertTitle = React.forwardRef<HTMLHeadingElement, React.HTMLAttributes<HTMLHeadingElement> & AlertTitleBaseProps>(
|
|
34
|
+
({ className, ...props }, ref) => (
|
|
35
|
+
<h5 ref={ref} className={cn('mb-1 font-medium leading-none tracking-tight', className)} {...props} />
|
|
36
|
+
),
|
|
37
|
+
);
|
|
38
|
+
AlertTitle.displayName = 'AlertTitle';
|
|
39
|
+
|
|
40
|
+
const AlertDescription = React.forwardRef<
|
|
41
|
+
HTMLDivElement,
|
|
42
|
+
React.HTMLAttributes<HTMLDivElement> & AlertDescriptionBaseProps
|
|
43
|
+
>(({ className, ...props }, ref) => (
|
|
44
|
+
<div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
|
|
45
|
+
));
|
|
46
|
+
AlertDescription.displayName = 'AlertDescription';
|
|
47
|
+
|
|
48
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
49
|
+
export type { AlertBaseProps as AlertProps };
|
package/src/avatar.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { AvatarBaseProps, AvatarFallbackBaseProps, AvatarImageBaseProps } from '@gv-tech/ui-core';
|
|
5
|
+
import { cn } from './lib/utils';
|
|
6
|
+
|
|
7
|
+
const Avatar = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> & AvatarBaseProps
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<AvatarPrimitive.Root
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
));
|
|
17
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
18
|
+
|
|
19
|
+
const AvatarImage = React.forwardRef<
|
|
20
|
+
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
21
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> & AvatarImageBaseProps
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<AvatarPrimitive.Image ref={ref} className={cn('aspect-square h-full w-full', className)} {...props} />
|
|
24
|
+
));
|
|
25
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
26
|
+
|
|
27
|
+
const AvatarFallback = React.forwardRef<
|
|
28
|
+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
29
|
+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> & AvatarFallbackBaseProps
|
|
30
|
+
>(({ className, ...props }, ref) => (
|
|
31
|
+
<AvatarPrimitive.Fallback
|
|
32
|
+
ref={ref}
|
|
33
|
+
className={cn('flex h-full w-full items-center justify-center rounded-full bg-muted', className)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
));
|
|
37
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
38
|
+
|
|
39
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
40
|
+
export type { AvatarBaseProps as AvatarProps };
|
package/src/badge.tsx
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { BadgeBaseProps } from '@gv-tech/ui-core';
|
|
5
|
+
import { cn } from './lib/utils';
|
|
6
|
+
|
|
7
|
+
const badgeVariants = cva(
|
|
8
|
+
'inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: 'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
|
|
13
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
14
|
+
destructive: 'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
|
|
15
|
+
outline: 'text-foreground',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: 'default',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export interface BadgeProps
|
|
25
|
+
extends
|
|
26
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, 'variant'>,
|
|
27
|
+
Omit<BadgeBaseProps, 'variant'>,
|
|
28
|
+
VariantProps<typeof badgeVariants> {}
|
|
29
|
+
|
|
30
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
31
|
+
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
2
|
+
import { ChevronRight, MoreHorizontal } from 'lucide-react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
BreadcrumbBaseProps,
|
|
7
|
+
BreadcrumbEllipsisBaseProps,
|
|
8
|
+
BreadcrumbItemBaseProps,
|
|
9
|
+
BreadcrumbLinkBaseProps,
|
|
10
|
+
BreadcrumbListBaseProps,
|
|
11
|
+
BreadcrumbPageBaseProps,
|
|
12
|
+
BreadcrumbSeparatorBaseProps,
|
|
13
|
+
} from '@gv-tech/ui-core';
|
|
14
|
+
import { cn } from './lib/utils';
|
|
15
|
+
|
|
16
|
+
const Breadcrumb = React.forwardRef<
|
|
17
|
+
HTMLElement,
|
|
18
|
+
React.ComponentPropsWithoutRef<'nav'> &
|
|
19
|
+
BreadcrumbBaseProps & {
|
|
20
|
+
separator?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
|
|
23
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
24
|
+
|
|
25
|
+
const BreadcrumbList = React.forwardRef<
|
|
26
|
+
HTMLOListElement,
|
|
27
|
+
React.ComponentPropsWithoutRef<'ol'> & BreadcrumbListBaseProps
|
|
28
|
+
>(({ className, ...props }, ref) => (
|
|
29
|
+
<ol
|
|
30
|
+
ref={ref}
|
|
31
|
+
className={cn(
|
|
32
|
+
'flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5',
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
));
|
|
38
|
+
BreadcrumbList.displayName = 'BreadcrumbList';
|
|
39
|
+
|
|
40
|
+
const BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'> & BreadcrumbItemBaseProps>(
|
|
41
|
+
({ className, ...props }, ref) => (
|
|
42
|
+
<li ref={ref} className={cn('inline-flex items-center gap-1.5', className)} {...props} />
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
BreadcrumbItem.displayName = 'BreadcrumbItem';
|
|
46
|
+
|
|
47
|
+
const BreadcrumbLink = React.forwardRef<
|
|
48
|
+
HTMLAnchorElement,
|
|
49
|
+
React.ComponentPropsWithoutRef<'a'> & BreadcrumbLinkBaseProps
|
|
50
|
+
>(({ asChild, className, ...props }, ref) => {
|
|
51
|
+
const Comp = asChild ? Slot : 'a';
|
|
52
|
+
|
|
53
|
+
return <Comp ref={ref} className={cn('transition-colors hover:text-foreground', className)} {...props} />;
|
|
54
|
+
});
|
|
55
|
+
BreadcrumbLink.displayName = 'BreadcrumbLink';
|
|
56
|
+
|
|
57
|
+
const BreadcrumbPage = React.forwardRef<
|
|
58
|
+
HTMLSpanElement,
|
|
59
|
+
React.ComponentPropsWithoutRef<'span'> & BreadcrumbPageBaseProps
|
|
60
|
+
>(({ className, ...props }, ref) => (
|
|
61
|
+
<span
|
|
62
|
+
ref={ref}
|
|
63
|
+
role="link"
|
|
64
|
+
aria-disabled="true"
|
|
65
|
+
aria-current="page"
|
|
66
|
+
className={cn('font-normal text-foreground', className)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
));
|
|
70
|
+
BreadcrumbPage.displayName = 'BreadcrumbPage';
|
|
71
|
+
|
|
72
|
+
const BreadcrumbSeparator = ({
|
|
73
|
+
children,
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: React.ComponentProps<'li'> & BreadcrumbSeparatorBaseProps) => (
|
|
77
|
+
<li role="presentation" aria-hidden="true" className={cn('[&>svg]:w-3.5 [&>svg]:h-3.5', className)} {...props}>
|
|
78
|
+
{children ?? <ChevronRight />}
|
|
79
|
+
</li>
|
|
80
|
+
);
|
|
81
|
+
BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
|
|
82
|
+
|
|
83
|
+
const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<'span'> & BreadcrumbEllipsisBaseProps) => (
|
|
84
|
+
<span
|
|
85
|
+
role="presentation"
|
|
86
|
+
aria-hidden="true"
|
|
87
|
+
className={cn('flex h-9 w-9 items-center justify-center', className)}
|
|
88
|
+
{...props}
|
|
89
|
+
>
|
|
90
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
91
|
+
<span className="sr-only">More</span>
|
|
92
|
+
</span>
|
|
93
|
+
);
|
|
94
|
+
BreadcrumbEllipsis.displayName = 'BreadcrumbElipssis';
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
Breadcrumb,
|
|
98
|
+
BreadcrumbEllipsis,
|
|
99
|
+
BreadcrumbItem,
|
|
100
|
+
BreadcrumbLink,
|
|
101
|
+
BreadcrumbList,
|
|
102
|
+
BreadcrumbPage,
|
|
103
|
+
BreadcrumbSeparator,
|
|
104
|
+
};
|
|
105
|
+
export type { BreadcrumbBaseProps as BreadcrumbProps };
|
package/src/button.tsx
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import type { ButtonBaseProps } from '@gv-tech/ui-core';
|
|
6
|
+
import { cn } from './lib/utils';
|
|
7
|
+
|
|
8
|
+
const buttonVariants = cva(
|
|
9
|
+
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
14
|
+
destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
15
|
+
outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
16
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
17
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
18
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: 'h-9 px-4 py-2',
|
|
22
|
+
sm: 'h-8 rounded-md px-3 text-xs',
|
|
23
|
+
lg: 'h-10 rounded-md px-8',
|
|
24
|
+
icon: 'h-9 w-9',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: 'default',
|
|
29
|
+
size: 'default',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export interface ButtonProps
|
|
35
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants>, ButtonBaseProps {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
40
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
41
|
+
const Comp = asChild ? Slot : 'button';
|
|
42
|
+
return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />;
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
Button.displayName = 'Button';
|
|
46
|
+
|
|
47
|
+
export { Button, buttonVariants };
|