@stackone/malachite 2.132.0 → 2.134.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +5 -5
- package/dist/components/Button.js.map +1 -1
- package/dist/components/FormActions.js +13 -9
- package/dist/components/FormActions.js.map +1 -1
- package/dist/components/Input/Input.js +55 -54
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/KeyValueList.js +46 -37
- package/dist/components/KeyValueList.js.map +1 -1
- package/dist/components/Surface.js +1 -1
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +691 -637
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TextArea/TextArea.js +46 -46
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/buttonStyles.js +2 -0
- package/dist/components/buttonStyles.js.map +1 -1
- package/dist/index.d.ts +37 -6
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +11 -3
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
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`, `hover` (default on; `false` leaves the hover to something inside the row), `tone` (`default` | `muted` | `success` | `warning` | `error`; an outcome tone tints the row and recolours its text with that tag colour), `inset` (`
|
|
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` | `success` | `warning` | `error`; an outcome tone tints the row and recolours its text with that tag colour), `inset` (`compact`, the default, the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper; `none` for content that pads itself or runs edge to edge), `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. By default the title and subtitle shrink to whatever `extra` leaves them, and on a framed card are cut short with the full text in a tooltip; `wrapExtra` instead moves `extra` onto a line of its own under them, still at the right, when the title and subtitle together do not fit on one line beside it, and the header grows by that line. On a framed card `wrapExtra` also adds 6px above and below the title row, so an `extra` taller than 32px makes the header taller than 44px even when nothing wraps; use a small or medium control there. Keep text that changes width, such as a live save status, out of a wrapping `extra`, or the header jumps between one line and two as it changes. `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. `tone` (`CardTone`, the same `neutral` | `warning` | `error` | `success` as `Modal`’s tray) paints a framed card’s frame in that tray colour, for a verdict card; `neutral` keeps the default grey frame. Tone is colour alone, so the title has to say the outcome. It is a type error on a default card. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to a framed card. A framed card given no children is its title row alone, such as a question with its answer buttons in `extra`. _Key props:_ `variant` (`CardVariant`: `default` | `framed`), `tone` (`CardTone`, framed only), `title`, `subtitle`, `extra`, `wrapExtra`, `padding`, `footer`.
|
|
@@ -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
|
|
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, `tone="destructive"` for an action that deletes, or `tone="destructive-filled"` for the one action in a confirmation that can’t be taken back; 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`.
|
|
@@ -107,13 +107,13 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
107
107
|
- **`CommandPalette`** — Chrome for a command palette, over a headless library that keeps its own elements. `FieldRow`/`Field` take the query input, `List` the scrolling viewport (with a bottom fade for `hasMoreBelow`), `Group` + `Heading` a titled section, and `Row` one result — composing leading/label/tags/crumb/meta/status/hint so names start and statuses end on the same x down the list. `Message` covers empty and loading, `Legend` documents the scope sigils, `Footer` the key hints. Everything the library owns is taken through `asChild`, so its role, id, state and handlers are untouched.
|
|
108
108
|
- **`Keycap`** — One key on a keyboard, drawn as a cap — `esc`, `⌘`, a caret, or a sigil a user types to scope a search. Renders a `<kbd>`, or a button as soon as either `onClick` or `disabled` is passed — `disabled={false}` included, since naming the prop at all is the statement that the cap is a control. `SidePanelNavFooter` is built on it.
|
|
109
109
|
- **`CollapsibleSection`** — Collapsible sunken-card section (title - subtitle header, disclosure arrow right) for stacked detail sections in side panels and detail pages. A preset over `Accordion`’s `sunken` variant.
|
|
110
|
-
- **`KeyValueList`** — Bordered card of label/value rows (`KeyValueList.Row`) for entity details: fixed-width secondary labels, free-form values, row dividers. `truncate` keeps a long value (an ID) to one line with an ellipsis at the cell width and a tooltip only when it is actually cut off — the value itself when it is text, else the row’s `tooltip` (`null` turns it off). For inline content only: a Tag or AppLogo is clipped without an ellipsis, so use its own truncate, as with `CodeText truncate`. `size="small"` tightens the rows for a list inside a dialog or panel. _Key props:_ `size` (`small` | `medium`), `label`, `truncate`, `tooltip`.
|
|
110
|
+
- **`KeyValueList`** — Bordered card of label/value rows (`KeyValueList.Row`) for entity details: fixed-width secondary labels, free-form values, row dividers. `truncate` keeps a long value (an ID) to one line with an ellipsis at the cell width and a tooltip only when it is actually cut off — the value itself when it is text, else the row’s `tooltip` (`null` turns it off). For inline content only: a Tag or AppLogo is clipped without an ellipsis, so use its own truncate, as with `CodeText truncate`. `size="small"` tightens the rows for a list inside a dialog or panel. `labelWidth` (`KeyValueListLabelWidth`: `narrow` | `regular` | `wide`) sets the label column on the scale of the size, `regular` being the width it has always had; `narrow` gives the values room in a small window. `layout="balanced"` gives labels and values equal shrinkable columns, aligns values to the end, and ignores `labelWidth`; use `Typography.EllipsisText` for labels that must stay on one line. A row’s `trailing` action stays outside the truncated value so it remains usable. The default `layout="fixed"` preserves existing widths and alignment. _Key props:_ `size` (`small` | `medium`), `labelWidth`, `layout`, `label`, `truncate`, `tooltip`, `trailing`.
|
|
111
111
|
- **`KeyValueStrip`** — Label/value cells side by side in one sunken band, divided by rules (`KeyValueStrip.Item`), for the facts under a side panel’s header. Cells share the width equally and text values are small, in medium weight. `truncate` keeps a value to one line with an ellipsis and, for text, a tooltip only when it is cut off; with `truncate`, a given `tooltip` always shows, since it may say more than the value (a full id behind a shortened one), and `null` turns it off. `prefix` (an icon) and `suffix` (a copy button) stay whole while the value truncates. `tone` (`KeyValueStripTone`: `neutral` | `success` | `warning` | `error`) puts a dot before the label in that outcome’s colour, for a strip that summarises the stages of a check; it is colour alone, so the value has to say the outcome. For a vertical list of rows use `KeyValueList`. _Key props:_ `aria-label`, `label`, `tone`, `truncate`, `tooltip`, `prefix`, `suffix`.
|
|
112
112
|
|
|
113
113
|
## Buttons & actions
|
|
114
114
|
|
|
115
115
|
- **`BannerButton`** — A banner that is one button: the warm ground, an icon in a white tile, a title with one line under it, and an arrow at the end that darkens on hover. For an offer of help beside a form, such as opening its setup guide, that wants more presence than a link and less than a primary button. Pass `aria-expanded` when it opens and closes something. _Key props:_ `icon`, `title`, `description`, `trailing`, `onClick`, `aria-expanded`, `aria-controls`, `aria-label`.
|
|
116
|
-
- **`Button`** — Primary button. Variants: `filled`, `outline`, `surface` (outline's geometry on a ground of its own, for a control sitting on a tinted surface), `assistant` (the violet the assistant is named in — provenance, not a severity: it says who is being asked, not that anything is wrong), `destructive`, `success`, `warning`, `error`, `ghost`, `row-outline` (`ghost` until the `Surface.Row` whose `trailing` slot it sits in is hovered or holds focus, or its menu is open, then `outline`; always `outline` on a touch screen — a row control that stays quiet until its row is in play, in CSS alone), `quiet` (text only in the accent colour, for a secondary action such as Reset beside a primary one — accent, not success, because it is something to press rather than a status), `muted` (a recessed grey with secondary text, for a control whose subject is switched off, such as an account set to Not allowed; it stays clickable), `subtle` (secondary text on no ground that turns primary on hover or keyboard focus, for a row's secondary affordance such as its open chevron — unlike `ghost` it is grey with no border on hover, and unlike `muted` it has no ground and says nothing about its subject being off; icon-only at `xsmall` it is 20px, so it meets WCAG 2.5.8 only beside a larger control that does the same, such as a clickable row, or with 4px clear around it), `no-style`. Supports `flush` (pulls a borderless button out by its padding so its label lines up with the text around it), `iconOnly`, `loading`, `tooltip`. `leading` puts something that is not an icon, such as an avatar, before the label at its own size; `contentAlign="start"` starts the label at the leading edge and pins an end `icon` to the far edge, which with `flexGrow` makes a full-width switcher trigger — a project pill whose width comes from its container (e.g. a box `SIDEBAR_POPOVER_WIDTH_PX` wide, so it lines up with the `Sidebar.Panel` it opens). `type` is `button` unless set, so a Button in a form submits it only as `type="submit"`. _Key props:_ `variant`, `size`, `icon`, `iconPosition`, `leading`, `contentAlign` (`center` | `start`), `flexGrow` (fills the container), `width` (`auto` | `wide` — a 120px floor for a panel's or dialog's primary action), `iconOnly`, `loading`, `disabled`, `fill`, `tooltip`.
|
|
116
|
+
- **`Button`** — Primary button. Variants: `filled`, `outline`, `surface` (outline's geometry on a ground of its own, for a control sitting on a tinted surface), `assistant` (the violet the assistant is named in — provenance, not a severity: it says who is being asked, not that anything is wrong), `destructive`, `destructive-filled` (a solid red ground, for the one irreversible action in a confirmation), `success`, `warning`, `error`, `ghost`, `row-outline` (`ghost` until the `Surface.Row` whose `trailing` slot it sits in is hovered or holds focus, or its menu is open, then `outline`; always `outline` on a touch screen — a row control that stays quiet until its row is in play, in CSS alone), `quiet` (text only in the accent colour, for a secondary action such as Reset beside a primary one — accent, not success, because it is something to press rather than a status), `muted` (a recessed grey with secondary text, for a control whose subject is switched off, such as an account set to Not allowed; it stays clickable), `subtle` (secondary text on no ground that turns primary on hover or keyboard focus, for a row's secondary affordance such as its open chevron — unlike `ghost` it is grey with no border on hover, and unlike `muted` it has no ground and says nothing about its subject being off; icon-only at `xsmall` it is 20px, so it meets WCAG 2.5.8 only beside a larger control that does the same, such as a clickable row, or with 4px clear around it), `no-style`. Supports `flush` (pulls a borderless button out by its padding so its label lines up with the text around it), `iconOnly`, `loading`, `tooltip`. `leading` puts something that is not an icon, such as an avatar, before the label at its own size; `contentAlign="start"` starts the label at the leading edge and pins an end `icon` to the far edge, which with `flexGrow` makes a full-width switcher trigger — a project pill whose width comes from its container (e.g. a box `SIDEBAR_POPOVER_WIDTH_PX` wide, so it lines up with the `Sidebar.Panel` it opens). `type` is `button` unless set, so a Button in a form submits it only as `type="submit"`. _Key props:_ `variant`, `size`, `icon`, `iconPosition`, `leading`, `contentAlign` (`center` | `start`), `flexGrow` (fills the container), `width` (`auto` | `wide` — a 120px floor for a panel's or dialog's primary action), `iconOnly`, `loading`, `disabled`, `fill`, `tooltip`.
|
|
117
117
|
- **`SplitButton`** — One pill made of a primary action and a trailing menu trigger, sharing `Button`'s chrome: for an action with a default and a choice behind it, such as authorizing on every connected app or on one. The two segments are two real buttons, each with its own hover, active and keyboard focus, separated by a translucent seam that reads on every variant's ground; `disabled` and `loading` take both out together. The trigger shows a chevron pointing down while closed and up while `menuOpen`, which also sets `aria-expanded`, and is named by `menuLabel` since it shows no text. `trailing` sits after the label at its own size, for an `AvatarGroup` of what the action reaches. To open a `Popover` from the trigger, pass `menuTrigger`: it hands the segment to the Popover as its `trigger`, so the main segment stays a plain action rather than toggling the menu too. The menu itself is composed by the consumer from `Popover` and `Surface.Row`. _Key props:_ `variant` (every `Button` variant, default `filled`), `size` (default `medium`), `children`, `leading`, `trailing`, `onClick`, `type`, `loading`, `disabled`, `flexGrow`, `menuLabel`, `menuOpen`, `onMenuClick`, `menuIcon`, `menuHasPopup`, `menuRef`, `menuTrigger` (`(segment) => node`), `ref`, `className`, `style`.
|
|
118
118
|
- **`CloseButton`** — The bare X that dismisses a screen, panel or wizard: secondary at rest, primary on hover and keyboard focus, with no box or background at either. Use it instead of a `ghost` `Button` (which draws a hover box) or `no-style` (which has no disabled look). `surface="inverse"` is for a panel that stays dark in every theme, such as `SplitScreenLayout`’s, and reads the `closeButton` theme tokens. `loading` swaps the X for a spinner and sets `aria-busy`. Disabled and loading both use `aria-disabled` rather than `disabled`, so they ignore clicks but stay focusable and can still trigger a `Tooltip` explaining why. Named "Close" unless `aria-label` says otherwise. _Key props:_ `onClick`, `aria-label`, `size` (`small` 24px | `medium` 32px, 12px glyph), `surface` (`default` | `inverse`), `disabled`, `loading`.
|
|
119
119
|
- **`AccessPills`** — Three toggle pills, R / W / D, saying which effects an account grants (Read, Write, Delete) — on a linked-account row and in the header above the rows. Each pill is a button with `aria-pressed`, named in full by its state (`Write: some actions off`), and a tooltip on hover and focus spells that name out, since a letter alone is cryptic. On paints the effect’s tint (Read in `Tag`’s primary, Write in warning, Delete in error, the colours the dashboard already gives these effects), `"mixed"` (some, not all, of its actions on) an empty pill with a dashed border, off a neutral one. The colours come from the theme and there is no colour prop. It reports only which pill was pressed through `onToggle`: any cascade between effects (Read off turning Write and Delete off, say) and what pressing a mixed pill means belong to the caller. A pill in `disabled` stays focusable with `aria-disabled`, ignores clicks and keys, and its tooltip shows `disabledReason` instead, which is also its accessible description. `size="dense"` draws 24×20 pills in place of 26×24, for a narrow screen. _Key props:_ `value` (`{ read, write, delete }`, each `true` | `false` | `"mixed"`), `onToggle(effect)`, `disabled` (per effect), `disabledReason` (per effect, or one string), `size` (`default` | `dense`), `aria-label`, `aria-labelledby`.
|
|
@@ -135,7 +135,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
135
135
|
- **`TimeBarChart`** — Counts per time bucket as stacked bars on a UTC axis, the request-volume chart above a log list. Every bucket in `range` takes a slot whether or not it has data, so gaps read as gaps; a zone-less time string is read as UTC. Hover or arrow-key through buckets for a tooltip listing every series and the total; `highlightTime` shades the bucket holding a time from elsewhere on the page, such as the hovered log row. With `onRangeSelect`, dragging across bars reports the whole buckets covered, `end` exclusive so it goes straight back in as `range`, and whether the selection takes in the last bucket. `loading` dims bars already drawn rather than replacing them, and shows a spinner only when there is nothing to dim. Series colours follow the theme’s status tokens by `tone`, and failures always stack above successes whatever order `series` comes in, so position separates them where colour alone might not; a legend names them unless `legend={false}`. A visually hidden table carries the same numbers for screen readers. _Key props:_ `series` (`{ key, label, tone }[]`, stacked by tone with `error` on top; `TimeBarChartTone`: `success` | `error` | `neutral`), `buckets` (`{ start, values }[]`), `interval` (`{ unit, step }`; `TimeBarChartUnit`: `minute` | `hour` | `day` | `week` | `month`), `range` (`end` exclusive, as a selection reports it; at most 2,000 buckets, the newest kept), `TimeBarChartSize` (`small` | `medium` | `large`), `loading`, `error`, `errorTitle`, `errorSubTitle`, `valueLabel`, `legend`, `highlightTime`, `onRangeSelect`, `aria-label`, `aria-labelledby`, `className`, `style`.
|
|
136
136
|
- **`TimeBarChartSwatch`** — The mark a `TimeBarChart` draws a series in, by its `tone`, for naming the series somewhere other than the chart's legend, such as a count beside the chart standing in for it. It matches the legend and the tooltip, and the bars draw the same colour at 40%; it follows the theme with them. Decorative: the label beside it does the naming. _Key props:_ `tone` (`TimeBarChartTone`).
|
|
137
137
|
- **`Timeline`** — A vertical sequence of steps as an ordered list (`Timeline.Item`): a dot on a connecting line, a title, its timing at the right and a free-form body below, such as what happened to one API call. `titleCode` sets code after the title in the mono face as one phrase with it, such as `n8n called` then `Salesforce | Delete contact`. The dot is painted by `tone` from the theme’s text tokens (`neutral` is secondary text, the rest their status colours), or replaced by a decorative `marker` such as the caller’s logo. `icon` keeps the ring and draws a 12-14px glyph inside it in place of the dot, painted by `tone`, such as the call’s source type (MCP, API key, webhook); `skipped` beats `marker`, which beats `icon`. `stopped` puts an error badge (`stoppedLabel`, default "Stopped here") after the title of the step a flow ended on and paints its dot `error` unless a `tone` is set; the line ends at the last item. `meta` puts facts about a step in one wrapping row under its title, such as `calls` 2 and `status` 200, each label secondary and its value in the mono face, 18px apart, as a `dl`. `skipped` marks a step that never ran with a grey chevron in place of the dot; the title has to say so. For steps a person works through (complete, open, locked) use `StepList`. _Key props:_ `aria-label`, `aria-labelledby`; on `Timeline.Item`: `title`, `eyebrow` (a short label above the title naming the stage), `titleCode`, `time`, `tone` (`TimelineTone`: `neutral` | `info` | `success` | `warning` | `error`), `marker` (fills the 24px circle in place of the ringed dot), `icon` (a glyph inside the ring, painted by `tone`), `skipped`, `stopped`, `stoppedLabel`, `meta` (`TimelineMetaEntry[]`: `label`, `value`).
|
|
138
|
-
- **`Table`** — Data table with columns, sizing, pagination and row selection. `column.align` places a column's header as well as its cells. What lands on the aligned edge is the last thing in the header row rather than the title: the sort caret on a sortable column, the info icon on one carrying `info` without a sorter. `headerVariant` picks the header layout, and only `inline` lines header and body up exactly, because both are cells of one `<table>`. `detached` builds them from flex rows, where a sortable header cell is 32px narrower than a non-sortable one — its padding sits on the inner button rather than on the flex item — so its header cells sit 15–17px off their column at any alignment; reach for `inline` where exact alignment matters. Sorting is internal, so the array passed as `data` is not the order rendered once a column is sorted: `onVisibleOrderChange` reports the rows in render order — the whole of `data`, compared by `rowKey` so an equal order never re-fires — for a consumer stepping a master-detail view the way the user sees it. On the detached header, `title`, `subtitle` and `extra` add a title row on the frame above the column headers, the row a `framed` `Card` draws, and it docks with them under `stickyHeaderTop` (with `showHeader={false}` nothing docks and it scrolls with the rows). The inline header has no frame, so it draws none of the three and warns in development. _Key props:_ `TableColumns` (incl. `align`, and `titleShrinks` for a title that truncates itself in a fixed-width column, inline header only), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition` (`pagination.position`, in antd naming: a pager on each edge named, aligned as named, 16px from the rows; bottom right by default), `rowDensity` (`default`; `compact`, about 30px rows; `snug`, 38px rows with 12px side padding and a tighter header), `headerVariant`, `title`, `subtitle`, `extra`, `onVisibleOrderChange`, `scrollHeight` (a height, or `"fill"` for the room left in its scroller once the content above and below it fits, so the page itself never scrolls), `loadingRowCount` (skeleton rows while `loading`, 1 to 50), `aria-label` and `aria-labelledby` (name the
|
|
138
|
+
- **`Table`** — Data table with columns, sizing, pagination and row selection. `column.align` places a column's header as well as its cells. What lands on the aligned edge is the last thing in the header row rather than the title: the sort caret on a sortable column, the info icon on one carrying `info` without a sorter. `headerVariant` picks the header layout, and only `inline` lines header and body up exactly, because both are cells of one `<table>`. `detached` builds them from flex rows (with table, row, columnheader and cell roles, so a clickable row is a focusable row named by its cells that Enter activates, as the inline table's is), where a sortable header cell is 32px narrower than a non-sortable one — its padding sits on the inner button rather than on the flex item — so its header cells sit 15–17px off their column at any alignment; reach for `inline` where exact alignment matters. Sorting is internal, so the array passed as `data` is not the order rendered once a column is sorted: `onVisibleOrderChange` reports the rows in render order — the whole of `data`, compared by `rowKey` so an equal order never re-fires — for a consumer stepping a master-detail view the way the user sees it. On the detached header, `title`, `subtitle` and `extra` add a title row on the frame above the column headers, the row a `framed` `Card` draws, and it docks with them under `stickyHeaderTop` (with `showHeader={false}` nothing docks and it scrolls with the rows). The inline header has no frame, so it draws none of the three and warns in development. _Key props:_ `TableColumns` (incl. `align`, and `titleShrinks` for a title that truncates itself in a fixed-width column, inline header only), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition` (`pagination.position`, in antd naming: a pager on each edge named, aligned as named, 16px from the rows; bottom right by default), `rowDensity` (`default`; `compact`, about 30px rows; `snug`, 38px rows with 12px side padding and a tighter header), `headerVariant`, `title`, `subtitle`, `extra`, `onVisibleOrderChange`, `scrollHeight` (a height, or `"fill"` for the room left in its scroller once the content above and below it fits, so the page itself never scrolls), `loadingRowCount` (skeleton rows while `loading`, 1 to 50), `aria-label` and `aria-labelledby` (name the table in either layout, in its loading and error states too; a detached table with neither takes its name from its title row).
|
|
139
139
|
- **`Statistic`** — Displays a statistic value with a label; primary/secondary sizes. _Key props:_ `StatisticValueSize`.
|
|
140
140
|
- **`Avatar`** — Logo/initial avatar. Renders the image when available, otherwise a coloured tile with the first letter of `name`, or with `fallback="placeholder"` the generic "no logo available" tile. Encapsulates the fallback colour. _Key props:_ `src`, `name`, `size`, `shape="square" | "circle"`, `fallback="initial" | "placeholder"`.
|
|
141
141
|
- **`ZoomableImage`** — An image shown inline as a button that enlarges it, for a screenshot too detailed to read at its inline size. The thumbnail is shown at its own width up to the width of its container, never stretched, and stops at 240px tall, cropping a tall image to its top. The enlarged image sits on the scrim with no card, as large as the window allows at its own aspect ratio, up to its natural size, and a click anywhere or ESC closes it. The thumbnail is named `Enlarge image: <alt>` and the dialog is named by `title`, or by `alt` when `title` is missing or empty, so `alt` must be non-empty. `onError` reports a thumbnail that failed to load, so the caller can leave it out rather than show a broken image. The thumbnail loads lazily, so for one below the fold that report comes once it nears the viewport, not on render. Inside a `SidePanel` it enlarges over the panel and its aside instead, on a blurred veil; Escape, the veil or the close button closes it and leaves the panel open. _Key props:_ `src`, `alt`, `title`, `onError`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../src/components/Button.tsx"],"sourcesContent":["import React, { forwardRef, useLayoutEffect, useMemo, useRef } from 'react';\nimport ButtonSpinner from './ButtonSpinner';\nimport Tooltip from './Tooltip';\nimport { getDeepActiveNode } from './activeElement';\nimport { getIconOnlySizeClasses, getIconSizeClass } from './buttonSizing';\nimport {\n getDefaultRadiusClass,\n getIconGapClass,\n getRadiusClass,\n getSizeClasses,\n getVariantClasses,\n} from './buttonStyles';\nimport { composeRefs } from './composeRefs';\nimport { isFocusVisible } from './focusRing';\nimport { resolveRel } from './linkRel';\n\n// Button variant types matching the old component\nexport type ButtonVariant =\n | 'filled'\n | 'outline'\n /**\n * `outline`'s geometry on a ground of its own. For a button sitting on a tinted or\n * patterned surface, where `outline`'s transparent background lets that surface through\n * and the control stops reading as a button.\n */\n | 'surface'\n /**\n * The violet the assistant is named in elsewhere — for a control that hands work to it, or\n * acts on what it produced. Provenance, not a severity: it says who is being asked, not\n * that anything is wrong.\n */\n | 'assistant'\n | 'destructive'\n | 'success'\n | 'warning'\n | 'error'\n | 'ghost'\n /** `ghost` until its `Surface.Row` is hovered or focused, or its menu opens. For `trailing` only. */\n | 'row-outline'\n /** Text only, in the accent colour, for a secondary action beside a primary one. */\n | 'quiet'\n /**\n * A recessed grey with secondary text, for a control whose subject is switched off, such as\n * an account set to Not allowed. It stays clickable: `disabled` is for a control that is not.\n */\n | 'muted'\n /** Secondary text on no ground, primary on hover or focus: a row's secondary affordance, e.g. its open chevron. */\n | 'subtle'\n | 'no-style';\n\nexport type ButtonSize = 'xsmall' | 'small' | 'medium' | 'large';\n\nexport type ButtonRadius = 'md' | 'lg' | 'xl';\n\ninterface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant: ButtonVariant;\n size?: ButtonSize;\n radius?: ButtonRadius;\n loading?: boolean;\n disabled?: boolean;\n icon?: React.ReactNode;\n iconPosition?: 'start' | 'end';\n /** Before the label at its own size, never squeezed (an avatar); pairs with an end `icon`. */\n leading?: React.ReactNode;\n /** `start` aligns the label to the leading edge and pins an end `icon` to the far edge. */\n contentAlign?: 'center' | 'start';\n /** Fills the container's width. */\n flexGrow?: boolean;\n /** `wide` holds a 120px floor for a primary action. */\n width?: 'auto' | 'wide';\n fill?: boolean;\n tooltip?: string;\n tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right';\n iconOnly?: boolean;\n /** Pulls a borderless button out by its own padding, so its label lines up with the text around it. */\n flush?: boolean;\n children?: React.ReactNode;\n onClick?: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement>;\n /** Renders the button as a real anchor, so a link action is never an <a> nested in a <button>. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n}\n\n// The 1px is the transparent border, which `no-style` drops.\nconst FLUSH_MARGIN = '-mx-[calc(var(--btn-px)+1px)]';\nconst FLUSH_MARGIN_BORDERLESS = '-mx-[var(--btn-px)]';\n\nexport const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (\n {\n variant,\n size = 'large',\n radius,\n loading = false,\n disabled = false,\n icon,\n iconPosition = 'start',\n leading,\n contentAlign = 'center',\n flexGrow = false,\n width = 'auto',\n fill = false,\n tooltip,\n tooltipPlacement = 'top',\n iconOnly = false,\n flush = false,\n children,\n className = '',\n href,\n target,\n rel,\n onBlur,\n onFocus,\n type = 'button',\n ...props\n },\n ref,\n ) => {\n const elementRef = useRef<HTMLElement | null>(null);\n // Memoised: a fresh callback ref each render would detach and re-attach the consumer's.\n const composedRef = useMemo(\n () => composeRefs(ref as React.Ref<HTMLElement>, elementRef),\n [ref],\n );\n // Loading disables the button, or swaps the element (a tooltip wrapper, a link), and\n // either drops a keyboard user's focus to <body>. It is handed back when loading ends.\n const keyboardFocus = useRef(false);\n const refocusAfterLoading = useRef(false);\n // Counts focus events, so a blur's deferred clear can tell focus came back meanwhile.\n const focusCount = useRef(0);\n\n // A layout effect, so it reads `keyboardFocus` at commit: the blur that commit causes\n // only clears it from a microtask, after this has run.\n useLayoutEffect(() => {\n if (loading) {\n refocusAfterLoading.current = keyboardFocus.current;\n return;\n }\n if (!refocusAfterLoading.current) {\n return;\n }\n refocusAfterLoading.current = false;\n const active = getDeepActiveNode();\n if (!active || active === document.body) {\n elementRef.current?.focus({ preventScroll: true });\n // Scripted focus from <body> need not match :focus-visible, yet it is still the\n // keyboard user's: the next send must hand it back too.\n if (getDeepActiveNode() === elementRef.current) {\n keyboardFocus.current = true;\n }\n }\n }, [loading]);\n\n const handleFocus = (event: React.FocusEvent<HTMLElement>) => {\n focusCount.current += 1;\n // Only keyboard focus is handed back: a mouse user never asked for focus to stay there.\n keyboardFocus.current = isFocusVisible(event.currentTarget);\n onFocus?.(event as React.FocusEvent<HTMLButtonElement>);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLElement>) => {\n // A focus trap can put focus straight back within this task; that focus wins.\n const blurredAfter = focusCount.current;\n queueMicrotask(() => {\n if (focusCount.current === blurredAfter) {\n keyboardFocus.current = false;\n }\n });\n onBlur?.(event as React.FocusEvent<HTMLButtonElement>);\n };\n\n const radiusClass = radius ? getRadiusClass(radius) : getDefaultRadiusClass(size, iconOnly);\n const isInactive = disabled || loading;\n const alignStart = contentAlign === 'start';\n const baseClasses = [\n alignStart\n ? 'flex items-center justify-start text-left'\n : 'flex items-center justify-center',\n iconOnly ? `p-0 ${getIconOnlySizeClasses(size)}` : getSizeClasses(size),\n getVariantClasses(variant, radiusClass),\n flexGrow ? 'w-full' : '',\n width === 'wide' ? 'min-w-[120px]' : '',\n fill ? 'max-w-full' : '',\n isInactive ? 'cursor-not-allowed' : '',\n tooltip && isInactive ? 'pointer-events-none' : '',\n flush && !iconOnly\n ? variant === 'no-style'\n ? FLUSH_MARGIN_BORDERLESS\n : FLUSH_MARGIN\n : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const label = alignStart ? (\n <span className=\"flex min-w-0 flex-1 items-center\">{children}</span>\n ) : (\n children\n );\n\n const leadingSlot = leading ? (\n <span\n className={\n children\n ? 'btn-leading inline-flex shrink-0 items-center me-2'\n : 'btn-leading inline-flex shrink-0 items-center'\n }\n >\n {leading}\n </span>\n ) : null;\n\n const renderContent = () => {\n if (loading) {\n return (\n <>\n {leadingSlot}\n <ButtonSpinner />\n {label}\n </>\n );\n }\n\n const iconWrapperClasses = `inline-flex items-center shrink-0 ${getIconSizeClass(size)}`;\n\n if (icon && iconPosition === 'start') {\n return (\n <>\n {leadingSlot}\n <span\n className={`${iconWrapperClasses}${children ? ` ${getIconGapClass(size, 'start')}` : ''}`}\n >\n {icon}\n </span>\n {label}\n </>\n );\n }\n\n if (icon && iconPosition === 'end') {\n return (\n <>\n {leadingSlot}\n {label}\n <span\n className={`${iconWrapperClasses}${children ? ` ${getIconGapClass(size, 'end')}` : ''}`}\n >\n {icon}\n </span>\n </>\n );\n }\n\n return (\n <>\n {leadingSlot}\n {label}\n </>\n );\n };\n\n // An anchor cannot be disabled, so an inactive link still renders as a <button>.\n const button =\n href && !isInactive ? (\n <a\n ref={composedRef}\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n className={baseClasses}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {renderContent()}\n </a>\n ) : (\n <button\n ref={composedRef}\n // Not the browser's `submit`: an untyped Button in a form would otherwise be its\n // default button, so Enter in any field pressed it.\n type={type}\n disabled={isInactive}\n className={baseClasses}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n >\n {renderContent()}\n </button>\n );\n\n if (tooltip) {\n const trigger = isInactive ? (\n <span className={`inline-flex cursor-not-allowed${flexGrow ? ' w-full' : ''}`}>\n {button}\n </span>\n ) : (\n button\n );\n return (\n <Tooltip text={tooltip} placement={tooltipPlacement} fill={flexGrow}>\n {trigger}\n </Tooltip>\n );\n }\n\n return button;\n },\n);\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"names":["FLUSH_MARGIN","FLUSH_MARGIN_BORDERLESS","Button","forwardRef","variant","size","radius","loading","disabled","icon","iconPosition","leading","contentAlign","flexGrow","width","fill","tooltip","tooltipPlacement","iconOnly","flush","children","className","href","target","rel","onBlur","onFocus","type","props","ref","elementRef","useRef","composedRef","useMemo","composeRefs","keyboardFocus","refocusAfterLoading","focusCount","useLayoutEffect","active","getDeepActiveNode","_a","handleFocus","event","isFocusVisible","handleBlur","blurredAfter","radiusClass","getRadiusClass","getDefaultRadiusClass","isInactive","alignStart","baseClasses","getIconOnlySizeClasses","getSizeClasses","getVariantClasses","label","jsx","leadingSlot","renderContent","jsxs","Fragment","ButtonSpinner","iconWrapperClasses","getIconSizeClass","getIconGapClass","button","resolveRel","Tooltip"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../src/components/Button.tsx"],"sourcesContent":["import React, { forwardRef, useLayoutEffect, useMemo, useRef } from 'react';\nimport ButtonSpinner from './ButtonSpinner';\nimport Tooltip from './Tooltip';\nimport { getDeepActiveNode } from './activeElement';\nimport { getIconOnlySizeClasses, getIconSizeClass } from './buttonSizing';\nimport {\n getDefaultRadiusClass,\n getIconGapClass,\n getRadiusClass,\n getSizeClasses,\n getVariantClasses,\n} from './buttonStyles';\nimport { composeRefs } from './composeRefs';\nimport { isFocusVisible } from './focusRing';\nimport { resolveRel } from './linkRel';\n\n// Button variant types matching the old component\nexport type ButtonVariant =\n | 'filled'\n | 'outline'\n /**\n * `outline`'s geometry on a ground of its own. For a button sitting on a tinted or\n * patterned surface, where `outline`'s transparent background lets that surface through\n * and the control stops reading as a button.\n */\n | 'surface'\n /**\n * The violet the assistant is named in elsewhere — for a control that hands work to it, or\n * acts on what it produced. Provenance, not a severity: it says who is being asked, not\n * that anything is wrong.\n */\n | 'assistant'\n | 'destructive'\n /**\n * `destructive` as a solid red ground with white text, for the one action in a confirmation\n * that cannot be taken back (stopping every AI tool, deleting a project). `destructive`'s\n * outline is for a destructive action that sits among others.\n */\n | 'destructive-filled'\n | 'success'\n | 'warning'\n | 'error'\n | 'ghost'\n /** `ghost` until its `Surface.Row` is hovered or focused, or its menu opens. For `trailing` only. */\n | 'row-outline'\n /** Text only, in the accent colour, for a secondary action beside a primary one. */\n | 'quiet'\n /**\n * A recessed grey with secondary text, for a control whose subject is switched off, such as\n * an account set to Not allowed. It stays clickable: `disabled` is for a control that is not.\n */\n | 'muted'\n /** Secondary text on no ground, primary on hover or focus: a row's secondary affordance, e.g. its open chevron. */\n | 'subtle'\n | 'no-style';\n\nexport type ButtonSize = 'xsmall' | 'small' | 'medium' | 'large';\n\nexport type ButtonRadius = 'md' | 'lg' | 'xl';\n\ninterface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant: ButtonVariant;\n size?: ButtonSize;\n radius?: ButtonRadius;\n loading?: boolean;\n disabled?: boolean;\n icon?: React.ReactNode;\n iconPosition?: 'start' | 'end';\n /** Before the label at its own size, never squeezed (an avatar); pairs with an end `icon`. */\n leading?: React.ReactNode;\n /** `start` aligns the label to the leading edge and pins an end `icon` to the far edge. */\n contentAlign?: 'center' | 'start';\n /** Fills the container's width. */\n flexGrow?: boolean;\n /** `wide` holds a 120px floor for a primary action. */\n width?: 'auto' | 'wide';\n fill?: boolean;\n tooltip?: string;\n tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right';\n iconOnly?: boolean;\n /** Pulls a borderless button out by its own padding, so its label lines up with the text around it. */\n flush?: boolean;\n children?: React.ReactNode;\n onClick?: React.MouseEventHandler<HTMLButtonElement & HTMLAnchorElement>;\n /** Renders the button as a real anchor, so a link action is never an <a> nested in a <button>. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n}\n\n// The 1px is the transparent border, which `no-style` drops.\nconst FLUSH_MARGIN = '-mx-[calc(var(--btn-px)+1px)]';\nconst FLUSH_MARGIN_BORDERLESS = '-mx-[var(--btn-px)]';\n\nexport const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (\n {\n variant,\n size = 'large',\n radius,\n loading = false,\n disabled = false,\n icon,\n iconPosition = 'start',\n leading,\n contentAlign = 'center',\n flexGrow = false,\n width = 'auto',\n fill = false,\n tooltip,\n tooltipPlacement = 'top',\n iconOnly = false,\n flush = false,\n children,\n className = '',\n href,\n target,\n rel,\n onBlur,\n onFocus,\n type = 'button',\n ...props\n },\n ref,\n ) => {\n const elementRef = useRef<HTMLElement | null>(null);\n // Memoised: a fresh callback ref each render would detach and re-attach the consumer's.\n const composedRef = useMemo(\n () => composeRefs(ref as React.Ref<HTMLElement>, elementRef),\n [ref],\n );\n // Loading disables the button, or swaps the element (a tooltip wrapper, a link), and\n // either drops a keyboard user's focus to <body>. It is handed back when loading ends.\n const keyboardFocus = useRef(false);\n const refocusAfterLoading = useRef(false);\n // Counts focus events, so a blur's deferred clear can tell focus came back meanwhile.\n const focusCount = useRef(0);\n\n // A layout effect, so it reads `keyboardFocus` at commit: the blur that commit causes\n // only clears it from a microtask, after this has run.\n useLayoutEffect(() => {\n if (loading) {\n refocusAfterLoading.current = keyboardFocus.current;\n return;\n }\n if (!refocusAfterLoading.current) {\n return;\n }\n refocusAfterLoading.current = false;\n const active = getDeepActiveNode();\n if (!active || active === document.body) {\n elementRef.current?.focus({ preventScroll: true });\n // Scripted focus from <body> need not match :focus-visible, yet it is still the\n // keyboard user's: the next send must hand it back too.\n if (getDeepActiveNode() === elementRef.current) {\n keyboardFocus.current = true;\n }\n }\n }, [loading]);\n\n const handleFocus = (event: React.FocusEvent<HTMLElement>) => {\n focusCount.current += 1;\n // Only keyboard focus is handed back: a mouse user never asked for focus to stay there.\n keyboardFocus.current = isFocusVisible(event.currentTarget);\n onFocus?.(event as React.FocusEvent<HTMLButtonElement>);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLElement>) => {\n // A focus trap can put focus straight back within this task; that focus wins.\n const blurredAfter = focusCount.current;\n queueMicrotask(() => {\n if (focusCount.current === blurredAfter) {\n keyboardFocus.current = false;\n }\n });\n onBlur?.(event as React.FocusEvent<HTMLButtonElement>);\n };\n\n const radiusClass = radius ? getRadiusClass(radius) : getDefaultRadiusClass(size, iconOnly);\n const isInactive = disabled || loading;\n const alignStart = contentAlign === 'start';\n const baseClasses = [\n alignStart\n ? 'flex items-center justify-start text-left'\n : 'flex items-center justify-center',\n iconOnly ? `p-0 ${getIconOnlySizeClasses(size)}` : getSizeClasses(size),\n getVariantClasses(variant, radiusClass),\n flexGrow ? 'w-full' : '',\n width === 'wide' ? 'min-w-[120px]' : '',\n fill ? 'max-w-full' : '',\n isInactive ? 'cursor-not-allowed' : '',\n tooltip && isInactive ? 'pointer-events-none' : '',\n flush && !iconOnly\n ? variant === 'no-style'\n ? FLUSH_MARGIN_BORDERLESS\n : FLUSH_MARGIN\n : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const label = alignStart ? (\n <span className=\"flex min-w-0 flex-1 items-center\">{children}</span>\n ) : (\n children\n );\n\n const leadingSlot = leading ? (\n <span\n className={\n children\n ? 'btn-leading inline-flex shrink-0 items-center me-2'\n : 'btn-leading inline-flex shrink-0 items-center'\n }\n >\n {leading}\n </span>\n ) : null;\n\n const renderContent = () => {\n if (loading) {\n return (\n <>\n {leadingSlot}\n <ButtonSpinner />\n {label}\n </>\n );\n }\n\n const iconWrapperClasses = `inline-flex items-center shrink-0 ${getIconSizeClass(size)}`;\n\n if (icon && iconPosition === 'start') {\n return (\n <>\n {leadingSlot}\n <span\n className={`${iconWrapperClasses}${children ? ` ${getIconGapClass(size, 'start')}` : ''}`}\n >\n {icon}\n </span>\n {label}\n </>\n );\n }\n\n if (icon && iconPosition === 'end') {\n return (\n <>\n {leadingSlot}\n {label}\n <span\n className={`${iconWrapperClasses}${children ? ` ${getIconGapClass(size, 'end')}` : ''}`}\n >\n {icon}\n </span>\n </>\n );\n }\n\n return (\n <>\n {leadingSlot}\n {label}\n </>\n );\n };\n\n // An anchor cannot be disabled, so an inactive link still renders as a <button>.\n const button =\n href && !isInactive ? (\n <a\n ref={composedRef}\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n className={baseClasses}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {renderContent()}\n </a>\n ) : (\n <button\n ref={composedRef}\n // Not the browser's `submit`: an untyped Button in a form would otherwise be its\n // default button, so Enter in any field pressed it.\n type={type}\n disabled={isInactive}\n className={baseClasses}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {...props}\n >\n {renderContent()}\n </button>\n );\n\n if (tooltip) {\n const trigger = isInactive ? (\n <span className={`inline-flex cursor-not-allowed${flexGrow ? ' w-full' : ''}`}>\n {button}\n </span>\n ) : (\n button\n );\n return (\n <Tooltip text={tooltip} placement={tooltipPlacement} fill={flexGrow}>\n {trigger}\n </Tooltip>\n );\n }\n\n return button;\n },\n);\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"names":["FLUSH_MARGIN","FLUSH_MARGIN_BORDERLESS","Button","forwardRef","variant","size","radius","loading","disabled","icon","iconPosition","leading","contentAlign","flexGrow","width","fill","tooltip","tooltipPlacement","iconOnly","flush","children","className","href","target","rel","onBlur","onFocus","type","props","ref","elementRef","useRef","composedRef","useMemo","composeRefs","keyboardFocus","refocusAfterLoading","focusCount","useLayoutEffect","active","getDeepActiveNode","_a","handleFocus","event","isFocusVisible","handleBlur","blurredAfter","radiusClass","getRadiusClass","getDefaultRadiusClass","isInactive","alignStart","baseClasses","getIconOnlySizeClasses","getSizeClasses","getVariantClasses","label","jsx","leadingSlot","renderContent","jsxs","Fragment","ButtonSpinner","iconWrapperClasses","getIconSizeClass","getIconGapClass","button","resolveRel","Tooltip"],"mappings":"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"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { jsxs as o, Fragment as c, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { Button as s } from "./Button.js";
|
|
3
|
-
const
|
|
3
|
+
const u = {
|
|
4
|
+
default: "filled",
|
|
5
|
+
destructive: "destructive",
|
|
6
|
+
"destructive-filled": "destructive-filled"
|
|
7
|
+
}, p = ({
|
|
4
8
|
primary: l,
|
|
5
9
|
secondary: t,
|
|
6
|
-
size:
|
|
10
|
+
size: d = "medium",
|
|
7
11
|
note: e,
|
|
8
|
-
className:
|
|
12
|
+
className: n = ""
|
|
9
13
|
}) => {
|
|
10
14
|
const a = /* @__PURE__ */ o(c, { children: [
|
|
11
15
|
t ? /* @__PURE__ */ i(
|
|
12
16
|
s,
|
|
13
17
|
{
|
|
14
18
|
variant: "outline",
|
|
15
|
-
size:
|
|
19
|
+
size: d,
|
|
16
20
|
type: "button",
|
|
17
21
|
disabled: t.disabled,
|
|
18
22
|
loading: t.loading,
|
|
@@ -24,8 +28,8 @@ const f = ({
|
|
|
24
28
|
l ? /* @__PURE__ */ i(
|
|
25
29
|
s,
|
|
26
30
|
{
|
|
27
|
-
variant: l.tone
|
|
28
|
-
size:
|
|
31
|
+
variant: u[l.tone ?? "default"],
|
|
32
|
+
size: d,
|
|
29
33
|
type: l.type ?? "button",
|
|
30
34
|
disabled: l.disabled,
|
|
31
35
|
loading: l.loading,
|
|
@@ -35,13 +39,13 @@ const f = ({
|
|
|
35
39
|
}
|
|
36
40
|
) : null
|
|
37
41
|
] });
|
|
38
|
-
return e == null || e === !1 || e === "" ? /* @__PURE__ */ i("div", { className: `flex items-center justify-end gap-[8px] ${
|
|
42
|
+
return e == null || e === !1 || e === "" ? /* @__PURE__ */ i("div", { className: `flex items-center justify-end gap-[8px] ${n}`, children: a }) : /* @__PURE__ */ o("div", { className: `flex flex-wrap items-center gap-x-[16px] gap-y-[8px] ${n}`, children: [
|
|
39
43
|
/* @__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
44
|
/* @__PURE__ */ i("div", { className: "ml-auto flex items-center justify-end gap-[8px]", children: a })
|
|
41
45
|
] });
|
|
42
46
|
};
|
|
43
47
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
p as FormActions,
|
|
49
|
+
p as default
|
|
46
50
|
};
|
|
47
51
|
//# 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
|
|
1
|
+
{"version":3,"file":"FormActions.js","sources":["../../src/components/FormActions.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, type ButtonVariant } from './Button';\n\nexport type FormPrimaryTone = 'default' | 'destructive' | 'destructive-filled';\n\nconst PRIMARY_VARIANT: Record<FormPrimaryTone, ButtonVariant> = {\n default: 'filled',\n destructive: 'destructive',\n 'destructive-filled': 'destructive-filled',\n};\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 /**\n * `destructive` for an action that deletes or revokes; `destructive-filled` for the one action\n * in a confirmation that can't be taken back, on the solid red ground.\n */\n tone?: FormPrimaryTone;\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_VARIANT[primary.tone ?? 'default']}\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":["PRIMARY_VARIANT","FormActions","primary","secondary","size","note","className","buttons","jsxs","Fragment","jsx","Button"],"mappings":";;AAKA,MAAMA,IAA0D;AAAA,EAC5D,SAAS;AAAA,EACT,aAAa;AAAA,EACb,sBAAsB;AAC1B,GAkCMC,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,SAASX,EAAgBE,EAAQ,QAAQ,SAAS;AAAA,QAClD,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;"}
|
|
@@ -27,13 +27,14 @@ const J = {
|
|
|
27
27
|
small: "rounded-[var(--malachite-radius-10,10px)]",
|
|
28
28
|
medium: "rounded-xl",
|
|
29
29
|
large: "rounded-[var(--malachite-radius-xxl,14px)]"
|
|
30
|
-
}, Ae = (
|
|
31
|
-
switch (
|
|
30
|
+
}, Ae = (t, e) => {
|
|
31
|
+
switch (t) {
|
|
32
32
|
case "ghost":
|
|
33
33
|
return {
|
|
34
34
|
wrapper: [
|
|
35
35
|
e ? "border-0 border-b border-solid border-[var(--malachite-destructive-border)]" : "",
|
|
36
|
-
|
|
36
|
+
// The hover and focus borders an invalid field moves to (tailwind.css).
|
|
37
|
+
e ? "field-invalid" : ""
|
|
37
38
|
],
|
|
38
39
|
shadow: "shadow-none",
|
|
39
40
|
borderRadius: "rounded-none"
|
|
@@ -44,22 +45,22 @@ const J = {
|
|
|
44
45
|
wrapper: [
|
|
45
46
|
"border border-solid",
|
|
46
47
|
e ? "border-[var(--malachite-destructive-border)]" : "border-[var(--malachite-card-border)]",
|
|
47
|
-
e ? "
|
|
48
|
+
e ? "field-invalid" : `${_e} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`
|
|
48
49
|
],
|
|
49
50
|
shadow: e ? "shadow-error" : "shadow-default",
|
|
50
51
|
borderRadius: ""
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
}, aa = ({
|
|
54
|
-
label:
|
|
55
|
+
label: t,
|
|
55
56
|
hint: e,
|
|
56
57
|
hintIcon: i,
|
|
57
58
|
tooltip: g,
|
|
58
|
-
placeholder:
|
|
59
|
+
placeholder: w,
|
|
59
60
|
icon: m,
|
|
60
61
|
name: o,
|
|
61
62
|
required: h,
|
|
62
|
-
requiredIndicator:
|
|
63
|
+
requiredIndicator: b,
|
|
63
64
|
error: $,
|
|
64
65
|
description: V,
|
|
65
66
|
loading: Y = !1,
|
|
@@ -72,15 +73,15 @@ const J = {
|
|
|
72
73
|
prefixValue: M,
|
|
73
74
|
prefixSecondaryValue: Z,
|
|
74
75
|
ellipsis: ae = !1,
|
|
75
|
-
copyOnClick:
|
|
76
|
+
copyOnClick: te = !1,
|
|
76
77
|
formControl: A,
|
|
77
|
-
buttons:
|
|
78
|
+
buttons: f,
|
|
78
79
|
onCopyClick: B,
|
|
79
|
-
showCopyButton:
|
|
80
|
+
showCopyButton: re,
|
|
80
81
|
onChange: I,
|
|
81
82
|
value: ie,
|
|
82
83
|
onBlur: y,
|
|
83
|
-
helperText:
|
|
84
|
+
helperText: u,
|
|
84
85
|
showPasswordToggle: N = !0,
|
|
85
86
|
id: le,
|
|
86
87
|
autoFocus: se = !1,
|
|
@@ -91,35 +92,35 @@ const J = {
|
|
|
91
92
|
}) => {
|
|
92
93
|
const { controlId: P, labelId: me, descriptionId: G, hintId: H, helperTextId: C } = Ee({
|
|
93
94
|
id: le,
|
|
94
|
-
label:
|
|
95
|
+
label: t,
|
|
95
96
|
description: V,
|
|
96
97
|
hint: e,
|
|
97
98
|
helperText: !0
|
|
98
|
-
}), [E, he] = T(!1), [pe,
|
|
99
|
+
}), [E, he] = T(!1), [pe, fe] = T(D || ""), [k, O] = T(!1);
|
|
99
100
|
ye(() => {
|
|
100
101
|
if (k) {
|
|
101
|
-
const
|
|
102
|
+
const r = setTimeout(() => {
|
|
102
103
|
O(!1);
|
|
103
104
|
}, 1e3);
|
|
104
|
-
return () => clearTimeout(
|
|
105
|
+
return () => clearTimeout(r);
|
|
105
106
|
}
|
|
106
107
|
}, [k]);
|
|
107
|
-
const
|
|
108
|
+
const ue = (r) => (l) => {
|
|
108
109
|
const c = l.target.value;
|
|
109
|
-
|
|
110
|
-
}, U = Ne(void 0), L = (
|
|
110
|
+
fe(c), I == null || I(c), r == null || r(c);
|
|
111
|
+
}, U = Ne(void 0), L = (r) => Ve({
|
|
111
112
|
component: "Input",
|
|
112
113
|
name: o,
|
|
113
114
|
value: ie,
|
|
114
|
-
formValue:
|
|
115
|
+
formValue: r,
|
|
115
116
|
defaultValue: D,
|
|
116
117
|
bound: !!A,
|
|
117
118
|
uncontrolledValue: pe
|
|
118
|
-
}),
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
} : void 0,
|
|
122
|
-
const l = Ae(ee,
|
|
119
|
+
}), x = B ? () => {
|
|
120
|
+
const r = L(U.current);
|
|
121
|
+
r && (navigator.clipboard.writeText(r), O(!0), B());
|
|
122
|
+
} : void 0, xe = d === "password" ? E ? "text" : "password" : d, ve = m || M || Z, ge = J[n], we = (r) => {
|
|
123
|
+
const l = Ae(ee, r);
|
|
123
124
|
return [
|
|
124
125
|
"relative",
|
|
125
126
|
"flex items-center",
|
|
@@ -135,13 +136,13 @@ const J = {
|
|
|
135
136
|
return /* @__PURE__ */ a(
|
|
136
137
|
Ce,
|
|
137
138
|
{
|
|
138
|
-
label:
|
|
139
|
+
label: t,
|
|
139
140
|
hint: e,
|
|
140
141
|
hintIcon: i,
|
|
141
142
|
tooltip: g,
|
|
142
143
|
name: o,
|
|
143
144
|
required: h,
|
|
144
|
-
requiredIndicator:
|
|
145
|
+
requiredIndicator: b,
|
|
145
146
|
loading: Y,
|
|
146
147
|
formControl: A,
|
|
147
148
|
description: V,
|
|
@@ -153,26 +154,26 @@ const J = {
|
|
|
153
154
|
Te,
|
|
154
155
|
{
|
|
155
156
|
heightClass: ge,
|
|
156
|
-
helperText: !!
|
|
157
|
+
helperText: !!u,
|
|
157
158
|
helperTextMarginTop: !0
|
|
158
159
|
}
|
|
159
160
|
),
|
|
160
|
-
children: ({ error:
|
|
161
|
+
children: ({ error: r, message: l, onFieldChange: c, onFieldBlur: S, value: W }) => {
|
|
161
162
|
U.current = W;
|
|
162
|
-
const
|
|
163
|
+
const v = L(W), z = re ?? !!(x && p && v), R = $ ?? r, j = $ === !1 ? void 0 : l, X = R && !j, be = X || z || (f == null ? void 0 : f.length) || d === "password" && N, q = `${C}-error`, Ie = [
|
|
163
164
|
G,
|
|
164
165
|
H,
|
|
165
|
-
|
|
166
|
+
u ? C : void 0,
|
|
166
167
|
j ? q : void 0,
|
|
167
168
|
ce
|
|
168
169
|
].filter(Boolean).join(" ") || void 0, F = /* @__PURE__ */ a(
|
|
169
170
|
"input",
|
|
170
171
|
{
|
|
171
172
|
id: P,
|
|
172
|
-
type:
|
|
173
|
-
placeholder:
|
|
174
|
-
value:
|
|
175
|
-
onChange:
|
|
173
|
+
type: xe,
|
|
174
|
+
placeholder: w,
|
|
175
|
+
value: v,
|
|
176
|
+
onChange: ue(c),
|
|
176
177
|
onBlur: () => {
|
|
177
178
|
y == null || y(), S == null || S();
|
|
178
179
|
},
|
|
@@ -190,8 +191,8 @@ const J = {
|
|
|
190
191
|
}
|
|
191
192
|
);
|
|
192
193
|
return /* @__PURE__ */ s(K, { children: [
|
|
193
|
-
/* @__PURE__ */ s("div", { className:
|
|
194
|
-
|
|
194
|
+
/* @__PURE__ */ s("div", { className: we(R), children: [
|
|
195
|
+
ve && /* @__PURE__ */ a("div", { className: "flex items-center pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ a(
|
|
195
196
|
Be,
|
|
196
197
|
{
|
|
197
198
|
prefixValue: M,
|
|
@@ -199,10 +200,10 @@ const J = {
|
|
|
199
200
|
icon: m
|
|
200
201
|
}
|
|
201
202
|
) }),
|
|
202
|
-
|
|
203
|
+
te && z && x ? /* @__PURE__ */ a(
|
|
203
204
|
$e,
|
|
204
205
|
{
|
|
205
|
-
text:
|
|
206
|
+
text: v,
|
|
206
207
|
fill: !0,
|
|
207
208
|
triggerAs: "div",
|
|
208
209
|
describesTrigger: !1,
|
|
@@ -215,14 +216,14 @@ const J = {
|
|
|
215
216
|
type: "button",
|
|
216
217
|
tabIndex: -1,
|
|
217
218
|
"aria-hidden": "true",
|
|
218
|
-
onClick:
|
|
219
|
+
onClick: x,
|
|
219
220
|
className: "absolute inset-0 cursor-copy border-0 bg-transparent p-0"
|
|
220
221
|
}
|
|
221
222
|
)
|
|
222
223
|
] })
|
|
223
224
|
}
|
|
224
225
|
) : F,
|
|
225
|
-
|
|
226
|
+
be && /* @__PURE__ */ s(
|
|
226
227
|
"div",
|
|
227
228
|
{
|
|
228
229
|
className: `flex items-center pl-1 flex-shrink-0 ${d === "password" && N ? "pr-0" : "pr-3"}`,
|
|
@@ -231,8 +232,8 @@ const J = {
|
|
|
231
232
|
Pe,
|
|
232
233
|
{
|
|
233
234
|
error: X,
|
|
234
|
-
defaultValue:
|
|
235
|
-
onCopyClick:
|
|
235
|
+
defaultValue: v,
|
|
236
|
+
onCopyClick: x,
|
|
236
237
|
showCopyButton: z,
|
|
237
238
|
copied: k,
|
|
238
239
|
type: d,
|
|
@@ -241,17 +242,17 @@ const J = {
|
|
|
241
242
|
onTogglePassword: () => he(!E)
|
|
242
243
|
}
|
|
243
244
|
),
|
|
244
|
-
/* @__PURE__ */ a(Ge, { buttons:
|
|
245
|
+
/* @__PURE__ */ a(Ge, { buttons: f })
|
|
245
246
|
]
|
|
246
247
|
}
|
|
247
248
|
)
|
|
248
249
|
] }),
|
|
249
|
-
|
|
250
|
+
u && /* @__PURE__ */ a(
|
|
250
251
|
"div",
|
|
251
252
|
{
|
|
252
253
|
id: C,
|
|
253
254
|
className: "mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))] [overflow-wrap:anywhere]",
|
|
254
|
-
children:
|
|
255
|
+
children: u
|
|
255
256
|
}
|
|
256
257
|
),
|
|
257
258
|
/* @__PURE__ */ a(je, { id: q, message: j, spaced: !0 })
|
|
@@ -259,22 +260,22 @@ const J = {
|
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
);
|
|
262
|
-
}, Be = ({ prefixValue:
|
|
263
|
+
}, Be = ({ prefixValue: t, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
263
264
|
i && /* @__PURE__ */ a("span", { className: "flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0", children: i }),
|
|
264
|
-
|
|
265
|
+
t && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-medium,14px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: t }),
|
|
265
266
|
e && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-medium,14px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: e })
|
|
266
267
|
] }), Pe = ({
|
|
267
|
-
error:
|
|
268
|
+
error: t,
|
|
268
269
|
defaultValue: e,
|
|
269
270
|
onCopyClick: i,
|
|
270
271
|
showCopyButton: g = !1,
|
|
271
|
-
copied:
|
|
272
|
+
copied: w = !1,
|
|
272
273
|
type: m,
|
|
273
274
|
showPassword: o,
|
|
274
275
|
showPasswordToggle: h = !0,
|
|
275
|
-
onTogglePassword:
|
|
276
|
+
onTogglePassword: b
|
|
276
277
|
}) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
277
|
-
|
|
278
|
+
t && // Decorative: the rejection is carried by the message beneath the field, so
|
|
278
279
|
// announcing an unnamed icon here would only repeat it as "info".
|
|
279
280
|
/* @__PURE__ */ a(
|
|
280
281
|
"div",
|
|
@@ -290,15 +291,15 @@ const J = {
|
|
|
290
291
|
)
|
|
291
292
|
}
|
|
292
293
|
),
|
|
293
|
-
g && i && e && /* @__PURE__ */ a(ke, { copied:
|
|
294
|
-
m === "password" && h && /* @__PURE__ */ a(Q, { variant: "no-style", onClick:
|
|
294
|
+
g && i && e && /* @__PURE__ */ a(ke, { copied: w, onCopy: i }),
|
|
295
|
+
m === "password" && h && /* @__PURE__ */ a(Q, { variant: "no-style", onClick: b, type: "button", size: "small", children: o ? /* @__PURE__ */ a(
|
|
295
296
|
Se,
|
|
296
297
|
{
|
|
297
298
|
size: 16,
|
|
298
299
|
style: { color: "var(--malachite-text-dimmed)" }
|
|
299
300
|
}
|
|
300
301
|
) : /* @__PURE__ */ a(ze, { size: 16, style: { color: "var(--malachite-text-dimmed)" } }) })
|
|
301
|
-
] }), Ge = ({ buttons:
|
|
302
|
+
] }), Ge = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ a(K, { children: t.map((e) => /* @__PURE__ */ a(
|
|
302
303
|
Q,
|
|
303
304
|
{
|
|
304
305
|
variant: e.variant || (e.danger ? "destructive" : "outline"),
|