@layerfi/components 0.1.134-alpha → 0.1.134

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.
@@ -283,7 +283,7 @@ var getIntlLocale = (locale) => {
283
283
  };
284
284
  var package_default = {
285
285
  name: "@layerfi/components",
286
- version: "0.1.134-alpha",
286
+ version: "0.1.134",
287
287
  description: "Layer React Components",
288
288
  main: "dist/cjs/index.cjs",
289
289
  module: "dist/esm/index.mjs",
@@ -24127,7 +24127,7 @@ var CategorizationRulesHeader = ({ onGoBack }) => {
24127
24127
  })]
24128
24128
  });
24129
24129
  };
24130
- var resolveVariant$1 = ({ width }) => width < BREAKPOINTS.TABLET ? "Mobile" : "Desktop";
24130
+ var resolveVariant$2 = ({ width }) => width < BREAKPOINTS.TABLET ? "Mobile" : "Desktop";
24131
24131
  var ResponsiveCategorizationRulesView = () => {
24132
24132
  var _ref;
24133
24133
  const { t } = (0, react_i18next.useTranslation)();
@@ -24238,7 +24238,7 @@ var ResponsiveCategorizationRulesView = () => {
24238
24238
  ]);
24239
24239
  const selectedRuleCounterpartyLabel = (_ref = selectedRule && getCategorizationRuleCounterpartyLabel(selectedRule)) !== null && _ref !== void 0 ? _ref : t("bankTransactions:label.selected_counterparty", "this counterparty");
24240
24240
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponsiveComponent, {
24241
- resolveVariant: resolveVariant$1,
24241
+ resolveVariant: resolveVariant$2,
24242
24242
  slots: {
24243
24243
  Desktop: DesktopView,
24244
24244
  Mobile: MobileView
@@ -33415,10 +33415,11 @@ var Expand = (_ref) => {
33415
33415
  };
33416
33416
  //#endregion
33417
33417
  //#region src/components/ExpandableDataTable/ExpandableDataTableToggleButton.tsx
33418
- var ExpandableDataTableToggleButton = () => {
33418
+ var ExpandableDataTableToggleButton = ({ iconOnly }) => {
33419
33419
  const { t } = (0, react_i18next.useTranslation)();
33420
33420
  const { expanded, setExpanded } = (0, react.useContext)(ExpandableDataTableContext);
33421
33421
  const { isDesktop } = useSizeClass();
33422
+ const resolvedIconOnly = iconOnly !== null && iconOnly !== void 0 ? iconOnly : !isDesktop;
33422
33423
  const shouldCollapse = expanded === true;
33423
33424
  const onClickExpandOrCollapse = (0, react.useCallback)(() => {
33424
33425
  if (shouldCollapse) setExpanded({});
@@ -33426,11 +33427,11 @@ var ExpandableDataTableToggleButton = () => {
33426
33427
  }, [setExpanded, shouldCollapse]);
33427
33428
  const buttonText = shouldCollapse ? t("common:action.collapse_all", "Collapse All") : t("common:action.expand_all", "Expand All");
33428
33429
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button$1, {
33429
- icon: !isDesktop,
33430
+ icon: resolvedIconOnly,
33430
33431
  variant: "outlined",
33431
33432
  onClick: onClickExpandOrCollapse,
33432
- "aria-label": !isDesktop ? buttonText : void 0,
33433
- children: !isDesktop ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(shouldCollapse ? Collapse : Expand, {}) : buttonText
33433
+ "aria-label": resolvedIconOnly ? buttonText : void 0,
33434
+ children: resolvedIconOnly ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(shouldCollapse ? Collapse : Expand, {}) : buttonText
33434
33435
  });
33435
33436
  };
33436
33437
  //#endregion
@@ -43670,9 +43671,10 @@ function useUnifiedReportExcel({ onSuccess } = {}) {
43670
43671
  }
43671
43672
  //#endregion
43672
43673
  //#region src/components/UnifiedReports/UnifiedReportDownloadButton.tsx
43673
- function UnifiedReportDownloadButton() {
43674
+ function UnifiedReportDownloadButton({ iconOnly }) {
43674
43675
  const { t } = (0, react_i18next.useTranslation)();
43675
43676
  const { isDesktop } = useSizeClass();
43677
+ const resolvedIconOnly = iconOnly !== null && iconOnly !== void 0 ? iconOnly : !isDesktop;
43676
43678
  const { invisibleDownloadRef, triggerInvisibleDownload } = useInvisibleDownload();
43677
43679
  const { trigger, isMutating, isError } = useUnifiedReportExcel({ onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl }) });
43678
43680
  const buttonText = isError ? t("common:action.retry_label", "Retry") : t("common:action.download_label", "Download");
@@ -43683,22 +43685,23 @@ function UnifiedReportDownloadButton() {
43683
43685
  },
43684
43686
  isPending: isMutating,
43685
43687
  isDisabled: isMutating,
43686
- icon: !isDesktop,
43687
- "aria-label": !isDesktop ? buttonText : void 0,
43688
- children: [isDesktop && buttonText, isError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RefreshCcw$1, { size: 12 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DownloadCloud, { size: 16 })]
43688
+ icon: resolvedIconOnly,
43689
+ "aria-label": resolvedIconOnly ? buttonText : void 0,
43690
+ children: [!resolvedIconOnly && buttonText, isError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RefreshCcw$1, { size: 12 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DownloadCloud, { size: 16 })]
43689
43691
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InvisibleDownload, { ref: invisibleDownloadRef })] });
43690
43692
  }
