@aivenio/aquarium 2.4.0 → 2.5.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/atoms.cjs +2 -1
- package/dist/atoms.mjs +2 -1
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/src/atoms/Select/Select.js +3 -3
- package/dist/src/charts/Tooltip/Tooltip.js +2 -2
- package/dist/src/molecules/Combobox/Combobox.d.ts +6 -5
- package/dist/src/molecules/Combobox/Combobox.js +21 -12
- package/dist/src/molecules/DatePicker/Calendar.js +2 -2
- package/dist/src/molecules/DatePicker/RangeCalendar.js +3 -3
- package/dist/src/molecules/MultiSelect/MultiSelect.d.ts +5 -11
- package/dist/src/molecules/MultiSelect/MultiSelect.js +2 -9
- package/dist/src/molecules/Section/Section.js +13 -2
- package/dist/src/molecules/Select/Select.js +4 -3
- package/dist/src/molecules/Select/utils.d.ts +3 -0
- package/dist/src/molecules/Select/utils.js +7 -0
- package/dist/styles.css +18 -14
- package/dist/system.cjs +99 -82
- package/dist/system.mjs +57 -40
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/tailwindGenerated.d.ts +1 -1
- package/package.json +1 -1
package/dist/system.mjs
CHANGED
@@ -4439,10 +4439,11 @@ var InputContainer = React2.forwardRef(
|
|
4439
4439
|
}
|
4440
4440
|
);
|
4441
4441
|
var Input = React2.forwardRef((_a, ref) => {
|
4442
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
4442
|
+
var _b = _a, { className, required } = _b, props = __objRest(_b, ["className", "required"]);
|
4443
4443
|
return /* @__PURE__ */ React2.createElement("input", __spreadValues({
|
4444
4444
|
ref,
|
4445
4445
|
type: "text",
|
4446
|
+
"aria-required": required,
|
4446
4447
|
className: classNames(
|
4447
4448
|
className,
|
4448
4449
|
"grow rounded border-0 focus:outline-none px-[1px] my-1 min-w-0 typography-small disabled:cursor-not-allowed disabled:bg-default placeholder:text-inactive",
|
@@ -10247,6 +10248,14 @@ var Wrapper = React53.forwardRef(
|
|
10247
10248
|
}
|
10248
10249
|
);
|
10249
10250
|
|
10251
|
+
// src/molecules/Select/utils.ts
|
10252
|
+
var isOptionGroup = (val) => {
|
10253
|
+
return (val == null ? void 0 : val.label) !== void 0 && Array.isArray(val == null ? void 0 : val.options);
|
10254
|
+
};
|
10255
|
+
var hasOptionGroups = (val) => {
|
10256
|
+
return val.some(isOptionGroup);
|
10257
|
+
};
|
10258
|
+
|
10250
10259
|
// src/molecules/Combobox/Combobox.tsx
|
10251
10260
|
var import_smallCross2 = __toESM(require_smallCross());
|
10252
10261
|
var ComboboxBase = (_a) => {
|
@@ -10296,18 +10305,19 @@ var ComboboxBase = (_a) => {
|
|
10296
10305
|
"readOnly"
|
10297
10306
|
]);
|
10298
10307
|
var _a2;
|
10308
|
+
const allOptions = hasOptionGroups(options) ? options.flatMap((g) => g.options) : options;
|
10299
10309
|
const popoverRef = useRef6(null);
|
10300
10310
|
const targetRef = useRef6(null);
|
10301
10311
|
const menuRef = useRef6(null);
|
10302
10312
|
const inputRef = useRef6(null);
|
10303
|
-
const [inputItems, setInputItems] = useState6(
|
10313
|
+
const [inputItems, setInputItems] = useState6(allOptions);
|
10304
10314
|
const [hasFocus, setFocus] = useState6(false);
|
10305
10315
|
const updateInputItems = (query, selected) => {
|
10306
|
-
const keys = typeof
|
10316
|
+
const keys = typeof allOptions[0] === "string" ? void 0 : optionKeys;
|
10307
10317
|
if (selected && itemToString(selected) === query) {
|
10308
|
-
setInputItems(
|
10318
|
+
setInputItems(allOptions);
|
10309
10319
|
} else {
|
10310
|
-
setInputItems(query ? matchSorter(
|
10320
|
+
setInputItems(query ? matchSorter(allOptions, query, { keys }) : allOptions);
|
10311
10321
|
}
|
10312
10322
|
};
|
10313
10323
|
const {
|
@@ -10359,6 +10369,20 @@ var ComboboxBase = (_a) => {
|
|
10359
10369
|
toggle: toggleMenu,
|
10360
10370
|
setOpen: (isOpen2) => isOpen2 ? openMenu() : closeMenu()
|
10361
10371
|
};
|
10372
|
+
const renderGroup = (group) => {
|
10373
|
+
const groupInputItems = group.options.filter((o) => inputItems.includes(o));
|
10374
|
+
return groupInputItems.length > 0 ? /* @__PURE__ */ React54.createElement(React54.Fragment, {
|
10375
|
+
key: group.label
|
10376
|
+
}, /* @__PURE__ */ React54.createElement(Select.Group, null, group.label), groupInputItems.map((opt) => renderItem(opt, inputItems.indexOf(opt)))) : null;
|
10377
|
+
};
|
10378
|
+
const renderItem = (item, index) => {
|
10379
|
+
var _a3;
|
10380
|
+
return /* @__PURE__ */ React54.createElement(Select.Item, __spreadValues({
|
10381
|
+
key: (_a3 = getOptionKey == null ? void 0 : getOptionKey(item)) != null ? _a3 : itemToString(item),
|
10382
|
+
selected: item === selectedItem,
|
10383
|
+
highlighted: index === highlightedIndex || item === selectedItem
|
10384
|
+
}, getItemProps({ item, index })), renderOption(item));
|
10385
|
+
};
|
10362
10386
|
useEffect6(() => {
|
10363
10387
|
updateInputItems(inputValue, selectedItem);
|
10364
10388
|
}, [JSON.stringify(options)]);
|
@@ -10399,19 +10423,18 @@ var ComboboxBase = (_a) => {
|
|
10399
10423
|
})), !readOnly && /* @__PURE__ */ React54.createElement(Box.Flex, {
|
10400
10424
|
alignItems: "center",
|
10401
10425
|
gap: "2"
|
10402
|
-
}, !!inputProps.value && !disabled && /* @__PURE__ */ React54.createElement(
|
10403
|
-
|
10426
|
+
}, !!inputProps.value && !disabled && /* @__PURE__ */ React54.createElement(Button.Icon, {
|
10427
|
+
UNSAFE_className: tw("group-hover:opacity-100 py-1", {
|
10404
10428
|
"opacity-0": !hasFocus,
|
10405
10429
|
"opacity-100": hasFocus
|
10406
|
-
})
|
10407
|
-
}, /* @__PURE__ */ React54.createElement(Button.Icon, {
|
10430
|
+
}),
|
10408
10431
|
icon: import_smallCross2.default,
|
10409
10432
|
onClick: () => selectItem(null),
|
10410
10433
|
onFocus: () => setFocus(true),
|
10411
10434
|
onBlur: () => setFocus(false),
|
10412
10435
|
"aria-label": "Clear selection",
|
10413
10436
|
dense: true
|
10414
|
-
})
|
10437
|
+
}), /* @__PURE__ */ React54.createElement(Select.Toggle, __spreadValues({
|
10415
10438
|
hasFocus,
|
10416
10439
|
isOpen
|
10417
10440
|
}, getToggleButtonProps({ disabled }))))), isOpen && /* @__PURE__ */ React54.createElement(PopoverOverlay, {
|
@@ -10424,14 +10447,7 @@ var ComboboxBase = (_a) => {
|
|
10424
10447
|
style: { width: (_a2 = targetRef.current) == null ? void 0 : _a2.offsetWidth }
|
10425
10448
|
}, /* @__PURE__ */ React54.createElement(Select.Menu, __spreadValues({
|
10426
10449
|
maxHeight
|
10427
|
-
}, menuProps), hasNoResults && /* @__PURE__ */ React54.createElement(Select.NoResults, null, emptyState), inputItems.map(
|
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
|
-
}))));
|
10450
|
+
}, 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
10451
|
};
|
10436
10452
|
var ComboboxBaseSkeleton = () => /* @__PURE__ */ React54.createElement(Skeleton, {
|
10437
10453
|
height: 38
|
@@ -10702,6 +10718,7 @@ Input2.Skeleton.displayName = "Input.Skeleton";
|
|
10702
10718
|
import React58, { useRef as useRef7, useState as useState8 } from "react";
|
10703
10719
|
import { useId as useId8 } from "@react-aria/utils";
|
10704
10720
|
import { useSelect } from "downshift";
|
10721
|
+
import { without } from "lodash";
|
10705
10722
|
import defaults from "lodash/defaults";
|
10706
10723
|
import isArray from "lodash/isArray";
|
10707
10724
|
import isNil from "lodash/isNil";
|
@@ -10710,7 +10727,7 @@ var hasIconProperty = (val) => {
|
|
10710
10727
|
var _a;
|
10711
10728
|
return typeof val === "string" || ((_a = val == null ? void 0 : val.icon) == null ? void 0 : _a.body) !== void 0;
|
10712
10729
|
};
|
10713
|
-
var
|
10730
|
+
var hasOptionGroups2 = (val) => {
|
10714
10731
|
return !val.some((opt) => (opt == null ? void 0 : opt.label) === void 0 || !isArray(opt == null ? void 0 : opt.options));
|
10715
10732
|
};
|
10716
10733
|
var defaultRenderOption = (item, props, { selectedItem }, { getOptionKey, getValue, optionToString = getOptionLabelBuiltin }) => {
|
@@ -10763,7 +10780,6 @@ var _SelectBase = (props) => {
|
|
10763
10780
|
valid,
|
10764
10781
|
emptyState,
|
10765
10782
|
actions,
|
10766
|
-
required,
|
10767
10783
|
children,
|
10768
10784
|
labelWrapper
|
10769
10785
|
} = _a, rest = __objRest(_a, [
|
@@ -10785,14 +10801,13 @@ var _SelectBase = (props) => {
|
|
10785
10801
|
"valid",
|
10786
10802
|
"emptyState",
|
10787
10803
|
"actions",
|
10788
|
-
"required",
|
10789
10804
|
"children",
|
10790
10805
|
"labelWrapper"
|
10791
10806
|
]);
|
10792
10807
|
const [hasFocus, setFocus] = useState8(false);
|
10793
10808
|
const targetRef = useRef7(null);
|
10794
10809
|
const menuRef = useRef7(null);
|
10795
|
-
const items =
|
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 && !
|
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}`
|
@@ -10904,7 +10919,7 @@ var Select2 = (_a) => {
|
|
10904
10919
|
const errorMessageId = useId8();
|
10905
10920
|
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
10906
10921
|
const labelProps = getLabelControlProps(props);
|
10907
|
-
const baseProps = omit6(props, Object.keys(labelProps));
|
10922
|
+
const baseProps = omit6(props, without(Object.keys(labelProps), "required"));
|
10908
10923
|
const legacyError = labelProps.error !== void 0 && labelProps.valid === false;
|
10909
10924
|
const variant = !labelProps.valid || legacyError ? "error" : labelProps.disabled ? "disabled" : "default";
|
10910
10925
|
const label = /* @__PURE__ */ React58.createElement(Label2, __spreadValues({
|
@@ -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:
|
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 =
|
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 =
|
15149
|
+
const flattenedOptions = hasOptionGroups(filteredOptions) ? filteredOptions.flatMap((group) => group.options) : filteredOptions;
|
15143
15150
|
const {
|
15144
15151
|
isOpen,
|
15145
15152
|
openMenu,
|
@@ -16151,8 +16158,16 @@ 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);
|
16164
|
+
const isMounted = useRef14(true);
|
16165
|
+
React121.useEffect(
|
16166
|
+
() => () => {
|
16167
|
+
isMounted.current = false;
|
16168
|
+
},
|
16169
|
+
[]
|
16170
|
+
);
|
16156
16171
|
const menu = title ? (_c = props.menu) != null ? _c : void 0 : void 0;
|
16157
16172
|
const menuAriaLabel = title ? (_e = (_d = props.menuAriaLabel) != null ? _d : props.menuLabel) != null ? _e : "Context menu" : void 0;
|
16158
16173
|
const onAction = title ? props.onAction : void 0;
|
@@ -16179,7 +16194,9 @@ var Section4 = (props) => {
|
|
16179
16194
|
config: {
|
16180
16195
|
duration: 150
|
16181
16196
|
},
|
16182
|
-
immediate: !_collapsible
|
16197
|
+
immediate: !_collapsible,
|
16198
|
+
onStart: () => isMounted.current && setResting(false),
|
16199
|
+
onRest: () => isMounted.current && setResting(true)
|
16183
16200
|
}), { transform } = _f, spring = __objRest(_f, ["transform"]);
|
16184
16201
|
const toggleId = useId17();
|
16185
16202
|
const regionId = useId17();
|
@@ -16233,7 +16250,7 @@ var Section4 = (props) => {
|
|
16233
16250
|
id: regionId,
|
16234
16251
|
"aria-hidden": _collapsible ? isCollapsed ? true : void 0 : void 0,
|
16235
16252
|
style: spring,
|
16236
|
-
className: tw({ "overflow-hidden": _collapsible })
|
16253
|
+
className: tw({ "overflow-hidden": _collapsible && (isCollapsed || !isResting) })
|
16237
16254
|
}, /* @__PURE__ */ React121.createElement("div", {
|
16238
16255
|
ref
|
16239
16256
|
}, hasTabs ? /* @__PURE__ */ React121.createElement(SectionTabs, __spreadProps(__spreadValues({}, children.props), {
|