@skyscanner/backpack-web 37.9.1 → 37.11.0

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.
@@ -1,4 +1,8 @@
1
- import BpkInsetBanner, { type Props as BpkInsetBannerProps, VARIANT } from './src/BpkInsetBanner';
1
+ import BpkInsetBanner, { type Props as BpkInsetBannerProps } from './src/BpkInsetBanner';
2
+ import BpkInsetBannerSponsored from './src/BpkInsetBannerV2/BpkInsetBannerSponsored';
3
+ import { type CommonProps as BpkInsetBannerSponsoredProps } from './src/BpkInsetBannerV2/common-types';
4
+ import { VARIANT } from './src/BpkInsetBannerV2/common-types';
2
5
  export type { BpkInsetBannerProps };
6
+ export type { BpkInsetBannerSponsoredProps };
3
7
  export { VARIANT };
4
- export default BpkInsetBanner;
8
+ export { BpkInsetBannerSponsored, BpkInsetBanner };
@@ -16,6 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import BpkInsetBanner, { VARIANT } from "./src/BpkInsetBanner";
19
+ import BpkInsetBanner from "./src/BpkInsetBanner";
20
+ import BpkInsetBannerSponsored from "./src/BpkInsetBannerV2/BpkInsetBannerSponsored";
21
+ import { VARIANT } from "./src/BpkInsetBannerV2/common-types";
20
22
  export { VARIANT };
