@servicetitan/navigation 12.0.3 → 13.0.0-canary.256.299dd08.0
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/components/counter-tag.d.ts +1 -1
- package/dist/components/counter-tag.d.ts.map +1 -1
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/profile-dropdown/interface.d.ts +55 -0
- package/dist/components/profile-dropdown/interface.d.ts.map +1 -0
- package/dist/components/profile-dropdown/interface.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts +13 -0
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +9 -79
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +22 -22
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/interface-internal.d.ts +12 -0
- package/dist/components/titan-layout/interface-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/interface-internal.js.map +1 -1
- package/dist/components/titan-layout/interface.d.ts +67 -14
- package/dist/components/titan-layout/interface.d.ts.map +1 -1
- package/dist/components/titan-layout/interface.js.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.js +21 -11
- package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links-internal.d.ts +22 -3
- package/dist/components/titan-layout/layout-header-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links-internal.js +15 -18
- package/dist/components/titan-layout/layout-header-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links.d.ts +3 -4
- package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links.js +25 -5
- package/dist/components/titan-layout/layout-header-links.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts +2 -2
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +31 -0
- package/dist/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/dist/components/titan-layout/layout-profile.d.ts +8 -5
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +30 -28
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +48 -31
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +84 -83
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts +3 -3
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +32 -19
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +51 -28
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.module.less +74 -22
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts +16 -0
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts +10 -0
- package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-links.d.ts +5 -0
- package/dist/components/titan-layout/titan-layout-links.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-links.js +34 -0
- package/dist/components/titan-layout/titan-layout-links.js.map +1 -0
- package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts +10 -0
- package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout.d.ts +5 -4
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +17 -11
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/test/data.d.ts +26 -23
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +26 -69
- package/dist/test/data.js.map +1 -1
- package/dist/test/titan-layout.d.ts +16 -0
- package/dist/test/titan-layout.d.ts.map +1 -0
- package/dist/test/titan-layout.js +21 -0
- package/dist/test/titan-layout.js.map +1 -0
- package/dist/utils/navigation-context.d.ts +3 -22
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js +2 -10
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation.d.ts +2 -7
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/navigation.js.map +1 -1
- package/package.json +2 -2
- package/src/components/counter-tag.tsx +1 -1
- package/src/components/profile-dropdown/interface.ts +47 -0
- package/src/components/profile-dropdown/profile-dropdown-legacy.stories.tsx +25 -0
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +15 -7
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +50 -43
- package/src/components/profile-dropdown/profile-dropdown.tsx +39 -115
- package/src/components/titan-layout/interface-internal.ts +13 -0
- package/src/components/titan-layout/interface.ts +73 -17
- package/src/components/titan-layout/layout-header-dark.tsx +17 -4
- package/src/components/titan-layout/layout-header-links-internal.tsx +41 -54
- package/src/components/titan-layout/layout-header-links.tsx +65 -12
- package/src/components/titan-layout/layout-header.module.less +31 -0
- package/src/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/src/components/titan-layout/layout-header.tsx +2 -2
- package/src/components/titan-layout/layout-profile.tsx +53 -34
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +183 -147
- package/src/components/titan-layout/layout-sidebar-links.tsx +73 -26
- package/src/components/titan-layout/layout-sidebar.module.less +74 -22
- package/src/components/titan-layout/layout-sidebar.tsx +55 -31
- package/src/components/titan-layout/{titan-layout.stories.tsx → titan-layout-default.stories.tsx} +131 -114
- package/src/components/titan-layout/titan-layout-legacy.stories.tsx +24 -0
- package/src/components/titan-layout/titan-layout-links.tsx +34 -0
- package/src/components/titan-layout/titan-layout-stacked.stories.tsx +30 -0
- package/src/components/titan-layout/titan-layout.tsx +16 -11
- package/src/index.ts +1 -12
- package/src/test/data.tsx +31 -83
- package/src/test/titan-layout.tsx +34 -0
- package/src/utils/navigation-context.tsx +9 -35
- package/src/utils/navigation.ts +3 -10
- package/dist/components/header-navigation/header-navigation-content.d.ts +0 -30
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-content.js +0 -58
- package/dist/components/header-navigation/header-navigation-content.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts +0 -9
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +0 -11
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.js +0 -62
- package/dist/components/header-navigation/header-navigation-links.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-stories.module.less +0 -6
- package/dist/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/dist/components/header-navigation/header-navigation.d.ts +0 -59
- package/dist/components/header-navigation/header-navigation.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation.js +0 -228
- package/dist/components/header-navigation/header-navigation.js.map +0 -1
- package/dist/components/header-navigation/header-navigation.module.less +0 -260
- package/dist/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/dist/components/header-navigation/header-navigation.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/index.d.ts +0 -2
- package/dist/components/header-navigation/index.d.ts.map +0 -1
- package/dist/components/header-navigation/index.js +0 -3
- package/dist/components/header-navigation/index.js.map +0 -1
- package/dist/components/header-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/header-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/header-navigation/with-tooltip.js +0 -10
- package/dist/components/header-navigation/with-tooltip.js.map +0 -1
- package/dist/components/layout.stories.d.ts +0 -13
- package/dist/components/layout.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts +0 -9
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +0 -18
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +0 -79
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.d.ts +0 -23
- package/dist/components/left-navigation/header-navigation-tiny.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.js +0 -32
- package/dist/components/left-navigation/header-navigation-tiny.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.module.less +0 -117
- package/dist/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts +0 -12
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/index.d.ts +0 -5
- package/dist/components/left-navigation/index.d.ts.map +0 -1
- package/dist/components/left-navigation/index.js +0 -5
- package/dist/components/left-navigation/index.js.map +0 -1
- package/dist/components/left-navigation/interface-internal.d.ts +0 -10
- package/dist/components/left-navigation/interface-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/interface-internal.js +0 -3
- package/dist/components/left-navigation/interface-internal.js.map +0 -1
- package/dist/components/left-navigation/interface.d.ts +0 -20
- package/dist/components/left-navigation/interface.d.ts.map +0 -1
- package/dist/components/left-navigation/interface.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.d.ts +0 -8
- package/dist/components/left-navigation/side-navigation-context.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.js +0 -8
- package/dist/components/left-navigation/side-navigation-context.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts +0 -28
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js +0 -89
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.d.ts +0 -6
- package/dist/components/left-navigation/side-navigation-links.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.js +0 -48
- package/dist/components/left-navigation/side-navigation-links.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.d.ts +0 -29
- package/dist/components/left-navigation/side-navigation.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation.js +0 -411
- package/dist/components/left-navigation/side-navigation.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.module.less +0 -530
- package/dist/components/left-navigation/side-navigation.module.less.d.ts +0 -48
- package/dist/components/left-navigation/side-navigation.stories.d.ts +0 -17
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/left-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/left-navigation/with-tooltip.js +0 -15
- package/dist/components/left-navigation/with-tooltip.js.map +0 -1
- package/dist/components/links.d.ts +0 -5
- package/dist/components/links.d.ts.map +0 -1
- package/dist/components/links.js +0 -35
- package/dist/components/links.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts +0 -9
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.map +0 -1
- package/dist/components/titan-layout/layout-profile.stories.d.ts +0 -13
- package/dist/components/titan-layout/layout-profile.stories.d.ts.map +0 -1
- package/dist/components/titan-layout/titan-layout.stories.d.ts +0 -29
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.d.ts +0 -88
- package/dist/utils/navigation-legacy.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.js +0 -3
- package/dist/utils/navigation-legacy.js.map +0 -1
- package/src/components/header-navigation/header-navigation-content.tsx +0 -120
- package/src/components/header-navigation/header-navigation-extra-stacked.stories.tsx +0 -19
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +0 -142
- package/src/components/header-navigation/header-navigation-links.tsx +0 -141
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +0 -146
- package/src/components/header-navigation/header-navigation-stories.module.less +0 -6
- package/src/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/src/components/header-navigation/header-navigation.module.less +0 -260
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/src/components/header-navigation/header-navigation.stories.tsx +0 -165
- package/src/components/header-navigation/header-navigation.tsx +0 -327
- package/src/components/header-navigation/index.ts +0 -1
- package/src/components/header-navigation/with-tooltip.tsx +0 -15
- package/src/components/layout.stories.tsx +0 -103
- package/src/components/left-navigation/header-navigation-extra-tiny.stories.tsx +0 -21
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +0 -145
- package/src/components/left-navigation/header-navigation-tiny.module.less +0 -117
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +0 -178
- package/src/components/left-navigation/header-navigation-tiny.tsx +0 -65
- package/src/components/left-navigation/index.ts +0 -4
- package/src/components/left-navigation/interface-internal.ts +0 -11
- package/src/components/left-navigation/interface.ts +0 -26
- package/src/components/left-navigation/side-navigation-context.tsx +0 -13
- package/src/components/left-navigation/side-navigation-links-internal.tsx +0 -151
- package/src/components/left-navigation/side-navigation-links.tsx +0 -57
- package/src/components/left-navigation/side-navigation.module.less +0 -530
- package/src/components/left-navigation/side-navigation.module.less.d.ts +0 -48
- package/src/components/left-navigation/side-navigation.stories.tsx +0 -226
- package/src/components/left-navigation/side-navigation.tsx +0 -543
- package/src/components/left-navigation/with-tooltip.tsx +0 -16
- package/src/components/links.tsx +0 -54
- package/src/components/profile-dropdown/profile-dropdown-tiny.stories.tsx +0 -25
- package/src/components/titan-layout/layout-profile.stories.tsx +0 -46
- package/src/utils/navigation-legacy.ts +0 -106
- /package/dist/components/{left-navigation → profile-dropdown}/interface.js +0 -0
package/dist/test/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/data.tsx"],"sourcesContent":["import { AnvilProvider } from '@servicetitan/anvil2';\nimport SvgPhone from '@servicetitan/anvil2/assets/icons/material/round/phone_disabled.svg';\nimport SvgPhoneActive from '@servicetitan/anvil2/assets/icons/material/round/phone_enabled.svg';\nimport SvgAccountingActive from '@servicetitan/anvil2/assets/icons/st/gnav_accounting_active.svg';\nimport SvgAccounting from '@servicetitan/anvil2/assets/icons/st/gnav_accounting_inactive.svg';\nimport SvgCallsActive from '@servicetitan/anvil2/assets/icons/st/gnav_calls_active.svg';\nimport SvgCalls from '@servicetitan/anvil2/assets/icons/st/gnav_calls_inactive.svg';\nimport SvgDashboardActive from '@servicetitan/anvil2/assets/icons/st/gnav_dashboard_active.svg';\nimport SvgDashboard from '@servicetitan/anvil2/assets/icons/st/gnav_dashboard_inactive.svg';\nimport SvgDispatchActive from '@servicetitan/anvil2/assets/icons/st/gnav_dispatch_active.svg';\nimport SvgDispatch from '@servicetitan/anvil2/assets/icons/st/gnav_dispatch_inactive.svg';\nimport SvgFleetProActive from '@servicetitan/anvil2/assets/icons/st/gnav_fleet_pro_active.svg';\nimport SvgFleetPro from '@servicetitan/anvil2/assets/icons/st/gnav_fleet_pro_inactive.svg';\nimport SvgFollowUpActive from '@servicetitan/anvil2/assets/icons/st/gnav_follow_up_active.svg';\nimport SvgFollowUp from '@servicetitan/anvil2/assets/icons/st/gnav_follow_up_inactive.svg';\nimport SvgInventoryActive from '@servicetitan/anvil2/assets/icons/st/gnav_inventory_active.svg';\nimport SvgInventory from '@servicetitan/anvil2/assets/icons/st/gnav_inventory_inactive.svg';\nimport SvgMarketingActive from '@servicetitan/anvil2/assets/icons/st/gnav_marketing_active.svg';\nimport SvgMarketing from '@servicetitan/anvil2/assets/icons/st/gnav_marketing_inactive.svg';\nimport SvgPosActive from '@servicetitan/anvil2/assets/icons/st/gnav_pos_active.svg';\nimport SvgPos from '@servicetitan/anvil2/assets/icons/st/gnav_pos_inactive.svg';\nimport SvgPriceBookActive from '@servicetitan/anvil2/assets/icons/st/gnav_pricebook_active.svg';\nimport SvgPriceBook from '@servicetitan/anvil2/assets/icons/st/gnav_pricebook_inactive.svg';\nimport SvgProjectsActive from '@servicetitan/anvil2/assets/icons/st/gnav_projects_active.svg';\nimport SvgProjects from '@servicetitan/anvil2/assets/icons/st/gnav_projects_inactive.svg';\nimport SvgReportsActive from '@servicetitan/anvil2/assets/icons/st/gnav_reports_active.svg';\nimport SvgReports from '@servicetitan/anvil2/assets/icons/st/gnav_reports_inactive.svg';\nimport SvgScheduleActive from '@servicetitan/anvil2/assets/icons/st/gnav_schedule_active.svg';\nimport SvgSchedule from '@servicetitan/anvil2/assets/icons/st/gnav_schedule_inactive.svg';\nimport SvgTasksActive from '@servicetitan/anvil2/assets/icons/st/gnav_tasks_active.svg';\nimport SvgTasks from '@servicetitan/anvil2/assets/icons/st/gnav_tasks_inactive.svg';\n\nimport { BodyText, Popover } from '@servicetitan/design-system';\n\nimport classNames from 'classnames';\nimport { FC, Fragment, forwardRef, useMemo, useState } from 'react';\n// needed only for storybook and added in root dependencies\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n MemoryRouter,\n Redirect,\n Switch,\n matchPath,\n useHistory,\n useLocation,\n} from 'react-router-dom';\nimport { HeaderNavigationTrigger } from '../components/links';\nimport { NavigationSubmenuGroupData, NavigationSubmenuItemData } from '../utils/navigation';\nimport {\n NavLinkComponentProps,\n NavigationComponentContext,\n NavigationLocationContext,\n NavigationLocationContextType,\n} from '../utils/navigation-context';\nimport { HeaderNavigationItemData } from '../utils/navigation-legacy';\nimport * as Styles from './data-stories.module.less';\n\nexport const NavLinkMock = forwardRef<any, NavLinkComponentProps>(\n ({ to, children, activeClassName, className, isActive, ...rest }, ref) => {\n const history = useHistory();\n const location = useLocation();\n const linkActive = location.pathname.startsWith(to);\n\n return (\n <a\n {...rest}\n onClick={e => {\n e.preventDefault();\n\n if (!to.startsWith('http')) {\n history.replace(to);\n }\n }}\n className={classNames(className, linkActive ? activeClassName : '')}\n href={to}\n ref={ref}\n >\n {children}\n </a>\n );\n }\n);\n\nexport const LocationInfo: FC<{ className?: string }> = ({ className }) => {\n const location = useLocation();\n\n return <BodyText className={className}>current location - {location.pathname}</BodyText>;\n};\n\nconst LocationProvider: FC<{ children: any }> = ({ children }) => {\n const location = useLocation();\n const context: NavigationLocationContextType = useMemo(\n () => ({\n location: { pathname: location.pathname },\n isLinkActive: (location, item) => !!matchPath(location.pathname, item.to),\n }),\n [location.pathname]\n );\n\n return (\n <NavigationLocationContext.Provider value={context}>\n {children}\n </NavigationLocationContext.Provider>\n );\n};\nexport const withMemoryRouter = (Story: any) => (\n <MemoryRouter>\n <NavigationComponentContext.Provider value={NavLinkMock}>\n <LocationProvider>\n <Story />\n </LocationProvider>\n </NavigationComponentContext.Provider>\n </MemoryRouter>\n);\n\nexport const withAnvil = (Story: any) => (\n <AnvilProvider className={Styles.fixIcons}>\n <Story />\n </AnvilProvider>\n);\n\nexport const InventoryIcon = () => (\n <svg width=\"20\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-293 385 24 24\" fill=\"currentColor\">\n <polyline points=\"-288,400.9 -282,404.3 -282,397.6 -288,394.2 -288,400.9 \" />\n <path d=\"M-272,401.5c0,0.4-0.2,0.7-0.5,0.9l-7.9,4.4c-0.2,0.1-0.4,0.2-0.6,0.2s-0.4-0.1-0.6-0.2l-7.9-4.4c-0.3-0.2-0.5-0.5-0.5-0.9v-9c0-0.4,0.2-0.7,0.5-0.9l7.9-4.4c0.2-0.1,0.4-0.2,0.6-0.2s0.4,0.1,0.6,0.2l7.9,4.4c0.3,0.2,0.5,0.5,0.5,0.9V401.5 M-287,392.5 l6,3.4l5.9-3.3l-5.9-3.4L-287,392.5 M-274,400.9v-6.7l-6,3.4v6.7L-274,400.9z\" />\n </svg>\n);\n\nexport const SearchIcon = () => (\n <svg\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g transform=\"translate(0,4)\">\n <path\n d=\"M0 15.7992V13.9992H12V15.7992H0ZM0 9.49922V7.69922H6V9.49922H0ZM0 3.19922V1.39922H6V3.19922H0ZM22.74 15.7992L17.94 10.9992C17.42 11.3992 16.86 11.6992 16.26 11.8992C15.66 12.0992 15.04 12.1992 14.4 12.1992C12.74 12.1992 11.325 11.6142 10.155 10.4442C8.985 9.27422 8.4 7.85922 8.4 6.19922C8.4 4.53922 8.985 3.12422 10.155 1.95422C11.325 0.784219 12.74 0.199219 14.4 0.199219C16.06 0.199219 17.475 0.784219 18.645 1.95422C19.815 3.12422 20.4 4.53922 20.4 6.19922C20.4 6.83922 20.3 7.45922 20.1 8.05922C19.9 8.65922 19.6 9.21922 19.2 9.73922L24 14.5392L22.74 15.7992ZM14.393 10.3992C15.5577 10.3992 16.55 9.99157 17.37 9.17627C18.19 8.36099 18.6 7.37099 18.6 6.20627C18.6 5.04157 18.1923 4.04922 17.377 3.22922C16.5618 2.40922 15.5718 1.99922 14.407 1.99922C13.2423 1.99922 12.25 2.40687 11.43 3.22217C10.61 4.03745 10.2 5.02745 10.2 6.19217C10.2 7.35687 10.6077 8.34922 11.423 9.16922C12.2382 9.98922 13.2282 10.3992 14.393 10.3992Z\"\n fill=\"white\"\n />\n </g>\n </svg>\n);\n\nconst getItem = (\n id: string,\n data: Partial<HeaderNavigationItemData>\n): HeaderNavigationItemData => ({\n id,\n to: '/' + id,\n title: id[0].toUpperCase() + id.substring(1),\n hint: id,\n icon: undefined,\n iconActive: undefined,\n ...data,\n submenu: data.submenu\n ? {\n ...data.submenu,\n groups: data.submenu.groups.map(group => ({\n ...group,\n links: group.links.map(link => ({\n ...link,\n to: `/${id}/${link.to}`,\n })),\n })),\n }\n : undefined,\n});\n\nconst getSubItem = (\n id: string,\n data: Partial<NavigationSubmenuItemData>\n): NavigationSubmenuItemData => ({\n id,\n to: id,\n title: id[0].toUpperCase() + id.substring(1),\n ...data,\n});\n\nconst getGroup = (\n title: string,\n links: NavigationSubmenuItemData[]\n): NavigationSubmenuGroupData => ({\n title,\n links,\n});\n\nexport const items = {\n calendar: getItem('calendar', {\n iconName: 'event',\n icon: SvgSchedule,\n iconActive: SvgScheduleActive,\n }),\n schedule: getItem('schedule', {\n iconName: 'event',\n icon: SvgSchedule,\n iconActive: SvgScheduleActive,\n }),\n calls: getItem('calls', {\n iconName: 'local_phone',\n icon: SvgCalls,\n iconActive: SvgCallsActive,\n counter: 1234,\n }),\n dashboard: getItem('dashboard', {\n iconName: 'odometer',\n icon: SvgDashboard,\n iconActive: SvgDashboardActive,\n }),\n dispatch: getItem('dispatch', {\n iconName: 'location_disabled',\n icon: SvgDispatch,\n iconActive: SvgDispatchActive,\n tag: { value: 3 },\n }),\n fleet: getItem('fleet', {\n iconName: 'fleet-pro',\n icon: SvgFleetPro,\n iconActive: SvgFleetProActive,\n title: 'Fleet Pro',\n }),\n followUps: getItem('followUps', {\n iconName: 'flag',\n icon: SvgFollowUp,\n iconActive: SvgFollowUpActive,\n title: 'Follow Up',\n }),\n followUpsWithSubmenu: getItem('followUps', {\n iconName: 'flag',\n icon: SvgFollowUp,\n iconActive: SvgFollowUpActive,\n title: 'Follow Up',\n submenu: {\n groups: [\n getGroup('', [\n getSubItem('estimates', { title: 'Unsold Estimates' }),\n getSubItem('sold', { title: 'Sold Estimates' }),\n getSubItem('surveys', { title: 'Surveys' }),\n ]),\n ],\n },\n }),\n inventory: getItem('inventory', {\n iconName: 'toys',\n icon: SvgInventory,\n iconActive: SvgInventoryActive,\n }),\n purchasing: getItem('purchasing', { iconComponent: InventoryIcon }),\n purchasingWithSubmenu: getItem('purchasing', {\n iconName: 'toys',\n icon: SvgInventory,\n iconActive: SvgInventoryActive,\n counter: true,\n submenu: {\n groups: [\n getGroup('Purchase', [\n getSubItem('repl', { title: 'Replenishment' }),\n getSubItem('orders', { title: 'Purchase Orders' }),\n getSubItem('receipts', { title: 'Receipts' }),\n getSubItem('returns', { title: 'Returns' }),\n ]),\n ],\n },\n }),\n accounting: getItem('accounting', {\n iconName: 'assignment',\n icon: SvgAccounting,\n iconActive: SvgAccountingActive,\n counter: true,\n }),\n accountingWithSubmenu: getItem('accounting', {\n iconName: 'assignment',\n icon: SvgAccounting,\n iconActive: SvgAccountingActive,\n counter: 1,\n submenu: {\n groups: [\n getGroup('Accounts Receivable', [\n getSubItem('export', {\n title: 'Batch/Export Transactions',\n counter: true,\n }),\n getSubItem('ar', { title: 'AR Management' }),\n getSubItem('invoices', { title: 'Invoices', counter: 3 }),\n getSubItem('payments', { title: 'Customer Payments', counter: 2 }),\n getSubItem('deposits', { title: 'Bank Deposits' }),\n ]),\n getGroup('Accounts Payable', [getSubItem('bills', { title: 'Bills' })]),\n getGroup('Financing', [getSubItem('dashboard', { title: 'Dashboard' })]),\n getGroup('Others', [getSubItem('at', { title: 'Accounting Audit Trail' })]),\n ],\n },\n }),\n marketing: getItem('marketing', {\n iconName: 'bullhorn',\n icon: SvgMarketing,\n iconActive: SvgMarketingActive,\n }),\n priceBook: getItem('pricebook', {\n iconName: 'book',\n icon: SvgPriceBook,\n iconActive: SvgPriceBookActive,\n }),\n pointOfSale: getItem('pointOfSale', {\n iconName: 'cash-register',\n icon: SvgPos,\n iconActive: SvgPosActive,\n title: 'Point Of Sale',\n }),\n projects: getItem('projects', {\n iconName: 'folder_special',\n icon: SvgProjects,\n iconActive: SvgProjectsActive,\n }),\n reports: getItem('reports', {\n iconName: 'folder_special',\n icon: SvgReports,\n iconActive: SvgReportsActive,\n }),\n tasks: getItem('tasks', {\n iconName: 'format_list_bulleted',\n icon: SvgTasks,\n iconActive: SvgTasksActive,\n }),\n};\n\nexport const CallsNavigationTrigger = () => {\n const [open, setOpen] = useState(false);\n\n return (\n <Popover\n open={open}\n onClickOutside={() => setOpen(false)}\n direction=\"bl\"\n trigger={\n <HeaderNavigationTrigger\n id=\"dialpad\"\n iconName=\"phone\"\n counter={2}\n title=\"Calls\"\n icon={SvgPhone}\n iconActive={SvgPhoneActive}\n onClick={() => setOpen(!open)}\n isActive={open}\n />\n }\n >\n calls content\n </Popover>\n );\n};\n\nexport const withDefaultRedirects = (Story: any) => (\n <Fragment>\n <Switch>\n <Redirect from=\"/accounting\" exact to=\"/accounting/export\" />\n <Redirect from=\"/purchasing\" exact to=\"/purchasing/repl\" />\n <Redirect from=\"/followUps\" exact to=\"/followUps/sold\" />\n </Switch>\n <Story />\n </Fragment>\n);\n"],"names":["AnvilProvider","SvgPhone","SvgPhoneActive","SvgAccountingActive","SvgAccounting","SvgCallsActive","SvgCalls","SvgDashboardActive","SvgDashboard","SvgDispatchActive","SvgDispatch","SvgFleetProActive","SvgFleetPro","SvgFollowUpActive","SvgFollowUp","SvgInventoryActive","SvgInventory","SvgMarketingActive","SvgMarketing","SvgPosActive","SvgPos","SvgPriceBookActive","SvgPriceBook","SvgProjectsActive","SvgProjects","SvgReportsActive","SvgReports","SvgScheduleActive","SvgSchedule","SvgTasksActive","SvgTasks","BodyText","Popover","classNames","Fragment","forwardRef","useMemo","useState","MemoryRouter","Redirect","Switch","matchPath","useHistory","useLocation","HeaderNavigationTrigger","NavigationComponentContext","NavigationLocationContext","Styles","NavLinkMock","to","children","activeClassName","className","isActive","rest","ref","history","location","linkActive","pathname","startsWith","a","onClick","e","preventDefault","replace","href","LocationInfo","LocationProvider","context","isLinkActive","item","Provider","value","withMemoryRouter","Story","withAnvil","fixIcons","InventoryIcon","svg","width","xmlns","viewBox","fill","polyline","points","path","d","SearchIcon","height","g","transform","getItem","id","data","title","toUpperCase","substring","hint","icon","undefined","iconActive","submenu","groups","map","group","links","link","getSubItem","getGroup","items","calendar","iconName","schedule","calls","counter","dashboard","dispatch","tag","fleet","followUps","followUpsWithSubmenu","inventory","purchasing","iconComponent","purchasingWithSubmenu","accounting","accountingWithSubmenu","marketing","priceBook","pointOfSale","projects","reports","tasks","CallsNavigationTrigger","open","setOpen","onClickOutside","direction","trigger","withDefaultRedirects","from","exact"],"mappings":";AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,OAAOC,cAAc,sEAAsE;AAC3F,OAAOC,oBAAoB,qEAAqE;AAChG,OAAOC,yBAAyB,kEAAkE;AAClG,OAAOC,mBAAmB,oEAAoE;AAC9F,OAAOC,oBAAoB,6DAA6D;AACxF,OAAOC,cAAc,+DAA+D;AACpF,OAAOC,wBAAwB,iEAAiE;AAChG,OAAOC,kBAAkB,mEAAmE;AAC5F,OAAOC,uBAAuB,gEAAgE;AAC9F,OAAOC,iBAAiB,kEAAkE;AAC1F,OAAOC,uBAAuB,iEAAiE;AAC/F,OAAOC,iBAAiB,mEAAmE;AAC3F,OAAOC,uBAAuB,iEAAiE;AAC/F,OAAOC,iBAAiB,mEAAmE;AAC3F,OAAOC,wBAAwB,i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lG;YACNoG,YAAYnG;YACZ4D,SAAS,IAAM0E,QAAQ,CAACD;YACxBlF,UAAUkF;;kBAGrB;;AAIT,EAAE;AAEF,OAAO,MAAMK,uBAAuB,CAACjE,sBACjC,MAACzC;;0BACG,MAACM;;kCACG,KAACD;wBAASsG,MAAK;wBAAcC,KAAK;wBAAC7F,IAAG;;kCACtC,KAACV;wBAASsG,MAAK;wBAAcC,KAAK;wBAAC7F,IAAG;;kCACtC,KAACV;wBAASsG,MAAK;wBAAaC,KAAK;wBAAC7F,IAAG;;;;0BAEzC,KAAC0B;;OAEP"}
|
|
1
|
+
{"version":3,"sources":["../../src/test/data.tsx"],"sourcesContent":["import { AnvilProvider } from '@servicetitan/anvil2';\nimport SvgPhone from '@servicetitan/anvil2/assets/icons/material/round/phone_disabled.svg';\nimport SvgPhoneActive from '@servicetitan/anvil2/assets/icons/material/round/phone_enabled.svg';\nimport SvgAccountingActive from '@servicetitan/anvil2/assets/icons/st/gnav_accounting_active.svg';\nimport SvgAccounting from '@servicetitan/anvil2/assets/icons/st/gnav_accounting_inactive.svg';\nimport SvgCallsActive from '@servicetitan/anvil2/assets/icons/st/gnav_calls_active.svg';\nimport SvgCalls from '@servicetitan/anvil2/assets/icons/st/gnav_calls_inactive.svg';\nimport SvgDashboardActive from '@servicetitan/anvil2/assets/icons/st/gnav_dashboard_active.svg';\nimport SvgDashboard from '@servicetitan/anvil2/assets/icons/st/gnav_dashboard_inactive.svg';\nimport SvgDispatchActive from '@servicetitan/anvil2/assets/icons/st/gnav_dispatch_active.svg';\nimport SvgDispatch from '@servicetitan/anvil2/assets/icons/st/gnav_dispatch_inactive.svg';\nimport SvgFleetProActive from '@servicetitan/anvil2/assets/icons/st/gnav_fleet_pro_active.svg';\nimport SvgFleetPro from '@servicetitan/anvil2/assets/icons/st/gnav_fleet_pro_inactive.svg';\nimport SvgFollowUpActive from '@servicetitan/anvil2/assets/icons/st/gnav_follow_up_active.svg';\nimport SvgFollowUp from '@servicetitan/anvil2/assets/icons/st/gnav_follow_up_inactive.svg';\nimport SvgInventoryActive from '@servicetitan/anvil2/assets/icons/st/gnav_inventory_active.svg';\nimport SvgInventory from '@servicetitan/anvil2/assets/icons/st/gnav_inventory_inactive.svg';\nimport SvgMarketingActive from '@servicetitan/anvil2/assets/icons/st/gnav_marketing_active.svg';\nimport SvgMarketing from '@servicetitan/anvil2/assets/icons/st/gnav_marketing_inactive.svg';\nimport SvgPosActive from '@servicetitan/anvil2/assets/icons/st/gnav_pos_active.svg';\nimport SvgPos from '@servicetitan/anvil2/assets/icons/st/gnav_pos_inactive.svg';\nimport SvgPriceBookActive from '@servicetitan/anvil2/assets/icons/st/gnav_pricebook_active.svg';\nimport SvgPriceBook from '@servicetitan/anvil2/assets/icons/st/gnav_pricebook_inactive.svg';\nimport SvgProjectsActive from '@servicetitan/anvil2/assets/icons/st/gnav_projects_active.svg';\nimport SvgProjects from '@servicetitan/anvil2/assets/icons/st/gnav_projects_inactive.svg';\nimport SvgReportsActive from '@servicetitan/anvil2/assets/icons/st/gnav_reports_active.svg';\nimport SvgReports from '@servicetitan/anvil2/assets/icons/st/gnav_reports_inactive.svg';\nimport SvgScheduleActive from '@servicetitan/anvil2/assets/icons/st/gnav_schedule_active.svg';\nimport SvgSchedule from '@servicetitan/anvil2/assets/icons/st/gnav_schedule_inactive.svg';\nimport SvgTasksActive from '@servicetitan/anvil2/assets/icons/st/gnav_tasks_active.svg';\nimport SvgTasks from '@servicetitan/anvil2/assets/icons/st/gnav_tasks_inactive.svg';\n\nimport { BodyText, Popover } from '@servicetitan/design-system';\n\nimport classNames from 'classnames';\nimport { FC, Fragment, forwardRef, useState } from 'react';\n// needed only for storybook and added in root dependencies\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { MemoryRouter, Redirect, Switch, useHistory, useLocation } from 'react-router-dom';\nimport { TitanLayout } from '../components/titan-layout';\nimport {\n NavigationItemData,\n NavigationSubmenuGroupData,\n NavigationSubmenuItemData,\n} from '../utils/navigation';\nimport { NavLinkComponentProps } from '../utils/navigation-context';\nimport * as Styles from './data-stories.module.less';\n\nexport const NavLinkMock = forwardRef<any, NavLinkComponentProps>(\n ({ to, children, activeClassName, className, isActive, ...rest }, ref) => {\n const history = useHistory();\n const location = useLocation();\n const linkActive = location.pathname.startsWith(to);\n\n return (\n <a\n {...rest}\n onClick={e => {\n e.preventDefault();\n\n if (!to.startsWith('http')) {\n history.replace(to);\n }\n }}\n className={classNames(className, linkActive ? activeClassName : '')}\n href={to}\n ref={ref}\n >\n {children}\n </a>\n );\n }\n);\n\nexport const LocationInfo: FC<{ className?: string }> = ({ className }) => {\n const location = useLocation();\n\n return <BodyText className={className}>current location - {location.pathname}</BodyText>;\n};\n\nexport const withMemoryRouter = (Story: any) => (\n <MemoryRouter>\n <Story />\n </MemoryRouter>\n);\n\nexport const withAnvil = (Story: any) => (\n <AnvilProvider className={Styles.fixIcons}>\n <Story />\n </AnvilProvider>\n);\n\nexport const InventoryIcon = () => (\n <svg width=\"20\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-293 385 24 24\" fill=\"currentColor\">\n <polyline points=\"-288,400.9 -282,404.3 -282,397.6 -288,394.2 -288,400.9 \" />\n <path d=\"M-272,401.5c0,0.4-0.2,0.7-0.5,0.9l-7.9,4.4c-0.2,0.1-0.4,0.2-0.6,0.2s-0.4-0.1-0.6-0.2l-7.9-4.4c-0.3-0.2-0.5-0.5-0.5-0.9v-9c0-0.4,0.2-0.7,0.5-0.9l7.9-4.4c0.2-0.1,0.4-0.2,0.6-0.2s0.4,0.1,0.6,0.2l7.9,4.4c0.3,0.2,0.5,0.5,0.5,0.9V401.5 M-287,392.5 l6,3.4l5.9-3.3l-5.9-3.4L-287,392.5 M-274,400.9v-6.7l-6,3.4v6.7L-274,400.9z\" />\n </svg>\n);\n\nexport const SearchIcon = () => (\n <svg\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g transform=\"translate(0,4)\">\n <path\n d=\"M0 15.7992V13.9992H12V15.7992H0ZM0 9.49922V7.69922H6V9.49922H0ZM0 3.19922V1.39922H6V3.19922H0ZM22.74 15.7992L17.94 10.9992C17.42 11.3992 16.86 11.6992 16.26 11.8992C15.66 12.0992 15.04 12.1992 14.4 12.1992C12.74 12.1992 11.325 11.6142 10.155 10.4442C8.985 9.27422 8.4 7.85922 8.4 6.19922C8.4 4.53922 8.985 3.12422 10.155 1.95422C11.325 0.784219 12.74 0.199219 14.4 0.199219C16.06 0.199219 17.475 0.784219 18.645 1.95422C19.815 3.12422 20.4 4.53922 20.4 6.19922C20.4 6.83922 20.3 7.45922 20.1 8.05922C19.9 8.65922 19.6 9.21922 19.2 9.73922L24 14.5392L22.74 15.7992ZM14.393 10.3992C15.5577 10.3992 16.55 9.99157 17.37 9.17627C18.19 8.36099 18.6 7.37099 18.6 6.20627C18.6 5.04157 18.1923 4.04922 17.377 3.22922C16.5618 2.40922 15.5718 1.99922 14.407 1.99922C13.2423 1.99922 12.25 2.40687 11.43 3.22217C10.61 4.03745 10.2 5.02745 10.2 6.19217C10.2 7.35687 10.6077 8.34922 11.423 9.16922C12.2382 9.98922 13.2282 10.3992 14.393 10.3992Z\"\n fill=\"white\"\n />\n </g>\n </svg>\n);\n\nconst getNavItem = (id: string, data: Partial<NavigationItemData>): NavigationItemData => ({\n id,\n to: '/' + id,\n title: id[0].toUpperCase() + id.substring(1),\n icon: undefined,\n iconActive: undefined,\n ...data,\n submenu: data.submenu\n ? {\n ...data.submenu,\n groups: data.submenu.groups.map(group => ({\n ...group,\n links: group.links.map(link => ({\n ...link,\n to: `/${id}/${link.to}`,\n })),\n })),\n }\n : undefined,\n});\n\nconst getSubItem = (\n id: string,\n data: Partial<NavigationSubmenuItemData>\n): NavigationSubmenuItemData => ({\n id,\n to: id,\n title: id[0].toUpperCase() + id.substring(1),\n ...data,\n});\n\nconst getGroup = (\n title: string,\n links: NavigationSubmenuItemData[]\n): NavigationSubmenuGroupData => ({\n title,\n links,\n});\n\nexport const navItems = {\n calendar: getNavItem('calendar', {\n icon: SvgSchedule,\n iconActive: SvgScheduleActive,\n }),\n schedule: getNavItem('schedule', {\n icon: SvgSchedule,\n iconActive: SvgScheduleActive,\n }),\n calls: getNavItem('calls', {\n icon: SvgCalls,\n iconActive: SvgCallsActive,\n counter: 1234,\n }),\n dashboard: getNavItem('dashboard', {\n icon: SvgDashboard,\n iconActive: SvgDashboardActive,\n }),\n dispatch: getNavItem('dispatch', {\n icon: SvgDispatch,\n iconActive: SvgDispatchActive,\n tag: { value: 3 },\n }),\n fleet: getNavItem('fleet', {\n icon: SvgFleetPro,\n iconActive: SvgFleetProActive,\n title: 'Fleet Pro',\n }),\n followUps: getNavItem('followUps', {\n icon: SvgFollowUp,\n iconActive: SvgFollowUpActive,\n title: 'Follow Up',\n }),\n followUpsWithSubmenu: getNavItem('followUps', {\n icon: SvgFollowUp,\n iconActive: SvgFollowUpActive,\n title: 'Follow Up',\n submenu: {\n groups: [\n getGroup('', [\n getSubItem('estimates', { title: 'Unsold Estimates' }),\n getSubItem('sold', { title: 'Sold Estimates' }),\n getSubItem('surveys', { title: 'Surveys' }),\n ]),\n ],\n },\n }),\n inventory: getNavItem('inventory', {\n icon: SvgInventory,\n iconActive: SvgInventoryActive,\n }),\n purchasing: getNavItem('purchasing', {}),\n purchasingWithSubmenu: getNavItem('purchasing', {\n icon: SvgInventory,\n iconActive: SvgInventoryActive,\n counter: true,\n submenu: {\n groups: [\n getGroup('Purchase', [\n getSubItem('repl', { title: 'Replenishment' }),\n getSubItem('orders', { title: 'Purchase Orders' }),\n getSubItem('receipts', { title: 'Receipts' }),\n getSubItem('returns', { title: 'Returns' }),\n ]),\n ],\n },\n }),\n accounting: getNavItem('accounting', {\n icon: SvgAccounting,\n iconActive: SvgAccountingActive,\n counter: true,\n }),\n accountingWithSubmenu: getNavItem('accounting', {\n icon: SvgAccounting,\n iconActive: SvgAccountingActive,\n counter: 1,\n submenu: {\n groups: [\n getGroup('Accounts Receivable', [\n getSubItem('export', {\n title: 'Batch/Export Transactions',\n counter: true,\n }),\n getSubItem('ar', { title: 'AR Management' }),\n getSubItem('invoices', { title: 'Invoices', counter: 3 }),\n getSubItem('payments', { title: 'Customer Payments', counter: 2 }),\n getSubItem('deposits', { title: 'Bank Deposits' }),\n ]),\n getGroup('Accounts Payable', [getSubItem('bills', { title: 'Bills' })]),\n getGroup('Financing', [getSubItem('dashboard', { title: 'Dashboard' })]),\n getGroup('Others', [getSubItem('at', { title: 'Accounting Audit Trail' })]),\n ],\n },\n }),\n marketing: getNavItem('marketing', {\n icon: SvgMarketing,\n iconActive: SvgMarketingActive,\n }),\n priceBook: getNavItem('pricebook', {\n icon: SvgPriceBook,\n iconActive: SvgPriceBookActive,\n }),\n pointOfSale: getNavItem('pointOfSale', {\n icon: SvgPos,\n iconActive: SvgPosActive,\n title: 'Point Of Sale',\n }),\n projects: getNavItem('projects', {\n icon: SvgProjects,\n iconActive: SvgProjectsActive,\n }),\n reports: getNavItem('reports', {\n icon: SvgReports,\n iconActive: SvgReportsActive,\n }),\n tasks: getNavItem('tasks', {\n icon: SvgTasks,\n iconActive: SvgTasksActive,\n }),\n};\n\nexport const CallsNavigationTrigger = () => {\n const [open, setOpen] = useState(false);\n\n return (\n <Popover\n open={open}\n onClickOutside={() => setOpen(false)}\n direction=\"bl\"\n trigger={\n <TitanLayout.Trigger\n id=\"dialpad\"\n counter={2}\n title=\"Calls\"\n icon={SvgPhone}\n iconActive={SvgPhoneActive}\n onClick={() => setOpen(!open)}\n isActive={open}\n />\n }\n >\n calls content\n </Popover>\n );\n};\n\nexport const withDefaultRedirects = (Story: any) => (\n <Fragment>\n <Switch>\n <Redirect from=\"/accounting\" exact to=\"/accounting/export\" />\n <Redirect from=\"/purchasing\" exact to=\"/purchasing/repl\" />\n <Redirect from=\"/followUps\" exact to=\"/followUps/sold\" />\n </Switch>\n <Story />\n </Fragment>\n);\n"],"names":["AnvilProvider","SvgPhone","SvgPhoneActive","SvgAccountingActive","SvgAccounting","SvgCallsActive","SvgCalls","SvgDashboardActive","SvgDashboard","SvgDispatchActive","SvgDispatch","SvgFleetProActive","SvgFleetPro","SvgFollowUpActive","SvgFollowUp","SvgInventoryActive","SvgInventory","SvgMarketingActive","SvgMarketing","SvgPosActive","SvgPos","SvgPriceBookActive","SvgPriceBook","SvgProjectsActive","SvgProjects","SvgReportsActive","SvgReports","SvgScheduleActive","SvgSchedule","SvgTasksActive","SvgTasks","BodyText","Popover","classNames","Fragment","forwardRef","useState","MemoryRouter","Redirect","Switch","useHistory","useLocation","TitanLayout","Styles","NavLinkMock","to","children","activeClassName","className","isActive","rest","ref","history","location","linkActive","pathname","startsWith","a","onClick","e","preventDefault","replace","href","LocationInfo","withMemoryRouter","Story","withAnvil","fixIcons","InventoryIcon","svg","width","xmlns","viewBox","fill","polyline","points","path","d","SearchIcon","height","g","transform","getNavItem","id","data","title","toUpperCase","substring","icon","undefined","iconActive","submenu","groups","map","group","links","link","getSubItem","getGroup","navItems","calendar","schedule","calls","counter","dashboard","dispatch","tag","value","fleet","followUps","followUpsWithSubmenu","inventory","purchasing","purchasingWithSubmenu","accounting","accountingWithSubmenu","marketing","priceBook","pointOfSale","projects","reports","tasks","CallsNavigationTrigger","open","setOpen","onClickOutside","direction","trigger","Trigger","withDefaultRedirects","from","exact"],"mappings":";AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,OAAOC,cAAc,sEAAsE;AAC3F,OAAOC,oBAAoB,qEAAqE;AAChG,OAAOC,yBAAyB,kEAAkE;AAClG,OAAOC,mBAAmB,oEAAoE;AAC9F,OAAOC,oBAAoB,6DAA6D;AACxF,OAAOC,cAAc,+DAA+D;AACpF,OAAOC,wBAAwB,iEAAiE;AAChG,OAAOC,kBAAkB,mEAAmE;AAC5F,OAAOC,uBAAuB,gEAAgE;AAC9F,OAAOC,iBAAiB,kEAAkE;AAC1F,OAAOC,uBAAuB,iEAAiE;AAC/F,OAAOC,iBAAiB,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NoE,YAAYrE;IAChB;IACAiG,aAAapC,WAAW,eAAe;QACnCM,MAAMpE;QACNsE,YAAYvE;QACZkE,OAAO;IACX;IACAkC,UAAUrC,WAAW,YAAY;QAC7BM,MAAMhE;QACNkE,YAAYnE;IAChB;IACAiG,SAAStC,WAAW,WAAW;QAC3BM,MAAM9D;QACNgE,YAAYjE;IAChB;IACAgG,OAAOvC,WAAW,SAAS;QACvBM,MAAM1D;QACN4D,YAAY7D;IAChB;AACJ,EAAE;AAEF,OAAO,MAAM6F,yBAAyB;IAClC,MAAM,CAACC,MAAMC,QAAQ,GAAGxF,SAAS;IAEjC,qBACI,KAACJ;QACG2F,MAAMA;QACNE,gBAAgB,IAAMD,QAAQ;QAC9BE,WAAU;QACVC,uBACI,KAACrF,YAAYsF,OAAO;YAChB7C,IAAG;YACHoB,SAAS;YACTlB,OAAM;YACNG,MAAMvF;YACNyF,YAAYxF;YACZwD,SAAS,IAAMkE,QAAQ,CAACD;YACxB1E,UAAU0E;;kBAGrB;;AAIT,EAAE;AAEF,OAAO,MAAMM,uBAAuB,CAAChE,sBACjC,MAAC/B;;0BACG,MAACK;;kCACG,KAACD;wBAAS4F,MAAK;wBAAcC,KAAK;wBAACtF,IAAG;;kCACtC,KAACP;wBAAS4F,MAAK;wBAAcC,KAAK;wBAACtF,IAAG;;kCACtC,KAACP;wBAAS4F,MAAK;wBAAaC,KAAK;wBAACtF,IAAG;;;;0BAEzC,KAACoB;;OAEP"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TitanLayoutProps } from '../components/titan-layout';
|
|
2
|
+
export interface LayoutContentArgs {
|
|
3
|
+
header: boolean;
|
|
4
|
+
sideTop: boolean;
|
|
5
|
+
extraText: boolean;
|
|
6
|
+
search: boolean;
|
|
7
|
+
longContent: boolean;
|
|
8
|
+
wideContent: boolean;
|
|
9
|
+
minWidth: boolean;
|
|
10
|
+
emptyNav: boolean;
|
|
11
|
+
overflowItems: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const getDefaultArgs: () => LayoutContentArgs;
|
|
14
|
+
export declare const withDefaultLayoutProps: (props: Partial<TitanLayoutProps>) => (Story: any) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const useDefaultLayoutProps: () => Partial<TitanLayoutProps>;
|
|
16
|
+
//# sourceMappingURL=titan-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"titan-layout.d.ts","sourceRoot":"","sources":["../../src/test/titan-layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,cAAc,QAAO,iBAUhC,CAAC;AAGH,eAAO,MAAM,sBAAsB,GAAI,OAAO,OAAO,CAAC,gBAAgB,CAAC,MAAM,OAAO,GAAG,4CAItF,CAAC;AACF,eAAO,MAAM,qBAAqB,iCAAwC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
export const getDefaultArgs = ()=>({
|
|
4
|
+
header: true,
|
|
5
|
+
sideTop: true,
|
|
6
|
+
extraText: true,
|
|
7
|
+
search: true,
|
|
8
|
+
longContent: true,
|
|
9
|
+
wideContent: false,
|
|
10
|
+
minWidth: false,
|
|
11
|
+
emptyNav: false,
|
|
12
|
+
overflowItems: true
|
|
13
|
+
});
|
|
14
|
+
const DefaultPropsContext = /*#__PURE__*/ createContext({});
|
|
15
|
+
export const withDefaultLayoutProps = (props)=>(Story)=>/*#__PURE__*/ _jsx(DefaultPropsContext.Provider, {
|
|
16
|
+
value: props,
|
|
17
|
+
children: /*#__PURE__*/ _jsx(Story, {})
|
|
18
|
+
});
|
|
19
|
+
export const useDefaultLayoutProps = ()=>useContext(DefaultPropsContext);
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=titan-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/titan-layout.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport { TitanLayoutProps } from '../components/titan-layout';\n\nexport interface LayoutContentArgs {\n header: boolean;\n sideTop: boolean;\n extraText: boolean;\n search: boolean;\n longContent: boolean;\n wideContent: boolean;\n minWidth: boolean;\n emptyNav: boolean;\n overflowItems: boolean;\n}\n\nexport const getDefaultArgs = (): LayoutContentArgs => ({\n header: true,\n sideTop: true,\n extraText: true,\n search: true,\n longContent: true,\n wideContent: false,\n minWidth: false,\n emptyNav: false,\n overflowItems: true,\n});\n\nconst DefaultPropsContext = createContext<Partial<TitanLayoutProps>>({});\nexport const withDefaultLayoutProps = (props: Partial<TitanLayoutProps>) => (Story: any) => (\n <DefaultPropsContext.Provider value={props}>\n <Story />\n </DefaultPropsContext.Provider>\n);\nexport const useDefaultLayoutProps = () => useContext(DefaultPropsContext);\n"],"names":["createContext","useContext","getDefaultArgs","header","sideTop","extraText","search","longContent","wideContent","minWidth","emptyNav","overflowItems","DefaultPropsContext","withDefaultLayoutProps","props","Story","Provider","value","useDefaultLayoutProps"],"mappings":";AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAelD,OAAO,MAAMC,iBAAiB,IAA0B,CAAA;QACpDC,QAAQ;QACRC,SAAS;QACTC,WAAW;QACXC,QAAQ;QACRC,aAAa;QACbC,aAAa;QACbC,UAAU;QACVC,UAAU;QACVC,eAAe;IACnB,CAAA,EAAG;AAEH,MAAMC,oCAAsBZ,cAAyC,CAAC;AACtE,OAAO,MAAMa,yBAAyB,CAACC,QAAqC,CAACC,sBACzE,KAACH,oBAAoBI,QAAQ;YAACC,OAAOH;sBACjC,cAAA,KAACC;WAEP;AACF,OAAO,MAAMG,wBAAwB,IAAMjB,WAAWW,qBAAqB"}
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface NavLinkComponentPropsStrict {
|
|
1
|
+
import { ComponentPropsWithoutRef, FC } from 'react';
|
|
2
|
+
export type NavLinkComponentProps = ComponentPropsWithoutRef<'a'> & {
|
|
4
3
|
to: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
className?: string;
|
|
7
4
|
activeClassName?: string;
|
|
8
|
-
children: ReactNode;
|
|
9
5
|
isActive?: (pathname: string) => boolean;
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export interface NavLinkComponentProps extends NavLinkComponentPropsStrict {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
}
|
|
6
|
+
};
|
|
15
7
|
export declare const DefaultNavLinkComponent: FC<NavLinkComponentProps>;
|
|
16
|
-
export interface NavigationLocationInfo {
|
|
17
|
-
pathname: string;
|
|
18
|
-
}
|
|
19
|
-
export type NavigationActiveLinkMatcher = (location: NavigationLocationInfo, link: NavigationLinkData) => boolean;
|
|
20
|
-
export interface NavigationLocationContextType {
|
|
21
|
-
location: NavigationLocationInfo;
|
|
22
|
-
isLinkActive: NavigationActiveLinkMatcher;
|
|
23
|
-
}
|
|
24
|
-
export declare const NavigationComponentContext: import("react").Context<FC<NavLinkComponentProps>>;
|
|
25
|
-
export declare const NavigationLegacyContext: import("react").Context<boolean>;
|
|
26
|
-
export declare const NavigationLocationContext: import("react").Context<NavigationLocationContextType>;
|
|
27
8
|
//# sourceMappingURL=navigation-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-context.d.ts","sourceRoot":"","sources":["../../src/utils/navigation-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation-context.d.ts","sourceRoot":"","sources":["../../src/utils/navigation-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,GAAG,CAAC,GAAG;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,qBAAqB,CAU7D,CAAC"}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export const DefaultNavLinkComponent = ({ children, to, activeClassName, isActive, ...props })=>/*#__PURE__*/ _jsx("a", {
|
|
3
|
+
href: to,
|
|
4
4
|
...props,
|
|
5
5
|
children: children
|
|
6
6
|
});
|
|
7
|
-
export const NavigationComponentContext = /*#__PURE__*/ createContext(DefaultNavLinkComponent);
|
|
8
|
-
export const NavigationLegacyContext = /*#__PURE__*/ createContext(false);
|
|
9
|
-
export const NavigationLocationContext = /*#__PURE__*/ createContext({
|
|
10
|
-
location: {
|
|
11
|
-
pathname: ''
|
|
12
|
-
},
|
|
13
|
-
isLinkActive: ()=>false
|
|
14
|
-
});
|
|
15
7
|
|
|
16
8
|
//# sourceMappingURL=navigation-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/navigation-context.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/navigation-context.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, FC } from 'react';\n\nexport type NavLinkComponentProps = ComponentPropsWithoutRef<'a'> & {\n to: string;\n activeClassName?: string;\n isActive?: (pathname: string) => boolean;\n};\n\nexport const DefaultNavLinkComponent: FC<NavLinkComponentProps> = ({\n children,\n to,\n activeClassName,\n isActive,\n ...props\n}) => (\n <a href={to} {...props}>\n {children}\n </a>\n);\n"],"names":["DefaultNavLinkComponent","children","to","activeClassName","isActive","props","a","href"],"mappings":";AAQA,OAAO,MAAMA,0BAAqD,CAAC,EAC/DC,QAAQ,EACRC,EAAE,EACFC,eAAe,EACfC,QAAQ,EACR,GAAGC,OACN,iBACG,KAACC;QAAEC,MAAML;QAAK,GAAGG,KAAK;kBACjBJ;OAEP"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { IconProps } from '@servicetitan/anvil2';
|
|
2
|
-
import { FC } from 'react';
|
|
3
2
|
import { CounterTagData, CounterTagValue } from './counter-tag';
|
|
4
3
|
export interface NavigationItemData extends NavigationLinkData {
|
|
5
|
-
/** flag if the link is not shown (based on FG and/or user permissions) */
|
|
6
|
-
isHidden?: boolean;
|
|
7
|
-
/** custom className (can be used for mdi icons) */
|
|
8
|
-
iconClassName?: string;
|
|
9
4
|
/** svg icon (anvil2) of inactive item */
|
|
10
5
|
icon: IconProps['svg'] | undefined;
|
|
11
6
|
/** svg icon (anvil2) of active item */
|
|
12
7
|
iconActive: IconProps['svg'] | undefined;
|
|
13
|
-
/** icon component of item (<svg />) */
|
|
14
|
-
iconComponent?: FC;
|
|
15
8
|
/** item tag (optional). shown if it is set and true or greater than 0 */
|
|
16
9
|
counter?: CounterTagValue;
|
|
17
10
|
tag?: CounterTagData;
|
|
@@ -19,6 +12,8 @@ export interface NavigationItemData extends NavigationLinkData {
|
|
|
19
12
|
className?: string;
|
|
20
13
|
/** optional submenu of link item */
|
|
21
14
|
submenu?: NavigationSubmenuData;
|
|
15
|
+
iconClassName?: never;
|
|
16
|
+
iconComponent?: never;
|
|
22
17
|
}
|
|
23
18
|
export interface NavigationLinkData {
|
|
24
19
|
/** link id */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/utils/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/utils/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC1D,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IAEnC,uCAAuC;IACvC,UAAU,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IAEzC,yEAAyE;IACzE,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,GAAG,CAAC,EAAE,cAAc,CAAC;IAErB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oCAAoC;IACpC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAEhC,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,aAAa,CAAC,EAAE,KAAK,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAC/B,cAAc;IACd,EAAE,EAAE,MAAM,CAAC;IAEX,gBAAgB;IAChB,EAAE,EAAE,MAAM,CAAC;IAEX,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,qBAAqB;IAClC,qBAAqB;IACrB,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,yBAA0B,SAAQ,kBAAkB;IACjE,+EAA+E;IAC/E,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,GAAG,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACvC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IAEd,0BAA0B;IAC1B,KAAK,EAAE,yBAAyB,EAAE,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/navigation.ts"],"sourcesContent":["import { IconProps } from '@servicetitan/anvil2';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/navigation.ts"],"sourcesContent":["import { IconProps } from '@servicetitan/anvil2';\nimport { CounterTagData, CounterTagValue } from './counter-tag';\n\nexport interface NavigationItemData extends NavigationLinkData {\n /** svg icon (anvil2) of inactive item */\n icon: IconProps['svg'] | undefined;\n\n /** svg icon (anvil2) of active item */\n iconActive: IconProps['svg'] | undefined;\n\n /** item tag (optional). shown if it is set and true or greater than 0 */\n counter?: CounterTagValue;\n tag?: CounterTagData;\n\n /** class name of link item */\n className?: string;\n\n /** optional submenu of link item */\n submenu?: NavigationSubmenuData;\n\n iconClassName?: never;\n iconComponent?: never;\n}\n\nexport interface NavigationLinkData {\n /** link id */\n id: string;\n\n /** link href */\n to: string;\n\n /** link title */\n title: string;\n\n /** callback to return active state. By default, it compares link href with current pathname */\n isActive?: boolean | ((pathname: string) => boolean);\n}\n\nexport interface NavigationSubmenuData {\n /** submenu groups */\n groups: NavigationSubmenuGroupData[];\n}\n\nexport interface NavigationSubmenuItemData extends NavigationLinkData {\n /** item tag (optional) value. shown if it is set and true or greater than 0 */\n counter?: CounterTagValue;\n tag?: CounterTagData;\n}\n\nexport interface NavigationSubmenuGroupData {\n /** submenu group title */\n title: string;\n\n /** submenu group links */\n links: NavigationSubmenuItemData[];\n}\n"],"names":[],"mappings":"AAiDA,WAMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0-canary.256.299dd08.0",
|
|
4
4
|
"description": "Navigation components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"less": true,
|
|
43
43
|
"webpack": false
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "299dd087e8e83bb8c0925bdec75c5df838740a92"
|
|
46
46
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PopoverPropsStrict } from '@servicetitan/design-system';
|
|
2
|
+
import { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
3
|
+
import { CounterTagData, CounterTagValue } from '../../utils/counter-tag';
|
|
4
|
+
|
|
5
|
+
export type ProfileDropdownTriggerProps = {
|
|
6
|
+
info?: { title: string; text: string };
|
|
7
|
+
imageSrc?: string | null;
|
|
8
|
+
avatarBadge?: boolean | string;
|
|
9
|
+
badge?: { content?: number | string; className: string };
|
|
10
|
+
} & Omit<ComponentPropsWithoutRef<'div'>, 'onClick'>;
|
|
11
|
+
|
|
12
|
+
export type ProfileDropdownProps = {
|
|
13
|
+
direction?: PopoverPropsStrict['direction'];
|
|
14
|
+
trigger?: Omit<ProfileDropdownTriggerProps, 'onClick' | 'open' | 'hintArrow'>;
|
|
15
|
+
hintPopup?: {
|
|
16
|
+
className?: string;
|
|
17
|
+
content: FC<{ openProfile(): void }>;
|
|
18
|
+
width?: PopoverPropsStrict['width'];
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
};
|
|
21
|
+
portal?: boolean;
|
|
22
|
+
width?: PopoverPropsStrict['width'];
|
|
23
|
+
onClose?(): void;
|
|
24
|
+
onOpen?(): void;
|
|
25
|
+
} & ComponentPropsWithoutRef<'div'>;
|
|
26
|
+
|
|
27
|
+
export type ProfileItemContent =
|
|
28
|
+
| { children: string; text?: string }
|
|
29
|
+
| { children: ReactNode; text: string };
|
|
30
|
+
|
|
31
|
+
export type ProfileDropdownSectionProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
id: string;
|
|
34
|
+
tooltip?: string;
|
|
35
|
+
tag?: CounterTagData;
|
|
36
|
+
counter?: CounterTagValue;
|
|
37
|
+
} & ProfileItemContent;
|
|
38
|
+
|
|
39
|
+
export type ProfileDropdownLinkProps = Omit<ComponentPropsWithoutRef<'a'>, 'children'> & {
|
|
40
|
+
id: string;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
external?: boolean;
|
|
43
|
+
tooltip?: string;
|
|
44
|
+
to: string;
|
|
45
|
+
tag?: CounterTagData;
|
|
46
|
+
counter?: CounterTagValue;
|
|
47
|
+
} & ProfileItemContent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NavLinkMock, withAnvil, withMemoryRouter } from '../../test/data';
|
|
2
|
+
import { TitanLayout } from '../titan-layout';
|
|
3
|
+
import { DesktopProfileDropdown } from './profile-dropdown';
|
|
4
|
+
|
|
5
|
+
const withLayout = (Story: any) => (
|
|
6
|
+
<TitanLayout navVariant="top" profile={<Story />} navigationComponent={NavLinkMock} />
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Navigation/DesktopProfileDropdown/Legacy',
|
|
11
|
+
component: DesktopProfileDropdown,
|
|
12
|
+
parameters: {},
|
|
13
|
+
decorators: [withMemoryRouter, withAnvil, withLayout],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ProfileDropdownDefault,
|
|
18
|
+
ProfileDropdownWithBothBadges,
|
|
19
|
+
ProfileDropdownWithCounter,
|
|
20
|
+
ProfileDropdownWithErrorLogo,
|
|
21
|
+
ProfileDropdownWithInfo,
|
|
22
|
+
ProfileDropdownWithHintAndInfoPopup,
|
|
23
|
+
ProfileDropdownWithHintPopup,
|
|
24
|
+
ProfileDropdownWithLogo,
|
|
25
|
+
} from './profile-dropdown.stories';
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { withAnvil, withMemoryRouter } from '../../test/data';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { NavLinkMock, navItems, withAnvil, withMemoryRouter } from '../../test/data';
|
|
2
|
+
import { TitanLayout } from '../titan-layout';
|
|
3
|
+
import { DesktopProfileDropdown } from './profile-dropdown';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const withStackedLayout = (Story: any) => (
|
|
6
|
+
<TitanLayout
|
|
7
|
+
navVariant="top"
|
|
8
|
+
top={<div />}
|
|
9
|
+
profile={<Story />}
|
|
10
|
+
navigationMainItems={[navItems.accounting]}
|
|
11
|
+
navigationComponent={NavLinkMock}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
6
14
|
|
|
7
15
|
export default {
|
|
8
|
-
title: 'Navigation/
|
|
9
|
-
component:
|
|
16
|
+
title: 'Navigation/DesktopProfileDropdown/Stacked',
|
|
17
|
+
component: DesktopProfileDropdown,
|
|
10
18
|
parameters: {},
|
|
11
|
-
decorators: [withMemoryRouter, withAnvil
|
|
19
|
+
decorators: [withStackedLayout, withMemoryRouter, withAnvil],
|
|
12
20
|
};
|
|
13
21
|
|
|
14
22
|
export {
|
|
@@ -1,58 +1,65 @@
|
|
|
1
1
|
import { Button } from '@servicetitan/design-system';
|
|
2
|
-
import { withAnvil, withMemoryRouter } from '../../test/data';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { NavLinkMock, withAnvil, withMemoryRouter } from '../../test/data';
|
|
3
|
+
import { TitanLayout } from '../titan-layout';
|
|
4
|
+
import { DesktopProfileDropdown } from './profile-dropdown';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
<
|
|
8
|
-
<Story />
|
|
9
|
-
</HeaderNavigation>
|
|
6
|
+
const withLegacyLayout = (Story: any) => (
|
|
7
|
+
<TitanLayout navigationComponent={NavLinkMock} profile={<Story />} />
|
|
10
8
|
);
|
|
11
9
|
|
|
12
10
|
export default {
|
|
13
|
-
title: 'Navigation/
|
|
14
|
-
component:
|
|
11
|
+
title: 'Navigation/DesktopProfileDropdown/Default',
|
|
12
|
+
component: DesktopProfileDropdown,
|
|
15
13
|
parameters: {},
|
|
16
|
-
decorators: [withMemoryRouter, withAnvil
|
|
14
|
+
decorators: [withLegacyLayout, withMemoryRouter, withAnvil],
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
export const ProfileDropdownDefault = () => (
|
|
20
|
-
<
|
|
21
|
-
<
|
|
18
|
+
<DesktopProfileDropdown>
|
|
19
|
+
<DesktopProfileDropdown.Link id="first" to="https://google.com" external>
|
|
22
20
|
first link
|
|
23
|
-
</
|
|
24
|
-
<
|
|
21
|
+
</DesktopProfileDropdown.Link>
|
|
22
|
+
<DesktopProfileDropdown.Section id="second" onClick={() => alert('second click')}>
|
|
25
23
|
second link
|
|
26
|
-
</
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
24
|
+
</DesktopProfileDropdown.Section>
|
|
25
|
+
<DesktopProfileDropdown.Divider />
|
|
26
|
+
<DesktopProfileDropdown.Section id="content">some content</DesktopProfileDropdown.Section>
|
|
27
|
+
<DesktopProfileDropdown.Divider />
|
|
28
|
+
<DesktopProfileDropdown.Divider />
|
|
29
|
+
<DesktopProfileDropdown.Divider />
|
|
30
|
+
<DesktopProfileDropdown.Link id="third" to="third">
|
|
33
31
|
third link
|
|
34
|
-
</
|
|
35
|
-
<
|
|
36
|
-
|
|
32
|
+
</DesktopProfileDropdown.Link>
|
|
33
|
+
<DesktopProfileDropdown.Divider />
|
|
34
|
+
<DesktopProfileDropdown.Section
|
|
35
|
+
id="forth"
|
|
36
|
+
onClick={() => alert('forth click')}
|
|
37
|
+
text="Sign Out user"
|
|
38
|
+
>
|
|
39
|
+
Sign Out
|
|
40
|
+
<span className="c-neutral-60 m-l-1">user</span>
|
|
41
|
+
</DesktopProfileDropdown.Section>
|
|
42
|
+
<DesktopProfileDropdown.Divider />
|
|
43
|
+
</DesktopProfileDropdown>
|
|
37
44
|
);
|
|
38
45
|
|
|
39
46
|
export const ProfileDropdownWithLogo = () => (
|
|
40
|
-
<
|
|
47
|
+
<DesktopProfileDropdown
|
|
41
48
|
trigger={{
|
|
42
49
|
imageSrc: 'https://upload.wikimedia.org/wikipedia/en/1/11/Milhouse_Van_Houten.png',
|
|
43
50
|
}}
|
|
44
51
|
>
|
|
45
|
-
<
|
|
52
|
+
<DesktopProfileDropdown.Link id="first" to="https://google.com">
|
|
46
53
|
first link
|
|
47
|
-
</
|
|
48
|
-
<
|
|
54
|
+
</DesktopProfileDropdown.Link>
|
|
55
|
+
<DesktopProfileDropdown.Section id="second" onClick={() => alert('second click')}>
|
|
49
56
|
second link
|
|
50
|
-
</
|
|
51
|
-
</
|
|
57
|
+
</DesktopProfileDropdown.Section>
|
|
58
|
+
</DesktopProfileDropdown>
|
|
52
59
|
);
|
|
53
60
|
|
|
54
61
|
export const ProfileDropdownWithErrorLogo = () => (
|
|
55
|
-
<
|
|
62
|
+
<DesktopProfileDropdown
|
|
56
63
|
trigger={{
|
|
57
64
|
imageSrc: 'https://some.incorrect.url/logo.png',
|
|
58
65
|
}}
|
|
@@ -60,7 +67,7 @@ export const ProfileDropdownWithErrorLogo = () => (
|
|
|
60
67
|
);
|
|
61
68
|
|
|
62
69
|
export const ProfileDropdownWithInfo = () => (
|
|
63
|
-
<
|
|
70
|
+
<DesktopProfileDropdown
|
|
64
71
|
trigger={{
|
|
65
72
|
info: { text: 'first', title: 'tenant user' },
|
|
66
73
|
avatarBadge: true,
|
|
@@ -69,7 +76,7 @@ export const ProfileDropdownWithInfo = () => (
|
|
|
69
76
|
);
|
|
70
77
|
|
|
71
78
|
export const ProfileDropdownWithCounter = () => (
|
|
72
|
-
<
|
|
79
|
+
<DesktopProfileDropdown
|
|
73
80
|
trigger={{
|
|
74
81
|
info: { text: 'first', title: 'tenant user' },
|
|
75
82
|
avatarBadge: true,
|
|
@@ -79,7 +86,7 @@ export const ProfileDropdownWithCounter = () => (
|
|
|
79
86
|
);
|
|
80
87
|
|
|
81
88
|
export const ProfileDropdownWithBothBadges = () => (
|
|
82
|
-
<
|
|
89
|
+
<DesktopProfileDropdown
|
|
83
90
|
trigger={{
|
|
84
91
|
avatarBadge: 'yellow-500',
|
|
85
92
|
badge: { className: 'bg-red-400' },
|
|
@@ -91,7 +98,7 @@ export const ProfileDropdownWithBothBadges = () => (
|
|
|
91
98
|
const log = (text: string) => console.log(text);
|
|
92
99
|
|
|
93
100
|
export const ProfileDropdownWithHintPopup = () => (
|
|
94
|
-
<
|
|
101
|
+
<DesktopProfileDropdown
|
|
95
102
|
trigger={{
|
|
96
103
|
avatarBadge: 'yellow-500',
|
|
97
104
|
badge: { className: 'bg-red-400' },
|
|
@@ -112,19 +119,19 @@ export const ProfileDropdownWithHintPopup = () => (
|
|
|
112
119
|
onOpen={() => log('open profile dropdown')}
|
|
113
120
|
onClose={() => log('close profile dropdown')}
|
|
114
121
|
>
|
|
115
|
-
<
|
|
122
|
+
<DesktopProfileDropdown.Link id="first" to="https://google.com" counter={12}>
|
|
116
123
|
first item
|
|
117
|
-
</
|
|
118
|
-
<
|
|
119
|
-
<
|
|
120
|
-
<
|
|
124
|
+
</DesktopProfileDropdown.Link>
|
|
125
|
+
<DesktopProfileDropdown.Divider />
|
|
126
|
+
<DesktopProfileDropdown.Section id="second">second item</DesktopProfileDropdown.Section>
|
|
127
|
+
<DesktopProfileDropdown.Link id="third" to="https://google.com" tag={{ value: 1 }}>
|
|
121
128
|
third item
|
|
122
|
-
</
|
|
123
|
-
</
|
|
129
|
+
</DesktopProfileDropdown.Link>
|
|
130
|
+
</DesktopProfileDropdown>
|
|
124
131
|
);
|
|
125
132
|
|
|
126
133
|
export const ProfileDropdownWithHintAndInfoPopup = () => (
|
|
127
|
-
<
|
|
134
|
+
<DesktopProfileDropdown
|
|
128
135
|
trigger={{
|
|
129
136
|
avatarBadge: 'yellow-500',
|
|
130
137
|
badge: { className: 'bg-red-400' },
|