@gntik-ai/blocks 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +301 -40
- package/dist/index.js +1441 -297
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.labels.test.tsx +179 -0
- package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +59 -24
- package/src/auth/ForgotPasswordForm/block.meta.ts +22 -1
- package/src/auth/ForgotPasswordForm/examples/Labels.tsx +29 -0
- package/src/auth/MfaChallenge/MfaChallenge.labels.test.tsx +139 -0
- package/src/auth/MfaChallenge/MfaChallenge.tsx +69 -23
- package/src/auth/MfaChallenge/block.meta.ts +29 -1
- package/src/auth/MfaChallenge/examples/Labels.tsx +28 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.labels.test.tsx +104 -0
- package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +42 -15
- package/src/auth/ResetPasswordForm/block.meta.ts +17 -1
- package/src/auth/ResetPasswordForm/examples/Labels.tsx +28 -0
- package/src/auth/SignInForm/SignInForm.labels.test.tsx +137 -0
- package/src/auth/SignInForm/SignInForm.tsx +43 -16
- package/src/auth/SignInForm/block.meta.ts +22 -1
- package/src/auth/SignInForm/examples/Labels.tsx +29 -0
- package/src/auth/SignUpForm/SignUpForm.labels.test.tsx +217 -0
- package/src/auth/SignUpForm/SignUpForm.tsx +65 -26
- package/src/auth/SignUpForm/block.meta.ts +27 -1
- package/src/auth/SignUpForm/examples/Labels.tsx +29 -0
- package/src/auth/SsoButtons/SsoButtons.labels.test.tsx +30 -0
- package/src/auth/SsoButtons/SsoButtons.tsx +10 -2
- package/src/auth/SsoButtons/block.meta.ts +8 -1
- package/src/auth/SsoButtons/examples/Labels.tsx +24 -0
- package/src/auth/shared.i18n.test.tsx +71 -0
- package/src/auth/shared.tsx +48 -11
- package/src/builders/LogViewer/LogViewer.levels.test.tsx +49 -0
- package/src/builders/LogViewer/LogViewer.tsx +29 -8
- package/src/builders/LogViewer/LogViewer.wrap.test.tsx +181 -0
- package/src/builders/LogViewer/block.meta.ts +6 -1
- package/src/builders/LogViewer/examples/Wrap.tsx +62 -0
- package/src/builders/LogViewer/use-wrapped-log-rows.ts +42 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.options.test.tsx +64 -0
- package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +38 -17
- package/src/data-display/DescriptionListCard/block.meta.ts +1 -1
- package/src/data-display/DescriptionListCard/examples/Spanish.tsx +7 -0
- package/src/feedback/EmptyStates/EmptyStates.tsx +32 -14
- package/src/feedback/EmptyStates/NoAccessEmpty.options.test.tsx +38 -0
- package/src/feedback/EmptyStates/block.meta.ts +1 -1
- package/src/feedback/EmptyStates/examples/Spanish.tsx +7 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.labels.test.tsx +115 -0
- package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +63 -21
- package/src/forms/CreateApiKeyDialog/block.meta.ts +22 -1
- package/src/forms/CreateApiKeyDialog/examples/Labels.tsx +29 -0
- package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.labels.test.tsx +165 -0
- package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.tsx +31 -8
- package/src/forms/CredentialDisclosureDialog/SecretCopy.tsx +16 -8
- package/src/forms/CredentialDisclosureDialog/block.meta.ts +19 -1
- package/src/forms/CredentialDisclosureDialog/examples/Labels.tsx +38 -0
- package/src/forms/DangerZone/ConfirmDestructiveDialog.tsx +17 -3
- package/src/forms/DangerZone/DangerZone.labels.test.tsx +87 -0
- package/src/forms/DangerZone/DangerZone.tsx +20 -5
- package/src/forms/DangerZone/block.meta.ts +10 -1
- package/src/forms/DangerZone/examples/Labels.tsx +29 -0
- package/src/forms/DateRangeFilter/DateRangeFilter.labels.test.tsx +52 -0
- package/src/forms/DateRangeFilter/DateRangeFilter.tsx +11 -3
- package/src/forms/DateRangeFilter/block.meta.ts +8 -1
- package/src/forms/DateRangeFilter/examples/Labels.tsx +28 -0
- package/src/forms/DialogWizard/DialogWizard.labels.test.tsx +37 -0
- package/src/forms/DialogWizard/DialogWizard.tsx +13 -2
- package/src/forms/DialogWizard/block.meta.ts +7 -1
- package/src/forms/DialogWizard/examples/Labels.tsx +39 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.labels.test.tsx +126 -0
- package/src/forms/FileUploadPanel/FileUploadPanel.tsx +81 -18
- package/src/forms/FileUploadPanel/block.meta.ts +22 -1
- package/src/forms/FileUploadPanel/examples/Labels.tsx +29 -0
- package/src/forms/FormSection/FormSection.labels.test.tsx +37 -0
- package/src/forms/FormSection/FormSection.tsx +14 -3
- package/src/forms/FormSection/block.meta.ts +7 -1
- package/src/forms/FormSection/examples/Labels.tsx +27 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.labels.test.tsx +87 -0
- package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +51 -16
- package/src/forms/InviteMembersDialog/block.meta.ts +20 -1
- package/src/forms/InviteMembersDialog/examples/Labels.tsx +28 -0
- package/src/forms/SettingsRow/SettingsRow.labels.test.tsx +33 -0
- package/src/forms/SettingsRow/SettingsRow.tsx +14 -3
- package/src/forms/SettingsRow/block.meta.ts +7 -1
- package/src/forms/SettingsRow/examples/Labels.tsx +27 -0
- package/src/forms/ValidationSummary/ValidationSummary.labels.test.tsx +47 -0
- package/src/forms/ValidationSummary/ValidationSummary.tsx +9 -3
- package/src/forms/ValidationSummary/block.meta.ts +6 -1
- package/src/forms/ValidationSummary/examples/Labels.tsx +24 -0
- package/src/forms/index.ts +5 -1
- package/src/forms/translated-content.tsx +12 -0
- package/src/page-chrome/PageHeader/PageHeader.options.test.tsx +34 -0
- package/src/page-chrome/PageHeader/PageHeader.tsx +7 -1
- package/src/page-chrome/PageHeader/block.meta.ts +1 -1
- package/src/page-chrome/PageHeader/examples/Spanish.tsx +11 -0
- package/src/tables/DataTable/DataTable.cross-page-selection.test.tsx +322 -0
- package/src/tables/DataTable/DataTable.labels.test.tsx +74 -0
- package/src/tables/DataTable/DataTable.server-pagination.test.tsx +1 -1
- package/src/tables/DataTable/DataTable.single-select.test.tsx +47 -7
- package/src/tables/DataTable/DataTable.test.tsx +55 -0
- package/src/tables/DataTable/DataTable.tsx +134 -67
- package/src/tables/DataTable/block.meta.ts +21 -3
- package/src/tables/DataTable/data-table-props.ts +14 -5
- package/src/tables/DataTable/data-table-row.tsx +7 -3
- package/src/tables/DataTable/data-table-utils.ts +2 -0
- package/src/tables/DataTable/examples/client-selection.tsx +33 -0
- package/src/tables/DataTable/examples/paginated-single-selection.tsx +46 -0
- package/src/tables/DataTable/examples/server-pagination.tsx +55 -15
- package/src/tables/DataTable/labels.ts +4 -0
- package/src/tables/DataTable/selection-strip.tsx +31 -0
- package/src/tables/DataTable/single-selection.tsx +0 -7
- package/src/tables/DataTable/use-multiple-selection.ts +86 -0
- package/src/test/OptInDefaults.test.tsx +27 -0
- package/src/test/fixtures/opt-in-defaults.json +10 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useId, useMemo, useRef, useState, type ReactNode, type UIEvent } from 'react';
|
|
2
2
|
import { Check, Copy, Eye, Search } from '@gntik-ai/icons';
|
|
3
3
|
import { IconButton, Input, Switch, Toggle, ToggleGroup, cn, foldText, matchRanges, useI18n } from '@gntik-ai/ui';
|
|
4
|
+
import { useWrappedLogRows } from './use-wrapped-log-rows';
|
|
4
5
|
import { logLines as defaultLines, type LogLevel, type LogLine } from './fixtures';
|
|
5
6
|
|
|
6
7
|
export type { LogLevel, LogLine } from './fixtures';
|
|
@@ -15,6 +16,7 @@ const LEVEL_STYLE: Record<LogLevel, { label: string; className: string }> = {
|
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export interface LogViewerLabels {
|
|
19
|
+
levels?: Partial<Record<LogLevel, string>>;
|
|
18
20
|
title: string;
|
|
19
21
|
levelFilter: string;
|
|
20
22
|
searchLabel: string;
|
|
@@ -38,6 +40,8 @@ export interface LogViewerProps {
|
|
|
38
40
|
height?: number;
|
|
39
41
|
/** Fixed row height in px (the windowing math relies on it). */
|
|
40
42
|
rowHeight?: number;
|
|
43
|
+
/** Wrap full messages and measure variable-height rows. Default false; rowHeight estimates unmeasured rows. */
|
|
44
|
+
wrap?: boolean;
|
|
41
45
|
/** Rows rendered above and below the visible window. */
|
|
42
46
|
overscan?: number;
|
|
43
47
|
/** Levels shown initially. */
|
|
@@ -89,6 +93,7 @@ export function LogViewer({
|
|
|
89
93
|
labels,
|
|
90
94
|
height = 360,
|
|
91
95
|
rowHeight = 24,
|
|
96
|
+
wrap = false,
|
|
92
97
|
overscan = 8,
|
|
93
98
|
defaultLevels = LOG_LEVELS,
|
|
94
99
|
defaultFollow = true,
|
|
@@ -135,12 +140,13 @@ export function LogViewer({
|
|
|
135
140
|
.map(({ line }) => line);
|
|
136
141
|
}, [foldedLines, levels, query, locale]);
|
|
137
142
|
|
|
138
|
-
const
|
|
143
|
+
const wrapped = useWrappedLogRows(wrap, visible, rowHeight, height, overscan, scrollTop, follow);
|
|
144
|
+
const total = wrap ? wrapped.total : visible.length * rowHeight;
|
|
139
145
|
const maxScroll = Math.max(0, total - height);
|
|
140
146
|
// While following, the window is pinned to the end (the DOM scroll catches up in the effect).
|
|
141
147
|
const offset = follow ? maxScroll : Math.min(scrollTop, maxScroll);
|
|
142
|
-
const start = Math.max(0, Math.floor(offset / rowHeight) - overscan);
|
|
143
|
-
const end = Math.min(visible.length, Math.ceil((offset + height) / rowHeight) + overscan);
|
|
148
|
+
const start = wrap ? wrapped.start : Math.max(0, Math.floor(offset / rowHeight) - overscan);
|
|
149
|
+
const end = wrap ? wrapped.end : Math.min(visible.length, Math.ceil((offset + height) / rowHeight) + overscan);
|
|
144
150
|
const rows = visible.slice(start, end);
|
|
145
151
|
|
|
146
152
|
useEffect(() => {
|
|
@@ -188,7 +194,7 @@ export function LogViewer({
|
|
|
188
194
|
>
|
|
189
195
|
{LOG_LEVELS.map((lv) => (
|
|
190
196
|
<Toggle key={lv} value={lv}>
|
|
191
|
-
{lv}
|
|
197
|
+
{labels?.levels?.[lv] ?? t(`logViewer.levelFilterOption.${lv}`)}
|
|
192
198
|
<span className="font-mono text-[10.5px] opacity-70">{counts[lv]}</span>
|
|
193
199
|
</Toggle>
|
|
194
200
|
))}
|
|
@@ -233,9 +239,18 @@ export function LogViewer({
|
|
|
233
239
|
<div
|
|
234
240
|
key={line.id}
|
|
235
241
|
data-slot="log-line"
|
|
242
|
+
ref={wrap ? (node) => wrapped.measureRow(node, line.id) : undefined}
|
|
236
243
|
onClick={onSelectLine ? () => onSelectLine(line) : undefined}
|
|
237
|
-
className=
|
|
238
|
-
|
|
244
|
+
className={
|
|
245
|
+
wrap
|
|
246
|
+
? 'group absolute inset-x-0 flex items-start gap-2.5 px-3 hover:bg-secondary/50'
|
|
247
|
+
: 'group absolute inset-x-0 flex items-center gap-2.5 px-3 hover:bg-secondary/50'
|
|
248
|
+
}
|
|
249
|
+
style={
|
|
250
|
+
wrap
|
|
251
|
+
? { top: wrapped.offsets[start + i], minHeight: rowHeight }
|
|
252
|
+
: { top: (start + i) * rowHeight, height: rowHeight }
|
|
253
|
+
}
|
|
239
254
|
>
|
|
240
255
|
<span className="shrink-0 text-muted-foreground tabular-nums">{line.timestamp}</span>
|
|
241
256
|
<span
|
|
@@ -244,14 +259,20 @@ export function LogViewer({
|
|
|
244
259
|
lv.className,
|
|
245
260
|
)}
|
|
246
261
|
>
|
|
247
|
-
{
|
|
262
|
+
{labels?.levels?.[line.level] ?? t(`logViewer.level.${line.level}`)}
|
|
248
263
|
</span>
|
|
249
264
|
{line.source && (
|
|
250
265
|
<span className="hidden shrink-0 text-muted-foreground sm:inline">
|
|
251
266
|
[{highlight(line.source, query, locale)}]
|
|
252
267
|
</span>
|
|
253
268
|
)}
|
|
254
|
-
<span
|
|
269
|
+
<span
|
|
270
|
+
className={
|
|
271
|
+
wrap
|
|
272
|
+
? 'min-w-0 flex-1 whitespace-pre-wrap break-words text-foreground'
|
|
273
|
+
: 'min-w-0 flex-1 truncate text-foreground'
|
|
274
|
+
}
|
|
275
|
+
>
|
|
255
276
|
{highlight(line.message, query, locale)}
|
|
256
277
|
</span>
|
|
257
278
|
{onSelectLine && (
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { expectNoAxeViolations } from '../../test/a11y';
|
|
4
|
+
import { LogViewer } from './LogViewer';
|
|
5
|
+
import { makeLogLines } from './fixtures';
|
|
6
|
+
|
|
7
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
8
|
+
afterEach(() => vi.restoreAllMocks());
|
|
9
|
+
|
|
10
|
+
it('preserves the fixed row attributes and English names with wrap unset or false', () => {
|
|
11
|
+
const lines = makeLogLines(20);
|
|
12
|
+
const { rerender } = render(<LogViewer lines={lines} />);
|
|
13
|
+
const attributes = () =>
|
|
14
|
+
[...screen.getByRole('log').querySelectorAll('[data-slot="log-line"]')].map((row) => ({
|
|
15
|
+
className: row.className,
|
|
16
|
+
style: row.getAttribute('style'),
|
|
17
|
+
chip: row.children[1]!.textContent,
|
|
18
|
+
}));
|
|
19
|
+
const original = attributes();
|
|
20
|
+
expect(original).toHaveLength(20);
|
|
21
|
+
expect(original[0]).toEqual({
|
|
22
|
+
className: 'group absolute inset-x-0 flex items-center gap-2.5 px-3 hover:bg-secondary/50',
|
|
23
|
+
style: 'top: 0px; height: 24px;',
|
|
24
|
+
chip: 'INFO',
|
|
25
|
+
});
|
|
26
|
+
expect(original[19]!.style).toBe('top: 456px; height: 24px;');
|
|
27
|
+
expect(original.map((row) => row.chip)).toEqual([
|
|
28
|
+
'INFO',
|
|
29
|
+
'DEBUG',
|
|
30
|
+
'INFO',
|
|
31
|
+
'WARN',
|
|
32
|
+
'INFO',
|
|
33
|
+
'ERROR',
|
|
34
|
+
'INFO',
|
|
35
|
+
'DEBUG',
|
|
36
|
+
'WARN',
|
|
37
|
+
'INFO',
|
|
38
|
+
'INFO',
|
|
39
|
+
'DEBUG',
|
|
40
|
+
'INFO',
|
|
41
|
+
'WARN',
|
|
42
|
+
'INFO',
|
|
43
|
+
'ERROR',
|
|
44
|
+
'INFO',
|
|
45
|
+
'DEBUG',
|
|
46
|
+
'WARN',
|
|
47
|
+
'INFO',
|
|
48
|
+
]);
|
|
49
|
+
expect(
|
|
50
|
+
[...screen.getByRole('group', { name: 'Log levels' }).querySelectorAll('button')].map(
|
|
51
|
+
(button) => button.textContent,
|
|
52
|
+
),
|
|
53
|
+
).toEqual(['debug4', 'info10', 'warn4', 'error2']);
|
|
54
|
+
rerender(<LogViewer lines={lines} wrap={false} />);
|
|
55
|
+
expect(attributes()).toEqual(original);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('measures rows by identity across filters and appends and disconnects observers', () => {
|
|
59
|
+
const observers = new Set<{ update: () => void; nodes: Set<Element> }>();
|
|
60
|
+
vi.stubGlobal(
|
|
61
|
+
'ResizeObserver',
|
|
62
|
+
class {
|
|
63
|
+
nodes = new Set<Element>();
|
|
64
|
+
constructor(readonly update: () => void) {
|
|
65
|
+
observers.add(this);
|
|
66
|
+
}
|
|
67
|
+
observe(node: Element) {
|
|
68
|
+
this.nodes.add(node);
|
|
69
|
+
}
|
|
70
|
+
unobserve(node: Element) {
|
|
71
|
+
this.nodes.delete(node);
|
|
72
|
+
}
|
|
73
|
+
disconnect() {
|
|
74
|
+
observers.delete(this);
|
|
75
|
+
this.nodes.clear();
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
const rect = Element.prototype.getBoundingClientRect;
|
|
80
|
+
vi.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function (this: Element) {
|
|
81
|
+
const result = rect.call(this);
|
|
82
|
+
if (this.matches('[data-slot="log-line"]')) {
|
|
83
|
+
return {
|
|
84
|
+
...result,
|
|
85
|
+
height: this.textContent?.includes('Message 0') ? 72 : this.textContent?.includes('Message 1') ? 48 : 24,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
});
|
|
90
|
+
const lines = makeLogLines(4).map((line, i) => ({
|
|
91
|
+
...line,
|
|
92
|
+
level: (['debug', 'warn', 'info', 'error'] as const)[i]!,
|
|
93
|
+
message: `Message ${i}`,
|
|
94
|
+
}));
|
|
95
|
+
const { rerender, unmount } = render(<LogViewer lines={lines} wrap height={240} defaultFollow={false} />);
|
|
96
|
+
const log = screen.getByRole('log');
|
|
97
|
+
expect(log.firstElementChild).toHaveStyle({ height: '168px' });
|
|
98
|
+
expect(screen.getByText('Message 2').closest('[data-slot="log-line"]')).toHaveStyle({ top: '120px' });
|
|
99
|
+
fireEvent.click(screen.getByRole('button', { name: /^debug/ }));
|
|
100
|
+
expect(log.firstElementChild).toHaveStyle({ height: '96px' });
|
|
101
|
+
expect(screen.getByText('Message 2').closest('[data-slot="log-line"]')).toHaveStyle({ top: '48px' });
|
|
102
|
+
rerender(
|
|
103
|
+
<LogViewer
|
|
104
|
+
lines={[...lines, { ...lines[2]!, id: 'appended', message: 'Appended' }]}
|
|
105
|
+
wrap
|
|
106
|
+
height={240}
|
|
107
|
+
defaultFollow={false}
|
|
108
|
+
/>,
|
|
109
|
+
);
|
|
110
|
+
act(() => {
|
|
111
|
+
for (const observer of observers) observer.update();
|
|
112
|
+
});
|
|
113
|
+
expect(log.firstElementChild).toHaveStyle({ height: '120px' });
|
|
114
|
+
expect(screen.getByText('Appended').closest('[data-slot="log-line"]')).toHaveStyle({ top: '96px' });
|
|
115
|
+
expect(log.querySelectorAll('[data-slot="log-line"]')).toHaveLength(4);
|
|
116
|
+
unmount();
|
|
117
|
+
expect(observers.size).toBe(0);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it.each(['noop', 'absent'])(
|
|
121
|
+
'wraps the full message and uses contiguous estimated rows with %s ResizeObserver',
|
|
122
|
+
(observer) => {
|
|
123
|
+
if (observer === 'absent') vi.stubGlobal('ResizeObserver', undefined);
|
|
124
|
+
const message = 'A long message '.repeat(36).slice(0, 500);
|
|
125
|
+
const lines = makeLogLines(20).map((line, i) => ({ ...line, message: i === 0 ? message : `Message ${i}` }));
|
|
126
|
+
const { rerender } = render(<LogViewer lines={lines} wrap defaultFollow={false} height={72} overscan={0} />);
|
|
127
|
+
const span = screen.getByText(message);
|
|
128
|
+
expect(span).not.toHaveClass('truncate');
|
|
129
|
+
expect(span).toHaveClass('whitespace-pre-wrap', 'break-words');
|
|
130
|
+
expect(span.textContent).toBe(message);
|
|
131
|
+
const log = screen.getByRole('log');
|
|
132
|
+
const rowMessages = () =>
|
|
133
|
+
[...log.querySelectorAll('[data-slot="log-line"]')].map((row) => row.querySelector('.flex-1')!.textContent);
|
|
134
|
+
expect(rowMessages()).toEqual([message, 'Message 1', 'Message 2']);
|
|
135
|
+
log.scrollTop = 72;
|
|
136
|
+
fireEvent.scroll(log);
|
|
137
|
+
expect(rowMessages()).toEqual(['Message 3', 'Message 4', 'Message 5']);
|
|
138
|
+
expect(log.firstElementChild).toHaveStyle({ height: '480px' });
|
|
139
|
+
rerender(<LogViewer lines={lines} wrap={false} defaultFollow={false} height={72} overscan={0} />);
|
|
140
|
+
expect(screen.getByText('Message 3')).toHaveClass('truncate');
|
|
141
|
+
},
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
it('keeps following as rows are measured and appended until the user scrolls up', () => {
|
|
145
|
+
const lines = makeLogLines(20);
|
|
146
|
+
const { rerender } = render(<LogViewer lines={lines} wrap height={72} />);
|
|
147
|
+
const log = screen.getByRole('log');
|
|
148
|
+
expect(log.scrollTop).toBe(408);
|
|
149
|
+
const rect = Element.prototype.getBoundingClientRect;
|
|
150
|
+
vi.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function (this: Element) {
|
|
151
|
+
const result = rect.call(this);
|
|
152
|
+
return this.matches('[data-slot="log-line"]') ? { ...result, height: 48 } : result;
|
|
153
|
+
});
|
|
154
|
+
rerender(<LogViewer lines={makeLogLines(21)} wrap height={72} />);
|
|
155
|
+
expect(log.scrollTop).toBeGreaterThan(432);
|
|
156
|
+
expect(log.scrollTop).toBe(Number((log.firstElementChild as HTMLElement).style.height.replace('px', '')) - 72);
|
|
157
|
+
fireEvent.scroll(log);
|
|
158
|
+
expect(screen.getByRole('switch', { name: 'Follow' })).toBeChecked();
|
|
159
|
+
log.scrollTop -= 48;
|
|
160
|
+
fireEvent.scroll(log);
|
|
161
|
+
expect(screen.getByRole('switch', { name: 'Follow' })).not.toBeChecked();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('preserves search marks, selection, English copying, keyboard access and accessibility while wrapping', async () => {
|
|
165
|
+
const user = userEvent.setup();
|
|
166
|
+
const line = { ...makeLogLines(1)[0]!, message: 'Full searchable message '.repeat(24) };
|
|
167
|
+
const onSelectLine = vi.fn();
|
|
168
|
+
render(<LogViewer lines={[line]} wrap onSelectLine={onSelectLine} labels={{ levels: { info: 'Notice' } }} />);
|
|
169
|
+
await user.type(screen.getByRole('searchbox'), 'searchable');
|
|
170
|
+
expect(screen.getByRole('log').querySelectorAll('mark')).toHaveLength(24);
|
|
171
|
+
fireEvent.click(screen.getByRole('log').querySelector('[data-slot="log-line"]')!);
|
|
172
|
+
expect(onSelectLine).toHaveBeenLastCalledWith(line);
|
|
173
|
+
screen.getByRole('log').focus();
|
|
174
|
+
await user.tab();
|
|
175
|
+
expect(screen.getByRole('button', { name: `Inspect event ${line.timestamp}` })).toHaveFocus();
|
|
176
|
+
await user.tab();
|
|
177
|
+
expect(screen.getByRole('button', { name: `Copy line ${line.timestamp}` })).toHaveFocus();
|
|
178
|
+
await user.keyboard('{Enter}');
|
|
179
|
+
expect(await navigator.clipboard.readText()).toBe(`${line.timestamp} INFO [api] ${line.message}`);
|
|
180
|
+
await expectNoAxeViolations();
|
|
181
|
+
});
|
|
@@ -6,10 +6,15 @@ 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 labels?: Partial<LogViewerLabels> overrides each built-in label. Explicit content props win over labels, then I18nProvider (en/es); no provider keeps English.
|
|
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.',
|
|
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' },
|
|
13
|
+
{
|
|
14
|
+
key: 'levels',
|
|
15
|
+
type: 'Partial<Record<LogLevel, string>>',
|
|
16
|
+
state: 'Per-level chip and filter names; omitted levels use the catalog',
|
|
17
|
+
},
|
|
13
18
|
{ key: 'searchLabel', type: 'string', state: 'Searchbox name' },
|
|
14
19
|
{ key: 'searchPlaceholder', type: 'string', state: 'Searchbox placeholder' },
|
|
15
20
|
{ key: 'follow', type: 'string', state: 'Follow switch name' },
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Button, I18nProvider, Stack, Switch } from '@gntik-ai/ui';
|
|
3
|
+
import { LogViewer } from '../LogViewer';
|
|
4
|
+
import { makeLogLines } from '../fixtures';
|
|
5
|
+
|
|
6
|
+
const initialLines = makeLogLines(40).map((line, index) => ({
|
|
7
|
+
...line,
|
|
8
|
+
message:
|
|
9
|
+
index === 0
|
|
10
|
+
? `Long message ${'with full details for inspection. '.repeat(16)}`.slice(0, 500)
|
|
11
|
+
: index === 1
|
|
12
|
+
? 'x'.repeat(200)
|
|
13
|
+
: line.message,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
export default function Wrap() {
|
|
17
|
+
const [lines, setLines] = useState(initialLines);
|
|
18
|
+
const [selected, setSelected] = useState('');
|
|
19
|
+
const [spanish, setSpanish] = useState(false);
|
|
20
|
+
const [override, setOverride] = useState(false);
|
|
21
|
+
return (
|
|
22
|
+
<Stack gap={4}>
|
|
23
|
+
<p className="text-[13px] text-muted-foreground">
|
|
24
|
+
Wrap full messages, including unbroken tokens. Follow the stream while appending lines, or scroll up to inspect.
|
|
25
|
+
Level names use the catalog unless overridden.
|
|
26
|
+
</p>
|
|
27
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
28
|
+
<Button
|
|
29
|
+
onClick={() =>
|
|
30
|
+
setLines((current) => [
|
|
31
|
+
...current,
|
|
32
|
+
{
|
|
33
|
+
...makeLogLines(current.length + 1)[current.length]!,
|
|
34
|
+
message: 'Appended full message with details that wrap across several lines.',
|
|
35
|
+
},
|
|
36
|
+
])
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
Append line
|
|
40
|
+
</Button>
|
|
41
|
+
<Switch label="Spanish catalog" checked={spanish} onCheckedChange={setSpanish} />
|
|
42
|
+
<Switch label="Override warning label" checked={override} onCheckedChange={setOverride} />
|
|
43
|
+
</div>
|
|
44
|
+
<I18nProvider locale={spanish ? 'es' : 'en'}>
|
|
45
|
+
<LogViewer
|
|
46
|
+
lines={lines}
|
|
47
|
+
wrap
|
|
48
|
+
title="Wrapped logs"
|
|
49
|
+
height={240}
|
|
50
|
+
rowHeight={24}
|
|
51
|
+
defaultFollow={false}
|
|
52
|
+
onSelectLine={(line) => setSelected(line.id)}
|
|
53
|
+
selectedLineId={selected}
|
|
54
|
+
labels={override ? { levels: { warn: 'Caution' } } : undefined}
|
|
55
|
+
/>
|
|
56
|
+
</I18nProvider>
|
|
57
|
+
<p role="status" className="text-[13px] text-muted-foreground">
|
|
58
|
+
{selected ? `Selected ${selected}` : 'Select a line to inspect it.'}
|
|
59
|
+
</p>
|
|
60
|
+
</Stack>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { computeOffsets, useVirtualWindow } from '@gntik-ai/ui';
|
|
3
|
+
import type { LogLine } from './fixtures';
|
|
4
|
+
|
|
5
|
+
/** Measurements belong to line IDs, independent of the current filtered indices. */
|
|
6
|
+
export function useWrappedLogRows(
|
|
7
|
+
enabled: boolean,
|
|
8
|
+
lines: LogLine[],
|
|
9
|
+
rowHeight: number,
|
|
10
|
+
height: number,
|
|
11
|
+
overscan: number,
|
|
12
|
+
scrollTop: number,
|
|
13
|
+
follow: boolean,
|
|
14
|
+
) {
|
|
15
|
+
const [sizes, setSizes] = useState<ReadonlyMap<string, number>>(new Map());
|
|
16
|
+
const count = enabled ? lines.length : 0;
|
|
17
|
+
const sizeOf = useCallback(
|
|
18
|
+
(index: number) => sizes.get(lines[index]?.id ?? '') ?? rowHeight,
|
|
19
|
+
[lines, sizes, rowHeight],
|
|
20
|
+
);
|
|
21
|
+
const offsets = useMemo(() => computeOffsets(count, sizeOf), [count, sizeOf]);
|
|
22
|
+
const total = offsets[count] ?? 0;
|
|
23
|
+
const maxScroll = Math.max(0, total - height);
|
|
24
|
+
const win = useVirtualWindow(count, sizeOf, follow ? maxScroll : Math.min(scrollTop, maxScroll), height, overscan);
|
|
25
|
+
|
|
26
|
+
const measureRow = useCallback((node: HTMLDivElement | null, id: string) => {
|
|
27
|
+
if (!node) return;
|
|
28
|
+
const measure = () => {
|
|
29
|
+
const measured = node.getBoundingClientRect().height;
|
|
30
|
+
if (measured > 0)
|
|
31
|
+
setSizes((previous) => (previous.get(id) === measured ? previous : new Map(previous).set(id, measured)));
|
|
32
|
+
};
|
|
33
|
+
measure();
|
|
34
|
+
if (typeof ResizeObserver === 'undefined') return;
|
|
35
|
+
// React 19 ref cleanup disconnects on removal, ref replacement and unmount.
|
|
36
|
+
const observer = new ResizeObserver(measure);
|
|
37
|
+
observer.observe(node);
|
|
38
|
+
return () => observer.disconnect();
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
return { ...win, end: win.end + 1, measureRow };
|
|
42
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { expectNoAxeViolations } from '../../test/a11y';
|
|
3
|
+
import { DescriptionListCard } from './DescriptionListCard';
|
|
4
|
+
|
|
5
|
+
it('wraps a full unbroken value only when requested', () => {
|
|
6
|
+
const value = 'x'.repeat(120);
|
|
7
|
+
const items = [{ id: 'id', label: 'Identifier', value, mono: true, copyable: true }];
|
|
8
|
+
const { rerender } = render(<DescriptionListCard items={items} wrap />);
|
|
9
|
+
const span = screen.getByText(value);
|
|
10
|
+
expect(span.tagName).toBe('SPAN');
|
|
11
|
+
expect(span).not.toHaveClass('truncate');
|
|
12
|
+
expect(span).toHaveClass('min-w-0', 'wrap-anywhere', 'font-mono');
|
|
13
|
+
expect(span.textContent).toBe(value);
|
|
14
|
+
expect(screen.getByRole('button', { name: 'Copy Identifier' })).toBeInTheDocument();
|
|
15
|
+
rerender(<DescriptionListCard items={items} />);
|
|
16
|
+
expect(screen.getByText(value)).toHaveClass('min-w-0', 'truncate');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it.each([
|
|
20
|
+
[
|
|
21
|
+
2,
|
|
22
|
+
[
|
|
23
|
+
['Field 1', 'Field 2', 'Field 3', 'Field 4'],
|
|
24
|
+
['Field 5', 'Field 6', 'Field 7'],
|
|
25
|
+
],
|
|
26
|
+
],
|
|
27
|
+
[3, [['Field 1', 'Field 2', 'Field 3'], ['Field 4', 'Field 5', 'Field 6'], ['Field 7']]],
|
|
28
|
+
] as const)('stacks terms and values in %i column-major groups', async (columns, expected) => {
|
|
29
|
+
const items = Array.from({ length: 7 }, (_, index) => ({
|
|
30
|
+
id: String(index),
|
|
31
|
+
label: `Field ${index + 1}`,
|
|
32
|
+
value: `Value ${index + 1}`,
|
|
33
|
+
}));
|
|
34
|
+
const { container } = render(<DescriptionListCard columns={columns} items={items} />);
|
|
35
|
+
const groups = Array.from(container.querySelectorAll('dl'));
|
|
36
|
+
expect(groups).toHaveLength(columns);
|
|
37
|
+
const grid = groups[0]!.parentElement!;
|
|
38
|
+
expect(grid).toHaveClass('grid', 'grid-cols-1', `sm:grid-cols-${columns}`);
|
|
39
|
+
expect(Array.from(grid.classList).filter((name) => /border|divide/.test(name))).toEqual([]);
|
|
40
|
+
expect(groups.map((group) => Array.from(group.querySelectorAll('dt'), (term) => term.textContent))).toEqual(expected);
|
|
41
|
+
expect(Array.from(container.querySelectorAll('dt'), (term) => term.textContent)).toEqual([
|
|
42
|
+
'Field 1',
|
|
43
|
+
'Field 2',
|
|
44
|
+
'Field 3',
|
|
45
|
+
'Field 4',
|
|
46
|
+
'Field 5',
|
|
47
|
+
'Field 6',
|
|
48
|
+
'Field 7',
|
|
49
|
+
]);
|
|
50
|
+
for (const group of groups) {
|
|
51
|
+
expect(group).toHaveClass('divide-y', 'divide-border');
|
|
52
|
+
for (const row of Array.from(group.children)) {
|
|
53
|
+
expect(row.tagName).toBe('DIV');
|
|
54
|
+
expect(row).toHaveClass('grid', 'grid-cols-1');
|
|
55
|
+
expect(row).not.toHaveClass('sm:grid-cols-[160px_minmax(0,1fr)]');
|
|
56
|
+
expect(Array.from(row.children, (child) => child.tagName)).toEqual(['DT', 'DD']);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const item of items) {
|
|
60
|
+
expect(screen.getAllByText(item.label)).toHaveLength(1);
|
|
61
|
+
expect(screen.getAllByText(item.value)).toHaveLength(1);
|
|
62
|
+
}
|
|
63
|
+
await expectNoAxeViolations(container);
|
|
64
|
+
});
|
|
@@ -45,6 +45,10 @@ export interface DescriptionListCardProps {
|
|
|
45
45
|
title?: string;
|
|
46
46
|
description?: string;
|
|
47
47
|
items?: readonly DescriptionItem[];
|
|
48
|
+
/** Wrap values, including long unbroken strings, instead of truncating (default false). */
|
|
49
|
+
wrap?: boolean;
|
|
50
|
+
/** Responsive columns; items fill top to bottom in contiguous groups (default 1). */
|
|
51
|
+
columns?: 1 | 2 | 3;
|
|
48
52
|
/** Shows an Edit button in the header. */
|
|
49
53
|
onEdit?: () => void;
|
|
50
54
|
editLabel?: string;
|
|
@@ -105,6 +109,8 @@ export function DescriptionListCard({
|
|
|
105
109
|
labels,
|
|
106
110
|
description: descriptionProp,
|
|
107
111
|
items = DEPLOYMENT_DETAILS,
|
|
112
|
+
wrap = false,
|
|
113
|
+
columns = 1,
|
|
108
114
|
onEdit,
|
|
109
115
|
editLabel: editLabelProp,
|
|
110
116
|
onCopy,
|
|
@@ -115,6 +121,27 @@ export function DescriptionListCard({
|
|
|
115
121
|
const title = titleProp ?? labels?.title ?? t('descriptionList.title');
|
|
116
122
|
const description = descriptionProp ?? labels?.description ?? t('descriptionList.description');
|
|
117
123
|
const editLabel = editLabelProp ?? labels?.edit ?? t('descriptionList.edit');
|
|
124
|
+
const renderItem = (item: DescriptionItem) => (
|
|
125
|
+
<div
|
|
126
|
+
key={item.id}
|
|
127
|
+
className={cn('grid grid-cols-1 gap-1 py-3.5', columns === 1 && 'sm:grid-cols-[160px_minmax(0,1fr)] sm:gap-4')}
|
|
128
|
+
>
|
|
129
|
+
<dt className="text-[13px] text-muted-foreground">{item.label}</dt>
|
|
130
|
+
<dd className="flex min-w-0 items-center gap-2 text-[13px] text-foreground">
|
|
131
|
+
{item.status ? (
|
|
132
|
+
<StatusTag status={item.status} />
|
|
133
|
+
) : (
|
|
134
|
+
<span
|
|
135
|
+
className={cn(wrap ? 'min-w-0 wrap-anywhere' : 'min-w-0 truncate', item.mono && 'font-mono text-[12.5px]')}
|
|
136
|
+
>
|
|
137
|
+
{item.render ?? item.value}
|
|
138
|
+
</span>
|
|
139
|
+
)}
|
|
140
|
+
{item.copyable && <CopyButton item={item} onCopy={onCopy} labels={labels} />}
|
|
141
|
+
</dd>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
const chunkSize = Math.ceil(items.length / columns);
|
|
118
145
|
return (
|
|
119
146
|
<Card className={className}>
|
|
120
147
|
<CardHeader divided>
|
|
@@ -128,23 +155,17 @@ export function DescriptionListCard({
|
|
|
128
155
|
</CardAction>
|
|
129
156
|
)}
|
|
130
157
|
</CardHeader>
|
|
131
|
-
|
|
132
|
-
{items.map(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)}
|
|
143
|
-
{item.copyable && <CopyButton item={item} onCopy={onCopy} labels={labels} />}
|
|
144
|
-
</dd>
|
|
145
|
-
</div>
|
|
146
|
-
))}
|
|
147
|
-
</dl>
|
|
158
|
+
{columns === 1 ? (
|
|
159
|
+
<dl className="divide-y divide-border px-5">{items.map(renderItem)}</dl>
|
|
160
|
+
) : (
|
|
161
|
+
<div className={cn('grid grid-cols-1 gap-x-6 px-5', columns === 2 ? 'sm:grid-cols-2' : 'sm:grid-cols-3')}>
|
|
162
|
+
{Array.from({ length: columns }, (_, column) => (
|
|
163
|
+
<dl key={column} className="min-w-0 divide-y divide-border">
|
|
164
|
+
{items.slice(column * chunkSize, (column + 1) * chunkSize).map(renderItem)}
|
|
165
|
+
</dl>
|
|
166
|
+
))}
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
148
169
|
</Card>
|
|
149
170
|
);
|
|
150
171
|
}
|
|
@@ -6,7 +6,7 @@ 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.',
|
|
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.',
|
|
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' },
|
|
@@ -16,6 +16,13 @@ export default function Spanish() {
|
|
|
16
16
|
copiedToClipboard: 'Field copied to clipboard',
|
|
17
17
|
}}
|
|
18
18
|
/>
|
|
19
|
+
<DescriptionListCard
|
|
20
|
+
title="Full identifiers"
|
|
21
|
+
wrap
|
|
22
|
+
items={[{ id: 'id', label: 'Correlation ID', value: 'a'.repeat(120), mono: true, copyable: true }]}
|
|
23
|
+
/>
|
|
24
|
+
<DescriptionListCard title="Two columns" columns={2} />
|
|
25
|
+
<DescriptionListCard title="Three columns" columns={3} />
|
|
19
26
|
</Stack>
|
|
20
27
|
</I18nProvider>
|
|
21
28
|
);
|
|
@@ -215,6 +215,10 @@ export interface NoAccessEmptyProps extends SharedEmptyProps {
|
|
|
215
215
|
owner?: string;
|
|
216
216
|
/** Called on "Request access"; may return a promise (the button shows a spinner). */
|
|
217
217
|
onRequestAccess?: () => void | Promise<void>;
|
|
218
|
+
/** Show the request button and its status announcement (default true). */
|
|
219
|
+
showRequestAccess?: boolean;
|
|
220
|
+
/** One href link; secondary to the request button, or primary when the button is hidden. */
|
|
221
|
+
action?: { label: string; href: string };
|
|
218
222
|
/** Start in the "requested" state (e.g. a pending request exists). */
|
|
219
223
|
defaultRequested?: boolean;
|
|
220
224
|
}
|
|
@@ -225,6 +229,8 @@ export function NoAccessEmpty({
|
|
|
225
229
|
labels,
|
|
226
230
|
owner = noAccessSample.owner,
|
|
227
231
|
onRequestAccess,
|
|
232
|
+
showRequestAccess = true,
|
|
233
|
+
action,
|
|
228
234
|
defaultRequested = false,
|
|
229
235
|
titleAs,
|
|
230
236
|
bordered = true,
|
|
@@ -241,6 +247,11 @@ export function NoAccessEmpty({
|
|
|
241
247
|
setState('idle');
|
|
242
248
|
}
|
|
243
249
|
};
|
|
250
|
+
const actionLink = action ? (
|
|
251
|
+
<Link underline="hover" href={action.href} className="inline-flex h-9 items-center px-2 text-[13px] font-semibold">
|
|
252
|
+
{action.label}
|
|
253
|
+
</Link>
|
|
254
|
+
) : undefined;
|
|
244
255
|
return (
|
|
245
256
|
<EmptyState
|
|
246
257
|
icon={Lock}
|
|
@@ -253,22 +264,29 @@ export function NoAccessEmpty({
|
|
|
253
264
|
t('emptyState.noAccess.description', { resource: resource.toLowerCase(), owner })
|
|
254
265
|
}
|
|
255
266
|
primaryAction={
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
showRequestAccess ? (
|
|
268
|
+
<Button
|
|
269
|
+
variant={state === 'requested' ? 'secondary' : 'primary'}
|
|
270
|
+
icon={state === 'requested' ? Check : undefined}
|
|
271
|
+
loading={state === 'pending'}
|
|
272
|
+
disabled={state === 'requested'}
|
|
273
|
+
onClick={() => void request()}
|
|
274
|
+
>
|
|
275
|
+
{state === 'requested'
|
|
276
|
+
? (labels?.requested ?? t('emptyState.noAccess.requested'))
|
|
277
|
+
: (labels?.request ?? t('emptyState.noAccess.request'))}
|
|
278
|
+
</Button>
|
|
279
|
+
) : (
|
|
280
|
+
actionLink
|
|
281
|
+
)
|
|
267
282
|
}
|
|
283
|
+
secondaryAction={showRequestAccess ? actionLink : undefined}
|
|
268
284
|
>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
285
|
+
{showRequestAccess && (
|
|
286
|
+
<p role="status" className="sr-only">
|
|
287
|
+
{state === 'requested' ? (labels?.sent ?? t('emptyState.noAccess.sent')) : ''}
|
|
288
|
+
</p>
|
|
289
|
+
)}
|
|
272
290
|
</EmptyState>
|
|
273
291
|
);
|
|
274
292
|
}
|