@equinor/apollo-components 4.0.1 → 4.0.3

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.js CHANGED
@@ -1,39 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
8
  var __export = (target, all) => {
38
9
  for (var name in all)
39
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -126,8 +97,8 @@ var Wrapper = import_styled_components.default.div`
126
97
  `;
127
98
  var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrapper, { children: [
128
99
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.TopBar, { sticky: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_eds_core_react.TopBar.Header, { children: [
129
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.Icon, { data: icon != null ? icon : import_eds_icons.apps }),
130
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title != null ? title : "App Title" })
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.Icon, { data: icon ?? import_eds_icons.apps }),
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title ?? "App Title" })
131
102
  ] }) }),
132
103
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "--content-wrapper", children: [
133
104
  sidebar,
@@ -244,15 +215,11 @@ var Chip = import_styled_components3.default.div`
244
215
  line-height: 22px;
245
216
  height: 22px;
246
217
  padding: 0 6px;
247
- background-color: ${(props) => {
248
- var _a;
249
- return (_a = props.backgroundColor) != null ? _a : import_eds_tokens2.tokens.colors.ui.background__medium.hex;
250
- }};
218
+ background-color: ${(props) => props.backgroundColor ?? import_eds_tokens2.tokens.colors.ui.background__medium.hex};
251
219
  color: darkslategrey;
252
220
  `;
253
221
  var ChipsCell = (props) => {
254
- var _a;
255
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChipsWrapper, { children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Chip, { backgroundColor: stringToHslColor(value), children: value }, value)) });
222
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChipsWrapper, { children: props.values?.map((value) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Chip, { backgroundColor: stringToHslColor(value), children: value }, value)) });
256
223
  };
257
224
 
258
225
  // src/cells/DynamicCell.tsx
@@ -296,35 +263,35 @@ var StyledCell = (0, import_styled_components5.default)(import_eds_core_react5.T
296
263
  background-color: ${({ backgroundColor }) => backgroundColor ? `${backgroundColor} !important` : `inherit`};
297
264
  `;
298
265
  function DynamicCell({ cell, cellConfig }) {
299
- var _a, _b, _c, _d, _e;
300
266
  const cellContent = (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
301
267
  const columnPinningDirection = cell.column.getIsPinned();
302
- const stickyCellColor = (_a = cellConfig == null ? void 0 : cellConfig.getStickyCellColor) == null ? void 0 : _a.call(cellConfig, cell);
303
- const regularCellColor = (_d = (_b = cellConfig == null ? void 0 : cellConfig.getCellColor) == null ? void 0 : _b.call(cellConfig, cell)) != null ? _d : ((_c = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _c.call(cellConfig, cell)) ? "#d5eaf4" : void 0;
268
+ const stickyCellColor = cellConfig?.getStickyCellColor?.(cell);
269
+ const regularCellColor = cellConfig?.getCellColor?.(cell) ?? (cellConfig?.getShouldHighlight?.(cell) ? "#d5eaf4" : void 0);
304
270
  if (columnPinningDirection) {
305
271
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
306
272
  import_eds_core_react5.Table.Cell,
307
273
  {
308
274
  "data-column": cell.column.id,
309
- style: __spreadValues({
275
+ style: {
310
276
  position: "sticky",
311
277
  top: 0,
312
- backgroundColor: stickyCellColor != null ? stickyCellColor : "inherit",
278
+ backgroundColor: stickyCellColor ?? "inherit",
313
279
  zIndex: 5,
314
280
  backgroundClip: "padding-box",
315
- display: "table-cell"
316
- }, columnPinningDirection === "left" ? {
317
- left: `${cell.column.getStart("left")}px`,
318
- borderRight: getIsLastLeftPinnedColumn(cell.getContext().table, cell.column) ? `1px solid ${import_eds_tokens3.tokens.colors.ui.background__medium.hex}` : void 0
319
- } : {
320
- right: `${getTotalRight(cell.getContext().table, cell.column)}px`,
321
- borderLeft: getIsFirstRightPinnedColumn(cell.column) ? `1px solid ${import_eds_tokens3.tokens.colors.ui.background__medium.hex}` : void 0
322
- }),
281
+ display: "table-cell",
282
+ ...columnPinningDirection === "left" ? {
283
+ left: `${cell.column.getStart("left")}px`,
284
+ borderRight: getIsLastLeftPinnedColumn(cell.getContext().table, cell.column) ? `1px solid ${import_eds_tokens3.tokens.colors.ui.background__medium.hex}` : void 0
285
+ } : {
286
+ right: `${getTotalRight(cell.getContext().table, cell.column)}px`,
287
+ borderLeft: getIsFirstRightPinnedColumn(cell.column) ? `1px solid ${import_eds_tokens3.tokens.colors.ui.background__medium.hex}` : void 0
288
+ }
289
+ },
323
290
  children: cellContent
324
291
  }
325
292
  );
326
293
  }
327
- if ((_e = cell.column.columnDef.meta) == null ? void 0 : _e.sticky) {
294
+ if (cell.column.columnDef.meta?.sticky) {
328
295
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledStickyCell, { backgroundColor: stickyCellColor, "data-column": cell.column.id, children: cellContent });
329
296
  }
330
297
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledCell, { "data-column": cell.column.id, backgroundColor: regularCellColor, children: cellContent });
@@ -367,7 +334,6 @@ var Cell2 = (0, import_styled_components6.default)(import_eds_core_react6.Table.
367
334
  ${resizeCellStyle}
368
335
  `;
369
336
  var HeaderCell = ({ header, table }) => {
370
- var _a;
371
337
  const style = {
372
338
  width: header.column.getSize(),
373
339
  zIndex: 10
@@ -382,28 +348,31 @@ var HeaderCell = ({ header, table }) => {
382
348
  if (columnPinningDirection) {
383
349
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
384
350
  import_eds_core_react6.Table.Cell,
385
- __spreadProps(__spreadValues({}, cellProps), {
386
- style: __spreadValues(__spreadProps(__spreadValues({}, cellProps.style), {
351
+ {
352
+ ...cellProps,
353
+ style: {
354
+ ...cellProps.style,
387
355
  position: "sticky",
388
356
  top: 0,
389
357
  zIndex: 11,
390
358
  backgroundClip: "padding-box",
391
- display: "table-cell"
392
- }), columnPinningDirection === "left" ? {
393
- left: `${header.column.getStart("left")}px`,
394
- borderRight: getIsLastLeftPinnedColumn(table, header.column) ? `1px solid ${import_eds_tokens4.tokens.colors.ui.background__medium.hex}` : void 0
395
- } : {
396
- right: `${getTotalRight(table, header.column)}px`,
397
- borderLeft: getIsFirstRightPinnedColumn(header.column) ? `1px solid ${import_eds_tokens4.tokens.colors.ui.background__medium.hex}` : void 0
398
- }),
359
+ display: "table-cell",
360
+ ...columnPinningDirection === "left" ? {
361
+ left: `${header.column.getStart("left")}px`,
362
+ borderRight: getIsLastLeftPinnedColumn(table, header.column) ? `1px solid ${import_eds_tokens4.tokens.colors.ui.background__medium.hex}` : void 0
363
+ } : {
364
+ right: `${getTotalRight(table, header.column)}px`,
365
+ borderLeft: getIsFirstRightPinnedColumn(header.column) ? `1px solid ${import_eds_tokens4.tokens.colors.ui.background__medium.hex}` : void 0
366
+ }
367
+ },
399
368
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderContent, { header, table })
400
- })
369
+ }
401
370
  );
402
371
  }
403
- if ((_a = header.column.columnDef.meta) == null ? void 0 : _a.sticky) {
404
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StickyCell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderContent, { header, table }) }), header.id);
372
+ if (header.column.columnDef.meta?.sticky) {
373
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StickyCell2, { ...cellProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderContent, { header, table }) }, header.id);
405
374
  }
