@flamingo-stack/openframe-frontend-core 0.0.616 → 0.0.617

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 (104) hide show
  1. package/dist/{chunk-KIQNMCOO.cjs → chunk-2OJVGAGX.cjs} +4 -4
  2. package/dist/{chunk-KIQNMCOO.cjs.map → chunk-2OJVGAGX.cjs.map} +1 -1
  3. package/dist/{chunk-TDA355L7.cjs → chunk-332JHI2D.cjs} +3 -3
  4. package/dist/{chunk-TDA355L7.cjs.map → chunk-332JHI2D.cjs.map} +1 -1
  5. package/dist/{chunk-A6ZMLRBR.js → chunk-45OAW4M2.js} +4 -4
  6. package/dist/{chunk-RRGQTQ6T.js → chunk-5KKLN7Q2.js} +2 -2
  7. package/dist/{chunk-N3G3YG3V.cjs → chunk-67XFJ442.cjs} +271 -235
  8. package/dist/chunk-67XFJ442.cjs.map +1 -0
  9. package/dist/{chunk-L3H6VYDB.js → chunk-6RMFEGJ4.js} +2 -2
  10. package/dist/{chunk-5WHUUHSH.cjs → chunk-7FFKXXWY.cjs} +50 -50
  11. package/dist/{chunk-5WHUUHSH.cjs.map → chunk-7FFKXXWY.cjs.map} +1 -1
  12. package/dist/{chunk-TOAJWB3V.js → chunk-7YHUP5BR.js} +2 -2
  13. package/dist/{chunk-F7R7J4HK.cjs → chunk-BJDQZH62.cjs} +3 -3
  14. package/dist/{chunk-F7R7J4HK.cjs.map → chunk-BJDQZH62.cjs.map} +1 -1
  15. package/dist/{chunk-NLKYBYPV.js → chunk-CGCV4QT2.js} +5 -5
  16. package/dist/{chunk-XJ5KH37F.js → chunk-CXEGV3ZS.js} +2 -2
  17. package/dist/{chunk-H6TOSMGU.cjs → chunk-FMNS5NN2.cjs} +13 -13
  18. package/dist/{chunk-H6TOSMGU.cjs.map → chunk-FMNS5NN2.cjs.map} +1 -1
  19. package/dist/{chunk-4C3BOBV6.js → chunk-GH4F4ODL.js} +4 -4
  20. package/dist/{chunk-UMVCVMCG.js → chunk-HGPGF6SF.js} +2 -2
  21. package/dist/{chunk-L6UVTIJP.cjs → chunk-HR6CHKD6.cjs} +4 -4
  22. package/dist/{chunk-L6UVTIJP.cjs.map → chunk-HR6CHKD6.cjs.map} +1 -1
  23. package/dist/{chunk-YSG26SQ7.cjs → chunk-JZELYIFZ.cjs} +33 -33
  24. package/dist/{chunk-YSG26SQ7.cjs.map → chunk-JZELYIFZ.cjs.map} +1 -1
  25. package/dist/{chunk-NLYWRJ6J.cjs → chunk-LFLJ3IHE.cjs} +17 -17
  26. package/dist/{chunk-NLYWRJ6J.cjs.map → chunk-LFLJ3IHE.cjs.map} +1 -1
  27. package/dist/{chunk-HIMST6NK.js → chunk-RZURBPBS.js} +2 -2
  28. package/dist/{chunk-BESOUYM7.cjs → chunk-TRY3CUWJ.cjs} +18 -18
  29. package/dist/{chunk-BESOUYM7.cjs.map → chunk-TRY3CUWJ.cjs.map} +1 -1
  30. package/dist/{chunk-TOXJS4HN.cjs → chunk-ULM5FCFN.cjs} +3 -3
  31. package/dist/{chunk-TOXJS4HN.cjs.map → chunk-ULM5FCFN.cjs.map} +1 -1
  32. package/dist/{chunk-X6G7JIX6.cjs → chunk-USP3UWID.cjs} +34 -34
  33. package/dist/{chunk-X6G7JIX6.cjs.map → chunk-USP3UWID.cjs.map} +1 -1
  34. package/dist/{chunk-OKWHWDA3.js → chunk-UVK7AQAG.js} +2 -2
  35. package/dist/{chunk-646YZIUK.js → chunk-UVXMIZYK.js} +5 -5
  36. package/dist/{chunk-RJT7I2Y4.cjs → chunk-V23BJC2Q.cjs} +10 -10
  37. package/dist/{chunk-RJT7I2Y4.cjs.map → chunk-V23BJC2Q.cjs.map} +1 -1
  38. package/dist/{chunk-AJRHEX5D.js → chunk-VHS3OYE4.js} +61 -25
  39. package/dist/chunk-VHS3OYE4.js.map +1 -0
  40. package/dist/{chunk-JYHDJD3U.js → chunk-VJJ7LGOI.js} +3 -3
  41. package/dist/{chunk-GHMTJJCC.cjs → chunk-VNNIRX23.cjs} +3 -3
  42. package/dist/{chunk-GHMTJJCC.cjs.map → chunk-VNNIRX23.cjs.map} +1 -1
  43. package/dist/{chunk-KKYE3E66.js → chunk-WFM5OAM6.js} +2 -2
  44. package/dist/{chunk-TWE6KYQM.js → chunk-ZJYZOOTU.js} +2 -2
  45. package/dist/{chunk-FBL32U6S.cjs → chunk-ZQOK4TCN.cjs} +17 -17
  46. package/dist/{chunk-FBL32U6S.cjs.map → chunk-ZQOK4TCN.cjs.map} +1 -1
  47. package/dist/components/case-studies/index.cjs +8 -8
  48. package/dist/components/case-studies/index.js +2 -2
  49. package/dist/components/contact/index.cjs +3 -3
  50. package/dist/components/contact/index.js +2 -2
  51. package/dist/components/docs/index.cjs +6 -6
  52. package/dist/components/docs/index.js +5 -5
  53. package/dist/components/embeds/index.cjs +3 -3
  54. package/dist/components/embeds/index.js +2 -2
  55. package/dist/components/faq/index.cjs +3 -3
  56. package/dist/components/faq/index.js +2 -2
  57. package/dist/components/features/index.cjs +2 -2
  58. package/dist/components/features/index.js +1 -1
  59. package/dist/components/help-center-pages/index.cjs +22 -22
  60. package/dist/components/help-center-pages/index.js +13 -13
  61. package/dist/components/index.cjs +31 -31
  62. package/dist/components/index.js +12 -12
  63. package/dist/components/meeting-scheduler/index.cjs +21 -21
  64. package/dist/components/meeting-scheduler/index.js +1 -1
  65. package/dist/components/navigation/index.cjs +5 -5
  66. package/dist/components/navigation/index.js +4 -4
  67. package/dist/components/onboarding-guides/index.cjs +5 -5
  68. package/dist/components/onboarding-guides/index.js +4 -4
  69. package/dist/components/tickets/index.cjs +6 -6
  70. package/dist/components/tickets/index.js +5 -5
  71. package/dist/components/ui/data-table/data-table-header.d.ts +9 -1
  72. package/dist/components/ui/data-table/data-table-header.d.ts.map +1 -1
  73. package/dist/components/ui/data-table/types.d.ts +9 -0
  74. package/dist/components/ui/data-table/types.d.ts.map +1 -1
  75. package/dist/components/ui/index.cjs +2 -2
  76. package/dist/components/ui/index.js +1 -1
  77. package/dist/components/ui/table/table-header.d.ts.map +1 -1
  78. package/dist/components/ui/table/types.d.ts +7 -0
  79. package/dist/components/ui/table/types.d.ts.map +1 -1
  80. package/dist/index.cjs +6 -6
  81. package/dist/index.js +5 -5
  82. package/package.json +1 -1
  83. package/src/__tests__/data-table-header-hint.test.tsx +69 -0
  84. package/src/components/ui/data-table/data-table-header.tsx +47 -11
  85. package/src/components/ui/data-table/types.ts +9 -0
  86. package/src/components/ui/table/__tests__/header-hint.test.tsx +85 -0
  87. package/src/components/ui/table/table-header.tsx +34 -9
  88. package/src/components/ui/table/types.ts +7 -0
  89. package/dist/chunk-AJRHEX5D.js.map +0 -1
  90. package/dist/chunk-N3G3YG3V.cjs.map +0 -1
  91. /package/dist/{chunk-A6ZMLRBR.js.map → chunk-45OAW4M2.js.map} +0 -0
  92. /package/dist/{chunk-RRGQTQ6T.js.map → chunk-5KKLN7Q2.js.map} +0 -0
  93. /package/dist/{chunk-L3H6VYDB.js.map → chunk-6RMFEGJ4.js.map} +0 -0
  94. /package/dist/{chunk-TOAJWB3V.js.map → chunk-7YHUP5BR.js.map} +0 -0
  95. /package/dist/{chunk-NLKYBYPV.js.map → chunk-CGCV4QT2.js.map} +0 -0
  96. /package/dist/{chunk-XJ5KH37F.js.map → chunk-CXEGV3ZS.js.map} +0 -0
  97. /package/dist/{chunk-4C3BOBV6.js.map → chunk-GH4F4ODL.js.map} +0 -0
  98. /package/dist/{chunk-UMVCVMCG.js.map → chunk-HGPGF6SF.js.map} +0 -0
  99. /package/dist/{chunk-HIMST6NK.js.map → chunk-RZURBPBS.js.map} +0 -0
  100. /package/dist/{chunk-OKWHWDA3.js.map → chunk-UVK7AQAG.js.map} +0 -0
  101. /package/dist/{chunk-646YZIUK.js.map → chunk-UVXMIZYK.js.map} +0 -0
  102. /package/dist/{chunk-JYHDJD3U.js.map → chunk-VJJ7LGOI.js.map} +0 -0
  103. /package/dist/{chunk-KKYE3E66.js.map → chunk-WFM5OAM6.js.map} +0 -0
  104. /package/dist/{chunk-TWE6KYQM.js.map → chunk-ZJYZOOTU.js.map} +0 -0
