@kaizen/components 0.0.0-canary-less-gung-ho-20240308011930 → 0.0.0-canary-brand-2-20240318014153

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 (95) hide show
  1. package/dist/cjs/Brand/Brand.cjs +23 -22
  2. package/dist/cjs/Brand/Brand.cjs.map +1 -1
  3. package/dist/cjs/Icon/ThumbsDownIcon.cjs +2 -1
  4. package/dist/cjs/Icon/ThumbsDownIcon.cjs.map +1 -1
  5. package/dist/cjs/Icon/ThumbsDownOffIcon.cjs +17 -0
  6. package/dist/cjs/Icon/ThumbsDownOffIcon.cjs.map +1 -0
  7. package/dist/cjs/Icon/ThumbsDownOnIcon.cjs +17 -0
  8. package/dist/cjs/Icon/ThumbsDownOnIcon.cjs.map +1 -0
  9. package/dist/cjs/Icon/ThumbsUpIcon.cjs +2 -1
  10. package/dist/cjs/Icon/ThumbsUpIcon.cjs.map +1 -1
  11. package/dist/cjs/Icon/ThumbsUpOffIcon.cjs +17 -0
  12. package/dist/cjs/Icon/ThumbsUpOffIcon.cjs.map +1 -0
  13. package/dist/cjs/Icon/ThumbsUpOnIcon.cjs +17 -0
  14. package/dist/cjs/Icon/ThumbsUpOnIcon.cjs.map +1 -0
  15. package/dist/cjs/KaizenProvider/KaizenProvider.cjs +26 -17
  16. package/dist/cjs/KaizenProvider/KaizenProvider.cjs.map +1 -1
  17. package/dist/cjs/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.cjs +20 -0
  18. package/dist/cjs/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.cjs.map +1 -0
  19. package/dist/cjs/Notification/ToastNotification/context/ToastNotificationContext.cjs +59 -2
  20. package/dist/cjs/Notification/ToastNotification/context/ToastNotificationContext.cjs.map +1 -1
  21. package/dist/cjs/Tag/Tag.cjs +123 -3
  22. package/dist/cjs/Tag/Tag.cjs.map +1 -1
  23. package/dist/cjs/Tag/Tag.module.scss.cjs +38 -0
  24. package/dist/cjs/Tag/Tag.module.scss.cjs.map +1 -0
  25. package/dist/cjs/dts/Icon/ThumbsDownIcon.d.ts +1 -0
  26. package/dist/cjs/dts/Icon/ThumbsDownOffIcon.d.ts +3 -0
  27. package/dist/cjs/dts/Icon/ThumbsDownOnIcon.d.ts +3 -0
  28. package/dist/cjs/dts/Icon/ThumbsUpIcon.d.ts +1 -0
  29. package/dist/cjs/dts/Icon/ThumbsUpOffIcon.d.ts +3 -0
  30. package/dist/cjs/dts/Icon/ThumbsUpOnIcon.d.ts +3 -0
  31. package/dist/cjs/dts/Icon/index.d.ts +4 -0
  32. package/dist/cjs/dts/Tag/Tag.d.ts +4 -0
  33. package/dist/cjs/dts/index.d.ts +1 -0
  34. package/dist/cjs/dts/utils/index.d.ts +1 -0
  35. package/dist/cjs/index.cjs +11 -0
  36. package/dist/cjs/index.cjs.map +1 -1
  37. package/dist/cjs/index.css +53 -53
  38. package/dist/esm/Brand/Brand.mjs +24 -23
  39. package/dist/esm/Brand/Brand.mjs.map +1 -1
  40. package/dist/esm/Icon/ThumbsDownIcon.mjs +2 -1
  41. package/dist/esm/Icon/ThumbsDownIcon.mjs.map +1 -1
  42. package/dist/esm/Icon/ThumbsDownOffIcon.mjs +15 -0
  43. package/dist/esm/Icon/ThumbsDownOffIcon.mjs.map +1 -0
  44. package/dist/esm/Icon/ThumbsDownOnIcon.mjs +15 -0
  45. package/dist/esm/Icon/ThumbsDownOnIcon.mjs.map +1 -0
  46. package/dist/esm/Icon/ThumbsUpIcon.mjs +2 -1
  47. package/dist/esm/Icon/ThumbsUpIcon.mjs.map +1 -1
  48. package/dist/esm/Icon/ThumbsUpOffIcon.mjs +15 -0
  49. package/dist/esm/Icon/ThumbsUpOffIcon.mjs.map +1 -0
  50. package/dist/esm/Icon/ThumbsUpOnIcon.mjs +15 -0
  51. package/dist/esm/Icon/ThumbsUpOnIcon.mjs.map +1 -0
  52. package/dist/esm/KaizenProvider/KaizenProvider.mjs +27 -19
  53. package/dist/esm/KaizenProvider/KaizenProvider.mjs.map +1 -1
  54. package/dist/esm/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.mjs +18 -0
  55. package/dist/esm/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.mjs.map +1 -0
  56. package/dist/esm/Notification/ToastNotification/context/ToastNotificationContext.mjs +60 -4
  57. package/dist/esm/Notification/ToastNotification/context/ToastNotificationContext.mjs.map +1 -1
  58. package/dist/esm/Tag/Tag.mjs +123 -3
  59. package/dist/esm/Tag/Tag.mjs.map +1 -1
  60. package/dist/esm/Tag/Tag.module.scss.mjs +36 -0
  61. package/dist/esm/Tag/Tag.module.scss.mjs.map +1 -0
  62. package/dist/esm/dts/Icon/ThumbsDownIcon.d.ts +1 -0
  63. package/dist/esm/dts/Icon/ThumbsDownOffIcon.d.ts +3 -0
  64. package/dist/esm/dts/Icon/ThumbsDownOnIcon.d.ts +3 -0
  65. package/dist/esm/dts/Icon/ThumbsUpIcon.d.ts +1 -0
  66. package/dist/esm/dts/Icon/ThumbsUpOffIcon.d.ts +3 -0
  67. package/dist/esm/dts/Icon/ThumbsUpOnIcon.d.ts +3 -0
  68. package/dist/esm/dts/Icon/index.d.ts +4 -0
  69. package/dist/esm/dts/Tag/Tag.d.ts +4 -0
  70. package/dist/esm/dts/index.d.ts +1 -0
  71. package/dist/esm/dts/utils/index.d.ts +1 -0
  72. package/dist/esm/index.css +50 -50
  73. package/dist/esm/index.mjs +5 -0
  74. package/dist/esm/index.mjs.map +1 -1
  75. package/dist/index.d.ts +44 -4
  76. package/dist/styles.css +1 -1
  77. package/package.json +4 -3
  78. package/src/Brand/Brand.tsx +20 -17
  79. package/src/Icon/ThumbsDownIcon.tsx +2 -1
  80. package/src/Icon/ThumbsDownOffIcon.tsx +18 -0
  81. package/src/Icon/ThumbsDownOnIcon.tsx +18 -0
  82. package/src/Icon/ThumbsUpIcon.tsx +2 -1
  83. package/src/Icon/ThumbsUpOffIcon.tsx +18 -0
  84. package/src/Icon/ThumbsUpOnIcon.tsx +18 -0
  85. package/src/Icon/_docs/Icon.stories.tsx +31 -37
  86. package/src/Icon/_docs/icon.stories.scss +15 -8
  87. package/src/Icon/index.ts +4 -0
  88. package/src/KaizenProvider/KaizenProvider.tsx +22 -22
  89. package/src/Tag/Tag.tsx +159 -3
  90. package/src/index.ts +1 -0
  91. package/src/utils/index.ts +2 -0
  92. package/dist/cjs/Brand/Brand.module.scss.cjs +0 -7
  93. package/dist/cjs/Brand/Brand.module.scss.cjs.map +0 -1
  94. package/dist/esm/Brand/Brand.module.scss.mjs +0 -5
  95. package/dist/esm/Brand/Brand.module.scss.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "0.0.0-canary-less-gung-ho-20240308011930",
