Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

refactor(frontend): adopt shadcn/ui new-york-v4 component style

Sergey Kozyrenko99f8485ae0be
diff --git a/frontend/src/components/shared/header-button.tsx b/frontend/src/components/shared/header-button.tsx
index 32a65aad..fbf6b60f 100644
--- a/frontend/src/components/shared/header-button.tsx
+++ b/frontend/src/components/shared/header-button.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode, Ref } from 'react';
+import type { ReactNode } from 'react';
import { Button, type ButtonProps } from '@/components/ui/button';
import { cn } from '@/lib/utils';
@@ -7,7 +7,6 @@ interface HeaderButtonProps extends Omit<ButtonProps, 'children'> {
endIcon?: ReactNode;
icon: ReactNode;
label: ReactNode;
- ref?: Ref<HTMLButtonElement>;
}
// Action button rendered inside a page header. Collapses to an icon-only square
@@ -16,23 +15,21 @@ interface HeaderButtonProps extends Omit<ButtonProps, 'children'> {
// trailing icon, e.g. a dropdown chevron) on wider screens. `aria-label` is
// auto-derived from `label` when it's a plain string so the icon-only mobile
// state stays accessible without the caller having to remember it.
-export const HeaderButton = ({
+export function HeaderButton({
'aria-label': ariaLabel,
className,
endIcon,
icon,
label,
- ref,
size = 'sm',
...props
-}: HeaderButtonProps) => {
+}: HeaderButtonProps) {
const accessibleLabel = ariaLabel ?? (typeof label === 'string' ? label : undefined);
return (
<Button
aria-label={accessibleLabel}
className={cn('w-8 px-0 md:w-auto md:px-3', className)}
- ref={ref}
size={size}
{...props}
>
@@ -41,6 +38,4 @@ export const HeaderButton = ({
{endIcon ? <span className="hidden md:inline-flex">{endIcon}</span> : null}
</Button>
);
-};
-
-HeaderButton.displayName = 'HeaderButton';
+}
diff --git a/frontend/src/components/shared/markdown-editor.tsx b/frontend/src/components/shared/markdown-editor.tsx
index 966d3393..cc6f9450 100644
--- a/frontend/src/components/shared/markdown-editor.tsx
+++ b/frontend/src/components/shared/markdown-editor.tsx
@@ -95,7 +95,12 @@ const resetUndoHistory = (editor: Editor): void => {
view.dispatch(newState.tr.setMeta('addToHistory', false));
};
-const MarkdownEditor = ({
+interface MarkdownEditorToolbarProps {
+ disabled?: boolean;
+ editor: Editor;
+}
+
+function MarkdownEditor({
autoFocus,
className,
contentClassName,
@@ -106,7 +111,7 @@ const MarkdownEditor = ({
ref,
showToolbar = true,
value,
-}: MarkdownEditorProps & { ref?: Ref<MarkdownEditorHandle> }) => {
+}: MarkdownEditorProps & { ref?: Ref<MarkdownEditorHandle> }) {
const onChangeRef = useRef(onChange);
const onBlurRef = useRef(onBlur);
// Tracks the last markdown the editor reported externally. We compare
@@ -296,16 +301,9 @@ const MarkdownEditor = ({
/>
</div>
);
-};
-
-MarkdownEditor.displayName = 'MarkdownEditor';
-
-interface MarkdownEditorToolbarProps {
- disabled?: boolean;
- editor: Editor;
}
-const MarkdownEditorToolbar = ({ disabled, editor }: MarkdownEditorToolbarProps) => {
+function MarkdownEditorToolbar({ disabled, editor }: MarkdownEditorToolbarProps) {
const handleSetLink = useCallback(() => {
const previousUrl = editor.getAttributes('link').href as string | undefined;
const url = window.prompt('URL', previousUrl ?? '');
@@ -491,6 +489,6 @@ const MarkdownEditorToolbar = ({ disabled, editor }: MarkdownEditorToolbarProps)
</div>
</div>
);
-};
+}
export { MarkdownEditor };
diff --git a/frontend/src/components/ui/accordion.tsx b/frontend/src/components/ui/accordion.tsx
index 36a1194a..ffea337a 100644
--- a/frontend/src/components/ui/accordion.tsx
+++ b/frontend/src/components/ui/accordion.tsx
@@ -6,61 +6,41 @@ import { cn } from '@/lib/utils';
const Accordion = AccordionPrimitive.Root;
-const AccordionItem = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> & {
- ref?: React.Ref<React.ElementRef<typeof AccordionPrimitive.Item>>;
-}) => (
- <AccordionPrimitive.Item
- className={cn('border-b', className)}
- ref={ref}
- {...props}
- />
-);
-AccordionItem.displayName = 'AccordionItem';
-
-const AccordionTrigger = ({
- children,
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> & {
- ref?: React.Ref<React.ElementRef<typeof AccordionPrimitive.Trigger>>;
-}) => (
- <AccordionPrimitive.Header className="flex">
- <AccordionPrimitive.Trigger
- className={cn(
- 'flex flex-1 items-center justify-between py-4 text-left text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
- className,
- )}
- ref={ref}
+function AccordionContent({ children, className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
+ return (
+ <AccordionPrimitive.Content
+ className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
{...props}
>
- {children}
- <ChevronDownIcon className="text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200" />
- </AccordionPrimitive.Trigger>
- </AccordionPrimitive.Header>
-);
-AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
+ <div className={cn('pt-0 pb-4', className)}>{children}</div>
+ </AccordionPrimitive.Content>
+ );
+}
+
+function AccordionItem({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
+ return (
+ <AccordionPrimitive.Item
+ className={cn('border-b', className)}
+ {...props}
+ />
+ );
+}
-const AccordionContent = ({
- children,
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof AccordionPrimitive.Content>>;
-}) => (
- <AccordionPrimitive.Content
- className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
- ref={ref}
- {...props}
- >
- <div className={cn('pt-0 pb-4', className)}>{children}</div>
- </AccordionPrimitive.Content>
-);
-AccordionContent.displayName = AccordionPrimitive.Content.displayName;
+function AccordionTrigger({ children, className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
+ return (
+ <AccordionPrimitive.Header className="flex">
+ <AccordionPrimitive.Trigger
+ className={cn(
+ 'flex flex-1 items-center justify-between py-4 text-left text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronDownIcon className="text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200" />
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+ );
+}
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
diff --git a/frontend/src/components/ui/alert.tsx b/frontend/src/components/ui/alert.tsx
index e676ad6a..5e41ce51 100644
--- a/frontend/src/components/ui/alert.tsx
+++ b/frontend/src/components/ui/alert.tsx
@@ -18,45 +18,32 @@ const alertVariants = cva(
},
);
-const Alert = ({
- className,
- ref,
- variant,
- ...props
-}: React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants> & { ref?: React.Ref<HTMLDivElement> }) => (
- <div
- className={cn(alertVariants({ variant }), className)}
- ref={ref}
- role="alert"
- {...props}
- />
-);
-Alert.displayName = 'Alert';
+function Alert({ className, variant, ...props }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
+ return (
+ <div
+ className={cn(alertVariants({ variant }), className)}
+ role="alert"
+ {...props}
+ />
+ );
+}
-const AlertTitle = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLHeadingElement> & { ref?: React.Ref<HTMLParagraphElement> }) => (
- <h5
- className={cn('mb-1 leading-none font-medium tracking-tight', className)}
- ref={ref}
- {...props}
- />
-);
-AlertTitle.displayName = 'AlertTitle';
+function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('text-sm [&_p]:leading-relaxed', className)}
+ {...props}
+ />
+ );
+}
-const AlertDescription = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLParagraphElement> & { ref?: React.Ref<HTMLParagraphElement> }) => (
- <div
- className={cn('text-sm [&_p]:leading-relaxed', className)}
- ref={ref}
- {...props}
- />
-);
-AlertDescription.displayName = 'AlertDescription';
+function AlertTitle({ className, ...props }: React.ComponentProps<'h5'>) {
+ return (
+ <h5
+ className={cn('mb-1 leading-none font-medium tracking-tight', className)}
+ {...props}
+ />
+ );
+}
export { Alert, AlertDescription, AlertTitle };
diff --git a/frontend/src/components/ui/autocomplete.tsx b/frontend/src/components/ui/autocomplete.tsx
index 9192c91a..b233da17 100644
--- a/frontend/src/components/ui/autocomplete.tsx
+++ b/frontend/src/components/ui/autocomplete.tsx
@@ -119,6 +119,38 @@ const substringFilter = (value: string, search: string, keywords?: string[]): nu
return 0;
};
+export type AutocompleteContentProps = React.ComponentProps<typeof PopoverPrimitive.Content> & {
+ /**
+ * Class name for the inner cmdk `List`. Use this to override the default
+ * max-height (`max-h-[280px]`) per usage site.
+ */
+ listClassName?: string;
+};
+
+export type AutocompleteEmptyProps = React.ComponentProps<typeof CommandEmpty>;
+
+export type AutocompleteGroupProps = React.ComponentProps<typeof CommandGroup>;
+
+export type AutocompleteInputProps = Omit<
+ React.ComponentProps<'input'>,
+ 'defaultValue' | 'onChange' | 'type' | 'value'
+>;
+
+export type AutocompleteItemProps = Omit<React.ComponentProps<typeof CommandItem>, 'onSelect' | 'value'> & {
+ /**
+ * Optional custom select handler. When provided, you become responsible
+ * for committing the value (the default behaviour is a no-op so you can
+ * decide whether to commit, navigate, etc.). When omitted, the item
+ * commits its own `value` via `Autocomplete.onCommit`.
+ */
+ onSelect?: (value: string) => void;
+ /**
+ * The value committed when this item is chosen. Also fed into cmdk's
+ * filter (so make sure it matches what the user is likely to type).
+ */
+ value: string;
+};
+
export interface AutocompleteProps {
children: React.ReactNode;
defaultOpen?: boolean;
@@ -154,7 +186,9 @@ export interface AutocompleteProps {
value?: string;
}
-const Autocomplete = ({
+export type AutocompleteSeparatorProps = React.ComponentProps<typeof CommandSeparator>;
+
+function Autocomplete({
children,
defaultOpen = false,
defaultValue = '',
@@ -166,7 +200,7 @@ const Autocomplete = ({
openOnFocus = true,
shouldFilter,
value: valueProp,
-}: AutocompleteProps) => {
+}: AutocompleteProps) {
const [inputValue, setInputValue] = useControllable<string>(valueProp, defaultValue, onValueChange);
const [open, setOpen] = useControllable<boolean>(openProp, defaultOpen, onOpenChange);
const inputRef = React.useRef<HTMLInputElement | null>(null);
@@ -230,16 +264,156 @@ const Autocomplete = ({
</Popover>
</AutocompleteContext.Provider>
);
-};
+}
-Autocomplete.displayName = 'Autocomplete';
+function AutocompleteContent({
+ align = 'start',
+ children,
+ className,
+ listClassName,
+ onFocusOutside,
+ onInteractOutside,
+ onOpenAutoFocus,
+ ref,
+ sideOffset = 4,
+ ...props
+}: AutocompleteContentProps) {
+ const { inputRef } = useAutocompleteContext();
+ const contentRef = React.useRef<null | React.ComponentRef<typeof PopoverPrimitive.Content>>(null);
+ const composedRef = React.useCallback(
+ (node: null | React.ComponentRef<typeof PopoverPrimitive.Content>) => {
+ contentRef.current = node;
-export type AutocompleteInputProps = Omit<
- React.InputHTMLAttributes<HTMLInputElement>,
- 'defaultValue' | 'onChange' | 'type' | 'value'
->;
+ if (typeof ref === 'function') {
+ ref(node);
+ } else if (ref) {
+ (ref as React.MutableRefObject<typeof node>).current = node;
+ }
+ },
+ [ref],
+ );
-const AutocompleteInput = ({
+ return (
+ /*
+ * Render inline — NO `PopoverPrimitive.Portal`. When the autocomplete
+ * lives inside a Radix `Dialog`, the dialog locks scroll on `body`
+ * (`body { pointer-events: none }` + a wheel/touch interceptor on
+ * the document). A portal'd popover ends up on `body`, outside the
+ * dialog DOM, and inherits the lock — wheel events on the suggestion
+ * list never fire and the user can't scroll. Rendering inline keeps
+ * the popover inside the dialog content, where the scroll lock
+ * doesn't apply, while Radix Popper still positions it correctly
+ * relative to the anchor (the visible input).
+ *
+ * Styles are copied verbatim from `components/ui/popover.tsx` so
+ * appearance and animations stay consistent with shadcn defaults.
+ */
+ <PopoverPrimitive.Content
+ align={align}
+ className={cn(
+ '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 origin-(--radix-popover-content-transform-origin) rounded-md border shadow-md outline-hidden',
+ // Width matches the input (anchor); max-h keeps the popover
+ // inside the viewport when the suggestion list is large.
+ 'max-h-(--radix-popover-content-available-height) w-(--radix-popover-trigger-width) min-w-(--radix-popover-trigger-width) overflow-hidden p-0',
+ className,
+ )}
+ onFocusOutside={(event) => {
+ onFocusOutside?.(event);
+
+ if (event.defaultPrevented) {
+ return;
+ }
+
+ // Radix `DismissableLayer` treats the anchor input as
+ // "outside" (it isn't a Trigger), and its React-tree flag
+ // races on Content's own focusin when our `CommandList`
+ // synchronously bounces focus back to the input — both
+ // produce spurious `focusOutside` events that would
+ // dismiss the popover. Treat focus on the anchor input
+ // or anywhere inside Content as "inside".
+ //
+ // Radix dispatches this event directly on the focused
+ // element (`bubbles: false`), so `event.target` IS it.
+ const focusTarget = event.target as Node | null;
+ const focusInsideInput = !!(focusTarget && inputRef.current?.contains(focusTarget));
+ const focusInsideContent = !!(focusTarget && contentRef.current?.contains(focusTarget));
+
+ if (focusInsideInput || focusInsideContent) {
+ event.preventDefault();
+ }
+ }}
+ onInteractOutside={(event) => {
+ onInteractOutside?.(event);
+
+ if (event.defaultPrevented) {
+ return;
+ }
+
+ // Clicking the input itself shouldn't dismiss the popover —
+ // Radix treats the anchor as "outside" since it isn't a
+ // Trigger. The real pointer target is the focused
+ // element via `event.target` (custom event is
+ // dispatched on the target, `bubbles: false`).
+ const interactTarget = event.target as Node | null;
+
+ if (interactTarget && inputRef.current?.contains(interactTarget)) {
+ event.preventDefault();
+ }
+ }}
+ onOpenAutoFocus={(event) => {
+ onOpenAutoFocus?.(event);
+
+ if (event.defaultPrevented) {
+ return;
+ }
+
+ // Keep focus on the input so typing keeps working immediately.
+ event.preventDefault();
+ }}
+ ref={composedRef}
+ sideOffset={sideOffset}
+ {...props}
+ >
+ {/*
+ * Explicit max-height + scroll on the cmdk list. shadcn's
+ * `CommandList` defaults to `max-h-[300px] overflow-y-auto`, but
+ * re-applying it here lets consumers override the cap via
+ * `listClassName` without losing scroll behaviour, and pins the
+ * list so a long suggestion set scrolls inside the popover
+ * instead of pushing the popover past the viewport.
+ */}
+ <CommandList
+ className={cn('max-h-[280px] overflow-x-hidden overflow-y-auto', listClassName)}
+ onFocus={(event) => {
+ // cmdk re-focuses the input by id when its value
+ // changes (`document.getElementById(inputId).focus()`),
+ // falling back to the list when the lookup fails — and
+ // it fails as soon as a wrapper like `FormControl`
+ // overrides the input's id via Radix Slot. The listbox
+ // then steals focus and typing breaks. Per the
+ // aria-activedescendant pattern the listbox shouldn't
+ // hold real focus (tabindex=-1), so bounce it back.
+ // `target === currentTarget` skips legitimate child focus.
+ if (event.target === event.currentTarget) {
+ inputRef.current?.focus();
+ }
+ }}
+ >
+ {children}
+ </CommandList>
+ </PopoverPrimitive.Content>
+ );
+}
+
+function AutocompleteEmpty(props: AutocompleteEmptyProps) {
+ return <CommandEmpty {...props} />;
+}
+
+function AutocompleteGroup(props: AutocompleteGroupProps) {
+ return <CommandGroup {...props} />;
+}
+
+function AutocompleteInput({
className,
id,
onFocus,
@@ -247,7 +421,7 @@ const AutocompleteInput = ({
onPointerDown,
ref: forwardedRef,
...props
-}: AutocompleteInputProps & { ref?: React.Ref<HTMLInputElement> }) => {
+}: AutocompleteInputProps & { ref?: React.Ref<HTMLInputElement> }) {
const { commit, inputId, inputRef, inputValue, open, openOnFocus, setInputValue, setOpen } =
useAutocompleteContext();
@@ -386,206 +560,9 @@ const AutocompleteInput = ({
</CommandPrimitive.Input>
</PopoverAnchor>
);
-};
-
-AutocompleteInput.displayName = 'AutocompleteInput';
-
-export type AutocompleteContentProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
- /**
- * Class name for the inner cmdk `List`. Use this to override the default
- * max-height (`max-h-[280px]`) per usage site.
- */
- listClassName?: string;
-};
-
-const AutocompleteContent = ({
- align = 'start',
- children,
- className,
- listClassName,
- onFocusOutside,
- onInteractOutside,
- onOpenAutoFocus,
- ref,
- sideOffset = 4,
- ...props
-}: AutocompleteContentProps & { ref?: React.Ref<React.ElementRef<typeof PopoverPrimitive.Content>> }) => {
- const { inputRef } = useAutocompleteContext();
- const contentRef = React.useRef<null | React.ElementRef<typeof PopoverPrimitive.Content>>(null);
- const composedRef = React.useCallback(
- (node: null | React.ElementRef<typeof PopoverPrimitive.Content>) => {
- contentRef.current = node;
-
- if (typeof ref === 'function') {
- ref(node);
- } else if (ref) {
- (ref as React.MutableRefObject<typeof node>).current = node;
- }
- },
- [ref],
- );
-
- return (
- /*
- * Render inline — NO `PopoverPrimitive.Portal`. When the autocomplete
- * lives inside a Radix `Dialog`, the dialog locks scroll on `body`
- * (`body { pointer-events: none }` + a wheel/touch interceptor on
- * the document). A portal'd popover ends up on `body`, outside the
- * dialog DOM, and inherits the lock — wheel events on the suggestion
- * list never fire and the user can't scroll. Rendering inline keeps
- * the popover inside the dialog content, where the scroll lock
- * doesn't apply, while Radix Popper still positions it correctly
- * relative to the anchor (the visible input).
- *
- * Styles are copied verbatim from `components/ui/popover.tsx` so
- * appearance and animations stay consistent with shadcn defaults.
- */
- <PopoverPrimitive.Content
- align={align}
- className={cn(
- '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 origin-(--radix-popover-content-transform-origin) rounded-md border shadow-md outline-hidden',
- // Width matches the input (anchor); max-h keeps the popover
- // inside the viewport when the suggestion list is large.
- 'max-h-(--radix-popover-content-available-height) w-(--radix-popover-trigger-width) min-w-(--radix-popover-trigger-width) overflow-hidden p-0',
- className,
- )}
- onFocusOutside={(event) => {
- onFocusOutside?.(event);
-
- if (event.defaultPrevented) {
- return;
- }
-
- // Radix `DismissableLayer` treats the anchor input as
- // "outside" (it isn't a Trigger), and its React-tree flag
- // races on Content's own focusin when our `CommandList`
- // synchronously bounces focus back to the input — both
- // produce spurious `focusOutside` events that would
- // dismiss the popover. Treat focus on the anchor input
- // or anywhere inside Content as "inside".
- //
- // Radix dispatches this event directly on the focused
- // element (`bubbles: false`), so `event.target` IS it.
- const focusTarget = event.target as Node | null;
- const focusInsideInput = !!(focusTarget && inputRef.current?.contains(focusTarget));
- const focusInsideContent = !!(focusTarget && contentRef.current?.contains(focusTarget));
-
- if (focusInsideInput || focusInsideContent) {
- event.preventDefault();
- }
- }}
- onInteractOutside={(event) => {
- onInteractOutside?.(event);
-
- if (event.defaultPrevented) {
- return;
- }
-
- // Clicking the input itself shouldn't dismiss the popover —
- // Radix treats the anchor as "outside" since it isn't a
- // Trigger. The real pointer target is the focused
- // element via `event.target` (custom event is
- // dispatched on the target, `bubbles: false`).
- const interactTarget = event.target as Node | null;
-
- if (interactTarget && inputRef.current?.contains(interactTarget)) {
- event.preventDefault();
- }
- }}
- onOpenAutoFocus={(event) => {
- onOpenAutoFocus?.(event);
-
- if (event.defaultPrevented) {
- return;
- }
-
- // Keep focus on the input so typing keeps working immediately.
- event.preventDefault();
- }}
- ref={composedRef}
- sideOffset={sideOffset}
- {...props}
- >
- {/*
- * Explicit max-height + scroll on the cmdk list. shadcn's
- * `CommandList` defaults to `max-h-[300px] overflow-y-auto`, but
- * re-applying it here lets consumers override the cap via
- * `listClassName` without losing scroll behaviour, and pins the
- * list so a long suggestion set scrolls inside the popover
- * instead of pushing the popover past the viewport.
- */}
- <CommandList
- className={cn('max-h-[280px] overflow-x-hidden overflow-y-auto', listClassName)}
- onFocus={(event) => {
- // cmdk re-focuses the input by id when its value
- // changes (`document.getElementById(inputId).focus()`),
- // falling back to the list when the lookup fails — and
- // it fails as soon as a wrapper like `FormControl`
- // overrides the input's id via Radix Slot. The listbox
- // then steals focus and typing breaks. Per the
- // aria-activedescendant pattern the listbox shouldn't
- // hold real focus (tabindex=-1), so bounce it back.
- // `target === currentTarget` skips legitimate child focus.
- if (event.target === event.currentTarget) {
- inputRef.current?.focus();
- }
- }}
- >
- {children}
- </CommandList>
- </PopoverPrimitive.Content>
- );
-};
-
-AutocompleteContent.displayName = 'AutocompleteContent';
-
-export type AutocompleteEmptyProps = React.ComponentPropsWithoutRef<typeof CommandEmpty>;
-
-const AutocompleteEmpty = ({
- ref,
- ...props
-}: AutocompleteEmptyProps & { ref?: React.Ref<React.ElementRef<typeof CommandEmpty>> }) => (
- <CommandEmpty
- ref={ref}
- {...props}
- />
-);
-AutocompleteEmpty.displayName = 'AutocompleteEmpty';
-
-export type AutocompleteGroupProps = React.ComponentPropsWithoutRef<typeof CommandGroup>;
-
-const AutocompleteGroup = ({
- ref,
- ...props
-}: AutocompleteGroupProps & { ref?: React.Ref<React.ElementRef<typeof CommandGroup>> }) => (
- <CommandGroup
- ref={ref}
- {...props}
- />
-);
-AutocompleteGroup.displayName = 'AutocompleteGroup';
-
-export type AutocompleteItemProps = Omit<React.ComponentPropsWithoutRef<typeof CommandItem>, 'onSelect' | 'value'> & {
- /**
- * Optional custom select handler. When provided, you become responsible
- * for committing the value (the default behaviour is a no-op so you can
- * decide whether to commit, navigate, etc.). When omitted, the item
- * commits its own `value` via `Autocomplete.onCommit`.
- */
- onSelect?: (value: string) => void;
- /**
- * The value committed when this item is chosen. Also fed into cmdk's
- * filter (so make sure it matches what the user is likely to type).
- */
- value: string;
-};
+}
-const AutocompleteItem = ({
- onSelect,
- ref,
- value,
- ...props
-}: AutocompleteItemProps & { ref?: React.Ref<React.ElementRef<typeof CommandItem>> }) => {
+function AutocompleteItem({ onSelect, value, ...props }: AutocompleteItemProps) {
const { commit } = useAutocompleteContext();
return (
@@ -599,27 +576,15 @@ const AutocompleteItem = ({
commit(selected);
}}
- ref={ref}
value={value}
{...props}
/>
);
-};
-
-AutocompleteItem.displayName = 'AutocompleteItem';
-
-export type AutocompleteSeparatorProps = React.ComponentPropsWithoutRef<typeof CommandSeparator>;
+}
-const AutocompleteSeparator = ({
- ref,
- ...props
-}: AutocompleteSeparatorProps & { ref?: React.Ref<React.ElementRef<typeof CommandSeparator>> }) => (
- <CommandSeparator
- ref={ref}
- {...props}
- />
-);
-AutocompleteSeparator.displayName = 'AutocompleteSeparator';
+function AutocompleteSeparator(props: AutocompleteSeparatorProps) {
+ return <CommandSeparator {...props} />;
+}
export {
Autocomplete,
diff --git a/frontend/src/components/ui/avatar.tsx b/frontend/src/components/ui/avatar.tsx
index 02c016c0..689d6216 100644
--- a/frontend/src/components/ui/avatar.tsx
+++ b/frontend/src/components/ui/avatar.tsx
@@ -3,49 +3,31 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Avatar = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> & {
- ref?: React.Ref<React.ElementRef<typeof AvatarPrimitive.Root>>;
-}) => (
- <AvatarPrimitive.Root
- className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
- ref={ref}
- {...props}
- />
-);
-Avatar.displayName = AvatarPrimitive.Root.displayName;
+function Avatar({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
+ return (
+ <AvatarPrimitive.Root
+ className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
+ {...props}
+ />
+ );
+}
-const AvatarImage = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> & {
- ref?: React.Ref<React.ElementRef<typeof AvatarPrimitive.Image>>;
-}) => (
- <AvatarPrimitive.Image
- className={cn('aspect-square h-full w-full', className)}
- ref={ref}
- {...props}
- />
-);
-AvatarImage.displayName = AvatarPrimitive.Image.displayName;
+function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
+ return (
+ <AvatarPrimitive.Fallback
+ className={cn('bg-muted flex h-full w-full items-center justify-center rounded-full', className)}
+ {...props}
+ />
+ );
+}
-const AvatarFallback = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> & {
- ref?: React.Ref<React.ElementRef<typeof AvatarPrimitive.Fallback>>;
-}) => (
- <AvatarPrimitive.Fallback
- className={cn('bg-muted flex h-full w-full items-center justify-center rounded-full', className)}
- ref={ref}
- {...props}
- />
-);
-AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
+function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
+ return (
+ <AvatarPrimitive.Image
+ className={cn('aspect-square h-full w-full', className)}
+ {...props}
+ />
+ );
+}
export { Avatar, AvatarFallback, AvatarImage };
diff --git a/frontend/src/components/ui/breadcrumb.tsx b/frontend/src/components/ui/breadcrumb.tsx
index 5526aab8..97c5f69c 100644
--- a/frontend/src/components/ui/breadcrumb.tsx
+++ b/frontend/src/components/ui/breadcrumb.tsx
@@ -4,112 +4,95 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Breadcrumb = ({
- ref,
+function Breadcrumb({
...props
-}: React.ComponentPropsWithoutRef<'nav'> & {
- ref?: React.Ref<HTMLElement>;
+}: React.ComponentProps<'nav'> & {
separator?: React.ReactNode;
-}) => (
- <nav
- aria-label="breadcrumb"
- ref={ref}
- {...props}
- />
-);
-Breadcrumb.displayName = 'Breadcrumb';
+}) {
+ return (
+ <nav
+ aria-label="breadcrumb"
+ {...props}
+ />
+ );
+}
-const BreadcrumbList = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<'ol'> & { ref?: React.Ref<HTMLOListElement> }) => (
- <ol
- className={cn(
- 'text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm wrap-break-word sm:gap-2.5',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-BreadcrumbList.displayName = 'BreadcrumbList';
+function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<'span'>) {
+ return (
+ <span
+ aria-hidden="true"
+ className={cn('flex h-9 w-9 items-center justify-center', className)}
+ role="presentation"
+ {...props}
+ >
+ <DotsHorizontalIcon className="h-4 w-4" />
+ <span className="sr-only">More</span>
+ </span>
+ );
+}
-const BreadcrumbItem = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<'li'> & { ref?: React.Ref<HTMLLIElement> }) => (
- <li
- className={cn('inline-flex items-center gap-1.5', className)}
- ref={ref}
- {...props}
- />
-);
-BreadcrumbItem.displayName = 'BreadcrumbItem';
+function BreadcrumbItem({ className, ...props }: React.ComponentProps<'li'>) {
+ return (
+ <li
+ className={cn('inline-flex items-center gap-1.5', className)}
+ {...props}
+ />
+ );
+}
-const BreadcrumbLink = ({
+function BreadcrumbLink({
asChild,
className,
- ref,
...props
-}: React.ComponentPropsWithoutRef<'a'> & {
+}: React.ComponentProps<'a'> & {
asChild?: boolean;
- ref?: React.Ref<HTMLAnchorElement>;
-}) => {
+}) {
const Comp = asChild ? Slot : 'a';
return (
<Comp
className={cn('hover:text-foreground transition-colors', className)}
- ref={ref}
{...props}
/>
);
-};
-
-BreadcrumbLink.displayName = 'BreadcrumbLink';
+}
-const BreadcrumbPage = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<'span'> & { ref?: React.Ref<HTMLSpanElement> }) => (
- <span
- aria-current="page"
- aria-disabled="true"
- className={cn('text-foreground font-normal', className)}
- ref={ref}
- role="link"
- {...props}
- />
-);
-BreadcrumbPage.displayName = 'BreadcrumbPage';
+function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>) {
+ return (
+ <ol
+ className={cn(
+ 'text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm wrap-break-word sm:gap-2.5',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<'li'>) => (
- <li
- aria-hidden="true"
- className={cn('[&>svg]:h-3.5 [&>svg]:w-3.5', className)}
- role="presentation"
- {...props}
- >
- {children ?? <ChevronRightIcon />}
- </li>
-);
-BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
+function BreadcrumbPage({ className, ...props }: React.ComponentProps<'span'>) {
+ return (
+ <span
+ aria-current="page"
+ aria-disabled="true"
+ className={cn('text-foreground font-normal', className)}
+ role="link"
+ {...props}
+ />
+ );
+}
-const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<'span'>) => (
- <span
- aria-hidden="true"
- className={cn('flex h-9 w-9 items-center justify-center', className)}
- role="presentation"
- {...props}
- >
- <DotsHorizontalIcon className="h-4 w-4" />
- <span className="sr-only">More</span>
- </span>
-);
-BreadcrumbEllipsis.displayName = 'BreadcrumbElipssis';
+function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<'li'>) {
+ return (
+ <li
+ aria-hidden="true"
+ className={cn('[&>svg]:h-3.5 [&>svg]:w-3.5', className)}
+ role="presentation"
+ {...props}
+ >
+ {children ?? <ChevronRightIcon />}
+ </li>
+ );
+}
export {
Breadcrumb,
diff --git a/frontend/src/components/ui/button.tsx b/frontend/src/components/ui/button.tsx
index ae6454f9..4dbfc464 100644
--- a/frontend/src/components/ui/button.tsx
+++ b/frontend/src/components/ui/button.tsx
@@ -34,30 +34,19 @@ const buttonVariants = cva(
},
);
-export interface ButtonProps
- extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
+export interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
asChild?: boolean;
}
-const Button = ({
- asChild = false,
- className,
- ref,
- size,
- variant,
- ...props
-}: ButtonProps & { ref?: React.Ref<HTMLButtonElement> }) => {
+function Button({ asChild = false, className, size, variant, ...props }: ButtonProps) {
const Comp = asChild ? Slot : 'button';
return (
<Comp
className={cn(buttonVariants({ className, size, variant }))}
- ref={ref}
{...props}
/>
);
-};
-
-Button.displayName = 'Button';
+}
export { Button, buttonVariants };
diff --git a/frontend/src/components/ui/card.tsx b/frontend/src/components/ui/card.tsx
index 4139e068..9d855dba 100644
--- a/frontend/src/components/ui/card.tsx
+++ b/frontend/src/components/ui/card.tsx
@@ -2,82 +2,58 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Card = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> }) => (
- <div
- className={cn('bg-card text-card-foreground rounded-xl border shadow-sm', className)}
- ref={ref}
- {...props}
- />
-);
-Card.displayName = 'Card';
-
-const CardHeader = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> }) => (
- <div
- className={cn('flex flex-col gap-1.5 p-4', className)}
- ref={ref}
- {...props}
- />
-);
-CardHeader.displayName = 'CardHeader';
-
-const CardTitle = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLHeadingElement> & { ref?: React.Ref<HTMLParagraphElement> }) => (
- <h3
- className={cn('leading-none font-semibold tracking-tight', className)}
- ref={ref}
- {...props}
- />
-);
-CardTitle.displayName = 'CardTitle';
-
-const CardDescription = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLParagraphElement> & { ref?: React.Ref<HTMLParagraphElement> }) => (
- <p
- className={cn('text-muted-foreground text-sm', className)}
- ref={ref}
- {...props}
- />
-);
-CardDescription.displayName = 'CardDescription';
-
-const CardContent = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> }) => (
- <div
- className={cn('p-4 pt-0', className)}
- ref={ref}
- {...props}
- />
-);
-CardContent.displayName = 'CardContent';
-
-const CardFooter = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> }) => (
- <div
- className={cn('flex items-center p-4 pt-0', className)}
- ref={ref}
- {...props}
- />
-);
-CardFooter.displayName = 'CardFooter';
+function Card({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('bg-card text-card-foreground rounded-xl border shadow-sm', className)}
+ {...props}
+ />
+ );
+}
+
+function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('p-4 pt-0', className)}
+ {...props}
+ />
+ );
+}
+
+function CardDescription({ className, ...props }: React.ComponentProps<'p'>) {
+ return (
+ <p
+ className={cn('text-muted-foreground text-sm', className)}
+ {...props}
+ />
+ );
+}
+
+function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('flex items-center p-4 pt-0', className)}
+ {...props}
+ />
+ );
+}
+
+function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('flex flex-col gap-1.5 p-4', className)}
+ {...props}
+ />
+ );
+}
+
+function CardTitle({ className, ...props }: React.ComponentProps<'h3'>) {
+ return (
+ <h3
+ className={cn('leading-none font-semibold tracking-tight', className)}
+ {...props}
+ />
+ );
+}
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
diff --git a/frontend/src/components/ui/checkbox.tsx b/frontend/src/components/ui/checkbox.tsx
index 13457b5c..36e1d6ec 100644
--- a/frontend/src/components/ui/checkbox.tsx
+++ b/frontend/src/components/ui/checkbox.tsx
@@ -4,26 +4,20 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Checkbox = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> & {
- ref?: React.Ref<React.ElementRef<typeof CheckboxPrimitive.Root>>;
-}) => (
- <CheckboxPrimitive.Root
- className={cn(
- 'peer border-primary focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground grid h-4 w-4 shrink-0 place-content-center rounded-sm border shadow focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50',
- className,
- )}
- ref={ref}
- {...props}
- >
- <CheckboxPrimitive.Indicator className={cn('grid place-content-center text-current')}>
- <Check className="h-4 w-4" />
- </CheckboxPrimitive.Indicator>
- </CheckboxPrimitive.Root>
-);
-Checkbox.displayName = CheckboxPrimitive.Root.displayName;
+function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
+ return (
+ <CheckboxPrimitive.Root
+ className={cn(
+ 'peer border-primary focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground grid h-4 w-4 shrink-0 place-content-center rounded-sm border shadow focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50',
+ className,
+ )}
+ {...props}
+ >
+ <CheckboxPrimitive.Indicator className={cn('grid place-content-center text-current')}>
+ <Check className="h-4 w-4" />
+ </CheckboxPrimitive.Indicator>
+ </CheckboxPrimitive.Root>
+ );
+}
export { Checkbox };
diff --git a/frontend/src/components/ui/command.tsx b/frontend/src/components/ui/command.tsx
index eeef6879..126754d7 100644
--- a/frontend/src/components/ui/command.tsx
+++ b/frontend/src/components/ui/command.tsx
@@ -6,25 +6,19 @@ import * as React from 'react';
import { Dialog, DialogContent } from '@/components/ui/dialog';
import { cn } from '@/lib/utils';
-const Command = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CommandPrimitive> & {
- ref?: React.Ref<React.ElementRef<typeof CommandPrimitive>>;
-}) => (
- <CommandPrimitive
- className={cn(
- 'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-Command.displayName = CommandPrimitive.displayName;
+function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
+ return (
+ <CommandPrimitive
+ className={cn(
+ 'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-const CommandDialog = ({ children, ...props }: DialogProps) => {
+function CommandDialog({ children, ...props }: DialogProps) {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0">
@@ -34,124 +28,82 @@ const CommandDialog = ({ children, ...props }: DialogProps) => {
</DialogContent>
</Dialog>
);
-};
+}
+
+function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
+ return (
+ <CommandPrimitive.Empty
+ className="text-muted-foreground/50 py-6 text-center text-sm"
+ {...props}
+ />
+ );
+}
-const CommandInput = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input> & {
- ref?: React.Ref<React.ElementRef<typeof CommandPrimitive.Input>>;
-}) => (
- <div className="flex items-center border-b px-3">
- <MagnifyingGlassIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
- <CommandPrimitive.Input
+function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {
+ return (
+ <CommandPrimitive.Group
className={cn(
- 'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
+ 'text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium',
className,
)}
- ref={ref}
{...props}
/>
- </div>
-);
-
-CommandInput.displayName = CommandPrimitive.Input.displayName;
-
-const CommandList = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CommandPrimitive.List> & {
- ref?: React.Ref<React.ElementRef<typeof CommandPrimitive.List>>;
-}) => (
- <CommandPrimitive.List
- className={cn('max-h-[300px] overflow-x-hidden overflow-y-auto', className)}
- ref={ref}
- {...props}
- />
-);
-
-CommandList.displayName = CommandPrimitive.List.displayName;
-
-const CommandEmpty = ({
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty> & {
- ref?: React.Ref<React.ElementRef<typeof CommandPrimitive.Empty>>;
-}) => (
- <CommandPrimitive.Empty
- className="text-muted-foreground/50 py-6 text-center text-sm"
- ref={ref}
- {...props}
- />
-);
-
-CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
-
-const CommandGroup = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group> & {
- ref?: React.Ref<React.ElementRef<typeof CommandPrimitive.Group>>;
-}) => (
- <CommandPrimitive.Group
- className={cn(
- 'text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
+ );
+}
-CommandGroup.displayName = CommandPrimitive.Group.displayName;
+function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>) {
+ return (
+ <div className="flex items-center border-b px-3">
+ <MagnifyingGlassIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
+ <CommandPrimitive.Input
+ className={cn(
+ 'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
+ className,
+ )}
+ {...props}
+ />
+ </div>
+ );
+}
-const CommandSeparator = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator> & {
- ref?: React.Ref<React.ElementRef<typeof CommandPrimitive.Separator>>;
-}) => (
- <CommandPrimitive.Separator
- className={cn('bg-border -mx-1 h-px', className)}
- ref={ref}
- {...props}
- />
-);
-CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
+function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
+ return (
+ <CommandPrimitive.Item
+ className={cn(
+ 'data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-const CommandItem = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item> & {
- ref?: React.Ref<React.ElementRef<typeof CommandPrimitive.Item>>;
-}) => (
- <CommandPrimitive.Item
- className={cn(
- 'data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
+function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
+ return (
+ <CommandPrimitive.List
+ className={cn('max-h-[300px] overflow-x-hidden overflow-y-auto', className)}
+ {...props}
+ />
+ );
+}
-CommandItem.displayName = CommandPrimitive.Item.displayName;
+function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
+ return (
+ <CommandPrimitive.Separator
+ className={cn('bg-border -mx-1 h-px', className)}
+ {...props}
+ />
+ );
+}
-const CommandShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
+function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
return (
<span
className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
{...props}
/>
);
-};
-
-CommandShortcut.displayName = 'CommandShortcut';
+}
export {
Command,
diff --git a/frontend/src/components/ui/context-menu.tsx b/frontend/src/components/ui/context-menu.tsx
index 6a1ef40e..0793aacf 100644
--- a/frontend/src/components/ui/context-menu.tsx
+++ b/frontend/src/components/ui/context-menu.tsx
@@ -16,186 +16,154 @@ const ContextMenuSub = ContextMenuPrimitive.Sub;
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
-const ContextMenuSubTrigger = ({
+function ContextMenuCheckboxItem({
+ checked,
children,
className,
- inset,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
- inset?: boolean;
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>>;
-}) => (
- <ContextMenuPrimitive.SubTrigger
- className={cn(
- '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-none select-none',
- inset && 'pl-8',
- className,
- )}
- ref={ref}
- {...props}
- >
- {children}
- <ChevronRight className="ml-auto h-4 w-4" />
- </ContextMenuPrimitive.SubTrigger>
-);
-ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
-
-const ContextMenuSubContent = ({
- className,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent> & {
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.SubContent>>;
-}) => (
- <ContextMenuPrimitive.SubContent
- className={cn(
- '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-context-menu-content-transform-origin] overflow-hidden rounded-md border p-1 shadow-lg',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
-
-const ContextMenuContent = ({
+}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
+ return (
+ <ContextMenuPrimitive.CheckboxItem
+ checked={checked}
+ className={cn(
+ 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
+ className,
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <Check className="h-4 w-4" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.CheckboxItem>
+ );
+}
+
+function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
+ return (
+ <ContextMenuPrimitive.Portal>
+ <ContextMenuPrimitive.Content
+ className={cn(
+ '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-context-menu-content-available-height] min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
+ className,
+ )}
+ {...props}
+ />
+ </ContextMenuPrimitive.Portal>
+ );
+}
+
+function ContextMenuItem({
className,
- ref,
+ inset,
...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.Content>>;
-}) => (
- <ContextMenuPrimitive.Portal>
- <ContextMenuPrimitive.Content
+}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
+ inset?: boolean;
+}) {
+ return (
+ <ContextMenuPrimitive.Item
className={cn(
- '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-context-menu-content-available-height] min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ inset && 'pl-8',
className,
)}
- ref={ref}
{...props}
/>
- </ContextMenuPrimitive.Portal>
-);
-ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
+ );
+}
-const ContextMenuItem = ({
+function ContextMenuLabel({
className,
inset,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
+}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
inset?: boolean;
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.Item>>;
-}) => (
- <ContextMenuPrimitive.Item
- className={cn(
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- inset && 'pl-8',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
-
-const ContextMenuCheckboxItem = ({
- checked,
+}) {
+ return (
+ <ContextMenuPrimitive.Label
+ className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
+ {...props}
+ />
+ );
+}
+
+function ContextMenuRadioItem({
children,
className,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem> & {
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>>;
-}) => (
- <ContextMenuPrimitive.CheckboxItem
- checked={checked}
- className={cn(
- 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
- className,
- )}
- ref={ref}
- {...props}
- >
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
- <ContextMenuPrimitive.ItemIndicator>
- <Check className="h-4 w-4" />
- </ContextMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </ContextMenuPrimitive.CheckboxItem>
-);
-ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
-
-const ContextMenuRadioItem = ({
+}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
+ return (
+ <ContextMenuPrimitive.RadioItem
+ className={cn(
+ 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
+ className,
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <Circle className="h-4 w-4 fill-current" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.RadioItem>
+ );
+}
+
+function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
+ return (
+ <ContextMenuPrimitive.Separator
+ className={cn('bg-border -mx-1 my-1 h-px', className)}
+ {...props}
+ />
+ );
+}
+
+function ContextMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {
+ return (
+ <span
+ className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
+ {...props}
+ />
+ );
+}
+
+function ContextMenuSubContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
+ return (
+ <ContextMenuPrimitive.SubContent
+ className={cn(
+ '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-context-menu-content-transform-origin] overflow-hidden rounded-md border p-1 shadow-lg',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function ContextMenuSubTrigger({
children,
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem> & {
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.RadioItem>>;
-}) => (
- <ContextMenuPrimitive.RadioItem
- className={cn(
- 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
- className,
- )}
- ref={ref}
- {...props}
- >
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
- <ContextMenuPrimitive.ItemIndicator>
- <Circle className="h-4 w-4 fill-current" />
- </ContextMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </ContextMenuPrimitive.RadioItem>
-);
-ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
-
-const ContextMenuLabel = ({
className,
inset,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
+}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
inset?: boolean;
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.Label>>;
-}) => (
- <ContextMenuPrimitive.Label
- className={cn('text-foreground px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
- ref={ref}
- {...props}
- />
-);
-ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
-
-const ContextMenuSeparator = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator> & {
- ref?: React.Ref<React.ElementRef<typeof ContextMenuPrimitive.Separator>>;
-}) => (
- <ContextMenuPrimitive.Separator
- className={cn('bg-border -mx-1 my-1 h-px', className)}
- ref={ref}
- {...props}
- />
-);
-ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
-
-const ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
+}) {
return (
- <span
- className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
+ <ContextMenuPrimitive.SubTrigger
+ className={cn(
+ '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-none select-none',
+ inset && 'pl-8',
+ className,
+ )}
{...props}
- />
+ >
+ {children}
+ <ChevronRight className="ml-auto h-4 w-4" />
+ </ContextMenuPrimitive.SubTrigger>
);
-};
-
-ContextMenuShortcut.displayName = 'ContextMenuShortcut';
+}
export {
ContextMenu,
diff --git a/frontend/src/components/ui/dialog.tsx b/frontend/src/components/ui/dialog.tsx
index 71096c0f..9164acb9 100644
--- a/frontend/src/components/ui/dialog.tsx
+++ b/frontend/src/components/ui/dialog.tsx
@@ -12,97 +12,74 @@ const DialogPortal = DialogPrimitive.Portal;
const DialogClose = DialogPrimitive.Close;
-const DialogOverlay = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> & {
- ref?: React.Ref<React.ElementRef<typeof DialogPrimitive.Overlay>>;
-}) => (
- <DialogPrimitive.Overlay
- className={cn(
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 bg-background/80 fixed inset-0 z-50 backdrop-blur-xs',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
+function DialogContent({ children, className, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>) {
+ return (
+ <DialogPortal>
+ <DialogOverlay />
+ <DialogPrimitive.Content
+ className={cn(
+ 'bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg outline-0 duration-200 sm:max-w-lg',
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
+ <X className="h-4 w-4" />
+ <span className="sr-only">Close</span>
+ </DialogPrimitive.Close>
+ </DialogPrimitive.Content>
+ </DialogPortal>
+ );
+}
-const DialogContent = ({
- children,
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof DialogPrimitive.Content>>;
-}) => (
- <DialogPortal>
- <DialogOverlay />
- <DialogPrimitive.Content
- className={cn(
- 'bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg outline-0 duration-200 sm:max-w-lg',
- className,
- )}
- ref={ref}
+function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {
+ return (
+ <DialogPrimitive.Description
+ className={cn('text-muted-foreground text-sm', className)}
{...props}
- >
- {children}
- <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
- <X className="h-4 w-4" />
- <span className="sr-only">Close</span>
- </DialogPrimitive.Close>
- </DialogPrimitive.Content>
- </DialogPortal>
-);
-DialogContent.displayName = DialogPrimitive.Content.displayName;
+ />
+ );
+}
-const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn('flex flex-col gap-1.5 text-center sm:text-left', className)}
- {...props}
- />
-);
-DialogHeader.displayName = 'DialogHeader';
+function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
+ {...props}
+ />
+ );
+}
-const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
- {...props}
- />
-);
-DialogFooter.displayName = 'DialogFooter';
+function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('flex flex-col gap-1.5 text-center sm:text-left', className)}
+ {...props}
+ />
+ );
+}
-const DialogTitle = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> & {
- ref?: React.Ref<React.ElementRef<typeof DialogPrimitive.Title>>;
-}) => (
- <DialogPrimitive.Title
- className={cn('text-lg leading-none font-semibold tracking-tight', className)}
- ref={ref}
- {...props}
- />
-);
-DialogTitle.displayName = DialogPrimitive.Title.displayName;
+function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
+ return (
+ <DialogPrimitive.Overlay
+ className={cn(
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 bg-background/80 fixed inset-0 z-50 backdrop-blur-xs',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-const DialogDescription = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> & {
- ref?: React.Ref<React.ElementRef<typeof DialogPrimitive.Description>>;
-}) => (
- <DialogPrimitive.Description
- className={cn('text-muted-foreground text-sm', className)}
- ref={ref}
- {...props}
- />
-);
-DialogDescription.displayName = DialogPrimitive.Description.displayName;
+function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
+ return (
+ <DialogPrimitive.Title
+ className={cn('text-lg leading-none font-semibold tracking-tight', className)}
+ {...props}
+ />
+ );
+}
export {
Dialog,
diff --git a/frontend/src/components/ui/drawer.tsx b/frontend/src/components/ui/drawer.tsx
index 9f943dcb..e935dadb 100644
--- a/frontend/src/components/ui/drawer.tsx
+++ b/frontend/src/components/ui/drawer.tsx
@@ -3,13 +3,14 @@ import { Drawer as DrawerPrimitive } from 'vaul';
import { cn } from '@/lib/utils';
-const Drawer = ({ shouldScaleBackground = true, ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
- <DrawerPrimitive.Root
- shouldScaleBackground={shouldScaleBackground}
- {...props}
- />
-);
-Drawer.displayName = 'Drawer';
+function Drawer({ shouldScaleBackground = true, ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
+ return (
+ <DrawerPrimitive.Root
+ shouldScaleBackground={shouldScaleBackground}
+ {...props}
+ />
+ );
+}
const DrawerTrigger = DrawerPrimitive.Trigger;
@@ -17,91 +18,68 @@ const DrawerPortal = DrawerPrimitive.Portal;
const DrawerClose = DrawerPrimitive.Close;
-const DrawerOverlay = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay> & {
- ref?: React.Ref<React.ElementRef<typeof DrawerPrimitive.Overlay>>;
-}) => (
- <DrawerPrimitive.Overlay
- className={cn('fixed inset-0 z-50 bg-black/80', className)}
- ref={ref}
- {...props}
- />
-);
-DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
+function DrawerContent({ children, className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
+ return (
+ <DrawerPortal>
+ <DrawerOverlay />
+ <DrawerPrimitive.Content
+ className={cn(
+ 'bg-background fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border',
+ className,
+ )}
+ {...props}
+ >
+ <div className="bg-muted mx-auto mt-4 h-2 w-[100px] rounded-full" />
+ {children}
+ </DrawerPrimitive.Content>
+ </DrawerPortal>
+ );
+}
-const DrawerContent = ({
- children,
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof DrawerPrimitive.Content>>;
-}) => (
- <DrawerPortal>
- <DrawerOverlay />
- <DrawerPrimitive.Content
- className={cn(
- 'bg-background fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border',
- className,
- )}
- ref={ref}
+function DrawerDescription({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
+ return (
+ <DrawerPrimitive.Description
+ className={cn('text-muted-foreground text-sm', className)}
{...props}
- >
- <div className="bg-muted mx-auto mt-4 h-2 w-[100px] rounded-full" />
- {children}
- </DrawerPrimitive.Content>
- </DrawerPortal>
-);
-DrawerContent.displayName = 'DrawerContent';
+ />
+ );
+}
-const DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn('grid gap-1.5 p-4 text-center sm:text-left', className)}
- {...props}
- />
-);
-DrawerHeader.displayName = 'DrawerHeader';
+function DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('mt-auto flex flex-col gap-2 p-4', className)}
+ {...props}
+ />
+ );
+}
-const DrawerFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn('mt-auto flex flex-col gap-2 p-4', className)}
- {...props}
- />
-);
-DrawerFooter.displayName = 'DrawerFooter';
+function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('grid gap-1.5 p-4 text-center sm:text-left', className)}
+ {...props}
+ />
+ );
+}
-const DrawerTitle = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title> & {
- ref?: React.Ref<React.ElementRef<typeof DrawerPrimitive.Title>>;
-}) => (
- <DrawerPrimitive.Title
- className={cn('text-lg leading-none font-semibold tracking-tight', className)}
- ref={ref}
- {...props}
- />
-);
-DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
+function DrawerOverlay({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
+ return (
+ <DrawerPrimitive.Overlay
+ className={cn('fixed inset-0 z-50 bg-black/80', className)}
+ {...props}
+ />
+ );
+}
-const DrawerDescription = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description> & {
- ref?: React.Ref<React.ElementRef<typeof DrawerPrimitive.Description>>;
-}) => (
- <DrawerPrimitive.Description
- className={cn('text-muted-foreground text-sm', className)}
- ref={ref}
- {...props}
- />
-);
-DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
+function DrawerTitle({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
+ return (
+ <DrawerPrimitive.Title
+ className={cn('text-lg leading-none font-semibold tracking-tight', className)}
+ {...props}
+ />
+ );
+}
export {
Drawer,
diff --git a/frontend/src/components/ui/dropdown-menu.tsx b/frontend/src/components/ui/dropdown-menu.tsx
index 4556c7b4..c0434f90 100644
--- a/frontend/src/components/ui/dropdown-menu.tsx
+++ b/frontend/src/components/ui/dropdown-menu.tsx
@@ -16,189 +16,163 @@ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
-const DropdownMenuSubTrigger = ({
+function DropdownMenuCheckboxItem({
+ checked,
children,
className,
- inset,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
- inset?: boolean;
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>>;
-}) => (
- <DropdownMenuPrimitive.SubTrigger
- className={cn(
- 'focus:bg-accent data-[state=open]:bg-accent flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
- inset && 'pl-8',
- className,
- )}
- ref={ref}
- {...props}
- >
- {children}
- <ChevronRightIcon className="ml-auto" />
- </DropdownMenuPrimitive.SubTrigger>
-);
-DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
-
-const DropdownMenuSubContent = ({
+}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
+ return (
+ <DropdownMenuPrimitive.CheckboxItem
+ checked={checked}
+ className={cn(
+ 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none data-disabled:pointer-events-none data-disabled:opacity-50',
+ className,
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <DropdownMenuPrimitive.ItemIndicator>
+ <CheckIcon className="h-4 w-4" />
+ </DropdownMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </DropdownMenuPrimitive.CheckboxItem>
+ );
+}
+
+function DropdownMenuContent({
className,
- ref,
+ sideOffset = 4,
...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> & {
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.SubContent>>;
-}) => (
- <DropdownMenuPrimitive.SubContent
- className={cn(
- '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-32 overflow-hidden rounded-md border p-1 shadow-lg',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
-
-const DropdownMenuContent = ({
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
+ return (
+ <DropdownMenuPrimitive.Portal>
+ <DropdownMenuPrimitive.Content
+ className={cn(
+ 'bg-popover text-popover-foreground z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-md',
+ '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',
+ className,
+ )}
+ sideOffset={sideOffset}
+ {...props}
+ />
+ </DropdownMenuPrimitive.Portal>
+ );
+}
+
+function DropdownMenuItem({
className,
- ref,
- sideOffset = 4,
+ inset,
...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.Content>>;
-}) => (
- <DropdownMenuPrimitive.Portal>
- <DropdownMenuPrimitive.Content
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
+ inset?: boolean;
+}) {
+ return (
+ <DropdownMenuPrimitive.Item
className={cn(
- 'bg-popover text-popover-foreground z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-md',
- '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',
+ 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',
+ inset && 'pl-8',
className,
)}
- ref={ref}
- sideOffset={sideOffset}
{...props}
/>
- </DropdownMenuPrimitive.Portal>
-);
-DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
+ );
+}
-const DropdownMenuItem = ({
+function DropdownMenuLabel({
className,
inset,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
+}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
inset?: boolean;
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.Item>>;
-}) => (
- <DropdownMenuPrimitive.Item
- className={cn(
- 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',
- inset && 'pl-8',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
-
-const DropdownMenuCheckboxItem = ({
- checked,
+}) {
+ return (
+ <DropdownMenuPrimitive.Label
+ className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuRadioItem({
children,
className,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> & {
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>>;
-}) => (
- <DropdownMenuPrimitive.CheckboxItem
- checked={checked}
- className={cn(
- 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none data-disabled:pointer-events-none data-disabled:opacity-50',
- className,
- )}
- ref={ref}
- {...props}
- >
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <CheckIcon className="h-4 w-4" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.CheckboxItem>
-);
-DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
-
-const DropdownMenuRadioItem = ({
- children,
+}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
+ return (
+ <DropdownMenuPrimitive.RadioItem
+ className={cn(
+ 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none data-disabled:pointer-events-none data-disabled:opacity-50',
+ className,
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <DropdownMenuPrimitive.ItemIndicator>
+ <DotFilledIcon className="h-4 w-4 fill-current" />
+ </DropdownMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </DropdownMenuPrimitive.RadioItem>
+ );
+}
+
+function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
+ return (
+ <DropdownMenuPrimitive.Separator
+ className={cn('bg-border -mx-1 my-1 h-px', className)}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {
+ return (
+ <span
+ className={cn('ml-auto text-xs tracking-widest opacity-60', className)}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuSubContent({
className,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> & {
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>>;
-}) => (
- <DropdownMenuPrimitive.RadioItem
- className={cn(
- 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none data-disabled:pointer-events-none data-disabled:opacity-50',
- className,
- )}
- ref={ref}
- {...props}
- >
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <DotFilledIcon className="h-4 w-4 fill-current" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.RadioItem>
-);
-DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
-
-const DropdownMenuLabel = ({
+}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
+ return (
+ <DropdownMenuPrimitive.SubContent
+ className={cn(
+ '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-32 overflow-hidden rounded-md border p-1 shadow-lg',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+function DropdownMenuSubTrigger({
+ children,
className,
inset,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
+}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
inset?: boolean;
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.Label>>;
-}) => (
- <DropdownMenuPrimitive.Label
- className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}
- ref={ref}
- {...props}
- />
-);
-DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
-
-const DropdownMenuSeparator = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator> & {
- ref?: React.Ref<React.ElementRef<typeof DropdownMenuPrimitive.Separator>>;
-}) => (
- <DropdownMenuPrimitive.Separator
- className={cn('bg-border -mx-1 my-1 h-px', className)}
- ref={ref}
- {...props}
- />
-);
-DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
-
-const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {
+}) {
return (
- <span
- className={cn('ml-auto text-xs tracking-widest opacity-60', className)}
+ <DropdownMenuPrimitive.SubTrigger
+ className={cn(
+ 'focus:bg-accent data-[state=open]:bg-accent flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
+ inset && 'pl-8',
+ className,
+ )}
{...props}
- />
+ >
+ {children}
+ <ChevronRightIcon className="ml-auto" />
+ </DropdownMenuPrimitive.SubTrigger>
);
-};
-
-DropdownMenuShortcut.displayName = 'DropdownMenuShortcut';
+}
export {
DropdownMenu,
diff --git a/frontend/src/components/ui/form.tsx b/frontend/src/components/ui/form.tsx
index b628d4e1..62197e65 100644
--- a/frontend/src/components/ui/form.tsx
+++ b/frontend/src/components/ui/form.tsx
@@ -66,53 +66,7 @@ type FormItemContextValue = {
const FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);
-const FormItem = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> }) => {
- const id = React.useId();
-
- return (
- <FormItemContext.Provider value={{ id }}>
- <div
- className={cn('flex flex-col gap-2', className)}
- ref={ref}
- {...props}
- />
- </FormItemContext.Provider>
- );
-};
-
-FormItem.displayName = 'FormItem';
-
-const FormLabel = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & {
- ref?: React.Ref<React.ElementRef<typeof LabelPrimitive.Root>>;
-}) => {
- const { error, formItemId } = useFormField();
-
- return (
- <Label
- className={cn(error && 'text-destructive', className)}
- htmlFor={formItemId}
- ref={ref}
- {...props}
- />
- );
-};
-
-FormLabel.displayName = 'FormLabel';
-
-const FormControl = ({
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof Slot> & {
- ref?: React.Ref<React.ElementRef<typeof Slot>>;
-}) => {
+function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
const { error, formDescriptionId, formItemId, formMessageId } = useFormField();
return (
@@ -120,39 +74,49 @@ const FormControl = ({
aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
aria-invalid={!!error}
id={formItemId}
- ref={ref}
{...props}
/>
);
-};
-
-FormControl.displayName = 'FormControl';
+}
-const FormDescription = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLParagraphElement> & { ref?: React.Ref<HTMLParagraphElement> }) => {
+function FormDescription({ className, ...props }: React.ComponentProps<'p'>) {
const { formDescriptionId } = useFormField();
return (
<p
className={cn('text-muted-foreground text-[0.8rem]', className)}
id={formDescriptionId}
- ref={ref}
{...props}
/>
);
-};
+}
-FormDescription.displayName = 'FormDescription';
+function FormItem({ className, ...props }: React.ComponentProps<'div'>) {
+ const id = React.useId();
-const FormMessage = ({
- children,
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLParagraphElement> & { ref?: React.Ref<HTMLParagraphElement> }) => {
+ return (
+ <FormItemContext.Provider value={{ id }}>
+ <div
+ className={cn('flex flex-col gap-2', className)}
+ {...props}
+ />
+ </FormItemContext.Provider>
+ );
+}
+
+function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
+ const { error, formItemId } = useFormField();
+
+ return (
+ <Label
+ className={cn(error && 'text-destructive', className)}
+ htmlFor={formItemId}
+ {...props}
+ />
+ );
+}
+
+function FormMessage({ children, className, ...props }: React.ComponentProps<'p'>) {
const { error, formMessageId } = useFormField();
const body = error ? String(error?.message) : children;
@@ -164,14 +128,11 @@ const FormMessage = ({
<p
className={cn('text-destructive text-[0.8rem] font-medium', className)}
id={formMessageId}
- ref={ref}
{...props}
>
{body}
</p>
);
-};
-
-FormMessage.displayName = 'FormMessage';
+}
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
diff --git a/frontend/src/components/ui/input.tsx b/frontend/src/components/ui/input.tsx
index 5b383287..30774578 100644
--- a/frontend/src/components/ui/input.tsx
+++ b/frontend/src/components/ui/input.tsx
@@ -2,9 +2,9 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-export type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
+export type InputProps = React.ComponentProps<'input'>;
-const Input = ({ className, ref, type, ...props }: InputProps & { ref?: React.Ref<HTMLInputElement> }) => {
+function Input({ className, type, ...props }: InputProps) {
return (
<input
className={cn(
@@ -14,13 +14,10 @@ const Input = ({ className, ref, type, ...props }: InputProps & { ref?: React.Re
'[appearance:textfield] [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:m-0 [&::-webkit-outer-spin-button]:appearance-none',
className,
)}
- ref={ref}
type={type}
{...props}
/>
);
-};
-
-Input.displayName = 'Input';
+}
export { Input };
diff --git a/frontend/src/components/ui/label.tsx b/frontend/src/components/ui/label.tsx
index 5e25c374..81f80134 100644
--- a/frontend/src/components/ui/label.tsx
+++ b/frontend/src/components/ui/label.tsx
@@ -6,18 +6,16 @@ import { cn } from '@/lib/utils';
const labelVariants = cva('text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70');
-const Label = ({
+function Label({
className,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
- VariantProps<typeof labelVariants> & { ref?: React.Ref<React.ElementRef<typeof LabelPrimitive.Root>> }) => (
- <LabelPrimitive.Root
- className={cn(labelVariants(), className)}
- ref={ref}
- {...props}
- />
-);
-Label.displayName = LabelPrimitive.Root.displayName;
+}: React.ComponentProps<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>) {
+ return (
+ <LabelPrimitive.Root
+ className={cn(labelVariants(), className)}
+ {...props}
+ />
+ );
+}
export { Label };
diff --git a/frontend/src/components/ui/popover.tsx b/frontend/src/components/ui/popover.tsx
index 44260bd5..68f84d2a 100644
--- a/frontend/src/components/ui/popover.tsx
+++ b/frontend/src/components/ui/popover.tsx
@@ -9,28 +9,25 @@ const PopoverTrigger = PopoverPrimitive.Trigger;
const PopoverAnchor = PopoverPrimitive.Anchor;
-const PopoverContent = ({
+function PopoverContent({
align = 'center',
className,
- ref,
sideOffset = 4,
...props
-}: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof PopoverPrimitive.Content>>;
-}) => (
- <PopoverPrimitive.Portal>
- <PopoverPrimitive.Content
- align={align}
- className={cn(
- '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 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
- className,
- )}
- ref={ref}
- sideOffset={sideOffset}
- {...props}
- />
- </PopoverPrimitive.Portal>
-);
-PopoverContent.displayName = PopoverPrimitive.Content.displayName;
+}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
+ return (
+ <PopoverPrimitive.Portal>
+ <PopoverPrimitive.Content
+ align={align}
+ className={cn(
+ '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 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
+ className,
+ )}
+ sideOffset={sideOffset}
+ {...props}
+ />
+ </PopoverPrimitive.Portal>
+ );
+}
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
diff --git a/frontend/src/components/ui/progress.tsx b/frontend/src/components/ui/progress.tsx
index 4cc75da5..3df3ffcc 100644
--- a/frontend/src/components/ui/progress.tsx
+++ b/frontend/src/components/ui/progress.tsx
@@ -3,25 +3,18 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Progress = ({
- className,
- ref,
- value,
- ...props
-}: React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & {
- ref?: React.Ref<React.ElementRef<typeof ProgressPrimitive.Root>>;
-}) => (
- <ProgressPrimitive.Root
- className={cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', className)}
- ref={ref}
- {...props}
- >
- <ProgressPrimitive.Indicator
- className={cn('bg-primary h-full w-full flex-1 transition-all')}
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
- />
- </ProgressPrimitive.Root>
-);
-Progress.displayName = ProgressPrimitive.Root.displayName;
+function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
+ return (
+ <ProgressPrimitive.Root
+ className={cn('bg-primary/20 relative h-2 w-full overflow-hidden rounded-full', className)}
+ {...props}
+ >
+ <ProgressPrimitive.Indicator
+ className={cn('bg-primary h-full w-full flex-1 transition-all')}
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
+ />
+ </ProgressPrimitive.Root>
+ );
+}
export { Progress };
diff --git a/frontend/src/components/ui/scroll-area.tsx b/frontend/src/components/ui/scroll-area.tsx
index 52713c52..f716ae30 100644
--- a/frontend/src/components/ui/scroll-area.tsx
+++ b/frontend/src/components/ui/scroll-area.tsx
@@ -3,48 +3,40 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const ScrollArea = ({
- children,
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> & {
- ref?: React.Ref<React.ElementRef<typeof ScrollAreaPrimitive.Root>>;
-}) => (
- <ScrollAreaPrimitive.Root
- className={cn('relative overflow-hidden', className)}
- ref={ref}
- {...props}
- >
- <ScrollAreaPrimitive.Viewport className="size-full rounded-[inherit]">{children}</ScrollAreaPrimitive.Viewport>
- <ScrollBar />
- <ScrollAreaPrimitive.Corner />
- </ScrollAreaPrimitive.Root>
-);
-ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
+function ScrollArea({ children, className, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
+ return (
+ <ScrollAreaPrimitive.Root
+ className={cn('relative overflow-hidden', className)}
+ {...props}
+ >
+ <ScrollAreaPrimitive.Viewport className="size-full rounded-[inherit]">
+ {children}
+ </ScrollAreaPrimitive.Viewport>
+ <ScrollBar />
+ <ScrollAreaPrimitive.Corner />
+ </ScrollAreaPrimitive.Root>
+ );
+}
-const ScrollBar = ({
+function ScrollBar({
className,
orientation = 'vertical',
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar> & {
- ref?: React.Ref<React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>>;
-}) => (
- <ScrollAreaPrimitive.ScrollAreaScrollbar
- className={cn(
- 'flex touch-none transition-colors select-none',
- orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-px',
- orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-px',
- className,
- )}
- orientation={orientation}
- ref={ref}
- {...props}
- >
- <ScrollAreaPrimitive.ScrollAreaThumb className="bg-border relative flex-1 rounded-full" />
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
-);
-ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
+}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
+ return (
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
+ className={cn(
+ 'flex touch-none transition-colors select-none',
+ orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-px',
+ orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-px',
+ className,
+ )}
+ orientation={orientation}
+ {...props}
+ >
+ <ScrollAreaPrimitive.ScrollAreaThumb className="bg-border relative flex-1 rounded-full" />
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
+ );
+}
export { ScrollArea, ScrollBar };
diff --git a/frontend/src/components/ui/select.tsx b/frontend/src/components/ui/select.tsx
index fcdf3a3f..83976d74 100644
--- a/frontend/src/components/ui/select.tsx
+++ b/frontend/src/components/ui/select.tsx
@@ -10,156 +10,118 @@ const SelectGroup = SelectPrimitive.Group;
const SelectValue = SelectPrimitive.Value;
-const SelectTrigger = ({
- children,
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {
- ref?: React.Ref<React.ElementRef<typeof SelectPrimitive.Trigger>>;
-}) => (
- <SelectPrimitive.Trigger
- className={cn(
- 'border-input ring-offset-background focus:ring-ring data-placeholder:text-muted-foreground flex h-9 w-full items-center justify-between rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs focus:ring-1 focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
- className,
- )}
- ref={ref}
- {...props}
- >
- {children}
- <SelectPrimitive.Icon asChild>
- <ChevronDownIcon className="h-4 w-4 opacity-50" />
- </SelectPrimitive.Icon>
- </SelectPrimitive.Trigger>
-);
-SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
-
-const SelectScrollUpButton = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton> & {
- ref?: React.Ref<React.ElementRef<typeof SelectPrimitive.ScrollUpButton>>;
-}) => (
- <SelectPrimitive.ScrollUpButton
- className={cn('flex cursor-default items-center justify-center py-1', className)}
- ref={ref}
- {...props}
- >
- <ChevronUpIcon className="h-4 w-4" />
- </SelectPrimitive.ScrollUpButton>
-);
-SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
-
-const SelectScrollDownButton = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton> & {
- ref?: React.Ref<React.ElementRef<typeof SelectPrimitive.ScrollDownButton>>;
-}) => (
- <SelectPrimitive.ScrollDownButton
- className={cn('flex cursor-default items-center justify-center py-1', className)}
- ref={ref}
- {...props}
- >
- <ChevronDownIcon className="h-4 w-4" />
- </SelectPrimitive.ScrollDownButton>
-);
-SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
-
-const SelectContent = ({
+function SelectContent({
children,
className,
position = 'popper',
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof SelectPrimitive.Content>>;
-}) => (
- <SelectPrimitive.Portal>
- <SelectPrimitive.Content
+}: React.ComponentProps<typeof SelectPrimitive.Content>) {
+ return (
+ <SelectPrimitive.Portal>
+ <SelectPrimitive.Content
+ className={cn(
+ '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 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
+ position === 'popper' &&
+ 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
+ className,
+ )}
+ position={position}
+ {...props}
+ >
+ <SelectScrollUpButton />
+ <SelectPrimitive.Viewport
+ className={cn(
+ 'p-1',
+ position === 'popper' &&
+ 'h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)',
+ )}
+ >
+ {children}
+ </SelectPrimitive.Viewport>
+ <SelectScrollDownButton />
+ </SelectPrimitive.Content>
+ </SelectPrimitive.Portal>
+ );
+}
+
+function SelectItem({ children, className, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
+ return (
+ <SelectPrimitive.Item
className={cn(
- '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 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md',
- position === 'popper' &&
- 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
+ 'focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50',
className,
)}
- position={position}
- ref={ref}
{...props}
>
- <SelectScrollUpButton />
- <SelectPrimitive.Viewport
- className={cn(
- 'p-1',
- position === 'popper' &&
- 'h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)',
- )}
- >
- {children}
- </SelectPrimitive.Viewport>
- <SelectScrollDownButton />
- </SelectPrimitive.Content>
- </SelectPrimitive.Portal>
-);
-SelectContent.displayName = SelectPrimitive.Content.displayName;
+ <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
+ <SelectPrimitive.ItemIndicator>
+ <CheckIcon className="h-4 w-4" />
+ </SelectPrimitive.ItemIndicator>
+ </span>
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
+ </SelectPrimitive.Item>
+ );
+}
-const SelectLabel = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> & {
- ref?: React.Ref<React.ElementRef<typeof SelectPrimitive.Label>>;
-}) => (
- <SelectPrimitive.Label
- className={cn('px-2 py-1.5 text-sm font-semibold', className)}
- ref={ref}
- {...props}
- />
-);
-SelectLabel.displayName = SelectPrimitive.Label.displayName;
+function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
+ return (
+ <SelectPrimitive.Label
+ className={cn('px-2 py-1.5 text-sm font-semibold', className)}
+ {...props}
+ />
+ );
+}
-const SelectItem = ({
- children,
+function SelectScrollDownButton({
className,
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {
- ref?: React.Ref<React.ElementRef<typeof SelectPrimitive.Item>>;
-}) => (
- <SelectPrimitive.Item
- className={cn(
- 'focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50',
- className,
- )}
- ref={ref}
- {...props}
- >
- <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
- <SelectPrimitive.ItemIndicator>
- <CheckIcon className="h-4 w-4" />
- </SelectPrimitive.ItemIndicator>
- </span>
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
- </SelectPrimitive.Item>
-);
-SelectItem.displayName = SelectPrimitive.Item.displayName;
+}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
+ return (
+ <SelectPrimitive.ScrollDownButton
+ className={cn('flex cursor-default items-center justify-center py-1', className)}
+ {...props}
+ >
+ <ChevronDownIcon className="h-4 w-4" />
+ </SelectPrimitive.ScrollDownButton>
+ );
+}
-const SelectSeparator = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> & {
- ref?: React.Ref<React.ElementRef<typeof SelectPrimitive.Separator>>;
-}) => (
- <SelectPrimitive.Separator
- className={cn('bg-muted -mx-1 my-1 h-px', className)}
- ref={ref}
- {...props}
- />
-);
-SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
+function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
+ return (
+ <SelectPrimitive.ScrollUpButton
+ className={cn('flex cursor-default items-center justify-center py-1', className)}
+ {...props}
+ >
+ <ChevronUpIcon className="h-4 w-4" />
+ </SelectPrimitive.ScrollUpButton>
+ );
+}
+
+function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
+ return (
+ <SelectPrimitive.Separator
+ className={cn('bg-muted -mx-1 my-1 h-px', className)}
+ {...props}
+ />
+ );
+}
+
+function SelectTrigger({ children, className, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger>) {
+ return (
+ <SelectPrimitive.Trigger
+ className={cn(
+ 'border-input ring-offset-background focus:ring-ring data-placeholder:text-muted-foreground flex h-9 w-full items-center justify-between rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs focus:ring-1 focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <SelectPrimitive.Icon asChild>
+ <ChevronDownIcon className="h-4 w-4 opacity-50" />
+ </SelectPrimitive.Icon>
+ </SelectPrimitive.Trigger>
+ );
+}
export {
Select,
diff --git a/frontend/src/components/ui/separator.tsx b/frontend/src/components/ui/separator.tsx
index e4b89e63..cbecf228 100644
--- a/frontend/src/components/ui/separator.tsx
+++ b/frontend/src/components/ui/separator.tsx
@@ -3,23 +3,24 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Separator = ({
+function Separator({
className,
decorative = true,
orientation = 'horizontal',
- ref,
...props
-}: React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root> & {
- ref?: React.Ref<React.ElementRef<typeof SeparatorPrimitive.Root>>;
-}) => (
- <SeparatorPrimitive.Root
- className={cn('bg-border shrink-0', orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px', className)}
- decorative={decorative}
- orientation={orientation}
- ref={ref}
- {...props}
- />
-);
-Separator.displayName = SeparatorPrimitive.Root.displayName;
+}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
+ return (
+ <SeparatorPrimitive.Root
+ className={cn(
+ 'bg-border shrink-0',
+ orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',
+ className,
+ )}
+ decorative={decorative}
+ orientation={orientation}
+ {...props}
+ />
+ );
+}
export { Separator };
diff --git a/frontend/src/components/ui/sheet.tsx b/frontend/src/components/ui/sheet.tsx
index 5f67e5dd..93882abf 100644
--- a/frontend/src/components/ui/sheet.tsx
+++ b/frontend/src/components/ui/sheet.tsx
@@ -15,23 +15,17 @@ const SheetClose = SheetPrimitive.Close;
const SheetPortal = SheetPrimitive.Portal;
-const SheetOverlay = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay> & {
- ref?: React.Ref<React.ElementRef<typeof SheetPrimitive.Overlay>>;
-}) => (
- <SheetPrimitive.Overlay
- className={cn(
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',
- className,
- )}
- {...props}
- ref={ref}
- />
-);
-SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
+function SheetOverlay({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
+ return (
+ <SheetPrimitive.Overlay
+ className={cn(
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
const sheetVariants = cva(
'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out',
@@ -51,82 +45,64 @@ const sheetVariants = cva(
);
interface SheetContentProps
- extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
+ extends React.ComponentProps<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
container?: HTMLElement | null;
overlay?: boolean;
}
-const SheetContent = ({
- children,
- className,
- container,
- overlay = true,
- ref,
- side = 'right',
- ...props
-}: SheetContentProps & { ref?: React.Ref<React.ElementRef<typeof SheetPrimitive.Content>> }) => (
- <SheetPortal container={container ?? undefined}>
- {overlay && <SheetOverlay />}
- <SheetPrimitive.Content
- className={cn(sheetVariants({ side }), className)}
- ref={ref}
- {...props}
- >
- <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
- <Cross2Icon className="h-4 w-4" />
- <span className="sr-only">Close</span>
- </SheetPrimitive.Close>
- {children}
- </SheetPrimitive.Content>
- </SheetPortal>
-);
-SheetContent.displayName = SheetPrimitive.Content.displayName;
+function SheetContent({ children, className, container, overlay = true, side = 'right', ...props }: SheetContentProps) {
+ return (
+ <SheetPortal container={container ?? undefined}>
+ {overlay && <SheetOverlay />}
+ <SheetPrimitive.Content
+ className={cn(sheetVariants({ side }), className)}
+ {...props}
+ >
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
+ <Cross2Icon className="h-4 w-4" />
+ <span className="sr-only">Close</span>
+ </SheetPrimitive.Close>
+ {children}
+ </SheetPrimitive.Content>
+ </SheetPortal>
+ );
+}
-const SheetHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
- {...props}
- />
-);
-SheetHeader.displayName = 'SheetHeader';
+function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>) {
+ return (
+ <SheetPrimitive.Description
+ className={cn('text-muted-foreground text-sm', className)}
+ {...props}
+ />
+ );
+}
-const SheetFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
- {...props}
- />
-);
-SheetFooter.displayName = 'SheetFooter';
+function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
+ {...props}
+ />
+ );
+}
-const SheetTitle = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title> & {
- ref?: React.Ref<React.ElementRef<typeof SheetPrimitive.Title>>;
-}) => (
- <SheetPrimitive.Title
- className={cn('text-foreground text-lg font-semibold', className)}
- ref={ref}
- {...props}
- />
-);
-SheetTitle.displayName = SheetPrimitive.Title.displayName;
+function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
+ {...props}
+ />
+ );
+}
-const SheetDescription = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description> & {
- ref?: React.Ref<React.ElementRef<typeof SheetPrimitive.Description>>;
-}) => (
- <SheetPrimitive.Description
- className={cn('text-muted-foreground text-sm', className)}
- ref={ref}
- {...props}
- />
-);
-SheetDescription.displayName = SheetPrimitive.Description.displayName;
+function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
+ return (
+ <SheetPrimitive.Title
+ className={cn('text-foreground text-lg font-semibold', className)}
+ {...props}
+ />
+ );
+}
export {
Sheet,
diff --git a/frontend/src/components/ui/sidebar.tsx b/frontend/src/components/ui/sidebar.tsx
index bea35940..af032b3d 100644
--- a/frontend/src/components/ui/sidebar.tsx
+++ b/frontend/src/components/ui/sidebar.tsx
@@ -61,133 +61,24 @@ const getSidebarState = (): boolean | undefined => {
return value === 'true';
};
-const SidebarProvider = ({
- children,
- className,
- defaultOpen = true,
- onOpenChange: setOpenProp,
- open: openProp,
- ref,
- style,
- ...props
-}: React.ComponentProps<'div'> & {
- defaultOpen?: boolean;
- onOpenChange?: (open: boolean) => void;
- open?: boolean;
- ref?: React.Ref<HTMLDivElement>;
-}) => {
- const { isMobile } = useBreakpoint();
- const [openMobile, setOpenMobile] = React.useState(false);
-
- // This is the internal state of the sidebar.
- // We use openProp and setOpenProp for control from outside the component.
- // First, try to read from cookie, fallback to defaultOpen
- const [_open, _setOpen] = React.useState(() => {
- const cookieValue = getSidebarState();
-
- return cookieValue ?? defaultOpen;
- });
- const open = openProp ?? _open;
- const setOpen = React.useCallback(
- (value: ((value: boolean) => boolean) | boolean) => {
- const openState = typeof value === 'function' ? value(open) : value;
-
- if (setOpenProp) {
- setOpenProp(openState);
- } else {
- _setOpen(openState);
- }
-
- // This sets the cookie to keep the sidebar state.
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
- },
- [setOpenProp, open],
- );
-
- // Helper to toggle the sidebar.
- const toggleSidebar = React.useCallback(() => {
- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
- }, [isMobile, setOpen, setOpenMobile]);
-
- // Adds a keyboard shortcut to toggle the sidebar.
- React.useEffect(() => {
- const handleKeyDown = (event: KeyboardEvent) => {
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
- event.preventDefault();
- toggleSidebar();
- }
- };
-
- window.addEventListener('keydown', handleKeyDown);
-
- return () => window.removeEventListener('keydown', handleKeyDown);
- }, [toggleSidebar]);
-
- // We add a state so that we can do data-state="expanded" or "collapsed".
- // This makes it easier to style the sidebar with Tailwind classes.
- const state = open ? 'expanded' : 'collapsed';
-
- const contextValue = React.useMemo<SidebarContext>(
- () => ({
- isMobile,
- open,
- openMobile,
- setOpen,
- setOpenMobile,
- state,
- toggleSidebar,
- }),
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
- );
-
- return (
- <SidebarContext.Provider value={contextValue}>
- <TooltipProvider delayDuration={0}>
- <div
- className={cn(
- 'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
- className,
- )}
- ref={ref}
- style={
- {
- '--sidebar-width': SIDEBAR_WIDTH,
- '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
- ...style,
- } as React.CSSProperties
- }
- {...props}
- >
- {children}
- </div>
- </TooltipProvider>
- </SidebarContext.Provider>
- );
-};
-
-SidebarProvider.displayName = 'SidebarProvider';
-
-const Sidebar = ({
+function Sidebar({
children,
className,
collapsible = 'offcanvas',
- ref,
side = 'left',
variant = 'sidebar',
...props
}: React.ComponentProps<'div'> & {
collapsible?: 'icon' | 'none' | 'offcanvas';
- ref?: React.Ref<HTMLDivElement>;
side?: 'left' | 'right';
variant?: 'floating' | 'inset' | 'sidebar';
-}) => {
+}) {
const { isMobile, openMobile, setOpenMobile, state } = useSidebar();
if (collapsible === 'none') {
return (
<div
className={cn('bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col', className)}
- ref={ref}
{...props}
>
{children}
@@ -228,7 +119,6 @@ const Sidebar = ({
data-side={side}
data-state={state}
data-variant={variant}
- ref={ref}
>
{/* This is what handles the sidebar gap on desktop */}
<div
@@ -264,98 +154,104 @@ const Sidebar = ({
</div>
</div>
);
-};
-
-Sidebar.displayName = 'Sidebar';
+}
-const SidebarTrigger = ({
- className,
- onClick,
- ref,
- ...props
-}: React.ComponentProps<typeof Button> & { ref?: React.Ref<React.ElementRef<typeof Button>> }) => {
- const { toggleSidebar } = useSidebar();
+function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn(
+ 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
+ className,
+ )}
+ data-sidebar="content"
+ {...props}
+ />
+ );
+}
+function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {
return (
- <Button
- className={cn('h-7 w-7', className)}
- data-sidebar="trigger"
- onClick={(event) => {
- onClick?.(event);
- toggleSidebar();
- }}
- ref={ref}
- size="icon"
- variant="ghost"
+ <div
+ className={cn('flex flex-col gap-2 p-2', className)}
+ data-sidebar="footer"
{...props}
- >
- <PanelLeft />
- <span className="sr-only">Toggle Sidebar</span>
- </Button>
+ />
);
-};
+}
-SidebarTrigger.displayName = 'SidebarTrigger';
+function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
+ data-sidebar="group"
+ {...props}
+ />
+ );
+}
-const SidebarRail = ({
+function SidebarGroupAction({
+ asChild = false,
className,
- ref,
...props
-}: React.ComponentProps<'button'> & { ref?: React.Ref<HTMLButtonElement> }) => {
- const { toggleSidebar } = useSidebar();
+}: React.ComponentProps<'button'> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot : 'button';
return (
- <button
- aria-label="Toggle Sidebar"
+ <Comp
className={cn(
- 'hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex',
- 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
- '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
- 'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
- '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
- '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
+ // Increases the hit area of the button on mobile.
+ 'after:absolute after:-inset-2 md:after:hidden',
+ 'group-data-[collapsible=icon]:hidden',
className,
)}
- data-sidebar="rail"
- onClick={toggleSidebar}
- ref={ref}
- tabIndex={-1}
- title="Toggle Sidebar"
+ data-sidebar="group-action"
{...props}
/>
);
-};
+}
-SidebarRail.displayName = 'SidebarRail';
+function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('w-full text-sm', className)}
+ data-sidebar="group-content"
+ {...props}
+ />
+ );
+}
-const SidebarInset = ({
+function SidebarGroupLabel({
+ asChild = false,
className,
- ref,
...props
-}: React.ComponentProps<'main'> & { ref?: React.Ref<HTMLDivElement> }) => {
+}: React.ComponentProps<'div'> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot : 'div';
+
return (
- <main
+ <Comp
className={cn(
- 'bg-background relative flex min-h-svh flex-1 flex-col',
- 'max-w-[100vw]',
- 'md:peer-data-[state=expanded]:max-w-[calc(100vw-var(--sidebar-width))]',
- 'md:peer-data-[state=collapsed]:max-w-[100vw]',
- 'peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
+ 'text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
+ 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
className,
)}
- ref={ref}
+ data-sidebar="group-label"
{...props}
/>
);
-};
+}
-SidebarInset.displayName = 'SidebarInset';
+function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn('flex flex-col gap-2 p-2', className)}
+ data-sidebar="header"
+ {...props}
+ />
+ );
+}
-const SidebarInput = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<typeof Input> & { ref?: React.Ref<React.ElementRef<typeof Input>> }) => {
+function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {
return (
<Input
className={cn(
@@ -363,193 +259,202 @@ const SidebarInput = ({
className,
)}
data-sidebar="input"
- ref={ref}
{...props}
/>
);
-};
+}
-SidebarInput.displayName = 'SidebarInput';
-
-const SidebarHeader = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'div'> & { ref?: React.Ref<HTMLDivElement> }) => {
+function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
return (
- <div
- className={cn('flex flex-col gap-2 p-2', className)}
- data-sidebar="header"
- ref={ref}
+ <main
+ className={cn(
+ 'bg-background relative flex min-h-svh flex-1 flex-col',
+ 'max-w-[100vw]',
+ 'md:peer-data-[state=expanded]:max-w-[calc(100vw-var(--sidebar-width))]',
+ 'md:peer-data-[state=collapsed]:max-w-[100vw]',
+ 'peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
+ className,
+ )}
{...props}
/>
);
-};
+}
-SidebarHeader.displayName = 'SidebarHeader';
-
-const SidebarFooter = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'div'> & { ref?: React.Ref<HTMLDivElement> }) => {
+function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {
return (
- <div
- className={cn('flex flex-col gap-2 p-2', className)}
- data-sidebar="footer"
- ref={ref}
+ <ul
+ className={cn('flex w-full min-w-0 flex-col gap-1', className)}
+ data-sidebar="menu"
{...props}
/>
);
-};
-
-SidebarFooter.displayName = 'SidebarFooter';
+}
-const SidebarSeparator = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<typeof Separator> & { ref?: React.Ref<React.ElementRef<typeof Separator>> }) => {
+function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {
return (
- <Separator
- className={cn('bg-sidebar-border mx-2 w-auto', className)}
- data-sidebar="separator"
- ref={ref}
+ <li
+ className={cn('group/menu-item relative', className)}
+ data-sidebar="menu-item"
{...props}
/>
);
-};
-
-SidebarSeparator.displayName = 'SidebarSeparator';
+}
-const SidebarContent = ({
+function SidebarProvider({
+ children,
className,
- ref,
+ defaultOpen = true,
+ onOpenChange: setOpenProp,
+ open: openProp,
+ style,
...props
-}: React.ComponentProps<'div'> & { ref?: React.Ref<HTMLDivElement> }) => {
- return (
- <div
- className={cn(
- 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
- className,
- )}
- data-sidebar="content"
- ref={ref}
- {...props}
- />
+}: React.ComponentProps<'div'> & {
+ defaultOpen?: boolean;
+ onOpenChange?: (open: boolean) => void;
+ open?: boolean;
+}) {
+ const { isMobile } = useBreakpoint();
+ const [openMobile, setOpenMobile] = React.useState(false);
+
+ // This is the internal state of the sidebar.
+ // We use openProp and setOpenProp for control from outside the component.
+ // First, try to read from cookie, fallback to defaultOpen
+ const [_open, _setOpen] = React.useState(() => {
+ const cookieValue = getSidebarState();
+
+ return cookieValue ?? defaultOpen;
+ });
+ const open = openProp ?? _open;
+ const setOpen = React.useCallback(
+ (value: ((value: boolean) => boolean) | boolean) => {
+ const openState = typeof value === 'function' ? value(open) : value;
+
+ if (setOpenProp) {
+ setOpenProp(openState);
+ } else {
+ _setOpen(openState);
+ }
+
+ // This sets the cookie to keep the sidebar state.
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
+ },
+ [setOpenProp, open],
);
-};
-SidebarContent.displayName = 'SidebarContent';
+ // Helper to toggle the sidebar.
+ const toggleSidebar = React.useCallback(() => {
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
+ }, [isMobile, setOpen, setOpenMobile]);
-const SidebarGroup = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'div'> & { ref?: React.Ref<HTMLDivElement> }) => {
- return (
- <div
- className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
- data-sidebar="group"
- ref={ref}
- {...props}
- />
+ // Adds a keyboard shortcut to toggle the sidebar.
+ React.useEffect(() => {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
+ event.preventDefault();
+ toggleSidebar();
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => window.removeEventListener('keydown', handleKeyDown);
+ }, [toggleSidebar]);
+
+ // We add a state so that we can do data-state="expanded" or "collapsed".
+ // This makes it easier to style the sidebar with Tailwind classes.
+ const state = open ? 'expanded' : 'collapsed';
+
+ const contextValue = React.useMemo<SidebarContext>(
+ () => ({
+ isMobile,
+ open,
+ openMobile,
+ setOpen,
+ setOpenMobile,
+ state,
+ toggleSidebar,
+ }),
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
);
-};
-SidebarGroup.displayName = 'SidebarGroup';
+ return (
+ <SidebarContext.Provider value={contextValue}>
+ <TooltipProvider delayDuration={0}>
+ <div
+ className={cn(
+ 'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
+ className,
+ )}
+ style={
+ {
+ '--sidebar-width': SIDEBAR_WIDTH,
+ '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
+ ...style,
+ } as React.CSSProperties
+ }
+ {...props}
+ >
+ {children}
+ </div>
+ </TooltipProvider>
+ </SidebarContext.Provider>
+ );
+}
-const SidebarGroupLabel = ({
- asChild = false,
- className,
- ref,
- ...props
-}: React.ComponentProps<'div'> & { asChild?: boolean; ref?: React.Ref<HTMLDivElement> }) => {
- const Comp = asChild ? Slot : 'div';
+function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
+ const { toggleSidebar } = useSidebar();
return (
- <Comp
+ <button
+ aria-label="Toggle Sidebar"
className={cn(
- 'text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
- 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
+ 'hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex',
+ 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
+ '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
+ 'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
+ '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
+ '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
className,
)}
- data-sidebar="group-label"
- ref={ref}
+ data-sidebar="rail"
+ onClick={toggleSidebar}
+ tabIndex={-1}
+ title="Toggle Sidebar"
{...props}
/>
);
-};
-
-SidebarGroupLabel.displayName = 'SidebarGroupLabel';
-
-const SidebarGroupAction = ({
- asChild = false,
- className,
- ref,
- ...props
-}: React.ComponentProps<'button'> & { asChild?: boolean; ref?: React.Ref<HTMLButtonElement> }) => {
- const Comp = asChild ? Slot : 'button';
+}
+function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
return (
- <Comp
- className={cn(
- 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
- // Increases the hit area of the button on mobile.
- 'after:absolute after:-inset-2 md:after:hidden',
- 'group-data-[collapsible=icon]:hidden',
- className,
- )}
- data-sidebar="group-action"
- ref={ref}
+ <Separator
+ className={cn('bg-sidebar-border mx-2 w-auto', className)}
+ data-sidebar="separator"
{...props}
/>
);
-};
-
-SidebarGroupAction.displayName = 'SidebarGroupAction';
+}
-const SidebarGroupContent = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'div'> & { ref?: React.Ref<HTMLDivElement> }) => (
- <div
- className={cn('w-full text-sm', className)}
- data-sidebar="group-content"
- ref={ref}
- {...props}
- />
-);
-SidebarGroupContent.displayName = 'SidebarGroupContent';
-
-const SidebarMenu = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'ul'> & { ref?: React.Ref<HTMLUListElement> }) => (
- <ul
- className={cn('flex w-full min-w-0 flex-col gap-1', className)}
- data-sidebar="menu"
- ref={ref}
- {...props}
- />
-);
-SidebarMenu.displayName = 'SidebarMenu';
+function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
+ const { toggleSidebar } = useSidebar();
-const SidebarMenuItem = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'li'> & { ref?: React.Ref<HTMLLIElement> }) => (
- <li
- className={cn('group/menu-item relative', className)}
- data-sidebar="menu-item"
- ref={ref}
- {...props}
- />
-);
-SidebarMenuItem.displayName = 'SidebarMenuItem';
+ return (
+ <Button
+ className={cn('h-7 w-7', className)}
+ data-sidebar="trigger"
+ onClick={(event) => {
+ onClick?.(event);
+ toggleSidebar();
+ }}
+ size="icon"
+ variant="ghost"
+ {...props}
+ >
+ <PanelLeft />
+ <span className="sr-only">Toggle Sidebar</span>
+ </Button>
+ );
+}
const sidebarMenuButtonVariants = cva(
'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [li[data-has-action=true]_&]:pr-8',
@@ -573,11 +478,59 @@ const sidebarMenuButtonVariants = cva(
},
);
-const SidebarMenuButton = ({
+function SidebarMenuAction({
+ asChild = false,
+ className,
+ showOnHover = false,
+ ...props
+}: React.ComponentProps<'button'> & {
+ asChild?: boolean;
+ showOnHover?: boolean;
+}) {
+ const Comp = asChild ? Slot : 'button';
+
+ return (
+ <Comp
+ className={cn(
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
+ // Increases the hit area of the button on mobile.
+ 'after:absolute after:-inset-2 md:after:hidden',
+ 'peer-data-[size=sm]/menu-button:top-1',
+ 'peer-data-[size=default]/menu-button:top-1.5',
+ 'peer-data-[size=lg]/menu-button:top-2.5',
+ 'group-data-[collapsible=icon]:hidden',
+ showOnHover &&
+ 'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
+ className,
+ )}
+ data-sidebar="menu-action"
+ {...props}
+ />
+ );
+}
+
+function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>) {
+ return (
+ <div
+ className={cn(
+ 'text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none',
+ 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
+ 'peer-data-[size=sm]/menu-button:top-1',
+ 'peer-data-[size=default]/menu-button:top-1.5',
+ 'peer-data-[size=lg]/menu-button:top-2.5',
+ 'group-data-[collapsible=icon]:hidden',
+ className,
+ )}
+ data-sidebar="menu-badge"
+ {...props}
+ />
+ );
+}
+
+function SidebarMenuButton({
asChild = false,
className,
isActive = false,
- ref,
size = 'default',
tooltip,
variant = 'default',
@@ -586,9 +539,8 @@ const SidebarMenuButton = ({
VariantProps<typeof sidebarMenuButtonVariants> & {
asChild?: boolean;
isActive?: boolean;
- ref?: React.Ref<HTMLButtonElement>;
tooltip?: React.ComponentProps<typeof TooltipContent> | string;
- }) => {
+ }) {
const Comp = asChild ? Slot : 'button';
const { isMobile, state } = useSidebar();
@@ -598,7 +550,6 @@ const SidebarMenuButton = ({
data-active={isActive}
data-sidebar="menu-button"
data-size={size}
- ref={ref}
{...props}
/>
);
@@ -624,51 +575,9 @@ const SidebarMenuButton = ({
/>
</Tooltip>
);
-};
-
-SidebarMenuButton.displayName = 'SidebarMenuButton';
-
-const SidebarMenuAction = ({
- asChild = false,
- className,
- ref,
- showOnHover = false,
- ...props
-}: React.ComponentProps<'button'> & {
- asChild?: boolean;
- ref?: React.Ref<HTMLButtonElement>;
- showOnHover?: boolean;
-}) => {
- const Comp = asChild ? Slot : 'button';
-
- return (
- <Comp
- className={cn(
- 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
- // Increases the hit area of the button on mobile.
- 'after:absolute after:-inset-2 md:after:hidden',
- 'peer-data-[size=sm]/menu-button:top-1',
- 'peer-data-[size=default]/menu-button:top-1.5',
- 'peer-data-[size=lg]/menu-button:top-2.5',
- 'group-data-[collapsible=icon]:hidden',
- showOnHover &&
- 'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
- className,
- )}
- data-sidebar="menu-action"
- ref={ref}
- {...props}
- />
- );
-};
+}
-SidebarMenuAction.displayName = 'SidebarMenuAction';
-
-const SidebarMenuIndicator = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'div'> & { ref?: React.Ref<HTMLDivElement> }) => {
+function SidebarMenuIndicator({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
className={cn(
@@ -681,7 +590,6 @@ const SidebarMenuIndicator = ({
className,
)}
data-sidebar="menu-indicator"
- ref={ref}
{...props}
>
<div className="relative flex size-5 items-center justify-center">
@@ -689,41 +597,15 @@ const SidebarMenuIndicator = ({
</div>
</div>
);
-};
-
-SidebarMenuIndicator.displayName = 'SidebarMenuIndicator';
-
-const SidebarMenuBadge = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'div'> & { ref?: React.Ref<HTMLDivElement> }) => (
- <div
- className={cn(
- 'text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none',
- 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
- 'peer-data-[size=sm]/menu-button:top-1',
- 'peer-data-[size=default]/menu-button:top-1.5',
- 'peer-data-[size=lg]/menu-button:top-2.5',
- 'group-data-[collapsible=icon]:hidden',
- className,
- )}
- data-sidebar="menu-badge"
- ref={ref}
- {...props}
- />
-);
-SidebarMenuBadge.displayName = 'SidebarMenuBadge';
+}
-const SidebarMenuSkeleton = ({
+function SidebarMenuSkeleton({
className,
- ref,
showIcon = false,
...props
}: React.ComponentProps<'div'> & {
- ref?: React.Ref<HTMLDivElement>;
showIcon?: boolean;
-}) => {
+}) {
// Random width between 50 to 90%.
const [width] = React.useState(() => `${Math.floor(Math.random() * 40) + 50}%`);
@@ -731,7 +613,6 @@ const SidebarMenuSkeleton = ({
<div
className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
data-sidebar="menu-skeleton"
- ref={ref}
{...props}
>
{showIcon && (
@@ -751,49 +632,33 @@ const SidebarMenuSkeleton = ({
/>
</div>
);
-};
+}
-SidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton';
-
-const SidebarMenuSub = ({
- className,
- ref,
- ...props
-}: React.ComponentProps<'ul'> & { ref?: React.Ref<HTMLUListElement> }) => (
- <ul
- className={cn(
- 'border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5',
- 'group-data-[collapsible=icon]:hidden',
- className,
- )}
- data-sidebar="menu-sub"
- ref={ref}
- {...props}
- />
-);
-SidebarMenuSub.displayName = 'SidebarMenuSub';
-
-const SidebarMenuSubItem = ({ ref, ...props }: React.ComponentProps<'li'> & { ref?: React.Ref<HTMLLIElement> }) => (
- <li
- ref={ref}
- {...props}
- />
-);
-SidebarMenuSubItem.displayName = 'SidebarMenuSubItem';
+function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
+ return (
+ <ul
+ className={cn(
+ 'border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5',
+ 'group-data-[collapsible=icon]:hidden',
+ className,
+ )}
+ data-sidebar="menu-sub"
+ {...props}
+ />
+ );
+}
-const SidebarMenuSubButton = ({
+function SidebarMenuSubButton({
asChild = false,
className,
isActive,
- ref,
size = 'md',
...props
}: React.ComponentProps<'a'> & {
asChild?: boolean;
isActive?: boolean;
- ref?: React.Ref<HTMLAnchorElement>;
size?: 'md' | 'sm';
-}) => {
+}) {
const Comp = asChild ? Slot : 'a';
return (
@@ -809,13 +674,14 @@ const SidebarMenuSubButton = ({
data-active={isActive}
data-sidebar="menu-sub-button"
data-size={size}
- ref={ref}
{...props}
/>
);
-};
+}
-SidebarMenuSubButton.displayName = 'SidebarMenuSubButton';
+function SidebarMenuSubItem(props: React.ComponentProps<'li'>) {
+ return <li {...props} />;
+}
export {
Sidebar,
diff --git a/frontend/src/components/ui/switch.tsx b/frontend/src/components/ui/switch.tsx
index 627eb417..e2dd89ad 100644
--- a/frontend/src/components/ui/switch.tsx
+++ b/frontend/src/components/ui/switch.tsx
@@ -3,28 +3,22 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Switch = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & {
- ref?: React.Ref<React.ElementRef<typeof SwitchPrimitives.Root>>;
-}) => (
- <SwitchPrimitives.Root
- className={cn(
- 'peer focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
- className,
- )}
- {...props}
- ref={ref}
- >
- <SwitchPrimitives.Thumb
+function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitives.Root>) {
+ return (
+ <SwitchPrimitives.Root
className={cn(
- 'bg-background pointer-events-none block h-4 w-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',
+ 'peer focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
+ className,
)}
- />
- </SwitchPrimitives.Root>
-);
-Switch.displayName = SwitchPrimitives.Root.displayName;
+ {...props}
+ >
+ <SwitchPrimitives.Thumb
+ className={cn(
+ 'bg-background pointer-events-none block h-4 w-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',
+ )}
+ />
+ </SwitchPrimitives.Root>
+ );
+}
export { Switch };
diff --git a/frontend/src/components/ui/table.tsx b/frontend/src/components/ui/table.tsx
index 8b004ed1..253bbe78 100644
--- a/frontend/src/components/ui/table.tsx
+++ b/frontend/src/components/ui/table.tsx
@@ -2,113 +2,81 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
-const Table = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLTableElement> & { ref?: React.Ref<HTMLTableElement> }) => (
- <div className="relative w-full overflow-auto">
- <table
- className={cn('w-full caption-bottom text-sm', className)}
- ref={ref}
+function Table({ className, ...props }: React.ComponentProps<'table'>) {
+ return (
+ <div className="relative w-full overflow-auto">
+ <table
+ className={cn('w-full caption-bottom text-sm', className)}
+ {...props}
+ />
+ </div>
+ );
+}
+
+function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
+ return (
+ <tbody
+ className={cn('[&_tr:last-child]:border-0', className)}
{...props}
/>
- </div>
-);
-Table.displayName = 'Table';
-
-const TableHeader = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLTableSectionElement> & { ref?: React.Ref<HTMLTableSectionElement> }) => (
- <thead
- className={cn('[&_tr]:border-b', className)}
- ref={ref}
- {...props}
- />
-);
-TableHeader.displayName = 'TableHeader';
+ );
+}
-const TableBody = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLTableSectionElement> & { ref?: React.Ref<HTMLTableSectionElement> }) => (
- <tbody
- className={cn('[&_tr:last-child]:border-0', className)}
- ref={ref}
- {...props}
- />
-);
-TableBody.displayName = 'TableBody';
+function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
+ return (
+ <caption
+ className={cn('text-muted-foreground mt-4 text-sm', className)}
+ {...props}
+ />
+ );
+}
-const TableFooter = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLTableSectionElement> & { ref?: React.Ref<HTMLTableSectionElement> }) => (
- <tfoot
- className={cn('bg-muted/50 border-t font-medium last:[&>tr]:border-b-0', className)}
- ref={ref}
- {...props}
- />
-);
-TableFooter.displayName = 'TableFooter';
+function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
+ return (
+ <td
+ className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
+ {...props}
+ />
+ );
+}
-const TableRow = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLTableRowElement> & { ref?: React.Ref<HTMLTableRowElement> }) => (
- <tr
- className={cn('hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors', className)}
- ref={ref}
- {...props}
- />
-);
-TableRow.displayName = 'TableRow';
+function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
+ return (
+ <tfoot
+ className={cn('bg-muted/50 border-t font-medium last:[&>tr]:border-b-0', className)}
+ {...props}
+ />
+ );
+}
-const TableHead = ({
- className,
- ref,
- ...props
-}: React.ThHTMLAttributes<HTMLTableCellElement> & { ref?: React.Ref<HTMLTableCellElement> }) => (
- <th
- className={cn(
- 'text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-TableHead.displayName = 'TableHead';
+function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
+ return (
+ <th
+ className={cn(
+ 'text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-const TableCell = ({
- className,
- ref,
- ...props
-}: React.TdHTMLAttributes<HTMLTableCellElement> & { ref?: React.Ref<HTMLTableCellElement> }) => (
- <td
- className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
- ref={ref}
- {...props}
- />
-);
-TableCell.displayName = 'TableCell';
+function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
+ return (
+ <thead
+ className={cn('[&_tr]:border-b', className)}
+ {...props}
+ />
+ );
+}
-const TableCaption = ({
- className,
- ref,
- ...props
-}: React.HTMLAttributes<HTMLTableCaptionElement> & { ref?: React.Ref<HTMLTableCaptionElement> }) => (
- <caption
- className={cn('text-muted-foreground mt-4 text-sm', className)}
- ref={ref}
- {...props}
- />
-);
-TableCaption.displayName = 'TableCaption';
+function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
+ return (
+ <tr
+ className={cn('hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors', className)}
+ {...props}
+ />
+ );
+}
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
diff --git a/frontend/src/components/ui/tabs.tsx b/frontend/src/components/ui/tabs.tsx
index 10cc8130..d3dfc837 100644
--- a/frontend/src/components/ui/tabs.tsx
+++ b/frontend/src/components/ui/tabs.tsx
@@ -5,58 +5,40 @@ import { cn } from '@/lib/utils';
const Tabs = TabsPrimitive.Root;
-const TabsList = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
- ref?: React.Ref<React.ElementRef<typeof TabsPrimitive.List>>;
-}) => (
- <TabsPrimitive.List
- className={cn(
- 'bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-1',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-TabsList.displayName = TabsPrimitive.List.displayName;
+function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>) {
+ return (
+ <TabsPrimitive.Content
+ className={cn(
+ 'ring-offset-background focus-visible:ring-ring mt-4 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-const TabsTrigger = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {
- ref?: React.Ref<React.ElementRef<typeof TabsPrimitive.Trigger>>;
-}) => (
- <TabsPrimitive.Trigger
- className={cn(
- 'ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-md px-3 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
+function TabsList({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {
+ return (
+ <TabsPrimitive.List
+ className={cn(
+ 'bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-1',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-const TabsContent = ({
- className,
- ref,
- ...props
-}: React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof TabsPrimitive.Content>>;
-}) => (
- <TabsPrimitive.Content
- className={cn(
- 'ring-offset-background focus-visible:ring-ring mt-4 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden',
- className,
- )}
- ref={ref}
- {...props}
- />
-);
-TabsContent.displayName = TabsPrimitive.Content.displayName;
+function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
+ return (
+ <TabsPrimitive.Trigger
+ className={cn(
+ 'ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-md px-3 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm',
+ className,
+ )}
+ {...props}
+ />
+ );
+}
export { Tabs, TabsContent, TabsList, TabsTrigger };
diff --git a/frontend/src/components/ui/textarea.tsx b/frontend/src/components/ui/textarea.tsx
index db2a2b2d..438aa09b 100644
--- a/frontend/src/components/ui/textarea.tsx
+++ b/frontend/src/components/ui/textarea.tsx
@@ -42,7 +42,7 @@ const useTextarea = ({
}, [triggerAutoSize, maxHeight, minHeight, textareaRef]);
};
-type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
+type TextareaProps = React.ComponentProps<'textarea'> & {
maxHeight?: number;
minHeight?: number;
};
@@ -53,7 +53,7 @@ type TextareaRef = {
textarea: HTMLTextAreaElement;
};
-const Textarea = ({
+function Textarea({
className,
maxHeight = 118,
minHeight = 38,
@@ -61,7 +61,7 @@ const Textarea = ({
ref,
value,
...props
-}: TextareaProps & { ref?: React.Ref<TextareaRef> }) => {
+}: TextareaProps & { ref?: React.Ref<TextareaRef> }) {
const textareaRef = React.useRef<HTMLTextAreaElement | null>(null);
const [triggerAutoSize, setTriggerAutoSize] = React.useState('');
@@ -99,8 +99,6 @@ const Textarea = ({
value={value}
/>
);
-};
-
-Textarea.displayName = 'Textarea';
+}
export { Textarea };
diff --git a/frontend/src/components/ui/toggle-group.tsx b/frontend/src/components/ui/toggle-group.tsx
index 3386573a..0ef75d31 100644
--- a/frontend/src/components/ui/toggle-group.tsx
+++ b/frontend/src/components/ui/toggle-group.tsx
@@ -12,39 +12,30 @@ const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariant
variant: 'default',
});
-const ToggleGroup = ({
+function ToggleGroup({
children,
className,
- ref,
size,
variant,
...props
-}: React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
- VariantProps<typeof toggleVariants> & {
- ref?: React.Ref<React.ElementRef<typeof ToggleGroupPrimitive.Root>>;
- }) => (
- <ToggleGroupPrimitive.Root
- className={cn('flex items-center justify-center gap-1', className)}
- ref={ref}
- {...props}
- >
- <ToggleGroupContext.Provider value={{ size, variant }}>{children}</ToggleGroupContext.Provider>
- </ToggleGroupPrimitive.Root>
-);
-
-ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
+}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants>) {
+ return (
+ <ToggleGroupPrimitive.Root
+ className={cn('flex items-center justify-center gap-1', className)}
+ {...props}
+ >
+ <ToggleGroupContext.Provider value={{ size, variant }}>{children}</ToggleGroupContext.Provider>
+ </ToggleGroupPrimitive.Root>
+ );
+}
-const ToggleGroupItem = ({
+function ToggleGroupItem({
children,
className,
- ref,
size,
variant,
...props
-}: React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
- VariantProps<typeof toggleVariants> & {
- ref?: React.Ref<React.ElementRef<typeof ToggleGroupPrimitive.Item>>;
- }) => {
+}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>) {
const context = React.useContext(ToggleGroupContext);
return (
@@ -56,14 +47,11 @@ const ToggleGroupItem = ({
}),
className,
)}
- ref={ref}
{...props}
>
{children}
</ToggleGroupPrimitive.Item>
);
-};
-
-ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
+}
export { ToggleGroup, ToggleGroupItem };
diff --git a/frontend/src/components/ui/toggle.tsx b/frontend/src/components/ui/toggle.tsx
index c51b4cfe..2bbbabff 100644
--- a/frontend/src/components/ui/toggle.tsx
+++ b/frontend/src/components/ui/toggle.tsx
@@ -25,23 +25,18 @@ const toggleVariants = cva(
},
);
-const Toggle = ({
+function Toggle({
className,
- ref,
size,
variant,
...props
-}: React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
- VariantProps<typeof toggleVariants> & {
- ref?: React.Ref<React.ElementRef<typeof TogglePrimitive.Root>>;
- }) => (
- <TogglePrimitive.Root
- className={cn(toggleVariants({ className, size, variant }))}
- ref={ref}
- {...props}
- />
-);
-
-Toggle.displayName = TogglePrimitive.Root.displayName;
+}: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>) {
+ return (
+ <TogglePrimitive.Root
+ className={cn(toggleVariants({ className, size, variant }))}
+ {...props}
+ />
+ );
+}
export { Toggle, toggleVariants };
diff --git a/frontend/src/components/ui/tooltip.tsx b/frontend/src/components/ui/tooltip.tsx
index ca98fb98..6a324867 100644
--- a/frontend/src/components/ui/tooltip.tsx
+++ b/frontend/src/components/ui/tooltip.tsx
@@ -9,26 +9,23 @@ const Tooltip = TooltipPrimitive.Root;
const TooltipTrigger = TooltipPrimitive.Trigger;
-const TooltipContent = ({
+function TooltipContent({
className,
- ref,
sideOffset = 4,
...props
-}: React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {
- ref?: React.Ref<React.ElementRef<typeof TooltipPrimitive.Content>>;
-}) => (
- <TooltipPrimitive.Portal>
- <TooltipPrimitive.Content
- className={cn(
- 'bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 overflow-hidden rounded-md border px-3 py-1.5 text-xs shadow-md',
- className,
- )}
- ref={ref}
- sideOffset={sideOffset}
- {...props}
- />
- </TooltipPrimitive.Portal>
-);
-TooltipContent.displayName = TooltipPrimitive.Content.displayName;
+}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
+ return (
+ <TooltipPrimitive.Portal>
+ <TooltipPrimitive.Content
+ className={cn(
+ 'bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 overflow-hidden rounded-md border px-3 py-1.5 text-xs shadow-md',
+ className,
+ )}
+ sideOffset={sideOffset}
+ {...props}
+ />
+ </TooltipPrimitive.Portal>
+ );
+}
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };