Skip to content

Commit 1cc87a0

Browse files
committed
fix: fix linters and types
1 parent 2d50298 commit 1cc87a0

File tree

21 files changed

+98
-85
lines changed

21 files changed

+98
-85
lines changed

packages/ui/src/components/badge.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ enum BadgesHoverStates {
1717
}
1818

1919
const badgeVariants = cva(
20-
'focus:ring-ring inline-flex items-center rounded-md border transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2',
20+
'inline-flex items-center rounded-md border transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
2121
{
2222
variants: {
2323
variant: {
24-
default: 'bg-primary text-primary-foreground hover:bg-primary/80 border-transparent shadow',
25-
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent',
26-
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent shadow',
24+
default: 'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
25+
secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
26+
destructive: 'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
2727
outline: 'text-foreground'
2828
},
2929
size: {
3030
default: 'px-2.5 py-0.5 text-xs font-semibold',
3131
lg: 'px-3 py-1 text-xs font-normal',
32-
sm: 'text-12 h-5 px-1 leading-none',
33-
xs: 'text-11 px-1.5 py-0 font-light',
32+
sm: 'h-5 px-1 text-12 leading-none',
33+
xs: 'px-1.5 py-0 text-11 font-light',
3434
// TODO: Consider switching size variants to numeric values
3535
// Numeric size variants (like '18') provide clearer context about actual dimensions
3636
// compared to abstract sizes (xs, sm, lg).
37-
'18': 'text-12 h-[18px] px-2'
37+
'18': 'h-[18px] px-2 text-12'
3838
},
3939
borderRadius: {
4040
default: '',

packages/ui/src/components/card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { forwardRef, HTMLAttributes } from 'react'
33
import { cn } from '@utils/cn'
44
import { cva, type VariantProps } from 'class-variance-authority'
55

6-
const cardVariants = cva('bg-card text-card-foreground rounded-lg border shadow', {
6+
const cardVariants = cva('rounded-lg border bg-card text-card-foreground shadow', {
77
variants: {
88
variant: {
99
default: '',

packages/ui/src/components/dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const DialogContent = React.forwardRef<
4242
{...props}
4343
>
4444
{children}
45-
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none">
45+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
4646
<Cross2Icon className="size-4" />
4747
<span className="sr-only">Close</span>
4848
</DialogPrimitive.Close>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ const DropdownMenuCheckboxItem = React.forwardRef<
126126
checked={checked}
127127
{...props}
128128
>
129-
<span className="border-borders-9 group-data-[state=checked]:border-icons-2 absolute left-2 flex size-4 items-center justify-center rounded-sm border">
130-
<DropdownMenuPrimitive.ItemIndicator className="bg-icons-2 flex size-full items-center justify-center">
131-
<Icon className="text-icons-5 h-[7px]" name="checkbox" />
129+
<span className="absolute left-2 flex size-4 items-center justify-center rounded-sm border border-borders-9 group-data-[state=checked]:border-icons-2">
130+
<DropdownMenuPrimitive.ItemIndicator className="flex size-full items-center justify-center bg-icons-2">
131+
<Icon className="h-[7px] text-icons-5" name="checkbox" />
132132
</DropdownMenuPrimitive.ItemIndicator>
133133
</span>
134134
<span className="text-14 text-foreground-8">{children}</span>

packages/ui/src/components/filters/filters-bar/filters.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ const Filters = ({
8484

8585
return (
8686
<DropdownMenu key={filter.type} open={isOpen} onOpenChange={setIsOpen}>
87-
<DropdownMenuTrigger className="bg-background-3 hover:bg-background-8 flex h-8 items-center gap-x-3 whitespace-nowrap rounded pl-2.5 pr-2 transition-colors duration-200">
88-
<div className="text-13 flex items-center gap-x-1.5">
87+
<DropdownMenuTrigger className="flex h-8 items-center gap-x-3 whitespace-nowrap rounded bg-background-3 pl-2.5 pr-2 transition-colors duration-200 hover:bg-background-8">
88+
<div className="flex items-center gap-x-1.5 text-13">
8989
<span className="text-foreground-1">
9090
{filterOption.label}
9191
{!!filter.selectedValues.length && ': '}
@@ -107,7 +107,7 @@ const Filters = ({
107107
<span className="text-14 text-foreground-4">{filterOption.label}</span>
108108

109109
<DropdownMenu>
110-
<DropdownMenuTrigger className="bg-background-3 text-14 text-foreground-2 flex h-[18px] items-center gap-x-1 rounded pl-1.5 pr-1">
110+
<DropdownMenuTrigger className="flex h-[18px] items-center gap-x-1 rounded bg-background-3 pl-1.5 pr-1 text-14 text-foreground-2">
111111
{filterOption.conditions?.find(c => c.value === filter.condition)?.label}
112112
<Icon className="chevron-down text-icons-1" name="chevron-down" size={10} />
113113
</DropdownMenuTrigger>
@@ -127,17 +127,17 @@ const Filters = ({
127127
<DropdownMenu>
128128
<DropdownMenuTrigger className="group flex h-[18px] items-center px-1">
129129
<Icon
130-
className="text-icons-1 group-hover:text-foreground-1 transition-colors duration-200"
130+
className="text-icons-1 transition-colors duration-200 group-hover:text-foreground-1"
131131
name="more-dots-fill"
132132
size={12}
133133
/>
134134
</DropdownMenuTrigger>
135135
<DropdownMenuContent align="start">
136136
<DropdownMenuItem
137-
className="text-foreground-4 hover:text-foreground-danger data-[highlighted]:text-foreground-danger duration-200 data-[highlighted]:bg-transparent data-[highlighted]:outline-none"
137+
className="text-foreground-4 duration-200 hover:text-foreground-danger data-[highlighted]:bg-transparent data-[highlighted]:text-foreground-danger data-[highlighted]:outline-none"
138138
onSelect={() => handleRemoveFilter?.(filter.type)}
139139
>
140-
<button className="text-14 flex items-center gap-x-1.5">
140+
<button className="flex items-center gap-x-1.5 text-14">
141141
<Icon name="trash" size={12} />
142142
Delete filter
143143
</button>
@@ -153,7 +153,7 @@ const Filters = ({
153153

154154
{filterOption.type === 'checkbox' && getFilteredOptions(filterOption, filter, searchQueries).length === 0 && (
155155
<div className="flex items-center justify-center p-4">
156-
<span className="text-1 text-foreground-2 leading-none">No results</span>
156+
<span className="text-1 leading-none text-foreground-2">No results</span>
157157
</div>
158158
)}
159159
</div>

packages/ui/src/components/filters/filters-bar/sorts.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ const SortableItem = ({
4747
<div className="flex items-center justify-between gap-x-2">
4848
<div className="flex items-center gap-x-2">
4949
<div
50-
className="hover:bg-background-3 cursor-grab rounded p-1 active:cursor-grabbing"
50+
className="cursor-grab rounded p-1 hover:bg-background-3 active:cursor-grabbing"
5151
{...attributes}
5252
{...listeners}
5353
>
5454
<Icon className="text-icons-1" name="grid-dots" size={12} />
5555
</div>
5656

5757
<DropdownMenu>
58-
<DropdownMenuTrigger className="border-borders-1 text-14 text-foreground-8 flex h-6 items-center gap-x-1.5 rounded border pl-2.5 pr-1.5">
58+
<DropdownMenuTrigger className="flex h-6 items-center gap-x-1.5 rounded border border-borders-1 pl-2.5 pr-1.5 text-14 text-foreground-8">
5959
{sortOptions.find(opt => opt.value === sort.type)?.label}
6060
<Icon className="chevron-down text-icons-1" name="chevron-down" size={10} />
6161
</DropdownMenuTrigger>
@@ -72,7 +72,7 @@ const SortableItem = ({
7272
</DropdownMenu>
7373

7474
<DropdownMenu>
75-
<DropdownMenuTrigger className="border-borders-1 text-14 text-foreground-8 flex h-6 items-center gap-x-1.5 rounded border pl-2.5 pr-1.5">
75+
<DropdownMenuTrigger className="flex h-6 items-center gap-x-1.5 rounded border border-borders-1 pl-2.5 pr-1.5 text-14 text-foreground-8">
7676
{sortDirections.find(dir => dir.value === sort.direction)?.label}
7777
<Icon className="chevron-down text-icons-1" name="chevron-down" size={10} />
7878
</DropdownMenuTrigger>
@@ -90,7 +90,7 @@ const SortableItem = ({
9090
</div>
9191

9292
<button
93-
className="text-foreground-4 hover:text-foreground-1 p-1 transition-colors duration-200 focus:bg-transparent"
93+
className="p-1 text-foreground-4 transition-colors duration-200 hover:text-foreground-1 focus:bg-transparent"
9494
onClick={e => {
9595
e.preventDefault()
9696
onRemoveSort?.(index)
@@ -152,7 +152,7 @@ const Sorts = ({
152152

153153
return (
154154
<DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
155-
<DropdownMenuTrigger className="bg-background-3 hover:bg-background-8 flex h-8 items-center gap-x-3 whitespace-nowrap rounded px-2.5 transition-colors duration-200">
155+
<DropdownMenuTrigger className="flex h-8 items-center gap-x-3 whitespace-nowrap rounded bg-background-3 px-2.5 transition-colors duration-200 hover:bg-background-8">
156156
<div className="flex items-center gap-x-1">
157157
<Icon
158158
className={cn('text-icons-1', getSortTriggerLabel(activeSorts, sortOptions).isDescending && 'rotate-180')}
@@ -190,12 +190,12 @@ const Sorts = ({
190190
<div className="mt-3 flex flex-col gap-y-2.5">
191191
{sortOptions.some(option => !activeSorts.some(sort => sort.type === option.value)) && (
192192
<DropdownMenu>
193-
<DropdownMenuTrigger className="text-14 text-foreground-4 hover:text-foreground-1 flex w-full items-center gap-x-1.5 transition-colors duration-200">
193+
<DropdownMenuTrigger className="flex w-full items-center gap-x-1.5 text-14 text-foreground-4 transition-colors duration-200 hover:text-foreground-1">
194194
<Icon name="plus" size={12} />
195195
Add sort
196196
</DropdownMenuTrigger>
197197
<DropdownMenuContent className="min-w-[224px] p-0" align="start">
198-
<div className="border-borders-4 relative flex items-center justify-between border-b px-3 py-2.5">
198+
<div className="relative flex items-center justify-between border-b border-borders-4 px-3 py-2.5">
199199
<DropdownMenuItem className="hover:bg-transparent focus:bg-transparent" asChild>
200200
<Input
201201
type="text"
@@ -210,7 +210,7 @@ const Sorts = ({
210210
{searchQueries.menu['sort'] && (
211211
<DropdownMenuItem className="absolute right-3 hover:bg-transparent focus:bg-transparent" asChild>
212212
<button
213-
className="text-foreground-4 hover:text-foreground-1 flex transition-colors duration-200"
213+
className="flex text-foreground-4 transition-colors duration-200 hover:text-foreground-1"
214214
onClick={e => {
215215
e.preventDefault()
216216
handleSearchChange('sort', '', 'menu')
@@ -239,7 +239,7 @@ const Sorts = ({
239239

240240
{filteredBySearchSortOptions.length === 0 && (
241241
<div className="flex items-center justify-center p-4">
242-
<span className="text-1 text-foreground-2 leading-none">No results</span>
242+
<span className="text-1 leading-none text-foreground-2">No results</span>
243243
</div>
244244
)}
245245
</div>
@@ -248,10 +248,10 @@ const Sorts = ({
248248
)}
249249

250250
<DropdownMenuItem
251-
className="text-foreground-4 focus:text-foreground-danger data-[highlighted]:text-foreground-danger p-0 transition-colors duration-200 focus:bg-transparent focus:outline-none data-[highlighted]:bg-transparent"
251+
className="p-0 text-foreground-4 transition-colors duration-200 focus:bg-transparent focus:text-foreground-danger focus:outline-none data-[highlighted]:bg-transparent data-[highlighted]:text-foreground-danger"
252252
asChild
253253
>
254-
<button className="text-14 flex items-center gap-x-1.5" onClick={handleResetSorts}>
254+
<button className="flex items-center gap-x-1.5 text-14" onClick={handleResetSorts}>
255255
<Icon name="trash" size={12} />
256256
Delete sort
257257
</button>

packages/ui/src/components/form/checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Checkbox = forwardRef<ElementRef<typeof CheckboxPrimitive.Root>, CheckboxP
2020
<div className={cn('flex gap-x-2.5', className)}>
2121
<CheckboxPrimitive.Root
2222
ref={ref}
23-
className="border-icons-1 hover:border-icons-3 disabled:border-icons-4 data-[state=checked]:border-icons-2 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer size-4 shrink-0 rounded-sm border shadow disabled:cursor-not-allowed"
23+
className="peer size-4 shrink-0 rounded-sm border border-icons-1 shadow hover:border-icons-3 disabled:cursor-not-allowed disabled:border-icons-4 data-[state=checked]:border-icons-2 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground"
2424
{...props}
2525
>
2626
<CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>

packages/ui/src/components/form/input.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ export interface BaseInputProps
88
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>,
99
VariantProps<typeof inputVariants> {}
1010

11-
const inputVariants = cva('text-foreground-1 bg-transparent px-2.5 py-1 disabled:cursor-not-allowed', {
11+
const inputVariants = cva('bg-transparent px-2.5 py-1 text-foreground-1 disabled:cursor-not-allowed', {
1212
variants: {
1313
variant: {
1414
default:
15-
'placeholder:text-foreground-4 flex w-full rounded border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:rounded focus-visible:outline-none',
15+
'flex w-full rounded border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-foreground-4 focus-visible:rounded focus-visible:outline-none',
1616
extended: 'grow border-none focus-visible:outline-none'
1717
},
1818
size: {
@@ -50,6 +50,8 @@ interface InputProps extends BaseInputProps {
5050
caption?: ReactNode
5151
error?: InputError
5252
optional?: boolean
53+
className?: string
54+
wrapperClassName?: string
5355
}
5456

5557
/**
@@ -64,6 +66,8 @@ interface InputProps extends BaseInputProps {
6466
* @param {MessageTheme} [props.theme] - Visual theme of the input
6567
* @param {boolean} [props.disabled] - Whether the input is disabled
6668
* @param {boolean} [props.optional] - Indicates if the field is optional, displays "(Optional)" in the label
69+
* @param {string} [props.className] - Optional additional class names for the input element
70+
* @param {string} [props.wrapperClassName] - Optional additional class names for the wrapper element
6771
* @param {BaseInputProps} props.rest - All other props are passed to the underlying input element
6872
*
6973
* @example
@@ -77,17 +81,24 @@ interface InputProps extends BaseInputProps {
7781
* />
7882
*/
7983
const Input = forwardRef<HTMLInputElement, InputProps>(
80-
({ label, caption, error, id, theme, disabled, optional, ...props }, ref) => {
81-
const InputWrapper = error || caption || label ? ControlGroup : Fragment
84+
({ label, caption, error, id, theme, disabled, optional, className, wrapperClassName, ...props }, ref) => {
85+
const InputWrapper = error || caption || label || wrapperClassName ? ControlGroup : Fragment
8286

8387
return (
84-
<InputWrapper>
88+
<InputWrapper className={wrapperClassName}>
8589
{label && (
8690
<Label className="mb-2.5" color={disabled ? 'disabled-dark' : 'secondary'} optional={optional} htmlFor={id}>
8791
{label}
8892
</Label>
8993
)}
90-
<BaseInput id={id} ref={ref} theme={error ? 'danger' : theme} disabled={disabled} {...props} />
94+
<BaseInput
95+
className={className}
96+
id={id}
97+
ref={ref}
98+
theme={error ? 'danger' : theme}
99+
disabled={disabled}
100+
{...props}
101+
/>
91102
{error && (
92103
<Message className={cn(caption ? 'mt-1' : 'absolute top-full translate-y-1')} theme={error.theme}>
93104
{error.message}

packages/ui/src/components/form/label.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface LabelProps extends VariantProps<typeof labelVariants>, PropsWithChildr
5454
const Label = ({ htmlFor, optional, color, variant, children, className }: LabelProps) => {
5555
return (
5656
<LabelRoot htmlFor={htmlFor} variant={variant} color={color} className={className}>
57-
{children} {optional && <span className="text-foreground-7 align-top">(optional)</span>}
57+
{children} {optional && <span className="align-top text-foreground-7">(optional)</span>}
5858
</LabelRoot>
5959
)
6060
}

packages/ui/src/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export * from './breadcrumb'
3232
export * from './skeleton-list'
3333
export * from './dialog'
3434
export * from './path-breadcrumbs'
35+
export * from './card'
36+
export * from './input-otp'
3537
export * from './form'
3638
export * from './button-group'
3739

0 commit comments

Comments
 (0)