diff --git a/package.json b/package.json index 44f09a8be..555c7b0e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ably/ui", - "version": "15.1.8", + "version": "15.1.9", "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.", "repository": { "type": "git", diff --git a/src/core/Icon/__snapshots__/Icon.stories.tsx.snap b/src/core/Icon/__snapshots__/Icon.stories.tsx.snap index 884381b56..d2dfcc971 100644 --- a/src/core/Icon/__snapshots__/Icon.stories.tsx.snap +++ b/src/core/Icon/__snapshots__/Icon.stories.tsx.snap @@ -1526,6 +1526,29 @@ exports[`Components/Icon EncapsulatedIcons smoke-test 1`] = ` +
+ icon-product-platform
+
+
icon-product-pubsub-mono
@@ -2548,6 +2571,21 @@ exports[`Components/Icon ProductIcons smoke-test 1`] = `
+ icon-product-platform
+
+
icon-product-pubsub-mono
diff --git a/src/core/TabMenu.tsx b/src/core/TabMenu.tsx
index e75937c8f..f515eb3da 100644
--- a/src/core/TabMenu.tsx
+++ b/src/core/TabMenu.tsx
@@ -27,6 +27,16 @@ export type TabMenuProps = {
*/
tabClassName?: string;
+ /**
+ * An optional class name to apply to the Tabs.Root element.
+ */
+ rootClassName?: string;
+
+ /**
+ * An optional class name to apply to the Tabs.Content element.
+ */
+ contentClassName?: string;
+
/**
* Optional configuration options for the TabMenu.
*/
@@ -58,24 +68,37 @@ export type TabMenuProps = {
};
};
+const DEFAULT_TAILWIND_ANIMATION_DURATION = 150;
+
const TabMenu: React.FC = ({
tabs = [],
contents = [],
tabOnClick,
tabClassName,
+ rootClassName,
+ contentClassName,
options,
}) => {
const {
defaultTabIndex = 0,
underline = true,
- animated = true,
+ animated: animatedOption = true,
flexibleTabWidth = false,
flexibleTabHeight = false,
} = options ?? {};
const listRef = React.useRef(null);
+ const [animated, setAnimated] = React.useState(false);
const [highlight, setHighlight] = React.useState({ offset: 0, width: 0 });
+ useEffect(() => {
+ if (animatedOption && highlight.width > 0) {
+ setTimeout(() => {
+ setAnimated(true);
+ }, DEFAULT_TAILWIND_ANIMATION_DURATION);
+ }
+ }, [animatedOption, highlight.width]);
+
useEffect(() => {
const handleResize = throttle(() => {
const activeTabElement =
@@ -118,7 +141,7 @@ const TabMenu: React.FC = ({
return (
= ({
>