remoraid 2.1.7 → 2.2.1

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.
@@ -31,6 +31,15 @@ import { useState } from "react";
31
31
 
32
32
  // src/core/lib/utils.ts
33
33
  var co = (condition, value, fallback) => condition(value) ? value : fallback;
34
+ var isRemoraidButtonProps = (e) => {
35
+ if (typeof e !== "object") {
36
+ return false;
37
+ }
38
+ if (!("label" in e)) {
39
+ return false;
40
+ }
41
+ return true;
42
+ };
34
43
 
35
44
  // src/core/components/RemoraidProvider/ThemeProvider/index.tsx
36
45
  import {
@@ -790,7 +799,7 @@ function WidgetSelectionHeader({
790
799
  ]
791
800
  }, undefined, true, undefined, this);
792
801
  }
793
- // src/core/components/CloseButton/index.tsx
802
+ // src/core/components/Widget/WidgetWrapper/CloseButton/index.tsx
794
803
  import { ActionIcon, Transition } from "@mantine/core";
795
804
  import { IconX } from "@tabler/icons-react";
796
805
  import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
@@ -969,52 +978,101 @@ function AlertMinimal({
969
978
  }, undefined, false, undefined, this);
970
979
  }
971
980
  // src/core/components/ResponsiveButton/index.tsx
981
+ import {
982
+ Box
983
+ } from "@mantine/core";
984
+
985
+ // src/core/components/Button/index.tsx
972
986
  import {
973
987
  ActionIcon as ActionIcon2,
974
- Button,
975
- Tooltip as Tooltip4
988
+ Tooltip as Tooltip4,
989
+ Button as MantineButton
976
990
  } from "@mantine/core";
977
991
  import { IconClick } from "@tabler/icons-react";
