remoraid 2.1.7 → 2.2.5

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.
@@ -53,8 +53,8 @@ __export(exports_core, {
53
53
  WidgetWrapper: () => WidgetWrapper,
54
54
  WidgetSelectionHeader: () => WidgetSelectionHeader,
55
55
  Widget: () => Widget,
56
- ResponsiveButton: () => ResponsiveButton,
57
56
  RemoraidProvider: () => RemoraidProvider,
57
+ RemoraidButton: () => RemoraidButton,
58
58
  PageContainer: () => PageContainer,
59
59
  Page: () => Page,
60
60
  NotFoundPage: () => NotFoundPage,
@@ -806,7 +806,7 @@ function WidgetSelectionHeader({
806
806
  ]
807
807
  }, undefined, true, undefined, this);
808
808
  }
809
- // src/core/components/CloseButton/index.tsx
809
+ // src/core/components/Widget/WidgetWrapper/CloseButton/index.tsx
810
810
  var import_core7 = require("@mantine/core");
811
811
  var import_icons_react5 = require("@tabler/icons-react");
812
812
  var jsx_dev_runtime11 = require("react/jsx-dev-runtime");
@@ -973,11 +973,11 @@ function AlertMinimal({
973
973
  }, undefined, true, undefined, this)
974
974
  }, undefined, false, undefined, this);
975
975
  }
976
- // src/core/components/ResponsiveButton/index.tsx
976
+ // src/core/components/RemoraidButton/index.tsx
977
977
  var import_core11 = require("@mantine/core");
978
978
  var import_icons_react6 = require("@tabler/icons-react");
979
979
  var jsx_dev_runtime15 = require("react/jsx-dev-runtime");
