@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.
Files changed (61) hide show
  1. package/codemods/README.md +0 -1
  2. package/dist/cjs/{__containers__/GuidanceBlock/v2 → GuidanceBlock}/GuidanceBlock.cjs +6 -6
  3. package/dist/cjs/GuidanceBlock/GuidanceBlock.module.scss.cjs +33 -0
  4. package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +1 -1
  5. package/dist/cjs/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.cjs +2 -4
  6. package/dist/cjs/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.cjs +2 -3
  7. package/dist/cjs/index.cjs +2 -2
  8. package/dist/esm/{__containers__/GuidanceBlock/v2 → GuidanceBlock}/GuidanceBlock.mjs +6 -6
  9. package/dist/esm/GuidanceBlock/GuidanceBlock.module.scss.mjs +31 -0
  10. package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +1 -1
  11. package/dist/esm/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.mjs +2 -4
  12. package/dist/esm/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.mjs +2 -3
  13. package/dist/esm/index.mjs +1 -1
  14. package/dist/styles.css +1437 -1766
  15. package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.d.ts +4 -4
  16. package/dist/types/index.d.ts +1 -1
  17. package/package.json +2 -2
  18. package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.module.scss +2 -2
  19. package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.mdx +2 -2
  20. package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.stickersheet.stories.tsx +1 -1
  21. package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/_docs/GuidanceBlock.stories.tsx +1 -1
  22. package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +5 -1
  23. package/src/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.scss +8 -2
  24. package/src/__layout__/Workflow/v2/subcomponents/Footer/components/ProgressStepper/ProgressStepper.tsx +2 -7
  25. package/src/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.css +5 -0
  26. package/src/__layout__/Workflow/v3/subcomponents/Footer/components/ProgressStepper/ProgressStepper.tsx +2 -6
  27. package/src/index.ts +1 -2
  28. package/codemods/updateGuidanceBlockVariantProp/index.ts +0 -19
  29. package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.spec.ts +0 -135
  30. package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.ts +0 -77
  31. package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.cjs +0 -160
  32. package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.cjs +0 -33
  33. package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.cjs +0 -28
  34. package/dist/cjs/containersV1.cjs +0 -4
  35. package/dist/cjs/containersV2.cjs +0 -4
  36. package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.mjs +0 -153
  37. package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.mjs +0 -31
  38. package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.mjs +0 -26
  39. package/dist/esm/containersV1.mjs +0 -1
  40. package/dist/esm/containersV2.mjs +0 -1
  41. package/dist/types/__containers__/GuidanceBlock/v2/GuidanceBlock.d.ts +0 -59
  42. package/dist/types/__containers__/GuidanceBlock/v2/index.d.ts +0 -1
  43. package/dist/types/__containers__/v1.d.ts +0 -1
  44. package/dist/types/__containers__/v2.d.ts +0 -1
  45. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss +0 -356
  46. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +0 -82
  47. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.tsx +0 -262
  48. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.mdx +0 -38
  49. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stickersheet.stories.tsx +0 -118
  50. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stories.tsx +0 -152
  51. package/src/__containers__/GuidanceBlock/v2/index.ts +0 -1
  52. package/src/__containers__/v1.ts +0 -1
  53. package/src/__containers__/v2.ts +0 -1
  54. package/v1/containers/package.json +0 -5
  55. package/v2/containers/package.json +0 -5
  56. /package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/index.d.ts +0 -0
  57. /package/dist/types/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/types.d.ts +0 -0
  58. /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.spec.tsx +0 -0
  59. /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/GuidanceBlock.tsx +0 -0
  60. /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/index.ts +0 -0
  61. /package/src/{__containers__/GuidanceBlock/v1 → GuidanceBlock}/types.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import { HeadingProps } from "../../../Heading";
3
- import { SceneProps, SpotProps } from "../../../Illustration";
4
- import { ButtonProps } from "../../../__actions__/v2";
5
- import { TooltipProps } from "../../../__overlays__/Tooltip/v1";
2
+ import { HeadingProps } from "../Heading";
3
+ import { SceneProps, SpotProps } from "../Illustration";
4
+ import { ButtonProps } from "../__actions__/v2";
5
+ import { TooltipProps } from "../__overlays__/Tooltip/v1";
6
6
  import { VariantType } from "./types";
