@servicetitan/navigation 12.0.3 → 13.0.0-canary.256.5761ed1.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 +66 -13
- 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 -25
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +56 -52
- 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 +33 -18
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +49 -24
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- 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 +10 -8
- 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 +72 -16
- 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 +169 -116
- package/src/components/titan-layout/layout-sidebar-links.tsx +73 -24
- package/src/components/titan-layout/layout-sidebar.tsx +52 -28
- package/src/components/titan-layout/{titan-layout.stories.tsx → titan-layout-default.stories.tsx} +125 -113
- 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 +12 -9
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/titan-layout.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CSSProperties,\n ComponentPropsWithoutRef,\n FC,\n Fragment,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { NavigationItemData } from '../../utils/navigation';\nimport { DefaultNavLinkComponent, NavLinkComponentProps } from '../../utils/navigation-context';\nimport { useTitanBreakpoint } from '../../utils/use-breakpoint';\nimport { TitanLayoutState } from './interface';\nimport {\n LayoutContext,\n LayoutPlacementContext,\n TitanLayoutContextType,\n TitanLayoutSidebarContextType,\n} from './layout-context';\nimport { LayoutHeader } from './layout-header';\nimport { LayoutHeaderDark } from './layout-header-dark';\nimport { TitanLayoutLogoProps } from './layout-logo';\nimport { LayoutSidebar } from './layout-sidebar';\nimport { TitanLayoutSidebarLink, TitanLayoutSidebarTrigger } from './layout-sidebar-links';\nimport { InternalSideNavigationTrigger } from './layout-sidebar-links-internal';\nimport { useNotificationsState } from './notifications-context';\nimport * as Styles from './titan-layout.module.less';\n\nexport type TitanLayoutProps = Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'style'> & {\n /** layout appearance */\n appearance?: 'legacy' | 'anvil1' | 'anvil2';\n\n /** layout navigation variant (left by default) */\n navVariant?: 'left' | 'top';\n\n /** layout's content */\n children?: ReactNode;\n\n /** show only content without side and top bars */\n contentOnly?: boolean;\n\n /** component used for navigation */\n navigationComponent?: FC<NavLinkComponentProps>;\n\n /** data for main navigation links */\n navigationMainItems?: NavigationItemData[];\n\n /** data for overflow navigation links (used only with top variant) */\n navigationOverflowItems?: NavigationItemData[];\n\n /** logo props */\n logo?: TitanLayoutLogoProps;\n\n state?: TitanLayoutState;\n onStateChange?: (state: TitanLayoutState) => void;\n\n header?: ReactElement;\n top?: ReactElement;\n sideTop?: ReactElement[];\n profile?: ReactElement;\n extraLinks?: ReactElement;\n extraLinksTop?: ReactElement;\n extraText?: string;\n minContentWidth?: number;\n};\n\nconst defaultSidebarContext: TitanLayoutSidebarContextType = {\n styles: {\n popoverContent: {\n '--background-color-strong': '#24323C',\n 'color': 'var(--color-white)',\n } as CSSProperties,\n },\n};\n\nconst useAppearance = (appearance: TitanLayoutProps['appearance']) =>\n useMemo(() => {\n const isLegacy = appearance === 'legacy';\n const isAnvil1 = appearance === 'anvil1';\n const isAnvil2 = appearance === 'anvil2';\n\n return {\n isLegacy,\n isAnvil1,\n isAnvil2,\n isSequent: isLegacy || isAnvil2,\n };\n }, [appearance]);\n\nconst TitanLayoutComponent: FC<TitanLayoutProps> = ({\n appearance = 'anvil2',\n navVariant = 'left',\n id,\n children,\n contentOnly,\n navigationComponent,\n header,\n top,\n profile,\n state,\n logo,\n onStateChange,\n navigationMainItems,\n navigationOverflowItems,\n extraLinks,\n extraLinksTop,\n extraText,\n minContentWidth,\n sideTop,\n}) => {\n const breakpoint = useTitanBreakpoint();\n const context: TitanLayoutContextType = useMemo(\n () => ({\n NavigationComponent: navigationComponent ?? DefaultNavLinkComponent,\n breakpoint,\n isTitanLayout: true,\n sidebar: defaultSidebarContext,\n }),\n [navigationComponent, breakpoint]\n );\n const view = useAppearance(appearance);\n const [mobileDrawerOpened, setMobileDrawerOpened] = useState(false);\n const { hasNotifications, NotificationsContextProvider } = useNotificationsState();\n const [offsetTopStyles, setOffsetTopStyles] = useState<object>({});\n const updateIndicatorsHeight = useCallback((offset: number) => {\n setOffsetTopStyles({\n '--content-offset-top': `calc(var(--nav-offset-top) + ${offset}px)`,\n });\n }, []);\n\n const isMobile = breakpoint.isMobile;\n const hasSideBar =\n !contentOnly &&\n (navVariant === 'left' || (navVariant === 'top' && isMobile)) &&\n (!!navigationMainItems?.length || !!sideTop?.length);\n const hasTopBar = !contentOnly;\n\n useEffect(() => {\n if (view.isAnvil1) {\n const bodyClassName = 'of-hidden-i';\n document.body.classList.add(bodyClassName);\n return () => document.body.classList.remove(bodyClassName);\n }\n }, [view.isAnvil1]);\n\n const onBurgerClick = useCallback((e: MouseEvent) => {\n setMobileDrawerOpened(true);\n e.stopPropagation();\n }, []);\n\n const onBarExpandChange = useCallback(\n (expanded: boolean) => {\n if (isMobile) {\n setMobileDrawerOpened(false);\n } else {\n onStateChange?.({ navCollapsed: !expanded });\n }\n },\n [onStateChange, isMobile]\n );\n const onSubmenuExpandChange = useCallback(\n (id: string, expanded: boolean) => {\n onStateChange?.({\n navCollapsed: state?.navCollapsed ?? false,\n submenuExpanded: expanded ? id : undefined,\n });\n },\n [state, onStateChange]\n );\n const sidebarNavItems = useMemo(() => {\n if (!hasSideBar) {\n return undefined;\n }\n\n if (navVariant === 'left') {\n return navigationMainItems;\n }\n\n return [...(navigationMainItems ?? []), ...(navigationOverflowItems ?? [])];\n }, [hasSideBar, navigationMainItems, navigationOverflowItems, navVariant]);\n\n const hasMenuNotifications = useMemo(() => {\n try {\n return (\n sidebarNavItems?.some(item => {\n if (item.counter || item.tag?.value) {\n return true;\n } else if (item.submenu) {\n return item.submenu.groups.some(group =>\n group.links.some(link => !!link.counter || !!link.tag?.value)\n );\n }\n return false;\n }) ?? false\n );\n } catch {\n return false;\n }\n }, [sidebarNavItems]);\n\n const limitContentWidth = useMemo(() => {\n if (view.isAnvil2 || !minContentWidth) {\n return undefined;\n }\n\n if (breakpoint.width < minContentWidth) {\n return minContentWidth;\n }\n }, [view, minContentWidth, breakpoint.width]);\n\n const contentStyles = useMemo(() => {\n if (view.isAnvil2) {\n return offsetTopStyles;\n }\n\n if (view.isLegacy) {\n return {\n ...(limitContentWidth\n ? { display: 'flex', flexDirection: 'column', minHeight: '100vh' }\n : {}),\n ...offsetTopStyles,\n };\n }\n }, [view, offsetTopStyles, limitContentWidth]);\n\n const layoutClass = view.isLegacy\n ? Styles.layoutLegacy\n : view.isAnvil1\n ? Styles.layoutAnvil1\n : Styles.layoutAnvil2;\n\n return (\n <LayoutContext.Provider value={context}>\n <LayoutPlacementContext.Provider value=\"unset\">\n <div\n id={id}\n className={classNames(\n Styles.layout,\n isMobile ? Styles.layoutMobile : Styles.layoutDesktop,\n hasTopBar &&\n (navVariant === 'left' || !top\n ? Styles.layoutTopLight\n : Styles.layoutTopNav),\n {\n [Styles.layoutNavSlim]: !isMobile && hasSideBar && state?.navCollapsed,\n [Styles.layoutNavWide]: !isMobile && hasSideBar && !state?.navCollapsed,\n },\n layoutClass\n )}\n style={contentStyles}\n >\n {view.isSequent && <div className={Styles.topPlaceholder} />}\n {hasTopBar &&\n (navVariant === 'left' ? (\n <LayoutHeader\n className={Styles.top}\n variant=\"light\"\n logo={logo}\n profile={isMobile ? undefined : profile}\n center={top}\n rightText={isMobile ? undefined : extraText}\n right={\n <Fragment>\n {extraLinksTop}\n {!isMobile && extraLinks}\n </Fragment>\n }\n isMobile={isMobile}\n hasNotifications={hasNotifications || hasMenuNotifications}\n onBurgerClick={onBurgerClick}\n />\n ) : (\n <LayoutHeaderDark\n className={Styles.top}\n logo={logo}\n profile={isMobile ? undefined : profile}\n center={top}\n rightText={isMobile ? undefined : extraText}\n right={\n <Fragment>\n {extraLinksTop}\n {!isMobile && extraLinks}\n </Fragment>\n }\n isMobile={isMobile}\n hasNotifications={hasNotifications || hasMenuNotifications}\n onBurgerClick={onBurgerClick}\n navigationMainItems={navigationMainItems}\n navigationOverflowItems={navigationOverflowItems}\n />\n ))}\n\n {hasSideBar && (\n <NotificationsContextProvider>\n <LayoutSidebar\n className={Styles.side}\n mobile={breakpoint.isMobile}\n barExpanded={!state?.navCollapsed}\n onBarExpandChange={onBarExpandChange}\n submenuExpanded={state?.submenuExpanded}\n onSubmenuExpandChange={onSubmenuExpandChange}\n drawerOpened={mobileDrawerOpened}\n onDrawerOpenChange={setMobileDrawerOpened}\n top={sideTop}\n mainItems={sidebarNavItems}\n navigationComponent={context.NavigationComponent}\n bottom={\n isMobile ? (\n <Fragment>\n {profile}\n {extraLinks}\n {!!extraText && (\n <InternalSideNavigationTrigger\n id=\"--extra-text\"\n title={extraText}\n submenuExpanded={undefined}\n tag={undefined}\n icon={undefined}\n iconActive={undefined}\n />\n )}\n </Fragment>\n ) : undefined\n }\n />\n </NotificationsContextProvider>\n )}\n\n {view.isSequent && (\n <TitanLayoutHeaderObserved heightChange={updateIndicatorsHeight}>\n {header}\n </TitanLayoutHeaderObserved>\n )}\n {view.isAnvil1 ? (\n <LayoutContentAnvil1 header={header} minWidth={limitContentWidth}>\n {children}\n </LayoutContentAnvil1>\n ) : view.isLegacy ? (\n <LayoutContentLegacy minWidth={limitContentWidth}>\n {children}\n </LayoutContentLegacy>\n ) : (\n children\n )}\n </div>\n </LayoutPlacementContext.Provider>\n </LayoutContext.Provider>\n );\n};\n\nconst TitanLayoutHeaderObserved: FC<{\n children: ReactNode;\n heightChange?(value: number): void;\n}> = ({ children, heightChange }) => {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (ref.current) {\n const updatePosition = () => {\n if (ref.current && heightChange) {\n const pos = ref.current.getBoundingClientRect();\n heightChange(pos.height);\n }\n };\n\n const observer = new ResizeObserver(updatePosition);\n observer.observe(ref.current);\n\n updatePosition();\n return () => observer.disconnect();\n }\n }, [heightChange]);\n\n useEffect(() => {\n return () => {\n heightChange?.(0);\n };\n }, [heightChange]);\n return (\n <div ref={ref} className={Styles.contentHeader} data-cy=\"layout-content-header\">\n {children}\n </div>\n );\n};\nconst TitanLayoutHeader: FC<{ children: ReactNode }> = ({ children }) => {\n return (\n <div className={Styles.contentHeader} data-cy=\"layout-content-header\">\n {children}\n </div>\n );\n};\n\nconst LayoutContentAnvil1: FC<{\n children: ReactNode;\n header?: ReactNode;\n minWidth?: number;\n}> = ({ children, header, minWidth }) => {\n const innerContentStyles: CSSProperties = useMemo(\n () => ({\n ...(minWidth ? { minWidth: `${minWidth}px`, overflowX: 'auto' } : {}),\n }),\n [minWidth]\n );\n\n return (\n <Fragment>\n <TitanLayoutHeader>{header}</TitanLayoutHeader>\n <div\n className={classNames(Styles.content, { 'of-x-auto-i': !!minWidth })}\n data-cy=\"layout-content\"\n >\n <div\n className=\"position-relative d-f flex-grow-1 flex-basis-0 of-hidden\"\n style={innerContentStyles}\n >\n {children}\n </div>\n </div>\n </Fragment>\n );\n};\n\nconst LayoutContentLegacy: FC<{\n children: ReactNode;\n minWidth: number | undefined;\n}> = ({ children, minWidth }) => {\n const innerContentStyles: CSSProperties = useMemo(\n () => ({\n position: 'relative',\n minWidth: `${minWidth}px`,\n }),\n [minWidth]\n );\n\n return (\n <div className={minWidth ? 'of-x-auto flex-basis-0 flex-grow-1' : undefined}>\n <div style={minWidth ? innerContentStyles : undefined}>{children}</div>\n </div>\n );\n};\n\nexport const TitanLayout = Object.assign(TitanLayoutComponent, {\n Link: TitanLayoutSidebarLink,\n Trigger: TitanLayoutSidebarTrigger,\n});\n"],"names":["classNames","Fragment","useCallback","useEffect","useMemo","useRef","useState","DefaultNavLinkComponent","useTitanBreakpoint","LayoutContext","LayoutPlacementContext","LayoutHeader","LayoutHeaderDark","LayoutSidebar","TitanLayoutSidebarLink","TitanLayoutSidebarTrigger","InternalSideNavigationTrigger","useNotificationsState","Styles","defaultSidebarContext","styles","popoverContent","useAppearance","appearance","isLegacy","isAnvil1","isAnvil2","isSequent","TitanLayoutComponent","navVariant","id","children","contentOnly","navigationComponent","header","top","profile","state","logo","onStateChange","navigationMainItems","navigationOverflowItems","extraLinks","extraLinksTop","extraText","minContentWidth","sideTop","breakpoint","context","NavigationComponent","isTitanLayout","sidebar","view","mobileDrawerOpened","setMobileDrawerOpened","hasNotifications","NotificationsContextProvider","offsetTopStyles","setOffsetTopStyles","updateIndicatorsHeight","offset","isMobile","hasSideBar","length","hasTopBar","bodyClassName","document","body","classList","add","remove","onBurgerClick","e","stopPropagation","onBarExpandChange","expanded","navCollapsed","onSubmenuExpandChange","submenuExpanded","undefined","sidebarNavItems","hasMenuNotifications","some","item","counter","tag","value","submenu","groups","group","links","link","limitContentWidth","width","contentStyles","display","flexDirection","minHeight","layoutClass","layoutLegacy","layoutAnvil1","layoutAnvil2","Provider","div","className","layout","layoutMobile","layoutDesktop","layoutTopLight","layoutTopNav","layoutNavSlim","layoutNavWide","style","topPlaceholder","variant","center","rightText","right","side","mobile","barExpanded","drawerOpened","onDrawerOpenChange","mainItems","bottom","title","icon","iconActive","TitanLayoutHeaderObserved","heightChange","LayoutContentAnvil1","minWidth","LayoutContentLegacy","ref","current","updatePosition","pos","getBoundingClientRect","height","observer","ResizeObserver","observe","disconnect","contentHeader","data-cy","TitanLayoutHeader","innerContentStyles","overflowX","content","position","TitanLayout","Object","assign","Link","Trigger"],"mappings":";AAAA,OAAOA,gBAAgB,aAAa;AACpC,SAIIC,QAAQ,EAGRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,QAAQ;AAEf,SAASC,uBAAuB,QAA+B,iCAAiC;AAChG,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,SACIC,aAAa,EACbC,sBAAsB,QAGnB,mBAAmB;AAC1B,SAASC,YAAY,QAAQ,kBAA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ACwB;YAAIS,OAAOmB,WAAWe,qBAAqBnE;sBAAYhD;;;AAGpE;AAEA,OAAO,MAAMuH,cAAcC,OAAOC,MAAM,CAAC5H,sBAAsB;IAC3D6H,MAAM3I;IACN4I,SAAS3I;AACb,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/titan-layout.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CSSProperties,\n ComponentPropsWithoutRef,\n FC,\n Fragment,\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { NavigationItemData } from '../../utils/navigation';\nimport { DefaultNavLinkComponent, NavLinkComponentProps } from '../../utils/navigation-context';\nimport { useTitanBreakpoint } from '../../utils/use-breakpoint';\nimport { TitanLayoutState } from './interface';\nimport {\n LayoutContext,\n LayoutPlacementContext,\n TitanLayoutContextType,\n TitanLayoutSidebarContextType,\n} from './layout-context';\nimport { LayoutHeader } from './layout-header';\nimport { LayoutHeaderDark } from './layout-header-dark';\nimport { TitanLayoutLogoProps } from './layout-logo';\nimport { LayoutSidebar } from './layout-sidebar';\nimport { InternalSideNavigationTrigger } from './layout-sidebar-links-internal';\nimport { useNotificationsState } from './notifications-context';\nimport { TitanLayoutLink, TitanLayoutTrigger } from './titan-layout-links';\nimport * as Styles from './titan-layout.module.less';\n\nexport type TitanLayoutProps = Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'style'> & {\n /** layout appearance */\n appearance?: 'legacy' | 'anvil1' | 'anvil2';\n\n /** layout navigation variant (left by default) */\n navVariant?: 'left' | 'top';\n\n /** layout's content */\n children?: ReactNode;\n\n /** show only content without side and top bars */\n contentOnly?: boolean;\n\n /** component used for navigation */\n navigationComponent?: FC<NavLinkComponentProps>;\n\n /** data for main navigation links */\n navigationMainItems?: NavigationItemData[];\n\n /** data for overflow navigation links (used only with top variant) */\n navigationOverflowItems?: NavigationItemData[];\n\n /** logo props */\n logo?: TitanLayoutLogoProps;\n\n state?: TitanLayoutState;\n onStateChange?: (state: TitanLayoutState) => void;\n\n header?: ReactElement;\n top?: ReactElement;\n sideTop?: ReactElement[];\n profile?: ReactElement;\n extraLinks?: ReactElement;\n extraLinksTop?: ReactElement;\n extraText?: string;\n minContentWidth?: number;\n};\n\nconst defaultSidebarContext: TitanLayoutSidebarContextType = {\n styles: {\n popoverContent: {\n '--background-color-strong': '#24323C',\n 'color': 'var(--color-white)',\n } as CSSProperties,\n },\n};\n\nconst useAppearance = (appearance: TitanLayoutProps['appearance']) =>\n useMemo(() => {\n const isLegacy = appearance === 'legacy';\n const isAnvil1 = appearance === 'anvil1';\n const isAnvil2 = appearance === 'anvil2';\n\n return {\n isLegacy,\n isAnvil1,\n isAnvil2,\n isSequent: isLegacy || isAnvil2,\n };\n }, [appearance]);\n\nfunction TitanLayoutComponent({\n appearance = 'anvil2',\n navVariant = 'left',\n id,\n children,\n contentOnly,\n navigationComponent,\n header,\n top,\n profile,\n state,\n logo,\n onStateChange,\n navigationMainItems,\n navigationOverflowItems,\n extraLinks,\n extraLinksTop,\n extraText,\n minContentWidth,\n sideTop,\n}: TitanLayoutProps) {\n const breakpoint = useTitanBreakpoint();\n const context: TitanLayoutContextType = useMemo(\n () => ({\n NavigationComponent: navigationComponent ?? DefaultNavLinkComponent,\n breakpoint,\n isTitanLayout: true,\n sidebar: defaultSidebarContext,\n }),\n [navigationComponent, breakpoint]\n );\n const view = useAppearance(appearance);\n const [mobileDrawerOpened, setMobileDrawerOpened] = useState(false);\n const { hasNotifications, NotificationsContextProvider } = useNotificationsState();\n const [offsetTopStyles, setOffsetTopStyles] = useState<object>({});\n const updateIndicatorsHeight = useCallback((offset: number) => {\n setOffsetTopStyles({\n '--content-offset-top': `calc(var(--nav-offset-top) + ${offset}px)`,\n });\n }, []);\n\n const isMobile = breakpoint.isMobile;\n const hasSideBar =\n !contentOnly &&\n (navVariant === 'left' || (navVariant === 'top' && isMobile)) &&\n (!!navigationMainItems?.length || !!sideTop?.length);\n const hasTopBar = !contentOnly;\n\n useEffect(() => {\n if (view.isAnvil1) {\n const bodyClassName = 'of-hidden-i';\n document.body.classList.add(bodyClassName);\n return () => document.body.classList.remove(bodyClassName);\n }\n }, [view.isAnvil1]);\n\n const onBurgerClick = useCallback((e: MouseEvent<never>) => {\n setMobileDrawerOpened(true);\n e.stopPropagation();\n }, []);\n\n const onBarExpandChange = useCallback(\n (expanded: boolean) => {\n if (isMobile) {\n setMobileDrawerOpened(false);\n } else {\n onStateChange?.({ navCollapsed: !expanded });\n }\n },\n [onStateChange, isMobile]\n );\n const onSubmenuExpandChange = useCallback(\n (id: string, expanded: boolean) => {\n onStateChange?.({\n navCollapsed: state?.navCollapsed ?? false,\n submenuExpanded: expanded ? id : undefined,\n });\n },\n [state, onStateChange]\n );\n const sidebarNavItems = useMemo(() => {\n if (!hasSideBar) {\n return undefined;\n }\n\n if (navVariant === 'left') {\n return navigationMainItems;\n }\n\n return [...(navigationMainItems ?? []), ...(navigationOverflowItems ?? [])];\n }, [hasSideBar, navigationMainItems, navigationOverflowItems, navVariant]);\n\n const hasMenuNotifications = useMemo(() => {\n try {\n return (\n sidebarNavItems?.some(item => {\n if (item.counter || item.tag?.value) {\n return true;\n } else if (item.submenu) {\n return item.submenu.groups.some(group =>\n group.links.some(link => !!link.counter || !!link.tag?.value)\n );\n }\n return false;\n }) ?? false\n );\n } catch {\n return false;\n }\n }, [sidebarNavItems]);\n\n const limitContentWidth = useMemo(() => {\n if (view.isAnvil2 || !minContentWidth) {\n return undefined;\n }\n\n if (breakpoint.width < minContentWidth) {\n return minContentWidth;\n }\n }, [view, minContentWidth, breakpoint.width]);\n\n const contentStyles = useMemo(() => {\n if (view.isAnvil2) {\n return offsetTopStyles;\n }\n\n if (view.isLegacy) {\n return {\n ...(limitContentWidth\n ? { display: 'flex', flexDirection: 'column', minHeight: '100vh' }\n : {}),\n ...offsetTopStyles,\n };\n }\n }, [view, offsetTopStyles, limitContentWidth]);\n\n const layoutClass = view.isLegacy\n ? Styles.layoutLegacy\n : view.isAnvil1\n ? Styles.layoutAnvil1\n : Styles.layoutAnvil2;\n\n return (\n <LayoutContext.Provider value={context}>\n <LayoutPlacementContext.Provider value=\"unset\">\n <div\n id={id}\n className={classNames(\n Styles.layout,\n isMobile ? Styles.layoutMobile : Styles.layoutDesktop,\n hasTopBar &&\n (navVariant === 'left' || !top\n ? Styles.layoutTopLight\n : Styles.layoutTopNav),\n {\n [Styles.layoutNavSlim]: !isMobile && hasSideBar && state?.navCollapsed,\n [Styles.layoutNavWide]: !isMobile && hasSideBar && !state?.navCollapsed,\n },\n layoutClass\n )}\n style={contentStyles}\n >\n {view.isSequent && <div className={Styles.topPlaceholder} />}\n {hasTopBar &&\n (navVariant === 'left' ? (\n <LayoutHeader\n className={Styles.top}\n variant=\"light\"\n logo={logo}\n profile={isMobile ? undefined : profile}\n center={top}\n rightText={isMobile ? undefined : extraText}\n right={\n <Fragment>\n {extraLinksTop}\n {!isMobile && extraLinks}\n </Fragment>\n }\n isMobile={isMobile}\n hasNotifications={hasNotifications || hasMenuNotifications}\n onBurgerClick={onBurgerClick}\n />\n ) : (\n <LayoutHeaderDark\n className={Styles.top}\n logo={logo}\n profile={isMobile ? undefined : profile}\n center={top}\n rightText={isMobile ? undefined : extraText}\n right={\n <Fragment>\n {extraLinksTop}\n {!isMobile && extraLinks}\n </Fragment>\n }\n isMobile={isMobile}\n hasNotifications={hasNotifications || hasMenuNotifications}\n onBurgerClick={onBurgerClick}\n navigationMainItems={navigationMainItems}\n navigationOverflowItems={navigationOverflowItems}\n />\n ))}\n\n {hasSideBar && (\n <NotificationsContextProvider>\n <LayoutSidebar\n className={Styles.side}\n mobile={breakpoint.isMobile}\n barExpanded={!state?.navCollapsed}\n onBarExpandChange={onBarExpandChange}\n submenuExpanded={state?.submenuExpanded}\n onSubmenuExpandChange={onSubmenuExpandChange}\n drawerOpened={mobileDrawerOpened}\n onDrawerOpenChange={setMobileDrawerOpened}\n top={sideTop}\n mainItems={sidebarNavItems}\n navigationComponent={context.NavigationComponent}\n bottom={\n isMobile ? (\n <Fragment>\n {profile}\n {extraLinks}\n {!!extraText && (\n <InternalSideNavigationTrigger\n id=\"--extra-text\"\n title={extraText}\n isActive={undefined}\n icon={undefined}\n iconActive={undefined}\n tag={undefined}\n className={undefined}\n submenuExpanded={undefined}\n />\n )}\n </Fragment>\n ) : undefined\n }\n />\n </NotificationsContextProvider>\n )}\n\n {view.isSequent && (\n <TitanLayoutHeaderObserved heightChange={updateIndicatorsHeight}>\n {header}\n </TitanLayoutHeaderObserved>\n )}\n {view.isAnvil1 ? (\n <LayoutContentAnvil1 header={header} minWidth={limitContentWidth}>\n {children}\n </LayoutContentAnvil1>\n ) : view.isLegacy ? (\n <LayoutContentLegacy minWidth={limitContentWidth}>\n {children}\n </LayoutContentLegacy>\n ) : (\n children\n )}\n </div>\n </LayoutPlacementContext.Provider>\n </LayoutContext.Provider>\n );\n}\n\nconst TitanLayoutHeaderObserved: FC<{\n children: ReactNode;\n heightChange?(value: number): void;\n}> = ({ children, heightChange }) => {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (ref.current) {\n const updatePosition = () => {\n if (ref.current && heightChange) {\n const pos = ref.current.getBoundingClientRect();\n heightChange(pos.height);\n }\n };\n\n const observer = new ResizeObserver(updatePosition);\n observer.observe(ref.current);\n\n updatePosition();\n return () => observer.disconnect();\n }\n }, [heightChange]);\n\n useEffect(() => {\n return () => {\n heightChange?.(0);\n };\n }, [heightChange]);\n return (\n <div ref={ref} className={Styles.contentHeader} data-cy=\"layout-content-header\">\n {children}\n </div>\n );\n};\nconst TitanLayoutHeader: FC<{ children: ReactNode }> = ({ children }) => {\n return (\n <div className={Styles.contentHeader} data-cy=\"layout-content-header\">\n {children}\n </div>\n );\n};\n\nconst LayoutContentAnvil1: FC<{\n children: ReactNode;\n header?: ReactNode;\n minWidth?: number;\n}> = ({ children, header, minWidth }) => {\n const innerContentStyles: CSSProperties = useMemo(\n () => ({\n ...(minWidth ? { minWidth: `${minWidth}px`, overflowX: 'auto' } : {}),\n }),\n [minWidth]\n );\n\n return (\n <Fragment>\n <TitanLayoutHeader>{header}</TitanLayoutHeader>\n <div\n className={classNames(Styles.content, { 'of-x-auto-i': !!minWidth })}\n data-cy=\"layout-content\"\n >\n <div\n className=\"position-relative d-f flex-grow-1 flex-basis-0 of-hidden\"\n style={innerContentStyles}\n >\n {children}\n </div>\n </div>\n </Fragment>\n );\n};\n\nconst LayoutContentLegacy: FC<{\n children: ReactNode;\n minWidth: number | undefined;\n}> = ({ children, minWidth }) => {\n const innerContentStyles: CSSProperties = useMemo(\n () => ({\n position: 'relative',\n minWidth: `${minWidth}px`,\n }),\n [minWidth]\n );\n\n return (\n <div className={minWidth ? 'of-x-auto flex-basis-0 flex-grow-1' : undefined}>\n <div style={minWidth ? innerContentStyles : undefined}>{children}</div>\n </div>\n );\n};\n\nexport const TitanLayout = Object.assign(TitanLayoutComponent, {\n Link: TitanLayoutLink,\n Trigger: TitanLayoutTrigger,\n});\n"],"names":["classNames","Fragment","useCallback","useEffect","useMemo","useRef","useState","DefaultNavLinkComponent","useTitanBreakpoint","LayoutContext","LayoutPlacementContext","LayoutHeader","LayoutHeaderDark","LayoutSidebar","InternalSideNavigationTrigger","useNotificationsState","TitanLayoutLink","TitanLayoutTrigger","Styles","defaultSidebarContext","styles","popoverContent","useAppearance","appearance","isLegacy","isAnvil1","isAnvil2","isSequent","TitanLayoutComponent","navVariant","id","children","contentOnly","navigationComponent","header","top","profile","state","logo","onStateChange","navigationMainItems","navigationOverflowItems","extraLinks","extraLinksTop","extraText","minContentWidth","sideTop","breakpoint","context","NavigationComponent","isTitanLayout","sidebar","view","mobileDrawerOpened","setMobileDrawerOpened","hasNotifications","NotificationsContextProvider","offsetTopStyles","setOffsetTopStyles","updateIndicatorsHeight","offset","isMobile","hasSideBar","length","hasTopBar","bodyClassName","document","body","classList","add","remove","onBurgerClick","e","stopPropagation","onBarExpandChange","expanded","navCollapsed","onSubmenuExpandChange","submenuExpanded","undefined","sidebarNavItems","hasMenuNotifications","some","item","counter","tag","value","submenu","groups","group","links","link","limitContentWidth","width","contentStyles","display","flexDirection","minHeight","layoutClass","layoutLegacy","layoutAnvil1","layoutAnvil2","Provider","div","className","layout","layoutMobile","layoutDesktop","layoutTopLight","layoutTopNav","layoutNavSlim","layoutNavWide","style","topPlaceholder","variant","center","rightText","right","side","mobile","barExpanded","drawerOpened","onDrawerOpenChange","mainItems","bottom","title","isActive","icon","iconActive","TitanLayoutHeaderObserved","heightChange","LayoutContentAnvil1","minWidth","LayoutContentLegacy","ref","current","updatePosition","pos","getBoundingClientRect","height","observer","ResizeObserver","observe","disconnect","contentHeader","data-cy","TitanLayoutHeader","innerContentStyles","overflowX","content","position","TitanLayout","Object","assign","Link","Trigger"],"mappings":";AAAA,OAAOA,gBAAgB,aAAa;AACpC,SAIIC,QAAQ,EAIRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,QAAQ;AAEf,SAASC,uBAAuB,QAA+B,iCAAiC;AAChG,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,SACIC,aAAa,EACbC,sBAAsB,QAGnB,mBAAmB;AAC1B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,6BAA6B,QAAQ,kCAAkC;AAChF,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,uBAAuB;AAC3E,YAAYC,YAAY,6BAA6B;AAwCrD,MAAMC,wBAAuD;IACzDC,QAAQ;QACJC,gBAAgB;YACZ,6BAA6B;YAC7B,SAAS;QACb;IACJ;AACJ;AAEA,MAAMC,gBAAgB,CAACC,aACnBnB,QAAQ;QACJ,MAAMoB,WAAWD,eAAe;QAChC,MAAME,WAAWF,eAAe;QAChC,MAAMG,WAAWH,eAAe;QAEhC,OA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qBACI,KAACwE;QAAIC,WAAWtF,OAAO8H,aAAa;QAAEC,WAAQ;kBACzClH;;AAGb;AAEA,MAAMoG,sBAID,CAAC,EAAEpG,QAAQ,EAAEG,MAAM,EAAEkG,QAAQ,EAAE;IAChC,MAAMe,qBAAoC/I,QACtC,IAAO,CAAA;YACH,GAAIgI,WAAW;gBAAEA,UAAU,GAAGA,SAAS,EAAE,CAAC;gBAAEgB,WAAW;YAAO,IAAI,CAAC,CAAC;QACxE,CAAA,GACA;QAAChB;KAAS;IAGd,qBACI,MAACnI;;0BACG,KAACiJ;0BAAmBhH;;0BACpB,KAACqE;gBACGC,WAAWxG,WAAWkB,OAAOmI,OAAO,EAAE;oBAAE,eAAe,CAAC,CAACjB;gBAAS;gBAClEa,WAAQ;0BAER,cAAA,KAAC1C;oBACGC,WAAU;oBACVQ,OAAOmC;8BAENpH;;;;;AAKrB;AAEA,MAAMsG,sBAGD,CAAC,EAAEtG,QAAQ,EAAEqG,QAAQ,EAAE;IACxB,MAAMe,qBAAoC/I,QACtC,IAAO,CAAA;YACHkJ,UAAU;YACVlB,UAAU,GAAGA,SAAS,EAAE,CAAC;QAC7B,CAAA,GACA;QAACA;KAAS;IAGd,qBACI,KAAC7B;QAAIC,WAAW4B,WAAW,uCAAuCrD;kBAC9D,cAAA,KAACwB;YAAIS,OAAOoB,WAAWe,qBAAqBpE;sBAAYhD;;;AAGpE;AAEA,OAAO,MAAMwH,cAAcC,OAAOC,MAAM,CAAC7H,sBAAsB;IAC3D8H,MAAM1I;IACN2I,SAAS1I;AACb,GAAG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
export * from './components/header-navigation';
|
|
2
1
|
export * from './components/logo/logo-company-title';
|
|
3
2
|
export * from './components/logo/logo-titan';
|
|
4
3
|
export * from './components/logo/logo-titan-text';
|
|
5
4
|
export * from './components/counter-tag';
|
|
6
|
-
export * from './components/left-navigation';
|
|
7
5
|
export * from './components/titan-layout';
|
|
8
|
-
export * from './components/links';
|
|
9
6
|
export type * from './utils/navigation';
|
|
10
|
-
export type {
|
|
11
|
-
export { NavigationComponentContext, NavigationLocationContext } from './utils/navigation-context';
|
|
12
|
-
export type * from './utils/navigation-legacy';
|
|
7
|
+
export type { NavLinkComponentProps } from './utils/navigation-context';
|
|
13
8
|
export * from './utils/use-breakpoint';
|
|
14
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,mBAAmB,oBAAoB,CAAC;AACxC,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
export * from './components/header-navigation';
|
|
2
1
|
export * from './components/logo/logo-company-title';
|
|
3
2
|
export * from './components/logo/logo-titan';
|
|
4
3
|
export * from './components/logo/logo-titan-text';
|
|
5
4
|
export * from './components/counter-tag';
|
|
6
|
-
export * from './components/left-navigation';
|
|
7
5
|
export * from './components/titan-layout';
|
|
8
|
-
export * from './components/links';
|
|
9
|
-
export { NavigationComponentContext, NavigationLocationContext } from './utils/navigation-context';
|
|
10
6
|
export * from './utils/use-breakpoint';
|
|
11
7
|
|
|
12
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './components/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './components/logo/logo-company-title';\nexport * from './components/logo/logo-titan';\nexport * from './components/logo/logo-titan-text';\nexport * from './components/counter-tag';\nexport * from './components/titan-layout';\nexport type * from './utils/navigation';\nexport type { NavLinkComponentProps } from './utils/navigation-context';\nexport * from './utils/use-breakpoint';\n"],"names":[],"mappings":"AAAA,cAAc,uCAAuC;AACrD,cAAc,+BAA+B;AAC7C,cAAc,oCAAoC;AAClD,cAAc,2BAA2B;AACzC,cAAc,4BAA4B;AAG1C,cAAc,yBAAyB"}
|
package/dist/test/data.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import { NavigationItemData } from '../utils/navigation';
|
|
3
|
+
export declare const NavLinkMock: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
4
|
+
to: string;
|
|
5
|
+
activeClassName?: string;
|
|
6
|
+
isActive?: (pathname: string) => boolean;
|
|
7
|
+
} & import("react").RefAttributes<any>>;
|
|
5
8
|
export declare const LocationInfo: FC<{
|
|
6
9
|
className?: string;
|
|
7
10
|
}>;
|
|
@@ -9,26 +12,26 @@ export declare const withMemoryRouter: (Story: any) => import("react/jsx-runtime
|
|
|
9
12
|
export declare const withAnvil: (Story: any) => import("react/jsx-runtime").JSX.Element;
|
|
10
13
|
export declare const InventoryIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
11
14
|
export declare const SearchIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare const
|
|
13
|
-
calendar:
|
|
14
|
-
schedule:
|
|
15
|
-
calls:
|
|
16
|
-
dashboard:
|
|
17
|
-
dispatch:
|
|
18
|
-
fleet:
|
|
19
|
-
followUps:
|
|
20
|
-
followUpsWithSubmenu:
|
|
21
|
-
inventory:
|
|
22
|
-
purchasing:
|
|
23
|
-
purchasingWithSubmenu:
|
|
24
|
-
accounting:
|
|
25
|
-
accountingWithSubmenu:
|
|
26
|
-
marketing:
|
|
27
|
-
priceBook:
|
|
28
|
-
pointOfSale:
|
|
29
|
-
projects:
|
|
30
|
-
reports:
|
|
31
|
-
tasks:
|
|
15
|
+
export declare const navItems: {
|
|
16
|
+
calendar: NavigationItemData;
|
|
17
|
+
schedule: NavigationItemData;
|
|
18
|
+
calls: NavigationItemData;
|
|
19
|
+
dashboard: NavigationItemData;
|
|
20
|
+
dispatch: NavigationItemData;
|
|
21
|
+
fleet: NavigationItemData;
|
|
22
|
+
followUps: NavigationItemData;
|
|
23
|
+
followUpsWithSubmenu: NavigationItemData;
|
|
24
|
+
inventory: NavigationItemData;
|
|
25
|
+
purchasing: NavigationItemData;
|
|
26
|
+
purchasingWithSubmenu: NavigationItemData;
|
|
27
|
+
accounting: NavigationItemData;
|
|
28
|
+
accountingWithSubmenu: NavigationItemData;
|
|
29
|
+
marketing: NavigationItemData;
|
|
30
|
+
priceBook: NavigationItemData;
|
|
31
|
+
pointOfSale: NavigationItemData;
|
|
32
|
+
projects: NavigationItemData;
|
|
33
|
+
reports: NavigationItemData;
|
|
34
|
+
tasks: NavigationItemData;
|
|
32
35
|
};
|
|
33
36
|
export declare const CallsNavigationTrigger: () => import("react/jsx-runtime").JSX.Element;
|
|
34
37
|
export declare const withDefaultRedirects: (Story: any) => import("react/jsx-runtime").JSX.Element;
|
package/dist/test/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/test/data.tsx"],"names":[],"mappings":"AAmCA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/test/data.tsx"],"names":[],"mappings":"AAmCA,OAAO,EAAE,EAAE,EAAkC,MAAM,OAAO,CAAC;AAK3D,OAAO,EACH,kBAAkB,EAGrB,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,WAAW;;;;uCAwBvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAInD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,GAAG,4CAI1C,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,GAAG,4CAInC,CAAC;AAEF,eAAO,MAAM,aAAa,+CAKzB,CAAC;AAEF,eAAO,MAAM,UAAU,+CAetB,CAAC;AAyCF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;CAuHpB,CAAC;AAEF,eAAO,MAAM,sBAAsB,+CAuBlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,OAAO,GAAG,4CAS9C,CAAC"}
|
package/dist/test/data.js
CHANGED
|
@@ -32,12 +32,11 @@ import SvgTasksActive from '@servicetitan/anvil2/assets/icons/st/gnav_tasks_acti
|
|
|
32
32
|
import SvgTasks from '@servicetitan/anvil2/assets/icons/st/gnav_tasks_inactive.svg';
|
|
33
33
|
import { BodyText, Popover } from '@servicetitan/design-system';
|
|
34
34
|
import classNames from 'classnames';
|
|
35
|
-
import { Fragment, forwardRef,
|
|
35
|
+
import { Fragment, forwardRef, useState } from 'react';
|
|
36
36
|
// needed only for storybook and added in root dependencies
|
|
37
37
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
38
|
-
import { MemoryRouter, Redirect, Switch,
|
|
39
|
-
import {
|
|
40
|
-
import { NavigationComponentContext, NavigationLocationContext } from '../utils/navigation-context';
|
|
38
|
+
import { MemoryRouter, Redirect, Switch, useHistory, useLocation } from 'react-router-dom';
|
|
39
|
+
import { TitanLayout } from '../components/titan-layout';
|
|
41
40
|
import * as Styles from './data-stories.module.less';
|
|
42
41
|
export const NavLinkMock = /*#__PURE__*/ forwardRef(({ to, children, activeClassName, className, isActive, ...rest }, ref)=>{
|
|
43
42
|
const history = useHistory();
|
|
@@ -67,28 +66,8 @@ export const LocationInfo = ({ className })=>{
|
|
|
67
66
|
]
|
|
68
67
|
});
|
|
69
68
|
};
|
|
70
|
-
const LocationProvider = ({ children })=>{
|
|
71
|
-
const location = useLocation();
|
|
72
|
-
const context = useMemo(()=>({
|
|
73
|
-
location: {
|
|
74
|
-
pathname: location.pathname
|
|
75
|
-
},
|
|
76
|
-
isLinkActive: (location, item)=>!!matchPath(location.pathname, item.to)
|
|
77
|
-
}), [
|
|
78
|
-
location.pathname
|
|
79
|
-
]);
|
|
80
|
-
return /*#__PURE__*/ _jsx(NavigationLocationContext.Provider, {
|
|
81
|
-
value: context,
|
|
82
|
-
children: children
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
69
|
export const withMemoryRouter = (Story)=>/*#__PURE__*/ _jsx(MemoryRouter, {
|
|
86
|
-
children: /*#__PURE__*/ _jsx(
|
|
87
|
-
value: NavLinkMock,
|
|
88
|
-
children: /*#__PURE__*/ _jsx(LocationProvider, {
|
|
89
|
-
children: /*#__PURE__*/ _jsx(Story, {})
|
|
90
|
-
})
|
|
91
|
-
})
|
|
70
|
+
children: /*#__PURE__*/ _jsx(Story, {})
|
|
92
71
|
});
|
|
93
72
|
export const withAnvil = (Story)=>/*#__PURE__*/ _jsx(AnvilProvider, {
|
|
94
73
|
className: Styles.fixIcons,
|
|
@@ -122,11 +101,10 @@ export const SearchIcon = ()=>/*#__PURE__*/ _jsx("svg", {
|
|
|
122
101
|
})
|
|
123
102
|
})
|
|
124
103
|
});
|
|
125
|
-
const
|
|
104
|
+
const getNavItem = (id, data)=>({
|
|
126
105
|
id,
|
|
127
106
|
to: '/' + id,
|
|
128
107
|
title: id[0].toUpperCase() + id.substring(1),
|
|
129
|
-
hint: id,
|
|
130
108
|
icon: undefined,
|
|
131
109
|
iconActive: undefined,
|
|
132
110
|
...data,
|
|
@@ -151,50 +129,42 @@ const getGroup = (title, links)=>({
|
|
|
151
129
|
title,
|
|
152
130
|
links
|
|
153
131
|
});
|
|
154
|
-
export const
|
|
155
|
-
calendar:
|
|
156
|
-
iconName: 'event',
|
|
132
|
+
export const navItems = {
|
|
133
|
+
calendar: getNavItem('calendar', {
|
|
157
134
|
icon: SvgSchedule,
|
|
158
135
|
iconActive: SvgScheduleActive
|
|
159
136
|
}),
|
|
160
|
-
schedule:
|
|
161
|
-
iconName: 'event',
|
|
137
|
+
schedule: getNavItem('schedule', {
|
|
162
138
|
icon: SvgSchedule,
|
|
163
139
|
iconActive: SvgScheduleActive
|
|
164
140
|
}),
|
|
165
|
-
calls:
|
|
166
|
-
iconName: 'local_phone',
|
|
141
|
+
calls: getNavItem('calls', {
|
|
167
142
|
icon: SvgCalls,
|
|
168
143
|
iconActive: SvgCallsActive,
|
|
169
144
|
counter: 1234
|
|
170
145
|
}),
|
|
171
|
-
dashboard:
|
|
172
|
-
iconName: 'odometer',
|
|
146
|
+
dashboard: getNavItem('dashboard', {
|
|
173
147
|
icon: SvgDashboard,
|
|
174
148
|
iconActive: SvgDashboardActive
|
|
175
149
|
}),
|
|
176
|
-
dispatch:
|
|
177
|
-
iconName: 'location_disabled',
|
|
150
|
+
dispatch: getNavItem('dispatch', {
|
|
178
151
|
icon: SvgDispatch,
|
|
179
152
|
iconActive: SvgDispatchActive,
|
|
180
153
|
tag: {
|
|
181
154
|
value: 3
|
|
182
155
|
}
|
|
183
156
|
}),
|
|
184
|
-
fleet:
|
|
185
|
-
iconName: 'fleet-pro',
|
|
157
|
+
fleet: getNavItem('fleet', {
|
|
186
158
|
icon: SvgFleetPro,
|
|
187
159
|
iconActive: SvgFleetProActive,
|
|
188
160
|
title: 'Fleet Pro'
|
|
189
161
|
}),
|
|
190
|
-
followUps:
|
|
191
|
-
iconName: 'flag',
|
|
162
|
+
followUps: getNavItem('followUps', {
|
|
192
163
|
icon: SvgFollowUp,
|
|
193
164
|
iconActive: SvgFollowUpActive,
|
|
194
165
|
title: 'Follow Up'
|
|
195
166
|
}),
|
|
196
|
-
followUpsWithSubmenu:
|
|
197
|
-
iconName: 'flag',
|
|
167
|
+
followUpsWithSubmenu: getNavItem('followUps', {
|
|
198
168
|
icon: SvgFollowUp,
|
|
199
169
|
iconActive: SvgFollowUpActive,
|
|
200
170
|
title: 'Follow Up',
|
|
@@ -214,16 +184,12 @@ export const items = {
|
|
|
214
184
|
]
|
|
215
185
|
}
|
|
216
186
|
}),
|
|
217
|
-
inventory:
|
|
218
|
-
iconName: 'toys',
|
|
187
|
+
inventory: getNavItem('inventory', {
|
|
219
188
|
icon: SvgInventory,
|
|
220
189
|
iconActive: SvgInventoryActive
|
|
221
190
|
}),
|
|
222
|
-
purchasing:
|
|
223
|
-
|
|
224
|
-
}),
|
|
225
|
-
purchasingWithSubmenu: getItem('purchasing', {
|
|
226
|
-
iconName: 'toys',
|
|
191
|
+
purchasing: getNavItem('purchasing', {}),
|
|
192
|
+
purchasingWithSubmenu: getNavItem('purchasing', {
|
|
227
193
|
icon: SvgInventory,
|
|
228
194
|
iconActive: SvgInventoryActive,
|
|
229
195
|
counter: true,
|
|
@@ -246,14 +212,12 @@ export const items = {
|
|
|
246
212
|
]
|
|
247
213
|
}
|
|
248
214
|
}),
|
|
249
|
-
accounting:
|
|
250
|
-
iconName: 'assignment',
|
|
215
|
+
accounting: getNavItem('accounting', {
|
|
251
216
|
icon: SvgAccounting,
|
|
252
217
|
iconActive: SvgAccountingActive,
|
|
253
218
|
counter: true
|
|
254
219
|
}),
|
|
255
|
-
accountingWithSubmenu:
|
|
256
|
-
iconName: 'assignment',
|
|
220
|
+
accountingWithSubmenu: getNavItem('accounting', {
|
|
257
221
|
icon: SvgAccounting,
|
|
258
222
|
iconActive: SvgAccountingActive,
|
|
259
223
|
counter: 1,
|
|
@@ -297,34 +261,28 @@ export const items = {
|
|
|
297
261
|
]
|
|
298
262
|
}
|
|
299
263
|
}),
|
|
300
|
-
marketing:
|
|
301
|
-
iconName: 'bullhorn',
|
|
264
|
+
marketing: getNavItem('marketing', {
|
|
302
265
|
icon: SvgMarketing,
|
|
303
266
|
iconActive: SvgMarketingActive
|
|
304
267
|
}),
|
|
305
|
-
priceBook:
|
|
306
|
-
iconName: 'book',
|
|
268
|
+
priceBook: getNavItem('pricebook', {
|
|
307
269
|
icon: SvgPriceBook,
|
|
308
270
|
iconActive: SvgPriceBookActive
|
|
309
271
|
}),
|
|
310
|
-
pointOfSale:
|
|
311
|
-
iconName: 'cash-register',
|
|
272
|
+
pointOfSale: getNavItem('pointOfSale', {
|
|
312
273
|
icon: SvgPos,
|
|
313
274
|
iconActive: SvgPosActive,
|
|
314
275
|
title: 'Point Of Sale'
|
|
315
276
|
}),
|
|
316
|
-
projects:
|
|
317
|
-
iconName: 'folder_special',
|
|
277
|
+
projects: getNavItem('projects', {
|
|
318
278
|
icon: SvgProjects,
|
|
319
279
|
iconActive: SvgProjectsActive
|
|
320
280
|
}),
|
|
321
|
-
reports:
|
|
322
|
-
iconName: 'folder_special',
|
|
281
|
+
reports: getNavItem('reports', {
|
|
323
282
|
icon: SvgReports,
|
|
324
283
|
iconActive: SvgReportsActive
|
|
325
284
|
}),
|
|
326
|
-
tasks:
|
|
327
|
-
iconName: 'format_list_bulleted',
|
|
285
|
+
tasks: getNavItem('tasks', {
|
|
328
286
|
icon: SvgTasks,
|
|
329
287
|
iconActive: SvgTasksActive
|
|
330
288
|
})
|
|
@@ -335,9 +293,8 @@ export const CallsNavigationTrigger = ()=>{
|
|
|
335
293
|
open: open,
|
|
336
294
|
onClickOutside: ()=>setOpen(false),
|
|
337
295
|
direction: "bl",
|
|
338
|
-
trigger: /*#__PURE__*/ _jsx(
|
|
296
|
+
trigger: /*#__PURE__*/ _jsx(TitanLayout.Trigger, {
|
|
339
297
|
id: "dialpad",
|
|
340
|
-
iconName: "phone",
|
|
341
298
|
counter: 2,
|
|
342
299
|
title: "Calls",
|
|
343
300
|
icon: SvgPhone,
|
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;AA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YAAY9E;IAChB;IACA6G,SAASxC,QAAQ,WAAW;QACxBoB,UAAU;QACVb,MAAMzE;QACN2E,YAAY5E;IAChB;IACA4G,OAAOzC,QAAQ,SAAS;QACpBoB,UAAU;QACVb,MAAMrE;QACNuE,YAAYxE;IAChB;AACJ,EAAE;AAEF,OAAO,MAAMyG,yBAAyB;IAClC,MAAM,CAACC,MAAMC,QAAQ,GAAGnG,SAAS;IAEjC,qBACI,KAACL;QACGuG,MAAMA;QACNE,gBAAgB,IAAMD,QAAQ;QAC9BE,WAAU;QACVC,uBACI,KAAC/F;YACGiD,IAAG;YACHmB,UAAS;YACTG,SAAS;YACTpB,OAAM;YACNI,MAAMlG;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","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AAG;;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"}
|