@equinor/apollo-components 3.4.0-skeleton.1 → 3.5.1-beta.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
@@ -1,13 +1,13 @@
1
1
  import { IconData } from '@equinor/eds-icons';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, ReactElement, HTMLProps, MutableRefObject, Dispatch, SetStateAction, SyntheticEvent } from 'react';
4
- import { CellContext, Cell, Header, Table, Row, SortingState, OnChangeFn, ColumnDef, RowSelectionState, ExpandedState, ColumnPinningState, VisibilityState, HeaderContext, Column } from '@tanstack/react-table';
4
+ import { CellContext, Cell, Header, Table, Row, SortingState, OnChangeFn, ColumnDef, ColumnResizeMode, RowSelectionState, ExpandedState, ColumnPinningState, VisibilityState, HeaderContext, Column } from '@tanstack/react-table';
5
+ export { Cell, ColumnDef, ColumnPinningState, ColumnResizeMode, ExpandedState, OnChangeFn, Row, RowSelectionState, SortingState, Table, VisibilityState } from '@tanstack/react-table';
5
6
  import * as styled_components from 'styled-components';
6
7
  import * as _equinor_eds_core_react from '@equinor/eds-core-react';
7
8
  import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-core-react';
8
9
  import { ColumnDef as ColumnDef$1 } from '@tanstack/table-core';
9
10
  import { SetRequired } from 'type-fest';
10
- import { TableOptions } from '@tanstack/table-core/build/lib/types';
11
11
  import { Variants } from '@equinor/eds-core-react/dist/types/components/types';
12
12
  import { FieldError } from 'react-hook-form';
13
13
 
@@ -27,12 +27,12 @@ declare const ChipsCell: (props: {
27
27
  values?: string[];
28
28
  }) => JSX.Element;
29
29
 
