@stackone/malachite 2.134.0 → 2.134.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/components/ChangeReview/ChangeReviewItem.js +19 -19
  2. package/dist/components/ChangeReview/ChangeReviewItem.js.map +1 -1
  3. package/dist/components/CodePreview.js +41 -41
  4. package/dist/components/CodePreview.js.map +1 -1
  5. package/dist/components/Input/Input.js +126 -112
  6. package/dist/components/Input/Input.js.map +1 -1
  7. package/dist/components/PageLayout/constants.js +17 -11
  8. package/dist/components/PageLayout/constants.js.map +1 -1
  9. package/dist/components/PageLayout/pageColumn.js +18 -24
  10. package/dist/components/PageLayout/pageColumn.js.map +1 -1
  11. package/dist/components/PageLayout/pageColumns.js +9 -10
  12. package/dist/components/PageLayout/pageColumns.js.map +1 -1
  13. package/dist/components/PageLayout/regularLayout.js +5 -5
  14. package/dist/components/PageLayout/regularLayout.js.map +1 -1
  15. package/dist/fontFace.js +20 -0
  16. package/dist/fontFace.js.map +1 -0
  17. package/dist/fontInjection.js.map +1 -1
  18. package/dist/geist-font.inline.js +7 -0
  19. package/dist/geist-font.inline.js.map +1 -0
  20. package/dist/geist-font.js +13 -14
  21. package/dist/geist-font.js.map +1 -1
  22. package/dist/inter-font.inline.js +22 -0
  23. package/dist/inter-font.inline.js.map +1 -0
  24. package/dist/inter-font.js +25 -26
  25. package/dist/inter-font.js.map +1 -1
  26. package/dist/stack-sans-font.inline.js +6 -0
  27. package/dist/stack-sans-font.inline.js.map +1 -0
  28. package/dist/stack-sans-font.js +9 -8
  29. package/dist/stack-sans-font.js.map +1 -1
  30. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-400-normal.woff2 +0 -0
  31. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-400-normal.woff2.inline.js +5 -0
  32. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-400-normal.woff2.inline.js.map +1 -0
  33. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-400-normal.woff2.js +2 -2
  34. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-400-normal.woff2.js.map +1 -1
  35. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-500-normal.woff2 +0 -0
  36. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-500-normal.woff2.inline.js +5 -0
  37. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-500-normal.woff2.inline.js.map +1 -0
  38. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-500-normal.woff2.js +2 -2
  39. package/dist/vendor/@fontsource/geist-sans/files/geist-sans-latin-500-normal.woff2.js.map +1 -1
  40. package/dist/vendor/@fontsource/inter/files/inter-latin-400-normal.woff2 +0 -0
  41. package/dist/vendor/@fontsource/inter/files/inter-latin-400-normal.woff2.inline.js +5 -0
  42. package/dist/vendor/@fontsource/inter/files/inter-latin-400-normal.woff2.inline.js.map +1 -0
  43. package/dist/vendor/@fontsource/inter/files/inter-latin-400-normal.woff2.js +2 -2
  44. package/dist/vendor/@fontsource/inter/files/inter-latin-400-normal.woff2.js.map +1 -1
  45. package/dist/vendor/@fontsource/inter/files/inter-latin-500-normal.woff2 +0 -0
  46. package/dist/vendor/@fontsource/inter/files/inter-latin-500-normal.woff2.inline.js +5 -0
  47. package/dist/vendor/@fontsource/inter/files/inter-latin-500-normal.woff2.inline.js.map +1 -0
  48. package/dist/vendor/@fontsource/inter/files/inter-latin-500-normal.woff2.js +2 -2
  49. package/dist/vendor/@fontsource/inter/files/inter-latin-500-normal.woff2.js.map +1 -1
  50. package/dist/vendor/@fontsource/inter/files/inter-latin-600-normal.woff2 +0 -0
  51. package/dist/vendor/@fontsource/inter/files/inter-latin-600-normal.woff2.inline.js +5 -0
  52. package/dist/vendor/@fontsource/inter/files/inter-latin-600-normal.woff2.inline.js.map +1 -0
  53. package/dist/vendor/@fontsource/inter/files/inter-latin-600-normal.woff2.js +2 -2
  54. package/dist/vendor/@fontsource/inter/files/inter-latin-600-normal.woff2.js.map +1 -1
  55. package/dist/vendor/@fontsource/inter/files/inter-latin-700-normal.woff2 +0 -0
  56. package/dist/vendor/@fontsource/inter/files/inter-latin-700-normal.woff2.inline.js +5 -0
  57. package/dist/vendor/@fontsource/inter/files/inter-latin-700-normal.woff2.inline.js.map +1 -0
  58. package/dist/vendor/@fontsource/inter/files/inter-latin-700-normal.woff2.js +2 -2
  59. package/dist/vendor/@fontsource/inter/files/inter-latin-700-normal.woff2.js.map +1 -1
  60. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-400-normal.woff2 +0 -0
  61. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-400-normal.woff2.inline.js +5 -0
  62. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-400-normal.woff2.inline.js.map +1 -0
  63. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-400-normal.woff2.js +2 -2
  64. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-400-normal.woff2.js.map +1 -1
  65. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-500-normal.woff2 +0 -0
  66. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-500-normal.woff2.inline.js +5 -0
  67. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-500-normal.woff2.inline.js.map +1 -0
  68. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-500-normal.woff2.js +2 -2
  69. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-500-normal.woff2.js.map +1 -1
  70. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-600-normal.woff2 +0 -0
  71. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-600-normal.woff2.inline.js +5 -0
  72. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-600-normal.woff2.inline.js.map +1 -0
  73. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-600-normal.woff2.js +2 -2
  74. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-600-normal.woff2.js.map +1 -1
  75. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-700-normal.woff2 +0 -0
  76. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-700-normal.woff2.inline.js +5 -0
  77. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-700-normal.woff2.inline.js.map +1 -0
  78. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-700-normal.woff2.js +2 -2
  79. package/dist/vendor/@fontsource/inter/files/inter-latin-ext-700-normal.woff2.js.map +1 -1
  80. package/dist/vendor/@fontsource-variable/stack-sans-text/files/stack-sans-text-latin-wght-normal.woff2 +0 -0
  81. package/dist/vendor/@fontsource-variable/stack-sans-text/files/stack-sans-text-latin-wght-normal.woff2.inline.js +5 -0
  82. package/dist/vendor/@fontsource-variable/stack-sans-text/files/stack-sans-text-latin-wght-normal.woff2.inline.js.map +1 -0
  83. package/dist/vendor/@fontsource-variable/stack-sans-text/files/stack-sans-text-latin-wght-normal.woff2.js +2 -2
  84. package/dist/vendor/@fontsource-variable/stack-sans-text/files/stack-sans-text-latin-wght-normal.woff2.js.map +1 -1
  85. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
