playbook_ui 16.11.0.pre.alpha.PLAY308717843 → 16.11.0.pre.alpha.bettermetadata18084

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 (146) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +7 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +3 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +6 -3
  5. data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +6 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell.jsx +69 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell.md +3 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell_rails.html.erb +49 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_full_width_cell_rails.md +3 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both_rails.html.erb +57 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_both_rails.md +1 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom_rails.html.erb +57 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_bottom_rails.md +1 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +5 -5
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +3 -3
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers.html.erb +40 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers.jsx +55 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_rails.md +1 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_react.md +1 -0
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +4 -1
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -1
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +7 -1
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
  27. data/app/pb_kits/playbook/pb_advanced_table/index.js +28 -11
  28. data/app/pb_kits/playbook/pb_advanced_table/kit.schema.json +12 -2
  29. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +17 -5
  30. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +57 -18
  31. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  32. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +6 -0
  33. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +4 -0
  34. data/app/pb_kits/playbook/pb_avatar/docs/_playground.json +1 -0
  35. data/app/pb_kits/playbook/pb_avatar/kit.schema.json +4 -2
  36. data/app/pb_kits/playbook/pb_background/kit.schema.json +3 -3
  37. data/app/pb_kits/playbook/pb_card/docs/_playground.json +1 -0
  38. data/app/pb_kits/playbook/pb_card/kit.schema.json +5 -3
  39. data/app/pb_kits/playbook/pb_currency/docs/_playground.json +1 -0
  40. data/app/pb_kits/playbook/pb_currency/kit.schema.json +4 -2
  41. data/app/pb_kits/playbook/pb_date_picker/docs/_playground.json +1 -0
  42. data/app/pb_kits/playbook/pb_date_picker/kit.schema.json +18 -2
  43. data/app/pb_kits/playbook/pb_date_range_inline/docs/_playground.json +1 -0
  44. data/app/pb_kits/playbook/pb_date_range_inline/kit.schema.json +4 -2
  45. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_playground.json +3 -1
  46. data/app/pb_kits/playbook/pb_date_range_stacked/kit.schema.json +4 -2
  47. data/app/pb_kits/playbook/pb_date_stacked/docs/_playground.json +1 -0
  48. data/app/pb_kits/playbook/pb_date_stacked/kit.schema.json +4 -2
  49. data/app/pb_kits/playbook/pb_date_time/kit.schema.json +7 -0
  50. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_playground.json +1 -0
  51. data/app/pb_kits/playbook/pb_date_time_stacked/kit.schema.json +4 -2
  52. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_playground.json +2 -1
  53. data/app/pb_kits/playbook/pb_date_year_stacked/kit.schema.json +4 -2
  54. data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.html.erb +8 -1
  55. data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb +3 -6
  56. data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +7 -14
  57. data/app/pb_kits/playbook/pb_docs/kit_example.rb +2 -17
  58. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.html.erb +67 -0
  59. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.jsx +95 -0
  60. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.md +1 -0
  61. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  62. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -0
  63. data/app/pb_kits/playbook/pb_filter/docs/_playground.json +1 -1
  64. data/app/pb_kits/playbook/pb_filter/kit.schema.json +6 -3
  65. data/app/pb_kits/playbook/pb_flex/kit.schema.json +6 -3
  66. data/app/pb_kits/playbook/pb_home_address_street/docs/_playground.json +1 -0
  67. data/app/pb_kits/playbook/pb_home_address_street/kit.schema.json +4 -2
  68. data/app/pb_kits/playbook/pb_icon/docs/_playground.json +1 -0
  69. data/app/pb_kits/playbook/pb_icon/kit.schema.json +18 -5
  70. data/app/pb_kits/playbook/pb_icon_circle/kit.schema.json +12 -4
  71. data/app/pb_kits/playbook/pb_icon_stat_value/kit.schema.json +3 -3
  72. data/app/pb_kits/playbook/pb_layout/docs/_playground.json +1 -0
  73. data/app/pb_kits/playbook/pb_layout/kit.schema.json +4 -2
  74. data/app/pb_kits/playbook/pb_list/docs/_playground.json +1 -0
  75. data/app/pb_kits/playbook/pb_list/kit.schema.json +4 -2
  76. data/app/pb_kits/playbook/pb_loading_inline/docs/_playground.json +1 -0
  77. data/app/pb_kits/playbook/pb_loading_inline/kit.schema.json +4 -2
  78. data/app/pb_kits/playbook/pb_map/docs/_playground.json +7 -0
  79. data/app/pb_kits/playbook/pb_map/docs/_playground.overrides.json +5 -0
  80. data/app/pb_kits/playbook/pb_message/kit.schema.json +1 -1
  81. data/app/pb_kits/playbook/pb_multi_level_select/docs/_playground.json +1 -0
  82. data/app/pb_kits/playbook/pb_multi_level_select/kit.schema.json +2 -1
  83. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_playground.json +9 -0
  84. data/app/pb_kits/playbook/pb_pb_bar_graph/docs/_playground.overrides.json +6 -0
  85. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_playground.json +9 -0
  86. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_playground.overrides.json +6 -0
  87. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_playground.json +9 -0
  88. data/app/pb_kits/playbook/pb_pb_gauge_chart/docs/_playground.overrides.json +6 -0
  89. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_playground.json +9 -0
  90. data/app/pb_kits/playbook/pb_pb_line_graph/docs/_playground.overrides.json +6 -0
  91. data/app/pb_kits/playbook/pb_phone_number_input/docs/_playground.json +1 -0
  92. data/app/pb_kits/playbook/pb_phone_number_input/kit.schema.json +4 -2
  93. data/app/pb_kits/playbook/pb_pill/_pill.scss +25 -4
  94. data/app/pb_kits/playbook/pb_pill/_pill.test.jsx +83 -0
  95. data/app/pb_kits/playbook/pb_pill/_pill.tsx +3 -1
  96. data/app/pb_kits/playbook/pb_pill/docs/_pill_size.html.erb +1 -0
  97. data/app/pb_kits/playbook/pb_pill/docs/_pill_size.jsx +16 -0
  98. data/app/pb_kits/playbook/pb_pill/docs/_pill_size.md +1 -0
  99. data/app/pb_kits/playbook/pb_pill/docs/_playground.json +11 -0
  100. data/app/pb_kits/playbook/pb_pill/docs/_playground.overrides.json +11 -1
  101. data/app/pb_kits/playbook/pb_pill/docs/example.yml +2 -0
  102. data/app/pb_kits/playbook/pb_pill/docs/index.js +1 -0
  103. data/app/pb_kits/playbook/pb_pill/kit.schema.json +13 -2
  104. data/app/pb_kits/playbook/pb_pill/pill.rb +4 -1
  105. data/app/pb_kits/playbook/pb_popover/kit.schema.json +54 -2
  106. data/app/pb_kits/playbook/pb_progress_simple/docs/_playground.json +2 -2
  107. data/app/pb_kits/playbook/pb_progress_simple/kit.schema.json +4 -2
  108. data/app/pb_kits/playbook/pb_progress_step/kit.schema.json +2 -2
  109. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.json +11 -0
  110. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_playground.overrides.json +11 -0
  111. data/app/pb_kits/playbook/pb_section_separator/docs/_playground.json +1 -0
  112. data/app/pb_kits/playbook/pb_section_separator/kit.schema.json +4 -2
  113. data/app/pb_kits/playbook/pb_skeleton_loading/docs/_playground.json +5 -4
  114. data/app/pb_kits/playbook/pb_skeleton_loading/kit.schema.json +43 -14
  115. data/app/pb_kits/playbook/pb_time_picker/docs/_playground.json +1 -0
  116. data/app/pb_kits/playbook/pb_time_picker/kit.schema.json +4 -2
  117. data/app/pb_kits/playbook/pb_time_range_inline/docs/_playground.json +1 -0
  118. data/app/pb_kits/playbook/pb_time_range_inline/kit.schema.json +4 -2
  119. data/app/pb_kits/playbook/pb_timeline/kit.schema.json +1 -1
  120. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +7 -5
  121. data/app/pb_kits/playbook/pb_timestamp/activeSupportTimeZones.ts +165 -0
  122. data/app/pb_kits/playbook/pb_timestamp/docs/_playground.json +1 -0
  123. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.html.erb +15 -0
  124. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.jsx +19 -0
  125. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.md +3 -1
  126. data/app/pb_kits/playbook/pb_timestamp/kit.schema.json +4 -2
  127. data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +44 -0
  128. data/app/pb_kits/playbook/pb_tooltip/kit.schema.json +21 -7
  129. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +145 -1
  130. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +30 -4
  131. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +33 -10
  132. data/app/pb_kits/playbook/pb_typeahead/docs/_playground.json +2 -0
  133. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.html.erb +7 -0
  134. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.md +11 -1
  135. data/app/pb_kits/playbook/pb_typeahead/kit.schema.json +36 -33
  136. data/app/pb_kits/playbook/utilities/global-props.schema.json +318 -1
  137. data/dist/chunks/_typeahead-DqA5Pxcc.js +5 -0
  138. data/dist/chunks/vendor.js +3 -3
  139. data/dist/menu.yml +3 -12
  140. data/dist/playbook-rails-react-bindings.js +1 -1
  141. data/dist/playbook-rails.js +1 -1
  142. data/dist/playbook.css +1 -1
  143. data/lib/playbook/pb_doc_helper.rb +0 -2
  144. data/lib/playbook/version.rb +1 -1
  145. metadata +23 -3
  146. data/dist/chunks/_typeahead-CXg3ungD.js +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00db3d23c89ba37db73a4991f6df1fe6642c7ad40790dea3523d91d27a6eac09
