@flamingo-stack/openframe-frontend-core 0.0.616 → 0.0.617-snapshot.20260912211033
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/{chunk-NLKYBYPV.js → chunk-2DTZXXY3.js} +5 -5
- package/dist/{chunk-F7R7J4HK.cjs → chunk-3FTNQDLP.cjs} +5 -5
- package/dist/{chunk-F7R7J4HK.cjs.map → chunk-3FTNQDLP.cjs.map} +1 -1
- package/dist/{chunk-JYHDJD3U.js → chunk-5P74E24M.js} +5 -5
- package/dist/{chunk-BLUL2TE3.js → chunk-6XJS3WU7.js} +2 -2
- package/dist/{chunk-QPAPUIF3.cjs → chunk-7ZEQMFP3.cjs} +30 -30
- package/dist/{chunk-QPAPUIF3.cjs.map → chunk-7ZEQMFP3.cjs.map} +1 -1
- package/dist/{chunk-OKWHWDA3.js → chunk-ANMD7SM4.js} +3 -3
- package/dist/{chunk-TDA355L7.cjs → chunk-BGDYSUA2.cjs} +11 -11
- package/dist/{chunk-TDA355L7.cjs.map → chunk-BGDYSUA2.cjs.map} +1 -1
- package/dist/{chunk-X6G7JIX6.cjs → chunk-BXNSKTEG.cjs} +57 -57
- package/dist/{chunk-X6G7JIX6.cjs.map → chunk-BXNSKTEG.cjs.map} +1 -1
- package/dist/{chunk-N3G3YG3V.cjs → chunk-CM6DNLK7.cjs} +579 -471
- package/dist/chunk-CM6DNLK7.cjs.map +1 -0
- package/dist/{chunk-TOAJWB3V.js → chunk-CWMKY2UJ.js} +3 -3
- package/dist/{chunk-UQEOAPAI.cjs → chunk-E2EGTHYA.cjs} +28 -12
- package/dist/chunk-E2EGTHYA.cjs.map +1 -0
- package/dist/{chunk-YSG26SQ7.cjs → chunk-E7VXPU3R.cjs} +33 -33
- package/dist/{chunk-YSG26SQ7.cjs.map → chunk-E7VXPU3R.cjs.map} +1 -1
- package/dist/{chunk-TOXJS4HN.cjs → chunk-EJGZIYC7.cjs} +6 -6
- package/dist/{chunk-TOXJS4HN.cjs.map → chunk-EJGZIYC7.cjs.map} +1 -1
- package/dist/{chunk-NLYWRJ6J.cjs → chunk-EXEXX34Q.cjs} +28 -28
- package/dist/{chunk-NLYWRJ6J.cjs.map → chunk-EXEXX34Q.cjs.map} +1 -1
- package/dist/{chunk-FP5WYJ3S.js → chunk-FCN2HN6Q.js} +2 -2
- package/dist/{chunk-KIQNMCOO.cjs → chunk-G7NEMLNW.cjs} +10 -10
- package/dist/{chunk-KIQNMCOO.cjs.map → chunk-G7NEMLNW.cjs.map} +1 -1
- package/dist/{chunk-4C3BOBV6.js → chunk-GD7CV2JI.js} +6 -6
- package/dist/{chunk-KKYE3E66.js → chunk-GFWKEWEH.js} +4 -4
- package/dist/{chunk-RU3IKVY2.js → chunk-GXUGYZ6H.js} +27 -11
- package/dist/chunk-GXUGYZ6H.js.map +1 -0
- package/dist/{chunk-FBL32U6S.cjs → chunk-IDMEC4ZK.cjs} +22 -22
- package/dist/{chunk-FBL32U6S.cjs.map → chunk-IDMEC4ZK.cjs.map} +1 -1
- package/dist/{chunk-646YZIUK.js → chunk-IPHA3AQ6.js} +7 -7
- package/dist/{chunk-A6ZMLRBR.js → chunk-J25M43YI.js} +6 -6
- package/dist/{chunk-RJT7I2Y4.cjs → chunk-K26VN65M.cjs} +15 -15
- package/dist/{chunk-RJT7I2Y4.cjs.map → chunk-K26VN65M.cjs.map} +1 -1
- package/dist/{chunk-5WHUUHSH.cjs → chunk-MOC7JLEP.cjs} +80 -80
- package/dist/{chunk-5WHUUHSH.cjs.map → chunk-MOC7JLEP.cjs.map} +1 -1
- package/dist/{chunk-TWE6KYQM.js → chunk-NUU5ZEEG.js} +4 -4
- package/dist/{chunk-GHMTJJCC.cjs → chunk-PIJK3FV6.cjs} +3 -3
- package/dist/{chunk-GHMTJJCC.cjs.map → chunk-PIJK3FV6.cjs.map} +1 -1
- package/dist/{chunk-L6UVTIJP.cjs → chunk-RDEFB354.cjs} +6 -6
- package/dist/{chunk-L6UVTIJP.cjs.map → chunk-RDEFB354.cjs.map} +1 -1
- package/dist/{chunk-7GLJC4EO.cjs → chunk-ROQTWRV7.cjs} +145 -145
- package/dist/{chunk-7GLJC4EO.cjs.map → chunk-ROQTWRV7.cjs.map} +1 -1
- package/dist/{chunk-L3H6VYDB.js → chunk-RROIA6WY.js} +2 -2
- package/dist/{chunk-H6TOSMGU.cjs → chunk-U6B3MM4U.cjs} +20 -20
- package/dist/{chunk-H6TOSMGU.cjs.map → chunk-U6B3MM4U.cjs.map} +1 -1
- package/dist/{chunk-BESOUYM7.cjs → chunk-UKFBPJBK.cjs} +29 -29
- package/dist/{chunk-BESOUYM7.cjs.map → chunk-UKFBPJBK.cjs.map} +1 -1
- package/dist/{chunk-RRGQTQ6T.js → chunk-UUXLDIK3.js} +3 -3
- package/dist/{chunk-UMVCVMCG.js → chunk-VRN5YYD3.js} +3 -3
- package/dist/{chunk-XJ5KH37F.js → chunk-WVRXDGGP.js} +3 -3
- package/dist/{chunk-HIMST6NK.js → chunk-XUNFDRMP.js} +3 -3
- package/dist/{chunk-AJRHEX5D.js → chunk-YCZBCEQO.js} +2577 -2469
- package/dist/chunk-YCZBCEQO.js.map +1 -0
- package/dist/components/case-studies/index.cjs +10 -10
- package/dist/components/case-studies/index.js +4 -4
- package/dist/components/chat/index.cjs +3 -3
- package/dist/components/chat/index.js +2 -2
- package/dist/components/contact/index.cjs +5 -5
- package/dist/components/contact/index.js +4 -4
- package/dist/components/docs/index.cjs +8 -8
- package/dist/components/docs/index.js +7 -7
- package/dist/components/embeds/index.cjs +5 -5
- package/dist/components/embeds/index.js +4 -4
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/index.cjs +4 -4
- package/dist/components/features/index.js +3 -3
- package/dist/components/help-center-pages/index.cjs +24 -24
- package/dist/components/help-center-pages/index.js +15 -15
- package/dist/components/index.cjs +57 -53
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +19 -15
- package/dist/components/index.js.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +34 -34
- package/dist/components/meeting-scheduler/index.cjs.map +1 -1
- package/dist/components/meeting-scheduler/index.js +5 -5
- package/dist/components/meeting-scheduler/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +7 -7
- package/dist/components/navigation/index.js +6 -6
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +8 -8
- package/dist/components/tickets/index.js +7 -7
- package/dist/components/ui/avatar-stack.d.ts +16 -3
- package/dist/components/ui/avatar-stack.d.ts.map +1 -1
- package/dist/components/ui/data-table/data-table-header.d.ts +9 -1
- package/dist/components/ui/data-table/data-table-header.d.ts.map +1 -1
- package/dist/components/ui/data-table/types.d.ts +9 -0
- package/dist/components/ui/data-table/types.d.ts.map +1 -1
- package/dist/components/ui/index.cjs +8 -4
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +7 -3
- package/dist/components/ui/people-cell.d.ts +46 -0
- package/dist/components/ui/people-cell.d.ts.map +1 -0
- package/dist/components/ui/table/table-header.d.ts.map +1 -1
- package/dist/components/ui/table/types.d.ts +7 -0
- package/dist/components/ui/table/types.d.ts.map +1 -1
- package/dist/index.cjs +14 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/format.d.ts +8 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +5 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/data-table-header-hint.test.tsx +69 -0
- package/src/components/meeting-scheduler/context-panel.tsx +1 -1
- package/src/components/meeting-scheduler/directory.tsx +1 -1
- package/src/components/ui/__tests__/people-cell.test.tsx +97 -0
- package/src/components/ui/avatar-stack.tsx +40 -13
- package/src/components/ui/data-table/data-table-header.tsx +47 -11
- package/src/components/ui/data-table/types.ts +9 -0
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/people-cell.tsx +133 -0
- package/src/components/ui/table/__tests__/header-hint.test.tsx +85 -0
- package/src/components/ui/table/table-header.tsx +34 -9
- package/src/components/ui/table/types.ts +7 -0
- package/src/utils/format.ts +13 -0
- package/src/utils/index.ts +1 -0
- package/dist/chunk-AJRHEX5D.js.map +0 -1
- package/dist/chunk-N3G3YG3V.cjs.map +0 -1
- package/dist/chunk-RU3IKVY2.js.map +0 -1
- package/dist/chunk-UQEOAPAI.cjs.map +0 -1
- /package/dist/{chunk-NLKYBYPV.js.map → chunk-2DTZXXY3.js.map} +0 -0
- /package/dist/{chunk-JYHDJD3U.js.map → chunk-5P74E24M.js.map} +0 -0
- /package/dist/{chunk-BLUL2TE3.js.map → chunk-6XJS3WU7.js.map} +0 -0
- /package/dist/{chunk-OKWHWDA3.js.map → chunk-ANMD7SM4.js.map} +0 -0
- /package/dist/{chunk-TOAJWB3V.js.map → chunk-CWMKY2UJ.js.map} +0 -0
- /package/dist/{chunk-FP5WYJ3S.js.map → chunk-FCN2HN6Q.js.map} +0 -0
- /package/dist/{chunk-4C3BOBV6.js.map → chunk-GD7CV2JI.js.map} +0 -0
- /package/dist/{chunk-KKYE3E66.js.map → chunk-GFWKEWEH.js.map} +0 -0
- /package/dist/{chunk-646YZIUK.js.map → chunk-IPHA3AQ6.js.map} +0 -0
- /package/dist/{chunk-A6ZMLRBR.js.map → chunk-J25M43YI.js.map} +0 -0
- /package/dist/{chunk-TWE6KYQM.js.map → chunk-NUU5ZEEG.js.map} +0 -0
- /package/dist/{chunk-L3H6VYDB.js.map → chunk-RROIA6WY.js.map} +0 -0
- /package/dist/{chunk-RRGQTQ6T.js.map → chunk-UUXLDIK3.js.map} +0 -0
- /package/dist/{chunk-UMVCVMCG.js.map → chunk-VRN5YYD3.js.map} +0 -0
- /package/dist/{chunk-XJ5KH37F.js.map → chunk-WVRXDGGP.js.map} +0 -0
- /package/dist/{chunk-HIMST6NK.js.map → chunk-XUNFDRMP.js.map} +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createColumnHelper } from '@tanstack/react-table';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { DataTable } from '../components/ui/data-table';
|
|
5
|
+
import { DATA_TABLE_HEADER_LABEL_CLASS } from '../components/ui/data-table/data-table-header';
|
|
6
|
+
import { useDataTable } from '../components/ui/data-table/use-data-table';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `meta.hint` draws a header's definition in an InfoHint named after the
|
|
10
|
+
* column, and a header label wraps inside its cell rather than painting across
|
|
11
|
+
* the next column. Both used to be hand-rolled per table with a node header.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface Row {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const columnHelper = createColumnHelper<Row>();
|
|
20
|
+
|
|
21
|
+
function HintTable({ hint, filterable = false }: { hint?: string; filterable?: boolean }) {
|
|
22
|
+
const columns = [
|
|
23
|
+
columnHelper.accessor('name', {
|
|
24
|
+
id: 'name',
|
|
25
|
+
header: 'Implementation owners',
|
|
26
|
+
meta: {
|
|
27
|
+
hint,
|
|
28
|
+
...(filterable ? { filter: { options: [{ id: 'a', label: 'A', value: 'a' }] } } : {}),
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
];
|
|
32
|
+
const table = useDataTable({ data: [{ id: '1', name: 'Alpha' }], columns });
|
|
33
|
+
return (
|
|
34
|
+
<DataTable table={table}>
|
|
35
|
+
<DataTable.Header />
|
|
36
|
+
</DataTable>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
describe('DataTable header hint', () => {
|
|
41
|
+
it('draws the definition beside a plain header, named after the column', () => {
|
|
42
|
+
render(<HintTable hint="Engineers building it." />);
|
|
43
|
+
expect(screen.getByRole('button', { name: 'About Implementation owners' })).toBeTruthy();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('draws it beside a FILTER header too', () => {
|
|
47
|
+
render(<HintTable hint="Engineers building it." filterable />);
|
|
48
|
+
expect(screen.getByRole('button', { name: 'About Implementation owners' })).toBeTruthy();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('draws nothing extra without a hint', () => {
|
|
52
|
+
render(<HintTable />);
|
|
53
|
+
expect(screen.queryByRole('button', { name: /^About / })).toBeNull();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('the shared label class wraps inside the cell', () => {
|
|
57
|
+
expect(DATA_TABLE_HEADER_LABEL_CLASS).not.toContain('whitespace-nowrap');
|
|
58
|
+
expect(DATA_TABLE_HEADER_LABEL_CLASS).toContain('min-w-0');
|
|
59
|
+
// A GOOD break: even lines, never one word stranded on its own.
|
|
60
|
+
expect(DATA_TABLE_HEADER_LABEL_CLASS).toContain('text-balance');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('pins the hint to the first line of a label that breaks onto two', () => {
|
|
64
|
+
// The assertion is about a CLASS reaching the DOM, which has no
|
|
65
|
+
// accessible-name equivalent to query by.
|
|
66
|
+
const { container } = render(<HintTable hint="Engineers building it." />);
|
|
67
|
+
expect(container.innerHTML).toContain('flex min-w-0 items-start gap-[var(--spacing-system-xxs)]');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -222,7 +222,7 @@ export function SchedulerContextPanel({
|
|
|
222
222
|
)}
|
|
223
223
|
{hosts.length > 3 && (
|
|
224
224
|
<div className="flex flex-col gap-[var(--spacing-system-xs)]">
|
|
225
|
-
<AvatarStack people={hosts} max={4} size="lg" />
|
|
225
|
+
<AvatarStack people={hosts} max={4} size="lg" label="Hosts" />
|
|
226
226
|
<p className="text-ods-text-secondary text-h6">{hosts.length} hosts on this calendar</p>
|
|
227
227
|
</div>
|
|
228
228
|
)}
|
|
@@ -114,7 +114,7 @@ function DirectoryRow({
|
|
|
114
114
|
{/* Hosts stay visible on mobile too — the facepile is the row's "who
|
|
115
115
|
you're booking with" signal; only the chip and next-available meta
|
|
116
116
|
collapse on narrow widths. */}
|
|
117
|
-
<AvatarStack people={link.hosts} max={3} size="md" className="flex shrink-0" />
|
|
117
|
+
<AvatarStack people={link.hosts} max={3} size="md" label="Hosts" className="flex shrink-0" />
|
|
118
118
|
|
|
119
119
|
<div className="hidden w-44 shrink-0 flex-col items-end justify-center md:flex">
|
|
120
120
|
<p className="text-ods-text-secondary text-h6">Next available</p>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { personFirstName } from '../../../utils/format';
|
|
5
|
+
import { AvatarStack } from '../avatar-stack';
|
|
6
|
+
import { PeopleCell, PersonCell } from '../people-cell';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The people-column contract, pinned at the primitive:
|
|
10
|
+
*
|
|
11
|
+
* · one person reads as ONE layout wherever it appears (name + second line),
|
|
12
|
+
* so a single implementation owner and a DRI look identical;
|
|
13
|
+
* · several people become first names beside a FIXED-width stack, so every
|
|
14
|
+
* multi-person row's names start at the same x;
|
|
15
|
+
* · the "+N" count, and the group's accessible name, say what they mean.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const person = (name: string, key: string | number = name) => ({
|
|
19
|
+
key,
|
|
20
|
+
name,
|
|
21
|
+
avatarUrl: null,
|
|
22
|
+
secondary: `${name} title`,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('personFirstName', () => {
|
|
26
|
+
it('takes the first word, ignoring surrounding whitespace', () => {
|
|
27
|
+
expect(personFirstName(' Ada Lovelace ')).toBe('Ada');
|
|
28
|
+
});
|
|
29
|
+
it('falls back on an empty or missing name', () => {
|
|
30
|
+
expect(personFirstName(' ')).toBeNull();
|
|
31
|
+
expect(personFirstName(null, 'friend')).toBe('friend');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('PersonCell', () => {
|
|
36
|
+
it('renders the name and the second line', () => {
|
|
37
|
+
render(<PersonCell name="Ada Lovelace" secondary="Engineer" />);
|
|
38
|
+
expect(screen.getByText('Ada Lovelace')).toBeTruthy();
|
|
39
|
+
expect(screen.getByText('Engineer')).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
it('marks an expected-but-missing second line, and names the empty state', () => {
|
|
42
|
+
render(<PersonCell secondary={null} />);
|
|
43
|
+
expect(screen.getByText('Unassigned')).toBeTruthy();
|
|
44
|
+
expect(screen.getByText('·')).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
it('becomes a button when clickable', () => {
|
|
47
|
+
render(<PersonCell name="Ada" onClick={() => {}} actionTitle="Filter by Ada" />);
|
|
48
|
+
expect(screen.getByRole('button', { name: /Ada/ }).getAttribute('title')).toBe('Filter by Ada');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('PeopleCell', () => {
|
|
53
|
+
it('renders one person exactly as PersonCell does', () => {
|
|
54
|
+
const { container: single } = render(<PeopleCell people={[person('Ada Lovelace')]} />);
|
|
55
|
+
const { container: direct } = render(<PersonCell name="Ada Lovelace" secondary="Ada Lovelace title" />);
|
|
56
|
+
expect(single.innerHTML).toBe(direct.innerHTML);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('joins first names with & and keeps the full names for assistive tech', () => {
|
|
60
|
+
render(<PeopleCell people={[person('Dmytro K'), person('Michael A'), person('Ilona K')]} />);
|
|
61
|
+
expect(screen.getByText('Dmytro & Michael & Ilona')).toBeTruthy();
|
|
62
|
+
expect(screen.getByText('Dmytro K, Michael A, Ilona K')).toBeTruthy();
|
|
63
|
+
expect(screen.queryByText('Dmytro K title')).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('reserves the same stack width for two people and for five', () => {
|
|
67
|
+
const width = (count: number) => {
|
|
68
|
+
const { unmount } = render(<PeopleCell people={Array.from({ length: count }, (_, i) => person(`P${i} X`, i))} />);
|
|
69
|
+
// `hidden`: the stack is decorative (aria-hidden) beside the names.
|
|
70
|
+
const value = screen.getByRole('group', { hidden: true }).style.width;
|
|
71
|
+
unmount();
|
|
72
|
+
return value;
|
|
73
|
+
};
|
|
74
|
+
expect(width(2)).toBe('52px');
|
|
75
|
+
expect(width(5)).toBe('52px');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('AvatarStack', () => {
|
|
80
|
+
it('in slots mode shows slots-1 faces and a count for the rest', () => {
|
|
81
|
+
render(<AvatarStack size="sm" slots={2} people={[person('A'), person('B'), person('C')]} />);
|
|
82
|
+
expect(screen.getByText('+2')).toBeTruthy();
|
|
83
|
+
expect(screen.getAllByTitle(/^[ABC]$/)).toHaveLength(1);
|
|
84
|
+
});
|
|
85
|
+
it('fills every slot with a face when the people fit', () => {
|
|
86
|
+
render(<AvatarStack size="sm" slots={2} people={[person('A'), person('B')]} />);
|
|
87
|
+
expect(screen.queryByText(/^\+/)).toBeNull();
|
|
88
|
+
});
|
|
89
|
+
it('names the group after what the people are', () => {
|
|
90
|
+
render(<AvatarStack label="Hosts" people={[person('Ada'), person('Lin')]} />);
|
|
91
|
+
expect(screen.getByRole('group', { name: 'Hosts: Ada, Lin' })).toBeTruthy();
|
|
92
|
+
});
|
|
93
|
+
it('defaults the group name to Assignees', () => {
|
|
94
|
+
render(<AvatarStack people={[person('Ada')]} />);
|
|
95
|
+
expect(screen.getByRole('group', { name: 'Assignees: Ada' })).toBeTruthy();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -19,43 +19,66 @@ export interface AvatarStackPerson {
|
|
|
19
19
|
key?: string | number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
type AvatarStackSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
23
|
+
|
|
22
24
|
export interface AvatarStackProps {
|
|
23
25
|
people: AvatarStackPerson[];
|
|
24
|
-
/** Avatars shown before collapsing into the "+N" circle. */
|
|
26
|
+
/** Avatars shown before collapsing into the "+N" circle. Ignored when `slots` is set. */
|
|
25
27
|
max?: number;
|
|
28
|
+
/**
|
|
29
|
+
* FIXED-WIDTH mode: the stack always occupies exactly `slots` positions, the
|
|
30
|
+
* "+N" circle counting as one. Up to `slots` people show as faces; more show
|
|
31
|
+
* `slots - 1` faces and the circle. Use it wherever rows must line up (a
|
|
32
|
+
* table column): the width no longer depends on how many people a row holds,
|
|
33
|
+
* so the text beside every stack starts at the same x.
|
|
34
|
+
*/
|
|
35
|
+
slots?: number;
|
|
26
36
|
/** Size bucket (also sizes the "+N" circle). `xs` (24px) is for
|
|
27
37
|
* dense card meta rows (chat compact cards, delivery rows). */
|
|
28
|
-
size?:
|
|
38
|
+
size?: AvatarStackSize;
|
|
29
39
|
/** Ring color class separating overlapped avatars from each other —
|
|
30
40
|
* MUST match the surface the stack sits on (default: card surface).
|
|
31
41
|
* Without the surface-colored ring, overlapping photos read as one
|
|
32
42
|
* smeared blob — the ring is what makes a stack look deliberate. */
|
|
33
43
|
ringClassName?: string;
|
|
44
|
+
/** What these people ARE, for the group's accessible name ("Hosts: Ada, Lin").
|
|
45
|
+
* Default "Assignees". */
|
|
46
|
+
label?: string;
|
|
34
47
|
className?: string;
|
|
35
48
|
}
|
|
36
49
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
/** Face diameter and how far each later face tucks under the previous one — the
|
|
51
|
+
* `SquareAvatar` buckets and the `-ml-*` classes below, in px, for `slots`. */
|
|
52
|
+
const SIZE_PX: Record<AvatarStackSize, number> = { xs: 24, sm: 32, md: 40, lg: 48 };
|
|
53
|
+
const OVERLAP_PX: Record<AvatarStackSize, number> = { xs: 8, sm: 12, md: 12, lg: 12 };
|
|
54
|
+
|
|
55
|
+
const OVERFLOW_CIRCLE_SIZE: Record<AvatarStackSize, string> = {
|
|
56
|
+
xs: 'h-6 min-w-6',
|
|
57
|
+
sm: 'h-8 min-w-8',
|
|
58
|
+
md: 'h-10 min-w-10',
|
|
59
|
+
lg: 'h-12 min-w-12',
|
|
42
60
|
};
|
|
43
61
|
|
|
44
62
|
export function AvatarStack({
|
|
45
63
|
people,
|
|
46
64
|
max = 3,
|
|
65
|
+
slots,
|
|
47
66
|
size = 'md',
|
|
48
67
|
ringClassName = 'ring-ods-card',
|
|
68
|
+
label = 'Assignees',
|
|
49
69
|
className,
|
|
50
70
|
}: AvatarStackProps) {
|
|
51
71
|
if (people.length === 0) return null;
|
|
52
|
-
const
|
|
53
|
-
const
|
|
72
|
+
const faces = slots ? (people.length > slots ? slots - 1 : slots) : max;
|
|
73
|
+
const visible = people.slice(0, faces);
|
|
74
|
+
const overflow = people.slice(faces);
|
|
75
|
+
const compact = size === 'xs';
|
|
54
76
|
return (
|
|
55
77
|
<div
|
|
56
|
-
className={cn('flex items-center', className)}
|
|
78
|
+
className={cn('flex items-center', slots && 'shrink-0', className)}
|
|
79
|
+
style={slots ? { width: SIZE_PX[size] + (slots - 1) * (SIZE_PX[size] - OVERLAP_PX[size]) } : undefined}
|
|
57
80
|
role="group"
|
|
58
|
-
aria-label={
|
|
81
|
+
aria-label={`${label}: ${people.map(p => p.name).join(', ')}`}
|
|
59
82
|
>
|
|
60
83
|
{visible.map((person, i) => (
|
|
61
84
|
<SquareAvatar
|
|
@@ -66,7 +89,7 @@ export function AvatarStack({
|
|
|
66
89
|
alt={person.name}
|
|
67
90
|
fallback={person.name}
|
|
68
91
|
title={person.name}
|
|
69
|
-
className={cn('relative ring-2', ringClassName, i > 0 && (
|
|
92
|
+
className={cn('relative ring-2', ringClassName, i > 0 && (compact ? '-ml-2' : '-ml-3'))}
|
|
70
93
|
// Leftmost (primary assignee) on TOP — later avatars tuck
|
|
71
94
|
// BEHIND, so the first face is always fully visible.
|
|
72
95
|
style={{ zIndex: visible.length - i }}
|
|
@@ -78,7 +101,11 @@ export function AvatarStack({
|
|
|
78
101
|
className={cn(
|
|
79
102
|
'relative z-0 flex shrink-0 items-center justify-center rounded-full bg-ods-bg text-ods-text-secondary ring-2',
|
|
80
103
|
ringClassName,
|
|
81
|
-
|
|
104
|
+
// The circle tucks under the last face like every other avatar, so
|
|
105
|
+
// its left edge is covered: the left padding equals that overlap,
|
|
106
|
+
// centering "+N" in the part that shows. `min-w` (not a fixed
|
|
107
|
+
// width) lets a two-digit count widen the circle instead of clipping.
|
|
108
|
+
compact ? '-ml-2 pl-2 pr-1 text-badge' : '-ml-3 pl-3 pr-1.5 text-h6',
|
|
82
109
|
OVERFLOW_CIRCLE_SIZE[size],
|
|
83
110
|
)}
|
|
84
111
|
>
|
|
@@ -4,6 +4,7 @@ import { flexRender, type Header } from '@tanstack/react-table';
|
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
5
|
import { cn } from '../../../utils/cn';
|
|
6
6
|
import { Arrow01DownIcon, Arrow01UpIcon, SwitchVrIcon } from '../../icons-v2-generated';
|
|
7
|
+
import { InfoHint } from '../info-hint';
|
|
7
8
|
import { useDataTableContext } from './data-table';
|
|
8
9
|
import { DataTableColumnFilter } from './data-table-column-filter';
|
|
9
10
|
import type { TailwindBreakpoint } from './types';
|
|
@@ -217,6 +218,17 @@ function HeaderCell({ header, sort, onSortChange }: HeaderCellProps) {
|
|
|
217
218
|
// the `sort` prop; we do not consult TanStack's sort APIs here.
|
|
218
219
|
const canSort = meta?.sortable === true;
|
|
219
220
|
const sortDir: false | 'asc' | 'desc' = sort?.id === column.id ? (sort.desc ? 'desc' : 'asc') : false;
|
|
221
|
+
// Built once: rendered bare, or beside the column's hint.
|
|
222
|
+
const filterTrigger = filter ? (
|
|
223
|
+
<DataTableColumnFilter
|
|
224
|
+
column={column}
|
|
225
|
+
options={filter.options}
|
|
226
|
+
placement={filter.placement}
|
|
227
|
+
pending={filter.pending}
|
|
228
|
+
label={resolveHeaderLabel(header)}
|
|
229
|
+
align={align}
|
|
230
|
+
/>
|
|
231
|
+
) : null;
|
|
220
232
|
|
|
221
233
|
return (
|
|
222
234
|
<div
|
|
@@ -247,15 +259,18 @@ function HeaderCell({ header, sort, onSortChange }: HeaderCellProps) {
|
|
|
247
259
|
meta?.headerClassName,
|
|
248
260
|
)}
|
|
249
261
|
>
|
|
250
|
-
{
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
262
|
+
{filterTrigger ? (
|
|
263
|
+
// Only a column that HAS a hint gets the extra row, so every existing
|
|
264
|
+
// filter header keeps its exact structure — the trigger stays a direct
|
|
265
|
+
// child of the cell.
|
|
266
|
+
meta?.hint ? (
|
|
267
|
+
<div className="flex items-start gap-[var(--spacing-system-xxs)]">
|
|
268
|
+
{filterTrigger}
|
|
269
|
+
<InfoHint label={resolveHeaderLabel(header)}>{meta.hint}</InfoHint>
|
|
270
|
+
</div>
|
|
271
|
+
) : (
|
|
272
|
+
filterTrigger
|
|
273
|
+
)
|
|
259
274
|
) : (
|
|
260
275
|
<div
|
|
261
276
|
className={cn(
|
|
@@ -269,7 +284,20 @@ function HeaderCell({ header, sort, onSortChange }: HeaderCellProps) {
|
|
|
269
284
|
)}
|
|
270
285
|
onClick={canSort ? () => onSortChange?.(column.id) : undefined}
|
|
271
286
|
>
|
|
272
|
-
|
|
287
|
+
{meta?.hint ? (
|
|
288
|
+
// The hint shares a LABEL GROUP with the text, pinned to the FIRST
|
|
289
|
+
// line (`items-start`): on a label that breaks onto a second line it
|
|
290
|
+
// reads beside the opening word instead of floating in the gap
|
|
291
|
+
// between the two. Only a column WITH a hint gets the group, so a
|
|
292
|
+
// hint-less header keeps its DOM. The sort icon stays outside it,
|
|
293
|
+
// centred on the row.
|
|
294
|
+
<span className="flex min-w-0 items-start gap-[var(--spacing-system-xxs)]">
|
|
295
|
+
<HeaderLabel header={header} />
|
|
296
|
+
<InfoHint label={resolveHeaderLabel(header)}>{meta.hint}</InfoHint>
|
|
297
|
+
</span>
|
|
298
|
+
) : (
|
|
299
|
+
<HeaderLabel header={header} />
|
|
300
|
+
)}
|
|
273
301
|
{canSort && <SortIcon sorted={sortDir} />}
|
|
274
302
|
</div>
|
|
275
303
|
)}
|
|
@@ -281,9 +309,17 @@ function HeaderCell({ header, sort, onSortChange }: HeaderCellProps) {
|
|
|
281
309
|
* THE header label styling. Exported because a column may supply a NODE header
|
|
282
310
|
* (an icon beside the text), and without this those headers rendered unstyled
|
|
283
311
|
* beside the string ones — same row, two different type treatments.
|
|
312
|
+
*
|
|
313
|
+
* The label WRAPS inside its own cell (`min-w-0`, no `whitespace-nowrap`). A
|
|
314
|
+
* nowrapped label longer than its column does not truncate — it paints straight
|
|
315
|
+
* across the next column's header, which is how "Implementation owners" landed
|
|
316
|
+
* on top of "Updated". `text-balance` makes the break a GOOD one: the lines come
|
|
317
|
+
* out even ("IMPLEMENTATION / OWNERS") instead of one word stranded on its own.
|
|
318
|
+
* Two lines of the 20px label still fit the fixed 48px header, and a label that
|
|
319
|
+
* fits on one line looks exactly as it did.
|
|
284
320
|
*/
|
|
285
321
|
export const DATA_TABLE_HEADER_LABEL_CLASS =
|
|
286
|
-
'
|
|
322
|
+
'min-w-0 text-balance uppercase text-ods-text-secondary transition-colors duration-200 text-h5 group-hover:text-ods-text-primary';
|
|
287
323
|
|
|
288
324
|
function HeaderLabel({ header }: { header: AnyHeader }) {
|
|
289
325
|
const headerDef = header.column.columnDef.header;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RowData } from '@tanstack/react-table';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
export type TailwindBreakpoint = 'md' | 'lg' | 'xl' | '2xl';
|
|
4
5
|
|
|
@@ -61,5 +62,13 @@ declare module '@tanstack/react-table' {
|
|
|
61
62
|
cellClassName?: string;
|
|
62
63
|
/** Extra class names applied to the header cell wrapper. */
|
|
63
64
|
headerClassName?: string;
|
|
65
|
+
/**
|
|
66
|
+
* A definition shown in an `InfoHint` beside the header label — for a
|
|
67
|
+
* column whose NAME is a term of art a reader may not know. The header owns
|
|
68
|
+
* the icon, its spacing and its accessible name (`About <label>`), so every
|
|
69
|
+
* table explains a column the same way instead of each hand-rolling a node
|
|
70
|
+
* header to fit one in.
|
|
71
|
+
*/
|
|
72
|
+
hint?: ReactNode;
|
|
64
73
|
}
|
|
65
74
|
}
|
|
@@ -115,6 +115,7 @@ export * from './page-actions';
|
|
|
115
115
|
export * from './service-card';
|
|
116
116
|
export * from './slider';
|
|
117
117
|
export * from './avatar-stack';
|
|
118
|
+
export * from './people-cell';
|
|
118
119
|
export * from './deleted-user-avatar';
|
|
119
120
|
export * from './square-avatar';
|
|
120
121
|
export * from './tab-selector';
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { personFirstName } from '../../utils/format';
|
|
4
|
+
import { AvatarStack } from './avatar-stack';
|
|
5
|
+
import { Button } from './button';
|
|
6
|
+
import { FloatingTooltip } from './floating-tooltip';
|
|
7
|
+
import { SquareAvatar } from './square-avatar';
|
|
8
|
+
import { TruncateText } from './truncate-text';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* THE person cells for tables and dense lists — one for a single person, one
|
|
12
|
+
* for a column that may hold several — so every column of people in every app
|
|
13
|
+
* reads the same way.
|
|
14
|
+
*
|
|
15
|
+
* - `PersonCell` → avatar, name, then a second line (a title, an email)
|
|
16
|
+
* - `PeopleCell` → zero or one person IS `PersonCell`; several become an
|
|
17
|
+
* `AvatarStack` in a FIXED two-position slot beside their
|
|
18
|
+
* first names ("Dmytro & Michael & Ilona") across both
|
|
19
|
+
* lines. A title per person does not fit, and the names are
|
|
20
|
+
* what the column is read for; the tooltip carries the full
|
|
21
|
+
* names. The fixed slot keeps every multi-person row's names
|
|
22
|
+
* on the same x, whether it holds two people or twelve.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export interface PersonCellProps {
|
|
26
|
+
name?: string | null;
|
|
27
|
+
avatarUrl?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The second line: a job title, an email, a department. Omitted keeps the
|
|
30
|
+
* two-line height with an empty line; `null` or `''` (a value that is
|
|
31
|
+
* expected but missing) renders a `·` placeholder.
|
|
32
|
+
*/
|
|
33
|
+
secondary?: string | null;
|
|
34
|
+
/** Shown when there is no name — "Unassigned", "Unknown", … */
|
|
35
|
+
fallbackName?: string;
|
|
36
|
+
/** Makes the whole cell a button and the name an accent link (e.g. filter by this person). */
|
|
37
|
+
onClick?: () => void;
|
|
38
|
+
/** Tooltip for the clickable cell ("Filter by ada@example.com"). */
|
|
39
|
+
actionTitle?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function PersonCell({
|
|
43
|
+
name,
|
|
44
|
+
avatarUrl,
|
|
45
|
+
secondary,
|
|
46
|
+
fallbackName = 'Unassigned',
|
|
47
|
+
onClick,
|
|
48
|
+
actionTitle,
|
|
49
|
+
}: PersonCellProps) {
|
|
50
|
+
const displayName = name || fallbackName;
|
|
51
|
+
const row = (
|
|
52
|
+
<div className="group/person-cell flex min-w-0 items-center gap-3">
|
|
53
|
+
<SquareAvatar size="sm" src={avatarUrl ?? undefined} alt={displayName} fallback={displayName} />
|
|
54
|
+
<div className="min-w-0 flex-1">
|
|
55
|
+
<TruncateText
|
|
56
|
+
variant="h6"
|
|
57
|
+
className={onClick ? 'text-ods-accent group-hover/person-cell:underline' : undefined}
|
|
58
|
+
>
|
|
59
|
+
{displayName}
|
|
60
|
+
</TruncateText>
|
|
61
|
+
<TruncateText variant="h6" tone="secondary">
|
|
62
|
+
{secondary === undefined ? ' ' : secondary || '·'}
|
|
63
|
+
</TruncateText>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
if (!onClick) return row;
|
|
68
|
+
return (
|
|
69
|
+
<Button
|
|
70
|
+
variant="transparent"
|
|
71
|
+
onClick={onClick}
|
|
72
|
+
title={actionTitle}
|
|
73
|
+
// No hover background — only the name underlines. `text-left`: a button
|
|
74
|
+
// centers its text by default, which would center the second line.
|
|
75
|
+
className="h-auto w-full min-w-0 cursor-pointer justify-start bg-transparent p-0 text-left hover:bg-transparent focus:bg-transparent"
|
|
76
|
+
>
|
|
77
|
+
{row}
|
|
78
|
+
</Button>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface PeopleCellPerson {
|
|
83
|
+
/** Stable render key (a profile id) — names can collide or be blank. */
|
|
84
|
+
key?: string | number;
|
|
85
|
+
name?: string | null;
|
|
86
|
+
avatarUrl?: string | null;
|
|
87
|
+
/** The single-person second line — see `PersonCellProps.secondary`. */
|
|
88
|
+
secondary?: string | null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface PeopleCellProps {
|
|
92
|
+
people: PeopleCellPerson[];
|
|
93
|
+
/** Shown when the list is empty — the same slot `PersonCell` fills. */
|
|
94
|
+
fallbackName?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Positions the multi-person stack reserves: two faces, or one face and "+N". */
|
|
98
|
+
const PEOPLE_CELL_STACK_SLOTS = 2;
|
|
99
|
+
|
|
100
|
+
export function PeopleCell({ people, fallbackName = 'Unassigned' }: PeopleCellProps) {
|
|
101
|
+
if (people.length <= 1) {
|
|
102
|
+
const [person] = people;
|
|
103
|
+
return (
|
|
104
|
+
<PersonCell
|
|
105
|
+
name={person?.name}
|
|
106
|
+
avatarUrl={person?.avatarUrl}
|
|
107
|
+
secondary={person ? person.secondary : undefined}
|
|
108
|
+
fallbackName={fallbackName}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
const fullNames = people.map(p => p.name || 'Unknown').join(', ');
|
|
113
|
+
return (
|
|
114
|
+
<FloatingTooltip content={fullNames} triggerClassName="min-w-0 max-w-full">
|
|
115
|
+
{/* Same gap and two-line height as `PersonCell`, so the two sit on one rhythm. */}
|
|
116
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
117
|
+
{/* Decorative here: the names are the text right beside it, so the
|
|
118
|
+
stack's own accessible name would read every name twice. */}
|
|
119
|
+
<div aria-hidden className="shrink-0">
|
|
120
|
+
<AvatarStack
|
|
121
|
+
size="sm"
|
|
122
|
+
slots={PEOPLE_CELL_STACK_SLOTS}
|
|
123
|
+
people={people.map(p => ({ key: p.key, name: p.name || 'Unknown', avatarUrl: p.avatarUrl }))}
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
<p className="line-clamp-2 min-w-0 flex-1 break-words text-ods-text-primary text-h6">
|
|
127
|
+
<span aria-hidden>{people.map(p => personFirstName(p.name, 'Unknown')).join(' & ')}</span>
|
|
128
|
+
<span className="sr-only">{fullNames}</span>
|
|
129
|
+
</p>
|
|
130
|
+
</div>
|
|
131
|
+
</FloatingTooltip>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { Table } from '../table';
|
|
5
|
+
import type { TableColumn } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Two header behaviours a screen used to hand-roll per table, pinned at the
|
|
9
|
+
* primitive so every table gets them:
|
|
10
|
+
*
|
|
11
|
+
* · `column.hint` draws the header's definition in an InfoHint, named after
|
|
12
|
+
* the column (`About <label>`).
|
|
13
|
+
* · the label WRAPS inside its cell. A nowrapped label longer than its column
|
|
14
|
+
* does not truncate — it paints across the next column's header.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface Row {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const data: Row[] = [{ id: '1', name: 'Alpha' }];
|
|
23
|
+
|
|
24
|
+
// The header only draws plain columns from lg up; the global setup stubs the
|
|
25
|
+
// narrow branch, so this file opts into the wide one for its own cases.
|
|
26
|
+
const realMatchMedia = window.matchMedia;
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
window.matchMedia = (query: string) => ({
|
|
29
|
+
matches: true,
|
|
30
|
+
media: query,
|
|
31
|
+
onchange: null,
|
|
32
|
+
addEventListener: () => {},
|
|
33
|
+
removeEventListener: () => {},
|
|
34
|
+
addListener: () => {},
|
|
35
|
+
removeListener: () => {},
|
|
36
|
+
dispatchEvent: () => false,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
window.matchMedia = realMatchMedia;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('Table column hint', () => {
|
|
44
|
+
it('draws the definition beside the label, named after the column', () => {
|
|
45
|
+
const columns: TableColumn<Row>[] = [
|
|
46
|
+
{ key: 'name', label: 'Implementation owners', hint: 'Engineers building it.' },
|
|
47
|
+
];
|
|
48
|
+
render(<Table data={data} columns={columns} rowKey="id" />);
|
|
49
|
+
expect(screen.getByRole('button', { name: 'About Implementation owners' })).toBeTruthy();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('draws nothing extra for a column without a hint', () => {
|
|
53
|
+
const columns: TableColumn<Row>[] = [{ key: 'name', label: 'Name' }];
|
|
54
|
+
render(<Table data={data} columns={columns} rowKey="id" />);
|
|
55
|
+
expect(screen.queryByRole('button', { name: /^About / })).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('leaves a custom renderHeader in charge of its whole contents', () => {
|
|
59
|
+
const columns: TableColumn<Row>[] = [
|
|
60
|
+
{ key: 'name', label: 'Name', hint: 'ignored', renderHeader: () => <span>Custom</span> },
|
|
61
|
+
];
|
|
62
|
+
render(<Table data={data} columns={columns} rowKey="id" />);
|
|
63
|
+
expect(screen.queryByRole('button', { name: 'About Name' })).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('lets a long label wrap inside its cell instead of painting across the next one', () => {
|
|
67
|
+
const columns: TableColumn<Row>[] = [{ key: 'name', label: 'Implementation owners', width: 'w-32' }];
|
|
68
|
+
render(<Table data={data} columns={columns} rowKey="id" />);
|
|
69
|
+
const label = screen.getAllByText('Implementation owners')[0];
|
|
70
|
+
expect(label.className).not.toContain('whitespace-nowrap');
|
|
71
|
+
expect(label.className).toContain('min-w-0');
|
|
72
|
+
// A GOOD break: even lines, never one word stranded on its own.
|
|
73
|
+
expect(label.className).toContain('text-balance');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('pins the hint to the first line of a label that breaks onto two', () => {
|
|
77
|
+
const columns: TableColumn<Row>[] = [
|
|
78
|
+
{ key: 'name', label: 'Implementation owners', hint: 'Engineers building it.' },
|
|
79
|
+
];
|
|
80
|
+
// The assertion is about a CLASS reaching the DOM, which has no
|
|
81
|
+
// accessible-name equivalent to query by — the actions-column test's shape.
|
|
82
|
+
const { container } = render(<Table data={data} columns={columns} rowKey="id" />);
|
|
83
|
+
expect(container.innerHTML).toContain('flex min-w-0 items-start gap-[var(--spacing-system-xxs)]');
|
|
84
|
+
});
|
|
85
|
+
});
|