@equinor/apollo-components 3.2.0 → 3.3.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.mjs CHANGED
@@ -1,9 +1,38 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __getProtoOf = Object.getPrototypeOf;
6
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
7
36
  var __commonJS = (cb, mod) => function __require() {
8
37
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
38
  };
@@ -16,6 +45,10 @@ var __copyProps = (to, from, except, desc) => {
16
45
  return to;
17
46
  };
18
47
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
48
+ // If the importer is in node compatibility mode or this is not an ESM
49
+ // file that has been converted to a CommonJS file using a Babel-
50
+ // compatible transform (i.e. "__esModule" has not been set), then set
51
+ // "default" to the CommonJS "module.exports" for node compatibility.
19
52
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
20
53
  mod
21
54
  ));
@@ -1007,7 +1040,11 @@ var require_arrayLikeKeys = __commonJS({
1007
1040
  function arrayLikeKeys(value, inherited) {
1008
1041
  var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
1009
1042
  for (var key in value) {
1010
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
1043
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
1044
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1045
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1046
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
1047
+ isIndex(key, length)))) {
1011
1048
  result.push(key);
1012
1049
  }
1013
1050
  }
@@ -2345,33 +2382,16 @@ var Wrapper = styled.div`
2345
2382
  max-width: 100%;
2346
2383
  }
2347
2384
  `;
2348
- var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ jsxs(Wrapper, {
2349
- children: [
2350
- /* @__PURE__ */ jsx(TopBar, {
2351
- sticky: false,
2352
- children: /* @__PURE__ */ jsxs(TopBar.Header, {
2353
- children: [
2354
- /* @__PURE__ */ jsx(Icon, {
2355
- data: icon ?? apps
2356
- }),
2357
- /* @__PURE__ */ jsx("span", {
2358
- children: title ?? "App Title"
2359
- })
2360
- ]
2361
- })
2362
- }),
2363
- /* @__PURE__ */ jsxs("div", {
2364
- className: "--content-wrapper",
2365
- children: [
2366
- sidebar,
2367
- /* @__PURE__ */ jsx("div", {
2368
- className: "--content-outlet",
2369
- children
2370
- })
2371
- ]
2372
- })
2373
- ]
2374
- });
2385
+ var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ jsxs(Wrapper, { children: [
2386
+ /* @__PURE__ */ jsx(TopBar, { sticky: false, children: /* @__PURE__ */ jsxs(TopBar.Header, { children: [
2387
+ /* @__PURE__ */ jsx(Icon, { data: icon != null ? icon : apps }),
2388
+ /* @__PURE__ */ jsx("span", { children: title != null ? title : "App Title" })
2389
+ ] }) }),
2390
+ /* @__PURE__ */ jsxs("div", { className: "--content-wrapper", children: [
2391
+ sidebar,
2392
+ /* @__PURE__ */ jsx("div", { className: "--content-outlet", children })
2393
+ ] })
2394
+ ] });
2375
2395
 
2376
2396
  // src/AppShell/AppSidebar.tsx
2377
2397
  import { Button, Icon as Icon2 } from "@equinor/eds-core-react";
@@ -2408,38 +2428,34 @@ var Wrapper2 = styled2.div`
2408
2428
  `;
2409
2429
  function AppSidebar() {
2410
2430
  const [collapsed, setCollapsed] = useState(false);
2411
- return /* @__PURE__ */ jsx2(Wrapper2, {
2412
- collapsed,
2413
- children: /* @__PURE__ */ jsx2("div", {
2414
- className: "collapse-button-wrapper",
2415
- children: /* @__PURE__ */ jsxs2(Button, {
2416
- className: "collapse-button",
2417
- variant: collapsed ? "ghost_icon" : "ghost",
2418
- onClick: () => setCollapsed(!collapsed),
2419
- children: [
2420
- /* @__PURE__ */ jsx2(Icon2, {
2421
- data: collapsed ? last_page : first_page
2422
- }),
2423
- !collapsed && /* @__PURE__ */ jsx2("div", {
2424
- children: "Collapse"
2425
- })
2426
- ]
2427
- })
2428
- })
2429
- });
2431
+ return /* @__PURE__ */ jsx2(Wrapper2, { collapsed, children: /* @__PURE__ */ jsx2("div", { className: "collapse-button-wrapper", children: /* @__PURE__ */ jsxs2(
2432
+ Button,
2433
+ {
2434
+ className: "collapse-button",
2435
+ variant: collapsed ? "ghost_icon" : "ghost",
2436
+ onClick: () => setCollapsed(!collapsed),
2437
+ children: [
2438
+ /* @__PURE__ */ jsx2(Icon2, { data: collapsed ? last_page : first_page }),
2439
+ !collapsed && /* @__PURE__ */ jsx2("div", { children: "Collapse" })
2440
+ ]
2441
+ }
2442
+ ) }) });
2430
2443
  }
2431
2444
 
2432
2445
  // src/cells/CheckboxCell.tsx
2433
2446
  import { Checkbox } from "@equinor/eds-core-react";
2434
2447
  import { jsx as jsx3 } from "react/jsx-runtime";
2435
2448
  function CheckboxCell(context) {
2436
- return /* @__PURE__ */ jsx3(Checkbox, {
2437
- enterKeyHint: "next",
2438
- "aria-label": "readonly",
2439
- readOnly: true,
2440
- checked: context.getValue(),
2441
- disabled: true
2442
- });
2449
+ return /* @__PURE__ */ jsx3(
2450
+ Checkbox,
2451
+ {
2452
+ enterKeyHint: "next",
2453
+ "aria-label": "readonly",
2454
+ readOnly: true,
2455
+ checked: context.getValue(),
2456
+ disabled: true
2457
+ }
2458
+ );
2443
2459
  }
2444
2460
 
2445
2461
  // src/cells/ChipsCell.tsx
@@ -2477,17 +2493,15 @@ var Chip = styled3.div`
2477
2493
  line-height: 22px;
2478
2494
  height: 22px;
2479
2495
  padding: 0 6px;
2480
- background-color: ${(props) => props.backgroundColor ?? tokens2.colors.ui.background__medium.hex};
2496
+ background-color: ${(props) => {
2497
+ var _a;
2498
+ return (_a = props.backgroundColor) != null ? _a : tokens2.colors.ui.background__medium.hex;
2499
+ }};
2481
2500
  color: darkslategrey;
2482
2501
  `;
2483
2502
  var ChipsCell = (props) => {
2484
2503
  var _a;
2485
- return /* @__PURE__ */ jsx4(ChipsWrapper, {
2486
- children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ jsx4(Chip, {
2487
- backgroundColor: stringToHslColor(value),
2488
- children: value
2489
- }, value))
2490
- });
2504
+ return /* @__PURE__ */ jsx4(ChipsWrapper, { children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ jsx4(Chip, { backgroundColor: stringToHslColor(value), children: value }, value)) });
2491
2505
  };
2492
2506
 
2493
2507
  // src/cells/DynamicCell.tsx
@@ -2533,17 +2547,9 @@ function DynamicCell({ cell, highlight, getStickyCellColor }) {
2533
2547
  var _a;
2534
2548
  const cellContent = flexRender(cell.column.columnDef.cell, cell.getContext());
2535
2549
  if ((_a = cell.column.columnDef.meta) == null ? void 0 : _a.sticky) {
2536
- return /* @__PURE__ */ jsx5(StyledStickyCell, {
2537
- backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell),
2538
- "data-column": cell.column.id,
2539
- children: cellContent
2540
- });
2550
+ return /* @__PURE__ */ jsx5(StyledStickyCell, { backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell), "data-column": cell.column.id, children: cellContent });
2541
2551
  }
2542
- return /* @__PURE__ */ jsx5(StyledCell, {
2543
- "data-column": cell.column.id,
2544
- backgroundColor: highlight ? "#d5eaf4" : void 0,
2545
- children: cellContent
2546
- });
2552
+ return /* @__PURE__ */ jsx5(StyledCell, { "data-column": cell.column.id, backgroundColor: highlight ? "#d5eaf4" : void 0, children: cellContent });
2547
2553
  }
2548
2554
 
2549
2555
  // src/cells/HeaderCell.tsx
@@ -2595,21 +2601,9 @@ var HeaderCell = ({ header, table }) => {
2595
2601
  colSpan: header.colSpan
2596
2602
  };
2597
2603
  if ((_a = header.column.columnDef.meta) == null ? void 0 : _a.sticky) {
2598
- return /* @__PURE__ */ jsx6(StickyCell2, {
2599
- ...cellProps,
2600
- children: /* @__PURE__ */ jsx6(HeaderContent, {
2601
- header,
2602
- table
2603
- })
2604
- }, header.id);
2604
+ return /* @__PURE__ */ jsx6(StickyCell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ jsx6(HeaderContent, { header, table }) }), header.id);
2605
2605
  }
2606
- return /* @__PURE__ */ jsx6(Cell2, {
2607
- ...cellProps,
2608
- children: /* @__PURE__ */ jsx6(HeaderContent, {
2609
- header,
2610
- table
2611
- })
2612
- }, header.id);
2606
+ return /* @__PURE__ */ jsx6(Cell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ jsx6(HeaderContent, { header, table }) }), header.id);
2613
2607
  };
2614
2608
  var HeaderDiv = styled6.div`
2615
2609
  display: flex;
@@ -2618,23 +2612,19 @@ var HeaderDiv = styled6.div`
2618
2612
  z-index: 5;
