playbook_ui_docs 16.7.0 → 16.8.0.pre.alpha.PLAY2935formbuilderrequiredindicatorbug16780

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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +6 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.jsx +57 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.md +66 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.html.erb +62 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_enable_toggle_expansion_rails.md +7 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.jsx +12 -4
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header.md +4 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.html.erb +16 -2
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_header_rails.md +4 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.jsx +68 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sticky_scroll_limitation.md +7 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +16 -2
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +12 -5
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +4 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +5 -3
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +180 -5839
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +5 -30
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_column_definitions_styling.json +4 -1
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
  23. data/app/pb_kits/playbook/pb_date/docs/_playground.json +13 -17
  24. data/app/pb_kits/playbook/pb_date/docs/_playground.overrides.json +13 -16
  25. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dialog_submission.jsx +2 -2
  26. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -2
  27. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -2
  28. data/app/pb_kits/playbook/pb_date_picker/docs/_playground.json +136 -42
  29. data/app/pb_kits/playbook/pb_date_picker/docs/_playground.overrides.json +113 -45
  30. data/app/pb_kits/playbook/pb_date_range_inline/docs/_playground.json +48 -6
  31. data/app/pb_kits/playbook/pb_date_range_inline/docs/_playground.overrides.json +57 -0
  32. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_playground.json +28 -5
  33. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_playground.overrides.json +38 -0
  34. data/app/pb_kits/playbook/pb_date_stacked/docs/_playground.json +1 -1
  35. data/app/pb_kits/playbook/pb_date_stacked/docs/_playground.overrides.json +1 -1
  36. data/app/pb_kits/playbook/pb_date_time/docs/_playground.json +16 -3
  37. data/app/pb_kits/playbook/pb_date_time/docs/_playground.overrides.json +16 -3
  38. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_playground.json +11 -15
  39. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_playground.overrides.json +11 -15
  40. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_playground.json +4 -4
  41. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_playground.overrides.json +4 -4
  42. data/app/pb_kits/playbook/pb_detail/docs/_playground.json +12 -18
  43. data/app/pb_kits/playbook/pb_detail/docs/_playground.overrides.json +13 -12
  44. data/app/pb_kits/playbook/pb_dialog/docs/_playground.json +108 -42
  45. data/app/pb_kits/playbook/pb_dialog/docs/_playground.overrides.json +88 -40
  46. data/app/pb_kits/playbook/pb_distribution_bar/docs/_playground.json +65 -7
  47. data/app/pb_kits/playbook/pb_distribution_bar/docs/_playground.overrides.json +45 -0
  48. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +2 -0
  49. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_react.md +1 -0
  50. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +2 -0
  51. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_react.md +3 -1
  52. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +3 -1
  53. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_react.md +3 -1
  54. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.json +318 -21
  55. data/app/pb_kits/playbook/pb_dropdown/docs/_playground.overrides.json +192 -19
  56. data/app/pb_kits/playbook/pb_empty_state/docs/_playground.json +77 -12
  57. data/app/pb_kits/playbook/pb_empty_state/docs/_playground.overrides.json +79 -0
  58. data/app/pb_kits/playbook/pb_file_upload/docs/_playground.json +98 -13
  59. data/app/pb_kits/playbook/pb_file_upload/docs/_playground.overrides.json +99 -0
  60. data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +20 -19
  61. data/app/pb_kits/playbook/pb_icon/docs/example.yml +0 -2
  62. data/app/pb_kits/playbook/pb_icon/docs/index.js +0 -1
  63. data/app/pb_kits/playbook/pb_link/docs/_playground.json +81 -40
  64. data/app/pb_kits/playbook/pb_link/docs/_playground.overrides.json +88 -30
  65. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.html.erb +90 -0
  66. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.jsx +100 -0
  67. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_centered_data.md +1 -0
  68. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +1 -1
  69. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +2 -0
  70. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +2 -1
  71. data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +4 -2
  72. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_default.html.erb +1 -0
  73. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_default.md +12 -0
  74. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_simple.html.erb +9 -0
  75. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_rails_simple.md +8 -0
  76. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -0
  77. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.html.erb +85 -83
  78. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.jsx +88 -86
  79. data/app/pb_kits/playbook/pb_table/docs/_table_sticky.md +3 -1
  80. data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +1 -1
  81. data/app/pb_kits/playbook/pb_title/docs/_playground.json +72 -23
  82. data/app/pb_kits/playbook/pb_title/docs/_playground.overrides.json +80 -16
  83. metadata +21 -6
  84. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.html.erb +0 -1
  85. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.jsx +0 -21
  86. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.md +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0fc6745132e00861350832917eae46af8cb87d4241c65d77b654768cae6a5e3