4
- data.tar.gz: e10a651ffc72c33c9ad69f93a61ab4a7b617552a86adbaf810cc0b2521c496b4
3
+ metadata.gz: dc8efac2071a693a945c9ad2b6bdd0ce9e7c092250ad1912188e33a24a2ed86e
4
+ data.tar.gz: 4c02ea4ad383b32bc3a153172ebb4a838c5f540d2d893d635e76ff8b55fa346b
5
5
  SHA512:
6
- metadata.gz: 1cc120b2aade21a5e4835307a8fcc5efefe19e69b5f245b8f964b62a6bb04392dd13d9d11670762ae95196239ab64a14bf8c2e2f6f0a63af9137f534e21a9b1d
7
- data.tar.gz: c01f8df2a5af7711620e408c50848a5f2ca28139d2c8d4f00e2a67c288d799b33183c5877978750300ac7e9d93f14e6f4dc8b5e7e769291002c0ae14715ad7de
6
+ metadata.gz: 37e1d808f292e4f6190b49305d9adfdedb1ee03b5e034c06f98b186164bb90c26f64d433b294e4803bb655598ad4f110d7148fbb004e53d6ac3834c0c0e5644f
7
+ data.tar.gz: 58f3be19870b5bbc06d6a4852dc171c76040410536636319f74db242e255b3a5014d1f070a273d32e56a4846fd5d37392f253307824a4f386aea1335a1914cef
@@ -21,6 +21,7 @@ interface CustomCellProps {
21
21
  customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
22
22
  selectableRows?: boolean
23
23
  customStyle?: GenericObject
24
+ fullWidthCell?: boolean
24
25
  }
