@skyscanner/backpack-web 35.7.0 → 36.1.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.
- package/bpk-component-banner-alert/src/AnimateAndFade.js +0 -1
- package/bpk-component-card/src/BpkDividedCard.module.css +1 -1
- package/bpk-component-drawer/index.d.ts +6 -0
- package/bpk-component-drawer/src/BpkDrawer.d.ts +23 -0
- package/bpk-component-drawer/src/BpkDrawer.js +58 -73
- package/bpk-component-drawer/src/BpkDrawerContent.d.ts +5 -4
- package/bpk-component-drawer/src/BpkDrawerContent.js +3 -3
- package/bpk-component-drawer/src/BpkDrawerContent.module.css +1 -1
- package/bpk-component-drawer/src/themeAttributes.d.ts +2 -0
- package/bpk-component-drawer/src/themeAttributes.js +4 -1
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +0 -2
- package/bpk-component-image/src/BpkBackgroundImage.js +0 -1
- package/bpk-component-image/src/BpkImage.js +0 -2
- package/bpk-component-info-banner/src/AnimateAndFade.js +0 -1
- package/bpk-component-map/src/BpkIconMarkerBackground.js +2 -0
- package/bpk-react-utils/src/BpkDialogWrapper/BpkDialogWrapper.js +0 -2
- package/bpk-react-utils/src/TransitionInitialMount.js +0 -1
- package/package.json +1 -1
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
22
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
23
22
|
|
|
@@ -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-divided-card--content{display:flex;
|
|
18
|
+
.bpk-divided-card--content{display:flex;align-items:stretch}.bpk-divided-card--vertical-content{flex-direction:column}.bpk-divided-card--vertical-container{display:flex}.bpk-divided-card--horizontal-container{display:flex}.bpk-divided-card__primary--horizontal{flex:1}.bpk-divided-card__secondary--vertical{border-top:solid .0625rem #c1c7cf}.bpk-divided-card__secondary--horizontal{border-left:solid .0625rem #c1c7cf}html[dir=rtl] .bpk-divided-card__secondary--horizontal{border-right:solid .0625rem #c1c7cf;border-left:unset}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type Props = {
|
|
3
|
+
id: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClose?: (arg0?: TouchEvent | MouseEvent | KeyboardEvent, arg1?: {
|
|
7
|
+
source: 'ESCAPE' | 'DOCUMENT_CLICK';
|
|
8
|
+
}) => void;
|
|
9
|
+
title: string;
|
|
10
|
+
getApplicationElement: () => HTMLElement | null;
|
|
11
|
+
renderTarget?: null | HTMLElement | (() => null | HTMLElement);
|
|
12
|
+
dialogRef?: (ref: HTMLElement | null | undefined) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
contentClassName?: string;
|
|
15
|
+
closeLabel?: string | null;
|
|
16
|
+
closeText?: string;
|
|
17
|
+
hideTitle?: boolean;
|
|
18
|
+
isIphone?: boolean;
|
|
19
|
+
padded?: boolean;
|
|
20
|
+
mobileModalDisplay?: boolean;
|
|
21
|
+
};
|
|
22
|
+
declare const BpkDrawer: ({ children, className, closeLabel, closeText, contentClassName, dialogRef, getApplicationElement, hideTitle, id, isIphone, isOpen, mobileModalDisplay, onClose, padded, renderTarget, title, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default BpkDrawer;
|
|
@@ -14,85 +14,70 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/import
|
|
18
|
-
import {
|
|
19
|
-
import { Portal } from "../../bpk-react-utils";
|
|
17
|
+
*/import { useState, useEffect } from 'react';
|
|
18
|
+
import { Portal, isDeviceIphone } from "../../bpk-react-utils";
|
|
20
19
|
import { withScrim } from "../../bpk-scrim-utils";
|
|
21
20
|
import BpkDrawerContent from "./BpkDrawerContent";
|
|
22
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
22
|
const BpkScrimDrawerContent = withScrim(BpkDrawerContent);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
const BpkDrawer = ({
|
|
24
|
+
children,
|
|
25
|
+
className = undefined,
|
|
26
|
+
closeLabel = null,
|
|
27
|
+
closeText = undefined,
|
|
28
|
+
contentClassName = undefined,
|
|
29
|
+
dialogRef,
|
|
30
|
+
getApplicationElement,
|
|
31
|
+
hideTitle = false,
|
|
32
|
+
id,
|
|
33
|
+
isIphone = isDeviceIphone(),
|
|
34
|
+
isOpen,
|
|
35
|
+
mobileModalDisplay = false,
|
|
36
|
+
onClose,
|
|
37
|
+
padded = true,
|
|
38
|
+
renderTarget = null,
|
|
39
|
+
title
|
|
40
|
+
}) => {
|
|
41
|
+
const [isDrawerShown, setIsDrawerShown] = useState(true);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (isOpen) {
|
|
44
|
+
setIsDrawerShown(true);
|
|
45
|
+
}
|
|
46
|
+
}, [isOpen]);
|
|
47
|
+
const onCloseAnimationComplete = () => {
|
|
48
|
+
if (onClose) {
|
|
49
|
+
onClose();
|
|
36
50
|
}
|
|
37
|
-
}
|
|
38
|
-
onCloseAnimationComplete = () => {
|
|
39
|
-
this.props.onClose();
|
|
40
51
|
};
|
|
41
|
-
hide = () => {
|
|
42
|
-
|
|
43
|
-
isDrawerShown: false
|
|
44
|
-
});
|
|
52
|
+
const hide = () => {
|
|
53
|
+
setIsDrawerShown(false);
|
|
45
54
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
onClose: PropTypes.func.isRequired,
|
|
74
|
-
title: PropTypes.string.isRequired,
|
|
75
|
-
/**
|
|
76
|
-
* **Note:** In order to "hide" your application from screen readers whilst the drawer is open you need to let it know what
|
|
77
|
-
* the root element for your application is by returning it's DOM node via the function passed to the
|
|
78
|
-
* `getApplicationElement` prop (see the example above). The `pagewrap` element id is a convention we use internally at Skyscanner. In most cases it should "just work".
|
|
79
|
-
*/
|
|
80
|
-
getApplicationElement: PropTypes.func.isRequired,
|
|
81
|
-
renderTarget: PropTypes.func,
|
|
82
|
-
dialogRef: PropTypes.func,
|
|
83
|
-
className: PropTypes.string,
|
|
84
|
-
contentClassName: PropTypes.string,
|
|
85
|
-
closeLabel: PropTypes.string,
|
|
86
|
-
closeText: PropTypes.string,
|
|
87
|
-
hideTitle: PropTypes.bool
|
|
88
|
-
};
|
|
89
|
-
BpkDrawer.defaultProps = {
|
|
90
|
-
renderTarget: null,
|
|
91
|
-
className: null,
|
|
92
|
-
contentClassName: null,
|
|
93
|
-
closeLabel: null,
|
|
94
|
-
closeText: null,
|
|
95
|
-
hideTitle: false,
|
|
96
|
-
padded: true
|
|
55
|
+
return /*#__PURE__*/_jsx(Portal, {
|
|
56
|
+
isOpen: isOpen,
|
|
57
|
+
onClose: hide,
|
|
58
|
+
renderTarget: renderTarget,
|
|
59
|
+
children: /*#__PURE__*/_jsx(BpkScrimDrawerContent, {
|
|
60
|
+
id: id,
|
|
61
|
+
title: title,
|
|
62
|
+
dialogRef: dialogRef,
|
|
63
|
+
closeLabel: closeLabel || "",
|
|
64
|
+
closeText: closeText
|
|
65
|
+
// eslint-disable-next-line @skyscanner/rules/forbid-component-props
|
|
66
|
+
,
|
|
67
|
+
className: className,
|
|
68
|
+
contentClassName: contentClassName,
|
|
69
|
+
getApplicationElement: getApplicationElement,
|
|
70
|
+
hideTitle: hideTitle,
|
|
71
|
+
isDrawerShown: isDrawerShown,
|
|
72
|
+
onClose: hide,
|
|
73
|
+
onCloseAnimationComplete: onCloseAnimationComplete,
|
|
74
|
+
closeOnScrimClick: true,
|
|
75
|
+
isIpad: true,
|
|
76
|
+
isIphone: isIphone,
|
|
77
|
+
padded: padded,
|
|
78
|
+
mobileModalDisplay: mobileModalDisplay,
|
|
79
|
+
children: children
|
|
80
|
+
})
|
|
81
|
+
});
|
|
97
82
|
};
|
|
98
83
|
export default BpkDrawer;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, RefObject } from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
dialogRef: () =>
|
|
4
|
+
dialogRef: () => RefObject<HTMLElement>;
|
|
5
5
|
onCloseAnimationComplete: () => void;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
id: string;
|
|
8
8
|
title: string;
|
|
9
|
-
className?: string;
|
|
9
|
+
className?: string | null;
|
|
10
10
|
contentClassName?: string;
|
|
11
11
|
closeLabel?: string;
|
|
12
12
|
closeText?: string;
|
|
@@ -16,6 +16,7 @@ type Props = {
|
|
|
16
16
|
isIphone?: boolean;
|
|
17
17
|
isIpad?: boolean;
|
|
18
18
|
padded?: boolean;
|
|
19
|
+
mobileModalDisplay?: boolean;
|
|
19
20
|
};
|
|
20
|
-
declare const BpkDrawerContent: ({ children, className, closeLabel, closeOnScrimClick, closeText, contentClassName, dialogRef, hideTitle, id, isDrawerShown, isIpad, isIphone, onClose, onCloseAnimationComplete, padded, title, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare const BpkDrawerContent: ({ children, className, closeLabel, closeOnScrimClick, closeText, contentClassName, dialogRef, hideTitle, id, isDrawerShown, isIpad, isIphone, mobileModalDisplay, onClose, onCloseAnimationComplete, padded, title, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
export default BpkDrawerContent;
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
import Transition from 'react-transition-group/Transition';
|
|
19
|
+
import { Transition } from 'react-transition-group';
|
|
21
20
|
import { animations } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
21
|
|
|
23
22
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
@@ -44,6 +43,7 @@ const BpkDrawerContent = ({
|
|
|
44
43
|
// Unused from withScrim scrim HOC
|
|
45
44
|
isIphone = false,
|
|
46
45
|
// Unused from withScrim scrim HOC
|
|
46
|
+
mobileModalDisplay = false,
|
|
47
47
|
onClose,
|
|
48
48
|
onCloseAnimationComplete,
|
|
49
49
|
padded,
|
|
@@ -81,7 +81,7 @@ const BpkDrawerContent = ({
|
|
|
81
81
|
tabIndex: -1,
|
|
82
82
|
role: "dialog",
|
|
83
83
|
"aria-labelledby": headingId,
|
|
84
|
-
className: [drawerClassNames.join(' '), getClassName(`bpk-drawer--${status}`)].join(' '),
|
|
84
|
+
className: [drawerClassNames.join(' '), getClassName(`bpk-drawer--${status}`, mobileModalDisplay ? `bpk-drawer__modal-mobile-view--${status}` : undefined)].join(' '),
|
|
85
85
|
ref: dialogRef,
|
|
86
86
|
...rest,
|
|
87
87
|
children: [/*#__PURE__*/_jsxs("header", {
|
|
@@ -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-drawer{position:fixed;right:0;display:flex;z-index:1100;width:90%;max-width:25rem;height:100%;flex-direction:column;transform:translate(100%);transition:transform 200ms ease;outline:0;background:#fff;overflow-y:scroll;box-shadow:0px 12px 50px 0px rgba(37,32,31,.25)}html[dir=rtl] .bpk-drawer{right:auto;left:0;transform:translate(-100%)}@media(max-width: 32rem){.bpk-drawer{width:100%;max-width:100%}}.bpk-drawer--entering,.bpk-drawer--entered{transform:translate(0)}html[dir=rtl] .bpk-drawer--entering,html[dir=rtl] .bpk-drawer--entered{transform:translate(0)}.bpk-drawer--exiting{transition:transform 50ms ease}.bpk-drawer--exiting,.bpk-drawer--exited{transform:translate(100%)}html[dir=rtl] .bpk-drawer--exiting,html[dir=rtl] .bpk-drawer--exited{transform:translate(-100%)}.bpk-drawer__header{display:flex;min-height:3rem;padding:1rem;justify-content:space-between;align-items:center;flex:0 0
|
|
18
|
+
.bpk-drawer{position:fixed;right:0;display:flex;z-index:1100;width:90%;max-width:25rem;height:100%;flex-direction:column;transform:translate(100%);transition:transform 200ms ease;outline:0;background:#fff;overflow-y:scroll;box-shadow:0px 12px 50px 0px rgba(37,32,31,.25)}html[dir=rtl] .bpk-drawer{right:auto;left:0;transform:translate(-100%)}@media(max-width: 32rem){.bpk-drawer{width:100%;max-width:100%}}.bpk-drawer--entering,.bpk-drawer--entered{transform:translate(0)}html[dir=rtl] .bpk-drawer--entering,html[dir=rtl] .bpk-drawer--entered{transform:translate(0)}.bpk-drawer--exiting{transition:transform 50ms ease}.bpk-drawer--exiting,.bpk-drawer--exited{transform:translate(100%)}html[dir=rtl] .bpk-drawer--exiting,html[dir=rtl] .bpk-drawer--exited{transform:translate(-100%)}.bpk-drawer__header{display:flex;min-height:3rem;padding:1rem;justify-content:space-between;align-items:center;flex:0 0}.bpk-drawer__heading{margin:0;font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-drawer__heading--visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip:rect(0 0 0 0)}.bpk-drawer__close-button{float:right}html[dir=rtl] .bpk-drawer__close-button{float:left}.bpk-drawer__content{height:100%;flex:1 1 100%;overflow-y:auto}.bpk-drawer__content--padded{padding:1rem}@media(max-width: 32rem){.bpk-drawer__modal-mobile-view{transform:scale(0.9);transition:opacity 200ms ease-in-out,transform 200ms ease-in-out;opacity:0}.bpk-drawer__modal-mobile-view--entering,.bpk-drawer__modal-mobile-view--entered{transform:scale(1);opacity:1}.bpk-drawer__modal-mobile-view--exited{transform:scale(0.9);opacity:0}.bpk-drawer__modal-mobile-view--exiting{transform:none}}
|
|
@@ -14,5 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
20
|
+
import { themeAttributes as linkAttributes } from "../../bpk-component-link";
|
|
18
21
|
export default [...linkAttributes];
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { useEffect, useState } from 'react';
|
|
20
|
-
|
|
21
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
20
|
import { CSSTransition } from 'react-transition-group';
|
|
23
21
|
import BpkAriaLive from "../../bpk-component-aria-live";
|
|
24
22
|
import { BUTTON_TYPES, BpkButtonV2 } from "../../bpk-component-button";
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
20
|
import CSSTransition from 'react-transition-group/CSSTransition';
|
|
22
21
|
import { animations } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
23
22
|
import { BpkSpinner } from "../../bpk-component-spinner";
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
|
-
|
|
21
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
20
|
import CSSTransition from 'react-transition-group/CSSTransition';
|
|
23
21
|
import { animations } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
24
22
|
import { BpkSpinner } from "../../bpk-component-spinner";
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
22
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
23
22
|
|
|
@@ -35,6 +35,7 @@ const BpkIconMarkerBackground = props => {
|
|
|
35
35
|
width: "32",
|
|
36
36
|
height: "40",
|
|
37
37
|
viewBox: "0 0 32 40",
|
|
38
|
+
"aria-hidden": "true",
|
|
38
39
|
className: classNames,
|
|
39
40
|
...rest,
|
|
40
41
|
children: /*#__PURE__*/_jsx("path", {
|
|
@@ -51,6 +52,7 @@ const BpkIconMarkerBackground = props => {
|
|
|
51
52
|
width: "26",
|
|
52
53
|
height: "32",
|
|
53
54
|
viewBox: "0 0 26 32",
|
|
55
|
+
"aria-hidden": "true",
|
|
54
56
|
className: classNames,
|
|
55
57
|
...rest,
|
|
56
58
|
children: /*#__PURE__*/_jsx("path", {
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { useEffect, useRef, useState } from "react";
|
|
20
|
-
|
|
21
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
20
|
import CSSTransition from 'react-transition-group/CSSTransition';
|
|
23
21
|
import cssModules from "../cssModules";
|
|
24
22
|
import STYLES from "./BpkDialogWrapper.module.css";
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
20
20
|
import assign from 'object-assign';
|
|
21
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
21
|
import CSSTransition from 'react-transition-group/CSSTransition';
|
|
23
22
|
|
|
24
23
|
// Object.assign() is used unpolyfilled in react-transition-group.
|