@kaizen/components 1.61.3 → 1.62.0
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/codemods/README.md +0 -1
- package/dist/cjs/{__containers__/GuidanceBlock/v2 → GuidanceBlock}/GuidanceBlock.cjs +6 -6
- package/dist/cjs/GuidanceBlock/GuidanceBlock.module.scss.cjs +33 -0
- package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +1 -1
- package/dist/cjs/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.cjs +2 -4
- package/dist/cjs/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.cjs +2 -3
- package/dist/cjs/index.cjs +2 -2
- package/dist/esm/{__containers__/GuidanceBlock/v2 → GuidanceBlock}/GuidanceBlock.mjs +6 -6
- package/dist/esm/GuidanceBlock/GuidanceBlock.module.scss.mjs +31 -0
- package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +1 -1
- package/dist/esm/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.mjs +2 -4
- package/dist/esm/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.mjs +2 -3
- package/dist/esm/index.mjs +1 -1
- package/dist/styles.css +1437 -1766
- package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.module.scss +2 -2
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.mdx +2 -2
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.stickersheet.stories.tsx +1 -1
- package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.stories.tsx +1 -1
- package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +5 -1
- package/src/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.scss +8 -2
- package/src/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.tsx +2 -7
- package/src/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.css +5 -0
- package/src/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.tsx +2 -6
- package/src/index.ts +1 -2
- package/codemods/updateGuidanceBlockVariantProp/index.ts +0 -19
- package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.spec.ts +0 -135
- package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.ts +0 -77
- package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.cjs +0 -160
- package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.cjs +0 -33
- package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.cjs +0 -28
- package/dist/cjs/containersV1.cjs +0 -4
- package/dist/cjs/containersV2.cjs +0 -4
- package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.mjs +0 -153
- package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.mjs +0 -31
- package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.mjs +0 -26
- package/dist/esm/containersV1.mjs +0 -1
- package/dist/esm/containersV2.mjs +0 -1
- package/dist/types/__containers__/GuidanceBlock/v2/GuidanceBlock.d.ts +0 -59
- package/dist/types/__containers__/GuidanceBlock/v2/index.d.ts +0 -1
- package/dist/types/__containers__/v1.d.ts +0 -1
- package/dist/types/__containers__/v2.d.ts +0 -1
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss +0 -356
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +0 -82
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.tsx +0 -262
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.mdx +0 -38
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stickersheet.stories.tsx +0 -118
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stories.tsx +0 -152
- package/src/__containers__/GuidanceBlock/v2/index.ts +0 -1
- package/src/__containers__/v1.ts +0 -1
- package/src/__containers__/v2.ts +0 -1
- package/v1/containers/package.json +0 -5
- package/v2/containers/package.json +0 -5
- /package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/index.d.ts +0 -0
- /package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/types.d.ts +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.spec.tsx +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.tsx +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/index.ts +0 -0
- /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/types.ts +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { cleanup, render, waitFor } from "@testing-library/react"
|
|
3
|
-
import userEvent from "@testing-library/user-event"
|
|
4
|
-
import { vi } from "vitest"
|
|
5
|
-
import { Informative } from "~components/Illustration"
|
|
6
|
-
import { GuidanceBlock } from "./GuidanceBlock"
|
|
7
|
-
const user = userEvent.setup()
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
|
|
10
|
-
window.matchMedia = vi.fn().mockImplementation(() => ({
|
|
11
|
-
matches: false,
|
|
12
|
-
media: "",
|
|
13
|
-
onchange: null,
|
|
14
|
-
addListener: vi.fn(),
|
|
15
|
-
removeListener: vi.fn(),
|
|
16
|
-
}))
|
|
17
|
-
|
|
18
|
-
describe("GuidanceBlock", () => {
|
|
19
|
-
afterEach(cleanup)
|
|
20
|
-
|
|
21
|
-
it("calls the action function when action button is clicked", async () => {
|
|
22
|
-
const onAction = vi.fn()
|
|
23
|
-
const { container } = render(
|
|
24
|
-
<GuidanceBlock
|
|
25
|
-
illustration={<Informative alt="" />}
|
|
26
|
-
text={{
|
|
27
|
-
title: "This is the call to action title",
|
|
28
|
-
description:
|
|
29
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis.",
|
|
30
|
-
}}
|
|
31
|
-
actions={{
|
|
32
|
-
primary: { label: "Action!", onClick: onAction },
|
|
33
|
-
}}
|
|
34
|
-
/>
|
|
35
|
-
)
|
|
36
|
-
const actionButton = container.querySelector("button")
|
|
37
|
-
actionButton && (await user.click(actionButton))
|
|
38
|
-
|
|
39
|
-
await waitFor(() => {
|
|
40
|
-
expect(onAction).toHaveBeenCalledTimes(1)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it("has a default title tag of h3", () => {
|
|
45
|
-
const { getByRole } = render(
|
|
46
|
-
<GuidanceBlock
|
|
47
|
-
illustration={<Informative alt="" />}
|
|
48
|
-
text={{
|
|
49
|
-
title: "This is the call to action title",
|
|
50
|
-
description:
|
|
51
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis.",
|
|
52
|
-
}}
|
|
53
|
-
/>
|
|
54
|
-
)
|
|
55
|
-
expect(
|
|
56
|
-
getByRole("heading", {
|
|
57
|
-
level: 3,
|
|
58
|
-
name: "This is the call to action title",
|
|
59
|
-
})
|
|
60
|
-
).toBeInTheDocument()
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it("can allow the user to override the title tag", () => {
|
|
64
|
-
const { getByRole } = render(
|
|
65
|
-
<GuidanceBlock
|
|
66
|
-
illustration={<Informative alt="" />}
|
|
67
|
-
text={{
|
|
68
|
-
title: "This is the call to action title",
|
|
69
|
-
description:
|
|
70
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis.",
|
|
71
|
-
titleTag: "h2",
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
)
|
|
75
|
-
expect(
|
|
76
|
-
getByRole("heading", {
|
|
77
|
-
level: 2,
|
|
78
|
-
name: "This is the call to action title",
|
|
79
|
-
})
|
|
80
|
-
).toBeInTheDocument()
|
|
81
|
-
})
|
|
82
|
-
})
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react"
|
|
2
|
-
import classNames from "classnames"
|
|
3
|
-
import Media from "react-media"
|
|
4
|
-
import { Heading, HeadingProps } from "~components/Heading"
|
|
5
|
-
import { ArrowForwardIcon } from "~components/Icon"
|
|
6
|
-
import { SceneProps, SpotProps } from "~components/Illustration"
|
|
7
|
-
import { Text } from "~components/Text"
|
|
8
|
-
import { Button, ButtonProps } from "~components/__actions__/v2"
|
|
9
|
-
import { Tooltip, TooltipProps } from "~components/__overlays__/Tooltip/v1"
|
|
10
|
-
import styles from "./GuidanceBlock.module.scss"
|
|
11
|
-
|
|
12
|
-
export type ActionProps = ButtonProps & {
|
|
13
|
-
tooltip?: TooltipProps
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type LayoutType = "default" | "inline" | "stacked"
|
|
17
|
-
|
|
18
|
-
type IllustrationType = "spot" | "scene"
|
|
19
|
-
|
|
20
|
-
type TextAlignment = "center" | "left"
|
|
21
|
-
|
|
22
|
-
type GuidanceBlockActions = {
|
|
23
|
-
primary: ActionProps
|
|
24
|
-
secondary?: ActionProps
|
|
25
|
-
dismiss?: {
|
|
26
|
-
onClick: () => void
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
type BaseGuidanceBlockProps = {
|
|
31
|
-
layout?: LayoutType
|
|
32
|
-
illustration: React.ReactElement<SpotProps | SceneProps>
|
|
33
|
-
/*
|
|
34
|
-
* Sets how the width and aspect ratio will respond to the Illustration passed in.
|
|
35
|
-
*/
|
|
36
|
-
illustrationType?: IllustrationType
|
|
37
|
-
|
|
38
|
-
smallScreenTextAlignment?: TextAlignment
|
|
39
|
-
actions?: GuidanceBlockActions
|
|
40
|
-
/*
|
|
41
|
-
* This will still require the secondary object to be passed into the actions ie: {secondary: { label: "Dismiss action" }}`
|
|
42
|
-
*/
|
|
43
|
-
secondaryDismiss?: boolean
|
|
44
|
-
/**
|
|
45
|
-
* If you are migrating from the KAIO v1:
|
|
46
|
-
* - `prominent` is now `expert-advice`
|
|
47
|
-
* - All other variants are removed in favour of `default`
|
|
48
|
-
*/
|
|
49
|
-
variant?: "default" | "expert-advice"
|
|
50
|
-
withActionButtonArrow?: boolean
|
|
51
|
-
noMaxWidth?: boolean
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
type GuidanceBlockWithText = {
|
|
55
|
-
text: {
|
|
56
|
-
title: string
|
|
57
|
-
titleTag?: HeadingProps["tag"]
|
|
58
|
-
description: string | React.ReactNode
|
|
59
|
-
}
|
|
60
|
-
} & BaseGuidanceBlockProps
|
|
61
|
-
|
|
62
|
-
type GuidanceBlockPropsWithContent = {
|
|
63
|
-
content: React.ReactElement
|
|
64
|
-
} & BaseGuidanceBlockProps
|
|
65
|
-
|
|
66
|
-
export type GuidanceBlockProps =
|
|
67
|
-
| GuidanceBlockWithText
|
|
68
|
-
| GuidanceBlockPropsWithContent
|
|
69
|
-
|
|
70
|
-
export type GuidanceBlockState = {
|
|
71
|
-
hidden: boolean
|
|
72
|
-
removed: boolean
|
|
73
|
-
mediaQueryLayout: string
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
type WithTooltipProps = {
|
|
77
|
-
children: React.ReactNode
|
|
78
|
-
tooltipProps?: TooltipProps
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const WithTooltip = ({
|
|
82
|
-
tooltipProps,
|
|
83
|
-
children,
|
|
84
|
-
}: WithTooltipProps): JSX.Element =>
|
|
85
|
-
!!tooltipProps ? (
|
|
86
|
-
<Tooltip {...tooltipProps}>{children}</Tooltip>
|
|
87
|
-
) : (
|
|
88
|
-
<>{children}</>
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093807/Guidance+Block Guidance} |
|
|
93
|
-
* {@link https://cultureamp.design/?path=/docs/components-guidanceblock--docs Storybook}
|
|
94
|
-
*/
|
|
95
|
-
export const GuidanceBlock = ({
|
|
96
|
-
layout = "default",
|
|
97
|
-
variant = "default",
|
|
98
|
-
withActionButtonArrow = true,
|
|
99
|
-
noMaxWidth = false,
|
|
100
|
-
illustrationType = "spot",
|
|
101
|
-
smallScreenTextAlignment = "center",
|
|
102
|
-
actions,
|
|
103
|
-
illustration,
|
|
104
|
-
secondaryDismiss,
|
|
105
|
-
...restProps
|
|
106
|
-
}: GuidanceBlockProps): JSX.Element => {
|
|
107
|
-
const [hidden, setHidden] = useState<boolean>(false)
|
|
108
|
-
const [removed, setRemoved] = useState<boolean>(false)
|
|
109
|
-
const [mediaQueryLayout, setMediaQueryLayout] = useState<string>("")
|
|
110
|
-
|
|
111
|
-
const containerRef = React.createRef<HTMLDivElement>()
|
|
112
|
-
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (layout === "inline" || layout === "stacked") {
|
|
115
|
-
containerQuery()
|
|
116
|
-
}
|
|
117
|
-
}, [])
|
|
118
|
-
|
|
119
|
-
const handleDismissBanner = (): void => {
|
|
120
|
-
setHidden(true)
|
|
121
|
-
actions?.dismiss?.onClick()
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const onTransitionEnd = (e: React.TransitionEvent<HTMLDivElement>): void => {
|
|
125
|
-
// Be careful: this assumes the final CSS property to be animated is "margin-top".
|
|
126
|
-
if (hidden && e.propertyName === "margin-top") {
|
|
127
|
-
setRemoved(true)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const containerQuery = (): void => {
|
|
132
|
-
const resizeObserver = new ResizeObserver(entries => {
|
|
133
|
-
if (entries.length === 1) {
|
|
134
|
-
handleMediaQueryLayout(entries[0].contentRect.width)
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
resizeObserver.observe(containerRef.current as HTMLElement)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const handleMediaQueryLayout = (width: number): void => {
|
|
142
|
-
if (width <= 320) {
|
|
143
|
-
setMediaQueryLayout("centerContent")
|
|
144
|
-
} else {
|
|
145
|
-
setMediaQueryLayout("")
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const marginTop = (): string => {
|
|
150
|
-
if (hidden && containerRef.current) {
|
|
151
|
-
return -containerRef.current.clientHeight + "px"
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return "0"
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (removed) {
|
|
158
|
-
return <></>
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const componentIsMobile = mediaQueryLayout.includes("centerContent")
|
|
162
|
-
|
|
163
|
-
return (
|
|
164
|
-
<div
|
|
165
|
-
className={classNames(
|
|
166
|
-
styles.banner,
|
|
167
|
-
variant && styles[variant],
|
|
168
|
-
layout && styles[layout],
|
|
169
|
-
hidden && styles.hidden,
|
|
170
|
-
mediaQueryLayout === "centerContent" && styles.centerContent,
|
|
171
|
-
noMaxWidth && styles.noMaxWidth,
|
|
172
|
-
illustrationType === "scene" && styles.hasSceneIllustration,
|
|
173
|
-
smallScreenTextAlignment === "left" && styles.smallScreenTextAlignment
|
|
174
|
-
)}
|
|
175
|
-
style={{
|
|
176
|
-
marginTop: marginTop(),
|
|
177
|
-
}}
|
|
178
|
-
ref={containerRef}
|
|
179
|
-
onTransitionEnd={onTransitionEnd}
|
|
180
|
-
>
|
|
181
|
-
<div className={styles.illustrationWrapper}>
|
|
182
|
-
<div className={styles.illustration}>
|
|
183
|
-
{illustrationType === "scene"
|
|
184
|
-
? React.cloneElement(illustration, { enableAspectRatio: true })
|
|
185
|
-
: illustration}
|
|
186
|
-
</div>
|
|
187
|
-
</div>
|
|
188
|
-
<div className={styles.descriptionAndActions}>
|
|
189
|
-
<div className={styles.descriptionContainer}>
|
|
190
|
-
{"content" in restProps && restProps.content}
|
|
191
|
-
{"text" in restProps && (
|
|
192
|
-
<>
|
|
193
|
-
<div className={styles.headingWrapper}>
|
|
194
|
-
<Heading
|
|
195
|
-
tag={restProps?.text?.titleTag ?? "h3"}
|
|
196
|
-
variant="heading-3"
|
|
197
|
-
>
|
|
198
|
-
{restProps?.text?.title}
|
|
199
|
-
</Heading>
|
|
200
|
-
</div>
|
|
201
|
-
<Text tag="p" variant="body">
|
|
202
|
-
{restProps?.text?.description}
|
|
203
|
-
</Text>
|
|
204
|
-
</>
|
|
205
|
-
)}
|
|
206
|
-
</div>
|
|
207
|
-
{actions?.primary && (
|
|
208
|
-
<Media query="(max-width: 767px)">
|
|
209
|
-
{(isMobile: boolean): JSX.Element => (
|
|
210
|
-
<div
|
|
211
|
-
className={classNames({
|
|
212
|
-
noRightMargin: isMobile || componentIsMobile,
|
|
213
|
-
rightMargin:
|
|
214
|
-
!(isMobile || componentIsMobile) && layout === "default",
|
|
215
|
-
})}
|
|
216
|
-
>
|
|
217
|
-
<div
|
|
218
|
-
className={classNames(
|
|
219
|
-
styles.buttonContainer,
|
|
220
|
-
actions?.secondary && styles.secondaryAction
|
|
221
|
-
)}
|
|
222
|
-
>
|
|
223
|
-
<WithTooltip tooltipProps={actions.primary.tooltip}>
|
|
224
|
-
<Button
|
|
225
|
-
icon={
|
|
226
|
-
withActionButtonArrow ? (
|
|
227
|
-
<ArrowForwardIcon role="presentation" />
|
|
228
|
-
) : undefined
|
|
229
|
-
}
|
|
230
|
-
iconPosition="end"
|
|
231
|
-
{...actions.primary}
|
|
232
|
-
fullWidth={isMobile || componentIsMobile}
|
|
233
|
-
/>
|
|
234
|
-
</WithTooltip>
|
|
235
|
-
|
|
236
|
-
{actions?.secondary && (
|
|
237
|
-
<WithTooltip tooltipProps={actions.secondary.tooltip}>
|
|
238
|
-
<div className={styles.secondaryAction}>
|
|
239
|
-
<Button
|
|
240
|
-
secondary
|
|
241
|
-
{...actions.secondary}
|
|
242
|
-
onClick={
|
|
243
|
-
secondaryDismiss
|
|
244
|
-
? (): void => handleDismissBanner()
|
|
245
|
-
: actions?.secondary?.onClick
|
|
246
|
-
}
|
|
247
|
-
fullWidth={isMobile || componentIsMobile}
|
|
248
|
-
/>
|
|
249
|
-
</div>
|
|
250
|
-
</WithTooltip>
|
|
251
|
-
)}
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
)}
|
|
255
|
-
</Media>
|
|
256
|
-
)}
|
|
257
|
-
</div>
|
|
258
|
-
</div>
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
GuidanceBlock.displayName = "GuidanceBlock"
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Canvas, Controls, DocsStory, Meta } from "@storybook/blocks"
|
|
2
|
-
import { ResourceLinks, KAIOInstallation } from "~storybook/components"
|
|
3
|
-
import * as GuidanceBlockStories from "./GuidanceBlock.stories"
|
|
4
|
-
|
|
5
|
-
<Meta of={GuidanceBlockStories} />
|
|
6
|
-
|
|
7
|
-
# GuidanceBlock (V2)
|
|
8
|
-
|
|
9
|
-
<ResourceLinks
|
|
10
|
-
sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/GuidanceBlock"
|
|
11
|
-
figma="https://www.figma.com/file/ZRfnoNUXbGZv4eVWLbF4Az/%EF%B8%8F%F0%9F%96%BC%EF%B8%8F-Component-Gallery?node-id=622%3A149926&t=P1w10jr2cpPuaayw-1"
|
|
12
|
-
designGuidelines="https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093807/Guidance+Block"
|
|
13
|
-
|
|
14
|
-
/>
|
|
15
|
-
|
|
16
|
-
<KAIOInstallation exportNames="GuidanceBlock" version="2" family="containers" />
|
|
17
|
-
|
|
18
|
-
## Overview
|
|
19
|
-
|
|
20
|
-
A Guidance Block provides a familiar layout that is visually prominent to draw attention to related content.
|
|
21
|
-
It guides people to new actions they haven't done before or connects them to relevant content they can view on another page.
|
|
22
|
-
|
|
23
|
-
<Canvas of={GuidanceBlockStories.Playground} />
|
|
24
|
-
<Controls of={GuidanceBlockStories.Playground} />
|
|
25
|
-
|
|
26
|
-
## API
|
|
27
|
-
|
|
28
|
-
<DocsStory of={GuidanceBlockStories.Actions} />
|
|
29
|
-
|
|
30
|
-
<DocsStory of={GuidanceBlockStories.Tooltip} />
|
|
31
|
-
|
|
32
|
-
<DocsStory of={GuidanceBlockStories.CustomContent} />
|
|
33
|
-
|
|
34
|
-
<DocsStory of={GuidanceBlockStories.Stacked} />
|
|
35
|
-
|
|
36
|
-
<DocsStory of={GuidanceBlockStories.SceneExample} />
|
|
37
|
-
|
|
38
|
-
<DocsStory of={GuidanceBlockStories.Variants} />
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { Meta } from "@storybook/react"
|
|
3
|
-
import { Heading } from "~components/Heading"
|
|
4
|
-
import { EmptyStatesPositive, Informative } from "~components/Illustration"
|
|
5
|
-
import { Tag } from "~components/Tag"
|
|
6
|
-
import { Text } from "~components/Text"
|
|
7
|
-
import {
|
|
8
|
-
StickerSheet,
|
|
9
|
-
StickerSheetStory,
|
|
10
|
-
} from "~storybook/components/StickerSheet"
|
|
11
|
-
import { GuidanceBlock, GuidanceBlockProps } from "../index"
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: "Containers/GuidanceBlock/v2",
|
|
15
|
-
parameters: {
|
|
16
|
-
chromatic: { disable: false },
|
|
17
|
-
controls: { disable: true },
|
|
18
|
-
},
|
|
19
|
-
} satisfies Meta
|
|
20
|
-
|
|
21
|
-
const GENERIC_PROPS = {
|
|
22
|
-
persistent: true,
|
|
23
|
-
illustration: <Informative alt="" />,
|
|
24
|
-
actions: {
|
|
25
|
-
primary: {
|
|
26
|
-
label: "Action",
|
|
27
|
-
onClick: () => {
|
|
28
|
-
alert("tada: 🎉")
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
secondary: {
|
|
32
|
-
label: "Pass",
|
|
33
|
-
onClick: () => {
|
|
34
|
-
alert("tada: 🎉")
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const TEXT_PROPS: GuidanceBlockProps = {
|
|
41
|
-
...GENERIC_PROPS,
|
|
42
|
-
text: {
|
|
43
|
-
title: "This is the Guidance block title",
|
|
44
|
-
description:
|
|
45
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis, " +
|
|
46
|
-
"qui tem lupuliz, matis, aguis e fermentis. Mé faiz elementum girarzis, nisi eros vermeio.",
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const CONTENT_PROPS: GuidanceBlockProps = {
|
|
51
|
-
...GENERIC_PROPS,
|
|
52
|
-
content: (
|
|
53
|
-
<>
|
|
54
|
-
<Tag>Early Access</Tag>
|
|
55
|
-
<Heading variant="heading-3">{TEXT_PROPS.text.title}</Heading>
|
|
56
|
-
<Text variant="body">{TEXT_PROPS.text.description}</Text>
|
|
57
|
-
</>
|
|
58
|
-
),
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const StickerSheetTemplate: StickerSheetStory = {
|
|
62
|
-
render: ({ isReversed }) => (
|
|
63
|
-
<StickerSheet isReversed={isReversed}>
|
|
64
|
-
<StickerSheet.Body>
|
|
65
|
-
<StickerSheet.Row rowTitle="Default">
|
|
66
|
-
<GuidanceBlock {...TEXT_PROPS} />
|
|
67
|
-
</StickerSheet.Row>
|
|
68
|
-
<StickerSheet.Row rowTitle="Expert advice">
|
|
69
|
-
<GuidanceBlock variant="expert-advice" {...TEXT_PROPS} />
|
|
70
|
-
</StickerSheet.Row>
|
|
71
|
-
<StickerSheet.Row rowTitle="No arrow">
|
|
72
|
-
<GuidanceBlock withActionButtonArrow={false} {...TEXT_PROPS} />
|
|
73
|
-
</StickerSheet.Row>
|
|
74
|
-
<StickerSheet.Row rowTitle="Custom Content">
|
|
75
|
-
<GuidanceBlock {...CONTENT_PROPS} />
|
|
76
|
-
</StickerSheet.Row>
|
|
77
|
-
<StickerSheet.Row rowTitle="Tooltip">
|
|
78
|
-
<GuidanceBlock
|
|
79
|
-
{...TEXT_PROPS}
|
|
80
|
-
actions={{
|
|
81
|
-
primary: {
|
|
82
|
-
...GENERIC_PROPS.actions.primary,
|
|
83
|
-
tooltip: {
|
|
84
|
-
text: "Opens in a new tab",
|
|
85
|
-
mood: "cautionary",
|
|
86
|
-
isInitiallyVisible: true,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
</StickerSheet.Row>
|
|
92
|
-
<StickerSheet.Row rowTitle="Scene Illustration">
|
|
93
|
-
<GuidanceBlock
|
|
94
|
-
{...TEXT_PROPS}
|
|
95
|
-
illustration={<EmptyStatesPositive alt="" />}
|
|
96
|
-
illustrationType="scene"
|
|
97
|
-
/>
|
|
98
|
-
</StickerSheet.Row>
|
|
99
|
-
<StickerSheet.Row rowTitle="No Max Width">
|
|
100
|
-
<GuidanceBlock {...TEXT_PROPS} noMaxWidth />
|
|
101
|
-
</StickerSheet.Row>
|
|
102
|
-
</StickerSheet.Body>
|
|
103
|
-
</StickerSheet>
|
|
104
|
-
),
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const StickerSheetDefault: StickerSheetStory = {
|
|
108
|
-
...StickerSheetTemplate,
|
|
109
|
-
name: "Sticker Sheet (Default)",
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export const StickerSheetRTL: StickerSheetStory = {
|
|
113
|
-
...StickerSheetTemplate,
|
|
114
|
-
name: "Sticker Sheet (RTL)",
|
|
115
|
-
parameters: {
|
|
116
|
-
textDirection: "rtl",
|
|
117
|
-
},
|
|
118
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
3
|
-
import { Heading } from "~components/Heading"
|
|
4
|
-
import {
|
|
5
|
-
BrandMomentPositiveOutro,
|
|
6
|
-
Informative,
|
|
7
|
-
SkillsCoachEssentialFeedback,
|
|
8
|
-
} from "~components/Illustration"
|
|
9
|
-
import { Text } from "~components/Text"
|
|
10
|
-
import { GuidanceBlock } from "../index"
|
|
11
|
-
|
|
12
|
-
const ContentComponent = (): JSX.Element => (
|
|
13
|
-
<>
|
|
14
|
-
<Heading tag="h3" variant="heading-3">
|
|
15
|
-
This is the Guidance block title
|
|
16
|
-
</Heading>
|
|
17
|
-
<Text variant="body">
|
|
18
|
-
Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite
|
|
19
|
-
divinis,
|
|
20
|
-
</Text>
|
|
21
|
-
</>
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
const defaultText = {
|
|
25
|
-
description:
|
|
26
|
-
"Mussum Ipsum, cacilds vidis litro abertis. Suco de cevadiss, é um leite divinis, qui tem lupuliz, matis, aguis e fermentis. Mé faiz elementum girarzis, nisi eros vermeio.",
|
|
27
|
-
title: "This is the Guidance block title",
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const meta = {
|
|
31
|
-
title: "Containers/GuidanceBlock/v2",
|
|
32
|
-
component: GuidanceBlock,
|
|
33
|
-
args: {
|
|
34
|
-
layout: "default",
|
|
35
|
-
illustration: <Informative alt="" />,
|
|
36
|
-
},
|
|
37
|
-
argTypes: {
|
|
38
|
-
actions: {
|
|
39
|
-
control: false,
|
|
40
|
-
},
|
|
41
|
-
illustrationType: {
|
|
42
|
-
description:
|
|
43
|
-
"Sets the how the width and aspect ratio will respond to the Illustration passed in.",
|
|
44
|
-
},
|
|
45
|
-
illustration: {
|
|
46
|
-
control: { type: "radio" },
|
|
47
|
-
options: ["spot", "scene"],
|
|
48
|
-
mapping: {
|
|
49
|
-
spot: <Informative alt="" />,
|
|
50
|
-
scene: <BrandMomentPositiveOutro alt="" />,
|
|
51
|
-
},
|
|
52
|
-
description:
|
|
53
|
-
"This takes a scene scene or spot element, ie: `<Informative />`. This radio button implementation is a storybook only representation to toggle between the two illustration styles.",
|
|
54
|
-
},
|
|
55
|
-
content: {
|
|
56
|
-
description:
|
|
57
|
-
"If you need to render custom content inside of the `GuidanceBlock` that is more than just a title and description use this prop instead of the default `text` option.",
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
} satisfies Meta<typeof GuidanceBlock>
|
|
61
|
-
|
|
62
|
-
export default meta
|
|
63
|
-
|
|
64
|
-
type Story = StoryObj<typeof meta>
|
|
65
|
-
|
|
66
|
-
export const Playground: Story = {
|
|
67
|
-
args: {
|
|
68
|
-
text: defaultText,
|
|
69
|
-
},
|
|
70
|
-
parameters: {
|
|
71
|
-
docs: {
|
|
72
|
-
canvas: {
|
|
73
|
-
sourceState: "shown",
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export const Actions: Story = {
|
|
80
|
-
args: {
|
|
81
|
-
content: <ContentComponent />,
|
|
82
|
-
actions: {
|
|
83
|
-
primary: {
|
|
84
|
-
label: "Learn more",
|
|
85
|
-
onClick: () => alert("tada: 🎉"),
|
|
86
|
-
},
|
|
87
|
-
secondary: {
|
|
88
|
-
label: "Dismiss",
|
|
89
|
-
href: "#",
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export const Tooltip: Story = {
|
|
96
|
-
args: {
|
|
97
|
-
content: <ContentComponent />,
|
|
98
|
-
actions: {
|
|
99
|
-
primary: {
|
|
100
|
-
label: "Hover me for a tooltip",
|
|
101
|
-
onClick: () => alert("tada: 🎉"),
|
|
102
|
-
tooltip: {
|
|
103
|
-
text: "Opens in a new tab",
|
|
104
|
-
mood: "cautionary",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
secondary: {
|
|
108
|
-
label: "Dismiss",
|
|
109
|
-
href: "#",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export const CustomContent: Story = {
|
|
116
|
-
args: {
|
|
117
|
-
content: <ContentComponent />,
|
|
118
|
-
},
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export const Stacked: Story = {
|
|
122
|
-
render: args => (
|
|
123
|
-
<div style={{ display: "flex", gap: "36px" }}>
|
|
124
|
-
<GuidanceBlock {...args} />
|
|
125
|
-
<GuidanceBlock {...args} />
|
|
126
|
-
</div>
|
|
127
|
-
),
|
|
128
|
-
args: {
|
|
129
|
-
layout: "stacked",
|
|
130
|
-
content: <ContentComponent />,
|
|
131
|
-
},
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export const SceneExample: Story = {
|
|
135
|
-
args: {
|
|
136
|
-
illustration: <SkillsCoachEssentialFeedback alt="" />,
|
|
137
|
-
illustrationType: "scene",
|
|
138
|
-
text: defaultText,
|
|
139
|
-
},
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export const Variants: Story = {
|
|
143
|
-
render: args => (
|
|
144
|
-
<div className="flex flex-col gap-16">
|
|
145
|
-
<GuidanceBlock {...args} />
|
|
146
|
-
<GuidanceBlock variant="expert-advice" {...args} />
|
|
147
|
-
</div>
|
|
148
|
-
),
|
|
149
|
-
args: {
|
|
150
|
-
text: defaultText,
|
|
151
|
-
},
|
|
152
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./GuidanceBlock"
|
package/src/__containers__/v1.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./GuidanceBlock/v1"
|
package/src/__containers__/v2.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./GuidanceBlock/v2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|