@kaizen/components 1.74.3 → 1.75.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.
Files changed (32) hide show
  1. package/bin/codemod.sh +1 -0
  2. package/codemods/README.md +6 -0
  3. package/codemods/migrateGuidanceBlockActionsToActionsSlot/index.ts +21 -0
  4. package/codemods/migrateGuidanceBlockActionsToActionsSlot/migrateGuidanceBlockActionsToActionsSlot.spec.ts +122 -0
  5. package/codemods/migrateGuidanceBlockActionsToActionsSlot/migrateGuidanceBlockActionsToActionsSlot.ts +102 -0
  6. package/codemods/migrateGuidanceBlockActionsToActionsSlot/transformActionsToActionsSlot.spec.ts +196 -0
  7. package/codemods/migrateGuidanceBlockActionsToActionsSlot/transformActionsToActionsSlot.ts +71 -0
  8. package/codemods/utils/createProp.ts +1 -1
  9. package/codemods/utils/index.ts +1 -0
  10. package/codemods/utils/transformV1ButtonPropsToButtonOrLinkButton.spec.tsx +199 -0
  11. package/codemods/utils/transformV1ButtonPropsToButtonOrLinkButton.ts +195 -0
  12. package/dist/cjs/GuidanceBlock/GuidanceBlock.cjs +49 -84
  13. package/dist/cjs/GuidanceBlock/GuidanceBlock.module.css.cjs +0 -2
  14. package/dist/esm/GuidanceBlock/GuidanceBlock.mjs +50 -84
  15. package/dist/esm/GuidanceBlock/GuidanceBlock.module.css.mjs +0 -2
  16. package/dist/styles.css +1117 -1126
  17. package/dist/types/GuidanceBlock/GuidanceBlock.d.ts +8 -4
  18. package/package.json +4 -5
  19. package/src/GuidanceBlock/GuidanceBlock.module.css +0 -9
  20. package/src/GuidanceBlock/GuidanceBlock.tsx +48 -87
  21. package/src/GuidanceBlock/_docs/GuidanceBlock--migration-guide.mdx +77 -0
  22. package/src/GuidanceBlock/_docs/GuidanceBlock.mdx +35 -6
  23. package/src/GuidanceBlock/_docs/GuidanceBlock.stickersheet.stories.tsx +60 -27
  24. package/src/GuidanceBlock/_docs/GuidanceBlock.stories.tsx +205 -4
  25. package/src/Notification/InlineNotification/_docs/InlineNotification.stories.tsx +1 -0
  26. package/src/Workflow/_docs/ProgressStepper.stickersheet.stories.tsx +1 -1
  27. package/src/Workflow/_docs/ProgressStepper.stories.tsx +1 -1
  28. package/src/Workflow/_docs/Workflow.stories.tsx +1 -1
  29. package/src/Workflow/_docs/WorkflowFooter.stories.tsx +1 -1
  30. package/src/Workflow/_docs/WorkflowHeader.stories.tsx +1 -1
  31. package/src/__next__/Button/_docs/Button--migration-guide.mdx +3 -3
  32. package/src/__next__/Tag/Tag/_docs/Tag.stories.tsx +10 -0
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { type ButtonProps } from "../Button";
2
+ import { type ButtonProps as V1ButtonProps } from "../Button";
3
3
  import { type HeadingProps } from "../Heading";
4
4
  import { type SceneProps, type SpotProps } from "../Illustration";
5
5
  import { type TooltipProps } from "../Tooltip";
6
6
  import { type VariantType } from './types';