- import { jsx as a, jsxs as s, Fragment as K } from "react/jsx-runtime";
1
+ import { jsx as a, jsxs as o, Fragment as Q } 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 Q } from "../Button.js";
5
- import { CopyButton as ke } from "../CopyButton.js";
6
- import Se from "../CustomIcons/EyeClosedIcon.js";
4
+ import { Button as Y } from "../Button.js";
5
+ import { CopyButton as Se } from "../CopyButton.js";
6
+ import ke from "../CustomIcons/EyeClosedIcon.js";
7
7
  import ze from "../CustomIcons/EyeIcon.js";
8
8
  import Re from "../CustomIcons/InfoIcon.js";
9
- import { FieldMessage as je } from "../FieldMessage.js";
10
- import Te from "../LoadingInput.js";
11
- import $e from "../Tooltip.js";
9
+ import { FieldMessage as $e } from "../FieldMessage.js";
10
+ import je from "../LoadingInput.js";
11
+ import Te from "../Tooltip.js";
12
12
  import { paintedFieldValue as Ve } from "../devWarning.js";
13
13
  import { FOCUS_BORDER as _e } from "../focusRing.js";
14
- const J = {
14
+ const L = {
15
15
  small: "h-[var(--malachite-control-height-small,28px)]",
16
16
  medium: "h-[var(--malachite-control-height-medium,32px)]",
17
17
  large: "h-[var(--malachite-control-height-large,42px)]"
@@ -55,82 +55,82 @@ const J = {
55
55
  label: t,
56
56
  hint: e,
57
57
  hintIcon: i,
58
- tooltip: g,
59
- placeholder: w,
58
+ tooltip: w,
59
+ placeholder: b,
60
60
  icon: m,
61
- name: o,
61
+ name: s,
62
62
  required: h,
63
- requiredIndicator: b,
64
- error: $,
63
+ requiredIndicator: I,
64
+ error: p,
65
65
  description: V,
66
- loading: Y = !1,
66
+ loading: ee = !1,
67
67
  readOnly: _ = !1,
68
68
  type: d = "text",
69
69
  size: n = "large",
70
- variant: ee = "default",
70
+ variant: ae = "default",
71
71
  defaultValue: D,
72
- disabled: p,
72
+ disabled: f,
73
73
  prefixValue: M,
74
74
  prefixSecondaryValue: Z,
75
- ellipsis: ae = !1,
76
- copyOnClick: te = !1,
75
+ ellipsis: te = !1,
76
+ copyOnClick: re = !1,
77
77
  formControl: A,
78
- buttons: f,
78
+ buttons: u,
79
79
  onCopyClick: B,
80
- showCopyButton: re,
81
- onChange: I,
82
- value: ie,
83
- onBlur: y,
84
- helperText: u,
85
- showPasswordToggle: N = !0,
86
- id: le,
87
- autoFocus: se = !1,
88
- autoComplete: oe = "off",
89
- "aria-label": de,
80
+ showCopyButton: ie,
81
+ onChange: y,
82
+ value: le,
83
+ onBlur: N,
84
+ helperText: x,
85
+ showPasswordToggle: C = !0,
86
+ id: se,
87
+ autoFocus: oe = !1,
88
+ autoComplete: de = "off",
89
+ "aria-label": G,
90
90
  "aria-labelledby": ne,
91
91
  "aria-describedby": ce
92
92
  }) => {
93
- const { controlId: P, labelId: me, descriptionId: G, hintId: H, helperTextId: C } = Ee({
94
- id: le,
93
+ const { controlId: H, labelId: me, descriptionId: O, hintId: P, helperTextId: E } = Ee({
94
+ id: se,
95
95
  label: t,
96
96
  description: V,
97
97
  hint: e,
98
98
  helperText: !0
99
- }), [E, he] = T(!1), [pe, fe] = T(D || ""), [k, O] = T(!1);
99
+ }), [S, he] = T(!1), [pe, fe] = T(D || ""), [k, U] = T(!1);
100
100
  ye(() => {
101
101
  if (k) {
102
102
  const r = setTimeout(() => {
103
- O(!1);
103
+ U(!1);
104
104
  }, 1e3);
105
105
  return () => clearTimeout(r);
106
106
  }
107
107
  }, [k]);
108
108
  const ue = (r) => (l) => {
109
109
  const c = l.target.value;
110
- fe(c), I == null || I(c), r == null || r(c);
111
- }, U = Ne(void 0), L = (r) => Ve({
110
+ fe(c), y == null || y(c), r == null || r(c);
111
+ }, W = Ne(void 0), X = (r) => Ve({
112
112
  component: "Input",
113
- name: o,
114
- value: ie,
113
+ name: s,
114
+ value: le,
115
115
  formValue: r,
116
116
  defaultValue: D,
117
117
  bound: !!A,
118
118
  uncontrolledValue: pe
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);
119
+ }), v = B ? () => {
120
+ const r = X(W.current);
121
+ r && (navigator.clipboard.writeText(r), U(!0), B());
122
+ } : void 0, xe = d === "password" ? S ? "text" : "password" : d, ve = m || M || Z, ge = L[n], we = (r) => {
123
+ const l = Ae(ae, r);
124
124
  return [
125
125
  "relative",
126
126
  "flex items-center",
127
127
  "w-full",
128
128
  l.borderRadius || Ze[n],
129
- p ? "bg-[var(--malachite-card-dimmed-background)]" : "bg-[var(--malachite-card-background)]",
129
+ f ? "bg-[var(--malachite-card-dimmed-background)]" : "bg-[var(--malachite-card-background)]",
130
130
  "transition-colors duration-200 ease-in-out",
131
131
  l.shadow,
132
- ...p ? [] : l.wrapper,
133
- J[n]
132
+ ...f ? [] : l.wrapper,
133
+ L[n]
134
134
  ].filter(Boolean).join(" ");
135
135
  };
136
136
  return /* @__PURE__ */ a(
@@ -139,59 +139,59 @@ const J = {
139
139
  label: t,
140
140
  hint: e,
141
141
  hintIcon: i,
142
- tooltip: g,
143
- name: o,
142
+ tooltip: w,
143
+ name: s,
144
144
  required: h,
145
- requiredIndicator: b,
146
- loading: Y,
145
+ requiredIndicator: I,
146
+ loading: ee,
147
147
  formControl: A,
148
148
  description: V,
149
- controlId: P,
149
+ controlId: H,
150
150
  labelId: me,
151
- descriptionId: G,
152
- hintId: H,
151
+ descriptionId: O,
152
+ hintId: P,
153
153
  loadingComponent: /* @__PURE__ */ a(
154
- Te,
154
+ je,
155
155
  {
156
156
  heightClass: ge,
157
- helperText: !!u,
157
+ helperText: !!x,
158
158
  helperTextMarginTop: !0
159
159
  }
160
160
  ),
161
- children: ({ error: r, message: l, onFieldChange: c, onFieldBlur: S, value: W }) => {
162
- U.current = W;
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 = [
164
- G,
165
- H,
166
- u ? C : void 0,
167
- j ? q : void 0,
161
+ children: ({ error: r, message: l, onFieldChange: c, onFieldBlur: z, value: q }) => {
162
+ W.current = q;
163
+ const g = X(q), R = ie ?? !!(v && f && g), $ = p ?? r, j = p === !1 ? void 0 : l, F = $ && !j, be = F || R || (u == null ? void 0 : u.length) || d === "password" && C, J = `${E}-error`, Ie = [
164
+ O,
165
+ P,
166
+ x ? E : void 0,
167
+ j ? J : void 0,
168
168
  ce
169
- ].filter(Boolean).join(" ") || void 0, F = /* @__PURE__ */ a(
169
+ ].filter(Boolean).join(" ") || void 0, K = /* @__PURE__ */ a(
170
170
  "input",
171
171
  {
172
- id: P,
172
+ id: H,
173
173
  type: xe,
174
- placeholder: w,
175
- value: v,
174
+ placeholder: b,
175
+ value: g,
176
176
  onChange: ue(c),
177
177
  onBlur: () => {
178
- y == null || y(), S == null || S();
178
+ N == null || N(), z == null || z();
179
179
  },
180
- disabled: p || _,
180
+ disabled: f || _,
181
181
  readOnly: _,
182
- autoComplete: oe,
183
- autoFocus: se,
184
- "aria-label": de,
182
+ autoComplete: de,
183
+ autoFocus: oe,
184
+ "aria-label": G,
185
185
  "aria-labelledby": ne,
186
- "aria-invalid": R || void 0,
186
+ "aria-invalid": $ || void 0,
187
187
  "aria-required": h || void 0,
188
188
  "aria-describedby": Ie,
189
- 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" : ""}`,
190
- name: o
189
+ 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]} ${te ? "min-w-0 truncate" : ""}`,
190
+ name: s
191
191
  }
192
192
  );
193
- return /* @__PURE__ */ s(K, { children: [
194
- /* @__PURE__ */ s("div", { className: we(R), children: [
193
+ return /* @__PURE__ */ o(Q, { children: [
194
+ /* @__PURE__ */ o("div", { className: we($), children: [
195
195
  ve && /* @__PURE__ */ a("div", { className: "flex items-center pl-3 pr-1 flex-shrink-0 pointer-events-none", children: /* @__PURE__ */ a(
196
196
  Be,
197
197
  {
@@ -200,81 +200,83 @@ const J = {
200
200
  icon: m
201
201
  }
202
202
  ) }),
203
- te && z && x ? /* @__PURE__ */ a(
204
- $e,
203
+ re && R && v ? /* @__PURE__ */ a(
204
+ Te,
205
205
  {
206
- text: v,
206
+ text: g,
207
207
  fill: !0,
208
208
  triggerAs: "div",
209
209
  describesTrigger: !1,
210
210
  showOnFocus: !1,
211
- children: /* @__PURE__ */ s("div", { className: "relative flex min-w-0 flex-1", children: [
212
- F,
211
+ children: /* @__PURE__ */ o("div", { className: "relative flex min-w-0 flex-1", children: [
212
+ K,
213
213
  /* @__PURE__ */ a(
214
214
  "button",
215
215
  {
216
216
  type: "button",
217
217
  tabIndex: -1,
218
218
  "aria-hidden": "true",
219
- onClick: x,
219
+ onClick: v,
220
220
  className: "absolute inset-0 cursor-copy border-0 bg-transparent p-0"
221
221
  }
222
222
  )
223
223
  ] })
224
224
  }
225
- ) : F,
226
- be && /* @__PURE__ */ s(
225
+ ) : K,
226
+ be && /* @__PURE__ */ o(
227
227
  "div",
228
228
  {
229
- className: `flex items-center pl-1 flex-shrink-0 ${d === "password" && N ? "pr-0" : "pr-3"}`,
229
+ className: `flex items-center pl-1 flex-shrink-0 ${d === "password" && C ? "pr-0" : "pr-3"}`,
230
230
  children: [
231
231
  /* @__PURE__ */ a(
232
- Pe,
232
+ Ge,
233
233
  {
234
- error: X,
235
- defaultValue: v,
236
- onCopyClick: x,
237
- showCopyButton: z,
234
+ error: F,
235
+ defaultValue: g,
236
+ onCopyClick: v,
237
+ showCopyButton: R,
238
238
  copied: k,
239
239
  type: d,
240
- showPassword: E,
241
- showPasswordToggle: N,
242
- onTogglePassword: () => he(!E)
240
+ showPassword: S,
241
+ showPasswordToggle: C,
242
+ fieldName: t || G,
243
+ onTogglePassword: () => he(!S)
243
244
  }
244
245
  ),
245
- /* @__PURE__ */ a(Ge, { buttons: f })
246
+ /* @__PURE__ */ a(He, { buttons: u })
246
247
  ]
247
248
  }
248
249
  )
249
250
  ] }),
250
- u && /* @__PURE__ */ a(
251
+ x && /* @__PURE__ */ a(
251
252
  "div",
252
253
  {
253
- id: C,
254
+ id: E,
254
255
  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]",
255
- children: u
256
+ children: x
256
257
  }
257
258
  ),
258
- /* @__PURE__ */ a(je, { id: q, message: j, spaced: !0 })
259
+ /* @__PURE__ */ a($e, { id: J, message: j, spaced: !0 })
259
260
  ] });
260
261
  }
261
262
  }
262
263
  );
263
- }, Be = ({ prefixValue: t, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
264
+ }, Be = ({ prefixValue: t, prefixSecondaryValue: e, icon: i }) => /* @__PURE__ */ o("div", { className: "flex items-center gap-1", children: [
264
265
  i && /* @__PURE__ */ a("span", { className: "flex items-center justify-center text-[var(--malachite-text-dimmed)] w-4 h-4 flex-shrink-0", children: i }),
265
266
  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 }),
266
267
  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 })
267
- ] }), Pe = ({
268
+ ] }), Ge = ({
268
269
  error: t,
269
270
  defaultValue: e,
270
271
  onCopyClick: i,
271
- showCopyButton: g = !1,
272
- copied: w = !1,
272
+ showCopyButton: w = !1,
273
+ copied: b = !1,
273
274
  type: m,
274
- showPassword: o,
275
+ showPassword: s,
275
276
  showPasswordToggle: h = !0,
276
- onTogglePassword: b
277
- }) => /* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
277
+ fieldName: I,
278
+ onTogglePassword: p
279
+ }) => /* @__PURE__ */ o("div", { className: "flex items-center gap-1", children: [
278
280
  t && // Decorative: the rejection is carried by the message beneath the field, so
279
281
  // announcing an unnamed icon here would only repeat it as "info".
280
282
  /* @__PURE__ */ a(
@@ -291,16 +293,28 @@ const J = {
291
293
  )
292
294
  }
293
295
  ),
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(
296
- Se,
296
+ w && i && e && /* @__PURE__ */ a(Se, { copied: b, onCopy: i }),
297
+ m === "password" && h && // A fixed name with `aria-pressed`: a toggle whose name flips is announced as a different control.
298
+ /* @__PURE__ */ a(
299
+ Y,
297
300
  {
298
- size: 16,
299
- style: { color: "var(--malachite-text-dimmed)" }
301
+ variant: "no-style",
302
+ onClick: p,
303
+ type: "button",
304
+ size: "small",
305
+ "aria-label": `Show ${I || "password"}`,
306
+ "aria-pressed": s,
307
+ children: s ? /* @__PURE__ */ a(
308
+ ke,
309
+ {
310
+ size: 16,
311
+ style: { color: "var(--malachite-text-dimmed)" }
312
+ }
313
+ ) : /* @__PURE__ */ a(ze, { size: 16, style: { color: "var(--malachite-text-dimmed)" } })
300
314
  }
301
- ) : /* @__PURE__ */ a(ze, { size: 16, style: { color: "var(--malachite-text-dimmed)" } }) })
302
- ] }), Ge = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ a(K, { children: t.map((e) => /* @__PURE__ */ a(
303
- Q,
315
+ )
316
+ ] }), He = ({ buttons: t }) => t != null && t.length ? /* @__PURE__ */ a(Q, { children: t.map((e) => /* @__PURE__ */ a(
317
+ Y,
304
318
  {
305
319
  variant: e.variant || (e.danger ? "destructive" : "outline"),
306
320
  size: e.size || "small",
@@ -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 // 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","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;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ASG,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 fieldName={label || ariaLabel}\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 fieldName?: string;\n onTogglePassword?: () => void;\n}> = ({\n error,\n defaultValue,\n onCopyClick,\n showCopyButton = false,\n copied = false,\n type,\n showPassword,\n showPasswordToggle = true,\n fieldName,\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 // A fixed name with `aria-pressed`: a toggle whose name flips is announced as a different control.\n <Button\n variant=\"no-style\"\n onClick={onTogglePassword}\n type=\"button\"\n size=\"small\"\n aria-label={`Show ${fieldName || 'password'}`}\n aria-pressed={showPassword}\n >\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","fieldName","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;AAAA,UAENA,IAAQ,kBAAkB;AAAA,QAAA;AAAA,QAE9B,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,kBACA,GAAGC,EAAY;AAAA,QAAA;AAAA,QAEzB,QAAQD,IAAQ,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,IAET,UAAAA,EAAO;AAAA,EAAA;AAAA,EATHA,EAAO;AAAA,CAWnB,GACL,IAnBO;"}
@@ -1,14 +1,20 @@
1
- const a = "var(--malachite-radius-xxxl, 16px)", c = "w-full overflow-hidden bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]", o = "border-b border-solid border-[var(--malachite-card-border)]", e = 56, t = 8, d = "var(--malachite-card-sunken-background, rgb(250, 250, 250))", n = "calc(100vh - 16px)", E = "calc(100vh - 136px)", r = "--malachite-page-content-inset", s = `var(${r}, 0px)`;
1
+ const c = {
2
+ small: 8,
3
+ medium: 16,
4
+ large: 24,
5
+ xlarge: 40
6
+ }, o = "var(--malachite-radius-xxxl, 16px)", e = "w-full overflow-hidden bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]", t = "border-b border-solid border-[var(--malachite-card-border)]", d = 56, r = 8, n = "var(--malachite-card-sunken-background, rgb(250, 250, 250))", l = `calc(100vh - ${r * 2}px)`, s = "calc(100vh - 136px)", a = "--malachite-page-content-inset", E = `var(${a}, 0px)`;
2
7
  export {
3
- c as CARD_CLASSES,
4
- n as CARD_MIN_HEIGHT,
5
- a as CARD_RADIUS,
6
- s as CONTENT_INSET,
7
- r as CONTENT_INSET_VAR,
8
- E as CONTENT_MIN_HEIGHT,
9
- o as DIVIDER_CLASSES,
10
- e as HEADER_HEIGHT,
11
- d as PAGE_BACKGROUND,
12
- t as PAGE_INSET
8
+ e as CARD_CLASSES,
9
+ l as CARD_MIN_HEIGHT,
10
+ o as CARD_RADIUS,
11
+ c as CONTENT_GAPS,
12
+ E as CONTENT_INSET,
13
+ a as CONTENT_INSET_VAR,
14
+ s as CONTENT_MIN_HEIGHT,
15
+ t as DIVIDER_CLASSES,
16
+ d as HEADER_HEIGHT,
17
+ n as PAGE_BACKGROUND,
18
+ r as PAGE_INSET
13
19
  };
14
20
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../src/components/PageLayout/constants.ts"],"sourcesContent":["// Not a <Surface>: that is a 14px card and paints a box-shadow this page card must not have.\nexport const CARD_RADIUS = 'var(--malachite-radius-xxxl, 16px)';\nexport const CARD_CLASSES =\n 'w-full overflow-hidden bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]';\nexport const DIVIDER_CLASSES = 'border-b border-solid border-[var(--malachite-card-border)]';\n\n// 56, not Figma's 60: the app sidebar's divider sits at 9 + 56 and this header's must land\n// on the same line (8px page inset + 1px card border + 56). Move both together or neither.\nexport const HEADER_HEIGHT = 56;\nexport const PAGE_INSET = 8;\nexport const PAGE_BACKGROUND = 'var(--malachite-card-sunken-background, rgb(250, 250, 250))';\nexport const CARD_MIN_HEIGHT = `calc(100vh - ${PAGE_INSET * 2}px)`;\n// 136 is not derivable from the constants above: the extra 64px is app chrome above the card.\nexport const CONTENT_MIN_HEIGHT = 'calc(100vh - 136px)';\n\n// Set by RegularLayout to its own horizontal content padding, so a `bleed` child can pull\n// itself out to the page card's edges without knowing which layout variant wraps it.\nexport const CONTENT_INSET_VAR = '--malachite-page-content-inset';\nexport const CONTENT_INSET = `var(${CONTENT_INSET_VAR}, 0px)`;\n"],"names":["CARD_RADIUS","CARD_CLASSES","DIVIDER_CLASSES","HEADER_HEIGHT","PAGE_INSET","PAGE_BACKGROUND","CARD_MIN_HEIGHT","CONTENT_MIN_HEIGHT","CONTENT_INSET_VAR","CONTENT_INSET"],"mappings":"AACO,MAAMA,IAAc,sCACdC,IACT,0HACSC,IAAkB,+DAIlBC,IAAgB,IAChBC,IAAa,GACbC,IAAkB,+DAClBC,IAAkB,sBAElBC,IAAqB,uBAIrBC,IAAoB,kCACpBC,IAAgB,OAAOD,CAAiB;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../src/components/PageLayout/constants.ts"],"sourcesContent":["import type { PageContentGap } from './pageColumn';\n\nexport const CONTENT_GAPS: Record<PageContentGap, number> = {\n small: 8,\n medium: 16,\n large: 24,\n xlarge: 40,\n};\n\n// Not a <Surface>: that is a 14px card and paints a box-shadow this page card must not have.\nexport const CARD_RADIUS = 'var(--malachite-radius-xxxl, 16px)';\nexport const CARD_CLASSES =\n 'w-full overflow-hidden bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]';\nexport const DIVIDER_CLASSES = 'border-b border-solid border-[var(--malachite-card-border)]';\n\n// 56, not Figma's 60: the app sidebar's divider sits at 9 + 56 and this header's must land\n// on the same line (8px page inset + 1px card border + 56). Move both together or neither.\nexport const HEADER_HEIGHT = 56;\nexport const PAGE_INSET = 8;\nexport const PAGE_BACKGROUND = 'var(--malachite-card-sunken-background, rgb(250, 250, 250))';\nexport const CARD_MIN_HEIGHT = `calc(100vh - ${PAGE_INSET * 2}px)`;\n// 136 is not derivable from the constants above: the extra 64px is app chrome above the card.\nexport const CONTENT_MIN_HEIGHT = 'calc(100vh - 136px)';\n\n// Set by RegularLayout to its own horizontal content padding, so a `bleed` child can pull\n// itself out to the page card's edges without knowing which layout variant wraps it.\nexport const CONTENT_INSET_VAR = '--malachite-page-content-inset';\nexport const CONTENT_INSET = `var(${CONTENT_INSET_VAR}, 0px)`;\n"],"names":["CONTENT_GAPS","CARD_RADIUS","CARD_CLASSES","DIVIDER_CLASSES","HEADER_HEIGHT","PAGE_INSET","PAGE_BACKGROUND","CARD_MIN_HEIGHT","CONTENT_MIN_HEIGHT","CONTENT_INSET_VAR","CONTENT_INSET"],"mappings":"AAEO,MAAMA,IAA+C;AAAA,EACxD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AACZ,GAGaC,IAAc,sCACdC,IACT,0HACSC,IAAkB,+DAIlBC,IAAgB,IAChBC,IAAa,GACbC,IAAkB,+DAClBC,IAAkB,gBAAgBF,IAAa,CAAC,OAEhDG,IAAqB,uBAIrBC,IAAoB,kCACpBC,IAAgB,OAAOD,CAAiB;"}
@@ -1,35 +1,29 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { CONTENT_INSET_VAR as s } from "./constants.js";
3
- const t = {
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { CONTENT_GAPS as e, CONTENT_INSET_VAR as i } from "./constants.js";
3
+ const s = {
4
4
  narrow: 520
5
- }, x = {
6
- small: 8,
7
- medium: 16,
8
- large: 24,
9
- xlarge: 40
10
- }, i = 40, N = 16, f = ({
11
- width: a,
12
- gap: l,
13
- standalone: o = !1,
14
- children: e,
15
- className: T = ""
16
- }) => /* @__PURE__ */ m(
5
+ }, f = 40, T = 16, p = ({
6
+ width: l,
7
+ gap: o,
8
+ standalone: N = !1,
9
+ children: t,
10
+ className: x = ""
11
+ }) => /* @__PURE__ */ a(
17
12
  "div",
18
13
  {
19
- className: `flex flex-col flex-1 w-full ${T}`,
14
+ className: `flex flex-col flex-1 w-full ${x}`,
20
15
  style: {
21
- maxWidth: t[a],
16
+ maxWidth: s[l],
22
17
  marginInline: "auto",
23
- gap: l ? x[l] : void 0,
24
- padding: o ? `${i}px ${N}px` : void 0,
25
- [s]: o ? `${N}px` : "0px"
18
+ gap: o ? e[o] : void 0,
19
+ padding: N ? `${f}px ${T}px` : void 0,
20
+ [i]: N ? `${T}px` : "0px"
26
21
  },
27
- children: e
22
+ children: t
28
23
  }
29
24
  );
30
25
  export {
31
- x as CONTENT_GAPS,
32
- f as PageColumn,
33
- f as default
26
+ p as PageColumn,
27
+ p as default
34
28
  };
35
29
  //# sourceMappingURL=pageColumn.js.map