playbook_ui 16.12.0.pre.rc.1 → 16.12.0.pre.rc.2

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 (39) 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_skipping_subrow_headers.html.erb +40 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers.jsx +55 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_rails.md +1 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_skipping_subrow_headers_react.md +1 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +3 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -1
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
  21. data/app/pb_kits/playbook/pb_advanced_table/kit.schema.json +8 -0
  22. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -1
  23. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  24. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
  25. data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.html.erb +8 -1
  26. data/app/pb_kits/playbook/pb_distribution_bar/distribution_bar.rb +3 -6
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.html.erb +67 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.jsx +95 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_grouped_options.md +1 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -0
  32. data/dist/chunks/_typeahead-Db6-KBQO.js +5 -0
  33. data/dist/chunks/vendor.js +3 -3
  34. data/dist/menu.yml +3 -3
  35. data/dist/playbook-rails-react-bindings.js +1 -1
  36. data/dist/playbook-rails.js +1 -1
  37. data/lib/playbook/version.rb +1 -1
  38. metadata +14 -3
  39. data/dist/chunks/_typeahead-CXg3ungD.js +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0cbc758e63f9d4d5dbf201736dbd86f6c922ff025a8209c163264ce8a186f54
4
- data.tar.gz: 87b94773628bf6591d5b7eb136ffa26441a8519b160afca6e4e6ea326a819b4b
3
+ metadata.gz: bfd216d4f2b888b976c65a9d5a7a9f3b85c980873d2ea731f1f8e9e625b6bb7a
4
+ data.tar.gz: ef14fc5a7b4c3674b796589c4ed64191c396cbbc0a8a2a5f01e5c4e86c7494b6
5
5
  SHA512:
6
- metadata.gz: c91ae82e2bc2c6631192f52806cf76db101b0002a321012201b216ff928df6bf28a34692a85cfeb540191fc4d194807af8a653012e0bab25de93470dbd9e1891
7
- data.tar.gz: c69a780ec1d5d6f71cfb7b6f1a33199874bb777929b850390040410e911e4c98b99ae50f60bac02488a3ec8e39b4eda25337703a884d0059aedc1f7f8aa518d6
6
+ metadata.gz: c1d9b48277949ea6ec17fe88bc0705fb3259f9f38338d2f3715aadc4213f63866f0a498dd55935e8d71a1d18da581fd64091a01d3f81a7b56f9b150d132ac8c4
7
+ data.tar.gz: 6ac44566fc4ae3fd9122504aab547d6a1b2da04f29e1355092ceca453ef906bcaf176f73c36522746420f169624248fde9989cf923a7b6c4edf7f770c748037f
@@ -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,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,6 +9,7 @@
9
9
  "defaults": {
10
10
  "columnGroupBorderColor": "none",
11
11
  "enableToggleExpansion": "header",
12
+ "fullWidthCell": false,
12
13
  "inlineRowLoading": false,
13
14
  "loading": false,
14
15
  "responsive": "scroll",
@@ -92,7 +93,8 @@
92
93
  "name": "Column Configuration",
93
94
  "props": [
94
95
  "columnVisibilityControl",
95
- "columnGroupBorderColor"
96
+ "columnGroupBorderColor",
97
+ "fullWidthCell"
96
98
  ]
97
99
  },
