@c-rex/ui 0.1.1 → 0.1.2

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.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src"
@@ -85,6 +85,14 @@
85
85
  "./checkbox": {
86
86
  "types": "./src/checkbox.tsx",
87
87
  "import": "./src/checkbox.tsx"
88
+ },
89
+ "./sonner": {
90
+ "types": "./src/sonner.tsx",
91
+ "import": "./src/sonner.tsx"
92
+ },
93
+ "./pagination": {
94
+ "types": "./src/pagination.tsx",
95
+ "import": "./src/pagination.tsx"
88
96
  }
89
97
  },
90
98
  "scripts": {
@@ -112,6 +120,7 @@
112
120
  "@radix-ui/react-popover": "^1.1.6",
113
121
  "@radix-ui/react-select": "^2.1.6",
114
122
  "@radix-ui/react-separator": "^1.1.2",
123
+ "@radix-ui/react-slot": "^1.2.3",
115
124
  "@radix-ui/react-tooltip": "^1.1.8",
116
125
  "class-variance-authority": "^0.7.1",
117
126
  "clsx": "^2.1.1",
@@ -119,6 +128,7 @@
119
128
  "lucide-react": "^0.486.0",
120
129
  "react": "^18.3.1",
121
130
  "react-dom": "^18.3.1",
131
+ "sonner": "^2.0.5",
122
132
  "tailwind-merge": "^3.3.0",
123
133
  "tw-animate-css": "^1.2.9"
124
134
  }
