playbook_ui 18.1.0 → 18.2.0.pre.rc.1

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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +1 -4
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +9 -5
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +28 -6
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +6 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +2 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +137 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.jsx +90 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.md +5 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +2 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -4
  14. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +16 -0
  15. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +184 -24
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.html.erb +58 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.md +10 -0
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.jsx +45 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.md +9 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.jsx +43 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.md +9 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.jsx +44 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.md +5 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.html.erb +44 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.md +5 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.jsx +64 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.md +5 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.html.erb +43 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.md +55 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.jsx +42 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.md +5 -0
  32. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.jsx +58 -0
  33. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.md +9 -0
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.html.erb +9 -0
  35. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.jsx +35 -0
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_rails.md +3 -0
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_react.md +3 -0
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +174 -3
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +154 -2
  40. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +11 -0
  41. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +7 -0
  42. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +1 -1
  43. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +12 -0
  44. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1344 -0
  45. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -1
  46. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +1 -0
  47. data/app/pb_kits/playbook/pb_dropdown/dropdown_index.test.js +1153 -0
  48. data/app/pb_kits/playbook/pb_dropdown/hooks/useAsyncOptions.ts +179 -0
  49. data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +21 -19
  50. data/app/pb_kits/playbook/pb_dropdown/index.js +494 -69
  51. data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +5 -3
  52. data/app/pb_kits/playbook/pb_dropdown/kit.schema.json +71 -1
  53. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +17 -3
  54. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +21 -7
  55. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +5 -2
  56. data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +9 -3
  57. data/app/pb_kits/playbook/pb_full_screen/_full_screen.scss +6 -1
  58. data/app/pb_kits/playbook/pb_full_screen/full_screen.test.jsx +19 -7
  59. data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +1 -1
  60. data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +1 -1
  61. data/app/pb_kits/playbook/pb_select/_select.scss +2 -2
  62. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  63. data/app/pb_kits/playbook/pb_text_input/add_on.html.erb +2 -2
  64. data/dist/ai/all-schemas.json +147 -5
  65. data/dist/ai/forms.json +1 -1
  66. data/dist/ai/index.json +2 -2
  67. data/dist/ai/kits/dropdown.schema.json +147 -5
  68. data/dist/ai/playgrounds/dropdown.json +1 -1
  69. data/dist/ai/playgrounds/index.json +1 -1
  70. data/dist/chunks/_detail-BqqzPTNr.js +5 -0
  71. data/dist/chunks/{_pb_line_graph-CUJ7NJIr.js → _pb_line_graph-BGyCJjgG.js} +1 -1
  72. data/dist/chunks/_table-CEZU0qUK.js +1 -0
  73. data/dist/chunks/_typeahead-C7iPR5ZF.js +1 -0
  74. data/dist/chunks/{globalProps-DDcpyjvz.js → globalProps-K1DCn3il.js} +1 -1
  75. data/dist/chunks/lib-7vm9BMqp.js +29 -0
  76. data/dist/chunks/{time_picker_helper-B_FN8E9Y.js → time_picker_helper-BZutIzB3.js} +1 -1
  77. data/dist/chunks/vendor.js +2 -2
  78. data/dist/menu.yml +1 -1
  79. data/dist/playbook-rails-react-bindings.js +1 -1
  80. data/dist/playbook-rails.js +1 -1
  81. data/dist/playbook.css +1 -1
  82. data/lib/playbook/version.rb +2 -2
  83. metadata +34 -9
  84. data/dist/chunks/_detail-CDUjsRrc.js +0 -5
  85. data/dist/chunks/_table-C9KHGQhb.js +0 -1
  86. data/dist/chunks/_typeahead-CfxZLhd3.js +0 -1
  87. data/dist/chunks/lib-D57mygNT.js +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4989243cbc32bb750918ef297467d634a7db628b51bbf211895e293f3d14feeb
