@skyscanner/backpack-web 35.5.1 → 35.7.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.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
dialogRef: () => React.RefObject<HTMLElement>;
|
|
5
|
+
onCloseAnimationComplete: () => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
contentClassName?: string;
|
|
11
|
+
closeLabel?: string;
|
|
12
|
+
closeText?: string;
|
|
13
|
+
isDrawerShown?: boolean;
|
|
14
|
+
hideTitle?: boolean;
|
|
15
|
+
closeOnScrimClick?: boolean;
|
|
16
|
+
isIphone?: boolean;
|
|
17
|
+
isIpad?: boolean;
|
|
18
|
+
padded?: boolean;
|
|
19
|
+
};
|
|
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
|
+
export default BpkDrawerContent;
|
|
@@ -14,37 +14,42 @@
|
|
|
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`.
|
|
18
20
|
import Transition from 'react-transition-group/Transition';
|
|
19
21
|
import { animations } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
|
+
|
|
23
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
20
24
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
25
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
26
|
import { BpkButtonLink } from "../../bpk-component-link";
|
|
22
27
|
import { cssModules } from "../../bpk-react-utils";
|
|
23
28
|
import STYLES from "./BpkDrawerContent.module.css";
|
|
24
29
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
30
|
const getClassName = cssModules(STYLES);
|
|
26
|
-
const BpkDrawerContent =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
const BpkDrawerContent = ({
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
closeLabel,
|
|
35
|
+
closeOnScrimClick = true,
|
|
36
|
+
// Unused from withScrim scrim HOC
|
|
37
|
+
closeText,
|
|
38
|
+
contentClassName,
|
|
39
|
+
dialogRef,
|
|
40
|
+
hideTitle = false,
|
|
41
|
+
id,
|
|
42
|
+
isDrawerShown = true,
|
|
43
|
+
isIpad = false,
|
|
44
|
+
// Unused from withScrim scrim HOC
|
|
45
|
+
isIphone = false,
|
|
46
|
+
// Unused from withScrim scrim HOC
|
|
47
|
+
onClose,
|
|
48
|
+
onCloseAnimationComplete,
|
|
49
|
+
padded,
|
|
50
|
+
title,
|
|
51
|
+
...rest
|
|
52
|
+
}) => {
|
|
48
53
|
const drawerClassNames = [getClassName('bpk-drawer')];
|
|
49
54
|
const headerClassNames = [getClassName('bpk-drawer__heading')];
|
|
50
55
|
const contentClassNames = [getClassName('bpk-drawer__content')];
|
|
@@ -54,6 +59,9 @@ const BpkDrawerContent = props => {
|
|
|
54
59
|
if (hideTitle) {
|
|
55
60
|
headerClassNames.push(getClassName('bpk-drawer__heading--visually-hidden'));
|
|
56
61
|
}
|
|
62
|
+
if (padded) {
|
|
63
|
+
contentClassNames.push(getClassName('bpk-drawer__content--padded'));
|
|
64
|
+
}
|
|
57
65
|
if (contentClassName) {
|
|
58
66
|
contentClassNames.push(contentClassName);
|
|
59
67
|
}
|
|
@@ -68,12 +76,9 @@ const BpkDrawerContent = props => {
|
|
|
68
76
|
exit: true,
|
|
69
77
|
in: isDrawerShown,
|
|
70
78
|
onExited: onCloseAnimationComplete,
|
|
71
|
-
children: status =>
|
|
72
|
-
/*#__PURE__*/
|
|
73
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See decisions/flowfixme.md
|
|
74
|
-
_jsxs("section", {
|
|
79
|
+
children: status => /*#__PURE__*/_jsxs("section", {
|
|
75
80
|
id: id,
|
|
76
|
-
tabIndex:
|
|
81
|
+
tabIndex: -1,
|
|
77
82
|
role: "dialog",
|
|
78
83
|
"aria-labelledby": headingId,
|
|
79
84
|
className: [drawerClassNames.join(' '), getClassName(`bpk-drawer--${status}`)].join(' '),
|
|
@@ -102,32 +107,4 @@ const BpkDrawerContent = props => {
|
|
|
102
107
|
}, "dialog")
|
|
103
108
|
});
|
|
104
109
|
};
|
|
105
|
-
BpkDrawerContent.propTypes = {
|
|
106
|
-
children: PropTypes.node.isRequired,
|
|
107
|
-
dialogRef: PropTypes.func.isRequired,
|
|
108
|
-
onCloseAnimationComplete: PropTypes.func.isRequired,
|
|
109
|
-
onClose: PropTypes.func.isRequired,
|
|
110
|
-
id: PropTypes.string.isRequired,
|
|
111
|
-
title: PropTypes.string.isRequired,
|
|
112
|
-
className: PropTypes.string,
|
|
113
|
-
contentClassName: PropTypes.string,
|
|
114
|
-
closeLabel: PropTypes.string,
|
|
115
|
-
closeText: PropTypes.string,
|
|
116
|
-
isDrawerShown: PropTypes.bool,
|
|
117
|
-
hideTitle: PropTypes.bool,
|
|
118
|
-
closeOnScrimClick: PropTypes.bool,
|
|
119
|
-
isIphone: PropTypes.bool,
|
|
120
|
-
isIpad: PropTypes.bool
|
|
121
|
-
};
|
|
122
|
-
BpkDrawerContent.defaultProps = {
|
|
123
|
-
className: null,
|
|
124
|
-
contentClassName: null,
|
|
125
|
-
closeLabel: null,
|
|
126
|
-
closeText: null,
|
|
127
|
-
isDrawerShown: true,
|
|
128
|
-
hideTitle: false,
|
|
129
|
-
closeOnScrimClick: true,
|
|
130
|
-
isIphone: false,
|
|
131
|
-
isIpad: false
|
|
132
|
-
};
|
|
133
110
|
export default BpkDrawerContent;
|
|
@@ -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;box-shadow:0 -1px 0 0 #c1c7cf inset}.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%;
|
|
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;box-shadow:0 -1px 0 0 #c1c7cf inset}.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}
|