@gntik-ai/blocks 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/index.d.ts +1501 -1232
  2. package/dist/index.js +1891 -840
  3. package/dist/index.js.map +1 -1
  4. package/package.json +6 -6
  5. package/src/ai/EvaluationScorecard/EvaluationScorecard.test.tsx +10 -0
  6. package/src/ai/EvaluationScorecard/EvaluationScorecard.tsx +2 -1
  7. package/src/ai/PromptEditor/PromptEditor.tsx +2 -2
  8. package/src/ai/PromptEditor/examples/controlled-variables.tsx +1 -1
  9. package/src/ai/TokenCostCard/TokenCostCard.test.tsx +10 -0
  10. package/src/ai/TokenCostCard/TokenCostCard.tsx +2 -1
  11. package/src/ai/TraceWaterfall/TraceWaterfall.tsx +2 -2
  12. package/src/auth/ForgotPasswordForm/ForgotPasswordForm.test.tsx +6 -0
  13. package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +4 -1
  14. package/src/auth/ForgotPasswordForm/block.meta.ts +1 -1
  15. package/src/auth/ForgotPasswordForm/examples/LargeFields.tsx +6 -0
  16. package/src/auth/MfaChallenge/MfaChallenge.test.tsx +9 -0
  17. package/src/auth/MfaChallenge/MfaChallenge.tsx +5 -2
  18. package/src/auth/MfaChallenge/block.meta.ts +1 -1
  19. package/src/auth/MfaChallenge/examples/LargeFields.tsx +6 -0
  20. package/src/auth/ResetPasswordForm/ResetPasswordForm.test.tsx +7 -0
  21. package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +5 -3
  22. package/src/auth/ResetPasswordForm/block.meta.ts +1 -1
  23. package/src/auth/ResetPasswordForm/examples/LargeFields.tsx +6 -0
  24. package/src/auth/SignInForm/SignInForm.test.tsx +7 -0
  25. package/src/auth/SignInForm/SignInForm.tsx +5 -1
  26. package/src/auth/SignInForm/block.meta.ts +1 -1
  27. package/src/auth/SignInForm/examples/LargeFields.tsx +6 -0
  28. package/src/auth/SignUpForm/SignUpForm.test.tsx +22 -0
  29. package/src/auth/SignUpForm/SignUpForm.tsx +7 -1
  30. package/src/auth/SignUpForm/block.meta.ts +1 -1
  31. package/src/auth/SignUpForm/examples/LargeFields.tsx +6 -0
  32. package/src/auth/__snapshots__/field-size.test.tsx.snap +11 -0
  33. package/src/auth/field-size.test.tsx +21 -0
  34. package/src/auth/large-examples.test.tsx +30 -0
  35. package/src/auth/shared.tsx +7 -2
  36. package/src/billing/PaymentMethodCard/PaymentMethodCard.tsx +1 -1
  37. package/src/billing/PlanCard/PlanCard.baseline.test.tsx +3 -2
  38. package/src/billing/PlanCard/__snapshots__/PlanCard.baseline.test.tsx.snap +2 -2
  39. package/src/billing/PlanDefinitionCard/examples/Compact.tsx +1 -4
  40. package/src/billing/PlanDefinitionCard/examples/Full.tsx +1 -4
  41. package/src/builders/CodePanel/CodePanel.test.tsx +11 -0
  42. package/src/builders/CodePanel/CodePanel.tsx +4 -3
  43. package/src/builders/FlowBuilder/FlowBuilder.tsx +4 -19
  44. package/src/builders/FlowBuilder/parts.tsx +4 -4
  45. package/src/builders/LogViewer/LogViewer.follow.test.tsx +29 -0
  46. package/src/builders/LogViewer/LogViewer.test.tsx +24 -0
  47. package/src/builders/LogViewer/LogViewer.tsx +67 -20
  48. package/src/builders/LogViewer/block.meta.ts +2 -1
  49. package/src/builders/LogViewer/examples/Spanish.tsx +2 -1
  50. package/src/data-display/ActivityFeed/ActivityFeed.tsx +1 -1
  51. package/src/data-display/ChartCard/ChartCard.tsx +2 -2
  52. package/src/data-display/ChartCard/examples/ContainerPanel.tsx +16 -0
  53. package/src/data-display/CommentThread/CommentThread.test.tsx +70 -1
  54. package/src/data-display/CommentThread/CommentThread.tsx +22 -6
  55. package/src/data-display/CommentThread/block.meta.ts +1 -1
  56. package/src/data-display/CommentThread/examples/RenderedBody.tsx +20 -0
  57. package/src/data-display/DescriptionListCard/DescriptionListCard.test.tsx +24 -1
  58. package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +14 -20
  59. package/src/data-display/DescriptionListCard/block.meta.ts +2 -1
  60. package/src/data-display/DescriptionListCard/examples/Spanish.tsx +2 -1
  61. package/src/data-display/KpiRow/KpiRow.doc.ts +14 -0
  62. package/src/data-display/KpiRow/KpiRow.test.tsx +11 -0
  63. package/src/data-display/KpiRow/KpiRow.tsx +72 -55
  64. package/src/data-display/KpiRow/examples/ContainerPanel.tsx +47 -0
  65. package/src/data-display/ResourceCardGrid/ResourceCardGrid.doc.ts +19 -0
  66. package/src/data-display/ResourceCardGrid/ResourceCardGrid.test.tsx +13 -0
  67. package/src/data-display/ResourceCardGrid/ResourceCardGrid.tsx +49 -40
  68. package/src/data-display/ResourceCardGrid/examples/ContainerPanel.tsx +18 -0
  69. package/src/data-display/StatusTimeline/StatusTimeline.tsx +1 -1
  70. package/src/feedback/EmptyStates/EmptyStates.test.tsx +42 -0
  71. package/src/feedback/EmptyStates/EmptyStates.tsx +5 -3
  72. package/src/feedback/EmptyStates/block.meta.ts +1 -1
  73. package/src/feedback/EmptyStates/examples/HiddenAction.tsx +13 -0
  74. package/src/feedback/ErrorPanel/ErrorPanel.tsx +13 -15
  75. package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.lifecycle.test.tsx +123 -0
  76. package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +128 -139
  77. package/src/forms/CreateApiKeyDialog/block.meta.ts +12 -1
  78. package/src/forms/FileUploadPanel/FileUploadPanel.controlled.test.tsx +482 -0
  79. package/src/forms/FileUploadPanel/FileUploadPanel.drag.test.tsx +60 -0
  80. package/src/forms/FileUploadPanel/FileUploadPanel.lifecycle.test.tsx +165 -0
  81. package/src/forms/FileUploadPanel/FileUploadPanel.tsx +267 -69
  82. package/src/forms/FileUploadPanel/block.meta.ts +5 -1
  83. package/src/forms/FileUploadPanel/examples/AutoCancel.tsx +38 -0
  84. package/src/forms/FileUploadPanel/examples/Labels.tsx +1 -1
  85. package/src/forms/FileUploadPanel/examples/ManualForm.tsx +36 -0
  86. package/src/forms/FileUploadPanel/fixtures.ts +31 -16
  87. package/src/forms/FileUploadPanel/simulate-upload.test.ts +24 -0
  88. package/src/forms/FormSection/FormSection.test.tsx +11 -0
  89. package/src/forms/FormSection/FormSection.tsx +20 -22
  90. package/src/forms/FormSection/block.meta.ts +1 -1
  91. package/src/forms/FormSection/examples/ContainerPanel.tsx +16 -0
  92. package/src/forms/InviteMembersDialog/InviteMembersDialog.lifecycle.test.tsx +80 -0
  93. package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +90 -109
  94. package/src/forms/InviteMembersDialog/block.meta.ts +1 -1
  95. package/src/forms/ValidationSummary/ValidationSummary.tsx +1 -4
  96. package/src/hooks/index.ts +2 -0
  97. package/src/hooks/useTableData.integration.test.tsx +89 -0
  98. package/src/hooks/useTableData.test.tsx +613 -0
  99. package/src/hooks/useTableData.ts +377 -0
  100. package/src/index.ts +1 -0
  101. package/src/marketing/ComparisonTable/ComparisonTable.tsx +2 -2
  102. package/src/marketing/FeatureGrid/FeatureGrid.tsx +1 -1
  103. package/src/marketing/LogoCloud/LogoCloud.doc.ts +13 -0
  104. package/src/marketing/LogoCloud/LogoCloud.test.tsx +155 -0
  105. package/src/marketing/LogoCloud/LogoCloud.tsx +89 -0
  106. package/src/marketing/LogoCloud/block.meta.ts +10 -0
  107. package/src/marketing/LogoCloud/examples/CaptionStart.tsx +6 -0
  108. package/src/marketing/LogoCloud/examples/Custom.tsx +25 -0
  109. package/src/marketing/LogoCloud/examples/Empty.tsx +6 -0
  110. package/src/marketing/LogoCloud/examples/Grid.tsx +13 -0
  111. package/src/marketing/LogoCloud/examples/Row.tsx +6 -0
  112. package/src/marketing/LogoCloud/examples/UnderHero.tsx +13 -0
  113. package/src/marketing/LogoCloud/fixtures.ts +23 -0
  114. package/src/marketing/PricingTable/PricingTable.tsx +1 -1
  115. package/src/marketing/SiteFooter/SiteFooter.doc.ts +18 -0
  116. package/src/marketing/SiteFooter/SiteFooter.test.tsx +236 -0
  117. package/src/marketing/SiteFooter/SiteFooter.tsx +160 -0
  118. package/src/marketing/SiteFooter/block.meta.ts +10 -0
  119. package/src/marketing/SiteFooter/examples/Centered.tsx +15 -0
  120. package/src/marketing/SiteFooter/examples/Columns.tsx +15 -0
  121. package/src/marketing/SiteFooter/examples/Custom.tsx +35 -0
  122. package/src/marketing/SiteFooter/examples/Empty.tsx +6 -0
  123. package/src/marketing/SiteFooter/examples/Simple.tsx +14 -0
  124. package/src/marketing/SiteFooter/fixtures.ts +36 -0
  125. package/src/marketing/index.ts +6 -0
  126. package/src/page-chrome/PageHeader/EditableTitle.test.tsx +26 -0
  127. package/src/page-chrome/PageHeader/PageHeader.tsx +4 -4
  128. package/src/page-chrome/PageHeader/block.meta.ts +1 -1
  129. package/src/page-chrome/PageHeader/examples/ContainerPanel.tsx +16 -0
  130. package/src/page-chrome/PageHeader/examples/EditableTitle.tsx +23 -0
  131. package/src/page-chrome/PageToolbar/PageToolbar.test.tsx +3 -1
  132. package/src/page-chrome/PageToolbar/PageToolbar.tsx +2 -2
  133. package/src/page-chrome/StickyActionBar/StickyActionBar.tsx +1 -1
  134. package/src/scheduling/AgendaList/AgendaList.tsx +39 -15
  135. package/src/scheduling/AgendaList/AgendaListZone.test.tsx +38 -0
  136. package/src/scheduling/AgendaList/block.meta.ts +1 -1
  137. package/src/scheduling/AgendaList/examples/TimeZone.tsx +28 -0
  138. package/src/scheduling/MonthCalendar/MonthCalendar.tsx +51 -40
  139. package/src/scheduling/MonthCalendar/MonthCalendarZone.test.tsx +44 -0
  140. package/src/scheduling/MonthCalendar/block.meta.ts +1 -1
  141. package/src/scheduling/MonthCalendar/examples/TimeZone.tsx +28 -0
  142. package/src/scheduling/WeekCalendar/WeekCalendar.tsx +37 -28
  143. package/src/scheduling/WeekCalendar/WeekCalendarZone.test.tsx +41 -0
  144. package/src/scheduling/WeekCalendar/block.meta.ts +1 -1
  145. package/src/scheduling/WeekCalendar/examples/TimeZone.tsx +28 -0
  146. package/src/scheduling/shared/CalendarHeader.tsx +26 -1
  147. package/src/scheduling/shared/dates.ts +102 -58
  148. package/src/scheduling/shared/events.ts +2 -2
  149. package/src/shell/AppSidebar/AppSidebar.context.test.tsx +175 -0
  150. package/src/shell/AppSidebar/AppSidebar.doc.ts +29 -0
  151. package/src/shell/AppSidebar/AppSidebar.tsx +97 -25
  152. package/src/shell/AppSidebar/block.meta.ts +1 -1
  153. package/src/shell/GlobalSearch/GlobalSearch.test.tsx +1 -0
  154. package/src/shell/GlobalSearch/GlobalSearch.tsx +1 -1
  155. package/src/tables/DataTable/DataTable.cursor-example.test.tsx +67 -0
  156. package/src/tables/DataTable/DataTable.export.test.tsx +511 -0
  157. package/src/tables/DataTable/DataTable.inline-edit-focus.test.tsx +32 -0
  158. package/src/tables/DataTable/DataTable.layout.test.tsx +6 -5
  159. package/src/tables/DataTable/DataTable.link-actions.test.tsx +18 -0
  160. package/src/tables/DataTable/DataTable.server-pagination.test.tsx +328 -14
  161. package/src/tables/DataTable/DataTable.test.tsx +85 -1
  162. package/src/tables/DataTable/DataTable.tsx +108 -14
  163. package/src/tables/DataTable/block.meta.ts +11 -1
  164. package/src/tables/DataTable/column-sizing.ts +2 -2
  165. package/src/tables/DataTable/data-table-props.ts +29 -1
  166. package/src/tables/DataTable/data-table-row.tsx +2 -2
  167. package/src/tables/DataTable/data-table-utils.ts +4 -0
  168. package/src/tables/DataTable/editable-cell.tsx +20 -79
  169. package/src/tables/DataTable/examples/csv-export.tsx +74 -0
  170. package/src/tables/DataTable/examples/cursor-load-more.tsx +87 -0
  171. package/src/tables/DataTable/examples/server-pagination.tsx +47 -40
  172. package/src/tables/DataTable/export-menu.tsx +58 -0
  173. package/src/tables/DataTable/header-cell.tsx +1 -1
  174. package/src/tables/DataTable/labels.ts +7 -0
  175. package/src/tables/DataTable/resize-handle.tsx +2 -2
  176. package/src/tables/DataTable/use-table-export.ts +117 -0
  177. package/src/tables/FilterBar/FilterBar.test.tsx +12 -0
  178. package/src/tables/FilterBar/FilterBar.tsx +5 -7
  179. package/src/team/ProfileHeader/ProfileHeader.picker.test.tsx +34 -0
  180. package/src/team/ProfileHeader/ProfileHeader.test.tsx +2 -2
  181. package/src/team/ProfileHeader/ProfileHeader.tsx +17 -24
  182. package/src/team/ProfileHeader/block.meta.ts +1 -1
  183. package/src/test/OptInDefaults.test.tsx +10 -1
  184. package/src/test/clipboard-fallback.test.tsx +49 -0
  185. package/src/test/copy-examples.test.tsx +29 -0
  186. package/src/test/copy-feedback.test.tsx +166 -0
  187. package/src/test/fixtures/opt-in-defaults.json +5 -5
  188. package/src/test/without-forced-colors.test.ts +44 -0
  189. package/src/test/without-forced-colors.ts +14 -0
