@skyscanner/backpack-web 9.2.0-beta.3 → 10.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.
Files changed (118) hide show
  1. package/bpk-animate-height/package.json +3 -3
  2. package/bpk-component-accordion/package.json +7 -7
  3. package/bpk-component-aria-live/README.md +2 -2
  4. package/bpk-component-aria-live/{index.js → index.ts} +0 -1
  5. package/bpk-component-aria-live/package.json +9 -10
  6. package/bpk-component-aria-live/src/BpkAriaLive-test.tsx +60 -0
  7. package/bpk-component-aria-live/src/{BpkAriaLive.js → BpkAriaLive.tsx} +20 -26
  8. package/bpk-component-aria-live/src/accessibility-test.tsx +31 -0
  9. package/bpk-component-autosuggest/package.json +4 -4
  10. package/bpk-component-badge/package.json +5 -5
  11. package/bpk-component-banner-alert/package.json +9 -9
  12. package/bpk-component-barchart/package.json +8 -8
  13. package/bpk-component-blockquote/package.json +2 -2
  14. package/bpk-component-breadcrumb/package.json +5 -5
  15. package/bpk-component-breadcrumb/src/BpkBreadcrumbItem.module.scss +2 -2
  16. package/bpk-component-breakpoint/package.json +3 -3
  17. package/bpk-component-button/package.json +3 -3
  18. package/bpk-component-calendar/DOCS.md +1 -7
  19. package/bpk-component-calendar/README.md +0 -10
  20. package/bpk-component-calendar/index.js +0 -2
  21. package/bpk-component-calendar/package.json +9 -9
  22. package/bpk-component-calendar/src/BpkCalendarDate.js +0 -15
  23. package/bpk-component-calendar/src/BpkCalendarDate.module.scss +17 -50
  24. package/bpk-component-calendar/src/BpkCalendarGrid.js +3 -2
  25. package/bpk-component-calendar/src/BpkCalendarGrid.module.scss +5 -5
  26. package/bpk-component-calendar/src/_variables.scss +1 -3
  27. package/bpk-component-card/package.json +4 -4
  28. package/bpk-component-checkbox/package.json +5 -5
  29. package/bpk-component-chip/package.json +5 -5
  30. package/bpk-component-close-button/package.json +4 -4
  31. package/bpk-component-code/package.json +2 -2
  32. package/bpk-component-content-cards/README.md +43 -0
  33. package/bpk-component-content-cards/index.ts +21 -0
  34. package/bpk-component-content-cards/package.json +23 -0
  35. package/bpk-component-content-cards/src/BpkContentCard-test.tsx +88 -0
  36. package/bpk-component-content-cards/src/BpkContentCard.module.scss +87 -0
  37. package/bpk-component-content-cards/src/BpkContentCard.tsx +84 -0
  38. package/bpk-component-content-cards/src/BpkContentCards-test.tsx +126 -0
  39. package/bpk-component-content-cards/src/BpkContentCards.module.css +18 -0
  40. package/bpk-component-content-cards/src/BpkContentCards.module.scss +51 -0
  41. package/bpk-component-content-cards/src/BpkContentCards.tsx +72 -0
  42. package/bpk-component-content-cards/src/accessibility-test.tsx +64 -0
  43. package/bpk-component-content-container/package.json +2 -2
  44. package/bpk-component-datatable/README.md +78 -21
  45. package/bpk-component-datatable/package.json +5 -6
  46. package/bpk-component-datatable/src/BpkDataTable.js +176 -143
  47. package/bpk-component-datatable/src/BpkDataTable.module.scss +10 -14
  48. package/bpk-component-datatable/src/BpkDataTableColumn.js +37 -40
  49. package/bpk-component-datatable/src/BpkDataTableHeader.js +143 -0
  50. package/bpk-component-datatable/src/{BpkDataTableColumn.module.scss → BpkDataTableHeader.module.scss} +12 -11
  51. package/bpk-component-datatable/src/common-types.js +33 -11
  52. package/bpk-component-datatable/src/sort-types.js +6 -0
  53. package/bpk-component-datatable/src/utils.js +66 -9
  54. package/bpk-component-datepicker/package.json +9 -9
  55. package/bpk-component-description-list/package.json +2 -2
  56. package/bpk-component-dialog/package.json +8 -8
  57. package/bpk-component-drawer/package.json +9 -9
  58. package/bpk-component-fieldset/package.json +12 -12
  59. package/bpk-component-flare/package.json +4 -4
  60. package/bpk-component-floating-notification/package.json +5 -5
  61. package/bpk-component-form-validation/package.json +10 -10
  62. package/bpk-component-graphic-promotion/package.json +6 -5
  63. package/bpk-component-graphic-promotion/src/BpkGraphicPromo-test.tsx +3 -2
  64. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.tsx +24 -24
  65. package/bpk-component-grid/package.json +2 -2
  66. package/bpk-component-grid-toggle/package.json +3 -3
  67. package/bpk-component-horizontal-nav/package.json +6 -6
  68. package/bpk-component-icon/package.json +7 -7
  69. package/bpk-component-image/package.json +6 -6
  70. package/bpk-component-infinite-scroll/package.json +6 -6
  71. package/bpk-component-input/package.json +6 -6
  72. package/bpk-component-label/package.json +2 -2
  73. package/bpk-component-link/package.json +4 -4
  74. package/bpk-component-list/README.md +8 -5
  75. package/bpk-component-list/package.json +2 -2
  76. package/bpk-component-list/src/BpkList.js +18 -2
  77. package/bpk-component-loading-button/package.json +6 -6
  78. package/bpk-component-map/package.json +6 -6
  79. package/bpk-component-map/src/BpkIconMarker.module.scss +3 -3
  80. package/bpk-component-map/src/BpkIconMarkerBackground.module.scss +4 -4
  81. package/bpk-component-map/src/BpkPriceMarker.module.scss +17 -17
  82. package/bpk-component-map/src/DefaultLoadingElement.module.scss +1 -1
  83. package/bpk-component-mobile-scroll-container/package.json +3 -3
  84. package/bpk-component-modal/package.json +9 -9
  85. package/bpk-component-navigation-bar/package.json +8 -8
  86. package/bpk-component-nudger/package.json +7 -7
  87. package/bpk-component-overlay/package.json +4 -4
  88. package/bpk-component-pagination/package.json +4 -4
  89. package/bpk-component-panel/package.json +2 -2
  90. package/bpk-component-phone-input/package.json +9 -9
  91. package/bpk-component-popover/package.json +8 -8
  92. package/bpk-component-price/package.json +3 -3
  93. package/bpk-component-progress/package.json +5 -5
  94. package/bpk-component-radio/package.json +4 -4
  95. package/bpk-component-rating/package.json +4 -4
  96. package/bpk-component-rtl-toggle/package.json +2 -2
  97. package/bpk-component-scrollable-calendar/package.json +7 -7
  98. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +100 -69
  99. package/bpk-component-scrollable-calendar/src/utils.js +24 -1
  100. package/bpk-component-section-list/package.json +6 -6
  101. package/bpk-component-select/package.json +3 -3
  102. package/bpk-component-skip-link/package.json +2 -2
  103. package/bpk-component-slider/package.json +4 -4
  104. package/bpk-component-spinner/package.json +3 -3
  105. package/bpk-component-split-input/package.json +3 -3
  106. package/bpk-component-star-rating/package.json +5 -5
  107. package/bpk-component-switch/package.json +2 -2
  108. package/bpk-component-table/package.json +2 -2
  109. package/bpk-component-text/package.json +2 -2
  110. package/bpk-component-textarea/package.json +4 -4
  111. package/bpk-component-theme-toggle/package.json +5 -5
  112. package/bpk-component-ticket/package.json +4 -4
  113. package/bpk-component-tooltip/package.json +4 -4
  114. package/bpk-scrim-utils/package.json +2 -2
  115. package/bpk-theming/package.json +2 -2
  116. package/package.json +6 -5
  117. package/bpk-component-datatable/src/bpkHeaderRenderer.js +0 -110
  118. package/bpk-component-datatable/src/sorter.js +0 -166
