@stackone/malachite 2.86.0 → 2.88.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 +5 -4
- package/dist/components/Accordion.js +206 -179
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Button.js +118 -81
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +128 -75
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Chat/ChatModelPicker.js +70 -67
- package/dist/components/Chat/ChatModelPicker.js.map +1 -1
- package/dist/components/FilterSearch.js +237 -232
- package/dist/components/FilterSearch.js.map +1 -1
- package/dist/components/FrameHeader.js +36 -0
- package/dist/components/FrameHeader.js.map +1 -0
- package/dist/components/LoadingBar.js +5 -5
- package/dist/components/LoadingBar.js.map +1 -1
- package/dist/components/MultiSelect.js +438 -388
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/PinnedCornerCap.js +32 -19
- package/dist/components/PinnedCornerCap.js.map +1 -1
- package/dist/components/QueryInput.js +95 -92
- package/dist/components/QueryInput.js.map +1 -1
- package/dist/components/SplitButton.js +62 -61
- package/dist/components/SplitButton.js.map +1 -1
- package/dist/components/Surface.js +98 -94
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +630 -606
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
- package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
- package/dist/components/TimeBarChart/stackLayout.js +25 -0
- package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
- package/dist/components/TimeBarChart/timeBuckets.js +133 -0
- package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
- package/dist/components/TimeBarChart/tones.js +10 -0
- package/dist/components/TimeBarChart/tones.js.map +1 -0
- package/dist/components/Tooltip.js +93 -90
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/activeElement.js +5 -1
- package/dist/components/activeElement.js.map +1 -1
- package/dist/components/dateMath.js +1 -0
- package/dist/components/dateMath.js.map +1 -1
- package/dist/components/filterSearchModel.js +53 -45
- package/dist/components/filterSearchModel.js.map +1 -1
- package/dist/components/frameStyles.js +14 -0
- package/dist/components/frameStyles.js.map +1 -0
- package/dist/components/headerContent.js +10 -0
- package/dist/components/headerContent.js.map +1 -0
- package/dist/components/useFollowTrigger.js +28 -0
- package/dist/components/useFollowTrigger.js.map +1 -0
- package/dist/index.d.ts +131 -9
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +340 -340
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -8,10 +8,10 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
8
8
|
|
|
9
9
|
- **`Chat`** — A chat column: `Chat.Thread` scrolls and pins itself to the newest message, `Chat.Composer` keeps its own height and owns the Enter/Shift+Enter convention, and `Chat.Message`, `Chat.ToolCall` and `Chat.Thinking` render one turn each. A user turn sits right and hugs its text; an assistant turn runs full width, and `variant="card"` frames it with its state, copy and rating controls, and a token/model line. `variant="bubble"` is a third treatment, not a repaint of either: tinted bubbles whose flattened corner points at whoever spoke, so authorship reads before the words do. `Chat.Context` lists what the conversation can see — a removable chip per source, and an add affordance only when a handler is given. `Chat.Thinking` and a loading turn draw bars in the shape of the answer rather than a spinner. The row under a composer is `ComposerChip`, `ContextMeter` and `ModelPicker` — PillButton tabs, so it reads as attached to the field; `ModelPicker` opens a portalled menu with a submenu per model. The transcript is a live `log` region, so a streamed reply is announced, and it shows a centred empty state until the first turn. _Key props:_ `Chat`: `children`, `className`. `Thread`: `aria-label`, `emptyTitle`, `emptyDescription`, `emptyIcon`. `Message`: `role`, `variant` (`plain` | `card`), `content`, `children`, `name`, `avatarSrc`, `status` (`streaming` | `completed` | `error`), `loading`, `onCopy`, `onFeedback`, `usage`. `ToolCall`: `name`, `status` (`running` | `completed` | `error`), `callId`, `input`, `output`, `defaultExpanded`. `Thinking`: `label`. `Composer`: `value`, `onChange`, `onSend`, `onStop`, `busy`, `disabled`, `placeholder`, `maxLength`, `rows`, `children`. `ComposerChip`: `label`, `icon`, `trailingIcon`, `onClick`, `disabled`. `ContextMeter`: `used`, `limit`, `cached`, `label`. `ModelPicker`: `models`, `value`, `optionValue`, `onChange`, `openUp`, `disabled`. `Context`: `label`, `items` (`{id, label, onRemove?}`), `onAdd`, `className`.
|
|
10
10
|
- **`Surface`** — Rounded, bordered card container with the standard elevation shadow. Use `overflow="clip"` to keep the rounded clipping while letting a `position: sticky` descendant still pin (`hidden` would trap it); `visible` disables clipping. _Key props:_ `children`, `padding`, `overflow`, `shadow` (`false` sits the card flat, without the elevation shadow), `tone` (`default` | `highlight`; `highlight` paints the warm ground with no border, and sits flat unless `shadow` is passed, for a static block that stands out from the page, such as a hero or a guide's section header; its ground is too close to `Surface.Row`'s hover for clickable rows inside it), `className`, `style`.
|
|
11
|
-
- **`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; `selected` then paints the same treatment `Table` gives `selectedRowKey`. Under `role="checkbox"` it only announces — a multi-select row carries its own checkbox, and a highlight marking one of many says nothing when most rows are checked. `selection` overrides that either way (`highlight` / `announce`). `selected="mixed"` marks a partly selected checkbox row (`aria-checked="mixed"`); it never paints or marks a row current, and counts as not selected under any other role. Use `trailing` for a control that must stay interactive — it renders outside the row button, which a nested control could not be. An `onClick` row with `trailing` is still clickable across its whole box, padding and the space around the slot included (an `href` row leaves that to its link, so a modified click still opens a new tab), with its focus ring at the row's edge; a click inside the slot (or in a menu it portals out) is the slot's own, and a disabled row drops both the click and the ring. `revealTrailing` shows that control only on hover, keyboard focus or while a menu it opened is open, keeping it in the tab order and always showing it on a touch screen. `tone="muted"` tints a row whose subject is inactive, which `disabled` does not: a muted row stays clickable. `leading` puts the row's own indicator (a presentational `Checkbox`) inside the row button ahead of the children, and `dimmed` fades the children but not `leading` or `trailing`, for a row switched off but still a click from on. _Key props:_ `divider`, `disabled`, `tone` (`default` | `muted`), `inset` (`none` | `compact` — the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper), `onClick`, `href`, `target`, `rel`, `selected` (`boolean` | `"mixed"`), `selection` (`highlight` | `tint` | `announce`; `tint` paints the selected treatment without the accent bar, for a menu whose choice is already marked inside the row), `trailing`, `revealTrailing`, `leading`, `dimmed`, `role`, `className`, `style`.
|
|
11
|
+
- **`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; `selected` then paints the same treatment `Table` gives `selectedRowKey`. Under `role="checkbox"` it only announces — a multi-select row carries its own checkbox, and a highlight marking one of many says nothing when most rows are checked. `selection` overrides that either way (`highlight` / `announce`). `selected="mixed"` marks a partly selected checkbox row (`aria-checked="mixed"`); it never paints or marks a row current, and counts as not selected under any other role. Use `trailing` for a control that must stay interactive — it renders outside the row button, which a nested control could not be. An `onClick` row with `trailing` is still clickable across its whole box, padding and the space around the slot included (an `href` row leaves that to its link, so a modified click still opens a new tab), with its focus ring at the row's edge; a click inside the slot (or in a menu it portals out) is the slot's own, and a disabled row drops both the click and the ring. `revealTrailing` shows that control only on hover, keyboard focus or while a menu it opened is open, keeping it in the tab order and always showing it on a touch screen. `tone="muted"` tints a row whose subject is inactive, which `disabled` does not: a muted row stays clickable. `leading` puts the row's own indicator (a presentational `Checkbox`) inside the row button ahead of the children (with `leading` or `dimmed`, pass one child; it fills the row), and `dimmed` fades the children but not `leading` or `trailing`, for a row switched off but still a click from on. _Key props:_ `divider`, `disabled`, `tone` (`default` | `muted`), `inset` (`none` | `compact` — the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper), `onClick`, `href`, `target`, `rel`, `selected` (`boolean` | `"mixed"`), `selection` (`highlight` | `tint` | `announce`; `tint` paints the selected treatment without the accent bar, for a menu whose choice is already marked inside the row), `trailing`, `revealTrailing`, `leading`, `dimmed`, `role`, `className`, `style`.
|
|
12
12
|
- **`SurfaceExpandableRow`** — A row that opens to reveal a body (used as `Surface.ExpandableRow`), for a line that carries its own controls. Not `Accordion`, which puts its header inside the toggle button, so a header holding a dropdown or a second button would be invalid: here the row surface takes the click and a cell opts out by wrapping its controls in `ExpandableRow.Controls`, while the arrow stays a real button so the keyboard reaches it. That opt-out is explicit rather than sniffing the event target for an interactive ancestor, because a control rendering into a shadow root retargets the event to its host. `sticky` pins the row while its body scrolls, offset by `stickyTopOffset` for whatever is already pinned above it; it only pins while open, since a closed row has nothing to scroll past. _Key props:_ `header`, `children`, `expanded`, `onToggle`, `sticky`, `stickyTopOffset`, `divider`, `tone`, `aria-label`, `className`, `style`.
|
|
13
13
|
- **`DisclosureArrow`** — The expand/collapse triangle disclosure UI shares (`Accordion`, `Surface.ExpandableRow`). Owns its colour states so they never drift between usages: `text-primary` when expanded, `text-placeholder` otherwise, and dark on hover inside a `group` ancestor — put `group` on the clickable header or row so that hover state activates. _Key props:_ `expanded`, `size`, `className`.
|
|
14
|
-
- **`Card`** — Generic content card.
|
|
14
|
+
- **`Card`** — Generic content card. `title` heads it, with dimmed `subtitle` text beside it and `extra` actions at the right of the title row. `variant="framed"` draws the detached `Table`’s frame instead: the title row sits on a grey frame and the children in a bordered section inside it, so a card above a table, such as a chart over a log list, reads as part of the same set. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to a framed card. _Key props:_ `variant` (`CardVariant`: `default` | `framed`), `title`, `subtitle`, `extra`, `padding`, `footer`.
|
|
15
15
|
- **`SelectableCard`** — A card that is one option in a radio group — eyebrow, optional status tag, title, description, a count label and a top-right action slot. Use inside a `CardStrip`. Selection is controlled by the consumer: pass `selected`, which drives both the visual treatment and `aria-checked`. A selected card meets the sheet below the way a browser tab meets its toolbar — its bottom corners flare outward onto the strip’s rule — so its outline is one SVG path rather than borders, which would split into two lines at the tangent. `variant` picks the palette: `profile` (green), `library` (neutral) or `editing` (amber, for a profile with unsaved changes). `actions` stands in the card’s top-right corner, on the eyebrow row, and renders outside the control so a menu or icon button inside it stays clickable and keeps its own tab stop. Nothing else marks that corner: the flared outline, the tint and the green eyebrow already say which card is selected, so a radio there would only repeat them. `onDismiss` adds an x after `actions`, tinted like the eyebrow so it reads as part of the card — for discarding a draft card; `dismissDisabledReason` disables it and explains why in its tooltip. `isDefault` marks the card as the account default with a pin beside the title, named for assistive tech and tooltipped for everyone else — it belongs with the name it qualifies rather than among the actions, which read as things to press. `address` puts a one-line chip above the count for a copyable address such as a server URL: its `label` is cut short with an ellipsis, and its full `value` shows in a tooltip and is copied on click, without selecting the card. It takes the place of `description`, since the card has room for one or the other. For a row-shaped selectable use `Surface.Row` instead. _Key props:_ `value`, `title`, `titleIcon`, `isDefault`, `variant` (`profile` | `library` | `editing`), `eyebrow`, `status` (`label`, `type`, `tooltip`), `description`, `address` (`label`, `value`), `countLabel`, `actions`, `onDismiss` (`dismissLabel`, `dismissDisabledReason`), `selected`, `loading` (`loadingLabel`, `loadingHint`), `disabled`, `dimmed`, `onSelect`, `tabIndex`, `aria-label`, `className`, `style`.
|
|
16
16
|
- **`CardStrip`** — Horizontally scrolling radio group of cards, with edge arrows that appear only when the content overflows, an edge fade, scroll-snap and arrow-key navigation matching `SegmentedControl`. Owns interaction only: it finds its options by looking for `role="radio"` descendants carrying `data-value`, so any such child works (`SelectableCard` emits both). Pass a non-selectable terminal tile as `CardStrip.AddTile` — it sits inside the group but outside the radio set, and must be a direct child or it scrolls with the cards. Use `leading` to pin a card that should not scroll away; the strip tells the cards which slot they are in, so a pinned `SelectableCard` drops the left rule the scrolling ones draw. A strip too narrow to show a card beside `leading` scrolls it with the cards rather than squeezing them, so the selected card always has its full width. Set `bleed` when the strip sits in a `PageLayout`: the strip stretches past the horizontal padding of the layout so its bottom rule runs the full width of the page card, while the cards stay aligned to the gutter. With no cards at all the strip degenerates to its pinned slots alone — no trough, no scroller and no arrows — with the add tile standing beside `leading` and taking `primary` emphasis automatically, since adding the first card is the only thing on offer. _Key props:_ `value`, `tone` (`profile` | `library` | `editing` — read off the selected card unless set), `onChange`, `children`, `leading`, `arrows`, `fadeEdges`, `snap`, `bleed`, `scrollSelectedIntoView`, `aria-label`, `aria-labelledby`, `className`, `style`. `CardStrip.AddTile`: `label`, `icon`, `onClick`, `disabled`, `emphasis` (`primary` | `secondary` — left to the strip unless set: `primary` while there are no cards, `secondary` once there are), `className`.
|
|
17
17
|
- **`SplitScreenLayout`** — Two-pane full-screen layout (content + preview/aside) with an optional dismiss button.
|
|
@@ -56,7 +56,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
56
56
|
## Lists, rows & navigation
|
|
57
57
|
|
|
58
58
|
- **`ButtonList`** — Vertical list of pill-style button/link rows with built-in hover/focus/active states. _Key props:_ `buttons[]` (`key`, `children`, `onClick`, `href`), `compact`.
|
|
59
|
-
- **`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. Pass `stickyHeader` (+ optional `stickyTopOffset`) to pin the header on an opaque ground, keeping its open highlight and hover, while the body scrolls; add `pinnedCorners` for a section at the top of a card on the page ground, so the pinned header takes the rounded top corners of its card (set the `--malachite-ctx-pinned-surround` context variable on an ancestor when the card sits on another ground) — needs a scroll ancestor that clips without trapping sticky (e.g. `<Surface overflow="clip"
|
|
59
|
+
- **`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. Pass `stickyHeader` (+ optional `stickyTopOffset`) to pin the header on an opaque ground, keeping its open highlight and hover, while the body scrolls; add `pinnedCorners` for a section at the top of a card on the page ground, so the pinned header takes the rounded top corners of its card (set the `--malachite-ctx-pinned-surround` context variable on an ancestor when the card sits on another ground) — needs a scroll ancestor that clips without trapping sticky (e.g. `<Surface overflow="clip">`; with `pinnedCorners`, keep the default tone and add `shadow={false}` so the header can round over the border). `animate={false}` opens instantly. `collapsible={false}` makes a section that never closes: the same header, open highlight, sticky pinning and corner caps, with no arrow, hover or toggle, so `title` is plain text and `header` may hold controls; the toggle props (`isExpanded`, `defaultExpanded`, `onToggle`, `arrowPosition`, `disabled`) are ignored while it is `false`, and `animate` still picks how the body is rendered, so flipping `collapsible` keeps the body mounted. _Key props:_ `title` or `header`, `leading` (before the title, outside the toggle, e.g. a group's tri-state Checkbox), `trailing`, `arrowPosition` (`start` | `end` | `gutter`; `gutter` puts the arrow before `leading` as its own mouse toggle, as a file tree keeps its caret in the gutter), `highlightExpanded` (default `true`; `false` leaves an open row on the card ground), `flashKey` (change it after mount to flash an outline around the section; clearing it to `undefined` does not flash, a key coming back does), a forwarded `ref` to the section for `scrollIntoView` (with `stickyHeader` it carries a scroll margin of `stickyTopOffset`), `bodyIndent` (`none` | `title`; `title` starts the body under the title, 16px short of it so a compact `Surface.Row` inside lands its checkbox there), `collapsible` (default `true`), `disabled`, `isExpanded`/`defaultExpanded`, `onToggle`, `stickyHeader`, `stickyTopOffset`, `pinnedCorners`, `animate`.
|
|
60
60
|
- **`DefinitionRow`** — Row showing an icon, label, optional tag and description — for definition/detail lists. _Key props:_ `icon`, `label`, `tag`, `description`.
|
|
61
61
|
- **`PreviewTree`** — Nested, indented tree for previewing hierarchical structure.
|
|
62
62
|
- **`PreviewTreeRow`** — A single labelled row within a PreviewTree. _Key props:_ `label`.
|
|
@@ -111,7 +111,8 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
111
111
|
## Data display
|
|
112
112
|
|
|
113
113
|
- **`LevelMeter`** — Rising bars, shortest first, that picture how much of a scale is on — an access level in a level menu or on a level chip. Each step is `on` (a solid accent-green bar), `partial` (a green outline over a faint tint, for a step only some of whose actions are on) or `off` (an empty grey outline); every step keeps 3:1 against the surface, and colours come from the theme. Styled inline so it still draws inside an `ActionMenu`, which portals outside the shadow root and its stylesheet. Beside text that already names the level it is decorative and hidden from assistive tech; give it a `label` only when it stands alone and it reads as an image of that name. As an `ActionMenu` item `icon` or a `Button` `icon`, leave `label` off: the icon joins the item name, and the text already says the level. _Key props:_ `steps` (`LevelMeterStep[]`: `on` | `partial` | `off`), `label`, `className`.
|
|
114
|
-
- **`
|
|
114
|
+
- **`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`.
|
|
115
|
+
- **`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`), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition`, `headerVariant`, `title`, `subtitle`, `extra`, `onVisibleOrderChange`.
|
|
115
116
|
- **`Statistic`** — Displays a statistic value with a label; primary/secondary sizes. _Key props:_ `StatisticValueSize`.
|
|
116
117
|
- **`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"`.
|
|
117
118
|
- **`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. _Key props:_ `src`, `alt`, `title`, `onError`.
|
|
@@ -1,213 +1,240 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { DisclosureArrow as
|
|
4
|
-
import
|
|
5
|
-
import { ARROW_PX as
|
|
6
|
-
import { FOCUS_RING as
|
|
7
|
-
import { isRenderableNode as
|
|
8
|
-
import { usePinned as
|
|
9
|
-
const
|
|
10
|
-
title:
|
|
11
|
-
header:
|
|
12
|
-
className:
|
|
13
|
-
children:
|
|
14
|
-
trailing:
|
|
15
|
-
leading:
|
|
16
|
-
arrowPosition:
|
|
17
|
-
highlightExpanded:
|
|
18
|
-
bodyIndent:
|
|
19
|
-
variant:
|
|
20
|
-
defaultExpanded:
|
|
21
|
-
isExpanded:
|
|
22
|
-
onToggle:
|
|
23
|
-
disabled:
|
|
24
|
-
stickyHeader:
|
|
25
|
-
stickyTopOffset:
|
|
26
|
-
pinnedCorners:
|
|
27
|
-
animate:
|
|
28
|
-
collapsible:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import { jsxs as S, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import ue, { useId as me, useState as c, useEffect as q, useRef as K } from "react";
|
|
3
|
+
import { DisclosureArrow as B } from "./DisclosureArrow.js";
|
|
4
|
+
import pe from "./PinnedCornerCap.js";
|
|
5
|
+
import { ARROW_PX as I, toggleGapPx as fe, togglePaddingLeftPx as be, bodyInsetPx as he } from "./accordionBodyInset.js";
|
|
6
|
+
import { FOCUS_RING as ge, FOCUS_RING_INSET as ve } from "./focusRing.js";
|
|
7
|
+
import { isRenderableNode as W } from "./renderableNode.js";
|
|
8
|
+
import { usePinned as xe } from "./usePinned.js";
|
|
9
|
+
const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { position: "absolute", width: 0, height: 0 }, Re = ({
|
|
10
|
+
title: Y,
|
|
11
|
+
header: J,
|
|
12
|
+
className: Q,
|
|
13
|
+
children: i,
|
|
14
|
+
trailing: A,
|
|
15
|
+
leading: L,
|
|
16
|
+
arrowPosition: u = "start",
|
|
17
|
+
highlightExpanded: g = !0,
|
|
18
|
+
bodyIndent: V = "none",
|
|
19
|
+
variant: Z = "default",
|
|
20
|
+
defaultExpanded: H = !1,
|
|
21
|
+
isExpanded: v,
|
|
22
|
+
onToggle: x,
|
|
23
|
+
disabled: w = !1,
|
|
24
|
+
stickyHeader: d = !1,
|
|
25
|
+
stickyTopOffset: m = 0,
|
|
26
|
+
pinnedCorners: ee = !1,
|
|
27
|
+
animate: l = !0,
|
|
28
|
+
collapsible: o = !0,
|
|
29
|
+
flashKey: p
|
|
30
|
+
}, te) => {
|
|
31
|
+
const N = w || !o, r = Z === "sunken", k = `${me()}-body`, [$, j] = c(H), [re, ne] = c(p), [f, oe] = c(0), [E, F] = c(!1);
|
|
32
|
+
Object.is(p, re) || (ne(p), p !== void 0 && (oe(f + 1), F(!0))), q(() => {
|
|
33
|
+
if (f === 0)
|
|
34
|
+
return;
|
|
35
|
+
const n = window.setTimeout(() => F(!1), X);
|
|
36
|
+
return () => window.clearTimeout(n);
|
|
37
|
+
}, [f]), !o && !$ && j(!0);
|
|
38
|
+
const e = !o || (v !== void 0 ? v : $), R = o && u === "gutter", ae = l || e && !!i, [s, b] = c(!o), P = K(e);
|
|
39
|
+
!e && s ? b(!1) : e && !l && !s && b(!0), q(() => {
|
|
34
40
|
if (!e) {
|
|
35
|
-
|
|
41
|
+
P.current = !1;
|
|
36
42
|
return;
|
|
37
43
|
}
|
|
38
|
-
if (!
|
|
44
|
+
if (!l || s || P.current && o)
|
|
39
45
|
return;
|
|
40
|
-
const
|
|
41
|
-
return () => window.clearTimeout(
|
|
42
|
-
}, [
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
},
|
|
46
|
+
const n = window.setTimeout(() => b(!0), Ne);
|
|
47
|
+
return () => window.clearTimeout(n);
|
|
48
|
+
}, [l, e, o, s]);
|
|
49
|
+
const z = K(null), D = !!d && ee && !r, y = xe(z, m, D), _ = W(L), a = V === "title", h = a ? "grid grid-cols-subgrid col-span-4" : "", T = () => {
|
|
50
|
+
const n = !e;
|
|
51
|
+
v === void 0 && j(n), x == null || x(n);
|
|
52
|
+
}, se = [
|
|
47
53
|
a ? "grid grid-cols-[auto_auto_minmax(0,1fr)_auto]" : "flex flex-col",
|
|
48
54
|
"w-full text-left",
|
|
49
55
|
r ? "rounded-xl bg-[var(--malachite-card-dimmed-background)] p-[4px]" : "",
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
E ? "relative" : "",
|
|
57
|
+
Q
|
|
58
|
+
].filter(Boolean).join(" "), ie = [
|
|
52
59
|
// `group` only when enabled, so the arrow doesn't darken on hover while disabled.
|
|
53
|
-
|
|
54
|
-
a ?
|
|
60
|
+
N ? "" : "group",
|
|
61
|
+
a ? h : "flex w-full",
|
|
55
62
|
"items-center transition-colors",
|
|
56
63
|
r ? "" : "border-0 border-b border-solid border-[var(--malachite-card-border)]",
|
|
57
|
-
|
|
58
|
-
r ? "bg-transparent" :
|
|
59
|
-
].filter(Boolean).join(" "),
|
|
64
|
+
d ? `sticky ${y ? "z-10" : "z-[8]"}` : "",
|
|
65
|
+
r ? "bg-transparent" : d ? e && g || N ? "" : "hover:bg-[image:linear-gradient(var(--malachite-buttonlist-hover-background),var(--malachite-buttonlist-hover-background))]" : e && g ? "bg-[var(--malachite-buttonlist-hover-background)]" : N ? "bg-transparent" : "bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background)]"
|
|
66
|
+
].filter(Boolean).join(" "), M = [
|
|
60
67
|
"flex flex-1 items-center min-w-0 text-left",
|
|
61
68
|
r ? "pr-[16px] py-[12px]" : "pr-[16px] py-[16px]",
|
|
62
69
|
a ? "col-start-3" : ""
|
|
63
|
-
].filter(Boolean).join(" "),
|
|
64
|
-
|
|
70
|
+
].filter(Boolean).join(" "), de = [
|
|
71
|
+
M,
|
|
65
72
|
"appearance-none border-0 bg-transparent cursor-pointer select-none disabled:cursor-not-allowed",
|
|
66
|
-
r ? `rounded-lg ${
|
|
67
|
-
].join(" "),
|
|
68
|
-
paddingLeft:
|
|
69
|
-
gap:
|
|
70
|
-
},
|
|
71
|
-
top: `${
|
|
73
|
+
r ? `rounded-lg ${ge}` : ve
|
|
74
|
+
].join(" "), G = {
|
|
75
|
+
paddingLeft: be(_ || R),
|
|
76
|
+
gap: fe(r)
|
|
77
|
+
}, U = J ?? /* @__PURE__ */ t("span", { className: "flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]", children: Y }), le = !r && e && g, ce = d ? {
|
|
78
|
+
top: `${m}px`,
|
|
72
79
|
backgroundColor: r ? "var(--malachite-card-dimmed-background)" : "var(--malachite-card-background)",
|
|
73
|
-
...
|
|
80
|
+
...le && {
|
|
74
81
|
backgroundImage: "linear-gradient(var(--malachite-buttonlist-hover-background), var(--malachite-buttonlist-hover-background))"
|
|
75
82
|
}
|
|
76
|
-
} : {},
|
|
77
|
-
arrowPosition:
|
|
78
|
-
hasLeading:
|
|
83
|
+
} : {}, C = he({
|
|
84
|
+
arrowPosition: o ? u : "end",
|
|
85
|
+
hasLeading: _,
|
|
79
86
|
sunken: r
|
|
80
|
-
}),
|
|
87
|
+
}), O = a ? /* @__PURE__ */ t(
|
|
81
88
|
"div",
|
|
82
89
|
{
|
|
83
90
|
className: "col-start-3 col-span-2 min-w-0",
|
|
84
|
-
style:
|
|
85
|
-
children:
|
|
91
|
+
style: C < 0 ? { marginLeft: C } : { paddingLeft: C },
|
|
92
|
+
children: i
|
|
86
93
|
}
|
|
87
|
-
) :
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
surround: `var(${le}, var(--malachite-card-sunken-background))`
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
x && /* @__PURE__ */ t(
|
|
106
|
-
"button",
|
|
107
|
-
{
|
|
108
|
-
type: "button",
|
|
109
|
-
tabIndex: -1,
|
|
110
|
-
"aria-hidden": "true",
|
|
111
|
-
className: `${a ? "col-start-1" : ""} shrink-0 self-stretch flex items-center pl-[16px] appearance-none border-0 bg-transparent cursor-pointer disabled:cursor-not-allowed`,
|
|
112
|
-
onMouseDown: (o) => o.preventDefault(),
|
|
113
|
-
onClick: E,
|
|
114
|
-
disabled: g,
|
|
115
|
-
children: /* @__PURE__ */ t(y, { expanded: e, size: C })
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
N && /* @__PURE__ */ t(
|
|
119
|
-
"div",
|
|
120
|
-
{
|
|
121
|
-
className: `${a ? "col-start-2" : ""} shrink-0 flex items-center ${x ? "pl-[12px]" : "pl-[16px]"}`,
|
|
122
|
-
children: B
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
n ? /* @__PURE__ */ w(
|
|
126
|
-
"button",
|
|
127
|
-
{
|
|
128
|
-
type: "button",
|
|
129
|
-
className: Z,
|
|
130
|
-
style: D,
|
|
131
|
-
onClick: E,
|
|
132
|
-
"aria-expanded": e,
|
|
133
|
-
"aria-controls": J ? v : void 0,
|
|
134
|
-
disabled: g,
|
|
135
|
-
children: [
|
|
136
|
-
c === "start" && /* @__PURE__ */ t(y, { expanded: e, size: C }),
|
|
137
|
-
T,
|
|
138
|
-
c === "end" && /* @__PURE__ */ t(
|
|
139
|
-
y,
|
|
140
|
-
{
|
|
141
|
-
expanded: e,
|
|
142
|
-
size: C,
|
|
143
|
-
className: "ml-auto"
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
) : /* @__PURE__ */ t("div", { className: P, style: D, children: T }),
|
|
149
|
-
U(R) && /* @__PURE__ */ t(
|
|
150
|
-
"div",
|
|
151
|
-
{
|
|
152
|
-
className: `${a ? "col-start-4" : ""} shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]`,
|
|
153
|
-
children: R
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
i ? (
|
|
160
|
-
/* Height animates via grid-template-rows (0fr → 1fr); body clips during.
|
|
161
|
-
grid-cols-[minmax(0,1fr)] pins the single column to the track width so
|
|
162
|
-
wide, non-wrapping children (e.g. a table with long cell text) can't grow
|
|
163
|
-
the implicit `auto` column to their max-content and overflow the container;
|
|
164
|
-
the title grid's body cell uses min-w-0 instead. */
|
|
165
|
-
/* @__PURE__ */ t(
|
|
166
|
-
"div",
|
|
167
|
-
{
|
|
168
|
-
id: v,
|
|
169
|
-
className: `grid ${a ? "grid-cols-subgrid col-span-4" : "grid-cols-[minmax(0,1fr)]"} w-full transition-[grid-template-rows] duration-200 ease-in-out`,
|
|
170
|
-
style: { gridTemplateRows: e ? "1fr" : "0fr" },
|
|
171
|
-
onTransitionEnd: (o) => {
|
|
172
|
-
o.target === o.currentTarget && o.propertyName === "grid-template-rows" && u(e);
|
|
94
|
+
) : i;
|
|
95
|
+
return /* @__PURE__ */ S(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
ref: te,
|
|
99
|
+
className: se,
|
|
100
|
+
style: d && m ? { scrollMarginTop: m } : void 0,
|
|
101
|
+
children: [
|
|
102
|
+
E && /* @__PURE__ */ t(
|
|
103
|
+
"span",
|
|
104
|
+
{
|
|
105
|
+
"aria-hidden": "true",
|
|
106
|
+
className: "pointer-events-none absolute inset-0 z-[11] rounded-[inherit] [outline-offset:-2px] [animation:malachite-section-flash_ease-out] motion-reduce:[animation-name:malachite-section-flash-still]",
|
|
107
|
+
style: { animationDuration: `${X}ms` },
|
|
108
|
+
"data-accordion-flash": ""
|
|
173
109
|
},
|
|
174
|
-
|
|
110
|
+
f
|
|
111
|
+
),
|
|
112
|
+
D && /* @__PURE__ */ t("div", { ref: z, "aria-hidden": "true", style: ke }),
|
|
113
|
+
/* @__PURE__ */ S(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: ie,
|
|
117
|
+
style: ce,
|
|
118
|
+
"data-accordion-header": "",
|
|
119
|
+
"data-pinned": y ? "" : void 0,
|
|
120
|
+
children: [
|
|
121
|
+
y && /* @__PURE__ */ t(
|
|
122
|
+
pe,
|
|
123
|
+
{
|
|
124
|
+
bordered: !0,
|
|
125
|
+
radius: "var(--malachite-radius-xxl, 14px)",
|
|
126
|
+
surround: `var(${we}, var(--malachite-card-sunken-background))`
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
R && /* @__PURE__ */ t(
|
|
130
|
+
"button",
|
|
131
|
+
{
|
|
132
|
+
type: "button",
|
|
133
|
+
tabIndex: -1,
|
|
134
|
+
"aria-hidden": "true",
|
|
135
|
+
className: `${a ? "col-start-1" : ""} shrink-0 self-stretch flex items-center pl-[16px] appearance-none border-0 bg-transparent cursor-pointer disabled:cursor-not-allowed`,
|
|
136
|
+
onMouseDown: (n) => n.preventDefault(),
|
|
137
|
+
onClick: T,
|
|
138
|
+
disabled: w,
|
|
139
|
+
children: /* @__PURE__ */ t(B, { expanded: e, size: I })
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
_ && /* @__PURE__ */ t(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
className: `${a ? "col-start-2" : ""} shrink-0 flex items-center ${R ? "pl-[12px]" : "pl-[16px]"}`,
|
|
146
|
+
children: L
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
o ? /* @__PURE__ */ S(
|
|
150
|
+
"button",
|
|
151
|
+
{
|
|
152
|
+
type: "button",
|
|
153
|
+
className: de,
|
|
154
|
+
style: G,
|
|
155
|
+
onClick: T,
|
|
156
|
+
"aria-expanded": e,
|
|
157
|
+
"aria-controls": ae ? k : void 0,
|
|
158
|
+
disabled: w,
|
|
159
|
+
children: [
|
|
160
|
+
u === "start" && /* @__PURE__ */ t(B, { expanded: e, size: I }),
|
|
161
|
+
U,
|
|
162
|
+
u === "end" && /* @__PURE__ */ t(
|
|
163
|
+
B,
|
|
164
|
+
{
|
|
165
|
+
expanded: e,
|
|
166
|
+
size: I,
|
|
167
|
+
className: "ml-auto"
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
) : /* @__PURE__ */ t("div", { className: M, style: G, children: U }),
|
|
173
|
+
W(A) && /* @__PURE__ */ t(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: `${a ? "col-start-4" : ""} shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]`,
|
|
177
|
+
children: A
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
l ? (
|
|
184
|
+
/* Height animates via grid-template-rows (0fr → 1fr); body clips during.
|
|
185
|
+
grid-cols-[minmax(0,1fr)] pins the single column to the track width so
|
|
186
|
+
wide, non-wrapping children (e.g. a table with long cell text) can't grow
|
|
187
|
+
the implicit `auto` column to their max-content and overflow the container;
|
|
188
|
+
the title grid's body cell uses min-w-0 instead. */
|
|
189
|
+
/* @__PURE__ */ t(
|
|
175
190
|
"div",
|
|
176
191
|
{
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
192
|
+
id: k,
|
|
193
|
+
className: `grid ${a ? "grid-cols-subgrid col-span-4" : "grid-cols-[minmax(0,1fr)]"} w-full transition-[grid-template-rows] duration-200 ease-in-out`,
|
|
194
|
+
style: { gridTemplateRows: e ? "1fr" : "0fr" },
|
|
195
|
+
onTransitionEnd: (n) => {
|
|
196
|
+
n.target === n.currentTarget && n.propertyName === "grid-template-rows" && b(e);
|
|
197
|
+
},
|
|
198
|
+
children: /* @__PURE__ */ t(
|
|
180
199
|
"div",
|
|
181
200
|
{
|
|
182
|
-
className: [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
201
|
+
className: [h, s ? "overflow-visible" : "overflow-hidden"].filter(Boolean).join(" "),
|
|
202
|
+
"data-settled": s ? "" : void 0,
|
|
203
|
+
children: i && /* @__PURE__ */ t(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
className: [
|
|
207
|
+
h,
|
|
208
|
+
r ? "pt-[4px]" : "border-b border-solid border-[var(--malachite-card-border)]"
|
|
209
|
+
].filter(Boolean).join(" "),
|
|
210
|
+
children: O
|
|
211
|
+
}
|
|
212
|
+
)
|
|
187
213
|
}
|
|
188
214
|
)
|
|
189
215
|
}
|
|
190
216
|
)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
217
|
+
) : (
|
|
218
|
+
/* Instant open — no clip, so a sticky child inside pins immediately. */
|
|
219
|
+
e && i && /* @__PURE__ */ t(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
id: k,
|
|
223
|
+
className: [
|
|
224
|
+
h,
|
|
225
|
+
r ? "pt-[4px]" : "border-b border-solid border-[var(--malachite-card-border)]"
|
|
226
|
+
].filter(Boolean).join(" "),
|
|
227
|
+
children: O
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
)
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}, ye = ue.forwardRef(Re);
|
|
235
|
+
ye.displayName = "Accordion";
|
|
209
236
|
export {
|
|
210
|
-
|
|
211
|
-
|
|
237
|
+
ye as Accordion,
|
|
238
|
+
ye as default
|
|
212
239
|
};
|
|
213
240
|
//# sourceMappingURL=Accordion.js.map
|