@aivenio/aquarium 1.13.0-rc1 → 1.14.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.
Files changed (33) hide show
  1. package/dist/_variables.scss +1 -1
  2. package/dist/_variables_timescale.scss +1 -1
  3. package/dist/atoms.cjs +28 -12
  4. package/dist/atoms.mjs +28 -12
  5. package/dist/src/atoms/DataList/DataList.d.ts +3 -1
  6. package/dist/src/atoms/DataList/DataList.js +5 -5
  7. package/dist/src/atoms/Table/Table.d.ts +4 -3
  8. package/dist/src/atoms/Table/Table.js +17 -7
  9. package/dist/src/molecules/DataList/DataList.d.ts +3 -3
  10. package/dist/src/molecules/DataList/DataList.js +7 -7
  11. package/dist/src/molecules/DataTable/DataTable.d.ts +3 -3
  12. package/dist/src/molecules/DataTable/DataTable.js +5 -5
  13. package/dist/src/molecules/Dialog/Dialog.js +3 -2
  14. package/dist/src/molecules/DropdownMenu/DropdownMenu.js +2 -2
  15. package/dist/src/molecules/Modal/Modal.d.ts +5 -0
  16. package/dist/src/molecules/Modal/Modal.js +4 -3
  17. package/dist/src/molecules/Popover/PopoverOverlay.d.ts +1 -0
  18. package/dist/src/molecules/Popover/PopoverOverlay.js +3 -3
  19. package/dist/src/utils/table/types.d.ts +28 -12
  20. package/dist/src/utils/table/types.js +3 -1
  21. package/dist/src/utils/table/useTableSort.d.ts +2 -2
  22. package/dist/src/utils/table/useTableSort.js +5 -5
  23. package/dist/src/utils/table/utils.d.ts +2 -0
  24. package/dist/src/utils/table/utils.js +16 -0
  25. package/dist/styles.css +5 -5
  26. package/dist/styles_timescaledb.css +5 -5
  27. package/dist/system.cjs +109 -50
  28. package/dist/system.mjs +98 -40
  29. package/dist/tokens.json +4 -4
  30. package/dist/tsconfig.module.tsbuildinfo +1 -1
  31. package/package.json +2 -2
  32. package/dist/src/molecules/Charts/data.d.ts +0 -1
  33. package/dist/src/molecules/Charts/data.js +0 -122