@@ -17,34 +17,56 @@
17
17
  */
18
18
 
19
19
  /* @flow strict */
20
- import type { ChildrenArray, Element } from 'react';
21
-
22
- import BpkDataTableColumn from './BpkDataTableColumn';
23
20
  import type {
24
21
  SortDirectionType as _SortDirectionType,
25
22
  SortProps as _SortProps,
26
23
  } from './sort-types';
27
24
 
28
- export type ColumnType = {
29
- toColumn(column: any, key: string): any,
30
- };
31
-
32
- export type DataTableProps = {
25
+ type CommonColumnProps = {
26
+ defaultSortDirection: _SortDirectionType,
27
+ flexGrow: number,
33
28
  headerClassName: ?string,
34
- rowClassName: ?string,
29
+ headerStyle: ?{},
30
+ label: ?string,
31
+ minWidth: ?number,
32
+ width: number,
35
33
  };
36
34
 
37
35
  export type Props<Row> = {
38
- ...$Exact<DataTableProps>,
39
36
  rows: Array<Row>,
40
- children: ChildrenArray<Element<typeof BpkDataTableColumn> & ColumnType>,
37
+ children: Node,
38
+ height: number,
41
39
  width: ?number,
42
40
  headerHeight: number,
41
+ rowHeight: number,
43
42
  className: ?string,
44
43
  defaultColumnSortIndex: number,
44
+ headerClassName: ?string,
45
+ rowClassName: ?string,
45
46
  onRowClick: (Row) => mixed,
46
47
  ...$Exact<_SortProps>,
47
48
  };
48
49
 
50
+ export type ColumnType = {
51
+ disableSortBy: boolean,
52
+ getHeaderProps: Function,
53
+ isSorted: boolean,
54
+ isSortedDesc: boolean,
55
+ render: Function,
56
+ sortDirection: _SortDirectionType,
57
+ toggleSortBy: Function,
58
+ ...$Exact<CommonColumnProps>,
59
+ };
60
+
61
+ export type BpkDataTableColumnProps = {
62
+ cellDataGetter: ?Function,
63
+ cellRenderer: ?Function,
64
+ className: ?string,
65
+ dataKey: string,
66
+ disableSort: boolean,
67
+ headerRenderer: ?Function,
68
+ ...$Exact<CommonColumnProps>,
69
+ };
70
+
49
71
  export type SortDirectionType = _SortDirectionType;
50
72
  export type SortProps = _SortProps;
@@ -20,6 +20,12 @@
20
20
 
21
21
  // This file exists to break a cycle that would otherwise happen between
22
22
  // BpkDataTableColumn.js and common-types.js
23
+
24
+ export const SORT_DIRECTION_TYPES = {
25
+ ASC: 'ASC',
26
+ DESC: 'DESC',
27
+ };
28
+
23
29
  export type SortDirectionType = 'ASC' | ' DESC';
24
30
 
25
31
  export type SortProps = {
@@ -17,14 +17,71 @@
17
17
  */
18
18
  /* @flow strict */
19
19
 
20
+ // TODO: Remove these functions once we want to change the API to match the react-table library API
21
+ // To maintain backwards compatibility with the old API of BpkDataTable which takes columns as children
22
+ // The `react-table` library however expects columns as an array of objects
20
23
  // eslint-disable-next-line import/prefer-default-export
21
- export const hasClassName = (node: ?Element, className: ?string): boolean => {
22
- if (node == null) {
23
- return false;
24
- }
24
+ export const getColumns = (columns) =>
25
+ columns.map((column) => {
26
+ const { cellDataGetter, cellRenderer, headerRenderer } = column.props;
27
+ // To maintain backwards compatibility with the old API of BpkDataTable we rename the parameters
28
+ // And create an interface so that the function signature doesn't depend on the underlying library
29
+ const columnCellRenderer = ({
30
+ column: { id: dataKey },
31
+ columns: columnsData,
32
+ row: { id: rowID, values: rowData },
33
+ sortedRows,
34
+ value: cellData,
35
+ }) => {
36
+ const columnIndex = columnsData.map((col) => col.id).indexOf(dataKey);
37
+ const rowIndex = sortedRows.map((row) => row.id).indexOf(rowID);
25
38
 
26
- const nodeClassName = node.getAttribute('class');
27
- return (
28
- nodeClassName != null && nodeClassName.split(' ').indexOf(className) !== -1
29
- );
30
- };
39
+ return cellRenderer({
40
+ cellData,
41
+ columnIndex,
42
+ dataKey,
43
+ rowData,
44
+ rowIndex,
45
+ });
46
+ };
47
+
48
+ const columnCellDataGetter = ({
49
+ column: { id: dataKey },
50
+ row: { values: rowData },
51
+ }) => cellDataGetter({ dataKey, rowData });
52
+
53
+ const columnHeaderRenderer = ({
54
+ column: { disableSortBy: disableSort, id: dataKey, label },
55
+ }) => headerRenderer({ dataKey, label, disableSort });
56
+
57
+ const {
58
+ className,
59
+ dataKey,
60
+ defaultSortDirection,
61
+ disableSort,
62
+ flexGrow,
63
+ headerClassName,
64
+ headerStyle,
65
+ label,
66
+ minWidth,
67
+ style,
68
+ width,
69
+ } = column.props;
70
+ return {
71
+ Header: headerRenderer ? columnHeaderRenderer : label,
72
+ accessor: dataKey,
73
+ ...((cellRenderer || cellDataGetter) && {
74
+ Cell: columnCellRenderer || columnCellDataGetter,
75
+ }),
76
+ className,
77
+ disableSortBy: disableSort,
78
+ defaultSortDirection,
79
+ flexGrow,
80
+ headerClassName,
81
+ headerStyle,
82
+ label,
83
+ minWidth,
84
+ style,
85
+ width,
86
+ };
87
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-datepicker",
3
- "version": "18.0.1",
3
+ "version": "18.0.3",
4
4
  "description": "Backpack datepicker component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-component-breakpoint": "^5.0.1",
18
- "bpk-component-calendar": "^12.0.1",
19
- "bpk-component-input": "^7.0.1",
20
- "bpk-component-modal": "^6.0.1",
21
- "bpk-component-popover": "^8.0.1",
22
- "bpk-mixins": "^31.4.0",
17
+ "bpk-component-breakpoint": "^5.0.3",
18
+ "bpk-component-calendar": "^13.0.0",
19
+ "bpk-component-input": "^7.0.3",
20
+ "bpk-component-modal": "^6.0.3",
21
+ "bpk-component-popover": "^8.0.3",
22
+ "bpk-mixins": "^31.6.1",
23
23
  "bpk-react-utils": "^7.0.0",
24
24
  "prop-types": "^15.7.2"
25
25
  },
@@ -27,7 +27,7 @@
27
27
  "react": "^17.0.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@skyscanner/bpk-foundations-web": "^8.5.0",
31
- "bpk-storybook-utils": "^2.0.1"
30
+ "@skyscanner/bpk-foundations-web": "^9.2.0",
31
+ "bpk-storybook-utils": "^2.0.3"
32
32
  }
33
33
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-description-list",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Backpack description list component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
- "bpk-mixins": "^31.4.0",
17
+ "bpk-mixins": "^31.6.1",
18
18
  "bpk-react-utils": "^7.0.0",
19
19
  "prop-types": "^15.7.2"
20
20
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-dialog",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "description": "Backpack dialog component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,19 +14,19 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-component-close-button": "^4.0.1",
18
- "bpk-component-flare": "^3.0.1",
19
- "bpk-mixins": "^31.4.0",
17
+ "bpk-component-close-button": "^4.0.3",
18
+ "bpk-component-flare": "^3.0.3",
19
+ "bpk-mixins": "^31.6.1",
20
20
  "bpk-react-utils": "^7.0.0",
21
- "bpk-scrim-utils": "^6.0.1",
21
+ "bpk-scrim-utils": "^6.0.3",
22
22
  "prop-types": "^15.7.2"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^17.0.2"
26
26
  },
27
27
  "devDependencies": {
28
- "bpk-component-button": "^7.0.1",
29
- "bpk-component-icon": "^10.0.1",
30
- "bpk-component-text": "^8.0.1"
28
+ "bpk-component-button": "^7.0.3",
29
+ "bpk-component-icon": "^10.0.3",
30
+ "bpk-component-text": "^8.0.3"
31
31
  }
32
32
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-drawer",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "description": "Backpack drawer component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,13 +14,13 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "@skyscanner/bpk-foundations-web": "^8.5.0",
18
- "bpk-component-close-button": "^4.0.1",
19
- "bpk-component-icon": "^10.0.1",
20
- "bpk-component-link": "^4.0.1",
21
- "bpk-mixins": "^31.4.0",
17
+ "@skyscanner/bpk-foundations-web": "^9.2.0",
18
+ "bpk-component-close-button": "^4.0.3",
19
+ "bpk-component-icon": "^10.0.3",
20
+ "bpk-component-link": "^4.0.3",
21
+ "bpk-mixins": "^31.6.1",
22
22
  "bpk-react-utils": "^7.0.0",
23
- "bpk-scrim-utils": "^6.0.1",
23
+ "bpk-scrim-utils": "^6.0.3",
24
24
  "prop-types": "^15.7.2",
25
25
  "react-transition-group": "^2.5.3"
26
26
  },
