@skyscanner/backpack-web 9.2.0 → 11.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 (116) 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 +0 -1
  5. package/bpk-component-aria-live/package.json +8 -9
  6. package/bpk-component-aria-live/src/BpkAriaLive.js +21 -20
  7. package/bpk-component-autosuggest/package.json +4 -4
  8. package/bpk-component-badge/package.json +5 -5
  9. package/bpk-component-banner-alert/package.json +9 -9
  10. package/bpk-component-barchart/package.json +8 -8
  11. package/bpk-component-blockquote/package.json +2 -2
  12. package/bpk-component-breadcrumb/package.json +5 -5
  13. package/bpk-component-breakpoint/package.json +3 -3
  14. package/bpk-component-button/package.json +3 -3
  15. package/bpk-component-calendar/DOCS.md +1 -7
  16. package/bpk-component-calendar/README.md +0 -10
  17. package/bpk-component-calendar/index.js +0 -2
  18. package/bpk-component-calendar/package.json +9 -9
  19. package/bpk-component-calendar/src/BpkCalendarDate.js +0 -15
  20. package/bpk-component-calendar/src/BpkCalendarDate.module.scss +17 -50
  21. package/bpk-component-calendar/src/BpkCalendarGrid.module.scss +5 -5
  22. package/bpk-component-calendar/src/_variables.scss +1 -3
  23. package/bpk-component-card/package.json +4 -4
  24. package/bpk-component-checkbox/package.json +5 -5
  25. package/bpk-component-chip/package.json +5 -5
  26. package/bpk-component-close-button/package.json +4 -4
  27. package/bpk-component-code/package.json +2 -2
  28. package/bpk-component-content-cards/README.md +43 -0
  29. package/bpk-component-content-cards/index.js +21 -0
  30. package/bpk-component-content-cards/package.json +23 -0
  31. package/bpk-component-content-cards/src/BpkContentCard.js +83 -0
  32. package/bpk-component-content-cards/src/BpkContentCard.module.scss +87 -0
  33. package/bpk-component-content-cards/src/BpkContentCards.js +72 -0
  34. package/bpk-component-content-cards/src/BpkContentCards.module.css +18 -0
  35. package/bpk-component-content-cards/src/BpkContentCards.module.scss +51 -0
  36. package/bpk-component-content-container/package.json +2 -2
  37. package/bpk-component-datatable/README.md +78 -21
  38. package/bpk-component-datatable/package.json +5 -6
  39. package/bpk-component-datatable/src/BpkDataTable.js +176 -143
  40. package/bpk-component-datatable/src/BpkDataTable.module.scss +10 -14
  41. package/bpk-component-datatable/src/BpkDataTableColumn.js +37 -40
  42. package/bpk-component-datatable/src/BpkDataTableHeader.js +143 -0
  43. package/bpk-component-datatable/src/{BpkDataTableColumn.module.scss → BpkDataTableHeader.module.scss} +12 -11
  44. package/bpk-component-datatable/src/common-types.js +33 -11
  45. package/bpk-component-datatable/src/sort-types.js +6 -0
  46. package/bpk-component-datatable/src/utils.js +66 -9
  47. package/bpk-component-datepicker/package.json +9 -9
  48. package/bpk-component-description-list/package.json +2 -2
  49. package/bpk-component-dialog/package.json +8 -8
  50. package/bpk-component-drawer/package.json +9 -9
  51. package/bpk-component-fieldset/package.json +12 -12
  52. package/bpk-component-flare/package.json +4 -4
  53. package/bpk-component-floating-notification/README.md +0 -8
  54. package/bpk-component-floating-notification/index.js +0 -2
  55. package/bpk-component-floating-notification/package.json +5 -5
  56. package/bpk-component-floating-notification/src/BpkFloatingNotification.js +7 -26
  57. package/bpk-component-floating-notification/src/BpkFloatingNotification.module.scss +4 -17
  58. package/bpk-component-form-validation/package.json +10 -10
  59. package/bpk-component-graphic-promotion/{index.ts → index.js} +0 -0
  60. package/bpk-component-graphic-promotion/package.json +7 -6
  61. package/bpk-component-graphic-promotion/src/{BpkGraphicPromo.tsx → BpkGraphicPromo.js} +26 -16
  62. package/bpk-component-grid/package.json +2 -2
  63. package/bpk-component-grid-toggle/package.json +3 -3
  64. package/bpk-component-horizontal-nav/package.json +6 -6
  65. package/bpk-component-horizontal-nav/src/BpkHorizontalNav.module.scss +2 -2
  66. package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.module.scss +13 -13
  67. package/bpk-component-icon/package.json +7 -7
  68. package/bpk-component-image/package.json +6 -6
  69. package/bpk-component-infinite-scroll/package.json +6 -6
  70. package/bpk-component-input/package.json +6 -6
  71. package/bpk-component-label/package.json +2 -2
  72. package/bpk-component-link/package.json +4 -4
  73. package/bpk-component-list/README.md +8 -5
  74. package/bpk-component-list/package.json +2 -2
  75. package/bpk-component-list/src/BpkList.js +18 -2
  76. package/bpk-component-loading-button/package.json +6 -6
  77. package/bpk-component-map/package.json +6 -6
  78. package/bpk-component-mobile-scroll-container/package.json +3 -3
  79. package/bpk-component-modal/package.json +9 -9
  80. package/bpk-component-navigation-bar/package.json +8 -8
  81. package/bpk-component-navigation-bar/src/BpkNavigationBar.module.scss +2 -3
  82. package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.module.scss +4 -4
  83. package/bpk-component-navigation-bar/src/BpkNavigationBarIconButton.module.scss +3 -3
  84. package/bpk-component-nudger/package.json +7 -7
  85. package/bpk-component-overlay/package.json +4 -4
  86. package/bpk-component-pagination/package.json +4 -4
  87. package/bpk-component-panel/package.json +2 -2
  88. package/bpk-component-phone-input/package.json +9 -9
  89. package/bpk-component-popover/package.json +8 -8
  90. package/bpk-component-price/package.json +3 -3
  91. package/bpk-component-progress/package.json +5 -5
  92. package/bpk-component-radio/package.json +4 -4
  93. package/bpk-component-rating/package.json +4 -4
  94. package/bpk-component-rtl-toggle/package.json +2 -2
  95. package/bpk-component-scrollable-calendar/package.json +6 -6
  96. package/bpk-component-section-list/package.json +6 -6
  97. package/bpk-component-select/package.json +3 -3
  98. package/bpk-component-skip-link/package.json +2 -2
  99. package/bpk-component-slider/package.json +4 -4
  100. package/bpk-component-spinner/package.json +3 -3
  101. package/bpk-component-split-input/package.json +3 -3
  102. package/bpk-component-star-rating/package.json +5 -5
  103. package/bpk-component-switch/package.json +2 -2
  104. package/bpk-component-table/package.json +2 -2
  105. package/bpk-component-text/package.json +2 -2
  106. package/bpk-component-textarea/package.json +4 -4
  107. package/bpk-component-theme-toggle/package.json +5 -5
  108. package/bpk-component-ticket/package.json +4 -4
  109. package/bpk-component-tooltip/package.json +4 -4
  110. package/bpk-scrim-utils/package.json +2 -2
  111. package/bpk-theming/package.json +2 -2
  112. package/package.json +4 -4
  113. package/bpk-component-datatable/src/bpkHeaderRenderer.js +0 -110
  114. package/bpk-component-datatable/src/sorter.js +0 -166
  115. package/bpk-component-graphic-promotion/src/BpkGraphicPromo-test.tsx +0 -134
  116. package/bpk-component-graphic-promotion/src/accessibility-test.tsx +0 -147
