@equinor/apollo-components 3.2.1 → 3.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-co
8
8
  import { ColumnDef as ColumnDef$1 } from '@tanstack/table-core';
9
9
  import { SetRequired } from 'type-fest';
10
10
  import { TableOptions } from '@tanstack/table-core/build/lib/types';
11
+ import { FieldError } from 'react-hook-form';
11
12
 
12
13
  interface AppShellProps {
13
14
  children?: ReactNode;
@@ -161,7 +162,12 @@ interface DataTableProps<T> {
161
162
  enableGlobalFilterInput?: boolean;
162
163
  globalFilterPlaceholder?: string;
163
164
  filterFromLeafRows?: boolean;
165
+ /**
166
+ * @deprecated Use `customActionsLeft` instead
167
+ */
164
168
  customActions?: <T>(table: Table<T>) => ReactNode;
169
+ customActionsLeft?: <T>(table: Table<T>) => ReactNode;
170
+ customActionsRight?: <T>(table: Table<T>) => ReactNode;
165
171
  /**
166
172
  * Default 1rem
167
173
  * Accepts any CSS padding value
@@ -239,32 +245,45 @@ declare function useSetFormMeta<T extends FormMeta>(): (newValues: Partial<T>) =
239
245
  declare function removeFormMeta<T extends FormMeta>(withFormMeta: T): Omit<T, keyof FormMeta>;
240
246
  declare function addFormMeta<T>(withoutFormMeta: T): T & FormMeta;
241
247
 
242
- declare function EditableCheckboxCell<T extends FormMeta>(context: CellContext<T, boolean>): JSX.Element;
248
+ interface EditableCellBaseProps<T extends FormMeta, Value> extends CellContext<T, Value> {
249
+ /**
250
+ * FieldError object used to overwrite react-hook-form validation result. It is prioritized over
251
+ * react-hook-form's validation.
252
+ */
253
+ error?: FieldError;
254
+ /**
255
+ * Custom `onChange` called on input change after react-hook-form's `onChange`. E.g. used to trigger actions on change.
256
+ */
257
+ onChange?: (value: Value) => void;
258
+ }
259
+
260
+ declare function EditableCheckboxCell<T extends FormMeta>({ onChange: onChangeFromProps, ...context }: EditableCellBaseProps<T, boolean>): JSX.Element;
243
261
 
244
- interface EditableDateCellProps<T extends FormMeta> extends CellContext<T, unknown> {
262
+ interface EditableDateCellProps<T extends FormMeta> extends EditableCellBaseProps<T, string> {
245
263
  dateStringFormatter?: (date: string) => string;
246
264
  }
247
- declare function EditableDateCell<T extends FormMeta>(props: EditableDateCellProps<T>): JSX.Element;
265
+ declare function EditableDateCell<T extends FormMeta>({ dateStringFormatter, error: errorFromProps, onChange: onChangeFromProps, ...context }: EditableDateCellProps<T>): JSX.Element;
248
266
 
249
267
  interface Option {
250
268
  label: string;
251
269
  value: string;
252
270
  }
253
- interface EditableDropdownSingleCellProps<T extends FormMeta> extends CellContext<T, unknown> {
271
+ interface EditableDropdownSingleCellProps<T extends FormMeta> extends Omit<EditableCellBaseProps<T, unknown>, 'onChange'> {
254
272
  /**
255
273
  * `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
256
274
  */
257
275
  options: Option[];
276
+ onChange?: (value: Option) => void;
258
277
  }
259
- declare function EditableDropdownSingleCell<T extends FormMeta>(props: EditableDropdownSingleCellProps<T>): JSX.Element;
278
+ declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, onChange: onChangeFromProps, ...context }: EditableDropdownSingleCellProps<T>): JSX.Element;
260
279
 
261
- declare function EditableNumberCell<T extends FormMeta>(context: CellContext<T, number>): JSX.Element;
280
+ declare function EditableNumberCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableCellBaseProps<T, number>): JSX.Element;
262
281
 
263
- interface EdtiableTextAreaProps<T extends FormMeta> extends CellContext<T, string> {
282
+ interface EdtiableTextAreaProps<T extends FormMeta> extends EditableCellBaseProps<T, string> {
264
283
  title: string;
265
284
  }
266
- declare function EditableTextAreaCell<T extends FormMeta>(props: EdtiableTextAreaProps<T>): JSX.Element;
285
+ declare function EditableTextAreaCell<T extends FormMeta>({ title, error: errorFromProps, onChange: onChangeFromProps, ...context }: EdtiableTextAreaProps<T>): JSX.Element;
267
286
 
268
- declare function EditableTextFieldCell<T extends FormMeta>(context: CellContext<T, unknown>): JSX.Element;
287
+ declare function EditableTextFieldCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableCellBaseProps<T, string>): JSX.Element;
269
288
 
270
289
  export { AppShell, AppSidebar, CellConfig, CheckboxCell, ChipsCell, ColumnSelect, DataTable, DataTableProps, DynamicCell, EditableCheckboxCell, EditableDateCell, EditableDateCellProps, EditableDropdownSingleCell, EditableDropdownSingleCellProps, EditableNumberCell, EditableTextAreaCell, EditableTextFieldCell, FormMeta, HTMLPropsRef, HeaderCell, HierarchyCell, InfiniteScrollConfig, Option, PopoverCell, RowConfig, RowSelectionMode, SelectColumnDef, SortConfig, StickyCell, StickyHeaderCell, StyledStickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TruncateMode, TypographyCustom, TypographyProps, WithoutFormMeta, addFormMeta, capitalizeHeader, leftCellShadow, prependSelectColumn, removeFormMeta, stopPropagation, stringToHslColor, useEditMode, useGetIsNew, useHasRemoteChange, useSetFormMeta };
