playbook_ui 14.21.2.pre.alpha.PLAY2018verticalBordertableheaderborders8323 → 14.21.2.pre.alpha.PLAY2020sidebarfilterPOC8265

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +4 -12
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +5 -25
  5. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -17
  6. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -61
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +1 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_border_color_rails.html.erb +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.html.erb +1 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +2 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +2 -3
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +1 -1
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -4
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
  16. data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -21
  17. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -1
  18. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -5
  19. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
  20. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -33
  21. data/app/pb_kits/playbook/pb_filter/Filter/FilterSection.tsx +49 -0
  22. data/app/pb_kits/playbook/pb_filter/Filter/FilterSidebar.tsx +69 -0
  23. data/app/pb_kits/playbook/pb_filter/Filter/index.tsx +13 -0
  24. data/app/pb_kits/playbook/pb_filter/_filter.scss +4 -0
  25. data/app/pb_kits/playbook/pb_filter/docs/_filter_sidebar.jsx +224 -0
  26. data/app/pb_kits/playbook/pb_filter/docs/example.yml +1 -0
  27. data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
  28. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +0 -4
  29. data/dist/chunks/_weekday_stacked-BitxTXxk.js +45 -0
  30. data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
  31. data/dist/chunks/vendor.js +1 -1
  32. data/dist/playbook-doc.js +1 -1
  33. data/dist/playbook-rails.js +1 -1
  34. data/dist/playbook.css +1 -1
  35. data/lib/playbook/version.rb +1 -1
  36. metadata +7 -13
  37. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ColumnStylingHelper.ts +0 -15
  38. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +0 -51
  39. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +0 -7
  40. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +0 -77
  41. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.md +0 -1
  42. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.html.erb +0 -63
  43. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers_rails.md +0 -1
  44. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +0 -38
  45. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +0 -7
  46. data/dist/chunks/_weekday_stacked-JnoR3mIy.js +0 -45
  47. data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89e5c8498b0a671de8feebbb801b169ab19d122477756c9ea6a0f270f51d660e
4
- data.tar.gz: 0754ee11059ff2b06f74b87777a5e400c122a3a32ccabba8ee09ea0e5a80a480
3
+ metadata.gz: 110027cf4b6fc7f41901f5d8a95eeee3cabd472a0f64d95870e83cac6155d44f
4
+ data.tar.gz: 96c09cbb3a87483920bfd554a727e6663767bc3447cc2e363af5adcb09d6a5c7
5
5
  SHA512:
6
- metadata.gz: 70011e7df53940699338913f5d156bc49473d45b97d01295e00ad304cc0c309d11a8ba994ffb0ac100e6800c285906b192289ad5ecf25c9f5a98b3401c7a8675
7
- data.tar.gz: b768e24d2dfea9ad4f3e85f6938e7ebbce5073235c3ee1f2977aa76b8bdf962d03ffe8cd21a94f7d1a6adc48772247634a3996272216f8b055867f24052a20ab
6
+ metadata.gz: 14c26029d6c5254a2f62b2ea222c4cd5d06ffb3e6586d36d506dfaeed57c4f824e41418e9ce5533838e720d94c1257bace7f55a78da5a2d6ee6dd6768d066fdf
7
+ data.tar.gz: 0cd5c076dfb211d337b2de733d3b4a94b09c208b00261b74bcd2eeae88c255b59cd6849025ad1f3548be3f1a910244d6b8e6f689dd413b210a8903855b656a90
@@ -47,7 +47,7 @@ export const CustomCell = ({
47
47
  <Flex
48
48
  alignItems="center"
49
49
  columnGap="xs"
50
- justify="start"
50
+ justify={"start"}
51
51
  orientation="row"
52
52
  >
53
53
  {
@@ -4,7 +4,6 @@ import { flexRender, Row, Cell } from "@tanstack/react-table"
4
4
 
5
5
  import { GenericObject } from "../../types"
6
6
  import { isChrome } from "../Utilities/BrowserCheck"
7
- import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
8
7
 
9
8
  import LoadingInline from "../../pb_loading_inline/_loading_inline"
10
9
  import Checkbox from "../../pb_checkbox/_checkbox"
@@ -26,15 +25,13 @@ const TableCellRenderer = ({
26
25
  collapsibleTrail = true,
27
26
  loading = false,
28
27
  stickyLeftColumn,
29
- columnPinning,
30
- columnDefinitions,
28
+ columnPinning
31
29
  }: {
32
30
  row: Row<GenericObject>
33
31
  collapsibleTrail?: boolean
34
32
  loading?: boolean | string
35
33
  stickyLeftColumn?: string[]
36
34
  columnPinning: { left: string[] }
37
- columnDefinitions?: {[key:string]:any}[]
38
35
  }) => {
39
36
  return (
40
37
  <>
@@ -52,14 +49,10 @@ const TableCellRenderer = ({
52
49
  })();
53
50
 
54
51
  const { column } = cell;
55
-
56
- // Find the “owning” colDefinition by accessor. Needed for multi column logic
57
- const colDef = findColumnDefByAccessor(columnDefinitions ?? [], column.id)
58
- const cellAlignment = colDef?.columnStyling?.cellAlignment ?? "right"
59
-
52
+
60
53
  return (
61
54
  <td
62
- align={cellAlignment}
55
+ align="right"
63
56
  className={classnames(
64
57
  `${cell.id}-cell position_relative`,
65
58
  isChrome() ? "chrome-styles" : "",
@@ -124,6 +117,7 @@ export const RegularTableView = ({
124
117
 
125
118
  const columnPinning = table.getState().columnPinning || { left: [] };
126
119
  const columnDefinitions = table.options.meta?.columnDefinitions || [];
120
+
127
121
  // Row pinning
128
122
  function PinnedRow({ row }: { row: Row<any> }) {
129
123
  return (
@@ -143,7 +137,6 @@ export const RegularTableView = ({
143
137
  >
144
138
  <TableCellRenderer
145
139
  collapsibleTrail={collapsibleTrail}
146
- columnDefinitions={columnDefinitions}
147
140
  columnPinning={columnPinning}
148
141
  loading={loading}
149
142
  row={row}
@@ -204,7 +197,6 @@ export const RegularTableView = ({
204
197
  )}
205
198
  <TableCellRenderer
206
199
  collapsibleTrail={collapsibleTrail}
207
- columnDefinitions={columnDefinitions}
208
200
  columnPinning={columnPinning}
209
201
  loading={loading}
210
202
  row={row}
@@ -15,7 +15,6 @@ import Icon from "../../pb_icon/_icon"
15
15
  import { SortIconButton } from "./SortIconButton"
16
16
  import { ToggleIconButton } from "./ToggleIconButton"
17
17
  import { displayIcon } from "../Utilities/IconHelpers"
18
- import { findColumnDefByAccessor } from "../Utilities/ColumnStylingHelper"
19
18
  import { updateExpandAndCollapseState } from "../Utilities/ExpansionControlHelpers"
20
19
 
21
20
  import { isChrome } from "../Utilities/BrowserCheck"
@@ -46,7 +45,6 @@ export const TableHeaderCell = ({
46
45
  table
47
46
  }: TableHeaderCellProps) => {
48
47
  const {
49
- columnDefinitions,
50
48
  expanded,
51
49
  setExpanded,
52
50
  expandByDepth,
@@ -74,18 +72,6 @@ export const TableHeaderCell = ({
74
72
  header?.column.getToggleSortingHandler()(event)
75
73
  }
76
74
  }
77
- const alignmentMap: Record<string, "start" | "center" | "end"> = {
78
- left: "start",
79
- center: "center",
80
- right: "end",
81
- };
82
-
83
- // Look up the “owning” columnDefinition by accessor. Needed for multi column logic
84
- const colDef = header
85
- ? findColumnDefByAccessor(columnDefinitions, header.column.id)
86
- : undefined
87
-
88
- const headerAlignment = colDef?.columnStyling?.headerAlignment ?? colDef?.columnStyling?.headerAligment
89
75
 
90
76
  const isLeafColumn =
91
77
  header?.column.getLeafColumns().length === 1 &&
@@ -140,15 +126,9 @@ const isToggleExpansionEnabled =
140
126
  (enableToggleExpansion === "all" || "header") &&
141
127
  enableToggleExpansion !== "none"
142
128
 
143
- let justifyHeader: justifyTypes;
129
+ let justifyHeader:justifyTypes;
144
130
 
145
- if (headerAlignment && alignmentMap[headerAlignment]) {
146
- justifyHeader = alignmentMap[headerAlignment];
147
- } else if (
148
- (header?.index === 0 && hasAnySubRows) ||
149
- (header?.index === 0 && inlineRowLoading) ||
150
- (header?.index === 0 && isToggleExpansionEnabled)
151
- ) {
131
+ if (header?.index === 0 && hasAnySubRows || (header?.index === 0 && inlineRowLoading) || (header?.index === 0 && isToggleExpansionEnabled)) {
152
132
  justifyHeader = enableSorting ? "between" : "start";
153
133
  } else {
154
134
  justifyHeader = isLeafColumn ? "end" : "center";
@@ -185,7 +165,7 @@ const isToggleExpansionEnabled =
185
165
 
186
166
  return (
187
167
  <th
188
- align={headerAlignment ? headerAlignment : "right"}
168
+ align="right"
189
169
  className={cellClassName}
190
170
  colSpan={header?.colSpan}
191
171
  id={cellId}
@@ -273,8 +253,8 @@ const isToggleExpansionEnabled =
273
253
  tabIndex: 0,
274
254
  },
275
255
  })}
276
- justify={header?.index === 0 && enableSorting ? "between" : headerAlignment ? alignmentMap[headerAlignment] : "none"}
277
- paddingLeft={header?.index === 0 ? enableSorting ? "xxs" : "xs" : "none"}
256
+ justify={header?.index === 0 && enableSorting ? "between" : "none"}
257
+ paddingLeft={enableSorting ? "xxs" : "xs"}
278
258
  >
279
259
  <div>
280
260
  {flexRender(header?.column.columnDef.header, header?.getContext())}
@@ -621,23 +621,6 @@
621
621
  box-shadow: 0 4px 10px 0 rgba($shadow, 0.16) !important;
622
622
  }
623
623
 
624
- // For Rails, we can't target the &:last-child since collapsed rows are display: none;
625
- // With JS, we add a .last-visible-row class and add rounded corners to bottom row
626
- .last-visible-row {
627
- td, .pb_table_td {
628
- border-width: 0 0 1px 0;
629
-
630
- &:first-child {
631
- border-radius: 0 0 0 4px;
632
- border-width: 0 0 1px 1px;
633
- }
634
- &:last-child {
635
- border-radius: 0 0 4px 0;
636
- border-width: 0 1px 1px 0;
637
- }
638
- }
639
- }
640
-
641
624
  &.dark {
642
625
  // Override default border color for dark mode
643
626
  --column-border-color: #{$border_dark};
@@ -572,64 +572,4 @@ test("pinnedRows prop renders pinned rows at top", () => {
572
572
  const firstPinnedRow = pinnedRows[0]
573
573
  expect(firstPinnedRow).toHaveStyle("position: sticky")
574
574
  expect(firstPinnedRow).toHaveStyle("background-color: white")
575
- })
576
-
577
- test("columnStyling.headerAlignment aligns header as expected", () => {
578
- const styledColumnDefs = [
579
- {
580
- accessor: "year",
581
- label: "Year",
582
- cellAccessors: ["quarter", "month", "day"],
583
- },
584
- {
585
- accessor: "newEnrollments",
586
- label: "New Enrollments",
587
- columnStyling: { headerAlignment: "left" },
588
- },
589
- {
590
- accessor: "scheduledMeetings",
591
- label: "Scheduled Meetings",
592
- },
593
- ];
594
-
595
- render(
596
- <AdvancedTable
597
- columnDefinitions={styledColumnDefs}
598
- data={{ testid: testId }}
599
- tableData={MOCK_DATA}
600
- />
601
- );
602
-
603
- const headerCell = screen.getByText("New Enrollments").closest("th");
604
- expect(headerCell).toHaveAttribute("align", "left");
605
- });
606
-
607
- test("columnStyling.cellAlignment sets each <td> align attribute as expected", () => {
608
- const styledColumnDefs = [
609
- {
610
- accessor: "year",
611
- label: "Year",
612
- cellAccessors: ["quarter", "month", "day"],
613
- },
614
- {
615
- accessor: "newEnrollments",
616
- label: "New Enrollments",
617
- columnStyling: { cellAlignment: "left" },
618
- },
619
- {
620
- accessor: "scheduledMeetings",
621
- label: "Scheduled Meetings",
622
- },
623
- ];
624
-
625
- render(
626
- <AdvancedTable
627
- columnDefinitions={styledColumnDefs}
628
- data={{ testid: testId }}
629
- tableData={MOCK_DATA}
630
- />
631
- );
632
-
633
- const firstEnrollmentCell = screen.getAllByText("20")[0].closest("td");
634
- expect(firstEnrollmentCell).toHaveAttribute("align", "left");
635
- });
575
+ })
@@ -51,7 +51,7 @@
51
51
  ]
52
52
  %>
53
53
 
54
- <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions, id: "beta_sort" }) do %>
54
+ <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
55
55
  <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
56
56
  <%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, enable_toggle_expansion: "all" }) %>
57
57
  <% end %>
@@ -34,7 +34,7 @@
34
34
  subrow_headers = ["Quarter", "Month", "Day"]
35
35
  %>
36
36
 
37
- <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions, id: "test_table" }) do %>
37
+ <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
38
38
  <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
39
39
  <%= pb_rails("advanced_table/table_body", props: { id: "test_table", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
40
40
  <% end %>
@@ -55,4 +55,4 @@
55
55
  },
56
56
  ] %>
57
57
 
58
- <%= pb_rails("advanced_table", props: { id: "beta_table_with_color_headers", table_data: @table_data, column_definitions: column_definitions, column_group_border_color: "text_lt_default", table_props: { vertical_border: true } }) %>
58
+ <%= pb_rails("advanced_table", props: { id: "beta_table_with_muilti_headers", table_data: @table_data, column_definitions: column_definitions, column_group_border_color: "text_lt_default", table_props: { vertical_border: true } }) %>
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "loading_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
33
+ <%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
@@ -47,14 +47,14 @@ const CustomActions = () => {
47
47
  <CircleIconButton
48
48
  icon="file-csv"
49
49
  onClick={() =>
50
- alert(rowIds.length === 0 ? "No Selection Made" : 'Row ids ' + rowIds.join(", ") + 'will be exported!')
50
+ alert(rowIds.length === 0 ? "No Selection Made" : `Row ids ${rowIds.join(", ")} will be exported!`)
51
51
  }
52
52
  variant="link"
53
53
  />
54
54
  <CircleIconButton
55
55
  icon="trash-alt"
56
56
  onClick={() =>
57
- alert(rowIds.length === 0 ? "No Selection Made" : 'Row ids ' + rowIds.join(", ") + 'will be deleted!')
57
+ alert(rowIds.length === 0 ? "No Selection Made" : `Row ids ${rowIds.join(", ")} will be deleted!`)
58
58
  }
59
59
  variant="link"
60
60
  />
@@ -88,11 +88,10 @@ actions = [
88
88
  if (!selectedRowIds || selectedRowIds.length === 0) {
89
89
  alert('No Selection Made');
90
90
  } else {
91
- const selectedRowsString = selectedRowIds.join(', ');
92
91
  if (actionType === 'export') {
93
- alert('Row ids ' + selectedRowsString + ' will be exported!');
92
+ alert(`Row ids ${selectedRowIds.join(', ')} will be exported!`);
94
93
  } else if (actionType === 'delete') {
95
- alert('Row ids ' + selectedRowsString + ' will be deleted!');
94
+ alert(`Row ids ${selectedRowIds.join(', ')} will be deleted!`);
96
95
  }
97
96
  }
98
97
  };
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "table_props_sticky_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
33
+ <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
@@ -19,8 +19,6 @@ examples:
19
19
  - advanced_table_selectable_rows_actions_rails: Selectable Rows (With Actions)
20
20
  - advanced_table_selectable_rows_header_rails: Selectable Rows (No Actions Bar)
21
21
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
- # - advanced_table_column_styling_rails: Column Styling
23
- # - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
24
22
 
25
23
  react:
26
24
  - advanced_table_default: Default (Required Props)
@@ -59,5 +57,3 @@ examples:
59
57
  - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
60
58
  - advanced_table_pinned_rows: Pinned Rows
61
59
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
62
- - advanced_table_column_styling: Column Styling
63
- - advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
@@ -34,5 +34,3 @@ export { default as AdvancedTableColumnVisibilityMulti } from './_advanced_table
34
34
  export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
35
35
  export { default as AdvancedTablePinnedRows } from './_advanced_table_pinned_rows.jsx'
36
36
  export { default as AdvancedTableScrollbarNone} from './_advanced_table_scrollbar_none.jsx'
37
- export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
38
- export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
@@ -266,25 +266,6 @@ export default class PbAdvancedTable extends PbEnhancedElement {
266
266
  this.updateTableSelectedRowsAttribute();
267
267
  });
268
268
  }
269
- this.addBorderRadiusOnLastVisibleRow()
270
- }
271
-
272
- addBorderRadiusOnLastVisibleRow() {
273
- const parentElement = this.element.closest('.pb_advanced_table');
274
-
275
- const table = document.getElementById(parentElement.id);
276
-
277
- if (table) {
278
- const visibleRows = table.querySelectorAll('tr.is-visible, tr:not(.toggle-content)');
279
-
280
- visibleRows.forEach(row => row.classList.remove('last-visible-row'));
281
-
282
- const lastVisibleRow = visibleRows[visibleRows.length - 1];
283
-
284
- if (lastVisibleRow) {
285
- lastVisibleRow.classList.add('last-visible-row');
286
- }
287
- }
288
269
  }
289
270
 
290
271
 
@@ -386,8 +367,6 @@ export default class PbAdvancedTable extends PbEnhancedElement {
386
367
  row.classList.toggle("bg-silver", !isVisible);
387
368
  row.classList.toggle("bg-white", isVisible);
388
369
  }
389
-
390
- this.addBorderRadiusOnLastVisibleRow();
391
370
  }
392
371
 
393
372
  displayDownArrow() {
@@ -7,7 +7,7 @@
7
7
  <% header_row.each_with_index do |cell, cell_index| %>
8
8
  <% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
9
9
  <%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname(is_first_column: cell_index.zero?), ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
10
- <%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: (cell[:header_alignment] || "end") }) do %>
10
+ <%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: "end" }) do %>
11
11
  <% if cell_index.zero? && row_index === header_rows.size - 1 %>