406
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Cell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderContent, { header, table }) }), header.id);
375
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Cell2, { ...cellProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderContent, { header, table }) }, header.id);
407
376
  };
408
377
  var HeaderDiv = import_styled_components6.default.div`
409
378
  display: flex;
@@ -412,15 +381,14 @@ var HeaderDiv = import_styled_components6.default.div`
412
381
  z-index: 5;
413
382
  `;
414
383
  function HeaderContent({ header, table }) {
415
- var _a;
416
384
  if (header.isPlaceholder) return null;
417
385
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(HeaderDiv, { children: [
418
386
  (0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
419
- (_a = {
387
+ {
420
388
  asc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_up, style: { flexShrink: 0 } }),
421
389
  desc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down, style: { flexShrink: 0 } }),
422
390
  none: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down, style: { flexShrink: 0 } })
423
- }[header.column.getIsSorted()]) != null ? _a : null,
391
+ }[header.column.getIsSorted()] ?? null,
424
392
  table.options.enableColumnResizing && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
425
393
  "div",
426
394
  {
@@ -462,22 +430,30 @@ var truncateStyle = {
462
430
  textOverflow: "ellipsis"
463
431
  };
464
432
  var TypographyCustom = (props) => {
465
- const _a = props, { truncate, enableShowAllOnHover, style: styleFromProps } = _a, edsTypographyProps = __objRest(_a, ["truncate", "enableShowAllOnHover", "style"]);
433
+ const { truncate, enableShowAllOnHover, style: styleFromProps, ...edsTypographyProps } = props;
466
434
  if (enableShowAllOnHover)
467
435
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HoverCapture, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
468
436
  import_eds_core_react7.Typography,
469
- __spreadProps(__spreadValues({}, edsTypographyProps), {
470
- style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
471
- })
437
+ {
438
+ ...edsTypographyProps,
439
+ style: {
440
+ ...styleFromProps,
441
+ ...truncateStyle
442
+ }
443
+ }
472
444
  ) });
473
445
  if (truncate)
474
446
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
475
447
  import_eds_core_react7.Typography,
476
- __spreadProps(__spreadValues({}, edsTypographyProps), {
477
- style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
478
- })
448
+ {
449
+ ...edsTypographyProps,
450
+ style: {
451
+ ...styleFromProps,
452
+ ...truncateStyle
453
+ }
454
+ }
479
455
  );
480
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react7.Typography, __spreadProps(__spreadValues({}, edsTypographyProps), { style: styleFromProps }));
456
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react7.Typography, { ...edsTypographyProps, style: styleFromProps });
481
457
  };
482
458
  var HoverCapture = import_styled_components7.default.div`
483
459
  height: ${import_eds_tokens5.tokens.typography.table.cell_text.lineHeight};
@@ -532,15 +508,14 @@ var CellWrapper = (0, import_styled_components8.default)(TypographyCustom)`
532
508
  `}
