playbook_ui 13.11.1.pre.alpha.play900startratingasinput1530 → 13.12.0.pre.alpha.PLAY1051removinghighchartsdependency1551
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 +67 -63
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +57 -46
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +39 -34
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_children_swift.md +14 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_dashed_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_line_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_props_swift.md +8 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_text_swift.md +7 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_vertical_swift.md +18 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +8 -0
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +49 -61
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +54 -151
- 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 +15 -56
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -49
- data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -33
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default_swift.md +27 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error_swift.md +11 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_props_swift.md +9 -0
- data/app/pb_kits/playbook/pb_textarea/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +33 -28
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +2 -2
- metadata +11 -10
- 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_star_rating/star.svg +0 -3
@@ -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,46 +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
41
|
/>
|
41
|
-
)
|
42
|
+
);
|
42
43
|
|
43
|
-
const kit = screen.getByTestId(testId)
|
44
|
-
const highlight = kit.querySelector(".pb_star_rating_wrapper")
|
45
|
-
const stars = highlight.querySelectorAll(".pb_star_sm")
|
46
|
-
const count = stars.length
|
47
44
|
|
48
|
-
|
49
|
-
|
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;
|
50
49
|
|
51
|
-
|
50
|
+
expect(count).toBe(2);
|
51
|
+
});
|
52
|
+
|
53
|
+
test("Displays three highlighted stars and a half star", () => {
|
52
54
|
render(
|
53
55
|
<StarRating
|
54
56
|
data={{ testid: testId }}
|
55
|
-
|
56
|
-
rating={2}
|
57
|
-
size="lg"
|
57
|
+
rating={3.5}
|
58
58
|
/>
|
59
|
-
)
|
59
|
+
);
|
60
60
|
|
61
|
-
const kit = screen.getByTestId(testId)
|
62
|
-
const highlight = kit.querySelector(".
|
63
|
-
const
|
64
|
-
const
|
65
|
-
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;
|
66
67
|
|
67
|
-
expect(
|
68
|
-
expect(
|
69
|
-
})
|
70
|
-
})
|
68
|
+
expect(starCount).toBe(3);
|
69
|
+
expect(halfStarCount).toBe(1);
|
70
|
+
});
|
71
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
![textarea-default](https://github.com/powerhome/playbook/assets/92755007/40eec958-63d7-4840-bf5c-f8d1e34c911a)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
@State var defaultText = ""
|
6
|
+
@State var placeholderText = ""
|
7
|
+
@State var customText = "Default value text"
|
8
|
+
|
9
|
+
VStack(alignment: .leading, spacing: Spacing.small) {
|
10
|
+
PBTextArea(
|
11
|
+
"Label",
|
12
|
+
text: $defaultText
|
13
|
+
)
|
14
|
+
|
15
|
+
PBTextArea(
|
16
|
+
"Label",
|
17
|
+
text: $placeholderText,
|
18
|
+
placeholder: "Placeholder with text"
|
19
|
+
)
|
20
|
+
|
21
|
+
PBTextArea(
|
22
|
+
"Label",
|
23
|
+
text: $customText
|
24
|
+
)
|
25
|
+
}
|
26
|
+
|
27
|
+
```
|
@@ -0,0 +1,9 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **characterCount** | `CharacterCount` | Adds a character counter to the Textarea | `.noCount` | `.noCount` `.count` `.maxCharacterCount` `.maxCharacterCountBlock` `.maxCharacterCountError` |
|
5
|
+
| **inline** | `Bool` | Changes the style of the Textarea | `false` | `true` `false` |
|
6
|
+
| **label** | `String` | Adds a label | `nil` | |
|
7
|
+
| **placeholder** | `String` | Adds placeholder text | `nil` | |
|
8
|
+
| **text** | `String` | Sets the Textarea's text value | `Binding<String>` | |
|
9
|
+
| **error** | `String` | Changes the style of the Textarea | `nil` | |
|
@@ -5,7 +5,6 @@ import { globalProps } from "../utilities/globalProps";
|
|
5
5
|
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
6
6
|
|
7
7
|
import HighchartsReact from "highcharts-react-official";
|
8
|
-
import Highcharts from "highcharts";
|
9
8
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
10
9
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
10
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
@@ -13,24 +12,24 @@ import treemap from 'highcharts/modules/treemap'
|
|
13
12
|
|
14
13
|
type TreemapChartProps = {
|
15
14
|
chartData: {
|
16
|
-
name: string
|
17
|
-
parent?: string | number
|
18
|
-
value: number
|
19
|
-
color?: string
|
20
|
-
id?: string | number
|
21
|
-
}[]
|
22
|
-
className?: string
|
23
|
-
colors: string[]
|
24
|
-
dark?: boolean
|
25
|
-
drillable: boolean
|
26
|
-
grouped: boolean
|
27
|
-
height?: string
|
28
|
-
id: number | string
|
29
|
-
title?: string
|
30
|
-
tooltipHtml: string
|
31
|
-
type?: string
|
32
|
-
aria?: { [key: string]: string }
|
33
|
-
data?: { [key: string]: string }
|
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 },
|
34
33
|
};
|
35
34
|
|
36
35
|
const TreemapChart = ({
|
@@ -50,13 +49,6 @@ const TreemapChart = ({
|
|
50
49
|
}: TreemapChartProps) => {
|
51
50
|
const ariaProps = buildAriaProps(aria);
|
52
51
|
const dataProps = buildDataProps(data);
|
53
|
-
const setupTheme = () => {
|
54
|
-
dark
|
55
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
56
|
-
: Highcharts.setOptions(highchartsTheme);
|
57
|
-
};
|
58
|
-
treemap(Highcharts)
|
59
|
-
setupTheme();
|
60
52
|
|
61
53
|
const staticOptions = {
|
62
54
|
title: {
|
@@ -88,13 +80,26 @@ const TreemapChart = ({
|
|
88
80
|
};
|
89
81
|
|
90
82
|
const [options, setOptions] = useState({});
|
83
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
91
84
|
|
92
85
|
useEffect(() => {
|
93
|
-
|
94
86
|
setOptions({ ...staticOptions });
|
87
|
+
|
88
|
+
const interval = setInterval(() => {
|
89
|
+
if (window.Highcharts) {
|
90
|
+
clearInterval(interval)
|
91
|
+
dark
|
92
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
93
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
94
|
+
|
95
|
+
treemap(window.Highcharts)
|
96
|
+
setIsHighchartsLoaded(true)
|
97
|
+
}
|
98
|
+
}, 0)
|
95
99
|
}, [chartData]);
|
96
100
|
|
97
101
|
return (
|
102
|
+
isHighchartsLoaded &&
|
98
103
|
<HighchartsReact
|
99
104
|
containerProps={{
|
100
105
|
className: classnames(globalProps(props), "pb_treemap_chart"),
|
@@ -102,7 +107,7 @@ const TreemapChart = ({
|
|
102
107
|
...ariaProps,
|
103
108
|
...dataProps,
|
104
109
|
}}
|
105
|
-
highcharts={Highcharts}
|
110
|
+
highcharts={window.Highcharts}
|
106
111
|
options={options}
|
107
112
|
/>
|
108
113
|
);
|