@@ -28,7 +28,7 @@
28
28
  "react": "^17.0.2"
29
29
  },
30
30
  "devDependencies": {
31
- "bpk-component-button": "^7.0.1",
32
- "bpk-component-text": "^8.0.1"
31
+ "bpk-component-button": "^7.0.3",
32
+ "bpk-component-text": "^8.0.3"
33
33
  }
34
34
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-fieldset",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Backpack fieldset component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,9 +14,9 @@
14
14
  },
15
15
  "gitHead": "4e4ec9add28e1db54d6a38a10c331bbd163f2926",
16
16
  "dependencies": {
17
- "bpk-component-form-validation": "^5.0.1",
18
- "bpk-component-label": "^6.0.1",
19
- "bpk-mixins": "^31.4.0",
17
+ "bpk-component-form-validation": "^5.0.3",
18
+ "bpk-component-label": "^6.0.3",
19
+ "bpk-mixins": "^31.6.1",
20
20
  "bpk-react-utils": "^7.0.0",
21
21
  "prop-types": "^15.7.2"
22
22
  },
@@ -24,13 +24,13 @@
24
24
  "react": "^17.0.2"
25
25
  },
26
26
  "devDependencies": {
27
- "bpk-component-autosuggest": "^7.0.1",
28
- "bpk-component-button": "^7.0.1",
29
- "bpk-component-calendar": "^12.0.1",
30
- "bpk-component-checkbox": "^5.0.1",
31
- "bpk-component-datepicker": "^18.0.1",
32
- "bpk-component-input": "^7.0.1",
33
- "bpk-component-select": "^6.0.1",
34
- "bpk-component-textarea": "^5.0.1"
27
+ "bpk-component-autosuggest": "^7.0.3",
28
+ "bpk-component-button": "^7.0.3",
29
+ "bpk-component-calendar": "^13.0.0",
30
+ "bpk-component-checkbox": "^5.0.3",
31
+ "bpk-component-datepicker": "^18.0.3",
32
+ "bpk-component-input": "^7.0.3",
33
+ "bpk-component-select": "^6.0.3",
34
+ "bpk-component-textarea": "^5.0.3"
35
35
  }
