playbook_ui_docs 14.11.1.pre.alpha.PBNTR798datepickerturbo5537 → 14.11.1.pre.alpha.PBNTR7495495

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +50 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +1 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +1 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx +60 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md +5 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +78 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md +1 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx +53 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md +1 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.jsx +52 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.md +1 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_no_subrows.json +42 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_with_id.json +299 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +5 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +6 -1
  18. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -1
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
  20. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +3 -8
  21. data/dist/playbook-doc.js +1 -1
  22. metadata +12 -3
  23. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames.html.erb +0 -13
  24. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails.md +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c323b5f7631c37e4576b44abd9c22f50dd39665e73973e9cae0cb3bd273e6481
4
- data.tar.gz: 0d48e9b4d1fa09c4b1a2878d8118121440cbd706548c68acc896e5ca45cfd46f
3
+ metadata.gz: a55fc3ad44f9dff0dcbff3a0c0e85c9248f12795642526578c55f288721ed718
4
+ data.tar.gz: ec32dd69d48003ba67b2ea6afb0f41cd6c80c15b29f80304c7f3e61911d9fb99
5
5
  SHA512:
6
- metadata.gz: afbb13cc7bafd1c11be35bcbb5592d727ef69ffa993b6b589abee0c8d2a1d5673fad8fe1e6650ee88ca795bff7acbc5a2dddbdc7b9e059afacf20a83215f459f
7
- data.tar.gz: cecfa017c1fe79f06337067cfee7163657a938bc23eae418afb8452f230668708be8a75cd66b445df3c6a15b86f1d2e46ae5983d1a0b18d8a079093a6413ceeb
6
+ metadata.gz: acda96a67cca54c09087226e4a91145afed1fe224b0de165672c591d51ba67203bb53e93ac9b6e829f5a9af549537e31d03b980d7c178391722b92a5df705659
7
+ data.tar.gz: e643133bf270e6877644c25eef683305ef25921575b23e67895768f0e25d44fe9bcc24163ef6221f502d21f6de273ef6750d8149983d343b76809b93a160b4e7
@@ -0,0 +1,50 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data_no_subrows.json"
4
+
5
+ const AdvancedTableNoSubrows = (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
+ return (
39
+ <div>
40
+ <AdvancedTable
41
+ columnDefinitions={columnDefinitions}
42
+ enableToggleExpansion="all"
43
+ tableData={MOCK_DATA}
44
+ {...props}
45
+ />
46
+ </div>
47
+ )
48
+ }
49
+
50
+ export default AdvancedTableNoSubrows
@@ -40,6 +40,7 @@ const AdvancedTablePagination = (props) => {
40
40
  <AdvancedTable
41
41
  columnDefinitions={columnDefinitions}
42
42
  pagination
43
+ responsive="none"
43
44
  tableData={PAGINATION_MOCK_DATA}
44
45
  {...props}
45
46
  />
@@ -47,6 +47,7 @@ const AdvancedTablePaginationWithProps = (props) => {
47
47
  columnDefinitions={columnDefinitions}
48
48
  pagination
49
49
  paginationProps={paginationProps}
50
+ responsive="none"
50
51
  tableData={PAGINATION_MOCK_DATA}
51
52
  {...props}
52
53
  />
@@ -0,0 +1,60 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data_with_id.json"
4
+
5
+ const AdvancedTableSelectableRows = (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
+ //Render the subRow header rows
39
+ const subRowHeaders = ["Quarter", "Month", "Day"]
40
+
41
+
42
+ return (
43
+ <div>
44
+ <AdvancedTable
45
+ columnDefinitions={columnDefinitions}
46
+ enableToggleExpansion="all"
47
+ onRowSelectionChange={(selectedRows) => console.log(selectedRows)}
48
+ selectableRows
49
+ tableData={MOCK_DATA}
50
+
51
+ {...props}
52
+ >
53
+ <AdvancedTable.Header />
54
+ <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
55
+ </AdvancedTable>
56
+ </div>
57
+ )
58
+ }
59
+
60
+ export default AdvancedTableSelectableRows
@@ -0,0 +1,5 @@
1
+ `selectableRows` is a boolean prop that if present will add checkboxes to all rows that will allow for selecting rows.
2
+
3
+ When a parent row is clicked, it will check all nested children rows, Children rows can be manually checked or unchecked as well.
4
+
5
+ The `onRowSelectionChange` prop returns an array of ids of all Rows that have been selected. Open the console on this example and check and uncheck checkboxes to see this is action! __NOTE__: Each object within the `tableData`Array must contain a unique id in order to attach an id to all Rows for this to function.
@@ -0,0 +1,78 @@
1
+ import React, {useState} from "react"
2
+ import { AdvancedTable, CircleIconButton, Flex } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data_no_subrows.json"
4
+
5
+ const AdvancedTableSelectableRowsActions = (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 [selectedRows, setSelectedRows] = useState()
39
+
40
+ const CustomActions = () => {
41
+ const rowIds = selectedRows ? Object.keys(selectedRows) : [];
42
+
43
+ return (
44
+ <Flex>
45
+ <CircleIconButton
46
+ icon="file-csv"
47
+ onClick={() =>
48
+ alert(rowIds.length === 0 ? "No Selection Made" : `Row ids ${rowIds.join(", ")} will be exported!`)
49
+ }
50
+ variant="link"
51
+ />
52
+ <CircleIconButton
53
+ icon="trash-alt"
54
+ onClick={() =>
55
+ alert(rowIds.length === 0 ? "No Selection Made" : `Row ids ${rowIds.join(", ")} will be deleted!`)
56
+ }
57
+ variant="link"
58
+ />
59
+ </Flex>
60
+ );
61
+ };
62
+
63
+
64
+ return (
65
+ <div>
66
+ <AdvancedTable
67
+ actions={<CustomActions/>}
68
+ columnDefinitions={columnDefinitions}
69
+ onRowSelectionChange={(selected) => setSelectedRows(selected)}
70
+ selectableRows
71
+ tableData={MOCK_DATA}
72
+ {...props}
73
+ />
74
+ </div>
75
+ )
76
+ }
77
+
78
+ export default AdvancedTableSelectableRowsActions
@@ -0,0 +1 @@
1
+ Custom actions content can be rendered within the Actions Bar as shown in this doc example. The component passed to `actions` will be rendered on the right of the actionsBar. The `onRowSelectionChange` can then be used to attach the needed click events to those actions.
@@ -0,0 +1,53 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data_no_subrows.json"
4
+
5
+ const AdvancedTableSelectableRowsHeader = (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
+
39
+ return (
40
+ <div>
41
+ <AdvancedTable
42
+ columnDefinitions={columnDefinitions}
43
+ onRowSelectionChange={(selectedRows) => console.log(selectedRows)}
44
+ selectableRows
45
+ showActionsBar={false}
46
+ tableData={MOCK_DATA}
47
+ {...props}
48
+ />
49
+ </div>
50
+ )
51
+ }
52
+
53
+ export default AdvancedTableSelectableRowsHeader
@@ -0,0 +1 @@
1
+ `showActionsBar` is an optional prop that renders the header at the top showing the row count. This is set to `true` by default but can be toggled off by setting it to `false`
@@ -0,0 +1,52 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data_no_subrows.json"
4
+
5
+ const AdvancedTableSelectableRowsNoSubrows = (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
+
39
+ return (
40
+ <div>
41
+ <AdvancedTable
42
+ columnDefinitions={columnDefinitions}
43
+ onRowSelectionChange={(selectedRows) => console.log(selectedRows)}
44
+ selectableRows
45
+ tableData={MOCK_DATA}
46
+ {...props}
47
+ />
48
+ </div>
49
+ )
50
+ }
51
+
52
+ export default AdvancedTableSelectableRowsNoSubrows
@@ -0,0 +1 @@
1
+ `selectableRows` can also be used with tables without nested row data.
@@ -1,3 +1,3 @@
1
- `sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
1
+ `sortControl` is an optional prop that can be used to gain greater control over the sort state of the Advanced Table. Tanstack handles sort itself, however it does provide for a way to handle the state manually if needed. Usecases for this include needing to store the sort state so it persists on page reload, set an initial sort state, etc.
2
2
 
3
- The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort direction is `desc: true`.
3
+ The sort state must be an object with a single key/value pair, with the key being "desc" and the value being a boolean. The default for sort directino is `desc: true`.
@@ -0,0 +1,42 @@
1
+ [
2
+ {
3
+ "year": "2021",
4
+ "id": "1",
5
+ "newEnrollments": "20",
6
+ "scheduledMeetings": "10",
7
+ "attendanceRate": "51%",
8
+ "completedClasses": "3",
9
+ "classCompletionRate": "33%",
10
+ "graduatedStudents": "19"
11
+ },
12
+ {
13
+ "year": "2022",
14
+ "id": "8",
15
+ "newEnrollments": "25",
16
+ "scheduledMeetings": "17",
17
+ "attendanceRate": "75%",
18
+ "completedClasses": "5",
19
+ "classCompletionRate": "45%",
20
+ "graduatedStudents": "32"
21
+ },
22
+ {
23
+ "year": "2023",
24
+ "id": "15",
25
+ "newEnrollments": "10",
26
+ "scheduledMeetings": "15",
27
+ "attendanceRate": "65%",
28
+ "completedClasses": "4",
29
+ "classCompletionRate": "49%",
30
+ "graduatedStudents": "29"
31
+ },
32
+ {
33
+ "year": "2024",
34
+ "id": "14",
35
+ "newEnrollments": "15",
36
+ "scheduledMeetings": "34",
37
+ "attendanceRate": "32%",
38
+ "completedClasses": "6",
39
+ "classCompletionRate": "67%",
40
+ "graduatedStudents": "65"
41
+ }
42
+ ]