mirror of
https://github.com/temetro/temetro.git
synced 2026-08-05 00:19:04 +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>
59 lines
2.4 KiB
TypeScript
59 lines
2.4 KiB
TypeScript
"use client";
|
|
|
|
import { Field as FieldPrimitive } from "@base-ui/react/field";
|
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
import type * as React from "react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export type TextareaProps = React.ComponentPropsWithoutRef<"textarea"> &
|
|
React.RefAttributes<HTMLTextAreaElement> & {
|
|
size?: "sm" | "default" | "lg" | number;
|
|
unstyled?: boolean;
|
|
};
|
|
|
|
export function Textarea({
|
|
className,
|
|
size = "default",
|
|
unstyled = false,
|
|
ref,
|
|
...props
|
|
}: TextareaProps): React.ReactElement {
|
|
return (
|
|
<span
|
|
className={
|
|
cn(
|
|
!unstyled &&
|
|
"relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
|
className,
|
|
) || undefined
|
|
}
|
|
data-size={size}
|
|
data-slot="textarea-control"
|
|
>
|
|
<FieldPrimitive.Control
|
|
ref={ref}
|
|
value={props.value}
|
|
defaultValue={props.defaultValue}
|
|
disabled={props.disabled}
|
|
id={props.id}
|
|
name={props.name}
|
|
render={(defaultProps: React.ComponentProps<"textarea">) => (
|
|
<textarea
|
|
className={cn(
|
|
"field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5",
|
|
size === "sm" &&
|
|
"min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5",
|
|
size === "lg" &&
|
|
"min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5",
|
|
)}
|
|
data-slot="textarea"
|
|
{...mergeProps(defaultProps, props)}
|
|
/>
|
|
)}
|
|
/>
|
|
</span>
|
|
);
|
|
}
|
|
|
|
export { FieldPrimitive };
|