playbook_ui 15.4.0.pre.rc.2 → 15.4.0.pre.rc.4

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +1 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +4 -4
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +5 -5
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +16 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.html.erb +104 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.md +1 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +1 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +2 -2
  11. data/app/pb_kits/playbook/pb_advanced_table/index.js +7 -7
  12. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +2 -2
  13. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +90 -20
  14. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -1
  15. data/app/pb_kits/playbook/pb_badge/_badge.tsx +4 -1
  16. data/app/pb_kits/playbook/pb_badge/badge.test.js +13 -0
  17. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -4
  18. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.jsx +38 -0
  19. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.md +14 -0
  20. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -1
  21. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -1
  22. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -0
  23. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +111 -6
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.jsx +18 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.md +4 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.jsx +18 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.md +1 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.jsx +19 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.md +1 -0
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.jsx +38 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.md +14 -0
  32. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +5 -0
  33. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -1
  34. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +148 -2
  35. data/app/pb_kits/playbook/pb_dropdown/quickpick/index.ts +60 -0
  36. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +15 -1
  37. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.html.erb +9 -8
  38. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions.html.erb +11 -10
  39. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +44 -11
  40. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
  41. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +110 -17
  42. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +7 -0
  43. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +64 -1
  44. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +33 -1
  45. data/dist/chunks/{_line_graph-CqE0-dq5.js → _line_graph-C-AuMGN2.js} +1 -1
  46. data/dist/chunks/_typeahead--38pnHwS.js +6 -0
  47. data/dist/chunks/_weekday_stacked-Fx-KHOwY.js +37 -0
  48. data/dist/chunks/{lib-CGxXTQ75.js → lib-BXBHAZMY.js} +1 -1
  49. data/dist/chunks/pb_form_validation-BNfSnIUF.js +1 -0
  50. data/dist/chunks/vendor.js +1 -1
  51. data/dist/playbook-doc.js +1 -1
  52. data/dist/playbook-rails-react-bindings.js +1 -1
  53. data/dist/playbook-rails.js +1 -1
  54. data/dist/playbook.css +1 -1
  55. data/lib/playbook/version.rb +1 -1
  56. metadata +20 -7
  57. data/dist/chunks/_typeahead-3ZAbZUqU.js +0 -6
  58. data/dist/chunks/_weekday_stacked-DHzeEnCx.js +0 -37
  59. data/dist/chunks/pb_form_validation-DebqlUKZ.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8756195b79021a48424cf2bd8a089948bebbf4c613c04a66960f680d891d79f6
4
- data.tar.gz: 904bdd2056ff5dd877f4d96d131a6548a05e9b601e83e8a9de77256a4265b08d
3
+ metadata.gz: c2971aeca06ad7724c6dbfa7d78baf6b50b700f09c1ab2463f74b35785f7d9bc
4
+ data.tar.gz: 959e8ac2a178a18f546b82a857edf4296d0e7140027c3dcac0cd199609c27357
5
5
  SHA512:
6
- metadata.gz: 375ba6253df92a3e7f304d214d60cbe0c0a19b663362be0499349704516a2307d810acd570cf2c8124148352d45f7c46bb178c6563802eb24501a701a557e11e
7
- data.tar.gz: a5d7cce19c57a82b4cd3328bdec7b902d891d0930541d41fc4789adb93eb3b8910ba3284bd4ae8963f36f63b85cb1eabe9da3a7de6cc7a89dd878103419a66a9
6
+ metadata.gz: 367fde0cdcc412337c173d02287f795a967adec61f53dbe92c5e92254cef14bf6f49db6eefa209446d0978b76e5c4bf8d4b2ed1c26179c4449744644c629b91f
7
+ data.tar.gz: 42b6c57e7d49d4252ce409adc9a7fbc92fcc436248d78a8256974cc0f87eeb6e6066acc9304d17bb8abf8664106fa035d44cced6d0dfa9d8f2282ab21830f726
@@ -17,7 +17,7 @@ export const getRowColorClass = (
17
17
  (inlineRowLoading && (rowHasNoChildren || row.getCanExpand()))
18
18
  );
19
19
 
20
- return row.getIsSelected() ? "bg-row-selection" : shouldShowExpandedBackground ? "bg-silver" : "bg-white";
20
+ return row.getIsSelected() ? "bg-row-selection" : shouldShowExpandedBackground ? "bg-silver" : "pb-bg-row-white";
21
21
  }
