Files
Dashboard/ui/components/TextArea/TextArea.tsx
T
dejanandClaude Opus 5 b8bf987d0e feat(dashboard): Analytics-Dashboard als Gestaltungsvorlage zur Übergabe
UI/UX-Prototyp der Analytics-Dashboards in HiveGrid, fachlich auf einen
SHK-/Handwerksbetrieb zugeschnitten. Ziel ist die Übergabe an die Entwicklung,
nicht der Produktivbetrieb.

Inhalt: sechs Seiten (Übersicht, Finanzen, Aufträge, Kunden, Team, Komponenten),
26 KPIs, neun Chart-Bausteine, Filtersystem mit seitenabhängiger Relevanz und ein
deterministischer Demo-Datensatz (420 Kunden, 1.900 Aufträge, Stichtag 30.07.2026).

Drei Quellen sind zusammengeführt: die fachliche Planung mit dem Branchenpartner
(Januar 2026), die Subframe-Komponentenbibliothek aus dem HiveGrid-Pitch und
IBM Carbon Data Visualization für die Diagrammregeln. Herkunft und bewusste
Abweichungen stehen in docs/HERKUNFT.md.

Dokumentation: README, HANDOVER (was echte Logik braucht), docs/DESIGN-SYSTEM,
KPI-KATALOG, DATENMODELL, NAVIGATION, HERKUNFT, ZIELSYSTEM (Einbauort in
HiveGrid Cloud) und LEITPLANKEN (welche Cloud-Screens als Vorbild taugen).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QPeZNwSeU7qG3RRCwaxEZX
2026-08-29 17:25:20 +02:00

155 lines
6.2 KiB
TypeScript

"use client";
/*
* Documentation:
* Text Area — https://app.subframe.com/f023064a5ca0/library?component=Text+Area_4ec05ee8-8f1c-46b2-b863-5419aa7f5cce
*/
import React from "react";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface InputProps
extends Omit<
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
"placeholder" | "value"
> {
placeholder?: React.ReactNode;
value?: React.ReactNode;
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
className?: string;
}
const Input = React.forwardRef<HTMLTextAreaElement, InputProps>(function Input(
{ placeholder, value, className, ...otherProps }: InputProps,
ref
) {
return (
<textarea
className={SubframeUtils.twClassNames(
"min-h-[96px] w-full border-none bg-transparent px-3 py-2 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle",
className
)}
placeholder={placeholder as string}
value={value as string}
ref={ref}
{...otherProps}
/>
);
});
export interface TextAreaRootProps
extends React.LabelHTMLAttributes<HTMLLabelElement> {
error?: boolean;
variant?: "outline" | "filled";
borderless?: boolean;
noPadding?: boolean;
fillContainer?: boolean;
showLabel?: boolean;
label?: React.ReactNode;
helpText?: React.ReactNode;
children?: React.ReactNode;
errorText?: React.ReactNode;
message?: React.ReactNode;
className?: string;
}
const TextAreaRoot = React.forwardRef<HTMLLabelElement, TextAreaRootProps>(
function TextAreaRoot(
{
error = false,
variant = "outline",
borderless = false,
noPadding = false,
fillContainer = false,
showLabel = false,
label,
helpText,
children,
errorText,
message,
className,
...otherProps
}: TextAreaRootProps,
ref
) {
return (
<label
className={SubframeUtils.twClassNames(
"group/4ec05ee8 flex w-full min-w-[192px] max-w-[576px] cursor-pointer flex-col items-start gap-1",
{ "h-full max-w-none": fillContainer },
className
)}
ref={ref}
{...otherProps}
>
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-start gap-4",
{ "gap-1.5": showLabel, grow: fillContainer, "gap-1": error }
)}
>
<div
className={SubframeUtils.twClassNames(
"hidden flex-col items-start gap-1.5",
{ flex: showLabel }
)}
>
{label ? (
<span
className={SubframeUtils.twClassNames(
"text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary",
{ "text-text-feedback-negative": error }
)}
>
{label}
</span>
) : null}
{helpText ? (
<span
className={SubframeUtils.twClassNames(
"text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary",
{ "text-text-feedback-negative": error }
)}
>
{helpText}
</span>
) : null}
</div>
{children ? (
<div
className={SubframeUtils.twClassNames(
"flex w-full flex-col items-start rounded-sm border border-solid border-border-strong bg-surface-neutral-primary group-hover/4ec05ee8:border group-hover/4ec05ee8:border-solid group-hover/4ec05ee8:border-brand-brand-border-solid-hover group-hover/4ec05ee8:bg-surface-neutral-secondary group-focus-within/4ec05ee8:border-2 group-focus-within/4ec05ee8:border-solid group-focus-within/4ec05ee8:border-brand-brand-border-solid-default group-focus-within/4ec05ee8:bg-surface-neutral-secondary",
{
"grow [&_textarea]:grow": fillContainer,
"[&_textarea]:px-0 [&_textarea]:py-0": noPadding,
"border-none group-hover/4ec05ee8:border-none group-hover/4ec05ee8:group-hover/4ec05ee8:[&&]:border-none group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:[&&]:border-none group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:[&&]:border-none group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:[&&]:border-none group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:group-hover/4ec05ee8:[&&]:border-none group-focus-within/4ec05ee8:border-none group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:[&&]:border-none group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:[&&]:border-none group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:[&&]:border-none group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:group-focus-within/4ec05ee8:[&&]:border-none":
borderless,
"bg-surface-neutral-secondary": variant === "filled",
"border border-solid border-border-negative-solid [&_textarea]:text-text-feedback-negative [&_textarea]:placeholder:text-text-feedback-negative group-hover/4ec05ee8:border group-hover/4ec05ee8:border-solid group-hover/4ec05ee8:border-border-negative-solid group-focus-within/4ec05ee8:border-2 group-focus-within/4ec05ee8:border-solid group-focus-within/4ec05ee8:border-border-negative-solid":
error,
}
)}
>
{children}
</div>
) : null}
{errorText ? (
<span
className={SubframeUtils.twClassNames(
"hidden text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-feedback-negative",
{ inline: error }
)}
>
{errorText}
</span>
) : null}
</div>
</label>
);
}
);
export const TextArea = Object.assign(TextAreaRoot, {
Input,
});