2619
2613
  `;
2620
2614
  function HeaderContent({ header, table }) {
2615
+ var _a;
2621
2616
  if (header.isPlaceholder)
2622
2617
  return null;
2623
- return /* @__PURE__ */ jsxs3(HeaderDiv, {
2624
- children: [
2625
- flexRender2(header.column.columnDef.header, header.getContext()),
2618
+ return /* @__PURE__ */ jsxs3(HeaderDiv, { children: [
2619
+ flexRender2(header.column.columnDef.header, header.getContext()),
2620
+ (_a = {
2621
+ asc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_up }),
2622
+ desc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down }),
2623
+ none: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down })
2624
+ }[header.column.getIsSorted()]) != null ? _a : null,
2625
+ table.options.enableColumnResizing && /* @__PURE__ */ jsx6(
2626
+ "div",
2626
2627
  {
2627
- asc: /* @__PURE__ */ jsx6(Icon3, {
2628
- data: arrow_drop_up
2629
- }),
2630
- desc: /* @__PURE__ */ jsx6(Icon3, {
2631
- data: arrow_drop_down
2632
- }),
2633
- none: /* @__PURE__ */ jsx6(Icon3, {
2634
- data: arrow_drop_down
2635
- })
2636
- }[header.column.getIsSorted()] ?? null,
2637
- table.options.enableColumnResizing && /* @__PURE__ */ jsx6("div", {
2638
2628
  onMouseDown: header.getResizeHandler(),
2639
2629
  onTouchStart: header.getResizeHandler(),
2640
2630
  onClick: (e) => e.stopPropagation(),
@@ -2642,9 +2632,9 @@ function HeaderContent({ header, table }) {
2642
2632
  style: {
2643
2633
  transform: table.options.columnResizeMode === "onEnd" && header.column.getIsResizing() ? `translateX(${table.getState().columnSizingInfo.deltaOffset}px)` : ""
2644
2634
  }
2645
- })
2646
- ]
2647
- });
2635
+ }
2636
+ )
2637
+ ] });
2648
2638
  }
2649
2639
  function getSort({ column }) {
2650
2640
  if (!column.getCanSort())
@@ -2676,29 +2666,22 @@ var truncateStyle = {
2676
2666
  textOverflow: "ellipsis"
2677
2667
  };
2678
2668
  var TypographyCustom = (props) => {
2679
- const { truncate, enableShowAllOnHover, style: styleFromProps, ...edsTypographyProps } = props;
2669
+ const _a = props, { truncate, enableShowAllOnHover, style: styleFromProps } = _a, edsTypographyProps = __objRest(_a, ["truncate", "enableShowAllOnHover", "style"]);
2680
2670
  if (enableShowAllOnHover)
2681
- return /* @__PURE__ */ jsx7(HoverCapture, {
2682
- children: /* @__PURE__ */ jsx7(EdsTypography, {
2683
- ...edsTypographyProps,
2684
- style: {
2685
- ...styleFromProps,
2686
- ...truncateStyle
2687
- }
2671
+ return /* @__PURE__ */ jsx7(HoverCapture, { children: /* @__PURE__ */ jsx7(
2672
+ EdsTypography,
2673
+ __spreadProps(__spreadValues({}, edsTypographyProps), {
2674
+ style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
2688
2675
  })
2689
- });
2676
+ ) });
2690
2677
  if (truncate)
2691
- return /* @__PURE__ */ jsx7(EdsTypography, {
2692
- ...edsTypographyProps,
2693
- style: {
2694
- ...styleFromProps,
2695
- ...truncateStyle
2696
- }
2697
- });
2698
- return /* @__PURE__ */ jsx7(EdsTypography, {
2699
- ...edsTypographyProps,
2700
- style: styleFromProps
2701
- });
2678
+ return /* @__PURE__ */ jsx7(
2679
+ EdsTypography,
2680
+ __spreadProps(__spreadValues({}, edsTypographyProps), {
2681
+ style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
2682
+ })
2683
+ );
2684
+ return /* @__PURE__ */ jsx7(EdsTypography, __spreadProps(__spreadValues({}, edsTypographyProps), { style: styleFromProps }));
2702
2685
  };
2703
2686
  var HoverCapture = styled7.div`
2704
2687
  height: ${tokens4.typography.table.cell_text.lineHeight};
@@ -2747,17 +2730,18 @@ var CellWrapper = styled8(TypographyCustom)`
2747
2730
  `}