12
12
  <% if object.selectable_rows && object.enable_toggle_expansion != "none" %>
13
13
  <%= pb_rails("flex/flex_item", props: { padding_right: "xs" }) do %>
@@ -98,9 +98,6 @@ module Playbook
98
98
 
99
99
  process_columns(col[:columns], rows, current_depth + 1, max_depth)
100
100
  else
101
- raw_styling = col[:column_styling] || {}
102
- header_alignment = raw_styling[:header_alignment]
103
-
104
101
  colspan = 1
105
102
  rows[current_depth] << {
106
103
  label: col[:label],
@@ -108,7 +105,6 @@ module Playbook
108
105
  accessor: col[:accessor],
109
106
  sort_menu: col[:sort_menu],
110
107
  is_last_in_group: is_last && current_depth.positive?,
111
- header_alignment: header_alignment,
112
108
  }
113
109
  end
114
110
  end
@@ -141,7 +137,6 @@ module Playbook
141
137
  accessor: col[:accessor],
142
138
  label: col[:label] || "",
143
139
  sort_menu: col[:sort_menu] || nil,
144
- column_styling: col[:column_styling] || {},
145
140
  }
146
141
  (max_depth - 1).times do
147
142
  wrapped = { label: "", columns: [wrapped] }
@@ -6,7 +6,7 @@
6
6
  <% object.column_definitions.each_with_index do |column, index| %>
