@sproutsocial/racine 12.15.0 → 12.16.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 (151) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/__flow__/Avatar/index.stories.js +1 -0
  3. package/__flow__/Avatar/index.test.js +1 -0
  4. package/__flow__/Badge/index.stories.js +1 -0
  5. package/__flow__/Badge/index.test.js +1 -0
  6. package/__flow__/Banner/index.stories.js +1 -0
  7. package/__flow__/Banner/index.test.js +1 -0
  8. package/__flow__/Box/index.stories.js +1 -0
  9. package/__flow__/Box/index.test.js +1 -0
  10. package/__flow__/Breadcrumb/index.stories.js +1 -0
  11. package/__flow__/Breadcrumb/index.test.js +1 -0
  12. package/__flow__/Button/index.js +14 -3
  13. package/__flow__/Button/index.stories.js +24 -17
  14. package/__flow__/CharacterCounter/index.stories.js +1 -0
  15. package/__flow__/CharacterCounter/index.test.js +1 -0
  16. package/__flow__/ChartLegend/index.stories.js +1 -0
  17. package/__flow__/ChartLegend/index.test.js +1 -0
  18. package/__flow__/Checkbox/index.js +5 -5
  19. package/__flow__/Checkbox/index.stories.js +18 -13
  20. package/__flow__/Checkbox/index.test.js +9 -1
  21. package/__flow__/Collapsible/index.stories.js +16 -2
  22. package/__flow__/Collapsible/index.test.js +1 -0
  23. package/__flow__/Drawer/index.stories.js +14 -5
  24. package/__flow__/Drawer/index.test.js +4 -3
  25. package/__flow__/EmptyState/index.stories.js +1 -0
  26. package/__flow__/EmptyState/index.test.js +1 -0
  27. package/__flow__/EnumIconNames.js +1 -1
  28. package/__flow__/EnumLogoNames.js +1 -1
  29. package/__flow__/Fieldset/index.stories.js +21 -6
  30. package/__flow__/FormField/index.stories.js +11 -6
  31. package/__flow__/FormField/index.test.js +5 -4
  32. package/__flow__/Icon/index.js +5 -2
  33. package/__flow__/Icon/index.stories.js +8 -7
  34. package/__flow__/Icon/index.test.js +1 -0
  35. package/__flow__/Icon/styles.js +2 -0
  36. package/__flow__/IconViewBoxes.js +1 -1
  37. package/__flow__/Image/index.stories.js +1 -0
  38. package/__flow__/Image/index.test.js +1 -0
  39. package/__flow__/Indicator/index.stories.js +1 -0
  40. package/__flow__/Indicator/index.test.js +1 -0
  41. package/__flow__/Indicator/styles.js +1 -1
  42. package/__flow__/Input/index.stories.js +37 -0
  43. package/__flow__/Input/index.test.js +1 -0
  44. package/__flow__/KeyboardKey/index.stories.js +1 -0
  45. package/__flow__/KeyboardKey/index.test.js +1 -0
  46. package/__flow__/Label/index.stories.js +2 -1
  47. package/__flow__/Label/index.test.js +1 -0
  48. package/__flow__/Link/index.stories.js +1 -0
  49. package/__flow__/Link/index.test.js +1 -0
  50. package/__flow__/Listbox/index.stories.js +12 -6
  51. package/__flow__/Listbox/index.test.js +1 -0
  52. package/__flow__/Loader/index.js +1 -1
  53. package/__flow__/Loader/index.stories.js +5 -4
  54. package/__flow__/Loader/index.test.js +1 -0
  55. package/__flow__/LoaderButton/index.js +3 -1
  56. package/__flow__/LoaderButton/index.stories.js +1 -0
  57. package/__flow__/LoaderButton/index.test.js +1 -0
  58. package/__flow__/LogoViewBoxes.js +1 -1
  59. package/__flow__/Menu/index.flow.js +2 -0
  60. package/__flow__/Menu/index.stories.js +16 -8
  61. package/__flow__/Menu/index.test.js +3 -1
  62. package/__flow__/Message/index.stories.js +14 -6
  63. package/__flow__/Message/index.test.js +3 -3
  64. package/__flow__/Modal/index.stories.js +1 -0
  65. package/__flow__/Modal/index.test.js +1 -0
  66. package/__flow__/Numeral/index.js +1 -1
  67. package/__flow__/Numeral/index.stories.js +8 -7
  68. package/__flow__/OverflowList/index.flow.js +2 -2
  69. package/__flow__/OverflowList/index.stories.js +4 -3
  70. package/__flow__/OverflowList/index.test.js +7 -2
  71. package/__flow__/PartnerLogo/index.js +34 -34
  72. package/__flow__/PartnerLogo/index.stories.js +41 -13
  73. package/__flow__/PartnerLogo/partnerLogos/dropbox-lockup-dark.svg +7 -0
  74. package/__flow__/PartnerLogo/partnerLogos/dropbox-lockup.svg +7 -0
  75. package/__flow__/PartnerLogo/partnerLogos/dropbox-wordmark-dark.svg +3 -0
  76. package/__flow__/PartnerLogo/partnerLogos/dropbox-wordmark.svg +3 -0
  77. package/__flow__/PartnerLogo/partnerLogos/zendesk-lockup-dark.svg +28 -0
  78. package/__flow__/PartnerLogo/partnerLogos/zendesk-lockup.svg +28 -0
  79. package/__flow__/PartnerLogo/partnerLogos/zendesk-wordmark-dark.svg +9 -0
  80. package/__flow__/PartnerLogo/partnerLogos/zendesk-wordmark.svg +9 -0
  81. package/__flow__/PartnerLogo/styles.js +50 -0
  82. package/__flow__/Popout/index.js +2 -2
  83. package/__flow__/Popout/index.stories.js +24 -9
  84. package/__flow__/Popout/index.test.js +2 -1
  85. package/__flow__/Radio/index.js +1 -1
  86. package/__flow__/Radio/index.stories.js +9 -8
  87. package/__flow__/Radio/index.test.js +1 -0
  88. package/__flow__/SegmentedControl/index.stories.js +1 -0
  89. package/__flow__/SegmentedControl/index.test.js +1 -0
  90. package/__flow__/Select/index.stories.js +25 -6
  91. package/__flow__/Select/index.test.js +1 -0
  92. package/__flow__/Skeleton/index.stories.js +1 -0
  93. package/__flow__/SpotIllustration/index.js +1 -1
  94. package/__flow__/SpotIllustration/index.stories.js +6 -5
  95. package/__flow__/Stack/index.stories.js +1 -0
  96. package/__flow__/Stack/index.test.js +1 -0
  97. package/__flow__/Switch/index.js +1 -1
  98. package/__flow__/Switch/index.stories.js +6 -5
  99. package/__flow__/Switch/index.test.js +1 -0
  100. package/__flow__/Table/index.stories.js +14 -12
  101. package/__flow__/Table/index.test.js +1 -0
  102. package/__flow__/TableCell/index.stories.js +1 -0
  103. package/__flow__/TableCell/index.test.js +2 -1
  104. package/__flow__/TableHeaderCell/index.stories.js +1 -0
  105. package/__flow__/TableHeaderCell/index.test.js +5 -2
  106. package/__flow__/TableRowAccordion/index.stories.js +3 -2
  107. package/__flow__/TableRowAccordion/index.test.js +2 -1
  108. package/__flow__/Tabs/index.stories.js +1 -0
  109. package/__flow__/Tabs/index.test.js +1 -0
  110. package/__flow__/Text/index.js +11 -7
  111. package/__flow__/Text/index.stories.js +1 -0
  112. package/__flow__/Text/index.test.js +1 -0
  113. package/__flow__/Textarea/index.stories.js +9 -0
  114. package/__flow__/Textarea/index.test.js +1 -0
  115. package/__flow__/Toast/index.stories.js +10 -6
  116. package/__flow__/ToggleHint/index.test.js +1 -0
  117. package/__flow__/Token/index.stories.js +1 -0
  118. package/__flow__/Token/index.test.js +1 -0
  119. package/__flow__/TokenInput/tests/default/deleting.test.js +10 -9
  120. package/__flow__/TokenInput/tests/default/focusing.test.js +1 -0
  121. package/__flow__/TokenInput/tests/default/inputting.test.js +2 -1
  122. package/__flow__/Tooltip/index.stories.js +1 -17
  123. package/__flow__/Tooltip/index.test.js +2 -0
  124. package/__flow__/dataviz/dataviz.stories.js +1 -0
  125. package/__flow__/dataviz/index.js +1 -0
  126. package/__flow__/themes/dark/decorative-palettes.js +2 -0
  127. package/__flow__/themes/light/decorative-palettes.js +2 -0
  128. package/__flow__/utils/system-props.js +1 -0
  129. package/commonjs/Button/index.js +7 -1
  130. package/commonjs/Checkbox/index.js +3 -3
  131. package/commonjs/Icon/styles.js +3 -0
  132. package/commonjs/IconViewBoxes.js +2 -0
  133. package/commonjs/Indicator/styles.js +3 -1
  134. package/commonjs/LoaderButton/index.js +3 -1
  135. package/commonjs/LogoViewBoxes.js +8 -0
  136. package/commonjs/PartnerLogo/index.js +20 -20
  137. package/commonjs/PartnerLogo/styles.js +40 -0
  138. package/dist/icon.svg +1 -1
  139. package/dist/iconList.js +1 -1
  140. package/dist/logo.svg +1 -1
  141. package/dist/logoList.js +1 -1
  142. package/lib/Button/index.js +11 -1
  143. package/lib/Checkbox/index.js +3 -3
  144. package/lib/Icon/styles.js +3 -0
  145. package/lib/IconViewBoxes.js +2 -0
  146. package/lib/Indicator/styles.js +3 -1
  147. package/lib/LoaderButton/index.js +3 -1
  148. package/lib/LogoViewBoxes.js +8 -0
  149. package/lib/PartnerLogo/index.js +19 -15
  150. package/lib/PartnerLogo/styles.js +26 -0
  151. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # Change Log