2748
2731
  `;
2749
2732
  function HierarchyCell(cell, options = {}) {
2750
- var _a, _b;
2751
- return /* @__PURE__ */ jsxs4(CellWrapper, {
2752
- depth: ((_a = options.getRowDepth) == null ? void 0 : _a.call(options)) ?? cell.row.depth,
2753
- expanded: cell.row.getIsExpanded(),
2754
- children: [
2755
- /* @__PURE__ */ jsx8("span", {
2756
- className: "--divider"
2757
- }),
2758
- ((_b = options.getDisplayName) == null ? void 0 : _b.call(options)) ?? cell.getValue()
2759
- ]
2760
- });
2733
+ var _a, _b, _c, _d;
2734
+ return /* @__PURE__ */ jsxs4(
2735
+ CellWrapper,
2736
+ {
2737
+ depth: (_b = (_a = options.getRowDepth) == null ? void 0 : _a.call(options)) != null ? _b : cell.row.depth,
2738
+ expanded: cell.row.getIsExpanded(),
2739
+ children: [
2740
+ /* @__PURE__ */ jsx8("span", { className: "--divider" }),
2741
+ (_d = (_c = options.getDisplayName) == null ? void 0 : _c.call(options)) != null ? _d : cell.getValue()
2742
+ ]
2743
+ }
2744
+ );
2761
2745
  }
2762
2746
 
2763
2747
  // src/cells/PopoverCell.tsx
@@ -2765,21 +2749,24 @@ import { Popover, Typography } from "@equinor/eds-core-react";
2765
2749
  import { useRef, useState as useState2 } from "react";
2766
2750
  import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
2767
2751
  function PopoverCell(props) {
2752
+ var _a, _b;
2768
2753
  const [open, setOpen] = useState2(false);
2769
2754
  const anchorRef = useRef(null);
2770
2755
  const handleClick = () => setOpen(!open);
2771
2756
  const handleClose = () => setOpen(false);
2772
- return /* @__PURE__ */ jsxs5("div", {
2773
- style: { position: "relative" },
2774
- ref: anchorRef,
2775
- children: [
2776
- /* @__PURE__ */ jsx9(TypographyCustom, {
2757
+ return /* @__PURE__ */ jsxs5("div", { style: { position: "relative" }, ref: anchorRef, children: [
2758
+ /* @__PURE__ */ jsx9(
2759
+ TypographyCustom,
2760
+ {
2777
2761
  onClick: stopPropagation(handleClick),
2778
2762
  style: { cursor: "pointer" },
2779
2763
  truncate: true,
2780
- children: String(props.value)
2781
- }),
2782
- /* @__PURE__ */ jsxs5(Popover, {
2764
+ children: String((_a = props.value) != null ? _a : "")
2765
+ }
2766
+ ),
2767
+ /* @__PURE__ */ jsxs5(
2768
+ Popover,
2769
+ {
2783
2770
  id: props.id,
2784
2771
  open,
2785
2772
  "aria-controls": "expand cell",
@@ -2787,20 +2774,12 @@ function PopoverCell(props) {
2787
2774
  onClose: handleClose,
2788
2775
  placement: "bottom",
2789
2776
  children: [
2790
- props.title && /* @__PURE__ */ jsx9(Popover.Title, {
2791
- children: /* @__PURE__ */ jsx9(Popover.Header, {
2792
- children: props.title
2793
- })
2794
- }),
2795
- /* @__PURE__ */ jsx9(Popover.Content, {
2796
- children: /* @__PURE__ */ jsx9(Typography, {
2797
- children: String(props.value)
2798
- })
2799
- })
2777
+ props.title && /* @__PURE__ */ jsx9(Popover.Title, { children: /* @__PURE__ */ jsx9(Popover.Header, { children: props.title }) }),
2778
+ /* @__PURE__ */ jsx9(Popover.Content, { children: /* @__PURE__ */ jsx9(Typography, { children: String((_b = props.value) != null ? _b : "") }) })
2800
2779
  ]
2801
- })
2802
- ]
2803
- });
2780
+ }
2781
+ )
2782
+ ] });
2804
2783
  }
2805
2784
 
2806
2785
  // src/cells/SelectColumnDef.tsx
@@ -2820,44 +2799,46 @@ function SelectColumnDef(props) {
2820
2799
  return {
2821
2800
  id: "select",
2822
2801
  size: props.includeExpansionButton ? 96 : 48,
2823
- header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ jsx10(CellWrapper2, {
2824
- children: /* @__PURE__ */ jsx10(Checkbox2, {
2802
+ header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ jsx10(CellWrapper2, { children: /* @__PURE__ */ jsx10(
2803
+ Checkbox2,
2804
+ {
2825
2805
  checked: table.getIsAllRowsSelected(),
2826
2806
  indeterminate: table.getIsSomeRowsSelected(),
2827
2807
  "aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
2828
2808
  onChange: table.getIsSomeRowsSelected() ? () => table.toggleAllRowsSelected(false) : table.getToggleAllRowsSelectedHandler()
2829
- })
2830
- }) : null,
2809
+ }
2810
+ ) }) : null,
2831
2811
  cell: ({ table, row }) => {
2832
2812
  const paddingLeft = "0px";
2833
- return /* @__PURE__ */ jsx10(CellWrapper2, {
2834
- paddingLeft,
2835
- rowDepth: row.depth,
2836
- children: /* @__PURE__ */ jsxs6(Fragment, {
2837
- children: [
2838
- selectionMode === "single" ? /* @__PURE__ */ jsx10(Radio, {
2839
- checked: row.getIsSelected(),
2840
- "aria-label": `Select row ${row.id}`,
2841
- onChange: stopPropagation(row.getToggleSelectedHandler())
2842
- }) : /* @__PURE__ */ jsx10(Checkbox2, {
2843
- checked: row.getIsSelected(),
2844
- indeterminate: row.getIsSomeSelected(),
2845
- "aria-label": `Select row ${row.id}`,
2846
- onChange: stopPropagation(row.getToggleSelectedHandler())
2847
- }),
2848
- row.getCanExpand() && table.options.enableExpanding && /* @__PURE__ */ jsx10(Button2, {
2849
- variant: "ghost_icon",
2850
- color: "secondary",
2851
- "aria-label": row.getIsExpanded() ? "Close group" : "Expand group",
2852
- onClick: stopPropagation(row.getToggleExpandedHandler()),
2853
- style: { cursor: "pointer" },
2854
- children: /* @__PURE__ */ jsx10(Icon4, {
2855
- data: row.getIsExpanded() ? chevron_up : chevron_down
2856
- })
2857
- })
2858
- ]
2859
- })
2860
- });
2813
+ return /* @__PURE__ */ jsx10(CellWrapper2, { paddingLeft, rowDepth: row.depth, children: /* @__PURE__ */ jsxs6(Fragment, { children: [
2814
+ selectionMode === "single" ? /* @__PURE__ */ jsx10(
2815
+ Radio,
2816
+ {
2817
+ checked: row.getIsSelected(),
2818
+ "aria-label": `Select row ${row.id}`,
2819
+ onChange: stopPropagation(row.getToggleSelectedHandler())
2820
+ }
2821
+ ) : /* @__PURE__ */ jsx10(
2822
+ Checkbox2,
2823
+ {
2824
+ checked: row.getIsSelected(),
2825
+ indeterminate: row.getIsSomeSelected(),
2826
+ "aria-label": `Select row ${row.id}`,
2827
+ onChange: stopPropagation(row.getToggleSelectedHandler())
2828
+ }
2829
+ ),
2830
+ row.getCanExpand() && table.options.enableExpanding && /* @__PURE__ */ jsx10(
2831
+ Button2,
2832
+ {
2833
+ variant: "ghost_icon",
2834
+ color: "secondary",
2835
+ "aria-label": row.getIsExpanded() ? "Close group" : "Expand group",
2836
+ onClick: stopPropagation(row.getToggleExpandedHandler()),
2837
+ style: { cursor: "pointer" },
2838
+ children: /* @__PURE__ */ jsx10(Icon4, { data: row.getIsExpanded() ? chevron_up : chevron_down })
2839
+ }
2840
+ )
2841
+ ] }) });
2861
2842
  }
2862
2843
  };
2863
2844
  }
@@ -2914,93 +2895,76 @@ function ColumnSelect({ table }) {
2914
2895
  const [isOpen, setIsOpen] = useState3(false);
2915
2896
  const referenceElement = useRef2(null);
2916
2897
  const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
2917
- return /* @__PURE__ */ jsxs7(Fragment2, {
2918
- children: [
2919
- /* @__PURE__ */ jsx11(Tooltip, {
2920
- title: "Select columns",
2921
- placement: "left",
2922
- children: /* @__PURE__ */ jsx11(Button3, {
2923
- "aria-haspopup": true,
2924
- id: "column-select-anchor",
2925
- "aria-controls": "column-select-popover",
2926
- "aria-expanded": isOpen,
2927
- ref: referenceElement,
2928
- variant: "ghost_icon",
2929
- onClick: () => setIsOpen(true),
2930
- children: /* @__PURE__ */ jsx11(Icon5, {
2931
- name: "view_column",
2932
- data: view_column
2933
- })
2934
- })
2935
- }),
2936
- /* @__PURE__ */ jsxs7(Popover2, {
2898
+ return /* @__PURE__ */ jsxs7(Fragment2, { children: [
2899
+ /* @__PURE__ */ jsx11(Tooltip, { title: "Select columns", placement: "left", children: /* @__PURE__ */ jsx11(
2900
+ Button3,
2901
+ {
2902
+ "aria-haspopup": true,
2903
+ id: "column-select-anchor",
2904
+ "aria-controls": "column-select-popover",
2905
+ "aria-expanded": isOpen,
2906
+ ref: referenceElement,
2907
+ variant: "ghost_icon",
2908
+ onClick: () => setIsOpen(true),
2909
+ children: /* @__PURE__ */ jsx11(Icon5, { name: "view_column", data: view_column })
2910
+ }
2911
+ ) }),
2912
+ /* @__PURE__ */ jsxs7(
2913
+ Popover2,
2914
+ {
2937
2915
  open: isOpen,
2938
2916
  id: "column-select-popover",
2939
2917
  anchorEl: referenceElement.current,
2940
2918
  placement: "bottom-end",
2941
2919
  onClose: () => setIsOpen(false),
2942
2920
  children: [
2943
- /* @__PURE__ */ jsxs7(Popover2.Header, {
2944
- children: [
2945
- /* @__PURE__ */ jsx11(Popover2.Title, {
2946
- children: "Column settings"
2947
- }),
2948
- /* @__PURE__ */ jsx11(Button3, {
2921
+ /* @__PURE__ */ jsxs7(Popover2.Header, { children: [
2922
+ /* @__PURE__ */ jsx11(Popover2.Title, { children: "Column settings" }),
2923
+ /* @__PURE__ */ jsx11(
2924
+ Button3,
2925
+ {
2949
2926
  variant: "ghost_icon",
2950
2927
  "aria-label": "Close column select",
2951
2928
  onClick: () => setIsOpen(false),
2952
- children: /* @__PURE__ */ jsx11(Icon5, {
2953
- name: "close",
2954
- data: close,
2955
- size: 24
2956
- })
2957
- })
2958
- ]
2959
- }),
2960
- /* @__PURE__ */ jsxs7(Popover2.Content, {
2961
- children: [
2962
- /* @__PURE__ */ jsx11(ColumnSelectContent, {
2963
- children: selectableColumns.map((column) => {
2964
- return /* @__PURE__ */ jsx11(Checkbox3, {
2965
- checked: column.getIsVisible(),
2966
- label: getColumnHeader(column),
2967
- onChange: column.getToggleVisibilityHandler()
2968
- }, column.id);
2969
- })
2970
- }),
2971
- /* @__PURE__ */ jsx11(Divider, {
2972
- variant: "small"
2973
- }),
2974
- /* @__PURE__ */ jsx11(ActionsWrapper, {
2975
- children: /* @__PURE__ */ jsx11(Button3, {
2976
- color: "secondary",
2977
- variant: "ghost",
2978
- disabled: table.getIsAllColumnsVisible(),
2979
- onClick: () => table.toggleAllColumnsVisible(true),
2980
- children: "Reset to default"
2981
- })
2982
- })
2983
- ]
2984
- })
2929
+ children: /* @__PURE__ */ jsx11(Icon5, { name: "close", data: close, size: 24 })
2930
+ }
2931
+ )
2932
+ ] }),
2933
+ /* @__PURE__ */ jsxs7(Popover2.Content, { children: [
2934
+ /* @__PURE__ */ jsx11(ColumnSelectContent, { children: selectableColumns.map((column) => {
2935
+ return /* @__PURE__ */ jsx11(
2936
+ Checkbox3,
2937
+ {
2938
+ checked: column.getIsVisible(),
2939
+ label: getColumnHeader(column),
2940
+ onChange: column.getToggleVisibilityHandler()
2941
+ },
2942
+ column.id
2943
+ );
2944
+ }) }),
2945
+ /* @__PURE__ */ jsx11(Divider, { variant: "small" }),
2946
+ /* @__PURE__ */ jsx11(ActionsWrapper, { children: /* @__PURE__ */ jsx11(
2947
+ Button3,
2948
+ {
2949
+ color: "secondary",
2950
+ variant: "ghost",
2951
+ disabled: table.getIsAllColumnsVisible(),
2952
+ onClick: () => table.toggleAllColumnsVisible(true),
2953
+ children: "Reset to default"
2954
+ }
2955
+ ) })
2956
+ ] })
2985
2957
  ]
2986
- })
2987
- ]
2988
- });
2958
+ }
2959
+ )
2960
+ ] });
2989
2961
  }
2990
2962
 
2991
2963
  // src/DataTable/components/TableHeader.tsx
2992
2964
  import { Table as Table4 } from "@equinor/eds-core-react";
2993
2965
  import { jsx as jsx12 } from "react/jsx-runtime";
2994
2966
  function TableHeader({ table, sticky }) {
2995
- return /* @__PURE__ */ jsx12(Table4.Head, {
2996
- sticky,
2997
- children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx12(Table4.Row, {
2998
- children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx12(HeaderCell, {
2999
- header,
3000
- table
3001
- }, header.id))
3002
- }, headerGroup.id))
3003
- });
2967
+ return /* @__PURE__ */ jsx12(Table4.Head, { sticky, children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx12(Table4.Row, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx12(HeaderCell, { header, table }, header.id)) }, headerGroup.id)) });
3004
2968
  }
3005
2969
 
3006
2970
  // src/DataTable/DataTable.tsx
@@ -3026,18 +2990,7 @@ var PlaceholderTextWrapper = styled11.div`
3026
2990
  justify-content: center;
3027
2991
  `;
3028
2992
  function PlaceholderRow({ isLoading }) {
3029
- return /* @__PURE__ */ jsx13(Table5.Row, {
3030
- children: /* @__PURE__ */ jsx13(Table5.Cell, {
3031
- colSpan: 100,
3032
- children: /* @__PURE__ */ jsx13(PlaceholderTextWrapper, {
3033
- children: isLoading ? /* @__PURE__ */ jsx13(DotProgress, {
3034
- color: "primary"
3035
- }) : /* @__PURE__ */ jsx13(Typography2, {
3036
- children: "No data available"
3037
- })
3038
- })
3039
- })
3040
- });
2993
+ return /* @__PURE__ */ jsx13(Table5.Row, { children: /* @__PURE__ */ jsx13(Table5.Cell, { colSpan: 100, children: /* @__PURE__ */ jsx13(PlaceholderTextWrapper, { children: isLoading ? /* @__PURE__ */ jsx13(DotProgress, { color: "primary" }) : /* @__PURE__ */ jsx13(Typography2, { children: "No data available" }) }) }) });
3041
2994
  }
3042
2995
 
3043
2996
  // src/DataTable/components/TableBody.tsx
@@ -3062,29 +3015,36 @@ function TableRow({
3062
3015
  }) {
3063
3016
  var _a;
3064
3017
  const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
3065
- const tableRowContent = /* @__PURE__ */ jsx14(StyledTableRow, {
3066
- active: row.getIsSelected(),
3067
- "data-index": index,
3068
- ref: measureElement,
3069
- style: {
3070
- cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
3071
- backgroundColor: (_a = rowConfig == null ? void 0 : rowConfig.getRowBackground) == null ? void 0 : _a.call(rowConfig, row)
3072
- },
3073
- onClick: () => {
3074
- var _a2;
3075
- return (_a2 = rowConfig == null ? void 0 : rowConfig.onClick) == null ? void 0 : _a2.call(rowConfig, row);
3076
- },
3077
- onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
3078
- onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
3079
- children: row.getVisibleCells().map((cell) => {
3080
- var _a2;
3081
- return /* @__PURE__ */ jsx14(DynamicCell, {
3082
- cell,
3083
- getStickyCellColor: cellConfig == null ? void 0 : cellConfig.getStickyCellColor,
3084
- highlight: (_a2 = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _a2.call(cellConfig, cell)
3085
- }, cell.id);
3086
- })
3087
- });
3018
+ const tableRowContent = /* @__PURE__ */ jsx14(
3019
+ StyledTableRow,
3020
+ {
3021
+ active: row.getIsSelected(),
3022
+ "data-index": index,
3023
+ ref: measureElement,
3024
+ style: {
3025
+ cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
3026
+ backgroundColor: (_a = rowConfig == null ? void 0 : rowConfig.getRowBackground) == null ? void 0 : _a.call(rowConfig, row)
3027
+ },
3028
+ onClick: () => {
3029
+ var _a2;
3030
+ return (_a2 = rowConfig == null ? void 0 : rowConfig.onClick) == null ? void 0 : _a2.call(rowConfig, row);
3031
+ },
3032
+ onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
3033
+ onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
3034
+ children: row.getVisibleCells().map((cell) => {
3035
+ var _a2;
3036
+ return /* @__PURE__ */ jsx14(
3037
+ DynamicCell,
3038
+ {
3039
+ cell,
3040
+ getStickyCellColor: cellConfig == null ? void 0 : cellConfig.getStickyCellColor,
3041
+ highlight: (_a2 = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _a2.call(cellConfig, cell)
3042
+ },
3043
+ cell.id
3044
+ );
3045
+ })
3046
+ }
3047
+ );
3088
3048
  return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
3089
3049
  }
3090
3050
  var StyledTableRow = styled13(Table7.Row)`