25
26
 
26
27
  export const CustomCell = ({
@@ -31,6 +32,7 @@ export const CustomCell = ({
31
32
  customRenderer,
32
33
  selectableRows,
33
34
  customStyle = {},
35
+ fullWidthCell,
34
36
  }: CustomCellProps & GlobalProps) => {
35
37
  const { setExpanded, expanded, expandedControl, inlineRowLoading, hasAnySubRows, cascadeCollapse } = useContext(AdvancedTableContext);
36
38
 
@@ -58,7 +60,7 @@ export const CustomCell = ({
58
60
  const renderButton = inlineRowLoading ? RowHasChildren : row.getCanExpand()
59
61
 
60
62
  return (
61
- <div style={{ paddingLeft: `${row.depth * 1.25}em`}}>
63
+ <div style={{ paddingLeft: `${row.depth * 1.25}em`, ...(fullWidthCell ? { width: "100%" } : {}) }}>
62
64
  <Flex
63
65
  alignItems="center"
64
66
  columnGap="xs"
@@ -94,7 +96,10 @@ export const CustomCell = ({
94
96
  )}
95
97
  </button>
96
98
  ) : null}
97
- <FlexItem paddingLeft={renderButton? "none" : "xs"}>
99
+ <FlexItem
100
+ paddingLeft={renderButton? "none" : "xs"}
101
+ width={fullWidthCell ? "100%" : undefined}
102
+ >
98
103
  {row.depth === 0 ? (
99
104
  customRenderer ? customRenderer(row, getValue()) : getValue()
100
105
  ) :(
@@ -213,6 +213,8 @@ export const RegularTableView = ({
213
213
  ))}
214
214
  {totalRows.map((row: Row<GenericObject>, rowIndex: number) => {
215
215
  const isFirstChildofSubrow = row.depth > 0 && row.index === 0;
216
+ const subRowHeaderText = subRowHeaders?.[row.depth - 1]?.trim();
217
+ const shouldRenderSubRowHeader = isFirstChildofSubrow && !!subRowHeaderText;
216
218
  const numberOfColumns = table.getAllFlatColumns().length;
217
219
  const isFirstRegularRow = rowIndex === 0 && !row.getIsPinned();
218
220
  const customRowStyle = getRowStyle(rowStyling, row);
@@ -223,7 +225,7 @@ export const RegularTableView = ({
223
225
 
224
226
  return (
225
227
  <React.Fragment key={`${row.index}-${row.id}-${row.depth}-row`}>
226
- {isFirstChildofSubrow && subRowHeaders && (
228
+ {shouldRenderSubRowHeader && (
227
229
  <SubRowHeaderRow
228
230
  collapsibleTrail={collapsibleTrail}
229
231
  enableToggleExpansion={enableToggleExpansion}
@@ -42,6 +42,7 @@ interface UseTableStateProps {
42
42
  rowStyling?: GenericObject[];
43
43
  inlineRowLoading?: boolean;
44
44
  sortParentOnly?: boolean;
45
+ fullWidthCell?: boolean;
45
46
  }
46
47
 
47
48
  export function useTableState({
@@ -62,7 +63,8 @@ export function useTableState({
62
63
  pinnedRows,
63
64
  rowStyling,
64
65
  inlineRowLoading = false,
65
- sortParentOnly = false
66
+ sortParentOnly = false,
67
+ fullWidthCell = false,
66
68
  }: UseTableStateProps) {
67
69
 
68
70
  // Create a local state for expanded and setExpanded if expandedControl not used
@@ -145,13 +147,14 @@ export function useTableState({
145
147
  isFirstColumn,
146
148
  onRowToggleClick,
147
149
  selectableRows,
148
- rowStyling
150
+ rowStyling,
151
+ fullWidthCell
149
152
  );
150
153
  }
151
154
 
152
155
  return columnStructure;
153
156
  }) || [];
154
- }, [columnHelper, onRowToggleClick, rowStyling, selectableRows]);
157
+ }, [columnHelper, onRowToggleClick, rowStyling, selectableRows, fullWidthCell]);
155
158
 
156
159
  const columns = useMemo(() => buildColumns(columnDefinitions), [buildColumns, columnDefinitions]);
157
160
 
@@ -12,6 +12,8 @@ import { getRowStyle } from "./RowUtils";
12
12
  * @param isFirstColumn Whether this is the first column (special handling)
13
13
  * @param onRowToggleClick Optional callback for row toggle
14
14
  * @param selectableRows Whether rows are selectable
15
+ * @param rowStyling Optional row styling configuration
16
+ * @param fullWidthCell Whether first-column cell content should take full width
15
17
  */
16
18
  export const createCellFunction = (
17
19
  cellAccessors: string[],
@@ -19,7 +21,8 @@ export const createCellFunction = (
19
21
  isFirstColumn?: boolean,
20
22
  onRowToggleClick?: (row: Row<GenericObject>) => void,
21
23
  selectableRows?: boolean,
22
- rowStyling?: GenericObject[]
24
+ rowStyling?: GenericObject[],
25
+ fullWidthCell?: boolean
23
26
  ) => {
24
27
  // Add display name to the returned function
25
28
  const cellRenderer = ({
@@ -39,6 +42,7 @@ export const createCellFunction = (
39
42
  <CustomCell
40
43
  customRenderer={customRenderer}
41
44
  customStyle={customStyle}
45
+ fullWidthCell={fullWidthCell}
42
46
  getValue={getValue}
43
47
  onRowToggleClick={onRowToggleClick}
44
48
  row={row}
@@ -54,6 +58,7 @@ export const createCellFunction = (
54
58
  <CustomCell
55
59
  customRenderer={customRenderer}
56
60
  customStyle={customStyle}
61
+ fullWidthCell={fullWidthCell}
57
62
  onRowToggleClick={onRowToggleClick}
58
63
  row={row}
59
64
  selectableRows={selectableRows}
@@ -36,6 +36,7 @@ type AdvancedTableProps = {
36
36
  expandedControl?: GenericObject
37
37
  expandByDepth?: GenericObject[]
38
38
  onExpandByDepthClick?: (arg: number, arg1: any) => void
39
+ fullWidthCell?: boolean
39
40
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
40
41
  id?: string
41
42
  initialLoadingRowsCount?: number
@@ -98,6 +99,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
98
99
  expandedControl,
99
100
  expandByDepth,
100
101
  onExpandByDepthClick,
102
+ fullWidthCell = false,
101
103
  htmlOptions = {},
102
104
  id,
103
105
  initialLoadingRowsCount = 10,
@@ -164,7 +166,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
164
166
  pinnedRows,
165
167
  rowStyling,
166
168
  inlineRowLoading,
167
- sortParentOnly
169
+ sortParentOnly,
170
+ fullWidthCell,
168
171
  });
169
172
 
170
173
  // Initialize table actions
@@ -12,7 +12,7 @@
12
12
  <% content.presence %>
13
13
  <% else %>
14
14
  <%= pb_rails("advanced_table/table_header", props: { table_id: object.id, column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, show_actions_bar: object.show_actions_bar, inline_row_loading: object.inline_row_loading, persist_toggle_expansion_button: object.persist_toggle_expansion_button, table_data: object.table_data }) %>
15
- <%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, pinned_rows: object.pinned_rows }) %>
15
+ <%= pb_rails("advanced_table/table_body", props: { table_id: object.id, table_data: object.table_data, column_definitions: object.column_definitions, responsive: object.responsive, loading: object.loading, selectable_rows: object.selectable_rows, enable_toggle_expansion: object.enable_toggle_expansion, row_styling: object.row_styling, inline_row_loading: object.inline_row_loading, full_width_cell: object.full_width_cell, pinned_rows: object.pinned_rows }) %>
16
16
  <% end %>
17
17
  <% end %>
18
18
  <% end %>
@@ -35,6 +35,8 @@ module Playbook
35
35
  default: []
36
36
  prop :inline_row_loading, type: Playbook::Props::Boolean,
37
37
  default: false
38
+ prop :full_width_cell, type: Playbook::Props::Boolean,
39
+ default: false
38
40
  prop :persist_toggle_expansion_button, type: Playbook::Props::Boolean,
39
41
  default: false
40
42
  prop :pinned_rows, type: Playbook::Props::HashProp,
@@ -0,0 +1,69 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import Flex from "../../pb_flex/_flex"
4
+ import Badge from "../../pb_badge/_badge"
5
+ import Title from "../../pb_title/_title"
6
+ import MOCK_DATA from "./advanced_table_mock_data.json"
7
+
8
+ const AdvancedTableFullWidthCell = (props) => {
9
+ const columnDefinitions = [
10
+ {
11
+ accessor: "year",
12
+ label: "Year",
13
+ cellAccessors: ["quarter", "month", "day"],
14
+ customRenderer: (row, value) => (
15
+ <Flex justify="between">
16
+ <Title size={4}
17
+ text={value}
18
+ />
19
+ <Badge dark
20
+ marginLeft="xxs"
21
+ text={row.original.newEnrollments > 20 ? "High" : "Low"}
22
+ variant="neutral"
23
+ />
24
+ </Flex>
25
+ ),
26
+ },
27
+ {
28
+ accessor: "newEnrollments",
29
+ label: "New Enrollments",
30
+ },
31
+ {
32
+ accessor: "scheduledMeetings",
33
+ label: "Scheduled Meetings",
34
+ },
35
+ {
36
+ accessor: "attendanceRate",
37
+ label: "Attendance Rate",
38
+ },
39
+ {
40
+ accessor: "completedClasses",
41
+ label: "Completed Classes",
42
+ },
43
+ {
44
+ accessor: "classCompletionRate",
45
+ label: "Class Completion Rate",
46
+ },
47
+ {
48
+ accessor: "graduatedStudents",
49
+ label: "Graduated Students",
50
+ },
51
+ ]
52
+
53
+ return (
54
+ <div>
55
+ <AdvancedTable
56
+ columnDefinitions={columnDefinitions}
57
+ enableToggleExpansion="all"
58
+ fullWidthCell
59
+ tableData={MOCK_DATA}
60
+ {...props}
61
+ >
62
+ <AdvancedTable.Header enableSorting />
63
+ <AdvancedTable.Body />
64
+ </AdvancedTable>
65
+ </div>
66
+ )
67
+ }
68
+
69
+ export default AdvancedTableFullWidthCell
@@ -0,0 +1,3 @@
1
+ `fullWidthCell` is an optional boolean prop that defaults to `false`. When set to `true`, the first column's cell content takes up the full available width of the cell.
2
+
3
+ This is especially useful with custom cell renderers that need horizontal space — for example, a `Flex` with `justify="between"` that places content on both the left and right edges of the cell.
@@ -0,0 +1,49 @@
1
+ <%
2
+ column_definitions = [
3
+ {
4
+ accessor: "year",
5
+ label: "Year",
6
+ cellAccessors: ["quarter", "month", "day"],
7
+ custom_renderer: ->(row, value) {
8
+ capture do
9
+ pb_rails("flex", props: { justify: "between" }) do
10
+ pb_rails("title", props: { text: value, size: 4 }) +
11
+ pb_rails("badge", props: { dark: true, margin_left: "xxs", text: row[:newEnrollments].to_i > 20 ? "High" : "Low", variant: "neutral" })
12
+ end
13
+ end
14
+ }
15
+ },
16
+ {
17
+ accessor: "newEnrollments",
18
+ label: "New Enrollments",
19
+ },
20
+ {
21
+ accessor: "scheduledMeetings",
22
+ label: "Scheduled Meetings",
23
+ },
24
+ {
25
+ accessor: "attendanceRate",
26
+ label: "Attendance Rate",
27
+ },
28
+ {
29
+ accessor: "completedClasses",
30
+ label: "Completed Classes",
31
+ },
32
+ {
33
+ accessor: "classCompletionRate",
34
+ label: "Class Completion Rate",
35
+ },
36
+ {
37
+ accessor: "graduatedStudents",
38
+ label: "Graduated Students",
39
+ }
40
+ ]
41
+ %>
42
+
43
+ <%= pb_rails("advanced_table", props: {
44
+ id: "full_width_cell",
45
+ table_data: @table_data,
46
+ column_definitions: column_definitions,
47
+ enable_toggle_expansion: "all",
48
+ full_width_cell: true
49
+ }) %>
@@ -0,0 +1,3 @@
1
+ `full_width_cell` is an optional boolean prop that defaults to `false`. When set to `true`, the first column's cell content takes up the full available width of the cell.
2
+
3
+ This is especially useful with custom cell renderers that need horizontal space — for example, a `Flex` with `justify: "between"` that places content on both the left and right edges of the cell.
@@ -0,0 +1,57 @@
1
+ <%# Example sort method for demonstration purposes %>
2
+ <% if params["sort"] %>
3
+ <% sort_param = params["sort"].gsub(/_(asc|desc)\z/, "") %>
4
+ <% sort_direction = params["sort"].end_with?("_asc") ? 1 : -1 %>
5
+ <% @table_data_with_id.sort! do |a, b|
6
+ value_a = a[sort_param] || a[sort_param.to_sym]
7
+ value_b = b[sort_param] || b[sort_param.to_sym]
8
+
9
+ value_a = value_a.to_i if value_a.is_a?(String) && value_a.match?(/^\d+$/)
10
+ value_b = value_b.to_i if value_b.is_a?(String) && value_b.match?(/^\d+$/)
11
+
12
+ sort_direction * (value_a <=> value_b)
13
+ end %>
14
+ <% end %>
15
+
16
+ <% column_definitions = [
17
+ {
18
+ accessor: "year",
19
+ label: "Year",
20
+ cellAccessors: ["quarter", "month", "day"],
21
+ sort_menu: [
22
+ { item: "Year", link: "?sort=year_asc#pinned_rows_both_table", active: params["sort"] == "year_asc", direction: "asc" },
23
+ { item: "Year", link: "?sort=year_desc#pinned_rows_both_table", active: params["sort"] == "year_desc", direction: "desc" }
24
+ ],
25
+ },
26
+ {
27
+ accessor: "newEnrollments",
28
+ label: "New Enrollments",
29
+ },
30
+ {
31
+ accessor: "scheduledMeetings",
32
+ label: "Scheduled Meetings",
33
+ },
34
+ {
35
+ accessor: "attendanceRate",
36
+ label: "Attendance Rate",
37
+ },
38
+ {
39
+ accessor: "completedClasses",
40
+ label: "Completed Classes",
41
+ },
42
+ {
43
+ accessor: "classCompletionRate",
44
+ label: "Class Completion Rate",
45
+ },
46
+ {
47
+ accessor: "graduatedStudents",
48
+ label: "Graduated Students",
49
+ }
50
+ ] %>
51
+
52
+ <% pinned_rows = { top: ["8"], bottom: ["1"] } %>
53
+
54
+ <%= pb_rails("advanced_table", props: { id: "pinned_rows_both_table", table_data: @table_data_with_id, column_definitions: column_definitions, max_height: "xs", pinned_rows: pinned_rows, responsive: "none", table_props: { sticky: true }}) do %>
55
+ <%= pb_rails("advanced_table/table_header", props: { table_id: "pinned_rows_both_table", column_definitions: column_definitions }) %>
56
+ <%= pb_rails("advanced_table/table_body", props: { table_id: "pinned_rows_both_table", table_data: @table_data_with_id, column_definitions: column_definitions, pinned_rows: pinned_rows }) %>
57
+ <% end %>
@@ -0,0 +1 @@
1
+ This code snippet demonstrates `pinned_rows` taking a hash with an array of row ids to both the `top` and `bottom` keys.
@@ -0,0 +1,57 @@
1
+ <%# Example sort method for demonstration purposes %>
2
+ <% if params["sort"] %>
3
+ <% sort_param = params["sort"].gsub(/_(asc|desc)\z/, "") %>
4
+ <% sort_direction = params["sort"].end_with?("_asc") ? 1 : -1 %>
5
+ <% @table_data_with_id.sort! do |a, b|
6
+ value_a = a[sort_param] || a[sort_param.to_sym]
7
+ value_b = b[sort_param] || b[sort_param.to_sym]
8
+
9
+ value_a = value_a.to_i if value_a.is_a?(String) && value_a.match?(/^\d+$/)
10
+ value_b = value_b.to_i if value_b.is_a?(String) && value_b.match?(/^\d+$/)
11
+
12
+ sort_direction * (value_a <=> value_b)
13
+ end %>
14
+ <% end %>
15
+
16
+ <% column_definitions = [
17
+ {
18
+ accessor: "year",
19
+ label: "Year",
20
+ cellAccessors: ["quarter", "month", "day"],
21
+ sort_menu: [
22
+ { item: "Year", link: "?sort=year_asc#pinned_rows_bottom_table", active: params["sort"] == "year_asc", direction: "asc" },
23
+ { item: "Year", link: "?sort=year_desc#pinned_rows_bottom_table", active: params["sort"] == "year_desc", direction: "desc" }
24
+ ],
25
+ },
26
+ {
27
+ accessor: "newEnrollments",
28
+ label: "New Enrollments",
29
+ },
30
+ {
31
+ accessor: "scheduledMeetings",
32
+ label: "Scheduled Meetings",
33
+ },
34
+ {
35
+ accessor: "attendanceRate",
36
+ label: "Attendance Rate",
37
+ },
38
+ {
39
+ accessor: "completedClasses",
40
+ label: "Completed Classes",
41
+ },
42
+ {
43
+ accessor: "classCompletionRate",
44
+ label: "Class Completion Rate",
45
+ },
46
+ {
47
+ accessor: "graduatedStudents",
48
+ label: "Graduated Students",
49
+ }
50
+ ] %>
51
+
52
+ <% pinned_rows = { bottom: ["8"] } %>
53
+
54
+ <%= pb_rails("advanced_table", props: { id: "pinned_rows_bottom_table", table_data: @table_data_with_id, column_definitions: column_definitions, max_height: "xs", pinned_rows: pinned_rows, responsive: "none", table_props: { sticky: true }}) do %>
55
+ <%= pb_rails("advanced_table/table_header", props: { table_id: "pinned_rows_bottom_table", column_definitions: column_definitions }) %>
56
+ <%= pb_rails("advanced_table/table_body", props: { table_id: "pinned_rows_bottom_table", table_data: @table_data_with_id, column_definitions: column_definitions, pinned_rows: pinned_rows }) %>
57
+ <% end %>
@@ -0,0 +1 @@
1
+ This code snippet demonstrates `pinned_rows` taking a hash with an array of row ids to the `bottom` key.
@@ -19,8 +19,8 @@
19
19
  label: "Year",
20
20
  cellAccessors: ["quarter", "month", "day"],
21
21
  sort_menu: [
22
- { item: "Year", link: "?sort=year_asc#pinned_rows_table", active: params["sort"] == "year_asc", direction: "asc" },
23
- { item: "Year", link: "?sort=year_desc#pinned_rows_table", active: params["sort"] == "year_desc", direction: "desc" }
22
+ { item: "Year", link: "?sort=year_asc#pinned_rows_top_table", active: params["sort"] == "year_asc", direction: "asc" },
23
+ { item: "Year", link: "?sort=year_desc#pinned_rows_top_table", active: params["sort"] == "year_desc", direction: "desc" }
24
24
  ],
25
25
  },
26
26
  {
@@ -51,7 +51,7 @@
51
51
 
52
52
  <% pinned_rows = { top: ["8"] } %>
53
53
 
54
- <%= pb_rails("advanced_table", props: { id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, max_height: "xs", pinned_rows: pinned_rows, responsive: "none", table_props: { sticky: true }}) do %>
55
- <%= pb_rails("advanced_table/table_header", props: { table_id: "pinned_rows_table", column_definitions: column_definitions }) %>
56
- <%= pb_rails("advanced_table/table_body", props: { table_id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, pinned_rows: pinned_rows }) %>
54
+ <%= pb_rails("advanced_table", props: { id: "pinned_rows_top_table", table_data: @table_data_with_id, column_definitions: column_definitions, max_height: "xs", pinned_rows: pinned_rows, responsive: "none", table_props: { sticky: true }}) do %>
55
+ <%= pb_rails("advanced_table/table_header", props: { table_id: "pinned_rows_top_table", column_definitions: column_definitions }) %>
56
+ <%= pb_rails("advanced_table/table_body", props: { table_id: "pinned_rows_top_table", table_data: @table_data_with_id, column_definitions: column_definitions, pinned_rows: pinned_rows }) %>
57
57
  <% end %>
@@ -1,7 +1,7 @@
1
- Use the `pinned_rows` prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and will not change position if sorting is used.
1
+ Use the `pinned_rows` prop to pin specific rows to the top or bottom of an Advanced Table. Pinned rows will remain at the top or bottom when scrolling through table data and will not change position if sorting is used.
2
2
 
3
3
  **NOTE:**
4
4
  - Sticky header required: Pinned rows must be used with `sticky: true` via `table_props` (works with both responsive and non-responsive tables)
5
5
  - Row ids required: Each object within the `table_data` array must contain a unique `id` in order to attach an id to all Rows for this to function.
6
- - `pinned_rows` takes a hash with a `top` key containing an array of row ids, as shown in the code snippet below.
7
- - For expandable rows, use the parent id in `pinned_rows[:top]`; all its children will automatically be pinned with it. If a child id is passed without the parent being pinned, nothing will be pinned.
6
+ - `pinned_rows` takes a hash with a `top` and/or `bottom` key containing an array of row ids, as shown in the code snippet below.
7
+ - For expandable rows, use the parent id in `pinned_rows[:top]` or `pinned_rows[:bottom]`; all its children will automatically be pinned with it. If a child id is passed without the parent being pinned, nothing will be pinned.
@@ -0,0 +1,40 @@
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", "", "Day"]
35
+ %>
36
+
37
+ <%= pb_rails("advanced_table", props: { id: "skipping-subrow-headers", table_data: @table_data, column_definitions: column_definitions }) do %>
38
+ <%= pb_rails("advanced_table/table_header", props: { table_id: "skipping-subrow-headers", column_definitions: column_definitions }) %>
39
+ <%= pb_rails("advanced_table/table_body", props: { table_id: "skipping-subrow-headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
40
+ <% end %>
@@ -0,0 +1,55 @@
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
+
6
+ const AdvancedTableSkippingSubrowHeaders = (props) => {
7
+ const columnDefinitions = [
8
+ {
9
+ accessor: "year",
10
+ label: "Year",
11
+ cellAccessors: ["quarter", "month", "day"],
12
+ },
13
+ {
14
+ accessor: "newEnrollments",
15
+ label: "New Enrollments",
16
+ },
17
+ {
18
+ accessor: "scheduledMeetings",
19
+ label: "Scheduled Meetings",
20
+ },
21
+ {
22
+ accessor: "attendanceRate",
23
+ label: "Attendance Rate",
24
+ },
25
+ {
26
+ accessor: "completedClasses",
27
+ label: "Completed Classes",
28
+ },
29
+ {
30
+ accessor: "classCompletionRate",
31
+ label: "Class Completion Rate",
32
+ },
33
+ {
34
+ accessor: "graduatedStudents",
35
+ label: "Graduated Students",
36
+ },
37
+ ]
38
+
39
+ const subRowHeaders = ["Quarter", "", "Day"]
40
+
41
+
42
+ return (
43
+ <div>
44
+ <AdvancedTable
45
+ columnDefinitions={columnDefinitions}
46
+ tableData={MOCK_DATA}
47
+ {...props}
48
+ >
49
+ <AdvancedTable.Header />
50
+ <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
51
+ </AdvancedTable>
52
+ </div>
53
+ );
54
+ };
55
+ export default AdvancedTableSkippingSubrowHeaders;
@@ -0,0 +1 @@
1
+ Pass an empty string at any index in `sub_row_headers` to skip the rendering of a subrow header while still nesting the data under it.
@@ -0,0 +1 @@
1
+ Pass an empty string at any index in `subRowHeaders` to skip the rendering of a subrow header while still nesting the data under it.
@@ -9,8 +9,10 @@
9
9
  "defaults": {
10
10
  "columnGroupBorderColor": "none",
11
11
  "enableToggleExpansion": "header",
12
+ "fullWidthCell": false,
12
13
  "inlineRowLoading": false,
13
14
  "loading": false,
15
+ "maxHeight": "auto",
14
16
  "responsive": "scroll",
15
17
  "scrollBarNone": false,
16
18
  "selectableRows": false,
@@ -92,7 +94,8 @@
92
94
  "name": "Column Configuration",
93
95
  "props": [
94
96
  "columnVisibilityControl",
95
- "columnGroupBorderColor"
97
+ "columnGroupBorderColor",
98
+ "fullWidthCell"
96
99
  ]
97
100
  },
98
101
  {
@@ -160,7 +160,7 @@
160
160
  },
161
161
  {
162
162
  "name": "Column Configuration",
163
- "props": ["columnVisibilityControl", "columnGroupBorderColor"]
163
+ "props": ["columnVisibilityControl", "columnGroupBorderColor", "fullWidthCell"]
164
164
  },
165
165
  {
166
166
  "name": "Table engine",
@@ -3,15 +3,19 @@ examples:
3
3
  - advanced_table_beta: Default (Required Props)
4
4
  - advanced_table_loading: Loading State
5
5
  - advanced_table_beta_subrow_headers: SubRow Headers
6
+ - advanced_table_skipping_subrow_headers: Skipping Subrow Headers
6
7
  - advanced_table_enable_toggle_expansion_rails: Enable Toggle Expansion
7
8
  - advanced_table_collapsible_trail_rails: Collapsible Trail
8
9
  - advanced_table_table_props: Table Props
9
10
  - advanced_table_sticky_header_rails: Sticky Header
10
11
  - advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
11
- - advanced_table_pinned_rows_rails: Pinned Rows
12
+ - advanced_table_pinned_rows_rails: Pinned Rows (Top)
13
+ - advanced_table_pinned_rows_bottom_rails: Pinned Rows (Bottom)
14
+ - advanced_table_pinned_rows_both_rails: Pinned Rows (Both)
12
15
  - advanced_table_beta_sort: Enable Sorting
13
16
  - advanced_table_responsive: Responsive Tables
14
17
  - advanced_table_custom_cell_rails: Custom Components for Cells
18
+ - advanced_table_full_width_cell_rails: Full Width Cell
15
19
  - advanced_table_with_custom_header_rails: Custom Header Cell
16
20
  - advanced_table_with_custom_header_multi_header_rails: Custom Header with Multiple Headers
17
21
  - advanced_table_column_headers: Multi-Header Columns
@@ -46,6 +50,7 @@ examples:
46
50
  - advanced_table_expanded_control: Expanded Control
47
51
  - advanced_table_expand_by_depth: Expand by Depth
48
52
  - advanced_table_subrow_headers: SubRow Headers
53
+ - advanced_table_skipping_subrow_headers: Skipping Subrow Headers
49
54
  - advanced_table_cascade_collapse: Cascade Collapse
50
55
  - advanced_table_collapsible_trail: Collapsible Trail
51
56
  - advanced_table_table_options: Table Options
@@ -57,6 +62,7 @@ examples:
57
62
  - advanced_table_sticky_scroll_limitation: Sticky Header and Column Scroll Limitation
58
63
  - advanced_table_responsive: Responsive Tables
59
64
  - advanced_table_custom_cell: Custom Components for Cells
65
+ - advanced_table_full_width_cell: Full Width Cell
60
66
  - advanced_table_with_custom_header: Custom Header Cell
61
67
  - advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
62
68
  - advanced_table_pagination: Pagination