playbook_ui 13.12.0.pre.alpha.play900startratingasinput1612 → 13.12.0.pre.alpha.play1051highchartstest1556
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_bar_graph/_bar_graph.tsx +36 -32
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +68 -63
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +257 -3
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +59 -47
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +40 -34
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +53 -84
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +55 -184
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.html.erb +1 -11
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +2 -17
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb +1 -6
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +5 -22
- data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +5 -10
- data/app/pb_kits/playbook/pb_star_rating/docs/index.js +0 -6
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +20 -58
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -42
- data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -34
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_toggle/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +107 -102
- data/app/pb_kits/playbook/playbook-doc.js +4 -4
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +4 -4
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +1 -1
- metadata +2 -25
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +0 -11
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +0 -7
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +0 -13
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +0 -11
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +0 -15
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +0 -5
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +0 -15
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +0 -15
- data/app/pb_kits/playbook/pb_star_rating/custom-icons.js +0 -356
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.html.erb +0 -7
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.jsx +0 -40
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb +0 -12
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx +0 -57
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb +0 -23
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx +0 -59
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +0 -35
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +0 -29
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +0 -13
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +0 -24
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +0 -13
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +0 -11
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +0 -10
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +0 -6
@@ -1,7 +1,7 @@
|
|
1
|
+
/* eslint-disable */
|
1
2
|
import React, { useState, useEffect } from "react";
|
2
3
|
import classnames from "classnames";
|
3
4
|
import HighchartsReact from "highcharts-react-official";
|
4
|
-
import Highcharts from "highcharts";
|
5
5
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
6
6
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
7
7
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
@@ -14,26 +14,26 @@ import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
|
|
14
14
|
import { globalProps } from "../utilities/globalProps";
|
15
15
|
|
16
16
|
type GaugeProps = {
|
17
|
-
aria: { [key: string]: string }
|
18
|
-
className?: string
|
19
|
-
chartData?: { name: string
|
20
|
-
dark?:
|
21
|
-
data?: { [key: string]: string }
|
22
|
-
disableAnimation?: boolean
|
23
|
-
fullCircle?: boolean
|
24
|
-
height?: string
|
25
|
-
id?: string
|
26
|
-
max?: number
|
27
|
-
min?: number
|
28
|
-
prefix?: string
|
29
|
-
showLabels?: boolean
|
30
|
-
style?: string
|
31
|
-
suffix?: string
|
32
|
-
title?: string
|
33
|
-
tooltipHtml?: string
|
34
|
-
colors: string[]
|
35
|
-
minorTickInterval: any
|
36
|
-
circumference: number[]
|
17
|
+
aria: { [key: string]: string },
|
18
|
+
className?: string,
|
19
|
+
chartData?: { name: string, value: number[] | number }[],
|
20
|
+
dark?: boolean,
|
21
|
+
data?: { [key: string]: string },
|
22
|
+
disableAnimation?: boolean,
|
23
|
+
fullCircle?: boolean,
|
24
|
+
height?: string,
|
25
|
+
id?: string,
|
26
|
+
max?: number,
|
27
|
+
min?: number,
|
28
|
+
prefix?: string,
|
29
|
+
showLabels?: boolean,
|
30
|
+
style?: string,
|
31
|
+
suffix?: string,
|
32
|
+
title?: string,
|
33
|
+
tooltipHtml?: string,
|
34
|
+
colors: string[],
|
35
|
+
minorTickInterval: any,
|
36
|
+
circumference: number[],
|
37
37
|
};
|
38
38
|
|
39
39
|
const Gauge = ({
|
@@ -54,7 +54,7 @@ const Gauge = ({
|
|
54
54
|
suffix = "",
|
55
55
|
title = "",
|
56
56
|
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
|
57
|
-
|
57
|
+
"<b>{point.y}</b>",
|
58
58
|
colors = [],
|
59
59
|
minorTickInterval = null,
|
60
60
|
circumference = fullCircle ? [0, 360] : [-100, 100],
|
@@ -62,28 +62,13 @@ const Gauge = ({
|
|
62
62
|
}: GaugeProps) => {
|
63
63
|
const ariaProps = buildAriaProps(aria);
|
64
64
|
const dataProps = buildDataProps(data);
|
65
|
-
highchartsMore(Highcharts);
|
66
|
-
solidGauge(Highcharts);
|
67
|
-
const setupTheme = () => {
|
68
|
-
dark
|
69
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
70
|
-
: Highcharts.setOptions(highchartsTheme);
|
71
|
-
};
|
72
|
-
setupTheme();
|
73
|
-
|
74
|
-
//set tooltip directly to prevent being overriden by Highcharts defaults
|
75
|
-
Highcharts.setOptions({
|
76
|
-
tooltip: {
|
77
|
-
pointFormat: tooltipHtml,
|
78
|
-
followPointer: true,
|
79
|
-
},
|
80
|
-
});
|
81
65
|
|
82
66
|
const css = buildCss({
|
83
67
|
pb_gauge_kit: true,
|
84
68
|
});
|
85
69
|
|
86
70
|
const [options, setOptions] = useState({});
|
71
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
87
72
|
|
88
73
|
useEffect(() => {
|
89
74
|
const formattedChartData = chartData.map((obj: any) => {
|
@@ -174,18 +159,45 @@ const Gauge = ({
|
|
174
159
|
|
175
160
|
setOptions({ ...staticOptions });
|
176
161
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
162
|
+
const interval = setInterval(() => {
|
163
|
+
if (window.Highcharts) {
|
164
|
+
clearInterval(interval)
|
165
|
+
|
166
|
+
const gaugeInterval = setInterval(() => {
|
167
|
+
if (document.querySelector(".prefix")) {
|
168
|
+
clearInterval(gaugeInterval)
|
169
|
+
document.querySelectorAll(".prefix").forEach((prefix) => {
|
170
|
+
prefix.setAttribute("y", "28");
|
171
|
+
});
|
172
|
+
document
|
173
|
+
.querySelectorAll(".fix")
|
174
|
+
.forEach((fix) => fix.setAttribute("y", "38"));
|
175
|
+
}
|
176
|
+
}, 0)
|
177
|
+
|
178
|
+
dark
|
179
|
+
? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
|
180
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
181
|
+
|
182
|
+
highchartsMore(window.Highcharts);
|
183
|
+
solidGauge(window.Highcharts);
|
184
|
+
|
185
|
+
//set tooltip directly to prevent being overriden by window.Highcharts defaults
|
186
|
+
window.Highcharts.setOptions({
|
187
|
+
tooltip: {
|
188
|
+
pointFormat: tooltipHtml,
|
189
|
+
followPointer: true,
|
190
|
+
},
|
191
|
+
});
|
192
|
+
|
193
|
+
setIsHighchartsLoaded(true)
|
194
|
+
}
|
195
|
+
}, 0)
|
185
196
|
|
186
197
|
}, [chartData]);
|
187
198
|
|
188
199
|
return (
|
200
|
+
isHighchartsLoaded &&
|
189
201
|
<HighchartsReact
|
190
202
|
containerProps={{
|
191
203
|
className: classnames(css, globalProps(props)),
|
@@ -193,7 +205,7 @@ const Gauge = ({
|
|
193
205
|
...ariaProps,
|
194
206
|
...dataProps,
|
195
207
|
}}
|
196
|
-
highcharts={Highcharts}
|
208
|
+
highcharts={window.Highcharts}
|
197
209
|
options={options}
|
198
210
|
/>
|
199
211
|
);
|
@@ -1,42 +1,42 @@
|
|
1
|
+
/* eslint-disable */
|
1
2
|
import React, { useState, useEffect } from "react";
|
2
3
|
import classnames from "classnames";
|
3
4
|
import { globalProps } from "../utilities/globalProps";
|
4
5
|
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
5
6
|
|
6
7
|
import HighchartsReact from "highcharts-react-official";
|
7
|
-
import Highcharts from "highcharts";
|
8
8
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
9
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
10
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
11
11
|
|
12
12
|
type LineGraphProps = {
|
13
|
-
align?: "left" | "right" | "center"
|
14
|
-
axisTitle?: string
|
15
|
-
dark?:
|
16
|
-
xAxisCategories: []
|
17
|
-
yAxisMin: number
|
18
|
-
yAxisMax: number
|
19
|
-
className?: string
|
13
|
+
align?: "left" | "right" | "center",
|
14
|
+
axisTitle?: string,
|
15
|
+
dark?: boolean,
|
16
|
+
xAxisCategories: [],
|
17
|
+
yAxisMin: number,
|
18
|
+
yAxisMax: number,
|
19
|
+
className?: string,
|
20
20
|
chartData: {
|
21
|
-
name: string
|
22
|
-
data: number[]
|
23
|
-
}[]
|
24
|
-
gradient?: boolean
|
25
|
-
id: string
|
26
|
-
pointStart: number
|
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 }
|
21
|
+
name: string,
|
22
|
+
data: number[],
|
23
|
+
}[],
|
24
|
+
gradient?: boolean,
|
25
|
+
id: string,
|
26
|
+
pointStart: number,
|
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
40
|
};
|
41
41
|
|
42
42
|
const LineGraph = ({
|
@@ -68,12 +68,6 @@ const LineGraph = ({
|
|
68
68
|
}: LineGraphProps) => {
|
69
69
|
const ariaProps = buildAriaProps(aria);
|
70
70
|
const dataProps = buildDataProps(data);
|
71
|
-
const setupTheme = () => {
|
72
|
-
dark
|
73
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
74
|
-
: Highcharts.setOptions(highchartsTheme);
|
75
|
-
};
|
76
|
-
setupTheme();
|
77
71
|
|
78
72
|
const staticOptions = {
|
79
73
|
title: {
|
@@ -126,12 +120,24 @@ const LineGraph = ({
|
|
126
120
|
}
|
127
121
|
|
128
122
|
const [options, setOptions] = useState({});
|
123
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
129
124
|
|
130
125
|
useEffect(() => {
|
131
126
|
setOptions({ ...staticOptions });
|
127
|
+
|
128
|
+
const interval = setInterval(() => {
|
129
|
+
if (window.Highcharts) {
|
130
|
+
clearInterval(interval)
|
131
|
+
dark
|
132
|
+
? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
|
133
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
134
|
+
setIsHighchartsLoaded(true)
|
135
|
+
}
|
136
|
+
}, 0)
|
132
137
|
}, [chartData]);
|
133
138
|
|
134
139
|
return (
|
140
|
+
isHighchartsLoaded &&
|
135
141
|
<HighchartsReact
|
136
142
|
containerProps={{
|
137
143
|
className: classnames(globalProps(props), className),
|
@@ -139,7 +145,7 @@ const LineGraph = ({
|
|
139
145
|
...ariaProps,
|
140
146
|
...dataProps,
|
141
147
|
}}
|
142
|
-
highcharts={Highcharts}
|
148
|
+
highcharts={window.Highcharts}
|
143
149
|
options={options}
|
144
150
|
/>
|
145
151
|
);
|
@@ -10,9 +10,3 @@ examples:
|
|
10
10
|
- multiple_users_default: Default
|
11
11
|
- multiple_users_reverse: Reverse
|
12
12
|
- multiple_users_size: Size
|
13
|
-
|
14
|
-
swift:
|
15
|
-
- multiple_users_default_swift: Default
|
16
|
-
- multiple_users_reverse_swift: Reverse
|
17
|
-
- multiple_users_size_swift: Small
|
18
|
-
- multiple_users_props_swift: ""
|
@@ -6,9 +6,3 @@ examples:
|
|
6
6
|
|
7
7
|
react:
|
8
8
|
- multiple_users_stacked_default: Default
|
9
|
-
|
10
|
-
swift:
|
11
|
-
- multiple_users_stacked_default_swift: Default
|
12
|
-
- multiple_users_stacked_small_swift: Small
|
13
|
-
- multiple_users_stacked_xsmall_swift: xSmall
|
14
|
-
- multiple_users_stacked_props_swift: ""
|
@@ -2,92 +2,61 @@
|
|
2
2
|
@import "../tokens/opacity";
|
3
3
|
@import "../tokens/spacing";
|
4
4
|
|
5
|
+
$pb_star_rating_number_width: 30px;
|
6
|
+
$pb_star_rating_wrapper_width: 90px;
|
7
|
+
$pb_star_rating_height: 26px;
|
5
8
|
|
6
|
-
[class
|
7
|
-
|
8
|
-
|
9
|
+
[class^=pb_star_rating_kit] {
|
10
|
+
position: relative;
|
11
|
+
display: inline-flex;
|
9
12
|
justify-content: flex-start;
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
.#{$class} {
|
58
|
-
@each $property, $value in $styles {
|
59
|
-
#{$property}: $value;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
$star-container: (
|
65
|
-
pb_star_container_xs: (font-size: 14px ),
|
66
|
-
pb_star_container_sm: (font-size: 16px ),
|
67
|
-
pb_star_container_md: (font-size: 24px ),
|
68
|
-
pb_star_container_lg: (font-size: 48px )
|
69
|
-
);
|
70
|
-
|
71
|
-
@each $class, $styles in $star-container {
|
72
|
-
.#{$class} {
|
73
|
-
@each $property, $value in $styles {
|
74
|
-
#{$property}: $value;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
$star-padding: (
|
80
|
-
pb_star_padding_xs: (padding-right: 4px),
|
81
|
-
pb_star_padding_sm: (padding-right: 4px),
|
82
|
-
pb_star_padding_md: (padding-right: 6px),
|
83
|
-
pb_star_padding_lg: (padding-right: 12px)
|
84
|
-
);
|
85
|
-
|
86
|
-
@each $class, $styles in $star-padding {
|
87
|
-
.#{$class} {
|
88
|
-
@each $property, $value in $styles {
|
89
|
-
#{$property}: $value;
|
90
|
-
}
|
13
|
+
align-items: flex-start;
|
14
|
+
|
15
|
+
.pb_star_rating_number {
|
16
|
+
flex-shrink: 0;
|
17
|
+
flex-grow: 0;
|
18
|
+
flex-basis: $pb_star_rating_number_width;
|
19
|
+
width: $pb_star_rating_number_width;
|
20
|
+
min-height: $pb_star_rating_height;
|
21
|
+
padding: 0 $space-xs 0;
|
22
|
+
color: $text_lt_light;
|
23
|
+
font-size: $text-small;
|
24
|
+
display: flex;
|
25
|
+
justify-content: center;
|
26
|
+
align-items: center;
|
27
|
+
}
|
28
|
+
|
29
|
+
.pb_star_rating_wrapper {
|
30
|
+
position: relative;
|
31
|
+
width: $pb_star_rating_wrapper_width;
|
32
|
+
flex-basis: $pb_star_rating_wrapper_width;
|
33
|
+
flex-shrink: 0;
|
34
|
+
flex-grow: 1;
|
35
|
+
min-height: $pb_star_rating_height;
|
36
|
+
|
37
|
+
.pb_star_rating_highlight {
|
38
|
+
display: flex;
|
39
|
+
position: absolute;
|
40
|
+
top: 5px;
|
41
|
+
left: 0;
|
42
|
+
z-index: 5;
|
43
|
+
color: $yellow;
|
44
|
+
line-height: $pb_star_rating_height;
|
45
|
+
}
|
46
|
+
.pb_star_rating_base {
|
47
|
+
display: flex;
|
48
|
+
position: absolute;
|
49
|
+
top: 5px;
|
50
|
+
left: 0;
|
51
|
+
z-index: 0;
|
52
|
+
color: rgba($slate, $opacity-4);
|
53
|
+
line-height: $pb_star_rating_height;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
&[class*=_hide_rating] {
|
58
|
+
.pb_star_rating_number {
|
59
|
+
display: none;
|
91
60
|
}
|
92
61
|
}
|
93
62
|
}
|