@pega/cosmos-react-core 10.0.0-build.9.7 → 10.0.0-build.9.9
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/lib/components/AIRewrite/AIRewrite.styles.d.ts +32 -12
- package/lib/components/AIRewrite/AIRewrite.styles.d.ts.map +1 -1
- package/lib/components/AIRewrite/AIRewrite.styles.js +5 -2
- package/lib/components/AIRewrite/AIRewrite.styles.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +3 -2
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +17 -7
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +23 -2
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.d.ts +1 -1
- package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.js +63 -23
- package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
- package/lib/components/AppShell/Notifications.d.ts +28 -0
- package/lib/components/AppShell/Notifications.d.ts.map +1 -0
- package/lib/components/AppShell/Notifications.js +145 -0
- package/lib/components/AppShell/Notifications.js.map +1 -0
- package/lib/components/AppShell/TouchAppShell.d.ts +1 -1
- package/lib/components/AppShell/TouchAppShell.d.ts.map +1 -1
- package/lib/components/AppShell/TouchAppShell.js +4 -3
- package/lib/components/AppShell/TouchAppShell.js.map +1 -1
- package/lib/components/AppShell/TouchAppShell.styles.d.ts +4 -2
- package/lib/components/AppShell/TouchAppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/index.d.ts +1 -1
- package/lib/components/AppShell/index.d.ts.map +1 -1
- package/lib/components/AppShell/index.js.map +1 -1
- package/lib/components/Dialog/Dialog.types.d.ts +42 -12
- package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
- package/lib/components/Dialog/FormDialog.js +29 -33
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/Dialog/FormDialogWrapper.d.ts +5 -0
- package/lib/components/Dialog/FormDialogWrapper.d.ts.map +1 -0
- package/lib/components/Dialog/FormDialogWrapper.js +13 -0
- package/lib/components/Dialog/FormDialogWrapper.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.js +6 -6
- package/lib/components/Dialog/TouchDialog.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.d.ts +2 -2
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.js +31 -30
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.d.ts +9 -4
- package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.js.map +1 -1
- package/lib/components/Dialog/TouchFormDialog.d.ts +5 -0
- package/lib/components/Dialog/TouchFormDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchFormDialog.js +53 -0
- package/lib/components/Dialog/TouchFormDialog.js.map +1 -0
- package/lib/components/Dialog/TouchFormDialog.styles.d.ts +7 -0
- package/lib/components/Dialog/TouchFormDialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/TouchFormDialog.styles.js +39 -0
- package/lib/components/Dialog/TouchFormDialog.styles.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +2 -1
- package/lib/components/Dialog/index.d.ts.map +1 -1
- package/lib/components/Dialog/index.js +2 -1
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/InlineEdit/InlineEdit.styles.d.ts +32 -12
- package/lib/components/InlineEdit/InlineEdit.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +32 -12
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.styles.js +9 -6
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
- package/lib/components/Modal/DockedModals.js +1 -1
- package/lib/components/Modal/DockedModals.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +1 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +1 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +1 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +1 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyboardEvent,\n MouseEvent,\n MouseEventHandler,\n ReactElement,\n ReactNode,\n Ref,\n RefObject\n} from 'react';\n\nimport type { AsProp, BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport type { ImageProps } from '../Image';\nimport type { ProgressProps } from '../Progress';\nimport type { SearchInputProps } from '../SearchInput';\nimport type { MenuItemProps } from '../Menu';\nimport type { MenuButtonProps } from '../MenuButton';\n\n/** Share Application button configuration */\nexport interface ShareAppConfig {\n /** Click handler for the share application button. */\n onClick: NavListItemProps['onClick'];\n /** Label for the share application button. */\n label?: string;\n}\n\n/** Portal switcher button configuration. */\nexport type PortalSwitcherConfig = Pick<MenuButtonProps, 'text' | 'icon' | 'onClick' | 'menu'>;\n\n/** AppShell props */\n\nexport interface AppInfoProps {\n /** The primary text to render in the header. */\n appName: string;\n /** If true, the appName will not be visibly displayed on screen. */\n appNameHidden?: boolean;\n /** The source for a small application image or logo that is rendered in the nav bar. */\n imageSrc: ImageProps['src'];\n /** The alt text for the image. Defaults to \"Application logo\" */\n imageAltText?: string;\n /** The source for the full size application image or logo that is rendered in the app header, if enabled. */\n fullImageSrc?: ImageProps['src'];\n /** URL or DOM id to navigate to. */\n href?: string;\n /** Click handler for the header. */\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n /** The secondary text to render in the header. */\n portalName?: string;\n /** Specifies where to open the link href. */\n target?: string;\n}\n\nexport interface ContextItem extends Pick<MenuItemProps, 'id' | 'primary' | 'visual' | 'href'> {\n selected: MenuItemProps['selected'];\n}\n\ninterface ContextSwitcherOptions extends BaseProps {\n /** Application contexts available to user. */\n contexts: ContextItem[];\n /** Callback on click of item in context switcher. */\n onContextClick: (id: MenuItemProps['id'], e: MouseEvent<HTMLElement>) => void;\n /** Label of context being modified; i.e: \"Switch Application\", \"Switch Studio\"\n * @default 'Switch to…'\n */\n label?: string;\n}\n\nexport type ContextSwitcherProps = ContextSwitcherOptions | Record<string, never>;\n\nexport interface AppShellProps extends BaseProps, NoChildrenProp {\n /** Props related to the App Shell header. */\n appInfo: AppInfoProps;\n /** The content of the application. */\n main: ReactNode;\n /** The active user of the application. */\n operator: OperatorProps;\n /** If true, a header will render containing the logo and name of the app as well as search and operator regions. */\n appHeader?: boolean;\n /** Context switcher configuration. */\n contextSwitcher?: ContextSwitcherProps;\n /** If true, the search results page will replace the search input in the app header with its own */\n searchPage?: boolean;\n /** Props related to the Search Input. */\n searchInput?: SearchInputProps;\n /**\n * The aria-label for the search input.\n * @default 'Sitewide'\n */\n searchLabel?: string;\n /** A set of cases that will render in an expanded list within the App Shell. */\n caseTypes?: CaseTypeProps[];\n /** A set of links that will render as a flat list in the App Shell. */\n links?: LinkProps[];\n /** Agent configuration. */\n agent?: AgentProps;\n /** A set of cases that will render as a flat list in the App Shell. */\n cases?: CaseProps[];\n /** Place the main content of the application into a loading state by way of a boolean or a custom message. */\n progress?: boolean | ProgressProps['message'];\n /** A set of app utilities like notifications, recents that renders at the bottom of AppShell */\n utils?: (UtilItemProps | ReactElement)[];\n /** A set of app utilities for the Header */\n headerUtils?: [ReactNode, ReactNode];\n /** Configuration for the help menu in the header */\n helpMenu?: MenuItemProps[];\n /** Banners will render above the main content if they are provided. */\n banners?: ReactNode;\n defaultExpanded?: boolean;\n /** When the navigation is collapsed menus will be shown on hover instead of on click */\n collapsedHoverMenus?: boolean;\n /** Configuration for the Share Application button. */\n shareApp?: ShareAppConfig;\n /** Configuration for the portal switcher button. */\n portalSwitcher?: PortalSwitcherConfig;\n /**\n * Orientation of the primary navigation.\n * @default 'side-rail'\n */\n navOrientation?: NavOrientation;\n /** Props related to the document tabs. When provided, shows horizontal tabs below the header. */\n documentTabs?: DocumentTabsProps;\n}\n\nexport type NavOrientation = 'side-rail' | 'top-bar';\n\nexport interface CaseTypeProps {\n /** The display name of the case. */\n name: string;\n /** The icon for the case. */\n icon?: string;\n /** Click handler for the case. */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport interface LinkProps extends ForwardProps {\n /** Unique id */\n id: string;\n /** The display name of the link. */\n name: string;\n /** URL or DOM id to navigate to. */\n href: string;\n /** The name of the Cosmos Icon to render as a visual. */\n icon?: string;\n /** Determines if the link represents the active page. */\n active?: boolean;\n /** A set of nested links. */\n links?: LinkProps[];\n /** Click handler for the link. */\n onClick?: MouseEventHandler<HTMLElement>;\n}\n\nexport interface AgentProps extends Pick<LinkProps, 'id' | 'name' | 'active' | 'onClick'> {\n /** Icon or visual element for the agent. */\n icon?: ReactNode;\n}\n\nexport interface CaseProps extends ForwardProps {\n /** Unique id */\n id: string;\n /** Name of the case or some primary information like title. */\n primary: string;\n /** Additional info of a case like timestamp. */\n secondary?: string;\n /** Presents short, quickly identifiable info to a user for a collapsed nav item. */\n collapsedItemInfo?: string;\n /** A visual element identifying the case. If not passed will render case-solid icon */\n visual?: ReactNode;\n /** Determines if the case represents the active page. */\n active?: boolean;\n /** Click handler for the case . */\n onClick?: MouseEventHandler<HTMLElement>;\n /** Dismiss handler for the case. */\n onDismiss?: MouseEventHandler<HTMLElement>;\n}\n\nexport interface OperatorProps {\n /** A visual element identifying the operator. */\n avatar: ReactNode;\n /** A list of actions that will populate a menu attached to the operator. */\n actions: Pick<NavListItemProps, 'id' | 'primary' | 'href' | 'onClick' | 'visual'>[];\n /** The name of the operator. */\n name: string;\n}\n\nexport interface UtilItemProps extends Pick<NavListItemProps, 'visual' | 'actions' | 'onClick'> {\n /** The display name of an utility item. */\n name: string;\n /** Number when given displays on top-right of a given icon. */\n count?: number;\n /** View that renders on an appShell drawer onClick of an item */\n drawerView?: ReactNode;\n /** Heading for view that renders */\n drawerHeader?: string;\n /** Callback that fires on appshell drawer open */\n onDrawerOpen?: () => void;\n /** Callback that fires on appshell drawer close */\n onDrawerClose?: () => void;\n}\n\nexport interface UtilsProps {\n /** Context switcher config. */\n contextSwitcher?: ContextSwitcherProps | Record<string, never>;\n /** The active user of the application. */\n operator?: AppShellProps['operator'];\n /** A set of app utilities like notifications, recents that renders at the bottom of AppShell */\n items?: (UtilItemProps | ReactElement)[];\n /** Configuration for the Share Application button. */\n shareApp?: ShareAppConfig;\n /** Configuration for the portal switcher button. */\n portalSwitcher?: PortalSwitcherConfig;\n}\n\nexport interface NavListProps extends AsProp, BaseProps {\n items?: (NavListItemProps | ReactElement)[];\n nestedList?: boolean;\n collapsed?: boolean;\n id?: string;\n /** Whether the list is of single-select style options */\n singleSelect?: boolean;\n mobileNavBar?: boolean;\n}\n\nexport interface NavListItemWrapperProps extends ForwardProps {\n label: string;\n tooltipLabel: string;\n content?: ReactNode;\n items?: NavListItemProps[];\n /** @default 5 */\n filterAt?: number;\n onMenuToggle?: (state: 'open' | 'close') => void;\n childElementRef: RefObject<HTMLElement>;\n mobileNavBar?: boolean;\n}\n\nexport interface NavListItemProps extends AsProp, BaseProps, ForwardProps, NoChildrenProp {\n id?: string;\n visual?: ReactNode;\n primary: string;\n secondary?: string;\n /** Presents short, quickly identifiable info to a user for a collapsed nav item. */\n collapsedItemInfo?: string;\n href?: string;\n onClick?: MouseEventHandler<HTMLElement>;\n items?: NavListItemProps[];\n collapseItems?: boolean;\n actions?: OperatorProps['actions'];\n onDismiss?: MouseEventHandler<HTMLElement>;\n forwardedRef?: Ref<HTMLAnchorElement | HTMLDivElement | HTMLButtonElement>;\n isMenuItem?: boolean;\n /** Whether the item is a single-select option */\n singleSelect?: NavListProps['singleSelect'];\n /** Whether the item is selected */\n selected?: boolean;\n mobileNavBar?: boolean;\n}\n\nexport interface NavMenuProps extends NavListItemProps {\n forwardedRef?: Ref<HTMLButtonElement>;\n}\n\n/** AppHeader props */\n\nexport interface AppHeaderProps extends BaseProps, AppInfoProps {\n contextSwitcher?: ContextSwitcherProps | Record<string, never>;\n operator: AppShellProps['operator'];\n searchInput?: AppShellProps['searchInput'];\n searchLabel?: AppShellProps['searchLabel'];\n searchPage?: AppShellProps['searchPage'];\n headerUtils?: AppShellProps['headerUtils'];\n helpMenu?: AppShellProps['helpMenu'];\n /** Configuration for the Share Application button. */\n shareApp?: ShareAppConfig;\n /** Configuration for the portal switcher button. */\n portalSwitcher?: PortalSwitcherConfig;\n}\n\n/** Drawer props */\n\nexport interface DrawerListProps {\n items: (DrawerItemProps & ForwardProps)[];\n loading?: boolean;\n viewAll?: {\n onClick?: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n href?: string;\n } & ForwardProps;\n newNotifications?: number;\n onItemClick?: (id: string, event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n onItemPinToggle?: (id: string) => void;\n onDrawerOpen?: () => void;\n onDrawerClose?: () => void;\n}\n\nexport interface DrawerItemProps extends BaseProps {\n /** An id representing the item. */\n id: string;\n /** The primary text for the item. */\n primary: string;\n /** Secondary text that will be rendered as a Meta List. */\n secondary?: string[];\n /** A visual associated with the item. */\n visual?: ReactNode;\n /** A flag indicating if the item has been read. */\n unread?: boolean;\n /** A flag indicating if the item has been pinned or not. */\n pinned?: boolean;\n /** URL or DOM id to navigate to. */\n href?: string;\n /** The onClick handler for the item. */\n onClick?: (id: string, event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n /** The handler hat is called when a pin icon is toggled on an item. */\n onPinToggle?: (id: string) => void;\n}\n\nexport interface ListProps extends DrawerListProps {\n headingText?: string;\n emptyText: string;\n displayRecents: boolean;\n displayPins?: boolean;\n}\n\nexport type DocumentTabGroup = 'page' | 'case' | 'data';\n\nexport interface DocumentTab {\n /** Unique id for the tab. */\n id: string;\n /** Display label for the tab. */\n label: string;\n /** Optional icon name to display in the tab. */\n icon?: string;\n /** Whether the tab can be closed. Defaults to true. */\n closeable?: boolean;\n /** Group for overflow menu categorization. */\n group?: DocumentTabGroup;\n /** Secondary line in overflow menu. */\n secondary?: string;\n /** When false, tab cannot be reordered. Defaults to true. */\n reorderable?: boolean;\n}\n\nexport interface DocumentTabsProps {\n /** The list of open document tabs. */\n items: DocumentTab[];\n /** The id of the currently active tab. */\n currentTabId?: string;\n /** Callback when a tab is clicked. */\n onTabClick?: (id: string) => void;\n /** Callback when a tab's close button is clicked. */\n onTabClose?: (id: string) => void;\n /** Callback when all closeable tabs should be closed from the overflow menu. */\n onTabCloseAll?: () => void;\n /** Callback when tabs are reordered. Receives tab ids in display order. */\n onTabReorder?: (orderedIds: string[]) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyboardEvent,\n MouseEvent,\n MouseEventHandler,\n ReactElement,\n ReactNode,\n Ref,\n RefObject\n} from 'react';\n\nimport type { Action, AsProp, BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport type { ImageProps } from '../Image';\nimport type { ProgressProps } from '../Progress';\nimport type { SearchInputProps } from '../SearchInput';\nimport type { MenuItemProps } from '../Menu';\nimport type { MenuButtonProps } from '../MenuButton';\n\n/** Share Application button configuration */\nexport interface ShareAppConfig {\n /** Click handler for the share application button. */\n onClick: NavListItemProps['onClick'];\n /** Label for the share application button. */\n label?: string;\n}\n\n/** Portal switcher button configuration. */\nexport type PortalSwitcherConfig = Pick<MenuButtonProps, 'text' | 'icon' | 'onClick' | 'menu'>;\n\n/** AppShell props */\n\nexport interface AppInfoProps {\n /** The primary text to render in the header. */\n appName: string;\n /** If true, the appName will not be visibly displayed on screen. */\n appNameHidden?: boolean;\n /** The source for a small application image or logo that is rendered in the nav bar. */\n imageSrc: ImageProps['src'];\n /** The alt text for the image. Defaults to \"Application logo\" */\n imageAltText?: string;\n /** The source for the full size application image or logo that is rendered in the app header, if enabled. */\n fullImageSrc?: ImageProps['src'];\n /** URL or DOM id to navigate to. */\n href?: string;\n /** Click handler for the header. */\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n /** The secondary text to render in the header. */\n portalName?: string;\n /** Specifies where to open the link href. */\n target?: string;\n}\n\nexport interface ContextItem extends Pick<MenuItemProps, 'id' | 'primary' | 'visual' | 'href'> {\n selected: MenuItemProps['selected'];\n}\n\ninterface ContextSwitcherOptions extends BaseProps {\n /** Application contexts available to user. */\n contexts: ContextItem[];\n /** Callback on click of item in context switcher. */\n onContextClick: (id: MenuItemProps['id'], e: MouseEvent<HTMLElement>) => void;\n /** Label of context being modified; i.e: \"Switch Application\", \"Switch Studio\"\n * @default 'Switch to…'\n */\n label?: string;\n}\n\nexport type ContextSwitcherProps = ContextSwitcherOptions | Record<string, never>;\n\nexport interface AppShellProps extends BaseProps, NoChildrenProp {\n /** Props related to the App Shell header. */\n appInfo: AppInfoProps;\n /** The content of the application. */\n main: ReactNode;\n /** The active user of the application. */\n operator: OperatorProps;\n /** The notifications panel of the application. */\n notifications?: NotificationsProps;\n /** If true, a header will render containing the logo and name of the app as well as search, notifications and operator regions. */\n appHeader?: boolean;\n /** Context switcher configuration. */\n contextSwitcher?: ContextSwitcherProps;\n /** If true, the search results page will replace the search input in the app header with its own */\n searchPage?: boolean;\n /** Props related to the Search Input. */\n searchInput?: SearchInputProps;\n /**\n * The aria-label for the search input.\n * @default 'Sitewide'\n */\n searchLabel?: string;\n /** A set of cases that will render in an expanded list within the App Shell. */\n caseTypes?: CaseTypeProps[];\n /** A set of links that will render as a flat list in the App Shell. */\n links?: LinkProps[];\n /** Agent configuration. */\n agent?: AgentProps;\n /** A set of cases that will render as a flat list in the App Shell. */\n cases?: CaseProps[];\n /** Place the main content of the application into a loading state by way of a boolean or a custom message. */\n progress?: boolean | ProgressProps['message'];\n /** A set of app utilities like notifications, recents that renders at the bottom of AppShell */\n utils?: (UtilItemProps | ReactElement)[];\n /** A set of app utilities for the Header */\n headerUtils?: [ReactNode, ReactNode];\n /** Configuration for the help menu in the header */\n helpMenu?: MenuItemProps[];\n /** Banners will render above the main content if they are provided. */\n banners?: ReactNode;\n defaultExpanded?: boolean;\n /** When the navigation is collapsed menus will be shown on hover instead of on click */\n collapsedHoverMenus?: boolean;\n /** Configuration for the Share Application button. */\n shareApp?: ShareAppConfig;\n /** Configuration for the portal switcher button. */\n portalSwitcher?: PortalSwitcherConfig;\n /**\n * Orientation of the primary navigation.\n * @default 'side-rail'\n */\n navOrientation?: NavOrientation;\n /** Props related to the document tabs. When provided, shows horizontal tabs below the header. */\n documentTabs?: DocumentTabsProps;\n}\n\nexport type NavOrientation = 'side-rail' | 'top-bar';\n\nexport interface CaseTypeProps {\n /** The display name of the case. */\n name: string;\n /** The icon for the case. */\n icon?: string;\n /** Click handler for the case. */\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport interface LinkProps extends ForwardProps {\n /** Unique id */\n id: string;\n /** The display name of the link. */\n name: string;\n /** URL or DOM id to navigate to. */\n href: string;\n /** The name of the Cosmos Icon to render as a visual. */\n icon?: string;\n /** Determines if the link represents the active page. */\n active?: boolean;\n /** A set of nested links. */\n links?: LinkProps[];\n /** Click handler for the link. */\n onClick?: MouseEventHandler<HTMLElement>;\n}\n\nexport interface AgentProps extends Pick<LinkProps, 'id' | 'name' | 'active' | 'onClick'> {\n /** Icon or visual element for the agent. */\n icon?: ReactNode;\n}\n\nexport interface CaseProps extends ForwardProps {\n /** Unique id */\n id: string;\n /** Name of the case or some primary information like title. */\n primary: string;\n /** Additional info of a case like timestamp. */\n secondary?: string;\n /** Presents short, quickly identifiable info to a user for a collapsed nav item. */\n collapsedItemInfo?: string;\n /** A visual element identifying the case. If not passed will render case-solid icon */\n visual?: ReactNode;\n /** Determines if the case represents the active page. */\n active?: boolean;\n /** Click handler for the case . */\n onClick?: MouseEventHandler<HTMLElement>;\n /** Dismiss handler for the case. */\n onDismiss?: MouseEventHandler<HTMLElement>;\n}\n\nexport interface OperatorProps {\n /** A visual element identifying the operator. */\n avatar: ReactNode;\n /** A list of actions that will populate a menu attached to the operator. */\n actions: Pick<NavListItemProps, 'id' | 'primary' | 'href' | 'onClick' | 'visual'>[];\n /** The name of the operator. */\n name: string;\n}\n\nexport interface NotificationsProps extends Pick<NavListItemProps, 'visual'> {\n /** The display name of the notifications, used as the trigger label and popover heading. */\n name: string;\n /** Number of new notifications, displayed as a badge on the trigger when greater than 0. */\n count?: number;\n /** Content rendered in the notifications popover. */\n content?: ReactNode;\n /** Called when the popover opens. */\n onOpen?: () => void;\n /** Called when the popover closes. */\n onClose?: () => void;\n /** When given, renders a \"Mark all as read\" button in the popover header. */\n onMarkAllAsRead?: () => void;\n /** Actions rendered in the popover header. */\n actions?: Action[];\n /** Ref for the popover actions button element. */\n actionsButtonRef?: Ref<HTMLButtonElement>;\n}\n\nexport interface UtilItemProps extends Pick<NavListItemProps, 'visual' | 'actions' | 'onClick'> {\n /** The display name of an utility item. */\n name: string;\n /** Number when given displays on top-right of a given icon. */\n count?: number;\n /** View that renders on an appShell drawer onClick of an item */\n drawerView?: ReactNode;\n /** Heading for view that renders */\n drawerHeader?: string;\n /** Callback that fires on appshell drawer open */\n onDrawerOpen?: () => void;\n /** Callback that fires on appshell drawer close */\n onDrawerClose?: () => void;\n}\n\nexport interface UtilsProps {\n /** Context switcher config. */\n contextSwitcher?: ContextSwitcherProps | Record<string, never>;\n /** The active user of the application. */\n operator?: AppShellProps['operator'];\n /** A set of app utilities like notifications, recents that renders at the bottom of AppShell */\n items?: (UtilItemProps | ReactElement)[];\n /** Configuration for the Share Application button. */\n shareApp?: ShareAppConfig;\n /** Configuration for the portal switcher button. */\n portalSwitcher?: PortalSwitcherConfig;\n}\n\nexport interface NavListProps extends AsProp, BaseProps {\n items?: (NavListItemProps | ReactElement)[];\n nestedList?: boolean;\n collapsed?: boolean;\n id?: string;\n /** Whether the list is of single-select style options */\n singleSelect?: boolean;\n mobileNavBar?: boolean;\n}\n\nexport interface NavListItemWrapperProps extends ForwardProps {\n label: string;\n tooltipLabel: string;\n content?: ReactNode;\n items?: NavListItemProps[];\n /** @default 5 */\n filterAt?: number;\n onMenuToggle?: (state: 'open' | 'close') => void;\n childElementRef: RefObject<HTMLElement>;\n mobileNavBar?: boolean;\n}\n\nexport interface NavListItemProps extends AsProp, BaseProps, ForwardProps, NoChildrenProp {\n id?: string;\n visual?: ReactNode;\n primary: string;\n secondary?: string;\n /** Presents short, quickly identifiable info to a user for a collapsed nav item. */\n collapsedItemInfo?: string;\n href?: string;\n onClick?: MouseEventHandler<HTMLElement>;\n items?: NavListItemProps[];\n collapseItems?: boolean;\n actions?: OperatorProps['actions'];\n onDismiss?: MouseEventHandler<HTMLElement>;\n forwardedRef?: Ref<HTMLAnchorElement | HTMLDivElement | HTMLButtonElement>;\n isMenuItem?: boolean;\n /** Whether the item is a single-select option */\n singleSelect?: NavListProps['singleSelect'];\n /** Whether the item is selected */\n selected?: boolean;\n mobileNavBar?: boolean;\n}\n\nexport interface NavMenuProps extends NavListItemProps {\n forwardedRef?: Ref<HTMLButtonElement>;\n}\n\n/** AppHeader props */\n\nexport interface AppHeaderProps extends BaseProps, AppInfoProps {\n contextSwitcher?: ContextSwitcherProps | Record<string, never>;\n operator: AppShellProps['operator'];\n notifications?: AppShellProps['notifications'];\n searchInput?: AppShellProps['searchInput'];\n searchLabel?: AppShellProps['searchLabel'];\n searchPage?: AppShellProps['searchPage'];\n headerUtils?: AppShellProps['headerUtils'];\n helpMenu?: AppShellProps['helpMenu'];\n /** Configuration for the Share Application button. */\n shareApp?: ShareAppConfig;\n /** Configuration for the portal switcher button. */\n portalSwitcher?: PortalSwitcherConfig;\n}\n\n/** Drawer props */\n\nexport interface DrawerListProps {\n items: (DrawerItemProps & ForwardProps)[];\n loading?: boolean;\n viewAll?: {\n onClick?: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n href?: string;\n } & ForwardProps;\n newNotifications?: number;\n onItemClick?: (id: string, event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n onItemPinToggle?: (id: string) => void;\n onDrawerOpen?: () => void;\n onDrawerClose?: () => void;\n}\n\nexport interface DrawerItemProps extends BaseProps {\n /** An id representing the item. */\n id: string;\n /** The primary text for the item. */\n primary: string;\n /** Secondary text that will be rendered as a Meta List. */\n secondary?: string[];\n /** A visual associated with the item. */\n visual?: ReactNode;\n /** A flag indicating if the item has been read. */\n unread?: boolean;\n /** A flag indicating if the item has been pinned or not. */\n pinned?: boolean;\n /** URL or DOM id to navigate to. */\n href?: string;\n /** The onClick handler for the item. */\n onClick?: (id: string, event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n /** The handler hat is called when a pin icon is toggled on an item. */\n onPinToggle?: (id: string) => void;\n}\n\nexport interface ListProps extends DrawerListProps {\n headingText?: string;\n emptyText: string;\n displayRecents: boolean;\n displayPins?: boolean;\n}\n\nexport type DocumentTabGroup = 'page' | 'case' | 'data';\n\nexport interface DocumentTab {\n /** Unique id for the tab. */\n id: string;\n /** Display label for the tab. */\n label: string;\n /** Optional icon name to display in the tab. */\n icon?: string;\n /** Whether the tab can be closed. Defaults to true. */\n closeable?: boolean;\n /** Group for overflow menu categorization. */\n group?: DocumentTabGroup;\n /** Secondary line in overflow menu. */\n secondary?: string;\n /** When false, tab cannot be reordered. Defaults to true. */\n reorderable?: boolean;\n}\n\nexport interface DocumentTabsProps {\n /** The list of open document tabs. */\n items: DocumentTab[];\n /** The id of the currently active tab. */\n currentTabId?: string;\n /** Callback when a tab is clicked. */\n onTabClick?: (id: string) => void;\n /** Callback when a tab's close button is clicked. */\n onTabClose?: (id: string) => void;\n /** Callback when all closeable tabs should be closed from the overflow menu. */\n onTabCloseAll?: () => void;\n /** Callback when tabs are reordered. Receives tab ids in display order. */\n onTabReorder?: (orderedIds: string[]) => void;\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const StyledAppShellListWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
1
|
export declare const StyledAppShellList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
3
2
|
export declare const StyledAppShellSummaryList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
4
3
|
export declare const StyledAppShellMetaList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
@@ -16,4 +15,5 @@ export declare const StyledNotificationSecondary: import("styled-components/dist
|
|
|
16
15
|
export declare const EmptyStateColorContrast: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
17
16
|
export declare const StyledAppShellListSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
17
|
export declare const StyledAppShellListHeading: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
18
|
+
export declare const StyledAppShellListWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
19
|
//# sourceMappingURL=AppShellList.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShellList.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellList.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppShellList.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellList.styles.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,kBAAkB,iOAAc,CAAC;AAI9C,eAAO,MAAM,yBAAyB,6NA0BpC,CAAC;AAIH,eAAO,MAAM,sBAAsB,iOAIlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,yOAwBlC,CAAC;AAIH,eAAO,MAAM,wBAAwB;aAA0B,OAAO;qBAAmB,OAAO;YAiB/F,CAAC;AAIF,eAAO,MAAM,yBAAyB;aAA0B,OAAO;YASrE,CAAC;AAIH,eAAO,MAAM,2BAA2B;aAA0B,OAAO;YAUxE,CAAC;AAIF,eAAO,MAAM,uBAAuB,6NAWlC,CAAC;AAIH,eAAO,MAAM,yBAAyB,6NAOpC,CAAC;AAIH,eAAO,MAAM,yBAAyB,qOAWpC,CAAC;AAKH,eAAO,MAAM,yBAAyB,6NA4DpC,CAAC"}
|
|
@@ -1,33 +1,14 @@
|
|
|
1
|
-
import { darken, getContrast, lighten } from 'polished';
|
|
1
|
+
import { darken, mix, getContrast, lighten } from 'polished';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { defaultThemeProp } from '../../theme';
|
|
4
|
+
import { tryCatch } from '../../utils';
|
|
4
5
|
import { StyledAlert } from '../Badges/Alert';
|
|
5
6
|
import { StyledEmptyState } from '../EmptyState';
|
|
6
7
|
import { StyledSummaryItem } from '../SummaryItem';
|
|
7
8
|
import { StyledText } from '../Text';
|
|
9
|
+
import { StyledDrawerViewAll } from './Drawer.styles';
|
|
10
|
+
import { StyledNotificationsPopover } from './Notifications';
|
|
8
11
|
import { navContrastColors } from './style-utils';
|
|
9
|
-
/* AppShellList styles */
|
|
10
|
-
export const StyledAppShellListWrapper = styled.div(({ theme }) => {
|
|
11
|
-
const { border: borderColor } = navContrastColors(theme);
|
|
12
|
-
return css `
|
|
13
|
-
max-height: 100%;
|
|
14
|
-
white-space: nowrap;
|
|
15
|
-
|
|
16
|
-
${StyledSummaryItem} {
|
|
17
|
-
position: relative;
|
|
18
|
-
&::after {
|
|
19
|
-
content: '';
|
|
20
|
-
position: absolute;
|
|
21
|
-
top: calc(100% - 0.03125rem);
|
|
22
|
-
inset-inline-end: 1rem;
|
|
23
|
-
inset-inline-start: 1rem;
|
|
24
|
-
height: 0.0625rem;
|
|
25
|
-
background-color: ${borderColor};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
});
|
|
30
|
-
StyledAppShellListWrapper.defaultProps = defaultThemeProp;
|
|
31
12
|
export const StyledAppShellList = styled.ul ``;
|
|
32
13
|
StyledAppShellList.defaultProps = defaultThemeProp;
|
|
33
14
|
export const StyledAppShellSummaryList = styled.li(({ theme }) => {
|
|
@@ -154,4 +135,63 @@ export const StyledAppShellListHeading = styled.h3(({ theme }) => {
|
|
|
154
135
|
`;
|
|
155
136
|
});
|
|
156
137
|
StyledAppShellListHeading.defaultProps = defaultThemeProp;
|
|
138
|
+
/* AppShellList styles */
|
|
139
|
+
export const StyledAppShellListWrapper = styled.div(({ theme }) => {
|
|
140
|
+
const { palette } = theme.base;
|
|
141
|
+
const { border: borderColor } = navContrastColors(theme);
|
|
142
|
+
const hoverBackgroundColor = tryCatch(() => mix(0.9, palette['primary-background'], palette['foreground-color']), () => palette['primary-background']);
|
|
143
|
+
return css `
|
|
144
|
+
max-height: 100%;
|
|
145
|
+
white-space: nowrap;
|
|
146
|
+
|
|
147
|
+
${StyledSummaryItem} {
|
|
148
|
+
position: relative;
|
|
149
|
+
&::after {
|
|
150
|
+
content: '';
|
|
151
|
+
position: absolute;
|
|
152
|
+
top: calc(100% - 0.03125rem);
|
|
153
|
+
inset-inline-end: 1rem;
|
|
154
|
+
inset-inline-start: 1rem;
|
|
155
|
+
height: 0.0625rem;
|
|
156
|
+
background-color: ${borderColor};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
${StyledNotificationsPopover}:has(&) {
|
|
161
|
+
overflow: auto;
|
|
162
|
+
${StyledAppShellListSection} {
|
|
163
|
+
border-block-start-color: ${palette['border-line']};
|
|
164
|
+
|
|
165
|
+
${StyledAppShellSummaryList} ${StyledSummaryItem} {
|
|
166
|
+
&:hover,
|
|
167
|
+
&:focus {
|
|
168
|
+
background-color: ${hoverBackgroundColor};
|
|
169
|
+
}
|
|
170
|
+
&::after {
|
|
171
|
+
background-color: ${palette['border-line']};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
${StyledNotificationPrimary} {
|
|
175
|
+
color: ${palette['foreground-color']};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
${StyledNotificationVisual} ${StyledAlert} {
|
|
179
|
+
background-color: ${palette['foreground-color']};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
${EmptyStateColorContrast} ${StyledEmptyState} span,
|
|
184
|
+
svg {
|
|
185
|
+
color: ${palette['foreground-color']};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
${StyledDrawerViewAll} {
|
|
190
|
+
color: ${palette['foreground-color']};
|
|
191
|
+
background-color: ${darken(0.075, hoverBackgroundColor)};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
195
|
+
});
|
|
196
|
+
StyledAppShellListWrapper.defaultProps = defaultThemeProp;
|
|
157
197
|
//# sourceMappingURL=AppShellList.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShellList.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellList.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,yBAAyB;AACzB,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAChE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAEzD,OAAO,GAAG,CAAA;;;;MAIN,iBAAiB;;;;;;;;;4BASK,WAAW;;;GAGpC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAE9C,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/D,MAAM,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KAAK,CAAC,CAAC;IAEhD,OAAO,GAAG,CAAA;MACN,gBAAgB;;;iBAGL,UAAU;;;GAGxB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAChE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAEzD,OAAO,GAAG,CAAA;kCACsB,WAAW;;GAE1C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/D,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAElE,OAAO,GAAG,CAAA;;;eAGG,KAAK,CAAC,IAAI,CAAC,OAAO,aAAa,KAAK,CAAC,IAAI,CAAC,OAAO;wBACxC,gBAAgB;aAC3B,UAAU;;GAEpB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { darken, getContrast, lighten } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledAlert } from '../Badges/Alert';\nimport { StyledEmptyState } from '../EmptyState';\nimport { StyledSummaryItem } from '../SummaryItem';\nimport { StyledText } from '../Text';\n\nimport { navContrastColors } from './style-utils';\n\n/* AppShellList styles */\nexport const StyledAppShellListWrapper = styled.div(({ theme }) => {\n const { border: borderColor } = navContrastColors(theme);\n\n return css`\n max-height: 100%;\n white-space: nowrap;\n\n ${StyledSummaryItem} {\n position: relative;\n &::after {\n content: '';\n position: absolute;\n top: calc(100% - 0.03125rem);\n inset-inline-end: 1rem;\n inset-inline-start: 1rem;\n height: 0.0625rem;\n background-color: ${borderColor};\n }\n }\n `;\n});\n\nStyledAppShellListWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellList = styled.ul``;\n\nStyledAppShellList.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellSummaryList = styled.li(({ theme }) => {\n const { hoverBg } = navContrastColors(theme);\n\n return css`\n ${StyledSummaryItem} {\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n color: inherit;\n background-color: transparent;\n border: none;\n text-decoration: none;\n cursor: pointer;\n text-align: start;\n white-space: normal;\n width: 100%;\n\n &:hover,\n &:focus {\n background-color: ${hoverBg};\n }\n\n &:focus-visible {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n }\n `;\n});\n\nStyledAppShellSummaryList.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellMetaList = styled.ul`\n li {\n color: inherit;\n }\n`;\n\nexport const StyledAppShellPinButton = styled.button(({ theme }) => {\n const { foreground, hoverBg: listHoverBg } = navContrastColors(theme);\n let hoverBg = darken(0.1, listHoverBg);\n\n if (getContrast(hoverBg, listHoverBg) < 1.3) {\n hoverBg = lighten(0.1, listHoverBg);\n }\n\n return css`\n color: inherit;\n border: none;\n background-color: transparent;\n\n &:hover,\n &:focus {\n color: ${foreground};\n background-color: ${hoverBg};\n }\n\n &:focus-visible {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledAppShellPinButton.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationVisual = styled.span<{ unread?: boolean; visualIncluded?: boolean }>(\n ({ theme, unread, visualIncluded }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n position: relative;\n ${StyledAlert} {\n display: ${unread ? 'auto' : 'none'};\n position: absolute;\n inset-inline-start: -0.65625rem;\n top: ${visualIncluded ? 'calc(50% - 0.15625rem)' : '0.5rem'};\n background-color: ${foreground};\n height: 0.3125rem;\n width: 0.3125rem;\n }\n `;\n }\n);\n\nStyledNotificationVisual.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationPrimary = styled.span<{ unread?: boolean }>(({ theme, unread }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n font-weight: ${unread\n ? theme.base['font-weight'].bold\n : theme.base['font-weight']['semi-bold']};\n color: ${foreground};\n `;\n});\n\nStyledNotificationPrimary.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationSecondary = styled.span<{ unread?: boolean }>(\n ({ theme, unread }) => {\n return css`\n ${StyledText} {\n opacity: ${unread\n ? theme.base.transparency['transparent-1']\n : theme.base.transparency['transparent-3']};\n }\n `;\n }\n);\n\nStyledNotificationSecondary.defaultProps = defaultThemeProp;\n\nexport const EmptyStateColorContrast = styled.div(({ theme }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n ${StyledEmptyState} {\n span,\n svg {\n color: ${foreground};\n }\n }\n `;\n});\n\nEmptyStateColorContrast.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellListSection = styled.div(({ theme }) => {\n const { border: borderColor } = navContrastColors(theme);\n\n return css`\n border-top: 0.0625rem solid ${borderColor};\n min-height: max(20%, 8rem);\n `;\n});\n\nStyledAppShellListSection.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellListHeading = styled.h3(({ theme }) => {\n const { foreground, nestedListHeader } = navContrastColors(theme);\n\n return css`\n position: sticky;\n top: 0;\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n background-color: ${nestedListHeader};\n color: ${foreground};\n z-index: 1;\n `;\n});\n\nStyledAppShellListHeading.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"AppShellList.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellList.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC7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AC,kBAAkB,CAAC;;;;QAItC,mBAAmB;iBACV,OAAO,CAAC,kBAAkB,CAAC;4BAChB,MAAM,CAAC,KAAK,EAAE,oBAAoB,CAAC;;;GAG5D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { darken, mix, getContrast, lighten } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledAlert } from '../Badges/Alert';\nimport { StyledEmptyState } from '../EmptyState';\nimport { StyledSummaryItem } from '../SummaryItem';\nimport { StyledText } from '../Text';\n\nimport { StyledDrawerViewAll } from './Drawer.styles';\nimport { StyledNotificationsPopover } from './Notifications';\nimport { navContrastColors } from './style-utils';\n\nexport const StyledAppShellList = styled.ul``;\n\nStyledAppShellList.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellSummaryList = styled.li(({ theme }) => {\n const { hoverBg } = navContrastColors(theme);\n\n return css`\n ${StyledSummaryItem} {\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n color: inherit;\n background-color: transparent;\n border: none;\n text-decoration: none;\n cursor: pointer;\n text-align: start;\n white-space: normal;\n width: 100%;\n\n &:hover,\n &:focus {\n background-color: ${hoverBg};\n }\n\n &:focus-visible {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n }\n `;\n});\n\nStyledAppShellSummaryList.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellMetaList = styled.ul`\n li {\n color: inherit;\n }\n`;\n\nexport const StyledAppShellPinButton = styled.button(({ theme }) => {\n const { foreground, hoverBg: listHoverBg } = navContrastColors(theme);\n let hoverBg = darken(0.1, listHoverBg);\n\n if (getContrast(hoverBg, listHoverBg) < 1.3) {\n hoverBg = lighten(0.1, listHoverBg);\n }\n\n return css`\n color: inherit;\n border: none;\n background-color: transparent;\n\n &:hover,\n &:focus {\n color: ${foreground};\n background-color: ${hoverBg};\n }\n\n &:focus-visible {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nStyledAppShellPinButton.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationVisual = styled.span<{ unread?: boolean; visualIncluded?: boolean }>(\n ({ theme, unread, visualIncluded }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n position: relative;\n ${StyledAlert} {\n display: ${unread ? 'auto' : 'none'};\n position: absolute;\n inset-inline-start: -0.65625rem;\n top: ${visualIncluded ? 'calc(50% - 0.15625rem)' : '0.5rem'};\n background-color: ${foreground};\n height: 0.3125rem;\n width: 0.3125rem;\n }\n `;\n }\n);\n\nStyledNotificationVisual.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationPrimary = styled.span<{ unread?: boolean }>(({ theme, unread }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n font-weight: ${unread\n ? theme.base['font-weight'].bold\n : theme.base['font-weight']['semi-bold']};\n color: ${foreground};\n `;\n});\n\nStyledNotificationPrimary.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationSecondary = styled.span<{ unread?: boolean }>(\n ({ theme, unread }) => {\n return css`\n ${StyledText} {\n opacity: ${unread\n ? theme.base.transparency['transparent-1']\n : theme.base.transparency['transparent-3']};\n }\n `;\n }\n);\n\nStyledNotificationSecondary.defaultProps = defaultThemeProp;\n\nexport const EmptyStateColorContrast = styled.div(({ theme }) => {\n const { foreground } = navContrastColors(theme);\n\n return css`\n ${StyledEmptyState} {\n span,\n svg {\n color: ${foreground};\n }\n }\n `;\n});\n\nEmptyStateColorContrast.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellListSection = styled.div(({ theme }) => {\n const { border: borderColor } = navContrastColors(theme);\n\n return css`\n border-top: 0.0625rem solid ${borderColor};\n min-height: max(20%, 8rem);\n `;\n});\n\nStyledAppShellListSection.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellListHeading = styled.h3(({ theme }) => {\n const { foreground, nestedListHeader } = navContrastColors(theme);\n\n return css`\n position: sticky;\n top: 0;\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n background-color: ${nestedListHeader};\n color: ${foreground};\n z-index: 1;\n `;\n});\n\nStyledAppShellListHeading.defaultProps = defaultThemeProp;\n\n/* AppShellList styles */\nexport const StyledAppShellListWrapper = styled.div(({ theme }) => {\n const { palette } = theme.base;\n const { border: borderColor } = navContrastColors(theme);\n const hoverBackgroundColor = tryCatch(\n () => mix(0.9, palette['primary-background'], palette['foreground-color']),\n () => palette['primary-background']\n );\n\n return css`\n max-height: 100%;\n white-space: nowrap;\n\n ${StyledSummaryItem} {\n position: relative;\n &::after {\n content: '';\n position: absolute;\n top: calc(100% - 0.03125rem);\n inset-inline-end: 1rem;\n inset-inline-start: 1rem;\n height: 0.0625rem;\n background-color: ${borderColor};\n }\n }\n\n ${StyledNotificationsPopover}:has(&) {\n overflow: auto;\n ${StyledAppShellListSection} {\n border-block-start-color: ${palette['border-line']};\n\n ${StyledAppShellSummaryList} ${StyledSummaryItem} {\n &:hover,\n &:focus {\n background-color: ${hoverBackgroundColor};\n }\n &::after {\n background-color: ${palette['border-line']};\n }\n\n ${StyledNotificationPrimary} {\n color: ${palette['foreground-color']};\n }\n\n ${StyledNotificationVisual} ${StyledAlert} {\n background-color: ${palette['foreground-color']};\n }\n }\n\n ${EmptyStateColorContrast} ${StyledEmptyState} span,\n svg {\n color: ${palette['foreground-color']};\n }\n }\n\n ${StyledDrawerViewAll} {\n color: ${palette['foreground-color']};\n background-color: ${darken(0.075, hoverBackgroundColor)};\n }\n }\n `;\n});\n\nStyledAppShellListWrapper.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PopoverProps } from '../Popover';
|
|
2
|
+
import type { NotificationsProps } from './AppShell.types';
|
|
3
|
+
export declare const StyledNotificationsPopover: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<PopoverProps<string> & import("../..").ForwardProps, never>> & string & Omit<(<Modifiers extends string = string>(props: PopoverProps<Modifiers> & import("../..").ForwardProps) => import("react").ReactElement | null), keyof import("react").Component<any, {}, any>>;
|
|
4
|
+
/**
|
|
5
|
+
* Manages the notifications popover (a full-screen dialog on touch devices). Returns a `toggle`
|
|
6
|
+
* handler and ARIA `triggerProps` for the trigger, and the element to render (`undefined` when no
|
|
7
|
+
* notifications are given).
|
|
8
|
+
*/
|
|
9
|
+
export declare const useNotificationsPopover: (notifications: NotificationsProps | undefined, placement?: PopoverProps["placement"]) => {
|
|
10
|
+
toggle: (trigger: HTMLElement) => void;
|
|
11
|
+
triggerProps: {
|
|
12
|
+
readonly 'aria-haspopup': "dialog";
|
|
13
|
+
readonly 'aria-expanded': boolean;
|
|
14
|
+
readonly 'aria-controls': string | undefined;
|
|
15
|
+
};
|
|
16
|
+
popover: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
toggle: (trigger: HTMLElement) => void;
|
|
19
|
+
triggerProps: {
|
|
20
|
+
readonly 'aria-haspopup': "dialog";
|
|
21
|
+
readonly 'aria-expanded': boolean;
|
|
22
|
+
readonly 'aria-controls': string | undefined;
|
|
23
|
+
};
|
|
24
|
+
popover: import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
};
|
|
26
|
+
declare const Notifications: (notifications: NotificationsProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export default Notifications;
|
|
28
|
+
//# sourceMappingURL=Notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Notifications.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA4B3D,eAAO,MAAM,0BAA0B,kXAerC,CAAC;AAIH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,eAAe,kBAAkB,GAAG,SAAS,EAC7C,YAAY,YAAY,CAAC,WAAW,CAAC;sBA0BzB,WAAW;;;;;;;;sBAAX,WAAW;;;;;;;CAwIxB,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,eAAe,kBAAkB,4CAoBvD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState, useEffect } from 'react';
|
|
3
|
+
import { remToPx, stripUnit } from 'polished';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { useConsolidatedRef, useElement, useEscape, useFocusTrap, useI18n, useOuterEvent, useTheme, useUID } from '../../hooks';
|
|
6
|
+
import { defaultThemeProp } from '../../theme';
|
|
7
|
+
import { getFocusables, isTouchDevice, tryCatch } from '../../utils';
|
|
8
|
+
import Actions from '../Actions';
|
|
9
|
+
import Count, { StyledCount } from '../Badges/Count';
|
|
10
|
+
import Button, { StyledButton } from '../Button';
|
|
11
|
+
import { CardContent, CardHeader, StyledCard } from '../Card';
|
|
12
|
+
import { StyledCardHeader } from '../Card/CardHeader';
|
|
13
|
+
import { TouchDialog } from '../Dialog';
|
|
14
|
+
import Icon, { registerIcon } from '../Icon';
|
|
15
|
+
import * as checkIcon from '../Icon/icons/check.icon';
|
|
16
|
+
import * as timesIcon from '../Icon/icons/times.icon';
|
|
17
|
+
import Popover from '../Popover';
|
|
18
|
+
import Text from '../Text';
|
|
19
|
+
import Flex from '../Flex';
|
|
20
|
+
registerIcon(timesIcon, checkIcon);
|
|
21
|
+
const StyledNotificationsButton = styled(Button) `
|
|
22
|
+
${StyledButton} + & {
|
|
23
|
+
margin-inline-start: 0;
|
|
24
|
+
}
|
|
25
|
+
${StyledCount} {
|
|
26
|
+
position: absolute;
|
|
27
|
+
inset-block-start: 0;
|
|
28
|
+
inset-inline-end: 0;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
StyledNotificationsButton.defaultProps = defaultThemeProp;
|
|
32
|
+
const StyledCardContent = styled(CardContent) `
|
|
33
|
+
overflow: auto;
|
|
34
|
+
border-bottom-left-radius: inherit;
|
|
35
|
+
border-bottom-right-radius: inherit;
|
|
36
|
+
&:not(${StyledCard} ${StyledCard} > &) {
|
|
37
|
+
padding: 0;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
StyledCardContent.defaultProps = defaultThemeProp;
|
|
41
|
+
export const StyledNotificationsPopover = styled(Popover)(({ theme: { base: { 'content-width': contentWidth } } }) => {
|
|
42
|
+
return css `
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
min-width: min(${contentWidth.sm}, calc(100vw - 2rem));
|
|
46
|
+
width: min(calc(${contentWidth.sm} + 5ch), calc(100vw - 2rem));
|
|
47
|
+
|
|
48
|
+
${StyledCardHeader} ${StyledButton} {
|
|
49
|
+
margin-inline-start: 0;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
});
|
|
53
|
+
StyledNotificationsPopover.defaultProps = defaultThemeProp;
|
|
54
|
+
/**
|
|
55
|
+
* Manages the notifications popover (a full-screen dialog on touch devices). Returns a `toggle`
|
|
56
|
+
* handler and ARIA `triggerProps` for the trigger, and the element to render (`undefined` when no
|
|
57
|
+
* notifications are given).
|
|
58
|
+
*/
|
|
59
|
+
export const useNotificationsPopover = (notifications, placement) => {
|
|
60
|
+
const t = useI18n();
|
|
61
|
+
const theme = useTheme();
|
|
62
|
+
const [popoverEl, setPopoverEl] = useElement();
|
|
63
|
+
const popoverRef = useConsolidatedRef(setPopoverEl);
|
|
64
|
+
const popoverId = useUID();
|
|
65
|
+
const headingId = useUID();
|
|
66
|
+
const [{ isOpen, target }, setState] = useState({ isOpen: false, target: null });
|
|
67
|
+
const close = useCallback(() => {
|
|
68
|
+
notifications?.onClose?.();
|
|
69
|
+
// Deferred so the popover's own close handling settles before it hides.
|
|
70
|
+
setTimeout(() => setState(cur => ({ ...cur, isOpen: false })));
|
|
71
|
+
}, [notifications]);
|
|
72
|
+
const closeAndFocusTarget = useCallback(() => {
|
|
73
|
+
if (!isOpen)
|
|
74
|
+
return;
|
|
75
|
+
close();
|
|
76
|
+
target?.focus();
|
|
77
|
+
}, [isOpen, close, target]);
|
|
78
|
+
const toggle = useCallback((trigger) => {
|
|
79
|
+
if (isOpen) {
|
|
80
|
+
notifications?.onClose?.();
|
|
81
|
+
setState(cur => ({ ...cur, isOpen: false }));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
notifications?.onOpen?.();
|
|
85
|
+
setState({ isOpen: true, target: trigger });
|
|
86
|
+
}
|
|
87
|
+
}, [notifications, isOpen]);
|
|
88
|
+
useOuterEvent('mousedown', [popoverRef, target], () => {
|
|
89
|
+
if (!isTouchDevice && isOpen)
|
|
90
|
+
close();
|
|
91
|
+
});
|
|
92
|
+
useEscape(closeAndFocusTarget, isTouchDevice ? null : popoverEl);
|
|
93
|
+
useFocusTrap(isOpen && !isTouchDevice ? popoverRef : null, true, [isOpen]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!window.navigation)
|
|
96
|
+
return;
|
|
97
|
+
const ac = new AbortController();
|
|
98
|
+
window.navigation.addEventListener('navigate', () => {
|
|
99
|
+
if (isTouchDevice && isOpen) {
|
|
100
|
+
close();
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
signal: ac.signal
|
|
104
|
+
});
|
|
105
|
+
return () => {
|
|
106
|
+
ac.abort();
|
|
107
|
+
};
|
|
108
|
+
}, [isOpen, isTouchDevice, close]);
|
|
109
|
+
const triggerProps = {
|
|
110
|
+
'aria-haspopup': 'dialog',
|
|
111
|
+
'aria-expanded': isOpen,
|
|
112
|
+
'aria-controls': isOpen ? popoverId : undefined
|
|
113
|
+
};
|
|
114
|
+
if (!notifications)
|
|
115
|
+
return { toggle, triggerProps, popover: undefined };
|
|
116
|
+
const { name, content, actions, actionsButtonRef, onMarkAllAsRead } = notifications;
|
|
117
|
+
const headingActions = (_jsxs(_Fragment, { children: [!!actions && _jsx(Actions, { items: actions, menuAt: 1, ref: actionsButtonRef }), onMarkAllAsRead && (_jsx(Button, { variant: 'simple', icon: true, label: t('app_shell_notifications_mark_all_as_read'), onClick: () => {
|
|
118
|
+
onMarkAllAsRead();
|
|
119
|
+
closeAndFocusTarget();
|
|
120
|
+
}, children: _jsx(Icon, { name: 'check' }) }))] }));
|
|
121
|
+
const popover = isTouchDevice ? (_jsx(TouchDialog, { ref: popoverRef, id: popoverId, open: isOpen, size: 'full', heading: _jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, children: [_jsx(Text, { variant: 'h2', children: name }), _jsx(Flex, { container: { alignItems: 'center' }, children: headingActions })] }), onMouseDown: (e) => e.stopPropagation(), onDismiss: close, onAfterClose: () => target?.focus(), children: content })) : (_jsxs(StyledNotificationsPopover, { ref: popoverRef, id: popoverId, role: 'dialog', "aria-labelledby": headingId, target: target, show: isOpen, placement: placement, hideOnTargetHidden: true, onShow: () => getFocusables(popoverRef)[0]?.focus(), onHide: () => {
|
|
122
|
+
if (!isOpen)
|
|
123
|
+
return;
|
|
124
|
+
notifications.onClose?.();
|
|
125
|
+
setState(cur => ({ ...cur, isOpen: false }));
|
|
126
|
+
}, modifiers: [
|
|
127
|
+
{
|
|
128
|
+
name: 'offset',
|
|
129
|
+
options: {
|
|
130
|
+
offset: [
|
|
131
|
+
0,
|
|
132
|
+
tryCatch(() => Number(stripUnit(remToPx(theme.base.spacing))) * 3, () => 24)
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
], children: [_jsx(CardHeader, { actions: _jsxs(_Fragment, { children: [headingActions, _jsx(Button, { variant: 'simple', icon: true, label: t('dismiss'), onClick: closeAndFocusTarget, children: _jsx(Icon, { name: 'times' }) })] }), children: _jsx(Text, { variant: 'h2', id: headingId, children: name }) }), _jsx(StyledCardContent, { children: content })] }));
|
|
137
|
+
return { toggle, triggerProps, popover };
|
|
138
|
+
};
|
|
139
|
+
const Notifications = (notifications) => {
|
|
140
|
+
const { toggle, triggerProps, popover } = useNotificationsPopover(notifications);
|
|
141
|
+
const { name, visual, count } = notifications;
|
|
142
|
+
return (_jsxs(_Fragment, { children: [_jsxs(StyledNotificationsButton, { variant: 'simple', icon: true, label: name, "aria-label": count ? `${name}, ${String(count)}` : undefined, ...triggerProps, onClick: (e) => toggle(e.currentTarget), children: [visual, !!count && _jsx(Count, { variant: 'urgent', children: count })] }), popover] }));
|
|
143
|
+
};
|
|
144
|
+
export default Notifications;
|
|
145
|
+
//# sourceMappingURL=Notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../../src/components/AppShell/Notifications.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oB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,EAAE,EAAE;IAC1D,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACjF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;IAE9C,OAAO,CACL,8BACE,MAAC,yBAAyB,IACxB,OAAO,EAAC,QAAQ,EAChB,IAAI,QACJ,KAAK,EAAE,IAAI,gBACC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KACvD,YAAY,EAChB,OAAO,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,aAErE,MAAM,EACN,CAAC,CAAC,KAAK,IAAI,KAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,YAAE,KAAK,GAAS,IACzB,EAC3B,OAAO,IACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useCallback, useState, useEffect } from 'react';\nimport type { MouseEvent } from 'react';\nimport { remToPx, stripUnit } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useElement,\n useEscape,\n useFocusTrap,\n useI18n,\n useOuterEvent,\n useTheme,\n useUID\n} from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { getFocusables, isTouchDevice, tryCatch } from '../../utils';\nimport Actions from '../Actions';\nimport Count, { StyledCount } from '../Badges/Count';\nimport Button, { StyledButton } from '../Button';\nimport { CardContent, CardHeader, StyledCard } from '../Card';\nimport { StyledCardHeader } from '../Card/CardHeader';\nimport { TouchDialog } from '../Dialog';\nimport Icon, { registerIcon } from '../Icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport Popover from '../Popover';\nimport type { PopoverProps } from '../Popover';\nimport Text from '../Text';\nimport Flex from '../Flex';\n\nimport type { NotificationsProps } from './AppShell.types';\n\nregisterIcon(timesIcon, checkIcon);\n\nconst StyledNotificationsButton = styled(Button)`\n ${StyledButton} + & {\n margin-inline-start: 0;\n }\n ${StyledCount} {\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n }\n`;\n\nStyledNotificationsButton.defaultProps = defaultThemeProp;\n\nconst StyledCardContent = styled(CardContent)`\n overflow: auto;\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n &:not(${StyledCard} ${StyledCard} > &) {\n padding: 0;\n }\n`;\n\nStyledCardContent.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationsPopover = styled(Popover)(({\n theme: {\n base: { 'content-width': contentWidth }\n }\n}) => {\n return css`\n display: flex;\n flex-direction: column;\n min-width: min(${contentWidth.sm}, calc(100vw - 2rem));\n width: min(calc(${contentWidth.sm} + 5ch), calc(100vw - 2rem));\n\n ${StyledCardHeader} ${StyledButton} {\n margin-inline-start: 0;\n }\n `;\n});\n\nStyledNotificationsPopover.defaultProps = defaultThemeProp;\n\n/**\n * Manages the notifications popover (a full-screen dialog on touch devices). Returns a `toggle`\n * handler and ARIA `triggerProps` for the trigger, and the element to render (`undefined` when no\n * notifications are given).\n */\nexport const useNotificationsPopover = (\n notifications: NotificationsProps | undefined,\n placement?: PopoverProps['placement']\n) => {\n const t = useI18n();\n const theme = useTheme();\n const [popoverEl, setPopoverEl] = useElement<HTMLDivElement>();\n const popoverRef = useConsolidatedRef<HTMLDivElement>(setPopoverEl);\n const popoverId = useUID();\n const headingId = useUID();\n const [{ isOpen, target }, setState] = useState<{\n isOpen: boolean;\n target: HTMLElement | null;\n }>({ isOpen: false, target: null });\n\n const close = useCallback(() => {\n notifications?.onClose?.();\n // Deferred so the popover's own close handling settles before it hides.\n setTimeout(() => setState(cur => ({ ...cur, isOpen: false })));\n }, [notifications]);\n\n const closeAndFocusTarget = useCallback(() => {\n if (!isOpen) return;\n close();\n target?.focus();\n }, [isOpen, close, target]);\n\n const toggle = useCallback(\n (trigger: HTMLElement) => {\n if (isOpen) {\n notifications?.onClose?.();\n setState(cur => ({ ...cur, isOpen: false }));\n } else {\n notifications?.onOpen?.();\n setState({ isOpen: true, target: trigger });\n }\n },\n [notifications, isOpen]\n );\n\n useOuterEvent('mousedown', [popoverRef, target], () => {\n if (!isTouchDevice && isOpen) close();\n });\n useEscape(closeAndFocusTarget, isTouchDevice ? null : popoverEl);\n useFocusTrap(isOpen && !isTouchDevice ? popoverRef : null, true, [isOpen]);\n\n useEffect(() => {\n if (!window.navigation) return;\n\n const ac = new AbortController();\n window.navigation.addEventListener(\n 'navigate',\n () => {\n if (isTouchDevice && isOpen) {\n close();\n }\n },\n {\n signal: ac.signal\n }\n );\n\n return () => {\n ac.abort();\n };\n }, [isOpen, isTouchDevice, close]);\n\n const triggerProps = {\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? popoverId : undefined\n } as const;\n\n if (!notifications) return { toggle, triggerProps, popover: undefined };\n\n const { name, content, actions, actionsButtonRef, onMarkAllAsRead } = notifications;\n\n const headingActions = (\n <>\n {!!actions && <Actions items={actions} menuAt={1} ref={actionsButtonRef} />}\n {onMarkAllAsRead && (\n <Button\n variant='simple'\n icon\n label={t('app_shell_notifications_mark_all_as_read')}\n onClick={() => {\n onMarkAllAsRead();\n closeAndFocusTarget();\n }}\n >\n <Icon name='check' />\n </Button>\n )}\n </>\n );\n\n const popover = isTouchDevice ? (\n <TouchDialog\n ref={popoverRef}\n id={popoverId}\n open={isOpen}\n size='full'\n heading={\n <Flex container={{ justify: 'between', alignItems: 'center' }}>\n <Text variant='h2'>{name}</Text>\n <Flex container={{ alignItems: 'center' }}>{headingActions}</Flex>\n </Flex>\n }\n onMouseDown={(e: MouseEvent<HTMLElement>) => e.stopPropagation()}\n onDismiss={close}\n onAfterClose={() => target?.focus()}\n >\n {content}\n </TouchDialog>\n ) : (\n <StyledNotificationsPopover\n ref={popoverRef}\n id={popoverId}\n role='dialog'\n aria-labelledby={headingId}\n target={target}\n show={isOpen}\n placement={placement}\n hideOnTargetHidden\n onShow={() => getFocusables(popoverRef)[0]?.focus()}\n onHide={() => {\n if (!isOpen) return;\n notifications.onClose?.();\n setState(cur => ({ ...cur, isOpen: false }));\n }}\n modifiers={[\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => Number(stripUnit(remToPx(theme.base.spacing))) * 3,\n () => 24\n )\n ]\n }\n }\n ]}\n >\n <CardHeader\n actions={\n <>\n {headingActions}\n <Button variant='simple' icon label={t('dismiss')} onClick={closeAndFocusTarget}>\n <Icon name='times' />\n </Button>\n </>\n }\n >\n <Text variant='h2' id={headingId}>\n {name}\n </Text>\n </CardHeader>\n <StyledCardContent>{content}</StyledCardContent>\n </StyledNotificationsPopover>\n );\n\n return { toggle, triggerProps, popover };\n};\n\nconst Notifications = (notifications: NotificationsProps) => {\n const { toggle, triggerProps, popover } = useNotificationsPopover(notifications);\n const { name, visual, count } = notifications;\n\n return (\n <>\n <StyledNotificationsButton\n variant='simple'\n icon\n label={name}\n aria-label={count ? `${name}, ${String(count)}` : undefined}\n {...triggerProps}\n onClick={(e: MouseEvent<HTMLButtonElement>) => toggle(e.currentTarget)}\n >\n {visual}\n {!!count && <Count variant='urgent'>{count}</Count>}\n </StyledNotificationsButton>\n {popover}\n </>\n );\n};\n\nexport default Notifications;\n"]}
|
|
@@ -7,7 +7,7 @@ export interface TouchAppShellProps extends AppShellProps {
|
|
|
7
7
|
content: ReactNode;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
export default function TouchAppShell({ appInfo, contextSwitcher, searchPage, searchInput, searchLabel, caseTypes, links, cases, agent, utils, utilsList, operator, headerUtils, helpMenu, shareApp, banners, progress, main, bottomTouchPanel, documentTabs, navId, restProps }: TouchAppShellProps & {
|
|
10
|
+
export default function TouchAppShell({ appInfo, contextSwitcher, searchPage, searchInput, searchLabel, caseTypes, links, cases, agent, utils, utilsList, operator, notifications, headerUtils, helpMenu, shareApp, banners, progress, main, bottomTouchPanel, documentTabs, navId, restProps }: TouchAppShellProps & {
|
|
11
11
|
searchLabel: string;
|
|
12
12
|
utilsList: (UtilItemProps | ReactElement)[];
|
|
13
13
|
navId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchAppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/TouchAppShell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAwCjE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIrE,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,SAAS,CAAC;KACpB,CAAC;CACH;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,OAAO,EACP,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACL,SAAS,EACV,EAAE,kBAAkB,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,aAAa,GAAG,YAAY,CAAC,EAAE,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,
|
|
1
|
+
{"version":3,"file":"TouchAppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/TouchAppShell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAwCjE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIrE,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,6DAA6D;IAC7D,gBAAgB,CAAC,EAAE;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,SAAS,CAAC;KACpB,CAAC;CACH;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,OAAO,EACP,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACL,SAAS,EACV,EAAE,kBAAkB,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,aAAa,GAAG,YAAY,CAAC,EAAE,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,2CA2RA"}
|
|
@@ -17,7 +17,7 @@ import TopNavDrawerProvider from './TopNavDrawerProvider';
|
|
|
17
17
|
import { menuButtonWidth, StyledAppMain, StyledBannerRegion, AppShellGlobalStyle } from './AppShell.styles';
|
|
18
18
|
import { TouchAppShellGlobalStyle, StyledMainTouchAppShell, StyledSplitViewPanel, StyledPortalTouchDialog, StyledMobileMoreMenuButton, StyledMobileMoreMenu, StyledMobileNav } from './TouchAppShell.styles';
|
|
19
19
|
import AppShellContext from './AppShellContext';
|
|
20
|
-
export default function TouchAppShell({ appInfo, contextSwitcher, searchPage, searchInput, searchLabel, caseTypes, links, cases, agent, utils, utilsList, operator, headerUtils, helpMenu, shareApp, banners, progress, main, bottomTouchPanel, documentTabs, navId, restProps }) {
|
|
20
|
+
export default function TouchAppShell({ appInfo, contextSwitcher, searchPage, searchInput, searchLabel, caseTypes, links, cases, agent, utils, utilsList, operator, notifications, headerUtils, helpMenu, shareApp, banners, progress, main, bottomTouchPanel, documentTabs, navId, restProps }) {
|
|
21
21
|
const t = useI18n();
|
|
22
22
|
const theme = useTheme();
|
|
23
23
|
const { previewActive, setPreviewActive } = usePreviewManager();
|
|
@@ -119,8 +119,9 @@ export default function TouchAppShell({ appInfo, contextSwitcher, searchPage, se
|
|
|
119
119
|
const touchNav = !isSmallOrAbove && (_jsxs(_Fragment, { children: [_jsxs(StyledMobileNav, { hasBottomTouchPanel: !isSmallOrAbove && !!agent && bottomPanelOpen, container: { alignItems: 'center', gap: 0.25 }, ref: setMobileHeaderEl, "data-app-region": true, onClick: () => setMobileNavOpen(false), children: [caseTypes && caseTypes.length > 0 && _jsx(CaseTypes, { caseTypes: caseTypes, mobileNavBar: true }), links && _jsx(Links, { links: links.slice(0, mobileNavLinksCount), mobileNavBar: true }), _jsxs(StyledMobileMoreMenuButton, { variant: 'simple', onClick: (e) => {
|
|
120
120
|
setMobileNavOpen(prev => !prev);
|
|
121
121
|
e.stopPropagation();
|
|
122
|
-
}, label: t('app_shell_more'), icon: true, "aria-expanded": mobileNavOpen, "aria-controls": navId, children: [_jsx(Icon, { name: 'bars' }), !mobileNavOpen &&
|
|
123
|
-
|
|
122
|
+
}, label: t('app_shell_more'), icon: true, "aria-expanded": mobileNavOpen, "aria-controls": navId, children: [_jsx(Icon, { name: 'bars' }), !mobileNavOpen &&
|
|
123
|
+
utilsList.some(item => (isValidElement(item) ? false : !!item.count)) && (_jsx(Alert, { variant: 'urgent' })), _jsx("span", { children: t('app_shell_more') })] })] }), _jsx(Drawer, { open: mobileNavOpen, position: 'fixed', placement: 'bottom', size: '100dvh', nullWhenClosed: true, children: _jsx(Flex, { ...restProps, container: { direction: 'column', justify: 'between' }, id: navId, as: StyledMobileMoreMenu, "aria-label": t('app_shell_main_navigation_label'), children: _jsx(AppNavigationPanel, { appInfo: appInfo, navState: 'open', searchInput: searchInput, searchLabel: searchLabel, links: links?.slice(mobileNavLinksCount), cases: cases, utils: utilsList, agent: navigationAgent }) }) })] }));
|
|
124
|
+
return (_jsx(AppShellContext.Provider, { value: mobileAppShellContext, children: _jsxs(_Fragment, { children: [isSmallOrAbove && (_jsx(AppHeader, { ...appInfo, contextSwitcher: contextSwitcher, searchInput: searchInput, searchLabel: searchLabel, searchPage: searchPage, operator: operator, notifications: notifications, headerUtils: headerUtils, helpMenu: helpMenu, shareApp: shareApp, ref: setHeaderEl })), isSmallOrAbove ? (_jsx(TopNavDrawerProvider, { children: _jsx(AppTopNav, { appInfo: appInfo, caseTypes: caseTypes, links: links, cases: cases, agent: navigationAgent, utils: utils, searchInput: searchInput, searchPage: searchPage, searchLabel: searchLabel }) })) : (touchNav), documentTabs && _jsx(DocumentTabs, { ...documentTabs }), (() => {
|
|
124
125
|
const mainRegion = (_jsxs(StyledAppMain, { previewActive: previewActive, isTopBar: isSmallOrAbove, hasBottomTouchPanel: !isSmallOrAbove && !!agent && bottomPanelOpen, "aria-busy": !!progress, "data-app-region": true, children: [_jsx(Progress, { visible: !!progress, placement: 'local', message: typeof progress === 'string' ? progress : t('loading') }), banners && _jsx(StyledBannerRegion, { children: banners }), main] }));
|
|
125
126
|
const touchMainRegion = isMobileNav ? (_jsx(StyledMainTouchAppShell, { active: !!agent && bottomPanelOpen, children: mainRegion })) : (mainRegion);
|
|
126
127
|
if (!documentTabs)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TouchAppShell.js","sourceRoot":"","sources":["../../../src/components/AppShell/TouchAppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1F,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,WAAW,CAAC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ACO,CAC1B,CAAC;gBACJ,CAAC,CAAC,EAAE,EACJ,KAAC,oBAAoB,IAAC,MAAM,EAAE,CAAC,cAAc,IAAI,CAAC,CAAC,KAAK,IAAI,eAAe,YACxE,CAAC,cAAc,IAAI,gBAAgB,IAAI,CACtC,KAAC,uBAAuB,IACtB,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,gBAAgB,CAAC,OAAO,EACjC,gBAAgB,EAAC,YAAY,EAC7B,SAAS,EAAE,GAAG,EAAE;4BACd,kBAAkB,CAAC,KAAK,CAAC,CAAC;wBAC5B,CAAC,EACD,IAAI,EAAC,cAAc,YAElB,gBAAgB,CAAC,OAAO,GACD,CAC3B,GACoB,EACvB,KAAC,mBAAmB,IAClB,QAAQ,EAAE,cAAc,EACxB,aAAa,EAAE,cAAc,EAC7B,eAAe,EAAE,CAAC,CAAC,YAAY,EAC/B,aAAa,QACb,kBAAkB,EAAE,CAAC,cAAc,EACnC,OAAO,EAAE,aAAa,GACtB,EACF,KAAC,wBAAwB,IACvB,mBAAmB,EAAE,CAAC,cAAc,IAAI,CAAC,CAAC,KAAK,IAAI,eAAe,EAClE,WAAW,EAAE,WAAW,GACxB,IACD,GACsB,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport type { MouseEvent, ReactElement, ReactNode } from 'react';\n\nimport { Alert } from '../Badges';\nimport Drawer from '../Drawer';\nimport Flex from '../Flex';\nimport Icon from '../Icon';\nimport {\n useBreakpoint,\n useElement,\n useEscape,\n useI18n,\n usePreviewManager,\n useScrollToggle,\n useTheme\n} from '../../hooks';\nimport { debounce, isValidElement } from '../../utils';\nimport { openCloseStates } from '../../hooks/useTransitionState';\nimport Progress from '../Progress';\n\nimport AppNavigationPanel, { CaseTypes, Links } from './AppNavigationPanel';\nimport AppHeader from './AppHeader';\nimport AppTopNav from './AppTopNav';\nimport DocumentTabs, { getTabElementId, getTabPanelId } from './DocumentTabs';\nimport { StyledDocumentTabPanel } from './DocumentTabs.styles';\nimport TopNavDrawerProvider from './TopNavDrawerProvider';\nimport {\n menuButtonWidth,\n StyledAppMain,\n StyledBannerRegion,\n AppShellGlobalStyle\n} from './AppShell.styles';\nimport {\n TouchAppShellGlobalStyle,\n StyledMainTouchAppShell,\n StyledSplitViewPanel,\n StyledPortalTouchDialog,\n StyledMobileMoreMenuButton,\n StyledMobileMoreMenu,\n StyledMobileNav\n} from './TouchAppShell.styles';\nimport type { AppShellProps, UtilItemProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\nimport type { AppShellContextValue } from './AppShellContext';\n\nexport interface TouchAppShellProps extends AppShellProps {\n /** Optional bottom panel rendered by the touch app shell. */\n bottomTouchPanel?: {\n heading: string;\n content: ReactNode;\n };\n}\n\nexport default function TouchAppShell({\n appInfo,\n contextSwitcher,\n searchPage,\n searchInput,\n searchLabel,\n caseTypes,\n links,\n cases,\n agent,\n utils,\n utilsList,\n operator,\n headerUtils,\n helpMenu,\n shareApp,\n banners,\n progress,\n main,\n bottomTouchPanel,\n documentTabs,\n navId,\n restProps\n}: TouchAppShellProps & {\n searchLabel: string;\n utilsList: (UtilItemProps | ReactElement)[];\n navId: string;\n restProps: Record<string, unknown>;\n}) {\n const t = useI18n();\n const theme = useTheme();\n const { previewActive, setPreviewActive } = usePreviewManager();\n const { disableScroll, enableScroll } = useScrollToggle();\n const appShellContext = useContext(AppShellContext);\n const isSmallOrAbove = useBreakpoint('sm');\n const isMobileNav = !isSmallOrAbove;\n const [mobileNavOpen, setMobileNavOpen] = useState(false);\n const [bottomPanelOpen, setBottomPanelOpen] = useState(false);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const [mobileNavLinksCount, setMobileNavLinksCount] = useState(0);\n const [mobileHeaderEl, setMobileHeaderEl] = useElement<HTMLDivElement>();\n const [headerEl, setHeaderEl] = useElement<HTMLDivElement>();\n const focusedImperatively = useRef(false);\n const [searchContainerEl, setSearchContainerEl] = useState<HTMLElement | null>(null);\n const mobileAppShellContext = useMemo<AppShellContextValue>(\n () => ({\n ...appShellContext,\n navOpen: mobileNavOpen,\n drawerOpen,\n setDrawerOpen,\n navState: openCloseStates.high,\n focusedImperatively,\n headerEl: headerEl || mobileHeaderEl,\n appHeaderEl: headerEl || mobileHeaderEl,\n searchContainerEl,\n setSearchContainerEl,\n isMobileNav,\n isTopBar: isSmallOrAbove,\n previewActive,\n setPreviewActive\n }),\n [\n appShellContext,\n headerEl,\n mobileHeaderEl,\n mobileNavOpen,\n drawerOpen,\n searchContainerEl,\n isMobileNav,\n previewActive,\n setPreviewActive,\n setSearchContainerEl\n ]\n );\n\n useEffect(() => {\n if (!isSmallOrAbove && agent && agent.active === false) {\n setBottomPanelOpen(false);\n }\n }, [agent?.active, isSmallOrAbove]);\n\n useEffect(() => {\n const ac = new AbortController();\n window.navigation.addEventListener(\n 'navigate',\n () => {\n if (mobileNavOpen) {\n setMobileNavOpen(false);\n }\n },\n {\n signal: ac.signal\n }\n );\n\n return () => {\n ac.abort();\n };\n }, [mobileNavOpen]);\n\n const navigationAgent = agent\n ? {\n ...agent,\n active: bottomPanelOpen,\n onClick: (event: MouseEvent<HTMLElement>) => {\n setBottomPanelOpen(true);\n setMobileNavOpen(false);\n\n if (isSmallOrAbove || (!bottomPanelOpen && !agent.active)) {\n agent.onClick?.(event);\n }\n }\n }\n : undefined;\n useEffect(() => {\n if (mobileNavOpen) disableScroll();\n else enableScroll();\n }, [mobileNavOpen]);\n\n useEffect(() => {\n if (isSmallOrAbove && mobileNavOpen) {\n setMobileNavOpen(false);\n }\n }, [isSmallOrAbove, mobileNavOpen]);\n\n useEscape(() => setMobileNavOpen(false));\n\n useLayoutEffect(() => {\n if (!mobileHeaderEl) return;\n\n const resizeObserver = new ResizeObserver(\n debounce(() => {\n const screenWidth = document.documentElement.clientWidth;\n const regionsPaddingInlinePixels =\n 2 *\n Number.parseInt(\n window.getComputedStyle(mobileHeaderEl).getPropertyValue('padding-inline-start'),\n 10\n );\n const availableWidth = screenWidth * 0.9 - regionsPaddingInlinePixels;\n setMobileNavLinksCount(\n Math.max(\n Math.floor(availableWidth / menuButtonWidth(theme)) - (caseTypes?.length ? 2 : 1),\n 0\n )\n );\n }, 0)\n );\n\n resizeObserver.observe(document.documentElement);\n return () => resizeObserver.disconnect();\n }, [mobileHeaderEl, caseTypes?.length, theme]);\n\n const touchNav = !isSmallOrAbove && (\n <>\n <StyledMobileNav\n hasBottomTouchPanel={!isSmallOrAbove && !!agent && bottomPanelOpen}\n container={{ alignItems: 'center', gap: 0.25 }}\n ref={setMobileHeaderEl}\n data-app-region\n onClick={() => setMobileNavOpen(false)}\n >\n {caseTypes && caseTypes.length > 0 && <CaseTypes caseTypes={caseTypes} mobileNavBar />}\n {links && <Links links={links.slice(0, mobileNavLinksCount)} mobileNavBar />}\n <StyledMobileMoreMenuButton\n variant='simple'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n setMobileNavOpen(prev => !prev);\n e.stopPropagation();\n }}\n label={t('app_shell_more')}\n icon\n aria-expanded={mobileNavOpen}\n aria-controls={navId}\n >\n <Icon name='bars' />\n {!mobileNavOpen && utils?.some(item => (isValidElement(item) ? false : !!item.count)) && (\n <Alert variant='urgent' />\n )}\n <span>{t('app_shell_more')}</span>\n </StyledMobileMoreMenuButton>\n </StyledMobileNav>\n <Drawer open={mobileNavOpen} position='fixed' placement='bottom' size='100dvh' nullWhenClosed>\n <Flex\n {...restProps}\n container={{ direction: 'column', justify: 'between' }}\n id={navId}\n as={StyledMobileMoreMenu}\n aria-label={t('app_shell_main_navigation_label')}\n >\n <AppNavigationPanel\n appInfo={appInfo}\n navState='open'\n searchInput={searchInput}\n searchLabel={searchLabel}\n links={links?.slice(mobileNavLinksCount)}\n cases={cases}\n utils={utilsList}\n agent={navigationAgent}\n />\n </Flex>\n </Drawer>\n </>\n );\n\n return (\n <AppShellContext.Provider value={mobileAppShellContext}>\n <>\n {isSmallOrAbove && (\n <AppHeader\n {...appInfo}\n contextSwitcher={contextSwitcher}\n searchInput={searchInput}\n searchLabel={searchLabel}\n searchPage={searchPage}\n operator={operator}\n headerUtils={headerUtils}\n helpMenu={helpMenu}\n shareApp={shareApp}\n ref={setHeaderEl}\n />\n )}\n {isSmallOrAbove ? (\n <TopNavDrawerProvider>\n <AppTopNav\n appInfo={appInfo}\n caseTypes={caseTypes}\n links={links}\n cases={cases}\n agent={navigationAgent}\n utils={utils}\n searchInput={searchInput}\n searchPage={searchPage}\n searchLabel={searchLabel}\n />\n </TopNavDrawerProvider>\n ) : (\n touchNav\n )}\n {documentTabs && <DocumentTabs {...documentTabs} />}\n {(() => {\n const mainRegion = (\n <StyledAppMain\n previewActive={previewActive}\n isTopBar={isSmallOrAbove}\n hasBottomTouchPanel={!isSmallOrAbove && !!agent && bottomPanelOpen}\n aria-busy={!!progress}\n data-app-region\n >\n <Progress\n visible={!!progress}\n placement='local'\n message={typeof progress === 'string' ? progress : t('loading')}\n />\n {banners && <StyledBannerRegion>{banners}</StyledBannerRegion>}\n {main}\n </StyledAppMain>\n );\n const touchMainRegion = isMobileNav ? (\n <StyledMainTouchAppShell active={!!agent && bottomPanelOpen}>\n {mainRegion}\n </StyledMainTouchAppShell>\n ) : (\n mainRegion\n );\n if (!documentTabs) return touchMainRegion;\n return (\n <StyledDocumentTabPanel\n role='tabpanel'\n id={documentTabs.currentTabId ? getTabPanelId(documentTabs.currentTabId) : undefined}\n aria-labelledby={\n documentTabs.currentTabId ? getTabElementId(documentTabs.currentTabId) : undefined\n }\n tabIndex={0}\n >\n {touchMainRegion}\n </StyledDocumentTabPanel>\n );\n })()}\n <StyledSplitViewPanel active={!isSmallOrAbove && !!agent && bottomPanelOpen}>\n {!isSmallOrAbove && bottomTouchPanel && (\n <StyledPortalTouchDialog\n open={bottomPanelOpen}\n heading={bottomTouchPanel.heading}\n outerClickAction='reset-size'\n onDismiss={() => {\n setBottomPanelOpen(false);\n }}\n size='full-compact'\n >\n {bottomTouchPanel.content}\n </StyledPortalTouchDialog>\n )}\n </StyledSplitViewPanel>\n <AppShellGlobalStyle\n isTopBar={isSmallOrAbove}\n showAppHeader={isSmallOrAbove}\n hasDocumentTabs={!!documentTabs}\n isTouchDevice\n isExtraSmallScreen={!isSmallOrAbove}\n navOpen={mobileNavOpen}\n />\n <TouchAppShellGlobalStyle\n hasBottomTouchPanel={!isSmallOrAbove && !!agent && bottomPanelOpen}\n isMobileNav={isMobileNav}\n />\n </>\n </AppShellContext.Provider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TouchAppShell.js","sourceRoot":"","sources":["../../../src/components/AppShell/TouchAppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1F,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,kBAAkB,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,YAAY,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,oBAAoB,MAAM,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,KAAC,wBAAwB,IACvB,mBAAmB,EAAE,CAAC,cAAc,IAAI,CAAC,CAAC,KAAK,IAAI,eAAe,EAClE,WAAW,EAAE,WAAW,GACxB,IACD,GACsB,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport type { MouseEvent, ReactElement, ReactNode } from 'react';\n\nimport { Alert } from '../Badges';\nimport Drawer from '../Drawer';\nimport Flex from '../Flex';\nimport Icon from '../Icon';\nimport {\n useBreakpoint,\n useElement,\n useEscape,\n useI18n,\n usePreviewManager,\n useScrollToggle,\n useTheme\n} from '../../hooks';\nimport { debounce, isValidElement } from '../../utils';\nimport { openCloseStates } from '../../hooks/useTransitionState';\nimport Progress from '../Progress';\n\nimport AppNavigationPanel, { CaseTypes, Links } from './AppNavigationPanel';\nimport AppHeader from './AppHeader';\nimport AppTopNav from './AppTopNav';\nimport DocumentTabs, { getTabElementId, getTabPanelId } from './DocumentTabs';\nimport { StyledDocumentTabPanel } from './DocumentTabs.styles';\nimport TopNavDrawerProvider from './TopNavDrawerProvider';\nimport {\n menuButtonWidth,\n StyledAppMain,\n StyledBannerRegion,\n AppShellGlobalStyle\n} from './AppShell.styles';\nimport {\n TouchAppShellGlobalStyle,\n StyledMainTouchAppShell,\n StyledSplitViewPanel,\n StyledPortalTouchDialog,\n StyledMobileMoreMenuButton,\n StyledMobileMoreMenu,\n StyledMobileNav\n} from './TouchAppShell.styles';\nimport type { AppShellProps, UtilItemProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\nimport type { AppShellContextValue } from './AppShellContext';\n\nexport interface TouchAppShellProps extends AppShellProps {\n /** Optional bottom panel rendered by the touch app shell. */\n bottomTouchPanel?: {\n heading: string;\n content: ReactNode;\n };\n}\n\nexport default function TouchAppShell({\n appInfo,\n contextSwitcher,\n searchPage,\n searchInput,\n searchLabel,\n caseTypes,\n links,\n cases,\n agent,\n utils,\n utilsList,\n operator,\n notifications,\n headerUtils,\n helpMenu,\n shareApp,\n banners,\n progress,\n main,\n bottomTouchPanel,\n documentTabs,\n navId,\n restProps\n}: TouchAppShellProps & {\n searchLabel: string;\n utilsList: (UtilItemProps | ReactElement)[];\n navId: string;\n restProps: Record<string, unknown>;\n}) {\n const t = useI18n();\n const theme = useTheme();\n const { previewActive, setPreviewActive } = usePreviewManager();\n const { disableScroll, enableScroll } = useScrollToggle();\n const appShellContext = useContext(AppShellContext);\n const isSmallOrAbove = useBreakpoint('sm');\n const isMobileNav = !isSmallOrAbove;\n const [mobileNavOpen, setMobileNavOpen] = useState(false);\n const [bottomPanelOpen, setBottomPanelOpen] = useState(false);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const [mobileNavLinksCount, setMobileNavLinksCount] = useState(0);\n const [mobileHeaderEl, setMobileHeaderEl] = useElement<HTMLDivElement>();\n const [headerEl, setHeaderEl] = useElement<HTMLDivElement>();\n const focusedImperatively = useRef(false);\n const [searchContainerEl, setSearchContainerEl] = useState<HTMLElement | null>(null);\n const mobileAppShellContext = useMemo<AppShellContextValue>(\n () => ({\n ...appShellContext,\n navOpen: mobileNavOpen,\n drawerOpen,\n setDrawerOpen,\n navState: openCloseStates.high,\n focusedImperatively,\n headerEl: headerEl || mobileHeaderEl,\n appHeaderEl: headerEl || mobileHeaderEl,\n searchContainerEl,\n setSearchContainerEl,\n isMobileNav,\n isTopBar: isSmallOrAbove,\n previewActive,\n setPreviewActive\n }),\n [\n appShellContext,\n headerEl,\n mobileHeaderEl,\n mobileNavOpen,\n drawerOpen,\n searchContainerEl,\n isMobileNav,\n previewActive,\n setPreviewActive,\n setSearchContainerEl\n ]\n );\n\n useEffect(() => {\n if (!isSmallOrAbove && agent && agent.active === false) {\n setBottomPanelOpen(false);\n }\n }, [agent?.active, isSmallOrAbove]);\n\n useEffect(() => {\n const ac = new AbortController();\n window.navigation.addEventListener(\n 'navigate',\n () => {\n if (mobileNavOpen) {\n setMobileNavOpen(false);\n }\n },\n {\n signal: ac.signal\n }\n );\n\n return () => {\n ac.abort();\n };\n }, [mobileNavOpen]);\n\n const navigationAgent = agent\n ? {\n ...agent,\n active: bottomPanelOpen,\n onClick: (event: MouseEvent<HTMLElement>) => {\n setBottomPanelOpen(true);\n setMobileNavOpen(false);\n\n if (isSmallOrAbove || (!bottomPanelOpen && !agent.active)) {\n agent.onClick?.(event);\n }\n }\n }\n : undefined;\n useEffect(() => {\n if (mobileNavOpen) disableScroll();\n else enableScroll();\n }, [mobileNavOpen]);\n\n useEffect(() => {\n if (isSmallOrAbove && mobileNavOpen) {\n setMobileNavOpen(false);\n }\n }, [isSmallOrAbove, mobileNavOpen]);\n\n useEscape(() => setMobileNavOpen(false));\n\n useLayoutEffect(() => {\n if (!mobileHeaderEl) return;\n\n const resizeObserver = new ResizeObserver(\n debounce(() => {\n const screenWidth = document.documentElement.clientWidth;\n const regionsPaddingInlinePixels =\n 2 *\n Number.parseInt(\n window.getComputedStyle(mobileHeaderEl).getPropertyValue('padding-inline-start'),\n 10\n );\n const availableWidth = screenWidth * 0.9 - regionsPaddingInlinePixels;\n setMobileNavLinksCount(\n Math.max(\n Math.floor(availableWidth / menuButtonWidth(theme)) - (caseTypes?.length ? 2 : 1),\n 0\n )\n );\n }, 0)\n );\n\n resizeObserver.observe(document.documentElement);\n return () => resizeObserver.disconnect();\n }, [mobileHeaderEl, caseTypes?.length, theme]);\n\n const touchNav = !isSmallOrAbove && (\n <>\n <StyledMobileNav\n hasBottomTouchPanel={!isSmallOrAbove && !!agent && bottomPanelOpen}\n container={{ alignItems: 'center', gap: 0.25 }}\n ref={setMobileHeaderEl}\n data-app-region\n onClick={() => setMobileNavOpen(false)}\n >\n {caseTypes && caseTypes.length > 0 && <CaseTypes caseTypes={caseTypes} mobileNavBar />}\n {links && <Links links={links.slice(0, mobileNavLinksCount)} mobileNavBar />}\n <StyledMobileMoreMenuButton\n variant='simple'\n onClick={(e: MouseEvent<HTMLButtonElement>) => {\n setMobileNavOpen(prev => !prev);\n e.stopPropagation();\n }}\n label={t('app_shell_more')}\n icon\n aria-expanded={mobileNavOpen}\n aria-controls={navId}\n >\n <Icon name='bars' />\n {!mobileNavOpen &&\n utilsList.some(item => (isValidElement(item) ? false : !!item.count)) && (\n <Alert variant='urgent' />\n )}\n <span>{t('app_shell_more')}</span>\n </StyledMobileMoreMenuButton>\n </StyledMobileNav>\n <Drawer open={mobileNavOpen} position='fixed' placement='bottom' size='100dvh' nullWhenClosed>\n <Flex\n {...restProps}\n container={{ direction: 'column', justify: 'between' }}\n id={navId}\n as={StyledMobileMoreMenu}\n aria-label={t('app_shell_main_navigation_label')}\n >\n <AppNavigationPanel\n appInfo={appInfo}\n navState='open'\n searchInput={searchInput}\n searchLabel={searchLabel}\n links={links?.slice(mobileNavLinksCount)}\n cases={cases}\n utils={utilsList}\n agent={navigationAgent}\n />\n </Flex>\n </Drawer>\n </>\n );\n\n return (\n <AppShellContext.Provider value={mobileAppShellContext}>\n <>\n {isSmallOrAbove && (\n <AppHeader\n {...appInfo}\n contextSwitcher={contextSwitcher}\n searchInput={searchInput}\n searchLabel={searchLabel}\n searchPage={searchPage}\n operator={operator}\n notifications={notifications}\n headerUtils={headerUtils}\n helpMenu={helpMenu}\n shareApp={shareApp}\n ref={setHeaderEl}\n />\n )}\n {isSmallOrAbove ? (\n <TopNavDrawerProvider>\n <AppTopNav\n appInfo={appInfo}\n caseTypes={caseTypes}\n links={links}\n cases={cases}\n agent={navigationAgent}\n utils={utils}\n searchInput={searchInput}\n searchPage={searchPage}\n searchLabel={searchLabel}\n />\n </TopNavDrawerProvider>\n ) : (\n touchNav\n )}\n {documentTabs && <DocumentTabs {...documentTabs} />}\n {(() => {\n const mainRegion = (\n <StyledAppMain\n previewActive={previewActive}\n isTopBar={isSmallOrAbove}\n hasBottomTouchPanel={!isSmallOrAbove && !!agent && bottomPanelOpen}\n aria-busy={!!progress}\n data-app-region\n >\n <Progress\n visible={!!progress}\n placement='local'\n message={typeof progress === 'string' ? progress : t('loading')}\n />\n {banners && <StyledBannerRegion>{banners}</StyledBannerRegion>}\n {main}\n </StyledAppMain>\n );\n const touchMainRegion = isMobileNav ? (\n <StyledMainTouchAppShell active={!!agent && bottomPanelOpen}>\n {mainRegion}\n </StyledMainTouchAppShell>\n ) : (\n mainRegion\n );\n if (!documentTabs) return touchMainRegion;\n return (\n <StyledDocumentTabPanel\n role='tabpanel'\n id={documentTabs.currentTabId ? getTabPanelId(documentTabs.currentTabId) : undefined}\n aria-labelledby={\n documentTabs.currentTabId ? getTabElementId(documentTabs.currentTabId) : undefined\n }\n tabIndex={0}\n >\n {touchMainRegion}\n </StyledDocumentTabPanel>\n );\n })()}\n <StyledSplitViewPanel active={!isSmallOrAbove && !!agent && bottomPanelOpen}>\n {!isSmallOrAbove && bottomTouchPanel && (\n <StyledPortalTouchDialog\n open={bottomPanelOpen}\n heading={bottomTouchPanel.heading}\n outerClickAction='reset-size'\n onDismiss={() => {\n setBottomPanelOpen(false);\n }}\n size='full-compact'\n >\n {bottomTouchPanel.content}\n </StyledPortalTouchDialog>\n )}\n </StyledSplitViewPanel>\n <AppShellGlobalStyle\n isTopBar={isSmallOrAbove}\n showAppHeader={isSmallOrAbove}\n hasDocumentTabs={!!documentTabs}\n isTouchDevice\n isExtraSmallScreen={!isSmallOrAbove}\n navOpen={mobileNavOpen}\n />\n <TouchAppShellGlobalStyle\n hasBottomTouchPanel={!isSmallOrAbove && !!agent && bottomPanelOpen}\n isMobileNav={isMobileNav}\n />\n </>\n </AppShellContext.Provider>\n );\n}\n"]}
|