playbook_ui 14.12.0.pre.rc.12 → 14.13.0.pre.alpha.play1834depupdatesass6024

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +11 -4
  5. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ActionBarAnimationHelper.ts +26 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +71 -10
  7. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +37 -21
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +3 -3
  9. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +3 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +33 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading_rails.md +1 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_loading.md → _advanced_table_loading_react.md} +2 -2
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb +38 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +1 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +3 -1
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.jsx +55 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_react.md +3 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  21. data/app/pb_kits/playbook/pb_advanced_table/index.js +9 -6
  22. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +17 -3
  23. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +15 -11
  24. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +14 -3
  25. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +10 -7
  26. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +9 -1
  27. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -1
  28. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +9 -0
  29. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +14 -0
  30. data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +11 -7
  31. data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +6 -7
  32. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +9 -3
  33. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +6 -2
  34. data/app/pb_kits/playbook/pb_button/button.rb +1 -1
  35. data/app/pb_kits/playbook/pb_card/card.html.erb +21 -2
  36. data/app/pb_kits/playbook/pb_card/card.rb +7 -0
  37. data/app/pb_kits/playbook/pb_copy_button/_copy_button.scss +4 -0
  38. data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +92 -0
  39. data/app/pb_kits/playbook/pb_copy_button/copy_button.html.erb +15 -0
  40. data/app/pb_kits/playbook/pb_copy_button/copy_button.rb +28 -0
  41. data/app/pb_kits/playbook/pb_copy_button/copy_button.test.jsx +64 -0
  42. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.html.erb +2 -0
  43. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_default.jsx +21 -0
  44. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb +5 -0
  45. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx +45 -0
  46. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md +1 -0
  47. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +8 -0
  48. data/app/pb_kits/playbook/pb_copy_button/docs/index.js +2 -0
  49. data/app/pb_kits/playbook/pb_copy_button/index.js +47 -0
  50. data/app/pb_kits/playbook/pb_date/_date.tsx +14 -4
  51. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +2 -1
  52. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +13 -5
  53. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.html.erb +99 -0
  54. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +1 -0
  55. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +1 -3
  56. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +7 -0
  57. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +61 -0
  58. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -0
  59. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -5
  60. data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +2 -2
  61. data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +5 -0
  62. data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +1 -1
  63. data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +4 -0
  64. data/app/pb_kits/playbook/pb_draggable/index.js +151 -15
  65. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -6
  66. data/app/pb_kits/playbook/pb_filter/filter.html.erb +1 -5
  67. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +58 -0
  68. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close_rails.md +3 -0
  69. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +1 -0
  70. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/index.js +7 -5
  71. data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +1 -6
  72. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
  73. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +11 -7
  74. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +11 -0
  75. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +22 -0
  76. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +1 -0
  77. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +1 -0
  78. data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
  79. data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
  80. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +13 -2
  81. data/app/pb_kits/playbook/pb_icon/icon.html.erb +2 -6
  82. data/app/pb_kits/playbook/pb_layout/body.html.erb +1 -5
  83. data/app/pb_kits/playbook/pb_layout/footer.html.erb +1 -5
  84. data/app/pb_kits/playbook/pb_layout/header.html.erb +1 -5
  85. data/app/pb_kits/playbook/pb_layout/item.html.erb +1 -5
  86. data/app/pb_kits/playbook/pb_layout/layout.html.erb +1 -5
  87. data/app/pb_kits/playbook/pb_layout/sidebar.html.erb +1 -5
  88. data/app/pb_kits/playbook/pb_legend/legend.html.erb +1 -6
  89. data/app/pb_kits/playbook/pb_lightbox/lightbox.scss +7 -6
  90. data/app/pb_kits/playbook/pb_link/_link.tsx +18 -0
  91. data/app/pb_kits/playbook/pb_link/docs/_link_target.html.erb +15 -0
  92. data/app/pb_kits/playbook/pb_link/docs/_link_target.jsx +29 -0
  93. data/app/pb_kits/playbook/pb_link/docs/example.yml +5 -3
  94. data/app/pb_kits/playbook/pb_link/docs/index.js +2 -1
  95. data/app/pb_kits/playbook/pb_link/link.html.erb +1 -1
  96. data/app/pb_kits/playbook/pb_link/link.rb +6 -0
  97. data/app/pb_kits/playbook/pb_link/link.test.jsx +30 -0
  98. data/app/pb_kits/playbook/pb_message/message.html.erb +1 -6
  99. data/app/pb_kits/playbook/pb_message/message_mention.html.erb +1 -6
  100. data/app/pb_kits/playbook/pb_progress_step/docs/_progress_step_tooltip.html.erb +6 -6
  101. data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb +6 -9
  102. data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx +6 -9
  103. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +12 -8
  104. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb +52 -0
  105. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md +0 -0
  106. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb +52 -0
  107. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +3 -0
  108. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb +80 -0
  109. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +1 -0
  110. data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
  111. data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +26 -0
  112. data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +0 -1
  113. data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +25 -0
  114. data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +25 -0
  115. data/app/pb_kits/playbook/pb_table/table_row.rb +1 -1
  116. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +1 -1
  117. data/app/pb_kits/playbook/pb_text_input/index.js +52 -83
  118. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +3 -1
  119. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default.html.erb +1 -1
  120. data/app/pb_kits/playbook/pb_tooltip/index.js +45 -27
  121. data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +5 -1
  122. data/app/pb_kits/playbook/pb_user/_user.tsx +3 -0
  123. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.html.erb +42 -0
  124. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.jsx +59 -0
  125. data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.md +2 -0
  126. data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
  127. data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
  128. data/app/pb_kits/playbook/pb_user/user.html.erb +1 -1
  129. data/app/pb_kits/playbook/pb_user/user.rb +1 -0
  130. data/app/pb_kits/playbook/pb_user/user.test.js +14 -0
  131. data/dist/chunks/_typeahead-DQTwAd_2.js +36 -0
  132. data/dist/chunks/_weekday_stacked-CnPEqV7l.js +45 -0
  133. data/dist/chunks/{lib-kMuhBuU7.js → lib-WQEeEj3t.js} +2 -2
  134. data/dist/chunks/{pb_form_validation-DBJ0wZuS.js → pb_form_validation-Cq64l4zn.js} +1 -1
  135. data/dist/chunks/vendor.js +1 -1
  136. data/dist/menu.yml +6 -0
  137. data/dist/playbook-doc.js +1 -1
  138. data/dist/playbook-rails-react-bindings.js +1 -1
  139. data/dist/playbook-rails.js +1 -1
  140. data/dist/playbook.css +1 -1
  141. data/lib/playbook/pb_forms_global_props_helper.rb +136 -0
  142. data/lib/playbook/pb_forms_helper.rb +13 -4
  143. data/lib/playbook/version.rb +2 -2
  144. metadata +49 -8
  145. data/dist/chunks/_typeahead-BWwaAo_0.js +0 -36
  146. data/dist/chunks/_weekday_stacked-zyBCd1s8.js +0 -45
  147. /data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/{_fixed_confirmation_toast_auto_close.md → _fixed_confirmation_toast_auto_close_react.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b01422970c47b5ac3d53ad0fa10ea7cb9bbb8be651852f4c2ee25b2d51379ee7
4
- data.tar.gz: 4a196fb9aa2fc4eea20c60530f607c89313ba0e7b36baab2915dfa1be31ceda0
3
+ metadata.gz: eaae4c0710eed5f130a25be20f2b53abeb9c0e8411e98a2fea634d1d36ab4441
4
+ data.tar.gz: fcd82b79aec1f5f402e1818c53d747e91e488ec3ee7b41cb35708ccf7a6a82de
5
5
  SHA512:
6
- metadata.gz: c240f23324bd2e796025ce55b2c4d71b24c40591bee4ae0b9f769a54907b0933874f875b0c9f16630c5e1801a882fc54278041fc612655872ab36418ddc8f62e
7
- data.tar.gz: 3c9a91daa012c834a2cdef8b4be88f97df70c48b6f4bfe6b545622b80f0ca4661563b91eeaac4e9288a06f9d3c2fd998ae2890f2d918504d7accca57f1aa8748
6
+ metadata.gz: f1b38fee7ad7e12b3d352caf206eb0bfa06d70f61b4822c87065910e4afa8aa0b449d34057115af2ad36fb49041f95ed5e4fc929078ac0f65f696e51076e6fc2
7
+ data.tar.gz: 8c92d4019299e686dbeb55e880f75907ceca98eb5e285ab441e29a9984de5528f46dd0b525c61e580ed3e9605b085017a1be8aedc198800e4004fa76f3b1d133
@@ -15,6 +15,7 @@
15
15
  @import 'pb_circle_chart/circle_chart';
16
16
  @import 'pb_circle_icon_button/circle_icon_button';
17
17
  @import 'pb_collapsible/collapsible';
18
+ @import 'pb_copy_button/copy_button';
18
19
  @import 'pb_contact/contact';
19
20
  @import 'pb_currency/currency';
20
21
  @import 'pb_dashboard_value/dashboard_value';
@@ -47,7 +47,7 @@ export const CustomCell = ({
47
47
  <Flex
48
48
  alignItems="center"
49
49
  columnGap="xs"
50
- justify={!hasAnySubRows ? "end" : "start"}
50
+ justify={!hasAnySubRows && !inlineRowLoading ? "end" : "start"}
51
51
  orientation="row"
52
52
  >
53
53
  {
@@ -39,8 +39,15 @@ export const TableHeaderCell = ({
39
39
  sortIcon,
40
40
  table
41
41
  }: TableHeaderCellProps) => {
42
- const { sortControl, responsive, selectableRows, hasAnySubRows, showActionsBar } =
43
- useContext(AdvancedTableContext);
42
+ const {
43
+ sortControl,
44
+ responsive,
45
+ selectableRows,
46
+ hasAnySubRows,
47
+ showActionsBar,
48
+ inlineRowLoading,
49
+ isActionBarVisible,
50
+ } = useContext(AdvancedTableContext);
44
51
 
45
52
  type justifyTypes = "none" | "center" | "start" | "end" | "between" | "around" | "evenly"
46
53
 
@@ -65,7 +72,7 @@ export const TableHeaderCell = ({
65
72
 
66
73
  const cellClassName = classnames(
67
74
  "table-header-cells",
68
- `${showActionsBar && "header-cells-with-actions"}`,
75
+ `${showActionsBar && isActionBarVisible && "header-cells-with-actions"}`,
69
76
  `${isChrome() ? "chrome-styles" : ""}`,
70
77
  `${enableSorting ? "table-header-cells-active" : ""}`,
71
78
  { "pinned-left": responsive === "scroll" && isPinnedLeft },
@@ -91,7 +98,7 @@ const isToggleExpansionEnabled =
91
98
 
92
99
  let justifyHeader:justifyTypes;
93
100
 
94
- if (header?.index === 0 && hasAnySubRows) {
101
+ if (header?.index === 0 && hasAnySubRows || (header?.index === 0 && inlineRowLoading)) {
95
102
  justifyHeader = enableSorting ? "between" : "start";
96
103
  } else {
97
104
  justifyHeader = isLeafColumn ? "end" : "center";
@@ -0,0 +1,26 @@
1
+ export const showActionBar = (elem: HTMLElement) => {
2
+ elem.style.display = "block";
3
+ const height = elem.scrollHeight + "px";
4
+ elem.style.height = height;
5
+ elem.classList.add("is-visible");
6
+ elem.style.overflow = "hidden";
7
+
8
+ window.setTimeout(() => {
9
+ if (elem.classList.contains("is-visible")) {
10
+ elem.style.height = "";
11
+ elem.style.overflow = "visible";
12
+ }
13
+ }, 300);
14
+ };
15
+
16
+ export const hideActionBar = (elem: HTMLElement) => {
17
+ elem.style.height = elem.scrollHeight + "px";
18
+ elem.offsetHeight;
19
+ window.setTimeout(() => {
20
+ elem.style.height = "0";
21
+ elem.style.overflow = "hidden";
22
+ }, 10);
23
+ window.setTimeout(() => {
24
+ elem.classList.remove("is-visible");
25
+ }, 300);
26
+ };
@@ -31,12 +31,12 @@
31
31
  width: 100%;
32
32
  }
33
33
 
34
- .row-selection-actions-card {
35
- border-bottom-right-radius: 0px !important;
36
- border-bottom-left-radius: 0px !important;
37
- border-bottom-color: transparent;
38
- }
39
-
34
+ .row-selection-actions-card {
35
+ border-bottom-right-radius: 0px !important;
36
+ border-bottom-left-radius: 0px !important;
37
+ border-bottom-color: transparent;
38
+ transition: height 300ms ease;
39
+ }
40
40
  .table-header-cells:first-child {
41
41
  min-width: 180px;
42
42
  }
@@ -89,11 +89,47 @@
89
89
  }
90
90
  }
91
91
 
92
-
93
92
  .table-header-cells-active:first-child {
94
93
  color: $primary !important;
95
94
  }
96
95
 
96
+ // Sticky Header
97
+ .sticky-header {
98
+ thead {
99
+ z-index: 3 !important;
100
+ }
101
+ }
102
+
103
+ // Max height overflow - the below prevents expansion from overflowing container at full screen for responsive and nonresponsive tables
104
+ &.advanced-table-max-height-xs {
105
+ max-height: 320px;
106
+ overflow-y: auto;
107
+ }
108
+ &.advanced-table-max-height-sm {
109
+ max-height: 480px;
110
+ overflow-y: auto;
111
+ }
112
+ &.advanced-table-max-height-md {
113
+ max-height: 768px;
114
+ overflow-y: auto;
115
+ }
116
+ &.advanced-table-max-height-lg {
117
+ max-height: 1024px;
118
+ overflow-y: auto;
119
+ }
120
+ &.advanced-table-max-height-xl {
121
+ max-height: 1280px;
122
+ overflow-y: auto;
123
+ }
124
+ &.advanced-table-max-height-xxl {
125
+ max-height: 1440px;
126
+ overflow-y: auto;
127
+ }
128
+ &.advanced-table-max-height-xxxl {
129
+ max-height: 1920px;
130
+ overflow-y: auto;
131
+ }
132
+
97
133
  // Icons
98
134
  .button-icon {
99
135
  display: flex;
@@ -179,7 +215,7 @@
179
215
  }
180
216
 
181
217
  // Responsive Styles
182
- @media only screen and (max-width: $screen-xl-min) {
218
+ @media only screen and (max-width: $screen-xl-min) {
183
219
  &[class*="advanced-table-responsive-scroll"] {
184
220
  border-radius: 4px;
185
221
  box-shadow: 1px 0 0 0px $border_light,
@@ -215,7 +251,24 @@
215
251
  .bg-white td:first-child {
216
252
  background-color: $white;
217
253
  }
218
-
254
+ .row-selection-actions-card {
255
+ border-right-width: 0px;
256
+ border-left-width: 0px;
257
+ position: sticky;
258
+ top: 0;
259
+ left: 0;
260
+ border-radius: unset;
261
+ }
262
+ .checkbox-cell {
263
+ display: table-cell !important;
264
+ }
265
+ .sticky-header {
266
+ thead {
267
+ th:first-child {
268
+ box-shadow: 1px 0 10px -2px $border_light !important;
269
+ }
270
+ }
271
+ }
219
272
  }
220
273
  }
221
274
  @media only screen and (min-width: $screen-xl-min) {
@@ -303,7 +356,15 @@
303
356
  .bg-white td:first-child {
304
357
  background-color: $bg_dark_card;
305
358
  }
359
+ .sticky-header {
360
+ thead {
361
+ th:first-child {
362
+ background: $bg_dark;
363
+ box-shadow: 1px 0 10px -2px $border_dark !important;
364
+ }
365
+ }
366
+ }
306
367
  }
307
368
  }
308
369
  }
309
- }
370
+ }
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useCallback } from "react"
1
+ import React, { useState, useEffect, useCallback, useRef } from "react"
2
2
  import classnames from "classnames"
3
3
 
4
4
  import { GenericObject } from "../types"
@@ -27,6 +27,7 @@ import FlexItem from "../pb_flex/_flex_item"
27
27
  import AdvancedTableContext from "./Context/AdvancedTableContext"
28
28
 
29
29
  import { updateExpandAndCollapseState } from "./Utilities/ExpansionControlHelpers"
30
+ import { showActionBar, hideActionBar } from "./Utilities/ActionBarAnimationHelper"
30
31
 
31
32
  import { CustomCell } from "./Components/CustomCell"
32
33
  import { TableHeader } from "./SubKits/TableHeader"
@@ -48,6 +49,7 @@ type AdvancedTableProps = {
48
49
  initialLoadingRowsCount?: number
49
50
  inlineRowLoading?: boolean
50
51
  loading?: boolean | string
52
+ maxHeight?: "auto" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl"
51
53
  onRowToggleClick?: (arg: Row<GenericObject>) => void
52
54
  onToggleExpansionClick?: (arg: Row<GenericObject>) => void
53
55
  pagination?: boolean,
@@ -79,6 +81,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
79
81
  initialLoadingRowsCount = 10,
80
82
  inlineRowLoading = false,
81
83
  loading,
84
+ maxHeight,
82
85
  onRowToggleClick,
83
86
  onToggleExpansionClick,
84
87
  pagination = false,
@@ -288,6 +291,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
288
291
  const classes = classnames(
289
292
  buildCss("pb_advanced_table"),
290
293
  `advanced-table-responsive-${responsive}`,
294
+ maxHeight ? `advanced-table-max-height-${maxHeight}` : '', // max height as kit prop not global prop to control overflow-y
291
295
  globalProps(props),
292
296
  className
293
297
  )
@@ -295,6 +299,20 @@ const AdvancedTable = (props: AdvancedTableProps) => {
295
299
  const onPageChange = (page: number) => {
296
300
  table.setPageIndex(page - 1)
297
301
  }
302
+ //When to show the actions bar as a whole
303
+ const isActionBarVisible = selectableRows && showActionsBar && selectedRowsLength > 0
304
+
305
+ //Ref and useEffect for animating the actions bar
306
+ const cardRef = useRef(null);
307
+ useEffect(() => {
308
+ if (cardRef.current) {
309
+ if (isActionBarVisible) {
310
+ showActionBar(cardRef.current);
311
+ } else {
312
+ hideActionBar(cardRef.current);
313
+ }
314
+ }
315
+ }, [isActionBarVisible]);
298
316
 
299
317
  return (
300
318
  <div {...ariaProps}
@@ -311,6 +329,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
311
329
  expandedControl,
312
330
  handleExpandOrCollapse,
313
331
  inlineRowLoading,
332
+ isActionBarVisible,
314
333
  loading,
315
334
  responsive,
316
335
  setExpanded,
@@ -333,27 +352,24 @@ const AdvancedTable = (props: AdvancedTableProps) => {
333
352
  total={table.getPageCount()}
334
353
  />
335
354
  }
336
- {
337
- selectableRows && showActionsBar && (
338
- <Card className="row-selection-actions-card"
339
- padding="xs"
355
+ <Card
356
+ borderNone={!isActionBarVisible}
357
+ className={`${isActionBarVisible && "show-action-card row-selection-actions-card"}`}
358
+ htmlOptions={{ ref: cardRef as any }}
359
+ padding={`${isActionBarVisible ? "xs" : "none"}`}
360
+ >
361
+ <Flex alignItems="center"
362
+ justify="between"
363
+ >
364
+ <Caption color="light"
365
+ paddingLeft="xs"
366
+ size="xs"
340
367
  >
341
- <Flex alignItems="center"
342
- justify="between"
343
- >
344
- <Caption color="light"
345
- paddingLeft="xs"
346
- size="xs"
347
- >
348
- {selectedRowsLength} Selected
349
- </Caption>
350
- <FlexItem>
351
- {actions}
352
- </FlexItem>
353
- </Flex>
354
- </Card>
355
- )
356
- }
368
+ {selectedRowsLength} Selected
369
+ </Caption>
370
+ <FlexItem>{actions}</FlexItem>
371
+ </Flex>
372
+ </Card>
357
373
  <Table
358
374
  className={`${loading ? "content-loading" : ""}`}
359
375
  dark={dark}
@@ -1,10 +1,10 @@
1
1
  <%= pb_content_tag do %>
2
- <%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }.merge(object.table_props)) do %>
2
+ <%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark, classname: object.loading ? "content-loading" : "" }.merge(object.table_props)) do %>
3
3
  <% if content.present? %>
4
4
  <% content.presence %>
5
5
  <% else %>
6
- <%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion }) %>
7
- <%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions }) %>
6
+ <%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading }) %>
7
+ <%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading }) %>
8
8
  <% end %>
