@stackone/malachite 2.93.1 → 2.93.2

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
@@ -8,7 +8,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
8
8
 
9
9
  - **`Chat`** — A chat column: `Chat.Thread` scrolls and pins itself to the newest message, `Chat.Composer` keeps its own height and owns the Enter/Shift+Enter convention, and `Chat.Message`, `Chat.ToolCall` and `Chat.Thinking` render one turn each. A user turn sits right and hugs its text; an assistant turn runs full width, and `variant="card"` frames it with its state, copy and rating controls, and a token/model line. `variant="bubble"` is a third treatment, not a repaint of either: tinted bubbles whose flattened corner points at whoever spoke, so authorship reads before the words do. `Chat.Context` lists what the conversation can see — a removable chip per source, and an add affordance only when a handler is given. `Chat.Thinking` and a loading turn draw bars in the shape of the answer rather than a spinner. `Chat.Reasoning` shows what a model reasoned, open while it arrives and shut once it stops, until the reader toggles it. `Chat.ToolCall` mounts its payloads only once opened, since a result can be tens of KB; `blocked` is a call something refused to run, as distinct from `error`. The row under a composer is `ComposerChip`, `ContextMeter` and `ModelPicker` — PillButton tabs, so it reads as attached to the field; `ModelPicker` opens a portalled menu with a submenu per model. The transcript is a live `log` region, so a streamed reply is announced, and it shows a centred empty state until the first turn. _Key props:_ `Chat`: `children`, `className`. `Thread`: `aria-label`, `emptyTitle`, `emptyDescription`, `emptyIcon`. `Message`: `role`, `variant` (`plain` | `card`), `content`, `children`, `name`, `avatarSrc`, `status` (`streaming` | `completed` | `error`), `loading`, `onCopy`, `onFeedback`, `usage`. `ToolCall`: `name`, `status` (`running` | `completed` | `error` | `blocked`), `callId`, `input` and `output` (an object, or a string shown as it is), `adornment`, `children`, `defaultExpanded`. `Reasoning`: `text`, `streaming`, `title`. `Thinking`: `label`. `Composer`: `value`, `onChange`, `onSend`, `onStop`, `busy`, `disabled`, `placeholder`, `maxLength`, `rows`, `children`. `ComposerChip`: `label`, `icon`, `trailingIcon`, `onClick`, `disabled`. `ContextMeter`: `used`, `limit`, `cached`, `label`. `ModelPicker`: `models`, `value`, `optionValue`, `onChange`, `openUp`, `disabled`. `Context`: `label`, `items` (`{id, label, onRemove?}`), `onAdd`, `className`.
10
10
  - **`Surface`** — Rounded, bordered card container with the standard elevation shadow. Use `overflow="clip"` to keep the rounded clipping while letting a `position: sticky` descendant still pin (`hidden` would trap it); `visible` disables clipping. _Key props:_ `children`, `padding`, `overflow`, `shadow` (`false` sits the card flat, without the elevation shadow), `tone` (`default` | `highlight`; `highlight` paints the warm ground with no border, and sits flat unless `shadow` is passed, for a static block that stands out from the page, such as a hero or a guide's section header; its ground is too close to `Surface.Row`'s hover for clickable rows inside it), `className`, `style`.
11
- - **`SurfaceRow`** — A full-bleed row inside a Surface (used as `Surface.Row`). Owns hover highlight, colour transition and an optional bottom divider. Pass `onClick`/`href` to make the whole row clickable (renders as a real button/anchor, so keyboard nav works). For a selectable row use `role="radio"` + `selected` and put a presentational `<Radio>` inside as the indicator; `selected` then paints the same treatment `Table` gives `selectedRowKey`. Under `role="checkbox"` it only announces — a multi-select row carries its own checkbox, and a highlight marking one of many says nothing when most rows are checked. `selection` overrides that either way (`highlight` / `announce`). `selected="mixed"` marks a partly selected checkbox row (`aria-checked="mixed"`); it never paints or marks a row current, and counts as not selected under any other role. Use `trailing` for a control that must stay interactive — it renders outside the row button, which a nested control could not be. An `onClick` row with `trailing` is still clickable across its whole box, padding and the space around the slot included (an `href` row leaves that to its link, so a modified click still opens a new tab), with its focus ring at the row's edge; a click inside the slot (or in a menu it portals out) is the slot's own, and a disabled row drops both the click and the ring. `revealTrailing` shows that control only on hover, keyboard focus or while a menu it opened is open, keeping it in the tab order and always showing it on a touch screen. `tone="muted"` tints a row whose subject is inactive, which `disabled` does not: a muted row stays clickable. `leading` puts the row's own indicator (a presentational `Checkbox`) inside the row button ahead of the children (with `leading` or `dimmed`, pass one child; it fills the row), and `dimmed` fades the children but not `leading` or `trailing`, for a row switched off but still a click from on. _Key props:_ `divider`, `disabled`, `tone` (`default` | `muted`), `inset` (`none` | `compact` — the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper), `onClick`, `href`, `target`, `rel`, `selected` (`boolean` | `"mixed"`), `selection` (`highlight` | `tint` | `announce`; `tint` paints the selected treatment without the accent bar, for a menu whose choice is already marked inside the row), `trailing`, `revealTrailing`, `leading`, `dimmed`, `role`, `className`, `style`.
11
+ - **`SurfaceRow`** — A full-bleed row inside a Surface (used as `Surface.Row`). Owns hover highlight, colour transition and an optional bottom divider. Pass `onClick`/`href` to make the whole row clickable (renders as a real button/anchor, so keyboard nav works). For a selectable row use `role="radio"` + `selected` and put a presentational `<Radio>` inside as the indicator; `selected` then paints the same treatment `Table` gives `selectedRowKey`. Under `role="checkbox"` it only announces — a multi-select row carries its own checkbox, and a highlight marking one of many says nothing when most rows are checked. `selection` overrides that either way (`highlight` / `announce`). `selected="mixed"` marks a partly selected checkbox row (`aria-checked="mixed"`); it never paints or marks a row current, and counts as not selected under any other role. Use `trailing` for a control that must stay interactive — it renders outside the row button, which a nested control could not be. An `onClick` row with `trailing` is still clickable across its whole box, padding and the space around the slot included (an `href` row leaves that to its link, so a modified click still opens a new tab), with its focus ring at the row's edge; a click inside the slot (or in a menu it portals out) is the slot's own, and a disabled row drops both the click and the ring. `revealTrailing` shows that control only on hover, keyboard focus or while a menu it opened is open, keeping it in the tab order and always showing it on a touch screen. `tone="muted"` tints a row whose subject is inactive, which `disabled` does not: a muted row stays clickable. `leading` puts the row's own indicator (a presentational `Checkbox`) inside the row button ahead of the children (with `leading` or `dimmed`, pass one child; it fills the row), and `dimmed` fades the children but not `leading` or `trailing`, for a row switched off but still a click from on. _Key props:_ `divider`, `disabled`, `hover` (default on; `false` leaves the hover to something inside the row), `tone` (`default` | `muted`), `inset` (`none` | `compact` — the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper), `onClick`, `href`, `target`, `rel`, `selected` (`boolean` | `"mixed"`), `selection` (`highlight` | `tint` | `announce`; `tint` paints the selected treatment without the accent bar, for a menu whose choice is already marked inside the row), `trailing`, `revealTrailing`, `leading`, `dimmed`, `role`, `className`, `style`.
12
12
  - **`SurfaceExpandableRow`** — A row that opens to reveal a body (used as `Surface.ExpandableRow`), for a line that carries its own controls. Not `Accordion`, which puts its header inside the toggle button, so a header holding a dropdown or a second button would be invalid: here the row surface takes the click and a cell opts out by wrapping its controls in `ExpandableRow.Controls`, while the arrow stays a real button so the keyboard reaches it. That opt-out is explicit rather than sniffing the event target for an interactive ancestor, because a control rendering into a shadow root retargets the event to its host. `sticky` pins the row while its body scrolls, offset by `stickyTopOffset` for whatever is already pinned above it; it only pins while open, since a closed row has nothing to scroll past. _Key props:_ `header`, `children`, `expanded`, `onToggle`, `sticky`, `stickyTopOffset`, `divider`, `tone`, `aria-label`, `className`, `style`.
13
13
  - **`DisclosureArrow`** — The expand/collapse triangle disclosure UI shares (`Accordion`, `Surface.ExpandableRow`). Owns its colour states so they never drift between usages: `text-primary` when expanded, `text-placeholder` otherwise, and dark on hover inside a `group` ancestor — put `group` on the clickable header or row so that hover state activates. _Key props:_ `expanded`, `size`, `className`.
14
14
  - **`Card`** — Generic content card. `title` heads it, with dimmed `subtitle` text beside it and `extra` actions at the right of the title row. `variant="framed"` draws the detached `Table`’s frame instead: the title row sits on a grey frame and the children in a bordered section inside it, so a card above a table, such as a chart over a log list, reads as part of the same set. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to a framed card. _Key props:_ `variant` (`CardVariant`: `default` | `framed`), `title`, `subtitle`, `extra`, `padding`, `footer`.
