@aivenio/aquarium 1.76.3 → 1.77.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/README.md +26 -18
- package/dist/atoms.cjs +4 -1
- package/dist/atoms.mjs +4 -1
- package/dist/src/molecules/DropdownMenu/DropdownMenu.js +76 -18
- package/dist/src/molecules/Input/Input.d.ts +5 -4
- package/dist/src/molecules/Input/Input.js +46 -30
- package/dist/src/molecules/Popover/Popover.d.ts +1 -0
- package/dist/src/molecules/Popover/Popover.js +1 -1
- package/dist/src/molecules/PopoverDialog/PopoverDialog.d.ts +1 -1
- package/dist/src/molecules/Spacing/Spacing.d.ts +1 -1
- package/dist/src/molecules/Spacing/Spacing.js +1 -1
- package/dist/src/molecules/Tooltip/Tooltip.js +2 -2
- package/dist/src/utils/form/InputAdornment/InputAdornment.d.ts +1 -0
- package/dist/src/utils/form/InputAdornment/InputAdornment.js +3 -1
- package/dist/styles.css +24 -0
- package/dist/system.cjs +130 -59
- package/dist/system.mjs +130 -60
- 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
@@ -4224,6 +4224,7 @@ __export(molecules_exports, {
|
|
4224
4224
|
EmptyState: () => EmptyState,
|
4225
4225
|
EmptyStateLayout: () => EmptyStateLayout,
|
4226
4226
|
ExternalLinkButton: () => ExternalLinkButton,
|
4227
|
+
FileInput: () => FileInput,
|
4227
4228
|
Flexbox: () => Flexbox,
|
4228
4229
|
FlexboxItem: () => FlexboxItem,
|
4229
4230
|
GhostButton: () => GhostButton,
|
@@ -6825,7 +6826,10 @@ var TooltipWrapper = React8.forwardRef(
|
|
6825
6826
|
const arrowStyle = getArrowStyle(ref.current, placement, (_a2 = arrowProps.style) != null ? _a2 : {});
|
6826
6827
|
return /* @__PURE__ */ React8.createElement(OverlayContainer, null, /* @__PURE__ */ React8.createElement("div", __spreadValues({
|
6827
6828
|
ref,
|
6828
|
-
className: classNames(
|
6829
|
+
className: classNames(
|
6830
|
+
"Aquarium-Tooltip",
|
6831
|
+
tw("p-3 rounded-sm typography-caption max-w-[320px] bg-body-intense text-opposite-default")
|
6832
|
+
)
|
6829
6833
|
}, mergeProps(props, tooltipProps)), props.children, /* @__PURE__ */ React8.createElement(Arrow, __spreadProps(__spreadValues({}, arrowProps), {
|
6830
6834
|
style: arrowStyle
|
6831
6835
|
}))));
|
@@ -10293,6 +10297,7 @@ var import_cross5 = __toESM(require_cross());
|
|
10293
10297
|
var import_error3 = __toESM(require_error());
|
10294
10298
|
var import_search3 = __toESM(require_search());
|
10295
10299
|
var import_tick4 = __toESM(require_tick());
|
10300
|
+
var import_upload2 = __toESM(require_upload());
|
10296
10301
|
var InputAdornment = ({
|
10297
10302
|
placement = "right",
|
10298
10303
|
className,
|
@@ -10317,6 +10322,12 @@ var SearchIcon = ({ onClick }) => /* @__PURE__ */ React56.createElement(Icon, {
|
|
10317
10322
|
"data-testid": "icon-search",
|
10318
10323
|
onClick
|
10319
10324
|
});
|
10325
|
+
var UploadIcon = ({ onClick }) => /* @__PURE__ */ React56.createElement(Icon, {
|
10326
|
+
icon: import_upload2.default,
|
10327
|
+
color: "primary-intense",
|
10328
|
+
"data-testid": "icon-upload",
|
10329
|
+
onClick
|
10330
|
+
});
|
10320
10331
|
var ResetIcon = ({ onClick }) => /* @__PURE__ */ React56.createElement(Icon, {
|
10321
10332
|
className: "hover:cursor-pointer",
|
10322
10333
|
icon: import_cross5.default,
|
@@ -10347,11 +10358,14 @@ var createInput = (displayName, opts = {}) => {
|
|
10347
10358
|
"type"
|
10348
10359
|
]);
|
10349
10360
|
var _a2;
|
10350
|
-
const inputType = opts.isSearch ? "search" : type;
|
10361
|
+
const inputType = opts.isSearch ? "search" : opts.isFile ? "file" : type;
|
10351
10362
|
const inputRef = React57.useRef(null);
|
10352
10363
|
useImperativeHandle(ref, () => inputRef.current);
|
10353
|
-
const handleReset = () => {
|
10364
|
+
const handleReset = (e) => {
|
10354
10365
|
var _a3;
|
10366
|
+
if (opts.isFile) {
|
10367
|
+
e.preventDefault();
|
10368
|
+
}
|
10355
10369
|
const el = inputRef.current;
|
10356
10370
|
if (el) {
|
10357
10371
|
const lastValue = el.value;
|
@@ -10364,7 +10378,8 @@ var createInput = (displayName, opts = {}) => {
|
|
10364
10378
|
return /* @__PURE__ */ React57.createElement("span", {
|
10365
10379
|
className: classNames("Aquarium-InputBase", tw("relative block"))
|
10366
10380
|
}, opts.adornment && /* @__PURE__ */ React57.createElement(InputAdornment, {
|
10367
|
-
placement: "left"
|
10381
|
+
placement: "left",
|
10382
|
+
className: opts.isFile ? "icon-stroke-2" : void 0
|
10368
10383
|
}, opts.adornment), /* @__PURE__ */ React57.createElement("input", __spreadProps(__spreadValues({
|
10369
10384
|
ref: inputRef,
|
10370
10385
|
type: inputType
|
@@ -10377,7 +10392,8 @@ var createInput = (displayName, opts = {}) => {
|
|
10377
10392
|
{
|
10378
10393
|
"[&::-webkit-search-cancel-button]:appearance-none": opts.isSearch,
|
10379
10394
|
"pl-7": opts.adornment,
|
10380
|
-
"pr-7": opts.canReset || endAdornment
|
10395
|
+
"pr-7": opts.canReset || endAdornment,
|
10396
|
+
"file:text-primary-intense file:typography-small-strong file:border-0 file:bg-transparent file:p-0 file:mr-4": opts.isFile
|
10381
10397
|
},
|
10382
10398
|
getCommonInputStyles({ readOnly, valid }),
|
10383
10399
|
props.className
|
@@ -10395,57 +10411,68 @@ var createInput = (displayName, opts = {}) => {
|
|
10395
10411
|
return InputComponent;
|
10396
10412
|
};
|
10397
10413
|
var InputBase = createInput("InputBase");
|
10414
|
+
var FileInputBase = createInput("FileInputBase", {
|
10415
|
+
adornment: /* @__PURE__ */ React57.createElement(UploadIcon, null),
|
10416
|
+
canReset: true,
|
10417
|
+
isFile: true
|
10418
|
+
});
|
10398
10419
|
var SearchInput = createInput("SearchInput", {
|
10399
10420
|
adornment: /* @__PURE__ */ React57.createElement(SearchIcon, null),
|
10400
10421
|
canReset: true,
|
10401
10422
|
isSearch: true
|
10402
10423
|
});
|
10403
|
-
var
|
10404
|
-
|
10405
|
-
const
|
10406
|
-
|
10407
|
-
|
10408
|
-
|
10409
|
-
|
10410
|
-
|
10411
|
-
|
10412
|
-
|
10413
|
-
|
10414
|
-
|
10415
|
-
|
10416
|
-
|
10417
|
-
|
10418
|
-
|
10419
|
-
|
10420
|
-
|
10421
|
-
|
10422
|
-
|
10423
|
-
|
10424
|
-
|
10425
|
-
inputProps,
|
10426
|
-
|
10427
|
-
|
10428
|
-
|
10429
|
-
|
10430
|
-
|
10431
|
-
|
10432
|
-
|
10433
|
-
|
10434
|
-
|
10435
|
-
|
10436
|
-
|
10437
|
-
|
10438
|
-
|
10439
|
-
|
10440
|
-
|
10441
|
-
|
10442
|
-
|
10443
|
-
|
10444
|
-
|
10445
|
-
|
10446
|
-
|
10447
|
-
|
10448
|
-
|
10424
|
+
var createInputComponent = (displayName, options = {}) => {
|
10425
|
+
const InputComponentBase = options.input || InputBase;
|
10426
|
+
const InputComponent = React57.forwardRef((inputProps, ref) => {
|
10427
|
+
var _b, _c;
|
10428
|
+
const _a = inputProps, { readOnly = false, value: valueProp, onChange: onChangeProp } = _a, props = __objRest(_a, ["readOnly", "value", "onChange"]);
|
10429
|
+
const isControlled = typeof valueProp !== "undefined";
|
10430
|
+
const [valueState, setValueState] = useState7((_b = props.defaultValue) != null ? _b : "");
|
10431
|
+
const value = isControlled ? valueProp : valueState;
|
10432
|
+
const handleChange = useCallback(
|
10433
|
+
(e) => {
|
10434
|
+
const next = e.target.value;
|
10435
|
+
if (!isControlled) {
|
10436
|
+
setValueState(next);
|
10437
|
+
}
|
10438
|
+
onChangeProp == null ? void 0 : onChangeProp(e);
|
10439
|
+
},
|
10440
|
+
[isControlled, onChangeProp]
|
10441
|
+
);
|
10442
|
+
const defaultId = useId7();
|
10443
|
+
const id = (_c = props.id) != null ? _c : defaultId;
|
10444
|
+
const errorMessageId = useId7();
|
10445
|
+
const errorProps = props.valid === false ? { "aria-invalid": true, "aria-describedby": errorMessageId } : {};
|
10446
|
+
const _d = getLabelControlProps(inputProps), { "data-testid": dataTestId } = _d, labelControlProps = __objRest(_d, ["data-testid"]);
|
10447
|
+
const baseProps = omit5(
|
10448
|
+
inputProps,
|
10449
|
+
Object.keys(labelControlProps).concat(isControlled ? ["defaultValue"] : ["value"])
|
10450
|
+
);
|
10451
|
+
return /* @__PURE__ */ React57.createElement(LabelControl, __spreadProps(__spreadValues({
|
10452
|
+
id: `${id}-label`,
|
10453
|
+
htmlFor: id,
|
10454
|
+
messageId: errorMessageId,
|
10455
|
+
length: value !== void 0 ? toString(value).length : void 0
|
10456
|
+
}, labelControlProps), {
|
10457
|
+
className: "Aquarium-Input"
|
10458
|
+
}), /* @__PURE__ */ React57.createElement(InputComponentBase, __spreadProps(__spreadValues(__spreadValues({
|
10459
|
+
ref
|
10460
|
+
}, baseProps), errorProps), {
|
10461
|
+
id,
|
10462
|
+
"data-testid": dataTestId,
|
10463
|
+
onChange: handleChange,
|
10464
|
+
disabled: props.disabled,
|
10465
|
+
maxLength: props.maxLength,
|
10466
|
+
required: props.required,
|
10467
|
+
valid: props.valid,
|
10468
|
+
readOnly
|
10469
|
+
})));
|
10470
|
+
});
|
10471
|
+
InputComponent.displayName = displayName;
|
10472
|
+
return InputComponent;
|
10473
|
+
};
|
10474
|
+
var FileInput = createInputComponent("FileInput", { input: FileInputBase });
|
10475
|
+
var Input2 = createInputComponent("Input", { input: InputBase });
|
10449
10476
|
Input2.Skeleton = () => /* @__PURE__ */ React57.createElement(LabelControl.Skeleton, null, /* @__PURE__ */ React57.createElement(InputBase.Skeleton, null));
|
10450
10477
|
Input2.Skeleton.displayName = "Input.Skeleton";
|
10451
10478
|
|
@@ -11416,7 +11443,7 @@ import React68 from "react";
|
|
11416
11443
|
import isFunction from "lodash/isFunction";
|
11417
11444
|
|
11418
11445
|
// src/molecules/DropdownMenu/DropdownMenu.tsx
|
11419
|
-
import React67 from "react";
|
11446
|
+
import React67, { useCallback as useCallback2 } from "react";
|
11420
11447
|
import { useFilter } from "@react-aria/i18n";
|
11421
11448
|
import { PressResponder, usePress } from "@react-aria/interactions";
|
11422
11449
|
import { useMenu, useMenuItem, useMenuSection, useMenuTrigger } from "@react-aria/menu";
|
@@ -11646,13 +11673,13 @@ var MenuWrapper = (_a) => {
|
|
11646
11673
|
"header",
|
11647
11674
|
"footer"
|
11648
11675
|
]);
|
11649
|
-
const
|
11676
|
+
const baseListRef = React67.useRef(null);
|
11650
11677
|
const disabledKeys = getDisabledItemKeys(props.children);
|
11651
11678
|
const state = useTreeState(__spreadValues({
|
11652
11679
|
disabledKeys,
|
11653
11680
|
selectedKeys
|
11654
11681
|
}, props));
|
11655
|
-
const { menuProps } = useMenu(props, state,
|
11682
|
+
const { menuProps } = useMenu(props, state, baseListRef);
|
11656
11683
|
const { contains } = useFilter({ sensitivity: "base" });
|
11657
11684
|
const [search, setSearch] = React67.useState("");
|
11658
11685
|
const searchInputRef = React67.useRef(null);
|
@@ -11660,12 +11687,51 @@ var MenuWrapper = (_a) => {
|
|
11660
11687
|
() => searchable ? filterCollection(state.collection, search, contains) : state.collection,
|
11661
11688
|
[searchable, state.collection, search, contains]
|
11662
11689
|
);
|
11663
|
-
|
11690
|
+
const focusOnSearchInput = useCallback2(() => {
|
11691
|
+
var _a2;
|
11692
|
+
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
11693
|
+
}, []);
|
11694
|
+
const focusOnBaseList = useCallback2(() => {
|
11664
11695
|
var _a2;
|
11696
|
+
(_a2 = baseListRef.current) == null ? void 0 : _a2.focus();
|
11697
|
+
}, []);
|
11698
|
+
React67.useEffect(() => {
|
11665
11699
|
if (searchable) {
|
11666
|
-
(
|
11700
|
+
requestAnimationFrame(focusOnSearchInput);
|
11667
11701
|
}
|
11668
|
-
}, [searchable]);
|
11702
|
+
}, [searchable, focusOnSearchInput]);
|
11703
|
+
const onSearchInputKeyDown = useCallback2(
|
11704
|
+
(event) => {
|
11705
|
+
if (event.code === "ArrowDown") {
|
11706
|
+
focusOnBaseList();
|
11707
|
+
}
|
11708
|
+
},
|
11709
|
+
[focusOnBaseList]
|
11710
|
+
);
|
11711
|
+
const onMenuItemsKeyDown = useCallback2(
|
11712
|
+
(event) => {
|
11713
|
+
if (!searchable) {
|
11714
|
+
return;
|
11715
|
+
}
|
11716
|
+
if (event.shiftKey && event.code.startsWith("Shift") || event.altKey && event.code.startsWith("Alt") || event.ctrlKey || event.metaKey || [
|
11717
|
+
"ArrowUp",
|
11718
|
+
"ArrowDown",
|
11719
|
+
"ArrowLeft",
|
11720
|
+
"ArrowRight",
|
11721
|
+
"PageUp",
|
11722
|
+
"PageDown",
|
11723
|
+
"Home",
|
11724
|
+
"End",
|
11725
|
+
"Tab",
|
11726
|
+
"Enter",
|
11727
|
+
"Space"
|
11728
|
+
].includes(event.code)) {
|
11729
|
+
return;
|
11730
|
+
}
|
11731
|
+
focusOnSearchInput();
|
11732
|
+
},
|
11733
|
+
[searchable, focusOnSearchInput]
|
11734
|
+
);
|
11669
11735
|
return /* @__PURE__ */ React67.createElement(DropdownMenu, {
|
11670
11736
|
minWidth,
|
11671
11737
|
maxWidth,
|
@@ -11675,10 +11741,13 @@ var MenuWrapper = (_a) => {
|
|
11675
11741
|
"aria-label": "search",
|
11676
11742
|
value: search,
|
11677
11743
|
onChange: (e) => setSearch(e.target.value),
|
11744
|
+
onKeyDown: onSearchInputKeyDown,
|
11678
11745
|
className: tw("mb-5"),
|
11679
11746
|
ref: searchInputRef
|
11680
|
-
}), filteredCollection.size === 0 && emptyState && /* @__PURE__ */ React67.createElement(DropdownMenu.EmptyStateContainer, null, emptyState), /* @__PURE__ */ React67.createElement(
|
11681
|
-
|
11747
|
+
}), filteredCollection.size === 0 && emptyState && /* @__PURE__ */ React67.createElement(DropdownMenu.EmptyStateContainer, null, emptyState), /* @__PURE__ */ React67.createElement("div", {
|
11748
|
+
onKeyDown: onMenuItemsKeyDown
|
11749
|
+
}, /* @__PURE__ */ React67.createElement(DropdownMenu.List, __spreadValues({
|
11750
|
+
ref: baseListRef
|
11682
11751
|
}, menuProps), Array.from(filteredCollection).map((item) => {
|
11683
11752
|
if (isSectionNode(item)) {
|
11684
11753
|
return /* @__PURE__ */ React67.createElement(SectionWrapper, {
|
@@ -11693,7 +11762,7 @@ var MenuWrapper = (_a) => {
|
|
11693
11762
|
state
|
11694
11763
|
});
|
11695
11764
|
}
|
11696
|
-
}))), footer);
|
11765
|
+
})))), footer);
|
11697
11766
|
};
|
11698
11767
|
var ItemWrapper = ({ item, state }) => {
|
11699
11768
|
const ref = React67.useRef(null);
|
@@ -15923,6 +15992,7 @@ export {
|
|
15923
15992
|
EmptyState,
|
15924
15993
|
EmptyStateLayout,
|
15925
15994
|
ExternalLinkButton,
|
15995
|
+
FileInput,
|
15926
15996
|
Flexbox,
|
15927
15997
|
FlexboxItem,
|
15928
15998
|
FormControl,
|