@vvedantb/ui 0.1.1 → 0.1.3

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 (74) hide show
  1. package/LICENSE +21 -21
  2. package/package.json +3 -2
  3. package/src/ai-elements/artifact.tsx +99 -99
  4. package/src/ai-elements/attachments.tsx +366 -366
  5. package/src/ai-elements/chain-of-thought.tsx +212 -212
  6. package/src/ai-elements/code-block.tsx +478 -478
  7. package/src/ai-elements/conversation.tsx +157 -157
  8. package/src/ai-elements/image.tsx +25 -25
  9. package/src/ai-elements/inline-citation.tsx +252 -252
  10. package/src/ai-elements/message.tsx +269 -269
  11. package/src/ai-elements/model-selector.tsx +211 -211
  12. package/src/ai-elements/prompt-input.tsx +1018 -1018
  13. package/src/ai-elements/queue.tsx +251 -251
  14. package/src/ai-elements/reasoning.tsx +178 -178
  15. package/src/ai-elements/shimmer.tsx +56 -56
  16. package/src/ai-elements/sources.tsx +77 -77
  17. package/src/ai-elements/speech-input.tsx +290 -290
  18. package/src/ai-elements/suggestion.tsx +191 -191
  19. package/src/css.d.ts +2 -2
  20. package/src/index.ts +96 -96
  21. package/src/motion/presets.ts +35 -35
  22. package/src/motion/presets.vibot.ts +105 -105
  23. package/src/ui/_menu-classes.ts +30 -30
  24. package/src/ui/_menu-classes.vibot.ts +33 -33
  25. package/src/ui/accordion.tsx +81 -81
  26. package/src/ui/accordion.verve.tsx +56 -56
  27. package/src/ui/badge.tsx +34 -34
  28. package/src/ui/breadcrumb.tsx +83 -83
  29. package/src/ui/button-group.tsx +84 -84
  30. package/src/ui/button.tsx +57 -57
  31. package/src/ui/card.tsx +27 -27
  32. package/src/ui/carousel.tsx +211 -211
  33. package/src/ui/checkbox.tsx +27 -27
  34. package/src/ui/clear-input.tsx +170 -170
  35. package/src/ui/clear-input.vibot.tsx +76 -76
  36. package/src/ui/clearInputDissolve.ts +214 -214
  37. package/src/ui/collapsible.tsx +7 -7
  38. package/src/ui/command.tsx +148 -148
  39. package/src/ui/context-menu.tsx +173 -173
  40. package/src/ui/dialog.tsx +149 -149
  41. package/src/ui/dropdown-menu.tsx +178 -178
  42. package/src/ui/hover-card.tsx +31 -31
  43. package/src/ui/input-group.tsx +162 -162
  44. package/src/ui/input-group.verve.tsx +150 -150
  45. package/src/ui/input.tsx +21 -21
  46. package/src/ui/kbd.tsx +18 -18
  47. package/src/ui/label.tsx +20 -20
  48. package/src/ui/labeled-switch-row.tsx +53 -53
  49. package/src/ui/modalTransition.ts +85 -85
  50. package/src/ui/pagination.tsx +47 -47
  51. package/src/ui/popover.tsx +33 -33
  52. package/src/ui/progress.tsx +25 -25
  53. package/src/ui/radix-select.tsx +202 -202
  54. package/src/ui/scroll-area.tsx +55 -55
  55. package/src/ui/scroll-area.verve.tsx +43 -43
  56. package/src/ui/search-input.tsx +29 -29
  57. package/src/ui/select.tsx +163 -163
  58. package/src/ui/separator.tsx +28 -28
  59. package/src/ui/sheet.tsx +100 -87
  60. package/src/ui/skeleton.tsx +18 -18
  61. package/src/ui/sonner.css +16 -16
  62. package/src/ui/sonner.tsx +47 -47
  63. package/src/ui/spinner.tsx +27 -27
  64. package/src/ui/surface-classes.ts +55 -55
  65. package/src/ui/switch.tsx +26 -26
  66. package/src/ui/table.tsx +123 -123
  67. package/src/ui/tabs.tsx +140 -140
  68. package/src/ui/tabsSliding.ts +56 -56
  69. package/src/ui/textarea.tsx +21 -21
  70. package/src/ui/time-picker.tsx +170 -170
  71. package/src/ui/tooltip.tsx +25 -25
  72. package/src/ui/visually-hidden.tsx +3 -3
  73. package/src/utils/cn.ts +16 -16
  74. package/src/utils/ref.ts +10 -10