@@ -1 +1 @@
1
- {"version":3,"file":"ChatModelPicker.js","sources":["../../../src/components/Chat/ChatModelPicker.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useInsertionEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport Avatar from '../Avatar';\nimport CaretDownIcon from '../CustomIcons/CaretDownIcon';\nimport CaretRightIcon from '../CustomIcons/CaretRightIcon';\nimport CaretUpIcon from '../CustomIcons/CaretUpIcon';\nimport CheckIcon from '../CustomIcons/CheckIcon';\nimport PillButton from '../PillButton';\nimport { pushEscapeLayer } from '../escapeLayers';\nimport { usePopupLayer } from '../overlayLayers';\nimport { useOwnedByPopover } from '../popoverTree';\nimport { ensureOverlayStyles } from '../portalOverlay';\nimport { useTopLayer } from '../topLayer';\nimport { useFollowTrigger } from '../useFollowTrigger';\n\nexport interface ChatModelSubOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface ChatModelOption {\n value: string;\n label: string;\n /** The provider's mark. A URL, since providers ship logos rather than icon fonts. */\n iconSrc?: string;\n /** A second choice the model offers, e.g. how long it may think. */\n options?: ChatModelSubOption[];\n}\n\nexport interface ChatModelPickerProps {\n models: ChatModelOption[];\n value: string;\n /** The chosen sub-option, when the current model offers them. */\n optionValue?: string;\n /** Called with the model, and its sub-option when it has them. */\n onChange: (model: string, option?: string) => void;\n disabled?: boolean;\n /**\n * Opens upward. On by default: this sits under a composer at the bottom of a column, so\n * downward is almost always off-screen.\n */\n openUp?: boolean;\n 'aria-label'?: string;\n}\n\nconst VIEWPORT_PADDING = 8;\nconst PANEL_MIN_WIDTH = 220;\nconst SUBMENU_MIN_WIDTH = 240;\n\n/**\n * Inline rather than Tailwind: the panel is portalled to `document.body`, which the scoped\n * shadow stylesheet does not reach. Same reason `ActionMenu` styles its popover inline.\n */\nconst panelStyle = (\n position: { top: number; left: number; maxHeight?: number } | null,\n minWidth: number,\n): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n maxHeight: position?.maxHeight,\n overflowY: position?.maxHeight === undefined ? undefined : 'auto',\n minWidth,\n background: 'var(--malachite-card-background, rgb(255, 255, 255))',\n border: '1px solid var(--malachite-card-border, rgb(232, 232, 232))',\n borderRadius: 12,\n boxShadow: '0px 4px 12px rgba(0, 0, 0, 0.08)',\n padding: 4,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n\nconst ROW_STYLE: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n border: 'none',\n background: 'transparent',\n textAlign: 'left',\n width: '100%',\n cursor: 'pointer',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n};\n\nconst DESCRIPTION_STYLE: React.CSSProperties = {\n fontSize: 'var(--malachite-font-size-xsmall, 11px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nconst CHECK_STYLE: React.CSSProperties = {\n marginLeft: 'auto',\n display: 'inline-flex',\n color: 'var(--malachite-text-success, rgb(2, 122, 66))',\n};\n\n/**\n * Which model answers, and how hard it may think.\n *\n * Its own component rather than a `Dropdown`: that one is a form select bound to\n * react-hook-form, and this is a menu whose rows open a second menu. Portalled for the same\n * reason `ActionMenu` is — a panel inside the composer would be clipped by it.\n */\nconst ChatModelPicker: React.FC<ChatModelPickerProps> = ({\n models,\n value,\n optionValue,\n onChange,\n disabled = false,\n openUp = true,\n 'aria-label': ariaLabel = 'Model',\n}) => {\n const [open, setOpen] = useState(false);\n const [position, setPosition] = useState<{\n top: number;\n left: number;\n maxHeight: number;\n } | null>(null);\n const [submenuFor, setSubmenuFor] = useState<string | null>(null);\n const [submenuPosition, setSubmenuPosition] = useState<{ top: number; left: number } | null>(\n null,\n );\n const triggerRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const submenuRef = useRef<HTMLDivElement>(null);\n const submenuRowRef = useRef<HTMLElement | null>(null);\n const panelIdentity = usePopupLayer('actionmenu', open, panelRef);\n const submenuIdentity = usePopupLayer('actionmenu', open, submenuRef);\n\n useTopLayer(panelRef, open);\n useOwnedByPopover(\n useCallback(() => submenuRef.current, []),\n open,\n );\n\n const selected = models.find((model) => model.value === value);\n\n const place = useCallback(() => {\n const trigger = triggerRef.current;\n const panel = panelRef.current;\n\n if (!trigger) {\n return;\n }\n\n const rect = trigger.getBoundingClientRect();\n const width = panel?.offsetWidth || PANEL_MIN_WIDTH;\n // `scrollHeight`, not `offsetHeight`: once capped, the panel's own height says nothing\n // about whether the whole list would now fit. The difference is its border.\n const height = panel ? panel.scrollHeight + panel.offsetHeight - panel.clientHeight : 0;\n const maxLeft = window.innerWidth - width - VIEWPORT_PADDING;\n const left = Math.max(VIEWPORT_PADDING, Math.min(rect.right - width, maxLeft));\n const roomAbove = rect.top - 4 - VIEWPORT_PADDING;\n const roomBelow = window.innerHeight - rect.bottom - 4 - VIEWPORT_PADDING;\n const preferred = openUp ? roomAbove : roomBelow;\n const other = openUp ? roomBelow : roomAbove;\n // Flips when the chosen side has no room. With no room on either, it takes the side with\n // more and scrolls, so the panel is never off-screen however long the list.\n const flips = height > preferred && other > preferred;\n const goesUp = openUp !== flips;\n const room = goesUp ? roomAbove : roomBelow;\n const top = goesUp ? rect.top - 4 - Math.min(height, room) : rect.bottom + 4;\n\n setPosition({ top, left, maxHeight: room });\n }, [openUp]);\n\n // The submenu is placed from its row once; rather than leave it behind as the panel\n // follows the trigger, it closes, and hovering the row opens it again in place.\n const follow = useCallback(() => {\n setSubmenuFor(null);\n setSubmenuPosition(null);\n place();\n }, [place]);\n const close = useCallback(() => setOpen(false), []);\n\n useFollowTrigger(open, triggerRef, follow, close);\n\n useEffect(() => {\n if (!open) {\n setSubmenuFor(null);\n setSubmenuPosition(null);\n return;\n }\n\n place();\n\n const reposition = () => place();\n const closeOnOutside = (event: MouseEvent) => {\n // `composedPath`, not `event.target`: this listener is on `document`, and the\n // trigger lives in a shadow root, so the target is retargeted to the shadow HOST.\n // `contains` then says the trigger was not clicked, the menu closes on mousedown,\n // and the click that follows toggles it straight back open.\n const path = event.composedPath();\n const insideOwnUi = [triggerRef.current, panelRef.current, submenuRef.current].some(\n (node) => node !== null && path.includes(node),\n );\n\n if (!insideOwnUi) {\n setOpen(false);\n }\n };\n const popEscapeLayer = pushEscapeLayer(() => setOpen(false));\n\n window.addEventListener('resize', reposition);\n document.addEventListener('mousedown', closeOnOutside, true);\n\n return () => {\n window.removeEventListener('resize', reposition);\n document.removeEventListener('mousedown', closeOnOutside, true);\n popEscapeLayer();\n };\n }, [open, place]);\n\n useInsertionEffect(() => {\n if (open) {\n ensureOverlayStyles();\n }\n }, [open]);\n\n const openSubmenu = (model: ChatModelOption, row: HTMLElement) => {\n if (!model.options?.length) {\n setSubmenuFor(null);\n return;\n }\n\n const rect = row.getBoundingClientRect();\n const panelLeft = panelRef.current?.getBoundingClientRect().left ?? rect.left;\n // To the left of the parent panel by default, flipping right when that would clip.\n const toLeft = panelLeft - SUBMENU_MIN_WIDTH - 4;\n const left =\n toLeft >= VIEWPORT_PADDING\n ? toLeft\n : Math.min(\n (panelRef.current?.getBoundingClientRect().right ?? rect.right) + 4,\n window.innerWidth - SUBMENU_MIN_WIDTH - VIEWPORT_PADDING,\n );\n\n submenuRowRef.current = row;\n setSubmenuFor(model.value);\n setSubmenuPosition({ top: rect.top, left });\n };\n\n // The submenu goes with its row, and closes once the row has left the panel. Not closed\n // outright: tabbing to a row out of view opens its submenu and then scrolls it in, and closing\n // on that scroll would leave the row's efforts out of reach of the keyboard.\n const followRowOnScroll = () => {\n const row = submenuRowRef.current?.getBoundingClientRect();\n const panel = panelRef.current?.getBoundingClientRect();\n\n if (!row || !panel || row.top < panel.top || row.bottom > panel.bottom) {\n setSubmenuFor(null);\n setSubmenuPosition(null);\n return;\n }\n\n setSubmenuPosition((current) => current && { ...current, top: row.top });\n };\n\n const choose = (model: ChatModelOption, option?: ChatModelSubOption) => {\n onChange(model.value, option?.value);\n setOpen(false);\n };\n\n const submenuModel = models.find((model) => model.value === submenuFor);\n\n return (\n <>\n <div ref={triggerRef} className=\"inline-flex\">\n <PillButton\n label={selected?.label ?? value}\n icon={\n selected?.iconSrc ? (\n <Avatar src={selected.iconSrc} name={selected.label} size={14} />\n ) : undefined\n }\n trailingIcon={openUp ? <CaretUpIcon size={10} /> : <CaretDownIcon size={10} />}\n shape=\"tab\"\n size=\"small\"\n disabled={disabled}\n onClick={() => setOpen((wasOpen) => !wasOpen)}\n />\n </div>\n {open &&\n createPortal(\n <>\n <div\n ref={panelRef}\n role=\"menu\"\n aria-label={ariaLabel}\n // `actionmenu` rather than a new kind: the identity is a\n // host-facing allow-list, so a new class would need every host to\n // update its CSS, and this panel is an action menu in shape.\n {...panelIdentity}\n style={panelStyle(position, PANEL_MIN_WIDTH)}\n onScroll={followRowOnScroll}\n >\n {models.map((model) => (\n <button\n key={model.value}\n type=\"button\"\n role=\"menuitem\"\n aria-haspopup={model.options?.length ? 'menu' : undefined}\n style={ROW_STYLE}\n onMouseEnter={(event) =>\n openSubmenu(model, event.currentTarget)\n }\n onFocus={(event) => openSubmenu(model, event.currentTarget)}\n onClick={() =>\n model.options?.length\n ? choose(model, model.options[0])\n : choose(model)\n }\n >\n {model.iconSrc ? (\n <Avatar src={model.iconSrc} name={model.label} size={14} />\n ) : null}\n {model.label}\n {model.value === value ? (\n <span style={CHECK_STYLE}>\n <CheckIcon size={11} />\n </span>\n ) : null}\n {model.options?.length ? (\n <span\n style={{\n marginLeft: model.value === value ? 4 : 'auto',\n display: 'inline-flex',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n }}\n >\n <CaretRightIcon size={10} />\n </span>\n ) : null}\n </button>\n ))}\n </div>\n {submenuModel?.options?.length ? (\n <div\n ref={submenuRef}\n role=\"menu\"\n aria-label={`${submenuModel.label} options`}\n {...submenuIdentity}\n style={panelStyle(submenuPosition, SUBMENU_MIN_WIDTH)}\n >\n {submenuModel.options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n role=\"menuitem\"\n style={{ ...ROW_STYLE, alignItems: 'flex-start' }}\n onClick={() => choose(submenuModel, option)}\n >\n <span\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n }}\n >\n {option.label}\n {option.description ? (\n <span style={DESCRIPTION_STYLE}>\n {option.description}\n </span>\n ) : null}\n </span>\n {submenuModel.value === value &&\n option.value === optionValue ? (\n <span style={CHECK_STYLE}>\n <CheckIcon size={11} />\n </span>\n ) : null}\n </button>\n ))}\n </div>\n ) : null}\n </>,\n document.body,\n )}\n </>\n );\n};\n\nexport default ChatModelPicker;\nexport { ChatModelPicker };\n"],"names":["VIEWPORT_PADDING","PANEL_MIN_WIDTH","SUBMENU_MIN_WIDTH","panelStyle","position","minWidth","ROW_STYLE","DESCRIPTION_STYLE","CHECK_STYLE","ChatModelPicker","models","value","optionValue","onChange","disabled","openUp","ariaLabel","open","setOpen","useState","setPosition","submenuFor","setSubmenuFor","submenuPosition","setSubmenuPosition","triggerRef","useRef","panelRef","submenuRef","submenuRowRef","panelIdentity","usePopupLayer","submenuIdentity","useTopLayer","useOwnedByPopover","useCallback","selected","model","place","trigger","panel","rect","width","height","maxLeft","left","roomAbove","roomBelow","preferred","other","flips","goesUp","room","top","follow","close","useFollowTrigger","useEffect","reposition","closeOnOutside","event","path","node","popEscapeLayer","pushEscapeLayer","useInsertionEffect","ensureOverlayStyles","openSubmenu","row","_a","toLeft","_b","_c","followRowOnScroll","current","choose","option","submenuModel","jsxs","Fragment","jsx","PillButton","Avatar","CaretUpIcon","CaretDownIcon","wasOpen","createPortal","CheckIcon","CaretRightIcon"],"mappings":";;;;;;;;;;;;;;;AA8CA,MAAMA,IAAmB,GACnBC,IAAkB,KAClBC,IAAoB,KAMpBC,IAAa,CACfC,GACAC,OACuB;AAAA,EACvB,UAAU;AAAA,EACV,MAAKD,KAAA,gBAAAA,EAAU,QAAO;AAAA,EACtB,OAAMA,KAAA,gBAAAA,EAAU,SAAQ;AAAA,EACxB,WAAWA,KAAA,gBAAAA,EAAU;AAAA,EACrB,YAAWA,KAAA,gBAAAA,EAAU,eAAc,SAAY,SAAY;AAAA,EAC3D,UAAAC;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,WA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components/Chat/ChatModelPicker.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useInsertionEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport Avatar from '../Avatar';\nimport CaretDownIcon from '../CustomIcons/CaretDownIcon';\nimport CaretRightIcon from '../CustomIcons/CaretRightIcon';\nimport CaretUpIcon from '../CustomIcons/CaretUpIcon';\nimport CheckIcon from '../CustomIcons/CheckIcon';\nimport PillButton from '../PillButton';\nimport { pushEscapeLayer } from '../escapeLayers';\nimport { usePopupLayer } from '../overlayLayers';\nimport { useOwnedByPopover } from '../popoverTree';\nimport { ensureOverlayStyles } from '../portalOverlay';\nimport { useTopLayer } from '../topLayer';\nimport { useFollowTrigger } from '../useFollowTrigger';\n\nexport interface ChatModelSubOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface ChatModelOption {\n value: string;\n label: string;\n /** The provider's mark. A URL, since providers ship logos rather than icon fonts. */\n iconSrc?: string;\n /** A second choice the model offers, e.g. how long it may think. */\n options?: ChatModelSubOption[];\n}\n\nexport interface ChatModelPickerProps {\n models: ChatModelOption[];\n value: string;\n /** The chosen sub-option, when the current model offers them. */\n optionValue?: string;\n /** Called with the model, and its sub-option when it has them. */\n onChange: (model: string, option?: string) => void;\n disabled?: boolean;\n /**\n * Opens upward. On by default: this sits under a composer at the bottom of a column, so\n * downward is almost always off-screen.\n */\n openUp?: boolean;\n 'aria-label'?: string;\n}\n\nconst VIEWPORT_PADDING = 8;\nconst PANEL_MIN_WIDTH = 220;\nconst SUBMENU_MIN_WIDTH = 240;\n\n/**\n * Inline rather than Tailwind: the panel is portalled to `document.body`, which the scoped\n * shadow stylesheet does not reach. Same reason `ActionMenu` styles its popover inline.\n */\nconst panelStyle = (\n position: { top: number; left: number; maxHeight?: number } | null,\n minWidth: number,\n): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n maxHeight: position?.maxHeight,\n overflowY: position?.maxHeight === undefined ? undefined : 'auto',\n minWidth,\n background: 'var(--malachite-card-background, rgb(255, 255, 255))',\n border: '1px solid var(--malachite-card-border, rgb(232, 232, 232))',\n borderRadius: 12,\n boxShadow: '0px 4px 12px rgba(0, 0, 0, 0.08)',\n padding: 4,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n\nconst ROW_STYLE: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n border: 'none',\n background: 'transparent',\n textAlign: 'left',\n width: '100%',\n cursor: 'pointer',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n};\n\nconst DESCRIPTION_STYLE: React.CSSProperties = {\n fontSize: 'var(--malachite-font-size-xsmall, 11px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nconst CHECK_STYLE: React.CSSProperties = {\n marginLeft: 'auto',\n display: 'inline-flex',\n color: 'var(--malachite-text-success, rgb(2, 122, 66))',\n};\n\n/**\n * Which model answers, and how hard it may think.\n *\n * Its own component rather than a `Dropdown`: that one is a form select bound to\n * react-hook-form, and this is a menu whose rows open a second menu. Portalled for the same\n * reason `ActionMenu` is — a panel inside the composer would be clipped by it.\n */\nconst ChatModelPicker: React.FC<ChatModelPickerProps> = ({\n models,\n value,\n optionValue,\n onChange,\n disabled = false,\n openUp = true,\n 'aria-label': ariaLabel = 'Model',\n}) => {\n const [open, setOpen] = useState(false);\n const [position, setPosition] = useState<{\n top: number;\n left: number;\n maxHeight: number;\n } | null>(null);\n const [submenuFor, setSubmenuFor] = useState<string | null>(null);\n const [submenuPosition, setSubmenuPosition] = useState<{ top: number; left: number } | null>(\n null,\n );\n const triggerRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const submenuRef = useRef<HTMLDivElement>(null);\n const submenuRowRef = useRef<HTMLElement | null>(null);\n const panelIdentity = usePopupLayer('actionmenu', open, panelRef);\n const submenuIdentity = usePopupLayer('actionmenu', open, submenuRef);\n\n useTopLayer(panelRef, open);\n useOwnedByPopover(\n useCallback(() => submenuRef.current, []),\n open,\n );\n\n const selected = models.find((model) => model.value === value);\n\n const place = useCallback(() => {\n const trigger = triggerRef.current;\n const panel = panelRef.current;\n\n if (!trigger) {\n return;\n }\n\n const rect = trigger.getBoundingClientRect();\n const width = panel?.offsetWidth || PANEL_MIN_WIDTH;\n // `scrollHeight`, not `offsetHeight`: once capped, the panel's own height says nothing\n // about whether the whole list would now fit. The difference is its border.\n const height = panel ? panel.scrollHeight + panel.offsetHeight - panel.clientHeight : 0;\n const maxLeft = window.innerWidth - width - VIEWPORT_PADDING;\n const left = Math.max(VIEWPORT_PADDING, Math.min(rect.right - width, maxLeft));\n const roomAbove = rect.top - 4 - VIEWPORT_PADDING;\n const roomBelow = window.innerHeight - rect.bottom - 4 - VIEWPORT_PADDING;\n const preferred = openUp ? roomAbove : roomBelow;\n const other = openUp ? roomBelow : roomAbove;\n // Flips when the chosen side has no room. With no room on either, it takes the side with\n // more and scrolls, so the panel is never off-screen however long the list.\n const flips = height > preferred && other > preferred;\n const goesUp = openUp !== flips;\n const room = goesUp ? roomAbove : roomBelow;\n const top = goesUp ? rect.top - 4 - Math.min(height, room) : rect.bottom + 4;\n\n setPosition({ top, left, maxHeight: room });\n }, [openUp]);\n\n // Rather than leave the submenu behind as the panel follows the trigger, it closes, and\n // hovering the row opens it again in place. Scrolling inside the panel is `followRowOnScroll`.\n const follow = useCallback(() => {\n setSubmenuFor(null);\n setSubmenuPosition(null);\n place();\n }, [place]);\n const close = useCallback(() => setOpen(false), []);\n\n useFollowTrigger(open, triggerRef, follow, close);\n\n useEffect(() => {\n if (!open) {\n setSubmenuFor(null);\n setSubmenuPosition(null);\n return;\n }\n\n place();\n\n const reposition = () => place();\n const closeOnOutside = (event: MouseEvent) => {\n // `composedPath`, not `event.target`: this listener is on `document`, and the\n // trigger lives in a shadow root, so the target is retargeted to the shadow HOST.\n // `contains` then says the trigger was not clicked, the menu closes on mousedown,\n // and the click that follows toggles it straight back open.\n const path = event.composedPath();\n const insideOwnUi = [triggerRef.current, panelRef.current, submenuRef.current].some(\n (node) => node !== null && path.includes(node),\n );\n\n if (!insideOwnUi) {\n setOpen(false);\n }\n };\n const popEscapeLayer = pushEscapeLayer(() => setOpen(false));\n\n window.addEventListener('resize', reposition);\n document.addEventListener('mousedown', closeOnOutside, true);\n\n return () => {\n window.removeEventListener('resize', reposition);\n document.removeEventListener('mousedown', closeOnOutside, true);\n popEscapeLayer();\n };\n }, [open, place]);\n\n useInsertionEffect(() => {\n if (open) {\n ensureOverlayStyles();\n }\n }, [open]);\n\n const openSubmenu = (model: ChatModelOption, row: HTMLElement) => {\n if (!model.options?.length) {\n setSubmenuFor(null);\n return;\n }\n\n const rect = row.getBoundingClientRect();\n const panelLeft = panelRef.current?.getBoundingClientRect().left ?? rect.left;\n // To the left of the parent panel by default, flipping right when that would clip.\n const toLeft = panelLeft - SUBMENU_MIN_WIDTH - 4;\n const left =\n toLeft >= VIEWPORT_PADDING\n ? toLeft\n : Math.min(\n (panelRef.current?.getBoundingClientRect().right ?? rect.right) + 4,\n window.innerWidth - SUBMENU_MIN_WIDTH - VIEWPORT_PADDING,\n );\n\n submenuRowRef.current = row;\n setSubmenuFor(model.value);\n setSubmenuPosition({ top: rect.top, left });\n };\n\n // The submenu goes with its row, and closes once the row has left the panel. Not closed\n // outright: tabbing to a row out of view opens its submenu and then scrolls it in, and closing\n // on that scroll would leave the row's efforts out of reach of the keyboard.\n const followRowOnScroll = () => {\n const row = submenuRowRef.current?.getBoundingClientRect();\n const panel = panelRef.current?.getBoundingClientRect();\n\n if (!row || !panel || row.top < panel.top || row.bottom > panel.bottom) {\n setSubmenuFor(null);\n setSubmenuPosition(null);\n return;\n }\n\n setSubmenuPosition((current) => current && { ...current, top: row.top });\n };\n\n const choose = (model: ChatModelOption, option?: ChatModelSubOption) => {\n onChange(model.value, option?.value);\n setOpen(false);\n };\n\n const submenuModel = models.find((model) => model.value === submenuFor);\n\n return (\n <>\n <div ref={triggerRef} className=\"inline-flex\">\n <PillButton\n label={selected?.label ?? value}\n icon={\n selected?.iconSrc ? (\n <Avatar src={selected.iconSrc} name={selected.label} size={14} />\n ) : undefined\n }\n trailingIcon={openUp ? <CaretUpIcon size={10} /> : <CaretDownIcon size={10} />}\n shape=\"tab\"\n size=\"small\"\n disabled={disabled}\n onClick={() => setOpen((wasOpen) => !wasOpen)}\n />\n </div>\n {open &&\n createPortal(\n <>\n <div\n ref={panelRef}\n role=\"menu\"\n aria-label={ariaLabel}\n // `actionmenu` rather than a new kind: the identity is a\n // host-facing allow-list, so a new class would need every host to\n // update its CSS, and this panel is an action menu in shape.\n {...panelIdentity}\n style={panelStyle(position, PANEL_MIN_WIDTH)}\n onScroll={followRowOnScroll}\n >\n {models.map((model) => (\n <button\n key={model.value}\n type=\"button\"\n role=\"menuitem\"\n aria-haspopup={model.options?.length ? 'menu' : undefined}\n style={ROW_STYLE}\n onMouseEnter={(event) =>\n openSubmenu(model, event.currentTarget)\n }\n onFocus={(event) => openSubmenu(model, event.currentTarget)}\n onClick={() =>\n model.options?.length\n ? choose(model, model.options[0])\n : choose(model)\n }\n >\n {model.iconSrc ? (\n <Avatar src={model.iconSrc} name={model.label} size={14} />\n ) : null}\n {model.label}\n {model.value === value ? (\n <span style={CHECK_STYLE}>\n <CheckIcon size={11} />\n </span>\n ) : null}\n {model.options?.length ? (\n <span\n style={{\n marginLeft: model.value === value ? 4 : 'auto',\n display: 'inline-flex',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n }}\n >\n <CaretRightIcon size={10} />\n </span>\n ) : null}\n </button>\n ))}\n </div>\n {submenuModel?.options?.length ? (\n <div\n ref={submenuRef}\n role=\"menu\"\n aria-label={`${submenuModel.label} options`}\n {...submenuIdentity}\n style={panelStyle(submenuPosition, SUBMENU_MIN_WIDTH)}\n >\n {submenuModel.options.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n role=\"menuitem\"\n style={{ ...ROW_STYLE, alignItems: 'flex-start' }}\n onClick={() => choose(submenuModel, option)}\n >\n <span\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n }}\n >\n {option.label}\n {option.description ? (\n <span style={DESCRIPTION_STYLE}>\n {option.description}\n </span>\n ) : null}\n </span>\n {submenuModel.value === value &&\n option.value === optionValue ? (\n <span style={CHECK_STYLE}>\n <CheckIcon size={11} />\n </span>\n ) : null}\n </button>\n ))}\n </div>\n ) : null}\n </>,\n document.body,\n )}\n </>\n );\n};\n\nexport default ChatModelPicker;\nexport { ChatModelPicker };\n"],"names":["VIEWPORT_PADDING","PANEL_MIN_WIDTH","SUBMENU_MIN_WIDTH","panelStyle","position","minWidth","ROW_STYLE","DESCRIPTION_STYLE","CHECK_STYLE","ChatModelPicker","models","value","optionValue","onChange","disabled","openUp","ariaLabel","open","setOpen","useState","setPosition","submenuFor","setSubmenuFor","submenuPosition","setSubmenuPosition","triggerRef","useRef","panelRef","submenuRef","submenuRowRef","panelIdentity","usePopupLayer","submenuIdentity","useTopLayer","useOwnedByPopover","useCallback","selected","model","place","trigger","panel","rect","width","height","maxLeft","left","roomAbove","roomBelow","preferred","other","flips","goesUp","room","top","follow","close","useFollowTrigger","useEffect","reposition","closeOnOutside","event","path","node","popEscapeLayer","pushEscapeLayer","useInsertionEffect","ensureOverlayStyles","openSubmenu","row","_a","toLeft","_b","_c","followRowOnScroll","current","choose","option","submenuModel","jsxs","Fragment","jsx","PillButton","Avatar","CaretUpIcon","CaretDownIcon","wasOpen","createPortal","CheckIcon","CaretRightIcon"],"mappings":";;;;;;;;;;;;;;;AA8CA,MAAMA,IAAmB,GACnBC,IAAkB,KAClBC,IAAoB,KAMpBC,IAAa,CACfC,GACAC,OACuB;AAAA,EACvB,UAAU;AAAA,EACV,MAAKD,KAAA,gBAAAA,EAAU,QAAO;AAAA,EACtB,OAAMA,KAAA,gBAAAA,E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A;AAAA,cAAA;AAAA,cAzBCX,EAAO;AAAA,YAAA,CA2BnB;AAAA,UAAA;AAAA,QAAA,IAEL;AAAA,MAAA,GACR;AAAA,MACA,SAAS;AAAA,IAAA;AAAA,EACb,GACR;AAER;"}
@@ -1,134 +1,135 @@
1
1
  import { jsx as o, jsxs as E } from "react/jsx-runtime";