3
+ "version": "0.0.0-canary-brand-2-20240318014153",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -108,10 +108,11 @@
108
108
  "serialize-query-params": "^2.0.2",
109
109
  "svgo": "^3.2.0",
110
110
  "ts-jest": "^29.1.2",
111
+ "ts-node": "^10.9.2",
111
112
  "ts-patch": "^3.1.2",
112
113
  "typescript-transform-paths": "^3.4.7",
113
- "@kaizen/design-tokens": "10.3.18",
114
- "@kaizen/tailwind": "1.2.4"
114
+ "@kaizen/tailwind": "1.2.5",
115
+ "@kaizen/design-tokens": "10.3.19"
115
116
  },
116
117
  "peerDependencies": {
117
118
  "@cultureamp/i18n-react-intl": "^2.5.1",
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1
2
  import React, { HTMLAttributes } from "react"
2
3
  import { assetUrl } from "@kaizen/hosted-assets"
3
4
  import { OverrideClassName } from "~types/OverrideClassName"
@@ -22,23 +23,25 @@ export const Brand = ({
22
23
  }: BrandProps): JSX.Element => {
23
24
  const brandTheme = reversed ? "-reversed" : "-default"
24
25
 
25
- return (
26
- <picture className={classNameOverride} {...restProps}>
27
- <source
28
- srcSet={assetUrl(`brand/${variant}-reversed.svg`)}
29
- media="(forced-colors: active) and (prefers-color-scheme: dark)"
30
- />
31
- <source
32
- srcSet={assetUrl(`brand/${variant}-default.svg`)}
33
- media="(forced-colors: active) and (prefers-color-scheme: light)"
34
- />
35
- <img
36
- src={assetUrl(`brand/${variant}${brandTheme}.svg`)}
37
- alt={alt}
38
- className={styles.img}
39
- />
40
- </picture>
41
- )
26
+ return <div>BrandName</div>
27
+
28
+ // return (
29
+ // <picture className={classNameOverride} {...restProps}>
30
+ // <source
31
+ // srcSet={assetUrl(`brand/${variant}-reversed.svg`)}
32
+ // media="(forced-colors: active) and (prefers-color-scheme: dark)"
33
+ // />
34
+ // <source
35
+ // srcSet={assetUrl(`brand/${variant}-default.svg`)}
36
+ // media="(forced-colors: active) and (prefers-color-scheme: light)"
37
+ // />
38
+ // <img
39
+ // src={assetUrl(`brand/${variant}${brandTheme}.svg`)}
40
+ // alt={alt}
41
+ // className={styles.img}
42
+ // />
43
+ // </picture>
44
+ // )
42
45
  }
43
46
 
44
47
  Brand.displayName = "Brand"
@@ -5,6 +5,7 @@ import React, { useId } from "react"
5
5
  import { SVG } from "~components/Icon/subcomponents/SVG"
6
6
  import type { IconProps } from "~components/Icon/types"
7
7
 
8
+ /** @deprecated Use `<ThumbsDownIconOn/>` or `<ThumbsDownIconOff/>` */
8
9
  export const ThumbsDownIcon = (props: IconProps): JSX.Element => {
9
10
  const uniqueId = useId()
10
11
  const svgContent = (
@@ -12,7 +13,7 @@ export const ThumbsDownIcon = (props: IconProps): JSX.Element => {
12
13
  <defs>
13
14
  <path
14
15
  id={uniqueId}
15
- d="M5.91 3.183c-.566 0-1.05.341-1.254.832L2.597 8.821c-.061.156-.095.32-.095.497v1.364c0 .75.613 1.363 1.363 1.363h4.301L7.52 15.16l-.02.218c0 .28.115.539.3.723l.722.716 4.492-4.493c.245-.245.395-.586.395-.96V4.546c0-.75-.613-1.364-1.363-1.364zm8.862 8.18h2.726v-8.18h-2.726z"
16
+ d="M5.91 3.183c-.566 0-1.05.341-1.254.832L2.597 8.821q-.093.233-.095.497v1.364c0 .75.613 1.363 1.363 1.363h4.301L7.52 15.16l-.02.218c0 .28.115.539.3.723l.722.716 4.492-4.493c.245-.245.395-.586.395-.96V4.546c0-.75-.613-1.364-1.363-1.364zm8.862 8.18h2.726v-8.18h-2.726z"
16
17
  />
17
18
  </defs>
18
19
  <use fill="currentColor" href={`#${uniqueId}`} fillRule="evenodd" />
@@ -0,0 +1,18 @@
1
+ // This file is autogenerated by wrapSVGs.ts
2
+ // Changes to this file will be overwritten
3
+
4
+ import React from "react"
5
+ import { SVG } from "~components/Icon/subcomponents/SVG"
6
+ import type { IconProps } from "~components/Icon/types"
7
+
8
+ export const ThumbsDownOffIcon = (props: IconProps): JSX.Element => {
9
+ const svgContent = (
10
+ <>
11
+ <path
12
+ fill="currentColor"
13
+ d="M5.224 3.253h8.766v10L8.461 18.75l-.705-.705a1 1 0 0 1-.215-.344 1.1 1.1 0 0 1-.086-.403v-.211l.885-3.834H2.756q-.594 0-1.05-.456t-.456-1.05V10.4q0-.13.034-.28a3 3 0 0 1 .075-.281l2.388-5.635q.18-.4.6-.676a1.6 1.6 0 0 1 .877-.276m7.516 1.25H5.224a.4.4 0 0 0-.18.048.3.3 0 0 0-.14.16L2.5 10.337v1.41a.25.25 0 0 0 .072.185.25.25 0 0 0 .184.072H9.92L8.875 16.57l3.865-3.849zm1.25 8.75v-1.25h2.677v-7.5H13.99v-1.25h3.927v10z"
14
+ />
15
+ </>
16
+ )
17
+ return <SVG {...props}>{svgContent}</SVG>
18
+ }
@@ -0,0 +1,18 @@
1
+ // This file is autogenerated by wrapSVGs.ts
2
+ // Changes to this file will be overwritten
3
+
4
+ import React from "react"
5
+ import { SVG } from "~components/Icon/subcomponents/SVG"
6
+ import type { IconProps } from "~components/Icon/types"
7
+
8
+ export const ThumbsDownOnIcon = (props: IconProps): JSX.Element => {
9
+ const svgContent = (
10
+ <>
11
+ <path
12
+ fill="currentColor"
13
+ d="M5.224 3.253h8.253v10L7.95 18.75l-.705-.705a1 1 0 0 1-.216-.344 1.1 1.1 0 0 1-.086-.403v-.211l.885-3.834h-5.07q-.595 0-1.051-.456t-.456-1.05V10.4a1.6 1.6 0 0 1 .109-.561l2.388-5.635q.18-.4.6-.676a1.6 1.6 0 0 1 .877-.276m9.503 10v-10h3.19v10z"
14
+ />
15
+ </>
16
+ )
17
+ return <SVG {...props}>{svgContent}</SVG>
18
+ }
@@ -5,6 +5,7 @@ import React, { useId } from "react"
5
5
  import { SVG } from "~components/Icon/subcomponents/SVG"
6
6
  import type { IconProps } from "~components/Icon/types"
7
7
 
8
+ /** @deprecated Use `<ThumbsUpIconOn/>` or `<ThumbsUpIconOff/>` */
8
9
  export const ThumbsUpIcon = (props: IconProps): JSX.Element => {
9
10
  const uniqueId = useId()
10
11
  const svgContent = (
@@ -12,7 +13,7 @@ export const ThumbsUpIcon = (props: IconProps): JSX.Element => {
12
13
  <defs>
13
14
  <path
14
15
  id={uniqueId}
15
- d="M5.228 16.817v-8.18H2.502v8.18zm10.907-8.862h-4.301l.647-3.115.02-.218c0-.28-.115-.539-.3-.723l-.722-.716-4.485 4.493a1.333 1.333 0 0 0-.402.96v6.817c0 .75.613 1.364 1.363 1.364h6.135c.566 0 1.05-.341 1.254-.832l2.059-4.806c.061-.156.095-.32.095-.497V9.318c0-.75-.613-1.363-1.363-1.363"
16
+ d="M5.228 16.817v-8.18H2.502v8.18zm10.907-8.862h-4.301l.647-3.115.02-.218c0-.28-.115-.539-.3-.723l-.722-.716-4.485 4.493a1.33 1.33 0 0 0-.402.96v6.817c0 .75.613 1.364 1.363 1.364h6.135c.566 0 1.05-.341 1.254-.832l2.059-4.806q.093-.233.095-.497V9.318c0-.75-.613-1.363-1.363-1.363"
16
17
  />
17
18
  </defs>
18
19
  <use fill="currentColor" href={`#${uniqueId}`} fillRule="evenodd" />
@@ -0,0 +1,18 @@
1
+ // This file is autogenerated by wrapSVGs.ts
2
+ // Changes to this file will be overwritten
3
+
4
+ import React from "react"
5
+ import { SVG } from "~components/Icon/subcomponents/SVG"
6
+ import type { IconProps } from "~components/Icon/types"
7
+
8
+ export const ThumbsUpOffIcon = (props: IconProps): JSX.Element => {
9
+ const svgContent = (
10
+ <>
11
+ <path
12
+ fill="currentColor"
13
+ d="M14.776 17.083H6.01v-10l5.529-5.496.705.705q.13.129.215.344.086.213.086.403v.211l-.885 3.833h5.584q.594 0 1.05.456t.456 1.05v1.347q0 .13-.034.28-.033.15-.075.28l-2.388 5.635q-.18.401-.6.677a1.6 1.6 0 0 1-.877.275m-7.516-1.25h7.516a.4.4 0 0 0 .18-.048.3.3 0 0 0 .14-.16L17.5 10V8.59a.25.25 0 0 0-.072-.184.25.25 0 0 0-.184-.073H10.08l1.045-4.567-3.865 3.85zm-1.25-8.75v1.25H3.333v7.5H6.01v1.25H2.083v-10z"
14
+ />
15
+ </>
16
+ )
17
+ return <SVG {...props}>{svgContent}</SVG>
18
+ }
@@ -0,0 +1,18 @@
1
+ // This file is autogenerated by wrapSVGs.ts
2
+ // Changes to this file will be overwritten
3
+
4
+ import React from "react"
5
+ import { SVG } from "~components/Icon/subcomponents/SVG"
6
+ import type { IconProps } from "~components/Icon/types"
7
+
8
+ export const ThumbsUpOnIcon = (props: IconProps): JSX.Element => {
9
+ const svgContent = (
10
+ <>
11
+ <path
12
+ fill="currentColor"
13
+ d="M14.776 17.083H6.522v-10l5.53-5.496.704.705q.13.129.216.344.086.213.086.403v.211l-.885 3.833h5.07q.595 0 1.051.456t.456 1.05v1.347a1.6 1.6 0 0 1-.109.56l-2.388 5.635q-.18.401-.6.677a1.6 1.6 0 0 1-.877.275m-9.504-10v10H2.083v-10z"
14
+ />
15
+ </>
16
+ )
17
+ return <SVG {...props}>{svgContent}</SVG>
18
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react"
2
2
  import { Meta, StoryObj } from "@storybook/react"
3
3
  import * as ICONS from "~components/Icon"
4
- import { SearchField } from "~components/SearchField"
4
+ import { Text } from "~components/Text"
5
5
  import { Tag } from "~components/__future__/Tag"
6
6
  import { AddIcon } from "../index"
7
7
  import styles from "./icon.stories.scss"
@@ -63,12 +63,17 @@ const ReferenceButton = ({
63
63
  <li key={iconName}>
64
64
  <button type="button" className={styles.button} onClick={handleCopy}>
65
65
  {copied ? (
66
- <Tag color="green" classNameOverride={styles.tag}>
67
- Copied!
68
- </Tag>
66
+ <span className={styles.copiedTag}>
67
+ <Tag color="green" classNameOverride={styles.tag}>
68
+ Copied!
69
+ </Tag>
70
+ </span>
69
71
  ) : (
70
72
  <>
71
- {icon} {iconName}
73
+ <span className={styles.icon}>{icon}</span>
74
+ <Text variant="small" tag="span">
75
+ {iconName}
76
+ </Text>
72
77
  </>
73
78
  )}
74
79
  </button>
@@ -76,39 +81,28 @@ const ReferenceButton = ({
76
81
  )
77
82
  }
78
83
 
79
- export const Reference: Story = {
80
- render: () => {
81
- const [searchTerm, setSearchTerm] = useState<string>("")
84
+ /**
85
+ * Deprecated icons will still exist in as a React component but have been removed from the assets folder
86
+ * This will remove them from the documentation but give us time to remove them in the next major
87
+ */
88
+ const deprecatedList: string[] = ["ThumbsUpIcon", "ThumbsDownIcon"]
82
89
 
83
- return (
84
- <div className="flex flex-col gap-16">
85
- <SearchField
86
- labelText="Find icon by name"
87
- onChange={event => {
88
- setSearchTerm(event.target.value)
89
- }}
90
- />
91
- <ul className={styles.grid}>
92
- {Object.keys(ICONS)
93
- .filter(iconName => {
94
- const term = new RegExp(searchTerm, "i")
95
- return iconName.match(term)
90
+ export const Reference: Story = {
91
+ render: () => (
92
+ <div className="flex flex-col gap-16">
93
+ <ul className={styles.grid}>
94
+ {Object.keys(ICONS)
95
+ .filter(iconName => !deprecatedList.includes(iconName))
96
+ .map(iconName => {
97
+ const icon = ICONS[iconName as keyof typeof ICONS]({
98
+ role: "presentation",
96
99
  })
97
- .map(iconName => {
98
- const icon = ICONS[iconName as keyof typeof ICONS]({
99
- role: "presentation",
100
- })
101
100
 
102
- return (
103
- <ReferenceButton
104
- key={iconName}
105
- icon={icon}
106
- iconName={iconName}
107
- />
108
- )
109
- })}
110
- </ul>
111
- </div>
112
- )
113
- },
101
+ return (
102
+ <ReferenceButton key={iconName} icon={icon} iconName={iconName} />
103
+ )
104
+ })}
105
+ </ul>
106
+ </div>
107
+ ),
114
108
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  .grid {
4
4
  display: grid;
5
- grid-template-columns: repeat(6, 1fr);
6
- grid-template-rows: repeat(6, 1fr);
5
+ grid-template-columns: repeat(6, 150px);
6
+ grid-template-rows: min-content;
7
7
  grid-gap: var(--spacing-8);
8
8
  margin: 0;
9
9
  padding: 0;
@@ -13,14 +13,13 @@
13
13
  .button {
14
14
  @include button-reset;
15
15
 
16
- display: flex;
16
+ display: inline-flex;
17
17
  flex-direction: column;
18
18
  align-items: center;
19
- justify-content: center;
20
- gap: var(--spacing-16);
21
- padding: var(--spacing-8);
22
- width: 150px;
23
- height: 100px;
19
+ gap: var(--spacing-8);
20
+ padding: var(--spacing-16);
21
+ width: 100%;
22
+ height: 100%;
24
23
  background-color: var(--color-gray-100);
25
24
  border-radius: var(--border-solid-border-radius);
26
25
  word-break: break-all;
@@ -31,6 +30,14 @@
31
30
  }
32
31
  }
33
32
 
33
+ .copiedTag {
34
+ margin: auto;
35
+ }
36
+
37
+ .icon {
38
+ margin-bottom: var(--spacing-8);
39
+ }
40
+
34
41
  .tag {
35
42
  border: 1px solid var(--color-green-500);
36
43
  }
package/src/Icon/index.ts CHANGED
@@ -217,7 +217,11 @@ export * from "./TemplateWhiteIcon"
217
217
  export * from "./TextAnalyticsIcon"
218
218
  export * from "./TextAnalyticsWhiteIcon"
219
219
  export * from "./ThumbsDownIcon"
220
+ export * from "./ThumbsDownOffIcon"
221
+ export * from "./ThumbsDownOnIcon"
220
222
  export * from "./ThumbsUpIcon"
223
+ export * from "./ThumbsUpOffIcon"
224
+ export * from "./ThumbsUpOnIcon"
221
225
  export * from "./TimeIcon"
222
226
  export * from "./TimeWhiteIcon"
223
227
  export * from "./TranslationIcon"
@@ -1,8 +1,8 @@
1
- import React from "react"
2
- // import { ToastNotificationsList } from "~components/Notification"
3
- // import { ToastNotificationProvider } from "~components/Notification/ToastNotification/context/ToastNotificationContext"
1
+ import React, { useEffect, useState } from "react"
2
+ import { ToastNotificationsList } from "~components/Notification"
3
+ import { ToastNotificationProvider } from "~components/Notification/ToastNotification/context/ToastNotificationContext"
4
4
  import { FontDefinitions } from "./subcomponents/FontDefinitions"
5
- // import { OptionalIntlProvider } from "./subcomponents/OptionalIntlProvider"
5
+ import { OptionalIntlProvider } from "./subcomponents/OptionalIntlProvider"
6
6
 
7
7
  export type KaizenProviderProps = {
8
8
  children: React.ReactNode
@@ -12,30 +12,30 @@ export type KaizenProviderProps = {
12
12
  export const KaizenProvider = ({
13
13
  children,
14
14
  locale = "en",
15
- }: KaizenProviderProps): JSX.Element =>
16
- // const [documentIsAvailable, setDocumentIsAvailable] = useState<boolean>(false)
17
- // const [notificationsList, setNotificationsList] = useState<JSX.Element>()
15
+ }: KaizenProviderProps): JSX.Element => {
16
+ const [documentIsAvailable, setDocumentIsAvailable] = useState<boolean>(false)
17
+ const [notificationsList, setNotificationsList] = useState<JSX.Element>()
18
18
 
19
- // useEffect(() => {
20
- // // SSR does not have a document, which is required for ToastNotificationsList.
21
- // // Await document render before rendering the component.
22
- // if (document !== undefined) {
23
- // setNotificationsList(<ToastNotificationsList />)
24
- // setDocumentIsAvailable(true)
25
- // }
26
- // }, [documentIsAvailable])
19
+ useEffect(() => {
20
+ // SSR does not have a document, which is required for ToastNotificationsList.
21
+ // Await document render before rendering the component.
22
+ if (document !== undefined) {
23
+ setNotificationsList(<ToastNotificationsList />)
24
+ setDocumentIsAvailable(true)
25
+ }
26
+ }, [documentIsAvailable])
27
27
 
28
- (
29
- // <OptionalIntlProvider locale={locale}>
28
+ return (
29
+ <OptionalIntlProvider locale={locale}>
30
30
  <>
31
- {/* <ToastNotificationProvider> */}
32
- {/* {notificationsList} */}
31
+ <ToastNotificationProvider>
32
+ {notificationsList}
33
33
  {children}
34
- {/* </ToastNotificationProvider> */}
34
+ </ToastNotificationProvider>
35
35
  <FontDefinitions />
36
36
  </>
37
- // </OptionalIntlProvider>
37
+ </OptionalIntlProvider>
38
38
  )
39
-
39
+ }
40
40
 
41
41
  KaizenProvider.displayName = "KaizenProvider"
package/src/Tag/Tag.tsx CHANGED
@@ -1,6 +1,16 @@
1
1
  import React from "react"
2
- import { AvatarProps } from "~components/Avatar"
2
+ import classnames from "classnames"
3
+ import { Avatar, AvatarProps } from "~components/Avatar"
4
+ import {
5
+ CautionIcon,
6
+ ClearIcon,
7
+ ExclamationIcon,
8
+ InformationIcon,
9
+ LiveIcon,
10
+ SuccessIcon,
11
+ } from "~components/Icon"
3
12
  import { TagVariants } from "./types"
13
+ import styles from "./Tag.module.scss"
4
14
 
5
15
  export type TagWithAvatarProps = Omit<DefaultTagProps, "variant"> & {
6
16
  variant: "profile"
@@ -23,9 +33,155 @@ export interface DefaultTagProps {
23
33
 
24
34
  export type TagProps = DefaultTagProps | TagWithAvatarProps
25
35
 
36
+ const isJSXElement = (
37
+ imageElementOrAvatarProps: JSX.Element | AvatarProps
38
+ ): imageElementOrAvatarProps is JSX.Element =>
39
+ "props" in imageElementOrAvatarProps
40
+
41
+ const renderAvatar = (
42
+ imageElementOrAvatarProps: JSX.Element | AvatarProps
43
+ ): JSX.Element =>
44
+ isJSXElement(imageElementOrAvatarProps) ? (
45
+ <>{imageElementOrAvatarProps}</>
46
+ ) : (
47
+ <Avatar {...imageElementOrAvatarProps} size="small" />
48
+ )
49
+
50
+ /**
51
+ * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081928978/Tags Guidance} |
52
+ * {@link https://cultureamp.design/?path=/docs/components-tag--docs Storybook}
53
+ */
26
54
  export const Tag = (props: TagProps): JSX.Element => {
27
- const { variant = "default" } = props
28
- return <div>Testing Tag component {variant}</div>
55
+ const {
56
+ children,
57
+ variant = "default",
58
+ size = "medium",
59
+ inline = false,
60
+ dismissible = false,
61
+ onDismiss,
62
+ onMouseDown,
63
+ onMouseLeave,
64
+ truncateWidth,
65
+ } = props
66
+
67
+ const isTruncated = truncateWidth && truncateWidth > 0
68
+ const canShowIcon = size === "medium"
69
+ return (
70
+ <div
71
+ className={classnames(
72
+ styles.root,
73
+ styles[variant],
74
+ variant === "profile" && styles.default,
75
+ styles[size],
76
+ inline && styles.inline,
77
+ dismissible && styles.dismissible
78
+ )}
79
+ >
80
+ <div className={styles.layoutContainer}>
81
+ <>
82
+ {canShowIcon &&
83
+ ((): JSX.Element | void => {
84
+ switch (props.variant) {
85
+ case "validationPositive":
86
+ return (
87
+ <span className={styles.validationIcon}>
88
+ <SuccessIcon role="presentation" />
89
+ </span>
90
+ )
91
+ case "validationNegative":
92
+ return (
93
+ <span className={styles.validationIcon}>
94
+ <ExclamationIcon role="presentation" />
95
+ </span>
96
+ )
97
+ case "validationCautionary":
98
+ return (
99
+ <span className={styles.validationIcon}>
100
+ <CautionIcon role="presentation" />
101
+ </span>
102
+ )
103
+ case "validationInformative":
104
+ return (
105
+ <span className={styles.validationIcon}>
106
+ <InformationIcon role="presentation" />
107
+ </span>
108
+ )
109
+ case "profile":
110
+ return (
111
+ <span className={styles.profile}>
112
+ {props.avatar && renderAvatar(props.avatar)}
113
+ </span>
114
+ )
115
+ default:
116
+ return
117
+ }
118
+ })()}
119
+ <span
120
+ className={classnames(
121
+ styles.textContent,
122
+ isTruncated && styles.truncate
123
+ )}
124
+ style={{
125
+ maxWidth: isTruncated ? truncateWidth : undefined,
126
+ }}
127
+ >
128
+ {children}
129
+ </span>
130
+ {dismissible && (
131
+ <>
132
+ <button
133
+ type="button"
134
+ className={styles.dismissButton}
135
+ onClick={onDismiss}
136
+ onMouseDown={onMouseDown}
137
+ onMouseLeave={onMouseLeave}
138
+ >
139
+ <div className={styles.iconWrapper}>
140
+ <ClearIcon inheritSize role="img" aria-label="Dismiss" />
141
+ </div>
142
+ </button>
143
+ </>
144
+ )}
145
+ {variant === "statusLive" && (
146
+ <span className={styles.liveIcon}>
147
+ <LiveIcon
148
+ role="presentation"
149
+ classNameOverride={styles.liveIcon_base}
150
+ width="16"
151
+ height="16"
152
+ viewBox="0 0 16 16"
153
+ fill="none"
154
+ />
155
+ <LiveIcon
156
+ role="presentation"
157
+ classNameOverride={styles.liveIcon_1}
158
+ width="16"
159
+ height="16"
160
+ viewBox="0 0 16 16"
161
+ fill="none"
162
+ />
163
+ <LiveIcon
164
+ role="presentation"
165
+ classNameOverride={styles.liveIcon_2}
166
+ width="16"
167
+ height="16"
168
+ viewBox="0 0 16 16"
169
+ fill="none"
170
+ />
171
+ <LiveIcon
172
+ role="presentation"
173
+ classNameOverride={styles.liveIcon_3}
174
+ width="16"
175
+ height="16"
176
+ viewBox="0 0 16 16"
177
+ fill="none"
178
+ />
179
+ </span>
180
+ )}
181
+ </>
182
+ </div>
183
+ </div>
184
+ )
29
185
  }
30
186
 
31
187
  Tag.displayName = "Tag"
package/src/index.ts CHANGED
@@ -57,6 +57,7 @@ export * from "./TimeField"
57
57
  export * from "./TitleBlockZen"
58
58
  export * from "./ToggleSwitch"
59
59
  export * from "./Tooltip"
60
+ export * from "./utils"
60
61
  export * from "./VisuallyHidden"
61
62
  export * from "./Well"
62
63
  export * from "./Workflow"
@@ -0,0 +1,2 @@
1
+ // Not all utils are exported because most are intended for internal use only
2
+ export * from "./useMediaQueries"
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "img": "Brand-module_img__uWvra"
5
- };
6
- module.exports = styles;
7
- //# sourceMappingURL=Brand.module.scss.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Brand.module.scss.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1,5 +0,0 @@
1
- var styles = {
2
- "img": "Brand-module_img__uWvra"
3
- };
4
- export { styles as default };
5
- //# sourceMappingURL=Brand.module.scss.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Brand.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}