@skyscanner/backpack-web 31.2.0 → 31.3.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.
Files changed (24) hide show
  1. package/bpk-component-banner-alert/src/BpkBannerAlert.js +5 -0
  2. package/bpk-component-info-banner/index.d.ts +32 -0
  3. package/bpk-component-info-banner/index.js +25 -0
  4. package/bpk-component-info-banner/src/AnimateAndFade.d.ts +61 -0
  5. package/bpk-component-info-banner/src/AnimateAndFade.js +147 -0
  6. package/bpk-component-info-banner/src/BpkAnimateAndFade.module.css +18 -0
  7. package/bpk-component-info-banner/src/BpkInfoBanner.d.ts +29 -0
  8. package/bpk-component-info-banner/src/BpkInfoBanner.js +40 -0
  9. package/bpk-component-info-banner/src/BpkInfoBanner.module.css +18 -0
  10. package/bpk-component-info-banner/src/BpkInfoBannerDismissable.d.ts +30 -0
  11. package/bpk-component-info-banner/src/BpkInfoBannerDismissable.js +29 -0
  12. package/bpk-component-info-banner/src/BpkInfoBannerExpandable.d.ts +37 -0
  13. package/bpk-component-info-banner/src/BpkInfoBannerExpandable.js +35 -0
  14. package/bpk-component-info-banner/src/BpkInfoBannerInner.d.ts +58 -0
  15. package/bpk-component-info-banner/src/BpkInfoBannerInner.js +176 -0
  16. package/bpk-component-info-banner/src/common-types.d.ts +50 -0
  17. package/bpk-component-info-banner/src/common-types.js +28 -0
  18. package/bpk-component-info-banner/src/withBannerAlertState.d.ts +168 -0
  19. package/bpk-component-info-banner/src/withBannerAlertState.js +111 -0
  20. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.js +1 -1
  21. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.module.css +1 -1
  22. package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +1 -1
  23. package/bpk-stylesheets/base.css +1 -1
  24. package/package.json +2 -2
@@ -24,6 +24,11 @@ const defaultProps = {
24
24
  show: true,
25
25
  icon: null
26
26
  };