36
36
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-flare",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Backpack FlareBar and ContentBubble component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,9 +17,9 @@
17
17
  },
18
18
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
19
19
  "dependencies": {
20
- "bpk-component-label": "^6.0.1",
21
- "bpk-component-text": "^8.0.1",
22
- "bpk-mixins": "^31.4.0",
20
+ "bpk-component-label": "^6.0.3",
21
+ "bpk-component-text": "^8.0.3",
22
+ "bpk-mixins": "^31.6.1",
23
23
  "bpk-react-utils": "^7.0.0",
24
24
  "prop-types": "^15.7.2"
25
25
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-floating-notification",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Backpack floating-notification component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,10 +13,10 @@
13
13
  "registry": "https://registry.npmjs.org/"
14
14
  },
15
15
  "dependencies": {
16
- "bpk-component-aria-live": "^3.0.1",
17
- "bpk-component-button": "^7.0.1",
18
- "bpk-component-text": "^8.0.1",
19
- "bpk-mixins": "^31.4.0",
16
+ "bpk-component-aria-live": "^3.1.0",
17
+ "bpk-component-button": "^7.0.3",
18
+ "bpk-component-text": "^8.0.3",
19
+ "bpk-mixins": "^31.6.1",
20
20
  "bpk-react-utils": "^7.0.0",
21
21
  "prop-types": "^15.5.8"
22
22
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-form-validation",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Backpack form-validation component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-animate-height": "^5.0.1",
18
- "bpk-mixins": "^31.4.0",
17
+ "bpk-animate-height": "^5.0.3",
18
+ "bpk-mixins": "^31.6.1",
19
19
  "bpk-react-utils": "^7.0.0",
20
20
  "prop-types": "^15.7.2"
21
21
  },