package/dist/index.js CHANGED
@@ -3043,15 +3043,11 @@ var TableBody = (0, import_styled_components12.default)(import_eds_core_react13.
3043
3043
  var import_eds_core_react14 = require("@equinor/eds-core-react");
3044
3044
  var import_styled_components13 = __toESM(require("styled-components"));
3045
3045
  var import_jsx_runtime14 = require("react/jsx-runtime");
3046
- function TableRow({
3047
- row,
3048
- rowConfig,
3049
- cellConfig,
3050
- measureElement,
3051
- index
3052
- }) {
3046
+ function TableRow(props) {
3053
3047
  var _a;
3048
+ const { row, rowConfig, cellConfig, measureElement, index } = props;
3054
3049
  const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
3050
+ console.log("Hello");
3055
3051
  const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3056
3052
  StyledTableRow,
3057
3053
  {
@@ -3196,19 +3192,20 @@ function TableBanner({
3196
3192
  tableCaption,
3197
3193
  globalFilter
3198
3194
  }) {
3199
- var _a, _b;
3195
+ var _a, _b, _c, _d, _e;
3200
3196
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
3201
3197
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(FilterContainer, { className: "--filter-container-left", children: [
3202
3198
  (bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_eds_core_react17.Typography, { variant: "h3", as: "h2", children: tableCaption }),
3203
- (_a = bannerConfig == null ? void 0 : bannerConfig.customActions) == null ? void 0 : _a.call(bannerConfig, table)
3199
+ (_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)
3204
3200
  ] }),
3205
3201
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3202
+ (_d = bannerConfig == null ? void 0 : bannerConfig.customActionsRight) == null ? void 0 : _d.call(bannerConfig, table),
3206
3203
  (bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3207
3204
  DebouncedInput,
3208
3205
  {
3209
3206
  value: globalFilter.state,
3210
3207
  icon: import_eds_icons7.search,
3211
- placeholder: (_b = bannerConfig.globalFilterPlaceholder) != null ? _b : "Search all columns",
3208
+ placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
3212
3209
  onChange: (value) => globalFilter.onChange(String(value))
3213
3210
  }
3214
3211
  ),
@@ -3545,7 +3542,12 @@ function addFormMeta(withoutFormMeta) {
3545
3542
 
3546
3543
  // src/form-cells/EditableCheckboxCell.tsx
3547
3544
  var import_jsx_runtime21 = require("react/jsx-runtime");
3548
- function EditableCheckboxCell(context) {
3545
+ function EditableCheckboxCell(_a) {
3546
+ var _b = _a, {
3547
+ onChange: onChangeFromProps
3548
+ } = _b, context = __objRest(_b, [
3549
+ "onChange"
3550
+ ]);
3549
3551
  const editMode = useEditMode();
3550
3552
  if (!editMode)
3551
3553
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -3562,9 +3564,21 @@ function EditableCheckboxCell(context) {
3562
3564
  import_react_hook_form2.Controller,
3563
3565
  {
3564
3566
  name: context.column.id,
3565
- render: (_a) => {
3566
- var { field: _b } = _a, _c = _b, { value } = _c, field = __objRest(_c, ["value"]);
3567
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_eds_core_react20.Checkbox, __spreadValues({ enterKeyHint: "send", "aria-label": "editable", checked: value }, field));
3567
+ render: (_a2) => {
3568
+ var { field: _b2 } = _a2, _c = _b2, { value, onChange } = _c, field = __objRest(_c, ["value", "onChange"]);
3569
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3570
+ import_eds_core_react20.Checkbox,
3571
+ __spreadProps(__spreadValues({
3572
+ enterKeyHint: "send",
3573
+ "aria-label": "editable",
3574
+ checked: value
3575
+ }, field), {
3576
+ onChange: (e) => {
3577
+ onChange(e);
3578
+ onChangeFromProps == null ? void 0 : onChangeFromProps(e.target.checked);
3579
+ }
3580
+ })
3581
+ );
3568
3582
  }
3569
3583
  }
3570
3584
  );
@@ -3580,17 +3594,27 @@ var import_styled_components17 = __toESM(require("styled-components"));
3580
3594
  var import_eds_core_react21 = require("@equinor/eds-core-react");
3581
3595
  var import_eds_icons8 = require("@equinor/eds-icons");
3582
3596
  var import_jsx_runtime22 = require("react/jsx-runtime");
3597
+ var WARNING_PREFIX = "WARNING";
3583
3598
  function getHelperTextProps({
3584
3599
  error,
3585
3600
  warning,
3586
3601
  helperText
3587
3602
  }) {
3588
- if (error)
3603
+ var _a;
3604
+ if (error) {
3605
+ if ((_a = error.message) == null ? void 0 : _a.startsWith(WARNING_PREFIX)) {
3606
+ return {
3607
+ variant: "warning",
3608
+ helperText: error.message.substring(WARNING_PREFIX.length - 1),
3609
+ helperIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_eds_core_react21.Icon, { data: import_eds_icons8.warning_filled, size: 16 })
3610
+ };
3611
+ }
3589
3612
  return {
3590
3613
  variant: "error",
3591
3614
  helperText: error.message,
3592
3615
  helperIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_eds_core_react21.Icon, { data: import_eds_icons8.error_filled, size: 16 })
3593
3616
  };
3617
+ }
3594
3618
  if (warning)
3595
3619
  return {
3596
3620
  variant: "warning",
@@ -3611,8 +3635,16 @@ function stopPropagation2(handler) {
3611
3635
 
3612
3636
  // src/form-cells/EditableDateCell.tsx
3613
3637
  var import_jsx_runtime23 = require("react/jsx-runtime");
3614
- function EditableDateCell(props) {
3615
- const _a = props, { dateStringFormatter } = _a, context = __objRest(_a, ["dateStringFormatter"]);
3638
+ function EditableDateCell(_a) {
3639
+ var _b = _a, {
3640
+ dateStringFormatter,
3641
+ error: errorFromProps,
3642
+ onChange: onChangeFromProps
3643
+ } = _b, context = __objRest(_b, [
3644
+ "dateStringFormatter",
3645
+ "error",
3646
+ "onChange"
3647
+ ]);
3616
3648
  const rawValue = context.getValue();
3617
3649
  const editMode = useEditMode();
3618
3650
  const formattedValue = (0, import_react8.useMemo)(
@@ -3628,8 +3660,8 @@ function EditableDateCell(props) {
3628
3660
  import_react_hook_form3.Controller,
3629
3661
  {
3630
3662
  name: context.column.id,
3631
- render: (_b) => {
3632
- var _c = _b, { field: _d } = _c, _e = _d, { value, onChange } = _e, field = __objRest(_e, ["value", "onChange"]), { fieldState: { error } } = _c;
3663
+ render: (_a2) => {
3664
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
3633
3665
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3634
3666
  InlineTextField,
3635
3667
  __spreadValues(__spreadValues({
@@ -3637,8 +3669,12 @@ function EditableDateCell(props) {
3637
3669
  type: "date",
3638
3670
  autoComplete: "none",
3639
3671
  value: value ? parseISODate(value) : "",
3640
- onChange: (e) => onChange(e.target.value ? parseISODate(e.target.value) : "")
3641
- }, getHelperTextProps({ error })), field)
3672
+ onChange: (e) => {
3673
+ const newDateString = e.target.value ? parseISODate(e.target.value) : "";
3674
+ onChange(newDateString);
3675
+ onChangeFromProps == null ? void 0 : onChangeFromProps(newDateString);
3676
+ }
3677
+ }, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
3642
3678
  );
3643
3679
  }
3644
3680
  }
@@ -3674,78 +3710,138 @@ var InlineTextField = (0, import_styled_components17.default)(import_eds_core_re
3674
3710
  `;
3675
3711
 
3676
3712
  // src/form-cells/EditableDropdownSingleCell.tsx
3677
- var import_eds_core_react23 = require("@equinor/eds-core-react");
3713
+ var import_eds_core_react24 = require("@equinor/eds-core-react");
3678
3714
  var import_react_hook_form4 = require("react-hook-form");
3715
+
3716
+ // src/form-cells/FormHelperText.tsx
3717
+ var import_eds_core_react23 = require("@equinor/eds-core-react");
3718
+ var import_eds_tokens6 = require("@equinor/eds-tokens");
3679
3719
  var import_jsx_runtime24 = require("react/jsx-runtime");
3720
+ var colors = {
3721
+ error: import_eds_tokens6.tokens.colors.interactive.danger__text.hex,
3722
+ warning: import_eds_tokens6.tokens.colors.interactive.warning__text.hex,
3723
+ success: import_eds_tokens6.tokens.colors.interactive.success__text.hex
3724
+ };
3725
+ function HelperText({ helperText, variant, helperIcon }) {
3726
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: helperText && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { marginTop: "8px", marginLeft: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3727
+ "div",
3728
+ {
3729
+ style: {
3730
+ display: "flex",
3731
+ alignItems: "flex-start",
3732
+ marginTop: "8px",
3733
+ color: variant ? colors[variant] : "inherit"
3734
+ },
3735
+ children: [
3736
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { flexShrink: 0 }, children: helperIcon }),
3737
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3738
+ import_eds_core_react23.Typography,
3739
+ {
3740
+ style: {
3741
+ fontSize: "0.75rem",
3742
+ fontWeight: 500,
3743
+ lineHeight: "1.333em",
3744
+ letterSpacing: "0.013em",
3745
+ textAlign: "left",
3746
+ margin: "0 0 0 8px",
3747
+ color: "inherit"
3748
+ },
3749
+ children: helperText
3750
+ }
3751
+ )
3752
+ ]
3753
+ }
3754
+ ) }) });
3755
+ }
3756
+
3757
+ // src/form-cells/EditableDropdownSingleCell.tsx
3758
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3680
3759
  function buildEmptyOption() {
3681
3760
  return { label: "", value: "" };
3682
3761
  }
3683
- function EditableDropdownSingleCell(props) {
3684
- const _a = props, { options } = _a, context = __objRest(_a, ["options"]);
3762
+ function EditableDropdownSingleCell(_a) {
3763
+ var _b = _a, {
3764
+ options,
3765
+ error: errorFromProps,
3766
+ onChange: onChangeFromProps
3767
+ } = _b, context = __objRest(_b, [
3768
+ "options",
3769
+ "error",
3770
+ "onChange"
3771
+ ]);
3685
3772
  const editMode = useEditMode();
3686
3773
  if (!editMode)
3687
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
3688
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3774
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
3775
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3689
3776
  import_react_hook_form4.Controller,
3690
3777
  {
3691
3778
  name: context.column.id,
3692
- render: (_b) => {
3693
- var { field: _c } = _b, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]);
3694
- var _a2;
3695
- const selectedOption = (_a2 = options.find((option) => option.value === value)) != null ? _a2 : buildEmptyOption();
3696
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3697
- import_eds_core_react23.Autocomplete,
3698
- __spreadValues({
3699
- label: "",
3700
- selectedOptions: selectedOption && [selectedOption],
3701
- options,
3702
- optionLabel: (option) => {
3703
- var _a3;
3704
- return (_a3 = option == null ? void 0 : option.label) != null ? _a3 : "";
3705
- },
3706
- "aria-required": true,
3707
- hideClearButton: true,
3708
- "aria-autocomplete": "none",
3709
- onOptionsChange: (changes) => {
3710
- const [change] = changes.selectedItems;
3711
- onChange(change == null ? void 0 : change.value);
3712
- }
3713
- }, field)
3714
- );
3779
+ render: (_a2) => {
3780
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
3781
+ var _a3;
3782
+ const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
3783
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3784
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3785
+ import_eds_core_react24.Autocomplete,
3786
+ __spreadValues({
3787
+ label: "",
3788
+ selectedOptions: selectedOption && [selectedOption],
3789
+ options,
3790
+ optionLabel: (option) => {
3791
+ var _a4;
3792
+ return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
3793
+ },
3794
+ "aria-required": true,
3795
+ hideClearButton: true,
3796
+ "aria-autocomplete": "none",
3797
+ onOptionsChange: (changes) => {
3798
+ const [change] = changes.selectedItems;
3799
+ onChange(change == null ? void 0 : change.value);
3800
+ onChangeFromProps == null ? void 0 : onChangeFromProps(change);
3801
+ }
3802
+ }, field)
3803
+ ),
3804
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
3805
+ ] });
3715
3806
  }
3716
3807
  }
3717
3808
  );
3718
3809
  }
3719
3810
 
3720
3811
  // src/form-cells/EditableNumberCell.tsx
3721
- var import_eds_core_react24 = require("@equinor/eds-core-react");
3812
+ var import_eds_core_react25 = require("@equinor/eds-core-react");
3722
3813
  var import_react_hook_form5 = require("react-hook-form");
3723
3814
  var import_styled_components18 = __toESM(require("styled-components"));
3724
- var import_jsx_runtime25 = require("react/jsx-runtime");
3725
- function EditableNumberCell(context) {
3815
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3816
+ function EditableNumberCell(_a) {
3817
+ var _b = _a, {
3818
+ error: errorFromProps
3819
+ } = _b, context = __objRest(_b, [
3820
+ "error"
3821
+ ]);
3726
3822
  const editMode = useEditMode();
3727
3823
  if (!editMode)
3728
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
3729
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3824
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
3825
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3730
3826
  import_react_hook_form5.Controller,
3731
3827
  {
3732
3828
  name: context.column.id,
3733
- render: (_a) => {
3734
- var _b = _a, { field: _c } = _b, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b;
3735
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3829
+ render: (_a2) => {
3830
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
3831
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3736
3832
  InlineTextField2,
3737
3833
  __spreadValues(__spreadValues({
3738
3834
  id: context.column.id,
3739
3835
  type: "number",
3740
3836
  autoComplete: "none",
3741
3837
  onChange: (e) => onChange(e.target.valueAsNumber)
3742
- }, field), getHelperTextProps({ error }))
3838
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3743
3839
  ) });
3744
3840
  }
3745
3841
  }
3746
3842
  );
3747
3843
  }
3748
- var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_react24.TextField)`
3844
+ var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_react25.TextField)`
3749
3845
  /*
3750
3846
  TODO: Improve input based on feedback from UX
3751
3847
  & > div {
@@ -3769,30 +3865,38 @@ var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_r
3769
3865
  `;
3770
3866
 
3771
3867
  // src/form-cells/EditableTextAreaCell.tsx
3772
- var import_eds_core_react25 = require("@equinor/eds-core-react");
3868
+ var import_eds_core_react26 = require("@equinor/eds-core-react");
3773
3869
  var import_eds_icons9 = require("@equinor/eds-icons");
3774
3870
  var import_react9 = require("react");
3775
3871
  var import_react_hook_form6 = require("react-hook-form");
3776
3872
  var import_styled_components19 = __toESM(require("styled-components"));
3777
- var import_jsx_runtime26 = require("react/jsx-runtime");
3778
- function EditableTextAreaCell(props) {
3779
- const _a = props, { title } = _a, context = __objRest(_a, ["title"]);
3873
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3874
+ function EditableTextAreaCell(_a) {
3875
+ var _b = _a, {
3876
+ title,
3877
+ error: errorFromProps,
3878
+ onChange: onChangeFromProps
3879
+ } = _b, context = __objRest(_b, [
3880
+ "title",
3881
+ "error",
3882
+ "onChange"
3883
+ ]);
3780
3884
  const [textareaValue, setTextareaValue] = (0, import_react9.useState)(context.getValue());
3781
3885
  const [open, setOpen] = (0, import_react9.useState)(false);
3782
3886
  const editMode = useEditMode();
3783
3887
  const name = context.column.id;
3784
3888
  if (!editMode)
3785
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverCell, { id: name + "popover", value: context.getValue(), title });
3889
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PopoverCell, { id: name + "popover", value: context.getValue(), title });
3786
3890
  const openDialog = () => setOpen(true);
3787
3891
  const closeDialog = () => setOpen(false);
3788
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3892
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3789
3893
  import_react_hook_form6.Controller,
3790
3894
  {
3791
3895
  name,
3792
- render: (_b) => {
3793
- var _c = _b, { field: _d } = _c, _e = _d, { onChange, ref } = _e, field = __objRest(_e, ["onChange", "ref"]), { fieldState: { error } } = _c;
3794
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3795
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3896
+ render: (_a2) => {
3897
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
3898
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
3899
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3796
3900
  "div",
3797
3901
  {
3798
3902
  style: {
@@ -3801,32 +3905,33 @@ function EditableTextAreaCell(props) {
3801
3905
  position: "relative"
3802
3906
  },
3803
3907
  children: [
3804
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3908
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3805
3909
  StyledTextField,
3806
3910
  __spreadValues(__spreadValues({
3807
3911
  id: field.name,
3808
3912
  onChange,
3809
3913
  ref
3810
- }, field), getHelperTextProps({ error }))
3914
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3811
3915
  ),
3812
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_eds_core_react25.Icon, { data: import_eds_icons9.arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
3916
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(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)" } }) })
3813
3917
  ]
3814
3918
  }
3815
3919
  ),
3816
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3817
- import_eds_core_react25.Dialog,
3920
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3921
+ import_eds_core_react26.Dialog,
3818
3922
  {
3819
3923
  open,
3820
3924
  onClose: () => {
3821
3925
  closeDialog();
3822
3926
  onChange(textareaValue);
3927
+ onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
3823
3928
  },
3824
3929
  isDismissable: true,
3825
3930
  style: { width: "min(50rem, calc(100vw - 4rem))" },
3826
3931
  children: [
3827
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_eds_core_react25.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_eds_core_react25.Dialog.Title, { children: title }) }),
3828
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_eds_core_react25.Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3829
- import_eds_core_react25.TextField,
3932
+ /* @__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 }) }),
3933
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3934
+ import_eds_core_react26.TextField,
3830
3935
  {
3831
3936
  style: {
3832
3937
  maxWidth: "100%",
@@ -3842,19 +3947,20 @@ function EditableTextAreaCell(props) {
3842
3947
  }
3843
3948
  }
3844
3949
  ) }),
3845
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_eds_core_react25.Dialog.Actions, { style: { display: "flex", gap: "1rem" }, children: [
3846
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3847
- import_eds_core_react25.Button,
3950
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_eds_core_react26.Dialog.Actions, { style: { display: "flex", gap: "1rem" }, children: [
3951
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3952
+ import_eds_core_react26.Button,
3848
3953
  {
3849
3954
  onClick: () => {
3850
3955
  closeDialog();
3851
3956
  onChange(textareaValue);
3957
+ onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
3852
3958
  },
3853
3959
  children: "Submit"
3854
3960
  }
3855
3961
  ),
3856
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3857
- import_eds_core_react25.Button,
3962
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3963
+ import_eds_core_react26.Button,
3858
3964
  {
3859
3965
  variant: "ghost",
3860
3966
  onClick: () => {
@@ -3873,7 +3979,7 @@ function EditableTextAreaCell(props) {
3873
3979
  }
3874
3980
  );
3875
3981
  }
3876
- var StyledTextField = (0, import_styled_components19.default)(import_eds_core_react25.TextField)`
3982
+ var StyledTextField = (0, import_styled_components19.default)(import_eds_core_react26.TextField)`
3877
3983
  & input {
3878
3984
  padding-right: 40px;
3879
3985
  letter-spacing: 0;
@@ -3882,7 +3988,7 @@ var StyledTextField = (0, import_styled_components19.default)(import_eds_core_re
3882
3988
  text-overflow: ellipsis;
3883
3989
  }
3884
3990
  `;
3885
- var IconButton = (0, import_styled_components19.default)(import_eds_core_react25.Button)`
3991
+ var IconButton = (0, import_styled_components19.default)(import_eds_core_react26.Button)`
3886
3992
  position: absolute;
3887
3993
  height: 32px;
3888
3994
  width: 32px;
@@ -3890,33 +3996,38 @@ var IconButton = (0, import_styled_components19.default)(import_eds_core_react25
3890
3996
  `;
3891
3997
 
3892
3998
  // src/form-cells/EditableTextFieldCell.tsx
3893
- var import_eds_core_react26 = require("@equinor/eds-core-react");
3999
+ var import_eds_core_react27 = require("@equinor/eds-core-react");
3894
4000
  var import_react_hook_form7 = require("react-hook-form");
3895
4001
  var import_styled_components20 = __toESM(require("styled-components"));
3896
- var import_jsx_runtime27 = require("react/jsx-runtime");
3897
- function EditableTextFieldCell(context) {
4002
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4003
+ function EditableTextFieldCell(_a) {
4004
+ var _b = _a, {
4005
+ error: errorFromProps
4006
+ } = _b, context = __objRest(_b, [
4007
+ "error"
4008
+ ]);
3898
4009
  const editMode = useEditMode();
3899
4010
  if (!editMode)
3900
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
3901
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4011
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
4012
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3902
4013
  import_react_hook_form7.Controller,
3903
4014
  {
3904
4015
  name: context.column.id,
3905
- render: (_a) => {
3906
- var _b = _a, { field: _c } = _b, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b;
3907
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4016
+ render: (_a2) => {
4017
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
4018
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3908
4019
  InlineTextField3,
3909
4020
  __spreadValues(__spreadValues({
3910
4021
  id: context.column.id,
3911
4022
  autoComplete: "none",
3912
4023
  value: String(value != null ? value : "")
3913
- }, field), getHelperTextProps({ error }))
4024
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3914
4025
  );
3915
4026
  }
3916
4027
  }
3917
4028
  );
3918
4029
  }
3919
- var InlineTextField3 = (0, import_styled_components20.default)(import_eds_core_react26.TextField)`
4030
+ var InlineTextField3 = (0, import_styled_components20.default)(import_eds_core_react27.TextField)`
3920
4031
  /*
3921
4032
  TODO: Improve input based on feedback from UX
3922
4033
  & > div {
package/dist/index.mjs CHANGED
@@ -3006,15 +3006,11 @@ var TableBody = styled12(Table6.Body)`
3006
3006
  import { Table as Table7 } from "@equinor/eds-core-react";
3007
3007
  import styled13 from "styled-components";
3008
3008
  import { jsx as jsx14 } from "react/jsx-runtime";
3009
- function TableRow({
3010
- row,
3011
- rowConfig,
3012
- cellConfig,
3013
- measureElement,
3014
- index
3015
- }) {
3009
+ function TableRow(props) {
3016
3010
  var _a;
3011
+ const { row, rowConfig, cellConfig, measureElement, index } = props;
3017
3012
  const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
3013
+ console.log("Hello");
3018
3014
  const tableRowContent = /* @__PURE__ */ jsx14(
3019
3015
  StyledTableRow,
3020
3016
  {
@@ -3159,19 +3155,20 @@ function TableBanner({
3159
3155
  tableCaption,
3160
3156
  globalFilter
3161
3157
  }) {
3162
- var _a, _b;
3158
+ var _a, _b, _c, _d, _e;
3163
3159
  return /* @__PURE__ */ jsxs9(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
3164
3160
  /* @__PURE__ */ jsxs9(FilterContainer, { className: "--filter-container-left", children: [
3165
3161
  (bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx17(Typography3, { variant: "h3", as: "h2", children: tableCaption }),
3166
- (_a = bannerConfig == null ? void 0 : bannerConfig.customActions) == null ? void 0 : _a.call(bannerConfig, table)
3162
+ (_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
3163
  ] }),
3168
3164
  /* @__PURE__ */ jsx17(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ jsxs9(Fragment3, { children: [
3165
+ (_d = bannerConfig == null ? void 0 : bannerConfig.customActionsRight) == null ? void 0 : _d.call(bannerConfig, table),
3169
3166
  (bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ jsx17(
3170
3167
  DebouncedInput,
3171
3168
  {
3172
3169
  value: globalFilter.state,
3173
3170
  icon: search,
3174
- placeholder: (_b = bannerConfig.globalFilterPlaceholder) != null ? _b : "Search all columns",
3171
+ placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
3175
3172
  onChange: (value) => globalFilter.onChange(String(value))
3176
3173
  }
3177
3174
  ),
@@ -3508,7 +3505,12 @@ function addFormMeta(withoutFormMeta) {
3508
3505
 
3509
3506
  // src/form-cells/EditableCheckboxCell.tsx
3510
3507
  import { jsx as jsx21 } from "react/jsx-runtime";
3511
- function EditableCheckboxCell(context) {
3508
+ function EditableCheckboxCell(_a) {
3509
+ var _b = _a, {
3510
+ onChange: onChangeFromProps
3511
+ } = _b, context = __objRest(_b, [
3512
+ "onChange"
3513
+ ]);
3512
3514
  const editMode = useEditMode();
3513
3515
  if (!editMode)
3514
3516
  return /* @__PURE__ */ jsx21(
@@ -3525,9 +3527,21 @@ function EditableCheckboxCell(context) {
3525
3527
  Controller,
3526
3528
  {
3527
3529
  name: context.column.id,
3528
- render: (_a) => {
3529
- var { field: _b } = _a, _c = _b, { value } = _c, field = __objRest(_c, ["value"]);
3530
- return /* @__PURE__ */ jsx21(Checkbox4, __spreadValues({ enterKeyHint: "send", "aria-label": "editable", checked: value }, field));
3530
+ render: (_a2) => {
3531
+ var { field: _b2 } = _a2, _c = _b2, { value, onChange } = _c, field = __objRest(_c, ["value", "onChange"]);
3532
+ return /* @__PURE__ */ jsx21(
3533
+ Checkbox4,
3534
+ __spreadProps(__spreadValues({
3535
+ enterKeyHint: "send",
3536
+ "aria-label": "editable",
3537
+ checked: value
3538
+ }, field), {
3539
+ onChange: (e) => {
3540
+ onChange(e);
3541
+ onChangeFromProps == null ? void 0 : onChangeFromProps(e.target.checked);
3542
+ }
3543
+ })
3544
+ );
3531
3545
  }
3532
3546
  }
3533
3547
  );
@@ -3543,17 +3557,27 @@ import styled17 from "styled-components";
3543
3557
  import { Icon as Icon7 } from "@equinor/eds-core-react";
3544
3558
  import { error_filled, warning_filled } from "@equinor/eds-icons";
3545
3559
  import { jsx as jsx22 } from "react/jsx-runtime";
3560
+ var WARNING_PREFIX = "WARNING";
3546
3561
  function getHelperTextProps({
3547
3562
  error,
3548
3563
  warning,
3549
3564
  helperText
3550
3565
  }) {
3551
- if (error)
3566
+ var _a;
3567
+ if (error) {
3568
+ if ((_a = error.message) == null ? void 0 : _a.startsWith(WARNING_PREFIX)) {
3569
+ return {
3570
+ variant: "warning",
3571
+ helperText: error.message.substring(WARNING_PREFIX.length - 1),
3572
+ helperIcon: /* @__PURE__ */ jsx22(Icon7, { data: warning_filled, size: 16 })
3573
+ };
3574
+ }
3552
3575
  return {
3553
3576
  variant: "error",
3554
3577
  helperText: error.message,
3555
3578
  helperIcon: /* @__PURE__ */ jsx22(Icon7, { data: error_filled, size: 16 })
3556
3579
  };
3580
+ }
3557
3581
  if (warning)
3558
3582
  return {
3559
3583
  variant: "warning",
@@ -3574,8 +3598,16 @@ function stopPropagation2(handler) {
3574
3598
 
3575
3599
  // src/form-cells/EditableDateCell.tsx
3576
3600
  import { jsx as jsx23 } from "react/jsx-runtime";
3577
- function EditableDateCell(props) {
3578
- const _a = props, { dateStringFormatter } = _a, context = __objRest(_a, ["dateStringFormatter"]);
3601
+ function EditableDateCell(_a) {
3602
+ var _b = _a, {
3603
+ dateStringFormatter,
3604
+ error: errorFromProps,
3605
+ onChange: onChangeFromProps
3606
+ } = _b, context = __objRest(_b, [
3607
+ "dateStringFormatter",
3608
+ "error",
3609
+ "onChange"
3610
+ ]);
3579
3611
  const rawValue = context.getValue();
3580
3612
  const editMode = useEditMode();
3581
3613
  const formattedValue = useMemo(
@@ -3591,8 +3623,8 @@ function EditableDateCell(props) {
3591
3623
  Controller2,
3592
3624
  {
3593
3625
  name: context.column.id,
3594
- render: (_b) => {
3595
- var _c = _b, { field: _d } = _c, _e = _d, { value, onChange } = _e, field = __objRest(_e, ["value", "onChange"]), { fieldState: { error } } = _c;
3626
+ render: (_a2) => {
3627
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
3596
3628
  return /* @__PURE__ */ jsx23(
3597
3629
  InlineTextField,
3598
3630
  __spreadValues(__spreadValues({
@@ -3600,8 +3632,12 @@ function EditableDateCell(props) {
3600
3632
  type: "date",
3601
3633
  autoComplete: "none",
3602
3634
  value: value ? parseISODate(value) : "",
3603
- onChange: (e) => onChange(e.target.value ? parseISODate(e.target.value) : "")
3604
- }, getHelperTextProps({ error })), field)
3635
+ onChange: (e) => {
3636
+ const newDateString = e.target.value ? parseISODate(e.target.value) : "";
3637
+ onChange(newDateString);
3638
+ onChangeFromProps == null ? void 0 : onChangeFromProps(newDateString);
3639
+ }
3640
+ }, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
3605
3641
  );
3606
3642
  }
3607
3643
  }
@@ -3639,42 +3675,97 @@ var InlineTextField = styled17(TextField)`
3639
3675
  // src/form-cells/EditableDropdownSingleCell.tsx
3640
3676
  import { Autocomplete } from "@equinor/eds-core-react";
3641
3677
  import { Controller as Controller3 } from "react-hook-form";
3642
- import { jsx as jsx24 } from "react/jsx-runtime";
3678
+
3679
+ // src/form-cells/FormHelperText.tsx
3680
+ import { Typography as Typography4 } from "@equinor/eds-core-react";
3681
+ import { tokens as tokens6 } from "@equinor/eds-tokens";
3682
+ import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
3683
+ var colors = {
3684
+ error: tokens6.colors.interactive.danger__text.hex,
3685
+ warning: tokens6.colors.interactive.warning__text.hex,
3686
+ success: tokens6.colors.interactive.success__text.hex
3687
+ };
3688
+ function HelperText({ helperText, variant, helperIcon }) {
3689
+ return /* @__PURE__ */ jsx24(Fragment4, { children: helperText && /* @__PURE__ */ jsx24("div", { style: { marginTop: "8px", marginLeft: "8px" }, children: /* @__PURE__ */ jsxs12(
3690
+ "div",
3691
+ {
3692
+ style: {
3693
+ display: "flex",
3694
+ alignItems: "flex-start",
3695
+ marginTop: "8px",
3696
+ color: variant ? colors[variant] : "inherit"
3697
+ },
3698
+ children: [
3699
+ /* @__PURE__ */ jsx24("span", { style: { flexShrink: 0 }, children: helperIcon }),
3700
+ /* @__PURE__ */ jsx24(
3701
+ Typography4,
3702
+ {
3703
+ style: {
3704
+ fontSize: "0.75rem",
3705
+ fontWeight: 500,
3706
+ lineHeight: "1.333em",
3707
+ letterSpacing: "0.013em",
3708
+ textAlign: "left",
3709
+ margin: "0 0 0 8px",
3710
+ color: "inherit"
3711
+ },
3712
+ children: helperText
3713
+ }
3714
+ )
3715
+ ]
3716
+ }
3717
+ ) }) });
3718
+ }
3719
+
3720
+ // src/form-cells/EditableDropdownSingleCell.tsx
3721
+ import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
3643
3722
  function buildEmptyOption() {
3644
3723
  return { label: "", value: "" };
3645
3724
  }
3646
- function EditableDropdownSingleCell(props) {
3647
- const _a = props, { options } = _a, context = __objRest(_a, ["options"]);
3725
+ function EditableDropdownSingleCell(_a) {
3726
+ var _b = _a, {
3727
+ options,
3728
+ error: errorFromProps,
3729
+ onChange: onChangeFromProps
3730
+ } = _b, context = __objRest(_b, [
3731
+ "options",
3732
+ "error",
3733
+ "onChange"
3734
+ ]);
3648
3735
  const editMode = useEditMode();
3649
3736
  if (!editMode)
3650
- return /* @__PURE__ */ jsx24(TypographyCustom, { truncate: true, children: context.getValue() });
3651
- return /* @__PURE__ */ jsx24(
3737
+ return /* @__PURE__ */ jsx25(TypographyCustom, { truncate: true, children: context.getValue() });
3738
+ return /* @__PURE__ */ jsx25(
3652
3739
  Controller3,
3653
3740
  {
3654
3741
  name: context.column.id,
3655
- render: (_b) => {
3656
- var { field: _c } = _b, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]);
3657
- var _a2;
3658
- const selectedOption = (_a2 = options.find((option) => option.value === value)) != null ? _a2 : buildEmptyOption();
3659
- return /* @__PURE__ */ jsx24(
3660
- Autocomplete,
3661
- __spreadValues({
3662
- label: "",
3663
- selectedOptions: selectedOption && [selectedOption],
3664
- options,
3665
- optionLabel: (option) => {
3666
- var _a3;
3667
- return (_a3 = option == null ? void 0 : option.label) != null ? _a3 : "";
3668
- },
3669
- "aria-required": true,
3670
- hideClearButton: true,
3671
- "aria-autocomplete": "none",
3672
- onOptionsChange: (changes) => {
3673
- const [change] = changes.selectedItems;
3674
- onChange(change == null ? void 0 : change.value);
3675
- }
3676
- }, field)
3677
- );
3742
+ render: (_a2) => {
3743
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
3744
+ var _a3;
3745
+ const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
3746
+ return /* @__PURE__ */ jsxs13(Fragment5, { children: [
3747
+ /* @__PURE__ */ jsx25(
3748
+ Autocomplete,
3749
+ __spreadValues({
3750
+ label: "",
3751
+ selectedOptions: selectedOption && [selectedOption],
3752
+ options,
3753
+ optionLabel: (option) => {
3754
+ var _a4;
3755
+ return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
3756
+ },
3757
+ "aria-required": true,
3758
+ hideClearButton: true,
3759
+ "aria-autocomplete": "none",
3760
+ onOptionsChange: (changes) => {
3761
+ const [change] = changes.selectedItems;
3762
+ onChange(change == null ? void 0 : change.value);
3763
+ onChangeFromProps == null ? void 0 : onChangeFromProps(change);
3764
+ }
3765
+ }, field)
3766
+ ),
3767
+ /* @__PURE__ */ jsx25(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
3768
+ ] });
3678
3769
  }
3679
3770
  }
3680
3771
  );
@@ -3684,25 +3775,30 @@ function EditableDropdownSingleCell(props) {
3684
3775
  import { TextField as TextField2 } from "@equinor/eds-core-react";
3685
3776
  import { Controller as Controller4 } from "react-hook-form";
3686
3777
  import styled18 from "styled-components";
3687
- import { Fragment as Fragment4, jsx as jsx25 } from "react/jsx-runtime";
3688
- function EditableNumberCell(context) {
3778
+ import { Fragment as Fragment6, jsx as jsx26 } from "react/jsx-runtime";
3779
+ function EditableNumberCell(_a) {
3780
+ var _b = _a, {
3781
+ error: errorFromProps
3782
+ } = _b, context = __objRest(_b, [
3783
+ "error"
3784
+ ]);
3689
3785
  const editMode = useEditMode();
3690
3786
  if (!editMode)
3691
- return /* @__PURE__ */ jsx25(TypographyCustom, { truncate: true, children: context.getValue() });
3692
- return /* @__PURE__ */ jsx25(
3787
+ return /* @__PURE__ */ jsx26(TypographyCustom, { truncate: true, children: context.getValue() });
3788
+ return /* @__PURE__ */ jsx26(
3693
3789
  Controller4,
3694
3790
  {
3695
3791
  name: context.column.id,
3696
- render: (_a) => {
3697
- var _b = _a, { field: _c } = _b, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b;
3698
- return /* @__PURE__ */ jsx25(Fragment4, { children: /* @__PURE__ */ jsx25(
3792
+ render: (_a2) => {
3793
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
3794
+ return /* @__PURE__ */ jsx26(Fragment6, { children: /* @__PURE__ */ jsx26(
3699
3795
  InlineTextField2,
3700
3796
  __spreadValues(__spreadValues({
3701
3797
  id: context.column.id,
3702
3798
  type: "number",
3703
3799
  autoComplete: "none",
3704
3800
  onChange: (e) => onChange(e.target.valueAsNumber)
3705
- }, field), getHelperTextProps({ error }))
3801
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3706
3802
  ) });
3707
3803
  }
3708
3804
  }
@@ -3737,25 +3833,33 @@ import { arrow_up } from "@equinor/eds-icons";
3737
3833
  import { useState as useState7 } from "react";
3738
3834
  import { Controller as Controller5 } from "react-hook-form";
3739
3835
  import styled19 from "styled-components";
3740
- import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
3741
- function EditableTextAreaCell(props) {
3742
- const _a = props, { title } = _a, context = __objRest(_a, ["title"]);
3836
+ import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
3837
+ function EditableTextAreaCell(_a) {
3838
+ var _b = _a, {
3839
+ title,
3840
+ error: errorFromProps,
3841
+ onChange: onChangeFromProps
3842
+ } = _b, context = __objRest(_b, [
3843
+ "title",
3844
+ "error",
3845
+ "onChange"
3846
+ ]);
3743
3847
  const [textareaValue, setTextareaValue] = useState7(context.getValue());
3744
3848
  const [open, setOpen] = useState7(false);
3745
3849
  const editMode = useEditMode();
3746
3850
  const name = context.column.id;
3747
3851
  if (!editMode)
3748
- return /* @__PURE__ */ jsx26(PopoverCell, { id: name + "popover", value: context.getValue(), title });
3852
+ return /* @__PURE__ */ jsx27(PopoverCell, { id: name + "popover", value: context.getValue(), title });
3749
3853
  const openDialog = () => setOpen(true);
3750
3854
  const closeDialog = () => setOpen(false);
3751
- return /* @__PURE__ */ jsx26(
3855
+ return /* @__PURE__ */ jsx27(
3752
3856
  Controller5,
3753
3857
  {
3754
3858
  name,
3755
- render: (_b) => {
3756
- var _c = _b, { field: _d } = _c, _e = _d, { onChange, ref } = _e, field = __objRest(_e, ["onChange", "ref"]), { fieldState: { error } } = _c;
3757
- return /* @__PURE__ */ jsxs12(Fragment5, { children: [
3758
- /* @__PURE__ */ jsxs12(
3859
+ render: (_a2) => {
3860
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
3861
+ return /* @__PURE__ */ jsxs14(Fragment7, { children: [
3862
+ /* @__PURE__ */ jsxs14(
3759
3863
  "div",
3760
3864
  {
3761
3865
  style: {
@@ -3764,31 +3868,32 @@ function EditableTextAreaCell(props) {
3764
3868
  position: "relative"
3765
3869
  },
3766
3870
  children: [
3767
- /* @__PURE__ */ jsx26(
3871
+ /* @__PURE__ */ jsx27(
3768
3872
  StyledTextField,
3769
3873
  __spreadValues(__spreadValues({
3770
3874
  id: field.name,
3771
3875
  onChange,
3772
3876
  ref
3773
- }, field), getHelperTextProps({ error }))
3877
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3774
3878
  ),
3775
- /* @__PURE__ */ jsx26(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ jsx26(Icon8, { data: arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
3879
+ /* @__PURE__ */ jsx27(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ jsx27(Icon8, { data: arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
3776
3880
  ]
3777
3881
  }
3778
3882
  ),
3779
- /* @__PURE__ */ jsxs12(
3883
+ /* @__PURE__ */ jsxs14(
3780
3884
  EDS,
3781
3885
  {
3782
3886
  open,
3783
3887
  onClose: () => {
3784
3888
  closeDialog();
3785
3889
  onChange(textareaValue);
3890
+ onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
3786
3891
  },
3787
3892
  isDismissable: true,
3788
3893
  style: { width: "min(50rem, calc(100vw - 4rem))" },
3789
3894
  children: [
3790
- /* @__PURE__ */ jsx26(EDS.Header, { children: /* @__PURE__ */ jsx26(EDS.Title, { children: title }) }),
3791
- /* @__PURE__ */ jsx26(EDS.Content, { children: /* @__PURE__ */ jsx26(
3895
+ /* @__PURE__ */ jsx27(EDS.Header, { children: /* @__PURE__ */ jsx27(EDS.Title, { children: title }) }),
3896
+ /* @__PURE__ */ jsx27(EDS.Content, { children: /* @__PURE__ */ jsx27(
3792
3897
  TextField3,
3793
3898
  {
3794
3899
  style: {
@@ -3805,18 +3910,19 @@ function EditableTextAreaCell(props) {
3805
3910
  }
3806
3911
  }
3807
3912
  ) }),
3808
- /* @__PURE__ */ jsxs12(EDS.Actions, { style: { display: "flex", gap: "1rem" }, children: [
3809
- /* @__PURE__ */ jsx26(
3913
+ /* @__PURE__ */ jsxs14(EDS.Actions, { style: { display: "flex", gap: "1rem" }, children: [
3914
+ /* @__PURE__ */ jsx27(
3810
3915
  Button5,
3811
3916
  {
3812
3917
  onClick: () => {
3813
3918
  closeDialog();
3814
3919
  onChange(textareaValue);
3920
+ onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
3815
3921
  },
3816
3922
  children: "Submit"
3817
3923
  }
3818
3924
  ),
3819
- /* @__PURE__ */ jsx26(
3925
+ /* @__PURE__ */ jsx27(
3820
3926
  Button5,
3821
3927
  {
3822
3928
  variant: "ghost",
@@ -3856,24 +3962,29 @@ var IconButton = styled19(Button5)`
3856
3962
  import { TextField as TextField4 } from "@equinor/eds-core-react";
3857
3963
  import { Controller as Controller6 } from "react-hook-form";
3858
3964
  import styled20 from "styled-components";
3859
- import { jsx as jsx27 } from "react/jsx-runtime";
3860
- function EditableTextFieldCell(context) {
3965
+ import { jsx as jsx28 } from "react/jsx-runtime";
3966
+ function EditableTextFieldCell(_a) {
3967
+ var _b = _a, {
3968
+ error: errorFromProps
3969
+ } = _b, context = __objRest(_b, [
3970
+ "error"
3971
+ ]);
3861
3972
  const editMode = useEditMode();
3862
3973
  if (!editMode)
3863
- return /* @__PURE__ */ jsx27(TypographyCustom, { truncate: true, children: context.getValue() });
3864
- return /* @__PURE__ */ jsx27(
3974
+ return /* @__PURE__ */ jsx28(TypographyCustom, { truncate: true, children: context.getValue() });
3975
+ return /* @__PURE__ */ jsx28(
3865
3976
  Controller6,
3866
3977
  {
3867
3978
  name: context.column.id,
3868
- render: (_a) => {
3869
- var _b = _a, { field: _c } = _b, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b;
3870
- return /* @__PURE__ */ jsx27(
3979
+ render: (_a2) => {
3980
+ var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
3981
+ return /* @__PURE__ */ jsx28(
3871
3982
  InlineTextField3,
3872
3983
  __spreadValues(__spreadValues({
3873
3984
  id: context.column.id,
3874
3985
  autoComplete: "none",
3875
3986
  value: String(value != null ? value : "")
3876
- }, field), getHelperTextProps({ error }))
3987
+ }, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
3877
3988
  );
3878
3989
  }
3879
3990
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/apollo-components",
3
- "version": "3.2.1",
3
+ "version": "3.3.0-beta.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",