playbook_ui 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3953 → 14.5.0.pre.alpha.PLAY1510railsformloading3975
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +0 -1
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +1 -3
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +184 -5
- data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +216 -5
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +11 -3
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +13 -3
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +30 -7
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +0 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +8 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.md +1 -0
- data/app/pb_kits/playbook/pb_form/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_form/form.rb +2 -0
- data/app/pb_kits/playbook/pb_form/formHelper.js +41 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +9 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +19 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +27 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +64 -3
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +203 -5
- data/app/pb_kits/playbook/pb_gauge/gauge.test.js +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +154 -5
- data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +113 -5
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -1
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +3 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -1
- data/dist/chunks/_typeahead-CnC6UeRx.js +22 -0
- data/dist/chunks/_weekday_stacked-DzL3HGZ_.js +45 -0
- data/dist/chunks/lib-DJCA-0lC.js +29 -0
- data/dist/chunks/{pb_form_validation-Dna2I7fw.js → pb_form_validation-CyF9hGTn.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/pb_forms_helper.rb +3 -1
- data/lib/playbook/version.rb +1 -1
- metadata +12 -7
- data/app/pb_kits/playbook/pb_dashboard/_highcharts_theme.scss +0 -52
- data/dist/chunks/_typeahead-BywvWGAm.js +0 -22
- data/dist/chunks/_weekday_stacked-5OGZKZeo.js +0 -45
- data/dist/chunks/lib-DMOmCoAX.js +0 -29
@@ -1,10 +1,118 @@
|
|
1
|
-
import React from
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
|
+
import classnames from "classnames";
|
3
|
+
|
4
|
+
import { globalProps } from "../utilities/globalProps";
|
5
|
+
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
6
|
+
|
7
|
+
import HighchartsReact from "highcharts-react-official";
|
8
|
+
import Highcharts from "highcharts";
|
9
|
+
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
10
|
+
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
|
+
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
|
+
import treemap from 'highcharts/modules/treemap'
|
13
|
+
import { merge } from 'lodash'
|
14
|
+
|
15
|
+
type TreemapChartProps = {
|
16
|
+
chartData: {
|
17
|
+
name: string;
|
18
|
+
parent?: string | number;
|
19
|
+
value: number;
|
20
|
+
color?: string;
|
21
|
+
id?: string | number;
|
22
|
+
}[];
|
23
|
+
className?: string;
|
24
|
+
colors: string[];
|
25
|
+
customOptions?: Partial<Highcharts.Options>;
|
26
|
+
dark?: boolean;
|
27
|
+
drillable: boolean;
|
28
|
+
grouped: boolean;
|
29
|
+
height?: string;
|
30
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
31
|
+
id: number | string;
|
32
|
+
title?: string;
|
33
|
+
tooltipHtml: string;
|
34
|
+
type?: string;
|
35
|
+
aria?: { [key: string]: string };
|
36
|
+
data?: { [key: string]: string };
|
37
|
+
};
|
38
|
+
|
39
|
+
const TreemapChart = ({
|
40
|
+
aria = {},
|
41
|
+
data = {},
|
42
|
+
chartData,
|
43
|
+
colors,
|
44
|
+
customOptions = {},
|
45
|
+
dark = false,
|
46
|
+
drillable = false,
|
47
|
+
grouped = false,
|
48
|
+
height,
|
49
|
+
htmlOptions = {},
|
50
|
+
id,
|
51
|
+
title = "",
|
52
|
+
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.value}</b>',
|
53
|
+
type = "treemap",
|
54
|
+
...props
|
55
|
+
}: TreemapChartProps): React.ReactElement => {
|
56
|
+
|
57
|
+
const ariaProps = buildAriaProps(aria)
|
58
|
+
const dataProps = buildDataProps(data)
|
59
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
60
|
+
|
61
|
+
const setupTheme = () => {
|
62
|
+
dark
|
63
|
+
? Highcharts.setOptions(highchartsDarkTheme)
|
64
|
+
: Highcharts.setOptions(highchartsTheme);
|
65
|
+
};
|
66
|
+
treemap(Highcharts)
|
67
|
+
setupTheme();
|
68
|
+
|
69
|
+
const staticOptions = {
|
70
|
+
title: {
|
71
|
+
text: title,
|
72
|
+
},
|
73
|
+
chart: {
|
74
|
+
height: height,
|
75
|
+
type: type,
|
76
|
+
},
|
77
|
+
credits: false,
|
78
|
+
series: [
|
79
|
+
{
|
80
|
+
data: chartData,
|
81
|
+
},
|
82
|
+
],
|
83
|
+
plotOptions: {
|
84
|
+
treemap: {
|
85
|
+
tooltip: {
|
86
|
+
pointFormat: tooltipHtml,
|
87
|
+
},
|
88
|
+
allowTraversingTree: drillable,
|
89
|
+
colorByPoint: !grouped,
|
90
|
+
colors:
|
91
|
+
colors !== undefined && colors.length > 0
|
92
|
+
? mapColors(colors)
|
93
|
+
: highchartsTheme.colors,
|
94
|
+
},
|
95
|
+
},
|
96
|
+
};
|
97
|
+
|
98
|
+
const [options, setOptions] = useState({});
|
99
|
+
|
100
|
+
useEffect(() => {
|
101
|
+
setOptions(merge(staticOptions, customOptions));
|
102
|
+
}, [chartData]);
|
2
103
|
|
3
|
-
const TreemapChart: React.FC = () => {
|
4
104
|
return (
|
5
|
-
<
|
6
|
-
|
7
|
-
|
105
|
+
<HighchartsReact
|
106
|
+
containerProps={{
|
107
|
+
className: classnames(globalProps(props), "pb_treemap_chart"),
|
108
|
+
id: id,
|
109
|
+
...ariaProps,
|
110
|
+
...dataProps,
|
111
|
+
...htmlProps
|
112
|
+
}}
|
113
|
+
highcharts={Highcharts}
|
114
|
+
options={options}
|
115
|
+
/>
|
8
116
|
);
|
9
117
|
};
|
10
118
|
|
@@ -136,12 +136,15 @@ const Typeahead = ({
|
|
136
136
|
}
|
137
137
|
}
|
138
138
|
|
139
|
+
const filteredProps: TypeaheadProps = {...props}
|
140
|
+
delete filteredProps.truncate
|
141
|
+
|
139
142
|
const dataProps = buildDataProps(data)
|
140
143
|
const htmlProps = buildHtmlProps(htmlOptions)
|
141
144
|
const classes = classnames(
|
142
145
|
'pb_typeahead_kit react-select',
|
143
146
|
`mb_${marginBottom}`,
|
144
|
-
globalProps(
|
147
|
+
globalProps(filteredProps),
|
145
148
|
className
|
146
149
|
)
|
147
150
|
|
@@ -16,7 +16,7 @@ type Props = {
|
|
16
16
|
const MultiValue = (props: Props) => {
|
17
17
|
const { removeProps } = props
|
18
18
|
const { imageUrl, label } = props.data
|
19
|
-
const { dark, multiKit, pillColor } = props.selectProps
|
19
|
+
const { dark, multiKit, pillColor, truncate } = props.selectProps
|
20
20
|
|
21
21
|
const formPillProps = {
|
22
22
|
marginRight: 'xs',
|
@@ -51,6 +51,7 @@ const MultiValue = (props: Props) => {
|
|
51
51
|
name={label}
|
52
52
|
size={multiKit === 'smallPill' ? 'small' : ''}
|
53
53
|
text=''
|
54
|
+
truncate={truncate}
|
54
55
|
{...props}
|
55
56
|
/>
|
56
57
|
}
|
@@ -64,6 +65,7 @@ const MultiValue = (props: Props) => {
|
|
64
65
|
name=''
|
65
66
|
size={multiKit === 'smallPill' ? 'small' : ''}
|
66
67
|
text={label}
|
68
|
+
truncate={truncate}
|
67
69
|
{...props}
|
68
70
|
/>
|
69
71
|
}
|
@@ -65,10 +65,10 @@ module Playbook
|
|
65
65
|
def typeahead_react_options
|
66
66
|
base_options = {
|
67
67
|
className: classname,
|
68
|
-
pillColor: pill_color,
|
69
68
|
dark: dark,
|
70
69
|
defaultValue: default_options,
|
71
70
|
error: error,
|
71
|
+
htmlOptions: html_options,
|
72
72
|
id: id,
|
73
73
|
inline: inline,
|
74
74
|
isMulti: is_multi,
|
@@ -77,8 +77,10 @@ module Playbook
|
|
77
77
|
multiKit: multi_kit,
|
78
78
|
name: name,
|
79
79
|
options: options,
|
80
|
+
pillColor: pill_color,
|
80
81
|
placeholder: placeholder,
|
81
82
|
plusIcon: plus_icon,
|
83
|
+
truncate: truncate,
|
82
84
|
}
|
83
85
|
|
84
86
|
base_options[:getOptionLabel] = get_option_label if get_option_label.present?
|