@aivenio/aquarium 6.4.0 → 6.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/_variables.scss +1 -1
- package/dist/atoms.cjs +12 -11
- package/dist/atoms.mjs +13 -12
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/src/atoms/Modal/Modal.d.ts +1 -0
- package/dist/src/atoms/Modal/Modal.js +3 -3
- package/dist/src/molecules/DataList/DataList.js +32 -15
- package/dist/src/molecules/DataList/DataListGroup.d.ts +2 -1
- package/dist/src/molecules/DataList/DataListGroup.js +15 -14
- package/dist/src/molecules/Dialog/Dialog.d.ts +1 -1
- package/dist/src/molecules/Dialog/Dialog.js +6 -6
- package/dist/src/molecules/Tooltip/Tooltip.js +22 -4
- package/dist/src/tokens/tokens.json +1 -1
- package/dist/src/utils/table/types.d.ts +7 -0
- package/dist/src/utils/table/types.js +1 -1
- package/dist/styles.css +9 -1
- package/dist/system.cjs +98 -86
- package/dist/system.mjs +63 -51
- package/dist/tokens.json +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/molecules/DataList/utils.d.ts +0 -2
- package/dist/src/molecules/DataList/utils.js +0 -3
package/dist/system.mjs
CHANGED
|
@@ -1813,7 +1813,7 @@ var tokens_default = {
|
|
|
1813
1813
|
}
|
|
1814
1814
|
},
|
|
1815
1815
|
code: {
|
|
1816
|
-
background: "rgba(
|
|
1816
|
+
background: "rgba(255,255,255,1)",
|
|
1817
1817
|
text: "rgba(45,46,48,1)",
|
|
1818
1818
|
variable: "rgba(91,30,103,1)",
|
|
1819
1819
|
keyword: "rgba(202, 33, 101, 1)",
|
|
@@ -2281,7 +2281,7 @@ import React6 from "react";
|
|
|
2281
2281
|
import { useFocusWithin } from "@react-aria/interactions";
|
|
2282
2282
|
import { OverlayContainer, useOverlayPosition } from "@react-aria/overlays";
|
|
2283
2283
|
import { useTooltip, useTooltipTrigger } from "@react-aria/tooltip";
|
|
2284
|
-
import { mergeProps } from "@react-aria/utils";
|
|
2284
|
+
import { isFocusable, mergeProps } from "@react-aria/utils";
|
|
2285
2285
|
|
|
2286
2286
|
// src/molecules/Tooltip/useTooltipTriggerState.ts
|
|
2287
2287
|
import { useEffect as useEffect2, useMemo, useRef } from "react";
|
|
@@ -2417,6 +2417,14 @@ var Tooltip = ({ delay = 200, ...props }) => {
|
|
|
2417
2417
|
shouldFlip,
|
|
2418
2418
|
offset: ARROW_OFFSET
|
|
2419
2419
|
});
|
|
2420
|
+
const [containsFocusable, setContainsFocusable] = React6.useState(false);
|
|
2421
|
+
React6.useLayoutEffect(() => {
|
|
2422
|
+
if (triggerRef.current) {
|
|
2423
|
+
const elements = Array.from(triggerRef.current.querySelectorAll("*"));
|
|
2424
|
+
const hasFocusable = elements.some((el) => isFocusable(el));
|
|
2425
|
+
setContainsFocusable(hasFocusable);
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2420
2428
|
const { focusWithinProps } = useFocusWithin({
|
|
2421
2429
|
onFocusWithinChange: (isFocusWithin) => isFocusWithin ? state.open() : state.close()
|
|
2422
2430
|
});
|
|
@@ -2445,6 +2453,7 @@ var Tooltip = ({ delay = 200, ...props }) => {
|
|
|
2445
2453
|
{
|
|
2446
2454
|
className: display,
|
|
2447
2455
|
...triggerProps,
|
|
2456
|
+
tabIndex: containsFocusable ? -1 : triggerProps.tabIndex,
|
|
2448
2457
|
onFocus: (e) => {
|
|
2449
2458
|
triggerProps.onFocus?.(e);
|
|
2450
2459
|
focusWithinProps.onFocus?.(e);
|
|
@@ -6081,15 +6090,7 @@ Modal.TitleContainer = ({ children, className, ...rest }) => {
|
|
|
6081
6090
|
const { titleContainer: titleContainer2 } = modalStyles();
|
|
6082
6091
|
return /* @__PURE__ */ React59.createElement("div", { ...rest, className: titleContainer2({ className }) }, children);
|
|
6083
6092
|
};
|
|
6084
|
-
var ModalBody = ({
|
|
6085
|
-
children,
|
|
6086
|
-
className,
|
|
6087
|
-
noFooter = false,
|
|
6088
|
-
maxHeight,
|
|
6089
|
-
style,
|
|
6090
|
-
size,
|
|
6091
|
-
...rest
|
|
6092
|
-
}) => {
|
|
6093
|
+
var ModalBody = ({ children, className, contentClassName, noFooter = false, maxHeight, style, size, ...rest }) => {
|
|
6093
6094
|
const { body, bodyContent } = modalStyles({ size });
|
|
6094
6095
|
const { containerRef, topSentinelRef, bottomSentinelRef, showTopFade, showBottomFade } = useScrollFade();
|
|
6095
6096
|
return /* @__PURE__ */ React59.createElement(
|
|
@@ -6101,7 +6102,7 @@ var ModalBody = ({
|
|
|
6101
6102
|
style: { maxHeight, ...style }
|
|
6102
6103
|
},
|
|
6103
6104
|
/* @__PURE__ */ React59.createElement("div", { ref: topSentinelRef, "aria-hidden": "true", className: "h-1px" }),
|
|
6104
|
-
/* @__PURE__ */ React59.createElement("div", { className: bodyContent({ noFooter }) }, children),
|
|
6105
|
+
/* @__PURE__ */ React59.createElement("div", { className: bodyContent({ noFooter, className: contentClassName }) }, children),
|
|
6105
6106
|
/* @__PURE__ */ React59.createElement("div", { ref: bottomSentinelRef, "aria-hidden": "true", className: "h-1px -mt-1px" })
|
|
6106
6107
|
);
|
|
6107
6108
|
};
|
|
@@ -8076,11 +8077,6 @@ var useDataListContext = () => {
|
|
|
8076
8077
|
// src/molecules/DataList/DataListGroup.tsx
|
|
8077
8078
|
import React80 from "react";
|
|
8078
8079
|
import { isFunction as isFunction2, noop } from "lodash-es";
|
|
8079
|
-
|
|
8080
|
-
// src/molecules/DataList/utils.ts
|
|
8081
|
-
var flattenRows = (rows) => areRowsGrouped(rows) ? Object.values(rows).flatMap(flattenRows) : rows;
|
|
8082
|
-
|
|
8083
|
-
// src/molecules/DataList/DataListGroup.tsx
|
|
8084
8080
|
var GAP = 8;
|
|
8085
8081
|
var INDENTATION = 28;
|
|
8086
8082
|
var sortGroupKeys = (groupKeys) => [...groupKeys].sort((a) => a === "undefined" ? -1 : 1);
|
|
@@ -8111,6 +8107,7 @@ var DataListGroup = ({
|
|
|
8111
8107
|
rows,
|
|
8112
8108
|
selectable,
|
|
8113
8109
|
selectedRows,
|
|
8110
|
+
statsByNode,
|
|
8114
8111
|
getOnSelectionChangeForId,
|
|
8115
8112
|
selectionDisabled = () => false,
|
|
8116
8113
|
getRowSelectionLabel = getDefaultRowSelectionLabel,
|
|
@@ -8139,8 +8136,8 @@ var DataListGroup = ({
|
|
|
8139
8136
|
items: groups,
|
|
8140
8137
|
renderItem: (row, index) => {
|
|
8141
8138
|
const isSelected = selectedRows?.includes(row.id) ?? false;
|
|
8142
|
-
const isDisabled = disabled?.(row, index,
|
|
8143
|
-
const isSelectionDisabled = selectionDisabled(row, index,
|
|
8139
|
+
const isDisabled = disabled?.(row, index, groups);
|
|
8140
|
+
const isSelectionDisabled = selectionDisabled(row, index, groups);
|
|
8144
8141
|
const isLastRow = isLastGroup && index === groups.length - 1;
|
|
8145
8142
|
return /* @__PURE__ */ React80.createElement(
|
|
8146
8143
|
DataListRow,
|
|
@@ -8150,7 +8147,7 @@ var DataListGroup = ({
|
|
|
8150
8147
|
row,
|
|
8151
8148
|
index,
|
|
8152
8149
|
isLast: isLastRow,
|
|
8153
|
-
rows,
|
|
8150
|
+
rows: groups,
|
|
8154
8151
|
active: selectable && isSelected,
|
|
8155
8152
|
menu: /* @__PURE__ */ React80.createElement(
|
|
8156
8153
|
DataListRowMenu,
|
|
@@ -8179,7 +8176,7 @@ var DataListGroup = ({
|
|
|
8179
8176
|
RadioButton,
|
|
8180
8177
|
{
|
|
8181
8178
|
value: row2.id.toString(),
|
|
8182
|
-
"aria-label": getRowSelectionLabel(row2, index2, isSelected,
|
|
8179
|
+
"aria-label": getRowSelectionLabel(row2, index2, isSelected, groups),
|
|
8183
8180
|
onChange: noop,
|
|
8184
8181
|
checked: isSelected,
|
|
8185
8182
|
disabled: isDisabled || isSelectionDisabled
|
|
@@ -8187,7 +8184,7 @@ var DataListGroup = ({
|
|
|
8187
8184
|
), isMultiSelectionMode && /* @__PURE__ */ React80.createElement(
|
|
8188
8185
|
Checkbox,
|
|
8189
8186
|
{
|
|
8190
|
-
"aria-label": getRowSelectionLabel(row2, index2, isSelected,
|
|
8187
|
+
"aria-label": getRowSelectionLabel(row2, index2, isSelected, groups),
|
|
8191
8188
|
onChange: getOnSelectionChangeForId(row2.id),
|
|
8192
8189
|
checked: isSelected,
|
|
8193
8190
|
disabled: isDisabled || isSelectionDisabled
|
|
@@ -8224,10 +8221,12 @@ var DataListGroup = ({
|
|
|
8224
8221
|
);
|
|
8225
8222
|
}
|
|
8226
8223
|
const openPanelId = expandedGroupIds ? expandedGroupIds.find((id) => id === key) ?? null : void 0;
|
|
8227
|
-
const
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8224
|
+
const { selectableIds, allSelected, isChecked, isDisabled } = statsByNode.get(group) ?? {
|
|
8225
|
+
selectableIds: [],
|
|
8226
|
+
allSelected: false,
|
|
8227
|
+
isChecked: false,
|
|
8228
|
+
isDisabled: true
|
|
8229
|
+
};
|
|
8231
8230
|
const isActiveRow = !!openPanelId || selectable && isChecked;
|
|
8232
8231
|
const isLastRow = isLastGroup && index === groupKeys.length - 1 && !openPanelId;
|
|
8233
8232
|
return /* @__PURE__ */ React80.createElement(Accordion, { key, openPanelId }, hasCustomRowForGroup && /* @__PURE__ */ React80.createElement(DataList.Row, { active: isActiveRow, noDivider: isLastRow }, selectable && /* @__PURE__ */ React80.createElement(DataList.Cell, null, isMultiSelectionMode && /* @__PURE__ */ React80.createElement(
|
|
@@ -8236,8 +8235,8 @@ var DataListGroup = ({
|
|
|
8236
8235
|
"aria-label": getGroupCheckboxLabel(key, group, index, isChecked, rows),
|
|
8237
8236
|
checked: isChecked,
|
|
8238
8237
|
indeterminate: isChecked && !allSelected,
|
|
8239
|
-
disabled:
|
|
8240
|
-
onChange: getOnSelectionChangeForId(
|
|
8238
|
+
disabled: isDisabled,
|
|
8239
|
+
onChange: getOnSelectionChangeForId(selectableIds)
|
|
8241
8240
|
}
|
|
8242
8241
|
)), /* @__PURE__ */ React80.createElement(
|
|
8243
8242
|
List,
|
|
@@ -8271,8 +8270,8 @@ var DataListGroup = ({
|
|
|
8271
8270
|
"aria-label": getGroupCheckboxLabel(key, group, index, isChecked, rows),
|
|
8272
8271
|
checked: isChecked,
|
|
8273
8272
|
indeterminate: isChecked && !allSelected,
|
|
8274
|
-
disabled:
|
|
8275
|
-
onChange: getOnSelectionChangeForId(
|
|
8273
|
+
disabled: isDisabled,
|
|
8274
|
+
onChange: getOnSelectionChangeForId(selectableIds)
|
|
8276
8275
|
}
|
|
8277
8276
|
)), /* @__PURE__ */ React80.createElement(
|
|
8278
8277
|
DataList.Cell,
|
|
@@ -8410,6 +8409,7 @@ var DataList2 = ({
|
|
|
8410
8409
|
const [sort, updateSort] = useTableSort({ ...initialSortState, onSortChanged });
|
|
8411
8410
|
const sortedRows = isArray2(rows) ? sortRowsBy(rows, sort) : [];
|
|
8412
8411
|
const groups = areRowsGrouped(rows) ? rows : group ? isFunction3(group) ? group(sortedRows) : groupBy2(sortedRows, group) : void 0;
|
|
8412
|
+
const rootNode = groups ?? sortedRows;
|
|
8413
8413
|
const isCollapsible = isFunction3(rowDetails);
|
|
8414
8414
|
const templateColumns = compact([
|
|
8415
8415
|
selectable ? "fit-content(28px)" : void 0,
|
|
@@ -8432,26 +8432,37 @@ var DataList2 = ({
|
|
|
8432
8432
|
}
|
|
8433
8433
|
};
|
|
8434
8434
|
const isMultiSelectionMode = selectable === "multiple" || selectable === "multiple-not-all";
|
|
8435
|
-
const
|
|
8436
|
-
const
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
(row,
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8435
|
+
const selectedIds = new Set(selected);
|
|
8436
|
+
const buildSelectionStats = (root) => {
|
|
8437
|
+
const statsByNode2 = /* @__PURE__ */ new Map();
|
|
8438
|
+
const recordStats = (node) => {
|
|
8439
|
+
const selectableIds2 = areRowsGrouped(node) ? Object.values(node).flatMap((child) => recordStats(child).selectableIds) : node.filter((row, i) => !disabled?.(row, i, node) && !selectionDisabled(row, i, node)).map((row) => row.id);
|
|
8440
|
+
const selectedSelectableCount = selectableIds2.filter((id) => selectedIds.has(id)).length;
|
|
8441
|
+
const stats = {
|
|
8442
|
+
selectableIds: selectableIds2,
|
|
8443
|
+
selectedSelectableCount,
|
|
8444
|
+
allSelected: selectableIds2.length > 0 && selectedSelectableCount === selectableIds2.length,
|
|
8445
|
+
isChecked: selectedSelectableCount > 0,
|
|
8446
|
+
isDisabled: selectableIds2.length === 0
|
|
8447
|
+
};
|
|
8448
|
+
statsByNode2.set(node, stats);
|
|
8449
|
+
return stats;
|
|
8450
|
+
};
|
|
8451
|
+
return { statsByNode: statsByNode2, rootStats: recordStats(root) };
|
|
8452
|
+
};
|
|
8453
|
+
const { statsByNode, rootStats } = buildSelectionStats(rootNode);
|
|
8454
|
+
const { selectableIds, isChecked, allSelected, isDisabled } = rootStats;
|
|
8443
8455
|
const componentContent = /* @__PURE__ */ React83.createElement(Template, { className: "Aquarium-DataList", columns: templateColumns, role: "table", "aria-label": ariaLabel }, !hideHeader && /* @__PURE__ */ React83.createElement(React83.Fragment, null, /* @__PURE__ */ React83.createElement(DataList.Row, { header: true }, selectable && /* @__PURE__ */ React83.createElement(DataList.HeadCell, { align: "left", sticky }, selectable === "multiple" && /* @__PURE__ */ React83.createElement(
|
|
8444
8456
|
Checkbox,
|
|
8445
8457
|
{
|
|
8446
8458
|
"aria-label": "Select all rows",
|
|
8447
|
-
indeterminate:
|
|
8448
|
-
checked:
|
|
8459
|
+
indeterminate: isChecked && !allSelected,
|
|
8460
|
+
checked: isChecked,
|
|
8461
|
+
disabled: isDisabled,
|
|
8449
8462
|
onChange: () => {
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
setSelected([]);
|
|
8454
|
-
}
|
|
8463
|
+
const enabledSet = new Set(selectableIds);
|
|
8464
|
+
const keptSelection = (selected ?? []).filter((id) => !enabledSet.has(id));
|
|
8465
|
+
setSelected(allSelected ? keptSelection : [...keptSelection, ...selectableIds]);
|
|
8455
8466
|
}
|
|
8456
8467
|
}
|
|
8457
8468
|
)), isCollapsible && /* @__PURE__ */ React83.createElement(DataList.HeadCell, { align: "left", sticky }), columns.map((column) => {
|
|
@@ -8496,6 +8507,7 @@ var DataList2 = ({
|
|
|
8496
8507
|
getGroupCheckboxLabel,
|
|
8497
8508
|
rows,
|
|
8498
8509
|
groups,
|
|
8510
|
+
statsByNode,
|
|
8499
8511
|
groupKey: void 0,
|
|
8500
8512
|
level: 0,
|
|
8501
8513
|
isLastGroup: true
|
|
@@ -8510,7 +8522,7 @@ var DataList2 = ({
|
|
|
8510
8522
|
const details = rowDetails?.(row, index, sortedRows);
|
|
8511
8523
|
const isSelected = selected?.includes(row.id) ?? false;
|
|
8512
8524
|
const isSelectionDisabled = selectionDisabled(row, index, sortedRows);
|
|
8513
|
-
const
|
|
8525
|
+
const isDisabled2 = disabled?.(row, index, sortedRows);
|
|
8514
8526
|
const openPanelId = expandedGroupIds.find((id) => id === row.id.toString()) || null;
|
|
8515
8527
|
const isLastRow = index === sortedRows.length - 1;
|
|
8516
8528
|
const content = /* @__PURE__ */ React83.createElement(
|
|
@@ -8533,7 +8545,7 @@ var DataList2 = ({
|
|
|
8533
8545
|
onAction,
|
|
8534
8546
|
onMenuOpenChange,
|
|
8535
8547
|
menuAriaLabel,
|
|
8536
|
-
disabled:
|
|
8548
|
+
disabled: isDisabled2
|
|
8537
8549
|
}
|
|
8538
8550
|
),
|
|
8539
8551
|
disabled,
|
|
@@ -8550,7 +8562,7 @@ var DataList2 = ({
|
|
|
8550
8562
|
"aria-label": getRowSelectionLabel(row2, index2, isSelected, sortedRows),
|
|
8551
8563
|
onChange: noop2,
|
|
8552
8564
|
checked: isSelected,
|
|
8553
|
-
disabled:
|
|
8565
|
+
disabled: isDisabled2 || isSelectionDisabled
|
|
8554
8566
|
}
|
|
8555
8567
|
), isMultiSelectionMode && /* @__PURE__ */ React83.createElement(
|
|
8556
8568
|
Checkbox,
|
|
@@ -8558,7 +8570,7 @@ var DataList2 = ({
|
|
|
8558
8570
|
"aria-label": getRowSelectionLabel(row2, index2, isSelected, sortedRows),
|
|
8559
8571
|
onChange: getOnSelectionChangeForId(row2.id),
|
|
8560
8572
|
checked: isSelected,
|
|
8561
|
-
disabled:
|
|
8573
|
+
disabled: isDisabled2 || isSelectionDisabled
|
|
8562
8574
|
}
|
|
8563
8575
|
)), rowDetails !== void 0 && /* @__PURE__ */ React83.createElement(DataList.Cell, null, details && /* @__PURE__ */ React83.createElement(Accordion.Toggle, { panelId: row2.id.toString(), onChange: onGroupToggled })));
|
|
8564
8576
|
},
|
|
@@ -11766,7 +11778,7 @@ var Dialog2 = (props) => {
|
|
|
11766
11778
|
if (!state.isOpen) {
|
|
11767
11779
|
return null;
|
|
11768
11780
|
}
|
|
11769
|
-
return /* @__PURE__ */ React96.createElement(Overlay, null, /* @__PURE__ */ React96.createElement(Modal, { className: "Aquarium-Dialog", open: true }, /* @__PURE__ */ React96.createElement(Modal.BackDrop, { ...underlayProps }), /* @__PURE__ */ React96.createElement(Modal.Dialog, { ref, size: "sm", isResponsive: false, ...modalProps }, /* @__PURE__ */ React96.createElement(DialogWrapper, { ...props }))));
|
|
11781
|
+
return /* @__PURE__ */ React96.createElement(Overlay, null, /* @__PURE__ */ React96.createElement(Modal, { className: "Aquarium-Dialog", open: true }, /* @__PURE__ */ React96.createElement(Modal.BackDrop, { ...underlayProps }), /* @__PURE__ */ React96.createElement(Modal.Dialog, { ref, size: "sm", isResponsive: false, className: "sm:max-w-[520px]", ...modalProps }, /* @__PURE__ */ React96.createElement(DialogWrapper, { ...props }))));
|
|
11770
11782
|
};
|
|
11771
11783
|
var DialogWrapper = ({
|
|
11772
11784
|
title,
|
|
@@ -11786,7 +11798,7 @@ var DialogWrapper = ({
|
|
|
11786
11798
|
},
|
|
11787
11799
|
ref
|
|
11788
11800
|
);
|
|
11789
|
-
return /* @__PURE__ */ React96.createElement("div", { ref, ...dialogProps, className: "outline-none" }, /* @__PURE__ */ React96.createElement(Modal.Header, { className: "icon-stroke-2" }, /* @__PURE__ */ React96.createElement(Icon, { icon: DIALOG_ICONS_AND_COLORS[type].icon, color: DIALOG_ICONS_AND_COLORS[type].color, fontSize: 20 }), /* @__PURE__ */ React96.createElement(Modal.Title, { id: labelledBy, variant: "large", color:
|
|
11801
|
+
return /* @__PURE__ */ React96.createElement("div", { ref, ...dialogProps, className: "outline-none" }, /* @__PURE__ */ React96.createElement(Modal.Header, { className: "icon-stroke-2 px-6 pr-6" }, /* @__PURE__ */ React96.createElement(Icon, { icon: DIALOG_ICONS_AND_COLORS[type].icon, color: DIALOG_ICONS_AND_COLORS[type].color, fontSize: 20 }), /* @__PURE__ */ React96.createElement(Modal.Title, { id: labelledBy, variant: "large", color: "default" }, title)), /* @__PURE__ */ React96.createElement(Modal.Body, { id: describedBy, contentClassName: "px-6" }, /* @__PURE__ */ React96.createElement(Typography2.Default, null, children)), /* @__PURE__ */ React96.createElement(Modal.Footer, { className: "px-6" }, /* @__PURE__ */ React96.createElement(Modal.Actions, { className: "gap-4" }, secondaryAction && /* @__PURE__ */ React96.createElement(Button2.Ghost, { key: secondaryAction.text, ...omit10(secondaryAction, "text") }, secondaryAction.text), /* @__PURE__ */ React96.createElement(Button2.Secondary, { key: primaryAction.text, ...omit10(primaryAction, "text") }, primaryAction.text))));
|
|
11790
11802
|
};
|
|
11791
11803
|
|
|
11792
11804
|
// src/molecules/Drawer/Drawer.tsx
|