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,22 +1,24 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { render, screen } from "../utilities/test-utils"
|
1
|
+
import React from "react";
|
2
|
+
import { render, screen } from "../utilities/test-utils";
|
3
3
|
|
4
|
-
import StarRating from "./_star_rating"
|
4
|
+
import StarRating from "./_star_rating";
|
5
5
|
|
6
|
-
const testId = "star-rating-kit"
|
6
|
+
const testId = "star-rating-kit";
|
7
7
|
|
8
8
|
describe("Star Rating Kit", () => {
|
9
9
|
test("Expects to have correct classname", () => {
|
10
10
|
render(
|
11
11
|
<StarRating
|
12
12
|
data={{ testid: testId }}
|
13
|
+
rating={2}
|
13
14
|
/>
|
14
|
-
)
|
15
|
+
);
|
15
16
|
|
16
|
-
const kit = screen.getByTestId(testId)
|
17
|
-
expect(kit.className).toBe("pb_star_rating_kit")
|
18
17
|
|
19
|
-
|
18
|
+
const kit = screen.getByTestId(testId);
|
19
|
+
expect(kit).toHaveClass("pb_star_rating_kit");
|
20
|
+
|
21
|
+
});
|
20
22
|
|
21
23
|
test('should render aria-label', () => {
|
22
24
|
render(
|
@@ -25,47 +27,45 @@ describe("Star Rating Kit", () => {
|
|
25
27
|
data={{ testid: testId }}
|
26
28
|
rating={2}
|
27
29
|
/>
|
28
|
-
)
|
30
|
+
);
|
29
31
|
|
30
32
|
const kit = screen.getByTestId(testId)
|
31
33
|
expect(kit).toHaveAttribute('aria-label', testId)
|
32
|
-
})
|
34
|
+
});
|
33
35
|
|
34
|
-
test("Displays
|
36
|
+
test("Displays two highlighted stars", () => {
|
35
37
|
render(
|
36
38
|
<StarRating
|
37
39
|
data={{ testid: testId }}
|
38
|
-
denominator={4}
|
39
40
|
rating={2}
|
40
|
-
size="xs"
|
41
41
|
/>
|
42
|
-
)
|
42
|
+
);
|
43
43
|
|
44
|
-
const kit = screen.getByTestId(testId)
|
45
|
-
const highlight = kit.querySelector(".star_flex_area")
|
46
|
-
const stars = highlight.querySelectorAll(".pb_star_xs")
|
47
|
-
const count = stars.length
|
48
44
|
|
49
|
-
|
50
|
-
|
45
|
+
const kit = screen.getByTestId(testId);
|
46
|
+
const highlight = kit.querySelector(".pb_star_rating_highlight");
|
47
|
+
const stars = highlight.querySelectorAll(".far.fa-star");
|
48
|
+
const count = stars.length;
|
51
49
|
|
52
|
-
|
50
|
+
expect(count).toBe(2);
|
51
|
+
});
|
52
|
+
|
53
|
+
test("Displays three highlighted stars and a half star", () => {
|
53
54
|
render(
|
54
55
|
<StarRating
|
55
56
|
data={{ testid: testId }}
|
56
|
-
|
57
|
-
rating={2}
|
58
|
-
size="lg"
|
57
|
+
rating={3.5}
|
59
58
|
/>
|
60
|
-
)
|
59
|
+
);
|
61
60
|
|
62
|
-
const kit = screen.getByTestId(testId)
|
63
|
-
const highlight = kit.querySelector(".
|
64
|
-
const
|
65
|
-
const
|
66
|
-
const
|
61
|
+
const kit = screen.getByTestId(testId);
|
62
|
+
const highlight = kit.querySelector(".pb_star_rating_highlight");
|
63
|
+
const stars = highlight.querySelectorAll(".far.fa-star");
|
64
|
+
const halfStars = highlight.querySelectorAll(".far.fa-star-half");
|
65
|
+
const starCount = stars.length;
|
66
|
+
const halfStarCount = halfStars.length;
|
67
67
|
|
68
|
-
expect(
|
69
|
-
expect(
|
70
|
-
})
|
71
|
-
})
|
68
|
+
expect(starCount).toBe(3);
|
69
|
+
expect(halfStarCount).toBe(1);
|
70
|
+
});
|
71
|
+
});
|
@@ -16,10 +16,3 @@ examples:
|
|
16
16
|
- text_input_add_on: Add On
|
17
17
|
- text_input_inline: Inline
|
18
18
|
- text_input_no_label: No Label
|
19
|
-
|
20
|
-
swift:
|
21
|
-
- text_input_default_swift: Default
|
22
|
-
- text_input_error_swift: With Error
|
23
|
-
- text_input_disabled_swift: Disabled
|
24
|
-
- text_input_add_on_swift: Add On
|
25
|
-
- text_input_props_swift: ""
|
@@ -1,111 +1,116 @@
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
2
|
-
import classnames from "classnames";
|
1
|
+
// import React, { useState, useEffect } from "react";
|
2
|
+
// import classnames from "classnames";
|
3
3
|
|
4
|
-
import { globalProps } from "../utilities/globalProps";
|
5
|
-
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
4
|
+
// import { globalProps } from "../utilities/globalProps";
|
5
|
+
// import { buildAriaProps, buildDataProps } from "../utilities/props";
|
6
6
|
|
7
|
-
import HighchartsReact from "highcharts-react-official";
|
8
|
-
import
|
9
|
-
import {
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import treemap from 'highcharts/modules/treemap'
|
7
|
+
// import HighchartsReact from "highcharts-react-official";
|
8
|
+
// import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
|
+
// import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
|
+
// import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
11
|
+
// import treemap from 'highcharts/modules/treemap'
|
13
12
|
|
14
|
-
type TreemapChartProps = {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
};
|
13
|
+
// type TreemapChartProps = {
|
14
|
+
// chartData: {
|
15
|
+
// name: string,
|
16
|
+
// parent?: string | number,
|
17
|
+
// value: number,
|
18
|
+
// color?: string,
|
19
|
+
// id?: string | number,
|
20
|
+
// }[],
|
21
|
+
// className?: string,
|
22
|
+
// colors: string[],
|
23
|
+
// dark?: boolean,
|
24
|
+
// drillable: boolean,
|
25
|
+
// grouped: boolean,
|
26
|
+
// height?: string,
|
27
|
+
// id: number | string,
|
28
|
+
// title?: string,
|
29
|
+
// tooltipHtml: string,
|
30
|
+
// type?: string,
|
31
|
+
// aria?: { [key: string]: string },
|
32
|
+
// data?: { [key: string]: string },
|
33
|
+
// };
|
35
34
|
|
36
|
-
const TreemapChart = ({
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}: TreemapChartProps) => {
|
51
|
-
|
52
|
-
|
53
|
-
const setupTheme = () => {
|
54
|
-
dark
|
55
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
56
|
-
: Highcharts.setOptions(highchartsTheme);
|
57
|
-
};
|
58
|
-
treemap(Highcharts)
|
59
|
-
setupTheme();
|
35
|
+
// const TreemapChart = ({
|
36
|
+
// aria = {},
|
37
|
+
// data = {},
|
38
|
+
// chartData,
|
39
|
+
// colors,
|
40
|
+
// dark = false,
|
41
|
+
// drillable = false,
|
42
|
+
// grouped = false,
|
43
|
+
// height,
|
44
|
+
// id,
|
45
|
+
// title = "",
|
46
|
+
// tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.value}</b>',
|
47
|
+
// type = "treemap",
|
48
|
+
// ...props
|
49
|
+
// }: TreemapChartProps) => {
|
50
|
+
// const ariaProps = buildAriaProps(aria);
|
51
|
+
// const dataProps = buildDataProps(data);
|
60
52
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
53
|
+
// const staticOptions = {
|
54
|
+
// title: {
|
55
|
+
// text: title,
|
56
|
+
// },
|
57
|
+
// chart: {
|
58
|
+
// height: height,
|
59
|
+
// type: type,
|
60
|
+
// },
|
61
|
+
// credits: false,
|
62
|
+
// series: [
|
63
|
+
// {
|
64
|
+
// data: chartData,
|
65
|
+
// },
|
66
|
+
// ],
|
67
|
+
// plotOptions: {
|
68
|
+
// treemap: {
|
69
|
+
// tooltip: {
|
70
|
+
// pointFormat: tooltipHtml,
|
71
|
+
// },
|
72
|
+
// allowTraversingTree: drillable,
|
73
|
+
// colorByPoint: !grouped,
|
74
|
+
// colors:
|
75
|
+
// colors !== undefined && colors.length > 0
|
76
|
+
// ? mapColors(colors)
|
77
|
+
// : highchartsTheme.colors,
|
78
|
+
// },
|
79
|
+
// },
|
80
|
+
// };
|
89
81
|
|
90
|
-
|
82
|
+
// const [options, setOptions] = useState({});
|
83
|
+
// const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
91
84
|
|
92
|
-
|
93
|
-
|
94
|
-
setOptions({ ...staticOptions });
|
95
|
-
}, [chartData]);
|
85
|
+
// useEffect(() => {
|
86
|
+
// setOptions({ ...staticOptions });
|
96
87
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
};
|
88
|
+
// const interval = setInterval(() => {
|
89
|
+
// if (window.Highcharts) {
|
90
|
+
// clearInterval(interval)
|
91
|
+
// dark
|
92
|
+
// ? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
|
93
|
+
// : window.Highcharts.setOptions(highchartsTheme)
|
94
|
+
|
95
|
+
// treemap(window.Highcharts)
|
96
|
+
// setIsHighchartsLoaded(true)
|
97
|
+
// }
|
98
|
+
// }, 0)
|
99
|
+
// }, [chartData]);
|
110
100
|
|
111
|
-
|
101
|
+
// return (
|
102
|
+
// isHighchartsLoaded &&
|
103
|
+
// <HighchartsReact
|
104
|
+
// containerProps={{
|
105
|
+
// className: classnames(globalProps(props), "pb_treemap_chart"),
|
106
|
+
// id: id,
|
107
|
+
// ...ariaProps,
|
108
|
+
// ...dataProps,
|
109
|
+
// }}
|
110
|
+
// highcharts={window.Highcharts}
|
111
|
+
// options={options}
|
112
|
+
// />
|
113
|
+
// );
|
114
|
+
// };
|
115
|
+
|
116
|
+
// export default TreemapChart;
|
@@ -39,7 +39,7 @@ import * as FixedConfirmationToast from 'pb_fixed_confirmation_toast/docs'
|
|
39
39
|
import * as Flex from 'pb_flex/docs'
|
40
40
|
import * as FormGroup from 'pb_form_group/docs'
|
41
41
|
import * as FormPill from 'pb_form_pill/docs'
|
42
|
-
import * as Gauge from 'pb_gauge/docs'
|
42
|
+
//import * as Gauge from 'pb_gauge/docs'
|
43
43
|
import * as Hashtag from 'pb_hashtag/docs'
|
44
44
|
import * as Highlight from 'pb_highlight/docs'
|
45
45
|
import * as HomeAddressStreet from 'pb_home_address_street/docs'
|
@@ -97,7 +97,7 @@ import * as TitleCount from 'pb_title_count/docs'
|
|
97
97
|
import * as TitleDetail from 'pb_title_detail/docs'
|
98
98
|
import * as Toggle from 'pb_toggle/docs'
|
99
99
|
import * as Tooltip from 'pb_tooltip/docs'
|
100
|
-
import * as TreemapChart from 'pb_treemap_chart/docs'
|
100
|
+
//import * as TreemapChart from 'pb_treemap_chart/docs'
|
101
101
|
import * as Typeahead from 'pb_typeahead/docs'
|
102
102
|
import * as User from 'pb_user/docs'
|
103
103
|
import * as UserBadge from 'pb_user_badge/docs'
|
@@ -140,7 +140,7 @@ WebpackerReact.registerComponents({
|
|
140
140
|
...Flex,
|
141
141
|
...FormGroup,
|
142
142
|
...FormPill,
|
143
|
-
|
143
|
+
//...Gauge,
|
144
144
|
...Hashtag,
|
145
145
|
...Highlight,
|
146
146
|
...HomeAddressStreet,
|
@@ -198,7 +198,7 @@ WebpackerReact.registerComponents({
|
|
198
198
|
...TitleDetail,
|
199
199
|
...Toggle,
|
200
200
|
...Tooltip,
|
201
|
-
|
201
|
+
//...TreemapChart,
|
202
202
|
...Typeahead,
|
203
203
|
...User,
|
204
204
|
...UserBadge,
|
@@ -10,13 +10,13 @@ import DialogBody from './pb_dialog/child_kits/_dialog_body'
|
|
10
10
|
import DialogFooter from './pb_dialog/child_kits/_dialog_footer'
|
11
11
|
import DialogHeader from './pb_dialog/child_kits/_dialog_header'
|
12
12
|
import DistributionBar from './pb_distribution_bar/_distribution_bar'
|
13
|
-
import Gauge from './pb_gauge/_gauge'
|
13
|
+
//import Gauge from './pb_gauge/_gauge'
|
14
14
|
import Legend from './pb_legend/_legend'
|
15
15
|
import LineGraph from './pb_line_graph/_line_graph'
|
16
16
|
import MultiLevelSelect from './pb_multi_level_select/_multi_level_select'
|
17
17
|
import Passphrase from './pb_passphrase/_passphrase'
|
18
18
|
import RichTextEditor from './pb_rich_text_editor/_rich_text_editor'
|
19
|
-
import TreemapChart from './pb_treemap_chart/_treemap_chart'
|
19
|
+
//import TreemapChart from './pb_treemap_chart/_treemap_chart'
|
20
20
|
import Typeahead from './pb_typeahead/_typeahead'
|
21
21
|
import PhoneNumberInput from './pb_phone_number_input/_phone_number_input'
|
22
22
|
|
@@ -33,9 +33,9 @@ WebpackerReact.registerComponents({
|
|
33
33
|
LineGraph,
|
34
34
|
Passphrase,
|
35
35
|
RichTextEditor,
|
36
|
-
TreemapChart,
|
36
|
+
//TreemapChart,
|
37
37
|
Typeahead,
|
38
|
-
Gauge,
|
38
|
+
//Gauge,
|
39
39
|
PhoneNumberInput
|
40
40
|
})
|
41
41
|
|