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
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.33.1
|
4
|
+
version: 13.33.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
8
8
|
- Power Devs
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-07-
|
12
|
+
date: 2024-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1332,8 +1332,6 @@ files:
|
|
1332
1332
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.html.erb
|
1333
1333
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.jsx
|
1334
1334
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.md
|
1335
|
-
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.html.erb
|
1336
|
-
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.jsx
|
1337
1335
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.html.erb
|
1338
1336
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.jsx
|
1339
1337
|
- app/pb_kits/playbook/pb_form_pill/docs/_form_pill_tag.html.erb
|
@@ -1439,9 +1437,6 @@ files:
|
|
1439
1437
|
- app/pb_kits/playbook/pb_icon/docs/_icon_border.html.erb
|
1440
1438
|
- app/pb_kits/playbook/pb_icon/docs/_icon_border.jsx
|
1441
1439
|
- app/pb_kits/playbook/pb_icon/docs/_icon_border_swift.md
|
1442
|
-
- app/pb_kits/playbook/pb_icon/docs/_icon_color.html.erb
|
1443
|
-
- app/pb_kits/playbook/pb_icon/docs/_icon_color.jsx
|
1444
|
-
- app/pb_kits/playbook/pb_icon/docs/_icon_color.md
|
1445
1440
|
- app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb
|
1446
1441
|
- app/pb_kits/playbook/pb_icon/docs/_icon_custom.jsx
|
1447
1442
|
- app/pb_kits/playbook/pb_icon/docs/_icon_custom.md
|
@@ -2344,7 +2339,6 @@ files:
|
|
2344
2339
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb
|
2345
2340
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx
|
2346
2341
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.html.erb
|
2347
|
-
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.jsx
|
2348
2342
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb
|
2349
2343
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx
|
2350
2344
|
- app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb
|
@@ -2359,10 +2353,7 @@ files:
|
|
2359
2353
|
- app/pb_kits/playbook/pb_star_rating/stars/star_outline.svg
|
2360
2354
|
- app/pb_kits/playbook/pb_star_rating/stars/subtle_dark_star.svg
|
2361
2355
|
- app/pb_kits/playbook/pb_star_rating/stars/subtle_star.svg
|
2362
|
-
- app/pb_kits/playbook/pb_star_rating/stars/utils.tsx
|
2363
2356
|
- app/pb_kits/playbook/pb_star_rating/stars/yellow_star.svg
|
2364
|
-
- app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx
|
2365
|
-
- app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx
|
2366
2357
|
- app/pb_kits/playbook/pb_stat_change/_stat_change.scss
|
2367
2358
|
- app/pb_kits/playbook/pb_stat_change/_stat_change.tsx
|
2368
2359
|
- app/pb_kits/playbook/pb_stat_change/docs/_description.md
|
@@ -3069,7 +3060,7 @@ homepage: https://playbook.powerapp.cloud/
|
|
3069
3060
|
licenses:
|
3070
3061
|
- ISC
|
3071
3062
|
metadata: {}
|
3072
|
-
post_install_message:
|
3063
|
+
post_install_message:
|
3073
3064
|
rdoc_options: []
|
3074
3065
|
require_paths:
|
3075
3066
|
- lib
|
@@ -3085,7 +3076,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
3085
3076
|
version: '0'
|
3086
3077
|
requirements: []
|
3087
3078
|
rubygems_version: 3.5.3
|
3088
|
-
signing_key:
|
3079
|
+
signing_key:
|
3089
3080
|
specification_version: 4
|
3090
3081
|
summary: Playbook Design System
|
3091
3082
|
test_files: []
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import FormPill from '../_form_pill'
|
3
|
-
|
4
|
-
const FormPillIcon = (props) => {
|
5
|
-
return (
|
6
|
-
<div>
|
7
|
-
<FormPill
|
8
|
-
icon="badge-check"
|
9
|
-
onClick={() => {
|
10
|
-
alert('Click!')
|
11
|
-
}}
|
12
|
-
tabIndex={0}
|
13
|
-
text="icon and tag"
|
14
|
-
{...props}
|
15
|
-
/>
|
16
|
-
</div>
|
17
|
-
)
|
18
|
-
}
|
19
|
-
export default FormPillIcon
|
@@ -1,5 +0,0 @@
|
|
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 %>
|
@@ -1,34 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import StarRating from '../_star_rating'
|
3
|
-
|
4
|
-
const StarRatingInteractive = (props) => (
|
5
|
-
<>
|
6
|
-
<StarRating
|
7
|
-
paddingBottom="xs"
|
8
|
-
variant="interactive"
|
9
|
-
{...props}
|
10
|
-
/>
|
11
|
-
</>
|
12
|
-
)
|
13
|
-
|
14
|
-
export default StarRatingInteractive
|
@@ -1,81 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
|
3
|
-
const starYellow = (
|
4
|
-
<svg className="iamyellow"
|
5
|
-
fill="none"
|
6
|
-
viewBox="0 0 18 16"
|
7
|
-
xmlns="http://www.w3.org/2000/svg"
|
8
|
-
>
|
9
|
-
<path clipRule="evenodd"
|
10
|
-
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"
|
11
|
-
fill="#F9BB00"
|
12
|
-
fillRule="evenodd"
|
13
|
-
/>
|
14
|
-
</svg>
|
15
|
-
)
|
16
|
-
|
17
|
-
const starPrimary = (
|
18
|
-
<svg fill="none"
|
19
|
-
viewBox="0 0 18 16"
|
20
|
-
xmlns="http://www.w3.org/2000/svg"
|
21
|
-
>
|
22
|
-
<path clipRule="evenodd"
|
23
|
-
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"
|
24
|
-
fill="#0056CF"
|
25
|
-
fillRule="evenodd"
|
26
|
-
/>
|
27
|
-
</svg>
|
28
|
-
)
|
29
|
-
|
30
|
-
const starSubtle = (
|
31
|
-
<svg fill="none"
|
32
|
-
viewBox="0 0 18 16"
|
33
|
-
xmlns="http://www.w3.org/2000/svg"
|
34
|
-
>
|
35
|
-
<path clipRule="evenodd"
|
36
|
-
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"
|
37
|
-
fillRule="evenodd"
|
38
|
-
/>
|
39
|
-
</svg>
|
40
|
-
)
|
41
|
-
|
42
|
-
const starOutline = (
|
43
|
-
<svg fill="none"
|
44
|
-
height="16"
|
45
|
-
viewBox="0 0 17 16"
|
46
|
-
width="17"
|
47
|
-
xmlns="http://www.w3.org/2000/svg"
|
48
|
-
>
|
49
|
-
<path 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.48395L12.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.91031 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"
|
50
|
-
stroke="#C1CDD6"
|
51
|
-
/>
|
52
|
-
</svg>
|
53
|
-
)
|
54
|
-
|
55
|
-
export const getStarIconObject = (backgroundType: string, color: string, dark: boolean, size: string) => {
|
56
|
-
const colorClassName = color === "subtle" ? (dark ? "suble_star_dark" : "suble_star_light") : `${color}_star`
|
57
|
-
const backgroundClassName = backgroundType === "outline" ? (dark ? "outline_empty_star_dark" : "outline_empty_star_light") : (dark ? "empty_star_dark" : "empty_star_light")
|
58
|
-
|
59
|
-
return {
|
60
|
-
yellow: {
|
61
|
-
className: `pb_star_${size} ${colorClassName}`,
|
62
|
-
icon: starYellow
|
63
|
-
},
|
64
|
-
primary: {
|
65
|
-
className: `pb_star_${size} ${colorClassName}`,
|
66
|
-
icon: starPrimary
|
67
|
-
},
|
68
|
-
subtle: {
|
69
|
-
className: `pb_star_${size} ${colorClassName}`,
|
70
|
-
icon: starSubtle
|
71
|
-
},
|
72
|
-
fill: {
|
73
|
-
className: `pb_star_${size} ${backgroundClassName}`,
|
74
|
-
icon: starYellow
|
75
|
-
},
|
76
|
-
outline: {
|
77
|
-
className: `pb_star_${size} ${backgroundClassName}`,
|
78
|
-
icon: starOutline
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { GlobalProps } from '../../utilities/globalProps'
|
3
|
-
import Icon from '../../pb_icon/_icon'
|
4
|
-
import Flex from '../../pb_flex/_flex'
|
5
|
-
import { getStarIconObject } from "../stars/utils"
|
6
|
-
|
7
|
-
type StarRatingDisplayProps = {
|
8
|
-
backgroundType: "fill" | "outline",
|
9
|
-
colorOption: "yellow" | "primary" | "subtle" | "outline",
|
10
|
-
dark: boolean,
|
11
|
-
denominator: number,
|
12
|
-
layoutOption: "default" | "number" | "onestar",
|
13
|
-
rating: number,
|
14
|
-
size: "xs" | "sm" | "md" | "lg",
|
15
|
-
} & GlobalProps
|
16
|
-
|
17
|
-
const StarRatingDisplay = (props: StarRatingDisplayProps) => {
|
18
|
-
const {
|
19
|
-
backgroundType,
|
20
|
-
colorOption,
|
21
|
-
dark,
|
22
|
-
denominator,
|
23
|
-
layoutOption,
|
24
|
-
rating,
|
25
|
-
size,
|
26
|
-
} = props
|
27
|
-
const denominatorStyle = layoutOption === "onestar" ? 1 : denominator
|
28
|
-
const activeStars = Math.round(rating) > denominatorStyle ? denominatorStyle : Math.round(rating)
|
29
|
-
const emptyStars = denominatorStyle - Math.round(rating) < 0 ? 0 : denominatorStyle - Math.round(rating)
|
30
|
-
const starIcon = getStarIconObject(backgroundType, colorOption, dark, size)
|
31
|
-
|
32
|
-
return (
|
33
|
-
<Flex className="star_flex_area">
|
34
|
-
{[...Array(activeStars)].map((_, index) => (
|
35
|
-
<React.Fragment key={index}>
|
36
|
-
<Icon
|
37
|
-
className={starIcon[colorOption].className}
|
38
|
-
customIcon={starIcon[colorOption].icon as unknown as { [key: string]: SVGElement }}
|
39
|
-
icon=""
|
40
|
-
/>
|
41
|
-
</React.Fragment>
|
42
|
-
))}
|
43
|
-
{[...Array(emptyStars)].map((_, index) => (
|
44
|
-
<React.Fragment key={index}>
|
45
|
-
<Icon
|
46
|
-
className={starIcon[backgroundType].className}
|
47
|
-
customIcon={starIcon[backgroundType].icon as unknown as { [key: string]: SVGElement }}
|
48
|
-
icon=""
|
49
|
-
/>
|
50
|
-
</React.Fragment>
|
51
|
-
))}
|
52
|
-
</Flex>
|
53
|
-
)
|
54
|
-
}
|
55
|
-
|
56
|
-
export default StarRatingDisplay
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import React, { useState } from "react"
|
2
|
-
import { GlobalProps } from '../../utilities/globalProps'
|
3
|
-
import Icon from '../../pb_icon/_icon'
|
4
|
-
import Flex from '../../pb_flex/_flex'
|
5
|
-
import { getStarIconObject } from "../stars/utils"
|
6
|
-
|
7
|
-
type StarRatingInteractiveProps = {
|
8
|
-
backgroundType: "fill" | "outline",
|
9
|
-
colorOption: "yellow" | "primary" | "subtle" | "outline",
|
10
|
-
dark: boolean,
|
11
|
-
denominator: number,
|
12
|
-
onClick?: (interactiveStarValue: number) => void,
|
13
|
-
size: "xs" | "sm" | "md" | "lg",
|
14
|
-
} & GlobalProps
|
15
|
-
|
16
|
-
const StarRatingInteractive = (props: StarRatingInteractiveProps) => {
|
17
|
-
const {
|
18
|
-
backgroundType,
|
19
|
-
colorOption,
|
20
|
-
dark,
|
21
|
-
denominator,
|
22
|
-
onClick,
|
23
|
-
size,
|
24
|
-
} = props
|
25
|
-
const [interactiveStarValue, setInteractiveStarValue] = useState(0)
|
26
|
-
const starIcon = getStarIconObject(backgroundType, colorOption, dark, size)
|
27
|
-
|
28
|
-
const handleOnClick = (interactiveStarValue: number) => {
|
29
|
-
setInteractiveStarValue(interactiveStarValue)
|
30
|
-
onClick && onClick(interactiveStarValue)
|
31
|
-
}
|
32
|
-
|
33
|
-
return (
|
34
|
-
<Flex className="star_flex_area">
|
35
|
-
{[...Array(denominator)].map((_, index) => (
|
36
|
-
<React.Fragment key={index}>
|
37
|
-
{index + 1 <= interactiveStarValue && (
|
38
|
-
<Icon
|
39
|
-
className={starIcon[colorOption].className}
|
40
|
-
cursor="pointer"
|
41
|
-
customIcon={starIcon[colorOption].icon as unknown as { [key: string]: SVGElement }}
|
42
|
-
htmlOptions={{ onClick: () => handleOnClick(index + 1) }}
|
43
|
-
icon=""
|
44
|
-
/>
|
45
|
-
)}
|
46
|
-
|
47
|
-
{index + 1 > interactiveStarValue && (
|
48
|
-
<React.Fragment key={index}>
|
49
|
-
<Icon
|
50
|
-
className={starIcon[backgroundType].className}
|
51
|
-
cursor="pointer"
|
52
|
-
customIcon={starIcon[backgroundType].icon as unknown as { [key: string]: SVGElement }}
|
53
|
-
htmlOptions={{ onClick: () => handleOnClick(index + 1) }}
|
54
|
-
icon=""
|
55
|
-
/>
|
56
|
-
</React.Fragment>
|
57
|
-
)}
|
58
|
-
</React.Fragment>
|
59
|
-
))}
|
60
|
-
</Flex>
|
61
|
-
)
|
62
|
-
}
|
63
|
-
|
64
|
-
export default StarRatingInteractive
|