@c-rex/ui 0.0.10 → 0.0.12

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 (106) hide show
  1. package/package.json +87 -107
  2. package/src/alert.tsx +58 -0
  3. package/src/breadcrumb.tsx +115 -0
  4. package/src/button.tsx +66 -0
  5. package/src/command.tsx +151 -0
  6. package/src/dialog.tsx +122 -0
  7. package/src/hooks/use-mobile.tsx +19 -0
  8. package/src/input.tsx +22 -0
  9. package/src/popover.tsx +31 -0
  10. package/src/select.tsx +157 -0
  11. package/src/separator.tsx +29 -0
  12. package/src/sheet.tsx +140 -0
  13. package/src/sidebar.tsx +785 -0
  14. package/src/skeleton.tsx +15 -0
  15. package/src/table.tsx +120 -0
  16. package/src/tooltip.tsx +30 -0
  17. package/dist/alert.cjs +0 -2
  18. package/dist/alert.cjs.map +0 -1
  19. package/dist/alert.d.cts +0 -11
  20. package/dist/alert.d.ts +0 -11
  21. package/dist/alert.js +0 -2
  22. package/dist/alert.js.map +0 -1
  23. package/dist/breadcrumb.cjs +0 -2
  24. package/dist/breadcrumb.cjs.map +0 -1
  25. package/dist/breadcrumb.d.cts +0 -22
  26. package/dist/breadcrumb.d.ts +0 -22
  27. package/dist/breadcrumb.js +0 -2
  28. package/dist/breadcrumb.js.map +0 -1
  29. package/dist/button.cjs +0 -2
  30. package/dist/button.cjs.map +0 -1
  31. package/dist/button.d.cts +0 -15
  32. package/dist/button.d.ts +0 -15
  33. package/dist/button.js +0 -2
  34. package/dist/button.js.map +0 -1
  35. package/dist/command.cjs +0 -2
  36. package/dist/command.cjs.map +0 -1
  37. package/dist/command.d.cts +0 -83
  38. package/dist/command.d.ts +0 -83
  39. package/dist/command.js +0 -2
  40. package/dist/command.js.map +0 -1
  41. package/dist/dialog.cjs +0 -2
  42. package/dist/dialog.cjs.map +0 -1
  43. package/dist/dialog.d.cts +0 -22
  44. package/dist/dialog.d.ts +0 -22
  45. package/dist/dialog.js +0 -2
  46. package/dist/dialog.js.map +0 -1
  47. package/dist/hooks/use-mobile.cjs +0 -2
  48. package/dist/hooks/use-mobile.cjs.map +0 -1
  49. package/dist/hooks/use-mobile.d.cts +0 -3
  50. package/dist/hooks/use-mobile.d.ts +0 -3
  51. package/dist/hooks/use-mobile.js +0 -2
  52. package/dist/hooks/use-mobile.js.map +0 -1
  53. package/dist/input.cjs +0 -2
  54. package/dist/input.cjs.map +0 -1
  55. package/dist/input.d.cts +0 -5
  56. package/dist/input.d.ts +0 -5
  57. package/dist/input.js +0 -2
  58. package/dist/input.js.map +0 -1
  59. package/dist/popover.cjs +0 -2
  60. package/dist/popover.cjs.map +0 -1
  61. package/dist/popover.d.cts +0 -9
  62. package/dist/popover.d.ts +0 -9
  63. package/dist/popover.js +0 -2
  64. package/dist/popover.js.map +0 -1
  65. package/dist/select.cjs +0 -2
  66. package/dist/select.cjs.map +0 -1
  67. package/dist/select.d.cts +0 -15
  68. package/dist/select.d.ts +0 -15
  69. package/dist/select.js +0 -2
  70. package/dist/select.js.map +0 -1
  71. package/dist/separator.cjs +0 -2
  72. package/dist/separator.cjs.map +0 -1
  73. package/dist/separator.d.cts +0 -6
  74. package/dist/separator.d.ts +0 -6
  75. package/dist/separator.js +0 -2
  76. package/dist/separator.js.map +0 -1
  77. package/dist/sheet.cjs +0 -2
  78. package/dist/sheet.cjs.map +0 -1
  79. package/dist/sheet.d.cts +0 -29
  80. package/dist/sheet.d.ts +0 -29
  81. package/dist/sheet.js +0 -2
  82. package/dist/sheet.js.map +0 -1
  83. package/dist/sidebar.cjs +0 -2
  84. package/dist/sidebar.cjs.map +0 -1
  85. package/dist/sidebar.d.cts +0 -72
  86. package/dist/sidebar.d.ts +0 -72
  87. package/dist/sidebar.js +0 -2
  88. package/dist/sidebar.js.map +0 -1
  89. package/dist/skeleton.cjs +0 -2
  90. package/dist/skeleton.cjs.map +0 -1
  91. package/dist/skeleton.d.cts +0 -5
  92. package/dist/skeleton.d.ts +0 -5
  93. package/dist/skeleton.js +0 -2
  94. package/dist/skeleton.js.map +0 -1
  95. package/dist/table.cjs +0 -2
  96. package/dist/table.cjs.map +0 -1
  97. package/dist/table.d.cts +0 -12
  98. package/dist/table.d.ts +0 -12
  99. package/dist/table.js +0 -2
  100. package/dist/table.js.map +0 -1
  101. package/dist/tooltip.cjs +0 -2
  102. package/dist/tooltip.cjs.map +0 -1
  103. package/dist/tooltip.d.cts +0 -9
  104. package/dist/tooltip.d.ts +0 -9
  105. package/dist/tooltip.js +0 -2
  106. package/dist/tooltip.js.map +0 -1