@@ -3110,27 +3070,11 @@ function BasicTable({
3110
3070
  tableCaption
3111
3071
  }) {
3112
3072
  const tableRows = table.getRowModel().rows;
3113
- return /* @__PURE__ */ jsxs8(EdsTable2, {
3114
- children: [
3115
- /* @__PURE__ */ jsx15(EdsTable2.Caption, {
3116
- hidden: true,
3117
- children: tableCaption
3118
- }),
3119
- /* @__PURE__ */ jsx15(TableHeader, {
3120
- sticky: stickyHeader,
3121
- table
3122
- }),
3123
- /* @__PURE__ */ jsx15(TableBody, {
3124
- children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx15(TableRow, {
3125
- row,
3126
- rowConfig,
3127
- cellConfig
3128
- }, row.id)) : /* @__PURE__ */ jsx15(PlaceholderRow, {
3129
- isLoading
3130
- })
3131
- })
3132
- ]
3133
- });
3073
+ return /* @__PURE__ */ jsxs8(EdsTable2, { children: [
3074
+ /* @__PURE__ */ jsx15(EdsTable2.Caption, { hidden: true, children: tableCaption }),
3075
+ /* @__PURE__ */ jsx15(TableHeader, { sticky: stickyHeader, table }),
3076
+ /* @__PURE__ */ jsx15(TableBody, { children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx15(TableRow, { row, rowConfig, cellConfig }, row.id)) : /* @__PURE__ */ jsx15(PlaceholderRow, { isLoading }) })
3077
+ ] });
3134
3078
  }
3135
3079
 
3136
3080
  // src/DataTable/components/DataTableHeader.tsx
@@ -3151,13 +3095,18 @@ var CloseButton = styled14(Button4)`
3151
3095
  width: 24px;
3152
3096
  height: 24px;
3153
3097
  `;