43691
43693
  //#endregion
43692
43694
  //#region src/components/UnifiedReports/UnifiedReportHeaderButtons.tsx
43693
- var UnifiedReportHeaderButtons = () => {
43695
+ var UnifiedReportHeaderButtons = ({ variant }) => {
43694
43696
  const { isDesktop } = useSizeClass();
43697
+ const isMobile = (variant !== null && variant !== void 0 ? variant : isDesktop ? "Desktop" : "Mobile") === "Mobile";
43695
43698
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HStack, {
43696
43699
  gap: "xs",
43697
- className: "Layer__UnifiedReports__HeaderButtons",
43700
+ className: (0, classnames.default)("Layer__UnifiedReports__HeaderButtons", { "Layer__UnifiedReports__HeaderButtons--mobile": isMobile }),
43698
43701
  children: [
43699
- !isDesktop && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReportsMobileSelectionDrawer, {}),
43700
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExpandableDataTableToggleButton, {}),
43701
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportDownloadButton, {})
43702
+ isMobile && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReportsMobileSelectionDrawer, {}),
43703
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExpandableDataTableToggleButton, { iconOnly: isMobile }),
43704
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportDownloadButton, { iconOnly: isMobile })
43702
43705
  ]
43703
43706
  });
43704
43707
  };