978
- import { jsxDEV as jsxDEV15, Fragment as Fragment3 } from "react/jsx-dev-runtime";
979
- var isResponsiveButtonProps = (e) => {
980
- if (typeof e !== "object") {
981
- return false;
982
- }
983
- if (!("label" in e)) {
984
- return false;
985
- }
986
- return true;
987
- };
988
- function ResponsiveButton(props) {
989
- const { onClick, label, loading, variant, componentsProps, breakpoint } = props;
992
+ import { jsxDEV as jsxDEV15 } from "react/jsx-dev-runtime";
993
+ function Button({
994
+ label,
995
+ collapsed,
996
+ componentsProps,
997
+ onClick,
998
+ loading,
999
+ variant,
1000
+ ...props
1001
+ }) {
990
1002
  const theme = useRemoraidTheme();
1003
+ const iconProps = { ...theme.iconProps.medium, ...componentsProps?.icon };
991
1004
  const icon = props.icon ? /* @__PURE__ */ jsxDEV15(props.icon, {
992
- ...theme.iconProps.medium
1005
+ ...iconProps
993
1006
  }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV15(IconClick, {
994
- ...theme.iconProps.medium
1007
+ ...iconProps
1008
+ }, undefined, false, undefined, this);
1009
+ if (collapsed === true) {
1010
+ return /* @__PURE__ */ jsxDEV15(Tooltip4, {
1011
+ label,
1012
+ ...componentsProps?.tooltip,
1013
+ children: /* @__PURE__ */ jsxDEV15(ActionIcon2, {
1014
+ variant: variant ?? "default",
1015
+ onClick,
1016
+ loading,
1017
+ size: "input-sm",
1018
+ "aria-label": "Refresh",
1019
+ ...componentsProps?.actionIcon,
1020
+ children: icon
1021
+ }, undefined, false, undefined, this)
1022
+ }, undefined, false, undefined, this);
1023
+ }
1024
+ return /* @__PURE__ */ jsxDEV15(MantineButton, {
1025
+ onClick,
1026
+ loading,
1027
+ variant: variant ?? "default",
1028
+ leftSection: props.icon ? icon : undefined,
1029
+ ...componentsProps?.button,
1030
+ children: label
995
1031
  }, undefined, false, undefined, this);
996
- return /* @__PURE__ */ jsxDEV15(Fragment3, {
1032
+ }
1033
+
1034
+ // src/core/components/ResponsiveButton/index.tsx
1035
+ import { jsxDEV as jsxDEV16, Fragment as Fragment3 } from "react/jsx-dev-runtime";
1036
+ function ResponsiveButton({
1037
+ breakpoint,
1038
+ componentsProps,
1039
+ ...remoraidButtonProps
1040
+ }) {
1041
+ return /* @__PURE__ */ jsxDEV16(Fragment3, {
997
1042
  children: [
998
- /* @__PURE__ */ jsxDEV15(Tooltip4, {
999
- label,
1000
- ...componentsProps?.tooltip,
1001
- children: /* @__PURE__ */ jsxDEV15(ActionIcon2, {
1002
- variant: variant || "default",
1003
- onClick,
1004
- loading,
1005
- size: "input-sm",
1006
- "aria-label": "Refresh",
1007
- hiddenFrom: breakpoint || "md",
1008
- children: icon
1043
+ /* @__PURE__ */ jsxDEV16(Box, {
1044
+ hiddenFrom: breakpoint ?? "md",
1045
+ children: /* @__PURE__ */ jsxDEV16(Button, {
1046
+ ...remoraidButtonProps,
1047
+ ...componentsProps?.Button,
1048
+ componentsProps: {
1049
+ tooltip: componentsProps?.tooltip,
1050
+ icon: componentsProps?.icon,
1051
+ ...componentsProps?.Button?.componentsProps,
1052
+ actionIcon: {
1053
+ ...componentsProps?.button,
1054
+ ...componentsProps?.Button?.componentsProps?.actionIcon
1055
+ }
1056
+ },
1057
+ collapsed: true
1009
1058
  }, undefined, false, undefined, this)
1010
1059
  }, undefined, false, undefined, this),
1011
- /* @__PURE__ */ jsxDEV15(Button, {
1012
- onClick,
1013
- loading,
1014
- variant: variant || "default",
1015
- leftSection: props.icon ? icon : undefined,
1016
- visibleFrom: breakpoint || "md",
1017
- children: label
1060
+ /* @__PURE__ */ jsxDEV16(Box, {
1061
+ visibleFrom: breakpoint ?? "md",
1062
+ children: /* @__PURE__ */ jsxDEV16(Button, {
1063
+ ...remoraidButtonProps,
1064
+ ...componentsProps?.Button,
1065
+ componentsProps: {
1066
+ tooltip: componentsProps?.tooltip,
1067
+ icon: componentsProps?.icon,
1068
+ ...componentsProps?.Button?.componentsProps,
1069
+ button: {
1070
+ ...componentsProps?.button,
1071
+ ...componentsProps?.Button?.componentsProps?.button
1072
+ }
1073
+ },
1074
+ collapsed: false
1075
+ }, undefined, false, undefined, this)
1018
1076
  }, undefined, false, undefined, this)
1019
1077
  ]
1020
1078
  }, undefined, true, undefined, this);
@@ -1025,7 +1083,7 @@ import {
1025
1083
  Transition as Transition4
1026
1084
  } from "@mantine/core";
1027
1085
  import { useEffect as useEffect3 } from "react";
1028
- import { jsxDEV as jsxDEV16 } from "react/jsx-dev-runtime";
1086
+ import { jsxDEV as jsxDEV17 } from "react/jsx-dev-runtime";
1029
1087
  function WidgetWrapper({
1030
1088
  children,
1031
1089
  config,
@@ -1051,12 +1109,12 @@ function WidgetWrapper({
1051
1109
  registerWidget(page.pageId, config);
1052
1110
  }
1053
1111
  }, [pageRegistered]);
1054
- return /* @__PURE__ */ jsxDEV16(Transition4, {
1112
+ return /* @__PURE__ */ jsxDEV17(Transition4, {
1055
1113
  mounted: page !== null && isWidgetSelected(page.pageId, config.widgetId),
1056
1114
  transition: "fade-left",
1057
1115
  duration: theme.transitionDurations.medium,
1058
1116
  timingFunction: "ease",
1059
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV16(Paper3, {
1117
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV17(Paper3, {
1060
1118
  p: "md",
1061
1119
  shadow: "md",
1062
1120
  bg: theme.transparentBackground,
@@ -1072,7 +1130,7 @@ function WidgetWrapper({
1072
1130
  updateActiveWidget(null);
1073
1131
  },
1074
1132
  children: [
1075
- withCloseButton !== false && /* @__PURE__ */ jsxDEV16(CloseButton, {
1133
+ withCloseButton !== false && /* @__PURE__ */ jsxDEV17(CloseButton, {
1076
1134
  widgetId: config.widgetId
1077
1135
  }, undefined, false, undefined, this),
1078
1136
  children
@@ -1088,7 +1146,7 @@ import {
1088
1146
  Loader,
1089
1147
  Title
1090
1148
  } from "@mantine/core";
1091
- import { jsxDEV as jsxDEV17, Fragment as Fragment4 } from "react/jsx-dev-runtime";
1149
+ import { jsxDEV as jsxDEV18, Fragment as Fragment4 } from "react/jsx-dev-runtime";
1092
1150
  import { createElement as createElement2 } from "react";
1093
1151
  function Widget({
1094
1152
  children,
@@ -1106,7 +1164,7 @@ function Widget({
1106
1164
  const badgesGap = (typeof gaps === "object" ? gaps.badges : gaps) ?? "xs";
1107
1165
  const buttonsGap = (typeof gaps === "object" ? gaps.buttons : gaps) ?? "xs";
1108
1166
  const alertsGap = (typeof gaps === "object" ? gaps.alerts : gaps) ?? "xs";
1109
- return /* @__PURE__ */ jsxDEV17(WidgetWrapper, {
1167
+ return /* @__PURE__ */ jsxDEV18(WidgetWrapper, {
1110
1168
  config: {
1111
1169
  widgetId: id,
1112
1170
  name: title,
@@ -1119,32 +1177,32 @@ function Widget({
1119
1177
  },
1120
1178
  ...componentsProps?.wrapper,
1121
1179
  children: [
1122
- /* @__PURE__ */ jsxDEV17(Group4, {
1180
+ /* @__PURE__ */ jsxDEV18(Group4, {
1123
1181
  justify: "space-between",
1124
1182
  wrap: "nowrap",
1125
1183
  children: [
1126
- /* @__PURE__ */ jsxDEV17(Group4, {
1184
+ /* @__PURE__ */ jsxDEV18(Group4, {
1127
1185
  gap: badgesGap,
1128
1186
  wrap: "nowrap",
1129
1187
  children: [
1130
- /* @__PURE__ */ jsxDEV17(Title, {
1188
+ /* @__PURE__ */ jsxDEV18(Title, {
1131
1189
  order: 1,
1132
1190
  size: "h3",
1133
1191
  lineClamp: 1,
1134
1192
  children: title
1135
1193
  }, undefined, false, undefined, this),
1136
- badges !== undefined && /* @__PURE__ */ jsxDEV17(BadgeGroup, {
1194
+ badges !== undefined && /* @__PURE__ */ jsxDEV18(BadgeGroup, {
1137
1195
  badges,
1138
1196
  gap: badgesGap,
1139
1197
  ...componentsProps?.badgeGroup
1140
1198
  }, undefined, false, undefined, this)
1141
1199
  ]
1142
1200
  }, undefined, true, undefined, this),
1143
- /* @__PURE__ */ jsxDEV17(Group4, {
1201
+ /* @__PURE__ */ jsxDEV18(Group4, {
1144
1202
  gap: buttonsGap,
1145
1203
  wrap: "nowrap",
1146
1204
  children: buttons !== undefined && buttons.map((e, i) => {
1147
- if (isResponsiveButtonProps(e)) {
1205
+ if (isRemoraidButtonProps(e)) {
1148
1206
  return /* @__PURE__ */ createElement2(ResponsiveButton, {
1149
1207
  ...e,
1150
1208
  key: i
@@ -1155,7 +1213,7 @@ function Widget({
1155
1213
  }, undefined, false, undefined, this)
1156
1214
  ]
1157
1215
  }, undefined, true, undefined, this),
1158
- /* @__PURE__ */ jsxDEV17(Divider3, {
1216
+ /* @__PURE__ */ jsxDEV18(Divider3, {
1159
1217
  my: "md"
1160
1218
  }, undefined, false, undefined, this),
1161
1219
  alerts !== undefined && alerts.map((a, i) => {
@@ -1168,11 +1226,11 @@ function Widget({
1168
1226
  }
1169
1227
  return a;
1170
1228
  }),
1171
- loading ? /* @__PURE__ */ jsxDEV17(Center, {
1172
- children: /* @__PURE__ */ jsxDEV17(Loader, {
1229
+ loading ? /* @__PURE__ */ jsxDEV18(Center, {
1230
+ children: /* @__PURE__ */ jsxDEV18(Loader, {
1173
1231
  ...componentsProps?.loader
1174
1232
  }, undefined, false, undefined, this)
1175
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV17(Fragment4, {
1233
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV18(Fragment4, {
1176
1234
  children
1177
1235
  }, undefined, false, undefined, this)
1178
1236
  ]
@@ -1181,7 +1239,7 @@ function Widget({
1181
1239
  // src/core/components/Page/NotFoundPage/index.tsx
1182
1240
  import { Alert as Alert2 } from "@mantine/core";
1183
1241
  import { usePathname as usePathname3 } from "next/navigation";
1184
- import { jsxDEV as jsxDEV18 } from "react/jsx-dev-runtime";
1242
+ import { jsxDEV as jsxDEV19 } from "react/jsx-dev-runtime";
1185
1243
  function NotFoundPage({
1186
1244
  children,
1187
1245
  message,
@@ -1189,11 +1247,11 @@ function NotFoundPage({
1189
1247
  }) {
1190
1248
  const pathname = usePathname3();
1191
1249
  const theme = useRemoraidTheme();
1192
- return /* @__PURE__ */ jsxDEV18(Page, {
1250
+ return /* @__PURE__ */ jsxDEV19(Page, {
1193
1251
  name: "Not Found",
1194
1252
  ...componentsProps?.page,
1195
1253
  children: [
1196
- /* @__PURE__ */ jsxDEV18(Alert2, {
1254
+ /* @__PURE__ */ jsxDEV19(Alert2, {
1197
1255
  ...theme.alertProps.negative,
1198
1256
  title: "404 - Page Not Found",
1199
1257
  children: message ?? `Could not find page ${pathname}.`
@@ -1204,7 +1262,7 @@ function NotFoundPage({
1204
1262
  }
1205
1263
  // src/core/components/EnvironmentShell/index.tsx
1206
1264
  import { Alert as Alert3 } from "@mantine/core";
1207
- import { jsxDEV as jsxDEV19, Fragment as Fragment5 } from "react/jsx-dev-runtime";
1265
+ import { jsxDEV as jsxDEV20, Fragment as Fragment5 } from "react/jsx-dev-runtime";
1208
1266
  function EnvironmentShell({
1209
1267
  children,
1210
1268
  environment,
@@ -1218,7 +1276,7 @@ function EnvironmentShell({
1218
1276
  const undefinedKeys = Object.keys(environment).filter((key) => environment[key] === undefined);
1219
1277
  const alertTitle = `Please Specify Environment Variable${undefinedKeys.length > 1 ? "s" : ""}`;
1220
1278
  const alertMessage = `Components could not be rendered because the following environment variables are not specified: ${undefinedKeys.join(", ")}.`;
1221
- const alert = /* @__PURE__ */ jsxDEV19(Alert3, {
1279
+ const alert = /* @__PURE__ */ jsxDEV20(Alert3, {
1222
1280
  ...theme.alertProps.neutral,
1223
1281
  title: alertTitle,
1224
1282
  m,
@@ -1226,12 +1284,12 @@ function EnvironmentShell({
1226
1284
  children: message ?? alertMessage
1227
1285
  }, undefined, false, undefined, this);
1228
1286
  if (undefinedKeys.length === 0) {
1229
- return /* @__PURE__ */ jsxDEV19(Fragment5, {
1287
+ return /* @__PURE__ */ jsxDEV20(Fragment5, {
1230
1288
  children
1231
1289
  }, undefined, false, undefined, this);
1232
1290
  }
1233
1291
  if (withContainer) {
1234
- return /* @__PURE__ */ jsxDEV19(PageContainer, {
1292
+ return /* @__PURE__ */ jsxDEV20(PageContainer, {
1235
1293
  componentsProps: { container: componentsProps?.container },
1236
1294
  children: alert
1237
1295
  }, undefined, false, undefined, this);
@@ -1256,6 +1314,7 @@ export {
1256
1314
  NotFoundPage,
1257
1315
  EnvironmentShell,
1258
1316
  CloseButton,
1317
+ Button,
1259
1318
  BadgeMinimal,
1260
1319
  BadgeGroup,
1261
1320
  AppShell,