@stackone/malachite 2.125.0 → 2.126.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
@@ -70,7 +70,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
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
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`.
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
- - **`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`, `aria-label`, `aria-labelledby`, `id`.
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`.
75
75
  - **`Search`** — Search input with a leading icon; `default` and `muted` variants. `width` fixes the field's width, the same prop `Dropdown` and `MultiSelect` take, so a toolbar can put its controls on one width rather than letting each size itself; without it the field fills its container, and a container narrower than the value still wins. `clearable` adds a clear button while there is text, and lets Escape clear; either way focus stays in the field, and an Escape that clears does not also close a surrounding panel. Name it with `aria-label` when the placeholder is too short to stand alone. Forwards a ref to the input. _Key props:_ `value`, `onChange`, `placeholder`, `variant`, `size`, `textSize` (`control` follows `size`; `body` sets the 14px body step at any height), `width`, `disabled`, `clearable`, `onClear`, `onKeyDown`, `aria-label`, `aria-labelledby`.
76
76
  - **`Checkbox`** — Checkbox supporting checked/indeterminate/disabled. Pass `presentational` to render a visual-only, non-focusable indicator for use inside a clickable row/card. _Key props:_ `checked`, `indeterminate`, `disabled`, `onChange`, `presentational`.
@@ -134,7 +134,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
134
134
  - **`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`.
135
135
  - **`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`).
136
136
  - **`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`).
137
- - **`Table`** — Data table with columns, sizing, pagination and row selection. `column.align` places a column's header as well as its cells. What lands on the aligned edge is the last thing in the header row rather than the title: the sort caret on a sortable column, the info icon on one carrying `info` without a sorter. `headerVariant` picks the header layout, and only `inline` lines header and body up exactly, because both are cells of one `<table>`. `detached` builds them from flex rows, where a sortable header cell is 32px narrower than a non-sortable one — its padding sits on the inner button rather than on the flex item — so its header cells sit 15–17px off their column at any alignment; reach for `inline` where exact alignment matters. Sorting is internal, so the array passed as `data` is not the order rendered once a column is sorted: `onVisibleOrderChange` reports the rows in render order — the whole of `data`, compared by `rowKey` so an equal order never re-fires — for a consumer stepping a master-detail view the way the user sees it. On the detached header, `title`, `subtitle` and `extra` add a title row on the frame above the column headers, the row a `framed` `Card` draws, and it docks with them under `stickyHeaderTop` (with `showHeader={false}` nothing docks and it scrolls with the rows). The inline header has no frame, so it draws none of the three and warns in development. _Key props:_ `TableColumns` (incl. `align`), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition` (`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).
137
+ - **`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).
138
138
  - **`Statistic`** — Displays a statistic value with a label; primary/secondary sizes. _Key props:_ `StatisticValueSize`.
139
139
  - **`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"`.
140
140
  - **`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`.
@@ -154,7 +154,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
154
154
  ## Typography
155
155
 
156
156
  - **`ClampText`** — Clamps text to N lines; expands to full text on hover/focus with a height animation. Wrapping markdown? Pass `variant="flow"` to the `Typography.MarkdownBlock` inside it, or the clamp counts blocks instead of lines. `expandable` swaps the hover reveal for `… Read More` in the accent over the end of text that runs past its lines, which opens it in full with `Show Less` after its last word. _Key props:_ `lines` (default 3), `expandOnHover`, `expandable`, `className`.
