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CACvD,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { AppShell } from '@pega/cosmos-react-wss';\nimport type { AppShellProps, NotificationItem } from '@pega/cosmos-react-wss';\nimport { Banner, Icon } from '@pega/cosmos-react-core';\nimport type { ContextSwitcherProps } from '@pega/cosmos-react-core';\n\nimport { DefaultMainContent, notificationItems } from './AppShell.mocks';\n\nexport default {\n  title: 'Web Self Service/AppShell',\n  component: AppShell,\n  parameters: {\n    layout: 'fullscreen'\n  }\n} as Meta;\n\ninterface AppShellDemoProps {\n  appName?: AppShellProps['appInfo']['appName'];\n  banner?: boolean;\n  imageSrc?: AppShellProps['appInfo']['imageSrc'];\n  numberOfNavLinks?: number;\n  navAlignment?: AppShellProps['navAlignment'];\n  navPosition?: AppShellProps['navPosition'];\n  operatorName?: AppShellProps['operator']['avatar']['name'];\n  operatorTitle?: AppShellProps['operator']['title'];\n  notificationsEmpty?: boolean;\n  notificationsLoading?: boolean;\n  mainContent?: ReactNode;\n}\n\nexport const AppShellDemo: StoryFn<AppShellDemoProps> = (args: AppShellDemoProps) => {\n  const [mainContent, setMainContent] = useState('Home');\n  const [notifications, setNotifications] = useState<NotificationItem[]>(notificationItems);\n  const [numNewNotifications, setNumNewNotifications] = useState(\n    notifications.filter(x => x.unread).length\n  );\n  const handleNotificationClick = (passedId: string) => {\n    setNotifications(cur =>\n      cur.map(({ id, unread, ...item }) => ({\n        id,\n        unread: passedId === id ? false : unread,\n        ...item\n      }))\n    );\n  };\n\n  const [contexts, setContexts] = useState<ContextSwitcherProps['contexts']>([\n    {\n      id: '1',\n      primary: 'Medical',\n      selected: true,\n      visual: <Icon name='heart-pulse-solid' />\n    },\n    {\n      id: '2',\n      primary: 'Vision',\n      selected: false,\n      visual: <Icon name='glasses-solid' />\n    }\n  ]);\n\n  return (\n    <AppShell\n      main={args.mainContent ?? <DefaultMainContent content={mainContent} banners={args.banner} />}\n      banners={args.banner ? <Banner variant='urgent' messages={['Example banner']} /> : undefined}\n      appInfo={{\n        appName: args.appName ?? 'Service Desk',\n        imageSrc: args.imageSrc,\n        onClick: () => setMainContent('Home')\n      }}\n      contextSwitcher={{\n        contexts,\n        onContextClick: (id: string) =>\n          setContexts(cur => cur!.map(ctx => ({ ...ctx, selected: id === ctx.id })))\n      }}\n      navLinks={Array.from({\n        length: args.numberOfNavLinks ?? 3\n      }).map((_, index) => {\n        const navName = `Navigation ${index + 1}`;\n\n        return {\n          id: `nav-${index + 1}`,\n          text: navName,\n          href: '#',\n          onClick: () => setMainContent(navName),\n          active: navName === mainContent\n        };\n      })}\n      operator={{\n        avatar: { name: args.operatorName ?? 'Cindy Turner' },\n        title: args.operatorTitle ?? 'Account',\n        actions: [\n          { id: 'profile', primary: 'My profile', href: '#' },\n          { id: 'settings', primary: 'Settings', href: '#' },\n          { id: 'logOut', primary: 'Log out', href: '#' }\n        ]\n      }}\n      notifications={{\n        title: 'Notifications',\n        count: numNewNotifications,\n        items: args.notificationsEmpty ? [] : notifications,\n        onItemClick: handleNotificationClick,\n        loading: args.notificationsLoading,\n        onNotificationsOpen: () => {\n          setNumNewNotifications(0);\n        }\n      }}\n      navAlignment={args.navAlignment}\n      navPosition={args.navPosition}\n    />\n  );\n};\n\nAppShellDemo.args = {\n  imageSrc: 'https://www.pega.com/themes/custom/pegawww_theme/images/pega-logo.svg',\n  appName: 'Service Desk',\n  banner: false,\n  numberOfNavLinks: 3,\n  navAlignment: 'end',\n  navPosition: 'inline',\n  operatorName: 'Cindy Turner',\n  operatorTitle: 'Account',\n  notificationsEmpty: false,\n  notificationsLoading: false\n};\n\nAppShellDemo.argTypes = {\n  imageSrc: { control: { type: 'text' } },\n  appName: { control: { type: 'text' } },\n  banner: { control: { type: 'boolean' } },\n  numberOfNavLinks: { control: { type: 'number' } },\n  navAlignment: { options: ['start', 'center', 'end'], control: { type: 'select' } },\n  navPosition: { options: ['inline', 'below'], control: { type: 'select' } },\n  operatorName: { control: { type: 'text' } },\n  operatorTitle: { control: { type: 'text' } },\n  notificationsEmpty: { control: { type: 'boolean' } },\n  notificationsLoading: { control: { type: 'boolean' } }\n};\n"]}