@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,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { theme } from '@stack-spot/portal-theme';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { StepNavigation } from './StepNavigation.js';
|
|
5
|
+
import { StepTitle } from './StepTitle.js';
|
|
6
|
+
import { useTour } from './context.js';
|
|
7
|
+
export const StepContainer = ({ title, stepKey, customNavigation, position, children }) => {
|
|
8
|
+
const { finishStep } = useTour();
|
|
9
|
+
return _jsxs(BoxWithPointingArrow, { "$position": position, children: [_jsx(StepTitle, { title: title, onClose: () => finishStep(stepKey) }), children, _jsx(StepNavigation, { stepKey: stepKey, ...(customNavigation || {}) })] });
|
|
10
|
+
};
|
|
11
|
+
const BoxWithPointingArrow = styled.div `
|
|
12
|
+
position: relative;
|
|
13
|
+
width: 100%;
|
|
14
|
+
background-color: ${theme.color.inverse[500]};
|
|
15
|
+
&::after {
|
|
16
|
+
content: '';
|
|
17
|
+
position: absolute;
|
|
18
|
+
border-width: 10px;
|
|
19
|
+
border-style: solid;
|
|
20
|
+
border-color: transparent;
|
|
21
|
+
margin-top: -5px;
|
|
22
|
+
border-right-color: ${theme.color.inverse[500]};
|
|
23
|
+
${({ $position, $top }) => $position === 'right' ?
|
|
24
|
+
`
|
|
25
|
+
top: ${$top || '16px'};
|
|
26
|
+
left: -18px;
|
|
27
|
+
` : ''}
|
|
28
|
+
${({ $position, $right }) => $position === 'top' ?
|
|
29
|
+
`
|
|
30
|
+
bottom: 96%;
|
|
31
|
+
right: ${$right || '16px'};
|
|
32
|
+
transform: rotate(90deg);
|
|
33
|
+
` : ''}
|
|
34
|
+
${({ $position, $top }) => $position === 'left' ?
|
|
35
|
+
`
|
|
36
|
+
top: ${$top || '16px'};
|
|
37
|
+
right: -18px;
|
|
38
|
+
transform: rotate(180deg);
|
|
39
|
+
` : ''}
|
|
40
|
+
${({ $position, $right }) => $position === 'bottom' ?
|
|
41
|
+
`
|
|
42
|
+
top: -13px;
|
|
43
|
+
right: ${$right || '16px'};
|
|
44
|
+
transform: rotate(90deg);
|
|
45
|
+
` : ''}
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
//# sourceMappingURL=StepContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepContainer.js","sourceRoot":"","sources":["../../../src/components/tour/StepContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAEhD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAmB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAUnC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAsB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NavigationButton = {
|
|
3
|
+
text: string;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type NavigationProps = {
|
|
7
|
+
stepKey: string;
|
|
8
|
+
nextButton?: CustomNavigationButton;
|
|
9
|
+
prevButton?: CustomNavigationButton;
|
|
10
|
+
};
|
|
11
|
+
export declare const StepNavigation: ({ stepKey, nextButton, prevButton }: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=StepNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/tour/StepNavigation.tsx"],"names":[],"mappings":"AACA,OAAO,yCAAyC,CAAA;AAKhD,KAAK,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;AACpE,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,sBAAsB,CAAC;IAAC,UAAU,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAE3H,eAAO,MAAM,cAAc,wCAAyC,eAAe,4CAsBlF,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { useTour } from './context.js';
|
|
6
|
+
import { finishTourStep } from './utils.js';
|
|
7
|
+
export const StepNavigation = ({ stepKey, nextButton, prevButton }) => {
|
|
8
|
+
const { currentStep, steps, nextStep, prevStep } = useTour();
|
|
9
|
+
const t = useTranslate({ en: { of: 'of', back: 'back' }, pt: { of: 'de', back: 'voltar' } });
|
|
10
|
+
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 &&
|
|
11
|
+
_jsx(Button, { sx: { paddingInline: '20px' }, onClick: () => {
|
|
12
|
+
prevStep?.();
|
|
13
|
+
prevButton?.onClick?.();
|
|
14
|
+
}, size: "sm", colorScheme: "light", children: prevButton?.text || t.back }), _jsx(Button, { sx: { paddingInline: '20px' }, onClick: () => {
|
|
15
|
+
nextButton?.onClick?.();
|
|
16
|
+
nextStep?.();
|
|
17
|
+
finishTourStep(stepKey);
|
|
18
|
+
}, size: "sm", colorScheme: "light", children: nextButton?.text || 'ok' })] })] });
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=StepNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepNavigation.js","sourceRoot":"","sources":["../../../src/components/tour/StepNavigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,yCAAyC,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKxC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAmB,EAAE,EAAE;IACrF,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAA;IAC5D,MAAM,CAAC,GAAG,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAA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Title.tsx"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,SAAS,uBAAwB,cAAc,4CAQnD,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Flex, IconBox, Text } from '@citric/core';
|
|
3
|
+
import { TimesMini } from '@citric/icons';
|
|
4
|
+
export const StepTitle = ({ title, onClose }) => _jsxs(Flex, { w: 12, pl: 5, py: 3, flexWrap: "nowrap", justifyContent: "space-between", alignItems: "center", children: [_jsxs(Text, { appearance: "body2", colorScheme: "inverse.contrastText", weight: "medium", children: [" ", title, " "] }), _jsx(Button, { appearance: "text", size: "sm", onClick: () => onClose?.(), sx: { ':hover': { borderColor: 'transparent !important' } }, children: _jsx(IconBox, { size: "xs", colorIcon: "inverse.contrastText", children: _jsx(TimesMini, {}) }) })] });
|
|
5
|
+
//# sourceMappingURL=StepTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepTitle.js","sourceRoot":"","sources":["../../../src/components/tour/StepTitle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAOzC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAkB,EAAE,EAAE,CAC9D,MAAC,IAAI,IAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe,EAAC,UAAU,EAAC,QAAQ,aAC7F,MAAC,IAAI,IAAC,UAAU,EAAC,OAAO,EAAC,WAAW,EAAC,sBAAsB,EAAC,MAAM,EAAC,QAAQ,kBAAG,KAAK,SAAS,EAC5F,KAAC,MAAM,IAAC,UAAU,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,EAAE,YACzH,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,sBAAsB,YACjD,KAAC,SAAS,KAAG,GACL,GACH,IACJ,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const defaultTourConfig: () => Omit<
|
|
1
|
+
import { ReactourProps } from 'reactour';
|
|
2
|
+
export declare const defaultTourConfig: () => Omit<ReactourProps, 'children'>;
|
|
3
3
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/components/tour/config.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/components/tour/config.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,iBAAiB,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,UAAU,CAWlE,CAAA"}
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import { CustomNavigation } from './Navigation.js';
|
|
2
|
-
import { hasFinishedTour } from './utils.js';
|
|
3
1
|
export const defaultTourConfig = () => ({
|
|
4
2
|
steps: [],
|
|
5
|
-
|
|
3
|
+
isOpen: true,
|
|
4
|
+
onRequestClose: console.log,
|
|
6
5
|
showBadge: false,
|
|
7
6
|
showDots: false,
|
|
8
7
|
showPrevNextButtons: false,
|
|
9
8
|
showCloseButton: false,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
boxShadow: 'unset',
|
|
14
|
-
backgroundColor: 'transparent',
|
|
15
|
-
padding: '0px 14px', // TODO: find a way to make paddings on y axis so it's possible to use the the pointing arrow.
|
|
16
|
-
}),
|
|
17
|
-
},
|
|
18
|
-
components: {
|
|
19
|
-
Navigation: CustomNavigation,
|
|
20
|
-
},
|
|
9
|
+
showNavigation: false,
|
|
10
|
+
showButtons: false,
|
|
11
|
+
showNumber: false,
|
|
21
12
|
});
|
|
22
13
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/components/tour/config.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/components/tour/config.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAA0C,GAAG,EAAE,CAAC,CAAC;IAC7E,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,OAAO,CAAC,GAAG;IAC3B,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,KAAK;IAC1B,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ReactourProps } from 'reactour';
|
|
3
|
+
type TourConfig = Omit<ReactourProps, 'children'>;
|
|
4
|
+
export declare const defaultTourConfig: TourConfig;
|
|
5
|
+
export declare const TourProvider: ({ config, children }: {
|
|
6
|
+
config: TourConfig;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useTour: () => {
|
|
10
|
+
currentStep: number;
|
|
11
|
+
nextStep: (() => void) | undefined;
|
|
12
|
+
prevStep: (() => void) | undefined;
|
|
13
|
+
steps: import("reactour").ReactourStep[];
|
|
14
|
+
finishStep: (stepKey: string) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/components/tour/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAuC,MAAM,OAAO,CAAA;AACtE,OAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAG9C,KAAK,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;AAEjD,eAAO,MAAM,iBAAiB,EAAE,UAU9B,CAAA;AAOF,eAAO,MAAM,YAAY;YAAoC,UAAU;cAAY,SAAS;6CAkB3F,CAAA;AAED,eAAO,MAAM,OAAO;;;;;0BAOM,MAAM;CAK/B,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from 'react';
|
|
3
|
+
import Tour from 'reactour';
|
|
4
|
+
import { finishTourStep } from './utils.js';
|
|
5
|
+
export const defaultTourConfig = Object.freeze({
|
|
6
|
+
steps: [],
|
|
7
|
+
isOpen: true,
|
|
8
|
+
onRequestClose: () => '',
|
|
9
|
+
showButtons: false,
|
|
10
|
+
showNavigation: false,
|
|
11
|
+
showNavigationNumber: false,
|
|
12
|
+
showNumber: false,
|
|
13
|
+
showCloseButton: false,
|
|
14
|
+
disableFocusLock: true,
|
|
15
|
+
});
|
|
16
|
+
const TourContext = createContext({
|
|
17
|
+
tourConfig: defaultTourConfig,
|
|
18
|
+
currentStep: 0,
|
|
19
|
+
});
|
|
20
|
+
export const TourProvider = ({ config, children }) => {
|
|
21
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
22
|
+
const tourConfig = {
|
|
23
|
+
...config,
|
|
24
|
+
goToStep: currentStep,
|
|
25
|
+
update: `${currentStep}`,
|
|
26
|
+
nextStep: () => setCurrentStep(currentStep + 1),
|
|
27
|
+
prevStep: () => setCurrentStep(currentStep - 1),
|
|
28
|
+
isOpen: !!config.steps.length && (currentStep < config.steps.length),
|
|
29
|
+
};
|
|
30
|
+
return _jsxs(TourContext.Provider, { value: {
|
|
31
|
+
currentStep,
|
|
32
|
+
tourConfig,
|
|
33
|
+
}, children: [_jsx(Tour, { ...tourConfig }), children] });
|
|
34
|
+
};
|
|
35
|
+
export const useTour = () => {
|
|
36
|
+
const { currentStep, tourConfig: { nextStep, prevStep, steps } } = useContext(TourContext);
|
|
37
|
+
return {
|
|
38
|
+
currentStep,
|
|
39
|
+
nextStep,
|
|
40
|
+
prevStep,
|
|
41
|
+
steps,
|
|
42
|
+
finishStep: (stepKey) => {
|
|
43
|
+
finishTourStep(stepKey);
|
|
44
|
+
nextStep?.();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/tour/context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtE,OAAO,IAAuB,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,MAAM,CAAC,MAAM,iBAAiB,GAAe,MAAM,CAAC,MAAM,CAAC;IACzD,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE;IACxB,WAAW,EAAE,KAAK;IAClB,cAAc,EAAE,KAAK;IACrB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,KAAK;IACjB,eAAe,EAAE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A;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/tour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortalSwitcherStep.d.ts","sourceRoot":"","sources":["../../../../src/components/tour/steps/PortalSwitcherStep.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PortalSwitcherStep.d.ts","sourceRoot":"","sources":["../../../../src/components/tour/steps/PortalSwitcherStep.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,uCAgBjC,CAAA"}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Box,
|
|
3
|
-
import { TimesMini } from '@citric/icons';
|
|
4
|
-
import { useTour } from '@reactour/tour';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Image, Text } from '@citric/core';
|
|
5
3
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
4
|
+
import { tourStepBuilder } from '../utils.js';
|
|
5
|
+
export const usePortalSwitcherStep = () => {
|
|
8
6
|
const t = useTranslate(translations);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
position: 'right',
|
|
7
|
+
return tourStepBuilder({
|
|
8
|
+
selector: '.portal-switcher',
|
|
9
|
+
title: t.title,
|
|
10
|
+
content: _jsxs(_Fragment, { children: [_jsx(Image, { src: "https://marketing.stackspot.com/switch-v2.gif", alt: t.imageAlt }), _jsx(Box, { px: 5, py: 3, children: _jsx(Text, { appearance: "microtext1", colorScheme: "inverse.contrastText", children: t.description }) })] }),
|
|
11
|
+
position: 'right',
|
|
12
|
+
style: {
|
|
13
|
+
width: '300px',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
19
16
|
};
|
|
20
17
|
const translations = {
|
|
21
18
|
en: {
|
|
22
19
|
title: 'Expand Your Horizons with Stackspot',
|
|
23
20
|
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!',
|
|
21
|
+
imageAlt: 'GIF describing how to use product switcher and navigate between AI and EDP portals',
|
|
24
22
|
},
|
|
25
23
|
pt: {
|
|
26
24
|
title: 'Expanda Seus Horizontes com Stackspot',
|
|
27
25
|
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!',
|
|
26
|
+
imageAlt: 'GIF mostrando como usar o alternador de produtos e navegar entre os portais AI e EDP',
|
|
28
27
|
},
|
|
29
28
|
};
|
|
30
29
|
//# sourceMappingURL=PortalSwitcherStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortalSwitcherStep.js","sourceRoot":"","sources":["../../../../src/components/tour/steps/PortalSwitcherStep.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"PortalSwitcherStep.js","sourceRoot":"","sources":["../../../../src/components/tour/steps/PortalSwitcherSt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ationProps } from './StepNavigation.js';
|
|
4
|
+
export declare const finishTourStep: (key: string) => void;
|
|
5
|
+
export declare const isNewTourStep: (step: ReactourStep) => boolean;
|
|
6
|
+
export declare const hasFinishedTourStep: (key: string) => boolean;
|
|
7
|
+
export declare const tourStepBuilder: ({ selector, position, title, content, style, customNavigation, ...rest }: ReactourStep & {
|
|
8
|
+
title: string;
|
|
9
|
+
selector: string;
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
customNavigation?: NavigationProps | undefined;
|
|
12
|
+
}) => ReactourStep;
|
|
9
13
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/tour/utils.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/tour/utils.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAyBlD,eAAO,MAAM,cAAc,QAAS,MAAM,SAIzC,CAAA;AAED,eAAO,MAAM,aAAa,SAAU,YAAY,YAA6C,CAAA;AAC7F,eAAO,MAAM,mBAAmB,QAAS,MAAM,YAAkC,CAAA;AAEjF,eAAO,MAAM,eAAe;WAQD,MAAM;cAAY,MAAM;aAAW,SAAS;;MAAyC,YAkB9G,CAAA"}
|
|
@@ -1,35 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { theme } from '@stack-spot/portal-theme';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
position: relative;
|
|
5
|
-
width: 100%;
|
|
6
|
-
&::after {
|
|
7
|
-
content: '';
|
|
8
|
-
position: absolute;
|
|
9
|
-
border-width: 10px;
|
|
10
|
-
border-style: solid;
|
|
11
|
-
border-color: transparent;
|
|
12
|
-
margin-top: -5px;
|
|
13
|
-
border-right-color: ${theme.color.inverse[500]};
|
|
14
|
-
${({ $position, $top }) => $position === 'right' ?
|
|
15
|
-
`
|
|
16
|
-
top: ${$top || '16px'};
|
|
17
|
-
left: -18px;
|
|
18
|
-
` : ''}
|
|
19
|
-
${({ $position, $right }) => $position === 'top' ?
|
|
20
|
-
`
|
|
21
|
-
bottom: 96%;
|
|
22
|
-
right: ${$right || '16px'};
|
|
23
|
-
transform: rotate(90deg);
|
|
24
|
-
` : ''}
|
|
25
|
-
${({ $position, $top }) => $position === 'left' ?
|
|
26
|
-
`
|
|
27
|
-
top: ${$top || '16px'};
|
|
28
|
-
right: -18px;
|
|
29
|
-
transform: rotate(180deg);
|
|
30
|
-
` : ''}
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
3
|
+
import { StepContainer } from './StepContainer.js';
|
|
4
|
+
const TOUR_COOKIE = 'guided-tour-global';
|
|
33
5
|
const DOMAIN_REGEX = new RegExp(/(\.*(prd|stg|dev)*.stackspot.com)|localhost/);
|
|
34
6
|
const portalUrl = new URL(location.href);
|
|
35
7
|
const cookieDomain = DOMAIN_REGEX.exec(portalUrl.host)?.[0];
|
|
@@ -43,6 +15,29 @@ const setCookie = (key, value) => {
|
|
|
43
15
|
document.cookie = `${key}=${value}; ${defaultCookieAttributes}`;
|
|
44
16
|
};
|
|
45
17
|
const getCookie = (key) => getCookies()[key];
|
|
46
|
-
|
|
47
|
-
|
|
18
|
+
const getTourCookie = () => {
|
|
19
|
+
const currentTourObject = getCookie(TOUR_COOKIE);
|
|
20
|
+
return currentTourObject ? currentTourObject.split(',') : [];
|
|
21
|
+
};
|
|
22
|
+
export const finishTourStep = (key) => {
|
|
23
|
+
const tourObject = getTourCookie();
|
|
24
|
+
if (!tourObject.includes(key))
|
|
25
|
+
tourObject.push(key);
|
|
26
|
+
setCookie(TOUR_COOKIE, tourObject.toString());
|
|
27
|
+
};
|
|
28
|
+
export const isNewTourStep = (step) => !hasFinishedTourStep(`${step.selector}`);
|
|
29
|
+
export const hasFinishedTourStep = (key) => getTourCookie().includes(key);
|
|
30
|
+
export const tourStepBuilder = ({ selector, position, title, content, style, customNavigation, ...rest }) => ({
|
|
31
|
+
selector,
|
|
32
|
+
content: (_jsx(StepContainer, { stepKey: selector, position: position, title: title, customNavigation: customNavigation, children: content })),
|
|
33
|
+
position,
|
|
34
|
+
style: {
|
|
35
|
+
backgroundColor: theme.color.inverse[500],
|
|
36
|
+
width: '256px',
|
|
37
|
+
padding: 0,
|
|
38
|
+
top: ['right', 'left'].includes(position) ? '-3px' : '0',
|
|
39
|
+
...(style || {}),
|
|
40
|
+
},
|
|
41
|
+
...(rest || {}),
|
|
42
|
+
});
|
|
48
43
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/tour/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/tour/utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAGhD,OAAO,EAAyB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAGtE,MAAM,WAAW,GAAG,oBAAoB,CAAA;AACxC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,6CAA6C,CAAC,CAAA;AAC9E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACxC,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC3D,MAAM,uBAAuB,GAAG,UAAU,YAAY,oBAAoB,CAAA;AAE1E,MAAM,UAAU,GAAG,GAA2B,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,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AM,mBAAmB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,gBAAgB,EAChB,GAAG,IAAI,EACoG,EAAgB,EAAE,CAAC,CAAC;IAC/H,QAAQ;IACR,OAAO,EAAE,CAAC,KAAC,aAAa,IACtB,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,QAAiC,EAC3C,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,YACjC,OAAO,GACM,CAAC;IACjB,QAAQ;IACR,KAAK,EAAE;QACL,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACzC,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAiC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG;QACjF,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;KACjB;IACD,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;CAChB,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export { Toaster } from './components/Toaster.js';
|
|
|
9
9
|
export { ActionItem, MenuContent, MenuGroup, Title } from './components/menu/MenuContent.js';
|
|
10
10
|
export { MenuSections } from './components/menu/MenuSections.js';
|
|
11
11
|
export * from './components/menu/types.js';
|
|
12
|
-
export { TextWithPointingArrow } from './components/tour/utils.js';
|
|
13
12
|
export * from './components/types.js';
|
|
14
13
|
export * from './elements.js';
|
|
15
14
|
export * from './errors.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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S,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAC7D,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAClD,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ export { Toaster } from './components/Toaster.js';
|
|
|
9
9
|
export { ActionItem, MenuContent, MenuGroup, Title } from './components/menu/MenuContent.js';
|
|
10
10
|
export { MenuSections } from './components/menu/MenuSections.js';
|
|
11
11
|
export * from './components/menu/types.js';
|
|
12
|
-
export { TextWithPointingArrow } from './components/tour/utils.js';
|
|
13
12
|
export * from './components/types.js';
|
|
14
13
|
export * from './elements.js';
|
|
15
14
|
export * from './errors.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAc,aAAa,EAAsB,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAC7D,cAAc,yBAAyB,CAAA;AACvC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAc,aAAa,EAAsB,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAC7D,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAClD,cAAc,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/portal-layout",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc && tsc-esm-fix --target='dist' && cpy src/layout.css dist --flat",
|
|
9
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
10
|
+
},
|
|
7
11
|
"peerDependencies": {
|
|
8
12
|
"@citric/core": ">=6.0.0",
|
|
9
13
|
"@citric/icons": ">=5.7.1",
|
|
10
14
|
"@citric/ui": ">=5.7.2",
|
|
11
|
-
"@reactour/tour": ">=3.6.2",
|
|
12
15
|
"@stack-spot/portal-theme": ">=0.0.11",
|
|
13
16
|
"@stack-spot/portal-translate": ">=0.0.6",
|
|
17
|
+
"@stack-spot/portal-components": ">=0.0.17",
|
|
14
18
|
"react": ">=18.2.0",
|
|
15
19
|
"react-dom": ">=18.2.0",
|
|
16
20
|
"styled-components": ">=6.1.1"
|
|
@@ -34,9 +38,5 @@
|
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
40
|
"react-toastify": "^9.1.3"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsc && tsc-esm-fix --target='dist' && cpy src/layout.css dist --flat",
|
|
40
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/Layout.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TourProps, TourProvider, defaultTourConfig, isNewTourStep } from '@stack-spot/portal-components'
|
|
2
2
|
import { CSSToCitricAdapter, WithStyle, listToClass } from '@stack-spot/portal-theme'
|
|
3
3
|
import '@stack-spot/portal-theme/dist/theme.css'
|
|
4
4
|
import { ReactElement, ReactNode, useEffect } from 'react'
|
|
@@ -11,8 +11,7 @@ import { SilentErrorBoundary } from './components/error/SilentErrorBoundary'
|
|
|
11
11
|
import { MenuContent } from './components/menu/MenuContent'
|
|
12
12
|
import { MenuSections } from './components/menu/MenuSections'
|
|
13
13
|
import { MenuProps } from './components/menu/types'
|
|
14
|
-
import {
|
|
15
|
-
import { portalSwitcherStep } from './components/tour/steps/PortalSwitcherStep'
|
|
14
|
+
import { usePortalSwitcherStep } from './components/tour/PortalSwitcherStep'
|
|
16
15
|
import { elementIds, getLayoutElements } from './elements'
|
|
17
16
|
import { LayoutContext, LayoutProvider } from './layout-context'
|
|
18
17
|
import './layout.css'
|
|
@@ -24,7 +23,7 @@ interface Props extends WithStyle, LayoutContext {
|
|
|
24
23
|
extra?: ReactNode,
|
|
25
24
|
errorDescriptor?: DescriptionFn,
|
|
26
25
|
onError?: ErrorHandler,
|
|
27
|
-
tourProps?:
|
|
26
|
+
tourProps?: TourProps,
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
interface RawProps extends WithStyle, LayoutContext {
|
|
@@ -35,7 +34,7 @@ interface RawProps extends WithStyle, LayoutContext {
|
|
|
35
34
|
extra?: ReactNode,
|
|
36
35
|
errorDescriptor?: DescriptionFn,
|
|
37
36
|
onError?: ErrorHandler,
|
|
38
|
-
tourProps?:
|
|
37
|
+
tourProps?: TourProps,
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
export const RawLayout = (
|
|
@@ -47,6 +46,7 @@ export const RawLayout = (
|
|
|
47
46
|
const { bottomDialog, modal, rightPanel } = overlay.useOverlays()
|
|
48
47
|
const { layout } = getLayoutElements()
|
|
49
48
|
const isCompactedOnlyIcons = layout?.classList.contains('menu-compact')
|
|
49
|
+
const portalSwitcherStep = usePortalSwitcherStep()
|
|
50
50
|
|
|
51
51
|
const classes = [
|
|
52
52
|
menuContent && !isCompactedOnlyIcons ? 'menu-content-visible' : undefined,
|
|
@@ -55,8 +55,11 @@ export const RawLayout = (
|
|
|
55
55
|
isCompactedOnlyIcons ? 'menu-compact' : undefined,
|
|
56
56
|
]
|
|
57
57
|
|
|
58
|
-
const tourPropsWithDefaults = { ...defaultTourConfig
|
|
59
|
-
tourPropsWithDefaults.steps
|
|
58
|
+
const tourPropsWithDefaults = { ...defaultTourConfig, ...(tourProps || {}) }
|
|
59
|
+
tourPropsWithDefaults.steps = [
|
|
60
|
+
portalSwitcherStep,
|
|
61
|
+
...tourPropsWithDefaults.steps,
|
|
62
|
+
].filter(isNewTourStep)
|
|
60
63
|
|
|
61
64
|
useEffect(() => {
|
|
62
65
|
if (errorDescriptor) ErrorManager.setDescriptionFunction(errorDescriptor)
|
|
@@ -66,7 +69,7 @@ export const RawLayout = (
|
|
|
66
69
|
return (
|
|
67
70
|
<CSSToCitricAdapter>
|
|
68
71
|
<LayoutProvider anchorTag={anchorTag}>
|
|
69
|
-
<TourProvider {
|
|
72
|
+
<TourProvider config={tourPropsWithDefaults} >
|
|
70
73
|
<div id={elementIds.layout} className={listToClass(classes)} style={style}>
|
|
71
74
|
{children && <div id={elementIds.page}>
|
|
72
75
|
<article id={elementIds.content}><ErrorBoundary>{children}</ErrorBoundary></article>
|