2
- import be, { useRef as D, useEffect as pe } from "react";
3
- import { DisclosureArrow as me } from "./DisclosureArrow.js";
4
- import { paintOnChild as he } from "./asChild.js";
5
- import { FOCUS_RING_INSET as Z, FOCUS_RING_INSET_OVERLAY_HIDDEN as ge } from "./focusRing.js";
6
- import { resolveRel as J } from "./linkRel.js";
7
- import { isRenderableNode as M } from "./renderableNode.js";
8
- import { safeHref as xe } from "./safeHref.js";
9
- import { FOREGROUND_RESET as ve, SELECTED_TEXT_CONTEXT as Ee, SELECTED_ROW_ACCENT as we, SELECTED_ROW_FOREGROUND as Ce, SELECTED_ROW_BACKGROUND as Q } from "./selectedRow.js";
10
- const Ne = {
2
+ import me, { useRef as D, useEffect as he } from "react";
3
+ import { DisclosureArrow as ge } from "./DisclosureArrow.js";
4
+ import { paintOnChild as xe } from "./asChild.js";
5
+ import { FOCUS_RING_INSET as ee, FOCUS_RING_INSET_OVERLAY_HIDDEN as ve } from "./focusRing.js";
6
+ import { resolveRel as M } from "./linkRel.js";
7
+ import { isRenderableNode as Q } from "./renderableNode.js";
8
+ import { safeHref as Ee } from "./safeHref.js";
9
+ import { FOREGROUND_RESET as we, SELECTED_TEXT_CONTEXT as Ce, SELECTED_ROW_ACCENT as Ne, SELECTED_ROW_FOREGROUND as Se, SELECTED_ROW_BACKGROUND as Z } from "./selectedRow.js";
10
+ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]", Re = {
11
11
  none: "",
12
12
  // The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.
13
13
  compact: "px-[16px] py-[8px]"