@@ -1,6 +1,17 @@
1
1
  import { useEffect, useId, useMemo, useRef, useState, type ReactNode, type UIEvent } from 'react';
2
- import { Check, Copy, Eye, Search } from '@gntik-ai/icons';
3
- import { IconButton, Input, Switch, Toggle, ToggleGroup, cn, foldText, matchRanges, useI18n } from '@gntik-ai/ui';
2
+ import { Check, Copy, Eye, X } from '@gntik-ai/icons';
3
+ import {
4
+ IconButton,
5
+ SearchField,
6
+ Switch,
7
+ Toggle,
8
+ ToggleGroup,
9
+ cn,
10
+ copyToClipboard,
11
+ foldText,
12
+ matchRanges,
13
+ useI18n,
14
+ } from '@gntik-ai/ui';
4
15
  import { useWrappedLogRows } from './use-wrapped-log-rows';
5
16
  import { logLines as defaultLines, type LogLevel, type LogLine } from './fixtures';
6
17
 
@@ -27,6 +38,7 @@ export interface LogViewerLabels {
27
38
  inspect: (timestamp: string) => string;
28
39
  copy: (timestamp: string) => string;
29
40
  copied: string;
41
+ copyFailed?: string;
30
42
  }
31
43
 
32
44
  export interface LogViewerProps {
@@ -108,12 +120,15 @@ export function LogViewer({
108
120
  const title = titleProp ?? labels?.title ?? t('logViewer.title');
109
121
  const titleId = useId();
110
122
  const viewport = useRef<HTMLDivElement>(null);
123
+ const lastFollowTop = useRef<number | null>(null);
111
124
  const copyTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
112
125
  const [levels, setLevels] = useState<string[]>(defaultLevels);
113
126
  const [query, setQuery] = useState('');
114
127
  const [follow, setFollow] = useState(defaultFollow);
115
128
  const [scrollTop, setScrollTop] = useState(0);
116
- const [copied, setCopied] = useState<string | null>(null);
129
+ const [copyResult, setCopyResult] = useState<{ id: string; status: 'copied' | 'failed' } | null>(null);
130
+ const mounted = useRef(true);
131
+ const copyAttempt = useRef(0);
117
132
 
118
133
  const counts = useMemo(() => {
119
134
  const c: Record<LogLevel, number> = { debug: 0, info: 0, warn: 0, error: 0 };
@@ -150,10 +165,31 @@ export function LogViewer({
150
165
  const rows = visible.slice(start, end);
151
166
 
152
167
  useEffect(() => {
153
- if (follow && viewport.current) viewport.current.scrollTop = maxScroll;
154
- }, [follow, maxScroll]);
168
+ const node = viewport.current;
169
+ if (!follow || !node) {
170
+ lastFollowTop.current = null;
171
+ return;
172
+ }
173
+ // A measurement can commit before the browser delivers an upward scroll event.
174
+ // Preserve that scroll instead of overwriting it with a new follow position.
175
+ // Account for the browser clamping scrollTop when the content shrinks.
176
+ if (lastFollowTop.current !== null && node.scrollTop < Math.min(lastFollowTop.current, maxScroll) - rowHeight) {
177
+ setScrollTop(node.scrollTop);
178
+ setFollow(false);
179
+ return;
180
+ }
181
+ node.scrollTop = maxScroll;
182
+ lastFollowTop.current = node.scrollTop;
183
+ }, [follow, maxScroll, rowHeight]);
155
184
 
156
- useEffect(() => () => clearTimeout(copyTimer.current), []);
185
+ useEffect(() => {
186
+ mounted.current = true;
187
+ return () => {
188
+ mounted.current = false;
189
+ copyAttempt.current += 1;
190
+ clearTimeout(copyTimer.current);
191
+ };
192
+ }, []);
157
193
 
158
194
  const onScroll = (event: UIEvent<HTMLDivElement>) => {
159
195
  const top = event.currentTarget.scrollTop;
@@ -161,12 +197,22 @@ export function LogViewer({
161
197
  if (follow && top < maxScroll - rowHeight) setFollow(false);
162
198
  };
163
199
 
164
- const copy = (line: LogLine) => {
165
- void navigator.clipboard?.writeText(lineText(line)).catch(() => undefined);
166
- onCopyLine?.(line);
167
- setCopied(line.id);
200
+ const copy = async (line: LogLine) => {
168
201
  clearTimeout(copyTimer.current);
169
- copyTimer.current = setTimeout(() => setCopied(null), 1500);
202
+ const current = ++copyAttempt.current;
203
+ let status: 'copied' | 'failed' = 'failed';
204
+ try {
205
+ await copyToClipboard(lineText(line));
206
+ status = 'copied';
207
+ } catch {
208
+ // A denied write must not confirm a copied line.
209
+ }
210
+ if (!mounted.current) return;
211
+ if (current === copyAttempt.current) {
212
+ setCopyResult({ id: line.id, status });
213
+ copyTimer.current = setTimeout(() => setCopyResult(null), 1500);
214
+ }
215
+ if (status === 'copied') onCopyLine?.(line);
170
216
  };
171
217
 
172
218
  return (
@@ -199,12 +245,10 @@ export function LogViewer({
199
245
  </Toggle>
200
246
  ))}
201
247
  </ToggleGroup>
202
- <Input
248
+ <SearchField
203
249
  size="sm"
204
- type="search"
205
250
  aria-label={labels?.searchLabel ?? t('logViewer.searchLabel')}
206
251
  placeholder={labels?.searchPlaceholder ?? t('logViewer.searchPlaceholder')}
207
- leadingIcon={Search}
208
252
  value={query}
209
253
  onValueChange={(v) => setQuery(String(v))}
210
254
  className="w-full sm:w-48"
@@ -224,7 +268,7 @@ export function LogViewer({
224
268
  aria-live={announceLines && follow ? 'polite' : 'off'}
225
269
  tabIndex={0}
226
270
  onScroll={onScroll}
227
- className="relative overflow-auto bg-background font-mono text-[12px] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus-ring"
271
+ className="relative overflow-auto bg-background font-mono text-[12px] focus-ring-inset"
228
272
  style={{ height }}
229
273
  >
230
274
  {visible.length === 0 ? (
@@ -235,6 +279,7 @@ export function LogViewer({
235
279
  <div className="relative w-full" style={{ height: total }}>
236
280
  {rows.map((line, i) => {
237
281
  const lv = LEVEL_STYLE[line.level];
282
+ const status = copyResult?.id === line.id ? copyResult.status : 'idle';
238
283
  return (
239
284
  <div
240
285
  key={line.id}
@@ -290,15 +335,17 @@ export function LogViewer({
290
335
  )}
291
336
  <IconButton
292
337
  size="sm"
293
- icon={copied === line.id ? Check : Copy}
338
+ icon={status === 'failed' ? X : status === 'copied' ? Check : Copy}
294
339
  label={
295
- copied === line.id
296
- ? (labels?.copied ?? t('common.copied'))
297
- : (labels?.copy?.(line.timestamp) ?? t('logViewer.copy', { timestamp: line.timestamp }))
340
+ status === 'failed'
341
+ ? (labels?.copyFailed ?? t('common.copyFailed'))
342
+ : status === 'copied'
343
+ ? (labels?.copied ?? t('common.copied'))
344
+ : (labels?.copy?.(line.timestamp) ?? t('logViewer.copy', { timestamp: line.timestamp }))
298
345
  }
299
346
  onClick={(event) => {
300
347
  if (onSelectLine) event.stopPropagation();
301
- copy(line);
348
+ void copy(line);
302
349
  }}
303
350
  className="size-6 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
304
351
  />
@@ -6,7 +6,7 @@ export const meta: BlockMeta = {
6
6
  family: 'builders',
7
7
  status: 'beta',
8
8
  description:
9
- 'Windowed log stream (role="log"): level filter, search with highlighted matches, follow-tail and per-line copy. Renders only the visible rows. Optional wrap (default false) shows full messages in measured, variable-height rows; rowHeight estimates unmeasured rows. Optional labels?: Partial<LogViewerLabels> overrides each built-in label, including per-level chip and filter names through labels.levels. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Copied log text and imported fixtures stay unchanged. See the Catalog labels and Full messages and level names live previews.',
9
+ 'Windowed log stream (role="log"): level filter, search with highlighted matches, follow-tail and per-line copy. Renders only the visible rows. Optional wrap (default false) shows full messages in measured, variable-height rows; rowHeight estimates unmeasured rows. Optional labels?: Partial<LogViewerLabels> overrides each built-in label, including per-level chip and filter names through labels.levels. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Copied log text and imported fixtures stay unchanged. See the Catalog labels and Full messages and level names live previews. Copy actions await the clipboard write; denied or unavailable access shows common.copyFailed (overridden by labels.copyFailed), and only a successful write calls onCopyLine. Both results reset after 1500ms. See the Catalog labels live preview.',
10
10
  labels: [
11
11
  { key: 'title', type: 'string', state: 'Visible heading and log region name; title prop wins' },
12
12
  { key: 'levelFilter', type: 'string', state: 'Level filter group name' },
@@ -22,6 +22,7 @@ export const meta: BlockMeta = {
22
22
  { key: 'empty', type: 'string', state: 'No matching lines' },
23
23
  { key: 'inspect', type: '(timestamp: string) => string', state: 'Inspect button name when onSelectLine exists' },
24
24
  { key: 'copy', type: '(timestamp: string) => string', state: 'Copy button before copying' },
25
+ { key: 'copyFailed', type: 'string', state: 'Copy button after a failed write, only on the affected line' },
25
26
  { key: 'copied', type: 'string', state: 'Copy button after copying' },
26
27
  ] satisfies Array<{ key: keyof LogViewerLabels; type: string; state: string }>,
27
28
  uses: ['ToggleGroup', 'Toggle', 'Input', 'Switch', 'IconButton'],
@@ -1,4 +1,4 @@
1
- import { I18nProvider, Stack } from '@gntik-ai/ui';
1
+ import { I18nProvider, Stack, en } from '@gntik-ai/ui';
2
2
  import { LogViewer } from '../LogViewer';
3
3
  import { makeLogLines } from '../fixtures';
4
4
  const lines = makeLogLines(3);
@@ -12,6 +12,7 @@ export default function Spanish() {
12
12
  height={100}
13
13
  onSelectLine={() => {}}
14
14
  labels={{
15
+ copyFailed: en['common.copyFailed'],
15
16
  title: 'Application logs',
16
17
  levelFilter: 'Severity',
17
18
  searchLabel: 'Find log messages',
@@ -79,7 +79,7 @@ export function ActivityFeed({
79
79
  <div key={group.key}>
80
80
  <GroupTag
81
81
  id={headingId}
82
- className="mb-3 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground uppercase"
82
+ className="mb-3 font-mono text-[10.5px] font-medium tracking-[0.12em] text-muted-foreground label-case"
83
83
  >
84
84
  {group.label}
85
85
  </GroupTag>
@@ -160,7 +160,7 @@ export function ChartCard<T extends object = CostPoint>({
160
160
  const { locale } = useI18n();
161
161
  return (
162
162
  <ChartLocaleProvider locale={locale}>
163
- <Card className={className}>
163
+ <Card className={cn('@container w-full min-w-0', className)}>
164
164
  <CardHeader className="pb-2">
165
165
  <CardTitle as={titleAs}>{title}</CardTitle>
166
166
  {description && <CardDescription>{description}</CardDescription>}
@@ -202,7 +202,7 @@ export function ChartCard<T extends object = CostPoint>({
202
202
  {active.summary.delta && <TrendDelta {...active.summary.delta} />}
203
203
  </p>
204
204
  )}
205
- <div className={cn('px-3 pb-4 pt-3 sm:px-4', !footer && 'pb-5')}>
205
+ <div className={cn('px-3 pb-4 pt-3 @sm:px-4', !footer && 'pb-5')}>
206
206
  {kind === 'heatmap' ? (
207
207
  <Heatmap
208
208
  data={data}
@@ -0,0 +1,16 @@
1
+ import { InspectorLayout } from '@gntik-ai/ui';
2
+ import { ChartCard } from '../ChartCard';
3
+
4
+ export default function ContainerPanel() {
5
+ return (
6
+ <div data-container-example className="h-[640px] overflow-hidden rounded-lg border border-border">
7
+ <InspectorLayout panelTitle="Properties" dockedQuery="(min-width: 0px)" panel={<ChartCard />}>
8
+ <div className="grid gap-6 overflow-auto p-4">
9
+ <div data-container-slot="default" className="flex min-w-0">
10
+ <ChartCard />
11
+ </div>
12
+ </div>
13
+ </InspectorLayout>
14
+ </div>
15
+ );
16
+ }
@@ -1,7 +1,15 @@
1
1
  import { render, screen } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
+ import { I18nProvider } from '@gntik-ai/ui';
3
4
  import { expectNoAxeViolations } from '../../test/a11y';
4
- import { CommentThread } from './CommentThread';
5
+ import { CommentThread, type ThreadComment } from './CommentThread';
6
+
7
+ const comment: ThreadComment = {
8
+ id: 'review',
9
+ author: { name: 'Reviewer' },
10
+ body: '**retry**\n<img src=x onerror=alert(1)>',
11
+ at: '2026-10-01T12:00:00Z',
12
+ };
5
13
 
6
14
  describe('CommentThread', () => {
7
15
  it('renders the comments and an empty composer', async () => {
@@ -26,4 +34,65 @@ describe('CommentThread', () => {
26
34
  expect(onSubmit).toHaveBeenLastCalledWith('Follow-up');
27
35
  expect(screen.getByRole('list', { name: '5 comments' })).toBeInTheDocument();
28
36
  });
37
+
38
+ it('keeps plain bodies as text in a paragraph with line breaks', () => {
39
+ const { container } = render(<CommentThread comments={[comment]} />);
40
+ const body = screen.getByText(/\*\*retry\*\*/);
41
+ expect(body.tagName).toBe('P');
42
+ expect(body).toHaveClass('whitespace-pre-line');
43
+ expect(body.textContent).toBe('**retry**\n<img src=x onerror=alert(1)>');
44
+ expect(container.querySelector('img')).toBeNull();
45
+ });
46
+
47
+ it('renders full supplied and appended comments through a block container', async () => {
48
+ const user = userEvent.setup();
49
+ const currentUser = { name: 'Writer' };
50
+ const renderBody = vi.fn((c: ThreadComment) => <blockquote>{c.body}</blockquote>);
51
+ render(<CommentThread comments={[comment]} currentUser={currentUser} renderBody={renderBody} />);
52
+ expect(renderBody).toHaveBeenCalledExactlyOnceWith(comment);
53
+ const body = screen.getByText(/\*\*retry\*\*/);
54
+ expect(body.parentElement?.tagName).toBe('DIV');
55
+ expect(body.closest('p')).toBeNull();
56
+ await user.type(screen.getByRole('textbox'), 'See **docs**');
57
+ renderBody.mockClear();
58
+ await user.keyboard('{Control>}{Enter}{/Control}');
59
+ expect(renderBody).toHaveBeenCalledTimes(2);
60
+ expect(renderBody).toHaveBeenCalledWith(comment);
61
+ expect(renderBody).toHaveBeenCalledWith({
62
+ id: 'local-1',
63
+ author: currentUser,
64
+ body: 'See **docs**',
65
+ at: expect.any(Number),
66
+ });
67
+ const posted = screen.getByText('See **docs**');
68
+ expect(posted.parentElement?.tagName).toBe('DIV');
69
+ expect(posted.closest('p')).toBeNull();
70
+ });
71
+
72
+ it.each([
73
+ ['en', false, 'Plain text · ⌘/Ctrl + Enter to post'],
74
+ ['en', true, 'Markdown supported · ⌘/Ctrl + Enter to post'],
75
+ ['es', false, 'Texto sin formato · ⌘/Ctrl + Intro para publicar'],
76
+ ['es', true, 'Admite Markdown · ⌘/Ctrl + Intro para publicar'],
77
+ ])('describes the composer in %s with renderBody=%s', (locale, rich, hint) => {
78
+ render(
79
+ <I18nProvider locale={locale}>
80
+ <CommentThread renderBody={rich ? (c) => <blockquote>{c.body}</blockquote> : undefined} />
81
+ </I18nProvider>,
82
+ );
83
+ expect(screen.getByText(hint)).toBeInTheDocument();
84
+ expect(screen.getByRole('textbox')).toHaveAccessibleDescription(hint);
85
+ });
86
+
87
+ it.each([false, true])('uses the custom hint with renderBody=%s', (rich) => {
88
+ render(
89
+ <CommentThread
90
+ renderBody={rich ? (c) => <blockquote>{c.body}</blockquote> : undefined}
91
+ composerHint={<em>Notes are visible to the workspace</em>}
92
+ />,
93
+ );
94
+ expect(screen.getByText('Notes are visible to the workspace').tagName).toBe('EM');
95
+ expect(screen.getByRole('textbox')).toHaveAccessibleDescription('Notes are visible to the workspace');
96
+ expect(screen.queryByText(/⌘\/Ctrl/)).not.toBeInTheDocument();
97
+ });
29
98
  });
@@ -1,5 +1,5 @@
1
1
  import { Avatar, Button, cn, Textarea, Timestamp, type DateInput, useI18n } from '@gntik-ai/ui';
2
- import { useId, useState, type FormEvent, type KeyboardEvent } from 'react';
2
+ import { useId, useState, type FormEvent, type KeyboardEvent, type ReactNode } from 'react';
3
3
  import { COMMENT_AUTHOR, REVIEW_COMMENTS } from './fixtures';
4
4
 
5
5
  export interface CommentAuthor {
@@ -10,13 +10,19 @@ export interface CommentAuthor {
10
10
  export interface ThreadComment {
11
11
  id: string;
12
12
  author: CommentAuthor;
13
- /** Plain text (no markdown); line breaks are kept. */
13
+ /** Plain text by default, with line breaks kept; pass renderBody to render Markdown. */
14
14
  body: string;
15
15
  at: DateInput;
16
16
  }
17
17
 
18
18
  export interface CommentThreadProps {
19
19
  comments?: readonly ThreadComment[];
20
+ /**
21
+ * Render the raw comment in a block container. Bodies are untrusted: use a safe
22
+ * renderer such as Markdown from @gntik-ai/chat (without allowHtml), never raw HTML.
23
+ * Defaults to plain text with line breaks kept.
24
+ */
25
+ renderBody?: (comment: ThreadComment) => ReactNode;
20
26
  /** Author of new comments (the signed-in user). */
21
27
  currentUser?: CommentAuthor;
22
28
  /** Called with the trimmed text when a comment is posted. */
@@ -27,18 +33,22 @@ export interface CommentThreadProps {
27
33
  label?: string;
28
34
  placeholder?: string;
29
35
  submitLabel?: string;
36
+ /** Overrides the plain-text or Markdown hint; stays the composer's accessible description. */
37
+ composerHint?: ReactNode;
30
38
  className?: string;
31
39
  }
32
40
 
33
- /** Comment thread: avatar, author, plain-text body and Timestamp, with a reply composer (⌘/Ctrl+Enter posts). */
41
+ /** Comment thread: avatar, author, plain text (or Markdown via renderBody) and Timestamp, with a reply composer (⌘/Ctrl+Enter posts). */
34
42
  export function CommentThread({
35
43
  comments = REVIEW_COMMENTS,
44
+ renderBody,
36
45
  currentUser = COMMENT_AUTHOR,
37
46
  onSubmit,
38
47
  appendOnSubmit = true,
39
48
  label: labelProp,
40
49
  placeholder: placeholderProp,
41
50
  submitLabel: submitLabelProp,
51
+ composerHint,
42
52
  className,
43
53
  }: CommentThreadProps) {
44
54
  const { t } = useI18n();
@@ -80,13 +90,19 @@ export function CommentThread({
80
90
  {i < all.length - 1 && (
81
91
  <span aria-hidden className="absolute top-9 -bottom-5 start-[15.5px] w-px bg-border" />
82
92
  )}
83
- <Avatar name={comment.author.name} src={comment.author.src} size="sm" className="relative z-10" />
93
+ <Avatar name={comment.author.name} src={comment.author.src} size="sm" className="relative z-raised" />
84
94
  <article className="min-w-0 flex-1 rounded-lg border border-border bg-background/50 p-3">
85
95
  <header className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5">
86
96
  <span className="text-[12.5px] font-semibold text-foreground">{comment.author.name}</span>
87
97
  <Timestamp value={comment.at} className="font-mono text-[11px]" />
88
98
  </header>
89
- <p className="mt-1 text-[13px] leading-relaxed whitespace-pre-line text-foreground/85">{comment.body}</p>
99
+ {renderBody ? (
100
+ <div className="mt-1 text-[13px] leading-relaxed text-foreground/85">{renderBody(comment)}</div>
101
+ ) : (
102
+ <p className="mt-1 text-[13px] leading-relaxed whitespace-pre-line text-foreground/85">
103
+ {comment.body}
104
+ </p>
105
+ )}
90
106
  </article>
91
107
  </li>
92
108
  ))}
@@ -107,7 +123,7 @@ export function CommentThread({
107
123
  />
108
124
  <div className="flex items-center justify-between gap-2 border-t border-border/60 px-3 py-2">
109
125
  <span id={hintId} className="text-[11.5px] text-muted-foreground">
110
- Plain text · ⌘/Ctrl + Enter to post
126
+ {composerHint ?? t(renderBody ? 'comments.hintMarkdown' : 'comments.hintPlain')}
111
127
  </span>
112
128
  <Button type="submit" size="sm" disabled={!text}>
113
129
  {submitLabel}
@@ -5,6 +5,6 @@ export const meta: BlockMeta = {
5
5
  family: 'data-display',
6
6
  status: 'beta',
7
7
  description:
8
- 'Plain-text comments with avatar, author and Timestamp, plus a reply composer (Textarea + Button, ⌘/Ctrl+Enter posts).',
8
+ 'Plain-text comments by default, with optional renderBody for safe Markdown, avatar, author and Timestamp, plus a reply composer (Textarea + Button, ⌘/Ctrl+Enter posts). renderBody receives the raw comment; use a safe renderer such as @gntik-ai/chat Markdown (without allowHtml). Bodies are untrusted: never inject raw HTML. composerHint overrides the catalog hint and remains the textarea’s accessible description.',
9
9
  uses: ['Avatar', 'Timestamp', 'Textarea', 'Button'],
10
10
  };
@@ -0,0 +1,20 @@
1
+ import { useI18n } from '@gntik-ai/ui';
2
+ import { CommentThread } from '../CommentThread';
3
+
4
+ /**
5
+ * /preview.html?kind=block&id=comment-thread--rendered-body
6
+ * A text-only stub demonstrates renderBody and a ReactNode composerHint override.
7
+ * For safe Markdown, see the scorecard template's @gntik-ai/chat Markdown renderer
8
+ * (without allowHtml). Treat bodies as untrusted; never inject raw HTML.
9
+ */
10
+ export default function RenderedBody() {
11
+ const { t } = useI18n();
12
+ return (
13
+ <CommentThread
14
+ renderBody={(comment) => (
15
+ <blockquote className="border-s-2 border-border ps-3 whitespace-pre-line">{comment.body}</blockquote>
16
+ )}
17
+ composerHint={<span>{t('comments.hintPlain')}</span>}
18
+ />
19
+ );
20
+ }
@@ -1,9 +1,32 @@
1
- import { render, screen } from '@testing-library/react';
1
+ import { fireEvent, render, screen } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import { expectNoAxeViolations } from '../../test/a11y';
4
4
  import { DescriptionListCard } from './DescriptionListCard';
5
5
 
6
6
  describe('DescriptionListCard', () => {
7
+ it.each(['rejected', 'missing'] as const)(
8
+ 'reports a %s clipboard write as failed without calling onCopy',
9
+ async (failure) => {
10
+ userEvent.setup();
11
+ const clipboard = navigator.clipboard;
12
+ if (failure === 'missing')
13
+ Object.defineProperty(navigator, 'clipboard', { configurable: true, value: undefined });
14
+ else vi.spyOn(navigator.clipboard, 'writeText').mockRejectedValue(new DOMException('Denied', 'NotAllowedError'));
15
+ const onCopy = vi.fn();
16
+ try {
17
+ const { container } = render(<DescriptionListCard onCopy={onCopy} />);
18
+ fireEvent.click(screen.getByRole('button', { name: 'Copy Deployment ID' }));
19
+ const button = await screen.findByRole('button', { name: 'Copy failed' });
20
+ expect(container.querySelector('[aria-live="polite"]')).toHaveTextContent('Copy failed');
21
+ expect(screen.queryByRole('button', { name: 'Deployment ID copied' })).toBeNull();
22
+ expect(button.querySelector('.lucide-check')).toBeNull();
23
+ expect(onCopy).not.toHaveBeenCalled();
24
+ } finally {
25
+ Object.defineProperty(navigator, 'clipboard', { configurable: true, value: clipboard });
26
+ vi.restoreAllMocks();
27
+ }
28
+ },
29
+ );
7
30
  it('renders labels and values', async () => {
8
31
  const { container } = render(<DescriptionListCard onEdit={() => {}} />);
9
32
  expect(screen.getByText('Deployment ID')).toBeInTheDocument();
@@ -1,4 +1,4 @@
1
- import { Check, Copy, Pencil } from '@gntik-ai/icons';
1
+ import { Check, Copy, Pencil, X } from '@gntik-ai/icons';
2
2
  import {
3
3
  Button,
4
4
  Card,
@@ -10,8 +10,9 @@ import {
10
10
  IconButton,
11
11
  StatusTag,
12
12
  useI18n,
13
+ useClipboard,
13
14
  } from '@gntik-ai/ui';
14
- import { useEffect, useRef, useState, type ReactNode } from 'react';
15
+ import { type ReactNode } from 'react';
15
16
  import { DEPLOYMENT_DETAILS } from './fixtures';
16
17
 
17
18
  export interface DescriptionItem {
@@ -37,6 +38,7 @@ export interface DescriptionListCardLabels {
37
38
  copy: (label: string) => string;
38
39
  copied: (label: string) => string;
39
40
  copiedToClipboard: string;
41
+ copyFailed?: string;
40
42
  }
41
43
 
42
44
  export interface DescriptionListCardProps {
@@ -69,27 +71,19 @@ function CopyButton({
69
71
  labels?: Partial<DescriptionListCardLabels>;
70
72
  }) {
71
73
  const { t } = useI18n();
72
- const [copied, setCopied] = useState(false);
73
- const timer = useRef<number | undefined>(undefined);
74
- useEffect(() => () => window.clearTimeout(timer.current), []);
75
- const copy = async () => {
76
- const text = item.copyValue ?? item.value ?? '';
77
- try {
78
- await navigator.clipboard?.writeText(text);
79
- } catch {}
80
- setCopied(true);
81
- onCopy?.(item);
82
- window.clearTimeout(timer.current);
83
- timer.current = window.setTimeout(() => setCopied(false), 1500);
84
- };
74
+ const { status, copied, copy: copyText } = useClipboard({ timeout: 1500, onCopy: () => onCopy?.(item) });
75
+ const failedText = labels?.copyFailed ?? t('common.copyFailed');
76
+ const copy = () => copyText(item.copyValue ?? item.value ?? '');
85
77
  return (
86
78
  <>
87
79
  <IconButton
88
- icon={copied ? Check : Copy}
80
+ icon={status === 'failed' ? X : copied ? Check : Copy}
89
81
  label={
90
- copied
91
- ? (labels?.copied?.(item.label) ?? t('descriptionList.copied', { label: item.label }))
92
- : (labels?.copy?.(item.label) ?? t('descriptionList.copy', { label: item.label }))
82
+ status === 'failed'
83
+ ? failedText
84
+ : copied
85
+ ? (labels?.copied?.(item.label) ?? t('descriptionList.copied', { label: item.label }))
86
+ : (labels?.copy?.(item.label) ?? t('descriptionList.copy', { label: item.label }))
93
87
  }
94
88
  size="sm"
95
89
  variant="ghost"
@@ -97,7 +91,7 @@ function CopyButton({
97
91
  onClick={copy}
98
92
  />
99
93
  <span className="sr-only" aria-live="polite">
100
- {copied ? (labels?.copiedToClipboard ?? t('common.copiedToClipboard')) : ''}
94
+ {status === 'failed' ? failedText : copied ? (labels?.copiedToClipboard ?? t('common.copiedToClipboard')) : ''}
101
95
  </span>
102
96
  </>
103
97
  );
@@ -6,13 +6,14 @@ export const meta: BlockMeta = {
6
6
  family: 'data-display',
7
7
  status: 'beta',
8
8
  description:
9
- 'Key–value detail card with mono, status and rich values, copy-to-clipboard buttons and an Edit action. Optional labels?: Partial<DescriptionListCardLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview. wrap?: boolean (default false) shows full values and breaks long unbroken strings. columns?: 1 | 2 | 3 (default 1) stacks terms above values in two or three columns from sm, with one column below sm; items fill contiguous top-to-bottom chunks of ceil(item count / columns), and dividers stay within each column. Defaults preserve the original single-column rows. See the Spanish live preview for wrapping and both column layouts.',
9
+ 'Key–value detail card with mono, status and rich values, copy-to-clipboard buttons and an Edit action. Optional labels?: Partial<DescriptionListCardLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English. Imported fixtures and machine data stay unchanged. See the Catalog labels live preview. wrap?: boolean (default false) shows full values and breaks long unbroken strings. columns?: 1 | 2 | 3 (default 1) stacks terms above values in two or three columns from sm, with one column below sm; items fill contiguous top-to-bottom chunks of ceil(item count / columns), and dividers stay within each column. Defaults preserve the original single-column rows. See the Spanish live preview for wrapping and both column layouts. Copy actions await the clipboard write; denied or unavailable access shows common.copyFailed (overridden by labels.copyFailed), and only a successful write calls onCopy. Both results reset after 1500ms. See the Catalog labels live preview.',
10
10
  labels: [
11
11
  { key: 'title', type: 'string', state: 'Card heading; title prop wins' },
12
12
  { key: 'description', type: 'string', state: 'Card description; description prop wins' },
13
13
  { key: 'edit', type: 'string', state: 'Edit button; editLabel prop wins' },
14
14
  { key: 'copy', type: '(label: string) => string', state: 'Copy button name; original item label' },
15
15
  { key: 'copied', type: '(label: string) => string', state: 'Copy button name after copying; original item label' },
16
+ { key: 'copyFailed', type: 'string', state: 'Copy button name and polite announcement after a failed write' },
16
17
  { key: 'copiedToClipboard', type: 'string', state: 'Polite copy announcement' },
17
18
  ] satisfies Array<{ key: keyof DescriptionListCardLabels; type: string; state: string }>,
18
19
  uses: ['Card', 'Button', 'IconButton', 'StatusTag'],
@@ -1,4 +1,4 @@
1
- import { I18nProvider, Stack } from '@gntik-ai/ui';
1
+ import { I18nProvider, Stack, en } from '@gntik-ai/ui';
2
2
  import { DescriptionListCard } from '../DescriptionListCard';
3
3
  export default function Spanish() {
4
4
  return (
@@ -8,6 +8,7 @@ export default function Spanish() {
8
8
  <DescriptionListCard
9
9
  onEdit={() => {}}
10
10
  labels={{
11
+ copyFailed: en['common.copyFailed'],
11
12
  title: 'Resource details',
12
13
  description: 'Current settings',
13
14
  edit: 'Change',
@@ -0,0 +1,14 @@
1
+ import type { ComponentDoc } from '@gntik-ai/ui';
2
+ import { meta } from './block.meta';
3
+
4
+ export const doc: ComponentDoc = {
5
+ name: 'KpiRow',
6
+ group: 'Display',
7
+ status: 'beta',
8
+ description: meta.description,
9
+ primitive: 'Named description list with optional sparklines',
10
+ pattern:
11
+ 'Metrics reflow by container width. className styles the list; containerClassName styles its wrapper for placement and visibility.',
12
+ keyboard: [],
13
+ tokens: ['card', 'border', 'foreground', 'muted-foreground'],
14
+ };
@@ -3,6 +3,17 @@ import { expectNoAxeViolations } from '../../test/a11y';
3
3
  import { KpiRow } from './KpiRow';
4
4
 
5
5
  describe('KpiRow', () => {
6
+ it('keeps the named description list and list styling inside a separately styled wrapper', () => {
7
+ const { container } = render(<KpiRow label="Usage" className="gap-6" containerClassName="col-span-2" />);
8
+ const list = screen.getByLabelText('Usage');
9
+ expect(list.tagName).toBe('DL');
10
+ expect(list).toHaveClass('gap-6');
11
+ expect(list).not.toHaveClass('col-span-2');
12
+ expect(list.parentElement).toBe(container.firstElementChild);
13
+ expect(list.parentElement).toHaveClass('col-span-2');
14
+ expect(list.parentElement).not.toHaveClass('gap-6');
15
+ });
16
+
6
17
  it('renders the default KPIs as a description list with sparklines', async () => {
7
18
  const { container } = render(<KpiRow />);
8
19
  expect(screen.getByText('Active projects')).toBeInTheDocument();