@@ -79,7 +79,6 @@ const BreadcrumbSeparator = ({
79
79
  }: React.ComponentProps<"li">) => (
80
80
  <li
81
81
  role="presentation"
82
- aria-hidden="true"
83
82
  className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
84
83
  {...props}
85
84
  >
@@ -94,7 +93,6 @@ const BreadcrumbEllipsis = ({
94
93
  }: React.ComponentProps<"span">) => (
95
94
  <span
96
95
  role="presentation"
97
- aria-hidden="true"
98
96
  className={cn("flex h-9 w-9 items-center justify-center", className)}
99
97
  {...props}
100
98
  >
package/src/checkbox.tsx CHANGED
@@ -5,26 +5,26 @@ import { CheckIcon } from "lucide-react"
5
5
  import { cn } from "@c-rex/utils"
6
6
 
7
7
  function Checkbox({
8
- className,
9
- ...props
8
+ className,
9
+ ...props
10
10
  }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
11
- return (
12
- <CheckboxPrimitive.Root
13
- data-slot="checkbox"
14
- className={cn(
15
- "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
16
- className
17
- )}
18
- {...props}
19
- >
20
- <CheckboxPrimitive.Indicator
21
- data-slot="checkbox-indicator"
22
- className="flex items-center justify-center text-current transition-none"
23
- >
24
- <CheckIcon className="size-3.5" />
25
- </CheckboxPrimitive.Indicator>
26
- </CheckboxPrimitive.Root>
27
- )
11
+ return (
12
+ <CheckboxPrimitive.Root
13
+ data-slot="checkbox"
14
+ className={cn(
15
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <CheckboxPrimitive.Indicator
21
+ data-slot="checkbox-indicator"
22
+ className="flex items-center justify-center text-current transition-none"
23
+ >
24
+ <CheckIcon className="size-3.5" />
25
+ </CheckboxPrimitive.Indicator>
26
+ </CheckboxPrimitive.Root>
27
+ )
28
28
  }
29
29
 
30
30
  export { Checkbox }
@@ -5,251 +5,251 @@ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
5
5
  import { cn } from "@c-rex/utils"
6
6
 
7
7
  function DropdownMenu({
8
- ...props
8
+ ...props
9
9
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
10
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
10
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" modal={false} {...props} />
11
11
  }
12
12
 
13
13
  function DropdownMenuPortal({
14
- ...props
14
+ ...props
15
15
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
16
- return (
17
- <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
18
- )
16
+ return (
17
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
18
+ )
19
19
  }
20
20
 
21
21
  function DropdownMenuTrigger({
22
- ...props
22
+ ...props
23
23
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
24
- return (
25
- <DropdownMenuPrimitive.Trigger
26
- data-slot="dropdown-menu-trigger"
27
- {...props}
28
- />
29
- )
24
+ return (
25
+ <DropdownMenuPrimitive.Trigger
26
+ data-slot="dropdown-menu-trigger"
27
+ {...props}
28
+ />
29
+ )
30
30
  }
31
31
 
32
32
  function DropdownMenuContent({
33
- className,
34
- sideOffset = 4,
35
- ...props
33
+ className,
34
+ sideOffset = 4,
35
+ ...props
36
36
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
37
- return (
38
- <DropdownMenuPrimitive.Portal>
39
- <DropdownMenuPrimitive.Content
40
- data-slot="dropdown-menu-content"
41
- sideOffset={sideOffset}
42
- className={cn(
43
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
44
- className
45
- )}
46
- {...props}
47
- />
48
- </DropdownMenuPrimitive.Portal>
49
- )
37
+ return (
38
+ <DropdownMenuPrimitive.Portal>
39
+ <DropdownMenuPrimitive.Content
40
+ data-slot="dropdown-menu-content"
41
+ sideOffset={sideOffset}
42
+ className={cn(
43
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
44
+ className
45
+ )}
46
+ {...props}
47
+ />
48
+ </DropdownMenuPrimitive.Portal>
49
+ )
50
50
  }
51
51
 
52
52
  function DropdownMenuGroup({
53
- ...props
53
+ ...props
54
54
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
55
- return (
56
- <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
57
- )
55
+ return (
56
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
57
+ )
58
58
  }
59
59
 
60
60
  function DropdownMenuItem({
61
- className,
62
- inset,
63
- variant = "default",
64
- ...props
61
+ className,
62
+ inset,
63
+ variant = "default",
64
+ ...props
65
65
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
66
- inset?: boolean
67
- variant?: "default" | "destructive"
66
+ inset?: boolean
67
+ variant?: "default" | "destructive"
68
68
  }) {
69
- return (
70
- <DropdownMenuPrimitive.Item
71
- data-slot="dropdown-menu-item"
72
- data-inset={inset}
73
- data-variant={variant}
74
- className={cn(
75
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
76
- className
77
- )}
78
- {...props}
79
- />
80
- )
69
+ return (
70
+ <DropdownMenuPrimitive.Item
71
+ data-slot="dropdown-menu-item"
72
+ data-inset={inset}
73
+ data-variant={variant}
74
+ className={cn(
75
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
76
+ className
77
+ )}
78
+ {...props}
79
+ />
80
+ )
81
81
  }
82
82
 
83
83
  function DropdownMenuCheckboxItem({
84
- className,
85
- children,
86
- checked,
87
- ...props
84
+ className,
85
+ children,
86
+ checked,
87
+ ...props
88
88
  }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
89
- return (
90
- <DropdownMenuPrimitive.CheckboxItem
91
- data-slot="dropdown-menu-checkbox-item"
92
- className={cn(
93
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
94
- className
95
- )}
96
- checked={checked}
97
- {...props}
98
- >
99
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
100
- <DropdownMenuPrimitive.ItemIndicator>
101
- <CheckIcon className="size-4" />
102
- </DropdownMenuPrimitive.ItemIndicator>
103
- </span>
104
- {children}
105
- </DropdownMenuPrimitive.CheckboxItem>
106
- )
89
+ return (
90
+ <DropdownMenuPrimitive.CheckboxItem
91
+ data-slot="dropdown-menu-checkbox-item"
92
+ className={cn(
93
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
94
+ className
95
+ )}
96
+ checked={checked}
97
+ {...props}
98
+ >
99
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
100
+ <DropdownMenuPrimitive.ItemIndicator>
101
+ <CheckIcon className="size-4" />
102
+ </DropdownMenuPrimitive.ItemIndicator>
103
+ </span>
104
+ {children}
105
+ </DropdownMenuPrimitive.CheckboxItem>
106
+ )
107
107
  }
108
108
 
109
109
  function DropdownMenuRadioGroup({
110
- ...props
110
+ ...props
111
111
  }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
112
- return (
113
- <DropdownMenuPrimitive.RadioGroup
114
- data-slot="dropdown-menu-radio-group"
115
- {...props}
116
- />
117
- )
112
+ return (
113
+ <DropdownMenuPrimitive.RadioGroup
114
+ data-slot="dropdown-menu-radio-group"
115
+ {...props}
116
+ />
117
+ )
118
118
  }
119
119
 
120
120
  function DropdownMenuRadioItem({
121
- className,
122
- children,
123
- ...props
121
+ className,
122
+ children,
123
+ ...props
124
124
  }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
125
- return (
126
- <DropdownMenuPrimitive.RadioItem
127
- data-slot="dropdown-menu-radio-item"
128
- className={cn(
129
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
130
- className
131
- )}
132
- {...props}
133
- >
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}
140
- </DropdownMenuPrimitive.RadioItem>
141
- )
125
+ return (
126
+ <DropdownMenuPrimitive.RadioItem
127
+ data-slot="dropdown-menu-radio-item"
128
+ className={cn(
129
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
130
+ className
131
+ )}
132
+ {...props}
133
+ >
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}
140
+ </DropdownMenuPrimitive.RadioItem>
141
+ )
142
142
  }
143
143
 
144
144
  function DropdownMenuLabel({
145
- className,
146
- inset,
147
- ...props
145
+ className,
146
+ inset,
147
+ ...props
148
148
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
149
- inset?: boolean
149
+ inset?: boolean
150
150
  }) {
151
- return (
152
- <DropdownMenuPrimitive.Label
153
- data-slot="dropdown-menu-label"
154
- data-inset={inset}
155
- className={cn(
156
- "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
157
- className
158
- )}
159
- {...props}
160
- />
161
- )
151
+ return (
152
+ <DropdownMenuPrimitive.Label
153
+ data-slot="dropdown-menu-label"
154
+ data-inset={inset}
155
+ className={cn(
156
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
157
+ className
158
+ )}
159
+ {...props}
160
+ />
161
+ )
162
162
  }
163
163
 
164
164
  function DropdownMenuSeparator({
165
- className,
166
- ...props
165
+ className,
166
+ ...props
167
167
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
168
- return (
169
- <DropdownMenuPrimitive.Separator
170
- data-slot="dropdown-menu-separator"
171
- className={cn("bg-border -mx-1 my-1 h-px", className)}
172
- {...props}
173
- />
174
- )
168
+ return (
169
+ <DropdownMenuPrimitive.Separator
170
+ data-slot="dropdown-menu-separator"
171
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
172
+ {...props}
173
+ />
174
+ )
175
175
  }
176
176
 
177
177
  function DropdownMenuShortcut({
178
- className,
179
- ...props
178
+ className,
179
+ ...props
180
180
  }: React.ComponentProps<"span">) {
181
- return (
182
- <span
183
- data-slot="dropdown-menu-shortcut"
184
- className={cn(
185
- "text-muted-foreground ml-auto text-xs tracking-widest",
186
- className
187
- )}
188
- {...props}
189
- />
190
- )
181
+ return (
182
+ <span
183
+ data-slot="dropdown-menu-shortcut"
184
+ className={cn(
185
+ "text-muted-foreground ml-auto text-xs tracking-widest",
186
+ className
187
+ )}
188
+ {...props}
189
+ />
190
+ )
191
191
  }
192
192
 
193
193
  function DropdownMenuSub({
194
- ...props
194
+ ...props
195
195
  }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
196
- return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
196
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
197
197
  }
198
198
 
199
199
  function DropdownMenuSubTrigger({
200
- className,
201
- inset,
202
- children,
203
- ...props
200
+ className,
201
+ inset,
202
+ children,
203
+ ...props
204
204
  }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
205
- inset?: boolean
205
+ inset?: boolean
206
206
  }) {
207
- return (
208
- <DropdownMenuPrimitive.SubTrigger
209
- data-slot="dropdown-menu-sub-trigger"
210
- data-inset={inset}
211
- className={cn(
212
- "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
213
- className
214
- )}
215
- {...props}
216
- >
217
- {children}
218
- <ChevronRightIcon className="ml-auto size-4" />
219
- </DropdownMenuPrimitive.SubTrigger>
220
- )
207
+ return (
208
+ <DropdownMenuPrimitive.SubTrigger
209
+ data-slot="dropdown-menu-sub-trigger"
210
+ data-inset={inset}
211
+ className={cn(
212
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
213
+ className
214
+ )}
215
+ {...props}
216
+ >
217
+ {children}
218
+ <ChevronRightIcon className="ml-auto size-4" />
219
+ </DropdownMenuPrimitive.SubTrigger>
220
+ )
221
221
  }
222
222
 
223
223
  function DropdownMenuSubContent({
224
- className,
225
- ...props
224
+ className,
225
+ ...props
226
226
  }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
227
- return (
228
- <DropdownMenuPrimitive.SubContent
229
- data-slot="dropdown-menu-sub-content"
230
- className={cn(
231
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
232
- className
233
- )}
234
- {...props}
235
- />
236
- )
227
+ return (
228
+ <DropdownMenuPrimitive.SubContent
229
+ data-slot="dropdown-menu-sub-content"
230
+ className={cn(
231
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
232
+ className
233
+ )}
234
+ {...props}
235
+ />
236
+ )
237
237
  }
238
238
 
239
239
  export {
240
- DropdownMenu,
241
- DropdownMenuPortal,
242
- DropdownMenuTrigger,
243
- DropdownMenuContent,
244
- DropdownMenuGroup,
245
- DropdownMenuLabel,
246
- DropdownMenuItem,
247
- DropdownMenuCheckboxItem,
248
- DropdownMenuRadioGroup,
249
- DropdownMenuRadioItem,
250
- DropdownMenuSeparator,
251
- DropdownMenuShortcut,
252
- DropdownMenuSub,
253
- DropdownMenuSubTrigger,
254
- DropdownMenuSubContent,
240
+ DropdownMenu,
241
+ DropdownMenuPortal,
242
+ DropdownMenuTrigger,
243
+ DropdownMenuContent,
244
+ DropdownMenuGroup,
245
+ DropdownMenuLabel,
246
+ DropdownMenuItem,
247
+ DropdownMenuCheckboxItem,
248
+ DropdownMenuRadioGroup,
249
+ DropdownMenuRadioItem,
250
+ DropdownMenuSeparator,
251
+ DropdownMenuShortcut,
252
+ DropdownMenuSub,
253
+ DropdownMenuSubTrigger,
254
+ DropdownMenuSubContent,
255
255
  }
package/src/input.tsx CHANGED
@@ -1,16 +1,39 @@
1
1
  import * as React from "react";
2
-
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
3
  import { cn } from "@c-rex/utils";
4
4
 
5
- const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
6
- ({ className, type, ...props }, ref) => {
5
+
6
+ const inputVariants = cva(
7
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base transition-colors placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
12
+ file: "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
13
+ embedded: "border-0 outline-none focus:border-0 focus:outline-none focus:ring20",
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ }
19
+ }
20
+ )
21
+
22
+ interface InputProps
23
+ extends React.ComponentProps<"input">,
24
+ VariantProps<typeof inputVariants> {
25
+ asChild?: boolean;
26
+ }
27
+
28
+ const Input = React.forwardRef<HTMLInputElement, InputProps>(
29
+ ({ className, type, variant, ...props }, ref) => {
30
+
31
+
32
+
7
33
  return (
8
34
  <input
9
35
  type={type}
10
- className={cn(
11
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
- className,
13
- )}
36
+ className={cn(inputVariants({ variant, className }))}
14
37
  ref={ref}
15
38
  {...props}
16
39
  />
@@ -0,0 +1,124 @@
1
+ import * as React from "react"
2
+ import {
3
+ ChevronLeftIcon,
4
+ ChevronRightIcon,
5
+ MoreHorizontalIcon,
6
+ } from "lucide-react"
7
+
8
+ import { cn } from "@c-rex/utils"
9
+ import { Button, buttonVariants } from "./button"
10
+
11
+ function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
12
+ return (
13
+ <nav
14
+ role="navigation"
15
+ aria-label="pagination"
16
+ data-slot="pagination"
17
+ className={cn("mx-auto flex w-full justify-center", className)}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ function PaginationContent({
24
+ className,
25
+ ...props
26
+ }: React.ComponentProps<"ul">) {
27
+ return (
28
+ <ul
29
+ data-slot="pagination-content"
30
+ className={cn("flex flex-row items-center gap-1", className)}
31
+ {...props}
32
+ />
33
+ )
34
+ }
35
+
36
+ function PaginationItem({ ...props }: React.ComponentProps<"li">) {
37
+ return <li data-slot="pagination-item" {...props} />
38
+ }
39
+
40
+ type PaginationLinkProps = {
41
+ isActive?: boolean
42
+ } & Pick<React.ComponentProps<typeof Button>, "size"> &
43
+ React.ComponentProps<"a">
44
+
45
+ function PaginationLink({
46
+ className,
47
+ isActive,
48
+ size = "icon",
49
+ ...props
50
+ }: PaginationLinkProps) {
51
+ return (
52
+ <a
53
+ aria-current={isActive ? "page" : undefined}
54
+ data-slot="pagination-link"
55
+ data-active={isActive}
56
+ className={cn(
57
+ buttonVariants({
58
+ variant: isActive ? "outline" : "ghost",
59
+ size,
60
+ }),
61
+ className
62
+ )}
63
+ {...props}
64
+ />
65
+ )
66
+ }
67
+
68
+ function PaginationPrevious({
69
+ className,
70
+ ...props
71
+ }: React.ComponentProps<typeof PaginationLink>) {
72
+ return (
73
+ <PaginationLink
74
+ aria-label="Go to previous page"
75
+ size="default"
76
+ className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
77
+ {...props}
78
+ >
79
+ <ChevronLeftIcon />
80
+ </PaginationLink>
81
+ )
82
+ }
83
+
84
+ function PaginationNext({
85
+ className,
86
+ ...props
87
+ }: React.ComponentProps<typeof PaginationLink>) {
88
+ return (
89
+ <PaginationLink
90
+ aria-label="Go to next page"
91
+ size="default"
92
+ className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
93
+ {...props}
94
+ >
95
+ <ChevronRightIcon />
96
+ </PaginationLink>
97
+ )
98
+ }
99
+
100
+ function PaginationEllipsis({
101
+ className,
102
+ ...props
103
+ }: React.ComponentProps<"span">) {
104
+ return (
105
+ <span
106
+ data-slot="pagination-ellipsis"
107
+ className={cn("flex size-9 items-center justify-center", className)}
108
+ {...props}
109
+ >
110
+ <MoreHorizontalIcon className="size-4" />
111
+ <span className="sr-only">More pages</span>
112
+ </span>
113
+ )
114
+ }
115
+
116
+ export {
117
+ Pagination,
118
+ PaginationContent,
119
+ PaginationLink,
120
+ PaginationItem,
121
+ PaginationPrevious,
122
+ PaginationNext,
123
+ PaginationEllipsis,
124
+ }
package/src/sidebar.tsx CHANGED
@@ -390,7 +390,7 @@ const SidebarFooter = React.forwardRef<
390
390
  <div
391
391
  ref={ref}
392
392
  data-sidebar="footer"
393
- className={cn("flex flex-col gap-2 p-2", className)}
393
+ className={cn("flex flex-col p-2", className)}
394
394
  {...props}
395
395
  />
396
396
  );
package/src/sonner.tsx ADDED
@@ -0,0 +1,10 @@
1
+ import { Toaster as Sonner, ToasterProps } from "sonner"
2
+
3
+ const Toaster = ({ ...props }: ToasterProps) => {
4
+
5
+ return (
6
+ <Sonner {...props} />
7
+ )
8
+ }
9
+
10
+ export { Toaster }