30
- declare type TableCellProps<T> = {
30
+ type TableCellProps<T> = {
31
31
  cell: Cell<T, unknown>;
32
32
  highlight?: boolean;
33
33
  getStickyCellColor?: (cell: Cell<T, unknown>) => string;
34
34
  };
35
- declare type StyledStickyCellProps = {
35
+ type StyledStickyCellProps = {
36
36
  highlight?: boolean;
37
37
  backgroundColor?: string;
38
38
  };
@@ -46,7 +46,7 @@ interface HeaderCellProps<TData, TValue> {
46
46
  }
47
47
  declare const HeaderCell: <TData, TValue>({ header, table }: HeaderCellProps<TData, TValue>) => JSX.Element;
48
48
 
49
- declare type HierarchyCellOptions = {
49
+ type HierarchyCellOptions = {
50
50
  getRowDepth?: () => number;
51
51
  getDisplayName?: () => string;
52
52
  };
@@ -87,8 +87,8 @@ interface RowConfig<T> {
87
87
  onMouseEnter?: (row: Row<T>) => void;
88
88
  onMouseLeave?: (row: Row<T>) => void;
89
89
  }
90
- declare type TruncateMode = 'wrap' | 'hover';
91
- declare type SortConfig = {
90
+ type TruncateMode = 'wrap' | 'hover';
91
+ type SortConfig = {
92
92
  enableSorting?: boolean;
93
93
  manualSorting?: boolean;
94
94
  sorting?: SortingState;
@@ -105,8 +105,8 @@ interface CellConfig<T> {
105
105
  */
106
106
  truncateMode?: TruncateMode | ((cell: Cell<T, unknown>) => TruncateMode);
107
107
  }
108
- declare type RowSelectionMode = 'single' | 'multiple';
109
- declare type TableLayout = 'auto' | 'fixed';
108
+ type RowSelectionMode = 'single' | 'multiple';
109
+ type TableLayout = 'auto' | 'fixed';
110
110
  interface HTMLPropsRef<T extends HTMLElement> extends HTMLProps<T> {
111
111
  ref?: MutableRefObject<T | null> | null;
112
112
  }
@@ -138,7 +138,7 @@ interface DataTableProps<T> {
138
138
  virtual?: boolean;
139
139
  getRowId?: (originalRow: T, index: number, parent: Row<T> | undefined) => string;
140
140
  getSubRows?: (originalRow: T) => T[] | undefined;
141
- columnResizing?: boolean | TableOptions<T>['columnResizeMode'];
141
+ columnResizing?: boolean | ColumnResizeMode;
142
142
  rowSelection?: Partial<ControlledState<RowSelectionState>> & {
143
143
  mode?: RowSelectionMode;
144
144
  selectColumn?: 'default' | ((options?: Record<string, any>) => ColumnDef<T, any>);
@@ -179,17 +179,9 @@ interface DataTableProps<T> {
179
179
  padding?: string;
180
180
  };
181
181
  tableContainerProps?: HTMLPropsRef<HTMLDivElement>;
182
- infiniteScroll?: {
183
- /** Called on scroll below offset. */
184
- onBottomScroll: () => void;
185
- /** Pixels above bottom. Defines when the onBottomScroll should be called. Defaults to `300`. */
186
- offset?: number;
187
- /** Displays loading row on the bottom of the table */
188
- isFetchingNextPage?: boolean;
189
- isLastPage?: boolean;
190
- };
182
+ infiniteScroll?: InfiniteScrollConfig;
191
183
  }
192
- declare type ControlledState<T> = {
184
+ type ControlledState<T> = {
193
185
  state?: T;
194
186
  /** Callback when state chagnes. Using this requires the state to be fully controlled. */
195
187
  onChange?: Dispatch<SetStateAction<T>>;
@@ -206,7 +198,7 @@ declare function DataTable<T>(props: DataTableProps<T>): JSX.Element;
206
198
  */
207
199
  declare function capitalizeHeader<T>(context: HeaderContext<T, any>): string;
208
200
  /** Prepend a column definition array with a select column. */
209
- declare function prependSelectColumn<T>(columns: ColumnDef<T>[], config?: DataTableProps<T>['rowSelection']): ColumnDef<T, unknown>[];
201
+ declare function prependSelectColumn<T>(columns: ColumnDef<T>[], config?: DataTableProps<T>['rowSelection']): ColumnDef<T>[];
210
202
 
211
203
  declare function SelectColumnDef<T>(props: SetRequired<DataTableProps<T>, 'rowSelection'>['rowSelection']): ColumnDef$1<T, any>;
212
204
 
@@ -214,7 +206,7 @@ declare const leftCellShadow: styled_components.FlattenSimpleInterpolation;
214
206
  declare const StickyCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, {} & CellProps, never>;
215
207
  declare const StickyHeaderCell: styled_components.StyledComponent<react.ForwardRefExoticComponent<CellProps & react.RefAttributes<HTMLTableCellElement>>, any, ({} & CellProps) & CellProps, never>;
216
208
 
217
- declare type TypographyProps = {
209
+ type TypographyProps = {
218
210
  truncate?: boolean;
219
211
  enableShowAllOnHover?: boolean;
220
212
  } & TypographyProps$1;
@@ -234,12 +226,12 @@ declare function getTotalRight<TData>(table: Table<TData>, column: Column<TData>
234
226
  declare function getIsFirstRightPinnedColumn<TData>(column: Column<TData>): boolean;
235
227
  declare function getIsLastLeftPinnedColumn<TData>(table: Table<TData>, column: Column<TData>): boolean;
236
228
 
237
- declare type FormMeta = {
229
+ type FormMeta = {
238
230
  _isNew?: boolean;
239
231
  _editMode?: boolean;
240
232
  _hasRemoteChange?: boolean;
241
233
  };
242
- declare type WithoutFormMeta<T extends FormMeta> = Omit<T, keyof FormMeta>;
234
+ type WithoutFormMeta<T extends FormMeta> = Omit<T, keyof FormMeta>;
243
235
 
244
236
  /**
245
237
  * Subscribes to the `_editMode` field in a `react-hook-form` context.
package/dist/index.js CHANGED
@@ -2724,9 +2724,9 @@ function HeaderContent({ header, table }) {
2724
2724
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(HeaderDiv, { children: [
2725
2725
  (0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
2726
2726
  (_a = {
2727
- asc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_up }),
2728
- desc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down }),
2729
- none: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down })
2727
+ asc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_up, style: { flexShrink: 0 } }),
2728
+ desc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down, style: { flexShrink: 0 } }),
2729
+ none: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down, style: { flexShrink: 0 } })
2730
2730
  }[header.column.getIsSorted()]) != null ? _a : null,
2731
2731
  table.options.enableColumnResizing && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2732
2732
  "div",
@@ -2954,6 +2954,7 @@ var import_react3 = require("react");
2954
2954
  var import_styled_components10 = __toESM(require("styled-components"));
2955
2955
 
2956
2956
  // src/DataTable/utils.tsx
2957
+ var import_react_table3 = require("@tanstack/react-table");
2957
2958
  function capitalizeHeader(context) {
2958
2959
  const header = context.header.id;
2959
2960
  return header.charAt(0).toUpperCase() + header.slice(1);
@@ -3072,8 +3073,8 @@ function TableHeader({ table, sticky }) {
3072
3073
  }
3073
3074
 
3074
3075
  // src/DataTable/DataTable.tsx
3075
- var import_react_table3 = require("@tanstack/react-table");
3076
- var import_react9 = require("react");
3076
+ var import_react_table4 = require("@tanstack/react-table");
3077
+ var import_react7 = require("react");
3077
3078
  var import_styled_components16 = __toESM(require("styled-components"));
3078
3079
 
3079
3080
  // src/DataTable/components/BasicTable.tsx
@@ -3081,43 +3082,20 @@ var import_eds_core_react15 = require("@equinor/eds-core-react");
3081
3082
 
3082
3083
  // src/DataTable/components/PlaceholderRow.tsx
3083
3084
  var import_eds_core_react12 = require("@equinor/eds-core-react");
3084
- var import_react4 = require("react");
3085
+ var import_styled_components11 = __toESM(require("styled-components"));
3085
3086
  var import_jsx_runtime13 = require("react/jsx-runtime");
3086
- function PlaceholderRow({ children }) {
3087
- const [width, setWidth] = (0, import_react4.useState)();
3088
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3089
- import_eds_core_react12.Table.Row,
3090
- {
3091
- ref: (node) => {
3092
- var _a, _b, _c;
3093
- if (!node)
3094
- return;
3095
- setWidth((_c = (_b = (_a = node.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement) == null ? void 0 : _c.clientWidth);
3096
- },
3097
- style: { pointerEvents: "none" },
3098
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Table.Cell, { colSpan: 100, style: { padding: 0 }, children: width && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3099
- "div",
3100
- {
3101
- style: {
3102
- width,
3103
- display: "flex",
3104
- justifyContent: "center",
3105
- position: "sticky",
3106
- left: 0,
3107
- height: "100%",
3108
- alignItems: "center"
3109
- },
3110
- children
3111
- }
3112
- ) })
3113
- }
3114
- );
3087
+ var PlaceholderTextWrapper = import_styled_components11.default.div`
3088
+ display: flex;
3089
+ justify-content: center;
3090
+ `;
3091
+ function PlaceholderRow({ isLoading }) {
3092
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Table.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Table.Cell, { colSpan: 100, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlaceholderTextWrapper, { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.DotProgress, { color: "primary" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Typography, { children: "No data available" }) }) }) });
3115
3093
  }
3116
3094
 
3117
3095
  // src/DataTable/components/TableBody.tsx
3118
3096
  var import_eds_core_react13 = require("@equinor/eds-core-react");
3119
- var import_styled_components11 = __toESM(require("styled-components"));
3120
- var TableBody = (0, import_styled_components11.default)(import_eds_core_react13.Table.Body)`
3097
+ var import_styled_components12 = __toESM(require("styled-components"));
3098
+ var TableBody = (0, import_styled_components12.default)(import_eds_core_react13.Table.Body)`
3121
3099
  // The following attribute are important for fixed column width
3122
3100
  // CHANGE THES WITH CAUTION
3123
3101
  background: inherit;
@@ -3125,7 +3103,7 @@ var TableBody = (0, import_styled_components11.default)(import_eds_core_react13.
3125
3103
 
3126
3104
  // src/DataTable/components/TableRow.tsx
3127
3105
  var import_eds_core_react14 = require("@equinor/eds-core-react");
3128
- var import_styled_components12 = __toESM(require("styled-components"));
3106
+ var import_styled_components13 = __toESM(require("styled-components"));
3129
3107
  var import_jsx_runtime14 = require("react/jsx-runtime");
3130
3108
  function TableRow({
3131
3109
  row,
@@ -3168,7 +3146,7 @@ function TableRow({
3168
3146
  );
3169
3147
  return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
3170
3148
  }
3171
- var StyledTableRow = (0, import_styled_components12.default)(import_eds_core_react14.Table.Row)`
3149
+ var StyledTableRow = (0, import_styled_components13.default)(import_eds_core_react14.Table.Row)`
3172
3150
  /* Background color must be inherited here. Does not work with inline styling */
3173
3151
  ${({ active }) => active ? "" : "background-color: inherit;"}
3174
3152
  `;
@@ -3201,18 +3179,18 @@ function BasicTable({
3201
3179
  // src/DataTable/components/DataTableHeader.tsx
3202
3180
  var import_eds_core_react17 = require("@equinor/eds-core-react");
3203
3181
  var import_eds_icons7 = require("@equinor/eds-icons");
3204
- var import_styled_components14 = __toESM(require("styled-components"));
3182
+ var import_styled_components15 = __toESM(require("styled-components"));
3205
3183
 
3206
3184
  // src/DataTable/filters/DebouncedInput.tsx
3207
3185
  var import_eds_core_react16 = require("@equinor/eds-core-react");
3208
3186
  var import_eds_icons6 = require("@equinor/eds-icons");
3209
- var import_react5 = require("react");
3210
- var import_styled_components13 = __toESM(require("styled-components"));
3187
+ var import_react4 = require("react");
3188
+ var import_styled_components14 = __toESM(require("styled-components"));
3211
3189
  var import_jsx_runtime16 = require("react/jsx-runtime");
3212
- var Wrapper3 = import_styled_components13.default.div`
3190
+ var Wrapper3 = import_styled_components14.default.div`
3213
3191
  width: 200px;
3214
3192
  `;
3215
- var CloseButton = (0, import_styled_components13.default)(import_eds_core_react16.Button)`
3193
+ var CloseButton = (0, import_styled_components14.default)(import_eds_core_react16.Button)`
3216
3194
  width: 24px;
3217
3195
  height: 24px;
3218
3196
  `;
@@ -3228,11 +3206,11 @@ function DebouncedInput(_a) {
3228
3206
  "icon",
3229
3207
  "debounce"
3230
3208
  ]);
3231
- const [value, setValue] = (0, import_react5.useState)(initialValue);
3232
- (0, import_react5.useEffect)(() => {
3209
+ const [value, setValue] = (0, import_react4.useState)(initialValue);
3210
+ (0, import_react4.useEffect)(() => {
3233
3211
  setValue(initialValue);
3234
3212
  }, [initialValue]);
3235
- (0, import_react5.useEffect)(() => {
3213
+ (0, import_react4.useEffect)(() => {
3236
3214
  const timeout = setTimeout(() => {
3237
3215
  onChange(value);
3238
3216
  }, debounce);
@@ -3261,14 +3239,14 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
3261
3239
 
3262
3240
  // src/DataTable/components/DataTableHeader.tsx
3263
3241
  var import_jsx_runtime17 = require("react/jsx-runtime");
3264
- var TableBannerWrapper = import_styled_components14.default.div`
3242
+ var TableBannerWrapper = import_styled_components15.default.div`
3265
3243
  display: flex;
3266
3244
  align-items: center;
3267
3245
  justify-content: space-between;
3268
3246
  gap: 0.5rem;
3269
3247
  padding: ${(props) => props.padding || "1rem"};
3270
3248
  `;
3271
- var FilterContainer = import_styled_components14.default.div`
3249
+ var FilterContainer = import_styled_components15.default.div`
3272
3250
  display: flex;
3273
3251
  align-items: center;
3274
3252
  gap: 1rem;
@@ -3312,8 +3290,6 @@ function TableBanner({
3312
3290
  // src/DataTable/components/VirtualTable.tsx
3313
3291
  var import_eds_core_react19 = require("@equinor/eds-core-react");
3314
3292
  var import_react_virtual = require("@tanstack/react-virtual");
3315
- var import_react6 = require("react");
3316
- var import_styled_components15 = __toESM(require("styled-components"));
3317
3293
 
3318
3294
  // src/DataTable/components/PaddingRow.tsx
3319
3295
  var import_eds_core_react18 = require("@equinor/eds-core-react");
@@ -3338,7 +3314,7 @@ function VirtualTable(_a) {
3338
3314
  "cellConfig",
3339
3315
  "containerRef"
3340
3316
  ]);
3341
- var _a2;
3317
+ var _a2, _b2;
3342
3318
  const { rows } = table.getRowModel();
3343
3319
  const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
3344
3320
  count: rows.length,
@@ -3349,13 +3325,13 @@ function VirtualTable(_a) {
3349
3325
  });
3350
3326
  const virtualRows = rowVirtualizer.getVirtualItems();
3351
3327
  const paddingTop = virtualRows.length > 0 ? ((_a2 = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a2.start) || 0 : 0;
3352
- const paddingBottom = true ? 0 : virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
3353
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_eds_core_react19.Table, { style: { position: "relative" }, children: [
3328
+ const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
3329
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_eds_core_react19.Table, { children: [
3354
3330
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.Table.Caption, { hidden: true, children: props.tableCaption }),
3355
3331
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableHeader, { sticky: props.stickyHeader, table }),
3356
- props.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.Table.Body, { children: new Array(...new Array(30)).map((_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.Table.Row, { children: table.getVisibleLeafColumns().map((column, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.Table.Cell, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableCellSkeleton, { delay: (rowIndex + 1) / 20 + (columnIndex + 1) / 5 }) }, rowIndex + column.id)) }, rowIndex)) }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(TableBody, { children: [
3332
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(TableBody, { children: [
3357
3333
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaddingRow, { height: paddingTop }),
3358
- rows.length && virtualRows.map((virtualRow) => {
3334
+ rows.length ? virtualRows.map((virtualRow) => {
3359
3335
  const row = rows[virtualRow.index];
3360
3336
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3361
3337
  TableRow,
@@ -3368,34 +3344,16 @@ function VirtualTable(_a) {
3368
3344
  },
3369
3345
  row.id
3370
3346
  );
3371
- }),
3372
- !rows.length && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PlaceholderRow, { children: props.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.DotProgress, { color: "primary" }) : "No data available" }),
3373
- props.isFetchingNextPage && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PlaceholderRow, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.DotProgress, { color: "primary" }) }),
3347
+ }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PlaceholderRow, { isLoading: props.isLoading }),
3374
3348
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaddingRow, { height: paddingBottom })
3375
3349
  ] })
3376
3350
  ] });
3377
3351
  }
3378
- var TableCellSkeleton = import_styled_components15.default.div`
3379
- opacity: 0.5;
3380
- animation: 1s skeleton-loading ${({ delay }) => `${delay}s`} linear infinite alternate;
3381
- height: 1rem;
3382
- border-radius: 0.5rem;
3383
- background-color: #ccc;
3384
-
3385
- @keyframes skeleton-loading {
3386
- 0% {
3387
- background-color: #ccc;
3388
- }
3389
- 100% {
3390
- background-color: #eee;
3391
- }
3392
- }
3393
- `;
3394
3352
 
3395
3353
  // src/DataTable/hooks/useFetchMoreOnBottomReached.tsx
3396
- var import_react7 = require("react");
3354
+ var import_react5 = require("react");
3397
3355
  function useFetchMoreOnBottomReached(tableContainerRef, infiniteScrollConfig) {
3398
- const fetchMoreOnBottomReached = (0, import_react7.useCallback)(
3356
+ const fetchMoreOnBottomReached = (0, import_react5.useCallback)(
3399
3357
  (tableContainer) => {
3400
3358
  if (!infiniteScrollConfig)
3401
3359
  return;
@@ -3409,11 +3367,11 @@ function useFetchMoreOnBottomReached(tableContainerRef, infiniteScrollConfig) {
3409
3367
  },
3410
3368
  [infiniteScrollConfig]
3411
3369
  );
3412
- const onTableContainerScroll = (0, import_react7.useCallback)(
3370
+ const onTableContainerScroll = (0, import_react5.useCallback)(
3413
3371
  (event) => fetchMoreOnBottomReached(event.target),
3414
3372
  [fetchMoreOnBottomReached]
3415
3373
  );
3416
- (0, import_react7.useEffect)(() => {
3374
+ (0, import_react5.useEffect)(() => {
3417
3375
  if (!infiniteScrollConfig)
3418
3376
  return;
3419
3377
  fetchMoreOnBottomReached(tableContainerRef.current);
@@ -3422,10 +3380,10 @@ function useFetchMoreOnBottomReached(tableContainerRef, infiniteScrollConfig) {
3422
3380
  }
3423
3381
 
3424
3382
  // src/DataTable/hooks/useForceRerender.ts
3425
- var import_react8 = require("react");
3383
+ var import_react6 = require("react");
3426
3384
  function useForceRerender() {
3427
- const [, setTick] = (0, import_react8.useState)(0);
3428
- return (0, import_react8.useCallback)(() => setTick((tick) => tick + 1), []);
3385
+ const [, setTick] = (0, import_react6.useState)(0);
3386
+ return (0, import_react6.useCallback)(() => setTick((tick) => tick + 1), []);
3429
3387
  }
3430
3388
 
3431
3389
  // src/DataTable/DataTable.tsx
@@ -3454,7 +3412,6 @@ var DataTableWrapper = import_styled_components16.default.div`
3454
3412
  }};
3455
3413
  width: '100%';
3456
3414
  overflow: auto;
3457
- ${(props) => props.disableYScroll ? "overflow-y: hidden;" : ""}
3458
3415
  ${(props) => canUseContainStrict(props.height) ? "contain: strict;" : ""}
3459
3416
 
3460
3417
  table {
@@ -3470,14 +3427,14 @@ var DataTableWrapper = import_styled_components16.default.div`
3470
3427
  }
3471
3428
  `;
3472
3429
  function DataTable(props) {
3473
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H;
3430
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
3474
3431
  const { columns, data, bannerConfig, cellConfig, sorting } = props;
3475
- const [internalColumnVisibility, setInternalColumnVisibility] = (0, import_react9.useState)({});
3432
+ const [internalColumnVisibility, setInternalColumnVisibility] = (0, import_react7.useState)({});
3476
3433
  const [columnVisibility, setColumnVisibility] = [
3477
3434
  (_b = (_a = props.columnVisibility) == null ? void 0 : _a.state) != null ? _b : internalColumnVisibility,
3478
3435
  (_d = (_c = props.columnVisibility) == null ? void 0 : _c.onChange) != null ? _d : setInternalColumnVisibility
3479
3436
  ];
3480
- const [internalGlobalFilterState, setInternalGlobalFilterState] = (0, import_react9.useState)("");
3437
+ const [internalGlobalFilterState, setInternalGlobalFilterState] = (0, import_react7.useState)("");
3481
3438
  const [globalFilterState, setGlobalFilterState] = [
3482
3439
  (_f = (_e = props.globalFilter) == null ? void 0 : _e.state) != null ? _f : internalGlobalFilterState,
3483
3440
  (_h = (_g = props.globalFilter) == null ? void 0 : _g.onChange) != null ? _h : setInternalGlobalFilterState
@@ -3486,27 +3443,27 @@ function DataTable(props) {
3486
3443
  function enableGlobalFilter(value) {
3487
3444
  return enableOrUndefined(shouldEnableGlobalFilter, value);
3488
3445
  }
3489
- const [internalSortingState, setInternalSortingState] = (0, import_react9.useState)([]);
3446
+ const [internalSortingState, setInternalSortingState] = (0, import_react7.useState)([]);
3490
3447
  const [sortingState, setSortingState] = [
3491
3448
  (_k = (_j = props.sorting) == null ? void 0 : _j.state) != null ? _k : internalSortingState,
3492
3449
  (_m = (_l = props.sorting) == null ? void 0 : _l.onChange) != null ? _m : setInternalSortingState
3493
3450
  ];
3494
- const [internalRowSelectionState, setInternalRowSelectionState] = (0, import_react9.useState)({});
3451
+ const [internalRowSelectionState, setInternalRowSelectionState] = (0, import_react7.useState)({});
3495
3452
  const [rowSelectionState, setRowSelectionState] = [
3496
3453
  (_o = (_n = props.rowSelection) == null ? void 0 : _n.state) != null ? _o : internalRowSelectionState,
3497
3454
  (_q = (_p = props.rowSelection) == null ? void 0 : _p.onChange) != null ? _q : setInternalRowSelectionState
3498
3455
  ];
3499
- const [internalExpandedState, setInternalExpandedState] = (0, import_react9.useState)({});
3456
+ const [internalExpandedState, setInternalExpandedState] = (0, import_react7.useState)({});
3500
3457
  const [expandedState, setExpandedState] = [
3501
3458
  (_s = (_r = props.expansion) == null ? void 0 : _r.state) != null ? _s : internalExpandedState,
3502
3459
  (_u = (_t = props.expansion) == null ? void 0 : _t.onChange) != null ? _u : setInternalExpandedState
3503
3460
  ];
3504
- const [internalColumnPinning, setInternalColumnPinning] = (0, import_react9.useState)({});
3461
+ const [internalColumnPinning, setInternalColumnPinning] = (0, import_react7.useState)({});
3505
3462
  const [columnPinning, setColumnPinning] = [
3506
3463
  typeof props.columnPinning === "object" && props.columnPinning.state ? props.columnPinning.state : internalColumnPinning,
3507
3464
  typeof props.columnPinning === "object" && props.columnPinning.onChange ? props.columnPinning.onChange : setInternalColumnPinning
3508
3465
  ];
3509
- const table = (0, import_react_table3.useReactTable)({
3466
+ const table = (0, import_react_table4.useReactTable)({
3510
3467
  columns: prependSelectColumn(columns, props.rowSelection),
3511
3468
  data,
3512
3469
  globalFilterFn: enableGlobalFilter(fuzzyFilter),
@@ -3533,10 +3490,10 @@ function DataTable(props) {
3533
3490
  enableSubRowSelection: ((_z = props.rowSelection) == null ? void 0 : _z.mode) !== "single",
3534
3491
  filterFromLeafRows: bannerConfig == null ? void 0 : bannerConfig.filterFromLeafRows,
3535
3492
  enablePinning: props.columnPinning !== void 0 && (typeof props.columnPinning === "boolean" ? props.columnPinning : props.columnPinning.enable),
3536
- getFilteredRowModel: enableGlobalFilter((0, import_react_table3.getFilteredRowModel)()),
3537
- getCoreRowModel: (0, import_react_table3.getCoreRowModel)(),
3538
- getExpandedRowModel: (0, import_react_table3.getExpandedRowModel)(),
3539
- getSortedRowModel: (0, import_react_table3.getSortedRowModel)(),
3493
+ getFilteredRowModel: enableGlobalFilter((0, import_react_table4.getFilteredRowModel)()),
3494
+ getCoreRowModel: (0, import_react_table4.getCoreRowModel)(),
3495
+ getExpandedRowModel: (0, import_react_table4.getExpandedRowModel)(),
3496
+ getSortedRowModel: (0, import_react_table4.getSortedRowModel)(),
3540
3497
  onExpandedChange: setExpandedState,
3541
3498
  onRowSelectionChange: setRowSelectionState,
3542
3499
  onColumnPinningChange: setColumnPinning,
@@ -3546,83 +3503,72 @@ function DataTable(props) {
3546
3503
  getSubRows: props == null ? void 0 : props.getSubRows,
3547
3504
  getRowId: props == null ? void 0 : props.getRowId
3548
3505
  });
3549
- (0, import_react9.useEffect)(() => {
3506
+ (0, import_react7.useEffect)(() => {
3550
3507
  var _a2;
3551
3508
  if ((_a2 = props.expansion) == null ? void 0 : _a2.expandAllByDefault) {
3552
3509
  table.toggleAllRowsExpanded();
3553
3510
  }
3554
3511
  }, [table, (_B = props.expansion) == null ? void 0 : _B.expandAllByDefault]);
3555
3512
  const { isLoading, rowConfig } = props;
3556
- const tableContainerRef = (0, import_react9.useRef)(null);
3513
+ const tableContainerRef = (0, import_react7.useRef)(null);
3557
3514
  const onTableContainerScroll = useFetchMoreOnBottomReached(
3558
3515
  tableContainerRef,
3559
3516
  props.infiniteScroll
3560
3517
  );
3561
3518
  const forceRerender = useForceRerender();
3562
- (0, import_react9.useEffect)(() => {
3519
+ (0, import_react7.useEffect)(() => {
3563
3520
  if (Boolean(tableContainerRef.current))
3564
3521
  forceRerender();
3565
3522
  }, [tableContainerRef.current === null]);
3566
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3567
- DataTableWrapper,
3568
- {
3569
- height: props == null ? void 0 : props.height,
3570
- width: props == null ? void 0 : props.width,
3571
- tableLayout: props == null ? void 0 : props.tableLayout,
3572
- disableYScroll: props.isLoading,
3573
- children: [
3574
- props.bannerConfig && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3575
- TableBanner,
3523
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DataTableWrapper, { height: props == null ? void 0 : props.height, width: props == null ? void 0 : props.width, tableLayout: props == null ? void 0 : props.tableLayout, children: [
3524
+ props.bannerConfig && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3525
+ TableBanner,
3526
+ {
3527
+ table,
3528
+ bannerConfig: props.bannerConfig,
3529
+ globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
3530
+ tableCaption: props.tableCaption
3531
+ }
3532
+ ),
3533
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3534
+ "div",
3535
+ __spreadProps(__spreadValues({}, props.tableContainerProps), {
3536
+ className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
3537
+ onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
3538
+ ref: (node) => {
3539
+ var _a2;
3540
+ if (node) {
3541
+ tableContainerRef.current = node;
3542
+ if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
3543
+ props.tableContainerProps.ref.current = node;
3544
+ }
3545
+ }
3546
+ },
3547
+ children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3548
+ VirtualTable,
3576
3549
  {
3550
+ containerRef: tableContainerRef,
3551
+ tableCaption: props.tableCaption,
3577
3552
  table,
3578
- bannerConfig: props.bannerConfig,
3579
- globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
3580
- tableCaption: props.tableCaption
3553
+ rowConfig,
3554
+ cellConfig,
3555
+ isLoading,
3556
+ stickyHeader: props.stickyHeader
3557
+ }
3558
+ ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3559
+ BasicTable,
3560
+ {
3561
+ tableCaption: props.tableCaption,
3562
+ table,
3563
+ rowConfig,
3564
+ cellConfig,
3565
+ isLoading,
3566
+ stickyHeader: props.stickyHeader
3581
3567
  }
3582
- ),
3583
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3584
- "div",
3585
- __spreadProps(__spreadValues({}, props.tableContainerProps), {
3586
- className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
3587
- onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
3588
- ref: (node) => {
3589
- var _a2;
3590
- if (node) {
3591
- tableContainerRef.current = node;
3592
- if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
3593
- props.tableContainerProps.ref.current = node;
3594
- }
3595
- }
3596
- },
3597
- children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3598
- VirtualTable,
3599
- {
3600
- containerRef: tableContainerRef,
3601
- tableCaption: props.tableCaption,
3602
- table,
3603
- rowConfig,
3604
- cellConfig,
3605
- isLoading,
3606
- stickyHeader: props.stickyHeader,
3607
- isFetchingNextPage: (_G = props.infiniteScroll) == null ? void 0 : _G.isFetchingNextPage
3608
- }
3609
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3610
- BasicTable,
3611
- {
3612
- tableCaption: props.tableCaption,
3613
- table,
3614
- rowConfig,
3615
- cellConfig,
3616
- isLoading,
3617
- stickyHeader: props.stickyHeader,
3618
- isFetchingNextPage: (_H = props.infiniteScroll) == null ? void 0 : _H.isFetchingNextPage
3619
- }
3620
- )
3621
- })
3622
3568
  )
3623
- ]
3624
- }
3625
- );
3569
+ })
3570
+ )
3571
+ ] });
3626
3572
  }
3627
3573
 
3628
3574
  // src/form-cells/EditableCheckboxCell.tsx
@@ -3714,7 +3660,7 @@ function EditableCheckboxCell(_a) {
3714
3660
 
3715
3661
  // src/form-cells/EditableDateCell.tsx
3716
3662
  var import_eds_core_react22 = require("@equinor/eds-core-react");
3717
- var import_react10 = require("react");
3663
+ var import_react8 = require("react");
3718
3664
  var import_react_hook_form3 = require("react-hook-form");
3719
3665
  var import_styled_components17 = __toESM(require("styled-components"));
3720
3666
 
@@ -3769,7 +3715,7 @@ function EditableDateCell(_a) {
3769
3715
  ]);
3770
3716
  const rawValue = context.getValue();
3771
3717
  const editMode = useEditMode();
3772
- const formattedValue = (0, import_react10.useMemo)(
3718
+ const formattedValue = (0, import_react8.useMemo)(
3773
3719
  () => {
3774
3720
  var _a2;
3775
3721
  return (_a2 = dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) != null ? _a2 : rawValue;
@@ -3989,7 +3935,7 @@ var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_r
3989
3935
  // src/form-cells/EditableTextAreaCell.tsx
3990
3936
  var import_eds_core_react26 = require("@equinor/eds-core-react");
3991
3937
  var import_eds_icons9 = require("@equinor/eds-icons");
3992
- var import_react11 = require("react");
3938
+ var import_react9 = require("react");
3993
3939
  var import_react_hook_form6 = require("react-hook-form");
3994
3940
  var import_styled_components19 = __toESM(require("styled-components"));
3995
3941
  var import_jsx_runtime27 = require("react/jsx-runtime");
@@ -4003,8 +3949,8 @@ function EditableTextAreaCell(_a) {
4003
3949
  "error",
4004
3950
  "onChange"
4005
3951
  ]);
4006
- const [textareaValue, setTextareaValue] = (0, import_react11.useState)(context.getValue());
4007
- const [open, setOpen] = (0, import_react11.useState)(false);
3952
+ const [textareaValue, setTextareaValue] = (0, import_react9.useState)(context.getValue());
3953
+ const [open, setOpen] = (0, import_react9.useState)(false);
4008
3954
  const editMode = useEditMode();
4009
3955
  const name = context.column.id;
4010
3956
  if (!editMode)
package/dist/index.mjs CHANGED
@@ -2674,9 +2674,9 @@ function HeaderContent({ header, table }) {
2674
2674
  return /* @__PURE__ */ jsxs3(HeaderDiv, { children: [
2675
2675
  flexRender2(header.column.columnDef.header, header.getContext()),
2676
2676
  (_a = {
2677
- asc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_up }),
2678
- desc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down }),
2679
- none: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down })
2677
+ asc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_up, style: { flexShrink: 0 } }),
2678
+ desc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down, style: { flexShrink: 0 } }),
2679
+ none: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down, style: { flexShrink: 0 } })
2680
2680
  }[header.column.getIsSorted()]) != null ? _a : null,
2681
2681
  table.options.enableColumnResizing && /* @__PURE__ */ jsx6(
2682
2682
  "div",
@@ -2906,6 +2906,7 @@ import { useRef as useRef2, useState as useState3 } from "react";
2906
2906
  import styled10 from "styled-components";
2907
2907
 
2908
2908
  // src/DataTable/utils.tsx
2909
+ import { createColumnHelper } from "@tanstack/react-table";
2909
2910
  function capitalizeHeader(context) {
2910
2911
  const header = context.header.id;
2911
2912
  return header.charAt(0).toUpperCase() + header.slice(1);
@@ -3031,51 +3032,28 @@ import {
3031
3032
  getSortedRowModel,
3032
3033
  useReactTable
3033
3034
  } from "@tanstack/react-table";
3034
- import { useEffect as useEffect3, useRef as useRef3, useState as useState8 } from "react";
3035
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState6 } from "react";
3035
3036
  import styled16 from "styled-components";
3036
3037
 
3037
3038
  // src/DataTable/components/BasicTable.tsx
3038
3039
  import { Table as EdsTable3 } from "@equinor/eds-core-react";
3039
3040
 
3040
3041
  // src/DataTable/components/PlaceholderRow.tsx
3041
- import { Table as Table4 } from "@equinor/eds-core-react";
3042
- import { useState as useState4 } from "react";
3042
+ import { DotProgress, Table as Table4, Typography as Typography2 } from "@equinor/eds-core-react";
3043
+ import styled11 from "styled-components";
3043
3044
  import { jsx as jsx13 } from "react/jsx-runtime";
3044
- function PlaceholderRow({ children }) {
3045
- const [width, setWidth] = useState4();
3046
- return /* @__PURE__ */ jsx13(
3047
- Table4.Row,
3048
- {
3049
- ref: (node) => {
3050
- var _a, _b, _c;
3051
- if (!node)
3052
- return;
3053
- setWidth((_c = (_b = (_a = node.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement) == null ? void 0 : _c.clientWidth);
3054
- },
3055
- style: { pointerEvents: "none" },
3056
- children: /* @__PURE__ */ jsx13(Table4.Cell, { colSpan: 100, style: { padding: 0 }, children: width && /* @__PURE__ */ jsx13(
3057
- "div",
3058
- {
3059
- style: {
3060
- width,
3061
- display: "flex",
3062
- justifyContent: "center",
3063
- position: "sticky",
3064
- left: 0,
3065
- height: "100%",
3066
- alignItems: "center"
3067
- },
3068
- children
3069
- }
3070
- ) })
3071
- }
3072
- );
3045
+ var PlaceholderTextWrapper = styled11.div`
3046
+ display: flex;
3047
+ justify-content: center;
3048
+ `;
3049
+ function PlaceholderRow({ isLoading }) {
3050
+ return /* @__PURE__ */ jsx13(Table4.Row, { children: /* @__PURE__ */ jsx13(Table4.Cell, { colSpan: 100, children: /* @__PURE__ */ jsx13(PlaceholderTextWrapper, { children: isLoading ? /* @__PURE__ */ jsx13(DotProgress, { color: "primary" }) : /* @__PURE__ */ jsx13(Typography2, { children: "No data available" }) }) }) });
3073
3051
  }
3074
3052
 
3075
3053
  // src/DataTable/components/TableBody.tsx
3076
3054
  import { Table as Table5 } from "@equinor/eds-core-react";
3077
- import styled11 from "styled-components";
3078
- var TableBody = styled11(Table5.Body)`
3055
+ import styled12 from "styled-components";
3056
+ var TableBody = styled12(Table5.Body)`
3079
3057
  // The following attribute are important for fixed column width
3080
3058
  // CHANGE THES WITH CAUTION
3081
3059
  background: inherit;
@@ -3083,7 +3061,7 @@ var TableBody = styled11(Table5.Body)`
3083
3061
 
3084
3062
  // src/DataTable/components/TableRow.tsx
3085
3063
  import { Table as Table6 } from "@equinor/eds-core-react";
3086
- import styled12 from "styled-components";
3064
+ import styled13 from "styled-components";
3087
3065
  import { jsx as jsx14 } from "react/jsx-runtime";
3088
3066
  function TableRow({
3089
3067
  row,
@@ -3126,7 +3104,7 @@ function TableRow({
3126
3104
  );
3127
3105
  return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
3128
3106
  }
3129
- var StyledTableRow = styled12(Table6.Row)`
3107
+ var StyledTableRow = styled13(Table6.Row)`
3130
3108
  /* Background color must be inherited here. Does not work with inline styling */
3131
3109
  ${({ active }) => active ? "" : "background-color: inherit;"}
3132
3110
  `;
@@ -3157,20 +3135,20 @@ function BasicTable({
3157
3135
  }
3158
3136
 
3159
3137
  // src/DataTable/components/DataTableHeader.tsx
3160
- import { Typography as Typography2 } from "@equinor/eds-core-react";
3138
+ import { Typography as Typography3 } from "@equinor/eds-core-react";
3161
3139
  import { search } from "@equinor/eds-icons";
3162
- import styled14 from "styled-components";
3140
+ import styled15 from "styled-components";
3163
3141
 
3164
3142
  // src/DataTable/filters/DebouncedInput.tsx
3165
3143
  import { Button as Button4, Icon as Icon6, Input, Tooltip as Tooltip2 } from "@equinor/eds-core-react";
3166
3144
  import { close as close2 } from "@equinor/eds-icons";
3167
- import { useEffect, useState as useState5 } from "react";
3168
- import styled13 from "styled-components";
3145
+ import { useEffect, useState as useState4 } from "react";
3146
+ import styled14 from "styled-components";
3169
3147
  import { jsx as jsx16 } from "react/jsx-runtime";
3170
- var Wrapper3 = styled13.div`
3148
+ var Wrapper3 = styled14.div`
3171
3149
  width: 200px;
3172
3150
  `;
3173
- var CloseButton = styled13(Button4)`
3151
+ var CloseButton = styled14(Button4)`
3174
3152
  width: 24px;
3175
3153
  height: 24px;
3176
3154
  `;
@@ -3186,7 +3164,7 @@ function DebouncedInput(_a) {
3186
3164
  "icon",
3187
3165
  "debounce"
3188
3166
  ]);
3189
- const [value, setValue] = useState5(initialValue);
3167
+ const [value, setValue] = useState4(initialValue);
3190
3168
  useEffect(() => {
3191
3169
  setValue(initialValue);
3192
3170
  }, [initialValue]);
@@ -3219,14 +3197,14 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
3219
3197
 
3220
3198
  // src/DataTable/components/DataTableHeader.tsx
3221
3199
  import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
3222
- var TableBannerWrapper = styled14.div`
3200
+ var TableBannerWrapper = styled15.div`
3223
3201
  display: flex;
3224
3202
  align-items: center;
3225
3203
  justify-content: space-between;
3226
3204
  gap: 0.5rem;
3227
3205
  padding: ${(props) => props.padding || "1rem"};
3228
3206
  `;
3229
- var FilterContainer = styled14.div`
3207
+ var FilterContainer = styled15.div`
3230
3208
  display: flex;
3231
3209
  align-items: center;
3232
3210
  gap: 1rem;
@@ -3241,7 +3219,7 @@ function TableBanner({
3241
3219
  var _a, _b, _c, _d, _e;
3242
3220
  return /* @__PURE__ */ jsxs9(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
3243
3221
  /* @__PURE__ */ jsxs9(FilterContainer, { className: "--filter-container-left", children: [
3244
- (bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx17(Typography2, { variant: "h3", as: "h2", children: tableCaption }),
3222
+ (bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx17(Typography3, { variant: "h3", as: "h2", children: tableCaption }),
3245
3223
  (_c = (_a = bannerConfig == null ? void 0 : bannerConfig.customActionsLeft) == null ? void 0 : _a.call(bannerConfig, table)) != null ? _c : (_b = bannerConfig == null ? void 0 : bannerConfig.customActions) == null ? void 0 : _b.call(bannerConfig, table)
3246
3224
  ] }),
3247
3225
  /* @__PURE__ */ jsx17(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ jsxs9(Fragment3, { children: [
@@ -3268,10 +3246,8 @@ function TableBanner({
3268
3246
  }
3269
3247
 
3270
3248
  // src/DataTable/components/VirtualTable.tsx
3271
- import { DotProgress, Table as Table8 } from "@equinor/eds-core-react";
3249
+ import { Table as Table8 } from "@equinor/eds-core-react";
3272
3250
  import { useVirtualizer } from "@tanstack/react-virtual";
3273
- import { useState as useState6 } from "react";
3274
- import styled15 from "styled-components";
3275
3251
 
3276
3252
  // src/DataTable/components/PaddingRow.tsx
3277
3253
  import { Table as Table7 } from "@equinor/eds-core-react";
@@ -3296,7 +3272,7 @@ function VirtualTable(_a) {
3296
3272
  "cellConfig",
3297
3273
  "containerRef"
3298
3274
  ]);
3299
- var _a2;
3275
+ var _a2, _b2;
3300
3276
  const { rows } = table.getRowModel();
3301
3277
  const rowVirtualizer = useVirtualizer({
3302
3278
  count: rows.length,
@@ -3307,13 +3283,13 @@ function VirtualTable(_a) {
3307
3283
  });
3308
3284
  const virtualRows = rowVirtualizer.getVirtualItems();
3309
3285
  const paddingTop = virtualRows.length > 0 ? ((_a2 = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a2.start) || 0 : 0;
3310
- const paddingBottom = true ? 0 : virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
3311
- return /* @__PURE__ */ jsxs10(Table8, { style: { position: "relative" }, children: [
3286
+ const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
3287
+ return /* @__PURE__ */ jsxs10(Table8, { children: [
3312
3288
  /* @__PURE__ */ jsx19(Table8.Caption, { hidden: true, children: props.tableCaption }),
3313
3289
  /* @__PURE__ */ jsx19(TableHeader, { sticky: props.stickyHeader, table }),
3314
- props.isLoading ? /* @__PURE__ */ jsx19(Table8.Body, { children: new Array(...new Array(30)).map((_, rowIndex) => /* @__PURE__ */ jsx19(Table8.Row, { children: table.getVisibleLeafColumns().map((column, columnIndex) => /* @__PURE__ */ jsx19(Table8.Cell, { children: /* @__PURE__ */ jsx19(TableCellSkeleton, { delay: (rowIndex + 1) / 20 + (columnIndex + 1) / 5 }) }, rowIndex + column.id)) }, rowIndex)) }) : /* @__PURE__ */ jsxs10(TableBody, { children: [
3290
+ /* @__PURE__ */ jsxs10(TableBody, { children: [
3315
3291
  /* @__PURE__ */ jsx19(PaddingRow, { height: paddingTop }),
3316
- rows.length && virtualRows.map((virtualRow) => {
3292
+ rows.length ? virtualRows.map((virtualRow) => {
3317
3293
  const row = rows[virtualRow.index];
3318
3294
  return /* @__PURE__ */ jsx19(
3319
3295
  TableRow,
@@ -3326,29 +3302,11 @@ function VirtualTable(_a) {
3326
3302
  },
3327
3303
  row.id
3328
3304
  );
3329
- }),
3330
- !rows.length && /* @__PURE__ */ jsx19(PlaceholderRow, { children: props.isLoading ? /* @__PURE__ */ jsx19(DotProgress, { color: "primary" }) : "No data available" }),
3331
- props.isFetchingNextPage && /* @__PURE__ */ jsx19(PlaceholderRow, { children: /* @__PURE__ */ jsx19(DotProgress, { color: "primary" }) }),
3305
+ }) : /* @__PURE__ */ jsx19(PlaceholderRow, { isLoading: props.isLoading }),
3332
3306
  /* @__PURE__ */ jsx19(PaddingRow, { height: paddingBottom })
3333
3307
  ] })
3334
3308
  ] });
3335
3309
  }
3336
- var TableCellSkeleton = styled15.div`
3337
- opacity: 0.5;
3338
- animation: 1s skeleton-loading ${({ delay }) => `${delay}s`} linear infinite alternate;
3339
- height: 1rem;
3340
- border-radius: 0.5rem;
3341
- background-color: #ccc;
3342
-
3343
- @keyframes skeleton-loading {
3344
- 0% {
3345
- background-color: #ccc;
3346
- }
3347
- 100% {
3348
- background-color: #eee;
3349
- }
3350
- }
3351
- `;
3352
3310
 
3353
3311
  // src/DataTable/hooks/useFetchMoreOnBottomReached.tsx
3354
3312
  import { useCallback, useEffect as useEffect2 } from "react";
@@ -3380,9 +3338,9 @@ function useFetchMoreOnBottomReached(tableContainerRef, infiniteScrollConfig) {
3380
3338
  }
3381
3339
 
3382
3340
  // src/DataTable/hooks/useForceRerender.ts
3383
- import { useCallback as useCallback2, useState as useState7 } from "react";
3341
+ import { useCallback as useCallback2, useState as useState5 } from "react";
3384
3342
  function useForceRerender() {
3385
- const [, setTick] = useState7(0);
3343
+ const [, setTick] = useState5(0);
3386
3344
  return useCallback2(() => setTick((tick) => tick + 1), []);
3387
3345
  }
3388
3346
 
@@ -3412,7 +3370,6 @@ var DataTableWrapper = styled16.div`
3412
3370
  }};
3413
3371
  width: '100%';
3414
3372
  overflow: auto;
3415
- ${(props) => props.disableYScroll ? "overflow-y: hidden;" : ""}
3416
3373
  ${(props) => canUseContainStrict(props.height) ? "contain: strict;" : ""}
3417
3374
 
3418
3375
  table {
@@ -3428,14 +3385,14 @@ var DataTableWrapper = styled16.div`
3428
3385
  }
3429
3386
  `;
3430
3387
  function DataTable(props) {
3431
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H;
3388
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
3432
3389
  const { columns, data, bannerConfig, cellConfig, sorting } = props;
3433
- const [internalColumnVisibility, setInternalColumnVisibility] = useState8({});
3390
+ const [internalColumnVisibility, setInternalColumnVisibility] = useState6({});
3434
3391
  const [columnVisibility, setColumnVisibility] = [
3435
3392
  (_b = (_a = props.columnVisibility) == null ? void 0 : _a.state) != null ? _b : internalColumnVisibility,
3436
3393
  (_d = (_c = props.columnVisibility) == null ? void 0 : _c.onChange) != null ? _d : setInternalColumnVisibility
3437
3394
  ];
3438
- const [internalGlobalFilterState, setInternalGlobalFilterState] = useState8("");
3395
+ const [internalGlobalFilterState, setInternalGlobalFilterState] = useState6("");
3439
3396
  const [globalFilterState, setGlobalFilterState] = [
3440
3397
  (_f = (_e = props.globalFilter) == null ? void 0 : _e.state) != null ? _f : internalGlobalFilterState,
3441
3398
  (_h = (_g = props.globalFilter) == null ? void 0 : _g.onChange) != null ? _h : setInternalGlobalFilterState
@@ -3444,22 +3401,22 @@ function DataTable(props) {
3444
3401
  function enableGlobalFilter(value) {
3445
3402
  return enableOrUndefined(shouldEnableGlobalFilter, value);
3446
3403
  }
3447
- const [internalSortingState, setInternalSortingState] = useState8([]);
3404
+ const [internalSortingState, setInternalSortingState] = useState6([]);
3448
3405
  const [sortingState, setSortingState] = [
3449
3406
  (_k = (_j = props.sorting) == null ? void 0 : _j.state) != null ? _k : internalSortingState,
3450
3407
  (_m = (_l = props.sorting) == null ? void 0 : _l.onChange) != null ? _m : setInternalSortingState
3451
3408
  ];
3452
- const [internalRowSelectionState, setInternalRowSelectionState] = useState8({});
3409
+ const [internalRowSelectionState, setInternalRowSelectionState] = useState6({});
3453
3410
  const [rowSelectionState, setRowSelectionState] = [
3454
3411
  (_o = (_n = props.rowSelection) == null ? void 0 : _n.state) != null ? _o : internalRowSelectionState,
3455
3412
  (_q = (_p = props.rowSelection) == null ? void 0 : _p.onChange) != null ? _q : setInternalRowSelectionState
3456
3413
  ];
3457
- const [internalExpandedState, setInternalExpandedState] = useState8({});
3414
+ const [internalExpandedState, setInternalExpandedState] = useState6({});
3458
3415
  const [expandedState, setExpandedState] = [
3459
3416
  (_s = (_r = props.expansion) == null ? void 0 : _r.state) != null ? _s : internalExpandedState,
3460
3417
  (_u = (_t = props.expansion) == null ? void 0 : _t.onChange) != null ? _u : setInternalExpandedState
3461
3418
  ];
3462
- const [internalColumnPinning, setInternalColumnPinning] = useState8({});
3419
+ const [internalColumnPinning, setInternalColumnPinning] = useState6({});
3463
3420
  const [columnPinning, setColumnPinning] = [
3464
3421
  typeof props.columnPinning === "object" && props.columnPinning.state ? props.columnPinning.state : internalColumnPinning,
3465
3422
  typeof props.columnPinning === "object" && props.columnPinning.onChange ? props.columnPinning.onChange : setInternalColumnPinning
@@ -3521,66 +3478,55 @@ function DataTable(props) {
3521
3478
  if (Boolean(tableContainerRef.current))
3522
3479
  forceRerender();
3523
3480
  }, [tableContainerRef.current === null]);
3524
- return /* @__PURE__ */ jsxs11(
3525
- DataTableWrapper,
3526
- {
3527
- height: props == null ? void 0 : props.height,
3528
- width: props == null ? void 0 : props.width,
3529
- tableLayout: props == null ? void 0 : props.tableLayout,
3530
- disableYScroll: props.isLoading,
3531
- children: [
3532
- props.bannerConfig && /* @__PURE__ */ jsx20(
3533
- TableBanner,
3481
+ return /* @__PURE__ */ jsxs11(DataTableWrapper, { height: props == null ? void 0 : props.height, width: props == null ? void 0 : props.width, tableLayout: props == null ? void 0 : props.tableLayout, children: [
3482
+ props.bannerConfig && /* @__PURE__ */ jsx20(
3483
+ TableBanner,
3484
+ {
3485
+ table,
3486
+ bannerConfig: props.bannerConfig,
3487
+ globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
3488
+ tableCaption: props.tableCaption
3489
+ }
3490
+ ),
3491
+ /* @__PURE__ */ jsx20(
3492
+ "div",
3493
+ __spreadProps(__spreadValues({}, props.tableContainerProps), {
3494
+ className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
3495
+ onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
3496
+ ref: (node) => {
3497
+ var _a2;
3498
+ if (node) {
3499
+ tableContainerRef.current = node;
3500
+ if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
3501
+ props.tableContainerProps.ref.current = node;
3502
+ }
3503
+ }
3504
+ },
3505
+ children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ jsx20(
3506
+ VirtualTable,
3534
3507
  {
3508
+ containerRef: tableContainerRef,
3509
+ tableCaption: props.tableCaption,
3535
3510
  table,
3536
- bannerConfig: props.bannerConfig,
3537
- globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
3538
- tableCaption: props.tableCaption
3511
+ rowConfig,
3512
+ cellConfig,
3513
+ isLoading,
3514
+ stickyHeader: props.stickyHeader
3515
+ }
3516
+ ) : /* @__PURE__ */ jsx20(
3517
+ BasicTable,
3518
+ {
3519
+ tableCaption: props.tableCaption,
3520
+ table,
3521
+ rowConfig,
3522
+ cellConfig,
3523
+ isLoading,
3524
+ stickyHeader: props.stickyHeader
3539
3525
  }
3540
- ),
3541
- /* @__PURE__ */ jsx20(
3542
- "div",
3543
- __spreadProps(__spreadValues({}, props.tableContainerProps), {
3544
- className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
3545
- onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
3546
- ref: (node) => {
3547
- var _a2;
3548
- if (node) {
3549
- tableContainerRef.current = node;
3550
- if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
3551
- props.tableContainerProps.ref.current = node;
3552
- }
3553
- }
3554
- },
3555
- children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ jsx20(
3556
- VirtualTable,
3557
- {
3558
- containerRef: tableContainerRef,
3559
- tableCaption: props.tableCaption,
3560
- table,
3561
- rowConfig,
3562
- cellConfig,
3563
- isLoading,
3564
- stickyHeader: props.stickyHeader,
3565
- isFetchingNextPage: (_G = props.infiniteScroll) == null ? void 0 : _G.isFetchingNextPage
3566
- }
3567
- ) : /* @__PURE__ */ jsx20(
3568
- BasicTable,
3569
- {
3570
- tableCaption: props.tableCaption,
3571
- table,
3572
- rowConfig,
3573
- cellConfig,
3574
- isLoading,
3575
- stickyHeader: props.stickyHeader,
3576
- isFetchingNextPage: (_H = props.infiniteScroll) == null ? void 0 : _H.isFetchingNextPage
3577
- }
3578
- )
3579
- })
3580
3526
  )
3581
- ]
3582
- }
3583
- );
3527
+ })
3528
+ )
3529
+ ] });
3584
3530
  }
3585
3531
 
3586
3532
  // src/form-cells/EditableCheckboxCell.tsx
@@ -3794,7 +3740,7 @@ import { Autocomplete } from "@equinor/eds-core-react";
3794
3740
  import { Controller as Controller3 } from "react-hook-form";
3795
3741
 
3796
3742
  // src/form-cells/FormHelperText.tsx
3797
- import { Typography as Typography3 } from "@equinor/eds-core-react";
3743
+ import { Typography as Typography4 } from "@equinor/eds-core-react";
3798
3744
  import { tokens as tokens7 } from "@equinor/eds-tokens";
3799
3745
  import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
3800
3746
  var colors = {
@@ -3815,7 +3761,7 @@ function HelperText({ helperText, variant, helperIcon }) {
3815
3761
  children: [
3816
3762
  /* @__PURE__ */ jsx24("span", { style: { flexShrink: 0 }, children: helperIcon }),
3817
3763
  /* @__PURE__ */ jsx24(
3818
- Typography3,
3764
+ Typography4,
3819
3765
  {
3820
3766
  style: {
3821
3767
  fontSize: "0.75rem",
@@ -3947,7 +3893,7 @@ var InlineTextField2 = styled18(TextField2)`
3947
3893
  // src/form-cells/EditableTextAreaCell.tsx
3948
3894
  import { Button as Button5, Dialog as EDS, Icon as Icon8, TextField as TextField3 } from "@equinor/eds-core-react";
3949
3895
  import { arrow_up } from "@equinor/eds-icons";
3950
- import { useState as useState9 } from "react";
3896
+ import { useState as useState7 } from "react";
3951
3897
  import { Controller as Controller5 } from "react-hook-form";
3952
3898
  import styled19 from "styled-components";
3953
3899
  import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
@@ -3961,8 +3907,8 @@ function EditableTextAreaCell(_a) {
3961
3907
  "error",
3962
3908
  "onChange"
3963
3909
  ]);
3964
- const [textareaValue, setTextareaValue] = useState9(context.getValue());
3965
- const [open, setOpen] = useState9(false);
3910
+ const [textareaValue, setTextareaValue] = useState7(context.getValue());
3911
+ const [open, setOpen] = useState7(false);
3966
3912
  const editMode = useEditMode();
3967
3913
  const name = context.column.id;
3968
3914
  if (!editMode)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/apollo-components",
3
- "version": "3.4.0-skeleton.1",
3
+ "version": "3.5.1-beta.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -20,7 +20,7 @@
20
20
  "@equinor/eds-icons": "^0.19.1",
21
21
  "@equinor/eds-tokens": "^0.9.1",
22
22
  "@tanstack/match-sorter-utils": "^8.8.4",
23
- "@tanstack/react-table": "^8.9.1",
23
+ "@tanstack/react-table": "^8.9.8",
24
24
  "@tanstack/react-virtual": "^3.0.0-beta.54",
25
25
  "tsup": "^6.7.0",
26
26
  "type-fest": "^3.11.0"
@@ -46,7 +46,7 @@
46
46
  "eslint-config-custom": "*",
47
47
  "storybook": "^7.0.0-alpha.38",
48
48
  "tsconfig": "*",
49
- "typescript": "^4.5.2"
49
+ "typescript": "^5.2.2"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"