@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.
- package/COMPONENTS.md +8 -8
- package/dist/assets/icons/hexagon_fill.svg.js +6 -0
- package/dist/assets/icons/hexagon_fill.svg.js.map +1 -0
- package/dist/assets/icons/shield_star_fill.svg.js +6 -0
- package/dist/assets/icons/shield_star_fill.svg.js.map +1 -0
- package/dist/components/Button.js.map +1 -1
- package/dist/components/CodeBlock.js +130 -130
- package/dist/components/CodeBlock.js.map +1 -1
- package/dist/components/CodeBlockHighlighter.js +65 -65
- package/dist/components/CodeBlockHighlighter.js.map +1 -1
- package/dist/components/CodePreview.js +74 -63
- package/dist/components/CodePreview.js.map +1 -1
- package/dist/components/FormActions.js +13 -9
- package/dist/components/FormActions.js.map +1 -1
- package/dist/components/Hexagon.js +33 -26
- package/dist/components/Hexagon.js.map +1 -1
- package/dist/components/HexagonScale.js +20 -19
- package/dist/components/HexagonScale.js.map +1 -1
- package/dist/components/Input/Input.js +55 -54
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/KeyValueList.js +36 -32
- package/dist/components/KeyValueList.js.map +1 -1
- package/dist/components/QueryInput.js +91 -90
- package/dist/components/QueryInput.js.map +1 -1
- package/dist/components/Surface.js +1 -1
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +691 -637
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TextArea/TextArea.js +46 -46
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/buttonStyles.js +2 -0
- package/dist/components/buttonStyles.js.map +1 -1
- package/dist/components/codeBlockStyles.js +11 -6
- package/dist/components/codeBlockStyles.js.map +1 -1
- package/dist/components/codePreviewJson.js +25 -0
- package/dist/components/codePreviewJson.js.map +1 -0
- package/dist/index.d.ts +42 -7
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +11 -3
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormActions.js","sources":["../../src/components/FormActions.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from './Button';\n\nexport interface FormAction {\n label: string;\n onClick?: () => void;\n disabled?: boolean;\n loading?: boolean;\n tooltip?: string;\n}\n\nexport interface FormPrimaryAction extends FormAction {\n
|
|
1
|
+
{"version":3,"file":"FormActions.js","sources":["../../src/components/FormActions.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, type ButtonVariant } from './Button';\n\nexport type FormPrimaryTone = 'default' | 'destructive' | 'destructive-filled';\n\nconst PRIMARY_VARIANT: Record<FormPrimaryTone, ButtonVariant> = {\n default: 'filled',\n destructive: 'destructive',\n 'destructive-filled': 'destructive-filled',\n};\n\nexport interface FormAction {\n label: string;\n onClick?: () => void;\n disabled?: boolean;\n loading?: boolean;\n tooltip?: string;\n}\n\nexport interface FormPrimaryAction extends FormAction {\n /**\n * `destructive` for an action that deletes or revokes; `destructive-filled` for the one action\n * in a confirmation that can't be taken back, on the solid red ground.\n */\n tone?: FormPrimaryTone;\n /**\n * `submit` makes it the form's submit button, so Enter in a field presses it. Leave `onClick`\n * off then and handle the form's `onSubmit` (a `SidePanel`'s, say), or a click runs both.\n */\n type?: 'button' | 'submit';\n}\n\nexport interface FormActionsProps {\n /** The filled action, last in the row. */\n primary?: FormPrimaryAction;\n /** The outline action before it, usually Cancel. */\n secondary?: FormAction;\n size?: 'small' | 'medium';\n note?: React.ReactNode;\n className?: string;\n}\n\n/** A form's Cancel and primary pair, end-aligned: a side panel's footer, or under a settings section. */\nconst FormActions: React.FC<FormActionsProps> = ({\n primary,\n secondary,\n size = 'medium',\n note,\n className = '',\n}) => {\n const buttons = (\n <>\n {secondary ? (\n <Button\n variant=\"outline\"\n size={size}\n type=\"button\"\n disabled={secondary.disabled}\n loading={secondary.loading}\n tooltip={secondary.tooltip}\n onClick={secondary.onClick}\n >\n {secondary.label}\n </Button>\n ) : null}\n {primary ? (\n <Button\n variant={PRIMARY_VARIANT[primary.tone ?? 'default']}\n size={size}\n type={primary.type ?? 'button'}\n disabled={primary.disabled}\n loading={primary.loading}\n tooltip={primary.tooltip}\n onClick={primary.onClick}\n >\n {primary.label}\n </Button>\n ) : null}\n </>\n );\n if (note === undefined || note === null || note === false || note === '') {\n return (\n <div className={`flex items-center justify-end gap-[8px] ${className}`}>{buttons}</div>\n );\n }\n return (\n <div className={`flex flex-wrap items-center gap-x-[16px] gap-y-[8px] ${className}`}>\n <div className=\"min-w-0 flex-[1_1_240px] text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] text-[var(--malachite-text-secondary)]\">\n {note}\n </div>\n <div className=\"ml-auto flex items-center justify-end gap-[8px]\">{buttons}</div>\n </div>\n );\n};\n\nexport default FormActions;\nexport { FormActions };\n"],"names":["PRIMARY_VARIANT","FormActions","primary","secondary","size","note","className","buttons","jsxs","Fragment","jsx","Button"],"mappings":";;AAKA,MAAMA,IAA0D;AAAA,EAC5D,SAAS;AAAA,EACT,aAAa;AAAA,EACb,sBAAsB;AAC1B,GAkCMC,IAA0C,CAAC;AAAA,EAC7C,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IACF,gBAAAC,EAAAC,GAAA,EACK,UAAA;AAAA,IAAAN,IACG,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,SAAQ;AAAA,QACR,MAAAP;AAAA,QACA,MAAK;AAAA,QACL,UAAUD,EAAU;AAAA,QACpB,SAASA,EAAU;AAAA,QACnB,SAASA,EAAU;AAAA,QACnB,SAASA,EAAU;AAAA,QAElB,UAAAA,EAAU;AAAA,MAAA;AAAA,IAAA,IAEf;AAAA,IACHD,IACG,gBAAAQ;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,SAASX,EAAgBE,EAAQ,QAAQ,SAAS;AAAA,QAClD,MAAAE;AAAA,QACA,MAAMF,EAAQ,QAAQ;AAAA,QACtB,UAAUA,EAAQ;AAAA,QAClB,SAASA,EAAQ;AAAA,QACjB,SAASA,EAAQ;AAAA,QACjB,SAASA,EAAQ;AAAA,QAEhB,UAAAA,EAAQ;AAAA,MAAA;AAAA,IAAA,IAEb;AAAA,EAAA,GACR;AAEJ,SAA0BG,KAAS,QAAQA,MAAS,MAASA,MAAS,uBAE7D,OAAA,EAAI,WAAW,2CAA2CC,CAAS,IAAK,UAAAC,GAAQ,IAIrF,gBAAAC,EAAC,OAAA,EAAI,WAAW,wDAAwDF,CAAS,IAC7E,UAAA;AAAA,IAAA,gBAAAI,EAAC,OAAA,EAAI,WAAU,qIACV,UAAAL,GACL;AAAA,IACA,gBAAAK,EAAC,OAAA,EAAI,WAAU,mDAAmD,UAAAH,EAAA,CAAQ;AAAA,EAAA,GAC9E;AAER;"}
|
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import c from "../assets/icons/hexagon_fill.svg.js";
|
|
3
|
+
import m from "../assets/icons/shield_star_fill.svg.js";
|
|
4
|
+
const e = { small: 16, medium: 18 }, s = 0.2, g = {
|
|
5
|
+
hexagon: c,
|
|
6
|
+
shield: m
|
|
7
|
+
}, d = {
|
|
3
8
|
neutral: "var(--malachite-text-dimmed, rgb(161, 161, 161))",
|
|
4
9
|
success: "var(--malachite-text-success, rgb(2, 122, 66))",
|
|
5
10
|
caution: "var(--malachite-warning-fill-muted, rgb(227, 196, 143))",
|
|
6
11
|
warning: "var(--malachite-warning-fill, rgb(201, 138, 46))",
|
|
7
12
|
error: "var(--malachite-error-background, rgb(197, 63, 63))"
|
|
8
|
-
},
|
|
13
|
+
}, x = ({
|
|
9
14
|
tone: a = "neutral",
|
|
10
15
|
size: r = "medium",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
shape: t = "hexagon",
|
|
17
|
+
dimmed: i = !1,
|
|
18
|
+
className: l
|
|
19
|
+
}) => {
|
|
20
|
+
const o = g[t];
|
|
21
|
+
return /* @__PURE__ */ n(
|
|
22
|
+
o,
|
|
23
|
+
{
|
|
24
|
+
width: e[r],
|
|
25
|
+
height: e[r],
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
"data-tone": a,
|
|
28
|
+
"data-shape": t,
|
|
29
|
+
className: l,
|
|
30
|
+
style: {
|
|
31
|
+
display: "block",
|
|
32
|
+
flexShrink: 0,
|
|
33
|
+
color: d[a],
|
|
34
|
+
opacity: i ? s : 1
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
32
39
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
x as Hexagon,
|
|
41
|
+
x as default
|
|
35
42
|
};
|
|
36
43
|
//# sourceMappingURL=Hexagon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hexagon.js","sources":["../../src/components/Hexagon.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type HexagonTone = 'neutral' | 'success' | 'caution' | 'warning' | 'error';\nexport type HexagonSize = 'small' | 'medium';\n\nexport interface HexagonProps {\n tone?: HexagonTone;\n /** `small` is 16px, `medium` 18px. */\n size?: HexagonSize;\n /** Draws it at 20% strength, for a step of a scale that isn't the current one. */\n dimmed?: boolean;\n className?: string;\n}\n\nconst SIZES: Record<HexagonSize, number> = { small: 16, medium: 18 };\nconst DIMMED_OPACITY = 0.2;\n\n// `error` fills from `error-background`, as TimeBarChart's TONE_FILL does; `text-error` is\n// the brighter text red.\nconst TONE_FILL: Record<HexagonTone, string> = {\n neutral: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n success: 'var(--malachite-text-success, rgb(2, 122, 66))',\n caution: 'var(--malachite-warning-fill-muted, rgb(227, 196, 143))',\n warning: 'var(--malachite-warning-fill, rgb(201, 138, 46))',\n error: 'var(--malachite-error-background, rgb(197, 63, 63))',\n};\n\n// Inline, not Tailwind: menus portal outside the shadow root's stylesheet. The fill rides on\n// `color` because the shadow root's `svg path` rule forces paths to `currentColor`.\nexport const Hexagon: React.FC<HexagonProps> = ({\n tone = 'neutral',\n size = 'medium',\n dimmed = false,\n className,\n}) => (\n
|
|
1
|
+
{"version":3,"file":"Hexagon.js","sources":["../../src/components/Hexagon.tsx"],"sourcesContent":["import type React from 'react';\nimport HexagonSvg from '../assets/icons/hexagon_fill.svg?react';\nimport ShieldStarSvg from '../assets/icons/shield_star_fill.svg?react';\n\nexport type HexagonTone = 'neutral' | 'success' | 'caution' | 'warning' | 'error';\nexport type HexagonSize = 'small' | 'medium';\nexport type HexagonShape = 'hexagon' | 'shield';\n\nexport interface HexagonProps {\n tone?: HexagonTone;\n /** `small` is 16px, `medium` 18px. */\n size?: HexagonSize;\n /** `hexagon` for an outcome; `shield`, a shield with a star cut out, for a protection or risk level. Same tones and sizes. */\n shape?: HexagonShape;\n /** Draws it at 20% strength, for a step of a scale that isn't the current one. */\n dimmed?: boolean;\n className?: string;\n}\n\nconst SIZES: Record<HexagonSize, number> = { small: 16, medium: 18 };\nconst DIMMED_OPACITY = 0.2;\n\nconst SHAPES: Record<HexagonShape, React.FC<React.SVGProps<SVGSVGElement>>> = {\n hexagon: HexagonSvg,\n shield: ShieldStarSvg,\n};\n\n// `error` fills from `error-background`, as TimeBarChart's TONE_FILL does; `text-error` is\n// the brighter text red.\nconst TONE_FILL: Record<HexagonTone, string> = {\n neutral: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n success: 'var(--malachite-text-success, rgb(2, 122, 66))',\n caution: 'var(--malachite-warning-fill-muted, rgb(227, 196, 143))',\n warning: 'var(--malachite-warning-fill, rgb(201, 138, 46))',\n error: 'var(--malachite-error-background, rgb(197, 63, 63))',\n};\n\n// Inline, not Tailwind: menus portal outside the shadow root's stylesheet. The fill rides on\n// `color` because the shadow root's `svg path` rule forces paths to `currentColor`.\nexport const Hexagon: React.FC<HexagonProps> = ({\n tone = 'neutral',\n size = 'medium',\n shape = 'hexagon',\n dimmed = false,\n className,\n}) => {\n const Shape = SHAPES[shape];\n return (\n <Shape\n width={SIZES[size]}\n height={SIZES[size]}\n aria-hidden=\"true\"\n data-tone={tone}\n data-shape={shape}\n className={className}\n style={{\n display: 'block',\n flexShrink: 0,\n color: TONE_FILL[tone],\n opacity: dimmed ? DIMMED_OPACITY : 1,\n }}\n />\n );\n};\n\nexport default Hexagon;\n"],"names":["SIZES","DIMMED_OPACITY","SHAPES","HexagonSvg","ShieldStarSvg","TONE_FILL","Hexagon","tone","size","shape","dimmed","className","Shape","jsx"],"mappings":";;;AAmBA,MAAMA,IAAqC,EAAE,OAAO,IAAI,QAAQ,GAAA,GAC1DC,IAAiB,KAEjBC,IAAwE;AAAA,EAC1E,SAASC;AAAAA,EACT,QAAQC;AACZ,GAIMC,IAAyC;AAAA,EAC3C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAIaC,IAAkC,CAAC;AAAA,EAC5C,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,WAAAC;AACJ,MAAM;AACF,QAAMC,IAAQV,EAAOO,CAAK;AAC1B,SACI,gBAAAI;AAAA,IAACD;AAAA,IAAA;AAAA,MACG,OAAOZ,EAAMQ,CAAI;AAAA,MACjB,QAAQR,EAAMQ,CAAI;AAAA,MAClB,eAAY;AAAA,MACZ,aAAWD;AAAA,MACX,cAAYE;AAAA,MACZ,WAAAE;AAAA,MACA,OAAO;AAAA,QACH,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,OAAON,EAAUE,CAAI;AAAA,QACrB,SAASG,IAAST,IAAiB;AAAA,MAAA;AAAA,IACvC;AAAA,EAAA;AAGZ;"}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Hexagon as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
return
|
|
8
|
-
},
|
|
9
|
-
steps:
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Hexagon as f } from "./Hexagon.js";
|
|
3
|
+
import p from "./Tooltip.js";
|
|
4
|
+
const u = (i, t) => {
|
|
5
|
+
const o = i == null ? void 0 : i.trim(), r = t == null ? void 0 : t.trim();
|
|
6
|
+
if (o)
|
|
7
|
+
return r ? `${o} · ${r}` : o;
|
|
8
|
+
}, k = ({
|
|
9
|
+
steps: i,
|
|
10
|
+
shape: t,
|
|
10
11
|
current: o,
|
|
11
12
|
label: r,
|
|
12
|
-
stepLabels:
|
|
13
|
-
currentNote:
|
|
14
|
-
className:
|
|
15
|
-
}) => /* @__PURE__ */
|
|
13
|
+
stepLabels: n,
|
|
14
|
+
currentNote: d,
|
|
15
|
+
className: l
|
|
16
|
+
}) => /* @__PURE__ */ s(
|
|
16
17
|
"span",
|
|
17
18
|
{
|
|
18
19
|
role: r ? "img" : void 0,
|
|
19
20
|
"aria-label": r,
|
|
20
21
|
"aria-hidden": r ? void 0 : !0,
|
|
21
|
-
className:
|
|
22
|
+
className: l,
|
|
22
23
|
style: { display: "inline-flex", flexShrink: 0, alignItems: "center", gap: 2 },
|
|
23
|
-
children:
|
|
24
|
-
const
|
|
25
|
-
return c ? /* @__PURE__ */
|
|
24
|
+
children: i.map((g, e) => {
|
|
25
|
+
const a = e === o, m = /* @__PURE__ */ s(f, { tone: g, shape: t, size: "small", dimmed: !a }, e), c = u(n == null ? void 0 : n[e], a ? d : void 0);
|
|
26
|
+
return c ? /* @__PURE__ */ s(p, { text: c, triggerAs: "span", inline: !0, describesTrigger: !1, children: m }, e) : m;
|
|
26
27
|
})
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
k as HexagonScale,
|
|
32
|
+
k as default
|
|
32
33
|
};
|
|
33
34
|
//# sourceMappingURL=HexagonScale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HexagonScale.js","sources":["../../src/components/HexagonScale.tsx"],"sourcesContent":["import type React from 'react';\nimport Hexagon, { type HexagonTone } from './Hexagon';\nimport Tooltip from './Tooltip';\n\nexport interface HexagonScaleProps {\n /** One
|
|
1
|
+
{"version":3,"file":"HexagonScale.js","sources":["../../src/components/HexagonScale.tsx"],"sourcesContent":["import type React from 'react';\nimport Hexagon, { type HexagonShape, type HexagonTone } from './Hexagon';\nimport Tooltip from './Tooltip';\n\nexport interface HexagonScaleProps {\n /** One mark per step, in order. */\n steps: readonly HexagonTone[];\n /** Every step's outline; default `hexagon`. */\n shape?: HexagonShape;\n /** Index of the step drawn at full strength; the rest are dimmed. Omit to dim them all. */\n current?: number;\n /** Only when it stands alone; beside text naming the step it is decorative. */\n label?: string;\n stepLabels?: readonly string[];\n currentNote?: string;\n className?: string;\n}\n\nconst stepName = (name: string | undefined, note: string | undefined): string | undefined => {\n const base = name?.trim();\n const extra = note?.trim();\n if (!base) {\n return undefined;\n }\n return extra ? `${base} · ${extra}` : base;\n};\n\n// Inline, not Tailwind: menus portal outside the shadow root's stylesheet.\nexport const HexagonScale: React.FC<HexagonScaleProps> = ({\n steps,\n shape,\n current,\n label,\n stepLabels,\n currentNote,\n className,\n}) => (\n <span\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={className}\n style={{ display: 'inline-flex', flexShrink: 0, alignItems: 'center', gap: 2 }}\n >\n {steps.map((tone, index) => {\n const isCurrent = index === current;\n const mark = (\n <Hexagon key={index} tone={tone} shape={shape} size=\"small\" dimmed={!isCurrent} />\n );\n const name = stepName(stepLabels?.[index], isCurrent ? currentNote : undefined);\n return name ? (\n <Tooltip key={index} text={name} triggerAs=\"span\" inline describesTrigger={false}>\n {mark}\n </Tooltip>\n ) : (\n mark\n );\n })}\n </span>\n);\n\nexport default HexagonScale;\n"],"names":["stepName","name","note","base","extra","HexagonScale","steps","shape","current","label","stepLabels","currentNote","className","jsx","tone","index","isCurrent","mark","Hexagon","Tooltip"],"mappings":";;;AAkBA,MAAMA,IAAW,CAACC,GAA0BC,MAAiD;AACzF,QAAMC,IAAOF,KAAA,gBAAAA,EAAM,QACbG,IAAQF,KAAA,gBAAAA,EAAM;AACpB,MAAKC;AAGL,WAAOC,IAAQ,GAAGD,CAAI,MAAMC,CAAK,KAAKD;AAC1C,GAGaE,IAA4C,CAAC;AAAA,EACtD,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AACJ,MACI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,MAAMJ,IAAQ,QAAQ;AAAA,IACtB,cAAYA;AAAA,IACZ,eAAaA,IAAQ,SAAY;AAAA,IACjC,WAAAG;AAAA,IACA,OAAO,EAAE,SAAS,eAAe,YAAY,GAAG,YAAY,UAAU,KAAK,EAAA;AAAA,IAE1E,UAAAN,EAAM,IAAI,CAACQ,GAAMC,MAAU;AACxB,YAAMC,IAAYD,MAAUP,GACtBS,IACF,gBAAAJ,EAACK,GAAA,EAAoB,MAAAJ,GAAY,OAAAP,GAAc,MAAK,SAAQ,QAAQ,CAACS,EAAA,GAAvDD,CAAkE,GAE9Ed,IAAOD,EAASU,KAAA,gBAAAA,EAAaK,IAAQC,IAAYL,IAAc,MAAS;AAC9E,aAAOV,IACH,gBAAAY,EAACM,GAAA,EAAoB,MAAMlB,GAAM,WAAU,QAAO,QAAM,IAAC,kBAAkB,IACtE,UAAAgB,EAAA,GADSF,CAEd,IAEAE;AAAA,IAER,CAAC;AAAA,EAAA;AACL;"}
|
|
@@ -27,13 +27,14 @@ const J = {
|
|
|
27
27
|
small: "rounded-[var(--malachite-radius-10,10px)]",
|
|
28
28
|
medium: "rounded-xl",
|
|
29
29
|
large: "rounded-[var(--malachite-radius-xxl,14px)]"
|
|
30
|
-
}, Ae = (
|
|
31
|
-
switch (
|
|
30
|
+
}, Ae = (t, e) => {
|
|
31
|
+
switch (t) {
|
|
32
32
|
case "ghost":
|
|
33
33
|
return {
|
|
34
34
|
wrapper: [
|
|
35
35
|
e ? "border-0 border-b border-solid border-[var(--malachite-destructive-border)]" : "",
|
|
36
|
-
|
|
36
|
+
// The hover and focus borders an invalid field moves to (tailwind.css).
|
|
37
|
+
e ? "field-invalid" : ""
|
|
37
38
|
],
|
|
38
39
|
shadow: "shadow-none",
|
|
39
40
|
borderRadius: "rounded-none"
|
|
@@ -44,22 +45,22 @@ const J = {
|
|
|
44
45
|
wrapper: [
|
|
45
46
|
"border border-solid",
|
|
46
47
|
e ? "border-[var(--malachite-destructive-border)]" : "border-[var(--malachite-card-border)]",
|
|
47
|
-
e ? "
|
|
48
|
+
e ? "field-invalid" : `${_e} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`
|
|
48
49
|
],
|
|
49
50
|
shadow: e ? "shadow-error" : "shadow-default",
|
|
50
51
|
borderRadius: ""
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
}, aa = ({
|
|
54
|
-
label:
|
|
55
|
+
label: t,
|
|
55
56
|
hint: e,
|
|
56
57
|
hintIcon: i,
|
|
57
58
|
tooltip: g,
|
|
58
|
-
placeholder:
|
|
59
|
+
placeholder: w,
|
|
59
60
|
icon: m,
|
|
60
61
|
name: o,
|
|
61
62
|
required: h,
|
|
62
|
-
requiredIndicator:
|
|
63
|
+
requiredIndicator: b,
|
|
63
64
|
error: $,
|
|
64
65
|
description: V,
|
|
65
66
|
loading: Y = !1,
|
|
@@ -72,15 +73,15 @@ const J = {
|
|
|
72
73
|
prefixValue: M,
|
|
73
74
|
prefixSecondaryValue: Z,
|
|
74
75
|
ellipsis: ae = !1,
|
|
75
|
-
copyOnClick:
|
|
76
|
+
copyOnClick: te = !1,
|
|
76
77
|
formControl: A,
|
|
77
|
-
buttons:
|
|
78
|
+
buttons: f,
|
|
78
79
|
onCopyClick: B,
|
|
79
|
-
showCopyButton:
|
|
80
|
+
showCopyButton: re,
|
|
80
81
|
onChange: I,
|
|
81
82
|
value: ie,
|
|
82
83
|
onBlur: y,
|
|
83
|
-
helperText:
|
|
84
|
+
helperText: u,
|
|
84
85
|
showPasswordToggle: N = !0,
|
|
85
86
|
id: le,
|
|
86
87
|
autoFocus: se = !1,
|
|
@@ -91,35 +92,35 @@ const J = {
|
|
|
91
92
|
}) => {
|
|
92
93
|
const { controlId: P, labelId: me, descriptionId: G, hintId: H, helperTextId: C } = Ee({
|
|
93
94
|
id: le,
|
|
94
|
-
label:
|
|
95
|
+
label: t,
|
|
95
96
|
description: V,
|
|
96
97
|
hint: e,
|
|
97
98
|
helperText: !0
|
|
98
|
-
}), [E, he] = T(!1), [pe,
|
|
99
|
+
}), [E, he] = T(!1), [pe, fe] = T(D || ""), [k, O] = T(!1);
|
|
99
100
|
ye(() => {
|
|
100
101
|
if (k) {
|
|
101
|
-
const
|
|
102
|
+
const r = setTimeout(() => {
|
|
102
103
|
O(!1);
|
|
103
104
|
}, 1e3);
|
|
104
|
-
return () => clearTimeout(
|
|
105
|
+
return () => clearTimeout(r);
|
|
105
106
|
}
|
|
106
107
|
}, [k]);
|
|
107
|
-
const
|
|
108
|
+
const ue = (r) => (l) => {
|
|
108
109
|
const c = l.target.value;
|
|
109
|
-
|
|
110
|
-
}, U = Ne(void 0), L = (
|
|
110
|
+
fe(c), I == null || I(c), r == null || r(c);
|
|
111
|
+
}, U = Ne(void 0), L = (r) => Ve({
|
|
111
112
|
component: "Input",
|
|
112
113
|
name: o,
|
|
113
114
|
value: ie,
|
|
114
|
-
formValue:
|
|
115
|
+
formValue: r,
|
|
115
116
|
defaultValue: D,
|
|
116
117
|
bound: !!A,
|
|
117
118
|
uncontrolledValue: pe
|
|
118
|
-
}),
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
} : void 0,
|
|
122
|
-
const l = Ae(ee,
|
|
119
|
+
}), x = B ? () => {
|
|
120
|
+
const r = L(U.current);
|
|
121
|
+
r && (navigator.clipboard.writeText(r), O(!0), B());
|
|
122
|
+
} : void 0, xe = d === "password" ? E ? "text" : "password" : d, ve = m || M || Z, ge = J[n], we = (r) => {
|
|
123
|
+
const l = Ae(ee, r);
|
|
123
124
|
return [
|
|
124
125
|
"relative",
|
|
125
126
|
"flex items-center",
|
|
@@ -135,13 +136,13 @@ const J = {
|
|
|
135
136
|
return /* @__PURE__ */ a(
|
|
136
137
|
Ce,
|
|
137
138
|
{
|
|
138
|
-
label:
|
|
139
|
+
label: t,
|
|
139
140
|
hint: e,
|
|
140
141
|
hintIcon: i,
|
|
141
142
|
tooltip: g,
|
|
142
143
|
name: o,
|
|
143
144
|
required: h,
|
|
144
|
-
requiredIndicator:
|
|
145
|
+
requiredIndicator: b,
|
|
145
146
|
loading: Y,
|
|
146
147
|
formControl: A,
|
|
147
148
|
description: V,
|
|
@@ -153,26 +154,26 @@ const J = {
|
|
|
153
154
|
Te,
|
|
154
155
|
{
|
|
155
156
|
heightClass: ge,
|
|
156
|
-
helperText: !!
|
|
157
|
+
helperText: !!u,
|
|
157
158
|
helperTextMarginTop: !0
|
|
158
159
|
}
|
|
159
160
|
),
|
|
160
|
-
children: ({ error:
|
|
161
|
+
children: ({ error: r, message: l, onFieldChange: c, onFieldBlur: S, value: W }) => {
|
|
161
162
|
U.current = W;
|
|
162
|
-
const
|
|
163
|
+
const v = L(W), z = re ?? !!(x && p && v), R = $ ?? r, j = $ === !1 ? void 0 : l, X = R && !j, be = X || z || (f == null ? void 0 : f.length) || d === "password" && N, q = `${C}-error`, Ie = [
|
|
163
164
|
G,
|
|
164
165
|
H,
|
|
165
|
-
|
|
166
|
+
u ? C : void 0,
|
|
166
167
|
j ? q : void 0,
|
|
167
168
|
ce
|
|
168
169
|
].filter(Boolean).join(" ") || void 0, F = /* @__PURE__ */ a(
|
|
169
170
|
"input",
|
|
170
171
|
{
|
|
171
172
|
id: P,
|
|
172
|
-
type:
|
|
173
|
-
placeholder:
|
|
174
|
-
value:
|
|
175
|
-
onChange:
|
|
173
|
+
type: xe,
|
|
174
|
+
placeholder: w,
|
|
175
|
+
value: v,
|
|
176
|
+
onChange: ue(c),
|
|
176
177
|
onBlur: () => {
|
|
177
178
|
y == null || y(), S == null || S();
|
|
178
179
|
},
|
|
@@ -190,8 +191,8 @@ const J = {
|
|
|
190
191
|
}
|
|
191
192
|
);
|
|
192
193
|
return /* @__PURE__ */ s(K, { children: [
|
|
193
|
-
/* @__PURE__ */ s("div", { className:
|
|
194
|
-
|
|
194
|
+
/* @__PURE__ */ s("div", { className: we(R), children: [
|
|
195
|
+
ve && /* @__PURE__ */ a("div", { className: "flex items-center pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ a(
|
|
195
196
|
Be,
|
|
196
197
|
{
|
|
197
198
|
prefixValue: M,
|
|
@@ -199,10 +200,10 @@ const J = {
|
|
|
199
200
|
icon: m
|
|
200
201
|
}
|
|
201
202
|
) }),
|
|
202
|
-
|
|
203
|
+
te && z && x ? /* @__PURE__ */ a(
|
|
203
204
|
$e,
|
|
204
205
|
{
|
|
205
|
-
text:
|
|
206
|
+
text: v,
|
|
206
207
|
fill: !0,
|
|
207
208
|
triggerAs: "div",
|
|
208
209
|
describesTrigger: !1,
|
|
@@ -215,14 +216,14 @@ const J = {
|
|
|
215
216
|
type: "button",
|
|
216
217
|
tabIndex: -1,
|
|
217
218
|
"aria-hidden": "true",
|
|
218
|
-
onClick:
|
|
219
|
+
onClick: x,
|
|
219
220
|
className: "absolute inset-0 cursor-copy border-0 bg-transparent p-0"
|
|
220
221
|
}
|
|
221
222
|
)
|
|
222
223
|
] })
|
|
223
224
|
}
|
|
224
225
|
) : F,
|
|
225
|
-
|
|
226
|
+
be && /* @__PURE__ */ s(
|
|
226
227
|
"div",
|
|
227
228
|
{
|
|
228
229
|
className: `flex items-center pl-1 flex-shrink-0 ${d === "password" && N ? "pr-0" : "pr-3"}`,
|
|
@@ -231,8 +232,8 @@ const J = {
|
|
|
231
232
|
Pe,
|
|
232
233
|
{
|
|
233
234
|
error: X,
|
|
234
|
-
defaultValue:
|
|
235
|
-
onCopyClick:
|
|
235
|
+
defaultValue: v,
|
|
236
|
+
onCopyClick: x,
|
|
236
237
|
showCopyButton: z,
|
|
237
238
|
copied: k,
|
|
238
239
|
type: d,
|
|
@@ -241,17 +242,17 @@ const J = {
|
|
|
241
242
|
onTogglePassword: () => he(!E)
|
|
242
243
|
}
|
|
243
244
|
),
|
|
244
|
-
/* @__PURE__ */ a(Ge, { buttons:
|
|
245
|
+
/* @__PURE__ */ a(Ge, { buttons: f })
|
|
245
246
|
]
|
|
246
247
|
}
|
|
247
248
|
)
|
|
248
249
|
] }),
|
|
249
|
-
|
|
250
|
+
u && /* @__PURE__ */ a(
|
|
250
251
|
"div",
|
|
251
252
|
{
|
|
252
253
|
id: C,
|
|
253
254
|
className: "mt-1 text-[length:var(--malachite-font-size-small,13px)] text-left pl-2 text-[var(--malachite-text-dimmed,rgb(161,161,161))] [overflow-wrap:anywhere]",
|
|
254
|
-
children:
|
|
255
|
+
children: u
|
|
255
256
|
}
|
|
256
257
|
),
|
|
257
258
|
/* @__PURE__ */ a(je, { id: q, message: j, spaced: !0 })
|
|
@@ -259,22 +260,22 @@ const J = {
|
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
);
|
|
262
|
-
}, Be = ({ prefixValue:
|
|
263
|
+
}, Be = ({ prefixValue: t, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
263
264
|
i && /* @__PURE__ */ a("span", { className: "flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0", children: i }),
|
|
264
|
-
|
|
265
|
+
t && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-medium,14px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: t }),
|
|
265
266
|
e && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-medium,14px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: e })
|
|
266
267
|
] }), Pe = ({
|
|
267
|
-
error:
|
|
268
|
+
error: t,
|
|
268
269
|
defaultValue: e,
|
|
269
270
|
onCopyClick: i,
|
|
270
271
|
showCopyButton: g = !1,
|
|
271
|
-
copied:
|
|
272
|
+
copied: w = !1,
|
|
272
273
|
type: m,
|
|
273
274
|
showPassword: o,
|
|
274
275
|
showPasswordToggle: h = !0,
|
|
275
|
-
onTogglePassword:
|
|
276
|
+
onTogglePassword: b
|
|
276
277
|
}) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
277
|
-
|
|
278
|
+
t && // Decorative: the rejection is carried by the message beneath the field, so
|
|
278
279
|
// announcing an unnamed icon here would only repeat it as "info".
|
|
279
280
|
/* @__PURE__ */ a(
|
|
280
281
|
"div",
|
|
@@ -290,15 +291,15 @@ const J = {
|
|
|
290
291
|
)
|
|
291
292
|
}
|
|
292
293
|
),
|
|
293
|
-
g && i && e && /* @__PURE__ */ a(ke, { copied:
|
|
294
|
-
m === "password" && h && /* @__PURE__ */ a(Q, { variant: "no-style", onClick:
|
|
294
|
+
g && i && e && /* @__PURE__ */ a(ke, { copied: w, onCopy: i }),
|
|
295
|
+
m === "password" && h && /* @__PURE__ */ a(Q, { variant: "no-style", onClick: b, type: "button", size: "small", children: o ? /* @__PURE__ */ a(
|
|
295
296
|
Se,
|
|
296
297
|
{
|
|
297
298
|
size: 16,
|
|
298
299
|
style: { color: "var(--malachite-text-dimmed)" }
|
|
299
300
|
}
|
|
300
301
|
) : /* @__PURE__ */ a(ze, { size: 16, style: { color: "var(--malachite-text-dimmed)" } }) })
|
|
301
|
-
] }), Ge = ({ buttons:
|
|
302
|
+
] }), Ge = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ a(K, { children: t.map((e) => /* @__PURE__ */ a(
|
|
302
303
|
Q,
|
|
303
304
|
{
|
|
304
305
|
variant: e.variant || (e.danger ? "destructive" : "outline"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { useEffect, 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 CopyButton from '../CopyButton';\nimport EyeClosedIcon from '../CustomIcons/EyeClosedIcon';\nimport EyeIcon from '../CustomIcons/EyeIcon';\nimport InfoIcon from '../CustomIcons/InfoIcon';\nimport FieldMessage from '../FieldMessage';\nimport LoadingInput from '../LoadingInput';\nimport Tooltip from '../Tooltip';\nimport { paintedFieldValue } from '../devWarning';\nimport { FOCUS_BORDER } from '../focusRing';\nimport type { ButtonDefinition, InputSize, InputType, InputVariant } from './types';\n\ninterface InputProps {\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 type?: InputType;\n description?: string;\n size?: InputSize;\n variant?: InputVariant;\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 /**\n * For a value shown to copy (`showCopyButton` with `onCopyClick`): a click anywhere on the\n * value copies it too, under a copy cursor, and hovering shows the whole value. The copy\n * button stays the keyboard's way to copy.\n */\n copyOnClick?: boolean;\n formControl?: Control<FieldValues, unknown>;\n buttons?: ButtonDefinition[];\n onCopyClick?: () => void;\n showCopyButton?: boolean;\n onChange?: (value: string) => void;\n /** Controlled value, for a source of truth outside the form (URL, app state). */\n value?: string;\n onBlur?: () => void;\n helperText?: React.ReactNode;\n showPasswordToggle?: boolean;\n id?: string;\n /** Moves focus into the field when it mounts, such as the first field of a form that just opened. */\n autoFocus?: boolean;\n /** The browser's autofill hint, such as `current-password` or `new-password`. Defaults to `off`. */\n autoComplete?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n}\n\n// Figma specs one Input, at 42px / px-16 / 15px / radius 14 — the large tier. The smaller\n// tiers have no Input master, so they follow Search, which shares the field chrome.\nconst SIZE_HEIGHT: Record<InputSize, string> = {\n small: 'h-[var(--malachite-control-height-small,28px)]',\n medium: 'h-[var(--malachite-control-height-medium,32px)]',\n large: 'h-[var(--malachite-control-height-large,42px)]',\n};\n\nconst SIZE_TEXT: Record<InputSize, string> = {\n small: 'text-[length:var(--malachite-font-size-small,13px)]',\n medium: 'text-[length:var(--malachite-font-size-small,13px)]',\n large: 'text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]',\n};\n\nconst SIZE_PADDING: Record<InputSize, string> = {\n small: 'px-[10px]',\n medium: 'px-[10px]',\n large: 'px-[16px]',\n};\n\nconst SIZE_RADIUS: Record<InputSize, string> = {\n small: 'rounded-[var(--malachite-radius-10,10px)]',\n medium: 'rounded-xl',\n large: 'rounded-[var(--malachite-radius-xxl,14px)]',\n};\n\nconst getVariantClasses = (\n variant: InputVariant,\n error?: boolean,\n): {\n wrapper: string[];\n shadow: string;\n borderRadius: string;\n} => {\n switch (variant) {\n case 'ghost':\n return {\n wrapper: [\n error\n ? 'border-0 border-b border-solid border-[var(--malachite-destructive-border)]'\n : '',\n error\n ? 'focus-within:border-[var(--malachite-destructive-border-hover)] hover:border-[var(--malachite-destructive-border-hover)]'\n : '',\n ],\n shadow: 'shadow-none',\n borderRadius: 'rounded-none',\n };\n case 'default':\n default:\n return {\n wrapper: [\n 'border border-solid',\n error\n ? 'border-[var(--malachite-destructive-border)]'\n : 'border-[var(--malachite-card-border)]',\n error\n ? 'focus-within:border-[var(--malachite-destructive-border-hover)] hover:border-[var(--malachite-destructive-border-hover)]'\n : `${FOCUS_BORDER} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`,\n ],\n shadow: error ? 'shadow-error' : 'shadow-default',\n borderRadius: '',\n };\n }\n};\n\nconst Input: React.FC<InputProps> = ({\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 type = 'text',\n size = 'large',\n variant = 'default',\n defaultValue,\n disabled,\n prefixValue,\n prefixSecondaryValue,\n ellipsis = false,\n copyOnClick = false,\n formControl,\n buttons,\n onCopyClick,\n showCopyButton,\n onChange,\n value,\n onBlur,\n helperText,\n showPasswordToggle = true,\n id,\n autoFocus = false,\n autoComplete = 'off',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n}) => {\n const { controlId, labelId, descriptionId, hintId, helperTextId } = useFormFieldIds({\n id,\n label,\n description,\n hint,\n helperText: true,\n });\n const [showPassword, setShowPassword] = useState(false);\n const [inputValue, setInputValue] = useState(defaultValue || '');\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (copied) {\n const timer = setTimeout(() => {\n setCopied(false);\n }, 1000);\n return () => clearTimeout(timer);\n }\n }, [copied]);\n\n const handleChange =\n (reportToForm?: (value: unknown) => void) => (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setInputValue(newValue);\n onChange?.(newValue);\n reportToForm?.(newValue);\n };\n\n const formValueRef = useRef<unknown>(undefined);\n const paintedValue = (formValue: unknown): string =>\n paintedFieldValue({\n component: 'Input',\n name,\n value,\n formValue,\n defaultValue,\n bound: !!formControl,\n uncontrolledValue: inputValue,\n });\n\n const handleCopyClick = onCopyClick\n ? () => {\n const copyValue = paintedValue(formValueRef.current);\n if (copyValue) {\n navigator.clipboard.writeText(copyValue);\n setCopied(true);\n onCopyClick();\n }\n }\n : undefined;\n\n const actualInputType = type === 'password' ? (showPassword ? 'text' : 'password') : type;\n\n const hasPrefix = icon || prefixValue || prefixSecondaryValue;\n\n // The skeleton stands in for the field, so it reads the same height the wrapper does.\n const heightClass = SIZE_HEIGHT[size];\n\n const buildWrapperClasses = (isError: boolean): string => {\n const variantStyles = getVariantClasses(variant, isError);\n\n return [\n 'relative',\n 'flex items-center',\n 'w-full',\n variantStyles.borderRadius || SIZE_RADIUS[size],\n disabled\n ? 'bg-[var(--malachite-card-dimmed-background)]'\n : 'bg-[var(--malachite-card-background)]',\n 'transition-colors duration-200 ease-in-out',\n variantStyles.shadow,\n ...(disabled ? [] : variantStyles.wrapper),\n SIZE_HEIGHT[size],\n ]\n .filter(Boolean)\n .join(' ');\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={\n <LoadingInput\n heightClass={heightClass}\n helperText={!!helperText}\n helperTextMarginTop\n />\n }\n >\n {({ error: fieldError, message, onFieldChange, onFieldBlur, value: formValue }) => {\n formValueRef.current = formValue;\n const displayValue = paintedValue(formValue);\n const shouldShowCopyButton =\n showCopyButton ?? !!(handleCopyClick && disabled && displayValue);\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 // The message is its own line rather than a replacement for the helper text:\n // a field that explains where to find its value still has to say why what was\n // typed was rejected, and dropping one for the other left the field marked red\n // with nothing anywhere saying what was wrong.\n const errorMessage = error === false ? undefined : message;\n // The icon is the only signal a consumer-forced `error` has; beside a message it\n // is duplication, and it crowds the suffix next to a reveal or copy control.\n const showErrorIcon = isError && !errorMessage;\n const hasSuffix =\n showErrorIcon ||\n shouldShowCopyButton ||\n buttons?.length ||\n (type === 'password' && showPasswordToggle);\n const errorMessageId = `${helperTextId}-error`;\n const describedBy =\n [\n descriptionId,\n hintId,\n helperText ? helperTextId : undefined,\n errorMessage ? errorMessageId : undefined,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const field = (\n <input\n id={controlId}\n type={actualInputType}\n placeholder={placeholder}\n value={displayValue}\n onChange={handleChange(onFieldChange)}\n onBlur={() => {\n onBlur?.();\n onFieldBlur?.();\n }}\n disabled={disabled || readOnly}\n readOnly={readOnly}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-invalid={isError || undefined}\n aria-required={required || undefined}\n aria-describedby={describedBy}\n className={`flex-1 bg-transparent border-none outline-none text-[var(--malachite-text-primary)] placeholder:text-[var(--malachite-text-placeholder)] disabled:text-[var(--malachite-text-primary)] disabled:cursor-not-allowed ${SIZE_TEXT[size]} ${SIZE_PADDING[size]} ${ellipsis ? 'min-w-0 truncate' : ''}`}\n name={name}\n />\n );\n\n return (\n <>\n <div className={buildWrapperClasses(isError)}>\n {hasPrefix && (\n <div className=\"flex items-center 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 {copyOnClick && shouldShowCopyButton && handleCopyClick ? (\n <Tooltip\n text={displayValue}\n fill\n triggerAs=\"div\"\n describesTrigger={false}\n showOnFocus={false}\n >\n <div className=\"relative flex min-w-0 flex-1\">\n {field}\n {/* Out of the tab order and the tree: the copy button is the keyboard's way to copy. */}\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden=\"true\"\n onClick={handleCopyClick}\n className=\"absolute inset-0 cursor-copy border-0 bg-transparent p-0\"\n />\n </div>\n </Tooltip>\n ) : (\n field\n )}\n\n {hasSuffix && (\n <div\n className={`flex items-center pl-1 flex-shrink-0 ${type === 'password' && showPasswordToggle ? 'pr-0' : 'pr-3'}`}\n >\n <Suffix\n error={showErrorIcon}\n defaultValue={displayValue}\n onCopyClick={handleCopyClick}\n showCopyButton={shouldShowCopyButton}\n copied={copied}\n type={type}\n showPassword={showPassword}\n showPasswordToggle={showPasswordToggle}\n onTogglePassword={() => setShowPassword(!showPassword)}\n />\n <InputButtons buttons={buttons} />\n </div>\n )}\n </div>\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))] [overflow-wrap:anywhere]\"\n >\n {helperText}\n </div>\n )}\n <FieldMessage id={errorMessageId} message={errorMessage} spaced />\n </>\n );\n }}\n </BaseFormComponent>\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-center gap-1\">\n {icon && (\n <span className=\"flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0\">\n {icon}\n </span>\n )}\n {prefixValue && (\n <span className=\"text-[length:var(--malachite-font-size-medium,14px)] 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-medium,14px)] 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 defaultValue?: string;\n onCopyClick?: () => void;\n showCopyButton?: boolean;\n copied?: boolean;\n type?: InputType;\n showPassword?: boolean;\n showPasswordToggle?: boolean;\n onTogglePassword?: () => void;\n}> = ({\n error,\n defaultValue,\n onCopyClick,\n showCopyButton = false,\n copied = false,\n type,\n showPassword,\n showPasswordToggle = true,\n onTogglePassword,\n}) => {\n return (\n <div className=\"flex items-center gap-1\">\n {error && (\n // Decorative: the rejection is carried by the message beneath the field, so\n // announcing an unnamed icon here would only repeat it as \"info\".\n <div\n aria-hidden=\"true\"\n className=\"flex items-center justify-center w-5 h-5 flex-shrink-0\"\n >\n <InfoIcon\n size={16}\n className=\"text-[var(--malachite-destructive-foreground,rgb(196,62,62))]\"\n />\n </div>\n )}\n {showCopyButton && onCopyClick && defaultValue && (\n <CopyButton copied={copied} onCopy={onCopyClick} />\n )}\n {type === 'password' && showPasswordToggle && (\n <Button variant=\"no-style\" onClick={onTogglePassword} type=\"button\" size=\"small\">\n {showPassword ? (\n <EyeClosedIcon\n size={16}\n style={{ color: 'var(--malachite-text-dimmed)' }}\n />\n ) : (\n <EyeIcon size={16} style={{ color: 'var(--malachite-text-dimmed)' }} />\n )}\n </Button>\n )}\n </div>\n );\n};\n\nconst InputButtons: React.FC<{\n buttons?: ButtonDefinition[];\n}> = ({ buttons }) => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <>\n {buttons.map((button) => (\n <Button\n key={button.label}\n variant={button.variant || (button.danger ? 'destructive' : 'outline')}\n size={button.size || 'small'}\n disabled={button.disabled}\n icon={button.icon}\n tooltip={button.tooltip}\n onClick={button.onClick}\n className=\"ml-1\"\n >\n {button.label}\n </Button>\n ))}\n </>\n );\n};\n\nexport default Input;\n"],"names":["SIZE_HEIGHT","SIZE_TEXT","SIZE_PADDING","SIZE_RADIUS","getVariantClasses","variant","error","FOCUS_BORDER","Input","label","hint","hintIcon","tooltip","placeholder","icon","name","required","requiredIndicator","description","loading","readOnly","type","size","defaultValue","disabled","prefixValue","prefixSecondaryValue","ellipsis","copyOnClick","formControl","buttons","onCopyClick","showCopyButton","onChange","value","onBlur","helperText","showPasswordToggle","id","autoFocus","autoComplete","ariaLabel","ariaLabelledBy","ariaDescribedBy","controlId","labelId","descriptionId","hintId","helperTextId","useFormFieldIds","showPassword","setShowPassword","useState","inputValue","setInputValue","copied","setCopied","useEffect","timer","handleChange","reportToForm","e","newValue","formValueRef","useRef","paintedValue","formValue","paintedFieldValue","handleCopyClick","copyValue","actualInputType","hasPrefix","heightClass","buildWrapperClasses","isError","variantStyles","jsx","BaseFormComponent","LoadingInput","fieldError","message","onFieldChange","onFieldBlur","displayValue","shouldShowCopyButton","errorMessage","showErrorIcon","hasSuffix","errorMessageId","describedBy","field","jsxs","Fragment","CompositeIcon","Tooltip","Suffix","InputButtons","FieldMessage","onTogglePassword","InfoIcon","CopyButton","Button","EyeClosedIcon","EyeIcon","button"],"mappings":";;;;;;;;;;;;;AAkEA,MAAMA,IAAyC;AAAA,EAC3C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACX,GAEMC,KAAuC;AAAA,EACzC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACX,GAEMC,KAA0C;AAAA,EAC5C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACX,GAEMC,KAAyC;AAAA,EAC3C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AACX,GAEMC,KAAoB,CACtBC,GACAC,MAKC;AACD,UAAQD,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,QACH,SAAS;AAAA,UACLC,IACM,iFACA;AAAA,UACNA,IACM,6HACA;AAAA,QAAA;AAAA,QAEV,QAAQ;AAAA,QACR,cAAc;AAAA,MAAA;AAAA,IAEtB,KAAK;AAAA,IACL;AACI,aAAO;AAAA,QACH,SAAS;AAAA,UACL;AAAA,UACAA,IACM,iDACA;AAAA,UACNA,IACM,6HACA,GAAGC,EAAY;AAAA,QAAA;AAAA,QAEzB,QAAQD,IAAQ,iBAAiB;AAAA,QACjC,cAAc;AAAA,MAAA;AAAA,EAClB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AAA;AAAA,EAAArF;AAAA;AAAA,EAGG,gBAAAsE;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,eAAY;AAAA,MACZ,WAAU;AAAA,MAEV,UAAA,gBAAAA;AAAA,QAACuB;AAAA,QAAA;AAAA,UACG,MAAM;AAAA,UACN,WAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAAA,EAGPnE,KAAkBD,KAAeR,uBAC7B6E,IAAA,EAAW,QAAA7C,GAAgB,QAAQxB,GAAa;AAAA,EAEpDV,MAAS,cAAcgB,KACpB,gBAAAuC,EAACyB,GAAA,EAAO,SAAQ,YAAW,SAASH,GAAkB,MAAK,UAAS,MAAK,SACpE,UAAAhD,IACG,gBAAA0B;AAAA,IAAC0B;AAAA,IAAA;AAAA,MACG,MAAM;AAAA,MACN,OAAO,EAAE,OAAO,+BAAA;AAAA,IAA+B;AAAA,EAAA,IAGnD,gBAAA1B,EAAC2B,IAAA,EAAQ,MAAM,IAAI,OAAO,EAAE,OAAO,+BAAA,EAA+B,CAAG,EAAA,CAE7E;AAAA,GAER,GAIFP,KAED,CAAC,EAAE,SAAAlE,QACCA,KAAA,QAAAA,EAAS,SAKV,gBAAA8C,EAAAgB,GAAA,EACK,UAAA9D,EAAQ,IAAI,CAAC0E,MACV,gBAAA5B;AAAA,EAACyB;AAAA,EAAA;AAAA,IAEG,SAASG,EAAO,YAAYA,EAAO,SAAS,gBAAgB;AAAA,IAC5D,MAAMA,EAAO,QAAQ;AAAA,IACrB,UAAUA,EAAO;AAAA,IACjB,MAAMA,EAAO;AAAA,IACb,SAASA,EAAO;AAAA,IAChB,SAASA,EAAO;AAAA,IAChB,WAAU;AAAA,IAET,UAAAA,EAAO;AAAA,EAAA;AAAA,EATHA,EAAO;AAAA,CAWnB,GACL,IAnBO;"}
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { useEffect, 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 CopyButton from '../CopyButton';\nimport EyeClosedIcon from '../CustomIcons/EyeClosedIcon';\nimport EyeIcon from '../CustomIcons/EyeIcon';\nimport InfoIcon from '../CustomIcons/InfoIcon';\nimport FieldMessage from '../FieldMessage';\nimport LoadingInput from '../LoadingInput';\nimport Tooltip from '../Tooltip';\nimport { paintedFieldValue } from '../devWarning';\nimport { FOCUS_BORDER } from '../focusRing';\nimport type { ButtonDefinition, InputSize, InputType, InputVariant } from './types';\n\ninterface InputProps {\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 type?: InputType;\n description?: string;\n size?: InputSize;\n variant?: InputVariant;\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 /**\n * For a value shown to copy (`showCopyButton` with `onCopyClick`): a click anywhere on the\n * value copies it too, under a copy cursor, and hovering shows the whole value. The copy\n * button stays the keyboard's way to copy.\n */\n copyOnClick?: boolean;\n formControl?: Control<FieldValues, unknown>;\n buttons?: ButtonDefinition[];\n onCopyClick?: () => void;\n showCopyButton?: boolean;\n onChange?: (value: string) => void;\n /** Controlled value, for a source of truth outside the form (URL, app state). */\n value?: string;\n onBlur?: () => void;\n helperText?: React.ReactNode;\n showPasswordToggle?: boolean;\n id?: string;\n /** Moves focus into the field when it mounts, such as the first field of a form that just opened. */\n autoFocus?: boolean;\n /** The browser's autofill hint, such as `current-password` or `new-password`. Defaults to `off`. */\n autoComplete?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n}\n\n// Figma specs one Input, at 42px / px-16 / 15px / radius 14 — the large tier. The smaller\n// tiers have no Input master, so they follow Search, which shares the field chrome.\nconst SIZE_HEIGHT: Record<InputSize, string> = {\n small: 'h-[var(--malachite-control-height-small,28px)]',\n medium: 'h-[var(--malachite-control-height-medium,32px)]',\n large: 'h-[var(--malachite-control-height-large,42px)]',\n};\n\nconst SIZE_TEXT: Record<InputSize, string> = {\n small: 'text-[length:var(--malachite-font-size-small,13px)]',\n medium: 'text-[length:var(--malachite-font-size-small,13px)]',\n large: 'text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]',\n};\n\nconst SIZE_PADDING: Record<InputSize, string> = {\n small: 'px-[10px]',\n medium: 'px-[10px]',\n large: 'px-[16px]',\n};\n\nconst SIZE_RADIUS: Record<InputSize, string> = {\n small: 'rounded-[var(--malachite-radius-10,10px)]',\n medium: 'rounded-xl',\n large: 'rounded-[var(--malachite-radius-xxl,14px)]',\n};\n\nconst getVariantClasses = (\n variant: InputVariant,\n error?: boolean,\n): {\n wrapper: string[];\n shadow: string;\n borderRadius: string;\n} => {\n switch (variant) {\n case 'ghost':\n return {\n wrapper: [\n error\n ? 'border-0 border-b border-solid border-[var(--malachite-destructive-border)]'\n : '',\n // The hover and focus borders an invalid field moves to (tailwind.css).\n error ? 'field-invalid' : '',\n ],\n shadow: 'shadow-none',\n borderRadius: 'rounded-none',\n };\n case 'default':\n default:\n return {\n wrapper: [\n 'border border-solid',\n error\n ? 'border-[var(--malachite-destructive-border)]'\n : 'border-[var(--malachite-card-border)]',\n error\n ? 'field-invalid'\n : `${FOCUS_BORDER} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`,\n ],\n shadow: error ? 'shadow-error' : 'shadow-default',\n borderRadius: '',\n };\n }\n};\n\nconst Input: React.FC<InputProps> = ({\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 type = 'text',\n size = 'large',\n variant = 'default',\n defaultValue,\n disabled,\n prefixValue,\n prefixSecondaryValue,\n ellipsis = false,\n copyOnClick = false,\n formControl,\n buttons,\n onCopyClick,\n showCopyButton,\n onChange,\n value,\n onBlur,\n helperText,\n showPasswordToggle = true,\n id,\n autoFocus = false,\n autoComplete = 'off',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n}) => {\n const { controlId, labelId, descriptionId, hintId, helperTextId } = useFormFieldIds({\n id,\n label,\n description,\n hint,\n helperText: true,\n });\n const [showPassword, setShowPassword] = useState(false);\n const [inputValue, setInputValue] = useState(defaultValue || '');\n const [copied, setCopied] = useState(false);\n\n useEffect(() => {\n if (copied) {\n const timer = setTimeout(() => {\n setCopied(false);\n }, 1000);\n return () => clearTimeout(timer);\n }\n }, [copied]);\n\n const handleChange =\n (reportToForm?: (value: unknown) => void) => (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n setInputValue(newValue);\n onChange?.(newValue);\n reportToForm?.(newValue);\n };\n\n const formValueRef = useRef<unknown>(undefined);\n const paintedValue = (formValue: unknown): string =>\n paintedFieldValue({\n component: 'Input',\n name,\n value,\n formValue,\n defaultValue,\n bound: !!formControl,\n uncontrolledValue: inputValue,\n });\n\n const handleCopyClick = onCopyClick\n ? () => {\n const copyValue = paintedValue(formValueRef.current);\n if (copyValue) {\n navigator.clipboard.writeText(copyValue);\n setCopied(true);\n onCopyClick();\n }\n }\n : undefined;\n\n const actualInputType = type === 'password' ? (showPassword ? 'text' : 'password') : type;\n\n const hasPrefix = icon || prefixValue || prefixSecondaryValue;\n\n // The skeleton stands in for the field, so it reads the same height the wrapper does.\n const heightClass = SIZE_HEIGHT[size];\n\n const buildWrapperClasses = (isError: boolean): string => {\n const variantStyles = getVariantClasses(variant, isError);\n\n return [\n 'relative',\n 'flex items-center',\n 'w-full',\n variantStyles.borderRadius || SIZE_RADIUS[size],\n disabled\n ? 'bg-[var(--malachite-card-dimmed-background)]'\n : 'bg-[var(--malachite-card-background)]',\n 'transition-colors duration-200 ease-in-out',\n variantStyles.shadow,\n ...(disabled ? [] : variantStyles.wrapper),\n SIZE_HEIGHT[size],\n ]\n .filter(Boolean)\n .join(' ');\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={\n <LoadingInput\n heightClass={heightClass}\n helperText={!!helperText}\n helperTextMarginTop\n />\n }\n >\n {({ error: fieldError, message, onFieldChange, onFieldBlur, value: formValue }) => {\n formValueRef.current = formValue;\n const displayValue = paintedValue(formValue);\n const shouldShowCopyButton =\n showCopyButton ?? !!(handleCopyClick && disabled && displayValue);\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 // The message is its own line rather than a replacement for the helper text:\n // a field that explains where to find its value still has to say why what was\n // typed was rejected, and dropping one for the other left the field marked red\n // with nothing anywhere saying what was wrong.\n const errorMessage = error === false ? undefined : message;\n // The icon is the only signal a consumer-forced `error` has; beside a message it\n // is duplication, and it crowds the suffix next to a reveal or copy control.\n const showErrorIcon = isError && !errorMessage;\n const hasSuffix =\n showErrorIcon ||\n shouldShowCopyButton ||\n buttons?.length ||\n (type === 'password' && showPasswordToggle);\n const errorMessageId = `${helperTextId}-error`;\n const describedBy =\n [\n descriptionId,\n hintId,\n helperText ? helperTextId : undefined,\n errorMessage ? errorMessageId : undefined,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const field = (\n <input\n id={controlId}\n type={actualInputType}\n placeholder={placeholder}\n value={displayValue}\n onChange={handleChange(onFieldChange)}\n onBlur={() => {\n onBlur?.();\n onFieldBlur?.();\n }}\n disabled={disabled || readOnly}\n readOnly={readOnly}\n autoComplete={autoComplete}\n autoFocus={autoFocus}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-invalid={isError || undefined}\n aria-required={required || undefined}\n aria-describedby={describedBy}\n className={`flex-1 bg-transparent border-none outline-none text-[var(--malachite-text-primary)] placeholder:text-[var(--malachite-text-placeholder)] disabled:text-[var(--malachite-text-primary)] disabled:cursor-not-allowed ${SIZE_TEXT[size]} ${SIZE_PADDING[size]} ${ellipsis ? 'min-w-0 truncate' : ''}`}\n name={name}\n />\n );\n\n return (\n <>\n <div className={buildWrapperClasses(isError)}>\n {hasPrefix && (\n <div className=\"flex items-center 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 {copyOnClick && shouldShowCopyButton && handleCopyClick ? (\n <Tooltip\n text={displayValue}\n fill\n triggerAs=\"div\"\n describesTrigger={false}\n showOnFocus={false}\n >\n <div className=\"relative flex min-w-0 flex-1\">\n {field}\n {/* Out of the tab order and the tree: the copy button is the keyboard's way to copy. */}\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden=\"true\"\n onClick={handleCopyClick}\n className=\"absolute inset-0 cursor-copy border-0 bg-transparent p-0\"\n />\n </div>\n </Tooltip>\n ) : (\n field\n )}\n\n {hasSuffix && (\n <div\n className={`flex items-center pl-1 flex-shrink-0 ${type === 'password' && showPasswordToggle ? 'pr-0' : 'pr-3'}`}\n >\n <Suffix\n error={showErrorIcon}\n defaultValue={displayValue}\n onCopyClick={handleCopyClick}\n showCopyButton={shouldShowCopyButton}\n copied={copied}\n type={type}\n showPassword={showPassword}\n showPasswordToggle={showPasswordToggle}\n onTogglePassword={() => setShowPassword(!showPassword)}\n />\n <InputButtons buttons={buttons} />\n </div>\n )}\n </div>\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))] [overflow-wrap:anywhere]\"\n >\n {helperText}\n </div>\n )}\n <FieldMessage id={errorMessageId} message={errorMessage} spaced />\n </>\n );\n }}\n </BaseFormComponent>\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-center gap-1\">\n {icon && (\n <span className=\"flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0\">\n {icon}\n </span>\n )}\n {prefixValue && (\n <span className=\"text-[length:var(--malachite-font-size-medium,14px)] 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-medium,14px)] 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 defaultValue?: string;\n onCopyClick?: () => void;\n showCopyButton?: boolean;\n copied?: boolean;\n type?: InputType;\n showPassword?: boolean;\n showPasswordToggle?: boolean;\n onTogglePassword?: () => void;\n}> = ({\n error,\n defaultValue,\n onCopyClick,\n showCopyButton = false,\n copied = false,\n type,\n showPassword,\n showPasswordToggle = true,\n onTogglePassword,\n}) => {\n return (\n <div className=\"flex items-center gap-1\">\n {error && (\n // Decorative: the rejection is carried by the message beneath the field, so\n // announcing an unnamed icon here would only repeat it as \"info\".\n <div\n aria-hidden=\"true\"\n className=\"flex items-center justify-center w-5 h-5 flex-shrink-0\"\n >\n <InfoIcon\n size={16}\n className=\"text-[var(--malachite-destructive-foreground,rgb(196,62,62))]\"\n />\n </div>\n )}\n {showCopyButton && onCopyClick && defaultValue && (\n <CopyButton copied={copied} onCopy={onCopyClick} />\n )}\n {type === 'password' && showPasswordToggle && (\n <Button variant=\"no-style\" onClick={onTogglePassword} type=\"button\" size=\"small\">\n {showPassword ? (\n <EyeClosedIcon\n size={16}\n style={{ color: 'var(--malachite-text-dimmed)' }}\n />\n ) : (\n <EyeIcon size={16} style={{ color: 'var(--malachite-text-dimmed)' }} />\n )}\n </Button>\n )}\n </div>\n );\n};\n\nconst InputButtons: React.FC<{\n buttons?: ButtonDefinition[];\n}> = ({ buttons }) => {\n if (!buttons?.length) {\n return null;\n }\n\n return (\n <>\n {buttons.map((button) => (\n <Button\n key={button.label}\n variant={button.variant || (button.danger ? 'destructive' : 'outline')}\n size={button.size || 'small'}\n disabled={button.disabled}\n icon={button.icon}\n tooltip={button.tooltip}\n onClick={button.onClick}\n className=\"ml-1\"\n >\n {button.label}\n </Button>\n ))}\n </>\n );\n};\n\nexport default Input;\n"],"names":["SIZE_HEIGHT","SIZE_TEXT","SIZE_PADDING","SIZE_RADIUS","getVariantClasses","variant","error","FOCUS_BORDER","Input","label","hint","hintIcon","tooltip","placeholder","icon","name","required","requiredIndicator","description","loading","readOnly","type","size","defaultValue","disabled","prefixValue","prefixSecondaryValue","ellipsis","copyOnClick","formControl","buttons","onCopyClick","showCopyButton","onChange","value","onBlur","helperText","showPasswordToggle","id","autoFocus","autoComplete","ariaLabel","ariaLabelledBy","ariaDescribedBy","controlId","labelId","descriptionId","hintId","helperTextId","useFormFieldIds","showPassword","setShowPassword","useState","inputValue","setInputValue","copied","setCopied","useEffect","timer","handleChange","reportToForm","e","newValue","formValueRef","useRef","paintedValue","formValue","paintedFieldValue","handleCopyClick","copyValue","actualInputType","hasPrefix","heightClass","buildWrapperClasses","isError","variantStyles","jsx","BaseFormComponent","LoadingInput","fieldError","message","onFieldChange","onFieldBlur","displayValue","shouldShowCopyButton","errorMessage","showErrorIcon","hasSuffix","errorMessageId","describedBy","field","jsxs","Fragment","CompositeIcon","Tooltip","Suffix","InputButtons","FieldMessage","onTogglePassword","InfoIcon","CopyButton","Button","EyeClosedIcon","Eye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