533
509
  `;
534
510
  function HierarchyCell(cell, options = {}) {
535
- var _a, _b, _c, _d;
536
511
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
537
512
  CellWrapper,
538
513
  {
539
- depth: (_b = (_a = options.getRowDepth) == null ? void 0 : _a.call(options)) != null ? _b : cell.row.depth,
514
+ depth: options.getRowDepth?.() ?? cell.row.depth,
540
515
  expanded: cell.row.getIsExpanded(),
541
516
  children: [
542
517
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "--divider" }),
543
- (_d = (_c = options.getDisplayName) == null ? void 0 : _c.call(options)) != null ? _d : cell.getValue()
518
+ options.getDisplayName?.() ?? cell.getValue()
544
519
  ]
545
520
  }
546
521
  );
@@ -551,7 +526,6 @@ var import_eds_core_react8 = require("@equinor/eds-core-react");
551
526
  var import_react2 = require("react");
552
527
  var import_jsx_runtime9 = require("react/jsx-runtime");
553
528
  function PopoverCell(props) {
554
- var _a, _b;
555
529
  const [open, setOpen] = (0, import_react2.useState)(false);
556
530
  const anchorRef = (0, import_react2.useRef)(null);
557
531
  const handleClick = () => setOpen(!open);
@@ -563,7 +537,7 @@ function PopoverCell(props) {
563
537
  onClick: stopPropagation(handleClick),
564
538
  style: { cursor: "pointer" },
565
539
  truncate: true,
566
- children: String((_a = props.value) != null ? _a : "")
540
+ children: String(props.value ?? "")
567
541
  }
568
542
  ),
569
543
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
@@ -577,7 +551,7 @@ function PopoverCell(props) {
577
551
  placement: "bottom",
578
552
  children: [
579
553
  props.title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Popover.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Popover.Header, { children: props.title }) }),
580
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Typography, { children: String((_b = props.value) != null ? _b : "") }) })
554
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Typography, { children: String(props.value ?? "") }) })
581
555
  ]
582
556
  }
583
557
  )
@@ -667,11 +641,11 @@ function getColumnHeader(column) {
667
641
  }
668
642
  function prependSelectColumnIfEnabled(columns, config) {
669
643
  if (!config) return columns;
670
- if (!(config == null ? void 0 : config.mode)) return columns;
644
+ if (!config?.mode) return columns;
671
645
  return prependSelectColumn(columns, config);
672
646
  }
673
647
  function prependSelectColumn(columns, config) {
674
- if (!(config == null ? void 0 : config.selectColumn)) return columns;
648
+ if (!config?.selectColumn) return columns;
675
649
  if (config.selectColumn === "default") return [SelectColumnDef(config), ...columns];
676
650
  return [config.selectColumn(), ...columns];
677
651
  }
@@ -821,9 +795,8 @@ function TableRow({
821
795
  measureElement,
822
796
  index
823
797
  }) {
824
- var _a, _b;
825
- const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
826
- const dataIdValue = (_a = rowConfig == null ? void 0 : rowConfig.getDataIdAttribute) == null ? void 0 : _a.call(rowConfig, row);
798
+ const rowWrapper = rowConfig?.rowWrapper;
799
+ const dataIdValue = rowConfig?.getDataIdAttribute?.(row);
827
800
  const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
828
801
  StyledTableRow,
829
802
  {
@@ -832,15 +805,12 @@ function TableRow({
832
805
  "data-id": dataIdValue,
833
806
  ref: measureElement,
834
807
  style: {
835
- cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
836
- backgroundColor: (_b = rowConfig == null ? void 0 : rowConfig.getRowBackground) == null ? void 0 : _b.call(rowConfig, row)
837
- },
838
- onClick: () => {
839
- var _a2;
840
- return (_a2 = rowConfig == null ? void 0 : rowConfig.onClick) == null ? void 0 : _a2.call(rowConfig, row);
808
+ cursor: rowConfig?.onClick ? "pointer" : "initial",
809
+ backgroundColor: rowConfig?.getRowBackground?.(row)
841
810
  },
842
- onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
843
- onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
811
+ onClick: () => rowConfig?.onClick?.(row),
812
+ onMouseEnter: handleRowEvent(row, rowConfig?.onMouseEnter),
813
+ onMouseLeave: handleRowEvent(row, rowConfig?.onMouseLeave),
844
814
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DynamicCell, { cell, cellConfig }, cell.id))
845
815
  }
846
816
  );
@@ -893,18 +863,13 @@ var CloseButton = (0, import_styled_components14.default)(import_eds_core_react1
893
863
  width: 24px;
894
864
  height: 24px;
895
865
  `;
896
- function DebouncedInput(_a) {
897
- var _b = _a, {
898
- value: initialValue,
899
- onChange,
900
- icon,
901
- debounce = 500
902
- } = _b, props = __objRest(_b, [
903
- "value",
904
- "onChange",
905
- "icon",
906
- "debounce"
907
- ]);
866
+ function DebouncedInput({
867
+ value: initialValue,
868
+ onChange,
869
+ icon,
870
+ debounce = 500,
871
+ ...props
872
+ }) {
908
873
  const [value, setValue] = (0, import_react4.useState)(initialValue);
909
874
  (0, import_react4.useEffect)(() => {
910
875
  setValue(initialValue);
@@ -917,12 +882,13 @@ function DebouncedInput(_a) {
917
882
  }, [value]);
918
883
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Wrapper3, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
919
884
  import_eds_core_react16.Input,
920
- __spreadProps(__spreadValues({}, props), {
885
+ {
886
+ ...props,
921
887
  value,
922
888
  leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Icon, { name: icon.name, data: icon, size: 18 }),
923
889
  rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Tooltip, { title: "Clear input", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CloseButton, { variant: "ghost_icon", onClick: () => setValue(""), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Icon, { name: import_eds_icons6.close.name, data: import_eds_icons6.close, size: 18 }) }) }),
924
890
  onChange: (event) => setValue(event.target.value)
925
- })
891
+ }
926
892
  ) });
927
893
  }
928
894
 
@@ -957,25 +923,30 @@ function TableBanner({
957
923
  tableCaption,
958
924
  globalFilter
959
925
  }) {
960
- var _a, _b, _c, _d, _e;
961
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
926
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig?.padding, children: [
962
927
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(FilterContainer, { className: "--filter-container-left", children: [
963
- (bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_eds_core_react17.Typography, { variant: "h3", as: "h2", children: tableCaption }),
964
- (_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)
928
+ bannerConfig?.enableTableCaption && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_eds_core_react17.Typography, { variant: "h3", as: "h2", children: tableCaption }),
929
+ bannerConfig?.customActionsLeft?.(table) ?? bannerConfig?.customActions?.(table)
965
930
  ] }),
966
931
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
967
- (_d = bannerConfig == null ? void 0 : bannerConfig.customActionsRight) == null ? void 0 : _d.call(bannerConfig, table),
968
- (bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
932
+ bannerConfig?.customActionsRight?.(table),
933
+ bannerConfig?.enableGlobalFilterInput && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
969
934
  DebouncedInput,
970
935
  {
971
936
  value: globalFilter.state,
972
937
  icon: import_eds_icons7.search,
973
- placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
938
+ placeholder: bannerConfig.globalFilterPlaceholder ?? "Search all columns",
974
939
  onChange: (value) => globalFilter.onChange(String(value))
975
940
  }
976
941
  ),
977
- (bannerConfig == null ? void 0 : bannerConfig.enableColumnSelect) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColumnSelect, { table, columnSelectPlaceholder: bannerConfig.columnSelectPlaceholder }),
978
- (bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
942
+ bannerConfig?.enableColumnSelect && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
943
+ ColumnSelect,
944
+ {
945
+ table,
946
+ columnSelectPlaceholder: bannerConfig.columnSelectPlaceholder
947
+ }
948
+ ),
949
+ bannerConfig?.totalRowCount && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
979
950
  table.options.data.length.toLocaleString(),
980
951
  " /",
981
952
  " ",