98
100
  {
@@ -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,6 +3,7 @@ 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
@@ -12,6 +13,7 @@ examples:
12
13
  - advanced_table_beta_sort: Enable Sorting
13
14
  - advanced_table_responsive: Responsive Tables
14
15
  - advanced_table_custom_cell_rails: Custom Components for Cells
16
+ - advanced_table_full_width_cell_rails: Full Width Cell
15
17
  - advanced_table_with_custom_header_rails: Custom Header Cell
16
18
  - advanced_table_with_custom_header_multi_header_rails: Custom Header with Multiple Headers
17
19
  - advanced_table_column_headers: Multi-Header Columns
@@ -45,6 +47,7 @@ examples:
45
47
  - advanced_table_expanded_control: Expanded Control
46
48
  - advanced_table_expand_by_depth: Expand by Depth
47
49
  - advanced_table_subrow_headers: SubRow Headers
50
+ - advanced_table_skipping_subrow_headers: Skipping Subrow Headers
48
51
  - advanced_table_cascade_collapse: Cascade Collapse
49
52
  - advanced_table_collapsible_trail: Collapsible Trail
50
53
  - advanced_table_table_options: Table Options
@@ -56,6 +59,7 @@ examples:
56
59
  - advanced_table_sticky_scroll_limitation: Sticky Header and Column Scroll Limitation
57
60
  - advanced_table_responsive: Responsive Tables
58
61
  - advanced_table_custom_cell: Custom Components for Cells
62
+ - advanced_table_full_width_cell: Full Width Cell
59
63
  - advanced_table_with_custom_header: Custom Header Cell
60
64
  - advanced_table_with_custom_header_multi_header: Custom Header with Multiple Headers
61
65
  - advanced_table_pagination: Pagination
@@ -10,6 +10,7 @@ export { default as AdvancedTableTableProps } from './_advanced_table_table_prop
10
10
  export { default as AdvancedTableInlineRowLoading } from './_advanced_table_inline_row_loading.jsx'
11
11
  export { default as AdvancedTableResponsive } from './_advanced_table_responsive.jsx'
12
12
  export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
13
+ export { default as AdvancedTableFullWidthCell } from './_advanced_table_full_width_cell.jsx'
13
14
  export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
14
15
  export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
15
16
  export { default as AdvancedTableColumnHeaders } from './_advanced_table_column_headers.jsx'
@@ -53,5 +54,6 @@ export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advance
53
54
  export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
54
55
  export { default as AdvancedTableCascadeCollapse } from './_advanced_table_cascade_collapse.jsx'
55
56
  export { default as AdvancedTableSortParentOnly } from './_advanced_table_sort_parent_only.jsx'
57
+ export { default as AdvancedTableSkippingSubrowHeaders } from './_advanced_table_skipping_subrow_headers.jsx'
56
58
  export { default as AdvancedTablePinnedRowsBottom } from './_advanced_table_pinned_rows_bottom.jsx'
57
59
  export { default as AdvancedTablePinnedRowsBoth } from './_advanced_table_pinned_rows_both.jsx'
@@ -92,6 +92,14 @@
92
92
  "react"
93
93
  ]
94
94
  },