7
- export type ActionProps = ButtonProps & {
7
+ export type ActionProps = V1ButtonProps & {
8
8
  'tooltip'?: TooltipProps;
9
9
  'aria-label'?: string;
10
10
  'aria-labelledby'?: string;
@@ -25,9 +25,14 @@ type BaseGuidanceBlockProps = {
25
25
  illustration: React.ReactElement<SpotProps | SceneProps>;
26
26
  illustrationType?: IllustrationType;
27
27
  smallScreenTextAlignment?: TextAlignment;
28
+ /** @deprecated use the `actionsSlot` prop with Button/next instead */
28
29
  actions?: GuidanceBlockActions;
30
+ /** A slot for the primary and secondary action. It is recommended to use the {@link https://cultureamp.design/?path=/docs/components-button-button-next-api-specification--docs | Button} or {@link https://cultureamp.design/?path=/docs/components-linkbutton-usage-guidelines--docs | LinkButton} wrapped in fragment. */
31
+ actionsSlot?: React.ReactNode;
32
+ /** @deprecated this is no longer a used feature and is only the deprecated `actions` prop, ie: {secondary: { label: "Dismiss action" }}` */
29
33
  secondaryDismiss?: boolean;
30
34
  variant?: VariantType;
35
+ /** @deprecated use the `actionsSlot` and pass the icon into the JSX elements */
31
36
  withActionButtonArrow?: boolean;
32
37
  noMaxWidth?: boolean;
33
38
  };
@@ -45,14 +50,13 @@ export type GuidanceBlockProps = GuidanceBlockWithText | GuidanceBlockPropsWithC
45
50
  export type GuidanceBlockState = {
46
51
  hidden: boolean;
47
52
  removed: boolean;
48
- mediaQueryLayout: string;
49
53
  };
50
54
  /**
51
55
  * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093807/Guidance+Block Guidance} |
52
56
  * {@link https://cultureamp.design/?path=/docs/components-guidanceblock--docs Storybook}
53
57
  */
54
58
  export declare const GuidanceBlock: {
55
- ({ layout, variant, withActionButtonArrow, noMaxWidth, illustrationType, smallScreenTextAlignment, actions, illustration, secondaryDismiss, ...restProps }: GuidanceBlockProps): JSX.Element;
59
+ ({ layout, variant, withActionButtonArrow, noMaxWidth, illustrationType, smallScreenTextAlignment, actions, illustration, secondaryDismiss, actionsSlot, ...restProps }: GuidanceBlockProps): JSX.Element;
56
60
  displayName: string;
57
61
  };
58
62
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.74.3",
3
+ "version": "1.75.1",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -143,7 +143,6 @@
143
143
  "react-day-picker": "8.10.1",
144
144
  "react-focus-lock": "^2.13.6",
145
145
  "react-focus-on": "^3.9.4",
146
- "react-media": "^1.10.0",
147
146
  "react-popper": "^2.3.0",
148
147
  "react-select": "^5.10.1",
149
148
  "react-textfit": "^1.1.1",
@@ -179,14 +178,14 @@
179
178
  "react-dom": "^18.3.1",
180
179
  "react-highlight": "^0.15.0",
181
180
  "react-intl": "^7.1.10",
182
- "rollup": "^4.38.0",
181
+ "rollup": "^4.39.0",
183
182
  "sass": "1.79.6",
184
183
  "serialize-query-params": "^2.0.2",
185
184
  "svgo": "^3.3.2",
186
185
  "tslib": "^2.8.1",
187
186
  "tsx": "^4.19.3",
188
- "@kaizen/design-tokens": "10.8.9",
189
- "@kaizen/package-bundler": "2.0.6"
187
+ "@kaizen/design-tokens": "10.8.10",
188
+ "@kaizen/package-bundler": "2.0.7"
190
189
  },
191
190
  "devDependenciesComments": {
192
191
  "sass": "Prevent deprecation warnings introduced in 1.80 as we plan to move away from sass",
@@ -1,11 +1,3 @@
1
- .rightMargin {
2
- margin-right: var(--spacing-8);
3
- }
4
-
5
- .noRightMargin {
6
- margin-right: 0;
7
- }
8
-
9
1
  .banner.noMaxWidth {
10
2
  max-width: inherit;
11
3
  }
@@ -121,7 +113,6 @@
121
113
 
122
114
  .buttonContainer {
123
115
  display: flex;
124
- flex: 1 0 auto;
125
116
  justify-content: center;
126
117
  flex-direction: row-reverse;
127
118
  gap: var(--spacing-12);
@@ -1,16 +1,16 @@
1
- import React, { useEffect, useState } from 'react'
1
+ import React, { useState } from 'react'
2
2
  import classNames from 'classnames'
3
- import Media from 'react-media'
4
- import { Button, type ButtonProps } from '~components/Button'
3
+ import { Button as V1Button, type ButtonProps as V1ButtonProps } from '~components/Button'
5
4
  import { Heading, type HeadingProps } from '~components/Heading'
6
5
  import { type SceneProps, type SpotProps } from '~components/Illustration'
7
6
  import { Text } from '~components/Text'
8
7
  import { Tooltip, type TooltipProps } from '~components/Tooltip'
9
- import { Icon } from '~components/__next__/Icon'
8
+ import { Icon } from '~components/__next__'
9
+ import { useMediaQueries } from '~components/utils/useMediaQueries'
10
10
  import { type VariantType } from './types'
11
11
  import styles from './GuidanceBlock.module.css'
12
12
 
13
- export type ActionProps = ButtonProps & {
13
+ export type ActionProps = V1ButtonProps & {
14
14
  'tooltip'?: TooltipProps
15
15
  'aria-label'?: string
16
16
  'aria-labelledby'?: string
@@ -38,14 +38,15 @@ type BaseGuidanceBlockProps = {
38
38
  * Sets how the width and aspect ratio will respond to the Illustration passed in.
39
39
  */
40
40
  illustrationType?: IllustrationType
41
-
42
41
  smallScreenTextAlignment?: TextAlignment
42
+ /** @deprecated use the `actionsSlot` prop with Button/next instead */
43
43
  actions?: GuidanceBlockActions
44
- /*
45
- * This will still require the secondary object to be passed into the actions ie: {secondary: { label: "Dismiss action" }}`
46
- */
44
+ /** A slot for the primary and secondary action. It is recommended to use the {@link https://cultureamp.design/?path=/docs/components-button-button-next-api-specification--docs | Button} or {@link https://cultureamp.design/?path=/docs/components-linkbutton-usage-guidelines--docs | LinkButton} wrapped in fragment. */
45
+ actionsSlot?: React.ReactNode
46
+ /** @deprecated this is no longer a used feature and is only the deprecated `actions` prop, ie: {secondary: { label: "Dismiss action" }}` */
47
47
  secondaryDismiss?: boolean
48
48
  variant?: VariantType
49
+ /** @deprecated use the `actionsSlot` and pass the icon into the JSX elements */
49
50
  withActionButtonArrow?: boolean
50
51
  noMaxWidth?: boolean
51
52
  }
@@ -67,7 +68,6 @@ export type GuidanceBlockProps = GuidanceBlockWithText | GuidanceBlockPropsWithC
67
68
  export type GuidanceBlockState = {
68
69
  hidden: boolean
69
70
  removed: boolean
70
- mediaQueryLayout: string
71
71
  }
72
72
 
73
73
  type WithTooltipProps = {
@@ -92,22 +92,15 @@ export const GuidanceBlock = ({
92
92
  actions,
93
93
  illustration,
94
94
  secondaryDismiss,
95
+ actionsSlot,
95
96
  ...restProps
96
97
  }: GuidanceBlockProps): JSX.Element => {
97
98
  const [hidden, setHidden] = useState<boolean>(false)
98
99
  const [removed, setRemoved] = useState<boolean>(false)
99
- const [mediaQueryLayout, setMediaQueryLayout] = useState<string>('')
100
+ const { queries } = useMediaQueries()
100
101
 
101
102
  const containerRef = React.createRef<HTMLDivElement>()
102
103
 
103
- useEffect(() => {
104
- if (layout === 'inline' || layout === 'stacked') {
105
- containerQuery()
106
- }
107
- // @todo: Fix if possible - avoiding breaking in eslint upgrade
108
- // eslint-disable-next-line react-hooks/exhaustive-deps
109
- }, [])
110
-
111
104
  const handleDismissBanner = (): void => {
112
105
  setHidden(true)
113
106
  actions?.dismiss?.onClick()
@@ -120,24 +113,6 @@ export const GuidanceBlock = ({
120
113
  }
121
114
  }
122
115
 
123
- const containerQuery = (): void => {
124
- const resizeObserver = new ResizeObserver((entries) => {
125
- if (entries.length === 1) {
126
- handleMediaQueryLayout(entries[0].contentRect.width)
127
- }
128
- })
129
-
130
- resizeObserver.observe(containerRef.current as HTMLElement)
131
- }
132
-
133
- const handleMediaQueryLayout = (width: number): void => {
134
- if (width <= 320) {
135
- setMediaQueryLayout('centerContent')
136
- } else {
137
- setMediaQueryLayout('')
138
- }
139
- }
140
-
141
116
  const marginTop = (): string => {
142
117
  if (hidden && containerRef.current) {
143
118
  return -containerRef.current.clientHeight + 'px'
@@ -150,8 +125,6 @@ export const GuidanceBlock = ({
150
125
  return <></>
151
126
  }
152
127
 
153
- const componentIsMobile = mediaQueryLayout.includes('centerContent')
154
-
155
128
  return (
156
129
  <div
157
130
  className={classNames(
@@ -159,7 +132,7 @@ export const GuidanceBlock = ({
159
132
  variant && styles[variant],
160
133
  layout && styles[layout],
161
134
  hidden && styles.hidden,
162
- mediaQueryLayout === 'centerContent' && styles.centerContent,
135
+ queries.isSmall && styles.centerContent,
163
136
  noMaxWidth && styles.noMaxWidth,
164
137
  illustrationType === 'scene' && styles.hasSceneIllustration,
165
138
  smallScreenTextAlignment === 'left' && styles.smallScreenTextAlignment,
@@ -193,55 +166,43 @@ export const GuidanceBlock = ({
193
166
  </>
194
167
  )}
195
168
  </div>
196
- {actions?.primary && (
197
- <Media query="(max-width: 767px)">
198
- {(isMobile: boolean): JSX.Element => (
199
- <div
200
- className={classNames({
201
- noRightMargin: isMobile || componentIsMobile,
202
- rightMargin: !(isMobile || componentIsMobile) && layout === 'default',
203
- })}
204
- >
205
- <div
206
- className={classNames(
207
- styles.buttonContainer,
208
- actions?.secondary && styles.secondaryAction,
209
- )}
210
- >
211
- <WithTooltip tooltipProps={actions.primary.tooltip}>
212
- <Button
213
- icon={
214
- withActionButtonArrow ? (
215
- <Icon name="arrow_forward" isPresentational shouldMirrorInRTL />
216
- ) : undefined
217
- }
218
- iconPosition="end"
219
- {...actions.primary}
220
- fullWidth={isMobile || componentIsMobile}
221
- />
169
+ {actions?.primary || actionsSlot ? (
170
+ <div className={styles.buttonContainer}>
171
+ {actions?.primary && (
172
+ <>
173
+ <WithTooltip tooltipProps={actions.primary.tooltip}>
174
+ <V1Button
175
+ icon={
176
+ withActionButtonArrow ? (
177
+ <Icon name="arrow_forward" isPresentational shouldMirrorInRTL />
178
+ ) : undefined
179
+ }
180
+ iconPosition="end"
181
+ {...actions.primary}
182
+ fullWidth={queries.isSmall}
183
+ />
184
+ </WithTooltip>
185
+ {actions?.secondary && (
186
+ <WithTooltip tooltipProps={actions.secondary.tooltip}>
187
+ <div className={styles.secondaryAction}>
188
+ <V1Button
189
+ secondary
190
+ {...actions.secondary}
191
+ onClick={
192
+ secondaryDismiss
193
+ ? (): void => handleDismissBanner()
194
+ : actions?.secondary?.onClick
195
+ }
196
+ fullWidth={queries.isSmall}
197
+ />
198
+ </div>
222
199
  </WithTooltip>
223
-
224
- {actions?.secondary && (
225
- <WithTooltip tooltipProps={actions.secondary.tooltip}>
226
- <div className={styles.secondaryAction}>
227
- <Button
228
- secondary
229
- {...actions.secondary}
230
- onClick={
231
- secondaryDismiss
232
- ? (): void => handleDismissBanner()
233
- : actions?.secondary?.onClick
234
- }
235
- fullWidth={isMobile || componentIsMobile}
236
- />
237
- </div>
238
- </WithTooltip>
239
- )}
240
- </div>
241
- </div>
200
+ )}
201
+ </>
242
202
  )}
243
- </Media>
244
- )}
203
+ {!actions && actionsSlot && actionsSlot}
204
+ </div>
205
+ ) : null}
245
206
  </div>
246
207
  </div>
247
208
  )
@@ -0,0 +1,77 @@
1
+ import { Canvas, Meta, Controls, Story } from '@storybook/blocks'
2
+ import { ResourceLinks, KAIOInstallation } from '~storybook/components'
3
+
4
+ <Meta title="Components/GuidanceBlock/Migration Guide" />
5
+
6
+ # GuidanceBlock `actions` Migration Guide
7
+
8
+ This is a short guide to assist in migration from the `actions` to `actionsSlot` prop.
9
+
10
+ ## Key API differences
11
+
12
+ Below is a list of notable changes when migrating:
13
+
14
+ - `actionsSlot` added
15
+ - This accepts a JSX element to render the primary and secondary actions
16
+ - `actions` prop is deprecated
17
+ - This uses the V1 `Button` component which is being dropped in the next cycle
18
+ - `secondaryDismiss` prop is deprecated
19
+ - A dismissible GuidanceBlock is no longer used across the platform
20
+ - `withActionButtonArrow` prop is deprecated
21
+ - Icons should be handled within the `Button` or `LinkButton` component
22
+
23
+ ### Mapping primary and secondary actions to the correct Button variant
24
+
25
+ The primary action is mapped to the `secondary` variant and secondary action is mapped to the `tertiary` variant, i.e:
26
+
27
+ ```tsx
28
+ <Button variant="secondary" size="large" {...otherButtonProps}>Primary Action</Button>
29
+ <Button variant="tertiary" size="large" {...otherButtonProps}>Secondary Action</Button>
30
+ ```
31
+
32
+ Note that within GuidanceBlock the size of the buttons is `large`.
33
+
34
+ ## Codemod
35
+
36
+ To assist in migration we have created the `migrateGuidanceBlockActionsToActionsSlot` codemod.
37
+
38
+ This will loop through the given directory and attempt to update all instances of GuidanceBlock to use the `actionsSlot`. You can refer to this [README](https://github.com/cultureamp/kaizen-design-system/blob/main/packages/components/codemods/README.md#kaizen-codemods) on how to run kaizen codemods using the CLI within your repository, ie:
39
+
40
+ ```bash
41
+ pnpm kaizen-codemod src migrateGuidanceBlockActionsToActionsSlot
42
+ ```
43
+
44
+ Note that there are cases where props that no longer exist will be left in the codebase to throw type error and provide feedback to the engineer. This is intentional and identifies area's where manual updates are required.
45
+
46
+ ### Codemod gotchas
47
+
48
+ If you're facing any issues not captured below, reach out to the [#help_design_system](https://cultureamp.slack.com/archives/C0189KBPM4Y) channel on Slack.
49
+
50
+ #### `icon` props and sizing
51
+
52
+ While the `icon` prop supports any `JSX` element, only the latest [Icon component](/docs/components-icon-icon-future-api-specification--docs) will be able to handle relative sizing and spacing automatically within the Button. We recommend running the `upgradeIconV1` codemod before this to convert all icons to the latest implementation. See the guidance here on using the [Material Icons CDN](/docs/guides-app-starter--docs#5-link-to-google-material-symbols-cdn).
53
+
54
+ #### `component` props type errors
55
+
56
+ Based off Metabase queries, `component` render props is used in consuming repositories to wrap Button content with a routing solution, such as NextJS's `Link` component. To ensure a safe migration, the codemod will update any usages to a `LinkButton` with the `component` prop still passed in. This will cause an intentional type error to provide feedback and make it easier to find in the codebase for a manual update. This should be able to be converted to use client side routing by following the [LinkButton API docs](https://cultureamp.design/?path=/docs/components-linkbutton-api-specification--docs).
57
+
58
+ #### `badge` props type errors
59
+
60
+ The codemod will continue to pass `badge` props into the new implementation so it will throw a type error and provide feedback to engineers. This will need to be manually composed within the `Children` if required, ie:
61
+
62
+ ```
63
+ import { Badge } from "@kaizen/components"
64
+ import { Button } from "@kaizen/components/next"
65
+
66
+ <Button>Label<Badge classNameOverride="ms-8" variant="success">New</Badge></Button>
67
+ ```
68
+
69
+ #### `tooltip` props type errors
70
+
71
+ Tooltips will need to be manually migrated to the latest version. Refer to the GuidanceBlock stories as an example.
72
+
73
+ #### Link related props type errors
74
+
75
+ If no `href` or `component` props are passed to the component you may get type errors for having anchor related props passed into a Button, ie: `target`, `rel`.
76
+
77
+ This will cause a type error that can be corrected by either using the `LinkButton` (if intended) or removing all anchor related props as they shouldn't exist on semantic buttons.
@@ -25,14 +25,43 @@ It guides people to new actions they haven't done before or connects them to rel
25
25
 
26
26
  ## API
27
27
 
28
- <DocsStory of={GuidanceBlockStories.Actions} />
28
+ ### actionsSlot
29
29
 
30
- <DocsStory of={GuidanceBlockStories.Tooltip} />
30
+ The `actionsSlot` slot is used to render the GuidanceBlock's primary and secondary action. This supersedes the deprecated `actions` prop and should be used with [LinkButton](https://cultureamp.design/?path=/docs/components-linkbutton-api-specification--docs) or [Button](https://cultureamp.design/?path=/docs/components-button-button-next-api-specification--docs) component.
31
31
 
32
- <DocsStory of={GuidanceBlockStories.CustomContent} />
32
+ <Canvas of={GuidanceBlockStories.ActionsSlot} />
33
33
 
34
- <DocsStory of={GuidanceBlockStories.Stacked} />
34
+ It is recommended that the primary and secondary actions use their respective variants (`secondary` and `tertiary`) within the Button component to ensure continuity in designs.
35
35
 
36
- <DocsStory of={GuidanceBlockStories.SceneExample} />
36
+ #### actionsSlot with tooltip
37
37
 
38
- <DocsStory of={GuidanceBlockStories.Variants} />
38
+ The new actionsSlot allows use to use the modern Tooltip. Refer to the [docs here](https://cultureamp.design/?path=/docs/components-tooltip-tooltip-next-api-specification--docs) for more tooltip configuration options.
39
+
40
+ <Canvas of={GuidanceBlockStories.ActionsSlotWithTooltips} />
41
+
42
+ ### actions (deprecated)
43
+
44
+ The actions prop is deprecated. Use the [actionsSlot](#actionsslot) slot instead with the `LinkButton` or `Button` component instead.
45
+
46
+ <Canvas of={GuidanceBlockStories.Actions} />
47
+
48
+ #### actions (deprecated) with tooltip
49
+
50
+ <Canvas of={GuidanceBlockStories.Tooltip} />
51
+
52
+ ### Custom content
53
+
54
+ <Canvas of={GuidanceBlockStories.CustomContent} />
55
+
56
+ ### Stacked
57
+
58
+ <Canvas of={GuidanceBlockStories.Stacked} />
59
+
60
+ ### Scene Illustrations
61
+
62
+ <Canvas of={GuidanceBlockStories.SceneExample} />
63
+
64
+ ### Variants
65
+
66
+ <Canvas of={GuidanceBlockStories.Variants} />
67
+ ```
@@ -2,8 +2,15 @@ import React from 'react'
2
2
  import { type Meta } from '@storybook/react'
3
3
  import { Heading } from '~components/Heading'
4
4
  import { EmptyStatesPositive, Informative } from '~components/Illustration'
5
+ import { LinkButton } from '~components/LinkButton'
5
6
  import { Tag } from '~components/Tag'
6
7
  import { Text } from '~components/Text'
8
+ import { Icon } from '~components/__next__'
9
+ import { Button } from '~components/__next__/Button'
10
+ import {
11
+ Tooltip as TooltipNext,
12
+ TooltipTrigger as TooltipTriggerNext,
13
+ } from '~components/__next__/Tooltip'
7
14
  import { StickerSheet, type StickerSheetStory } from '~storybook/components/StickerSheet'
8
15
  import { GuidanceBlock, type GuidanceBlockProps } from '../index'
9
16
  import { variantsMap } from '../types'
@@ -17,23 +24,24 @@ export default {
17
24
  } satisfies Meta
18
25
 
19
26
  const GENERIC_PROPS = {
20
- persistent: true,
21
27
  illustration: <Informative alt="" />,
22
- actions: {
23
- primary: {
24
- label: 'Action',
25
- onClick: () => {
26
- alert('tada: 🎉')
27
- },
28
- },
29
- secondary: {
30
- label: 'Pass',
31
- onClick: () => {
32
- alert('tada: 🎉')
33
- },
34
- },
35
- },
36
- }
28
+ actionsSlot: (
29
+ <>
30
+ <Button
31
+ variant="secondary"
32
+ onPress={() => alert('tada: 🎉')}
33
+ size="large"
34
+ iconPosition="end"
35
+ icon={<Icon name={'arrow_forward'} shouldMirrorInRTL isPresentational />}
36
+ >
37
+ Action
38
+ </Button>
39
+ <LinkButton variant="tertiary" href="#lorem" onPress={() => alert('tracking')} size="large">
40
+ Pass
41
+ </LinkButton>
42
+ </>
43
+ ),
44
+ } satisfies Partial<GuidanceBlockProps>
37
45
 
38
46
  const TEXT_PROPS: GuidanceBlockProps = {
39
47
  ...GENERIC_PROPS,
@@ -67,7 +75,24 @@ const StickerSheetTemplate: StickerSheetStory = {
67
75
  ))}
68
76
  </>
69
77
  <StickerSheet.Row header="No arrow">
70
- <GuidanceBlock withActionButtonArrow={false} {...TEXT_PROPS} />
78
+ <GuidanceBlock
79
+ {...TEXT_PROPS}
80
+ actionsSlot={
81
+ <>
82
+ <Button variant="secondary" onPress={() => alert('tada: 🎉')} size="large">
83
+ Action
84
+ </Button>
85
+ <LinkButton
86
+ variant="tertiary"
87
+ href="#lorem"
88
+ onPress={() => alert('tracking')}
89
+ size="large"
90
+ >
91
+ Pass
92
+ </LinkButton>
93
+ </>
94
+ }
95
+ />
71
96
  </StickerSheet.Row>
72
97
  <StickerSheet.Row header="Custom Content">
73
98
  <GuidanceBlock {...CONTENT_PROPS} />
@@ -75,16 +100,24 @@ const StickerSheetTemplate: StickerSheetStory = {
75
100
  <StickerSheet.Row header="Tooltip">
76
101
  <GuidanceBlock
77
102
  {...TEXT_PROPS}
78
- actions={{
79
- primary: {
80
- ...GENERIC_PROPS.actions.primary,
81
- tooltip: {
82
- text: 'Opens in a new tab',
83
- mood: 'cautionary',
84
- isInitiallyVisible: true,
85
- },
86
- },
87
- }}
103
+ actionsSlot={
104
+ <>
105
+ <TooltipTriggerNext defaultOpen>
106
+ <LinkButton
107
+ variant="secondary"
108
+ href="#lorem"
109
+ target="_blank"
110
+ rel="noopener noreferrer"
111
+ size="large"
112
+ iconPosition="end"
113
+ icon={<Icon name="arrow_forward" shouldMirrorInRTL isPresentational />}
114
+ >
115
+ Learn more
116
+ </LinkButton>
117
+ <TooltipNext>Opens in a new tab</TooltipNext>
118
+ </TooltipTriggerNext>
119
+ </>
120
+ }
88
121
  />
89
122
  </StickerSheet.Row>
90
123
  <StickerSheet.Row header="Scene Illustration">