@vrobots/storybook 0.1.55 → 0.1.57
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 +1 -1
- package/dist/src/components/AvatarIconMenu.d.ts +5 -2
- package/dist/src/components/AvatarIconMenu.js +7 -5
- package/dist/src/components/Menu.d.ts +2 -0
- package/dist/src/components/Page.d.ts +2 -3
- package/dist/src/components/Page.js +4 -2
- package/dist/src/stories/AvatarIconMenu.stories.d.ts +1 -1
- package/dist/src/stories/AvatarIconMenu.stories.js +1 -0
- package/dist/src/stories/Frame.stories.js +1 -1
- package/dist/src/stories/Header.stories.js +1 -1
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { IMenuItemsProps } from "./Menu";
|
|
2
|
+
import React from "react";
|
|
2
3
|
export interface IAvatarIconMenuProps {
|
|
3
4
|
src: string;
|
|
4
5
|
name: string;
|
|
5
6
|
menu: IMenuItemsProps[];
|
|
7
|
+
onClick: (value: string) => void;
|
|
8
|
+
children?: React.ReactNode;
|
|
6
9
|
}
|
|
7
|
-
export declare const createMenuItem: (item: IMenuItemsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare const AvatarIconMenu: ({ src, name, menu, }: IAvatarIconMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const createMenuItem: (onClick: (value: string) => void) => (item: IMenuItemsProps, key: number) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const AvatarIconMenu: ({ src, name, menu, onClick, children, }: IAvatarIconMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Avatar, Menu, Portal } from "@chakra-ui/react";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import * as Icons from "react-icons/md";
|
|
4
|
+
import React from "react";
|
|
5
|
+
export const createMenuItem = (onClick) => (item, key) => {
|
|
6
|
+
return (_jsxs(Menu.Item, { value: item.value, onClick: () => onClick(item.value), children: [Icons[item.icon || ''] ? React.createElement(Icons[item.icon]) : null, " ", item.label] }, key + item.value));
|
|
5
7
|
};
|
|
6
|
-
export const AvatarIconMenu = ({ src, name, menu, }) => {
|
|
7
|
-
return (_jsxs(Menu.Root, { positioning: { placement: "right-end" }, children: [_jsx(Menu.Trigger, { rounded: "full", focusRing: "outside", children: _jsxs(Avatar.Root, { size: { base: 'xs', md: 'sm' }, children: [_jsx(Avatar.Fallback, { name: name }), _jsx(Avatar.Image, { src: src })] }) }), _jsx(Portal, { children: _jsx(Menu.Positioner, { children:
|
|
8
|
+
export const AvatarIconMenu = ({ src, name, menu, onClick, children, }) => {
|
|
9
|
+
return (_jsxs(Menu.Root, { positioning: { placement: "right-end" }, children: [_jsx(Menu.Trigger, { rounded: "full", focusRing: "outside", children: _jsxs(Avatar.Root, { size: { base: 'xs', md: 'sm' }, children: [_jsx(Avatar.Fallback, { name: name }), _jsx(Avatar.Image, { src: src })] }) }), _jsx(Portal, { children: _jsx(Menu.Positioner, { children: _jsxs(Menu.Content, { children: [menu.map(createMenuItem(onClick)), children] }) }) })] }));
|
|
8
10
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { IBreadcrumb } from "./Breadcrumbs";
|
|
2
|
+
import React from "react";
|
|
2
3
|
export interface IPageProps {
|
|
3
4
|
breadcrumbs?: IBreadcrumb[];
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
export declare const Page: {
|
|
7
8
|
({ breadcrumbs, children }: IPageProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
Flex({ children }:
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
Flex({ children, breadcrumbs }: IPageProps): import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
};
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box } from "@chakra-ui/react";
|
|
3
3
|
import { Breadcrumbs } from "./Breadcrumbs";
|
|
4
4
|
import { useHeader } from "./Header";
|
|
5
|
+
import React from "react";
|
|
5
6
|
export const Page = ({ breadcrumbs, children }) => {
|
|
6
7
|
return (_jsxs(Box, { flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'stretch', overflow: 'hidden', minHeight: '100%', p: 4, children: [_jsx(Breadcrumbs, { breadcrumbs: breadcrumbs }), _jsx(Box, { flex: '1 1 auto', mt: !!breadcrumbs?.length ? 2 : 0, children: children })] }));
|
|
7
8
|
};
|
|
8
|
-
Page.Flex = ({ children }) => {
|
|
9
|
+
Page.Flex = ({ children, breadcrumbs }) => {
|
|
9
10
|
const { ref: headerRef } = useHeader();
|
|
10
|
-
|
|
11
|
+
const breadcrumbsRef = React.useRef(null);
|
|
12
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Breadcrumbs, { breadcrumbs: breadcrumbs, ref: breadcrumbsRef }), _jsx(Box, { display: "flex", justifyContent: "center", alignItems: "center", height: `calc(100vh - ${((headerRef.current?.offsetHeight || 0) * 2) + (breadcrumbsRef.current?.offsetHeight || 0)}px)`, children: children })] }));
|
|
11
13
|
};
|
|
@@ -2,7 +2,7 @@ import type { StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { IMenuItemsProps } from '../components';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ src, name, menu, }: import("../components").IAvatarIconMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
component: ({ src, name, menu, onClick, children, }: import("../components").IAvatarIconMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
@@ -18,7 +18,7 @@ const menu = (_jsx(AvatarIconMenu, { name: "Segun Adebayo", src: "https://bit.ly
|
|
|
18
18
|
{ label: 'Account', value: 'account' },
|
|
19
19
|
{ label: 'Settings', value: 'settings' },
|
|
20
20
|
{ label: 'Logout', value: 'logout' },
|
|
21
|
-
] }));
|
|
21
|
+
], onClick: (value) => console.log(value) }));
|
|
22
22
|
const meta = {
|
|
23
23
|
title: 'Frame/Frame',
|
|
24
24
|
component: Frame,
|
|
@@ -10,7 +10,7 @@ const menu = (_jsx(AvatarIconMenu, { name: "Segun Adebayo", src: "https://bit.ly
|
|
|
10
10
|
{ label: 'Account', value: 'account' },
|
|
11
11
|
{ label: 'Settings', value: 'settings' },
|
|
12
12
|
{ label: 'Logout', value: 'logout' },
|
|
13
|
-
] }));
|
|
13
|
+
], onClick: (value) => console.log(value) }));
|
|
14
14
|
const meta = {
|
|
15
15
|
title: 'Frame/Header',
|
|
16
16
|
component: Header,
|