playbook_ui 14.21.2.pre.alpha.PLAY22358326 → 14.21.2.pre.alpha.PLAY22558410

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +4 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +8 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +5 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +4 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +25 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +36 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.jsx +64 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.md +7 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +60 -84
  14. data/app/pb_kits/playbook/pb_advanced_table/index.js +114 -223
  15. data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.html.erb +1 -1
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb +3 -3
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx +7 -4
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +6 -3
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +6 -3
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_rails.html.erb +3 -3
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb +3 -3
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx +7 -4
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +3 -3
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +7 -4
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select.jsx +19 -10
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display.jsx +19 -10
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_display_rails.html.erb +10 -10
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_rails.html.erb +10 -10
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.html.erb +10 -10
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_autocomplete.jsx +20 -11
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.html.erb +3 -3
  32. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_custom_options.jsx +8 -8
  33. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.html.erb +10 -10
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_multi_select_with_default.jsx +23 -14
  35. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +3 -3
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +6 -3
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.jsx +6 -3
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.html.erb +3 -3
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +3 -3
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +6 -3
  41. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.html.erb +3 -3
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +3 -3
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.html.erb +4 -4
  44. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_with_subcomponents.jsx +4 -4
  45. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +4 -4
  46. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +4 -4
  47. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.html.erb +52 -0
  48. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options.jsx +99 -0
  49. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_rails.md +1 -0
  50. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_icon_options_react.md +1 -0
  51. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +3 -3
  52. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.html.erb +3 -3
  53. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.html.erb +3 -3
  54. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +3 -3
  55. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.html.erb +28 -0
  56. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +47 -0
  57. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_rails.md +1 -0
  58. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -0
  59. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +3 -3
  60. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.html.erb +3 -3
  61. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_external_control.jsx +3 -3
  62. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -3
  63. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +6 -3
  64. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search.jsx +3 -3
  65. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_search_rails.html.erb +3 -3
  66. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -0
  67. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +3 -1
  68. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +8 -8
  69. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +1 -1
  70. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +12 -12
  71. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
  72. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +12 -12
  73. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +2 -2
  74. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  75. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +4 -0
  76. data/dist/chunks/_typeahead-B80UsDrG.js +22 -0
  77. data/dist/chunks/_weekday_stacked-D1bqIne1.js +45 -0
  78. data/dist/chunks/lib-CTkMyvfQ.js +29 -0
  79. data/dist/chunks/{pb_form_validation-DSkdRDMf.js → pb_form_validation-BVF3TmcL.js} +1 -1
  80. data/dist/chunks/vendor.js +1 -1
  81. data/dist/playbook-doc.js +3 -3
  82. data/dist/playbook-rails-react-bindings.js +1 -1
  83. data/dist/playbook-rails.js +1 -1
  84. data/dist/playbook.css +1 -1
  85. data/lib/playbook/version.rb +1 -1
  86. metadata +17 -6
  87. data/dist/chunks/_typeahead-CVIBi3oA.js +0 -22
  88. data/dist/chunks/_weekday_stacked-BknM0ZnU.js +0 -45
  89. data/dist/chunks/lib-D7Va7yqa.js +0 -29
@@ -1,4 +1,5 @@
1
1
  import PbEnhancedElement from "../pb_enhanced_element";
2
+ import { updateSelectionActionBar } from "./advanced_table_action_bar";
2
3
 
3
4
  const ADVANCED_TABLE_SELECTOR = "[data-advanced-table]";
4
5
  const DOWN_ARROW_SELECTOR = "#advanced-table_open_icon";
@@ -9,9 +10,33 @@ export default class PbAdvancedTable extends PbEnhancedElement {
9
10
  return ADVANCED_TABLE_SELECTOR;
10
11
  }
11
12
 
13
+ static expandedRows = new Set();
14
+ static selectedRows = new Set();
15
+ static isCollapsing = false;
16
+
17
+ constructor(...args) {
18
+ super(...args);
19
+ // Map parent row ID to array of its child rows
20
+ this.childRowsMap = new Map();
21
+ }
22
+
23
+ // Fetch and cache child rows for a given parent row ID
24
+ childRowsFor(parentId) {
25
+ if (!this.childRowsMap.has(parentId)) {
26
+ const table = this.element.closest("table");
27
+ const rows = Array.from(
28
+ table.querySelectorAll(`tr[data-row-parent="${parentId}"]`)
29
+ );
30
+ this.childRowsMap.set(parentId, rows);
31
+ }
32
+ return this.childRowsMap.get(parentId);
33
+ }
34
+
12
35
  updateTableSelectedRowsAttribute() {
13
36
  const mainTable = this.element.closest(".pb_advanced_table");
14
- mainTable.dataset.selectedRows = JSON.stringify(Array.from(PbAdvancedTable.selectedRows));
37
+ mainTable.dataset.selectedRows = JSON.stringify(
38
+ Array.from(PbAdvancedTable.selectedRows)
39
+ );
15
40
  }
