@c-rex/ui 0.1.4 → 0.1.6
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 +14 -1
- package/src/badge.tsx +46 -0
- package/src/button.tsx +2 -1
- package/src/card.tsx +92 -0
- package/src/collapsible.tsx +31 -0
- package/src/dropdown-menu.tsx +19 -7
- package/src/input.tsx +1 -1
- package/src/sidebar.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-rex/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src"
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
|
+
"./collapsible": {
|
|
14
|
+
"types": "./src/collapsible.tsx",
|
|
15
|
+
"import": "./src/collapsible.tsx"
|
|
16
|
+
},
|
|
13
17
|
"./alert": {
|
|
14
18
|
"types": "./src/alert.tsx",
|
|
15
19
|
"import": "./src/alert.tsx"
|
|
@@ -117,6 +121,14 @@
|
|
|
117
121
|
"./context-menu": {
|
|
118
122
|
"types": "./src/context-menu.tsx",
|
|
119
123
|
"import": "./src/context-menu.tsx"
|
|
124
|
+
},
|
|
125
|
+
"./badge": {
|
|
126
|
+
"types": "./src/badge.tsx",
|
|
127
|
+
"import": "./src/badge.tsx"
|
|
128
|
+
},
|
|
129
|
+
"./card": {
|
|
130
|
+
"types": "./src/card.tsx",
|
|
131
|
+
"import": "./src/card.tsx"
|
|
120
132
|
}
|
|
121
133
|
},
|
|
122
134
|
"scripts": {
|
|
@@ -138,6 +150,7 @@
|
|
|
138
150
|
"@c-rex/utils": "*",
|
|
139
151
|
"@radix-ui/react-avatar": "^1.1.9",
|
|
140
152
|
"@radix-ui/react-checkbox": "^1.3.2",
|
|
153
|
+
"@radix-ui/react-collapsible": "^1.1.11",
|
|
141
154
|
"@radix-ui/react-context-menu": "^2.2.15",
|
|
142
155
|
"@radix-ui/react-dialog": "^1.1.6",
|
|
143
156
|
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
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
|
-
"
|
|
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/card.tsx
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@c-rex/utils"
|
|
4
|
+
|
|
5
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="card"
|
|
9
|
+
className={cn(
|
|
10
|
+
"bg-card text-card-foreground flex flex-col gap-4 rounded-xl border py-4 shadow-sm",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-slot="card-header"
|
|
22
|
+
className={cn(
|
|
23
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
data-slot="card-title"
|
|
35
|
+
className={cn("leading-none font-semibold", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="card-description"
|
|
45
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
data-slot="card-action"
|
|
55
|
+
className={cn(
|
|
56
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="card-content"
|
|
68
|
+
className={cn("px-4", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="card-footer"
|
|
78
|
+
className={cn("flex items-center px-4 [.border-t]:pt-6", className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Card,
|
|
86
|
+
CardHeader,
|
|
87
|
+
CardFooter,
|
|
88
|
+
CardTitle,
|
|
89
|
+
CardAction,
|
|
90
|
+
CardDescription,
|
|
91
|
+
CardContent,
|
|
92
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
|
2
|
+
|
|
3
|
+
function Collapsible({
|
|
4
|
+
...props
|
|
5
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
6
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function CollapsibleTrigger({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
12
|
+
return (
|
|
13
|
+
<CollapsiblePrimitive.CollapsibleTrigger
|
|
14
|
+
data-slot="collapsible-trigger"
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function CollapsibleContent({
|
|
21
|
+
...props
|
|
22
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
23
|
+
return (
|
|
24
|
+
<CollapsiblePrimitive.CollapsibleContent
|
|
25
|
+
data-slot="collapsible-content"
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
package/src/dropdown-menu.tsx
CHANGED
|
@@ -117,11 +117,15 @@ function DropdownMenuRadioGroup({
|
|
|
117
117
|
)
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
type Props = {
|
|
121
|
+
link?: string
|
|
122
|
+
}
|
|
120
123
|
function DropdownMenuRadioItem({
|
|
121
124
|
className,
|
|
122
125
|
children,
|
|
126
|
+
link,
|
|
123
127
|
...props
|
|
124
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
128
|
+
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & Props) {
|
|
125
129
|
return (
|
|
126
130
|
<DropdownMenuPrimitive.RadioItem
|
|
127
131
|
data-slot="dropdown-menu-radio-item"
|
|
@@ -131,12 +135,20 @@ function DropdownMenuRadioItem({
|
|
|
131
135
|
)}
|
|
132
136
|
{...props}
|
|
133
137
|
>
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
<a
|
|
139
|
+
href={link}
|
|
140
|
+
className="flex-1 flex items-center gap-2"
|
|
141
|
+
aria-label={typeof children === "string" ? children : "Dropdown menu radio item"}
|
|
142
|
+
title={typeof children === "string" ? children : undefined}
|
|
143
|
+
tabIndex={0}
|
|
144
|
+
>
|
|
145
|
+
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
146
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
147
|
+
<CircleIcon className="size-2 fill-current" />
|
|
148
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
149
|
+
</span>
|
|
150
|
+
{children}
|
|
151
|
+
</a>
|
|
140
152
|
</DropdownMenuPrimitive.RadioItem>
|
|
141
153
|
)
|
|
142
154
|
}
|
package/src/input.tsx
CHANGED
|
@@ -8,7 +8,7 @@ const inputVariants = cva(
|
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
default: "
|
|
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
|
-
"
|
|
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
|
)}
|