@skyscanner/backpack-web 37.1.0 → 37.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ export const getTypeByRating = (starNumber, rating) => {
30
30
  const BpkInteractiveStarRating = props => {
31
31
  const {
32
32
  className,
33
+ extraLarge,
33
34
  getStarLabel,
34
35
  hoverRating,
35
36
  id,
@@ -54,6 +55,7 @@ const BpkInteractiveStarRating = props => {
54
55
  onClick: event => onRatingSelect(starNumber, event),
55
56
  type: type,
56
57
  large: large,
58
+ extraLarge: extraLarge,
57
59
  onMouseEnter: event => onRatingHover(starNumber, event),
58
60
  selected: rating === starNumber,
59
61
  label: getStarLabel(starNumber, maxRating),
@@ -74,6 +76,7 @@ BpkInteractiveStarRating.propTypes = {
74
76
  className: PropTypes.string,
75
77
  hoverRating: PropTypes.number,
76
78
  large: PropTypes.bool,
79
+ extraLarge: PropTypes.bool,
77
80
  maxRating: PropTypes.number,
78
81
  onMouseLeave: PropTypes.func,
79
82
  onRatingHover: PropTypes.func,
@@ -84,6 +87,7 @@ BpkInteractiveStarRating.defaultProps = {
84
87
  className: null,
85
88
  hoverRating: 0,
86
89
  large: false,
90
+ extraLarge: false,
87
91
  maxRating: 5,
88
92
  onMouseLeave: () => null,
89
93
  onRatingHover: () => null,
@@ -22,6 +22,9 @@ import OutlineLargeIcon from "../../bpk-component-icon/lg/star-outline";
22
22
  import SmallIcon from "../../bpk-component-icon/sm/star";
23
23
  import HalfSmallIcon from "../../bpk-component-icon/sm/star-half";
24
24
  import OutlineSmallIcon from "../../bpk-component-icon/sm/star-outline";
25
+ import ExtraLargeIcon from "../../bpk-component-icon/xl/star";
26
+ import HalfExtraLargeIcon from "../../bpk-component-icon/xl/star-half";
27
+ import OutlineExtraLargeIcon from "../../bpk-component-icon/xl/star-outline";
25
28
  import { cssModules } from "../../bpk-react-utils";
26
29
  import STYLES from "./BpkStar.module.css";
27
30
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -34,12 +37,13 @@ export const STAR_TYPES = {
34
37
  const BpkStar = props => {
35
38
  const {
36
39
  className,
40
+ extraLarge,
37
41
  large,
38
42
  type,
39
43
  ...rest
40
44
  } = props;
41
- const iconClassNames = getClassName('bpk-star', large && 'bpk-star--large', type === STAR_TYPES.FULL && 'bpk-star--filled', className);
42
- const containerClassNames = getClassName('bpk-star__container', 'bpk-star__container--half-star', large && 'bpk-star__container--large', className);
45
+ const iconClassNames = getClassName('bpk-star', large && 'bpk-star--large', extraLarge && 'bpk-star--extra-large', type === STAR_TYPES.FULL && 'bpk-star--filled', className);
46
+ const containerClassNames = getClassName('bpk-star__container', 'bpk-star__container--half-star', large && 'bpk-star__container--large', extraLarge && 'bpk-star__container--extra-large', className);
43
47
  const halfIconClassNames = getClassName('bpk-star', 'bpk-star--half', 'bpk-star--filled');
44
48
  let Icon = SmallIcon;
45
49
  let OutlineIcon = OutlineSmallIcon;
@@ -49,6 +53,11 @@ const BpkStar = props => {
49
53
  OutlineIcon = OutlineLargeIcon;
50
54
  HalfIcon = HalfLargeIcon;
51
55
  }
56
+ if (extraLarge) {
57
+ Icon = ExtraLargeIcon;
58
+ OutlineIcon = OutlineExtraLargeIcon;
59
+ HalfIcon = HalfExtraLargeIcon;
60
+ }
52
61
  if (type === STAR_TYPES.HALF) {
53
62
  return (
54
63
  /*#__PURE__*/
@@ -79,11 +88,13 @@ const BpkStar = props => {
79
88
  BpkStar.propTypes = {
80
89
  type: PropTypes.oneOf([STAR_TYPES.EMPTY, STAR_TYPES.HALF, STAR_TYPES.FULL]).isRequired,
81
90
  className: PropTypes.string,
82
- large: PropTypes.bool
91
+ large: PropTypes.bool,
92
+ extraLarge: PropTypes.bool
83
93
  };
84
94
  BpkStar.defaultProps = {
85
95
  className: null,
86
- large: false
96
+ large: false,
97
+ extraLarge: false
87
98
  };
88
99
  export const BpkStarNonRtl = BpkStar;
89
100
  export default withRtlSupport(BpkStar);
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- .bpk-star{display:inline-flex;width:1rem;height:1rem;vertical-align:text-bottom;fill:rgba(0,0,0,.2)}.bpk-star--large{width:1.5rem;height:1.5rem;vertical-align:bottom}.bpk-star--half{position:absolute;left:0}.bpk-star--filled{fill:#f55d42;fill:var(--bpk-star-rating-filled-color, rgb(245, 93, 66))}.bpk-star__container{display:inline-flex;width:1rem;height:1rem}.bpk-star__container--half-star{position:relative;vertical-align:text-bottom}.bpk-star__container--large{width:1.5rem;height:1.5rem;vertical-align:bottom}
18
+ .bpk-star{display:inline-flex;width:1rem;height:1rem;vertical-align:text-bottom;fill:rgba(0,0,0,.2)}.bpk-star--large{width:1.5rem;height:1.5rem;vertical-align:bottom}.bpk-star--extra-large{width:2rem;height:2rem;vertical-align:bottom}.bpk-star--half{position:absolute;left:0}.bpk-star--filled{fill:#f55d42;fill:var(--bpk-star-rating-filled-color, rgb(245, 93, 66))}.bpk-star__container{display:inline-flex;width:1rem;height:1rem}.bpk-star__container--half-star{position:relative;vertical-align:text-bottom}.bpk-star__container--large{width:1.5rem;height:1.5rem;vertical-align:bottom}.bpk-star__container--extra-large{width:2rem;height:2rem;vertical-align:bottom}
@@ -38,6 +38,7 @@ export const ROUNDING_TYPES = {
38
38
  const BpkStarRating = props => {
39
39
  const {
40
40
  className,
41
+ extraLarge,
41
42
  large,
42
43
  maxRating,
43
44
  rating,
@@ -55,7 +56,8 @@ const BpkStarRating = props => {
55
56
  const type = getTypeByRating(starNumber, rounding(currentRating));
56
57
  stars.push(/*#__PURE__*/_jsx(BpkStar, {
57
58
  type: type,
58
- large: large
59
+ large: large,
60
+ extraLarge: extraLarge
59
61
  }, `star-${starNumber}`));
60
62
  }
61
63
  const label = typeof ratingLabel === 'string' ? ratingLabel : ratingLabel(rating, maxRating);
@@ -71,6 +73,7 @@ BpkStarRating.propTypes = {
71
73
  ratingLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
72
74
  className: PropTypes.string,
73
75
  large: PropTypes.bool,
76
+ extraLarge: PropTypes.bool,
74
77
  maxRating: PropTypes.number,
75
78
  rating: PropTypes.number,
76
79
  rounding: PropTypes.oneOf([ROUNDING_TYPES.down, ROUNDING_TYPES.up, ROUNDING_TYPES.nearest])
@@ -78,6 +81,7 @@ BpkStarRating.propTypes = {
78
81
  BpkStarRating.defaultProps = {
79
82
  className: null,
80
83
  large: false,
84
+ extraLarge: false,
81
85
  maxRating: 5,
82
86
  rating: 0,
83
87
  rounding: ROUNDING_TYPES.down
@@ -837,7 +837,7 @@
837
837
  content: '';
838
838
  display: block;
839
839
  width: 100%;
840
- height: tokens.$bpk-border-size-sm;
840
+ height: $bpk-border-size-sm;
841
841
  transition:
842
842
  width 0.2s ease 0s,
843
843
  left 0.2s ease 0s;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "37.1.0",
3
+ "version": "37.2.1",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",