7
7
  export type ActionProps = ButtonProps & {
8
8
  tooltip?: TooltipProps;
@@ -20,6 +20,7 @@ export * from "./ErrorPage";
20
20
  export * from "./FieldGroup";
21
21
  export * from "./FieldMessage";
22
22
  export * from "./Filter";
23
+ export * from "./GuidanceBlock";
23
24
  export * from "./Heading";
24
25
  export * from "./Icon";
25
26
  export * from "./Illustration";
@@ -60,4 +61,3 @@ export * from "./__layout__/Workflow/v1";
60
61
  export * from "./__overlays__/Tooltip/v1";
61
62
  export * from "./__actions__/Menu/v1";
62
63
  export * from "./__actions__/Button/v1";
63
- export * from "./__containers__/GuidanceBlock/v1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.61.3",
3
+ "version": "1.62.0",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -121,7 +121,7 @@
121
121
  "tslib": "^2.6.3",
122
122
  "tsx": "^4.17.0",
123
123
  "@kaizen/design-tokens": "10.6.1",
124
- "@kaizen/package-bundler": "1.1.4"
124
+ "@kaizen/package-bundler": "1.1.5"
125
125
  },
126
126
  "peerDependencies": {
127
127
  "@cultureamp/i18n-react-intl": "^2.5.9",
@@ -4,8 +4,8 @@
4
4
  @import "~@kaizen/design-tokens/sass/color";
5
5
  @import "~@kaizen/design-tokens/sass/animation";
6
6
  @import "~@kaizen/design-tokens/sass/spacing";
7
- @import "../../../../styles/utils/responsive";
8
- @import "../../../../styles/utils/button-reset";
7
+ @import "../../styles/utils/responsive";
8
+ @import "../../styles/utils/button-reset";
9
9
 
10
10
  @mixin guidance-block-under-480 {
11
11
  @media (max-width: 480px) {
@@ -4,7 +4,7 @@ import * as GuidanceBlockStories from "./GuidanceBlock.stories"
4
4
 
5
5
  <Meta of={GuidanceBlockStories} />
6
6
 
7
- # GuidanceBlock (V1)
7
+ # GuidanceBlock
8
8
 
9
9
  <ResourceLinks
10
10
  sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/GuidanceBlock"
@@ -13,7 +13,7 @@ import * as GuidanceBlockStories from "./GuidanceBlock.stories"
13
13
 
14
14
  />
15
15
 
16
- <KAIOInstallation exportNames="GuidanceBlock" version="1" family="containers" />
16
+ <KAIOInstallation exportNames="GuidanceBlock" />
17
17
 
18
18
  ## Overview
19
19
 
@@ -12,7 +12,7 @@ import { GuidanceBlock, GuidanceBlockProps } from "../index"
12
12
  import { variantsMap } from "../types"
13
13
 
14
14
  export default {
15
- title: "Containers/GuidanceBlock/v1",
15
+ title: "Containers/GuidanceBlock",
16
16
  parameters: {
17
17
  chromatic: { disable: false },
18
18
  controls: { disable: true },
@@ -29,7 +29,7 @@ const defaultText = {
29
29
  }
30
30
 
31
31
  const meta = {
32
- title: "Containers/GuidanceBlock/v1",
32
+ title: "Containers/GuidanceBlock",
33
33
  component: GuidanceBlock,
34
34
  args: {
35
35
  layout: "default",
@@ -210,7 +210,11 @@ export const ConfirmationModal = ({
210
210
  </ModalBody>
211
211
  <ModalFooter
212
212
  actions={footerActions}
213
- appearance={mood === "negative" ? "destructive" : "primary"}
213
+ appearance={
214
+ mood === "negative" || variant == "warning"
215
+ ? "destructive"
216
+ : "primary"
217
+ }
214
218
  unpadded={unpadded}
215
219
  />
216
220
  </div>
@@ -87,9 +87,15 @@ $indicator-size: 1.25rem;
87
87
  .stepperDescription {
88
88
  display: flex;
89
89
  justify-content: center;
90
+ color: var(--color-white);
91
+ font-family: var(--typography-paragraph-small-font-family);
92
+ font-weight: var(--typography-paragraph-small-font-weight);
93
+ font-size: var(--typography-paragraph-small-font-size);
94
+ line-height: var(--typography-paragraph-small-line-height);
95
+ letter-spacing: var(--typography-paragraph-small-letter-spacing);
90
96
 
91
- @media (min-width: 768px) {
92
- // sr hidden styles
97
+ @media (width >= 768px) {
98
+ /* sr hidden styles */
93
99
  position: absolute;
94
100
  width: 0;
95
101
  height: 0;
@@ -133,14 +133,9 @@ export const ProgressStepper = ({
133
133
  )
134
134
  })}
135
135
  </ol>
136
- <Text
137
- classNameOverride={styles.stepperDescription}
138
- variant="small"
139
- color="white"
140
- id="stepper-description"
141
- >
136
+ <span className={styles.stepperDescription} id="stepper-description">
142
137
  Step {currentStepIndex + 1} of {steps.length}
143
- </Text>
138
+ </span>
144
139
  </div>
145
140
  )
146
141
  }
@@ -92,6 +92,11 @@
92
92
  .stepperDescription {
93
93
  display: flex;
94
94
  justify-content: center;
95
+ font-family: var(--typography-paragraph-small-font-family);
96
+ font-weight: var(--typography-paragraph-small-font-weight);
97
+ font-size: var(--typography-paragraph-small-font-size);
98
+ line-height: var(--typography-paragraph-small-line-height);
99
+ letter-spacing: var(--typography-paragraph-small-letter-spacing);
95
100
 
96
101
  @media (width >= 768px) {
97
102
  /* sr hidden styles */
@@ -140,13 +140,9 @@ export const ProgressStepper = ({
140
140
  )
141
141
  })}
142
142
  </ol>
143
- <Text
144
- classNameOverride={styles.stepperDescription}
145
- variant="small"
146
- id="stepper-description"
147
- >
143
+ <span className={styles.stepperDescription} id="stepper-description">
148
144
  Step {currentStepIndex + 1} of {steps.length}
149
- </Text>
145
+ </span>
150
146
  </div>
151
147
  )
152
148
  }
package/src/index.ts CHANGED
@@ -20,7 +20,7 @@ export * from "./ErrorPage"
20
20
  export * from "./FieldGroup"
21
21
  export * from "./FieldMessage"
22
22
  export * from "./Filter"
23
-
23
+ export * from "./GuidanceBlock"
24
24
  export * from "./Heading"
25
25
  export * from "./Icon"
26
26
  export * from "./Illustration"
@@ -61,4 +61,3 @@ export * from "./__layout__/Workflow/v1"
61
61
  export * from "./__overlays__/Tooltip/v1"
62
62
  export * from "./__actions__/Menu/v1"
63
63
  export * from "./__actions__/Button/v1"
64
- export * from "./__containers__/GuidanceBlock/v1"
@@ -1,19 +0,0 @@
1
- import { transformComponentsInDir } from "../utils"
2
- import { transformGuidanceBlockVariantProp } from "./transformGuidanceBlockVariantProp"
3
- /** This is here as a script runner that updates GuidanceBlock variants to v2 variants */
4
- const updateGuidanceBlockVariantProp = (): void => {
5
- // eslint-disable-next-line no-console
6
- console.log(" ~(-_- ~) Running GuidanceBlock transformer (~ -_-)~")
7
- const targetDir = process.argv[2]
8
- if (!targetDir) {
9
- process.exit(1)
10
- }
11
-
12
- transformComponentsInDir(
13
- targetDir,
14
- transformGuidanceBlockVariantProp,
15
- "GuidanceBlock"
16
- )
17
- }
18
-
19
- updateGuidanceBlockVariantProp()
@@ -1,135 +0,0 @@
1
- import { parseJsx } from "../__tests__/utils"
2
- import { transformSource, printAst } from "../utils"
3
- import { transformGuidanceBlockVariantProp } from "./transformGuidanceBlockVariantProp"
4
-
5
- describe("transformGuidanceBlockVariantProp", () => {
6
- it("updates the import statement for GuidanceBlock to the new family version", () => {
7
- const inputAst = parseJsx(`
8
- import { GuidanceBlock } from "@kaizen/components"
9
- import { Card } from "@kaizen/components"
10
- `)
11
- const outputAst = parseJsx(`
12
- import { GuidanceBlock } from "@kaizen/components/v2/containers"
13
- import { Card } from "@kaizen/components"
14
- `)
15
- const transformed = transformSource({
16
- sourceFile: inputAst,
17
- astTransformer: transformGuidanceBlockVariantProp,
18
- tagName: "GuidanceBlock",
19
- })
20
- expect(transformed).toBe(printAst(outputAst))
21
- })
22
-
23
- it("removes all instances of `positive`, `negative`, `informative`, `cautionary`, `assertive`", () => {
24
- const inputAst = parseJsx(`
25
- const TestComponent = () => <GuidanceBlock variant="positive" />
26
- const TestComponent = () => <GuidanceBlock variant="negative" />
27
- const TestComponent = () => <GuidanceBlock variant="informative" />
28
- const TestComponent = () => <GuidanceBlock variant="cautionary" />
29
- const TestComponent = () => <GuidanceBlock variant="assertive" />
30
- `)
31
- const outputAst = parseJsx(`
32
- const TestComponent = () => <GuidanceBlock />
33
- const TestComponent = () => <GuidanceBlock />
34
- const TestComponent = () => <GuidanceBlock />
35
- const TestComponent = () => <GuidanceBlock />
36
- const TestComponent = () => <GuidanceBlock />
37
- `)
38
- const transformed = transformSource({
39
- sourceFile: inputAst,
40
- astTransformer: transformGuidanceBlockVariantProp,
41
- tagName: "GuidanceBlock",
42
- })
43
- expect(transformed).toEqual(printAst(outputAst))
44
- })
45
-
46
- it('replaces variant="expert-advice" with variant="prominent"', () => {
47
- const inputAst = parseJsx(`
48
- export const TestComponent = () => <GuidanceBlock variant="expert-advice" />
49
- `)
50
- const outputAst = parseJsx(`
51
- export const TestComponent = () => <GuidanceBlock variant="prominent" />
52
- `)
53
- const transformed = transformSource({
54
- sourceFile: inputAst,
55
- astTransformer: transformGuidanceBlockVariantProp,
56
- tagName: "GuidanceBlock",
57
- })
58
- expect(transformed).toBe(printAst(outputAst))
59
- })
60
-
61
- it("handles multiple attributes and replace only variant", () => {
62
- const inputAst = parseJsx(`
63
- export const TestComponent = () => <GuidanceBlock variant="positive" id="123" />
64
- `)
65
- const outputAst = parseJsx(`
66
- export const TestComponent = () => <GuidanceBlock id="123" />
67
- `)
68
- const transformed = transformSource({
69
- sourceFile: inputAst,
70
- astTransformer: transformGuidanceBlockVariantProp,
71
- tagName: "GuidanceBlock",
72
- })
73
- expect(transformed).toBe(printAst(outputAst))
74
- })
75
-
76
- it("handles nested GuidanceBlock components", () => {
77
- const inputAst = parseJsx(`
78
- export const TestComponent = () => <div><GuidanceBlock variant="positive" id="123" /></div>
79
- `)
80
- const outputAst = parseJsx(`
81
- export const TestComponent = () => <div><GuidanceBlock id="123" /></div>
82
- `)
83
- const transformed = transformSource({
84
- sourceFile: inputAst,
85
- astTransformer: transformGuidanceBlockVariantProp,
86
- tagName: "GuidanceBlock",
87
- })
88
- expect(transformed).toBe(printAst(outputAst))
89
- })
90
-
91
- it("transforms multiple GuidanceBlock", () => {
92
- const inputAst = parseJsx(`
93
- export const TestComponent = () => <div><GuidanceBlock variant="positive" /><GuidanceBlock variant="positive" /></div>
94
- `)
95
- const outputAst = parseJsx(`
96
- export const TestComponent = () => <div><GuidanceBlock /><GuidanceBlock /></div>
97
- `)
98
- const transformed = transformSource({
99
- sourceFile: inputAst,
100
- astTransformer: transformGuidanceBlockVariantProp,
101
- tagName: "GuidanceBlock",
102
- })
103
- expect(transformed).toBe(printAst(outputAst))
104
- })
105
-
106
- it("transforms GuidanceBlock with arbitrary braces", () => {
107
- const inputAst = parseJsx(`
108
- export const TestComponent = () => <div><GuidanceBlock variant={"informative"} /><GuidanceBlock variant={'assertive'} /><GuidanceBlock variant={\`expert-advice\`} /></div>
109
- `)
110
- const outputAst = parseJsx(`
111
- export const TestComponent = () => <div><GuidanceBlock /><GuidanceBlock /><GuidanceBlock variant="prominent" /></div>
112
- `)
113
- const transformed = transformSource({
114
- sourceFile: inputAst,
115
- astTransformer: transformGuidanceBlockVariantProp,
116
- tagName: "GuidanceBlock",
117
- })
118
- expect(transformed).toBe(printAst(outputAst))
119
- })
120
-
121
- it("won't modify variants usings variables", () => {
122
- const inputAst = parseJsx(`
123
- export const TestComponent = () => <div><GuidanceBlock variant={varName} /></div>
124
- `)
125
- const outputAst = parseJsx(`
126
- export const TestComponent = () => <div><GuidanceBlock variant={varName} /></div>
127
- `)
128
- const transformed = transformSource({
129
- sourceFile: inputAst,
130
- astTransformer: transformGuidanceBlockVariantProp,
131
- tagName: "GuidanceBlock",
132
- })
133
- expect(transformed).toBe(printAst(outputAst))
134
- })
135
- })
@@ -1,77 +0,0 @@
1
- import ts from "typescript"
2
- import { getPropValueText } from "../utils/getPropValueText"
3
-
4
- /** Recurses through AST to find and update any jsx element that matched the tagName */
5
- export const transformGuidanceBlockVariantProp =
6
- (context: ts.TransformationContext, tagName: string) =>
7
- (rootNode: ts.Node): ts.Node => {
8
- function visit(node: ts.Node): ts.Node {
9
- if (ts.isImportDeclaration(node) && node.getText().includes(tagName)) {
10
- const newModuleSpecifier = ts.factory.createStringLiteral(
11
- "@kaizen/components/v2/containers"
12
- )
13
- return ts.factory.updateImportDeclaration(
14
- node,
15
- node.modifiers,
16
- node.importClause,
17
- newModuleSpecifier,
18
- node.attributes
19
- )
20
- }
21
-
22
- if (ts.isJsxSelfClosingElement(node)) {
23
- if (node.tagName.getText() === tagName) {
24
- const newAttributes = node.attributes.properties.reduce<
25
- ts.JsxAttributeLike[]
26
- >((acc, attr) => {
27
- if (ts.isJsxAttribute(attr) && attr.name.getText() === "variant") {
28
- const valueName =
29
- attr.initializer && getPropValueText(attr.initializer)
30
-
31
- const oldValues = [
32
- "positive",
33
- "negative",
34
- "informative",
35
- "cautionary",
36
- "assertive",
37
- ]
38
-
39
- if (valueName) {
40
- if (oldValues.includes(valueName)) {
41
- // Remove the attribute for old values
42
- return acc
43
- }
44
-
45
- if (valueName === "expert-advice") {
46
- // Replace the attribute value for expert-advice
47
- return [
48
- ...acc,
49
- ts.factory.createJsxAttribute(
50
- attr.name,
51
- ts.factory.createStringLiteral("prominent")
52
- ),
53
- ]
54
- }
55
-
56
- // Keep the attribute for other values
57
- return [...acc, attr]
58
- }
59
- }
60
-
61
- return [...acc, attr]
62
- }, [])
63
-
64
- if (ts.isJsxSelfClosingElement(node)) {
65
- return ts.factory.updateJsxSelfClosingElement(
66
- node,
67
- node.tagName,
68
- node.typeArguments,
69
- ts.factory.createJsxAttributes(newAttributes)
70
- )
71
- }
72
- }
73
- }
74
- return ts.visitEachChild(node, visit, context)
75
- }
76
- return ts.visitNode(rootNode, visit)
77
- }
@@ -1,160 +0,0 @@
1
- 'use strict';
2
-
3
- var tslib = require('tslib');
4
- var React = require('react');
5
- var classnames = require('classnames');
6
- var Media = require('react-media');
7
- var Heading = require('../../../Heading/Heading.cjs');
8
- require('../../../Icon/subcomponents/SVG/SVG.cjs');
9
- var ArrowForwardIcon = require('../../../Icon/ArrowForwardIcon.cjs');
10
- var Text = require('../../../Text/Text.cjs');
11
- var index = require('../../../__overlays__/Tooltip/v1/index.cjs');
12
- var GuidanceBlock_module = require('./GuidanceBlock.module.scss.cjs');
13
- var Button = require('../../../__actions__/Button/v1/Button/Button.cjs');
14
- function _interopDefault(e) {
15
- return e && e.__esModule ? e : {
16
- default: e
17
- };
18
- }
19
- var React__default = /*#__PURE__*/_interopDefault(React);
20
- var classnames__default = /*#__PURE__*/_interopDefault(classnames);
21
- var Media__default = /*#__PURE__*/_interopDefault(Media);
22
- var WithTooltip = function (_a) {
23
- var tooltipProps = _a.tooltipProps,
24
- children = _a.children;
25
- return !!tooltipProps ? React__default.default.createElement(index.Tooltip, tslib.__assign({}, tooltipProps), children) : React__default.default.createElement(React__default.default.Fragment, null, children);
26
- };
27
- /**
28
- * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093807/Guidance+Block Guidance} |
29
- * {@link https://cultureamp.design/?path=/docs/components-guidanceblock--docs Storybook}
30
- */
31
- var GuidanceBlock = function (_a) {
32
- var _b, _c, _d, _e;
33
- var _f = _a.layout,
34
- layout = _f === void 0 ? "default" : _f,
35
- _g = _a.variant,
36
- variant = _g === void 0 ? "default" : _g,
37
- _h = _a.withActionButtonArrow,
38
- withActionButtonArrow = _h === void 0 ? true : _h,
39
- _j = _a.noMaxWidth,
40
- noMaxWidth = _j === void 0 ? false : _j,
41
- _k = _a.illustrationType,
42
- illustrationType = _k === void 0 ? "spot" : _k,
43
- _l = _a.smallScreenTextAlignment,
44
- smallScreenTextAlignment = _l === void 0 ? "center" : _l,
45
- actions = _a.actions,
46
- illustration = _a.illustration,
47
- secondaryDismiss = _a.secondaryDismiss,
48
- restProps = tslib.__rest(_a, ["layout", "variant", "withActionButtonArrow", "noMaxWidth", "illustrationType", "smallScreenTextAlignment", "actions", "illustration", "secondaryDismiss"]);
49
- var _m = React.useState(false),
50
- hidden = _m[0],
51
- setHidden = _m[1];
52
- var _o = React.useState(false),
53
- removed = _o[0],
54
- setRemoved = _o[1];
55
- var _p = React.useState(""),
56
- mediaQueryLayout = _p[0],
57
- setMediaQueryLayout = _p[1];
58
- var containerRef = React__default.default.createRef();
59
- React.useEffect(function () {
60
- if (layout === "inline" || layout === "stacked") {
61
- containerQuery();
62
- }
63
- }, []);
64
- var handleDismissBanner = function () {
65
- var _a;
66
- setHidden(true);
67
- (_a = actions === null || actions === void 0 ? void 0 : actions.dismiss) === null || _a === void 0 ? void 0 : _a.onClick();
68
- };
69
- var onTransitionEnd = function (e) {
70
- // Be careful: this assumes the final CSS property to be animated is "margin-top".
71
- if (hidden && e.propertyName === "margin-top") {
72
- setRemoved(true);
73
- }
74
- };
75
- var containerQuery = function () {
76
- var resizeObserver = new ResizeObserver(function (entries) {
77
- if (entries.length === 1) {
78
- handleMediaQueryLayout(entries[0].contentRect.width);
79
- }
80
- });
81
- resizeObserver.observe(containerRef.current);
82
- };
83
- var handleMediaQueryLayout = function (width) {
84
- if (width <= 320) {
85
- setMediaQueryLayout("centerContent");
86
- } else {
87
- setMediaQueryLayout("");
88
- }
89
- };
90
- var marginTop = function () {
91
- if (hidden && containerRef.current) {
92
- return -containerRef.current.clientHeight + "px";
93
- }
94
- return "0";
95
- };
96
- if (removed) {
97
- return React__default.default.createElement(React__default.default.Fragment, null);
98
- }
99
- var componentIsMobile = mediaQueryLayout.includes("centerContent");
100
- return React__default.default.createElement("div", {
101
- className: classnames__default.default(GuidanceBlock_module.banner, variant && GuidanceBlock_module[variant], layout && GuidanceBlock_module[layout], hidden && GuidanceBlock_module.hidden, mediaQueryLayout === "centerContent" && GuidanceBlock_module.centerContent, noMaxWidth && GuidanceBlock_module.noMaxWidth, illustrationType === "scene" && GuidanceBlock_module.hasSceneIllustration, smallScreenTextAlignment === "left" && GuidanceBlock_module.smallScreenTextAlignment),
102
- style: {
103
- marginTop: marginTop()
104
- },
105
- ref: containerRef,
106
- onTransitionEnd: onTransitionEnd
107
- }, React__default.default.createElement("div", {
108
- className: GuidanceBlock_module.illustrationWrapper
109
- }, React__default.default.createElement("div", {
110
- className: GuidanceBlock_module.illustration
111
- }, illustrationType === "scene" ? React__default.default.cloneElement(illustration, {
112
- enableAspectRatio: true
113
- }) : illustration)), React__default.default.createElement("div", {
114
- className: GuidanceBlock_module.descriptionAndActions
115
- }, React__default.default.createElement("div", {
116
- className: GuidanceBlock_module.descriptionContainer
117
- }, "content" in restProps && restProps.content, "text" in restProps && React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement("div", {
118
- className: GuidanceBlock_module.headingWrapper
119
- }, React__default.default.createElement(Heading.Heading, {
120
- tag: (_c = (_b = restProps === null || restProps === void 0 ? void 0 : restProps.text) === null || _b === void 0 ? void 0 : _b.titleTag) !== null && _c !== void 0 ? _c : "h3",
121
- variant: "heading-3"
122
- }, (_d = restProps === null || restProps === void 0 ? void 0 : restProps.text) === null || _d === void 0 ? void 0 : _d.title)), React__default.default.createElement(Text.Text, {
123
- tag: "p",
124
- variant: "body"
125
- }, (_e = restProps === null || restProps === void 0 ? void 0 : restProps.text) === null || _e === void 0 ? void 0 : _e.description))), (actions === null || actions === void 0 ? void 0 : actions.primary) && React__default.default.createElement(Media__default.default, {
126
- query: "(max-width: 767px)"
127
- }, function (isMobile) {
128
- var _a;
129
- return React__default.default.createElement("div", {
130
- className: classnames__default.default({
131
- noRightMargin: isMobile || componentIsMobile,
132
- rightMargin: !(isMobile || componentIsMobile) && layout === "default"
133
- })
134
- }, React__default.default.createElement("div", {
135
- className: classnames__default.default(GuidanceBlock_module.buttonContainer, (actions === null || actions === void 0 ? void 0 : actions.secondary) && GuidanceBlock_module.secondaryAction)
136
- }, React__default.default.createElement(WithTooltip, {
137
- tooltipProps: actions.primary.tooltip
138
- }, React__default.default.createElement(Button.Button, tslib.__assign({
139
- icon: withActionButtonArrow ? React__default.default.createElement(ArrowForwardIcon.ArrowForwardIcon, {
140
- role: "presentation"
141
- }) : undefined,
142
- iconPosition: "end"
143
- }, actions.primary, {
144
- fullWidth: isMobile || componentIsMobile
145
- }))), (actions === null || actions === void 0 ? void 0 : actions.secondary) && React__default.default.createElement(WithTooltip, {
146
- tooltipProps: actions.secondary.tooltip
147
- }, React__default.default.createElement("div", {
148
- className: GuidanceBlock_module.secondaryAction
149
- }, React__default.default.createElement(Button.Button, tslib.__assign({
150
- secondary: true
151
- }, actions.secondary, {
152
- onClick: secondaryDismiss ? function () {
153
- return handleDismissBanner();
154
- } : (_a = actions === null || actions === void 0 ? void 0 : actions.secondary) === null || _a === void 0 ? void 0 : _a.onClick,
155
- fullWidth: isMobile || componentIsMobile
156
- }))))));
157
- })));
158
- };
159
- GuidanceBlock.displayName = "GuidanceBlock";
160
- exports.GuidanceBlock = GuidanceBlock;
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "rightMargin": "GuidanceBlock-module_rightMargin__SbVUD",
5
- "noRightMargin": "GuidanceBlock-module_noRightMargin__CbCz9",
6
- "banner": "GuidanceBlock-module_banner__NyOs1",
7
- "noMaxWidth": "GuidanceBlock-module_noMaxWidth__Rh070",
8
- "illustrationWrapper": "GuidanceBlock-module_illustrationWrapper__lIGaj",
9
- "illustration": "GuidanceBlock-module_illustration__W7PwM",
10
- "hasSceneIllustration": "GuidanceBlock-module_hasSceneIllustration__CX8GF",
11
- "descriptionContainer": "GuidanceBlock-module_descriptionContainer__JyNJp",
12
- "descriptionAndActions": "GuidanceBlock-module_descriptionAndActions__2KGZQ",
13
- "buttonContainer": "GuidanceBlock-module_buttonContainer__6-Ty-",
14
- "hidden": "GuidanceBlock-module_hidden__a6zCg",
15
- "headingWrapper": "GuidanceBlock-module_headingWrapper__3zGY2",
16
- "cancel": "GuidanceBlock-module_cancel__G-4ci",
17
- "icon": "GuidanceBlock-module_icon__W0pEX",
18
- "disabled": "GuidanceBlock-module_disabled__GL1dK",
19
- "hover": "GuidanceBlock-module_hover__5PdJM",
20
- "active": "GuidanceBlock-module_active__3ifEz",
21
- "default": "GuidanceBlock-module_default__9rhEq",
22
- "positive": "GuidanceBlock-module_positive__m6n-N",
23
- "negative": "GuidanceBlock-module_negative__Z8tj-",
24
- "assertive": "GuidanceBlock-module_assertive__76y6Y",
25
- "informative": "GuidanceBlock-module_informative__QBzhx",
26
- "cautionary": "GuidanceBlock-module_cautionary__iwOA-",
27
- "prominent": "GuidanceBlock-module_prominent__LWMSm",
28
- "inline": "GuidanceBlock-module_inline__Dq-OU",
29
- "stacked": "GuidanceBlock-module_stacked__h3bUz",
30
- "centerContent": "GuidanceBlock-module_centerContent__Cyd34",
31
- "smallScreenTextAlignment": "GuidanceBlock-module_smallScreenTextAlignment__VI-fw"
32
- };
33
- module.exports = styles;
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "rightMargin": "GuidanceBlock-module_rightMargin__gIzig",
5
- "noRightMargin": "GuidanceBlock-module_noRightMargin__xtPiX",
6
- "banner": "GuidanceBlock-module_banner__ng6kh",
7
- "noMaxWidth": "GuidanceBlock-module_noMaxWidth__V-DbD",
8
- "illustrationWrapper": "GuidanceBlock-module_illustrationWrapper__-rRYc",
9
- "illustration": "GuidanceBlock-module_illustration__LpEwu",
10
- "hasSceneIllustration": "GuidanceBlock-module_hasSceneIllustration__HxwOA",
11
- "descriptionContainer": "GuidanceBlock-module_descriptionContainer__N1EEi",
12
- "descriptionAndActions": "GuidanceBlock-module_descriptionAndActions__D206m",
13
- "buttonContainer": "GuidanceBlock-module_buttonContainer__w3vEh",
14
- "hidden": "GuidanceBlock-module_hidden__hgakl",
15
- "headingWrapper": "GuidanceBlock-module_headingWrapper__xqjf-",
16
- "cancel": "GuidanceBlock-module_cancel__0lcBe",
17
- "icon": "GuidanceBlock-module_icon__XVKkH",
18
- "disabled": "GuidanceBlock-module_disabled__tbZPh",
19
- "hover": "GuidanceBlock-module_hover__vs7Wu",
20
- "active": "GuidanceBlock-module_active__eJu5N",
21
- "default": "GuidanceBlock-module_default__W7fnR",
22
- "expert-advice": "GuidanceBlock-module_expert-advice__uGg7D",
23
- "inline": "GuidanceBlock-module_inline__DC0LQ",
24
- "stacked": "GuidanceBlock-module_stacked__2SSuH",
25
- "centerContent": "GuidanceBlock-module_centerContent__pS9uQ",
26
- "smallScreenTextAlignment": "GuidanceBlock-module_smallScreenTextAlignment__iaw5d"
27
- };
28
- module.exports = styles;
@@ -1,4 +0,0 @@
1
- 'use strict';
2
-
3
- var GuidanceBlock = require('./__containers__/GuidanceBlock/v1/GuidanceBlock.cjs');
4
- exports.GuidanceBlock = GuidanceBlock.GuidanceBlock;
@@ -1,4 +0,0 @@
1
- 'use strict';
2
-
3
- var GuidanceBlock = require('./__containers__/GuidanceBlock/v2/GuidanceBlock.cjs');
4
- exports.GuidanceBlock = GuidanceBlock.GuidanceBlock;