@@ -0,0 +1,143 @@
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 React from 'react';
21
+
22
+ import { cssModules } from '../../bpk-react-utils';
23
+ import BpkSmallArrowDownIcon from '../../bpk-component-icon/sm/arrow-down';
24
+ import BpkSmallArrowUpIcon from '../../bpk-component-icon/sm/arrow-up';
25
+ import { withRtlSupport } from '../../bpk-component-icon';
26
+
27
+ import { SORT_DIRECTION_TYPES } from './sort-types';
28
+ import STYLES from './BpkDataTableHeader.module.scss';
29
+ import { type ColumnType } from './common-types';
30
+
31
+ const DownIcon = withRtlSupport(BpkSmallArrowDownIcon);
32
+ const UpIcon = withRtlSupport(BpkSmallArrowUpIcon);
33
+
34
+ const getClassName = cssModules(STYLES);
35
+
36
+ const KEYCODES = {
37
+ ENTER: 13,
38
+ SPACEBAR: 32,
39
+ };
40
+
41
+ const BpkDataTableHeader = ({ column }: { column: ColumnType }) => {
42
+ const {
43
+ defaultSortDirection,
44
+ disableSortBy,
45
+ flexGrow,
46
+ headerClassName,
47
+ headerStyle,
48
+ isSorted,
49
+ isSortedDesc,
50
+ label,
51
+ minWidth,
52
+ sortDirection,
53
+ width,
54
+ } = column;
55
+
56
+ const onHeaderClick = () => {
57
+ if (disableSortBy === true) {
58
+ return;
59
+ }
60
+ let isDescending;
61
+
62
+ if (isSorted) {
63
+ isDescending = isSortedDesc === false;
64
+ } else if (sortDirection) {
65
+ isDescending = sortDirection === SORT_DIRECTION_TYPES.DESC;
66
+ } else if (defaultSortDirection) {
67
+ isDescending = defaultSortDirection === SORT_DIRECTION_TYPES.DESC;
68
+ } else {
69
+ isDescending = false;
70
+ }
71
+
72
+ column.toggleSortBy(isDescending);
73
+ };
74
+
75
+ const handleKeyboardEvent = (event: React.KeyboardEvent<HTMLElement>) => {
76
+ if (
77
+ event.keyCode === KEYCODES.ENTER ||
78
+ event.keyCode === KEYCODES.SPACEBAR
79
+ ) {
80
+ event.preventDefault();
81
+ onHeaderClick();
82
+ }
83
+ };
84
+
85
+ const headerClassNames = getClassName(
86
+ 'bpk-data-table-column__header',
87
+ headerClassName,
88
+ );
89
+ const upIconClassNames = getClassName(
90
+ 'bpk-data-table-column__sort-icon--up',
91
+ 'bpk-data-table-column__sort-icon',
92
+ isSorted && !isSortedDesc && 'bpk-data-table-column__sort-icon--selected',
93
+ );
94
+
95
+ const downIconClassNames = getClassName(
96
+ 'bpk-data-table-column__sort-icon--down',
97
+ 'bpk-data-table-column__sort-icon',
98
+ isSorted && isSortedDesc && 'bpk-data-table-column__sort-icon--selected',
99
+ );
100
+
101
+ return (
102
+ <div
103
+ {...column.getHeaderProps({
104
+ style: {
105
+ width,
106
+ minWidth,
107
+ flexGrow,
108
+ ...headerStyle,
109
+ },
110
+ className: headerClassNames,
111
+ })}
112
+ >
113
+ <span
114
+ onClick={onHeaderClick}
115
+ onKeyDown={handleKeyboardEvent}
116
+ aria-label={label}
117
+ aria-pressed={isSorted}
118
+ role="button"
119
+ tabIndex={0}
120
+ >
121
+ {column.render('Header')}
122
+ </span>
123
+ {!disableSortBy && (
124
+ <div
125
+ className={getClassName('bpk-data-table-column__sort-icons')}
126
+ key="sort"
127
+ aria-hidden
128
+ >
129
+ <UpIcon
130
+ onClick={() => column.toggleSortBy(false)}
131
+ className={upIconClassNames}
132
+ />
133
+ <DownIcon
134
+ onClick={() => column.toggleSortBy(true)}
135
+ className={downIconClassNames}
136
+ />
137
+ </div>
138
+ )}
139
+ </div>
140
+ );
141
+ };
142
+
143
+ export default BpkDataTableHeader;
@@ -16,24 +16,25 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- @import '~bpk-mixins/index';
19
+ @import '~bpk-mixins';
20
20
 
