@veracity/vui 2.30.0 → 2.30.1-beta.1
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/cjs/sidemenuV2/theme.d.ts.map +1 -1
- package/dist/cjs/sidemenuV2/theme.js +2 -3
- package/dist/cjs/sidemenuV2/theme.js.map +1 -1
- package/dist/cjs/tutorial/index.d.ts +0 -1
- package/dist/cjs/tutorial/index.d.ts.map +1 -1
- package/dist/cjs/tutorial/index.js +0 -1
- package/dist/cjs/tutorial/index.js.map +1 -1
- package/dist/cjs/tutorial/tutorial.d.ts +1 -1
- package/dist/cjs/tutorial/tutorial.d.ts.map +1 -1
- package/dist/cjs/tutorial/tutorial.js +2 -6
- package/dist/cjs/tutorial/tutorial.js.map +1 -1
- package/dist/cjs/tutorial/tutorial.types.d.ts +14 -2
- package/dist/cjs/tutorial/tutorial.types.d.ts.map +1 -1
- package/dist/cjs/tutorial/tutorialCard.d.ts +1 -1
- package/dist/cjs/tutorial/tutorialCard.d.ts.map +1 -1
- package/dist/cjs/tutorial/tutorialCard.js +5 -5
- package/dist/cjs/tutorial/tutorialCard.js.map +1 -1
- package/dist/cjs/tutorial/tutorialStep.d.ts +1 -1
- package/dist/cjs/tutorial/tutorialStep.d.ts.map +1 -1
- package/dist/cjs/tutorial/tutorialStep.js +1 -1
- package/dist/cjs/tutorial/tutorialStep.js.map +1 -1
- package/dist/esm/sidemenuV2/theme.d.ts.map +1 -1
- package/dist/esm/sidemenuV2/theme.js +2 -3
- package/dist/esm/sidemenuV2/theme.js.map +1 -1
- package/dist/esm/tutorial/index.d.ts +0 -1
- package/dist/esm/tutorial/index.d.ts.map +1 -1
- package/dist/esm/tutorial/index.js +0 -1
- package/dist/esm/tutorial/index.js.map +1 -1
- package/dist/esm/tutorial/tutorial.d.ts +1 -1
- package/dist/esm/tutorial/tutorial.d.ts.map +1 -1
- package/dist/esm/tutorial/tutorial.js +2 -6
- package/dist/esm/tutorial/tutorial.js.map +1 -1
- package/dist/esm/tutorial/tutorial.types.d.ts +14 -2
- package/dist/esm/tutorial/tutorial.types.d.ts.map +1 -1
- package/dist/esm/tutorial/tutorialCard.d.ts +1 -1
- package/dist/esm/tutorial/tutorialCard.d.ts.map +1 -1
- package/dist/esm/tutorial/tutorialCard.js +4 -4
- package/dist/esm/tutorial/tutorialCard.js.map +1 -1
- package/dist/esm/tutorial/tutorialStep.d.ts +1 -1
- package/dist/esm/tutorial/tutorialStep.d.ts.map +1 -1
- package/dist/esm/tutorial/tutorialStep.js +1 -1
- package/dist/esm/tutorial/tutorialStep.js.map +1 -1
- package/dist/tsconfig.legacy.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/sidemenuV2/theme.ts +2 -4
- package/src/tutorial/index.ts +0 -1
- package/src/tutorial/tutorial.tsx +5 -6
- package/src/tutorial/tutorial.types.ts +14 -2
- package/src/tutorial/tutorialCard.tsx +10 -7
- package/src/tutorial/tutorialStep.tsx +6 -4
- package/dist/cjs/tutorial/useTutorial.d.ts +0 -7
- package/dist/cjs/tutorial/useTutorial.d.ts.map +0 -1
- package/dist/cjs/tutorial/useTutorial.js +0 -15
- package/dist/cjs/tutorial/useTutorial.js.map +0 -1
- package/dist/esm/tutorial/useTutorial.d.ts +0 -7
- package/dist/esm/tutorial/useTutorial.d.ts.map +0 -1
- package/dist/esm/tutorial/useTutorial.js +0 -11
- package/dist/esm/tutorial/useTutorial.js.map +0 -1
- package/src/tutorial/useTutorial.ts +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.1-beta.1",
|
|
4
4
|
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
"dist",
|
|
55
55
|
"src"
|
|
56
56
|
]
|
|
57
|
-
}
|
|
57
|
+
}
|
package/src/sidemenuV2/theme.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { colors } from '../theme'
|
|
2
|
-
|
|
3
1
|
const baseStyle = {
|
|
4
2
|
container: {
|
|
5
3
|
display: 'flex',
|
|
@@ -85,10 +83,10 @@ const variants = {
|
|
|
85
83
|
},
|
|
86
84
|
toggleButton: {
|
|
87
85
|
variant: 'tertiaryDark',
|
|
88
|
-
hoverBg:
|
|
86
|
+
hoverBg: 'sandstone.95',
|
|
89
87
|
},
|
|
90
88
|
item: {
|
|
91
|
-
color:
|
|
89
|
+
color: 'darkBlue.main',
|
|
92
90
|
},
|
|
93
91
|
},
|
|
94
92
|
dark: {
|
package/src/tutorial/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { JSXElementConstructor, ReactElement } from 'react'
|
|
|
4
4
|
import { cs } from '../utils'
|
|
5
5
|
import type { CloseEvent, TutorialProps } from './tutorial.types'
|
|
6
6
|
import { TutorialCard } from './tutorialCard'
|
|
7
|
-
import { useTutorial } from './useTutorial'
|
|
8
7
|
|
|
9
8
|
/** Popover Tutorial is used to display information about a new, or existing feature. */
|
|
10
9
|
export function Tutorial({
|
|
@@ -16,17 +15,15 @@ export function Tutorial({
|
|
|
16
15
|
onFinish,
|
|
17
16
|
steps,
|
|
18
17
|
title,
|
|
19
|
-
id,
|
|
20
18
|
placement = 'right',
|
|
21
19
|
showSkipButton,
|
|
20
|
+
isVisible = true,
|
|
21
|
+
includeFinalPage = true,
|
|
22
|
+
useContentTitle = false,
|
|
22
23
|
}: TutorialProps) {
|
|
23
|
-
const { isVisible, setIsVisible, saveDisplayed } = useTutorial(id)
|
|
24
|
-
|
|
25
24
|
const onClose = (e: CloseEvent) => {
|
|
26
|
-
setIsVisible(false)
|
|
27
25
|
if (e === 'dismissed') onDismiss?.()
|
|
28
26
|
if (e === 'finished') onFinish?.()
|
|
29
|
-
saveDisplayed(e)
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
return (
|
|
@@ -41,6 +38,8 @@ export function Tutorial({
|
|
|
41
38
|
showSkipButton={showSkipButton}
|
|
42
39
|
steps={steps}
|
|
43
40
|
title={title}
|
|
41
|
+
includeFinalPage={includeFinalPage}
|
|
42
|
+
useContentTitle={useContentTitle}
|
|
44
43
|
/>
|
|
45
44
|
}
|
|
46
45
|
interactive
|
|
@@ -5,7 +5,7 @@ export type TutorialDataStep = {
|
|
|
5
5
|
/** title of step */
|
|
6
6
|
title: string
|
|
7
7
|
/** Content */
|
|
8
|
-
content?: string
|
|
8
|
+
content?: string | React.ReactNode
|
|
9
9
|
/** Link to page where they can read more */
|
|
10
10
|
readMoreLink?: string
|
|
11
11
|
}
|
|
@@ -35,6 +35,12 @@ export type TutorialProps = {
|
|
|
35
35
|
title: string
|
|
36
36
|
/** Link to page where they can read more */
|
|
37
37
|
readMoreLink?: string
|
|
38
|
+
/** Decides if should show or hide tooltip */
|
|
39
|
+
isVisible?: boolean
|
|
40
|
+
/** Should include last thank you page */
|
|
41
|
+
includeFinalPage?: boolean
|
|
42
|
+
/** Should use dynamic header based on content */
|
|
43
|
+
useContentTitle?: boolean
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
export type TutorialCardProps = {
|
|
@@ -56,6 +62,10 @@ export type TutorialCardProps = {
|
|
|
56
62
|
readMoreLink?: string
|
|
57
63
|
/** Show the Skip button */
|
|
58
64
|
showSkipButton?: boolean
|
|
65
|
+
/** Include the final page */
|
|
66
|
+
includeFinalPage?: boolean
|
|
67
|
+
/** Should use dynamic header based on content */
|
|
68
|
+
useContentTitle?: boolean
|
|
59
69
|
}
|
|
60
70
|
|
|
61
71
|
export type TutorialStepProps = {
|
|
@@ -64,9 +74,11 @@ export type TutorialStepProps = {
|
|
|
64
74
|
/** Title of step */
|
|
65
75
|
title: string
|
|
66
76
|
/** Step content */
|
|
67
|
-
content?: string
|
|
77
|
+
content?: string | React.ReactNode
|
|
68
78
|
/** Link to page where user can read more */
|
|
69
79
|
readMoreLink?: string
|
|
80
|
+
/** Should use dynamic header based on content */
|
|
81
|
+
useContentTitle?: boolean
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
export type TutorialStepWrapper = {
|
|
@@ -15,6 +15,8 @@ export function TutorialCard({
|
|
|
15
15
|
onAction,
|
|
16
16
|
onDismiss,
|
|
17
17
|
onFinish,
|
|
18
|
+
includeFinalPage,
|
|
19
|
+
useContentTitle,
|
|
18
20
|
}: TutorialCardProps) {
|
|
19
21
|
const [steps, setSteps] = useState<TutorialStepWrapper[]>([])
|
|
20
22
|
const [activeStep, setActiveStep] = useState<number>(0)
|
|
@@ -30,12 +32,12 @@ export function TutorialCard({
|
|
|
30
32
|
|
|
31
33
|
if (readMoreLink) finalStep.readMoreLink = readMoreLink
|
|
32
34
|
|
|
33
|
-
setSteps([...s, { step: finalStep, key: propsSteps.length }])
|
|
35
|
+
includeFinalPage ? setSteps([...s, { step: finalStep, key: propsSteps.length }]) : setSteps([...s])
|
|
34
36
|
}
|
|
35
37
|
}, [title, propsSteps])
|
|
36
38
|
|
|
37
39
|
const isStartStep = activeStep === 0
|
|
38
|
-
const isFinalStep = activeStep === propsSteps.length
|
|
40
|
+
const isFinalStep = includeFinalPage ? activeStep === propsSteps.length : activeStep === propsSteps.length - 1
|
|
39
41
|
|
|
40
42
|
return (
|
|
41
43
|
<Card
|
|
@@ -60,7 +62,7 @@ export function TutorialCard({
|
|
|
60
62
|
row
|
|
61
63
|
style={{ WebkitFlexGrow: '0' }}
|
|
62
64
|
>
|
|
63
|
-
<H4 color={tutorialColors.color}>{title}</H4>
|
|
65
|
+
<H4 color={tutorialColors.color}>{useContentTitle ? steps[activeStep]?.step?.title : title}</H4>
|
|
64
66
|
{!isFinalStep && (
|
|
65
67
|
<Button aria-label="close" icon="uiTimes" onClick={onDismiss} scale={2} variant="tertiaryLight" />
|
|
66
68
|
)}
|
|
@@ -73,6 +75,7 @@ export function TutorialCard({
|
|
|
73
75
|
key={s.step.title}
|
|
74
76
|
readMoreLink={s.step.readMoreLink}
|
|
75
77
|
title={s.step.title}
|
|
78
|
+
useContentTitle={useContentTitle}
|
|
76
79
|
/>
|
|
77
80
|
))}
|
|
78
81
|
</Box>
|
|
@@ -116,17 +119,17 @@ export function TutorialCard({
|
|
|
116
119
|
{(showSkipButton || isFinalStep || !!onAction) && (
|
|
117
120
|
<Box alignItems="center" justifyContent="space-between">
|
|
118
121
|
{showSkipButton && !isFinalStep && (
|
|
119
|
-
<Button
|
|
122
|
+
<Button mx={1} onClick={onDismiss} variant="secondaryLight">
|
|
120
123
|
Skip
|
|
121
124
|
</Button>
|
|
122
125
|
)}
|
|
123
126
|
{isFinalStep && (
|
|
124
|
-
<Button
|
|
125
|
-
|
|
127
|
+
<Button mx={1} onClick={onFinish} variant="primaryLight">
|
|
128
|
+
I got it
|
|
126
129
|
</Button>
|
|
127
130
|
)}
|
|
128
131
|
{!!onAction && (
|
|
129
|
-
<Button mr={
|
|
132
|
+
<Button ml={1} mr={showSkipButton || isFinalStep ? 12 : 2} onClick={onAction} variant="primaryLight">
|
|
130
133
|
{actionLabel}
|
|
131
134
|
</Button>
|
|
132
135
|
)}
|
|
@@ -2,11 +2,13 @@ import { Box, H5, v } from '../index'
|
|
|
2
2
|
import { tutorialColors } from './consts'
|
|
3
3
|
import type { TutorialStepProps } from './tutorial.types'
|
|
4
4
|
|
|
5
|
-
export const TutorialStep = ({ active, content, title }: TutorialStepProps) => (
|
|
5
|
+
export const TutorialStep = ({ active, content, title, useContentTitle }: TutorialStepProps) => (
|
|
6
6
|
<v.div className="vui-tutorialStep" hidden={!active} pb={2}>
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
|
|
7
|
+
{!useContentTitle && (
|
|
8
|
+
<H5 color={tutorialColors.color} fontWeight="medium" mb={1}>
|
|
9
|
+
{title}
|
|
10
|
+
</H5>
|
|
11
|
+
)}
|
|
10
12
|
<Box>{content}</Box>
|
|
11
13
|
</v.div>
|
|
12
14
|
)
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CloseEvent } from './tutorial.types';
|
|
2
|
-
export declare const useTutorial: (tutorialId: string) => {
|
|
3
|
-
isVisible: boolean;
|
|
4
|
-
setIsVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
5
|
-
saveDisplayed: (e: CloseEvent) => void;
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=useTutorial.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTutorial.d.ts","sourceRoot":"","sources":["../../../src/tutorial/useTutorial.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,eAAO,MAAM,WAAW,GAAI,YAAY,MAAM;;;uBAQlB,UAAU;CAGrC,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTutorial = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useTutorial = (tutorialId) => {
|
|
6
|
-
const [isVisible, setIsVisible] = (0, react_1.useState)(false);
|
|
7
|
-
const localStorageId = `vuiTutorial-${tutorialId}`;
|
|
8
|
-
(0, react_1.useEffect)(() => {
|
|
9
|
-
setIsVisible(!window.localStorage.getItem(localStorageId));
|
|
10
|
-
}, []);
|
|
11
|
-
const saveDisplayed = (e) => window.localStorage.setItem(localStorageId, e);
|
|
12
|
-
return { isVisible, setIsVisible, saveDisplayed };
|
|
13
|
-
};
|
|
14
|
-
exports.useTutorial = useTutorial;
|
|
15
|
-
//# sourceMappingURL=useTutorial.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTutorial.js","sourceRoot":"","sources":["../../../src/tutorial/useTutorial.ts"],"names":[],"mappings":";;;AAAA,iCAA2C;AAIpC,MAAM,WAAW,GAAG,CAAC,UAAkB,EAAE,EAAE;IAChD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAA;IAC1D,MAAM,cAAc,GAAG,eAAe,UAAU,EAAE,CAAA;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,YAAY,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;IAC5D,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,aAAa,GAAG,CAAC,CAAa,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;IAEvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,CAAA;AACnD,CAAC,CAAA;AAXY,QAAA,WAAW,eAWvB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CloseEvent } from './tutorial.types';
|
|
2
|
-
export declare const useTutorial: (tutorialId: string) => {
|
|
3
|
-
isVisible: boolean;
|
|
4
|
-
setIsVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
5
|
-
saveDisplayed: (e: CloseEvent) => void;
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=useTutorial.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTutorial.d.ts","sourceRoot":"","sources":["../../../src/tutorial/useTutorial.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,eAAO,MAAM,WAAW,GAAI,YAAY,MAAM;;;uBAQlB,UAAU;CAGrC,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
export const useTutorial = (tutorialId) => {
|
|
3
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
4
|
-
const localStorageId = `vuiTutorial-${tutorialId}`;
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
setIsVisible(!window.localStorage.getItem(localStorageId));
|
|
7
|
-
}, []);
|
|
8
|
-
const saveDisplayed = (e) => window.localStorage.setItem(localStorageId, e);
|
|
9
|
-
return { isVisible, setIsVisible, saveDisplayed };
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=useTutorial.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTutorial.js","sourceRoot":"","sources":["../../../src/tutorial/useTutorial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAI3C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAAkB,EAAE,EAAE;IAChD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAA;IAC1D,MAAM,cAAc,GAAG,eAAe,UAAU,EAAE,CAAA;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;IAC5D,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,aAAa,GAAG,CAAC,CAAa,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;IAEvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,CAAA;AACnD,CAAC,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
import type { CloseEvent } from './tutorial.types'
|
|
4
|
-
|
|
5
|
-
export const useTutorial = (tutorialId: string) => {
|
|
6
|
-
const [isVisible, setIsVisible] = useState<boolean>(false)
|
|
7
|
-
const localStorageId = `vuiTutorial-${tutorialId}`
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
setIsVisible(!window.localStorage.getItem(localStorageId))
|
|
11
|
-
}, [])
|
|
12
|
-
|
|
13
|
-
const saveDisplayed = (e: CloseEvent) => window.localStorage.setItem(localStorageId, e)
|
|
14
|
-
|
|
15
|
-
return { isVisible, setIsVisible, saveDisplayed }
|
|
16
|
-
}
|