@aivenio/aquarium 4.2.0 → 4.4.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
@@ -12272,14 +12272,30 @@ var CalendarGridHeader = () => {
12272
12272
  // src/atoms/DatePicker/DatePicker.tsx
12273
12273
  import React84 from "react";
12274
12274
  import {
12275
+ Button as AriaButton3,
12275
12276
  DatePicker as AriaDatePicker,
12276
- DateRangePicker as AriaDateRangePicker
12277
+ DatePickerStateContext as AriaDatePickerStateContext,
12278
+ DateRangePicker as AriaDateRangePicker,
12279
+ DateRangePickerStateContext as AriaDateRangePickerStateContext
12277
12280
  } from "react-aria-components";
12278
12281
  import { tv as tv11 } from "tailwind-variants";
12279
12282
  var datePickerCalendarStyles = tv11({
12280
12283
  slots: {
12281
- dialog: "p-5 [[data-placement]>&]:px-5 [[data-placement]>&]:py-6 max-h-[inherit]",
12282
- errorMessage: "typography-caption text-danger-default max-w-[300px]"
12284
+ dialog: "flex",
12285
+ calendar: "[[data-placement]>&]:px-5 [[data-placement]>&]:py-6 max-h-[inherit]",
12286
+ errorMessage: "typography-caption text-danger-default max-w-[300px]",
12287
+ presets: "bg-muted py-6 px-5 flex flex-col min-w-[150px] max-w-[300px] self-stretch",
12288
+ preset: "hover:text-primary-active p-3 text-left hover:underline"
12289
+ },
12290
+ variants: {
12291
+ isPresetActive: {
12292
+ true: {
12293
+ preset: "text-primary-active typography-small-strong"
12294
+ },
12295
+ false: {
12296
+ preset: "typography-small"
12297
+ }
12298
+ }
12283
12299
  }
12284
12300
  });
12285
12301
  var DatePicker = ({ variant, ...props }) => {
@@ -12304,6 +12320,30 @@ var DateRangePicker = ({ variant, ...props }) => {
12304
12320
  }
12305
12321
  );
12306
12322
  };
12323
+ var Presets = ({ children }) => {
12324
+ const { presets } = datePickerCalendarStyles();
12325
+ return /* @__PURE__ */ React84.createElement("div", { className: presets() }, children);
12326
+ };
12327
+ var Preset = ({ value, label }) => {
12328
+ const { preset } = datePickerCalendarStyles();
12329
+ const context2 = React84.useContext(AriaDatePickerStateContext);
12330
+ const handlePress = () => {
12331
+ context2?.setValue(value);
12332
+ context2?.close();
12333
+ };
12334
+ const isActive = context2?.value !== void 0 && context2.value?.toString() === value.toString();
12335
+ return /* @__PURE__ */ React84.createElement(AriaButton3, { onPress: handlePress, className: preset({ isPresetActive: isActive }) }, label);
12336
+ };
12337
+ var RangePreset = ({ value, label }) => {
12338
+ const { preset } = datePickerCalendarStyles();
12339
+ const context2 = React84.useContext(AriaDateRangePickerStateContext);
12340
+ const handlePress = () => {
12341
+ context2?.setValue(value);
12342
+ context2?.close();
12343
+ };
12344
+ const isActive = context2?.value !== void 0 && context2.value.start?.toString() === value.start.toString() && context2.value.end?.toString() === value.end.toString();
12345
+ return /* @__PURE__ */ React84.createElement(AriaButton3, { onPress: handlePress, className: preset({ isPresetActive: isActive }) }, label);
12346
+ };
12307
12347
 
12308
12348
  // src/atoms/Dialog/Dialog.tsx
12309
12349
  import React85 from "react";
