@stackone/malachite 2.130.0 → 2.131.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.
@@ -1,40 +1,47 @@
1
- import { jsxs as d, jsx as o } from "react/jsx-runtime";
2
- import { Button as e } from "./Button.js";
3
- const b = ({
4
- primary: t,
5
- secondary: l,
6
- size: i = "medium",
7
- className: n = ""
8
- }) => /* @__PURE__ */ d("div", { className: `flex items-center justify-end gap-[8px] ${n}`, children: [
9
- l ? /* @__PURE__ */ o(
10
- e,
11
- {
12
- variant: "outline",
13
- size: i,
14
- type: "button",
15
- disabled: l.disabled,
16
- loading: l.loading,
17
- tooltip: l.tooltip,
18
- onClick: l.onClick,
19
- children: l.label
20
- }
21
- ) : null,
22
- t ? /* @__PURE__ */ o(
23
- e,
24
- {
25
- variant: t.tone === "destructive" ? "destructive" : "filled",
26
- size: i,
27
- type: t.type ?? "button",
28
- disabled: t.disabled,
29
- loading: t.loading,
30
- tooltip: t.tooltip,
31
- onClick: t.onClick,
32
- children: t.label
33
- }
34
- ) : null
35
- ] });
1
+ import { jsxs as o, Fragment as c, jsx as i } from "react/jsx-runtime";
2
+ import { Button as s } from "./Button.js";
3
+ const f = ({
4
+ primary: l,
5
+ secondary: t,
6
+ size: n = "medium",
7
+ note: e,
8
+ className: d = ""
9
+ }) => {
10
+ const a = /* @__PURE__ */ o(c, { children: [
11
+ t ? /* @__PURE__ */ i(
12
+ s,
13
+ {
14
+ variant: "outline",
15
+ size: n,
16
+ type: "button",
17
+ disabled: t.disabled,
18
+ loading: t.loading,
19
+ tooltip: t.tooltip,
20
+ onClick: t.onClick,
21
+ children: t.label
22
+ }
23
+ ) : null,
24
+ l ? /* @__PURE__ */ i(
25
+ s,
26
+ {
27
+ variant: l.tone === "destructive" ? "destructive" : "filled",
28
+ size: n,
29
+ type: l.type ?? "button",
30
+ disabled: l.disabled,
31
+ loading: l.loading,
32
+ tooltip: l.tooltip,
33
+ onClick: l.onClick,
34
+ children: l.label
35
+ }
36
+ ) : null
37
+ ] });
38
+ return e == null || e === !1 || e === "" ? /* @__PURE__ */ i("div", { className: `flex items-center justify-end gap-[8px] ${d}`, children: a }) : /* @__PURE__ */ o("div", { className: `flex flex-wrap items-center gap-x-[16px] gap-y-[8px] ${d}`, children: [
39
+ /* @__PURE__ */ i("div", { className: "min-w-0 flex-[1_1_240px] text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] text-[var(--malachite-text-secondary)]", children: e }),
40
+ /* @__PURE__ */ i("div", { className: "ml-auto flex items-center justify-end gap-[8px]", children: a })
41
+ ] });
42
+ };
36
43
  export {
37
- b as FormActions,
38
- b as default
44
+ f as FormActions,
45
+ f as default
39
46
  };