@@ -1000,30 +971,24 @@ var PaddingRow = (props) => {
1000
971
 
1001
972
  // src/DataTable/components/VirtualTable.tsx
1002
973
  var import_jsx_runtime19 = require("react/jsx-runtime");
1003
- function VirtualTable(_a) {
1004
- var _b = _a, {
1005
- table,
1006
- rowConfig,
1007
- cellConfig,
1008
- containerRef
1009
- } = _b, props = __objRest(_b, [
1010
- "table",
1011
- "rowConfig",
1012
- "cellConfig",
1013
- "containerRef"
1014
- ]);
1015
- var _a2, _b2;
974
+ function VirtualTable({
975
+ table,
976
+ rowConfig,
977
+ cellConfig,
978
+ containerRef,
979
+ ...props
980
+ }) {
1016
981
  const { rows } = table.getRowModel();
1017
982
  const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
1018
983
  count: rows.length,
1019
984
  estimateSize: () => 48,
1020
985
  getScrollElement: () => containerRef.current,
1021
- measureElement: (element) => element == null ? void 0 : element.getBoundingClientRect().height,
986
+ measureElement: (element) => element?.getBoundingClientRect().height,
1022
987
  overscan: 20
1023
988
  });
1024
989
  const virtualRows = rowVirtualizer.getVirtualItems();
1025
- const paddingTop = virtualRows.length > 0 ? ((_a2 = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a2.start) || 0 : 0;
1026
- const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
990
+ const paddingTop = virtualRows.length > 0 ? virtualRows?.[0]?.start || 0 : 0;
991
+ const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (virtualRows?.[virtualRows.length - 1]?.end || 0) : 0;
1027
992
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_eds_core_react19.Table, { children: [
1028
993
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.Table.Caption, { hidden: true, children: props.tableCaption }),
1029
994
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableHeader, { sticky: props.stickyHeader, table }),
@@ -1092,16 +1057,10 @@ function canUseContainStrict(height) {
1092
1057
  return true;
1093
1058
  }
1094
1059
  var DataTableWrapper = import_styled_components16.default.div`
1095
- width: ${(props) => {
1096
- var _a;
1097
- return (_a = props.width) != null ? _a : "100%";
1098
- }};
1060
+ width: ${(props) => props.width ?? "100%"};
1099
1061
 
1100
1062
  .--table-container {
1101
- height: ${(props) => {
1102
- var _a;
1103
- return (_a = props.height) != null ? _a : "100%";
1104
- }};
1063
+ height: ${(props) => props.height ?? "100%"};
1105
1064
  width: '100%';
1106
1065
  overflow: auto;
1107
1066
  ${(props) => canUseContainStrict(props.height) ? "contain: strict;" : ""}
@@ -1111,44 +1070,40 @@ var DataTableWrapper = import_styled_components16.default.div`
1111
1070
 
1112
1071
  // The following attribute is important for fixed column width
1113
1072
  // CHANGE THIS WITH CAUTION
1114
- table-layout: ${(props) => {
1115
- var _a;
1116
- return (_a = props.tableLayout) != null ? _a : "auto";
1117
- }};
1073
+ table-layout: ${(props) => props.tableLayout ?? "auto"};
1118
1074
  }
1119
1075
  }