3154
- function DebouncedInput({
3155
- value: initialValue,
3156
- onChange,
3157
- icon,
3158
- debounce = 500,
3159
- ...props
3160
- }) {
3098
+ function DebouncedInput(_a) {
3099
+ var _b = _a, {
3100
+ value: initialValue,
3101
+ onChange,
3102
+ icon,
3103
+ debounce = 500
3104
+ } = _b, props = __objRest(_b, [
3105
+ "value",
3106
+ "onChange",
3107
+ "icon",
3108
+ "debounce"
3109
+ ]);
3161
3110
  const [value, setValue] = useState4(initialValue);
3162
3111
  useEffect(() => {
3163
3112
  setValue(initialValue);
@@ -3168,30 +3117,15 @@ function DebouncedInput({
3168
3117
  }, debounce);
3169
3118
  return () => clearTimeout(timeout);
3170
3119
  }, [value]);
3171
- return /* @__PURE__ */ jsx16(Wrapper3, {
3172
- children: /* @__PURE__ */ jsx16(Input, {
3173
- ...props,
3120
+ return /* @__PURE__ */ jsx16(Wrapper3, { children: /* @__PURE__ */ jsx16(
3121
+ Input,
3122
+ __spreadProps(__spreadValues({}, props), {
3174
3123
  value,
3175
- leftAdornments: icon && /* @__PURE__ */ jsx16(Icon6, {
3176
- name: icon.name,
3177
- data: icon,
3178
- size: 18
3179
- }),
3180
- rightAdornments: !!value && /* @__PURE__ */ jsx16(Tooltip2, {
3181
- title: "Clear input",
3182
- children: /* @__PURE__ */ jsx16(CloseButton, {
3183
- variant: "ghost_icon",
3184
- onClick: () => setValue(""),
3185
- children: /* @__PURE__ */ jsx16(Icon6, {
3186
- name: close2.name,
3187
- data: close2,
3188
- size: 18
3189
- })
3190
- })
3191
- }),
3124
+ leftAdornments: icon && /* @__PURE__ */ jsx16(Icon6, { name: icon.name, data: icon, size: 18 }),
3125
+ rightAdornments: !!value && /* @__PURE__ */ jsx16(Tooltip2, { title: "Clear input", children: /* @__PURE__ */ jsx16(CloseButton, { variant: "ghost_icon", onClick: () => setValue(""), children: /* @__PURE__ */ jsx16(Icon6, { name: close2.name, data: close2, size: 18 }) }) }),
3192
3126
  onChange: (event) => setValue(event.target.value)
3193
3127
  })
3194
- });
3128
+ ) });
3195
3129
  }
3196
3130
 
3197
3131
  // src/DataTable/filters/functions.ts
@@ -3225,49 +3159,33 @@ function TableBanner({
3225
3159
  tableCaption,
3226
3160
  globalFilter
3227
3161
  }) {
3228
- var _a;
3229
- return /* @__PURE__ */ jsxs9(TableBannerWrapper, {
3230
- className: "--table-caption",
3231
- padding: bannerConfig == null ? void 0 : bannerConfig.padding,
3232
- children: [
3233
- /* @__PURE__ */ jsxs9(FilterContainer, {
3234
- className: "--filter-container-left",
3235
- children: [
3236
- (bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx17(Typography3, {
3237
- variant: "h3",
3238
- as: "h2",
3239
- children: tableCaption
3240
- }),
3241
- (_a = bannerConfig == null ? void 0 : bannerConfig.customActions) == null ? void 0 : _a.call(bannerConfig, table)
3242
- ]
3243
- }),
3244
- /* @__PURE__ */ jsx17(FilterContainer, {
3245
- className: "--filter-container-right",
3246
- children: /* @__PURE__ */ jsxs9(Fragment3, {
3247
- children: [
3248
- (bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ jsx17(DebouncedInput, {
3249
- value: globalFilter.state,
3250
- icon: search,
3251
- placeholder: bannerConfig.globalFilterPlaceholder ?? "Search all columns",
3252
- onChange: (value) => globalFilter.onChange(String(value))
3253
- }),
3254
- (bannerConfig == null ? void 0 : bannerConfig.enableColumnSelect) && /* @__PURE__ */ jsx17(ColumnSelect, {
3255
- table
3256
- }),
3257
- (bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ jsxs9("span", {
3258
- children: [
3259
- table.options.data.length.toLocaleString(),
3260
- " /",
3261
- " ",
3262
- bannerConfig.totalRowCount.toLocaleString(),
3263
- " rows"
3264
- ]
3265
- })
3266
- ]
3267
- })
3268
- })
3269
- ]
3270
- });
3162
+ var _a, _b, _c, _d, _e;
3163
+ return /* @__PURE__ */ jsxs9(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
3164
+ /* @__PURE__ */ jsxs9(FilterContainer, { className: "--filter-container-left", children: [
3165
+ (bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx17(Typography3, { variant: "h3", as: "h2", children: tableCaption }),
3166
+ (_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)
3167
+ ] }),
3168
+ /* @__PURE__ */ jsx17(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ jsxs9(Fragment3, { children: [
3169
+ (_d = bannerConfig == null ? void 0 : bannerConfig.customActionsRight) == null ? void 0 : _d.call(bannerConfig, table),
3170
+ (bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ jsx17(
3171
+ DebouncedInput,
3172
+ {
3173
+ value: globalFilter.state,
3174
+ icon: search,
3175
+ placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
3176
+ onChange: (value) => globalFilter.onChange(String(value))
3177
+ }
3178
+ ),
3179
+ (bannerConfig == null ? void 0 : bannerConfig.enableColumnSelect) && /* @__PURE__ */ jsx17(ColumnSelect, { table }),
3180
+ (bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ jsxs9("span", { children: [
3181
+ table.options.data.length.toLocaleString(),
3182
+ " /",
3183
+ " ",
3184
+ bannerConfig.totalRowCount.toLocaleString(),
3185
+ " rows"
3186
+ ] })
3187
+ ] }) })
3188
+ ] });
3271
3189
  }
3272
3190
 
3273
3191
  // src/DataTable/components/VirtualTable.tsx
@@ -3280,24 +3198,24 @@ import { jsx as jsx18 } from "react/jsx-runtime";
3280
3198
  var PaddingRow = (props) => {
3281
3199
  if (!props.height)
3282
3200
  return null;
3283
- return /* @__PURE__ */ jsx18(Table8.Row, {
3284
- style: { pointerEvents: "none" },
3285
- children: /* @__PURE__ */ jsx18(Table8.Cell, {
3286
- style: { height: `${props.height}px` }
3287
- })
3288
- });
3201
+ return /* @__PURE__ */ jsx18(Table8.Row, { style: { pointerEvents: "none" }, children: /* @__PURE__ */ jsx18(Table8.Cell, { style: { height: `${props.height}px` } }) });
3289
3202
  };
3290
3203
 
3291
3204
  // src/DataTable/components/VirtualTable.tsx
3292
3205
  import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
3293
- function VirtualTable({
3294
- table,
3295
- rowConfig,
3296
- cellConfig,
3297
- containerRef,
3298
- ...props
3299
- }) {
3300
- var _a, _b;
3206
+ function VirtualTable(_a) {
3207
+ var _b = _a, {
3208
+ table,
3209
+ rowConfig,
3210
+ cellConfig,
3211
+ containerRef
3212
+ } = _b, props = __objRest(_b, [
3213
+ "table",
3214
+ "rowConfig",
3215
+ "cellConfig",
3216
+ "containerRef"
3217
+ ]);
3218
+ var _a2, _b2;
3301
3219
  const { rows } = table.getRowModel();
3302
3220
  const rowVirtualizer = useVirtualizer({
3303
3221
  count: rows.length,
@@ -3307,42 +3225,30 @@ function VirtualTable({
3307
3225
  overscan: 20
3308
3226
  });
3309
3227
  const virtualRows = rowVirtualizer.getVirtualItems();
3310
- const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
3311
- const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
3312
- return /* @__PURE__ */ jsxs10(Table9, {
3313
- children: [
3314
- /* @__PURE__ */ jsx19(Table9.Caption, {
3315
- hidden: true,
3316
- children: props.tableCaption
3317
- }),
3318
- /* @__PURE__ */ jsx19(TableHeader, {
3319
- sticky: props.stickyHeader,
3320
- table
3321
- }),
3322
- /* @__PURE__ */ jsxs10(TableBody, {
3323
- children: [
3324
- /* @__PURE__ */ jsx19(PaddingRow, {
3325
- height: paddingTop
3326
- }),
3327
- rows.length ? virtualRows.map((virtualRow) => {
3328
- const row = rows[virtualRow.index];
3329
- return /* @__PURE__ */ jsx19(TableRow, {
3330
- row,
3331
- rowConfig,
3332
- cellConfig,
3333
- index: virtualRow.index,
3334
- measureElement: rowVirtualizer.measureElement
3335
- }, row.id);
3336
- }) : /* @__PURE__ */ jsx19(PlaceholderRow, {
3337
- isLoading: props.isLoading
3338
- }),
3339
- /* @__PURE__ */ jsx19(PaddingRow, {
3340
- height: paddingBottom
3341
- })
3342
- ]
3343
- })
3344
- ]
3345
- });
3228
+ const paddingTop = virtualRows.length > 0 ? ((_a2 = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a2.start) || 0 : 0;
3229
+ const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
3230
+ return /* @__PURE__ */ jsxs10(Table9, { children: [
3231
+ /* @__PURE__ */ jsx19(Table9.Caption, { hidden: true, children: props.tableCaption }),
3232
+ /* @__PURE__ */ jsx19(TableHeader, { sticky: props.stickyHeader, table }),
3233
+ /* @__PURE__ */ jsxs10(TableBody, { children: [
3234
+ /* @__PURE__ */ jsx19(PaddingRow, { height: paddingTop }),
3235
+ rows.length ? virtualRows.map((virtualRow) => {
3236
+ const row = rows[virtualRow.index];
3237
+ return /* @__PURE__ */ jsx19(
3238
+ TableRow,
3239
+ {
3240
+ row,
3241
+ rowConfig,
3242
+ cellConfig,
3243
+ index: virtualRow.index,
3244
+ measureElement: rowVirtualizer.measureElement
3245
+ },
3246
+ row.id
3247
+ );
3248
+ }) : /* @__PURE__ */ jsx19(PlaceholderRow, { isLoading: props.isLoading }),
3249
+ /* @__PURE__ */ jsx19(PaddingRow, { height: paddingBottom })
3250
+ ] })
3251
+ ] });
3346
3252
  }
3347
3253
 
3348
3254
  // src/DataTable/hooks/useFetchMoreOnBottomReached.tsx
@@ -3395,10 +3301,16 @@ function canUseContainStrict(height) {
3395
3301
  return true;
3396
3302
  }
3397
3303
  var DataTableWrapper = styled16.div`
3398
- width: ${(props) => props.width ?? "100%"};
3304
+ width: ${(props) => {
3305
+ var _a;
3306
+ return (_a = props.width) != null ? _a : "100%";
3307
+ }};
3399
3308
 
3400
3309
  .--table-container {
3401
- height: ${(props) => props.height ?? "100%"};
3310
+ height: ${(props) => {
3311
+ var _a;
3312
+ return (_a = props.height) != null ? _a : "100%";
3313
+ }};
3402
3314
  width: '100%';
3403
3315
  overflow: auto;
3404
3316
  ${(props) => canUseContainStrict(props.height) ? "contain: strict;" : ""}
@@ -3408,41 +3320,44 @@ var DataTableWrapper = styled16.div`
3408
3320
 
3409
3321
  // The following attribute is important for fixed column width
3410
3322
  // CHANGE THIS WITH CAUTION
3411
- table-layout: ${(props) => props.tableLayout ?? "auto"};
3323
+ table-layout: ${(props) => {
3324
+ var _a;
3325
+ return (_a = props.tableLayout) != null ? _a : "auto";
3326
+ }};
3412
3327
  }
3413
3328
  }
3414
3329
  `;
3415
3330
  function DataTable(props) {
3416
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
3331
+ 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;
3417
3332
  const { columns, data, bannerConfig, cellConfig, sorting } = props;
3418
3333
  const [internalColumnVisibility, setInternalColumnVisibility] = useState6({});
3419
3334
  const [columnVisibility, setColumnVisibility] = [
3420
- ((_a = props.columnVisibility) == null ? void 0 : _a.state) ?? internalColumnVisibility,
3421
- ((_b = props.columnVisibility) == null ? void 0 : _b.onChange) ?? setInternalColumnVisibility
3335
+ (_b = (_a = props.columnVisibility) == null ? void 0 : _a.state) != null ? _b : internalColumnVisibility,
3336
+ (_d = (_c = props.columnVisibility) == null ? void 0 : _c.onChange) != null ? _d : setInternalColumnVisibility
3422
3337
  ];
3423
3338
  const [internalGlobalFilterState, setInternalGlobalFilterState] = useState6("");
3424
3339
  const [globalFilterState, setGlobalFilterState] = [
3425
- ((_c = props.globalFilter) == null ? void 0 : _c.state) ?? internalGlobalFilterState,
3426
- ((_d = props.globalFilter) == null ? void 0 : _d.onChange) ?? setInternalGlobalFilterState
3340
+ (_f = (_e = props.globalFilter) == null ? void 0 : _e.state) != null ? _f : internalGlobalFilterState,
3341
+ (_h = (_g = props.globalFilter) == null ? void 0 : _g.onChange) != null ? _h : setInternalGlobalFilterState
3427
3342
  ];
3428
- const shouldEnableGlobalFilter = ((_e = props.bannerConfig) == null ? void 0 : _e.enableGlobalFilterInput) || Boolean(props.globalFilter);
3343
+ const shouldEnableGlobalFilter = ((_i = props.bannerConfig) == null ? void 0 : _i.enableGlobalFilterInput) || Boolean(props.globalFilter);
3429
3344
  function enableGlobalFilter(value) {
3430
3345
  return enableOrUndefined(shouldEnableGlobalFilter, value);
3431
3346
  }
3432
3347
  const [internalSortingState, setInternalSortingState] = useState6([]);
3433
3348
  const [sortingState, setSortingState] = [
3434
- ((_f = props.sorting) == null ? void 0 : _f.state) ?? internalSortingState,
3435
- ((_g = props.sorting) == null ? void 0 : _g.onChange) ?? setInternalSortingState
3349
+ (_k = (_j = props.sorting) == null ? void 0 : _j.state) != null ? _k : internalSortingState,
3350
+ (_m = (_l = props.sorting) == null ? void 0 : _l.onChange) != null ? _m : setInternalSortingState
3436
3351
  ];
3437
3352
  const [internalRowSelectionState, setInternalRowSelectionState] = useState6({});
3438
3353
  const [rowSelectionState, setRowSelectionState] = [
3439
- ((_h = props.rowSelection) == null ? void 0 : _h.state) ?? internalRowSelectionState,
3440
- ((_i = props.rowSelection) == null ? void 0 : _i.onChange) ?? setInternalRowSelectionState
3354
+ (_o = (_n = props.rowSelection) == null ? void 0 : _n.state) != null ? _o : internalRowSelectionState,
3355
+ (_q = (_p = props.rowSelection) == null ? void 0 : _p.onChange) != null ? _q : setInternalRowSelectionState
3441
3356
  ];
3442
3357
  const [internalExpandedState, setInternalExpandedState] = useState6({});
3443
3358
  const [expandedState, setExpandedState] = [
3444
- ((_j = props.expansion) == null ? void 0 : _j.state) ?? internalExpandedState,
3445
- ((_k = props.expansion) == null ? void 0 : _k.onChange) ?? setInternalExpandedState
3359
+ (_s = (_r = props.expansion) == null ? void 0 : _r.state) != null ? _s : internalExpandedState,
3360
+ (_u = (_t = props.expansion) == null ? void 0 : _t.onChange) != null ? _u : setInternalExpandedState
3446
3361
  ];
3447
3362
  const table = useReactTable({
3448
3363
  columns: prependSelectColumn(columns, props.rowSelection),
@@ -3451,18 +3366,14 @@ function DataTable(props) {
3451
3366
  state: {
3452
3367
  expanded: expandedState,
3453
3368
  globalFilter: enableGlobalFilter(globalFilterState),
3454
- sorting: ((_l = props.sorting) == null ? void 0 : _l.enableSorting) ? ((_m = props.sorting) == null ? void 0 : _m.state) ?? sortingState : void 0,
3369
+ sorting: ((_v = props.sorting) == null ? void 0 : _v.enableSorting) ? (_x = (_w = props.sorting) == null ? void 0 : _w.state) != null ? _x : sortingState : void 0,
3455
3370
  rowSelection: rowSelectionState,
3456
3371
  columnVisibility
3457
3372
  },
3458
3373
  defaultColumn: {
3459
3374
  cell: ({ cell }) => {
3460
3375
  const truncateMode = getFunctionValueOrDefault(cellConfig == null ? void 0 : cellConfig.truncateMode, cell, "hover");
3461
- return /* @__PURE__ */ jsx20(TypographyCustom, {
3462
- truncate: truncateMode === "hover",
3463
- enableShowAllOnHover: true,
3464
- children: cell.getValue()
3465
- });
3376
+ return /* @__PURE__ */ jsx20(TypographyCustom, { truncate: truncateMode === "hover", enableShowAllOnHover: true, children: cell.getValue() });
3466
3377
  }
3467
3378
  },
3468
3379
  enableColumnResizing: Boolean(props.columnResizing),
@@ -3470,8 +3381,8 @@ function DataTable(props) {
3470
3381
  enableSorting: sorting == null ? void 0 : sorting.enableSorting,
3471
3382
  manualSorting: sorting == null ? void 0 : sorting.manualSorting,
3472
3383
  enableExpanding: Boolean(props.expansion),
3473
- enableMultiRowSelection: ((_n = props.rowSelection) == null ? void 0 : _n.mode) === "multiple",
3474
- enableSubRowSelection: ((_o = props.rowSelection) == null ? void 0 : _o.mode) !== "single",
3384
+ enableMultiRowSelection: ((_y = props.rowSelection) == null ? void 0 : _y.mode) === "multiple",
3385
+ enableSubRowSelection: ((_z = props.rowSelection) == null ? void 0 : _z.mode) !== "single",
3475
3386
  filterFromLeafRows: bannerConfig == null ? void 0 : bannerConfig.filterFromLeafRows,
3476
3387
  getFilteredRowModel: enableGlobalFilter(getFilteredRowModel()),
3477
3388
  getCoreRowModel: getCoreRowModel(),
@@ -3479,7 +3390,7 @@ function DataTable(props) {
3479
3390
  getSortedRowModel: getSortedRowModel(),
3480
3391
  onExpandedChange: setExpandedState,
3481
3392
  onRowSelectionChange: setRowSelectionState,
3482
- onSortingChange: (sorting == null ? void 0 : sorting.enableSorting) ? (sorting == null ? void 0 : sorting.onChange) ?? setSortingState : void 0,
3393
+ onSortingChange: (sorting == null ? void 0 : sorting.enableSorting) ? (_A = sorting == null ? void 0 : sorting.onChange) != null ? _A : setSortingState : void 0,
3483
3394
  onColumnVisibilityChange: setColumnVisibility,
3484
3395
  onGlobalFilterChange: enableGlobalFilter(setGlobalFilterState),
3485
3396
  getSubRows: props == null ? void 0 : props.getSubRows,
@@ -3490,7 +3401,7 @@ function DataTable(props) {
3490
3401
  if ((_a2 = props.expansion) == null ? void 0 : _a2.expandAllByDefault) {
3491
3402
  table.toggleAllRowsExpanded();
3492
3403
  }
3493
- }, [table, (_p = props.expansion) == null ? void 0 : _p.expandAllByDefault]);
3404
+ }, [table, (_B = props.expansion) == null ? void 0 : _B.expandAllByDefault]);
3494
3405
  const { isLoading, rowConfig } = props;
3495
3406
  const tableContainerRef = useRef3(null);
3496
3407
  const onTableContainerScroll = useFetchMoreOnBottomReached(
@@ -3502,21 +3413,21 @@ function DataTable(props) {
3502
3413
  if (Boolean(tableContainerRef.current))
3503
3414
  forceRerender();
3504
3415
  }, [tableContainerRef.current === null]);
3505
- return /* @__PURE__ */ jsxs11(DataTableWrapper, {
3506
- height: props == null ? void 0 : props.height,
3507
- width: props == null ? void 0 : props.width,
3508
- tableLayout: props == null ? void 0 : props.tableLayout,
3509
- children: [
3510
- props.bannerConfig && /* @__PURE__ */ jsx20(TableBanner, {
3416
+ 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: [
3417
+ props.bannerConfig && /* @__PURE__ */ jsx20(
3418
+ TableBanner,
3419
+ {
3511
3420
  table,
3512
3421
  bannerConfig: props.bannerConfig,
3513
3422
  globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
3514
3423
  tableCaption: props.tableCaption
3515
- }),
3516
- /* @__PURE__ */ jsx20("div", {
3517
- ...props.tableContainerProps,
3518
- className: "--table-container " + (((_q = props.tableContainerProps) == null ? void 0 : _q.className) ?? ""),
3519
- onScroll: ((_r = props.tableContainerProps) == null ? void 0 : _r.onScroll) ?? onTableContainerScroll,
3424
+ }
3425
+ ),
3426
+ /* @__PURE__ */ jsx20(
3427
+ "div",
3428
+ __spreadProps(__spreadValues({}, props.tableContainerProps), {
3429
+ className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
3430
+ onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
3520
3431
  ref: (node) => {
3521
3432
  var _a2;
3522
3433
  if (node) {
@@ -3526,25 +3437,31 @@ function DataTable(props) {
3526
3437
  }
3527
3438
  }
3528
3439
  },
3529
- children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ jsx20(VirtualTable, {
3530
- containerRef: tableContainerRef,
3531
- tableCaption: props.tableCaption,
3532
- table,
3533
- rowConfig,
3534
- cellConfig,
3535
- isLoading,
3536
- stickyHeader: props.stickyHeader
3537
- }) : /* @__PURE__ */ jsx20(BasicTable, {
3538
- tableCaption: props.tableCaption,
3539
- table,
3540
- rowConfig,
3541
- cellConfig,
3542
- isLoading,
3543
- stickyHeader: props.stickyHeader
3544
- })
3440
+ children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ jsx20(
3441
+ VirtualTable,
3442
+ {
3443
+ containerRef: tableContainerRef,
3444
+ tableCaption: props.tableCaption,
3445
+ table,
3446
+ rowConfig,
3447
+ cellConfig,
3448
+ isLoading,
3449
+ stickyHeader: props.stickyHeader
3450
+ }
3451
+ ) : /* @__PURE__ */ jsx20(
3452
+ BasicTable,
3453
+ {
3454
+ tableCaption: props.tableCaption,
3455
+ table,
3456
+ rowConfig,
3457
+ cellConfig,
3458
+ isLoading,
3459
+ stickyHeader: props.stickyHeader
3460
+ }
3461
+ )
3545
3462
  })
3546
- ]
3547
- });
3463
+ )
3464
+ ] });
3548
3465
  }
3549
3466
 
3550
3467
  // src/form-cells/EditableCheckboxCell.tsx
@@ -3560,16 +3477,21 @@ var formMeta = {
3560
3477
  _hasRemoteChange: false
3561
3478
  };
3562
3479
  function useEditMode() {
3480
+ var _a;
3563
3481
  const { watch } = useFormContext();
3564
- return watch("_editMode") ?? false;
3482
+ return (_a = watch("_editMode")) != null ? _a : false;
3565
3483
  }
3566
3484
  function useHasRemoteChange() {
3485
+ var _a;
3567
3486
  const { watch } = useFormContext();
3568
- return watch("_hasRemoteChange") ?? false;
3487
+ return (_a = watch("_hasRemoteChange")) != null ? _a : false;
3569
3488
  }
3570
3489
  function useGetIsNew() {
3571
3490
  const { getValues } = useFormContext();
3572
- return () => getValues("_isNew") ?? false;
3491
+ return () => {
3492
+ var _a;
3493
+ return (_a = getValues("_isNew")) != null ? _a : false;
3494
+ };
3573
3495
  }
3574
3496
  function useSetFormMeta() {
3575
3497
  const { setValue } = useFormContext();
@@ -3582,30 +3504,51 @@ function removeFormMeta(withFormMeta) {
3582
3504
  return (0, import_omit.default)(withFormMeta, Object.keys(formMeta));
3583
3505
  }
3584
3506
  function addFormMeta(withoutFormMeta) {
3585
- return { ...formMeta, ...withoutFormMeta };
3507
+ return __spreadValues(__spreadValues({}, formMeta), withoutFormMeta);
3586
3508
  }
3587
3509
 
3588
3510
  // src/form-cells/EditableCheckboxCell.tsx
3589
3511
  import { jsx as jsx21 } from "react/jsx-runtime";
3590
- function EditableCheckboxCell(context) {
3512
+ function EditableCheckboxCell(_a) {
3513
+ var _b = _a, {
3514
+ onChange: onChangeFromProps
3515
+ } = _b, context = __objRest(_b, [
3516
+ "onChange"
3517
+ ]);
3591
3518
  const editMode = useEditMode();
3592
3519
  if (!editMode)
3593
- return /* @__PURE__ */ jsx21(Checkbox4, {
3594
- enterKeyHint: "next",
3595
- "aria-label": "readonly",
3596
- readOnly: true,
3597
- checked: context.getValue(),
3598
- disabled: true
3599
- });
3600
- return /* @__PURE__ */ jsx21(Controller, {
3601
- name: context.column.id,
3602
- render: ({ field: { value, ...field } }) => /* @__PURE__ */ jsx21(Checkbox4, {
3603
- enterKeyHint: "send",
3604
- "aria-label": "editable",
3605
- checked: value,
3606
- ...field
3607
- })
3608
- });
3520
+ return /* @__PURE__ */ jsx21(
3521
+ Checkbox4,
3522
+ {
3523
+ enterKeyHint: "next",
3524
+ "aria-label": "readonly",
3525
+ readOnly: true,
3526
+ checked: context.getValue(),
3527
+ disabled: true
3528
+ }
3529
+ );
3530
+ return /* @__PURE__ */ jsx21(
3531
+ Controller,
3532
+ {
3533
+ name: context.column.id,
3534
+ render: (_a2) => {
3535
+ var { field: _b2 } = _a2, _c = _b2, { value, onChange } = _c, field = __objRest(_c, ["value", "onChange"]);
3536
+ return /* @__PURE__ */ jsx21(
3537
+ Checkbox4,
3538
+ __spreadProps(__spreadValues({
3539
+ enterKeyHint: "send",
3540
+ "aria-label": "editable",
3541
+ checked: value
3542
+ }, field), {
3543
+ onChange: (e) => {
3544
+ onChange(e);
3545
+ onChangeFromProps == null ? void 0 : onChangeFromProps(e.target.checked);
3546
+ }
3547
+ })
3548
+ );
3549
+ }
3550
+ }
3551
+ );
3609
3552
  }
3610
3553
 
3611
3554
  // src/form-cells/EditableDateCell.tsx
@@ -3627,19 +3570,13 @@ function getHelperTextProps({
3627
3570
  return {
3628
3571
  variant: "error",
3629
3572
  helperText: error.message,
3630
- helperIcon: /* @__PURE__ */ jsx22(Icon7, {
3631
- data: error_filled,
3632
- size: 16
3633
- })
3573
+ helperIcon: /* @__PURE__ */ jsx22(Icon7, { data: error_filled, size: 16 })
3634
3574
  };
3635
3575
  if (warning)
3636
3576
  return {
3637
3577
  variant: "warning",
3638
3578
  helperText: warning.message,
3639
- helperIcon: /* @__PURE__ */ jsx22(Icon7, {
3640
- data: warning_filled,
3641
- size: 16
3642
- })
3579
+ helperIcon: /* @__PURE__ */ jsx22(Icon7, { data: warning_filled, size: 16 })
3643
3580
  };
3644
3581
  return {
3645
3582
  helperText,
@@ -3655,31 +3592,50 @@ function stopPropagation2(handler) {
3655
3592
 
3656
3593
  // src/form-cells/EditableDateCell.tsx
3657
3594
  import { jsx as jsx23 } from "react/jsx-runtime";
3658
- function EditableDateCell(props) {
3659
- const { dateStringFormatter, ...context } = props;
3595
+ function EditableDateCell(_a) {
3596
+ var _b = _a, {
3597
+ dateStringFormatter,
3598
+ error: errorFromProps,
3599
+ onChange: onChangeFromProps
3600
+ } = _b, context = __objRest(_b, [
3601
+ "dateStringFormatter",
3602
+ "error",
3603
+ "onChange"
3604
+ ]);
3660
3605
  const rawValue = context.getValue();
3661
3606
  const editMode = useEditMode();
3662
3607
  const formattedValue = useMemo(
3663
- () => (dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) ?? rawValue,
3608
+ () => {
3609
+ var _a2;
3610
+ return (_a2 = dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) != null ? _a2 : rawValue;
3611
+ },
3664
3612
  [rawValue, dateStringFormatter]
3665
3613
  );
3666
3614
  if (!editMode)
3667
- return /* @__PURE__ */ jsx23(TypographyCustom, {
3668
- truncate: true,
3669
- children: formattedValue
3670
- });
3671
- return /* @__PURE__ */ jsx23(Controller2, {
3672
- name: context.column.id,
3673
- render: ({ field: { value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx23(InlineTextField, {
3674
- id: context.column.id,
3675
- type: "date",
3676
- autoComplete: "none",
3677
- value: value ? parseISODate(value) : "",
3678
- onChange: (e) => onChange(e.target.value ? parseISODate(e.target.value) : ""),
3679
- ...getHelperTextProps({ error }),
3680
- ...field
3681
- })
3682
- });
3615
+ return /* @__PURE__ */ jsx23(TypographyCustom, { truncate: true, children: formattedValue });
3616
+ return /* @__PURE__ */ jsx23(
3617
+ Controller2,
3618
+ {
3619
+ name: context.column.id,
3620
+ render: (_a2) => {
3621
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
3622
+ return /* @__PURE__ */ jsx23(
3623
+ InlineTextField,
3624
+ __spreadValues(__spreadValues({
3625
+ id: context.column.id,
3626
+ type: "date",
3627
+ autoComplete: "none",
3628
+ value: value ? parseISODate(value) : "",
3629
+ onChange: (e) => {
3630
+ const newDateString = e.target.value ? parseISODate(e.target.value) : "";
3631
+ onChange(newDateString);
3632
+ onChangeFromProps == null ? void 0 : onChangeFromProps(newDateString);
3633
+ }
3634
+ }, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
3635
+ );
3636
+ }
3637
+ }
3638
+ );
3683
3639
  }
3684
3640
  function parseISODate(dateString) {
3685
3641
  const date = new Date(dateString);
@@ -3713,65 +3669,134 @@ var InlineTextField = styled17(TextField)`
3713
3669
  // src/form-cells/EditableDropdownSingleCell.tsx
3714
3670
  import { Autocomplete } from "@equinor/eds-core-react";
3715
3671
  import { Controller as Controller3 } from "react-hook-form";
3716
- import { jsx as jsx24 } from "react/jsx-runtime";
3672
+
3673
+ // src/form-cells/FormHelperText.tsx
3674
+ import { Typography as Typography4 } from "@equinor/eds-core-react";
3675
+ import { tokens as tokens6 } from "@equinor/eds-tokens";
3676
+ import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
3677
+ var colors = {
3678
+ error: tokens6.colors.interactive.danger__text.hex,
3679
+ warning: tokens6.colors.interactive.warning__text.hex,
3680
+ success: tokens6.colors.interactive.success__text.hex
3681
+ };
3682
+ function HelperText({ helperText, variant, helperIcon }) {
3683
+ return /* @__PURE__ */ jsx24(Fragment4, { children: helperText && /* @__PURE__ */ jsx24("div", { style: { marginTop: "8px", marginLeft: "8px" }, children: /* @__PURE__ */ jsxs12(
3684
+ "div",
3685
+ {
3686
+ style: {
3687
+ display: "flex",
3688
+ alignItems: "flex-start",
3689
+ marginTop: "8px",
3690
+ color: variant ? colors[variant] : "inherit"
3691
+ },
3692
+ children: [
3693
+ /* @__PURE__ */ jsx24("span", { style: { flexShrink: 0 }, children: helperIcon }),
3694
+ /* @__PURE__ */ jsx24(
3695
+ Typography4,
3696
+ {
3697
+ style: {
3698
+ fontSize: "0.75rem",
3699
+ fontWeight: 500,
3700
+ lineHeight: "1.333em",
3701
+ letterSpacing: "0.013em",
3702
+ textAlign: "left",
3703
+ margin: "0 0 0 8px",
3704
+ color: "inherit"
3705
+ },
3706
+ children: helperText
3707
+ }
3708
+ )
3709
+ ]
3710
+ }
3711
+ ) }) });
3712
+ }
3713
+
3714
+ // src/form-cells/EditableDropdownSingleCell.tsx
3715
+ import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
3717
3716
  function buildEmptyOption() {
3718
3717
  return { label: "", value: "" };
3719
3718
  }
3720
- function EditableDropdownSingleCell(props) {
3721
- const { options, ...context } = props;
3719
+ function EditableDropdownSingleCell(_a) {
3720
+ var _b = _a, {
3721
+ options,
3722
+ error: errorFromProps,
3723
+ onChange: onChangeFromProps
3724
+ } = _b, context = __objRest(_b, [
3725
+ "options",
3726
+ "error",
3727
+ "onChange"
3728
+ ]);
3722
3729
  const editMode = useEditMode();
3723
3730
  if (!editMode)
3724
- return /* @__PURE__ */ jsx24(TypographyCustom, {
3725
- truncate: true,
3726
- children: context.getValue()
3727
- });
3728
- return /* @__PURE__ */ jsx24(Controller3, {
3729
- name: context.column.id,
3730
- render: ({ field: { value, onChange, ...field } }) => {
3731
- const selectedOption = options.find((option) => option.value === value) ?? buildEmptyOption();
3732
- return /* @__PURE__ */ jsx24(Autocomplete, {
3733
- label: "",
3734
- selectedOptions: selectedOption && [selectedOption],
3735
- options,
3736
- optionLabel: (option) => (option == null ? void 0 : option.label) ?? "",
3737
- "aria-required": true,
3738
- hideClearButton: true,
3739
- "aria-autocomplete": "none",
3740
- onOptionsChange: (changes) => {
3741
- const [change] = changes.selectedItems;
3742
- onChange(change == null ? void 0 : change.value);
3743
- },
3744
- ...field
3745
- });
3731
+ return /* @__PURE__ */ jsx25(TypographyCustom, { truncate: true, children: context.getValue() });
3732
+ return /* @__PURE__ */ jsx25(
3733
+ Controller3,
3734
+ {
3735
+ name: context.column.id,
3736
+ render: (_a2) => {
3737
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
3738
+ var _a3;
3739
+ const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
3740
+ return /* @__PURE__ */ jsxs13(Fragment5, { children: [
3741
+ /* @__PURE__ */ jsx25(
3742
+ Autocomplete,
3743
+ __spreadValues({
3744
+ label: "",
3745
+ selectedOptions: selectedOption && [selectedOption],
3746
+ options,
3747
+ optionLabel: (option) => {
3748
+ var _a4;
3749
+ return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
3750
+ },
3751
+ "aria-required": true,
3752
+ hideClearButton: true,
3753
+ "aria-autocomplete": "none",
3754
+ onOptionsChange: (changes) => {
3755
+ const [change] = changes.selectedItems;
3756
+ onChange(change == null ? void 0 : change.value);
3757
+ onChangeFromProps == null ? void 0 : onChangeFromProps(change);
3758
+ }
3759
+ }, field)
3760
+ ),
3761
+ /* @__PURE__ */ jsx25(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
3762
+ ] });
3763
+ }
3746
3764
  }
3747
- });
3765
+ );
3748
3766
  }
3749
3767
 
3750
3768
  // src/form-cells/EditableNumberCell.tsx
3751
3769
  import { TextField as TextField2 } from "@equinor/eds-core-react";
3752
3770
  import { Controller as Controller4 } from "react-hook-form";
3753
3771
  import styled18 from "styled-components";
3754
- import { Fragment as Fragment4, jsx as jsx25 } from "react/jsx-runtime";
3755
- function EditableNumberCell(context) {
3772
+ import { Fragment as Fragment6, jsx as jsx26 } from "react/jsx-runtime";
3773
+ function EditableNumberCell(_a) {
3774
+ var _b = _a, {
3775
+ error: errorFromProps
3776
+ } = _b, context = __objRest(_b, [
3777
+ "error"
3778
+ ]);
3756
3779
  const editMode = useEditMode();
3757
3780
  if (!editMode)
3758
- return /* @__PURE__ */ jsx25(TypographyCustom, {
3759
- truncate: true,
3760
- children: context.getValue()
3761
- });
3762
- return /* @__PURE__ */ jsx25(Controller4, {
3763
- name: context.column.id,
3764
- render: ({ field: { onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx25(Fragment4, {
3765
- children: /* @__PURE__ */ jsx25(InlineTextField2, {
3766
- id: context.column.id,
3767
- type: "number",
3768
- autoComplete: "none",
3769
- onChange: (e) => onChange(e.target.valueAsNumber),
3770
- ...field,
3771
- ...getHelperTextProps({ error })
3772
- })
3773
- })
3774
- });
3781
+ return /* @__PURE__ */ jsx26(TypographyCustom, { truncate: true, children: context.getValue() });
3782
+ return /* @__PURE__ */ jsx26(
3783
+ Controller4,
3784
+ {
3785
+ name: context.column.id,
3786
+ render: (_a2) => {
3787
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
3788
+ return /* @__PURE__ */ jsx26(Fragment6, { children: /* @__PURE__ */ jsx26(
3789
+ InlineTextField2,
3790
+ __spreadValues(__spreadValues({
3791
+ id: context.column.id,
3792
+ type: "number",
3793
+ autoComplete: "none",
3794
+ onChange: (e) => onChange(e.target.valueAsNumber)
3795
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3796
+ ) });
3797
+ }
3798
+ }
3799
+ );
3775
3800
  }
3776
3801
  var InlineTextField2 = styled18(TextField2)`
3777
3802
  /*
@@ -3802,105 +3827,114 @@ import { arrow_up } from "@equinor/eds-icons";
3802
3827
  import { useState as useState7 } from "react";
3803
3828
  import { Controller as Controller5 } from "react-hook-form";
3804
3829
  import styled19 from "styled-components";
3805
- import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
3806
- function EditableTextAreaCell(props) {
3807
- const { title, ...context } = props;
3830
+ import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
3831
+ function EditableTextAreaCell(_a) {
3832
+ var _b = _a, {
3833
+ title,
3834
+ error: errorFromProps,
3835
+ onChange: onChangeFromProps
3836
+ } = _b, context = __objRest(_b, [
3837
+ "title",
3838
+ "error",
3839
+ "onChange"
3840
+ ]);
3808
3841
  const [textareaValue, setTextareaValue] = useState7(context.getValue());
3809
3842
  const [open, setOpen] = useState7(false);
3810
3843
  const editMode = useEditMode();
3811
3844
  const name = context.column.id;
3812
3845
  if (!editMode)
3813
- return /* @__PURE__ */ jsx26(PopoverCell, {
3814
- id: name + "popover",
3815
- value: context.getValue(),
3816
- title
3817
- });
3846
+ return /* @__PURE__ */ jsx27(PopoverCell, { id: name + "popover", value: context.getValue(), title });
3818
3847
  const openDialog = () => setOpen(true);
3819
3848
  const closeDialog = () => setOpen(false);
3820
- return /* @__PURE__ */ jsx26(Controller5, {
3821
- name,
3822
- render: ({ field: { onChange, ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsxs12(Fragment5, {
3823
- children: [
3824
- /* @__PURE__ */ jsxs12("div", {
3825
- style: {
3826
- display: "flex",
3827
- alignItems: "center",
3828
- position: "relative"
3829
- },
3830
- children: [
3831
- /* @__PURE__ */ jsx26(StyledTextField, {
3832
- id: field.name,
3833
- onChange,
3834
- ref,
3835
- ...field,
3836
- ...getHelperTextProps({ error })
3837
- }),
3838
- /* @__PURE__ */ jsx26(IconButton, {
3839
- variant: "ghost_icon",
3840
- onClick: stopPropagation2(openDialog),
3841
- children: /* @__PURE__ */ jsx26(Icon8, {
3842
- data: arrow_up,
3843
- size: 24,
3844
- style: { transform: "rotateZ(45deg)" }
3845
- })
3846
- })
3847
- ]
3848
- }),
3849
- /* @__PURE__ */ jsxs12(EDS, {
3850
- open,
3851
- onClose: () => {
3852
- closeDialog();
3853
- onChange(textareaValue);
3854
- },
3855
- isDismissable: true,
3856
- style: { width: "min(50rem, calc(100vw - 4rem))" },
3857
- children: [
3858
- /* @__PURE__ */ jsx26(EDS.Header, {
3859
- children: /* @__PURE__ */ jsx26(EDS.Title, {
3860
- children: title
3861
- })
3862
- }),
3863
- /* @__PURE__ */ jsx26(EDS.Content, {
3864
- children: /* @__PURE__ */ jsx26(TextField3, {
3865
- style: {
3866
- maxWidth: "100%",
3867
- marginTop: "1rem"
3868
- },
3869
- id: field.name + "modal",
3870
- multiline: true,
3871
- rows: 8,
3872
- name: field.name + "modal",
3873
- value: textareaValue,
3874
- onChange: (e) => {
3875
- setTextareaValue(e.target.value);
3876
- }
3877
- })
3878
- }),
3879
- /* @__PURE__ */ jsxs12(EDS.Actions, {
3880
- style: { display: "flex", gap: "1rem" },
3849
+ return /* @__PURE__ */ jsx27(
3850
+ Controller5,
3851
+ {
3852
+ name,
3853
+ render: (_a2) => {
3854
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
3855
+ return /* @__PURE__ */ jsxs14(Fragment7, { children: [
3856
+ /* @__PURE__ */ jsxs14(
3857
+ "div",
3858
+ {
3859
+ style: {
3860
+ display: "flex",
3861
+ alignItems: "center",
3862
+ position: "relative"
3863
+ },
3881
3864
  children: [
3882
- /* @__PURE__ */ jsx26(Button5, {
3883
- onClick: () => {
3884
- closeDialog();
3885
- onChange(textareaValue);
3886
- },
3887
- children: "Submit"
3888
- }),
3889
- /* @__PURE__ */ jsx26(Button5, {
3890
- variant: "ghost",
3891
- onClick: () => {
3892
- closeDialog();
3893
- setTextareaValue(context.getValue());
3894
- },
3895
- children: "Cancel"
3896
- })
3865
+ /* @__PURE__ */ jsx27(
3866
+ StyledTextField,
3867
+ __spreadValues(__spreadValues({
3868
+ id: field.name,
3869
+ onChange,
3870
+ ref
3871
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3872
+ ),
3873
+ /* @__PURE__ */ jsx27(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ jsx27(Icon8, { data: arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
3897
3874
  ]
3898
- })
3899
- ]
3900
- })
3901
- ]
3902
- })
3903
- });
3875
+ }
3876
+ ),
3877
+ /* @__PURE__ */ jsxs14(
3878
+ EDS,
3879
+ {
3880
+ open,
3881
+ onClose: () => {
3882
+ closeDialog();
3883
+ onChange(textareaValue);
3884
+ onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
3885
+ },
3886
+ isDismissable: true,
3887
+ style: { width: "min(50rem, calc(100vw - 4rem))" },
3888
+ children: [
3889
+ /* @__PURE__ */ jsx27(EDS.Header, { children: /* @__PURE__ */ jsx27(EDS.Title, { children: title }) }),
3890
+ /* @__PURE__ */ jsx27(EDS.Content, { children: /* @__PURE__ */ jsx27(
3891
+ TextField3,
3892
+ {
3893
+ style: {
3894
+ maxWidth: "100%",
3895
+ marginTop: "1rem"
3896
+ },
3897
+ id: field.name + "modal",
3898
+ multiline: true,
3899
+ rows: 8,
3900
+ name: field.name + "modal",
3901
+ value: textareaValue,
3902
+ onChange: (e) => {
3903
+ setTextareaValue(e.target.value);
3904
+ }
3905
+ }
3906
+ ) }),
3907
+ /* @__PURE__ */ jsxs14(EDS.Actions, { style: { display: "flex", gap: "1rem" }, children: [
3908
+ /* @__PURE__ */ jsx27(
3909
+ Button5,
3910
+ {
3911
+ onClick: () => {
3912
+ closeDialog();
3913
+ onChange(textareaValue);
3914
+ onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
3915
+ },
3916
+ children: "Submit"
3917
+ }
3918
+ ),
3919
+ /* @__PURE__ */ jsx27(
3920
+ Button5,
3921
+ {
3922
+ variant: "ghost",
3923
+ onClick: () => {
3924
+ closeDialog();
3925
+ setTextareaValue(context.getValue());
3926
+ },
3927
+ children: "Cancel"
3928
+ }
3929
+ )
3930
+ ] })
3931
+ ]
3932
+ }
3933
+ )
3934
+ ] });
3935
+ }
3936
+ }
3937
+ );
3904
3938
  }
3905
3939
  var StyledTextField = styled19(TextField3)`
3906
3940
  & input {
@@ -3922,24 +3956,33 @@ var IconButton = styled19(Button5)`
3922
3956
  import { TextField as TextField4 } from "@equinor/eds-core-react";
3923
3957
  import { Controller as Controller6 } from "react-hook-form";
3924
3958
  import styled20 from "styled-components";
3925
- import { jsx as jsx27 } from "react/jsx-runtime";
3926
- function EditableTextFieldCell(context) {
3959
+ import { jsx as jsx28 } from "react/jsx-runtime";
3960
+ function EditableTextFieldCell(_a) {
3961
+ var _b = _a, {
3962
+ error: errorFromProps
3963
+ } = _b, context = __objRest(_b, [
3964
+ "error"
3965
+ ]);
3927
3966
  const editMode = useEditMode();
3928
3967
  if (!editMode)
3929
- return /* @__PURE__ */ jsx27(TypographyCustom, {
3930
- truncate: true,
3931
- children: context.getValue()
3932
- });
3933
- return /* @__PURE__ */ jsx27(Controller6, {
3934
- name: context.column.id,
3935
- render: ({ field: { value, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx27(InlineTextField3, {
3936
- id: context.column.id,
3937
- autoComplete: "none",
3938
- value: String(value ?? ""),
3939
- ...field,
3940
- ...getHelperTextProps({ error })
3941
- })
3942
- });
3968
+ return /* @__PURE__ */ jsx28(TypographyCustom, { truncate: true, children: context.getValue() });
3969
+ return /* @__PURE__ */ jsx28(
3970
+ Controller6,
3971
+ {
3972
+ name: context.column.id,
3973
+ render: (_a2) => {
3974
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
3975
+ return /* @__PURE__ */ jsx28(
3976
+ InlineTextField3,
3977
+ __spreadValues(__spreadValues({
3978
+ id: context.column.id,
3979
+ autoComplete: "none",
3980
+ value: String(value != null ? value : "")
3981
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3982
+ );
3983
+ }
3984
+ }
3985
+ );
3943
3986
  }
3944
3987
  var InlineTextField3 = styled20(TextField4)`
3945
3988
  /*