@sproutsocial/racine 11.1.2-beta.0 → 11.2.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 (189) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/__flow__/Badge/constants.js +48 -0
  3. package/__flow__/Badge/index.js +59 -32
  4. package/__flow__/Badge/index.stories.js +35 -42
  5. package/__flow__/Badge/index.test.js +34 -32
  6. package/__flow__/Badge/styles.js +22 -42
  7. package/__flow__/themes/dark/theme.js +1 -0
  8. package/__flow__/themes/light/literal-colors.js +2 -0
  9. package/__flow__/themes/light/theme.js +1 -0
  10. package/__flow__/types/theme.colors.flow.js +27 -0
  11. package/commonjs/Avatar/index.js +4 -7
  12. package/commonjs/Badge/constants.js +43 -0
  13. package/commonjs/Badge/index.js +39 -39
  14. package/commonjs/Badge/styles.js +16 -32
  15. package/commonjs/Banner/index.js +1 -3
  16. package/commonjs/Banner/styles.js +1 -1
  17. package/commonjs/Box/styles.js +1 -1
  18. package/commonjs/Breadcrumb/index.js +2 -5
  19. package/commonjs/Button/index.js +1 -3
  20. package/commonjs/Card/index.js +1 -3
  21. package/commonjs/Card/styles.js +3 -3
  22. package/commonjs/CharacterCounter/index.js +1 -3
  23. package/commonjs/CharacterCounter/styles.js +1 -1
  24. package/commonjs/ChartLegend/index.js +1 -3
  25. package/commonjs/ChartLegend/styles.js +3 -3
  26. package/commonjs/Checkbox/index.js +1 -3
  27. package/commonjs/Checkbox/styles.js +1 -1
  28. package/commonjs/Collapsible/index.js +2 -5
  29. package/commonjs/DatePicker/DateRangePicker.js +1 -3
  30. package/commonjs/DatePicker/SingleDatePicker.js +1 -3
  31. package/commonjs/DatePicker/StatefulDateRangePicker.js +1 -3
  32. package/commonjs/DatePicker/StatefulSingleDatePicker.js +1 -3
  33. package/commonjs/DatePicker/common.js +1 -1
  34. package/commonjs/DatePicker/styles.js +6 -2
  35. package/commonjs/Drawer/SlideTransition.js +1 -3
  36. package/commonjs/Drawer/index.js +4 -9
  37. package/commonjs/Drawer/styles.js +2 -2
  38. package/commonjs/EmptyState/index.js +1 -3
  39. package/commonjs/Fieldset/index.js +3 -7
  40. package/commonjs/FormField/index.js +1 -3
  41. package/commonjs/Icon/index.js +2 -5
  42. package/commonjs/Icon/styles.js +1 -1
  43. package/commonjs/Image/index.js +1 -3
  44. package/commonjs/Image/styles.js +1 -1
  45. package/commonjs/Indicator/index.js +1 -3
  46. package/commonjs/Input/index.js +1 -3
  47. package/commonjs/Input/styles.js +2 -2
  48. package/commonjs/KeyboardKey/index.js +1 -3
  49. package/commonjs/Label/index.js +2 -4
  50. package/commonjs/Link/index.js +1 -3
  51. package/commonjs/Link/styles.js +1 -1
  52. package/commonjs/Listbox/index.js +4 -7
  53. package/commonjs/Loader/index.js +1 -3
  54. package/commonjs/Loader/styles.js +2 -2
  55. package/commonjs/LoaderButton/index.js +1 -3
  56. package/commonjs/Menu/constants.js +1 -1
  57. package/commonjs/Menu/descendants.js +7 -10
  58. package/commonjs/Menu/hooks.js +1 -1
  59. package/commonjs/Menu/index.js +16 -22
  60. package/commonjs/Menu/styles.js +2 -2
  61. package/commonjs/Message/index.js +1 -3
  62. package/commonjs/Message/styles.js +1 -1
  63. package/commonjs/Modal/index.js +3 -7
  64. package/commonjs/Modal/styles.js +6 -4
  65. package/commonjs/Numeral/constants.js +1 -1
  66. package/commonjs/Numeral/index.js +1 -3
  67. package/commonjs/Numeral/styles.js +3 -3
  68. package/commonjs/OverflowList/styles.js +1 -1
  69. package/commonjs/Popout/index.js +3 -7
  70. package/commonjs/Popout/styles.js +1 -1
  71. package/commonjs/Radio/index.js +1 -3
  72. package/commonjs/Radio/styles.js +4 -4
  73. package/commonjs/SegmentedControl/index.js +2 -5
  74. package/commonjs/Select/index.js +1 -3
  75. package/commonjs/Stack/index.js +1 -3
  76. package/commonjs/Switch/index.js +1 -3
  77. package/commonjs/Switch/styles.js +1 -1
  78. package/commonjs/Table/index.js +5 -10
  79. package/commonjs/TableCell/index.js +1 -3
  80. package/commonjs/TableHeaderCell/index.js +1 -3
  81. package/commonjs/TableRowAccordion/index.js +1 -3
  82. package/commonjs/Tabs/index.js +2 -5
  83. package/commonjs/Tabs/styles.js +4 -4
  84. package/commonjs/Text/index.js +1 -3
  85. package/commonjs/Text/styles.js +1 -1
  86. package/commonjs/Textarea/index.js +1 -3
  87. package/commonjs/Toast/index.js +15 -15
  88. package/commonjs/Toast/styles.js +7 -4
  89. package/commonjs/ToggleHint/index.js +1 -3
  90. package/commonjs/Token/index.js +1 -3
  91. package/commonjs/Token/styles.js +1 -1
  92. package/commonjs/TokenInput/index.js +1 -3
  93. package/commonjs/Tooltip/index.js +2 -5
  94. package/commonjs/Tooltip/styles.js +1 -1
  95. package/commonjs/VisuallyHidden/index.js +1 -1
  96. package/commonjs/index.js +1 -1
  97. package/commonjs/themes/dark/decorative-palettes.js +1 -1
  98. package/commonjs/themes/dark/theme.js +1 -1
  99. package/commonjs/themes/light/decorative-palettes.js +1 -1
  100. package/commonjs/themes/light/literal-colors.js +4 -2
  101. package/commonjs/themes/light/theme.js +1 -1
  102. package/commonjs/types/theme.colors.flow.js +2 -0
  103. package/commonjs/utils/hooks.js +2 -3
  104. package/commonjs/utils/mixins.js +1 -1
  105. package/commonjs/utils/system-props.js +1 -1
  106. package/dist/themes/dark/dark.scss +9 -7
  107. package/dist/themes/light/light.scss +99 -97
  108. package/lib/Avatar/index.js +4 -7
  109. package/lib/Badge/constants.js +38 -0
  110. package/lib/Badge/index.js +37 -40
  111. package/lib/Badge/styles.js +13 -28
  112. package/lib/Banner/index.js +1 -3
  113. package/lib/Banner/styles.js +1 -1
  114. package/lib/Box/styles.js +1 -1
  115. package/lib/Breadcrumb/index.js +2 -5
  116. package/lib/Button/index.js +1 -3
  117. package/lib/Card/index.js +1 -3
  118. package/lib/Card/styles.js +2 -2
  119. package/lib/CharacterCounter/index.js +1 -3
  120. package/lib/CharacterCounter/styles.js +1 -1
  121. package/lib/ChartLegend/index.js +1 -3
  122. package/lib/ChartLegend/styles.js +3 -3
  123. package/lib/Checkbox/index.js +1 -3
  124. package/lib/Collapsible/index.js +2 -5
  125. package/lib/DatePicker/DateRangePicker.js +1 -3
  126. package/lib/DatePicker/SingleDatePicker.js +1 -3
  127. package/lib/DatePicker/StatefulDateRangePicker.js +1 -3
  128. package/lib/DatePicker/StatefulSingleDatePicker.js +1 -3
  129. package/lib/DatePicker/styles.js +6 -2
  130. package/lib/Drawer/SlideTransition.js +1 -3
  131. package/lib/Drawer/index.js +4 -9
  132. package/lib/Drawer/styles.js +2 -2
  133. package/lib/EmptyState/index.js +1 -3
  134. package/lib/Fieldset/index.js +3 -7
  135. package/lib/FormField/index.js +1 -3
  136. package/lib/Icon/index.js +2 -5
  137. package/lib/Icon/styles.js +1 -1
  138. package/lib/Image/index.js +1 -3
  139. package/lib/Image/styles.js +1 -1
  140. package/lib/Indicator/index.js +1 -3
  141. package/lib/Input/index.js +1 -3
  142. package/lib/Input/styles.js +2 -2
  143. package/lib/KeyboardKey/index.js +1 -3
  144. package/lib/Label/index.js +2 -4
  145. package/lib/Link/index.js +1 -3
  146. package/lib/Link/styles.js +1 -1
  147. package/lib/Listbox/index.js +3 -6
  148. package/lib/Loader/index.js +1 -3
  149. package/lib/Loader/styles.js +2 -2
  150. package/lib/LoaderButton/index.js +1 -3
  151. package/lib/Menu/descendants.js +2 -5
  152. package/lib/Menu/index.js +16 -20
  153. package/lib/Menu/styles.js +2 -2
  154. package/lib/Message/index.js +1 -3
  155. package/lib/Modal/index.js +3 -7
  156. package/lib/Modal/styles.js +5 -3
  157. package/lib/Numeral/index.js +1 -3
  158. package/lib/Numeral/styles.js +2 -2
  159. package/lib/OverflowList/styles.js +1 -1
  160. package/lib/Popout/index.js +3 -7
  161. package/lib/Popout/styles.js +1 -1
  162. package/lib/Radio/index.js +1 -3
  163. package/lib/Radio/styles.js +4 -4
  164. package/lib/SegmentedControl/index.js +2 -5
  165. package/lib/Select/index.js +1 -3
  166. package/lib/Stack/index.js +1 -3
  167. package/lib/Switch/index.js +1 -3
  168. package/lib/Switch/styles.js +1 -1
  169. package/lib/Table/index.js +4 -9
  170. package/lib/TableCell/index.js +1 -3
  171. package/lib/TableHeaderCell/index.js +1 -3
  172. package/lib/TableRowAccordion/index.js +1 -3
  173. package/lib/Tabs/index.js +2 -5
  174. package/lib/Tabs/styles.js +3 -3
  175. package/lib/Text/index.js +1 -3
  176. package/lib/Text/styles.js +1 -1
  177. package/lib/Textarea/index.js +1 -3
  178. package/lib/Toast/index.js +14 -14
  179. package/lib/Toast/styles.js +7 -3
  180. package/lib/ToggleHint/index.js +1 -3
  181. package/lib/Token/index.js +1 -3
  182. package/lib/Token/styles.js +1 -1
  183. package/lib/TokenInput/index.js +1 -3
  184. package/lib/Tooltip/index.js +2 -5
  185. package/lib/Tooltip/styles.js +1 -1
  186. package/lib/VisuallyHidden/index.js +1 -1
  187. package/lib/themes/light/literal-colors.js +4 -2
  188. package/lib/types/theme.colors.flow.js +2 -1
  189. package/package.json +1 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 11.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6968733: adds deprecation messaging to typeProps to be displayed on seeds page
