@skyscanner/backpack-web 20.0.0 → 20.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.
@@ -15,9 +15,9 @@ import BpkCard from '@skyscanner/backpack-web/bpk-component-card';
15
15
 
16
16
  export default () => (
17
17
  <BpkCard>
18
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
19
- commodo ligula eget dolor. Aenean massa. Cum sociis natoque
20
- penatibus et magnis dis parturient montes, nascetur ridiculus mus.
18
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
19
+ ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis
20
+ parturient montes, nascetur ridiculus mus.
21
21
  </BpkCard>
22
22
  );
23
23
  ```
@@ -25,20 +25,22 @@ export default () => (
25
25
  ### BpkDividedCard
26
26
 
27
27
  ```js
28
- import { BpkDividedCard, ORIENTATION } from '@skyscanner/backpack-web/bpk-component-card';
28
+ import {
29
+ BpkDividedCard,
30
+ ORIENTATION,
31
+ } from '@skyscanner/backpack-web/bpk-component-card';
29
32
 
30
33
  export default () => (
31
34
  <>
32
35
  <BpkDividedCard
33
- primaryContent={'foo'}
34
- secondaryContent={'bar'}
36
+ primaryContent={<span>foo</span>}
37
+ secondaryContent={<span>bar</span>}
35
38
  orientation={ORIENTATION.vertical}
36
39
  />
37
-
38
40
  // Toggle shadow shadow with isElevated
39
41
  <BpkDividedCard
40
- primaryContent={'foo'}
41
- secondaryContent={'bar'}
42
+ primaryContent={<span>foo</span>}
43
+ secondaryContent={<span>bar</span>}
42
44
  orientation={ORIENTATION.horizontal}
43
45
  isElevated={false}
44
46
  />
@@ -46,6 +48,28 @@ export default () => (
46
48
  );
47
49
  ```
48
50
 
51
+ ### BpkCardWrapper
52
+
53
+ ```js
54
+ import { BpkCardWrapper } from '@skyscanner/backpack-web/bpk-component-card';
55
+ import { coreAccentDay } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
56
+ import BpkCard from '@skyscanner/backpack-web/bpk-component-card';
57
+
58
+ export default () => (
59
+ <BpkCardWrapper
60
+ header={<span>Hoc header</span>}
61
+ card={
62
+ <BpkCard>
63
+ Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
64
+ ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis
65
+ dis parturient montes, nascetur ridiculus mus.
66
+ </BpkCard>
67
+ }
68
+ backgroundColor={coreAccentDay}
69
+ />
70
+ );
71
+ ```
72
+
49
73
  ## Props
50
74
 
51
75
  ### BpkCard
@@ -60,11 +84,20 @@ export default () => (
60
84
 
61
85
  ### BpkDividedCard
62
86
 
63
- | Property | PropType | Required | Default Value |
64
- | --------- | -------- | -------- | ------------- |
65
- | primaryContent | node | true | - |
66
- | secondaryContent | node | true | - |
67
- | orientation | oneOf(ORIENTATION.horizontal, ORIENTATION.vertical) | false | ORIENTATION.horizontal |
68
- | href | string | false | null |
69
- | className | string | false | null |
70
- | isElevated | bool | false | true |
87
+ | Property | PropType | Required | Default Value |
88
+ | ---------------- | --------------------------------------------------- | -------- | ---------------------- |
89
+ | primaryContent | node | true | - |
90
+ | secondaryContent | node | true | - |
91
+ | orientation | oneOf(ORIENTATION.horizontal, ORIENTATION.vertical) | false | ORIENTATION.horizontal |
92
+ | href | string | false | null |
93
+ | className | string | false | null |
94
+ | isElevated | bool | false | true |
95
+
96
+ ### BpkCardWrapper
97
+
98
+ | Property | PropType | Required | Default Value |
99
+ | --------------- | -------- | -------- | ------------- |
100
+ | backgroundColor | string | true | null |
101
+ | card | node | true | - |
102
+ | header | node | true | - |
103
+ | className | string | false | null |
@@ -18,8 +18,9 @@
18
18
  /* @flow strict */
19
19
 
20
20
  import BpkCard from './src/BpkCard';
21
+ import BpkCardWrapper from './src/BpkCardWrapper';
21
22
  import BpkDividedCard, { ORIENTATION } from './src/BpkDividedCard';
22
23
 
23
- export { ORIENTATION, BpkDividedCard };
24
+ export { ORIENTATION, BpkDividedCard, BpkCardWrapper };
24
25
 
25
26
  export default BpkCard;
@@ -0,0 +1,66 @@
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
+ /* @flow strict */
20
+
21
+ import PropTypes from 'prop-types';
22
+ import { type Node } from 'react';
23
+
24
+ import { cssModules } from '../../bpk-react-utils';
25
+
26
+ import STYLES from './BpkCardWrapper.module.scss';
27
+
28
+ const getClassName = cssModules(STYLES);
29
+
30
+ type Props = {
31
+ card: Node,
32
+ className: ?string,
33
+ backgroundColor: string,
34
+ header: Node,
35
+ };
36
+
37
+ const BpkCardWrapper = (props: Props) => {
38
+ const { backgroundColor, card, className, header } = props;
39
+
40
+ const classNames = getClassName('bpk-card-wrapper', className);
41
+
42
+ return (
43
+ <div
44
+ className={classNames}
45
+ style={{
46
+ '--background-color': backgroundColor,
47
+ }}
48
+ >
49
+ <div className={getClassName('bpk-card-wrapper--header')}>{header}</div>
50
+ <div className={getClassName('bpk-card-wrapper--content')}>{card}</div>
51
+ </div>
52
+ );
53
+ };
54
+
55
+ BpkCardWrapper.propTypes = {
56
+ backgroundColor: PropTypes.string.isRequired,
57
+ card: PropTypes.node.isRequired,
58
+ className: PropTypes.string,
59
+ header: PropTypes.node.isRequired,
60
+ };
61
+
62
+ BpkCardWrapper.defaultProps = {
63
+ className: null,
64
+ };
65
+
66
+ export default BpkCardWrapper;
@@ -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 '~bpk-mixins/index.scss';
20
+
21
+ .bpk-card-wrapper {
22
+ @include bpk-card;
23
+ @include bpk-border-lg(var(--background-color), '');
24
+
25
+ &--header {
26
+ border-radius: $bpk-border-radius-sm $bpk-border-radius-sm 0 0;
27
+ background-color: var(--background-color);
28
+ overflow: hidden;
29
+ }
30
+
31
+ &--content {
32
+ position: relative;
33
+ border-radius: 0 0 $bpk-border-radius-md $bpk-border-radius-md;
34
+ overflow: hidden;
35
+
36
+ &::before,
37
+ &::after {
38
+ position: absolute;
39
+ top: 0;
40
+ content: ' ';
41
+ z-index: 2;
42
+ width: bpk-spacing-lg();
43
+ height: bpk-spacing-lg();
44
+ background-color: transparent;
45
+ box-shadow: bpk-spacing-base() 0 0 0 var(--background-color);
46
+ overflow: hidden;
47
+
48
+ @include bpk-border-radius-md;
49
+ }
50
+
51
+ &::before {
52
+ left: 0;
53
+ transform: rotate(225deg);
54
+ }
55
+
56
+ &::after {
57
+ right: 0;
58
+ transform: rotate(-45deg);
59
+ }
60
+ }
61
+ }
@@ -113,11 +113,11 @@ export default () => (
113
113
  | ---------------------- | --------------------------- | -------- | -------------------- |
114
114
  | rows | arrayOf(Object) | true | - |
115
115
  | children | arrayOf(BpkDataTableColumn) | true | - |
116
- | height | number | true | - |
117
- | width | number | false | full width of parent |
118
- | headerHeight | number | false | 60 |
116
+ | height | oneOfType(number, string) | true | - |
117
+ | width | oneOfType(number, string) | false | full width of parent |
118
+ | headerHeight | oneOfType(number, string) | false | 60 |
119
119
  | rowClassName | string | false | null |
120
- | rowHeight | number | false | 60 |
120
+ | rowHeight | oneOfType(number, string) | false | 60 |
121
121
  | rowStyle | object | false | {} |
122
122
  | onRowClick | func | false | null |
123
123
  | className | string | false | null |
@@ -193,4 +193,4 @@ function ({
193
193
  rowData: any,
194
194
  rowIndex: any,
195
195
  }): node
196
- ```
196
+ ```
@@ -212,10 +212,10 @@ const BpkDataTable = (props: Props) => {
212
212
  BpkDataTable.propTypes = {
213
213
  rows: PropTypes.arrayOf(Object).isRequired,
214
214
  children: PropTypes.node.isRequired,
215
- height: PropTypes.number.isRequired,
216
- width: PropTypes.number,
217
- headerHeight: PropTypes.number,
218
- rowHeight: PropTypes.number,
215
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
216
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
217
+ headerHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
218
+ rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
219
219
  className: PropTypes.string,
220
220
  defaultColumnSortIndex: PropTypes.number,
221
221
  sort: PropTypes.func,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "20.0.0",
3
+ "version": "20.1.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",