40
47
  //# sourceMappingURL=FormActions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormActions.js","sources":["../../src/components/FormActions.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from './Button';\n\nexport interface FormAction {\n label: string;\n onClick?: () => void;\n disabled?: boolean;\n loading?: boolean;\n tooltip?: string;\n}\n\nexport interface FormPrimaryAction extends FormAction {\n /** `destructive` for an action that deletes or revokes. */\n tone?: 'default' | 'destructive';\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 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 className = '',\n}) => (\n <div className={`flex items-center justify-end gap-[8px] ${className}`}>\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.tone === 'destructive' ? 'destructive' : 'filled'}\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 </div>\n);\n\nexport default FormActions;\nexport { FormActions };\n"],"names":["FormActions","primary","secondary","size","className","jsxs","jsx","Button"],"mappings":";;AA+BA,MAAMA,IAA0C,CAAC;AAAA,EAC7C,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAChB,MACI,gBAAAC,EAAC,OAAA,EAAI,WAAW,2CAA2CD,CAAS,IAC/D,UAAA;AAAA,EAAAF,IACG,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAAQ;AAAA,MACR,MAAAJ;AAAA,MACA,MAAK;AAAA,MACL,UAAUD,EAAU;AAAA,MACpB,SAASA,EAAU;AAAA,MACnB,SAASA,EAAU;AAAA,MACnB,SAASA,EAAU;AAAA,MAElB,UAAAA,EAAU;AAAA,IAAA;AAAA,EAAA,IAEf;AAAA,EACHD,IACG,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAASN,EAAQ,SAAS,gBAAgB,gBAAgB;AAAA,MAC1D,MAAAE;AAAA,MACA,MAAMF,EAAQ,QAAQ;AAAA,MACtB,UAAUA,EAAQ;AAAA,MAClB,SAASA,EAAQ;AAAA,MACjB,SAASA,EAAQ;AAAA,MACjB,SAASA,EAAQ;AAAA,MAEhB,UAAAA,EAAQ;AAAA,IAAA;AAAA,EAAA,IAEb;AAAA,EAAA,CACR;"}
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 /** `destructive` for an action that deletes or revokes. */\n tone?: 'default' | 'destructive';\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.tone === 'destructive' ? 'destructive' : 'filled'}\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":["FormActions","primary","secondary","size","note","className","buttons","jsxs","Fragment","jsx","Button"],"mappings":";;AAgCA,MAAMA,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,SAAST,EAAQ,SAAS,gBAAgB,gBAAgB;AAAA,QAC1D,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,28 +1,29 @@
1
- import { jsx as a, jsxs as s, Fragment as Q } from "react/jsx-runtime";
1
+ import { jsx as a, jsxs as s, Fragment as K } from "react/jsx-runtime";
2
2
  import { useState as T, useEffect as ye, useRef as Ne } from "react";
3
3
  import Ce, { useFormFieldIds as Ee } from "../BaseFormComponent.js";
4
- import { Button as Y } from "../Button.js";
4
+ import { Button as Q } from "../Button.js";
5
5
  import { CopyButton as ke } from "../CopyButton.js";
6
6
  import Se from "../CustomIcons/EyeClosedIcon.js";
7
7
  import ze from "../CustomIcons/EyeIcon.js";
8
- import je from "../CustomIcons/InfoIcon.js";
9
- import { FieldMessage as Re } from "../FieldMessage.js";
8
+ import Re from "../CustomIcons/InfoIcon.js";
9
+ import { FieldMessage as je } from "../FieldMessage.js";
10
10
  import Te from "../LoadingInput.js";