16
41
 
17
42
  // Check if the row is expanded or collapsed
@@ -104,7 +129,7 @@ export default class PbAdvancedTable extends PbEnhancedElement {
104
129
  } else {
105
130
  PbAdvancedTable.selectedRows.delete(rowId);
106
131
  }
107
- // Update background color on row
132
+ // Update background color on row
108
133
  if (!isChecked) {
109
134
  rowEl.classList.remove("bg-row-selection");
110
135
 
@@ -176,118 +201,129 @@ export default class PbAdvancedTable extends PbEnhancedElement {
176
201
  );
177
202
  selectAllInput.checked = allChecked;
178
203
  }
204
+ updateSelectionActionBar(table.closest(".pb_advanced_table"), PbAdvancedTable.selectedRows.size);
179
205
  }
180
206
 
181
207
  get target() {
182
- const table = this.element.closest("table");
183
- return table.querySelectorAll(`[data-row-parent="${this.element.id}"]`);
208
+ return this.childRowsFor(this.element.id) || [];
184
209
  }
185
210
 
186
- static expandedRows = new Set();
187
- static selectedRows = new Set();
188
- static isCollapsing = false;
189
-
190
211
  connect() {
191
- this.element.addEventListener("click", () => {
192
- if (!PbAdvancedTable.isCollapsing) {
193
- const isExpanded =
194
- this.element.querySelector(UP_ARROW_SELECTOR).style.display ===
195
- "inline-block";
196
- if (!isExpanded) {
197
- PbAdvancedTable.expandedRows.add(this.element.id);
198
- } else {
199
- PbAdvancedTable.expandedRows.delete(this.element.id);
200
- }
201
- this.toggleElement(this.target);
202
- }
203
- });
212
+ const table = this.element.closest("table");
204
213
 
205
214
  this.hideCloseIcon();
215
+ const mainTable = this.element.closest(".pb_advanced_table");
216
+
217
+ // This so it is hidden on first render
218
+ if (mainTable) {
219
+ updateSelectionActionBar(mainTable);
220
+ }
206
221
 
207
- const table = this.element.closest("table");
222
+ // Precompute parent→child rows mapping once
223
+ table.querySelectorAll("tr[data-row-parent]").forEach((row) => {
224
+ const parentId = row.dataset.rowParent;
225
+ if (!this.childRowsMap.has(parentId)) {
226
+ this.childRowsMap.set(parentId, []);
227
+ }
228
+ this.childRowsMap.get(parentId).push(row);
229
+ });
208
230
 
209
231
  // Prevent duplicate initialization
210
232
  if (table.dataset.pbAdvancedTableInitialized) return;
211
233
  table.dataset.pbAdvancedTableInitialized = "true";
212
234
 
213
- // Bind checkbox change handlers for all row checkboxes
214
- const checkboxLabels = table.querySelectorAll("label[data-row-id]");
215
- checkboxLabels.forEach((label) => {
216
- const checkbox = label.querySelector("input[type='checkbox']");
235
+ // Delegate checkbox changes
236
+ table.addEventListener("change", (event) => {
237
+ const checkbox = event.target.closest('input[type="checkbox"]');
217
238
  if (!checkbox) return;
218
- checkbox.addEventListener("change", (event) => {
219
- this.handleCheckboxClick(event);
220
- });
221
- });
222
239
 
223
- // Bind nested row expansion logic
224
- const nestedButtons = table.querySelectorAll("[data-advanced-table]");
225
- nestedButtons.forEach((button) => {
226
- button.addEventListener("click", () => {
227
- const isExpanded =
228
- button.querySelector(UP_ARROW_SELECTOR).style.display === "inline-block";
229
- if (isExpanded) {
230
- PbAdvancedTable.expandedRows.add(button.id);
231
- } else {
232
- PbAdvancedTable.expandedRows.delete(button.id);
233
- }
234
- });
235
- });
240
+ // Header "select-all" logic
241
+ if (checkbox.closest("#select-all-rows")) {
242
+ const checkAll = checkbox.checked;
243
+ const rowCheckboxes = table.querySelectorAll(
244
+ 'label[data-row-id] input[type="checkbox"]'
245
+ );
246
+ rowCheckboxes.forEach((cb) => {
247
+ if (cb.checked !== checkAll) {
248
+ cb.checked = checkAll;
249
+ this.handleCheckboxClick({ currentTarget: cb });
250
+ }
251
+ });
252
+ this.updateTableSelectedRowsAttribute();
253
+ updateSelectionActionBar(table.closest(".pb_advanced_table"), PbAdvancedTable.selectedRows.size);
254
+ return;
255
+ }
236
256
 
237
- // Bind select-all logic for this table
238
- const selectAllCheckbox = table.querySelector("#select-all-rows");
239
- if (selectAllCheckbox) {
240
- selectAllCheckbox.addEventListener("change", () => {
241
- const checkboxInput = selectAllCheckbox.querySelector('input[type="checkbox"]');
242
- const checkAll = checkboxInput.checked;
257
+ // Individual row checkbox logic
258
+ const rowLabel = checkbox.closest("label[data-row-id]");
259
+ if (rowLabel) {
260
+ this.handleCheckboxClick({ currentTarget: checkbox });
261
+ this.updateTableSelectedRowsAttribute();
243
262
 
244
- const checkboxes = Array.from(
245
- table.querySelectorAll("label[data-row-id] input[type='checkbox']")
263
+ // Sync header select-all state
264
+ const selectAllInput = table.querySelector(
265
+ '#select-all-rows input[type="checkbox"]'
246
266
  );
267
+ if (selectAllInput) {
268
+ selectAllInput.checked = Array.from(
269
+ table.querySelectorAll('label[data-row-id] input[type="checkbox"]')
270
+ ).every((cb) => cb.checked);
271
+ }
272
+ }
273
+ });
247
274
 
248
- checkboxes.forEach((cb) => {
249
- cb.checked = checkAll;
250
- const rowId = cb.id;
251
- const rowEl = cb.closest("tr");
275
+ // Delegate expand/collapse toggles
276
+ table.addEventListener("click", (event) => {
277
+ const toggleBtn = event.target.closest("[data-advanced-table]");
278
+ if (!toggleBtn || PbAdvancedTable.isCollapsing) return;
279
+
280
+ // Temporarily bind `this.element` to the clicked toggle
281
+ const prevElement = this.element;
282
+ this.element = toggleBtn;
283
+
284
+ // Update expandedRows set
285
+ const isExpanded =
286
+ toggleBtn.querySelector(UP_ARROW_SELECTOR).style.display ===
287
+ "inline-block";
288
+ if (!isExpanded) {
289
+ PbAdvancedTable.expandedRows.add(toggleBtn.id);
290
+ } else {
291
+ PbAdvancedTable.expandedRows.delete(toggleBtn.id);
292
+ }
252
293
 
253
- if (checkAll) {
254
- PbAdvancedTable.selectedRows.add(rowId);
255
- rowEl?.classList.add("bg-row-selection");
256
- rowEl?.classList.remove("bg-white", "bg-silver");
257
- } else {
258
- PbAdvancedTable.selectedRows.delete(rowId);
259
- rowEl?.classList.remove("bg-row-selection");
260
- rowEl?.classList.add("bg-white");
261
- }
262
- });
294
+ // Find direct child rows
295
+ const childRows = Array.from(
296
+ table.querySelectorAll(`[data-row-parent="${toggleBtn.id}"]`)
297
+ );
298
+ this.toggleElement(childRows);
263
299
 
264
- checkboxes.forEach((cb) => this.updateParentCheckboxes(cb));
300
+ // Restore original element context
301
+ this.element = prevElement;
302
+ });
265
303
 
266
- this.updateTableSelectedRowsAttribute();
267
- });
268
- }
269
- this.addBorderRadiusOnLastVisibleRow()
304
+ this.addBorderRadiusOnLastVisibleRow();
270
305
  }
271
306
 
272
307
  addBorderRadiusOnLastVisibleRow() {
273
- const parentElement = this.element.closest('.pb_advanced_table');
274
-
308
+ const parentElement = this.element.closest(".pb_advanced_table");
309
+
275
310
  const table = document.getElementById(parentElement.id);
276
311
 
277
312
  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
-
313
+ const visibleRows = table.querySelectorAll(
314
+ "tr.is-visible, tr:not(.toggle-content)"
315
+ );
316
+
317
+ visibleRows.forEach((row) => row.classList.remove("last-visible-row"));
318
+
282
319
  const lastVisibleRow = visibleRows[visibleRows.length - 1];
283
320
 
284
321
  if (lastVisibleRow) {
285
- lastVisibleRow.classList.add('last-visible-row');
322
+ lastVisibleRow.classList.add("last-visible-row");
286
323
  }
287
324
  }
288
325
  }