7
7
  <% next unless column[:accessor].present? %>
8
8
  <%= pb_rails("table/table_cell", props: { classname:object.td_classname(column, index)}) do %>
9
- <%= pb_rails("flex", props:{ align: "center", justify: object.justify_for(column, index), classname: object.loading ? "loading-cell" : "" }) do %>
9
+ <%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", classname: object.loading ? "loading-cell" : "" }) do %>
10
10
  <% if collapsible_trail && index.zero? %>
11
11
  <% (1..depth).each do |i| %>
12
12
  <% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
@@ -34,7 +34,7 @@
34
34
  </button>
35
35
  <% end %>
36
36
  <% end %>
37
- <%= pb_rails("flex/flex_item") do %>
37
+ <%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && (object.row[:children].present? || has_integrated_checkbox) ? "none" : "xs"}) do %>
38
38
  <% if column[:custom_renderer].present? %>
39
39
  <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
40
40
  <% elsif index.zero? %>
@@ -80,20 +80,6 @@ module Playbook
80
80
  end
81
81
  end
82
82
 
83
- def justify_for(column, index)
84
- if index.zero?
85
- "start"
86
- else
87
- case cell_alignment_for(column)
88
- when "left" then "start"
89
- when "center" then "center"
90
- when "right" then "end"
91
- else
92
- "end"
93
- end
94
- end
95
- end
96
-
97
83
  private
