@vrobots/storybook 0.1.70 → 0.1.72
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.
package/dist/package.json
CHANGED
|
@@ -30,6 +30,7 @@ export const Sidebar = forwardRef((props, ref) => {
|
|
|
30
30
|
const { colorMode } = useColorMode();
|
|
31
31
|
const breakpoint = useBreakpoint();
|
|
32
32
|
const isMobile = useIsMobile();
|
|
33
|
+
const [mounted, setMounted] = React.useState(false);
|
|
33
34
|
const width = {
|
|
34
35
|
base: '100vw',
|
|
35
36
|
sm: '100vw',
|
|
@@ -44,12 +45,15 @@ export const Sidebar = forwardRef((props, ref) => {
|
|
|
44
45
|
transition: { duration: 0.2 }
|
|
45
46
|
};
|
|
46
47
|
const close = {
|
|
47
|
-
initial: { width: width[breakpoint || 'base'] },
|
|
48
|
+
initial: { width: !mounted ? '0' : width[breakpoint || 'base'] },
|
|
48
49
|
animate: { width: '0' },
|
|
49
50
|
transition: { duration: 0.2 }
|
|
50
51
|
};
|
|
51
52
|
const action = isMobile ? sidebar.isOpen ? open : close : {};
|
|
52
53
|
const borderColor = colorMode === 'light' ? COLOR_GRAY_200 : COLOR_GRAY_800;
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
setMounted(true);
|
|
56
|
+
}, []);
|
|
53
57
|
if (!sidebar.menu)
|
|
54
58
|
return null;
|
|
55
59
|
return (_jsx(React.Fragment, { children: _jsx(motion.div, { style: {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tooltip as ChakraTooltip } from "@chakra-ui/react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface TooltipProps extends ChakraTooltip.RootProps {
|
|
4
|
+
showArrow?: boolean;
|
|
5
|
+
portalled?: boolean;
|
|
6
|
+
portalRef?: React.RefObject<HTMLElement | null>;
|
|
7
|
+
content: React.ReactNode;
|
|
8
|
+
contentProps?: ChakraTooltip.ContentProps;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as ChakraTooltip, Portal } from "@chakra-ui/react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export const Tooltip = React.forwardRef(function Tooltip(props, ref) {
|
|
5
|
+
const { showArrow, children, disabled, portalled = true, content, contentProps, portalRef, ...rest } = props;
|
|
6
|
+
if (disabled)
|
|
7
|
+
return children;
|
|
8
|
+
return (_jsxs(ChakraTooltip.Root, { ...rest, children: [_jsx(ChakraTooltip.Trigger, { asChild: true, children: children }), _jsx(Portal, { disabled: !portalled, container: portalRef, children: _jsx(ChakraTooltip.Positioner, { children: _jsxs(ChakraTooltip.Content, { ref: ref, ...contentProps, children: [showArrow && (_jsx(ChakraTooltip.Arrow, { children: _jsx(ChakraTooltip.ArrowTip, {}) })), content] }) }) })] }));
|
|
9
|
+
});
|