289
326
 
290
-
291
327
  hideCloseIcon() {
292
328
  const closeIcon = this.element.querySelector(UP_ARROW_SELECTOR);
293
329
  closeIcon.style.display = "none";
@@ -470,151 +506,6 @@ export default class PbAdvancedTable extends PbEnhancedElement {
470
506
  }
471
507
  }
472
508
 
473
- // Isolate action bar functionality so it doesn't mix with existing functionality
474
- class PbAdvancedTableActionBar {
475
- constructor() {
476
- this.init();
477
- }
478
-
479
- init() {
480
- // Initialize action bars for all advanced tables with action bars
481
- document.addEventListener('DOMContentLoaded', () => {
482
- this.setupActionBars();
483
- });
484
-
485
- // Also run immediately in case DOM is already loaded
486
- if (document.readyState === 'loading') {
487
- // DOM is still loading
488
- } else {
489
- // DOM is already loaded
490
- this.setupActionBars();
491
- }
492
- }
493
-
494
- setupActionBars() {
495
- const advancedTables = document.querySelectorAll('.pb_advanced_table');
496
-
497
- advancedTables.forEach(table => {
498
- // Only proceed if this table has both selectable rows AND an action bar
499
- if (!this.shouldEnableActionBar(table)) return;
500
-
501
- const actionBar = table.querySelector('.row-selection-actions-card');
502
- if (!actionBar) return; // Skip tables without action bars
503
-
504
- // Initialize action bar styles
505
- this.initializeActionBar(actionBar);
506
-
507
- // Set up checkbox listeners for this table
508
- this.setupCheckboxListeners(table, actionBar);
509
- });
510
- }
511
-
512
- shouldEnableActionBar(table) {
513
- // Check if the table has selectable rows
514
- const hasSelectableRows = table.querySelector('input[type="checkbox"]') !== null;
515
-
516
- // Check if the table has a row selection action bar (not other types of action bars)
517
- const hasRowSelectionActionBar = table.querySelector('.row-selection-actions-card') !== null;
518
-
519
- // Additional check: look for the presence of row checkboxes with data-row-id
520
- const hasRowCheckboxes = table.querySelector('label[data-row-id] input[type="checkbox"]') !== null;
521
-
522
- // Only enable if ALL conditions are met:
523
- // 1. Has selectable checkboxes
524
- // 2. Has the specific row selection action bar
525
- // 3. Has row checkboxes (not just other types of checkboxes)
526
- return hasSelectableRows && hasRowSelectionActionBar && hasRowCheckboxes;
527
- }
528
-
529
- initializeActionBar(actionBar) {
530
- // Set initial hidden state
531
- Object.assign(actionBar.style, {
532
- height: '0px',
533
- overflow: 'hidden',
534
- display: 'block',
535
- opacity: '0'
536
- });
537
-
538
- // Remove any visibility classes
539
- actionBar.classList.remove("p_xs", "is-visible", "show-action-card");
540
- actionBar.classList.add("p_none");
541
- }
542
-
543
- setupCheckboxListeners(table, actionBar) {
544
- // Only listen to row checkboxes (those with data-row-id), not all checkboxes
545
- const rowCheckboxes = table.querySelectorAll('label[data-row-id] input[type="checkbox"]');
546
-
547
- rowCheckboxes.forEach(checkbox => {
548
- checkbox.addEventListener('change', () => {
549
- // Use setTimeout to ensure this runs after the main checkbox logic
550
- setTimeout(() => {
551
- this.updateActionBarVisibility(table, actionBar);
552
- }, 0);
553
- });
554
- });
555
-
556
- // Special handling for select-all checkbox (only if it exists)
557
- const selectAllCheckbox = table.querySelector("#select-all-rows");
558
- if (selectAllCheckbox) {
559
- const selectAllInput = selectAllCheckbox.querySelector('input[type="checkbox"]');
560
- if (selectAllInput) {
561
- selectAllInput.addEventListener('change', () => {
562
- // Use setTimeout to ensure this runs after the main select-all logic
563
- setTimeout(() => {
564
- this.updateActionBarVisibility(table, actionBar);
565
- }, 10); // Slightly longer delay for select-all to ensure all row checkboxes are updated
566
- });
567
- }
568
- }
569
- }
570
-
571
- updateActionBarVisibility(table, actionBar) {
572
- // Only count row checkboxes (those with data-row-id), not all checkboxes
573
- const rowCheckboxes = table.querySelectorAll('label[data-row-id] input[type="checkbox"]');
574
-
575
- // Get all checked row checkboxes
576
- const selectedRowCheckboxes = Array.from(rowCheckboxes).filter(cb => cb.checked);
577
-
578
- // Get the selected count
579
- const selectedCount = selectedRowCheckboxes.length;
580
-
581
- if (selectedCount > 0) {
582
- this.showActionBar(actionBar, selectedCount);
583
- } else {
584
- this.hideActionBar(actionBar);
585
- }
586
- }
587
-
588
- showActionBar(actionBar, selectedCount) {
589
- // Show action bar directly
590
- actionBar.style.height = 'auto';
591
- actionBar.style.overflow = 'visible';
592
- actionBar.style.opacity = '1';
593
- actionBar.style.transitionProperty = 'all';
594
- actionBar.style.transitionTimingFunction = 'ease-in-out';
595
- actionBar.classList.remove("p_none");
596
- actionBar.classList.add("p_xs", "is-visible", "show-action-card");
597
-
598
- // Update the count
599
- const countElement = actionBar.querySelector(".selected-count");
600
- if (countElement) {
601
- countElement.textContent = `${selectedCount} Selected`;
602
- }
603
- }
604
-
605
- hideActionBar(actionBar) {
606
- // Hide action bar directly
607
- actionBar.style.height = '0px';
608
- actionBar.style.overflow = 'hidden';
609
- actionBar.style.opacity = '0';
610
- actionBar.classList.add("p_none");
611
- actionBar.classList.remove("p_xs", "is-visible", "show-action-card");
612
- }
613
- }
614
-
615
- // Initialize the isolated action bar functionality
616
- new PbAdvancedTableActionBar();
617
-
618
509
  window.expandAllRows = (element) => {
619
510
  PbAdvancedTable.handleToggleAllHeaders(element);
620
511
  };
