@skyscanner/backpack-web 19.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.
- package/README.md +0 -1
- package/bpk-component-banner-alert/src/BpkBannerAlert.module.scss +0 -8
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +0 -2
- package/bpk-component-banner-alert/src/common-types.js +1 -9
- package/bpk-component-button/README.md +0 -2
- package/bpk-component-button/index.js +0 -2
- package/bpk-component-button/src/BpkButton.js +0 -8
- package/bpk-component-calendar/README.md +1 -1
- package/bpk-component-calendar/src/BpkCalendarContainer.js +3 -18
- package/bpk-component-calendar/src/BpkCalendarGrid.js +1 -18
- package/bpk-component-calendar/src/BpkCalendarGridHeader.js +1 -6
- package/bpk-component-calendar/src/Week.js +1 -20
- package/bpk-component-calendar/src/composeCalendar.js +1 -11
- package/bpk-component-card/README.md +50 -17
- package/bpk-component-card/index.js +2 -1
- package/{bpk-component-grid/src/BpkGridContainer.js → bpk-component-card/src/BpkCardWrapper.js} +28 -23
- package/bpk-component-card/src/BpkCardWrapper.module.scss +61 -0
- package/bpk-component-datatable/README.md +5 -5
- package/bpk-component-datatable/src/BpkDataTable.js +4 -4
- package/bpk-component-datepicker/src/BpkDatepicker.js +1 -11
- package/bpk-component-flare/src/svgs/pointer.svg +1 -1
- package/bpk-component-icon/index.js +0 -4
- package/bpk-component-image/src/BpkBackgroundImage.js +2 -19
- package/bpk-component-image/src/BpkImage.js +2 -21
- package/bpk-component-input/index.js +2 -11
- package/bpk-component-link/src/BpkButtonLink.js +2 -7
- package/bpk-component-link/src/BpkLink.js +1 -7
- package/bpk-component-overlay/README.md +1 -2
- package/bpk-component-overlay/index.js +1 -2
- package/bpk-component-overlay/src/BpkOverlay.js +1 -14
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +1 -6
- package/bpk-component-switch/index.js +2 -5
- package/bpk-component-switch/src/BpkSwitch.js +2 -17
- package/bpk-component-switch/src/BpkSwitch.module.scss +6 -13
- package/bpk-component-table/README.md +0 -1
- package/bpk-component-table/src/BpkTable.js +3 -13
- package/bpk-component-table/src/BpkTable.module.scss +0 -8
- package/bpk-component-table/src/BpkTableHeadCell.js +4 -9
- package/package.json +1 -1
- package/bpk-component-button/BpkButtonOutline.js +0 -21
- package/bpk-component-button/src/BpkButtonOutline.js +0 -46
- package/bpk-component-button/src/BpkButtonOutline.module.css +0 -18
- package/bpk-component-button/src/BpkButtonOutline.module.scss +0 -23
- package/bpk-component-grid/README.md +0 -89
- package/bpk-component-grid/index.js +0 -25
- package/bpk-component-grid/src/BpkGridColumn.js +0 -117
- package/bpk-component-grid/src/BpkGridColumn.module.css +0 -18
- package/bpk-component-grid/src/BpkGridColumn.module.scss +0 -73
- package/bpk-component-grid/src/BpkGridContainer.module.css +0 -18
- package/bpk-component-grid/src/BpkGridContainer.module.scss +0 -33
- package/bpk-component-grid/src/BpkGridRow.js +0 -56
- package/bpk-component-grid/src/BpkGridRow.module.css +0 -18
- package/bpk-component-grid/src/BpkGridRow.module.scss +0 -29
- package/bpk-component-image/src/customPropTypes.js +0 -37
package/README.md
CHANGED
|
@@ -48,7 +48,6 @@ To contribute please see [contributing.md](CONTRIBUTING.md).
|
|
|
48
48
|
[`bpk-component-fieldset`](/packages/bpk-component-fieldset)
|
|
49
49
|
[`bpk-component-form-validation`](/packages/bpk-component-form-validation)
|
|
50
50
|
[`bpk-component-graphic-promotion`](/packages/bpk-component-graphic-promotion)
|
|
51
|
-
[`bpk-component-grid`](/packages/bpk-component-grid)
|
|
52
51
|
[`bpk-component-grid-toggle`](/packages/bpk-component-grid-toggle)
|
|
53
52
|
[`bpk-component-horizontal-nav`](/packages/bpk-component-horizontal-nav)
|
|
54
53
|
[`bpk-component-icon`](/packages/bpk-component-icon)
|
|
@@ -58,10 +58,6 @@ $bpk-spacing-v2: true;
|
|
|
58
58
|
@include bpk-border-sm($bpk-banner-alert-neutral-color, '');
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
&--event {
|
|
62
|
-
@include bpk-border-sm($bpk-banner-alert-event-color, '');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
61
|
&__header {
|
|
66
62
|
display: flex;
|
|
67
63
|
padding: bpk-spacing-md();
|
|
@@ -129,10 +125,6 @@ $bpk-spacing-v2: true;
|
|
|
129
125
|
fill: $bpk-text-secondary-day;
|
|
130
126
|
}
|
|
131
127
|
|
|
132
|
-
&__event-icon {
|
|
133
|
-
fill: $bpk-banner-alert-event-color;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
128
|
&__toggle-button {
|
|
137
129
|
padding: 0;
|
|
138
130
|
border: 0;
|
|
@@ -65,7 +65,6 @@ const getIconForType = (
|
|
|
65
65
|
[ALERT_TYPES.WARN]: getClassName('bpk-banner-alert__warn-icon'),
|
|
66
66
|
[ALERT_TYPES.ERROR]: getClassName('bpk-banner-alert__error-icon'),
|
|
67
67
|
[ALERT_TYPES.NEUTRAL]: getClassName('bpk-banner-alert__neutral-icon'),
|
|
68
|
-
[ALERT_TYPES.EVENT]: getClassName('bpk-banner-alert__event-icon'),
|
|
69
68
|
};
|
|
70
69
|
const className = classMap[type];
|
|
71
70
|
const componentMap: { [AlertTypeValue]: Node } = {
|
|
@@ -74,7 +73,6 @@ const getIconForType = (
|
|
|
74
73
|
[ALERT_TYPES.WARN]: InfoCircleIcon,
|
|
75
74
|
[ALERT_TYPES.ERROR]: InfoCircleIcon,
|
|
76
75
|
[ALERT_TYPES.NEUTRAL]: InfoCircleIcon,
|
|
77
|
-
[ALERT_TYPES.EVENT]: InfoCircleIcon,
|
|
78
76
|
};
|
|
79
77
|
const Icon = CustomIcon || componentMap[type];
|
|
80
78
|
const AlignedIcon = withButtonAlignment(Icon);
|
|
@@ -25,7 +25,6 @@ export const ALERT_TYPES = {
|
|
|
25
25
|
WARN: 'warn',
|
|
26
26
|
ERROR: 'error',
|
|
27
27
|
NEUTRAL: 'neutral',
|
|
28
|
-
EVENT: 'event', // DEPRECATED
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
export type AlertTypeValue = $Values<typeof ALERT_TYPES>;
|
|
@@ -45,14 +44,7 @@ export type OnDismissHandler = ?() => void;
|
|
|
45
44
|
export type OnHideHandler = ?() => void;
|
|
46
45
|
|
|
47
46
|
export const COMMON_PROP_TYPES = {
|
|
48
|
-
type: PropTypes.oneOf(
|
|
49
|
-
ALERT_TYPES.PRIMARY,
|
|
50
|
-
ALERT_TYPES.SUCCESS,
|
|
51
|
-
ALERT_TYPES.WARN,
|
|
52
|
-
ALERT_TYPES.ERROR,
|
|
53
|
-
ALERT_TYPES.NEUTRAL,
|
|
54
|
-
ALERT_TYPES.EVENT,
|
|
55
|
-
]).isRequired,
|
|
47
|
+
type: PropTypes.oneOf(Object.values(ALERT_TYPES)).isRequired,
|
|
56
48
|
message: PropTypes.node.isRequired,
|
|
57
49
|
animateOnEnter: PropTypes.bool,
|
|
58
50
|
animateOnLeave: PropTypes.bool,
|
|
@@ -23,7 +23,6 @@ export default () => (
|
|
|
23
23
|
<BpkButton secondaryOnDark>SecondaryOnDark</BpkButton>
|
|
24
24
|
<BpkButton link>Link</BpkButton>
|
|
25
25
|
<BpkButton linkOnDark>LinkOnDark</BpkButton>
|
|
26
|
-
<BpkButton outline>Outline (Deprecated, use PrimaryOnDark or PrimaryOnLight instead)</BpkButton>
|
|
27
26
|
<BpkButton primaryOnDark>PrimaryOnDark</BpkButton>
|
|
28
27
|
<BpkButton primaryOnLight>PrimaryOnLight</BpkButton>
|
|
29
28
|
<BpkButton iconOnly>
|
|
@@ -43,7 +42,6 @@ export default () => (
|
|
|
43
42
|
| featured | bool | false | false |
|
|
44
43
|
| link | bool | false | false |
|
|
45
44
|
| linkOnDark | bool | false | false |
|
|
46
|
-
| outline | bool (deprecated) | false | false |
|
|
47
45
|
| secondary | bool | false | false |
|
|
48
46
|
| secondaryOnDark | bool | false | false |
|
|
49
47
|
| primaryOnDark | bool | false | false |
|
|
@@ -28,7 +28,6 @@ import BpkButtonDestructive from './src/BpkButtonDestructive';
|
|
|
28
28
|
import BpkButtonLink from './src/BpkButtonLink';
|
|
29
29
|
import BpkButtonLinkOnDark from './src/BpkButtonLinkOnDark';
|
|
30
30
|
import BpkButtonFeatured from './src/BpkButtonFeatured';
|
|
31
|
-
import BpkButtonOutline from './src/BpkButtonOutline';
|
|
32
31
|
|
|
33
32
|
export {
|
|
34
33
|
buttonThemeAttributes,
|
|
@@ -53,5 +52,4 @@ export {
|
|
|
53
52
|
BpkButtonLink,
|
|
54
53
|
BpkButtonLinkOnDark,
|
|
55
54
|
BpkButtonFeatured,
|
|
56
|
-
BpkButtonOutline,
|
|
57
55
|
};
|
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
BpkButtonLink,
|
|
32
32
|
BpkButtonLinkOnDark,
|
|
33
33
|
BpkButtonFeatured,
|
|
34
|
-
BpkButtonOutline,
|
|
35
34
|
} from '../index';
|
|
36
35
|
|
|
37
36
|
import {
|
|
@@ -48,7 +47,6 @@ type Props = {
|
|
|
48
47
|
secondaryOnDark: boolean,
|
|
49
48
|
destructive: boolean,
|
|
50
49
|
featured: boolean,
|
|
51
|
-
outline: boolean,
|
|
52
50
|
link: boolean,
|
|
53
51
|
linkOnDark: boolean,
|
|
54
52
|
};
|
|
@@ -59,7 +57,6 @@ const BpkButton = (props: Props) => {
|
|
|
59
57
|
featured,
|
|
60
58
|
link,
|
|
61
59
|
linkOnDark,
|
|
62
|
-
outline,
|
|
63
60
|
primaryOnDark,
|
|
64
61
|
primaryOnLight,
|
|
65
62
|
secondary,
|
|
@@ -87,9 +84,6 @@ const BpkButton = (props: Props) => {
|
|
|
87
84
|
if (featured) {
|
|
88
85
|
return <BpkButtonFeatured {...rest} />;
|
|
89
86
|
}
|
|
90
|
-
if (outline) {
|
|
91
|
-
return <BpkButtonOutline {...rest} />;
|
|
92
|
-
}
|
|
93
87
|
if (link) {
|
|
94
88
|
return <BpkButtonLink {...rest} />;
|
|
95
89
|
}
|
|
@@ -107,7 +101,6 @@ BpkButton.propTypes = {
|
|
|
107
101
|
secondaryOnDark: PropTypes.bool,
|
|
108
102
|
destructive: PropTypes.bool,
|
|
109
103
|
featured: PropTypes.bool,
|
|
110
|
-
outline: PropTypes.bool,
|
|
111
104
|
link: PropTypes.bool,
|
|
112
105
|
linkOnDark: PropTypes.bool,
|
|
113
106
|
};
|
|
@@ -120,7 +113,6 @@ BpkButton.defaultProps = {
|
|
|
120
113
|
secondaryOnDark: false,
|
|
121
114
|
destructive: false,
|
|
122
115
|
featured: false,
|
|
123
|
-
outline: false,
|
|
124
116
|
link: false,
|
|
125
117
|
linkOnDark: false,
|
|
126
118
|
};
|
|
@@ -373,7 +373,7 @@ const onMonthChange = (event, {
|
|
|
373
373
|
|
|
374
374
|
#### initiallyFocusedDate
|
|
375
375
|
|
|
376
|
-
Sets the date that is focused initially, this prop has no effect if `
|
|
376
|
+
Sets the date that is focused initially, this prop has no effect if `selectionConfiguration` is specified in which case the date specified in this prop is focused. If no selected date is set and `initiallyFocusedDate` is not set the focused date is the `minDate`(defaults to today if it has not been explicitly set).
|
|
377
377
|
|
|
378
378
|
#### navProps, headerProps, gridProps, dateProps
|
|
379
379
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
20
|
import { Component } from 'react';
|
|
21
21
|
|
|
22
|
-
import {
|
|
22
|
+
import { isRTL } from '../../bpk-react-utils';
|
|
23
23
|
|
|
24
24
|
import CustomPropTypes, { CALENDAR_SELECTION_TYPE } from './custom-proptypes';
|
|
25
25
|
import BpkCalendarNav from './BpkCalendarNav';
|
|
@@ -287,13 +287,8 @@ const withCalendarState = (Calendar) => {
|
|
|
287
287
|
};
|
|
288
288
|
|
|
289
289
|
render() {
|
|
290
|
-
const {
|
|
291
|
-
|
|
292
|
-
maxDate,
|
|
293
|
-
minDate,
|
|
294
|
-
selectionConfiguration,
|
|
295
|
-
...calendarProps
|
|
296
|
-
} = this.props;
|
|
290
|
+
const { maxDate, minDate, selectionConfiguration, ...calendarProps } =
|
|
291
|
+
this.props;
|
|
297
292
|
|
|
298
293
|
delete calendarProps.onDateSelect;
|
|
299
294
|
delete calendarProps.onMonthChange;
|
|
@@ -326,25 +321,16 @@ const withCalendarState = (Calendar) => {
|
|
|
326
321
|
}
|
|
327
322
|
|
|
328
323
|
BpkCalendarContainer.propTypes = {
|
|
329
|
-
date: deprecated(
|
|
330
|
-
PropTypes.instanceOf(Date),
|
|
331
|
-
'Use selectionConfiguration to set selectedDate',
|
|
332
|
-
),
|
|
333
324
|
fixedWidth: PropTypes.bool,
|
|
334
325
|
maxDate: PropTypes.instanceOf(Date),
|
|
335
326
|
minDate: PropTypes.instanceOf(Date),
|
|
336
327
|
onDateSelect: PropTypes.func,
|
|
337
328
|
onMonthChange: PropTypes.func,
|
|
338
329
|
selectionConfiguration: CustomPropTypes.SelectionConfiguration,
|
|
339
|
-
selectedDate: deprecated(
|
|
340
|
-
PropTypes.instanceOf(Date),
|
|
341
|
-
'Use selectionConfiguration to set selectedDate',
|
|
342
|
-
),
|
|
343
330
|
initiallyFocusedDate: PropTypes.instanceOf(Date),
|
|
344
331
|
};
|
|
345
332
|
|
|
346
333
|
BpkCalendarContainer.defaultProps = {
|
|
347
|
-
date: null,
|
|
348
334
|
fixedWidth: true,
|
|
349
335
|
maxDate: addMonths(new Date(), 12),
|
|
350
336
|
minDate: new Date(),
|
|
@@ -354,7 +340,6 @@ const withCalendarState = (Calendar) => {
|
|
|
354
340
|
type: CALENDAR_SELECTION_TYPE.single,
|
|
355
341
|
date: null,
|
|
356
342
|
},
|
|
357
|
-
selectedDate: null,
|
|
358
343
|
initiallyFocusedDate: null,
|
|
359
344
|
};
|
|
360
345
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
20
|
import { Component } from 'react';
|
|
21
21
|
|
|
22
|
-
import { cssModules,
|
|
22
|
+
import { cssModules, isDeviceIos } from '../../bpk-react-utils';
|
|
23
23
|
|
|
24
24
|
import BpkCalendarGridHeader from './BpkCalendarGridHeader';
|
|
25
25
|
import Week from './Week';
|
|
@@ -103,8 +103,6 @@ class BpkCalendarGrid extends Component {
|
|
|
103
103
|
onDateKeyDown,
|
|
104
104
|
preventKeyboardFocus,
|
|
105
105
|
selectionConfiguration,
|
|
106
|
-
selectionEnd,
|
|
107
|
-
selectionStart,
|
|
108
106
|
weekStartsOn,
|
|
109
107
|
} = this.props;
|
|
110
108
|
|
|
@@ -139,8 +137,6 @@ class BpkCalendarGrid extends Component {
|
|
|
139
137
|
markToday={markToday}
|
|
140
138
|
markOutsideDays={markOutsideDays}
|
|
141
139
|
selectionConfiguration={selectionConfiguration}
|
|
142
|
-
selectionEnd={selectionEnd}
|
|
143
|
-
selectionStart={selectionStart}
|
|
144
140
|
focusedDate={focusedDate}
|
|
145
141
|
minDate={minDate}
|
|
146
142
|
maxDate={maxDate}
|
|
@@ -177,16 +173,6 @@ export const propTypes = {
|
|
|
177
173
|
onDateKeyDown: PropTypes.func,
|
|
178
174
|
preventKeyboardFocus: PropTypes.bool,
|
|
179
175
|
selectionConfiguration: CustomPropTypes.SelectionConfiguration,
|
|
180
|
-
selectedDate: deprecated(
|
|
181
|
-
PropTypes.instanceOf(Date),
|
|
182
|
-
'Use selectionConfiguration to set selectedDate',
|
|
183
|
-
),
|
|
184
|
-
selectionEnd: PropTypes.instanceOf(Date),
|
|
185
|
-
selectionStart: PropTypes.instanceOf(Date),
|
|
186
|
-
showWeekendSeparator: deprecated(
|
|
187
|
-
PropTypes.bool,
|
|
188
|
-
'The showWeekendSeparator prop in BpkCalendarGrid is now deprecated as no longer part of the calendar, so is no longer required',
|
|
189
|
-
),
|
|
190
176
|
ignoreOutsideDate: PropTypes.bool,
|
|
191
177
|
dateProps: PropTypes.object,
|
|
192
178
|
};
|
|
@@ -205,10 +191,7 @@ BpkCalendarGrid.defaultProps = {
|
|
|
205
191
|
onDateClick: null,
|
|
206
192
|
onDateKeyDown: null,
|
|
207
193
|
preventKeyboardFocus: false,
|
|
208
|
-
selectedDate: null,
|
|
209
194
|
selectionConfiguration: { type: CALENDAR_SELECTION_TYPE.single, date: null },
|
|
210
|
-
selectionEnd: null,
|
|
211
|
-
selectionStart: null,
|
|
212
195
|
ignoreOutsideDate: false,
|
|
213
196
|
dateProps: null,
|
|
214
197
|
cellClassName: null,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
20
|
import { PureComponent } from 'react';
|
|
21
21
|
|
|
22
|
-
import { cssModules
|
|
22
|
+
import { cssModules } from '../../bpk-react-utils';
|
|
23
23
|
|
|
24
24
|
import CustomPropTypes from './custom-proptypes';
|
|
25
25
|
import { orderDaysOfWeek } from './date-utils';
|
|
@@ -94,11 +94,6 @@ BpkCalendarGridHeader.propTypes = {
|
|
|
94
94
|
isTableHead: PropTypes.bool,
|
|
95
95
|
className: PropTypes.string,
|
|
96
96
|
weekDayKey: CustomPropTypes.WeekDayKey,
|
|
97
|
-
// eslint-disable-next-line react/require-default-props,react/no-unused-prop-types
|
|
98
|
-
showWeekendSeparator: deprecated(
|
|
99
|
-
PropTypes.bool,
|
|
100
|
-
'The showWeekendSeparator prop in BpkCalendarGridHeader is now deprecated as no longer part of the calendar, so is no longer required',
|
|
101
|
-
),
|
|
102
97
|
};
|
|
103
98
|
|
|
104
99
|
BpkCalendarGridHeader.defaultProps = {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
20
|
import { Component } from 'react';
|
|
21
21
|
|
|
22
|
-
import { cssModules
|
|
22
|
+
import { cssModules } from '../../bpk-react-utils';
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
25
|
isSameDay,
|
|
@@ -379,10 +379,6 @@ Week.propTypes = {
|
|
|
379
379
|
isKeyboardFocusable: PropTypes.bool.isRequired,
|
|
380
380
|
month: PropTypes.instanceOf(Date).isRequired,
|
|
381
381
|
weekStartsOn: PropTypes.number.isRequired,
|
|
382
|
-
daysOfWeek: deprecated(
|
|
383
|
-
CustomPropTypes.DaysOfWeek,
|
|
384
|
-
'daysOfWeek property in Week is now deprecated as no longer part of the calendar, so is no longer required',
|
|
385
|
-
),
|
|
386
382
|
focusedDate: PropTypes.instanceOf(Date),
|
|
387
383
|
maxDate: PropTypes.instanceOf(Date),
|
|
388
384
|
minDate: PropTypes.instanceOf(Date),
|
|
@@ -390,33 +386,18 @@ Week.propTypes = {
|
|
|
390
386
|
onDateClick: PropTypes.func,
|
|
391
387
|
onDateKeyDown: PropTypes.func,
|
|
392
388
|
selectionConfiguration: CustomPropTypes.SelectionConfiguration,
|
|
393
|
-
selectedDate: deprecated(
|
|
394
|
-
PropTypes.instanceOf(Date),
|
|
395
|
-
'Use selectionConfiguration to set selectedDate',
|
|
396
|
-
),
|
|
397
|
-
selectionEnd: PropTypes.instanceOf(Date),
|
|
398
|
-
selectionStart: PropTypes.instanceOf(Date),
|
|
399
|
-
// eslint-disable-next-line react/require-default-props
|
|
400
|
-
showWeekendSeparator: deprecated(
|
|
401
|
-
PropTypes.bool,
|
|
402
|
-
'The showWeekendSeparator prop in Week is now deprecated as no longer part of the calendar, so is no longer required',
|
|
403
|
-
),
|
|
404
389
|
ignoreOutsideDate: PropTypes.bool,
|
|
405
390
|
dateProps: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
|
406
391
|
};
|
|
407
392
|
|
|
408
393
|
Week.defaultProps = {
|
|
409
394
|
cellClassName: null,
|
|
410
|
-
daysOfWeek: null,
|
|
411
395
|
focusedDate: null,
|
|
412
396
|
maxDate: null,
|
|
413
397
|
minDate: null,
|
|
414
398
|
onDateClick: null,
|
|
415
399
|
onDateKeyDown: null,
|
|
416
400
|
selectionConfiguration: { type: CALENDAR_SELECTION_TYPE.single, date: null },
|
|
417
|
-
selectedDate: null,
|
|
418
|
-
selectionEnd: null,
|
|
419
|
-
selectionStart: null,
|
|
420
401
|
ignoreOutsideDate: false,
|
|
421
402
|
dateProps: null,
|
|
422
403
|
};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
20
|
|
|
21
|
-
import { cssModules
|
|
21
|
+
import { cssModules } from '../../bpk-react-utils';
|
|
22
22
|
|
|
23
23
|
import CustomPropTypes, { CALENDAR_SELECTION_TYPE } from './custom-proptypes';
|
|
24
24
|
import STYLES from './BpkCalendar.module.scss';
|
|
@@ -159,15 +159,6 @@ const composeCalendar = (Nav, GridHeader, Grid, CalendarDate) => {
|
|
|
159
159
|
onDateKeyDown: PropTypes.func,
|
|
160
160
|
preventKeyboardFocus: PropTypes.bool,
|
|
161
161
|
selectionConfiguration: CustomPropTypes.SelectionConfiguration,
|
|
162
|
-
selectedDate: deprecated(
|
|
163
|
-
PropTypes.instanceOf(Date),
|
|
164
|
-
'Use selectionConfiguration to set selectedDate',
|
|
165
|
-
),
|
|
166
|
-
// eslint-disable-next-line react/require-default-props
|
|
167
|
-
showWeekendSeparator: deprecated(
|
|
168
|
-
PropTypes.bool,
|
|
169
|
-
'The showWeekendSeparator prop in composeCalendar is now deprecated as no longer part of the calendar, so is no longer required',
|
|
170
|
-
),
|
|
171
162
|
gridClassName: PropTypes.string,
|
|
172
163
|
weekDayKey: PropTypes.string,
|
|
173
164
|
/* eslint-disable react/forbid-prop-types */
|
|
@@ -196,7 +187,6 @@ const composeCalendar = (Nav, GridHeader, Grid, CalendarDate) => {
|
|
|
196
187
|
type: CALENDAR_SELECTION_TYPE.single,
|
|
197
188
|
date: null,
|
|
198
189
|
},
|
|
199
|
-
selectedDate: null,
|
|
200
190
|
gridClassName: null,
|
|
201
191
|
weekDayKey: 'nameAbbr',
|
|
202
192
|
navProps: null,
|
|
@@ -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
|
-
|
|
20
|
-
|
|
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 {
|
|
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={
|
|
34
|
-
secondaryContent={
|
|
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={
|
|
41
|
-
secondaryContent={
|
|
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
|
|
64
|
-
|
|
|
65
|
-
| primaryContent
|
|
66
|
-
| secondaryContent | node
|
|
67
|
-
| orientation
|
|
68
|
-
| href
|
|
69
|
-
| className
|
|
70
|
-
| isElevated
|
|
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;
|
package/{bpk-component-grid/src/BpkGridContainer.js → bpk-component-card/src/BpkCardWrapper.js}
RENAMED
|
@@ -16,46 +16,51 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
/* @flow strict */
|
|
20
|
+
|
|
19
21
|
import PropTypes from 'prop-types';
|
|
22
|
+
import { type Node } from 'react';
|
|
20
23
|
|
|
21
24
|
import { cssModules } from '../../bpk-react-utils';
|
|
22
25
|
|
|
23
|
-
import STYLES from './
|
|
26
|
+
import STYLES from './BpkCardWrapper.module.scss';
|
|
24
27
|
|
|
25
28
|
const getClassName = cssModules(STYLES);
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
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;
|
|
30
39
|
|
|
31
|
-
|
|
32
|
-
classNames.push(getClassName('bpk-grid__container--debug'));
|
|
33
|
-
}
|
|
34
|
-
if (fullWidth) {
|
|
35
|
-
classNames.push(getClassName('bpk-grid__container--full-width'));
|
|
36
|
-
}
|
|
37
|
-
if (className) {
|
|
38
|
-
classNames.push(className);
|
|
39
|
-
}
|
|
40
|
+
const classNames = getClassName('bpk-card-wrapper', className);
|
|
40
41
|
|
|
41
42
|
return (
|
|
42
|
-
<div
|
|
43
|
-
{
|
|
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>
|
|
44
51
|
</div>
|
|
45
52
|
);
|
|
46
53
|
};
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
fullWidth: PropTypes.bool,
|
|
55
|
+
BpkCardWrapper.propTypes = {
|
|
56
|
+
backgroundColor: PropTypes.string.isRequired,
|
|
57
|
+
card: PropTypes.node.isRequired,
|
|
52
58
|
className: PropTypes.string,
|
|
59
|
+
header: PropTypes.node.isRequired,
|
|
53
60
|
};
|
|
54
61
|
|
|
55
|
-
|
|
56
|
-
debug: false,
|
|
57
|
-
fullWidth: false,
|
|
62
|
+
BpkCardWrapper.defaultProps = {
|
|
58
63
|
className: null,
|
|
59
64
|
};
|
|
60
65
|
|
|
61
|
-
export default
|
|
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
|
|
117
|
-
| width | number
|
|
118
|
-
| headerHeight | number
|
|
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
|
|
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,
|