@aivenio/aquarium 2.4.0 → 2.5.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/system.mjs CHANGED
@@ -10247,6 +10247,14 @@ var Wrapper = React53.forwardRef(
10247
10247
  }
10248
10248
  );
10249
10249
 
10250
+ // src/molecules/Select/utils.ts
10251
+ var isOptionGroup = (val) => {
10252
+ return (val == null ? void 0 : val.label) !== void 0 && Array.isArray(val == null ? void 0 : val.options);
10253
+ };
10254
+ var hasOptionGroups = (val) => {
10255
+ return val.some(isOptionGroup);
10256
+ };
10257
+
10250
10258
  // src/molecules/Combobox/Combobox.tsx
10251
10259
  var import_smallCross2 = __toESM(require_smallCross());
10252
10260
  var ComboboxBase = (_a) => {
@@ -10296,18 +10304,19 @@ var ComboboxBase = (_a) => {
10296
10304
  "readOnly"
10297
10305
  ]);
10298
10306
  var _a2;
10307
+ const allOptions = hasOptionGroups(options) ? options.flatMap((g) => g.options) : options;
10299
10308
  const popoverRef = useRef6(null);
10300
10309
  const targetRef = useRef6(null);
10301
10310
  const menuRef = useRef6(null);
10302
10311
  const inputRef = useRef6(null);
10303
- const [inputItems, setInputItems] = useState6(options);
10312
+ const [inputItems, setInputItems] = useState6(allOptions);
10304
10313
  const [hasFocus, setFocus] = useState6(false);
10305
10314
  const updateInputItems = (query, selected) => {
10306
- const keys = typeof options[0] === "string" ? void 0 : optionKeys;
10315
+ const keys = typeof allOptions[0] === "string" ? void 0 : optionKeys;
10307
10316
  if (selected && itemToString(selected) === query) {
10308
- setInputItems(options);
10317
+ setInputItems(allOptions);
10309
10318
  } else {
10310
- setInputItems(query ? matchSorter(options, query, { keys }) : options);
10319
+ setInputItems(query ? matchSorter(allOptions, query, { keys }) : allOptions);
10311
10320
  }
10312
10321
  };
10313
10322
  const {
@@ -10359,6 +10368,20 @@ var ComboboxBase = (_a) => {
10359
10368
  toggle: toggleMenu,
10360
10369
  setOpen: (isOpen2) => isOpen2 ? openMenu() : closeMenu()
10361
10370
  };
10371
+ const renderGroup = (group) => {
10372
+ const groupInputItems = group.options.filter((o) => inputItems.includes(o));
10373
+ return groupInputItems.length > 0 ? /* @__PURE__ */ React54.createElement(React54.Fragment, {
10374
+ key: group.label
10375
+ }, /* @__PURE__ */ React54.createElement(Select.Group, null, group.label), groupInputItems.map((opt) => renderItem(opt, inputItems.indexOf(opt)))) : null;
10376
+ };
10377
+ const renderItem = (item, index) => {
10378
+ var _a3;
10379
+ return /* @__PURE__ */ React54.createElement(Select.Item, __spreadValues({
10380
+ key: (_a3 = getOptionKey == null ? void 0 : getOptionKey(item)) != null ? _a3 : itemToString(item),
10381
+ selected: item === selectedItem,
10382
+ highlighted: index === highlightedIndex || item === selectedItem
10383
+ }, getItemProps({ item, index })), renderOption(item));
10384
+ };
10362
10385
  useEffect6(() => {
10363
10386
  updateInputItems(inputValue, selectedItem);
10364
10387
  }, [JSON.stringify(options)]);
@@ -10399,19 +10422,18 @@ var ComboboxBase = (_a) => {
10399
10422
  })), !readOnly && /* @__PURE__ */ React54.createElement(Box.Flex, {
10400
10423
  alignItems: "center",
10401
10424
  gap: "2"
10402
- }, !!inputProps.value && !disabled && /* @__PURE__ */ React54.createElement("div", {
10403
- className: tw("group-hover:opacity-100", {
10425
+ }, !!inputProps.value && !disabled && /* @__PURE__ */ React54.createElement(Button.Icon, {
10426
+ UNSAFE_className: tw("group-hover:opacity-100 py-1", {
10404
10427
  "opacity-0": !hasFocus,
10405
10428
  "opacity-100": hasFocus
10406
- })
10407
- }, /* @__PURE__ */ React54.createElement(Button.Icon, {
10429
+ }),
10408
10430
  icon: import_smallCross2.default,
10409
10431
  onClick: () => selectItem(null),
10410
10432
  onFocus: () => setFocus(true),
10411
10433
  onBlur: () => setFocus(false),
10412
10434
  "aria-label": "Clear selection",
10413
10435
  dense: true
10414
- })), /* @__PURE__ */ React54.createElement(Select.Toggle, __spreadValues({
10436
+ }), /* @__PURE__ */ React54.createElement(Select.Toggle, __spreadValues({
10415
10437
  hasFocus,
10416
10438
  isOpen
10417
10439
  }, getToggleButtonProps({ disabled }))))), isOpen && /* @__PURE__ */ React54.createElement(PopoverOverlay, {
@@ -10424,14 +10446,7 @@ var ComboboxBase = (_a) => {
10424
10446
  style: { width: (_a2 = targetRef.current) == null ? void 0 : _a2.offsetWidth }
10425
10447
  }, /* @__PURE__ */ React54.createElement(Select.Menu, __spreadValues({
10426
10448
  maxHeight
10427
- }, menuProps), hasNoResults && /* @__PURE__ */ React54.createElement(Select.NoResults, null, emptyState), inputItems.map((item, index) => {
10428
- var _a3;
10429
- return /* @__PURE__ */ React54.createElement(Select.Item, __spreadValues({
10430
- key: (_a3 = getOptionKey == null ? void 0 : getOptionKey(item)) != null ? _a3 : itemToString(item),
10431
- selected: item === selectedItem,
10432
- highlighted: index === highlightedIndex || item === selectedItem
10433
- }, getItemProps({ item, index })), renderOption(item));
10434
- }))));
10449
+ }, menuProps), hasNoResults && /* @__PURE__ */ React54.createElement(Select.NoResults, null, emptyState), inputItems.length > 0 && !hasOptionGroups(options) && inputItems.map(renderItem), inputItems.length > 0 && hasOptionGroups(options) && options.map(renderGroup))));
10435
10450
  };
