playbook_ui 13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 → 13.33.1
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 +11 -2
- data/app/pb_kits/playbook/pb_body/body.html.erb +6 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +6 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +6 -1
- data/app/pb_kits/playbook/pb_caption/caption.html.erb +6 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +7 -1
- 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 +32 -31
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +2 -3
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +32 -33
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +7 -3
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +0 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -9
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +19 -25
- data/app/pb_kits/playbook/pb_contact/contact.html.erb +3 -6
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +64 -71
- data/app/pb_kits/playbook/pb_detail/detail.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +5 -2
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +6 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +3 -7
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -1
- data/app/pb_kits/playbook/pb_dropdown/index.js +31 -37
- data/app/pb_kits/playbook/pb_flex/flex.html.erb +5 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +0 -4
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +0 -11
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +17 -52
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +1 -2
- 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 +9 -16
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -6
- data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +6 -1
- data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +5 -1
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +5 -1
- data/app/pb_kits/playbook/pb_icon/_icon.scss +0 -17
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +0 -3
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_icon/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -9
- data/app/pb_kits/playbook/pb_icon/icon.test.js +9 -22
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.scss +11 -0
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +201 -132
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +33 -28
- data/app/pb_kits/playbook/pb_star_rating/docs/index.js +0 -2
- data/dist/playbook-rails.js +6 -6
- data/lib/playbook/version.rb +2 -2
- metadata +5 -14
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.html.erb +0 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.jsx +0 -19
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb +0 -5
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx +0 -34
- data/app/pb_kits/playbook/pb_icon/docs/_icon_color.md +0 -1
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.jsx +0 -14
- data/app/pb_kits/playbook/pb_star_rating/stars/utils.tsx +0 -81
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx +0 -56
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +0 -64
@@ -1,20 +1,3 @@
|
|
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
|
18
1
|
svg.pb_custom_icon {
|
19
2
|
width: 1em;
|
20
3
|
fill: currentColor;
|
@@ -23,7 +23,6 @@ type IconProps = {
|
|
23
23
|
aria?: {[key: string]: string},
|
24
24
|
border?: string,
|
25
25
|
className?: string,
|
26
|
-
color?: string,
|
27
26
|
customIcon?: {[key: string] :SVGElement},
|
28
27
|
data?: {[key: string]: string},
|
29
28
|
fixedWidth?: boolean,
|
@@ -122,7 +121,6 @@ const Icon = (props: IconProps) => {
|
|
122
121
|
aria = {},
|
123
122
|
border = false,
|
124
123
|
className,
|
125
|
-
color,
|
126
124
|
customIcon,
|
127
125
|
data = {},
|
128
126
|
fixedWidth = true,
|
@@ -171,7 +169,6 @@ const Icon = (props: IconProps) => {
|
|
171
169
|
(!iconElement && !customIcon) ? 'pb_icon_kit' : '',
|
172
170
|
(iconElement || customIcon) ? 'pb_custom_icon' : fontStyle,
|
173
171
|
iconElement ? 'svg-inline--fa' : '',
|
174
|
-
color ? `color_${color}` : '',
|
175
172
|
globalProps(props),
|
176
173
|
className
|
177
174
|
)
|
@@ -9,7 +9,6 @@ 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
|
13
12
|
|
14
13
|
react:
|
15
14
|
- icon_default: Icon Default
|
@@ -21,7 +20,6 @@ examples:
|
|
21
20
|
- icon_sizes: Icon Sizes
|
22
21
|
- icon_custom: Icon Custom
|
23
22
|
- icon_fa_kit: Icon with FontAwesome Kit
|
24
|
-
- icon_color: Icon Color
|
25
23
|
|
26
24
|
swift:
|
27
25
|
- icon_default_swift: Icon Default
|
@@ -7,4 +7,3 @@ 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,7 +36,6 @@ 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
|
40
39
|
|
41
40
|
def valid_emoji?
|
42
41
|
emoji_regex = /\p{Emoji}/
|
@@ -46,7 +45,6 @@ module Playbook
|
|
46
45
|
def classname
|
47
46
|
generate_classname(
|
48
47
|
"pb_icon_kit",
|
49
|
-
color_class,
|
50
48
|
font_style_class,
|
51
49
|
icon_class,
|
52
50
|
border_class,
|
@@ -67,7 +65,6 @@ module Playbook
|
|
67
65
|
generate_classname(
|
68
66
|
"pb_icon_kit",
|
69
67
|
border_class,
|
70
|
-
color_class,
|
71
68
|
fixed_width_class,
|
72
69
|
flip_class,
|
73
70
|
inverse_class,
|
@@ -107,8 +104,7 @@ module Playbook
|
|
107
104
|
svg["aria"] = object.aria
|
108
105
|
svg["height"] = "auto"
|
109
106
|
svg["width"] = "auto"
|
110
|
-
|
111
|
-
doc.at_css("path")["fill"] = fill_color
|
107
|
+
doc.at_css("path")["fill"] = "currentColor"
|
112
108
|
raw doc
|
113
109
|
end
|
114
110
|
|
@@ -204,10 +200,6 @@ module Playbook
|
|
204
200
|
class_name = is_svg? ? "spin" : "fa-spin"
|
205
201
|
spin ? class_name : nil
|
206
202
|
end
|
207
|
-
|
208
|
-
def color_class
|
209
|
-
color ? "color_#{color}" : nil
|
210
|
-
end
|
211
203
|
end
|
212
204
|
end
|
213
205
|
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,24 +145,11 @@ 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
|
-
|
168
155
|
})
|
@@ -50,4 +50,15 @@
|
|
50
50
|
margin-right: $space-sm;
|
51
51
|
}
|
52
52
|
}
|
53
|
+
[class^=pb_title_kit_1] + [class^=pb_body_kit] {
|
54
|
+
font-size: 36px;
|
55
|
+
}
|
56
|
+
|
57
|
+
[class^=pb_title_kit_2] + [class^=pb_body_kit] {
|
58
|
+
font-size: 24px
|
59
|
+
}
|
60
|
+
|
61
|
+
[class^=pb_title_kit_3] + [class^=pb_body_kit] {
|
62
|
+
font-size: 20px;
|
63
|
+
}
|
53
64
|
}
|
@@ -7,148 +7,217 @@ 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 Icon from '../pb_icon/_icon'
|
11
|
+
import Flex from '../pb_flex/_flex'
|
12
12
|
|
13
13
|
type StarRatingProps = {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
variant?: "display" | "interactive",
|
29
|
-
onClick?: (interactiveStarValue: number) => void,
|
14
|
+
aria?: {[key: string]: string},
|
15
|
+
className?: string,
|
16
|
+
data?: object,
|
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";
|
30
28
|
} & GlobalProps
|
31
29
|
|
32
30
|
const StarRating = (props: StarRatingProps) => {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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)
|
31
|
+
const {
|
32
|
+
aria = {},
|
33
|
+
className,
|
34
|
+
data = {},
|
35
|
+
dark = false,
|
36
|
+
layoutOption = "default",
|
37
|
+
htmlOptions = {},
|
38
|
+
id,
|
39
|
+
rating = 0,
|
40
|
+
denominator = 5,
|
41
|
+
colorOption = "yellow",
|
42
|
+
backgroundType = "fill",
|
43
|
+
size = "sm",
|
44
|
+
} = props
|
54
45
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
-
</>
|
95
|
-
)}
|
46
|
+
const classes = classnames(buildCss('pb_star_rating_kit'), globalProps(props), className)
|
47
|
+
const ariaProps = buildAriaProps(aria)
|
48
|
+
const dataProps = buildDataProps(data)
|
49
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
50
|
+
const denominatorStyle = layoutOption === "onestar" ? 1 : denominator
|
51
|
+
const activeStars = Math.round(rating) > denominatorStyle ? denominatorStyle : Math.round(rating)
|
52
|
+
const emptyStars = denominatorStyle - Math.round(rating) < 0 ? 0 : denominatorStyle - Math.round(rating)
|
53
|
+
const oneDecimalRating = rating.toFixed(1)
|
54
|
+
let iconSize = `pb_star_${size}`
|
96
55
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
denominator={denominator}
|
103
|
-
layoutOption={layoutOption}
|
104
|
-
rating={rating}
|
105
|
-
size={size}
|
106
|
-
/>
|
107
|
-
)}
|
56
|
+
const starYellow = (
|
57
|
+
<svg className="iamyellow" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
58
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" fill="#F9BB00"/>
|
59
|
+
</svg>
|
60
|
+
)
|
108
61
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
62
|
+
const starPrimary = (
|
63
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
64
|
+
<path fillRule="evenodd" clipRule="evenodd" d="M9.86015 0.4371C9.73527 0.187329 9.4855 0 9.17328 0C8.89229 0 8.64252 0.187329 8.51763 0.4371L6.36335 4.83932L1.58647 5.55742C1.30547 5.58864 1.08692 5.80719 0.99326 6.05696C0.899595 6.33795 0.962038 6.61895 1.18059 6.8375L4.64617 10.2719L3.80319 15.1112C3.77197 15.3922 3.89685 15.7044 4.11541 15.8605C4.36518 16.0166 4.64617 16.0478 4.89594 15.9229L9.17328 13.6126L13.4506 15.9229C13.7004 16.0478 14.0126 16.0166 14.2624 15.8605C14.4809 15.7044 14.6058 15.3922 14.5434 15.1112L13.7316 10.2719L17.1972 6.8375C17.4157 6.61895 17.4782 6.33795 17.3845 6.05696C17.2909 5.80719 17.0723 5.58864 16.7913 5.55742L12.0144 4.83932L9.86015 0.4371Z" fill="#0056CF"/>
|
65
|
+
</svg>
|
66
|
+
);
|
67
|
+
|
68
|
+
const starSubtle = (
|
69
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
70
|
+
<path className={dark === true ? "suble_star_dark" : "suble_star_light"} fillRule="evenodd" clipRule="evenodd" d="M8.90904 0.4371C8.78416 0.187329 8.53438 0 8.22217 0C7.94118 0 7.69141 0.187329 7.56652 0.4371L5.41224 4.83932L0.635357 5.55742C0.354364 5.58864 0.135813 5.80719 0.042149 6.05696C-0.0515154 6.33795 0.0109275 6.61895 0.229478 6.8375L3.69506 10.2719L2.85208 15.1112C2.82086 15.3922 2.94574 15.7044 3.16429 15.8605C3.41407 16.0166 3.69506 16.0478 3.94483 15.9229L8.22217 13.6126L12.4995 15.9229C12.7493 16.0478 13.0615 16.0166 13.3113 15.8605C13.5298 15.7044 13.6547 15.3922 13.5923 15.1112L12.7805 10.2719L16.2461 6.8375C16.4646 6.61895 16.5271 6.33795 16.4334 6.05696C16.3397 5.80719 16.1212 5.58864 15.8402 5.55742L11.0633 4.83932L8.90904 0.4371Z" />
|
71
|
+
</svg>
|
72
|
+
);
|
119
73
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
74
|
+
const starBackground = (
|
75
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
76
|
+
<path className={dark === true ? "empty_star_dark" : "empty_star_light"} fillRule="evenodd" clipRule="evenodd" d="M9.31126 0.4371C9.18638 0.187329 8.93661 0 8.62439 0C8.3434 0 8.09363 0.187329 7.96874 0.4371L5.81446 4.83932L1.03758 5.55742C0.756585 5.58864 0.538035 5.80719 0.444371 6.05696C0.350706 6.33795 0.413149 6.61895 0.631699 6.8375L4.09728 10.2719L3.2543 15.1112C3.22308 15.3922 3.34797 15.7044 3.56652 15.8605C3.81629 16.0166 4.09728 16.0478 4.34705 15.9229L8.62439 13.6126L12.9017 15.9229C13.1515 16.0478 13.4637 16.0166 13.7135 15.8605C13.932 15.7044 14.0569 15.3922 13.9945 15.1112L13.1827 10.2719L16.6483 6.8375C16.8669 6.61895 16.9293 6.33795 16.8356 6.05696C16.742 5.80719 16.5234 5.58864 16.2424 5.55742L11.4655 4.83932L9.31126 0.4371Z" />
|
77
|
+
</svg>
|
78
|
+
)
|
79
|
+
|
80
|
+
const starOutline = (
|
81
|
+
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
82
|
+
<path className={dark === true ? "outline_star_dark" : "outline_star_light"} d="M5.91323 5.33377L6.17269 5.29477L6.28801 5.0591L8.44116 0.659187C8.49971 0.543364 8.59517 0.5 8.64884 0.5C8.74499 0.5 8.83506 0.555009 8.88775 0.659235L11.0409 5.0591L11.1562 5.29477L11.4157 5.33377L16.1925 6.05186L16.2021 6.0533L16.2117 6.05436C16.2359 6.05706 16.2671 6.06847 16.3024 6.09973C16.3374 6.13062 16.3686 6.17476 16.3886 6.22412C16.4186 6.32162 16.401 6.40181 16.3198 6.48332C16.3196 6.48353 16.3194 6.48374 16.3192 6.48394L12.8552 9.91671L12.6712 10.0991L12.7141 10.3546L13.5258 15.1939L13.528 15.2068L13.5308 15.2196C13.5488 15.3004 13.5074 15.402 13.4567 15.4462C13.3391 15.5132 13.2227 15.5096 13.1546 15.4781L8.88646 13.1726L8.64884 13.0443L8.41121 13.1726L4.14274 15.4782C4.07877 15.5083 3.99031 15.5147 3.87267 15.4466C3.82302 15.4033 3.76655 15.2914 3.77463 15.1781L4.61431 10.3577L4.65911 10.1005L4.47368 9.91671L1.0097 6.48394C1.00947 6.48372 1.00925 6.4835 1.00903 6.48327C0.927878 6.40178 0.910311 6.3216 0.94026 6.22412C0.960274 6.17476 0.99154 6.13062 1.02646 6.09973C1.0618 6.06847 1.09296 6.05706 1.11724 6.05436L1.12682 6.0533L1.13635 6.05186L5.91323 5.33377Z"/>
|
83
|
+
</svg>
|
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
|
+
/>
|
113
|
+
)}
|
114
|
+
{size === 'md' && (
|
115
|
+
<Body
|
116
|
+
text={oneDecimalRating.toString()}
|
117
|
+
paddingRight="xs"
|
118
|
+
dark={dark}
|
119
|
+
color="light"
|
120
|
+
className="pb_star_rating_number_md"
|
121
|
+
/>
|
122
|
+
)}
|
123
|
+
{size === 'lg' && (
|
124
|
+
<Title
|
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
|
+
/>
|
198
|
+
)}
|
199
|
+
{size === 'md' && (
|
200
|
+
<Body
|
201
|
+
text={`${rating.toString()} of ${denominator}`}
|
202
|
+
dark={dark}
|
203
|
+
color="light"
|
204
|
+
className="pb_star_rating_number_md"
|
205
|
+
/>
|
206
|
+
)}
|
207
|
+
{size === 'lg' && (
|
208
|
+
<Title
|
209
|
+
text={`${rating.toString()} of ${denominator}`}
|
210
|
+
size={2}
|
211
|
+
dark={dark}
|
212
|
+
color="light"
|
213
|
+
bold={false}
|
214
|
+
className="pb_star_rating_number_lg"
|
215
|
+
/>
|
149
216
|
)}
|
150
|
-
|
217
|
+
</>
|
218
|
+
)}
|
219
|
+
</div>
|
151
220
|
)
|
152
|
-
}
|
221
|
+
}
|
153
222
|
|
154
223
|
export default StarRating
|
@@ -1,35 +1,40 @@
|
|
1
1
|
import React from 'react'
|
2
|
+
|
2
3
|
import StarRating from '../_star_rating'
|
3
4
|
|
4
5
|
const StarRatingHide = (props) => (
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
6
|
+
<>
|
7
|
+
|
8
|
+
<StarRating
|
9
|
+
paddingBottom="xs"
|
10
|
+
rating={3}
|
11
|
+
{...props}
|
12
|
+
/>
|
13
|
+
|
14
|
+
|
15
|
+
<StarRating
|
16
|
+
layoutOption={"number"}
|
17
|
+
paddingBottom="xs"
|
18
|
+
rating={2.8}
|
19
|
+
{...props}
|
20
|
+
/>
|
21
|
+
|
22
|
+
|
23
|
+
<StarRating
|
24
|
+
layoutOption={"number"}
|
25
|
+
paddingBottom="xs"
|
26
|
+
rating={3}
|
27
|
+
{...props}
|
28
|
+
/>
|
29
|
+
|
30
|
+
<StarRating
|
31
|
+
layoutOption={"onestar"}
|
32
|
+
paddingBottom="xs"
|
33
|
+
rating={3}
|
34
|
+
{...props}
|
35
|
+
/>
|
36
|
+
|
37
|
+
</>
|
33
38
|
)
|
34
39
|
|
35
40
|
export default StarRatingHide
|
@@ -9,5 +9,3 @@ export { default as StarRatingHide } from './_star_rating_hide.jsx'
|
|
9
9
|
export { default as StarRatingNumberConfig } from './_star_rating_number_config.jsx'
|
10
10
|
|
11
11
|
export { default as StarRatingSizeOptions } from './_star_rating_size_options.jsx'
|
12
|
-
|
13
|
-
export { default as StarRatingInteractive } from './_star_rating_interactive.jsx'
|