@scm-manager/ui-core 4.0.0-REACT19-20250825-073633 → 4.0.0-REACT19-20250910-124634

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.
Files changed (60) hide show
  1. package/.turbo/turbo-test.log +174 -0
  2. package/.turbo/turbo-typecheck.log +1 -1
  3. package/package.json +4 -4
  4. package/src/base/buttons/Button.tsx +74 -60
  5. package/src/base/buttons/Icon.tsx +4 -3
  6. package/src/base/forms/ConfigurationForm.tsx +7 -7
  7. package/src/base/forms/FormRow.tsx +9 -9
  8. package/src/base/forms/base/Control.tsx +7 -3
  9. package/src/base/forms/base/ExpandableText.tsx +11 -12
  10. package/src/base/forms/checkbox/Checkbox.tsx +63 -65
  11. package/src/base/forms/checkbox/CheckboxField.tsx +4 -4
  12. package/src/base/forms/chip-input/ChipInputField.tsx +28 -30
  13. package/src/base/forms/chip-input/ControlledChipInputField.tsx +20 -22
  14. package/src/base/forms/combobox/Combobox.tsx +3 -13
  15. package/src/base/forms/combobox/ComboboxField.tsx +11 -14
  16. package/src/base/forms/headless-chip-input/ChipInput.tsx +49 -46
  17. package/src/base/forms/helpers.ts +3 -7
  18. package/src/base/forms/input/Input.tsx +4 -3
  19. package/src/base/forms/input/InputField.tsx +55 -43
  20. package/src/base/forms/input/Textarea.tsx +4 -3
  21. package/src/base/forms/radio-button/RadioButton.tsx +37 -27
  22. package/src/base/forms/radio-button/RadioGroup.tsx +4 -3
  23. package/src/base/forms/radio-button/RadioGroupField.tsx +15 -16
  24. package/src/base/forms/select/Select.tsx +15 -16
  25. package/src/base/forms/select/SelectField.tsx +19 -19
  26. package/src/base/layout/_helpers/with-classes.tsx +15 -12
  27. package/src/base/layout/card/Card.tsx +28 -21
  28. package/src/base/layout/card/CardDetail.tsx +65 -76
  29. package/src/base/layout/card/CardRow.tsx +9 -9
  30. package/src/base/layout/card/CardTitle.tsx +5 -5
  31. package/src/base/layout/card-list/CardList.tsx +9 -9
  32. package/src/base/layout/collapsible/Collapsible.tsx +42 -35
  33. package/src/base/layout/tabs/TabTrigger.tsx +5 -4
  34. package/src/base/layout/tabs/Tabs.tsx +4 -4
  35. package/src/base/layout/tabs/TabsList.tsx +5 -3
  36. package/src/base/layout/templates/data-page/DataPageHeader.tsx +10 -11
  37. package/src/base/misc/Image.tsx +5 -5
  38. package/src/base/misc/Level.tsx +4 -3
  39. package/src/base/misc/Loading.tsx +25 -25
  40. package/src/base/misc/SubSubtitle.tsx +9 -9
  41. package/src/base/misc/Subtitle.tsx +10 -10
  42. package/src/base/misc/Title.tsx +22 -14
  43. package/src/base/notifications/Notification.tsx +12 -13
  44. package/src/base/overlays/dialog/Dialog.tsx +39 -40
  45. package/src/base/overlays/menu/Menu.tsx +49 -52
  46. package/src/base/overlays/menu/MenuTrigger.tsx +6 -6
  47. package/src/base/overlays/popover/Popover.tsx +4 -6
  48. package/src/base/overlays/tooltip/ExpandableHint.tsx +7 -8
  49. package/src/base/overlays/tooltip/Tooltip.tsx +5 -3
  50. package/src/base/status/StatusIcon.tsx +46 -39
  51. package/src/index.ts +1 -0
  52. package/src/routing/admin.ts +38 -0
  53. package/src/routing/group.ts +22 -0
  54. package/src/routing/help.ts +21 -0
  55. package/src/routing/import.ts +17 -0
  56. package/src/routing/index.ts +24 -0
  57. package/src/routing/me.ts +26 -0
  58. package/src/routing/namespace.ts +39 -0
  59. package/src/routing/repository.ts +91 -0
  60. package/src/routing/user.ts +22 -0
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLAttributes } from "react";
17
+ import React, { FC, HTMLAttributes, Ref } from "react";
18
18
  import { useTranslation } from "react-i18next";
