remoraid 2.20.2 → 2.26.4

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.
@@ -5472,11 +5472,13 @@ __export(exports_core, {
5472
5472
  useHydrationStatus: () => useHydrationStatus,
5473
5473
  useHydratedMantineColorScheme: () => useHydratedMantineColorScheme,
5474
5474
  useFrameLayout: () => useFrameLayout,
5475
+ scrollToWidget: () => scrollToWidget,
5475
5476
  remoraidAppShellLayoutId: () => remoraidAppShellLayoutId,
5476
5477
  isValidElementOfType: () => isValidElementOfType,
5477
5478
  getElementTypeName: () => getElementTypeName,
5478
5479
  getDefaultWidgetContext: () => getDefaultWidgetContext,
5479
5480
  getDefaultButtonIconSize: () => getDefaultButtonIconSize,
5481
+ getCssVars: () => getCssVars,
5480
5482
  defaultUserExperienceCookieName: () => defaultUserExperienceCookieName,
5481
5483
  defaultUserExperience: () => defaultUserExperience,
5482
5484
  defaultSettingsWidgetOptions: () => defaultSettingsWidgetContext,
@@ -5534,7 +5536,10 @@ module.exports = __toCommonJS(exports_core);
5534
5536
  var import_lodash = __toESM(require_lodash());
5535
5537
  var import_react = __toESM(require("react"));
5536
5538
  var jsx_dev_runtime = require("react/jsx-dev-runtime");
5537
- var getDefaultWidgetContext = (configuration) => import_lodash.merge({ name: configuration.widgetId, selected: true }, configuration.initialValues);
5539
+ var getDefaultWidgetContext = (configuration) => {
5540
+ const mergedConfiguration = import_lodash.merge({ name: configuration.widgetId, selected: true }, configuration.initialValues);
5541
+ return { ...mergedConfiguration, hidden: !mergedConfiguration.selected };
5542
+ };
5538
5543
  var widgetsContext = import_react.default.createContext({
5539
5544
  widgets: {},
5540
5545
  activeWidget: null,
@@ -5545,7 +5550,8 @@ var widgetsContext = import_react.default.createContext({
5545
5550
  isPageRegistered: () => false,
5546
5551
  updateWidgetSelection: () => {},
5547
5552
  updateWidgetSelectionBulk: () => {},
5548
- isWidgetSelected: () => false
5553
+ isWidgetSelected: () => false,
5554
+ hideWidget: () => {}
5549
5555
  });
5550
5556
  var useWidgets = () => {
5551
5557
  return import_react.useContext(widgetsContext);
@@ -5563,38 +5569,57 @@ function WidgetsProvider({
5563
5569
  setActiveWidget(widgetId);
5564
5570
  };
5565
5571
  const updateWidgetSelection = (pageId, widgetId, value) => {
5566
- if (!widgets[pageId]) {
5572
+ const page = widgets[pageId];
5573
+ if (!page) {
5567
5574
  console.error(`Cannot change selection of widget in page ${pageId}. Because this page does exist.`);
5568
5575
  return;
5569
5576
  }
5570
- if (!widgets[pageId][widgetId]) {
5577
+ const widget = page[widgetId];
5578
+ if (!widget) {
5571
5579
  console.error(`Cannot change selection of widget ${widgetId}. Because this widget does not exist on page ${pageId}.`);
5572
5580
  return;
5573
5581
  }
5574
5582
  setWidgets((prev) => ({
5575
5583
  ...prev,
5576
5584
  [pageId]: {
5577
- ...widgets[pageId],
5578
- [widgetId]: { ...widgets[pageId][widgetId], selected: value }
5585
+ ...page,
5586
+ [widgetId]: {
5587
+ ...widget,
5588
+ selected: value,
5589
+ hidden: false
5590
+ }
5579
5591
  }
5580
5592
  }));
5581
5593
  };
5582
5594
  const updateWidgetSelectionBulk = (pageId, selectedWidgetIds) => {
5583
- if (!widgets[pageId]) {
5595
+ const page = widgets[pageId];
5596
+ if (!page) {
5584
5597
  console.error(`Cannot change selection of widget in page ${pageId}. Because this page does exist.`);
5585
5598
  return;
5586
5599
  }
5587
- const updatedPage = widgets[pageId];
5588
- for (let widgetId of Object.keys(updatedPage)) {
5589
- updatedPage[widgetId] = {
5590
- ...updatedPage[widgetId],
5591
- selected: selectedWidgetIds.includes(widgetId)
5600
+ setWidgets((prev) => {
5601
+ const updatedPage = {};
5602
+ for (const [widgetId, widget] of Object.entries(page)) {
5603
+ if (!widget) {
5604
+ continue;
5605
+ }
5606
+ const selected = selectedWidgetIds.includes(widgetId);
5607
+ const selectionChanged = widget.selected !== selected;
5608
+ if (!selectionChanged) {
5609
+ updatedPage[widgetId] = widget;
5610
+ continue;
5611
+ }
5612
+ updatedPage[widgetId] = {
5613
+ ...widget,
5614
+ selected,
5615
+ hidden: false
5616
+ };
5617
+ }
5618
+ return {
5619
+ ...prev,
5620
+ [pageId]: updatedPage
5592
5621
  };
5593
- }
5594
- setWidgets((prev) => ({
5595
- ...prev,
5596
- [pageId]: updatedPage
5597
- }));
5622
+ });
5598
5623
  };
5599
5624
  const registerPage = (pageId, initialWidgets) => {
5600
5625
  setWidgets((prev) => ({
@@ -5640,10 +5665,21 @@ function WidgetsProvider({
5640
5665
  return true;
5641
5666
  };
5642
5667
  const isWidgetSelected = (pageId, widgetId) => {
5643
- if (!isWidgetRegistered(pageId, widgetId)) {
5644
- return false;
5668
+ return Boolean(widgets[pageId]?.[widgetId]?.selected);
5669
+ };
5670
+ const hideWidget = (pageId, widgetId) => {
5671
+ const widget = widgets[pageId]?.[widgetId];
5672
+ if (!widget) {
5673
+ console.error(`Cannot call 'hideWidget' for widget ${widgetId}. Because this widget does not exist on page ${pageId}.`);
5674
+ return;
5645
5675
  }
5646
- return widgets[pageId][widgetId].selected;
5676
+ setWidgets((prev) => ({
5677
+ ...prev,
5678
+ [pageId]: {
5679
+ ...prev[pageId],
5680
+ [widgetId]: { ...widget, selected: false, hidden: true }
5681
+ }
5682
+ }));
5647
5683
  };
5648
5684
  return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(widgetsContext.Provider, {
5649
5685
  value: {
@@ -5656,7 +5692,8 @@ function WidgetsProvider({
5656
5692
  registerWidget,
5657
5693
  registerPage,
5658
5694
  isWidgetRegistered,
5659
- isPageRegistered
5695
+ isPageRegistered,
5696
+ hideWidget
5660
5697
  },
5661
5698
  children
5662
5699
  }, undefined, false, undefined, this);
@@ -5749,6 +5786,16 @@ var getDefaultButtonIconSize = (buttonSize) => {
5749
5786
  }
5750
5787
  return "medium" /* Medium */;
5751
5788
  };
5789
+ var scrollToWidget = (widgetId) => {
5790
+ const widgetElement = document.getElementById(widgetId);
5791
+ if (!widgetElement) {
5792
+ return;
5793
+ }
5794
+ widgetElement.scrollIntoView({
5795
+ behavior: "smooth",
5796
+ block: "start"
5797
+ });
5798
+ };
5752
5799
 
5753
5800
  // src/core/components/RemoraidProvider/ThemeProvider/index.tsx
5754
5801
  var import_core2 = require("@mantine/core");
@@ -5812,6 +5859,7 @@ var createRemoraidTheme = (customTheme, dependencies) => {
5812
5859
  };
5813
5860
  }
5814
5861
  const defaultTheme = {
5862
+ bodyColor: "light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-9))",
5815
5863
  containerSize: 1300,
5816
5864
  jsonStringifySpace: 2,
5817
5865
  transparentBackground,
@@ -5857,27 +5905,52 @@ var createRemoraidTheme = (customTheme, dependencies) => {
5857
5905
  ScrollArea: {
5858
5906
  scrollbarSize: 8,
5859
5907
  scrollHideDelay: 20,
5860
- type: "hover"
5908
+ type: "hover",
5909
+ styles: { thumb: { zIndex: 5 } }
5861
5910
  },
5862
5911
  HoverCard: {
5863
- shadow: "md",
5864
5912
  withArrow: true,
5865
5913
  transitionProps: {
5866
- transition: "pop",
5867
5914
  duration: transitionDurations.short
5868
- },
5869
- styles: {
5870
- dropdown: { border: "none", background: transparentBackground },
5871
- arrow: { border: "none" }
5872
5915
  }
5873
5916
  },
5874
5917
  Tooltip: {
5875
- withArrow: true
5918
+ withArrow: true,
5919
+ transitionProps: {
5920
+ duration: transitionDurations.short
5921
+ }
5922
+ },
5923
+ Menu: {
5924
+ withArrow: true,
5925
+ transitionProps: {
5926
+ duration: transitionDurations.short
5927
+ }
5876
5928
  }
5877
5929
  }
5878
5930
  };
5879
5931
  return import_lodash2.merge(defaultTheme, customTheme);
5880
5932
  };
5933
+ var getCssVars = (theme) => {
5934
+ const {
5935
+ bodyColor,
5936
+ transitionDurations,
5937
+ primaryGutter,
5938
+ containerSize,
5939
+ transparentBackground
5940
+ } = theme;
5941
+ return {
5942
+ "--mantine-color-body": bodyColor,
5943
+ "--remoraid-container-size": `${containerSize}px`,
5944
+ "--remoraid-primary-gutter": typeof primaryGutter === "string" ? `var(--mantine-spacing-${primaryGutter})` : `${primaryGutter}px`,
5945
+ ...transparentBackground && {
5946
+ "--remoraid-transparent-background": transparentBackground
5947
+ },
5948
+ ...Object.entries(transitionDurations).reduce((t, [key, value]) => ({
5949
+ ...t,
5950
+ [`--remoraid-transition-duration-${key}`]: `${value}ms`
5951
+ }), {})
5952
+ };
5953
+ };
5881
5954
  var themeContext = import_react4.default.createContext(createRemoraidTheme());
5882
5955
  var useRemoraidTheme = () => {
5883
5956
  return import_react4.useContext(themeContext);
@@ -5895,6 +5968,14 @@ function ThemeProvider({
5895
5968
  };
5896
5969
  return createRemoraidTheme(typeof theme === "function" ? theme(dependencies) : theme, dependencies);
5897
5970
  }, [colorScheme, theme]);
5971
+ import_react4.useLayoutEffect(() => {
5972
+ const root = document.documentElement;
5973
+ const entries = Object.entries(getCssVars(remoraidTheme));
5974
+ entries.forEach(([key, value]) => root.style.setProperty(key, value));
5975
+ return () => {
5976
+ entries.forEach(([key]) => root.style.removeProperty(key));
5977
+ };
5978
+ }, [remoraidTheme]);
5898
5979
  return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(themeContext.Provider, {
5899
5980
  value: remoraidTheme,
5900
5981
  children
@@ -6590,7 +6671,7 @@ var AppShell_default = Object.assign(AppShell, {
6590
6671
  FooterMinimal
6591
6672
  });
6592
6673
  // src/core/components/WidgetSelectionHeader/index.tsx
6593
- var import_core11 = require("@mantine/core");
6674
+ var import_core14 = require("@mantine/core");
6594
6675
 
6595
6676
  // src/core/components/Page/index.tsx
6596
6677
  var import_core9 = require("@mantine/core");
@@ -6634,7 +6715,8 @@ function Page({
6634
6715
  }
6635
6716
 
6636
6717
  // src/core/components/WidgetSelectionHeader/index.tsx
6637
- var import_icons_react4 = require("@tabler/icons-react");
6718
+ var import_icons_react7 = require("@tabler/icons-react");
6719
+ var import_react14 = require("react");
6638
6720
 
6639
6721
  // src/core/components/ScrollableChipGroup/index.tsx
6640
6722
  var import_core10 = require("@mantine/core");
@@ -6642,15 +6724,16 @@ var import_lodash7 = __toESM(require_lodash());
6642
6724
  var jsx_dev_runtime16 = require("react/jsx-dev-runtime");
6643
6725
  function ScrollableChipGroup({
6644
6726
  value,
6727
+ ref,
6645
6728
  onChange,
6646
- gap,
6729
+ gap = "xs",
6647
6730
  componentsProps,
6648
- children: childrenProp
6731
+ children
6649
6732
  }) {
6650
- const children = asChildrenOfType(import_core10.Chip, childrenProp, "Check children passed to 'ScrollableChipGroup' component.");
6651
6733
  const theme = useRemoraidTheme();
6652
6734
  return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.ScrollArea, {
6653
- ...import_lodash7.merge({}, theme.componentsProps.ScrollArea, componentsProps?.ScrollArea),
6735
+ ref,
6736
+ ...import_lodash7.merge({}, theme.componentsProps.ScrollArea, { style: { contain: "inline-size" } }, componentsProps?.ScrollArea),
6654
6737
  children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.Chip.Group, {
6655
6738
  value,
6656
6739
  onChange,
@@ -6659,7 +6742,7 @@ function ScrollableChipGroup({
6659
6742
  children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.Flex, {
6660
6743
  justify: "flex-start",
6661
6744
  align: "center",
6662
- gap: gap ?? "xs",
6745
+ gap,
6663
6746
  h: "auto",
6664
6747
  ...componentsProps?.container,
6665
6748
  children
@@ -6669,211 +6752,579 @@ function ScrollableChipGroup({
6669
6752
  }
6670
6753
 
6671
6754
  // src/core/components/WidgetSelectionHeader/index.tsx
6672
- var jsx_dev_runtime17 = require("react/jsx-dev-runtime");
6673
- function WidgetSelectionHeader({
6674
- title,
6675
- disabledWidgets,
6676
- mt
6677
- }) {
6678
- const theme = useRemoraidTheme();
6679
- const { isPageRegistered, updateWidgetSelectionBulk, ...widgetsContext2 } = useWidgets();
6680
- const page = usePage();
6681
- if (!page) {
6682
- throw new InvalidComponentUsageError("WidgetSelectionHeader", "must be used as child of 'Page'.");
6683
- }
6684
- const widgets = widgetsContext2.widgets[page.pageId] ?? {};
6685
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Flex, {
6686
- justify: "flex-start",
6687
- align: "center",
6688
- gap: "xs",
6689
- mt,
6690
- children: [
6691
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Text, {
6692
- size: "lg",
6693
- fw: 400,
6694
- children: title ?? page.name
6695
- }, undefined, false, undefined, this),
6696
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Divider, {
6697
- orientation: "vertical"
6698
- }, undefined, false, undefined, this),
6699
- isPageRegistered(page.pageId) && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ScrollableChipGroup, {
6700
- value: Object.keys(widgets).filter((widgetId) => widgets[widgetId]?.selected),
6701
- onChange: (value) => {
6702
- updateWidgetSelectionBulk(page.pageId, value);
6703
- },
6704
- componentsProps: { ScrollArea: { flex: 1 } },
6705
- children: Object.keys(widgets).map((widgetId) => {
6706
- const widget = widgets[widgetId] ?? getDefaultWidgetContext({ widgetId });
6707
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Chip, {
6708
- value: widgetId,
6709
- size: "sm",
6710
- disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6711
- icon: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_icons_react4.IconCheck, {
6712
- ...theme.componentsProps.icons.small
6713
- }, undefined, false, undefined, this),
6714
- children: widget.name
6715
- }, widgetId, false, undefined, this);
6716
- })
6717
- }, undefined, false, undefined, this)
6718
- ]
6719
- }, undefined, true, undefined, this);
6720
- }
6721
- // src/core/components/BadgeGroup/index.tsx
6755
+ var import_lodash10 = __toESM(require_lodash());
6756
+
6757
+ // src/core/components/Pinnable/index.tsx
6758
+ var import_react13 = require("react");
6759
+ var import_icons_react6 = require("@tabler/icons-react");
6722
6760
  var import_core13 = require("@mantine/core");
6723
- var import_react12 = __toESM(require("react"));
6724
6761
 
6725
- // src/core/components/BadgeMinimal/index.tsx
6726
- var import_core12 = require("@mantine/core");
6762
+ // src/core/components/Controls/ControlButton/index.tsx
6763
+ var import_core11 = require("@mantine/core");
6764
+ var import_icons_react4 = require("@tabler/icons-react");
6727
6765
  var import_lodash8 = __toESM(require_lodash());
6728
- var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
6729
- function BadgeMinimal({
6730
- label,
6731
- tooltip,
6766
+ var jsx_dev_runtime17 = require("react/jsx-dev-runtime");
6767
+ function ControlButton({
6768
+ icon: Icon3 = import_icons_react4.IconClick,
6732
6769
  mounted = true,
6770
+ size = "xs",
6771
+ iconSize = "tiny" /* Tiny */,
6772
+ onClick,
6773
+ order,
6774
+ color,
6775
+ tooltip,
6733
6776
  componentsProps
6734
6777
  }) {
6735
6778
  const theme = useRemoraidTheme();
6736
- return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Transition, {
6779
+ return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Transition, {
6737
6780
  mounted,
6738
6781
  transition: "fade",
6739
6782
  duration: theme.transitionDurations.short,
6740
6783
  timingFunction: "ease",
6741
6784
  ...componentsProps?.transition,
6742
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Tooltip, {
6785
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Tooltip, {
6743
6786
  ...import_lodash8.merge({}, theme.componentsProps.Tooltip, { label: tooltip, disabled: !Boolean(tooltip) }, componentsProps?.tooltip),
6744
- children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Badge, {
6745
- variant: "default",
6746
- ...componentsProps?.badge,
6787
+ children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.ActionIcon, {
6788
+ "data-control-button": true,
6789
+ size,
6790
+ color,
6791
+ onClick,
6792
+ radius: "xl",
6793
+ ...componentsProps?.button,
6747
6794
  style: {
6748
- ...transitionStyle,
6749
- cursor: "pointer",
6750
- ...componentsProps?.badge?.style
6795
+ order,
6796
+ ...import_lodash8.merge(transitionStyle, componentsProps?.button?.style)
6751
6797
  },
6752
- children: label
6798
+ children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Icon3, {
6799
+ ...import_lodash8.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
6800
+ }, undefined, false, undefined, this)
6753
6801
  }, undefined, false, undefined, this)
6754
6802
  }, undefined, false, undefined, this)
6755
6803
  }, undefined, false, undefined, this);
6756
6804
  }
6757
6805
 
6758
- // src/core/components/BadgeGroup/index.tsx
6806
+ // src/core/components/Controls/index.tsx
6807
+ var import_react12 = require("react");
6808
+ var import_core12 = require("@mantine/core");
6809
+ var import_icons_react5 = require("@tabler/icons-react");
6759
6810
  var import_lodash9 = __toESM(require_lodash());
6760
- var jsx_dev_runtime19 = require("react/jsx-dev-runtime");
6761
- var react = require("react");
6762
- function BadgeGroup({
6763
- badges: badgesProp,
6764
- gap = "xs",
6765
- breakpoint: breakpointProp,
6766
- componentsProps
6811
+ var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
6812
+ function Controls({
6813
+ groupRef,
6814
+ mounted = true,
6815
+ dragContainerRef,
6816
+ gutter = 5,
6817
+ iconSize = "tiny" /* Tiny */,
6818
+ additionalButtons: additionalButtonsProp,
6819
+ componentsProps,
6820
+ children: childrenProp
6767
6821
  }) {
6768
- const badges = badgesProp.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check 'badges' property passed to 'BadgeGroup'."));
6822
+ const additionalButtons = additionalButtonsProp?.map((additionalButton) => asElementOrPropsOfType(ControlButton, additionalButton, "Check the 'additionalButtons' property of 'Controls'."));
6823
+ const children = asChildrenOfType(ControlButton, childrenProp, "Check children passed to 'Controls' component.");
6769
6824
  const theme = useRemoraidTheme();
6770
- const breakpoint = breakpointProp ?? theme.breakpoints.badgeGroupCollapse;
6771
- const numVisibleBadges = badges.filter((badge) => isValidElementOfType(BadgeMinimal, badge) ? badge.props.mounted : badge.mounted !== false).length;
6772
- const badgesElement = badges.map((badge, i) => {
6773
- if (isValidElementOfType(BadgeMinimal, badge)) {
6774
- return badge;
6825
+ const [pos, setPos] = import_react12.useState({
6826
+ x: 0,
6827
+ y: 0
6828
+ });
6829
+ const offsetRef = import_react12.useRef({ x: 0, y: 0 });
6830
+ const containerRef = import_react12.useRef(null);
6831
+ const clamp = (v, min, max) => {
6832
+ return Math.min(Math.max(v, min), max);
6833
+ };
6834
+ const handlePointerDown = (e) => {
6835
+ if (e.target instanceof Element && e.target.closest("button,[data-control-button]")) {
6836
+ return;
6775
6837
  }
6776
- return /* @__PURE__ */ react.createElement(BadgeMinimal, {
6777
- ...badge,
6778
- key: i
6838
+ if (!containerRef.current) {
6839
+ return;
6840
+ }
6841
+ const paperRect = containerRef.current.getBoundingClientRect();
6842
+ offsetRef.current = {
6843
+ x: e.clientX - paperRect.right,
6844
+ y: e.clientY - paperRect.top
6845
+ };
6846
+ e.currentTarget.setPointerCapture(e.pointerId);
6847
+ };
6848
+ const handlePointerMove = (e) => {
6849
+ if (!e.currentTarget.hasPointerCapture(e.pointerId)) {
6850
+ return;
6851
+ }
6852
+ if (!containerRef.current || !dragContainerRef.current) {
6853
+ return;
6854
+ }
6855
+ const boxRect = dragContainerRef.current.getBoundingClientRect();
6856
+ const paperRect = containerRef.current.getBoundingClientRect();
6857
+ const rawX = e.clientX - boxRect.right - offsetRef.current.x;
6858
+ const rawY = e.clientY - boxRect.top - offsetRef.current.y;
6859
+ const maxX = boxRect.width - paperRect.width;
6860
+ const maxY = boxRect.height - paperRect.height;
6861
+ setPos({
6862
+ x: clamp(-rawX, 0, maxX),
6863
+ y: clamp(rawY, 0, maxY)
6779
6864
  });
6780
- });
6781
- return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(jsx_dev_runtime19.Fragment, {
6782
- children: [
6783
- /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Group, {
6784
- gap,
6785
- wrap: "nowrap",
6786
- visibleFrom: numVisibleBadges > 1 ? breakpoint : undefined,
6787
- ...componentsProps?.container,
6788
- className: clsx_default("remoraid-badge-group", componentsProps?.container?.className),
6789
- children: badgesElement
6790
- }, undefined, false, undefined, this),
6791
- /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Transition, {
6792
- mounted: numVisibleBadges > 1,
6793
- transition: "fade",
6794
- duration: theme.transitionDurations.short,
6795
- timingFunction: "ease",
6796
- ...componentsProps?.cumulativeBadgeTransition,
6797
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.HoverCard, {
6798
- ...import_lodash9.merge({}, theme.componentsProps.HoverCard, componentsProps?.HoverCard),
6799
- children: [
6800
- /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.HoverCard.Target, {
6801
- children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Badge, {
6802
- hiddenFrom: breakpoint,
6803
- variant: "dot",
6804
- ...componentsProps?.cumulativeBadge,
6805
- style: {
6806
- cursor: "pointer",
6807
- ...import_lodash9.merge(transitionStyle, componentsProps?.cumulativeBadge?.style)
6808
- },
6809
- children: [
6810
- numVisibleBadges,
6811
- " badges"
6812
- ]
6813
- }, undefined, true, undefined, this)
6814
- }, undefined, false, undefined, this),
6815
- /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.HoverCard.Dropdown, {
6816
- p: gap,
6817
- children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Stack, {
6818
- gap,
6819
- ...componentsProps?.hoverContainer,
6820
- children: badgesElement
6821
- }, undefined, false, undefined, this)
6822
- }, undefined, false, undefined, this)
6823
- ]
6824
- }, undefined, true, undefined, this)
6825
- }, undefined, false, undefined, this)
6826
- ]
6827
- }, undefined, true, undefined, this);
6828
- }
6829
- // src/core/components/AlertMinimal/index.tsx
6830
- var import_core14 = require("@mantine/core");
6831
- var import_lodash10 = __toESM(require_lodash());
6832
- var jsx_dev_runtime20 = require("react/jsx-dev-runtime");
6833
- function AlertMinimal({
6834
- category,
6835
- children,
6836
- ...props
6837
- }) {
6838
- const theme = useRemoraidTheme();
6839
- const {
6840
- title,
6841
- text,
6842
- color,
6843
- onClose,
6844
- mounted = true,
6845
- icon: Icon2,
6846
- iconSize = "medium" /* Medium */,
6847
- componentsProps
6848
- } = import_lodash10.merge({}, theme.componentsProps.alerts[category], props);
6849
- return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Transition, {
6865
+ };
6866
+ const handlePointerUp = (e) => {
6867
+ e.currentTarget.releasePointerCapture(e.pointerId);
6868
+ };
6869
+ return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Transition, {
6850
6870
  mounted,
6851
- transition: "fade",
6871
+ keepMounted: true,
6872
+ transition: "pop",
6852
6873
  duration: theme.transitionDurations.short,
6853
6874
  timingFunction: "ease",
6854
6875
  ...componentsProps?.transition,
6855
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Alert, {
6856
- title,
6857
- color,
6858
- variant: "light",
6876
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Paper, {
6877
+ ref: containerRef,
6878
+ pos: "absolute",
6879
+ p: gutter,
6880
+ bg: theme.transparentBackground,
6881
+ shadow: "md",
6882
+ onPointerDown: handlePointerDown,
6883
+ onPointerMove: handlePointerMove,
6884
+ onPointerUp: handlePointerUp,
6885
+ ...componentsProps?.container,
6886
+ style: {
6887
+ right: pos.x,
6888
+ top: pos.y,
6889
+ ...import_lodash9.merge(transitionStyle, componentsProps?.container?.style)
6890
+ },
6891
+ className: clsx_default("remoraid-controls", componentsProps?.container?.className),
6892
+ children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Group, {
6893
+ gap: gutter,
6894
+ ref: groupRef,
6895
+ wrap: "nowrap",
6896
+ ...componentsProps?.group,
6897
+ className: clsx_default("remoraid-controls-group", componentsProps?.group?.className),
6898
+ children: [
6899
+ /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_icons_react5.IconGripHorizontal, {
6900
+ ...import_lodash9.merge({}, theme.componentsProps.icons[iconSize], { order: -100, color: "var(--mantine-color-default-border)" }, componentsProps?.gripIcon)
6901
+ }, undefined, false, undefined, this),
6902
+ children,
6903
+ additionalButtons && additionalButtons.map((button, i) => {
6904
+ if (isValidElementOfType(ControlButton, button)) {
6905
+ return button;
6906
+ }
6907
+ return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(ControlButton, {
6908
+ ...button
6909
+ }, i, false, undefined, this);
6910
+ })
6911
+ ]
6912
+ }, undefined, true, undefined, this)
6913
+ }, undefined, false, undefined, this)
6914
+ }, undefined, false, undefined, this);
6915
+ }
6916
+
6917
+ // src/core/components/Pinnable/index.tsx
6918
+ var jsx_dev_runtime19 = require("react/jsx-dev-runtime");
6919
+ function Pinnable({
6920
+ layoutType: layoutTypeProp,
6921
+ section,
6922
+ initialValue = false,
6923
+ layoutId,
6924
+ controlsContainer,
6925
+ hidden = false,
6926
+ componentsProps,
6927
+ children
6928
+ }) {
6929
+ const layoutType = layoutTypeProp ?? "frame" /* Frame */;
6930
+ const { layouts } = useLayouts();
6931
+ const [pinned, setPinned] = import_react13.useState(initialValue);
6932
+ const containerRef = import_react13.useRef(null);
6933
+ const layout = layouts[layoutId ?? remoraidAppShellLayoutId];
6934
+ if (layout && layout.type !== layoutType) {
6935
+ throw new TypeError(`Prop 'layoutId' in '${Pinnable.name}' refers to a layout of type ${layout.type}, expected ${layoutType}. Leave 'layoutId' undefined, if you want to use the layout in '${AppShell_default.name}' as reference layout.`);
6936
+ }
6937
+ const controlButton = import_react13.useMemo(() => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ControlButton, {
6938
+ icon: pinned ? import_icons_react6.IconPinnedOff : import_icons_react6.IconPin,
6939
+ tooltip: pinned ? "Unpin" : "Pin",
6940
+ color: "green",
6941
+ order: 100,
6942
+ ...componentsProps?.button,
6943
+ onClick: (e) => {
6944
+ setPinned((p) => !p);
6945
+ componentsProps?.button?.onClick?.(e);
6946
+ }
6947
+ }, undefined, false, undefined, this), [pinned, componentsProps?.button]);
6948
+ const element = /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Box, {
6949
+ pos: "relative",
6950
+ ref: containerRef,
6951
+ "data-hidden": hidden,
6952
+ h: "100%",
6953
+ ...componentsProps?.container,
6954
+ className: clsx_default("remoraid-pinnable", componentsProps?.container?.className),
6955
+ children: [
6956
+ controlsContainer === undefined ? /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Controls, {
6957
+ dragContainerRef: containerRef,
6958
+ ...componentsProps?.controls,
6959
+ children: controlButton
6960
+ }, undefined, false, undefined, this) : controlsContainer !== null && /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Portal, {
6961
+ target: controlsContainer,
6962
+ children: controlButton
6963
+ }, undefined, false, undefined, this),
6964
+ children
6965
+ ]
6966
+ }, undefined, true, undefined, this);
6967
+ if (!layout) {
6968
+ return null;
6969
+ }
6970
+ if (pinned && layoutType === "frame" /* Frame */) {
6971
+ return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(FrameLayout_default.Element, {
6972
+ layoutId,
6973
+ section,
6974
+ hidden,
6975
+ ...componentsProps?.layoutElement,
6976
+ children: element
6977
+ }, undefined, false, undefined, this);
6978
+ }
6979
+ return element;
6980
+ }
6981
+
6982
+ // src/core/components/WidgetSelectionHeader/index.tsx
6983
+ var jsx_dev_runtime20 = require("react/jsx-dev-runtime");
6984
+ function WidgetSelectionHeader({
6985
+ title,
6986
+ pinnableSection = "top" /* Top */,
6987
+ initiallyPinned = true,
6988
+ disabledWidgets,
6989
+ componentsProps
6990
+ }) {
6991
+ const theme = useRemoraidTheme();
6992
+ const mantineTheme = import_core14.useMantineTheme();
6993
+ const {
6994
+ activeWidget,
6995
+ isPageRegistered,
6996
+ updateWidgetSelectionBulk,
6997
+ ...widgetsContext2
6998
+ } = useWidgets();
6999
+ const page = usePage();
7000
+ if (!page) {
7001
+ throw new InvalidComponentUsageError("WidgetSelectionHeader", "must be used as child of 'Page'.");
7002
+ }
7003
+ const [hover, setHover] = import_react14.useState(false);
7004
+ const [isPinned, setIsPinned] = import_react14.useState(initiallyPinned);
7005
+ const handleEnter = () => {
7006
+ setHover(true);
7007
+ };
7008
+ const handleLeave = () => {
7009
+ setHover(false);
7010
+ };
7011
+ const scrollAreaRef = import_react14.useRef(null);
7012
+ const widgets = widgetsContext2.widgets[page.pageId] ?? {};
7013
+ const selectedWidgets = Object.entries(widgets).reduce((t, [widgetId, widget]) => widget?.selected ? [...t, widgetId] : t, []);
7014
+ const element = /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Flex, {
7015
+ justify: "flex-start",
7016
+ align: "center",
7017
+ gap: "md",
7018
+ ...componentsProps?.container,
7019
+ onMouseEnter: (e) => {
7020
+ if (!pinnableSection) {
7021
+ handleEnter();
7022
+ }
7023
+ componentsProps?.container?.onMouseEnter?.(e);
7024
+ },
7025
+ onMouseLeave: (e) => {
7026
+ if (!pinnableSection) {
7027
+ handleEnter();
7028
+ }
7029
+ componentsProps?.container?.onMouseEnter?.(e);
7030
+ },
7031
+ className: clsx_default(!pinnableSection ? "remoraid-non-widget-segment" : undefined, !pinnableSection ? "remoraid-segment" : undefined, componentsProps?.container?.className),
7032
+ children: [
7033
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Text, {
7034
+ size: "md",
7035
+ ...componentsProps?.title,
7036
+ children: title ?? page.name
7037
+ }, undefined, false, undefined, this),
7038
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Divider, {
7039
+ orientation: "vertical"
7040
+ }, undefined, false, undefined, this),
7041
+ isPageRegistered(page.pageId) && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(ScrollableChipGroup, {
7042
+ value: selectedWidgets,
7043
+ ref: scrollAreaRef,
7044
+ ...componentsProps?.ScrollableChipGroup,
7045
+ onChange: (value) => {
7046
+ updateWidgetSelectionBulk(page.pageId, value);
7047
+ componentsProps?.ScrollableChipGroup?.onChange?.(value);
7048
+ },
7049
+ componentsProps: import_lodash10.merge({ ScrollArea: { flex: 1 } }, componentsProps?.ScrollableChipGroup?.componentsProps),
7050
+ children: Object.entries(widgets).map(([widgetId, widget]) => {
7051
+ if (!widget) {
7052
+ return;
7053
+ }
7054
+ return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Menu, {
7055
+ ...import_lodash10.merge({}, theme.componentsProps.Menu, { trigger: "hover" }, componentsProps?.widgetMenu),
7056
+ children: [
7057
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Menu.Target, {
7058
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Box, {
7059
+ children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Chip, {
7060
+ variant: selectedWidgets.includes(widgetId) ? "filled" : "outline",
7061
+ color: activeWidget === widgetId ? mantineTheme.primaryColor : "gray",
7062
+ value: widgetId,
7063
+ size: "sm",
7064
+ disabled: disabledWidgets?.includes(widgetId),
7065
+ icon: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_icons_react7.IconCheck, {
7066
+ ...theme.componentsProps.icons.small
7067
+ }, undefined, false, undefined, this),
7068
+ ...componentsProps?.Chip,
7069
+ styles: import_lodash10.merge({
7070
+ label: {
7071
+ transition: "background-color var(--remoraid-transition-duration-short)"
7072
+ }
7073
+ }, componentsProps?.Chip?.styles),
7074
+ id: `remoraid-widget-selection-header-chip-${widgetId}`,
7075
+ children: widget.name
7076
+ }, undefined, false, undefined, this)
7077
+ }, undefined, false, undefined, this)
7078
+ }, undefined, false, undefined, this),
7079
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Menu.Dropdown, {
7080
+ children: [
7081
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Menu.Item, {
7082
+ leftSection: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_icons_react7.IconNavigation, {
7083
+ ...theme.componentsProps.icons.small
7084
+ }, undefined, false, undefined, this),
7085
+ onClick: () => {
7086
+ scrollToWidget(widgetId);
7087
+ handleLeave();
7088
+ },
7089
+ disabled: !widget.selected,
7090
+ children: "Scroll to widget"
7091
+ }, undefined, false, undefined, this),
7092
+ /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Menu.Item, {
7093
+ leftSection: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_icons_react7.IconFocus, {
7094
+ ...theme.componentsProps.icons.small
7095
+ }, undefined, false, undefined, this),
7096
+ onClick: () => {
7097
+ updateWidgetSelectionBulk(page.pageId, [widgetId]);
7098
+ handleLeave();
7099
+ },
7100
+ disabled: selectedWidgets.length === 1 && selectedWidgets.includes(widgetId),
7101
+ children: "Isolate widget"
7102
+ }, undefined, false, undefined, this)
7103
+ ]
7104
+ }, undefined, true, undefined, this)
7105
+ ]
7106
+ }, widgetId, true, undefined, this);
7107
+ })
7108
+ }, undefined, false, undefined, this)
7109
+ ]
7110
+ }, undefined, true, undefined, this);
7111
+ import_react14.useEffect(() => {
7112
+ if (!activeWidget) {
7113
+ return;
7114
+ }
7115
+ if (!isPinned) {
7116
+ return;
7117
+ }
7118
+ if (!scrollAreaRef?.current) {
7119
+ return;
7120
+ }
7121
+ const activeWidgetChipElement = scrollAreaRef.current.querySelector(`#remoraid-widget-selection-header-chip-${activeWidget}`);
7122
+ if (!activeWidgetChipElement) {
7123
+ return;
7124
+ }
7125
+ activeWidgetChipElement.scrollIntoView({
7126
+ behavior: "smooth",
7127
+ inline: "center"
7128
+ });
7129
+ }, [activeWidget]);
7130
+ if (pinnableSection) {
7131
+ return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Pinnable, {
7132
+ section: pinnableSection,
7133
+ initialValue: initiallyPinned,
7134
+ ...componentsProps?.Pinnable,
7135
+ componentsProps: {
7136
+ ...componentsProps?.Pinnable?.componentsProps,
7137
+ container: {
7138
+ ...componentsProps?.Pinnable?.componentsProps?.container,
7139
+ onMouseEnter: (e) => {
7140
+ handleEnter();
7141
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseEnter?.(e);
7142
+ },
7143
+ onMouseLeave: (e) => {
7144
+ handleLeave();
7145
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseLeave?.(e);
7146
+ },
7147
+ className: clsx_default("remoraid-segment", "remoraid-non-widget-segment", componentsProps?.Pinnable?.componentsProps?.container?.className)
7148
+ },
7149
+ button: {
7150
+ ...componentsProps?.Pinnable?.componentsProps?.button,
7151
+ onClick: (e) => {
7152
+ setIsPinned(!isPinned);
7153
+ handleLeave();
7154
+ componentsProps?.Pinnable?.componentsProps?.button?.onClick?.(e);
7155
+ }
7156
+ },
7157
+ layoutElement: {
7158
+ includeContainer: false,
7159
+ includePageContainer: pinnableSection === "top" /* Top */ || pinnableSection === "bottom" /* Bottom */,
7160
+ ...componentsProps?.Pinnable?.componentsProps?.layoutElement
7161
+ },
7162
+ controls: {
7163
+ mounted: hover,
7164
+ ...componentsProps?.Pinnable?.componentsProps?.controls
7165
+ }
7166
+ },
7167
+ children: element
7168
+ }, undefined, false, undefined, this);
7169
+ }
7170
+ return element;
7171
+ }
7172
+ // src/core/components/BadgeGroup/index.tsx
7173
+ var import_core16 = require("@mantine/core");
7174
+ var import_react15 = __toESM(require("react"));
7175
+
7176
+ // src/core/components/BadgeMinimal/index.tsx
7177
+ var import_core15 = require("@mantine/core");
7178
+ var import_lodash11 = __toESM(require_lodash());
7179
+ var jsx_dev_runtime21 = require("react/jsx-dev-runtime");
7180
+ function BadgeMinimal({
7181
+ label,
7182
+ tooltip,
7183
+ mounted = true,
7184
+ componentsProps
7185
+ }) {
7186
+ const theme = useRemoraidTheme();
7187
+ return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Transition, {
7188
+ mounted,
7189
+ transition: "fade",
7190
+ duration: theme.transitionDurations.short,
7191
+ timingFunction: "ease",
7192
+ ...componentsProps?.transition,
7193
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Tooltip, {
7194
+ ...import_lodash11.merge({}, theme.componentsProps.Tooltip, { label: tooltip, disabled: !Boolean(tooltip) }, componentsProps?.tooltip),
7195
+ children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Badge, {
7196
+ variant: "default",
7197
+ ...componentsProps?.badge,
7198
+ style: {
7199
+ ...transitionStyle,
7200
+ cursor: "pointer",
7201
+ ...componentsProps?.badge?.style
7202
+ },
7203
+ children: label
7204
+ }, undefined, false, undefined, this)
7205
+ }, undefined, false, undefined, this)
7206
+ }, undefined, false, undefined, this);
7207
+ }
7208
+
7209
+ // src/core/components/BadgeGroup/index.tsx
7210
+ var import_lodash12 = __toESM(require_lodash());
7211
+ var jsx_dev_runtime22 = require("react/jsx-dev-runtime");
7212
+ var react = require("react");
7213
+ function BadgeGroup({
7214
+ badges: badgesProp,
7215
+ gap = "xs",
7216
+ breakpoint: breakpointProp,
7217
+ componentsProps
7218
+ }) {
7219
+ const badges = badgesProp.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check 'badges' property passed to 'BadgeGroup'."));
7220
+ const theme = useRemoraidTheme();
7221
+ const breakpoint = breakpointProp ?? theme.breakpoints.badgeGroupCollapse;
7222
+ const numVisibleBadges = badges.filter((badge) => isValidElementOfType(BadgeMinimal, badge) ? badge.props.mounted : badge.mounted !== false).length;
7223
+ const badgesElement = badges.map((badge, i) => {
7224
+ if (isValidElementOfType(BadgeMinimal, badge)) {
7225
+ return badge;
7226
+ }
7227
+ return /* @__PURE__ */ react.createElement(BadgeMinimal, {
7228
+ ...badge,
7229
+ key: i
7230
+ });
7231
+ });
7232
+ return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
7233
+ children: [
7234
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Group, {
7235
+ gap,
7236
+ wrap: "nowrap",
7237
+ visibleFrom: numVisibleBadges > 1 ? breakpoint : undefined,
7238
+ ...componentsProps?.container,
7239
+ className: clsx_default("remoraid-badge-group", componentsProps?.container?.className),
7240
+ children: badgesElement
7241
+ }, undefined, false, undefined, this),
7242
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Transition, {
7243
+ mounted: numVisibleBadges > 1,
7244
+ transition: "fade",
7245
+ duration: theme.transitionDurations.short,
7246
+ timingFunction: "ease",
7247
+ ...componentsProps?.cumulativeBadgeTransition,
7248
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.HoverCard, {
7249
+ ...import_lodash12.merge({}, theme.componentsProps.HoverCard, componentsProps?.HoverCard),
7250
+ children: [
7251
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.HoverCard.Target, {
7252
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Badge, {
7253
+ hiddenFrom: breakpoint,
7254
+ variant: "dot",
7255
+ ...componentsProps?.cumulativeBadge,
7256
+ style: {
7257
+ cursor: "pointer",
7258
+ ...import_lodash12.merge(transitionStyle, componentsProps?.cumulativeBadge?.style)
7259
+ },
7260
+ children: [
7261
+ numVisibleBadges,
7262
+ " badges"
7263
+ ]
7264
+ }, undefined, true, undefined, this)
7265
+ }, undefined, false, undefined, this),
7266
+ /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.HoverCard.Dropdown, {
7267
+ p: gap,
7268
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Stack, {
7269
+ gap,
7270
+ ...componentsProps?.hoverContainer,
7271
+ children: badgesElement
7272
+ }, undefined, false, undefined, this)
7273
+ }, undefined, false, undefined, this)
7274
+ ]
7275
+ }, undefined, true, undefined, this)
7276
+ }, undefined, false, undefined, this)
7277
+ ]
7278
+ }, undefined, true, undefined, this);
7279
+ }
7280
+ // src/core/components/AlertMinimal/index.tsx
7281
+ var import_core17 = require("@mantine/core");
7282
+ var import_lodash13 = __toESM(require_lodash());
7283
+ var jsx_dev_runtime23 = require("react/jsx-dev-runtime");
7284
+ function AlertMinimal({
7285
+ category,
7286
+ children,
7287
+ ...props
7288
+ }) {
7289
+ const theme = useRemoraidTheme();
7290
+ const {
7291
+ title,
7292
+ text,
7293
+ color,
7294
+ onClose,
7295
+ mounted = true,
7296
+ icon: Icon3,
7297
+ iconSize = "medium" /* Medium */,
7298
+ componentsProps
7299
+ } = import_lodash13.merge({}, theme.componentsProps.alerts[category], props);
7300
+ return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Transition, {
7301
+ mounted,
7302
+ transition: "fade",
7303
+ duration: theme.transitionDurations.short,
7304
+ timingFunction: "ease",
7305
+ ...componentsProps?.transition,
7306
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Alert, {
7307
+ title,
7308
+ color,
7309
+ variant: "light",
6859
7310
  onClose,
6860
7311
  withCloseButton: onClose !== undefined,
6861
- icon: Icon2 ? /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Icon2, {
6862
- ...import_lodash10.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
7312
+ icon: Icon3 ? /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Icon3, {
7313
+ ...import_lodash13.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
6863
7314
  }, undefined, false, undefined, this) : undefined,
6864
- style: import_lodash10.merge(transitionStyle, componentsProps?.alert?.style),
7315
+ style: import_lodash13.merge(transitionStyle, componentsProps?.alert?.style),
6865
7316
  children: [
6866
7317
  text,
6867
7318
  children
6868
7319
  ]
6869
7320
  }, undefined, true, undefined, this)
6870
- }, undefined, false, undefined, this);
6871
- }
6872
- // src/core/components/RemoraidButton/index.tsx
6873
- var import_core15 = require("@mantine/core");
6874
- var import_icons_react5 = require("@tabler/icons-react");
6875
- var import_lodash11 = __toESM(require_lodash());
6876
- var jsx_dev_runtime21 = require("react/jsx-dev-runtime");
7321
+ }, undefined, false, undefined, this);
7322
+ }
7323
+ // src/core/components/RemoraidButton/index.tsx
7324
+ var import_core18 = require("@mantine/core");
7325
+ var import_icons_react8 = require("@tabler/icons-react");
7326
+ var import_lodash14 = __toESM(require_lodash());
7327
+ var jsx_dev_runtime24 = require("react/jsx-dev-runtime");
6877
7328
  function RemoraidButton({
6878
7329
  label,
6879
7330
  responsive: ResponsiveProp,
@@ -6893,22 +7344,22 @@ function RemoraidButton({
6893
7344
  const breakpoint = breakpointProp ?? "md";
6894
7345
  const collapsed = collapsedProp ?? false;
6895
7346
  const iconSize = iconSizeProp ?? getDefaultButtonIconSize(size);
6896
- const Icon3 = iconProp ?? import_icons_react5.IconClick;
7347
+ const Icon4 = iconProp ?? import_icons_react8.IconClick;
6897
7348
  const theme = useRemoraidTheme();
6898
- const iconElement = /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Icon3, {
6899
- ...import_lodash11.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
7349
+ const iconElement = /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Icon4, {
7350
+ ...import_lodash14.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
6900
7351
  }, undefined, false, undefined, this);
6901
- return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Transition, {
7352
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Transition, {
6902
7353
  mounted,
6903
7354
  transition: "fade",
6904
7355
  duration: theme.transitionDurations.short,
6905
7356
  timingFunction: "ease",
6906
7357
  ...componentsProps?.transition,
6907
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
7358
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
6908
7359
  children: [
6909
- /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Tooltip, {
6910
- ...import_lodash11.merge({}, theme.componentsProps.Tooltip, { label }, componentsProps?.tooltip),
6911
- children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.ActionIcon, {
7360
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Tooltip, {
7361
+ ...import_lodash14.merge({}, theme.componentsProps.Tooltip, { label }, componentsProps?.tooltip),
7362
+ children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.ActionIcon, {
6912
7363
  "aria-label": label,
6913
7364
  variant,
6914
7365
  onClick,
@@ -6926,7 +7377,7 @@ function RemoraidButton({
6926
7377
  children: iconElement
6927
7378
  }, undefined, false, undefined, this)
6928
7379
  }, undefined, false, undefined, this),
6929
- /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Button, {
7380
+ /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Button, {
6930
7381
  onClick,
6931
7382
  loading,
6932
7383
  variant,
@@ -6947,234 +7398,11 @@ function RemoraidButton({
6947
7398
  }, undefined, true, undefined, this)
6948
7399
  }, undefined, false, undefined, this);
6949
7400
  }
6950
- // src/core/components/Controls/ControlButton/index.tsx
6951
- var import_core16 = require("@mantine/core");
6952
- var import_icons_react6 = require("@tabler/icons-react");
6953
- var import_lodash12 = __toESM(require_lodash());
6954
- var jsx_dev_runtime22 = require("react/jsx-dev-runtime");
6955
- function ControlButton({
6956
- icon: Icon4 = import_icons_react6.IconClick,
6957
- mounted = true,
6958
- size = "xs",
6959
- iconSize = "tiny" /* Tiny */,
6960
- onClick,
6961
- order,
6962
- color,
6963
- tooltip,
6964
- componentsProps
6965
- }) {
6966
- const theme = useRemoraidTheme();
6967
- return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Transition, {
6968
- mounted,
6969
- transition: "fade",
6970
- duration: theme.transitionDurations.short,
6971
- timingFunction: "ease",
6972
- ...componentsProps?.transition,
6973
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Tooltip, {
6974
- ...import_lodash12.merge({}, theme.componentsProps.Tooltip, { label: tooltip, disabled: !Boolean(tooltip) }, componentsProps?.tooltip),
6975
- children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.ActionIcon, {
6976
- "data-control-button": true,
6977
- size,
6978
- color,
6979
- onClick,
6980
- radius: "xl",
6981
- ...componentsProps?.button,
6982
- style: {
6983
- order,
6984
- ...import_lodash12.merge(transitionStyle, componentsProps?.button?.style)
6985
- },
6986
- children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Icon4, {
6987
- ...import_lodash12.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
6988
- }, undefined, false, undefined, this)
6989
- }, undefined, false, undefined, this)
6990
- }, undefined, false, undefined, this)
6991
- }, undefined, false, undefined, this);
6992
- }
6993
-
6994
- // src/core/components/Controls/index.tsx
6995
- var import_react13 = require("react");
6996
- var import_core17 = require("@mantine/core");
6997
- var import_icons_react7 = require("@tabler/icons-react");
6998
- var import_lodash13 = __toESM(require_lodash());
6999
- var jsx_dev_runtime23 = require("react/jsx-dev-runtime");
7000
- function Controls({
7001
- groupRef,
7002
- mounted = true,
7003
- dragContainerRef,
7004
- gutter = 5,
7005
- iconSize = "tiny" /* Tiny */,
7006
- additionalButtons: additionalButtonsProp,
7007
- componentsProps,
7008
- children: childrenProp
7009
- }) {
7010
- const additionalButtons = additionalButtonsProp?.map((additionalButton) => asElementOrPropsOfType(ControlButton, additionalButton, "Check the 'additionalButtons' property of 'Controls'."));
7011
- const children = asChildrenOfType(ControlButton, childrenProp, "Check children passed to 'Controls' component.");
7012
- const theme = useRemoraidTheme();
7013
- const [pos, setPos] = import_react13.useState({
7014
- x: 0,
7015
- y: 0
7016
- });
7017
- const offsetRef = import_react13.useRef({ x: 0, y: 0 });
7018
- const containerRef = import_react13.useRef(null);
7019
- const clamp = (v, min, max) => {
7020
- return Math.min(Math.max(v, min), max);
7021
- };
7022
- const handlePointerDown = (e) => {
7023
- if (e.target instanceof Element && e.target.closest("button,[data-control-button]")) {
7024
- return;
7025
- }
7026
- if (!containerRef.current) {
7027
- return;
7028
- }
7029
- const paperRect = containerRef.current.getBoundingClientRect();
7030
- offsetRef.current = {
7031
- x: e.clientX - paperRect.right,
7032
- y: e.clientY - paperRect.top
7033
- };
7034
- e.currentTarget.setPointerCapture(e.pointerId);
7035
- };
7036
- const handlePointerMove = (e) => {
7037
- if (!e.currentTarget.hasPointerCapture(e.pointerId)) {
7038
- return;
7039
- }
7040
- if (!containerRef.current || !dragContainerRef.current) {
7041
- return;
7042
- }
7043
- const boxRect = dragContainerRef.current.getBoundingClientRect();
7044
- const paperRect = containerRef.current.getBoundingClientRect();
7045
- const rawX = e.clientX - boxRect.right - offsetRef.current.x;
7046
- const rawY = e.clientY - boxRect.top - offsetRef.current.y;
7047
- const maxX = boxRect.width - paperRect.width;
7048
- const maxY = boxRect.height - paperRect.height;
7049
- setPos({
7050
- x: clamp(-rawX, 0, maxX),
7051
- y: clamp(rawY, 0, maxY)
7052
- });
7053
- };
7054
- const handlePointerUp = (e) => {
7055
- e.currentTarget.releasePointerCapture(e.pointerId);
7056
- };
7057
- return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Transition, {
7058
- mounted,
7059
- keepMounted: true,
7060
- transition: "pop",
7061
- duration: theme.transitionDurations.short,
7062
- timingFunction: "ease",
7063
- ...componentsProps?.transition,
7064
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Paper, {
7065
- ref: containerRef,
7066
- pos: "absolute",
7067
- p: gutter,
7068
- bg: theme.transparentBackground,
7069
- shadow: "md",
7070
- onPointerDown: handlePointerDown,
7071
- onPointerMove: handlePointerMove,
7072
- onPointerUp: handlePointerUp,
7073
- ...componentsProps?.container,
7074
- style: {
7075
- right: pos.x,
7076
- top: pos.y,
7077
- ...import_lodash13.merge(transitionStyle, componentsProps?.container?.style)
7078
- },
7079
- className: clsx_default("remoraid-controls", componentsProps?.container?.className),
7080
- children: /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Group, {
7081
- gap: gutter,
7082
- ref: groupRef,
7083
- wrap: "nowrap",
7084
- ...componentsProps?.group,
7085
- className: clsx_default("remoraid-controls-group", componentsProps?.group?.className),
7086
- children: [
7087
- /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_icons_react7.IconGripHorizontal, {
7088
- ...import_lodash13.merge({}, theme.componentsProps.icons[iconSize], { order: -100, color: "var(--mantine-color-default-border)" }, componentsProps?.gripIcon)
7089
- }, undefined, false, undefined, this),
7090
- children,
7091
- additionalButtons && additionalButtons.map((button, i) => {
7092
- if (isValidElementOfType(ControlButton, button)) {
7093
- return button;
7094
- }
7095
- return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ControlButton, {
7096
- ...button
7097
- }, i, false, undefined, this);
7098
- })
7099
- ]
7100
- }, undefined, true, undefined, this)
7101
- }, undefined, false, undefined, this)
7102
- }, undefined, false, undefined, this);
7103
- }
7104
7401
  // src/core/components/Widget/WidgetWrapper/index.tsx
