Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🧹 refactor: Remove Unused Components from the Client Package (#17437)

Marco Beretta14aba5132032
diff --git a/client/src/components/Nav/AccountSettings.tsx b/client/src/components/Nav/AccountSettings.tsx
index a0a2121c8c..8907a15af9 100644
--- a/client/src/components/Nav/AccountSettings.tsx
+++ b/client/src/components/Nav/AccountSettings.tsx
@@ -2,7 +2,7 @@ import { useState, memo, useRef } from 'react';
import { useSetAtom } from 'jotai';
import { useSetRecoilState } from 'recoil';
import * as Menu from '@ariakit/react/menu';
-import { GearIcon, DropdownMenuSeparator, Avatar } from '@librechat/client';
+import { GearIcon, Avatar } from '@librechat/client';
import {
Archive,
ChevronRight,
@@ -72,7 +72,9 @@ function HelpSubmenu({
<Keyboard className="icon-md" aria-hidden="true" />
{localize('com_shortcut_keyboard_shortcuts')}
</Menu.MenuItem>
- {showLegalDivider && (hasTos || hasPrivacy) && <DropdownMenuSeparator />}
+ {showLegalDivider && (hasTos || hasPrivacy) && (
+ <Menu.MenuSeparator className="bg-surface-hover -mx-1 my-1 h-px border-0" />
+ )}
{hasTos && (
<Menu.MenuItem
onClick={() => openInNewTab(termsOfServiceURL)}
@@ -146,7 +148,7 @@ function AccountSettings({ collapsed = false }: { collapsed?: boolean }) {
<div className="text-text-secondary ms-3 me-2 py-2 text-sm" role="note">
{user?.email ?? localize('com_nav_user')}
</div>
- <DropdownMenuSeparator />
+ <Menu.MenuSeparator className="bg-surface-hover -mx-1 my-1 h-px border-0" />
<HelpSubmenu
helpAndFaqURL={startupConfig?.helpAndFaqURL}
termsOfServiceURL={termsOfServiceUrl}
@@ -180,7 +182,7 @@ function AccountSettings({ collapsed = false }: { collapsed?: boolean }) {
<GearIcon className="icon-md" aria-hidden="true" />
{localize('com_nav_settings')}
</Menu.MenuItem>
- <DropdownMenuSeparator />
+ <Menu.MenuSeparator className="bg-surface-hover -mx-1 my-1 h-px border-0" />
<Menu.MenuItem onClick={() => logout()} className="select-item text-sm">
<LogOut className="icon-md" aria-hidden="true" />
{localize('com_nav_log_out')}
diff --git a/e2e/specs/mock/scenarios/account-menu-separators.spec.ts b/e2e/specs/mock/scenarios/account-menu-separators.spec.ts
new file mode 100644
index 0000000000..cb04fbfc59
--- /dev/null
+++ b/e2e/specs/mock/scenarios/account-menu-separators.spec.ts
@@ -0,0 +1,34 @@
+import { expect, test } from '@playwright/test';
+import { NEW_CHAT_PATH } from '../helpers';
+import { openSidebar } from './sidebar';
+
+/**
+ * The account menu is an Ariakit menu, and its dividers are that menu's own separators: exposed
+ * as separators inside the menu, drawn as a 1px rule, and skipped by the arrow keys.
+ */
+test('the account menu draws its dividers as menu separators @scenario:account-menu-separators', async ({
+ page,
+}) => {
+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });
+ /** Mobile keeps the account menu in the drawer. */
+ await openSidebar(page);
+ await page.getByTestId('nav-user').filter({ visible: true }).first().click();
+
+ const menu = page.getByRole('menu');
+ await expect(menu).toBeVisible();
+ const separators = menu.getByRole('separator');
+ await expect(separators.first()).toBeVisible();
+ expect(await separators.count()).toBeGreaterThanOrEqual(2);
+ for (const separator of await separators.all()) {
+ const box = await separator.boundingBox();
+ expect(box?.height).toBeCloseTo(1, 0);
+ }
+
+ const items = menu.getByRole('menuitem');
+ await items.first().focus();
+ const count = await items.count();
+ for (let step = 1; step < count; step++) {
+ await page.keyboard.press('ArrowDown');
+ await expect(menu.locator(':focus')).toHaveRole('menuitem');
+ }
+});
diff --git a/packages/client/src/components/Accordion.tsx b/packages/client/src/components/Accordion.tsx
deleted file mode 100644
index 112752b7a3..0000000000
--- a/packages/client/src/components/Accordion.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import * as React from 'react';
-import { ChevronDownIcon } from '@radix-ui/react-icons';
-import * as AccordionPrimitive from '@radix-ui/react-accordion';
-import { cn } from '~/utils';
-
-const Accordion: React.ForwardRefExoticComponent<
- (AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) &
- React.RefAttributes<HTMLDivElement>
-> = AccordionPrimitive.Root;
-
-const AccordionItem: React.ForwardRefExoticComponent<
- Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, 'ref'> &
- React.RefAttributes<HTMLDivElement>
-> = React.forwardRef<
- React.ElementRef<typeof AccordionPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
->(({ className = '', ...props }, ref) => (
- <AccordionPrimitive.Item ref={ref} className={cn(className)} {...props} />
-));
-AccordionItem.displayName = 'AccordionItem';
-
-const AccordionTrigger: React.ForwardRefExoticComponent<
- Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, 'ref'> &
- React.RefAttributes<HTMLButtonElement>
-> = React.forwardRef<
- React.ElementRef<typeof AccordionPrimitive.Trigger>,
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
->(({ className = '', children, ...props }, ref) => (
- <AccordionPrimitive.Header className="flex">
- <AccordionPrimitive.Trigger
- ref={ref}
- className={cn(
- 'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
- className,
- )}
- {...props}
- >
- {children}
- <ChevronDownIcon className="text-text-secondary h-4 w-4 shrink-0 transition-transform duration-200" />
- </AccordionPrimitive.Trigger>
- </AccordionPrimitive.Header>
-));
-AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
-
-const AccordionContent: React.ForwardRefExoticComponent<
- Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, 'ref'> &
- React.RefAttributes<HTMLDivElement>
-> = React.forwardRef<
- React.ElementRef<typeof AccordionPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
->(({ className = '', children, ...props }, ref) => (
- <AccordionPrimitive.Content
- ref={ref}
- className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-x-visible overflow-y-hidden text-sm transition-opacity data-[state=closed]:opacity-0 data-[state=open]:opacity-100"
- {...props}
- >
- <div className={cn('pt-0 pb-4', className)}>{children}</div>
- </AccordionPrimitive.Content>
-));
-AccordionContent.displayName = AccordionPrimitive.Content.displayName;
-
-export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
diff --git a/packages/client/src/components/Breadcrumb.tsx b/packages/client/src/components/Breadcrumb.tsx
deleted file mode 100644
index 6405686024..0000000000
--- a/packages/client/src/components/Breadcrumb.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import * as React from 'react';
-import { JSX } from 'react/jsx-runtime';
-import { Slot } from '@radix-ui/react-slot';
-import { ChevronRight, MoreHorizontal } from 'lucide-react';
-import { cn } from '~/utils';
-
-const Breadcrumb: React.ForwardRefExoticComponent<
- Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, 'ref'> & {
- separator?: React.ReactNode;
- } & React.RefAttributes<HTMLElement>
-> = React.forwardRef<
- HTMLElement,
- React.ComponentPropsWithoutRef<'nav'> & {
- separator?: React.ReactNode;
- }
->(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
-Breadcrumb.displayName = 'Breadcrumb';
-
-const BreadcrumbList: React.ForwardRefExoticComponent<
- Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, 'ref'> &
- React.RefAttributes<HTMLOListElement>
-> = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<'ol'>>(
- ({ className, ...props }, ref) => (
- <ol
- ref={ref}
- className={cn(
- 'text-text-secondary flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
- className,
- )}
- {...props}
- />
- ),
-);
-BreadcrumbList.displayName = 'BreadcrumbList';
-
-const BreadcrumbItem: React.ForwardRefExoticComponent<
- Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, 'ref'> &
- React.RefAttributes<HTMLLIElement>
-> = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'>>(
- ({ className, ...props }, ref) => (
- <li ref={ref} className={cn('inline-flex items-center gap-1.5', className)} {...props} />
- ),
-);
-BreadcrumbItem.displayName = 'BreadcrumbItem';
-
-const BreadcrumbLink: React.ForwardRefExoticComponent<
- Omit<
- React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>,
- 'ref'
- > & {
- asChild?: boolean;
- } & React.RefAttributes<HTMLAnchorElement>
-> = React.forwardRef<
- HTMLAnchorElement,
- React.ComponentPropsWithoutRef<'a'> & {
- asChild?: boolean;
- }
->(({ asChild, className, ...props }, ref) => {
- const Comp = asChild ? Slot : 'a';
-
- return (
- <Comp
- ref={ref}
- className={cn('hover:text-text-primary transition-colors', className)}
- {...props}
- />
- );
-});
-BreadcrumbLink.displayName = 'BreadcrumbLink';
-
-const BreadcrumbPage: React.ForwardRefExoticComponent<
- Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, 'ref'> &
- React.RefAttributes<HTMLSpanElement>
-> = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<'span'>>(
- ({ className, ...props }, ref) => (
- <span
- ref={ref}
- role="link"
- aria-disabled="true"
- aria-current="page"
- className={cn('text-text-primary font-normal', className)}
- {...props}
- />
- ),
-);
-BreadcrumbPage.displayName = 'BreadcrumbPage';
-
-const BreadcrumbSeparator: {
- ({ children, className, ...props }: React.ComponentProps<'li'>): JSX.Element;
- displayName: string;
-} = ({ children, className, ...props }: React.ComponentProps<'li'>): JSX.Element => (
- <li
- role="presentation"
- aria-hidden="true"
- className={cn('[&>svg]:size-3.5', className)}
- {...props}
- >
- {children ?? <ChevronRight className="dir-rtl:-scale-x-100" />}
- </li>
-);
-BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
-
-const BreadcrumbEllipsis: {
- ({ className, ...props }: React.ComponentProps<'span'>): JSX.Element;
- displayName: string;
-} = ({ className, ...props }: React.ComponentProps<'span'>): JSX.Element => (
- <span
- role="presentation"
- aria-hidden="true"
- className={cn('flex h-9 w-9 items-center justify-center', className)}
- {...props}
- >
- <MoreHorizontal className="h-4 w-4" />
- <span className="sr-only">More</span>
- </span>
-);
-BreadcrumbEllipsis.displayName = 'BreadcrumbElipssis';
-
-export {
- Breadcrumb,
- BreadcrumbList,
- BreadcrumbItem,
- BreadcrumbLink,
- BreadcrumbPage,
- BreadcrumbSeparator,
- BreadcrumbEllipsis,
-};
diff --git a/packages/client/src/components/CheckboxButton.spec.tsx b/packages/client/src/components/CheckboxButton.spec.tsx
deleted file mode 100644
index 5f3c1e53c8..0000000000
--- a/packages/client/src/components/CheckboxButton.spec.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import '@testing-library/jest-dom';
-import { render, screen } from '@testing-library/react';
-import CheckboxButton from './CheckboxButton';
-
-describe('CheckboxButton', () => {
- it('uses theme-owned control geometry', () => {
- render(<CheckboxButton label="Tools" icon={<span>icon</span>} />);
-
- expect(screen.getByRole('checkbox', { name: 'Tools' })).toHaveClass(
- 'h-theme-control',
- 'w-theme-control',
- 'rounded-theme-control-round',
- 'gap-theme-control-gap',
- 'p-theme-compact',
- 'md:px-theme-control-x',
- );
- });
-});
diff --git a/packages/client/src/components/CheckboxButton.tsx b/packages/client/src/components/CheckboxButton.tsx
deleted file mode 100644
index a49547fedc..0000000000
--- a/packages/client/src/components/CheckboxButton.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import * as React from 'react';
-import { useEffect } from 'react';
-import { Checkbox, useStoreState, useCheckboxStore } from '@ariakit/react';
-import { composerControlClasses } from '~/utils/composer';
-import { cn } from '~/utils';
-
-const CheckboxButton: React.ForwardRefExoticComponent<
- {
- icon?: React.ReactNode;
- label: string;
- className?: string;
- checked?: boolean;
- defaultChecked?: boolean;
- isCheckedClassName?: string;
- setValue?: (values: {
- e?: React.ChangeEvent<HTMLInputElement>;
- value: boolean | string;
- }) => void;
- } & React.RefAttributes<HTMLInputElement>
-> = React.forwardRef<
- HTMLInputElement,
- {
- icon?: React.ReactNode;
- label: string;
- className?: string;
- checked?: boolean;
- defaultChecked?: boolean;
- isCheckedClassName?: string;
- setValue?: (values: {
- e?: React.ChangeEvent<HTMLInputElement>;
- value: boolean | string;
- }) => void;
- }
->(({ icon, label, setValue, className, checked, defaultChecked, isCheckedClassName }, ref) => {
- const checkbox = useCheckboxStore();
- const isChecked = useStoreState(checkbox, (state) => state?.value);
- const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
- e.stopPropagation();
- if (typeof isChecked !== 'boolean') {
- return;
- }
- setValue?.({ e, value: !isChecked });
- };
-
- // Sync with controlled checked prop
- useEffect(() => {
- if (checked !== undefined) {
- checkbox.setValue(checked);
- }
- }, [checked, checkbox]);
-
- // Set initial value from defaultChecked
- useEffect(() => {
- if (defaultChecked !== undefined && checked === undefined) {
- checkbox.setValue(defaultChecked);
- }
- }, [defaultChecked, checked, checkbox]);
-
- return (
- <Checkbox
- ref={ref}
- store={checkbox}
- onChange={onChange}
- className={cn(
- composerControlClasses(),
- 'w-theme-control p-theme-compact md:px-theme-control-x max-w-fit md:w-full',
-
- // Checked state styling
- isChecked && isCheckedClassName && isCheckedClassName,
-
- // Additional custom classes
- className,
- )}
- render={<button type="button" aria-label={label} />}
- >
- {/* Icon if provided */}
- {icon && <span className="icon-md text-text-primary">{icon as React.JSX.Element}</span>}
-
- {/* Show the label on larger screens */}
- <span className="hidden truncate md:block">{label}</span>
- </Checkbox>
- );
-});
-
-CheckboxButton.displayName = 'CheckboxButton';
-
-export default CheckboxButton;
diff --git a/packages/client/src/components/DropdownMenu.tsx b/packages/client/src/components/DropdownMenu.tsx
deleted file mode 100644
index 4e3ed859ef..0000000000
--- a/packages/client/src/components/DropdownMenu.tsx
+++ /dev/null
@@ -1,242 +0,0 @@
-import * as React from 'react';
-import { JSX } from 'react/jsx-runtime';
-import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
-import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
-import { usePopoverZIndex } from './OriginalDialog';
-import { cn, disabledInkClasses } from '~/utils';
-
-function DropdownMenu({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): JSX.Element {
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
-}
-
-function DropdownMenuPortal({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): JSX.Element {
- return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
-}
-
-function DropdownMenuTrigger({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): JSX.Element {
- return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
-}
-
-function DropdownMenuContent({
- className,
- sideOffset = 4,
- style,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): JSX.Element {
- const zIndex = usePopoverZIndex();
- return (
- <DropdownMenuPrimitive.Portal>
- <DropdownMenuPrimitive.Content
- data-slot="dropdown-menu-content"
- sideOffset={sideOffset}
- style={{ zIndex, ...style }}
- className={cn(
- 'border-border-medium bg-surface-primary text-text-primary 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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
- className,
- )}
- {...props}
- />
- </DropdownMenuPrimitive.Portal>
- );
-}
-
-function DropdownMenuGroup({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): JSX.Element {
- return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
-}
-
-function DropdownMenuItem({
- className,
- inset,
- variant = 'default',
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
- inset?: boolean;
- variant?: 'default' | 'destructive';
-}): JSX.Element {
- return (
- <DropdownMenuPrimitive.Item
- data-slot="dropdown-menu-item"
- data-inset={inset}
- data-variant={variant}
- className={cn(
- "focus:bg-surface-hover focus:text-text-primary data-[variant=destructive]:text-text-destructive data-[variant=destructive]:focus:bg-status-error-subtle data-[variant=destructive]:focus:text-text-destructive [&_svg:not([class*='text-'])]:text-text-secondary data-[variant=destructive]:*:[svg]:text-text-destructive! relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- disabledInkClasses,
- className,
- )}
- {...props}
- />
- );
-}
-
-function DropdownMenuCheckboxItem({
- className,
- children,
- checked,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): JSX.Element {
- return (
- <DropdownMenuPrimitive.CheckboxItem
- data-slot="dropdown-menu-checkbox-item"
- className={cn(
- "focus:bg-surface-hover focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 ps-8 pe-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- disabledInkClasses,
- className,
- )}
- checked={checked}
- {...props}
- >
- <span className="pointer-events-none absolute inset-s-2 flex size-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <CheckIcon className="size-4" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.CheckboxItem>
- );
-}
-
-function DropdownMenuRadioGroup({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): JSX.Element {
- return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
-}
-
-function DropdownMenuRadioItem({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): JSX.Element {
- return (
- <DropdownMenuPrimitive.RadioItem
- data-slot="dropdown-menu-radio-item"
- className={cn(
- "focus:bg-surface-hover focus:text-text-primary relative flex cursor-default items-center gap-2 rounded-sm py-1.5 ps-8 pe-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- disabledInkClasses,
- className,
- )}
- {...props}
- >
- <span className="pointer-events-none absolute inset-s-2 flex size-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <CircleIcon className="size-2 fill-current" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.RadioItem>
- );
-}
-
-function DropdownMenuLabel({
- className,
- inset,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
- inset?: boolean;
-}): JSX.Element {
- return (
- <DropdownMenuPrimitive.Label
- data-slot="dropdown-menu-label"
- data-inset={inset}
- className={cn('px-2 py-1.5 text-sm font-medium data-[inset]:ps-8', className)}
- {...props}
- />
- );
-}
-
-function DropdownMenuSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): JSX.Element {
- return (
- <DropdownMenuPrimitive.Separator
- data-slot="dropdown-menu-separator"
- className={cn('bg-surface-hover -mx-1 my-1 h-px', className)}
- {...props}
- />
- );
-}
-
-function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): JSX.Element {
- return (
- <span
- data-slot="dropdown-menu-shortcut"
- className={cn('text-text-secondary ms-auto text-xs tracking-widest', className)}
- {...props}
- />
- );
-}
-
-function DropdownMenuSub({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): JSX.Element {
- return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
-}
-
-function DropdownMenuSubTrigger({
- className,
- inset,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
- inset?: boolean;
-}): JSX.Element {
- return (
- <DropdownMenuPrimitive.SubTrigger
- data-slot="dropdown-menu-sub-trigger"
- data-inset={inset}
- className={cn(
- 'focus:bg-surface-hover focus:text-text-primary data-[state=open]:bg-surface-hover data-[state=open]:text-text-primary flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:ps-8',
- className,
- )}
- {...props}
- >
- {children}
- <ChevronRightIcon className="dir-rtl:-scale-x-100 ms-auto size-4" />
- </DropdownMenuPrimitive.SubTrigger>
- );
-}
-
-function DropdownMenuSubContent({
- className,
- style,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): JSX.Element {
- const zIndex = usePopoverZIndex();
- return (
- <DropdownMenuPrimitive.SubContent
- data-slot="dropdown-menu-sub-content"
- style={{ zIndex, ...style }}
- className={cn(
- 'border-border-medium bg-surface-primary text-text-primary 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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-lg',
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- DropdownMenu,
- DropdownMenuPortal,
- DropdownMenuTrigger,
- DropdownMenuContent,
- DropdownMenuGroup,
- DropdownMenuLabel,
- DropdownMenuItem,
- DropdownMenuCheckboxItem,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
- DropdownMenuSeparator,
- DropdownMenuShortcut,
- DropdownMenuSub,
- DropdownMenuSubTrigger,
- DropdownMenuSubContent,
-};
diff --git a/packages/client/src/components/FormInput.tsx b/packages/client/src/components/FormInput.tsx
deleted file mode 100644
index 7ac1b466c7..0000000000
--- a/packages/client/src/components/FormInput.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import React from 'react';
-import { JSX } from 'react/jsx-runtime';
-import type { ControllerRenderProps, FieldValues, FieldPath } from 'react-hook-form';
-import { Label } from './Label';
-import { Input } from './Input';
-import { cn } from '~/utils';
-
-export default function FormInput<
- TFieldValues extends FieldValues = FieldValues,
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
->({
- field,
- label,
- labelClass,
- inputClass,
- containerClass,
- labelAdjacent,
- placeholder = '',
- type = 'string',
-}: {
- field: ControllerRenderProps<TFieldValues, TName>;
- label: string;
- labelClass?: string;
- inputClass?: string;
- placeholder?: string;
- containerClass?: string;
- type?: 'string' | 'number';
- labelAdjacent?: React.ReactNode;
-}): JSX.Element {
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
- const value = e.target.value;
-
- if (type !== 'number') {
- field.onChange(value);
- return;
- }
-
- if (value === '') {
- field.onChange(value);
- } else if (!isNaN(Number(value))) {
- field.onChange(Number(value));
- }
- };
-
- return (
- <div className={cn('flex w-full flex-col items-center gap-2', containerClass)}>
- <div className="flex w-full items-center justify-start gap-2">
- <Label
- htmlFor={`${field.name}-input`}
- className={cn('text-text-primary text-start text-sm font-semibold', labelClass)}
- >
- {label}
- </Label>
- {labelAdjacent}
- </div>
- <Input
- id={`${field.name}-input`}
- value={field.value ?? ''}
- onChange={handleChange}
- placeholder={placeholder}
- className={cn(
- 'bg-surface-secondary flex h-10 max-h-10 w-full resize-none border-none px-3 py-2',
- inputClass,
- )}
- />
- </div>
- );
-}
diff --git a/packages/client/src/components/InputWithDropDown.tsx b/packages/client/src/components/InputWithDropDown.tsx
deleted file mode 100644
index e91f6e12d8..0000000000
--- a/packages/client/src/components/InputWithDropDown.tsx
+++ /dev/null
@@ -1,159 +0,0 @@
-import * as React from 'react';
-import { Input } from './Input';
-import { cn } from '~/utils';
-
-export type InputWithDropdownProps = React.InputHTMLAttributes<HTMLInputElement> & {
- options: string[];
- onSelect?: (value: string) => void;
-};
-
-const InputWithDropdown: React.ForwardRefExoticComponent<
- React.InputHTMLAttributes<HTMLInputElement> & {
- options: string[];
- onSelect?: (value: string) => void;
- } & React.RefAttributes<HTMLInputElement>
-> = React.forwardRef<HTMLInputElement, InputWithDropdownProps>(
- ({ className, options, onSelect, ...props }, ref) => {
- const [isOpen, setIsOpen] = React.useState(false);
- const [inputValue, setInputValue] = React.useState((props.value as string) || '');
- const [highlightedIndex, setHighlightedIndex] = React.useState(-1);
- const inputRef = React.useRef<HTMLInputElement>(null);
-
- const handleSelect = (value: string) => {
- setInputValue(value);
- setIsOpen(false);
- setHighlightedIndex(-1);
- if (onSelect) {
- onSelect(value);
- }
- if (props.onChange) {
- props.onChange({ target: { value } } as React.ChangeEvent<HTMLInputElement>);
- }
- };
-
- const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
- setInputValue(e.target.value);
- if (props.onChange) {
- props.onChange(e);
- }
- };
-
- const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
- switch (e.key) {
- case 'ArrowDown':
- e.preventDefault();
- if (!isOpen) {
- setIsOpen(true);
- } else {
- setHighlightedIndex((prevIndex) =>
- prevIndex < options.length - 1 ? prevIndex + 1 : prevIndex,
- );
- }
- break;
- case 'ArrowUp':
- e.preventDefault();
- setHighlightedIndex((prevIndex) => (prevIndex > 0 ? prevIndex - 1 : 0));
- break;
- case 'Enter':
- e.preventDefault();
- if (isOpen && highlightedIndex !== -1) {
- handleSelect(options[highlightedIndex]);
- }
- setIsOpen(false);
- break;
- case 'Escape':
- setIsOpen(false);
- setHighlightedIndex(-1);
- break;
- }
- };
-
- React.useEffect(() => {
- const handleClickOutside = (event: MouseEvent) => {
- if (inputRef.current && !inputRef.current.contains(event.target as Node)) {
- setIsOpen(false);
- setHighlightedIndex(-1);
- }
- };
-
- document.addEventListener('mousedown', handleClickOutside);
- return () => {
- document.removeEventListener('mousedown', handleClickOutside);
- };
- }, []);
-
- return (
- <div className="relative" ref={inputRef}>
- <div className="relative">
- <Input
- {...props}
- value={inputValue}
- onChange={handleInputChange}
- onKeyDown={handleKeyDown}
- aria-haspopup="listbox"
- aria-controls="dropdown-list"
- className={cn('bg-surface-secondary', className ?? '')}
- ref={ref}
- />
- <button
- type="button"
- className="text-text-tertiary hover:text-text-secondary focus-visible:ring-focus-control absolute inset-y-0 inset-e-0 flex items-center rounded-md px-2 focus-visible:ring-1 focus-visible:outline-hidden"
- onClick={() => setIsOpen(!isOpen)}
- aria-label={isOpen ? 'Close dropdown' : 'Open dropdown'}
- >
- <svg
- className="h-5 w-5"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth={2}
- d="M19 9l-7 7-7-7"
- />
- </svg>
- </button>
- </div>
- {isOpen && (
- <ul
- id="dropdown-list"
- role="listbox"
- className="border-border-medium bg-surface-secondary focus:ring-focus-control absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md border shadow-lg focus:ring-1 focus:ring-inset"
- >
- {options.map((option, index) => (
- <li
- key={index}
- role="option"
- aria-selected={index === highlightedIndex}
- className={cn(
- 'cursor-pointer rounded-md px-3 py-2',
- 'focus:bg-surface-tertiary focus:ring-focus-control focus:ring-1 focus:outline-hidden focus:ring-inset',
- index === highlightedIndex
- ? 'bg-surface-active text-text-primary'
- : 'text-text-secondary hover:bg-surface-tertiary',
- )}
- onClick={() => handleSelect(option)}
- onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.preventDefault();
- handleSelect(option);
- }
- }}
- tabIndex={0}
- >
- {option}
- </li>
- ))}
- </ul>
- )}
- </div>
- );
- },
-);
-
-InputWithDropdown.displayName = 'InputWithDropdown';
-
-export default InputWithDropdown;
diff --git a/packages/client/src/components/QuestionMark.tsx b/packages/client/src/components/QuestionMark.tsx
deleted file mode 100644
index 4f64151773..0000000000
--- a/packages/client/src/components/QuestionMark.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { JSX } from 'react/jsx-runtime';
-import { cn } from '~/utils';
-
-export const QuestionMark = ({
- className = '',
-}: {
- className?: string | undefined;
-}): JSX.Element => {
- return (
- <span>
- <div
- className={cn(
- 'border-border-medium text-text-tertiary ms-2 flex h-3.5 w-3.5 cursor-default items-center justify-center rounded-full border text-[0.5rem] leading-none font-medium',
- className,
- )}
- >
- ?
- </div>
- </span>
- );
-};
diff --git a/packages/client/src/components/focus.spec.tsx b/packages/client/src/components/focus.spec.tsx
index 1342378564..d56724ceeb 100644
--- a/packages/client/src/components/focus.spec.tsx
+++ b/packages/client/src/components/focus.spec.tsx
@@ -4,7 +4,6 @@ import userEvent from '@testing-library/user-event';
import { render, screen } from '@testing-library/react';
import { Table, TableBody, TableCell, TableRow } from './Table';
import { Tabs, TabsList, TabsTrigger } from './Tabs';
-import InputWithDropdown from './InputWithDropDown';
import { InputCombobox } from './InputCombobox';
import { SecretInput } from './SecretInput';
import Dropdown from './Dropdown';
@@ -50,25 +49,6 @@ describe('shared control keyboard focus', () => {
});
});
- it('rings the dropdown toggle and its options in the focus role', async () => {
- const user = userEvent.setup();
- render(<InputWithDropdown aria-label="Stop word" options={['alpha', 'beta']} />);
-
- await user.tab();
- await user.tab();
- const toggle = screen.getByRole('button', { name: 'Open dropdown' });
- expect(toggle).toHaveFocus();
- expect(toggle).toHaveClass('focus-visible:ring-1', 'focus-visible:ring-focus-control');
-
- await user.keyboard('{Enter}');
- expect(screen.getByRole('listbox')).toHaveClass('focus:ring-focus-control');
-
- await user.tab();
- const [first] = screen.getAllByRole('option');
- expect(first).toHaveFocus();
- expect(first).toHaveClass('focus:ring-1', 'focus:ring-focus-control');
- });
-
it('rings the combobox only while it holds keyboard focus', async () => {
const user = userEvent.setup();
render(
diff --git a/packages/client/src/components/index.ts b/packages/client/src/components/index.ts
index 4d1c51b4a5..312145a2ec 100644
--- a/packages/client/src/components/index.ts
+++ b/packages/client/src/components/index.ts
@@ -1,14 +1,11 @@
-export * from './Accordion';
export * from './AnimatedTabs';
export * from './Alert';
export * from './AlertDialog';
-export * from './Breadcrumb';
export * from './Button';
export * from './Chip';
export * from './SeriesLabel';
export * from './Checkbox';
export * from './DisclosureChevron';
-export * from './DropdownMenu';
export * from './HoverCard';
export * from './Field';
export * from './Focus';
@@ -20,7 +17,6 @@ export * from './FieldMessage';
export * from './Label';
export * from './MorphIcon';
export * from './OriginalDialog';
-export * from './QuestionMark';
export * from './Slider';
export * from './Separator';
export * from './InputCombobox';
@@ -55,7 +51,6 @@ export type {
export { default as Dropdown } from './Dropdown';
export { default as DataTable } from './DataTable';
export { default as SplitText } from './SplitText';
-export { default as FormInput } from './FormInput';
export { default as PixelCard } from './PixelCard';
export { default as FileUpload } from './FileUpload';
export { default as MultiSelect } from './MultiSelect';
@@ -63,7 +58,6 @@ export { default as DropdownPopup } from './DropdownPopup';
export { default as DelayedRender } from './DelayedRender';
export { default as ThemeSelector } from './ThemeSelector';
export { default as InfoHoverCard } from './InfoHoverCard';
-export { default as CheckboxButton } from './CheckboxButton';
export { default as ControlCombobox } from './ControlCombobox';
export { default as EmptyState } from './EmptyState';
export type { EmptyStateProps } from './EmptyState';
@@ -79,7 +73,6 @@ export type {
TimeColumnProps,
} from './TimePicker';
export { default as OGDialogTemplate } from './OGDialogTemplate';
-export { default as InputWithDropdown } from './InputWithDropDown';
export { default as AnimatedSearchInput } from './AnimatedSearchInput';
export { default as VirtualizedDataTable } from './DataTable/DataTable';
export type {
diff --git a/packages/client/src/theme/highContrast.css b/packages/client/src/theme/highContrast.css
index 02dd3a79cd..716e88570f 100644
--- a/packages/client/src/theme/highContrast.css
+++ b/packages/client/src/theme/highContrast.css
@@ -10,7 +10,7 @@
* only works because selection is marked by a perimeter; and `::placeholder`
* has no token at all, so it falls through to Tailwind preflight's raw
* `gray-400`. Both defects reach package primitives — `TimePicker`,
- * `MultiSelect`, `InputWithDropDown`, `Badge`, `DataTable`,
+ * `MultiSelect`, `Badge`, `DataTable`,
* `Input`, `Textarea` — so shipping the palette without these rules ships a
* broken palette.
*