21
21
  $bpk-spacing-v2: true;
22
22
 
23
23
  $bpk-margin-size-sort-icons: bpk-spacing-sm() + bpk-spacing-md();
24
24
 
25
- .bpk-data-table-column {
25
+ .bpk-data-table-column__header {
26
+ display: flex;
27
+ height: 100%;
26
28
  margin: bpk-spacing-base();
27
- text-overflow: ellipsis;
28
- white-space: nowrap;
29
- overflow: hidden;
30
- }
29
+ flex-direction: row;
30
+ align-items: center;
31
+ outline-offset: -(bpk-spacing-sm());
31
32
 
32
- .bpk-data-table-column__header {
33
- display: inline-block;
34
- max-width: 100%;
35
- text-overflow: ellipsis;
36
- overflow: hidden;
33
+ @include bpk-label-2;
34
+
35
+ &:hover {
36
+ cursor: pointer;
37
+ }
37
38
  }
38
39
 
39
40
  .bpk-data-table-column__sort-icons {
@@ -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.2",
3
+ "version": "18.0.4",
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.2",
18
- "bpk-component-calendar": "^12.0.2",
19
- "bpk-component-input": "^7.0.2",
20
- "bpk-component-modal": "^6.0.2",
21
- "bpk-component-popover": "^8.0.2",
22
- "bpk-mixins": "^31.5.0",
17
+ "bpk-component-breakpoint": "^5.0.4",
18
+ "bpk-component-calendar": "^13.0.1",
19
+ "bpk-component-input": "^7.0.4",
20
+ "bpk-component-modal": "^6.0.4",
21
+ "bpk-component-popover": "^8.0.4",
22
+ "bpk-mixins": "^31.6.3",
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": "^9.0.0",
31
- "bpk-storybook-utils": "^2.0.2"
30
+ "@skyscanner/bpk-foundations-web": "^9.3.0",
31
+ "bpk-storybook-utils": "^2.0.4"
32
32
  }
33
33
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-description-list",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
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.5.0",
17
+ "bpk-mixins": "^31.6.3",
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.2",
3
+ "version": "7.0.4",
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.2",
18
- "bpk-component-flare": "^3.0.2",
19
- "bpk-mixins": "^31.5.0",
17
+ "bpk-component-close-button": "^4.0.4",
18
+ "bpk-component-flare": "^3.0.4",
19
+ "bpk-mixins": "^31.6.3",
20
20
  "bpk-react-utils": "^7.0.0",
21
- "bpk-scrim-utils": "^6.0.2",
21
+ "bpk-scrim-utils": "^6.0.4",
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.2",
29
- "bpk-component-icon": "^10.0.2",
30
- "bpk-component-text": "^8.0.2"
28
+ "bpk-component-button": "^7.0.4",
29
+ "bpk-component-icon": "^10.0.4",
30
+ "bpk-component-text": "^8.0.4"
31
31
  }