19
19
  import classNames from "classnames";
20
20
  import styled from "styled-components";
@@ -29,29 +29,29 @@ const FixedSizedImage = styled(Image)`
29
29
  height: 128px;
30
30
  `;
31
31
 
32
- const Loading = React.forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement> & { message?: string }>(
33
- ({ message, children, className, ...props }, ref) => {
34
- const [t] = useTranslation("commons");
35
- return (
36
- <Wrapper
37
- className={classNames(
38
- "is-flex",
39
- "is-flex-direction-column",
40
- "is-justify-content-center",
41
- "is-align-items-center",
42
- className
43
- )}
44
- {...props}
45
- ref={ref}
46
- >
47
- <FixedSizedImage className="mb-3" src="/images/loading.svg" alt={t("loading.alt")} />
48
- <p className="has-text-centered">
49
- {message}
50
- {children}
51
- </p>
52
- </Wrapper>
53
- );
54
- }
55
- );
32
+ type Props = HTMLAttributes<HTMLDivElement> & { message?: string; ref?: Ref<HTMLDivElement> };
33
+
34
+ const Loading: FC<Props> = ({ message, children, className, ref, ...props }) => {
35
+ const [t] = useTranslation("commons");
36
+ return (
37
+ <Wrapper
38
+ className={classNames(
39
+ "is-flex",
40
+ "is-flex-direction-column",
41
+ "is-justify-content-center",
42
+ "is-align-items-center",
43
+ className
44
+ )}
45
+ {...props}
46
+ ref={ref}
47
+ >
48
+ <FixedSizedImage className="mb-3" src="/images/loading.svg" alt={t("loading.alt")} />
49
+ <p className="has-text-centered">
50
+ {message}
51
+ {children}
52
+ </p>
53
+ </Wrapper>
54
+ );
55
+ };
56
56
 
57
57
  export default Loading;
@@ -14,16 +14,16 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLAttributes } from "react";
17
+ import React, { FC, HTMLAttributes, Ref } from "react";
18
18
  import classNames from "classnames";
19
19
 
20
- const SubSubtitle = React.forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement>>(
21
- ({ className, children, ...props }, ref) =>
22
- children ? (
23
- <h3 className={classNames("is-size-5", className)} ref={ref} {...props}>
24
- {children}
25
- </h3>
26
- ) : null
27
- );
20
+ type Props = HTMLAttributes<HTMLHeadingElement> & { ref?: Ref<HTMLHeadingElement> };
21
+
22
+ const SubSubtitle: FC<Props> = ({ className, children, ref, ...props }) =>
23
+ children ? (
24
+ <h3 className={classNames("is-size-5", className)} ref={ref} {...props}>
25
+ {children}
26
+ </h3>
27
+ ) : null;
28
28
 
29
29
  export default SubSubtitle;
@@ -14,17 +14,17 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLAttributes } from "react";
17
+ import React, { FC, HTMLAttributes, Ref } from "react";
18
18
  import classNames from "classnames";
19
19
 
20
- const Subtitle = React.forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement> & { subtitle?: string }>(
21
- ({ subtitle, className, children, ...props }, ref) =>
22
- !(subtitle || children) ? null : (
23
- <h2 className={classNames("subtitle", className)} {...props} ref={ref}>
24
- {subtitle}
25
- {children}
26
- </h2>
27
- )
28
- );
20
+ type Props = HTMLAttributes<HTMLHeadingElement> & { subtitle?: string; ref?: Ref<HTMLHeadingElement> };
21
+
22
+ const Subtitle: FC<Props> = ({ subtitle, className, children, ref, ...props }) =>
23
+ !(subtitle || children) ? null : (
24
+ <h2 className={classNames("subtitle", className)} {...props} ref={ref}>
25
+ {subtitle}
26
+ {children}
27
+ </h2>
28
+ );
29
29
 
30
30
  export default Subtitle;
@@ -14,26 +14,34 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLAttributes } from "react";
17
+ import React, { FC, HTMLAttributes, Ref } from "react";
18
18
  import classNames from "classnames";
19
19
 
