diff --git a/package.json b/package.json
index 9d2007e6..c741297a 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "onyxia-ui",
- "version": "5.3.6",
+ "version": "5.3.7-rc.0",
"description": "The Onyxia UI toolkit",
"repository": {
"type": "git",
diff --git a/src/BaseBar.tsx b/src/BaseBar.tsx
new file mode 100644
index 00000000..fad77dc1
--- /dev/null
+++ b/src/BaseBar.tsx
@@ -0,0 +1,27 @@
+import { ReactNode } from "react";
+import { tss } from "./lib/tss";
+import { symToStr } from "tsafe/symToStr";
+
+export type BaseBarProps = {
+ className?: string;
+ children: ReactNode;
+};
+
+export function BaseBar(props: BaseBarProps) {
+ const { className, children } = props;
+
+ const { classes, cx } = useStyles();
+
+ return
{children}
;
+}
+
+BaseBar.displayName = symToStr({ BaseBar });
+
+const useStyles = tss.withName({ BaseBar }).create(({ theme }) => ({
+ "root": {
+ "backgroundColor": theme.colors.useCases.surfaces.surface1,
+ "boxShadow": theme.shadows[1],
+ "borderRadius": 8,
+ "overflow": "hidden",
+ },
+}));
diff --git a/src/ButtonBar.tsx b/src/ButtonBar.tsx
index 4a5b1ba9..b5c2a535 100644
--- a/src/ButtonBar.tsx
+++ b/src/ButtonBar.tsx
@@ -1,8 +1,8 @@
import { memo, ReactNode } from "react";
-import { tss } from "./lib/tss";
import { useCallbackFactory } from "powerhooks/useCallbackFactory";
import { ButtonBarButton } from "./ButtonBarButton";
import { symToStr } from "tsafe/symToStr";
+import { BaseBar } from "./BaseBar";
export type ButtonBarProps = {
className?: string;
@@ -41,14 +41,12 @@ function NonMemoizedButtonBar(
) {
const { className, buttons, onClick } = props;
- const { classes, cx } = useStyles();
-
const onClickFactory = useCallbackFactory(([buttonId]: [ButtonId]) =>
onClick(buttonId),
);
return (
-
+
{buttons.map(button => (
(
{button.label}
))}
-
+
);
}
@@ -80,12 +78,3 @@ export const ButtonBar = memo(NonMemoizedButtonBar) as <
) => ReturnType;
(ButtonBar as any).displayName = symToStr({ ButtonBar });
-
-const useStyles = tss.withName({ ButtonBar }).create(({ theme }) => ({
- "root": {
- "backgroundColor": theme.colors.useCases.surfaces.surface1,
- "boxShadow": theme.shadows[1],
- "borderRadius": 8,
- "overflow": "hidden",
- },
-}));
diff --git a/src/ButtonBarButton.tsx b/src/ButtonBarButton.tsx
index f0bb0502..4c7697b4 100644
--- a/src/ButtonBarButton.tsx
+++ b/src/ButtonBarButton.tsx
@@ -1,5 +1,5 @@
import type { ReactNode } from "react";
-import { memo } from "react";
+import { forwardRef, memo } from "react";
import { tss } from "./lib/tss";
import { Button } from "./Button";
import { symToStr } from "tsafe/symToStr";
@@ -28,23 +28,26 @@ export namespace ButtonBarButtonProps {
};
}
-export const ButtonBarButton = memo((props: ButtonBarButtonProps) => {
- const { className, startIcon, disabled, children, ...rest } = props;
+export const ButtonBarButton = memo(
+ forwardRef((props, ref) => {
+ const { className, startIcon, disabled, children, ...rest } = props;
- const { classes, cx } = useStyles();
+ const { classes, cx } = useStyles();
- return (
-
- );
-});
+ return (
+
+ );
+ }),
+);
ButtonBarButton.displayName = symToStr({ ButtonBarButton });