@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
@@ -0,0 +1,126 @@
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 React from 'react';
20
+ import { render, screen } from '@testing-library/react';
21
+
22
+ import BpkContentCards from './BpkContentCards';
23
+
24
+ describe('Content Card widget', () => {
25
+ const contentContainerTestProps: React.ComponentProps<
26
+ typeof BpkContentCards
27
+ > = {
28
+ heading: 'Header for the component',
29
+ cards: [
30
+ {
31
+ image: {
32
+ url: 'http://skyscanner.net/card-1-image-link.jpg',
33
+ alt: 'People surfing in the ocean',
34
+ },
35
+ headline: 'Card 1 headline',
36
+ description: 'Card 1 description',
37
+ href: 'http://skyscanner.net/card-1-cta-link.html',
38
+ },
39
+ {
40
+ image: {
41
+ url: 'http://skyscanner.net/card-2-image-link.jpg',
42
+ alt: 'Man on boat in a fjord',
43
+ },
44
+ headline: 'Card 2 headline',
45
+ description: 'Card 2 description',
46
+ href: 'http://skyscanner.net/card-2-cta-link.html',
47
+ },
48
+ {
49
+ image: {
50
+ url: 'http://skyscanner.net/card-3-image-link.jpg',
51
+ alt: 'Airplane flying over mountains',
52
+ },
53
+ headline: 'Card 3 headline',
54
+ description: 'Card 3 description',
55
+ href: 'http://skyscanner.net/card-3-cta-link.html',
56
+ },
57
+ ],
58
+ };
59
+
60
+ it('renders correctly with 1 card', async () => {
61
+ const { asFragment } = render(
62
+ <BpkContentCards
63
+ heading={contentContainerTestProps.heading}
64
+ cards={contentContainerTestProps.cards.slice(0, 1)}
65
+ />,
66
+ );
67
+
68
+ expect(asFragment()).toMatchSnapshot();
69
+ });
70
+
71
+ it('renders correctly with 2 cards', async () => {
72
+ const { asFragment } = render(
73
+ <BpkContentCards
74
+ heading={contentContainerTestProps.heading}
75
+ cards={contentContainerTestProps.cards.slice(0, 2)}
76
+ />,
77
+ );
78
+
79
+ expect(asFragment()).toMatchSnapshot();
80
+ });
81
+
82
+ it('renders correctly with 3 cards', async () => {
83
+ const { asFragment } = render(
84
+ <BpkContentCards
85
+ heading={contentContainerTestProps.heading}
86
+ cards={contentContainerTestProps.cards}
87
+ />,
88
+ );
89
+
90
+ expect(asFragment()).toMatchSnapshot();
91
+ });
92
+
93
+ it('renders the title, the headline and the description for each card', async () => {
94
+ render(
95
+ <BpkContentCards
96
+ heading={contentContainerTestProps.heading}
97
+ cards={contentContainerTestProps.cards}
98
+ />,
99
+ );
100
+
101
+ const expectedElements = [
102
+ 'Header for the component',
103
+ 'Card 1 headline',
104
+ 'Card 1 description',
105
+ 'Card 2 headline',
106
+ 'Card 2 description',
107
+ 'Card 3 headline',
108
+ 'Card 3 description',
109
+ ];
110
+
111
+ expectedElements.forEach((element) =>
112
+ expect(screen.getByText(element)).toBeTruthy(),
113
+ );
114
+ });
115
+
116
+ it('does not render anything if the cards are not defined', () => {
117
+ const { container } = render(
118
+ <BpkContentCards
119
+ heading={contentContainerTestProps.heading}
120
+ cards={[]}
121
+ />,
122
+ );
123
+
124
+ expect(container.firstChild).toBe(null);
125
+ });
126
+ });
@@ -0,0 +1,18 @@
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
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-content-cards{display:flex}
@@ -0,0 +1,51 @@
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
+ /* stylelint-disable selector-class-pattern */
20
+ /* stylelint-disable selector-max-compound-selectors */
21
+ @import '~bpk-mixins/index';
22
+
23
+ $bpk-spacing-v2: true;
24
+
25
+ .bpk-content-cards {
26
+ &--header-text {
27
+ margin-bottom: bpk-spacing-base();
28
+
29
+ @include bpk-heading-2;
30
+
31
+ @include bpk-breakpoint-mobile {
32
+ @include bpk-heading-3;
33
+ }
34
+ }
35
+
36
+ &--layout {
37
+ display: grid;
38
+ grid-template-columns: repeat(
39
+ auto-fit,
40
+ minmax($bpk-one-pixel-rem * 50, 1fr)
41
+ );
42
+ grid-auto-flow: column;
43
+ gap: bpk-spacing-base();
44
+
45
+ @include bpk-breakpoint-small-tablet {
46
+ grid-template-columns: 1fr;
47
+ grid-auto-flow: row;
48
+ gap: bpk-spacing-lg();
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,72 @@
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 React from 'react';
20
+
21
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
22
+ import BpkText from '../../bpk-component-text';
23
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
24
+ import { cssModules } from '../../bpk-react-utils';
25
+
26
+ import BpkContentCard from './BpkContentCard';
27
+ import STYLES from './BpkContentCards.module.scss';
28
+
29
+ const getClassName = cssModules(STYLES);
30
+
31
+ type Props = {
32
+ heading: string;
33
+ cards: Array<{
34
+ image: {
35
+ url: string;
36
+ alt?: string;
37
+ };
38
+ headline: string;
39
+ description: string;
40
+ href: string;
41
+ }>;
42
+ };
43
+
44
+ const BpkContentCards = ({ cards, heading }: Props) => {
45
+ if (cards.length === 0) {
46
+ return null;
47
+ }
48
+
49
+ return (
50
+ <div>
51
+ <BpkText
52
+ tagName="h2"
53
+ className={getClassName('bpk-content-cards--header-text')}
54
+ >
55
+ {heading}
56
+ </BpkText>
57
+ <div role="list" className={getClassName('bpk-content-cards--layout')}>
58
+ {cards.map((card) => (
59
+ <div role="listitem">
60
+ <BpkContentCard
61
+ key={card.image.url}
62
+ card={card}
63
+ layout={cards.length === 1 ? 'HORIZONTAL' : 'VERTICAL'}
64
+ />
65
+ </div>
66
+ ))}
67
+ </div>
68
+ </div>
69
+ );
70
+ };
71
+
72
+ export default BpkContentCards;
@@ -0,0 +1,64 @@
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 React from 'react';
20
+ import { render } from '@testing-library/react';
21
+ import { axe } from 'jest-axe';
22
+
23
+ import BpkContentCards from './BpkContentCards';
24
+
25
+ const heading = 'Header for the component';
26
+ const cards = [
27
+ {
28
+ image: {
29
+ url: 'http://skyscanner.net/card-1-image-link.jpg',
30
+ alt: '',
31
+ },
32
+ headline: 'Card 1 headline',
33
+ description: 'Card 1 description',
34
+ href: 'http://skyscanner.net/card-1-cta-link.html',
35
+ },
36
+ {
37
+ image: {
38
+ url: 'http://skyscanner.net/card-2-image-link.jpg',
39
+ alt: '',
40
+ },
41
+ headline: 'Card 2 headline',
42
+ description: 'Card 2 description',
43
+ href: 'http://skyscanner.net/card-2-cta-link.html',
44
+ },
45
+ {
46
+ image: {
47
+ url: 'http://skyscanner.net/card-3-image-link.jpg',
48
+ alt: '',
49
+ },
50
+ headline: 'Card 3 headline',
51
+ description: 'Card 3 description',
52
+ href: 'http://skyscanner.net/card-3-cta-link.html',
53
+ },
54
+ ];
55
+
56
+ describe('BpkContentCards accessibility tests', () => {
57
+ it('should not have programmatically-detectable accessibility issues', async () => {
58
+ const { container } = render(
59
+ <BpkContentCards heading={heading} cards={cards} />,
60
+ );
61
+ const results = await axe(container);
62
+ expect(results).toHaveNoViolations();
63
+ });
64
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-content-container",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "description": "Backpack content container 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
  },
@@ -38,12 +38,11 @@ export default () => (
38
38
  );
39
39
  ```
40
40
 
41
- By default `BpkDataTable` sorts the column using the value of `dataKey`. For use cases where the data might more complex and requires custom sorting you can pass a `sort` function along with `sortBy` and `sortDirection` and they will be handled as explained in react-virtualized's [docs] (https://github.com/bvaughn/react-virtualized/blob/main/docs/Table.md#prop-types)
41
+ By default `BpkDataTable` sorts the column using the value of `dataKey`. For use cases where the data might more complex and requires custom sorting you can pass a `sort` function along with `sortBy` and `sortDirection`.
42
42
 
43
43
  ```js
44
44
  import React from 'react';
45
45
  import { BpkDataTable, BpkDataTableColumn } from 'bpk-component-datatable';
46
- import _sortBy from 'lodash/sortBy';
47
46
 
48
47
  const complexRows = [
49
48
  {
@@ -65,21 +64,16 @@ const complexRows = [
65
64
 
66
65
  let sortByValue = 'seat';
67
66
  let sortDirectionValue = 'DESC';
68
- const sortFunction = ({ sortBy, sortDirection }) => {
69
- if (sortBy === 'seat') {
70
- complexRows = _sortBy(complexRows, [
71
- row => row.seat.office,
72
- row => row.seat.desk,
73
- ]);
67
+ const sortFunction = (rowA, rowB, id, desc) => {
68
+ const deskA = rowA.values.seat.desk;
69
+ const deskB = rowB.values.seat.desk;
70
+
71
+ if (deskA === deskB) {
72
+ return 0;
74
73
  } else {
75
- complexRows = _sortBy(complexRows, sortBy);
76
- }
77
- if (sortDirection === 'DESC') {
78
- complexRows.reverse();
74
+ return deskA > deskB ? 1 : -1;
79
75
  }
80
- sortByValue = sortBy;
81
- sortDirectionValue = sortDirection;
82
- };
76
+ }
83
77
 
84
78
  export default () => (
85
79
  <BpkDataTable
@@ -118,10 +112,6 @@ export default () => (
118
112
 
119
113
  ### BpkDataTable
120
114
 
121
- Supports all properties defined in [`Table`](https://github.com/bvaughn/react-virtualized/blob/main/docs/Table.md) (from `react-virtualized`),
122
- in addition to the following:
123
-
124
-
125
115
  | Property | PropType | Required | Default Value |
126
116
  | ---------------------- | --------------------------- | -------- | -------------------- |
127
117
  | rows | arrayOf(Object) | true | - |
@@ -130,12 +120,79 @@ in addition to the following:
130
120
  | width | number | false | full width of parent |
131
121
  | headerHeight | number | false | 60 |
132
122
  | rowHeight | number | false | 60 |
123
+ | rowStyle | object | false | {} |
124
+ | onRowClick | func | false | null |
125
+ | className | string | false | null |
133
126
  | defaultColumnSortIndex | number | false | 0 |
134
127
  | sort | func | false | null |
135
128
  | sortBy | string | false | null |
136
- | sortDirection | oneOf('ASC', 'DESC') | false | null |
129
+ | sortDirection | oneOf('ASC', 'DESC') | false | 'ASC' |
137
130
 
138
131
 
139
132
  ### BpkDataTableColumn
140
133
 
141
- Supports all properties defined in [`Column`](https://github.com/bvaughn/react-virtualized/blob/master/docs/Column.md) (from `react-virtualized`)
134
+ | Property | PropType | Required | Default Value |
135
+ | ---------------------- | --------------------------- | -------- | -------------------- |
136
+ | dataKey | string | true | - |
137
+ | width | number | true | - |
138
+ | flexGrow | number | false | 0 |
139
+ | label | string | false | null |
140
+ | headerRenderer | func | false | null |
141
+ | headerClassName | string | false | null |
142
+ | headerStyle | object | false | {} |
143
+ | cellRenderer | func | false | null |
144
+ | cellDataGetter | func | false | null |
145
+ | disableSort | bool | false | false |
146
+ | defaultSortDirection | oneOf('ASC', 'DESC') | false | 'ASC' |
147
+ | className | string | false | null |
148
+
149
+ ### Prop Details
150
+
151
+
152
+ #### sort, sortBy, sortDirection
153
+
154
+ For custom sorting, pass a `sort` function.
155
+ Use `sortBy` to specify which column the custom sorting will be applied to.
156
+ Use `sortDirection` to set the direction of sorting. By default, it will be ascending.
157
+
158
+ #### defaultColumnSortIndex
159
+
160
+ The data will be sorted by default based on this column.
161
+
162
+ #### headerRenderer
163
+
164
+ To handle more complex header data that needs any custom processing, pass a function or component to `headerRenderer` prop. This will only be formatting the header value - all styling will be handled by the component.
165
+ It should implement the following signature:
166
+
167
+ ```
168
+ function ({
169
+ dataKey: string, disableSort: boolean, label: string
170
+ }): element
171
+ ```
172
+
173
+ #### cellDataGetter
174
+
175
+ To handle more complex cell data that needs any custom processing, pass a function or component to `cellDataGetter` prop. This will only be formatting the cell value - all styling will be handled by the component.
176
+ It should implement the following signature:
177
+
178
+ ```
179
+ function ({
180
+ dataKey: string,
181
+ rowData: any
182
+ }): any
183
+ ```
184
+
185
+ #### cellRenderer
186
+
187
+ To handle more complex cell data that needs any custom processing, pass a function or component to `cellRenderer` prop. This will only be formatting the cell value - all styling will be handled by the component. To maintain backward compatibility, both `cellRenderer` and `cellDataGetter` will be supported, however, they are interchangeable as they both can only format the cell value.
188
+ It should implement the following signature:
189
+
190
+ ```
191
+ function ({
192
+ cellData: any,
193
+ columnIndex: number,
194
+ dataKey: string,
195
+ rowData: any,
196
+ rowIndex: any,
197
+ }): node
198
+ ```
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-datatable",
3
- "version": "5.0.1",
3
+ "version": "6.0.0",
4
4
  "description": "Backpack datatable component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,17 +14,16 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-component-icon": "^10.0.1",
18
- "bpk-mixins": "^31.4.0",
17
+ "bpk-component-icon": "^10.0.3",
18
+ "bpk-mixins": "^31.6.1",
19
19
  "bpk-react-utils": "^7.0.0",
20
- "lodash": "^4.17.20",
21
20
  "prop-types": "^15.7.2",
22
- "react-virtualized": "^9.22.3"
21
+ "react-table": "^7.8.0"
23
22
  },
24
23
  "peerDependencies": {
25
24
  "react": "^17.0.2"
26
25
  },
27
26
  "devDependencies": {
28
- "@skyscanner/bpk-foundations-web": "^8.5.0"
27
+ "@skyscanner/bpk-foundations-web": "^9.2.0"
29
28
  }
30
29
  }