7105
7402
  var import_core19 = require("@mantine/core");
7106
- var import_react15 = require("react");
7403
+ var import_react16 = require("react");
7107
7404
  var import_icons_react9 = require("@tabler/icons-react");
7108
-
7109
- // src/core/components/Pinnable/index.tsx
7110
- var import_react14 = require("react");
7111
- var import_icons_react8 = require("@tabler/icons-react");
7112
- var import_core18 = require("@mantine/core");
7113
- var jsx_dev_runtime24 = require("react/jsx-dev-runtime");
7114
- function Pinnable({
7115
- layoutType: layoutTypeProp,
7116
- section,
7117
- initialValue = false,
7118
- layoutId,
7119
- controlsContainer,
7120
- hidden = false,
7121
- componentsProps,
7122
- children
7123
- }) {
7124
- const layoutType = layoutTypeProp ?? "frame" /* Frame */;
7125
- const { layouts } = useLayouts();
7126
- const [pinned, setPinned] = import_react14.useState(initialValue);
7127
- const containerRef = import_react14.useRef(null);
7128
- const layout = layouts[layoutId ?? remoraidAppShellLayoutId];
7129
- if (layout && layout.type !== layoutType) {
7130
- throw new TypeError(`Prop 'layoutId' in '${Pinnable.name}' refers to a layout of type ${layout.type}, expected ${layoutType}. Leave 'layoutId' undefined, if you want to use the layout in '${AppShell_default.name}' as reference layout.`);
7131
- }
7132
- const controlButton = import_react14.useMemo(() => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ControlButton, {
7133
- icon: pinned ? import_icons_react8.IconPinnedOff : import_icons_react8.IconPin,
7134
- tooltip: pinned ? "Unpin" : "Pin",
7135
- color: "green",
7136
- order: 100,
7137
- ...componentsProps?.button,
7138
- onClick: (e) => {
7139
- setPinned((p) => !p);
7140
- componentsProps?.button?.onClick?.(e);
7141
- }
7142
- }, undefined, false, undefined, this), [pinned, componentsProps?.button]);
7143
- const element = /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Box, {
7144
- pos: "relative",
7145
- ref: containerRef,
7146
- "data-hidden": hidden,
7147
- ...componentsProps?.container,
7148
- className: clsx_default("remoraid-pinnable", componentsProps?.container?.className),
7149
- children: [
7150
- controlsContainer === undefined ? /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Controls, {
7151
- dragContainerRef: containerRef,
7152
- ...componentsProps?.controls,
7153
- children: controlButton
7154
- }, undefined, false, undefined, this) : controlsContainer !== null && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Portal, {
7155
- target: controlsContainer,
7156
- children: controlButton
7157
- }, undefined, false, undefined, this),
7158
- children
7159
- ]
7160
- }, undefined, true, undefined, this);
7161
- if (!layout) {
7162
- return null;
7163
- }
7164
- if (pinned && layoutType === "frame" /* Frame */) {
7165
- return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(FrameLayout_default.Element, {
7166
- layoutId,
7167
- section,
7168
- hidden,
7169
- ...componentsProps?.layoutElement,
7170
- children: element
7171
- }, undefined, false, undefined, this);
7172
- }
7173
- return element;
7174
- }
7175
-
7176
- // src/core/components/Widget/WidgetWrapper/index.tsx
7177
- var import_lodash14 = __toESM(require_lodash());
7405
+ var import_lodash15 = __toESM(require_lodash());
7178
7406
  var jsx_dev_runtime25 = require("react/jsx-dev-runtime");