@@ -23,12 +23,12 @@
23
23
  "react": "^17.0.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@skyscanner/bpk-foundations-web": "^8.5.0",
27
- "bpk-component-button": "^7.0.1",
28
- "bpk-component-checkbox": "^5.0.1",
29
- "bpk-component-icon": "^10.0.1",
30
- "bpk-component-input": "^7.0.1",
31
- "bpk-component-select": "^6.0.1",
32
- "bpk-component-textarea": "^5.0.1"
26
+ "@skyscanner/bpk-foundations-web": "^9.2.0",
27
+ "bpk-component-button": "^7.0.3",
28
+ "bpk-component-checkbox": "^5.0.3",
29
+ "bpk-component-icon": "^10.0.3",
30
+ "bpk-component-input": "^7.0.3",
31
+ "bpk-component-select": "^6.0.3",
32
+ "bpk-component-textarea": "^5.0.3"
33
33
  }
34
34
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-graphic-promotion",
3
- "version": "5.0.1",
3
+ "version": "5.1.1",
4
4
  "description": "Backpack graphic-promotion component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,10 +13,11 @@
13
13
  "registry": "https://registry.npmjs.org/"
14
14
  },
15
15
  "dependencies": {
16
- "bpk-component-button": "^7.0.1",
17
- "bpk-component-text": "^8.0.1",
18
- "bpk-mixins": "^31.4.0",
19
- "bpk-react-utils": "^7.0.0"
16
+ "bpk-component-button": "^7.0.3",
17
+ "bpk-component-text": "^8.0.3",
18
+ "bpk-mixins": "^31.6.1",
19
+ "bpk-react-utils": "^7.0.0",
20
+ "prop-types": "^15.5.8"
20
21
  },
