playbook_ui_docs 15.2.0.pre.alpha.PLAY2589advancedtableinlinerowloadingtoggleicon11607 → 15.2.0.pre.alpha.PLAY2589advancedtableinlinerowloadingtoggleicon11644

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: b84651e99340e6bb6127f60dd831b721e1ff886b881e48b6baa8372519579439
4
- data.tar.gz: d4aa0e81e2c41ca8f8f9f6aec67841dccce1dd6de81aac9964ced85b314f2639
3
+ metadata.gz: 37b9f98cf6c9ecd28f5e80f11e44bc12526f86764e42d793a21cbbfaca5cdd16
4
+ data.tar.gz: d4bca2daea88f2c34f33c7b3442ac972dd58f9dd5ed11518aa12234f19428eca
5
5
  SHA512:
6
- metadata.gz: 64b74e6e18ee58e64ac5b25fff2e86f195fc2bf7f0f01174374e1ad7569b31f9efd45713fb2e2fab1b8222367ad085b582c2bcbe83a972646c303bb1cb239855
7
- data.tar.gz: e1a558934acbd69fe43f89b18e41d0fee3af89b84292d1af00a75dc61d5084328895243adab8d32d02dcfb9cbd1cb19bcccc1c67b5fbd0e4c75f916ccb42c753
6
+ metadata.gz: 1619cb8b7b2ee8231148684b43a32e6f2cb5c25c85c00c1e70f238c58145996867aa267f10250e0414554ff7fbdb98ef7bbafec0d29da1adbe4e5d74b3967252
7
+ data.tar.gz: 87e6e50bee320f73bc5037ecc880f93648e633df05ed11873d311ed1a448d942dd4049b9331d89b68fddb311d577847cc755305455b97ba70c8e5c2a910083b4
@@ -1,6 +1,8 @@
1
1
  import React from "react"
2
2
  import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import Caption from '../../pb_caption/_caption'
3
4
  import { MOCK_DATA_INLINE_LOADING } from "./_mock_data_inline_loading"
5
+ import { MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN } from "./_mock_data_inline_loading_empty_children"
4
6
 
