@skyscanner/backpack-web 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ # bpk-component-price
2
+
3
+ > Backpack example component.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install bpk-component-price --save-dev
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import React from 'react';
15
+ import BpkPrice, { SIZES } from 'bpk-component-price';
16
+
17
+ export default () => (
18
+ <BpkPrice
19
+ size={SIZES.large}
20
+ subtitle="£209"
21
+ title="£1,830"
22
+ description="/ night"
23
+ />
24
+ );
25
+ ```
26
+
27
+ ## Props
28
+
29
+ | Property | PropType | Required | Default Value |
30
+ | --------- | -------- | -------- | ------------- |
31
+ | title | string | true | - |
32
+ | size | oneOf(SIZES) | false | SIZES.small |
33
+ | subtitle | string | false | null |
34
+ | description | string | false | null |
35
+ | className | string | false | null |
@@ -0,0 +1,23 @@
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 BpkPrice, { SIZES } from './src/BpkPrice';
21
+
22
+ export default BpkPrice;
23
+ export { SIZES };
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "bpk-component-price",
3
+ "version": "1.0.0",
4
+ "description": "Backpack price 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-text": "^7.0.4",
17
+ "bpk-mixins": "^31.1.1",
18
+ "bpk-react-utils": "^4.1.2",
19
+ "prop-types": "^15.5.8"
20
+ },
21
+ "peerDependencies": {
22
+ "react": "^16.3.0 || ^17.0.0"
23
+ }
24
+ }
@@ -0,0 +1,106 @@
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 from 'react';
22
+
23
+ import { cssModules } from '../../bpk-react-utils';
24
+ import BpkText, { TEXT_STYLES } from '../../bpk-component-text';
25
+
26
+ import STYLES from './BpkPrice.module.scss';
27
+
28
+ export const SIZES = {
29
+ small: 'small',
30
+ large: 'large',
31
+ };
32
+
33
+ type Props = {
34
+ title: string,
35
+ size: $Values<typeof SIZES>,
36
+ className: ?string,
37
+ subtitle: ?string,
38
+ description: ?string,
39
+ };
40
+
41
+ const getClassName = cssModules(STYLES);
42
+
43
+ const BpkPrice = (props: Props) => {
44
+ const { className, description, size, subtitle, title, ...rest } = props;
45
+
46
+ const isSmall = size === SIZES.small;
47
+
48
+ return (
49
+ <div
50
+ className={getClassName(
51
+ 'bpk-price',
52
+ isSmall && 'bpk-price--small',
53
+ className,
54
+ )}
55
+ // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
56
+ {...rest}
57
+ >
58
+ {subtitle && (
59
+ <BpkText
60
+ className={getClassName('bpk-price__subtitle')}
61
+ textStyle={isSmall ? TEXT_STYLES.xs : TEXT_STYLES.sm}
62
+ tagName="span"
63
+ >
64
+ {subtitle}
65
+ </BpkText>
66
+ )}
67
+ <div className={isSmall && getClassName('bpk-price__titleColumn')}>
68
+ <BpkText
69
+ textStyle={isSmall ? TEXT_STYLES.heading4 : TEXT_STYLES.xxl}
70
+ tagName="span"
71
+ >
72
+ {title}
73
+ </BpkText>
74
+ {description && (
75
+ <BpkText
76
+ textStyle={isSmall ? TEXT_STYLES.xs : TEXT_STYLES.sm}
77
+ tagName="span"
78
+ className={getClassName(
79
+ 'bpk-price__description',
80
+ !isSmall && 'bpk-price__descriptionSpacing',
81
+ )}
82
+ >
83
+ {description}
84
+ </BpkText>
85
+ )}
86
+ </div>
87
+ </div>
88
+ );
89
+ };
90
+
91
+ BpkPrice.propTypes = {
92
+ title: PropTypes.string.isRequired,
93
+ size: PropTypes.oneOf(Object.keys(SIZES)),
94
+ className: PropTypes.string,
95
+ subtitle: PropTypes.string,
96
+ description: PropTypes.string,
97
+ };
98
+
99
+ BpkPrice.defaultProps = {
100
+ size: SIZES.small,
101
+ className: null,
102
+ subtitle: null,
103
+ description: null,
104
+ };
105
+
106
+ export default BpkPrice;
@@ -0,0 +1,55 @@
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-price {
22
+ display: flex;
23
+ flex-direction: column;
24
+
25
+ &--small {
26
+ text-align: right;
27
+
28
+ @include bpk-rtl {
29
+ text-align: left;
30
+ }
31
+ }
32
+
33
+ &__subtitle {
34
+ color: $bpk-color-sky-gray-tint-02;
35
+ text-decoration-line: line-through;
36
+ }
37
+
38
+ &__titleColumn {
39
+ display: flex;
40
+ flex-direction: column;
41
+ }
42
+
43
+ &__description {
44
+ color: $bpk-color-sky-gray-tint-02;
45
+
46
+ &Spacing {
47
+ margin-left: bpk-spacing-sm();
48
+
49
+ @include bpk-rtl {
50
+ margin-right: bpk-spacing-sm();
51
+ margin-left: unset;
52
+ }
53
+ }
54
+ }
55
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-theme-toggle",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "Backpack theme toggle component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -19,7 +19,6 @@
19
19
  "bpk-component-select": "^5.1.10",
20
20
  "bpk-mixins": "^31.1.1",
21
21
  "bpk-react-utils": "^4.1.2",
22
- "konami": "^1.6.2",
23
22
  "prop-types": "^15.7.2"
24
23
  },
25
24
  "peerDependencies": {
@@ -17,7 +17,6 @@
17
17
  */
18
18
 
19
19
  import React from 'react';
20
- import Konami from 'konami';
21
20
 
22
21
  import BpkLabel from '../../bpk-component-label';
23
22
  import BpkSelect from '../../bpk-component-select';
@@ -48,17 +47,10 @@ class BpkThemeToggle extends React.Component {
48
47
 
49
48
  componentDidMount() {
50
49
  document.addEventListener('keydown', this.handleKeyDown);
51
- this.easterEgg = new Konami(() => {
52
- this.konamiInterval = setInterval(this.cycleTheme, 200);
53
- });
54
50
  }
55
51
 
56
52
  componentWillUnmount() {
57
53
  document.removeEventListener('keydown', this.handleKeyDown);
58
-
59
- if (this.konamiInterval) {
60
- clearInterval(this.konamiInterval);
61
- }
62
54
  }
63
55
 
64
56
  handleKeyDown = (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,13 +22,16 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
+ "@popperjs/core": "^2.11.5",
26
+ "@react-google-maps/api": "^2.12.0",
25
27
  "@skyscanner/bpk-foundations-web": "^8.0.0",
28
+ "@skyscanner/bpk-svgs": "^14.1.9",
26
29
  "a11y-focus-scope": "^1.1.3",
27
30
  "a11y-focus-store": "^1.0.0",
28
31
  "bpk-mixins": "^31.1.1",
29
- "date-fns": "^2.21.1",
30
32
  "d3-path": "^2.0.0",
31
33
  "d3-scale": "^4.0.2",
34
+ "date-fns": "^2.21.1",
32
35
  "intersection-observer": "^0.7.0",
33
36
  "lodash": "^4.17.20",
34
37
  "lodash.clamp": "^4.0.3",