mirror of
https://github.com/temetro/temetro.git
synced 2026-08-02 23:19:22 +00:00
4d6a5dc008
Components: - Replace components/ui primitives with COSS equivalents from the @coss/* shadcn registry. Add menu/preview-card/group; remove the superseded dropdown-menu, hover-card, button-group; keep carousel (no COSS equivalent). - Migrate live call sites to canonical COSS APIs preserving layout/behavior: sidebar menus (nav-user, team-switcher, nav-notifications), chat-input radio menu, patient dialogs/cards, auth forms (FieldGroup -> flex column), settings. - ai-elements: migrate the live conversation/message with behavior parity (Tooltip via render, Group/GroupText); repoint dormant files (hover-card -> preview-card, dropdown-menu -> menu, button-group -> group, InputGroupButton -> Button). Residual pre-existing Base UI type drift stays behind ignoreBuildErrors. Theme: - Adopt COSS default neutral tokens in globals.css with light + dark palettes. - Add next-themes (defaultTheme=dark, enableSystem) and drop the forced dark class. Align font variables to the COSS contract (--font-sans/-heading/-mono). Make scrollbars theme-aware. i18n: - Add i18next + react-i18next (lib/i18n/config.ts, locales/en/translation.json, components/i18n-provider.tsx mounted in layout). Convert auth forms, sidebar nav, and settings tabs to useTranslation() as the reference pattern. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
90 lines
3.0 KiB
TypeScript
90 lines
3.0 KiB
TypeScript
"use client";
|
|
|
|
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
import type React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export type TabsVariant = "default" | "underline";
|
|
|
|
export function Tabs({
|
|
className,
|
|
...props
|
|
}: TabsPrimitive.Root.Props): React.ReactElement {
|
|
return (
|
|
<TabsPrimitive.Root
|
|
className={cn(
|
|
"flex flex-col gap-2 data-[orientation=vertical]:flex-row",
|
|
className,
|
|
)}
|
|
data-slot="tabs"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export function TabsList({
|
|
variant = "default",
|
|
className,
|
|
children,
|
|
...props
|
|
}: TabsPrimitive.List.Props & {
|
|
variant?: TabsVariant;
|
|
}): React.ReactElement {
|
|
return (
|
|
<TabsPrimitive.List
|
|
className={cn(
|
|
"relative z-0 flex w-fit items-center justify-center gap-x-0.5 text-muted-foreground",
|
|
"data-[orientation=vertical]:flex-col",
|
|
variant === "default"
|
|
? "rounded-lg bg-muted p-0.5 text-muted-foreground/72"
|
|
: "data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1 *:data-[slot=tabs-tab]:hover:bg-accent",
|
|
className,
|
|
)}
|
|
data-slot="tabs-list"
|
|
{...props}
|
|
>
|
|
{children}
|
|
<TabsPrimitive.Indicator
|
|
className={cn(
|
|
"absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) -translate-y-(--active-tab-bottom) transition-[width,translate] duration-200 ease-in-out",
|
|
variant === "underline"
|
|
? "z-10 bg-primary data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=vertical]:-translate-x-px data-[orientation=horizontal]:translate-y-px"
|
|
: "-z-1 rounded-md bg-background shadow-sm/5 dark:bg-input",
|
|
)}
|
|
data-slot="tab-indicator"
|
|
/>
|
|
</TabsPrimitive.List>
|
|
);
|
|
}
|
|
|
|
export function TabsTab({
|
|
className,
|
|
...props
|
|
}: TabsPrimitive.Tab.Props): React.ReactElement {
|
|
return (
|
|
<TabsPrimitive.Tab
|
|
className={cn(
|
|
"relative flex h-9 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-[calc(--spacing(2.5)-1px)] font-medium text-base outline-none transition-[color,background-color,box-shadow] hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-foreground data-disabled:opacity-64 sm:h-8 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0",
|
|
className,
|
|
)}
|
|
data-slot="tabs-tab"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export function TabsPanel({
|
|
className,
|
|
...props
|
|
}: TabsPrimitive.Panel.Props): React.ReactElement {
|
|
return (
|
|
<TabsPrimitive.Panel
|
|
className={cn("flex-1 outline-none", className)}
|
|
data-slot="tabs-content"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { TabsPrimitive, TabsTab as TabsTrigger, TabsPanel as TabsContent };
|