14
- }, Se = {
14
+ }, ye = {
15
15
  default: "",
16
16
  muted: "bg-[var(--malachite-card-dimmed-background)]",
17
17
  success: "bg-[var(--malachite-tag-success-background)]",
18
18
  error: "bg-[var(--malachite-tag-error-background)]"
19
- }, Re = {
19
+ }, _e = {
20
20
  success: "var(--malachite-tag-success-foreground)",
21
21
  error: "var(--malachite-tag-error-foreground)"
22
- }, ye = "opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100", _e = (r) => {
23
- var i;
24
- const n = r.getRootNode(), e = ((i = n.getSelection) == null ? void 0 : i.call(n)) ?? r.ownerDocument.getSelection();
22
+ }, ke = "opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100", Oe = (r) => {
23
+ var s;
24
+ const n = r.getRootNode(), e = ((s = n.getSelection) == null ? void 0 : s.call(n)) ?? r.ownerDocument.getSelection();
25
25
  if (!e || e.isCollapsed)
26
26
  return !1;
27
- for (let s = 0; s < e.rangeCount; s += 1)
28
- if (e.getRangeAt(s).intersectsNode(r))
27
+ for (let l = 0; l < e.rangeCount; l += 1)
28
+ if (e.getRangeAt(l).intersectsNode(r))
29
29
  return !0;
30
30
  return !1;
31
- }, ke = (r) => new r.constructor("click", r), Te = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", ee = (r) => {
31
+ }, Te = (r) => new r.constructor("click", r), Ae = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", te = (r) => {
32
32
  const {
33
33
  children: n,
34
34
  divider: a = !1,
35
35
  disabled: e = !1,
36
- selected: i,
37
- selection: s,
38
- tone: d = "default",
36
+ hover: s = !0,
37
+ selected: l,
38
+ selection: d,
39
+ tone: u = "default",
39
40
  inset: w = "none",
40
- className: b = "",
41
- style: C
42
- } = r, l = r.asChild === !0, {
43
- onClick: c,
44
- href: p,
45
- target: m,
41
+ className: m = "",
42
+ style: f
43
+ } = r, c = r.asChild === !0, {
44
+ onClick: i,
45
+ href: y,
46
+ target: S,
46
47
  rel: I,
47
- trailing: $,
48
- revealTrailing: P,
49
- leading: y,
50
- dimmed: B,
51
- role: u
52
- } = l ? {} : r, h = xe(p), F = l ? void 0 : r["aria-label"], U = l ? void 0 : r["aria-labelledby"], te = l ? void 0 : r.tabIndex, j = !!(c || h), ae = e && (j || l) ? "" : "transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]", oe = d !== "default", ne = Se[d], G = !l && M($), _ = Ne[w], ie = _ ? "" : "p-0", W = [
48
+ trailing: P,
49
+ revealTrailing: B,
50
+ leading: _,
51
+ dimmed: F,
52
+ role: b
53
+ } = c ? {} : r, h = Ee(y), U = c ? void 0 : r["aria-label"], j = c ? void 0 : r["aria-labelledby"], oe = c ? void 0 : r.tabIndex, G = !!(i || h), ne = e && (G || c) ? "" : s ? re : "", ie = u !== "default", le = ye[u], W = !c && Q(P), k = Re[w], ce = k ? "" : "p-0", H = [
53
54
  "w-full text-left border-0",
54
- ne,
55
+ le,
55
56
  a ? "border-b border-solid border-[var(--malachite-card-border)]" : "",
56
- ae
57
- ].filter(Boolean).join(" "), H = [
57
+ ne
58
+ ].filter(Boolean).join(" "), X = [
58
59
  "appearance-none",
59
- oe ? "" : "bg-transparent",
60
+ ie ? "" : "bg-transparent",
60
61
  e ? "" : "cursor-pointer"
61
- ], X = (t) => [W, ...t, _, b].filter(Boolean).join(" "), le = s ? s !== "announce" : u !== "checkbox", ce = s !== "tint", f = G && !!c && !h && !e, z = D(null), K = D(null), g = D(!1), se = (t) => {
62
+ ], V = (t) => [H, ...t, k, m].filter(Boolean).join(" "), se = d ? d !== "announce" : b !== "checkbox", de = d !== "tint", p = W && !!i && !h && !e, z = D(null), K = D(null), g = D(!1), ue = (t) => {
62
63
  g.current = t.target !== t.currentTarget;
63
- }, de = (t) => {
64
+ }, fe = (t) => {
64
65
  g.current || (g.current = t.target !== t.currentTarget);
65
66
  };
66
- pe(() => {
67
+ he(() => {
67
68
  const t = z.current;
68
- if (!f || !t)
69
+ if (!p || !t)
69
70
  return;
70
- const S = (v) => {
71
- const A = g.current;
71
+ const N = (v) => {
72
+ const L = g.current;
72
73
  g.current = !1;
73
- const L = K.current;
74
- !L || v.target !== t || A || v.detail <= 1 && !v.shiftKey && _e(t) || (v.stopPropagation(), L.focus({ preventScroll: !0 }), L.dispatchEvent(ke(v)));
74
+ const $ = K.current;
75
+ !$ || v.target !== t || L || v.detail <= 1 && !v.shiftKey && Oe(t) || (v.stopPropagation(), $.focus({ preventScroll: !0 }), $.dispatchEvent(Te(v)));
75
76
  };
76
- return t.addEventListener("click", S), () => t.removeEventListener("click", S);
77
- }, [f]);
78
- const ue = i === !0 && le ? {
79
- backgroundImage: `linear-gradient(${Q}, ${Q})`,
80
- color: Ce,
81
- ...ce ? { boxShadow: `inset 2px 0 0 ${we}` } : {},
82
- ...Ee
83
- } : {}, k = Re[d], N = { ...k ? {
84
- color: k,
85
- "--malachite-ctx-text-primary": k
86
- } : {}, ...ue, ...C }, T = u === "checkbox" && i === "mixed" ? "mixed" : u === "radio" || u === "checkbox" ? i === !0 : void 0, V = T === void 0 && i === !0 ? !0 : void 0, Y = {
87
- role: u,
77
+ return t.addEventListener("click", N), () => t.removeEventListener("click", N);
78
+ }, [p]);
79
+ const be = l === !0 && se ? {
80
+ backgroundImage: `linear-gradient(${Z}, ${Z})`,
81
+ color: Se,
82
+ ...de ? { boxShadow: `inset 2px 0 0 ${Ne}` } : {},
83
+ ...Ce
84
+ } : {}, O = _e[u], C = { ...O ? {
85
+ color: O,
86
+ "--malachite-ctx-text-primary": O
87
+ } : {}, ...be, ...f }, T = b === "checkbox" && l === "mixed" ? "mixed" : b === "radio" || b === "checkbox" ? l === !0 : void 0, Y = T === void 0 && l === !0 ? !0 : void 0, q = {
88
+ role: b,
88
89
  "aria-checked": T,
89
- "aria-current": V,
90
- "aria-label": F,
91
- "aria-labelledby": U,
92
- "aria-disabled": u && e ? !0 : void 0
90
+ "aria-current": Y,
91
+ "aria-label": U,
92
+ "aria-labelledby": j,
93
+ "aria-disabled": b && e ? !0 : void 0
93
94
  };
94
- if (l)
95
- return he(n, X([]), N);
95
+ if (c)
96
+ return xe(n, V([]), C);
96
97
  const R = {
97
- role: u,
98
- tabIndex: te,
98
+ role: b,
99
+ tabIndex: oe,
99
100
  "aria-checked": T,
100
- "aria-current": V,
101
- "aria-label": F,
102
- "aria-labelledby": U
103
- }, fe = M(y), q = y !== void 0 || B !== void 0, x = q ? /* @__PURE__ */ E("span", { className: "flex w-full min-w-0 items-center gap-[12px]", children: [
104
- fe && /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center", children: y }),
101
+ "aria-current": Y,
102
+ "aria-label": U,
103
+ "aria-labelledby": j
104
+ }, pe = Q(_), J = _ !== void 0 || F !== void 0, x = J ? /* @__PURE__ */ E("span", { className: "flex w-full min-w-0 items-center gap-[12px]", children: [
105
+ pe && /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center", children: _ }),
105
106
  /* @__PURE__ */ o(
106
107
  "span",
107
108
  {
108
- className: `grid flex-1 min-w-0 grid-cols-[minmax(0,1fr)] transition-opacity ${B ? "opacity-60" : ""}`,
109
+ className: `grid flex-1 min-w-0 grid-cols-[minmax(0,1fr)] transition-opacity ${F ? "opacity-60" : ""}`,
109
110
  children: n
110
111
  }
111
112
  )
112
113
  ] }) : n;
113
- if (G) {
114
+ if (W) {
114
115
  const t = e ? null : /* @__PURE__ */ o(
115
116
  "span",
116
117
  {
117
118
  "aria-hidden": "true",
118
119
  "data-malachite-row-ring": "",
119
- className: ge
120
+ className: ve
120
121
  }
121
- ), S = [
122
- ...H,
122
+ ), N = [
123
+ ...X,
123
124
  "outline-none border-0 p-0 flex-1 min-w-0 text-left"
124
- ].filter(Boolean).join(" "), A = !!h && !e ? /* @__PURE__ */ E(
125
+ ].filter(Boolean).join(" "), L = !!h && !e ? /* @__PURE__ */ E(
125
126
  "a",
126
127
  {
127
128
  href: h,
128
- target: m,
129
- rel: J(I, m),
130
- onClick: c,
131
- className: `${S} no-underline text-inherit`,
129
+ target: S,
130
+ rel: M(I, S),
131
+ onClick: i,
132
+ className: `${N} no-underline text-inherit`,
132
133
  "data-malachite-row-control": "",
133
134
  ...R,
134
135
  children: [
@@ -136,14 +137,14 @@ const Ne = {
136
137
  t
137
138
  ]
138
139
  }
139
- ) : c ? /* @__PURE__ */ E(
140
+ ) : i ? /* @__PURE__ */ E(
140
141
  "button",
141
142
  {
142
143
  ref: K,
143
144
  type: "button",
144
- onClick: c,
145
+ onClick: i,
145
146
  disabled: e,
146
- className: S,
147
+ className: N,
147
148
  "data-malachite-row-control": "",
148
149
  ...R,
149
150
  children: [
@@ -151,152 +152,166 @@ const Ne = {
151
152
  t
152
153
  ]
153
154
  }
154
- ) : /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", "data-malachite-row-control": "", ...Y, children: x });
155
+ ) : /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", "data-malachite-row-control": "", ...q, children: x });
155
156
  return /* @__PURE__ */ E(
156
157
  "div",
157
158
  {
158
159
  className: [
159
- W,
160
+ H,
160
161
  "relative flex items-center",
161
- f ? "cursor-pointer" : "",
162
- _,
163
- P ? "group/row" : "",
164
- b
162
+ p ? "cursor-pointer" : "",
163
+ k,
164
+ B ? "group/row" : "",
165
+ m
165
166
  ].filter(Boolean).join(" "),
166
- style: N,
167
+ style: C,
167
168
  "data-malachite-row": "",
168
169
  "data-disabled": e ? "" : void 0,
169
170
  ref: z,
170
- role: f ? "presentation" : void 0,
171
- onPointerDownCapture: f ? se : void 0,
172
- onPointerUpCapture: f ? de : void 0,
171
+ role: p ? "presentation" : void 0,
172
+ onPointerDownCapture: p ? ue : void 0,
173
+ onPointerUpCapture: p ? fe : void 0,
173
174
  children: [
174
- A,
175
+ L,
175
176
  /* @__PURE__ */ o(
176
177
  "div",
177
178
  {
178
- className: `shrink-0 flex items-center ${f ? "cursor-default" : ""} ${P ? ye : ""}`,
179
+ className: `shrink-0 flex items-center ${p ? "cursor-default" : ""} ${B ? ke : ""}`,
179
180
  "data-malachite-row-slot": "",
180
- children: $
181
+ children: P
181
182
  }
182
183
  )
183
184
  ]
184
185
  }
185
186
  );
186
187
  }
187
- const O = X(
188
- j ? [...H, ie, Z] : []
188
+ const A = V(
189
+ G ? [...X, ce, ee] : []
189
190
  );
190
191
  return h && !e ? /* @__PURE__ */ o(
191
192
  "a",
192
193
  {
193
194
  href: h,
194
- target: m,
195
- rel: J(I, m),
196
- onClick: c,
197
- className: `${O} no-underline text-inherit ${q ? "block" : ""}`,
198
- style: N,
195
+ target: S,
196
+ rel: M(I, S),
197
+ onClick: i,
198
+ className: `${A} no-underline text-inherit ${J ? "block" : ""}`,
199
+ style: C,
199
200
  ...R,
200
201
  children: x
201
202
  }
202
- ) : c ? /* @__PURE__ */ o(
203
+ ) : i ? /* @__PURE__ */ o(
203
204
  "button",
204
205
  {
205
206
  type: "button",
206
- onClick: c,
207
+ onClick: i,
207
208
  disabled: e,
208
- className: O,
209
- style: N,
209
+ className: A,
210
+ style: C,
210
211
  ...R,
211
212
  children: x
212
213
  }
213
- ) : /* @__PURE__ */ o("div", { className: O, style: N, ...Y, children: x });
214
- }, Oe = ({ children: r, className: n = "", style: a }) => /* @__PURE__ */ o("div", { className: n, style: a, onClick: (e) => e.stopPropagation(), children: r }), Xe = 39, Ae = Object.assign(
214
+ ) : /* @__PURE__ */ o("div", { className: A, style: C, ...q, children: x });
215
+ }, Le = ({ children: r, className: n = "", style: a }) => /* @__PURE__ */ o("div", { className: n, style: a, onClick: (e) => e.stopPropagation(), children: r }), ze = 39, $e = Object.assign(
215
216
  ({
216
217
  header: r,
217
218
  children: n,
218
219
  expanded: a,
219
220
  onToggle: e,
220
- sticky: i = !1,
221
- stickyTopOffset: s = 0,
221
+ sticky: s = !1,
222
+ stickyTopOffset: l = 0,
222
223
  divider: d = !1,
223
- tone: w = "default",
224
- "aria-label": b,
225
- className: C = "",
226
- style: l
224
+ tone: u = "default",
225
+ "aria-label": w,
226
+ className: m = "",
227
+ style: f
227
228
  }) => {
228
- const c = be.useId(), p = e ? () => e(!a) : void 0;
229
- return /* @__PURE__ */ E(ee, { divider: d, tone: w, className: C, style: l, children: [
229
+ const c = me.useId(), i = e ? () => e(!a) : void 0;
230
+ return (
231
+ // The hover is the header's, not the row's: the row holds the open body too, which is
232
+ // not a target, and tinting it washes out everything in it.
230
233
  /* @__PURE__ */ E(
231
- "div",
234
+ te,
232
235
  {
233
- className: `group flex items-center w-full ${p ? "cursor-pointer" : ""} ${i && a ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
234
- style: i && a ? { top: s } : void 0,
235
- onClick: p,
236
- role: "presentation",
236
+ divider: d,
237
+ tone: u,
238
+ hover: !1,
239
+ className: m,
240
+ style: f,
237
241
  children: [
238
- /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center pl-[16px] pr-[12px]", children: p && /* @__PURE__ */ o(
239
- "button",
242
+ /* @__PURE__ */ E(
243
+ "div",
240
244
  {
241
- type: "button",
242
- className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${Z}`,
243
- "aria-expanded": a,
244
- "aria-controls": c,
245
- "aria-label": b,
246
- onClick: (m) => {
247
- m.stopPropagation(), p();
248
- },
249
- children: /* @__PURE__ */ o(me, { expanded: a })
245
+ className: `group flex items-center w-full ${re} ${i ? "cursor-pointer" : ""} ${s && a ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
246
+ style: s && a ? { top: l } : void 0,
247
+ onClick: i,
248
+ role: "presentation",
249
+ children: [
250
+ /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center pl-[16px] pr-[12px]", children: i && /* @__PURE__ */ o(
251
+ "button",
252
+ {
253
+ type: "button",
254
+ className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${ee}`,
255
+ "aria-expanded": a,
256
+ "aria-controls": c,
257
+ "aria-label": w,
258
+ onClick: (y) => {
259
+ y.stopPropagation(), i();
260
+ },
261
+ children: /* @__PURE__ */ o(ge, { expanded: a })
262
+ }
263
+ ) }),
264
+ r
265
+ ]
250
266
  }
251
- ) }),
252
- r
267
+ ),
268
+ a && /* @__PURE__ */ o("div", { id: c, children: n })
253
269
  ]
254
270
  }
255
- ),
256
- a && /* @__PURE__ */ o("div", { id: c, children: n })
257
- ] });
271
+ )
272
+ );
258
273
  },