32
32
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-drawer",
3
- "version": "7.0.2",
3
+ "version": "7.0.4",
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": "^9.0.0",
18
- "bpk-component-close-button": "^4.0.2",
19
- "bpk-component-icon": "^10.0.2",
20
- "bpk-component-link": "^4.0.2",
21
- "bpk-mixins": "^31.5.0",
17
+ "@skyscanner/bpk-foundations-web": "^9.3.0",
18
+ "bpk-component-close-button": "^4.0.4",
19
+ "bpk-component-icon": "^10.0.4",
20
+ "bpk-component-link": "^4.0.4",
21
+ "bpk-mixins": "^31.6.3",
22
22
  "bpk-react-utils": "^7.0.0",
23
- "bpk-scrim-utils": "^6.0.2",
23
+ "bpk-scrim-utils": "^6.0.4",
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.2",
32
- "bpk-component-text": "^8.0.2"
31
+ "bpk-component-button": "^7.0.4",
32
+ "bpk-component-text": "^8.0.4"
33
33
  }
34
34
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-fieldset",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
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.2",
18
- "bpk-component-label": "^6.0.2",
19
- "bpk-mixins": "^31.5.0",
17
+ "bpk-component-form-validation": "^5.0.4",
18
+ "bpk-component-label": "^6.0.4",
19
+ "bpk-mixins": "^31.6.3",
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.2",
28
- "bpk-component-button": "^7.0.2",
29
- "bpk-component-calendar": "^12.0.2",
30
- "bpk-component-checkbox": "^5.0.2",
31
- "bpk-component-datepicker": "^18.0.2",
32
- "bpk-component-input": "^7.0.2",
33
- "bpk-component-select": "^6.0.2",
34
- "bpk-component-textarea": "^5.0.2"
27
+ "bpk-component-autosuggest": "^7.0.4",
28
+ "bpk-component-button": "^7.0.4",
29
+ "bpk-component-calendar": "^13.0.1",
30
+ "bpk-component-checkbox": "^5.0.4",
31
+ "bpk-component-datepicker": "^18.0.4",
32
+ "bpk-component-input": "^7.0.4",
33
+ "bpk-component-select": "^6.0.4",
34
+ "bpk-component-textarea": "^5.0.4"
35
35
  }
