playbook_ui_docs 14.22.0.pre.alpha.PLAY2207preservesearchinputrails8526 → 14.22.0.pre.alpha.PLAY2248railstooltipclicktoopen8667

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: e0a8670cfd55da11802b8602697c5614608984bb2958fdca5ef0af34237b465f
4
- data.tar.gz: 7886f93a35d6c04bb964b577ee1a3353efff2fe11f904bbceee36c22c00c3fdf
3
+ metadata.gz: c574d7a069446e11d18c9e2d28d2a779d7fb1a73a7f00155e589886eec64cc5a
4
+ data.tar.gz: ee71cb2ed3767b2e96e4f4f4737e237548cfe1c58442afd98cf116f5c7d0eb32
5
5
  SHA512:
6
- metadata.gz: 4450928ce7e8138bf02d8dbb3517f4a7823f6013e1c0fb3a43edef64a5ee3860ca2d0d736edb9c01503c1297ff02e47c3e3262d2dedc1968d7cd59bbeef4948d
7
- data.tar.gz: 920407260790539fd1886f3fd930730633fc9b8f4271755fcbfbcbd66ebe527755c842e80fd7346358b3d260712dde3fb8bde0c05dc06ce1b5037514912c0d25
6
+ metadata.gz: 36e50ead676186ca8e739050ab3aae40b4e8993dd9d14d69199ee5944a501f74c1c1863881b986022b0153bb19cf970e538a928d641a6852ad1ebf63a5442f38
7
+ data.tar.gz: 804657f3a1b72c1ec1e69ab61c2afd178d26916ff0257a7fd89788e747dd983668b4caf3425f18cbc764431fc751871c8bc93c7972a95f311142612cd795a097
@@ -0,0 +1,65 @@
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 AdvancedTableCustomSort = (props) => {
6
+ const columnDefinitions = [
7
+ {
8
+ accessor: "year",
9
+ label: "Year",
10
+ id: "year",
11
+ cellAccessors: ["quarter", "month", "day"],
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ id: "newEnrollments",
16
+ label: "New Enrollments",
17
+ },
18
+ {
19
+ accessor: "scheduledMeetings",
20
+ id: "scheduledMeetings",
21
+ label: "Scheduled Meetings",
22
+ },
23
+ {
24
+ accessor: "attendanceRate",
25
+ id: "attendanceRate",
26
+ label: "Attendance Rate",
27
+ },
28
+ {
29
+ accessor: "completedClasses",
30
+ id: "completedClasses",
31
+ label: "Completed Classes",
32
+ },
33
+ {
34
+ accessor: "classCompletionRate",
35
+ id: "classCompletionRate",
36
+ label: "Class Completion Rate",
37
+ },
38
+ {
39
+ accessor: "graduatedStudents",
40
+ id: "graduatedStudents",
41
+ label: "Graduated Students",
42
+ },
43
+ ]
44
+
45
+ //Render the subRow header rows
46
+ const subRowHeaders = ["Quarter", "Month", "Day"]
47
+
48
+ return (
49
+ <div>
50
+ <AdvancedTable
51
+ columnDefinitions={columnDefinitions}
52
+ customSort
53
+ enableToggleExpansion="all"
54
+ onCustomSortClick={(subrows)=>{console.log("Custom sort clicked", subrows)}}
55
+ tableData={MOCK_DATA}
56
+ {...props}
57
+ >
58
+ <AdvancedTable.Header enableSorting />
59
+ <AdvancedTable.Body subRowHeaders={subRowHeaders} />
60
+ </AdvancedTable>
61
+ </div>
62
+ )
63
+ }
64
+
65
+ export default AdvancedTableCustomSort
@@ -0,0 +1,5 @@
1
+ The optional `customSort` prop can be used to add a sort button within a subrow header. The button will only appear if that subrowheader has more than one subrow nested within it. This button comes with a callback function called `onCustomSortClick`.
2
+
3
+ The `onCustomSortClick` provides as an argument an array of all the subrows nested within that level of the table.
4
+
5
+ __NOTE__: `customSort` must be used in conjunction with the `subRowHeaders` prop. The `customSort` DOES NOT handle the sort logic, this must be handled on the frontend using the callback provided.
@@ -0,0 +1,69 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import Icon from "../../pb_icon/_icon"
4
+ import Flex from "../../pb_flex/_flex"
5
+ import Caption from "../../pb_caption/_caption"
6
+ import Tooltip from "../../pb_tooltip/_tooltip"
7
+ import MOCK_DATA from "./advanced_table_mock_data.json"
8
+
9
+ const AdvancedTableWithCustomHeader = (props) => {
10
+ const columnDefinitions = [
11
+ {
12
+ accessor: "year",
13
+ label: "Year",
14
+ cellAccessors: ["quarter", "month", "day"],
15
+ },
16
+ {
17
+ accessor: "newEnrollments",
18
+ label: "New Enrollments",
19
+ header: () => (
20
+ <Flex alignItems="center"
21
+ justifyContent="center"
22
+ >
23
+ <Caption marginRight="xs">New Enrollments</Caption>
24
+ <Tooltip placement="top"
25
+ text="Whoa. I'm a Tooltip"
26
+ zIndex={10}
27
+ >
28
+ <Icon cursor="pointer"
29
+ icon="info"
30
+ size="xs"
31
+ />
32
+ </Tooltip>
33
+ </Flex>
34
+ ),
35
+ },
36
+ {
37
+ accessor: "scheduledMeetings",
38
+ label: "Scheduled Meetings",
39
+ },
40
+ {
41
+ accessor: "attendanceRate",
42
+ label: "Attendance Rate",
43
+ },
44
+ {
45
+ accessor: "completedClasses",
46
+ label: "Completed Classes",
47
+ },
48
+ {
49
+ accessor: "classCompletionRate",
50
+ label: "Class Completion Rate",
51
+ },
52
+ {
53
+ accessor: "graduatedStudents",
54
+ label: "Graduated Students",
55
+ },
56
+ ];
57
+
58
+ return (
59
+ <div>
60
+ <AdvancedTable
61
+ columnDefinitions={columnDefinitions}
62
+ tableData={MOCK_DATA}
63
+ {...props}
64
+ />
65
+ </div>
66
+ )
67
+ }
68
+
69
+ export default AdvancedTableWithCustomHeader
@@ -0,0 +1 @@
1
+ The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
@@ -19,14 +19,15 @@ examples:
19
19
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
20
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
21
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
- # - advanced_table_column_styling_rails: Column Styling
23
- # - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
22
+ - advanced_table_column_styling_rails: Column Styling
23
+ - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
24
24
 
