playbook_ui_docs 14.19.0 → 14.20.0.pre.rc.0

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: 102b75f85575b396e0c2b080453da35f67a8087408c8a00f7176f613765e1ed2
4
- data.tar.gz: 8a16b9fc69b005a286fc530d7414dc6279cd828b6a4eae702d47e96d050417f9
3
+ metadata.gz: ff2d019b5abd6484c31d09bc6ca745b354d5121f9e7462be866214da1c3231dd
4
+ data.tar.gz: 2c29674f75161acb7770a03ac2dc2bfcdda0fa5803cec3a30230717f71518d90
5
5
  SHA512:
6
- metadata.gz: 88f4dc52d9e74feb83c45270f6b2880acd8f663c08fd3212df19c817515bda68ec5fc6bdfa514d589ddedce1e79d44cb6092c9a2a9b4e1c00e91ff46944ac99a
7
- data.tar.gz: 228a3a0524b322da09b4eb7f11d80b6206b52529a33dba162ba79c014d549b2b379a560afe8611dc29aedb2c94adadf3e0553dc1b163b0ea589f20a16fd46b84
6
+ metadata.gz: d20ca232588c4ae79da0cab06e132a3458fdbdd2c8e772705da120464217af4b42e1419f2c546c6dd2a819fd8082bc7c8a7a9b47aeecc5f66a6dc0d52a8fe980
7
+ data.tar.gz: 9e074e2fbd029f9e86bff6cd7e0c9916663c8f911914df3222689f79b72a2dde002a7d0b39573c7ef72df3db13a08f240bcb2e0c75cbebbd5258e064b45af94f
@@ -0,0 +1,57 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableColumnVisibility = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ id: "year"
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ id: "newEnrollments"
17
+ },
18
+ {
19
+ accessor: "scheduledMeetings",
20
+ label: "Scheduled Meetings",
21
+ id: "scheduledMeetings"
22
+ },
23
+ {
24
+ accessor: "attendanceRate",
25
+ label: "Attendance Rate",
26
+ id: "attendanceRate"
27
+ },
28
+ {
29
+ accessor: "completedClasses",
30
+ label: "Completed Classes",
31
+ id: "completedClasses"
32
+ },
33
+ {
34
+ accessor: "classCompletionRate",
35
+ label: "Class Completion Rate",
36
+ id: "classCompletionRate"
37
+ },
38
+ {
39
+ accessor: "graduatedStudents",
40
+ label: "Graduated Students",
41
+ id: "graduatedStudents"
42
+ },
43
+ ]
44
+
45
+ return (
46
+ <div>
47
+ <AdvancedTable
48
+ columnDefinitions={columnDefinitions}
49
+ columnVisibilityControl={{default: true}}
50
+ tableData={MOCK_DATA}
51
+ {...props}
52
+ />
53
+ </div>
54
+ )
55
+ }
56
+
57
+ export default AdvancedTableColumnVisibility
@@ -0,0 +1,4 @@
1
+ The `columnVisibilityControl` prop allows users to toggle the visibility of table columns dynamically.
2
+
3
+ The default can be enabled simply by passing `{ default:true }` to the prop as shown. This will render the header with the icon enabled dropdown. The dropdown contains all columns present in the Table and any can be toggled on or off via the checkboxes.
4
+ **NOTE**: The first column will not be shown in the dropdown as an option since all the expansion logic/functionality lives there and it should always be visible.
@@ -0,0 +1,62 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableColumnVisibilityCustom = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ id: "year"
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ id: "newEnrollments"
17
+ },
18
+ {
19
+ accessor: "scheduledMeetings",
20
+ label: "Scheduled Meetings",
21
+ id: "scheduledMeetings"
22
+ },
23
+ {
24
+ accessor: "attendanceRate",
25
+ label: "Attendance Rate",
26
+ id: "attendanceRate"
27
+ },
28
+ {
29
+ accessor: "completedClasses",
30
+ label: "Completed Classes",
31
+ id: "completedClasses"
32
+ },
33
+ {
34
+ accessor: "classCompletionRate",
35
+ label: "Class Completion Rate",
36
+ id: "classCompletionRate"
37
+ },
38
+ {
39
+ accessor: "graduatedStudents",
40
+ label: "Graduated Students",
41
+ id: "graduatedStudents"
42
+ },
43
+ ]
44
+
45
+ const columnVisibilityControl = {
46
+ // This is the list of column ids that will be included in the column visibility control
47
+ includeIds:["newEnrollments", "scheduledMeetings", "attendanceRate", "completedClasses"],
48
+ }
49
+
50
+ return (
51
+ <div>
52
+ <AdvancedTable
53
+ columnDefinitions={columnDefinitions}
54
+ columnVisibilityControl={columnVisibilityControl}
55
+ tableData={MOCK_DATA}
56
+ {...props}
57
+ />
58
+ </div>
59
+ )
60
+ }
61
+
62
+ export default AdvancedTableColumnVisibilityCustom
@@ -0,0 +1 @@
1
+ By using the `includeIds` key/value pair as shown within the `columnVisibilityControl` prop, you can control which columns show up as options in the columnVisibility dropdown.
@@ -0,0 +1,82 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableColumnVisibilityMulti = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ id: "year",
11
+ cellAccessors: ["quarter", "month", "day"],
12
+ },
13
+ {
14
+ label: "Enrollment Data",
15
+ id: "enrollmentData",
16
+ columns: [
17
+ {
18
+ label: "Enrollment Stats",
19
+ id: "enrollmentStats",
20
+ columns: [
21
+ {
22
+ accessor: "newEnrollments",
23
+ label: "New Enrollments",
24
+ id: "newEnrollments",
25
+ },
26
+ {
27
+ accessor: "scheduledMeetings",
28
+ label: "Scheduled Meetings",
29
+ id: "scheduledMeetings",
30
+ },
31
+ ],
32
+ },
33
+ ],
34
+ },
35
+ {
36
+ label: "Performance Data",
37
+ id: "performanceData",
38
+ columns: [
39
+ {
40
+ label: "Completion Metrics",
41
+ id: "completionMetrics",
42
+ columns: [
43
+ {
44
+ accessor: "completedClasses",
45
+ label: "Completed Classes",
46
+ id: "completedClasses",
47
+ },
48
+ {
49
+ accessor: "classCompletionRate",
50
+ label: "Class Completion Rate",
51
+ id: "classCompletionRate",
52
+ },
53
+ ],
54
+ },
55
+ {
56
+ label: "Attendance",
57
+ id: "attendance",
58
+ columns: [
59
+ {
60
+ accessor: "attendanceRate",
61
+ label: "Attendance Rate",
62
+ id: "attendanceRate",
63
+ },
64
+ ],
65
+ },
66
+ ],
67
+ },
68
+ ];
69
+
70
+ return (
71
+ <div>
72
+ <AdvancedTable
73
+ columnDefinitions={columnDefinitions}
74
+ columnVisibilityControl={{default: true}}
75
+ tableData={MOCK_DATA}
76
+ {...props}
77
+ />
78
+ </div>
79
+ )
80
+ }
81
+
82
+ export default AdvancedTableColumnVisibilityMulti
@@ -0,0 +1 @@
1
+ The `columnVisibilityControl` prop can also be used with multi-header columns as shown.
@@ -0,0 +1,65 @@
1
+ import React, { useState } from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableColumnVisibilityWithState = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ cellAccessors: ["quarter", "month", "day"],
11
+ id: "year"
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ id: "newEnrollments"
17
+ },
18
+ {
19
+ accessor: "scheduledMeetings",
20
+ label: "Scheduled Meetings",
21
+ id: "scheduledMeetings"
22
+ },
23
+ {
24
+ accessor: "attendanceRate",
25
+ label: "Attendance Rate",
26
+ id: "attendanceRate"
27
+ },
28
+ {
29
+ accessor: "completedClasses",
30
+ label: "Completed Classes",
31
+ id: "completedClasses"
32
+ },
33
+ {
34
+ accessor: "classCompletionRate",
35
+ label: "Class Completion Rate",
36
+ id: "classCompletionRate"
37
+ },
38
+ {
39
+ accessor: "graduatedStudents",
40
+ label: "Graduated Students",
41
+ id: "graduatedStudents"
42
+ },
43
+ ]
44
+
45
+ const [columnVisibility, setColumnVisibility] = useState({
46
+ newEnrollments: false
47
+ })
48
+
49
+ const columnVisibilityControl = {
50
+ value: columnVisibility,
51
+ onChange: setColumnVisibility,
52
+ }
53
+ return (
54
+ <div>
55
+ <AdvancedTable
56
+ columnDefinitions={columnDefinitions}
57
+ columnVisibilityControl={columnVisibilityControl}
58
+ tableData={MOCK_DATA}
59
+ {...props}
60
+ />
61
+ </div>
62
+ )
63
+ }
64
+
65
+ export default AdvancedTableColumnVisibilityWithState
@@ -0,0 +1 @@
1
+ The `columnVisibilityControl` prop also allows for greater control over the columnVisibility state. Devs can manage state themselves by passing in `value` and `onChange` as shown.
@@ -47,3 +47,7 @@ examples:
47
47
  - advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