11
- import Ve from "../Tooltip.js";
12
- import { paintedFieldValue as $e } from "../devWarning.js";
13
- const O = {
11
+ import $e from "../Tooltip.js";
12
+ import { paintedFieldValue as Ve } from "../devWarning.js";
13
+ import { FOCUS_BORDER as _e } from "../focusRing.js";
14
+ const J = {
14
15
  small: "h-[var(--malachite-control-height-small,28px)]",
15
16
  medium: "h-[var(--malachite-control-height-medium,32px)]",
16
17
  large: "h-[var(--malachite-control-height-large,42px)]"
17
- }, Me = {
18
+ }, De = {
18
19
  small: "text-[length:var(--malachite-font-size-small,13px)]",
19
20
  medium: "text-[length:var(--malachite-font-size-small,13px)]",
20
21
  large: "text-[length:var(--malachite-font-size-15,15px)] leading-[1.4]"
21
- }, Ze = {
22
+ }, Me = {
22
23
  small: "px-[10px]",
23
24
  medium: "px-[10px]",
24
25
  large: "px-[16px]"
25
- }, _e = {
26
+ }, Ze = {
26
27
  small: "rounded-[var(--malachite-radius-10,10px)]",
27
28
  medium: "rounded-xl",
28
29
  large: "rounded-[var(--malachite-radius-xxl,14px)]"
@@ -43,13 +44,13 @@ const O = {
43
44
  wrapper: [
44
45
  "border border-solid",
45
46
  e ? "border-[var(--malachite-destructive-border)]" : "border-[var(--malachite-card-border)]",
46
- e ? "focus-within:border-[var(--malachite-destructive-border-hover)] hover:border-[var(--malachite-destructive-border-hover)]" : "focus-within:border-[var(--malachite-control-border-hover)] hover:border-[var(--malachite-control-border-hover)]"
47
+ e ? "focus-within:border-[var(--malachite-destructive-border-hover)] hover:border-[var(--malachite-destructive-border-hover)]" : `${_e} hover:not-focus-within:border-[var(--malachite-control-border-hover)]`
47
48
  ],
48
49
  shadow: e ? "shadow-error" : "shadow-default",
49
50
  borderRadius: ""
50
51
  };
51
52
  }
52
- }, Fe = ({
53
+ }, aa = ({
53
54
  label: r,
54
55
  hint: e,
55
56
  hintIcon: i,
@@ -59,22 +60,22 @@ const O = {
59
60
  name: o,
60
61
  required: h,
61
62
  requiredIndicator: w,
62
- error: V,
63
- description: $,
64
- loading: F = !1,
65
- readOnly: M = !1,
63
+ error: $,
64
+ description: V,
65
+ loading: Y = !1,
66
+ readOnly: _ = !1,
66
67
  type: d = "text",
67
68
  size: n = "large",
68
69
  variant: ee = "default",
69
- defaultValue: Z,
70
+ defaultValue: D,
70
71
  disabled: p,
71
- prefixValue: _,
72
- prefixSecondaryValue: A,
72
+ prefixValue: M,
73
+ prefixSecondaryValue: Z,
73
74
  ellipsis: ae = !1,
74
75
  copyOnClick: re = !1,
75
- formControl: D,
76
+ formControl: A,
76
77
  buttons: u,
77
- onCopyClick: P,
78
+ onCopyClick: B,
78
79
  showCopyButton: te,
79
80
  onChange: I,
80
81
  value: ie,
@@ -88,17 +89,17 @@ const O = {
88
89
  "aria-labelledby": ne,
89
90
  "aria-describedby": ce
90
91
  }) => {
91
- const { controlId: B, labelId: me, descriptionId: G, hintId: H, helperTextId: C } = Ee({
92
+ const { controlId: P, labelId: me, descriptionId: G, hintId: H, helperTextId: C } = Ee({
92
93
  id: le,
93
94
  label: r,
94
- description: $,
95
+ description: V,
95
96
  hint: e,
96
97
  helperText: !0
97
- }), [E, he] = T(!1), [pe, ue] = T(Z || ""), [k, L] = T(!1);
98
+ }), [E, he] = T(!1), [pe, ue] = T(D || ""), [k, O] = T(!1);
98
99
  ye(() => {
99
100
  if (k) {
100
101
  const t = setTimeout(() => {
101
- L(!1);
102
+ O(!1);
102
103
  }, 1e3);
103
104
  return () => clearTimeout(t);
104
105
  }
@@ -106,29 +107,29 @@ const O = {
106
107
  const ve = (t) => (l) => {
107
108
  const c = l.target.value;
108
109
  ue(c), I == null || I(c), t == null || t(c);
109
- }, U = Ne(void 0), W = (t) => $e({
110
+ }, U = Ne(void 0), L = (t) => Ve({
110
111
  component: "Input",
111
112
  name: o,
112
113
  value: ie,
113
114
  formValue: t,
114
- defaultValue: Z,
115
- bound: !!D,
115
+ defaultValue: D,
116
+ bound: !!A,
116
117
  uncontrolledValue: pe
117
- }), f = P ? () => {
118
- const t = W(U.current);
119
- t && (navigator.clipboard.writeText(t), L(!0), P());
120
- } : void 0, fe = d === "password" ? E ? "text" : "password" : d, xe = m || _ || A, ge = O[n], be = (t) => {
118
+ }), f = B ? () => {
119
+ const t = L(U.current);
120
+ t && (navigator.clipboard.writeText(t), O(!0), B());
121
+ } : void 0, fe = d === "password" ? E ? "text" : "password" : d, xe = m || M || Z, ge = J[n], be = (t) => {
121
122
  const l = Ae(ee, t);
122
123
  return [
123
124
  "relative",
124
125
  "flex items-center",
125
126
  "w-full",
126
- l.borderRadius || _e[n],
127
+ l.borderRadius || Ze[n],
127
128
  p ? "bg-[var(--malachite-card-dimmed-background)]" : "bg-[var(--malachite-card-background)]",
128
129
  "transition-colors duration-200 ease-in-out",
129
130
  l.shadow,
130
131
  ...p ? [] : l.wrapper,
131
- O[n]
132
+ J[n]
132
133
  ].filter(Boolean).join(" ");
133
134
  };
134
135
  return /* @__PURE__ */ a(
@@ -141,10 +142,10 @@ const O = {
141
142
  name: o,
142
143
  required: h,
143
144
  requiredIndicator: w,
144
- loading: F,
145
- formControl: D,
146
- description: $,
147
- controlId: B,
145
+ loading: Y,
146
+ formControl: A,
147
+ description: V,
148
+ controlId: P,
148
149
  labelId: me,
149
150
  descriptionId: G,
150
151
  hintId: H,
@@ -156,18 +157,18 @@ const O = {
156
157
  helperTextMarginTop: !0
157
158
  }
158
159
  ),
159
- children: ({ error: t, message: l, onFieldChange: c, onFieldBlur: S, value: X }) => {
160
- U.current = X;
161
- const x = W(X), z = te ?? !!(f && p && x), j = V ?? t, R = V === !1 ? void 0 : l, q = j && !R, we = q || z || (u == null ? void 0 : u.length) || d === "password" && N, J = `${C}-error`, Ie = [
160
+ children: ({ error: t, message: l, onFieldChange: c, onFieldBlur: S, value: W }) => {
161
+ U.current = W;
162
+ const x = L(W), z = te ?? !!(f && p && x), R = $ ?? t, j = $ === !1 ? void 0 : l, X = R && !j, we = X || z || (u == null ? void 0 : u.length) || d === "password" && N, q = `${C}-error`, Ie = [
162
163
  G,
163
164
  H,
164
165
  v ? C : void 0,
165
- R ? J : void 0,
166
+ j ? q : void 0,
166
167
  ce
167
- ].filter(Boolean).join(" ") || void 0, K = /* @__PURE__ */ a(
168
+ ].filter(Boolean).join(" ") || void 0, F = /* @__PURE__ */ a(
168
169
  "input",
169
170
  {
170
- id: B,
171
+ id: P,
171
172
  type: fe,
172
173
  placeholder: b,
173
174
  value: x,
@@ -175,31 +176,31 @@ const O = {
175
176
  onBlur: () => {
176
177
  y == null || y(), S == null || S();
177
178
  },
178
- disabled: p || M,
179
- readOnly: M,
179
+ disabled: p || _,
180
+ readOnly: _,
180
181
  autoComplete: oe,
181
182
  autoFocus: se,
182
183
  "aria-label": de,
183
184
  "aria-labelledby": ne,
184
- "aria-invalid": j || void 0,
185
+ "aria-invalid": R || void 0,
185
186
  "aria-required": h || void 0,
186
187
  "aria-describedby": Ie,
187
- className: `flex-1 bg-transparent border-none outline-none text-[var(--malachite-text-primary)] placeholder:text-[var(--malachite-text-placeholder)] disabled:text-[var(--malachite-text-primary)] disabled:cursor-not-allowed ${Me[n]} ${Ze[n]} ${ae ? "min-w-0 truncate" : ""}`,
188
+ 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 ${De[n]} ${Me[n]} ${ae ? "min-w-0 truncate" : ""}`,
188
189
  name: o
189
190
  }
190
191
  );
191
- return /* @__PURE__ */ s(Q, { children: [
192
- /* @__PURE__ */ s("div", { className: be(j), children: [
192
+ return /* @__PURE__ */ s(K, { children: [
193
+ /* @__PURE__ */ s("div", { className: be(R), children: [
193
194
  xe && /* @__PURE__ */ a("div", { className: "flex items-center pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ a(
194
- De,
195
+ Be,
195
196
  {
196
- prefixValue: _,
197
- prefixSecondaryValue: A,
197
+ prefixValue: M,
198
+ prefixSecondaryValue: Z,
198
199
  icon: m
199
200
  }
200
201
  ) }),
201
202
  re && z && f ? /* @__PURE__ */ a(
202
- Ve,
203
+ $e,
203
204
  {
204
205
  text: x,
205
206
  fill: !0,
@@ -207,7 +208,7 @@ const O = {
207
208
  describesTrigger: !1,
208
209
  showOnFocus: !1,
209
210
  children: /* @__PURE__ */ s("div", { className: "relative flex min-w-0 flex-1", children: [
210
- K,
211
+ F,
211
212
  /* @__PURE__ */ a(
212
213
  "button",
213
214
  {
@@ -220,7 +221,7 @@ const O = {
220
221
  )
221
222
  ] })
222
223
  }
223
- ) : K,
224
+ ) : F,
224
225
  we && /* @__PURE__ */ s(
225
226
  "div",
226
227
  {
@@ -229,7 +230,7 @@ const O = {
229
230
  /* @__PURE__ */ a(
230
231
  Pe,
231
232
  {
232
- error: q,
233
+ error: X,
233
234
  defaultValue: x,
234
235
  onCopyClick: f,
235
236
  showCopyButton: z,
@@ -240,7 +241,7 @@ const O = {
240
241
  onTogglePassword: () => he(!E)
241
242
  }
242
243
  ),
243
- /* @__PURE__ */ a(Be, { buttons: u })
244
+ /* @__PURE__ */ a(Ge, { buttons: u })
244
245
  ]
245
246
  }
246
247
  )
@@ -253,12 +254,12 @@ const O = {
253
254
  children: v
254
255
  }
255
256
  ),
256
- /* @__PURE__ */ a(Re, { id: J, message: R, spaced: !0 })
257
+ /* @__PURE__ */ a(je, { id: q, message: j, spaced: !0 })
257
258
  ] });
258
259
  }
259
260
  }
260
261
  );
261
- }, De = ({ prefixValue: r, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
262
+ }, Be = ({ prefixValue: r, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
262
263
  i && /* @__PURE__ */ a("span", { className: "flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0", children: i }),
263
264
  r && /* @__PURE__ */ a("span", { className: "text-[length:var(--malachite-font-size-medium,14px)] leading-[1.4] text-[var(--malachite-text-dimmed)] whitespace-nowrap", children: r }),
264
265
  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 })
@@ -281,7 +282,7 @@ const O = {
281
282
  "aria-hidden": "true",
282
283
  className: "flex items-center justify-center w-5 h-5 flex-shrink-0",
283
284
  children: /* @__PURE__ */ a(
284
- je,
285
+ Re,
285
286
  {
286
287
  size: 16,
287
288
  className: "text-[var(--malachite-destructive-foreground,rgb(196,62,62))]"
@@ -290,15 +291,15 @@ const O = {
290
291
  }
291
292
  ),
292
293
  g && i && e && /* @__PURE__ */ a(ke, { copied: b, onCopy: i }),
293
- m === "password" && h && /* @__PURE__ */ a(Y, { variant: "no-style", onClick: w, type: "button", size: "small", children: o ? /* @__PURE__ */ a(
294
+ m === "password" && h && /* @__PURE__ */ a(Q, { variant: "no-style", onClick: w, type: "button", size: "small", children: o ? /* @__PURE__ */ a(
294
295
  Se,
295
296
  {
296
297
  size: 16,
297
298
  style: { color: "var(--malachite-text-dimmed)" }
298
299
  }
299
300
  ) : /* @__PURE__ */ a(ze, { size: 16, style: { color: "var(--malachite-text-dimmed)" } }) })
300
- ] }), Be = ({ buttons: r }) => r != null && r.length ? /* @__PURE__ */ a(Q, { children: r.map((e) => /* @__PURE__ */ a(
301
- Y,
301
+ ] }), Ge = ({ buttons: r }) => r != null && r.length ? /* @__PURE__ */ a(K, { children: r.map((e) => /* @__PURE__ */ a(
302
+ Q,
302
303
  {
303
304
  variant: e.variant || (e.danger ? "destructive" : "outline"),
304
305
  size: e.size || "small",
@@ -312,6 +313,6 @@ const O = {
312
313
  e.label
313
314
  )) }) : null;
314
315
  export {
315
- Fe as default
316
+ aa as default
316
317
  };
317
318
  //# sourceMappingURL=Input.js.map
@@ -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 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-within:border-[var(--malachite-control-border-hover)] hover: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","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":";;;;;;;;;;;;AAiEA,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;AAAA,QAAA;AAAA,QAEV,QAAQA,IAAQ,iBAAiB;AAAA,QACjC,cAAc;AAAA,MAAA;AAAA,EAClB;AAEZ,GAEMC,KAA8B,CAAC;AAAA,EACjC,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC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A,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 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;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