4
- data.tar.gz: '08e12f515845e5bfd957ef67a253280c2cafd28274d6cc8bfd58831eeebfc408'
3
+ metadata.gz: 3199fb4e6cb177716055d8b460d66e879626f02e4f3bb6ad12edb9b22725c2dc
4
+ data.tar.gz: 38ca89a03adf56cb1ee16334899f8e8f4e0315a036ed54a3746a0c1c3b7ef920
5
5
  SHA512:
6
- metadata.gz: 7c694113752216ac6e5a606edc4b7c85ed5ee3487f4cc9603e81fedcb353664cd9595eedf94bc77a5040cf5215d63535c6f0e4a942db3bffabaabc1d3f318503
7
- data.tar.gz: bfc611733a3ddc0c39235cb430534d5bf1905037766a05b18eb3353ee331661a4168899fc8c8d1e5ae48826bc24d5e7c785beec6572e1340e75018ed8bd97e09
6
+ metadata.gz: 49304bcd06237aee0a231c817c6cbcd10f4942cc54754457c5372d555e2e2e85819747d287871ad519e083e81828eccd634a432e8b26541d5da5c9537e579555
7
+ data.tar.gz: 45b87cdd2c9a8a291ed39c03a509d225425db6c337a19239bbbab2d0d6eb3468662cb01a9819683af505323c19f234063b4d60e31a050569c65a6f02b4fdf30e
@@ -10,6 +10,7 @@ const AdvancedTableColumnStyling = (props) => {
10
10
  accessor: "year",
11
11
  label: "Year",
12
12
  cellAccessors: ["quarter", "month", "day"],
13
+ columnStyling: { width: 124 },
13
14
  },
