playbook_ui 14.12.0.pre.alpha.testingwithfas5689 → 14.12.0.pre.rc.0
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +2 -18
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +5 -27
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +2 -17
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -23
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -29
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +4 -61
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +8 -13
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -15
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +11 -11
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +3 -12
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +0 -9
- data/app/pb_kits/playbook/pb_button/button.html.erb +3 -2
- data/app/pb_kits/playbook/pb_button/button.rb +1 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +2 -21
- data/app/pb_kits/playbook/pb_card/card.rb +0 -7
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +6 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
- data/app/pb_kits/playbook/pb_collapsible/collapsible.html.erb +1 -3
- data/app/pb_kits/playbook/pb_collapsible/collapsible.rb +0 -3
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +16 -24
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +2 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default_date.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +3 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +9 -3
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +183 -145
- data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +268 -158
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +45 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +16 -9
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +19 -44
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +3 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +21 -16
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +19 -2
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_drawer/drawer.test.jsx +5 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +12 -7
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +14 -9
- data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +11 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +14 -8
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +2 -2
- data/app/pb_kits/playbook/pb_icon/icon.test.js +8 -8
- data/app/pb_kits/playbook/pb_list/item.html.erb +8 -30
- data/app/pb_kits/playbook/pb_list/item.rb +0 -7
- data/app/pb_kits/playbook/pb_list/list.html.erb +11 -31
- data/app/pb_kits/playbook/pb_list/list.rb +0 -4
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -6
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +0 -4
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +0 -1
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +12 -30
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +1 -20
- data/app/pb_kits/playbook/pb_radio/_radio.scss +8 -12
- data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.jsx +3 -8
- data/app/pb_kits/playbook/pb_select/_select.scss +5 -3
- data/app/pb_kits/playbook/pb_select/_select.tsx +1 -5
- data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +1 -9
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +1 -4
- data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +1 -4
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.html.erb +3 -17
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list.rb +0 -3
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.html.erb +4 -11
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +0 -3
- data/app/pb_kits/playbook/pb_table/_table.tsx +3 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +8 -12
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_table/index.ts +88 -187
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -12
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +5 -6
- data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_table/table.rb +2 -17
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +1 -20
- data/app/pb_kits/playbook/pb_table/table_row.rb +0 -5
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +0 -4
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +3 -33
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +30 -30
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +2 -3
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -12
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +1 -5
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +3 -8
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -21
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -13
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -7
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/dist/chunks/_typeahead-C2iCBqxQ.js +36 -0
- data/dist/chunks/_weekday_stacked-CWnbnW7m.js +45 -0
- data/dist/chunks/{lib-RmkltInK.js → lib-B7sgJtGS.js} +2 -2
- data/dist/chunks/{pb_form_validation-Bu-zi4X-.js → pb_form_validation-C5Cc0-1v.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +0 -6
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +11 -75
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_no_subrows.jsx +0 -50
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.html.erb +0 -38
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows.md +0 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.jsx +0 -78
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.jsx +0 -53
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.jsx +0 -52
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_no_subrows.json +0 -42
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_with_id.json +0 -299
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames.html.erb +0 -13
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_turbo_frames_rails.md +0 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +0 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.html.erb +0 -38
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +0 -3
- data/app/pb_kits/playbook/pb_drawer/context.ts +0 -11
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +0 -38
- data/app/pb_kits/playbook/pb_drawer/hooks/useBreakpoint.tsx +0 -60
- data/app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx +0 -21
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.scss +0 -78
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +0 -3
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +0 -16
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +0 -22
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.html.erb +0 -15
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.jsx +0 -24
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_format.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.html.erb +0 -74
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.html.erb +0 -74
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md +0 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content_rails.md +0 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.html.erb +0 -52
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb +0 -80
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +0 -1
- data/app/pb_kits/playbook/pb_table/utilities/addDataTitle.ts +0 -22
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +0 -46
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask_rails.md +0 -3
- data/app/pb_kits/playbook/pb_text_input/index.js +0 -103
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +0 -19
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +0 -27
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md +0 -1
- data/dist/chunks/_typeahead-BDhvNf6A.js +0 -36
- data/dist/chunks/_weekday_stacked-BhU_44Uo.js +0 -45
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_table_props_react.md → _advanced_table_table_props.md} +0 -0
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_react.md → _table_with_collapsible.md} +0 -0
@@ -8,31 +8,27 @@ const TableWithCollapsibleWithCustomContent = (props) => {
|
|
8
8
|
<Card
|
9
9
|
borderNone
|
10
10
|
borderRadius="none"
|
11
|
-
color="light"
|
11
|
+
color="light"
|
12
12
|
paddingX="xl"
|
13
13
|
paddingY="md"
|
14
14
|
{...props}
|
15
15
|
>
|
16
|
-
<Body paddingBottom="sm"
|
16
|
+
<Body paddingBottom="sm"
|
17
17
|
text="Expanded Custom Layout"
|
18
18
|
{...props}
|
19
19
|
/>
|
20
20
|
<Flex justify="between">
|
21
21
|
<Image
|
22
|
-
|
23
|
-
url="https://unsplash.it/500/400/?image=634"
|
22
|
+
url="https://via.placeholder.com/150"
|
24
23
|
/>
|
25
24
|
<Image
|
26
|
-
|
27
|
-
url="https://unsplash.it/500/400/?image=634"
|
25
|
+
url="https://via.placeholder.com/150"
|
28
26
|
/>
|
29
27
|
<Image
|
30
|
-
|
31
|
-
url="https://unsplash.it/500/400/?image=634"
|
28
|
+
url="https://via.placeholder.com/150"
|
32
29
|
/>
|
33
30
|
<Image
|
34
|
-
|
35
|
-
url="https://unsplash.it/500/400/?image=634"
|
31
|
+
url="https://via.placeholder.com/150"
|
36
32
|
/>
|
37
33
|
</Flex>
|
38
34
|
</Card>
|
@@ -56,7 +52,7 @@ const TableWithCollapsibleWithCustomContent = (props) => {
|
|
56
52
|
|
57
53
|
</Table.Head>
|
58
54
|
<Table.Body>
|
59
|
-
<Table.Row collapsible
|
55
|
+
<Table.Row collapsible
|
60
56
|
collapsibleContent={<Content/>}
|
61
57
|
{...props}
|
62
58
|
>
|
@@ -65,7 +61,7 @@ const TableWithCollapsibleWithCustomContent = (props) => {
|
|
65
61
|
<Table.Cell>{'Value 3'}</Table.Cell>
|
66
62
|
<Table.Cell>{'Value 4'}</Table.Cell>
|
67
63
|
<Table.Cell>{'Value 5'}</Table.Cell>
|
68
|
-
<Table.Cell textAlign="right">{
|
64
|
+
<Table.Cell textAlign="right">{
|
69
65
|
<Icon
|
70
66
|
color="primary"
|
71
67
|
fixedWidth
|
@@ -5,8 +5,6 @@ examples:
|
|
5
5
|
- table_lg: Large
|
6
6
|
- table_sticky: Sticky Header
|
7
7
|
- table_sticky_left_columns: Sticky Left Column
|
8
|
-
- table_sticky_right_columns: Sticky Right Column
|
9
|
-
- table_sticky_columns: Sticky Left and Right Columns
|
10
8
|
- table_header: Table Header
|
11
9
|
- table_alignment_row_rails: Row Alignment
|
12
10
|
- table_alignment_column_rails: Cell Alignment
|
@@ -30,10 +28,6 @@ examples:
|
|
30
28
|
- table_with_subcomponents_rails: Table with Sub Components (Table Elements)
|
31
29
|
- table_with_subcomponents_as_divs: Table with Sub Components (Divs)
|
32
30
|
- table_outer_padding: Outer Padding
|
33
|
-
- table_with_collapsible: Table with Collapsible
|
34
|
-
- table_with_collapsible_with_custom_content_rails: Table with Collapsible with Custom Content
|
35
|
-
- table_with_collapsible_with_nested_rows_rails: Table with Collapsible with Nested Rows
|
36
|
-
- table_with_collapsible_with_nested_table_rails: Table with Collapsible with Nested Table
|
37
31
|
|
38
32
|
react:
|
39
33
|
- table_sm: Small
|
@@ -1,207 +1,108 @@
|
|
1
1
|
import PbEnhancedElement from '../pb_enhanced_element'
|
2
2
|
|
3
|
-
const TABLE_WRAPPER_SELECTOR = "[data-pb-table-wrapper]";
|
4
|
-
const TABLE_COLLAPSIBLE_WRAPPER_SELECTOR = "[data-pb-table-collapsible-wrapper]";
|
5
|
-
|
6
3
|
export default class PbTable extends PbEnhancedElement {
|
7
|
-
|
8
|
-
|
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
|
-
}
|
24
|
-
});
|
25
|
-
|
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
|
-
})
|
31
|
-
}
|
4
|
+
private stickyLeftColumns: string[] = [];
|
5
|
+
private handleStickyLeftColumnsRef: () => void;
|
32
6
|
|
33
|
-
|
34
|
-
|
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);
|
56
|
-
}
|
57
|
-
}
|
7
|
+
static get selector(): string {
|
8
|
+
return '.table-responsive-collapse'
|
58
9
|
}
|
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
|
-
}
|
80
10
|
|
81
|
-
|
82
|
-
|
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
|
+
})
|
31
|
+
});
|
83
32
|
|
84
|
-
|
85
|
-
|
86
|
-
|
33
|
+
// New sticky columns logic
|
34
|
+
this.initStickyLeftColumns();
|
35
|
+
}
|
87
36
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
+
}
|
94
60
|
}
|
95
61
|
});
|
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
62
|
}
|
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
63
|
|
142
|
-
|
143
|
-
|
64
|
+
private handleStickyLeftColumns(): void {
|
65
|
+
let accumulatedWidth = 0;
|
144
66
|
|
145
|
-
|
146
|
-
|
147
|
-
|
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}"]`);
|
148
71
|
|
149
|
-
if (
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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');
|
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;
|
72
|
+
if (header) {
|
73
|
+
header.classList.add('sticky');
|
74
|
+
(header as HTMLElement).style.left = `${accumulatedWidth}px`;
|
75
|
+
|
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');
|
189
82
|
}
|
190
|
-
|
191
|
-
|
83
|
+
|
84
|
+
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
192
85
|
}
|
193
|
-
});
|
194
|
-
}
|
195
|
-
}
|
196
86
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
87
|
+
cells.forEach((cell) => {
|
88
|
+
cell.classList.add('sticky');
|
89
|
+
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
90
|
+
|
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
|
+
}
|
98
|
+
});
|
99
|
+
});
|
201
100
|
}
|
202
101
|
|
203
|
-
|
204
|
-
|
102
|
+
// Cleanup method to remove event listener
|
103
|
+
disconnect(): void {
|
104
|
+
if (this.handleStickyLeftColumnsRef) {
|
105
|
+
window.removeEventListener('resize', this.handleStickyLeftColumnsRef);
|
106
|
+
}
|
205
107
|
}
|
206
|
-
|
207
|
-
}
|
108
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
@import "../../tokens/screen_sizes";
|
2
|
-
@import "../../tokens/border_radius";
|
3
2
|
|
4
3
|
.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,12 +27,11 @@
|
|
27
27
|
// Responsive Styles
|
28
28
|
@media (max-width: 1600px) {
|
29
29
|
&[class*="table-responsive-scroll"] {
|
30
|
-
|
31
|
-
|
32
|
-
box-shadow: 1px 0 0 0px $border_light,
|
30
|
+
border-radius: 4px;
|
31
|
+
box-shadow: 1px 0 0 0px $border_light,
|
33
32
|
-1px 0 0 0px $border_light
|
34
|
-
|
35
|
-
|
33
|
+
}
|
34
|
+
|
36
35
|
&[class^=pb_table].table-sm.table-card thead tr th:first-child,
|
37
36
|
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
|
38
37
|
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
|
7
|
+
<%= content_tag(:div, class: responsive_class) do %>
|
8
8
|
<% if object.tag == "table" %>
|
9
9
|
<%= content_tag(:table,
|
10
10
|
aria: object.aria,
|
@@ -25,8 +25,6 @@ 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: []
|
30
28
|
prop :vertical_border, type: Playbook::Props::Boolean,
|
31
29
|
default: false
|
32
30
|
prop :striped, type: Playbook::Props::Boolean,
|
@@ -42,7 +40,7 @@ module Playbook
|
|
42
40
|
generate_classname(
|
43
41
|
"pb_table", "table-#{size}", single_line_class, dark_class,
|
44
42
|
disable_hover_class, container_class, data_table_class, sticky_class, sticky_left_column_class,
|
45
|
-
|
43
|
+
collapse_class, vertical_border_class, striped_class, outer_padding_class,
|
46
44
|
"table-responsive-#{responsive}", separator: " "
|
47
45
|
)
|
48
46
|
end
|
@@ -85,7 +83,7 @@ module Playbook
|
|
85
83
|
if sticky_left_column.empty?
|
86
84
|
nil
|
87
85
|
else
|
88
|
-
sticky_col_classname = "sticky-left-column sticky-
|
86
|
+
sticky_col_classname = "sticky-left-column sticky-columns"
|
89
87
|
sticky_left_column.each do |id|
|
90
88
|
sticky_col_classname += "-#{id}"
|
91
89
|
end
|
@@ -94,19 +92,6 @@ module Playbook
|
|
94
92
|
end
|
95
93
|
end
|
96
94
|
|
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
|
-
|
110
95
|
def striped_class
|
111
96
|
striped ? "striped" : nil
|
112
97
|
end
|
@@ -1,23 +1,4 @@
|
|
1
|
-
<% if object.
|
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" %>
|
1
|
+
<% if object.tag == "table" %>
|
21
2
|
<%= content_tag(:tr,
|
22
3
|
aria: object.aria,
|
23
4
|
class: object.classname,
|
@@ -8,11 +8,6 @@ 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: true
|
16
11
|
|
17
12
|
def classname
|
18
13
|
generate_classname("pb_table_row_kit", side_highlight_class) + tag_class
|
@@ -8,7 +8,6 @@ examples:
|
|
8
8
|
- text_input_inline: Inline
|
9
9
|
- text_input_no_label: No Label
|
10
10
|
- text_input_options: Input Options
|
11
|
-
- text_input_mask: Mask
|
12
11
|
react:
|
13
12
|
- text_input_default: Default
|
14
13
|
- text_input_error: With Error
|
@@ -24,4 +23,4 @@ examples:
|
|
24
23
|
- text_input_error_swift: With Error
|
25
24
|
- text_input_disabled_swift: Disabled
|
26
25
|
- text_input_add_on_swift: Add On
|
27
|
-
- text_input_props_swift: ""
|
26
|
+
- text_input_props_swift: ""
|
@@ -13,13 +13,9 @@
|
|
13
13
|
<%= pb_rails("text_input/add_on", props: object.add_on_props) do %>
|
14
14
|
<%= input_tag %>
|
15
15
|
<% end %>
|
16
|
-
<% elsif mask.present? %>
|
17
|
-
<%= input_tag %>
|
18
|
-
<%= tag(:input, data: "sanitized-pb-input", id: sanitized_id, name: object.name, style: "display: none;") %>
|
19
16
|
<% else %>
|
20
17
|
<%= input_tag %>
|
21
18
|
<% end %>
|
22
19
|
<%= pb_rails("body", props: {dark: object.dark, status: "negative", text: object.error}) if object.error %>
|
23
20
|
<% end %>
|
24
21
|
<% end %>
|
25
|
-
|
@@ -4,15 +4,6 @@
|
|
4
4
|
module Playbook
|
5
5
|
module PbTextInput
|
6
6
|
class TextInput < Playbook::KitBase
|
7
|
-
VALID_MASKS = %w[currency zipCode postalCode ssn].freeze
|
8
|
-
|
9
|
-
MASK_PATTERNS = {
|
10
|
-
"currency" => '^\$\d{1,3}(?:,\d{3})*(?:\.\d{2})?$',
|
11
|
-
"zip_code" => '\d{5}',
|
12
|
-
"postal_code" => '\d{5}-\d{4}',
|
13
|
-
"ssn" => '\d{3}-\d{2}-\d{4}',
|
14
|
-
}.freeze
|
15
|
-
|
16
7
|
prop :autocomplete, type: Playbook::Props::Boolean,
|
17
8
|
default: true
|
18
9
|
prop :disabled, type: Playbook::Props::Boolean,
|
@@ -34,9 +25,6 @@ module Playbook
|
|
34
25
|
prop :add_on, type: Playbook::Props::NestedProps,
|
35
26
|
nested_kit: Playbook::PbTextInput::AddOn
|
36
27
|
|
37
|
-
prop :mask, type: Playbook::Props::String,
|
38
|
-
default: nil
|
39
|
-
|
40
28
|
def classname
|
41
29
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
42
30
|
generate_classname("pb_text_input_kit") + default_margin_bottom + error_class + inline_class
|
@@ -58,10 +46,6 @@ module Playbook
|
|
58
46
|
{ dark: dark }.merge(add_on || {})
|
59
47
|
end
|
60
48
|
|
61
|
-
def sanitized_id
|
62
|
-
"#{object.id}-sanitized" if id.present?
|
63
|
-
end
|
64
|
-
|
65
49
|
private
|
66
50
|
|
67
51
|
def all_input_options
|
@@ -71,13 +55,12 @@ module Playbook
|
|
71
55
|
data: validation_data,
|
72
56
|
disabled: disabled,
|
73
57
|
id: input_options.dig(:id) || id,
|
74
|
-
name:
|
75
|
-
pattern: validation_pattern
|
58
|
+
name: name,
|
59
|
+
pattern: validation_pattern,
|
76
60
|
placeholder: placeholder,
|
77
61
|
required: required,
|
78
62
|
type: type,
|
79
63
|
value: value,
|
80
|
-
mask: mask,
|
81
64
|
}.merge(input_options)
|
82
65
|
end
|
83
66
|
|
@@ -92,7 +75,7 @@ module Playbook
|
|
92
75
|
def validation_data
|
93
76
|
fields = input_options.dig(:data) || {}
|
94
77
|
fields[:message] = validation_message unless validation_message.blank?
|
95
|
-
|
78
|
+
fields
|
96
79
|
end
|
97
80
|
|
98
81
|
def error_class
|
@@ -102,19 +85,6 @@ module Playbook
|
|
102
85
|
def inline_class
|
103
86
|
inline ? " inline" : ""
|
104
87
|
end
|
105
|
-
|
106
|
-
def mask_data
|
107
|
-
return {} unless mask
|
108
|
-
raise ArgumentError, "mask must be one of: #{VALID_MASKS.join(', ')}" unless VALID_MASKS.include?(mask)
|
109
|
-
|
110
|
-
{ mask: mask }
|
111
|
-
end
|
112
|
-
|
113
|
-
def mask_pattern
|
114
|
-
return nil unless mask
|
115
|
-
|
116
|
-
MASK_PATTERNS[mask]
|
117
|
-
end
|
118
88
|
end
|
119
89
|
end
|
120
90
|
end
|