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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +36 -32
  3. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +68 -63
  4. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +257 -3
  5. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +59 -47
  6. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +40 -34
  7. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -6
  8. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -6
  9. data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +53 -84
  10. data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +55 -184
  11. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.html.erb +1 -11
  12. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +2 -17
  13. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb +1 -6
  14. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +5 -22
  15. data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +5 -10
  16. data/app/pb_kits/playbook/pb_star_rating/docs/index.js +0 -6
  17. data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +20 -58
  18. data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -42
  19. data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -34
  20. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -7
  21. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +0 -4
  22. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +107 -102
  23. data/app/pb_kits/playbook/playbook-doc.js +4 -4
  24. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +4 -4
  25. data/dist/playbook-rails.js +7 -7
  26. data/lib/playbook/version.rb +1 -1
  27. metadata +2 -25
  28. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +0 -11
  29. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +0 -7
  30. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +0 -13
  31. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +0 -11
  32. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +0 -15
  33. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +0 -5
  34. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +0 -15
  35. data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +0 -15
  36. data/app/pb_kits/playbook/pb_star_rating/custom-icons.js +0 -356
  37. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.html.erb +0 -7
  38. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.jsx +0 -40
  39. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb +0 -12
  40. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx +0 -57
  41. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb +0 -23
  42. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx +0 -59
  43. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +0 -35
  44. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +0 -29
  45. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +0 -13
  46. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +0 -24
  47. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +0 -13
  48. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +0 -11
  49. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +0 -10
  50. 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; 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[];
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
- "<b>{point.y}</b>",
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
- if (document.querySelector(".prefix")) {
178
- document.querySelectorAll(".prefix").forEach((prefix) => {
179
- prefix.setAttribute("y", "28");
180
- });
181
- document
182
- .querySelectorAll(".fix")
183
- .forEach((fix) => fix.setAttribute("y", "38"));
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?: Boolean;
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*=pb_star_rating_kit] {
7
- display: flex;
8
- align-items: flex-end;
9
+ [class^=pb_star_rating_kit] {
10
+ position: relative;
11
+ display: inline-flex;
9
12
  justify-content: flex-start;
10
-
11
- path {
12
- &.suble_star_dark {
13
- fill: $text_dk_default;
14
- }
15
- &.suble_star_light {
16
- fill: $text_lt_default;
17
- }
18
- &.outline_star_dark {
19
- stroke: $text_dk_lighter;
20
- }
21
- &.outline_star_light {
22
- stroke: $text_lt_lighter;
23
- }
24
- &.empty_star_dark {
25
- fill: $border_dark;
26
- }
27
- &.empty_star_light {
28
- fill: $border_light;
29
- }
30
- }
31
-
32
- .pb_star_rating_number_xs {
33
- max-height: 14px;
34
- }
35
-
36
- .pb_star_rating_number_sm {
37
- max-height: 14px;
38
- }
39
-
40
- .pb_star_rating_number_md {
41
- max-height: 24px;
42
- }
43
-
44
- .pb_star_rating_number_lg {
45
- max-height: 40px;
46
- height: 29px;
47
- }
48
-
49
- $star-styles: (
50
- pb_star_xs: (font-size: 14px, padding-right: 4px),
51
- pb_star_sm: (font-size: 16px, padding-right: 4px),
52
- pb_star_md: (font-size: 24px, padding-right: 6px),
53
- pb_star_lg: (font-size: 48px, padding-right: 12px)
54
- );
55
-
56
- @each $class, $styles in $star-styles {
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
  }