27
+
28
+ /**
29
+ * @deprecated use bpk-component-info-banner instead
30
+ * @returns {Component} a banner alert component
31
+ */
27
32
  const BpkBannerAlert = ({
28
33
  animateOnEnter = false,
29
34
  animateOnLeave = false,
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2022 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
+
19
+ import BpkInfoBanner from './src/BpkInfoBanner';
20
+ import BpkInfoBannerDismissable from './src/BpkInfoBannerDismissable';
21
+ import BpkInfoBannerExpandable from './src/BpkInfoBannerExpandable';
22
+ import { ALERT_TYPES, STYLE_TYPES } from './src/common-types';
23
+ import withBannerAlertState from './src/withBannerAlertState';
24
+
25
+ export {
26
+ ALERT_TYPES,
27
+ STYLE_TYPES,
28
+ BpkInfoBannerDismissable,
29
+ BpkInfoBannerExpandable,
30
+ withBannerAlertState,
31
+ };
32
+ export default BpkInfoBanner;
@@ -0,0 +1,25 @@
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
+
19
+ import BpkInfoBanner from "./src/BpkInfoBanner";
20
+ import BpkInfoBannerDismissable from "./src/BpkInfoBannerDismissable";
21
+ import BpkInfoBannerExpandable from "./src/BpkInfoBannerExpandable";
22
+ import { ALERT_TYPES, STYLE_TYPES } from "./src/common-types";
23
+ import withBannerAlertState from "./src/withBannerAlertState";
24
+ export { ALERT_TYPES, STYLE_TYPES, BpkInfoBannerDismissable, BpkInfoBannerExpandable, withBannerAlertState };
25
+ export default BpkInfoBanner;
@@ -0,0 +1,61 @@
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
+
19
+ import { Component } from 'react';
20
+ import type { ReactNode } from 'react';
21
+
22
+ type Props = {
23
+ animateOnEnter: boolean;
24
+ animateOnLeave: boolean;
25
+ children: ReactNode | string;
26
+ show: boolean;
27
+ className?: string | null;
28
+ };
29
+ type State = {
30
+ isExpanded: boolean;
31
+ visible: boolean;
32
+ initiateShow: boolean;
33
+ hideAnimationInProgress: boolean;
34
+ inDom: boolean;
35
+ };
36
+ declare class AnimateAndFade extends Component<Props, State> {
37
+ toggleImmediately: boolean;
38
+
39
+ static defaultProps: {
40
+ animateOnEnter: boolean;
41
+ animateOnLeave: boolean;
42
+ className: null;
43
+ };
44
+
45
+ constructor(props: Props);
46
+
47
+ componentDidMount(): void;
48
+
49
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
50
+
51
+ componentDidUpdate(): void;
52
+
53
+ onAnimateHeightComplete: () => void;
54
+
55
+ onFadeComplete: () => void;
56
+
57
+ toggle: () => void;
58
+
59
+ render(): JSX.Element | null;
60
+ }
61
+ export default AnimateAndFade;
@@ -0,0 +1,147 @@
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
+
19
+ import { Component } from 'react';
20
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
21
+ import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
22
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
23
+ import { TransitionGroup, CSSTransition } from 'react-transition-group';
24
+ import { cssModules } from "../../bpk-react-utils";
25
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
26
+ import BpkAnimateHeight from "../../bpk-animate-height";
27
+ import STYLES from "./BpkAnimateAndFade.module.css";
28
+ import { jsx as _jsx } from "react/jsx-runtime";
29
+ import { jsxs as _jsxs } from "react/jsx-runtime";
30
+ const getClassName = cssModules(STYLES);
31
+ const ANIMATION_DURATION = parseInt(durationSm, 10);
32
+ class AnimateAndFade extends Component {
33
+ static defaultProps = {
34
+ animateOnEnter: false,
35
+ animateOnLeave: false,
36
+ className: null
37
+ };
38
+ constructor(props) {
39
+ super(props);
40
+ this.toggleImmediately = this.props.show && this.props.animateOnEnter;
41
+ const initiallyShown = this.toggleImmediately ? false : this.props.show;
42
+ this.state = {
43
+ isExpanded: initiallyShown,
44
+ visible: initiallyShown,
45
+ initiateShow: false,
46
+ hideAnimationInProgress: false,
47
+ inDom: initiallyShown
48
+ };
49
+ }
50
+ componentDidMount() {
51
+ if (this.toggleImmediately) {
52
+ this.toggle();
53
+ }
54
+ }
55
+ UNSAFE_componentWillReceiveProps(nextProps) {
56
+ if (nextProps.show === this.props.show) {
57
+ return;
58
+ }
59
+ this.toggle();
60
+ }
61
+ componentDidUpdate() {
62
+ if (this.state.initiateShow) {
63
+ // React doesn't like us calling setState from componentDidUpdate as it can lead to an infinite re-renders.
64
+ // I think it is ok here, however, as this will only happen conditionally (ie once)
65
+
66
+ this.setState({
67
+ initiateShow: false,
68
+ isExpanded: true,
69
+ visible: true
70
+ });
71
+ }
72
+ }
73
+ onAnimateHeightComplete = () => {
74
+ if (this.state.isExpanded) {
75
+ return;
76
+ }
77
+ this.setState({
78
+ inDom: false,
79
+ hideAnimationInProgress: false
80
+ });
81
+ };
82
+ onFadeComplete = () => {
83
+ if (!this.state.visible && this.state.hideAnimationInProgress) {
84
+ this.setState({
85
+ isExpanded: false
86
+ });
87
+ }
88
+ };
89
+ toggle = () => {
90
+ if (this.state.visible && this.state.isExpanded) {
91
+ this.setState({
92
+ hideAnimationInProgress: true,
93
+ visible: false
94
+ });
95
+ } else if (!this.state.visible && !this.state.isExpanded) {
96
+ this.setState({
97
+ inDom: true,
98
+ initiateShow: true
99
+ });
100
+ }
101
+ };
102
+ render() {
103
+ const {
104
+ animateOnEnter,
105
+ animateOnLeave,
106
+ children,
107
+ className
108
+ } = this.props;
109
+ const showPlaceholder = !this.state.visible && !this.state.hideAnimationInProgress;
110
+ // While the expanding animation takes place, we render the child element
111
+ // close to invisible. If we don't do this, the animate-height container
112
+ // will take on height 0, and will never expand to allow the children to fade in
113
+ return this.state.inDom ? /*#__PURE__*/_jsxs(BpkAnimateHeight, {
114
+ className: className,
115
+ onAnimationComplete: this.onAnimateHeightComplete,
116
+ duration: ANIMATION_DURATION,
117
+ height: this.state.isExpanded ? 'auto' : 0,
118
+ children: [showPlaceholder && /*#__PURE__*/_jsx("div", {
119
+ style: {
120
+ opacity: 0.35
121
+ },
122
+ children: children
123
+ }), /*#__PURE__*/_jsx(TransitionGroup, {
124
+ exit: animateOnLeave,
125
+ enter: animateOnEnter,
126
+ appear: animateOnEnter,
127
+ onTransitionEnd: this.onFadeComplete,
128
+ children: this.state.visible && /*#__PURE__*/_jsx(CSSTransition, {
129
+ classNames: {
130
+ exit: getClassName('bpk-animate-and-fade--leave'),
131
+ exitActive: getClassName('bpk-animate-and-fade--leave-active'),
132
+ enter: getClassName('bpk-animate-and-fade--enter'),
133
+ enterActive: getClassName('bpk-animate-and-fade--enter-active'),
134
+ appear: getClassName('bpk-animate-and-fade--appear'),
135
+ appearActive: getClassName('bpk-animate-and-fade--appear-active')
136
+ },
137
+ timeout: {
138
+ enter: ANIMATION_DURATION * 2,
139
+ exit: ANIMATION_DURATION * 2
140
+ },
141
+ children: children
142
+ })
143
+ })]
144
+ }) : null;
145
+ }
146
+ }
147
+ export default AnimateAndFade;
@@ -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
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-animate-and-fade--enter{transition:opacity 200ms ease-in-out;opacity:.01;transition-delay:200ms}.bpk-animate-and-fade--enter-active{opacity:1}.bpk-animate-and-fade--leave{transition:opacity 200ms ease-in-out;opacity:1}.bpk-animate-and-fade--leave-active{transition:opacity 200ms ease-in-out;opacity:.01}.bpk-animate-and-fade--appear{transition:opacity 200ms ease-in-out;opacity:.01;transition-delay:200ms}.bpk-animate-and-fade--appear-active{opacity:1}
@@ -0,0 +1,29 @@
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
+
19
+ /// <reference types="react" />
20
+ import type { CommonProps } from './common-types';
21
+
22
+ declare const BpkInfoBanner: ({
23
+ animateOnEnter,
24
+ animateOnLeave,
25
+ icon,
26
+ show,
27
+ ...rest
28
+ }: CommonProps) => JSX.Element;
29
+ export default BpkInfoBanner;
@@ -0,0 +1,40 @@
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
+
19
+ import BpkInfoBannerInner from "./BpkInfoBannerInner";
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ const defaultProps = {
22
+ animateOnEnter: false,
23
+ animateOnLeave: false,
24
+ show: true,
25
+ icon: null
26
+ };
27
+ const BpkInfoBanner = ({
28
+ animateOnEnter = false,
29
+ animateOnLeave = false,
30
+ icon = null,
31
+ show = true,
32
+ ...rest
33
+ }) => /*#__PURE__*/_jsx(BpkInfoBannerInner, {
34
+ animateOnEnter: animateOnEnter,
35
+ animateOnLeave: animateOnLeave,
36
+ show: show,
37
+ icon: icon,
38
+ ...rest
39
+ });
40
+ export default BpkInfoBanner;
@@ -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
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-info-banner{padding:0.5rem 1rem;overflow:hidden;border-radius:.5rem;margin:0;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner--style-default{background-color:#eff1f2}.bpk-info-banner--style-onContrast{background-color:#fff}.bpk-info-banner__header{display:flex;flex-direction:row;align-items:flex-start}.bpk-info-banner__header--expandable{cursor:pointer}.bpk-info-banner__icon,.bpk-info-banner__toggle{padding:0.125rem 0}.bpk-info-banner__message{padding:0.25rem 0.5rem;flex-grow:1}.bpk-info-banner__success-icon{fill:#0c838a}.bpk-info-banner__warning-icon{fill:#f55d42}.bpk-info-banner__error-icon{fill:#e70866}.bpk-info-banner__info-icon{fill:#545860}.bpk-info-banner__toggle-button{padding:0;border:0;background-color:transparent;cursor:pointer;appearance:none}.bpk-info-banner__expand-icon{fill:#545860}.bpk-info-banner__expand-icon--flipped{transform:scaleY(-1)}.bpk-info-banner__children-container{color:#161616;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner__children-container--with-action{padding:0.25rem 0 0.25rem}.bpk-info-banner__children-container--no-action{padding:0.25rem 0 0.5rem}.bpk-info-banner__expandable-action{padding-bottom:0.25rem}
@@ -0,0 +1,30 @@
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
+
19
+ /// <reference types="react" />
20
+ import type { CommonProps, OnDismissHandler } from './common-types';
21
+
22
+ export type Props = CommonProps & {
23
+ dismissButtonLabel: string;
24
+ onDismiss?: OnDismissHandler;
25
+ };
26
+ declare const BpkInfoBannerDismissable: ({
27
+ onDismiss,
28
+ ...rest
29
+ }: Props) => JSX.Element;
30
+ export default BpkInfoBannerDismissable;
@@ -0,0 +1,29 @@
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
+
19
+ import BpkInfoBannerInner, { CONFIGURATION } from "./BpkInfoBannerInner";
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ const BpkInfoBannerDismissable = ({
22
+ onDismiss = null,
23
+ ...rest
24
+ }) => /*#__PURE__*/_jsx(BpkInfoBannerInner, {
25
+ configuration: CONFIGURATION.DISMISSABLE,
26
+ onDismiss: onDismiss,
27
+ ...rest
28
+ });
29
+ export default BpkInfoBannerDismissable;
@@ -0,0 +1,37 @@
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
+
19
+ import type { ReactNode } from 'react';
20
+
21
+ import type { CommonProps, OnExpandToggleHandler } from './common-types';
22
+
23
+ export type Props = CommonProps & {
24
+ children: ReactNode;
25
+ expanded?: boolean;
26
+ toggleButtonLabel: string;
27
+ onExpandToggle?: OnExpandToggleHandler;
28
+ action?: ExpandableBannerAction;
29
+ };
30
+ declare const BpkInfoBannerExpandable: ({
31
+ action,
32
+ children,
33
+ expanded,
34
+ onExpandToggle,
35
+ ...rest
36
+ }: Props) => JSX.Element;
37
+ export default BpkInfoBannerExpandable;
@@ -0,0 +1,35 @@
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
+
19
+ import BpkInfoBannerInner, { CONFIGURATION } from "./BpkInfoBannerInner";
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ const BpkInfoBannerExpandable = ({
22
+ action = null,
23
+ children,
24
+ expanded = false,
25
+ onExpandToggle = null,
26
+ ...rest
27
+ }) => /*#__PURE__*/_jsx(BpkInfoBannerInner, {
28
+ action: action,
29
+ configuration: CONFIGURATION.EXPANDABLE,
30
+ expanded: expanded,
31
+ onExpandToggle: onExpandToggle,
32
+ ...rest,
33
+ children: children
34
+ });
35
+ export default BpkInfoBannerExpandable;
@@ -0,0 +1,58 @@
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
+
19
+ import type { ReactNode } from 'react';
20
+
21
+ import type {
22
+ CommonProps,
23
+ OnDismissHandler,
24
+ OnExpandToggleHandler,
25
+ } from './common-types';
26
+
27
+ export declare const CONFIGURATION: {
28
+ readonly NONE: 'none';
29
+ readonly DISMISSABLE: 'dismissable';
30
+ readonly EXPANDABLE: 'expandable';
31
+ };
32
+ type Props = CommonProps & {
33
+ configuration?: (typeof CONFIGURATION)[keyof typeof CONFIGURATION];
34
+ children?: ReactNode | string;
35
+ expanded?: boolean;
36
+ toggleButtonLabel?: string;
37
+ onExpandToggle?: OnExpandToggleHandler;
38
+ dismissButtonLabel?: string;
39
+ onDismiss?: OnDismissHandler;
40
+ };
41
+ declare const BpkInfoBannerInner: ({
42
+ animateOnEnter,
43
+ animateOnLeave,
44
+ bannerClassName,
45
+ children,
46
+ configuration,
47
+ dismissButtonLabel,
48
+ expanded,
49
+ icon,
50
+ message,
51
+ onDismiss,
52
+ onExpandToggle,
53
+ show,
54
+ toggleButtonLabel,
55
+ type,
56
+ ...rest
57
+ }: Props) => JSX.Element;
58
+ export default BpkInfoBannerInner;
@@ -0,0 +1,176 @@
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
+
19
+ /* This is an internal component to Backpack that powers `BpkInfoBanner`,
20
+ * `BpkInfoBannerDismissable` and `BpkInfoBannerExpandable`.
21
+ */
22
+
23
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
24
+ import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
25
+ import { withButtonAlignment } from "../../bpk-component-icon";
26
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
27
+ import BpkLink from "../../bpk-component-link";
28
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
29
+ import BpkAnimateHeight from "../../bpk-animate-height";
30
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
31
+ import BpkCloseButton from "../../bpk-component-close-button";
32
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
33
+ import TickCircleIcon from "../../bpk-component-icon/sm/tick-circle";
34
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
35
+ import ChevronDownIcon from "../../bpk-component-icon/sm/chevron-down";
36
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
37
+ import InfoCircleIcon from "../../bpk-component-icon/sm/information-circle";
38
+ import { cssModules } from "../../bpk-react-utils";
39
+ import AnimateAndFade from "./AnimateAndFade";
40
+ import { ALERT_TYPES, STYLE_TYPES } from "./common-types";
41
+ import STYLES from "./BpkInfoBanner.module.css";
42
+ import { jsx as _jsx } from "react/jsx-runtime";
43
+ import { jsxs as _jsxs } from "react/jsx-runtime";
44
+ const getClassName = cssModules(STYLES);
45
+ const ExpandIcon = withButtonAlignment(ChevronDownIcon);
46
+ export const CONFIGURATION = {
47
+ NONE: 'none',
48
+ DISMISSABLE: 'dismissable',
49
+ EXPANDABLE: 'expandable'
50
+ };
51
+ const getIconForType = (type, CustomIcon) => {
52
+ const classMap = {
53
+ [ALERT_TYPES.SUCCESS]: getClassName('bpk-info-banner__success-icon'),
54
+ [ALERT_TYPES.WARNING]: getClassName('bpk-info-banner__warning-icon'),
55
+ [ALERT_TYPES.ERROR]: getClassName('bpk-info-banner__error-icon'),
56
+ [ALERT_TYPES.INFO]: getClassName('bpk-info-banner__info-icon')
57
+ };
58
+ const className = classMap[type];
59
+ const componentMap = {
60
+ [ALERT_TYPES.SUCCESS]: TickCircleIcon,
61
+ [ALERT_TYPES.WARNING]: InfoCircleIcon,
62
+ [ALERT_TYPES.ERROR]: InfoCircleIcon,
63
+ [ALERT_TYPES.INFO]: InfoCircleIcon
64
+ };
65
+ const Icon = CustomIcon || componentMap[type];
66
+ const AlignedIcon = withButtonAlignment(Icon);
67
+ return /*#__PURE__*/_jsx(AlignedIcon, {
68
+ className: className
69
+ });
70
+ };
71
+ const ToggleButton = props => {
72
+ const classNames = getClassName('bpk-info-banner__expand-icon', props.expanded && 'bpk-info-banner__expand-icon--flipped');
73
+ return /*#__PURE__*/_jsx("button", {
74
+ type: "button",
75
+ className: getClassName('bpk-info-banner__toggle-button'),
76
+ "aria-label": props.label,
77
+ "aria-expanded": props.expanded,
78
+ title: props.label,
79
+ children: /*#__PURE__*/_jsx(ExpandIcon, {
80
+ className: classNames
81
+ })
82
+ });
83
+ };
84
+ const BpkInfoBannerInner = ({
85
+ action = null,
86
+ animateOnEnter = false,
87
+ animateOnLeave = false,
88
+ bannerClassName,
89
+ children = null,
90
+ configuration,
91
+ dismissButtonLabel = '',
92
+ expanded = false,
93
+ icon = null,
94
+ message,
95
+ onDismiss = null,
96
+ onExpandToggle = null,
97
+ show = true,
98
+ style = STYLE_TYPES.DEFAULT,
99
+ toggleButtonLabel = '',
100
+ type = ALERT_TYPES.INFO,
101
+ ...rest
102
+ }) => {
103
+ const onBannerExpandToggle = () => {
104
+ if (onExpandToggle) {
105
+ onExpandToggle(!expanded);
106
+ }
107
+ };
108
+ const onBannerDismiss = () => {
109
+ if (onDismiss) {
110
+ onDismiss();
111
+ }
112
+ };
113
+ const isExpandable = configuration === CONFIGURATION.EXPANDABLE;
114
+ const dismissable = configuration === CONFIGURATION.DISMISSABLE;
115
+ const showChildren = isExpandable && expanded;
116
+ const sectionClassNames = getClassName('bpk-info-banner', `bpk-info-banner--${type}`, `bpk-info-banner--style-${style}`, bannerClassName && bannerClassName);
117
+ const headerClassNames = getClassName('bpk-info-banner__header', isExpandable && 'bpk-info-banner__header--expandable');
118
+ const childrenContainerClassName = action && isExpandable ? getClassName('bpk-info-banner__children-container--with-action') : getClassName('bpk-info-banner__children-container--no-action');
119
+
120
+ /* eslint-disable
121
+ jsx-a11y/no-static-element-interactions,
122
+ jsx-a11y/click-events-have-key-events,
123
+ */
124
+ // Disabling 'click-events-have-key-events and interactive-supports-focus' because header element is not focusable.
125
+ // ToggleButton is focusable and works for this.
126
+ return /*#__PURE__*/_jsx(AnimateAndFade, {
127
+ animateOnEnter: animateOnEnter,
128
+ animateOnLeave: dismissable || animateOnLeave,
129
+ show: show,
130
+ ...rest,
131
+ children: /*#__PURE__*/_jsxs("section", {
132
+ className: sectionClassNames,
133
+ role: "alert",
134
+ children: [/*#__PURE__*/_jsxs("div", {
135
+ role: isExpandable ? 'button' : undefined,
136
+ className: headerClassNames,
137
+ onClick: onBannerExpandToggle,
138
+ children: [/*#__PURE__*/_jsx("span", {
139
+ className: getClassName('bpk-info-banner__icon'),
140
+ children: getIconForType(type, icon)
141
+ }), /*#__PURE__*/_jsx("span", {
142
+ className: getClassName('bpk-info-banner__message'),
143
+ children: message
144
+ }), isExpandable && /*#__PURE__*/_jsx("span", {
145
+ className: getClassName('bpk-info-banner__toggle'),
146
+ children: /*#__PURE__*/_jsx(ToggleButton, {
147
+ expanded: expanded,
148
+ label: toggleButtonLabel
149
+ })
150
+ }), dismissable && /*#__PURE__*/_jsx("span", {
151
+ className: getClassName('bpk-info-banner__toggle'),
152
+ children: /*#__PURE__*/_jsx(BpkCloseButton, {
153
+ className: getClassName('bpk-info-banner__toggle-button'),
154
+ onClick: onBannerDismiss,
155
+ "aria-label": dismissButtonLabel,
156
+ label: dismissButtonLabel
157
+ })
158
+ })]
159
+ }), /*#__PURE__*/_jsxs(BpkAnimateHeight, {
160
+ duration: parseInt(durationSm, 10),
161
+ height: showChildren ? 'auto' : 0,
162
+ children: [/*#__PURE__*/_jsx("div", {
163
+ className: childrenContainerClassName,
164
+ children: children
165
+ }), isExpandable && action && /*#__PURE__*/_jsx(BpkLink, {
166
+ className: getClassName('bpk-info-banner__expandable-action'),
167
+ onClick: action.callback,
168
+ children: action.title
169
+ })]
170
+ })]
171
+ })
172
+ });
173
+ /* eslint-enable */
174
+ };
175
+
176
+ export default BpkInfoBannerInner;
@@ -0,0 +1,50 @@
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
+
19
+ import type { FunctionComponent, ReactNode } from 'react';
20
+
21
+ export declare const ALERT_TYPES: {
22
+ readonly SUCCESS: 'success',
23
+ readonly WARNING: 'warning',
24
+ readonly ERROR: 'error',
25
+ readonly INFO: 'info',
26
+ };
27
+ export declare const STYLE_TYPES: {
28
+ readonly DEFAULT: 'default',
29
+ readonly ON_CONTRAST: 'onContrast',
30
+ };
31
+ export type AlertTypeValue = (typeof ALERT_TYPES)[keyof typeof ALERT_TYPES];
32
+ export type StyleTypeValue = (typeof STYLE_TYPES)[keyof typeof STYLE_TYPES];
33
+ export type CommonProps = {
34
+ type?: AlertTypeValue;
35
+ message: ReactNode | string;
36
+ animateOnEnter?: boolean;
37
+ animateOnLeave?: boolean;
38
+ show?: boolean;
39
+ bannerClassName?: string | null;
40
+ icon?: FunctionComponent<any> | null;
41
+ style?: StyleTypeValue;
42
+ [rest: string]: any;
43
+ };
44
+ export type OnExpandToggleHandler =
45
+ | ((expanded: boolean) => void)
46
+ | null
47
+ | undefined;
48
+ export type ExpandableBannerAction = { title: string, callback: () => void } | null | undefined;
49
+ export type OnDismissHandler = (() => void) | null | undefined;
50
+ export type OnHideHandler = (() => void) | null | undefined;
@@ -0,0 +1,28 @@
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
+
19
+ export const ALERT_TYPES = {
20
+ SUCCESS: 'success',
21
+ WARNING: 'warning',
22
+ ERROR: 'error',
23
+ INFO: 'info'
24
+ };
25
+ export const STYLE_TYPES = {
26
+ DEFAULT: 'default',
27
+ ON_CONTRAST: 'onContrast'
28
+ };
@@ -0,0 +1,168 @@
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
+
19
+ /// <reference types="node" />
20
+ import type { ComponentType } from 'react';
21
+ export type WithBannerAlertStateProps = {
22
+ onHide?: () => void;
23
+ hideAfter?: number;
24
+ };
25
+ declare const withBannerAlertState: <
26
+ P extends Partial<
27
+ import('./common-types').CommonProps & {
28
+ dismissButtonLabel: string;
29
+ onDismiss?: import('./common-types').OnDismissHandler;
30
+ } & {
31
+ children: import('react').ReactNode;
32
+ expanded?: boolean | undefined;
33
+ toggleButtonLabel: string;
34
+ onExpandToggle?: import('./common-types').OnExpandToggleHandler;
35
+ }
36
+ >,
37
+ >(
38
+ WrappedComponent: ComponentType<P>,
39
+ ) => {
40
+ new (props: P & WithBannerAlertStateProps): {
41
+ hideIntervalId?: NodeJS.Timeout | null | undefined;
42
+ componentDidMount(): void;
43
+ componentWillUnmount(): void;
44
+ onExpandToggle: () => void;
45
+ onDismiss: () => void;
46
+ onHide: () => void;
47
+ render(): JSX.Element;
48
+ context: any;
49
+ setState<
50
+ K extends keyof {
51
+ expanded?: boolean | undefined;
52
+ show?: boolean | undefined;
53
+ },
54
+ >(
55
+ state:
56
+ | {
57
+ expanded?: boolean | undefined;
58
+ show?: boolean | undefined;
59
+ }
60
+ | ((
61
+ prevState: Readonly<{
62
+ expanded?: boolean | undefined;
63
+ show?: boolean | undefined;
64
+ }>,
65
+ props: Readonly<P & WithBannerAlertStateProps>,
66
+ ) =>
67
+ | {
68
+ expanded?: boolean | undefined;
69
+ show?: boolean | undefined;
70
+ }
71
+ | Pick<
72
+ {
73
+ expanded?: boolean | undefined;
74
+ show?: boolean | undefined;
75
+ },
76
+ K
77
+ >
78
+ | null)
79
+ | Pick<
80
+ {
81
+ expanded?: boolean | undefined;
82
+ show?: boolean | undefined;
83
+ },
84
+ K
85
+ >
86
+ | null,
87
+ callback?: (() => void) | undefined,
88
+ ): void;
89
+ forceUpdate(callback?: (() => void) | undefined): void;
90
+ readonly props: Readonly<P & WithBannerAlertStateProps> &
91
+ Readonly<{
92
+ children?: import('react').ReactNode;
93
+ }>;
94
+ state: Readonly<{
95
+ expanded?: boolean | undefined;
96
+ show?: boolean | undefined;
97
+ }>;
98
+ refs: {
99
+ [key: string]: import('react').ReactInstance;
100
+ };
101
+ shouldComponentUpdate?(
102
+ nextProps: Readonly<P & WithBannerAlertStateProps>,
103
+ nextState: Readonly<{
104
+ expanded?: boolean | undefined;
105
+ show?: boolean | undefined;
106
+ }>,
107
+ nextContext: any,
108
+ ): boolean;
109
+ componentDidCatch?(
110
+ error: Error,
111
+ errorInfo: import('react').ErrorInfo,
112
+ ): void;
113
+ getSnapshotBeforeUpdate?(
114
+ prevProps: Readonly<P & WithBannerAlertStateProps>,
115
+ prevState: Readonly<{
116
+ expanded?: boolean | undefined;
117
+ show?: boolean | undefined;
118
+ }>,
119
+ ): any;
120
+ componentDidUpdate?(
121
+ prevProps: Readonly<P & WithBannerAlertStateProps>,
122
+ prevState: Readonly<{
123
+ expanded?: boolean | undefined;
124
+ show?: boolean | undefined;
125
+ }>,
126
+ snapshot?: any,
127
+ ): void;
128
+ componentWillMount?(): void;
129
+ UNSAFE_componentWillMount?(): void;
130
+ componentWillReceiveProps?(
131
+ nextProps: Readonly<P & WithBannerAlertStateProps>,
132
+ nextContext: any,
133
+ ): void;
134
+ UNSAFE_componentWillReceiveProps?(
135
+ nextProps: Readonly<P & WithBannerAlertStateProps>,
136
+ nextContext: any,
137
+ ): void;
138
+ componentWillUpdate?(
139
+ nextProps: Readonly<P & WithBannerAlertStateProps>,
140
+ nextState: Readonly<{
141
+ expanded?: boolean | undefined;
142
+ show?: boolean | undefined;
143
+ }>,
144
+ nextContext: any,
145
+ ): void;
146
+ UNSAFE_componentWillUpdate?(
147
+ nextProps: Readonly<P & WithBannerAlertStateProps>,
148
+ nextState: Readonly<{
149
+ expanded?: boolean | undefined;
150
+ show?: boolean | undefined;
151
+ }>,
152
+ nextContext: any,
153
+ ): void;
154
+ };
155
+ displayName: string;
156
+ defaultProps: {
157
+ onDismiss: null;
158
+ onExpandToggle: null;
159
+ onHide: null;
160
+ expanded: boolean;
161
+ show: boolean;
162
+ hideAfter: null;
163
+ animateOnLeave: boolean;
164
+ children: null;
165
+ };
166
+ contextType?: import('react').Context<any> | undefined;
167
+ };
168
+ export default withBannerAlertState;
@@ -0,0 +1,111 @@
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
+
19
+ import { Component } from 'react';
20
+ import { wrapDisplayName } from "../../bpk-react-utils";
21
+ import BpkInfoBannerExpandable from "./BpkInfoBannerExpandable";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ const withBannerAlertState = WrappedComponent => {
24
+ class component extends Component {
25
+ static defaultProps = {
26
+ onDismiss: null,
27
+ onExpandToggle: null,
28
+ onHide: null,
29
+ expanded: false,
30
+ show: true,
31
+ hideAfter: null,
32
+ animateOnLeave: false,
33
+ children: null
34
+ };
35
+ constructor(props) {
36
+ super(props);
37
+ this.state = {
38
+ expanded: props.expanded,
39
+ show: true
40
+ };
41
+ this.hideIntervalId = null;
42
+ }
43
+ componentDidMount() {
44
+ const {
45
+ hideAfter
46
+ } = this.props;
47
+ if (WrappedComponent !== BpkInfoBannerExpandable && hideAfter && hideAfter > 0) {
48
+ this.hideIntervalId = setTimeout(() => {
49
+ this.onHide();
50
+ }, hideAfter * 1000);
51
+ }
52
+ }
53
+ componentWillUnmount() {
54
+ if (this.hideIntervalId) {
55
+ clearTimeout(this.hideIntervalId);
56
+ }
57
+ }
58
+ onExpandToggle = () => {
59
+ this.setState(prevState => {
60
+ const expanded = !prevState.expanded;
61
+ if (this.props.onExpandToggle) {
62
+ this.props.onExpandToggle(expanded);
63
+ }
64
+ return {
65
+ expanded
66
+ };
67
+ });
68
+ };
69
+ onDismiss = () => {
70
+ this.setState({
71
+ show: false
72
+ });
73
+ if (this.props.onDismiss) {
74
+ this.props.onDismiss();
75
+ }
76
+ };
77
+ onHide = () => {
78
+ this.setState({
79
+ show: false
80
+ });
81
+ if (this.props.onHide) {
82
+ this.props.onHide();
83
+ }
84
+ };
85
+ render() {
86
+ const {
87
+ animateOnLeave,
88
+ children,
89
+ expanded,
90
+ hideAfter,
91
+ onDismiss,
92
+ onExpandToggle,
93
+ onHide,
94
+ show,
95
+ ...rest
96
+ } = this.props;
97
+ return /*#__PURE__*/_jsx(WrappedComponent, {
98
+ expanded: this.state.expanded,
99
+ onExpandToggle: this.onExpandToggle,
100
+ onDismiss: this.onDismiss,
101
+ show: this.state.show,
102
+ animateOnLeave: hideAfter && hideAfter > 0 || animateOnLeave,
103
+ ...rest,
104
+ children: children
105
+ });
106
+ }
107
+ }
108
+ component.displayName = wrapDisplayName(WrappedComponent, 'withBannerAlertState');
109
+ return component;
110
+ };
111
+ export default withBannerAlertState;
@@ -54,7 +54,7 @@ export const BpkPriceMarkerV2 = props => {
54
54
  children: /*#__PURE__*/_jsxs("div", {
55
55
  className: classNames,
56
56
  children: [icon, /*#__PURE__*/_jsx(BpkText, {
57
- textStyle: TEXT_STYLES.label2,
57
+ textStyle: TEXT_STYLES.label3,
58
58
  children: label
59
59
  })]
60
60
  })
@@ -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
- @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-price-marker{display:flex;height:1.5rem;padding:0 0.5rem;justify-content:center;align-items:center;border-radius:.5rem;gap:0.5rem}.bpk-price-marker--dynamic{cursor:pointer}.bpk-price-marker-unselected{background-color:#fff;color:#161616}.bpk-price-marker-unselected--icon{fill:#161616}.bpk-price-marker-previous_selected{background-color:#cfe4ff;color:#161616}.bpk-price-marker-previous_selected--icon{fill:#161616}.bpk-price-marker-selected{background-color:#05203c;color:#fff}.bpk-price-marker-selected--icon{fill:#fff}.bpk-price-marker__wrapper{position:relative;display:flex;padding:0;flex-direction:column;align-items:center;border:none;background:none}
18
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-price-marker{display:flex;height:1.5rem;padding:0 0.5rem;justify-content:center;align-items:center;border-radius:.5rem;box-shadow:0px 1px 3px 0px rgba(37,32,31,0.3);gap:0.5rem}.bpk-price-marker--dynamic{cursor:pointer}.bpk-price-marker-unselected{background-color:#fff;color:#161616}.bpk-price-marker-unselected--icon{fill:#161616}.bpk-price-marker-previous_selected{background-color:#cfe4ff;color:#161616}.bpk-price-marker-previous_selected--icon{fill:#161616}.bpk-price-marker-selected{background-color:#05203c;color:#fff}.bpk-price-marker-selected--icon{fill:#fff}.bpk-price-marker__wrapper{position:relative;display:flex;padding:0;flex-direction:column;align-items:center;border:none;background:none}
@@ -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
- @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@keyframes bpk-modal-scrim{0%{opacity:0}100%{opacity:1}}@keyframes bpk-modal-scale{0%{transform:scale(0.9)}100%{transform:scale(1)}}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop{position:fixed;z-index:0;margin:0 auto;background-color:rgba(0,0,0,0.7);animation:bpk-modal-scrim 200ms ease-in-out;inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal{position:fixed;top:50%;left:50%;display:block;z-index:1;transform:translate(-50%, -50%) scale(1);transition:transform 200ms ease-in-out 200ms}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal:not([data-open='true']),.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop:not([data-open='true']){display:none}.bpk-modal{width:100%;max-width:none;height:100%;max-height:100%;padding:0;border:none;background:#fff;overflow-y:scroll;scrollbar-width:none;box-shadow:0px 12px 50px 0px rgba(37,32,31,0.25)}@media (min-width: 32.0625rem){.bpk-modal{width:32rem;max-width:none;height:fit-content;max-height:90%;border-radius:.75rem}.bpk-modal--full-screen-desktop{width:100%;height:100%;max-height:100%;border-radius:0}.bpk-modal--wide{width:64rem}}.bpk-modal[open]{animation:bpk-modal-scale 200ms ease-in-out}.bpk-modal--no-full-screen-mobile{width:90%;max-width:none;height:fit-content;max-height:90%}@media (min-width: 32.0625rem){.bpk-modal--no-full-screen-mobile{width:32rem;max-width:none}}.bpk-modal::backdrop{position:fixed;background-color:rgba(0,0,0,0.7);animation:bpk-modal-scrim 200ms ease-in-out;inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal::-webkit-scrollbar{display:none}.bpk-modal__header-title{padding:1rem;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__header-title-container{display:flex;width:100%;justify-content:flex-start}.bpk-modal__title{padding-inline-end:1rem;font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-modal__button-container{padding-block-start:1rem;padding-inline-end:1rem;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__container{min-height:100%;padding:1rem}.bpk-modal__container--padded{padding:0}.bpk-modal__container--full-screen-desktop{height:100%}
18
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@keyframes bpk-modal-scrim{0%{opacity:0}100%{opacity:1}}@keyframes bpk-modal-scale{0%{transform:scale(0.9)}100%{transform:scale(1)}}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop{position:fixed;z-index:0;margin:0 auto;background-color:rgba(0,0,0,0.7);animation:bpk-modal-scrim 200ms ease-in-out;inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal{position:fixed;top:50%;left:50%;display:block;z-index:1;transform:translate(-50%, -50%) scale(1);transition:transform 200ms ease-in-out 200ms}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal:not([data-open='true']),.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop:not([data-open='true']){display:none}.bpk-modal{width:100%;max-width:none;height:100%;max-height:100%;padding:0;border:none;background:#fff;overflow-y:scroll;scrollbar-width:none;box-shadow:0px 12px 50px 0px rgba(37,32,31,0.25)}@media (min-width: 32.0625rem){.bpk-modal{width:32rem;max-width:none;height:fit-content;max-height:90%;border-radius:.75rem}.bpk-modal--full-screen-desktop{width:100%;height:100%;max-height:100%;border-radius:0}.bpk-modal--wide{width:64rem;max-width:100%}}.bpk-modal[open]{animation:bpk-modal-scale 200ms ease-in-out}.bpk-modal--no-full-screen-mobile{width:90%;max-width:none;height:fit-content;max-height:90%}@media (min-width: 32.0625rem){.bpk-modal--no-full-screen-mobile{width:32rem;max-width:none}}.bpk-modal::backdrop{position:fixed;background-color:rgba(0,0,0,0.7);animation:bpk-modal-scrim 200ms ease-in-out;inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal::-webkit-scrollbar{display:none}.bpk-modal__header-title{padding:1rem;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__header-title-container{display:flex;width:100%;justify-content:flex-start}.bpk-modal__title{padding-inline-end:1rem;font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-modal__button-container{padding-block-start:1rem;padding-inline-end:1rem;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__container{min-height:100%;padding:1rem}.bpk-modal__container--padded{padding:0}.bpk-modal__container--full-screen-desktop{height:100%}
@@ -16,5 +16,5 @@
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  *
19
- *//*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}template,[hidden]{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:0.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}html{font-size:100%;box-sizing:border-box}*{box-sizing:inherit}*::before,*::after{box-sizing:inherit}body{color:#161616;font-family:"Skyscanner Relative",-apple-system,BlinkMacSystemFont,"Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:1rem;line-height:1.3rem}:global(body.scaffold-font-size){font-size:13px}:global(body.enable-font-smoothing){-webkit-font-smoothing:antialiased}:focus-visible{outline:.125rem solid #0062e3 !important;outline-offset:.125rem !important}:global(.hidden),:global(.hide){display:none !important}:global(.visuallyhidden),:global(.visually-hidden){position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}:global(.visuallyhidden.focusable):active,:global(.visuallyhidden.focusable):focus,:global(.visually-hidden.focusable):active,:global(.visually-hidden.focusable):focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}:global(.invisible){visibility:hidden}:global(.clearfix)::before,:global(.clearfix)::after{content:'';display:table}:global(.clearfix)::after{clear:both}
19
+ *//*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}template,[hidden]{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:0.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}html{font-size:100%;box-sizing:border-box}*{box-sizing:inherit}*::before,*::after{box-sizing:inherit}body{color:#161616;font-family:"Skyscanner Relative",-apple-system,BlinkMacSystemFont,"Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:1rem;line-height:1.3rem}body.scaffold-font-size{font-size:13px}body.enable-font-smoothing{-webkit-font-smoothing:antialiased}:focus-visible{outline:.125rem solid #0062e3 !important;outline-offset:.125rem !important}.hidden,.hide{display:none !important}.visuallyhidden,.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus,.visually-hidden.focusable:active,.visually-hidden.focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.invisible{visibility:hidden}.clearfix::before,.clearfix::after{content:'';display:table}.clearfix::after{clear:both}
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "31.2.0",
3
+ "version": "31.3.1",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@popperjs/core": "^2.11.5",
26
26
  "@react-google-maps/api": "^2.12.0",
27
- "@skyscanner/bpk-foundations-web": "^17.4.0",
27
+ "@skyscanner/bpk-foundations-web": "^17.5.3",
28
28
  "@skyscanner/bpk-svgs": "^19.0.0",
29
29
  "a11y-focus-scope": "^1.1.3",
30
30
  "a11y-focus-store": "^1.0.0",