@equinor/apollo-components 1.9.0 → 1.10.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/dist/index.d.ts CHANGED
@@ -69,9 +69,18 @@ interface CellConfig<T> {
69
69
  getShouldHighlight?: (cell: Cell<T, unknown>) => boolean;
70
70
  }
71
71
  declare type RowSelectionMode = 'single' | 'multiple';
72
+ declare type TableLayout = 'auto' | 'fixed';
72
73
  declare type DataTableConfig<T> = {
73
74
  height?: string;
74
- tableLayout?: 'auto' | 'fixed';
75
+ /**
76
+ * Defaults to `'auto'`.
77
+ *
78
+ * `'auto'` determines column width based on cell content.
79
+ *
80
+ * `'fixed'` uses fixed column width. Specify width (`size` property) in ColumnDef.
81
+ * Default size is 150px.
82
+ */
83
+ tableLayout?: TableLayout;
75
84
  sortable?: boolean;
76
85
  virtual?: boolean;
77
86
  rowSelectionMode?: RowSelectionMode;
@@ -143,7 +152,7 @@ declare type DataTableCompoundProps = typeof DataTable$1 & {
143
152
  };
144
153
  declare const DataTable: DataTableCompoundProps;
145
154
 
146
- declare function SelectColumnDef<T>(selectionMode?: RowSelectionMode): ColumnDef$1<T, any>;
155
+ declare function SelectColumnDef<T>(props?: DataTableConfig<T>): ColumnDef$1<T, any>;
147
156
 
148
157
  declare const StickyCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, {} & CellProps, never>;
149
158
 
@@ -158,4 +167,4 @@ declare type TypographyProps = {
158
167
  */
159
168
  declare const TypographyCustom: (props: TypographyProps) => JSX.Element;
160
169
 
161
- export { AppShell, AppSidebar, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableCommonProps, DataTableConfig, DataTableProps, DataTableRawProps, DynamicCell, FilterConfig, HeaderConfig, HierarchyCell, RowConfig, RowSelectionMode, SelectColumnDef, StickyCell, TableHeader, TableRowWrapper, TableRowWrapperProps, TypographyCustom, capitalizeHeader, globalFilterAtom, prependSelectColumn, rowSelectionAtom, tableSortingAtom };
170
+ export { AppShell, AppSidebar, CellConfig, ChipsCell, ColumnSelect, DataTable, DataTableCommonProps, DataTableConfig, DataTableProps, DataTableRawProps, DynamicCell, FilterConfig, HeaderConfig, HierarchyCell, RowConfig, RowSelectionMode, SelectColumnDef, StickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TypographyCustom, capitalizeHeader, globalFilterAtom, prependSelectColumn, rowSelectionAtom, tableSortingAtom };
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ var Wrapper = import_styled_components.default.div`
61
61
  }
62
62
  .--content-outlet {
63
63
  flex: 1;
64
+ max-width: 100%;
64
65
  }
65
66
  `;
66
67
  var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrapper, {
@@ -172,7 +173,10 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
172
173
  var ChipsWrapper = import_styled_components3.default.div`
173
174
  display: flex;
174
175
  align-items: center;
176
+ flex-wrap: wrap;
175
177
  gap: 0.25rem;
178
+ padding-top: 0.25rem;
179
+ padding-bottom: 0.25rem;
176
180
  `;
177
181
  var Chip = import_styled_components3.default.div`
178
182
  border-radius: 25px;
@@ -226,10 +230,10 @@ var StickyHeaderCell = (0, import_styled_components4.default)(StickyCell)`
226
230
  // src/cells/DynamicCell.tsx
227
231
  var import_jsx_runtime4 = require("react/jsx-runtime");
228
232
  var StyledStickyCell = (0, import_styled_components5.default)(StickyCell)`
229
- ${(props) => props.backgroundColor ? `background-color: ${props.backgroundColor} !important;` : ``}
233
+ background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
230
234
  `;
231
235
  var StyledCell = (0, import_styled_components5.default)(import_eds_core_react4.Table.Cell)`
232
- ${(props) => props.backgroundColor ? `background-color: ${props.backgroundColor} !important;` : ``}
236
+ ${({ backgroundColor: bg }) => bg ? `background-color: ${bg} !important;` : ``};
233
237
  `;
234
238
  function DynamicCell({ cell, highlight, getStickyCellColor }) {
235
239
  var _a;
@@ -358,9 +362,12 @@ var CellWrapper2 = import_styled_components8.default.div`
358
362
  margin-left: -16px;
359
363
  z-index: 2;
360
364
  `;
361
- function SelectColumnDef(selectionMode) {
365
+ function SelectColumnDef(props = {}) {
366
+ const selectionMode = props.rowSelectionMode;
367
+ const showBothSelectAndSubRowsToggle = props.hideExpandControls === false;
362
368
  return {
363
369
  id: "select",
370
+ size: showBothSelectAndSubRowsToggle ? 96 : 48,
364
371
  header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CellWrapper2, {
365
372
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react6.Checkbox, {
366
373
  checked: table.getIsAllRowsSelected(),
@@ -405,10 +412,10 @@ function SelectColumnDef(selectionMode) {
405
412
 
406
413
  // src/DataTable/DataTableRaw.tsx
407
414
  var import_react4 = require("react");
408
- var import_styled_components14 = __toESM(require("styled-components"));
415
+ var import_styled_components16 = __toESM(require("styled-components"));
409
416
 
410
417
  // src/DataTable/components/BasicTable.tsx
411
- var import_eds_core_react11 = require("@equinor/eds-core-react");
418
+ var import_eds_core_react12 = require("@equinor/eds-core-react");
412
419
 
413
420
  // src/DataTable/components/PlaceholderRow.tsx
414
421
  var import_eds_core_react7 = require("@equinor/eds-core-react");
@@ -433,16 +440,25 @@ function PlaceholderRow({ isLoading }) {
433
440
  });
434
441
  }
435
442
 
443
+ // src/DataTable/components/TableBody.tsx
444
+ var import_eds_core_react8 = require("@equinor/eds-core-react");
445
+ var import_styled_components10 = __toESM(require("styled-components"));
446
+ var TableBody = (0, import_styled_components10.default)(import_eds_core_react8.Table.Body)`
447
+ // The following attribute are important for fixed column width
448
+ // CHANGE THES WITH CAUTION
449
+ background: inherit;
450
+ `;
451
+
436
452
  // src/DataTable/components/TableHeader.tsx
437
- var import_eds_core_react9 = require("@equinor/eds-core-react");
453
+ var import_eds_core_react10 = require("@equinor/eds-core-react");
438
454
 
439
455
  // src/cells/HeaderCell.tsx
440
- var import_eds_core_react8 = require("@equinor/eds-core-react");
456
+ var import_eds_core_react9 = require("@equinor/eds-core-react");
441
457
  var import_eds_icons4 = require("@equinor/eds-icons");
442
458
  var import_react_table2 = require("@tanstack/react-table");
443
- var import_styled_components10 = __toESM(require("styled-components"));
459
+ var import_styled_components11 = __toESM(require("styled-components"));
444
460
  var import_jsx_runtime9 = require("react/jsx-runtime");
445
- var HeaderDiv = import_styled_components10.default.div`
461
+ var HeaderDiv = import_styled_components11.default.div`
446
462
  display: flex;
447
463
  align-items: center;
448
464
  gap: 0.25rem;
@@ -451,7 +467,7 @@ var HeaderDiv = import_styled_components10.default.div`
451
467
  var HeaderCell = ({ header }) => {
452
468
  var _a;
453
469
  const style = {
454
- width: header.column.getSize() === -1 ? "auto" : header.column.getSize()
470
+ width: header.column.getSize()
455
471
  };
456
472
  const cellProps = {
457
473
  style,
@@ -467,7 +483,7 @@ var HeaderCell = ({ header }) => {
467
483
  })
468
484
  }, header.id);
469
485
  }
470
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Table.Cell, {
486
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Table.Cell, {
471
487
  ...cellProps,
472
488
  children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HeaderContent, {
473
489
  header
@@ -481,13 +497,13 @@ function HeaderContent({ header }) {
481
497
  children: [
482
498
  (0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
483
499
  {
484
- asc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Icon, {
500
+ asc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Icon, {
485
501
  data: import_eds_icons4.arrow_drop_up
486
502
  }),
487
- desc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Icon, {
503
+ desc: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Icon, {
488
504
  data: import_eds_icons4.arrow_drop_down
489
505
  }),
490
- none: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Icon, {
506
+ none: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react9.Icon, {
491
507
  data: import_eds_icons4.arrow_drop_down
492
508
  })
493
509
  }[header.column.getIsSorted()] ?? null
@@ -510,9 +526,9 @@ function getSort({ column }) {
510
526
  // src/DataTable/components/TableHeader.tsx
511
527
  var import_jsx_runtime10 = require("react/jsx-runtime");
512
528
  function TableHeader({ table, sticky }) {
513
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react9.Table.Head, {
529
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react10.Table.Head, {
514
530
  sticky,
515
- children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react9.Table.Row, {
531
+ children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react10.Table.Row, {
516
532
  children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(HeaderCell, {
517
533
  header
518
534
  }, header.id))
@@ -521,12 +537,13 @@ function TableHeader({ table, sticky }) {
521
537
  }
522
538
 
523
539
  // src/DataTable/components/TableRow.tsx
524
- var import_eds_core_react10 = require("@equinor/eds-core-react");
540
+ var import_eds_core_react11 = require("@equinor/eds-core-react");
541
+ var import_styled_components12 = __toESM(require("styled-components"));
525
542
  var import_jsx_runtime11 = require("react/jsx-runtime");
526
543
  function TableRow({ row, rowConfig, cellConfig }) {
527
544
  var _a;
528
545
  const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
529
- const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Table.Row, {
546
+ const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledTableRow, {
530
547
  active: row.getIsSelected(),
531
548
  style: {
532
549
  cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
@@ -549,6 +566,10 @@ function TableRow({ row, rowConfig, cellConfig }) {
549
566
  });
550
567
  return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
551
568
  }
569
+ var StyledTableRow = (0, import_styled_components12.default)(import_eds_core_react11.Table.Row)`
570
+ /* Background color must be inherited here. Does not work with inline styling */
571
+ background-color: inherit;
572
+ `;
552
573
  function handleRowEvent(row, handler) {
553
574
  if (!handler)
554
575
  return void 0;
@@ -567,13 +588,13 @@ function BasicTable({
567
588
  isLoading
568
589
  }) {
569
590
  const tableRows = table.getRowModel().rows;
570
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_eds_core_react11.Table, {
591
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_eds_core_react12.Table, {
571
592
  children: [
572
593
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableHeader, {
573
594
  sticky: stickyHeader,
574
595
  table
575
596
  }),
576
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_eds_core_react11.Table.Body, {
597
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableBody, {
577
598
  children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, {
578
599
  row,
579
600
  rowConfig,
@@ -587,10 +608,10 @@ function BasicTable({
587
608
  }
588
609
 
589
610
  // src/DataTable/components/DataTableHeader.tsx
590
- var import_eds_core_react14 = require("@equinor/eds-core-react");
611
+ var import_eds_core_react15 = require("@equinor/eds-core-react");
591
612
  var import_eds_icons7 = require("@equinor/eds-icons");
592
613
  var import_jotai2 = require("jotai");
593
- var import_styled_components13 = __toESM(require("styled-components"));
614
+ var import_styled_components15 = __toESM(require("styled-components"));
594
615
 
595
616
  // src/DataTable/atoms.ts
596
617
  var import_jotai = require("jotai");
@@ -601,15 +622,15 @@ var tableSortingAtom = (0, import_jotai.atom)([]);
601
622
  var expandedRowsAtom = (0, import_jotai.atom)({});
602
623
 
603
624
  // src/DataTable/filters/DebouncedInput.tsx
604
- var import_eds_core_react12 = require("@equinor/eds-core-react");
625
+ var import_eds_core_react13 = require("@equinor/eds-core-react");
605
626
  var import_eds_icons5 = require("@equinor/eds-icons");
606
627
  var import_react2 = require("react");
607
- var import_styled_components11 = __toESM(require("styled-components"));
628
+ var import_styled_components13 = __toESM(require("styled-components"));
608
629
  var import_jsx_runtime13 = require("react/jsx-runtime");
609
- var Wrapper3 = import_styled_components11.default.div`
630
+ var Wrapper3 = import_styled_components13.default.div`
610
631
  width: 200px;
611
632
  `;
612
- var CloseButton = (0, import_styled_components11.default)(import_eds_core_react12.Button)`
633
+ var CloseButton = (0, import_styled_components13.default)(import_eds_core_react13.Button)`
613
634
  width: 24px;
614
635
  height: 24px;
615
636
  `;
@@ -631,20 +652,20 @@ function DebouncedInput({
631
652
  return () => clearTimeout(timeout);
632
653
  }, [value]);
633
654
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Wrapper3, {
634
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Input, {
655
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Input, {
635
656
  ...props,
636
657
  value,
637
- leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Icon, {
658
+ leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Icon, {
638
659
  name: icon.name,
639
660
  data: icon,
640
661
  size: 18
641
662
  }),
642
- rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Tooltip, {
663
+ rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Tooltip, {
643
664
  title: "Clear input",
644
665
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseButton, {
645
666
  variant: "ghost_icon",
646
667
  onClick: () => setValue(""),
647
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Icon, {
668
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react13.Icon, {
648
669
  name: import_eds_icons5.close.name,
649
670
  data: import_eds_icons5.close,
650
671
  size: 18
@@ -667,10 +688,10 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
667
688
  };
668
689
 
669
690
  // src/DataTable/components/ColumnSelect.tsx
670
- var import_eds_core_react13 = require("@equinor/eds-core-react");
691
+ var import_eds_core_react14 = require("@equinor/eds-core-react");
671
692
  var import_eds_icons6 = require("@equinor/eds-icons");
672
693
  var import_react3 = require("react");
673
- var import_styled_components12 = __toESM(require("styled-components"));
694
+ var import_styled_components14 = __toESM(require("styled-components"));
674
695
 
675
696
  // src/DataTable/utils.tsx
676
697
  function capitalizeHeader(context) {
@@ -690,18 +711,18 @@ function prependSelectColumn(columns, config) {
690
711
  if (!(config == null ? void 0 : config.selectColumn))
691
712
  return columns;
692
713
  if (config.selectColumn === "default")
693
- return [SelectColumnDef(config == null ? void 0 : config.rowSelectionMode), ...columns];
714
+ return [SelectColumnDef(config), ...columns];
694
715
  return [config.selectColumn(), ...columns];
695
716
  }
696
717
 
697
718
  // src/DataTable/components/ColumnSelect.tsx
698
719
  var import_jsx_runtime14 = require("react/jsx-runtime");
699
- var ColumnSelectContent = import_styled_components12.default.div`
720
+ var ColumnSelectContent = import_styled_components14.default.div`
700
721
  display: grid;
701
722
  grid-template-columns: repeat(2, 1fr);
702
723
  grid-gap: 0.5rem;
703
724
  `;
704
- var ActionsWrapper = import_styled_components12.default.div`
725
+ var ActionsWrapper = import_styled_components14.default.div`
705
726
  display: flex;
706
727
  align-items: center;
707
728
  justify-content: flex-end;
@@ -713,7 +734,7 @@ function ColumnSelect({ table }) {
713
734
  const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
714
735
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, {
715
736
  children: [
716
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Button, {
737
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Button, {
717
738
  "aria-haspopup": true,
718
739
  id: "column-select-anchor",
719
740
  "aria-controls": "column-select-popover",
@@ -721,28 +742,28 @@ function ColumnSelect({ table }) {
721
742
  ref: referenceElement,
722
743
  variant: "ghost_icon",
723
744
  onClick: () => setIsOpen(true),
724
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Icon, {
745
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Icon, {
725
746
  name: "view_column",
726
747
  data: import_eds_icons6.view_column
727
748
  })
728
749
  }),
729
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react13.Popover, {
750
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react14.Popover, {
730
751
  open: isOpen,
731
752
  id: "column-select-popover",
732
753
  anchorEl: referenceElement.current,
733
754
  placement: "bottom-end",
734
755
  onClose: () => setIsOpen(false),
735
756
  children: [
736
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react13.Popover.Header, {
757
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react14.Popover.Header, {
737
758
  children: [
738
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Popover.Title, {
759
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Popover.Title, {
739
760
  children: "Column settings"
740
761
  }),
741
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Button, {
762
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Button, {
742
763
  variant: "ghost_icon",
743
764
  "aria-label": "Close column select",
744
765
  onClick: () => setIsOpen(false),
745
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Icon, {
766
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Icon, {
746
767
  name: "close",
747
768
  data: import_eds_icons6.close,
748
769
  size: 24
@@ -750,22 +771,22 @@ function ColumnSelect({ table }) {
750
771
  })
751
772
  ]
752
773
  }),
753
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react13.Popover.Content, {
774
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_eds_core_react14.Popover.Content, {
754
775
  children: [
755
776
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ColumnSelectContent, {
756
777
  children: selectableColumns.map((column) => {
757
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Checkbox, {
778
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Checkbox, {
758
779
  checked: column.getIsVisible(),
759
780
  label: getColumnHeader(column),
760
781
  onChange: column.getToggleVisibilityHandler()
761
782
  }, column.id);
762
783
  })
763
784
  }),
764
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Divider, {
785
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Divider, {
765
786
  variant: "small"
766
787
  }),
767
788
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ActionsWrapper, {
768
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react13.Button, {
789
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_eds_core_react14.Button, {
769
790
  color: "secondary",
770
791
  variant: "ghost",
771
792
  disabled: table.getIsAllColumnsVisible(),
@@ -783,14 +804,14 @@ function ColumnSelect({ table }) {
783
804
 
784
805
  // src/DataTable/components/DataTableHeader.tsx
785
806
  var import_jsx_runtime15 = require("react/jsx-runtime");
786
- var DataTableHeaderWrapper = import_styled_components13.default.div`
807
+ var DataTableHeaderWrapper = import_styled_components15.default.div`
787
808
  display: flex;
788
809
  align-items: center;
789
810
  justify-content: space-between;
790
811
  gap: 0.5rem;
791
812
  padding: ${(props) => props.captionPadding ?? "1rem"};
792
813
  `;
793
- var FilterContainer = import_styled_components13.default.div`
814
+ var FilterContainer = import_styled_components15.default.div`
794
815
  display: flex;
795
816
  align-items: center;
796
817
  gap: 1rem;
@@ -803,7 +824,7 @@ function DataTableHeader({ config, table, ...props }) {
803
824
  className: "--table-caption",
804
825
  captionPadding: props.captionPadding,
805
826
  children: [
806
- (props == null ? void 0 : props.tableCaption) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_eds_core_react14.Typography, {
827
+ (props == null ? void 0 : props.tableCaption) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_eds_core_react15.Typography, {
807
828
  variant: "h3",
808
829
  children: props == null ? void 0 : props.tableCaption
809
830
  }),
@@ -829,17 +850,17 @@ function DataTableHeader({ config, table, ...props }) {
829
850
  }
830
851
 
831
852
  // src/DataTable/components/VirtualTable.tsx
832
- var import_eds_core_react16 = require("@equinor/eds-core-react");
853
+ var import_eds_core_react17 = require("@equinor/eds-core-react");
833
854
  var import_react_virtual = require("@tanstack/react-virtual");
834
855
 
835
856
  // src/DataTable/components/PaddingRow.tsx
836
- var import_eds_core_react15 = require("@equinor/eds-core-react");
857
+ var import_eds_core_react16 = require("@equinor/eds-core-react");
837
858
  var import_jsx_runtime16 = require("react/jsx-runtime");
838
859
  var PaddingRow = (props) => {
839
860
  if (!props.height)
840
861
  return null;
841
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react15.Table.Row, {
842
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react15.Table.Cell, {
862
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Table.Row, {
863
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Table.Cell, {
843
864
  style: { height: `${props.height}px` }
844
865
  })
845
866
  });
@@ -864,13 +885,13 @@ function VirtualTable({
864
885
  const virtualRows = rowVirtualizer.getVirtualItems();
865
886
  const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
866
887
  const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
867
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_eds_core_react16.Table, {
888
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_eds_core_react17.Table, {
868
889
  children: [
869
890
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHeader, {
870
891
  sticky: props.stickyHeader,
871
892
  table
872
893
  }),
873
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_eds_core_react16.Table.Body, {
894
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TableBody, {
874
895
  children: [
875
896
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PaddingRow, {
876
897
  height: paddingTop
@@ -896,7 +917,7 @@ function VirtualTable({
896
917
 
897
918
  // src/DataTable/DataTableRaw.tsx
898
919
  var import_jsx_runtime18 = require("react/jsx-runtime");
899
- var DataTableWrapper = import_styled_components14.default.div`
920
+ var DataTableWrapper = import_styled_components16.default.div`
900
921
  width: ${(props) => props.width ?? "100%"};
901
922
 
902
923
  .--table-container {
@@ -906,7 +927,11 @@ var DataTableWrapper = import_styled_components14.default.div`
906
927
 
907
928
  table {
908
929
  width: 100%;
909
- table-layout: auto;
930
+
931
+ // The following attributes are important for fixed column width
932
+ // CHANGE THES WITH CAUTION
933
+ overflow: auto;
934
+ table-layout: ${(props) => props.tableLayout ?? "auto"};
910
935
  }
911
936
  }
912
937
  `;
@@ -917,6 +942,7 @@ function DataTableRaw(props) {
917
942
  captionPadding: header == null ? void 0 : header.captionPadding,
918
943
  height: config == null ? void 0 : config.height,
919
944
  width: config == null ? void 0 : config.width,
945
+ tableLayout: config == null ? void 0 : config.tableLayout,
920
946
  children: [
921
947
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DataTableHeader, {
922
948
  tableCaption: header == null ? void 0 : header.tableCaption,
package/dist/index.mjs CHANGED
@@ -14,6 +14,7 @@ var Wrapper = styled.div`
14
14
  }
15
15
  .--content-outlet {
16
16
  flex: 1;
17
+ max-width: 100%;
17
18
  }
18
19
  `;
19
20
  var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ jsxs(Wrapper, {
@@ -125,7 +126,10 @@ import { jsx as jsx3 } from "react/jsx-runtime";
125
126
  var ChipsWrapper = styled3.div`
126
127
  display: flex;
127
128
  align-items: center;
129
+ flex-wrap: wrap;
128
130
  gap: 0.25rem;
131
+ padding-top: 0.25rem;
132
+ padding-bottom: 0.25rem;
129
133
  `;
130
134
  var Chip = styled3.div`
131
135
  border-radius: 25px;
@@ -179,10 +183,10 @@ var StickyHeaderCell = styled4(StickyCell)`
179
183
  // src/cells/DynamicCell.tsx
180
184
  import { jsx as jsx4 } from "react/jsx-runtime";
181
185
  var StyledStickyCell = styled5(StickyCell)`
182
- ${(props) => props.backgroundColor ? `background-color: ${props.backgroundColor} !important;` : ``}
186
+ background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
183
187
  `;
184
188
  var StyledCell = styled5(Table2.Cell)`
185
- ${(props) => props.backgroundColor ? `background-color: ${props.backgroundColor} !important;` : ``}
189
+ ${({ backgroundColor: bg }) => bg ? `background-color: ${bg} !important;` : ``};
186
190
  `;
187
191
  function DynamicCell({ cell, highlight, getStickyCellColor }) {
188
192
  var _a;
@@ -313,9 +317,12 @@ var CellWrapper2 = styled8.div`
313
317
  margin-left: -16px;
314
318
  z-index: 2;
315
319
  `;
316
- function SelectColumnDef(selectionMode) {
320
+ function SelectColumnDef(props = {}) {
321
+ const selectionMode = props.rowSelectionMode;
322
+ const showBothSelectAndSubRowsToggle = props.hideExpandControls === false;
317
323
  return {
318
324
  id: "select",
325
+ size: showBothSelectAndSubRowsToggle ? 96 : 48,
319
326
  header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ jsx7(CellWrapper2, {
320
327
  children: /* @__PURE__ */ jsx7(Checkbox, {
321
328
  checked: table.getIsAllRowsSelected(),
@@ -360,7 +367,7 @@ function SelectColumnDef(selectionMode) {
360
367
 
361
368
  // src/DataTable/DataTableRaw.tsx
362
369
  import { useRef as useRef2 } from "react";
363
- import styled14 from "styled-components";
370
+ import styled16 from "styled-components";
364
371
 
365
372
  // src/DataTable/components/BasicTable.tsx
366
373
  import { Table as EdsTable } from "@equinor/eds-core-react";
@@ -388,16 +395,25 @@ function PlaceholderRow({ isLoading }) {
388
395
  });
389
396
  }
390
397
 
398
+ // src/DataTable/components/TableBody.tsx
399
+ import { Table as Table4 } from "@equinor/eds-core-react";
400
+ import styled10 from "styled-components";
401
+ var TableBody = styled10(Table4.Body)`
402
+ // The following attribute are important for fixed column width
403
+ // CHANGE THES WITH CAUTION
404
+ background: inherit;
405
+ `;
406
+
391
407
  // src/DataTable/components/TableHeader.tsx
392
- import { Table as Table5 } from "@equinor/eds-core-react";
408
+ import { Table as Table6 } from "@equinor/eds-core-react";
393
409
 
394
410
  // src/cells/HeaderCell.tsx
395
- import { Icon as Icon4, Table as Table4 } from "@equinor/eds-core-react";
411
+ import { Icon as Icon4, Table as Table5 } from "@equinor/eds-core-react";
396
412
  import { arrow_drop_down, arrow_drop_up } from "@equinor/eds-icons";
397
413
  import { flexRender as flexRender2 } from "@tanstack/react-table";
398
- import styled10 from "styled-components";
414
+ import styled11 from "styled-components";
399
415
  import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
400
- var HeaderDiv = styled10.div`
416
+ var HeaderDiv = styled11.div`
401
417
  display: flex;
402
418
  align-items: center;
403
419
  gap: 0.25rem;
@@ -406,7 +422,7 @@ var HeaderDiv = styled10.div`
406
422
  var HeaderCell = ({ header }) => {
407
423
  var _a;
408
424
  const style = {
409
- width: header.column.getSize() === -1 ? "auto" : header.column.getSize()
425
+ width: header.column.getSize()
410
426
  };
411
427
  const cellProps = {
412
428
  style,
@@ -422,7 +438,7 @@ var HeaderCell = ({ header }) => {
422
438
  })
423
439
  }, header.id);
424
440
  }
425
- return /* @__PURE__ */ jsx9(Table4.Cell, {
441
+ return /* @__PURE__ */ jsx9(Table5.Cell, {
426
442
  ...cellProps,
427
443
  children: /* @__PURE__ */ jsx9(HeaderContent, {
428
444
  header
@@ -465,9 +481,9 @@ function getSort({ column }) {
465
481
  // src/DataTable/components/TableHeader.tsx
466
482
  import { jsx as jsx10 } from "react/jsx-runtime";
467
483
  function TableHeader({ table, sticky }) {
468
- return /* @__PURE__ */ jsx10(Table5.Head, {
484
+ return /* @__PURE__ */ jsx10(Table6.Head, {
469
485
  sticky,
470
- children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx10(Table5.Row, {
486
+ children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx10(Table6.Row, {
471
487
  children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx10(HeaderCell, {
472
488
  header
473
489
  }, header.id))
@@ -476,12 +492,13 @@ function TableHeader({ table, sticky }) {
476
492
  }
477
493
 
478
494
  // src/DataTable/components/TableRow.tsx
479
- import { Table as Table6 } from "@equinor/eds-core-react";
495
+ import { Table as Table7 } from "@equinor/eds-core-react";
496
+ import styled12 from "styled-components";
480
497
  import { jsx as jsx11 } from "react/jsx-runtime";
481
498
  function TableRow({ row, rowConfig, cellConfig }) {
482
499
  var _a;
483
500
  const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
484
- const tableRowContent = /* @__PURE__ */ jsx11(Table6.Row, {
501
+ const tableRowContent = /* @__PURE__ */ jsx11(StyledTableRow, {
485
502
  active: row.getIsSelected(),
486
503
  style: {
487
504
  cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
@@ -504,6 +521,10 @@ function TableRow({ row, rowConfig, cellConfig }) {
504
521
  });
505
522
  return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
506
523
  }
524
+ var StyledTableRow = styled12(Table7.Row)`
525
+ /* Background color must be inherited here. Does not work with inline styling */
526
+ background-color: inherit;
527
+ `;
507
528
  function handleRowEvent(row, handler) {
508
529
  if (!handler)
509
530
  return void 0;
@@ -528,7 +549,7 @@ function BasicTable({
528
549
  sticky: stickyHeader,
529
550
  table
530
551
  }),
531
- /* @__PURE__ */ jsx12(EdsTable.Body, {
552
+ /* @__PURE__ */ jsx12(TableBody, {
532
553
  children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx12(TableRow, {
533
554
  row,
534
555
  rowConfig,
@@ -545,7 +566,7 @@ function BasicTable({
545
566
  import { Typography as Typography2 } from "@equinor/eds-core-react";
546
567
  import { search } from "@equinor/eds-icons";
547
568
  import { useAtom } from "jotai";
548
- import styled13 from "styled-components";
569
+ import styled15 from "styled-components";
549
570
 
550
571
  // src/DataTable/atoms.ts
551
572
  import { atom } from "jotai";
@@ -559,12 +580,12 @@ var expandedRowsAtom = atom({});
559
580
  import { Button as Button3, Icon as Icon5, Input, Tooltip } from "@equinor/eds-core-react";
560
581
  import { close } from "@equinor/eds-icons";
561
582
  import { useEffect, useState as useState2 } from "react";
562
- import styled11 from "styled-components";
583
+ import styled13 from "styled-components";
563
584
  import { jsx as jsx13 } from "react/jsx-runtime";
564
- var Wrapper3 = styled11.div`
585
+ var Wrapper3 = styled13.div`
565
586
  width: 200px;
566
587
  `;
567
- var CloseButton = styled11(Button3)`
588
+ var CloseButton = styled13(Button3)`
568
589
  width: 24px;
569
590
  height: 24px;
570
591
  `;
@@ -625,7 +646,7 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
625
646
  import { Button as Button4, Checkbox as Checkbox2, Divider, Icon as Icon6, Popover } from "@equinor/eds-core-react";
626
647
  import { close as close2, view_column } from "@equinor/eds-icons";
627
648
  import { useRef, useState as useState3 } from "react";
628
- import styled12 from "styled-components";
649
+ import styled14 from "styled-components";
629
650
 
630
651
  // src/DataTable/utils.tsx
631
652
  function capitalizeHeader(context) {
@@ -645,18 +666,18 @@ function prependSelectColumn(columns, config) {
645
666
  if (!(config == null ? void 0 : config.selectColumn))
646
667
  return columns;
647
668
  if (config.selectColumn === "default")
648
- return [SelectColumnDef(config == null ? void 0 : config.rowSelectionMode), ...columns];
669
+ return [SelectColumnDef(config), ...columns];
649
670
  return [config.selectColumn(), ...columns];
650
671
  }
651
672
 
652
673
  // src/DataTable/components/ColumnSelect.tsx
653
674
  import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
654
- var ColumnSelectContent = styled12.div`
675
+ var ColumnSelectContent = styled14.div`
655
676
  display: grid;
656
677
  grid-template-columns: repeat(2, 1fr);
657
678
  grid-gap: 0.5rem;
658
679
  `;
659
- var ActionsWrapper = styled12.div`
680
+ var ActionsWrapper = styled14.div`
660
681
  display: flex;
661
682
  align-items: center;
662
683
  justify-content: flex-end;
@@ -738,14 +759,14 @@ function ColumnSelect({ table }) {
738
759
 
739
760
  // src/DataTable/components/DataTableHeader.tsx
740
761
  import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
741
- var DataTableHeaderWrapper = styled13.div`
762
+ var DataTableHeaderWrapper = styled15.div`
742
763
  display: flex;
743
764
  align-items: center;
744
765
  justify-content: space-between;
745
766
  gap: 0.5rem;
746
767
  padding: ${(props) => props.captionPadding ?? "1rem"};
747
768
  `;
748
- var FilterContainer = styled13.div`
769
+ var FilterContainer = styled15.div`
749
770
  display: flex;
750
771
  align-items: center;
751
772
  gap: 1rem;
@@ -784,17 +805,17 @@ function DataTableHeader({ config, table, ...props }) {
784
805
  }
785
806
 
786
807
  // src/DataTable/components/VirtualTable.tsx
787
- import { Table as Table8 } from "@equinor/eds-core-react";
808
+ import { Table as Table9 } from "@equinor/eds-core-react";
788
809
  import { useVirtualizer } from "@tanstack/react-virtual";
789
810
 
790
811
  // src/DataTable/components/PaddingRow.tsx
791
- import { Table as Table7 } from "@equinor/eds-core-react";
812
+ import { Table as Table8 } from "@equinor/eds-core-react";
792
813
  import { jsx as jsx16 } from "react/jsx-runtime";
793
814
  var PaddingRow = (props) => {
794
815
  if (!props.height)
795
816
  return null;
796
- return /* @__PURE__ */ jsx16(Table7.Row, {
797
- children: /* @__PURE__ */ jsx16(Table7.Cell, {
817
+ return /* @__PURE__ */ jsx16(Table8.Row, {
818
+ children: /* @__PURE__ */ jsx16(Table8.Cell, {
798
819
  style: { height: `${props.height}px` }
799
820
  })
800
821
  });
@@ -819,13 +840,13 @@ function VirtualTable({
819
840
  const virtualRows = rowVirtualizer.getVirtualItems();
820
841
  const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
821
842
  const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
822
- return /* @__PURE__ */ jsxs10(Table8, {
843
+ return /* @__PURE__ */ jsxs10(Table9, {
823
844
  children: [
824
845
  /* @__PURE__ */ jsx17(TableHeader, {
825
846
  sticky: props.stickyHeader,
826
847
  table
827
848
  }),
828
- /* @__PURE__ */ jsxs10(Table8.Body, {
849
+ /* @__PURE__ */ jsxs10(TableBody, {
829
850
  children: [
830
851
  /* @__PURE__ */ jsx17(PaddingRow, {
831
852
  height: paddingTop
@@ -851,7 +872,7 @@ function VirtualTable({
851
872
 
852
873
  // src/DataTable/DataTableRaw.tsx
853
874
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
854
- var DataTableWrapper = styled14.div`
875
+ var DataTableWrapper = styled16.div`
855
876
  width: ${(props) => props.width ?? "100%"};
856
877
 
857
878
  .--table-container {
@@ -861,7 +882,11 @@ var DataTableWrapper = styled14.div`
861
882
 
862
883
  table {
863
884
  width: 100%;
864
- table-layout: auto;
885
+
886
+ // The following attributes are important for fixed column width
887
+ // CHANGE THES WITH CAUTION
888
+ overflow: auto;
889
+ table-layout: ${(props) => props.tableLayout ?? "auto"};
865
890
  }
866
891
  }
867
892
  `;
@@ -872,6 +897,7 @@ function DataTableRaw(props) {
872
897
  captionPadding: header == null ? void 0 : header.captionPadding,
873
898
  height: config == null ? void 0 : config.height,
874
899
  width: config == null ? void 0 : config.width,
900
+ tableLayout: config == null ? void 0 : config.tableLayout,
875
901
  children: [
876
902
  /* @__PURE__ */ jsx18(DataTableHeader, {
877
903
  tableCaption: header == null ? void 0 : header.tableCaption,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/apollo-components",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",