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
153 lines
6.7 KiB
TypeScript
153 lines
6.7 KiB
TypeScript
"use client";
|
|
/*
|
|
* Documentation:
|
|
* Button — https://app.subframe.com/f023064a5ca0/library?component=Button_3b777358-b86b-40af-9327-891efc6826fe
|
|
*/
|
|
|
|
import React from "react";
|
|
import * as SubframeCore from "@subframe/core";
|
|
import * as SubframeUtils from "../../utils";
|
|
|
|
export interface ButtonRootProps
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
disabled?: boolean;
|
|
loading?: boolean;
|
|
variant?:
|
|
| "primary"
|
|
| "secondary"
|
|
| "tertiary"
|
|
| "ghost"
|
|
| "destructive"
|
|
| "neutral"
|
|
| "success"
|
|
| "warning"
|
|
| "information";
|
|
size?: "large" | "medium" | "small";
|
|
children?: React.ReactNode;
|
|
icon?: React.ReactNode;
|
|
iconRight?: React.ReactNode;
|
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
className?: string;
|
|
}
|
|
|
|
const ButtonRoot = React.forwardRef<HTMLButtonElement, ButtonRootProps>(
|
|
function ButtonRoot(
|
|
{
|
|
disabled = false,
|
|
loading = false,
|
|
variant = "primary",
|
|
size = "medium",
|
|
children,
|
|
icon = null,
|
|
iconRight = null,
|
|
className,
|
|
type = "button",
|
|
...otherProps
|
|
}: ButtonRootProps,
|
|
ref
|
|
) {
|
|
return (
|
|
<button
|
|
className={SubframeUtils.twClassNames(
|
|
"group/3b777358 flex h-9 cursor-pointer items-center justify-center gap-3 rounded-md border-none bg-brand-brand-surface-solid-default px-4 py-2.5 text-left hover:bg-brand-brand-surface-solid-hover active:bg-brand-brand-surface-solid-active focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled",
|
|
{
|
|
"h-8 gap-2 px-3 py-2": size === "small",
|
|
"h-12 gap-2.5 px-5 py-3.5": size === "large",
|
|
"bg-surface-feedback-solid-information hover:bg-surface-feedback-solid-information-hover active:bg-surface-feedback-solid-information-active":
|
|
variant === "information",
|
|
"bg-surface-feedback-solid-warning hover:bg-surface-feedback-solid-warning-hover active:bg-surface-feedback-solid-warning-active":
|
|
variant === "warning",
|
|
"bg-surface-feedback-solid-positive-default hover:bg-surface-feedback-solid-positive-hover active:bg-surface-feedback-solid-positive-active":
|
|
variant === "success",
|
|
"bg-surface-feedback-solid-neutral hover:bg-surface-feedback-solid-neutral-hover active:bg-surface-feedback-solid-neutral-active":
|
|
variant === "neutral",
|
|
"bg-surface-feedback-solid-negative-default hover:bg-surface-feedback-solid-negative-hover active:bg-surface-feedback-solid-negative-active":
|
|
variant === "destructive",
|
|
"bg-transparent hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary focus-within:border focus-within:border-solid focus-within:border-border-default focus-within:bg-surface-neutral-secondary":
|
|
variant === "ghost",
|
|
"border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary":
|
|
variant === "tertiary",
|
|
"bg-brand-brand-secondary-surface-subtle-default hover:bg-brand-brand-secondary-surface-subtle-hover active:bg-brand-brand-secondary-surface-subtle-active":
|
|
variant === "secondary",
|
|
},
|
|
className
|
|
)}
|
|
ref={ref}
|
|
type={type}
|
|
disabled={disabled}
|
|
{...otherProps}
|
|
>
|
|
{icon ? (
|
|
<SubframeCore.IconWrapper
|
|
className={SubframeUtils.twClassNames(
|
|
"text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-on-solid group-disabled/3b777358:text-icon-neutral-disabled",
|
|
{
|
|
"text-body-large-0 font-body-large-0": size === "large",
|
|
"text-icon-neutral-secondary": variant === "ghost",
|
|
"text-icon-neutral-on-subtle": variant === "tertiary",
|
|
"text-icon-neutral-primary": variant === "secondary",
|
|
hidden: loading,
|
|
}
|
|
)}
|
|
>
|
|
{icon}
|
|
</SubframeCore.IconWrapper>
|
|
) : null}
|
|
<div
|
|
className={SubframeUtils.twClassNames(
|
|
"hidden h-4 w-4 flex-none items-center justify-center gap-2",
|
|
{ "h-5 w-5": size === "large", flex: loading }
|
|
)}
|
|
>
|
|
<SubframeCore.Loader
|
|
className={SubframeUtils.twClassNames(
|
|
"text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-icon-neutral-on-solid group-disabled/3b777358:text-icon-neutral-disabled group-hover/3b777358:group-disabled/3b777358:text-icon-neutral-on-solid group-active/3b777358:group-disabled/3b777358:text-icon-neutral-disabled",
|
|
{
|
|
"text-icon-neutral-secondary": variant === "ghost",
|
|
"text-icon-neutral-on-subtle": variant === "tertiary",
|
|
"text-icon-neutral-primary": variant === "secondary",
|
|
}
|
|
)}
|
|
/>
|
|
</div>
|
|
{children ? (
|
|
<span
|
|
className={SubframeUtils.twClassNames(
|
|
"whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-on-solid group-disabled/3b777358:text-text-neutral-disabled",
|
|
{
|
|
"text-body-large-0 font-body-large-0": size === "large",
|
|
"text-text-neutral-primary":
|
|
variant === "ghost" ||
|
|
variant === "tertiary" ||
|
|
variant === "secondary",
|
|
"hidden text-body-small-medium-150 font-body-small-medium-150":
|
|
loading,
|
|
}
|
|
)}
|
|
>
|
|
{children}
|
|
</span>
|
|
) : null}
|
|
{iconRight ? (
|
|
<SubframeCore.IconWrapper
|
|
className={SubframeUtils.twClassNames(
|
|
"text-body-default-regular-150 font-body-default-regular-150 text-icon-neutral-on-solid group-disabled/3b777358:text-icon-neutral-disabled",
|
|
{
|
|
"text-body-large font-body-large": size === "large",
|
|
"text-icon-neutral-secondary": variant === "ghost",
|
|
"text-icon-neutral-on-subtle": variant === "tertiary",
|
|
"text-icon-neutral-primary": variant === "secondary",
|
|
hidden: loading,
|
|
}
|
|
)}
|
|
>
|
|
{iconRight}
|
|
</SubframeCore.IconWrapper>
|
|
) : null}
|
|
</button>
|
|
);
|
|
}
|
|
);
|
|
|
|
export const Button = ButtonRoot;
|