@stackone/malachite 2.84.1 → 2.85.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 +2 -2
- package/dist/components/BaseFormComponent.js +63 -59
- package/dist/components/BaseFormComponent.js.map +1 -1
- package/dist/components/DatePickerField.js +131 -129
- package/dist/components/DatePickerField.js.map +1 -1
- package/dist/components/Dropdown.js +444 -434
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/Input/Input.js +126 -124
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/MultiSelect.js +85 -83
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/Sidebar.js +152 -122
- package/dist/components/Sidebar.js.map +1 -1
- package/dist/components/TextArea/TextArea.js +73 -71
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/overlayBehaviour.js +159 -143
- package/dist/components/overlayBehaviour.js.map +1 -1
- package/dist/components/sidebarContext.js +7 -6
- package/dist/components/sidebarContext.js.map +1 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +320 -319
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as a, jsxs as h, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { FieldMessage as
|
|
8
|
-
import { paintedFieldValue as
|
|
9
|
-
const
|
|
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";
|
|
3
|
+
import ye, { useFormFieldIds as Ne } from "../BaseFormComponent.js";
|
|
4
|
+
import { Button as Ie } from "../Button.js";
|
|
5
|
+
import He from "../CustomIcons/CopyIcon.js";
|
|
6
|
+
import je from "../CustomIcons/InfoIcon.js";
|
|
7
|
+
import { FieldMessage as ke } from "../FieldMessage.js";
|
|
8
|
+
import { paintedFieldValue as ze } from "../devWarning.js";
|
|
9
|
+
const Ce = (t) => {
|
|
10
10
|
switch (t) {
|
|
11
11
|
case "small":
|
|
12
12
|
return "text-sm";
|
|
@@ -17,22 +17,23 @@ const ze = (t) => {
|
|
|
17
17
|
default:
|
|
18
18
|
return "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]";
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, Ae = (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)]" : "focus-within:border-[var(--malachite-control-border-hover)] hover:border-[var(--malachite-control-border-hover)]", Q = (t, e) => ({
|
|
21
21
|
small: 20,
|
|
22
22
|
medium: 22,
|
|
23
23
|
large: 24
|
|
24
|
-
})[t] * e + 24, R = (t, e) => `${Q(t, e)}px`,
|
|
24
|
+
})[t] * e + 24, R = (t, e) => `${Q(t, e)}px`, Je = ({
|
|
25
25
|
label: t,
|
|
26
26
|
hint: e,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
hintIcon: l,
|
|
28
|
+
tooltip: o,
|
|
29
|
+
placeholder: U,
|
|
29
30
|
icon: A,
|
|
30
31
|
name: f,
|
|
31
32
|
required: M,
|
|
32
|
-
requiredIndicator:
|
|
33
|
+
requiredIndicator: V,
|
|
33
34
|
error: T,
|
|
34
35
|
description: $,
|
|
35
|
-
loading:
|
|
36
|
+
loading: W = !1,
|
|
36
37
|
readOnly: L = !1,
|
|
37
38
|
size: d = "medium",
|
|
38
39
|
defaultValue: P,
|
|
@@ -44,28 +45,28 @@ const ze = (t) => {
|
|
|
44
45
|
buttons: x,
|
|
45
46
|
onCopyClick: E,
|
|
46
47
|
onChange: g,
|
|
47
|
-
onKeyDown:
|
|
48
|
+
onKeyDown: X,
|
|
48
49
|
inFieldAction: b,
|
|
49
|
-
tone:
|
|
50
|
+
tone: Z = "default",
|
|
50
51
|
value: w,
|
|
51
52
|
onBlur: y,
|
|
52
53
|
helperText: N,
|
|
53
54
|
rows: I = 4,
|
|
54
55
|
maxRows: H,
|
|
55
|
-
maxLength:
|
|
56
|
+
maxLength: _,
|
|
56
57
|
resize: j = "vertical",
|
|
57
58
|
wrap: S = !0,
|
|
58
|
-
id:
|
|
59
|
-
"aria-label":
|
|
60
|
-
"aria-labelledby":
|
|
59
|
+
id: O,
|
|
60
|
+
"aria-label": F,
|
|
61
|
+
"aria-labelledby": ee
|
|
61
62
|
}) => {
|
|
62
|
-
const { controlId: Y, labelId:
|
|
63
|
-
id:
|
|
63
|
+
const { controlId: Y, labelId: te, descriptionId: q, hintId: D, helperTextId: k } = Ne({
|
|
64
|
+
id: O,
|
|
64
65
|
label: t,
|
|
65
66
|
description: $,
|
|
66
67
|
hint: e,
|
|
67
68
|
helperText: !0
|
|
68
|
-
}), [
|
|
69
|
+
}), [re, ae] = pe(P || ""), G = ge(null), z = be(() => {
|
|
69
70
|
const r = G.current;
|
|
70
71
|
if (!r || H === void 0)
|
|
71
72
|
return;
|
|
@@ -74,27 +75,27 @@ const ze = (t) => {
|
|
|
74
75
|
const i = Math.min(r.scrollHeight, s);
|
|
75
76
|
r.style.height = `${i}px`, r.style.overflowY = r.scrollHeight > s ? "auto" : "hidden";
|
|
76
77
|
}, [H, d]);
|
|
77
|
-
|
|
78
|
+
we(() => {
|
|
78
79
|
z();
|
|
79
80
|
}, [z, w]);
|
|
80
|
-
const
|
|
81
|
+
const ie = w !== void 0, le = (r) => ze({
|
|
81
82
|
component: "TextArea",
|
|
82
83
|
name: f,
|
|
83
84
|
value: w,
|
|
84
85
|
formValue: r,
|
|
85
86
|
defaultValue: P,
|
|
86
87
|
bound: !!B,
|
|
87
|
-
uncontrolledValue:
|
|
88
|
-
}),
|
|
88
|
+
uncontrolledValue: re
|
|
89
|
+
}), se = (r) => (s) => {
|
|
89
90
|
const i = s.target.value;
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
const n =
|
|
91
|
+
ie || ae(i), z(), g == null || g(i), r == null || r(i);
|
|
92
|
+
}, ne = A || u || p, J = `${k}-error`, oe = (r, s, i, m, v, C) => {
|
|
93
|
+
const n = le(C), K = r && !v, me = K || E && c && n || (x == null ? void 0 : x.length), he = [
|
|
93
94
|
q,
|
|
94
95
|
D,
|
|
95
96
|
s ? k : void 0,
|
|
96
97
|
v ? J : void 0
|
|
97
|
-
].filter(Boolean).join(" ") || void 0,
|
|
98
|
+
].filter(Boolean).join(" ") || void 0, xe = [
|
|
98
99
|
"relative",
|
|
99
100
|
"flex",
|
|
100
101
|
"w-full",
|
|
@@ -113,8 +114,8 @@ const ze = (t) => {
|
|
|
113
114
|
// indicator, the same as the default tone's. Adding a ring here drew a second,
|
|
114
115
|
// concentric outline around the first on `assistant` — the field already has one,
|
|
115
116
|
// it only needed to change colour.
|
|
116
|
-
c ? "" :
|
|
117
|
-
].filter(Boolean).join(" "),
|
|
117
|
+
c ? "" : Ae(r, Z)
|
|
118
|
+
].filter(Boolean).join(" "), ve = [
|
|
118
119
|
"flex-1",
|
|
119
120
|
"bg-transparent",
|
|
120
121
|
"border-none",
|
|
@@ -123,54 +124,54 @@ const ze = (t) => {
|
|
|
123
124
|
"placeholder:text-[var(--malachite-text-placeholder)]",
|
|
124
125
|
"disabled:text-[var(--malachite-text-dimmed)]",
|
|
125
126
|
"disabled:cursor-not-allowed",
|
|
126
|
-
|
|
127
|
+
Ce(d),
|
|
127
128
|
// Emitted as one side each when an action sits in the field: `px` and `pr` are
|
|
128
129
|
// the same specificity, so which wins would rest on Tailwind's output order.
|
|
129
130
|
b ? "pl-[16px] pr-[52px]" : "px-[16px]",
|
|
130
131
|
"py-[12px]",
|
|
131
132
|
j === "none" ? "resize-none" : j === "vertical" ? "resize-y" : j === "horizontal" ? "resize-x" : "resize",
|
|
132
133
|
S ? "" : "whitespace-pre overflow-x-auto min-w-0"
|
|
133
|
-
].filter(Boolean).join(" "),
|
|
134
|
+
].filter(Boolean).join(" "), fe = /* @__PURE__ */ a(
|
|
134
135
|
"textarea",
|
|
135
136
|
{
|
|
136
137
|
ref: G,
|
|
137
138
|
id: Y,
|
|
138
|
-
placeholder:
|
|
139
|
+
placeholder: U,
|
|
139
140
|
value: n,
|
|
140
|
-
onChange:
|
|
141
|
+
onChange: se(i),
|
|
141
142
|
onBlur: () => {
|
|
142
143
|
y == null || y(), m == null || m();
|
|
143
144
|
},
|
|
144
|
-
onKeyDown:
|
|
145
|
-
"aria-label":
|
|
146
|
-
"aria-labelledby":
|
|
145
|
+
onKeyDown: X,
|
|
146
|
+
"aria-label": F,
|
|
147
|
+
"aria-labelledby": ee,
|
|
147
148
|
"aria-invalid": r || void 0,
|
|
148
149
|
"aria-required": M || void 0,
|
|
149
|
-
"aria-describedby":
|
|
150
|
+
"aria-describedby": he,
|
|
150
151
|
disabled: c || !!u || !!p || L,
|
|
151
152
|
readOnly: L,
|
|
152
153
|
wrap: S ? void 0 : "off",
|
|
153
154
|
rows: I,
|
|
154
|
-
maxLength:
|
|
155
|
+
maxLength: _,
|
|
155
156
|
style: { minHeight: R(d, I) },
|
|
156
|
-
className:
|
|
157
|
+
className: ve,
|
|
157
158
|
name: f
|
|
158
159
|
}
|
|
159
160
|
);
|
|
160
|
-
return /* @__PURE__ */ h("div", { className:
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
return /* @__PURE__ */ h("div", { className: xe, children: [
|
|
162
|
+
ne && /* @__PURE__ */ a("div", { className: "flex pt-3 pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ a(
|
|
163
|
+
Te,
|
|
163
164
|
{
|
|
164
165
|
prefixValue: u,
|
|
165
166
|
prefixSecondaryValue: p,
|
|
166
167
|
icon: A
|
|
167
168
|
}
|
|
168
169
|
) }),
|
|
169
|
-
|
|
170
|
+
fe,
|
|
170
171
|
b && /* @__PURE__ */ a("div", { className: "absolute bottom-2 right-2 flex items-center", children: b }),
|
|
171
|
-
|
|
172
|
+
me && /* @__PURE__ */ h("div", { className: "flex pt-3 pl-1 pr-3 flex-shrink-0", children: [
|
|
172
173
|
/* @__PURE__ */ a(
|
|
173
|
-
|
|
174
|
+
$e,
|
|
174
175
|
{
|
|
175
176
|
error: K,
|
|
176
177
|
disabled: c,
|
|
@@ -178,38 +179,39 @@ const ze = (t) => {
|
|
|
178
179
|
onCopyClick: E
|
|
179
180
|
}
|
|
180
181
|
),
|
|
181
|
-
/* @__PURE__ */ a(
|
|
182
|
+
/* @__PURE__ */ a(Le, { buttons: x })
|
|
182
183
|
] })
|
|
183
184
|
] });
|
|
184
|
-
},
|
|
185
|
+
}, de = () => N ? /* @__PURE__ */ a(
|
|
185
186
|
"div",
|
|
186
187
|
{
|
|
187
188
|
id: k,
|
|
188
189
|
className: "mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))]",
|
|
189
190
|
children: N
|
|
190
191
|
}
|
|
191
|
-
) : null,
|
|
192
|
+
) : null, ce = (r) => /* @__PURE__ */ a(ke, { id: J, message: r, spaced: !0 });
|
|
192
193
|
return /* @__PURE__ */ a(
|
|
193
|
-
|
|
194
|
+
ye,
|
|
194
195
|
{
|
|
195
196
|
label: t,
|
|
196
197
|
hint: e,
|
|
197
|
-
|
|
198
|
+
hintIcon: l,
|
|
199
|
+
tooltip: o,
|
|
198
200
|
name: f,
|
|
199
201
|
required: M,
|
|
200
|
-
requiredIndicator:
|
|
201
|
-
loading:
|
|
202
|
+
requiredIndicator: V,
|
|
203
|
+
loading: W,
|
|
202
204
|
formControl: B,
|
|
203
205
|
description: $,
|
|
204
206
|
controlId: Y,
|
|
205
|
-
labelId:
|
|
207
|
+
labelId: te,
|
|
206
208
|
descriptionId: q,
|
|
207
209
|
hintId: D,
|
|
208
|
-
loadingComponent: /* @__PURE__ */ a(
|
|
210
|
+
loadingComponent: /* @__PURE__ */ a(Me, { size: d, rows: I }),
|
|
209
211
|
children: ({ error: r, message: s, onFieldChange: i, onFieldBlur: m, value: v }) => {
|
|
210
212
|
const C = T ?? r, n = T === !1 ? void 0 : s;
|
|
211
|
-
return /* @__PURE__ */ h(
|
|
212
|
-
|
|
213
|
+
return /* @__PURE__ */ h(ue, { children: [
|
|
214
|
+
oe(
|
|
213
215
|
C,
|
|
214
216
|
N,
|
|
215
217
|
i,
|
|
@@ -217,13 +219,13 @@ const ze = (t) => {
|
|
|
217
219
|
n,
|
|
218
220
|
v
|
|
219
221
|
),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
de(),
|
|
223
|
+
ce(n)
|
|
222
224
|
] });
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
);
|
|
226
|
-
},
|
|
228
|
+
}, Me = ({
|
|
227
229
|
size: t = "medium",
|
|
228
230
|
rows: e = 4
|
|
229
231
|
}) => (
|
|
@@ -238,11 +240,11 @@ const ze = (t) => {
|
|
|
238
240
|
style: { minHeight: R(t, e) }
|
|
239
241
|
}
|
|
240
242
|
)
|
|
241
|
-
),
|
|
243
|
+
), Te = ({ prefixValue: t, prefixSecondaryValue: e, icon: l }) => /* @__PURE__ */ h("div", { className: "flex items-start gap-1", children: [
|
|
242
244
|
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 }),
|
|
243
245
|
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 }),
|
|
244
246
|
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
|
-
] }),
|
|
247
|
+
] }), $e = ({ error: t, disabled: e, defaultValue: l, onCopyClick: o }) => /* @__PURE__ */ h("div", { className: "flex items-start gap-1", children: [
|
|
246
248
|
t && // Decorative: the rejection is carried by the message beneath the field.
|
|
247
249
|
/* @__PURE__ */ a(
|
|
248
250
|
"div",
|
|
@@ -250,7 +252,7 @@ const ze = (t) => {
|
|
|
250
252
|
"aria-hidden": "true",
|
|
251
253
|
className: "flex items-center justify-center w-5 h-5 flex-shrink-0 mt-1",
|
|
252
254
|
children: /* @__PURE__ */ a(
|
|
253
|
-
|
|
255
|
+
je,
|
|
254
256
|
{
|
|
255
257
|
size: 16,
|
|
256
258
|
className: "text-[var(--malachite-destructive-foreground,rgb(196,62,62))]"
|
|
@@ -267,11 +269,11 @@ const ze = (t) => {
|
|
|
267
269
|
type: "button",
|
|
268
270
|
"aria-label": "Copy to clipboard",
|
|
269
271
|
className: "flex items-center justify-center w-5 h-5 hover:bg-[var(--malachite-primary-border)] rounded transition-colors flex-shrink-0 mt-1",
|
|
270
|
-
children: /* @__PURE__ */ a(
|
|
272
|
+
children: /* @__PURE__ */ a(He, { size: 16 })
|
|
271
273
|
}
|
|
272
274
|
)
|
|
273
|
-
] }),
|
|
274
|
-
|
|
275
|
+
] }), Le = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ a("div", { className: "flex flex-col gap-1 mt-1", children: t.map((e) => /* @__PURE__ */ a(
|
|
276
|
+
Ie,
|
|
275
277
|
{
|
|
276
278
|
variant: e.danger ? "destructive" : "outline",
|
|
277
279
|
size: "small",
|
|
@@ -284,6 +286,6 @@ const ze = (t) => {
|
|
|
284
286
|
e.label
|
|
285
287
|
)) }) : null;
|
|
286
288
|
export {
|
|
287
|
-
|
|
289
|
+
Je as default
|
|
288
290
|
};
|
|
289
291
|
//# sourceMappingURL=TextArea.js.map
|
|
@@ -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 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 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 * Each branch spells its two classes out in full rather than interpolating a shared colour\n * variable into them. Tailwind extracts candidates by scanning source text, so a class built\n * at runtime is one Tailwind never sees — and the CSS is simply absent, 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-within:border-[var(--malachite-control-border-hover)] hover: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 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 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","rowHeightPx","rows","getMinHeight","TextArea","label","hint","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":";;;;;;;;AAyEA,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,GAaMC,KAAqB,CAACC,GAAkBC,MACtCD,IACO,6HAGPC,MAAS,cACF,qHAGJ,oHAKLC,IAAc,CAACJ,GAAoBK,OAClB;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,GACTL,CAAI,IAKcK,IAFJ,IAKdC,IAAe,CAACN,GAAoBK,MAAyB,GAAGD,EAAYJ,GAAMK,CAAI,CAAC,MAEvFE,KAAoC,CAAC;AAAA,EACvC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AAU;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 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 * Each branch spells its two classes out in full rather than interpolating a shared colour\n * variable into them. Tailwind extracts candidates by scanning source text, so a class built\n * at runtime is one Tailwind never sees — and the CSS is simply absent, 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-within:border-[var(--malachite-control-border-hover)] hover: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","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":";;;;;;;;AA2EA,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,GAaMC,KAAqB,CAACC,GAAkBC,MACtCD,IACO,6HAGPC,MAAS,cACF,qHAGJ,oHAKLC,IAAc,CAACJ,GAAoBK,OAClB;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,GACTL,CAAI,IAKcK,IAFJ,IAKdC,IAAe,CAACN,GAAoBK,MAAyB,GAAGD,EAAYJ,GAAMK,CAAI,CAAC,MAEvFE,KAAoC,CAAC;AAAA,EACvC,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,mB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