remoraid 2.20.2 → 2.23.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.cjs +664 -447
- package/dist/core/index.d.ts +139 -123
- package/dist/core/index.js +667 -441
- package/dist/core/styles.css +13 -1
- package/dist/server/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/core/index.cjs
CHANGED
|
@@ -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) =>
|
|
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,51 @@ function WidgetsProvider({
|
|
|
5563
5569
|
setActiveWidget(widgetId);
|
|
5564
5570
|
};
|
|
5565
5571
|
const updateWidgetSelection = (pageId, widgetId, value) => {
|
|
5566
|
-
|
|
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
|
-
|
|
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
|
-
...
|
|
5578
|
-
[widgetId]: {
|
|
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
|
-
|
|
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
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5600
|
+
setWidgets((prev) => {
|
|
5601
|
+
const updatedPage = {};
|
|
5602
|
+
for (const [widgetId, widget] of Object.entries(page)) {
|
|
5603
|
+
if (!widget) {
|
|
5604
|
+
continue;
|
|
5605
|
+
}
|
|
5606
|
+
updatedPage[widgetId] = {
|
|
5607
|
+
...widget,
|
|
5608
|
+
selected: selectedWidgetIds.includes(widgetId),
|
|
5609
|
+
hidden: false
|
|
5610
|
+
};
|
|
5611
|
+
}
|
|
5612
|
+
return {
|
|
5613
|
+
...prev,
|
|
5614
|
+
[pageId]: updatedPage
|
|
5592
5615
|
};
|
|
5593
|
-
}
|
|
5594
|
-
setWidgets((prev) => ({
|
|
5595
|
-
...prev,
|
|
5596
|
-
[pageId]: updatedPage
|
|
5597
|
-
}));
|
|
5616
|
+
});
|
|
5598
5617
|
};
|
|
5599
5618
|
const registerPage = (pageId, initialWidgets) => {
|
|
5600
5619
|
setWidgets((prev) => ({
|
|
@@ -5640,10 +5659,21 @@ function WidgetsProvider({
|
|
|
5640
5659
|
return true;
|
|
5641
5660
|
};
|
|
5642
5661
|
const isWidgetSelected = (pageId, widgetId) => {
|
|
5643
|
-
|
|
5644
|
-
|
|
5662
|
+
return Boolean(widgets[pageId]?.[widgetId]?.selected);
|
|
5663
|
+
};
|
|
5664
|
+
const hideWidget = (pageId, widgetId) => {
|
|
5665
|
+
const widget = widgets[pageId]?.[widgetId];
|
|
5666
|
+
if (!widget) {
|
|
5667
|
+
console.error(`Cannot call 'hideWidget' for widget ${widgetId}. Because this widget does not exist on page ${pageId}.`);
|
|
5668
|
+
return;
|
|
5645
5669
|
}
|
|
5646
|
-
|
|
5670
|
+
setWidgets((prev) => ({
|
|
5671
|
+
...prev,
|
|
5672
|
+
[pageId]: {
|
|
5673
|
+
...prev[pageId],
|
|
5674
|
+
[widgetId]: { ...widget, selected: false, hidden: true }
|
|
5675
|
+
}
|
|
5676
|
+
}));
|
|
5647
5677
|
};
|
|
5648
5678
|
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(widgetsContext.Provider, {
|
|
5649
5679
|
value: {
|
|
@@ -5656,7 +5686,8 @@ function WidgetsProvider({
|
|
|
5656
5686
|
registerWidget,
|
|
5657
5687
|
registerPage,
|
|
5658
5688
|
isWidgetRegistered,
|
|
5659
|
-
isPageRegistered
|
|
5689
|
+
isPageRegistered,
|
|
5690
|
+
hideWidget
|
|
5660
5691
|
},
|
|
5661
5692
|
children
|
|
5662
5693
|
}, undefined, false, undefined, this);
|
|
@@ -5749,6 +5780,16 @@ var getDefaultButtonIconSize = (buttonSize) => {
|
|
|
5749
5780
|
}
|
|
5750
5781
|
return "medium" /* Medium */;
|
|
5751
5782
|
};
|
|
5783
|
+
var scrollToWidget = (widgetId) => {
|
|
5784
|
+
const widgetElement = document.getElementById(widgetId);
|
|
5785
|
+
if (!widgetElement) {
|
|
5786
|
+
return;
|
|
5787
|
+
}
|
|
5788
|
+
widgetElement.scrollIntoView({
|
|
5789
|
+
behavior: "smooth",
|
|
5790
|
+
block: "start"
|
|
5791
|
+
});
|
|
5792
|
+
};
|
|
5752
5793
|
|
|
5753
5794
|
// src/core/components/RemoraidProvider/ThemeProvider/index.tsx
|
|
5754
5795
|
var import_core2 = require("@mantine/core");
|
|
@@ -5812,6 +5853,7 @@ var createRemoraidTheme = (customTheme, dependencies) => {
|
|
|
5812
5853
|
};
|
|
5813
5854
|
}
|
|
5814
5855
|
const defaultTheme = {
|
|
5856
|
+
bodyColor: "light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-9))",
|
|
5815
5857
|
containerSize: 1300,
|
|
5816
5858
|
jsonStringifySpace: 2,
|
|
5817
5859
|
transparentBackground,
|
|
@@ -5873,11 +5915,44 @@ var createRemoraidTheme = (customTheme, dependencies) => {
|
|
|
5873
5915
|
},
|
|
5874
5916
|
Tooltip: {
|
|
5875
5917
|
withArrow: true
|
|
5918
|
+
},
|
|
5919
|
+
Menu: {
|
|
5920
|
+
shadow: "md",
|
|
5921
|
+
withArrow: true,
|
|
5922
|
+
transitionProps: {
|
|
5923
|
+
transition: "pop",
|
|
5924
|
+
duration: transitionDurations.short
|
|
5925
|
+
},
|
|
5926
|
+
styles: {
|
|
5927
|
+
dropdown: { border: "none", background: transparentBackground },
|
|
5928
|
+
arrow: { border: "none" }
|
|
5929
|
+
}
|
|
5876
5930
|
}
|
|
5877
5931
|
}
|
|
5878
5932
|
};
|
|
5879
5933
|
return import_lodash2.merge(defaultTheme, customTheme);
|
|
5880
5934
|
};
|
|
5935
|
+
var getCssVars = (theme) => {
|
|
5936
|
+
const {
|
|
5937
|
+
bodyColor,
|
|
5938
|
+
transitionDurations,
|
|
5939
|
+
primaryGutter,
|
|
5940
|
+
containerSize,
|
|
5941
|
+
transparentBackground
|
|
5942
|
+
} = theme;
|
|
5943
|
+
return {
|
|
5944
|
+
"--mantine-color-body": bodyColor,
|
|
5945
|
+
"--remoraid-container-size": `${containerSize}px`,
|
|
5946
|
+
"--remoraid-primary-gutter": typeof primaryGutter === "string" ? `var(--mantine-spacing-${primaryGutter})` : `${primaryGutter}px`,
|
|
5947
|
+
...transparentBackground && {
|
|
5948
|
+
"--remoraid-transparent-background": transparentBackground
|
|
5949
|
+
},
|
|
5950
|
+
...Object.entries(transitionDurations).reduce((t, [key, value]) => ({
|
|
5951
|
+
...t,
|
|
5952
|
+
[`--remoraid-transition-duration-${key}`]: `${value}ms`
|
|
5953
|
+
}), {})
|
|
5954
|
+
};
|
|
5955
|
+
};
|
|
5881
5956
|
var themeContext = import_react4.default.createContext(createRemoraidTheme());
|
|
5882
5957
|
var useRemoraidTheme = () => {
|
|
5883
5958
|
return import_react4.useContext(themeContext);
|
|
@@ -5895,6 +5970,14 @@ function ThemeProvider({
|
|
|
5895
5970
|
};
|
|
5896
5971
|
return createRemoraidTheme(typeof theme === "function" ? theme(dependencies) : theme, dependencies);
|
|
5897
5972
|
}, [colorScheme, theme]);
|
|
5973
|
+
import_react4.useLayoutEffect(() => {
|
|
5974
|
+
const root = document.documentElement;
|
|
5975
|
+
const entries = Object.entries(getCssVars(remoraidTheme));
|
|
5976
|
+
entries.forEach(([key, value]) => root.style.setProperty(key, value));
|
|
5977
|
+
return () => {
|
|
5978
|
+
entries.forEach(([key]) => root.style.removeProperty(key));
|
|
5979
|
+
};
|
|
5980
|
+
}, [remoraidTheme]);
|
|
5898
5981
|
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(themeContext.Provider, {
|
|
5899
5982
|
value: remoraidTheme,
|
|
5900
5983
|
children
|
|
@@ -6590,7 +6673,7 @@ var AppShell_default = Object.assign(AppShell, {
|
|
|
6590
6673
|
FooterMinimal
|
|
6591
6674
|
});
|
|
6592
6675
|
// src/core/components/WidgetSelectionHeader/index.tsx
|
|
6593
|
-
var
|
|
6676
|
+
var import_core14 = require("@mantine/core");
|
|
6594
6677
|
|
|
6595
6678
|
// src/core/components/Page/index.tsx
|
|
6596
6679
|
var import_core9 = require("@mantine/core");
|
|
@@ -6634,7 +6717,8 @@ function Page({
|
|
|
6634
6717
|
}
|
|
6635
6718
|
|
|
6636
6719
|
// src/core/components/WidgetSelectionHeader/index.tsx
|
|
6637
|
-
var
|
|
6720
|
+
var import_icons_react7 = require("@tabler/icons-react");
|
|
6721
|
+
var import_react14 = require("react");
|
|
6638
6722
|
|
|
6639
6723
|
// src/core/components/ScrollableChipGroup/index.tsx
|
|
6640
6724
|
var import_core10 = require("@mantine/core");
|
|
@@ -6642,15 +6726,16 @@ var import_lodash7 = __toESM(require_lodash());
|
|
|
6642
6726
|
var jsx_dev_runtime16 = require("react/jsx-dev-runtime");
|
|
6643
6727
|
function ScrollableChipGroup({
|
|
6644
6728
|
value,
|
|
6729
|
+
ref,
|
|
6645
6730
|
onChange,
|
|
6646
|
-
gap,
|
|
6731
|
+
gap = "xs",
|
|
6647
6732
|
componentsProps,
|
|
6648
|
-
children
|
|
6733
|
+
children
|
|
6649
6734
|
}) {
|
|
6650
|
-
const children = asChildrenOfType(import_core10.Chip, childrenProp, "Check children passed to 'ScrollableChipGroup' component.");
|
|
6651
6735
|
const theme = useRemoraidTheme();
|
|
6652
6736
|
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.ScrollArea, {
|
|
6653
|
-
|
|
6737
|
+
ref,
|
|
6738
|
+
...import_lodash7.merge({}, theme.componentsProps.ScrollArea, { style: { contain: "inline-size" } }, componentsProps?.ScrollArea),
|
|
6654
6739
|
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.Chip.Group, {
|
|
6655
6740
|
value,
|
|
6656
6741
|
onChange,
|
|
@@ -6659,7 +6744,7 @@ function ScrollableChipGroup({
|
|
|
6659
6744
|
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.Flex, {
|
|
6660
6745
|
justify: "flex-start",
|
|
6661
6746
|
align: "center",
|
|
6662
|
-
gap
|
|
6747
|
+
gap,
|
|
6663
6748
|
h: "auto",
|
|
6664
6749
|
...componentsProps?.container,
|
|
6665
6750
|
children
|
|
@@ -6669,399 +6754,128 @@ function ScrollableChipGroup({
|
|
|
6669
6754
|
}
|
|
6670
6755
|
|
|
6671
6756
|
// src/core/components/WidgetSelectionHeader/index.tsx
|
|
6672
|
-
var
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
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
|
|
6757
|
+
var import_lodash10 = __toESM(require_lodash());
|
|
6758
|
+
|
|
6759
|
+
// src/core/components/Pinnable/index.tsx
|
|
6760
|
+
var import_react13 = require("react");
|
|
6761
|
+
var import_icons_react6 = require("@tabler/icons-react");
|
|
6722
6762
|
var import_core13 = require("@mantine/core");
|
|
6723
|
-
var import_react12 = __toESM(require("react"));
|
|
6724
6763
|
|
|
6725
|
-
// src/core/components/
|
|
6726
|
-
var
|
|
6764
|
+
// src/core/components/Controls/ControlButton/index.tsx
|
|
6765
|
+
var import_core11 = require("@mantine/core");
|
|
6766
|
+
var import_icons_react4 = require("@tabler/icons-react");
|
|
6727
6767
|
var import_lodash8 = __toESM(require_lodash());
|
|
6728
|
-
var
|
|
6729
|
-
function
|
|
6730
|
-
|
|
6731
|
-
tooltip,
|
|
6768
|
+
var jsx_dev_runtime17 = require("react/jsx-dev-runtime");
|
|
6769
|
+
function ControlButton({
|
|
6770
|
+
icon: Icon3 = import_icons_react4.IconClick,
|
|
6732
6771
|
mounted = true,
|
|
6772
|
+
size = "xs",
|
|
6773
|
+
iconSize = "tiny" /* Tiny */,
|
|
6774
|
+
onClick,
|
|
6775
|
+
order,
|
|
6776
|
+
color,
|
|
6777
|
+
tooltip,
|
|
6733
6778
|
componentsProps
|
|
6734
6779
|
}) {
|
|
6735
6780
|
const theme = useRemoraidTheme();
|
|
6736
|
-
return /* @__PURE__ */
|
|
6781
|
+
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Transition, {
|
|
6737
6782
|
mounted,
|
|
6738
6783
|
transition: "fade",
|
|
6739
6784
|
duration: theme.transitionDurations.short,
|
|
6740
6785
|
timingFunction: "ease",
|
|
6741
6786
|
...componentsProps?.transition,
|
|
6742
|
-
children: (transitionStyle) => /* @__PURE__ */
|
|
6787
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Tooltip, {
|
|
6743
6788
|
...import_lodash8.merge({}, theme.componentsProps.Tooltip, { label: tooltip, disabled: !Boolean(tooltip) }, componentsProps?.tooltip),
|
|
6744
|
-
children: /* @__PURE__ */
|
|
6745
|
-
|
|
6746
|
-
|
|
6789
|
+
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.ActionIcon, {
|
|
6790
|
+
"data-control-button": true,
|
|
6791
|
+
size,
|
|
6792
|
+
color,
|
|
6793
|
+
onClick,
|
|
6794
|
+
radius: "xl",
|
|
6795
|
+
...componentsProps?.button,
|
|
6747
6796
|
style: {
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
...componentsProps?.badge?.style
|
|
6797
|
+
order,
|
|
6798
|
+
...import_lodash8.merge(transitionStyle, componentsProps?.button?.style)
|
|
6751
6799
|
},
|
|
6752
|
-
children:
|
|
6800
|
+
children: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Icon3, {
|
|
6801
|
+
...import_lodash8.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
|
|
6802
|
+
}, undefined, false, undefined, this)
|
|
6753
6803
|
}, undefined, false, undefined, this)
|
|
6754
6804
|
}, undefined, false, undefined, this)
|
|
6755
6805
|
}, undefined, false, undefined, this);
|
|
6756
6806
|
}
|
|
6757
6807
|
|
|
6758
|
-
// src/core/components/
|
|
6808
|
+
// src/core/components/Controls/index.tsx
|
|
6809
|
+
var import_react12 = require("react");
|
|
6810
|
+
var import_core12 = require("@mantine/core");
|
|
6811
|
+
var import_icons_react5 = require("@tabler/icons-react");
|
|
6759
6812
|
var import_lodash9 = __toESM(require_lodash());
|
|
6760
|
-
var
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6813
|
+
var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
|
|
6814
|
+
function Controls({
|
|
6815
|
+
groupRef,
|
|
6816
|
+
mounted = true,
|
|
6817
|
+
dragContainerRef,
|
|
6818
|
+
gutter = 5,
|
|
6819
|
+
iconSize = "tiny" /* Tiny */,
|
|
6820
|
+
additionalButtons: additionalButtonsProp,
|
|
6821
|
+
componentsProps,
|
|
6822
|
+
children: childrenProp
|
|
6767
6823
|
}) {
|
|
6768
|
-
const
|
|
6824
|
+
const additionalButtons = additionalButtonsProp?.map((additionalButton) => asElementOrPropsOfType(ControlButton, additionalButton, "Check the 'additionalButtons' property of 'Controls'."));
|
|
6825
|
+
const children = asChildrenOfType(ControlButton, childrenProp, "Check children passed to 'Controls' component.");
|
|
6769
6826
|
const theme = useRemoraidTheme();
|
|
6770
|
-
const
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6827
|
+
const [pos, setPos] = import_react12.useState({
|
|
6828
|
+
x: 0,
|
|
6829
|
+
y: 0
|
|
6830
|
+
});
|
|
6831
|
+
const offsetRef = import_react12.useRef({ x: 0, y: 0 });
|
|
6832
|
+
const containerRef = import_react12.useRef(null);
|
|
6833
|
+
const clamp = (v, min, max) => {
|
|
6834
|
+
return Math.min(Math.max(v, min), max);
|
|
6835
|
+
};
|
|
6836
|
+
const handlePointerDown = (e) => {
|
|
6837
|
+
if (e.target instanceof Element && e.target.closest("button,[data-control-button]")) {
|
|
6838
|
+
return;
|
|
6775
6839
|
}
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6840
|
+
if (!containerRef.current) {
|
|
6841
|
+
return;
|
|
6842
|
+
}
|
|
6843
|
+
const paperRect = containerRef.current.getBoundingClientRect();
|
|
6844
|
+
offsetRef.current = {
|
|
6845
|
+
x: e.clientX - paperRect.right,
|
|
6846
|
+
y: e.clientY - paperRect.top
|
|
6847
|
+
};
|
|
6848
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
6849
|
+
};
|
|
6850
|
+
const handlePointerMove = (e) => {
|
|
6851
|
+
if (!e.currentTarget.hasPointerCapture(e.pointerId)) {
|
|
6852
|
+
return;
|
|
6853
|
+
}
|
|
6854
|
+
if (!containerRef.current || !dragContainerRef.current) {
|
|
6855
|
+
return;
|
|
6856
|
+
}
|
|
6857
|
+
const boxRect = dragContainerRef.current.getBoundingClientRect();
|
|
6858
|
+
const paperRect = containerRef.current.getBoundingClientRect();
|
|
6859
|
+
const rawX = e.clientX - boxRect.right - offsetRef.current.x;
|
|
6860
|
+
const rawY = e.clientY - boxRect.top - offsetRef.current.y;
|
|
6861
|
+
const maxX = boxRect.width - paperRect.width;
|
|
6862
|
+
const maxY = boxRect.height - paperRect.height;
|
|
6863
|
+
setPos({
|
|
6864
|
+
x: clamp(-rawX, 0, maxX),
|
|
6865
|
+
y: clamp(rawY, 0, maxY)
|
|
6779
6866
|
});
|
|
6780
|
-
}
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
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, {
|
|
6867
|
+
};
|
|
6868
|
+
const handlePointerUp = (e) => {
|
|
6869
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
6870
|
+
};
|
|
6871
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Transition, {
|
|
6850
6872
|
mounted,
|
|
6851
|
-
|
|
6873
|
+
keepMounted: true,
|
|
6874
|
+
transition: "pop",
|
|
6852
6875
|
duration: theme.transitionDurations.short,
|
|
6853
6876
|
timingFunction: "ease",
|
|
6854
6877
|
...componentsProps?.transition,
|
|
6855
|
-
children: (transitionStyle) => /* @__PURE__ */
|
|
6856
|
-
title,
|
|
6857
|
-
color,
|
|
6858
|
-
variant: "light",
|
|
6859
|
-
onClose,
|
|
6860
|
-
withCloseButton: onClose !== undefined,
|
|
6861
|
-
icon: Icon2 ? /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Icon2, {
|
|
6862
|
-
...import_lodash10.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
|
|
6863
|
-
}, undefined, false, undefined, this) : undefined,
|
|
6864
|
-
style: import_lodash10.merge(transitionStyle, componentsProps?.alert?.style),
|
|
6865
|
-
children: [
|
|
6866
|
-
text,
|
|
6867
|
-
children
|
|
6868
|
-
]
|
|
6869
|
-
}, 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");
|
|
6877
|
-
function RemoraidButton({
|
|
6878
|
-
label,
|
|
6879
|
-
responsive: ResponsiveProp,
|
|
6880
|
-
breakpoint: breakpointProp,
|
|
6881
|
-
collapsed: collapsedProp,
|
|
6882
|
-
size = "sm",
|
|
6883
|
-
color,
|
|
6884
|
-
onClick,
|
|
6885
|
-
loading,
|
|
6886
|
-
variant = "default",
|
|
6887
|
-
mounted = true,
|
|
6888
|
-
icon: iconProp,
|
|
6889
|
-
iconSize: iconSizeProp,
|
|
6890
|
-
componentsProps
|
|
6891
|
-
}) {
|
|
6892
|
-
const responsive = ResponsiveProp ?? true;
|
|
6893
|
-
const breakpoint = breakpointProp ?? "md";
|
|
6894
|
-
const collapsed = collapsedProp ?? false;
|
|
6895
|
-
const iconSize = iconSizeProp ?? getDefaultButtonIconSize(size);
|
|
6896
|
-
const Icon3 = iconProp ?? import_icons_react5.IconClick;
|
|
6897
|
-
const theme = useRemoraidTheme();
|
|
6898
|
-
const iconElement = /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Icon3, {
|
|
6899
|
-
...import_lodash11.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
|
|
6900
|
-
}, undefined, false, undefined, this);
|
|
6901
|
-
return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Transition, {
|
|
6902
|
-
mounted,
|
|
6903
|
-
transition: "fade",
|
|
6904
|
-
duration: theme.transitionDurations.short,
|
|
6905
|
-
timingFunction: "ease",
|
|
6906
|
-
...componentsProps?.transition,
|
|
6907
|
-
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
|
|
6908
|
-
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, {
|
|
6912
|
-
"aria-label": label,
|
|
6913
|
-
variant,
|
|
6914
|
-
onClick,
|
|
6915
|
-
loading,
|
|
6916
|
-
size: size ? `input-${size}` : "input-sm",
|
|
6917
|
-
color,
|
|
6918
|
-
...componentsProps?.button,
|
|
6919
|
-
...componentsProps?.ActionIcon,
|
|
6920
|
-
hiddenFrom: !responsive ? undefined : breakpoint,
|
|
6921
|
-
display: !responsive && !collapsed ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
|
|
6922
|
-
style: {
|
|
6923
|
-
...transitionStyle,
|
|
6924
|
-
...componentsProps?.ActionIcon?.style ?? componentsProps?.button?.style
|
|
6925
|
-
},
|
|
6926
|
-
children: iconElement
|
|
6927
|
-
}, undefined, false, undefined, this)
|
|
6928
|
-
}, undefined, false, undefined, this),
|
|
6929
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Button, {
|
|
6930
|
-
onClick,
|
|
6931
|
-
loading,
|
|
6932
|
-
variant,
|
|
6933
|
-
size,
|
|
6934
|
-
color,
|
|
6935
|
-
leftSection: iconProp ? iconElement : undefined,
|
|
6936
|
-
...componentsProps?.button,
|
|
6937
|
-
...componentsProps?.Button,
|
|
6938
|
-
visibleFrom: !responsive ? undefined : breakpoint,
|
|
6939
|
-
display: !responsive && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
|
|
6940
|
-
style: {
|
|
6941
|
-
...transitionStyle,
|
|
6942
|
-
...componentsProps?.Button?.style ?? componentsProps?.button?.style
|
|
6943
|
-
},
|
|
6944
|
-
children: label
|
|
6945
|
-
}, undefined, false, undefined, this)
|
|
6946
|
-
]
|
|
6947
|
-
}, undefined, true, undefined, this)
|
|
6948
|
-
}, undefined, false, undefined, this);
|
|
6949
|
-
}
|
|
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, {
|
|
6878
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Paper, {
|
|
7065
6879
|
ref: containerRef,
|
|
7066
6880
|
pos: "absolute",
|
|
7067
6881
|
p: gutter,
|
|
@@ -7074,25 +6888,25 @@ function Controls({
|
|
|
7074
6888
|
style: {
|
|
7075
6889
|
right: pos.x,
|
|
7076
6890
|
top: pos.y,
|
|
7077
|
-
...
|
|
6891
|
+
...import_lodash9.merge(transitionStyle, componentsProps?.container?.style)
|
|
7078
6892
|
},
|
|
7079
6893
|
className: clsx_default("remoraid-controls", componentsProps?.container?.className),
|
|
7080
|
-
children: /* @__PURE__ */
|
|
6894
|
+
children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Group, {
|
|
7081
6895
|
gap: gutter,
|
|
7082
6896
|
ref: groupRef,
|
|
7083
6897
|
wrap: "nowrap",
|
|
7084
6898
|
...componentsProps?.group,
|
|
7085
6899
|
className: clsx_default("remoraid-controls-group", componentsProps?.group?.className),
|
|
7086
6900
|
children: [
|
|
7087
|
-
/* @__PURE__ */
|
|
7088
|
-
...
|
|
6901
|
+
/* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_icons_react5.IconGripHorizontal, {
|
|
6902
|
+
...import_lodash9.merge({}, theme.componentsProps.icons[iconSize], { order: -100, color: "var(--mantine-color-default-border)" }, componentsProps?.gripIcon)
|
|
7089
6903
|
}, undefined, false, undefined, this),
|
|
7090
6904
|
children,
|
|
7091
6905
|
additionalButtons && additionalButtons.map((button, i) => {
|
|
7092
6906
|
if (isValidElementOfType(ControlButton, button)) {
|
|
7093
6907
|
return button;
|
|
7094
6908
|
}
|
|
7095
|
-
return /* @__PURE__ */
|
|
6909
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(ControlButton, {
|
|
7096
6910
|
...button
|
|
7097
6911
|
}, i, false, undefined, this);
|
|
7098
6912
|
})
|
|
@@ -7101,16 +6915,9 @@ function Controls({
|
|
|
7101
6915
|
}, undefined, false, undefined, this)
|
|
7102
6916
|
}, undefined, false, undefined, this);
|
|
7103
6917
|
}
|
|
7104
|
-
// src/core/components/Widget/WidgetWrapper/index.tsx
|
|
7105
|
-
var import_core19 = require("@mantine/core");
|
|
7106
|
-
var import_react15 = require("react");
|
|
7107
|
-
var import_icons_react9 = require("@tabler/icons-react");
|
|
7108
6918
|
|
|
7109
6919
|
// src/core/components/Pinnable/index.tsx
|
|
7110
|
-
var
|
|
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");
|
|
6920
|
+
var jsx_dev_runtime19 = require("react/jsx-dev-runtime");
|
|
7114
6921
|
function Pinnable({
|
|
7115
6922
|
layoutType: layoutTypeProp,
|
|
7116
6923
|
section,
|
|
@@ -7123,14 +6930,14 @@ function Pinnable({
|
|
|
7123
6930
|
}) {
|
|
7124
6931
|
const layoutType = layoutTypeProp ?? "frame" /* Frame */;
|
|
7125
6932
|
const { layouts } = useLayouts();
|
|
7126
|
-
const [pinned, setPinned] =
|
|
7127
|
-
const containerRef =
|
|
6933
|
+
const [pinned, setPinned] = import_react13.useState(initialValue);
|
|
6934
|
+
const containerRef = import_react13.useRef(null);
|
|
7128
6935
|
const layout = layouts[layoutId ?? remoraidAppShellLayoutId];
|
|
7129
6936
|
if (layout && layout.type !== layoutType) {
|
|
7130
6937
|
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
6938
|
}
|
|
7132
|
-
const controlButton =
|
|
7133
|
-
icon: pinned ?
|
|
6939
|
+
const controlButton = import_react13.useMemo(() => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(ControlButton, {
|
|
6940
|
+
icon: pinned ? import_icons_react6.IconPinnedOff : import_icons_react6.IconPin,
|
|
7134
6941
|
tooltip: pinned ? "Unpin" : "Pin",
|
|
7135
6942
|
color: "green",
|
|
7136
6943
|
order: 100,
|
|
@@ -7140,18 +6947,18 @@ function Pinnable({
|
|
|
7140
6947
|
componentsProps?.button?.onClick?.(e);
|
|
7141
6948
|
}
|
|
7142
6949
|
}, undefined, false, undefined, this), [pinned, componentsProps?.button]);
|
|
7143
|
-
const element = /* @__PURE__ */
|
|
6950
|
+
const element = /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Box, {
|
|
7144
6951
|
pos: "relative",
|
|
7145
6952
|
ref: containerRef,
|
|
7146
6953
|
"data-hidden": hidden,
|
|
7147
6954
|
...componentsProps?.container,
|
|
7148
6955
|
className: clsx_default("remoraid-pinnable", componentsProps?.container?.className),
|
|
7149
6956
|
children: [
|
|
7150
|
-
controlsContainer === undefined ? /* @__PURE__ */
|
|
6957
|
+
controlsContainer === undefined ? /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(Controls, {
|
|
7151
6958
|
dragContainerRef: containerRef,
|
|
7152
6959
|
...componentsProps?.controls,
|
|
7153
6960
|
children: controlButton
|
|
7154
|
-
}, undefined, false, undefined, this) : controlsContainer !== null && /* @__PURE__ */
|
|
6961
|
+
}, undefined, false, undefined, this) : controlsContainer !== null && /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Portal, {
|
|
7155
6962
|
target: controlsContainer,
|
|
7156
6963
|
children: controlButton
|
|
7157
6964
|
}, undefined, false, undefined, this),
|
|
@@ -7162,7 +6969,7 @@ function Pinnable({
|
|
|
7162
6969
|
return null;
|
|
7163
6970
|
}
|
|
7164
6971
|
if (pinned && layoutType === "frame" /* Frame */) {
|
|
7165
|
-
return /* @__PURE__ */
|
|
6972
|
+
return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(FrameLayout_default.Element, {
|
|
7166
6973
|
layoutId,
|
|
7167
6974
|
section,
|
|
7168
6975
|
hidden,
|
|
@@ -7173,8 +6980,425 @@ function Pinnable({
|
|
|
7173
6980
|
return element;
|
|
7174
6981
|
}
|
|
7175
6982
|
|
|
7176
|
-
// src/core/components/
|
|
6983
|
+
// src/core/components/WidgetSelectionHeader/index.tsx
|
|
6984
|
+
var jsx_dev_runtime20 = require("react/jsx-dev-runtime");
|
|
6985
|
+
function WidgetSelectionHeader({
|
|
6986
|
+
title,
|
|
6987
|
+
pinnableSection = "top" /* Top */,
|
|
6988
|
+
initiallyPinned = true,
|
|
6989
|
+
disabledWidgets,
|
|
6990
|
+
componentsProps
|
|
6991
|
+
}) {
|
|
6992
|
+
const theme = useRemoraidTheme();
|
|
6993
|
+
const mantineTheme = import_core14.useMantineTheme();
|
|
6994
|
+
const {
|
|
6995
|
+
activeWidget,
|
|
6996
|
+
isPageRegistered,
|
|
6997
|
+
updateWidgetSelectionBulk,
|
|
6998
|
+
...widgetsContext2
|
|
6999
|
+
} = useWidgets();
|
|
7000
|
+
const page = usePage();
|
|
7001
|
+
if (!page) {
|
|
7002
|
+
throw new InvalidComponentUsageError("WidgetSelectionHeader", "must be used as child of 'Page'.");
|
|
7003
|
+
}
|
|
7004
|
+
const [hover, setHover] = import_react14.useState(false);
|
|
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.Label, {
|
|
7082
|
+
children: "Widget menu"
|
|
7083
|
+
}, undefined, false, undefined, this),
|
|
7084
|
+
/* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Menu.Item, {
|
|
7085
|
+
leftSection: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_icons_react7.IconNavigation, {
|
|
7086
|
+
...theme.componentsProps.icons.small
|
|
7087
|
+
}, undefined, false, undefined, this),
|
|
7088
|
+
onClick: () => {
|
|
7089
|
+
scrollToWidget(widgetId);
|
|
7090
|
+
handleLeave();
|
|
7091
|
+
},
|
|
7092
|
+
disabled: !widget.selected,
|
|
7093
|
+
children: "Scroll to widget"
|
|
7094
|
+
}, undefined, false, undefined, this),
|
|
7095
|
+
/* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Menu.Item, {
|
|
7096
|
+
leftSection: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_icons_react7.IconFocus, {
|
|
7097
|
+
...theme.componentsProps.icons.small
|
|
7098
|
+
}, undefined, false, undefined, this),
|
|
7099
|
+
onClick: () => {
|
|
7100
|
+
updateWidgetSelectionBulk(page.pageId, [widgetId]);
|
|
7101
|
+
handleLeave();
|
|
7102
|
+
},
|
|
7103
|
+
disabled: selectedWidgets.length === 1 && selectedWidgets.includes(widgetId),
|
|
7104
|
+
children: "Isolate widget"
|
|
7105
|
+
}, undefined, false, undefined, this)
|
|
7106
|
+
]
|
|
7107
|
+
}, undefined, true, undefined, this)
|
|
7108
|
+
]
|
|
7109
|
+
}, widgetId, true, undefined, this);
|
|
7110
|
+
})
|
|
7111
|
+
}, undefined, false, undefined, this)
|
|
7112
|
+
]
|
|
7113
|
+
}, undefined, true, undefined, this);
|
|
7114
|
+
import_react14.useEffect(() => {
|
|
7115
|
+
if (!activeWidget) {
|
|
7116
|
+
return;
|
|
7117
|
+
}
|
|
7118
|
+
const activeWidgetChipElement = scrollAreaRef?.current?.querySelector(`#remoraid-widget-selection-header-chip-${activeWidget}`);
|
|
7119
|
+
if (!activeWidgetChipElement) {
|
|
7120
|
+
return;
|
|
7121
|
+
}
|
|
7122
|
+
activeWidgetChipElement.scrollIntoView({
|
|
7123
|
+
behavior: "smooth",
|
|
7124
|
+
inline: "center"
|
|
7125
|
+
});
|
|
7126
|
+
}, [activeWidget]);
|
|
7127
|
+
if (pinnableSection) {
|
|
7128
|
+
return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Pinnable, {
|
|
7129
|
+
section: pinnableSection,
|
|
7130
|
+
initialValue: initiallyPinned,
|
|
7131
|
+
...componentsProps?.Pinnable,
|
|
7132
|
+
componentsProps: {
|
|
7133
|
+
...componentsProps?.Pinnable?.componentsProps,
|
|
7134
|
+
container: {
|
|
7135
|
+
...componentsProps?.Pinnable?.componentsProps?.container,
|
|
7136
|
+
onMouseEnter: (e) => {
|
|
7137
|
+
handleEnter();
|
|
7138
|
+
componentsProps?.Pinnable?.componentsProps?.container?.onMouseEnter?.(e);
|
|
7139
|
+
},
|
|
7140
|
+
onMouseLeave: (e) => {
|
|
7141
|
+
handleLeave();
|
|
7142
|
+
componentsProps?.Pinnable?.componentsProps?.container?.onMouseLeave?.(e);
|
|
7143
|
+
},
|
|
7144
|
+
className: clsx_default("remoraid-segment", "remoraid-non-widget-segment", componentsProps?.Pinnable?.componentsProps?.container?.className)
|
|
7145
|
+
},
|
|
7146
|
+
button: {
|
|
7147
|
+
...componentsProps?.Pinnable?.componentsProps?.button,
|
|
7148
|
+
onClick: (e) => {
|
|
7149
|
+
handleLeave();
|
|
7150
|
+
componentsProps?.Pinnable?.componentsProps?.button?.onClick?.(e);
|
|
7151
|
+
}
|
|
7152
|
+
},
|
|
7153
|
+
layoutElement: {
|
|
7154
|
+
includeContainer: false,
|
|
7155
|
+
includePageContainer: pinnableSection === "top" /* Top */ || pinnableSection === "bottom" /* Bottom */,
|
|
7156
|
+
...componentsProps?.Pinnable?.componentsProps?.layoutElement
|
|
7157
|
+
},
|
|
7158
|
+
controls: {
|
|
7159
|
+
mounted: hover,
|
|
7160
|
+
...componentsProps?.Pinnable?.componentsProps?.controls
|
|
7161
|
+
}
|
|
7162
|
+
},
|
|
7163
|
+
children: element
|
|
7164
|
+
}, undefined, false, undefined, this);
|
|
7165
|
+
}
|
|
7166
|
+
return element;
|
|
7167
|
+
}
|
|
7168
|
+
// src/core/components/BadgeGroup/index.tsx
|
|
7169
|
+
var import_core16 = require("@mantine/core");
|
|
7170
|
+
var import_react15 = __toESM(require("react"));
|
|
7171
|
+
|
|
7172
|
+
// src/core/components/BadgeMinimal/index.tsx
|
|
7173
|
+
var import_core15 = require("@mantine/core");
|
|
7174
|
+
var import_lodash11 = __toESM(require_lodash());
|
|
7175
|
+
var jsx_dev_runtime21 = require("react/jsx-dev-runtime");
|
|
7176
|
+
function BadgeMinimal({
|
|
7177
|
+
label,
|
|
7178
|
+
tooltip,
|
|
7179
|
+
mounted = true,
|
|
7180
|
+
componentsProps
|
|
7181
|
+
}) {
|
|
7182
|
+
const theme = useRemoraidTheme();
|
|
7183
|
+
return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Transition, {
|
|
7184
|
+
mounted,
|
|
7185
|
+
transition: "fade",
|
|
7186
|
+
duration: theme.transitionDurations.short,
|
|
7187
|
+
timingFunction: "ease",
|
|
7188
|
+
...componentsProps?.transition,
|
|
7189
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Tooltip, {
|
|
7190
|
+
...import_lodash11.merge({}, theme.componentsProps.Tooltip, { label: tooltip, disabled: !Boolean(tooltip) }, componentsProps?.tooltip),
|
|
7191
|
+
children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Badge, {
|
|
7192
|
+
variant: "default",
|
|
7193
|
+
...componentsProps?.badge,
|
|
7194
|
+
style: {
|
|
7195
|
+
...transitionStyle,
|
|
7196
|
+
cursor: "pointer",
|
|
7197
|
+
...componentsProps?.badge?.style
|
|
7198
|
+
},
|
|
7199
|
+
children: label
|
|
7200
|
+
}, undefined, false, undefined, this)
|
|
7201
|
+
}, undefined, false, undefined, this)
|
|
7202
|
+
}, undefined, false, undefined, this);
|
|
7203
|
+
}
|
|
7204
|
+
|
|
7205
|
+
// src/core/components/BadgeGroup/index.tsx
|
|
7206
|
+
var import_lodash12 = __toESM(require_lodash());
|
|
7207
|
+
var jsx_dev_runtime22 = require("react/jsx-dev-runtime");
|
|
7208
|
+
var react = require("react");
|
|
7209
|
+
function BadgeGroup({
|
|
7210
|
+
badges: badgesProp,
|
|
7211
|
+
gap = "xs",
|
|
7212
|
+
breakpoint: breakpointProp,
|
|
7213
|
+
componentsProps
|
|
7214
|
+
}) {
|
|
7215
|
+
const badges = badgesProp.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check 'badges' property passed to 'BadgeGroup'."));
|
|
7216
|
+
const theme = useRemoraidTheme();
|
|
7217
|
+
const breakpoint = breakpointProp ?? theme.breakpoints.badgeGroupCollapse;
|
|
7218
|
+
const numVisibleBadges = badges.filter((badge) => isValidElementOfType(BadgeMinimal, badge) ? badge.props.mounted : badge.mounted !== false).length;
|
|
7219
|
+
const badgesElement = badges.map((badge, i) => {
|
|
7220
|
+
if (isValidElementOfType(BadgeMinimal, badge)) {
|
|
7221
|
+
return badge;
|
|
7222
|
+
}
|
|
7223
|
+
return /* @__PURE__ */ react.createElement(BadgeMinimal, {
|
|
7224
|
+
...badge,
|
|
7225
|
+
key: i
|
|
7226
|
+
});
|
|
7227
|
+
});
|
|
7228
|
+
return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
|
|
7229
|
+
children: [
|
|
7230
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Group, {
|
|
7231
|
+
gap,
|
|
7232
|
+
wrap: "nowrap",
|
|
7233
|
+
visibleFrom: numVisibleBadges > 1 ? breakpoint : undefined,
|
|
7234
|
+
...componentsProps?.container,
|
|
7235
|
+
className: clsx_default("remoraid-badge-group", componentsProps?.container?.className),
|
|
7236
|
+
children: badgesElement
|
|
7237
|
+
}, undefined, false, undefined, this),
|
|
7238
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Transition, {
|
|
7239
|
+
mounted: numVisibleBadges > 1,
|
|
7240
|
+
transition: "fade",
|
|
7241
|
+
duration: theme.transitionDurations.short,
|
|
7242
|
+
timingFunction: "ease",
|
|
7243
|
+
...componentsProps?.cumulativeBadgeTransition,
|
|
7244
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.HoverCard, {
|
|
7245
|
+
...import_lodash12.merge({}, theme.componentsProps.HoverCard, componentsProps?.HoverCard),
|
|
7246
|
+
children: [
|
|
7247
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.HoverCard.Target, {
|
|
7248
|
+
children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Badge, {
|
|
7249
|
+
hiddenFrom: breakpoint,
|
|
7250
|
+
variant: "dot",
|
|
7251
|
+
...componentsProps?.cumulativeBadge,
|
|
7252
|
+
style: {
|
|
7253
|
+
cursor: "pointer",
|
|
7254
|
+
...import_lodash12.merge(transitionStyle, componentsProps?.cumulativeBadge?.style)
|
|
7255
|
+
},
|
|
7256
|
+
children: [
|
|
7257
|
+
numVisibleBadges,
|
|
7258
|
+
" badges"
|
|
7259
|
+
]
|
|
7260
|
+
}, undefined, true, undefined, this)
|
|
7261
|
+
}, undefined, false, undefined, this),
|
|
7262
|
+
/* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.HoverCard.Dropdown, {
|
|
7263
|
+
p: gap,
|
|
7264
|
+
children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Stack, {
|
|
7265
|
+
gap,
|
|
7266
|
+
...componentsProps?.hoverContainer,
|
|
7267
|
+
children: badgesElement
|
|
7268
|
+
}, undefined, false, undefined, this)
|
|
7269
|
+
}, undefined, false, undefined, this)
|
|
7270
|
+
]
|
|
7271
|
+
}, undefined, true, undefined, this)
|
|
7272
|
+
}, undefined, false, undefined, this)
|
|
7273
|
+
]
|
|
7274
|
+
}, undefined, true, undefined, this);
|
|
7275
|
+
}
|
|
7276
|
+
// src/core/components/AlertMinimal/index.tsx
|
|
7277
|
+
var import_core17 = require("@mantine/core");
|
|
7278
|
+
var import_lodash13 = __toESM(require_lodash());
|
|
7279
|
+
var jsx_dev_runtime23 = require("react/jsx-dev-runtime");
|
|
7280
|
+
function AlertMinimal({
|
|
7281
|
+
category,
|
|
7282
|
+
children,
|
|
7283
|
+
...props
|
|
7284
|
+
}) {
|
|
7285
|
+
const theme = useRemoraidTheme();
|
|
7286
|
+
const {
|
|
7287
|
+
title,
|
|
7288
|
+
text,
|
|
7289
|
+
color,
|
|
7290
|
+
onClose,
|
|
7291
|
+
mounted = true,
|
|
7292
|
+
icon: Icon3,
|
|
7293
|
+
iconSize = "medium" /* Medium */,
|
|
7294
|
+
componentsProps
|
|
7295
|
+
} = import_lodash13.merge({}, theme.componentsProps.alerts[category], props);
|
|
7296
|
+
return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Transition, {
|
|
7297
|
+
mounted,
|
|
7298
|
+
transition: "fade",
|
|
7299
|
+
duration: theme.transitionDurations.short,
|
|
7300
|
+
timingFunction: "ease",
|
|
7301
|
+
...componentsProps?.transition,
|
|
7302
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Alert, {
|
|
7303
|
+
title,
|
|
7304
|
+
color,
|
|
7305
|
+
variant: "light",
|
|
7306
|
+
onClose,
|
|
7307
|
+
withCloseButton: onClose !== undefined,
|
|
7308
|
+
icon: Icon3 ? /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(Icon3, {
|
|
7309
|
+
...import_lodash13.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
|
|
7310
|
+
}, undefined, false, undefined, this) : undefined,
|
|
7311
|
+
style: import_lodash13.merge(transitionStyle, componentsProps?.alert?.style),
|
|
7312
|
+
children: [
|
|
7313
|
+
text,
|
|
7314
|
+
children
|
|
7315
|
+
]
|
|
7316
|
+
}, undefined, true, undefined, this)
|
|
7317
|
+
}, undefined, false, undefined, this);
|
|
7318
|
+
}
|
|
7319
|
+
// src/core/components/RemoraidButton/index.tsx
|
|
7320
|
+
var import_core18 = require("@mantine/core");
|
|
7321
|
+
var import_icons_react8 = require("@tabler/icons-react");
|
|
7177
7322
|
var import_lodash14 = __toESM(require_lodash());
|
|
7323
|
+
var jsx_dev_runtime24 = require("react/jsx-dev-runtime");
|
|
7324
|
+
function RemoraidButton({
|
|
7325
|
+
label,
|
|
7326
|
+
responsive: ResponsiveProp,
|
|
7327
|
+
breakpoint: breakpointProp,
|
|
7328
|
+
collapsed: collapsedProp,
|
|
7329
|
+
size = "sm",
|
|
7330
|
+
color,
|
|
7331
|
+
onClick,
|
|
7332
|
+
loading,
|
|
7333
|
+
variant = "default",
|
|
7334
|
+
mounted = true,
|
|
7335
|
+
icon: iconProp,
|
|
7336
|
+
iconSize: iconSizeProp,
|
|
7337
|
+
componentsProps
|
|
7338
|
+
}) {
|
|
7339
|
+
const responsive = ResponsiveProp ?? true;
|
|
7340
|
+
const breakpoint = breakpointProp ?? "md";
|
|
7341
|
+
const collapsed = collapsedProp ?? false;
|
|
7342
|
+
const iconSize = iconSizeProp ?? getDefaultButtonIconSize(size);
|
|
7343
|
+
const Icon4 = iconProp ?? import_icons_react8.IconClick;
|
|
7344
|
+
const theme = useRemoraidTheme();
|
|
7345
|
+
const iconElement = /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Icon4, {
|
|
7346
|
+
...import_lodash14.merge({}, theme.componentsProps.icons[iconSize], componentsProps?.icon)
|
|
7347
|
+
}, undefined, false, undefined, this);
|
|
7348
|
+
return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Transition, {
|
|
7349
|
+
mounted,
|
|
7350
|
+
transition: "fade",
|
|
7351
|
+
duration: theme.transitionDurations.short,
|
|
7352
|
+
timingFunction: "ease",
|
|
7353
|
+
...componentsProps?.transition,
|
|
7354
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
|
|
7355
|
+
children: [
|
|
7356
|
+
/* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Tooltip, {
|
|
7357
|
+
...import_lodash14.merge({}, theme.componentsProps.Tooltip, { label }, componentsProps?.tooltip),
|
|
7358
|
+
children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.ActionIcon, {
|
|
7359
|
+
"aria-label": label,
|
|
7360
|
+
variant,
|
|
7361
|
+
onClick,
|
|
7362
|
+
loading,
|
|
7363
|
+
size: size ? `input-${size}` : "input-sm",
|
|
7364
|
+
color,
|
|
7365
|
+
...componentsProps?.button,
|
|
7366
|
+
...componentsProps?.ActionIcon,
|
|
7367
|
+
hiddenFrom: !responsive ? undefined : breakpoint,
|
|
7368
|
+
display: !responsive && !collapsed ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
|
|
7369
|
+
style: {
|
|
7370
|
+
...transitionStyle,
|
|
7371
|
+
...componentsProps?.ActionIcon?.style ?? componentsProps?.button?.style
|
|
7372
|
+
},
|
|
7373
|
+
children: iconElement
|
|
7374
|
+
}, undefined, false, undefined, this)
|
|
7375
|
+
}, undefined, false, undefined, this),
|
|
7376
|
+
/* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Button, {
|
|
7377
|
+
onClick,
|
|
7378
|
+
loading,
|
|
7379
|
+
variant,
|
|
7380
|
+
size,
|
|
7381
|
+
color,
|
|
7382
|
+
leftSection: iconProp ? iconElement : undefined,
|
|
7383
|
+
...componentsProps?.button,
|
|
7384
|
+
...componentsProps?.Button,
|
|
7385
|
+
visibleFrom: !responsive ? undefined : breakpoint,
|
|
7386
|
+
display: !responsive && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
|
|
7387
|
+
style: {
|
|
7388
|
+
...transitionStyle,
|
|
7389
|
+
...componentsProps?.Button?.style ?? componentsProps?.button?.style
|
|
7390
|
+
},
|
|
7391
|
+
children: label
|
|
7392
|
+
}, undefined, false, undefined, this)
|
|
7393
|
+
]
|
|
7394
|
+
}, undefined, true, undefined, this)
|
|
7395
|
+
}, undefined, false, undefined, this);
|
|
7396
|
+
}
|
|
7397
|
+
// src/core/components/Widget/WidgetWrapper/index.tsx
|
|
7398
|
+
var import_core19 = require("@mantine/core");
|
|
7399
|
+
var import_react16 = require("react");
|
|
7400
|
+
var import_icons_react9 = require("@tabler/icons-react");
|
|
7401
|
+
var import_lodash15 = __toESM(require_lodash());
|
|
7178
7402
|
var jsx_dev_runtime25 = require("react/jsx-dev-runtime");
|
|
7179
7403
|
function WidgetWrapper({
|
|
7180
7404
|
config,
|
|
@@ -7185,7 +7409,8 @@ function WidgetWrapper({
|
|
|
7185
7409
|
children
|
|
7186
7410
|
}) {
|
|
7187
7411
|
const {
|
|
7188
|
-
|
|
7412
|
+
widgets,
|
|
7413
|
+
hideWidget,
|
|
7189
7414
|
isPageRegistered,
|
|
7190
7415
|
isWidgetRegistered,
|
|
7191
7416
|
registerWidget,
|
|
@@ -7195,12 +7420,11 @@ function WidgetWrapper({
|
|
|
7195
7420
|
} = useWidgets();
|
|
7196
7421
|
const page = usePage();
|
|
7197
7422
|
const theme = useRemoraidTheme();
|
|
7198
|
-
const
|
|
7199
|
-
const [
|
|
7200
|
-
const [hidden, setHidden] = import_react15.useState(!mounted);
|
|
7423
|
+
const [controlsContainer, setControlsContainer] = import_react16.useState(null);
|
|
7424
|
+
const widget = page ? widgets[page.pageId]?.[config.widgetId] : undefined;
|
|
7201
7425
|
const pageRegistered = page ? isPageRegistered(page.pageId) : false;
|
|
7202
|
-
const containerRef =
|
|
7203
|
-
const controlsContainerRef =
|
|
7426
|
+
const containerRef = import_react16.useRef(null);
|
|
7427
|
+
const controlsContainerRef = import_react16.useCallback((n) => {
|
|
7204
7428
|
setControlsContainer(n);
|
|
7205
7429
|
}, [setControlsContainer]);
|
|
7206
7430
|
const handleEnter = () => {
|
|
@@ -7210,13 +7434,15 @@ function WidgetWrapper({
|
|
|
7210
7434
|
updateActiveWidget(null);
|
|
7211
7435
|
};
|
|
7212
7436
|
let element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core19.Transition, {
|
|
7213
|
-
mounted,
|
|
7437
|
+
mounted: Boolean(widget?.selected),
|
|
7214
7438
|
transition: "fade-left",
|
|
7215
7439
|
duration: theme.transitionDurations.medium,
|
|
7216
7440
|
timingFunction: "ease",
|
|
7217
7441
|
...componentsProps?.transition,
|
|
7218
7442
|
onExited: () => {
|
|
7219
|
-
|
|
7443
|
+
if (page) {
|
|
7444
|
+
hideWidget(page.pageId, config.widgetId);
|
|
7445
|
+
}
|
|
7220
7446
|
componentsProps?.transition?.onExited?.();
|
|
7221
7447
|
},
|
|
7222
7448
|
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core19.Paper, {
|
|
@@ -7240,7 +7466,8 @@ function WidgetWrapper({
|
|
|
7240
7466
|
}
|
|
7241
7467
|
componentsProps?.container?.onMouseLeave?.(e);
|
|
7242
7468
|
},
|
|
7243
|
-
style:
|
|
7469
|
+
style: import_lodash15.merge(transitionStyle, componentsProps?.container?.style),
|
|
7470
|
+
className: clsx_default("remoraid-segment", componentsProps?.container?.className),
|
|
7244
7471
|
id: config.widgetId,
|
|
7245
7472
|
children: [
|
|
7246
7473
|
/* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Controls, {
|
|
@@ -7273,7 +7500,7 @@ function WidgetWrapper({
|
|
|
7273
7500
|
element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Pinnable, {
|
|
7274
7501
|
section: pinnableSection,
|
|
7275
7502
|
controlsContainer,
|
|
7276
|
-
hidden,
|
|
7503
|
+
hidden: Boolean(widget?.hidden),
|
|
7277
7504
|
...componentsProps?.Pinnable,
|
|
7278
7505
|
componentsProps: {
|
|
7279
7506
|
...componentsProps?.Pinnable?.componentsProps,
|
|
@@ -7304,7 +7531,7 @@ function WidgetWrapper({
|
|
|
7304
7531
|
children: element
|
|
7305
7532
|
}, undefined, false, undefined, this);
|
|
7306
7533
|
}
|
|
7307
|
-
|
|
7534
|
+
import_react16.useEffect(() => {
|
|
7308
7535
|
if (!page) {
|
|
7309
7536
|
return;
|
|
7310
7537
|
}
|
|
@@ -7312,16 +7539,6 @@ function WidgetWrapper({
|
|
|
7312
7539
|
registerWidget(page.pageId, config);
|
|
7313
7540
|
}
|
|
7314
7541
|
}, [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
7542
|
return element;
|
|
7326
7543
|
}
|
|
7327
7544
|
// src/core/components/Widget/index.tsx
|
|
@@ -7492,7 +7709,7 @@ function EnvironmentShell({
|
|
|
7492
7709
|
return null;
|
|
7493
7710
|
}
|
|
7494
7711
|
// src/core/components/SettingsWidget/index.tsx
|
|
7495
|
-
var
|
|
7712
|
+
var import_react17 = require("react");
|
|
7496
7713
|
var import_icons_react11 = require("@tabler/icons-react");
|
|
7497
7714
|
|
|
7498
7715
|
// src/core/components/SettingsWidget/SaveButton/index.tsx
|
|
@@ -7534,9 +7751,9 @@ function SaveButton({
|
|
|
7534
7751
|
// src/core/components/SettingsWidget/index.tsx
|
|
7535
7752
|
var jsx_dev_runtime30 = require("react/jsx-dev-runtime");
|
|
7536
7753
|
var defaultSettingsWidgetContext = {};
|
|
7537
|
-
var settingsWidgetContext =
|
|
7754
|
+
var settingsWidgetContext = import_react17.createContext(defaultSettingsWidgetContext);
|
|
7538
7755
|
var useSettingsWidgetContext = () => {
|
|
7539
|
-
return
|
|
7756
|
+
return import_react17.useContext(settingsWidgetContext);
|
|
7540
7757
|
};
|
|
7541
7758
|
function SettingsWidget({
|
|
7542
7759
|
children,
|
|
@@ -7582,7 +7799,7 @@ var SettingsWidget_default = Object.assign(SettingsWidget, {
|
|
|
7582
7799
|
SaveButton
|
|
7583
7800
|
});
|
|
7584
7801
|
// src/core/components/SettingsWidget/SettingsTable/index.tsx
|
|
7585
|
-
var
|
|
7802
|
+
var import_react18 = require("react");
|
|
7586
7803
|
var import_core23 = require("@mantine/core");
|
|
7587
7804
|
|
|
7588
7805
|
// src/core/components/SettingsWidget/SettingsTable/Row/index.tsx
|
|
@@ -7615,9 +7832,9 @@ var jsx_dev_runtime32 = require("react/jsx-dev-runtime");
|
|
|
7615
7832
|
var defaultSettingsTableOptions = {
|
|
7616
7833
|
leftColumnWidth: "38.2%"
|
|
7617
7834
|
};
|
|
7618
|
-
var settingsTableOptionsContext =
|
|
7835
|
+
var settingsTableOptionsContext = import_react18.createContext(defaultSettingsTableOptions);
|
|
7619
7836
|
var useSettingsTableOptions = () => {
|
|
7620
|
-
return
|
|
7837
|
+
return import_react18.useContext(settingsTableOptionsContext);
|
|
7621
7838
|
};
|
|
7622
7839
|
function SettingsTable({
|
|
7623
7840
|
leftColumnWidth,
|
|
@@ -7644,7 +7861,7 @@ var SettingsTable_default = Object.assign(SettingsTable, {
|
|
|
7644
7861
|
Row
|
|
7645
7862
|
});
|
|
7646
7863
|
// src/core/components/NavbarSettingsWidget/index.tsx
|
|
7647
|
-
var
|
|
7864
|
+
var import_lodash16 = __toESM(require_lodash());
|
|
7648
7865
|
var import_core24 = require("@mantine/core");
|
|
7649
7866
|
var import_icons_react12 = require("@tabler/icons-react");
|
|
7650
7867
|
var jsx_dev_runtime33 = require("react/jsx-dev-runtime");
|
|
@@ -7670,7 +7887,7 @@ function NavbarSettingsWidget({
|
|
|
7670
7887
|
navbar: initialUserExperience.navbar
|
|
7671
7888
|
}));
|
|
7672
7889
|
},
|
|
7673
|
-
custom: !
|
|
7890
|
+
custom: !import_lodash16.isEqual(userExperience.navbar, initialUserExperience.navbar),
|
|
7674
7891
|
children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default, {
|
|
7675
7892
|
...componentsProps?.table,
|
|
7676
7893
|
children: [
|
|
@@ -7718,7 +7935,7 @@ function NavbarSettingsWidget({
|
|
|
7718
7935
|
}, undefined, false, undefined, this);
|
|
7719
7936
|
}
|
|
7720
7937
|
// src/core/components/ContextClusterProvider/index.tsx
|
|
7721
|
-
var
|
|
7938
|
+
var import_react19 = __toESM(require("react"));
|
|
7722
7939
|
var jsx_dev_runtime34 = require("react/jsx-dev-runtime");
|
|
7723
7940
|
var createContextCluster = (generalDefaultValue, staticIds) => {
|
|
7724
7941
|
const isStaticId = (id) => {
|
|
@@ -7730,16 +7947,16 @@ var createContextCluster = (generalDefaultValue, staticIds) => {
|
|
|
7730
7947
|
const contexts = {};
|
|
7731
7948
|
const defaultValues = {};
|
|
7732
7949
|
const createContext8 = (id, defaultValue) => {
|
|
7733
|
-
const context =
|
|
7950
|
+
const context = import_react19.default.createContext(defaultValue ?? generalDefaultValue);
|
|
7734
7951
|
contexts[id] = context;
|
|
7735
7952
|
defaultValues[id] = defaultValue ?? generalDefaultValue;
|
|
7736
7953
|
return context;
|
|
7737
7954
|
};
|
|
7738
7955
|
const useContext11 = (id) => {
|
|
7739
7956
|
if (isStaticId(id)) {
|
|
7740
|
-
return contexts[id] ?
|
|
7957
|
+
return contexts[id] ? import_react19.default.useContext(contexts[id]) : generalDefaultValue;
|
|
7741
7958
|
}
|
|
7742
|
-
return contexts[id] ?
|
|
7959
|
+
return contexts[id] ? import_react19.default.useContext(contexts[id]) : null;
|
|
7743
7960
|
};
|
|
7744
7961
|
return {
|
|
7745
7962
|
contexts,
|