8
+
9
+ ## 11.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - a71a431: backwards compatible style and api changes to the badge component
14
+
15
+ ## 11.1.2
16
+
17
+ ### Patch Changes
18
+
19
+ - 81f95bc: Add flow support for newer colors in theme
20
+
3
21
  ## 11.1.1
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,48 @@
1
+ //@flow
2
+
3
+ const defaultPurple = {
4
+ color: "colors.text.body",
5
+ background: "colors.container.background.decorative.purple",
6
+ };
7
+
8
+ const suggestion = {
9
+ color: "colors.text.body",
10
+ background: "colors.container.background.decorative.blue",
11
+ };
12
+
13
+ const passive = {
14
+ color: "colors.text.body",
15
+ background: "colors.container.background.decorative.neutral",
16
+ };
17
+
18
+ const primary = {
19
+ color: "colors.text.body",
20
+ background: "colors.container.background.decorative.blue",
21
+ };
22
+
23
+ const secondary = {
24
+ color: "colors.text.body",
25
+ background: "colors.container.background.decorative.yellow",
26
+ };
27
+
28
+ const common = {
29
+ color: "colors.text.inverse",
30
+ background: "colors.aqua.600",
31
+ };
32
+
33
+ const approval = {
34
+ color: "colors.text.body",
35
+ background: "colors.container.background.decorative.orange",
36
+ };
37
+
38
+ //Deprecated former "types"
39
+
40
+ export const legacyBadgeColors = {
41
+ primary,
42
+ secondary,
43
+ passive,
44
+ common,
45
+ approval,
46
+ default: defaultPurple,
47
+ suggestion,
48
+ };
@@ -1,43 +1,70 @@
1
1
  // @flow