21
- export default BpkInsetBanner;
23
+ export { BpkInsetBannerSponsored, BpkInsetBanner };
@@ -0,0 +1,3 @@
1
+ import { type CommonProps } from './common-types';
2
+ declare const BpkInsetBannerSponsored: ({ accessibilityLabel, backgroundColor, callToAction, image, logo, subheadline, title, variant, }: CommonProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default BpkInsetBannerSponsored;
@@ -0,0 +1,138 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import { useState } from 'react';
19
+ import { surfaceHighlightDay } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
20
+ import BpkBottomSheet from "../../../bpk-component-bottom-sheet";
21
+ import ViewIcon from "../../../bpk-component-icon/lg/view";
22
+ import InfoIcon from "../../../bpk-component-icon/sm/information-circle";
23
+ import BpkImage from "../../../bpk-component-image";
24
+ import BpkText, { TEXT_STYLES } from "../../../bpk-component-text/src/BpkText";
25
+ import { cssModules } from "../../../bpk-react-utils";
26
+ import { VARIANT } from "./common-types";
27
+ import STYLES from "./BpkInsetBannerSponsored.module.css";
28
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
+ const getClassName = cssModules(STYLES);
30
+ const BpkInsetBannerSponsored = ({
31
+ accessibilityLabel,
32
+ backgroundColor = surfaceHighlightDay,
33
+ callToAction,
34
+ image,
35
+ logo,
36
+ subheadline,
37
+ title,
38
+ variant = VARIANT.onLight
39
+ }) => {
40
+ const classNames = getClassName('bpk-inset-banner', `bpk-inset-banner--${variant}`, image && 'bpk-inset-banner--with-image');
41
+ const [sheetOpen, setSheetOpen] = useState(false);
42
+ return /*#__PURE__*/_jsxs("div", {
43
+ children: [/*#__PURE__*/_jsxs("div", {
44
+ "aria-label": accessibilityLabel,
45
+ className: classNames,
46
+ style: {
47
+ backgroundColor
48
+ },
49
+ children: [/*#__PURE__*/_jsx("div", {
50
+ className: getClassName('bpk-inset-banner--logo'),
51
+ children: logo && /*#__PURE__*/_jsx("img", {
52
+ className: getClassName('bpk-inset-banner--image'),
53
+ src: logo,
54
+ alt: "",
55
+ "aria-hidden": true
56
+ })
57
+ }), /*#__PURE__*/_jsxs("div", {
58
+ className: getClassName('bpk-inset-banner--text-container'),
59
+ children: [/*#__PURE__*/_jsx(BpkText, {
60
+ textStyle: TEXT_STYLES.label2,
61
+ children: title
62
+ }), /*#__PURE__*/_jsx(BpkText, {
63
+ textStyle: TEXT_STYLES.caption,
64
+ children: subheadline
65
+ })]
66
+ }), callToAction && callToAction.bottomSheetContent && /*#__PURE__*/_jsxs("div", {
67
+ role: "presentation",
68
+ className: getClassName('bpk-inset-banner--cta-container'),
69
+ onClick: e => {
70
+ // Do not propagate the click on the trigger OR bottomSheet content up the DOM tree.
71
+ e.stopPropagation();
72
+ e.preventDefault();
73
+ },
74
+ children: [/*#__PURE__*/_jsx("button", {
75
+ "aria-label": callToAction?.buttonA11yLabel,
76
+ className: getClassName('bpk-inset-banner--cta-button'),
77
+ "data-testid": "ctaBtn",
78
+ "aria-hidden": "false",
79
+ type: "button",
80
+ onClick: () => setSheetOpen(true),
81
+ children: /*#__PURE__*/_jsxs("div", {
82
+ className: getClassName('bpk-inset-banner--cta-content'),
83
+ children: [callToAction?.text && /*#__PURE__*/_jsx(BpkText, {
84
+ textStyle: TEXT_STYLES.caption,
85
+ children: callToAction.text
86
+ }), /*#__PURE__*/_jsx("div", {
87
+ className: getClassName('bpk-inset-banner--cta-info-icon'),
88
+ children: /*#__PURE__*/_jsx(InfoIcon, {})
89
+ })]
90
+ })
91
+ }), /*#__PURE__*/_jsx(BpkBottomSheet, {
92
+ id: "InsetBannerBottomSheet",
93
+ isOpen: sheetOpen,
94
+ onClose: () => setSheetOpen(false),
95
+ title: callToAction?.bottomSheetTitle || '',
96
+ closeLabel: "Close bottom sheet",
97
+ ariaLabel: callToAction?.bottomSheetA11yLabel || '',
98
+ children: callToAction.bottomSheetContent.map((item, index) => /*#__PURE__*/_jsxs("div", {
99
+ className: getClassName('bpk-inset-banner--bottom-sheet-content'),
100
+ children: [/*#__PURE__*/_jsx("div", {
101
+ className: getClassName('bpk-inset-banner--bottom-sheet-icon'),
102
+ children: index === 0 ? /*#__PURE__*/_jsx(ViewIcon, {
103
+ height: 24,
104
+ width: 24
105
+ }) : /*#__PURE__*/_jsx(InfoIcon, {
106
+ height: 24,
107
+ width: 24
108
+ })
109
+ }), /*#__PURE__*/_jsxs("div", {
110
+ className: getClassName('bpk-inset-banner--bottom-sheet-text'),
111
+ children: [/*#__PURE__*/_jsx("div", {
112
+ className: getClassName('bpk-inset-banner--bottom-sheet-title'),
113
+ children: /*#__PURE__*/_jsx(BpkText, {
114
+ textStyle: TEXT_STYLES.heading4,
115
+ children: item.title
116
+ })
117
+ }), /*#__PURE__*/_jsx("div", {
118
+ className: getClassName('bpk-inset-banner--bottom-sheet-description'),
119
+ children: /*#__PURE__*/_jsx(BpkText, {
120
+ textStyle: TEXT_STYLES.bodyDefault,
121
+ children: item.description
122
+ })
123
+ })]
124
+ })]
125
+ }, item.title))
126
+ })]
127
+ })]
128
+ }), image && /*#__PURE__*/_jsx("div", {
129
+ className: getClassName('bpk-inset-banner-image-container'),
130
+ children: /*#__PURE__*/_jsx(BpkImage, {
131
+ src: image.src,
132
+ altText: image.altText,
133
+ aspectRatio: image.aspectRatio
134
+ })
135
+ })]
136
+ });
137
+ };
138
+ export default BpkInsetBannerSponsored;
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ .bpk-inset-banner{display:grid;padding:.5rem 1rem;grid-template-columns:auto 1fr auto;grid-template-areas:"logo content cta";align-items:center;border-radius:.5rem}@media(max-width: 32rem){.bpk-inset-banner{grid-template-columns:1fr auto;grid-template-areas:"logo cta" "content content"}}.bpk-inset-banner--logo{grid-area:logo}.bpk-inset-banner--with-image{border-radius:.5rem .5rem 0 0}.bpk-inset-banner--on-light{color:#161616;fill:#161616}.bpk-inset-banner--on-dark{color:#fff;fill:#fff}.bpk-inset-banner--image{max-height:2rem;object-fit:contain;padding-inline-end:1rem}.bpk-inset-banner--text-container{display:flex;grid-area:content;flex-direction:column;word-wrap:break-word}.bpk-inset-banner--cta-text{display:flex;align-items:center}.bpk-inset-banner--cta-button{all:unset}.bpk-inset-banner--cta-button:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-inset-banner--cta-container{display:flex;height:2rem;grid-area:cta;align-items:center;cursor:pointer}.bpk-inset-banner--cta-content{display:flex;align-items:center}.bpk-inset-banner--cta-info-icon{display:flex;align-items:center;margin-inline-start:.5rem}.bpk-inset-banner--bottom-sheet-content{display:flex;padding-bottom:2rem;flex-direction:row}.bpk-inset-banner--bottom-sheet-icon{display:flex;margin-right:1.5rem;fill:#161616}.bpk-inset-banner--bottom-sheet-text{display:flex;flex-direction:column}.bpk-inset-banner--bottom-sheet-title{margin-bottom:.5rem;color:#161616}.bpk-inset-banner--bottom-sheet-description{color:#161616}.bpk-inset-banner-image-container{min-height:7.5rem;border-radius:0 0 .5rem .5rem;overflow:hidden}
@@ -0,0 +1,40 @@
1
+ export declare const VARIANT: {
2
+ onLight: string;
3
+ onDark: string;
4
+ };
5
+ type callToActionType = {
6
+ text?: string;
7
+ bottomSheetContent: Array<{
8
+ title: string;
9
+ description: string;
10
+ }>;
11
+ bottomSheetTitle?: string;
12
+ buttonCloseLabel?: string;
13
+ buttonA11yLabel?: string;
14
+ bottomSheetLabel?: string;
15
+ bottomSheetId?: string;
16
+ bottomSheetWidth?: string;
17
+ bottomSheetMarginStart?: string;
18
+ bottomSheetMarginEnd?: string;
19
+ bottomSheetA11yLabel?: string;
20
+ labelTitle?: boolean;
21
+ closeBtnIcon?: boolean;
22
+ zIndexCustom?: number;
23
+ };
24
+ export type CommonProps = {
25
+ accessibilityLabel?: string;
26
+ backgroundColor?: string;
27
+ callToAction?: callToActionType & {
28
+ bottomSheetContent: callToActionType['bottomSheetContent'];
29
+ };
30
+ logo: string;
31
+ subheadline?: string;
32
+ title?: string;
33
+ variant?: (typeof VARIANT)[keyof typeof VARIANT];
34
+ image?: {
35
+ src: string;
36
+ altText: string;
37
+ aspectRatio: number;
38
+ };
39
+ };
40
+ export {};
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ export const VARIANT = {
19
+ onLight: 'on-light',
20
+ onDark: 'on-dark'
21
+ };
@@ -0,0 +1,2 @@
1
+ import BpkPanel from './src/BpkPanel';
2
+ export default BpkPanel;
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ export type Props = {
3
+ children: ReactNode;
4
+ padded?: boolean;
5
+ fullWidth?: boolean;
6
+ className?: string | null;
7
+ keyline?: boolean;
8
+ [rest: string]: any;
9
+ };
10
+ declare const BpkPanel: ({ children, className, fullWidth, keyline, padded, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export default BpkPanel;
@@ -16,26 +16,32 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import PropTypes from 'prop-types';
20
19
  import { cssModules } from "../../bpk-react-utils";
21
20
  import STYLES from "./BpkPanel.module.css";
22
21
  import { jsx as _jsx } from "react/jsx-runtime";
23
22
  const getClassName = cssModules(STYLES);
24
- const BpkPanel = props => {
23
+ const BpkPanel = ({
24
+ children,
25
+ className = null,
26
+ fullWidth = false,
27
+ keyline = true,
28
+ padded = true,
29
+ ...rest
30
+ }) => {
25
31
  const classNames = [getClassName('bpk-panel')];
26
- const {
27
- children,
28
- className,
29
- fullWidth,
30
- padded,
31
- ...rest
32
- } = props;
33
32
  if (padded) {
34
33
  classNames.push(getClassName('bpk-panel--padded'));
35
34
  }
36
35
  if (fullWidth) {
37
36
  classNames.push(getClassName('bpk-panel--full-width'));
38
37
  }
38
+ if (keyline) {
39
+ if (fullWidth) {
40
+ classNames.push(getClassName('bpk-panel--full-width-keyline'));
41
+ } else {
42
+ classNames.push(getClassName('bpk-panel--keyline'));
43
+ }
44
+ }
39
45
  if (className) {
40
46
  classNames.push(className);
41
47
  }
@@ -45,15 +51,4 @@ const BpkPanel = props => {
45
51
  children: children
46
52
  });
47
53
  };
48
- BpkPanel.propTypes = {
49
- children: PropTypes.node.isRequired,
50
- padded: PropTypes.bool,
51
- fullWidth: PropTypes.bool,
52
- className: PropTypes.string
53
- };
54
- BpkPanel.defaultProps = {
55
- padded: true,
56
- fullWidth: false,
57
- className: null
58
- };
59
54
  export default BpkPanel;
@@ -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-panel{display:block;background-color:#fff;box-shadow:0 0 0 1px #c1c7cf inset;border-radius:.75rem}.bpk-panel--padded{padding:1rem}.bpk-panel--full-width{border-radius:0;box-shadow:#c1c7cf 0 -0.0625rem 0 0 inset,#c1c7cf 0 .0625rem 0 0 inset}
18
+ .bpk-panel{display:block;background-color:#fff;border-radius:.75rem}.bpk-panel--padded{padding:1rem}.bpk-panel--full-width{border-radius:0}.bpk-panel--keyline{box-shadow:0 0 0 1px #c1c7cf inset}.bpk-panel--full-width-keyline{box-shadow:#c1c7cf 0 -0.0625rem 0 0 inset,#c1c7cf 0 .0625rem 0 0 inset}
@@ -1,4 +1,3 @@
1
- import PropTypes from 'prop-types';
2
1
  import type { ReactNode } from 'react';
3
2
  import { RATING_SIZES, RATING_SCALES } from './common-types';
4
3
  type ValueOf<T> = T[keyof T];
@@ -11,26 +10,7 @@ type Props = {
11
10
  subtitle?: string;
12
11
  title?: string | ReactNode;
13
12
  value: string | number;
13
+ [rest: string]: any;
14
14
  };
15
- declare const BpkRating: {
16
- (props: Props): import("react/jsx-runtime").JSX.Element;
17
- propTypes: {
18
- ariaLabel: PropTypes.Validator<string>;
19
- value: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
20
- className: PropTypes.Requireable<string>;
21
- ratingScale: PropTypes.Requireable<string>;
22
- size: PropTypes.Requireable<string>;
23
- subtitle: PropTypes.Requireable<string>;
24
- showScale: PropTypes.Requireable<boolean>;
25
- title: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
26
- };
27
- defaultProps: {
28
- className: null;
29
- ratingScale: "zeroToFive";
30
- size: "base";
31
- subtitle: null;
32
- showScale: boolean;
33
- title: null;
34
- };
35
- };
15
+ declare const BpkRating: ({ ariaLabel, className, ratingScale, showScale, size, subtitle, title, value, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
36
16
  export default BpkRating;
@@ -16,7 +16,6 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import PropTypes from 'prop-types';
20
19
  import clamp from 'lodash.clamp';
21
20
  import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
22
21
  import { cssModules } from "../../bpk-react-utils";
@@ -37,18 +36,17 @@ const getMaxValue = ratingScale => {
37
36
  return 10;
38
37
  }
39
38
  };
40
- const BpkRating = props => {
41
- const {
42
- ariaLabel,
43
- className,
44
- ratingScale,
45
- showScale,
46
- size,
47
- subtitle,
48
- title,
49
- value,
50
- ...rest
51
- } = props;
39
+ const BpkRating = ({
40
+ ariaLabel,
41
+ className,
42
+ ratingScale = RATING_SCALES.zeroToFive,
43
+ showScale = true,
44
+ size = RATING_SIZES.base,
45
+ subtitle = undefined,
46
+ title = null,
47
+ value,
48
+ ...rest
49
+ }) => {
52
50
  const classNames = getClassName('bpk-rating', className, size === RATING_SIZES.large && title && subtitle && 'bpk-rating--large');
53
51
  const valueStyles = getClassName('bpk-rating__value');
54
52
  const scaleStyles = getClassName('bpk-rating__scale');
@@ -96,42 +94,24 @@ const BpkRating = props => {
96
94
  })]
97
95
  }), /*#__PURE__*/_jsxs("div", {
98
96
  className: textWrapperStyles,
99
- children: [title && /*#__PURE__*/_jsx(BpkText, {
100
- textStyle: titleTextSize,
101
- tagName: "span",
102
- "aria-hidden": "true",
103
- children: /*#__PURE__*/_jsx("span", {
104
- className: titleStyles,
97
+ children: [title && /*#__PURE__*/_jsx("span", {
98
+ className: titleStyles,
99
+ children: /*#__PURE__*/_jsx(BpkText, {
100
+ textStyle: titleTextSize,
101
+ tagName: "span",
102
+ "aria-hidden": "true",
105
103
  children: title
106
104
  })
107
- }), subtitle && /*#__PURE__*/_jsx(BpkText, {
108
- textStyle: subtitleTextSize,
109
- tagName: "span",
110
- "aria-hidden": "true",
111
- children: /*#__PURE__*/_jsx("span", {
112
- className: subtitleStyles,
105
+ }), subtitle && /*#__PURE__*/_jsx("span", {
106
+ className: subtitleStyles,
107
+ children: /*#__PURE__*/_jsx(BpkText, {
108
+ textStyle: subtitleTextSize,
109
+ tagName: "span",
110
+ "aria-hidden": "true",
113
111
  children: subtitle
114
112
  })
115
113
  })]
116
114
  })]
117
115
  });
118
116
  };
119
- BpkRating.propTypes = {
120
- ariaLabel: PropTypes.string.isRequired,
121
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
122
- className: PropTypes.string,
123
- ratingScale: PropTypes.oneOf(Object.keys(RATING_SCALES)),
124
- size: PropTypes.oneOf(Object.keys(RATING_SIZES)),
125
- subtitle: PropTypes.string,
126
- showScale: PropTypes.bool,
127
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
128
- };
129
- BpkRating.defaultProps = {
130
- className: null,
131
- ratingScale: RATING_SCALES.zeroToFive,
132
- size: RATING_SIZES.base,
133
- subtitle: null,
134
- showScale: true,
135
- title: null
136
- };
137
117
  export default BpkRating;
@@ -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-rating{display:flex;flex-flow:row nowrap;align-items:baseline}.bpk-rating--large{align-items:center}.bpk-rating__value{padding-inline-end:.5rem}.bpk-rating__text-wrapper{display:flex;flex-direction:row;align-items:baseline;white-space:nowrap}.bpk-rating__text-wrapper--large{padding-top:.0625rem;flex-direction:column;align-items:flex-start}.bpk-rating__scale{color:#626971}.bpk-rating__title--with-subtitle{padding-right:.5rem}html[dir=rtl] .bpk-rating__title--with-subtitle{padding-right:0;padding-left:.5rem}.bpk-rating__subtitle{color:#626971}
18
+ .bpk-rating{display:flex;flex-flow:row nowrap;align-items:baseline}.bpk-rating--large{align-items:center}.bpk-rating__value{padding-inline-end:.5rem}.bpk-rating__text-wrapper{display:flex;min-width:0;flex-direction:row;align-items:baseline;white-space:nowrap}.bpk-rating__text-wrapper--large{padding-top:.0625rem;flex-direction:column;align-items:flex-start}.bpk-rating__scale{color:#626971}.bpk-rating__title--with-subtitle{padding-right:.5rem}html[dir=rtl] .bpk-rating__title--with-subtitle{padding-right:0;padding-left:.5rem}.bpk-rating__subtitle{min-width:0;max-width:100%;flex:1 1 auto;color:#626971;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}
@@ -39,8 +39,9 @@ type Props = {
39
39
  textStyle?: TextStyle;
40
40
  tagName?: Tag;
41
41
  className?: string | null;
42
+ color?: string | null;
42
43
  id?: string;
43
44
  [rest: string]: any;
44
45
  };
45
- declare const BpkText: ({ children, className, tagName: TagName, textStyle, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
46
+ declare const BpkText: ({ children, className, color, tagName: TagName, textStyle, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
46
47
  export default BpkText;
@@ -56,18 +56,30 @@ export const TEXT_STYLES = {
56
56
  const BpkText = ({
57
57
  children,
58
58
  className = null,
59
+ color = null,
59
60
  tagName: TagName = 'span',
60
61
  textStyle = TEXT_STYLES.bodyDefault,
61
62
  ...rest
62
63
  }) => {
63
64
  const classNames = getClassName('bpk-text', `bpk-text--${textStyle}`, className);
65
+ const {
66
+ style,
67
+ ...otherProps
68
+ } = rest;
69
+ const computedStyles = {
70
+ ...style,
71
+ ...(color ? {
72
+ color
73
+ } : {})
74
+ };
64
75
  return (
65
76
  /*#__PURE__*/
66
77
  // Allowed, TagName is always a dom element.
67
78
  // eslint-disable-next-line @skyscanner/rules/forbid-component-props
68
79
  _jsx(TagName, {
69
80
  className: classNames,
70
- ...rest,
81
+ style: computedStyles,
82
+ ...otherProps,
71
83
  children: children
72
84
  })
73
85
  );
@@ -36,7 +36,6 @@
36
36
  display: block;
37
37
  background-color: $bpk-card-background-color;
38
38
 
39
- @include bpk-border-sm($bpk-panel-border-color);
40
39
  @include bpk-border-radius-md;
41
40
  }
42
41
 
@@ -53,7 +52,21 @@
53
52
  padding: $bpk-card-padding;
54
53
  }
55
54
 
56
- /// Makes panel full width by removing left and right border.
55
+ /// Controls if we have a keyline or not on the panel
56
+ /// Modifies the bpk-panel mixin.
57
+ ///
58
+ /// @require {mixin} bpk-panel
59
+ ///
60
+ /// @example scss
61
+ /// .selector {
62
+ /// @include bpk-panel();
63
+ /// @include bpk-panel--keyline();
64
+ /// }
65
+ @mixin bpk-panel--keyline {
66
+ @include bpk-border-sm($bpk-panel-border-color);
67
+ }
68
+
69
+ /// Makes panel full width by removing the border radius
57
70
  /// Modifies the bpk-panel mixin.
58
71
  ///
59
72
  /// @require {mixin} bpk-panel
@@ -65,6 +78,18 @@
65
78
  /// }
66
79
  @mixin bpk-panel--full-width {
67
80
  border-radius: 0;
81
+ }
82
+
83
+ /// Sets the keyline to only show on the top and bottom when full
84
+ ///
85
+ /// @require {mixin} bpk-panel
86
+ ///
87
+ /// @example scss
88
+ /// .selector {
89
+ /// @include bpk-panel();
90
+ /// @include bpk-panel--full-width-keyline();
91
+ /// }
92
+ @mixin bpk-panel--full-width-keyline {
68
93
  box-shadow:
69
94
  $bpk-panel-border-color 0 -1 * $bpk-one-pixel-rem 0 0 inset,
70
95
  $bpk-panel-border-color 0 $bpk-one-pixel-rem 0 0 inset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "37.9.1",
3
+ "version": "37.11.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,9 +31,9 @@
31
31
  "@skyscanner/bpk-svgs": "^20.6.0",
32
32
  "a11y-focus-scope": "^1.1.3",
33
33
  "a11y-focus-store": "^1.0.0",
34
- "d3-path": "^2.0.0",
34
+ "d3-path": "^3.1.0",
35
35
  "d3-scale": "^4.0.2",
36
- "intersection-observer": "^0.7.0",
36
+ "intersection-observer": "^0.12.2",
37
37
  "lodash": "^4.17.20",
38
38
  "lodash.clamp": "^4.0.3",
39
39
  "lodash.debounce": "^4.0.8",
@@ -36,7 +36,6 @@
36
36
  display: block;
37
37
  background-color: tokens.$bpk-card-background-color;
38
38
 
39
- @include borders.bpk-border-sm(tokens.$bpk-panel-border-color);
40
39
  @include radii.bpk-border-radius-md;
41
40
  }
42
41
 
@@ -53,7 +52,21 @@
53
52
  padding: tokens.$bpk-card-padding;
54
53
  }
55
54
 
56
- /// Makes panel full width by removing left and right border.
55
+ /// Controls if we have a keyline or not on the panel
56
+ /// Modifies the bpk-panel mixin.
57
+ ///
58
+ /// @require {mixin} bpk-panel
59
+ ///
60
+ /// @example scss
61
+ /// .selector {
62
+ /// @include bpk-panel();
63
+ /// @include bpk-panel--keyline();
64
+ /// }
65
+ @mixin bpk-panel--keyline {
66
+ @include borders.bpk-border-sm(tokens.$bpk-panel-border-color);
67
+ }
68
+
69
+ /// Makes panel full width by removing the border radius
57
70
  /// Modifies the bpk-panel mixin.
58
71
  ///
59
72
  /// @require {mixin} bpk-panel
@@ -65,6 +78,18 @@
65
78
  /// }
66
79
  @mixin bpk-panel--full-width {
67
80
  border-radius: 0;
81
+ }
82
+
83
+ /// Sets the keyline to only show on the top and bottom when full
84
+ ///
85
+ /// @require {mixin} bpk-panel
86
+ ///
87
+ /// @example scss
88
+ /// .selector {
89
+ /// @include bpk-panel();
90
+ /// @include bpk-panel--full-width-keyline();
91
+ /// }
92
+ @mixin bpk-panel--full-width-keyline {
68
93
  box-shadow:
69
94
  tokens.$bpk-panel-border-color 0 -1 * tokens.$bpk-one-pixel-rem 0 0 inset,
70
95
  tokens.$bpk-panel-border-color 0 tokens.$bpk-one-pixel-rem 0 0 inset;