@@ -44126,8 +44129,14 @@ function UnifiedReportTagControl({ tagControl }) {
44126
44129
  const { t } = (0, react_i18next.useTranslation)();
44127
44130
  const { selectedTagValues, setSelectedTagValues } = useUnifiedReportTagSelection();
44128
44131
  const dimensionName = (_tagControl$tagDimens = tagControl.tagDimension.displayName) !== null && _tagControl$tagDimens !== void 0 ? _tagControl$tagDimens : capitalizeFirstLetter(tagControl.tagDimension.key);
44129
- const options = tagControl.tagDimension.definedValues.filter(isActiveTagValueDefinition).map(toOption);
44130
- const selectedValues = selectedTagValues.filter(isActiveTagValueDefinition).map(toOption);
44132
+ const options = (0, react.useMemo)(() => tagControl.tagDimension.definedValues.filter(isActiveTagValueDefinition).map(toOption), [tagControl.tagDimension.definedValues]);
44133
+ const selectedValues = (0, react.useMemo)(() => {
44134
+ const optionsByTagValueId = new Map(options.map((option) => [option.tagValueDefinition.id, option]));
44135
+ return selectedTagValues.flatMap((tagValue) => {
44136
+ const option = optionsByTagValueId.get(tagValue.id);
44137
+ return option ? [option] : [];
44138
+ });
44139
+ }, [options, selectedTagValues]);
44131
44140
  const handleSelectedValuesChange = (values) => {
44132
44141
  setSelectedTagValues(values.map(({ tagValueDefinition }) => tagValueDefinition));
44133
44142
  };
@@ -44150,13 +44159,7 @@ function UnifiedReportTagControl({ tagControl }) {
44150
44159
  }
44151
44160
  //#endregion
44152
44161
  //#region src/components/UnifiedReports/UnifiedReportControls.tsx
44153
- var SMALL_BREAKPOINT$1 = 560;
44154
- var MEDIUM_BREAKPOINT$1 = 760;
44155
- var getVariantForWidth = (width) => {
44156
- if (width >= MEDIUM_BREAKPOINT$1) return "large";
44157
- if (width >= SMALL_BREAKPOINT$1) return "medium";
44158
- return "small";
44159
- };
44162
+ var COMPACT_DATE_SELECTION_BREAKPOINT = 560;
44160
44163
  var UnifiedReportDateSelection = ({ isCompact }) => {
44161
44164
  const { baseReport } = useBaseUnifiedReport();
44162
44165
  const dateSelectionMode = useUnifiedReportDateSelectionMode();
@@ -44180,55 +44183,69 @@ var UnifiedReportControls = () => {
44180
44183
  const containerRef = useElementSize((size) => {
44181
44184
  setSize(size.width);
44182
44185
  });
44183
- const variant = getVariantForWidth(size);
44186
+ const isCompact = size < COMPACT_DATE_SELECTION_BREAKPOINT;
44184
44187
  const hasGroupBy = dateSelectionMode === "full" && hasControl(baseReport, ReportControl.GroupBy);
44185
44188
  const hasYear = hasControl(baseReport, ReportControl.Year);
44186
44189
  const hasReportingBasis = hasControl(baseReport, ReportControl.ReportingBasis) && reportingBasis != null;
44187
44190
  const tagControl = baseReport === null || baseReport === void 0 ? void 0 : baseReport.tagControl;
44188
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Stack, {
44191
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VStack, {
44189
44192
  ref: containerRef,
44190
- direction: variant === "large" ? "row" : "column",
44191
- pb: "md",
44192
- pi: "lg",
44193
- gap: "xs",
44194
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportDateSelection, { isCompact: variant === "small" }), (hasYear || hasGroupBy || hasReportingBasis || tagControl) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
44195
- className: "Layer__UnifiedReports__AdditionalControls",
44196
- "data-variant": variant,
44197
- children: [
44198
- hasYear && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalYearPicker, {}),
44199
- hasGroupBy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DateGroupByComboBox, {
44200
- value: groupBy,
44201
- onValueChange: setGroupBy
44202
- }),
44203
- tagControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportTagControl, { tagControl }),
44204
- hasReportingBasis && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportReportingBasisControl, {
44205
- value: reportingBasis,
44206
- onValueChange: setReportingBasis
44207
- })
44208
- ]
44209
- })]
44193
+ className: "Layer__UnifiedReports__ControlsContainer",
44194
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Stack, {
44195
+ direction: "row",
44196
+ pb: "md",
44197
+ pi: "lg",
44198
+ gap: "xs",
44199
+ className: "Layer__UnifiedReports__Controls",
44200
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportDateSelection, { isCompact }), (hasYear || hasGroupBy || hasReportingBasis || tagControl) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
44201
+ className: "Layer__UnifiedReports__AdditionalControls",
44202
+ children: [
44203
+ hasYear && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalYearPicker, {}),
44204
+ hasGroupBy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DateGroupByComboBox, {
44205
+ value: groupBy,
44206
+ onValueChange: setGroupBy
44207
+ }),
44208
+ tagControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportTagControl, { tagControl }),
44209
+ hasReportingBasis && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportReportingBasisControl, {
44210
+ value: reportingBasis,
44211
+ onValueChange: setReportingBasis
44212
+ })
44213
+ ]
44214
+ })]
44215
+ })
44210
44216
  });
44211
44217
  };
44212
44218
  //#endregion
44213
44219
  //#region src/components/UnifiedReports/UnifiedReportBaseHeader.tsx
