@skyscanner/backpack-web 37.9.0 → 37.10.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.
@@ -28,6 +28,7 @@ const getClassName = cssModules(STYLES);
28
28
  const DEFAULT_ITEMS = 3;
29
29
  const BpkCardList = props => {
30
30
  const {
31
+ accessibilityLabels,
31
32
  accessoryDesktop,
32
33
  accessoryMobile,
33
34
  buttonContent,
@@ -74,6 +75,7 @@ const BpkCardList = props => {
74
75
  children: [layoutMobile === LAYOUTS.rail && /*#__PURE__*/_jsx(BpkCardListRowRailContainer, {
75
76
  initiallyShownCards: initiallyShownCardsMobile,
76
77
  layout: layoutMobile,
78
+ accessibilityLabels: accessibilityLabels,
77
79
  isMobile: true,
78
80
  children: cardList
79
81
  }), layoutMobile === LAYOUTS.stack && /*#__PURE__*/_jsx(BpkCardListGridStack, {
@@ -92,6 +94,7 @@ const BpkCardList = props => {
92
94
  accessory: accessoryDesktop,
93
95
  initiallyShownCards: initiallyShownCardsDesktop,
94
96
  layout: layoutDesktop,
97
+ accessibilityLabels: accessibilityLabels,
95
98
  children: cardList
96
99
  }), layoutDesktop === LAYOUTS.grid && accessoryDesktop !== ACCESSORY_DESKTOP_TYPES.pagination && /*#__PURE__*/_jsx(BpkCardListGridStack, {
97
100
  accessory: accessoryDesktop,
@@ -25,12 +25,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
25
25
  const getClassName = cssModules(STYLES);
26
26
  const BpkCardListCarousel = props => {
27
27
  const {
28
+ carouselLabel = (initiallyShownCards, childrenLength) => `Entering Carousel with ${initiallyShownCards} slides shown at a time, ${childrenLength} slides in total. Please use Pagination below with the Previous and Next buttons to navigate, or the slide dot buttons at the end to jump to slides.`,
28
29
  children,
29
30
  currentIndex,
30
31
  initiallyShownCards,
31
32
  isMobile = false,
32
33
  layout,
33
- setCurrentIndex
34
+ setCurrentIndex,
35
+ slideLabel = (index, childrenLength) => `slide ${index + 1} of ${childrenLength}`
34
36
  } = props;
35
37
  const shownNumberStyle = {
36
38
  '--initially-shown-cards': initiallyShownCards
@@ -63,14 +65,16 @@ const BpkCardListCarousel = props => {
63
65
  }, [root]);
64
66
  useUpdateCurrentIndexByVisibility(isMobile, visibilityList, setCurrentIndex, stateScrollingLockRef, openSetStateLockTimeoutRef);
65
67
  useScrollToCard(currentIndex, root, cardRefs, stateScrollingLockRef);
68
+
69
+ // Similar to Virtual Scrolling to improve performance
66
70
  const firstVisibleIndex = Math.max(0, visibilityList.indexOf(1));
67
71
  const lastVisibleIndex = firstVisibleIndex + initiallyShownCards - 1;
68
72
  const renderList = visibilityList.map((_, index) => index >= firstVisibleIndex - RENDER_BUFFER_SIZE && index <= lastVisibleIndex + RENDER_BUFFER_SIZE ? 1 : 0);
69
- const carouselAriaLabel = `Entering Carousel with ${initiallyShownCards} slides shown at a time, ${childrenLength} slides in total. Please use Pagination below with the Previous and Next buttons to navigate, or the slide dot buttons at the end to jump to slides.`;
70
73
  return /*#__PURE__*/_jsx("div", {
71
74
  className: getClassName(`bpk-card-list-row-rail__${layout}`),
72
75
  "data-testid": "bpk-card-list-row-rail__carousel",
73
- "aria-label": carouselAriaLabel
76
+ "aria-label": carouselLabel(initiallyShownCards, childrenLength),
77
+ "aria-roledescription": "carousel"
74
78
  // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
75
79
  ,
76
80
  tabIndex: 0,
@@ -83,17 +87,16 @@ const BpkCardListCarousel = props => {
83
87
  observerVisibility(el, index);
84
88
  setA11yTabIndex(el, index, visibilityList);
85
89
  };
86
- const slideAriaLabel = `slide ${index + 1} of ${childrenLength}`;
87
90
  const cardStyle = isMobile ? {
88
91
  ...shownNumberStyle,
89
- visibility: renderList[index] === 1 ? 'visible' : 'hidden'
92
+ visibility: renderList[index] === 1 ? 'visible' : 'hidden' // for mobile, {renderList[index] === 1 && card} will cause reflowing and bugs, implementing visibility improvement instead
90
93
  } : shownNumberStyle;
91
94
  return /*#__PURE__*/_jsx("div", {
92
95
  className: getClassName(`bpk-card-list-row-rail__${layout}__card`),
93
96
  ref: cardRefCallback,
94
97
  style: cardStyle,
95
98
  role: "group",
96
- "aria-label": slideAriaLabel,
99
+ "aria-label": slideLabel(index, childrenLength),
97
100
  "aria-current": index === currentIndex ? 'true' : 'false',
98
101
  children: isMobile ? card : renderList[index] === 1 && card
99
102
  }, `carousel-card-${index.toString()}`);
@@ -25,6 +25,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  const getClassName = cssModules(STYLES);
26
26
  const BpkCardListRowRailContainer = props => {
27
27
  const {
28
+ accessibilityLabels,
28
29
  accessory,
29
30
  children,
30
31
  initiallyShownCards,
@@ -37,13 +38,11 @@ const BpkCardListRowRailContainer = props => {
37
38
  const accessoryContent = layout === LAYOUTS.row && accessory === ACCESSORY_DESKTOP_TYPES.pagination ? /*#__PURE__*/_jsx(BpkPageIndicator, {
38
39
  currentIndex: currentIndex,
39
40
  totalIndicators: totalIndicators,
40
- onClick: (_e, index) => {
41
- setCurrentIndex(index);
42
- },
41
+ onClick: (_e, index) => setCurrentIndex(index),
43
42
  showNav: true,
44
- indicatorLabel: "Go to slide",
45
- prevNavLabel: "Previous slide",
46
- nextNavLabel: "Next slide"
43
+ indicatorLabel: accessibilityLabels?.indicatorLabel ?? 'Go to slide',
44
+ prevNavLabel: accessibilityLabels?.prevNavLabel ?? 'Previous slide',
45
+ nextNavLabel: accessibilityLabels?.nextNavLabel ?? 'Next slide'
47
46
  }) : null;
48
47
  return /*#__PURE__*/_jsxs("div", {
49
48
  className: getClassName('bpk-card-list-row-rail'),
@@ -54,6 +53,8 @@ const BpkCardListRowRailContainer = props => {
54
53
  currentIndex: currentIndex,
55
54
  setCurrentIndex: setCurrentIndex,
56
55
  isMobile: isMobile,
56
+ carouselLabel: accessibilityLabels?.carouselLabel,
57
+ slideLabel: accessibilityLabels?.slideLabel,
57
58
  children: children
58
59
  }), accessoryContent && showAccessory && /*#__PURE__*/_jsx("div", {
59
60
  role: "region",
@@ -1,4 +1,15 @@
1
+ /**
2
+ * Typically used to prevent useScrollToCard() from being called, to prevent scrollings caused by state changes, so as to avoid cyclic dependencies.
3
+ * @param stateScrollingLockRef - Ref to the state that indicates if scrollIntoView should be locked
4
+ * @param openSetStateLockTimeoutRef - Ref to the timeout that releases the lock after a delay. Should be renewed every time another scroll action is triggered, with a new lock is added.
5
+ */
1
6
  export declare const lockScroll: (stateScrollingLockRef: React.MutableRefObject<boolean>, openSetStateLockTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>) => void;
7
+ /**
8
+ * Only sets the tabIndex of focusable elements as 0 if the card is visible, otherwise sets it to -1, including all its children.
9
+ * For example, if there is a button inside a card which is not shown, it cannot be focused as well.
10
+ * @param el - Card container element, typically a div used to wrap the card content.
11
+ * @param index - Current container index
12
+ */
2
13
  export declare const setA11yTabIndex: (el: HTMLDivElement | null, index: number, visibilityList: number[]) => void;
3
14
  export declare const useUpdateCurrentIndexByVisibility: (isMobile: boolean, visibilityList: number[], setCurrentIndex: (index: number) => void, stateScrollingLockRef: React.MutableRefObject<boolean>, openSetStateLockTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>) => void;
4
15
  export declare const useScrollToCard: (currentIndex: number, container: HTMLElement | null, cardRefs: React.MutableRefObject<Array<HTMLDivElement | null>>, stateScrollingLockRef: React.MutableRefObject<boolean>) => void;
@@ -18,6 +18,13 @@
18
18
 
19
19
  import { useEffect, useRef, useMemo } from 'react';
20
20
  import { RELEASE_LOCK_DELAY } from "./constants";
21
+
22
+ /**
23
+ * Typically used to prevent useScrollToCard() from being called, to prevent scrollings caused by state changes, so as to avoid cyclic dependencies.
24
+ * @param stateScrollingLockRef - Ref to the state that indicates if scrollIntoView should be locked
25
+ * @param openSetStateLockTimeoutRef - Ref to the timeout that releases the lock after a delay. Should be renewed every time another scroll action is triggered, with a new lock is added.
26
+ */
27
+
21
28
  export const lockScroll = (stateScrollingLockRef, openSetStateLockTimeoutRef) => {
22
29
  // eslint-disable-next-line no-param-reassign
23
30
  stateScrollingLockRef.current = true;
@@ -30,6 +37,14 @@ export const lockScroll = (stateScrollingLockRef, openSetStateLockTimeoutRef) =>
30
37
  stateScrollingLockRef.current = false;
31
38
  }, RELEASE_LOCK_DELAY);
32
39
  };
40
+
41
+ /**
42
+ * Only sets the tabIndex of focusable elements as 0 if the card is visible, otherwise sets it to -1, including all its children.
43
+ * For example, if there is a button inside a card which is not shown, it cannot be focused as well.
44
+ * @param el - Card container element, typically a div used to wrap the card content.
45
+ * @param index - Current container index
46
+ */
47
+
33
48
  export const setA11yTabIndex = (el, index, visibilityList) => {
34
49
  if (!el) return;
35
50
  const focusableElements = el.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])');
@@ -40,19 +55,19 @@ export const setA11yTabIndex = (el, index, visibilityList) => {
40
55
  };
41
56
  export const useUpdateCurrentIndexByVisibility = (isMobile, visibilityList, setCurrentIndex, stateScrollingLockRef, openSetStateLockTimeoutRef) => {
42
57
  useEffect(() => {
43
- if (isMobile) return;
58
+ if (isMobile) return; // No pagination on mobile, so no need to update the current index
44
59
  if (!visibilityList || visibilityList.length === 0) return;
45
60
  const firstVisibleIndex = visibilityList.findIndex(visibility => visibility === 1);
46
61
  if (firstVisibleIndex !== -1) {
47
62
  setCurrentIndex(firstVisibleIndex);
48
- lockScroll(stateScrollingLockRef, openSetStateLockTimeoutRef);
63
+ lockScroll(stateScrollingLockRef, openSetStateLockTimeoutRef); // prevent scrollIntoView from being called immediately after the current index is set
49
64
  }
50
65
  }, [visibilityList]);
51
66
  };
52
67
  export const useScrollToCard = (currentIndex, container, cardRefs, stateScrollingLockRef) => {
53
68
  useEffect(() => {
54
69
  const isVisible = container && container.getBoundingClientRect().bottom > 0 && container.getBoundingClientRect().bottom <= window.innerHeight;
55
- if (!isVisible) return; // Escape from scrollIntoView if the container is not visible
70
+ if (!isVisible) return; // Escape from scrollIntoView if the container is not visible, otherwise the webpage will scroll down to the last rendered & non-visible container
56
71
 
57
72
  if (stateScrollingLockRef.current && stateScrollingLockRef.current === true) return;
58
73
  const targetCard = cardRefs.current[currentIndex];
@@ -21,6 +21,13 @@ type ExpandProps = {
21
21
  collapsed: boolean;
22
22
  onExpandToggle: () => void;
23
23
  };
24
+ type AccessibilityLabels = {
25
+ indicatorLabel?: string;
26
+ prevNavLabel?: string;
27
+ nextNavLabel?: string;
28
+ carouselLabel?: (initiallyShownCards: number, childrenLength: number) => string;
29
+ slideLabel?: (index: number, childrenLength: number) => string;
30
+ };
24
31
  type CardListBaseProps = {
25
32
  title: string;
26
33
  description?: string;
@@ -37,6 +44,7 @@ type CardListBaseProps = {
37
44
  onExpandClick?: () => void;
38
45
  buttonHref?: string;
39
46
  expandText?: string;
47
+ accessibilityLabels?: AccessibilityLabels;
40
48
  };
41
49
  type CardListGridStackProps = {
42
50
  children: ReactElement[];
@@ -55,6 +63,7 @@ type CardListRowRailProps = {
55
63
  layout: typeof LAYOUTS.row | typeof LAYOUTS.rail;
56
64
  accessory?: typeof ACCESSORY_DESKTOP_TYPES.pagination;
57
65
  isMobile?: boolean;
66
+ accessibilityLabels?: AccessibilityLabels;
58
67
  };
59
68
  type CardListCarouselProps = {
60
69
  children: Array<ReactElement<HTMLDivElement | HTMLAnchorElement>>;
@@ -63,6 +72,8 @@ type CardListCarouselProps = {
63
72
  currentIndex: number;
64
73
  setCurrentIndex: Dispatch<SetStateAction<number>>;
65
74
  isMobile?: boolean;
75
+ carouselLabel?: (initiallyShownCards: number, childrenLength: number) => string;
76
+ slideLabel?: (index: number, childrenLength: number) => string;
66
77
  };
67
78
  type CardListProps = CardListBaseProps;
68
79
  export default CardListProps;
@@ -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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "37.9.0",
3
+ "version": "37.10.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@floating-ui/react": "^0.27.8",
25
+ "@floating-ui/react": "^0.26.12",
26
26
  "@popperjs/core": "^2.11.8",
27
27
  "@radix-ui/react-compose-refs": "^1.1.1",
28
28
  "@radix-ui/react-slider": "1.1.2",