980
- var isResponsiveButtonProps = (e) => {
980
+ var isRemoraidButtonProps = (e) => {
981
981
  if (typeof e !== "object") {
982
982
  return false;
983
983
  }
@@ -986,13 +986,25 @@ var isResponsiveButtonProps = (e) => {
986
986
  }
987
987
  return true;
988
988
  };
989
- function ResponsiveButton(props) {
990
- const { onClick, label, loading, variant, componentsProps, breakpoint } = props;
989
+ function RemoraidButton({
990
+ label,
991
+ responsive,
992
+ breakpoint,
993
+ collapsed,
994
+ size,
995
+ color,
996
+ onClick,
997
+ loading,
998
+ variant,
999
+ componentsProps,
1000
+ ...props
1001
+ }) {
991
1002
  const theme = useRemoraidTheme();
1003
+ const iconProps = { ...theme.iconProps.medium, ...componentsProps?.icon };
992
1004
  const icon = props.icon ? /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(props.icon, {
993
- ...theme.iconProps.medium
1005
+ ...iconProps
994
1006
  }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(import_icons_react6.IconClick, {
995
- ...theme.iconProps.medium
1007
+ ...iconProps
996
1008
  }, undefined, false, undefined, this);
997
1009
  return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(jsx_dev_runtime15.Fragment, {
998
1010
  children: [
@@ -1000,21 +1012,30 @@ function ResponsiveButton(props) {
1000
1012
  label,
1001
1013
  ...componentsProps?.tooltip,
1002
1014
  children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(import_core11.ActionIcon, {
1003
- variant: variant || "default",
1015
+ "aria-label": label,
1016
+ variant: variant ?? "default",
1004
1017
  onClick,
1005
1018
  loading,
1006
- size: "input-sm",
1007
- "aria-label": "Refresh",
1008
- hiddenFrom: breakpoint || "md",
1019
+ size: size ? `input-${size}` : "input-sm",
1020
+ color,
1021
+ ...componentsProps?.button,
1022
+ ...componentsProps?.ActionIcon,
1023
+ hiddenFrom: responsive === false ? undefined : breakpoint ?? "md",
1024
+ display: responsive === false && collapsed !== true ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
1009
1025
  children: icon
1010
1026
  }, undefined, false, undefined, this)
1011
1027
  }, undefined, false, undefined, this),
1012
1028
  /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(import_core11.Button, {
1013
1029
  onClick,
1014
1030
  loading,
1015
- variant: variant || "default",
1031
+ variant: variant ?? "default",
1032
+ size,
1033
+ color,
1016
1034
  leftSection: props.icon ? icon : undefined,
1017
- visibleFrom: breakpoint || "md",
1035
+ ...componentsProps?.button,
1036
+ ...componentsProps?.Button,
1037
+ visibleFrom: responsive === false ? undefined : breakpoint ?? "md",
1038
+ display: responsive === false && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
1018
1039
  children: label
1019
1040
  }, undefined, false, undefined, this)
1020
1041
  ]
@@ -1136,8 +1157,8 @@ function Widget({
1136
1157
  gap: buttonsGap,
1137
1158
  wrap: "nowrap",
1138
1159
  children: buttons !== undefined && buttons.map((e, i) => {
1139
- if (isResponsiveButtonProps(e)) {
1140
- return /* @__PURE__ */ react2.createElement(ResponsiveButton, {
1160
+ if (isRemoraidButtonProps(e)) {
1161
+ return /* @__PURE__ */ react2.createElement(RemoraidButton, {
1141
1162
  ...e,
1142
1163
  key: i
1143
1164
  });
@@ -17,28 +17,21 @@ interface UserExperience {
17
17
  showWelcomeMessage: boolean;
18
18
  }
19
19
  type AlertCategory = "negative" | "neutral" | "positive";
20
+ type TransitionDuration = "short" | "medium" | "long";
21
+ type RemoraidBreakpoint = "buttonCollapse" | "badgeGroupCollapse";
22
+ type RemoraidIconSize = "tiny" | "medium";
20
23
  interface RemoraidTheme {
21
24
  complete: true;
22
- transitionDurations: {
23
- short: number
24
- medium: number
25
- long: number
26
- };
27
- breakpoints: {
28
- buttonCollapse: MantineBreakpoint
29
- badgeGroupCollapse: MantineBreakpoint
30
- };
25
+ transitionDurations: Record<TransitionDuration, number>;
26
+ breakpoints: Record<RemoraidBreakpoint, MantineBreakpoint>;
31
27
  scrollAreaProps: ScrollAreaProps;
32
- alertProps: { [C in AlertCategory] : AlertProps };
28
+ alertProps: Record<AlertCategory, AlertProps>;
33
29
  containerSize: MantineSize | number;
34
- iconProps: {
35
- tiny: IconProps
36
- medium: IconProps
37
- };
30
+ iconProps: Record<RemoraidIconSize, IconProps>;
38
31
  jsonStringifySpace: string | number;
39
32
  transparentBackground?: string;
40
33
  primaryColor?: string;
41
- spacingPx?: { [S in MantineSize] : number };
34
+ spacingPx?: Record<MantineSize, number>;
42
35
  }
43
36
  type RemoraidThemeCallback = (mantineTheme: MantineTheme, colorScheme: MantineColorScheme) => RemoraidTheme;
44
37
  type PartialRemoraidTheme = Omit<Partial<RemoraidTheme>, "complete">;
@@ -181,22 +174,34 @@ interface AlertMinimalProps {
181
174
  };
182
175
  }
183
176
  declare function AlertMinimal({ children, title, category, text, onClose, mounted, mt, mb, componentsProps }: PropsWithChildren6<AlertMinimalProps>): ReactNode11;
184
- import { ActionIconVariant, ButtonVariant, MantineBreakpoint as MantineBreakpoint3, TooltipProps as TooltipProps3 } from "@mantine/core";
185
- import { Icon as Icon2 } from "@tabler/icons-react";
177
+ import { ActionIconProps, ActionIconVariant, ButtonProps, ButtonVariant, MantineBreakpoint as MantineBreakpoint3, MantineColor, MantineSize as MantineSize5, TooltipProps as TooltipProps3 } from "@mantine/core";
178
+ import { Icon as Icon2, IconProps as IconProps2 } from "@tabler/icons-react";
186
179
  import { ReactNode as ReactNode12 } from "react";
187
- interface ResponsiveButtonProps {
180
+ type Common<
181
+ A,
182
+ B
183
+ > = Pick<A & B, keyof A & keyof B>;
184
+ interface RemoraidButtonProps {
188
185
  label: string;
186
+ responsive?: boolean;
187
+ breakpoint?: MantineBreakpoint3;
188
+ collapsed?: boolean;
189
+ size?: MantineSize5;
190
+ color?: MantineColor;
189
191
  icon?: Icon2;
190
192
  onClick?: () => void;
191
- breakpoint?: MantineBreakpoint3;
192
193
  loading?: boolean;
193
194
  variant?: Extract<ButtonVariant, ActionIconVariant>;
194
- componentsProps?: {
195
+ componentsProps: {
195
196
  tooltip?: Partial<TooltipProps3>
197
+ icon?: Partial<IconProps2>
198
+ button: Omit<Partial<Common<ButtonProps, ActionIconProps>>, "variant" | "onClick" | "size" | "color" | "loading">
199
+ Button?: Partial<ButtonProps>
200
+ ActionIcon?: Partial<ActionIconProps>
196
201
  };
197
202
  }
198
- declare function ResponsiveButton(props: ResponsiveButtonProps): ReactNode12;
199
- import { MantineSize as MantineSize5, PaperProps, TransitionProps as TransitionProps3 } from "@mantine/core";
203
+ declare function RemoraidButton({ label, responsive, breakpoint, collapsed, size, color, onClick, loading, variant, componentsProps,...props }: RemoraidButtonProps): ReactNode12;
204
+ import { MantineSize as MantineSize6, PaperProps, TransitionProps as TransitionProps3 } from "@mantine/core";
200
205
  import { PropsWithChildren as PropsWithChildren7, ReactNode as ReactNode13 } from "react";
201
206
  interface WidgetWrapperComponentsProps {
202
207
  container?: Partial<PaperProps>;
@@ -204,12 +209,12 @@ interface WidgetWrapperComponentsProps {
204
209
  }
205
210
  interface WidgetWrapperProps {
206
211
  config: WidgetConfiguration;
207
- mt?: MantineSize5 | number;
212
+ mt?: MantineSize6 | number;
208
213
  withCloseButton?: boolean;
209
214
  componentsProps?: WidgetWrapperComponentsProps;
210
215
  }
211
216
  declare function WidgetWrapper({ children, config, mt, withCloseButton, componentsProps }: PropsWithChildren7<WidgetWrapperProps>): ReactNode13;
212
- import { MantineSize as MantineSize6, LoaderProps } from "@mantine/core";
217
+ import { MantineSize as MantineSize7, LoaderProps } from "@mantine/core";
213
218
  import { PropsWithChildren as PropsWithChildren8, ReactNode as ReactNode14 } from "react";
214
219
  interface WidgetComponentsProps extends WidgetWrapperComponentsProps {
215
220
  wrapper?: Partial<Omit<WidgetWrapperProps, "widgetId">>;
@@ -221,33 +226,33 @@ interface WidgetProps {
221
226
  title: string;
222
227
  config?: Partial<Omit<WidgetConfiguration, "widgetId">>;
223
228
  badges?: (BadgeMinimalProps | ReactNode14)[];
224
- buttons?: (ResponsiveButtonProps | ReactNode14)[];
229
+ buttons?: (RemoraidButtonProps | ReactNode14)[];
225
230
  alerts?: (AlertMinimalProps | ReactNode14)[];
226
- gaps?: MantineSize6 | number | {
227
- badges?: MantineSize6 | number
228
- buttons?: MantineSize6 | number
229
- alerts?: MantineSize6 | number
231
+ gaps?: MantineSize7 | number | {
232
+ badges?: MantineSize7 | number
233
+ buttons?: MantineSize7 | number
234
+ alerts?: MantineSize7 | number
230
235
  };
231
236
  loading?: boolean;
232
- mt?: MantineSize6 | number;
237
+ mt?: MantineSize7 | number;
233
238
  componentsProps?: WidgetComponentsProps;
234
239
  }
235
240
  declare function Widget({ children, id, config, title, badges, buttons, alerts, gaps, loading, mt, componentsProps }: PropsWithChildren8<WidgetProps>): ReactNode14;
236
- import { ContainerProps, MantineSize as MantineSize7 } from "@mantine/core";
241
+ import { ContainerProps, MantineSize as MantineSize8 } from "@mantine/core";
237
242
  import { PropsWithChildren as PropsWithChildren9, ReactNode as ReactNode15 } from "react";
238
243
  interface PageProps {
239
244
  name?: string;
240
245
  config?: Partial<Omit<PageConfiguration, "name">>;
241
- pt?: MantineSize7 | number;
246
+ pt?: MantineSize8 | number;
242
247
  componentsProps?: {
243
248
  container?: ContainerProps
244
249
  };
245
250
  }
246
251
  declare function Page({ children, name, config, pt, componentsProps }: PropsWithChildren9<PageProps>): ReactNode15;
247
- import { ContainerProps as ContainerProps2, MantineSize as MantineSize8 } from "@mantine/core";
252
+ import { ContainerProps as ContainerProps2, MantineSize as MantineSize9 } from "@mantine/core";
248
253
  import { PropsWithChildren as PropsWithChildren10, ReactNode as ReactNode16 } from "react";
249
254
  interface PageContainerProps {
250
- pt?: MantineSize8 | number;
255
+ pt?: MantineSize9 | number;
251
256
  componentsProps?: {
252
257
  container?: ContainerProps2
253
258
  };
@@ -262,17 +267,17 @@ interface NotFoundPageProps {
262
267
  };
263
268
  }
264
269
  declare function NotFoundPage({ children, message, componentsProps }: PropsWithChildren11<NotFoundPageProps>): ReactNode17;
265
- import { ContainerProps as ContainerProps3, MantineSize as MantineSize9 } from "@mantine/core";
270
+ import { ContainerProps as ContainerProps3, MantineSize as MantineSize10 } from "@mantine/core";
266
271
  import { PropsWithChildren as PropsWithChildren12, ReactNode as ReactNode18 } from "react";
267
272
  interface EnvironmentShellProps {
268
273
  environment: Record<string, string | undefined>;
269
274
  message?: string;
270
- m?: MantineSize9 | number;
271
- mt?: MantineSize9 | number;
275
+ m?: MantineSize10 | number;
276
+ mt?: MantineSize10 | number;
272
277
  withContainer?: boolean;
273
278
  componentsProps?: {
274
279
  container?: ContainerProps3
275
280
  };
276
281
  }
277
282
  declare function EnvironmentShell({ children, environment, message, m, mt, withContainer, componentsProps }: PropsWithChildren12<EnvironmentShellProps>): ReactNode18;
278
- export { userExperienceCookieName, useWidgets, useRemoraidUserExperience, useRemoraidTheme, defaultUserExperience, defaultNavbarSettings, createRemoraidTheme, WidgetsProviderProps, WidgetWrapperProps, WidgetWrapper, WidgetSelectionHeaderProps, WidgetSelectionHeader, WidgetProps, WidgetConfiguration, Widget, UserExperienceProviderProps, UserExperience, ThemeProviderProps, ResponsiveButtonProps, ResponsiveButton, RemoraidThemeCallback, RemoraidTheme, RemoraidProviderProps, RemoraidProvider, PartialRemoraidTheme, PageProps, PageContainerProps, PageContainer, PageConfiguration, Page, NotFoundPageProps, NotFoundPage, NavbarVariant, NavbarSettings, NavbarProps, NavbarLink, EnvironmentShellProps, EnvironmentShell, CloseButtonProps, CloseButton, BadgeMinimalProps, BadgeMinimal, BadgeGroupProps, BadgeGroup, AppShellProps, AppShellLogo, AppShell, AlertMinimalProps, AlertMinimal, AlertCategory };
283
+ export { userExperienceCookieName, useWidgets, useRemoraidUserExperience, useRemoraidTheme, defaultUserExperience, defaultNavbarSettings, createRemoraidTheme, WidgetsProviderProps, WidgetWrapperProps, WidgetWrapper, WidgetSelectionHeaderProps, WidgetSelectionHeader, WidgetProps, WidgetConfiguration, Widget, UserExperienceProviderProps, UserExperience, TransitionDuration, ThemeProviderProps, RemoraidThemeCallback, RemoraidTheme, RemoraidProviderProps, RemoraidProvider, RemoraidIconSize, RemoraidButtonProps, RemoraidButton, RemoraidBreakpoint, PartialRemoraidTheme, PageProps, PageContainerProps, PageContainer, PageConfiguration, Page, NotFoundPageProps, NotFoundPage, NavbarVariant, NavbarSettings, NavbarProps, NavbarLink, EnvironmentShellProps, EnvironmentShell, CloseButtonProps, CloseButton, BadgeMinimalProps, BadgeMinimal, BadgeGroupProps, BadgeGroup, AppShellProps, AppShellLogo, AppShell, AlertMinimalProps, AlertMinimal, AlertCategory };
@@ -790,7 +790,7 @@ function WidgetSelectionHeader({
790
790
  ]
791
791
  }, undefined, true, undefined, this);
792
792
  }
793
- // src/core/components/CloseButton/index.tsx
793
+ // src/core/components/Widget/WidgetWrapper/CloseButton/index.tsx
794
794
  import { ActionIcon, Transition } from "@mantine/core";
795
795
  import { IconX } from "@tabler/icons-react";
796
796
  import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
@@ -968,7 +968,7 @@ function AlertMinimal({
968
968
  }, undefined, true, undefined, this)
969
969
  }, undefined, false, undefined, this);
970
970
  }
971
- // src/core/components/ResponsiveButton/index.tsx
971
+ // src/core/components/RemoraidButton/index.tsx
972
972
  import {
973
973
  ActionIcon as ActionIcon2,
974
974
  Button,
@@ -976,7 +976,7 @@ import {
976
976
  } from "@mantine/core";
977
977
  import { IconClick } from "@tabler/icons-react";
978
978
  import { jsxDEV as jsxDEV15, Fragment as Fragment3 } from "react/jsx-dev-runtime";
979
- var isResponsiveButtonProps = (e) => {
979
+ var isRemoraidButtonProps = (e) => {
980
980
  if (typeof e !== "object") {
981
981
  return false;
982
982
  }
@@ -985,13 +985,25 @@ var isResponsiveButtonProps = (e) => {
985
985
  }
986
986
  return true;
987
987
  };
988
- function ResponsiveButton(props) {
989
- const { onClick, label, loading, variant, componentsProps, breakpoint } = props;
988
+ function RemoraidButton({
989
+ label,
990
+ responsive,
991
+ breakpoint,
992
+ collapsed,
993
+ size,
994
+ color,
995
+ onClick,
996
+ loading,
997
+ variant,
998
+ componentsProps,
999
+ ...props
1000
+ }) {
990
1001
  const theme = useRemoraidTheme();
1002
+ const iconProps = { ...theme.iconProps.medium, ...componentsProps?.icon };
991
1003
  const icon = props.icon ? /* @__PURE__ */ jsxDEV15(props.icon, {
992
- ...theme.iconProps.medium
1004
+ ...iconProps
993
1005
  }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV15(IconClick, {
994
- ...theme.iconProps.medium
1006
+ ...iconProps
995
1007
  }, undefined, false, undefined, this);
996
1008
  return /* @__PURE__ */ jsxDEV15(Fragment3, {
997
1009
  children: [
@@ -999,21 +1011,30 @@ function ResponsiveButton(props) {
999
1011
  label,
1000
1012
  ...componentsProps?.tooltip,
1001
1013
  children: /* @__PURE__ */ jsxDEV15(ActionIcon2, {
1002
- variant: variant || "default",
1014
+ "aria-label": label,
1015
+ variant: variant ?? "default",
1003
1016
  onClick,
1004
1017
  loading,
1005
- size: "input-sm",
1006
- "aria-label": "Refresh",
1007
- hiddenFrom: breakpoint || "md",
1018
+ size: size ? `input-${size}` : "input-sm",
1019
+ color,
1020
+ ...componentsProps?.button,
1021
+ ...componentsProps?.ActionIcon,
1022
+ hiddenFrom: responsive === false ? undefined : breakpoint ?? "md",
1023
+ display: responsive === false && collapsed !== true ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
1008
1024
  children: icon
1009
1025
  }, undefined, false, undefined, this)
1010
1026
  }, undefined, false, undefined, this),
1011
1027
  /* @__PURE__ */ jsxDEV15(Button, {
1012
1028
  onClick,
1013
1029
  loading,
1014
- variant: variant || "default",
1030
+ variant: variant ?? "default",
1031
+ size,
1032
+ color,
1015
1033
  leftSection: props.icon ? icon : undefined,
1016
- visibleFrom: breakpoint || "md",
1034
+ ...componentsProps?.button,
1035
+ ...componentsProps?.Button,
1036
+ visibleFrom: responsive === false ? undefined : breakpoint ?? "md",
1037
+ display: responsive === false && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
1017
1038
  children: label
1018
1039
  }, undefined, false, undefined, this)
1019
1040
  ]
@@ -1144,8 +1165,8 @@ function Widget({
1144
1165
  gap: buttonsGap,
1145
1166
  wrap: "nowrap",
1146
1167
  children: buttons !== undefined && buttons.map((e, i) => {
1147
- if (isResponsiveButtonProps(e)) {
1148
- return /* @__PURE__ */ createElement2(ResponsiveButton, {
1168
+ if (isRemoraidButtonProps(e)) {
1169
+ return /* @__PURE__ */ createElement2(RemoraidButton, {
1149
1170
  ...e,
1150
1171
  key: i
1151
1172
  });
@@ -1249,8 +1270,8 @@ export {
1249
1270
  WidgetWrapper,
1250
1271
  WidgetSelectionHeader,
1251
1272
  Widget,
1252
- ResponsiveButton,
1253
1273
  RemoraidProvider,
1274
+ RemoraidButton,
1254
1275
  PageContainer,
1255
1276
  Page,
1256
1277
  NotFoundPage,