@aivenio/aquarium 2.5.2 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/system.mjs CHANGED
@@ -10256,6 +10256,15 @@ var isOptionGroup = (val) => {
10256
10256
  var hasOptionGroups = (val) => {
10257
10257
  return val.some(isOptionGroup);
10258
10258
  };
10259
+ var defaultGetValue = (opt) => {
10260
+ if (typeof opt === "string") {
10261
+ return opt;
10262
+ }
10263
+ if (typeof opt.value === "string") {
10264
+ return opt.value;
10265
+ }
10266
+ return opt;
10267
+ };
10259
10268
 
10260
10269
  // src/molecules/Combobox/Combobox.tsx
10261
10270
  var import_smallCross2 = __toESM(require_smallCross());
@@ -10330,6 +10339,12 @@ var ComboboxBase = (_a) => {
10330
10339
  }
10331
10340
  }
10332
10341
  };
10342
+ const findItemByValue = (val) => {
10343
+ if (val === null) {
10344
+ return null;
10345
+ }
10346
+ return val === void 0 ? void 0 : inputItems.find((opt) => defaultGetValue(opt) === defaultGetValue(val));
10347
+ };
10333
10348
  const {
10334
10349
  isOpen,
10335
10350
  openMenu,
@@ -10345,8 +10360,8 @@ var ComboboxBase = (_a) => {
10345
10360
  selectItem
10346
10361
  } = useCombobox({
10347
10362
  id,
10348
- selectedItem: value,
10349
- defaultSelectedItem: defaultValue,
10363
+ selectedItem: findItemByValue(value),
10364
+ defaultSelectedItem: findItemByValue(defaultValue),
10350
10365
  isItemDisabled: (item, index) => isOptionDisabled(item, index),
10351
10366
  itemToString,
10352
10367
  items: inputItems,
@@ -10520,7 +10535,7 @@ import { useControlledState } from "@react-stately/utils";
10520
10535
  import castArray2 from "lodash/castArray";
10521
10536
  import compact from "lodash/compact";
10522
10537
  import groupBy2 from "lodash/groupBy";
10523
- import isArray3 from "lodash/isArray";
10538
+ import isArray2 from "lodash/isArray";
10524
10539
  import isFunction3 from "lodash/isFunction";
10525
10540
 
10526
10541
  // src/molecules/List/List.tsx
@@ -10730,16 +10745,12 @@ import { useId as useId8 } from "@react-aria/utils";
10730
10745
  import { useSelect } from "downshift";
10731
10746
  import { without } from "lodash";
10732
10747
  import defaults from "lodash/defaults";
10733
- import isArray from "lodash/isArray";
10734
10748
  import isNil from "lodash/isNil";
10735
10749
  import omit6 from "lodash/omit";
10736
10750
  var hasIconProperty = (val) => {
10737
10751
  var _a;
10738
10752
  return typeof val === "string" || ((_a = val == null ? void 0 : val.icon) == null ? void 0 : _a.body) !== void 0;
10739
10753
  };
10740
- var hasOptionGroups2 = (val) => {
10741
- return !val.some((opt) => (opt == null ? void 0 : opt.label) === void 0 || !isArray(opt == null ? void 0 : opt.options));
10742
- };
10743
10754
  var defaultRenderOption = (item, props, { selectedItem }, { getOptionKey, getValue, optionToString = getOptionLabelBuiltin }) => {
10744
10755
  var _a, _b;
10745
10756
  return /* @__PURE__ */ React58.createElement(Select.Item, __spreadValues({
@@ -10749,15 +10760,6 @@ var defaultRenderOption = (item, props, { selectedItem }, { getOptionKey, getVal
10749
10760
  icon: item.icon
10750
10761
  }), optionToString(item));
10751
10762
  };
10752
- var defaultGetValue = (opt) => {
10753
- if (typeof opt === "string") {
10754
- return opt;
10755
- }
10756
- if (typeof opt.value === "string") {
10757
- return opt.value;
10758
- }
10759
- return "";
10760
- };
10761
10763
  var _SelectBase = (props) => {
10762
10764
  var _b;
10763
10765
  const withDefaults = defaults({}, props, {
@@ -10817,7 +10819,7 @@ var _SelectBase = (props) => {
10817
10819
  const [hasFocus, setFocus] = useState8(false);
10818
10820
  const targetRef = useRef7(null);
10819
10821
  const menuRef = useRef7(null);
10820
- const items = hasOptionGroups2(options) ? options.flatMap((g) => g.options) : options;
10822
+ const items = hasOptionGroups(options) ? options.flatMap((g) => g.options) : options;
10821
10823
  const findItemByValue = (val) => {
10822
10824
  if (val === null) {
10823
10825
  return null;
@@ -10898,7 +10900,7 @@ var _SelectBase = (props) => {
10898
10900
  style: { width: (_b = targetRef.current) == null ? void 0 : _b.offsetWidth }
10899
10901
  }, /* @__PURE__ */ React58.createElement(Select.Menu, __spreadValues({
10900
10902
  maxHeight
10901
- }, menuProps), options.length === 0 && /* @__PURE__ */ React58.createElement(Select.EmptyStateContainer, null, emptyState), options.length > 0 && !hasOptionGroups2(options) && options.map(renderItem), options.length > 0 && hasOptionGroups2(options) && options.map(renderGroup), actions.length > 0 && /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(Select.Divider, {
10903
+ }, menuProps), options.length === 0 && /* @__PURE__ */ React58.createElement(Select.EmptyStateContainer, null, emptyState), options.length > 0 && !hasOptionGroups(options) && options.map(renderItem), options.length > 0 && hasOptionGroups(options) && options.map(renderGroup), actions.length > 0 && /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(Select.Divider, {
10902
10904
  onMouseOver: () => setHighlightedIndex(-1)
10903
10905
  }), actions.map((act, index) => /* @__PURE__ */ React58.createElement(Select.ActionItem, __spreadProps(__spreadValues({
10904
10906
  key: `${index}`
@@ -11624,9 +11626,9 @@ function useScrollStyles({
11624
11626
  }
11625
11627
 
11626
11628
  // src/utils/table/types.ts
11627
- import isArray2 from "lodash/isArray";
11629
+ import isArray from "lodash/isArray";
11628
11630
  var areRowsGrouped = (rows) => {
11629
- return !isArray2(rows);
11631
+ return !isArray(rows);
11630
11632
  };
11631
11633
  var toSortDirection = (direction) => direction === "ascending" ? "asc" : direction === "descending" ? "desc" : false;
11632
11634
  var cellProps = (column) => {
@@ -12619,7 +12621,7 @@ var DataList2 = (_a) => {
12619
12621
  const defaultSortedColumn = columns.find((c) => c.headerName === (defaultSort == null ? void 0 : defaultSort.headerName));
12620
12622
  const initialSortState = defaultSortedColumn ? { column: defaultSortedColumn, direction: (_a2 = defaultSort == null ? void 0 : defaultSort.direction) != null ? _a2 : "ascending" } : {};
12621
12623
  const [sort, updateSort] = useTableSort(__spreadProps(__spreadValues({}, initialSortState), { onSortChanged }));
12622
- const sortedRows = isArray3(rows) ? sortRowsBy(rows, sort) : [];
12624
+ const sortedRows = isArray2(rows) ? sortRowsBy(rows, sort) : [];
12623
12625
  const groups = areRowsGrouped(rows) ? rows : group ? isFunction3(group) ? group(sortedRows) : groupBy2(sortedRows, group) : void 0;
12624
12626
  const isCollapsible = isFunction3(rowDetails);
12625
12627
  const templateColumns = compact([
@@ -12816,7 +12818,7 @@ var DataList2 = (_a) => {
12816
12818
  }, componentContent) : componentContent;
12817
12819
  return /* @__PURE__ */ React72.createElement(DataListContext.Provider, {
12818
12820
  value: {
12819
- rows: isArray3(rows) ? sortedRows : rows,
12821
+ rows: isArray2(rows) ? sortedRows : rows,
12820
12822
  selectedRows: selected
12821
12823
  }
12822
12824
  }, wrappedContent);