@equinor/apollo-components 3.7.3-beta.0 → 3.7.3-beta.1

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.mts CHANGED
@@ -362,8 +362,9 @@ interface EditableDropdownSingleCellProps<T extends FormMeta> extends Omit<Edita
362
362
  */
363
363
  options: Option[];
364
364
  onChange?: (value: Option) => void;
365
+ label?: string;
365
366
  }
366
- declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, onChange: onChangeFromProps, ...context }: EditableDropdownSingleCellProps<T>): react_jsx_runtime.JSX.Element;
367
+ declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, onChange: onChangeFromProps, label, ...context }: EditableDropdownSingleCellProps<T>): react_jsx_runtime.JSX.Element;
367
368
 
368
369
  declare function EditableNumberCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableCellBaseProps<T, number>): react_jsx_runtime.JSX.Element;
369
370
 
package/dist/index.d.ts CHANGED
@@ -362,8 +362,9 @@ interface EditableDropdownSingleCellProps<T extends FormMeta> extends Omit<Edita
362
362
  */
363
363
  options: Option[];
364
364
  onChange?: (value: Option) => void;
365
+ label?: string;
365
366
  }
366
- declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, onChange: onChangeFromProps, ...context }: EditableDropdownSingleCellProps<T>): react_jsx_runtime.JSX.Element;
367
+ declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, onChange: onChangeFromProps, label, ...context }: EditableDropdownSingleCellProps<T>): react_jsx_runtime.JSX.Element;
367
368
 
368
369
  declare function EditableNumberCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableCellBaseProps<T, number>): react_jsx_runtime.JSX.Element;
369
370
 
package/dist/index.js CHANGED
@@ -1514,18 +1514,17 @@ function HelperText({ helperText, variant, helperIcon }) {
1514
1514
 
1515
1515
  // src/form-cells/EditableDropdownSingleCell.tsx
1516
1516
  var import_jsx_runtime25 = require("react/jsx-runtime");
1517
- function buildEmptyOption() {
1518
- return { label: "", value: "" };
1519
- }
1520
1517
  function EditableDropdownSingleCell(_a) {
1521
1518
  var _b = _a, {
1522
1519
  options,
1523
1520
  error: errorFromProps,
1524
- onChange: onChangeFromProps
1521
+ onChange: onChangeFromProps,
1522
+ label = ""
1525
1523
  } = _b, context = __objRest(_b, [
1526
1524
  "options",
1527
1525
  "error",
1528
- "onChange"
1526
+ "onChange",
1527
+ "label"
1529
1528
  ]);
1530
1529
  const editMode = useEditMode();
1531
1530
  if (!editMode) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
@@ -1535,18 +1534,17 @@ function EditableDropdownSingleCell(_a) {
1535
1534
  name: context.column.id,
1536
1535
  render: (_a2) => {
1537
1536
  var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
1538
- var _a3;
1539
- const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
1537
+ const selectedOption = options.find((option) => option.value === value);
1540
1538
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
1541
1539
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1542
1540
  import_eds_core_react24.Autocomplete,
1543
1541
  __spreadValues({
1544
- label: "",
1545
- selectedOptions: [selectedOption],
1542
+ label,
1543
+ selectedOptions: selectedOption ? [selectedOption] : [],
1546
1544
  options,
1547
1545
  optionLabel: (option) => {
1548
- var _a4;
1549
- return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
1546
+ var _a3;
1547
+ return (_a3 = option == null ? void 0 : option.label) != null ? _a3 : "";
1550
1548
  },
1551
1549
  "aria-required": true,
1552
1550
  hideClearButton: true,
@@ -1555,7 +1553,8 @@ function EditableDropdownSingleCell(_a) {
1555
1553
  const [change] = changes.selectedItems;
1556
1554
  onChange(change == null ? void 0 : change.value);
1557
1555
  onChangeFromProps == null ? void 0 : onChangeFromProps(change);
1558
- }
1556
+ },
1557
+ clearSearchOnChange: true
1559
1558
  }, field)
1560
1559
  ),
1561
1560
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
package/dist/index.mjs CHANGED
@@ -1447,18 +1447,17 @@ function HelperText({ helperText, variant, helperIcon }) {
1447
1447
 
1448
1448
  // src/form-cells/EditableDropdownSingleCell.tsx
1449
1449
  import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
1450
- function buildEmptyOption() {
1451
- return { label: "", value: "" };
1452
- }
1453
1450
  function EditableDropdownSingleCell(_a) {
1454
1451
  var _b = _a, {
1455
1452
  options,
1456
1453
  error: errorFromProps,
1457
- onChange: onChangeFromProps
1454
+ onChange: onChangeFromProps,
1455
+ label = ""
1458
1456
  } = _b, context = __objRest(_b, [
1459
1457
  "options",
1460
1458
  "error",
1461
- "onChange"
1459
+ "onChange",
1460
+ "label"
1462
1461
  ]);
1463
1462
  const editMode = useEditMode();
1464
1463
  if (!editMode) return /* @__PURE__ */ jsx25(TypographyCustom, { truncate: true, children: context.getValue() });
@@ -1468,18 +1467,17 @@ function EditableDropdownSingleCell(_a) {
1468
1467
  name: context.column.id,
1469
1468
  render: (_a2) => {
1470
1469
  var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
1471
- var _a3;
1472
- const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
1470
+ const selectedOption = options.find((option) => option.value === value);
1473
1471
  return /* @__PURE__ */ jsxs13(Fragment5, { children: [
1474
1472
  /* @__PURE__ */ jsx25(
1475
1473
  Autocomplete,
1476
1474
  __spreadValues({
1477
- label: "",
1478
- selectedOptions: [selectedOption],
1475
+ label,
1476
+ selectedOptions: selectedOption ? [selectedOption] : [],
1479
1477
  options,
1480
1478
  optionLabel: (option) => {
1481
- var _a4;
1482
- return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
1479
+ var _a3;
1480
+ return (_a3 = option == null ? void 0 : option.label) != null ? _a3 : "";
1483
1481
  },
1484
1482
  "aria-required": true,
1485
1483
  hideClearButton: true,
@@ -1488,7 +1486,8 @@ function EditableDropdownSingleCell(_a) {
1488
1486
  const [change] = changes.selectedItems;
1489
1487
  onChange(change == null ? void 0 : change.value);
1490
1488
  onChangeFromProps == null ? void 0 : onChangeFromProps(change);
1491
- }
1489
+ },
1490
+ clearSearchOnChange: true
1492
1491
  }, field)
1493
1492
  ),
1494
1493
  /* @__PURE__ */ jsx25(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/apollo-components",
3
- "version": "3.7.3-beta.0",
3
+ "version": "3.7.3-beta.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",