@stackone/malachite 2.131.0 → 2.133.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.
Files changed (41) hide show
  1. package/COMPONENTS.md +8 -8
  2. package/dist/assets/icons/hexagon_fill.svg.js +6 -0
  3. package/dist/assets/icons/hexagon_fill.svg.js.map +1 -0
  4. package/dist/assets/icons/shield_star_fill.svg.js +6 -0
  5. package/dist/assets/icons/shield_star_fill.svg.js.map +1 -0
  6. package/dist/components/Button.js.map +1 -1
  7. package/dist/components/CodeBlock.js +130 -130
  8. package/dist/components/CodeBlock.js.map +1 -1
  9. package/dist/components/CodeBlockHighlighter.js +65 -65
  10. package/dist/components/CodeBlockHighlighter.js.map +1 -1
  11. package/dist/components/CodePreview.js +74 -63
  12. package/dist/components/CodePreview.js.map +1 -1
  13. package/dist/components/FormActions.js +13 -9
  14. package/dist/components/FormActions.js.map +1 -1
  15. package/dist/components/Hexagon.js +33 -26
  16. package/dist/components/Hexagon.js.map +1 -1
  17. package/dist/components/HexagonScale.js +20 -19
  18. package/dist/components/HexagonScale.js.map +1 -1
  19. package/dist/components/Input/Input.js +55 -54
  20. package/dist/components/Input/Input.js.map +1 -1
  21. package/dist/components/KeyValueList.js +36 -32
  22. package/dist/components/KeyValueList.js.map +1 -1
  23. package/dist/components/QueryInput.js +91 -90
  24. package/dist/components/QueryInput.js.map +1 -1
  25. package/dist/components/Surface.js +1 -1
  26. package/dist/components/Surface.js.map +1 -1
  27. package/dist/components/Table/Table.js +691 -637
  28. package/dist/components/Table/Table.js.map +1 -1
  29. package/dist/components/TextArea/TextArea.js +46 -46
  30. package/dist/components/TextArea/TextArea.js.map +1 -1
  31. package/dist/components/buttonStyles.js +2 -0
  32. package/dist/components/buttonStyles.js.map +1 -1
  33. package/dist/components/codeBlockStyles.js +11 -6
  34. package/dist/components/codeBlockStyles.js.map +1 -1
  35. package/dist/components/codePreviewJson.js +25 -0
  36. package/dist/components/codePreviewJson.js.map +1 -0
  37. package/dist/index.d.ts +42 -7
  38. package/dist/tailwind.css.js +1 -1
  39. package/dist/theme.js +11 -3
  40. package/dist/theme.js.map +1 -1
  41. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { jsx as a, jsxs as h, Fragment as ue } from "react/jsx-runtime";
2
- import { useState as pe, useRef as ge, useCallback as be, useLayoutEffect as we } from "react";
1
+ import { jsx as r, jsxs as h, Fragment as pe } from "react/jsx-runtime";
2
+ import { useState as ue, useRef as ge, useCallback as be, useLayoutEffect as we } from "react";
3
3
  import ye, { useFormFieldIds as Ne } from "../BaseFormComponent.js";
4
4
  import { Button as Ie } from "../Button.js";
5
5
  import He from "../CustomIcons/CopyIcon.js";
@@ -18,7 +18,7 @@ const Ae = (t) => {
18
18
  default:
19
19
  return "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]";
20
20
  }