44214
- var UnifiedReportBaseHeader = () => {
44220
+ var resolveVariant$1 = ({ width }) => width <= BREAKPOINTS.MOBILE ? "Mobile" : "Desktop";
44221
+ var UnifiedReportBaseHeaderRow = ({ variant }) => {
44215
44222
  const { baseReport } = useBaseUnifiedReport();
44223
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HStack, {
44224
+ pi: "lg",
44225
+ pbs: "lg",
44226
+ align: "center",
44227
+ justify: "space-between",
44228
+ className: "Layer__UnifiedReports__BaseHeaderRow",
44229
+ children: [!(variant === "Mobile") && (baseReport ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Span, {
44230
+ size: "lg",
44231
+ weight: "bold",
44232
+ children: baseReport.displayName
44233
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SkeletonLoader, {
44234
+ width: "192px",
44235
+ height: "24px"
44236
+ })), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportHeaderButtons, { variant })]
44237
+ });
44238
+ };
44239
+ var UnifiedReportBaseHeader = () => {
44216
44240
  const { isDesktop } = useSizeClass();
44217
44241
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(VStack, {
44218
44242
  className: "Layer__UnifiedReports__BaseHeader",
44219
- children: [isDesktop && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HStack, {
44220
- pi: "lg",
44221
- pbs: "lg",
44222
- align: "center",
44223
- justify: "space-between",
44224
- children: [baseReport ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Span, {
44225
- size: "lg",
44226
- weight: "bold",
44227
- children: baseReport.displayName
44228
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SkeletonLoader, {
44229
- width: "192px",
44230
- height: "24px"
44231
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportHeaderButtons, {})]
44243
+ children: [isDesktop && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponsiveComponent, {
44244
+ resolveVariant: resolveVariant$1,
44245
+ slots: {
44246
+ Desktop: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportBaseHeaderRow, { variant: "Desktop" }),
44247
+ Mobile: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportBaseHeaderRow, { variant: "Mobile" })
44248
+ }
44232
44249
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnifiedReportControls, {})]
44233
44250
  });
44234
44251
  };
@@ -255,7 +255,7 @@ var getIntlLocale = (locale) => {
255
255
  };
256
256
  var package_default = {
257
257
  name: "@layerfi/components",
258
- version: "0.1.134-alpha",
258
+ version: "0.1.134",
259
259
  description: "Layer React Components",
260
260
  main: "dist/cjs/index.cjs",
261
261
  module: "dist/esm/index.mjs",
@@ -20768,7 +20768,7 @@ var CategorizationRulesHeader = ({ onGoBack }) => {
20768
20768
  })]
20769
20769
  });
20770
20770
  };
20771
- var resolveVariant$1 = ({ width }) => width < BREAKPOINTS.TABLET ? "Mobile" : "Desktop";
20771
+ var resolveVariant$2 = ({ width }) => width < BREAKPOINTS.TABLET ? "Mobile" : "Desktop";
20772
20772
  var ResponsiveCategorizationRulesView = () => {
20773
20773
  var _ref;
20774
20774
  const { t } = useTranslation();
@@ -20879,7 +20879,7 @@ var ResponsiveCategorizationRulesView = () => {
20879
20879
  ]);
20880
20880
  const selectedRuleCounterpartyLabel = (_ref = selectedRule && getCategorizationRuleCounterpartyLabel(selectedRule)) !== null && _ref !== void 0 ? _ref : t("bankTransactions:label.selected_counterparty", "this counterparty");