25
25
  react:
26
26
  - advanced_table_default: Default (Required Props)
27
27
  - advanced_table_loading: Loading State
28
28
  - advanced_table_sort: Enable Sorting
29
29
  - advanced_table_sort_control: Sort Control
30
+ - advanced_table_custom_sort: Custom Sort
30
31
  - advanced_table_expanded_control: Expanded Control
31
32
  - advanced_table_expand_by_depth: Expand by Depth
32
33
  - advanced_table_subrow_headers: SubRow Headers
@@ -40,6 +41,7 @@ examples:
40
41
  - advanced_table_inline_row_loading: Inline Row Loading
41
42
  - advanced_table_responsive: Responsive Tables
42
43
  - advanced_table_custom_cell: Custom Components for Cells
44
+ - advanced_table_with_custom_header: Custom Header Cell
43
45
  - advanced_table_pagination: Pagination
44
46
  - advanced_table_pagination_with_props: Pagination Props
45
47
  - advanced_table_column_headers: Multi-Header Columns
@@ -38,3 +38,5 @@ export { default as AdvancedTableRowStyling } from './_advanced_table_row_stylin
38
38
  export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
39
39
  export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
40
40
  export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
41
+ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
42
+ export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
@@ -11,7 +11,7 @@ const TableStickyColumns = () => {
11
11
  >
12
12
  <thead>
13
13
  <tr>
14
- <th id="a">{'Column 1'}</th>
14
+ <th data-sticky-id="a">{'Column 1'}</th>
15
15
  <th>{'Column 2'}</th>
16
16
  <th>{'Column 3'}</th>
17
17
  <th>{'Column 4'}</th>
@@ -25,12 +25,12 @@ const TableStickyColumns = () => {
25
25
  <th>{'Column 12'}</th>
26
26
  <th>{'Column 13'}</th>
27
27
  <th>{'Column 14'}</th>
28
- <th id="b">{'Column 15'}</th>
28
+ <th data-sticky-id="b">{'Column 15'}</th>
29
29
  </tr>
30
30
  </thead>
31
31
  <tbody>
32
32
  <tr>
33
- <td id="a">{'Value 1'}</td>
33
+ <td data-sticky-id="a">{'Value 1'}</td>
34
34
  <td>{'Value 2'}</td>
35
35
  <td>{'Value 3'}</td>
36
36
  <td>{'Value 4'}</td>
@@ -44,10 +44,10 @@ const TableStickyColumns = () => {
44
44
  <td>{'Value 12'}</td>
45
45
  <td>{'Value 13'}</td>
46
46
  <td>{'Value 14'}</td>
47
- <td id="b">{'Value 15'}</td>
47
+ <td data-sticky-id="b">{'Value 15'}</td>
48
48
  </tr>
49
49
  <tr>
50
- <td id="a">{'Value 1'}</td>
50
+ <td data-sticky-id="a">{'Value 1'}</td>
51
51
  <td>{'Value 2'}</td>
52
52
  <td>{'Value 3'}</td>
53
53
  <td>{'Value 4'}</td>
@@ -61,10 +61,10 @@ const TableStickyColumns = () => {
61
61
  <td>{'Value 12'}</td>
62
62
  <td>{'Value 13'}</td>
63
63
  <td>{'Value 14'}</td>
64
- <td id="b">{'Value 15'}</td>
64
+ <td data-sticky-id="b">{'Value 15'}</td>
65
65
  </tr>
66
66
  <tr>
67
- <td id="a">{'Value 1'}</td>
67
+ <td data-sticky-id="a">{'Value 1'}</td>
68
68
  <td>{'Value 2'}</td>
69
69
  <td>{'Value 3'}</td>
70
70
  <td>{'Value 4'}</td>
@@ -78,7 +78,7 @@ const TableStickyColumns = () => {
78
78
  <td>{'Value 12'}</td>
79
79
  <td>{'Value 13'}</td>
80
80
  <td>{'Value 14'}</td>
81
- <td id="b">{'Value 15'}</td>
81
+ <td data-sticky-id="b">{'Value 15'}</td>
82
82
  </tr>
83
83
  </tbody>
84
84
  </Table>
@@ -1,3 +1,3 @@
1
1
  The `stickyLeftColumn` and `stickyRightColumn` props can be used together on the same table as needed.
2
2
 
3
- Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using props.
3
+ Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using props.
@@ -10,9 +10,9 @@ const TableStickyLeftColumns = () => {
10
10
  >
11
11
  <thead>
12
12
  <tr>
13
- <th id="1">{'Column 1'}</th>
14
- <th id="2">{'Column 2'}</th>
15
- <th id="3">{'Column 3'}</th>
13
+ <th data-sticky-id="1">{'Column 1'}</th>
14
+ <th data-sticky-id="2">{'Column 2'}</th>
15
+ <th data-sticky-id="3">{'Column 3'}</th>
16
16
  <th>{'Column 4'}</th>
17
17
  <th>{'Column 5'}</th>
18
18
  <th>{'Column 6'}</th>
@@ -29,9 +29,9 @@ const TableStickyLeftColumns = () => {
29
29
  </thead>
30
30
  <tbody>
31
31
  <tr>
32
- <td id="1">{'Value 1'}</td>
33
- <td id="2">{'Value 2'}</td>
34
- <td id="3">{'Value 3'}</td>
32
+ <td data-sticky-id="1">{'Value 1'}</td>
33
+ <td data-sticky-id="2">{'Value 2'}</td>
34
+ <td data-sticky-id="3">{'Value 3'}</td>
35
35
  <td>{'Value 4'}</td>
36
36
  <td>{'Value 5'}</td>
37
37
  <td>{'Value 6'}</td>
@@ -46,9 +46,9 @@ const TableStickyLeftColumns = () => {
46
46
  <td>{'Value 15'}</td>
47
47
  </tr>
48
48
  <tr>
49
- <td id="1">{'Value 1'}</td>
50
- <td id="2">{'Value 2'}</td>
51
- <td id="3">{'Value 3'}</td>
49
+ <td data-sticky-id="1">{'Value 1'}</td>
50
+ <td data-sticky-id="2">{'Value 2'}</td>
51
+ <td data-sticky-id="3">{'Value 3'}</td>
52
52
  <td>{'Value 4'}</td>
53
53
  <td>{'Value 5'}</td>
54
54
  <td>{'Value 6'}</td>
@@ -63,9 +63,9 @@ const TableStickyLeftColumns = () => {
63
63
  <td>{'Value 15'}</td>
64
64
  </tr>
65
65
  <tr>
66
- <td id="1">{'Value 1'}</td>
67
- <td id="2">{'Value 2'}</td>
68
- <td id="3">{'Value 3'}</td>
66
+ <td data-sticky-id="1">{'Value 1'}</td>
67
+ <td data-sticky-id="2">{'Value 2'}</td>
68
+ <td data-sticky-id="3">{'Value 3'}</td>
69
69
  <td>{'Value 4'}</td>
70
70
  <td>{'Value 5'}</td>
71
71
  <td>{'Value 6'}</td>
@@ -1,5 +1,5 @@
1
- The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
1
+ The `stickyLeftColumn` prop expects an array of the column `data-sticky-id`s you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
2
2
 
3
- If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
3
+ If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
4
4
 
5
- Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using `stickyLeftColumn` prop.
5
+ Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using `stickyLeftColumn` prop.
@@ -22,9 +22,9 @@ const TableStickyRightColumns = () => {
22
22
  <th>{'Column 10'}</th>
23
23
  <th>{'Column 11'}</th>
24
24
  <th>{'Column 12'}</th>
25
- <th id="13">{'Column 13'}</th>
26
- <th id="14">{'Column 14'}</th>
27
- <th id="15">{'Column 15'}</th>
25
+ <th data-sticky-id="13">{'Column 13'}</th>
26
+ <th data-sticky-id="14">{'Column 14'}</th>
27
+ <th data-sticky-id="15">{'Column 15'}</th>
28
28
  </tr>
29
29
  </thead>
30
30
  <tbody>
@@ -41,9 +41,9 @@ const TableStickyRightColumns = () => {
41
41
  <td>{'Value 10'}</td>
42
42
  <td>{'Value 11'}</td>
43
43
  <td>{'Value 12'}</td>
44
- <td id="13">{'Value 13'}</td>
45
- <td id="14">{'Value 14'}</td>
46
- <td id="15">{'Value 15'}</td>
44
+ <td data-sticky-id="13">{'Value 13'}</td>
45
+ <td data-sticky-id="14">{'Value 14'}</td>
46
+ <td data-sticky-id="15">{'Value 15'}</td>
47
47
  </tr>
48
48
  <tr>
49
49
  <td>{'Value 1'}</td>
@@ -58,9 +58,9 @@ const TableStickyRightColumns = () => {
58
58
  <td>{'Value 10'}</td>
59
59
  <td>{'Value 11'}</td>
60
60
  <td>{'Value 12'}</td>
61
- <td id="13">{'Value 13'}</td>
62
- <td id="14">{'Value 14'}</td>
63
- <td id="15">{'Value 15'}</td>
61
+ <td data-sticky-id="13">{'Value 13'}</td>
62
+ <td data-sticky-id="14">{'Value 14'}</td>
63
+ <td data-sticky-id="15">{'Value 15'}</td>
64
64
  </tr>
65
65
  <tr>
66
66
  <td>{'Value 1'}</td>
@@ -75,9 +75,9 @@ const TableStickyRightColumns = () => {
75
75
  <td>{'Value 10'}</td>
76
76
  <td>{'Value 11'}</td>
77
77
  <td>{'Value 12'}</td>
78
- <td id="13">{'Value 13'}</td>
79
- <td id="14">{'Value 14'}</td>
80
- <td id="15">{'Value 15'}</td>
78
+ <td data-sticky-id="13">{'Value 13'}</td>
79
+ <td data-sticky-id="14">{'Value 14'}</td>
80
+ <td data-sticky-id="15">{'Value 15'}</td>
81
81
  </tr>
82
82
  </tbody>
83
83
  </Table>
@@ -1,5 +1,5 @@
1
- The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
1
+ The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column `data-sticky-id`s you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
2
2
 
3
- If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
3
+ If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
4
4
 
5
- Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyRightColumn` prop.
5
+ Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using the `stickyRightColumn` prop.
@@ -0,0 +1,14 @@
1
+ <%= pb_rails("button", props: {
2
+ text: "Click to Open",
3
+ id: "click-tooltip-trigger-1",
4
+ variant: "primary"
5
+ }) %>
6
+
7
+ <%= pb_rails("tooltip", props: {
8
+ trigger_element_selector: "#click-tooltip-trigger-1",
9
+ tooltip_id: "click-tooltip-1",
10
+ position: "top",
11
+ use_click_to_open: true
12
+ }) do %>
13
+ Tooltip opened by click! Click trigger again to close.
14
+ <% end %>
@@ -0,0 +1 @@
1
+ Set the prop `use_click_to_open` as `true` so that the tooltip will only appear when an item is clicked rather than hovered over.
@@ -9,6 +9,7 @@ examples:
9
9
  - tooltip_with_icon_circle: Icon Circle Tooltip
10
10
  - tooltip_delay_rails: Delay
11
11
  - tooltip_show_tooltip: Show Tooltip
12
+ - tooltip_click_open: Click to Open
12
13
 
13
14
  react:
14
15
  - tooltip_default_react: Default
@@ -8,6 +8,7 @@
8
8
  %>
9
9
 
10
10
  <%= pb_rails("typeahead", props: {
11
+ id: "typeahead-preserve-search-input",
11
12
  is_multi: false,
12
13
  label: "Colors",
13
14
  options: options,