5
7
  const AdvancedTableInlineRowLoading = (props) => {
6
8
  const columnDefinitions = [
@@ -41,16 +43,30 @@ const AdvancedTableInlineRowLoading = (props) => {
41
43
 
42
44
  return (
43
45
  <div>
46
+ <Caption>Inline Row Loading</Caption>
44
47
  <AdvancedTable
45
48
  columnDefinitions={columnDefinitions}
46
49
  enableToggleExpansion="all"
47
50
  inlineRowLoading
51
+ marginBottom="md"
48
52
  tableData={MOCK_DATA_INLINE_LOADING}
49
53
  {...props}
50
54
  >
51
55
  <AdvancedTable.Header />
52
56
  <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
53
57
  </AdvancedTable>
58
+ <Caption>Inline Row Loading with Persist Toggle Expansion Button</Caption>
59
+ <AdvancedTable
60
+ columnDefinitions={columnDefinitions}
61
+ enableToggleExpansion="all"
62
+ inlineRowLoading
63
+ persistToggleExpansionButton
64
+ tableData={MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN}
65
+ {...props}
66
+ >
67
+ <AdvancedTable.Header />
68
+ <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
69
+ </AdvancedTable>
54
70
  </div>
55
71
  )
56
72
  }
@@ -1,5 +1,14 @@
1
+ ### inlineRowLoading
1
2
  As a default, the kit assumes that the initial dataset is complete, and it renders all expansion buttons/controls based on that data; if no children are present, no expansion controls are rendered. If, however, you want to change the initial dataset to omit some or all of its children (to improve load times of a complex dataset, perhaps), and you implement a querying logic that loads children only when its parent is expanded, then you must use the `inlineRowLoading` prop to ensure your expansion controls are rendered even though your child data is not yet loaded. You must also pass an empty `children` array to any node that will have children to ensure its parent maintains its ability to expand. If this prop is called AND your data contains empty `children` arrays, the kit will render expansion controls on any row with empty children, and then add an inline loading state within the expanded subrow until those child row(s) are returned to the page [by your query logic].
2
3
 
3
- In this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows.
4
+ In the first Advanced Table in this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows.
4
5
 
5
- This prop is set to `false` by default.
6
+ This prop is set to `false` by default.
7
+
8
+
9
+ ### persistToggleExpansion
10
+ The `persistToggleExpansionButton` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceeding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
11
+
12
+ In the second Advanced Table in this code example, all 3 rows have empty children arrays. The toggle all button would not render (prior to an initial row expansion) without `persistToggleExpansionButton` in place.
13
+
14
+ This prop is set to false by default and should only be used in conjunction with `inlineRowLoading`.
@@ -0,0 +1,42 @@
1
+ export const MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN = [
2
+ {
3
+ year: "2021",
4
+ quarter: null,
5
+ month: null,
6
+ day: null,
7
+ newEnrollments: "20",
8
+ scheduledMeetings: "10",
9
+ attendanceRate: "51%",
10
+ completedClasses: "3",
11
+ classCompletionRate: "33%",
12
+ graduatedStudents: "19",
13
+ children: [],
14
+ },
15
+ {
16
+ year: "2022",
17
+ quarter: null,
18
+ month: null,
19
+ day: null,
20
+ newEnrollments: "25",
21
+ scheduledMeetings: "17",
22
+ attendanceRate: "75%",
23
+ completedClasses: "5",
24
+ classCompletionRate: "45%",
25
+ graduatedStudents: "32",
26
+ children: [],
27
+ },
28
+ {
29
+ year: "2023",
30
+ quarter: null,
31
+ month: null,
32
+ day: null,
33
+ newEnrollments: "10",
34
+ scheduledMeetings: "15",
35
+ attendanceRate: "65%",
36
+ completedClasses: "4",
37
+ classCompletionRate: "49%",
38
+ graduatedStudents: "29",
39
+ children: [],
40
+ },
41
+ ]
42
+
@@ -0,0 +1,36 @@
1
+ <%
2
+ options = [
3
+ { label: 'Orange', value: '#FFA500' },
4
+ { label: 'Red', value: '#FF0000' },
5
+ { label: 'Green', value: '#1e3d1eff' },
6
+ { label: 'Blue', value: '#0000FF' },
7
+ { label: 'Purple', value: '#800080' },
8
+ { label: 'Yellow', value: '#FFFF00' },
9
+ { label: 'Pink', value: '#FFC0CB' },
10
+ { label: 'Brown', value: '#A52A2A' },
11
+ { label: 'Black', value: '#000000' },
12
+ { label: 'White', value: '#FFFFFF' },
13
+ { label: 'Gray', value: '#808080' },
14
+ { label: 'Cyan', value: '#00FFFF' },
15
+ { label: 'Magenta', value: '#FF00FF' },
16
+ { label: 'Lime', value: '#00FF00' },
17
+ { label: 'Maroon', value: '#800000' },
18
+ { label: 'Olive', value: '#808000' },
19
+ { label: 'Navy', value: '#000080' },
20
+ { label: 'Teal', value: '#008080' },
21
+ { label: 'Silver', value: '#C0C0C0' },
22
+ { label: 'Gold', value: '#FFD700' },
23
+ { label: 'Beige', value: '#F5F5DC' },
24
+ { label: 'Coral', value: '#FF7F50' }
25
+ ]
26
+ %>
27
+
28
+ <%= pb_rails("typeahead", props: {
29
+ default_options: [{ label: 'Gray', value: '#808080' }],
30
+ id: "typeahead-default-value",
31
+ options: options,
32
+ label: "Colors",
33
+ name: :foo,
34
+ is_multi: false
35
+ })
36
+ %>
@@ -0,0 +1 @@
1
+ The optional `default_options` prop can be used to set a default value for the kit. When a default value is set, focus will be automatically set to the selected option and the dropdown container will scroll to bring the selected option into view.
@@ -0,0 +1,41 @@
1
+ import React from 'react'
2
+
3
+ import Typeahead from '../_typeahead'
4
+
5
+ const options = [
6
+ { label: 'Orange', value: '#FFA500' },
7
+ { label: 'Red', value: '#FF0000' },
8
+ { label: 'Green', value: '#1e3d1eff' },
9
+ { label: 'Blue', value: '#0000FF' },
10
+ { label: 'Purple', value: '#800080' },
11
+ { label: 'Yellow', value: '#FFFF00' },
12
+ { label: 'Pink', value: '#FFC0CB' },
13
+ { label: 'Brown', value: '#A52A2A' },
14
+ { label: 'Black', value: '#000000' },
15
+ { label: 'White', value: '#FFFFFF' },
16
+ { label: 'Gray', value: '#808080' },
17
+ { label: 'Cyan', value: '#00FFFF' },
18
+ { label: 'Magenta', value: '#FF00FF' },
19
+ { label: 'Lime', value: '#00FF00' },
20
+ { label: 'Maroon', value: '#800000' },
21
+ { label: 'Olive', value: '#808000' },
22
+ { label: 'Navy', value: '#000080' },
23
+ { label: 'Teal', value: '#008080' },
24
+ { label: 'Silver', value: '#C0C0C0' },
25
+ { label: 'Gold', value: '#FFD700' },
26
+ { label: 'Beige', value: '#F5F5DC' },
27
+ { label: 'Coral', value: '#FF7F50' }
28
+ ]
29
+
30
+ const TypeaheadDefaultValue = (props) => {
31
+ return (
32
+ <Typeahead
33
+ defaultValue={options[10]}
34
+ label="Colors"
35
+ options={options}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ export default TypeaheadDefaultValue
@@ -0,0 +1 @@
1
+ The optional `defaultValue` prop can be used to set a default value for the kit. When a default value is set, focus will be automatically set to the selected option and the dropdown container will scroll to bring the selected option into view.
@@ -1,6 +1,7 @@
1
1
  examples:
2
2
  rails:
3
3
  - typeahead_default: Default
4
+ - typeahead_default_options: With Default Options
4
5
  - typeahead_with_context: With Context
5
6
  - typeahead_with_pills: With Pills
6
7
  - typeahead_without_pills: Without Pills (Single Select)
@@ -19,6 +20,7 @@ examples:
19
20
 
20
21
  react:
21
22
  - typeahead_default: Default
23
+ - typeahead_default_value: With Default Value
22
24
  - typeahead_react_hook: React Hook
23
25
  - typeahead_with_highlight: With Highlight
24
26
  - typeahead_with_pills: With Pills
@@ -16,3 +16,4 @@ export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.j
16
16
  export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
17
17
  export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
18
18
  export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'
19
+ export { default as TypeaheadDefaultValue } from './_typeahead_default_value.jsx'