@stackone/malachite 2.114.0 → 2.116.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 CHANGED
@@ -17,7 +17,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
17
17
  - **`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`.
18
18
  - **`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`.
19
19
  - **`SplitScreenLayout`** — Two-pane full-screen layout (content + preview/aside) with an optional dismiss button.
20
- - **`PageLayout`** — Standard page chrome: a bordered card holding a breadcrumb bar, an optional alert strip, and a header block (subtitle, title + suffix, description) above the page body. Used as `PageLayout.Regular`; `PageLayout.Empty` is the chrome-only variant for pre-auth and error screens, with `headerActions` and `background` slots. Actions are declared as data (`buttons`) rather than children, and any that do not fit collapse into an overflow `ActionMenu` via `OverflowRow`. A client-side-routed app must pass `renderLink` so crumbs and the back button go through its router instead of reloading the document. Both layouts render a `main` landmark, demoted via `role` when the app owns its own. Deliberately not a `Surface` — the page card is 16px and carries no shadow. _Key props:_ `PageLayout.Regular`: `breadcrumbLinks`, `breadcrumbActions`, `renderLink`, `title`, `titleSuffix`, `subtitle`, `description`, `buttons`, `loading`, `centered`, `noPadding`, `contentGap` (`small` | `medium` | `large` | `xlarge`, default `small`), `alert`, `role`, `aria-label`, `aria-labelledby`, `className`, `style`. `PageLayout.Empty`: `title`, `centered`, `uniformPadding`, `headerActions`, `background`, `role`, `aria-label`, `aria-labelledby`, `className`, `style`.
20
+ - **`PageLayout`** — Standard page chrome: a bordered card holding a breadcrumb bar, an optional alert strip, and a header block (subtitle, title + suffix, description) above the page body. Used as `PageLayout.Regular`; `PageLayout.Empty` is the chrome-only variant for pre-auth and error screens, with `headerActions` and `background` slots. Actions are declared as data (`buttons`) rather than children, and any that do not fit collapse into an overflow `ActionMenu` via `OverflowRow`. A client-side-routed app must pass `renderLink` so crumbs and the back button go through its router instead of reloading the document. Both layouts render a `main` landmark, demoted via `role` when the app owns its own. Deliberately not a `Surface` — the page card is 16px and carries no shadow. _Key props:_ `PageLayout.Regular`: `breadcrumbLinks`, `breadcrumbActions`, `renderLink`, `title`, `titleSuffix`, `subtitle`, `description`, `buttons`, `loading`, `centered`, `noPadding`, `contentGap` (`small` | `medium` | `large` | `xlarge`, default `small`), `contentWidth` (`narrow`: caps and centres the header and body column for a single-column form), `alert`, `role`, `aria-label`, `aria-labelledby`, `className`, `style`. `PageLayout.Empty`: `title`, `centered`, `uniformPadding`, `headerActions`, `background`, `role`, `aria-label`, `aria-labelledby`, `className`, `style`.
21
21
  - **`WizardLayout`** — Full-screen wizard scaffold: top bar (back button, right-aligned stepper, trailing slot), pinned `header` slot, centered scrolling content column, and a pinned footer (above sticky body content). `footerGlass` gives the footer a frosted translucent + backdrop-blur treatment. `banner` pins a page-wide notice under the top bar, above `header` and outside the content column, so a warning about the whole page is not squeezed to the column's width — pair it with `Alert layout="banner"`. `topBarSize="large"` draws a 60px top bar with 28px insets (52px and 16px below 640px). `footerAlign="content"` holds the footer to the content column, inside its gutter, so a full-width action lines up with the list above it. `reserveBack={false}` drops the square held for a hidden back button, so `leading` sits at the same inset as `trailing`; the default keeps it so `leading` does not move as the wizard steps. _Key props:_ `showBack`, `onBack`, `reserveBack`, `topBarSize` (`default` | `large`), `footerAlign` (`full` | `content`), `leading`, `stepper`, `trailing`, `banner`, `header`, `footer`, `footerGlass`, `center`, `contentWidth`, `minWidth`.
22
22
  - **`PageActions`** — A page's action buttons, collapsing into an overflow menu as the row narrows. `PageLayout.Regular` renders these from its `buttons` prop; import it directly when a page builds its own header block (e.g. one that scrolls the title away) so the collapse, the dividers and the href handling come with it rather than being hand-rolled. _Key props:_ `buttons` (`PageAction[]`).
23
23
  - **`Toolbar`** — Flat, opaque horizontal bar for a sub-header / filter row (e.g. a Search). Owns its chrome — an opaque ground (`card-background`, or the sunken page ground with `surface="page"` for a bar above a card), so it can pin over scrolling content, plus an optional bottom `divider` — so consumers don’t hand-roll background/border tokens. Its `TOOLBAR_FILTER_WIDTH_PX` / `TOOLBAR_FILTER_MIN_WIDTH_PX` / `TOOLBAR_FILL_BASIS_PX` / `TOOLBAR_FILL_MIN_WIDTH_PX` are exported so a control outside the bar can line up with one inside it without re-typing the number. `sticky` pins it to the top of its scroll container; any other positioning is left to the consumer, as is the gutter when `padding="none"` — use that when the bar must sit flush with the content it pins over. `layout="filters"` makes it own the layout too, which consumers were each re-deriving and getting wrong the same way: a `flex: 1` search with no floor collapses to nothing on a narrow viewport, and a row that cannot wrap runs off the page. Compose it as `Toolbar.Fill` for the search and `Toolbar.Item` per filter, as flat siblings; `grow={false}` stops a slot growing past its basis, for a row that already spaces its children, though it can still shrink toward its `minWidth`. The row packs greedily from its basis widths and each line's spare space is shared out by grow factor, which is deliberately lopsided: the search outweighs the filters a hundred to one, so a shared line leaves them at their 200px while a filter left alone on a wrapped line grows into the whole width instead of stranding beside a gap. A filter drops to the next line once its full 200px basis will not fit, and the filters sharing a line then compress toward a 160px floor. A search and a filter are laid out differently rather than uniformly, because a search field's useful width is "as much as you can spare" where a filter's is the width of a value. _Key props:_ `divider`, `padding` (`none` | `compact` | `default`), `layout` (`plain` | `filters`), `surface` (`card` | `page` — `page` paints the sunken page ground, for a bar that sits above a card rather than inside it), `sticky` (pins it to the top of its scroll container above the rows under it), `className`, `style`. `Fill`: `minWidth`. `Item`: `width`, `minWidth`, `grow`.
@@ -91,7 +91,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
91
91
  - **`PreviewTree`** — Nested, indented tree for previewing hierarchical structure.
92
92
  - **`PreviewTreeRow`** — A single labelled row within a PreviewTree. _Key props:_ `label`.
93
93
  - **`Tabs`** — Tabbed navigation switching between content panels. ArrowLeft and ArrowRight on a focused tab move focus to the next enabled tab, wrapping at the ends, and Home and End to the first and last; Enter, Space or a click opens it, or `activation="automatic"` opens the tab an arrow reaches. ArrowUp, ArrowDown and any key with Alt, Ctrl or Cmd held are left to the page. `trailing` puts content on the same row, settled against its end — a count, a scope picker, the state the tabs are showing — inside the rule this component already draws. Without it a consumer had to redraw that rule to carry it past the tabs, and the tab list, which cannot wrap, would not yield any width to what sat beside it. The tabs hold their width and the trailing content gives ground; the `tablist` role stays on the tabs alone, so the extra content is not announced as one. Give an item `content` and each tab gets a `tabpanel` below the strip, wired with `aria-controls` and `aria-labelledby`: a panel mounts the first time its tab opens and then stays mounted, hidden, so a search, a filter or a scroll position survives a round trip and its data is not fetched again. `destroyInactivePanels` unmounts a panel when its tab is left instead. Panels have no overflow of their own, so a sticky toolbar inside one still pins to the page. Leave `content` off every item and the strip is all it renders. _Key props:_ `TabItem[]` (`key`, `label`, `count` (a `NumberTag` after the label), `disabled`, `content`), `activeKey`, `onChange`, `trailing`, `destroyInactivePanels`, `activation` (`manual` | `automatic`), `className`, `style`.
94
- - **`Breadcrumbs`** — Breadcrumb trail with caret separators, an optional back button (shown only when there is more than one crumb AND the parent — the second-to-last — carries a `url` to target) and a right-aligned `actions` row. A lone crumb marked `isRoot` switches to title mode: plain emphasised text, no trail chrome, but the `actions` row still renders. Renders as a `nav`/`ol` with `aria-current="page"` on the last crumb. Pass `renderLink` to route crumbs through the app's own router instead of a plain `<a>`. Used by `PageLayout`, but standalone too. _Key props:_ `links[]` (`name`, `url`, `isRoot`), `actions[]`, `renderLink`, `className`, `style`.
94
+ - **`Breadcrumbs`** — Breadcrumb trail with caret separators, an optional back button (shown only when there is more than one crumb AND the parent — the second-to-last — carries a `url` to target) and a right-aligned `actions` row. A lone crumb marked `isRoot` switches to title mode: plain emphasised text, no trail chrome, but the `actions` row still renders; `titleElement` renders it as a heading, which `PageLayout.Regular` asks for (`h1`) when no `title` heading is showing. Renders as a `nav`/`ol` with `aria-current="page"` on the last crumb. Pass `renderLink` to route crumbs through the app's own router instead of a plain `<a>`. Used by `PageLayout`, but standalone too. _Key props:_ `links[]` (`name`, `url`, `isRoot`), `actions[]`, `renderLink`, `titleElement`, `className`, `style`.
95
95
  - **`ActionMenu`** — Dropdown menu of actions (kebab/overflow style). The trigger is an icon-only `Button` by default, so `size` draws exactly the square a `Button` of that size draws beside it: `xsmall` is Figma's 20px "Button Element - Square (X-Small)", `small` the 28px rung above it. Both squares are fixed rather than read off the `controlHeights` tokens, so re-theming those does not resize the trigger. A supplied `triggerIcon` is held to the tier's glyph size — 11px at `xsmall`, 16px at `small`. At 20px the `xsmall` trigger meets WCAG 2.5.8 through the *Spacing* exception rather than the 24px minimum, so keep at least 4px between adjacent triggers. `showLabel` draws `label` beside the icon instead of leaving it to the accessible name — for a menu that is the point of its corner rather than an overflow for a row that already says what it acts on — and `variant` puts the trigger on any `Button` variant, so a menu handing work to the assistant can wear the assistant ground rather than the overflow-kebab outline. An item's `icon` leads its label: every caller's names the action itself — copy, open, delete — and an icon that is part of an item's identity belongs where the eye starts rather than right-aligned, where it reads as a status column. The menu is Figma's `Dropdown Component - Options List`: a fixed sized to its widest item between a 180px floor and the 280px Figma draws, by default under the trigger's right edge, 14px below it, flipping above or clamping sideways when the viewport has no room, rounding at the library's 12px and padding wider (8px) than the menu a `Dropdown` opens. Items read in the primary text colour, or the secondary one with `tone="muted"` (e.g. a sidebar's menus); destructive ones in red; `danger: 'hover'` keeps an item in its normal colour and turns it destructive (red text on a light red ground) only on hover or keyboard focus, for an action like signing out. A ceiling rather than a flat width: taken literally it gave a menu of four short verbs 130px of air and made every kebab in an app the same width whatever it held. `minWidth` only raises it above that ceiling, so it is the one way to go past 280px, and a label too long for the box truncates rather than wrapping. _Key props:_ `ActionMenuItem[]`, `size`, `label`, `triggerIcon`, `minWidth`, `showLabel`, `variant`, `tone` (`default` | `muted`), `trigger` (your own control in place of the kebab, cloned with the menu's ref and aria state), `highlightChoices`, `placement` (`bottom-end` default | `bottom-start` | `right-start` | `top-start` | `top-center`), `offset` (`small` 8px | `medium` 12px | `large` 14px; applies to every placement; without it the default `bottom-end` keeps the options menu's 14px and the others use 8px). An item's `tag` (e.g. an "Early access" `Tag`) follows its label in a lazily loaded shadow host of its own, since the menu renders into `document.body`, and joins its accessible name; `current: true` marks the item for the page the user is on (`aria-current="page"` and the selected row paint; a `danger` item keeps its red text). An item with an `href` is a link: Cmd/Ctrl-click or a middle click opens it in a new tab and closes the menu, while a plain click runs `onClick` in its place when one is given (so a router can navigate in-app); Enter and Space both activate it. `target: '_blank'` opens it in a new tab, adds `noopener noreferrer` and tells screen readers it opens a new tab. An item with `checked` is one of a set of choices: a `menuitemradio` with `aria-checked` and a trailing check while true; picking it still runs `onClick` and closes. Give the choices of one set the same `group` and, where they sit next to each other, they share a `role="group"` named by it, so a screen reader can tell where the set ends; choices with the same `group` split by another item form separate groups. `description` adds a quieter second line under the label, announced as the item's description rather than its name. `intent` colours the label and icon: `warning` (amber) for undoing choices already made, `accent` (green) for a way forward; a disabled item drops it, and `danger` or `current` wins over it. `highlightChoices` styles the menu as a picker: the checked choice of each `group` sits on a light green row (a Dropdown selected option's ground) with a green check (a danger, intent, disabled or current choice keeps its own colours), and a text row whose label is a set's `group` name sits a notch smaller, as its heading. An item with `type: 'text'` is context rather than an action (an account's email above its actions): secondary text the arrow keys skip. Opened from the keyboard, focus lands on the first item, or on the checked choice in a menu of choices; Up/Down/Home/End move through enabled items, Tab closes the menu and moves on as usual; Escape or a picked item returns focus to the trigger.
96
96
  - **`NavItem`** — A row in an app's side navigation. Idle rows read secondary and take the list hover; the `active` row wears the accent tint and sets `aria-current="page"` on a link. `collapsed` shrinks it to a 36px icon tile whose label becomes the accessible name and a right-hand tooltip, with any `badge` pinned to the tile's corner. `variant="subitem"` indents a child row behind a dot instead of an icon; `disclosure` makes a group header button with `aria-expanded` and a rotating chevron, and `hasActiveChild` colours its text while a child is current. Renders an `<a>` with `href`, the element passed with `asChild` (a router `Link`), or a `<button>`, and forwards its ref and extra attributes so it can be a `Popover` or `ActionMenu` trigger. `disabled` keeps the row a tab stop with `aria-disabled`, drops its hover and pointer, and ignores clicks, Enter and Space; a `Popover` or `ActionMenu` it triggers stays shut on press, hover, focus and arrow keys, while other keys still reach a passed `onKeyDown` so arrow navigation through a list keeps working; a disabled `href` row renders as a button so it cannot be followed. `disabledReason` explains it in a right-hand tooltip on hover and focus and is the row's accessible description from the first focus. Not with `asChild`, whose child would still navigate. _Key props:_ `label`, `icon`, `active`, `hasActiveChild`, `collapsed`, `variant` (`item` | `subitem`), `danger`, `trailing`, `badge`, `disclosure` (`expanded` | `collapsed`), `tooltip`, `accessibleLabel` (overrides the accessible name; collapsed it defaults to the tooltip text plus `badgeLabel`), `href`, `target`, `rel`, `onClick`, `asChild` + `children`, `className`, `size` (`medium` | `small`, the tighter row for lists inside a popover), `tag` (beside the label, e.g. early access), `badgeLabel` (read in place of the badge and added to the collapsed name), `disabled`, `disabledReason`. A passed `aria-expanded` (e.g. from a `Popover`) wins over `disclosure`, and a button row forwards a passed `aria-current`.
