mirror of
https://github.com/temetro/temetro.git
synced 2026-07-28 12:48:58 +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>
75 lines
2.8 KiB
TypeScript
75 lines
2.8 KiB
TypeScript
"use client";
|
|
|
|
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
|
|
import type React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export function ScrollArea({
|
|
className,
|
|
children,
|
|
scrollFade = false,
|
|
scrollbarGutter = false,
|
|
fill = false,
|
|
clampContentMinWidth = true,
|
|
...props
|
|
}: ScrollAreaPrimitive.Root.Props & {
|
|
scrollFade?: boolean;
|
|
scrollbarGutter?: boolean;
|
|
fill?: boolean;
|
|
clampContentMinWidth?: boolean;
|
|
}): React.ReactElement {
|
|
return (
|
|
<ScrollAreaPrimitive.Root
|
|
className={cn("size-full min-h-0", className)}
|
|
{...props}
|
|
>
|
|
<ScrollAreaPrimitive.Viewport
|
|
className={cn(
|
|
"h-full rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-y:overscroll-y-contain data-has-overflow-x:overscroll-x-contain",
|
|
scrollFade &&
|
|
"mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
|
|
scrollbarGutter &&
|
|
"data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5",
|
|
)}
|
|
data-slot="scroll-area-viewport"
|
|
>
|
|
<ScrollAreaPrimitive.Content
|
|
className={cn(fill && "size-full")}
|
|
data-slot="scroll-area-content"
|
|
style={clampContentMinWidth ? { minWidth: 0 } : undefined}
|
|
>
|
|
{children}
|
|
</ScrollAreaPrimitive.Content>
|
|
</ScrollAreaPrimitive.Viewport>
|
|
<ScrollBar orientation="vertical" />
|
|
<ScrollBar orientation="horizontal" />
|
|
<ScrollAreaPrimitive.Corner data-slot="scroll-area-corner" />
|
|
</ScrollAreaPrimitive.Root>
|
|
);
|
|
}
|
|
|
|
export function ScrollBar({
|
|
className,
|
|
orientation = "vertical",
|
|
...props
|
|
}: ScrollAreaPrimitive.Scrollbar.Props): React.ReactElement {
|
|
return (
|
|
<ScrollAreaPrimitive.Scrollbar
|
|
className={cn(
|
|
"m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
|
|
className,
|
|
)}
|
|
data-slot="scroll-area-scrollbar"
|
|
orientation={orientation}
|
|
{...props}
|
|
>
|
|
<ScrollAreaPrimitive.Thumb
|
|
className="relative flex-1 rounded-full bg-foreground/20"
|
|
data-slot="scroll-area-thumb"
|
|
/>
|
|
</ScrollAreaPrimitive.Scrollbar>
|
|
);
|
|
}
|
|
|
|
export { ScrollAreaPrimitive };
|