playbook_ui 18.2.0.pre.rc.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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +28 -6
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +2 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +43 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.jsx +90 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_section_separator.md +5 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +2 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +16 -0
  11. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +184 -24
  12. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.html.erb +58 -0
  13. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_custom_content.md +10 -0
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.jsx +45 -0
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_initial_options.md +9 -0
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.jsx +43 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_loading.md +9 -0
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.jsx +44 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select.md +5 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.html.erb +44 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_multi_select_rails.md +5 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.jsx +64 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_rich_results.md +5 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.html.erb +43 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_async_search.md +55 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.jsx +42 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_controlled_selection.md +5 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.jsx +58 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_external_search.md +9 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.html.erb +9 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text.jsx +35 -0
  32. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_rails.md +3 -0
  33. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_no_options_text_react.md +3 -0
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +174 -3
  35. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +154 -2
  36. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +11 -0
  37. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +7 -0
  38. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +1 -1
  39. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +12 -0
  40. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1344 -0
  41. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -1
  42. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +1 -0
  43. data/app/pb_kits/playbook/pb_dropdown/dropdown_index.test.js +1153 -0
  44. data/app/pb_kits/playbook/pb_dropdown/hooks/useAsyncOptions.ts +179 -0
  45. data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +21 -19
  46. data/app/pb_kits/playbook/pb_dropdown/index.js +494 -69
  47. data/app/pb_kits/playbook/pb_dropdown/keyboard_accessibility.js +5 -3
  48. data/app/pb_kits/playbook/pb_dropdown/kit.schema.json +71 -1
  49. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +17 -3
  50. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +21 -7
  51. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +5 -2
  52. data/app/pb_kits/playbook/pb_dropdown/subcomponents/MultiSelectTriggerDisplay.tsx +9 -3
  53. data/app/pb_kits/playbook/pb_full_screen/_full_screen.scss +6 -1
  54. data/app/pb_kits/playbook/pb_full_screen/full_screen.test.jsx +19 -7
  55. data/dist/ai/all-schemas.json +147 -5
  56. data/dist/ai/forms.json +1 -1
  57. data/dist/ai/index.json +2 -2
  58. data/dist/ai/kits/dropdown.schema.json +147 -5
  59. data/dist/ai/playgrounds/dropdown.json +1 -1
  60. data/dist/ai/playgrounds/index.json +1 -1
  61. data/dist/chunks/{_table-A9O3w0UR.js → _table-CEZU0qUK.js} +1 -1
  62. data/dist/chunks/vendor.js +2 -2
  63. data/dist/menu.yml +1 -1
  64. data/dist/playbook-rails.js +1 -1
  65. data/dist/playbook.css +1 -1
  66. data/lib/playbook/version.rb +1 -1
  67. metadata +28 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea7a2cbd41fa905d1b87ea9045bf7b2ba422f28fb0a2b573d236bdc9298ac3ff
4
- data.tar.gz: a33468825a7669e840ba73fa1e57c838bba54a00e8900d942de1285e6dd418f2
3
+ metadata.gz: 5db309b02e5dd780da0f53f519c006634be2dd50e13553ce229ddd8be84a5527
4
+ data.tar.gz: dd7da084d43bf1060792d5dcc88dcc5fe2eaabe30d143f262083c80bef7f0a90
5
5
  SHA512:
6
- metadata.gz: 1d3d5f31785f165d440106d964e9c2e594972664f7f01447bf93ffc3b83b0c3d0c2c7c0d53af0ada8ce2737cd0189b9a9dd39521b291bf7638e7ad398e660f6e
7
- data.tar.gz: 037a62fcdd8ecf9417080645b462bf7f3a3ccc2a2f96baf7feed75b10f17aa43c7b5491711bdc947f4ed28a61a247579cb016c11962e4a7f745615fa5417fd93
6
+ metadata.gz: fcc52f997e3940eae2b3c00d36620ab00d2f44fddbce652671a6a3f6223877ce3cce1310d994e405dffad6fa92629727c8b1651a777cf379dd198a810ba1c93d
7
+ data.tar.gz: 18cd7637fe9d879a22a4df5505afda151de2e0a8f6bb02dc742016efe4bf4692bc2d08b50c88f078be99b0ea95c95e543dea5061489c4ffe9eada2799900a509
@@ -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;
@@ -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
  )}
@@ -1385,6 +1385,47 @@ test("cascadeCollapse=true with header toggle all: collapse all then expand all
1385
1385
  })
1386
1386
  })
1387
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
+
1388
1429
  const groupedColumnDefinitions = [
1389
1430
  {
1390
1431
  accessor: "year",
@@ -1477,4 +1518,5 @@ test("single header row does not mark every column as last-header-cell", () => {
1477
1518
  expect(headers[0]).not.toHaveClass("last-header-cell")
1478
1519
  expect(groupEnds).toHaveLength(1)
1479
1520
  expect(kit.querySelector("tbody td.last-cell")).not.toBeInTheDocument()
1480
- })
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'
@@ -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;