playbook_ui 14.23.0.pre.rc.0 → 14.23.0.pre.rc.2
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/Components/SubRowHeaderRow.tsx +32 -11
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.jsx +65 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.jsx +69 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_badge/_badge.scss +5 -6
- data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +106 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +33 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +33 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +52 -22
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +12 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +31 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +39 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +86 -38
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +32 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +72 -22
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +31 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +37 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +1 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.html.erb +14 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open_rails.md +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +59 -36
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +9 -2
- data/dist/chunks/_bar_graph-DVfSt34a.js +1 -0
- data/dist/chunks/{_typeahead-B7FRYVtS.js → _typeahead-C2h5Gq3P.js} +3 -3
- data/dist/chunks/_weekday_stacked-XhCaqWUk.js +45 -0
- data/dist/chunks/{lib-Carqm8Ip.js → lib-C0HyLoRj.js} +1 -1
- data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-C3CDCB0e.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/version.rb +1 -1
- metadata +16 -11
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +0 -72
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +0 -6
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +0 -64
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +0 -1
- data/dist/chunks/_weekday_stacked-BNSy7Mo2.js +0 -45
- /data/app/pb_kits/playbook/pb_tooltip/docs/{_tooltip_click_open.md → _tooltip_click_open_react.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc9ba12801b44159cc7542f339f5ba640128d0cc76303e594c2474aa893f21e
|
4
|
+
data.tar.gz: 6d52ca0c8aa9b30eaa5ff899283bd9d45c41babf1925a6c0ffec8162178c946e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0576e360ec5c421aea988396296d33d9d745f725782de197d0e3c64c2ee227801863e97ccf804e134e4941b52a584495c4c96c12e0d71f24c1002802b85cfcf7
|
7
|
+
data.tar.gz: c1a71f8386f2f29763c96cfd79acf2d706093ef44b1d964f55e1ee0298e8049055ff1241ec5c3a7d039994084bb02e8a2395b7eff7eb64448c9a5ec22610fa20
|
@@ -7,6 +7,7 @@ import { GlobalProps } from "../../utilities/globalProps"
|
|
7
7
|
|
8
8
|
import Flex from "../../pb_flex/_flex"
|
9
9
|
import Caption from "../../pb_caption/_caption"
|
10
|
+
import Icon from "../../pb_icon/_icon"
|
10
11
|
|
11
12
|
import { ToggleIconButton } from "./ToggleIconButton"
|
12
13
|
import { renderCollapsibleTrail } from "./CollapsibleTrail"
|
@@ -32,17 +33,19 @@ export const SubRowHeaderRow = ({
|
|
32
33
|
subRowHeaders,
|
33
34
|
table,
|
34
35
|
}: SubRowHeaderRowProps & GlobalProps) => {
|
35
|
-
const { inlineRowLoading } = useContext(AdvancedTableContext)
|
36
|
+
const { inlineRowLoading, customSort, onCustomSortClick } = useContext(AdvancedTableContext)
|
36
37
|
|
37
38
|
const numberOfColumns = table.getAllFlatColumns().length
|
38
39
|
const rowHasChildren = row.original.children ? true : false
|
39
40
|
const canExpand = inlineRowLoading ? rowHasChildren : row.getCanExpand()
|
41
|
+
const hasSubrowsToSort = row.getParentRow()?.subRows
|
42
|
+
|
40
43
|
|
41
44
|
return (
|
42
45
|
<tr className="custom-row bg-silver">
|
43
46
|
<td
|
44
47
|
className={`custom-row-first-column ${
|
45
|
-
|
48
|
+
isChrome() ? "chrome-styles" : ""
|
46
49
|
}`}
|
47
50
|
colSpan={1}
|
48
51
|
>
|
@@ -50,21 +53,39 @@ export const SubRowHeaderRow = ({
|
|
50
53
|
<div style={{ paddingLeft: `${row.depth * 1.25}em` }}>
|
51
54
|
<Flex align="center"
|
52
55
|
columnGap="xs"
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
57
|
+
//@ts-ignore
|
58
|
+
justifyContent={customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 ? "between" : undefined}
|
53
59
|
>
|
54
|
-
|
55
|
-
|
56
|
-
|
60
|
+
<Flex columnGap="xs">
|
61
|
+
{enableToggleExpansion === "all" && canExpand ? (
|
62
|
+
<ToggleIconButton onClick={onClick}
|
63
|
+
row={row}
|
64
|
+
/>
|
65
|
+
) : null}
|
66
|
+
<Caption
|
67
|
+
marginLeft={canExpand ? "none" : "xs"}
|
68
|
+
text={subRowHeaders[row.depth - 1]}
|
57
69
|
/>
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
70
|
+
</Flex>
|
71
|
+
{customSort && hasSubrowsToSort && hasSubrowsToSort.length > 1 && (
|
72
|
+
<button
|
73
|
+
aria-label="Sort this group"
|
74
|
+
className="sort-button-icon gray-icon"
|
75
|
+
onClick={() => { onCustomSortClick && onCustomSortClick(row.getParentRow()?.subRows)}}
|
76
|
+
>
|
77
|
+
<Icon
|
78
|
+
cursor="pointer"
|
79
|
+
fixedWidth
|
80
|
+
icon="sort"
|
81
|
+
/>
|
82
|
+
</button>
|
83
|
+
)}
|
63
84
|
</Flex>
|
64
85
|
</div>
|
65
86
|
</td>
|
66
87
|
|
67
88
|
<td colSpan={numberOfColumns - 1} />
|
68
89
|
</tr>
|
69
|
-
)
|
90
|
+
);
|
70
91
|
}
|
@@ -87,7 +87,7 @@ export function useTableState({
|
|
87
87
|
// Handle grouped columns
|
88
88
|
if (column.columns && column.columns.length > 0) {
|
89
89
|
return {
|
90
|
-
header: column.label || "",
|
90
|
+
header: column.header || column.label || "",
|
91
91
|
columns: buildColumns(column.columns, false),
|
92
92
|
};
|
93
93
|
}
|
@@ -95,7 +95,7 @@ export function useTableState({
|
|
95
95
|
// Define the base column structure
|
96
96
|
const columnStructure = {
|
97
97
|
...columnHelper.accessor(column.accessor, {
|
98
|
-
header: column.label
|
98
|
+
header: column.header ?? column.label ?? "",
|
99
99
|
}),
|
100
100
|
};
|
101
101
|
|
@@ -36,6 +36,7 @@ type AdvancedTableProps = {
|
|
36
36
|
columnDefinitions: GenericObject[]
|
37
37
|
columnGroupBorderColor?: "text_lt_default" | "text_lt_light" | "text_lt_lighter" | "text_dk_default" | "text_dk_light" | "text_dk_lighter"
|
38
38
|
columnVisibilityControl?: GenericObject
|
39
|
+
customSort?:boolean;
|
39
40
|
dark?: boolean
|
40
41
|
data?: { [key: string]: string }
|
41
42
|
enableToggleExpansion?: "all" | "header" | "none"
|
@@ -67,6 +68,7 @@ type AdvancedTableProps = {
|
|
67
68
|
tableProps?: GenericObject
|
68
69
|
toggleExpansionIcon?: string | string[]
|
69
70
|
onRowSelectionChange?: (arg: RowSelectionState) => void
|
71
|
+
onCustomSortClick?: (arg: GenericObject[]) => void
|
70
72
|
virtualizedRows?: boolean
|
71
73
|
allowFullScreen?: boolean
|
72
74
|
fullScreenControl?: (controls: FullscreenControls) => void
|
@@ -81,6 +83,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
81
83
|
columnDefinitions,
|
82
84
|
columnGroupBorderColor,
|
83
85
|
columnVisibilityControl,
|
86
|
+
customSort,
|
84
87
|
dark = false,
|
85
88
|
data = {},
|
86
89
|
enableToggleExpansion = "header",
|
@@ -95,6 +98,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
95
98
|
maxHeight,
|
96
99
|
onRowToggleClick,
|
97
100
|
onToggleExpansionClick,
|
101
|
+
onCustomSortClick,
|
98
102
|
pagination = false,
|
99
103
|
paginationProps,
|
100
104
|
pinnedRows,
|
@@ -325,6 +329,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
325
329
|
columnDefinitions={columnDefinitions}
|
326
330
|
columnGroupBorderColor={columnGroupBorderColor}
|
327
331
|
columnVisibilityControl={columnVisibilityControl}
|
332
|
+
customSort={customSort}
|
328
333
|
enableToggleExpansion={enableToggleExpansion}
|
329
334
|
enableVirtualization={virtualizedRows}
|
330
335
|
expandByDepth={expandByDepth}
|
@@ -336,6 +341,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
336
341
|
isActionBarVisible={isActionBarVisible}
|
337
342
|
isFullscreen={isFullscreen}
|
338
343
|
loading={loading}
|
344
|
+
onCustomSortClick={onCustomSortClick}
|
339
345
|
onExpandByDepthClick={onExpandByDepthClick}
|
340
346
|
pinnedRows={pinnedRows}
|
341
347
|
responsive={responsive}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
3
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
|
+
|
5
|
+
const AdvancedTableCustomSort = (props) => {
|
6
|
+
const columnDefinitions = [
|
7
|
+
{
|
8
|
+
accessor: "year",
|
9
|
+
label: "Year",
|
10
|
+
id: "year",
|
11
|
+
cellAccessors: ["quarter", "month", "day"],
|
12
|
+
},
|
13
|
+
{
|
14
|
+
accessor: "newEnrollments",
|
15
|
+
id: "newEnrollments",
|
16
|
+
label: "New Enrollments",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
accessor: "scheduledMeetings",
|
20
|
+
id: "scheduledMeetings",
|
21
|
+
label: "Scheduled Meetings",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
accessor: "attendanceRate",
|
25
|
+
id: "attendanceRate",
|
26
|
+
label: "Attendance Rate",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
accessor: "completedClasses",
|
30
|
+
id: "completedClasses",
|
31
|
+
label: "Completed Classes",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
accessor: "classCompletionRate",
|
35
|
+
id: "classCompletionRate",
|
36
|
+
label: "Class Completion Rate",
|
37
|
+
},
|
38
|
+
{
|
39
|
+
accessor: "graduatedStudents",
|
40
|
+
id: "graduatedStudents",
|
41
|
+
label: "Graduated Students",
|
42
|
+
},
|
43
|
+
]
|
44
|
+
|
45
|
+
//Render the subRow header rows
|
46
|
+
const subRowHeaders = ["Quarter", "Month", "Day"]
|
47
|
+
|
48
|
+
return (
|
49
|
+
<div>
|
50
|
+
<AdvancedTable
|
51
|
+
columnDefinitions={columnDefinitions}
|
52
|
+
customSort
|
53
|
+
enableToggleExpansion="all"
|
54
|
+
onCustomSortClick={(subrows)=>{console.log("Custom sort clicked", subrows)}}
|
55
|
+
tableData={MOCK_DATA}
|
56
|
+
{...props}
|
57
|
+
>
|
58
|
+
<AdvancedTable.Header enableSorting />
|
59
|
+
<AdvancedTable.Body subRowHeaders={subRowHeaders} />
|
60
|
+
</AdvancedTable>
|
61
|
+
</div>
|
62
|
+
)
|
63
|
+
}
|
64
|
+
|
65
|
+
export default AdvancedTableCustomSort
|
@@ -0,0 +1,5 @@
|
|
1
|
+
The optional `customSort` prop can be used to add a sort button within a subrow header. The button will only appear if that subrowheader has more than one subrow nested within it. This button comes with a callback function called `onCustomSortClick`.
|
2
|
+
|
3
|
+
The `onCustomSortClick` provides as an argument an array of all the subrows nested within that level of the table.
|
4
|
+
|
5
|
+
__NOTE__: `customSort` must be used in conjunction with the `subRowHeaders` prop. The `customSort` DOES NOT handle the sort logic, this must be handled on the frontend using the callback provided.
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import AdvancedTable from '../../pb_advanced_table/_advanced_table'
|
3
|
+
import Icon from "../../pb_icon/_icon"
|
4
|
+
import Flex from "../../pb_flex/_flex"
|
5
|
+
import Caption from "../../pb_caption/_caption"
|
6
|
+
import Tooltip from "../../pb_tooltip/_tooltip"
|
7
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
8
|
+
|
9
|
+
const AdvancedTableWithCustomHeader = (props) => {
|
10
|
+
const columnDefinitions = [
|
11
|
+
{
|
12
|
+
accessor: "year",
|
13
|
+
label: "Year",
|
14
|
+
cellAccessors: ["quarter", "month", "day"],
|
15
|
+
},
|
16
|
+
{
|
17
|
+
accessor: "newEnrollments",
|
18
|
+
label: "New Enrollments",
|
19
|
+
header: () => (
|
20
|
+
<Flex alignItems="center"
|
21
|
+
justifyContent="center"
|
22
|
+
>
|
23
|
+
<Caption marginRight="xs">New Enrollments</Caption>
|
24
|
+
<Tooltip placement="top"
|
25
|
+
text="Whoa. I'm a Tooltip"
|
26
|
+
zIndex={10}
|
27
|
+
>
|
28
|
+
<Icon cursor="pointer"
|
29
|
+
icon="info"
|
30
|
+
size="xs"
|
31
|
+
/>
|
32
|
+
</Tooltip>
|
33
|
+
</Flex>
|
34
|
+
),
|
35
|
+
},
|
36
|
+
{
|
37
|
+
accessor: "scheduledMeetings",
|
38
|
+
label: "Scheduled Meetings",
|
39
|
+
},
|
40
|
+
{
|
41
|
+
accessor: "attendanceRate",
|
42
|
+
label: "Attendance Rate",
|
43
|
+
},
|
44
|
+
{
|
45
|
+
accessor: "completedClasses",
|
46
|
+
label: "Completed Classes",
|
47
|
+
},
|
48
|
+
{
|
49
|
+
accessor: "classCompletionRate",
|
50
|
+
label: "Class Completion Rate",
|
51
|
+
},
|
52
|
+
{
|
53
|
+
accessor: "graduatedStudents",
|
54
|
+
label: "Graduated Students",
|
55
|
+
},
|
56
|
+
];
|
57
|
+
|
58
|
+
return (
|
59
|
+
<div>
|
60
|
+
<AdvancedTable
|
61
|
+
columnDefinitions={columnDefinitions}
|
62
|
+
tableData={MOCK_DATA}
|
63
|
+
{...props}
|
64
|
+
/>
|
65
|
+
</div>
|
66
|
+
)
|
67
|
+
}
|
68
|
+
|
69
|
+
export default AdvancedTableWithCustomHeader
|
@@ -0,0 +1 @@
|
|
1
|
+
The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
|
@@ -27,6 +27,7 @@ examples:
|
|
27
27
|
- advanced_table_loading: Loading State
|
28
28
|
- advanced_table_sort: Enable Sorting
|
29
29
|
- advanced_table_sort_control: Sort Control
|
30
|
+
- advanced_table_custom_sort: Custom Sort
|
30
31
|
- advanced_table_expanded_control: Expanded Control
|
31
32
|
- advanced_table_expand_by_depth: Expand by Depth
|
32
33
|
- advanced_table_subrow_headers: SubRow Headers
|
@@ -40,6 +41,7 @@ examples:
|
|
40
41
|
- advanced_table_inline_row_loading: Inline Row Loading
|
41
42
|
- advanced_table_responsive: Responsive Tables
|
42
43
|
- advanced_table_custom_cell: Custom Components for Cells
|
44
|
+
- advanced_table_with_custom_header: Custom Header Cell
|
43
45
|
- advanced_table_pagination: Pagination
|
44
46
|
- advanced_table_pagination_with_props: Pagination Props
|
45
47
|
- advanced_table_column_headers: Multi-Header Columns
|
@@ -38,3 +38,5 @@ export { default as AdvancedTableRowStyling } from './_advanced_table_row_stylin
|
|
38
38
|
export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
|
39
39
|
export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
|
40
40
|
export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
|
41
|
+
export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
|
42
|
+
export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
|
@@ -5,7 +5,7 @@
|
|
5
5
|
@import "../tokens/typography";
|
6
6
|
|
7
7
|
[class^=pb_badge_kit] {
|
8
|
-
$
|
8
|
+
$pb_badge_height_rounded: 16px;
|
9
9
|
|
10
10
|
display: inline-flex;
|
11
11
|
align-items: center;
|
@@ -13,7 +13,6 @@
|
|
13
13
|
border-radius: $border_rad_light;
|
14
14
|
padding: 0 $space_xs/2;
|
15
15
|
border-width: 1px;
|
16
|
-
border-style: solid;
|
17
16
|
border-color: $card_light;
|
18
17
|
white-space: nowrap;
|
19
18
|
|
@@ -31,10 +30,10 @@
|
|
31
30
|
}
|
32
31
|
|
33
32
|
&[class*=_rounded] {
|
34
|
-
height: $
|
35
|
-
min-height: $
|
36
|
-
min-width: $
|
37
|
-
border-radius: $
|
33
|
+
height: $pb_badge_height_rounded;
|
34
|
+
min-height: $pb_badge_height_rounded;
|
35
|
+
min-width: $pb_badge_height_rounded;
|
36
|
+
border-radius: $pb_badge_height_rounded / 2;
|
38
37
|
}
|
39
38
|
|
40
39
|
&[class*=_notification] {
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import colors from '../tokens/exports/_colors.module.scss'
|
2
|
+
import typography from '../tokens/exports/_typography.module.scss'
|
3
|
+
|
4
|
+
const barGraphTheme = {
|
5
|
+
title: {
|
6
|
+
text: "",
|
7
|
+
style: {
|
8
|
+
color: colors.text_lt_default,
|
9
|
+
fontFamily: typography.font_family_base,
|
10
|
+
fontWeight: typography.bold,
|
11
|
+
fontSize: typography.heading_3,
|
12
|
+
},
|
13
|
+
},
|
14
|
+
subtitle: {
|
15
|
+
text: "",
|
16
|
+
style: {
|
17
|
+
fontFamily: typography.font_family_base,
|
18
|
+
color: colors.text_lt_light,
|
19
|
+
fontWeight: typography.regular,
|
20
|
+
fontSize: typography.text_base,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
chart: {
|
24
|
+
type: "column",
|
25
|
+
},
|
26
|
+
tooltip: {
|
27
|
+
backgroundColor: {
|
28
|
+
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
29
|
+
stops: [
|
30
|
+
[0, colors.bg_dark],
|
31
|
+
[1, colors.bg_dark],
|
32
|
+
],
|
33
|
+
},
|
34
|
+
style: {
|
35
|
+
fontFamily: typography.font_family_base,
|
36
|
+
color: colors.text_dk_default,
|
37
|
+
fontWeight: typography.regular,
|
38
|
+
fontSize: typography.text_smaller,
|
39
|
+
},
|
40
|
+
},
|
41
|
+
colors: [
|
42
|
+
colors.data_1,
|
43
|
+
colors.data_2,
|
44
|
+
colors.data_3,
|
45
|
+
colors.data_4,
|
46
|
+
colors.data_5,
|
47
|
+
colors.data_6,
|
48
|
+
colors.data_7,
|
49
|
+
],
|
50
|
+
credits: { enabled: false },
|
51
|
+
legend: {
|
52
|
+
enabled: false,
|
53
|
+
itemStyle: {
|
54
|
+
color: colors.text_lt_light,
|
55
|
+
fill: colors.text_lt_light,
|
56
|
+
fontSize: typography.text_smaller,
|
57
|
+
},
|
58
|
+
},
|
59
|
+
xAxis: {
|
60
|
+
gridLineWidth: 0,
|
61
|
+
lineColor: colors.border_light,
|
62
|
+
tickColor: colors.border_light,
|
63
|
+
labels: {
|
64
|
+
style: {
|
65
|
+
fontFamily: typography.font_family_base,
|
66
|
+
color: colors.text_lt_lighter,
|
67
|
+
fontWeight: typography.bold,
|
68
|
+
fontSize: typography.text_smaller,
|
69
|
+
},
|
70
|
+
},
|
71
|
+
title: {
|
72
|
+
style: {
|
73
|
+
color: colors.text_lt_default,
|
74
|
+
fontFamily: typography.font_family_base,
|
75
|
+
fontWeight: typography.regular,
|
76
|
+
fontSize: typography.heading_4,
|
77
|
+
},
|
78
|
+
},
|
79
|
+
},
|
80
|
+
yAxis: {
|
81
|
+
alternateGridColor: undefined as string | undefined,
|
82
|
+
minorTickInterval: null as number | null,
|
83
|
+
gridLineColor: colors.border_light,
|
84
|
+
minorGridLineColor: colors.border_light,
|
85
|
+
lineWidth: 0,
|
86
|
+
tickWidth: 0,
|
87
|
+
labels: {
|
88
|
+
style: {
|
89
|
+
fontFamily: typography.font_family_base,
|
90
|
+
color: colors.text_lt_lighter,
|
91
|
+
fontWeight: typography.bold,
|
92
|
+
fontSize: typography.text_smaller,
|
93
|
+
},
|
94
|
+
},
|
95
|
+
title: {
|
96
|
+
style: {
|
97
|
+
fontFamily: typography.font_family_base,
|
98
|
+
color: colors.text_lt_lighter,
|
99
|
+
fontWeight: typography.bold,
|
100
|
+
fontSize: typography.text_smaller,
|
101
|
+
},
|
102
|
+
},
|
103
|
+
},
|
104
|
+
}
|
105
|
+
|
106
|
+
export default barGraphTheme;
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import React from 'react'
|
2
|
+
import colors from '../../tokens/exports/_colors.module.scss'
|
3
|
+
import barGraphTheme from '../barGraphTheme';
|
4
|
+
import Highcharts from "highcharts";
|
5
|
+
import HighchartsReact from "highcharts-react-official";
|
6
|
+
|
2
7
|
|
3
|
-
import BarGraph from '../_bar_graph'
|
4
8
|
|
5
9
|
const chartData = [{
|
6
10
|
name: 'Installation',
|
@@ -19,19 +23,33 @@ const chartData = [{
|
|
19
23
|
data: [1111, 677, 3245, 500, 200],
|
20
24
|
}]
|
21
25
|
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
const chartOptions = {
|
27
|
+
series: chartData,
|
28
|
+
title: {
|
29
|
+
text: "Bar Graph with Custom Data Colors",
|
30
|
+
},
|
31
|
+
xAxis: {
|
32
|
+
categories: ["Jan", "Feb", "Mar", "Apr", "May"],
|
33
|
+
},
|
34
|
+
yAxis: {
|
35
|
+
title: {
|
36
|
+
text: "Number of Employees",
|
37
|
+
},
|
38
|
+
},
|
39
|
+
colors: [colors.data_4, colors.data_5, colors.data_6, colors.data_7, colors.data_8],
|
40
|
+
}
|
41
|
+
|
42
|
+
const BarGraphColors = () => {
|
43
|
+
const options = Highcharts.merge({}, barGraphTheme, chartOptions)
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div>
|
47
|
+
<HighchartsReact
|
48
|
+
highcharts={Highcharts}
|
49
|
+
options={options}
|
50
|
+
/>
|
51
|
+
</div>
|
52
|
+
)
|
53
|
+
}
|
36
54
|
|
37
55
|
export default BarGraphColors
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import React from 'react'
|
2
|
+
import barGraphTheme from '../barGraphTheme';
|
3
|
+
import Highcharts from "highcharts";
|
4
|
+
import HighchartsReact from "highcharts-react-official";
|
2
5
|
|
3
|
-
import BarGraph from '../_bar_graph'
|
4
6
|
|
5
7
|
const chartData = [{
|
6
8
|
name: 'Installation',
|
@@ -19,19 +21,35 @@ const chartData = [{
|
|
19
21
|
data: [1111, 677, 3245, 500, 200],
|
20
22
|
}]
|
21
23
|
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
24
|
+
const chartOptions = {
|
25
|
+
series: chartData,
|
26
|
+
title: {
|
27
|
+
text: 'Solar Employment Growth by Sector, 2010-2016',
|
28
|
+
},
|
29
|
+
subtitle: {
|
30
|
+
text: 'Source: thesolarfoundation.com',
|
31
|
+
},
|
32
|
+
xAxis: {
|
33
|
+
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
|
34
|
+
},
|
35
|
+
yAxis: {
|
36
|
+
title: {
|
37
|
+
text: 'Number of Employees',
|
38
|
+
},
|
39
|
+
},
|
40
|
+
}
|
41
|
+
|
42
|
+
const BarGraphDefault = () => {
|
43
|
+
const options = Highcharts.merge({}, barGraphTheme, chartOptions)
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div>
|
47
|
+
<HighchartsReact
|
48
|
+
highcharts={Highcharts}
|
49
|
+
options={options}
|
50
|
+
/>
|
51
|
+
</div>
|
52
|
+
)
|
53
|
+
}
|
36
54
|
|
37
55
|
export default BarGraphDefault
|