14
15
  {
15
16
  accessor: "newEnrollments",
@@ -6,4 +6,10 @@ The `columnStyling` prop is an optional item that can be used within `columnDefi
6
6
 
7
7
  3) `fontColor`: This will allow you to control the font color for a given column.
8
8
 
9
+ 4) Column width: optional keys on `columnStyling` are `minWidth`, `width`, and `maxWidth` (numbers = pixels; CSS strings allowed). This example sets `width` on Year for a fixed hierarchy column (see the width doc for `minWidth` and bands).
10
+
11
+ Fixed width: pass `width` only (or TanStack `size` only) and Playbook sets min and max to the same value automatically — you do not need all three for an exact width.
12
+
13
+ See [Column Styling: Width](https://playbook.powerapp.cloud/kits/advanced_table/react#column-styling-width) for the full guide (Playbook ↔ TanStack mapping, floor-only vs bands, and when to use one vs three values).
14
+
9
15
  `columnStyling` can be used within the columnDefinition of all the columns or some of them, as shown. Each column has its own individual control in this way.
@@ -0,0 +1,57 @@
1
+ import React from "react"
2
+ import AdvancedTable from "../_advanced_table"
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ /**
6
+ * Kit doc: compares fixed width, floor-only, TanStack band, and min/preferred/max band.
7
+ */
8
+ const AdvancedTableColumnStylingWidth = (props) => {
9
+ const columnDefinitions = [
10
+ {
11
+ accessor: "year",
12
+ label: "Year (fixed)",
13
+ cellAccessors: ["quarter", "month", "day"],
14
+ // width alone locks min + max to the same value (128px).
15
+ columnStyling: { width: 128 },
16
+ },
17
+ {
18
+ accessor: "newEnrollments",
19
+ label: "Enrollments (floor)",
20
+ columnStyling: { minWidth: 160 },
21
+ },
22
+ {
23
+ accessor: "scheduledMeetings",
24
+ label: "Meetings (TanStack band)",
25
+ size: 200,
26
+ minSize: 160,
27
+ maxSize: 240,
28
+ },
29
+ {
30
+ accessor: "attendanceRate",
31
+ label: "Attendance (min / pref / max)",
32
+ columnStyling: { minWidth: 108, width: 124, maxWidth: 168 },
33
+ },
34
+ {
35
+ accessor: "completedClasses",
36
+ label: "Completed",
37
+ },
38
+ {
39
+ accessor: "classCompletionRate",
40
+ label: "Completion %",
41
+ },
42
+ {
43
+ accessor: "graduatedStudents",
44
+ label: "Graduated",
45
+ },
46
+ ]
47
+
48
+ return (
49
+ <AdvancedTable
50
+ columnDefinitions={columnDefinitions}
51
+ tableData={MOCK_DATA}
52
+ {...props}
53
+ />
54
+ )
55
+ }
56
+
57
+ export default AdvancedTableColumnStylingWidth
@@ -0,0 +1,66 @@
1
+ AdvancedTable column width is controlled in two equivalent places on each leaf `columnDefinitions` entry. Playbook maps them to inline styles on header and body cells (and forwards numeric values into TanStack Table’s column model).
2
+
3
+ 1) Playbook `columnStyling` and TanStack `ColumnDef` use the same three ideas:
4
+
5
+ - Preferred / target width: `columnStyling` `width` maps to TanStack `size` on the same column object.
6
+ - Minimum width (floor): `columnStyling` `minWidth` maps to TanStack `minSize`.
7
+ - Maximum width (ceiling): `columnStyling` `maxWidth` maps to TanStack `maxSize`.
8
+
9
+ Numbers are pixels. You can also pass CSS length strings on `columnStyling` (e.g. `"12rem"`, `"200px"`). TanStack fields accept numbers only.
10
+
11
+ If both APIs set the same axis, `columnStyling` wins for that axis when Playbook builds cell styles.
12
+
13
+ 2) Fixed width: set `width` only
14
+
15
+ If you pass only `width` (or only `size`) and do not set `minWidth` / `maxWidth` (or `minSize` / `maxSize`), Playbook treats that as a fixed column: it sets all three to the same value under the hood so you do not have to repeat yourself.
16
+
17
+ ```jsx
18
+ columnStyling: { width: 128 }
19
+ // Applied as width, minWidth, and maxWidth: 128px
20
+ ```
21
+
22
+ ```jsx
23
+ size: 200
24
+ // Forwarded as size, minSize, and maxSize: 200
25
+ ```
26
+
27
+ Use this when the column should stay one width (e.g. a hierarchy column with expand controls).
28
+
29
+ 3) Floor only: `minWidth` / `minSize`
30
+
31
+ Set only a minimum when the column may grow with the table or content but must not shrink below a baseline (common fix for horizontal “jump” when rows expand):
32
+
33
+ ```jsx
34
+ columnStyling: { minWidth: 160 }
35
+ ```
36
+
37
+ 4) Flexible band: min + preferred + max
38
+
39
+ Set two or three values when you want a range. CSS uses preferred `width` clamped between `minWidth` and `maxWidth`:
40
+
41
+ - `minWidth`: won’t shrink below this.
42
+ - `width`: preferred size when space allows.
43
+ - `maxWidth`: won’t grow above this.
44
+
45
+ Example from the table below (Attendance): `minWidth: 108`, `width: 124`, `maxWidth: 168` → preferred 124px, allowed between 108 and 168.
46
+
47
+ You only need all three when you want that band. If min and max are omitted, `width` alone is enough for a fixed column.
48
+
49
+ 5) TanStack band without `columnStyling`
50
+
51
+ The Meetings column uses only TanStack fields:
52
+
53
+ ```jsx
54
+ { accessor: "scheduledMeetings", size: 200, minSize: 160, maxSize: 240 }
55
+ ```
56
+
57
+ Playbook applies the same min / preferred / max idea to cell styles. Setting only `size: 200` would lock all three to 200, same as `width: 200` in `columnStyling`.
58
+
59
+ 6) What the example table shows
60
+
61
+ - Year (fixed): `columnStyling: { width: 128 }` — locked to 128px.
62
+ - Enrollments (floor): `columnStyling: { minWidth: 160 }` — at least 160px; can grow.
63
+ - Meetings (TanStack band): `size` / `minSize` / `maxSize` — preferred 200px, between 160–240.
64
+ - Attendance (min / pref / max): all three in `columnStyling` — preferred 124px, between 108–168.
65
+
66
+ Grouped columns: put width options on leaf definitions (columns with an `accessor`), not on parent group headers.
@@ -0,0 +1,62 @@
1
+ <%
2
+ column_definitions = [
3
+ {
4
+ accessor: "year",
5
+ label: "Year",
6
+ cellAccessors: ["quarter", "month", "day"],
7
+ },
8
+ {
9
+ accessor: "newEnrollments",
10
+ label: "New Enrollments",
11
+ },
12
+ {
13
+ accessor: "scheduledMeetings",
14
+ label: "Scheduled Meetings",
15
+ },
16
+ {
17
+ accessor: "attendanceRate",
18
+ label: "Attendance Rate",
19
+ },
20
+ {
21
+ accessor: "completedClasses",
22
+ label: "Completed Classes",
23
+ },
24
+ {
25
+ accessor: "classCompletionRate",
26
+ label: "Class Completion Rate",
27
+ },
28
+ {
29
+ accessor: "graduatedStudents",
30
+ label: "Graduated Students",
31
+ }
32
+ ]
33
+
34
+ subrow_headers = ["Quarter", "Month", "Day"]
35
+ %>
36
+
37
+ <%= pb_rails("title", props: { size: 4, text: "Normal Structure", margin_bottom: "sm" }) %>
38
+
39
+ <%= pb_rails("advanced_table", props: {
40
+ id: "enable-toggle-expansion-normal",
41
+ table_data: @table_data,
42
+ column_definitions: column_definitions,
43
+ enable_toggle_expansion: "all"
44
+ }) %>
45
+
46
+ <%= pb_rails("title", props: { size: 4, text: "Subcomponent Structure", margin_top: "lg", margin_bottom: "sm" }) %>
47
+
48
+ <%= pb_rails("advanced_table", props: { id: "enable-toggle-expansion-subcomponents" }) do %>
49
+ <%= pb_rails("advanced_table/table_header", props: {
50
+ table_id: "enable-toggle-expansion-subcomponents",
51
+ table_data: @table_data,
52
+ column_definitions: column_definitions,
53
+ enable_toggle_expansion: "all"
54
+ }) %>
55
+ <%= pb_rails("advanced_table/table_body", props: {
56
+ table_id: "enable-toggle-expansion-subcomponents",
57
+ table_data: @table_data,
58
+ column_definitions: column_definitions,
59
+ subrow_headers: subrow_headers,
60
+ enable_toggle_expansion: "all"
61
+ }) %>
62
+ <% end %>
@@ -0,0 +1,7 @@
1
+ `enable_toggle_expansion` controls where AdvancedTable renders toggle-all expansion controls. It accepts `"header"`, `"all"`, or `"none"` and defaults to `"header"`.
2
+
3
+ When using the normal Rails structure, pass `enable_toggle_expansion` to `advanced_table`. The parent kit renders its own `table_header` and `table_body`, so the prop is passed down automatically.
4
+
5
+ When using the Rails subcomponent structure, pass `enable_toggle_expansion` directly to the subcomponents that need it. `advanced_table/table_header` uses it for the table header toggle-all button. **NOTE**: you must pass `table_data` to `advanced_table/table_header` as well so it can detect whether expandable rows exist. `advanced_table/table_body` uses it for nested subrow header toggle controls, such as when `subrow_headers` is present.
6
+
7
+ Use `"all"` when you want toggle-all controls in both the table header and subrow headers. Use `"header"` when you only want the table header toggle-all control. Use `"none"` to suppress the header toggle-all control.
@@ -1,13 +1,21 @@
1
1
  import React from "react"
2
2
  import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
- import MOCK_DATA from "./advanced_table_mock_data.json"
3
+
4
+ const tableData = Array.from({ length: 15 }, (_, index) => ({
5
+ year: String(2020 + index),
6
+ newEnrollments: String(20 + index),
7
+ scheduledMeetings: String(10 + index),
8
+ attendanceRate: `${50 + index}%`,
9
+ completedClasses: String(3 + index),
10
+ classCompletionRate: `${30 + index}%`,
11
+ graduatedStudents: String(19 + index),
12
+ }))
4
13
 
5
14
  const AdvancedTableStickyHeader = (props) => {
6
15
  const columnDefinitions = [
7
16
  {
8
17
  accessor: "year",
9
18
  label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
19
  },
12
20
  {
13
21
  accessor: "newEnrollments",
@@ -40,11 +48,11 @@ const AdvancedTableStickyHeader = (props) => {
40
48
  }
41
49
 
42
50
  return (
43
- <div>
51
+ <div style={{ maxHeight: "320px", overflowY: "auto" }}>
44
52
  <AdvancedTable
45
53
  columnDefinitions={columnDefinitions}
46
54
  responsive="none"
47
- tableData={MOCK_DATA}
55
+ tableData={tableData}
48
56
  tableProps={tableProps}
49
57
  {...props}
50
58
  />
@@ -1,3 +1,7 @@
1
1
  The `TableProps` prop can also be used to render a sticky header for the Advanced Table.
2
2
 
3
+ This doc example uses a scroll container with flat rows so sticky behavior is visible in the docs without expanding subrows. Scroll inside the preview to see the header stick.
4
+
5
+ This example builds flat table data inline for the docs preview. For typical `tableData` setup, see [Default (Required Props)](/kits/advanced_table/default/react#advanced_table_default).
6
+
3
7
  This doc example showcases how to set a sticky header for a nonresponsive table (see the `responsive` prop set to "none"). To achieve sticky header AND responsive functionality, see the "Sticky Header for Responsive Table" doc example below.
@@ -2,7 +2,6 @@
2
2
  {
3
3
  accessor: "year",
4
4
  label: "Year",
5
- cellAccessors: ["quarter", "month", "day"],
6
5
  },
7
6
  {
8
7
  accessor: "newEnrollments",
@@ -30,4 +29,19 @@
30
29
  }
31
30
  ] %>
32
31
 
33
- <%= pb_rails("advanced_table", props: { id: "sticky_header_table", table_data: @table_data, column_definitions: column_definitions, responsive: "none", table_props: { sticky: true }}) %>
32
+ <% table_data = 15.times.map do |index|
33
+ {
34
+ year: (2020 + index).to_s,
35
+ id: (2020 + index).to_s,
36
+ newEnrollments: (20 + index).to_s,
37
+ scheduledMeetings: (10 + index).to_s,
38
+ attendanceRate: "#{50 + index}%",
39
+ completedClasses: (3 + index).to_s,
40
+ classCompletionRate: "#{30 + index}%",
41
+ graduatedStudents: (19 + index).to_s,
42
+ }
43
+ end %>
44
+
45
+ <div style="max-height: 320px; overflow-y: auto;">
46
+ <%= pb_rails("advanced_table", props: { id: "sticky_header_table", table_data: table_data, column_definitions: column_definitions, responsive: "none", table_props: { sticky: true }}) %>
47
+ </div>
@@ -1,3 +1,7 @@
1
1
  The `table_props` prop can also be used to render a sticky header for the Advanced Table.
2
2
 
3
+ This doc example uses a scroll container with flat rows so sticky behavior is visible in the docs without expanding subrows. Scroll inside the preview to see the header stick.
4
+
5
+ This example builds flat table data inline for the docs preview. For typical `table_data` setup, see [Default (Required Props)](/kits/advanced_table/default/rails#advanced_table_beta).
6
+
3
7
  This doc example showcases how to set a sticky header for a nonresponsive table (see the `responsive` prop set to "none"). To achieve sticky header AND responsive functionality, see the "[Sticky Header for Responsive Table](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header-for-responsive-table)" doc example below.
@@ -0,0 +1,68 @@
1
+ import React from "react"
2
+ import AdvancedTable from "../../pb_advanced_table/_advanced_table"
3
+ import Title from "../../pb_title/_title"
4
+
5
+ const COLUMN_COUNT = 10
6
+ const ROW_COUNT = 40
7
+
8
+ const columnDefinitions = [
9
+ {
10
+ accessor: "region",
11
+ label: "Region",
12
+ id: "region",
13
+ columnStyling: { minWidth: 160 },
14
+ },
15
+ ...Array.from({ length: COLUMN_COUNT }, (_, index) => ({
16
+ accessor: `metric${index + 1}`,
17
+ label: `Metric ${index + 1}`,
18
+ id: `metric${index + 1}`,
19
+ columnStyling: { minWidth: 180 },
20
+ })),
21
+ ]
22
+
23
+ const tableData = Array.from({ length: ROW_COUNT }, (_, row) => ({
24
+ region: `Region ${row + 1}`,
25
+ ...Object.fromEntries(
26
+ Array.from({ length: COLUMN_COUNT }, (_, col) => [
27
+ `metric${col + 1}`,
28
+ String((row + 1) * (col + 1)),
29
+ ])
30
+ ),
31
+ }))
32
+
33
+ const tableProps = { sticky: true }
34
+
35
+ const AdvancedTableStickyScrollLimitation = (props) => (
36
+ <div>
37
+ <Title
38
+ size={4}
39
+ text="Without maxHeight"
40
+ {...props}
41
+ />
42
+ <AdvancedTable
43
+ columnDefinitions={columnDefinitions}
44
+ responsive="none"
45
+ stickyLeftColumn={["region"]}
46
+ tableData={tableData}
47
+ tableProps={tableProps}
48
+ {...props}
49
+ />
50
+ <Title
51
+ paddingTop="sm"
52
+ size={4}
53
+ text="With maxHeight"
54
+ {...props}
55
+ />
56
+ <AdvancedTable
57
+ columnDefinitions={columnDefinitions}
58
+ maxHeight="sm"
59
+ responsive="none"
60
+ stickyLeftColumn={["region"]}
61
+ tableData={tableData}
62
+ tableProps={tableProps}
63
+ {...props}
64
+ />
65
+ </div>
66
+ )
67
+
68
+ export default AdvancedTableStickyScrollLimitation
@@ -0,0 +1,7 @@
1
+ `stickyLeftColumn` adds horizontal overflow to the table wrapper. Without `maxHeight`, the page scrolls vertically while the table scrolls horizontally — two scroll containers.
2
+
3
+ Sticky columns work in that setup, but the sticky header cannot stick to the page. Scroll down on the page, then scroll the first table horizontally to see the conflict.
4
+
5
+ The second table uses `maxHeight` so both axes share one scroll container. The header sticks to the top of the table box instead of the page.
6
+
7
+ For a typical implementation with subrows, see [Sticky Columns with Sticky Header](#sticky-columns-with-sticky-header).
@@ -2,7 +2,6 @@
2
2
  {
3
3
  accessor: "year",
4
4
  label: "Year",
5
- cellAccessors: ["quarter", "month", "day"],
6
5
  },
7
6
  {
8
7
  accessor: "newEnrollments",
@@ -30,4 +29,19 @@
30
29
  }
31
30
  ] %>
32
31
 
33
- <%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
32
+ <% table_data = 15.times.map do |index|
33
+ {
34
+ year: (2020 + index).to_s,
35
+ id: (2020 + index).to_s,
36
+ newEnrollments: (20 + index).to_s,
37
+ scheduledMeetings: (10 + index).to_s,
38
+ attendanceRate: "#{50 + index}%",
39
+ completedClasses: (3 + index).to_s,
40
+ classCompletionRate: "#{30 + index}%",
41
+ graduatedStudents: (19 + index).to_s,
42
+ }
43
+ end %>
44
+
45
+ <div style="max-height: 320px; overflow-y: auto;">
46
+ <%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: table_data, column_definitions: column_definitions, table_props: { sticky: true }}) %>
47
+ </div>
@@ -1,13 +1,21 @@
1
1
  import React from "react"
2
2
  import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
- import MOCK_DATA from "./advanced_table_mock_data.json"
3
+
4
+ const tableData = Array.from({ length: 15 }, (_, index) => ({
5
+ year: String(2020 + index),
6
+ newEnrollments: String(20 + index),
7
+ scheduledMeetings: String(10 + index),
8
+ attendanceRate: `${50 + index}%`,
9
+ completedClasses: String(3 + index),
10
+ classCompletionRate: `${30 + index}%`,
11
+ graduatedStudents: String(19 + index),
12
+ }))
4
13
 
5
14
  const AdvancedTableTablePropsStickyHeader = (props) => {
6
15
  const columnDefinitions = [
7
16
  {
8
17
  accessor: "year",
9
18
  label: "Year",
10
- cellAccessors: ["quarter", "month", "day"],
11
19
  },
12
20
  {
13
21
  accessor: "newEnrollments",
@@ -40,11 +48,10 @@ const AdvancedTableTablePropsStickyHeader = (props) => {
40
48
  }
41
49
 
42
50
  return (
43
- <div>
51
+ <div style={{ maxHeight: "320px", overflowY: "auto" }}>
44
52
  <AdvancedTable
45
53
  columnDefinitions={columnDefinitions}
46
- maxHeight="xs"
47
- tableData={MOCK_DATA}
54
+ tableData={tableData}
48
55
  tableProps={tableProps}
49
56
  {...props}
50
57
  />
@@ -2,6 +2,10 @@ Create a sticky header that works for responsive Advanced Tables by setting `sti
2
2
 
3
3
  **NOTE**: This behavior requires a `max_height` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
4
4
 
5
+ Scroll inside the table preview to see the header stick.
6
+
7
+ This example builds flat table data inline for the docs preview. For typical `table_data` setup, see [Default (Required Props)](/kits/advanced_table/default/rails#advanced_table_beta).
8
+
5
9
  Expand the table above to see this in action.
6
10
 
7
11
  A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table#sticky-header) doc example above.
@@ -1,7 +1,9 @@
1
- Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and giving the AdvancedTable a `maxHeight` using our [Max Height](https://playbook.powerapp.cloud/global_props/max_height) global prop.
1
+ Create a sticky header that works for responsive Advanced Tables by setting `sticky: true` via `tableProps` and wrapping the table in a scroll container (or using `maxHeight`).
2
2
 
3
- **NOTE**: This behavior requires a `maxHeight` to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
3
+ **NOTE**: The header is sticky within the table scroll area. The live example uses flat rows so you can scroll inside the preview without expanding subrows.
4
4
 
5
- Expand the table above to see this in action.
5
+ This example builds flat table data inline for the docs preview. For typical `tableData` setup, see [Default (Required Props)](/kits/advanced_table/default/react#advanced_table_default).
6
+
7
+ Expand the table above to see responsive behavior in action.
6
8
 
7
9
  A sticky header on a nonresponsive table is demonstrated in the ["Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#sticky-header) doc example above.