22
22
 
23
23
  /**
@@ -51,7 +51,7 @@
51
51
  background-color: lighten($silver, $opacity_7);
52
52
  }
53
53
 
54
- .bg-white {
54
+ .pb-bg-row-white {
55
55
  background-color: $white;
56
56
  }
57
57
 
@@ -278,7 +278,7 @@
278
278
  }
279
279
  }
280
280
 
281
- &.bg-white {
281
+ &.pb-bg-row-white {
282
282
  td:first-child {
283
283
  background-color: $white;
284
284
  }
@@ -756,7 +756,7 @@
756
756
  border-bottom-color: $border_dark !important;
757
757
  }
758
758
 
759
- .bg-white {
759
+ .pb-bg-row-white {
760
760
  background: $bg_dark_card;
761
761
  }
762
762
 
@@ -766,7 +766,7 @@
766
766
 
767
767
  // Dark mode virtualized rows
768
768
  .virtualized-table-row {
769
- &.bg-white {
769
+ &.pb-bg-row-white {
770
770
  background: $bg_dark_card !important;
771
771
 
772
772
  td:first-child {
@@ -308,10 +308,10 @@ test("Row toggle button exists and toggles subrows open and closed", () => {
308
308
  const kit = screen.getByTestId(testId)
309
309
  const rowButton = kit.querySelector(".gray-icon.expand-toggle-icon")
310
310
  expect(rowButton).toBeInTheDocument()
311
- const subRow1 = kit.querySelector(".bg-white.depth-sub-row-1")
311
+ const subRow1 = kit.querySelector(".pb-bg-row-white.depth-sub-row-1")
312
312
  expect(subRow1).not.toBeInTheDocument()
313
313
  rowButton.click()
314
- const subRow = kit.querySelector(".bg-white.depth-sub-row-1")
314
+ const subRow = kit.querySelector(".pb-bg-row-white.depth-sub-row-1")
315
315
  expect(subRow).toBeInTheDocument()
316
316
  })
317
317
 
@@ -328,13 +328,13 @@ test("toggleExpansionAll button exists and toggles subrows open and closed", asy
328
328
  const toggleButton = kit.querySelector(".gray-icon.toggle-all-icon");
329
329
  expect(toggleButton).toBeInTheDocument();
330
330
 
331
- const subRow1 = kit.querySelector(".bg-white.depth-sub-row-1");
331
+ const subRow1 = kit.querySelector(".pb-bg-row-white.depth-sub-row-1");
332
332
  expect(subRow1).not.toBeInTheDocument();
333
333
 
334
334
  toggleButton.click();
335
335
 
336
336
  await waitFor(() => {
337
- const subRow = kit.querySelector(".bg-white.depth-sub-row-1");
337
+ const subRow = kit.querySelector(".pb-bg-row-white.depth-sub-row-1");
338
338
  expect(subRow).toBeInTheDocument();
339
339
  })
340
340
  })
@@ -385,7 +385,7 @@ test("expandControl prop works as expected", () => {
385
385
  render (<AdvancedTableExpandControl/>)
386
386
 
387
387
  const kit = screen.getByTestId(testId)
388
- const subRow = kit.querySelector(".bg-white.depth-sub-row-1")
388
+ const subRow = kit.querySelector(".pb-bg-row-white.depth-sub-row-1")
389
389
  expect(subRow).toBeInTheDocument()
390
390
  })
391
391
 
@@ -76,6 +76,22 @@ const columnDefinitions = [
76
76
  {
77
77
  label: "Attendance",
78
78
  id: "attendance",
79
+ header: () => (
80
+ <Flex alignItems="center"
81
+ justifyContent="center"
82
+ >
83
+ <Caption marginRight="xs">Attendance</Caption>
84
+ <Tooltip placement="top"
85
+ text="Whoa. I'm a Tooltip Too!"
86
+ zIndex={10}
87
+ >
88
+ <Icon cursor="pointer"
89
+ icon="info"
90
+ size="xs"
91
+ />
92
+ </Tooltip>
93
+ </Flex>
94
+ ),
79
95
  columns: [
80
96
  {
81
97
  accessor: "attendanceRate",
@@ -0,0 +1,104 @@
1
+ <%
2
+ column_definitions = [
3
+ {
4
+ accessor: "year",
5
+ label: "Year",
6
+ id: "year",
7
+ cellAccessors: ["quarter", "month", "day"],
8
+ },
9
+ {
10
+ label: "Enrollment Data",
11
+ id: "enrollmentData",
12
+ header: ->(cell, label) {
13
+ capture do
14
+ pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
15
+ pb_rails("caption", props: { margin_right: "xs", text: "Enrollment Data" }) +
16
+ pb_rails("icon", props: { id: "tooltip-interact-multi", icon: "info", size: "xs", cursor: "pointer" }) +
17
+ pb_rails("tooltip", props: {
18
+ trigger_element_id: "tooltip-interact-multi",
19
+ tooltip_id: "example-custom-tooltip-multi",
20
+ position: "top",
21
+ z_index: "10"
22
+ }) do
23
+ "Whoa. I'm a Tooltip"
24
+ end
25
+ end
26
+ end
27
+ },
28
+ columns: [
29
+ {
30
+ label: "Enrollment Stats",
31
+ id: "enrollmentStats",
32
+ columns: [
33
+ {
34
+ accessor: "newEnrollments",
35
+ id: "newEnrollments",
36
+ label: "New Enrollments",
37
+ },
38
+ {
39
+ accessor: "scheduledMeetings",
40
+ id: "scheduledMeetings",
41
+ label: "Scheduled Meetings",
42
+ },
43
+ ],
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ label: "Performance Data",
49
+ id: "performanceData",
50
+ columns: [
51
+ {
52
+ label: "Completion Metrics",
53
+ id: "completionMetrics",
54
+ columns: [
55
+ {
56
+ accessor: "completedClasses",
57
+ id: "completedClasses",
58
+ label: "Completed Classes",
59
+ },
60
+ {
61
+ accessor: "classCompletionRate",
62
+ id: "classCompletionRate",
63
+ label: "Class Completion Rate",
64
+ },
65
+ ],
66
+ },
67
+ {
68
+ label: "Attendance",
69
+ id: "attendance",
70
+ header: ->(cell, label) {
71
+ capture do
72
+ pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
73
+ pb_rails("caption", props: { margin_right: "xs", text: "Attendance" }) +
74
+ pb_rails("icon", props: { id: "tooltip-interact-multi-2", icon: "info", size: "xs", cursor: "pointer" }) +
75
+ pb_rails("tooltip", props: {
76
+ trigger_element_id: "tooltip-interact-multi-2",
77
+ tooltip_id: "example-custom-tooltip-multi-2",
78
+ position: "top",
79
+ z_index: "10"
80
+ }) do
81
+ "Whoa. I'm a Tooltip Too!"
82
+ end
83
+ end
84
+ end
85
+ },
86
+ columns: [
87
+ {
88
+ accessor: "attendanceRate",
89
+ id: "attendanceRate",
90
+ label: "Attendance Rate",
91
+ },
92
+ {
93
+ accessor: "scheduledMeetings",
94
+ id: "scheduledMeetings",
95
+ label: "Scheduled Meetings",
96
+ },
97
+ ],
98
+ },
99
+ ],
100
+ },
101
+ ]
102
+ %>
103
+
104
+ <%= pb_rails("advanced_table", props: { id: "custom_header_multi_header_table", table_data: @table_data, column_definitions: column_definitions }) %>
@@ -0,0 +1 @@
1
+ The optional `header` item within `column_definitions` can also be used with multi headers as seen here.
@@ -12,7 +12,7 @@
12
12
  capture do
13
13
  pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do
14
14
  pb_rails("caption", props: { margin_right: "xs", text: "New Enrollments" }) +
15
- pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs" }) +
15
+ pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs", cursor: "pointer" }) +
16
16
  pb_rails("tooltip", props: {
17
17
  trigger_element_id: "tooltip-interact",
18
18
  tooltip_id: "example-custom-tooltip",
@@ -11,6 +11,7 @@ examples:
11
11
  - advanced_table_responsive: Responsive Tables
12
12
  - advanced_table_custom_cell_rails: Custom Components for Cells
13
13
  - advanced_table_with_custom_header_rails: Custom Header Cell
14
+ - advanced_table_with_custom_header_multi_header_rails: Custom Header with Multiple Headers
14
15
  - advanced_table_column_headers: Multi-Header Columns
15
16
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
16
17
  - advanced_table_column_headers_vertical_border: Multi-Header Columns with Vertical Borders
@@ -51,7 +51,7 @@ export default class PbFlatAdvancedTable extends PbEnhancedElement {
51
51
 
52
52
  const tr = rowCb.closest("tr");
53
53
  tr?.classList.toggle("bg-row-selection", rowCb.checked);
54
- tr?.classList.toggle("bg-white", !rowCb.checked);
54
+ tr?.classList.toggle("pb-bg-row-white", !rowCb.checked);
55
55
  }
56
56
 
57
57
  if (allCb) {
@@ -62,7 +62,7 @@ export default class PbFlatAdvancedTable extends PbEnhancedElement {
62
62
  cb.checked = checked;
63
63
  const tr = cb.closest("tr");
64
64
  tr?.classList.toggle("bg-row-selection", checked);
65
- tr?.classList.toggle("bg-white", !checked);
65
+ tr?.classList.toggle("pb-bg-row-white", !checked);
66
66
  const id = cb.id;
67
67
  if (checked) this.selectedRows.add(id);
68
68
  else this.selectedRows.delete(id);
@@ -76,7 +76,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
76
76
  // Only apply styling if the checkbox is inside a table row
77
77
  if (rowEl) {
78
78
  rowEl.classList.add("bg-row-selection");
79
- rowEl.classList.remove("bg-white", "bg-silver");
79
+ rowEl.classList.remove("pb-bg-row-white", "bg-silver");
80
80
  }
81
81
  } else {
82
82
  // Only apply styling if the checkbox is inside a table row
@@ -85,9 +85,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
85
85
 
86
86
  if (this.isRowExpanded(rowEl)) {
87
87
  rowEl.classList.remove("bg-silver");
88
- rowEl.classList.add("bg-white");
88
+ rowEl.classList.add("pb-bg-row-white");
89
89
  } else {
90
- rowEl.classList.remove("bg-white");
90
+ rowEl.classList.remove("pb-bg-row-white");
91
91
  rowEl.classList.add("bg-silver");
92
92
  }
93
93
  }
@@ -120,7 +120,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
120
120
  if (isChecked) {
121
121
  PbAdvancedTable.selectedRows.add(rowId);
122
122
  rowEl.classList.add("bg-row-selection");
123
- rowEl.classList.remove("bg-white", "bg-silver");
123
+ rowEl.classList.remove("pb-bg-row-white", "bg-silver");
124
124
  } else {
125
125
  PbAdvancedTable.selectedRows.delete(rowId);
126
126
  }
@@ -130,9 +130,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
130
130
 
131
131
  if (this.isRowExpanded(rowEl)) {
132
132
  rowEl.classList.remove("bg-silver");
133
- rowEl.classList.add("bg-white");
133
+ rowEl.classList.add("pb-bg-row-white");
134
134
  } else {
135
- rowEl.classList.remove("bg-white");
135
+ rowEl.classList.remove("pb-bg-row-white");
136
136
  rowEl.classList.add("bg-silver");
137
137
  }
138
138
  }
@@ -407,7 +407,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
407
407
  const row = this.element.closest("tr");
408
408
  if (row) {
409
409
  row.classList.toggle("bg-silver", !isVisible);
410
- row.classList.toggle("bg-white", isVisible);
410
+ row.classList.toggle("pb-bg-row-white", isVisible);
411
411
  }
412
412
 
413
413
  this.addBorderRadiusOnLastVisibleRow();
@@ -52,7 +52,7 @@
52
52
  }
53
53
  }
54
54
 
55
- .bg-white {
55
+ .pb-bg-row-white {
56
56
  td:first-child,
57
57
  .sticky-left {
58
58
  background-color: $bg-main;
@@ -63,7 +63,7 @@
63
63
  &.bg-silver td:first-child {
64
64
  background-color: $bg-secondary;
65
65
  }
66
- &.bg-white td:first-child {
66
+ &.pb-bg-row-white td:first-child {
67
67
  background-color: $bg-main;
68
68
  }
69
69
  &.bg-row-selection td:first-child {
@@ -82,32 +82,62 @@ module Playbook
82
82
  end
83
83
  end
84
84
 
85
- # Get original column definition for custom rendering
85
+ # Get original column definition for custom rendering by accessor
86
86
  def find_original_column_def(accessor)
87
87
  find_column_def_by_accessor(column_definitions, accessor)
88
88
  end
89
89
 
90
+ # Get original column definition for custom rendering by id
91
+ def find_original_column_def_by_id(id)
92
+ find_column_def_by_id(column_definitions, id)
93
+ end
94
+
90
95
  # Check if a header cell has a custom renderer
91
96
  def has_header_renderer?(cell)
92
- return false unless cell[:accessor].present?
93
-
94
- original_def = find_original_column_def(cell[:accessor])
95
- original_def && original_def[:header].present?
97
+ original_def = find_original_column_def_for_cell(cell)
98
+ original_def&.dig(:header).present?
99
+ rescue
100
+ false
96
101
  end
97
102
 
98
103
  # Render custom header content
99
104
  def render_header(cell)
100
105
  return cell[:label] unless has_header_renderer?(cell)
101
106
 
102
- original_def = find_original_column_def(cell[:accessor])
107
+ original_def = find_original_column_def_for_cell(cell)
108
+ return cell[:label] unless original_def
109
+
103
110
  custom_renderer = original_def[:header]
111
+ return cell[:label] unless custom_renderer
104
112
 
105
113
  # Call the custom renderer with the cell data and label
106
- custom_renderer.call(cell, cell[:label])
114
+ begin
115
+ result = custom_renderer.call(cell, cell[:label])
116
+ result.present? ? result.to_s : cell[:label]
117
+ rescue
118
+ cell[:label]
119
+ end
107
120
  end
108
121
 
109
122
  private
110
123
 
124
+ # Find the original column definition for a cell
125
+ def find_original_column_def_for_cell(cell)
126
+ # Try accessor first (for leaf columns)
127
+ if cell[:accessor].present?
128
+ found = find_original_column_def(cell[:accessor])
129
+ return found if found
130
+ end
131
+
132
+ # Try id if accessor lookup didn't find it (for grouped columns or leaf columns with id)
133
+ if cell[:id].present?
134
+ found = find_original_column_def_by_id(cell[:id])
135
+ return found if found
136
+ end
137
+
138
+ nil
139
+ end
140
+
111
141
  def compute_max_depth(columns)
112
142
  columns.map do |col|
113
143
  col[:columns] ? 1 + compute_max_depth(col[:columns]) : 1
@@ -118,21 +148,24 @@ module Playbook
118
148
  total_columns = columns.size
119
149
  columns.each_with_index do |col, index|
120
150
  is_last = index == total_columns - 1
121
- if col[:columns]
122
- colspan = compute_leaf_columns(col[:columns])
123
- rows[current_depth] << {
151
+ nested_columns = col[:columns]
152
+ if nested_columns
153
+ colspan = compute_leaf_columns(nested_columns)
154
+ cell_hash = {
124
155
  label: col[:label],
125
156
  colspan: colspan,
126
157
  is_last_in_group: is_last && current_depth.positive?,
127
158
  }
159
+ cell_hash[:id] = col[:id] if col[:id].present?
160
+ rows[current_depth] << cell_hash
128
161
 
129
- process_columns(col[:columns], rows, current_depth + 1, max_depth)
162
+ process_columns(nested_columns, rows, current_depth + 1, max_depth)
130
163
  else
131
- raw_styling = col[:column_styling] || {}
132
- header_alignment = raw_styling[:header_alignment]
164
+ raw_styling = col[:column_styling] || {}
165
+ header_alignment = raw_styling[:header_alignment]
133
166
 
134
167
  colspan = 1
135
- rows[current_depth] << {
168
+ cell_hash = {
136
169
  label: col[:label],
137
170
  colspan: colspan,
138
171
  accessor: col[:accessor],
@@ -140,6 +173,8 @@ module Playbook
140
173
  is_last_in_group: is_last && current_depth.positive?,
141
174
  header_alignment: header_alignment,
142
175
  }
176
+ cell_hash[:id] = col[:id] if col[:id].present?
177
+ rows[current_depth] << cell_hash
143
178
  end
144
179
  end
145
180
  end
@@ -154,11 +189,15 @@ module Playbook
154
189
  max_depth = compute_max_depth(column_definitions)
155
190
 
156
191
  column_definitions.map do |col|
157
- if col.key?(:columns)
158
- {
192
+ if col[:columns]
193
+ nested_columns = col[:columns]
194
+ wrapped = {
159
195
  label: col[:label],
160
- columns: wrap_leaf_columns(col[:columns]),
196
+ columns: wrap_leaf_columns(nested_columns),
161
197
  }
198
+ wrapped[:id] = col[:id] if col[:id].present?
199
+ wrapped[:header] = col[:header] if col[:header].present?
200
+ wrapped
162
201
  else
163
202
  # For leaf columns, wrap with empty labels up to max depth to get proper structure
164
203
  wrap_leaf_column(col, max_depth)
@@ -173,6 +212,7 @@ module Playbook
173
212
  sort_menu: col[:sort_menu] || nil,
174
213
  column_styling: col[:column_styling] || {},
175
214
  }
215
+ wrapped[:id] = col[:id] if col[:id].present?
176
216
  (max_depth - 1).times do
177
217
  wrapped = { label: "", columns: [wrapped] }
178
218
  end
@@ -180,11 +220,41 @@ module Playbook
180
220
  end
181
221
 
182
222
  def find_column_def_by_accessor(defs, target_accessor)
223
+ return nil if target_accessor.blank?
224
+
183
225
  defs.each do |col|
184
- return col if col[:accessor] == target_accessor
226
+ col_accessor = col[:accessor]
227
+ next if col_accessor.blank?
228
+
229
+ return col if col_accessor.to_s == target_accessor.to_s
230
+
231
+ nested_columns = col[:columns]
232
+ if nested_columns.is_a?(Array)
233
+ found = find_column_def_by_accessor(nested_columns, target_accessor)
234
+ return found if found
235
+ end
236
+ end
237
+ nil
238
+ end
239
+
240
+ def find_column_def_by_id(defs, target_id)
241
+ return nil if target_id.blank?
242
+
243
+ defs.each do |col|
244
+ col_id = col[:id]
245
+
246
+ return col if col_id.present? && col_id.to_s == target_id.to_s
247
+
248
+ # Recursively search nested columns, even if current col has no id or doesn't match
249
+ nested_columns = col[:columns]
250
+
251
+ next unless nested_columns.present?
252
+
253
+ # Convert to array if needed (for edge cases where is_a?(Array) might fail)
254
+ array_columns = Array(nested_columns)
185
255
 
186
- if col[:columns].is_a?(Array)
187
- found = find_column_def_by_accessor(col[:columns], target_accessor)
256
+ if array_columns.any?
257
+ found = find_column_def_by_id(array_columns, target_id)
188
258
  return found if found
189
259
  end
190
260
  end
@@ -39,7 +39,7 @@ module Playbook
39
39
  end
40
40
 
41
41
  def classname
42
- generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
42
+ generate_classname("pb_table_tr", "pb-bg-row-white", subrow_depth_classname, separator: " ")
43
43
  end
44
44
 
45
45
  def td_classname(column, index)
@@ -20,11 +20,12 @@ type BadgeProps = {
20
20
  onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
21
21
  },
22
22
  data?: {[key: string]: string},
23
- htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
23
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void) | ((event: any) => void) | any},
24
24
  id?: string,
25
25
  removeIcon?: boolean,
26
26
  removeOnClick?: React.MouseEventHandler<HTMLSpanElement>,
27
27
  rounded?: boolean,
28
+ tabIndex?: number,
28
29
  text?: string,
29
30
  variant?: "error" | "info" | "neutral" | "notification" | "notificationError" | "primary" | "success" | "warning",
30
31
  } & GlobalProps
@@ -39,6 +40,7 @@ const Badge = (props: BadgeProps): React.ReactElement => {
39
40
  removeIcon = false,
40
41
  removeOnClick,
41
42
  rounded = false,
43
+ tabIndex,
42
44
  text,
43
45
  variant = 'neutral',
44
46
  } = props
@@ -61,6 +63,7 @@ const Badge = (props: BadgeProps): React.ReactElement => {
61
63
  {...htmlProps}
62
64
  className={css}
63
65
  id={id}
66
+ tabIndex={tabIndex}
64
67
  >
65
68
  <span>
66
69
  {text}
@@ -112,3 +112,16 @@ test('displays notification variants', () => {
112
112
  cleanup()
113
113
  })
114
114
  })
115
+
116
+ test('should allow tabIndex to be set', () => {
117
+ render(
118
+ <Badge
119
+ data={{ testid: testId }}
120
+ tabIndex={0}
121
+ text="+1"
122
+ />
123
+ )
124
+
125
+ const kit = screen.getByTestId(testId)
126
+ expect(kit).toHaveAttribute('tabIndex', '0')
127
+ })
@@ -350,8 +350,14 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
350
350
  if (syncStartWith) {
351
351
  picker.config.onClose.push((selectedDates: string) => {
352
352
  if (selectedDates?.length) {
353
- const quickpick = (document.querySelector(`#${syncStartWith}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
354
- quickpick?.clear();
353
+ const element = document.querySelector(`#${syncStartWith}`) as any;
354
+ // Check if it's a Dropdown QuickPick (has _dropdownRef) or DatePicker QuickPick (has _flatpickr)
355
+ if (element?._dropdownRef?.current) {
356
+ element._dropdownRef.current.clearSelected();
357
+ } else {
358
+ const quickpick = element?._flatpickr;
359
+ quickpick?.clear();
360
+ }
355
361
  }
356
362
  });
357
363
  }
@@ -360,8 +366,14 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
360
366
  if (syncEndWith) {
361
367
  picker.config.onClose.push((selectedDates: string) => {
362
368
  if (selectedDates?.length) {
363
- const quickpick = (document.querySelector(`#${syncEndWith}`) as HTMLElement & { _flatpickr?: any })?._flatpickr;
364
- quickpick?.clear();
369
+ const element = document.querySelector(`#${syncEndWith}`) as any;
370
+ // Check if it's a Dropdown QuickPick (has _dropdownRef) or DatePicker QuickPick (has _flatpickr)
371
+ if (element?._dropdownRef?.current) {
372
+ element._dropdownRef.current.clearSelected();
373
+ } else {
374
+ const quickpick = element?._flatpickr;
375
+ quickpick?.clear();
376
+ }
365
377
  }
366
378
  });
367
379
  }
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import Dropdown from "../../pb_dropdown/_dropdown";
3
+ import DatePicker from "../../pb_date_picker/_date_picker";
4
+
5
+ const DatePickerAndDropdownRange = (props) => {
6
+ return (
7
+ <>
8
+ <Dropdown
9
+ controlsEndId="end-date-picker1"
10
+ controlsStartId="start-date-picker1"
11
+ id="dropdown-as-quickpick"
12
+ label="Date Range"
13
+ marginBottom="sm"
14
+ placeholder="Select a Date Range"
15
+ variant="quickpick"
16
+ {...props}
17
+ />
18
+
19
+ <DatePicker
20
+ label="Start Date"
21
+ pickerId="start-date-picker1"
22
+ placeholder="Select a Start Date"
23
+ syncStartWith="dropdown-as-quickpick"
24
+ {...props}
25
+ />
26
+
27
+ <DatePicker
28
+ label="End Date"
29
+ pickerId="end-date-picker1"
30
+ placeholder="Select an End Date"
31
+ syncEndWith="dropdown-as-quickpick"
32
+ {...props}
33
+ />
34
+ </>
35
+ );
36
+ };
37
+
38
+ export default DatePickerAndDropdownRange;
@@ -0,0 +1,14 @@
1
+ You can link a Dropdown (`quickpick` variant) to standard DatePickers using the following props:
2
+
3
+ **For the Dropdown**:
4
+ `controlsStartId`: ID of the DatePicker that should receive the start date.
5
+
6
+ `controlsEndId`: ID of the DatePicker that should receive the end date.
7
+
8
+ When a quickpick option like “This Year” is selected, it automatically populates the linked start and end inputs.
9
+
10
+ **For the Start/End DatePickers**:
11
+ `syncStartWith`: ID of the quickpick this start date is synced to.
12
+ `syncEndWith`: ID of the quickpick this end date is synced to.
13
+
14
+ When a user manually edits the start or end date, it clears the selected quickpick to prevent conflicting values.