4
- data.tar.gz: ee6a1cad85e386cd21a8d584c8715b97070f7a69b9ccb5cdb388f031cc1b7e81
3
+ metadata.gz: 5db309b02e5dd780da0f53f519c006634be2dd50e13553ce229ddd8be84a5527
4
+ data.tar.gz: dd7da084d43bf1060792d5dcc88dcc5fe2eaabe30d143f262083c80bef7f0a90
5
5
  SHA512:
6
- metadata.gz: 9823736cae61fe883d0210734d6c12163fae9a4d5e5b1f17ed8da990b5dbad5e816fc49374b672fe04bb3f1e6fc9b7c5704faf39f7119c170cad30954a6393f3
7
- data.tar.gz: c72caccadf7ab6a8f10fd9ee1197b06c1fba46a684f893b4f5d16525b91e6a69358aa51e1301fd7b9465127b34ac00c678263ed20258b2f90cc603443ea41243
6
+ metadata.gz: fcc52f997e3940eae2b3c00d36620ab00d2f44fddbce652671a6a3f6223877ce3cce1310d994e405dffad6fa92629727c8b1651a777cf379dd198a810ba1c93d
7
+ data.tar.gz: 18cd7637fe9d879a22a4df5505afda151de2e0a8f6bb02dc742016efe4bf4692bc2d08b50c88f078be99b0ea95c95e543dea5061489c4ffe9eada2799900a509
@@ -53,10 +53,7 @@ const TableCellRenderer = ({
53
53
  }
54
54
 
55
55
  const parent = cell.column.parent;
56
- if (!parent) {
57
- const last = row.getVisibleCells().at(-1);
58
- return last?.column.id === cell.column.id;
59
- }
56
+ if (!parent) return i !== 0;
60
57
 
61
58
  const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
62
59
  return visibleSiblings.at(-1)?.id === cell.column.id;
@@ -103,16 +103,20 @@ export const TableHeaderCell = ({
103
103
  col.getIsVisible?.() ||
104
104
  (Array.isArray(col.columns) &&
105
105
  col.columns.some((child: any) => columnHasVisibleLeaf(child)));
106
-
107
- // Check on column position in stack + visibility to add the vertical border
106
+
107
+ // Check on column position in stack + visibility to add the vertical border
108
108
  const isLastHeaderCell = (() => {
109
109
  if (!header) return false;
110
-
110
+
111
111
  if (header.colSpan > 1 && header.column.parent !== undefined) return true;
112
112
  const parent = header.column.parent;
113
-
113
+
114
114
  if (!parent) {
115
- const topHeaders = table?.getHeaderGroups()[0].headers.filter((h: any) => columnHasVisibleLeaf(h.column));
115
+ const headerGroups = table?.getHeaderGroups() ?? [];
116
+ const isSubheader = (header.headerGroup?.depth ?? 0) > 0;
117
+ if (isSubheader && headerGroups.length > 1 && header.index !== 0) return true;
118
+
119
+ const topHeaders = headerGroups[0]?.headers.filter((item: any) => columnHasVisibleLeaf(item.column));
116
120
  return topHeaders?.at(-1)?.id === header.id;
117
121
  }
118
122
  const visibleSiblings = parent.columns.filter(columnHasVisibleLeaf);
@@ -1,33 +1,55 @@
1
1
  import React from "react";
2
2
  import Pagination from "../../pb_pagination/_pagination";
3
+ import SectionSeparator from "../../pb_section_separator/_section_separator";
3
4
 
4
5
  interface TablePaginationProps {
5
- table: any;
6
6
  onChange: (page: number) => void;
7
7
  position: "top" | "bottom";
8
8
  range?: number;
9
+ sectionSeparator?: boolean;
10
+ table: any;
9
11
  }
10
12
 
11
13
  const TablePagination: React.FC<TablePaginationProps> = ({
12
- table,
13
14
  onChange,
14
15
  position,
15
- range = 5
16
+ range = 5,
17
+ sectionSeparator = false,
18
+ table,
16
19
  }) => {
17
20
  const current = table.getState().pagination.pageIndex + 1;
18
21
  const total = table.getPageCount();
19
22
 
20
- return (
23
+ // Pagination returns null when total <= 1; avoid orphan separators.
24
+ if (total <= 1) {
25
+ return null;
26
+ }
27
+
28
+ const pagination = (
21
29
  <Pagination
22
30
  current={current}
23
31
  key={`pagination-${position}-${current}`}
24
- marginBottom={position === "top" ? "xs" : undefined}
25
- marginTop={position === "bottom" ? "xs" : undefined}
32
+ marginBottom={!sectionSeparator && position === "top" ? "xs" : undefined}
33
+ marginLeft={sectionSeparator ? "lg" : undefined}
34
+ marginTop={!sectionSeparator && position === "bottom" ? "xs" : undefined}
26
35
  onChange={onChange}
36
+ paddingY={sectionSeparator ? "xs" : undefined}
27
37
  range={range}
28
38
  total={total}
29
39
  />
30
40
  );
41
+
42
+ if (!sectionSeparator) {
43
+ return pagination;
44
+ }
45
+
46
+ return (
47
+ <>
48
+ <SectionSeparator />
49
+ {pagination}
50
+ {position === "top" && <SectionSeparator />}
51
+ </>
52
+ );
31
53
  };
32
54
 
33
55
  export default TablePagination;
@@ -46,6 +46,9 @@ export const VirtualizedTableView = ({
46
46
  } = useContext(AdvancedTableContext)
47
47
 
48
48
  const columnPinning = table.getState().columnPinning || { left: [] };
49
+ const isMultiHeaderColumn = (table.options.meta?.columnDefinitions || []).some(
50
+ (column: Record<string, unknown>) => "columns" in column
51
+ );
49
52
  const sortingState = JSON.stringify(table.getState().sorting || []);
50
53
 
51
54
  // Store column widths extracted from header
@@ -212,7 +215,9 @@ export const VirtualizedTableView = ({
212
215
 
213
216
  {row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
214
217
  const isPinnedLeft = columnPinning.left.includes(cell.column.id);
215
- const isLastCell = cell.column.parent?.columns?.at(-1)?.id === cell.column.id;
218
+ const isLastCell = cell.column.parent
219
+ ? cell.column.parent.columns.at(-1)?.id === cell.column.id
220
+ : isMultiHeaderColumn && i !== 0;
216
221
  const cellWidth = columnWidths[cell.column.id] || 'auto';
217
222
 
218
223
  return (
@@ -293,6 +293,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
293
293
  onChange={onPageChange}
294
294
  position="top"
295
295
  range={paginationProps?.range}
296
+ sectionSeparator={paginationProps?.sectionSeparator}
296
297
  table={table}
297
298
  />
298
299
  )}
@@ -375,6 +376,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
375
376
  onChange={onPageChange}
376
377
  position="bottom"
377
378
  range={paginationProps?.range}
379
+ sectionSeparator={paginationProps?.sectionSeparator}
378
380
  table={table}
379
381
  />
380
382
  )}
@@ -1383,4 +1383,140 @@ test("cascadeCollapse=true with header toggle all: collapse all then expand all
1383
1383
  await waitFor(() => {
1384
1384
  expect(kit.querySelector(".depth-sub-row-1")).toBeInTheDocument()
1385
1385
  })
1386
- })
1386
+ })
1387
+
1388
+ test("pagination does not render section separators by default", () => {
1389
+ const { container } = render(
1390
+ <AdvancedTable
1391
+ columnDefinitions={columnDefinitions}
1392
+ data={{ testid: testId }}
1393
+ pagination
1394
+ paginationProps={{ pageSize: 1 }}
1395
+ tableData={MOCK_DATA}
1396
+ />
1397
+ )
1398
+
1399
+ expect(container.querySelectorAll(".pb_paginate")).toHaveLength(2)
1400
+ expect(container.querySelectorAll(".pb_section_separator_kit")).toHaveLength(0)
1401
+ })
1402
+
1403
+ test("paginationProps.sectionSeparator renders separators for top and bottom pagination", () => {
1404
+ const { container } = render(
1405
+ <AdvancedTable
1406
+ columnDefinitions={columnDefinitions}
1407
+ data={{ testid: testId }}
1408
+ pagination
1409
+ paginationProps={{ pageSize: 1, sectionSeparator: true }}
1410
+ tableData={MOCK_DATA}
1411
+ tableProps={{ container: false }}
1412
+ />
1413
+ )
1414
+
1415
+ const paginations = container.querySelectorAll(".pb_paginate")
1416
+ const separators = container.querySelectorAll(".pb_section_separator_kit")
1417
+
1418
+ expect(paginations).toHaveLength(2)
1419
+ expect(separators).toHaveLength(3)
1420
+ expect(paginations[0]).toHaveClass("ml_lg")
1421
+ expect(paginations[0]).toHaveClass("py_xs")
1422
+ expect(paginations[1]).toHaveClass("ml_lg")
1423
+ expect(paginations[1]).toHaveClass("py_xs")
1424
+ expect(separators[0].nextElementSibling).toBe(paginations[0])
1425
+ expect(paginations[0].nextElementSibling).toBe(separators[1])
1426
+ expect(separators[2].nextElementSibling).toBe(paginations[1])
1427
+ })
1428
+
1429
+ const groupedColumnDefinitions = [
1430
+ {
1431
+ accessor: "year",
1432
+ label: "Year",
1433
+ },
1434
+ {
1435
+ label: "Enrollment Data",
1436
+ columns: [
1437
+ {
1438
+ accessor: "newEnrollments",
1439
+ label: "New Enrollments",
1440
+ },
1441
+ {
1442
+ accessor: "scheduledMeetings",
1443
+ label: "Scheduled Meetings",
1444
+ },
1445
+ ],
1446
+ },
1447
+ {
1448
+ accessor: "attendanceRate",
1449
+ label: "Attendance Rate",
1450
+ },
1451
+ {
1452
+ label: "Performance Data",
1453
+ columns: [
1454
+ {
1455
+ accessor: "completedClasses",
1456
+ label: "Completed Classes",
1457
+ },
1458
+ {
1459
+ accessor: "graduatedStudents",
1460
+ label: "Graduated Students",
1461
+ },
1462
+ ],
1463
+ },
1464
+ {
1465
+ accessor: "classCompletionRate",
1466
+ label: "Difference",
1467
+ },
1468
+ ]
1469
+
1470
+ const headerWithText = (row, text) => (
1471
+ [...row.querySelectorAll("th")].find((cell) => cell.textContent.includes(text))
1472
+ )
1473
+
1474
+ test("parentless subheaders get last-header-cell without a placeholder parent", () => {
1475
+ render(
1476
+ <AdvancedTable
1477
+ columnDefinitions={groupedColumnDefinitions}
1478
+ data={{ testid: testId }}
1479
+ enableToggleExpansion="none"
1480
+ tableData={MOCK_DATA_NO_SUBROWS}
1481
+ />
1482
+ )
1483
+
1484
+ const kit = screen.getByTestId(testId)
1485
+ const [topRow, subheaderRow] = kit.querySelectorAll("thead tr")
1486
+ const topCells = topRow.querySelectorAll("th")
1487
+
1488
+ expect(headerWithText(subheaderRow, "Year")).not.toHaveClass("last-header-cell")
1489
+ expect(headerWithText(subheaderRow, "New Enrollments")).not.toHaveClass("last-header-cell")
1490
+ expect(headerWithText(subheaderRow, "Scheduled Meetings")).toHaveClass("last-header-cell")
1491
+ expect(headerWithText(subheaderRow, "Attendance Rate")).toHaveClass("last-header-cell")
1492
+ expect(headerWithText(subheaderRow, "Completed Classes")).not.toHaveClass("last-header-cell")
1493
+ expect(headerWithText(subheaderRow, "Graduated Students")).toHaveClass("last-header-cell")
1494
+ expect(headerWithText(subheaderRow, "Difference")).toHaveClass("last-header-cell")
1495
+ expect(headerWithText(topRow, "Enrollment Data")).not.toHaveClass("last-header-cell")
1496
+ expect(topCells[topCells.length - 1]).toHaveClass("last-header-cell")
1497
+
1498
+ const bodyCells = kit.querySelector("tbody tr").querySelectorAll("td")
1499
+ const bodyGroupEnds = [...bodyCells].map((cell) => cell.classList.contains("last-cell"))
1500
+ expect(bodyGroupEnds).toEqual([false, false, true, true, false, true, true])
1501
+ })
1502
+
1503
+ test("single header row does not mark every column as last-header-cell", () => {
1504
+ render(
1505
+ <AdvancedTable
1506
+ columnDefinitions={columnDefinitions}
1507
+ data={{ testid: testId }}
1508
+ enableToggleExpansion="none"
1509
+ tableData={MOCK_DATA_NO_SUBROWS}
1510
+ />
1511
+ )
1512
+
1513
+ const kit = screen.getByTestId(testId)
1514
+ const headers = kit.querySelectorAll("thead th")
1515
+ const groupEnds = [...headers].filter((cell) => cell.classList.contains("last-header-cell"))
1516
+
1517
+ expect(headers.length).toBeGreaterThan(1)
1518
+ expect(headers[0]).not.toHaveClass("last-header-cell")
1519
+ expect(groupEnds).toHaveLength(1)
1520
+ expect(kit.querySelector("tbody td.last-cell")).not.toBeInTheDocument()
1521
+ })
1522
+
@@ -0,0 +1,90 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import Button from '../../pb_button/_button'
4
+ import Card from '../../pb_card/_card'
5
+ import Filter from '../../pb_filter/_filter'
6
+ import Flex from '../../pb_flex/_flex'
7
+ import TextInput from '../../pb_text_input/_text_input'
8
+ import PAGINATION_MOCK_DATA from "./advanced_table_pagination_mock_data.json"
9
+
10
+ const AdvancedTablePaginationSectionSeparator = (props) => {
11
+ const columnDefinitions = [
12
+ {
13
+ accessor: "year",
14
+ label: "Year",
15
+ cellAccessors: ["quarter", "month", "day"],
16
+ },
17
+ {
18
+ accessor: "newEnrollments",
19
+ label: "New Enrollments",
20
+ },
21
+ {
22
+ accessor: "scheduledMeetings",
23
+ label: "Scheduled Meetings",
24
+ },
25
+ {
26
+ accessor: "attendanceRate",
27
+ label: "Attendance Rate",
28
+ },
29
+ {
30
+ accessor: "completedClasses",
31
+ label: "Completed Classes",
32
+ },
33
+ {
34
+ accessor: "classCompletionRate",
35
+ label: "Class Completion Rate",
36
+ },
37
+ {
38
+ accessor: "graduatedStudents",
39
+ label: "Graduated Students",
40
+ },
41
+ ]
42
+
43
+ const paginationProps = {
44
+ pageSize: 10,
45
+ sectionSeparator: true,
46
+ }
47
+
48
+ return (
49
+ <Card padding="none">
50
+ <Filter
51
+ background={false}
52
+ minWidth="xs"
53
+ results={PAGINATION_MOCK_DATA.length}
54
+ sortOptions={{
55
+ year: "Year",
56
+ newEnrollments: "New Enrollments",
57
+ scheduledMeetings: "Scheduled Meetings",
58
+ }}
59
+ sortValue={[{ name: "year", dir: "asc" }]}
60
+ >
61
+ {({ closePopover }) => (
62
+ <>
63
+ <TextInput label="Year" />
64
+ <Flex spacing="between">
65
+ <Button
66
+ onClick={closePopover}
67
+ text="Filter"
68
+ />
69
+ <Button
70
+ text="Defaults"
71
+ variant="secondary"
72
+ />
73
+ </Flex>
74
+ </>
75
+ )}
76
+ </Filter>
77
+ <AdvancedTable
78
+ columnDefinitions={columnDefinitions}
79
+ pagination
80
+ paginationProps={paginationProps}
81
+ responsive="none"
82
+ tableData={PAGINATION_MOCK_DATA}
83
+ tableProps={{ container: false }}
84
+ {...props}
85
+ />
86
+ </Card>
87
+ )
88
+ }
89
+
90
+ export default AdvancedTablePaginationSectionSeparator
@@ -0,0 +1,5 @@
1
+ Use `sectionSeparator` on `paginationProps` to add section separators and spacing around pagination, matching the Table pagination/filter pattern.
2
+
3
+ - Defaults to `false`
4
+ - When `true`, top pagination is sandwiched by separators, bottom pagination gets a leading separator, and both use Table filter spacing (`marginLeft="lg"`, `paddingY="xs"`)
5
+ - Recommended with `tableProps.container` set to `false` inside a Card (often with a Filter above), as shown here
@@ -3,4 +3,5 @@
3
3
  - `pageIndex`: An optional prop to set which page is set to open on initial load. Default is '0'
4
4
  - `pageSize`: An optional prop to set total number of rows for each page before the Table paginates. Default is '20'
5
5
  - `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
6
- - `onPageChange`: A callback function that gives to access to the current page index.
6
+ - `onPageChange`: A callback function that gives to access to the current page index.
7
+ - `sectionSeparator`: Adds section separators and Table filter-pattern spacing around pagination. Default is `false`. See the [Section Separator](https://playbook.powerapp.cloud/kits/advanced_table/react#pagination-section-separator) example.
@@ -67,6 +67,7 @@ examples:
67
67
  - advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
68
68
  - advanced_table_pagination: Pagination
69
69
  - advanced_table_pagination_with_props: Pagination Props
70
+ - advanced_table_pagination_section_separator: Pagination Section Separator
70
71
  - advanced_table_loading: Loading State
71
72
  - advanced_table_inline_row_loading: Inline Row Loading
72
73
  - advanced_table_column_headers: Multi-Header Columns
@@ -13,6 +13,7 @@ export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cel
13
13
  export { default as AdvancedTableFullWidthCell } from './_advanced_table_full_width_cell.jsx'
14
14
  export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
15
15
  export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
16
+ export { default as AdvancedTablePaginationSectionSeparator } from './_advanced_table_pagination_section_separator.jsx'
16
17
  export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
17
18
  export { default as AdvancedTableColumnHeadersMultiple } from './_advanced_table_column_headers_multiple.jsx'
18
19
  export { default as AdvancedTableSelectableRows } from './_advanced_table_selectable_rows.jsx'
@@ -32,13 +32,13 @@ module Playbook
32
32
  prop :pinned_rows, type: Playbook::Props::HashProp,
33
33
  default: {}
34
34
 
35
- def flatten_columns(columns)
36
- columns.flat_map do |col|
35
+ def flatten_columns(columns, root: true)
36
+ columns.each_with_index.flat_map do |col, index|
37
37
  if col[:columns]
38
- flatten_columns(col[:columns])
38
+ flatten_columns(col[:columns], root: false)
39
39
  elsif col[:accessor].present?
40
40
  if has_grouped_headers?
41
- col.merge(is_last_in_group: last_in_group?(columns, col))
41
+ col.merge(is_last_in_group: root ? index != 0 : last_in_group?(columns, col))
42
42
  else
43
43
  col
44
44
  end
@@ -106,6 +106,22 @@
106
106
  }
107
107
  }
108
108
 
109
+ // Let Rails autocomplete use the trigger space left by its action icons.
110
+ > :has([data-dropdown-autocomplete]) {
111
+ flex: 1;
112
+ min-width: 0;
113
+
114
+ .pb_flex_kit:has([data-dropdown-autocomplete]) {
115
+ min-width: 0;
116
+ width: 100%;
117
+ }
118
+
119
+ [data-dropdown-autocomplete] {
120
+ min-width: 0;
121
+ width: 100%;
122
+ }
123
+ }
124
+
109
125
  .dropdown_input:disabled {
110
126
  background-color: $input_background_disabled;
111
127
  color: $input_text_disabled;