98
84
 
99
85
  def custom_renderer_value(column, index)
@@ -117,25 +103,6 @@ module Playbook
117
103
  def subrow_depth_classname
118
104
  depth.positive? ? "depth-sub-row-#{depth}" : ""
119
105
  end
120
-
121
- def find_column_def_by_accessor(defs, target_accessor)
122
- defs.each do |col|
123
- return col if col[:accessor] == target_accessor
124
-
125
- if col[:columns].is_a?(Array)
126
- found = find_column_def_by_accessor(col[:columns], target_accessor)
127
- return found if found
128
- end
129
- end
130
- nil
131
- end
132
-
133
- def cell_alignment_for(column)
134
- return nil unless column[:accessor]
135
-
136
- orig_def = find_column_def_by_accessor(column_definitions, column[:accessor])
137
- orig_def[:column_styling][:cell_alignment] if orig_def && orig_def[:column_styling].is_a?(Hash)
138
- end
139
106
  end
140
107
  end
141
108
  end
@@ -0,0 +1,49 @@
1
+ import React from 'react'
2
+
3
+ import Collapsible from '../../pb_collapsible/_collapsible'
4
+ import Caption from '../../pb_caption/_caption'
5
+ import Body from '../../pb_body/_body'
6
+
7
+ type FilterSectionProps = {
8
+ children?: React.ReactChild[] | React.ReactChild,
9
+ collapsible?: boolean,
10
+ collapsed?: boolean,
11
+ headerText?: string,
12
+ }
13
+ const FilterSection = ({ children, collapsible = false, collapsed = true, headerText, }: FilterSectionProps): React.ReactElement => {
14
+ if (collapsible) {
15
+ return (
16
+ <Collapsible
17
+ collapsed={collapsed}
18
+ padding="none"
19
+ >
20
+ <Collapsible.Main
21
+ paddingX="sm"
22
+ paddingY="xs"
23
+ >
24
+ <Caption>{ headerText }</Caption>
25
+ </Collapsible.Main>
26
+ <Collapsible.Content
27
+ className="filter_section_collapsible"
28
+ paddingX="sm"
29
+ >
30
+ { children }
31
+ </Collapsible.Content>
32
+ </Collapsible>
33
+ )
34
+ }
35
+
36
+ return (
37
+ <Body
38
+ paddingTop="xs"
39
+ paddingX="sm"
40
+ >
41
+ <>
42
+ {headerText && <Caption marginBottom="sm">{ headerText }</Caption>}
43
+ { children }
44
+ </>
45
+ </Body>
46
+ )
47
+ }
48
+
49
+ export default FilterSection
@@ -0,0 +1,69 @@
1
+ import React from 'react'
2
+
3
+ import { FilterDescription } from './CurrentFilters'
4
+ import FilterBackground, { FilterBackgroundProps } from './FilterBackground'
5
+ import ResultsCount from './ResultsCount'
6
+
7
+ import Flex from '../../pb_flex/_flex'
8
+ import SectionSeparator from '../../pb_section_separator/_section_separator'
9
+ import Card from '../../pb_card/_card'
10
+ import Caption from '../../pb_caption/_caption'
11
+
12
+ export type FilterSidebarProps = {
13
+ children?: React.ReactChild[] | React.ReactChild,
14
+ filters?: FilterDescription,
15
+ results?: number,
16
+ } & FilterBackgroundProps
17
+
18
+ const FilterSidebar = ({
19
+ onCollapse,
20
+ onSortChange,
21
+ sortOptions,
22
+ sortValue,
23
+ filters,
24
+ results,
25
+ children,
26
+ dark,
27
+ isCollapsed,
28
+ maxHeight,
29
+ minWidth,
30
+ placement,
31
+ popoverProps,
32
+ ...bgProps
33
+ }: FilterSidebarProps): React.ReactElement => (
34
+ <FilterBackground
35
+ dark={dark}
36
+ {...bgProps}
37
+ >
38
+ <Card.Body
39
+ paddingX="sm"
40
+ paddingY="xs"
41
+ >
42
+ <Flex
43
+ align="center"
44
+ justify="between"
45
+ orientation="row"
46
+ >
47
+ <ResultsCount
48
+ dark={dark}
49
+ results={results}
50
+ title
51
+ />
52
+ <div onClick={onCollapse}>
53
+ <Caption
54
+ color="link"
55
+ cursor="pointer"
56
+ size="xs"
57
+ text={isCollapsed ? "Expand All" : "Collapse All"}
58
+ />
59
+ </div>
60
+ </Flex>
61
+ </Card.Body>
62
+ <SectionSeparator dark={dark} />
63
+ <>
64
+ { children }
65
+ </>
66
+ </FilterBackground>
67
+ )
68
+
69
+ export default FilterSidebar
@@ -1,18 +1,29 @@
1
1
  import React from 'react'