2
2
  import * as React from "react";
3
+ import Icon from "../Icon";
3
4
  import Container from "./styles";
5
+ import Box from "../Box";
4
6
 
5
7
  type TypeProps = {
8
+ children?: React.Node,
9
+ /** DEPRECATED: Use children instead of text */
6
10
  text: React.Node,
7
- type:
8
- | "primary"
9
- | "secondary"
10
- | "passive"
11
- | "common"
12
- | "approval"
13
- | "default"
14
- | "suggestion",
15
- size: "default" | "small",
11
+ /** Size default is deprecated in favor of small and large */
12
+ size?: "small" | "large" | "default",
13
+ badgeColor?:
14
+ | "green"
15
+ | "blue"
16
+ | "purple"
17
+ | "yellow"
18
+ | "orange"
19
+ | "red"
20
+ | "neutral",
21
+ iconName?: string,
22
+ /** DEPRECATED: Possibly only used for testing. Refrain from using at all if possible. (optional) */
16
23
  tip?: React.Node,
24
+ /** DEPRECATED: The legacy method of choosing a theme. Use badgeColor instead. (optional) */
25
+ type?: string,
17
26
  };
18
27
 
19
- export default class Badge extends React.Component<TypeProps> {
20
- static defaultProps = {
21
- type: "primary",
22
- size: "default",
23
- };
24
-
25
- render() {
26
- const { size, type, tip, text, ...rest } = this.props;
27
-
28
- return (
29
- <Container
30
- type={type}
31
- small={size === "small"}
32
- data-tip={tip}
33
- data-qa-badge={text || ""}
34
- data-qa-badge-type={type}
35
- data-qa-badge-tip={tip || ""}
36
- // $FlowIssue - upgrade v0.112.0
37
- {...rest}
38
- >
39
- {text}
40
- </Container>
28
+ const Badge = ({
29
+ children,
30
+ text,
31
+ iconName,
32
+ type,
33
+ tip,
34
+ size = "small",
35
+ badgeColor = "blue",
36
+ ...rest
37
+ }: TypeProps) => {
38
+ if (children && text) {
39
+ throw new Error(
40
+ "can't use both `children` and `text` props. Text is deprecated, consider using children."
41
41
  );
42
42
  }
43
- }
43
+
44
+ return (
45
+ <Container
46
+ {...rest}
47
+ // size previously included default, which currently maps to small. Once consumers have updated this can be simplified.
48
+ size={size === "default" ? "large" : size}
49
+ badgeColor={badgeColor}
50
+ data-tip={tip}
51
+ data-qa-badge={text || ""}
52
+ data-qa-badge-type={type}
53
+ data-qa-badge-tip={tip || ""}
54
+ type={type && type}
55
+ >
56
+ <Box display="flex" alignItems="center" JustifyContent="center">
57
+ {iconName ? (
58
+ <Icon
59
+ mr={200}
60
+ name={iconName}
61
+ size={size === "small" ? "mini" : "default"}
62
+ />
63
+ ) : null}
64
+ {children || text}
65
+ </Box>
66
+ </Container>
67
+ );
68
+ };
69
+
70
+ export default Badge;
@@ -1,53 +1,46 @@
1
1
  import React from "react";
2
- import { text } from "@storybook/addon-knobs";
3
2
  import Badge from "./index";
3
+ import Box from "../Box";
4
+ import Numeral from "../Numeral";
5
+ import Text from "../Text";
6
+ import Stack from "../Stack";
4
7
 
5
8
  export default {
6
9
  title: "Badge",
7
10
  };
8
11
 
9
12
  export const permutations = () => (
10
- <>
11
- <Badge
12
- text={text("text", "Test")}
13
- type="default"
14
- size={text("size", "small")}
15
- />
16
- <Badge text={text("text", "Test")} size={text("size", "small")} />
17
- <Badge
18
- text={text("text", "Test")}
19
- type="secondary"
20
- size={text("size", "small")}
21
- />
22
- <Badge
23
- text={text("text", "Test")}
24
- type="passive"
25
- size={text("size", "small")}
26
- />
27
- <Badge
28
- text={text("text", "Test")}
29
- type="common"
30
- size={text("size", "small")}
31
- />
32
- <Badge
33
- text={text("text", "Test")}
34
- type="approval"
35
- size={text("size", "small")}
36
- />
37
- <Badge
38
- text={text("text", "Test")}
39
- type="suggestion"
40
- size={text("size", "small")}
41
- />
42
-
43
- <Badge text={text("text", "Test")} type="default" />
44
- <Badge text={text("text", "Test")} />
45
- <Badge text={text("text", "Test")} type="secondary" />
46
- <Badge text={text("text", "Test")} type="passive" />
47
- <Badge text={text("text", "Test")} type="common" />
48
- <Badge text={text("text", "Test")} type="approval" />
49
- <Badge text={text("text", "Test")} type="suggestion" />
50
- </>
13
+ <Stack space={450}>
14
+ <Box display="flex" alignItems="center">
15
+ <Badge badgeColor="green">Badge</Badge>
16
+ <Badge>Badge</Badge>
17
+ <Badge badgeColor="purple">Badge</Badge>
18
+ <Badge badgeColor="yellow">Badge</Badge>
19
+ <Badge badgeColor="orange">Badge</Badge>
20
+ <Badge badgeColor="red">Badge</Badge>
21
+ <Badge badgeColor="neutral" iconName="atom">
22
+ Badge
23
+ </Badge>
24
+ <Badge
25
+ size="small"
26
+ type="default"
27
+ bg="chartreuse"
28
+ color="crimson"
29
+ p={500}
30
+ >
31
+ Radical overrides!
32
+ </Badge>
33
+ </Box>
34
+ <Box display="flex" alignItems="center">
35
+ <Badge size="large" type="secondary" iconName="sparkles">
36
+ Supports legacy types
37
+ </Badge>
38
+ <Badge size="large">
39
+ <Numeral fontWeight="bold" number={1569241} />
40
+ <Text ml={200}>and children!</Text>
41
+ </Badge>
42
+ </Box>
43
+ </Stack>
51
44
  );
52
45
 
53
46
  permutations.story = {
@@ -3,48 +3,50 @@ import Badge from "./";
3
3
  import { render } from "../utils/react-testing-library";
4
4
  import "jest-styled-components";
5
5
 
6
- describe("Racine Badge", () => {
7
- it("should render with default props", () => {
8
- const { getByText, getByDataQaLabel } = render(<Badge text="Test" />);
6
+ describe("Badge...", () => {
7
+ it("...should render with default props", () => {
8
+ const { getByText } = render(<Badge>Test</Badge>);
9
9
  expect(getByText("Test")).toBeTruthy();
10
- expect(getByDataQaLabel({ "badge-type": "primary" })).toBeTruthy();
10
+ expect(getByText("Test").closest("span")).toHaveStyleRule(
11
+ "padding",
12
+ "0px 4px"
13
+ );
14
+ expect(getByText("Test").closest("span")).toHaveStyleRule(
15
+ "background",
16
+ "#dcf2ff"
17
+ );
11
18
  });
12
19
 
13
- it("should render with correct size styling", () => {
14
- const { getByText } = render(<Badge text="Test" size="small" />);
15
- expect(getByText("Test")).toHaveStyleRule("padding", "4px 8px");
20
+ it("...should render with correct size styling", () => {
21
+ const { getByText } = render(<Badge size="large">Test</Badge>);
22
+ expect(getByText("Test").closest("span")).toHaveStyleRule("padding", "8px");
16
23
  });
17
24
 
18
- it("should render with secondary type", () => {
19
- const { getByText, getByDataQaLabel } = render(
20
- <Badge text="Test" type="secondary" />
21
- );
25
+ it("...should render with legacy type", () => {
26
+ const { getByText } = render(<Badge type="secondary">Test</Badge>);
22
27
  expect(getByText("Test")).toBeTruthy();
23
- expect(getByDataQaLabel({ "badge-type": "secondary" })).toBeTruthy();
24
- });
25
-
26
- it("should render with passive type", () => {
27
- const { getByText, getByDataQaLabel } = render(
28
- <Badge text="Test" type="passive" />
28
+ expect(getByText("Test").closest("span")).toHaveStyleRule(
29
+ "color",
30
+ "#364141"
31
+ );
32
+ expect(getByText("Test").closest("span")).toHaveStyleRule(
33
+ "background",
34
+ "#fdefcd"
29
35
  );
30
- expect(getByText("Test")).toBeTruthy();
31
- expect(getByDataQaLabel({ "badge-type": "passive" })).toBeTruthy();
32
36
  });
33
37
 
34
- it("should render with common type", () => {
35
- const { getByText, getByDataQaLabel } = render(
36
- <Badge text="Test" type="common" />
37
- );
38
+ it("...should render with a badge color", () => {
39
+ const { getByText } = render(<Badge badgeColor="purple">Test</Badge>);
38
40
  expect(getByText("Test")).toBeTruthy();
39
- expect(getByDataQaLabel({ "badge-type": "common" })).toBeTruthy();
41
+ expect(getByText("Test").closest("span")).toHaveStyleRule(
42
+ "background",
43
+ "#eaeaf9"
44
+ );
40
45
  });
41
46
 
42
- it("should render with approval type", () => {
43
- const { getByText, getByDataQaLabel } = render(
44
- <Badge text="Test" type="approval" />
45
- );
46
- expect(getByText("Test")).toBeTruthy();
47
- expect(getByDataQaLabel({ "badge-type": "approval" })).toBeTruthy();
47
+ it("...should render with an icon", () => {
48
+ const { container } = render(<Badge iconName="sparkles">Test</Badge>);
49
+ expect(container.querySelector("svg")).toBeTruthy();
48
50
  });
49
51
  it("should render with suggestion type", () => {
50
52
  const { getByText, getByDataQaLabel } = render(
@@ -54,9 +56,9 @@ describe("Racine Badge", () => {
54
56
  expect(getByDataQaLabel({ "badge-type": "suggestion" })).toBeTruthy();
55
57
  });
56
58
 
57
- it("should render with tooltip class", () => {
59
+ it("...should render with tooltip class", () => {
58
60
  const { getByText, getByDataQaLabel } = render(
59
- <Badge text="Test" tip="test tip" />
61
+ <Badge tip="test tip">Test</Badge>
60
62
  );
61
63
  expect(getByText("Test")).toBeTruthy();
62
64
  expect(getByDataQaLabel({ "badge-tip": "test tip" })).toBeTruthy();
@@ -1,51 +1,31 @@
1
1
  //@flow
2
- import styled, { css, type StyledComponent } from "styled-components";
2
+ import styled, { type StyledComponent } from "styled-components";
3
3
  import { COMMON } from "../utils/system-props";
4
- import { themeGet } from "@styled-system/theme-get";
5
-
6
4
  import type { TypeTheme } from "../types/theme.flow";
7
-
8
- const colors = {
9
- primary: "colors.neutral.0",
10
- secondary: "colors.neutral.800",
11
- passive: "colors.neutral.800",
12
- common: "colors.neutral.0",
13
- approval: "colors.neutral.800",
14
- default: "colors.neutral.0",
15
- suggestion: "colors.neutral.900",
16
- };
17
-
18
- const backgroundColors = {
19
- primary: "colors.blue.700",
20
- secondary: "colors.yellow.500",
21
- passive: "colors.neutral.200",
22
- common: "colors.aqua.600",
23
- approval: "colors.orange.300",
24
- default: "colors.purple.700",
25
- suggestion: "colors.blue.300",
26
- };
5
+ import { themeGet } from "@styled-system/theme-get";
6
+ import { legacyBadgeColors } from "./constants";
27
7
 
28
8
  // eslint-disable-next-line prettier/prettier
29
- const Container: StyledComponent<{type: "primary" | "secondary" | "passive" | "common" | "approval" | "default" | "suggestion", small: boolean, ...}, TypeTheme, *> = styled.span`
9
+ const Container: StyledComponent<{type: ?string, badgeColor: string, size: string, ...}, TypeTheme, *> = styled.span`
10
+ font-family: ${(p) => p.theme.fontFamily};
11
+ ${(p) =>
12
+ p.size === "small" ? p.theme.typography[100] : p.theme.typography[200]};
13
+ border-radius: 9999px;
14
+ line-height: 16px;
30
15
  display: inline-block;
31
- text-align: center;
32
- border-radius: 50px;
33
- font-family: ${(props) => props.theme.fontFamily};
34
-
35
- padding: ${(props) =>
36
- props.small
37
- ? `${props.theme.space[200]} ${props.theme.space[300]}`
38
- : `${props.theme.space[300]} ${props.theme.space[350]}`};
39
-
40
- ${(props) =>
41
- props.small ? props.theme.typography[100] : props.theme.typography[200]}
42
-
43
- ${(props) => css`
44
- color: ${themeGet(colors[props.type])(props)};
45
- background: ${themeGet(backgroundColors[props.type])(props)};
46
- `}
47
-
48
- ${COMMON}
16
+ color: ${(p) =>
17
+ p.type
18
+ ? themeGet(legacyBadgeColors[p.type].color)
19
+ : p.theme.colors.text.body};
20
+ background: ${(p) =>
21
+ p.type
22
+ ? themeGet(legacyBadgeColors[p.type].background)
23
+ : p.theme.colors.container.background.decorative[p.badgeColor]};
24
+ padding: ${(p) =>
25
+ p.size === "small"
26
+ ? `${p.theme.space[0]} ${p.theme.space[200]}`
27
+ : `${p.theme.space[300]}`};
28
+ ${COMMON};
49
29
  `;
50
30
 
51
31
  export default Container;
@@ -229,6 +229,7 @@ const colors = {
229
229
  map: datavizPalette.DATAVIZ_COLORS_MAP,
230
230
  list: datavizPalette.DATAVIZ_COLORS_LIST,
231
231
  },
232
+ // Remove this in a future version in favor of the above object
232
233
  ...datavizPalette,
233
234
  };
234
235
 
@@ -15,6 +15,7 @@ const literalColors = {
15
15
  "800": COLORS.COLOR_NEUTRAL_800,
16
16
  "900": COLORS.COLOR_NEUTRAL_900,
17
17
  "1000": COLORS.COLOR_NEUTRAL_1000,
18
+ "1100": COLORS.COLOR_NEUTRAL_1100,
18
19
  },
19
20
  green: {
20
21
  "0": COLORS.COLOR_GREEN_0,
@@ -42,6 +43,7 @@ const literalColors = {
42
43
  "800": COLORS.COLOR_RED_800,
43
44
  "900": COLORS.COLOR_RED_900,
44
45
  "1000": COLORS.COLOR_RED_1000,
46
+ "1100": COLORS.COLOR_RED_1100,
45
47
  },
46
48
  blue: {
47
49
  "0": COLORS.COLOR_BLUE_0,
@@ -256,6 +256,7 @@ const colors = {
256
256
  list: datavizPalette.DATAVIZ_COLORS_LIST,
257
257
  },
258
258
  ...literalColors,
259
+ // Remove this in a future version in favor of the above object
259
260
  ...datavizPalette,
260
261
  };
261
262
 
@@ -1,6 +1,7 @@
1
1
  // @flow strict-local
2
2
 
3
3
  import literalColors from "../themes/light/literal-colors";
4
+ import { datavizPalette } from "../themes/light/dataviz-palette";
4
5
 
5
6
  type TypeAppColors = {|
6
7
  app: {
@@ -170,6 +171,7 @@ type TypeIconColors = {|
170
171
  danger: string,
171
172
  info: string,
172
173
  opportunity: string,
174
+ applied: string,
173
175
  positive_sentiment: string,
174
176
  negative_sentiment: string,
175
177
  neutral_sentiment: string,
@@ -204,6 +206,28 @@ type TypeListItemColors = {|
204
206
  },
205
207
  |};
206
208
 
209
+ type TypeOverlayColors = {|
210
+ overlay: {
211
+ background: {
212
+ base: string,
213
+ },
214
+ text: {
215
+ base: string,
216
+ },
217
+ icon: {
218
+ base: string,
219
+ },
220
+ },
221
+ |};
222
+
223
+ type TypeElevationColors = {|
224
+ elevation: {
225
+ base: string,
226
+ },
227
+ |};
228
+
229
+ type TypeDatavizColors = typeof datavizPalette;
230
+
207
231
  type TypeNetworkColors = {|
208
232
  network: {
209
233
  twitter: string,
@@ -245,6 +269,9 @@ export type TypeColors = {
245
269
  ...TypeIconColors,
246
270
  ...TypeFormColors,
247
271
  ...TypeListItemColors,
272
+ ...TypeOverlayColors,
273
+ ...TypeElevationColors,
274
+ ...TypeDatavizColors,
248
275
  ...TypeNetworkColors,
249
276
  ...TypeLiteralColors,
250
277
  };
@@ -15,9 +15,6 @@ var _Image = _interopRequireDefault(require("../Image"));
15
15
 
16
16
  var _Text = _interopRequireDefault(require("../Text"));
17
17
 
18
- var _excluded = ["fontSize"],
19
- _excluded2 = ["appearance", "name", "src", "variant", "type", "size", "bg", "color"];
20
-
21
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
19
 
23
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -30,12 +27,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
30
27
 
31
28
  var AvatarText = (0, _styledComponents.default)(function (_ref) {
32
29
  var fontSize = _ref.fontSize,
33
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
30
+ rest = _objectWithoutPropertiesLoose(_ref, ["fontSize"]);
34
31
 
35
32
  return /*#__PURE__*/React.createElement(_Text.default, rest);
36
33
  }).withConfig({
37
34
  displayName: "Avatar__AvatarText",
38
- componentId: "sc-yx873f-0"
35
+ componentId: "yx873f-0"
39
36
  })(["font-size:", "px;color:", "px;"], function (props) {
40
37
  return props.fontSize;
41
38
  }, function (props) {
@@ -43,7 +40,7 @@ var AvatarText = (0, _styledComponents.default)(function (_ref) {
43
40
  });
44
41
  var Container = (0, _styledComponents.default)(_Box.default).withConfig({
45
42
  displayName: "Avatar__Container",
46
- componentId: "sc-yx873f-1"
43
+ componentId: "yx873f-1"
47
44
  })(["", ""], function (_ref2) {
48
45
  var theme = _ref2.theme,
49
46
  type = _ref2.type,
@@ -78,7 +75,7 @@ var Avatar = function Avatar(_ref3) {
78
75
  size = _ref3$size === void 0 ? "40px" : _ref3$size,
79
76
  bg = _ref3.bg,
80
77
  color = _ref3.color,
81
- rest = _objectWithoutPropertiesLoose(_ref3, _excluded2);
78
+ rest = _objectWithoutPropertiesLoose(_ref3, ["appearance", "name", "src", "variant", "type", "size", "bg", "color"]);
82
79
 
83
80
  var _useState = (0, React.useState)(false),
84
81
  imageFailedLoading = _useState[0],
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.legacyBadgeColors = void 0;
5
+ var defaultPurple = {
6
+ color: "colors.text.body",
7
+ background: "colors.container.background.decorative.purple"
8
+ };
9
+ var suggestion = {
10
+ color: "colors.text.body",
11
+ background: "colors.container.background.decorative.blue"
12
+ };
13
+ var passive = {
14
+ color: "colors.text.body",
15
+ background: "colors.container.background.decorative.neutral"
16
+ };
17
+ var primary = {
18
+ color: "colors.text.body",
19
+ background: "colors.container.background.decorative.blue"
20
+ };
21
+ var secondary = {
22
+ color: "colors.text.body",
23
+ background: "colors.container.background.decorative.yellow"
24
+ };
25
+ var common = {
26
+ color: "colors.text.inverse",
27
+ background: "colors.aqua.600"
28
+ };
29
+ var approval = {
30
+ color: "colors.text.body",
31
+ background: "colors.container.background.decorative.orange"
32
+ }; //Deprecated former "types"
33
+
34
+ var legacyBadgeColors = {
35
+ primary: primary,
36
+ secondary: secondary,
37
+ passive: passive,
38
+ common: common,
39
+ approval: approval,
40
+ default: defaultPurple,
41
+ suggestion: suggestion
42
+ };
43
+ exports.legacyBadgeColors = legacyBadgeColors;