playbook_ui 14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4216 → 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3930
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/pb_advanced_table/_advanced_table.tsx +7 -25
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +54 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +5 -184
- data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -5
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +5 -216
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +7 -30
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +2 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +3 -84
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +5 -28
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -10
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +0 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +0 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx +1 -4
- data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx +2 -4
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_filter/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/filter.rb +0 -2
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -3
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +2 -8
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -3
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -7
- data/app/pb_kits/playbook/pb_form/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_form/form.rb +0 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -9
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +3 -64
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +5 -203
- data/app/pb_kits/playbook/pb_gauge/gauge.test.js +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +5 -154
- data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +227 -211
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +65 -169
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +5 -5
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +9 -15
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -28
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +1 -31
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +18 -86
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +6 -15
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/intlTelInput.scss +931 -849
- data/app/pb_kits/playbook/pb_phone_number_input/types.d.ts +1 -4
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +2 -6
- data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_popover/popover.rb +1 -3
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -67
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +0 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +1 -5
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +5 -113
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -4
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -3
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -3
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -3
- data/app/pb_kits/playbook/utilities/globalProps.ts +2 -39
- data/dist/chunks/_typeahead-BywvWGAm.js +22 -0
- data/dist/chunks/_weekday_stacked-5OGZKZeo.js +45 -0
- data/dist/chunks/lib-DMOmCoAX.js +29 -0
- data/dist/chunks/{pb_form_validation-BkWGwJsl.js → pb_form_validation-Dna2I7fw.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 +1 -21
- data/lib/playbook/pb_doc_helper.rb +5 -5
- data/lib/playbook/pb_forms_helper.rb +1 -3
- data/lib/playbook/version.rb +1 -1
- metadata +6 -35
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +0 -72
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.md +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +0 -45
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +0 -9
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +0 -33
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +0 -34
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.html.erb +0 -41
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.jsx +0 -71
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_rails.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_react.md +0 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +0 -39
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.md +0 -1
- data/app/pb_kits/playbook/pb_form/formHelper.js +0 -27
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +0 -19
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +0 -27
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/context/index.tsx +0 -5
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +0 -93
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +0 -105
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +0 -106
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +0 -149
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb +0 -336
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx +0 -97
- data/dist/chunks/_typeahead-BhHnXJjy.js +0 -22
- data/dist/chunks/_weekday_stacked-B9Sy5PN8.js +0 -45
- data/dist/chunks/lib-D-mTv-kp.js +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8687cb9c372332d775ad42cd0a189c2e1c78e73d84accdb0b4a3f2039e4040d
|
4
|
+
data.tar.gz: e17faee766f6ff7a943f2bd1ece969cc7ed509c3c6600e6e83b096146b9fb51a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ab52cb63f67300accbd3ef804cbc092d67647e5a3205717f56e6499a947acc963b53e655c49d441e063f16f0f0cfad162fc9d630b0dbe11561d1a5d96994033
|
7
|
+
data.tar.gz: 5f8156e8c9e5726066c2b432448c1dcac097f7e8a095dd9ef1b37d5a3b5f176a88bc691479a6ee681812b6d2162874a415f51547fc54b83bf250d4c93a1a9cac
|
@@ -91,7 +91,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
91
91
|
const columnHelper = createColumnHelper()
|
92
92
|
|
93
93
|
//Create cells for first columns
|
94
|
-
const createCellFunction = (cellAccessors: string[]
|
94
|
+
const createCellFunction = (cellAccessors: string[]) => {
|
95
95
|
const columnCells = ({
|
96
96
|
row,
|
97
97
|
getValue,
|
@@ -101,11 +101,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
101
101
|
}) => {
|
102
102
|
const rowData = row.original
|
103
103
|
|
104
|
-
// Use customRenderer if provided, otherwise default rendering
|
105
|
-
if (customRenderer) {
|
106
|
-
return customRenderer(row, getValue())
|
107
|
-
}
|
108
|
-
|
109
104
|
switch (row.depth) {
|
110
105
|
case 0: {
|
111
106
|
return (
|
@@ -139,31 +134,18 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
139
134
|
//Create column array in format needed by Tanstack
|
140
135
|
const columns =
|
141
136
|
columnDefinitions &&
|
142
|
-
columnDefinitions.map((column
|
137
|
+
columnDefinitions.map((column) => {
|
143
138
|
// Define the base column structure
|
144
139
|
const columnStructure = {
|
145
140
|
...columnHelper.accessor(column.accessor, {
|
146
141
|
header: column.label,
|
147
142
|
}),
|
148
143
|
}
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
column.cellAccessors,
|
155
|
-
column.customRenderer
|
156
|
-
)
|
157
|
-
}
|
158
|
-
} else {
|
159
|
-
// For the first column, apply createCellFunction without customRenderer
|
160
|
-
if (column.cellAccessors) {
|
161
|
-
columnStructure.cell = createCellFunction(column.cellAccessors)
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
return columnStructure
|
166
|
-
})
|
144
|
+
if (column.cellAccessors) {
|
145
|
+
columnStructure.cell = createCellFunction(column.cellAccessors)
|
146
|
+
}
|
147
|
+
return columnStructure
|
148
|
+
})
|
167
149
|
|
168
150
|
//Syntax for sorting Array if we want to manage state ourselves
|
169
151
|
const sorting = [
|
@@ -3,7 +3,6 @@ examples:
|
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
4
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
5
5
|
- advanced_table_beta_sort: Enable Sorting
|
6
|
-
|
7
6
|
react:
|
8
7
|
- advanced_table_default: Default (Required Props)
|
9
8
|
- advanced_table_loading: Loading State
|
@@ -16,4 +15,3 @@ examples:
|
|
16
15
|
- advanced_table_table_props: Table Props
|
17
16
|
- advanced_table_inline_row_loading: Inline Row Loading
|
18
17
|
- advanced_table_responsive: Responsive Tables
|
19
|
-
- advanced_table_custom_cell: Custom Components for Cells
|
@@ -9,4 +9,3 @@ export { default as AdvancedTableTableOptions } from './_advanced_table_table_op
|
|
9
9
|
export { default as AdvancedTableTableProps } from './_advanced_table_table_props.jsx'
|
10
10
|
export { default as AdvancedTableInlineRowLoading } from './_advanced_table_inline_row_loading.jsx'
|
11
11
|
export { default as AdvancedTableResponsive } from './_advanced_table_responsive.jsx'
|
12
|
-
export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
|
@@ -13,20 +13,9 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
13
13
|
get target() {
|
14
14
|
return document.querySelector(CONTENT_SELECTOR.replace("id", this.element.id))
|
15
15
|
}
|
16
|
-
|
17
|
-
static expandedRows = new Set()
|
18
|
-
static isCollapsing = false
|
19
16
|
|
20
17
|
connect() {
|
21
18
|
this.element.addEventListener('click', () => {
|
22
|
-
if (!PbAdvancedTable.isCollapsing) {
|
23
|
-
const isExpanded = this.element.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
24
|
-
if (!isExpanded) {
|
25
|
-
PbAdvancedTable.expandedRows.add(this.element.id)
|
26
|
-
} else {
|
27
|
-
PbAdvancedTable.expandedRows.delete(this.element.id)
|
28
|
-
}
|
29
|
-
}
|
30
19
|
this.toggleElement(this.target)
|
31
20
|
})
|
32
21
|
}
|
@@ -86,53 +75,4 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
86
75
|
this.element.querySelector(UP_ARROW_SELECTOR).style.display = 'inline-block'
|
87
76
|
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display = 'none'
|
88
77
|
}
|
89
|
-
|
90
|
-
static handleToggleAllHeaders(element) {
|
91
|
-
const table = element.closest('.pb_table')
|
92
|
-
const firstLevelButtons = table.querySelectorAll('.pb_advanced_table_body > .pb_table_tr [data-advanced-table]')
|
93
|
-
|
94
|
-
const expandedRows = Array.from(firstLevelButtons).filter(button =>
|
95
|
-
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
96
|
-
)
|
97
|
-
|
98
|
-
if (expandedRows.length === firstLevelButtons.length) {
|
99
|
-
expandedRows.forEach(button => {
|
100
|
-
button.click()
|
101
|
-
})
|
102
|
-
this.expandedRows.clear()
|
103
|
-
} else {
|
104
|
-
firstLevelButtons.forEach(button => {
|
105
|
-
if (!this.expandedRows.has(button.id)) {
|
106
|
-
button.click()
|
107
|
-
}
|
108
|
-
})
|
109
|
-
}
|
110
|
-
}
|
111
|
-
static handleToggleAllSubRows(element, rowDepth) {
|
112
|
-
const parentElement = element.closest(".toggle-content")
|
113
|
-
const subrowButtons = parentElement.querySelectorAll('.depth-sub-row-' + rowDepth + ' [data-advanced-table]')
|
114
|
-
|
115
|
-
const expandedSubRows = Array.from(subrowButtons).filter(button =>
|
116
|
-
button.querySelector(UP_ARROW_SELECTOR).style.display === 'inline-block'
|
117
|
-
)
|
118
|
-
|
119
|
-
if (expandedSubRows.length === subrowButtons.length) {
|
120
|
-
expandedSubRows.forEach(button => {
|
121
|
-
button.click()
|
122
|
-
})
|
123
|
-
} else {
|
124
|
-
subrowButtons.forEach(button => {
|
125
|
-
if (!this.expandedRows.has(button.id)) {
|
126
|
-
button.click()
|
127
|
-
}
|
128
|
-
})
|
129
|
-
}
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
window.expandAllRows = (element) => {
|
134
|
-
PbAdvancedTable.handleToggleAllHeaders(element)
|
135
78
|
}
|
136
|
-
window.expandAllSubRows = (element, rowDepth) => {
|
137
|
-
PbAdvancedTable.handleToggleAllSubRows(element, rowDepth)
|
138
|
-
}
|
@@ -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>
|
@@ -23,4 +23,12 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
<% 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>
|
@@ -1,6 +1,60 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
@import "../tokens/typography";
|
3
|
+
|
1
4
|
.pb_bar_graph {
|
2
5
|
rect.highcharts-background {
|
3
6
|
fill: #0000 !important;
|
4
7
|
}
|
5
8
|
}
|
6
9
|
|
10
|
+
@import url("https://code.highcharts.com/css/highcharts.css");
|
11
|
+
|
12
|
+
// @import "highcharts/css/highcharts";
|
13
|
+
// @import "highcharts/highcharts.css";
|
14
|
+
|
15
|
+
:root {
|
16
|
+
--highcharts-color-0: #{$data_1};
|
17
|
+
--highcharts-color-1: #{$data_2};
|
18
|
+
--highcharts-color-2: #{$data_3};
|
19
|
+
--highcharts-color-3: #{$data_4};
|
20
|
+
--highcharts-color-4: #{$data_5};
|
21
|
+
--highcharts-color-5: #{$data_6};
|
22
|
+
--highcharts-color-6: #{$data_7};
|
23
|
+
--highcharts-color-7: #{$data_8};
|
24
|
+
}
|
25
|
+
|
26
|
+
.highcharts-title {
|
27
|
+
font-family: $font_family_base;
|
28
|
+
font-weight: $bold;
|
29
|
+
font-size: $heading_3;
|
30
|
+
color: $text_lt_default;
|
31
|
+
fill: $text_lt_default;
|
32
|
+
}
|
33
|
+
|
34
|
+
.highcharts-subtitle {
|
35
|
+
font-family: $font_family_base;
|
36
|
+
color: $text_lt_light;
|
37
|
+
fill: $text_lt_light;
|
38
|
+
font-weight: $regular;
|
39
|
+
font-size: $text_base;
|
40
|
+
}
|
41
|
+
|
42
|
+
.highcharts-yaxis > .highcharts-axis-title {
|
43
|
+
color: $text_lt_lighter;
|
44
|
+
fill: $text_lt_lighter;
|
45
|
+
font-family: $font_family_base;
|
46
|
+
font-weight: $bold;
|
47
|
+
font-size: $text_smaller;
|
48
|
+
}
|
49
|
+
|
50
|
+
.highcharts-axis-labels {
|
51
|
+
font-family: $font_family_base;
|
52
|
+
color: $text_lt_lighter;
|
53
|
+
fill: $text_lt_lighter;
|
54
|
+
font-weight: $bold;
|
55
|
+
font-size: $text_smaller;
|
56
|
+
}
|
57
|
+
|
58
|
+
.highcharts-grid-line {
|
59
|
+
stroke: $border_light;
|
60
|
+
}
|
@@ -1,189 +1,10 @@
|
|
1
|
-
import React
|
2
|
-
import { globalProps } from "../utilities/globalProps";
|
3
|
-
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
4
|
-
|
5
|
-
import HighchartsReact from "highcharts-react-official";
|
6
|
-
import Highcharts from "highcharts";
|
7
|
-
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
8
|
-
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
9
|
-
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
10
|
-
import { merge } from 'lodash'
|
11
|
-
|
12
|
-
import classnames from "classnames";
|
13
|
-
|
14
|
-
type BarGraphProps = {
|
15
|
-
align?: "left" | "right" | "center";
|
16
|
-
axisTitle: { name: string; }[] | string;
|
17
|
-
dark?: boolean;
|
18
|
-
xAxisCategories: [];
|
19
|
-
yAxisMin: number;
|
20
|
-
yAxisMax: number;
|
21
|
-
chartData: { name: string; data: number[], yAxis: number }[];
|
22
|
-
className?: string;
|
23
|
-
customOptions?: Partial<Highcharts.Options>;
|
24
|
-
id: string;
|
25
|
-
pointStart: number;
|
26
|
-
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
27
|
-
subTitle?: string;
|
28
|
-
title: string;
|
29
|
-
type?: string;
|
30
|
-
legend?: boolean;
|
31
|
-
toggleLegendClick?: boolean;
|
32
|
-
height?: string;
|
33
|
-
colors: string[];
|
34
|
-
layout?: "horizontal" | "vertical" | "proximate";
|
35
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
36
|
-
x?: number;
|
37
|
-
y?: number;
|
38
|
-
aria?: { [key: string]: string };
|
39
|
-
data?: { [key: string]: string };
|
40
|
-
stacking?: "normal" | "percent"
|
41
|
-
axisFormat?: { format: string; }[] | string;
|
42
|
-
};
|
43
|
-
|
44
|
-
|
45
|
-
const BarGraph = ({
|
46
|
-
aria = {},
|
47
|
-
data = {},
|
48
|
-
align = "center",
|
49
|
-
axisTitle,
|
50
|
-
dark = false,
|
51
|
-
chartData,
|
52
|
-
className = "pb_bar_graph",
|
53
|
-
colors,
|
54
|
-
htmlOptions = {},
|
55
|
-
customOptions = {},
|
56
|
-
axisFormat,
|
57
|
-
id,
|
58
|
-
pointStart,
|
59
|
-
stacking,
|
60
|
-
subTitle,
|
61
|
-
type = "column",
|
62
|
-
title = "Title",
|
63
|
-
xAxisCategories,
|
64
|
-
yAxisMin,
|
65
|
-
yAxisMax,
|
66
|
-
legend = false,
|
67
|
-
toggleLegendClick = true,
|
68
|
-
height,
|
69
|
-
layout = "horizontal",
|
70
|
-
verticalAlign = "bottom",
|
71
|
-
x = 0,
|
72
|
-
y = 0,
|
73
|
-
...props
|
74
|
-
}: BarGraphProps): React.ReactElement => {
|
75
|
-
const ariaProps = buildAriaProps(aria);
|
76
|
-
const dataProps = buildDataProps(data)
|
77
|
-
const htmlProps = buildHtmlProps(htmlOptions);
|
78
|
-
const setupTheme = () => {
|
79
|
-
dark
|
80
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
81
|
-
: Highcharts.setOptions(highchartsTheme);
|
82
|
-
};
|
83
|
-
setupTheme();
|
84
|
-
|
85
|
-
const staticOptions = {
|
86
|
-
title: {
|
87
|
-
text: title,
|
88
|
-
},
|
89
|
-
chart: {
|
90
|
-
height: height,
|
91
|
-
type: type,
|
92
|
-
},
|
93
|
-
subtitle: {
|
94
|
-
text: subTitle,
|
95
|
-
},
|
96
|
-
yAxis: [{
|
97
|
-
labels: {
|
98
|
-
format: typeof axisFormat === 'string' ? axisFormat : (axisFormat && axisFormat[0] ? axisFormat[0].format : "")
|
99
|
-
|
100
|
-
},
|
101
|
-
min: yAxisMin,
|
102
|
-
max: yAxisMax,
|
103
|
-
opposite: false,
|
104
|
-
title: {
|
105
|
-
text: Array.isArray(axisTitle) ? (axisTitle.length > 0 ? axisTitle[0].name : null) : axisTitle,
|
106
|
-
},
|
107
|
-
plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
|
108
|
-
value: 0,
|
109
|
-
zIndex: 10,
|
110
|
-
color: "#E4E8F0"
|
111
|
-
}],
|
112
|
-
}],
|
113
|
-
xAxis: {
|
114
|
-
categories: xAxisCategories,
|
115
|
-
},
|
116
|
-
legend: {
|
117
|
-
enabled: legend,
|
118
|
-
align: align,
|
119
|
-
verticalAlign: verticalAlign,
|
120
|
-
layout: layout,
|
121
|
-
x: x,
|
122
|
-
y: y,
|
123
|
-
},
|
124
|
-
colors:
|
125
|
-
colors !== undefined && colors.length > 0
|
126
|
-
? mapColors(colors)
|
127
|
-
: highchartsTheme.colors,
|
128
|
-
plotOptions: {
|
129
|
-
series: {
|
130
|
-
stacking: stacking,
|
131
|
-
pointStart: pointStart,
|
132
|
-
borderWidth: stacking ? 0 : "",
|
133
|
-
events: {},
|
134
|
-
dataLabels: {
|
135
|
-
enabled: false,
|
136
|
-
},
|
137
|
-
},
|
138
|
-
},
|
139
|
-
series: chartData,
|
140
|
-
credits: false,
|
141
|
-
};
|
142
|
-
|
143
|
-
if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
144
|
-
staticOptions.yAxis.push({
|
145
|
-
labels: {
|
146
|
-
format: typeof axisFormat === 'string' ? axisFormat : axisFormat[1].format,
|
147
|
-
},
|
148
|
-
min: yAxisMin,
|
149
|
-
max: yAxisMax,
|
150
|
-
opposite: true,
|
151
|
-
title: {
|
152
|
-
text: axisTitle[1].name,
|
153
|
-
},
|
154
|
-
plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
|
155
|
-
value: 0,
|
156
|
-
zIndex: 10,
|
157
|
-
color: "#E4E8F0"
|
158
|
-
}],
|
159
|
-
});
|
160
|
-
}
|
161
|
-
|
162
|
-
if (!toggleLegendClick) {
|
163
|
-
staticOptions.plotOptions.series.events = { legendItemClick: () => false };
|
164
|
-
}
|
165
|
-
|
166
|
-
const filteredProps: any = {...props};
|
167
|
-
delete filteredProps.verticalAlign;
|
168
|
-
|
169
|
-
const [options, setOptions] = useState({});
|
170
|
-
|
171
|
-
useEffect(() => {
|
172
|
-
setOptions(merge(staticOptions, customOptions));
|
173
|
-
}, [chartData]);
|
1
|
+
import React from 'react';
|
174
2
|
|
3
|
+
const BarGraph: React.FC = () => {
|
175
4
|
return (
|
176
|
-
<
|
177
|
-
|
178
|
-
|
179
|
-
id: id,
|
180
|
-
...ariaProps,
|
181
|
-
...dataProps,
|
182
|
-
...htmlProps
|
183
|
-
}}
|
184
|
-
highcharts={Highcharts}
|
185
|
-
options={options}
|
186
|
-
/>
|
5
|
+
<div>
|
6
|
+
This is a simple div component.
|
7
|
+
</div>
|
187
8
|
);
|
188
9
|
};
|
189
10
|
|
@@ -5,7 +5,7 @@ import { get } from 'lodash'
|
|
5
5
|
import classnames from 'classnames'
|
6
6
|
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
8
|
-
import { GlobalProps, globalProps
|
8
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
9
9
|
import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
|
10
10
|
|
11
11
|
import Icon from '../pb_icon/_icon'
|
@@ -49,7 +49,6 @@ type CardBodyProps = {
|
|
49
49
|
padding?: string,
|
50
50
|
} & GlobalProps
|
51
51
|
|
52
|
-
|
53
52
|
// Header component
|
54
53
|
const Header = (props: CardHeaderProps) => {
|
55
54
|
const { children, className, headerColor = 'category_1', headerColorStriped = false } = props
|
@@ -108,7 +107,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
108
107
|
|
109
108
|
// coerce to array
|
110
109
|
const cardChildren = React.Children.toArray(children)
|
111
|
-
const dynamicInlineProps = globalInlineProps(props);
|
112
110
|
|
113
111
|
const subComponentTags = (tagName: string) => {
|
114
112
|
return cardChildren.filter((c: string) => (
|
@@ -137,7 +135,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
137
135
|
{...dataProps}
|
138
136
|
{...htmlProps}
|
139
137
|
className={classnames(cardCss, globalProps(props), className)}
|
140
|
-
style={dynamicInlineProps}
|
141
138
|
>
|
142
139
|
{subComponentTags('Header')}
|
143
140
|
{
|
@@ -166,7 +163,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
166
163
|
{...dataProps}
|
167
164
|
{...htmlProps}
|
168
165
|
className={classnames(cardCss, globalProps(props), className)}
|
169
|
-
style={dynamicInlineProps}
|
170
166
|
>
|
171
167
|
{subComponentTags('Header')}
|
172
168
|
{nonHeaderChildren}
|
@@ -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 {
|