playbook_ui 13.33.1 → 13.34.0
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_background/background.html.erb +2 -11
- data/app/pb_kits/playbook/pb_body/body.html.erb +1 -6
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +1 -6
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +1 -6
- data/app/pb_kits/playbook/pb_caption/caption.html.erb +1 -6
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -7
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +31 -32
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +3 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +33 -32
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +3 -7
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +1 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +9 -0
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +25 -19
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +6 -3
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +71 -64
- data/app/pb_kits/playbook/pb_detail/detail.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +2 -5
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +7 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +37 -31
- data/app/pb_kits/playbook/pb_flex/flex.html.erb +1 -5
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +4 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +11 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +52 -17
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.html.erb +5 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.jsx +19 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +16 -9
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +6 -1
- data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +1 -6
- data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +1 -5
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +1 -5
- data/app/pb_kits/playbook/pb_icon/_icon.scss +17 -0
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +3 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +5 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +34 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.md +1 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_icon/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +9 -1
- data/app/pb_kits/playbook/pb_icon/icon.test.js +22 -9
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +132 -201
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +28 -33
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.jsx +14 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_star_rating/stars/utils.tsx +81 -0
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx +56 -0
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +64 -0
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/version.rb +2 -2
- metadata +11 -2
@@ -1,8 +1,4 @@
|
|
1
|
-
<%=
|
2
|
-
id: object.id,
|
3
|
-
data: object.data,
|
4
|
-
class: object.classname,
|
5
|
-
**combined_html_options) do %>
|
1
|
+
<%= pb_content_tag do %>
|
6
2
|
<%= pb_rails("home_address_street/#{emphasis}_emphasis", props: object.send("#{emphasis}_emphasis_props")) %>
|
7
3
|
<% end %>
|
8
4
|
|
@@ -1,3 +1,20 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
|
3
|
+
// All the merges below create $icon_colors, a map of all color tokens in colors.scss
|
4
|
+
$merge_kits1: map-merge($status_colors, $category_colors);
|
5
|
+
$merge_kits2: map-merge($merge_kits1, $product_colors);
|
6
|
+
$merge_kits3: map-merge($merge_kits2, $text_colors);
|
7
|
+
$icon_colors: map-merge($merge_kits3, $data_colors);
|
8
|
+
|
9
|
+
.pb_custom_icon, .pb_icon_kit {
|
10
|
+
@each $color_name, $color_value in $icon_colors {
|
11
|
+
&[class*="#{$color_name}"] {
|
12
|
+
color: $color_value;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
// Rails custom icon styles
|
1
18
|
svg.pb_custom_icon {
|
2
19
|
width: 1em;
|
3
20
|
fill: currentColor;
|
@@ -23,6 +23,7 @@ type IconProps = {
|
|
23
23
|
aria?: {[key: string]: string},
|
24
24
|
border?: string,
|
25
25
|
className?: string,
|
26
|
+
color?: string,
|
26
27
|
customIcon?: {[key: string] :SVGElement},
|
27
28
|
data?: {[key: string]: string},
|
28
29
|
fixedWidth?: boolean,
|
@@ -121,6 +122,7 @@ const Icon = (props: IconProps) => {
|
|
121
122
|
aria = {},
|
122
123
|
border = false,
|
123
124
|
className,
|
125
|
+
color,
|
124
126
|
customIcon,
|
125
127
|
data = {},
|
126
128
|
fixedWidth = true,
|
@@ -169,6 +171,7 @@ const Icon = (props: IconProps) => {
|
|
169
171
|
(!iconElement && !customIcon) ? 'pb_icon_kit' : '',
|
170
172
|
(iconElement || customIcon) ? 'pb_custom_icon' : fontStyle,
|
171
173
|
iconElement ? 'svg-inline--fa' : '',
|
174
|
+
color ? `color_${color}` : '',
|
172
175
|
globalProps(props),
|
173
176
|
className
|
174
177
|
)
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%= pb_rails("flex", props: {orientation: "column"}) do %>
|
2
|
+
<%= pb_rails("icon", props: { icon: "user", fixed_width: true, color: "primary", padding_bottom: "sm", size: "2x" }) %>
|
3
|
+
<%= pb_rails("icon", props: { icon: "recycle", fixed_width: true, color: "data_4", padding_bottom: "sm", size: "2x" }) %>
|
4
|
+
<%= pb_rails("icon", props: { icon: "roofing", fixed_width: true, color: "product_5_background", size: "2x" }) %>
|
5
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import Icon from "../_icon"
|
3
|
+
|
4
|
+
const IconDefault = (props) => {
|
5
|
+
return (
|
6
|
+
<div style={{ display: "flex", flexDirection: "column"}}>
|
7
|
+
<Icon
|
8
|
+
color="primary"
|
9
|
+
fixedWidth
|
10
|
+
icon="user"
|
11
|
+
paddingBottom="sm"
|
12
|
+
size="2x"
|
13
|
+
{...props}
|
14
|
+
/>
|
15
|
+
<Icon
|
16
|
+
color="data_4"
|
17
|
+
fixedWidth
|
18
|
+
icon="recycle"
|
19
|
+
paddingBottom="sm"
|
20
|
+
size="2x"
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
<Icon
|
24
|
+
color="product_5_background"
|
25
|
+
fixedWidth
|
26
|
+
icon="product-roofing"
|
27
|
+
size="2x"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
</div>
|
31
|
+
)
|
32
|
+
}
|
33
|
+
|
34
|
+
export default IconDefault
|
@@ -0,0 +1 @@
|
|
1
|
+
Pass any text, status, data, product, or category Playbook <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">color token</a> to the `color` prop to change any icon's color.
|
@@ -9,6 +9,7 @@ examples:
|
|
9
9
|
- icon_sizes: Icon Sizes
|
10
10
|
- icon_custom: Icon Custom
|
11
11
|
- icon_fa_kit: Icon with FontAwesome Kit
|
12
|
+
- icon_color: Icon Color
|
12
13
|
|
13
14
|
react:
|
14
15
|
- icon_default: Icon Default
|
@@ -20,6 +21,7 @@ examples:
|
|
20
21
|
- icon_sizes: Icon Sizes
|
21
22
|
- icon_custom: Icon Custom
|
22
23
|
- icon_fa_kit: Icon with FontAwesome Kit
|
24
|
+
- icon_color: Icon Color
|
23
25
|
|
24
26
|
swift:
|
25
27
|
- icon_default_swift: Icon Default
|
@@ -7,3 +7,4 @@ export { default as IconBorder } from './_icon_border.jsx'
|
|
7
7
|
export { default as IconSizes } from './_icon_sizes.jsx'
|
8
8
|
export { default as IconCustom } from './_icon_custom.jsx'
|
9
9
|
export { default as IconFaKit} from './_icon_fa_kit.jsx'
|
10
|
+
export { default as IconColor } from './_icon_color.jsx'
|
@@ -36,6 +36,7 @@ module Playbook
|
|
36
36
|
default: "far"
|
37
37
|
prop :spin, type: Playbook::Props::Boolean,
|
38
38
|
default: false
|
39
|
+
prop :color, type: Playbook::Props::String
|
39
40
|
|
40
41
|
def valid_emoji?
|
41
42
|
emoji_regex = /\p{Emoji}/
|
@@ -45,6 +46,7 @@ module Playbook
|
|
45
46
|
def classname
|
46
47
|
generate_classname(
|
47
48
|
"pb_icon_kit",
|
49
|
+
color_class,
|
48
50
|
font_style_class,
|
49
51
|
icon_class,
|
50
52
|
border_class,
|
@@ -65,6 +67,7 @@ module Playbook
|
|
65
67
|
generate_classname(
|
66
68
|
"pb_icon_kit",
|
67
69
|
border_class,
|
70
|
+
color_class,
|
68
71
|
fixed_width_class,
|
69
72
|
flip_class,
|
70
73
|
inverse_class,
|
@@ -104,7 +107,8 @@ module Playbook
|
|
104
107
|
svg["aria"] = object.aria
|
105
108
|
svg["height"] = "auto"
|
106
109
|
svg["width"] = "auto"
|
107
|
-
|
110
|
+
fill_color = object.color || "currentColor"
|
111
|
+
doc.at_css("path")["fill"] = fill_color
|
108
112
|
raw doc
|
109
113
|
end
|
110
114
|
|
@@ -200,6 +204,10 @@ module Playbook
|
|
200
204
|
class_name = is_svg? ? "spin" : "fa-spin"
|
201
205
|
spin ? class_name : nil
|
202
206
|
end
|
207
|
+
|
208
|
+
def color_class
|
209
|
+
color ? "color_#{color}" : nil
|
210
|
+
end
|
203
211
|
end
|
204
212
|
end
|
205
213
|
end
|
@@ -12,7 +12,7 @@ describe("Icon Kit", () => {
|
|
12
12
|
data={{ testid: testId }}
|
13
13
|
fixedWidth
|
14
14
|
icon="user"
|
15
|
-
|
15
|
+
/>
|
16
16
|
)
|
17
17
|
|
18
18
|
const kit = screen.getByTestId(testId)
|
@@ -27,7 +27,7 @@ describe("Icon Kit", () => {
|
|
27
27
|
fixedWidth
|
28
28
|
icon="user"
|
29
29
|
rotation={rotateProp}
|
30
|
-
|
30
|
+
/>
|
31
31
|
)
|
32
32
|
|
33
33
|
const kit = screen.getByTestId(testId)
|
@@ -44,7 +44,7 @@ describe("Icon Kit", () => {
|
|
44
44
|
fixedWidth
|
45
45
|
flip="horizontal"
|
46
46
|
icon="user"
|
47
|
-
|
47
|
+
/>
|
48
48
|
)
|
49
49
|
|
50
50
|
const kit = screen.getByTestId(testId)
|
@@ -59,7 +59,7 @@ describe("Icon Kit", () => {
|
|
59
59
|
fixedWidth
|
60
60
|
icon="spinner"
|
61
61
|
spin
|
62
|
-
|
62
|
+
/>
|
63
63
|
)
|
64
64
|
|
65
65
|
const kit = screen.getByTestId(testId)
|
@@ -73,7 +73,7 @@ describe("Icon Kit", () => {
|
|
73
73
|
fixedWidth
|
74
74
|
icon="arrow-left"
|
75
75
|
pull="left"
|
76
|
-
|
76
|
+
/>
|
77
77
|
)
|
78
78
|
|
79
79
|
const kit = screen.getByTestId(testId)
|
@@ -87,7 +87,7 @@ describe("Icon Kit", () => {
|
|
87
87
|
fixedWidth
|
88
88
|
icon="arrow-left"
|
89
89
|
pull="left"
|
90
|
-
|
90
|
+
/>
|
91
91
|
)
|
92
92
|
|
93
93
|
const kit = screen.getByTestId(testId)
|
@@ -101,7 +101,7 @@ describe("Icon Kit", () => {
|
|
101
101
|
data={{ testid: testId }}
|
102
102
|
fixedWidth
|
103
103
|
icon="user"
|
104
|
-
|
104
|
+
/>
|
105
105
|
)
|
106
106
|
|
107
107
|
const kit = screen.getByTestId(testId)
|
@@ -128,7 +128,7 @@ describe("Icon Kit", () => {
|
|
128
128
|
data={{ testid: testId }}
|
129
129
|
icon="user"
|
130
130
|
size={sizeProp}
|
131
|
-
|
131
|
+
/>
|
132
132
|
)
|
133
133
|
|
134
134
|
const kit = screen.getByTestId(testId)
|
@@ -145,11 +145,24 @@ describe("Icon Kit", () => {
|
|
145
145
|
fixedWidth
|
146
146
|
fontStyle="fas"
|
147
147
|
icon="user"
|
148
|
-
|
148
|
+
/>
|
149
149
|
)
|
150
150
|
|
151
151
|
const kit = screen.getByTestId(testId)
|
152
152
|
expect(kit).toHaveClass("fa-user pb_icon_kit fa-fw fas")
|
153
153
|
})
|
154
154
|
|
155
|
+
test("renders with color prop", () => {
|
156
|
+
render(
|
157
|
+
<Icon
|
158
|
+
color="primary"
|
159
|
+
data={{ testid: testId }}
|
160
|
+
icon="user"
|
161
|
+
/>
|
162
|
+
)
|
163
|
+
|
164
|
+
const kit = screen.getByTestId(testId)
|
165
|
+
expect(kit).toHaveClass("color_primary")
|
166
|
+
})
|
167
|
+
|
155
168
|
})
|
@@ -7,217 +7,148 @@ import { globalProps, GlobalProps } from '../utilities/globalProps'
|
|
7
7
|
import Caption from '../pb_caption/_caption'
|
8
8
|
import Body from '../pb_body/_body'
|
9
9
|
import Title from '../pb_title/_title'
|
10
|
-
import
|
11
|
-
import
|
10
|
+
import StarRatingInteractive from "./subcomponents/_star_rating_interactive"
|
11
|
+
import StarRatingDisplay from "./subcomponents/_star_rating_display"
|
12
12
|
|
13
13
|
type StarRatingProps = {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
aria?: { [key: string]: string },
|
15
|
+
className?: string,
|
16
|
+
data?: { [key: string]: string },
|
17
|
+
dark?: boolean,
|
18
|
+
fixedWidth?: boolean,
|
19
|
+
layoutOption?: "default" | "number" | "onestar",
|
20
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
21
|
+
icon?: string,
|
22
|
+
id?: string,
|
23
|
+
rating: number,
|
24
|
+
denominator: number,
|
25
|
+
colorOption?: "yellow" | "primary" | "subtle" | "outline",
|
26
|
+
backgroundType?: "fill" | "outline",
|
27
|
+
size?: "xs" | "sm" | "md" | "lg",
|
28
|
+
variant?: "display" | "interactive",
|
29
|
+
onClick?: (interactiveStarValue: number) => void,
|
28
30
|
} & GlobalProps
|
29
31
|
|
30
32
|
const StarRating = (props: StarRatingProps) => {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
const {
|
34
|
+
aria = {},
|
35
|
+
className,
|
36
|
+
data = {},
|
37
|
+
dark = false,
|
38
|
+
layoutOption = "default",
|
39
|
+
htmlOptions = {},
|
40
|
+
id,
|
41
|
+
rating = 0,
|
42
|
+
denominator = 5,
|
43
|
+
colorOption = "yellow",
|
44
|
+
backgroundType = "fill",
|
45
|
+
size = "sm",
|
46
|
+
variant = "display",
|
47
|
+
onClick,
|
48
|
+
} = props
|
49
|
+
const classes = classnames(buildCss('pb_star_rating_kit'), globalProps(props), className)
|
50
|
+
const ariaProps = buildAriaProps(aria)
|
51
|
+
const dataProps = buildDataProps(data)
|
52
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
53
|
+
const oneDecimalRating = rating.toFixed(1)
|
45
54
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
return (
|
87
|
-
<div
|
88
|
-
{...ariaProps}
|
89
|
-
{...dataProps}
|
90
|
-
{...htmlProps}
|
91
|
-
className={classes}
|
92
|
-
id={id}
|
93
|
-
>
|
94
|
-
{layoutOption === "number" && (
|
95
|
-
<>
|
96
|
-
{size === 'xs' && (
|
97
|
-
<Caption
|
98
|
-
text={oneDecimalRating.toString()}
|
99
|
-
size="xs"
|
100
|
-
paddingRight="xs"
|
101
|
-
dark={dark}
|
102
|
-
className="pb_star_rating_number_sm"
|
103
|
-
/>
|
104
|
-
)}
|
105
|
-
{size === 'sm' && (
|
106
|
-
<Caption
|
107
|
-
text={oneDecimalRating.toString()}
|
108
|
-
size="xs"
|
109
|
-
paddingRight="xs"
|
110
|
-
dark={dark}
|
111
|
-
className="pb_star_rating_number_sm"
|
112
|
-
/>
|
55
|
+
return (
|
56
|
+
<div
|
57
|
+
{...ariaProps}
|
58
|
+
{...dataProps}
|
59
|
+
{...htmlProps}
|
60
|
+
className={classes}
|
61
|
+
id={id}
|
62
|
+
>
|
63
|
+
{layoutOption === "number" && (
|
64
|
+
<>
|
65
|
+
{(size === 'xs' || size === 'sm') && (
|
66
|
+
<Caption
|
67
|
+
className="pb_star_rating_number_sm"
|
68
|
+
dark={dark}
|
69
|
+
paddingRight="xs"
|
70
|
+
size="xs"
|
71
|
+
text={oneDecimalRating.toString()}
|
72
|
+
/>
|
73
|
+
)}
|
74
|
+
{size === 'md' && (
|
75
|
+
<Body
|
76
|
+
className="pb_star_rating_number_md"
|
77
|
+
color="light"
|
78
|
+
dark={dark}
|
79
|
+
paddingRight="xs"
|
80
|
+
text={oneDecimalRating.toString()}
|
81
|
+
/>
|
82
|
+
)}
|
83
|
+
{size === 'lg' && (
|
84
|
+
<Title
|
85
|
+
bold={false}
|
86
|
+
className="pb_star_rating_number_lg"
|
87
|
+
color="light"
|
88
|
+
dark={dark}
|
89
|
+
paddingRight="sm"
|
90
|
+
size={2}
|
91
|
+
text={oneDecimalRating.toString()}
|
92
|
+
/>
|
93
|
+
)}
|
94
|
+
</>
|
113
95
|
)}
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
text={oneDecimalRating.toString()}
|
126
|
-
size={2}
|
127
|
-
paddingRight="sm"
|
128
|
-
dark={dark}
|
129
|
-
color="light"
|
130
|
-
bold={false}
|
131
|
-
className="pb_star_rating_number_lg"
|
132
|
-
/>
|
133
|
-
)}
|
134
|
-
</>
|
135
|
-
)}
|
136
|
-
<Flex className="star_flex_area">
|
137
|
-
{[...Array(activeStars)].map((_, index) => (
|
138
|
-
<React.Fragment key={index}>
|
139
|
-
{colorOption === 'yellow' && (
|
140
|
-
<Icon
|
141
|
-
// @ts-ignore
|
142
|
-
customIcon={starYellow}
|
143
|
-
className={iconSize}
|
144
|
-
/>
|
145
|
-
) }
|
146
|
-
{colorOption === 'primary' && (
|
147
|
-
<Icon
|
148
|
-
// @ts-ignore
|
149
|
-
customIcon={starPrimary}
|
150
|
-
className={iconSize}
|
151
|
-
/>
|
152
|
-
) }
|
153
|
-
{colorOption === 'subtle' && (
|
154
|
-
<Icon
|
155
|
-
// @ts-ignore
|
156
|
-
customIcon={starSubtle}
|
157
|
-
className={iconSize}
|
158
|
-
/>
|
159
|
-
) }
|
160
|
-
</React.Fragment>
|
161
|
-
))}
|
162
|
-
{[...Array(emptyStars)].map((_, index) => (
|
163
|
-
<React.Fragment key={index}>
|
164
|
-
{backgroundType === 'outline' && (
|
165
|
-
<Icon
|
166
|
-
// @ts-ignore
|
167
|
-
customIcon={starOutline}
|
168
|
-
className={iconSize}
|
169
|
-
/>
|
170
|
-
) }
|
171
|
-
{backgroundType !== 'outline' && (
|
172
|
-
<Icon
|
173
|
-
// @ts-ignore
|
174
|
-
customIcon={starBackground}
|
175
|
-
className={iconSize}
|
176
|
-
/>
|
177
|
-
) }
|
178
|
-
</React.Fragment>
|
179
|
-
))}
|
180
|
-
</Flex>
|
181
|
-
{layoutOption === "onestar" && (
|
182
|
-
<>
|
183
|
-
{size === 'xs' && (
|
184
|
-
<Caption
|
185
|
-
text={`${rating.toString()} of ${denominator}`}
|
186
|
-
size="xs"
|
187
|
-
dark={dark}
|
188
|
-
className="pb_star_rating_number_sm"
|
189
|
-
/>
|
190
|
-
)}
|
191
|
-
{size === 'sm' && (
|
192
|
-
<Caption
|
193
|
-
text={`${rating.toString()} of ${denominator}`}
|
194
|
-
size="xs"
|
195
|
-
dark={dark}
|
196
|
-
className="pb_star_rating_number_sm"
|
197
|
-
/>
|
96
|
+
|
97
|
+
{variant === "display" && (
|
98
|
+
<StarRatingDisplay
|
99
|
+
backgroundType={backgroundType}
|
100
|
+
colorOption={colorOption}
|
101
|
+
dark={dark}
|
102
|
+
denominator={denominator}
|
103
|
+
layoutOption={layoutOption}
|
104
|
+
rating={rating}
|
105
|
+
size={size}
|
106
|
+
/>
|
198
107
|
)}
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
108
|
+
|
109
|
+
{variant === "interactive" && (
|
110
|
+
<StarRatingInteractive
|
111
|
+
backgroundType={backgroundType}
|
112
|
+
colorOption={colorOption}
|
113
|
+
dark={dark}
|
114
|
+
denominator={denominator}
|
115
|
+
onClick={onClick}
|
116
|
+
size={size}
|
117
|
+
/>
|
206
118
|
)}
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
119
|
+
|
120
|
+
{layoutOption === "onestar" && (
|
121
|
+
<>
|
122
|
+
{(size === 'xs' || size === 'sm') && (
|
123
|
+
<Caption
|
124
|
+
className="pb_star_rating_number_sm"
|
125
|
+
dark={dark}
|
126
|
+
size="xs"
|
127
|
+
text={`${rating.toString()} of ${denominator}`}
|
128
|
+
/>
|
129
|
+
)}
|
130
|
+
{size === 'md' && (
|
131
|
+
<Body
|
132
|
+
className="pb_star_rating_number_md"
|
133
|
+
color="light"
|
134
|
+
dark={dark}
|
135
|
+
text={`${rating.toString()} of ${denominator}`}
|
136
|
+
/>
|
137
|
+
)}
|
138
|
+
{size === 'lg' && (
|
139
|
+
<Title
|
140
|
+
bold={false}
|
141
|
+
className="pb_star_rating_number_lg"
|
142
|
+
color="light"
|
143
|
+
dark={dark}
|
144
|
+
size={2}
|
145
|
+
text={`${rating.toString()} of ${denominator}`}
|
146
|
+
/>
|
147
|
+
)}
|
148
|
+
</>
|
216
149
|
)}
|
217
|
-
|
218
|
-
)}
|
219
|
-
</div>
|
150
|
+
</div>
|
220
151
|
)
|
221
|
-
|
152
|
+
}
|
222
153
|
|
223
154
|
export default StarRating
|