@stackone/malachite 2.126.0 → 2.128.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 +3 -1
- package/dist/components/Invisible.js +16 -0
- package/dist/components/Invisible.js.map +1 -0
- package/dist/components/PillButtonGroup.js +35 -0
- package/dist/components/PillButtonGroup.js.map +1 -0
- package/dist/components/Table/Table.js +657 -641
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +412 -408
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -118,6 +118,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
118
118
|
- **`CloseButton`** — The bare X that dismisses a screen, panel or wizard: secondary at rest, primary on hover and keyboard focus, with no box or background at either. Use it instead of a `ghost` `Button` (which draws a hover box) or `no-style` (which has no disabled look). `surface="inverse"` is for a panel that stays dark in every theme, such as `SplitScreenLayout`’s, and reads the `closeButton` theme tokens. `loading` swaps the X for a spinner and sets `aria-busy`. Disabled and loading both use `aria-disabled` rather than `disabled`, so they ignore clicks but stay focusable and can still trigger a `Tooltip` explaining why. Named "Close" unless `aria-label` says otherwise. _Key props:_ `onClick`, `aria-label`, `size` (`small` 24px | `medium` 32px, 12px glyph), `surface` (`default` | `inverse`), `disabled`, `loading`.
|
|
119
119
|
- **`AccessPills`** — Three toggle pills, R / W / D, saying which effects an account grants (Read, Write, Delete) — on a linked-account row and in the header above the rows. Each pill is a button with `aria-pressed`, named in full by its state (`Write: some actions off`), and a tooltip on hover and focus spells that name out, since a letter alone is cryptic. On paints the effect’s tint (Read in `Tag`’s primary, Write in warning, Delete in error, the colours the dashboard already gives these effects), `"mixed"` (some, not all, of its actions on) an empty pill with a dashed border, off a neutral one. The colours come from the theme and there is no colour prop. It reports only which pill was pressed through `onToggle`: any cascade between effects (Read off turning Write and Delete off, say) and what pressing a mixed pill means belong to the caller. A pill in `disabled` stays focusable with `aria-disabled`, ignores clicks and keys, and its tooltip shows `disabledReason` instead, which is also its accessible description. `size="dense"` draws 24×20 pills in place of 26×24, for a narrow screen. _Key props:_ `value` (`{ read, write, delete }`, each `true` | `false` | `"mixed"`), `onToggle(effect)`, `disabled` (per effect), `disabledReason` (per effect, or one string), `size` (`default` | `dense`), `aria-label`, `aria-labelledby`.
|
|
120
120
|
- **`PillButton`** — Pill-shaped button, often used for filters/toggleable chips. `shape="tab"` squares the top corners so a row of them reads as attached to whatever sits above — the controls under a chat composer. Pass `href` and an interactive, non-disabled pill renders a real anchor (cmd-click, copy-link) instead of navigating from `onClick`; a disabled or `interactive={false}` pill stays static, and an unsafe scheme such as `javascript:` is dropped. `target="_blank"` always carries `noopener noreferrer`. _Key props:_ `label`, `icon`, `trailingIcon`, `selected`, `pressed` (makes a button pill a toggle: announces `aria-pressed` and paints the selected look while true, in place of `selected`; not on a link pill or the `assistant` tone), `disabled`, `interactive`, `size`, `variant`, `shape` (`pill` | `tab`), `onClick`, `href`, `target`, `rel`.
|
|
121
|
+
- **`PillButtonGroup`** — A named `group` around a wrapping row of `PillButton`s, so a screen reader announces the question a set of toggle pills answers, such as “Which finding is wrong?”. `label` shows the name above the pills and names the group by it; without one, the type requires `aria-label` or `aria-labelledby`, one name source only. An empty name warns in development. _Key props:_ `label` (visible name, a string or element), `aria-label` or `aria-labelledby` (exactly one of the three), `className`.
|
|
121
122
|
- **`CopyButton`** — The small copy control a copyable `Input` ends with, for a copyable value that is not an input, such as a list of scopes beside its label, so the two read the same. With `value` it copies and shows a check for a second; without, the click is the caller’s. _Key props:_ `value`, `onCopy`, `copied`, `aria-label`, `tooltip`.
|
|
122
123
|
- **`BannerButton`** — A banner that is one button: the warm ground, an icon in a white tile, a title with one line under it, and an arrow at the end that darkens on hover. For an offer of help beside a form, such as opening its setup guide, that wants more presence than a link and less than a primary button. Pass `aria-expanded` when it opens and closes something. _Key props:_ `icon`, `title`, `description`, `trailing`, `onClick`, `aria-expanded`, `aria-controls`, `aria-label`.
|
|
123
124
|
- **`Link`** — Styled anchor/link text. Opens in a new tab by default; with `renderLink`, a root-relative href goes through the app's own link component instead (href, classes, children and `onClick` when set; no `target` or `rel`), while any other href keeps the new-tab anchor. _Key props:_ `href`, `color` (`default` | `dimmed` | `inherit`; `inherit` takes the surrounding text colour, for a name in a tinted row, and thickens its underline on hover, a cue that shows on any surface and theme; it is always underlined, whatever `underline` says), `size`, `underline`, `truncate` (as a flex item, shrinks and ellipsizes the label), `onClick`, `renderLink`, `target`, `rel`.
|
|
@@ -134,7 +135,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
134
135
|
- **`TimeBarChart`** — Counts per time bucket as stacked bars on a UTC axis, the request-volume chart above a log list. Every bucket in `range` takes a slot whether or not it has data, so gaps read as gaps; a zone-less time string is read as UTC. Hover or arrow-key through buckets for a tooltip listing every series and the total; `highlightTime` shades the bucket holding a time from elsewhere on the page, such as the hovered log row. With `onRangeSelect`, dragging across bars reports the whole buckets covered, `end` exclusive so it goes straight back in as `range`, and whether the selection takes in the last bucket. `loading` dims bars already drawn rather than replacing them, and shows a spinner only when there is nothing to dim. Series colours follow the theme’s status tokens by `tone`, and failures always stack above successes whatever order `series` comes in, so position separates them where colour alone might not; a legend names them unless `legend={false}`. A visually hidden table carries the same numbers for screen readers. _Key props:_ `series` (`{ key, label, tone }[]`, stacked by tone with `error` on top; `TimeBarChartTone`: `success` | `error` | `neutral`), `buckets` (`{ start, values }[]`), `interval` (`{ unit, step }`; `TimeBarChartUnit`: `minute` | `hour` | `day` | `week` | `month`), `range` (`end` exclusive, as a selection reports it; at most 2,000 buckets, the newest kept), `TimeBarChartSize` (`small` | `medium` | `large`), `loading`, `error`, `errorTitle`, `errorSubTitle`, `valueLabel`, `legend`, `highlightTime`, `onRangeSelect`, `aria-label`, `aria-labelledby`, `className`, `style`.
|
|
135
136
|
- **`TimeBarChartSwatch`** — The mark a `TimeBarChart` draws a series in, by its `tone`, for naming the series somewhere other than the chart's legend, such as a count beside the chart standing in for it. It matches the legend and the tooltip, and the bars draw the same colour at 40%; it follows the theme with them. Decorative: the label beside it does the naming. _Key props:_ `tone` (`TimeBarChartTone`).
|
|
136
137
|
- **`Timeline`** — A vertical sequence of steps as an ordered list (`Timeline.Item`): a dot on a connecting line, a title, its timing at the right and a free-form body below, such as what happened to one API call. `titleCode` sets code after the title in the mono face as one phrase with it, such as `n8n called` then `Salesforce | Delete contact`. The dot is painted by `tone` from the theme’s text tokens (`neutral` is secondary text, the rest their status colours), or replaced by a decorative `marker` such as the caller’s logo. `icon` keeps the ring and draws a 12-14px glyph inside it in place of the dot, painted by `tone`, such as the call’s source type (MCP, API key, webhook); `skipped` beats `marker`, which beats `icon`. `stopped` puts an error badge (`stoppedLabel`, default "Stopped here") after the title of the step a flow ended on and paints its dot `error` unless a `tone` is set; the line ends at the last item. `meta` puts facts about a step in one wrapping row under its title, such as `calls` 2 and `status` 200, each label secondary and its value in the mono face, 18px apart, as a `dl`. `skipped` marks a step that never ran with a grey chevron in place of the dot; the title has to say so. For steps a person works through (complete, open, locked) use `StepList`. _Key props:_ `aria-label`, `aria-labelledby`; on `Timeline.Item`: `title`, `eyebrow` (a short label above the title naming the stage), `titleCode`, `time`, `tone` (`TimelineTone`: `neutral` | `info` | `success` | `warning` | `error`), `marker` (fills the 24px circle in place of the ringed dot), `icon` (a glyph inside the ring, painted by `tone`), `skipped`, `stopped`, `stoppedLabel`, `meta` (`TimelineMetaEntry[]`: `label`, `value`).
|
|
137
|
-
- **`Table`** — Data table with columns, sizing, pagination and row selection. `column.align` places a column's header as well as its cells. What lands on the aligned edge is the last thing in the header row rather than the title: the sort caret on a sortable column, the info icon on one carrying `info` without a sorter. `headerVariant` picks the header layout, and only `inline` lines header and body up exactly, because both are cells of one `<table>`. `detached` builds them from flex rows, where a sortable header cell is 32px narrower than a non-sortable one — its padding sits on the inner button rather than on the flex item — so its header cells sit 15–17px off their column at any alignment; reach for `inline` where exact alignment matters. Sorting is internal, so the array passed as `data` is not the order rendered once a column is sorted: `onVisibleOrderChange` reports the rows in render order — the whole of `data`, compared by `rowKey` so an equal order never re-fires — for a consumer stepping a master-detail view the way the user sees it. On the detached header, `title`, `subtitle` and `extra` add a title row on the frame above the column headers, the row a `framed` `Card` draws, and it docks with them under `stickyHeaderTop` (with `showHeader={false}` nothing docks and it scrolls with the rows). The inline header has no frame, so it draws none of the three and warns in development. _Key props:_ `TableColumns` (incl. `align`, and `titleShrinks` for a title that truncates itself in a fixed-width column, inline header only), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition` (`pagination.position`, in antd naming: a pager on each edge named, aligned as named, 16px from the rows; bottom right by default), `rowDensity` (`default`; `compact`, about 30px rows; `snug`, 38px rows with 12px side padding and a tighter header), `headerVariant`, `title`, `subtitle`, `extra`, `onVisibleOrderChange`, `scrollHeight` (a height, or `"fill"` for the room left in its scroller once the content above and below it fits, so the page itself never scrolls).
|
|
138
|
+
- **`Table`** — Data table with columns, sizing, pagination and row selection. `column.align` places a column's header as well as its cells. What lands on the aligned edge is the last thing in the header row rather than the title: the sort caret on a sortable column, the info icon on one carrying `info` without a sorter. `headerVariant` picks the header layout, and only `inline` lines header and body up exactly, because both are cells of one `<table>`. `detached` builds them from flex rows, where a sortable header cell is 32px narrower than a non-sortable one — its padding sits on the inner button rather than on the flex item — so its header cells sit 15–17px off their column at any alignment; reach for `inline` where exact alignment matters. Sorting is internal, so the array passed as `data` is not the order rendered once a column is sorted: `onVisibleOrderChange` reports the rows in render order — the whole of `data`, compared by `rowKey` so an equal order never re-fires — for a consumer stepping a master-detail view the way the user sees it. On the detached header, `title`, `subtitle` and `extra` add a title row on the frame above the column headers, the row a `framed` `Card` draws, and it docks with them under `stickyHeaderTop` (with `showHeader={false}` nothing docks and it scrolls with the rows). The inline header has no frame, so it draws none of the three and warns in development. _Key props:_ `TableColumns` (incl. `align`, and `titleShrinks` for a title that truncates itself in a fixed-width column, inline header only), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition` (`pagination.position`, in antd naming: a pager on each edge named, aligned as named, 16px from the rows; bottom right by default), `rowDensity` (`default`; `compact`, about 30px rows; `snug`, 38px rows with 12px side padding and a tighter header), `headerVariant`, `title`, `subtitle`, `extra`, `onVisibleOrderChange`, `scrollHeight` (a height, or `"fill"` for the room left in its scroller once the content above and below it fits, so the page itself never scrolls), `loadingRowCount` (skeleton rows while `loading`, 1 to 50), `aria-label` and `aria-labelledby` (name the inline table, in its loading and error states too).
|
|
138
139
|
- **`Statistic`** — Displays a statistic value with a label; primary/secondary sizes. _Key props:_ `StatisticValueSize`.
|
|
139
140
|
- **`Avatar`** — Logo/initial avatar. Renders the image when available, otherwise a coloured tile with the first letter of `name`, or with `fallback="placeholder"` the generic "no logo available" tile. Encapsulates the fallback colour. _Key props:_ `src`, `name`, `size`, `shape="square" | "circle"`, `fallback="initial" | "placeholder"`.
|
|
140
141
|
- **`ZoomableImage`** — An image shown inline as a button that enlarges it, for a screenshot too detailed to read at its inline size. The thumbnail is shown at its own width up to the width of its container, never stretched, and stops at 240px tall, cropping a tall image to its top. The enlarged image sits on the scrim with no card, as large as the window allows at its own aspect ratio, up to its natural size, and a click anywhere or ESC closes it. The thumbnail is named `Enlarge image: <alt>` and the dialog is named by `title`, or by `alt` when `title` is missing or empty, so `alt` must be non-empty. `onError` reports a thumbnail that failed to load, so the caller can leave it out rather than show a broken image. The thumbnail loads lazily, so for one below the fold that report comes once it nears the viewport, not on render. Inside a `SidePanel` it enlarges over the panel and its aside instead, on a blurred veil; Escape, the veil or the close button closes it and leaves the panel open. _Key props:_ `src`, `alt`, `title`, `onError`.
|
|
@@ -162,4 +163,5 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
162
163
|
- **`ThemeScope`** — Pins a subtree to a fixed theme (e.g. a dark island in a light app) via its own shadow root, since theme tokens are scoped per shadow root.
|
|
163
164
|
- **`CustomIcons`** — Namespace of all built-in icons (`CustomIcons.<Name>Icon`), coloured via `currentColor`.
|
|
164
165
|
- **`ShadowEscape`** — Renders children into the document (escaping the shadow root) for portals/overlays.
|
|
166
|
+
- **`Invisible`** — Keeps its children's space in the layout while hiding them from sight, the tab order and assistive technology, so a slot with nothing to offer still lines up with its neighbours, such as a column header whose action does not apply. The children stay the layout item (`display: contents`) and stay out of focus and the accessibility tree even if one sets itself visible (`inert`), though such a child still paints. `hidden={false}` shows them without remounting. The opposite of `VisuallyHidden`, which hides from sight only. _Key props:_ `children`, `hidden` (default `true`).
|
|
165
167
|
- **`VisuallyHidden`** — Text for assistive technology only: painted nowhere, in the light DOM or a shadow root, and still in the accessibility tree, so it names the control or header it sits in and reads as part of the text around it. Prefer it to `aria-label` on a plain span, whose generic role prohibits an accessible name. _Key props:_ `children`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { inertWhen as n } from "./inert.js";
|
|
3
|
+
const o = { display: "contents" }, e = { display: "contents", visibility: "hidden" }, l = ({ children: i, hidden: t = !0 }) => /* @__PURE__ */ s(
|
|
4
|
+
"span",
|
|
5
|
+
{
|
|
6
|
+
style: t ? e : o,
|
|
7
|
+
"aria-hidden": t || void 0,
|
|
8
|
+
...n(t),
|
|
9
|
+
children: i
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
export {
|
|
13
|
+
l as Invisible,
|
|
14
|
+
l as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Invisible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Invisible.js","sources":["../../src/components/Invisible.tsx"],"sourcesContent":["import type React from 'react';\nimport { inertWhen } from './inert';\n\nexport interface InvisibleProps {\n children: React.ReactNode;\n /** Hides the children while true, so a slot can toggle without remounting them. Defaults to true. */\n hidden?: boolean;\n}\n\nconst SHOWN_STYLE: React.CSSProperties = { display: 'contents' };\nconst HIDDEN_STYLE: React.CSSProperties = { display: 'contents', visibility: 'hidden' };\n\n/** Keeps its children's space while hiding them from sight, focus and assistive technology. */\nconst Invisible: React.FC<InvisibleProps> = ({ children, hidden = true }) => (\n <span\n style={hidden ? HIDDEN_STYLE : SHOWN_STYLE}\n aria-hidden={hidden || undefined}\n {...inertWhen(hidden)}\n >\n {children}\n </span>\n);\n\nexport default Invisible;\nexport { Invisible };\n"],"names":["SHOWN_STYLE","HIDDEN_STYLE","Invisible","children","hidden","jsx","inertWhen"],"mappings":";;AASA,MAAMA,IAAmC,EAAE,SAAS,WAAA,GAC9CC,IAAoC,EAAE,SAAS,YAAY,YAAY,SAAA,GAGvEC,IAAsC,CAAC,EAAE,UAAAC,GAAU,QAAAC,IAAS,SAC9D,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,OAAOD,IAASH,IAAeD;AAAA,IAC/B,eAAaI,KAAU;AAAA,IACtB,GAAGE,EAAUF,CAAM;AAAA,IAEnB,UAAAD;AAAA,EAAA;AACL;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useId as s } from "react";
|
|
3
|
+
import m from "./Typography/Text.js";
|
|
4
|
+
import { devWarning as p } from "./devWarning.js";
|
|
5
|
+
import { isRenderableNode as u } from "./renderableNode.js";
|
|
6
|
+
const g = ({
|
|
7
|
+
children: t,
|
|
8
|
+
className: n = "",
|
|
9
|
+
label: o,
|
|
10
|
+
"aria-label": a,
|
|
11
|
+
"aria-labelledby": i
|
|
12
|
+
}) => {
|
|
13
|
+
const l = s(), e = u(o);
|
|
14
|
+
return !e && !a && !i && p(
|
|
15
|
+
`PillButtonGroup.unnamed:${l}`,
|
|
16
|
+
"PillButtonGroup got an empty `label`, `aria-label` or `aria-labelledby`, so screen readers announce the group with no name."
|
|
17
|
+
), /* @__PURE__ */ d(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
role: "group",
|
|
21
|
+
"aria-label": e ? void 0 : a || void 0,
|
|
22
|
+
"aria-labelledby": e ? l : i || void 0,
|
|
23
|
+
className: `flex flex-col gap-2 ${n}`,
|
|
24
|
+
children: [
|
|
25
|
+
e && /* @__PURE__ */ r("div", { id: l, children: /* @__PURE__ */ r(m, { size: "small", children: o }) }),
|
|
26
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2", children: t })
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
g as PillButtonGroup,
|
|
33
|
+
g as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=PillButtonGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PillButtonGroup.js","sources":["../../src/components/PillButtonGroup.tsx"],"sourcesContent":["import type React from 'react';\nimport { useId } from 'react';\nimport Text from './Typography/Text';\nimport { devWarning } from './devWarning';\nimport { isRenderableNode } from './renderableNode';\n\ninterface PillButtonGroupBaseProps {\n children: React.ReactNode;\n className?: string;\n}\n\ntype PillButtonGroupNameProps =\n | { label: string | React.ReactElement; 'aria-label'?: never; 'aria-labelledby'?: never }\n | { label?: never; 'aria-label': string; 'aria-labelledby'?: never }\n | { label?: never; 'aria-label'?: never; 'aria-labelledby': string };\n\nexport type PillButtonGroupProps = PillButtonGroupBaseProps & PillButtonGroupNameProps;\n\nconst PillButtonGroup: React.FC<PillButtonGroupProps> = ({\n children,\n className = '',\n label,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const labelId = useId();\n const hasLabel = isRenderableNode(label);\n if (!hasLabel && !ariaLabel && !ariaLabelledBy) {\n devWarning(\n `PillButtonGroup.unnamed:${labelId}`,\n 'PillButtonGroup got an empty `label`, `aria-label` or `aria-labelledby`, so screen readers announce the group with no name.',\n );\n }\n return (\n <div\n role=\"group\"\n aria-label={hasLabel ? undefined : ariaLabel || undefined}\n aria-labelledby={hasLabel ? labelId : ariaLabelledBy || undefined}\n className={`flex flex-col gap-2 ${className}`}\n >\n {hasLabel && (\n <div id={labelId}>\n <Text size=\"small\">{label}</Text>\n </div>\n )}\n <div className=\"flex flex-wrap items-center gap-2\">{children}</div>\n </div>\n );\n};\n\nexport default PillButtonGroup;\nexport { PillButtonGroup };\n"],"names":["PillButtonGroup","children","className","label","ariaLabel","ariaLabelledBy","labelId","useId","hasLabel","isRenderableNode","devWarning","jsxs","jsx","Text"],"mappings":";;;;;AAkBA,MAAMA,IAAkD,CAAC;AAAA,EACrD,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,cAAcC;AAAA,EACd,mBAAmBC;AACvB,MAAM;AACF,QAAMC,IAAUC,EAAA,GACVC,IAAWC,EAAiBN,CAAK;AACvC,SAAI,CAACK,KAAY,CAACJ,KAAa,CAACC,KAC5BK;AAAA,IACI,2BAA2BJ,CAAO;AAAA,IAClC;AAAA,EAAA,GAIJ,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,cAAYH,IAAW,SAAYJ,KAAa;AAAA,MAChD,mBAAiBI,IAAWF,IAAUD,KAAkB;AAAA,MACxD,WAAW,uBAAuBH,CAAS;AAAA,MAE1C,UAAA;AAAA,QAAAM,KACG,gBAAAI,EAAC,SAAI,IAAIN,GACL,4BAACO,GAAA,EAAK,MAAK,SAAS,UAAAV,EAAA,CAAM,EAAA,CAC9B;AAAA,QAEJ,gBAAAS,EAAC,OAAA,EAAI,WAAU,qCAAqC,UAAAX,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGzE;"}
|