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

Commit 31f0a56

Browse files
committed
refactor: refactor class order in multiple components for consistency
1 parent 2657d64 commit 31f0a56

20 files changed

+41
-38
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ export const AlertDialogContent = forwardRef<
7575
>
7676
<Content
7777
className={twMerge(
78-
alertDialogContentVariants({ className, scrollable }),
78+
alertDialogContentVariants({ scrollable }),
79+
className,
7980
classNames?.content,
8081
)}
8182
ref={forwardedRef}

packages/ui/src/react/alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const Alert = forwardRef<
1515
React.ComponentProps<'div'> & VariantProps<typeof alertVariants>
1616
>(({ className, variant, ...props }, forwardedRef) => (
1717
<div
18-
className={twMerge(alertVariants({ className, variant }))}
18+
className={twMerge(alertVariants({ variant }), className)}
1919
ref={forwardedRef}
2020
{...props}
2121
/>

packages/ui/src/react/badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function Badge({
1717
VariantProps<typeof badgeVariants>): React.JSX.Element {
1818
return (
1919
<div
20-
className={twMerge(badgeVariants({ className, variant }))}
20+
className={twMerge(badgeVariants({ variant }), className)}
2121
{...props}
2222
/>
2323
);

packages/ui/src/react/command.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const Command = forwardRef<
2828
VariantProps<typeof commandVariants>
2929
>(({ className, variant = 'primary', ...props }, forwardedRef) => (
3030
<Root
31-
className={twMerge(commandVariants({ className, variant }))}
31+
className={twMerge(commandVariants({ variant }), className)}
3232
ref={forwardedRef}
3333
{...props}
3434
/>

packages/ui/src/react/context-menu.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ export const ContextMenuSubTrigger = forwardRef<
139139
<SubTrigger
140140
className={twMerge(
141141
contextMenuSubTriggerVariants({
142-
className,
143142
inset,
144143
variant,
145144
}),
145+
className,
146146
)}
147147
ref={forwardedRef}
148148
{...props}
@@ -175,10 +175,10 @@ export const ContextMenuItem = forwardRef<
175175
<Item
176176
className={twMerge(
177177
contextMenuItemVariants({
178-
className,
179178
inset,
180179
variant,
181180
}),
181+
className,
182182
)}
183183
ref={forwardedRef}
184184
{...props}
@@ -212,9 +212,9 @@ export const ContextMenuCheckboxItem = forwardRef<
212212
<CheckboxItem
213213
className={twMerge(
214214
contextMenuCheckboxItemVariants({
215-
className,
216215
variant,
217216
}),
217+
className,
218218
)}
219219
ref={forwardedRef}
220220
{...props}
@@ -242,7 +242,7 @@ export const ContextMenuRadioItem = forwardRef<
242242
} & VariantProps<typeof contextMenuRadioItemVariants>
243243
>(({ children, className, variant, shortcut, ...props }, forwardedRef) => (
244244
<RadioItem
245-
className={twMerge(contextMenuRadioItemVariants({ className, variant }))}
245+
className={twMerge(contextMenuRadioItemVariants({ variant }), className)}
246246
ref={forwardedRef}
247247
{...props}
248248
>
@@ -291,7 +291,7 @@ export const ContextMenuLabel = forwardRef<
291291
VariantProps<typeof contextMenuLabelVariants>
292292
>(({ className, inset = false, ...props }, forwardedRef) => (
293293
<Label
294-
className={twMerge(contextMenuLabelVariants({ className, inset }))}
294+
className={twMerge(contextMenuLabelVariants({ inset }), className)}
295295
ref={forwardedRef}
296296
{...props}
297297
/>

packages/ui/src/react/dialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ export const DialogContent = forwardRef<
8484
>
8585
<Content
8686
className={twMerge(
87-
dialogContentVariants({ className, scrollable }),
87+
dialogContentVariants({ scrollable }),
88+
className,
8889
classNames?.content,
8990
)}
9091
ref={forwardedRef}

packages/ui/src/react/drawer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export const DrawerContent = forwardRef<
9393
>
9494
<Content
9595
className={twMerge(
96-
drawerContentVariants({ className, position, scrollable }),
96+
drawerContentVariants({ position, scrollable }),
97+
className,
9798
classNames?.content,
9899
)}
99100
ref={forwardedRef}

packages/ui/src/react/dropdown-menu.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ export const DropdownMenuSubTrigger = forwardRef<
113113
<SubTrigger
114114
className={twMerge(
115115
dropdownMenuSubTriggerVariants({
116-
className,
117116
inset,
118117
variant,
119118
}),
119+
className,
120120
)}
121121
ref={forwardedRef}
122122
{...props}
@@ -149,10 +149,10 @@ export const DropdownMenuItem = forwardRef<
149149
<Item
150150
className={twMerge(
151151
dropdownMenuItemVariants({
152-
className,
153152
inset,
154153
variant,
155154
}),
155+
className,
156156
)}
157157
ref={forwardedRef}
158158
{...props}
@@ -206,9 +206,9 @@ export const DropdownMenuCheckboxItem = forwardRef<
206206
<CheckboxItem
207207
className={twMerge(
208208
dropdownMenuCheckboxItemVariants({
209-
className,
210209
variant,
211210
}),
211+
className,
212212
)}
213213
ref={forwardedRef}
214214
{...props}
@@ -238,7 +238,7 @@ export const DropdownMenuRadioItem = forwardRef<
238238
} & VariantProps<typeof dropdownMenuRadioItemVariants>
239239
>(({ children, className, variant, shortcut, ...props }, forwardedRef) => (
240240
<RadioItem
241-
className={twMerge(dropdownMenuRadioItemVariants({ className, variant }))}
241+
className={twMerge(dropdownMenuRadioItemVariants({ variant }), className)}
242242
ref={forwardedRef}
243243
{...props}
244244
>
@@ -308,7 +308,7 @@ export const DropdownMenuLabel = forwardRef<
308308
VariantProps<typeof dropdownMenuLabelVariants>
309309
>(({ className, inset = false, ...props }, forwardedRef) => (
310310
<Label
311-
className={twMerge(dropdownMenuLabelVariants({ className, inset }))}
311+
className={twMerge(dropdownMenuLabelVariants({ inset }), className)}
312312
ref={forwardedRef}
313313
{...props}
314314
/>

packages/ui/src/react/form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const FormItem = forwardRef<
101101
return (
102102
<FormItemContext.Provider value={{ id }}>
103103
<div
104-
className={twMerge(formItemVariants({ className, inline }))}
104+
className={twMerge(formItemVariants({ inline }), className)}
105105
ref={forwardedRef}
106106
{...props}
107107
/>

packages/ui/src/react/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const PrimitiveInput = forwardRef<
2020
VariantProps<typeof primitiveInputVariants>
2121
>(({ className, size, inline, ...props }, forwardedRef) => (
2222
<input
23-
className={twMerge(primitiveInputVariants({ className, inline, size }))}
23+
className={twMerge(primitiveInputVariants({ inline, size }), className)}
2424
ref={forwardedRef}
2525
{...props}
2626
/>

packages/ui/src/react/label.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const Label = forwardRef<
2525
forwardedRef,
2626
) => (
2727
<Root
28-
className={twMerge(labelVariants({ className, invalid, required }))}
28+
className={twMerge(labelVariants({ invalid, required }), className)}
2929
ref={forwardedRef}
3030
{...props}
3131
>

packages/ui/src/react/menubar.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ export const MenubarSubTrigger = forwardRef<
174174
<SubTrigger
175175
className={twMerge(
176176
menubarSubTriggerVariants({
177-
className,
178177
inset,
179178
variant,
180179
}),
180+
className,
181181
)}
182182
ref={forwardedRef}
183183
{...props}
@@ -208,7 +208,7 @@ export const MenubarItem = forwardRef<
208208
forwardedRef,
209209
) => (
210210
<Item
211-
className={twMerge(menubarItemVariants({ className, inset, variant }))}
211+
className={twMerge(menubarItemVariants({ inset, variant }), className)}
212212
ref={forwardedRef}
213213
{...props}
214214
>
@@ -257,7 +257,7 @@ export const MenubarCheckboxItem = forwardRef<
257257
} & VariantProps<typeof menubarCheckboxItemVariants>
258258
>(({ children, className, variant, shortcut, ...props }, forwardedRef) => (
259259
<CheckboxItem
260-
className={twMerge(menubarCheckboxItemVariants({ className, variant }))}
260+
className={twMerge(menubarCheckboxItemVariants({ variant }), className)}
261261
ref={forwardedRef}
262262
{...props}
263263
>
@@ -284,7 +284,7 @@ export const MenubarRadioItem = forwardRef<
284284
} & VariantProps<typeof menubarRadioItemVariants>
285285
>(({ children, className, variant, shortcut, ...props }, forwardedRef) => (
286286
<RadioItem
287-
className={twMerge(menubarRadioItemVariants({ className, variant }))}
287+
className={twMerge(menubarRadioItemVariants({ variant }), className)}
288288
ref={forwardedRef}
289289
{...props}
290290
>
@@ -316,7 +316,7 @@ export const MenubarLabel = forwardRef<
316316
VariantProps<typeof menubarLabelVariants>
317317
>(({ className, inset = false, ...props }, forwardedRef) => (
318318
<Label
319-
className={twMerge(menubarLabelVariants({ className, inset }))}
319+
className={twMerge(menubarLabelVariants({ inset }), className)}
320320
ref={forwardedRef}
321321
{...props}
322322
/>

packages/ui/src/react/navigation-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const NavigationMenuTrigger = forwardRef<
147147
React.ComponentPropsWithoutRef<typeof Trigger>
148148
>(({ children, className, ...props }, forwardedRef) => (
149149
<Trigger
150-
className={twMerge(navigationMenuTriggerVariants({ className }))}
150+
className={twMerge(navigationMenuTriggerVariants(), className)}
151151
ref={forwardedRef}
152152
{...props}
153153
>

packages/ui/src/react/radio-group.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const RadioGroup = forwardRef<
2626
>(({ className, variant = 'default', ...props }, forwardedRef) => (
2727
<RadioGroupContext.Provider value={{ variant }}>
2828
<Root
29-
className={twMerge(radioGroupVariants({ className, variant }))}
29+
className={twMerge(radioGroupVariants({ variant }), className)}
3030
ref={forwardedRef}
3131
{...props}
3232
/>
@@ -68,7 +68,7 @@ export const RadioGroupItem = forwardRef<
6868

6969
return (
7070
<Item
71-
className={twMerge(radioGroupItemVariants({ className, variant }))}
71+
className={twMerge(radioGroupItemVariants({ variant }), className)}
7272
ref={forwardedRef}
7373
{...props}
7474
>

packages/ui/src/react/select.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const SelectTrigger = forwardRef<
8080
VariantProps<typeof selectTriggerVariants>
8181
>(({ children, className, size, block, ...props }, forwardedRef) => (
8282
<Trigger
83-
className={twMerge(selectTriggerVariants({ block, className, size }))}
83+
className={twMerge(selectTriggerVariants({ block, size }), className)}
8484
ref={forwardedRef}
8585
{...props}
8686
>
@@ -159,9 +159,9 @@ export const SelectContent = forwardRef<
159159
<Content
160160
className={twMerge(
161161
selectContentVariants({
162-
className,
163162
position: props.position ?? 'item-aligned',
164163
}),
164+
className,
165165
)}
166166
ref={forwardedRef}
167167
sideOffset={5}
@@ -214,7 +214,7 @@ export const SelectItem = forwardRef<
214214
VariantProps<typeof selectItemVariants>
215215
>(({ children, className, variant, ...props }, forwardedRef) => (
216216
<Item
217-
className={twMerge(selectItemVariants({ className, variant }))}
217+
className={twMerge(selectItemVariants({ variant }), className)}
218218
ref={forwardedRef}
219219
{...props}
220220
>

packages/ui/src/react/tabs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const TabsList = forwardRef<
4949

5050
return (
5151
<List
52-
className={twMerge(tabsListVariants({ className, variant }))}
52+
className={twMerge(tabsListVariants({ variant }), className)}
5353
ref={forwardedRef}
5454
{...props}
5555
/>
@@ -71,7 +71,7 @@ export const TabsTrigger = forwardRef<
7171

7272
return (
7373
<Trigger
74-
className={twMerge(tabsTriggerVariants({ className, variant }))}
74+
className={twMerge(tabsTriggerVariants({ variant }), className)}
7575
ref={forwardedRef}
7676
{...props}
7777
/>
@@ -93,7 +93,7 @@ export const TabsContent = forwardRef<
9393

9494
return (
9595
<Content
96-
className={twMerge(tabsContentVariants({ className, variant }))}
96+
className={twMerge(tabsContentVariants({ variant }), className)}
9797
ref={forwardedRef}
9898
{...props}
9999
/>

packages/ui/src/react/toast.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const ToastViewport = forwardRef<
3131
VariantProps<typeof toastViewportVariants>
3232
>(({ className, position = 'bottom-right', ...props }, forwardedRef) => (
3333
<Viewport
34-
className={twMerge(toastViewportVariants({ className, position }))}
34+
className={twMerge(toastViewportVariants({ position }), className)}
3535
ref={forwardedRef}
3636
{...props}
3737
/>
@@ -49,7 +49,7 @@ export const Toast = forwardRef<
4949
VariantProps<typeof toastVariants>
5050
>(({ className, variant, ...props }, forwardedRef) => (
5151
<Root
52-
className={twMerge(toastVariants({ className, variant }))}
52+
className={twMerge(toastVariants({ variant }), className)}
5353
ref={forwardedRef}
5454
{...props}
5555
/>

packages/ui/src/react/toggle-group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const ToggleGroupItem = forwardRef<
3737
VariantProps<typeof toggleGroupItemVariants>
3838
>(({ className, variant = 'primary', size = 'md', ...props }, forwardedRef) => (
3939
<Item
40-
className={twMerge(toggleGroupItemVariants({ className, size, variant }))}
40+
className={twMerge(toggleGroupItemVariants({ size, variant }), className)}
4141
ref={forwardedRef}
4242
{...props}
4343
/>

packages/ui/src/react/toggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const Toggle = forwardRef<
1717
VariantProps<typeof toggleVariants>
1818
>(({ className, variant, size, ...props }, forwardedRef) => (
1919
<Root
20-
className={twMerge(toggleVariants({ className, size, variant }))}
20+
className={twMerge(toggleVariants({ size, variant }), className)}
2121
ref={forwardedRef}
2222
{...props}
2323
/>

packages/ui/src/react/toolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const ToolbarToggleItem = forwardRef<
128128
<ToggleItem
129129
ref={forwardedRef}
130130
{...props}
131-
className={twMerge(toolbarToggleItemVariants({ className, size, variant }))}
131+
className={twMerge(toolbarToggleItemVariants({ size, variant }), className)}
132132
/>
133133
));
134134

0 commit comments

Comments
 (0)