package/dist/system.mjs CHANGED
@@ -219,7 +219,7 @@ var require_tokens = __commonJS({
219
219
  style: {
220
220
  fontFamily: "Inter",
221
221
  fontSize: "16px",
222
- fontWeight: 600,
222
+ fontWeight: 500,
223
223
  fontStyle: "normal",
224
224
  lineHeight: 1.5,
225
225
  textTransform: "none"
@@ -245,7 +245,7 @@ var require_tokens = __commonJS({
245
245
  style: {
246
246
  fontFamily: "Inter",
247
247
  fontSize: "14px",
248
- fontWeight: 600,
248
+ fontWeight: 500,
249
249
  fontStyle: "normal",
250
250
  lineHeight: 1.42,
251
251
  textTransform: "none"
@@ -779,7 +779,7 @@ var require_tokens = __commonJS({
779
779
  style: {
780
780
  fontFamily: "Inter",
781
781
  fontSize: "16px",
782
- fontWeight: 600,
782
+ fontWeight: 500,
783
783
  fontStyle: "normal",
784
784
  lineHeight: 1.5,
785
785
  textTransform: "none"
@@ -805,7 +805,7 @@ var require_tokens = __commonJS({
805
805
  style: {
806
806
  fontFamily: "Inter",
807
807
  fontSize: "14px",
808
- fontWeight: 600,
808
+ fontWeight: 500,
809
809
  fontStyle: "normal",
810
810
  lineHeight: 1.42,
811
811
  textTransform: "none"
@@ -1646,6 +1646,7 @@ __export(molecules_exports, {
1646
1646
  asPopoverButton: () => asPopoverButton,
1647
1647
  asTabItem: () => asTabItem,
1648
1648
  cellProps: () => cellProps,
1649
+ columnIsFieldColumn: () => columnIsFieldColumn,
1649
1650
  createTabsComponent: () => createTabsComponent,
1650
1651
  toSortDirection: () => toSortDirection,
1651
1652
  usePagination: () => usePagination,
@@ -4962,6 +4963,7 @@ var Wrapper = React40.forwardRef(
4962
4963
  style = {},
4963
4964
  placement = "bottom-left",
4964
4965
  role,
4966
+ focusable = true,
4965
4967
  isNonModal = false,
4966
4968
  autoFocus,
4967
4969
  containFocus,
@@ -4974,6 +4976,7 @@ var Wrapper = React40.forwardRef(
4974
4976
  "style",
4975
4977
  "placement",
4976
4978
  "role",
4979
+ "focusable",
4977
4980
  "isNonModal",
4978
4981
  "autoFocus",
4979
4982
  "containFocus",
@@ -4997,7 +5000,7 @@ var Wrapper = React40.forwardRef(
4997
5000
  );
4998
5001
  return /* @__PURE__ */ React40.createElement("div", null, !isNonModal && /* @__PURE__ */ React40.createElement(Popover.Underlay, __spreadValues({}, underlayProps)), /* @__PURE__ */ React40.createElement(Popover.Panel, __spreadProps(__spreadValues({
4999
5002
  ref: popoverRef,
5000
- tabIndex: 0,
5003
+ tabIndex: focusable ? 0 : -1,
5001
5004
  role: role != null ? role : "presentation"
5002
5005
  }, popoverProps), {
5003
5006
  id: id != null ? id : popoverProps.id,
@@ -5210,7 +5213,6 @@ var Container2 = ({ maxWidth = "xl", children }) => /* @__PURE__ */ React42.crea
5210
5213
 
5211
5214
  // src/molecules/DataList/DataList.tsx
5212
5215
  import React48 from "react";
5213
- import orderBy2 from "lodash/orderBy";
5214
5216
 
5215
5217
  // src/molecules/Template/Template.tsx
5216
5218
  import React43 from "react";
@@ -5300,7 +5302,7 @@ var TableBody = (_a) => {
5300
5302
  var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
5301
5303
  return /* @__PURE__ */ React45.createElement("tbody", __spreadValues({}, rest), children);
5302
5304
  };
5303
- var rowClassNames = tw("children:border-grey-10 children:last:border-b-0 hover:bg-grey-0");
5305
+ var rowClassNames = tw("children:border-grey-10 group children:last:border-b-0 hover:bg-grey-0");
5304
5306
  var TableRow = (_a) => {
5305
5307
  var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
5306
5308
  return /* @__PURE__ */ React45.createElement("tr", __spreadProps(__spreadValues({}, rest), {
@@ -5308,27 +5310,43 @@ var TableRow = (_a) => {
5308
5310
  }), children);
5309
5311
  };
5310
5312
  var cellClassNames = tw("px-4 border-b typography-small leading-[18px]");
5311
- var getBodyCellClassNames = (table = true) => tw("text-grey-70 py-3", {
5313
+ var getBodyCellClassNames = (table = true, stickyColumn) => tw("text-grey-70 py-3", {
5312
5314
  "h-[50px]": table,
5313
- "min-h-[50px]": !table
5315
+ "min-h-[50px]": !table,
5316
+ "sticky z-10 bg-white group-hover:bg-grey-0": Boolean(stickyColumn),
5317
+ "left-0": stickyColumn === "left",
5318
+ "right-0": stickyColumn === "right"
5314
5319
  });
5315
5320
  var getAlignClassNames = (align) => tw({ "text-right": align === "right", "text-center": align === "center" });
5316
- var getHeadCellClassNames = (sticky = true) => {
5321
+ var getHeadCellClassNames = (sticky = true, stickyColumn) => {
5317
5322
  const common = tw("py-[14px] text-left bg-white border-grey-40 text-grey-50 font-normal");
5318
- return sticky ? classNames(common, tw("sticky top-0 z-10")) : common;
5323
+ return sticky ? classNames(
5324
+ common,
5325
+ tw("sticky top-0", {
5326
+ "z-10": !stickyColumn,
5327
+ "z-20": Boolean(stickyColumn),
5328
+ "left-0": stickyColumn === "left",
5329
+ "right-0": stickyColumn === "right"
5330
+ })
5331
+ ) : common;
5319
5332
  };
5320
5333
  var TableCell = (_a) => {
5321
- var _b = _a, { children, className, align = "left" } = _b, rest = __objRest(_b, ["children", "className", "align"]);
5334
+ var _b = _a, { children, className, stickyColumn, align = "left" } = _b, rest = __objRest(_b, ["children", "className", "stickyColumn", "align"]);
5322
5335
  const headContext = React45.useContext(HeadContext);
5323
5336
  return headContext ? /* @__PURE__ */ React45.createElement("th", __spreadProps(__spreadValues({}, rest), {
5324
5337
  className: classNames(
5325
5338
  cellClassNames,
5326
- getHeadCellClassNames(headContext.sticky),
5339
+ getHeadCellClassNames(headContext.sticky, stickyColumn),
5327
5340
  getAlignClassNames(align),
5328
5341
  className
5329
5342
  )
5330
5343
  }), children) : /* @__PURE__ */ React45.createElement("td", __spreadProps(__spreadValues({}, rest), {
5331
- className: classNames(cellClassNames, getBodyCellClassNames(), getAlignClassNames(align), className)
5344
+ className: classNames(
5345
+ cellClassNames,
5346
+ getBodyCellClassNames(true, stickyColumn),
5347
+ getAlignClassNames(align),
5348
+ className
5349
+ )
5332
5350
  }), children);
5333
5351
  };
5334
5352
  var TableSelectCell = (_a) => {
@@ -5397,24 +5415,39 @@ var HeadCell = (_a) => {
5397
5415
  var _b = _a, {
5398
5416
  className,
5399
5417
  sticky,
5400
- align
5418
+ align,
5419
+ stickyColumn
5401
5420
  } = _b, rest = __objRest(_b, [
5402
5421
  "className",
5403
5422
  "sticky",
5404
- "align"
5423
+ "align",
5424
+ "stickyColumn"
5405
5425
  ]);
5406
5426
  return /* @__PURE__ */ React46.createElement("div", __spreadProps(__spreadValues({}, rest), {
5407
5427
  role: "cell",
5408
- className: classNames(cellClassNames, getHeadCellClassNames(sticky), getAlignClassNames2(align), className)
5428
+ className: classNames(
5429
+ cellClassNames,
5430
+ getHeadCellClassNames(sticky, stickyColumn),
5431
+ getAlignClassNames2(align),
5432
+ className
5433
+ )
5409
5434
  }));
5410
5435
  };
5411
5436
  var Cell = (_a) => {
5412
- var _b = _a, { className, align } = _b, rest = __objRest(_b, ["className", "align"]);
5437
+ var _b = _a, {
5438
+ className,
5439
+ align,
5440
+ stickyColumn
5441
+ } = _b, rest = __objRest(_b, [
5442
+ "className",
5443
+ "align",
5444
+ "stickyColumn"
5445
+ ]);
5413
5446
  return /* @__PURE__ */ React46.createElement("div", __spreadProps(__spreadValues({}, rest), {
5414
5447
  role: "cell",
5415
5448
  className: classNames(
5416
5449
  cellClassNames,
5417
- getBodyCellClassNames(false),
5450
+ getBodyCellClassNames(false, stickyColumn),
5418
5451
  getAlignClassNames2(align),
5419
5452
  tw("border-grey-10 group-hover:bg-grey-0 group-last:border-b-0"),
5420
5453
  className
@@ -5469,31 +5502,52 @@ var renameProperty = (oldProp, newProp, _a) => {
5469
5502
  var toSortDirection = (direction) => direction === "ascending" ? "asc" : direction === "descending" ? "desc" : false;
5470
5503
  var cellProps = (column) => ({
5471
5504
  key: column.key || column.headerName,
5472
- align: column.type === "number" || column.type === "action" ? "right" : "left"
5505
+ align: column.type === "number" || column.type === "action" ? "right" : "left",
5506
+ stickyColumn: column.sticky
5473
5507
  });
5508
+ var columnIsFieldColumn = (column) => Boolean(column && column.field);
5474
5509
 
5475
5510
  // src/utils/table/useTableSort.tsx
5476
5511
  import React47 from "react";
5477
5512
  var useTableSort = () => {
5478
5513
  const [sort, setSort] = React47.useState();
5479
- const handleSortClick = (field) => {
5480
- if ((sort == null ? void 0 : sort.key) === field) {
5514
+ const handleSortClick = (column) => {
5515
+ if (sort && sort.column.headerName === column.headerName) {
5481
5516
  if (sort.direction === "ascending") {
5482
- setSort({ key: field, direction: "descending" });
5517
+ setSort({ column, direction: "descending" });
5483
5518
  } else {
5484
5519
  setSort(void 0);
5485
5520
  }
5486
5521
  } else {
5487
- setSort({ key: field, direction: "ascending" });
5522
+ setSort({ column, direction: "ascending" });
5488
5523
  }
5489
5524
  };
5490
5525
  return [sort, handleSortClick];
5491
5526
  };
5492
5527
 
5528
+ // src/utils/table/utils.ts
5529
+ import orderBy2 from "lodash/orderBy";
5530
+ var sortRowsBy = (rows, sort) => {
5531
+ if (!sort) {
5532
+ return rows;
5533
+ }
5534
+ const sortFunction = sort.column.sort;
5535
+ if (sortFunction) {
5536
+ return [...rows].sort((a, b) => sortFunction(a, b, sort.direction));
5537
+ } else if (columnIsFieldColumn(sort.column)) {
5538
+ return orderBy2(rows, [sort.column.field], [toSortDirection(sort.direction)]);
5539
+ }
5540
+ return rows;
5541
+ };
5542
+
5493
5543
  // src/molecules/DataList/DataList.tsx
5494
- var DataList2 = ({ columns, rows, sticky }) => {
5544
+ var DataList2 = ({
5545
+ columns,
5546
+ rows,
5547
+ sticky
5548
+ }) => {
5495
5549
  const [sort, updateSort] = useTableSort();
5496
- const sortedRows = orderBy2(rows, [sort == null ? void 0 : sort.key], [toSortDirection(sort == null ? void 0 : sort.direction)]);
5550
+ const sortedRows = sortRowsBy(rows, sort);
5497
5551
  const templateColumns = columns.map((column) => {
5498
5552
  var _a;
5499
5553
  return (_a = column.width) != null ? _a : "auto";
@@ -5501,9 +5555,9 @@ var DataList2 = ({ columns, rows, sticky }) => {
5501
5555
  return /* @__PURE__ */ React48.createElement(Template, {
5502
5556
  columns: templateColumns
5503
5557
  }, columns.map(
5504
- (column) => (column.type === "text" || column.type === "number") && column.sortable ? /* @__PURE__ */ React48.createElement(DataList.SortCell, __spreadValues({
5505
- direction: sort && sort.key === column.field ? sort.direction : "none",
5506
- onClick: () => updateSort(column.field),
5558
+ (column) => columnIsFieldColumn(column) && column.sortable || column.sort ? /* @__PURE__ */ React48.createElement(DataList.SortCell, __spreadValues({
5559
+ direction: sort && sort.column.headerName === column.headerName ? sort.direction : "none",
5560
+ onClick: () => updateSort(column),
5507
5561
  sticky
5508
5562
  }, cellProps(column)), column.headerName) : /* @__PURE__ */ React48.createElement(DataList.HeadCell, __spreadProps(__spreadValues({}, cellProps(column)), {
5509
5563
  sticky
@@ -5518,14 +5572,13 @@ var DataList2 = ({ columns, rows, sticky }) => {
5518
5572
  dense: true
5519
5573
  }, column.status(row, index, sortedRows)))) : column.type === "action" ? /* @__PURE__ */ React48.createElement(DataList.Cell, __spreadValues({}, cellProps(column)), /* @__PURE__ */ React48.createElement(SecondaryButton, __spreadValues({
5520
5574
  dense: true
5521
- }, renameProperty("text", "children", column.action(row, index, sortedRows))))) : column.type === "custom" ? /* @__PURE__ */ React48.createElement(DataList.Cell, __spreadValues({}, cellProps(column)), column.UNSAFE_render(row, index, sortedRows)) : column.type === "item" ? /* @__PURE__ */ React48.createElement(DataList.Cell, null, /* @__PURE__ */ React48.createElement(Item2, __spreadValues({}, column.item(row, index, sortedRows)))) : /* @__PURE__ */ React48.createElement(DataList.Cell, __spreadValues({}, cellProps(column)), column.formatter ? column.formatter(row[column.field], row, index, sortedRows) : row[column.field])
5575
+ }, renameProperty("text", "children", column.action(row, index, sortedRows))))) : column.type === "custom" ? /* @__PURE__ */ React48.createElement(DataList.Cell, __spreadValues({}, cellProps(column)), column.UNSAFE_render(row, index, sortedRows)) : column.type === "item" ? /* @__PURE__ */ React48.createElement(DataList.Cell, __spreadValues({}, cellProps(column)), /* @__PURE__ */ React48.createElement(Item2, __spreadValues({}, column.item(row, index, sortedRows)))) : /* @__PURE__ */ React48.createElement(DataList.Cell, __spreadValues({}, cellProps(column)), column.formatter ? column.formatter(row[column.field], row, index, sortedRows) : row[column.field])
5522
5576
  }))
5523
5577
  }));
5524
5578
  };
5525
5579
 
5526
5580
  // src/molecules/DataTable/DataTable.tsx
5527
5581
  import React51 from "react";
5528
- import orderBy3 from "lodash/orderBy";
5529
5582
 
5530
5583
  // src/molecules/Table/Table.tsx
5531
5584
  import React50 from "react";
@@ -5585,7 +5638,7 @@ var DataTable = (_a) => {
5585
5638
  "sticky"
5586
5639
  ]);
5587
5640
  const [sort, updateSort] = useTableSort();
5588
- const sortedRows = orderBy3(rows, [sort == null ? void 0 : sort.key], [toSortDirection(sort == null ? void 0 : sort.direction)]);
5641
+ const sortedRows = sortRowsBy(rows, sort);
5589
5642
  return /* @__PURE__ */ React51.createElement(Table2, __spreadProps(__spreadValues({}, rest), {
5590
5643
  className: tw({
5591
5644
  "whitespace-nowrap": noWrap,
@@ -5595,9 +5648,9 @@ var DataTable = (_a) => {
5595
5648
  }), /* @__PURE__ */ React51.createElement(Table2.Head, {
5596
5649
  sticky
5597
5650
  }, columns.map(
5598
- (column) => (column.type === "text" || column.type === "number") && column.sortable ? /* @__PURE__ */ React51.createElement(Table2.SortCell, __spreadValues({
5599
- direction: sort && sort.key === column.field ? sort.direction : "none",
5600
- onClick: () => updateSort(column.field),
5651
+ (column) => columnIsFieldColumn(column) && column.sortable || column.sort ? /* @__PURE__ */ React51.createElement(Table2.SortCell, __spreadValues({
5652
+ direction: sort && sort.column.headerName === column.headerName ? sort.direction : "none",
5653
+ onClick: () => updateSort(column),
5601
5654
  style: { width: column.width },
5602
5655
  "aria-label": column.headerInvisible ? column.headerName : void 0
5603
5656
  }, cellProps(column)), !column.headerInvisible && column.headerName) : /* @__PURE__ */ React51.createElement(Table2.Cell, __spreadProps(__spreadValues({}, cellProps(column)), {
@@ -5777,9 +5830,11 @@ var DialogWrapper = ({
5777
5830
  { "role": "alertdialog", "aria-labelledby": labelledBy, "aria-describedby": describedBy },
5778
5831
  ref
5779
5832
  );
5780
- return /* @__PURE__ */ React53.createElement("div", __spreadValues({
5833
+ return /* @__PURE__ */ React53.createElement("div", __spreadProps(__spreadValues({
5781
5834
  ref
5782
- }, dialogProps), /* @__PURE__ */ React53.createElement(Modal.Header, null, /* @__PURE__ */ React53.createElement(Icon, {
5835
+ }, dialogProps), {
5836
+ className: tw("outline-none")
5837
+ }), /* @__PURE__ */ React53.createElement(Modal.Header, null, /* @__PURE__ */ React53.createElement(Icon, {
5783
5838
  icon: DIALOG_ICONS_AND_COLORS[type].icon,
5784
5839
  color: DIALOG_ICONS_AND_COLORS[type].color,
5785
5840
  fontSize: 20
@@ -6348,7 +6403,8 @@ var DropdownMenu3 = (_a) => {
6348
6403
  }, menuTriggerProps), /* @__PURE__ */ React61.createElement(TriggerWrapper, null, trigger.props.children)), state.isOpen && /* @__PURE__ */ React61.createElement(PopoverOverlay, {
6349
6404
  triggerRef,
6350
6405
  state,
6351
- placement
6406
+ placement,
6407
+ focusable: false
6352
6408
  }, /* @__PURE__ */ React61.createElement(MenuWrapper, __spreadValues({
6353
6409
  onAction,
6354
6410
  selectionMode,
@@ -7041,12 +7097,13 @@ var Tabs = createTabsComponent(Tab, TabItem, "Tabs", (children, selected) => /*
7041
7097
 
7042
7098
  // src/molecules/Modal/Modal.tsx
7043
7099
  var import_cross5 = __toESM(require_cross());
7044
- var Modal2 = (props) => {
7100
+ var Modal2 = (_a) => {
7101
+ var _b = _a, { closeOnEsc = true } = _b, props = __objRest(_b, ["closeOnEsc"]);
7045
7102
  const { open, onClose, size, portalContainer } = props;
7046
7103
  const ref = React71.useRef(null);
7047
7104
  const state = useOverlayTriggerState4({ isOpen: open, onOpenChange: (isOpen) => !isOpen && onClose() });
7048
7105
  const { modalProps, underlayProps } = useModalOverlay2(
7049
- { isDismissable: true, isKeyboardDismissDisabled: false },
7106
+ { isDismissable: true, isKeyboardDismissDisabled: !closeOnEsc },
7050
7107
  state,
7051
7108
  ref
7052
7109
  );
@@ -9260,6 +9317,7 @@ export {
9260
9317
  calcTopPosition,
9261
9318
  calcTopRightPosition,
9262
9319
  cellProps,
9320
+ columnIsFieldColumn,
9263
9321
  createComponent,
9264
9322
  createMountPointElement,
9265
9323
  createSimpleComponent,
package/dist/tokens.json CHANGED
@@ -160,7 +160,7 @@
160
160
  "style": {
161
161
  "fontFamily": "Inter",
162
162
  "fontSize": "16px",
163
- "fontWeight": 600,
163
+ "fontWeight": 500,
164
164
  "fontStyle": "normal",
165
165
  "lineHeight": 1.5,
166
166
  "textTransform": "none"
@@ -186,7 +186,7 @@
186
186
  "style": {
187
187
  "fontFamily": "Inter",
188
188
  "fontSize": "14px",
189
- "fontWeight": 600,
189
+ "fontWeight": 500,
190
190
  "fontStyle": "normal",
191
191
  "lineHeight": 1.42,
192
192
  "textTransform": "none"
@@ -720,7 +720,7 @@
720
720
  "style": {
721
721
  "fontFamily": "Inter",
722
722
  "fontSize": "16px",
723
- "fontWeight": 600,
723
+ "fontWeight": 500,
724
724
  "fontStyle": "normal",
725
725
  "lineHeight": 1.5,
726
726
  "textTransform": "none"
@@ -746,7 +746,7 @@
746
746
  "style": {
747
747
  "fontFamily": "Inter",
748
748
  "fontSize": "14px",
749
- "fontWeight": 600,
749
+ "fontWeight": 500,
750
750
  "fontStyle": "normal",
751
751
  "lineHeight": 1.42,
752
752
  "textTransform": "none"