@stack-spot/portal-layout 0.0.62 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Layout.d.ts +3 -3
- package/dist/Layout.d.ts.map +1 -1
- package/dist/Layout.js +9 -6
- package/dist/Layout.js.map +1 -1
- package/dist/components/menu/MenuContent.d.ts +545 -2
- package/dist/components/menu/MenuContent.d.ts.map +1 -1
- package/dist/components/tour/PortalSwitcherStep.d.ts +3 -0
- package/dist/components/tour/PortalSwitcherStep.d.ts.map +1 -0
- package/dist/components/tour/PortalSwitcherStep.js +29 -0
- package/dist/components/tour/PortalSwitcherStep.js.map +1 -0
- package/dist/components/tour/StepContainer.d.ts +13 -0
- package/dist/components/tour/StepContainer.d.ts.map +1 -0
- package/dist/components/tour/StepContainer.js +48 -0
- package/dist/components/tour/StepContainer.js.map +1 -0
- package/dist/components/tour/StepNavigation.d.ts +13 -0
- package/dist/components/tour/StepNavigation.d.ts.map +1 -0
- package/dist/components/tour/StepNavigation.js +20 -0
- package/dist/components/tour/StepNavigation.js.map +1 -0
- package/dist/components/tour/StepTitle.d.ts +7 -0
- package/dist/components/tour/StepTitle.d.ts.map +1 -0
- package/dist/components/tour/StepTitle.js +5 -0
- package/dist/components/tour/StepTitle.js.map +1 -0
- package/dist/components/tour/config.d.ts +2 -2
- package/dist/components/tour/config.d.ts.map +1 -1
- package/dist/components/tour/config.js +5 -14
- package/dist/components/tour/config.js.map +1 -1
- package/dist/components/tour/context.d.ts +17 -0
- package/dist/components/tour/context.d.ts.map +1 -0
- package/dist/components/tour/context.js +48 -0
- package/dist/components/tour/context.js.map +1 -0
- package/dist/components/tour/index.d.ts +4 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +4 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/steps/PortalSwitcherStep.d.ts +1 -2
- package/dist/components/tour/steps/PortalSwitcherStep.d.ts.map +1 -1
- package/dist/components/tour/steps/PortalSwitcherStep.js +15 -16
- package/dist/components/tour/steps/PortalSwitcherStep.js.map +1 -1
- package/dist/components/tour/utils.d.ts +12 -8
- package/dist/components/tour/utils.d.ts.map +1 -1
- package/dist/components/tour/utils.js +28 -33
- package/dist/components/tour/utils.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/Layout.tsx +11 -8
- package/src/components/tour/PortalSwitcherStep.tsx +36 -0
- package/src/index.ts +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/src/components/tour/Navigation.tsx +0 -29
- package/src/components/tour/config.tsx +0 -23
- package/src/components/tour/steps/PortalSwitcherStep.tsx +0 -47
- package/src/components/tour/utils.tsx +0 -58
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Box, Image, Text } from '@citric/core'
|
|
2
|
+
import { TourStep, tourStepBuilder } from '@stack-spot/portal-components'
|
|
3
|
+
import { useTranslate } from '@stack-spot/portal-translate'
|
|
4
|
+
export const usePortalSwitcherStep = (): TourStep => {
|
|
5
|
+
const t = useTranslate(translations)
|
|
6
|
+
return tourStepBuilder({
|
|
7
|
+
selector: '.portal-switcher',
|
|
8
|
+
title: t.title,
|
|
9
|
+
content: <>
|
|
10
|
+
<Image src="https://marketing.stackspot.com/switch-v2.gif" alt={t.imageAlt} />
|
|
11
|
+
<Box px={5} py={3}>
|
|
12
|
+
<Text appearance="microtext1" colorScheme="inverse.contrastText">{t.description}</Text>
|
|
13
|
+
</Box>
|
|
14
|
+
</>,
|
|
15
|
+
position: 'right',
|
|
16
|
+
style: {
|
|
17
|
+
width: '300px',
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const translations = {
|
|
26
|
+
en: {
|
|
27
|
+
title: 'Expand Your Horizons with Stackspot',
|
|
28
|
+
description: 'Easily switch between EDP and AI to enhance your projects. Access a wide range of resources with just one click and take your projects to a new level of efficiency. Start your journey now!',
|
|
29
|
+
imageAlt: 'GIF describing how to use product switcher and navigate between AI and EDP portals',
|
|
30
|
+
},
|
|
31
|
+
pt: {
|
|
32
|
+
title: 'Expanda Seus Horizontes com Stackspot',
|
|
33
|
+
description: 'Troque facilmente entre EDP e AI para aprimorar seus projetos. Acesse uma ampla gama de recursos com apenas um clique e leve seus projetos para um novo nível de eficiência. Comece sua jornada agora!',
|
|
34
|
+
imageAlt: 'GIF mostrando como usar o alternador de produtos e navegar entre os portais AI e EDP',
|
|
35
|
+
},
|
|
36
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,6 @@ export { Toaster } from './components/Toaster'
|
|
|
9
9
|
export { ActionItem, MenuContent, MenuGroup, Title } from './components/menu/MenuContent'
|
|
10
10
|
export { MenuSections } from './components/menu/MenuSections'
|
|
11
11
|
export * from './components/menu/types'
|
|
12
|
-
export { TextWithPointingArrow } from './components/tour/utils'
|
|
13
12
|
export * from './components/types'
|
|
14
13
|
export * from './elements'
|
|
15
14
|
export * from './errors'
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ProviderProps } from '@reactour/tour';
|
|
2
|
-
import '@stack-spot/portal-theme/dist/theme.css';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
type ComponentsDict = Exclude<ProviderProps['components'], undefined>;
|
|
5
|
-
type NavigationProps = React.ComponentProps<Exclude<ComponentsDict['Navigation'], undefined>>;
|
|
6
|
-
export declare const CustomNavigation: ({ currentStep, steps, setCurrentStep }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=Navigation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.d.ts","sourceRoot":"","sources":["../../../src/components/tour/Navigation.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,yCAAyC,CAAA;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,KAAK,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAA;AACrE,KAAK,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;AAE7F,eAAO,MAAM,gBAAgB,2CAA4C,eAAe,4CAiBvF,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Flex, Text } from '@citric/core';
|
|
3
|
-
import '@stack-spot/portal-theme/dist/theme.css';
|
|
4
|
-
import { useTranslate } from '@stack-spot/portal-translate';
|
|
5
|
-
import { finishTour } from './utils.js';
|
|
6
|
-
export const CustomNavigation = ({ currentStep, steps, setCurrentStep }) => {
|
|
7
|
-
const t = useTranslate({ en: { of: 'of', back: 'back' }, pt: { of: 'de', back: 'voltar' } });
|
|
8
|
-
return _jsxs(Flex, { w: 12, px: 5, py: 2, mt: "-1px", bg: "inverse.500", justifyContent: "space-between", children: [_jsxs(Text, { appearance: "microtext1", colorScheme: "inverse.contrastText", children: [currentStep + 1, " ", t.of, " ", steps.length] }), _jsxs(Flex, { sx: { gap: '8px' }, children: [currentStep > 1 &&
|
|
9
|
-
_jsx(Button, { sx: { paddingInline: '20px' }, onClick: () => setCurrentStep(currentStep - 1), size: "sm", colorScheme: "light", children: t.back }), _jsx(Button, { sx: { paddingInline: '20px' }, onClick: () => {
|
|
10
|
-
if (currentStep + 1 == steps.length)
|
|
11
|
-
finishTour();
|
|
12
|
-
setCurrentStep(currentStep + 1);
|
|
13
|
-
}, size: "sm", colorScheme: "light", children: "ok" })] })] });
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=Navigation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.js","sourceRoot":"","sources":["../../../src/components/tour/Navigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,yCAAyC,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAmB,EAAE,EAAE;IAC1F,MAAM,CAAC,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;IAC5F,OAAO,MAAC,IAAI,IAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAC,MAAM,EAAC,EAAE,EAAC,aAAa,EAAC,cAAc,EAAC,eAAe,aACzF,MAAC,IAAI,IAAC,UAAU,EAAC,YAAY,EAAC,WAAW,EAAC,sBAAsB,aAAE,WAAW,GAAG,CAAC,OAAG,CAAC,CAAC,EAAE,OAAG,KAAK,CAAC,MAAM,IAAQ,EAC/G,MAAC,IAAI,IAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,aACrB,WAAW,GAAG,CAAC;wBACd,KAAC,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE,IAAI,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,YACjH,CAAC,CAAC,IAAI,GACA,EACX,KAAC,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;4BACnD,IAAI,WAAW,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM;gCAAE,UAAU,EAAE,CAAA;4BACjD,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;wBACjC,CAAC,EAAE,IAAI,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,mBAEvB,IACJ,IACF,CAAA;AACT,CAAC,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Button, Flex, Text } from '@citric/core'
|
|
2
|
-
import { ProviderProps } from '@reactour/tour'
|
|
3
|
-
import '@stack-spot/portal-theme/dist/theme.css'
|
|
4
|
-
import { useTranslate } from '@stack-spot/portal-translate'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
import { finishTour } from './utils'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type ComponentsDict = Exclude<ProviderProps['components'], undefined>
|
|
10
|
-
type NavigationProps = React.ComponentProps<Exclude<ComponentsDict['Navigation'], undefined>>
|
|
11
|
-
|
|
12
|
-
export const CustomNavigation = ({ currentStep, steps, setCurrentStep }: NavigationProps) => {
|
|
13
|
-
const t = useTranslate({ en: { of: 'of', back: 'back' }, pt: { of: 'de', back: 'voltar' } })
|
|
14
|
-
return <Flex w={12} px={5} py={2} mt="-1px" bg="inverse.500" justifyContent="space-between">
|
|
15
|
-
<Text appearance="microtext1" colorScheme="inverse.contrastText">{currentStep + 1} {t.of} {steps.length}</Text>
|
|
16
|
-
<Flex sx={{ gap: '8px' }}>
|
|
17
|
-
{currentStep > 1 &&
|
|
18
|
-
<Button sx={{ paddingInline: '20px' }} onClick={() => setCurrentStep(currentStep - 1)} size="sm" colorScheme="light">
|
|
19
|
-
{t.back}
|
|
20
|
-
</Button>}
|
|
21
|
-
<Button sx={{ paddingInline: '20px' }} onClick={() => {
|
|
22
|
-
if (currentStep + 1 == steps.length) finishTour()
|
|
23
|
-
setCurrentStep(currentStep + 1)
|
|
24
|
-
}} size="sm" colorScheme="light">
|
|
25
|
-
ok
|
|
26
|
-
</Button>
|
|
27
|
-
</Flex>
|
|
28
|
-
</Flex>
|
|
29
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ProviderProps } from '@reactour/tour'
|
|
2
|
-
import { CustomNavigation } from './Navigation'
|
|
3
|
-
import { hasFinishedTour } from './utils'
|
|
4
|
-
|
|
5
|
-
export const defaultTourConfig: () => Omit<ProviderProps, 'children'> = () => ({
|
|
6
|
-
steps: [],
|
|
7
|
-
defaultOpen: !hasFinishedTour(),
|
|
8
|
-
showBadge: false,
|
|
9
|
-
showDots: false,
|
|
10
|
-
showPrevNextButtons: false,
|
|
11
|
-
showCloseButton: false,
|
|
12
|
-
styles: {
|
|
13
|
-
popover: (props) => ({
|
|
14
|
-
...props,
|
|
15
|
-
boxShadow: 'unset',
|
|
16
|
-
backgroundColor: 'transparent',
|
|
17
|
-
padding: '0px 14px', // TODO: find a way to make paddings on y axis so it's possible to use the the pointing arrow.
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
components: {
|
|
21
|
-
Navigation: CustomNavigation,
|
|
22
|
-
},
|
|
23
|
-
})
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Box, Button, Flex, IconBox, Image, Text } from '@citric/core'
|
|
2
|
-
import { TimesMini } from '@citric/icons'
|
|
3
|
-
import { StepType, useTour } from '@reactour/tour'
|
|
4
|
-
import { useTranslate } from '@stack-spot/portal-translate'
|
|
5
|
-
import { TextWithPointingArrow, finishTour } from '../utils'
|
|
6
|
-
|
|
7
|
-
const PortalSwitcherStep = () => {
|
|
8
|
-
const t = useTranslate(translations)
|
|
9
|
-
const { setIsOpen } = useTour()
|
|
10
|
-
return <Box bg="inverse.500">
|
|
11
|
-
<TextWithPointingArrow $position="right">
|
|
12
|
-
<Flex w={12} pl={5} py={3} flexWrap="nowrap" justifyContent="space-between" alignItems="center">
|
|
13
|
-
<Text appearance="body2" colorScheme="inverse.contrastText" weight="medium"> {t.title} </Text>
|
|
14
|
-
<Button appearance="text" size="sm" onClick={() => {
|
|
15
|
-
finishTour()
|
|
16
|
-
setIsOpen(false)
|
|
17
|
-
}}>
|
|
18
|
-
<IconBox size="xs" colorIcon="inverse.contrastText">
|
|
19
|
-
<TimesMini />
|
|
20
|
-
</IconBox>
|
|
21
|
-
</Button>
|
|
22
|
-
</Flex>
|
|
23
|
-
</TextWithPointingArrow>
|
|
24
|
-
<Image src="https://marketing.stackspot.com/switch-v2.gif"
|
|
25
|
-
alt="GIF showing how to move from one portal to another" />
|
|
26
|
-
<Box px={5} py={3}>
|
|
27
|
-
<Text appearance="microtext1" colorScheme="inverse.contrastText">{t.description}</Text>
|
|
28
|
-
</Box>
|
|
29
|
-
</Box >
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const portalSwitcherStep: StepType = {
|
|
33
|
-
selector: '.portal-switcher',
|
|
34
|
-
content: PortalSwitcherStep,
|
|
35
|
-
position: 'right',
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const translations = {
|
|
39
|
-
en: {
|
|
40
|
-
title: 'Expand Your Horizons with Stackspot',
|
|
41
|
-
description: 'Easily switch between EDP and AI to enhance your projects. Access a wide range of resources with just one click and take your projects to a new level of efficiency. Start your journey now!',
|
|
42
|
-
},
|
|
43
|
-
pt: {
|
|
44
|
-
title: 'Expanda Seus Horizontes com Stackspot',
|
|
45
|
-
description: 'Troque facilmente entre EDP e AI para aprimorar seus projetos. Acesse uma ampla gama de recursos com apenas um clique e leve seus projetos para um novo nível de eficiência. Comece sua jornada agora!',
|
|
46
|
-
},
|
|
47
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { theme } from '@stack-spot/portal-theme'
|
|
2
|
-
import styled from 'styled-components'
|
|
3
|
-
|
|
4
|
-
export const TextWithPointingArrow = styled.div < {
|
|
5
|
-
$position: 'right' | 'top' | 'left',
|
|
6
|
-
$top?: string,
|
|
7
|
-
$right?: string,
|
|
8
|
-
} > `
|
|
9
|
-
position: relative;
|
|
10
|
-
width: 100%;
|
|
11
|
-
&::after {
|
|
12
|
-
content: '';
|
|
13
|
-
position: absolute;
|
|
14
|
-
border-width: 10px;
|
|
15
|
-
border-style: solid;
|
|
16
|
-
border-color: transparent;
|
|
17
|
-
margin-top: -5px;
|
|
18
|
-
border-right-color: ${theme.color.inverse[500]};
|
|
19
|
-
${({ $position, $top }) => $position === 'right' ?
|
|
20
|
-
`
|
|
21
|
-
top: ${$top || '16px'};
|
|
22
|
-
left: -18px;
|
|
23
|
-
` : ''}
|
|
24
|
-
${({ $position, $right }) => $position === 'top' ?
|
|
25
|
-
`
|
|
26
|
-
bottom: 96%;
|
|
27
|
-
right: ${$right || '16px'};
|
|
28
|
-
transform: rotate(90deg);
|
|
29
|
-
` : ''}
|
|
30
|
-
${({ $position, $top }) => $position === 'left' ?
|
|
31
|
-
`
|
|
32
|
-
top: ${$top || '16px'};
|
|
33
|
-
right: -18px;
|
|
34
|
-
transform: rotate(180deg);
|
|
35
|
-
` : ''}
|
|
36
|
-
}
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
const DOMAIN_REGEX = new RegExp(/(\.*(prd|stg|dev)*.stackspot.com)|localhost/)
|
|
40
|
-
const portalUrl = new URL(location.href)
|
|
41
|
-
const cookieDomain = DOMAIN_REGEX.exec(portalUrl.host)?.[0]
|
|
42
|
-
const defaultCookieAttributes = `domain=${cookieDomain}; SameSite=Strict;`
|
|
43
|
-
|
|
44
|
-
const getCookies = (): Record<string, string> => document.cookie.split('; ').reduce((prev, current) => {
|
|
45
|
-
const [name, ...value] = current.split('=')
|
|
46
|
-
prev[name] = value.join('=')
|
|
47
|
-
return prev
|
|
48
|
-
}, {} as Record<string, string>)
|
|
49
|
-
|
|
50
|
-
const setCookie = (key: string, value: string) => {
|
|
51
|
-
document.cookie = `${key}=${value}; ${defaultCookieAttributes}`
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const getCookie = (key: string) => getCookies()[key]
|
|
55
|
-
|
|
56
|
-
export const finishTour = () => setCookie('welcomeTour', 'done')
|
|
57
|
-
|
|
58
|
-
export const hasFinishedTour = () => !!getCookie('welcomeTour')
|