playbook_ui 13.28.0 → 13.29.0.pre.alpha.PBNTR329draggablev33059
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +2 -3
- data/app/pb_kits/playbook/index.js +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +40 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +14 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +10 -2
- 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 +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +34 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +31 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +4 -1
- data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +31 -0
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +16 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +2 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/{_bar_graph_custom.html.erb → _bar_graph_custom_rails.html.erb} +3 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.md +2 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_card/_card.scss +5 -0
- data/app/pb_kits/playbook/pb_card/_card.tsx +56 -9
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +1 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +9 -3
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +45 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +24 -1
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +53 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +14 -8
- data/app/pb_kits/playbook/pb_collapsible/collapsible.test.js +24 -0
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +7 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +9 -1
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +13 -0
- data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +53 -0
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +92 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +53 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +4 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +158 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +101 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +50 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +51 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +11 -0
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +63 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +54 -0
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +57 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +10 -0
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +4 -1
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +6 -1
- data/app/pb_kits/playbook/pb_gauge/gauge.test.js +35 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +3 -2
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +8 -2
- data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +52 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +22 -1
- data/app/pb_kits/playbook/pb_list/_list.tsx +43 -2
- data/app/pb_kits/playbook/pb_list/_list_item.tsx +46 -10
- data/app/pb_kits/playbook/pb_pill/docs/_description.md +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -0
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +30 -32
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +0 -2
- data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +35 -28
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +5 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +5 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.jsx +33 -32
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.jsx +33 -33
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.jsx +51 -50
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.html.erb +54 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.jsx +37 -38
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.html.erb +53 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_row.html.erb → _table_outer_padding.html.erb} +7 -7
- data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.jsx +76 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +9 -9
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
- data/app/pb_kits/playbook/pb_table/styles/_outer_padding.scss +21 -0
- data/app/pb_kits/playbook/pb_table/table.rb +14 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +5 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +12 -9
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +61 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +6 -1
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/tokens/_vertical_align.scss +18 -0
- data/app/pb_kits/playbook/utilities/_vertical_align.scss +16 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +12 -1
- data/dist/menu.yml +5 -2
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/classnames.rb +1 -0
- data/lib/playbook/forms/builder/dropdown_field.rb +14 -0
- data/lib/playbook/forms/builder.rb +1 -0
- data/lib/playbook/kit_base.rb +2 -0
- data/lib/playbook/version.rb +2 -2
- data/lib/playbook/vertical_align.rb +37 -0
- metadata +49 -10
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.html.erb +0 -63
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.html.erb +0 -52
- /data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_column.html.erb → _table_alignment_column_rails.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15e8f4bc66591135abee36bd3c787bba5634a05f9946a633b65f30442b6b67ed
|
4
|
+
data.tar.gz: 746c09e0b3ff3376ee961b903fc843a2fbba545b68eb5ded7cdcf491e264d654
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 847a815f0747e139ae0b55e187a6c19e1e351e69f202ad55f832254375b4a64b87ffa14f9ac5f534a80e391904c57de7c793b5762e0a5cea4094e1fc04e3190e
|
7
|
+
data.tar.gz: 55b27592b147d0b565538a7fc0f4441b3663074413e2e4e78d97510511a3f634f92d530866780953121b9dc5e710464677a1bf5fa75045568dda50c48e9407a1
|
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
1
|
@import 'pb_advanced_table/advanced_table';
|
5
2
|
@import 'pb_avatar/avatar';
|
6
3
|
@import 'pb_avatar_action_button/avatar_action_button';
|
@@ -31,6 +28,7 @@
|
|
31
28
|
@import 'pb_detail/detail';
|
32
29
|
@import 'pb_dialog/dialog';
|
33
30
|
@import 'pb_distribution_bar/distribution_bar';
|
31
|
+
@import 'pb_draggable/draggable';
|
34
32
|
@import 'pb_dropdown/dropdown';
|
35
33
|
@import 'pb_file_upload/file_upload';
|
36
34
|
@import 'pb_filter/filter';
|
@@ -121,3 +119,4 @@
|
|
121
119
|
@import './utilities/text_align';
|
122
120
|
@import './utilities/overflow';
|
123
121
|
@import './utilities/truncate';
|
122
|
+
@import './utilities/vertical_align';
|
@@ -35,6 +35,8 @@ export { default as DateYearStacked } from './pb_date_year_stacked/_date_year_st
|
|
35
35
|
export { default as Detail} from './pb_detail/_detail'
|
36
36
|
export { default as Dialog } from './pb_dialog/_dialog'
|
37
37
|
export { default as DistributionBar } from './pb_distribution_bar/_distribution_bar'
|
38
|
+
export { default as Draggable} from './pb_draggable/_draggable'
|
39
|
+
export { DraggableProvider} from './pb_draggable/context'
|
38
40
|
export { default as Dropdown} from './pb_dropdown/_dropdown'
|
39
41
|
export { default as FileUpload } from './pb_file_upload/_file_upload'
|
40
42
|
export { default as Filter } from './pb_filter/_filter'
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<% if content.present? %>
|
4
4
|
<% content.presence %>
|
5
5
|
<% else %>
|
6
|
-
<%= pb_rails("advanced_table/table_header", props: {column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion }) %>
|
7
|
-
<%= pb_rails("advanced_table/table_body", props: {table_data: object.table_data, column_definitions: object.column_definitions}) %>
|
6
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: object.column_definitions, enable_toggle_expansion: object.enable_toggle_expansion }) %>
|
7
|
+
<%= pb_rails("advanced_table/table_body", props: { id: object.id, table_data: object.table_data, column_definitions: object.column_definitions }) %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
column_definitions = [
|
3
|
+
{
|
4
|
+
accessor: "year",
|
5
|
+
label: "Year",
|
6
|
+
cellAccessors: ["quarter", "month", "day"],
|
7
|
+
},
|
8
|
+
{
|
9
|
+
accessor: "newEnrollments",
|
10
|
+
label: "New Enrollments",
|
11
|
+
},
|
12
|
+
{
|
13
|
+
accessor: "scheduledMeetings",
|
14
|
+
label: "Scheduled Meetings",
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "attendanceRate",
|
18
|
+
label: "Attendance Rate",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
accessor: "completedClasses",
|
22
|
+
label: "Completed Classes",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
accessor: "classCompletionRate",
|
26
|
+
label: "Class Completion Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "graduatedStudents",
|
30
|
+
label: "Graduated Students",
|
31
|
+
}
|
32
|
+
]
|
33
|
+
|
34
|
+
subrow_headers = ["Quarter", "Month", "Day"]
|
35
|
+
%>
|
36
|
+
|
37
|
+
<%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
|
38
|
+
<%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
|
39
|
+
<%= pb_rails("advanced_table/table_body", props: { id: "subrow_headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
|
40
|
+
<% end %>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
`subrow_headers` is an optional prop that if present will add header rows at each level of the nested data. The prop takes an array of strings, each string being the text for each header row. The array of strings must be in the order in which they need to be rendered in the UI according to depth.
|
2
|
+
|
3
|
+
`enable_toggle_expansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enable_toggle_expansion` is a string that can be "all", "header" or "none". If set to "all", the toggle exapansion button will appear in the table header as well as in the subRow headers. If set to "header" button will only appear in header and NOT in subRow headers. This is set to "header" by default.
|
@@ -1,3 +1,3 @@
|
|
1
1
|
`subRowHeaders` is an optional prop that if present will add header rows at each level of the nested data. The prop takes an array of strings, each string being the text for each header row. The array of strings must be in the order in which they need to be rendered in the UI according to depth.
|
2
2
|
|
3
|
-
`enableToggleExpansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enableToggleExpansion` is a string that can be
|
3
|
+
`enableToggleExpansion` is an additional optional prop that can be used in conjunction with the subRowHeaders prop. `enableToggleExpansion` is a string that can be "all", "header" or "none". If set to "all", the toggle exapansion button will appear in the table header as well as in the subRow headers. If set to "header" button will only appear in header and NOT in subRow headers. This is set to "header" by default.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
|
+
- advanced_table_beta_subrow_headers: SubRow Headers
|
4
5
|
react:
|
5
6
|
- advanced_table_default: Default (Required Props)
|
6
7
|
- advanced_table_loading: Loading State
|
@@ -12,4 +13,3 @@ examples:
|
|
12
13
|
- advanced_table_table_options: Table Options
|
13
14
|
- advanced_table_table_props: Table Props
|
14
15
|
- advanced_table_inline_row_loading: inline Row Loading
|
15
|
-
|
@@ -3,20 +3,30 @@
|
|
3
3
|
module Playbook
|
4
4
|
module PbAdvancedTable
|
5
5
|
class TableBody < Playbook::KitBase
|
6
|
+
prop :id, type: Playbook::Props::String,
|
7
|
+
default: ""
|
6
8
|
prop :table_data, type: Playbook::Props::Array,
|
7
9
|
default: []
|
8
10
|
prop :column_definitions, type: Playbook::Props::Array,
|
9
11
|
default: []
|
12
|
+
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
13
|
+
values: %w[all header none],
|
14
|
+
default: "header"
|
15
|
+
prop :subrow_headers, type: Playbook::Props::Array,
|
16
|
+
default: []
|
10
17
|
|
11
|
-
def render_row_and_children(row, column_definitions, current_depth
|
18
|
+
def render_row_and_children(row, column_definitions, current_depth, first_parent_child)
|
12
19
|
output = ActiveSupport::SafeBuffer.new
|
20
|
+
is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
|
13
21
|
|
14
|
-
output << pb_rails("advanced_table/
|
22
|
+
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1] }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
23
|
+
|
24
|
+
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth })
|
15
25
|
|
16
26
|
if row[:children].present?
|
17
|
-
output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id }) do
|
27
|
+
output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id.to_s + id }) do
|
18
28
|
row[:children].map do |child_row|
|
19
|
-
render_row_and_children(child_row, column_definitions, current_depth + 1)
|
29
|
+
render_row_and_children(child_row, column_definitions, current_depth + 1, row.children.first == child_row)
|
20
30
|
end.join.html_safe
|
21
31
|
end
|
22
32
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= pb_rails("table/table_header", props: { tag:"div", id:item[:accessor], classname:object.th_classname}) do %>
|
5
5
|
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", text_align:"end" }) do %>
|
6
6
|
<% if index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") %>
|
7
|
-
<button class="gray-icon toggle-all-icon">
|
7
|
+
<button class="gray-icon toggle-all-icon" onclick="expandAllRows(this)">
|
8
8
|
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right:"xs" }) %>
|
9
9
|
</button>
|
10
10
|
<% end %>
|
@@ -13,4 +13,12 @@
|
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<script type="text/javascript">
|
19
|
+
var expandAllRows = (element) => {
|
20
|
+
element.closest('.pb_table').querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]').forEach((button) => {
|
21
|
+
button.dispatchEvent(new Event('click'));
|
22
|
+
});
|
23
|
+
};
|
24
|
+
</script>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<div style="padding-left: <%= depth * 1.25 %>em">
|
6
6
|
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
7
7
|
<% if index.zero? && object.row[:children].present? %>
|
8
|
-
<button id="<%= object.row.object_id %>" class="gray-icon expand-toggle-icon" data-advanced-table="true" >
|
8
|
+
<button id="<%= object.row.object_id.to_s + object.id %>" class="gray-icon expand-toggle-icon" data-advanced-table="true" >
|
9
9
|
<%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
|
10
10
|
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
|
11
11
|
</button>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id) do %>
|
6
|
+
<% object.column_definitions.each_with_index do |column, index| %>
|
7
|
+
<%= pb_rails("table/table_cell", props: { tag: "div", classname: object.td_classname}) do %>
|
8
|
+
<%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
|
9
|
+
<div style="padding-left: <%= depth * 1.25 %>em">
|
10
|
+
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
11
|
+
<% if index.zero? && object.row[:children].present? %>
|
12
|
+
<button class="gray-icon toggle-all-icon" onclick="expandAllSubRows(this, <%= depth %>)">
|
13
|
+
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right:"xs" }) %>
|
14
|
+
</button>
|
15
|
+
<% end %>
|
16
|
+
<%= pb_rails("flex/flex_item") do %>
|
17
|
+
<% if index.zero? %>
|
18
|
+
<%= pb_rails("caption", props: { margin_left: object.row[:children].present? ? "none" : "xs", text: object.subrow_header }) %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<script type="text/javascript">
|
29
|
+
var expandAllSubRows = (element, rowDepth) => {
|
30
|
+
element.closest(".toggle-content").querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]').forEach((button) => {
|
31
|
+
button.dispatchEvent(new Event('click'));
|
32
|
+
});
|
33
|
+
};
|
34
|
+
</script>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbAdvancedTable
|
5
|
+
class TableSubrowHeader < Playbook::KitBase
|
6
|
+
prop :column_definitions, type: Playbook::Props::Array,
|
7
|
+
default: []
|
8
|
+
prop :depth
|
9
|
+
prop :row
|
10
|
+
prop :enable_toggle_expansion, type: Playbook::Props::Enum,
|
11
|
+
values: %w[all header none],
|
12
|
+
default: "header"
|
13
|
+
prop :subrow_header, type: Playbook::Props::String,
|
14
|
+
default: ""
|
15
|
+
|
16
|
+
def classname
|
17
|
+
generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
|
18
|
+
end
|
19
|
+
|
20
|
+
def td_classname
|
21
|
+
generate_classname("id-cell", "chrome-styles", separator: " ")
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def subrow_depth_classname
|
27
|
+
depth.positive? ? "depth-sub-row-#{depth}" : ""
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -163,6 +163,9 @@ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
|
163
163
|
staticOptions.plotOptions.series.events = { legendItemClick: () => false };
|
164
164
|
}
|
165
165
|
|
166
|
+
const filteredProps: any = {...props};
|
167
|
+
delete filteredProps.verticalAlign;
|
168
|
+
|
166
169
|
const [options, setOptions] = useState({});
|
167
170
|
|
168
171
|
useEffect(() => {
|
@@ -172,7 +175,7 @@ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
|
172
175
|
return (
|
173
176
|
<HighchartsReact
|
174
177
|
containerProps={{
|
175
|
-
className: classnames(globalProps(
|
178
|
+
className: classnames(globalProps(filteredProps), className),
|
176
179
|
id: id,
|
177
180
|
...ariaProps,
|
178
181
|
...dataProps,
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '../utilities/test-utils';
|
3
|
+
import BarGraph from './_bar_graph';
|
4
|
+
|
5
|
+
beforeEach(() => {
|
6
|
+
// Silences error logs within the test suite.
|
7
|
+
jest.spyOn(console, 'error');
|
8
|
+
jest.spyOn(console, 'warn');
|
9
|
+
console.error.mockImplementation(() => {});
|
10
|
+
console.warn.mockImplementation(() => {});
|
11
|
+
});
|
12
|
+
|
13
|
+
afterEach(() => {
|
14
|
+
console.error.mockRestore();
|
15
|
+
console.warn.mockRestore();
|
16
|
+
});
|
17
|
+
|
18
|
+
const testId = 'bargraph1';
|
19
|
+
|
20
|
+
test('bargraph uses exact classname', () => {
|
21
|
+
render(
|
22
|
+
<BarGraph
|
23
|
+
className='super_important_class'
|
24
|
+
data={{ testid: testId }}
|
25
|
+
id='bar-default'
|
26
|
+
/>
|
27
|
+
);
|
28
|
+
|
29
|
+
const kit = screen.getByTestId(testId);
|
30
|
+
expect(kit).toHaveClass('super_important_class');
|
31
|
+
});
|
@@ -74,6 +74,22 @@ module Playbook
|
|
74
74
|
standard_options.deep_merge(custom_options)
|
75
75
|
end
|
76
76
|
|
77
|
+
def vertical_align_props
|
78
|
+
if vertical_align
|
79
|
+
if object.vertical_align
|
80
|
+
original_result = super
|
81
|
+
class_to_remove = "vertical_align_#{object.vertical_align}"
|
82
|
+
|
83
|
+
modified_result = original_result.gsub(class_to_remove, "").strip
|
84
|
+
modified_result.empty? ? nil : modified_result
|
85
|
+
else
|
86
|
+
super
|
87
|
+
end
|
88
|
+
else
|
89
|
+
super
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
77
93
|
def classname
|
78
94
|
generate_classname("pb_bar_graph")
|
79
95
|
end
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
The `customOptions` prop provides comprehensive access to additional [Highcharts options](https://api.highcharts.com/highcharts/) that are not explicitly defined as props.
|
2
|
+
It's important to note that certain options may require specific script imports to function properly.
|
@@ -15,7 +15,7 @@
|
|
15
15
|
data: [1111,677,3245,500,200]
|
16
16
|
}] %>
|
17
17
|
|
18
|
-
<%
|
18
|
+
<% bar_graph_options = {
|
19
19
|
customOptions: {
|
20
20
|
subtitle: {
|
21
21
|
text: "Overwritten subtitle",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
y_axis_min: 0,
|
46
46
|
subtitle: 'Subtitle to replace',
|
47
47
|
title: 'Bar Graph with Custom Overrides',
|
48
|
-
custom_options:
|
49
|
-
}) %>
|
48
|
+
custom_options: bar_graph_options
|
49
|
+
}) %>
|
@@ -8,7 +8,7 @@ examples:
|
|
8
8
|
- bar_graph_height: Height
|
9
9
|
- bar_graph_spline: Spline
|
10
10
|
- bar_graph_colors: Color Overrides
|
11
|
-
-
|
11
|
+
- bar_graph_custom_rails: Custom Overrides
|
12
12
|
- bar_graph_stacked: Stacked
|
13
13
|
- bar_graph_negative_numbers: Negative Numbers
|
14
14
|
- bar_graph_secondary_y_axis: Secondary Y-Axis
|
@@ -8,6 +8,10 @@ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../uti
|
|
8
8
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
9
9
|
import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
|
10
10
|
|
11
|
+
import Icon from '../pb_icon/_icon'
|
12
|
+
import Flex from '../pb_flex/_flex'
|
13
|
+
import Draggable from '../pb_draggable/_draggable'
|
14
|
+
|
11
15
|
type CardPropTypes = {
|
12
16
|
aria?: {[key: string]: string},
|
13
17
|
background?: BackgroundColors | ProductColors | "none",
|
@@ -16,11 +20,14 @@ type CardPropTypes = {
|
|
16
20
|
children: React.ReactChild[] | React.ReactChild | number,
|
17
21
|
className?: string,
|
18
22
|
data?: {[key: string]: string},
|
23
|
+
draggableItem?: boolean,
|
24
|
+
dragHandle?: boolean,
|
19
25
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
20
26
|
highlight?: {
|
21
27
|
position?: "side" | "top",
|
22
28
|
color?: string,
|
23
29
|
},
|
30
|
+
id?: string,
|
24
31
|
length?: number,
|
25
32
|
padding?: string,
|
26
33
|
selected?: boolean,
|
@@ -78,8 +85,11 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
78
85
|
children,
|
79
86
|
className,
|
80
87
|
data = {},
|
88
|
+
dragHandle = false,
|
89
|
+
draggableItem = false,
|
81
90
|
highlight = {},
|
82
91
|
htmlOptions = {},
|
92
|
+
id,
|
83
93
|
selected = false,
|
84
94
|
tag = 'div',
|
85
95
|
} = props
|
@@ -113,15 +123,52 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
113
123
|
const Tag = tagOptions.includes(tag) ? tag : 'div'
|
114
124
|
|
115
125
|
return (
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
{
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
126
|
+
<>
|
127
|
+
{
|
128
|
+
draggableItem ? (
|
129
|
+
<Draggable.Item id={id}
|
130
|
+
key={id}
|
131
|
+
>
|
132
|
+
<Tag
|
133
|
+
{...ariaProps}
|
134
|
+
{...dataProps}
|
135
|
+
{...htmlProps}
|
136
|
+
className={classnames(cardCss, globalProps(props), className)}
|
137
|
+
>
|
138
|
+
{subComponentTags('Header')}
|
139
|
+
{
|
140
|
+
dragHandle ? (
|
141
|
+
<Flex>
|
142
|
+
<span className="card_draggable_handle">
|
143
|
+
<Icon
|
144
|
+
icon="grip-dots-vertical"
|
145
|
+
paddingRight="xs"
|
146
|
+
verticalAlign="middle"
|
147
|
+
/>
|
148
|
+
</span>
|
149
|
+
<div>
|
150
|
+
{nonHeaderChildren}
|
151
|
+
</div>
|
152
|
+
</Flex>
|
153
|
+
) : (
|
154
|
+
nonHeaderChildren
|
155
|
+
)
|
156
|
+
}
|
157
|
+
</Tag>
|
158
|
+
</Draggable.Item>
|
159
|
+
) : (
|
160
|
+
<Tag
|
161
|
+
{...ariaProps}
|
162
|
+
{...dataProps}
|
163
|
+
{...htmlProps}
|
164
|
+
className={classnames(cardCss, globalProps(props), className)}
|
165
|
+
>
|
166
|
+
{subComponentTags('Header')}
|
167
|
+
{nonHeaderChildren}
|
168
|
+
</Tag>
|
169
|
+
)
|
170
|
+
}
|
171
|
+
</>
|
125
172
|
)
|
126
173
|
}
|
127
174
|
|
@@ -28,7 +28,8 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
|
|
28
28
|
|
29
29
|
@mixin pb_card_selected($border_color: $primary) {
|
30
30
|
border-color: $border_color;
|
31
|
-
border-width: $pb_card_border_width
|
31
|
+
border-width: $pb_card_border_width;
|
32
|
+
outline: 1px solid $border_color;
|
32
33
|
}
|
33
34
|
|
34
35
|
@mixin pb_card_selected_dark {
|
@@ -20,7 +20,6 @@ $transition: $transition_cubic;
|
|
20
20
|
border: solid $border_light 2px;
|
21
21
|
border-radius: $border_rad_light;
|
22
22
|
height: 22px;
|
23
|
-
position: relative;
|
24
23
|
transition: background $transition_default ease, box-shadow $transition_default ease;
|
25
24
|
width: 22px;
|
26
25
|
.check_icon,
|
@@ -28,8 +27,8 @@ $transition: $transition_cubic;
|
|
28
27
|
color: $white;
|
29
28
|
height: 16px;
|
30
29
|
left: 1px;
|
31
|
-
position: relative;
|
32
30
|
display: flex;
|
31
|
+
margin: auto;
|
33
32
|
opacity: 0;
|
34
33
|
width: 16px;
|
35
34
|
&.hidden {
|
@@ -10,6 +10,7 @@ import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
|
10
10
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
11
11
|
import { globalProps } from "../utilities/globalProps";
|
12
12
|
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
13
|
+
import { merge } from 'lodash'
|
13
14
|
|
14
15
|
type CircleChartProps = {
|
15
16
|
align?: "left" | "right" | "center";
|
@@ -18,6 +19,7 @@ type CircleChartProps = {
|
|
18
19
|
children?: Node;
|
19
20
|
className?: string;
|
20
21
|
colors?: string[];
|
22
|
+
customOptions?: Partial<Highcharts.Options>;
|
21
23
|
dark?: boolean;
|
22
24
|
data?: {[key: string]: string},
|
23
25
|
dataLabelHtml?: string;
|
@@ -67,6 +69,7 @@ const CircleChart = ({
|
|
67
69
|
children,
|
68
70
|
className,
|
69
71
|
colors = [],
|
72
|
+
customOptions = {},
|
70
73
|
dark = false,
|
71
74
|
data = {},
|
72
75
|
dataLabelHtml = "<div>{point.name}</div>",
|
@@ -115,6 +118,9 @@ const CircleChart = ({
|
|
115
118
|
innerSizes[size];
|
116
119
|
|
117
120
|
|
121
|
+
const filteredProps: any = {...props};
|
122
|
+
delete filteredProps.verticalAlign;
|
123
|
+
|
118
124
|
const [options, setOptions] = useState({});
|
119
125
|
|
120
126
|
useEffect(() => {
|
@@ -171,7 +177,7 @@ const CircleChart = ({
|
|
171
177
|
],
|
172
178
|
credits: false,
|
173
179
|
};
|
174
|
-
setOptions(
|
180
|
+
setOptions(merge(staticOptions, customOptions));
|
175
181
|
}, [chartData]);
|
176
182
|
|
177
183
|
|
@@ -181,7 +187,7 @@ const CircleChart = ({
|
|
181
187
|
<div id={`wrapper-circle-chart-${id}`}>
|
182
188
|
<HighchartsReact
|
183
189
|
containerProps={{
|
184
|
-
className: classnames("pb_circle_chart", globalProps(
|
190
|
+
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
185
191
|
id: id,
|
186
192
|
...ariaProps,
|
187
193
|
...dataProps,
|
@@ -195,7 +201,7 @@ const CircleChart = ({
|
|
195
201
|
) : (
|
196
202
|
<HighchartsReact
|
197
203
|
containerProps={{
|
198
|
-
className: classnames("pb_circle_chart", globalProps(
|
204
|
+
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
199
205
|
id: id,
|
200
206
|
...ariaProps,
|
201
207
|
...dataProps,
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '../utilities/test-utils';
|
3
|
+
import CircleChart from './_circle_chart';
|
4
|
+
|
5
|
+
beforeEach(() => {
|
6
|
+
// Silences error logs within the test suite.
|
7
|
+
jest.spyOn(console, 'error');
|
8
|
+
jest.spyOn(console, 'warn');
|
9
|
+
console.error.mockImplementation(() => {});
|
10
|
+
console.warn.mockImplementation(() => {});
|
11
|
+
});
|
12
|
+
|
13
|
+
afterEach(() => {
|
14
|
+
console.error.mockRestore();
|
15
|
+
console.warn.mockRestore();
|
16
|
+
});
|
17
|
+
|
18
|
+
const testId = 'circlechart1';
|
19
|
+
|
20
|
+
test('uses exact classname', () => {
|
21
|
+
const data = [
|
22
|
+
{
|
23
|
+
name: 'Waiting for Calls',
|
24
|
+
value: 41,
|
25
|
+
},
|
26
|
+
{
|
27
|
+
name: 'On Call',
|
28
|
+
value: 49,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: 'After call',
|
32
|
+
value: 10,
|
33
|
+
},
|
34
|
+
]
|
35
|
+
render(
|
36
|
+
<CircleChart
|
37
|
+
chartData={data}
|
38
|
+
data={{ testid: testId }}
|
39
|
+
id='circlechartid'
|
40
|
+
/>
|
41
|
+
);
|
42
|
+
|
43
|
+
const kit = screen.getByTestId(testId);
|
44
|
+
expect(kit).toHaveClass('pb_circle_chart');
|
45
|
+
});
|