playbook_ui_docs 14.25.0.pre.rc.0 → 14.25.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 874ed8c9f3437a3c991e142fbfb085433782b65d49c600e48b588b1a469d89c5
4
- data.tar.gz: cb13f3345acc62c8eb1653c988b8de177bdedd9082762fa8a85f91dbf612d763
3
+ metadata.gz: 85f0bccd2de4909c63e763eeeaff4f1faaed8c936d1df221e79dfd4bab07dd12
4
+ data.tar.gz: 926ac66b34b63fff19c1a6301204a50438536ca70601d71f18f7b085b9682b4c
5
5
  SHA512:
6
- metadata.gz: e9d9f046c5badb3b704b4fc9aabd4ed52c977afc71192135959284400fa8e120569abf5c913238432e8779b9349f12544a7bfdb329586c7eb9fe692d713b79c1
7
- data.tar.gz: 6e2c8a86d238f41dcc34f2ba3242dc0b0c2560fcf167ea4ccfaf4d8f8db0fa8ce48814352b96eb9b1cbdae4480ef01767cfaf6db66cebadef5b6450a851b1533
6
+ metadata.gz: 1472b8ab4342acd79ddba9e1866e7f05e3fc003f208cd012edd4432f65cc40bf492407fed6bb92c7b5f75e07dc2da2d584bab0bf4789154e7d58965ac8b6848b
7
+ data.tar.gz: 72e4d8e30c4ba7bfca718b0cb8a2961f687559e5307b806600fcc73aaff2cce2c1644ad6a217eb7e47fb0ccda6e3cc6fb37ca209d0953023a5067e982ea9350a
@@ -0,0 +1,60 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import Background from '../../pb_background/_background'
4
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
5
+
6
+ const AdvancedTablePaddingControl = (props) => {
7
+ const columnDefinitions = [
8
+ {
9
+ accessor: "year",
10
+ label: "Year",
11
+ cellAccessors: ["quarter", "month", "day"],
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ columnStyling:{cellPadding: "none"},
17
+ customRenderer: (row, value) => (
18
+ <Background
19
+ backgroundColor={row.original.newEnrollments > 20 ? "success_secondary" : "warning_secondary"}
20
+ padding="xs"
21
+ >
22
+ {value}
23
+ </Background>
24
+ ),
25
+
26
+ },
27
+ {
28
+ accessor: "scheduledMeetings",
29
+ label: "Scheduled Meetings",
30
+ },
31
+ {
32
+ accessor: "attendanceRate",
33
+ label: "Attendance Rate",
34
+ },
35
+ {
36
+ accessor: "completedClasses",
37
+ label: "Completed Classes",
38
+ },
39
+ {
40
+ accessor: "classCompletionRate",
41
+ label: "Class Completion Rate",
42
+ },
43
+ {
44
+ accessor: "graduatedStudents",
45
+ label: "Graduated Students",
46
+ },
47
+ ]
48
+
49
+ return (
50
+ <div>
51
+ <AdvancedTable
52
+ columnDefinitions={columnDefinitions}
53
+ tableData={MOCK_DATA}
54
+ {...props}
55
+ />
56
+ </div>
57
+ )
58
+ }
59
+
60
+ export default AdvancedTablePaddingControl
@@ -0,0 +1,3 @@
1
+ `columnStyling` can also be used to control padding on all cells in a given column via the use of the `cellPadding` key/value pair. `cellPadding` lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
2
+
3
+ This control can be used in conjunction with the `customRenderer` item within each columnDefinition to achieve custom background colors for individual cells as seen here.
@@ -0,0 +1,57 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
4
+
5
+ const AdvancedTablePaddingControlPerRow = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ },
12
+ {
13
+ accessor: "newEnrollments",
14
+ label: "New Enrollments",
15
+ },
16
+ {
17
+ accessor: "scheduledMeetings",
18
+ label: "Scheduled Meetings",
19
+ },
20
+ {
21
+ accessor: "attendanceRate",
22
+ label: "Attendance Rate",
23
+ },
24
+ {
25
+ accessor: "completedClasses",
26
+ label: "Completed Classes",
27
+ },
28
+ {
29
+ accessor: "classCompletionRate",
30
+ label: "Class Completion Rate",
31
+ },
32
+ {
33
+ accessor: "graduatedStudents",
34
+ label: "Graduated Students",
35
+ },
36
+ ]
37
+
38
+ const rowStyling = [
39
+ {
40
+ rowId: "1",
41
+ cellPadding:"md"
42
+ },
43
+ ];
44
+
45
+ return (
46
+ <div>
47
+ <AdvancedTable
48
+ columnDefinitions={columnDefinitions}
49
+ rowStyling={rowStyling}
50
+ tableData={MOCK_DATA}
51
+ {...props}
52
+ />
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default AdvancedTablePaddingControlPerRow
@@ -0,0 +1 @@
1
+ `rowStyling` can also be used to control padding on all cells in a given row via the use of the `cellPadding` key/value pair as shown here. `cellPadding` lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
@@ -68,8 +68,10 @@ examples:
68
68
  - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
69
69
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
70
70
  - advanced_table_row_styling: Row Styling
71
+ - advanced_table_padding_control_per_row: Padding Control using Row Styling
71
72
  - advanced_table_column_styling: Column Styling
72
73
  - advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
74
+ - advanced_table_padding_control: Padding Control using Column Styling
73
75
  - advanced_table_column_border_color: Column Group Border Color
74
76
  - advanced_table_fullscreen: Fullscreen
75
77
  - advanced_table_infinite_scroll: Infinite Scroll
@@ -43,4 +43,6 @@ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_c
43
43
  export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
44
44
  export { default as AdvancedTableWithCustomHeaderMultiHeader } from './_advanced_table_with_custom_header_multi_header.jsx'
45
45
  export { default as AdvancedTableSortPerColumn } from './_advanced_table_sort_per_column.jsx'
46
- export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
46
+ export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
47
+ export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
48
+ export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
@@ -0,0 +1,112 @@
1
+ import React, { useState } from "react";
2
+ import Flex from '../../pb_flex/_flex'
3
+ import Pagination from '../../pb_pagination/_pagination'
4
+ import Select from '../../pb_select/_select'
5
+ import Table from '../../pb_table/_table'
6
+
7
+ import { data } from "./data";
8
+
9
+ const PaginationExternalControl = (props) => {
10
+ const [totalItems, setTotalItems] = useState(20);
11
+ const [itemsPerPage, setItemsPerPage] = useState(5);
12
+ const [currentPage, setCurrentPage] = useState(1);
13
+
14
+ const totalPages = Math.ceil(totalItems / itemsPerPage);
15
+
16
+ const handlePageChange = (page) => {
17
+ setCurrentPage(page);
18
+ };
19
+
20
+ const limitedData = data.slice(0, totalItems);
21
+ const startIndex = (currentPage - 1) * itemsPerPage;
22
+ const paginatedItems = limitedData.slice(startIndex, startIndex + itemsPerPage);
23
+
24
+ const handleTotalItemsChange = (event) => {
25
+ const value = Number(event.target.value);
26
+ setTotalItems(value);
27
+ setCurrentPage(1);
28
+ };
29
+
30
+ const handleItemsPerPageChange = (event) => {
31
+ const value = Number(event.target.value);
32
+ setItemsPerPage(value);
33
+ setCurrentPage(1);
34
+ };
35
+
36
+ return (
37
+ <>
38
+ <Flex gap="sm">
39
+ <Select
40
+ label="Total Items"
41
+ onChange={handleTotalItemsChange}
42
+ options={[
43
+ { value: "5", text: "5" },
44
+ { value: "10", text: "10" },
45
+ { value: "20", text: "20" }
46
+ ]}
47
+ size="sm"
48
+ value={String(totalItems)}
49
+ {...props}
50
+ />
51
+
52
+ <Select
53
+ label="Items per Page"
54
+ onChange={handleItemsPerPageChange}
55
+ options={[
56
+ { value: "3", text: "3" },
57
+ { value: "5", text: "5" },
58
+ { value: "10", text: "10" }
59
+ ]}
60
+ size="sm"
61
+ value={String(itemsPerPage)}
62
+ {...props}
63
+ />
64
+ </Flex>
65
+
66
+ <Pagination
67
+ current={currentPage}
68
+ key={`pagination-top-${currentPage}`}
69
+ marginBottom="xs"
70
+ onChange={handlePageChange}
71
+ range={5}
72
+ total={totalPages}
73
+ {...props}
74
+ />
75
+ <Table
76
+ marginBottom="xs"
77
+ responsive="none"
78
+ size="sm"
79
+ {...props}
80
+ >
81
+ <Table.Head>
82
+ <Table.Row>
83
+ <Table.Header>{"Column 1"}</Table.Header>
84
+ <Table.Header>{"Column 2"}</Table.Header>
85
+ <Table.Header>{"Column 3"}</Table.Header>
86
+ <Table.Header>{"Column 4"}</Table.Header>
87
+ <Table.Header>{"Column 5"}</Table.Header>
88
+ </Table.Row>
89
+ </Table.Head>
90
+ <Table.Body>
91
+ {paginatedItems.map((row, index) => (
92
+ <Table.Row key={index}>
93
+ {row.map((cell, cellIndex) => (
94
+ <Table.Cell key={cellIndex}>{cell}</Table.Cell>
95
+ ))}
96
+ </Table.Row>
97
+ ))}
98
+ </Table.Body>
99
+ </Table>
100
+ <Pagination
101
+ current={currentPage}
102
+ key={`pagination-bottom-${currentPage}`}
103
+ onChange={handlePageChange}
104
+ range={5}
105
+ total={totalPages}
106
+ {...props}
107
+ />
108
+ </>
109
+ )
110
+ }
111
+
112
+ export default PaginationExternalControl
@@ -0,0 +1,3 @@
1
+ The Pagination component supports external control of the current page. This allows for programmatically reseting or changing the current page when filters or other criteria change, without needing to unmount and remount the component.
2
+
3
+ In this example, changing the "Total Items" or "Items per Page" dropdowns will automatically reset the pagination to page 1, demonstrating how external control works. The pagination component will update its internal state to reflect the new `current` prop value.
@@ -6,3 +6,4 @@ examples:
6
6
  react:
7
7
  - pagination_default: Default
8
8
  - pagination_page_change: Page Change
9
+ - pagination_external_control: External Control
@@ -1,2 +1,3 @@
1
1
  export { default as PaginationDefault } from './_pagination_default.jsx'
2
2
  export { default as PaginationPageChange } from './_pagination_page_change.jsx'
3
+ export { default as PaginationExternalControl } from './_pagination_external_control.jsx'