@@ -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
- {filter ? (
251
- <DataTableColumnFilter
252
- column={column}
253
- options={filter.options}
254
- placement={filter.placement}
255
- pending={filter.pending}
256
- label={resolveHeaderLabel(header)}
257
- align={align}
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
- <HeaderLabel header={header} />
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
- 'whitespace-nowrap uppercase text-ods-text-secondary transition-colors duration-200 text-h5 group-hover:text-ods-text-primary';
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
  }
@@ -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
+ })) as typeof window.matchMedia;
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
+ });
@@ -6,8 +6,12 @@ import { Arrow01DownIcon } from '../../icons-v2-generated/arrows/arrow-01-down-i
6
6
  import { Arrow01UpIcon } from '../../icons-v2-generated/arrows/arrow-01-up-icon';
7
7
  import { SwitchVrIcon } from '../../icons-v2-generated/arrows/switch-vr-icon';
8
8
  import { Checkbox } from '../checkbox';
9
+ import { InfoHint } from '../info-hint';
9
10
  import { TableColumnFilterDropdown } from './table-column-filter-dropdown';
10
11
  import type { TableColumn, TableHeaderProps, TableRowData } from './types';
12
+
13
+ /** The default header label: wraps inside its cell with a balanced split. */
14
+ const TABLE_HEADER_LABEL_CLASS = 'min-w-0 text-balance uppercase text-ods-text-secondary text-h5';
11
15
  import { getHideClasses } from './utils';