21
- }, Me = (t, e) => t ? "focus-within:border-[var(--malachite-destructive-border-hover)] hover:border-[var(--malachite-destructive-border-hover)]" : e === "assistant" ? "focus-within:border-[var(--malachite-assistant-foreground)] hover:border-[var(--malachite-assistant-foreground)]" : `${Ce} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`, q = (t, e) => ({
21
+ }, Me = (t, e) => t ? "field-invalid" : e === "assistant" ? "focus-within:border-[var(--malachite-assistant-foreground)] hover:border-[var(--malachite-assistant-foreground)]" : `${Ce} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`, q = (t, e) => ({
22
22
  small: 20,
23
23
  medium: 22,
24
24
  large: 24
@@ -39,8 +39,8 @@ const Ae = (t) => {
39
39
  size: d = "medium",
40
40
  defaultValue: E,
41
41
  disabled: c,
42
- prefixValue: u,
43
- prefixSecondaryValue: p,
42
+ prefixValue: p,
43
+ prefixSecondaryValue: u,
44
44
  // ellipsis = false,
45
45
  formControl: L,
46
46
  buttons: x,
@@ -67,31 +67,31 @@ const Ae = (t) => {
67
67
  description: $,
68
68
  hint: e,
69
69
  helperText: !0
70
- }), [re, ae] = pe(E || ""), U = ge(null), z = be(() => {
71
- const r = U.current;
72
- if (!r || H === void 0)
70
+ }), [ae, re] = ue(E || ""), U = ge(null), z = be(() => {
71
+ const a = U.current;
72
+ if (!a || H === void 0)
73
73
  return;
74
74
  const s = q(d, H);
75
- r.style.height = "auto";
76
- const i = Math.min(r.scrollHeight, s);
77
- r.style.height = `${i}px`, r.style.overflowY = r.scrollHeight > s ? "auto" : "hidden";
75
+ a.style.height = "auto";
76
+ const i = Math.min(a.scrollHeight, s);
77
+ a.style.height = `${i}px`, a.style.overflowY = a.scrollHeight > s ? "auto" : "hidden";
78
78
  }, [H, d]);
79
79
  we(() => {
80
80
  z();
81
81
  }, [z, w]);
82
- const ie = w !== void 0, le = (r) => ze({
82
+ const ie = w !== void 0, le = (a) => ze({
83
83
  component: "TextArea",
84
84
  name: v,
85
85
  value: w,
86
- formValue: r,
86
+ formValue: a,
87
87
  defaultValue: E,
88
88
  bound: !!L,
89
- uncontrolledValue: re
90
- }), se = (r) => (s) => {
89
+ uncontrolledValue: ae
90
+ }), se = (a) => (s) => {
91
91
  const i = s.target.value;
92
- ie || ae(i), z(), g == null || g(i), r == null || r(i);
93
- }, ne = A || u || p, Y = `${k}-error`, oe = (r, s, i, m, f, C) => {
94
- const n = le(C), _ = r && !f, me = _ || P && c && n || (x == null ? void 0 : x.length), he = [
92
+ ie || re(i), z(), g == null || g(i), a == null || a(i);
93
+ }, ne = A || p || u, Y = `${k}-error`, oe = (a, s, i, m, f, C) => {
94
+ const n = le(C), _ = a && !f, me = _ || P && c && n || (x == null ? void 0 : x.length), he = [
95
95
  D,
96
96
  O,
97
97
  s ? k : void 0,
@@ -104,8 +104,8 @@ const Ae = (t) => {
104
104
  "border border-solid",
105
105
  c ? "bg-[var(--malachite-card-dimmed-background)]" : "bg-[var(--malachite-card-background)]",
106
106
  "transition-colors duration-200 ease-in-out",
107
- r ? "shadow-error" : "shadow-default",
108
- r ? "border-[var(--malachite-destructive-border)]" : "border-[var(--malachite-card-border)]",
107
+ a ? "shadow-error" : "shadow-default",
108
+ a ? "border-[var(--malachite-destructive-border)]" : "border-[var(--malachite-card-border)]",
109
109
  // One border-hover colour, not two overlapping utilities for the same states: a
110
110
  // duplicate pair used to sit above this one, fixed at the default accent — since
111
111
  // it targeted the identical `focus-within`/`hover` selectors, a `tone` swap here
@@ -115,7 +115,7 @@ const Ae = (t) => {
115
115
  // indicator, the same as the default tone's. Adding a ring here drew a second,
116
116
  // concentric outline around the first on `assistant` — the field already has one,
117
117
  // it only needed to change colour.
118
- c ? "" : Me(r, W)
118
+ c ? "" : Me(a, W)
119
119
  ].filter(Boolean).join(" "), fe = [
120
120
  "flex-1",
121
121
  "bg-transparent",
@@ -132,7 +132,7 @@ const Ae = (t) => {
132
132
  "py-[12px]",
133
133
  j === "none" ? "resize-none" : j === "vertical" ? "resize-y" : j === "horizontal" ? "resize-x" : "resize",
134
134
  R ? "" : "whitespace-pre overflow-x-auto min-w-0"
135
- ].filter(Boolean).join(" "), ve = /* @__PURE__ */ a(
135
+ ].filter(Boolean).join(" "), ve = /* @__PURE__ */ r(
136
136
  "textarea",
137
137
  {
138
138
  ref: U,
@@ -146,10 +146,10 @@ const Ae = (t) => {
146
146
  onKeyDown: V,
147
147
  "aria-label": F,
148
148
  "aria-labelledby": ee,
149
- "aria-invalid": r || void 0,
149
+ "aria-invalid": a || void 0,
150
150
  "aria-required": M || void 0,
151
151
  "aria-describedby": he,
152
- disabled: c || !!u || !!p || B,
152
+ disabled: c || !!p || !!u || B,
153
153
  readOnly: B,
154
154
  wrap: R ? void 0 : "off",
155
155
  rows: I,
@@ -160,18 +160,18 @@ const Ae = (t) => {
160
160
  }
161
161
  );
162
162
  return /* @__PURE__ */ h("div", { className: xe, children: [
163
- ne && /* @__PURE__ */ a("div", { className: "flex pt-3 pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ a(
163
+ ne && /* @__PURE__ */ r("div", { className: "flex pt-3 pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ r(
164
164
  $e,
165
165
  {
166
- prefixValue: u,
167
- prefixSecondaryValue: p,
166
+ prefixValue: p,
167
+ prefixSecondaryValue: u,
168
168
  icon: A
169
169
  }
170
170
  ) }),
171
171
  ve,
172
- b && /* @__PURE__ */ a("div", { className: "absolute bottom-2 right-2 flex items-center", children: b }),
172
+ b && /* @__PURE__ */ r("div", { className: "absolute bottom-2 right-2 flex items-center", children: b }),
173
173
  me && /* @__PURE__ */ h("div", { className: "flex pt-3 pl-1 pr-3 flex-shrink-0", children: [
174
- /* @__PURE__ */ a(
174
+ /* @__PURE__ */ r(
175
175
  Be,
176
176
  {
177
177
  error: _,
@@ -180,18 +180,18 @@ const Ae = (t) => {
180
180
  onCopyClick: P
181
181
  }
182
182
  ),
183
- /* @__PURE__ */ a(Ee, { buttons: x })
183
+ /* @__PURE__ */ r(Ee, { buttons: x })
184
184
  ] })
185
185
  ] });
186
- }, de = () => N ? /* @__PURE__ */ a(
186
+ }, de = () => N ? /* @__PURE__ */ r(
187
187
  "div",
188
188
  {
189
189
  id: k,
190
190
  className: "mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))]",
191
191
  children: N
192
192
  }
193
- ) : null, ce = (r) => /* @__PURE__ */ a(ke, { id: Y, message: r, spaced: !0 });
194
- return /* @__PURE__ */ a(
193
+ ) : null, ce = (a) => /* @__PURE__ */ r(ke, { id: Y, message: a, spaced: !0 });
194
+ return /* @__PURE__ */ r(
195
195
  ye,
196
196
  {
197
197
  label: t,
@@ -208,10 +208,10 @@ const Ae = (t) => {
208
208
  labelId: te,
209
209
  descriptionId: D,
210
210
  hintId: O,
211
- loadingComponent: /* @__PURE__ */ a(Te, { size: d, rows: I }),
212
- children: ({ error: r, message: s, onFieldChange: i, onFieldBlur: m, value: f }) => {
213
- const C = T ?? r, n = T === !1 ? void 0 : s;
214
- return /* @__PURE__ */ h(ue, { children: [
211
+ loadingComponent: /* @__PURE__ */ r(Te, { size: d, rows: I }),
212
+ children: ({ error: a, message: s, onFieldChange: i, onFieldBlur: m, value: f }) => {
213
+ const C = T ?? a, n = T === !1 ? void 0 : s;
214
+ return /* @__PURE__ */ h(pe, { children: [
215
215
  oe(
216
216
  C,
217
217
  N,
@@ -232,7 +232,7 @@ const Ae = (t) => {
232
232
  }) => (
233
233
  // Decorative height placeholder — kept out of the a11y tree so it is not announced
234
234
  // as an unlabelled box (same as Skeleton and LoadingInput).
235
- /* @__PURE__ */ a(
235
+ /* @__PURE__ */ r(
236
236
  "div",
237
237
  {
238
238
  "aria-busy": "true",
@@ -242,17 +242,17 @@ const Ae = (t) => {
242
242
  }
243
243
  )
244
244
  ), $e = ({ prefixValue: t, prefixSecondaryValue: e, icon: l }) => /* @__PURE__ */ h("div", { className: "flex items-start gap-1", children: [
245
- l && /* @__PURE__ */ a("span", { className: "flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0 mt-1", children: l }),
246
- t && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: t }),
247
- e && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: e })
245
+ l && /* @__PURE__ */ r("span", { className: "flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0 mt-1", children: l }),
246
+ t && /* @__PURE__ */ r("span", { className: "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: t }),
247
+ e && /* @__PURE__ */ r("span", { className: "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: e })
248
248
  ] }), Be = ({ error: t, disabled: e, defaultValue: l, onCopyClick: o }) => /* @__PURE__ */ h("div", { className: "flex items-start gap-1", children: [
249
249
  t && // Decorative: the rejection is carried by the message beneath the field.
250
- /* @__PURE__ */ a(
250
+ /* @__PURE__ */ r(
251
251
  "div",
252
252
  {
253
253
  "aria-hidden": "true",
254
254
  className: "flex items-center justify-center w-5 h-5 flex-shrink-0 mt-1",
255
- children: /* @__PURE__ */ a(
255
+ children: /* @__PURE__ */ r(
256
256
  je,
257
257
  {
258
258
  size: 16,
@@ -261,7 +261,7 @@ const Ae = (t) => {
261
261
  )
262
262
  }
263
263
  ),
264
- o && e && l && /* @__PURE__ */ a(
264
+ o && e && l && /* @__PURE__ */ r(
265
265
  "button",
266
266
  {
267
267
  onClick: () => {
@@ -270,10 +270,10 @@ const Ae = (t) => {
270
270
  type: "button",
271
271
  "aria-label": "Copy to clipboard",
272
272
  className: "flex items-center justify-center w-5 h-5 hover:bg-[var(--malachite-primary-border)] rounded transition-colors flex-shrink-0 mt-1",
273
- children: /* @__PURE__ */ a(He, { size: 16 })
273
+ children: /* @__PURE__ */ r(He, { size: 16 })
274
274
  }
275
275
  )
276
- ] }), Ee = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ a("div", { className: "flex flex-col gap-1 mt-1", children: t.map((e) => /* @__PURE__ */ a(
276
+ ] }), Ee = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-1 mt-1", children: t.map((e) => /* @__PURE__ */ r(
277
277
  Ie,
278
278
  {
279
279
  variant: e.danger ? "destructive" : "outline",
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport type { Control, FieldPath, FieldValues } from 'react-hook-form';\nimport BaseFormComponent, { type RequiredIndicator, useFormFieldIds } from '../BaseFormComponent';\nimport { Button } from '../Button';\nimport CopyIcon from '../CustomIcons/CopyIcon';\nimport InfoIcon from '../CustomIcons/InfoIcon';\nimport FieldMessage from '../FieldMessage';\nimport { paintedFieldValue } from '../devWarning';\nimport { FOCUS_BORDER } from '../focusRing';\nimport type { ButtonDefinition, TextAreaSize } from './types';\n\n/**\n * `assistant` is the chrome for a field sitting in an AI context (e.g. `Chat.Composer`'s\n * policy-assistant tone): the field's own focus border recolours to the assistant violet\n * instead of the default accent — same indicator, different colour, not an extra one. Same\n * naming precedent as `PillButton`'s own `tone`.\n */\ntype TextAreaTone = 'default' | 'assistant';\n\ninterface TextAreaProps {\n label?: string;\n hint?: string;\n /** Decorative icon drawn before `hint`, such as a glyph for the value's type. Shown only with a `hint`. */\n hintIcon?: React.ReactNode;\n tooltip?: string;\n placeholder?: string;\n icon?: React.ReactNode;\n readOnly?: boolean;\n name: FieldPath<FieldValues> | string;\n description?: string;\n size?: TextAreaSize;\n required?: boolean;\n requiredIndicator?: RequiredIndicator;\n error?: boolean;\n loading?: boolean;\n defaultValue?: string;\n disabled?: boolean;\n prefixValue?: string;\n prefixSecondaryValue?: string;\n ellipsis?: boolean;\n formControl?: Control<FieldValues, unknown>;\n buttons?: ButtonDefinition[];\n onCopyClick?: () => void;\n onChange?: (value: string) => void;\n value?: string;\n onBlur?: () => void;\n /** Key handling the control cannot own, e.g. Enter-to-submit in a chat composer. */\n onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n /**\n * A control that belongs inside the field, pinned bottom-right — a chat composer's send.\n * The field reserves room for it, so text cannot run underneath.\n */\n inFieldAction?: React.ReactNode;\n /** See `TextAreaTone`. Defaults to `'default'`, so no existing field changes. */\n tone?: TextAreaTone;\n helperText?: React.ReactNode;\n rows?: number;\n /**\n * Grows the field from `rows` up to this many lines as content is typed, then scrolls\n * internally rather than growing further. Omitted keeps the field at a fixed `rows`\n * height, the pre-existing behaviour.\n */\n maxRows?: number;\n maxLength?: number;\n resize?: 'none' | 'vertical' | 'horizontal' | 'both';\n /**\n * When false, lines are not soft-wrapped — long content scrolls horizontally\n * instead of wrapping (native `wrap=\"off\"`). Useful for one-value-per-line\n * content like URLs. Defaults to true.\n */\n wrap?: boolean;\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nconst getSizeClasses = (size: TextAreaSize): string => {\n switch (size) {\n case 'small':\n return 'text-sm';\n case 'medium':\n return 'text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]';\n case 'large':\n return 'text-base';\n default:\n return 'text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]';\n }\n};\n\n/**\n * A rejection always wins the border colour, regardless of `tone`: a field the caller has\n * flagged invalid stays destructive-red on focus even inside an assistant surface.\n *\n * Every class is a complete literal, here or in `focusRing.ts` for the shared focus border,\n * never a shared colour interpolated into one. Tailwind extracts candidates by scanning source\n * text, so a class built at runtime is one Tailwind never sees — and the CSS is simply absent,\n * with no build error.\n * The assistant pair was surviving only because the same literal appears in a spec's\n * assertion, which the content glob also scans: rewording that assertion would have silently\n * dropped the violet focus border.\n */\nconst focusBorderClasses = (isError: boolean, tone: TextAreaTone): string => {\n if (isError) {\n return 'focus-within:border-[var(--malachite-destructive-border-hover)] hover:border-[var(--malachite-destructive-border-hover)]';\n }\n\n if (tone === 'assistant') {\n return 'focus-within:border-[var(--malachite-assistant-foreground)] hover:border-[var(--malachite-assistant-foreground)]';\n }\n\n return `${FOCUS_BORDER} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`;\n};\n\n// Shared by the static min-height and the auto-grow ceiling, so a field's grown height\n// lines up with the same row metrics its resting height already used.\nconst rowHeightPx = (size: TextAreaSize, rows: number): number => {\n const baseHeight = {\n small: 20,\n medium: 22,\n large: 24,\n }[size];\n\n // Every size renders `py-[12px]`, so the vertical padding is 24 regardless of size.\n const padding = 24;\n\n return baseHeight * rows + padding;\n};\n\nconst getMinHeight = (size: TextAreaSize, rows: number): string => `${rowHeightPx(size, rows)}px`;\n\nconst TextArea: React.FC<TextAreaProps> = ({\n label,\n hint,\n hintIcon,\n tooltip,\n placeholder,\n icon,\n name,\n required,\n requiredIndicator,\n error,\n description,\n loading = false,\n readOnly = false,\n size = 'medium',\n defaultValue,\n disabled,\n prefixValue,\n prefixSecondaryValue,\n // ellipsis = false,\n formControl,\n buttons,\n onCopyClick,\n onChange,\n onKeyDown,\n inFieldAction,\n tone = 'default',\n value,\n onBlur,\n helperText,\n rows = 4,\n maxRows,\n maxLength,\n resize = 'vertical',\n wrap = true,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const { controlId, labelId, descriptionId, hintId, helperTextId } = useFormFieldIds({\n id,\n label,\n description,\n hint,\n helperText: true,\n });\n const [internalValue, setInternalValue] = useState(defaultValue || '');\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n\n // Reset-then-measure rather than growing incrementally: `scrollHeight` on a field already\n // taller than its content stays stuck at that height, so the reset is what lets a paste\n // followed by a delete shrink the field back down, not just grow it. Mutates the DOM\n // directly instead of round-tripping through React state, so typing a character never\n // re-renders this component just to change its own height.\n const resizeToFit = useCallback(() => {\n const el = textareaRef.current;\n if (!el || maxRows === undefined) {\n return;\n }\n\n const maxHeight = rowHeightPx(size, maxRows);\n el.style.height = 'auto';\n const nextHeight = Math.min(el.scrollHeight, maxHeight);\n el.style.height = `${nextHeight}px`;\n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }, [maxRows, size]);\n\n // Catches every change `onChange` on the element itself would miss: the initial mount,\n // and a value the parent sets from outside (e.g. clearing the composer after send).\n // biome-ignore lint/correctness/useExhaustiveDependencies: `value` is not read in the body, but a controlled `value` changing from outside is exactly the case `onChange` cannot see, so the effect has to re-run on it anyway.\n useLayoutEffect(() => {\n resizeToFit();\n }, [resizeToFit, value]);\n\n const isControlled = value !== undefined;\n const paintedValue = (formValue: unknown): string =>\n paintedFieldValue({\n component: 'TextArea',\n name,\n value,\n formValue,\n defaultValue,\n bound: !!formControl,\n uncontrolledValue: internalValue,\n });\n\n const handleChange =\n (reportToForm?: (value: unknown) => void) =>\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const newValue = e.target.value;\n if (!isControlled) {\n setInternalValue(newValue);\n }\n // The browser has already applied the keystroke to the element by the time this\n // fires, so `scrollHeight` already reflects it — no need to wait for a re-render.\n resizeToFit();\n onChange?.(newValue);\n reportToForm?.(newValue);\n };\n\n const hasPrefix = icon || prefixValue || prefixSecondaryValue;\n\n const errorMessageId = `${helperTextId}-error`;\n\n const renderTextArea = (\n isError: boolean,\n resolvedHelperText?: React.ReactNode,\n onFieldChange?: (value: unknown) => void,\n onFieldBlur?: () => void,\n errorMessage?: string,\n formValue?: unknown,\n ) => {\n const textAreaValue = paintedValue(formValue);\n // The icon is the only signal a consumer-forced `error` has; beside a message it is\n // duplication, and it crowds the suffix next to a reveal or copy control.\n const showErrorIcon = isError && !errorMessage;\n const hasSuffix =\n showErrorIcon || (onCopyClick && disabled && textAreaValue) || buttons?.length;\n const describedBy =\n [\n descriptionId,\n hintId,\n resolvedHelperText ? helperTextId : undefined,\n errorMessage ? errorMessageId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n const wrapperClasses = [\n 'relative',\n 'flex',\n 'w-full',\n 'rounded-xl',\n 'border border-solid',\n disabled\n ? 'bg-[var(--malachite-card-dimmed-background)]'\n : 'bg-[var(--malachite-card-background)]',\n 'transition-colors duration-200 ease-in-out',\n isError ? 'shadow-error' : 'shadow-default',\n isError\n ? 'border-[var(--malachite-destructive-border)]'\n : 'border-[var(--malachite-card-border)]',\n // One border-hover colour, not two overlapping utilities for the same states: a\n // duplicate pair used to sit above this one, fixed at the default accent — since\n // it targeted the identical `focus-within`/`hover` selectors, a `tone` swap here\n // would otherwise leave a second, conflicting colour in the class list.\n //\n // No separate ring on top of it: the recoloured border IS this field's focus\n // indicator, the same as the default tone's. Adding a ring here drew a second,\n // concentric outline around the first on `assistant` — the field already has one,\n // it only needed to change colour.\n disabled ? '' : focusBorderClasses(isError, tone),\n ]\n .filter(Boolean)\n .join(' ');\n\n const textAreaClasses = [\n 'flex-1',\n 'bg-transparent',\n 'border-none',\n 'outline-none',\n 'text-[var(--malachite-text-primary)]',\n 'placeholder:text-[var(--malachite-text-placeholder)]',\n 'disabled:text-[var(--malachite-text-dimmed)]',\n 'disabled:cursor-not-allowed',\n getSizeClasses(size),\n // Emitted as one side each when an action sits in the field: `px` and `pr` are\n // the same specificity, so which wins would rest on Tailwind's output order.\n inFieldAction ? 'pl-[16px] pr-[52px]' : 'px-[16px]',\n 'py-[12px]',\n resize === 'none'\n ? 'resize-none'\n : resize === 'vertical'\n ? 'resize-y'\n : resize === 'horizontal'\n ? 'resize-x'\n : 'resize',\n wrap ? '' : 'whitespace-pre overflow-x-auto min-w-0',\n ]\n .filter(Boolean)\n .join(' ');\n\n const textAreaElement = (\n <textarea\n ref={textareaRef}\n id={controlId}\n placeholder={placeholder}\n value={textAreaValue}\n onChange={handleChange(onFieldChange)}\n onBlur={() => {\n onBlur?.();\n onFieldBlur?.();\n }}\n onKeyDown={onKeyDown}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-invalid={isError || undefined}\n aria-required={required || undefined}\n aria-describedby={describedBy}\n disabled={disabled || !!prefixValue || !!prefixSecondaryValue || readOnly}\n readOnly={readOnly}\n wrap={wrap ? undefined : 'off'}\n rows={rows}\n maxLength={maxLength}\n style={{ minHeight: getMinHeight(size, rows) }}\n className={textAreaClasses}\n name={name}\n />\n );\n\n return (\n <div className={wrapperClasses}>\n {hasPrefix && (\n <div className=\"flex pt-3 pl-3 pr-1 flex-shrink-0 pointer-events-none\">\n <CompositeIcon\n prefixValue={prefixValue}\n prefixSecondaryValue={prefixSecondaryValue}\n icon={icon}\n />\n </div>\n )}\n\n {textAreaElement}\n\n {inFieldAction && (\n <div className=\"absolute bottom-2 right-2 flex items-center\">\n {inFieldAction}\n </div>\n )}\n\n {hasSuffix && (\n <div className=\"flex pt-3 pl-1 pr-3 flex-shrink-0\">\n <Suffix\n error={showErrorIcon}\n disabled={disabled}\n defaultValue={textAreaValue}\n onCopyClick={onCopyClick}\n />\n <TextAreaButtons buttons={buttons} />\n </div>\n )}\n </div>\n );\n };\n\n const renderHelperText = () =>\n helperText ? (\n <div\n id={helperTextId}\n className=\"mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))]\"\n >\n {helperText}\n </div>\n ) : null;\n\n const renderErrorMessage = (errorMessage?: string) => (\n <FieldMessage id={errorMessageId} message={errorMessage} spaced />\n );\n\n return (\n <BaseFormComponent\n label={label}\n hint={hint}\n hintIcon={hintIcon}\n tooltip={tooltip}\n name={name}\n required={required}\n requiredIndicator={requiredIndicator}\n loading={loading}\n formControl={formControl}\n description={description}\n controlId={controlId}\n labelId={labelId}\n descriptionId={descriptionId}\n hintId={hintId}\n loadingComponent={<LoadingTextArea size={size} rows={rows} />}\n >\n {({ error: fieldError, message, onFieldChange, onFieldBlur, value: formValue }) => {\n const isError = error ?? fieldError;\n // `error={false}` opts out of the resolver entirely, message included: a\n // screen that has dealt with the rejection its own way would otherwise keep\n // reporting it in destructive text and through `aria-describedby`.\n\n // The message is its own line rather than a replacement for the helper text:\n // a field that explains what it wants still has to say why what was typed was\n // rejected, and dropping one for the other left the field marked red with\n // nothing anywhere saying what was wrong.\n const errorMessage = error === false ? undefined : message;\n\n return (\n <>\n {renderTextArea(\n isError,\n helperText,\n onFieldChange,\n onFieldBlur,\n errorMessage,\n formValue,\n )}\n {renderHelperText()}\n {renderErrorMessage(errorMessage)}\n </>\n );\n }}\n </BaseFormComponent>\n );\n};\n\nconst LoadingTextArea: React.FC<{ size?: TextAreaSize; rows?: number }> = ({\n size = 'medium',\n rows = 4,\n}) => {\n return (\n // Decorative height placeholder — kept out of the a11y tree so it is not announced\n // as an unlabelled box (same as Skeleton and LoadingInput).\n <div\n aria-busy=\"true\"\n aria-hidden=\"true\"\n className=\"w-full rounded-xl border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-border)] flex items-center justify-center shadow-[var(--malachite-shadow-default)]\"\n style={{ minHeight: getMinHeight(size, rows) }}\n />\n );\n};\n\nconst CompositeIcon: React.FC<{\n prefixValue?: string;\n prefixSecondaryValue?: string;\n icon?: React.ReactNode;\n}> = ({ prefixValue, prefixSecondaryValue, icon }) => {\n return (\n <div className=\"flex items-start gap-1\">\n {icon && (\n <span className=\"flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0 mt-1\">\n {icon}\n </span>\n )}\n {prefixValue && (\n <span className=\"text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap\">\n {prefixValue}\n </span>\n )}\n {prefixSecondaryValue && (\n <span className=\"text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap\">\n {prefixSecondaryValue}\n </span>\n )}\n </div>\n );\n};\n\nconst Suffix: React.FC<{\n error?: boolean;\n disabled?: boolean;\n defaultValue?: string;\n onCopyClick?: () => void;\n}> = ({ error, disabled, defaultValue, onCopyClick }) => {\n return (\n <div className=\"flex items-start gap-1\">\n {error && (\n // Decorative: the rejection is carried by the message beneath the field.\n <div\n aria-hidden=\"true\"\n className=\"flex items-center justify-center w-5 h-5 flex-shrink-0 mt-1\"\n >\n <InfoIcon\n size={16}\n className=\"text-[var(--malachite-destructive-foreground,rgb(196,62,62))]\"\n />\n </div>\n )}\n {onCopyClick && disabled && defaultValue && (\n <button\n onClick={() => {\n navigator.clipboard.writeText(defaultValue);\n onCopyClick();\n }}\n type=\"button\"\n aria-label=\"Copy to clipboard\"\n className=\"flex items-center justify-center w-5 h-5 hover:bg-[var(--malachite-primary-border)] rounded transition-colors flex-shrink-0 mt-1\"\n >\n <CopyIcon size={16} />\n </button>\n )}\n </div>\n );\n};\n\nconst TextAreaButtons: React.FC<{\n buttons?: ButtonDefinition[];\n}> = ({ buttons }) => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <div className=\"flex flex-col gap-1 mt-1\">\n {buttons.map((button) => (\n <Button\n key={button.label}\n variant={button.danger ? 'destructive' : 'outline'}\n size=\"small\"\n disabled={button.disabled}\n icon={button.icon}\n tooltip={button.tooltip}\n onClick={button.onClick}\n >\n {button.label}\n </Button>\n ))}\n </div>\n );\n};\n\nexport default TextArea;\n"],"names":["getSizeClasses","size","focusBorderClasses","isError","tone","FOCUS_BORDER","rowHeightPx","rows","getMinHeight","TextArea","label","hint","hintIcon","tooltip","placeholder","icon","name","required","requiredIndicator","error","description","loading","readOnly","defaultValue","disabled","prefixValue","prefixSecondaryValue","formControl","buttons","onCopyClick","onChange","onKeyDown","inFieldAction","value","onBlur","helperText","maxRows","maxLength","resize","wrap","id","ariaLabel","ariaLabelledBy","controlId","labelId","descriptionId","hintId","helperTextId","useFormFieldIds","internalValue","setInternalValue","useState","textareaRef","useRef","resizeToFit","useCallback","el","maxHeight","nextHeight","useLayoutEffect","isControlled","paintedValue","formValue","paintedFieldValue","handleChange","reportToForm","e","newValue","hasPrefix","errorMessageId","renderTextArea","resolvedHelperText","onFieldChange","onFieldBlur","errorMessage","textAreaValue","showErrorIcon","hasSuffix","describedBy","wrapperClasses","textAreaClasses","textAreaElement","jsx","jsxs","CompositeIcon","Suffix","TextAreaButtons","renderHelperText","renderErrorMessage","FieldMessage","BaseFormComponent","LoadingTextArea","fieldError","message","Fragment","InfoIcon","CopyIcon","button","Button"],"mappings":";;;;;;;;;AA4EA,MAAMA,KAAiB,CAACC,MAA+B;AACnD,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAcMC,KAAqB,CAACC,GAAkBC,MACtCD,IACO,6HAGPC,MAAS,cACF,qHAGJ,GAAGC,EAAY,0EAKpBC,IAAc,CAACL,GAAoBM,OAClB;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,GACTN,CAAI,IAKcM,IAFJ,IAKdC,IAAe,CAACP,GAA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A,MACG,eAAY;AAAA,MACZ,WAAU;AAAA,MAEV,UAAA,gBAAAA;AAAA,QAACa;AAAA,QAAA;AAAA,UACG,MAAM;AAAA,UACN,WAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAAA,EAGPlE,KAAeL,KAAYD,KACxB,gBAAA2D;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,SAAS,MAAM;AACX,kBAAU,UAAU,UAAU3D,CAAY,GAC1CM,EAAA;AAAA,MACJ;AAAA,MACA,MAAK;AAAA,MACL,cAAW;AAAA,MACX,WAAU;AAAA,MAEV,UAAA,gBAAAqD,EAACc,IAAA,EAAS,MAAM,GAAA,CAAI;AAAA,IAAA;AAAA,EAAA;AACxB,GAER,GAIFV,KAED,CAAC,EAAE,SAAA1D,QACCA,KAAA,QAAAA,EAAS,2BAKT,OAAA,EAAI,WAAU,4BACV,UAAAA,EAAQ,IAAI,CAACqE,MACV,gBAAAf;AAAA,EAACgB;AAAA,EAAA;AAAA,IAEG,SAASD,EAAO,SAAS,gBAAgB;AAAA,IACzC,MAAK;AAAA,IACL,UAAUA,EAAO;AAAA,IACjB,MAAMA,EAAO;AAAA,IACb,SAASA,EAAO;AAAA,IAChB,SAASA,EAAO;AAAA,IAEf,UAAAA,EAAO;AAAA,EAAA;AAAA,EARHA,EAAO;AAAA,CAUnB,GACL,IAlBO;"}
1
+ {"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport type { Control, FieldPath, FieldValues } from 'react-hook-form';\nimport BaseFormComponent, { type RequiredIndicator, useFormFieldIds } from '../BaseFormComponent';\nimport { Button } from '../Button';\nimport CopyIcon from '../CustomIcons/CopyIcon';\nimport InfoIcon from '../CustomIcons/InfoIcon';\nimport FieldMessage from '../FieldMessage';\nimport { paintedFieldValue } from '../devWarning';\nimport { FOCUS_BORDER } from '../focusRing';\nimport type { ButtonDefinition, TextAreaSize } from './types';\n\n/**\n * `assistant` is the chrome for a field sitting in an AI context (e.g. `Chat.Composer`'s\n * policy-assistant tone): the field's own focus border recolours to the assistant violet\n * instead of the default accent — same indicator, different colour, not an extra one. Same\n * naming precedent as `PillButton`'s own `tone`.\n */\ntype TextAreaTone = 'default' | 'assistant';\n\ninterface TextAreaProps {\n label?: string;\n hint?: string;\n /** Decorative icon drawn before `hint`, such as a glyph for the value's type. Shown only with a `hint`. */\n hintIcon?: React.ReactNode;\n tooltip?: string;\n placeholder?: string;\n icon?: React.ReactNode;\n readOnly?: boolean;\n name: FieldPath<FieldValues> | string;\n description?: string;\n size?: TextAreaSize;\n required?: boolean;\n requiredIndicator?: RequiredIndicator;\n error?: boolean;\n loading?: boolean;\n defaultValue?: string;\n disabled?: boolean;\n prefixValue?: string;\n prefixSecondaryValue?: string;\n ellipsis?: boolean;\n formControl?: Control<FieldValues, unknown>;\n buttons?: ButtonDefinition[];\n onCopyClick?: () => void;\n onChange?: (value: string) => void;\n value?: string;\n onBlur?: () => void;\n /** Key handling the control cannot own, e.g. Enter-to-submit in a chat composer. */\n onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n /**\n * A control that belongs inside the field, pinned bottom-right — a chat composer's send.\n * The field reserves room for it, so text cannot run underneath.\n */\n inFieldAction?: React.ReactNode;\n /** See `TextAreaTone`. Defaults to `'default'`, so no existing field changes. */\n tone?: TextAreaTone;\n helperText?: React.ReactNode;\n rows?: number;\n /**\n * Grows the field from `rows` up to this many lines as content is typed, then scrolls\n * internally rather than growing further. Omitted keeps the field at a fixed `rows`\n * height, the pre-existing behaviour.\n */\n maxRows?: number;\n maxLength?: number;\n resize?: 'none' | 'vertical' | 'horizontal' | 'both';\n /**\n * When false, lines are not soft-wrapped — long content scrolls horizontally\n * instead of wrapping (native `wrap=\"off\"`). Useful for one-value-per-line\n * content like URLs. Defaults to true.\n */\n wrap?: boolean;\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nconst getSizeClasses = (size: TextAreaSize): string => {\n switch (size) {\n case 'small':\n return 'text-sm';\n case 'medium':\n return 'text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]';\n case 'large':\n return 'text-base';\n default:\n return 'text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]';\n }\n};\n\n/**\n * A rejection always wins the border colour, regardless of `tone`: a field the caller has\n * flagged invalid stays destructive-red on focus even inside an assistant surface.\n *\n * Every class is a complete literal, here or in `focusRing.ts` for the shared focus border,\n * never a shared colour interpolated into one. Tailwind extracts candidates by scanning source\n * text, so a class built at runtime is one Tailwind never sees — and the CSS is simply absent,\n * with no build error.\n * The assistant pair was surviving only because the same literal appears in a spec's\n * assertion, which the content glob also scans: rewording that assertion would have silently\n * dropped the violet focus border.\n */\nconst focusBorderClasses = (isError: boolean, tone: TextAreaTone): string => {\n if (isError) {\n // The hover and focus borders an invalid field moves to (tailwind.css).\n return 'field-invalid';\n }\n\n if (tone === 'assistant') {\n return 'focus-within:border-[var(--malachite-assistant-foreground)] hover:border-[var(--malachite-assistant-foreground)]';\n }\n\n return `${FOCUS_BORDER} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`;\n};\n\n// Shared by the static min-height and the auto-grow ceiling, so a field's grown height\n// lines up with the same row metrics its resting height already used.\nconst rowHeightPx = (size: TextAreaSize, rows: number): number => {\n const baseHeight = {\n small: 20,\n medium: 22,\n large: 24,\n }[size];\n\n // Every size renders `py-[12px]`, so the vertical padding is 24 regardless of size.\n const padding = 24;\n\n return baseHeight * rows + padding;\n};\n\nconst getMinHeight = (size: TextAreaSize, rows: number): string => `${rowHeightPx(size, rows)}px`;\n\nconst TextArea: React.FC<TextAreaProps> = ({\n label,\n hint,\n hintIcon,\n tooltip,\n placeholder,\n icon,\n name,\n required,\n requiredIndicator,\n error,\n description,\n loading = false,\n readOnly = false,\n size = 'medium',\n defaultValue,\n disabled,\n prefixValue,\n prefixSecondaryValue,\n // ellipsis = false,\n formControl,\n buttons,\n onCopyClick,\n onChange,\n onKeyDown,\n inFieldAction,\n tone = 'default',\n value,\n onBlur,\n helperText,\n rows = 4,\n maxRows,\n maxLength,\n resize = 'vertical',\n wrap = true,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const { controlId, labelId, descriptionId, hintId, helperTextId } = useFormFieldIds({\n id,\n label,\n description,\n hint,\n helperText: true,\n });\n const [internalValue, setInternalValue] = useState(defaultValue || '');\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n\n // Reset-then-measure rather than growing incrementally: `scrollHeight` on a field already\n // taller than its content stays stuck at that height, so the reset is what lets a paste\n // followed by a delete shrink the field back down, not just grow it. Mutates the DOM\n // directly instead of round-tripping through React state, so typing a character never\n // re-renders this component just to change its own height.\n const resizeToFit = useCallback(() => {\n const el = textareaRef.current;\n if (!el || maxRows === undefined) {\n return;\n }\n\n const maxHeight = rowHeightPx(size, maxRows);\n el.style.height = 'auto';\n const nextHeight = Math.min(el.scrollHeight, maxHeight);\n el.style.height = `${nextHeight}px`;\n el.style.overflowY = el.scrollHeight > maxHeight ? 'auto' : 'hidden';\n }, [maxRows, size]);\n\n // Catches every change `onChange` on the element itself would miss: the initial mount,\n // and a value the parent sets from outside (e.g. clearing the composer after send).\n // biome-ignore lint/correctness/useExhaustiveDependencies: `value` is not read in the body, but a controlled `value` changing from outside is exactly the case `onChange` cannot see, so the effect has to re-run on it anyway.\n useLayoutEffect(() => {\n resizeToFit();\n }, [resizeToFit, value]);\n\n const isControlled = value !== undefined;\n const paintedValue = (formValue: unknown): string =>\n paintedFieldValue({\n component: 'TextArea',\n name,\n value,\n formValue,\n defaultValue,\n bound: !!formControl,\n uncontrolledValue: internalValue,\n });\n\n const handleChange =\n (reportToForm?: (value: unknown) => void) =>\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const newValue = e.target.value;\n if (!isControlled) {\n setInternalValue(newValue);\n }\n // The browser has already applied the keystroke to the element by the time this\n // fires, so `scrollHeight` already reflects it — no need to wait for a re-render.\n resizeToFit();\n onChange?.(newValue);\n reportToForm?.(newValue);\n };\n\n const hasPrefix = icon || prefixValue || prefixSecondaryValue;\n\n const errorMessageId = `${helperTextId}-error`;\n\n const renderTextArea = (\n isError: boolean,\n resolvedHelperText?: React.ReactNode,\n onFieldChange?: (value: unknown) => void,\n onFieldBlur?: () => void,\n errorMessage?: string,\n formValue?: unknown,\n ) => {\n const textAreaValue = paintedValue(formValue);\n // The icon is the only signal a consumer-forced `error` has; beside a message it is\n // duplication, and it crowds the suffix next to a reveal or copy control.\n const showErrorIcon = isError && !errorMessage;\n const hasSuffix =\n showErrorIcon || (onCopyClick && disabled && textAreaValue) || buttons?.length;\n const describedBy =\n [\n descriptionId,\n hintId,\n resolvedHelperText ? helperTextId : undefined,\n errorMessage ? errorMessageId : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n const wrapperClasses = [\n 'relative',\n 'flex',\n 'w-full',\n 'rounded-xl',\n 'border border-solid',\n disabled\n ? 'bg-[var(--malachite-card-dimmed-background)]'\n : 'bg-[var(--malachite-card-background)]',\n 'transition-colors duration-200 ease-in-out',\n isError ? 'shadow-error' : 'shadow-default',\n isError\n ? 'border-[var(--malachite-destructive-border)]'\n : 'border-[var(--malachite-card-border)]',\n // One border-hover colour, not two overlapping utilities for the same states: a\n // duplicate pair used to sit above this one, fixed at the default accent — since\n // it targeted the identical `focus-within`/`hover` selectors, a `tone` swap here\n // would otherwise leave a second, conflicting colour in the class list.\n //\n // No separate ring on top of it: the recoloured border IS this field's focus\n // indicator, the same as the default tone's. Adding a ring here drew a second,\n // concentric outline around the first on `assistant` — the field already has one,\n // it only needed to change colour.\n disabled ? '' : focusBorderClasses(isError, tone),\n ]\n .filter(Boolean)\n .join(' ');\n\n const textAreaClasses = [\n 'flex-1',\n 'bg-transparent',\n 'border-none',\n 'outline-none',\n 'text-[var(--malachite-text-primary)]',\n 'placeholder:text-[var(--malachite-text-placeholder)]',\n 'disabled:text-[var(--malachite-text-dimmed)]',\n 'disabled:cursor-not-allowed',\n getSizeClasses(size),\n // Emitted as one side each when an action sits in the field: `px` and `pr` are\n // the same specificity, so which wins would rest on Tailwind's output order.\n inFieldAction ? 'pl-[16px] pr-[52px]' : 'px-[16px]',\n 'py-[12px]',\n resize === 'none'\n ? 'resize-none'\n : resize === 'vertical'\n ? 'resize-y'\n : resize === 'horizontal'\n ? 'resize-x'\n : 'resize',\n wrap ? '' : 'whitespace-pre overflow-x-auto min-w-0',\n ]\n .filter(Boolean)\n .join(' ');\n\n const textAreaElement = (\n <textarea\n ref={textareaRef}\n id={controlId}\n placeholder={placeholder}\n value={textAreaValue}\n onChange={handleChange(onFieldChange)}\n onBlur={() => {\n onBlur?.();\n onFieldBlur?.();\n }}\n onKeyDown={onKeyDown}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-invalid={isError || undefined}\n aria-required={required || undefined}\n aria-describedby={describedBy}\n disabled={disabled || !!prefixValue || !!prefixSecondaryValue || readOnly}\n readOnly={readOnly}\n wrap={wrap ? undefined : 'off'}\n rows={rows}\n maxLength={maxLength}\n style={{ minHeight: getMinHeight(size, rows) }}\n className={textAreaClasses}\n name={name}\n />\n );\n\n return (\n <div className={wrapperClasses}>\n {hasPrefix && (\n <div className=\"flex pt-3 pl-3 pr-1 flex-shrink-0 pointer-events-none\">\n <CompositeIcon\n prefixValue={prefixValue}\n prefixSecondaryValue={prefixSecondaryValue}\n icon={icon}\n />\n </div>\n )}\n\n {textAreaElement}\n\n {inFieldAction && (\n <div className=\"absolute bottom-2 right-2 flex items-center\">\n {inFieldAction}\n </div>\n )}\n\n {hasSuffix && (\n <div className=\"flex pt-3 pl-1 pr-3 flex-shrink-0\">\n <Suffix\n error={showErrorIcon}\n disabled={disabled}\n defaultValue={textAreaValue}\n onCopyClick={onCopyClick}\n />\n <TextAreaButtons buttons={buttons} />\n </div>\n )}\n </div>\n );\n };\n\n const renderHelperText = () =>\n helperText ? (\n <div\n id={helperTextId}\n className=\"mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))]\"\n >\n {helperText}\n </div>\n ) : null;\n\n const renderErrorMessage = (errorMessage?: string) => (\n <FieldMessage id={errorMessageId} message={errorMessage} spaced />\n );\n\n return (\n <BaseFormComponent\n label={label}\n hint={hint}\n hintIcon={hintIcon}\n tooltip={tooltip}\n name={name}\n required={required}\n requiredIndicator={requiredIndicator}\n loading={loading}\n formControl={formControl}\n description={description}\n controlId={controlId}\n labelId={labelId}\n descriptionId={descriptionId}\n hintId={hintId}\n loadingComponent={<LoadingTextArea size={size} rows={rows} />}\n >\n {({ error: fieldError, message, onFieldChange, onFieldBlur, value: formValue }) => {\n const isError = error ?? fieldError;\n // `error={false}` opts out of the resolver entirely, message included: a\n // screen that has dealt with the rejection its own way would otherwise keep\n // reporting it in destructive text and through `aria-describedby`.\n\n // The message is its own line rather than a replacement for the helper text:\n // a field that explains what it wants still has to say why what was typed was\n // rejected, and dropping one for the other left the field marked red with\n // nothing anywhere saying what was wrong.\n const errorMessage = error === false ? undefined : message;\n\n return (\n <>\n {renderTextArea(\n isError,\n helperText,\n onFieldChange,\n onFieldBlur,\n errorMessage,\n formValue,\n )}\n {renderHelperText()}\n {renderErrorMessage(errorMessage)}\n </>\n );\n }}\n </BaseFormComponent>\n );\n};\n\nconst LoadingTextArea: React.FC<{ size?: TextAreaSize; rows?: number }> = ({\n size = 'medium',\n rows = 4,\n}) => {\n return (\n // Decorative height placeholder — kept out of the a11y tree so it is not announced\n // as an unlabelled box (same as Skeleton and LoadingInput).\n <div\n aria-busy=\"true\"\n aria-hidden=\"true\"\n className=\"w-full rounded-xl border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-border)] flex items-center justify-center shadow-[var(--malachite-shadow-default)]\"\n style={{ minHeight: getMinHeight(size, rows) }}\n />\n );\n};\n\nconst CompositeIcon: React.FC<{\n prefixValue?: string;\n prefixSecondaryValue?: string;\n icon?: React.ReactNode;\n}> = ({ prefixValue, prefixSecondaryValue, icon }) => {\n return (\n <div className=\"flex items-start gap-1\">\n {icon && (\n <span className=\"flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0 mt-1\">\n {icon}\n </span>\n )}\n {prefixValue && (\n <span className=\"text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap\">\n {prefixValue}\n </span>\n )}\n {prefixSecondaryValue && (\n <span className=\"text-[length:var(--malachite-font-size-15,15px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap\">\n {prefixSecondaryValue}\n </span>\n )}\n </div>\n );\n};\n\nconst Suffix: React.FC<{\n error?: boolean;\n disabled?: boolean;\n defaultValue?: string;\n onCopyClick?: () => void;\n}> = ({ error, disabled, defaultValue, onCopyClick }) => {\n return (\n <div className=\"flex items-start gap-1\">\n {error && (\n // Decorative: the rejection is carried by the message beneath the field.\n <div\n aria-hidden=\"true\"\n className=\"flex items-center justify-center w-5 h-5 flex-shrink-0 mt-1\"\n >\n <InfoIcon\n size={16}\n className=\"text-[var(--malachite-destructive-foreground,rgb(196,62,62))]\"\n />\n </div>\n )}\n {onCopyClick && disabled && defaultValue && (\n <button\n onClick={() => {\n navigator.clipboard.writeText(defaultValue);\n onCopyClick();\n }}\n type=\"button\"\n aria-label=\"Copy to clipboard\"\n className=\"flex items-center justify-center w-5 h-5 hover:bg-[var(--malachite-primary-border)] rounded transition-colors flex-shrink-0 mt-1\"\n >\n <CopyIcon size={16} />\n </button>\n )}\n </div>\n );\n};\n\nconst TextAreaButtons: React.FC<{\n buttons?: ButtonDefinition[];\n}> = ({ buttons }) => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <div className=\"flex flex-col gap-1 mt-1\">\n {buttons.map((button) => (\n <Button\n key={button.label}\n variant={button.danger ? 'destructive' : 'outline'}\n size=\"small\"\n disabled={button.disabled}\n icon={button.icon}\n tooltip={button.tooltip}\n onClick={button.onClick}\n >\n {button.label}\n </Button>\n ))}\n </div>\n );\n};\n\nexport default TextArea;\n"],"names":["getSizeClasses","size","focusBorderClasses","isError","tone","FOCUS_BORDER","rowHeightPx","rows","getMinHeight","TextArea","label","hint","hintIcon","tooltip","placeholder","icon","name","required","requiredIndicator","error","description","loading","readOnly","defaultValue","disabled","prefixValue","prefixSecondaryValue","formControl","buttons","onCopyClick","onChange","onKeyDown","inFieldAction","value","onBlur","helperText","maxRows","maxLength","resize","wrap","id","ariaLabel","ariaLabelledBy","controlId","labelId","descriptionId","hintId","helperTextId","useFormFieldIds","internalValue","setInternalValue","useState","textareaRef","useRef","resizeToFit","useCallback","el","maxHeight","nextHeight","useLayoutEffect","isControlled","paintedValue","formValue","paintedFieldValue","handleChange","reportToForm","e","newValue","hasPrefix","errorMessageId","renderTextArea","resolvedHelperText","onFieldChange","onFieldBlur","errorMessage","textAreaValue","showErrorIcon","hasSuffix","describedBy","wrapperClasses","textAreaClasses","textAreaElement","jsx","jsxs","CompositeIcon","Suffix","TextAreaButtons","renderHelperText","renderErrorMessage","FieldMessage","BaseFormComponent","LoadingTextArea","fieldError","message","Fragment","InfoIcon","CopyIcon","button","Button"],"mappings":";;;;;;;;;AA4EA,MAAMA,KAAiB,CAACC,MAA+B;AACnD,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAcMC,KAAqB,CAACC,GAAkBC,MACtCD,IAEO,kBAGPC,MAAS,cACF,qHAGJ,GAAGC,EAAY,0EAKpBC,IAAc,CAACL,GAAoBM,OAClB;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,GACTN,CAAI,IAKcM,IAFJ,IAKdC,IAAe,CAACP,GAAoBM,MAAyB,GAAGD,EAAYL,GAAMM,CAAI,CAAC,MAEvFE,KAAoC,CAAC;AAA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AAA,QAAA;AAAA,UACG,MAAM;AAAA,UACN,WAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAAA,EAGPlE,KAAeL,KAAYD,KACxB,gBAAA2D;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,SAAS,MAAM;AACX,kBAAU,UAAU,UAAU3D,CAAY,GAC1CM,EAAA;AAAA,MACJ;AAAA,MACA,MAAK;AAAA,MACL,cAAW;AAAA,MACX,WAAU;AAAA,MAEV,UAAA,gBAAAqD,EAACc,IAAA,EAAS,MAAM,GAAA,CAAI;AAAA,IAAA;AAAA,EAAA;AACxB,GAER,GAIFV,KAED,CAAC,EAAE,SAAA1D,QACCA,KAAA,QAAAA,EAAS,2BAKT,OAAA,EAAI,WAAU,4BACV,UAAAA,EAAQ,IAAI,CAACqE,MACV,gBAAAf;AAAA,EAACgB;AAAA,EAAA;AAAA,IAEG,SAASD,EAAO,SAAS,gBAAgB;AAAA,IACzC,MAAK;AAAA,IACL,UAAUA,EAAO;AAAA,IACjB,MAAMA,EAAO;AAAA,IACb,SAASA,EAAO;AAAA,IAChB,SAASA,EAAO;AAAA,IAEf,UAAAA,EAAO;AAAA,EAAA;AAAA,EARHA,EAAO;AAAA,CAUnB,GACL,IAlBO;"}
@@ -67,6 +67,8 @@ const s = (a) => {
67
67
  return `${e} ${t.assistant} btn-assistant shadow-default`;
68
68
  case "destructive":
69
69
  return `${e} ${t.destructive} btn-destructive`;
70
+ case "destructive-filled":
71
+ return `${e} ${t.destructive} btn-destructive-filled shadow-default`;
70
72
  case "success":
71
73
  return `${e} ${t.success} btn-glass-success`;
72
74
  case "warning":
@@ -1 +1 @@
1
- {"version":3,"file":"buttonStyles.js","sources":["../../src/components/buttonStyles.ts"],"sourcesContent":["import type { ButtonRadius, ButtonSize, ButtonVariant } from './Button';\n\n// Geometry from the Figma component library, which is variant-independent.\n// `min-h` not `h`: Tailwind emits `h-*` after `min-h-*`, so a hard height would beat a\n// consumer's own `h-*`. Paired with `whitespace-nowrap` (as Figma has it) so a long label\n// cannot wrap into a line the height would clip.\nexport const getSizeClasses = (size: ButtonSize) => {\n switch (size) {\n // Figma has no text X-Small button, only the icon-only square — nothing to align to.\n case 'xsmall':\n return '[--btn-px:calc(var(--spacing)*2)] px-[var(--btn-px)] py-1 text-xs';\n case 'small':\n return 'min-h-[var(--malachite-control-height-small,28px)] [--btn-px:10px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-small,13px)] leading-[16px] whitespace-nowrap';\n case 'medium':\n return 'min-h-[var(--malachite-control-height-medium,32px)] [--btn-px:10px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-small,13px)] leading-[16px] whitespace-nowrap';\n case 'large':\n return 'min-h-[var(--malachite-control-height-large,42px)] [--btn-px:12px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-15,15px)] leading-[18px] whitespace-nowrap';\n default:\n return 'min-h-[var(--malachite-control-height-large,42px)] [--btn-px:12px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-15,15px)] leading-[18px] whitespace-nowrap';\n }\n};\n\n// `rounded-*` reads the malachite radius tokens via `@theme`, so these follow the theme.\n// An explicit `radius` prop still wins, via getRadiusClass.\nexport const getDefaultRadiusClass = (size: ButtonSize, iconOnly: boolean): string => {\n switch (size) {\n // Only the square rounds at 8px — text buttons at this size keep their 6px corner.\n case 'xsmall':\n return iconOnly ? 'rounded-lg' : 'rounded-md';\n case 'small':\n return 'rounded-[var(--malachite-radius-10,10px)]';\n case 'medium':\n return 'rounded-xl';\n case 'large':\n return 'rounded-[var(--malachite-radius-xxl,14px)]';\n default:\n return 'rounded-[var(--malachite-radius-xxl,14px)]';\n }\n};\n\n// Figma pairs a 6px icon gap with the 13px tiers and 8px with the 15px tier.\nexport const getIconGapClass = (size: ButtonSize, position: 'start' | 'end'): string => {\n const start = position === 'start';\n switch (size) {\n case 'small':\n case 'medium':\n return start ? 'mr-[6px]' : 'ml-[6px]';\n default:\n return start ? 'mr-2' : 'ml-2';\n }\n};\n\nexport const getRadiusClass = (radius: ButtonRadius): string => {\n switch (radius) {\n case 'md':\n return 'rounded-md';\n case 'lg':\n return 'rounded-lg';\n case 'xl':\n return 'rounded-xl';\n default:\n return 'rounded-xl';\n }\n};\n\n// Focus ring: a `focus-visible` outline (keyboard only), coloured to match the variant.\n// Uses `outline` rather than Tailwind's `ring-*` because ring composes `--tw-ring-*`\n// custom properties via box-shadow that rely on document-level @property registration\n// and silently don't paint inside a shadow root (same class of issue as transform\n// utilities). The classes are full literals so Tailwind's JIT can generate them.\nconst FOCUS_OUTLINE = {\n neutral: 'focus-visible:[outline:2px_solid_var(--malachite-text-primary)]',\n destructive: 'focus-visible:[outline:2px_solid_var(--malachite-text-destructive)]',\n success: 'focus-visible:[outline:2px_solid_var(--malachite-text-success)]',\n warning: 'focus-visible:[outline:2px_solid_var(--malachite-text-warning)]',\n error: 'focus-visible:[outline:2px_solid_var(--malachite-text-error)]',\n assistant: 'focus-visible:[outline:2px_solid_var(--malachite-assistant-foreground)]',\n accent: 'focus-visible:[outline:2px_solid_var(--malachite-accent-foreground)]',\n};\n\nexport const getVariantClasses = (variant: ButtonVariant, radiusClass: string): string => {\n const baseClasses = `font-medium transition-[color,background-color,border-color,opacity,box-shadow] duration-200 ease-in-out outline-none focus-visible:outline-offset-2 border border-solid ${radiusClass} cursor-pointer`;\n\n switch (variant) {\n case 'filled':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-filled shadow-default`;\n\n case 'outline':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-outline shadow-default`;\n\n case 'surface':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-surface shadow-default`;\n\n case 'assistant':\n return `${baseClasses} ${FOCUS_OUTLINE.assistant} btn-assistant shadow-default`;\n\n case 'destructive':\n return `${baseClasses} ${FOCUS_OUTLINE.destructive} btn-destructive`;\n\n case 'success':\n return `${baseClasses} ${FOCUS_OUTLINE.success} btn-glass-success`;\n\n case 'warning':\n return `${baseClasses} ${FOCUS_OUTLINE.warning} btn-glass-warning`;\n\n case 'error':\n return `${baseClasses} ${FOCUS_OUTLINE.error} btn-glass-error`;\n\n case 'ghost':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-ghost`;\n\n case 'row-outline':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-row-outline`;\n\n case 'quiet':\n return `${baseClasses} ${FOCUS_OUTLINE.accent} btn-quiet`;\n\n case 'muted':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-muted`;\n\n case 'subtle':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-subtle`;\n\n case 'no-style':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-no-style border-none`;\n\n default:\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-filled shadow-default`;\n }\n};\n"],"names":["getSizeClasses","size","getDefaultRadiusClass","iconOnly","getIconGapClass","position","start","getRadiusClass","radius","FOCUS_OUTLINE","getVariantClasses","variant","radiusClass","baseClasses"],"mappings":"AAMO,MAAMA,IAAiB,CAACC,MAAqB;AAChD,UAAQA,GAAA;AAAA;AAAA,IAEJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAIaC,IAAwB,CAACD,GAAkBE,MAA8B;AAClF,UAAQF,GAAA;AAAA;AAAA,IAEJ,KAAK;AACD,aAAOE,IAAW,eAAe;AAAA,IACrC,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EAAA;AAEnB,GAGaC,IAAkB,CAACH,GAAkBI,MAAsC;AACpF,QAAMC,IAAQD,MAAa;AAC3B,UAAQJ,GAAA;AAAA,IACJ,KAAK;AAAA,IACL,KAAK;AACD,aAAOK,IAAQ,aAAa;AAAA,IAChC;AACI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AAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD;AACI,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,EAAA;AAE1D;"}
1
+ {"version":3,"file":"buttonStyles.js","sources":["../../src/components/buttonStyles.ts"],"sourcesContent":["import type { ButtonRadius, ButtonSize, ButtonVariant } from './Button';\n\n// Geometry from the Figma component library, which is variant-independent.\n// `min-h` not `h`: Tailwind emits `h-*` after `min-h-*`, so a hard height would beat a\n// consumer's own `h-*`. Paired with `whitespace-nowrap` (as Figma has it) so a long label\n// cannot wrap into a line the height would clip.\nexport const getSizeClasses = (size: ButtonSize) => {\n switch (size) {\n // Figma has no text X-Small button, only the icon-only square — nothing to align to.\n case 'xsmall':\n return '[--btn-px:calc(var(--spacing)*2)] px-[var(--btn-px)] py-1 text-xs';\n case 'small':\n return 'min-h-[var(--malachite-control-height-small,28px)] [--btn-px:10px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-small,13px)] leading-[16px] whitespace-nowrap';\n case 'medium':\n return 'min-h-[var(--malachite-control-height-medium,32px)] [--btn-px:10px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-small,13px)] leading-[16px] whitespace-nowrap';\n case 'large':\n return 'min-h-[var(--malachite-control-height-large,42px)] [--btn-px:12px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-15,15px)] leading-[18px] whitespace-nowrap';\n default:\n return 'min-h-[var(--malachite-control-height-large,42px)] [--btn-px:12px] px-[var(--btn-px)] text-[length:var(--malachite-font-size-15,15px)] leading-[18px] whitespace-nowrap';\n }\n};\n\n// `rounded-*` reads the malachite radius tokens via `@theme`, so these follow the theme.\n// An explicit `radius` prop still wins, via getRadiusClass.\nexport const getDefaultRadiusClass = (size: ButtonSize, iconOnly: boolean): string => {\n switch (size) {\n // Only the square rounds at 8px — text buttons at this size keep their 6px corner.\n case 'xsmall':\n return iconOnly ? 'rounded-lg' : 'rounded-md';\n case 'small':\n return 'rounded-[var(--malachite-radius-10,10px)]';\n case 'medium':\n return 'rounded-xl';\n case 'large':\n return 'rounded-[var(--malachite-radius-xxl,14px)]';\n default:\n return 'rounded-[var(--malachite-radius-xxl,14px)]';\n }\n};\n\n// Figma pairs a 6px icon gap with the 13px tiers and 8px with the 15px tier.\nexport const getIconGapClass = (size: ButtonSize, position: 'start' | 'end'): string => {\n const start = position === 'start';\n switch (size) {\n case 'small':\n case 'medium':\n return start ? 'mr-[6px]' : 'ml-[6px]';\n default:\n return start ? 'mr-2' : 'ml-2';\n }\n};\n\nexport const getRadiusClass = (radius: ButtonRadius): string => {\n switch (radius) {\n case 'md':\n return 'rounded-md';\n case 'lg':\n return 'rounded-lg';\n case 'xl':\n return 'rounded-xl';\n default:\n return 'rounded-xl';\n }\n};\n\n// Focus ring: a `focus-visible` outline (keyboard only), coloured to match the variant.\n// Uses `outline` rather than Tailwind's `ring-*` because ring composes `--tw-ring-*`\n// custom properties via box-shadow that rely on document-level @property registration\n// and silently don't paint inside a shadow root (same class of issue as transform\n// utilities). The classes are full literals so Tailwind's JIT can generate them.\nconst FOCUS_OUTLINE = {\n neutral: 'focus-visible:[outline:2px_solid_var(--malachite-text-primary)]',\n destructive: 'focus-visible:[outline:2px_solid_var(--malachite-text-destructive)]',\n success: 'focus-visible:[outline:2px_solid_var(--malachite-text-success)]',\n warning: 'focus-visible:[outline:2px_solid_var(--malachite-text-warning)]',\n error: 'focus-visible:[outline:2px_solid_var(--malachite-text-error)]',\n assistant: 'focus-visible:[outline:2px_solid_var(--malachite-assistant-foreground)]',\n accent: 'focus-visible:[outline:2px_solid_var(--malachite-accent-foreground)]',\n};\n\nexport const getVariantClasses = (variant: ButtonVariant, radiusClass: string): string => {\n const baseClasses = `font-medium transition-[color,background-color,border-color,opacity,box-shadow] duration-200 ease-in-out outline-none focus-visible:outline-offset-2 border border-solid ${radiusClass} cursor-pointer`;\n\n switch (variant) {\n case 'filled':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-filled shadow-default`;\n\n case 'outline':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-outline shadow-default`;\n\n case 'surface':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-surface shadow-default`;\n\n case 'assistant':\n return `${baseClasses} ${FOCUS_OUTLINE.assistant} btn-assistant shadow-default`;\n\n case 'destructive':\n return `${baseClasses} ${FOCUS_OUTLINE.destructive} btn-destructive`;\n\n case 'destructive-filled':\n return `${baseClasses} ${FOCUS_OUTLINE.destructive} btn-destructive-filled shadow-default`;\n\n case 'success':\n return `${baseClasses} ${FOCUS_OUTLINE.success} btn-glass-success`;\n\n case 'warning':\n return `${baseClasses} ${FOCUS_OUTLINE.warning} btn-glass-warning`;\n\n case 'error':\n return `${baseClasses} ${FOCUS_OUTLINE.error} btn-glass-error`;\n\n case 'ghost':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-ghost`;\n\n case 'row-outline':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-row-outline`;\n\n case 'quiet':\n return `${baseClasses} ${FOCUS_OUTLINE.accent} btn-quiet`;\n\n case 'muted':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-muted`;\n\n case 'subtle':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-subtle`;\n\n case 'no-style':\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-no-style border-none`;\n\n default:\n return `${baseClasses} ${FOCUS_OUTLINE.neutral} btn-filled shadow-default`;\n }\n};\n"],"names":["getSizeClasses","size","getDefaultRadiusClass","iconOnly","getIconGapClass","position","start","getRadiusClass","radius","FOCUS_OUTLINE","getVariantClasses","variant","radiusClass","baseClasses"],"mappings":"AAMO,MAAMA,IAAiB,CAACC,MAAqB;AAChD,UAAQA,GAAA;AAAA;AAAA,IAEJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA,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AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,WAAW;AAAA,IAEtD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,KAAK;AAAA,IAEhD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,MAAM;AAAA,IAEjD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD,KAAK;AACD,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,IAElD;AACI,aAAO,GAAGI,CAAW,IAAIJ,EAAc,OAAO;AAAA,EAAA;AAE1D;"}
@@ -1,21 +1,26 @@
1
- const s = {
1
+ const l = {
2
2
  color: "var(--malachite-codeblock-foreground)",
3
3
  fontSize: "14px",
4
4
  lineHeight: "20px",
5
5
  fontFamily: "var(--malachite-font-mono, monospace)",
6
6
  textAlign: "left",
7
7
  background: "transparent"
8
- }, h = (n) => n ? { width: "100%" } : { width: "max-content", minWidth: "100%" }, a = /^ *(?:- +)*(?:"[^"]*"|'[^']*'|[^\s:'"][^\s:]*): +(?=\S)/, r = /^ *(?:- +)*/, i = 32, d = (n) => {
8
+ }, s = {
9
+ keyword: "var(--malachite-codeblock-keyword, rgb(12, 88, 174))",
10
+ string: "var(--malachite-codeblock-string, rgb(2, 122, 66))",
11
+ number: "var(--malachite-codeblock-number, rgb(150, 88, 10))"
12
+ }, d = (n) => n ? { width: "100%" } : { width: "max-content", minWidth: "100%" }, r = /^ *(?:- +)*(?:"[^"]*"|'[^']*'|[^\s:'"][^\s:]*): +(?=\S)/, a = /^ *(?:- +)*/, i = 32, g = (n) => {
9
13
  var o;
10
- const c = ((o = a.exec(n) ?? r.exec(n)) == null ? void 0 : o[0].length) ?? 0, t = Math.min(c, i);
14
+ const c = ((o = r.exec(n) ?? a.exec(n)) == null ? void 0 : o[0].length) ?? 0, t = Math.min(c, i);
11
15
  if (t === 0)
12
16
  return {};
13
17
  const e = `${t}ch`;
14
18
  return { paddingLeft: e, textIndent: `-${e}` };
15
19
  };
16
20
  export {
17
- s as CODE_FONT,
18
- d as hangingIndentStyle,
19
- h as rowsWrapperStyle
21
+ l as CODE_FONT,
22
+ s as CODE_TOKEN_COLOR,
23
+ g as hangingIndentStyle,
24
+ d as rowsWrapperStyle
20
25
  };
21
26
  //# sourceMappingURL=codeBlockStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeBlockStyles.js","sources":["../../src/components/codeBlockStyles.ts"],"sourcesContent":["import type React from 'react';\n\nexport const CODE_FONT: React.CSSProperties = {\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n lineHeight: '20px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n textAlign: 'left',\n background: 'transparent',\n};\n\n/**\n * The element around a block's rows. Unwrapped, it is as wide as the widest line, floored at\n * the view, so rows filling it end level when one scrolls out. Wrapped, it is the view's width:\n * at `max-content` a line has nothing narrower to wrap against and scrolls anyway.\n */\nexport const rowsWrapperStyle = (wrap: boolean): React.CSSProperties =>\n wrap ? { width: '100%' } : { width: 'max-content', minWidth: '100%' };\n\n/** Anchored, so prose containing a colon falls through to {@link INDENT_COLUMN} instead. */\nconst VALUE_COLUMN = /^ *(?:- +)*(?:\"[^\"]*\"|'[^']*'|[^\\s:'\"][^\\s:]*): +(?=\\S)/;\n\nconst INDENT_COLUMN = /^ *(?:- +)*/;\n\n/**\n * Backstop, not a fit-to-width rule: `padding-left` counts toward the flex item's\n * `min-width: auto`, so a pathological key could otherwise widen the row past its panel. Set\n * well past any realistic key (the deepest in connector step YAML is ~18ch) because a clamped\n * row stops aligning under its value, which is the whole point of the hang.\n */\nconst MAX_HANG_CH = 32;\n\n/**\n * Hangs a wrapped row under the start of its line's value, so it can't read as a new key.\n * Measured in `ch` — the block is monospace, so one `ch` is one space (tabs are not counted).\n */\nexport const hangingIndentStyle = (line: string): React.CSSProperties => {\n const column = (VALUE_COLUMN.exec(line) ?? INDENT_COLUMN.exec(line))?.[0].length ?? 0;\n const hang = Math.min(column, MAX_HANG_CH);\n if (hang === 0) {\n return {};\n }\n const hangingIndent = `${hang}ch`;\n return { paddingLeft: hangingIndent, textIndent: `-${hangingIndent}` };\n};\n"],"names":["CODE_FONT","rowsWrapperStyle","wrap","VALUE_COLUMN","INDENT_COLUMN","MAX_HANG_CH","hangingIndentStyle","line","_a","column","hang","hangingIndent"],"mappings":"AAEO,MAAMA,IAAiC;AAAA,EAC1C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAChB,GAOaC,IAAmB,CAACC,MAC7BA,IAAO,EAAE,OAAO,OAAA,IAAW,EAAE,OAAO,eAAe,UAAU,OAAA,GAG3DC,IAAe,2DAEfC,IAAgB,eAQhBC,IAAc,IAMPC,IAAqB,CAACC,MAAsC;AAlClE,MAAAC;AAmCH,QAAMC,MAAUD,IAAAL,EAAa,KAAKI,CAAI,KAAKH,EAAc,KAAKG,CAAI,MAAlD,gBAAAC,EAAuD,GAAG,WAAU,GAC9EE,IAAO,KAAK,IAAID,GAAQJ,CAAW;AACzC,MAAIK,MAAS;AACT,WAAO,CAAA;AAEX,QAAMC,IAAgB,GAAGD,CAAI;AAC7B,SAAO,EAAE,aAAaC,GAAe,YAAY,IAAIA,CAAa,GAAA;AACtE;"}
1
+ {"version":3,"file":"codeBlockStyles.js","sources":["../../src/components/codeBlockStyles.ts"],"sourcesContent":["import type React from 'react';\n\nexport const CODE_FONT: React.CSSProperties = {\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n lineHeight: '20px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n textAlign: 'left',\n background: 'transparent',\n};\n\n/** The shared keyword, string and number colours for code surfaces. */\nexport const CODE_TOKEN_COLOR = {\n keyword: 'var(--malachite-codeblock-keyword, rgb(12, 88, 174))',\n string: 'var(--malachite-codeblock-string, rgb(2, 122, 66))',\n number: 'var(--malachite-codeblock-number, rgb(150, 88, 10))',\n} as const;\n\n/**\n * The element around a block's rows. Unwrapped, it is as wide as the widest line, floored at\n * the view, so rows filling it end level when one scrolls out. Wrapped, it is the view's width:\n * at `max-content` a line has nothing narrower to wrap against and scrolls anyway.\n */\nexport const rowsWrapperStyle = (wrap: boolean): React.CSSProperties =>\n wrap ? { width: '100%' } : { width: 'max-content', minWidth: '100%' };\n\n/** Anchored, so prose containing a colon falls through to {@link INDENT_COLUMN} instead. */\nconst VALUE_COLUMN = /^ *(?:- +)*(?:\"[^\"]*\"|'[^']*'|[^\\s:'\"][^\\s:]*): +(?=\\S)/;\n\nconst INDENT_COLUMN = /^ *(?:- +)*/;\n\n/**\n * Backstop, not a fit-to-width rule: `padding-left` counts toward the flex item's\n * `min-width: auto`, so a pathological key could otherwise widen the row past its panel. Set\n * well past any realistic key (the deepest in connector step YAML is ~18ch) because a clamped\n * row stops aligning under its value, which is the whole point of the hang.\n */\nconst MAX_HANG_CH = 32;\n\n/**\n * Hangs a wrapped row under the start of its line's value, so it can't read as a new key.\n * Measured in `ch` — the block is monospace, so one `ch` is one space (tabs are not counted).\n */\nexport const hangingIndentStyle = (line: string): React.CSSProperties => {\n const column = (VALUE_COLUMN.exec(line) ?? INDENT_COLUMN.exec(line))?.[0].length ?? 0;\n const hang = Math.min(column, MAX_HANG_CH);\n if (hang === 0) {\n return {};\n }\n const hangingIndent = `${hang}ch`;\n return { paddingLeft: hangingIndent, textIndent: `-${hangingIndent}` };\n};\n"],"names":["CODE_FONT","CODE_TOKEN_COLOR","rowsWrapperStyle","wrap","VALUE_COLUMN","INDENT_COLUMN","MAX_HANG_CH","hangingIndentStyle","line","_a","column","hang","hangingIndent"],"mappings":"AAEO,MAAMA,IAAiC;AAAA,EAC1C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAChB,GAGaC,IAAmB;AAAA,EAC5B,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACZ,GAOaC,IAAmB,CAACC,MAC7BA,IAAO,EAAE,OAAO,OAAA,IAAW,EAAE,OAAO,eAAe,UAAU,OAAA,GAG3DC,IAAe,2DAEfC,IAAgB,eAQhBC,IAAc,IAMPC,IAAqB,CAACC,MAAsC;AAzClE,MAAAC;AA0CH,QAAMC,MAAUD,IAAAL,EAAa,KAAKI,CAAI,KAAKH,EAAc,KAAKG,CAAI,MAAlD,gBAAAC,EAAuD,GAAG,WAAU,GAC9EE,IAAO,KAAK,IAAID,GAAQJ,CAAW;AACzC,MAAIK,MAAS;AACT,WAAO,CAAA;AAEX,QAAMC,IAAgB,GAAGD,CAAI;AAC7B,SAAO,EAAE,aAAaC,GAAe,YAAY,IAAIA,CAAa,GAAA;AACtE;"}
@@ -0,0 +1,25 @@
1
+ import { CODE_TOKEN_COLOR as s } from "./codeBlockStyles.js";
2
+ const c = 1e4, k = new RegExp('("(?:[^"\\\\]|\\\\.)*(?:"|\\\\?$))(\\s*:)?|(?<![\\w.\\-])(-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)(?![\\w.])|\\b(true|false|null)\\b', "g"), f = {
3
+ key: s.keyword,
4
+ string: s.string,
5
+ number: s.number,
6
+ literal: s.keyword
7
+ }, p = (e) => {
8
+ if (e.length > c)
9
+ return [{ text: e, kind: "plain" }];
10
+ const t = [];
11
+ let n = 0;
12
+ for (const i of e.matchAll(k)) {
13
+ const o = i.index ?? 0;
14
+ o > n && t.push({ text: e.slice(n, o), kind: "plain" });
15
+ const [, l, r, d, u] = i;
16
+ l !== void 0 ? (t.push({ text: l, kind: r ? "key" : "string" }), r && t.push({ text: r, kind: "plain" })) : d !== void 0 ? t.push({ text: d, kind: "number" }) : u !== void 0 && t.push({ text: u, kind: "literal" }), n = o + i[0].length;
17
+ }
18
+ return n < e.length && t.push({ text: e.slice(n), kind: "plain" }), t;
19
+ };
20
+ export {
21
+ f as JSON_TOKEN_COLORS,
22
+ c as MAX_TOKENIZED_LINE_LENGTH,
23
+ p as jsonTokensOf
24
+ };
25
+ //# sourceMappingURL=codePreviewJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codePreviewJson.js","sources":["../../src/components/codePreviewJson.ts"],"sourcesContent":["import { CODE_TOKEN_COLOR } from './codeBlockStyles';\n\nexport type JsonTokenKind = 'key' | 'string' | 'number' | 'literal' | 'plain';\n\nexport interface JsonToken {\n text: string;\n kind: JsonTokenKind;\n}\n\n/** Past this a line stays plain: minified payloads arrive as one line, and every token is a span. */\nexport const MAX_TOKENIZED_LINE_LENGTH = 10_000;\n\n// An unterminated string runs to the end of the line, so a truncated payload is one string\n// token rather than a retry from every later quote.\nconst TOKEN =\n /(\"(?:[^\"\\\\]|\\\\.)*(?:\"|\\\\?$))(\\s*:)?|(?<![\\w.\\-])(-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)(?![\\w.])|\\b(true|false|null)\\b/g;\n\nexport const JSON_TOKEN_COLORS: Record<Exclude<JsonTokenKind, 'plain'>, string> = {\n key: CODE_TOKEN_COLOR.keyword,\n string: CODE_TOKEN_COLOR.string,\n number: CODE_TOKEN_COLOR.number,\n literal: CODE_TOKEN_COLOR.keyword,\n};\n\n/** One line of pretty-printed JSON, split into coloured runs. Anything unrecognised stays plain. */\nexport const jsonTokensOf = (line: string): JsonToken[] => {\n if (line.length > MAX_TOKENIZED_LINE_LENGTH) {\n return [{ text: line, kind: 'plain' }];\n }\n const tokens: JsonToken[] = [];\n let last = 0;\n for (const match of line.matchAll(TOKEN)) {\n const start = match.index ?? 0;\n if (start > last) {\n tokens.push({ text: line.slice(last, start), kind: 'plain' });\n }\n const [, quoted, colon, number, literal] = match;\n if (quoted !== undefined) {\n tokens.push({ text: quoted, kind: colon ? 'key' : 'string' });\n if (colon) {\n tokens.push({ text: colon, kind: 'plain' });\n }\n } else if (number !== undefined) {\n tokens.push({ text: number, kind: 'number' });\n } else if (literal !== undefined) {\n tokens.push({ text: literal, kind: 'literal' });\n }\n last = start + match[0].length;\n }\n if (last < line.length) {\n tokens.push({ text: line.slice(last), kind: 'plain' });\n }\n return tokens;\n};\n"],"names":["MAX_TOKENIZED_LINE_LENGTH","TOKEN","JSON_TOKEN_COLORS","CODE_TOKEN_COLOR","jsonTokensOf","line","tokens","last","match","start","quoted","colon","number","literal"],"mappings":";AAUO,MAAMA,IAA4B,KAInCC,IACF,WAAA,qIAAA,GAAA,GAESC,IAAqE;AAAA,EAC9E,KAAKC,EAAiB;AAAA,EACtB,QAAQA,EAAiB;AAAA,EACzB,QAAQA,EAAiB;AAAA,EACzB,SAASA,EAAiB;AAC9B,GAGaC,IAAe,CAACC,MAA8B;AACvD,MAAIA,EAAK,SAASL;AACd,WAAO,CAAC,EAAE,MAAMK,GAAM,MAAM,SAAS;AAEzC,QAAMC,IAAsB,CAAA;AAC5B,MAAIC,IAAO;AACX,aAAWC,KAASH,EAAK,SAASJ,CAAK,GAAG;AACtC,UAAMQ,IAAQD,EAAM,SAAS;AAC7B,IAAIC,IAAQF,KACRD,EAAO,KAAK,EAAE,MAAMD,EAAK,MAAME,GAAME,CAAK,GAAG,MAAM,SAAS;AAEhE,UAAM,CAAA,EAAGC,GAAQC,GAAOC,GAAQC,CAAO,IAAIL;AAC3C,IAAIE,MAAW,UACXJ,EAAO,KAAK,EAAE,MAAMI,GAAQ,MAAMC,IAAQ,QAAQ,UAAU,GACxDA,KACAL,EAAO,KAAK,EAAE,MAAMK,GAAO,MAAM,SAAS,KAEvCC,MAAW,SAClBN,EAAO,KAAK,EAAE,MAAMM,GAAQ,MAAM,UAAU,IACrCC,MAAY,UACnBP,EAAO,KAAK,EAAE,MAAMO,GAAS,MAAM,WAAW,GAElDN,IAAOE,IAAQD,EAAM,CAAC,EAAE;AAAA,EAC5B;AACA,SAAID,IAAOF,EAAK,UACZC,EAAO,KAAK,EAAE,MAAMD,EAAK,MAAME,CAAI,GAAG,MAAM,SAAS,GAElDD;AACX;"}