@guardian/interactive-component-library 0.1.0-alpha.36 → 0.1.0-alpha.38

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.
@@ -1204,6 +1204,11 @@ const sortAscending = (accessor) => {
1204
1204
  return (a, b) => {
1205
1205
  const valueA = a[accessor];
1206
1206
  const valueB = b[accessor];
1207
+ if (valueA === null) {
1208
+ return -1;
1209
+ } else if (valueB === null) {
1210
+ return 1;
1211
+ }
1207
1212
  if (valueA < valueB)
1208
1213
  return -1;
1209
1214
  if (valueA > valueB)
@@ -1215,6 +1220,11 @@ const sortDescending = (accessor) => {
1215
1220
  return (a, b) => {
1216
1221
  const valueA = a[accessor];
1217
1222
  const valueB = b[accessor];
1223
+ if (valueA === null) {
1224
+ return 1;
1225
+ } else if (valueB === null) {
1226
+ return -1;
1227
+ }
1218
1228
  if (valueA > valueB)
1219
1229
  return -1;
1220
1230
  if (valueA < valueB)
@@ -1317,21 +1327,23 @@ class CellModel {
1317
1327
  const rowData = JSON.stringify(this.row, null, 2);
1318
1328
  throw new Error(`Missing value for key ${this.column.accessor} in ${rowData}`);
1319
1329
  }
1320
- return this.row[this.column.accessor].toString();
1330
+ return this.row[this.column.accessor] !== null ? this.row[this.column.accessor].toString() : "null";
1321
1331
  }
1322
1332
  }
1323
- const table = "_table_1dg64_9";
1324
- const hideHeader = "_hideHeader_1dg64_19";
1325
- const hideHeaderNoBorder = "_hideHeaderNoBorder_1dg64_28";
1326
- const headerCell = "_headerCell_1dg64_32";
1327
- const headerCellButton = "_headerCellButton_1dg64_40";
1328
- const bodyRow = "_bodyRow_1dg64_49";
1329
- const bodyCell = "_bodyCell_1dg64_54";
1333
+ const table = "_table_fhbur_9";
1334
+ const hideHeader = "_hideHeader_fhbur_20";
1335
+ const hideHeaderNoBorder = "_hideHeaderNoBorder_fhbur_29";
1336
+ const headerCell = "_headerCell_fhbur_33";
1337
+ const stickyHeader = "_stickyHeader_fhbur_42";
1338
+ const headerCellButton = "_headerCellButton_fhbur_49";
1339
+ const bodyRow = "_bodyRow_fhbur_58";
1340
+ const bodyCell = "_bodyCell_fhbur_62";
1330
1341
  const defaultStyles$f = {
1331
1342
  table,
1332
1343
  hideHeader,
1333
1344
  hideHeaderNoBorder,
1334
1345
  headerCell,
1346
+ stickyHeader,
1335
1347
  headerCellButton,
1336
1348
  bodyRow,
1337
1349
  bodyCell
@@ -1340,6 +1352,7 @@ function Table({
1340
1352
  columns,
1341
1353
  data,
1342
1354
  hideHeader: hideHeader2 = false,
1355
+ stickyHeader: stickyHeader2 = false,
1343
1356
  styles: styles2
1344
1357
  }) {
1345
1358
  const [sortState, setSortState] = useState(() => {
@@ -1378,9 +1391,13 @@ function Table({
1378
1391
  children: jsx("tr", {
1379
1392
  children: table2.columns.map((column, index) => {
1380
1393
  var _a;
1394
+ let columnStyle = mergeStyles(styles2.headerCell, (_a = column.styles) == null ? void 0 : _a.headerCell);
1395
+ if (stickyHeader2) {
1396
+ columnStyle = mergeStyles(columnStyle, styles2.stickyHeader);
1397
+ }
1381
1398
  return jsx("th", {
1382
1399
  scope: "col",
1383
- className: mergeStyles(styles2.headerCell, (_a = column.styles) == null ? void 0 : _a.headerCell),
1400
+ className: columnStyle,
1384
1401
  children: jsx(HeaderCell, {
1385
1402
  styles: mergeStyles(styles2, column.styles),
1386
1403
  onClick: () => sortByColumn(index),
@@ -1860,11 +1877,11 @@ const ToplineResult = forwardRef(({
1860
1877
  })]
1861
1878
  });
1862
1879
  });
1863
- const borderTop = "_borderTop_1yz7f_9";
1864
- const section = "_section_1yz7f_14";
1865
- const fullWidth = "_fullWidth_1yz7f_57";
1866
- const header = "_header_1yz7f_96";
1867
- const content = "_content_1yz7f_133";
1880
+ const borderTop = "_borderTop_gph7y_9";
1881
+ const section = "_section_gph7y_13";
1882
+ const fullWidth = "_fullWidth_gph7y_19";
1883
+ const header = "_header_gph7y_95";
1884
+ const content = "_content_gph7y_132";
1868
1885
  const defaultStyles$9 = {
1869
1886
  borderTop,
1870
1887
  section,