12
16
 
13
17
  /** @deprecated Use `DataTableHeader` from `data-table` instead. */
@@ -120,18 +124,23 @@ export function TableHeader<T = TableRowData>({
120
124
  )
121
125
  ) : column.filterable && column.filterOptions && onFilterChange ? (
122
126
  /* Filterable column — label + icon are both inside the dropdown trigger */
123
- <TableColumnFilterDropdown
124
- columnKey={column.key}
125
- columnLabel={column.label}
126
- filterOptions={column.filterOptions}
127
- filters={filters}
128
- onFilterChange={onFilterChange}
129
- />
127
+ <>
128
+ <TableColumnFilterDropdown
129
+ columnKey={column.key}
130
+ columnLabel={column.label}
131
+ filterOptions={column.filterOptions}
132
+ filters={filters}
133
+ onFilterChange={onFilterChange}
134
+ />
135
+ {column.hint ? <InfoHint label={column.label}>{column.hint}</InfoHint> : null}
136
+ </>
130
137
  ) : (
131
138
  /* Non-filterable column — regular label with optional sort */
132
139
  <div
133
140
  className={cn(
134
- 'flex items-center gap-2',
141
+ // `min-w-0` lets the row shrink to its column, so a long label
142
+ // wraps inside the cell instead of forcing the row past it.
143
+ 'flex min-w-0 items-center gap-2',
135
144
  column.sortable && 'cursor-pointer transition-colors hover:text-ods-text-primary',
136
145
  )}
137
146
  onClick={() => handleSort(column)}
@@ -143,7 +152,23 @@ export function TableHeader<T = TableRowData>({
143
152
  </>
144
153
  ) : (
145
154
  <>
146
- <span className="whitespace-nowrap uppercase text-ods-text-secondary text-h5">{column.label}</span>
155
+ {/* Wraps inside the cell, with a BALANCED split — "IMPLEMENTATION
156
+ / OWNERS", never one word stranded on a line of its own. A
157
+ nowrapped label longer than its column paints straight
158
+ across the next column's header. */}
159
+ {column.hint ? (
160
+ /* The hint sits in a LABEL GROUP with the text, pinned to the
161
+ FIRST line (`items-start`): on a label that breaks onto a
162
+ second line it reads beside the opening word instead of
163
+ floating in the gap between the two. Added only when a
164
+ hint exists, so a hint-less header keeps its DOM. */
165
+ <span className="flex min-w-0 items-start gap-[var(--spacing-system-xxs)]">
166
+ <span className={TABLE_HEADER_LABEL_CLASS}>{column.label}</span>
167
+ <InfoHint label={column.label}>{column.hint}</InfoHint>
168
+ </span>
169
+ ) : (
170
+ <span className={TABLE_HEADER_LABEL_CLASS}>{column.label}</span>
171
+ )}
147
172
  {getSortIcon(column)}
148
173
  </>
149
174
  )}
@@ -22,6 +22,13 @@ export interface TableColumn<T = TableRowData> {
22
22
  hideAt?: TailwindBreakpoint | TailwindBreakpoint[];
23
23
  renderCell?: (item: T, column: TableColumn<T>) => ReactNode;
24
24
  renderHeader?: () => ReactNode;
25
+ /**
26
+ * A definition shown in an `InfoHint` beside the header label. The header
27
+ * owns the icon, spacing and accessible name, so a column never needs a
28
+ * hand-rolled `renderHeader` just to explain itself. Ignored when
29
+ * `renderHeader` is set — a custom header owns its whole contents.
30
+ */
31
+ hint?: ReactNode;
25
32
  className?: string;
26
33
  // Sorting
27
34
  sortKey?: string;