@stack-spot/portal-layout 0.0.65 → 1.0.0-stg.1768483038644
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/CHANGELOG.md +779 -0
- package/dist/Layout.d.ts +60 -8
- package/dist/Layout.d.ts.map +1 -1
- package/dist/Layout.js +59 -24
- package/dist/Layout.js.map +1 -1
- package/dist/LayoutOverlayManager.d.ts +274 -19
- package/dist/LayoutOverlayManager.d.ts.map +1 -1
- package/dist/LayoutOverlayManager.js +373 -82
- package/dist/LayoutOverlayManager.js.map +1 -1
- package/dist/WelcomeTour.d.ts +2 -0
- package/dist/WelcomeTour.d.ts.map +1 -0
- package/dist/WelcomeTour.js +8 -0
- package/dist/WelcomeTour.js.map +1 -0
- package/dist/components/Backdrop.d.ts +75 -0
- package/dist/components/Backdrop.d.ts.map +1 -0
- package/dist/components/Backdrop.js +69 -0
- package/dist/components/Backdrop.js.map +1 -0
- package/dist/components/Contact/show-contact-modal.d.ts +5 -0
- package/dist/components/Contact/show-contact-modal.d.ts.map +1 -0
- package/dist/components/Contact/show-contact-modal.js +37 -0
- package/dist/components/Contact/show-contact-modal.js.map +1 -0
- package/dist/components/ContactModal.d.ts +1 -0
- package/dist/components/ContactModal.d.ts.map +1 -0
- package/dist/components/ContactModal.js +2 -0
- package/dist/components/ContactModal.js.map +1 -0
- package/dist/components/Dialog.d.ts +54 -7
- package/dist/components/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog.js +8 -2
- package/dist/components/Dialog.js.map +1 -1
- package/dist/components/Header.d.ts +38 -2
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/Header.js +9 -4
- package/dist/components/Header.js.map +1 -1
- package/dist/components/NotificationCenter/NotificationPanel.d.ts +3 -0
- package/dist/components/NotificationCenter/NotificationPanel.d.ts.map +1 -0
- package/dist/components/NotificationCenter/NotificationPanel.js +19 -0
- package/dist/components/NotificationCenter/NotificationPanel.js.map +1 -0
- package/dist/components/NotificationCenter/NotificationPanelHeader.d.ts +3 -0
- package/dist/components/NotificationCenter/NotificationPanelHeader.d.ts.map +1 -0
- package/dist/components/NotificationCenter/NotificationPanelHeader.js +16 -0
- package/dist/components/NotificationCenter/NotificationPanelHeader.js.map +1 -0
- package/dist/components/NotificationCenter/NotificationsPanelFooter.d.ts +4 -0
- package/dist/components/NotificationCenter/NotificationsPanelFooter.d.ts.map +1 -0
- package/dist/components/NotificationCenter/NotificationsPanelFooter.js +12 -0
- package/dist/components/NotificationCenter/NotificationsPanelFooter.js.map +1 -0
- package/dist/components/NotificationCenter/dictionary.d.ts +2 -0
- package/dist/components/NotificationCenter/dictionary.d.ts.map +1 -0
- package/dist/components/NotificationCenter/dictionary.js +43 -0
- package/dist/components/NotificationCenter/dictionary.js.map +1 -0
- package/dist/components/NotificationCenter/index.d.ts +2 -0
- package/dist/components/NotificationCenter/index.d.ts.map +1 -0
- package/dist/components/NotificationCenter/index.js +34 -0
- package/dist/components/NotificationCenter/index.js.map +1 -0
- package/dist/components/NotificationCenter/styled.d.ts +3 -0
- package/dist/components/NotificationCenter/styled.d.ts.map +1 -0
- package/dist/components/NotificationCenter/styled.js +74 -0
- package/dist/components/NotificationCenter/styled.js.map +1 -0
- package/dist/components/NotificationCenter/types.d.ts +21 -0
- package/dist/components/NotificationCenter/types.d.ts.map +1 -0
- package/dist/components/NotificationCenter/types.js.map +1 -0
- package/dist/components/NotificationCenter/utils.d.ts +5 -0
- package/dist/components/NotificationCenter/utils.d.ts.map +1 -0
- package/dist/components/NotificationCenter/utils.js +18 -0
- package/dist/components/NotificationCenter/utils.js.map +1 -0
- package/dist/components/OverlayContent.d.ts +27 -1
- package/dist/components/OverlayContent.d.ts.map +1 -1
- package/dist/components/OverlayContent.js +8 -4
- package/dist/components/OverlayContent.js.map +1 -1
- package/dist/components/PortalSwitcher.d.ts +19 -1
- package/dist/components/PortalSwitcher.d.ts.map +1 -1
- package/dist/components/PortalSwitcher.js +16 -31
- package/dist/components/PortalSwitcher.js.map +1 -1
- package/dist/components/PrivacyPolicyMessage/hooks.d.ts +10 -0
- package/dist/components/PrivacyPolicyMessage/hooks.d.ts.map +1 -0
- package/dist/components/PrivacyPolicyMessage/hooks.js +33 -0
- package/dist/components/PrivacyPolicyMessage/hooks.js.map +1 -0
- package/dist/components/PrivacyPolicyMessage/index.d.ts +7 -0
- package/dist/components/PrivacyPolicyMessage/index.d.ts.map +1 -0
- package/dist/components/PrivacyPolicyMessage/index.js +5 -0
- package/dist/components/PrivacyPolicyMessage/index.js.map +1 -0
- package/dist/components/Rate/FeedbackModal.d.ts +8 -0
- package/dist/components/Rate/FeedbackModal.d.ts.map +1 -0
- package/dist/components/Rate/FeedbackModal.js +52 -0
- package/dist/components/Rate/FeedbackModal.js.map +1 -0
- package/dist/components/Rate/hook.d.ts +3 -0
- package/dist/components/Rate/hook.d.ts.map +1 -0
- package/dist/components/Rate/hook.js +48 -0
- package/dist/components/Rate/hook.js.map +1 -0
- package/dist/components/Rate/index.d.ts +10 -0
- package/dist/components/Rate/index.d.ts.map +1 -0
- package/dist/components/Rate/index.js +16 -0
- package/dist/components/Rate/index.js.map +1 -0
- package/dist/components/Rate/on-nps-submit.d.ts +7 -0
- package/dist/components/Rate/on-nps-submit.d.ts.map +1 -0
- package/dist/components/Rate/on-nps-submit.js +8 -0
- package/dist/components/Rate/on-nps-submit.js.map +1 -0
- package/dist/components/Rate/show-rate-us-modals.d.ts +17 -0
- package/dist/components/Rate/show-rate-us-modals.d.ts.map +1 -0
- package/dist/components/Rate/show-rate-us-modals.js +14 -0
- package/dist/components/Rate/show-rate-us-modals.js.map +1 -0
- package/dist/components/Rate/utils.d.ts +2 -0
- package/dist/components/Rate/utils.d.ts.map +1 -0
- package/dist/components/Rate/utils.js +10 -0
- package/dist/components/Rate/utils.js.map +1 -0
- package/dist/components/Toaster.d.ts +35 -0
- package/dist/components/Toaster.d.ts.map +1 -1
- package/dist/components/Toaster.js +32 -4
- package/dist/components/Toaster.js.map +1 -1
- package/dist/components/TypeForm/hook.d.ts +2 -0
- package/dist/components/TypeForm/hook.d.ts.map +1 -0
- package/dist/components/TypeForm/hook.js +11 -0
- package/dist/components/TypeForm/hook.js.map +1 -0
- package/dist/components/TypeForm/index.d.ts +6 -0
- package/dist/components/TypeForm/index.d.ts.map +1 -0
- package/dist/components/TypeForm/index.js +23 -0
- package/dist/components/TypeForm/index.js.map +1 -0
- package/dist/components/TypeForm/show-typeform-modal.d.ts +5 -0
- package/dist/components/TypeForm/show-typeform-modal.d.ts.map +1 -0
- package/dist/components/TypeForm/show-typeform-modal.js +11 -0
- package/dist/components/TypeForm/show-typeform-modal.js.map +1 -0
- package/dist/components/TypeForm/utils.d.ts +2 -0
- package/dist/components/TypeForm/utils.d.ts.map +1 -0
- package/dist/components/TypeForm/utils.js +9 -0
- package/dist/components/TypeForm/utils.js.map +1 -0
- package/dist/components/UserMenu.d.ts +19 -2
- package/dist/components/UserMenu.d.ts.map +1 -1
- package/dist/components/UserMenu.js +12 -6
- package/dist/components/UserMenu.js.map +1 -1
- package/dist/components/error/ErrorBoundary.d.ts +25 -4
- package/dist/components/error/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/error/ErrorBoundary.js +10 -1
- package/dist/components/error/ErrorBoundary.js.map +1 -1
- package/dist/components/error/ErrorManager.d.ts +22 -6
- package/dist/components/error/ErrorManager.d.ts.map +1 -1
- package/dist/components/error/ErrorManager.js +21 -1
- package/dist/components/error/ErrorManager.js.map +1 -1
- package/dist/components/error/SilentErrorBoundary.d.ts +26 -5
- package/dist/components/error/SilentErrorBoundary.d.ts.map +1 -1
- package/dist/components/error/SilentErrorBoundary.js +10 -0
- package/dist/components/error/SilentErrorBoundary.js.map +1 -1
- package/dist/components/menu/MenuContent.d.ts +20 -4
- package/dist/components/menu/MenuContent.d.ts.map +1 -1
- package/dist/components/menu/MenuContent.js +89 -88
- package/dist/components/menu/MenuContent.js.map +1 -1
- package/dist/components/menu/MenuSectionGroup.d.ts +2 -0
- package/dist/components/menu/MenuSectionGroup.d.ts.map +1 -0
- package/dist/components/menu/MenuSectionGroup.js +121 -0
- package/dist/components/menu/MenuSectionGroup.js.map +1 -0
- package/dist/components/menu/MenuSections.d.ts +17 -0
- package/dist/components/menu/MenuSections.d.ts.map +1 -1
- package/dist/components/menu/MenuSections.js +159 -39
- package/dist/components/menu/MenuSections.js.map +1 -1
- package/dist/components/menu/PageSelector.d.ts +5 -0
- package/dist/components/menu/PageSelector.d.ts.map +1 -1
- package/dist/components/menu/PageSelector.js +9 -4
- package/dist/components/menu/PageSelector.js.map +1 -1
- package/dist/components/menu/types.d.ts +219 -8
- package/dist/components/menu/types.d.ts.map +1 -1
- package/dist/components/tour/StepContainer.d.ts +37 -0
- package/dist/components/tour/StepContainer.d.ts.map +1 -0
- package/dist/components/tour/StepContainer.js +51 -0
- package/dist/components/tour/StepContainer.js.map +1 -0
- package/dist/components/tour/StepNavigation.d.ts +29 -0
- package/dist/components/tour/StepNavigation.d.ts.map +1 -0
- package/dist/components/tour/StepNavigation.js +37 -0
- package/dist/components/tour/StepNavigation.js.map +1 -0
- package/dist/components/tour/StepTitle.d.ts +17 -0
- package/dist/components/tour/StepTitle.d.ts.map +1 -0
- package/dist/components/tour/StepTitle.js +10 -0
- package/dist/components/tour/StepTitle.js.map +1 -0
- package/dist/components/tour/hook.d.ts +3 -0
- package/dist/components/tour/hook.d.ts.map +1 -0
- package/dist/components/tour/hook.js +10 -0
- package/dist/components/tour/hook.js.map +1 -0
- package/dist/components/tour/index.d.ts +5 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +5 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/manager.d.ts +34 -0
- package/dist/components/tour/manager.d.ts.map +1 -0
- package/dist/components/tour/manager.js +104 -0
- package/dist/components/tour/manager.js.map +1 -0
- package/dist/components/tour/utils.d.ts +67 -0
- package/dist/components/tour/utils.d.ts.map +1 -0
- package/dist/components/tour/utils.js +60 -0
- package/dist/components/tour/utils.js.map +1 -0
- package/dist/components/user-menu-manager.d.ts +13 -0
- package/dist/components/user-menu-manager.d.ts.map +1 -0
- package/dist/components/user-menu-manager.js +36 -0
- package/dist/components/user-menu-manager.js.map +1 -0
- package/dist/dictionary.d.ts +6 -1
- package/dist/dictionary.d.ts.map +1 -1
- package/dist/dictionary.js +7 -2
- package/dist/dictionary.js.map +1 -1
- package/dist/elements.d.ts +7 -0
- package/dist/elements.d.ts.map +1 -1
- package/dist/elements.js +7 -0
- package/dist/elements.js.map +1 -1
- package/dist/index.d.ts +15 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/dist/layout.css +190 -35
- package/dist/svg/StarFillWithGradient.d.ts +6 -0
- package/dist/svg/StarFillWithGradient.d.ts.map +1 -0
- package/dist/svg/StarFillWithGradient.js +4 -0
- package/dist/svg/StarFillWithGradient.js.map +1 -0
- package/dist/toaster.d.ts +55 -9
- package/dist/toaster.d.ts.map +1 -1
- package/dist/toaster.js +34 -6
- package/dist/toaster.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +6 -69
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +9 -130
- package/dist/utils.js.map +1 -1
- package/package.dev.json +3 -0
- package/package.json +24 -13
- package/package.stg.json +3 -0
- package/readme.md +147 -0
- package/src/Layout.tsx +166 -58
- package/src/LayoutOverlayManager.tsx +499 -85
- package/src/WelcomeTour.tsx +8 -0
- package/src/components/Backdrop.tsx +116 -0
- package/src/components/Contact/show-contact-modal.tsx +71 -0
- package/src/components/Dialog.tsx +58 -9
- package/src/components/Header.tsx +53 -5
- package/src/components/NotificationCenter/NotificationPanel.tsx +40 -0
- package/src/components/NotificationCenter/NotificationPanelHeader.tsx +53 -0
- package/src/components/NotificationCenter/NotificationsPanelFooter.tsx +25 -0
- package/src/components/NotificationCenter/dictionary.ts +44 -0
- package/src/components/NotificationCenter/index.tsx +58 -0
- package/src/components/NotificationCenter/styled.ts +75 -0
- package/src/components/NotificationCenter/types.ts +24 -0
- package/src/components/NotificationCenter/utils.ts +20 -0
- package/src/components/OverlayContent.tsx +40 -5
- package/src/components/PortalSwitcher.tsx +33 -39
- package/src/components/PrivacyPolicyMessage/hooks.tsx +49 -0
- package/src/components/PrivacyPolicyMessage/index.tsx +21 -0
- package/src/components/Rate/FeedbackModal.tsx +86 -0
- package/src/components/Rate/hook.tsx +61 -0
- package/src/components/Rate/index.tsx +36 -0
- package/src/components/Rate/on-nps-submit.ts +18 -0
- package/src/components/Rate/show-rate-us-modals.tsx +29 -0
- package/src/components/Rate/utils.ts +11 -0
- package/src/components/Toaster.tsx +82 -3
- package/src/components/TypeForm/hook.tsx +13 -0
- package/src/components/TypeForm/index.tsx +50 -0
- package/src/components/TypeForm/show-typeform-modal.tsx +10 -0
- package/src/components/TypeForm/utils.ts +8 -0
- package/src/components/UserMenu.tsx +32 -8
- package/src/components/error/ErrorBoundary.tsx +11 -2
- package/src/components/error/ErrorManager.ts +22 -6
- package/src/components/error/SilentErrorBoundary.tsx +12 -2
- package/src/components/menu/MenuContent.tsx +102 -110
- package/src/components/menu/MenuSectionGroup.tsx +121 -0
- package/src/components/menu/MenuSections.tsx +342 -93
- package/src/components/menu/PageSelector.tsx +16 -4
- package/src/components/menu/types.ts +221 -9
- package/src/components/tour/StepContainer.tsx +92 -0
- package/src/components/tour/StepNavigation.tsx +72 -0
- package/src/components/tour/StepTitle.tsx +28 -0
- package/src/components/tour/hook.ts +12 -0
- package/src/components/tour/index.ts +6 -0
- package/src/components/tour/manager.tsx +119 -0
- package/src/components/tour/utils.tsx +119 -0
- package/src/components/user-menu-manager.ts +31 -0
- package/src/dictionary.ts +7 -2
- package/src/elements.ts +7 -0
- package/src/index.ts +15 -8
- package/src/layout.css +190 -35
- package/src/svg/StarFillWithGradient.tsx +14 -0
- package/src/toaster.tsx +90 -13
- package/src/types.ts +4 -0
- package/src/utils.ts +9 -142
- package/dist/components/BottomNotification.d.ts +0 -1
- package/dist/components/BottomNotification.d.ts.map +0 -1
- package/dist/components/BottomNotification.js +0 -2
- package/dist/components/BottomNotification.js.map +0 -1
- package/dist/components/BottomPanel.d.ts +0 -1
- package/dist/components/BottomPanel.d.ts.map +0 -1
- package/dist/components/BottomPanel.js +0 -2
- package/dist/components/BottomPanel.js.map +0 -1
- package/dist/components/SelectionList.d.ts +0 -36
- package/dist/components/SelectionList.d.ts.map +0 -1
- package/dist/components/SelectionList.js +0 -140
- package/dist/components/SelectionList.js.map +0 -1
- package/dist/components/error/ErrorFeedback.d.ts +0 -3
- package/dist/components/error/ErrorFeedback.d.ts.map +0 -1
- package/dist/components/error/ErrorFeedback.js +0 -66
- package/dist/components/error/ErrorFeedback.js.map +0 -1
- package/dist/components/menu/use-check-text-overflow.d.ts +0 -6
- package/dist/components/menu/use-check-text-overflow.d.ts.map +0 -1
- package/dist/components/menu/use-check-text-overflow.js +0 -20
- package/dist/components/menu/use-check-text-overflow.js.map +0 -1
- package/dist/components/menu/use-keyboard-controls.d.ts +0 -23
- package/dist/components/menu/use-keyboard-controls.d.ts.map +0 -1
- package/dist/components/menu/use-keyboard-controls.js +0 -49
- package/dist/components/menu/use-keyboard-controls.js.map +0 -1
- package/dist/components/tour/PortalSwitcherStep.d.ts +0 -3
- package/dist/components/tour/PortalSwitcherStep.d.ts.map +0 -1
- package/dist/components/tour/PortalSwitcherStep.js +0 -29
- package/dist/components/tour/PortalSwitcherStep.js.map +0 -1
- package/dist/components/types.d.ts +0 -15
- package/dist/components/types.d.ts.map +0 -1
- package/dist/components/types.js.map +0 -1
- package/dist/layout-context.d.ts +0 -10
- package/dist/layout-context.d.ts.map +0 -1
- package/dist/layout-context.js +0 -11
- package/dist/layout-context.js.map +0 -1
- package/dist/svg/AI.d.ts +0 -6
- package/dist/svg/AI.d.ts.map +0 -1
- package/dist/svg/AI.js +0 -9
- package/dist/svg/AI.js.map +0 -1
- package/dist/svg/EDP.d.ts +0 -6
- package/dist/svg/EDP.d.ts.map +0 -1
- package/dist/svg/EDP.js +0 -5
- package/dist/svg/EDP.js.map +0 -1
- package/dist/svg/Forbidden.d.ts +0 -6
- package/dist/svg/Forbidden.d.ts.map +0 -1
- package/dist/svg/Forbidden.js +0 -4
- package/dist/svg/Forbidden.js.map +0 -1
- package/dist/svg/HUB.d.ts +0 -6
- package/dist/svg/HUB.d.ts.map +0 -1
- package/dist/svg/HUB.js +0 -5
- package/dist/svg/HUB.js.map +0 -1
- package/dist/svg/Logo.d.ts +0 -2
- package/dist/svg/Logo.d.ts.map +0 -1
- package/dist/svg/Logo.js +0 -4
- package/dist/svg/Logo.js.map +0 -1
- package/dist/svg/NotFound.d.ts +0 -6
- package/dist/svg/NotFound.d.ts.map +0 -1
- package/dist/svg/NotFound.js +0 -4
- package/dist/svg/NotFound.js.map +0 -1
- package/dist/svg/ServerError.d.ts +0 -6
- package/dist/svg/ServerError.d.ts.map +0 -1
- package/dist/svg/ServerError.js +0 -4
- package/dist/svg/ServerError.js.map +0 -1
- package/dist/svg/Unauthenticated.d.ts +0 -6
- package/dist/svg/Unauthenticated.d.ts.map +0 -1
- package/dist/svg/Unauthenticated.js +0 -4
- package/dist/svg/Unauthenticated.js.map +0 -1
- package/src/components/BottomPanel.tsx +0 -0
- package/src/components/SelectionList.tsx +0 -272
- package/src/components/error/ErrorFeedback.tsx +0 -114
- package/src/components/menu/use-check-text-overflow.tsx +0 -26
- package/src/components/menu/use-keyboard-controls.tsx +0 -70
- package/src/components/tour/PortalSwitcherStep.tsx +0 -36
- package/src/components/types.ts +0 -15
- package/src/layout-context.tsx +0 -22
- package/src/svg/AI.tsx +0 -37
- package/src/svg/EDP.tsx +0 -35
- package/src/svg/Forbidden.tsx +0 -22
- package/src/svg/HUB.tsx +0 -35
- package/src/svg/Logo.tsx +0 -35
- package/src/svg/NotFound.tsx +0 -16
- package/src/svg/ServerError.tsx +0 -33
- package/src/svg/Unauthenticated.tsx +0 -16
- /package/dist/components/{types.js → NotificationCenter/types.js} +0 -0
- /package/src/components/{BottomNotification.tsx → ContactModal.tsx} +0 -0
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
import { Flex, IconBox, Text } from '@citric/core'
|
|
1
|
+
import { Box, Flex, IconBox, Text } from '@citric/core'
|
|
4
2
|
import { ArrowLeft, ChevronDown } from '@citric/icons'
|
|
5
3
|
import { LoadingCircular } from '@citric/ui'
|
|
4
|
+
import { useCheckTextOverflow } from '@stack-spot/portal-components'
|
|
5
|
+
import { useAnchorTag } from '@stack-spot/portal-components/anchor'
|
|
6
6
|
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
7
7
|
import { useMemo, useState } from 'react'
|
|
8
8
|
import { styled } from 'styled-components'
|
|
9
|
-
import { useAnchorTag } from '../../layout-context'
|
|
10
9
|
import { hideOverlayImmediately } from './MenuSections'
|
|
11
10
|
import { PageSelector } from './PageSelector'
|
|
12
11
|
import { MENU_CONTENT_ITEM_PADDING as ITEM_PADDING, MENU_CONTENT_PADDING as PADDING } from './constants'
|
|
13
12
|
import { ItemGroup, MenuAction, MenuItem, MenuSectionContent } from './types'
|
|
14
|
-
import { useCheckTextOverflow } from './use-check-text-overflow'
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
margin-bottom: 16px;
|
|
22
|
-
gap: 6px;
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
export const MenuGroup = styled.ul`
|
|
14
|
+
/**
|
|
15
|
+
* The list (`<ul>`) used for grouping items in a menu.
|
|
16
|
+
*/
|
|
17
|
+
// fixme: remove explicit type when TS is upgraded to 5.5 or greater
|
|
18
|
+
export const MenuGroup: React.FC<React.HTMLAttributes<HTMLUListElement>> = styled.ul`
|
|
26
19
|
padding: 0 0 0 16px;
|
|
27
20
|
display: flex;
|
|
28
21
|
flex-direction: column;
|
|
@@ -33,30 +26,18 @@ export const MenuGroup = styled.ul`
|
|
|
33
26
|
padding: 0;
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
.item-row-group > a {
|
|
37
|
-
padding: 0 16px;
|
|
38
|
-
margin: 0;
|
|
39
|
-
border-radius: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.item-row-group > a::before {
|
|
43
|
-
content: '';
|
|
44
|
-
position: absolute;
|
|
45
|
-
top: 0;
|
|
46
|
-
left: 0;
|
|
47
|
-
right: 0;
|
|
48
|
-
bottom: 0;
|
|
49
|
-
background-color: var(--light-300);
|
|
50
|
-
opacity: 0.24;
|
|
51
|
-
border-radius: inherit;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
29
|
.item-row {
|
|
55
30
|
display: flex;
|
|
56
31
|
flex-direction: row;
|
|
57
32
|
gap: 8px;
|
|
58
33
|
align-items: center;
|
|
59
34
|
|
|
35
|
+
&.root {
|
|
36
|
+
padding: 0 16px;
|
|
37
|
+
margin-top: 16px;
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
60
41
|
.label {
|
|
61
42
|
flex: 1;
|
|
62
43
|
&.hidden, &.ellipsis {
|
|
@@ -68,73 +49,77 @@ export const MenuGroup = styled.ul`
|
|
|
68
49
|
}
|
|
69
50
|
}
|
|
70
51
|
}
|
|
71
|
-
|
|
72
|
-
.item-row-group {
|
|
73
|
-
margin-top: 16px;
|
|
74
|
-
}
|
|
75
52
|
|
|
76
|
-
li
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
transition: height 0.3s, background-color 0.2s;
|
|
81
|
-
margin-left: ${PADDING - ITEM_PADDING}px;
|
|
82
|
-
padding-left: ${ITEM_PADDING}px;
|
|
53
|
+
li {
|
|
54
|
+
.item-row-title {
|
|
55
|
+
opacity: 0.7;
|
|
56
|
+
}
|
|
83
57
|
|
|
84
|
-
|
|
85
|
-
|
|
58
|
+
.item-as-title {
|
|
59
|
+
position: relative;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
margin-left: ${PADDING - ITEM_PADDING}px;
|
|
86
62
|
}
|
|
87
63
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
64
|
+
a {
|
|
65
|
+
position: relative;
|
|
66
|
+
height: 0;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
transition: height 0.3s, background-color 0.2s;
|
|
69
|
+
margin-left: ${PADDING - ITEM_PADDING}px;
|
|
70
|
+
padding-left: ${ITEM_PADDING}px;
|
|
71
|
+
|
|
72
|
+
&:hover {
|
|
73
|
+
background-color: ${theme.color.light['500']};
|
|
97
74
|
}
|
|
75
|
+
|
|
76
|
+
&.action {
|
|
77
|
+
&:before {
|
|
78
|
+
content: '';
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: 2px;
|
|
81
|
+
width: 2px;
|
|
82
|
+
height: 0;
|
|
83
|
+
background: inherit;
|
|
84
|
+
transition: height 0.2s;
|
|
85
|
+
}
|
|
98
86
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
87
|
+
&.active {
|
|
88
|
+
|
|
89
|
+
&:hover {
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:before {
|
|
94
|
+
background: ${theme.color.primary['500']};
|
|
95
|
+
height: 24px;
|
|
96
|
+
}
|
|
103
97
|
}
|
|
104
|
-
|
|
105
|
-
&:before {
|
|
106
|
-
background: ${theme.color.
|
|
98
|
+
|
|
99
|
+
&:not(.active):hover:before {
|
|
100
|
+
background: ${theme.color.light.contrastText};
|
|
107
101
|
height: 24px;
|
|
108
102
|
}
|
|
109
103
|
}
|
|
110
104
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.chevron {
|
|
118
|
-
transition: transform 0.3s;
|
|
119
|
-
&:not(.open) {
|
|
120
|
-
transform: rotate(-90deg);
|
|
105
|
+
.chevron {
|
|
106
|
+
transition: transform 0.3s;
|
|
107
|
+
&:not(.open) {
|
|
108
|
+
transform: rotate(-90deg);
|
|
109
|
+
}
|
|
121
110
|
}
|
|
122
111
|
}
|
|
123
|
-
|
|
124
|
-
.item-row-title {
|
|
125
|
-
opacity: 0.7;
|
|
126
|
-
}
|
|
127
112
|
}
|
|
128
113
|
|
|
129
114
|
&.open {
|
|
130
115
|
visibility: visible;
|
|
131
116
|
transition: unset;
|
|
132
|
-
& > li > a, & > li > .item-
|
|
117
|
+
& > li > a, & > li > .item-as-title {
|
|
133
118
|
height: 40px;
|
|
134
119
|
}
|
|
135
120
|
}
|
|
136
121
|
|
|
137
|
-
&:not(.open) &.open > li > a {
|
|
122
|
+
&:not(.open) &.open > li > a, &:not(.open) &.open > li > .item-as-title {
|
|
138
123
|
height: 0;
|
|
139
124
|
}
|
|
140
125
|
|
|
@@ -158,13 +143,21 @@ export const MenuGroup = styled.ul`
|
|
|
158
143
|
}
|
|
159
144
|
`
|
|
160
145
|
|
|
161
|
-
|
|
146
|
+
/**
|
|
147
|
+
* The header (<header>) for a group of items in a menu. Contains the title of the group.
|
|
148
|
+
*/
|
|
149
|
+
// fixme: remove explicit type when TS is upgraded to 5.5 or greater
|
|
150
|
+
export const Title: React.FC<React.HTMLAttributes<HTMLElement>> = styled.header`
|
|
162
151
|
display: flex;
|
|
163
152
|
flex-direction: column;
|
|
164
153
|
margin: ${PADDING}px 0 24px ${PADDING}px;
|
|
165
154
|
`
|
|
166
155
|
|
|
167
|
-
|
|
156
|
+
/**
|
|
157
|
+
* A menu item that performs an action.
|
|
158
|
+
* @param props the props for the component {@link MenuAction}.
|
|
159
|
+
*/
|
|
160
|
+
export const ActionItem = ({ label, onClick, href, active, icon, badge, target, overflow = 'wrap' }: MenuAction) => {
|
|
168
161
|
const Link = useAnchorTag()
|
|
169
162
|
const { ref, overflow: textOverflow } = useCheckTextOverflow()
|
|
170
163
|
const isTextLabel = typeof label === 'string'
|
|
@@ -176,6 +169,7 @@ export const ActionItem = ({ label, onClick, href, active, icon, badge, overflow
|
|
|
176
169
|
if (onClick) onClick()
|
|
177
170
|
hideOverlayImmediately()
|
|
178
171
|
}}
|
|
172
|
+
target={target}
|
|
179
173
|
className={listToClass(['action', 'item-row', active ? 'active' : undefined])}
|
|
180
174
|
{...(active ? { 'aria-current': 'page' } : undefined)}
|
|
181
175
|
{...(!href ? { 'tabIndex': 0 } : undefined)}
|
|
@@ -189,7 +183,12 @@ export const ActionItem = ({ label, onClick, href, active, icon, badge, overflow
|
|
|
189
183
|
)
|
|
190
184
|
}
|
|
191
185
|
|
|
192
|
-
|
|
186
|
+
/**
|
|
187
|
+
* A menu item that is actually a subgroup and can be collapsed/expanded.
|
|
188
|
+
* @param props the props for the component {@link ItemGroup} & { root: boolean }. Pass root=true to style this group as a root group.
|
|
189
|
+
* Root groups have slightly different visuals.
|
|
190
|
+
*/
|
|
191
|
+
const CollapsibleGroupItem = ({ label, showAsTitle, open: initiallyOpened, children, icon, badge, root, overflow = 'wrap' }:
|
|
193
192
|
ItemGroup & { root?: boolean }) => {
|
|
194
193
|
const [open, setOpen] = useState(initiallyOpened ?? children?.some(c => 'active' in c && c.active) ?? false)
|
|
195
194
|
const items = useMemo(() => children?.filter(i => !i.hidden).map(renderOption), [children])
|
|
@@ -197,10 +196,17 @@ const CollapsibleGroupItem = ({ label, open: initiallyOpened, children, icon, ba
|
|
|
197
196
|
|
|
198
197
|
return (
|
|
199
198
|
<>
|
|
200
|
-
<
|
|
199
|
+
{showAsTitle ? <Box className={listToClass(['item-row', root && 'root', 'item-as-title'])}>
|
|
200
|
+
{icon}
|
|
201
|
+
<Text appearance={root ? 'overheader2' : 'body2'}
|
|
202
|
+
colorScheme="light.contrastText"
|
|
203
|
+
className={`label ${overflow} ${root ? 'item-row-title' : ''}`}>
|
|
204
|
+
{label}
|
|
205
|
+
</Text>
|
|
206
|
+
</Box> : <a
|
|
201
207
|
onClick={() => setOpen(!open)}
|
|
202
208
|
onKeyDown={e => e.key === 'Enter' && setOpen(!open)}
|
|
203
|
-
className=
|
|
209
|
+
className={listToClass(['item-row', root && 'root'])}
|
|
204
210
|
tabIndex={0}
|
|
205
211
|
aria-controls={id}
|
|
206
212
|
aria-expanded={open}
|
|
@@ -215,7 +221,7 @@ const CollapsibleGroupItem = ({ label, open: initiallyOpened, children, icon, ba
|
|
|
215
221
|
<IconBox sx={{ mr: root ? undefined : '5' }}>
|
|
216
222
|
<ChevronDown className={listToClass(['chevron', open ? 'open' : ''])} />
|
|
217
223
|
</IconBox>
|
|
218
|
-
</a>
|
|
224
|
+
</a>}
|
|
219
225
|
<MenuGroup id={id}
|
|
220
226
|
className={`${open ? 'open' : ''} ${root ? 'no-indentation' : ''}`}
|
|
221
227
|
aria-hidden={!open}>{items}</MenuGroup>
|
|
@@ -223,41 +229,27 @@ const CollapsibleGroupItem = ({ label, open: initiallyOpened, children, icon, ba
|
|
|
223
229
|
)
|
|
224
230
|
}
|
|
225
231
|
|
|
226
|
-
const RootGroupItem = (props: ItemGroup) => {
|
|
227
|
-
const items = useMemo(() => props.children?.filter(i => !i.hidden).map(renderOption), [props.children])
|
|
228
|
-
|
|
229
|
-
return <>
|
|
230
|
-
{items.length ? <div className="item-row-group">
|
|
231
|
-
<CollapsibleGroupItem {...props} open={true} root={true} />
|
|
232
|
-
</div> :
|
|
233
|
-
<>
|
|
234
|
-
<div className="item-row">
|
|
235
|
-
{props.icon}
|
|
236
|
-
<Text appearance="overheader2" colorScheme="light.700" className={`group-title label ${props.overflow}`}>{props.label}</Text>
|
|
237
|
-
{props.badge}
|
|
238
|
-
</div>
|
|
239
|
-
<MenuGroup className="open no-indentation">{items}</MenuGroup>
|
|
240
|
-
</>
|
|
241
|
-
}
|
|
242
|
-
</>
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const GroupItem = ({ root, ...item }: ItemGroup & { root?: boolean }) => (
|
|
246
|
-
root ? <RootGroupItem {...item} /> : <CollapsibleGroupItem {...item} />
|
|
247
|
-
)
|
|
248
|
-
|
|
249
232
|
function renderOption({ root, ...option }: MenuItem & { root?: boolean }) {
|
|
250
233
|
const labelText = typeof option.label === 'string' ? option.label : option.label.id
|
|
251
234
|
return (
|
|
252
235
|
<li key={labelText} role="menuitem" aria-selected={'children' in option ? undefined : option.active}>
|
|
253
|
-
{'children' in option ? <
|
|
236
|
+
{'children' in option ? <CollapsibleGroupItem {...option} root={root} open={option.open ?? root} /> : <ActionItem {...option} />}
|
|
254
237
|
</li >
|
|
255
238
|
)
|
|
256
239
|
}
|
|
257
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Renders a menu-content interface.
|
|
243
|
+
*
|
|
244
|
+
* Considering the Stackspot UI, this is the "menu content", not the "menu sections", i.e. it's the second menu from left to right, the
|
|
245
|
+
* one that changes according to section selected.
|
|
246
|
+
* @param props the props for the component {@link MenuSectionContent}.
|
|
247
|
+
*/
|
|
258
248
|
export const MenuContent = ({ pageSelector, goBack, title, subtitle, afterTitle, options = [], loading, error }: MenuSectionContent) => {
|
|
259
249
|
const items = useMemo(() => options.filter(o => !o.hidden).map(o => renderOption({ ...o, root: true })), [options])
|
|
260
250
|
|
|
251
|
+
const Link = useAnchorTag()
|
|
252
|
+
|
|
261
253
|
function renderContent() {
|
|
262
254
|
if (loading) {
|
|
263
255
|
return (
|
|
@@ -273,14 +265,14 @@ export const MenuContent = ({ pageSelector, goBack, title, subtitle, afterTitle,
|
|
|
273
265
|
return (
|
|
274
266
|
<>
|
|
275
267
|
{goBack && (
|
|
276
|
-
<
|
|
268
|
+
<Link href={goBack.href} onClick={goBack.onClick} className="goBackLink">
|
|
277
269
|
<IconBox colorIcon="inverse.500" size="sm">
|
|
278
270
|
<ArrowLeft />
|
|
279
271
|
</IconBox>
|
|
280
272
|
{typeof goBack?.label === 'string' ?
|
|
281
273
|
<Text appearance="body2" nowrapEllipsis>{goBack.label}</Text> :
|
|
282
274
|
goBack.label.element}
|
|
283
|
-
</
|
|
275
|
+
</Link>
|
|
284
276
|
)}
|
|
285
277
|
{title && (
|
|
286
278
|
<Title>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
2
|
+
import styled from 'styled-components'
|
|
3
|
+
import { MENU_CONTENT_PADDING as PADDING } from './constants'
|
|
4
|
+
|
|
5
|
+
export const MenuSectionGroup: React.FC<React.HTMLAttributes<HTMLUListElement>> = styled.ul`
|
|
6
|
+
padding: 0 0 0 16px;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
visibility: hidden;
|
|
10
|
+
transition: visibility 0s 0.3s;
|
|
11
|
+
|
|
12
|
+
&.no-indentation {
|
|
13
|
+
padding: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.item-row {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
gap: 8px;
|
|
20
|
+
align-items: center;
|
|
21
|
+
|
|
22
|
+
&.root {
|
|
23
|
+
padding: 0 16px;
|
|
24
|
+
margin-top: 16px;
|
|
25
|
+
border-radius: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.label {
|
|
29
|
+
flex: 1;
|
|
30
|
+
&.hidden, &.ellipsis {
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
&.ellipsis {
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
li a {
|
|
41
|
+
position: relative;
|
|
42
|
+
height: 0;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
transition: height 0.3s, background-color 0.2s;
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
background-color: ${theme.color.light['500']};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.action {
|
|
51
|
+
&:before {
|
|
52
|
+
content: '';
|
|
53
|
+
position: absolute;
|
|
54
|
+
left: 2px;
|
|
55
|
+
width: 2px;
|
|
56
|
+
height: 0;
|
|
57
|
+
background: inherit;
|
|
58
|
+
transition: height 0.2s;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.active {
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
background-color: transparent;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:before {
|
|
68
|
+
background: ${theme.color.primary['500']};
|
|
69
|
+
height: 24px;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:not(.active):hover:before {
|
|
74
|
+
background: ${theme.color.light.contrastText};
|
|
75
|
+
height: 24px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.chevron {
|
|
80
|
+
transition: transform 0.5s;
|
|
81
|
+
&:not(.open) {
|
|
82
|
+
transform: rotate(180deg);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.item-row-title {
|
|
87
|
+
opacity: 0.7;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.open {
|
|
92
|
+
visibility: visible;
|
|
93
|
+
transition: unset;
|
|
94
|
+
& > li > a {
|
|
95
|
+
height: 56px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:not(.open) &.open > li > a {
|
|
100
|
+
height: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.root {
|
|
104
|
+
/* margin-bottom: ${PADDING}px; */
|
|
105
|
+
|
|
106
|
+
& > li {
|
|
107
|
+
.group-title {
|
|
108
|
+
margin-left: ${PADDING}px;
|
|
109
|
+
margin-bottom: 5px;
|
|
110
|
+
margin-top: 40px;
|
|
111
|
+
display: block;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&:first-child {
|
|
115
|
+
.group-title {
|
|
116
|
+
margin-top: 0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`
|