@stackone/malachite 0.38.1 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/COMPONENTS.md ADDED
@@ -0,0 +1,84 @@
1
+ <!-- GENERATED by `npm run docs:components` from scripts/component-catalog.mjs. Do not edit by hand. -->
2
+
3
+ # Malachite components
4
+
5
+ The catalog of components exported from `@stackone/malachite`. **Reach for one of these before hand-rolling UI** — see `CLAUDE.md` for why. Open the demo app and pick a component from the sidebar to see it live.
6
+
7
+ ## Layout & containers
8
+
9
+ - **`Surface`** — Rounded, bordered card container with the standard elevation shadow. _Key props:_ `children`, `className`, `style`.
10
+ - **`SurfaceRow`** — A full-bleed row inside a Surface (used as `Surface.Row`). Owns hover highlight, colour transition and an optional bottom divider. Pass `onClick`/`href` to make the whole row clickable (renders as a real button/anchor, so keyboard nav works). For a selectable row use `role="radio"` + `selected` and put a presentational `<Radio>` inside as the indicator. _Key props:_ `divider`, `disabled`, `onClick`, `href`, `selected`, `role`, `className`, `style`.
11
+ - **`Card`** — Generic content card.
12
+ - **`SplitScreenLayout`** — Two-pane full-screen layout (content + preview/aside) with an optional dismiss button.
13
+ - **`WizardLayout`** — Full-screen wizard scaffold: top bar (back button, right-aligned stepper, trailing slot), centered content column, pinned footer. _Key props:_ `showBack`, `onBack`, `stepper`, `trailing`, `footer`, `center`, `contentWidth`, `minWidth`.
14
+ - **`Flex`** — Flexbox layout helper with semantic direction/align/justify/gap props. _Key props:_ `FlexDirection`, `FlexAlign`, `FlexJustify`, `FlexGapSize`.
15
+ - **`Padded`** — Padding wrapper applying consistent design-system spacing.
16
+ - **`Spacer`** — Empty element that adds fixed spacing between siblings.
17
+ - **`Divider`** — Horizontal/vertical separator; supports a dashed line style. _Key props:_ `lineStyle="solid" | "dashed"`, `DividerVariant`, `SpacingSize`, `PaddingSize`.
18
+ - **`OverflowRow`** — Horizontal row that collapses items that do not fit into an overflow affordance.
19
+
20
+ ## Lists, rows & navigation
21
+
22
+ - **`ButtonList`** — Vertical list of pill-style button/link rows with built-in hover/focus/active states. _Key props:_ `buttons[]` (`key`, `children`, `onClick`, `href`), `compact`.
23
+ - **`Accordion`** — Expand/collapse section with a clickable header (disclosure arrow + title/header + trailing slot). Use `header` for rich content and `trailing` for an interactive control (e.g. a Checkbox) — trailing sits outside the toggle button, so a selectable+expandable row is just an Accordion. Controlled or uncontrolled. _Key props:_ `title` or `header`, `trailing`, `disabled`, `isExpanded`/`defaultExpanded`, `onToggle`.
24
+ - **`DefinitionRow`** — Row showing an icon, label, optional tag and description — for definition/detail lists. _Key props:_ `icon`, `label`, `tag`, `description`.
25
+ - **`PreviewTree`** — Nested, indented tree for previewing hierarchical structure.
26
+ - **`PreviewTreeRow`** — A single labelled row within a PreviewTree. _Key props:_ `label`.
27
+ - **`Tabs`** — Tabbed navigation switching between content panels. _Key props:_ `TabItem[]`.
28
+ - **`ActionMenu`** — Dropdown menu of actions (kebab/overflow style). _Key props:_ `ActionMenuItem[]`.
29
+ - **`FooterNav`** — Footer navigation bar of links. _Key props:_ `FooterNavLink[]`.
30
+ - **`FooterLinks`** — Inline list of footer links (e.g. terms, privacy, support).
31
+
32
+ ## Forms & inputs
33
+
34
+ - **`Form`** — Form container coordinating field layout and submission.
35
+ - **`FormItem`** — Labelled form field wrapper (label, help text, error).
36
+ - **`BaseFormComponent`** — Low-level base used by form controls; rarely used directly.
37
+ - **`Input`** — Single-line text input.
38
+ - **`TextArea`** — Multi-line text input.
39
+ - **`Search`** — Search input with a leading icon; `filled` and `muted` variants. _Key props:_ `value`, `onChange`, `placeholder`, `variant`, `size`, `disabled`.
40
+ - **`Checkbox`** — Checkbox supporting checked/indeterminate/disabled. _Key props:_ `checked`, `indeterminate`, `disabled`, `onChange`.
41
+ - **`Radio`** — Single radio control with hover state; parent manages the group. Pass `presentational` to render a visual-only, non-focusable indicator for use inside a clickable row/card. _Key props:_ `checked`, `onChange`, `disabled`, `size`, `presentational`.
42
+ - **`Toggle`** — On/off switch.
43
+ - **`Dropdown`** — Single-select dropdown. _Key props:_ `DropdownItem[]`, `DropdownSize`.
44
+ - **`MultiSelect`** — Multi-select dropdown. _Key props:_ `MultiSelectOption[]`, `MultiSelectSize`.
45
+
46
+ ## Buttons & actions
47
+
48
+ - **`Button`** — Primary button. Variants: `filled`, `outline`, `destructive`, `success`, `warning`, `error`, `ghost`, `no-style`. Supports `iconOnly`, `loading`, `tooltip`. _Key props:_ `variant`, `size`, `icon`, `iconOnly`, `loading`, `disabled`, `fill`, `tooltip`.
49
+ - **`PillButton`** — Pill-shaped button, often used for filters/toggleable chips.
50
+ - **`Link`** — Styled anchor/link text. _Key props:_ `LinkProps`.
51
+
52
+ ## Feedback & status
53
+
54
+ - **`Alert`** — Inline alert/callout (info, success, warning, error).
55
+ - **`StatusBadge`** — Large status indicator (e.g. success checkmark) for terminal/confirmation screens. _Key props:_ `type`.
56
+ - **`StatBadge`** — Pill showing a numeric value with a label (e.g. "3 accounts selected"). _Key props:_ `count`, `label`.
57
+ - **`Tag`** — Small status/label tag. Types: success, error, warning, default. _Key props:_ `value`, `type`, `paddingSize`, `textTransform`, `WidthSize`.
58
+ - **`NumberTag`** — Compact numeric badge/counter.
59
+ - **`Progress`** — Progress bar.
60
+ - **`Spinner`** — Loading spinner.
61
+ - **`Skeleton`** — Loading placeholders. Includes `Skeleton.Avatar` and `Skeleton.Input`.
62
+ - **`Tooltip`** — Hover/focus tooltip; also works on disabled controls (see CLAUDE.md).
63
+ - **`TruncatedTooltip`** — Shows a tooltip only when its text is truncated.
64
+ - **`Confetti`** — Celebratory confetti burst for success moments. _Key props:_ `pieces`.
65
+
66
+ ## Data display
67
+
68
+ - **`Table`** — Data table with columns, sizing, pagination and row selection. _Key props:_ `TableColumns`, `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition`.
69
+ - **`Statistic`** — Displays a statistic value with a label; primary/secondary sizes. _Key props:_ `StatisticValueSize`.
70
+ - **`Avatar`** — Logo/initial avatar. Renders the image when available, otherwise a coloured tile with the first letter of `name`. Encapsulates the fallback colour. _Key props:_ `src`, `name`, `size`, `shape="square" | "circle"`.
71
+ - **`ConnectionHeader`** — Two tilted logo tiles (from → to) showing a connection between apps. _Key props:_ `from`, `to` (`ConnectionEndpoint`: `icon`, `label`, `background`).
72
+ - **`CodeBlock`** — Syntax-styled code block. _Key props:_ `code`.
73
+ - **`Stepper`** — Progress dots/segments for a multi-step flow; optionally clickable. _Key props:_ `steps`, `active`, `onChange`.
74
+ - **`Swatch`** — Colour swatch preview.
75
+
76
+ ## Typography
77
+
78
+ - **`Typography`** — Text primitives — use these instead of raw colour tokens on `<span>`s. Includes `Typography.Text`, `Typography.SecondaryText`, `Typography.EllipsisText`, etc., with size/weight/color props.
79
+
80
+ ## Theming & utility
81
+
82
+ - **`MalachiteContext`** — Wraps a subtree in the shadow root + theme context. Wrap groups of components in this.
83
+ - **`CustomIcons`** — Namespace of all built-in icons (`CustomIcons.<Name>Icon`), coloured via `currentColor`.
84
+ - **`ShadowEscape`** — Renders children into the document (escaping the shadow root) for portals/overlays.
package/dist/index.d.ts CHANGED
@@ -10,16 +10,33 @@ import { UseFormReturn } from 'react-hook-form';
10
10
 
