@stackone/malachite 2.130.1 → 2.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/COMPONENTS.md CHANGED
@@ -33,7 +33,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
33
33
  - **`GuideProgress`** — A progress line that follows the active step of a GuideTimeline. _Key props:_ `sections`, `active`, `className`, `aria-label`.
34
34
  - **`Popover`** — An anchored, non-modal panel for arbitrary content — a workspace switcher, an org flyout. The panel renders in its own shadow root, so malachite components inside it are styled, and joins the top layer like the other overlays. It prefers its `placement` and flips to the opposite side when there is no room, clamping along the other axis. Click-opened panels take focus and hand it back to the trigger on close; `openOn="hover"` also opens on focus and stays open while the pointer or focus is in the panel. A nested Popover counts as inside its parent for outside-press and hover dismissal, and Escape closes the topmost only. A click panel also closes when focus moves somewhere outside it and its trigger, and on close it hands focus back to the trigger only if focus would otherwise fall to the page. _Key props:_ `trigger`, `children`, `open`, `defaultOpen`, `onOpenChange`, `placement` (`bottom-start` | `bottom-end` | `top-start` | `top-end` | `top-center` | `right-start` | `right-end` | `left-start`), `openOn` (`click` | `hover`), `width` (`content` | `trigger`), `padding` (`none` | `small` | `medium`), `anchorRef` (position against another element, e.g. the section a trigger row sits in), `offset` (`small` 8px | `medium` 12px | `large` 14px), `elevation` (`default` | `raised`), `initialFocus` (a ref, or a function read when the panel is shown, for what takes focus in place of the first focusable; it is read again as the panel's content changes, so focus follows content that mounts late or a focused element that is removed, but never leaves an element the user moved to; `initialFocusRef` is its deprecated form, read on open only), `openOnArrowKey` (a click panel also opens, focus inside, on the arrow key its placement points at — ArrowDown for a `bottom-*` placement; a text field trigger keeps its arrow keys), `role` (`dialog` | `menu` | `listbox`; `menu` brings no roving focus of its own), `aria-label` or `aria-labelledby` (one is required), `className`. The panel is capped to the viewport width, and only overlays opened from inside it (menus, dropdowns, modals) count as inside for outside-press dismissal. A side placement stays level with its anchor and scrolls within the room below, sliding up only when under 160px is left. Parts for the panel body: `Popover.Header` (`title`, `action`, `divider` — `false` drops the rule and sits it 4px over the list, as its label), `Popover.Action` (`icon`, `aria-label`, `onClick`, `href` (a link that opens in a new tab on Cmd/Ctrl-click or a middle click; a plain click runs `onClick` when one is given), `disabled`, `tooltip`), `Popover.List` (a scrolling list; `scrollToSelected` scrolls the list, never the page, to its selected row, one marked `aria-current`, `aria-selected` or a checked radio, each time the popover is shown, once that row mounts), `Popover.Section` (a bordered section), `Popover.Empty` (an empty-state line), `Popover.Search` (pads a `Search` above the list without a second rule), `Popover.Note` (a footnote section in small secondary text) and `Popover.Status` (`message`, `tone` (`default` | `error`), `action` (`label`, `onClick`, `pending`), `focusable`): one `status` live region for the panel's life, announcing each message it is given and staying mounted, visually hidden, while there is none, so clear `message` rather than unmounting it. Errors announce through the same region. `focusable` with a ref makes it an `initialFocus` target; resolve to it only while it has a message, since an empty one is invisible. Reach for `Status` when the message changes while the panel is open or carries an action (loading, failed, sign-in needed), and `Empty` for a static line in a list that simply has nothing in it.
35
35
  - **`Modal`** — Centred dialog over a scrim, with header slots (icon/title/subtitle/extra), a scrolling body and a pinned footer. Locks background scroll and dismisses on ESC, the close button, or a scrim click unless `closeOnOverlayClick` is off; `busy` suppresses the two pointer routes while a request is in flight and sets `aria-busy`, so a stray click cannot tear the dialog down mid-write — but never ESC, which is the only guaranteed keyboard exit from a focus trap and so always reaches `onClose`. ESC, the Tab focus trap and `aria-modal` all apply to the topmost overlay only, so these may be stacked — a dialog opened from a panel keeps Tab to itself and the panel stops claiming to be modal. The Tab trap follows focus into a malachite popup portaled out of the dialog’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the dialog’s first control or escaping the dialog altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. Set `role="alertdialog"` for a consequential choice, which asks assistive tech to announce the body and not just the name, and point `aria-describedby` at whichever element carries it. Width comes from the `size` union (`small` 420px | `medium` 612px | `large` 760px | `fullscreen`, which fills the window in both directions) rather than a raw pixel prop. `titleAdornment` sits immediately after the title behind a hairline divider, for naming the thing being acted on — distinct from `headerExtra`, which pins to the far right. `tray` paints a tinted plate around the card and hangs a `caption` beneath it; the plate is the dialog element itself, so that caption stays inside the `aria-modal` subtree rather than being stranded outside it by the visual nesting, and it is added to `aria-describedby` automatically because it says what the dialog is asking. It takes a tone (`neutral` | `warning` | `error` | `success`) rather than a colour, so no consumer can paint it off-palette — and the tone sets the plate and its caption colour together, so the two cannot disagree. The caption is a `{ label?, message }` pair rather than a node, because its row height, type scale and colour belong to the plate. `size` names the card, and the plate’s 4px ring is added on top. Like `SidePanel` it sits in a z-index band from 1000 — one step per stacked overlay, so what paints on top is what holds the keyboard — and stays out of the browser top layer, so a host app’s own dialogs can still cover it. `callouts` stacks full-bleed `Alert` bands at the top of the body, as on `SidePanel`; they ignore `bodyPadding` and lead `aria-describedby`, ahead of the consumer’s own description and the tray caption. For a confirmation use `ConfirmationDialog`, which is a preset over this. _Key props:_ `open`, `onClose`, `title`, `subtitle`, `icon`, `headerExtra`, `titleAdornment`, `tray`, `callouts`, `renderLink`, `headerDivider`, `footer`, `size`, `showCloseButton`, `closeOnOverlayClick`, `bodyPadding`, `bodyHeight` (`auto` | `tall` — 600px, or the viewport less 160px when smaller, for an embedded iframe at `height: 100%`), `busy`, `role` (`dialog` | `alertdialog`), `aria-label`, `aria-labelledby`, `aria-describedby`.
36
- - **`SidePanel`** — Right-hand slide-in overlay panel (drawer) with header slots (back/icon/title/subtitle/extra), scrollable body and optional footer. `subtitlePlacement="below"` stacks the subtitle on its own line under the title row, so neither truncates the other in a narrow panel. `toolbar` pins content between the header and the scrolling body (16px sides, 16px above, 8px below, no divider), such as a Search over the list it filters. `toolbarPadding="body"` insets it 28px either side instead, level with the body, for a full-width row such as a `KeyValueStrip`. `SidePanel.Tabs`, rendered anywhere in the body, pins its `Tabs` strip under the header and toolbar (arrow keys open the tab they reach), always inset by the panel’s 28px gutter (with `bodyPadding={false}`, pad the panels 28px to line them up), and keeps its panels where it sits, so a child that owns its tabs needs no plumbing; panels mount the first time their tab opens and stay mounted, hidden, until it unmounts, each tab reopens at the scroll position it was left at, and a tabbed body keeps a stable scrollbar gutter so tabs of any length line up. Outside a `SidePanel` it renders as `Tabs`. Locks background scroll and dismisses on ESC, an overlay click or close. ESC and the Tab focus trap apply to the topmost overlay only, so a `Modal` may be stacked over it. The Tab trap follows focus into a malachite popup portaled out of the panel’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the panel’s first control or escaping the panel altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. `callouts` stacks full-bleed `Alert` bands at the top of the body, above `children` and unaffected by `bodyPadding` — the same band `ConfirmationDialog` gives its `callout` — and `renderLink` routes their root-relative markdown links through the app’s router. The callouts are announced as the panel’s description, ahead of `description`. `aside` opens a full-height column to the left, as wide again as `maxWidth`, for help that sits beside the content — a setup guide beside a form. The panel’s own header, body and footer keep their width and place, and the aside’s `title` (with an optional `headerExtra`, such as a `Stepper`) and `footer` line up with the panel’s header and footer; `bodyPadding` works as the panel’s does. The aside is never narrower than 360px, so a window too narrow for both columns scrolls the panel sideways. `onSubmit` makes the header, body and footer one `<form>` (`noValidate`, default prevented), so Enter in a field submits through a `type="submit"` footer button, as `FormActions` gives, the way a browser form does: not from a textarea, not mid-composition, and not while that button is disabled. Enter in the `toolbar` never submits, and the submit does not reach a form the panel is rendered inside. `sheet` raises a drill-in over the body and footer, dimming the panel’s header above it: its own header (`title`, `headerExtra`, a close button named from its `aria-label`), scrolling body and `footer`, with a shadow and scrim of its own (`shadows.sheet`, `overlay.sheetScrim`). The panel’s header, body, footer and aside are inert while it is up; it takes focus and hands it back to the control that opened it, or to the panel once it has moved on to another record, and ESC or a click on the dimmed panel around it, header included, calls the sheet’s `onClose`. A click on the page around the panel closes the sheet with it; a consumer that closes the panel through `open` clears its own sheet. `aside.layout: 'detached'` draws the aside as a card of its own on the warm ground, tucked behind the panel’s left edge, which slides out from behind it; `aside.open` puts it away and `aside.onOpenChange` adds a collapse button to its header and, while it is away, a tab on the panel’s edge (`aside.tabLabel`, with `aside.tabIcon` before it) to bring it back. `subtitleExtra` puts content at the far end of a `below` subtitle’s row, such as `Next: Preferences`. `progress` (0 to 1) draws an accent line along the foot of the header, for a multi-step form. `subheader` adds a band under the header with a rule below, for a wizard’s step and what comes next, leaving the header at its usual height; `progress` then runs along the band’s foot.
36
+ - **`SidePanel`** — Right-hand slide-in overlay panel (drawer) with header slots (back/icon/title/subtitle/extra), scrollable body and optional footer. `subtitlePlacement="below"` stacks the subtitle on its own line under the title row, so neither truncates the other in a narrow panel. `toolbar` pins content between the header and the scrolling body (16px sides, 16px above, 8px below, no divider), such as a Search over the list it filters. `toolbarPadding="body"` insets it 28px either side instead, level with the body, for a full-width row such as a `KeyValueStrip`. `SidePanel.Tabs`, rendered anywhere in the body, pins its `Tabs` strip under the header and toolbar (arrow keys open the tab they reach), always inset by the panel’s 28px gutter (with `bodyPadding={false}`, pad the panels 28px to line them up), and keeps its panels where it sits, so a child that owns its tabs needs no plumbing; panels mount the first time their tab opens and stay mounted, hidden, until it unmounts, each tab reopens at the scroll position it was left at, and a tabbed body keeps a stable scrollbar gutter so tabs of any length line up. Outside a `SidePanel` it renders as `Tabs`. Locks background scroll and dismisses on ESC, an overlay click or close. ESC and the Tab focus trap apply to the topmost overlay only, so a `Modal` may be stacked over it. The Tab trap follows focus into a malachite popup portaled out of the panel’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the panel’s first control or escaping the panel altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. `callouts` stacks full-bleed `Alert` bands at the top of the body, above `children` and unaffected by `bodyPadding` — the same band `ConfirmationDialog` gives its `callout` — and `renderLink` routes their root-relative markdown links through the app’s router. The callouts are announced as the panel’s description, ahead of `description`. `aside` opens a full-height column to the left, as wide again as `maxWidth`, for help that sits beside the content — a setup guide beside a form. The panel’s own header, body and footer keep their width and place, and the aside’s `title` (with an optional `headerExtra`, such as a `Stepper`) and `footer` line up with the panel’s header and footer; `bodyPadding` works as the panel’s does. The aside is never narrower than 360px, so a window too narrow for both columns scrolls the panel sideways. `onSubmit` makes the header, body and footer one `<form>` (`noValidate`, default prevented), so Enter in a field submits through a `type="submit"` footer button, as `FormActions` gives, the way a browser form does: not from a textarea, not mid-composition, and not while that button is disabled. Enter in the `toolbar` never submits, and the submit does not reach a form the panel is rendered inside. `sheet` raises a drill-in over the body and footer, dimming the panel’s header above it: its own header (`title`, `headerExtra`, a close button named from its `aria-label`), scrolling body and `footer`, with a shadow and scrim of its own (`shadows.sheet`, `overlay.sheetScrim`). The panel’s header, body, footer and aside are inert while it is up; it takes focus and hands it back to the control that opened it, or to the panel once it has moved on to another record, and ESC or a click on the dimmed panel around it, header included, calls the sheet’s `onClose`. A click on the page around the panel closes the sheet with it; a consumer that closes the panel through `open` clears its own sheet. `aside.layout: 'detached'` draws the aside as a card of its own on the warm ground, tucked behind the panel’s left edge, which slides out from behind it; `aside.open` puts it away and `aside.onOpenChange` adds a collapse button to its header and, while it is away, a tab on the panel’s edge (`aside.tabLabel`, with `aside.tabIcon` before it) to bring it back. `subtitleExtra` puts content at the far end of a `below` subtitle’s row, such as `Next: Preferences`. `progress` (0 to 1) draws an accent line along the foot of the header, for a multi-step form. `subheader` adds a band under the header with a rule below, for a wizard’s step and what comes next, leaving the header at its usual height; `progress` then runs along the band’s foot. `columns` (in place of `children`, typed as `SidePanelColumnsProps`) splits the body into full-height columns side by side, each `{ id, content, share, bodyPadding?, fill?, 'aria-label'? }`: `share` is its part of the width, a rule runs between them, `callouts` stay above them full width, and a `fill` column hands its height to content that scrolls itself (a `Chat`, say) where the others scroll on their own. Where the body is under 576px wide the columns stack, splitting the height by share, each at least 240px tall and scrolling itself, and the stack scrolls once those minimums overflow it, so the panel never scrolls sideways. `tray` is a full-width band between the body and the footer, up to 55% of the space below the header, scrolling itself; it and the columns are inert under a `sheet`.
37
37
  - **`useHasOpenOverlay`** — Hook reporting whether any modal-type overlay - `SidePanel` or `Modal` - is open anywhere in the app. For host chrome that has to get out of an overlay’s way, a floating support widget being the case it was added for: overlays render through a portal, so a host has no DOM signal of its own to read, and reading the library’s internal markers would couple it to something it does not own. Dropdowns and tooltips are deliberately not counted - they do not trap focus, and chrome does not need to move for them. _Key props:_ No arguments. Returns a boolean.
38
38
  - **`SidePanelNavFooter`** — Keyboard-hint footer for SidePanel: up/down keycaps to step between records, optional left/right keycaps to switch tabs, and an esc-to-close hint, with an optional right-aligned actions slot. `navigateLabel` and `escapeLabel` rename the two hints, for a footer that steps through something other than records, such as the steps of a log in a `SidePanel` `sheet`; a `navigateLabel` names the reader's place (`Step 2 of 5`), so it reads in the primary text colour.
39
39
 
@@ -68,7 +68,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
68
68
  - **`BaseFormComponent`** — Low-level base used by form controls; rarely used directly.
69
69
  - **`FormSectionHeading`** — Names a group of fields and rules off the space beside it, the way a long panel or settings page separates what it is asking for into parts. The label never shrinks — letting it flex clips the name long before the rule runs out of room — and it carries the same 8px inset a field label does, so a section name and the labels beneath it stand on one line. Quieter than `Typography.FormSectionTitle`, which titles a form rather than dividing one. `rule={false}` drops the rule, and it announces as a heading at `level`, so a long form can be navigated by section. _Key props:_ `children`, `rule`, `level` (2-6, default 3), `className`, `style`.
70
70
  - **`FieldGroup`** — Fields that follow from an answer given above them — the credentials a chosen authentication type asks for, say — drawn as its children: indented, with a rule down the side of the group. Stretches them to its own width, since a field left to size itself takes only the width of its content. _Key props:_ `children`, `gap` (default 40), `className`, `style`.
71
- - **`FormActions`** — A form’s Cancel and primary pair, end-aligned: a side panel’s footer, or under a settings section. `secondary` is the outline action and always `type="button"`, so a Cancel inside a form never submits it. `primary` is filled, or `tone="destructive"` for an action that deletes; give it `type: 'submit'` inside a form or a `SidePanel` with `onSubmit` and Enter in a field presses it. _Key props:_ `primary` (`label`, `onClick`, `disabled`, `loading`, `tooltip`, `tone`, `type`), `secondary` (`label`, `onClick`, `disabled`, `loading`, `tooltip`), `size` (`small` | `medium`, default medium), `className`.
71
+ - **`FormActions`** — A form’s Cancel and primary pair, end-aligned: a side panel’s footer, or under a settings section. `secondary` is the outline action and always `type="button"`, so a Cancel inside a form never submits it. `primary` is filled, or `tone="destructive"` for an action that deletes; give it `type: 'submit'` inside a form or a `SidePanel` with `onSubmit` and Enter in a field presses it. `note` puts secondary text at the start of the row, such as why the primary is disabled; the buttons stay end-aligned and wrap below it in a narrow row. _Key props:_ `primary` (`label`, `onClick`, `disabled`, `loading`, `tooltip`, `tone`, `type`), `secondary` (`label`, `onClick`, `disabled`, `loading`, `tooltip`), `size` (`small` | `medium`, default medium), `note`, `className`.
72
72
  - **`FieldBlock`** — Something a form has to show but does not ask for — a computed list, a generated value — wearing a field’s anatomy: label, optional `badge` beside it and `action` at the end of the row, content, then helper text, all on a field’s own metrics and inset. A real control brings its anatomy with it; this is for everything that has no control to bring one. _Key props:_ `label`, `badge`, `action`, `helperText`, `variant` (`default` | `field`; `field` sets the content at an input's full width and lines `action` up with an input's end button, for a box such as a list set among inputs), `children`, `className`, `style`.
73
73
  - **`Input`** — Single-line text input. Passing `formControl` is enough to show validation: the resolver's message renders on its own line beneath the field in the destructive colour, politely announced, with `aria-invalid` and `aria-describedby` wired and the in-field error icon standing down once the message carries the meaning, and the control reports its edits back so a rejection clears as the customer fixes the field rather than standing until the next submit. Given a `formControl` the form owns the value: the field paints an explicit `value` first, then the value the form holds, then `defaultValue`, then empty — the ladder react-hook-form's own `useController` computes — so `reset()` and `setValue()` repaint the field and the text on screen cannot drift from the value being validated, which had put a rejection under a field the customer could see was filled. Passing `defaultValue` to a bound field warns in development, naming the component and the field: where the form has an entry for it, it is ignored, and where it has none it paints text the form will never submit. Set it through `useForm({ defaultValues })` instead. A consumer's own `helperText` keeps its line above it and stays dimmed, since it explains the field rather than reporting the fault — replacing one with the other left a field ringed in red with nothing saying what was wrong. An explicit `error` still wins, for a rejection the resolver knows nothing about, and `error={false}` suppresses the resolver outright, message included. `requiredIndicator` switches the label between the library default of naming the optional fields, an `asterisk` on the required ones for designs drawn that way, and `none` for a field whose value is supplied rather than asked for — a locked control is still required, but a marker only sends the reader looking for something to fill in. Visual only: `aria-required` is set from `required` whichever is chosen. Long unbroken text in `helperText`, such as a URL, wraps rather than widening the field. `copyOnClick` makes a click anywhere on a copyable value copy it, under a copy cursor, with the whole value on hover. _Key props:_ `label`, `type`, `InputSize`, `InputVariant` (`default` | `ghost`), `required`, `requiredIndicator`, `error`, `helperText`, `loading`, `formControl`, `value`, `defaultValue`, `showCopyButton`, `showPasswordToggle`, `autoFocus`, `autoComplete` (defaults to `off`), `aria-label`, `aria-labelledby`, `id`.
74
74
  - **`TextArea`** — Multi-line text input. Shows resolver validation from `formControl` on exactly the same terms as `Input`: the message gets its own line beneath any `helperText`, which keeps its own, and the value climbs the same ladder — an explicit `value`, then the value the form holds, then `defaultValue`, then empty — a disabled field included, which used to show `defaultValue` whatever the form or the consumer had said. `requiredIndicator` switches the label between the library default of naming the optional fields, an `asterisk` on the required ones for designs drawn that way, and `none` for a field whose value is supplied rather than asked for — a locked control is still required, but a marker only sends the reader looking for something to fill in. Visual only: `aria-required` is set from `required` whichever is chosen. _Key props:_ `label`, `rows`, `maxLength`, `resize`, `required`, `requiredIndicator`, `error`, `helperText`, `loading`, `formControl`, `value`, `defaultValue`, `aria-label`, `aria-labelledby`, `id`.
@@ -1,40 +1,47 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import { Button as e } from "./Button.js";
3
- const b = ({
4
- primary: t,
5
- secondary: l,
6
- size: i = "medium",
7
- className: n = ""
8
- }) => /* @__PURE__ */ d("div", { className: `flex items-center justify-end gap-[8px] ${n}`, children: [
9
- l ? /* @__PURE__ */ o(
10
- e,
11
- {
12
- variant: "outline",
13
- size: i,
14
- type: "button",
15
- disabled: l.disabled,
16
- loading: l.loading,
17
- tooltip: l.tooltip,
18
- onClick: l.onClick,
19
- children: l.label
20
- }
21
- ) : null,
22
- t ? /* @__PURE__ */ o(
23
- e,
24
- {
25
- variant: t.tone === "destructive" ? "destructive" : "filled",
26
- size: i,
27
- type: t.type ?? "button",
28
- disabled: t.disabled,
29
- loading: t.loading,
30
- tooltip: t.tooltip,
31
- onClick: t.onClick,
32
- children: t.label
33
- }
34
- ) : null
35
- ] });
1
+ import { jsxs as o, Fragment as c, jsx as i } from "react/jsx-runtime";
2
+ import { Button as s } from "./Button.js";
3
+ const f = ({
4
+ primary: l,
5
+ secondary: t,
6
+ size: n = "medium",
7
+ note: e,
8
+ className: d = ""
9
+ }) => {
10
+ const a = /* @__PURE__ */ o(c, { children: [
11
+ t ? /* @__PURE__ */ i(
12
+ s,
13
+ {
14
+ variant: "outline",
15
+ size: n,
16
+ type: "button",
17
+ disabled: t.disabled,
18
+ loading: t.loading,
19
+ tooltip: t.tooltip,
20
+ onClick: t.onClick,
21
+ children: t.label
22
+ }
23
+ ) : null,
24
+ l ? /* @__PURE__ */ i(
25
+ s,
26
+ {
27
+ variant: l.tone === "destructive" ? "destructive" : "filled",
28
+ size: n,
29
+ type: l.type ?? "button",
30
+ disabled: l.disabled,
31
+ loading: l.loading,
32
+ tooltip: l.tooltip,
33
+ onClick: l.onClick,
34
+ children: l.label
35
+ }
36
+ ) : null
37
+ ] });
38
+ return e == null || e === !1 || e === "" ? /* @__PURE__ */ i("div", { className: `flex items-center justify-end gap-[8px] ${d}`, children: a }) : /* @__PURE__ */ o("div", { className: `flex flex-wrap items-center gap-x-[16px] gap-y-[8px] ${d}`, children: [
39
+ /* @__PURE__ */ i("div", { className: "min-w-0 flex-[1_1_240px] text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] text-[var(--malachite-text-secondary)]", children: e }),
40
+ /* @__PURE__ */ i("div", { className: "ml-auto flex items-center justify-end gap-[8px]", children: a })
41
+ ] });
42
+ };
36
43
  export {
37
- b as FormActions,
38
- b as default
44
+ f as FormActions,
45
+ f as default
39
46
  };
40
47
  //# sourceMappingURL=FormActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormActions.js","sources":["../../src/components/FormActions.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from './Button';\n\nexport interface FormAction {\n label: string;\n onClick?: () => void;\n disabled?: boolean;\n loading?: boolean;\n tooltip?: string;\n}\n\nexport interface FormPrimaryAction extends FormAction {\n /** `destructive` for an action that deletes or revokes. */\n tone?: 'default' | 'destructive';\n /**\n * `submit` makes it the form's submit button, so Enter in a field presses it. Leave `onClick`\n * off then and handle the form's `onSubmit` (a `SidePanel`'s, say), or a click runs both.\n */\n type?: 'button' | 'submit';\n}\n\nexport interface FormActionsProps {\n /** The filled action, last in the row. */\n primary?: FormPrimaryAction;\n /** The outline action before it, usually Cancel. */\n secondary?: FormAction;\n size?: 'small' | 'medium';\n className?: string;\n}\n\n/** A form's Cancel and primary pair, end-aligned: a side panel's footer, or under a settings section. */\nconst FormActions: React.FC<FormActionsProps> = ({\n primary,\n secondary,\n size = 'medium',\n className = '',\n}) => (\n <div className={`flex items-center justify-end gap-[8px] ${className}`}>\n {secondary ? (\n <Button\n variant=\"outline\"\n size={size}\n type=\"button\"\n disabled={secondary.disabled}\n loading={secondary.loading}\n tooltip={secondary.tooltip}\n onClick={secondary.onClick}\n >\n {secondary.label}\n </Button>\n ) : null}\n {primary ? (\n <Button\n variant={primary.tone === 'destructive' ? 'destructive' : 'filled'}\n size={size}\n type={primary.type ?? 'button'}\n disabled={primary.disabled}\n loading={primary.loading}\n tooltip={primary.tooltip}\n onClick={primary.onClick}\n >\n {primary.label}\n </Button>\n ) : null}\n </div>\n);\n\nexport default FormActions;\nexport { FormActions };\n"],"names":["FormActions","primary","secondary","size","className","jsxs","jsx","Button"],"mappings":";;AA+BA,MAAMA,IAA0C,CAAC;AAAA,EAC7C,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAChB,MACI,gBAAAC,EAAC,OAAA,EAAI,WAAW,2CAA2CD,CAAS,IAC/D,UAAA;AAAA,EAAAF,IACG,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAAQ;AAAA,MACR,MAAAJ;AAAA,MACA,MAAK;AAAA,MACL,UAAUD,EAAU;AAAA,MACpB,SAASA,EAAU;AAAA,MACnB,SAASA,EAAU;AAAA,MACnB,SAASA,EAAU;AAAA,MAElB,UAAAA,EAAU;AAAA,IAAA;AAAA,EAAA,IAEf;AAAA,EACHD,IACG,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAASN,EAAQ,SAAS,gBAAgB,gBAAgB;AAAA,MAC1D,MAAAE;AAAA,MACA,MAAMF,EAAQ,QAAQ;AAAA,MACtB,UAAUA,EAAQ;AAAA,MAClB,SAASA,EAAQ;AAAA,MACjB,SAASA,EAAQ;AAAA,MACjB,SAASA,EAAQ;AAAA,MAEhB,UAAAA,EAAQ;AAAA,IAAA;AAAA,EAAA,IAEb;AAAA,EAAA,CACR;"}
1
+ {"version":3,"file":"FormActions.js","sources":["../../src/components/FormActions.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from './Button';\n\nexport interface FormAction {\n label: string;\n onClick?: () => void;\n disabled?: boolean;\n loading?: boolean;\n tooltip?: string;\n}\n\nexport interface FormPrimaryAction extends FormAction {\n /** `destructive` for an action that deletes or revokes. */\n tone?: 'default' | 'destructive';\n /**\n * `submit` makes it the form's submit button, so Enter in a field presses it. Leave `onClick`\n * off then and handle the form's `onSubmit` (a `SidePanel`'s, say), or a click runs both.\n */\n type?: 'button' | 'submit';\n}\n\nexport interface FormActionsProps {\n /** The filled action, last in the row. */\n primary?: FormPrimaryAction;\n /** The outline action before it, usually Cancel. */\n secondary?: FormAction;\n size?: 'small' | 'medium';\n note?: React.ReactNode;\n className?: string;\n}\n\n/** A form's Cancel and primary pair, end-aligned: a side panel's footer, or under a settings section. */\nconst FormActions: React.FC<FormActionsProps> = ({\n primary,\n secondary,\n size = 'medium',\n note,\n className = '',\n}) => {\n const buttons = (\n <>\n {secondary ? (\n <Button\n variant=\"outline\"\n size={size}\n type=\"button\"\n disabled={secondary.disabled}\n loading={secondary.loading}\n tooltip={secondary.tooltip}\n onClick={secondary.onClick}\n >\n {secondary.label}\n </Button>\n ) : null}\n {primary ? (\n <Button\n variant={primary.tone === 'destructive' ? 'destructive' : 'filled'}\n size={size}\n type={primary.type ?? 'button'}\n disabled={primary.disabled}\n loading={primary.loading}\n tooltip={primary.tooltip}\n onClick={primary.onClick}\n >\n {primary.label}\n </Button>\n ) : null}\n </>\n );\n if (note === undefined || note === null || note === false || note === '') {\n return (\n <div className={`flex items-center justify-end gap-[8px] ${className}`}>{buttons}</div>\n );\n }\n return (\n <div className={`flex flex-wrap items-center gap-x-[16px] gap-y-[8px] ${className}`}>\n <div className=\"min-w-0 flex-[1_1_240px] text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] text-[var(--malachite-text-secondary)]\">\n {note}\n </div>\n <div className=\"ml-auto flex items-center justify-end gap-[8px]\">{buttons}</div>\n </div>\n );\n};\n\nexport default FormActions;\nexport { FormActions };\n"],"names":["FormActions","primary","secondary","size","note","className","buttons","jsxs","Fragment","jsx","Button"],"mappings":";;AAgCA,MAAMA,IAA0C,CAAC;AAAA,EAC7C,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IACF,gBAAAC,EAAAC,GAAA,EACK,UAAA;AAAA,IAAAN,IACG,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,SAAQ;AAAA,QACR,MAAAP;AAAA,QACA,MAAK;AAAA,QACL,UAAUD,EAAU;AAAA,QACpB,SAASA,EAAU;AAAA,QACnB,SAASA,EAAU;AAAA,QACnB,SAASA,EAAU;AAAA,QAElB,UAAAA,EAAU;AAAA,MAAA;AAAA,IAAA,IAEf;AAAA,IACHD,IACG,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,SAAST,EAAQ,SAAS,gBAAgB,gBAAgB;AAAA,QAC1D,MAAAE;AAAA,QACA,MAAMF,EAAQ,QAAQ;AAAA,QACtB,UAAUA,EAAQ;AAAA,QAClB,SAASA,EAAQ;AAAA,QACjB,SAASA,EAAQ;AAAA,QACjB,SAASA,EAAQ;AAAA,QAEhB,UAAAA,EAAQ;AAAA,MAAA;AAAA,IAAA,IAEb;AAAA,EAAA,GACR;AAEJ,SAA0BG,KAAS,QAAQA,MAAS,MAASA,MAAS,uBAE7D,OAAA,EAAI,WAAW,2CAA2CC,CAAS,IAAK,UAAAC,GAAQ,IAIrF,gBAAAC,EAAC,OAAA,EAAI,WAAW,wDAAwDF,CAAS,IAC7E,UAAA;AAAA,IAAA,gBAAAI,EAAC,OAAA,EAAI,WAAU,qIACV,UAAAL,GACL;AAAA,IACA,gBAAAK,EAAC,OAAA,EAAI,WAAU,mDAAmD,UAAAH,EAAA,CAAQ;AAAA,EAAA,GAC9E;AAER;"}