From 9cf7804d205feaecfc239204795e355f4f928779 Mon Sep 17 00:00:00 2001
From: robert dennis <31261583+robertdrakedennis@users.noreply.github.com>
Date: Mon, 12 Oct 2026 09:04:03 -0400
Subject: [PATCH] skin primitives
---
docs-notes/skins.md | 111 +++++
packages/sdk/types/components/Avatar.d.ts | 18 +
.../sdk/types/components/elements/Badge.d.ts | 13 +
.../sdk/types/components/elements/Button.d.ts | 23 +-
.../sdk/types/components/elements/Card.d.ts | 19 +
.../sdk/types/components/elements/Code.d.ts | 8 +
.../types/components/elements/ContentBox.d.ts | 1 +
.../components/elements/CopyOnClick.d.ts | 2 +-
.../sdk/types/components/elements/Label.d.ts | 4 +-
.../types/components/elements/ListRow.d.ts | 13 +
.../types/components/elements/NewButton.d.ts | 12 +-
.../components/elements/PageHeading.d.ts | 8 +-
.../types/components/elements/Pagination.d.ts | 4 +-
.../components/elements/ProgressBar.d.ts | 18 +
.../types/components/elements/Spinner.d.ts | 6 +-
.../components/elements/SpinnerOverlay.d.ts | 4 +-
.../components/elements/TitledGreyBox.d.ts | 1 +
.../components/elements/alert/Alert.d.ts | 6 +-
.../components/elements/alert/index.d.ts | 2 +-
.../components/elements/dialog/types.d.ts | 4 +-
.../elements/dropdown/DropdownMenu.d.ts | 9 +-
.../sdk/types/components/form/controls.d.ts | 10 +-
packages/sdk/types/components/ui/empty.d.ts | 12 +-
packages/sdk/types/sdk/index.d.ts | 25 +-
packages/sdk/types/sdk/theme.d.ts | 2 +-
packages/sdk/types/sdk/ui.d.ts | 17 +-
packages/sdk/types/themes/primitives.d.ts | 353 ++++++++++++++++
packages/sdk/types/themes/skins.d.ts | 96 ++++-
resources/scripts/components/Avatar.tsx | 29 +-
.../components/admin/AdminListEmpty.tsx | 3 +-
.../databases/DatabaseHostDetailContainer.tsx | 3 +-
.../components/admin/eggs/EggVariablesTab.tsx | 3 +-
.../components/admin/eggs/EggsContainer.tsx | 3 +-
.../admin/extensions/ExtensionsContainer.tsx | 3 +-
.../locations/LocationDetailContainer.tsx | 3 +-
.../admin/mounts/AttachEggsModal.tsx | 3 +-
.../admin/mounts/AttachNodesModal.tsx | 3 +-
.../admin/mounts/MountDetailContainer.tsx | 5 +-
.../components/admin/nodes/NodeAboutTab.tsx | 21 +-
.../admin/nodes/NodeAllocationTab.tsx | 3 +-
.../components/admin/nodes/NodeServersTab.tsx | 3 +-
.../admin/servers/ServerDatabaseTab.tsx | 3 +-
.../admin/servers/ServerMountsTab.tsx | 3 +-
.../admin/servers/ServerStartupTab.tsx | 3 +-
.../components/admin/tags/NoTagsYet.tsx | 3 +-
.../admin/users/UserDetailContainer.tsx | 3 +-
.../dashboard/AccountApiContainer.tsx | 3 +-
.../dashboard/search/SearchModal.tsx | 4 +-
.../dashboard/ssh/AccountSSHContainer.tsx | 3 +-
.../scripts/components/elements/Badge.tsx | 23 ++
.../scripts/components/elements/Button.tsx | 168 +++-----
.../scripts/components/elements/Card.tsx | 55 +++
.../scripts/components/elements/Code.tsx | 17 +-
.../components/elements/ContentBox.tsx | 8 +-
.../components/elements/CopyOnClick.tsx | 12 +-
.../components/elements/GreyRowBox.tsx | 26 --
.../scripts/components/elements/Label.tsx | 18 +-
.../scripts/components/elements/ListRow.tsx | 29 ++
.../scripts/components/elements/NewButton.tsx | 40 +-
.../components/elements/PageHeading.tsx | 25 +-
.../components/elements/Pagination.tsx | 39 +-
.../components/elements/ProgressBar.tsx | 51 ++-
.../scripts/components/elements/Spinner.tsx | 46 +--
.../components/elements/SpinnerOverlay.tsx | 16 +-
.../components/elements/TitledGreyBox.tsx | 22 +-
.../components/elements/alert/Alert.tsx | 59 +--
.../components/elements/alert/index.ts | 2 +-
.../components/elements/dialog/Dialog.tsx | 85 ++--
.../elements/dialog/DialogFooter.tsx | 12 +-
.../components/elements/dialog/DialogIcon.tsx | 26 +-
.../components/elements/dialog/context.ts | 1 +
.../components/elements/dialog/types.d.ts | 4 +-
.../elements/dropdown/DropdownMenu.tsx | 79 ++--
.../elements/table/DataTable.spec.tsx | 6 +-
.../components/elements/table/DataTable.tsx | 42 +-
.../components/elements/table/RowActions.tsx | 14 +-
.../components/elements/tooltip/Tooltip.tsx | 38 +-
.../scripts/components/form/controls.tsx | 98 ++---
.../server/backups/BackupContainer.tsx | 5 +-
.../server/databases/DatabasesContainer.tsx | 3 +-
.../server/network/NetworkContainer.tsx | 3 +-
.../server/schedules/ScheduleContainer.tsx | 3 +-
.../schedules/ScheduleEditContainer.tsx | 3 +-
.../server/startup/StartupContainer.tsx | 4 +-
.../server/users/UsersContainer.tsx | 3 +-
resources/scripts/components/ui/Checkbox.tsx | 17 +-
resources/scripts/components/ui/Select.tsx | 207 ++++------
resources/scripts/components/ui/Switch.tsx | 28 +-
.../scripts/components/ui/empty.spec.tsx | 19 +-
resources/scripts/components/ui/empty.tsx | 93 ++---
resources/scripts/components/ui/styles.ts | 3 -
resources/scripts/components/ui/typography.ts | 2 -
.../scripts/router/layouts/RootLayout.tsx | 4 +-
resources/scripts/sdk/index.ts | 50 ++-
resources/scripts/sdk/testing.tsx | 3 +-
resources/scripts/sdk/theme.ts | 30 +-
resources/scripts/sdk/ui.tsx | 32 +-
resources/scripts/setup-tests.ts | 5 +
.../themes/__fixtures__/classic-classes.json | 28 +-
.../scripts/themes/classic/skins/buttons.ts | 76 ++++
.../scripts/themes/classic/skins/data.ts | 37 ++
.../scripts/themes/classic/skins/feedback.ts | 127 ++++++
.../scripts/themes/classic/skins/forms.ts | 118 ++++++
.../scripts/themes/classic/skins/index.ts | 40 +-
.../scripts/themes/classic/skins/overlays.ts | 100 +++++
.../scripts/themes/classic/skins/surfaces.ts | 41 ++
.../classic/views/dashboard/ServerCard.tsx | 35 +-
.../classic/views/dashboard/ServerList.tsx | 15 +-
.../scripts/themes/classicClasses.spec.tsx | 166 ++++----
resources/scripts/themes/primitives.ts | 236 +++++++++++
resources/scripts/themes/skins.spec.tsx | 260 ++++++++++++
resources/scripts/themes/skins.ts | 384 +++++++++++++++++-
resources/scripts/views/boot.spec.tsx | 27 +-
resources/scripts/views/boot.tsx | 10 +-
114 files changed, 3049 insertions(+), 1140 deletions(-)
create mode 100644 docs-notes/skins.md
create mode 100644 packages/sdk/types/components/Avatar.d.ts
create mode 100644 packages/sdk/types/components/elements/Badge.d.ts
create mode 100644 packages/sdk/types/components/elements/Card.d.ts
create mode 100644 packages/sdk/types/components/elements/Code.d.ts
create mode 100644 packages/sdk/types/components/elements/ListRow.d.ts
create mode 100644 packages/sdk/types/components/elements/ProgressBar.d.ts
create mode 100644 packages/sdk/types/themes/primitives.d.ts
create mode 100644 resources/scripts/components/elements/Badge.tsx
create mode 100644 resources/scripts/components/elements/Card.tsx
delete mode 100644 resources/scripts/components/elements/GreyRowBox.tsx
create mode 100644 resources/scripts/components/elements/ListRow.tsx
create mode 100644 resources/scripts/themes/classic/skins/buttons.ts
create mode 100644 resources/scripts/themes/classic/skins/data.ts
create mode 100644 resources/scripts/themes/classic/skins/feedback.ts
create mode 100644 resources/scripts/themes/classic/skins/forms.ts
create mode 100644 resources/scripts/themes/classic/skins/overlays.ts
create mode 100644 resources/scripts/themes/classic/skins/surfaces.ts
create mode 100644 resources/scripts/themes/primitives.ts
create mode 100644 resources/scripts/themes/skins.spec.tsx
diff --git a/docs-notes/skins.md b/docs-notes/skins.md
new file mode 100644
index 000000000..f4b6916b8
--- /dev/null
+++ b/docs-notes/skins.md
@@ -0,0 +1,111 @@
+# Skin reference (data for the docs lane)
+
+Source of truth: `resources/scripts/themes/primitives.ts` (`UiPrimitives`, `UI_PRIMITIVES`), the registry in
+`resources/scripts/themes/skins.ts`, classic's recipes in `resources/scripts/themes/classic/skins/*.ts`.
+
+## API (`@pterodactyl/sdk/theme`)
+
+- `defineTheme({ ui })`: `ui` is `ThemeSkins`, keyed by primitive name.
+- `skin(name, skin)` types a skin; `skin(name, (parent) => skin)` extends the layers below. The function form must go
+ through `skin()`: a bare function is read as a replacement component.
+- Skin: `{ [part]: recipe }`. A recipe is a string, a cva recipe `{ base, variants, compoundVariants, defaultVariants }`,
+ or `(state) => string`. Variant keys are state keys; booleans use `'true'`/`'false'`.
+- `parent` in the function form has every part resolved: `parent.root(state)` returns the classes below.
+- `useSkin(name, state)` returns a binding: `ui(part, className?, partState?)` gives
+ `{ className, 'data-ui', 'data-part', data-* }` to spread; `ui.classes(part, className?, partState?)` gives the string.
+- Types: `ThemeSkins`, `Skin`, `CompleteSkin`, `CompleteSkins`, `SkinRecipe`, `SkinRecipeConfig`,
+ `SkinCompoundVariant`, `ResolvedSkin`, `SkinExtension`, `SkinDefinition`, `SkinBinding`,
+ `SkinPartProps`, `SkinClassName`, `SkinPart`, `PrimitiveName`, `PrimitiveState`, `PrimitiveProps`,
+ `ReplaceableName`, `UiPrimitives`, `UiTone`, `NoState`, `SkinStateMap`, `SkinStateValue`, `PrimitiveMeta`;
+ value `UI_PRIMITIVES` (parts and `replaceable` per primitive).
+
+## Rules
+
+- Layers: classic, then the theme chain parent first. For each part the topmost recipe wins and replaces the one below
+ wholesale; nothing merges. Parts a skin leaves out keep the recipe below.
+- The call-site `className` is appended with `cn()` (tailwind-merge), so it wins conflicts.
+- Every part renders `data-ui=""` and `data-part=""`. The root also renders a `data-` per state
+ value (camelCase keys become kebab case: `richLabel` → `data-rich-label`). `true` renders as an empty attribute,
+ `false`/unset render nothing. A part given its own state (Dialog `icon`, Empty `media`, Pagination `page`) renders
+ that state on itself.
+- Parts marked "classes only" below are passed as `className` to another primitive or element and carry no attributes.
+- Presentational primitives can be replaced by a component receiving the identical props. The topmost replacement wins;
+ skins of all layers still resolve for the core components. A replacement must not render the primitive it replaces.
+- Base UI primitives (and the other skin-only ones) cannot be replaced: a component there is a type error, and at
+ runtime it is ignored with a dev warning. Unknown primitive names and unknown parts are ignored with a dev warning.
+- Resolution is memoised per primitive per layer stack; a recipe or extension that throws is skipped and logged.
+
+## Primitives
+
+`root` gets the bound state as `data-*`. Replaceable = may be a component.
+
+| Primitive | Parts | State (→ `data-*`) | Replaceable |
+|---|---|---|---|
+| Alert | root, icon, body, title, content | `type`: success, info, warning, danger | yes |
+| Avatar | root | `variant`: beam, marble, pixel, sunset, ring, bauhaus | yes |
+| Badge | root | `tone`: neutral, success, warning, danger, info, accent; `size`: sm, md; `variant`: solid, soft | yes |
+| Button | root, spinner, label | `color`: primary, grey, green, red, orange; `size`: xsmall, small, large, xlarge; `secondary`; `loading` | yes |
+| Card | root, header, title, icon, actions, body | `titled` (has a header); `actions`; `loading` | yes |
+| Checkbox | root, indicator | none (Base UI sets `data-checked`, `data-indeterminate`, `data-disabled`) | no |
+| Code | root | `dark` | no |
+| CopyOnClick | root (toast), status, message, target (classes only, added to the clicked child) | `status`: copied, failed | no |
+| Dialog | backdrop, viewport, container, root (popup), body, content, header, heading, title, description, spacer, footer, close, closeButton (classes only, on a Button), closeIcon, icon, iconGlyph | `described`; `type` on `icon`: danger, warning, success, info | no |
+| DropdownMenu | trigger, positioner, root (popup) | `context` (ContextDropdownMenu) | no |
+| DropdownMenuItem | root, icon, glyph, text, label, description | `danger`; `described` | no |
+| Empty | root, header, media, title, description, content | `size`: default, compact; `variant` on `media`: default, icon | yes (root) |
+| FileInput | root | none | no |
+| Input | root | `light`; `error` | no |
+| Label | root | `light` | no |
+| ListRow | root | `interactive` | yes |
+| NewButton | root (classes only, on the Button), content, icon | `link` (NewLinkButton) | no |
+| NumberInput | root (NumberField), input | `light`; `error` | no |
+| PageHeading | root, text, title, description, actions | none | yes |
+| Pagination | root, page (classes only, on each page Button) | `current` on `page` | no |
+| ProgressBar | root (track), indicator | `variant`: meter, page; `tone`: as Badge | yes |
+| Select | root (input group), input, trigger, positioner, popup, list, item, itemLabel, indicator, empty, group, groupLabel, summary, preview | `error`; `multiple`; `selected`; `richLabel`; `searching` | no |
+| Spinner | root, container (when centered) | `size`: small, base, large; `blue`; `centered` | yes |
+| SpinnerOverlay | root, text | `fixed` | no |
+| Switch | root, control, thumb, text, label (classes only, on the Label), description | `described`; `position`: start, end | no |
+| Table | root, empty, scroller, table, head, headerRow, headerCell, body, row, cell | `fetching` | no |
+| TextArea | root | `light`; `error` | no |
+| Tooltip | root, arrow | `side`: top, right, bottom, left; `arrow` | no |
+
+## Components and props (`@pterodactyl/sdk`)
+
+Button (`ButtonProps`, `ButtonColor`, `ButtonSize`; `Button.Text`, `Button.Danger`), LinkButton, RouterLinkButton,
+NewButton/NewLinkButton (`NewButtonProps`, `NewLinkButtonProps`), Input (`InputProps`), TextArea (`TextAreaProps`),
+NumberInput (`NumberInputProps`), FileInput (`FileInputProps`), Select (`SelectProps`), Checkbox (`CheckboxProps`),
+Switch (`SwitchProps`), Label (`LabelProps`), Dialog (`DialogProps`, `DialogIconProps`; `Dialog.Footer`, `Dialog.Icon`,
+`Dialog.Confirm`), Alert (`AlertProps`, `AlertType`), Tooltip (`TooltipProps`), DropdownMenu / DropdownMenuItem /
+ContextDropdownMenu (`DropdownMenuProps`, `DropdownMenuItemProps`, `ContextDropdownMenuProps`), Table (`TableProps`),
+Pagination (`PaginationProps`), Empty + EmptyHeader/EmptyMedia/EmptyTitle/EmptyDescription/EmptyContent (`EmptyProps`,
+`EmptySize`, `EmptyMediaVariant`), Spinner (`SpinnerProps`), SpinnerOverlay (`SpinnerOverlayProps`), Avatar
+(`AvatarProps`), ProgressBar (`ProgressBarProps`), Code (`CodeProps`), CopyOnClick (`CopyOnClickProps`), Card
+(`CardProps`), ListRow (`ListRowProps`), Badge (`BadgeProps`), PageHeading (`PageHeadingProps`). ContentBox and
+TitledGreyBox remain as thin wrappers over Card.
+
+## Recipes
+
+```tsx
+export default defineTheme({
+ ui: {
+ // Replaces Button's root recipe; spinner and label keep classic's.
+ Button: skin('Button', {
+ root: {
+ base: 'inline-flex h-9 items-center rounded-full px-4 font-medium',
+ variants: { color: { primary: 'bg-primary text-primary-foreground hover:bg-primary/90' } },
+ compoundVariants: [{ secondary: true, color: 'primary', class: 'bg-transparent text-primary' }],
+ },
+ }),
+ // Builds on the classes below.
+ Card: skin('Card', (parent) => ({ root: (state) => `${parent.root(state)} backdrop-blur-xl bg-card/60` })),
+ // Presentational primitives can be components with the same props.
+ Badge: AuroraBadge,
+ },
+});
+```
+
+Classic's normalised variants: plain `hover:`/`active:` guarded with `not-disabled:` on Button
+(`hover:not-disabled:bg-primary/80`), `data-checked:`/`data-highlighted:`/`data-starting-style:` instead of
+`data-[…]:`, `z-9999`, and `(--var)` shorthands. Rendered classes are otherwise unchanged
+(`resources/scripts/themes/classicClasses.spec.tsx`).
diff --git a/packages/sdk/types/components/Avatar.d.ts b/packages/sdk/types/components/Avatar.d.ts
new file mode 100644
index 000000000..4f32abe2a
--- /dev/null
+++ b/packages/sdk/types/components/Avatar.d.ts
@@ -0,0 +1,18 @@
+// Generated by scripts/generate-sdk-types.mjs. Do not edit.
+export type AvatarVariant = 'beam' | 'marble' | 'pixel' | 'sunset' | 'ring' | 'bauhaus';
+export interface AvatarProps {
+ /** Seeds the generated pattern; the panel uses a user's UUID. */
+ name: string;
+ size?: number | string;
+ variant?: AvatarVariant;
+ square?: boolean;
+ title?: boolean;
+ className?: string;
+}
+declare const Avatar: ((props: AvatarProps) => import("react").ReactElement) & {
+ User: {
+ (props: Omit): import("react").JSX.Element;
+ displayName: string;
+ };
+};
+export default Avatar;
diff --git a/packages/sdk/types/components/elements/Badge.d.ts b/packages/sdk/types/components/elements/Badge.d.ts
new file mode 100644
index 000000000..07b6d3847
--- /dev/null
+++ b/packages/sdk/types/components/elements/Badge.d.ts
@@ -0,0 +1,13 @@
+// Generated by scripts/generate-sdk-types.mjs. Do not edit.
+import type React from 'react';
+import { type UiTone } from "../../themes/skins.js";
+export type BadgeSize = 'sm' | 'md';
+/** `solid` fills the badge with its tone; `soft` tints it. */
+export type BadgeVariant = 'solid' | 'soft';
+export interface BadgeProps extends React.HTMLAttributes {
+ tone?: UiTone;
+ size?: BadgeSize;
+ variant?: BadgeVariant;
+}
+declare const Badge: (props: BadgeProps) => React.ReactElement;
+export default Badge;
diff --git a/packages/sdk/types/components/elements/Button.d.ts b/packages/sdk/types/components/elements/Button.d.ts
index 04869782b..8c94df006 100644
--- a/packages/sdk/types/components/elements/Button.d.ts
+++ b/packages/sdk/types/components/elements/Button.d.ts
@@ -1,33 +1,34 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
import React from 'react';
import { Link } from '@tanstack/react-router';
+export type ButtonColor = 'green' | 'red' | 'orange' | 'primary' | 'grey';
+export type ButtonSize = 'xsmall' | 'small' | 'large' | 'xlarge';
interface Props {
isLoading?: boolean;
- size?: 'xsmall' | 'small' | 'large' | 'xlarge';
- color?: 'green' | 'red' | 'orange' | 'primary' | 'grey';
+ size?: ButtonSize;
+ color?: ButtonColor;
isSecondary?: boolean;
}
-declare const buttonClassName: ({ color, size, isSecondary, className, }: Omit & {
+type StyleableProps = Omit;
+/** The root classes of a button, for elements styled as one outside a component. */
+declare const buttonClassName: ({ className, ...props }: StyleableProps & {
className?: string;
}) => string;
-type StyleableProps = Omit;
type ButtonStyleProps = {
as?: E;
ref?: React.ComponentPropsWithRef['ref'];
} & StyleableProps & Omit, keyof StyleableProps | 'as'>;
+/** Any element, styled as a button. */
declare const ButtonStyle: ({ as, color, size, isSecondary, className, ref, ...props }: ButtonStyleProps) => React.JSX.Element;
-type ComponentProps = Omit, keyof Props> & Props;
+export type ButtonProps = Omit, keyof Props> & Props;
/** Defaults to `type="button"`; `isLoading` shows a spinner and disables the button. */
-declare const Button: {
- ({ children, isLoading, disabled, type, ref, ...props }: ComponentProps): React.JSX.Element;
- displayName: string;
-};
+declare const Button: (props: ButtonProps) => React.ReactElement;
declare const TextButton: {
- ({ ref, ...props }: ComponentProps): React.JSX.Element;
+ ({ ref, ...props }: ButtonProps): React.JSX.Element;
displayName: string;
};
declare const DangerButton: {
- ({ ref, ...props }: ComponentProps): React.JSX.Element;
+ ({ ref, ...props }: ButtonProps): React.JSX.Element;
displayName: string;
};
declare const ButtonWithVariants: typeof Button & {
diff --git a/packages/sdk/types/components/elements/Card.d.ts b/packages/sdk/types/components/elements/Card.d.ts
new file mode 100644
index 000000000..8e06a1963
--- /dev/null
+++ b/packages/sdk/types/components/elements/Card.d.ts
@@ -0,0 +1,19 @@
+// Generated by scripts/generate-sdk-types.mjs. Do not edit.
+import type React from 'react';
+import type { LucideIcon } from 'lucide-react';
+export interface CardProps {
+ /** A string renders as the card's heading; any other node replaces it. */
+ title?: React.ReactNode;
+ /** Shown before a string title. */
+ icon?: LucideIcon;
+ /** Controls placed at the end of the header. */
+ actions?: React.ReactNode;
+ /** Covers the card with a spinner. */
+ loading?: boolean;
+ className?: string;
+ /** Classes for the body of a card with a header. */
+ bodyClassName?: string;
+ children?: React.ReactNode;
+}
+declare const Card: (props: CardProps) => React.ReactElement;
+export default Card;
diff --git a/packages/sdk/types/components/elements/Code.d.ts b/packages/sdk/types/components/elements/Code.d.ts
new file mode 100644
index 000000000..f4e1e5ea3
--- /dev/null
+++ b/packages/sdk/types/components/elements/Code.d.ts
@@ -0,0 +1,8 @@
+// Generated by scripts/generate-sdk-types.mjs. Do not edit.
+import React from 'react';
+export interface CodeProps {
+ dark?: boolean | undefined;
+ className?: string;
+ children: React.ReactNode;
+}
+export default function Code({ dark, className, children }: CodeProps): React.JSX.Element;
diff --git a/packages/sdk/types/components/elements/ContentBox.d.ts b/packages/sdk/types/components/elements/ContentBox.d.ts
index 73cf3c40d..73f70a77c 100644
--- a/packages/sdk/types/components/elements/ContentBox.d.ts
+++ b/packages/sdk/types/components/elements/ContentBox.d.ts
@@ -5,5 +5,6 @@ type Props = Readonly;
+/** A section title above a plain `Card`. */
declare const ContentBox: ({ title, borderColor, showLoadingOverlay, children, ...props }: Props) => React.JSX.Element;
export default ContentBox;
diff --git a/packages/sdk/types/components/elements/CopyOnClick.d.ts b/packages/sdk/types/components/elements/CopyOnClick.d.ts
index af79b42d8..9a168b9c3 100644
--- a/packages/sdk/types/components/elements/CopyOnClick.d.ts
+++ b/packages/sdk/types/components/elements/CopyOnClick.d.ts
@@ -1,6 +1,6 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
import React from 'react';
-interface CopyOnClickProps {
+export interface CopyOnClickProps {
text: string | number | null | undefined;
showInNotification?: boolean;
children: React.ReactNode;
diff --git a/packages/sdk/types/components/elements/Label.d.ts b/packages/sdk/types/components/elements/Label.d.ts
index c37335308..49df30845 100644
--- a/packages/sdk/types/components/elements/Label.d.ts
+++ b/packages/sdk/types/components/elements/Label.d.ts
@@ -1,8 +1,8 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
import React from 'react';
-type Props = {
+export type LabelProps = {
as?: E;
isLight?: boolean;
} & Omit, 'as' | 'isLight'>;
-declare const Label: ({ as, isLight, className, ...props }: Props) => React.JSX.Element;
+declare const Label: ({ as, isLight, className, ...props }: LabelProps) => React.JSX.Element;
export default Label;
diff --git a/packages/sdk/types/components/elements/ListRow.d.ts b/packages/sdk/types/components/elements/ListRow.d.ts
new file mode 100644
index 000000000..4fbd29629
--- /dev/null
+++ b/packages/sdk/types/components/elements/ListRow.d.ts
@@ -0,0 +1,13 @@
+// Generated by scripts/generate-sdk-types.mjs. Do not edit.
+import React from 'react';
+import { type PanelDestination } from "../../sdk/navigation.js";
+export interface ListRowProps extends React.HTMLAttributes {
+ as?: 'div' | 'li' | 'article';
+ /** Renders the row as a link to the destination. */
+ destination?: PanelDestination;
+ exact?: boolean;
+ /** Hover and press feedback; on for links and clickable rows unless set. */
+ interactive?: boolean;
+}
+declare const ListRow: (props: ListRowProps) => React.ReactElement;
+export default ListRow;
diff --git a/packages/sdk/types/components/elements/NewButton.d.ts b/packages/sdk/types/components/elements/NewButton.d.ts
index 54cb19279..bad9231cf 100644
--- a/packages/sdk/types/components/elements/NewButton.d.ts
+++ b/packages/sdk/types/components/elements/NewButton.d.ts
@@ -1,15 +1,17 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
import type * as React from 'react';
import { type LucideIcon } from 'lucide-react';
-import Button, { RouterLinkButton } from "./Button.js";
+import { RouterLinkButton, type ButtonProps } from "./Button.js";
interface IconProps {
/** Replaces the Plus for sibling toolbar actions such as Upload. */
icon?: LucideIcon;
}
+export type NewButtonProps = ButtonProps & IconProps;
/** The panel's "create" action: a Plus icon and a sentence-case label such as "New node". */
-export declare function NewButton({ icon, className, children, ...props }: React.ComponentProps & IconProps): React.JSX.Element;
-/** `NewButton` for actions that navigate to a create page. */
-export declare function NewLinkButton({ icon, className, children, ...props }: Omit, 'children'> & IconProps & {
+export declare function NewButton({ icon, className, children, ...props }: NewButtonProps): React.JSX.Element;
+export type NewLinkButtonProps = Omit, 'children'> & IconProps & {
children: React.ReactNode;
-}): React.JSX.Element;
+};
+/** `NewButton` for actions that navigate to a create page. */
+export declare function NewLinkButton({ icon, className, children, ...props }: NewLinkButtonProps): React.JSX.Element;
export {};
diff --git a/packages/sdk/types/components/elements/PageHeading.d.ts b/packages/sdk/types/components/elements/PageHeading.d.ts
index 3d4962fd2..14d80eaec 100644
--- a/packages/sdk/types/components/elements/PageHeading.d.ts
+++ b/packages/sdk/types/components/elements/PageHeading.d.ts
@@ -1,10 +1,10 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
-import React from 'react';
-interface Props {
+import type React from 'react';
+export interface PageHeadingProps {
title: React.ReactNode;
description?: React.ReactNode;
actions?: React.ReactNode;
className?: string;
}
-export default function PageHeading({ title, description, actions, className }: Props): React.JSX.Element;
-export {};
+declare const PageHeading: (props: PageHeadingProps) => React.ReactElement;
+export default PageHeading;
diff --git a/packages/sdk/types/components/elements/Pagination.d.ts b/packages/sdk/types/components/elements/Pagination.d.ts
index 8ce906797..5a9fd8f95 100644
--- a/packages/sdk/types/components/elements/Pagination.d.ts
+++ b/packages/sdk/types/components/elements/Pagination.d.ts
@@ -5,7 +5,7 @@ interface RenderFuncProps {
isLastPage: boolean;
isFirstPage: boolean;
}
-interface Props {
+export interface PaginationProps {
data: GeneratedPaginatedResult;
showGoToLast?: boolean;
showGoToFirst?: boolean;
@@ -24,5 +24,5 @@ interface GeneratedPaginatedResult {
};
};
}
-declare function Pagination({ data, onPageSelect, children }: Props): React.JSX.Element;
+declare function Pagination({ data, onPageSelect, children }: PaginationProps): React.JSX.Element;
export default Pagination;
diff --git a/packages/sdk/types/components/elements/ProgressBar.d.ts b/packages/sdk/types/components/elements/ProgressBar.d.ts
new file mode 100644
index 000000000..f950b1463
--- /dev/null
+++ b/packages/sdk/types/components/elements/ProgressBar.d.ts
@@ -0,0 +1,18 @@
+// Generated by scripts/generate-sdk-types.mjs. Do not edit.
+import { type UiTone } from "../../themes/skins.js";
+/** `meter` shows a value in a track; `page` is the loading bar along the top of the page. */
+export type ProgressBarVariant = 'meter' | 'page';
+export interface ProgressBarProps {
+ /** Percent complete from 0 to 100; `null` shows the track alone. */
+ value: number | null;
+ variant?: ProgressBarVariant;
+ /** Defaults to `accent` for the page bar and `neutral` otherwise. */
+ tone?: UiTone;
+ /** Names a meter for assistive technology. */
+ label?: string;
+ className?: string;
+}
+declare const ProgressBar: (props: ProgressBarProps) => import("react").ReactElement;
+export default ProgressBar;
+/** The page loading bar, driven by the panel's HTTP requests. */
+export declare function HttpProgressBar(): import("react").JSX.Element;
diff --git a/packages/sdk/types/components/elements/Spinner.d.ts b/packages/sdk/types/components/elements/Spinner.d.ts
index 7414ba8aa..225830b5f 100644
--- a/packages/sdk/types/components/elements/Spinner.d.ts
+++ b/packages/sdk/types/components/elements/Spinner.d.ts
@@ -1,16 +1,16 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
import React from 'react';
export type SpinnerSize = 'small' | 'base' | 'large';
-interface Props {
+export interface SpinnerProps {
size?: SpinnerSize;
centered?: boolean;
isBlue?: boolean;
children?: React.ReactNode;
}
-type SpinnerComponentType = ((props: Props) => React.JSX.Element) & {
+type SpinnerComponentType = ((props: SpinnerProps) => React.JSX.Element) & {
displayName?: string;
Size: Record<'SMALL' | 'BASE' | 'LARGE', SpinnerSize>;
- Suspense: ((props: Props) => React.JSX.Element) & {
+ Suspense: ((props: SpinnerProps) => React.JSX.Element) & {
displayName?: string;
};
};
diff --git a/packages/sdk/types/components/elements/SpinnerOverlay.d.ts b/packages/sdk/types/components/elements/SpinnerOverlay.d.ts
index 108d5c476..d22b1cceb 100644
--- a/packages/sdk/types/components/elements/SpinnerOverlay.d.ts
+++ b/packages/sdk/types/components/elements/SpinnerOverlay.d.ts
@@ -1,12 +1,12 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
import React from 'react';
import type { SpinnerSize } from "./Spinner.js";
-interface Props {
+export interface SpinnerOverlayProps {
visible: boolean;
fixed?: boolean;
size?: SpinnerSize;
backgroundOpacity?: number;
children?: React.ReactNode;
}
-declare const SpinnerOverlay: ({ size, fixed, visible, backgroundOpacity, children }: Props) => React.JSX.Element | null;
+declare const SpinnerOverlay: ({ size, fixed, visible, backgroundOpacity, children }: SpinnerOverlayProps) => React.JSX.Element | null;
export default SpinnerOverlay;
diff --git a/packages/sdk/types/components/elements/TitledGreyBox.d.ts b/packages/sdk/types/components/elements/TitledGreyBox.d.ts
index 81e9b3f80..c6652527d 100644
--- a/packages/sdk/types/components/elements/TitledGreyBox.d.ts
+++ b/packages/sdk/types/components/elements/TitledGreyBox.d.ts
@@ -8,5 +8,6 @@ interface Props {
contentClassName?: string;
children: React.ReactNode;
}
+/** A `Card` with a header. */
declare const TitledGreyBox: ({ icon, title, children, className, contentClassName }: Props) => React.JSX.Element;
export default TitledGreyBox;
diff --git a/packages/sdk/types/components/elements/alert/Alert.d.ts b/packages/sdk/types/components/elements/alert/Alert.d.ts
index 0d0eb0145..2709b1265 100644
--- a/packages/sdk/types/components/elements/alert/Alert.d.ts
+++ b/packages/sdk/types/components/elements/alert/Alert.d.ts
@@ -1,11 +1,11 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
import React from 'react';
export type AlertType = 'success' | 'info' | 'warning' | 'danger';
-interface AlertProps {
+export interface AlertProps {
type: AlertType;
title?: React.ReactNode;
className?: string;
children: React.ReactNode;
}
-export default function Alert({ type, title, className, children }: AlertProps): React.JSX.Element;
-export {};
+declare const Alert: (props: AlertProps) => React.ReactElement;
+export default Alert;
diff --git a/packages/sdk/types/components/elements/alert/index.d.ts b/packages/sdk/types/components/elements/alert/index.d.ts
index 360b226a5..141688a1e 100644
--- a/packages/sdk/types/components/elements/alert/index.d.ts
+++ b/packages/sdk/types/components/elements/alert/index.d.ts
@@ -1,3 +1,3 @@
// Generated by scripts/generate-sdk-types.mjs. Do not edit.
export { default as Alert } from "./Alert.js";
-export type { AlertType } from "./Alert.js";
+export type { AlertProps, AlertType } from "./Alert.js";
diff --git a/packages/sdk/types/components/elements/dialog/types.d.ts b/packages/sdk/types/components/elements/dialog/types.d.ts
index 40d48d3e8..07f55c54b 100644
--- a/packages/sdk/types/components/elements/dialog/types.d.ts
+++ b/packages/sdk/types/components/elements/dialog/types.d.ts
@@ -25,6 +25,8 @@ export interface RenderDialogProps extends DialogProps {
}
export interface DialogContextType {
- setIcon: Callback;
+ setIcon: Callback;
setIconPosition: Callback;
+ /** The state the dialog's skin reads, for parts rendered by its children. */
+ described: boolean;
}
diff --git a/packages/sdk/types/components/elements/dropdown/DropdownMenu.d.ts b/packages/sdk/types/components/elements/dropdown/DropdownMenu.d.ts
index 7eb52a902..7aca34c1a 100644
--- a/packages/sdk/types/components/elements/dropdown/DropdownMenu.d.ts
+++ b/packages/sdk/types/components/elements/dropdown/DropdownMenu.d.ts
@@ -2,7 +2,7 @@
import React from 'react';
import { Menu } from '@base-ui/react/menu';
import type { LucideIcon } from 'lucide-react';
-interface DropdownMenuProps {
+export interface DropdownMenuProps {
/** Rendered inside the trigger `
-
+
);
};
diff --git a/resources/scripts/components/admin/nodes/NodeAllocationTab.tsx b/resources/scripts/components/admin/nodes/NodeAllocationTab.tsx
index 155234877..b54e9a824 100644
--- a/resources/scripts/components/admin/nodes/NodeAllocationTab.tsx
+++ b/resources/scripts/components/admin/nodes/NodeAllocationTab.tsx
@@ -31,7 +31,6 @@ import { actionsColumn, DeleteAction, RowActions } from '@/components/elements/t
import { Dialog } from '@/components/elements/dialog';
import { Alert } from '@/components/elements/alert';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
import { cardTitleClass } from '@/components/ui/typography';
import { httpErrorToHuman } from '@/api/http';
import { cn } from '@/lib/cn';
@@ -372,7 +371,7 @@ const AllocationList = ({ query, paginationTable, showPagination, onBlockDelete
return (
<>
{grouped.length === 0 ? (
-
+
diff --git a/resources/scripts/components/admin/nodes/NodeServersTab.tsx b/resources/scripts/components/admin/nodes/NodeServersTab.tsx
index d879f7b30..3b4e79486 100644
--- a/resources/scripts/components/admin/nodes/NodeServersTab.tsx
+++ b/resources/scripts/components/admin/nodes/NodeServersTab.tsx
@@ -16,7 +16,6 @@ import DataTablePagination from '@/components/elements/table/DataTablePagination
import { Alert } from '@/components/elements/alert';
import Button from '@/components/elements/Button';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
import { httpErrorToHuman } from '@/api/http';
import { relationshipAttributes } from '@/api/relationships';
@@ -138,7 +137,7 @@ const NodeServerList = ({ query, table }: NodeServerListProps) => {
table={table}
isFetching={loading}
emptyState={
-
+
diff --git a/resources/scripts/components/admin/servers/ServerDatabaseTab.tsx b/resources/scripts/components/admin/servers/ServerDatabaseTab.tsx
index cd6b5aed2..0c027f4b9 100644
--- a/resources/scripts/components/admin/servers/ServerDatabaseTab.tsx
+++ b/resources/scripts/components/admin/servers/ServerDatabaseTab.tsx
@@ -15,7 +15,6 @@ import CopyOnClick from '@/components/elements/CopyOnClick';
import ListToolbar from '@/components/elements/ListToolbar';
import { NewLinkButton } from '@/components/elements/NewButton';
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
function ServerDatabaseContent({ server }: { server: AdminServer }) {
const { attributes } = server;
@@ -106,7 +105,7 @@ function ServerDatabaseContent({ server }: { server: AdminServer }) {
table={table}
isFetching={isFetching}
emptyState={
-
+
diff --git a/resources/scripts/components/admin/servers/ServerMountsTab.tsx b/resources/scripts/components/admin/servers/ServerMountsTab.tsx
index 46cb21c21..58655e5e6 100644
--- a/resources/scripts/components/admin/servers/ServerMountsTab.tsx
+++ b/resources/scripts/components/admin/servers/ServerMountsTab.tsx
@@ -17,7 +17,6 @@ import TitledGreyBox from '@/components/elements/TitledGreyBox';
import Code from '@/components/elements/Code';
import { NewLinkButton } from '@/components/elements/NewButton';
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
import Button from '@/components/elements/Button';
import Spinner from '@/components/elements/Spinner';
import { ServerError } from '@/components/elements/ScreenBlock';
@@ -142,7 +141,7 @@ function ServerMountsContent({ server }: Props) {
table={table}
isFetching={isFetching}
emptyState={
-
+
diff --git a/resources/scripts/components/admin/servers/ServerStartupTab.tsx b/resources/scripts/components/admin/servers/ServerStartupTab.tsx
index 957e3d55c..d00bf40e2 100644
--- a/resources/scripts/components/admin/servers/ServerStartupTab.tsx
+++ b/resources/scripts/components/admin/servers/ServerStartupTab.tsx
@@ -23,7 +23,6 @@ import Code from '@/components/elements/Code';
import { TextInput } from '@/components/form/controls';
import { ServerError } from '@/components/elements/ScreenBlock';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
import { relationshipData } from '@/api/relationships';
interface Props {
@@ -66,7 +65,7 @@ const EnvironmentVariables = ({ form, egg }: { form: AppForm
-
+
diff --git a/resources/scripts/components/admin/tags/NoTagsYet.tsx b/resources/scripts/components/admin/tags/NoTagsYet.tsx
index 8bc15952c..6e3a808b9 100644
--- a/resources/scripts/components/admin/tags/NoTagsYet.tsx
+++ b/resources/scripts/components/admin/tags/NoTagsYet.tsx
@@ -1,11 +1,10 @@
import { Link } from '@tanstack/react-router';
import { Tags } from 'lucide-react';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
export default function NoTagsYet() {
return (
-
+
diff --git a/resources/scripts/components/admin/users/UserDetailContainer.tsx b/resources/scripts/components/admin/users/UserDetailContainer.tsx
index 877c464b5..7eae04256 100644
--- a/resources/scripts/components/admin/users/UserDetailContainer.tsx
+++ b/resources/scripts/components/admin/users/UserDetailContainer.tsx
@@ -48,7 +48,6 @@ import DataTable from '@/components/elements/table/DataTable';
import { actionsColumn, RowActions } from '@/components/elements/table/RowActions';
import ServerEditAction from '@/components/admin/servers/ServerEditAction';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
import { relationshipData } from '@/api/relationships';
type UserForm = AppForm;
@@ -237,7 +236,7 @@ const OwnedServersCard = ({ servers }: { servers: AdminUserServer[] }) => {
+
diff --git a/resources/scripts/components/dashboard/AccountApiContainer.tsx b/resources/scripts/components/dashboard/AccountApiContainer.tsx
index 481461235..d124e94f9 100644
--- a/resources/scripts/components/dashboard/AccountApiContainer.tsx
+++ b/resources/scripts/components/dashboard/AccountApiContainer.tsx
@@ -7,7 +7,6 @@ import CreateApiKeyForm from '@/components/dashboard/forms/CreateApiKeyForm';
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
import Spinner from '@/components/elements/Spinner';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
import PageContentBlock from '@/components/elements/PageContentBlock';
import { Dialog } from '@/components/elements/dialog';
import Code from '@/components/elements/Code';
@@ -62,7 +61,7 @@ export default function AccountApiContainer() {
+
diff --git a/resources/scripts/components/dashboard/search/SearchModal.tsx b/resources/scripts/components/dashboard/search/SearchModal.tsx
index eff01be76..d4b107a95 100644
--- a/resources/scripts/components/dashboard/search/SearchModal.tsx
+++ b/resources/scripts/components/dashboard/search/SearchModal.tsx
@@ -14,8 +14,6 @@ import { useCurrentUser } from '@/api/account/queries';
import { useDebouncedValue } from '@/plugins/useDebouncedValue';
import { relationshipData } from '@/api/relationships';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
-import { cn } from '@/lib/cn';
type Props = DialogProps;
@@ -66,7 +64,7 @@ export default function SearchModal({ ...props }: Props) {
)}
{canSearch && servers && !isFetching && !error && serverList.length === 0 && (
-
+
diff --git a/resources/scripts/components/dashboard/ssh/AccountSSHContainer.tsx b/resources/scripts/components/dashboard/ssh/AccountSSHContainer.tsx
index 61a7cbada..5694367d1 100644
--- a/resources/scripts/components/dashboard/ssh/AccountSSHContainer.tsx
+++ b/resources/scripts/components/dashboard/ssh/AccountSSHContainer.tsx
@@ -11,7 +11,6 @@ import { ServerError } from '@/components/elements/ScreenBlock';
import DataTable from '@/components/elements/table/DataTable';
import { accountSshColumns } from '@/components/dashboard/ssh/AccountSSHTable';
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
-import { emptyCompactClass } from '@/components/ui/styles';
export default function AccountSSHContainer() {
const { data, error, refetch } = useSSHKeys();
@@ -39,7 +38,7 @@ export default function AccountSSHContainer() {
+
diff --git a/resources/scripts/components/elements/Badge.tsx b/resources/scripts/components/elements/Badge.tsx
new file mode 100644
index 000000000..7a949a999
--- /dev/null
+++ b/resources/scripts/components/elements/Badge.tsx
@@ -0,0 +1,23 @@
+import type React from 'react';
+import { replaceable, useSkin, type UiTone } from '@/themes/skins';
+
+export type BadgeSize = 'sm' | 'md';
+/** `solid` fills the badge with its tone; `soft` tints it. */
+export type BadgeVariant = 'solid' | 'soft';
+
+export interface BadgeProps extends React.HTMLAttributes {
+ tone?: UiTone;
+ size?: BadgeSize;
+ variant?: BadgeVariant;
+}
+
+/** A short status or count label. */
+function CoreBadge({ tone = 'neutral', size = 'md', variant = 'solid', className, ...props }: BadgeProps) {
+ const ui = useSkin('Badge', { tone, size, variant });
+
+ return ;
+}
+
+const Badge = replaceable('Badge', CoreBadge);
+
+export default Badge;
diff --git a/resources/scripts/components/elements/Button.tsx b/resources/scripts/components/elements/Button.tsx
index 125a7a50f..83e8458f1 100644
--- a/resources/scripts/components/elements/Button.tsx
+++ b/resources/scripts/components/elements/Button.tsx
@@ -1,115 +1,38 @@
import React from 'react';
-import { cva, type VariantProps } from 'class-variance-authority';
import { Link } from '@tanstack/react-router';
-import { cn } from '@/lib/cn';
import Spinner from '@/components/elements/Spinner';
+import { getSkin, replaceable, useSkin } from '@/themes/skins';
+
+export type ButtonColor = 'green' | 'red' | 'orange' | 'primary' | 'grey';
+export type ButtonSize = 'xsmall' | 'small' | 'large' | 'xlarge';
interface Props {
isLoading?: boolean;
- size?: 'xsmall' | 'small' | 'large' | 'xlarge';
- color?: 'green' | 'red' | 'orange' | 'primary' | 'grey';
+ size?: ButtonSize;
+ color?: ButtonColor;
isSecondary?: boolean;
}
-const buttonStyle = cva(
- 'relative inline-block rounded-sm border p-2 text-sm uppercase tracking-wide transition-colors duration-150 disabled:cursor-default disabled:opacity-50',
- {
- variants: {
- color: {
- primary:
- 'bg-primary border-primary text-primary-foreground [&:hover:not(:disabled)]:bg-primary/80 [&:hover:not(:disabled)]:border-primary',
- grey: 'border-border bg-popover text-foreground [&:hover:not(:disabled)]:bg-secondary [&:hover:not(:disabled)]:border-secondary',
- green: 'border-success bg-success text-success-foreground [&:hover:not(:disabled)]:bg-success/80 [&:hover:not(:disabled)]:border-success',
- red: 'border-destructive bg-destructive text-destructive-foreground [&:hover:not(:disabled)]:bg-destructive/80 [&:hover:not(:disabled)]:border-destructive',
- orange: 'border-caution bg-caution text-caution-foreground [&:hover:not(:disabled)]:bg-caution/80 [&:hover:not(:disabled)]:border-caution',
- },
- size: {
- xsmall: 'px-2 py-1 text-xs',
- small: 'px-4 py-2',
- large: 'p-4 text-sm',
- xlarge: 'p-4 w-full',
- },
- isSecondary: {
- true: 'border-border bg-transparent text-foreground [&:hover:not(:disabled)]:border-popover [&:hover:not(:disabled)]:bg-popover [&:hover:not(:disabled)]:text-foreground',
- false: '',
- },
- },
- compoundVariants: [
- {
- isSecondary: true,
- color: 'primary',
- class: '[&:hover:not(:disabled)]:bg-primary [&:hover:not(:disabled)]:border-primary [&:hover:not(:disabled)]:text-primary-foreground',
- },
- {
- isSecondary: true,
- color: 'red',
- class: '[&:hover:not(:disabled)]:bg-destructive [&:hover:not(:disabled)]:border-destructive [&:hover:not(:disabled)]:text-destructive-foreground',
- },
- {
- isSecondary: true,
- color: 'green',
- class: '[&:hover:not(:disabled)]:bg-success [&:hover:not(:disabled)]:border-success [&:hover:not(:disabled)]:text-success-foreground',
- },
- {
- isSecondary: true,
- color: 'orange',
- class: '[&:hover:not(:disabled)]:bg-caution [&:hover:not(:disabled)]:border-caution [&:hover:not(:disabled)]:text-caution-foreground',
- },
- {
- isSecondary: false,
- color: 'primary',
- class: '[&:active:not(:disabled)]:bg-primary/70 [&:active:not(:disabled)]:border-primary/70',
- },
- {
- isSecondary: false,
- color: 'green',
- class: '[&:active:not(:disabled)]:bg-success/70 [&:active:not(:disabled)]:border-success',
- },
- {
- isSecondary: false,
- color: 'red',
- class: '[&:active:not(:disabled)]:bg-destructive/70 [&:active:not(:disabled)]:border-destructive',
- },
- {
- isSecondary: false,
- color: 'orange',
- class: '[&:active:not(:disabled)]:bg-caution/70 [&:active:not(:disabled)]:border-caution',
- },
- ],
- defaultVariants: {
- color: 'primary',
- size: 'small',
- isSecondary: false,
- },
- }
-);
-
-type StyleProps = VariantProps;
-
-const buttonClassName = ({
- color,
- size,
- isSecondary,
- className,
-}: Omit & { className?: string }): string =>
- cn(
- buttonStyle({
- // A secondary button without a colour skips the default primary fill.
- color: isSecondary && !color ? undefined : (color as StyleProps['color']),
- size: (size as StyleProps['size']) ?? 'small',
- isSecondary: !!isSecondary,
- }),
- className
- );
-
type StyleableProps = Omit;
+const buttonState = ({ color, size, isSecondary }: StyleableProps, loading = false) => ({
+ color: color ?? 'primary',
+ size: size ?? 'small',
+ secondary: !!isSecondary,
+ loading,
+});
+
+/** The root classes of a button, for elements styled as one outside a component. */
+const buttonClassName = ({ className, ...props }: StyleableProps & { className?: string }): string =>
+ getSkin('Button', buttonState(props)).classes('root', className);
+
type ButtonStyleProps = {
as?: E;
ref?: React.ComponentPropsWithRef['ref'];
} & StyleableProps &
Omit, keyof StyleableProps | 'as'>;
+/** Any element, styled as a button. */
const ButtonStyle = ({
as,
color,
@@ -120,31 +43,54 @@ const ButtonStyle = ({
...props
}: ButtonStyleProps) => {
const Component = (as || 'button') as React.ElementType;
+ const ui = useSkin('Button', buttonState({ color, size, isSecondary }));
- return ;
+ return ;
};
-type ComponentProps = Omit, keyof Props> & Props;
+export type ButtonProps = Omit, keyof Props> & Props;
+
+function CoreButton({
+ children,
+ isLoading,
+ disabled,
+ type = 'button',
+ color,
+ size,
+ isSecondary,
+ className,
+ ref,
+ ...props
+}: ButtonProps) {
+ const ui = useSkin('Button', buttonState({ color, size, isSecondary }, !!isLoading));
+
+ return (
+
+ );
+}
/** Defaults to `type="button"`; `isLoading` shows a spinner and disables the button. */
-const Button = ({ children, isLoading, disabled, type = 'button', ref, ...props }: ComponentProps) => (
-
- {isLoading && (
-
-
-
- )}
- {children}
-
-);
+const Button = replaceable('Button', CoreButton);
-Button.displayName = 'Button';
-
-const TextButton = ({ ref, ...props }: ComponentProps) => ;
+const TextButton = ({ ref, ...props }: ButtonProps) => ;
TextButton.displayName = 'Button.Text';
-const DangerButton = ({ ref, ...props }: ComponentProps) => ;
+const DangerButton = ({ ref, ...props }: ButtonProps) => ;
DangerButton.displayName = 'Button.Danger';
diff --git a/resources/scripts/components/elements/Card.tsx b/resources/scripts/components/elements/Card.tsx
new file mode 100644
index 000000000..b9deb9c8e
--- /dev/null
+++ b/resources/scripts/components/elements/Card.tsx
@@ -0,0 +1,55 @@
+import type React from 'react';
+import type { LucideIcon } from 'lucide-react';
+import Icon from '@/components/elements/Icon';
+import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
+import { isString } from '@/lib/objects';
+import { replaceable, useSkin } from '@/themes/skins';
+
+export interface CardProps {
+ /** A string renders as the card's heading; any other node replaces it. */
+ title?: React.ReactNode;
+ /** Shown before a string title. */
+ icon?: LucideIcon;
+ /** Controls placed at the end of the header. */
+ actions?: React.ReactNode;
+ /** Covers the card with a spinner. */
+ loading?: boolean;
+ className?: string;
+ /** Classes for the body of a card with a header. */
+ bodyClassName?: string;
+ children?: React.ReactNode;
+}
+
+/** A surface for a section of content; with a title or actions it has a header above its body. */
+function CoreCard({ title, icon, actions, loading = false, className, bodyClassName, children }: CardProps) {
+ const titled = !!title || !!actions;
+ const ui = useSkin('Card', { titled, actions: !!actions, loading });
+
+ return (
+
+ {loading &&
}
+ {titled ? (
+ <>
+
+ {isString(title) ? (
+
+ {icon && }
+ {title}
+
+ ) : (
+ title
+ )}
+ {!!actions &&
{actions}
}
+
+
{children}
+ >
+ ) : (
+ children
+ )}
+
+ );
+}
+
+const Card = replaceable('Card', CoreCard);
+
+export default Card;
diff --git a/resources/scripts/components/elements/Code.tsx b/resources/scripts/components/elements/Code.tsx
index 8d297070e..02e3d2ff6 100644
--- a/resources/scripts/components/elements/Code.tsx
+++ b/resources/scripts/components/elements/Code.tsx
@@ -1,21 +1,14 @@
import React from 'react';
-import { cn } from '@/lib/cn';
+import { useSkin } from '@/themes/skins';
-interface CodeProps {
+export interface CodeProps {
dark?: boolean | undefined;
className?: string;
children: React.ReactNode;
}
export default function Code({ dark, className, children }: CodeProps) {
- return (
-
- {children}
-
- );
+ const ui = useSkin('Code', { dark: !!dark });
+
+ return {children};
}
diff --git a/resources/scripts/components/elements/ContentBox.tsx b/resources/scripts/components/elements/ContentBox.tsx
index 3153fea42..20ec92641 100644
--- a/resources/scripts/components/elements/ContentBox.tsx
+++ b/resources/scripts/components/elements/ContentBox.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
+import Card from '@/components/elements/Card';
import { cn } from '@/lib/cn';
import { sectionTitleClass } from '@/components/ui/typography';
@@ -11,13 +11,13 @@ type Props = Readonly<
}
>;
+/** A section title above a plain `Card`. */
const ContentBox = ({ title, borderColor, showLoadingOverlay, children, ...props }: Props) => (
{title &&
{title}
}
-
-
+
{children}
-
+
);
diff --git a/resources/scripts/components/elements/CopyOnClick.tsx b/resources/scripts/components/elements/CopyOnClick.tsx
index 44d7c445e..d42c9aa26 100644
--- a/resources/scripts/components/elements/CopyOnClick.tsx
+++ b/resources/scripts/components/elements/CopyOnClick.tsx
@@ -4,8 +4,9 @@ import Button from '@/components/elements/Button';
import { TextArea, TextInput } from '@/components/form/controls';
import copyToClipboard from '@/lib/clipboard';
import { cn } from '@/lib/cn';
+import { useSkin } from '@/themes/skins';
-interface CopyOnClickProps {
+export interface CopyOnClickProps {
text: string | number | null | undefined;
showInNotification?: boolean;
children: React.ReactNode;
@@ -45,6 +46,7 @@ const copyStatusMessage = (status: CopyStatus, text: CopyOnClickProps['text'], s
/** Copies `text` when its single child is clicked; a non-interactive child becomes a focusable button. */
const CopyOnClick = ({ text, showInNotification = false, children }: CopyOnClickProps) => {
const [status, setStatus] = useState(null);
+ const ui = useSkin('CopyOnClick', { status: status ?? undefined });
useEffect(() => {
if (!status) {
@@ -85,7 +87,7 @@ const CopyOnClick = ({ text, showInNotification = false, children }: CopyOnClick
role: interactive ? element.props.role : (element.props.role ?? 'button'),
tabIndex: interactive ? element.props.tabIndex : (element.props.tabIndex ?? 0),
onKeyDown: interactive ? element.props.onKeyDown : onKeyDown,
- className: cn(element.props.className || '', 'cursor-pointer'),
+ className: cn(element.props.className, ui.classes('target')),
onClick: (e: React.MouseEvent) => {
copy();
element.props.onClick?.(e);
@@ -97,9 +99,9 @@ const CopyOnClick = ({ text, showInNotification = false, children }: CopyOnClick
<>
{status && (
-
-
-
{copyStatusMessage(status, text, showInNotification)}
+
+
+
{copyStatusMessage(status, text, showInNotification)}
diff --git a/resources/scripts/components/elements/GreyRowBox.tsx b/resources/scripts/components/elements/GreyRowBox.tsx
deleted file mode 100644
index d8c96953a..000000000
--- a/resources/scripts/components/elements/GreyRowBox.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import { cn } from '@/lib/cn';
-import { interactiveSurfaceClass } from '@/components/ui/styles';
-
-type Props
= {
- as?: E;
- $hoverable?: boolean;
-} & Omit, 'as' | '$hoverable'>;
-
-const GreyRowBox = ({ as, $hoverable, className, ...props }: Props) => {
- const Component = (as || 'div') as React.ElementType;
-
- return (
-
- );
-};
-
-export default GreyRowBox;
diff --git a/resources/scripts/components/elements/Label.tsx b/resources/scripts/components/elements/Label.tsx
index 014dbd582..2b084d1f2 100644
--- a/resources/scripts/components/elements/Label.tsx
+++ b/resources/scripts/components/elements/Label.tsx
@@ -1,24 +1,16 @@
import React from 'react';
-import { cn } from '@/lib/cn';
+import { useSkin } from '@/themes/skins';
-type Props = {
+export type LabelProps = {
as?: E;
isLight?: boolean;
} & Omit, 'as' | 'isLight'>;
-const Label = ({ as, isLight, className, ...props }: Props) => {
+const Label = ({ as, isLight, className, ...props }: LabelProps) => {
const Component = (as || 'label') as React.ElementType;
+ const ui = useSkin('Label', { light: !!isLight });
- return (
-
- );
+ return ;
};
export default Label;
diff --git a/resources/scripts/components/elements/ListRow.tsx b/resources/scripts/components/elements/ListRow.tsx
new file mode 100644
index 000000000..5542d5d82
--- /dev/null
+++ b/resources/scripts/components/elements/ListRow.tsx
@@ -0,0 +1,29 @@
+import React from 'react';
+import { PanelLink, type PanelDestination } from '@/sdk/navigation';
+import { replaceable, useSkin } from '@/themes/skins';
+
+export interface ListRowProps extends React.HTMLAttributes {
+ as?: 'div' | 'li' | 'article';
+ /** Renders the row as a link to the destination. */
+ destination?: PanelDestination;
+ exact?: boolean;
+ /** Hover and press feedback; on for links and clickable rows unless set. */
+ interactive?: boolean;
+}
+
+/** A row of a list, such as a server on the dashboard. */
+function CoreListRow({ as: Element = 'div', destination, exact, interactive, className, ...props }: ListRowProps) {
+ const ui = useSkin('ListRow', {
+ interactive: interactive ?? (destination !== undefined || props.onClick !== undefined),
+ });
+
+ if (destination) {
+ return ;
+ }
+
+ return ;
+}
+
+const ListRow = replaceable('ListRow', CoreListRow);
+
+export default ListRow;
diff --git a/resources/scripts/components/elements/NewButton.tsx b/resources/scripts/components/elements/NewButton.tsx
index ac80c6eeb..b1a3c3bed 100644
--- a/resources/scripts/components/elements/NewButton.tsx
+++ b/resources/scripts/components/elements/NewButton.tsx
@@ -1,44 +1,40 @@
import type * as React from 'react';
import { Plus, type LucideIcon } from 'lucide-react';
-import Button, { RouterLinkButton } from '@/components/elements/Button';
+import Button, { RouterLinkButton, type ButtonProps } from '@/components/elements/Button';
import Icon from '@/components/elements/Icon';
-import { cn } from '@/lib/cn';
-
-const newButtonClass =
- 'inline-flex h-9 shrink-0 items-center justify-center gap-2 px-3 normal-case font-medium tracking-normal';
+import { useSkin } from '@/themes/skins';
interface IconProps {
/** Replaces the Plus for sibling toolbar actions such as Upload. */
icon?: LucideIcon;
}
+export type NewButtonProps = ButtonProps & IconProps;
+
/** The panel's "create" action: a Plus icon and a sentence-case label such as "New node". */
-export function NewButton({
- icon = Plus,
- className,
- children,
- ...props
-}: React.ComponentProps & IconProps) {
+export function NewButton({ icon = Plus, className, children, ...props }: NewButtonProps) {
+ const ui = useSkin('NewButton', { link: false });
+
return (
-