9
9
  <% end %>
10
10
  <% end %>
@@ -10,9 +10,11 @@ module Playbook
10
10
  prop :enable_toggle_expansion, type: Playbook::Props::Enum,
11
11
  values: %w[all header none],
12
12
  default: "header"
13
+ prop :loading, type: Playbook::Props::Boolean,
14
+ default: false
13
15
  prop :responsive, type: Playbook::Props::Enum,
14
16
  values: %w[none scroll],
15
- default: "none"
17
+ default: "scroll"
16
18
  prop :table_props, type: Playbook::Props::HashProp,
17
19
  default: {}
18
20
 
@@ -245,7 +245,7 @@ test("toggleExpansionAll button exists and toggles subrows open and closed", asy
245
245
  })
246
246
 
247
247
 
248
- test("loading state + initialLoadingRowCount prop", () => {
248
+ test("loading state + initialLoadingRowsCount prop", () => {
249
249
  render(
250
250
  <AdvancedTable
251
251
  columnDefinitions={columnDefinitions}
@@ -0,0 +1,33 @@
1
+ <% column_definitions = [
2
+ {
3
+ accessor: "year",
4
+ label: "Year",
5
+ cellAccessors: ["quarter", "month", "day"],
6
+ },
7
+ {
8
+ accessor: "newEnrollments",
9
+ label: "New Enrollments",
10
+ },
11
+ {
12
+ accessor: "scheduledMeetings",
13
+ label: "Scheduled Meetings",
14
+ },
15
+ {
16
+ accessor: "attendanceRate",
17
+ label: "Attendance Rate",
18
+ },
19
+ {
20
+ accessor: "completedClasses",
21
+ label: "Completed Classes",
22
+ },
23
+ {
24
+ accessor: "classCompletionRate",
25
+ label: "Class Completion Rate",
26
+ },
27
+ {
28
+ accessor: "graduatedStudents",
29
+ label: "Graduated Students",
30
+ }
31
+ ] %>
32
+
33
+ <%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
@@ -0,0 +1 @@
1
+ The optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
@@ -1,3 +1,3 @@
1
- the optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
1
+ The optional `loading` prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
2
2
 
3
- By default, the inital row count of the loading skeleton is set to 10. If you want more control over this initial row count, the optional `initialLoadingRowCount` prop can be used to pass in a number. __NOTE__: This is only for the first render of the table, subsequent loading skeleton row count logic is handled within the kit itself.
3
+ By default, the inital row count of the loading skeleton is set to 10. If you want more control over this initial row count, the optional `initialLoadingRowsCount` prop can be used to pass in a number. __NOTE__: This is only for the first render of the table, subsequent loading skeleton row count logic is handled within the kit itself.
@@ -0,0 +1,38 @@
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
+ <%= pb_rails("title", props: { size: 4 }) do %> Not Responsive <% end %>
35
+ <%= pb_rails("advanced_table", props: { id: "table_props_table_non_responsive", table_data: @table_data, column_definitions: column_definitions, responsive: "none" }) %>
36
+
37
+ <%= pb_rails("title", props: { padding_top: "sm", size: 4 }) do %> Responsive as Default <% end %>
38
+ <%= pb_rails("advanced_table", props: { id: "table_props_table_responsive", table_data: @table_data, column_definitions: column_definitions }) %>
@@ -44,6 +44,7 @@ const AdvancedTableTableProps = (props) => {
44
44
  <div>
45
45
  <AdvancedTable
46
46
  columnDefinitions={columnDefinitions}
47
+ responsive="none"
47
48
  tableData={MOCK_DATA}
48
49
  tableProps={tableProps}
49
50
  {...props}
@@ -1 +1,3 @@
1
- This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react).
1
+ This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table/react) under the hood which comes with it's own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional `tableProps` prop. This prop must be an object that contains valid Table props. For a full list of Table props, see [here](https://playbook.powerapp.cloud/kits/table/react).
2
+
3
+ This doc example showcases how to set a sticky header for a nonresponsive table. To achieve sticky header AND responsive functionality, see the ["Table Props Sticky Header"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props-sticky-header) doc example below.
@@ -0,0 +1,55 @@
1
+ import React from "react"
2
+ import { AdvancedTable } from "playbook-ui"
3
+ import MOCK_DATA from "./advanced_table_mock_data.json"
4
+
5
+ const AdvancedTableTablePropsStickyHeader = (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 tableProps = {
39
+ sticky: true
40
+ }
41
+
42
+ return (
43
+ <div>
44
+ <AdvancedTable
45
+ columnDefinitions={columnDefinitions}
46
+ maxHeight="xs"
47
+ tableData={MOCK_DATA}
48
+ tableProps={tableProps}
49
+ {...props}
50
+ />
51
+ </div>
52
+ )
53
+ }
54
+
55
+ export default AdvancedTableTablePropsStickyHeader
@@ -0,0 +1,3 @@
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/visual_guidelines/max_height) global prop. 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.
2
+
3
+ A sticky header on a nonresponsive table is demonstrated in the ["Table Props"](https://playbook.powerapp.cloud/kits/advanced_table/react#table-props) doc example above.
@@ -1,10 +1,12 @@
1
1
  examples:
2
2
  rails:
3
3
  - advanced_table_beta: Default (Required Props)
4
+ - advanced_table_loading: Loading State
4
5
  - advanced_table_beta_subrow_headers: SubRow Headers
5
6
  - advanced_table_collapsible_trail_rails: Collapsible Trail
6
7
  - advanced_table_table_props: Table Props
7
8
  - advanced_table_beta_sort: Enable Sorting
9
+ - advanced_table_responsive: Responsive Tables
8
10
  - advanced_table_custom_cell_rails: Custom Components for Cells
9
11
  - advanced_table_column_headers: Multi-Header Columns
10
12
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
@@ -20,6 +22,7 @@ examples:
20
22
  - advanced_table_collapsible_trail: Collapsible Trail
21
23
  - advanced_table_table_options: Table Options
22
24
  - advanced_table_table_props: Table Props
25
+ - advanced_table_table_props_sticky_header: Table Props Sticky Header
23
26
  - advanced_table_inline_row_loading: Inline Row Loading
24
27
  - advanced_table_responsive: Responsive Tables
25
28
  - advanced_table_custom_cell: Custom Components for Cells
@@ -18,4 +18,5 @@ export { default as AdvancedTableSelectableRows } from './_advanced_table_select
18
18
  export { default as AdvancedTableSelectableRowsNoSubrows } from './_advanced_table_selectable_rows_no_subrows.jsx'
19
19
  export { default as AdvancedTableNoSubrows } from './_advanced_table_no_subrows.jsx'
20
20
  export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_selectable_rows_header.jsx'
21
- export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
21
+ export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
22
+ export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
@@ -133,15 +133,18 @@ export default class PbAdvancedTable extends PbEnhancedElement {
133
133
  if (!elements.length) return;
134
134
 
135
135
  const isVisible = elements[0].classList.contains("is-visible");
136
- if (isVisible) {
137
- this.hideElement(elements);
138
- this.displayDownArrow();
139
- } else {
140
- this.showElement(elements);
141
- this.displayUpArrow();
136
+
137
+ isVisible ? this.hideElement(elements) : this.showElement(elements);
138
+ isVisible ? this.displayDownArrow() : this.displayUpArrow();
139
+
140
+ const row = this.element.closest("tr");
141
+ if (row) {
142
+ row.classList.toggle("bg-silver", !isVisible);
143
+ row.classList.toggle("bg-white", isVisible);
142
144
  }
143
145
  }
144
146
 
147
+
145
148
  displayDownArrow() {
146
149
  this.element.querySelector(DOWN_ARROW_SELECTOR).style.display =
147
150
  "inline-block";
@@ -16,6 +16,11 @@ module Playbook
16
16
  default: []
17
17
  prop :collapsible_trail, type: Playbook::Props::Boolean,
18
18
  default: true
19
+ prop :loading, type: Playbook::Props::Boolean,
20
+ default: false
21
+ prop :responsive, type: Playbook::Props::Enum,
22
+ values: %w[none scroll],
23
+ default: "scroll"
19
24
 
20
25
  def flatten_columns(columns)
21
26
  columns.flat_map do |col|
@@ -46,12 +51,12 @@ module Playbook
46
51
  row_parent: "#{id}_#{ancestor_ids.last}",
47
52
  }
48
53
  # Subrow header if applicable
49
- output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", subrow_data_attributes: subrow_data_attributes }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
54
+ output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: leaf_columns, depth: current_depth, subrow_header: subrow_headers[current_depth - 1], collapsible_trail: collapsible_trail, classname: "toggle-content", responsive: responsive, subrow_data_attributes: subrow_data_attributes }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
50
55
 
51
56
  current_data_attributes = current_depth.zero? ? { row_depth: 0 } : table_data_attributes
52
57
 
53
58
  # Additional class and data attributes needed for toggle logic
54
- output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes })
59
+ output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading })
55
60
 
56
61
  if row[:children].present?
57
62
  row[:children].each do |child_row|
@@ -74,7 +79,16 @@ module Playbook
74
79
  end
75
80
 
76
81
  def classname
77
- generate_classname("pb_advanced_table_body", separator: " ")
82
+ additional_classes = []
83
+ additional_classes << "advanced-table-responsive-#{responsive} pinned-left" if responsive == "scroll"
84
+
85
+ generate_classname("pb_advanced_table_body", *additional_classes, separator: " ")
86
+ end
87
+
88
+ def pinned_cell_class(index)
89
+ return "pinned-left" if index.zero? && responsive == "scroll"
90
+
91
+ ""
78
92
  end
79
93
 
80
94
  private