refactor: use React.ComponentProps instead of ref-variant helpers (#29577)

This commit is contained in:
McKayla はな authored and GitHub committed 2026-09-18 13:01:48 -06:00
1 parent 55da502938
commit 98e1ec11bc
43 files changed
+141 -140

No files matched your search

+21 -4
View File
@@ -1,11 +1,8 @@
{
// oxlint config for the Coder frontend. Biome (see biome.jsonc) remains the
// authoritative JS/TS linter; oxlint runs alongside it and enforces only the
// rules that already match Biome's behavior. See the migration backlog below.
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn", "oxc", "react", "jsx-a11y", "vitest"],
// Turn every default-on category off so nothing runs unless explicitly
// enabled below. This keeps oxlint to "nothing more" than Biome.
// enabled below.
"categories": { "correctness": "off" },
"rules": {
// --- a11y (jsx-a11y) ---
@@ -236,6 +233,26 @@
}
]
}
],
"no-restricted-types": [
"error",
{
"types": {
"ComponentPropsWithRef": {
"message": "Use ComponentProps instead. Under React 19 it already includes ref."
},
"React.ComponentPropsWithRef": {
"message": "Use React.ComponentProps instead. Under React 19 it already includes ref."
},
"ComponentPropsWithoutRef": {
"message": "Use ComponentProps instead. Under React 19 it already includes ref."
},
"React.ComponentPropsWithoutRef": {
"message": "Use React.ComponentProps instead. Under React 19 it already includes ref."
}
}
}
]
},
// typesGenerated.ts is generated, so ignore it entirely rather than
+1 -1
View File
@@ -141,7 +141,7 @@ export const AlertDescription: React.FC<React.PropsWithChildren> = ({
);
};
export const AlertTitle: React.FC<React.ComponentPropsWithRef<"h2">> = ({
export const AlertTitle: React.FC<React.ComponentProps<"h2">> = ({
className,
children,
...props
+1 -1
View File
@@ -74,7 +74,7 @@ const badgeVariants = cva(
},
);
export type BadgeProps = React.ComponentPropsWithRef<"div"> &
export type BadgeProps = React.ComponentProps<"div"> &
VariantProps<typeof badgeVariants> & {
asChild?: boolean;
};
+1 -1
View File
@@ -8,7 +8,7 @@ export const EnabledBadge: React.FC = () => {
);
};
export const DisabledBadge: React.FC<React.ComponentPropsWithRef<"div">> = ({
export const DisabledBadge: React.FC<React.ComponentProps<"div">> = ({
...props
}) => {
return (
@@ -7,7 +7,7 @@ import { cn } from "cn";
import { MoreHorizontalIcon } from "lucide-react";
import { NavLink } from "react-router";
type BreadcrumbProps = React.ComponentPropsWithRef<"nav"> & {
type BreadcrumbProps = React.ComponentProps<"nav"> & {
separator?: React.ReactNode;
};
@@ -15,7 +15,7 @@ export const Breadcrumb: React.FC<BreadcrumbProps> = ({ ...props }) => {
return <nav aria-label="breadcrumb" {...props} />;
};
export const BreadcrumbList: React.FC<React.ComponentPropsWithRef<"ol">> = ({
export const BreadcrumbList: React.FC<React.ComponentProps<"ol">> = ({
className,
...props
}) => {
@@ -30,7 +30,7 @@ export const BreadcrumbList: React.FC<React.ComponentPropsWithRef<"ol">> = ({
);
};
export const BreadcrumbItem: React.FC<React.ComponentPropsWithRef<"li">> = ({
export const BreadcrumbItem: React.FC<React.ComponentProps<"li">> = ({
className,
...props
}) => {
@@ -62,7 +62,7 @@ export const BreadcrumbLink: React.FC<BreadcrumbLinkProps> = ({
);
};
export const BreadcrumbPage: React.FC<React.ComponentPropsWithRef<"span">> = ({
export const BreadcrumbPage: React.FC<React.ComponentProps<"span">> = ({
className,
...props
}) => {
@@ -79,7 +79,7 @@ export const BreadcrumbPage: React.FC<React.ComponentPropsWithRef<"span">> = ({
};
export const BreadcrumbSeparator: React.FC<
Omit<React.ComponentPropsWithRef<"li">, "children">
Omit<React.ComponentProps<"li">, "children">
> = ({ className, ...props }) => {
return (
<li
@@ -97,7 +97,7 @@ export const BreadcrumbSeparator: React.FC<
};
export const BreadcrumbEllipsis: React.FC<
Omit<React.ComponentPropsWithRef<"span">, "children">
Omit<React.ComponentProps<"span">, "children">
> = ({ className, ...props }) => {
return (
<span
+1 -1
View File
@@ -57,7 +57,7 @@ const buttonVariants = cva(
},
);
export type ButtonProps = React.ComponentPropsWithRef<"button"> &
export type ButtonProps = React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean;
};
+1 -4
View File
@@ -36,10 +36,7 @@ function useChart() {
return context;
}
type ChartContainerProps = Omit<
React.ComponentPropsWithRef<"div">,
"children"
> &
type ChartContainerProps = Omit<React.ComponentProps<"div">, "children"> &
Pick<
React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>,
"children"
+1 -1
View File
@@ -11,7 +11,7 @@ import { Checkbox as CheckboxPrimitive } from "radix-ui";
* To allow for an indeterminate state the checkbox must be controlled, otherwise the checked prop would remain undefined
*/
export const Checkbox: React.FC<
React.ComponentPropsWithRef<typeof CheckboxPrimitive.Root>
React.ComponentProps<typeof CheckboxPrimitive.Root>
> = ({ className, ...props }) => {
return (
<CheckboxPrimitive.Root
+4 -6
View File
@@ -65,7 +65,7 @@ export const Combobox = ({
export const ComboboxTrigger = PopoverTrigger;
interface ComboboxButtonProps extends React.ComponentPropsWithRef<"button"> {
interface ComboboxButtonProps extends React.ComponentProps<"button"> {
width?: number;
selectedOption?: SelectFilterOption;
placeholder?: string;
@@ -97,9 +97,7 @@ export const ComboboxButton = ({
);
};
type ComboboxContentProps = React.ComponentPropsWithRef<
typeof PopoverContent
> & {
type ComboboxContentProps = React.ComponentProps<typeof PopoverContent> & {
shouldFilter?: boolean;
};
@@ -129,7 +127,7 @@ export const ComboboxContent = ({
export const ComboboxInput = CommandInput;
export const ComboboxList: React.FC<
React.ComponentPropsWithRef<typeof CommandList>
React.ComponentProps<typeof CommandList>
> = ({ className, ...props }) => {
return (
<CommandList
@@ -145,7 +143,7 @@ export const ComboboxItem = ({
onSelect,
value,
...props
}: React.ComponentPropsWithRef<typeof CommandItem>) => {
}: React.ComponentProps<typeof CommandItem>) => {
const { setOpen, value: selectedValue, onValueChange } = useCombobox();
const isSelected = value === selectedValue;
+7 -7
View File
@@ -3,7 +3,7 @@ import { cn } from "cn";
import { SearchIcon } from "lucide-react";
export const Command: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive>
React.ComponentProps<typeof CommandPrimitive>
> = ({ className, ...props }) => {
return (
<CommandPrimitive
@@ -17,7 +17,7 @@ export const Command: React.FC<
};
export const CommandInput: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive.Input>
React.ComponentProps<typeof CommandPrimitive.Input>
> = ({ className, ...props }) => {
return (
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
@@ -36,7 +36,7 @@ export const CommandInput: React.FC<
};
export const CommandList: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive.List>
React.ComponentProps<typeof CommandPrimitive.List>
> = ({ className, ...props }) => {
return (
<CommandPrimitive.List
@@ -47,7 +47,7 @@ export const CommandList: React.FC<
};
export const CommandEmpty: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive.Empty>
React.ComponentProps<typeof CommandPrimitive.Empty>
> = ({ className, ...props }) => {
return (
<CommandPrimitive.Empty
@@ -58,7 +58,7 @@ export const CommandEmpty: React.FC<
};
export const CommandGroup: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive.Group>
React.ComponentProps<typeof CommandPrimitive.Group>
> = ({ className, ...props }) => {
return (
<CommandPrimitive.Group
@@ -74,7 +74,7 @@ export const CommandGroup: React.FC<
};
export const CommandSeparator: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive.Separator>
React.ComponentProps<typeof CommandPrimitive.Separator>
> = ({ className, ...props }) => {
return (
<CommandPrimitive.Separator
@@ -85,7 +85,7 @@ export const CommandSeparator: React.FC<
};
export const CommandItem: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive.Item>
React.ComponentProps<typeof CommandPrimitive.Item>
> = ({ className, ...props }) => {
return (
<CommandPrimitive.Item
@@ -25,7 +25,7 @@ export const ContextMenuGroup = ContextMenuPrimitive.Group;
export const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
export const ContextMenuContent: React.FC<
React.ComponentPropsWithRef<typeof ContextMenuPrimitive.Content>
React.ComponentProps<typeof ContextMenuPrimitive.Content>
> = ({ className, ...props }) => {
return (
<ContextMenuPrimitive.Portal>
@@ -37,7 +37,7 @@ export const ContextMenuContent: React.FC<
);
};
type ContextMenuItemProps = React.ComponentPropsWithRef<
type ContextMenuItemProps = React.ComponentProps<
typeof ContextMenuPrimitive.Item
> & {
inset?: boolean;
@@ -57,7 +57,7 @@ export const ContextMenuItem: React.FC<ContextMenuItemProps> = ({
};
export const ContextMenuSeparator: React.FC<
React.ComponentPropsWithRef<typeof ContextMenuPrimitive.Separator>
React.ComponentProps<typeof ContextMenuPrimitive.Separator>
> = ({ className, ...props }) => {
return (
<ContextMenuPrimitive.Separator
+6 -8
View File
@@ -17,7 +17,7 @@ const DialogPortal = DialogPrimitive.Portal;
export const DialogClose = DialogPrimitive.Close;
const DialogOverlay: React.FC<
React.ComponentPropsWithRef<typeof DialogPrimitive.Overlay>
React.ComponentProps<typeof DialogPrimitive.Overlay>
> = ({ className, ...props }) => {
return (
<DialogPrimitive.Overlay
@@ -52,9 +52,7 @@ const dialogVariants = cva(
},
);
type DialogContentProps = React.ComponentPropsWithRef<
typeof DialogPrimitive.Content
> &
type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> &
VariantProps<typeof dialogVariants>;
export const DialogContent: React.FC<DialogContentProps> = ({
@@ -76,7 +74,7 @@ export const DialogContent: React.FC<DialogContentProps> = ({
);
};
export const DialogHeader: React.FC<React.ComponentPropsWithRef<"div">> = ({
export const DialogHeader: React.FC<React.ComponentProps<"div">> = ({
className,
...props
}) => {
@@ -91,7 +89,7 @@ export const DialogHeader: React.FC<React.ComponentPropsWithRef<"div">> = ({
);
};
export const DialogFooter: React.FC<React.ComponentPropsWithRef<"div">> = ({
export const DialogFooter: React.FC<React.ComponentProps<"div">> = ({
className,
...props
}) => {
@@ -169,7 +167,7 @@ export const DialogActions: React.FC<DialogActionsProps> = ({
};
export const DialogTitle: React.FC<
React.ComponentPropsWithRef<typeof DialogPrimitive.Title>
React.ComponentProps<typeof DialogPrimitive.Title>
> = ({ className, ...props }) => {
return (
<DialogPrimitive.Title
@@ -183,7 +181,7 @@ export const DialogTitle: React.FC<
};
export const DialogDescription: React.FC<
React.ComponentPropsWithRef<typeof DialogPrimitive.Description>
React.ComponentProps<typeof DialogPrimitive.Description>
> = ({ className, ...props }) => {
return (
<DialogPrimitive.Description
+7 -7
View File
@@ -7,7 +7,7 @@ type DrawerDirection = "top" | "bottom" | "left" | "right";
const DrawerDirectionContext = createContext<DrawerDirection>("right");
type DrawerProps = React.ComponentPropsWithRef<typeof DialogPrimitive.Root> & {
type DrawerProps = React.ComponentProps<typeof DialogPrimitive.Root> & {
/** The edge of the screen the drawer slides in from. Defaults to "right". */
direction?: DrawerDirection;
};
@@ -30,7 +30,7 @@ export const DrawerClose = DialogPrimitive.Close;
const DrawerPortal = DialogPrimitive.Portal;
const DrawerOverlay: React.FC<
React.ComponentPropsWithRef<typeof DialogPrimitive.Overlay>
React.ComponentProps<typeof DialogPrimitive.Overlay>
> = ({ className, ...props }) => {
return (
<DialogPrimitive.Overlay
@@ -80,7 +80,7 @@ const drawerContentVariants = cva(
);
export const DrawerContent: React.FC<
React.ComponentPropsWithRef<typeof DialogPrimitive.Content>
React.ComponentProps<typeof DialogPrimitive.Content>
> = ({ className, children, ...props }) => {
const direction = useContext(DrawerDirectionContext);
@@ -97,7 +97,7 @@ export const DrawerContent: React.FC<
);
};
export const DrawerHeader: React.FC<React.ComponentPropsWithRef<"div">> = ({
export const DrawerHeader: React.FC<React.ComponentProps<"div">> = ({
className,
...props
}) => {
@@ -109,7 +109,7 @@ export const DrawerHeader: React.FC<React.ComponentPropsWithRef<"div">> = ({
);
};
export const DrawerFooter: React.FC<React.ComponentPropsWithRef<"div">> = ({
export const DrawerFooter: React.FC<React.ComponentProps<"div">> = ({
className,
...props
}) => {
@@ -122,7 +122,7 @@ export const DrawerFooter: React.FC<React.ComponentPropsWithRef<"div">> = ({
};
export const DrawerTitle: React.FC<
React.ComponentPropsWithRef<typeof DialogPrimitive.Title>
React.ComponentProps<typeof DialogPrimitive.Title>
> = ({ className, ...props }) => {
return (
<DialogPrimitive.Title
@@ -136,7 +136,7 @@ export const DrawerTitle: React.FC<
};
export const DrawerDescription: React.FC<
React.ComponentPropsWithRef<typeof DialogPrimitive.Description>
React.ComponentProps<typeof DialogPrimitive.Description>
> = ({ className, ...props }) => {
return (
<DialogPrimitive.Description
@@ -22,7 +22,7 @@ export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
export const DropdownMenuContent: React.FC<
React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Content>
React.ComponentProps<typeof DropdownMenuPrimitive.Content>
> = ({ className, sideOffset = 4, ...props }) => {
return (
<DropdownMenuPrimitive.Portal>
@@ -35,7 +35,7 @@ export const DropdownMenuContent: React.FC<
);
};
type DropdownMenuItemProps = React.ComponentPropsWithRef<
type DropdownMenuItemProps = React.ComponentProps<
typeof DropdownMenuPrimitive.Item
> & {
inset?: boolean;
@@ -55,7 +55,7 @@ export const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({
};
export const DropdownMenuCheckboxItem: React.FC<
React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.CheckboxItem>
React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>
> = ({ className, children, ...props }) => {
return (
<DropdownMenuPrimitive.CheckboxItem
@@ -73,7 +73,7 @@ export const DropdownMenuCheckboxItem: React.FC<
};
export const DropdownMenuRadioItem: React.FC<
React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.RadioItem>
React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>
> = ({ className, children, ...props }) => {
return (
<DropdownMenuPrimitive.RadioItem
@@ -99,7 +99,7 @@ export const DropdownMenuRadioItem: React.FC<
export const DropdownMenuSub = DropdownMenuPrimitive.Sub;
export const DropdownMenuSubTrigger: React.FC<
React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.SubTrigger> & {
React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
inset?: boolean;
}
> = ({ className, inset, children, ...props }) => {
@@ -115,7 +115,7 @@ export const DropdownMenuSubTrigger: React.FC<
};
export const DropdownMenuSubContent: React.FC<
React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.SubContent>
React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>
> = ({ className, ...props }) => {
return (
<DropdownMenuPrimitive.Portal>
@@ -128,7 +128,7 @@ export const DropdownMenuSubContent: React.FC<
};
export const DropdownMenuSeparator: React.FC<
React.ComponentPropsWithRef<typeof DropdownMenuPrimitive.Separator>
React.ComponentProps<typeof DropdownMenuPrimitive.Separator>
> = ({ className, ...props }) => {
return (
<DropdownMenuPrimitive.Separator
@@ -1,7 +1,7 @@
import { useAppearance } from "#/theme/appearance";
import { getExternalImageStylesFromUrl } from "#/theme/externalImages";
export const ExternalImage: React.FC<React.ComponentPropsWithRef<"img">> = ({
export const ExternalImage: React.FC<React.ComponentProps<"img">> = ({
style,
alt = "",
...props
@@ -2,7 +2,7 @@ import { Command as CommandPrimitive, useCommandState } from "cmdk";
import { cn } from "cn";
import { XIcon } from "lucide-react";
import {
type ComponentPropsWithRef,
type ComponentProps,
createContext,
type FC,
type ReactNode,
@@ -133,7 +133,7 @@ export function FilterComboboxRoot({
);
}
type FilterComboboxContentProps = ComponentPropsWithRef<typeof PopoverContent>;
type FilterComboboxContentProps = ComponentProps<typeof PopoverContent>;
export const FilterComboboxContent: FC<FilterComboboxContentProps> = ({
className,
@@ -168,9 +168,7 @@ export const FilterComboboxContent: FC<FilterComboboxContentProps> = ({
);
};
type FilterComboboxListProps = ComponentPropsWithRef<
typeof CommandPrimitive.List
>;
type FilterComboboxListProps = ComponentProps<typeof CommandPrimitive.List>;
export const FilterComboboxList: FC<FilterComboboxListProps> = ({
className,
@@ -191,9 +189,7 @@ export const FilterComboboxList: FC<FilterComboboxListProps> = ({
);
};
type FilterComboboxItemProps = ComponentPropsWithRef<
typeof CommandPrimitive.Item
>;
type FilterComboboxItemProps = ComponentProps<typeof CommandPrimitive.Item>;
/**
* A dropdown row. Rows are actions, not toggles: pass `onSelect` to run the
@@ -216,9 +212,7 @@ export const FilterComboboxItem: FC<FilterComboboxItemProps> = ({
);
};
type FilterComboboxGroupProps = ComponentPropsWithRef<
typeof CommandPrimitive.Group
>;
type FilterComboboxGroupProps = ComponentProps<typeof CommandPrimitive.Group>;
export const FilterComboboxGroup: FC<FilterComboboxGroupProps> = ({
className,
@@ -233,7 +227,7 @@ export const FilterComboboxGroup: FC<FilterComboboxGroupProps> = ({
);
};
type FilterComboboxLabelProps = ComponentPropsWithRef<"div">;
type FilterComboboxLabelProps = ComponentProps<"div">;
export const FilterComboboxLabel: FC<FilterComboboxLabelProps> = ({
className,
@@ -248,7 +242,7 @@ export const FilterComboboxLabel: FC<FilterComboboxLabelProps> = ({
);
};
type FilterComboboxEmptyProps = ComponentPropsWithRef<"div">;
type FilterComboboxEmptyProps = ComponentProps<"div">;
export const FilterComboboxEmpty: FC<FilterComboboxEmptyProps> = ({
className,
@@ -268,7 +262,7 @@ export const FilterComboboxEmpty: FC<FilterComboboxEmptyProps> = ({
);
};
type FilterComboboxStatusProps = ComponentPropsWithRef<"div">;
type FilterComboboxStatusProps = ComponentProps<"div">;
export const FilterComboboxStatus: FC<FilterComboboxStatusProps> = ({
className,
@@ -285,7 +279,7 @@ export const FilterComboboxStatus: FC<FilterComboboxStatusProps> = ({
);
};
type FilterComboboxInputGroupProps = ComponentPropsWithRef<"div">;
type FilterComboboxInputGroupProps = ComponentProps<"div">;
export const FilterComboboxInputGroup: FC<FilterComboboxInputGroupProps> = ({
className,
@@ -304,7 +298,7 @@ export const FilterComboboxInputGroup: FC<FilterComboboxInputGroupProps> = ({
);
};
type FilterComboboxChipsProps = ComponentPropsWithRef<"div">;
type FilterComboboxChipsProps = ComponentProps<"div">;
export const FilterComboboxChips: FC<FilterComboboxChipsProps> = ({
className,
@@ -322,7 +316,7 @@ export const FilterComboboxChips: FC<FilterComboboxChipsProps> = ({
);
};
type FilterComboboxChipProps = ComponentPropsWithRef<typeof Badge> & {
type FilterComboboxChipProps = ComponentProps<typeof Badge> & {
/**
* Token passed to `onRemoveValue` when the chip is removed. Decoupled from
* `children` so the chip can render richer content than a bare string.
@@ -385,7 +379,7 @@ export const FilterComboboxChip: FC<FilterComboboxChipProps> = ({
);
};
type FilterComboboxChipsInputProps = ComponentPropsWithRef<
type FilterComboboxChipsInputProps = ComponentProps<
typeof CommandPrimitive.Input
>;
+1 -1
View File
@@ -12,7 +12,7 @@ type ControlProps = Pick<
"id" | "aria-invalid" | "aria-describedby"
>;
type FormFieldProps = React.ComponentPropsWithRef<"input"> & {
type FormFieldProps = React.ComponentProps<"input"> & {
field: FormHelpers;
label: ReactNode;
description?: ReactNode;
@@ -36,7 +36,7 @@ export const HelpPopoverContent: FC<PopoverContentProps> = ({
);
};
type HelpPopoverIconTriggerProps = React.ComponentPropsWithRef<"button"> & {
type HelpPopoverIconTriggerProps = React.ComponentProps<"button"> & {
size?: Size;
hoverEffect?: boolean;
};
+2 -2
View File
@@ -1,6 +1,6 @@
import { cn } from "cn";
import {
type ComponentPropsWithRef,
type ComponentProps,
type FC,
lazy,
type ReactNode,
@@ -26,7 +26,7 @@ import {
const EmojiPicker = lazy(() => import("./EmojiPicker"));
type IconFieldProps = Omit<ComponentPropsWithRef<"input">, "type"> & {
type IconFieldProps = Omit<ComponentProps<"input">, "type"> & {
label?: ReactNode;
error?: boolean;
helperText?: ReactNode;
+2 -2
View File
@@ -4,9 +4,9 @@
*/
import { cn } from "cn";
import type { ComponentPropsWithRef, FC } from "react";
import type { ComponentProps, FC } from "react";
type InputProps = ComponentPropsWithRef<"input">;
type InputProps = ComponentProps<"input">;
export const Input: FC<InputProps> = ({ className, type, ...props }) => {
return (
@@ -62,9 +62,10 @@ export const InputGroupAddon: React.FC<
);
};
export const InputGroupInput: React.FC<
React.ComponentPropsWithRef<typeof Input>
> = ({ className, ...props }) => {
export const InputGroupInput: React.FC<React.ComponentProps<typeof Input>> = ({
className,
...props
}) => {
return (
<Input
className={cn(
+1 -1
View File
@@ -10,7 +10,7 @@ const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
);
type LabelProps = React.ComponentPropsWithRef<typeof LabelPrimitive.Root> &
type LabelProps = React.ComponentProps<typeof LabelPrimitive.Root> &
VariantProps<typeof labelVariants>;
export const Label: React.FC<LabelProps> = ({ className, ...props }) => {
@@ -6,7 +6,7 @@ import { Command as CommandPrimitive, useCommandState } from "cmdk";
import { cn } from "cn";
import { InfoIcon, XIcon } from "lucide-react";
import {
type ComponentPropsWithoutRef,
type ComponentProps,
type KeyboardEvent,
type ReactNode,
type Ref,
@@ -95,10 +95,10 @@ interface MultiSelectComboboxProps {
/** Allow user to create option when there is no option matched. */
creatable?: boolean;
/** Props of `Command` */
commandProps?: ComponentPropsWithoutRef<typeof Command>;
commandProps?: ComponentProps<typeof Command>;
/** Props of `CommandInput` */
inputProps?: Omit<
ComponentPropsWithoutRef<typeof CommandPrimitive.Input>,
ComponentProps<typeof CommandPrimitive.Input>,
"value" | "placeholder" | "disabled"
>;
/** hide or show the button that clears all the selected options. */
@@ -160,7 +160,7 @@ function isOptionsExist(groupOption: GroupOption, targetOption: Option[]) {
* @reference: https://github.com/hsuanyi-chou/shadcn-ui-expansions/issues/34#issuecomment-1949561607
**/
const CommandEmpty: React.FC<
React.ComponentPropsWithRef<typeof CommandPrimitive.Empty>
React.ComponentProps<typeof CommandPrimitive.Empty>
> = ({ className, ...props }) => {
const render = useCommandState((state) => state.filtered.count === 0);
@@ -32,7 +32,7 @@ export const PageHeader: FC<PageHeaderProps> = ({
);
};
type PageHeaderTitleProps = React.ComponentPropsWithRef<"h1">;
type PageHeaderTitleProps = React.ComponentProps<"h1">;
export const PageHeaderTitle: FC<PageHeaderTitleProps> = ({
children,
@@ -52,7 +52,7 @@ export const PageHeaderTitle: FC<PageHeaderTitleProps> = ({
);
};
type PageHeaderSubtitleProps = React.ComponentPropsWithRef<"h2">;
type PageHeaderSubtitleProps = React.ComponentProps<"h2">;
export const PageHeaderSubtitle: FC<PageHeaderSubtitleProps> = ({
children,
@@ -72,7 +72,7 @@ export const PageHeaderSubtitle: FC<PageHeaderSubtitleProps> = ({
);
};
type PageHeaderCaptionProps = React.ComponentPropsWithRef<"span">;
type PageHeaderCaptionProps = React.ComponentProps<"span">;
export const PageHeaderCaption: FC<PageHeaderCaptionProps> = ({
children,
+1 -1
View File
@@ -6,7 +6,7 @@
import { cn } from "cn";
import { Popover as PopoverPrimitive } from "radix-ui";
export type PopoverContentProps = React.ComponentPropsWithRef<
export type PopoverContentProps = React.ComponentProps<
typeof PopoverPrimitive.Content
> & {
disablePortal?: boolean;
@@ -8,7 +8,7 @@ import { CircleIcon } from "lucide-react";
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
export const RadioGroup: React.FC<
React.ComponentPropsWithRef<typeof RadioGroupPrimitive.Root>
React.ComponentProps<typeof RadioGroupPrimitive.Root>
> = ({ className, ...props }) => {
return (
<RadioGroupPrimitive.Root
@@ -19,7 +19,7 @@ export const RadioGroup: React.FC<
};
export const RadioGroupItem: React.FC<
React.ComponentPropsWithRef<typeof RadioGroupPrimitive.Item>
React.ComponentProps<typeof RadioGroupPrimitive.Item>
> = ({ className, ...props }) => {
return (
<RadioGroupPrimitive.Item
@@ -7,7 +7,7 @@ import { cn } from "cn";
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
interface ScrollAreaProps
extends React.ComponentPropsWithRef<typeof ScrollAreaPrimitive.Root> {
extends React.ComponentProps<typeof ScrollAreaPrimitive.Root> {
scrollBarClassName?: string;
horizontalScrollBarClassName?: string;
/** Extra thumb classes; also reaches the thumb's `::before` hit-target. */
@@ -69,9 +69,7 @@ export const ScrollArea: React.FC<ScrollAreaProps> = ({
};
const ScrollBar: React.FC<
React.ComponentPropsWithRef<
typeof ScrollAreaPrimitive.ScrollAreaScrollbar
> & {
React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar> & {
thumbClassName?: string;
}
> = ({ className, orientation = "vertical", thumbClassName, ...props }) => {
+6 -8
View File
@@ -18,9 +18,7 @@ export const SelectGroup = SelectPrimitive.Group;
export const SelectValue = SelectPrimitive.Value;
type SelectTriggerProps = React.ComponentPropsWithRef<
typeof SelectPrimitive.Trigger
>;
type SelectTriggerProps = React.ComponentProps<typeof SelectPrimitive.Trigger>;
export const SelectTrigger: React.FC<SelectTriggerProps> = ({
className,
@@ -46,7 +44,7 @@ export const SelectTrigger: React.FC<SelectTriggerProps> = ({
);
const SelectScrollUpButton: React.FC<
React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollUpButton>
React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>
> = ({ className, ...props }) => (
<SelectPrimitive.ScrollUpButton
className={cn(
@@ -60,7 +58,7 @@ const SelectScrollUpButton: React.FC<
);
const SelectScrollDownButton: React.FC<
React.ComponentPropsWithRef<typeof SelectPrimitive.ScrollDownButton>
React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>
> = ({ className, ...props }) => {
return (
<SelectPrimitive.ScrollDownButton
@@ -76,7 +74,7 @@ const SelectScrollDownButton: React.FC<
};
export const SelectContent: React.FC<
React.ComponentPropsWithRef<typeof SelectPrimitive.Content>
React.ComponentProps<typeof SelectPrimitive.Content>
> = ({ className, children, position = "popper", ...props }) => (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
@@ -111,7 +109,7 @@ export const SelectContent: React.FC<
);
export const SelectLabel: React.FC<
React.ComponentPropsWithRef<typeof SelectPrimitive.Label>
React.ComponentProps<typeof SelectPrimitive.Label>
> = ({ className, ...props }) => {
return (
<SelectPrimitive.Label
@@ -122,7 +120,7 @@ export const SelectLabel: React.FC<
};
export const SelectItem: React.FC<
React.ComponentPropsWithRef<typeof SelectPrimitive.Item>
React.ComponentProps<typeof SelectPrimitive.Item>
> = ({ className, children, ...props }) => (
<SelectPrimitive.Item
className={cn(
+1 -1
View File
@@ -7,7 +7,7 @@ import { cn } from "cn";
import { Slider as SliderPrimitive } from "radix-ui";
export const Slider: React.FC<
React.ComponentPropsWithRef<typeof SliderPrimitive.Root>
React.ComponentProps<typeof SliderPrimitive.Root>
> = ({ className, defaultValue, value, min = 0, max = 100, ...props }) => {
const thumbCount = Array.isArray(value)
? value.length
@@ -34,7 +34,7 @@ type StatusIndicatorContextValue = VariantProps<typeof statusIndicatorVariants>;
const StatusIndicatorContext = createContext<StatusIndicatorContextValue>({});
export type StatusIndicatorProps = React.ComponentPropsWithRef<"div"> &
export type StatusIndicatorProps = React.ComponentProps<"div"> &
StatusIndicatorContextValue;
export const StatusIndicator: React.FC<StatusIndicatorProps> = ({
+1 -1
View File
@@ -43,7 +43,7 @@ const thumbVariants = cva(
},
);
type SwitchProps = React.ComponentPropsWithRef<typeof SwitchPrimitives.Root> &
type SwitchProps = React.ComponentProps<typeof SwitchPrimitives.Root> &
VariantProps<typeof switchVariants>;
export const Switch: React.FC<SwitchProps> = ({
+6 -6
View File
@@ -5,7 +5,7 @@
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "cn";
type TableProps = React.ComponentPropsWithRef<"table"> & {
type TableProps = React.ComponentProps<"table"> & {
wrapperClassName?: string;
};
@@ -27,7 +27,7 @@ export const Table: React.FC<TableProps> = ({
);
};
export const TableHeader: React.FC<React.ComponentPropsWithRef<"thead">> = ({
export const TableHeader: React.FC<React.ComponentProps<"thead">> = ({
className,
...props
}) => {
@@ -42,7 +42,7 @@ const tableBodyVariants = cva(null, {
},
});
type TableBodyProps = React.ComponentPropsWithRef<"tbody"> &
type TableBodyProps = React.ComponentProps<"tbody"> &
VariantProps<typeof tableBodyVariants>;
export const TableBody: React.FC<TableBodyProps> = ({
@@ -65,7 +65,7 @@ export const TableBody: React.FC<TableBodyProps> = ({
);
};
export const TableFooter: React.FC<React.ComponentPropsWithRef<"tfoot">> = ({
export const TableFooter: React.FC<React.ComponentProps<"tfoot">> = ({
className,
...props
}) => {
@@ -121,7 +121,7 @@ export const TableRow: React.FC<TableRowProps> = ({
);
};
export const TableHead: React.FC<React.ComponentPropsWithRef<"th">> = ({
export const TableHead: React.FC<React.ComponentProps<"th">> = ({
className,
scope = "col",
...props
@@ -139,7 +139,7 @@ export const TableHead: React.FC<React.ComponentPropsWithRef<"th">> = ({
);
};
export const TableCell: React.FC<React.ComponentPropsWithRef<"td">> = ({
export const TableCell: React.FC<React.ComponentProps<"td">> = ({
className,
...props
}) => {
+1 -1
View File
@@ -4,7 +4,7 @@
*/
import { cn } from "cn";
export const Textarea: React.FC<React.ComponentPropsWithRef<"textarea">> = ({
export const Textarea: React.FC<React.ComponentProps<"textarea">> = ({
className,
...props
}) => {
+1 -1
View File
@@ -20,7 +20,7 @@ export const TooltipTrigger = TooltipPrimitive.Trigger;
export const TooltipArrow = TooltipPrimitive.Arrow;
type TooltipContentProps = React.ComponentPropsWithRef<
type TooltipContentProps = React.ComponentProps<
typeof TooltipPrimitive.Content
> & {
disablePortal?: boolean;
@@ -33,7 +33,7 @@ const fallbackLog: WorkspaceAgentLogSource = {
};
type AgentLogsProps = Omit<
React.ComponentPropsWithoutRef<typeof List>,
React.ComponentProps<typeof List>,
"children" | "itemSize" | "itemCount" | "itemKey"
> & {
logs: readonly Line[];
@@ -21,7 +21,7 @@ type BaseBarProps<T> = Omit<T, "size" | "color"> & {
colors?: BarColors;
};
type BarProps = BaseBarProps<React.ComponentPropsWithRef<"div">>;
type BarProps = BaseBarProps<React.ComponentProps<"div">>;
export const Bar: React.FC<BarProps> = ({
colors,
@@ -43,7 +43,7 @@ export const Bar: React.FC<BarProps> = ({
);
};
type ClickableBarProps = BaseBarProps<React.ComponentPropsWithRef<"button">>;
type ClickableBarProps = BaseBarProps<React.ComponentProps<"button">>;
export const ClickableBar: React.FC<ClickableBarProps> = ({
colors,
@@ -1,7 +1,7 @@
import { cn } from "cn";
import type { ComponentPropsWithRef } from "react";
import type { ComponentProps } from "react";
type ConversationProps = ComponentPropsWithRef<"div">;
type ConversationProps = ComponentProps<"div">;
export const Conversation = ({
className,
@@ -17,7 +17,7 @@ export const Conversation = ({
);
};
type ConversationItemProps = Omit<ComponentPropsWithRef<"div">, "role"> & {
type ConversationItemProps = Omit<ComponentProps<"div">, "role"> & {
role: "user" | "assistant";
};
@@ -1,7 +1,7 @@
import { cn } from "cn";
import type { ComponentPropsWithRef } from "react";
import type { ComponentProps } from "react";
type MessageProps = ComponentPropsWithRef<"div">;
type MessageProps = ComponentProps<"div">;
export const Message = ({ className, ref, ...props }: MessageProps) => {
return (
@@ -9,7 +9,7 @@ export const Message = ({ className, ref, ...props }: MessageProps) => {
);
};
type MessageContentProps = ComponentPropsWithRef<"div">;
type MessageContentProps = ComponentProps<"div">;
export const MessageContent = ({
className,
@@ -3,7 +3,7 @@ import {
type SupportedLanguages,
} from "@pierre/diffs/react";
import { cn } from "cn";
import type { ComponentPropsWithRef, ReactNode } from "react";
import type { ComponentProps, ReactNode } from "react";
import {
type Components,
defaultRehypePlugins,
@@ -15,7 +15,7 @@ import { useTheme } from "#/theme/context";
import { MarkdownImage } from "./MarkdownImage";
import { MermaidDiagram } from "./MermaidDiagram";
interface ResponseProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
interface ResponseProps extends Omit<ComponentProps<"div">, "children"> {
children: string;
urlTransform?: UrlTransform;
/** Enable streaming-mode Streamdown with incomplete-markdown
@@ -1,8 +1,8 @@
import { cn } from "cn";
import { Slot } from "radix-ui";
import type { ComponentPropsWithRef, FC } from "react";
import type { ComponentProps, FC } from "react";
type TranscriptRowProps = ComponentPropsWithRef<"div"> & {
type TranscriptRowProps = ComponentProps<"div"> & {
asChild?: boolean;
};
@@ -1,6 +1,6 @@
import { File as FileViewer } from "@pierre/diffs/react";
import { cn } from "cn";
import { type ComponentPropsWithRef, type FC, memo } from "react";
import { type ComponentProps, type FC, memo } from "react";
import type * as TypesGen from "#/api/typesGenerated";
import { ScrollArea } from "#/components/ScrollArea/ScrollArea";
import { useTheme } from "#/theme/context";
@@ -64,7 +64,7 @@ import {
import { WriteFileTool } from "./WriteFileTool";
interface ToolProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
interface ToolProps extends Omit<ComponentProps<"div">, "children"> {
organizationId?: string;
name: string;
status?: ToolStatus;
@@ -861,8 +861,8 @@ const ComputerRenderer: FC<ToolRendererProps> = ({
type ToolFileViewerProps = {
label?: string;
file: ComponentPropsWithRef<typeof FileViewer>["file"];
options: ComponentPropsWithRef<typeof FileViewer>["options"];
file: ComponentProps<typeof FileViewer>["file"];
options: ComponentProps<typeof FileViewer>["options"];
};
const ToolFileViewer: FC<ToolFileViewerProps> = ({ label, file, options }) => (
@@ -898,7 +898,7 @@ const ToolFileViewer: FC<ToolFileViewerProps> = ({ label, file, options }) => (
type GenericToolContentProps = {
toolInput: string | null;
fileContent: ReturnType<typeof getFileContentForViewer>;
fileContentOptions: ComponentPropsWithRef<typeof FileViewer>["options"];
fileContentOptions: ComponentProps<typeof FileViewer>["options"];
isDark: boolean;
resultOutput: string | null;
};
@@ -6,7 +6,7 @@ import {
TriangleAlertIcon,
} from "lucide-react";
import {
type ComponentPropsWithoutRef,
type ComponentProps,
createContext,
type FC,
type ReactNode,
@@ -105,7 +105,7 @@ const useToolCallContext = () => {
* Standard `div` attributes are forwarded to the wrapper element so
* callers can attach semantics such as live region roles.
*/
type ToolCallRootProps = Omit<ComponentPropsWithoutRef<"div">, "children"> & {
type ToolCallRootProps = Omit<ComponentProps<"div">, "children"> & {
children: ReactNode;
status: ToolStatus;
isError?: boolean;
+1 -1
View File
@@ -171,7 +171,7 @@ export const SectionLabel: FC<HTMLAttributes<HTMLHeadingElement>> = ({
);
};
type PillProps = React.ComponentPropsWithRef<"div"> & {
type PillProps = React.ComponentProps<"div"> & {
icon: ReactElement<HTMLAttributes<HTMLElement>>;
};