playbook_ui 14.16.0 → 14.17.0.pre.alpha.play1499backgroundkitoverlay7105
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/pb_advanced_table/Utilities/types.ts +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +104 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +168 -85
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +10 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +20 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.jsx +90 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_fullscreen.md +3 -0
- 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_selectable_rows.html.erb +39 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb +33 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +19 -9
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +38 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +49 -37
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +39 -0
- data/app/pb_kits/playbook/pb_background/_background.scss +26 -0
- data/app/pb_kits/playbook/pb_background/_background.tsx +8 -4
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.jsx +36 -0
- data/app/pb_kits/playbook/pb_background/docs/_background_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_background/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +5 -5
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +14 -7
- data/app/pb_kits/playbook/pb_contact/contact.test.js +7 -7
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +34 -34
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.html.erb +0 -11
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_inline.jsx +0 -7
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss +28 -24
- data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/date_range_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +58 -17
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +8 -8
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +3 -3
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +3 -4
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +2 -3
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +22 -0
- data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -9
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_value/label_value.test.js +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.scss +58 -0
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +20 -7
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.jsx +190 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_bracket.md +5 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/layout.test.js +4 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_game.tsx +90 -0
- data/app/pb_kits/playbook/pb_layout/subcomponents/_round.tsx +57 -0
- data/app/pb_kits/playbook/pb_lightbox/hooks/useVisibility.js +1 -1
- data/app/pb_kits/playbook/pb_link/link.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +2 -1
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +5 -3
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +29 -11
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.html.erb +4 -4
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +2 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical.md +1 -0
- data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +8 -4
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless.jsx +50 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_borderless_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating.jsx +59 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_header_style_floating_react.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_table/styles/_headers.scss +76 -0
- data/app/pb_kits/playbook/pb_table/styles/_striped.scss +3 -3
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +11 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/table.test.js +17 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +183 -56
- data/app/pb_kits/playbook/pb_tooltip/tooltip.html.erb +2 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +4 -4
- data/app/pb_kits/playbook/pb_typeahead/index.ts +2 -2
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -6
- data/app/pb_kits/playbook/pb_user_badge/user_badge.html.erb +1 -6
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/app/pb_kits/playbook/utilities/object.test.js +149 -1
- data/app/pb_kits/playbook/utilities/object.ts +124 -42
- data/dist/chunks/_typeahead-ySWHB-7p.js +22 -0
- data/dist/chunks/_weekday_stacked-36N8xzXL.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-DMajaRt3.js → pb_form_validation-BvNy9Bd6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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/kit_base.rb +4 -4
- data/lib/playbook/version.rb +2 -2
- metadata +26 -10
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/dist/chunks/_typeahead-BuTZG1Jn.js +0 -22
- data/dist/chunks/_weekday_stacked-oT22q75-.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
- data/dist/chunks/lib-Co5y3V4K.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows_no_subrows.md → _advanced_table_selectable_rows_no_subrows_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_selectable_rows.md → _advanced_table_selectable_rows_react.md} +0 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
]
|
32
|
+
|
33
|
+
subrow_headers = ["Quarter", "Month", "Day"]
|
34
|
+
%>
|
35
|
+
|
36
|
+
<%= pb_rails("advanced_table", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, selectable_rows: true }) do %>
|
37
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions, selectable_rows: true }) %>
|
38
|
+
<%= pb_rails("advanced_table/table_body", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all", selectable_rows: true }) %>
|
39
|
+
<% end %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows.html.erb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
<% column_definitions = [
|
2
|
+
{
|
3
|
+
accessor: "year",
|
4
|
+
label: "Year",
|
5
|
+
cellAccessors: ["quarter", "month", "day"],
|
6
|
+
},
|
7
|
+
{
|
8
|
+
accessor: "newEnrollments",
|
9
|
+
label: "New Enrollments",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
accessor: "scheduledMeetings",
|
13
|
+
label: "Scheduled Meetings",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
accessor: "attendanceRate",
|
17
|
+
label: "Attendance Rate",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
accessor: "completedClasses",
|
21
|
+
label: "Completed Classes",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "classCompletionRate",
|
25
|
+
label: "Class Completion Rate",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
accessor: "graduatedStudents",
|
29
|
+
label: "Graduated Students",
|
30
|
+
}
|
31
|
+
] %>
|
32
|
+
|
33
|
+
<%= pb_rails("advanced_table", props: { id: "selectable_rows_no_subrows", table_data: @table_data_no_subrows, column_definitions: column_definitions, selectable_rows: true, enable_toggle_expansion: "none", }) %>
|
data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_no_subrows_rails.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
`selectable_rows` can also be used with tables without nested row data. Set `enable_toggle_expansion: none` to adjust the Advanced Table styling to fit a table without subrows.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
`selectable_rows` is a boolean prop that if present will add checkboxes to all rows that will allow for selecting rows.
|
2
|
+
|
3
|
+
When a parent row is clicked, it will check all nested children rows, Children rows can be manually checked or unchecked as well.
|
4
|
+
|
5
|
+
__ALERT TO DEVS__: UPDATE THIS PARAGRAPH IN THE FOLLOW UP STORY WHEN CHECKBOX FUNCTIONALITY IS SET PLEASE
|
6
|
+
The `onRowSelectionChange` prop returns an array of ids of all Rows that have been selected. Open the console on this example and check and uncheck checkboxes to see this is action! __NOTE__: Each object within the `tableData`Array must contain a unique id in order to attach an id to all Rows for this to function.
|
@@ -11,6 +11,8 @@ examples:
|
|
11
11
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
12
12
|
- advanced_table_column_headers: Multi-Header Columns
|
13
13
|
- advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
|
14
|
+
# - advanced_table_selectable_rows: Selectable Rows
|
15
|
+
# - advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
14
16
|
|
15
17
|
|
16
18
|
react:
|
@@ -37,4 +39,5 @@ examples:
|
|
37
39
|
- advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
38
40
|
- advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
|
39
41
|
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
40
|
-
- advanced_table_inline_editing: Inline Cell Editing
|
42
|
+
- advanced_table_inline_editing: Inline Cell Editing
|
43
|
+
- advanced_table_fullscreen: Fullscreen
|
@@ -21,4 +21,5 @@ export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_
|
|
21
21
|
export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
|
22
22
|
export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
|
23
23
|
export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
|
24
|
-
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
24
|
+
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
25
|
+
export { default as AdvancedTableFullscreen } from './_advanced_table_fullscreen.jsx'
|
@@ -21,6 +21,8 @@ module Playbook
|
|
21
21
|
prop :responsive, type: Playbook::Props::Enum,
|
22
22
|
values: %w[none scroll],
|
23
23
|
default: "scroll"
|
24
|
+
prop :selectable_rows, type: Playbook::Props::Boolean,
|
25
|
+
default: false
|
24
26
|
|
25
27
|
def flatten_columns(columns)
|
26
28
|
columns.flat_map do |col|
|
@@ -56,7 +58,7 @@ module Playbook
|
|
56
58
|
current_data_attributes = current_depth.zero? ? { row_depth: 0 } : table_data_attributes
|
57
59
|
|
58
60
|
# Additional class and data attributes needed for toggle logic
|
59
|
-
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading })
|
61
|
+
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: leaf_columns, depth: current_depth, collapsible_trail: collapsible_trail, classname: additional_classes, table_data_attributes: current_data_attributes, responsive: responsive, loading: loading, selectable_rows: selectable_rows, row_id: row[:id], enable_toggle_expansion: enable_toggle_expansion })
|
60
62
|
|
61
63
|
if row[:children].present?
|
62
64
|
row[:children].each do |child_row|
|
@@ -81,7 +83,7 @@ module Playbook
|
|
81
83
|
def classname
|
82
84
|
additional_classes = []
|
83
85
|
additional_classes << "advanced-table-responsive-#{responsive} pinned-left" if responsive == "scroll"
|
84
|
-
|
86
|
+
additional_classes << "selectable-rows-enabled" if selectable_rows && enable_toggle_expansion == "none"
|
85
87
|
generate_classname("pb_advanced_table_body", *additional_classes, separator: " ")
|
86
88
|
end
|
87
89
|
|
@@ -1,19 +1,29 @@
|
|
1
1
|
<%= pb_content_tag(:thead) do %>
|
2
2
|
<% object.header_rows.each_with_index do |header_row, row_index| %>
|
3
3
|
<%= pb_rails("table/table_row") do %>
|
4
|
+
<% if row_index == 0 && object.selectable_rows && object.enable_toggle_expansion == "none" %>
|
5
|
+
<%= object.render_select_all_header %>
|
6
|
+
<% end %>
|
4
7
|
<% header_row.each_with_index do |cell, cell_index| %>
|
5
8
|
<% header_id = cell[:accessor].present? ? cell[:accessor] : "header_#{row_index}_#{cell_index}" %>
|
6
9
|
<%= pb_rails("table/table_header", props: { id: header_id, colspan: cell[:colspan], classname: [object.th_classname(is_first_column: cell_index.zero?), ('last-header-cell' if cell[:is_last_in_group] && cell_index != 0)].compact.join(' '), sort_menu: cell[:accessor] ? cell[:sort_menu] : nil }) do %>
|
7
10
|
<%= pb_rails("flex", props: { align: "center", justify: cell_index.zero? ? "start" : row_index === header_rows.size - 1 ? "end" : "center", text_align: "end" }) do %>
|
8
|
-
<% if cell_index.zero? &&
|
9
|
-
<% if
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
<% if cell_index.zero? && row_index === header_rows.size - 1 %>
|
12
|
+
<% if object.selectable_rows && object.enable_toggle_expansion != "none" %>
|
13
|
+
<%= pb_rails("flex/flex_item", props: { padding_right: "xs" }) do %>
|
14
|
+
<%= object.render_select_all_checkbox %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
<% if object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all" %>
|
18
|
+
<% if loading %>
|
19
|
+
<div class="<%= object.loading ? 'loading-toggle-icon' : '' %>"></div>
|
20
|
+
<% else %>
|
21
|
+
<button
|
22
|
+
class="gray-icon toggle-all-icon"
|
23
|
+
onclick="expandAllRows(this); event.preventDefault();">
|
24
|
+
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
|
25
|
+
</button>
|
26
|
+
<% end %>
|
17
27
|
<% end %>
|
18
28
|
<% end %>
|
19
29
|
<%= cell[:label] %>
|
@@ -13,17 +13,20 @@ module Playbook
|
|
13
13
|
prop :responsive, type: Playbook::Props::Enum,
|
14
14
|
values: %w[none scroll],
|
15
15
|
default: "scroll"
|
16
|
+
prop :selectable_rows, type: Playbook::Props::Boolean,
|
17
|
+
default: false
|
16
18
|
|
17
19
|
def classname
|
18
20
|
additional_classes = []
|
19
21
|
additional_classes << "advanced-table-responsive-#{responsive} pinned-left" if responsive == "scroll"
|
22
|
+
additional_classes << "selectable-rows-enabled" if selectable_rows && enable_toggle_expansion == "none"
|
20
23
|
|
21
24
|
generate_classname("pb_advanced_table_header", "pb_table_thead", *additional_classes, separator: " ")
|
22
25
|
end
|
23
26
|
|
24
27
|
def th_classname(is_first_column: false)
|
25
28
|
additional_classes = []
|
26
|
-
additional_classes << "pinned-left" if is_first_column && responsive == "scroll"
|
29
|
+
additional_classes << "pinned-left" if is_first_column && responsive == "scroll" && !selectable_rows
|
27
30
|
|
28
31
|
generate_classname("table-header-cells", *additional_classes, separator: " ")
|
29
32
|
end
|
@@ -38,6 +41,40 @@ module Playbook
|
|
38
41
|
rows
|
39
42
|
end
|
40
43
|
|
44
|
+
# Selectable Rows No Subrows - checkboxes in their own first cell
|
45
|
+
def render_select_all_header
|
46
|
+
if selectable_rows
|
47
|
+
additional_classes = []
|
48
|
+
additional_classes << "table-header-cells-custom"
|
49
|
+
additional_classes << "checkbox-cell-header"
|
50
|
+
additional_classes << "pinned-left" if responsive == "scroll"
|
51
|
+
pb_rails("table/table_header", props: {
|
52
|
+
classname: additional_classes.join(" "),
|
53
|
+
}) do
|
54
|
+
pb_rails("checkbox", props: {
|
55
|
+
id: "select-all-rows",
|
56
|
+
name: "select-all-rows",
|
57
|
+
data: {
|
58
|
+
action: "click->pb-advanced-table#toggleAllRowSelection",
|
59
|
+
},
|
60
|
+
})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Selectable Rows w/ Subrows - checkboxes part of toggleable first cell
|
66
|
+
def render_select_all_checkbox
|
67
|
+
if selectable_rows
|
68
|
+
pb_rails("checkbox", props: {
|
69
|
+
id: "select-all-rows",
|
70
|
+
name: "select-all-rows",
|
71
|
+
data: {
|
72
|
+
action: "click->pb-advanced-table#toggleAllRowSelection",
|
73
|
+
},
|
74
|
+
})
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
41
78
|
private
|
42
79
|
|
43
80
|
def compute_max_depth(columns)
|
@@ -1,48 +1,60 @@
|
|
1
1
|
<%= pb_content_tag(:tr) do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
<% has_separate_checkbox = object.selectable_rows && object.enable_toggle_expansion == "none" %>
|
3
|
+
<% if has_separate_checkbox %>
|
4
|
+
<%= object.render_checkbox_cell %>
|
5
|
+
<% end %>
|
6
|
+
<% object.column_definitions.each_with_index do |column, index| %>
|
7
|
+
<% next unless column[:accessor].present? %>
|
8
|
+
<%= pb_rails("table/table_cell", props: { classname:object.td_classname(column, index)}) do %>
|
9
|
+
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", classname: object.loading ? "loading-cell" : "" }) do %>
|
10
|
+
<% if collapsible_trail && index.zero? %>
|
11
|
+
<% (1..depth).each do |i| %>
|
12
|
+
<% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
|
13
|
+
<% left_offset = i * 1.0 + additional_offset %>
|
14
|
+
<div class="collapsible-trail" style="left: <%= left_offset %>em"></div>
|
12
15
|
<% end %>
|
16
|
+
<% end %>
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
|
23
|
-
</button>
|
18
|
+
<div style="padding-left: <%= depth * 1.25 %>em">
|
19
|
+
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
20
|
+
<% if index.zero? %>
|
21
|
+
<% has_integrated_checkbox = object.selectable_rows && object.enable_toggle_expansion != "none" %>
|
22
|
+
<% if has_integrated_checkbox %>
|
23
|
+
<%= pb_rails("flex/flex_item", props: { padding_right: "xs" }) do %>
|
24
|
+
<%= object.render_row_checkbox %>
|
25
|
+
<% end %>
|
24
26
|
<% end %>
|
25
|
-
|
26
|
-
|
27
|
-
<%=
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
<% if object.row[:children].present? %>
|
28
|
+
<button
|
29
|
+
id="<%= "#{object.id}_#{object.row.object_id}" %>"
|
30
|
+
class="gray-icon expand-toggle-icon"
|
31
|
+
data-advanced-table="true">
|
32
|
+
<%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
|
33
|
+
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
|
34
|
+
</button>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
37
|
+
<%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && (object.row[:children].present? || has_integrated_checkbox) ? "none" : "xs"}) do %>
|
38
|
+
<% if column[:custom_renderer].present? %>
|
39
|
+
<%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
|
40
|
+
<% elsif index.zero? %>
|
41
|
+
<% if object.depth.zero? %>
|
42
|
+
<%= object.row[column[:accessor].to_sym] %>
|
43
|
+
<% else %>
|
44
|
+
<% object.depth_accessors.each_with_index do |item, accessor_index| %>
|
45
|
+
<% if object.depth - 1 == accessor_index %>
|
46
|
+
<% key = item.to_sym %>
|
47
|
+
<%= object.row[key] %>
|
37
48
|
<% end %>
|
38
49
|
<% end %>
|
39
|
-
<% else %>
|
40
|
-
<%= object.row[column[:accessor].to_sym] %>
|
41
50
|
<% end %>
|
51
|
+
<% else %>
|
52
|
+
<%= object.row[column[:accessor].to_sym] %>
|
42
53
|
<% end %>
|
43
54
|
<% end %>
|
44
|
-
|
45
|
-
|
55
|
+
<% end %>
|
56
|
+
</div>
|
46
57
|
<% end %>
|
47
58
|
<% end %>
|
48
|
-
<% end %>
|
59
|
+
<% end %>
|
60
|
+
<% end %>
|
@@ -20,6 +20,13 @@ module Playbook
|
|
20
20
|
default: "scroll"
|
21
21
|
prop :is_pinned_left, type: Playbook::Props::Boolean,
|
22
22
|
default: false
|
23
|
+
prop :selectable_rows, type: Playbook::Props::Boolean,
|
24
|
+
default: false
|
25
|
+
prop :row_id, type: Playbook::Props::String,
|
26
|
+
default: ""
|
27
|
+
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
28
|
+
values: %w[all header none],
|
29
|
+
default: "header"
|
23
30
|
|
24
31
|
def data
|
25
32
|
Hash(prop(:data)).merge(table_data_attributes)
|
@@ -42,6 +49,38 @@ module Playbook
|
|
42
49
|
end.compact
|
43
50
|
end
|
44
51
|
|
52
|
+
# Selectable Rows No Subrows - checkboxes in their own first cell
|
53
|
+
def render_checkbox_cell
|
54
|
+
if selectable_rows
|
55
|
+
pb_rails("table/table_cell", props: {
|
56
|
+
classname: "checkbox-cell",
|
57
|
+
}) do
|
58
|
+
pb_rails("checkbox", props: {
|
59
|
+
id: "select-row-#{row_id || row.object_id}",
|
60
|
+
name: "select-row-#{row_id || row.object_id}",
|
61
|
+
data: {
|
62
|
+
row_id: row_id || row.object_id.to_s,
|
63
|
+
action: "click->pb-advanced-table#toggleRowSelection",
|
64
|
+
},
|
65
|
+
})
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Selectable Rows w/ Subrows - checkboxes part of toggleable first cell
|
71
|
+
def render_row_checkbox
|
72
|
+
if selectable_rows
|
73
|
+
pb_rails("checkbox", props: {
|
74
|
+
id: "select-row-#{row_id || row.object_id}",
|
75
|
+
name: "select-row-#{row_id || row.object_id}",
|
76
|
+
data: {
|
77
|
+
row_id: row_id || row.object_id.to_s,
|
78
|
+
action: "click->pb-advanced-table#toggleRowSelection",
|
79
|
+
},
|
80
|
+
})
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
45
84
|
private
|
46
85
|
|
47
86
|
def custom_renderer_value(column, index)
|
@@ -55,4 +55,30 @@ $background_colors: map-merge($additional_colors, $merge_kits7);
|
|
55
55
|
transition: 700ms ease-in;
|
56
56
|
}
|
57
57
|
}
|
58
|
+
|
59
|
+
&.imageoverlay {
|
60
|
+
position: relative;
|
61
|
+
|
62
|
+
&:before {
|
63
|
+
content: "";
|
64
|
+
position: absolute;
|
65
|
+
top: 0;
|
66
|
+
left: 0;
|
67
|
+
right: 0;
|
68
|
+
bottom: 0;
|
69
|
+
z-index: 1;
|
70
|
+
background-color: inherit;
|
71
|
+
}
|
72
|
+
|
73
|
+
* {
|
74
|
+
position: relative;
|
75
|
+
z-index: 2;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
@each $key, $value in $opacity {
|
80
|
+
&.imageoverlay[imageoverlay="#{$key}"]::before {
|
81
|
+
opacity: $value;
|
82
|
+
}
|
83
|
+
}
|
58
84
|
}
|
@@ -25,6 +25,7 @@ type BackgroundProps = {
|
|
25
25
|
backgroundPosition?: ResponsiveProp<string> | string,
|
26
26
|
backgroundRepeat?: ResponsiveProp<BackgroundRepeat> | BackgroundRepeat,
|
27
27
|
imageUrl?: ResponsiveProp<string> | string,
|
28
|
+
imageOverlay?: 'opacity_1' | 'opacity_2' | 'opacity_3' | 'opacity_4' | 'opacity_5' | 'opacity_6' | 'opacity_7' | 'opacity_8' | 'opacity_9' | 'opacity_10',
|
28
29
|
children?: React.ReactChild[] | React.ReactNode,
|
29
30
|
className?: string,
|
30
31
|
customColor?: string,
|
@@ -86,8 +87,9 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
86
87
|
imageUrl = '',
|
87
88
|
tag = 'div',
|
88
89
|
transition = '',
|
90
|
+
imageOverlay,
|
89
91
|
} = props
|
90
|
-
|
92
|
+
|
91
93
|
const [responsiveProps, setResponsiveProps] = useState({
|
92
94
|
backgroundSize: getResponsiveValue(backgroundSize),
|
93
95
|
backgroundPosition: getResponsiveValue(backgroundPosition),
|
@@ -132,7 +134,8 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
132
134
|
[`pb_background_color_${resBackgroundColor}`]: resBackgroundColor && !customColor,
|
133
135
|
[`pb_background_custom_color`]: !!customColor,
|
134
136
|
},
|
135
|
-
className
|
137
|
+
className,
|
138
|
+
imageOverlay ? "imageoverlay" : ""
|
136
139
|
);
|
137
140
|
|
138
141
|
const backgroundStyle = {
|
@@ -155,7 +158,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
155
158
|
const ariaProps = buildAriaProps(aria);
|
156
159
|
const dataProps = buildDataProps(data);
|
157
160
|
const htmlProps = buildHtmlProps(htmlOptions);
|
158
|
-
|
161
|
+
|
159
162
|
return (
|
160
163
|
<Tag
|
161
164
|
{...ariaProps}
|
@@ -164,11 +167,12 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
164
167
|
alt={alt}
|
165
168
|
className={classes}
|
166
169
|
id={id}
|
170
|
+
imageOverlay={imageOverlay}
|
167
171
|
style={combinedStyles}
|
168
172
|
>
|
169
173
|
{children}
|
170
174
|
</Tag>
|
171
|
-
|
175
|
+
|
172
176
|
)
|
173
177
|
}
|
174
178
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Background from "../../pb_background/_background"
|
3
|
+
import Flex from "../../pb_flex/_flex"
|
4
|
+
import FlexItem from "../../pb_flex/_flex_item"
|
5
|
+
import Title from "../../pb_title/_title"
|
6
|
+
|
7
|
+
const BackgroundOverlay = (props) => {
|
8
|
+
return (
|
9
|
+
<Background
|
10
|
+
alt="colorful background"
|
11
|
+
className="background lazyload"
|
12
|
+
imageOverlay="opacity_6"
|
13
|
+
imageUrl="https://images.unsplash.com/photo-1528459801416-a9e53bbf4e17?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
|
14
|
+
{...props}
|
15
|
+
backgroundColor="light"
|
16
|
+
>
|
17
|
+
<Flex
|
18
|
+
orientation="column"
|
19
|
+
vertical="center"
|
20
|
+
{...props}
|
21
|
+
>
|
22
|
+
<FlexItem>
|
23
|
+
<Title
|
24
|
+
dark
|
25
|
+
padding="lg"
|
26
|
+
size={1}
|
27
|
+
text="Background Kit Image"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
</FlexItem>
|
31
|
+
</Flex>
|
32
|
+
</Background>
|
33
|
+
)
|
34
|
+
}
|
35
|
+
|
36
|
+
export default BackgroundOverlay
|
@@ -0,0 +1 @@
|
|
1
|
+
An overlay can be added to the background image by setting the `imageOverlay` prop and adding a `backgroundColor`. The `imageOverlay` prop can be set to any opacity ranging from `opacity_1` to `opacity_10`.
|
@@ -6,3 +6,4 @@ export { default as BackgroundStatus } from './_background_status.jsx'
|
|
6
6
|
export { default as BackgroundStatusSubtle } from './_background_status_subtle.jsx'
|
7
7
|
export { default as BackgroundCategory } from './_background_category.jsx'
|
8
8
|
export { default as BackgroundSize } from './_background_size.jsx'
|
9
|
+
export { default as BackgroundOverlay } from './_background_overlay.jsx'
|
@@ -63,11 +63,6 @@ $pb_button_sizes: (
|
|
63
63
|
color: $text_lt_lighter;
|
64
64
|
}
|
65
65
|
|
66
|
-
// Disabled =================
|
67
|
-
&[class*=_disabled] {
|
68
|
-
@include pb_button_disabled;
|
69
|
-
}
|
70
|
-
|
71
66
|
// Block ====================
|
72
67
|
&[class*=_block] {
|
73
68
|
@include pb_button_block;
|
@@ -83,6 +78,11 @@ $pb_button_sizes: (
|
|
83
78
|
@include pb_button_danger;
|
84
79
|
}
|
85
80
|
|
81
|
+
// Disabled =================
|
82
|
+
&[class*=_disabled] {
|
83
|
+
@include pb_button_disabled;
|
84
|
+
}
|
85
|
+
|
86
86
|
// Dark Variants =============
|
87
87
|
&.dark {
|
88
88
|
&[class*=_primary] {
|
@@ -27,13 +27,20 @@ exports[`html structure is correct 1`] = `
|
|
27
27
|
class="icon_wrapper"
|
28
28
|
style="vertical-align: middle; color: rgb(193, 205, 214);"
|
29
29
|
>
|
30
|
-
<
|
31
|
-
class="
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
<svg
|
31
|
+
class="pb_custom_icon svg-inline--fa svg_lg svg_fw"
|
32
|
+
color="currentColor"
|
33
|
+
fill="none"
|
34
|
+
height="auto"
|
35
|
+
viewBox="0 0 30 25"
|
36
|
+
width="auto"
|
37
|
+
xmlns="http://www.w3.org/2000/svg"
|
38
|
+
>
|
39
|
+
<path
|
40
|
+
d="M14.203 19.297l-9-9c-.469-.422-.469-1.125 0-1.594.422-.422 1.125-.422 1.594 0L15 16.953l8.203-8.203c.422-.469 1.125-.469 1.594 0a1.103 1.103 0 010 1.547l-9.047 9a1.027 1.027 0 01-1.547 0z"
|
41
|
+
fill="#242B42"
|
42
|
+
/>
|
43
|
+
</svg>
|
37
44
|
</div>
|
38
45
|
</div>
|
39
46
|
</div>
|
@@ -75,15 +75,15 @@ test('returns correct icon', () => {
|
|
75
75
|
</>
|
76
76
|
)
|
77
77
|
|
78
|
-
expect(screen.getByTestId('test-cell').querySelector('.
|
79
|
-
expect(screen.getByTestId('test-home').querySelector('.
|
78
|
+
expect(screen.getByTestId('test-cell').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
79
|
+
expect(screen.getByTestId('test-home').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
80
80
|
expect(screen.getByTestId('test-work').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-office')
|
81
|
-
expect(screen.getByTestId('test-work-cell').querySelector('.
|
82
|
-
expect(screen.getByTestId('test-email').querySelector('.pb_custom_icon')).
|
83
|
-
expect(screen.getByTestId('test-wrong-phone').querySelector('.
|
84
|
-
expect(screen.getByTestId('test-wrong-type').querySelector('.
|
81
|
+
expect(screen.getByTestId('test-work-cell').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
82
|
+
expect(screen.getByTestId('test-email').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
83
|
+
expect(screen.getByTestId('test-wrong-phone').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
84
|
+
expect(screen.getByTestId('test-wrong-type').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
85
85
|
expect(screen.getByTestId('test-extension').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-plus')
|
86
|
-
expect(screen.getByTestId('test-empty').querySelector('.
|
86
|
+
expect(screen.getByTestId('test-empty').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
87
87
|
})
|
88
88
|
|
89
89
|
test("not compliant values return null in phone related contact types", () => {
|