21
22
  "peerDependencies": {
22
23
  "react": "^17.0.2"
@@ -42,6 +42,7 @@ const props: Props = {
42
42
  'Portugal and 6 more countries have just been added to the UK travel green list',
43
43
  tagline: 'Tagline',
44
44
  textAlign: TEXT_ALIGN.start,
45
+ contentId: 'mock-content-id',
45
46
  };
46
47
 
47
48
  describe('BpkGraphicPromo', () => {
@@ -123,9 +124,9 @@ describe('BpkGraphicPromo', () => {
123
124
  expect(props.onClick).toHaveBeenCalledTimes(1);
124
125
  });
125
126
 
126
- it('should render correctly with a content ID', () => {
127
+ it('should render as expected without a content ID', () => {
127
128
  const { asFragment } = render(
128
- <BpkGraphicPromo contentId="content-id" {...props} />,
129
+ <BpkGraphicPromo {...props} contentId={null} />,
129
130
  );
130
131
 
131
132
  expect(asFragment()).toMatchSnapshot();
@@ -18,11 +18,11 @@
18
18
 
19
19
  import React from 'react';
20
20
 
21
- // @ts-expect-error Untyped import. Not added as a stub declaration so consumers still have the suppression in their node_modules when shipped untranspiled.
21
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
22
22
  import { cssModules } from '../../bpk-react-utils';
23
- // @ts-expect-error Untyped import. Not added as a stub declaration so consumers still have the suppression in their node_modules when shipped untranspiled.
23
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
24
24
  import BpkText from '../../bpk-component-text';
25
- // @ts-expect-error Untyped import. Not added as a stub declaration so consumers still have the suppression in their node_modules when shipped untranspiled.
25
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
26
26
  import BpkButton from '../../bpk-component-button';
27
27
 
28
28
  import STYLES from './BpkGraphicPromo.module.scss';
@@ -45,45 +45,45 @@ export const TEXT_ALIGN = {
45
45
  } as const;
46
46
 
47
47
  export type Props = {
48
- buttonText: string;
49
48
  className?: string | null;
50
49
  contentId?: string | null;
50
+ tagline?: string | null;
51
51
  headline: string;
52
- invertVertically?: boolean;
53
- onClick: () => void;
52
+ subheading?: string | null;
54
53
  sponsor?: {
55
54
  label: string;
56
55
  logo: string;
57
56
  altText: string;
58
57
  } | null;
59
- style?: {};
60
- subheading?: string | null;
61
- tagline?: string | null;
58
+ buttonText: string;
59
+ onClick: () => void;
60
+ invertVertically?: boolean;
62
61
  textAlign: typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
62
+ style?: {};
63
63
  };
64
64
 
65
- const constructAriaLabel = (
66
- buttonText: Props['buttonText'],
67
- headline: Props['headline'],
68
- sponsor: Props['sponsor'],
69
- subheading: Props['subheading'],
70
- tagline: Props['tagline'],
71
- ) => {
65
+ const constructAriaLabel = ({
66
+ buttonText,
67
+ headline,
68
+ sponsor,
69
+ subheading,
70
+ tagline,
71
+ }: Pick<
72
+ Props,
73
+ 'buttonText' | 'headline' | 'sponsor' | 'subheading' | 'tagline'
74
+ >) => {
72
75
  const text: string[] = [];
73
- const addText = (value: string) => value && text.push(value);
76
+ const addText = (value?: string | null) => value && text.push(value);
74
77
 
75
78
  if (sponsor) {
76
79
  addText(sponsor.label);
77
80
  addText(sponsor.altText);
78
- } else if (tagline) {
81
+ } else {
79
82
  addText(tagline);
80
83
  }
81
84
 
82
85
  addText(headline);
83
-
84
- if (subheading) {
85
- addText(subheading);
86
- }
86
+ addText(subheading);
87
87
  addText(buttonText);
88
88
 
89
89
  return text.join('. ');
@@ -129,13 +129,13 @@ const BpkGraphicPromo = ({
129
129
  className={cardClasses}
130
130
  style={style}
131
131
  role="link"
132
- aria-label={constructAriaLabel(
132
+ aria-label={constructAriaLabel({
133
133
  buttonText,
134
134
  headline,
135
135
  sponsor,
136
136
  subheading,
137
137
  tagline,
138
- )}
138
+ })}
139
139
  tabIndex={0}
140
140
  onClick={onClickWrapper}
141
141
  onKeyDown={onKeyWrapper}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-grid",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Backpack grid components.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
- "bpk-mixins": "^31.4.0",
17
+ "bpk-mixins": "^31.6.1",
18
18
  "bpk-react-utils": "^7.0.0",
19
19
  "prop-types": "^15.7.2"
20
20
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-grid-toggle",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "Backpack vertical grid toggle component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
- "bpk-component-link": "^4.0.1",
18
- "bpk-mixins": "^31.4.0",
17
+ "bpk-component-link": "^4.0.3",
18
+ "bpk-mixins": "^31.6.1",
19
19
  "bpk-react-utils": "^7.0.0",
20
20
  "prop-types": "^15.7.2"
21
21
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-horizontal-nav",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "description": "Backpack horizontal nav component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-component-mobile-scroll-container": "^4.0.1",
18
- "bpk-mixins": "^31.4.0",
17
+ "bpk-component-mobile-scroll-container": "^4.0.3",
18
+ "bpk-mixins": "^31.6.1",
19
19
  "bpk-react-utils": "^7.0.0",
20
20
  "prop-types": "^15.7.2"
21
21
  },
@@ -23,8 +23,8 @@
23
23
  "react": "^17.0.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@skyscanner/bpk-foundations-web": "^8.5.0",
27
- "bpk-component-text": "^8.0.1",
28
- "bpk-storybook-utils": "^2.0.1"
26
+ "@skyscanner/bpk-foundations-web": "^9.2.0",
27
+ "bpk-component-text": "^8.0.3",
28
+ "bpk-storybook-utils": "^2.0.3"
29
29
  }
30
30
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-icon",
3
- "version": "10.0.1",
3
+ "version": "10.0.3",
4
4
  "description": "Backpack icon components.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,16 +17,16 @@
17
17
  },
18
18
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
19
19
  "dependencies": {
20
- "@skyscanner/bpk-foundations-web": "^8.5.0",
21
- "@skyscanner/bpk-svgs": "^14.3.6",
22
- "bpk-mixins": "^31.4.0",
20
+ "@skyscanner/bpk-foundations-web": "^9.2.0",
21
+ "@skyscanner/bpk-svgs": "^14.4.1",
22
+ "bpk-mixins": "^31.6.1",
23
23
  "bpk-react-utils": "^7.0.0",
24
24
  "prop-types": "^15.7.2"
25
25
  },
26
26
  "devDependencies": {
27
- "bpk-component-button": "^7.0.1",
28
- "bpk-component-list": "^5.0.1",
29
- "bpk-component-text": "^8.0.1"
27
+ "bpk-component-button": "^7.0.3",
28
+ "bpk-component-list": "^5.1.0",
29
+ "bpk-component-text": "^8.0.3"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "^17.0.2"