playbook_ui 14.11.1.pre.alpha.hfhbrakemanplaybook5370 → 14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
  3. data/app/pb_kits/playbook/pb_button/button.html.erb +2 -3
  4. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +1 -6
  5. data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +3 -1
  6. data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +3 -0
  7. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -6
  8. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
  9. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +3 -9
  10. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +5 -0
  11. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +38 -0
  12. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +3 -0
  13. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -0
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
  15. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +7 -12
  16. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +9 -14
  17. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +6 -11
  18. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +8 -14
  19. data/app/pb_kits/playbook/pb_list/item.html.erb +30 -8
  20. data/app/pb_kits/playbook/pb_list/item.rb +7 -0
  21. data/app/pb_kits/playbook/pb_list/list.html.erb +31 -11
  22. data/app/pb_kits/playbook/pb_list/list.rb +4 -0
  23. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +6 -1
  24. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +30 -12
  25. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb +15 -0
  26. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx +24 -0
  27. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md +1 -0
  28. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -1
  29. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  30. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
  31. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +20 -1
  32. data/app/pb_kits/playbook/pb_radio/_radio.scss +12 -8
  33. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +8 -3
  34. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +17 -3
  35. data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +3 -0
  36. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +11 -4
  37. data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +3 -0
  38. data/app/pb_kits/playbook/pb_table/_table.tsx +2 -3
  39. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +74 -0
  40. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +3 -0
  41. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
  42. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +74 -0
  43. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +3 -0
  44. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +47 -0
  45. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +2 -0
  46. data/app/pb_kits/playbook/pb_table/docs/example.yml +3 -0
  47. data/app/pb_kits/playbook/pb_table/index.ts +187 -88
  48. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +12 -0
  49. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +6 -5
  50. data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
  51. data/app/pb_kits/playbook/pb_table/table.rb +17 -2
  52. data/app/pb_kits/playbook/pb_table/table_row.html.erb +20 -1
  53. data/app/pb_kits/playbook/pb_table/table_row.rb +5 -0
  54. data/app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts +22 -0
  55. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +30 -30
  56. data/dist/chunks/{_typeahead-BNULwihE.js → _typeahead-DjGX1O4K.js} +2 -2
  57. data/dist/chunks/_weekday_stacked-s8bX_aFg.js +45 -0
  58. data/dist/chunks/{lib-B7sgJtGS.js → lib-kMuhBuU7.js} +2 -2
  59. data/dist/chunks/{pb_form_validation-C5Cc0-1v.js → pb_form_validation-DBJ0wZuS.js} +1 -1
  60. data/dist/chunks/vendor.js +1 -1
  61. data/dist/playbook-doc.js +1 -1
  62. data/dist/playbook-rails-react-bindings.js +1 -1
  63. data/dist/playbook-rails.js +1 -1
  64. data/dist/playbook.css +1 -1
  65. data/lib/playbook/version.rb +1 -1
  66. metadata +20 -7
  67. data/dist/chunks/_weekday_stacked-BKWemDAe.js +0 -45
  68. /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible.md → _table_with_collapsible_react.md} +0 -0
@@ -1,108 +1,207 @@
1
1
  import PbEnhancedElement from '../pb_enhanced_element'
2
2
 