7179
7407
  function WidgetWrapper({
7180
7408
  config,
@@ -7185,7 +7413,8 @@ function WidgetWrapper({
7185
7413
  children
7186
7414
  }) {
7187
7415
  const {
7188
- isWidgetSelected,
7416
+ widgets,
7417
+ hideWidget,
7189
7418
  isPageRegistered,
7190
7419
  isWidgetRegistered,
7191
7420
  registerWidget,
@@ -7195,12 +7424,11 @@ function WidgetWrapper({
7195
7424
  } = useWidgets();
7196
7425
  const page = usePage();
7197
7426
  const theme = useRemoraidTheme();
7198
- const mounted = page !== null && isWidgetSelected(page.pageId, config.widgetId);
7199
- const [controlsContainer, setControlsContainer] = import_react15.useState(null);
7200
- const [hidden, setHidden] = import_react15.useState(!mounted);
7427
+ const [controlsContainer, setControlsContainer] = import_react16.useState(null);
7428
+ const widget = page ? widgets[page.pageId]?.[config.widgetId] : undefined;
7201
7429
  const pageRegistered = page ? isPageRegistered(page.pageId) : false;
7202
- const containerRef = import_react15.useRef(null);
7203
- const controlsContainerRef = import_react15.useCallback((n) => {
7430
+ const containerRef = import_react16.useRef(null);
7431
+ const controlsContainerRef = import_react16.useCallback((n) => {
7204
7432
  setControlsContainer(n);
7205
7433
  }, [setControlsContainer]);
7206
7434
  const handleEnter = () => {
@@ -7209,6 +7437,7 @@ function WidgetWrapper({
7209
7437
  const handleLeave = () => {
7210
7438
  updateActiveWidget(null);
7211
7439
  };
7440
+ const mounted = Boolean(widget?.selected);
7212
7441
  let element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core19.Transition, {
7213
7442
  mounted,
7214
7443
  transition: "fade-left",
@@ -7216,7 +7445,9 @@ function WidgetWrapper({
7216
7445
  timingFunction: "ease",
7217
7446
  ...componentsProps?.transition,
7218
7447
  onExited: () => {
7219
- setHidden(true);
7448
+ if (page) {
7449
+ hideWidget(page.pageId, config.widgetId);
7450
+ }
7220
7451
  componentsProps?.transition?.onExited?.();
7221
7452
  },
7222
7453
  children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core19.Paper, {
@@ -7227,6 +7458,8 @@ function WidgetWrapper({
7227
7458
  mt,
7228
7459
  pos: "relative",
7229
7460
  h: "fit-content",
7461
+ mah: "100%",
7462
+ display: "flex",
7230
7463
  ...componentsProps?.container,
7231
7464
  onMouseEnter: (e) => {
7232
7465
  if (!pinnableSection) {
@@ -7240,7 +7473,8 @@ function WidgetWrapper({
7240
7473
  }
7241
7474
  componentsProps?.container?.onMouseLeave?.(e);
7242
7475
  },
7243
- style: import_lodash14.merge(transitionStyle, componentsProps?.container?.style),
7476
+ style: import_lodash15.merge(transitionStyle, { flexDirection: "column" }, componentsProps?.container?.style),
7477
+ className: clsx_default("remoraid-segment", componentsProps?.container?.className),
7244
7478
  id: config.widgetId,
7245
7479
  children: [
7246
7480
  /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Controls, {
@@ -7255,6 +7489,13 @@ function WidgetWrapper({
7255
7489
  color: "red",
7256
7490
  order: 200,
7257
7491
  ...componentsProps?.closeButton,
7492
+ componentsProps: {
7493
+ ...componentsProps?.closeButton?.componentsProps,
7494
+ tooltip: {
7495
+ disabled: !mounted,
7496
+ ...componentsProps?.closeButton?.componentsProps?.tooltip
7497
+ }
7498
+ },
7258
7499
  onClick: (e) => {
7259
7500
  if (!page) {
7260
7501
  return;
@@ -7273,7 +7514,7 @@ function WidgetWrapper({
7273
7514
  element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Pinnable, {
7274
7515
  section: pinnableSection,
7275
7516
  controlsContainer,
7276
- hidden,
7517
+ hidden: Boolean(widget?.hidden),
7277
7518
  ...componentsProps?.Pinnable,
7278
7519
  componentsProps: {
7279
7520
  ...componentsProps?.Pinnable?.componentsProps,
@@ -7304,7 +7545,7 @@ function WidgetWrapper({
7304
7545
  children: element
7305
7546
  }, undefined, false, undefined, this);
7306
7547
  }
7307
- import_react15.useEffect(() => {
7548
+ import_react16.useEffect(() => {
7308
7549
  if (!page) {
7309
7550
  return;
7310
7551
  }
@@ -7312,20 +7553,11 @@ function WidgetWrapper({
7312
7553
  registerWidget(page.pageId, config);
7313
7554
  }
7314
7555
  }, [pageRegistered]);
7315
- import_react15.useEffect(() => {
7316
- if (mounted) {
7317
- const id = requestAnimationFrame(() => {
7318
- setHidden(false);
7319
- });
7320
- return () => {
7321
- cancelAnimationFrame(id);
7322
- };
7323
- }
7324
- }, [mounted]);
7325
7556
  return element;
7326
7557
  }
7327
7558
  // src/core/components/Widget/index.tsx
7328
7559
  var import_core20 = require("@mantine/core");
7560
+ var import_lodash16 = __toESM(require_lodash());
7329
7561
  var jsx_dev_runtime26 = require("react/jsx-dev-runtime");
7330
7562
  var react2 = require("react");
7331
7563
  function Widget({
@@ -7345,6 +7577,7 @@ function Widget({
7345
7577
  const buttons = buttonsProp?.map((button) => asElementOrPropsOfType(RemoraidButton, button, "Check the 'buttons' property of this widget."));
7346
7578
  const alerts = alertsProp?.map((alert) => asElementOrPropsOfType(AlertMinimal, alert, "Check the 'alerts' property of this widget."));
7347
7579
  const badges = badgesProp?.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check the 'badges' property of this widget."));
7580
+ const theme = useRemoraidTheme();
7348
7581
  const badgesGap = (typeof gaps === "object" ? gaps.badges : gaps) ?? "xs";
7349
7582
  const buttonsGap = (typeof gaps === "object" ? gaps.buttons : gaps) ?? "xs";
7350
7583
  const alertsGap = (typeof gaps === "object" ? gaps.alerts : gaps) ?? "xs";
@@ -7360,72 +7593,79 @@ function Widget({
7360
7593
  mt,
7361
7594
  ...componentsProps?.wrapper,
7362
7595
  pinnableSection: pinnableSection ?? componentsProps?.wrapper?.pinnableSection,
7363
- children: [
7364
- /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
7365
- justify: "space-between",
7366
- wrap: "nowrap",
7367
- children: [
7368
- /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
7369
- gap: badgesGap,
7370
- wrap: "nowrap",
7371
- children: [
7372
- /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Title, {
7373
- order: 1,
7374
- size: "h2",
7375
- lineClamp: 1,
7376
- ...componentsProps?.title,
7377
- children: title ?? id
7378
- }, undefined, false, undefined, this),
7379
- badges !== undefined && /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(BadgeGroup, {
7380
- badges,
7381
- gap: badgesGap,
7382
- ...componentsProps?.badgeGroup
7383
- }, undefined, false, undefined, this)
7384
- ]
7385
- }, undefined, true, undefined, this),
7386
- /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
7387
- gap: buttonsGap,
7388
- wrap: "nowrap",
7389
- children: buttons !== undefined && buttons.map((button, i) => {
7390
- if (isValidElementOfType(RemoraidButton, button)) {
7391
- return button;
7392
- }
7393
- return /* @__PURE__ */ react2.createElement(RemoraidButton, {
7394
- ...button,
7395
- key: i
7396
- });
7397
- })
7596
+ children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Stack, {
7597
+ gap: "md",
7598
+ mih: 0,
7599
+ ...componentsProps?.contentContainer,
7600
+ children: [
7601
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
7602
+ justify: "space-between",
7603
+ wrap: "nowrap",
7604
+ children: [
7605
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
7606
+ gap: badgesGap,
7607
+ wrap: "nowrap",
7608
+ children: [
7609
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Title, {
7610
+ order: 1,
7611
+ size: "h2",
7612
+ lineClamp: 1,
7613
+ ...componentsProps?.title,
7614
+ children: title ?? id
7615
+ }, undefined, false, undefined, this),
7616
+ badges !== undefined && /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(BadgeGroup, {
7617
+ badges,
7618
+ gap: badgesGap,
7619
+ ...componentsProps?.badgeGroup
7620
+ }, undefined, false, undefined, this)
7621
+ ]
7622
+ }, undefined, true, undefined, this),
7623
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
7624
+ gap: buttonsGap,
7625
+ wrap: "nowrap",
7626
+ children: buttons !== undefined && buttons.map((button, i) => {
7627
+ if (isValidElementOfType(RemoraidButton, button)) {
7628
+ return button;
7629
+ }
7630
+ return /* @__PURE__ */ react2.createElement(RemoraidButton, {
7631
+ ...button,
7632
+ key: i
7633
+ });
7634
+ })
7635
+ }, undefined, false, undefined, this)
7636
+ ]
7637
+ }, undefined, true, undefined, this),
7638
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Box, {
7639
+ children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Divider, {
7640
+ ...componentsProps?.divider
7398
7641
  }, undefined, false, undefined, this)
7399
- ]
7400
- }, undefined, true, undefined, this),
7401
- /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Divider, {
7402
- my: "md",
7403
- ...componentsProps?.divider
7404
- }, undefined, false, undefined, this),
7405
- /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Stack, {
7406
- align: "stretch",
7407
- gap: alertsGap,
7408
- mb: alerts && alerts.length > 0 ? "md" : 0,
7409
- ...componentsProps?.alertsContainer,
7410
- children: alerts?.map((alert, i) => {
7411
- if (isValidElementOfType(AlertMinimal, alert)) {
7412
- return alert;
7413
- }
7414
- return /* @__PURE__ */ react2.createElement(AlertMinimal, {
7415
- ...alert,
7416
- key: i
7417
- });
7418
- })
7419
- }, undefined, false, undefined, this),
7420
- loading ? /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Center, {
7421
- children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Loader, {
7422
- ...componentsProps?.loader
7642
+ }, undefined, false, undefined, this),
7643
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Stack, {
7644
+ align: "stretch",
7645
+ gap: alertsGap,
7646
+ ...componentsProps?.alertsContainer,
7647
+ className: clsx_default("remoraid-widget-alerts-container", componentsProps?.alertsContainer?.className),
7648
+ children: alerts?.map((alert, i) => {
7649
+ if (isValidElementOfType(AlertMinimal, alert)) {
7650
+ return alert;
7651
+ }
7652
+ return /* @__PURE__ */ react2.createElement(AlertMinimal, {
7653
+ ...alert,
7654
+ key: i
7655
+ });
7656
+ })
7657
+ }, undefined, false, undefined, this),
7658
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.ScrollArea.Autosize, {
7659
+ ...import_lodash16.merge(theme.componentsProps.ScrollArea, { flex: 1 }, componentsProps?.childrenContainer),
7660
+ children: loading ? /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Center, {
7661
+ children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Loader, {
7662
+ ...componentsProps?.loader
7663
+ }, undefined, false, undefined, this)
7664
+ }, undefined, false, undefined, this) : children
7423
7665
  }, undefined, false, undefined, this)
7424
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(jsx_dev_runtime26.Fragment, {
7425
- children
7426
- }, undefined, false, undefined, this)
7427
- ]
7428
- }, undefined, true, undefined, this);
7666
+ ]
7667
+ }, undefined, true, undefined, this)
7668
+ }, undefined, false, undefined, this);
7429
7669
  }
7430
7670
  // src/core/components/NotFoundPage/index.tsx
7431
7671
  var import_navigation3 = require("next/navigation");
@@ -7492,7 +7732,7 @@ function EnvironmentShell({
7492
7732
  return null;
7493
7733
  }
7494
7734
  // src/core/components/SettingsWidget/index.tsx
7495
- var import_react16 = require("react");
7735
+ var import_react17 = require("react");
7496
7736
  var import_icons_react11 = require("@tabler/icons-react");
7497
7737
 
7498
7738
  // src/core/components/SettingsWidget/SaveButton/index.tsx
@@ -7534,9 +7774,9 @@ function SaveButton({
7534
7774
  // src/core/components/SettingsWidget/index.tsx
7535
7775
  var jsx_dev_runtime30 = require("react/jsx-dev-runtime");
7536
7776
  var defaultSettingsWidgetContext = {};
7537
- var settingsWidgetContext = import_react16.createContext(defaultSettingsWidgetContext);
7777
+ var settingsWidgetContext = import_react17.createContext(defaultSettingsWidgetContext);
7538
7778
  var useSettingsWidgetContext = () => {
7539
- return import_react16.useContext(settingsWidgetContext);
7779
+ return import_react17.useContext(settingsWidgetContext);
7540
7780
  };
7541
7781
  function SettingsWidget({
7542
7782
  children,
@@ -7582,7 +7822,7 @@ var SettingsWidget_default = Object.assign(SettingsWidget, {
7582
7822
  SaveButton
7583
7823
  });
7584
7824
  // src/core/components/SettingsWidget/SettingsTable/index.tsx
7585
- var import_react17 = require("react");
7825
+ var import_react18 = require("react");
7586
7826
  var import_core23 = require("@mantine/core");
7587
7827
 
7588
7828
  // src/core/components/SettingsWidget/SettingsTable/Row/index.tsx
@@ -7615,9 +7855,9 @@ var jsx_dev_runtime32 = require("react/jsx-dev-runtime");
7615
7855
  var defaultSettingsTableOptions = {
7616
7856
  leftColumnWidth: "38.2%"
7617
7857
  };
7618
- var settingsTableOptionsContext = import_react17.createContext(defaultSettingsTableOptions);
7858
+ var settingsTableOptionsContext = import_react18.createContext(defaultSettingsTableOptions);
7619
7859
  var useSettingsTableOptions = () => {
7620
- return import_react17.useContext(settingsTableOptionsContext);
7860
+ return import_react18.useContext(settingsTableOptionsContext);
7621
7861
  };
7622
7862
  function SettingsTable({
7623
7863
  leftColumnWidth,
@@ -7644,7 +7884,7 @@ var SettingsTable_default = Object.assign(SettingsTable, {
7644
7884
  Row
7645
7885
  });
7646
7886
  // src/core/components/NavbarSettingsWidget/index.tsx
7647
- var import_lodash15 = __toESM(require_lodash());
7887
+ var import_lodash17 = __toESM(require_lodash());
7648
7888
  var import_core24 = require("@mantine/core");
7649
7889
  var import_icons_react12 = require("@tabler/icons-react");
7650
7890
  var jsx_dev_runtime33 = require("react/jsx-dev-runtime");
@@ -7670,7 +7910,7 @@ function NavbarSettingsWidget({
7670
7910
  navbar: initialUserExperience.navbar
7671
7911
  }));
7672
7912
  },
7673
- custom: !import_lodash15.isEqual(userExperience.navbar, initialUserExperience.navbar),
7913
+ custom: !import_lodash17.isEqual(userExperience.navbar, initialUserExperience.navbar),
7674
7914
  children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default, {
7675
7915
  ...componentsProps?.table,
7676
7916
  children: [
@@ -7699,6 +7939,7 @@ function NavbarSettingsWidget({
7699
7939
  color: "var(--mantine-primary-color-filled)"
7700
7940
  }, undefined, false, undefined, this),
7701
7941
  variant: "outline",
7942
+ size: "sm",
7702
7943
  children: label
7703
7944
  }, i, false, undefined, this);
7704
7945
  })
@@ -7718,7 +7959,7 @@ function NavbarSettingsWidget({
7718
7959
  }, undefined, false, undefined, this);
7719
7960
  }
7720
7961
  // src/core/components/ContextClusterProvider/index.tsx
7721
- var import_react18 = __toESM(require("react"));
7962
+ var import_react19 = __toESM(require("react"));
7722
7963
  var jsx_dev_runtime34 = require("react/jsx-dev-runtime");
7723
7964
  var createContextCluster = (generalDefaultValue, staticIds) => {
7724
7965
  const isStaticId = (id) => {
@@ -7730,16 +7971,16 @@ var createContextCluster = (generalDefaultValue, staticIds) => {
7730
7971
  const contexts = {};
7731
7972
  const defaultValues = {};
7732
7973
  const createContext8 = (id, defaultValue) => {
7733
- const context = import_react18.default.createContext(defaultValue ?? generalDefaultValue);
7974
+ const context = import_react19.default.createContext(defaultValue ?? generalDefaultValue);
7734
7975
  contexts[id] = context;
7735
7976
  defaultValues[id] = defaultValue ?? generalDefaultValue;
7736
7977
  return context;
7737
7978
  };
7738
7979
  const useContext11 = (id) => {
7739
7980
  if (isStaticId(id)) {
7740
- return contexts[id] ? import_react18.default.useContext(contexts[id]) : generalDefaultValue;
7981
+ return contexts[id] ? import_react19.default.useContext(contexts[id]) : generalDefaultValue;
7741
7982
  }
7742
- return contexts[id] ? import_react18.default.useContext(contexts[id]) : null;
7983
+ return contexts[id] ? import_react19.default.useContext(contexts[id]) : null;
7743
7984
  };
7744
7985
  return {
7745
7986
  contexts,