48
48
  - advanced_table_inline_editing: Inline Cell Editing
49
49
  - advanced_table_fullscreen: Fullscreen
50
+ - advanced_table_column_visibility: Column Visibility Control
51
+ - advanced_table_column_visibility_with_state: Column Visibility Control With State
52
+ - advanced_table_column_visibility_custom: Column Visibility Control with Custom Dropdown
53
+ - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
@@ -27,4 +27,8 @@ export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_
27
27
  export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
28
28
  export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
29
29
  export { default as AdvancedTableExpandByDepth } from './_advanced_table_expand_by_depth.jsx'
30
- export { default as AdvancedTableColumnBorderColor} from './_advanced_table_column_border_color.jsx'
30
+ export { default as AdvancedTableColumnBorderColor} from './_advanced_table_column_border_color.jsx'
31
+ export { default as AdvancedTableColumnVisibility } from './_advanced_table_column_visibility.jsx'
32
+ export { default as AdvancedTableColumnVisibilityCustom } from './_advanced_table_column_visibility_custom.jsx'
33
+ export { default as AdvancedTableColumnVisibilityMulti } from './_advanced_table_column_visibility_multi.jsx'
34
+ export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
@@ -0,0 +1 @@
1
+ <%= pb_rails("file_upload", props: {id: "error", error: raw(pb_rails("icon", props: { icon: "warning" }) + " Please upload a valid file")}) %>
@@ -0,0 +1,41 @@
1
+ import React, { useState } from 'react'
2
+ import FileUpload from '../_file_upload'
3
+ import List from '../../pb_list/_list'
4
+ import ListItem from '../../pb_list/_list_item'
5
+ import Icon from '../../pb_icon/_icon'
6
+
7
+ const AcceptedFilesList = ({ files }) => (
8
+ <List>
9
+ {files.map((file) => (
10
+ <ListItem key={file.name}>{file.name}</ListItem>
11
+ ))}
12
+ </List>
13
+ )
14
+
15
+ const FileUploadError = (props) => {
16
+ const [filesToUpload, setFilesToUpload] = useState([])
17
+
18
+ const handleOnFilesAccepted = (files) => {
19
+ setFilesToUpload([...filesToUpload, ...files])
20
+ }
21
+
22
+ const error = (<>
23
+ <Icon icon="warning" /> Please upload a valid file
24
+ </>)
25
+
26
+ return (
27
+ <div>
28
+ <AcceptedFilesList
29
+ files={filesToUpload}
30
+ {...props}
31
+ />
32
+ <FileUpload
33
+ error={error}
34
+ onFilesAccepted={handleOnFilesAccepted}
35
+ {...props}
36
+ />
37
+ </div>
38
+ )
39
+ }
40
+
41
+ export default FileUploadError
@@ -3,6 +3,7 @@ examples:
3
3
  rails:
4
4
  - file_upload_default: File Upload
5
5
  - file_upload_custom: Custom
6
+ - file_upload_error: Error
6
7
 
7
8
  react:
8
9
  - file_upload_default: Default List of files to upload
@@ -10,3 +11,4 @@ examples:
10
11
  - file_upload_custom_message: Add a custom message
11
12
  - file_upload_custom_description: Add your one accepted files description
12
13
  - file_upload_max_size: Set a file size limit
14
+ - file_upload_error: Error
@@ -3,3 +3,4 @@ export { default as FileUploadAccept } from './_file_upload_accept.jsx'
3
3
  export { default as FileUploadCustomMessage } from './_file_upload_custom_message.jsx'
4
4
  export { default as FileUploadCustomDescription } from './_file_upload_custom_description.jsx'
5
5
  export { default as FileUploadMaxSize } from './_file_upload_max_size.jsx'
6
+ export { default as FileUploadError } from './_file_upload_error.jsx'