20
20
  type Props = {
21
21
  title?: string;
22
22
  customPageTitle?: string;
23
23
  preventRefreshingPageTitle?: boolean;
24
- };
25
- const Title = React.forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement> & Props>(
26
- ({ title, customPageTitle, preventRefreshingPageTitle, children, className, ...props }, ref) => {
27
- if (children || title) {
28
- return (
29
- <h1 className={classNames("title", className)} {...props} ref={ref}>
30
- {title}
31
- {children}
32
- </h1>
33
- );
34
- }
35
- return null;
24
+ ref?: Ref<HTMLHeadingElement>;
25
+ } & HTMLAttributes<HTMLHeadingElement>;
26
+
27
+ const Title: FC<Props> = ({
28
+ title,
29
+ customPageTitle,
30
+ preventRefreshingPageTitle,
31
+ children,
32
+ className,
33
+ ref,
34
+ ...props
35
+ }) => {
36
+ if (children || title) {
37
+ return (
38
+ <h1 className={classNames("title", className)} {...props} ref={ref}>
39
+ {title}
40
+ {children}
41
+ </h1>
42
+ );
36
43
  }
37
- );
44
+ return null;
45
+ };
38
46
 
39
47
  export default Title;
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLAttributes } from "react";
17
+ import React, { FC, HTMLAttributes, Ref } from "react";
18
18
  import classNames from "classnames";
19
19
 
20
20
  type NotificationType = "primary" | "info" | "success" | "warning" | "danger" | "inherit";
@@ -23,19 +23,18 @@ type Props = {
23
23
  type?: NotificationType;
24
24
  onClose?: () => void;
25
25
  role?: string;
26
- };
26
+ ref?: Ref<HTMLDivElement>;
27
+ } & HTMLAttributes<HTMLDivElement>;
27
28
 
28
- const Notification = React.forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement> & Props>(
29
- ({ type = "info", onClose, className, children, role, ...props }, ref) => {
30
- const color = type !== "inherit" ? "is-" + type : "";
29
+ const Notification: FC<Props> = ({ type = "info", onClose, className, children, role, ref, ...props }) => {
30
+ const color = type !== "inherit" ? "is-" + type : "";
31
31
 
32
- return (
33
- <div className={classNames("notification", color, className)} role={role} ref={ref} {...props}>
34
- {onClose ? <button className="delete" onClick={onClose} /> : null}
35
- {children}
36
- </div>
37
- );
38
- }
39
- );
32
+ return (
33
+ <div className={classNames("notification", color, className)} role={role} ref={ref} {...props}>
34
+ {onClose ? <button className="delete" onClick={onClose} /> : null}
35
+ {children}
36
+ </div>
37
+ );
38
+ };
40
39
 
41
40
  export default Notification;
@@ -16,18 +16,18 @@
16
16
 
17
17
  import * as RadixDialog from "@radix-ui/react-dialog";
18
18
  import { DialogProps } from "@radix-ui/react-dialog";
19
- import React, { ComponentProps, ReactComponentElement, ReactElement, ReactNode, useCallback } from "react";
19
+ import React, { ComponentProps, FC, ReactComponentElement, ReactElement, ReactNode, Ref, useCallback } from "react";
20
20
  import { Button } from "../../buttons";
21
21
  import { useTranslation } from "react-i18next";
22
22
 