97
97
  - **`Sidebar`** — An app's left navigation shell, pinned to the viewport's left edge: 260px wide, 60px `collapsed`, on the sunken page background. Composed from `Sidebar.Header` (a 56px band for `Sidebar.Switcher`, the logo + workspace + parent trigger), `Sidebar.Body` (the part that scrolls), `Sidebar.Notices`, `Sidebar.Search`, `Sidebar.Section` (rows of `NavItem`s at the gutter), `Sidebar.Group` + `Sidebar.GroupItems` (a disclosure header and its sub-items), `Sidebar.Divider`, `Sidebar.Usage` (a `UsageCard` placed at the sidebar's gutter) and `Sidebar.Footer` holding `Sidebar.Account`. Popovers opened from it (with `padding="none"`) wrap their body in `Sidebar.Panel`, sized so the popover comes to `SIDEBAR_POPOVER_WIDTH_PX`, and build it from the `Popover` parts. `onToggleCollapse` adds the edge toggle, shown in CSS while the pointer is over the sidebar or a keyboard focus is inside it, and always on a touch screen, which has no hover to reveal it. A workspace, organization or account name cut off in the expanded sidebar shows in full on hover. Notices, the divider and the usage card hide while collapsed. Render it inside `<MalachiteContext layer="sidebar">`, or the page paints over the edge toggle. On a viewport narrower than `SIDEBAR_OVERLAY_BREAKPOINT_PX` (768px) pass `overlay`, collapse it on entering overlay mode, and keep the page at the collapsed offset. Collapsed, it is the plain rail and takes no focus. Expanded from that rail, it floats over the page as a modal drawer, behind a scrim, with Escape, a focus trap and scroll lock, and a click on the scrim or Escape collapses it through `onToggleCollapse`. Expanded on mount or across the breakpoint it stays a plain sidebar, so it never takes focus from the page, and expanded under an open dialog it becomes the drawer once that dialog closes. _Key props:_ `collapsed`, `onToggleCollapse`, `overlay`, `expandLabel`, `collapseLabel`, `aria-label`; `Sidebar.Switcher`: `logo`, `title`, `subtitle`, `titleTooltip`/`subtitleTooltip` (shown when the name is cut off, the name by default; pass a node to wrap it, e.g. to keep it out of session recordings) + button attributes; `Sidebar.Account`: `avatar` or `initials` (a small chip when there is no photo), `name`, `tooltip` (on the collapsed rail, and expanded when the name is cut off; `name` by default; pass a node to wrap it) + button attributes; `Sidebar.Usage`: the `UsageCard` props; `Sidebar.Notices`: `aria-label` (required); `Sidebar.Panel`: `width` (`SIDEBAR_POPOVER_WIDTH_PX` by default). `useSidebarCollapsed()` reads the state from inside; `SIDEBAR_WIDTH_PX` gives the page its offset beside the sidebar; `SIDEBAR_TOOLTIP_DELAY_S` is the 0.2s delay its name and rail tooltips use, for tooltips a consumer adds inside it.
@@ -115,7 +115,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
115
115
  - **`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`, `disabled`, `interactive`, `size`, `variant`, `shape` (`pill` | `tab`), `onClick`, `href`, `target`, `rel`.
116
116
  - **`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`.
117
117
  - **`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`.
118
- - **`Link`** — Styled anchor/link text. _Key props:_ `LinkProps`.
118
+ - **`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`, `size`, `underline`, `onClick`, `renderLink`, `target`, `rel`.
119
119
  - **`InlineConfirm`** — A confirmation asked on the control that triggered it rather than in a modal, for a reversible bulk edit where a dialog would be heavier than the change it guards. Drawn to the design's chip: 33px tall, 12px radius, its confirm cell running to the pill's own edge between two rules. Reads its own `inlineConfirm` theme tokens — a shade off the `SelectionBar` it appears beside, by design. Carries a spinning glyph by default — its own, so it takes the pill's colour rather than the sheet's dimmed grey — standing for a change waiting on an answer; pass `icon={null}` to drop it or a node to replace it. Anchored placement is in viewport coordinates, so the chip must not sit inside an ancestor carrying `transform`, `filter` or `contain`. It takes focus on open so `Enter` confirms, dismisses on `Escape` (through the shared escape-layer stack, so the topmost overlay answers) or a click outside, and returns focus to whatever opened it. `role="alertdialog"` named by the message itself, so the confirm button is never announced bare. Only one can be open at a time: opening a second dismisses the first, so it is never ambiguous what Yes answers. Pass `anchorTo` (a ref to the control it answers for) and it pins itself to that control's left, follows it while the page or a sticky header scrolls, dismisses once it scrolls out of view, and treats clicks on it as inside — without which the same click would dismiss and reopen. Left unanchored it renders in flow for the consumer to place, and must then not sit in a container that clips overflow (`Table` header cells among them). Nothing renders while `open` is false, and its listeners are attached only while it is open. _Key props:_ `open`, `message`, `confirmLabel`, `onConfirm`, `onDismiss`, `anchorTo`, `icon`, `className`, `style`.
120
120
  - **`SelectionBar`** — A bar reporting a pending selection and the actions that resolve it, for flows where changes accumulate and save once rather than writing on every toggle. Paints its own inverted surface from the `selectionBar` theme tokens, so its buttons are its own rather than `Button`. A count renders as one phrase (`3 Added`), not a number styled apart from its label, and an empty `value` carries a bare message instead; the separators between counts and before an action are glyphs (`•`, `|`) in the muted colour, not drawn rules. `emphasis` runs `primary` (a light filled button with its own edge, for the action that commits) → `secondary`, the default (a filled chip) → `quiet` (unfilled, taking a wash on hover). The pill is edgeless in light mode and keeps a hairline `border` token in dark, where a shadow alone would not separate it from the sheet. Defaults to `placement="sticky"` — render it as the last child of the scrolling content and it holds its place over a long list. Counts are announced through a live region that outlives the bar, so the first change is not lost; `open` drives an animated mount so it can appear and leave as the selection goes dirty and clean. Every action closes the bar, so the caller must move focus deliberately in `onClick`. `notice` wraps the whole bar in a warning sleeve carrying that message, for state the bar is reporting rather than an action it offers — a refused exit, say — and it leads the announcement; an empty string renders no sleeve. _Key props:_ `open`, `counts` (`value`, `label`), `actions` (`label`, `onClick`, `emphasis`, `icon`, `iconPosition`, `disabled`, `dividerBefore`), `placement`, `notice`, `aria-label`, `className`.
121
121
 
@@ -1,106 +1,122 @@
1
- import { jsxs as u, jsx as a } from "react/jsx-runtime";
2
- import { Button as v } from "./Button.js";
3
- import b from "./CustomIcons/ArrowLeftIcon.js";
4
- import N from "./CustomIcons/CaretRightIcon.js";
5
- import B from "./Typography/Text.js";
6
- import { hasBackButton as $ } from "./breadcrumbsNav.js";
1
+ import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
+ import N from "react";
3
+ import { Button as B } from "./Button.js";
4
+ import S from "./CustomIcons/ArrowLeftIcon.js";
5
+ import _ from "./CustomIcons/CaretRightIcon.js";
6
+ import $ from "./Typography/Text.js";
7
+ import { hasBackButton as y } from "./breadcrumbsNav.js";
7
8
  import { FOCUS_RING as x } from "./focusRing.js";
8
- import { isSafeHref as y, safeHref as S } from "./safeHref.js";
9
- const A = `no-underline rounded-xs cursor-pointer transition-colors duration-200 ease-in-out hover:text-[var(--malachite-accent-foreground,rgb(2,122,66))] ${x}`, C = `flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--malachite-radius-10,10px)] no-underline bg-[var(--malachite-number-tag-background,rgba(0,0,0,0.08))] text-[var(--malachite-text-primary,rgb(10,10,10))] transition-colors duration-200 ease-in-out hover:bg-[var(--malachite-number-tag-emphasis-background,rgba(0,0,0,0.15))] ${x}`, g = (e, r) => y(e.href) ? r ? r(e) : /* @__PURE__ */ a("a", { ...e }) : e.children, f = (e, r) => typeof e == "string" ? /* @__PURE__ */ a(B, { size: "medium", fontWeight: "semi-bold", color: r, children: e }) : e, _ = ({
9
+ import { isSafeHref as E, safeHref as A } from "./safeHref.js";
10
+ const R = `no-underline rounded-xs cursor-pointer transition-colors duration-200 ease-in-out hover:text-[var(--malachite-accent-foreground,rgb(2,122,66))] ${x}`, C = `flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--malachite-radius-10,10px)] no-underline bg-[var(--malachite-number-tag-background,rgba(0,0,0,0.08))] text-[var(--malachite-text-primary,rgb(10,10,10))] transition-colors duration-200 ease-in-out hover:bg-[var(--malachite-number-tag-emphasis-background,rgba(0,0,0,0.15))] ${x}`, p = (e, r) => E(e.href) ? r ? r(e) : /* @__PURE__ */ n("a", { ...e }) : e.children, v = { margin: 0 }, I = {
11
+ ...v,
12
+ fontSize: "inherit",
13
+ fontWeight: "inherit"
14
+ }, f = (e, r, a) => typeof e == "string" ? /* @__PURE__ */ n(
15
+ $,
16
+ {
17
+ as: a,
18
+ size: "medium",
19
+ fontWeight: "semi-bold",
20
+ color: r,
21
+ style: a ? v : void 0,
22
+ children: e
23
+ }
24
+ ) : a ? N.createElement(a, { style: I }, e) : e, T = ({
10
25
  label: e,
11
26
  onClick: r,
12
- disabled: m,
13
- variant: s,
14
- icon: d,
15
- href: h,
16
- target: t,
17
- tooltip: l,
18
- tooltipPlacement: c
19
- }, i) => {
20
- const n = S(h);
21
- return /* @__PURE__ */ a(
22
- v,
27
+ disabled: a,
28
+ variant: c,
29
+ icon: s,
30
+ href: d,
31
+ target: h,
32
+ tooltip: i,
33
+ tooltipPlacement: m
34
+ }, l) => {
35
+ const t = A(d);
36
+ return /* @__PURE__ */ n(
37
+ B,
23
38
  {
24
39
  size: "small",
25
- variant: s ?? "outline",
26
- disabled: m,
27
- icon: d,
28
- tooltip: l,
29
- tooltipPlacement: c,
30
- href: n,
31
- target: n ? t ?? "_blank" : void 0,
32
- onClick: n ? void 0 : r,
40
+ variant: c ?? "outline",
41
+ disabled: a,
42
+ icon: s,
43
+ tooltip: i,
44
+ tooltipPlacement: m,
45
+ href: t,
46
+ target: t ? h ?? "_blank" : void 0,
47
+ onClick: t ? void 0 : r,
33
48
  children: e
34
49
  },
35
- `${i}-${e}`
50
+ `${l}-${e}`
36
51
  );
37
- }, E = ({
52
+ }, K = ({
38
53
  links: e,
39
54
  actions: r,
40
- renderLink: m,
55
+ renderLink: a,
56
+ titleElement: c,
41
57
  className: s = "",
42
58
  style: d
43
59
  }) => {
44
60
  if (e.length === 0 && !(r != null && r.length))
45
61
  return null;
46
- const h = e.length === 1 && !!e[0].isRoot, t = $(e) ? e[e.length - 2] : void 0, l = t == null ? void 0 : t.name, c = !!(r != null && r.length);
62
+ const h = e.length === 1 && !!e[0].isRoot, i = y(e) ? e[e.length - 2] : void 0, m = i == null ? void 0 : i.name, l = !!(r != null && r.length);
47
63
  return /* @__PURE__ */ u(
48
64
  "div",
49
65
  {
50
- className: `flex items-center ${c ? "justify-between" : ""} ${s}`,
66
+ className: `flex items-center ${l ? "justify-between" : ""} ${s}`,
51
67
  style: d,
52
68
  children: [
53
- h ? f(e[0].name, "primary") : /* @__PURE__ */ u("div", { className: "flex items-center gap-4", children: [
54
- (t == null ? void 0 : t.url) && g(
69
+ h ? f(e[0].name, "primary", c) : /* @__PURE__ */ u("div", { className: "flex items-center gap-4", children: [
70
+ (i == null ? void 0 : i.url) && p(
55
71
  {
56
- href: t.url,
57
- "aria-label": typeof l == "string" ? `Back to ${l}` : "Go back",
72
+ href: i.url,
73
+ "aria-label": typeof m == "string" ? `Back to ${m}` : "Go back",
58
74
  className: C,
59
- children: /* @__PURE__ */ a(b, { size: 12 })
75
+ children: /* @__PURE__ */ n(S, { size: 12 })
60
76
  },
61
- m
77
+ a
62
78
  ),
63
- e.length > 0 && /* @__PURE__ */ a("nav", { "aria-label": "Breadcrumb", children: /* @__PURE__ */ a("ol", { className: "flex flex-wrap items-center gap-2 m-0 p-0 list-none", children: e.map((i, n) => {
64
- const o = n === e.length - 1, p = o ? "primary" : "muted";
79
+ e.length > 0 && /* @__PURE__ */ n("nav", { "aria-label": "Breadcrumb", children: /* @__PURE__ */ n("ol", { className: "flex flex-wrap items-center gap-2 m-0 p-0 list-none", children: e.map((t, g) => {
80
+ const o = g === e.length - 1, b = o ? "primary" : "muted";
65
81
  return /* @__PURE__ */ u(
66
82
  "li",
67
83
  {
68
84
  className: "flex items-center gap-2",
69
- "aria-current": o && !i.url ? "page" : void 0,
85
+ "aria-current": o && !t.url ? "page" : void 0,
70
86
  children: [
71
- i.url ? g(
87
+ t.url ? p(
72
88
  {
73
- href: i.url,
89
+ href: t.url,
74
90
  "aria-current": o ? "page" : void 0,
75
- className: `${A} ${o ? "text-[var(--malachite-text-primary,rgb(10,10,10))]" : "text-[var(--malachite-text-muted,rgb(76,75,75))]"}`,
91
+ className: `${R} ${o ? "text-[var(--malachite-text-primary,rgb(10,10,10))]" : "text-[var(--malachite-text-muted,rgb(76,75,75))]"}`,
76
92
  children: f(
77
- i.name,
93
+ t.name,
78
94
  "inherit"
79
95
  )
80
96
  },
81
- m
82
- ) : f(i.name, p),
83
- !o && /* @__PURE__ */ a(
97
+ a
98
+ ) : f(t.name, b),
99
+ !o && /* @__PURE__ */ n(
84
100
  "span",
85
101
  {
86
102
  "aria-hidden": "true",
87
103
  className: "flex items-center text-[var(--malachite-text-dimmed,rgb(161,161,161))]",
88
- children: /* @__PURE__ */ a(N, { size: 13 })
104
+ children: /* @__PURE__ */ n(_, { size: 13 })
89
105
  }
90
106
  )
91
107
  ]
92
108
  },
93
- `${i.url ?? ""}-${n}`
109
+ `${t.url ?? ""}-${g}`
94
110
  );
95
111
  }) }) })
96
112
  ] }),
97
- c && /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: r == null ? void 0 : r.map(_) })
113
+ l && /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: r == null ? void 0 : r.map(T) })
98
114
  ]
99
115
  }
100
116
  );
101
117
  };
102
118
  export {
103
- E as Breadcrumbs,
104
- E as default
119
+ K as Breadcrumbs,
120
+ K as default
105
121
  };
106
122
  //# sourceMappingURL=Breadcrumbs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.js","sources":["../../src/components/Breadcrumbs.tsx"],"sourcesContent":["import React from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport CaretRightIcon from './CustomIcons/CaretRightIcon';\nimport type { BreadcrumbLink, PageAction, RenderLink } from './PageLayout/types';\nimport Text, { type TextColor } from './Typography/Text';\nimport { hasBackButton } from './breadcrumbsNav';\nimport { FOCUS_RING } from './focusRing';\nimport { isSafeHref, safeHref } from './safeHref';\n\nexport interface BreadcrumbsProps {\n links: BreadcrumbLink[];\n actions?: PageAction[];\n renderLink?: RenderLink;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst CRUMB_LINK_CLASSES = `no-underline rounded-xs cursor-pointer transition-colors duration-200 ease-in-out hover:text-[var(--malachite-accent-foreground,rgb(2,122,66))] ${FOCUS_RING}`;\n\nconst BACK_BUTTON_CLASSES = `flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--malachite-radius-10,10px)] no-underline bg-[var(--malachite-number-tag-background,rgba(0,0,0,0.08))] text-[var(--malachite-text-primary,rgb(10,10,10))] transition-colors duration-200 ease-in-out hover:bg-[var(--malachite-number-tag-emphasis-background,rgba(0,0,0,0.15))] ${FOCUS_RING}`;\n\ntype LinkProps = Parameters<RenderLink>[0];\n\nconst renderCrumbLink = (props: LinkProps, renderLink?: RenderLink): React.ReactNode => {\n // An unsafe url degrades to plain text rather than a link that could run a script.\n if (!isSafeHref(props.href)) {\n return props.children;\n }\n return renderLink ? renderLink(props) : <a {...props} />;\n};\n\nconst renderCrumbName = (name: React.ReactNode, color: TextColor): React.ReactNode =>\n typeof name === 'string' ? (\n <Text size=\"medium\" fontWeight=\"semi-bold\" color={color}>\n {name}\n </Text>\n ) : (\n name\n );\n\nconst renderAction = (\n {\n label,\n onClick,\n disabled,\n variant,\n icon,\n href,\n target,\n tooltip,\n tooltipPlacement,\n }: PageAction,\n index: number,\n) => {\n const safe = safeHref(href);\n return (\n <Button\n key={`${index}-${label}`}\n size=\"small\"\n variant={variant ?? 'outline'}\n disabled={disabled}\n icon={icon}\n tooltip={tooltip}\n tooltipPlacement={tooltipPlacement}\n href={safe}\n target={safe ? (target ?? '_blank') : undefined}\n onClick={safe ? undefined : onClick}\n >\n {label}\n </Button>\n );\n};\n\nconst Breadcrumbs: React.FC<BreadcrumbsProps> = ({\n links,\n actions,\n renderLink,\n className = '',\n style,\n}) => {\n // PageLayout mounts this unconditionally, so returning markup would leave an empty\n // navigation landmark on every page without crumbs.\n if (links.length === 0 && !actions?.length) {\n return null;\n }\n\n const isTitle = links.length === 1 && Boolean(links[0].isRoot);\n const parentCrumb = hasBackButton(links) ? links[links.length - 2] : undefined;\n const parentName = parentCrumb?.name;\n const hasActions = Boolean(actions?.length);\n\n return (\n <div\n className={`flex items-center ${hasActions ? 'justify-between' : ''} ${className}`}\n style={style}\n >\n {isTitle ? (\n renderCrumbName(links[0].name, 'primary')\n ) : (\n <div className=\"flex items-center gap-4\">\n {parentCrumb?.url &&\n renderCrumbLink(\n {\n href: parentCrumb.url,\n 'aria-label':\n typeof parentName === 'string'\n ? `Back to ${parentName}`\n : 'Go back',\n className: BACK_BUTTON_CLASSES,\n children: <ArrowLeftIcon size={12} />,\n },\n renderLink,\n )}\n {links.length > 0 && (\n <nav aria-label=\"Breadcrumb\">\n <ol className=\"flex flex-wrap items-center gap-2 m-0 p-0 list-none\">\n {links.map((link, index) => {\n const isLast = index === links.length - 1;\n const color: TextColor = isLast ? 'primary' : 'muted';\n\n return (\n <li\n key={`${link.url ?? ''}-${index}`}\n className=\"flex items-center gap-2\"\n aria-current={isLast && !link.url ? 'page' : undefined}\n >\n {link.url\n ? renderCrumbLink(\n {\n href: link.url,\n 'aria-current': isLast\n ? 'page'\n : undefined,\n className: `${CRUMB_LINK_CLASSES} ${\n isLast\n ? 'text-[var(--malachite-text-primary,rgb(10,10,10))]'\n : 'text-[var(--malachite-text-muted,rgb(76,75,75))]'\n }`,\n children: renderCrumbName(\n link.name,\n 'inherit',\n ),\n },\n renderLink,\n )\n : renderCrumbName(link.name, color)}\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className=\"flex items-center text-[var(--malachite-text-dimmed,rgb(161,161,161))]\"\n >\n <CaretRightIcon size={13} />\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n )}\n </div>\n )}\n {hasActions && (\n <div className=\"flex items-center gap-2\">{actions?.map(renderAction)}</div>\n )}\n </div>\n );\n};\n\nexport { Breadcrumbs };\nexport default Breadcrumbs;\n"],"names":["CRUMB_LINK_CLASSES","FOCUS_RING","BACK_BUTTON_CLASSES","renderCrumbLink","props","renderLink","isSafeHref","jsx","renderCrumbName","name","color","Text","renderAction","label","onClick","disabled","variant","icon","href","target","tooltip","tooltipPlacement","index","safe","safeHref","Button","Breadcrumbs","links","actions","className","style","isTitle","parentCrumb","hasBackButton","parentName","hasActions","jsxs","ArrowLeftIcon","link","isLast","CaretRightIcon"],"mappings":";;;;;;;;AAkBA,MAAMA,IAAqB,mJAAmJC,CAAU,IAElLC,IAAsB,mVAAmVD,CAAU,IAInXE,IAAkB,CAACC,GAAkBC,MAElCC,EAAWF,EAAM,IAAI,IAGnBC,IAAaA,EAAWD,CAAK,IAAI,gBAAAG,EAAC,KAAA,EAAG,GAAGH,GAAO,IAF3CA,EAAM,UAKfI,IAAkB,CAACC,GAAuBC,MAC5C,OAAOD,KAAS,WACZ,gBAAAF,EAACI,GAAA,EAAK,MAAK,UAAS,YAAW,aAAY,OAAAD,GACtC,aACL,IAEAD,GAGFG,IAAe,CACjB;AAAA,EACI,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AACJ,GACAC,MACC;AACD,QAAMC,IAAOC,EAASN,CAAI;AAC1B,SACI,gBAAAX;AAAA,IAACkB;AAAA,IAAA;AAAA,MAEG,MAAK;AAAA,MACL,SAAST,KAAW;AAAA,MACpB,UAAAD;AAAA,MACA,MAAAE;AAAA,MACA,SAAAG;AAAA,MACA,kBAAAC;AAAA,MACA,MAAME;AAAA,MACN,QAAQA,IAAQJ,KAAU,WAAY;AAAA,MACtC,SAASI,IAAO,SAAYT;AAAA,MAE3B,UAAAD;AAAA,IAAA;AAAA,IAXI,GAAGS,CAAK,IAAIT,CAAK;AAAA,EAAA;AAclC,GAEMa,IAA0C,CAAC;AAAA,EAC7C,OAAAC;AAAA,EACA,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,kBAAAA,EAAK,MACAnC;AAAA,oBACI;AAAA,sBACI,MAAMmC,EAAK;AAAA,sBACX,gBAAgBC,IACV,SACA;AAAA,sBACN,WAAW,GAAGvC,CAAkB,IAC5BuC,IACM,uDACA,kDACV;AAAA,sBACA,UAAU/B;AAAA,wBACN8B,EAAK;AAAA,wBACL;AAAA,sBAAA;AAAA,oBACJ;AAAA,oBAEJjC;AAAA,kBAAA,IAEJG,EAAgB8B,EAAK,MAAM5B,CAAK;AAAA,kBACrC,CAAC6B,KACE,gBAAAhC;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACG,eAAY;AAAA,sBACZ,WAAU;AAAA,sBAEV,UAAA,gBAAAA,EAACiC,GAAA,EAAe,MAAM,GAAA,CAAI;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAC9B;AAAA,cAAA;AAAA,cA9BC,GAAGF,EAAK,OAAO,EAAE,IAAIhB,CAAK;AAAA,YAAA;AAAA,UAkC3C,CAAC,GACL,EAAA,CACJ;AAAA,QAAA,GAER;AAAA,QAEHa,uBACI,OAAA,EAAI,WAAU,2BAA2B,UAAAP,KAAA,gBAAAA,EAAS,IAAIhB,GAAY,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIrF;"}
1
+ {"version":3,"file":"Breadcrumbs.js","sources":["../../src/components/Breadcrumbs.tsx"],"sourcesContent":["import React from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport CaretRightIcon from './CustomIcons/CaretRightIcon';\nimport type { BreadcrumbLink, PageAction, RenderLink } from './PageLayout/types';\nimport Text, { type TextColor, type TextElement } from './Typography/Text';\nimport { hasBackButton } from './breadcrumbsNav';\nimport { FOCUS_RING } from './focusRing';\nimport { isSafeHref, safeHref } from './safeHref';\n\nexport interface BreadcrumbsProps {\n links: BreadcrumbLink[];\n actions?: PageAction[];\n renderLink?: RenderLink;\n /** The element a lone root crumb renders as, e.g. `h1` when it titles the page. */\n titleElement?: TextElement;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst CRUMB_LINK_CLASSES = `no-underline rounded-xs cursor-pointer transition-colors duration-200 ease-in-out hover:text-[var(--malachite-accent-foreground,rgb(2,122,66))] ${FOCUS_RING}`;\n\nconst BACK_BUTTON_CLASSES = `flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--malachite-radius-10,10px)] no-underline bg-[var(--malachite-number-tag-background,rgba(0,0,0,0.08))] text-[var(--malachite-text-primary,rgb(10,10,10))] transition-colors duration-200 ease-in-out hover:bg-[var(--malachite-number-tag-emphasis-background,rgba(0,0,0,0.15))] ${FOCUS_RING}`;\n\ntype LinkProps = Parameters<RenderLink>[0];\n\nconst renderCrumbLink = (props: LinkProps, renderLink?: RenderLink): React.ReactNode => {\n // An unsafe url degrades to plain text rather than a link that could run a script.\n if (!isSafeHref(props.href)) {\n return props.children;\n }\n return renderLink ? renderLink(props) : <a {...props} />;\n};\n\nconst HEADING_RESET: React.CSSProperties = { margin: 0 };\n\nconst NODE_HEADING_RESET: React.CSSProperties = {\n ...HEADING_RESET,\n fontSize: 'inherit',\n fontWeight: 'inherit',\n};\n\nconst renderCrumbName = (\n name: React.ReactNode,\n color: TextColor,\n as?: TextElement,\n): React.ReactNode => {\n if (typeof name === 'string') {\n return (\n <Text\n as={as}\n size=\"medium\"\n fontWeight=\"semi-bold\"\n color={color}\n style={as ? HEADING_RESET : undefined}\n >\n {name}\n </Text>\n );\n }\n return as ? React.createElement(as, { style: NODE_HEADING_RESET }, name) : name;\n};\n\nconst renderAction = (\n {\n label,\n onClick,\n disabled,\n variant,\n icon,\n href,\n target,\n tooltip,\n tooltipPlacement,\n }: PageAction,\n index: number,\n) => {\n const safe = safeHref(href);\n return (\n <Button\n key={`${index}-${label}`}\n size=\"small\"\n variant={variant ?? 'outline'}\n disabled={disabled}\n icon={icon}\n tooltip={tooltip}\n tooltipPlacement={tooltipPlacement}\n href={safe}\n target={safe ? (target ?? '_blank') : undefined}\n onClick={safe ? undefined : onClick}\n >\n {label}\n </Button>\n );\n};\n\nconst Breadcrumbs: React.FC<BreadcrumbsProps> = ({\n links,\n actions,\n renderLink,\n titleElement,\n className = '',\n style,\n}) => {\n // PageLayout mounts this unconditionally, so returning markup would leave an empty\n // navigation landmark on every page without crumbs.\n if (links.length === 0 && !actions?.length) {\n return null;\n }\n\n const isTitle = links.length === 1 && Boolean(links[0].isRoot);\n const parentCrumb = hasBackButton(links) ? links[links.length - 2] : undefined;\n const parentName = parentCrumb?.name;\n const hasActions = Boolean(actions?.length);\n\n return (\n <div\n className={`flex items-center ${hasActions ? 'justify-between' : ''} ${className}`}\n style={style}\n >\n {isTitle ? (\n renderCrumbName(links[0].name, 'primary', titleElement)\n ) : (\n <div className=\"flex items-center gap-4\">\n {parentCrumb?.url &&\n renderCrumbLink(\n {\n href: parentCrumb.url,\n 'aria-label':\n typeof parentName === 'string'\n ? `Back to ${parentName}`\n : 'Go back',\n className: BACK_BUTTON_CLASSES,\n children: <ArrowLeftIcon size={12} />,\n },\n renderLink,\n )}\n {links.length > 0 && (\n <nav aria-label=\"Breadcrumb\">\n <ol className=\"flex flex-wrap items-center gap-2 m-0 p-0 list-none\">\n {links.map((link, index) => {\n const isLast = index === links.length - 1;\n const color: TextColor = isLast ? 'primary' : 'muted';\n\n return (\n <li\n key={`${link.url ?? ''}-${index}`}\n className=\"flex items-center gap-2\"\n aria-current={isLast && !link.url ? 'page' : undefined}\n >\n {link.url\n ? renderCrumbLink(\n {\n href: link.url,\n 'aria-current': isLast\n ? 'page'\n : undefined,\n className: `${CRUMB_LINK_CLASSES} ${\n isLast\n ? 'text-[var(--malachite-text-primary,rgb(10,10,10))]'\n : 'text-[var(--malachite-text-muted,rgb(76,75,75))]'\n }`,\n children: renderCrumbName(\n link.name,\n 'inherit',\n ),\n },\n renderLink,\n )\n : renderCrumbName(link.name, color)}\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className=\"flex items-center text-[var(--malachite-text-dimmed,rgb(161,161,161))]\"\n >\n <CaretRightIcon size={13} />\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n )}\n </div>\n )}\n {hasActions && (\n <div className=\"flex items-center gap-2\">{actions?.map(renderAction)}</div>\n )}\n </div>\n );\n};\n\nexport { Breadcrumbs };\nexport default Breadcrumbs;\n"],"names":["CRUMB_LINK_CLASSES","FOCUS_RING","BACK_BUTTON_CLASSES","renderCrumbLink","props","renderLink","isSafeHref","jsx","HEADING_RESET","NODE_HEADING_RESET","renderCrumbName","name","color","as","Text","React","renderAction","label","onClick","disabled","variant","icon","href","target","tooltip","tooltipPlacement","index","safe","safeHref","Button","Breadcrumbs","links","actions","titleElement","className","style","isTitle","parentCrumb","hasBackButton","parentName","hasActions","jsxs","ArrowLeftIcon","link","isLast","CaretRightIcon"],"mappings":";;;;;;;;;AAoBA,MAAMA,IAAqB,mJAAmJC,CAAU,IAElLC,IAAsB,mVAAmVD,CAAU,IAInXE,IAAkB,CAACC,GAAkBC,MAElCC,EAAWF,EAAM,IAAI,IAGnBC,IAAaA,EAAWD,CAAK,IAAI,gBAAAG,EAAC,KAAA,EAAG,GAAGH,GAAO,IAF3CA,EAAM,UAKfI,IAAqC,EAAE,QAAQ,EAAA,GAE/CC,IAA0C;AAAA,EAC5C,GAAGD;AAAA,EACH,UAAU;AAAA,EACV,YAAY;AAChB,GAEME,IAAkB,CACpBC,GACAC,GACAC,MAEI,OAAOF,KAAS,WAEZ,gBAAAJ;AAAA,EAACO;AAAA,EAAA;AAAA,IACG,IAAAD;AAAA,IACA,MAAK;AAAA,IACL,YAAW;AAAA,IACX,OAAAD;AAAA,IACA,OAAOC,IAAKL,IAAgB;AAAA,IAE3B,UAAAG;AAAA,EAAA;AAAA,IAINE,IAAKE,EAAM,cAAcF,GAAI,EAAE,OAAOJ,EAAA,GAAsBE,CAAI,IAAIA,GAGzEK,IAAe,CACjB;AAAA,EACI,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EAC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R,KAAA,gBAAAA,EAAS,IAAIhB,GAAY,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIrF;"}
@@ -1,6 +1,7 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { FOCUS_RING as x } from "./focusRing.js";
3
- const u = (e) => {
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { FOCUS_RING as f } from "./focusRing.js";
3
+ import { isRootRelative as g } from "./safeHref.js";
4
+ const d = (e) => {
4
5
  if (!e) return "";
5
6
  switch (e) {
6
7
  case "xsmall":
@@ -18,30 +19,23 @@ const u = (e) => {
18
19
  default:
19
20
  return "";
20
21
  }
21
- }, f = ({
22
+ }, $ = ({
22
23
  children: e,
23
24
  href: t,
24
- target: r = "_blank",
25
- rel: a = "noopener noreferrer",
26
- className: n = "",
27
- color: l = "default",
28
- size: o,
29
- underline: s = !0
25
+ target: n = "_blank",
26
+ rel: s = "noopener noreferrer",
27
+ className: o = "",
28
+ color: i = "default",
29
+ size: m,
30
+ underline: c = !0,
31
+ onClick: a,
32
+ renderLink: r
30
33
  }) => {
31
- const i = l === "dimmed" ? "text-[var(--malachite-text-dimmed)] hover:text-[var(--malachite-text-primary)]" : "text-[var(--malachite-text-link-foreground)] hover:text-[var(--malachite-text-link-foreground-hover)]", m = u(o);
32
- return /* @__PURE__ */ c(
33
- "a",
34
- {
35
- href: t,
36
- target: r,
37
- rel: a,
38
- className: `${s ? "underline" : "no-underline"} rounded-xs cursor-pointer transition-colors duration-200 ease-in-out ${x} ${i} ${m} ${n}`,
39
- children: e
40
- }
41
- );
34
+ const x = i === "dimmed" ? "text-[var(--malachite-text-dimmed)] hover:text-[var(--malachite-text-primary)]" : "text-[var(--malachite-text-link-foreground)] hover:text-[var(--malachite-text-link-foreground-hover)]", u = d(m), l = `${c ? "underline" : "no-underline"} rounded-xs cursor-pointer transition-colors duration-200 ease-in-out ${f} ${x} ${u} ${o}`;
35
+ return r && g(t) ? r({ href: t, className: l, children: e, ...a ? { onClick: a } : {} }) : /* @__PURE__ */ h("a", { href: t, target: n, rel: s, className: l, onClick: a, children: e });
42
36
  };
43
37
  export {
44
- f as Link,
45
- f as default
38
+ $ as Link,
39
+ $ as default
46
40
  };
47
41
  //# sourceMappingURL=Link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sources":["../../src/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport { FOCUS_RING } from './focusRing';\nimport type { FontSize } from './Typography/Text';\n\nexport interface LinkProps {\n href: string;\n target?: '_blank' | '_self' | '_parent' | '_top';\n rel?: string;\n children: React.ReactNode;\n className?: string;\n color?: 'default' | 'dimmed';\n size?: FontSize;\n underline?: boolean;\n}\n\nconst getFontSizeClass = (size?: FontSize): string => {\n if (!size) return '';\n switch (size) {\n case 'xsmall':\n return 'text-[length:var(--malachite-font-size-xsmall)]';\n case 'small':\n return 'text-[length:var(--malachite-font-size-small)]';\n case 'medium':\n return 'text-[length:var(--malachite-font-size-medium)]';\n case 'large':\n return 'text-[length:var(--malachite-font-size-large)]';\n case 'xlarge':\n return 'text-[length:var(--malachite-font-size-xlarge)]';\n case 'xxlarge':\n return 'text-[length:var(--malachite-font-size-xxlarge)]';\n default:\n return '';\n }\n};\n\nexport const Link: React.FC<LinkProps> = ({\n children,\n href,\n target = '_blank',\n rel = 'noopener noreferrer',\n className = '',\n color = 'default',\n size,\n underline = true,\n}) => {\n const colorClasses =\n color === 'dimmed'\n ? 'text-[var(--malachite-text-dimmed)] hover:text-[var(--malachite-text-primary)]'\n : 'text-[var(--malachite-text-link-foreground)] hover:text-[var(--malachite-text-link-foreground-hover)]';\n\n const fontSizeClasses = getFontSizeClass(size);\n\n return (\n <a\n href={href}\n target={target}\n rel={rel}\n className={`${underline ? 'underline' : 'no-underline'} rounded-xs cursor-pointer transition-colors duration-200 ease-in-out ${FOCUS_RING} ${colorClasses} ${fontSizeClasses} ${className}`}\n >\n {children}\n </a>\n );\n};\n\nexport default Link;\n\n"],"names":["getFontSizeClass","size","Link","children","href","target","rel","className","color","underline","colorClasses","fontSizeClasses","jsx","FOCUS_RING"],"mappings":";;AAeA,MAAMA,IAAmB,CAACC,MAA4B;AAClD,MAAI,CAACA,EAAM,QAAO;AAClB,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAEaC,IAA4B,CAAC;AAAA,EACtC,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,KAAAC,IAAM;AAAA,EACN,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ;AAAA,EACR,MAAAP;AAAA,EACA,WAAAQ,IAAY;AAChB,MAAM;AACF,QAAMC,IACFF,MAAU,WACJ,mFACA,yGAEJG,IAAkBX,EAAiBC,CAAI;AAE7C,SACI,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAAR;AAAA,MACA,QAAAC;AAAA,MACA,KAAAC;AAAA,MACA,WAAW,GAAGG,IAAY,cAAc,cAAc,yEAAyEI,CAAU,IAAIH,CAAY,IAAIC,CAAe,IAAIJ,CAAS;AAAA,MAExL,UAAAJ;AAAA,IAAA;AAAA,EAAA;AAGb;"}
1
+ {"version":3,"file":"Link.js","sources":["../../src/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport type { RenderLink } from './PageLayout/types';\nimport type { FontSize } from './Typography/Text';\nimport { FOCUS_RING } from './focusRing';\nimport { isRootRelative } from './safeHref';\n\nexport interface LinkProps {\n href: string;\n target?: '_blank' | '_self' | '_parent' | '_top';\n rel?: string;\n children: React.ReactNode;\n className?: string;\n color?: 'default' | 'dimmed';\n size?: FontSize;\n underline?: boolean;\n onClick?: React.MouseEventHandler<HTMLAnchorElement>;\n /** Renders a root-relative href through the app's router instead of a new-tab anchor, without `target` or `rel`. Other hrefs keep the anchor. */\n renderLink?: RenderLink;\n}\n\nconst getFontSizeClass = (size?: FontSize): string => {\n if (!size) return '';\n switch (size) {\n case 'xsmall':\n return 'text-[length:var(--malachite-font-size-xsmall)]';\n case 'small':\n return 'text-[length:var(--malachite-font-size-small)]';\n case 'medium':\n return 'text-[length:var(--malachite-font-size-medium)]';\n case 'large':\n return 'text-[length:var(--malachite-font-size-large)]';\n case 'xlarge':\n return 'text-[length:var(--malachite-font-size-xlarge)]';\n case 'xxlarge':\n return 'text-[length:var(--malachite-font-size-xxlarge)]';\n default:\n return '';\n }\n};\n\nexport const Link: React.FC<LinkProps> = ({\n children,\n href,\n target = '_blank',\n rel = 'noopener noreferrer',\n className = '',\n color = 'default',\n size,\n underline = true,\n onClick,\n renderLink,\n}) => {\n const colorClasses =\n color === 'dimmed'\n ? 'text-[var(--malachite-text-dimmed)] hover:text-[var(--malachite-text-primary)]'\n : 'text-[var(--malachite-text-link-foreground)] hover:text-[var(--malachite-text-link-foreground-hover)]';\n\n const fontSizeClasses = getFontSizeClass(size);\n const classes = `${underline ? 'underline' : 'no-underline'} rounded-xs cursor-pointer transition-colors duration-200 ease-in-out ${FOCUS_RING} ${colorClasses} ${fontSizeClasses} ${className}`;\n\n if (renderLink && isRootRelative(href)) {\n return renderLink({ href, className: classes, children, ...(onClick ? { onClick } : {}) });\n }\n\n return (\n <a href={href} target={target} rel={rel} className={classes} onClick={onClick}>\n {children}\n </a>\n );\n};\n\nexport default Link;\n"],"names":["getFontSizeClass","size","Link","children","href","target","rel","className","color","underline","onClick","renderLink","colorClasses","fontSizeClasses","classes","FOCUS_RING","isRootRelative","jsx"],"mappings":";;;AAoBA,MAAMA,IAAmB,CAACC,MAA4B;AAClD,MAAI,CAACA,EAAM,QAAO;AAClB,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAEaC,IAA4B,CAAC;AAAA,EACtC,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,KAAAC,IAAM;AAAA,EACN,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ;AAAA,EACR,MAAAP;AAAA,EACA,WAAAQ,IAAY;AAAA,EACZ,SAAAC;AAAA,EACA,YAAAC;AACJ,MAAM;AACF,QAAMC,IACFJ,MAAU,WACJ,mFACA,yGAEJK,IAAkBb,EAAiBC,CAAI,GACvCa,IAAU,GAAGL,IAAY,cAAc,cAAc,yEAAyEM,CAAU,IAAIH,CAAY,IAAIC,CAAe,IAAIN,CAAS;AAE9L,SAAII,KAAcK,EAAeZ,CAAI,IAC1BO,EAAW,EAAE,MAAAP,GAAM,WAAWU,GAAS,UAAAX,GAAU,GAAIO,IAAU,EAAE,SAAAA,EAAA,IAAY,CAAA,GAAK,IAIzF,gBAAAO,EAAC,OAAE,MAAAb,GAAY,QAAAC,GAAgB,KAAAC,GAAU,WAAWQ,GAAS,SAAAJ,GACxD,UAAAP,GACL;AAER;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/PageLayout/index.tsx"],"sourcesContent":["import Empty from './emptyLayout';\nimport Regular from './regularLayout';\n\nexport const PageLayout = { Regular, Empty };\n\nexport default PageLayout;\nexport type { BreadcrumbLink, PageAction, RenderLink } from './types';\nexport { PageActions } from './regularLayout';\nexport type { PageContentGap, RegularLayoutProps } from './regularLayout';\nexport type { EmptyLayoutProps } from './emptyLayout';\n"],"names":["PageLayout","Regular","Empty"],"mappings":";;;AAGO,MAAMA,IAAa,EAAA,SAAEC,UAASC,EAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/PageLayout/index.tsx"],"sourcesContent":["import Empty from './emptyLayout';\nimport Regular from './regularLayout';\n\nexport const PageLayout = { Regular, Empty };\n\nexport default PageLayout;\nexport type { BreadcrumbLink, PageAction, RenderLink } from './types';\nexport { PageActions } from './regularLayout';\nexport type { PageContentGap, PageContentWidth, RegularLayoutProps } from './regularLayout';\nexport type { EmptyLayoutProps } from './emptyLayout';\n"],"names":["PageLayout","Regular","Empty"],"mappings":";;;AAGO,MAAMA,IAAa,EAAA,SAAEC,UAASC,EAAA;"}
@@ -1,47 +1,49 @@
1
- import { jsx as l, jsxs as s } from "react/jsx-runtime";
2
- import $ from "../ActionMenu.js";
3
- import { Alert as D } from "../Alert.js";
4
- import { Breadcrumbs as O } from "../Breadcrumbs.js";
5
- import { hasBackButton as M } from "../breadcrumbsNav.js";
6
- import { Button as u } from "../Button.js";
7
- import P from "../OverflowRow.js";
1
+ import { jsx as l, jsxs as n, Fragment as P } from "react/jsx-runtime";
2
+ import j from "../ActionMenu.js";
3
+ import { Alert as G } from "../Alert.js";
4
+ import { Breadcrumbs as L } from "../Breadcrumbs.js";
5
+ import { hasBackButton as z } from "../breadcrumbsNav.js";
6
+ import { Button as U } from "../Button.js";
7
+ import V from "../OverflowRow.js";
8
8
  import h from "../Skeleton.js";
9
- import j from "../Typography/PageTitle.js";
10
- import N from "../Typography/Text.js";
11
- import { safeHref as y } from "../safeHref.js";
12
- import { CARD_MIN_HEIGHT as G, CARD_RADIUS as L, CARD_CLASSES as z, HEADER_HEIGHT as U, DIVIDER_CLASSES as x, CONTENT_MIN_HEIGHT as V, CONTENT_INSET_VAR as K } from "./constants.js";
13
- const q = {
9
+ import F from "../Typography/PageTitle.js";
10
+ import I from "../Typography/Text.js";
11
+ import { safeHref as E } from "../safeHref.js";
12
+ import { CARD_MIN_HEIGHT as K, CARD_RADIUS as W, CARD_CLASSES as q, HEADER_HEIGHT as J, DIVIDER_CLASSES as w, CONTENT_MIN_HEIGHT as Q, CONTENT_INSET_VAR as T } from "./constants.js";
13
+ const X = {
14
+ narrow: 520
15
+ }, _ = {
14
16
  small: 8,
15
17
  medium: 16,
16
18
  large: 24,
17
19
  xlarge: 40
18
- }, F = (a) => a.variant === "destructive" || a.variant === "error", J = (a) => a.flatMap((e, r) => {
19
- const i = y(e.href), c = {
20
+ }, Y = (a) => a.variant === "destructive" || a.variant === "error", Z = (a) => a.flatMap((e, r) => {
21
+ const i = E(e.href), c = {
20
22
  key: `${r}-${e.label}`,
21
23
  label: e.label,
22
24
  ...i ? { href: i, target: e.target ?? "_blank" } : { onClick: e.onClick },
23
25
  disabled: e.disabled,
24
26
  icon: e.icon,
25
27
  tooltip: e.tooltip,
26
- danger: F(e)
28
+ danger: Y(e)
27
29
  };
28
30
  return e.dividerBefore && r > 0 ? [{ type: "divider", key: `divider-${r}-${e.label}` }, c] : [c];
29
- }), Q = ({ buttons: a }) => a.length === 0 ? null : /* @__PURE__ */ l("div", { className: "min-w-0", children: /* @__PURE__ */ l(
30
- P,
31
+ }), b = ({ buttons: a }) => a.length === 0 ? null : /* @__PURE__ */ l("div", { className: "min-w-0", children: /* @__PURE__ */ l(
32
+ V,
31
33
  {
32
34
  gap: 8,
33
35
  justify: "end",
34
36
  renderOverflow: (e) => /* @__PURE__ */ l(
35
- $,
37
+ j,
36
38
  {
37
- items: J(
39
+ items: Z(
38
40
  a.slice(Math.max(0, a.length - e))
39
41
  )
40
42
  }
41
43
  ),
42
44
  children: a.map((e, r) => {
43
- const i = y(e.href);
44
- return /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
45
+ const i = E(e.href);
46
+ return /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
45
47
  e.dividerBefore && r > 0 ? /* @__PURE__ */ l(
46
48
  "span",
47
49
  {
@@ -50,7 +52,7 @@ const q = {
50
52
  }
51
53
  ) : null,
52
54
  /* @__PURE__ */ l(
53
- u,
55
+ U,
54
56
  {
55
57
  variant: e.variant ?? "filled",
56
58
  size: "medium",
@@ -67,99 +69,106 @@ const q = {
67
69
  ] }, `${r}-${e.label}`);
68
70
  })
69
71
  }
70
- ) }), W = [], X = [], de = ({
71
- breadcrumbLinks: a = W,
72
+ ) }), ee = [], le = [], pe = ({
73
+ breadcrumbLinks: a = ee,
72
74
  breadcrumbActions: e,
73
75
  renderLink: r,
74
76
  title: i,
75
77
  titleSuffix: c,
76
78
  subtitle: t,
77
79
  description: d,
78
- buttons: o = X,
79
- loading: n = !1,
80
- children: I,
80
+ buttons: o = le,
81
+ loading: s = !1,
82
+ children: S,
81
83
  centered: f = !1,
82
84
  noPadding: p = !1,
83
- contentGap: w = "small",
85
+ contentGap: g = "small",
86
+ contentWidth: N,
84
87
  alert: m,
85
- role: _,
86
- "aria-label": T,
87
- "aria-labelledby": E,
88
- className: S = "",
89
- style: k
88
+ role: k,
89
+ "aria-label": C,
90
+ "aria-labelledby": H,
91
+ className: A = "",
92
+ style: B
90
93
  }) => {
91
- const A = M(a), C = p ? 0 : f ? "5vh 14vw" : "40px", H = p ? "0px" : f ? "14vw" : "40px", B = !!(n || i || t || d || o.length > 0), g = t ? n ? /* @__PURE__ */ l(h.Input, { width: 120, height: 24 }) : /* @__PURE__ */ l(N, { color: "secondary", size: "small", children: t }) : null, v = n ? /* @__PURE__ */ l(h.Input, { width: 200, height: 40 }) : i ? /* @__PURE__ */ s("div", { className: "flex items-center", style: { gap: 12 }, children: [
92
- /* @__PURE__ */ l(j, { children: i }),
94
+ const R = z(a), D = p ? 0 : f ? "5vh 14vw" : "40px", O = p ? "0px" : f ? "14vw" : "40px", $ = !!(s || i || t || d || o.length > 0), v = t ? s ? /* @__PURE__ */ l(h.Input, { width: 120, height: 24 }) : /* @__PURE__ */ l(I, { color: "secondary", size: "small", children: t }) : null, x = s ? /* @__PURE__ */ l(h.Input, { width: 200, height: 40 }) : i ? /* @__PURE__ */ n("div", { className: "flex items-center", style: { gap: 12 }, children: [
95
+ /* @__PURE__ */ l(F, { children: i }),
93
96
  c
94
- ] }) : null, R = d ? n ? /* @__PURE__ */ l(h.Input, { width: 120, height: 24 }) : /* @__PURE__ */ l(N, { color: "secondary", style: { lineHeight: 1.6 }, children: d }) : null;
95
- return /* @__PURE__ */ s(
97
+ ] }) : null, u = d ? s ? /* @__PURE__ */ l(h.Input, { width: 120, height: 24 }) : /* @__PURE__ */ l(I, { color: "secondary", style: { lineHeight: 1.6 }, children: d }) : null, M = $ ? /* @__PURE__ */ n("div", { className: "flex flex-col", style: { gap: 12 }, children: [
98
+ x || v || o.length > 0 ? /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center justify-between", style: { gap: 12 }, children: [
99
+ /* @__PURE__ */ n(
100
+ "div",
101
+ {
102
+ className: "flex flex-col flex-auto min-w-0 overflow-hidden",
103
+ style: { gap: 4 },
104
+ children: [
105
+ v,
106
+ x
107
+ ]
108
+ }
109
+ ),
110
+ s ? null : /* @__PURE__ */ l(b, { buttons: o })
111
+ ] }) : null,
112
+ u
113
+ ] }) : null, y = /* @__PURE__ */ n(P, { children: [
114
+ M,
115
+ S
116
+ ] });
117
+ return /* @__PURE__ */ n(
96
118
  "main",
97
119
  {
98
- className: `${z} ${S}`,
99
- style: { borderRadius: L, minHeight: G, ...k },
100
- role: _,
101
- "aria-label": T,
102
- "aria-labelledby": E,
103
- "aria-busy": n || void 0,
120
+ className: `${q} ${A}`,
121
+ style: { borderRadius: W, minHeight: K, ...B },
122
+ role: k,
123
+ "aria-label": C,
124
+ "aria-labelledby": H,
125
+ "aria-busy": s || void 0,
104
126
  children: [
105
127
  /* @__PURE__ */ l(
106
128
  "div",
107
129
  {
108
- className: `flex items-center ${x}`,
130
+ className: `flex items-center ${w}`,
109
131
  style: {
110
- height: U,
111
- paddingInlineStart: A ? 16 : 28,
132
+ height: J,
133
+ paddingInlineStart: R ? 16 : 28,
112
134
  paddingInlineEnd: 16
113
135
  },
114
136
  children: /* @__PURE__ */ l(
115
- O,
137
+ L,
116
138
  {
117
139
  links: a,
118
140
  actions: e,
119
141
  renderLink: r,
142
+ titleElement: i && !s ? void 0 : "h1",
120
143
  className: "flex-1 min-w-0"
121
144
  }
122
145
  )
123
146
  }
124
147
  ),
125
- m ? /* @__PURE__ */ l("div", { className: x, style: { padding: "10px 16px" }, children: /* @__PURE__ */ l(D, { message: m.message, type: m.type, hasMargin: !1 }) }) : null,
126
- /* @__PURE__ */ s(
148
+ m ? /* @__PURE__ */ l("div", { className: w, style: { padding: "10px 16px" }, children: /* @__PURE__ */ l(G, { message: m.message, type: m.type, hasMargin: !1 }) }) : null,
149
+ /* @__PURE__ */ l(
127
150
  "div",
128
151
  {
129
152
  className: "flex flex-col",
130
153
  style: {
131
- padding: C,
132
- minHeight: V,
133
- gap: q[w],
134
- [K]: H
154
+ padding: D,
155
+ minHeight: Q,
156
+ gap: _[g],
157
+ [T]: O
135
158
  },
136
- children: [
137
- B ? /* @__PURE__ */ s("div", { className: "flex flex-col", style: { gap: 12 }, children: [
138
- v || g || o.length > 0 ? /* @__PURE__ */ s(
139
- "div",
140
- {
141
- className: "flex flex-wrap items-center justify-between",
142
- style: { gap: 12 },
143
- children: [
144
- /* @__PURE__ */ s(
145
- "div",
146
- {
147
- className: "flex flex-col flex-auto min-w-0 overflow-hidden",
148
- style: { gap: 4 },
149
- children: [
150
- g,
151
- v
152
- ]
153
- }
154
- ),
155
- n ? null : /* @__PURE__ */ l(Q, { buttons: o })
156
- ]
157
- }
158
- ) : null,
159
- R
160
- ] }) : null,
161
- I
162
- ]
159
+ children: N ? /* @__PURE__ */ l(
160
+ "div",
161
+ {
162
+ className: "flex flex-col flex-1 w-full",
163
+ style: {
164
+ maxWidth: X[N],
165
+ marginInline: "auto",
166
+ gap: _[g],
167
+ [T]: "0px"
168
+ },
169
+ children: y
170
+ }
171
+ ) : y
163
172
  }
164
173
  )
165
174
  ]
@@ -167,8 +176,8 @@ const q = {
167
176
  );
168
177
  };
169
178
  export {
170
- Q as PageActions,
171
- de as RegularLayout,
172
- de as default
179
+ b as PageActions,
180
+ pe as RegularLayout,
181
+ pe as default
173
182
  };
174
183
  //# sourceMappingURL=regularLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"regularLayout.js","sources":["../../../src/components/PageLayout/regularLayout.tsx"],"sourcesContent":["import React from 'react';\nimport ActionMenu, { type ActionMenuItem } from '../ActionMenu';\nimport Alert, { type AlertType } from '../Alert';\nimport Breadcrumbs from '../Breadcrumbs';\nimport { hasBackButton } from '../breadcrumbsNav';\nimport Button from '../Button';\nimport OverflowRow from '../OverflowRow';\nimport Skeleton from '../Skeleton';\nimport PageTitle from '../Typography/PageTitle';\nimport Text from '../Typography/Text';\nimport { safeHref } from '../safeHref';\nimport {\n CARD_CLASSES,\n CARD_MIN_HEIGHT,\n CARD_RADIUS,\n CONTENT_INSET_VAR,\n CONTENT_MIN_HEIGHT,\n DIVIDER_CLASSES,\n HEADER_HEIGHT,\n} from './constants';\nimport type { BreadcrumbLink, PageAction, RenderLink } from './types';\n\nexport type PageContentGap = 'small' | 'medium' | 'large' | 'xlarge';\n\nexport interface RegularLayoutProps {\n breadcrumbLinks?: BreadcrumbLink[];\n breadcrumbActions?: PageAction[];\n renderLink?: RenderLink;\n title?: React.ReactNode;\n titleSuffix?: React.ReactNode;\n subtitle?: string;\n description?: React.ReactNode;\n buttons?: PageAction[];\n /**\n * Hides the buttons and skeletons the title. `subtitle` and `description` are only\n * skeletoned when those props are also passed.\n */\n loading?: boolean;\n children: React.ReactNode;\n centered?: boolean;\n noPadding?: boolean;\n contentGap?: PageContentGap;\n alert?: { message: string; type?: AlertType };\n /** Demotes the default `main` landmark — pass e.g. `region` when the app owns its own. */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst CONTENT_GAPS: Record<PageContentGap, number> = {\n small: 8,\n medium: 16,\n large: 24,\n xlarge: 40,\n};\n\nconst isDanger = (button: PageAction): boolean =>\n button.variant === 'destructive' || button.variant === 'error';\n\nconst toMenuItems = (buttons: PageAction[]): ActionMenuItem[] =>\n buttons.flatMap((button, index) => {\n const href = safeHref(button.href);\n const item: ActionMenuItem = {\n key: `${index}-${button.label}`,\n label: button.label,\n ...(href ? { href, target: button.target ?? '_blank' } : { onClick: button.onClick }),\n disabled: button.disabled,\n icon: button.icon,\n tooltip: button.tooltip,\n danger: isDanger(button),\n };\n return button.dividerBefore && index > 0\n ? [{ type: 'divider' as const, key: `divider-${index}-${button.label}` }, item]\n : [item];\n });\n\n// Not `ActionBar`: it measures by walking ancestors for `clientWidth`, and this chrome\n// mounts on every page. OverflowRow batches its measurement instead.\n// A divider must live in the same OverflowRow child as its button — a standalone child\n// would survive its hidden button and break the child-index-to-button mapping.\n/**\n * The page's action buttons, collapsing into an overflow menu as the row narrows. Exported so\n * a page that renders its own header block — e.g. one that scrolls the title away — keeps the\n * same behaviour instead of hand-rolling `buttons.map(...)` and losing the collapse, the\n * dividers and the href handling.\n */\nexport const PageActions: React.FC<{ buttons: PageAction[] }> = ({ buttons }) => {\n if (buttons.length === 0) {\n return null;\n }\n\n // min-w-0 gives OverflowRow a shrinkable container to collapse against.\n return (\n <div className=\"min-w-0\">\n <OverflowRow\n gap={8}\n justify=\"end\"\n renderOverflow={(hiddenCount) => (\n <ActionMenu\n items={toMenuItems(\n buttons.slice(Math.max(0, buttons.length - hiddenCount)),\n )}\n />\n )}\n >\n {buttons.map((button, index) => {\n const href = safeHref(button.href);\n return (\n <div key={`${index}-${button.label}`} className=\"flex items-center gap-2\">\n {button.dividerBefore && index > 0 ? (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-px bg-[var(--malachite-card-border)]\"\n />\n ) : null}\n <Button\n variant={button.variant ?? 'filled'}\n size=\"medium\"\n disabled={button.disabled}\n icon={button.icon}\n tooltip={button.tooltip}\n tooltipPlacement={button.tooltipPlacement}\n href={href}\n target={href ? (button.target ?? '_blank') : undefined}\n onClick={href ? undefined : button.onClick}\n >\n {button.label}\n </Button>\n </div>\n );\n })}\n </OverflowRow>\n </div>\n );\n};\n\nconst NO_LINKS: BreadcrumbLink[] = [];\nconst NO_BUTTONS: PageAction[] = [];\n\nconst RegularLayout: React.FC<RegularLayoutProps> = ({\n breadcrumbLinks = NO_LINKS,\n breadcrumbActions,\n renderLink,\n title,\n titleSuffix,\n subtitle,\n description,\n buttons = NO_BUTTONS,\n loading = false,\n children,\n centered = false,\n noPadding = false,\n contentGap = 'small',\n alert,\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}) => {\n const hasBack = hasBackButton(breadcrumbLinks);\n const contentPadding = noPadding ? 0 : centered ? '5vh 14vw' : '40px';\n // Published so a full-bleed child (CardStrip's bottom rule) can cancel it and re-apply\n // it as its own padding, instead of hardcoding the gutter at the call site.\n const contentInset = noPadding ? '0px' : centered ? '14vw' : '40px';\n const hasHeaderBlock = Boolean(\n loading || title || subtitle || description || buttons.length > 0,\n );\n\n const subtitleNode = subtitle ? (\n loading ? (\n <Skeleton.Input width={120} height={24} />\n ) : (\n <Text color=\"secondary\" size=\"small\">\n {subtitle}\n </Text>\n )\n ) : null;\n\n const titleNode = loading ? (\n <Skeleton.Input width={200} height={40} />\n ) : title ? (\n <div className=\"flex items-center\" style={{ gap: 12 }}>\n <PageTitle>{title}</PageTitle>\n {titleSuffix}\n </div>\n ) : null;\n\n const descriptionNode = description ? (\n loading ? (\n <Skeleton.Input width={120} height={24} />\n ) : (\n <Text color=\"secondary\" style={{ lineHeight: 1.6 }}>\n {description}\n </Text>\n )\n ) : null;\n\n return (\n <main\n className={`${CARD_CLASSES} ${className}`}\n style={{ borderRadius: CARD_RADIUS, minHeight: CARD_MIN_HEIGHT, ...style }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-busy={loading || undefined}\n >\n <div\n className={`flex items-center ${DIVIDER_CLASSES}`}\n style={{\n height: HEADER_HEIGHT,\n paddingInlineStart: hasBack ? 16 : 28,\n paddingInlineEnd: 16,\n }}\n >\n <Breadcrumbs\n links={breadcrumbLinks}\n actions={breadcrumbActions}\n renderLink={renderLink}\n className=\"flex-1 min-w-0\"\n />\n </div>\n\n {alert ? (\n <div className={DIVIDER_CLASSES} style={{ padding: '10px 16px' }}>\n <Alert message={alert.message} type={alert.type} hasMargin={false} />\n </div>\n ) : null}\n\n <div\n className=\"flex flex-col\"\n style={\n {\n padding: contentPadding,\n minHeight: CONTENT_MIN_HEIGHT,\n gap: CONTENT_GAPS[contentGap],\n [CONTENT_INSET_VAR]: contentInset,\n } as React.CSSProperties\n }\n >\n {hasHeaderBlock ? (\n <div className=\"flex flex-col\" style={{ gap: 12 }}>\n {titleNode || subtitleNode || buttons.length > 0 ? (\n <div\n className=\"flex flex-wrap items-center justify-between\"\n style={{ gap: 12 }}\n >\n <div\n className=\"flex flex-col flex-auto min-w-0 overflow-hidden\"\n style={{ gap: 4 }}\n >\n {subtitleNode}\n {titleNode}\n </div>\n {loading ? null : <PageActions buttons={buttons} />}\n </div>\n ) : null}\n {descriptionNode}\n </div>\n ) : null}\n {children}\n </div>\n </main>\n );\n};\n\nexport default RegularLayout;\nexport { RegularLayout };\n"],"names":["CONTENT_GAPS","isDanger","button","toMenuItems","buttons","index","href","safeHref","item","PageActions","jsx","OverflowRow","hiddenCount","ActionMenu","jsxs","Button","NO_LINKS","NO_BUTTONS","RegularLayout","breadcrumbLinks","breadcrumbActions","renderLink","title","titleSuffix","subtitle","description","loading","children","centered","noPadding","contentGap","alert","role","ariaLabel","ariaLabelledBy","className","style","hasBack","hasBackButton","contentPadding","contentInset","hasHeaderBlock","subtitleNode","Skeleton","Text","titleNode","PageTitle","descriptionNode","CARD_CLASSES","CARD_RADIUS","CARD_MIN_HEIGHT","DIVIDER_CLASSES","HEADER_HEIGHT","Breadcrumbs","Alert","CONTENT_MIN_HEIGHT","CONTENT_INSET_VAR"],"mappings":";;;;;;;;;;;;AAmDA,MAAMA,IAA+C;AAAA,EACjD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AACZ,GAEMC,IAAW,CAACC,MACdA,EAAO,YAAY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IAAO,EAAA,CACvE,IACA;AAAA,QAEJ,gBAAAjB;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAU;AAAA,YACV,OACI;AAAA,cACI,SAASyB;AAAA,cACT,WAAWgB;AAAA,cACX,KAAKvD,EAAa8B,CAAU;AAAA,cAC5B,CAAC0B,CAAiB,GAAGhB;AAAA,YAAA;AAAA,YAI5B,UAAA;AAAA,cAAAC,IACG,gBAAA3B,EAAC,SAAI,WAAU,iBAAgB,OAAO,EAAE,KAAK,MACxC,UAAA;AAAA,gBAAA+B,KAAaH,KAAgBtC,EAAQ,SAAS,IAC3C,gBAAAU;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACG,WAAU;AAAA,oBACV,OAAO,EAAE,KAAK,GAAA;AAAA,oBAEd,UAAA;AAAA,sBAAA,gBAAAA;AAAA,wBAAC;AAAA,wBAAA;AAAA,0BACG,WAAU;AAAA,0BACV,OAAO,EAAE,KAAK,EAAA;AAAA,0BAEb,UAAA;AAAA,4BAAA4B;AAAA,4BACAG;AAAA,0BAAA;AAAA,wBAAA;AAAA,sBAAA;AAAA,sBAEJnB,IAAU,OAAO,gBAAAhB,EAACD,GAAA,EAAY,SAAAL,EAAA,CAAkB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA,IAErD;AAAA,gBACH2C;AAAA,cAAA,EAAA,CACL,IACA;AAAA,cACHpB;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACL;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
1
+ {"version":3,"file":"regularLayout.js","sources":["../../../src/components/PageLayout/regularLayout.tsx"],"sourcesContent":["import React from 'react';\nimport ActionMenu, { type ActionMenuItem } from '../ActionMenu';\nimport Alert, { type AlertType } from '../Alert';\nimport Breadcrumbs from '../Breadcrumbs';\nimport { hasBackButton } from '../breadcrumbsNav';\nimport Button from '../Button';\nimport OverflowRow from '../OverflowRow';\nimport Skeleton from '../Skeleton';\nimport PageTitle from '../Typography/PageTitle';\nimport Text from '../Typography/Text';\nimport { safeHref } from '../safeHref';\nimport {\n CARD_CLASSES,\n CARD_MIN_HEIGHT,\n CARD_RADIUS,\n CONTENT_INSET_VAR,\n CONTENT_MIN_HEIGHT,\n DIVIDER_CLASSES,\n HEADER_HEIGHT,\n} from './constants';\nimport type { BreadcrumbLink, PageAction, RenderLink } from './types';\n\nexport type PageContentGap = 'small' | 'medium' | 'large' | 'xlarge';\n\nexport type PageContentWidth = 'narrow';\n\nexport interface RegularLayoutProps {\n breadcrumbLinks?: BreadcrumbLink[];\n breadcrumbActions?: PageAction[];\n renderLink?: RenderLink;\n title?: React.ReactNode;\n titleSuffix?: React.ReactNode;\n subtitle?: string;\n description?: React.ReactNode;\n buttons?: PageAction[];\n /**\n * Hides the buttons and skeletons the title. `subtitle` and `description` are only\n * skeletoned when those props are also passed.\n */\n loading?: boolean;\n children: React.ReactNode;\n centered?: boolean;\n noPadding?: boolean;\n contentGap?: PageContentGap;\n /** Caps the content column and centres it; `narrow` fits a single-column form. */\n contentWidth?: PageContentWidth;\n alert?: { message: string; type?: AlertType };\n /** Demotes the default `main` landmark — pass e.g. `region` when the app owns its own. */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst CONTENT_WIDTHS: Record<PageContentWidth, number> = {\n narrow: 520,\n};\n\nconst CONTENT_GAPS: Record<PageContentGap, number> = {\n small: 8,\n medium: 16,\n large: 24,\n xlarge: 40,\n};\n\nconst isDanger = (button: PageAction): boolean =>\n button.variant === 'destructive' || button.variant === 'error';\n\nconst toMenuItems = (buttons: PageAction[]): ActionMenuItem[] =>\n buttons.flatMap((button, index) => {\n const href = safeHref(button.href);\n const item: ActionMenuItem = {\n key: `${index}-${button.label}`,\n label: button.label,\n ...(href ? { href, target: button.target ?? '_blank' } : { onClick: button.onClick }),\n disabled: button.disabled,\n icon: button.icon,\n tooltip: button.tooltip,\n danger: isDanger(button),\n };\n return button.dividerBefore && index > 0\n ? [{ type: 'divider' as const, key: `divider-${index}-${button.label}` }, item]\n : [item];\n });\n\n// Not `ActionBar`: it measures by walking ancestors for `clientWidth`, and this chrome\n// mounts on every page. OverflowRow batches its measurement instead.\n// A divider must live in the same OverflowRow child as its button — a standalone child\n// would survive its hidden button and break the child-index-to-button mapping.\n/**\n * The page's action buttons, collapsing into an overflow menu as the row narrows. Exported so\n * a page that renders its own header block — e.g. one that scrolls the title away — keeps the\n * same behaviour instead of hand-rolling `buttons.map(...)` and losing the collapse, the\n * dividers and the href handling.\n */\nexport const PageActions: React.FC<{ buttons: PageAction[] }> = ({ buttons }) => {\n if (buttons.length === 0) {\n return null;\n }\n\n // min-w-0 gives OverflowRow a shrinkable container to collapse against.\n return (\n <div className=\"min-w-0\">\n <OverflowRow\n gap={8}\n justify=\"end\"\n renderOverflow={(hiddenCount) => (\n <ActionMenu\n items={toMenuItems(\n buttons.slice(Math.max(0, buttons.length - hiddenCount)),\n )}\n />\n )}\n >\n {buttons.map((button, index) => {\n const href = safeHref(button.href);\n return (\n <div key={`${index}-${button.label}`} className=\"flex items-center gap-2\">\n {button.dividerBefore && index > 0 ? (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-px bg-[var(--malachite-card-border)]\"\n />\n ) : null}\n <Button\n variant={button.variant ?? 'filled'}\n size=\"medium\"\n disabled={button.disabled}\n icon={button.icon}\n tooltip={button.tooltip}\n tooltipPlacement={button.tooltipPlacement}\n href={href}\n target={href ? (button.target ?? '_blank') : undefined}\n onClick={href ? undefined : button.onClick}\n >\n {button.label}\n </Button>\n </div>\n );\n })}\n </OverflowRow>\n </div>\n );\n};\n\nconst NO_LINKS: BreadcrumbLink[] = [];\nconst NO_BUTTONS: PageAction[] = [];\n\nconst RegularLayout: React.FC<RegularLayoutProps> = ({\n breadcrumbLinks = NO_LINKS,\n breadcrumbActions,\n renderLink,\n title,\n titleSuffix,\n subtitle,\n description,\n buttons = NO_BUTTONS,\n loading = false,\n children,\n centered = false,\n noPadding = false,\n contentGap = 'small',\n contentWidth,\n alert,\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}) => {\n const hasBack = hasBackButton(breadcrumbLinks);\n const contentPadding = noPadding ? 0 : centered ? '5vh 14vw' : '40px';\n // Published so a full-bleed child (CardStrip's bottom rule) can cancel it and re-apply\n // it as its own padding, instead of hardcoding the gutter at the call site.\n const contentInset = noPadding ? '0px' : centered ? '14vw' : '40px';\n const hasHeaderBlock = Boolean(\n loading || title || subtitle || description || buttons.length > 0,\n );\n\n const subtitleNode = subtitle ? (\n loading ? (\n <Skeleton.Input width={120} height={24} />\n ) : (\n <Text color=\"secondary\" size=\"small\">\n {subtitle}\n </Text>\n )\n ) : null;\n\n const titleNode = loading ? (\n <Skeleton.Input width={200} height={40} />\n ) : title ? (\n <div className=\"flex items-center\" style={{ gap: 12 }}>\n <PageTitle>{title}</PageTitle>\n {titleSuffix}\n </div>\n ) : null;\n\n const descriptionNode = description ? (\n loading ? (\n <Skeleton.Input width={120} height={24} />\n ) : (\n <Text color=\"secondary\" style={{ lineHeight: 1.6 }}>\n {description}\n </Text>\n )\n ) : null;\n\n const headerBlock = hasHeaderBlock ? (\n <div className=\"flex flex-col\" style={{ gap: 12 }}>\n {titleNode || subtitleNode || buttons.length > 0 ? (\n <div className=\"flex flex-wrap items-center justify-between\" style={{ gap: 12 }}>\n <div\n className=\"flex flex-col flex-auto min-w-0 overflow-hidden\"\n style={{ gap: 4 }}\n >\n {subtitleNode}\n {titleNode}\n </div>\n {loading ? null : <PageActions buttons={buttons} />}\n </div>\n ) : null}\n {descriptionNode}\n </div>\n ) : null;\n\n const body = (\n <>\n {headerBlock}\n {children}\n </>\n );\n\n return (\n <main\n className={`${CARD_CLASSES} ${className}`}\n style={{ borderRadius: CARD_RADIUS, minHeight: CARD_MIN_HEIGHT, ...style }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-busy={loading || undefined}\n >\n <div\n className={`flex items-center ${DIVIDER_CLASSES}`}\n style={{\n height: HEADER_HEIGHT,\n paddingInlineStart: hasBack ? 16 : 28,\n paddingInlineEnd: 16,\n }}\n >\n <Breadcrumbs\n links={breadcrumbLinks}\n actions={breadcrumbActions}\n renderLink={renderLink}\n titleElement={title && !loading ? undefined : 'h1'}\n className=\"flex-1 min-w-0\"\n />\n </div>\n\n {alert ? (\n <div className={DIVIDER_CLASSES} style={{ padding: '10px 16px' }}>\n <Alert message={alert.message} type={alert.type} hasMargin={false} />\n </div>\n ) : null}\n\n <div\n className=\"flex flex-col\"\n style={\n {\n padding: contentPadding,\n minHeight: CONTENT_MIN_HEIGHT,\n gap: CONTENT_GAPS[contentGap],\n [CONTENT_INSET_VAR]: contentInset,\n } as React.CSSProperties\n }\n >\n {contentWidth ? (\n <div\n className=\"flex flex-col flex-1 w-full\"\n style={\n {\n maxWidth: CONTENT_WIDTHS[contentWidth],\n marginInline: 'auto',\n gap: CONTENT_GAPS[contentGap],\n [CONTENT_INSET_VAR]: '0px',\n } as React.CSSProperties\n }\n >\n {body}\n </div>\n ) : (\n body\n )}\n </div>\n </main>\n );\n};\n\nexport default RegularLayout;\nexport { RegularLayout };\n"],"names":["CONTENT_WIDTHS","CONTENT_GAPS","isDanger","button","toMenuItems","buttons","index","href","safeHref","item","PageActions","jsx","OverflowRow","hiddenCount","ActionMenu","jsxs","Button","NO_LINKS","NO_BUTTONS","RegularLayout","breadcrumbLinks","breadcrumbActions","renderLink","title","titleSuffix","subtitle","description","loading","children","centered","noPadding","contentGap","contentWidth","alert","role","ariaLabel","ariaLabelledBy","className","style","hasBack","hasBackButton","contentPadding","contentInset","hasHeaderBlock","subtitleNode","Skeleton","Text","titleNode","PageTitle","descriptionNode","headerBlock","body","Fragment","CARD_CLASSES","CARD_RADIUS","CARD_MIN_HEIGHT","DIVIDER_CLASSES","HEADER_HEIGHT","Breadcrumbs","Alert","CONTENT_MIN_HEIGHT","CONTENT_INSET_VAR"],"mappings":";;;;;;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C,CAAY;AAAA,kBACrC,cAAc;AAAA,kBACd,KAAK/B,EAAa8B,CAAU;AAAA,kBAC5B,CAAC8B,CAAiB,GAAG;AAAA,gBAAA;AAAA,gBAI5B,UAAAV;AAAA,cAAA;AAAA,YAAA,IAGLA;AAAA,UAAA;AAAA,QAAA;AAAA,MAER;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1,18 +1,18 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import n, { useMemo as s } from "react";
3
- const g = ({
4
- direction: a = "horizontal",
5
- size: c = 8,
6
- children: l,
1
+ import { jsx as x } from "react/jsx-runtime";
2
+ import { useMemo as r } from "react";
3
+ const w = ({
4
+ direction: n = "horizontal",
5
+ size: s = 8,
6
+ children: c,
7
7
  align: e,
8
8
  justifyContent: t,
9
- padding: i,
10
- id: o,
11
- fullHeight: u = !1,
12
- fullWidth: d = !1,
13
- className: f = ""
9
+ padding: a,
10
+ id: l,
11
+ fullHeight: o = !1,
12
+ fullWidth: i = !1,
13
+ className: u = ""
14
14
  }) => {
15
- const h = a === "vertical" ? "column" : "row", m = s(() => {
15
+ const f = n === "vertical" ? "column" : "row", d = r(() => {
16
16
  switch (e) {
17
17
  case "center":
18
18
  return "center";
@@ -27,7 +27,7 @@ const g = ({
27
27
  default:
28
28
  return "center";
29
29
  }
30
- }, [e]), p = s(() => {
30
+ }, [e]), m = r(() => {
31
31
  switch (t) {
32
32
  case "space-between":
33
33
  return "space-between";
@@ -38,26 +38,26 @@ const g = ({
38
38
  default:
39
39
  return "flex-start";
40
40
  }
41
- }, [t]), x = n.Children.toArray(l);
42
- return /* @__PURE__ */ r(
41
+ }, [t]);
42
+ return /* @__PURE__ */ x(
43
43
  "div",
44
44
  {
45
- id: o,
46
- className: `flex ${f}`.trim(),
45
+ id: l,
46
+ className: `flex ${u}`.trim(),
47
47
  style: {
48
- flexDirection: h,
49
- alignItems: m,
50
- justifyContent: p,
51
- gap: `${c}px`,
52
- padding: i,
53
- height: u ? "100%" : void 0,
54
- width: d ? "100%" : void 0
48
+ flexDirection: f,
49
+ alignItems: d,
50
+ justifyContent: m,
51
+ gap: `${s}px`,
52
+ padding: a,
53
+ height: o ? "100%" : void 0,
54
+ width: i ? "100%" : void 0
55
55
  },
56
- children: x.map((w, y) => /* @__PURE__ */ r(n.Fragment, { children: w }, y))
56
+ children: c
57
57
  }
58
58
  );
59
59
  };
60
60
  export {
61
- g as default
61
+ w as default
62
62
  };
63
63
  //# sourceMappingURL=Spacer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Spacer.js","sources":["../../src/components/Spacer.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\n\ninterface SpacerProps {\n direction?: 'horizontal' | 'vertical';\n size?: number;\n align?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';\n justifyContent?: 'space-between' | 'end' | 'center';\n padding?: string;\n children: React.ReactNode;\n id?: string;\n fullHeight?: boolean;\n fullWidth?: boolean;\n className?: string;\n}\n\nconst Spacer: React.FC<SpacerProps> = ({\n direction = 'horizontal',\n size = 8,\n children,\n align,\n justifyContent,\n padding,\n id,\n fullHeight = false,\n fullWidth = false,\n className = '',\n}) => {\n const flexDirection = direction === 'vertical' ? 'column' : 'row';\n\n const alignItems = useMemo(() => {\n switch (align) {\n case 'center':\n return 'center';\n case 'start':\n return 'flex-start';\n case 'end':\n return 'flex-end';\n case 'baseline':\n return 'baseline';\n case 'stretch':\n return 'stretch';\n default:\n return 'center';\n }\n }, [align]);\n\n const justifyContentStyle = useMemo(() => {\n switch (justifyContent) {\n case 'space-between':\n return 'space-between';\n case 'center':\n return 'center';\n case 'end':\n return 'flex-end';\n default:\n return 'flex-start';\n }\n }, [justifyContent]);\n\n const childrenArray = React.Children.toArray(children);\n\n return (\n <div\n id={id}\n className={`flex ${className}`.trim()}\n style={{\n flexDirection,\n alignItems,\n justifyContent: justifyContentStyle,\n gap: `${size}px`,\n padding,\n height: fullHeight ? '100%' : undefined,\n width: fullWidth ? '100%' : undefined,\n }}\n >\n {childrenArray.map((child, index) => (\n <React.Fragment key={index}>{child}</React.Fragment>\n ))}\n </div>\n );\n};\n\nexport default Spacer;\n"],"names":["Spacer","direction","size","children","align","justifyContent","padding","id","fullHeight","fullWidth","className","flexDirection","alignItems","useMemo","justifyContentStyle","childrenArray","React","jsx","child","index"],"mappings":";;AAeA,MAAMA,IAAgC,CAAC;AAAA,EACnC,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,IAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAAgBV,MAAc,aAAa,WAAW,OAEtDW,IAAaC,EAAQ,MAAM;AAC7B,YAAQT,GAAA;AAAA,MACJ,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IAAA;AAAA,EAEnB,GAAG,CAACA,CAAK,CAAC,GAEJU,IAAsBD,EAAQ,MAAM;AACtC,YAAQR,GAAA;AAAA,MACJ,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IAAA;AAAA,EAEnB,GAAG,CAACA,CAAc,CAAC,GAEbU,IAAgBC,EAAM,SAAS,QAAQb,CAAQ;AAErD,SACI,gBAAAc;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,IAAAV;AAAA,MACA,WAAW,QAAQG,CAAS,GAAG,KAAA;AAAA,MAC/B,OAAO;AAAA,QACH,eAAAC;AAAA,QACA,YAAAC;AAAA,QACA,gBAAgBE;AAAA,QAChB,KAAK,GAAGZ,CAAI;AAAA,QACZ,SAAAI;AAAA,QACA,QAAQE,IAAa,SAAS;AAAA,QAC9B,OAAOC,IAAY,SAAS;AAAA,MAAA;AAAA,MAG/B,UAAAM,EAAc,IAAI,CAACG,GAAOC,MACvB,gBAAAF,EAACD,EAAM,UAAN,EAA4B,UAAAE,EAAA,GAARC,CAAc,CACtC;AAAA,IAAA;AAAA,EAAA;AAGb;"}
1
+ {"version":3,"file":"Spacer.js","sources":["../../src/components/Spacer.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\n\ninterface SpacerProps {\n direction?: 'horizontal' | 'vertical';\n size?: number;\n align?: 'center' | 'start' | 'end' | 'baseline' | 'stretch';\n justifyContent?: 'space-between' | 'end' | 'center';\n padding?: string;\n children: React.ReactNode;\n id?: string;\n fullHeight?: boolean;\n fullWidth?: boolean;\n className?: string;\n}\n\nconst Spacer: React.FC<SpacerProps> = ({\n direction = 'horizontal',\n size = 8,\n children,\n align,\n justifyContent,\n padding,\n id,\n fullHeight = false,\n fullWidth = false,\n className = '',\n}) => {\n const flexDirection = direction === 'vertical' ? 'column' : 'row';\n\n const alignItems = useMemo(() => {\n switch (align) {\n case 'center':\n return 'center';\n case 'start':\n return 'flex-start';\n case 'end':\n return 'flex-end';\n case 'baseline':\n return 'baseline';\n case 'stretch':\n return 'stretch';\n default:\n return 'center';\n }\n }, [align]);\n\n const justifyContentStyle = useMemo(() => {\n switch (justifyContent) {\n case 'space-between':\n return 'space-between';\n case 'center':\n return 'center';\n case 'end':\n return 'flex-end';\n default:\n return 'flex-start';\n }\n }, [justifyContent]);\n\n return (\n <div\n id={id}\n className={`flex ${className}`.trim()}\n style={{\n flexDirection,\n alignItems,\n justifyContent: justifyContentStyle,\n gap: `${size}px`,\n padding,\n height: fullHeight ? '100%' : undefined,\n width: fullWidth ? '100%' : undefined,\n }}\n >\n {children}\n </div>\n );\n};\n\nexport default Spacer;\n"],"names":["Spacer","direction","size","children","align","justifyContent","padding","id","fullHeight","fullWidth","className","flexDirection","alignItems","useMemo","justifyContentStyle","jsx"],"mappings":";;AAeA,MAAMA,IAAgC,CAAC;AAAA,EACnC,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,IAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAAgBV,MAAc,aAAa,WAAW,OAEtDW,IAAaC,EAAQ,MAAM;AAC7B,YAAQT,GAAA;AAAA,MACJ,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IAAA;AAAA,EAEnB,GAAG,CAACA,CAAK,CAAC,GAEJU,IAAsBD,EAAQ,MAAM;AACtC,YAAQR,GAAA;AAAA,MACJ,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IAAA;AAAA,EAEnB,GAAG,CAACA,CAAc,CAAC;AAEnB,SACI,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,IAAAR;AAAA,MACA,WAAW,QAAQG,CAAS,GAAG,KAAA;AAAA,MAC/B,OAAO;AAAA,QACH,eAAAC;AAAA,QACA,YAAAC;AAAA,QACA,gBAAgBE;AAAA,QAChB,KAAK,GAAGZ,CAAI;AAAA,QACZ,SAAAI;AAAA,QACA,QAAQE,IAAa,SAAS;AAAA,QAC9B,OAAOC,IAAY,SAAS;AAAA,MAAA;AAAA,MAG/B,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGb;"}
@@ -2,21 +2,22 @@ import { jsx as r, jsxs as a } from "react/jsx-runtime";
2
2
  import b from "marked-react";
3
3
  import d from "react";
4
4
  import { FOCUS_RING_INSET as x, FOCUS_RING as E } from "../focusRing.js";
5
+ import { isRootRelative as k } from "../safeHref.js";
5
6
  import p from "./CodeText.js";
6
- import k from "./PageTitle.js";
7
- import y from "./SectionTitle.js";
8
- import { getInlineMarked as R } from "./inlineMarkdown.js";
9
- import { getFontSize as L, getTextColor as _ } from "./textStyles.js";
10
- const N = "• ", S = {
7
+ import y from "./PageTitle.js";
8
+ import R from "./SectionTitle.js";
9
+ import { getInlineMarked as L } from "./inlineMarkdown.js";
10
+ import { getFontSize as _, getTextColor as N } from "./textStyles.js";
11
+ const S = "• ", T = {
11
12
  color: "inherit",
12
13
  textDecoration: "underline",
13
14
  fontWeight: 600
14
- }, T = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), u = (e) => {
15
+ }, w = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), u = (e) => {
15
16
  if (typeof e != "string")
16
17
  return !1;
17
18
  const i = /^([a-z][a-z0-9+.-]*):/i.exec(e.replace(/[\u0000-\u0020]/g, ""));
18
- return !i || T.has(`${i[1].toLowerCase()}:`);
19
- }, w = (e) => /^\/(?![/\\])[^\t\n\r]*$/.test(e), f = `md-link rounded-xs ${E}`, C = ({
19
+ return !i || w.has(`${i[1].toLowerCase()}:`);
20
+ }, f = `md-link rounded-xs ${E}`, C = ({
20
21
  omitMargin: e,
21
22
  links: i,
22
23
  renderLink: l
@@ -66,7 +67,7 @@ const N = "• ", S = {
66
67
  ) }, this.elementId);
67
68
  },
68
69
  heading(t, n) {
69
- return n === 1 ? /* @__PURE__ */ r(k, { children: t }, this.elementId) : /* @__PURE__ */ r(y, { children: t }, this.elementId);
70
+ return n === 1 ? /* @__PURE__ */ r(y, { children: t }, this.elementId) : /* @__PURE__ */ r(R, { children: t }, this.elementId);
70
71
  },
71
72
  br() {
72
73
  return /* @__PURE__ */ r("br", {}, this.elementId);
@@ -74,7 +75,7 @@ const N = "• ", S = {
74
75
  // `text`/`strong` are deliberately NOT overridden: a wrapping Text emits a font-weight, and
75
76
  // the nested 400 beat strong's 600 — which is why bold never rendered.
76
77
  link(t, n) {
77
- return u(t) ? i === "inert" ? /* @__PURE__ */ r("span", { style: S, children: n }, this.elementId) : l && w(t) ? /* @__PURE__ */ r(d.Fragment, { children: l({ href: t, children: n, className: f }) }, this.elementId) : (
78
+ return u(t) ? i === "inert" ? /* @__PURE__ */ r("span", { style: T, children: n }, this.elementId) : l && k(t) ? /* @__PURE__ */ r(d.Fragment, { children: l({ href: t, children: n, className: f }) }, this.elementId) : (
78
79
  // Hover is in tailwind.css: CLAUDE.md forbids JS for styling, and JS misses keyboard.
79
80
  // FOCUS_RING because a colour change alone is not a focus indicator.
80
81
  /* @__PURE__ */ r(
@@ -191,7 +192,7 @@ const N = "• ", S = {
191
192
  // Index as key: one list node's rendered children never reorder.
192
193
  /* @__PURE__ */ a("span", { role: "listitem", style: { display: "inline" }, children: [
193
194
  /* @__PURE__ */ r("br", {}),
194
- /* @__PURE__ */ r("span", { "aria-hidden": "true", children: i ? `${(l ?? 1) + s}. ` : N }),
195
+ /* @__PURE__ */ r("span", { "aria-hidden": "true", children: i ? `${(l ?? 1) + s}. ` : S }),
195
196
  n
196
197
  ] }, s)
197
198
  )),
@@ -352,8 +353,8 @@ const N = "• ", S = {
352
353
  className: n === "flow" ? "md-root md-flow" : "md-root",
353
354
  style: {
354
355
  display: "contents",
355
- color: _(i ?? "primary"),
356
- fontSize: l === "inherit" ? "inherit" : L(l ?? "small")
356
+ color: N(i ?? "primary"),
357
+ fontSize: l === "inherit" ? "inherit" : _(l ?? "small")
357
358
  },
358
359
  children: /* @__PURE__ */ r(
359
360
  b,
@@ -362,13 +363,13 @@ const N = "• ", S = {
362
363
  renderer: g,
363
364
  isInline: n === "inline",
364
365
  gfm: n !== "inline",
365
- instance: n === "inline" ? R() : void 0
366
+ instance: n === "inline" ? L() : void 0
366
367
  }
367
368
  )
368
369
  }
369
370
  ) : null;
370
- }, ne = d.memo(X);
371
+ }, re = d.memo(X);
371
372
  export {
372
- ne as default
373
+ re as default
373
374
  };
374
375
  //# sourceMappingURL=MarkdownBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownBlock.js","sources":["../../../src/components/Typography/MarkdownBlock.tsx"],"sourcesContent":["import Markdown, { ReactRenderer } from 'marked-react';\nimport React from 'react';\nimport type { RenderLink } from '../PageLayout/types';\nimport { FOCUS_RING, FOCUS_RING_INSET } from '../focusRing';\nimport CodeText from './CodeText';\nimport PageTitle from './PageTitle';\nimport SectionTitle from './SectionTitle';\nimport type { FontSize, TextColor } from './Text';\nimport { getInlineMarked } from './inlineMarkdown';\nimport { getFontSize, getTextColor } from './textStyles';\n\n/** `inline`: one line of inline syntax, with no autolinked emails or URLs. */\nexport type MarkdownVariant = 'block' | 'flow' | 'inline';\n\n/** `inert` draws links without an anchor, for markdown inside a <button>. */\nexport type MarkdownLinks = 'interactive' | 'inert';\n\nexport interface MarkdownProps {\n text: string;\n color?: TextColor;\n size?: FontSize | 'inherit';\n omitMargin?: boolean;\n variant?: MarkdownVariant;\n normalizeSource?: boolean;\n links?: MarkdownLinks;\n /** Renders root-relative links (`/path`) through the app's router, in the same tab. Other\n * links still open in a new tab. Pass a stable function: a new one re-parses the markdown. */\n renderLink?: RenderLink;\n}\n\nconst FLOW_BULLET = '• ';\n\n// Inline, not `md-link`, for portals outside the shadow root; the link token is unreadable on tooltips.\nconst INERT_LINK_STYLE: React.CSSProperties = {\n color: 'inherit',\n textDecoration: 'underline',\n fontWeight: 600,\n};\n\n// Third-party content, and React does not sanitize href — `javascript:` would execute.\nconst ALLOWED_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nconst isSafeHref = (href: unknown): href is string => {\n if (typeof href !== 'string') {\n return false;\n }\n const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(href.replace(/[\\u0000-\\u0020]/g, ''));\n // No scheme means relative or fragment, which has nothing to vet.\n return !scheme || ALLOWED_SCHEMES.has(`${scheme[1].toLowerCase()}:`);\n};\n\n// `//host` and `/\\host` are protocol-relative to a browser, so they leave the app.\n// URL parsing drops tab, CR and LF, so `/\\t/evil.com` would resolve off-site.\nconst isRootRelative = (href: string): boolean => /^\\/(?![/\\\\])[^\\t\\n\\r]*$/.test(href);\n\nconst LINK_CLASSES = `md-link rounded-xs ${FOCUS_RING}`;\n\n// Renderer args are always arrays: never unwrap with `x[0]`, it drops all tokens after the first.\nconst getRendererFunction = ({\n omitMargin,\n links,\n renderLink,\n}: Pick<MarkdownProps, 'omitMargin' | 'links' | 'renderLink'>): Partial<ReactRenderer> => ({\n blockquote(this: ReactRenderer, quote) {\n return (\n <div\n key={this.elementId}\n style={{\n backgroundColor: 'var(--malachite-card-dimmed-background)',\n padding: '20px',\n borderRadius: '20px',\n border: '1px solid var(--malachite-card-border)',\n margin: '16px 0',\n }}\n >\n {quote}\n </div>\n );\n },\n\n paragraph(this: ReactRenderer, text) {\n return (\n <div\n key={this.elementId}\n className=\"md-paragraph\"\n style={{ marginBottom: omitMargin ? '0px' : '16px' }}\n >\n {text}\n </div>\n );\n },\n\n codespan(this: ReactRenderer, code) {\n return (\n <CodeText key={this.elementId} variant=\"inline\">\n {code}\n </CodeText>\n );\n },\n\n code(this: ReactRenderer, code) {\n return (\n <pre key={this.elementId} style={{ margin: omitMargin ? 0 : '16px 0' }}>\n <CodeText\n style={{\n display: 'block',\n whiteSpace: 'pre',\n overflowX: 'auto',\n padding: '12px',\n }}\n >\n {code}\n </CodeText>\n </pre>\n );\n },\n\n heading(this: ReactRenderer, text, level) {\n return level === 1 ? (\n <PageTitle key={this.elementId}>{text}</PageTitle>\n ) : (\n <SectionTitle key={this.elementId}>{text}</SectionTitle>\n );\n },\n\n br(this: ReactRenderer) {\n return <br key={this.elementId} />;\n },\n\n // `text`/`strong` are deliberately NOT overridden: a wrapping Text emits a font-weight, and\n // the nested 400 beat strong's 600 — which is why bold never rendered.\n\n link(this: ReactRenderer, href, children) {\n // Keep the label for a rejected scheme rather than deleting content.\n if (!isSafeHref(href)) {\n return <React.Fragment key={this.elementId}>{children}</React.Fragment>;\n }\n if (links === 'inert') {\n return (\n <span key={this.elementId} style={INERT_LINK_STYLE}>\n {children}\n </span>\n );\n }\n if (renderLink && isRootRelative(href)) {\n return (\n <React.Fragment key={this.elementId}>\n {renderLink({ href, children, className: LINK_CLASSES })}\n </React.Fragment>\n );\n }\n return (\n // Hover is in tailwind.css: CLAUDE.md forbids JS for styling, and JS misses keyboard.\n // FOCUS_RING because a colour change alone is not a focus indicator.\n <a\n key={this.elementId}\n className={LINK_CLASSES}\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {children}\n </a>\n );\n },\n\n // Overridden only to vet `src`. Alt text stands in for a rejected image.\n image(this: ReactRenderer, src, alt, title) {\n if (!isSafeHref(src)) {\n return <span key={this.elementId}>{alt ?? ''}</span>;\n }\n return (\n <img\n key={this.elementId}\n src={src}\n alt={alt ?? ''}\n title={title ?? undefined}\n style={{ maxWidth: '100%' }}\n />\n );\n },\n\n // Scrolls on its own: a wide table in a block of markdown must not widen the column it sits in.\n // Tabbable because Safari won't focus a scroller holding only text, leaving keyboard readers\n // no way to reach the columns off screen.\n table(this: ReactRenderer, children) {\n return (\n <div\n key={this.elementId}\n role=\"group\"\n aria-label=\"Table\"\n tabIndex={0}\n className={FOCUS_RING_INSET}\n style={{ overflowX: 'auto', margin: omitMargin ? 0 : '16px 0' }}\n >\n <table style={{ borderCollapse: 'collapse', minWidth: '100%' }}>{children}</table>\n </div>\n );\n },\n\n tableCell(this: ReactRenderer, children, flags) {\n const Cell = flags.header ? 'th' : 'td';\n return (\n <Cell\n key={this.elementId}\n style={{\n border: '1px solid var(--malachite-card-border)',\n padding: '6px 10px',\n textAlign: flags.align ?? 'left',\n fontWeight: flags.header ? 600 : undefined,\n }}\n >\n {children}\n </Cell>\n );\n },\n\n // Preflight resets list-style/margin/padding; padding-left on the LIST is the hanging indent.\n list(this: ReactRenderer, children, ordered, start) {\n const Tag = ordered ? 'ol' : 'ul';\n return (\n <Tag\n key={this.elementId}\n // Forward `start` or `3. three` silently renumbers from 1.\n start={ordered && start !== 1 ? start : undefined}\n style={{\n listStyle: ordered ? 'decimal' : 'disc',\n paddingLeft: '1.25em',\n margin: 0,\n }}\n >\n {children}\n </Tag>\n );\n },\n\n listItem(this: ReactRenderer, children) {\n return (\n // Padding too: it pushes line boxes off ClampText's line grid, slicing the last line.\n <li key={this.elementId} style={{ padding: omitMargin ? '0px' : '2px 0px' }}>\n {children}\n </li>\n );\n },\n});\n\n/** Turns every block-level node inline for `flow`. Every block renderer must appear here, or the\n * one invariant — no block children — breaks silently. */\nconst getFlowOverrides = (): Partial<ReactRenderer> => ({\n paragraph(this: ReactRenderer, text) {\n return <span key={this.elementId}>{text} </span>;\n },\n\n // Roles are pinned: without the real <h*> the heading leaves the a11y tree entirely.\n heading(this: ReactRenderer, text, level) {\n return (\n <span\n key={this.elementId}\n role=\"heading\"\n aria-level={level}\n style={{ fontWeight: 600 }}\n >\n {text}{' '}\n </span>\n );\n },\n\n // The list owns markers and breaks — ordered numbering needs `start` plus the item index.\n // A <br> opens a line box (what -webkit-line-clamp counts); `display: block` would not.\n // Items OPEN with it, so tailwind.css suppresses the leading one on a first-child list.\n list(this: ReactRenderer, children, ordered, start) {\n const items = React.Children.toArray(children);\n return (\n <span key={this.elementId} role=\"list\" style={{ display: 'inline' }}>\n {items.map((item, index) => (\n // Index as key: one list node's rendered children never reorder.\n <span key={index} role=\"listitem\" style={{ display: 'inline' }}>\n <br />\n {/* Decoration — the role already conveys position. */}\n <span aria-hidden=\"true\">\n {ordered ? `${(start ?? 1) + index}. ` : FLOW_BULLET}\n </span>\n {item}\n </span>\n ))}\n {/* Closes the list so following prose starts on its own line. */}\n <br />\n </span>\n );\n },\n\n listItem(this: ReactRenderer, children) {\n return <React.Fragment key={this.elementId}>{children}</React.Fragment>;\n },\n\n blockquote(this: ReactRenderer, quote) {\n return <span key={this.elementId}>{quote} </span>;\n },\n\n // A hard break here is incidental wrapping; honouring it spends a clamped line on nothing.\n br(this: ReactRenderer) {\n return <span key={this.elementId}> </span>;\n },\n\n // Whitespace collapses, so a multi-line snippet becomes one run instead of the whole budget.\n code(this: ReactRenderer, code) {\n return (\n <React.Fragment key={this.elementId}>\n <CodeText variant=\"inline\">{code}</CodeText>{' '}\n </React.Fragment>\n );\n },\n\n hr(this: ReactRenderer) {\n return <span key={this.elementId}> </span>;\n },\n\n // Flattened to cell text: rows would each cost a line while carrying little at preview width.\n table(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children} </span>;\n },\n tableHeader(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children}</span>;\n },\n tableBody(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children}</span>;\n },\n tableRow(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children}</span>;\n },\n tableCell(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children} </span>;\n },\n\n // Replaced content grows the line box and breaks the grid the clamp measures against.\n checkbox(this: ReactRenderer, checked) {\n return <span key={this.elementId}>{checked ? '[x] ' : '[ ] '}</span>;\n },\n\n image(this: ReactRenderer, _src, alt) {\n return <span key={this.elementId}>{alt ? `${alt} ` : ''}</span>;\n },\n});\n\n// An image would fetch a third-party URL and a break would wrap the line.\nconst getInlineOverrides = (): Partial<ReactRenderer> => ({\n image(this: ReactRenderer, _src, alt) {\n return <React.Fragment key={this.elementId}>{alt ?? ''}</React.Fragment>;\n },\n\n br(this: ReactRenderer) {\n return <React.Fragment key={this.elementId}> </React.Fragment>;\n },\n});\n\nconst dedent = (str: string) => {\n const lines = str.split('\\n');\n const indents = lines.reduce<number[]>((acc, line) => {\n if (line.trim() !== '') {\n acc.push(line.match(/^[ \\t]*(?=\\S)/gm)?.[0].length ?? 0);\n }\n return acc;\n }, []);\n // Blank-only input has no indents to measure, and Math.min() would return Infinity — which\n // reads as a literal `{Infinity}` quantifier today, but throws the moment the `u` flag is added.\n if (indents.length === 0) {\n return str;\n }\n const indent = Math.min(...indents);\n return lines.map((line) => line.replace(new RegExp(`^[ \\\\t]{${indent}}`, 'gm'), '')).join('\\n');\n};\n\ntype BlockKind = 'blank' | 'item' | 'label' | 'prose';\n\nconst FENCE = /^ {0,3}(?:```|~~~)/;\n/** Lazy continuation or indented code — either way not a new block of a different kind. */\nconst INDENTED = /^ {2,}\\S/;\n/** Belongs to the line ABOVE; a break between them demotes the heading to a thematic rule. */\nconst SETEXT_UNDERLINE = /^ {0,3}(?:=+|-+)\\s*$/;\n/** Tested before the bullet rule so `---` is not read as a list item. */\nconst THEMATIC_BREAK = /^ {0,3}(?:(?:-\\s*){3,}|(?:\\*\\s*){3,}|(?:_\\s*){3,})$/;\nconst BULLET_MARKER = /^[-*+]\\s/;\nconst ORDERED_MARKER = /^(\\d{1,9})[.)]\\s/;\n/** The colon is REQUIRED: emphasis mid-sentence looks identical, and splitting it would turn\n * one paragraph into three. */\nconst BOLD_LABEL = /^\\*\\*[^*]+:\\*\\*$|^\\*\\*[^*]+\\*\\*:$/;\n\nconst INLINE_LABEL = /\\*\\*[^*\\n]+?:\\*\\*|\\*\\*[^*\\n]+?\\*\\*:/g;\nconst LEADING_MARKER = /^\\s*(?:[-*+]|\\d{1,9}[.)])\\s+/;\n\n/** Splits a bold label that TRAILS other text onto its own line — `...support. **Pagination\n * Mode:**`. Line classification alone cannot fix it: the whole line is prose. A label that\n * OPENS its line, or a list item, is a lead-in and left alone. */\nconst splitTrailingLabels = (line: string): string[] => {\n const marker = LEADING_MARKER.exec(line)?.[0] ?? '';\n let rest = line.slice(marker.length);\n const out: string[] = [];\n let isFirst = true;\n\n while (true) {\n INLINE_LABEL.lastIndex = 0;\n let found: RegExpExecArray | null = null;\n let match = INLINE_LABEL.exec(rest);\n while (match) {\n // index 0 means the label opens the chunk — a lead-in, not a new block.\n if (match.index > 0) {\n found = match;\n break;\n }\n match = INLINE_LABEL.exec(rest);\n }\n if (!found) {\n break;\n }\n const before = rest.slice(0, found.index).trimEnd();\n if (before) {\n out.push((isFirst ? marker : '') + before);\n isFirst = false;\n }\n rest = rest.slice(found.index);\n }\n\n out.push((isFirst ? marker : '') + rest);\n return out;\n};\n\nconst classifyLine = (line: string, previous: BlockKind): BlockKind => {\n const trimmed = line.trim();\n if (!trimmed) {\n return 'blank';\n }\n if (THEMATIC_BREAK.test(line) || SETEXT_UNDERLINE.test(line)) {\n // Continues what came before, so nothing is inserted above it.\n return previous === 'blank' ? 'prose' : previous;\n }\n if (BULLET_MARKER.test(trimmed)) {\n return 'item';\n }\n const ordered = ORDERED_MARKER.exec(trimmed);\n if (ordered) {\n // Only a list starting at 1 may interrupt a paragraph, else \"Released in\\n2024.\" would\n // become `<ol start=\"2024\">`.\n if (previous !== 'prose' || ordered[1] === '1') {\n return 'item';\n }\n }\n if (BOLD_LABEL.test(trimmed)) {\n return 'label';\n }\n return 'prose';\n};\n\n/** Inserts the blank line CommonMark needs between blocks of different kinds — generated\n * descriptions separate them with a single `\\n`, which reads as lazy continuation. Only a\n * CHANGE of kind breaks, so tight lists and wrapped paragraphs survive. Skips fences, indented\n * lines and setext underlines, where a blank line changes meaning. */\nconst explicitBlocks = (text: string): string => {\n const lines = text.split('\\n');\n const out: string[] = [];\n let previous: BlockKind = 'blank';\n let inFence = false;\n\n for (const line of lines) {\n if (FENCE.test(line)) {\n inFence = !inFence;\n out.push(line);\n // A fence is its own block on both sides.\n previous = 'blank';\n continue;\n }\n if (inFence) {\n out.push(line);\n continue;\n }\n if (INDENTED.test(line)) {\n out.push(line);\n continue;\n }\n // One line can hold a block AND a trailing label, so split before classifying.\n for (const piece of splitTrailingLabels(line)) {\n previous = pushClassified(piece, previous, out);\n }\n }\n return out.join('\\n');\n};\n\nconst pushClassified = (line: string, previous: BlockKind, out: string[]): BlockKind => {\n const kind = classifyLine(line, previous);\n if (kind !== 'blank' && previous !== 'blank' && kind !== previous) {\n out.push('');\n }\n out.push(line);\n return kind;\n};\n\nconst MarkdownBlock: React.FC<MarkdownProps> = ({\n text,\n color,\n size,\n omitMargin,\n variant = 'block',\n normalizeSource = false,\n links = 'interactive',\n renderLink,\n}) => {\n // Hooks before the early return so hook order stays stable. marked-react re-lexes on every\n // render, and this can land in a virtualized Table cell.\n const source = React.useMemo(\n () => (normalizeSource ? explicitBlocks(dedent(text ?? '')) : dedent(text ?? '')),\n [text, normalizeSource],\n );\n const renderer = React.useMemo(\n () => ({\n ...getRendererFunction({ omitMargin, links, renderLink }),\n ...(variant === 'flow' ? getFlowOverrides() : {}),\n ...(variant === 'inline' ? getInlineOverrides() : {}),\n }),\n [omitMargin, variant, links, renderLink],\n );\n\n if (!text) {\n return null;\n }\n\n // `display: contents` generates no box, so this only propagates colour and size — a real box\n // would be a block child for -webkit-line-clamp to count, and a stray div inside Alert. The\n // tag still switches: `display` does not change content-model validity.\n const Root = variant === 'block' ? 'div' : 'span';\n return (\n <Root\n className={variant === 'flow' ? 'md-root md-flow' : 'md-root'}\n style={{\n display: 'contents',\n color: getTextColor(color ?? 'primary'),\n fontSize: size === 'inherit' ? 'inherit' : getFontSize(size ?? 'small'),\n }}\n >\n <Markdown\n value={source}\n renderer={renderer}\n isInline={variant === 'inline'}\n gfm={variant !== 'inline'}\n instance={variant === 'inline' ? getInlineMarked() : undefined}\n />\n </Root>\n );\n};\n\n// marked-react re-parses on every render. Every prop but `renderLink` is a primitive.\nexport default React.memo(MarkdownBlock);\n"],"names":["FLOW_BULLET","INERT_LINK_STYLE","ALLOWED_SCHEMES","isSafeHref","href","scheme","isRootRelative","LINK_CLASSES","FOCUS_RING","getRendererFunction","omitMargin","links","renderLink","quote","jsx","text","code","CodeText","level","PageTitle","SectionTitle","children","React","src","alt","title","FOCUS_RING_INSET","flags","Cell","ordered","start","getFlowOverrides","jsxs","items","item","index","checked","_src","getInlineOverrides","dedent","str","lines","indents","acc","line","_a","indent","FENCE","INDENTED","SETEXT_UNDERLINE","THEMATIC_BREAK","BULLET_MARKER","ORDERED_MARKER","BOLD_LABEL","INLINE_LABEL","LEADING_MARKER","splitTrailingLabels","marker","rest","out","isFirst","found","match","before","classifyLine","previous","trimmed","explicitBlocks","inFence","piece","pushClassified","kind","MarkdownBlock","color","size","variant","normalizeSource","source","renderer","getTextColor","getFontSize","Markdown","getInlineMarked","MarkdownBlock$1"],"mappings":";;;;;;;;;AA8BA,MAAMA,IAAc,MAGdC,IAAwC;AAAA,EAC1C,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAChB,GAGMC,wBAAsB,IAAI,CAAC,SAAS,UAAU,WAAW,MAAM,CAAC,GAEhEC,IAAa,CAACC,MAAkC;AAClD,MAAI,OAAOA,KAAS;AAChB,WAAO;AAEX,QAAMC,IAAS,yBAAyB,KAAKD,EAAK,QAAQ,oBAAoB,EAAE,CAAC;AAEjF,SAAO,CAACC,KAAUH,EAAgB,IAAI,GAAGG,EAAO,CAAC,EAAE,aAAa,GAAG;AACvE,GAIMC,IAAiB,CAACF,MAA0B,0BAA0B,KAAKA,CAAI,GAE/EG,IAAe,sBAAsBC,CAAU,IAG/CC,IAAsB,CAAC;AAAA,EACzB,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AACJ,OAA2F;AAAA,EACvF,WAAgCC,GAAO;AACnC,WACI,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,OAAO;AAAA,UACH,iBAAiB;AAAA,UACjB,SAAS;AAAA,UACT,cAAc;AAAA,UACd,QAAQ;AAAA,UACR,QAAQ;AAAA,QAAA;AAAA,QAGX,UAAAD;AAAA,MAAA;AAAA,MATI,KAAK;AAAA,IAAA;AAAA,EAYtB;AAAA,EAEA,UAA+BE,GAAM;AACjC,WACI,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,WAAU;AAAA,QACV,OAAO,EAAE,cAAcJ,IAAa,QAAQ,OAAA;AAAA,QAE3C,UAAAK;AAAA,MAAA;AAAA,MAJI,KAAK;AAAA,IAAA;AAAA,EAOtB;AAAA,EAEA,SAA8BC,GAAM;AAChC,6BACKC,GAAA,EAA8B,SAAQ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,MAC9C,GAAI4C,MAAY,WAAWrC,MAAuB,CAAA;AAAA,IAAC;AAAA,IAEvD,CAAC5B,GAAYiE,GAAShE,GAAOC,CAAU;AAAA,EAAA;AAG3C,SAAKG,IASD,gBAAAD;AAAA,IAFS6D,MAAY,UAAU,QAAQ;AAAA,IAEtC;AAAA,MACG,WAAWA,MAAY,SAAS,oBAAoB;AAAA,MACpD,OAAO;AAAA,QACH,SAAS;AAAA,QACT,OAAOI,EAAaN,KAAS,SAAS;AAAA,QACtC,UAAUC,MAAS,YAAY,YAAYM,EAAYN,KAAQ,OAAO;AAAA,MAAA;AAAA,MAG1E,UAAA,gBAAA5D;AAAA,QAACmE;AAAA,QAAA;AAAA,UACG,OAAOJ;AAAA,UACP,UAAAC;AAAA,UACA,UAAUH,MAAY;AAAA,UACtB,KAAKA,MAAY;AAAA,UACjB,UAAUA,MAAY,WAAWO,MAAoB;AAAA,QAAA;AAAA,MAAA;AAAA,IACzD;AAAA,EAAA,IAtBG;AAyBf,GAGAC,KAAe7D,EAAM,KAAKkD,CAAa;"}
1
+ {"version":3,"file":"MarkdownBlock.js","sources":["../../../src/components/Typography/MarkdownBlock.tsx"],"sourcesContent":["import Markdown, { ReactRenderer } from 'marked-react';\nimport React from 'react';\nimport type { RenderLink } from '../PageLayout/types';\nimport { FOCUS_RING, FOCUS_RING_INSET } from '../focusRing';\nimport { isRootRelative } from '../safeHref';\nimport CodeText from './CodeText';\nimport PageTitle from './PageTitle';\nimport SectionTitle from './SectionTitle';\nimport type { FontSize, TextColor } from './Text';\nimport { getInlineMarked } from './inlineMarkdown';\nimport { getFontSize, getTextColor } from './textStyles';\n\n/** `inline`: one line of inline syntax, with no autolinked emails or URLs. */\nexport type MarkdownVariant = 'block' | 'flow' | 'inline';\n\n/** `inert` draws links without an anchor, for markdown inside a <button>. */\nexport type MarkdownLinks = 'interactive' | 'inert';\n\nexport interface MarkdownProps {\n text: string;\n color?: TextColor;\n size?: FontSize | 'inherit';\n omitMargin?: boolean;\n variant?: MarkdownVariant;\n normalizeSource?: boolean;\n links?: MarkdownLinks;\n /** Renders root-relative links (`/path`) through the app's router, in the same tab. Other\n * links still open in a new tab. Pass a stable function: a new one re-parses the markdown. */\n renderLink?: RenderLink;\n}\n\nconst FLOW_BULLET = '• ';\n\n// Inline, not `md-link`, for portals outside the shadow root; the link token is unreadable on tooltips.\nconst INERT_LINK_STYLE: React.CSSProperties = {\n color: 'inherit',\n textDecoration: 'underline',\n fontWeight: 600,\n};\n\n// Third-party content, and React does not sanitize href — `javascript:` would execute.\nconst ALLOWED_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nconst isSafeHref = (href: unknown): href is string => {\n if (typeof href !== 'string') {\n return false;\n }\n const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(href.replace(/[\\u0000-\\u0020]/g, ''));\n // No scheme means relative or fragment, which has nothing to vet.\n return !scheme || ALLOWED_SCHEMES.has(`${scheme[1].toLowerCase()}:`);\n};\n\nconst LINK_CLASSES = `md-link rounded-xs ${FOCUS_RING}`;\n\n// Renderer args are always arrays: never unwrap with `x[0]`, it drops all tokens after the first.\nconst getRendererFunction = ({\n omitMargin,\n links,\n renderLink,\n}: Pick<MarkdownProps, 'omitMargin' | 'links' | 'renderLink'>): Partial<ReactRenderer> => ({\n blockquote(this: ReactRenderer, quote) {\n return (\n <div\n key={this.elementId}\n style={{\n backgroundColor: 'var(--malachite-card-dimmed-background)',\n padding: '20px',\n borderRadius: '20px',\n border: '1px solid var(--malachite-card-border)',\n margin: '16px 0',\n }}\n >\n {quote}\n </div>\n );\n },\n\n paragraph(this: ReactRenderer, text) {\n return (\n <div\n key={this.elementId}\n className=\"md-paragraph\"\n style={{ marginBottom: omitMargin ? '0px' : '16px' }}\n >\n {text}\n </div>\n );\n },\n\n codespan(this: ReactRenderer, code) {\n return (\n <CodeText key={this.elementId} variant=\"inline\">\n {code}\n </CodeText>\n );\n },\n\n code(this: ReactRenderer, code) {\n return (\n <pre key={this.elementId} style={{ margin: omitMargin ? 0 : '16px 0' }}>\n <CodeText\n style={{\n display: 'block',\n whiteSpace: 'pre',\n overflowX: 'auto',\n padding: '12px',\n }}\n >\n {code}\n </CodeText>\n </pre>\n );\n },\n\n heading(this: ReactRenderer, text, level) {\n return level === 1 ? (\n <PageTitle key={this.elementId}>{text}</PageTitle>\n ) : (\n <SectionTitle key={this.elementId}>{text}</SectionTitle>\n );\n },\n\n br(this: ReactRenderer) {\n return <br key={this.elementId} />;\n },\n\n // `text`/`strong` are deliberately NOT overridden: a wrapping Text emits a font-weight, and\n // the nested 400 beat strong's 600 — which is why bold never rendered.\n\n link(this: ReactRenderer, href, children) {\n // Keep the label for a rejected scheme rather than deleting content.\n if (!isSafeHref(href)) {\n return <React.Fragment key={this.elementId}>{children}</React.Fragment>;\n }\n if (links === 'inert') {\n return (\n <span key={this.elementId} style={INERT_LINK_STYLE}>\n {children}\n </span>\n );\n }\n if (renderLink && isRootRelative(href)) {\n return (\n <React.Fragment key={this.elementId}>\n {renderLink({ href, children, className: LINK_CLASSES })}\n </React.Fragment>\n );\n }\n return (\n // Hover is in tailwind.css: CLAUDE.md forbids JS for styling, and JS misses keyboard.\n // FOCUS_RING because a colour change alone is not a focus indicator.\n <a\n key={this.elementId}\n className={LINK_CLASSES}\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {children}\n </a>\n );\n },\n\n // Overridden only to vet `src`. Alt text stands in for a rejected image.\n image(this: ReactRenderer, src, alt, title) {\n if (!isSafeHref(src)) {\n return <span key={this.elementId}>{alt ?? ''}</span>;\n }\n return (\n <img\n key={this.elementId}\n src={src}\n alt={alt ?? ''}\n title={title ?? undefined}\n style={{ maxWidth: '100%' }}\n />\n );\n },\n\n // Scrolls on its own: a wide table in a block of markdown must not widen the column it sits in.\n // Tabbable because Safari won't focus a scroller holding only text, leaving keyboard readers\n // no way to reach the columns off screen.\n table(this: ReactRenderer, children) {\n return (\n <div\n key={this.elementId}\n role=\"group\"\n aria-label=\"Table\"\n tabIndex={0}\n className={FOCUS_RING_INSET}\n style={{ overflowX: 'auto', margin: omitMargin ? 0 : '16px 0' }}\n >\n <table style={{ borderCollapse: 'collapse', minWidth: '100%' }}>{children}</table>\n </div>\n );\n },\n\n tableCell(this: ReactRenderer, children, flags) {\n const Cell = flags.header ? 'th' : 'td';\n return (\n <Cell\n key={this.elementId}\n style={{\n border: '1px solid var(--malachite-card-border)',\n padding: '6px 10px',\n textAlign: flags.align ?? 'left',\n fontWeight: flags.header ? 600 : undefined,\n }}\n >\n {children}\n </Cell>\n );\n },\n\n // Preflight resets list-style/margin/padding; padding-left on the LIST is the hanging indent.\n list(this: ReactRenderer, children, ordered, start) {\n const Tag = ordered ? 'ol' : 'ul';\n return (\n <Tag\n key={this.elementId}\n // Forward `start` or `3. three` silently renumbers from 1.\n start={ordered && start !== 1 ? start : undefined}\n style={{\n listStyle: ordered ? 'decimal' : 'disc',\n paddingLeft: '1.25em',\n margin: 0,\n }}\n >\n {children}\n </Tag>\n );\n },\n\n listItem(this: ReactRenderer, children) {\n return (\n // Padding too: it pushes line boxes off ClampText's line grid, slicing the last line.\n <li key={this.elementId} style={{ padding: omitMargin ? '0px' : '2px 0px' }}>\n {children}\n </li>\n );\n },\n});\n\n/** Turns every block-level node inline for `flow`. Every block renderer must appear here, or the\n * one invariant — no block children — breaks silently. */\nconst getFlowOverrides = (): Partial<ReactRenderer> => ({\n paragraph(this: ReactRenderer, text) {\n return <span key={this.elementId}>{text} </span>;\n },\n\n // Roles are pinned: without the real <h*> the heading leaves the a11y tree entirely.\n heading(this: ReactRenderer, text, level) {\n return (\n <span\n key={this.elementId}\n role=\"heading\"\n aria-level={level}\n style={{ fontWeight: 600 }}\n >\n {text}{' '}\n </span>\n );\n },\n\n // The list owns markers and breaks — ordered numbering needs `start` plus the item index.\n // A <br> opens a line box (what -webkit-line-clamp counts); `display: block` would not.\n // Items OPEN with it, so tailwind.css suppresses the leading one on a first-child list.\n list(this: ReactRenderer, children, ordered, start) {\n const items = React.Children.toArray(children);\n return (\n <span key={this.elementId} role=\"list\" style={{ display: 'inline' }}>\n {items.map((item, index) => (\n // Index as key: one list node's rendered children never reorder.\n <span key={index} role=\"listitem\" style={{ display: 'inline' }}>\n <br />\n {/* Decoration — the role already conveys position. */}\n <span aria-hidden=\"true\">\n {ordered ? `${(start ?? 1) + index}. ` : FLOW_BULLET}\n </span>\n {item}\n </span>\n ))}\n {/* Closes the list so following prose starts on its own line. */}\n <br />\n </span>\n );\n },\n\n listItem(this: ReactRenderer, children) {\n return <React.Fragment key={this.elementId}>{children}</React.Fragment>;\n },\n\n blockquote(this: ReactRenderer, quote) {\n return <span key={this.elementId}>{quote} </span>;\n },\n\n // A hard break here is incidental wrapping; honouring it spends a clamped line on nothing.\n br(this: ReactRenderer) {\n return <span key={this.elementId}> </span>;\n },\n\n // Whitespace collapses, so a multi-line snippet becomes one run instead of the whole budget.\n code(this: ReactRenderer, code) {\n return (\n <React.Fragment key={this.elementId}>\n <CodeText variant=\"inline\">{code}</CodeText>{' '}\n </React.Fragment>\n );\n },\n\n hr(this: ReactRenderer) {\n return <span key={this.elementId}> </span>;\n },\n\n // Flattened to cell text: rows would each cost a line while carrying little at preview width.\n table(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children} </span>;\n },\n tableHeader(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children}</span>;\n },\n tableBody(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children}</span>;\n },\n tableRow(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children}</span>;\n },\n tableCell(this: ReactRenderer, children) {\n return <span key={this.elementId}>{children} </span>;\n },\n\n // Replaced content grows the line box and breaks the grid the clamp measures against.\n checkbox(this: ReactRenderer, checked) {\n return <span key={this.elementId}>{checked ? '[x] ' : '[ ] '}</span>;\n },\n\n image(this: ReactRenderer, _src, alt) {\n return <span key={this.elementId}>{alt ? `${alt} ` : ''}</span>;\n },\n});\n\n// An image would fetch a third-party URL and a break would wrap the line.\nconst getInlineOverrides = (): Partial<ReactRenderer> => ({\n image(this: ReactRenderer, _src, alt) {\n return <React.Fragment key={this.elementId}>{alt ?? ''}</React.Fragment>;\n },\n\n br(this: ReactRenderer) {\n return <React.Fragment key={this.elementId}> </React.Fragment>;\n },\n});\n\nconst dedent = (str: string) => {\n const lines = str.split('\\n');\n const indents = lines.reduce<number[]>((acc, line) => {\n if (line.trim() !== '') {\n acc.push(line.match(/^[ \\t]*(?=\\S)/gm)?.[0].length ?? 0);\n }\n return acc;\n }, []);\n // Blank-only input has no indents to measure, and Math.min() would return Infinity — which\n // reads as a literal `{Infinity}` quantifier today, but throws the moment the `u` flag is added.\n if (indents.length === 0) {\n return str;\n }\n const indent = Math.min(...indents);\n return lines.map((line) => line.replace(new RegExp(`^[ \\\\t]{${indent}}`, 'gm'), '')).join('\\n');\n};\n\ntype BlockKind = 'blank' | 'item' | 'label' | 'prose';\n\nconst FENCE = /^ {0,3}(?:```|~~~)/;\n/** Lazy continuation or indented code — either way not a new block of a different kind. */\nconst INDENTED = /^ {2,}\\S/;\n/** Belongs to the line ABOVE; a break between them demotes the heading to a thematic rule. */\nconst SETEXT_UNDERLINE = /^ {0,3}(?:=+|-+)\\s*$/;\n/** Tested before the bullet rule so `---` is not read as a list item. */\nconst THEMATIC_BREAK = /^ {0,3}(?:(?:-\\s*){3,}|(?:\\*\\s*){3,}|(?:_\\s*){3,})$/;\nconst BULLET_MARKER = /^[-*+]\\s/;\nconst ORDERED_MARKER = /^(\\d{1,9})[.)]\\s/;\n/** The colon is REQUIRED: emphasis mid-sentence looks identical, and splitting it would turn\n * one paragraph into three. */\nconst BOLD_LABEL = /^\\*\\*[^*]+:\\*\\*$|^\\*\\*[^*]+\\*\\*:$/;\n\nconst INLINE_LABEL = /\\*\\*[^*\\n]+?:\\*\\*|\\*\\*[^*\\n]+?\\*\\*:/g;\nconst LEADING_MARKER = /^\\s*(?:[-*+]|\\d{1,9}[.)])\\s+/;\n\n/** Splits a bold label that TRAILS other text onto its own line — `...support. **Pagination\n * Mode:**`. Line classification alone cannot fix it: the whole line is prose. A label that\n * OPENS its line, or a list item, is a lead-in and left alone. */\nconst splitTrailingLabels = (line: string): string[] => {\n const marker = LEADING_MARKER.exec(line)?.[0] ?? '';\n let rest = line.slice(marker.length);\n const out: string[] = [];\n let isFirst = true;\n\n while (true) {\n INLINE_LABEL.lastIndex = 0;\n let found: RegExpExecArray | null = null;\n let match = INLINE_LABEL.exec(rest);\n while (match) {\n // index 0 means the label opens the chunk — a lead-in, not a new block.\n if (match.index > 0) {\n found = match;\n break;\n }\n match = INLINE_LABEL.exec(rest);\n }\n if (!found) {\n break;\n }\n const before = rest.slice(0, found.index).trimEnd();\n if (before) {\n out.push((isFirst ? marker : '') + before);\n isFirst = false;\n }\n rest = rest.slice(found.index);\n }\n\n out.push((isFirst ? marker : '') + rest);\n return out;\n};\n\nconst classifyLine = (line: string, previous: BlockKind): BlockKind => {\n const trimmed = line.trim();\n if (!trimmed) {\n return 'blank';\n }\n if (THEMATIC_BREAK.test(line) || SETEXT_UNDERLINE.test(line)) {\n // Continues what came before, so nothing is inserted above it.\n return previous === 'blank' ? 'prose' : previous;\n }\n if (BULLET_MARKER.test(trimmed)) {\n return 'item';\n }\n const ordered = ORDERED_MARKER.exec(trimmed);\n if (ordered) {\n // Only a list starting at 1 may interrupt a paragraph, else \"Released in\\n2024.\" would\n // become `<ol start=\"2024\">`.\n if (previous !== 'prose' || ordered[1] === '1') {\n return 'item';\n }\n }\n if (BOLD_LABEL.test(trimmed)) {\n return 'label';\n }\n return 'prose';\n};\n\n/** Inserts the blank line CommonMark needs between blocks of different kinds — generated\n * descriptions separate them with a single `\\n`, which reads as lazy continuation. Only a\n * CHANGE of kind breaks, so tight lists and wrapped paragraphs survive. Skips fences, indented\n * lines and setext underlines, where a blank line changes meaning. */\nconst explicitBlocks = (text: string): string => {\n const lines = text.split('\\n');\n const out: string[] = [];\n let previous: BlockKind = 'blank';\n let inFence = false;\n\n for (const line of lines) {\n if (FENCE.test(line)) {\n inFence = !inFence;\n out.push(line);\n // A fence is its own block on both sides.\n previous = 'blank';\n continue;\n }\n if (inFence) {\n out.push(line);\n continue;\n }\n if (INDENTED.test(line)) {\n out.push(line);\n continue;\n }\n // One line can hold a block AND a trailing label, so split before classifying.\n for (const piece of splitTrailingLabels(line)) {\n previous = pushClassified(piece, previous, out);\n }\n }\n return out.join('\\n');\n};\n\nconst pushClassified = (line: string, previous: BlockKind, out: string[]): BlockKind => {\n const kind = classifyLine(line, previous);\n if (kind !== 'blank' && previous !== 'blank' && kind !== previous) {\n out.push('');\n }\n out.push(line);\n return kind;\n};\n\nconst MarkdownBlock: React.FC<MarkdownProps> = ({\n text,\n color,\n size,\n omitMargin,\n variant = 'block',\n normalizeSource = false,\n links = 'interactive',\n renderLink,\n}) => {\n // Hooks before the early return so hook order stays stable. marked-react re-lexes on every\n // render, and this can land in a virtualized Table cell.\n const source = React.useMemo(\n () => (normalizeSource ? explicitBlocks(dedent(text ?? '')) : dedent(text ?? '')),\n [text, normalizeSource],\n );\n const renderer = React.useMemo(\n () => ({\n ...getRendererFunction({ omitMargin, links, renderLink }),\n ...(variant === 'flow' ? getFlowOverrides() : {}),\n ...(variant === 'inline' ? getInlineOverrides() : {}),\n }),\n [omitMargin, variant, links, renderLink],\n );\n\n if (!text) {\n return null;\n }\n\n // `display: contents` generates no box, so this only propagates colour and size — a real box\n // would be a block child for -webkit-line-clamp to count, and a stray div inside Alert. The\n // tag still switches: `display` does not change content-model validity.\n const Root = variant === 'block' ? 'div' : 'span';\n return (\n <Root\n className={variant === 'flow' ? 'md-root md-flow' : 'md-root'}\n style={{\n display: 'contents',\n color: getTextColor(color ?? 'primary'),\n fontSize: size === 'inherit' ? 'inherit' : getFontSize(size ?? 'small'),\n }}\n >\n <Markdown\n value={source}\n renderer={renderer}\n isInline={variant === 'inline'}\n gfm={variant !== 'inline'}\n instance={variant === 'inline' ? getInlineMarked() : undefined}\n />\n </Root>\n );\n};\n\n// marked-react re-parses on every render. Every prop but `renderLink` is a primitive.\nexport default React.memo(MarkdownBlock);\n"],"names":["FLOW_BULLET","INERT_LINK_STYLE","ALLOWED_SCHEMES","isSafeHref","href","scheme","LINK_CLASSES","FOCUS_RING","getRendererFunction","omitMargin","links","renderLink","quote","jsx","text","code","CodeText","level","PageTitle","SectionTitle","children","isRootRelative","React","src","alt","title","FOCUS_RING_INSET","flags","Cell","ordered","start","getFlowOverrides","jsxs","items","item","index","checked","_src","getInlineOverrides","dedent","str","lines","indents","acc","line","_a","indent","FENCE","INDENTED","SETEXT_UNDERLINE","THEMATIC_BREAK","BULLET_MARKER","ORDERED_MARKER","BOLD_LABEL","INLINE_LABEL","LEADING_MARKER","splitTrailingLabels","marker","rest","out","isFirst","found","match","before","classifyLine","previous","trimmed","explicitBlocks","inFence","piece","pushClassified","kind","MarkdownBlock","color","size","variant","normalizeSource","source","renderer","getTextColor","getFontSize","Markdown","getInlineMarked","MarkdownBlock$1"],"mappings":";;;;;;;;;;AA+BA,MAAMA,IAAc,MAGdC,IAAwC;AAAA,EAC1C,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAChB,GAGMC,wBAAsB,IAAI,CAAC,SAAS,UAAU,WAAW,MAAM,CAAC,GAEhEC,IAAa,CAACC,MAAkC;AAClD,MAAI,OAAOA,KAAS;AAChB,WAAO;AAEX,QAAMC,IAAS,yBAAyB,KAAKD,EAAK,QAAQ,oBAAoB,EAAE,CAAC;AAEjF,SAAO,CAACC,KAAUH,EAAgB,IAAI,GAAGG,EAAO,CAAC,EAAE,aAAa,GAAG;AACvE,GAEMC,IAAe,sBAAsBC,CAAU,IAG/CC,IAAsB,CAAC;AAAA,EACzB,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AACJ,OAA2F;AAAA,EACvF,WAAgCC,GAAO;AACnC,WACI,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,OAAO;AAAA,UACH,iBAAiB;AAAA,UACjB,SAAS;AAAA,UACT,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AAkB;AAAA,EAClB,OAAAlE,IAAQ;AAAA,EACR,YAAAC;AACJ,MAAM;AAGF,QAAMkE,IAASvD,EAAM;AAAA,IACjB,MAAOsD,IAAkBT,EAAe5B,EAAOzB,KAAQ,EAAE,CAAC,IAAIyB,EAAOzB,KAAQ,EAAE;AAAA,IAC/E,CAACA,GAAM8D,CAAe;AAAA,EAAA,GAEpBE,IAAWxD,EAAM;AAAA,IACnB,OAAO;AAAA,MACH,GAAGd,EAAoB,EAAE,YAAAC,GAAY,OAAAC,GAAO,YAAAC,GAAY;AAAA,MACxD,GAAIgE,MAAY,SAAS5C,EAAA,IAAqB,CAAA;AAAA,MAC9C,GAAI4C,MAAY,WAAWrC,MAAuB,CAAA;AAAA,IAAC;AAAA,IAEvD,CAAC7B,GAAYkE,GAASjE,GAAOC,CAAU;AAAA,EAAA;AAG3C,SAAKG,IASD,gBAAAD;AAAA,IAFS8D,MAAY,UAAU,QAAQ;AAAA,IAEtC;AAAA,MACG,WAAWA,MAAY,SAAS,oBAAoB;AAAA,MACpD,OAAO;AAAA,QACH,SAAS;AAAA,QACT,OAAOI,EAAaN,KAAS,SAAS;AAAA,QACtC,UAAUC,MAAS,YAAY,YAAYM,EAAYN,KAAQ,OAAO;AAAA,MAAA;AAAA,MAG1E,UAAA,gBAAA7D;AAAA,QAACoE;AAAA,QAAA;AAAA,UACG,OAAOJ;AAAA,UACP,UAAAC;AAAA,UACA,UAAUH,MAAY;AAAA,UACtB,KAAKA,MAAY;AAAA,UACjB,UAAUA,MAAY,WAAWO,MAAoB;AAAA,QAAA;AAAA,MAAA;AAAA,IACzD;AAAA,EAAA,IAtBG;AAyBf,GAGAC,KAAe7D,EAAM,KAAKkD,CAAa;"}
@@ -1,10 +1,11 @@
1
- const s = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), o = (e) => {
2
- if (typeof e != "string")
1
+ const s = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), o = (t) => {
2
+ if (typeof t != "string")
3
3
  return !1;
4
- const t = /^([a-z][a-z0-9+.-]*):/i.exec(e.replace(/[\u0000-\u0020]/g, ""));
5
- return !t || s.has(`${t[1].toLowerCase()}:`);
6
- }, a = (e) => o(e) ? e : void 0;
4
+ const e = /^([a-z][a-z0-9+.-]*):/i.exec(t.replace(/[\u0000-\u0020]/g, ""));
5
+ return !e || s.has(`${e[1].toLowerCase()}:`);
6
+ }, a = (t) => o(t) ? t : void 0, n = (t) => /^\/(?![/\\])[^\t\n\r]*$/.test(t);
7
7
  export {
8
+ n as isRootRelative,
8
9
  o as isSafeHref,
9
10
  a as safeHref
10
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"safeHref.js","sources":["../../src/components/safeHref.ts"],"sourcesContent":["// React does not sanitize href, so a `javascript:` URL reaching one executes. Component\n// props are not always author-written: a docs link can arrive from an API response.\nconst ALLOWED_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nexport const isSafeHref = (href: unknown): href is string => {\n if (typeof href !== 'string') {\n return false;\n }\n // Strip control characters first: `java\\u0009script:` is a scheme the naive test misses.\n const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(href.replace(/[\\u0000-\\u0020]/g, ''));\n // No scheme means relative or fragment, which has nothing to vet.\n return !scheme || ALLOWED_SCHEMES.has(`${scheme[1].toLowerCase()}:`);\n};\n\n/** Returns the href only when it is safe to navigate to, so callers can fall back. */\nexport const safeHref = (href: string | undefined): string | undefined =>\n isSafeHref(href) ? href : undefined;\n"],"names":["ALLOWED_SCHEMES","isSafeHref","href","scheme","safeHref"],"mappings":"AAEA,MAAMA,wBAAsB,IAAI,CAAC,SAAS,UAAU,WAAW,MAAM,CAAC,GAEzDC,IAAa,CAACC,MAAkC;AACzD,MAAI,OAAOA,KAAS;AAChB,WAAO;AAGX,QAAMC,IAAS,yBAAyB,KAAKD,EAAK,QAAQ,oBAAoB,EAAE,CAAC;AAEjF,SAAO,CAACC,KAAUH,EAAgB,IAAI,GAAGG,EAAO,CAAC,EAAE,aAAa,GAAG;AACvE,GAGaC,IAAW,CAACF,MACrBD,EAAWC,CAAI,IAAIA,IAAO;"}
1
+ {"version":3,"file":"safeHref.js","sources":["../../src/components/safeHref.ts"],"sourcesContent":["// React does not sanitize href, so a `javascript:` URL reaching one executes. Component\n// props are not always author-written: a docs link can arrive from an API response.\nconst ALLOWED_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nexport const isSafeHref = (href: unknown): href is string => {\n if (typeof href !== 'string') {\n return false;\n }\n // Strip control characters first: `java\\u0009script:` is a scheme the naive test misses.\n const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(href.replace(/[\\u0000-\\u0020]/g, ''));\n // No scheme means relative or fragment, which has nothing to vet.\n return !scheme || ALLOWED_SCHEMES.has(`${scheme[1].toLowerCase()}:`);\n};\n\n/** Returns the href only when it is safe to navigate to, so callers can fall back. */\nexport const safeHref = (href: string | undefined): string | undefined =>\n isSafeHref(href) ? href : undefined;\n\n// `//host` and `/\\host` are protocol-relative to a browser, so they leave the app; URL parsing drops tab, CR and LF.\nexport const isRootRelative = (href: string): boolean => /^\\/(?![/\\\\])[^\\t\\n\\r]*$/.test(href);\n"],"names":["ALLOWED_SCHEMES","isSafeHref","href","scheme","safeHref","isRootRelative"],"mappings":"AAEA,MAAMA,wBAAsB,IAAI,CAAC,SAAS,UAAU,WAAW,MAAM,CAAC,GAEzDC,IAAa,CAACC,MAAkC;AACzD,MAAI,OAAOA,KAAS;AAChB,WAAO;AAGX,QAAMC,IAAS,yBAAyB,KAAKD,EAAK,QAAQ,oBAAoB,EAAE,CAAC;AAEjF,SAAO,CAACC,KAAUH,EAAgB,IAAI,GAAGG,EAAO,CAAC,EAAE,aAAa,GAAG;AACvE,GAGaC,IAAW,CAACF,MACrBD,EAAWC,CAAI,IAAIA,IAAO,QAGjBG,IAAiB,CAACH,MAA0B,0BAA0B,KAAKA,CAAI;"}
package/dist/index.d.ts CHANGED
@@ -464,6 +464,8 @@ export declare interface BreadcrumbsProps {
464
464
  links: BreadcrumbLink[];
465
465
  actions?: PageAction[];
466
466
  renderLink?: RenderLink;
467
+ /** The element a lone root crumb renders as, e.g. `h1` when it titles the page. */
468
+ titleElement?: TextElement;
467
469
  className?: string;
468
470
  style?: default_2.CSSProperties;
469
471
  }
@@ -3600,6 +3602,9 @@ export declare interface LinkProps {
3600
3602
  color?: 'default' | 'dimmed';
3601
3603
  size?: FontSize;
3602
3604
  underline?: boolean;
3605
+ onClick?: default_2.MouseEventHandler<HTMLAnchorElement>;
3606
+ /** Renders a root-relative href through the app's router instead of a new-tab anchor, without `target` or `rel`. Other hrefs keep the anchor. */
3607
+ renderLink?: RenderLink;
3603
3608
  }
3604
3609
 
3605
3610
  declare interface LinkProps_2 {
@@ -4499,7 +4504,9 @@ export declare const PageActions: default_2.FC<{
4499
4504
  buttons: PageAction[];
4500
4505
  }>;
4501
4506
 
4502
- declare type PageContentGap = 'small' | 'medium' | 'large' | 'xlarge';
4507
+ export declare type PageContentGap = 'small' | 'medium' | 'large' | 'xlarge';
4508
+
4509
+ export declare type PageContentWidth = 'narrow';
4503
4510
 
4504
4511
  export declare const PageLayout: {
4505
4512
  Regular: FC<RegularLayoutProps>;
@@ -4930,6 +4937,8 @@ export declare interface RegularLayoutProps {
4930
4937
  centered?: boolean;
4931
4938
  noPadding?: boolean;
4932
4939
  contentGap?: PageContentGap;
4940
+ /** Caps the content column and centres it; `narrow` fits a single-column form. */
4941
+ contentWidth?: PageContentWidth;
4933
4942
  alert?: {
4934
4943
  message: string;
4935
4944
  type?: AlertType;
@@ -4948,8 +4957,9 @@ export declare const ReloadIcon: React.FC<IconProps_99>;
4948
4957
 
4949
4958
  /**
4950
4959
  * Renders an in-app link through the app's own link component, spreading every field onto it:
4951
- * breadcrumbs, the back button, and root-relative markdown links. A client-side-routed consumer
4952
- * MUST pass this, or navigation breaks.
4960
+ * breadcrumbs, the back button, and root-relative markdown and `Link` hrefs. Forward `onClick`
4961
+ * too, which `Link` passes when its caller sets one. A client-side-routed consumer MUST pass
4962
+ * this, or navigation breaks.
4953
4963
  */
4954
4964
  export declare type RenderLink = (props: {
4955
4965
  href: string;
@@ -4957,6 +4967,7 @@ export declare type RenderLink = (props: {
4957
4967
  className?: string;
4958
4968
  'aria-current'?: 'page';
4959
4969
  'aria-label'?: string;
4970
+ onClick?: default_2.MouseEventHandler<HTMLAnchorElement>;
4960
4971
  }) => default_2.ReactNode;
4961
4972
 
4962
4973
  export declare const ReplyIcon: React.FC<IconProps_100>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/malachite",
3
- "version": "2.114.0",
3
+ "version": "2.116.0",
4
4
  "description": "StackOne's themeable React component library — Shadow DOM isolated, scoped Tailwind, theme-token driven.",
5
5
  "license": "MIT",
6
6
  "author": "StackOne",