package/src/ui/badge.tsx CHANGED
@@ -1,34 +1,34 @@
1
- import { cva, type VariantProps } from "class-variance-authority";
2
- import { cn } from "../utils/cn";
3
-
4
- const badgeVariants = cva(
5
- "inline-flex items-center gap-1 rounded-full border border-transparent px-2.5 py-1 text-xs font-medium tracking-normal transition-colors focus:outline-none focus:ring-2 focus:ring-focus-ring focus:ring-offset-2",
6
- {
7
- variants: {
8
- variant: {
9
- default: "border-border bg-default text-foreground",
10
- secondary: "border-separator bg-default text-default-foreground",
11
- destructive: "border-danger/25 bg-danger/12 text-danger",
12
- outline: "border-separator bg-transparent text-muted",
13
- success: "border-success/25 bg-success/12 text-success",
14
- warning: "border-warning/25 bg-warning/12 text-warning",
15
- },
16
- },
17
- defaultVariants: {
18
- variant: "default",
19
- },
20
- },
21
- );
22
-
23
- export interface BadgeProps
24
- extends
25
- React.HTMLAttributes<HTMLDivElement>,
26
- VariantProps<typeof badgeVariants> {}
27
-
28
- function Badge({ className, variant, ...props }: BadgeProps) {
29
- return (
30
- <div className={cn(badgeVariants({ variant }), className)} {...props} />
31
- );
32
- }
33
-
34
- export { Badge };
1
+ import { cva, type VariantProps } from "class-variance-authority";
2
+ import { cn } from "../utils/cn";
3
+
4
+ const badgeVariants = cva(
5
+ "inline-flex items-center gap-1 rounded-full border border-transparent px-2.5 py-1 text-xs font-medium tracking-normal transition-colors focus:outline-none focus:ring-2 focus:ring-focus-ring focus:ring-offset-2 focus:ring-offset-background",
6
+ {
7
+ variants: {
8
+ variant: {
9
+ default: "border-border bg-default text-foreground",
10
+ secondary: "border-separator bg-default text-default-foreground",
11
+ destructive: "border-danger/25 bg-danger/12 text-danger",
12
+ outline: "border-separator bg-transparent text-muted",
13
+ success: "border-success/25 bg-success/12 text-success",
14
+ warning: "border-warning/25 bg-warning/12 text-warning",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ variant: "default",
19
+ },
20
+ },
21
+ );
22
+
23
+ export interface BadgeProps
24
+ extends
25
+ React.HTMLAttributes<HTMLDivElement>,
26
+ VariantProps<typeof badgeVariants> {}
27
+
28
+ function Badge({ className, variant, ...props }: BadgeProps) {
29
+ return (
30
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
31
+ );
32
+ }
33
+
34
+ export { Badge };
@@ -1,83 +1,83 @@
1
- import * as React from "react";
2
- import { Slot } from "@radix-ui/react-slot";
3
- import { cn } from "../utils/cn";
4
-
5
- // breadcrumb, navigation trail for the current page location renders its children as a horizontal list with `/` separators automatically
6
- // inserted between them designed to replace the page title + back button on
7
- // detail pages: the parent route(s) act as the "up" affordance and the final
8
- // segment identifies the current page example: <breadcrumb> <breadcrumblink aschild> <link to="/wiki">wiki</link> </breadcrumblink> <breadcrumbpage>overview</breadcrumbpage> </breadcrumb>
9
- const Breadcrumb = React.forwardRef<
10
- HTMLElement,
11
- React.HTMLAttributes<HTMLElement>
12
- >(({ className, children, ...props }, ref) => {
13
- // Filter out falsy children (e.g. conditionally rendered segments) so the
14
- // separator interleaving stays aligned with actual rendered items.
15
- const items = React.Children.toArray(children).filter(Boolean);
16
-
17
- return (
18
- <nav
19
- ref={ref}
20
- aria-label="breadcrumb"
21
- className={cn(
22
- "flex min-w-0 items-center gap-1.5 text-xl font-semibold leading-tight tracking-tight",
23
- className,
24
- )}
25
- {...props}
26
- >
27
- {items.map((item, index) => (
28
- <React.Fragment key={index}>
29
- {item}
30
- {index < items.length - 1 && <BreadcrumbSeparator />}
31
- </React.Fragment>
32
- ))}
33
- </nav>
34
- );
35
- });
36
- Breadcrumb.displayName = "Breadcrumb";
37
-
38
- // clickable breadcrumb segment (parent routes) muted + medium weight, one
39
- // step quieter than the current page, shifts to foreground on hover pass
40
- // `aschild` to render as your router's link component while keeping the
41
- // styling, preserves type, safe routing
42
- const BreadcrumbLink = React.forwardRef<
43
- HTMLAnchorElement,
44
- React.AnchorHTMLAttributes<HTMLAnchorElement> & { asChild?: boolean }
45
- >(({ asChild = false, className, ...props }, ref) => {
46
- const Comp = asChild ? Slot : "a";
47
- return (
48
- <Comp
49
- ref={ref}
50
- className={cn(
51
- "min-w-0 truncate font-medium text-muted transition-colors hover:text-foreground",
52
- className,
53
- )}
54
- {...props}
55
- />
56
- );
57
- });
58
- BreadcrumbLink.displayName = "BreadcrumbLink";
59
-
60
- // current page segment (last in the trail) inherits the page-title weight
61
- // (semibold) at foreground colour, and not clickable, signals "you are here"
62
- const BreadcrumbPage = React.forwardRef<
63
- HTMLSpanElement,
64
- React.HTMLAttributes<HTMLSpanElement>
65
- >(({ className, ...props }, ref) => (
66
- <span
67
- ref={ref}
68
- aria-current="page"
69
- className={cn("min-w-0 truncate text-foreground", className)}
70
- {...props}
71
- />
72
- ));
73
- BreadcrumbPage.displayName = "BreadcrumbPage";
74
-
75
- // separator rendered automatically between breadcrumb children
76
- const BreadcrumbSeparator = () => (
77
- <span aria-hidden className="flex-shrink-0 text-muted/40">
78
- /
79
- </span>
80
- );
81
- BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
82
-
83
- export { Breadcrumb, BreadcrumbLink, BreadcrumbPage };
1
+ import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cn } from "../utils/cn";
4
+
5
+ // breadcrumb, navigation trail for the current page location renders its children as a horizontal list with `/` separators automatically
6
+ // inserted between them designed to replace the page title + back button on
7
+ // detail pages: the parent route(s) act as the "up" affordance and the final
8
+ // segment identifies the current page example: <breadcrumb> <breadcrumblink aschild> <link to="/wiki">wiki</link> </breadcrumblink> <breadcrumbpage>overview</breadcrumbpage> </breadcrumb>
9
+ const Breadcrumb = React.forwardRef<
10
+ HTMLElement,
11
+ React.HTMLAttributes<HTMLElement>
12
+ >(({ className, children, ...props }, ref) => {
13
+ // Filter out falsy children (e.g. conditionally rendered segments) so the
14
+ // separator interleaving stays aligned with actual rendered items.
15
+ const items = React.Children.toArray(children).filter(Boolean);
16
+
17
+ return (
18
+ <nav
19
+ ref={ref}
20
+ aria-label="breadcrumb"
21
+ className={cn(
22
+ "flex min-w-0 items-center gap-1.5 text-xl font-semibold leading-tight tracking-tight",
23
+ className,
24
+ )}
25
+ {...props}
26
+ >
27
+ {items.map((item, index) => (
28
+ <React.Fragment key={index}>
29
+ {item}
30
+ {index < items.length - 1 && <BreadcrumbSeparator />}
31
+ </React.Fragment>
32
+ ))}
33
+ </nav>
34
+ );
35
+ });
36
+ Breadcrumb.displayName = "Breadcrumb";
37
+
38
+ // clickable breadcrumb segment (parent routes) muted + medium weight, one
39
+ // step quieter than the current page, shifts to foreground on hover pass
40
+ // `aschild` to render as your router's link component while keeping the
41
+ // styling, preserves type, safe routing
42
+ const BreadcrumbLink = React.forwardRef<
43
+ HTMLAnchorElement,
44
+ React.AnchorHTMLAttributes<HTMLAnchorElement> & { asChild?: boolean }
45
+ >(({ asChild = false, className, ...props }, ref) => {
46
+ const Comp = asChild ? Slot : "a";
47
+ return (
48
+ <Comp
49
+ ref={ref}
50
+ className={cn(
51
+ "min-w-0 truncate font-medium text-muted transition-colors hover:text-foreground",
52
+ className,
53
+ )}
54
+ {...props}
55
+ />
56
+ );
57
+ });
58
+ BreadcrumbLink.displayName = "BreadcrumbLink";
59
+
60
+ // current page segment (last in the trail) inherits the page-title weight
61
+ // (semibold) at foreground colour, and not clickable, signals "you are here"
62
+ const BreadcrumbPage = React.forwardRef<
63
+ HTMLSpanElement,
64
+ React.HTMLAttributes<HTMLSpanElement>
65
+ >(({ className, ...props }, ref) => (
66
+ <span
67
+ ref={ref}
68
+ aria-current="page"
69
+ className={cn("min-w-0 truncate text-foreground", className)}
70
+ {...props}
71
+ />
72
+ ));
73
+ BreadcrumbPage.displayName = "BreadcrumbPage";
74
+
75
+ // separator rendered automatically between breadcrumb children
76
+ const BreadcrumbSeparator = () => (
77
+ <span aria-hidden className="flex-shrink-0 text-muted/40">
78
+ /
79
+ </span>
80
+ );
81
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
82
+
83
+ export { Breadcrumb, BreadcrumbLink, BreadcrumbPage };
@@ -1,84 +1,84 @@
1
- import type * as React from "react";
2
- import { cva, type VariantProps } from "class-variance-authority";
3
- import { Slot } from "radix-ui";
4
-
5
- import { cn } from "../utils/cn";
6
- import { Separator } from "./separator";
7
-
8
- const buttonGroupVariants = cva(
9
- "flex w-fit items-stretch focus-visible:*:z-10 focus-visible:*:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 [&>[data-slot=select-trigger]:last-of-type]:has-[select[aria-hidden=true]:last-child]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
10
- {
11
- variants: {
12
- orientation: {
13
- horizontal:
14
- "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
15
- vertical:
16
- "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
17
- },
18
- },
19
- defaultVariants: {
20
- orientation: "horizontal",
21
- },
22
- },
23
- );
24
-
25
- function ButtonGroup({
26
- className,
27
- orientation,
28
- ...props
29
- }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
30
- return (
31
- <div
32
- role="group"
33
- data-slot="button-group"
34
- data-orientation={orientation}
35
- className={cn(buttonGroupVariants({ orientation }), className)}
36
- {...props}
37
- />
38
- );
39
- }
40
-
41
- function ButtonGroupText({
42
- className,
43
- asChild = false,
44
- ...props
45
- }: React.ComponentProps<"div"> & {
46
- asChild?: boolean;
47
- }) {
48
- const Comp = asChild ? Slot.Root : "div";
49
-
50
- return (
51
- <Comp
52
- className={cn(
53
- "bg-surface-secondary flex items-center gap-2 rounded-md px-4 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
54
- className,
55
- )}
56
- {...props}
57
- />
58
- );
59
- }
60
-
61
- function ButtonGroupSeparator({
62
- className,
63
- orientation = "vertical",
64
- ...props
65
- }: React.ComponentProps<typeof Separator>) {
66
- return (
67
- <Separator
68
- data-slot="button-group-separator"
69
- orientation={orientation}
70
- className={cn(
71
- "bg-separator relative m-0! self-stretch data-[orientation=vertical]:h-auto",
72
- className,
73
- )}
74
- {...props}
75
- />
76
- );
77
- }
78
-
79
- export {
80
- ButtonGroup,
81
- ButtonGroupSeparator,
82
- ButtonGroupText,
83
- buttonGroupVariants,
84
- };
1
+ import type * as React from "react";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+ import { Slot } from "radix-ui";
4
+
5
+ import { cn } from "../utils/cn";
6
+ import { Separator } from "./separator";
7
+
8
+ const buttonGroupVariants = cva(
9
+ "flex w-fit items-stretch focus-visible:*:z-10 focus-visible:*:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 [&>[data-slot=select-trigger]:last-of-type]:has-[select[aria-hidden=true]:last-child]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
10
+ {
11
+ variants: {
12
+ orientation: {
13
+ horizontal:
14
+ "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
15
+ vertical:
16
+ "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ orientation: "horizontal",
21
+ },
22
+ },
23
+ );
24
+
25
+ function ButtonGroup({
26
+ className,
27
+ orientation,
28
+ ...props
29
+ }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
30
+ return (
31
+ <div
32
+ role="group"
33
+ data-slot="button-group"
34
+ data-orientation={orientation}
35
+ className={cn(buttonGroupVariants({ orientation }), className)}
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ function ButtonGroupText({
42
+ className,
43
+ asChild = false,
44
+ ...props
45
+ }: React.ComponentProps<"div"> & {
46
+ asChild?: boolean;
47
+ }) {
48
+ const Comp = asChild ? Slot.Root : "div";
49
+
50
+ return (
51
+ <Comp
52
+ className={cn(
53
+ "bg-surface-secondary flex items-center gap-2 rounded-md px-4 text-sm font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
54
+ className,
55
+ )}
56
+ {...props}
57
+ />
58
+ );
59
+ }
60
+
61
+ function ButtonGroupSeparator({
62
+ className,
63
+ orientation = "vertical",
64
+ ...props
65
+ }: React.ComponentProps<typeof Separator>) {
66
+ return (
67
+ <Separator
68
+ data-slot="button-group-separator"
69
+ orientation={orientation}
70
+ className={cn(
71
+ "bg-separator relative m-0! self-stretch data-[orientation=vertical]:h-auto",
72
+ className,
73
+ )}
74
+ {...props}
75
+ />
76
+ );
77
+ }
78
+
79
+ export {
80
+ ButtonGroup,
81
+ ButtonGroupSeparator,
82
+ ButtonGroupText,
83
+ buttonGroupVariants,
84
+ };
package/src/ui/button.tsx CHANGED
@@ -1,57 +1,57 @@
1
- import * as React from "react";
2
- import { Slot } from "@radix-ui/react-slot";
3
- import { cva, type VariantProps } from "class-variance-authority";
4
- import { cn } from "../utils/cn";
5
-
6
- const buttonVariants = cva(
7
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium tracking-normal transition-[transform,background-color,box-shadow,opacity,border-color] duration-200 ease-smooth focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 active:scale-[0.96] [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
8
- {
9
- variants: {
10
- variant: {
11
- default:
12
- "bg-accent text-accent-foreground hover:-translate-y-0.5 hover:opacity-90",
13
- destructive: "bg-danger text-danger-foreground hover:bg-danger/90",
14
- outline:
15
- "border border-border bg-transparent text-foreground hover:bg-default",
16
- secondary: "bg-default text-default-foreground hover:bg-default/78",
17
- ghost: "text-muted hover:bg-surface-tertiary hover:text-foreground",
18
- link: "text-accent underline-offset-4 hover:underline active:scale-100",
19
- },
20
- size: {
21
- default: "h-10 px-4 py-2",
22
- sm: "h-8 rounded-lg px-3 text-xs max-sm:hit-target",
23
- lg: "h-11 px-6",
24
- icon: "h-10 w-10",
25
- "icon-sm": "h-8 w-8 rounded-lg max-sm:hit-target",
26
- "icon-xs": "h-7 w-7 rounded-md hit-target",
27
- },
28
- },
29
- defaultVariants: {
30
- variant: "default",
31
- size: "default",
32
- },
33
- },
34
- );
35
-
36
- export interface ButtonProps
37
- extends
38
- React.ButtonHTMLAttributes<HTMLButtonElement>,
39
- VariantProps<typeof buttonVariants> {
40
- asChild?: boolean;
41
- }
42
-
43
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44
- ({ className, variant, size, asChild = false, ...props }, ref) => {
45
- const Comp = asChild ? Slot : "button";
46
- return (
47
- <Comp
48
- className={cn(buttonVariants({ variant, size, className }))}
49
- ref={ref}
50
- {...props}
51
- />
52
- );
53
- },
54
- );
55
- Button.displayName = "Button";
56
-
57
- export { Button };
1
+ import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+ import { cn } from "../utils/cn";
5
+
6
+ const buttonVariants = cva(
7
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium tracking-normal transition-[transform,background-color,box-shadow,opacity,border-color] duration-200 ease-smooth focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 active:scale-[0.96] [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default:
12
+ "bg-accent text-accent-foreground hover:-translate-y-0.5 hover:opacity-90",
13
+ destructive: "bg-danger text-danger-foreground hover:bg-danger/90",
14
+ outline:
15
+ "border border-border bg-transparent text-foreground hover:bg-default",
16
+ secondary: "bg-default text-default-foreground hover:bg-default/78",
17
+ ghost: "text-muted hover:bg-surface-tertiary hover:text-foreground",
18
+ link: "text-accent underline-offset-4 hover:underline active:scale-100",
19
+ },
20
+ size: {
21
+ default: "h-10 px-4 py-2",
22
+ sm: "h-8 rounded-lg px-3 text-xs max-sm:hit-target",
23
+ lg: "h-11 px-6",
24
+ icon: "h-10 w-10",
25
+ "icon-sm": "h-8 w-8 rounded-lg max-sm:hit-target",
26
+ "icon-xs": "h-7 w-7 rounded-md hit-target",
27
+ },
28
+ },
29
+ defaultVariants: {
30
+ variant: "default",
31
+ size: "default",
32
+ },
33
+ },
34
+ );
35
+
36
+ export interface ButtonProps
37
+ extends
38
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
39
+ VariantProps<typeof buttonVariants> {
40
+ asChild?: boolean;
41
+ }
42
+
43
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
44
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
45
+ const Comp = asChild ? Slot : "button";
46
+ return (
47
+ <Comp
48
+ className={cn(buttonVariants({ variant, size, className }))}
49
+ ref={ref}
50
+ {...props}
51
+ />
52
+ );
53
+ },
54
+ );
55
+ Button.displayName = "Button";
56
+
57
+ export { Button };
package/src/ui/card.tsx CHANGED
@@ -1,27 +1,27 @@
1
- import * as React from "react";
2
- import { cn } from "../utils/cn";
3
-
4
- const Card = React.forwardRef<
5
- HTMLDivElement,
6
- React.HTMLAttributes<HTMLDivElement>
7
- >(({ className, ...props }, ref) => (
8
- <div
9
- ref={ref}
10
- className={cn(
11
- "rounded-lg bg-surface-card text-surface-foreground",
12
- className,
13
- )}
14
- {...props}
15
- />
16
- ));
17
- Card.displayName = "Card";
18
-
19
- const CardContent = React.forwardRef<
20
- HTMLDivElement,
21
- React.HTMLAttributes<HTMLDivElement>
22
- >(({ className, ...props }, ref) => (
23
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
24
- ));
25
- CardContent.displayName = "CardContent";
26
-
27
- export { Card, CardContent };
1
+ import * as React from "react";
2
+ import { cn } from "../utils/cn";
3
+
4
+ const Card = React.forwardRef<
5
+ HTMLDivElement,
6
+ React.HTMLAttributes<HTMLDivElement>
7
+ >(({ className, ...props }, ref) => (
8
+ <div
9
+ ref={ref}
10
+ className={cn(
11
+ "rounded-lg bg-surface-card text-surface-foreground",
12
+ className,
13
+ )}
14
+ {...props}
15
+ />
16
+ ));
17
+ Card.displayName = "Card";
18
+
19
+ const CardContent = React.forwardRef<
20
+ HTMLDivElement,
21
+ React.HTMLAttributes<HTMLDivElement>
22
+ >(({ className, ...props }, ref) => (
23
+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
24
+ ));
25
+ CardContent.displayName = "CardContent";
26
+
27
+ export { Card, CardContent };