23
- export const CloseButton = React.forwardRef<HTMLButtonElement, ComponentProps<typeof Button>>(
24
- ({ children, ...props }, ref) => (
25
- <RadixDialog.Close asChild>
26
- <Button {...props} ref={ref}>
27
- {children}
28
- </Button>
29
- </RadixDialog.Close>
30
- )
23
+ type CloseButtonProps = ComponentProps<typeof Button> & { ref?: Ref<HTMLButtonElement> };
24
+
25
+ export const CloseButton: FC<CloseButtonProps> = ({ children, ref, ...props }) => (
26
+ <RadixDialog.Close asChild>
27
+ <Button {...props} ref={ref}>
28
+ {children}
29
+ </Button>
30
+ </RadixDialog.Close>
31
31
  );
32
32
 
33
33
  type Props = {
@@ -35,43 +35,42 @@ type Props = {
35
35
  title: ReactNode;
36
36
  description?: ReactNode;
37
37
  footer?: ReactElement[] | ((close: () => void) => ReactElement[]);
38
+ ref?: Ref<HTMLDivElement>;
38
39
  } & Pick<DialogProps, "onOpenChange" | "open" | "children">;
39
40
 
40
41
  /**
41
42
  * @beta
42
43
  * @since 2.46.0
43
44
  */
44
- const Dialog = React.forwardRef<HTMLDivElement, Props>(
45
- ({ children, onOpenChange, open, footer, title, trigger, description }, ref) => {
46
- const contentProps = description ? {} : { "aria-describedby": undefined };
47
- const close = useCallback(() => onOpenChange && onOpenChange(false), [onOpenChange]);
48
- const [t] = useTranslation("commons");
49
- return (
50
- <RadixDialog.Root open={open} onOpenChange={onOpenChange}>
51
- <RadixDialog.Trigger asChild>{trigger}</RadixDialog.Trigger>
52
- <RadixDialog.Portal>
53
- <RadixDialog.Overlay className="modal-background" />
54
- <RadixDialog.Content className="modal is-active" ref={ref} {...contentProps}>
55
- <div className="modal-card">
56
- <div className="modal-card-head">
57
- <RadixDialog.Title className="modal-card-title">{title}</RadixDialog.Title>
58
- <RadixDialog.Close asChild>
59
- <button className="delete" aria-label={t("dialog.closeButton.ariaLabel")} />
60
- </RadixDialog.Close>
61
- </div>
62
- <div className="modal-card-body">
63
- {description ? <RadixDialog.Description>{description}</RadixDialog.Description> : null}
64
- {children}
65
- </div>
66
- {footer ? (
67
- <div className="modal-card-foot">{typeof footer === "function" ? footer(close) : footer}</div>
68
- ) : null}
45
+ const Dialog: FC<Props> = ({ children, onOpenChange, open, footer, title, trigger, description, ref }) => {
46
+ const contentProps = description ? {} : { "aria-describedby": undefined };
47
+ const close = useCallback(() => onOpenChange && onOpenChange(false), [onOpenChange]);
48
+ const [t] = useTranslation("commons");
49
+ return (
50
+ <RadixDialog.Root open={open} onOpenChange={onOpenChange}>
51
+ <RadixDialog.Trigger asChild>{trigger}</RadixDialog.Trigger>
52
+ <RadixDialog.Portal>
53
+ <RadixDialog.Overlay className="modal-background" />
54
+ <RadixDialog.Content className="modal is-active" ref={ref} {...contentProps}>
55
+ <div className="modal-card">
56
+ <div className="modal-card-head">
57
+ <RadixDialog.Title className="modal-card-title">{title}</RadixDialog.Title>
58
+ <RadixDialog.Close asChild>
59
+ <button className="delete" aria-label={t("dialog.closeButton.ariaLabel")} />
60
+ </RadixDialog.Close>
69
61
  </div>
70
- </RadixDialog.Content>
71
- </RadixDialog.Portal>
72
- </RadixDialog.Root>
73
- );
74
- }
75
- );
62
+ <div className="modal-card-body">
63
+ {description ? <RadixDialog.Description>{description}</RadixDialog.Description> : null}
64
+ {children}
65
+ </div>
66
+ {footer ? (
67
+ <div className="modal-card-foot">{typeof footer === "function" ? footer(close) : footer}</div>
68
+ ) : null}
69
+ </div>
70
+ </RadixDialog.Content>
71
+ </RadixDialog.Portal>
72
+ </RadixDialog.Root>
73
+ );
74
+ };
76
75
 
77
76
  export default Dialog;
@@ -21,6 +21,7 @@ import React, {
21
21
  createContext,
22
22
  FC,
23
23
  ReactNode,
24
+ Ref,
24
25
  useCallback,
25
26
  useContext,
26
27
  useMemo,
@@ -55,22 +56,23 @@ const MenuItem = styled(RadixMenu.Item).attrs({
55
56
  }
56
57
  `;
57
58
 
58
- type MenuLinkProps = Omit<ReactRouterLinkProps, "onSelect"> & Pick<RadixMenu.MenuItemProps, "disabled">;
59
+ type MenuLinkProps = Omit<ReactRouterLinkProps, "onSelect"> &
60
+ Pick<RadixMenu.MenuItemProps, "disabled"> & { ref?: Ref<HTMLAnchorElement> };
59
61
 
60
62
  /**
61
63
  * @beta
62
64
  * @since 2.44.0
63
65
  */
64
- export const MenuLink = React.forwardRef<HTMLAnchorElement, MenuLinkProps>(({ children, disabled, ...props }, ref) => (
66
+ export const MenuLink: FC<MenuLinkProps> = ({ children, disabled, ref, ...props }) => (
65
67
  <MenuItem asChild disabled={disabled}>
66
68
  <ReactRouterLink ref={ref} {...props}>
67
69
  {children}
68
70
  </ReactRouterLink>
69
71
  </MenuItem>
70
- ));
72
+ );
71
73
 
72
74
  type MenuExternalLinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "onSelect"> &
73
- Pick<RadixMenu.MenuItemProps, "disabled">;
75
+ Pick<RadixMenu.MenuItemProps, "disabled"> & { ref?: Ref<HTMLAnchorElement> };
74
76
 
75
77
  /**
76
78
  * External links open in a new browser tab with rel flags "noopener" and "noreferrer" set by default.
@@ -78,18 +80,16 @@ type MenuExternalLinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "onSe
78
80
  * @beta
79
81
  * @since 2.44.0
80
82
  */
81
- export const MenuExternalLink = React.forwardRef<HTMLAnchorElement, MenuExternalLinkProps>(
82
- ({ children, disabled, ...props }, ref) => (
83
- <MenuItem asChild disabled={disabled}>
84
- <a ref={ref} target="_blank" rel="noopener noreferrer" {...props}>
85
- {children}
86
- </a>
87
- </MenuItem>
88
- )
83
+ export const MenuExternalLink: FC<MenuExternalLinkProps> = ({ children, disabled, ref, ...props }) => (
84
+ <MenuItem asChild disabled={disabled}>
85
+ <a ref={ref} target="_blank" rel="noopener noreferrer" {...props}>
86
+ {children}
87
+ </a>
88
+ </MenuItem>
89
89
  );
90
90
 
91
91
  type MenuButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "onSelect"> &
92
- Pick<RadixMenu.MenuItemProps, "onSelect">;
92
+ Pick<RadixMenu.MenuItemProps, "onSelect"> & { ref?: Ref<HTMLButtonElement> };
93
93
 
94
94
  /**
95
95
  * Use {@link MenuButtonProps#onSelect} to handle menu item selection.
@@ -98,14 +98,12 @@ type MenuButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick" |
98
98
  * @beta
99
99
  * @since 2.44.0
100
100
  */
101
- export const MenuButton = React.forwardRef<HTMLButtonElement, MenuButtonProps>(
102
- ({ children, onSelect, disabled, ...props }, ref) => (
103
- <MenuItem asChild disabled={disabled} onSelect={onSelect}>
104
- <button ref={ref} {...props}>
105
- {children}
106
- </button>
107
- </MenuItem>
108
- )
101
+ export const MenuButton: FC<MenuButtonProps> = ({ children, onSelect, disabled, ref, ...props }) => (
102
+ <MenuItem asChild disabled={disabled} onSelect={onSelect}>
103
+ <button ref={ref} {...props}>
104
+ {children}
105
+ </button>
106
+ </MenuItem>
109
107
  );
110
108
 
111
109
  type MenuContextType = {
@@ -116,6 +114,7 @@ const MenuContext = createContext<MenuContextType>(null as unknown as MenuContex
116
114
  type MenuDialogProps = Omit<MenuButtonProps, "onSelect"> &
117
115
  Omit<ComponentProps<typeof Dialog>, "trigger"> & {
118
116
  dialogContent?: ReactNode;
117
+ ref?: Ref<HTMLButtonElement>;
119
118
  };
120
119
 
121
120
  /**
@@ -123,37 +122,35 @@ type MenuDialogProps = Omit<MenuButtonProps, "onSelect"> &
123
122
  * @since 2.46.0
124
123
  * @see {@link Dialog}
125
124
  */
126
- export const MenuDialog = React.forwardRef<HTMLButtonElement, MenuDialogProps>(
127
- ({ children, dialogContent, title, description, footer }, ref) => {
128
- const { handleDialogItemOpenChange } = useContext(MenuContext);
129
- const [open, setOpen] = useState(false);
130
- const handleSelect = useCallback((event: Event) => event.preventDefault(), []);
131
- const changeOpen = useCallback(
132
- (newValue: boolean) => {
133
- setOpen(newValue);
134
- handleDialogItemOpenChange(newValue);
135
- },
136
- [handleDialogItemOpenChange]
137
- );
138
-
139
- return (
140
- <Dialog
141
- trigger={
142
- <MenuButton ref={ref} onSelect={handleSelect}>
143
- {children}
144
- </MenuButton>
145
- }
146
- title={title}
147
- description={description}
148
- footer={footer}
149
- onOpenChange={changeOpen}
150
- open={open}
151
- >
152
- {dialogContent}
153
- </Dialog>
154
- );
155
- }
156
- );
125
+ export const MenuDialog: FC<MenuDialogProps> = ({ children, dialogContent, title, description, footer, ref }) => {
126
+ const { handleDialogItemOpenChange } = useContext(MenuContext);
127
+ const [open, setOpen] = useState(false);
128
+ const handleSelect = useCallback((event: Event) => event.preventDefault(), []);
129
+ const changeOpen = useCallback(
130
+ (newValue: boolean) => {
131
+ setOpen(newValue);
132
+ handleDialogItemOpenChange(newValue);
133
+ },
134
+ [handleDialogItemOpenChange]
135
+ );
136
+
137
+ return (
138
+ <Dialog
139
+ trigger={
140
+ <MenuButton ref={ref} onSelect={handleSelect}>
141
+ {children}
142
+ </MenuButton>
143
+ }
144
+ title={title}
145
+ description={description}
146
+ footer={footer}
147
+ onOpenChange={changeOpen}
148
+ open={open}
149
+ >
150
+ {dialogContent}
151
+ </Dialog>
152
+ );
153
+ };
157
154
 
158
155
  type Props = {
159
156
  className?: string;
@@ -14,31 +14,31 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { ComponentProps } from "react";
17
+ import React, { ComponentProps, FC, Ref } from "react";
18
18
  import { Button, Icon } from "../../buttons";
19
19
  import * as RadixMenu from "@radix-ui/react-dropdown-menu";
20
20
  import { useTranslation } from "react-i18next";
21
21
  import classNames from "classnames";
22
22
 
23
- type Props = ComponentProps<typeof Button>;
23
+ type Props = ComponentProps<typeof Button> & { ref?: Ref<HTMLButtonElement> };
24
24
 
25
25
  /**
26
26
  * @beta
27
27
  * @since 2.44.0
28
28
  */
29
- const MenuTrigger = React.forwardRef<HTMLButtonElement, Props>(({ children, ...props }, ref) => (
29
+ const MenuTrigger: FC<Props> = ({ children, ref, ...props }) => (
30
30
  <RadixMenu.Trigger asChild>
31
31
  <Button ref={ref} {...props}>
32
32
  {children}
33
33
  </Button>
34
34
  </RadixMenu.Trigger>
35
- ));
35
+ );
36
36
 
37
37
  /**
38
38
  * @beta
39
39
  * @since 2.44.0
40
40
  */
41
- export const DefaultMenuTrigger = React.forwardRef<HTMLButtonElement, Props>(({ className, ...props }, ref) => {
41
+ export const DefaultMenuTrigger: FC<Props> = ({ className, ref, ...props }) => {
42
42
  const [t] = useTranslation("commons");
43
43
  return (
44
44
  <MenuTrigger
@@ -50,6 +50,6 @@ export const DefaultMenuTrigger = React.forwardRef<HTMLButtonElement, Props>(({
50
50
  <Icon>ellipsis-v</Icon>
51
51
  </MenuTrigger>
52
52
  );
53
- });
53
+ };
54
54
 
55
55
  export default MenuTrigger;
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { ReactElement, ReactNode } from "react";
17
+ import React, { FC, ReactElement, ReactNode, Ref } from "react";
18
18
  import * as RadixPopover from "@radix-ui/react-popover";
19
19
  import styled from "styled-components";
20
20
  import classNames from "classnames";
@@ -38,28 +38,26 @@ type Props = {
38
38
  * Element to trigger the popover
39
39
  */
40
40
  trigger: ReactElement;
41
-
42
41
  /**
43
42
  * Element for the content of the popover
44
43
  */
45
44
  children: ReactElement;
46
-
47
45
  /**
48
46
  * Element for the title row of the popover
49
47
  */
50
48
  title: ReactNode;
51
-
52
49
  /**
53
50
  * Classnames for the content of the popover
54
51
  */
55
52
  className?: string;
53
+ ref?: Ref<HTMLDivElement>;
56
54
  };
57
55
 
58
56
  /**
59
57
  * @beta
60
58
  * @since 2.46.0
61
59
  */
62
- const Popover = React.forwardRef<HTMLDivElement, Props>(({ title, className, trigger, children }, ref) => {
60
+ const Popover: FC<Props> = ({ title, className, trigger, children, ref }) => {
63
61
  const [t] = useTranslation("commons");
64
62
 
65
63
  return (
@@ -82,6 +80,6 @@ const Popover = React.forwardRef<HTMLDivElement, Props>(({ title, className, tri
82
80
  </RadixPopover.Portal>
83
81
  </RadixPopover.Root>
84
82
  );
85
- });
83
+ };
86
84
 
87
85
  export default Popover;
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { useState } from "react";
17
+ import React, { FC, Ref, useState } from "react";
18
18
  import Icon from "../../buttons/Icon";
19
19
  import classNames from "classnames";
20
20
  import styled from "styled-components";
@@ -23,11 +23,12 @@ type Props = {
23
23
  message: string;
24
24
  summary: string;
25
25
  className?: string;
26
- }
26
+ ref?: Ref<HTMLButtonElement>;
27
+ };
27
28
 
28
29
  const StyledButton = styled.button`
29
30
  border-radius: 4px !important;
30
- min-width: 2.5rem;
31
+ min-width: 2.5rem;
31
32
  min-height: 24px;
32
33
  border: none;
33
34
  padding: 6px;
@@ -42,8 +43,6 @@ const StyledButton = styled.button`
42
43
  }
43
44
  `;
44
45
 
45
-
46
-
47
46
  /**
48
47
  * An a11y-friendly tooltip replacement that is an expandable hint
49
48
  *
@@ -51,7 +50,7 @@ const StyledButton = styled.button`
51
50
  * @since 3.2.0
52
51
  */
53
52
 
54
- const ExpandableHint = React.forwardRef<HTMLButtonElement, Props>(({ message, summary, className }, ref) => {
53
+ const ExpandableHint: FC<Props> = ({ message, summary, className, ref }) => {
55
54
  const [isOpen, setOpen] = useState<boolean>(false);
56
55
  return (
57
56
  <>
@@ -63,12 +62,12 @@ const ExpandableHint = React.forwardRef<HTMLButtonElement, Props>(({ message, su
63
62
  className={classNames(className, "is-flex")}
64
63
  ref={ref}
65
64
  >
66
- {isOpen ? <Icon className="is-small">chevron-down</Icon> : <Icon className="is-small">chevron-right</Icon>}
65
+ {isOpen ? <Icon className="is-small">chevron-down</Icon> : <Icon className="is-small">chevron-right</Icon>}
67
66
  {summary}
68
67
  </StyledButton>
69
68
  {isOpen ? <p className="mt-2 is-size-7">{message}</p> : undefined}
70
69
  </>
71
70
  );
72
- });
71
+ };
73
72
 
74
73
  export default ExpandableHint;
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { ReactElement, ReactNode } from "react";
17
+ import React, { FC, ReactElement, ReactNode, Ref } from "react";
18
18
  import * as RadixTooltip from "@radix-ui/react-tooltip";
19
19
  import classNames from "classnames";
20
20
  import styled from "styled-components";
@@ -49,6 +49,7 @@ type Props = {
49
49
  * Class to be applied to the content container.
50
50
  */
51
51
  className?: string;
52
+ ref?: Ref<HTMLDivElement>;
52
53
  } & Pick<RadixTooltip.TooltipContentProps, "side">;
53
54
 
54
55
  /**
@@ -57,7 +58,7 @@ type Props = {
57
58
  * @since 2.41.0
58
59
  * @beta
59
60
  */
60
- const Tooltip = React.forwardRef<HTMLDivElement, Props>(({ children, className, message, side }, ref) => (
61
+ const Tooltip: FC<Props> = ({ children, className, message, side, ref }) => (
61
62
  <RadixTooltip.Provider>
62
63
  <RadixTooltip.Root>
63
64
  <RadixTooltip.Trigger asChild>{children}</RadixTooltip.Trigger>
@@ -84,5 +85,6 @@ const Tooltip = React.forwardRef<HTMLDivElement, Props>(({ children, className,
84
85
  </RadixTooltip.Portal>
85
86
  </RadixTooltip.Root>
86
87
  </RadixTooltip.Provider>
87
- ));
88
+ );
89
+
88
90
  export default Tooltip;