20881
20881
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ResponsiveComponent, {
20882
- resolveVariant: resolveVariant$1,
20882
+ resolveVariant: resolveVariant$2,
20883
20883
  slots: {
20884
20884
  Desktop: DesktopView,
20885
20885
  Mobile: MobileView
@@ -30056,10 +30056,11 @@ var Expand = (_ref) => {
30056
30056
  };
30057
30057
  //#endregion
30058
30058
  //#region src/components/ExpandableDataTable/ExpandableDataTableToggleButton.tsx
30059
- var ExpandableDataTableToggleButton = () => {
30059
+ var ExpandableDataTableToggleButton = ({ iconOnly }) => {
30060
30060
  const { t } = useTranslation();
30061
30061
  const { expanded, setExpanded } = useContext(ExpandableDataTableContext);
30062
30062
  const { isDesktop } = useSizeClass();
30063
+ const resolvedIconOnly = iconOnly !== null && iconOnly !== void 0 ? iconOnly : !isDesktop;
30063
30064
  const shouldCollapse = expanded === true;
30064
30065
  const onClickExpandOrCollapse = useCallback(() => {
30065
30066
  if (shouldCollapse) setExpanded({});
@@ -30067,11 +30068,11 @@ var ExpandableDataTableToggleButton = () => {
30067
30068
  }, [setExpanded, shouldCollapse]);
30068
30069
  const buttonText = shouldCollapse ? t("common:action.collapse_all", "Collapse All") : t("common:action.expand_all", "Expand All");
30069
30070
  return /* @__PURE__ */ jsx(Button$1, {
30070
- icon: !isDesktop,
30071
+ icon: resolvedIconOnly,
30071
30072
  variant: "outlined",
30072
30073
  onClick: onClickExpandOrCollapse,
30073
- "aria-label": !isDesktop ? buttonText : void 0,
30074
- children: !isDesktop ? /* @__PURE__ */ jsx(shouldCollapse ? Collapse : Expand, {}) : buttonText
30074
+ "aria-label": resolvedIconOnly ? buttonText : void 0,
30075
+ children: resolvedIconOnly ? /* @__PURE__ */ jsx(shouldCollapse ? Collapse : Expand, {}) : buttonText
30075
30076
  });
30076
30077
  };
30077
30078
  //#endregion
@@ -40311,9 +40312,10 @@ function useUnifiedReportExcel({ onSuccess } = {}) {
40311
40312
  }
40312
40313
  //#endregion
40313
40314
  //#region src/components/UnifiedReports/UnifiedReportDownloadButton.tsx
40314
- function UnifiedReportDownloadButton() {
40315
+ function UnifiedReportDownloadButton({ iconOnly }) {
40315
40316
  const { t } = useTranslation();
40316
40317
  const { isDesktop } = useSizeClass();
40318
+ const resolvedIconOnly = iconOnly !== null && iconOnly !== void 0 ? iconOnly : !isDesktop;
40317
40319
  const { invisibleDownloadRef, triggerInvisibleDownload } = useInvisibleDownload();
40318
40320
  const { trigger, isMutating, isError } = useUnifiedReportExcel({ onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl }) });
40319
40321
  const buttonText = isError ? t("common:action.retry_label", "Retry") : t("common:action.download_label", "Download");
@@ -40324,22 +40326,23 @@ function UnifiedReportDownloadButton() {
40324
40326
  },
40325
40327
  isPending: isMutating,
40326
40328
  isDisabled: isMutating,
40327
- icon: !isDesktop,
40328
- "aria-label": !isDesktop ? buttonText : void 0,
40329
- children: [isDesktop && buttonText, isError ? /* @__PURE__ */ jsx(RefreshCcw$1, { size: 12 }) : /* @__PURE__ */ jsx(DownloadCloud, { size: 16 })]
40329
+ icon: resolvedIconOnly,
40330
+ "aria-label": resolvedIconOnly ? buttonText : void 0,
40331
+ children: [!resolvedIconOnly && buttonText, isError ? /* @__PURE__ */ jsx(RefreshCcw$1, { size: 12 }) : /* @__PURE__ */ jsx(DownloadCloud, { size: 16 })]
40330
40332
  }), /* @__PURE__ */ jsx(InvisibleDownload, { ref: invisibleDownloadRef })] });
40331
40333
  }
40332
40334
  //#endregion
40333
40335
  //#region src/components/UnifiedReports/UnifiedReportHeaderButtons.tsx