@@ -8,7 +8,7 @@
8
8
  }) do %>
9
9
  <%= pb_rails("flex", props: { align_items: "center", justify: "between" }) do %>
10
10
  <%= pb_rails("caption", props: { color: "light", padding_left: "xs", size: "xs" }) do %>
11
- <span class="selected-count"><%= object.selected_count %> Selected</span>
11
+ <span class="selected-count"></span>
12
12
  <% end %>
13
13
  <%= pb_rails("flex/flex_item") do %>
14
14
  <%= pb_rails("flex") do %>
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  options = [
3
- { label: 'United States', value: 'United States', id: 'us' },
4
- { label: 'Canada', value: 'Canada', id: 'ca' },
5
- { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
3
+ { label: 'United States', value: 'unitedStates', id: 'us' },
4
+ { label: 'Canada', value: 'canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
6
6
  ]
7
7
 
8
8
  %>
@@ -5,17 +5,20 @@ const DropdownBlankSelection = (props) => {
5
5
  const options = [
6
6
  {
7
7
  label: "United States",
8
- value: "United States",
8
+ value: "unitedStates",
9
+ id: "us"
9
10
  },
10
11
  {
11
12
  label: "Canada",
12
- value: "Canada",
13
+ value: "canada",
14
+ id: "ca"
13
15
  },
14
16
  {
15
17
  label: "Pakistan",
16
- value: "Pakistan",
18
+ value: "pakistan",
19
+ id: "pk"
17
20
  }
18
- ];
21
+ ];
19
22
 
20
23
  return (
21
24
  <>
@@ -6,15 +6,18 @@ import Dropdown from '../../pb_dropdown/_dropdown'
6
6
  const options = [
7
7
  {
8
8
  label: "United States",
9
- value: "United States",
9
+ value: "unitedStates",
10
+ id: "us"
10
11
  },
11
12
  {
12
13
  label: "Canada",
13
- value: "Canada",
14
+ value: "canada",
15
+ id: "ca"
14
16
  },
15
17
  {
16
18
  label: "Pakistan",
17
- value: "Pakistan",
19
+ value: "pakistan",
20
+ id: "pk"
18
21
  }
19
22
  ]
20
23
 
@@ -6,15 +6,18 @@ const DropdownDefault = (props) => {
6
6
  const options = [
7
7
  {
8
8
  label: "United States",
9
- value: "United States",
9
+ value: "unitedStates",
10
+ id: "us"
10
11
  },
11
12
  {
12
13
  label: "Canada",
13
- value: "Canada",
14
+ value: "canada",
15
+ id: "ca"
14
16
  },
15
17
  {
16
18
  label: "Pakistan",
17
- value: "Pakistan",
19
+ value: "pakistan",
20
+ id: "pk"
18
21
  }
19
22
  ];
20
23
 
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  options = [
3
- { label: 'United States', value: 'United States', id: 'us' },
4
- { label: 'Canada', value: 'Canada', id: 'ca' },
5
- { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
3
+ { label: 'United States', value: 'unitedStates', id: 'us' },
4
+ { label: 'Canada', value: 'canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
6
6
  ]
7
7
 
8
8
  %>
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  options = [
3
- { label: 'United States', value: 'United States', id: 'us' },
4
- { label: 'Canada', value: 'Canada', id: 'ca' },
5
- { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
3
+ { label: 'United States', value: 'unitedStates', id: 'us' },
4
+ { label: 'Canada', value: 'canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
6
6
  ]
7
7
 
8
8
  %>
@@ -5,17 +5,20 @@ const DropdownDefaultValue = (props) => {
5
5
  const options = [
6
6
  {
7
7
  label: "United States",
8
- value: "United States",
8
+ value: "unitedStates",
9
+ id: "us"
9
10
  },
10
11
  {
11
12
  label: "Canada",
12
- value: "Canada",
13
+ value: "canada",
14
+ id: "ca"
13
15
  },
14
16
  {
15
17
  label: "Pakistan",
16
- value: "Pakistan",
18
+ value: "pakistan",
19
+ id: "pk"
17
20
  }
18
- ];
21
+ ];
19
22
 
20
23
  return (
21
24
  <>
@@ -1,8 +1,8 @@
1
1
  <%
2
2
  options = [
3
- { label: 'United States', value: 'United States', id: 'us' },
4
- { label: 'Canada', value: 'Canada', id: 'ca' },
5
- { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
3
+ { label: 'United States', value: 'unitedStates', id: 'us' },
4
+ { label: 'Canada', value: 'canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
6
6
  ]
7
7
  %>
8
8
 
@@ -10,17 +10,20 @@ const DropdownError = (props) => {
10
10
  const options = [
11
11
  {
12
12
  label: "United States",
13
- value: "United States",
13
+ value: "unitedStates",
14
+ id: "us"
14
15
  },
15
16
  {
16
17
  label: "Canada",
17
- value: "Canada",
18
+ value: "canada",
19
+ id: "ca"
18
20
  },
19
21
  {
20
22
  label: "Pakistan",
21
- value: "Pakistan",
23
+ value: "pakistan",
24
+ id: "pk"
22
25
  }
23
- ]
26
+ ];
24
27
 
25
28
  return (
26
29
  <>
@@ -6,39 +6,48 @@ const DropdownMultiSelect = (props) => {
6
6
  const options = [
7
7
  {
8
8
  label: "United States",
9
- value: "United States",
9
+ value: "unitedStates",
10
+ id: "us"
10
11
  },
11
12
  {
12
- label: "United Kingdom",
13
- value: "United Kingdom",
13
+ label: "United Kingdom",
14
+ value: "unitedKingdom",
15
+ id: "gb"
14
16
  },
15
17
  {
16
18
  label: "Canada",
17
- value: "Canada",
19
+ value: "canada",
20
+ id: "ca"
18
21
  },
19
22
  {
20
23
  label: "Pakistan",
21
- value: "Pakistan",
24
+ value: "pakistan",
25
+ id: "pk"
22
26
  },
23
27
  {
24
28
  label: "India",
25
- value: "India",
29
+ value: "india",
30
+ id: "in"
26
31
  },
27
32
  {
28
33
  label: "Australia",
29
- value: "Australia",
34
+ value: "australia",
35
+ id: "au"
30
36
  },
31
37
  {
32
38
  label: "New Zealand",
33
- value: "New Zealand",
39
+ value: "new Zealand",
40
+ id: "nz"
34
41
  },
35
42
  {
36
43
  label: "Italy",
37
- value: "Italy",
44
+ value: "italy",
45
+ id: "it"
38
46
  },
39
47
  {
40
48
  label: "Spain",
41
- value: "Spain",
49
+ value: "spain",
50
+ id: "es"
42
51
  }
43
52
  ];
44
53