10436
10451
  var ComboboxBaseSkeleton = () => /* @__PURE__ */ React54.createElement(Skeleton, {
10437
10452
  height: 38
@@ -10710,7 +10725,7 @@ var hasIconProperty = (val) => {
10710
10725
  var _a;
10711
10726
  return typeof val === "string" || ((_a = val == null ? void 0 : val.icon) == null ? void 0 : _a.body) !== void 0;
10712
10727
  };
10713
- var hasOptionGroups = (val) => {
10728
+ var hasOptionGroups2 = (val) => {
10714
10729
  return !val.some((opt) => (opt == null ? void 0 : opt.label) === void 0 || !isArray(opt == null ? void 0 : opt.options));
10715
10730
  };
10716
10731
  var defaultRenderOption = (item, props, { selectedItem }, { getOptionKey, getValue, optionToString = getOptionLabelBuiltin }) => {
@@ -10792,7 +10807,7 @@ var _SelectBase = (props) => {
10792
10807
  const [hasFocus, setFocus] = useState8(false);
10793
10808
  const targetRef = useRef7(null);
10794
10809
  const menuRef = useRef7(null);
10795
- const items = hasOptionGroups(options) ? options.flatMap((g) => g.options) : options;
10810
+ const items = hasOptionGroups2(options) ? options.flatMap((g) => g.options) : options;
10796
10811
  const findItemByValue = (val) => {
10797
10812
  if (val === null) {
10798
10813
  return null;
@@ -10873,7 +10888,7 @@ var _SelectBase = (props) => {
10873
10888
  style: { width: (_b = targetRef.current) == null ? void 0 : _b.offsetWidth }
10874
10889
  }, /* @__PURE__ */ React58.createElement(Select.Menu, __spreadValues({
10875
10890
  maxHeight
10876
- }, 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, {
10891
+ }, 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, {
10877
10892
  onMouseOver: () => setHighlightedIndex(-1)
10878
10893
  }), actions.map((act, index) => /* @__PURE__ */ React58.createElement(Select.ActionItem, __spreadProps(__spreadValues({
10879
10894
  key: `${index}`
@@ -13183,7 +13198,7 @@ var import_chevronLeft4 = __toESM(require_chevronLeft());
13183
13198
  var import_chevronRight4 = __toESM(require_chevronRight());
13184
13199
  var cellStyles = tv4({
13185
13200
  extend: focusRing,
13186
- base: "w-8 h-8 typography-small cursor-default rounded flex items-center justify-center",
13201
+ base: "w-8 h-8 typography-small cursor-default rounded-md flex items-center justify-center outside-month:hidden",
13187
13202
  variants: {
13188
13203
  isSelected: {
13189
13204
  false: "text-default hover:bg-default pressed:bg-intense",
@@ -13362,7 +13377,7 @@ import {
13362
13377
  import { tv as tv5 } from "tailwind-variants";
13363
13378
  var cell = tv5({
13364
13379
  extend: focusRing,
13365
- base: "w-full h-full flex items-center justify-center rounded text-default",
13380
+ base: "w-full h-full flex items-center justify-center rounded-md text-default",
13366
13381
  variants: {
13367
13382
  selectionState: {
13368
13383
  none: "group-hover:bg-default group-pressed:bg-intense",
@@ -13390,9 +13405,9 @@ function RangeCalendar(props) {
13390
13405
  date,
13391
13406
  className: tw(
13392
13407
  "group w-8 h-8 typography-small outline outline-0 cursor-default",
13393
- "outside-month:text-inactive selected:bg-primary-default",
13408
+ "outside-month:hidden selected:bg-primary-default",
13394
13409
  "invalid:selected:bg-danger-default",
13395
- "selection-start:rounded-s selection-end:rounded-e"
13410
+ "selection-start:rounded-s-md selection-end:rounded-e-md"
13396
13411
  )
13397
13412
  }, (_a) => {
13398
13413
  var _b = _a, { formattedDate, isSelected, isSelectionStart, isSelectionEnd } = _b, rest = __objRest(_b, ["formattedDate", "isSelected", "isSelectionStart", "isSelectionEnd"]);
@@ -15052,19 +15067,11 @@ import React105, { useEffect as useEffect10, useRef as useRef13, useState as use
15052
15067
  import { ariaHideOutside as ariaHideOutside2 } from "@react-aria/overlays";
15053
15068
  import { useId as useId14 } from "@react-aria/utils";
15054
15069
  import { useCombobox as useCombobox2, useMultipleSelection } from "downshift";
15055
- import isArray4 from "lodash/isArray";
15056
15070
  import isEqual from "lodash/isEqual";
15057
15071
  import isNil2 from "lodash/isNil";
15058
- import isObject2 from "lodash/isObject";
15059
15072
  import omit16 from "lodash/omit";
15060
15073
  import omitBy from "lodash/omitBy";
15061
15074
  import { matchSorter as matchSorter2 } from "match-sorter";
15062
- var isOptionGroup = (option) => {
15063
- return isObject2(option) && "options" in option && isArray4(option.options);
15064
- };
15065
- var hasOptionGroups2 = (options) => {
15066
- return options.some(isOptionGroup);
15067
- };
15068
15075
  var MultiSelectBase = (_a) => {
15069
15076
  var _b = _a, {
15070
15077
  id,
@@ -15132,14 +15139,14 @@ var MultiSelectBase = (_a) => {
15132
15139
  );
15133
15140
  const keys = typeof options[0] === "string" ? void 0 : optionKeys;
15134
15141
  const selectedItemsAsStrings = selectedItems.map(itemToString);
15135
- const filteredOptions = hasOptionGroups2(options) ? options.map((option) => __spreadProps(__spreadValues({}, option), {
15142
+ const filteredOptions = hasOptionGroups(options) ? options.map((option) => __spreadProps(__spreadValues({}, option), {
15136
15143
  options: (inputValue ? matchSorter2(option.options, inputValue, { keys }) : option.options).filter(
15137
15144
  (opt) => !selectedItemsAsStrings.includes(itemToString(opt))
15138
15145
  )
15139
15146
  })) : (inputValue ? matchSorter2(options, inputValue, { keys }) : options).filter(
15140
15147
  (opt) => !selectedItemsAsStrings.includes(itemToString(opt))
15141
15148
  );
15142
- const flattenedOptions = hasOptionGroups2(filteredOptions) ? filteredOptions.flatMap((group) => group.options) : filteredOptions;
15149
+ const flattenedOptions = hasOptionGroups(filteredOptions) ? filteredOptions.flatMap((group) => group.options) : filteredOptions;
15143
15150
  const {
15144
15151
  isOpen,
15145
15152
  openMenu,
@@ -16151,6 +16158,7 @@ var Section4 = (props) => {
16151
16158
  const _collapsed = title ? props.collapsed : void 0;
16152
16159
  const _defaultCollapsed = title ? (_b = props.defaultCollapsed) != null ? _b : false : false;
16153
16160
  const [isCollapsed, setCollapsed] = React121.useState(_collapsed != null ? _collapsed : _defaultCollapsed);
16161
+ const [isResting, setResting] = React121.useState(true);
16154
16162
  const [ref, { height }] = useMeasure();
16155
16163
  const toggleAreaRef = useRef14(null);
16156
16164
  const menu = title ? (_c = props.menu) != null ? _c : void 0 : void 0;
@@ -16179,7 +16187,9 @@ var Section4 = (props) => {
16179
16187
  config: {
16180
16188
  duration: 150
16181
16189
  },
16182
- immediate: !_collapsible
16190
+ immediate: !_collapsible,
16191
+ onStart: () => setResting(false),
16192
+ onRest: () => setResting(true)
16183
16193
  }), { transform } = _f, spring = __objRest(_f, ["transform"]);
16184
16194
  const toggleId = useId17();
16185
16195
  const regionId = useId17();
@@ -16233,7 +16243,7 @@ var Section4 = (props) => {
16233
16243
  id: regionId,
16234
16244
  "aria-hidden": _collapsible ? isCollapsed ? true : void 0 : void 0,
16235
16245
  style: spring,
16236
- className: tw({ "overflow-hidden": _collapsible })
16246
+ className: tw({ "overflow-hidden": _collapsible && (isCollapsed || !isResting) })
16237
16247
  }, /* @__PURE__ */ React121.createElement("div", {
16238
16248
  ref
16239
16249
  }, hasTabs ? /* @__PURE__ */ React121.createElement(SectionTabs, __spreadProps(__spreadValues({}, children.props), {