40334
- var UnifiedReportHeaderButtons = () => {
40336
+ var UnifiedReportHeaderButtons = ({ variant }) => {
40335
40337
  const { isDesktop } = useSizeClass();
40338
+ const isMobile = (variant !== null && variant !== void 0 ? variant : isDesktop ? "Desktop" : "Mobile") === "Mobile";
40336
40339
  return /* @__PURE__ */ jsxs(HStack, {
40337
40340
  gap: "xs",
40338
- className: "Layer__UnifiedReports__HeaderButtons",
40341
+ className: classNames("Layer__UnifiedReports__HeaderButtons", { "Layer__UnifiedReports__HeaderButtons--mobile": isMobile }),
40339
40342
  children: [
40340
- !isDesktop && /* @__PURE__ */ jsx(ReportsMobileSelectionDrawer, {}),
40341
- /* @__PURE__ */ jsx(ExpandableDataTableToggleButton, {}),
40342
- /* @__PURE__ */ jsx(UnifiedReportDownloadButton, {})
40343
+ isMobile && /* @__PURE__ */ jsx(ReportsMobileSelectionDrawer, {}),
40344
+ /* @__PURE__ */ jsx(ExpandableDataTableToggleButton, { iconOnly: isMobile }),
40345
+ /* @__PURE__ */ jsx(UnifiedReportDownloadButton, { iconOnly: isMobile })
40343
40346
  ]
40344
40347
  });
40345
40348
  };
@@ -40767,8 +40770,14 @@ function UnifiedReportTagControl({ tagControl }) {
40767
40770
  const { t } = useTranslation();
40768
40771
  const { selectedTagValues, setSelectedTagValues } = useUnifiedReportTagSelection();
40769
40772
  const dimensionName = (_tagControl$tagDimens = tagControl.tagDimension.displayName) !== null && _tagControl$tagDimens !== void 0 ? _tagControl$tagDimens : capitalizeFirstLetter(tagControl.tagDimension.key);
40770
- const options = tagControl.tagDimension.definedValues.filter(isActiveTagValueDefinition).map(toOption);
40771
- const selectedValues = selectedTagValues.filter(isActiveTagValueDefinition).map(toOption);
40773
+ const options = useMemo(() => tagControl.tagDimension.definedValues.filter(isActiveTagValueDefinition).map(toOption), [tagControl.tagDimension.definedValues]);
40774
+ const selectedValues = useMemo(() => {
40775
+ const optionsByTagValueId = new Map(options.map((option) => [option.tagValueDefinition.id, option]));
40776
+ return selectedTagValues.flatMap((tagValue) => {
40777
+ const option = optionsByTagValueId.get(tagValue.id);
40778
+ return option ? [option] : [];
40779
+ });
40780
+ }, [options, selectedTagValues]);
40772
40781
  const handleSelectedValuesChange = (values) => {
40773
40782
  setSelectedTagValues(values.map(({ tagValueDefinition }) => tagValueDefinition));
40774
40783
  };
@@ -40791,13 +40800,7 @@ function UnifiedReportTagControl({ tagControl }) {
40791
40800
  }
40792
40801
  //#endregion
40793
40802
  //#region src/components/UnifiedReports/UnifiedReportControls.tsx
40794
- var SMALL_BREAKPOINT$1 = 560;
40795
- var MEDIUM_BREAKPOINT$1 = 760;
40796
- var getVariantForWidth = (width) => {
40797
- if (width >= MEDIUM_BREAKPOINT$1) return "large";
40798
- if (width >= SMALL_BREAKPOINT$1) return "medium";
40799
- return "small";
40800
- };
40803
+ var COMPACT_DATE_SELECTION_BREAKPOINT = 560;
40801
40804
  var UnifiedReportDateSelection = ({ isCompact }) => {
40802
40805
  const { baseReport } = useBaseUnifiedReport();
40803
40806
  const dateSelectionMode = useUnifiedReportDateSelectionMode();
@@ -40821,55 +40824,69 @@ var UnifiedReportControls = () => {
40821
40824
  const containerRef = useElementSize((size) => {
40822
40825
  setSize(size.width);
40823
40826
  });
40824
- const variant = getVariantForWidth(size);
40827
+ const isCompact = size < COMPACT_DATE_SELECTION_BREAKPOINT;
40825
40828
  const hasGroupBy = dateSelectionMode === "full" && hasControl(baseReport, ReportControl.GroupBy);
40826
40829
  const hasYear = hasControl(baseReport, ReportControl.Year);
40827
40830
  const hasReportingBasis = hasControl(baseReport, ReportControl.ReportingBasis) && reportingBasis != null;
40828
40831
  const tagControl = baseReport === null || baseReport === void 0 ? void 0 : baseReport.tagControl;
40829
- return /* @__PURE__ */ jsxs(Stack, {
40832
+ return /* @__PURE__ */ jsx(VStack, {
40830
40833
  ref: containerRef,
40831
- direction: variant === "large" ? "row" : "column",
40832
- pb: "md",
40833
- pi: "lg",
40834
- gap: "xs",
40835
- children: [/* @__PURE__ */ jsx(UnifiedReportDateSelection, { isCompact: variant === "small" }), (hasYear || hasGroupBy || hasReportingBasis || tagControl) && /* @__PURE__ */ jsxs("div", {
40836
- className: "Layer__UnifiedReports__AdditionalControls",
40837
- "data-variant": variant,
40838
- children: [
40839
- hasYear && /* @__PURE__ */ jsx(GlobalYearPicker, {}),
40840
- hasGroupBy && /* @__PURE__ */ jsx(DateGroupByComboBox, {
40841
- value: groupBy,
40842
- onValueChange: setGroupBy
40843
- }),
40844
- tagControl && /* @__PURE__ */ jsx(UnifiedReportTagControl, { tagControl }),
40845
- hasReportingBasis && /* @__PURE__ */ jsx(UnifiedReportReportingBasisControl, {
40846
- value: reportingBasis,
40847
- onValueChange: setReportingBasis
40848
- })
40849
- ]
40850
- })]
40834
+ className: "Layer__UnifiedReports__ControlsContainer",
40835
+ children: /* @__PURE__ */ jsxs(Stack, {
40836
+ direction: "row",
40837
+ pb: "md",
40838
+ pi: "lg",
40839
+ gap: "xs",
40840
+ className: "Layer__UnifiedReports__Controls",
40841
+ children: [/* @__PURE__ */ jsx(UnifiedReportDateSelection, { isCompact }), (hasYear || hasGroupBy || hasReportingBasis || tagControl) && /* @__PURE__ */ jsxs("div", {
40842
+ className: "Layer__UnifiedReports__AdditionalControls",
40843
+ children: [
40844
+ hasYear && /* @__PURE__ */ jsx(GlobalYearPicker, {}),
40845
+ hasGroupBy && /* @__PURE__ */ jsx(DateGroupByComboBox, {
40846
+ value: groupBy,
40847
+ onValueChange: setGroupBy
40848
+ }),
40849
+ tagControl && /* @__PURE__ */ jsx(UnifiedReportTagControl, { tagControl }),
40850
+ hasReportingBasis && /* @__PURE__ */ jsx(UnifiedReportReportingBasisControl, {
40851
+ value: reportingBasis,
40852
+ onValueChange: setReportingBasis
40853
+ })
40854
+ ]
40855
+ })]
40856
+ })
40851
40857
  });
40852
40858
  };
40853
40859
  //#endregion
40854
40860
  //#region src/components/UnifiedReports/UnifiedReportBaseHeader.tsx
40855
- var UnifiedReportBaseHeader = () => {
40861
+ var resolveVariant$1 = ({ width }) => width <= BREAKPOINTS.MOBILE ? "Mobile" : "Desktop";
40862
+ var UnifiedReportBaseHeaderRow = ({ variant }) => {
40856
40863
  const { baseReport } = useBaseUnifiedReport();
40864
+ return /* @__PURE__ */ jsxs(HStack, {
40865
+ pi: "lg",
40866
+ pbs: "lg",
40867
+ align: "center",
40868
+ justify: "space-between",
40869
+ className: "Layer__UnifiedReports__BaseHeaderRow",
40870
+ children: [!(variant === "Mobile") && (baseReport ? /* @__PURE__ */ jsx(Span, {
40871
+ size: "lg",
40872
+ weight: "bold",
40873
+ children: baseReport.displayName
40874
+ }) : /* @__PURE__ */ jsx(SkeletonLoader, {
40875
+ width: "192px",
40876
+ height: "24px"
40877
+ })), /* @__PURE__ */ jsx(UnifiedReportHeaderButtons, { variant })]
40878
+ });
40879
+ };
40880
+ var UnifiedReportBaseHeader = () => {
40857
40881
  const { isDesktop } = useSizeClass();
40858
40882
  return /* @__PURE__ */ jsxs(VStack, {
40859
40883
  className: "Layer__UnifiedReports__BaseHeader",
40860
- children: [isDesktop && /* @__PURE__ */ jsxs(HStack, {
40861
- pi: "lg",
40862
- pbs: "lg",
40863
- align: "center",
40864
- justify: "space-between",
40865
- children: [baseReport ? /* @__PURE__ */ jsx(Span, {
40866
- size: "lg",
40867
- weight: "bold",
40868
- children: baseReport.displayName
40869
- }) : /* @__PURE__ */ jsx(SkeletonLoader, {
40870
- width: "192px",
40871
- height: "24px"
40872
- }), /* @__PURE__ */ jsx(UnifiedReportHeaderButtons, {})]
40884
+ children: [isDesktop && /* @__PURE__ */ jsx(ResponsiveComponent, {
40885
+ resolveVariant: resolveVariant$1,
40886
+ slots: {
40887
+ Desktop: /* @__PURE__ */ jsx(UnifiedReportBaseHeaderRow, { variant: "Desktop" }),
40888
+ Mobile: /* @__PURE__ */ jsx(UnifiedReportBaseHeaderRow, { variant: "Mobile" })
40889
+ }
40873
40890
  }), /* @__PURE__ */ jsx(UnifiedReportControls, {})]
40874
40891
  });
40875
40892
  };
package/dist/index.css CHANGED
@@ -5650,7 +5650,7 @@ tbody .Layer__table__empty-row:first-child {
5650
5650
  visibility: hidden;
5651
5651
  }
5652
5652
  .Layer__ComboBoxOption--selected {
5653
- background-color: var(--color-base-100);
5653
+ background-color: var(--color-base-300);
5654
5654
  }
5655
5655
  .Layer__ComboBoxOption--selected .Layer__ComboBoxOptionCheckIcon {
5656
5656
  visibility: visible;
@@ -9362,6 +9362,19 @@ tbody .Layer__table__empty-row:first-child {
9362
9362
  justify-content: flex-end;
9363
9363
  min-width: 15rem;
9364
9364
  max-width: 24rem;
9365
+ }
9366
+ .Layer__UnifiedReports__HeaderButtons--mobile {
9367
+ width: 100%;
9368
+ min-width: 0;
9369
+ max-width: none;
9370
+ }
9371
+
9372
+ @container unified-reports (max-width: 500px) {
9373
+ .Layer__UnifiedReports__HeaderButtons {
9374
+ width: 100%;
9375
+ min-width: 0;
9376
+ max-width: none;
9377
+ }
9365
9378
  }.Layer__UI__Table__UnifiedReports {
9366
9379
  width: max-content;
9367
9380
  min-width: 100%;
@@ -9385,27 +9398,36 @@ tbody .Layer__table__empty-row:first-child {
9385
9398
  }
9386
9399
  .Layer__UnifiedReports__TagControl__Container .Layer__ComboBoxMultiValue {
9387
9400
  flex: 1 1 auto;
9388
- }.Layer__UnifiedReports__AdditionalControls {
9389
- display: grid;
9390
- gap: var(--spacing-xs);
9391
- }
9392
- .Layer__UnifiedReports__AdditionalControls[data-variant=small] {
9393
- grid-template-columns: 1fr;
9394
- }
9395
- .Layer__UnifiedReports__AdditionalControls[data-variant=medium] {
9396
- grid-template-columns: repeat(2, 1fr);
9401
+ }.Layer__UnifiedReports__ControlsContainer {
9402
+ container: unified-report-controls/inline-size;
9397
9403
  }
9398
- .Layer__UnifiedReports__AdditionalControls[data-variant=large] {
9404
+
9405
+ .Layer__UnifiedReports__AdditionalControls {
9406
+ display: grid;
9399
9407
  grid-auto-columns: max-content;
9400
9408
  grid-auto-flow: column;
9409
+ gap: var(--spacing-xs);
9401
9410
  }
9402
- .Layer__UnifiedReports__AdditionalControls[data-variant=small] > *,
9403
- .Layer__UnifiedReports__AdditionalControls[data-variant=small] .Layer__DateGroupByComboBox__Container,
9404
- .Layer__UnifiedReports__AdditionalControls[data-variant=small] .Layer__YearPicker, .Layer__UnifiedReports__AdditionalControls[data-variant=medium] > *,
9405
- .Layer__UnifiedReports__AdditionalControls[data-variant=medium] .Layer__DateGroupByComboBox__Container,
9406
- .Layer__UnifiedReports__AdditionalControls[data-variant=medium] .Layer__YearPicker {
9407
- inline-size: 100%;
9408
- max-inline-size: none;
9411
+
9412
+ @container unified-report-controls (max-width: 1200px) {
9413
+ .Layer__UnifiedReports__Controls.Layer__Stack[data-direction=row] {
9414
+ flex-direction: column;
9415
+ }
9416
+ .Layer__UnifiedReports__AdditionalControls {
9417
+ grid-template-columns: repeat(2, minmax(0, 1fr));
9418
+ grid-auto-flow: row;
9419
+ }
9420
+ .Layer__UnifiedReports__AdditionalControls > *,
9421
+ .Layer__UnifiedReports__AdditionalControls .Layer__DateGroupByComboBox__Container,
9422
+ .Layer__UnifiedReports__AdditionalControls .Layer__YearPicker {
9423
+ inline-size: 100%;
9424
+ max-inline-size: none;
9425
+ }
9426
+ }
9427
+ @container unified-report-controls (max-width: 560px) {
9428
+ .Layer__UnifiedReports__AdditionalControls {
9429
+ grid-template-columns: 1fr;
9430
+ }
9409
9431
  }.Layer__UnifiedReports__BaseHeader {
9410
9432
  border-bottom: 1px solid var(--border-color);
9411
9433
  }.Layer__UI__Link {
@@ -9467,6 +9489,7 @@ tbody .Layer__table__empty-row:first-child {
9467
9489
  }.Layer__UnifiedReports__DetailHeader {
9468
9490
  border-bottom: 1px solid var(--border-color);
9469
9491
  }.Layer__view.Layer__UnifiedReports {
9492
+ container: unified-reports/inline-size;
9470
9493
  overflow: hidden;
9471
9494
  max-height: 100vh;
9472
9495
  min-width: clamp(23rem, 100%, 1406px);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerfi/components",
3
- "version": "0.1.134-alpha",
3
+ "version": "0.1.134",
4
4
  "description": "Layer React Components",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",