2
2
  import FilterSingle, { FilterSingleProps } from './FilterSingle'
3
3
  import FilterDouble, { FilterDoubleProps } from './FilterDouble'
4
+ import FilterSidebar, { FilterSidebarProps } from './FilterSidebar'
5
+ import FilterSection from './FilterSection'
4
6
 
5
7
  type FilterProps =
6
8
  | FilterSingleProps
7
9
  | (FilterDoubleProps & {
8
10
  double?: boolean,
9
11
  })
12
+ | (FilterSidebarProps & {
13
+ variant?: null | 'sidebar',
14
+ })
10
15
 
11
16
  const Filter = ({
12
17
  double = false,
18
+ variant,
13
19
  ...templateProps
14
20
  }: FilterProps): React.ReactElement => {
15
21
  const displayFilter = () => {
22
+ if (variant === 'sidebar') {
23
+ return (
24
+ <FilterSidebar {...templateProps} />
25
+ )
26
+ }
16
27
  if (double === true) {
17
28
  return (
18
29
  <FilterDouble {...templateProps} />
@@ -30,4 +41,6 @@ const Filter = ({
30
41
  )
31
42
  }
32
43
 
44
+ Filter.Section = FilterSection
45
+
33
46
  export default Filter
@@ -88,6 +88,10 @@
88
88
  z-index: 1;
89
89
  }
90
90
 
91
+ [class^=pb_collapsible_kit] .toggle-content.filter_section_collapsible {
92
+ padding-top: $space_xs !important;
93
+ }
94
+
91
95
  &[class*=dark] {
92
96
  .filters .filter {
93
97
  border-right: 1px solid $border_dark !important;