package/package.json CHANGED
@@ -1,120 +1,100 @@
1
1
  {
2
2
  "name": "@c-rex/ui",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "files": [
6
- "dist"
6
+ "src"
7
7
  ],
8
+ "sideEffects": false,
8
9
  "publishConfig": {
9
- "access": "public"
10
+ "access": "public"
10
11
  },
11
12
  "exports": {
12
- "./alert": {
13
- "types": "./dist/alert.d.ts",
14
- "import": "./dist/alert.esm.js",
15
- "require": "./dist/alert.cjs.js"
16
- },
17
- "./breadcrumb": {
18
- "types": "./dist/breadcrumb.d.ts",
19
- "import": "./dist/breadcrumb.esm.js",
20
- "require": "./dist/breadcrumb.cjs.js"
21
- },
22
- "./button": {
23
- "types": "./dist/button.d.ts",
24
- "import": "./dist/button.esm.js",
25
- "require": "./dist/button.cjs.js"
26
- },
27
- "./command": {
28
- "types": "./dist/command.d.ts",
29
- "import": "./dist/command.esm.js",
30
- "require": "./dist/command.cjs.js"
31
- },
32
- "./dialog": {
33
- "types": "./dist/dialog.d.ts",
34
- "import": "./dist/dialog.esm.js",
35
- "require": "./dist/dialog.cjs.js"
36
- },
37
- "./hooks/use-mobile": {
38
- "types": "./dist/hooks/use-mobile.d.ts",
39
- "import": "./dist/hooks/use-mobile.esm.js",
40
- "require": "./dist/hooks/use-mobile.cjs.js"
41
- },
42
- "./input": {
43
- "types": "./dist/input.d.ts",
44
- "import": "./dist/input.esm.js",
45
- "require": "./dist/input.cjs.js"
46
- },
47
- "./popover": {
48
- "types": "./dist/popover.d.ts",
49
- "import": "./dist/popover.esm.js",
50
- "require": "./dist/popover.cjs.js"
51
- },
52
- "./select": {
53
- "types": "./dist/select.d.ts",
54
- "import": "./dist/select.esm.js",
55
- "require": "./dist/select.cjs.js"
56
- },
57
- "./separator": {
58
- "types": "./dist/separator.d.ts",
59
- "import": "./dist/separator.esm.js",
60
- "require": "./dist/separator.cjs.js"
61
- },
62
- "./sheet": {
63
- "types": "./dist/sheet.d.ts",
64
- "import": "./dist/sheet.esm.js",
65
- "require": "./dist/sheet.cjs.js"
66
- },
67
- "./sidebar": {
68
- "types": "./dist/sidebar.d.ts",
69
- "import": "./dist/sidebar.esm.js",
70
- "require": "./dist/sidebar.cjs.js"
71
- },
72
- "./skeleton": {
73
- "types": "./dist/skeleton.d.ts",
74
- "import": "./dist/skeleton.esm.js",
75
- "require": "./dist/skeleton.cjs.js"
76
- },
77
- "./table": {
78
- "types": "./dist/table.d.ts",
79
- "import": "./dist/table.esm.js",
80
- "require": "./dist/table.cjs.js"
81
- },
82
- "./tooltip": {
83
- "types": "./dist/tooltip.d.ts",
84
- "import": "./dist/tooltip.esm.js",
85
- "require": "./dist/tooltip.cjs.js"
86
- },
87
- "./package.json": "./package.json"
88
- },
89
- "scripts": {
90
- "dev": "tsup --watch",
91
- "build": "tsup"
13
+ "./alert": {
14
+ "types": "./src/alert.tsx",
15
+ "import": "./src/alert.tsx"
16
+ },
17
+ "./breadcrumb": {
18
+ "types": "./src/breadcrumb.tsx",
19
+ "import": "./src/breadcrumb.tsx"
20
+ },
21
+ "./button": {
22
+ "types": "./src/button.tsx",
23
+ "import": "./src/button.tsx"
24
+ },
25
+ "./command": {
26
+ "types": "./src/command.tsx",
27
+ "import": "./src/command.tsx"
28
+ },
29
+ "./dialog": {
30
+ "types": "./src/dialog.tsx",
31
+ "import": "./src/dialog.tsx"
32
+ },
33
+ "./hooks/use-mobile": {
34
+ "types": "./src/hooks/use-mobile.tsx",
35
+ "import": "./src/hooks/use-mobile.tsx"
36
+ },
37
+ "./input": {
38
+ "types": "./src/input.tsx",
39
+ "import": "./src/input.tsx"
40
+ },
41
+ "./popover": {
42
+ "types": "./src/popover.tsx",
43
+ "import": "./src/popover.tsx"
44
+ },
45
+ "./select": {
46
+ "types": "./src/select.tsx",
47
+ "import": "./src/select.tsx"
48
+ },
49
+ "./separator": {
50
+ "types": "./src/separator.tsx",
51
+ "import": "./src/separator.tsx"
52
+ },
53
+ "./sheet": {
54
+ "types": "./src/sheet.tsx",
55
+ "import": "./src/sheet.tsx"
56
+ },
57
+ "./sidebar": {
58
+ "types": "./src/sidebar.tsx",
59
+ "import": "./src/sidebar.tsx"
60
+ },
61
+ "./skeleton": {
62
+ "types": "./src/skeleton.tsx",
63
+ "import": "./src/skeleton.tsx"
64
+ },
65
+ "./table": {
66
+ "types": "./src/table.tsx",
67
+ "import": "./src/table.tsx"
68
+ },
69
+ "./tooltip": {
70
+ "types": "./src/tooltip.tsx",
71
+ "import": "./src/tooltip.tsx"
72
+ }
92
73
  },
93
74
  "devDependencies": {
94
- "@c-rex/eslint-config": "*",
95
- "@c-rex/typescript-config": "*",
96
- "@turbo/gen": "^2.4.4",
97
- "@types/node": "^22.13.10",
98
- "@types/react": "19.0.10",
99
- "@types/react-dom": "19.0.4",
100
- "eslint": "^9.23.0",
101
- "shadcn": "^2.4.1",
102
- "typescript": "latest"
75
+ "@c-rex/eslint-config": "*",
76
+ "@c-rex/typescript-config": "*",
77
+ "@turbo/gen": "^2.4.4",
78
+ "@types/node": "^22.13.10",
79
+ "@types/react": "19.0.10",
80
+ "@types/react-dom": "19.0.4",
81
+ "eslint": "^9.23.0",
82
+ "shadcn": "^2.4.1",
83
+ "typescript": "latest"
103
84
  },
104
85
  "dependencies": {
105
- "@c-rex/utils": "*",
106
- "@radix-ui/react-dialog": "^1.1.6",
107
- "@radix-ui/react-popover": "^1.1.6",
108
- "@radix-ui/react-select": "^2.1.6",
109
- "@radix-ui/react-separator": "^1.1.2",
110
- "@radix-ui/react-tooltip": "^1.1.8",
111
- "class-variance-authority": "^0.7.1",
112
- "clsx": "^2.1.1",
113
- "cmdk": "^1.1.1",
114
- "lucide-react": "^0.486.0",
115
- "react": "^18.3.1",
116
- "react-dom": "^18.3.1",
117
- "tailwind-merge": "^3.0.2"
86
+ "@c-rex/utils": "*",
87
+ "@radix-ui/react-dialog": "^1.1.6",
88
+ "@radix-ui/react-popover": "^1.1.6",
89
+ "@radix-ui/react-select": "^2.1.6",
90
+ "@radix-ui/react-separator": "^1.1.2",
91
+ "@radix-ui/react-tooltip": "^1.1.8",
92
+ "class-variance-authority": "^0.7.1",
93
+ "clsx": "^2.1.1",
94
+ "cmdk": "^1.1.1",
95
+ "lucide-react": "^0.486.0",
96
+ "react": "^18.3.1",
97
+ "react-dom": "^18.3.1",
98
+ "tailwind-merge": "^3.0.2"
118
99
  }
119
- }
120
-
100
+ }
package/src/alert.tsx ADDED
@@ -0,0 +1,58 @@
1
+ import * as React from "react";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+ import { cn } from "@c-rex/utils";
4
+
5
+ const alertVariants = cva(
6
+ "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",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-background text-foreground",
11
+ destructive:
12
+ "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ variant: "default",
17
+ },
18
+ },
19
+ );
20
+
21
+ const Alert = React.forwardRef<
22
+ HTMLDivElement,
23
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
24
+ >(({ className, variant, ...props }, ref) => (
25
+ <div
26
+ ref={ref}
27
+ role="alert"
28
+ className={cn(alertVariants({ variant }), className)}
29
+ {...props}
30
+ />
31
+ ));
32
+ Alert.displayName = "Alert";
33
+
34
+ const AlertTitle = React.forwardRef<
35
+ HTMLParagraphElement,
36
+ React.HTMLAttributes<HTMLHeadingElement>
37
+ >(({ className, ...props }, ref) => (
38
+ <h5
39
+ ref={ref}
40
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
41
+ {...props}
42
+ />
43
+ ));
44
+ AlertTitle.displayName = "AlertTitle";
45
+
46
+ const AlertDescription = React.forwardRef<
47
+ HTMLParagraphElement,
48
+ React.HTMLAttributes<HTMLParagraphElement>
49
+ >(({ className, ...props }, ref) => (
50
+ <div
51
+ ref={ref}
52
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
53
+ {...props}
54
+ />
55
+ ));
56
+ AlertDescription.displayName = "AlertDescription";
57
+
58
+ export { Alert, AlertTitle, AlertDescription };
@@ -0,0 +1,115 @@
1
+ import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { ChevronRight, MoreHorizontal } from "lucide-react";
4
+
5
+ import { cn } from "@c-rex/utils";
6
+
7
+ const Breadcrumb = React.forwardRef<
8
+ HTMLElement,
9
+ React.ComponentPropsWithoutRef<"nav"> & {
10
+ separator?: React.ReactNode;
11
+ }
12
+ >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
13
+ Breadcrumb.displayName = "Breadcrumb";
14
+
15
+ const BreadcrumbList = React.forwardRef<
16
+ HTMLOListElement,
17
+ React.ComponentPropsWithoutRef<"ol">
18
+ >(({ className, ...props }, ref) => (
19
+ <ol
20
+ ref={ref}
21
+ className={cn(
22
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
23
+ className,
24
+ )}
25
+ {...props}
26
+ />
27
+ ));
28
+ BreadcrumbList.displayName = "BreadcrumbList";
29
+
30
+ const BreadcrumbItem = React.forwardRef<
31
+ HTMLLIElement,
32
+ React.ComponentPropsWithoutRef<"li">
33
+ >(({ className, ...props }, ref) => (
34
+ <li
35
+ ref={ref}
36
+ className={cn("inline-flex items-center gap-1.5", className)}
37
+ {...props}
38
+ />
39
+ ));
40
+ BreadcrumbItem.displayName = "BreadcrumbItem";
41
+
42
+ const BreadcrumbLink = React.forwardRef<
43
+ HTMLAnchorElement,
44
+ React.ComponentPropsWithoutRef<"a"> & {
45
+ asChild?: boolean;
46
+ }
47
+ >(({ asChild, className, ...props }, ref) => {
48
+ const Comp = asChild ? Slot : "a";
49
+
50
+ return (
51
+ <Comp
52
+ ref={ref}
53
+ className={cn("transition-colors hover:text-foreground", className)}
54
+ {...props}
55
+ />
56
+ );
57
+ });
58
+ BreadcrumbLink.displayName = "BreadcrumbLink";
59
+
60
+ const BreadcrumbPage = React.forwardRef<
61
+ HTMLSpanElement,
62
+ React.ComponentPropsWithoutRef<"span">
63
+ >(({ className, ...props }, ref) => (
64
+ <span
65
+ ref={ref}
66
+ role="link"
67
+ aria-disabled="true"
68
+ aria-current="page"
69
+ className={cn("font-normal text-foreground", className)}
70
+ {...props}
71
+ />
72
+ ));
73
+ BreadcrumbPage.displayName = "BreadcrumbPage";
74
+
75
+ const BreadcrumbSeparator = ({
76
+ children,
77
+ className,
78
+ ...props
79
+ }: React.ComponentProps<"li">) => (
80
+ <li
81
+ role="presentation"
82
+ aria-hidden="true"
83
+ className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
84
+ {...props}
85
+ >
86
+ {children ?? <ChevronRight />}
87
+ </li>
88
+ );
89
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
90
+
91
+ const BreadcrumbEllipsis = ({
92
+ className,
93
+ ...props
94
+ }: React.ComponentProps<"span">) => (
95
+ <span
96
+ role="presentation"
97
+ aria-hidden="true"
98
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
99
+ {...props}
100
+ >
101
+ <MoreHorizontal className="h-4 w-4" />
102
+ <span className="sr-only">More</span>
103
+ </span>
104
+ );
105
+ BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
106
+
107
+ export {
108
+ Breadcrumb,
109
+ BreadcrumbList,
110
+ BreadcrumbItem,
111
+ BreadcrumbLink,
112
+ BreadcrumbPage,
113
+ BreadcrumbSeparator,
114
+ BreadcrumbEllipsis,
115
+ };
package/src/button.tsx ADDED
@@ -0,0 +1,66 @@
1
+ import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+
5
+ import { cn } from "@c-rex/utils";
6
+
7
+ const buttonVariants = cva(
8
+ "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",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default:
13
+ "bg-primary text-primary-foreground shadow hover:bg-primary/90",
14
+ destructive:
15
+ "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
16
+ outline:
17
+ "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
18
+ secondary:
19
+ "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
20
+ ghost: "hover:bg-accent hover:text-accent-foreground",
21
+ link: "text-primary underline-offset-4 hover:underline",
22
+ },
23
+ size: {
24
+ default: "h-9 px-4 py-2",
25
+ sm: "h-8 rounded-md px-3 text-xs",
26
+ lg: "h-10 rounded-md px-8",
27
+ icon: "h-9 w-9",
28
+ },
29
+ rounded: {
30
+ default: "rounded-md",
31
+ sm: "rounded-sm",
32
+ lg: "rounded-lg",
33
+ xl: "rounded-xl",
34
+ "2xl": "rounded-2xl",
35
+ full: "rounded-full",
36
+ },
37
+ },
38
+ defaultVariants: {
39
+ variant: "default",
40
+ size: "default",
41
+ rounded: "default",
42
+ },
43
+ },
44
+ );
45
+
46
+ export interface ButtonProps
47
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
48
+ VariantProps<typeof buttonVariants> {
49
+ asChild?: boolean;
50
+ }
51
+
52
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
53
+ ({ className, variant, size, rounded, asChild = false, ...props }, ref) => {
54
+ const Comp = asChild ? Slot : "button";
55
+ return (
56
+ <Comp
57
+ className={cn(buttonVariants({ variant, size, rounded, className }))}
58
+ ref={ref}
59
+ {...props}
60
+ />
61
+ );
62
+ },
63
+ );
64
+ Button.displayName = "Button";
65
+
66
+ export { Button, buttonVariants };
@@ -0,0 +1,151 @@
1
+ import * as React from "react";
2
+ import { type DialogProps } from "@radix-ui/react-dialog";
3
+ import { Command as CommandPrimitive } from "cmdk";
4
+ import { Search } from "lucide-react";
5
+
6
+ import { cn } from "@c-rex/utils";
7
+ import { Dialog, DialogContent } from "./dialog";
8
+
9
+ const Command = React.forwardRef<
10
+ React.ElementRef<typeof CommandPrimitive>,
11
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
12
+ >(({ className, ...props }, ref) => (
13
+ <CommandPrimitive
14
+ ref={ref}
15
+ className={cn(
16
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
17
+ className,
18
+ )}
19
+ {...props}
20
+ />
21
+ ));
22
+ Command.displayName = CommandPrimitive.displayName;
23
+
24
+ const CommandDialog = ({ children, ...props }: DialogProps) => {
25
+ return (
26
+ <Dialog {...props}>
27
+ <DialogContent className="overflow-hidden p-0">
28
+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
29
+ {children}
30
+ </Command>
31
+ </DialogContent>
32
+ </Dialog>
33
+ );
34
+ };
35
+
36
+ const CommandInput = React.forwardRef<
37
+ React.ElementRef<typeof CommandPrimitive.Input>,
38
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
39
+ >(({ className, ...props }, ref) => (
40
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
41
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
42
+ <CommandPrimitive.Input
43
+ ref={ref}
44
+ className={cn(
45
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
46
+ className,
47
+ )}
48
+ {...props}
49
+ />
50
+ </div>
51
+ ));
52
+
53
+ CommandInput.displayName = CommandPrimitive.Input.displayName;
54
+
55
+ const CommandList = React.forwardRef<
56
+ React.ElementRef<typeof CommandPrimitive.List>,
57
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
58
+ >(({ className, ...props }, ref) => (
59
+ <CommandPrimitive.List
60
+ ref={ref}
61
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
62
+ {...props}
63
+ />
64
+ ));
65
+
66
+ CommandList.displayName = CommandPrimitive.List.displayName;
67
+
68
+ const CommandEmpty = React.forwardRef<
69
+ React.ElementRef<typeof CommandPrimitive.Empty>,
70
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
71
+ >((props, ref) => (
72
+ <CommandPrimitive.Empty
73
+ ref={ref}
74
+ className="py-6 text-center text-sm"
75
+ {...props}
76
+ />
77
+ ));
78
+
79
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
80
+
81
+ const CommandGroup = React.forwardRef<
82
+ React.ElementRef<typeof CommandPrimitive.Group>,
83
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
84
+ >(({ className, ...props }, ref) => (
85
+ <CommandPrimitive.Group
86
+ ref={ref}
87
+ className={cn(
88
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
89
+ className,
90
+ )}
91
+ {...props}
92
+ />
93
+ ));
94
+
95
+ CommandGroup.displayName = CommandPrimitive.Group.displayName;
96
+
97
+ const CommandSeparator = React.forwardRef<
98
+ React.ElementRef<typeof CommandPrimitive.Separator>,
99
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
100
+ >(({ className, ...props }, ref) => (
101
+ <CommandPrimitive.Separator
102
+ ref={ref}
103
+ className={cn("-mx-1 h-px bg-border", className)}
104
+ {...props}
105
+ />
106
+ ));
107
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
108
+
109
+ const CommandItem = React.forwardRef<
110
+ React.ElementRef<typeof CommandPrimitive.Item>,
111
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
112
+ >(({ className, ...props }, ref) => (
113
+ <CommandPrimitive.Item
114
+ ref={ref}
115
+ className={cn(
116
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
117
+ className,
118
+ )}
119
+ {...props}
120
+ />
121
+ ));
122
+
123
+ CommandItem.displayName = CommandPrimitive.Item.displayName;
124
+
125
+ const CommandShortcut = ({
126
+ className,
127
+ ...props
128
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
129
+ return (
130
+ <span
131
+ className={cn(
132
+ "ml-auto text-xs tracking-widest text-muted-foreground",
133
+ className,
134
+ )}
135
+ {...props}
136
+ />
137
+ );
138
+ };
139
+ CommandShortcut.displayName = "CommandShortcut";
140
+
141
+ export {
142
+ Command,
143
+ CommandDialog,
144
+ CommandInput,
145
+ CommandList,
146
+ CommandEmpty,
147
+ CommandGroup,
148
+ CommandItem,
149
+ CommandShortcut,
150
+ CommandSeparator,
151
+ };