@beydesign/storybook 0.2.6 → 0.2.7

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { MobileNavBarProps } from './types';
3
+ export declare const MobileNavBar: React.FC<MobileNavBarProps>;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Box, Drawer as MuiDrawer } from '@mui/material';
4
+ import { Logo } from '../UI';
5
+ import { Drawer } from '../Drawer';
6
+ import { getIconComponent } from '../../utils';
7
+ const shadowXs = 'var(--global-shadows-shadow-xs-offset-x) ' +
8
+ 'var(--global-shadows-shadow-xs-offset-y) ' +
9
+ 'var(--global-shadows-shadow-xs-blur) ' +
10
+ 'var(--global-shadows-shadow-xs-spread) ' +
11
+ 'var(--global-shadows-shadow-xs-color)';
12
+ const NavIconButton = ({ icon, ariaLabel, onClick, }) => (_jsx(Box, { component: 'button', type: 'button', onClick: onClick, "aria-label": ariaLabel, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0, padding: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', border: '1px solid var(--color-border-border-component)', borderRadius: 'var(--spacing-tokens-size-in-px-radius-radius-xs)', sx: {
13
+ backgroundColor: 'transparent',
14
+ cursor: 'pointer',
15
+ boxShadow: shadowXs,
16
+ '&:focus-visible': {
17
+ outline: '2px solid var(--color-border-border-component-active)',
18
+ outlineOffset: '2px',
19
+ },
20
+ }, children: getIconComponent(icon, {
21
+ width: '20px',
22
+ height: '20px',
23
+ color: 'var(--color-foreground-fg-secondary)',
24
+ 'aria-hidden': 'true',
25
+ }) }));
26
+ export const MobileNavBar = ({ onSearchClick, drawerProps, showSearch = true, logoProps, style, className, }) => {
27
+ const [open, setOpen] = useState(false);
28
+ const handleMenuClick = () => {
29
+ if (drawerProps)
30
+ setOpen(true);
31
+ };
32
+ const closeDrawer = () => setOpen(false);
33
+ const navItems = drawerProps?.navItems.map((item) => ({
34
+ ...item,
35
+ onClick: () => {
36
+ item.onClick?.();
37
+ closeDrawer();
38
+ },
39
+ }));
40
+ return (_jsxs(_Fragment, { children: [_jsxs(Box, { className: className, sx: style, boxSizing: 'border-box', display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%', height: '60px', paddingX: 'var(--spacing-tokens-size-in-px-spacing-spacing-xl)', borderBottom: '1px solid var(--color-border-border-component)', bgcolor: 'var(--color-background-bg-page)', children: [_jsx(Box, { display: 'flex', alignItems: 'center', sx: { '& svg': { display: 'block', height: '20px', width: 'auto' } }, children: _jsx(Logo, { color: 'var(--color-foreground-fg-brand-logo)', ...logoProps }) }), _jsxs(Box, { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-end', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-md)', children: [showSearch && (_jsx(NavIconButton, { icon: 'MagnifyingGlass', ariaLabel: 'Search', onClick: onSearchClick })), _jsx(NavIconButton, { icon: 'List', ariaLabel: 'Open menu', onClick: handleMenuClick })] })] }), drawerProps && navItems && (_jsx(MuiDrawer, { anchor: 'left', open: open, onClose: closeDrawer, PaperProps: {
41
+ sx: { backgroundColor: 'transparent', boxShadow: 'none' },
42
+ }, children: _jsx(Drawer, { ...drawerProps, navItems: navItems, showToggle: false }) }))] }));
43
+ };
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { MobileNavBar } from './MobileNavBar';
3
+ declare const meta: Meta<typeof MobileNavBar>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const WithoutDrawer: Story;
8
+ export declare const MenuOnly: Story;
@@ -0,0 +1,75 @@
1
+ import { MobileNavBar } from './MobileNavBar';
2
+ const navItems = [
3
+ { key: 'home', text: 'Home', icon: 'House' },
4
+ { key: 'avatars', text: 'Avatars', icon: 'UserFocus' },
5
+ { key: 'agents', text: 'My Agents', icon: 'Headset' },
6
+ { key: 'ttv', text: 'Text-to-Video', icon: 'VideoCamera' },
7
+ { key: 'kb', text: 'Knowledge Base', icon: 'Book' },
8
+ { key: 'conversations', text: 'Conversations', icon: 'ChatTeardropDots' },
9
+ { key: 'analytics', text: 'Analytics', icon: 'ChartBar' },
10
+ { key: 'api', text: 'API keys', icon: 'Key' },
11
+ { key: 'developers', text: 'Developers', icon: 'BracketsCurly' },
12
+ ];
13
+ const drawerProps = {
14
+ navItems,
15
+ activeKey: 'kb',
16
+ credits: { usedCredits: 500, maxCredits: 2000 },
17
+ profile: {
18
+ name: 'Emma Novak',
19
+ email: 'emma@example.com',
20
+ },
21
+ };
22
+ const meta = {
23
+ title: 'Design System/Components/Navigation/MobileNavBar',
24
+ component: MobileNavBar,
25
+ parameters: {
26
+ layout: 'fullscreen',
27
+ design: {
28
+ type: 'figspec',
29
+ url: 'https://www.figma.com/design/mIhjz2yJjcpLlIqw6oUivt/Beyond-Presence?node-id=7079-12927',
30
+ },
31
+ },
32
+ tags: ['autodocs'],
33
+ argTypes: {
34
+ onSearchClick: {
35
+ description: 'Callback fired when the search button is clicked',
36
+ table: { type: { summary: 'function' } },
37
+ },
38
+ drawerProps: {
39
+ control: false,
40
+ description: 'Drawer config. When provided, the menu button opens the navigation drawer as an overlay.',
41
+ table: { type: { summary: 'DrawerProps' } },
42
+ },
43
+ showSearch: {
44
+ control: 'boolean',
45
+ description: 'Whether to show the search button',
46
+ table: {
47
+ type: { summary: 'boolean' },
48
+ defaultValue: { summary: 'true' },
49
+ },
50
+ },
51
+ logoProps: {
52
+ control: 'object',
53
+ description: 'Logo customization props',
54
+ table: { type: { summary: 'object' } },
55
+ },
56
+ },
57
+ };
58
+ export default meta;
59
+ export const Default = {
60
+ args: {
61
+ showSearch: true,
62
+ drawerProps,
63
+ },
64
+ };
65
+ export const WithoutDrawer = {
66
+ args: {
67
+ showSearch: true,
68
+ },
69
+ };
70
+ export const MenuOnly = {
71
+ args: {
72
+ showSearch: false,
73
+ drawerProps,
74
+ },
75
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './Header';
2
+ export * from './MobileNavBar';
2
3
  export * from './NavItem';
3
4
  export * from './Sidebar';
4
5
  export * from './types';
@@ -1,4 +1,5 @@
1
1
  export * from './Header';
2
+ export * from './MobileNavBar';
2
3
  export * from './NavItem';
3
4
  export * from './Sidebar';
4
5
  export * from './types';
@@ -2,6 +2,7 @@ import { SxProps, Theme } from '@mui/material';
2
2
  import { IconName } from '../../utils';
3
3
  import { AvatarProps } from '../UI';
4
4
  import { CreditsCardProps } from '../Credits';
5
+ import { DrawerProps } from '../Drawer';
5
6
  /**
6
7
  * Header component props
7
8
  */
@@ -184,3 +185,27 @@ export interface ProcessHeaderProps {
184
185
  /** The class name to apply to the component */
185
186
  className?: string;
186
187
  }
188
+ /**
189
+ * Mobile navigation bar props
190
+ */
191
+ export interface MobileNavBarProps {
192
+ /** Callback fired when the search button is clicked */
193
+ onSearchClick?: () => void;
194
+ /**
195
+ * Drawer configuration. When provided, clicking the menu button slides the
196
+ * navigation drawer in as an overlay.
197
+ */
198
+ drawerProps?: DrawerProps;
199
+ /** Whether to show the search button */
200
+ showSearch?: boolean;
201
+ /** Logo customization props */
202
+ logoProps?: {
203
+ gradient?: string;
204
+ color?: string;
205
+ svgUrl?: string;
206
+ };
207
+ /** The style object to apply to the component */
208
+ style?: SxProps<Theme>;
209
+ /** The class name to apply to the component */
210
+ className?: string;
211
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.2.6",
4
+ "version": "0.2.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",