259
- { Controls: Oe }
260
- ), Le = {
274
+ { Controls: Le }
275
+ ), De = {
261
276
  default: "bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]",
262
277
  highlight: "bg-[var(--malachite-card-warm-background,rgb(244,242,240))]"
263
- }, De = "relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']", re = ({
278
+ }, Ie = "relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']", ae = ({
264
279
  children: r,
265
280
  padding: n = !1,
266
281
  overflow: a = "hidden",
267
282
  tone: e = "default",
268
- shadow: i = e !== "highlight",
269
- role: s,
283
+ shadow: s = e !== "highlight",
284
+ role: l,
270
285
  "aria-label": d,
271
- "aria-labelledby": w,
272
- className: b = "",
273
- style: C
286
+ "aria-labelledby": u,
287
+ className: w = "",
288
+ style: m
274
289
  }) => {
275
- const l = a === "clip" && !i && e === "default";
290
+ const f = a === "clip" && !s && e === "default";
276
291
  return /* @__PURE__ */ o(
277
292
  "div",
278
293
  {
279
- className: `w-full rounded-[var(--malachite-radius-xxl,14px)] ${l ? "overflow-visible" : a === "clip" ? "overflow-clip" : a === "visible" ? "overflow-visible" : "overflow-hidden"} ${Le[e]} ${n ? "py-3 px-4" : ""} ${l ? De : ""} ${b}`,
294
+ className: `w-full rounded-[var(--malachite-radius-xxl,14px)] ${f ? "overflow-visible" : a === "clip" ? "overflow-clip" : a === "visible" ? "overflow-visible" : "overflow-hidden"} ${De[e]} ${n ? "py-3 px-4" : ""} ${f ? Ie : ""} ${w}`,
280
295
  style: {
281
- ...i ? { boxShadow: Te } : {},
282
- ...l ? { clipPath: "inset(0 round var(--malachite-radius-xxl, 14px))" } : {},
283
- ...ve,
284
- ...C
296
+ ...s ? { boxShadow: Ae } : {},
297
+ ...f ? { clipPath: "inset(0 round var(--malachite-radius-xxl, 14px))" } : {},
298
+ ...we,
299
+ ...m
285
300
  },
286
- role: s,
301
+ role: l,
287
302
  "aria-label": d,
288
- "aria-labelledby": w,
303
+ "aria-labelledby": u,
289
304
  children: r
290
305
  }
291
306
  );
292
307
  };
293
- re.Row = ee;
294
- re.ExpandableRow = Ae;
308
+ ae.Row = te;
309
+ ae.ExpandableRow = $e;
295
310
  export {
296
- Xe as EXPANDABLE_ROW_LEAD_PX,
297
- re as Surface,
298
- Ae as SurfaceExpandableRow,
299
- ee as SurfaceRow,
300
- re as default
311
+ ze as EXPANDABLE_ROW_LEAD_PX,
312
+ ae as Surface,
313
+ $e as SurfaceExpandableRow,
314
+ te as SurfaceRow,
315
+ ae as default
301
316
  };
302
317
  //# sourceMappingURL=Surface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Surface.js","sources":["../../src/components/Surface.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { paintOnChild } from './asChild';\nimport { FOCUS_RING_INSET, FOCUS_RING_INSET_OVERLAY_HIDDEN } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\nimport {\n FOREGROUND_RESET,\n SELECTED_ROW_ACCENT,\n SELECTED_ROW_BACKGROUND,\n SELECTED_ROW_FOREGROUND,\n SELECTED_TEXT_CONTEXT,\n} from './selectedRow';\n\nexport type SurfaceTone = 'default' | 'highlight';\n\nexport interface SurfaceProps {\n children?: React.ReactNode;\n padding?: boolean;\n /**\n * Content overflow. Defaults to `hidden` so children are clipped to the rounded\n * corners. Use `clip` to keep the rounded clipping WITHOUT creating a scroll\n * container — so a `position: sticky` descendant still pins (unlike `hidden`,\n * which traps it). `visible` disables clipping entirely. A flat, default-tone `clip` card clips at its border.\n */\n overflow?: 'hidden' | 'visible' | 'clip';\n /**\n * `false` drops the elevation shadow, for a card that sits flat on its ground.\n * Default: `true`, or `false` with `tone=\"highlight\"`.\n */\n shadow?: boolean;\n /**\n * `highlight` paints the warm ground with no border and no shadow, for a static block that\n * stands out from the page, such as a hero or a guide's section header. Its ground is too\n * close to `Surface.Row`'s hover for clickable rows inside it.\n */\n tone?: SurfaceTone;\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\ninterface SurfaceRowChromeProps {\n children?: React.ReactNode;\n /** Renders a bottom divider — omit on the last row in a Surface. */\n divider?: boolean;\n /** Removes the hover affordance / disables the control (e.g. while loading/busy). */\n disabled?: boolean;\n /** Announces the row as selected — `aria-checked` under a `radio`/`checkbox` role,\n * `aria-current` otherwise — and paints `Table`'s selected treatment unless `selection`\n * says not to. `'mixed'` is for a `checkbox` row that is partly selected: it announces\n * `aria-checked=\"mixed\"` there, never paints and never marks the row current, and counts\n * as not selected under any other role. */\n selected?: boolean | 'mixed';\n /** How a `selected` row shows it. `highlight` paints the treatment; `tint` paints it\n * without the accent bar, for a menu whose choice is already marked inside the row;\n * `announce` leaves the visual to a control inside the row and only sets the ARIA state.\n * Defaults to `announce` under `role=\"checkbox\"` and `highlight` otherwise. */\n selection?: 'highlight' | 'tint' | 'announce';\n /**\n * Tints the whole row by what it reports. `muted` is a row whose subject is inactive —\n * not disabled: it stays interactive. `success` and `error` are for a row that carries\n * an outcome, where the result belongs to the whole line rather than to one cell in it.\n */\n tone?: 'default' | 'muted' | 'success' | 'error';\n /** `compact` is an 8px by 16px inset the row owns. */\n inset?: 'none' | 'compact';\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst INSET_CLASSES: Record<NonNullable<SurfaceRowChromeProps['inset']>, string> = {\n none: '',\n // The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.\n compact: 'px-[16px] py-[8px]',\n};\n\n/** Stays an interface under its original name: a consumer may `extends` it. */\nexport interface SurfaceRowProps extends SurfaceRowChromeProps {\n asChild?: false;\n /**\n * When provided, the whole row becomes clickable: it renders as a `<button>`\n * (or `<a>` when `href` is set), so the entire row is the click target with\n * native focus + Enter/Space — no manual tabIndex/key handlers. For a\n * selectable row, put a presentational `<Radio>`/`<Checkbox>` inside as the\n * visual indicator; do NOT nest an interactive control (invalid + double tab stop).\n */\n onClick?: (event: React.MouseEvent) => void;\n /** Renders the clickable row as an anchor instead of a button. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n /** Content pinned right, outside the row button, so it may hold its own control. */\n trailing?: React.ReactNode;\n /**\n * Shows `trailing` only while the row is hovered or holds focus, and while a menu\n * it opened is still open. Hidden by opacity, so it stays in the tab order; a touch screen,\n * which has no hover, always shows it.\n */\n revealTrailing?: boolean;\n /** The row's indicator, before the children. With this or `dimmed`, pass one child. */\n leading?: React.ReactNode;\n /** Fades the children, not `leading` or `trailing`. */\n dimmed?: boolean;\n /** ARIA role for a clickable row, e.g. `radio`/`checkbox` (wrap the list in a `radiogroup`). */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** `-1` takes the row out of the Tab order, for a roving radio group. */\n tabIndex?: number;\n}\n\n/**\n * The outcome tones reuse the tag tokens rather than minting row ones, so a row saying \"this\n * passed\" and a tag saying it are the same green wherever the two sit together.\n */\nconst TONE_CLASSES: Record<NonNullable<SurfaceRowProps['tone']>, string> = {\n default: '',\n muted: 'bg-[var(--malachite-card-dimmed-background)]',\n success: 'bg-[var(--malachite-tag-success-background)]',\n error: 'bg-[var(--malachite-tag-error-background)]',\n};\n\n/**\n * The text an outcome tone carries with it, through the same context channel a selected row\n * uses, so `Typography` inside the row follows the tint instead of staying near-black on it.\n * `color` as well, for row content that is not Typography.\n *\n * Only the outcome tones. `muted` dims its subject rather than recolouring it, and its\n * foreground is the ordinary one.\n */\nconst TONE_FOREGROUNDS: Partial<Record<NonNullable<SurfaceRowProps['tone']>, string>> = {\n success: 'var(--malachite-tag-success-foreground)',\n error: 'var(--malachite-tag-error-foreground)',\n};\n\nexport interface SurfaceRowAsChildProps extends SurfaceRowChromeProps {\n asChild: true;\n children: React.ReactElement;\n}\n\nexport type AnySurfaceRowProps = SurfaceRowProps | SurfaceRowAsChildProps;\n\n// Not `group-hover` or `group-has-[:focus-visible]`: WebKit never applies the first (its\n// `@media (hover: hover)` nested in the group selector) nor the second inside a shadow root,\n// so the control stayed hidden in Safari. An open menu takes focus out of the row into a\n// portal, and would otherwise lose its trigger.\nconst REVEALED_ON_INTERACTION =\n 'opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100';\n\nconst selectsTextIn = (row: Element): boolean => {\n const root = row.getRootNode();\n const ownSelection = (root as Partial<Pick<Document, 'getSelection'>>).getSelection?.();\n const selection = ownSelection ?? row.ownerDocument.getSelection();\n if (!selection || selection.isCollapsed) {\n return false;\n }\n for (let index = 0; index < selection.rangeCount; index += 1) {\n if (selection.getRangeAt(index).intersectsNode(row)) {\n return true;\n }\n }\n return false;\n};\n\nconst forwardedClick = (event: MouseEvent): MouseEvent =>\n new (event.constructor as typeof MouseEvent)('click', event);\n\nconst TRIPLE_SHADOW =\n '0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)';\n\n/**\n * A single full-bleed row inside a <Surface>. Owns the row chrome — hover\n * highlight, colour transition and an optional bottom divider — so consumers\n * compose their own content inside without re-implementing design-system styling.\n * Pass `onClick`/`href` to make the entire row clickable (rendered as a real\n * button/anchor, so keyboard navigation works natively).\n */\nconst SurfaceRow: React.FC<AnySurfaceRowProps> = (props) => {\n const {\n children,\n divider = false,\n disabled = false,\n selected,\n selection,\n tone = 'default',\n inset = 'none',\n className = '',\n style,\n } = props;\n const asChild = props.asChild === true;\n const {\n onClick,\n href: rawHref,\n target,\n rel,\n trailing,\n revealTrailing,\n leading,\n dimmed,\n role,\n } = asChild ? ({} as SurfaceRowProps) : (props as SurfaceRowProps);\n // A rejected href (e.g. `javascript:`) leaves the row a button or a plain row, never an anchor.\n const href = safeHref(rawHref);\n const ariaLabel = asChild ? undefined : (props as SurfaceRowProps)['aria-label'];\n const ariaLabelledBy = asChild ? undefined : (props as SurfaceRowProps)['aria-labelledby'];\n const tabIndex = asChild ? undefined : (props as SurfaceRowProps).tabIndex;\n const interactive = Boolean(onClick || href);\n // `asChild` is interactive for the hover affordance only, not the focus/reset classes.\n const hover =\n disabled && (interactive || asChild)\n ? ''\n : 'transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]';\n\n // A class, not an inline colour, which would outrank the hover utility. It replaces the\n // button reset's `bg-transparent` rather than joining it: same specificity, so the winner\n // would be whichever Tailwind emitted last.\n const tinted = tone !== 'default';\n const toneClass = TONE_CLASSES[tone];\n\n const hasTrailing = !asChild && isRenderableNode(trailing);\n const insetClass = INSET_CLASSES[inset];\n const controlPadding = insetClass ? '' : 'p-0';\n\n const chromeClasses = [\n 'w-full text-left border-0',\n toneClass,\n divider ? 'border-b border-solid border-[var(--malachite-card-border)]' : '',\n hover,\n ]\n .filter(Boolean)\n .join(' ');\n\n const controlReset = [\n 'appearance-none',\n tinted ? '' : 'bg-transparent',\n disabled ? '' : 'cursor-pointer',\n ];\n const rowClasses = (control: string[]) =>\n [chromeClasses, ...control, insetClass, className].filter(Boolean).join(' ');\n\n const paints = selection ? selection !== 'announce' : role !== 'checkbox';\n const accent = selection !== 'tint';\n\n const forwards = hasTrailing && Boolean(onClick) && !href && !disabled;\n const rowRef = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLButtonElement>(null);\n const pressLeftPadding = useRef(false);\n const startPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current = event.target !== event.currentTarget;\n };\n const trackPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current ||= event.target !== event.currentTarget;\n };\n useEffect(() => {\n const row = rowRef.current;\n if (!forwards || !row) {\n return undefined;\n }\n const forwardPaddingClick = (event: MouseEvent) => {\n const leftPadding = pressLeftPadding.current;\n pressLeftPadding.current = false;\n const control = controlRef.current;\n if (\n !control ||\n event.target !== row ||\n leftPadding ||\n (event.detail <= 1 && !event.shiftKey && selectsTextIn(row))\n ) {\n return;\n }\n event.stopPropagation();\n control.focus({ preventScroll: true });\n control.dispatchEvent(forwardedClick(event));\n };\n row.addEventListener('click', forwardPaddingClick);\n return () => row.removeEventListener('click', forwardPaddingClick);\n }, [forwards]);\n\n // A gradient layer so the tint composites over hover, and an inset shadow because\n // `ring-*` silently doesn't paint in a shadow root.\n const selectedStyle: React.CSSProperties =\n selected === true && paints\n ? {\n backgroundImage: `linear-gradient(${SELECTED_ROW_BACKGROUND}, ${SELECTED_ROW_BACKGROUND})`,\n color: SELECTED_ROW_FOREGROUND,\n ...(accent ? { boxShadow: `inset 2px 0 0 ${SELECTED_ROW_ACCENT}` } : {}),\n ...SELECTED_TEXT_CONTEXT,\n }\n : {};\n\n const toneForeground = TONE_FOREGROUNDS[tone];\n const toneStyle: React.CSSProperties = toneForeground\n ? ({\n color: toneForeground,\n '--malachite-ctx-text-primary': toneForeground,\n } as React.CSSProperties)\n : {};\n\n // `selected` last of the two: a row can be both, and selection is the state the reader is\n // acting on, so it wins the colour.\n const rowStyle = { ...toneStyle, ...selectedStyle, ...style };\n\n // Only a checkbox has a partly-checked state; a radio is chosen or not.\n const ariaChecked =\n role === 'checkbox' && selected === 'mixed'\n ? ('mixed' as const)\n : role === 'radio' || role === 'checkbox'\n ? selected === true\n : undefined;\n // `aria-current`, not `aria-pressed`: a selected row is one of many choices, not a toggle\n // (same call as `Dropdown`'s options). A role that carries its own state uses that instead.\n const ariaCurrent = ariaChecked === undefined && selected === true ? true : undefined;\n\n // Everything a control would have carried, for the branches that render none: the row\n // element is then the only thing assistive tech sees. `aria-disabled` because there is no\n // control to be natively disabled — and it is inert without a role, like the name.\n const rowFallbackAria = {\n role,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-disabled': role && disabled ? true : undefined,\n };\n\n if (asChild) {\n return paintOnChild(children, rowClasses([]), rowStyle);\n }\n\n // The set goes here, not on the wrapper: `radio` and `checkbox` make their\n // descendants presentational, which would bury a control in the trailing slot.\n const controlAria = {\n role,\n tabIndex,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n };\n\n const hasLeading = isRenderableNode(leading);\n const boxed = leading !== undefined || dimmed !== undefined;\n const content = boxed ? (\n <span className=\"flex w-full min-w-0 items-center gap-[12px]\">\n {hasLeading && <span className=\"shrink-0 flex items-center\">{leading}</span>}\n <span\n className={`grid flex-1 min-w-0 grid-cols-[minmax(0,1fr)] transition-opacity ${dimmed ? 'opacity-60' : ''}`}\n >\n {children}\n </span>\n </span>\n ) : (\n children\n );\n\n if (hasTrailing) {\n const focusRing = disabled ? null : (\n <span\n aria-hidden=\"true\"\n data-malachite-row-ring=\"\"\n className={FOCUS_RING_INSET_OVERLAY_HIDDEN}\n />\n );\n const rowControlClasses = [\n ...controlReset,\n 'outline-none border-0 p-0 flex-1 min-w-0 text-left',\n ]\n .filter(Boolean)\n .join(' ');\n const anchor = Boolean(href) && !disabled;\n const control = anchor ? (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${rowControlClasses} no-underline text-inherit`}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </a>\n ) : onClick ? (\n <button\n ref={controlRef}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={rowControlClasses}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </button>\n ) : (\n <div className=\"flex-1 min-w-0\" data-malachite-row-control=\"\" {...rowFallbackAria}>\n {content}\n </div>\n );\n\n return (\n <div\n className={[\n chromeClasses,\n 'relative flex items-center',\n forwards ? 'cursor-pointer' : '',\n insetClass,\n revealTrailing ? 'group/row' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={rowStyle}\n data-malachite-row=\"\"\n data-disabled={disabled ? '' : undefined}\n ref={rowRef}\n role={forwards ? 'presentation' : undefined}\n onPointerDownCapture={forwards ? startPress : undefined}\n onPointerUpCapture={forwards ? trackPress : undefined}\n >\n {control}\n <div\n className={`shrink-0 flex items-center ${forwards ? 'cursor-default' : ''} ${revealTrailing ? REVEALED_ON_INTERACTION : ''}`}\n data-malachite-row-slot=\"\"\n >\n {trailing}\n </div>\n </div>\n );\n }\n\n const classes = rowClasses(\n interactive ? [...controlReset, controlPadding, FOCUS_RING_INSET] : [],\n );\n\n if (href && !disabled) {\n return (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${classes} no-underline text-inherit ${boxed ? 'block' : ''}`}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </a>\n );\n }\n\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={classes}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </button>\n );\n }\n\n return (\n <div className={classes} style={rowStyle} {...rowFallbackAria}>\n {content}\n </div>\n );\n};\n\nexport interface SurfaceExpandableRowProps {\n /** The row itself, laid out across the line. May hold its own controls. */\n header: React.ReactNode;\n /** The body, rendered beneath the row while it is open. */\n children?: React.ReactNode;\n expanded: boolean;\n /** Omit for a row that cannot open. The arrow's space is still reserved, so a list of\n * rows stays in one column whether or not each one has a body. */\n onToggle?: (expanded: boolean) => void;\n /**\n * Pins the row while its body scrolls, so a long body never leaves the reader without\n * the line it belongs to. Offset by whatever is already pinned above it.\n */\n sticky?: boolean;\n stickyTopOffset?: number;\n divider?: boolean;\n tone?: SurfaceRowProps['tone'];\n /** Names the disclosure control, which is otherwise only an arrow. */\n 'aria-label'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/**\n * Stops a click inside it from toggling the row, for the cells that hold controls.\n *\n * Explicit rather than sniffing the event's target for an interactive ancestor: a control\n * rendering into a shadow root retargets the event to its host, so the sniff would miss\n * exactly the components most likely to sit in a row.\n */\nconst ExpandableRowControls: React.FC<{\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}> = ({ children, className = '', style }) => (\n <div className={className} style={style} onClick={(event) => event.stopPropagation()}>\n {children}\n </div>\n);\n\n/**\n * A row that opens to reveal a body, for a line that carries its own controls.\n *\n * Not `Accordion`: that puts its header inside the toggle button, so a header holding a\n * dropdown or a second button is invalid. Here the row surface takes the click and a cell\n * opts out with `ExpandableRow.Controls`, while the arrow stays a real button so the\n * keyboard reaches it.\n */\n/**\n * The space before the header: the arrow's own inset, its glyph and the gap after it.\n * Exported so a consumer aligning a column header above these rows offsets by the same\n * amount instead of guessing at it.\n */\nexport const EXPANDABLE_ROW_LEAD_PX = 39;\n\nconst SurfaceExpandableRow: React.FC<SurfaceExpandableRowProps> & {\n Controls: typeof ExpandableRowControls;\n} = Object.assign(\n ({\n header,\n children,\n expanded,\n onToggle,\n sticky = false,\n stickyTopOffset = 0,\n divider = false,\n tone = 'default',\n 'aria-label': ariaLabel,\n className = '',\n style,\n }: SurfaceExpandableRowProps) => {\n const bodyId = React.useId();\n const toggle = onToggle ? () => onToggle(!expanded) : undefined;\n\n return (\n <SurfaceRow divider={divider} tone={tone} className={className} style={style}>\n {/* `group` so the arrow takes its hover state from the whole row. */}\n <div\n className={`group flex items-center w-full ${toggle ? 'cursor-pointer' : ''} ${\n sticky && expanded\n ? 'sticky z-[1] bg-[var(--malachite-card-background)]'\n : ''\n }`}\n style={sticky && expanded ? { top: stickyTopOffset } : undefined}\n // Presentational: the arrow below is the keyboard control, and this only\n // widens the pointer target.\n onClick={toggle}\n role=\"presentation\"\n >\n {/* Reserved whether or not this row opens, so a list stays in one column.\n The inset and gap match Accordion's header. */}\n <span className=\"shrink-0 flex items-center pl-[16px] pr-[12px]\">\n {toggle && (\n <button\n type=\"button\"\n className={`appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${FOCUS_RING_INSET}`}\n aria-expanded={expanded}\n aria-controls={bodyId}\n aria-label={ariaLabel}\n onClick={(event) => {\n event.stopPropagation();\n toggle();\n }}\n >\n <DisclosureArrow expanded={expanded} />\n </button>\n )}\n </span>\n {header}\n </div>\n {expanded && <div id={bodyId}>{children}</div>}\n </SurfaceRow>\n );\n },\n { Controls: ExpandableRowControls },\n);\n\ninterface SurfaceComponent extends React.FC<SurfaceProps> {\n Row: React.FC<AnySurfaceRowProps>;\n ExpandableRow: typeof SurfaceExpandableRow;\n}\n\nconst SURFACE_TONE_CLASSES: Record<SurfaceTone, string> = {\n default:\n 'bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]',\n highlight: 'bg-[var(--malachite-card-warm-background,rgb(244,242,240))]',\n};\n\nconst FLAT_CLIP_RING =\n \"relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']\";\n\nconst Surface = (({\n children,\n padding = false,\n overflow = 'hidden',\n tone = 'default',\n shadow = tone !== 'highlight',\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}: SurfaceProps) => {\n // Literal class names (not interpolated) so Tailwind's JIT emits them.\n const clipsToBorder = overflow === 'clip' && !shadow && tone === 'default';\n const overflowClass = clipsToBorder\n ? 'overflow-visible'\n : overflow === 'clip'\n ? 'overflow-clip'\n : overflow === 'visible'\n ? 'overflow-visible'\n : 'overflow-hidden';\n return (\n <div\n className={`w-full rounded-[var(--malachite-radius-xxl,14px)] ${overflowClass} ${SURFACE_TONE_CLASSES[tone]} ${padding ? 'py-3 px-4' : ''} ${clipsToBorder ? FLAT_CLIP_RING : ''} ${className}`}\n style={{\n ...(shadow ? { boxShadow: TRIPLE_SHADOW } : {}),\n ...(clipsToBorder\n ? { clipPath: 'inset(0 round var(--malachite-radius-xxl, 14px))' }\n : {}),\n ...FOREGROUND_RESET,\n ...style,\n }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n}) as SurfaceComponent;\n\nSurface.Row = SurfaceRow;\nSurface.ExpandableRow = SurfaceExpandableRow;\n\nexport default Surface;\nexport { Surface, SurfaceRow, SurfaceExpandableRow };\n"],"names":["INSET_CLASSES","TONE_CLASSES","TONE_FOREGROUNDS","REVEALED_ON_INTERACTION","selectsTextIn","row","root","selection","_a","index","forwardedClick","event","TRIPLE_SHADOW","SurfaceRow","props","children","divider","disabled","selected","tone","inset","className","style","asChild","onClick","rawHref","target","rel","trailing","revealTrailing","leading","dimmed","role","href","safeHref","ariaLabel","ariaLabelledBy","tabIndex","interactive","hover","tinted","toneClass","hasTrailing","isRenderableNode","insetClass","controlPadding","chromeClasses","controlReset","rowClasses","control","paints","accent","forwards","rowRef","useRef","controlRef","pressLeftPadding","startPress","trackPress","useEffect","forwardPaddingClick","leftPadding","selectedStyle","SELECTED_ROW_BACKGROUND","SELECTED_ROW_FOREGROUND","SELECTED_ROW_ACCENT","SELECTED_TEXT_CONTEXT","toneForeground","rowStyle","ariaChecked","ariaCurrent","rowFallbackAria","paintOnChild","controlAria","hasLeading","boxed","content","jsxs","jsx","focusRing","FOCUS_RING_INSET_OVERLAY_HIDDEN","rowControlClasses","resolveRel","classes","FOCUS_RING_INSET","ExpandableRowControls","EXPANDABLE_ROW_LEAD_PX","SurfaceExpandableRow","header","expanded","onToggle","sticky","stickyTopOffset","bodyId","React","toggle","DisclosureArrow","SURFACE_TONE_CLASSES","FLAT_CLIP_RING","Surface","padding","overflow","shadow","clipsToBorder","FOREGROUND_RESET"],"mappings":";;;;;;;;;AA0EA,MAAMA,KAA6E;AAAA,EAC/E,MAAM;AAAA;AAAA,EAEN,SAAS;AACb,GAyCMC,KAAqE;AAAA,EACvE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACX,GAUMC,KAAkF;AAAA,EACpF,SAAS;AAAA,EACT,OAAO;AACX,GAaMC,KACF,0KAEEC,KAAgB,CAACC,MAA0B;;AAC7C,QAAMC,IAAOD,EAAI,YAAA,GAEXE,MADgBC,IAAAF,EAAiD,iBAAjD,gBAAAE,EAAA,KAAAF,OACYD,EAAI,cAAc,aAAA;AACpD,MAAI,CAACE,KAAaA,EAAU;AACxB,WAAO;AAEX,WAASE,IAAQ,GAAGA,IAAQF,EAAU,YAAYE,KAAS;AACvD,QAAIF,EAAU,WAAWE,CAAK,EAAE,eAAeJ,CAAG;AAC9C,aAAO;AAGf,SAAO;AACX,GAEMK,KAAiB,CAACC,MACpB,IAAKA,EAAM,YAAkC,SAASA,CAAK,GAEzDC,KACF,yGASEC,KAA2C,CAACC,MAAU;AACxD,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,WAAAX;AAAA,IACA,MAAAY,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,WAAAC,IAAY;AAAA,IACZ,OAAAC;AAAA,EAAA,IACAR,GACES,IAAUT,EAAM,YAAY,IAC5B;AAAA,IACF,SAAAU;AAAA,IACA,MAAMC;AAAA,IACN,QAAAC;AAAA,IACA,KAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,EAAA,IACAT,IAAW,CAAA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BL,KAAiB,EAAE,IAAI7E,CAAS;AAAA,MAC7L,OAAO;AAAA,QACH,GAAIiF,IAAS,EAAE,WAAW1F,GAAA,IAAkB,CAAA;AAAA,QAC5C,GAAI2F,IACE,EAAE,UAAU,mDAAA,IACZ,CAAA;AAAA,QACN,GAAGC;AAAA,QACH,GAAGlF;AAAA,MAAA;AAAA,MAEP,MAAAU;AAAA,MACA,cAAYG;AAAA,MACZ,mBAAiBC;AAAA,MAEhB,UAAArB;AAAA,IAAA;AAAA,EAAA;AAGb;AAEAoF,GAAQ,MAAMtF;AACdsF,GAAQ,gBAAgBZ;"}
1
+ {"version":3,"file":"Surface.js","sources":["../../src/components/Surface.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { paintOnChild } from './asChild';\nimport { FOCUS_RING_INSET, FOCUS_RING_INSET_OVERLAY_HIDDEN } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\nimport {\n FOREGROUND_RESET,\n SELECTED_ROW_ACCENT,\n SELECTED_ROW_BACKGROUND,\n SELECTED_ROW_FOREGROUND,\n SELECTED_TEXT_CONTEXT,\n} from './selectedRow';\n\nexport type SurfaceTone = 'default' | 'highlight';\n\nexport interface SurfaceProps {\n children?: React.ReactNode;\n padding?: boolean;\n /**\n * Content overflow. Defaults to `hidden` so children are clipped to the rounded\n * corners. Use `clip` to keep the rounded clipping WITHOUT creating a scroll\n * container — so a `position: sticky` descendant still pins (unlike `hidden`,\n * which traps it). `visible` disables clipping entirely. A flat, default-tone `clip` card clips at its border.\n */\n overflow?: 'hidden' | 'visible' | 'clip';\n /**\n * `false` drops the elevation shadow, for a card that sits flat on its ground.\n * Default: `true`, or `false` with `tone=\"highlight\"`.\n */\n shadow?: boolean;\n /**\n * `highlight` paints the warm ground with no border and no shadow, for a static block that\n * stands out from the page, such as a hero or a guide's section header. Its ground is too\n * close to `Surface.Row`'s hover for clickable rows inside it.\n */\n tone?: SurfaceTone;\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\ninterface SurfaceRowChromeProps {\n children?: React.ReactNode;\n /** Renders a bottom divider — omit on the last row in a Surface. */\n divider?: boolean;\n /** Removes the hover affordance / disables the control (e.g. while loading/busy). */\n disabled?: boolean;\n /** Announces the row as selected — `aria-checked` under a `radio`/`checkbox` role,\n * `aria-current` otherwise — and paints `Table`'s selected treatment unless `selection`\n * says not to. `'mixed'` is for a `checkbox` row that is partly selected: it announces\n * `aria-checked=\"mixed\"` there, never paints and never marks the row current, and counts\n * as not selected under any other role. */\n selected?: boolean | 'mixed';\n /** How a `selected` row shows it. `highlight` paints the treatment; `tint` paints it\n * without the accent bar, for a menu whose choice is already marked inside the row;\n * `announce` leaves the visual to a control inside the row and only sets the ARIA state.\n * Defaults to `announce` under `role=\"checkbox\"` and `highlight` otherwise. */\n selection?: 'highlight' | 'tint' | 'announce';\n /**\n * Tints the whole row by what it reports. `muted` is a row whose subject is inactive —\n * not disabled: it stays interactive. `success` and `error` are for a row that carries\n * an outcome, where the result belongs to the whole line rather than to one cell in it.\n */\n tone?: 'default' | 'muted' | 'success' | 'error';\n /** `compact` is an 8px by 16px inset the row owns. */\n inset?: 'none' | 'compact';\n /** `false` leaves the hover to something inside the row. */\n hover?: boolean;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst ROW_HOVER_CLASSES =\n 'transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]';\n\nconst INSET_CLASSES: Record<NonNullable<SurfaceRowChromeProps['inset']>, string> = {\n none: '',\n // The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.\n compact: 'px-[16px] py-[8px]',\n};\n\n/** Stays an interface under its original name: a consumer may `extends` it. */\nexport interface SurfaceRowProps extends SurfaceRowChromeProps {\n asChild?: false;\n /**\n * When provided, the whole row becomes clickable: it renders as a `<button>`\n * (or `<a>` when `href` is set), so the entire row is the click target with\n * native focus + Enter/Space — no manual tabIndex/key handlers. For a\n * selectable row, put a presentational `<Radio>`/`<Checkbox>` inside as the\n * visual indicator; do NOT nest an interactive control (invalid + double tab stop).\n */\n onClick?: (event: React.MouseEvent) => void;\n /** Renders the clickable row as an anchor instead of a button. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n /** Content pinned right, outside the row button, so it may hold its own control. */\n trailing?: React.ReactNode;\n /**\n * Shows `trailing` only while the row is hovered or holds focus, and while a menu\n * it opened is still open. Hidden by opacity, so it stays in the tab order; a touch screen,\n * which has no hover, always shows it.\n */\n revealTrailing?: boolean;\n /** The row's indicator, before the children. With this or `dimmed`, pass one child. */\n leading?: React.ReactNode;\n /** Fades the children, not `leading` or `trailing`. */\n dimmed?: boolean;\n /** ARIA role for a clickable row, e.g. `radio`/`checkbox` (wrap the list in a `radiogroup`). */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** `-1` takes the row out of the Tab order, for a roving radio group. */\n tabIndex?: number;\n}\n\n/**\n * The outcome tones reuse the tag tokens rather than minting row ones, so a row saying \"this\n * passed\" and a tag saying it are the same green wherever the two sit together.\n */\nconst TONE_CLASSES: Record<NonNullable<SurfaceRowProps['tone']>, string> = {\n default: '',\n muted: 'bg-[var(--malachite-card-dimmed-background)]',\n success: 'bg-[var(--malachite-tag-success-background)]',\n error: 'bg-[var(--malachite-tag-error-background)]',\n};\n\n/**\n * The text an outcome tone carries with it, through the same context channel a selected row\n * uses, so `Typography` inside the row follows the tint instead of staying near-black on it.\n * `color` as well, for row content that is not Typography.\n *\n * Only the outcome tones. `muted` dims its subject rather than recolouring it, and its\n * foreground is the ordinary one.\n */\nconst TONE_FOREGROUNDS: Partial<Record<NonNullable<SurfaceRowProps['tone']>, string>> = {\n success: 'var(--malachite-tag-success-foreground)',\n error: 'var(--malachite-tag-error-foreground)',\n};\n\nexport interface SurfaceRowAsChildProps extends SurfaceRowChromeProps {\n asChild: true;\n children: React.ReactElement;\n}\n\nexport type AnySurfaceRowProps = SurfaceRowProps | SurfaceRowAsChildProps;\n\n// Not `group-hover` or `group-has-[:focus-visible]`: WebKit never applies the first (its\n// `@media (hover: hover)` nested in the group selector) nor the second inside a shadow root,\n// so the control stayed hidden in Safari. An open menu takes focus out of the row into a\n// portal, and would otherwise lose its trigger.\nconst REVEALED_ON_INTERACTION =\n 'opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100';\n\nconst selectsTextIn = (row: Element): boolean => {\n const root = row.getRootNode();\n const ownSelection = (root as Partial<Pick<Document, 'getSelection'>>).getSelection?.();\n const selection = ownSelection ?? row.ownerDocument.getSelection();\n if (!selection || selection.isCollapsed) {\n return false;\n }\n for (let index = 0; index < selection.rangeCount; index += 1) {\n if (selection.getRangeAt(index).intersectsNode(row)) {\n return true;\n }\n }\n return false;\n};\n\nconst forwardedClick = (event: MouseEvent): MouseEvent =>\n new (event.constructor as typeof MouseEvent)('click', event);\n\nconst TRIPLE_SHADOW =\n '0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)';\n\n/**\n * A single full-bleed row inside a <Surface>. Owns the row chrome — hover\n * highlight, colour transition and an optional bottom divider — so consumers\n * compose their own content inside without re-implementing design-system styling.\n * Pass `onClick`/`href` to make the entire row clickable (rendered as a real\n * button/anchor, so keyboard navigation works natively).\n */\nconst SurfaceRow: React.FC<AnySurfaceRowProps> = (props) => {\n const {\n children,\n divider = false,\n disabled = false,\n hover: hoverable = true,\n selected,\n selection,\n tone = 'default',\n inset = 'none',\n className = '',\n style,\n } = props;\n const asChild = props.asChild === true;\n const {\n onClick,\n href: rawHref,\n target,\n rel,\n trailing,\n revealTrailing,\n leading,\n dimmed,\n role,\n } = asChild ? ({} as SurfaceRowProps) : (props as SurfaceRowProps);\n // A rejected href (e.g. `javascript:`) leaves the row a button or a plain row, never an anchor.\n const href = safeHref(rawHref);\n const ariaLabel = asChild ? undefined : (props as SurfaceRowProps)['aria-label'];\n const ariaLabelledBy = asChild ? undefined : (props as SurfaceRowProps)['aria-labelledby'];\n const tabIndex = asChild ? undefined : (props as SurfaceRowProps).tabIndex;\n const interactive = Boolean(onClick || href);\n // `asChild` is interactive for the hover affordance only, not the focus/reset classes.\n const hover = disabled && (interactive || asChild) ? '' : hoverable ? ROW_HOVER_CLASSES : '';\n\n // A class, not an inline colour, which would outrank the hover utility. It replaces the\n // button reset's `bg-transparent` rather than joining it: same specificity, so the winner\n // would be whichever Tailwind emitted last.\n const tinted = tone !== 'default';\n const toneClass = TONE_CLASSES[tone];\n\n const hasTrailing = !asChild && isRenderableNode(trailing);\n const insetClass = INSET_CLASSES[inset];\n const controlPadding = insetClass ? '' : 'p-0';\n\n const chromeClasses = [\n 'w-full text-left border-0',\n toneClass,\n divider ? 'border-b border-solid border-[var(--malachite-card-border)]' : '',\n hover,\n ]\n .filter(Boolean)\n .join(' ');\n\n const controlReset = [\n 'appearance-none',\n tinted ? '' : 'bg-transparent',\n disabled ? '' : 'cursor-pointer',\n ];\n const rowClasses = (control: string[]) =>\n [chromeClasses, ...control, insetClass, className].filter(Boolean).join(' ');\n\n const paints = selection ? selection !== 'announce' : role !== 'checkbox';\n const accent = selection !== 'tint';\n\n const forwards = hasTrailing && Boolean(onClick) && !href && !disabled;\n const rowRef = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLButtonElement>(null);\n const pressLeftPadding = useRef(false);\n const startPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current = event.target !== event.currentTarget;\n };\n const trackPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current ||= event.target !== event.currentTarget;\n };\n useEffect(() => {\n const row = rowRef.current;\n if (!forwards || !row) {\n return undefined;\n }\n const forwardPaddingClick = (event: MouseEvent) => {\n const leftPadding = pressLeftPadding.current;\n pressLeftPadding.current = false;\n const control = controlRef.current;\n if (\n !control ||\n event.target !== row ||\n leftPadding ||\n (event.detail <= 1 && !event.shiftKey && selectsTextIn(row))\n ) {\n return;\n }\n event.stopPropagation();\n control.focus({ preventScroll: true });\n control.dispatchEvent(forwardedClick(event));\n };\n row.addEventListener('click', forwardPaddingClick);\n return () => row.removeEventListener('click', forwardPaddingClick);\n }, [forwards]);\n\n // A gradient layer so the tint composites over hover, and an inset shadow because\n // `ring-*` silently doesn't paint in a shadow root.\n const selectedStyle: React.CSSProperties =\n selected === true && paints\n ? {\n backgroundImage: `linear-gradient(${SELECTED_ROW_BACKGROUND}, ${SELECTED_ROW_BACKGROUND})`,\n color: SELECTED_ROW_FOREGROUND,\n ...(accent ? { boxShadow: `inset 2px 0 0 ${SELECTED_ROW_ACCENT}` } : {}),\n ...SELECTED_TEXT_CONTEXT,\n }\n : {};\n\n const toneForeground = TONE_FOREGROUNDS[tone];\n const toneStyle: React.CSSProperties = toneForeground\n ? ({\n color: toneForeground,\n '--malachite-ctx-text-primary': toneForeground,\n } as React.CSSProperties)\n : {};\n\n // `selected` last of the two: a row can be both, and selection is the state the reader is\n // acting on, so it wins the colour.\n const rowStyle = { ...toneStyle, ...selectedStyle, ...style };\n\n // Only a checkbox has a partly-checked state; a radio is chosen or not.\n const ariaChecked =\n role === 'checkbox' && selected === 'mixed'\n ? ('mixed' as const)\n : role === 'radio' || role === 'checkbox'\n ? selected === true\n : undefined;\n // `aria-current`, not `aria-pressed`: a selected row is one of many choices, not a toggle\n // (same call as `Dropdown`'s options). A role that carries its own state uses that instead.\n const ariaCurrent = ariaChecked === undefined && selected === true ? true : undefined;\n\n // Everything a control would have carried, for the branches that render none: the row\n // element is then the only thing assistive tech sees. `aria-disabled` because there is no\n // control to be natively disabled — and it is inert without a role, like the name.\n const rowFallbackAria = {\n role,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-disabled': role && disabled ? true : undefined,\n };\n\n if (asChild) {\n return paintOnChild(children, rowClasses([]), rowStyle);\n }\n\n // The set goes here, not on the wrapper: `radio` and `checkbox` make their\n // descendants presentational, which would bury a control in the trailing slot.\n const controlAria = {\n role,\n tabIndex,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n };\n\n const hasLeading = isRenderableNode(leading);\n const boxed = leading !== undefined || dimmed !== undefined;\n const content = boxed ? (\n <span className=\"flex w-full min-w-0 items-center gap-[12px]\">\n {hasLeading && <span className=\"shrink-0 flex items-center\">{leading}</span>}\n <span\n className={`grid flex-1 min-w-0 grid-cols-[minmax(0,1fr)] transition-opacity ${dimmed ? 'opacity-60' : ''}`}\n >\n {children}\n </span>\n </span>\n ) : (\n children\n );\n\n if (hasTrailing) {\n const focusRing = disabled ? null : (\n <span\n aria-hidden=\"true\"\n data-malachite-row-ring=\"\"\n className={FOCUS_RING_INSET_OVERLAY_HIDDEN}\n />\n );\n const rowControlClasses = [\n ...controlReset,\n 'outline-none border-0 p-0 flex-1 min-w-0 text-left',\n ]\n .filter(Boolean)\n .join(' ');\n const anchor = Boolean(href) && !disabled;\n const control = anchor ? (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${rowControlClasses} no-underline text-inherit`}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </a>\n ) : onClick ? (\n <button\n ref={controlRef}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={rowControlClasses}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </button>\n ) : (\n <div className=\"flex-1 min-w-0\" data-malachite-row-control=\"\" {...rowFallbackAria}>\n {content}\n </div>\n );\n\n return (\n <div\n className={[\n chromeClasses,\n 'relative flex items-center',\n forwards ? 'cursor-pointer' : '',\n insetClass,\n revealTrailing ? 'group/row' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={rowStyle}\n data-malachite-row=\"\"\n data-disabled={disabled ? '' : undefined}\n ref={rowRef}\n role={forwards ? 'presentation' : undefined}\n onPointerDownCapture={forwards ? startPress : undefined}\n onPointerUpCapture={forwards ? trackPress : undefined}\n >\n {control}\n <div\n className={`shrink-0 flex items-center ${forwards ? 'cursor-default' : ''} ${revealTrailing ? REVEALED_ON_INTERACTION : ''}`}\n data-malachite-row-slot=\"\"\n >\n {trailing}\n </div>\n </div>\n );\n }\n\n const classes = rowClasses(\n interactive ? [...controlReset, controlPadding, FOCUS_RING_INSET] : [],\n );\n\n if (href && !disabled) {\n return (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${classes} no-underline text-inherit ${boxed ? 'block' : ''}`}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </a>\n );\n }\n\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={classes}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </button>\n );\n }\n\n return (\n <div className={classes} style={rowStyle} {...rowFallbackAria}>\n {content}\n </div>\n );\n};\n\nexport interface SurfaceExpandableRowProps {\n /** The row itself, laid out across the line. May hold its own controls. */\n header: React.ReactNode;\n /** The body, rendered beneath the row while it is open. */\n children?: React.ReactNode;\n expanded: boolean;\n /** Omit for a row that cannot open. The arrow's space is still reserved, so a list of\n * rows stays in one column whether or not each one has a body. */\n onToggle?: (expanded: boolean) => void;\n /**\n * Pins the row while its body scrolls, so a long body never leaves the reader without\n * the line it belongs to. Offset by whatever is already pinned above it.\n */\n sticky?: boolean;\n stickyTopOffset?: number;\n divider?: boolean;\n tone?: SurfaceRowProps['tone'];\n /** Names the disclosure control, which is otherwise only an arrow. */\n 'aria-label'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/**\n * Stops a click inside it from toggling the row, for the cells that hold controls.\n *\n * Explicit rather than sniffing the event's target for an interactive ancestor: a control\n * rendering into a shadow root retargets the event to its host, so the sniff would miss\n * exactly the components most likely to sit in a row.\n */\nconst ExpandableRowControls: React.FC<{\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}> = ({ children, className = '', style }) => (\n <div className={className} style={style} onClick={(event) => event.stopPropagation()}>\n {children}\n </div>\n);\n\n/**\n * A row that opens to reveal a body, for a line that carries its own controls.\n *\n * Not `Accordion`: that puts its header inside the toggle button, so a header holding a\n * dropdown or a second button is invalid. Here the row surface takes the click and a cell\n * opts out with `ExpandableRow.Controls`, while the arrow stays a real button so the\n * keyboard reaches it.\n */\n/**\n * The space before the header: the arrow's own inset, its glyph and the gap after it.\n * Exported so a consumer aligning a column header above these rows offsets by the same\n * amount instead of guessing at it.\n */\nexport const EXPANDABLE_ROW_LEAD_PX = 39;\n\nconst SurfaceExpandableRow: React.FC<SurfaceExpandableRowProps> & {\n Controls: typeof ExpandableRowControls;\n} = Object.assign(\n ({\n header,\n children,\n expanded,\n onToggle,\n sticky = false,\n stickyTopOffset = 0,\n divider = false,\n tone = 'default',\n 'aria-label': ariaLabel,\n className = '',\n style,\n }: SurfaceExpandableRowProps) => {\n const bodyId = React.useId();\n const toggle = onToggle ? () => onToggle(!expanded) : undefined;\n\n return (\n // The hover is the header's, not the row's: the row holds the open body too, which is\n // not a target, and tinting it washes out everything in it.\n <SurfaceRow\n divider={divider}\n tone={tone}\n hover={false}\n className={className}\n style={style}\n >\n {/* `group` so the arrow takes its hover state from the whole header line. */}\n <div\n className={`group flex items-center w-full ${ROW_HOVER_CLASSES} ${\n toggle ? 'cursor-pointer' : ''\n } ${\n sticky && expanded\n ? 'sticky z-[1] bg-[var(--malachite-card-background)]'\n : ''\n }`}\n style={sticky && expanded ? { top: stickyTopOffset } : undefined}\n // Presentational: the arrow below is the keyboard control, and this only\n // widens the pointer target.\n onClick={toggle}\n role=\"presentation\"\n >\n {/* Reserved whether or not this row opens, so a list stays in one column.\n The inset and gap match Accordion's header. */}\n <span className=\"shrink-0 flex items-center pl-[16px] pr-[12px]\">\n {toggle && (\n <button\n type=\"button\"\n className={`appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${FOCUS_RING_INSET}`}\n aria-expanded={expanded}\n aria-controls={bodyId}\n aria-label={ariaLabel}\n onClick={(event) => {\n event.stopPropagation();\n toggle();\n }}\n >\n <DisclosureArrow expanded={expanded} />\n </button>\n )}\n </span>\n {header}\n </div>\n {expanded && <div id={bodyId}>{children}</div>}\n </SurfaceRow>\n );\n },\n { Controls: ExpandableRowControls },\n);\n\ninterface SurfaceComponent extends React.FC<SurfaceProps> {\n Row: React.FC<AnySurfaceRowProps>;\n ExpandableRow: typeof SurfaceExpandableRow;\n}\n\nconst SURFACE_TONE_CLASSES: Record<SurfaceTone, string> = {\n default:\n 'bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]',\n highlight: 'bg-[var(--malachite-card-warm-background,rgb(244,242,240))]',\n};\n\nconst FLAT_CLIP_RING =\n \"relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']\";\n\nconst Surface = (({\n children,\n padding = false,\n overflow = 'hidden',\n tone = 'default',\n shadow = tone !== 'highlight',\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}: SurfaceProps) => {\n // Literal class names (not interpolated) so Tailwind's JIT emits them.\n const clipsToBorder = overflow === 'clip' && !shadow && tone === 'default';\n const overflowClass = clipsToBorder\n ? 'overflow-visible'\n : overflow === 'clip'\n ? 'overflow-clip'\n : overflow === 'visible'\n ? 'overflow-visible'\n : 'overflow-hidden';\n return (\n <div\n className={`w-full rounded-[var(--malachite-radius-xxl,14px)] ${overflowClass} ${SURFACE_TONE_CLASSES[tone]} ${padding ? 'py-3 px-4' : ''} ${clipsToBorder ? FLAT_CLIP_RING : ''} ${className}`}\n style={{\n ...(shadow ? { boxShadow: TRIPLE_SHADOW } : {}),\n ...(clipsToBorder\n ? { clipPath: 'inset(0 round var(--malachite-radius-xxl, 14px))' }\n : {}),\n ...FOREGROUND_RESET,\n ...style,\n }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n}) as SurfaceComponent;\n\nSurface.Row = SurfaceRow;\nSurface.ExpandableRow = SurfaceExpandableRow;\n\nexport default Surface;\nexport { Surface, SurfaceRow, SurfaceExpandableRow };\n"],"names":["ROW_HOVER_CLASSES","INSET_CLASSES","TONE_CLASSES","TONE_FOREGROUNDS","REVEALED_ON_INTERACTION","selectsTextIn","row","root","selection","_a","index","forwardedClick","event","TRIPLE_SHADOW","SurfaceRow","props","children","divider","disabled","hoverable","selected","tone","inset","className","style","asChild","onClick","rawHref","target","rel","trailing","revealTrailing","leading","dimmed","role","href","safeHref","ariaLabel","ariaLabelledBy","tabIndex","interactive","hover","tinted","toneClass","hasTrailing","isRenderableNode","insetClass","controlPadding","chromeClasses","controlReset","rowClasses","control","paints","accent","forwards","rowRef","useRef","controlRef","pressLeftPadding","startPress","trackPress","useEffect","forwardPaddingClick","leftPadding","selectedStyle","SELECTED_ROW_BACKGROUND","SELECTED_ROW_FOREGROUND","SELECTED_ROW_ACCENT","SELECTED_TEXT_CONTEXT","toneForeground","rowStyle","ariaChecked","ariaCurrent","rowFallbackAria","paintOnChild","controlAria","hasLeading","boxed","content","jsxs","jsx","focusRing","FOCUS_RING_INSET_OVERLAY_HIDDEN","rowControlClasses","resolveRel","classes","FOCUS_RING_INSET","ExpandableRowControls","EXPANDABLE_ROW_LEAD_PX","SurfaceExpandableRow","header","expanded","onToggle","sticky","stickyTopOffset","bodyId","React","toggle","DisclosureArrow","SURFACE_TONE_CLASSES","FLAT_CLIP_RING","Surface","padding","overflow","shadow","clipsToBorder","FOREGROUND_RESET"],"mappings":";;;;;;;;;AA4EA,MAAMA,KACF,6EAEEC,KAA6E;AAAA,EAC/E,MAAM;AAAA;AAAA,E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E,IAAI7E,CAAS;AAAA,MAC7L,OAAO;AAAA,QACH,GAAIiF,IAAS,EAAE,WAAW3F,GAAA,IAAkB,CAAA;AAAA,QAC5C,GAAI4F,IACE,EAAE,UAAU,mDAAA,IACZ,CAAA;AAAA,QACN,GAAGC;AAAA,QACH,GAAGlF;AAAA,MAAA;AAAA,MAEP,MAAAU;AAAA,MACA,cAAYG;AAAA,MACZ,mBAAiBC;AAAA,MAEhB,UAAAtB;AAAA,IAAA;AAAA,EAAA;AAGb;AAEAqF,GAAQ,MAAMvF;AACduF,GAAQ,gBAAgBZ;"}
package/dist/index.d.ts CHANGED
@@ -5358,6 +5358,8 @@ declare interface SurfaceRowChromeProps {
5358
5358
  tone?: 'default' | 'muted' | 'success' | 'error';
5359
5359
  /** `compact` is an 8px by 16px inset the row owns. */
5360
5360
  inset?: 'none' | 'compact';
5361
+ /** `false` leaves the hover to something inside the row. */
5362
+ hover?: boolean;
5361
5363
  className?: string;
5362
5364
  style?: default_2.CSSProperties;
5363
5365
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/malachite",
3
- "version": "2.93.1",
3
+ "version": "2.93.2",
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",