95
+ "fullWidthCell": {
96
+ "type": "boolean",
97
+ "platforms": [
98
+ "react",
99
+ "rails"
100
+ ],
101
+ "default": false
102
+ },
95
103
  "initialLoadingRowsCount": {
96
104
  "type": "number",
97
105
  "platforms": [
@@ -27,6 +27,8 @@ module Playbook
27
27
  default: []
28
28
  prop :inline_row_loading, type: Playbook::Props::Boolean,
29
29
  default: false
30
+ prop :full_width_cell, type: Playbook::Props::Boolean,
31
+ default: false
30
32
  prop :pinned_rows, type: Playbook::Props::HashProp,
31
33
  default: {}
32
34
 
@@ -89,7 +91,7 @@ module Playbook
89
91
  end
90
92
 
91
93
  # Additional class and data attributes needed for toggle logic
92
- row_props = { table_id: table_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, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading }
94
+ row_props = { table_id: table_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, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion, row_styling: row_styling, last_row: last_row, immediate_parent_row_id: immediate_parent_row_id, inline_row_loading: inline_row_loading, full_width_cell: full_width_cell }
93
95
  if is_pinned_row && next_pinned_index
94
96
  row_props[:is_pinned_row] = true
95
97
  row_props[:pinned_index] = next_pinned_index
@@ -26,7 +26,7 @@
26
26
  <% end %>
27
27
  <% end %>
28
28
 
29
- <div style="padding-left: <%= depth * 1.25 %>em">
29
+ <div style="padding-left: <%= depth * 1.25 %>em;<%= ' width: 100%;' if index.zero? && object.full_width_cell %>">
30
30
  <%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
31
31
  <% if index.zero? %>
32
32
  <% has_integrated_checkbox = object.selectable_rows && object.enable_toggle_expansion != "none" %>
@@ -47,7 +47,7 @@
47
47
  </button>
48
48
  <% end %>
49
49
  <% end %>
50
- <%= pb_rails("flex/flex_item") do %>
50
+ <%= pb_rails("flex/flex_item", props: (index.zero? && object.full_width_cell ? { width: "100%" } : {})) do %>
51
51
  <% if column[:custom_renderer].present? %>
52
52
  <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
53
53
  <% elsif index.zero? %>
@@ -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 :is_pinned_row, type: Playbook::Props::Boolean,
39
41
  default: false
40
42
  prop :pinned_index, type: Playbook::Props::Numeric,
@@ -1 +1,8 @@
1
- <%= react_component('DistributionBar', object.chart_options) %>
1
+ <%= pb_content_tag do %>
2
+ <% widths_to_percentages.each_with_index do |percentage, index| %>
3
+ <div
4
+ class="<%= segment_classname(index) %>"
5
+ style="width: <%= percentage %>%;"
6
+ ></div>
7
+ <% end %>
8
+ <% end %>
@@ -21,12 +21,9 @@ module Playbook
21
21
  end
22
22
  end
23
23
 
24
- def chart_options
25
- {
26
- size: size,
27
- widths: widths,
28
- colors: colors,
29
- }
24
+ def segment_classname(index)
25
+ color = colors[index]
26
+ ["pb_distribution_width", ("color_#{color}" if color.present?)].compact.join(" ")
30
27
  end
31
28
  end
32
29
  end
@@ -0,0 +1,67 @@
1
+ <%
2
+ sections = [
3
+ {
4
+ title: "Profile",
5
+ items: [
6
+ { label: "View Profile", value: "profile", id: "profile" },
7
+ { label: "Account Settings", value: "settings", id: "settings" },
8
+ ],
9
+ },
10
+ {
11
+ title: "Workspace",
12
+ items: [
13
+ { label: "Projects", value: "projects", id: "projects" },
14
+ { label: "Billing", value: "billing", id: "billing" },
15
+ ],
16
+ },
17
+ {
18
+ title: "Support",
19
+ items: [
20
+ { label: "Help Center", value: "help", id: "help" },
21
+ { label: "Contact Support", value: "contact", id: "contact" },
22
+ ],
23
+ },
24
+ ]
25
+
26
+ options = sections.flat_map { |section| section[:items] }
27
+ %>
28
+
29
+ <%= pb_rails("dropdown", props: { label: "Grouped Options", margin_bottom: "md", options: options }) do %>
30
+ <%= pb_rails("dropdown/dropdown_trigger") %>
31
+ <%= pb_rails("dropdown/dropdown_container") do %>
32
+ <% sections.each do |section| %>
33
+
34
+ <%= pb_rails("caption", props: {
35
+ text: section[:title],
36
+ color: "light",
37
+ padding_x: "xs",
38
+ padding_y: "xs"
39
+ }) %>
40
+
41
+ <%= pb_rails("section_separator") %>
42
+
43
+ <% section[:items].each do |option| %>
44
+ <%= pb_rails("dropdown/dropdown_option", props: { option: option }) %>
45
+ <% end %>
46
+
47
+ <% end %>
48
+ <% end %>
49
+ <% end %>
50
+
51
+
52
+ <%= pb_rails("dropdown", props: { label: "Grouped Options Minimalist", options: options, separators: false }) do %>
53
+ <%= pb_rails("dropdown/dropdown_trigger") %>
54
+ <%= pb_rails("dropdown/dropdown_container") do %>
55
+ <% sections.each do |section| %>
56
+
57
+ <%= pb_rails("section_separator", props: { padding_y: "xs" }) do %>
58
+ <%= pb_rails("caption", props: { text: section[:title], padding_x: "xs" }) %>
59
+ <% end %>
60
+
61
+ <% section[:items].each do |option| %>
62
+ <%= pb_rails("dropdown/dropdown_option", props: { option: option }) %>
63
+ <% end %>
64
+
65
+ <% end %>
66
+ <% end %>
67
+ <% end %>