@c-rex/ui 0.1.4 → 0.1.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-rex/ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -117,6 +117,10 @@
117
117
  "./context-menu": {
118
118
  "types": "./src/context-menu.tsx",
119
119
  "import": "./src/context-menu.tsx"
120
+ },
121
+ "./badge": {
122
+ "types": "./src/badge.tsx",
123
+ "import": "./src/badge.tsx"
120
124
  }
121
125
  },
122
126
  "scripts": {
package/src/badge.tsx ADDED
@@ -0,0 +1,46 @@
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 badgeVariants = cva(
8
+ "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default:
13
+ "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
14
+ secondary:
15
+ "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
16
+ destructive:
17
+ "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
18
+ outline:
19
+ "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ },
25
+ }
26
+ )
27
+
28
+ function Badge({
29
+ className,
30
+ variant,
31
+ asChild = false,
32
+ ...props
33
+ }: React.ComponentProps<"span"> &
34
+ VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
35
+ const Comp = asChild ? Slot : "span"
36
+
37
+ return (
38
+ <Comp
39
+ data-slot="badge"
40
+ className={cn(badgeVariants({ variant }), className)}
41
+ {...props}
42
+ />
43
+ )
44
+ }
45
+
46
+ export { Badge, badgeVariants }
package/src/button.tsx CHANGED
@@ -12,7 +12,7 @@ const buttonVariants = cva(
12
12
  default:
13
13
  "bg-primary text-primary-foreground shadow hover:bg-primary/90",
14
14
  destructive:
15
- "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
15
+ "border border-destructive text-destructive shadow-sm hover:bg-destructive/90 hover:text-destructive-foreground",
16
16
  outline:
17
17
  "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
18
18
  secondary:
@@ -23,6 +23,7 @@ const buttonVariants = cva(
23
23
  size: {
24
24
  default: "h-9 px-4 py-2",
25
25
  sm: "h-8 rounded-md px-3 text-xs",
26
+ xs: "h-5 w-5 rounded text-xs",
26
27
  lg: "h-10 rounded-md px-8",
27
28
  icon: "h-9 w-9",
28
29
  },
package/src/input.tsx CHANGED
@@ -8,7 +8,7 @@ const inputVariants = cva(
8
8
  {
9
9
  variants: {
10
10
  variant: {
11
- default: "shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
11
+ default: "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
12
12
  file: "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
13
13
  embedded: "border-0 outline-none focus:border-0 focus:outline-none focus:ring20",
14
14
  }
package/src/sidebar.tsx CHANGED
@@ -713,7 +713,7 @@ const SidebarMenuSub = React.forwardRef<
713
713
  ref={ref}
714
714
  data-sidebar="menu-sub"
715
715
  className={cn(
716
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
716
+ "ml-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border pl-2.5 py-0.5",
717
717
  "group-data-[collapsible=icon]:hidden",
718
718
  className,
719
719
  )}