1120
1076
  `;
1121
1077
  function DataTable(props) {
1122
- 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;
1123
1078
  const { columns, data, bannerConfig, cellConfig, sorting } = props;
1124
1079
  const [internalColumnVisibility, setInternalColumnVisibility] = (0, import_react7.useState)({});
1125
1080
  const [columnVisibility, setColumnVisibility] = [
1126
- (_b = (_a = props.columnVisibility) == null ? void 0 : _a.state) != null ? _b : internalColumnVisibility,
1127
- (_d = (_c = props.columnVisibility) == null ? void 0 : _c.onChange) != null ? _d : setInternalColumnVisibility
1081
+ props.columnVisibility?.state ?? internalColumnVisibility,
1082
+ props.columnVisibility?.onChange ?? setInternalColumnVisibility
1128
1083
  ];
1129
1084
  const [internalGlobalFilterState, setInternalGlobalFilterState] = (0, import_react7.useState)("");
1130
1085
  const [globalFilterState, setGlobalFilterState] = [
1131
- (_f = (_e = props.globalFilter) == null ? void 0 : _e.state) != null ? _f : internalGlobalFilterState,
1132
- (_h = (_g = props.globalFilter) == null ? void 0 : _g.onChange) != null ? _h : setInternalGlobalFilterState
1086
+ props.globalFilter?.state ?? internalGlobalFilterState,
1087
+ props.globalFilter?.onChange ?? setInternalGlobalFilterState
1133
1088
  ];
1134
- const shouldEnableGlobalFilter = ((_i = props.bannerConfig) == null ? void 0 : _i.enableGlobalFilterInput) || Boolean(props.globalFilter);
1089
+ const shouldEnableGlobalFilter = props.bannerConfig?.enableGlobalFilterInput || Boolean(props.globalFilter);
1135
1090
  function enableGlobalFilter(value) {
1136
1091
  return enableOrUndefined(shouldEnableGlobalFilter, value);
1137
1092
  }
1138
1093
  const [internalSortingState, setInternalSortingState] = (0, import_react7.useState)([]);
1139
1094
  const [sortingState, setSortingState] = [
1140
- (_k = (_j = props.sorting) == null ? void 0 : _j.state) != null ? _k : internalSortingState,
1141
- (_m = (_l = props.sorting) == null ? void 0 : _l.onChange) != null ? _m : setInternalSortingState
1095
+ props.sorting?.state ?? internalSortingState,
1096
+ props.sorting?.onChange ?? setInternalSortingState
1142
1097
  ];
1143
1098
  const [internalRowSelectionState, setInternalRowSelectionState] = (0, import_react7.useState)({});
1144
1099
  const [rowSelectionState, setRowSelectionState] = [
1145
- (_o = (_n = props.rowSelection) == null ? void 0 : _n.state) != null ? _o : internalRowSelectionState,
1146
- (_q = (_p = props.rowSelection) == null ? void 0 : _p.onChange) != null ? _q : setInternalRowSelectionState
1100
+ props.rowSelection?.state ?? internalRowSelectionState,
1101
+ props.rowSelection?.onChange ?? setInternalRowSelectionState
1147
1102
  ];
1148
1103
  const [internalExpandedState, setInternalExpandedState] = (0, import_react7.useState)({});
1149
1104
  const [expandedState, setExpandedState] = [
1150
- (_s = (_r = props.expansion) == null ? void 0 : _r.state) != null ? _s : internalExpandedState,
1151
- (_u = (_t = props.expansion) == null ? void 0 : _t.onChange) != null ? _u : setInternalExpandedState
1105
+ props.expansion?.state ?? internalExpandedState,
1106
+ props.expansion?.onChange ?? setInternalExpandedState
1152
1107
  ];
1153
1108
  const [internalColumnPinning, setInternalColumnPinning] = (0, import_react7.useState)({});
1154
1109
  const [columnPinning, setColumnPinning] = [
@@ -1162,25 +1117,25 @@ function DataTable(props) {
1162
1117
  state: {
1163
1118
  expanded: expandedState,
1164
1119
  globalFilter: enableGlobalFilter(globalFilterState),
1165
- sorting: ((_v = props.sorting) == null ? void 0 : _v.enableSorting) ? (_x = (_w = props.sorting) == null ? void 0 : _w.state) != null ? _x : sortingState : void 0,
1120
+ sorting: props.sorting?.enableSorting ? props.sorting?.state ?? sortingState : void 0,
1166
1121
  rowSelection: rowSelectionState,
1167
1122
  columnVisibility,
1168
1123
  columnPinning
1169
1124
  },
1170
1125
  defaultColumn: {
1171
1126
  cell: ({ cell }) => {
1172
- const truncateMode = getFunctionValueOrDefault(cellConfig == null ? void 0 : cellConfig.truncateMode, cell, "hover");
1127
+ const truncateMode = getFunctionValueOrDefault(cellConfig?.truncateMode, cell, "hover");
1173
1128
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TypographyCustom, { truncate: truncateMode === "hover", enableShowAllOnHover: true, children: cell.getValue() });
1174
1129
  }
1175
1130
  },
1176
1131
  enableColumnResizing: Boolean(props.columnResizing),
1177
1132
  columnResizeMode: typeof props.columnResizing === "boolean" ? "onChange" : props.columnResizing,
1178
- enableSorting: sorting == null ? void 0 : sorting.enableSorting,
1179
- manualSorting: sorting == null ? void 0 : sorting.manualSorting,
1133
+ enableSorting: sorting?.enableSorting,
1134
+ manualSorting: sorting?.manualSorting,
1180
1135
  enableExpanding: Boolean(props.expansion),
1181
- enableMultiRowSelection: ((_y = props.rowSelection) == null ? void 0 : _y.mode) === "multiple",
1182
- enableSubRowSelection: ((_z = props.rowSelection) == null ? void 0 : _z.mode) !== "single",
1183
- filterFromLeafRows: bannerConfig == null ? void 0 : bannerConfig.filterFromLeafRows,
1136
+ enableMultiRowSelection: props.rowSelection?.mode === "multiple",
1137
+ enableSubRowSelection: props.rowSelection?.mode !== "single",
1138
+ filterFromLeafRows: bannerConfig?.filterFromLeafRows,
1184
1139
  enablePinning: props.columnPinning !== void 0 && (typeof props.columnPinning === "boolean" ? props.columnPinning : props.columnPinning.enable),
1185
1140
  getFilteredRowModel: enableGlobalFilter((0, import_react_table4.getFilteredRowModel)()),
1186
1141
  getCoreRowModel: (0, import_react_table4.getCoreRowModel)(),
@@ -1189,18 +1144,17 @@ function DataTable(props) {
1189
1144
  onExpandedChange: setExpandedState,
1190
1145
  onRowSelectionChange: setRowSelectionState,
1191
1146
  onColumnPinningChange: setColumnPinning,
1192
- onSortingChange: (sorting == null ? void 0 : sorting.enableSorting) ? (_A = sorting == null ? void 0 : sorting.onChange) != null ? _A : setSortingState : void 0,
1147
+ onSortingChange: sorting?.enableSorting ? sorting?.onChange ?? setSortingState : void 0,
1193
1148
  onColumnVisibilityChange: setColumnVisibility,
1194
1149
  onGlobalFilterChange: enableGlobalFilter(setGlobalFilterState),
1195
- getSubRows: props == null ? void 0 : props.getSubRows,
1196
- getRowId: props == null ? void 0 : props.getRowId
1150
+ getSubRows: props?.getSubRows,
1151
+ getRowId: props?.getRowId
1197
1152
  });
1198
1153
  (0, import_react7.useEffect)(() => {
1199
- var _a2;
1200
- if ((_a2 = props.expansion) == null ? void 0 : _a2.expandAllByDefault) {
1154
+ if (props.expansion?.expandAllByDefault) {
1201
1155
  table.toggleAllRowsExpanded();
1202
1156
  }
1203
- }, [table, (_B = props.expansion) == null ? void 0 : _B.expandAllByDefault]);
1157
+ }, [table, props.expansion?.expandAllByDefault]);
1204
1158
  const { isLoading, rowConfig } = props;
1205
1159
  const tableContainerRef = (0, import_react7.useRef)(null);
1206
1160
  const onTableContainerScroll = useFetchMoreOnBottomReached(
@@ -1211,7 +1165,7 @@ function DataTable(props) {
1211
1165
  (0, import_react7.useEffect)(() => {
1212
1166
  if (tableContainerRef.current) forceRerender();
1213
1167
  }, [tableContainerRef.current === null]);
1214
- 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: [
1168
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DataTableWrapper, { height: props?.height, width: props?.width, tableLayout: props?.tableLayout, children: [
1215
1169
  props.bannerConfig && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1216
1170
  TableBanner,
1217
1171
  {
@@ -1223,19 +1177,19 @@ function DataTable(props) {
1223
1177
  ),
1224
1178
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1225
1179
  "div",
1226
- __spreadProps(__spreadValues({}, props.tableContainerProps), {
1227
- className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
1228
- onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
1180
+ {
1181
+ ...props.tableContainerProps,
1182
+ className: "--table-container " + (props.tableContainerProps?.className ?? ""),
1183
+ onScroll: props.tableContainerProps?.onScroll ?? onTableContainerScroll,
1229
1184
  ref: (node) => {
1230
- var _a2;
1231
1185
  if (node) {
1232
1186
  tableContainerRef.current = node;
1233
- if ((_a2 = props.tableContainerProps) == null ? void 0 : _a2.ref) {
1187
+ if (props.tableContainerProps?.ref) {
1234
1188
  props.tableContainerProps.ref.current = node;
1235
1189
  }
1236
1190
  }
1237
1191
  },
1238
- children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1192
+ children: props?.virtual ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1239
1193
  VirtualTable,
1240
1194
  {
1241
1195
  containerRef: tableContainerRef,
@@ -1257,7 +1211,7 @@ function DataTable(props) {
1257
1211
  stickyHeader: props.stickyHeader
1258
1212
  }
1259
1213
  )
1260
- })
1214
+ }
1261
1215
  )
1262
1216
  ] });
1263
1217
  }
@@ -1275,21 +1229,16 @@ var formMeta = {
1275
1229
  _hasRemoteChange: false
1276
1230
  };
1277
1231
  function useEditMode() {
1278
- var _a;
1279
1232
  const { watch } = (0, import_react_hook_form.useFormContext)();
1280
- return (_a = watch("_editMode")) != null ? _a : false;
1233
+ return watch("_editMode") ?? false;
1281
1234
  }
1282
1235
  function useHasRemoteChange() {
1283
- var _a;
1284
1236
  const { watch } = (0, import_react_hook_form.useFormContext)();
1285
- return (_a = watch("_hasRemoteChange")) != null ? _a : false;
1237
+ return watch("_hasRemoteChange") ?? false;
1286
1238
  }
1287
1239
  function useGetIsNew() {
1288
1240
  const { getValues } = (0, import_react_hook_form.useFormContext)();
1289
- return () => {
1290
- var _a;
1291
- return (_a = getValues("_isNew")) != null ? _a : false;
1292
- };
1241
+ return () => getValues("_isNew") ?? false;
1293
1242
  }
1294
1243
  function useSetFormMeta() {
1295
1244
  const { setValue } = (0, import_react_hook_form.useFormContext)();
@@ -1302,17 +1251,15 @@ function removeFormMeta(withFormMeta) {
1302
1251
  return (0, import_omit.default)(withFormMeta, Object.keys(formMeta));
1303
1252
  }
1304
1253
  function addFormMeta(withoutFormMeta) {
1305
- return __spreadValues(__spreadValues({}, formMeta), withoutFormMeta);
1254
+ return { ...formMeta, ...withoutFormMeta };
1306
1255
  }
1307
1256
 
1308
1257
  // src/form-cells/EditableCheckboxCell.tsx
1309
1258
  var import_jsx_runtime21 = require("react/jsx-runtime");
1310
- function EditableCheckboxCell(_a) {
1311
- var _b = _a, {
1312
- onChange: onChangeFromProps
1313
- } = _b, context = __objRest(_b, [
1314
- "onChange"
1315
- ]);
1259
+ function EditableCheckboxCell({
1260
+ onChange: onChangeFromProps,
1261
+ ...context
1262
+ }) {
1316
1263
  const editMode = useEditMode();
1317
1264
  if (!editMode)
1318
1265
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -1329,22 +1276,19 @@ function EditableCheckboxCell(_a) {
1329
1276
  import_react_hook_form2.Controller,
1330
1277
  {
1331
1278
  name: context.column.id,
1332
- render: (_a2) => {
1333
- var { field: _b2 } = _a2, _c = _b2, { value, onChange } = _c, field = __objRest(_c, ["value", "onChange"]);
1334
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1335
- import_eds_core_react20.Checkbox,
1336
- __spreadProps(__spreadValues({
1337
- enterKeyHint: "send",
1338
- "aria-label": "editable",
1339
- checked: value
1340
- }, field), {
1341
- onChange: (e) => {
1342
- onChange(e);
1343
- onChangeFromProps == null ? void 0 : onChangeFromProps(e.target.checked);
1344
- }
1345
- })
1346
- );
1347
- }
1279
+ render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1280
+ import_eds_core_react20.Checkbox,
1281
+ {
1282
+ enterKeyHint: "send",
1283
+ "aria-label": "editable",
1284
+ checked: value,
1285
+ ...field,
1286
+ onChange: (e) => {
1287
+ onChange(e);
1288
+ onChangeFromProps?.(e.target.checked);
1289
+ }
1290
+ }
1291
+ )
1348
1292
  }
1349
1293
  );
1350
1294
  }
@@ -1365,9 +1309,8 @@ function getHelperTextProps({
1365
1309
  warning,
1366
1310
  helperText
1367
1311
  }) {
1368
- var _a;
1369
1312
  if (error) {
1370
- if ((_a = error.message) == null ? void 0 : _a.startsWith(WARNING_PREFIX)) {
1313
+ if (error.message?.startsWith(WARNING_PREFIX)) {
1371
1314
  return {
1372
1315
  variant: "warning",
1373
1316
  helperText: error.message.substring(WARNING_PREFIX.length),
@@ -1394,23 +1337,16 @@ function getHelperTextProps({
1394
1337
 
1395
1338
  // src/form-cells/EditableDateCell.tsx
1396
1339
  var import_jsx_runtime23 = require("react/jsx-runtime");
1397
- function EditableDateCell(_a) {
1398
- var _b = _a, {
1399
- dateStringFormatter,
1400
- error: errorFromProps,
1401
- onChange: onChangeFromProps
1402
- } = _b, context = __objRest(_b, [
1403
- "dateStringFormatter",
1404
- "error",
1405
- "onChange"
1406
- ]);
1340
+ function EditableDateCell({
1341
+ dateStringFormatter,
1342
+ error: errorFromProps,
1343
+ onChange: onChangeFromProps,
1344
+ ...context
1345
+ }) {
1407
1346
  const rawValue = context.getValue();
1408
1347
  const editMode = useEditMode();
1409
1348
  const formattedValue = (0, import_react8.useMemo)(
1410
- () => {
1411
- var _a2;
1412
- return (_a2 = dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) != null ? _a2 : rawValue;
1413
- },
1349
+ () => dateStringFormatter?.(rawValue) ?? rawValue,
1414
1350
  [rawValue, dateStringFormatter]
1415
1351
  );
1416
1352
  if (!editMode) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TypographyCustom, { truncate: true, children: formattedValue });
@@ -1418,23 +1354,22 @@ function EditableDateCell(_a) {
1418
1354
  import_react_hook_form3.Controller,
1419
1355
  {
1420
1356
  name: context.column.id,
1421
- render: (_a2) => {
1422
- var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
1423
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1424
- InlineTextField,
1425
- __spreadValues(__spreadValues({
1426
- id: context.column.id,
1427
- type: "date",
1428
- autoComplete: "none",
1429
- value: value ? parseISODate(value) : "",
1430
- onChange: (e) => {
1431
- const newDateString = e.target.value ? parseISODate(e.target.value) : "";
1432
- onChange(newDateString);
1433
- onChangeFromProps == null ? void 0 : onChangeFromProps(newDateString);
1434
- }
1435
- }, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
1436
- );
1437
- }
1357
+ render: ({ field: { value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1358
+ InlineTextField,
1359
+ {
1360
+ id: context.column.id,
1361
+ type: "date",
1362
+ autoComplete: "none",
1363
+ value: value ? parseISODate(value) : "",
1364
+ onChange: (e) => {
1365
+ const newDateString = e.target.value ? parseISODate(e.target.value) ?? "" : "";
1366
+ onChange(newDateString);
1367
+ onChangeFromProps?.(newDateString);
1368
+ },
1369
+ ...getHelperTextProps({ error: errorFromProps ?? error }),
1370
+ ...field
1371
+ }
1372
+ )
1438
1373
  }
1439
1374
  );
1440
1375
  }
@@ -1514,18 +1449,13 @@ function HelperText({ helperText, variant, helperIcon }) {
1514
1449
 
1515
1450
  // src/form-cells/EditableDropdownSingleCell.tsx
1516
1451
  var import_jsx_runtime25 = require("react/jsx-runtime");
1517
- function EditableDropdownSingleCell(_a) {
1518
- var _b = _a, {
1519
- options,
1520
- error: errorFromProps,
1521
- onChange: onChangeFromProps,
1522
- label = ""
1523
- } = _b, context = __objRest(_b, [
1524
- "options",
1525
- "error",
1526
- "onChange",
1527
- "label"
1528
- ]);
1452
+ function EditableDropdownSingleCell({
1453
+ options,
1454
+ error: errorFromProps,
1455
+ onChange: onChangeFromProps,
1456
+ label = "",
1457
+ ...context
1458
+ }) {
1529
1459
  const editMode = useEditMode();
1530
1460
  if (!editMode)
1531
1461
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
@@ -1533,31 +1463,28 @@ function EditableDropdownSingleCell(_a) {
1533
1463
  import_react_hook_form4.Controller,
1534
1464
  {
1535
1465
  name: context.column.id,
1536
- render: (_a2) => {
1537
- var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
1466
+ render: ({ field: { value, onChange, ...field }, fieldState: { error } }) => {
1538
1467
  const selectedOption = options.find((option) => option.value === value);
1539
1468
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1540
1469
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1541
1470
  import_eds_core_react24.Autocomplete,
1542
- __spreadValues({
1471
+ {
1543
1472
  label,
1544
1473
  selectedOptions: selectedOption ? [selectedOption] : [],
1545
1474
  options,
1546
- optionLabel: (option) => {
1547
- var _a3;
1548
- return (_a3 = option == null ? void 0 : option.label) != null ? _a3 : "";
1549
- },
1475
+ optionLabel: (option) => option?.label ?? "",
1550
1476
  "aria-required": true,
1551
1477
  hideClearButton: true,
1552
1478
  "aria-autocomplete": "none",
1553
1479
  onOptionsChange: (changes) => {
1554
1480
  const [change] = changes.selectedItems;
1555
- onChange(change == null ? void 0 : change.value);
1556
- onChangeFromProps == null ? void 0 : onChangeFromProps(change);
1557
- }
1558
- }, field)
1481
+ onChange(change?.value);
1482
+ onChangeFromProps?.(change);
1483
+ },
1484
+ ...field
1485
+ }
1559
1486
  ),
1560
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
1487
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HelperText, { ...getHelperTextProps({ error: errorFromProps ?? error }) })
1561
1488
  ] });
1562
1489
  }
1563
1490
  }
@@ -1569,30 +1496,27 @@ var import_eds_core_react25 = require("@equinor/eds-core-react");
1569
1496
  var import_react_hook_form5 = require("react-hook-form");
1570
1497
  var import_styled_components18 = __toESM(require("styled-components"));
1571
1498
  var import_jsx_runtime26 = require("react/jsx-runtime");
1572
- function EditableNumberCell(_a) {
1573
- var _b = _a, {
1574
- error: errorFromProps
1575
- } = _b, context = __objRest(_b, [
1576
- "error"
1577
- ]);
1499
+ function EditableNumberCell({
1500
+ error: errorFromProps,
1501
+ ...context
1502
+ }) {
1578
1503
  const editMode = useEditMode();
1579
1504
  if (!editMode) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
1580
1505
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1581
1506
  import_react_hook_form5.Controller,
1582
1507
  {
1583
1508
  name: context.column.id,
1584
- render: (_a2) => {
1585
- var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
1586
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1587
- InlineTextField2,
1588
- __spreadValues(__spreadValues({
1589
- id: context.column.id,
1590
- type: "number",
1591
- autoComplete: "none",
1592
- onChange: (e) => onChange(e.target.valueAsNumber)
1593
- }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
1594
- ) });
1595
- }
1509
+ render: ({ field: { onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1510
+ InlineTextField2,
1511
+ {
1512
+ id: context.column.id,
1513
+ type: "number",
1514
+ autoComplete: "none",
1515
+ onChange: (e) => onChange(e.target.valueAsNumber),
1516
+ ...field,
1517
+ ...getHelperTextProps({ error: errorFromProps ?? error })
1518
+ }
1519
+ ) })
1596
1520
  }
1597
1521
  );
1598
1522
  }
@@ -1626,16 +1550,12 @@ var import_react9 = require("react");
1626
1550
  var import_react_hook_form6 = require("react-hook-form");
1627
1551
  var import_styled_components19 = __toESM(require("styled-components"));
1628
1552
  var import_jsx_runtime27 = require("react/jsx-runtime");
1629
- function EditableTextAreaCell(_a) {
1630
- var _b = _a, {
1631
- title,
1632
- error: errorFromProps,
1633
- onChange: onChangeFromProps
1634
- } = _b, context = __objRest(_b, [
1635
- "title",
1636
- "error",
1637
- "onChange"
1638
- ]);
1553
+ function EditableTextAreaCell({
1554
+ title,
1555
+ error: errorFromProps,
1556
+ onChange: onChangeFromProps,
1557
+ ...context
1558
+ }) {
1639
1559
  const [textareaValue, setTextareaValue] = (0, import_react9.useState)(context.getValue());
1640
1560
  const [open, setOpen] = (0, import_react9.useState)(false);
1641
1561
  const editMode = useEditMode();
@@ -1648,88 +1568,87 @@ function EditableTextAreaCell(_a) {
1648
1568
  import_react_hook_form6.Controller,
1649
1569
  {
1650
1570
  name,
1651
- render: (_a2) => {
1652
- var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
1653
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
1654
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1655
- "div",
1656
- {
1657
- style: {
1658
- display: "flex",
1659
- alignItems: "center",
1660
- position: "relative"
1661
- },
1662
- children: [
1571
+ render: ({ field: { onChange, ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
1572
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1573
+ "div",
1574
+ {
1575
+ style: {
1576
+ display: "flex",
1577
+ alignItems: "center",
1578
+ position: "relative"
1579
+ },
1580
+ children: [
1581
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1582
+ StyledTextField,
1583
+ {
1584
+ id: field.name,
1585
+ onChange,
1586
+ ref,
1587
+ ...field,
1588
+ ...getHelperTextProps({ error: errorFromProps ?? error })
1589
+ }
1590
+ ),
1591
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { variant: "ghost_icon", onClick: stopPropagation(openDialog), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Icon, { data: import_eds_icons9.arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
1592
+ ]
1593
+ }
1594
+ ),
1595
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1596
+ import_eds_core_react26.Dialog,
1597
+ {
1598
+ open,
1599
+ onClose: () => {
1600
+ closeDialog();
1601
+ onChange(textareaValue);
1602
+ onChangeFromProps?.(textareaValue);
1603
+ },
1604
+ isDismissable: true,
1605
+ style: { width: "min(50rem, calc(100vw - 4rem))" },
1606
+ children: [
1607
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Title, { children: title }) }),
1608
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1609
+ import_eds_core_react26.Textarea,
1610
+ {
1611
+ style: {
1612
+ maxWidth: "100%",
1613
+ marginTop: "1rem"
1614
+ },
1615
+ id: field.name + "modal",
1616
+ rows: 8,
1617
+ name: field.name + "modal",
1618
+ value: textareaValue,
1619
+ onChange: (e) => {
1620
+ setTextareaValue(e.target.value);
1621
+ }
1622
+ }
1623
+ ) }),
1624
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_eds_core_react26.Dialog.Actions, { style: { display: "flex", gap: "1rem" }, children: [
1663
1625
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1664
- StyledTextField,
1665
- __spreadValues(__spreadValues({
1666
- id: field.name,
1667
- onChange,
1668
- ref
1669
- }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
1626
+ import_eds_core_react26.Button,
1627
+ {
1628
+ onClick: () => {
1629
+ closeDialog();
1630
+ onChange(textareaValue);
1631
+ onChangeFromProps?.(textareaValue);
1632
+ },
1633
+ children: "Submit"
1634
+ }
1670
1635
  ),
1671
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { variant: "ghost_icon", onClick: stopPropagation(openDialog), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Icon, { data: import_eds_icons9.arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
1672
- ]
1673
- }
1674
- ),
1675
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1676
- import_eds_core_react26.Dialog,
1677
- {
1678
- open,
1679
- onClose: () => {
1680
- closeDialog();
1681
- onChange(textareaValue);
1682
- onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
1683
- },
1684
- isDismissable: true,
1685
- style: { width: "min(50rem, calc(100vw - 4rem))" },
1686
- children: [
1687
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Title, { children: title }) }),
1688
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1689
- import_eds_core_react26.Textarea,
1636
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1637
+ import_eds_core_react26.Button,
1690
1638
  {
1691
- style: {
1692
- maxWidth: "100%",
1693
- marginTop: "1rem"
1639
+ variant: "ghost",
1640
+ onClick: () => {
1641
+ closeDialog();
1642
+ setTextareaValue(context.getValue());
1694
1643
  },
1695
- id: field.name + "modal",
1696
- rows: 8,
1697
- name: field.name + "modal",
1698
- value: textareaValue,
1699
- onChange: (e) => {
1700
- setTextareaValue(e.target.value);
1701
- }
1644
+ children: "Cancel"
1702
1645
  }
1703
- ) }),
1704
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_eds_core_react26.Dialog.Actions, { style: { display: "flex", gap: "1rem" }, children: [
1705
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1706
- import_eds_core_react26.Button,
1707
- {
1708
- onClick: () => {
1709
- closeDialog();
1710
- onChange(textareaValue);
1711
- onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
1712
- },
1713
- children: "Submit"
1714
- }
1715
- ),
1716
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1717
- import_eds_core_react26.Button,
1718
- {
1719
- variant: "ghost",
1720
- onClick: () => {
1721
- closeDialog();
1722
- setTextareaValue(context.getValue());
1723
- },
1724
- children: "Cancel"
1725
- }
1726
- )
1727
- ] })
1728
- ]
1729
- }
1730
- )
1731
- ] });
1732
- }
1646
+ )
1647
+ ] })
1648
+ ]
1649
+ }
1650
+ )
1651
+ ] })
1733
1652
  }
1734
1653
  );
1735
1654
  }
@@ -1754,12 +1673,10 @@ var import_eds_core_react27 = require("@equinor/eds-core-react");
1754
1673
  var import_react_hook_form7 = require("react-hook-form");
1755
1674
  var import_styled_components20 = __toESM(require("styled-components"));
1756
1675
  var import_jsx_runtime28 = require("react/jsx-runtime");
1757
- function EditableTextFieldCell(_a) {
1758
- var _b = _a, {
1759
- error: errorFromProps
1760
- } = _b, context = __objRest(_b, [
1761
- "error"
1762
- ]);
1676
+ function EditableTextFieldCell({
1677
+ error: errorFromProps,
1678
+ ...context
1679
+ }) {
1763
1680
  const editMode = useEditMode();
1764
1681
  if (!editMode)
1765
1682
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
@@ -1767,17 +1684,16 @@ function EditableTextFieldCell(_a) {
1767
1684
  import_react_hook_form7.Controller,
1768
1685
  {
1769
1686
  name: context.column.id,
1770
- render: (_a2) => {
1771
- var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
1772
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1773
- InlineTextField3,
1774
- __spreadValues(__spreadValues({
1775
- id: context.column.id,
1776
- autoComplete: "none",
1777
- value: String(value != null ? value : "")
1778
- }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
1779
- );
1780
- }
1687
+ render: ({ field: { value, ...field }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1688
+ InlineTextField3,
1689
+ {
1690
+ id: context.column.id,
1691
+ autoComplete: "none",
1692
+ value: String(value ?? ""),
1693
+ ...field,
1694
+ ...getHelperTextProps({ error: errorFromProps ?? error })
1695
+ }
1696
+ )
1781
1697
  }
1782
1698
  );
1783
1699
  }