@stack-spot/portal-layout 0.0.64 → 1.0.0-dev.1768482785050
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 -547
- 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 +66 -8
- package/dist/components/tour/utils.d.ts.map +1 -1
- package/dist/components/tour/utils.js +57 -45
- package/dist/components/tour/utils.js.map +1 -1
- 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 +26 -15
- package/package.stg.json +3 -0
- package/readme.md +147 -0
- package/src/Layout.tsx +166 -57
- 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/ErrorDescriptor.d.ts +0 -12
- package/dist/components/error/ErrorDescriptor.d.ts.map +0 -1
- package/dist/components/error/ErrorDescriptor.js +0 -17
- package/dist/components/error/ErrorDescriptor.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/menu/useCheckTextOverflow.d.ts +0 -6
- package/dist/components/menu/useCheckTextOverflow.d.ts.map +0 -1
- package/dist/components/menu/useCheckTextOverflow.js +0 -20
- package/dist/components/menu/useCheckTextOverflow.js.map +0 -1
- package/dist/components/tour/Navigation.d.ts +0 -8
- package/dist/components/tour/Navigation.d.ts.map +0 -1
- package/dist/components/tour/Navigation.js +0 -15
- package/dist/components/tour/Navigation.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/tour/config.d.ts +0 -3
- package/dist/components/tour/config.d.ts.map +0 -1
- package/dist/components/tour/config.js +0 -22
- package/dist/components/tour/config.js.map +0 -1
- package/dist/components/tour/steps/PortalSwitcherStep.d.ts +0 -3
- package/dist/components/tour/steps/PortalSwitcherStep.d.ts.map +0 -1
- package/dist/components/tour/steps/PortalSwitcherStep.js +0 -30
- package/dist/components/tour/steps/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,16 +1,95 @@
|
|
|
1
|
+
import { Flex, Text } from '@citric/core'
|
|
1
2
|
import { TimesMini } from '@citric/icons'
|
|
2
3
|
import { IconButton } from '@citric/ui'
|
|
3
|
-
import {
|
|
4
|
+
import { useAnchorTag } from '@stack-spot/portal-components/anchor'
|
|
5
|
+
import { useMemo } from 'react'
|
|
6
|
+
import type { CloseButton as DefaultCloseButton } from 'react-toastify'
|
|
7
|
+
import { ToastContainer, toast } from 'react-toastify'
|
|
4
8
|
import 'react-toastify/dist/ReactToastify.css'
|
|
5
9
|
import { useDictionary } from '../dictionary'
|
|
6
10
|
|
|
11
|
+
type CloseButtonProps = Parameters<typeof DefaultCloseButton>[0]
|
|
12
|
+
|
|
13
|
+
export const TOASTER_CLOSE_BTN_CLASS = 'btn-close'
|
|
14
|
+
|
|
7
15
|
const CloseButton = ({ closeToast }: CloseButtonProps) => {
|
|
8
16
|
const t = useDictionary()
|
|
9
17
|
return (
|
|
10
|
-
<IconButton
|
|
18
|
+
<IconButton appearance="circle" color="light" size="xs" className={TOASTER_CLOSE_BTN_CLASS} onClick={closeToast} title={t.dismiss}>
|
|
11
19
|
<TimesMini />
|
|
12
20
|
</IconButton>
|
|
13
21
|
)
|
|
14
22
|
}
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Uses react-toastify to render a Toaster based on the Citric DS.
|
|
26
|
+
*/
|
|
27
|
+
export const Toaster = () => <ToastContainer closeButton={CloseButton} className="container-toaster"/>
|
|
28
|
+
|
|
29
|
+
export interface ToasterAction {
|
|
30
|
+
/**
|
|
31
|
+
* The button's label.
|
|
32
|
+
*/
|
|
33
|
+
label: string,
|
|
34
|
+
/**
|
|
35
|
+
* A function to run once the button is clicked.
|
|
36
|
+
*/
|
|
37
|
+
onClick?: (event: React.MouseEvent) => void,
|
|
38
|
+
/**
|
|
39
|
+
* If this is set, instead of a button, an anchor is rendered with this href.
|
|
40
|
+
*/
|
|
41
|
+
href?: string,
|
|
42
|
+
/**
|
|
43
|
+
* Whether or not to close the toaster once the button is clicked.
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
closeOnClick?: boolean,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface ToasterContentProps {
|
|
50
|
+
id: number | string,
|
|
51
|
+
actions?: ToasterAction[],
|
|
52
|
+
onClick?: (event: React.MouseEvent) => void,
|
|
53
|
+
title?: string,
|
|
54
|
+
message: React.ReactNode,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const actionStyle: React.CSSProperties = {
|
|
58
|
+
background: 'transparent',
|
|
59
|
+
border: 'none',
|
|
60
|
+
padding: 0,
|
|
61
|
+
color: 'inherit',
|
|
62
|
+
font: 'inherit',
|
|
63
|
+
fontWeight: 500,
|
|
64
|
+
cursor: 'pointer',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Renders a toaster with the default layout for toasters.
|
|
69
|
+
*/
|
|
70
|
+
export const ToasterContent = ({ id, message, actions, onClick, title }: ToasterContentProps) => {
|
|
71
|
+
const Link = useAnchorTag()
|
|
72
|
+
const buttons = useMemo(() => actions?.map(
|
|
73
|
+
({ label, href, onClick, closeOnClick = true }) => (
|
|
74
|
+
<Text
|
|
75
|
+
key={label}
|
|
76
|
+
as={href ? Link : 'button'}
|
|
77
|
+
href={href}
|
|
78
|
+
style={actionStyle}
|
|
79
|
+
onClick={(event: React.MouseEvent) => {
|
|
80
|
+
onClick?.(event)
|
|
81
|
+
if (closeOnClick) toast.dismiss(id)
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
{label}
|
|
85
|
+
</Text>
|
|
86
|
+
),
|
|
87
|
+
), [actions])
|
|
88
|
+
return (
|
|
89
|
+
<div onClick={onClick}>
|
|
90
|
+
<h2>{title}</h2>
|
|
91
|
+
{typeof message === 'string' ? <p>{message}</p> : message}
|
|
92
|
+
{buttons?.length ? <Flex style={{ gap: '12px', marginTop: '12px' }}>{buttons}</Flex> : null}
|
|
93
|
+
</div>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffectOnce } from '@stack-spot/portal-components'
|
|
2
|
+
import { loadTypeFormScript } from './utils'
|
|
3
|
+
|
|
4
|
+
export function useTypeFormEffect() {
|
|
5
|
+
|
|
6
|
+
const handleInit = async () => {
|
|
7
|
+
await loadTypeFormScript()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
useEffectOnce(() => {
|
|
11
|
+
handleInit()
|
|
12
|
+
})
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Box, Flex } from '@citric/core'
|
|
2
|
+
import { LoadingCircular } from '@citric/ui'
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
export interface TypeFormProps {
|
|
6
|
+
dataTfLive: string,
|
|
7
|
+
hiddenProps?: Record<string, string | number>,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const TypeForm = ({
|
|
11
|
+
dataTfLive,
|
|
12
|
+
hiddenProps,
|
|
13
|
+
}: TypeFormProps) => {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const [isLoading, setIsLoading] = useState(true)
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
(window as any).tf?.load()
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
setIsLoading(false)
|
|
22
|
+
}, 2000)
|
|
23
|
+
}, [])
|
|
24
|
+
|
|
25
|
+
const hiddenPropsString = useMemo(() => {
|
|
26
|
+
if (hiddenProps) {
|
|
27
|
+
return Object.entries(hiddenProps)
|
|
28
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
29
|
+
.join(',')
|
|
30
|
+
}
|
|
31
|
+
}, [hiddenProps])
|
|
32
|
+
|
|
33
|
+
const typeform = useMemo(() => <Box>
|
|
34
|
+
<div
|
|
35
|
+
data-tf-live={dataTfLive}
|
|
36
|
+
data-tf-hidden={hiddenPropsString}
|
|
37
|
+
/>
|
|
38
|
+
</Box>, [dataTfLive, hiddenPropsString])
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Box sx={{ minWidth: '650px', minHeight: '500px' }}>
|
|
42
|
+
{isLoading && <Flex alignItems="center" justifyContent="center" w="12" sx={{ height: '100%' }}>
|
|
43
|
+
<LoadingCircular />
|
|
44
|
+
</Flex>}
|
|
45
|
+
<Box sx={{ opacity: isLoading ? '0' : 1 }}>
|
|
46
|
+
{typeform}
|
|
47
|
+
</Box>
|
|
48
|
+
</Box>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { overlay } from '../../LayoutOverlayManager'
|
|
2
|
+
import { TypeForm, TypeFormProps } from '.'
|
|
3
|
+
|
|
4
|
+
export const showTypeFormModal = ({ title, ...props }: TypeFormProps & { title: string }) => {
|
|
5
|
+
overlay.showModal({
|
|
6
|
+
title: title,
|
|
7
|
+
children: <TypeForm {...props} />,
|
|
8
|
+
size: 'large',
|
|
9
|
+
})
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const loadTypeFormScript = () => new Promise<void>((resolve, reject) => {
|
|
2
|
+
const script = document.createElement('script')
|
|
3
|
+
script.setAttribute('src', '//embed.typeform.com/next/embed.js')
|
|
4
|
+
script.setAttribute('async', 'true')
|
|
5
|
+
script.onload = () => resolve()
|
|
6
|
+
script.onerror = (error) => reject(error)
|
|
7
|
+
document.body.appendChild(script)
|
|
8
|
+
})
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import { Flex, IconBox, LinkBox, Text } from '@citric/core'
|
|
2
2
|
import { ChevronDown } from '@citric/icons'
|
|
3
3
|
import { Avatar } from '@citric/ui'
|
|
4
|
+
import { SelectionList, SelectionListProps } from '@stack-spot/portal-components/SelectionList'
|
|
4
5
|
import { theme } from '@stack-spot/portal-theme'
|
|
5
6
|
import { Dictionary, interpolate, useTranslate } from '@stack-spot/portal-translate'
|
|
6
|
-
import { useState } from 'react'
|
|
7
|
+
import { useEffect, useState } from 'react'
|
|
7
8
|
import { styled } from 'styled-components'
|
|
8
|
-
import {
|
|
9
|
+
import { userMenuManager } from './user-menu-manager'
|
|
9
10
|
|
|
10
11
|
interface Props {
|
|
12
|
+
/**
|
|
13
|
+
* The user name.
|
|
14
|
+
*/
|
|
11
15
|
userName: string,
|
|
16
|
+
/**
|
|
17
|
+
* The user image to show in the user menu.
|
|
18
|
+
*/
|
|
19
|
+
userImage?: string,
|
|
20
|
+
/**
|
|
21
|
+
* The user email.
|
|
22
|
+
*/
|
|
12
23
|
email?: string,
|
|
24
|
+
/**
|
|
25
|
+
* The menu options.
|
|
26
|
+
*/
|
|
13
27
|
options?: SelectionListProps['items'],
|
|
14
28
|
}
|
|
15
29
|
|
|
@@ -57,18 +71,23 @@ const UserMenuBox = styled.div`
|
|
|
57
71
|
}
|
|
58
72
|
`
|
|
59
73
|
|
|
60
|
-
const UserMenuHeader = ({ userName, email }: Omit<Props, 'options'>) => (
|
|
74
|
+
const UserMenuHeader = ({ userName, email, userImage }: Omit<Props, 'options'>) => (
|
|
61
75
|
<div className="user-menu-header">
|
|
62
|
-
<Avatar size="xs">{userName}</Avatar>
|
|
76
|
+
<Avatar size="xs">{userImage ? (<img src={userImage} />) : userName}</Avatar>
|
|
63
77
|
<Text appearance="body1" className="username">{userName}</Text>
|
|
64
78
|
{email && <Text appearance="microtext1" className="email" colorScheme="light.700">{email}</Text>}
|
|
65
79
|
</div>
|
|
66
80
|
)
|
|
67
81
|
|
|
68
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Renders the user menu.
|
|
84
|
+
* @param props the component's props {@link Props}.
|
|
85
|
+
*/
|
|
86
|
+
export const UserMenu = ({ userName, email, options, userImage }: Props) => {
|
|
69
87
|
const t = useTranslate(dictionary)
|
|
70
88
|
const [visible, setVisible] = useState(false)
|
|
71
89
|
|
|
90
|
+
useEffect(() => userMenuManager.subscribe(setVisible), [])
|
|
72
91
|
return (
|
|
73
92
|
<UserMenuBox>
|
|
74
93
|
<LinkBox
|
|
@@ -79,7 +98,12 @@ export const UserMenu = ({ userName, email, options }: Props) => {
|
|
|
79
98
|
aria-label={interpolate(t.accountMenu, [userName])}
|
|
80
99
|
>
|
|
81
100
|
<Flex alignItems="center">
|
|
82
|
-
<Avatar size="xs"
|
|
101
|
+
<Avatar size="xs"
|
|
102
|
+
aria-label={
|
|
103
|
+
interpolate(t.accountMenu, [userName])}>
|
|
104
|
+
{userImage ? (
|
|
105
|
+
<img src={userImage} />
|
|
106
|
+
) : userName}</Avatar>
|
|
83
107
|
<IconBox colorIcon="inverse.500" className="chevron" style={visible ? { transform: 'rotate(180deg)' } : undefined}>
|
|
84
108
|
<ChevronDown />
|
|
85
109
|
</IconBox>
|
|
@@ -90,10 +114,10 @@ export const UserMenu = ({ userName, email, options }: Props) => {
|
|
|
90
114
|
? <SelectionList
|
|
91
115
|
id={USER_MENU_ID}
|
|
92
116
|
visible={visible}
|
|
93
|
-
before={<UserMenuHeader userName={userName} email={email} />}
|
|
117
|
+
before={<UserMenuHeader userName={userName} email={email} userImage={userImage} />}
|
|
94
118
|
items={options!}
|
|
95
119
|
onHide={() => setVisible(false)}
|
|
96
|
-
maxHeight="
|
|
120
|
+
maxHeight="calc(100vh - 70px)"
|
|
97
121
|
/>
|
|
98
122
|
: null
|
|
99
123
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ErrorDescription, ErrorFeedback } from '@stack-spot/portal-components/error'
|
|
1
2
|
import { Component } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import { ErrorDescription, ErrorManager } from './ErrorManager'
|
|
3
|
+
import { ErrorManager } from './ErrorManager'
|
|
4
4
|
|
|
5
5
|
interface State extends ErrorDescription {
|
|
6
6
|
hasError: boolean,
|
|
@@ -10,6 +10,15 @@ interface Props {
|
|
|
10
10
|
children: React.ReactNode,
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* An Error Boundary that renders an ErrorFeedback instead of its content if any of its children throws.
|
|
15
|
+
*
|
|
16
|
+
* To customize what properties are passed to the ErrorFeedback component, setup an error descriptor for the ErrorManager class. If you're
|
|
17
|
+
* using the component `Layout` or `RawLayout`, you can use the property `errorDescriptor`.
|
|
18
|
+
*
|
|
19
|
+
* To run an error handler every time an error is catch by this boundary, setup an error handler for the ErrorManager class. If you're
|
|
20
|
+
* using the component `Layout` or `RawLayout`, you can use the property `onError`.
|
|
21
|
+
*/
|
|
13
22
|
export class ErrorBoundary extends Component<Props, State> {
|
|
14
23
|
constructor(props: Props) {
|
|
15
24
|
super(props)
|
|
@@ -1,31 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
code?: number,
|
|
3
|
-
message?: string,
|
|
4
|
-
debug?: boolean,
|
|
5
|
-
}
|
|
1
|
+
import { ErrorDescription } from '@stack-spot/portal-components/error'
|
|
6
2
|
|
|
7
3
|
export type DescriptionFn = (error: any) => ErrorDescription
|
|
8
4
|
export type ErrorHandler = (error: any) => void
|
|
9
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Setup how the Error Boundaries deal with errors.
|
|
8
|
+
*/
|
|
10
9
|
export class ErrorManager {
|
|
11
10
|
private static descriptionFunction: DescriptionFn = error => ({
|
|
12
11
|
message: error.message || `${error}`,
|
|
13
12
|
})
|
|
14
13
|
private static errorHandler: ErrorHandler | undefined
|
|
15
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Sets a custom logic for generating error messages and codes. Also setups the environment (debug or not).
|
|
17
|
+
* @param fn a function that, given an error, generates its description.
|
|
18
|
+
*/
|
|
16
19
|
static setDescriptionFunction(fn: DescriptionFn) {
|
|
17
20
|
this.descriptionFunction = fn
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Sets a custom error handler, i.e. a function to run every time an error is catch by an ErrorBoundary.
|
|
25
|
+
* @param fn a function that receives the error.
|
|
26
|
+
*/
|
|
20
27
|
static setErrorHandler(handler: ErrorHandler) {
|
|
21
28
|
this.errorHandler = handler
|
|
22
29
|
}
|
|
23
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Uses the error descriptor to describe an error.
|
|
33
|
+
* @param error the error
|
|
34
|
+
* @returns the error description
|
|
35
|
+
*/
|
|
24
36
|
static describe(error: any) {
|
|
25
37
|
return this.descriptionFunction(error)
|
|
26
38
|
}
|
|
27
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Runs the error handler, if any has been setup.
|
|
42
|
+
* @param error the error
|
|
43
|
+
*/
|
|
28
44
|
static runErrorHandler(error: any) {
|
|
29
|
-
|
|
45
|
+
this.errorHandler?.(error)
|
|
30
46
|
}
|
|
31
47
|
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
+
import { ErrorDescription } from '@stack-spot/portal-components/error'
|
|
1
2
|
import { theme } from '@stack-spot/portal-theme'
|
|
2
3
|
import { Component } from 'react'
|
|
3
|
-
import {
|
|
4
|
+
import { ErrorManager } from './ErrorManager'
|
|
4
5
|
|
|
5
6
|
interface State extends ErrorDescription {
|
|
6
7
|
hasError: boolean,
|
|
7
|
-
message?: string,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
children: React.ReactNode,
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* An Error Boundary that doesn't render anything if any of its children throws. If the environment is not production, a small error icon
|
|
16
|
+
* is rendered instead of nothing.
|
|
17
|
+
*
|
|
18
|
+
* To customize how the error is logged, setup an error descriptor for the ErrorManager class. If you're using the component `Layout` or
|
|
19
|
+
* `RawLayout`, you can use the property `errorDescriptor`.
|
|
20
|
+
*
|
|
21
|
+
* To run an error handler every time an error is catch by this boundary, setup an error handler for the ErrorManager class. If you're
|
|
22
|
+
* using the component `Layout` or `RawLayout`, you can use the property `onError`.
|
|
23
|
+
*/
|
|
14
24
|
export class SilentErrorBoundary extends Component<Props, State> {
|
|
15
25
|
constructor(props: Props) {
|
|
16
26
|
super(props)
|