Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 80c28e2

Browse files
committed
Refactor UI components
1 parent 58c5fc1 commit 80c28e2

38 files changed

+266
-257
lines changed

.idea/codefixlabs.iml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Update `package.json`
3030
"build": "next build",
3131
"start": "next start",
3232
"lint": "next lint",
33-
+ "clean": "rm -rf .next",
33+
+ "clean": "rm -rf .next && rm -rf node_modules",
3434
+ "db:generate": "prisma generate",
3535
+ "db:push": "prisma db push",
3636
+ "db:studio": "prisma studio",

apps/docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"build": "next build",
77
"build-storybook": "storybook build",
8-
"clean": "rm -rf .next .turbo node_modules",
8+
"clean": "rm -rf .next && rm -rf .turbo && rm -rf node_modules",
99
"dev": "next dev",
1010
"lint": "next lint",
1111
"start": "next start",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"scripts": {
99
"build": "turbo run build",
1010
"changeset": "changeset",
11-
"clean": "turbo run clean && rm -rf .turbo node_modules",
11+
"clean": "turbo run clean && rm -rf .turbo && rm -rf node_modules",
1212
"dev": "turbo run dev",
1313
"dev:packages": "turbo run dev --filter='./packages/*'",
1414
"force:build": "turbo run clean && turbo run build --force",

packages/hooks/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @codefixlabs/hooks
22

3+
## 0.1.34
4+
5+
### Patch Changes
6+
7+
- Refactor UI components
8+
39
## 0.1.33
410

511
### Patch Changes

packages/hooks/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefixlabs/hooks",
3-
"version": "0.1.33",
3+
"version": "0.1.34",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {
@@ -24,7 +24,7 @@
2424
"scripts": {
2525
"build": "tsup",
2626
"check-types": "tsc --noEmit",
27-
"clean": "rm -rf dist .turbo node_modules",
27+
"clean": "rm -rf dist && rm -rf .turbo && rm -rf node_modules",
2828
"dev": "tsup --watch",
2929
"lint": "eslint src/"
3030
},

packages/lib/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @codefixlabs/lib
22

3+
## 0.1.37
4+
5+
### Patch Changes
6+
7+
- Refactor UI components
8+
39
## 0.1.36
410

511
### Patch Changes

packages/lib/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefixlabs/lib",
3-
"version": "0.1.36",
3+
"version": "0.1.37",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {
@@ -24,7 +24,7 @@
2424
"scripts": {
2525
"build": "tsup",
2626
"check-types": "tsc --noEmit",
27-
"clean": "rm -rf dist .turbo node_modules",
27+
"clean": "rm -rf dist && rm -rf .turbo && rm -rf node_modules",
2828
"dev": "tsup --watch",
2929
"lint": "eslint src/"
3030
},

packages/tailwindcss/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @codefixlabs/tailwindcss
22

3+
## 0.1.47
4+
5+
### Patch Changes
6+
7+
- Refactor UI components
8+
39
## 0.1.46
410

511
### Patch Changes

packages/tailwindcss/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefixlabs/tailwindcss",
3-
"version": "0.1.46",
3+
"version": "0.1.47",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {
@@ -24,7 +24,7 @@
2424
"scripts": {
2525
"build": "tsup",
2626
"check-types": "tsc --noEmit",
27-
"clean": "rm -rf dist .turbo node_modules",
27+
"clean": "rm -rf dist && rm -rf .turbo && rm -rf node_modules",
2828
"dev": "tsup --watch",
2929
"lint": "eslint src/"
3030
},

packages/ui/CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @codefixlabs/ui
22

3+
## 0.1.91
4+
5+
### Patch Changes
6+
7+
- Refactor UI components
8+
- Updated dependencies
9+
- @codefixlabs/hooks@0.1.34
10+
- @codefixlabs/lib@0.1.37
11+
312
## 0.1.90
413

514
### Patch Changes

packages/ui/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "@codefixlabs/ui",
3-
"version": "0.1.90",
3+
"version": "0.1.91",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {
77
".": {
88
"import": {
9-
"types": "./dist/index.d.mts",
10-
"default": "./dist/index.mjs"
9+
"default": "./dist/index.mjs",
10+
"types": "./dist/index.d.mts"
1111
},
1212
"require": {
13-
"types": "./dist/index.d.ts",
14-
"default": "./dist/index.js"
13+
"default": "./dist/index.js",
14+
"types": "./dist/index.d.ts"
1515
}
1616
}
1717
},
@@ -24,7 +24,7 @@
2424
"scripts": {
2525
"build": "tsup",
2626
"check-types": "tsc --noEmit",
27-
"clean": "rm -rf dist .turbo node_modules",
27+
"clean": "rm -rf dist && rm -rf .turbo && rm -rf node_modules",
2828
"dev": "tsup --watch",
2929
"lint": "eslint src/"
3030
},

packages/ui/src/react/alert-dialog.tsx

+16-18
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import {
2121
import type { VariantProps } from 'class-variance-authority';
2222
import { cva } from 'class-variance-authority';
2323
import * as React from 'react';
24+
import type { ButtonVariantsProps } from '@/server/button-variants';
2425
import { buttonVariants } from '@/server/button-variants';
2526
import { cn } from '@/server/cn';
26-
import type { ButtonProps } from '@/react/button';
2727

2828
/* -----------------------------------------------------------------------------
2929
* Classes
@@ -46,6 +46,10 @@ const alertDialogContentVariants = cva(
4646
},
4747
);
4848

49+
type AlertDialogContentVariantsProps = VariantProps<
50+
typeof alertDialogContentVariants
51+
>;
52+
4953
/* -----------------------------------------------------------------------------
5054
* Provider: AlertDialogContext
5155
* -------------------------------------------------------------------------- */
@@ -78,7 +82,7 @@ export function AlertDialog({
7882
* -------------------------------------------------------------------------- */
7983

8084
export interface AlertDialogContentProps
81-
extends Omit<VariantProps<typeof alertDialogContentVariants>, 'scrollable'>,
85+
extends Omit<AlertDialogContentVariantsProps, 'scrollable'>,
8286
ContentProps {
8387
classNames?: {
8488
content?: string;
@@ -127,23 +131,20 @@ AlertDialogContent.displayName = Content.displayName;
127131
* Component: AlertDialogAction
128132
* -------------------------------------------------------------------------- */
129133

130-
export interface AlertDialogActionProps extends ActionProps {
131-
variant?: ButtonProps['variant'];
132-
size?: ButtonProps['size'];
133-
shape?: ButtonProps['shape'];
134-
block?: ButtonProps['block'];
135-
}
134+
export interface AlertDialogActionProps
135+
extends ActionProps,
136+
ButtonVariantsProps {}
136137

137138
export const AlertDialogAction = React.forwardRef<
138139
React.ElementRef<typeof Action>,
139140
AlertDialogActionProps
140141
>(
141142
(
142-
{ className, variant = 'destructive', size, shape, block, ...props },
143+
{ className, variant = 'destructive', size, block, icon, ...props },
143144
forwardedRef,
144145
) => (
145146
<Action
146-
className={cn(buttonVariants({ variant, size, shape, block }), className)}
147+
className={cn(buttonVariants({ variant, size, block, icon }), className)}
147148
ref={forwardedRef}
148149
{...props}
149150
/>
@@ -156,23 +157,20 @@ AlertDialogAction.displayName = Action.displayName;
156157
* Component: AlertDialogCancel
157158
* -------------------------------------------------------------------------- */
158159

159-
export interface AlertDialogCancelProps extends CancelProps {
160-
variant?: ButtonProps['variant'];
161-
size?: ButtonProps['size'];
162-
shape?: ButtonProps['shape'];
163-
block?: ButtonProps['block'];
164-
}
160+
export interface AlertDialogCancelProps
161+
extends CancelProps,
162+
ButtonVariantsProps {}
165163

166164
export const AlertDialogCancel = React.forwardRef<
167165
React.ElementRef<typeof Cancel>,
168166
AlertDialogCancelProps
169167
>(
170168
(
171-
{ className, variant = 'outline', size, shape, block, ...props },
169+
{ className, variant = 'outline', size, block, icon, ...props },
172170
forwardedRef,
173171
) => (
174172
<Cancel
175-
className={cn(buttonVariants({ variant, size, shape, block }), className)}
173+
className={cn(buttonVariants({ variant, size, icon, block }), className)}
176174
ref={forwardedRef}
177175
{...props}
178176
/>

packages/ui/src/react/alert.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ const alertVariants = cva(
3030
},
3131
);
3232

33+
type AlertVariantsProps = VariantProps<typeof alertVariants>;
34+
3335
/* -----------------------------------------------------------------------------
3436
* Component: Alert
3537
* -------------------------------------------------------------------------- */
3638

3739
export interface AlertProps
3840
extends React.HTMLAttributes<HTMLDivElement>,
39-
VariantProps<typeof alertVariants> {}
41+
AlertVariantsProps {}
4042

4143
export const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
4244
({ className, variant, ...props }, forwardedRef) => (

packages/ui/src/react/badge.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ const badgeVariants = cva(
2525
},
2626
);
2727

28+
type BadgeVariantsProps = VariantProps<typeof badgeVariants>;
29+
2830
/* -----------------------------------------------------------------------------
2931
* Component: Badge
3032
* -------------------------------------------------------------------------- */
3133

3234
export interface BadgeProps
3335
extends React.HTMLAttributes<HTMLDivElement>,
34-
VariantProps<typeof badgeVariants> {}
36+
BadgeVariantsProps {}
3537

3638
export function Badge({
3739
className,

packages/ui/src/react/button.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { Loader2Icon } from 'lucide-react';
3-
import type { VariantProps } from 'class-variance-authority';
3+
import type { ButtonVariantsProps } from '@/server/button-variants';
44
import { buttonVariants } from '@/server/button-variants';
55
import { cn } from '@/server/cn';
66

@@ -10,7 +10,7 @@ import { cn } from '@/server/cn';
1010

1111
export interface ButtonProps
1212
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
13-
VariantProps<typeof buttonVariants> {
13+
ButtonVariantsProps {
1414
endIcon?: React.ReactNode;
1515
startIcon?: React.ReactNode;
1616
loading?: boolean;
@@ -24,8 +24,6 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
2424
variant,
2525
size,
2626
block,
27-
shape,
28-
justify,
2927
loading,
3028
startIcon,
3129
endIcon,
@@ -40,8 +38,6 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
4038
buttonVariants({
4139
block,
4240
icon: icon || !React.Children.count(children),
43-
justify,
44-
shape,
4541
size,
4642
variant,
4743
}),

packages/ui/src/react/calendar.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ export function DatePicker({
106106
<Trigger>
107107
<PopoverTrigger
108108
className={cn(
109-
buttonVariants({
110-
variant: 'outline',
111-
}),
109+
buttonVariants({ variant: 'outline' }),
112110
classNameTrigger,
113111
)}
114112
disabled={loading}
@@ -506,11 +504,7 @@ export function Calendar({
506504
months: 'flex flex-col gap-4 sm:flex-row',
507505
nav: '',
508506
nav_button: twMerge(
509-
buttonVariants({
510-
icon: true,
511-
size: 'sm',
512-
variant: 'outline',
513-
}),
507+
buttonVariants({ icon: true, size: 'sm', variant: 'outline' }),
514508
'absolute inset-y-0',
515509
),
516510
nav_button_next: 'right-0',

packages/ui/src/react/combobox.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,8 @@ export function Combobox({
153153
<Trigger>
154154
<PopoverTrigger
155155
className={cn(
156-
buttonVariants({
157-
block,
158-
variant: 'outline',
159-
justify: 'between',
160-
}),
156+
buttonVariants({ block, variant: 'outline' }),
157+
'justify-between',
161158
classNameTrigger,
162159
)}
163160
disabled={disabled}

packages/ui/src/react/command.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ const commandVariants = cva(
3535
},
3636
);
3737

38+
type CommandVariantsProps = VariantProps<typeof commandVariants>;
39+
3840
/* -----------------------------------------------------------------------------
3941
* Component: Command
4042
* -------------------------------------------------------------------------- */
4143

4244
export interface CommandProps
4345
extends React.ComponentPropsWithoutRef<typeof Root>,
44-
VariantProps<typeof commandVariants> {}
46+
CommandVariantsProps {}
4547

4648
export const Command = React.forwardRef<
4749
React.ElementRef<typeof Root>,

0 commit comments

Comments
 (0)