@c-rex/ui 0.1.5 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-rex/ui",
3
- "version": "0.1.5",
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"
@@ -121,6 +125,10 @@
121
125
  "./badge": {
122
126
  "types": "./src/badge.tsx",
123
127
  "import": "./src/badge.tsx"
128
+ },
129
+ "./card": {
130
+ "types": "./src/card.tsx",
131
+ "import": "./src/card.tsx"
124
132
  }
125
133
  },
126
134
  "scripts": {
@@ -142,6 +150,7 @@
142
150
  "@c-rex/utils": "*",
143
151
  "@radix-ui/react-avatar": "^1.1.9",
144
152
  "@radix-ui/react-checkbox": "^1.3.2",
153
+ "@radix-ui/react-collapsible": "^1.1.11",
145
154
  "@radix-ui/react-context-menu": "^2.2.15",
146
155
  "@radix-ui/react-dialog": "^1.1.6",
147
156
  "@radix-ui/react-dropdown-menu": "^2.1.15",
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 }
@@ -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
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
135
- <DropdownMenuPrimitive.ItemIndicator>
136
- <CircleIcon className="size-2 fill-current" />
137
- </DropdownMenuPrimitive.ItemIndicator>
138
- </span>
139
- {children}
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
  }