@@ -14833,9 +14873,9 @@ var CalendarTimeField = ({ granularity, labelText = "Time", ...props }) => {
14833
14873
  var DatePickerCalendarPropsContext = React86.createContext(null);
14834
14874
  var DatePickerCalendar = (props) => {
14835
14875
  const ctx = React86.useContext(DatePickerCalendarPropsContext);
14836
- const { variant, granularity, errorMessage } = mergeProps3(ctx, props);
14837
- const { dialog, errorMessage: errorMessageStyle } = datePickerCalendarStyles();
14838
- return /* @__PURE__ */ React86.createElement(Popover, { offset: 0 }, /* @__PURE__ */ React86.createElement(Dialog, { className: dialog() }, /* @__PURE__ */ React86.createElement(Spacing, { gap: "3" }, /* @__PURE__ */ React86.createElement(Calendar, null), variant === "datetime" && /* @__PURE__ */ React86.createElement(CalendarTimeField, { granularity }), errorMessage && /* @__PURE__ */ React86.createElement(Text, { slot: "errorMessage", className: errorMessageStyle() }, errorMessage))));
14876
+ const { variant, granularity, errorMessage, presets = [] } = mergeProps3(ctx, props);
14877
+ const { dialog, calendar, errorMessage: errorMessageStyle } = datePickerCalendarStyles();
14878
+ return /* @__PURE__ */ React86.createElement(Popover, { offset: 0 }, /* @__PURE__ */ React86.createElement(Dialog, { className: dialog() }, presets.length > 0 && /* @__PURE__ */ React86.createElement(Presets, null, presets.map((props2) => /* @__PURE__ */ React86.createElement(Preset, { key: props2.value.toString(), ...props2 }))), /* @__PURE__ */ React86.createElement(Spacing, { gap: "3", className: tw("p-5") }, /* @__PURE__ */ React86.createElement(Calendar, { className: calendar() }), variant === "datetime" && /* @__PURE__ */ React86.createElement(CalendarTimeField, { granularity }), errorMessage && /* @__PURE__ */ React86.createElement(Text, { slot: "errorMessage", className: errorMessageStyle() }, errorMessage))));
14839
14879
  };
14840
14880
  DatePickerCalendar.displayName = "DatePicker.Calendar";
14841
14881
  var DatePickerField = ({ clearSelectionEnabled = true, disabled = false }) => {
@@ -14849,11 +14889,18 @@ var createDatePickerBase = (variant) => {
14849
14889
  shouldCloseOnSelect,
14850
14890
  errorMessage,
14851
14891
  clearSelectionEnabled = true,
14892
+ presets,
14852
14893
  children,
14853
14894
  ...props
14854
14895
  }) => {
14855
14896
  const content = children ?? /* @__PURE__ */ React86.createElement(React86.Fragment, null, /* @__PURE__ */ React86.createElement(DatePickerField, { clearSelectionEnabled, disabled }), /* @__PURE__ */ React86.createElement(DatePickerCalendar, null));
14856
- return /* @__PURE__ */ React86.createElement(DatePickerCalendarPropsContext.Provider, { value: { variant, granularity: props.granularity, errorMessage } }, /* @__PURE__ */ React86.createElement(DatePicker, { ...props, variant, isDisabled: disabled, isInvalid: valid === false }, content));
14897
+ return /* @__PURE__ */ React86.createElement(
14898
+ DatePickerCalendarPropsContext.Provider,
14899
+ {
14900
+ value: { variant, granularity: props.granularity, errorMessage, presets }
14901
+ },
14902
+ /* @__PURE__ */ React86.createElement(DatePicker, { ...props, variant, isDisabled: disabled, isInvalid: valid === false }, content)
14903
+ );
14857
14904
  };
14858
14905
  datePicker.Calendar = DatePickerCalendar;
14859
14906
  datePicker.Field = DatePickerField;
@@ -14983,9 +15030,9 @@ var RangeCalendarTimeField = ({ granularity, part, ...props }) => {
14983
15030
  var DateRangePickerCalendarPropsContext = React88.createContext(null);
14984
15031
  var DateRangePickerCalendar = (props) => {
14985
15032
  const ctx = React88.useContext(DateRangePickerCalendarPropsContext);
14986
- const { variant, granularity, errorMessage } = mergeProps4(ctx, props);
14987
- const { dialog, errorMessage: errorMessageStyle } = datePickerCalendarStyles();
14988
- return /* @__PURE__ */ React88.createElement(Popover, { offset: 0 }, /* @__PURE__ */ React88.createElement(Dialog, { className: dialog() }, /* @__PURE__ */ React88.createElement(Spacing, { gap: "3" }, /* @__PURE__ */ React88.createElement(RangeCalendar, null), variant === "datetime" && /* @__PURE__ */ React88.createElement(Box.Flex, { gap: "6" }, /* @__PURE__ */ React88.createElement("div", { className: tw("flex-1") }, /* @__PURE__ */ React88.createElement(RangeCalendarTimeField, { granularity, part: "start" })), /* @__PURE__ */ React88.createElement("div", { className: tw("flex-1") }, /* @__PURE__ */ React88.createElement(RangeCalendarTimeField, { granularity, part: "end" }))), errorMessage && /* @__PURE__ */ React88.createElement(Text2, { slot: "errorMessage", className: errorMessageStyle() }, errorMessage))));
15033
+ const { variant, granularity, errorMessage, presets = [] } = mergeProps4(ctx, props);
15034
+ const { dialog, calendar, errorMessage: errorMessageStyle } = datePickerCalendarStyles();
15035
+ return /* @__PURE__ */ React88.createElement(Popover, { offset: 0 }, /* @__PURE__ */ React88.createElement(Dialog, { className: dialog() }, presets.length > 0 && /* @__PURE__ */ React88.createElement(Presets, null, presets.map((props2) => /* @__PURE__ */ React88.createElement(RangePreset, { key: `${props2.value.start.toString()}-${props2.value.end.toString()}`, ...props2 }))), /* @__PURE__ */ React88.createElement(Spacing, { gap: "3", className: tw("p-5") }, /* @__PURE__ */ React88.createElement(RangeCalendar, { className: calendar() }), variant === "datetime" && /* @__PURE__ */ React88.createElement(Box.Flex, { gap: "6" }, /* @__PURE__ */ React88.createElement("div", { className: tw("flex-1") }, /* @__PURE__ */ React88.createElement(RangeCalendarTimeField, { granularity, part: "start" })), /* @__PURE__ */ React88.createElement("div", { className: tw("flex-1") }, /* @__PURE__ */ React88.createElement(RangeCalendarTimeField, { granularity, part: "end" }))), errorMessage && /* @__PURE__ */ React88.createElement(Text2, { slot: "errorMessage", className: errorMessageStyle() }, errorMessage))));
14989
15036
  };
14990
15037
  DateRangePickerCalendar.displayName = "DateRangePicker.Calendar";
14991
15038
  var DateRangePickerField = ({ clearSelectionEnabled = true, disabled = false }) => {
@@ -14999,11 +15046,18 @@ var createDateRangePickerBase = (variant) => {
14999
15046
  shouldCloseOnSelect,
15000
15047
  errorMessage,
15001
15048
  clearSelectionEnabled = true,
15049
+ presets,
15002
15050
  children,
15003
15051
  ...props
15004
15052
  }) => {
15005
15053
  const content = children ?? /* @__PURE__ */ React88.createElement(React88.Fragment, null, /* @__PURE__ */ React88.createElement(DateRangePickerField, { clearSelectionEnabled, disabled }), /* @__PURE__ */ React88.createElement(DateRangePickerCalendar, { variant, granularity: props.granularity, errorMessage }));
15006
- return /* @__PURE__ */ React88.createElement(DateRangePickerCalendarPropsContext.Provider, { value: { variant, granularity: props.granularity, errorMessage } }, /* @__PURE__ */ React88.createElement(DateRangePicker, { ...props, variant, isDisabled: disabled, isInvalid: valid === false }, content));
15054
+ return /* @__PURE__ */ React88.createElement(
15055
+ DateRangePickerCalendarPropsContext.Provider,
15056
+ {
15057
+ value: { variant, granularity: props.granularity, errorMessage, presets }
15058
+ },
15059
+ /* @__PURE__ */ React88.createElement(DateRangePicker, { ...props, variant, isDisabled: disabled, isInvalid: valid === false }, content)
15060
+ );
15007
15061
  };
15008
15062
  dateRangePicker.Calendar = DateRangePickerCalendar;
15009
15063
  dateRangePicker.Field = DateRangePickerField;
@@ -15074,7 +15128,8 @@ var modalStyles = tv13({
15074
15128
  screen: {
15075
15129
  overlay: "py-0",
15076
15130
  dialog: "w-dvw h-dvh mx-0 rounded-none",
15077
- header: "border-b-1 border-muted mb-6"
15131
+ header: "border-b-1 border-muted",
15132
+ body: "pt-6"
15078
15133
  }
15079
15134
  },
15080
15135
  noFooter: {
@@ -15177,8 +15232,8 @@ Modal.TitleContainer = ({ children, className, ...rest }) => {
15177
15232
  const { titleContainer } = modalStyles();
15178
15233
  return /* @__PURE__ */ React89.createElement("div", { ...rest, className: titleContainer({ className }) }, children);
15179
15234
  };
15180
- Modal.Body = ({ children, className, noFooter = false, maxHeight, style, ...rest }) => {
15181
- const { body } = modalStyles();
15235
+ Modal.Body = ({ children, className, noFooter = false, maxHeight, style, size, ...rest }) => {
15236
+ const { body } = modalStyles({ size });
15182
15237
  return /* @__PURE__ */ React89.createElement("div", { ...rest, className: body({ noFooter, className }), style: { maxHeight, ...style } }, children);
15183
15238
  };
15184
15239
  Modal.Footer = ({ children, className, ...rest }) => {
@@ -15800,9 +15855,9 @@ var EmptyState = ({
15800
15855
  // src/atoms/Filter/Filter.tsx
15801
15856
  import React97 from "react";
15802
15857
  import {
15803
- Button as AriaButton3,
15804
- DatePickerStateContext as AriaDatePickerStateContext,
15805
- DateRangePickerStateContext as AriaDateRangePickerStateContext,
15858
+ Button as AriaButton4,
15859
+ DatePickerStateContext as AriaDatePickerStateContext2,
15860
+ DateRangePickerStateContext as AriaDateRangePickerStateContext2,
15806
15861
  Group as AriaGroup
15807
15862
  } from "react-aria-components";
15808
15863
  import { tv as tv14 } from "tailwind-variants";
@@ -15835,12 +15890,12 @@ var FilterTrigger = ({
15835
15890
  onClear,
15836
15891
  onClick,
15837
15892
  value,
15838
- // children,
15839
15893
  error: error2 = false,
15894
+ clearSelectionEnabled = true,
15840
15895
  ...props
15841
15896
  }) => {
15842
- const ariaDatePickerState = React97.useContext(AriaDatePickerStateContext);
15843
- const ariaDateRangePickerState = React97.useContext(AriaDateRangePickerStateContext);
15897
+ const ariaDatePickerState = React97.useContext(AriaDatePickerStateContext2);
15898
+ const ariaDateRangePickerState = React97.useContext(AriaDateRangePickerStateContext2);
15844
15899
  const isUsedInsideDatePicker = !!ariaDatePickerState?.value;
15845
15900
  const isUsedInsideDateRangePicker = !!ariaDateRangePickerState?.value.start && !!ariaDateRangePickerState.value.end;
15846
15901
  const onClearDatePickerRelated = () => {
@@ -15851,7 +15906,7 @@ var FilterTrigger = ({
15851
15906
  }
15852
15907
  };
15853
15908
  const hasValue = !!value || isUsedInsideDatePicker || isUsedInsideDateRangePicker;
15854
- const showClearButton = !!onClear && !!value || isUsedInsideDatePicker || isUsedInsideDateRangePicker;
15909
+ const showClearButton = clearSelectionEnabled && (!!onClear && !!value || isUsedInsideDatePicker || isUsedInsideDateRangePicker);
15855
15910
  return /* @__PURE__ */ React97.createElement(
15856
15911
  AriaGroup,
15857
15912
  {
@@ -15860,7 +15915,7 @@ var FilterTrigger = ({
15860
15915
  className: (renderProps) => filterWrapper({ ...renderProps, hasValue: hasValue || !!badge })
15861
15916
  },
15862
15917
  /* @__PURE__ */ React97.createElement(React97.Fragment, null, /* @__PURE__ */ React97.createElement(
15863
- AriaButton3,
15918
+ AriaButton4,
15864
15919
  {
15865
15920
  onPress: () => {
15866
15921
  onClick && onClick();
@@ -15874,7 +15929,11 @@ var FilterTrigger = ({
15874
15929
  /* @__PURE__ */ React97.createElement("div", { className: tw("flex items-center gap-3 divide-x divide-grey-20") }, /* @__PURE__ */ React97.createElement("div", { className: tw("flex items-center gap-3") }, /* @__PURE__ */ React97.createElement("div", { className: tw("flex items-center gap-2") }, /* @__PURE__ */ React97.createElement(InlineIcon, { icon }), /* @__PURE__ */ React97.createElement(Typography2.Small, null, labelText)), badge && /* @__PURE__ */ React97.createElement(Typography2, { color: "primary-active", className: tw("flex items-center") }, /* @__PURE__ */ React97.createElement(Badge, { dense: true, value: badge }))), hasValue && /* @__PURE__ */ React97.createElement("div", { className: "pl-3" }, /* @__PURE__ */ React97.createElement(
15875
15930
  Typography2.Small,
15876
15931
  {
15877
- className: tw("truncate max-w-[233px]"),
15932
+ className: tw("truncate", {
15933
+ "max-w-[320px]": isUsedInsideDateRangePicker,
15934
+ "max-w-[233px]": !isUsedInsideDateRangePicker
15935
+ // Set to 233px to keep the total width of the filter pill within approximately 360px.
15936
+ }),
15878
15937
  color: error2 ? "danger-intense" : "primary-active"
15879
15938
  },
15880
15939
  value,
@@ -15999,7 +16058,7 @@ var ListItem = ({ name, icon, active = false }) => {
15999
16058
  // src/molecules/Modal/Modal.tsx
16000
16059
  import React101 from "react";
16001
16060
  import { Dialog as AriaDialog3, Modal as AriaModal2, ModalOverlay as AriaModalOverlay2 } from "react-aria-components";
16002
- import { castArray as castArray4, omit as omit12 } from "lodash-es";
16061
+ import { castArray as castArray4, isEmpty as isEmpty2, omit as omit12 } from "lodash-es";
16003
16062
  var import_cross8 = __toESM(require_cross());
16004
16063
  var Modal2 = ({
16005
16064
  open,
@@ -16018,6 +16077,7 @@ var Modal2 = ({
16018
16077
  }
16019
16078
  const styles = modalStyles({ kind: "dialog", size });
16020
16079
  const hasTabs = isComponentType(children, ModalTabs);
16080
+ const hasActions = secondaryActions && !isEmpty2(secondaryActions) || primaryAction;
16021
16081
  return /* @__PURE__ */ React101.createElement(
16022
16082
  AriaModalOverlay2,
16023
16083
  {
@@ -16036,7 +16096,7 @@ var Modal2 = ({
16036
16096
  className: tw({ "pb-3": isComponentType(children, ModalTabs) })
16037
16097
  },
16038
16098
  /* @__PURE__ */ React101.createElement(Modal.TitleContainer, null, /* @__PURE__ */ React101.createElement(ModalTitle, { kind: "dialog" }, title), subtitle && /* @__PURE__ */ React101.createElement(Modal.Subtitle, null, subtitle))
16039
- ), hasTabs ? React101.cloneElement(children, { className: tw("[&>div:first-child]:px-5 grow") }) : /* @__PURE__ */ React101.createElement(Modal.Body, { tabIndex: 0, noFooter: !(secondaryActions ?? primaryAction) }, children), (secondaryActions ?? primaryAction) && /* @__PURE__ */ React101.createElement(Modal.Footer, null, /* @__PURE__ */ React101.createElement(Modal.Actions, null, secondaryActions && castArray4(secondaryActions).filter(Boolean).map(({ text, ...action }) => /* @__PURE__ */ React101.createElement(Button2.Secondary, { key: text, ...action }, text)), primaryAction && /* @__PURE__ */ React101.createElement(Button2.Primary, { key: primaryAction.text, ...omit12(primaryAction, "text") }, primaryAction.text))))))
16099
+ ), hasTabs ? React101.cloneElement(children, { className: tw("[&>div:first-child]:px-5 grow") }) : /* @__PURE__ */ React101.createElement(Modal.Body, { tabIndex: 0, noFooter: !hasActions, size }, children), hasActions && /* @__PURE__ */ React101.createElement(Modal.Footer, null, /* @__PURE__ */ React101.createElement(Modal.Actions, null, secondaryActions && castArray4(secondaryActions).filter(Boolean).map(({ text, ...action }) => /* @__PURE__ */ React101.createElement(Button2.Secondary, { key: text, ...action }, text)), primaryAction && /* @__PURE__ */ React101.createElement(Button2.Primary, { key: primaryAction.text, ...omit12(primaryAction, "text") }, primaryAction.text))))))
16040
16100
  );
16041
16101
  };
16042
16102
  var ModalTabs = createTabsComponent(