3
- export default class PbTable extends PbEnhancedElement {
4
- private stickyLeftColumns: string[] = [];
5
- private handleStickyLeftColumnsRef: () => void;
6
-
7
- static get selector(): string {
8
- return '.table-responsive-collapse'
9
- }
3
+ const TABLE_WRAPPER_SELECTOR = "[data-pb-table-wrapper]";
4
+ const TABLE_COLLAPSIBLE_WRAPPER_SELECTOR = "[data-pb-table-collapsible-wrapper]";
10
5
 
11
- connect(): void {
12
- const tables = document.querySelectorAll('.table-responsive-collapse');
13
- // Each Table
14
- [].forEach.call(tables, (table: HTMLTableElement) => {
15
- // Header Titles
16
- const headers: string[] = [];
17
- [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
18
- const colSpan = header.colSpan
19
- for (let i = 0; i < colSpan; i++) {
20
- headers.push(header.textContent.replace(/\r?\n|\r/, ''));
21
- }
22
- });
23
- // for each row in tbody
24
- [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
25
- // for each cell
26
- [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
27
- // apply the attribute
28
- cell.setAttribute('data-title', headers[headerIndex])
29
- })
30
- })
6
+ export default class PbTable extends PbEnhancedElement {
7
+ stickyLeftColumns: string[] = [];
8
+ stickyRightColumns: string[] = [];
9
+ stickyRightColumnsReversed: string[] = [];
10
+
11
+ static get selector(): string {
12
+ return TABLE_WRAPPER_SELECTOR;
13
+ }
14
+
15
+ connect() {
16
+ if (this.element.classList.contains('table-responsive-collapse')) {
17
+ const headers: string[] = [];
18
+
19
+ [].forEach.call(this.element.querySelectorAll('th'), (header: HTMLTableCellElement) => {
20
+ const colSpan = header.colSpan
21
+ for (let i = 0; i < colSpan; i++) {
22
+ headers.push(header.textContent.replace(/\r?\n|\r/, ''));
23
+ }
31
24
  });
32
25
 
33
- // New sticky columns logic
34
- this.initStickyLeftColumns();
26
+ [].forEach.call(this.element.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
27
+ [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
28
+ cell.setAttribute('data-title', headers[headerIndex])
29
+ })
30
+ })
35
31
  }
36
32
 
37
- private initStickyLeftColumns(): void {
38
- // Find tables with sticky-left-column class
39
- const tables = document.querySelectorAll('.sticky-left-column');
40
-
41
- tables.forEach((table) => {
42
- // Extract sticky left column IDs by looking at the component's class
43
- const classList = Array.from(table.classList);
44
-
45
- // Look for classes in the format sticky-left-column-{ids}
46
- const stickyColumnClass = classList.find(cls => cls.startsWith('sticky-columns-'));
47
- if (stickyColumnClass) {
48
- // Extract the IDs from the class name
49
- this.stickyLeftColumns = stickyColumnClass
50
- .replace('sticky-columns-', '')
51
- .split('-');
52
-
53
- if (this.stickyLeftColumns.length > 0) {
54
- setTimeout(() => {
55
- this.handleStickyLeftColumnsRef = this.handleStickyLeftColumns.bind(this);
56
- this.handleStickyLeftColumns();
57
- window.addEventListener('resize', this.handleStickyLeftColumnsRef);
58
- }, 10);
59
- }
33
+ this.initStickyLeftColumns();
34
+ this.initStickyRightColumns();
35
+ this.handleCollapsibleClick();
36
+ this.handleCollapsibleRow();
37
+ }
38
+
39
+ initStickyLeftColumns() {
40
+ const table = this.element.querySelector('.sticky-left-column');
41
+
42
+ if (table) {
43
+ const classList = Array.from(table.classList);
44
+ const stickyColumnClass = classList.find(cls => cls.startsWith('sticky-left-columns-ids-'));
45
+
46
+ if (stickyColumnClass) {
47
+ this.stickyLeftColumns = stickyColumnClass
48
+ .replace('sticky-left-columns-ids-', '')
49
+ .split('-');
50
+
51
+ if (this.stickyLeftColumns.length > 0) {
52
+ setTimeout(() => {
53
+ this.handleStickyLeftColumns();
54
+ window.addEventListener('resize', () => this.handleStickyLeftColumns());
55
+ }, 10);
60
56
  }
61
- });
57
+ }
62
58
  }
59
+ }
60
+
61
+ handleStickyLeftColumns() {
62
+ let accumulatedWidth = 0;
63
+
64
+ this.stickyLeftColumns.forEach((colId, index) => {
65
+ const isLastColumn = index === this.stickyLeftColumns.length - 1;
66
+ const header = this.element.querySelector(`th[id="${colId}"]`);
67
+ const cells = this.element.querySelectorAll(`td[id="${colId}"]`);
68
+
69
+ if (header) {
70
+ header.classList.add('sticky');
71
+ (header as HTMLElement).style.left = `${accumulatedWidth}px`;
72
+
73
+ if (!isLastColumn) {
74
+ header.classList.add('with-border-right');
75
+ header.classList.remove('sticky-left-shadow');
76
+ } else {
77
+ header.classList.remove('with-border-right');
78
+ header.classList.add('sticky-left-shadow');
79
+ }
63
80
 
64
- private handleStickyLeftColumns(): void {
65
- let accumulatedWidth = 0;
66
-
67
- this.stickyLeftColumns.forEach((colId, index) => {
68
- const isLastColumn = index === this.stickyLeftColumns.length - 1;
69
- const header = document.querySelector(`th[id="${colId}"]`);
70
- const cells = document.querySelectorAll(`td[id="${colId}"]`);
71
-
72
- if (header) {
73
- header.classList.add('sticky');
74
- (header as HTMLElement).style.left = `${accumulatedWidth}px`;
81
+ accumulatedWidth += (header as HTMLElement).offsetWidth;
82
+ }
75
83
 
76
- if (!isLastColumn) {
77
- header.classList.add('with-border-right');
78
- header.classList.remove('sticky-left-shadow');
79
- } else {
80
- header.classList.remove('with-border-right');
81
- header.classList.add('sticky-left-shadow');
82
- }
84
+ cells.forEach((cell) => {
85
+ cell.classList.add('sticky');
86
+ (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
83
87
 
84
- accumulatedWidth += (header as HTMLElement).offsetWidth;
88
+ if (!isLastColumn) {
89
+ cell.classList.add('with-border-right');
90
+ cell.classList.remove('sticky-left-shadow');
91
+ } else {
92
+ cell.classList.remove('with-border-right');
93
+ cell.classList.add('sticky-left-shadow');
85
94
  }
95
+ });
96
+ });
97
+ }
98
+
99
+ initStickyRightColumns() {
100
+ const table = this.element.querySelector('.sticky-right-column');
101
+
102
+ if (table) {
103
+ const classList = Array.from(table.classList);
104
+ const stickyColumnClass = classList.find(cls => cls.startsWith('sticky-right-columns-ids-'));
105
+
106
+ if (stickyColumnClass) {
107
+ this.stickyRightColumns = stickyColumnClass
108
+ .replace('sticky-right-columns-ids-', '')
109
+ .split('-');
110
+ this.stickyRightColumnsReversed = this.stickyRightColumns.reverse();
111
+
112
+ if (this.stickyRightColumns.length > 0) {
113
+ setTimeout(() => {
114
+ this.handleStickyRightColumns();
115
+ window.addEventListener('resize', () => this.handleStickyRightColumns());
116
+ }, 10);
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ handleStickyRightColumns() {
123
+ let accumulatedWidth = 0;
124
+
125
+ this.stickyRightColumnsReversed.forEach((colId, index) => {
126
+ const isLastColumn = index === this.stickyRightColumns.length - 1;
127
+ const header = this.element.querySelector(`th[id="${colId}"]`);
128
+ const cells = this.element.querySelectorAll(`td[id="${colId}"]`);
129
+
130
+ if (header) {
131
+ header.classList.add('sticky');
132
+ (header as HTMLElement).style.right = `${accumulatedWidth}px`;
133
+
134
+ if (!isLastColumn) {
135
+ header.classList.add('with-border-left');
136
+ header.classList.remove('sticky-right-shadow');
137
+ } else {
138
+ header.classList.remove('with-border-right');
139
+ header.classList.add('sticky-right-shadow');
140
+ }
141
+
142
+ accumulatedWidth += (header as HTMLElement).offsetWidth;
143
+ }
86
144
 
87
- cells.forEach((cell) => {
88
- cell.classList.add('sticky');
89
- (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
145
+ cells.forEach((cell) => {
146
+ cell.classList.add('sticky');
147
+ (cell as HTMLElement).style.right = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
90
148
 
91
- if (!isLastColumn) {
92
- cell.classList.add('with-border-right');
93
- cell.classList.remove('sticky-left-shadow');
94
- } else {
95
- cell.classList.remove('with-border-right');
96
- cell.classList.add('sticky-left-shadow');
97
- }
149
+ if (!isLastColumn) {
150
+ cell.classList.add('with-border-left');
151
+ cell.classList.remove('sticky-right-shadow');
152
+ } else {
153
+ cell.classList.remove('with-border-left');
154
+ cell.classList.add('sticky-right-shadow');
155
+ }
156
+ });
157
+ });
158
+ }
159
+
160
+ handleCollapsibleClick() {
161
+ const collapsibleElements = this.element.querySelectorAll(TABLE_COLLAPSIBLE_WRAPPER_SELECTOR);
162
+ collapsibleElements.forEach((collapsibleElement) => {
163
+ collapsibleElement.addEventListener('click', (event) => {
164
+ document.dispatchEvent(new CustomEvent(`collapsed-toggle${(event.currentTarget as HTMLElement).id}`))
165
+
166
+ const toggleElements = this.element.querySelectorAll(`.collapsible_border_toggle${(event.currentTarget as HTMLElement).id}`);
167
+ toggleElements.forEach(element => {
168
+ element.classList.toggle('no-border');
169
+ element.classList.toggle('border-active');
98
170
  });
171
+ })
172
+ })
173
+ }
174
+
175
+ handleCollapsibleRow() {
176
+ const collapsibleRows = this.element.querySelectorAll('.pb_table_collapsible_row');
177
+ if (collapsibleRows.length > 0) {
178
+ collapsibleRows.forEach((row) => {
179
+ const previousRow = row.previousElementSibling;
180
+
181
+ if (
182
+ previousRow &&
183
+ previousRow.tagName === 'TR'
184
+ ) {
185
+ const tdCount = previousRow.querySelectorAll('td').length;
186
+ const collapsibleTd = row.querySelector('td');
187
+ if (collapsibleTd) {
188
+ collapsibleTd.colSpan = tdCount;
189
+ }
190
+ } else {
191
+ return
192
+ }
99
193
  });
100
194
  }
195
+ }
101
196
 
102
- // Cleanup method to remove event listener
103
- disconnect(): void {
104
- if (this.handleStickyLeftColumnsRef) {
105
- window.removeEventListener('resize', this.handleStickyLeftColumnsRef);
106
- }
197
+ // Cleanup method to remove event listener
198
+ disconnect() {
199
+ if (this.stickyLeftColumns.length > 0) {
200
+ window.removeEventListener('resize', () => this.handleStickyLeftColumns());
201
+ }
202
+
203
+ if (this.stickyRightColumns.length > 0) {
204
+ window.removeEventListener('resize', () => this.handleStickyRightColumns());
107
205
  }
108
- }
206
+ }
207
+ }
@@ -32,4 +32,16 @@
32
32
  }
33
33
  }
34
34
  }
35
+
36
+ .collapsible-tr {
37
+ cursor: pointer;
38
+ }
39
+
40
+ .no-border {
41
+ border-bottom: none !important;
42
+ }
43
+
44
+ .border-active {
45
+ border-bottom: 1px;
46
+ }
35
47
  }
@@ -1,7 +1,7 @@
1
1
  @import "../../tokens/screen_sizes";
2
+ @import "../../tokens/border_radius";
2
3
 
3
4
  .table-responsive-scroll {
4
- display: block;
5
5
  overflow-x: scroll;
6
6
 
7
7
  // hides duplicate scroll bar for those that see two (byproduct of repeated table-responsive-scroll class
@@ -27,11 +27,12 @@
27
27
  // Responsive Styles
28
28
  @media (max-width: 1600px) {
29
29
  &[class*="table-responsive-scroll"] {
30
- border-radius: 4px;
31
- box-shadow: 1px 0 0 0px $border_light,
30
+ &:has(> table.table-card) {
31
+ border-radius: $border_rad_light;
32
+ box-shadow: 1px 0 0 0px $border_light,
32
33
  -1px 0 0 0px $border_light
33
- }
34
-
34
+ }
35
+ }
35
36
  &[class^=pb_table].table-sm.table-card thead tr th:first-child,
36
37
  &[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
37
38
  border-left-width: 0px;
@@ -4,7 +4,7 @@
4
4
  <% responsive_class = nil %>
5
5
  <% end %>
6
6
 
7
- <%= content_tag(:div, class: responsive_class) do %>
7
+ <%= content_tag(:div, class: responsive_class, 'data-pb-table-wrapper' => true) do %>
8
8
  <% if object.tag == "table" %>
9
9
  <%= content_tag(:table,
10
10
  aria: object.aria,
@@ -25,6 +25,8 @@ module Playbook
25
25
  default: false
26
26
  prop :sticky_left_column, type: Playbook::Props::Array,
27
27
  default: []
28
+ prop :sticky_right_column, type: Playbook::Props::Array,
29
+ default: []
28
30
  prop :vertical_border, type: Playbook::Props::Boolean,
29
31
  default: false
30
32
  prop :striped, type: Playbook::Props::Boolean,
@@ -40,7 +42,7 @@ module Playbook
40
42
  generate_classname(
41
43
  "pb_table", "table-#{size}", single_line_class, dark_class,
42
44
  disable_hover_class, container_class, data_table_class, sticky_class, sticky_left_column_class,
43
- collapse_class, vertical_border_class, striped_class, outer_padding_class,
45
+ sticky_right_column_class, collapse_class, vertical_border_class, striped_class, outer_padding_class,
44
46
  "table-responsive-#{responsive}", separator: " "
45
47
  )
46
48
  end
@@ -83,7 +85,7 @@ module Playbook
83
85
  if sticky_left_column.empty?
84
86
  nil
85
87
  else
86
- sticky_col_classname = "sticky-left-column sticky-columns"
88
+ sticky_col_classname = "sticky-left-column sticky-left-columns-ids"
87
89
  sticky_left_column.each do |id|
88
90
  sticky_col_classname += "-#{id}"
89
91
  end
@@ -92,6 +94,19 @@ module Playbook
92
94
  end
93
95
  end
94
96
 
97
+ def sticky_right_column_class
98
+ if sticky_right_column.empty?
99
+ nil
100
+ else
101
+ sticky_col_classname = "sticky-right-column sticky-right-columns-ids"
102
+ sticky_right_column.each do |id|
103
+ sticky_col_classname += "-#{id}"
104
+ end
105
+
106
+ sticky_col_classname
107
+ end
108
+ end
109
+
95
110
  def striped_class
96
111
  striped ? "striped" : nil
97
112
  end
@@ -1,4 +1,23 @@
1
- <% if object.tag == "table" %>
1
+ <% if object.collapsible && object.tag == "table" %>
2
+ <%= content_tag(:tr,
3
+ aria: object.aria,
4
+ class: object.classname + " collapsible-tr",
5
+ data: object.data.merge(id: object.id),
6
+ id: object.id,
7
+ 'data-pb-table-collapsible-wrapper' => true,
8
+ **combined_html_options) do %>
9
+ <%= content.presence %>
10
+ <% end %>
11
+
12
+ <tr class="pb_table_collapsible_row">
13
+ <%= pb_rails("collapsible", props: { classname: "collapsible_border_toggle#{object.id}" + " no-border", name: "default-example", tag: "td", padding: "none" }) do %>
14
+ <%= pb_rails("flex", props: { data: { "collapsible-main": "true"} }) %>
15
+ <%= pb_rails("collapsible/collapsible_content", props: { classname: object.collapsible_side_highlight ? "table_collapsible_side_highlight" : "", padding: "none", margin: "none", id: "collapsed-toggle#{object.id}" }) do %>
16
+ <%= object.collapsible_content %>
17
+ <% end %>
18
+ <% end %>
19
+ </tr>
20
+ <% elsif object.tag == "table" %>
2
21
  <%= content_tag(:tr,
3
22
  aria: object.aria,
4
23
  class: object.classname,
@@ -8,6 +8,11 @@ module Playbook
8
8
  prop :tag, type: Playbook::Props::Enum,
9
9
  values: %w[table div],
10
10
  default: "table"
11
+ prop :collapsible, type: Playbook::Props::Boolean,
12
+ default: false
13
+ prop :collapsible_content
14
+ prop :collapsible_side_highlight, type: Playbook::Props::Boolean,
15
+ default: false
11
16
 
12
17
  def classname
13
18
  generate_classname("pb_table_row_kit", side_highlight_class) + tag_class
@@ -0,0 +1,22 @@
1
+ export const addDataTitle = () => {
2
+ const tables = document.querySelectorAll('.table-responsive-collapse');
3
+ // Each Table
4
+ [].forEach.call(tables, (table: HTMLTableElement) => {
5
+ // Header Titles
6
+ const headers: string[] = [];
7
+ [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
8
+ const colSpan = header.colSpan
9
+ for (let i = 0; i < colSpan; i++) {
10
+ headers.push(header.textContent.replace(/\r?\n|\r/, ''));
11
+ }
12
+ });
13
+ // for each row in tbody
14
+ [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
15
+ // for each cell
16
+ [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
17
+ // apply the attribute
18
+ cell.setAttribute('data-title', headers[headerIndex])
19
+ })
20
+ })
21
+ });
22
+ }
@@ -50,7 +50,7 @@ $gap_lg: $height_from_top + $space_lg;
50
50
  >div {
51
51
  &:last-child {
52
52
  flex-basis: auto !important;
53
- [class=pb_timeline_item_step] {
53
+ [class^=pb_timeline_item_step] {
54
54
  [class=pb_timeline_item_connector] {
55
55
  opacity: 0;
56
56
  }
@@ -66,29 +66,25 @@ $gap_lg: $height_from_top + $space_lg;
66
66
  [class*=pb_timeline_item_kit] {
67
67
  &[class*=_solid] {
68
68
  flex-basis: 100%;
69
- [class=pb_timeline_item_left_block] {
70
- height: 0px;
71
- }
72
- [class=pb_timeline_item_step] {
69
+ [class^=pb_timeline_item_step] {
73
70
  @include flex_wrapper(row);
71
+ align-items: center;
74
72
  margin-top: $space_xs;
75
73
  margin-bottom: $space_xs;
76
74
  [class=pb_timeline_item_connector] {
77
- @include pb_timeline_line_solid($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
75
+ @include pb_timeline_line_solid($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
78
76
  }
79
77
  }
80
78
  }
81
79
  &[class*=_dotted] {
82
80
  flex-basis: 100%;
83
- [class=pb_timeline_item_left_block] {
84
- height: 0;
85
- }
86
- [class=pb_timeline_item_step] {
81
+ [class^=pb_timeline_item_step] {
87
82
  @include flex_wrapper(row);
83
+ align-items: center;
88
84
  margin-top: $space_xs;
89
85
  margin-bottom: $space_xs;
90
86
  [class=pb_timeline_item_connector] {
91
- @include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
87
+ @include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
92
88
  }
93
89
  }
94
90
  }
@@ -99,7 +95,7 @@ $gap_lg: $height_from_top + $space_lg;
99
95
  >div {
100
96
  &:last-child {
101
97
  flex-basis: auto !important;
102
- [class=pb_timeline_item_step] {
98
+ [class^=pb_timeline_item_step] {
103
99
  [class=pb_timeline_item_connector] {
104
100
  opacity: 0;
105
101
  }
@@ -129,12 +125,12 @@ $gap_lg: $height_from_top + $space_lg;
129
125
  }
130
126
  }
131
127
  }
132
- [class=pb_timeline_item_step] {
128
+ [class^=pb_timeline_item_step] {
133
129
  @include flex_wrapper(row);
134
130
  margin-top: $space_xs;
135
131
  margin-bottom: $space_xs;
136
132
  [class=pb_timeline_item_connector] {
137
- @include pb_timeline_line_solid($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
133
+ @include pb_timeline_line_solid($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
138
134
  }
139
135
  }
140
136
  }
@@ -153,12 +149,12 @@ $gap_lg: $height_from_top + $space_lg;
153
149
  }
154
150
  }
155
151
  }
156
- [class=pb_timeline_item_step] {
152
+ [class^=pb_timeline_item_step] {
157
153
  @include flex_wrapper(row);
158
154
  margin-top: $space_xs;
159
155
  margin-bottom: $space_xs;
160
156
  [class=pb_timeline_item_connector] {
161
- @include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, $height_from_top $icon_margin 0 $icon_margin );
157
+ @include pb_timeline_line_dotted_horizontal($connector_width, $connector_width, 0 $icon_margin 0 $icon_margin );
162
158
  }
163
159
  }
164
160
  }
@@ -170,7 +166,7 @@ $gap_lg: $height_from_top + $space_lg;
170
166
  align-items: flex-start;
171
167
  align-self: auto;
172
168
  >div:last-child {
173
- [class=pb_timeline_item_step] {
169
+ [class^=pb_timeline_item_step] {
174
170
  [class=pb_timeline_item_connector] {
175
171
  opacity: 0;
176
172
  }
@@ -180,13 +176,14 @@ $gap_lg: $height_from_top + $space_lg;
180
176
  @include flex_wrapper(row);
181
177
  &[class*=_solid] {
182
178
  flex-basis: 100%;
183
- [class=pb_timeline_item_step] {
179
+ [class^=pb_timeline_item_step] {
184
180
  @include flex_wrapper(column);
181
+ align-items: center;
185
182
  align-content: flex-start;
186
183
  margin-right: $space_sm;
187
184
  margin-left: $space_sm;
188
185
  [class=pb_timeline_item_connector] {
189
- @include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
186
+ @include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
190
187
  }
191
188
  }
192
189
  [class=pb_timeline_item_left_block] {
@@ -200,12 +197,13 @@ $gap_lg: $height_from_top + $space_lg;
200
197
  }
201
198
  &[class*=_dotted] {
202
199
  flex-basis: 100%;
203
- [class=pb_timeline_item_step] {
200
+ [class^=pb_timeline_item_step] {
204
201
  @include flex_wrapper(column);
202
+ align-items: center;
205
203
  margin-right: $space_sm;
206
204
  margin-left: $space_sm;
207
205
  [class=pb_timeline_item_connector] {
208
- @include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
206
+ @include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
209
207
  }
210
208
  }
211
209
  [class=pb_timeline_item_left_block] {
@@ -223,7 +221,7 @@ $gap_lg: $height_from_top + $space_lg;
223
221
  align-items: flex-start;
224
222
  align-self: auto;
225
223
  >div:last-child {
226
- [class=pb_timeline_item_step] {
224
+ [class^=pb_timeline_item_step] {
227
225
  [class=pb_timeline_item_connector] {
228
226
  opacity: 0;
229
227
  }
@@ -233,13 +231,14 @@ $gap_lg: $height_from_top + $space_lg;
233
231
  @include flex_wrapper(row);
234
232
  &[class*=_solid] {
235
233
  flex-basis: 100%;
236
- [class=pb_timeline_item_step] {
234
+ [class^=pb_timeline_item_step] {
237
235
  @include flex_wrapper(column);
236
+ align-items: center;
238
237
  align-content: flex-start;
239
238
  margin-right: $space_sm;
240
239
  margin-left: $space_sm;
241
240
  [class=pb_timeline_item_connector] {
242
- @include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
241
+ @include pb_timeline_line_solid($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
243
242
  }
244
243
  }
245
244
  [class=pb_timeline_item_left_block] {
@@ -253,12 +252,13 @@ $gap_lg: $height_from_top + $space_lg;
253
252
  }
254
253
  &[class*=_dotted] {
255
254
  flex-basis: 100%;
256
- [class=pb_timeline_item_step] {
255
+ [class^=pb_timeline_item_step] {
257
256
  @include flex_wrapper(column);
257
+ align-items: center;
258
258
  margin-right: $space_sm;
259
259
  margin-left: $space_sm;
260
260
  [class=pb_timeline_item_connector] {
261
- @include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin $height_from_top);
261
+ @include pb_timeline_line_dotted_vertical($connector_width, $connector_width, $icon_margin 0 $icon_margin 0);
262
262
  }
263
263
  }
264
264
  [class=pb_timeline_item_left_block] {
@@ -274,7 +274,7 @@ $gap_lg: $height_from_top + $space_lg;
274
274
  }
275
275
  &[class*=_gap_xs] {
276
276
  [class*=pb_timeline_item_kit] {
277
- [class=pb_timeline_item_step] {
277
+ [class^=pb_timeline_item_step] {
278
278
  [class=pb_timeline_item_connector] {
279
279
  height: $gap_xs !important;
280
280
  }
@@ -283,7 +283,7 @@ $gap_lg: $height_from_top + $space_lg;
283
283
  }
284
284
  &[class*=_gap_sm] {
285
285
  [class*=pb_timeline_item_kit] {
286
- [class=pb_timeline_item_step] {
286
+ [class^=pb_timeline_item_step] {
287
287
  [class=pb_timeline_item_connector] {
288
288
  height: $gap_sm !important;
289
289
  }
@@ -292,7 +292,7 @@ $gap_lg: $height_from_top + $space_lg;
292
292
  }
293
293
  &[class*=_gap_md] {
294
294
  [class*=pb_timeline_item_kit] {
295
- [class=pb_timeline_item_step] {
295
+ [class^=pb_timeline_item_step] {
296
296
  [class=pb_timeline_item_connector] {
297
297
  height: $gap_md !important;
298
298
  }
@@ -301,7 +301,7 @@ $gap_lg: $height_from_top + $space_lg;
301
301
  }
302
302
  &[class*=_gap_lg] {
303
303
  [class*=pb_timeline_item_kit] {
304
- [class=pb_timeline_item_step] {
304
+ [class^=pb_timeline_item_step] {
305
305
  [class=pb_timeline_item_connector] {
306
306
  height: $gap_lg !important;
307
307
  }