157
- - **`Typography`** — Text primitives — use these instead of raw colour tokens on `<span>`s. Includes `Typography.Text`, `Typography.SecondaryText`, `Typography.EllipsisText`, etc., with size/weight/color props. `Typography.Text`'s `size` runs `xsmall` (11px), `12`, `small` (13px), `medium` (14px) and up; `12` is off the named ladder, like the theme's `15`, for a secondary line under a 14px label. `wrap={false}` keeps a `Typography.Text` on one line. `Typography.Text` takes `font="sans" | "heading" | "body" | "mono"`, and `as` (`p`, `h1`–`h6`) for a heading or paragraph that keeps its look; `Typography.CodeText` takes `variant="inline"` for a chip mid-sentence; `Typography.MarkdownBlock` takes `variant="flow"` for use inside `ClampText`, `variant="inline"` for one line of inline syntax set inside another component (no autolinks, images as alt text), `links="inert"` to draw links without an anchor inside a button, `renderLink` to send root-relative links (`/path`, never `//host`) through the app’s router in the same tab while every other link still opens in a new one — without it every link opens in a new tab, and `normalizeSource` for machine-generated descriptions that omit blank lines between blocks. `Typography.PathText` draws one line of path segments (`segments`, root first, each `{ text, tone, minChars }` with `tone` `default` | `secondary`) joined by a `separator` that is never cut: the segments give way in order, each down to `minChars` (2) characters, so the last stays whole the longest, and a cut never leaves a space before its ellipsis, which `text-overflow` does. The full path is always the accessible name and shows in a tooltip only when something is cut (`tooltip`, `tooltipPlacement`, `tooltipSuppressed` while the menu it labels is open). It measures with canvas text metrics against a shared ResizeObserver, so it costs no layout read per instance. `Typography.EllipsisText` takes a `size` and a `fontWeight` (Text's scale) so a truncating label can match the text beside it, and shows its `tooltip` on every hover unless `tooltipWhenTruncated` is set, which limits it to text that is actually cut off — for a tooltip that repeats the label, where a tooltip carrying something the label does not say should keep the default. `tooltipDelay` sets the seconds before it opens, and `focusableTrigger` makes the text a tab stop that opens it on focus, for a tooltip that says what the text does not (ignored with `tooltipWhenTruncated`). `inline` wraps the text in a span rather than a div, for inside a clickable `Surface.Row`.
157
+ - **`Typography`** — Text primitives — use these instead of raw colour tokens on `<span>`s. Includes `Typography.Text`, `Typography.SecondaryText`, `Typography.EllipsisText`, etc., with size/weight/color props. `Typography.Text`'s `size` runs `xsmall` (11px), `12`, `small` (13px), `medium` (14px) and up; `12` is off the named ladder, like the theme's `15`, for a secondary line under a 14px label. `wrap={false}` keeps a `Typography.Text` on one line. `breakAnywhere` breaks a long unbroken token (an id, a URL) instead of letting it widen its container, and `preserveLineBreaks` keeps the newlines of a message while runs of spaces collapse; both apply only while the text wraps. `Typography.Text` takes `font="sans" | "heading" | "body" | "mono"`, and `as` (`p`, `h1`–`h6`) for a heading or paragraph that keeps its look; `Typography.CodeText` takes `variant="inline"` for a chip mid-sentence; `Typography.MarkdownBlock` takes `variant="flow"` for use inside `ClampText`, `variant="inline"` for one line of inline syntax set inside another component (no autolinks, images as alt text), `links="inert"` to draw links without an anchor inside a button, `renderLink` to send root-relative links (`/path`, never `//host`) through the app’s router in the same tab while every other link still opens in a new one — without it every link opens in a new tab, and `normalizeSource` for machine-generated descriptions that omit blank lines between blocks. `Typography.PathText` draws one line of path segments (`segments`, root first, each `{ text, tone, minChars }` with `tone` `default` | `secondary`) joined by a `separator` that is never cut: the segments give way in order, each down to `minChars` (2) characters, so the last stays whole the longest, and a cut never leaves a space before its ellipsis, which `text-overflow` does. The full path is always the accessible name and shows in a tooltip only when something is cut (`tooltip`, `tooltipPlacement`, `tooltipSuppressed` while the menu it labels is open). It measures with canvas text metrics against a shared ResizeObserver, so it costs no layout read per instance. `Typography.EllipsisText` takes a `size` and a `fontWeight` (Text's scale) so a truncating label can match the text beside it, and shows its `tooltip` on every hover unless `tooltipWhenTruncated` is set, which limits it to text that is actually cut off — for a tooltip that repeats the label, where a tooltip carrying something the label does not say should keep the default. `tooltipDelay` sets the seconds before it opens, and `focusableTrigger` makes the text a tab stop that opens it on focus, for a tooltip that says what the text does not (ignored with `tooltipWhenTruncated`). `inline` wraps the text in a span rather than a div, for inside a clickable `Surface.Row`.
158
158
 
159
159
  ## Theming & utility
160
160
 
@@ -1,33 +1,33 @@
1
- import { jsx as a, jsxs as m, Fragment as ie } from "react/jsx-runtime";
2
- import { useState as V, useEffect as Ie, useRef as ye } from "react";
3
- import Ne, { useFormFieldIds as Ce } from "../BaseFormComponent.js";
4
- import { Button as le } from "../Button.js";
5
- import { CopyButton as Ee } from "../CopyButton.js";
6
- import ke from "../CustomIcons/EyeClosedIcon.js";
7
- import Se from "../CustomIcons/EyeIcon.js";
8
- import $e from "../CustomIcons/InfoIcon.js";
9
- import { FieldMessage as je } from "../FieldMessage.js";
10
- import ze from "../LoadingInput.js";
11
- import Re from "../Tooltip.js";
12
- import { paintedFieldValue as Te } from "../devWarning.js";
13
- const ae = {
1
+ import { jsx as a, jsxs as s, Fragment as Q } from "react/jsx-runtime";
2
+ import { useState as T, useEffect as ye, useRef as Ne } from "react";
3
+ import Ce, { useFormFieldIds as Ee } from "../BaseFormComponent.js";
4
+ import { Button as Y } from "../Button.js";
5
+ import { CopyButton as ke } from "../CopyButton.js";
6
+ import Se from "../CustomIcons/EyeClosedIcon.js";
7
+ import ze from "../CustomIcons/EyeIcon.js";
8
+ import je from "../CustomIcons/InfoIcon.js";
9
+ import { FieldMessage as Re } from "../FieldMessage.js";
10
+ import Te from "../LoadingInput.js";
11
+ import Ve from "../Tooltip.js";
12
+ import { paintedFieldValue as $e } from "../devWarning.js";
13
+ const O = {
14
14
  small: "h-[var(--malachite-control-height-small,28px)]",
15
15
  medium: "h-[var(--malachite-control-height-medium,32px)]",
16
16
  large: "h-[var(--malachite-control-height-large,42px)]"
17
- }, te = {
17
+ }, Me = {
18
18
  small: "text-[length:var(--malachite-font-size-small,13px)]",
19
19
  medium: "text-[length:var(--malachite-font-size-small,13px)]",
20
20
  large: "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]"
21
- }, re = {
21
+ }, Ze = {
22
22
  small: "px-[10px]",
23
23
  medium: "px-[10px]",
24
24
  large: "px-[16px]"
25
- }, Ve = {
25
+ }, _e = {
26
26
  small: "rounded-[var(--malachite-radius-10,10px)]",
27
27
  medium: "rounded-xl",
28
28
  large: "rounded-[var(--malachite-radius-xxl,14px)]"
29
- }, Me = (t, e) => {
30
- switch (t) {
29
+ }, Ae = (r, e) => {
30
+ switch (r) {
31
31
  case "ghost":
32
32
  return {
33
33
  wrapper: [
@@ -49,250 +49,231 @@ const ae = {
49
49
  borderRadius: ""
50
50
  };
51
51
  }
52
- }, Le = ({
53
- label: t,
52
+ }, Fe = ({
53
+ label: r,
54
54
  hint: e,
55
55
  hintIcon: i,
56
- tooltip: N,
57
- placeholder: f,
58
- icon: x,
56
+ tooltip: g,
57
+ placeholder: b,
58
+ icon: m,
59
59
  name: o,
60
60
  required: h,
61
- requiredIndicator: C,
62
- error: M,
63
- description: Z,
64
- loading: se = !1,
65
- readOnly: b = !1,
66
- type: p = "text",
67
- size: l = "large",
68
- variant: oe = "default",
69
- defaultValue: _,
70
- disabled: v,
71
- prefixValue: A,
72
- prefixSecondaryValue: D,
73
- ellipsis: P = !1,
74
- copyOnClick: de = !1,
75
- formControl: G,
76
- buttons: g,
77
- onCopyClick: H,
78
- showCopyButton: ce,
79
- onChange: E,
80
- value: ne,
81
- onBlur: d,
82
- helperText: w,
83
- showPasswordToggle: k = !0,
84
- id: me,
85
- "aria-label": U,
86
- "aria-labelledby": W,
87
- "aria-describedby": he
61
+ requiredIndicator: w,
62
+ error: V,
63
+ description: $,
64
+ loading: F = !1,
65
+ readOnly: M = !1,
66
+ type: d = "text",
67
+ size: n = "large",
68
+ variant: ee = "default",
69
+ defaultValue: Z,
70
+ disabled: p,
71
+ prefixValue: _,
72
+ prefixSecondaryValue: A,
73
+ ellipsis: ae = !1,
74
+ copyOnClick: re = !1,
75
+ formControl: D,
76
+ buttons: u,
77
+ onCopyClick: P,
78
+ showCopyButton: te,
79
+ onChange: I,
80
+ value: ie,
81
+ onBlur: y,
82
+ helperText: v,
83
+ showPasswordToggle: N = !0,
84
+ id: le,
85
+ autoFocus: se = !1,
86
+ autoComplete: oe = "off",
87
+ "aria-label": de,
88
+ "aria-labelledby": ne,
89
+ "aria-describedby": ce
88
90
  }) => {
89
- const { controlId: S, labelId: pe, descriptionId: X, hintId: q, helperTextId: $ } = Ce({
90
- id: me,
91
- label: t,
92
- description: Z,
91
+ const { controlId: B, labelId: me, descriptionId: G, hintId: H, helperTextId: C } = Ee({
92
+ id: le,
93
+ label: r,
94
+ description: $,
93
95
  hint: e,
94
96
  helperText: !0
95
- }), [j, ve] = V(!1), [ue, fe] = V(_ || ""), [z, J] = V(!1);
96
- Ie(() => {
97
- if (z) {
98
- const r = setTimeout(() => {
99
- J(!1);
97
+ }), [E, he] = T(!1), [pe, ue] = T(Z || ""), [k, L] = T(!1);
98
+ ye(() => {
99
+ if (k) {
100
+ const t = setTimeout(() => {
101
+ L(!1);
100
102
  }, 1e3);
101
- return () => clearTimeout(r);
103
+ return () => clearTimeout(t);
102
104
  }
103
- }, [z]);
104
- const K = (r) => (s) => {
105
- const c = s.target.value;
106
- fe(c), E == null || E(c), r == null || r(c);
107
- }, Q = ye(void 0), Y = (r) => Te({
105
+ }, [k]);
106
+ const ve = (t) => (l) => {
107
+ const c = l.target.value;
108
+ ue(c), I == null || I(c), t == null || t(c);
109
+ }, U = Ne(void 0), W = (t) => $e({
108
110
  component: "Input",
109
111
  name: o,
110
- value: ne,
111
- formValue: r,
112
- defaultValue: _,
113
- bound: !!G,
114
- uncontrolledValue: ue
115
- }), I = H ? () => {
116
- const r = Y(Q.current);
117
- r && (navigator.clipboard.writeText(r), J(!0), H());
118
- } : void 0, L = p === "password" ? j ? "text" : "password" : p, xe = x || A || D, be = ae[l], ge = (r) => {
119
- const s = Me(oe, r);
112
+ value: ie,
113
+ formValue: t,
114
+ defaultValue: Z,
115
+ bound: !!D,
116
+ uncontrolledValue: pe
117
+ }), f = P ? () => {
118
+ const t = W(U.current);
119
+ t && (navigator.clipboard.writeText(t), L(!0), P());
120
+ } : void 0, fe = d === "password" ? E ? "text" : "password" : d, xe = m || _ || A, ge = O[n], be = (t) => {
121
+ const l = Ae(ee, t);
120
122
  return [
121
123
  "relative",
122
124
  "flex items-center",
123
125
  "w-full",
124
- s.borderRadius || Ve[l],
125
- v ? "bg-[var(--malachite-card-dimmed-background)]" : "bg-[var(--malachite-card-background)]",
126
+ l.borderRadius || _e[n],
127
+ p ? "bg-[var(--malachite-card-dimmed-background)]" : "bg-[var(--malachite-card-background)]",
126
128
  "transition-colors duration-200 ease-in-out",
127
- s.shadow,
128
- ...v ? [] : s.wrapper,
129
- ae[l]
129
+ l.shadow,
130
+ ...p ? [] : l.wrapper,
131
+ O[n]
130
132
  ].filter(Boolean).join(" ");
131
133
  };
132
134
  return /* @__PURE__ */ a(
133
- Ne,
135
+ Ce,
134
136
  {
135
- label: t,
137
+ label: r,
136
138
  hint: e,
137
139
  hintIcon: i,
138
- tooltip: N,
140
+ tooltip: g,
139
141
  name: o,
140
142
  required: h,
141
- requiredIndicator: C,
142
- loading: se,
143
- formControl: G,
144
- description: Z,
145
- controlId: S,
146
- labelId: pe,
147
- descriptionId: X,
148
- hintId: q,
143
+ requiredIndicator: w,
144
+ loading: F,
145
+ formControl: D,
146
+ description: $,
147
+ controlId: B,
148
+ labelId: me,
149
+ descriptionId: G,
150
+ hintId: H,
149
151
  loadingComponent: /* @__PURE__ */ a(
150
- ze,
152
+ Te,
151
153
  {
152
- heightClass: be,
153
- helperText: !!w,
154
+ heightClass: ge,
155
+ helperText: !!v,
154
156
  helperTextMarginTop: !0
155
157
  }
156
158
  ),
157
- children: ({ error: r, message: s, onFieldChange: c, onFieldBlur: n, value: O }) => {
158
- Q.current = O;
159
- const u = Y(O), R = ce ?? !!(I && v && u), y = M ?? r, T = M === !1 ? void 0 : s, F = y && !T, we = F || R || (g == null ? void 0 : g.length) || p === "password" && k, B = `${$}-error`, ee = [
160
- X,
161
- q,
162
- w ? $ : void 0,
163
- T ? B : void 0,
164
- he
165
- ].filter(Boolean).join(" ") || void 0;
166
- return /* @__PURE__ */ m(ie, { children: [
167
- /* @__PURE__ */ m("div", { className: ge(y), children: [
159
+ children: ({ error: t, message: l, onFieldChange: c, onFieldBlur: S, value: X }) => {
160
+ U.current = X;
161
+ const x = W(X), z = te ?? !!(f && p && x), j = V ?? t, R = V === !1 ? void 0 : l, q = j && !R, we = q || z || (u == null ? void 0 : u.length) || d === "password" && N, J = `${C}-error`, Ie = [
162
+ G,
163
+ H,
164
+ v ? C : void 0,
165
+ R ? J : void 0,
166
+ ce
167
+ ].filter(Boolean).join(" ") || void 0, K = /* @__PURE__ */ a(
168
+ "input",
169
+ {
170
+ id: B,
171
+ type: fe,
172
+ placeholder: b,
173
+ value: x,
174
+ onChange: ve(c),
175
+ onBlur: () => {
176
+ y == null || y(), S == null || S();
177
+ },
178
+ disabled: p || M,
179
+ readOnly: M,
180
+ autoComplete: oe,
181
+ autoFocus: se,
182
+ "aria-label": de,
183
+ "aria-labelledby": ne,
184
+ "aria-invalid": j || void 0,
185
+ "aria-required": h || void 0,
186
+ "aria-describedby": Ie,
187
+ className: `flex-1 bg-transparent border-none outline-none text-[var(--malachite-text-primary)] placeholder:text-[var(--malachite-text-placeholder)] disabled:text-[var(--malachite-text-primary)] disabled:cursor-not-allowed ${Me[n]} ${Ze[n]} ${ae ? "min-w-0 truncate" : ""}`,
188
+ name: o
189
+ }
190
+ );
191
+ return /* @__PURE__ */ s(Q, { children: [
192
+ /* @__PURE__ */ s("div", { className: be(j), children: [
168
193
  xe && /* @__PURE__ */ a("div", { className: "flex items-center pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ a(
169
- Ze,
194
+ De,
170
195
  {
171
- prefixValue: A,
172
- prefixSecondaryValue: D,
173
- icon: x
196
+ prefixValue: _,
197
+ prefixSecondaryValue: A,
198
+ icon: m
174
199
  }
175
200
  ) }),
176
- de && R && I ? /* @__PURE__ */ a(
177
- Re,
201
+ re && z && f ? /* @__PURE__ */ a(
202
+ Ve,
178
203
  {
179
- text: u,
204
+ text: x,
180
205
  fill: !0,
181
206
  triggerAs: "div",
182
207
  describesTrigger: !1,
183
208
  showOnFocus: !1,
184
- children: /* @__PURE__ */ m("div", { className: "relative flex min-w-0 flex-1", children: [
185
- /* @__PURE__ */ a(
186
- "input",
187
- {
188
- id: S,
189
- type: L,
190
- placeholder: f,
191
- value: u,
192
- onChange: K(c),
193
- onBlur: () => {
194
- d == null || d(), n == null || n();
195
- },
196
- disabled: v || b,
197
- readOnly: b,
198
- autoComplete: "off",
199
- "aria-label": U,
200
- "aria-labelledby": W,
201
- "aria-invalid": y || void 0,
202
- "aria-required": h || void 0,
203
- "aria-describedby": ee,
204
- className: `flex-1 bg-transparent border-none outline-none text-[var(--malachite-text-primary)] placeholder:text-[var(--malachite-text-placeholder)] disabled:text-[var(--malachite-text-primary)] disabled:cursor-not-allowed ${te[l]} ${re[l]} ${P ? "min-w-0 truncate" : ""}`,
205
- name: o
206
- }
207
- ),
209
+ children: /* @__PURE__ */ s("div", { className: "relative flex min-w-0 flex-1", children: [
210
+ K,
208
211
  /* @__PURE__ */ a(
209
212
  "button",
210
213
  {
211
214
  type: "button",
212
215
  tabIndex: -1,
213
216
  "aria-hidden": "true",
214
- onClick: I,
217
+ onClick: f,
215
218
  className: "absolute inset-0 cursor-copy border-0 bg-transparent p-0"
216
219
  }
217
220
  )
218
221
  ] })
219
222
  }
220
- ) : /* @__PURE__ */ a(
221
- "input",
222
- {
223
- id: S,
224
- type: L,
225
- placeholder: f,
226
- value: u,
227
- onChange: K(c),
228
- onBlur: () => {
229
- d == null || d(), n == null || n();
230
- },
231
- disabled: v || b,
232
- readOnly: b,
233
- autoComplete: "off",
234
- "aria-label": U,
235
- "aria-labelledby": W,
236
- "aria-invalid": y || void 0,
237
- "aria-required": h || void 0,
238
- "aria-describedby": ee,
239
- className: `flex-1 bg-transparent border-none outline-none text-[var(--malachite-text-primary)] placeholder:text-[var(--malachite-text-placeholder)] disabled:text-[var(--malachite-text-primary)] disabled:cursor-not-allowed ${te[l]} ${re[l]} ${P ? "min-w-0 truncate" : ""}`,
240
- name: o
241
- }
242
- ),
243
- we && /* @__PURE__ */ m(
223
+ ) : K,
224
+ we && /* @__PURE__ */ s(
244
225
  "div",
245
226
  {
246
- className: `flex items-center pl-1 flex-shrink-0 ${p === "password" && k ? "pr-0" : "pr-3"}`,
227
+ className: `flex items-center pl-1 flex-shrink-0 ${d === "password" && N ? "pr-0" : "pr-3"}`,
247
228
  children: [
248
229
  /* @__PURE__ */ a(
249
- _e,
230
+ Pe,
250
231
  {
251
- error: F,
252
- defaultValue: u,
253
- onCopyClick: I,
254
- showCopyButton: R,
255
- copied: z,
256
- type: p,
257
- showPassword: j,
258
- showPasswordToggle: k,
259
- onTogglePassword: () => ve(!j)
232
+ error: q,
233
+ defaultValue: x,
234
+ onCopyClick: f,
235
+ showCopyButton: z,
236
+ copied: k,
237
+ type: d,
238
+ showPassword: E,
239
+ showPasswordToggle: N,
240
+ onTogglePassword: () => he(!E)
260
241
  }
261
242
  ),
262
- /* @__PURE__ */ a(Ae, { buttons: g })
243
+ /* @__PURE__ */ a(Be, { buttons: u })
263
244
  ]
264
245
  }
265
246
  )
266
247
  ] }),
267
- w && /* @__PURE__ */ a(
248
+ v && /* @__PURE__ */ a(
268
249
  "div",
269
250
  {
270
- id: $,
251
+ id: C,
271
252
  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]",
272
- children: w
253
+ children: v
273
254
  }
274
255
  ),
275
- /* @__PURE__ */ a(je, { id: B, message: T, spaced: !0 })
256
+ /* @__PURE__ */ a(Re, { id: J, message: R, spaced: !0 })
276
257
  ] });
277
258
  }
278
259
  }
279
260
  );
280
- }, Ze = ({ prefixValue: t, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ m("div", { className: "flex items-center gap-1", children: [
261
+ }, De = ({ prefixValue: r, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
281
262
  i && /* @__PURE__ */ a("span", { className: "flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0", children: i }),
282
- 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 }),
263
+ r && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-medium,14px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: r }),
283
264
  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 })
284
- ] }), _e = ({
285
- error: t,
265
+ ] }), Pe = ({
266
+ error: r,
286
267
  defaultValue: e,
287
268
  onCopyClick: i,
288
- showCopyButton: N = !1,
289
- copied: f = !1,
290
- type: x,
269
+ showCopyButton: g = !1,
270
+ copied: b = !1,
271
+ type: m,
291
272
  showPassword: o,
292
273
  showPasswordToggle: h = !0,
293
- onTogglePassword: C
294
- }) => /* @__PURE__ */ m("div", { className: "flex items-center gap-1", children: [
295
- t && // Decorative: the rejection is carried by the message beneath the field, so
274
+ onTogglePassword: w
275
+ }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
276
+ r && // Decorative: the rejection is carried by the message beneath the field, so
296
277
  // announcing an unnamed icon here would only repeat it as "info".
297
278
  /* @__PURE__ */ a(
298
279
  "div",
@@ -300,7 +281,7 @@ const ae = {
300
281
  "aria-hidden": "true",
301
282
  className: "flex items-center justify-center w-5 h-5 flex-shrink-0",
302
283
  children: /* @__PURE__ */ a(
303
- $e,
284
+ je,
304
285
  {
305
286
  size: 16,
306
287
  className: "text-[var(--malachite-destructive-foreground,rgb(196,62,62))]"
@@ -308,16 +289,16 @@ const ae = {
308
289
  )
309
290
  }
310
291
  ),
311
- N && i && e && /* @__PURE__ */ a(Ee, { copied: f, onCopy: i }),
312
- x === "password" && h && /* @__PURE__ */ a(le, { variant: "no-style", onClick: C, type: "button", size: "small", children: o ? /* @__PURE__ */ a(
313
- ke,
292
+ g && i && e && /* @__PURE__ */ a(ke, { copied: b, onCopy: i }),
293
+ m === "password" && h && /* @__PURE__ */ a(Y, { variant: "no-style", onClick: w, type: "button", size: "small", children: o ? /* @__PURE__ */ a(
294
+ Se,
314
295
  {
315
296
  size: 16,
316
297
  style: { color: "var(--malachite-text-dimmed)" }
317
298
  }
318
- ) : /* @__PURE__ */ a(Se, { size: 16, style: { color: "var(--malachite-text-dimmed)" } }) })
319
- ] }), Ae = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ a(ie, { children: t.map((e) => /* @__PURE__ */ a(
320
- le,
299
+ ) : /* @__PURE__ */ a(ze, { size: 16, style: { color: "var(--malachite-text-dimmed)" } }) })
300
+ ] }), Be = ({ buttons: r }) => r != null && r.length ? /* @__PURE__ */ a(Q, { children: r.map((e) => /* @__PURE__ */ a(
301
+ Y,
321
302
  {
322
303
  variant: e.variant || (e.danger ? "destructive" : "outline"),
323
304
  size: e.size || "small",
@@ -331,6 +312,6 @@ const ae = {
331
312
  e.label
332
313
  )) }) : null;
333
314
  export {
334
- Le as default
315
+ Fe as default
335
316
  };
336
317
  //# sourceMappingURL=Input.js.map