36
36
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-flare",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
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.2",
21
- "bpk-component-text": "^8.0.2",
22
- "bpk-mixins": "^31.5.0",
20
+ "bpk-component-label": "^6.0.4",
21
+ "bpk-component-text": "^8.0.4",
22
+ "bpk-mixins": "^31.6.3",
23
23
  "bpk-react-utils": "^7.0.0",
24
24
  "prop-types": "^15.7.2"
25
25
  },
@@ -16,7 +16,6 @@ import BpkIconHeart from '../../packages/bpk-component-icon/sm/heart';
16
16
  export default () => (
17
17
  <BpkFloatingNotification
18
18
  ctaText="View"
19
- type={TYPE.dark}
20
19
  icon={BpkIconHeart}
21
20
  onClick={() => {}}
22
21
  text="Killer Combo saved to New York and Miami 🎉"
@@ -37,7 +36,6 @@ export default () => (
37
36
  | onClick | func | false | null |
38
37
  | onExit | func | false | null |
39
38
  | text | string | true | - |
40
- | type | oneOf(TYPE) | false | TYPE.light |
41
39
 
42
40
  ### Prop Details
43
41
 
@@ -50,9 +48,3 @@ The default value is 4 seconds (4000 milliseconds).
50
48
  #### onExit
51
49
 
52
50
  Execute a function after the component has finished the exit animation.
53
-
54
- #### type
55
-
56
- 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.
57
-
58
- The dark theme (`TYPE.dark`) displays the notification with a white background and black text. This contrasts against a dark page.
@@ -19,9 +19,7 @@
19
19
 
20
20
  import BpkFloatingNotification, {
21
21
  type Props as BpkFloatingNotificationProps,
22
- TYPE,
23
22
  } from './src/BpkFloatingNotification';
24
23
 
25
24
  export type { BpkFloatingNotificationProps };
26
- export { TYPE };
27
25
  export default BpkFloatingNotification;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-floating-notification",
3
- "version": "2.0.2",
3
+ "version": "3.0.0",
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.2",
17
- "bpk-component-button": "^7.0.2",
18
- "bpk-component-text": "^8.0.2",
19
- "bpk-mixins": "^31.5.0",
16
+ "bpk-component-aria-live": "^3.1.1",
17
+ "bpk-component-button": "^7.0.4",
18
+ "bpk-component-text": "^8.0.4",
19
+ "bpk-mixins": "^31.6.3",
20
20
  "bpk-react-utils": "^7.0.0",
21
21
  "prop-types": "^15.5.8"
22
22
  },
@@ -30,11 +30,6 @@ import STYLES from './BpkFloatingNotification.module.scss';
30
30
 
31
31
  const getClassName = cssModules(STYLES);
32
32
 
33
- export const TYPE = {
34
- light: 'light',
35
- dark: 'dark',
36
- };
37
-
38
33
  type Props = {
39
34
  animateOnEnter: ?boolean,
40
35
  animateOnExit: ?boolean,
@@ -45,7 +40,6 @@ type Props = {
45
40
  onClick: ?() => void,
46
41
  onExit: ?() => void,
47
42
  text: string,
48
- type: ?TYPE,
49
43
  };
50
44
 
51
45
  const BpkFloatingNotification = (props: Props) => {
@@ -61,25 +55,10 @@ const BpkFloatingNotification = (props: Props) => {
61
55
  onClick,
62
56
  onExit,
63
57
  text,
64
- type,
65
58
  ...rest
66
59
  } = props;
67
60
 
68
- const classNames = getClassName(
69
- 'bpk-floating-notification',
70
- type === TYPE.dark && 'bpk-floating-notification--dark',
71
- className,
72
- );
73
-
74
- const iconClassNames = getClassName(
75
- 'bpk-floating-notification__icon',
76
- type === TYPE.dark && 'bpk-floating-notification__icon--dark',
77
- );
78
-
79
- const buttonClassNames = getClassName(
80
- 'bpk-floating-notification__button',
81
- type === TYPE.dark && 'bpk-floating-notification__button--dark',
82
- );
61
+ const classNames = getClassName('bpk-floating-notification', className);
83
62
 
84
63
  useEffect(() => {
85
64
  let timer;
@@ -107,7 +86,7 @@ const BpkFloatingNotification = (props: Props) => {
107
86
  >
108
87
  <div className={classNames} {...rest}>
109
88
  {Icon && (
110
- <div className={iconClassNames}>
89
+ <div className={getClassName('bpk-floating-notification__icon')}>
111
90
  <Icon aria-hidden />
112
91
  </div>
113
92
  )}
@@ -120,7 +99,11 @@ const BpkFloatingNotification = (props: Props) => {
120
99
  </BpkText>
121
100
  <BpkAriaLive aria-hidden>{text}</BpkAriaLive>
122
101
  {ctaText && (
123
- <BpkButton link onClick={onClick} className={buttonClassNames}>
102
+ <BpkButton
103
+ link
104
+ onClick={onClick}
105
+ className={getClassName('bpk-floating-notification__button')}
106
+ >
124
107
  {ctaText}
125
108
  </BpkButton>
126
109
  )}
@@ -139,7 +122,6 @@ BpkFloatingNotification.propTypes = {
139
122
  onClick: PropTypes.func,
140
123
  onExit: PropTypes.func,
141
124
  text: PropTypes.string.isRequired,
142
- type: PropTypes.oneOf(Object.values(TYPE)),
143
125
  };
144
126
 
145
127
  BpkFloatingNotification.defaultProps = {
@@ -151,7 +133,6 @@ BpkFloatingNotification.defaultProps = {
151
133
  icon: null,
152
134
  onClick: null,
153
135
  onExit: null,
154
- type: TYPE.light,
155
136
  };
156
137
 
157
138
  export default BpkFloatingNotification;