11
11
  export declare const Accordion: default_2.FC<AccordionProps>;
12
12
 
13
- export declare interface AccordionProps {
14
- title: string;
13
+ declare interface AccordionBaseProps {
15
14
  className?: string;
16
15
  children?: default_2.ReactNode;
16
+ /**
17
+ * Content pinned to the right of the header, OUTSIDE the toggle button — so it may
18
+ * be interactive (e.g. a Checkbox) without nesting a button inside a button.
19
+ */
17
20
  trailing?: default_2.ReactNode;
18
21
  defaultExpanded?: boolean;
19
22
  isExpanded?: boolean;
20
23
  onToggle?: (expanded: boolean) => void;
24
+ /** Disables the toggle (and its hover). Trailing controls manage their own state. */
25
+ disabled?: boolean;
21
26
  }
22
27
 
28
+ /**
29
+ * Requires at least one of `title` (simple text header) or `header` (rich ReactNode
30
+ * content for the toggle area, e.g. avatar + badges) so the toggle is never empty.
31
+ */
32
+ export declare type AccordionProps = AccordionBaseProps & ({
33
+ title: string;
34
+ header?: default_2.ReactNode;
35
+ } | {
36
+ title?: string;
37
+ header: default_2.ReactNode;
38
+ });
39
+
23
40
  /**
24
41
  * ActionMenu is a kebab-style overflow action menu. The trigger renders a
25
42
  * three-dot icon button; on click, a popover appears with the given items.
@@ -86,6 +103,26 @@ export declare function applyLightTheme(): void;
86
103
  */
87
104
  export declare function applyTheme(theme: PartialMalachiteTheme): void;
88
105
 
106
+ /**
107
+ * A logo/initial avatar. Renders `src` when available, otherwise a coloured tile
108
+ * with the first letter of `name`. Encapsulates the fallback colour so consumers
109
+ * never hand-roll it.
110
+ */
111
+ export declare const Avatar: default_2.FC<AvatarProps>;
112
+
113
+ export declare interface AvatarProps {
114
+ /** Image URL (logo/photo). Falls back to the initial of `name` when missing or it fails to load. */
115
+ src?: string;
116
+ /** Used for the initial fallback and as the image alt / accessible label. */
117
+ name?: string;
118
+ /** Pixel size of the (square) avatar. */
119
+ size?: number;
120
+ shape?: AvatarShape;
121
+ className?: string;
122
+ }
123
+
124
+ export declare type AvatarShape = 'square' | 'circle';
125
+
89
126
  export declare const BaseFormComponent: default_2.FC<BaseFormComponentProps>;
90
127
 
91
128
  declare interface BaseFormComponentProps {
@@ -1083,9 +1120,16 @@ export declare const Radio: default_2.FC<RadioProps>;
1083
1120
 
1084
1121
  export declare interface RadioProps {
1085
1122
  checked: boolean;
1086
- onChange: (checked: boolean) => void;
1123
+ /** Optional when `presentational` — a presentational radio is a visual indicator only. */
1124
+ onChange?: (checked: boolean) => void;
1087
1125
  disabled?: boolean;
1088
1126
  size?: number;
1127
+ /**
1128
+ * Render a visual-only indicator (a non-interactive, non-focusable `<span>`,
1129
+ * `aria-hidden`) instead of an interactive radio. Use this inside a clickable
1130
+ * row/card whose wrapper is the real control, so there's a single tab stop.
1131
+ */
1132
+ presentational?: boolean;
1089
1133
  'aria-label'?: string;
1090
1134
  'aria-labelledby'?: string;
1091
1135
  className?: string;
@@ -1284,7 +1328,11 @@ export declare interface StepperProps {
1284
1328
  'aria-label'?: string;
1285
1329
  }
1286
1330
 
1287
- export declare const Surface: default_2.FC<SurfaceProps>;
1331
+ export declare const Surface: SurfaceComponent;
1332
+
1333
+ declare interface SurfaceComponent extends default_2.FC<SurfaceProps> {
1334
+ Row: default_2.FC<SurfaceRowProps>;
1335
+ }
1288
1336
 
1289
1337
  export declare interface SurfaceProps {
1290
1338
  children?: default_2.ReactNode;
@@ -1292,6 +1340,41 @@ export declare interface SurfaceProps {
1292
1340
  style?: default_2.CSSProperties;
1293
1341
  }
1294
1342
 
1343
+ /**
1344
+ * A single full-bleed row inside a <Surface>. Owns the row chrome — hover
1345
+ * highlight, colour transition and an optional bottom divider — so consumers
1346
+ * compose their own content inside without re-implementing design-system styling.
1347
+ * Pass `onClick`/`href` to make the entire row clickable (rendered as a real
1348
+ * button/anchor, so keyboard navigation works natively).
1349
+ */
1350
+ export declare const SurfaceRow: default_2.FC<SurfaceRowProps>;
1351
+
1352
+ export declare interface SurfaceRowProps {
1353
+ children?: default_2.ReactNode;
1354
+ /** Renders a bottom divider — omit on the last row in a Surface. */
1355
+ divider?: boolean;
1356
+ /** Removes the hover affordance / disables the control (e.g. while loading/busy). */
1357
+ disabled?: boolean;
1358
+ /**
1359
+ * When provided, the whole row becomes clickable: it renders as a `<button>`
1360
+ * (or `<a>` when `href` is set), so the entire row is the click target with
1361
+ * native focus + Enter/Space — no manual tabIndex/key handlers. For a
1362
+ * selectable row, put a presentational `<Radio>`/`<Checkbox>` inside as the
1363
+ * visual indicator; do NOT nest an interactive control (invalid + double tab stop).
1364
+ */
1365
+ onClick?: (event: default_2.MouseEvent) => void;
1366
+ /** Renders the clickable row as an anchor instead of a button. */
1367
+ href?: string;
1368
+ /** Selected state. Drives `aria-checked` when `role` is `radio`/`checkbox`. */
1369
+ selected?: boolean;
1370
+ /** ARIA role for a clickable row, e.g. `radio`/`checkbox` (wrap the list in a `radiogroup`). */
1371
+ role?: default_2.AriaRole;
1372
+ 'aria-label'?: string;
1373
+ 'aria-labelledby'?: string;
1374
+ className?: string;
1375
+ style?: default_2.CSSProperties;
1376
+ }
1377
+
1295
1378
  export declare const Swatch: default_2.FC<SwatchProps>;
1296
1379
 
1297
1380
  export declare interface SwatchProps {