2
2
 
3
+ ## 12.16.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3cb36bf: This change fixes a bug where "px" was being appended to a number value when users were already including a pixel value. This was causing incorrect css syntax i.e. "16pxpx"
8
+
9
+ ## 12.16.0
10
+
11
+ ### Minor Changes
12
+
13
+ - b2c4834: The `aria-label` and `aria-labelledby` props were added to the `TypeListboxButtonProps` flow type for the `ListboxButton` component
14
+ - 8b80526: Updated Indicator color to support theming
15
+ - Indicator's color was previously hard-coded to teal.600
16
+ - We are now using a semantic theme value, "icon.info", so that the color of Indicator can reflect the current theme.
17
+ - Please note that "icon.info" currently resolves to a blue color in all bundled themes. Thus, unless you override the color, all Indicators currently in use will change from teal to blue.
18
+ - Support for overriding the Indicator color via the `color` system prop was added.
19
+ - b2c4834: The `checked` and `indeterminate` props on the `Checkbox` component are now optional
20
+ - 57cb24f: **Deprecation Notice:**
21
+
22
+ The `default` appearance for the `Button` component has been **deprecated** in favor of `unstyled`. To migrate, change all `Button` components which use the `default` appearance to use `unstyled` instead. Support for the `default` option will be removed in a future version.
23
+
24
+ The following components that use the `Button` component or its types must also be migrated to use `unstyled` instead of `default` for the `appearance`:
25
+
26
+ - `ListboxButton`
27
+ - `LoaderButton`
28
+ - `MenuButton`
29
+ - `Message.Button`
30
+ - `ModalCloseButton`
31
+
32
+ - b2c4834: The following components now export their prop flow types:
33
+ - Loader
34
+ - Icon
35
+ - Numeral
36
+ - PartnerLogo
37
+ - Popout
38
+ - SpotIllustration
39
+ - Switch
40
+ - b2c4834: The `ItemComponent` and `getItemProps` props on the `OverflowList` component are now optional
41
+ - 8a70eff: We've made some enhancements to the Partner Logo component! The Partner Logo component API now closely aligns with the Icon component.
42
+
43
+ - Added support for different logo types ie. `wordmark` or `lockup`
44
+ - Added support for predefined sizes. ie. `mini`, `small`, `medium`, `large`, and `jumbo`.
45
+ - The partner Logo now has a fixed width by default.
46
+
47
+ - 5613a5c: A new Advocacy icon has been added to the icon library
48
+
49
+ ### Patch Changes
50
+
51
+ - 56fa0b9: Updated Icon component to accept `size="small"` prop to closer align to the `PartnerLogo` component
52
+
3
53
  ## 12.15.0
