@skyscanner/backpack-web 3.1.0 → 4.0.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-animate-height/package.json +2 -2
- package/bpk-component-accordion/package.json +6 -6
- package/bpk-component-aria-live/package.json +7 -7
- package/bpk-component-autosuggest/package.json +4 -4
- package/bpk-component-badge/package.json +4 -4
- package/bpk-component-banner-alert/package.json +8 -8
- package/bpk-component-barchart/package.json +7 -7
- package/bpk-component-blockquote/package.json +2 -2
- package/bpk-component-breadcrumb/package.json +5 -5
- package/bpk-component-breakpoint/package.json +2 -2
- package/bpk-component-button/package.json +2 -2
- package/bpk-component-calendar/package.json +8 -8
- package/bpk-component-card/package.json +4 -4
- package/bpk-component-checkbox/package.json +4 -4
- package/bpk-component-chip/package.json +5 -5
- package/bpk-component-close-button/package.json +4 -4
- package/bpk-component-code/package.json +2 -2
- package/bpk-component-content-container/package.json +2 -2
- package/bpk-component-datatable/package.json +3 -3
- package/bpk-component-datepicker/package.json +8 -8
- package/bpk-component-description-list/package.json +2 -2
- package/bpk-component-dialog/package.json +8 -8
- package/bpk-component-drawer/package.json +8 -8
- package/bpk-component-fieldset/package.json +12 -12
- package/bpk-component-flare/package.json +4 -4
- package/bpk-component-floating-notification/README.md +53 -0
- package/bpk-component-floating-notification/index.js +27 -0
- package/bpk-component-floating-notification/package.json +25 -0
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +150 -0
- package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +18 -0
- package/bpk-component-floating-notification/src/BpkFloatingNotification.module.scss +96 -0
- package/bpk-component-form-validation/package.json +9 -9
- package/bpk-component-graphic-promotion/package.json +4 -5
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +22 -6
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo.module.scss +14 -4
- package/bpk-component-grid/package.json +2 -2
- package/bpk-component-grid-toggle/package.json +3 -3
- package/bpk-component-horizontal-nav/package.json +5 -5
- package/bpk-component-icon/package.json +5 -5
- package/bpk-component-image/package.json +6 -6
- package/bpk-component-infinite-scroll/package.json +6 -6
- package/bpk-component-input/package.json +6 -6
- package/bpk-component-label/package.json +2 -2
- package/bpk-component-link/package.json +3 -3
- package/bpk-component-list/package.json +2 -2
- package/bpk-component-loading-button/package.json +6 -6
- package/bpk-component-map/package.json +6 -6
- package/bpk-component-mobile-scroll-container/package.json +2 -2
- package/bpk-component-modal/package.json +9 -9
- package/bpk-component-navigation-bar/package.json +7 -7
- package/bpk-component-navigation-stack/package.json +6 -6
- package/bpk-component-nudger/package.json +6 -6
- package/bpk-component-overlay/package.json +4 -4
- package/bpk-component-pagination/package.json +4 -4
- package/bpk-component-panel/package.json +2 -2
- package/bpk-component-phone-input/package.json +8 -8
- package/bpk-component-popover/package.json +8 -8
- package/bpk-component-popover/src/BpkPopoverPortal.js +3 -3
- package/bpk-component-price/package.json +3 -3
- package/bpk-component-progress/package.json +4 -4
- package/bpk-component-radio/package.json +3 -3
- package/bpk-component-rating/package.json +3 -3
- package/bpk-component-rtl-toggle/package.json +3 -3
- package/bpk-component-scrollable-calendar/package.json +5 -5
- package/bpk-component-section-list/package.json +5 -5
- package/bpk-component-select/package.json +3 -3
- package/bpk-component-skip-link/package.json +2 -2
- package/bpk-component-slider/package.json +3 -3
- package/bpk-component-spinner/package.json +2 -2
- package/bpk-component-star-rating/package.json +5 -5
- package/bpk-component-switch/package.json +2 -2
- package/bpk-component-table/package.json +2 -2
- package/bpk-component-text/package.json +2 -2
- package/bpk-component-textarea/package.json +4 -4
- package/bpk-component-theme-toggle/package.json +4 -4
- package/bpk-component-ticket/package.json +4 -4
- package/bpk-component-tooltip/package.json +3 -3
- package/bpk-component-tooltip/src/BpkTooltipPortal.js +3 -3
- package/bpk-react-utils/index.js +3 -0
- package/bpk-react-utils/package.json +1 -1
- package/bpk-react-utils/src/Portal-v1.js +310 -0
- package/bpk-react-utils/src/Portal.js +42 -54
- package/bpk-scrim-utils/package.json +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-flare",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
4
4
|
"description": "Backpack FlareBar and ContentBubble component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"bpk-component-label": "^5.1.
|
|
21
|
-
"bpk-component-text": "^7.0.
|
|
20
|
+
"bpk-component-label": "^5.1.11",
|
|
21
|
+
"bpk-component-text": "^7.0.5",
|
|
22
22
|
"bpk-mixins": "^31.1.1",
|
|
23
|
-
"bpk-react-utils": "^
|
|
23
|
+
"bpk-react-utils": "^5.0.0",
|
|
24
24
|
"prop-types": "^15.7.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# bpk-component-floating-notification
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install bpk-component-floating-notification --save-dev
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import BpkFloatingNotification from 'bpk-component-floating-notification';
|
|
14
|
+
import BpkIconHeart from '../../packages/bpk-component-icon/sm/heart';
|
|
15
|
+
|
|
16
|
+
export default () => (
|
|
17
|
+
<BpkFloatingNotification
|
|
18
|
+
ctaText="View"
|
|
19
|
+
type={TYPE.dark}
|
|
20
|
+
icon={BpkIconHeart}
|
|
21
|
+
onClick={() => {}}
|
|
22
|
+
text="Killer Combo saved to New York and Miami 🎉"
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Props
|
|
28
|
+
|
|
29
|
+
| Property | PropType | Required | Default Value |
|
|
30
|
+
| -------------- | ------------ | -------- | ------------- |
|
|
31
|
+
| animateOnEnter | bool | false | true |
|
|
32
|
+
| animateOnExit | bool | false | true |
|
|
33
|
+
| className | string | false | null |
|
|
34
|
+
| ctaText | string | false | null |
|
|
35
|
+
| hideAfter | number | false | 4000 |
|
|
36
|
+
| icon | ReactElement | false | null |
|
|
37
|
+
| onClick | func | false | null |
|
|
38
|
+
| text | string | true | - |
|
|
39
|
+
| type | oneOf(TYPE) | false | TYPE.light |
|
|
40
|
+
|
|
41
|
+
### Prop Details
|
|
42
|
+
|
|
43
|
+
#### hideAfter
|
|
44
|
+
|
|
45
|
+
This prop controls the amount of time that the notification stays visible before the exit animation begins.
|
|
46
|
+
|
|
47
|
+
The default value is 4 seconds (4000 milliseconds).
|
|
48
|
+
|
|
49
|
+
#### type
|
|
50
|
+
|
|
51
|
+
By default the component is rendered in the light theme (`TYPE.light`) which uses a dark background and white text for the notification. This contrasts against a white page.
|
|
52
|
+
|
|
53
|
+
The dark theme (`TYPE.dark`) displays the notification with a white background and black text. This contrasts against a dark page.
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/* @flow strict */
|
|
19
|
+
|
|
20
|
+
import BpkFloatingNotification, {
|
|
21
|
+
type Props as BpkFloatingNotificationProps,
|
|
22
|
+
TYPE,
|
|
23
|
+
} from './src/BpkFloatingNotification';
|
|
24
|
+
|
|
25
|
+
export type { BpkFloatingNotificationProps };
|
|
26
|
+
export { TYPE };
|
|
27
|
+
export default BpkFloatingNotification;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bpk-component-floating-notification",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Backpack floating-notification component.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git@github.com:Skyscanner/backpack.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Backpack Design System <backpack@skyscanner.net>",
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"bpk-component-button": "^6.2.6",
|
|
17
|
+
"bpk-component-text": "^7.0.5",
|
|
18
|
+
"bpk-mixins": "^31.1.1",
|
|
19
|
+
"bpk-react-utils": "^5.0.0",
|
|
20
|
+
"prop-types": "^15.5.8"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": "^16.8.0 || ^17.0.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
/* @flow strict */
|
|
19
|
+
|
|
20
|
+
import PropTypes from 'prop-types';
|
|
21
|
+
import React, { useEffect, useState, ReactElement } from 'react';
|
|
22
|
+
import { CSSTransition } from 'react-transition-group';
|
|
23
|
+
|
|
24
|
+
import BpkButton from '../../bpk-component-button';
|
|
25
|
+
import BpkText, { TEXT_STYLES } from '../../bpk-component-text';
|
|
26
|
+
import { cssModules } from '../../bpk-react-utils';
|
|
27
|
+
|
|
28
|
+
import STYLES from './BpkFloatingNotification.module.scss';
|
|
29
|
+
|
|
30
|
+
const getClassName = cssModules(STYLES);
|
|
31
|
+
|
|
32
|
+
export const TYPE = {
|
|
33
|
+
light: 'light',
|
|
34
|
+
dark: 'dark',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type Props = {
|
|
38
|
+
animateOnEnter: ?boolean,
|
|
39
|
+
animateOnExit: ?boolean,
|
|
40
|
+
className: ?string,
|
|
41
|
+
ctaText: ?string,
|
|
42
|
+
hideAfter: ?number,
|
|
43
|
+
icon: ?() => ReactElement,
|
|
44
|
+
onClick: ?() => void,
|
|
45
|
+
text: string,
|
|
46
|
+
type: ?TYPE,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const BpkFloatingNotification = (props: Props) => {
|
|
50
|
+
const [showMessage, setShowMessage] = useState(true);
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
animateOnEnter,
|
|
54
|
+
animateOnExit,
|
|
55
|
+
className,
|
|
56
|
+
ctaText,
|
|
57
|
+
hideAfter,
|
|
58
|
+
icon: Icon,
|
|
59
|
+
onClick,
|
|
60
|
+
text,
|
|
61
|
+
type,
|
|
62
|
+
...rest
|
|
63
|
+
} = props;
|
|
64
|
+
|
|
65
|
+
const classNames = getClassName(
|
|
66
|
+
'bpk-floating-notification',
|
|
67
|
+
type === TYPE.dark && 'bpk-floating-notification--dark',
|
|
68
|
+
className,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const iconClassNames = getClassName(
|
|
72
|
+
'bpk-floating-notification__icon',
|
|
73
|
+
type === TYPE.dark && 'bpk-floating-notification__icon--dark',
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const buttonClassNames = getClassName(
|
|
77
|
+
'bpk-floating-notification__button',
|
|
78
|
+
type === TYPE.dark && 'bpk-floating-notification__button--dark',
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
let timer;
|
|
83
|
+
if (hideAfter) {
|
|
84
|
+
timer = setTimeout(() => setShowMessage(false), hideAfter);
|
|
85
|
+
}
|
|
86
|
+
return () => timer && clearTimeout(timer);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<CSSTransition
|
|
91
|
+
in={showMessage}
|
|
92
|
+
classNames={{
|
|
93
|
+
exit: getClassName('bpk-floating-notification--leave'),
|
|
94
|
+
exitActive: getClassName('bpk-floating-notification--leave-active'),
|
|
95
|
+
exitDone: getClassName('bpk-floating-notification--leave-done'),
|
|
96
|
+
appear: getClassName('bpk-floating-notification--appear'),
|
|
97
|
+
appearActive: getClassName('bpk-floating-notification--appear-active'),
|
|
98
|
+
}}
|
|
99
|
+
timeout={400}
|
|
100
|
+
appear={animateOnEnter}
|
|
101
|
+
exit={animateOnExit}
|
|
102
|
+
unmountOnExit
|
|
103
|
+
>
|
|
104
|
+
<div className={classNames} {...rest}>
|
|
105
|
+
{Icon && (
|
|
106
|
+
<div className={iconClassNames}>
|
|
107
|
+
<Icon />
|
|
108
|
+
</div>
|
|
109
|
+
)}
|
|
110
|
+
<BpkText
|
|
111
|
+
tagName="p"
|
|
112
|
+
textStyle={TEXT_STYLES.bodyDefault}
|
|
113
|
+
className={getClassName('bpk-floating-notification__text')}
|
|
114
|
+
>
|
|
115
|
+
{text}
|
|
116
|
+
</BpkText>
|
|
117
|
+
{ctaText && (
|
|
118
|
+
<BpkButton link onClick={onClick} className={buttonClassNames}>
|
|
119
|
+
{ctaText}
|
|
120
|
+
</BpkButton>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
</CSSTransition>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
BpkFloatingNotification.propTypes = {
|
|
128
|
+
animateOnEnter: PropTypes.bool,
|
|
129
|
+
animateOnExit: PropTypes.bool,
|
|
130
|
+
className: PropTypes.string,
|
|
131
|
+
ctaText: PropTypes.string,
|
|
132
|
+
hideAfter: PropTypes.number,
|
|
133
|
+
icon: PropTypes.ReactElement,
|
|
134
|
+
onClick: PropTypes.func,
|
|
135
|
+
text: PropTypes.string.isRequired,
|
|
136
|
+
type: PropTypes.oneOf(Object.values(TYPE)),
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
BpkFloatingNotification.defaultProps = {
|
|
140
|
+
animateOnEnter: true,
|
|
141
|
+
animateOnExit: true,
|
|
142
|
+
className: null,
|
|
143
|
+
ctaText: null,
|
|
144
|
+
hideAfter: 4000,
|
|
145
|
+
icon: null,
|
|
146
|
+
onClick: null,
|
|
147
|
+
type: TYPE.light,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default BpkFloatingNotification;
|
|
@@ -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-floating-notification{display:flex}
|
|
@@ -0,0 +1,96 @@
|
|
|
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 '~bpk-mixins/index';
|
|
20
|
+
|
|
21
|
+
.bpk-floating-notification {
|
|
22
|
+
position: absolute;
|
|
23
|
+
right: 0;
|
|
24
|
+
bottom: bpk-spacing-xl();
|
|
25
|
+
left: 0;
|
|
26
|
+
display: flex;
|
|
27
|
+
max-width: bpk-spacing-xxl() * 10;
|
|
28
|
+
margin: auto;
|
|
29
|
+
padding: bpk-spacing-lg();
|
|
30
|
+
transition: opacity $bpk-duration-base ease-in-out,
|
|
31
|
+
transform $bpk-duration-base ease-in-out;
|
|
32
|
+
border-radius: $bpk-border-radius-md;
|
|
33
|
+
background: $bpk-color-sky-blue-shade-03;
|
|
34
|
+
color: $bpk-color-white;
|
|
35
|
+
box-shadow: $bpk-box-shadow-xl, $bpk-box-shadow-lg;
|
|
36
|
+
|
|
37
|
+
@include bpk-breakpoint-mobile {
|
|
38
|
+
max-width: 100%;
|
|
39
|
+
padding: bpk-spacing-base();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--leave {
|
|
43
|
+
transform: translateY(0);
|
|
44
|
+
opacity: 1;
|
|
45
|
+
|
|
46
|
+
&-active {
|
|
47
|
+
transform: translateY(bpk-spacing-xl());
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-done {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&--appear {
|
|
57
|
+
transform: translateY(bpk-spacing-xl());
|
|
58
|
+
opacity: 0;
|
|
59
|
+
|
|
60
|
+
&-active {
|
|
61
|
+
transform: translateY(0);
|
|
62
|
+
opacity: 1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&__button {
|
|
67
|
+
min-height: 0;
|
|
68
|
+
margin: 0 0 auto auto;
|
|
69
|
+
padding: 0;
|
|
70
|
+
color: $bpk-color-sky-blue-tint-01;
|
|
71
|
+
|
|
72
|
+
&--dark {
|
|
73
|
+
color: $bpk-link-color;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__icon {
|
|
78
|
+
margin: bpk-spacing-sm() bpk-spacing-md() 0 bpk-spacing-sm();
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
text-align: bottom;
|
|
81
|
+
fill: $bpk-color-white;
|
|
82
|
+
|
|
83
|
+
&--dark {
|
|
84
|
+
fill: $bpk-color-sky-gray;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__text {
|
|
89
|
+
margin-right: bpk-spacing-md();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&--dark {
|
|
93
|
+
background: $bpk-color-white;
|
|
94
|
+
color: $bpk-color-sky-gray;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-form-validation",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.15",
|
|
4
4
|
"description": "Backpack form-validation component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"bpk-animate-height": "^4.1.
|
|
17
|
+
"bpk-animate-height": "^4.1.11",
|
|
18
18
|
"bpk-mixins": "^31.1.1",
|
|
19
|
-
"bpk-react-utils": "^
|
|
19
|
+
"bpk-react-utils": "^5.0.0",
|
|
20
20
|
"prop-types": "^15.7.2"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@skyscanner/bpk-foundations-web": "^8.0.0",
|
|
27
|
-
"bpk-component-button": "^6.2.
|
|
28
|
-
"bpk-component-checkbox": "^4.1.
|
|
29
|
-
"bpk-component-icon": "^9.2.
|
|
30
|
-
"bpk-component-input": "^6.1.
|
|
31
|
-
"bpk-component-select": "^5.1.
|
|
32
|
-
"bpk-component-textarea": "^4.2.
|
|
27
|
+
"bpk-component-button": "^6.2.6",
|
|
28
|
+
"bpk-component-checkbox": "^4.1.13",
|
|
29
|
+
"bpk-component-icon": "^9.2.12",
|
|
30
|
+
"bpk-component-input": "^6.1.15",
|
|
31
|
+
"bpk-component-select": "^5.1.11",
|
|
32
|
+
"bpk-component-textarea": "^4.2.11"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-graphic-promotion",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Backpack graphic-promotion component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
"registry": "https://registry.npmjs.org/"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"bpk-component-button": "^6.2.
|
|
17
|
-
"bpk-component-
|
|
18
|
-
"bpk-component-text": "^7.0.4",
|
|
16
|
+
"bpk-component-button": "^6.2.6",
|
|
17
|
+
"bpk-component-text": "^7.0.5",
|
|
19
18
|
"bpk-mixins": "^31.1.1",
|
|
20
|
-
"bpk-react-utils": "^
|
|
19
|
+
"bpk-react-utils": "^5.0.0",
|
|
21
20
|
"prop-types": "^15.5.8"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
@@ -23,12 +23,20 @@ import React from 'react';
|
|
|
23
23
|
import { cssModules } from '../../bpk-react-utils';
|
|
24
24
|
import BpkText from '../../bpk-component-text';
|
|
25
25
|
import BpkButton from '../../bpk-component-button';
|
|
26
|
-
import BpkCard from '../../bpk-component-card';
|
|
27
26
|
|
|
28
27
|
import STYLES from './BpkGraphicPromo.module.scss';
|
|
29
28
|
|
|
30
29
|
const getClassName = cssModules(STYLES);
|
|
31
30
|
|
|
31
|
+
const ACCESSIBILITY_KEYS = {
|
|
32
|
+
Enter: 13 /* Enter */,
|
|
33
|
+
Space: 32 /* Space */,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const isAccessibilityClick = (event: React.KeyboardEvent<HTMLElement>) =>
|
|
37
|
+
Object.keys(ACCESSIBILITY_KEYS).includes(event.key) ||
|
|
38
|
+
Object.values(ACCESSIBILITY_KEYS).includes(event.keyCode || event.which);
|
|
39
|
+
|
|
32
40
|
export const TEXT_ALIGN = {
|
|
33
41
|
start: 'start',
|
|
34
42
|
center: 'center',
|
|
@@ -94,8 +102,10 @@ const BpkGraphicPromo = (props: Props) => {
|
|
|
94
102
|
event.stopPropagation();
|
|
95
103
|
onClick();
|
|
96
104
|
};
|
|
105
|
+
const onKeyWrapper = (event: React.KeyboardEvent<HTMLElement>) =>
|
|
106
|
+
isAccessibilityClick(event) && onClick();
|
|
97
107
|
|
|
98
|
-
const cardClasses = getClassName('bpk-graphic-promo', className);
|
|
108
|
+
const cardClasses = getClassName('bpk-card', 'bpk-graphic-promo', className);
|
|
99
109
|
const containerClasses = getClassName(
|
|
100
110
|
'bpk-graphic-promo__container',
|
|
101
111
|
`bpk-graphic-promo__container--${textAlign}`,
|
|
@@ -104,13 +114,19 @@ const BpkGraphicPromo = (props: Props) => {
|
|
|
104
114
|
|
|
105
115
|
const getTextClasses = (baseClass: string) =>
|
|
106
116
|
getClassName(baseClass, `${baseClass}--${textAlign}`);
|
|
117
|
+
|
|
107
118
|
return (
|
|
108
|
-
|
|
119
|
+
// The card appears as a single component for the screen reader; its children are hidden. The card handles mouse
|
|
120
|
+
// clicks and key presses (Enter/Space) for the whole component, as described here:
|
|
121
|
+
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets
|
|
122
|
+
<div
|
|
109
123
|
className={cardClasses}
|
|
110
124
|
style={style}
|
|
111
|
-
|
|
125
|
+
role="link"
|
|
112
126
|
aria-label={constructAriaLabel(props)}
|
|
113
|
-
|
|
127
|
+
tabIndex={0}
|
|
128
|
+
onClick={onClickWrapper}
|
|
129
|
+
onKeyDown={onKeyWrapper}
|
|
114
130
|
>
|
|
115
131
|
<div className={containerClasses} aria-hidden>
|
|
116
132
|
<div className={getTextClasses('bpk-graphic-promo__sponsor-content')}>
|
|
@@ -163,7 +179,7 @@ const BpkGraphicPromo = (props: Props) => {
|
|
|
163
179
|
</BpkButton>
|
|
164
180
|
</div>
|
|
165
181
|
</div>
|
|
166
|
-
</
|
|
182
|
+
</div>
|
|
167
183
|
);
|
|
168
184
|
};
|
|
169
185
|
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
@import '~bpk-mixins/index';
|
|
20
20
|
@import './custom-breakpoints.module';
|
|
21
21
|
|
|
22
|
+
.bpk-card {
|
|
23
|
+
@include bpk-card;
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
.bpk-graphic-promo {
|
|
23
27
|
max-width: 65.5rem;
|
|
24
28
|
margin-right: auto;
|
|
@@ -30,8 +34,6 @@
|
|
|
30
34
|
box-shadow: none;
|
|
31
35
|
|
|
32
36
|
@include breakpoint-landscape {
|
|
33
|
-
pointer-events: none;
|
|
34
|
-
|
|
35
37
|
&__sponsor-label {
|
|
36
38
|
margin-bottom: bpk-spacing-sm();
|
|
37
39
|
|
|
@@ -172,6 +174,11 @@
|
|
|
172
174
|
|
|
173
175
|
@include bpk-margin-leading(bpk-spacing-xxxl(), false);
|
|
174
176
|
@include bpk-margin-trailing(bpk-spacing-xxl(), false);
|
|
177
|
+
|
|
178
|
+
/* adjusting for 1.5rem different between margins */
|
|
179
|
+
&--center > * {
|
|
180
|
+
@include bpk-margin-trailing(bpk-spacing-lg());
|
|
181
|
+
}
|
|
175
182
|
}
|
|
176
183
|
|
|
177
184
|
@include breakpoint-landscape-tablet {
|
|
@@ -179,6 +186,11 @@
|
|
|
179
186
|
|
|
180
187
|
@include bpk-margin-leading(bpk-spacing-xxl(), false);
|
|
181
188
|
@include bpk-margin-trailing(bpk-spacing-xl(), false);
|
|
189
|
+
|
|
190
|
+
/* adjusting for 0.5rem different between margins */
|
|
191
|
+
&--center > * {
|
|
192
|
+
@include bpk-margin-trailing(bpk-spacing-md());
|
|
193
|
+
}
|
|
182
194
|
}
|
|
183
195
|
|
|
184
196
|
@include breakpoint-portrait-large {
|
|
@@ -237,8 +249,6 @@
|
|
|
237
249
|
}
|
|
238
250
|
|
|
239
251
|
&__cta {
|
|
240
|
-
pointer-events: auto;
|
|
241
|
-
|
|
242
252
|
@include breakpoint-landscape {
|
|
243
253
|
margin-top: bpk-spacing-xl();
|
|
244
254
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-grid",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.11",
|
|
4
4
|
"description": "Backpack grid components.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"bpk-mixins": "^31.1.1",
|
|
18
|
-
"bpk-react-utils": "^
|
|
18
|
+
"bpk-react-utils": "^5.0.0",
|
|
19
19
|
"prop-types": "^15.7.2"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-grid-toggle",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.11",
|
|
4
4
|
"description": "Backpack vertical grid toggle component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"bpk-component-link": "^3.1.
|
|
17
|
+
"bpk-component-link": "^3.1.11",
|
|
18
18
|
"bpk-mixins": "^31.1.1",
|
|
19
|
-
"bpk-react-utils": "^
|
|
19
|
+
"bpk-react-utils": "^5.0.0",
|
|
20
20
|
"prop-types": "^15.7.2"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-horizontal-nav",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.12",
|
|
4
4
|
"description": "Backpack horizontal nav component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"bpk-component-mobile-scroll-container": "^3.1.
|
|
17
|
+
"bpk-component-mobile-scroll-container": "^3.1.11",
|
|
18
18
|
"bpk-mixins": "^31.1.1",
|
|
19
|
-
"bpk-react-utils": "^
|
|
19
|
+
"bpk-react-utils": "^5.0.0",
|
|
20
20
|
"prop-types": "^15.7.2"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@skyscanner/bpk-foundations-web": "^8.0.0",
|
|
27
|
-
"bpk-component-text": "^7.0.
|
|
28
|
-
"bpk-storybook-utils": "^1.1.
|
|
27
|
+
"bpk-component-text": "^7.0.5",
|
|
28
|
+
"bpk-storybook-utils": "^1.1.10"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-icon",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.12",
|
|
4
4
|
"description": "Backpack icon components.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"@skyscanner/bpk-foundations-web": "^8.0.0",
|
|
21
21
|
"@skyscanner/bpk-svgs": "^14.1.9",
|
|
22
22
|
"bpk-mixins": "^31.1.1",
|
|
23
|
-
"bpk-react-utils": "^
|
|
23
|
+
"bpk-react-utils": "^5.0.0",
|
|
24
24
|
"prop-types": "^15.7.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"bpk-component-button": "^6.2.
|
|
28
|
-
"bpk-component-list": "^4.0.
|
|
29
|
-
"bpk-component-text": "^7.0.
|
|
27
|
+
"bpk-component-button": "^6.2.6",
|
|
28
|
+
"bpk-component-list": "^4.0.4",
|
|
29
|
+
"bpk-component-text": "^7.0.5"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^16.3.0 || ^17.0.0"
|