mirror of
https://github.com/temetro/temetro.git
synced 2026-07-26 11:58:14 +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>
119 lines
4.5 KiB
TypeScript
119 lines
4.5 KiB
TypeScript
"use client";
|
|
|
|
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
import type React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export const PopoverCreateHandle: typeof PopoverPrimitive.createHandle =
|
|
PopoverPrimitive.createHandle;
|
|
|
|
export const Popover: typeof PopoverPrimitive.Root = PopoverPrimitive.Root;
|
|
|
|
export function PopoverTrigger({
|
|
className,
|
|
children,
|
|
...props
|
|
}: PopoverPrimitive.Trigger.Props): React.ReactElement {
|
|
return (
|
|
<PopoverPrimitive.Trigger
|
|
className={className}
|
|
data-slot="popover-trigger"
|
|
{...props}
|
|
>
|
|
{children}
|
|
</PopoverPrimitive.Trigger>
|
|
);
|
|
}
|
|
|
|
export function PopoverPopup({
|
|
children,
|
|
className,
|
|
side = "bottom",
|
|
align = "center",
|
|
sideOffset = 4,
|
|
alignOffset = 0,
|
|
tooltipStyle = false,
|
|
anchor,
|
|
portalProps,
|
|
...props
|
|
}: PopoverPrimitive.Popup.Props & {
|
|
portalProps?: PopoverPrimitive.Portal.Props;
|
|
side?: PopoverPrimitive.Positioner.Props["side"];
|
|
align?: PopoverPrimitive.Positioner.Props["align"];
|
|
sideOffset?: PopoverPrimitive.Positioner.Props["sideOffset"];
|
|
alignOffset?: PopoverPrimitive.Positioner.Props["alignOffset"];
|
|
tooltipStyle?: boolean;
|
|
anchor?: PopoverPrimitive.Positioner.Props["anchor"];
|
|
}): React.ReactElement {
|
|
return (
|
|
<PopoverPrimitive.Portal {...portalProps}>
|
|
<PopoverPrimitive.Positioner
|
|
align={align}
|
|
alignOffset={alignOffset}
|
|
anchor={anchor}
|
|
className="z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none"
|
|
data-slot="popover-positioner"
|
|
side={side}
|
|
sideOffset={sideOffset}
|
|
>
|
|
<PopoverPrimitive.Popup
|
|
className={cn(
|
|
"relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
|
tooltipStyle &&
|
|
"w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]",
|
|
className,
|
|
)}
|
|
data-slot="popover-popup"
|
|
{...props}
|
|
>
|
|
<PopoverPrimitive.Viewport
|
|
className={cn(
|
|
"relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity",
|
|
tooltipStyle
|
|
? "py-1 [--viewport-inline-padding:--spacing(2)]"
|
|
: "not-data-transitioning:overflow-y-auto",
|
|
)}
|
|
data-slot="popover-viewport"
|
|
>
|
|
{children}
|
|
</PopoverPrimitive.Viewport>
|
|
</PopoverPrimitive.Popup>
|
|
</PopoverPrimitive.Positioner>
|
|
</PopoverPrimitive.Portal>
|
|
);
|
|
}
|
|
|
|
export function PopoverClose({
|
|
...props
|
|
}: PopoverPrimitive.Close.Props): React.ReactElement {
|
|
return <PopoverPrimitive.Close data-slot="popover-close" {...props} />;
|
|
}
|
|
|
|
export function PopoverTitle({
|
|
className,
|
|
...props
|
|
}: PopoverPrimitive.Title.Props): React.ReactElement {
|
|
return (
|
|
<PopoverPrimitive.Title
|
|
className={cn("font-semibold text-lg leading-none", className)}
|
|
data-slot="popover-title"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export function PopoverDescription({
|
|
className,
|
|
...props
|
|
}: PopoverPrimitive.Description.Props): React.ReactElement {
|
|
return (
|
|
<PopoverPrimitive.Description
|
|
className={cn("text-muted-foreground text-sm", className)}
|
|
data-slot="popover-description"
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export { PopoverPrimitive, PopoverPopup as PopoverContent };
|