4
54
 
5
55
  ### Minor Changes
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import Avatar from "./index";
3
4
 
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { render } from "../utils/react-testing-library";
3
4
  import "jest-styled-components";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import Badge from "./index";
3
4
  import Box from "../Box";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import Badge from "./";
3
4
  import { render } from "../utils/react-testing-library";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { text } from "@storybook/addon-knobs";
3
4
  import Banner from "./index";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import Banner from "./";
3
4
  import { render } from "../utils/react-testing-library";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React, { useRef } from "react";
2
3
  import { css } from "styled-components";
3
4
  import { text } from "@storybook/addon-knobs";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { render } from "../utils/react-testing-library";
3
4
  import Box from "./";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import Breadcrumb from "./index";
3
4
  import Menu from "../Menu";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { render } from "../utils/react-testing-library";
3
4
  import "jest-styled-components";
@@ -2,6 +2,12 @@
2
2
  import * as React from "react";
3
3
  import Container from "./styles";
4
4
 
5
+ /**
6
+ * @deprecated
7
+ * Use "unstyled" appearance instead of "default"
8
+ */
9
+ type EnumDeprecatedAppearance = "default";
10
+
5
11
  export type TypeProps = {
6
12
  /** If the button is being used as an anchor, this prop will cause the link to open in a new tab. */
7
13
  external?: boolean,
@@ -12,9 +18,9 @@ export type TypeProps = {
12
18
  | "secondary"
13
19
  | "pill"
14
20
  | "destructive"
15
- | "default"
16
21
  | "unstyled"
17
- | "placeholder",
22
+ | "placeholder"
23
+ | EnumDeprecatedAppearance,
18
24
  /** Set the button to display in its active state */
19
25
  active?: boolean,
20
26
  /** Disables user action and applies a disabled style on the button */
@@ -55,8 +61,13 @@ const Button = ({
55
61
  );
56
62
  }
57
63
 
58
- // plans to properly deprecate captured in DS-1096
64
+ /** "default" is @deprecated in favor of "unstyled" */
59
65
  const appearanceCheck = appearance === "default" ? "unstyled" : appearance;
66
+ if (appearance === "default") {
67
+ console.warn(
68
+ "Warning: The `default` appearance has been deprecated on the Button component. Please use `unstyled` instead."
69
+ );
70
+ }
60
71
 
61
72
  return (
62
73
  <Container
@@ -1,5 +1,6 @@
1
+ // @flow
1
2
  import React from "react";
2
- import Button from "./index";
3
+ import Button, { type TypeProps } from "./index";
3
4
  import Icon from "../Icon";
4
5
  import Box from "../Box";
5
6
 
@@ -7,19 +8,19 @@ export default {
7
8
  title: "Button",
8
9
  };
9
10
 
10
- export const defaultStory = (args) => (
11
+ export const defaultStory = (args: TypeProps) => (
11
12
  <Button {...args} onClick={() => alert("Testing...")}>
12
- Default
13
+ Unstyled
13
14
  </Button>
14
15
  );
15
16
 
16
- defaultStory.args = { appearance: "default" };
17
+ defaultStory.args = { appearance: "unstyled" };
17
18
 
18
19
  defaultStory.story = {
19
- name: "Default",
20
+ name: "Unstyled",
20
21
  };
21
22
 
22
- export const primary = (args) => (
23
+ export const primary = (args: TypeProps) => (
23
24
  <Button {...args} onClick={() => alert("Testing...")}>
24
25
  Primary Button
25
26
  </Button>
@@ -31,7 +32,9 @@ primary.story = {
31
32
  name: "Primary",
32
33
  };
33
34
 
34
- export const secondary = (args) => <Button {...args}>Secondary Button</Button>;
35
+ export const secondary = (args: TypeProps) => (
36
+ <Button {...args}>Secondary Button</Button>
37
+ );
35
38
 
36
39
  secondary.args = { appearance: "secondary" };
37
40
 
@@ -39,7 +42,7 @@ secondary.story = {
39
42
  name: "Secondary",
40
43
  };
41
44
 
42
- export const destructive = (args) => (
45
+ export const destructive = (args: TypeProps) => (
43
46
  <Button {...args}>Destructive Button</Button>
44
47
  );
45
48
 
@@ -48,7 +51,7 @@ destructive.story = {
48
51
  name: "Destructive",
49
52
  };
50
53
 
51
- export const placeholder = (args) => (
54
+ export const placeholder = (args: TypeProps) => (
52
55
  <Button {...args}>Placeholder Button</Button>
53
56
  );
54
57
 
@@ -57,14 +60,16 @@ placeholder.story = {
57
60
  name: "Placeholder",
58
61
  };
59
62
 
60
- export const largeButton = (args) => <Button {...args}>Large Button</Button>;
63
+ export const largeButton = (args: TypeProps) => (
64
+ <Button {...args}>Large Button</Button>
65
+ );
61
66
  largeButton.args = { size: "large", appearance: "primary" };
62
67
 
63
68
  largeButton.story = {
64
69
  name: "Large button",
65
70
  };
66
71
 
67
- export const pillButton = (args) => (
72
+ export const pillButton = (args: TypeProps) => (
68
73
  <Box bg="container.background.base" p={400}>
69
74
  <Button {...args}>
70
75
  <Icon name="reply" mr={350} />
@@ -77,7 +82,7 @@ pillButton.story = {
77
82
  name: "Pill button",
78
83
  };
79
84
 
80
- export const pillIconOnlyButton = (args) => (
85
+ export const pillIconOnlyButton = (args: TypeProps) => (
81
86
  <Box bg="container.background.base" p={400}>
82
87
  <Button {...args} ariaLabel="This is a label">
83
88
  <Icon name="circle-check-outline" />
@@ -90,14 +95,16 @@ pillIconOnlyButton.story = {
90
95
  name: "Pill icon only button",
91
96
  };
92
97
 
93
- export const activeButton = (args) => <Button {...args}>Active Button</Button>;
98
+ export const activeButton = (args: TypeProps) => (
99
+ <Button {...args}>Active Button</Button>
100
+ );
94
101
 
95
102
  activeButton.args = { appearance: "secondary", active: true };
96
103
  activeButton.story = {
97
104
  name: "Active button",
98
105
  };
99
106
 
100
- export const buttonAsALink = (args) => (
107
+ export const buttonAsALink = (args: TypeProps) => (
101
108
  <Button {...args}>Button using anchor element</Button>
102
109
  );
103
110
  buttonAsALink.args = {
@@ -109,7 +116,7 @@ buttonAsALink.story = {
109
116
  name: "Button as a link",
110
117
  };
111
118
 
112
- export const disabledButton = (args) => (
119
+ export const disabledButton = (args: TypeProps) => (
113
120
  <Button {...args}>This Button is disabled</Button>
114
121
  );
115
122
  disabledButton.args = {
@@ -120,7 +127,7 @@ disabledButton.story = {
120
127
  name: "Disabled button",
121
128
  };
122
129
 
123
- export const fullWidthButton = (args) => (
130
+ export const fullWidthButton = (args: TypeProps) => (
124
131
  <Button {...args}>Full-Width Button</Button>
125
132
  );
126
133
  fullWidthButton.args = {
@@ -131,7 +138,7 @@ fullWidthButton.story = {
131
138
  name: "Full width button",
132
139
  };
133
140
 
134
- export const withIcon = (args) => (
141
+ export const withIcon = (args: TypeProps) => (
135
142
  <Button {...args}>
136
143
  <Icon name="twitter" mr={350} />
137
144
  Secondary Button
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { number, text } from "@storybook/addon-knobs";
3
4
 
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { render } from "../utils/react-testing-library";
3
4
  import "jest-styled-components";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import ChartLegend from "./index";
3
4
 
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { render } from "../utils/react-testing-library";
3
4
  import "jest-styled-components";
@@ -19,8 +19,8 @@ export type TypeProps = {
19
19
  /** Label used to describe the input (if not used with an accompanying visual label) */
20
20
  ariaLabel?: string,
21
21
  labelProps?: Object,
22
- checked: boolean,
23
- indeterminate: boolean,
22
+ checked?: boolean,
23
+ indeterminate?: boolean,
24
24
  disabled?: boolean,
25
25
  onChange: (event: SyntheticEvent<HTMLInputElement>) => void,
26
26
  appearance?: "pill" | "default",
@@ -39,14 +39,14 @@ export default class Checkbox extends React.Component<TypeProps> {
39
39
  };
40
40
 
41
41
  componentDidUpdate(prevProps: TypeProps) {
42
- if (prevProps.indeterminate !== this.props.indeterminate && this.el) {
43
- this.el.indeterminate = this.props.indeterminate;
42
+ if (prevProps.indeterminate !== !!this.props.indeterminate && this.el) {
43
+ this.el.indeterminate = !!this.props.indeterminate;
44
44
  }
45
45
  }
46
46
 
47
47
  componentDidMount() {
48
48
  if (this.el) {
49
- this.el.indeterminate = this.props.indeterminate;
49
+ this.el.indeterminate = !!this.props.indeterminate;
50
50
  }
51
51
  }
52
52
 
@@ -1,22 +1,23 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { action } from "@storybook/addon-actions";
3
4
 
4
- import Checkbox from "./";
5
+ import Checkbox, { type TypeProps } from "./";
5
6
 
6
7
  export default {
7
8
  title: "Checkbox",
8
9
  component: Checkbox,
9
10
  };
10
11
 
11
- export const Checked = (args) => <Checkbox {...args} />;
12
+ export const Checked = (args: TypeProps) => <Checkbox {...args} />;
12
13
 
13
14
  Checked.args = { checked: true };
14
15
 
15
- export const Unchecked = (args) => <Checkbox {...args} />;
16
+ export const Unchecked = (args: TypeProps) => <Checkbox {...args} />;
16
17
 
17
18
  Unchecked.args = { checked: false };
18
19
 
19
- export const PillChecked = (args) => <Checkbox {...args} />;
20
+ export const PillChecked = (args: TypeProps) => <Checkbox {...args} />;
20
21
 
21
22
  PillChecked.args = {
22
23
  checked: true,
@@ -27,7 +28,7 @@ PillChecked.story = {
27
28
  name: "Pill/Checked",
28
29
  };
29
30
 
30
- export const PillUnchecked = (args) => <Checkbox {...args} />;
31
+ export const PillUnchecked = (args: TypeProps) => <Checkbox {...args} />;
31
32
 
32
33
  PillUnchecked.args = {
33
34
  checked: false,
@@ -38,7 +39,7 @@ PillUnchecked.story = {
38
39
  name: "Pill/Unchecked",
39
40
  };
40
41
 
41
- export const DisabledChecked = (args) => <Checkbox {...args} />;
42
+ export const DisabledChecked = (args: TypeProps) => <Checkbox {...args} />;
42
43
 
43
44
  DisabledChecked.args = {
44
45
  checked: true,
@@ -49,7 +50,7 @@ DisabledChecked.story = {
49
50
  name: "Disabled/Checked",
50
51
  };
51
52
 
52
- export const DisabledUnchecked = (args) => <Checkbox {...args} />;
53
+ export const DisabledUnchecked = (args: TypeProps) => <Checkbox {...args} />;
53
54
 
54
55
  DisabledUnchecked.args = {
55
56
  checked: false,
@@ -60,7 +61,7 @@ DisabledUnchecked.story = {
60
61
  name: "Disabled/Unchecked",
61
62
  };
62
63
 
63
- export const IndeterminateChecked = (args) => <Checkbox {...args} />;
64
+ export const IndeterminateChecked = (args: TypeProps) => <Checkbox {...args} />;
64
65
 
65
66
  IndeterminateChecked.args = {
66
67
  checked: true,
@@ -71,7 +72,9 @@ IndeterminateChecked.story = {
71
72
  name: "Indeterminate/Checked",
72
73
  };
73
74
 
74
- export const IndeterminateUnchecked = (args) => <Checkbox {...args} />;
75
+ export const IndeterminateUnchecked = (args: TypeProps) => (
76
+ <Checkbox {...args} />
77
+ );
75
78
 
76
79
  IndeterminateUnchecked.args = {
77
80
  checked: false,
@@ -82,7 +85,7 @@ IndeterminateUnchecked.story = {
82
85
  name: "Indeterminate/Unchecked",
83
86
  };
84
87
 
85
- export const LabelledChecked = (args) => <Checkbox {...args} />;
88
+ export const LabelledChecked = (args: TypeProps) => <Checkbox {...args} />;
86
89
 
87
90
  LabelledChecked.args = {
88
91
  checked: true,
@@ -93,7 +96,7 @@ LabelledChecked.story = {
93
96
  name: "Labelled/Checked",
94
97
  };
95
98
 
96
- export const LabelledUnchecked = (args) => <Checkbox {...args} />;
99
+ export const LabelledUnchecked = (args: TypeProps) => <Checkbox {...args} />;
97
100
 
98
101
  LabelledUnchecked.args = {
99
102
  checked: false,
@@ -104,7 +107,7 @@ LabelledUnchecked.story = {
104
107
  name: "Labelled/Unchecked",
105
108
  };
106
109
 
107
- export const LabelledDisabled = (args) => <Checkbox {...args} />;
110
+ export const LabelledDisabled = (args: TypeProps) => <Checkbox {...args} />;
108
111
 
109
112
  LabelledDisabled.args = {
110
113
  checked: true,
@@ -116,7 +119,9 @@ LabelledDisabled.story = {
116
119
  name: "Labelled/Disabled",
117
120
  };
118
121
 
119
- export const InputPropsOnMouseOver = (args) => <Checkbox {...args} />;
122
+ export const InputPropsOnMouseOver = (args: TypeProps) => (
123
+ <Checkbox {...args} />
124
+ );
120
125
 
121
126
  InputPropsOnMouseOver.args = {
122
127
  checked: true,
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { render, fireEvent } from "../utils/react-testing-library";
3
4
  import Checkbox from "./";
@@ -50,7 +51,12 @@ describe("Checkbox", () => {
50
51
 
51
52
  it("should display label when label not undefined and appearance is default", () => {
52
53
  const { getByLabelText } = render(
53
- <Checkbox checked label="Checkbox Label" id="checkboxid" />
54
+ <Checkbox
55
+ checked
56
+ onChange={mockHandleClick}
57
+ label="Checkbox Label"
58
+ id="checkboxid"
59
+ />
54
60
  );
55
61
  expect(getByLabelText("Checkbox Label")).toBeInTheDocument();
56
62
  });
@@ -59,6 +65,7 @@ describe("Checkbox", () => {
59
65
  const { queryByLabelText } = render(
60
66
  <Checkbox
61
67
  checked
68
+ onChange={mockHandleClick}
62
69
  label="Checkbox Label"
63
70
  id="checkboxid"
64
71
  appearance="pill"
@@ -72,6 +79,7 @@ describe("Checkbox", () => {
72
79
  const options = render(
73
80
  <Checkbox
74
81
  checked
82
+ onChange={mockHandleClick}
75
83
  inputProps={{ onMouseOver: mockHandleMouseOver }}
76
84
  id="checkboxid"
77
85
  label="checkbox"
@@ -1,9 +1,18 @@
1
- import React, { useState } from "react";
1
+ // @flow
2
+ import React, { type Node as ReactNode, useState } from "react";
2
3
  import Collapsible from "./index";
3
4
  import Button from "../Button";
4
5
  import Box from "../Box";
5
6
 
6
- const StatefulCollapse = ({ children, offset = 0, initialIsOpen = false }) => {
7
+ const StatefulCollapse = ({
8
+ children,
9
+ offset = 0,
10
+ initialIsOpen = false,
11
+ }: {
12
+ children: ReactNode,
13
+ offset?: number,
14
+ initialIsOpen?: boolean,
15
+ }) => {
7
16
  const [open, setOpen] = useState(initialIsOpen);
8
17
  const toggle = () => setOpen(!open);
9
18
 
@@ -95,6 +104,11 @@ const StatefulCollapseWithMinHeight = ({
95
104
  offset = 0,
96
105
  collapsedHeight = 0,
97
106
  openHeight,
107
+ }: {
108
+ children: ReactNode,
109
+ offset?: number,
110
+ collapsedHeight?: number,
111
+ openHeight: number,
98
112
  }) => {
99
113
  const [open, setOpen] = useState(false);
100
114
  const toggle = () => setOpen(!open);
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { useState } from "react";
3
4
  import { render, fireEvent } from "../utils/react-testing-library";
@@ -1,7 +1,8 @@
1
+ // @flow
1
2
  import React, { useState } from "react";
2
3
  import { createGlobalStyle } from "styled-components";
3
4
  import { text, number, boolean } from "@storybook/addon-knobs";
4
- import Drawer from "./index";
5
+ import Drawer, { type TypeDrawerProps } from "./index";
5
6
  import Button from "../Button";
6
7
  import Icon from "../Icon";
7
8
  import Box from "../Box";
@@ -14,7 +15,12 @@ const GlobalStyle = createGlobalStyle`
14
15
  }
15
16
  `;
16
17
 
17
- const StatefulDrawer = ({ isOpen = true, onClose, children, ...rest }) => {
18
+ const StatefulDrawer = ({
19
+ isOpen = true,
20
+ onClose,
21
+ children,
22
+ ...rest
23
+ }: TypeDrawerProps) => {
18
24
  const [isDrawerOpen, setIsDrawerOpen] = useState(isOpen);
19
25
  const onDrawerClose = () => {
20
26
  setIsDrawerOpen(false);
@@ -23,7 +29,7 @@ const StatefulDrawer = ({ isOpen = true, onClose, children, ...rest }) => {
23
29
 
24
30
  return (
25
31
  <React.Fragment>
26
- <Drawer isOpen={isDrawerOpen} onClose={onDrawerClose} {...rest}>
32
+ <Drawer {...rest} isOpen={isDrawerOpen} onClose={onDrawerClose}>
27
33
  {children}
28
34
  </Drawer>
29
35
  <Button
@@ -36,7 +42,7 @@ const StatefulDrawer = ({ isOpen = true, onClose, children, ...rest }) => {
36
42
  );
37
43
  };
38
44
 
39
- const DrawerComponent = ({ direction, offset }) => {
45
+ const DrawerComponent = ({ direction, offset }: $Shape<TypeDrawerProps>) => {
40
46
  const [isOpen, setIsOpen] = useState(false);
41
47
  const onOpen = () => setIsOpen(true);
42
48
  const onClose = () => setIsOpen(false);
@@ -71,7 +77,10 @@ const DrawerComponent = ({ direction, offset }) => {
71
77
  );
72
78
  };
73
79
 
74
- const NectarDrawerComponent = ({ direction, offset }) => {
80
+ const NectarDrawerComponent = ({
81
+ direction,
82
+ offset,
83
+ }: $Shape<TypeDrawerProps>) => {
75
84
  const [isNotificationsOpen, setIsNotificationsOpen] = useState(false);
76
85
  const [isPoplarOpen, setIsPoplarOpen] = useState(false);
77
86
  const openNotifications = () => {
@@ -1,5 +1,6 @@
1
+ // @flow
1
2
  import React, { useState } from "react";
2
- import Drawer from "./";
3
+ import Drawer, { type TypeDrawerProps } from "./";
3
4
  import {
4
5
  render as testRender,
5
6
  fireEvent,
@@ -14,7 +15,7 @@ const StatefulDrawer = ({ isOpen, onClose, children, ...rest }) => {
14
15
  };
15
16
 
16
17
  return (
17
- <Drawer isOpen={isDrawerOpen} onClose={onDrawerClose} {...rest}>
18
+ <Drawer {...rest} isOpen={isDrawerOpen} onClose={onDrawerClose}>
18
19
  {children}
19
20
  </Drawer>
20
21
  );
@@ -36,7 +37,7 @@ const render = ({
36
37
  onClose = () => {},
37
38
  id = "drawer",
38
39
  closeButtonLabel = "close",
39
- } = {}) => {
40
+ }: $Shape<TypeDrawerProps> = {}) => {
40
41
  const { baseElement } = testRender(<div id="main-content" />);
41
42
  const mainContentRef = baseElement.querySelector("#main-content");
42
43
 
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import EmptyState from "./index";
3
4
  import Button from "../Button";
@@ -1,3 +1,4 @@
1
+ // @flow
1
2
  import React from "react";
2
3
  import { render } from "../utils/react-testing-library";
3
4
  import "jest-styled-components";