@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.
- package/CHANGELOG.md +50 -0
- package/__flow__/Avatar/index.stories.js +1 -0
- package/__flow__/Avatar/index.test.js +1 -0
- package/__flow__/Badge/index.stories.js +1 -0
- package/__flow__/Badge/index.test.js +1 -0
- package/__flow__/Banner/index.stories.js +1 -0
- package/__flow__/Banner/index.test.js +1 -0
- package/__flow__/Box/index.stories.js +1 -0
- package/__flow__/Box/index.test.js +1 -0
- package/__flow__/Breadcrumb/index.stories.js +1 -0
- package/__flow__/Breadcrumb/index.test.js +1 -0
- package/__flow__/Button/index.js +14 -3
- package/__flow__/Button/index.stories.js +24 -17
- package/__flow__/CharacterCounter/index.stories.js +1 -0
- package/__flow__/CharacterCounter/index.test.js +1 -0
- package/__flow__/ChartLegend/index.stories.js +1 -0
- package/__flow__/ChartLegend/index.test.js +1 -0
- package/__flow__/Checkbox/index.js +5 -5
- package/__flow__/Checkbox/index.stories.js +18 -13
- package/__flow__/Checkbox/index.test.js +9 -1
- package/__flow__/Collapsible/index.stories.js +16 -2
- package/__flow__/Collapsible/index.test.js +1 -0
- package/__flow__/Drawer/index.stories.js +14 -5
- package/__flow__/Drawer/index.test.js +4 -3
- package/__flow__/EmptyState/index.stories.js +1 -0
- package/__flow__/EmptyState/index.test.js +1 -0
- package/__flow__/EnumIconNames.js +1 -1
- package/__flow__/EnumLogoNames.js +1 -1
- package/__flow__/Fieldset/index.stories.js +21 -6
- package/__flow__/FormField/index.stories.js +11 -6
- package/__flow__/FormField/index.test.js +5 -4
- package/__flow__/Icon/index.js +5 -2
- package/__flow__/Icon/index.stories.js +8 -7
- package/__flow__/Icon/index.test.js +1 -0
- package/__flow__/Icon/styles.js +2 -0
- package/__flow__/IconViewBoxes.js +1 -1
- package/__flow__/Image/index.stories.js +1 -0
- package/__flow__/Image/index.test.js +1 -0
- package/__flow__/Indicator/index.stories.js +1 -0
- package/__flow__/Indicator/index.test.js +1 -0
- package/__flow__/Indicator/styles.js +1 -1
- package/__flow__/Input/index.stories.js +37 -0
- package/__flow__/Input/index.test.js +1 -0
- package/__flow__/KeyboardKey/index.stories.js +1 -0
- package/__flow__/KeyboardKey/index.test.js +1 -0
- package/__flow__/Label/index.stories.js +2 -1
- package/__flow__/Label/index.test.js +1 -0
- package/__flow__/Link/index.stories.js +1 -0
- package/__flow__/Link/index.test.js +1 -0
- package/__flow__/Listbox/index.stories.js +12 -6
- package/__flow__/Listbox/index.test.js +1 -0
- package/__flow__/Loader/index.js +1 -1
- package/__flow__/Loader/index.stories.js +5 -4
- package/__flow__/Loader/index.test.js +1 -0
- package/__flow__/LoaderButton/index.js +3 -1
- package/__flow__/LoaderButton/index.stories.js +1 -0
- package/__flow__/LoaderButton/index.test.js +1 -0
- package/__flow__/LogoViewBoxes.js +1 -1
- package/__flow__/Menu/index.flow.js +2 -0
- package/__flow__/Menu/index.stories.js +16 -8
- package/__flow__/Menu/index.test.js +3 -1
- package/__flow__/Message/index.stories.js +14 -6
- package/__flow__/Message/index.test.js +3 -3
- package/__flow__/Modal/index.stories.js +1 -0
- package/__flow__/Modal/index.test.js +1 -0
- package/__flow__/Numeral/index.js +1 -1
- package/__flow__/Numeral/index.stories.js +8 -7
- package/__flow__/OverflowList/index.flow.js +2 -2
- package/__flow__/OverflowList/index.stories.js +4 -3
- package/__flow__/OverflowList/index.test.js +7 -2
- package/__flow__/PartnerLogo/index.js +34 -34
- package/__flow__/PartnerLogo/index.stories.js +41 -13
- package/__flow__/PartnerLogo/partnerLogos/dropbox-lockup-dark.svg +7 -0
- package/__flow__/PartnerLogo/partnerLogos/dropbox-lockup.svg +7 -0
- package/__flow__/PartnerLogo/partnerLogos/dropbox-wordmark-dark.svg +3 -0
- package/__flow__/PartnerLogo/partnerLogos/dropbox-wordmark.svg +3 -0
- package/__flow__/PartnerLogo/partnerLogos/zendesk-lockup-dark.svg +28 -0
- package/__flow__/PartnerLogo/partnerLogos/zendesk-lockup.svg +28 -0
- package/__flow__/PartnerLogo/partnerLogos/zendesk-wordmark-dark.svg +9 -0
- package/__flow__/PartnerLogo/partnerLogos/zendesk-wordmark.svg +9 -0
- package/__flow__/PartnerLogo/styles.js +50 -0
- package/__flow__/Popout/index.js +2 -2
- package/__flow__/Popout/index.stories.js +24 -9
- package/__flow__/Popout/index.test.js +2 -1
- package/__flow__/Radio/index.js +1 -1
- package/__flow__/Radio/index.stories.js +9 -8
- package/__flow__/Radio/index.test.js +1 -0
- package/__flow__/SegmentedControl/index.stories.js +1 -0
- package/__flow__/SegmentedControl/index.test.js +1 -0
- package/__flow__/Select/index.stories.js +25 -6
- package/__flow__/Select/index.test.js +1 -0
- package/__flow__/Skeleton/index.stories.js +1 -0
- package/__flow__/SpotIllustration/index.js +1 -1
- package/__flow__/SpotIllustration/index.stories.js +6 -5
- package/__flow__/Stack/index.stories.js +1 -0
- package/__flow__/Stack/index.test.js +1 -0
- package/__flow__/Switch/index.js +1 -1
- package/__flow__/Switch/index.stories.js +6 -5
- package/__flow__/Switch/index.test.js +1 -0
- package/__flow__/Table/index.stories.js +14 -12
- package/__flow__/Table/index.test.js +1 -0
- package/__flow__/TableCell/index.stories.js +1 -0
- package/__flow__/TableCell/index.test.js +2 -1
- package/__flow__/TableHeaderCell/index.stories.js +1 -0
- package/__flow__/TableHeaderCell/index.test.js +5 -2
- package/__flow__/TableRowAccordion/index.stories.js +3 -2
- package/__flow__/TableRowAccordion/index.test.js +2 -1
- package/__flow__/Tabs/index.stories.js +1 -0
- package/__flow__/Tabs/index.test.js +1 -0
- package/__flow__/Text/index.js +11 -7
- package/__flow__/Text/index.stories.js +1 -0
- package/__flow__/Text/index.test.js +1 -0
- package/__flow__/Textarea/index.stories.js +9 -0
- package/__flow__/Textarea/index.test.js +1 -0
- package/__flow__/Toast/index.stories.js +10 -6
- package/__flow__/ToggleHint/index.test.js +1 -0
- package/__flow__/Token/index.stories.js +1 -0
- package/__flow__/Token/index.test.js +1 -0
- package/__flow__/TokenInput/tests/default/deleting.test.js +10 -9
- package/__flow__/TokenInput/tests/default/focusing.test.js +1 -0
- package/__flow__/TokenInput/tests/default/inputting.test.js +2 -1
- package/__flow__/Tooltip/index.stories.js +1 -17
- package/__flow__/Tooltip/index.test.js +2 -0
- package/__flow__/dataviz/dataviz.stories.js +1 -0
- package/__flow__/dataviz/index.js +1 -0
- package/__flow__/themes/dark/decorative-palettes.js +2 -0
- package/__flow__/themes/light/decorative-palettes.js +2 -0
- package/__flow__/utils/system-props.js +1 -0
- package/commonjs/Button/index.js +7 -1
- package/commonjs/Checkbox/index.js +3 -3
- package/commonjs/Icon/styles.js +3 -0
- package/commonjs/IconViewBoxes.js +2 -0
- package/commonjs/Indicator/styles.js +3 -1
- package/commonjs/LoaderButton/index.js +3 -1
- package/commonjs/LogoViewBoxes.js +8 -0
- package/commonjs/PartnerLogo/index.js +20 -20
- package/commonjs/PartnerLogo/styles.js +40 -0
- package/dist/icon.svg +1 -1
- package/dist/iconList.js +1 -1
- package/dist/logo.svg +1 -1
- package/dist/logoList.js +1 -1
- package/lib/Button/index.js +11 -1
- package/lib/Checkbox/index.js +3 -3
- package/lib/Icon/styles.js +3 -0
- package/lib/IconViewBoxes.js +2 -0
- package/lib/Indicator/styles.js +3 -1
- package/lib/LoaderButton/index.js +3 -1
- package/lib/LogoViewBoxes.js +8 -0
- package/lib/PartnerLogo/index.js +19 -15
- package/lib/PartnerLogo/styles.js +26 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { text } from "@storybook/addon-knobs";
|
|
3
4
|
|
|
@@ -8,7 +9,7 @@ export default {
|
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
export const defaultStory = () => (
|
|
11
|
-
<Label>{text("children", "Example label")}</Label>
|
|
12
|
+
<Label htmlFor="default">{text("children", "Example label")}</Label>
|
|
12
13
|
);
|
|
13
14
|
|
|
14
15
|
defaultStory.story = {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from "react";
|
|
2
3
|
import Listbox, { ListboxButton } from "./index";
|
|
3
4
|
import { MenuButton } from "../Menu";
|
|
5
|
+
import type { TypeListboxButtonProps } from "../Menu/index.flow";
|
|
4
6
|
import { useMultiselect, useSelect } from "../utils/hooks";
|
|
5
7
|
import Icon from "../Icon";
|
|
6
8
|
import Button from "../Button";
|
|
@@ -59,13 +61,14 @@ const BaseListbox = () => {
|
|
|
59
61
|
);
|
|
60
62
|
};
|
|
61
63
|
|
|
62
|
-
const BaseListboxMultiselect = (props) => {
|
|
64
|
+
const BaseListboxMultiselect = (props: $Shape<TypeListboxButtonProps>) => {
|
|
63
65
|
const { value, onChange, onClear } = useMultiselect();
|
|
64
66
|
const currentOption =
|
|
65
67
|
value.length > 1 ? value.length + " selected" : value.length ? value : null;
|
|
66
68
|
|
|
67
69
|
return (
|
|
68
70
|
<ListboxButton
|
|
71
|
+
{...props}
|
|
69
72
|
minWidth="140px"
|
|
70
73
|
content={
|
|
71
74
|
<Listbox
|
|
@@ -86,7 +89,6 @@ const BaseListboxMultiselect = (props) => {
|
|
|
86
89
|
)}
|
|
87
90
|
</Listbox>
|
|
88
91
|
}
|
|
89
|
-
{...props}
|
|
90
92
|
>
|
|
91
93
|
{currentOption || "Select a fruit"}
|
|
92
94
|
</ListboxButton>
|
|
@@ -198,18 +200,22 @@ export const BigVirtualizedExample = () => {
|
|
|
198
200
|
};
|
|
199
201
|
|
|
200
202
|
const ListboxFilterInput = () => {
|
|
201
|
-
const { value, onChange } = useSelect(
|
|
202
|
-
const { inputValue } = useSelect({ initialValue: null });
|
|
203
|
+
const { value, onChange } = useSelect();
|
|
203
204
|
return (
|
|
204
205
|
<>
|
|
205
|
-
<Text>{
|
|
206
|
+
<Text>{value}</Text>
|
|
206
207
|
<ListboxButton
|
|
207
208
|
minWidth="200px"
|
|
208
209
|
aria-label="Favorite fruit"
|
|
209
210
|
content={
|
|
210
211
|
<Listbox onChange={onChange} value={value} width="200px">
|
|
211
212
|
<Listbox.Group>
|
|
212
|
-
<Listbox.FilterInput
|
|
213
|
+
<Listbox.FilterInput
|
|
214
|
+
id="list-filter"
|
|
215
|
+
name="list-filter"
|
|
216
|
+
placeholder="Filter items"
|
|
217
|
+
mb={300}
|
|
218
|
+
/>
|
|
213
219
|
<Listbox.Item value="Apple">Apple</Listbox.Item>
|
|
214
220
|
<Listbox.Item value="Orange">Orange</Listbox.Item>
|
|
215
221
|
<Listbox.Item value="Banana">Banana</Listbox.Item>
|
package/__flow__/Loader/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import Container, { Text } from "./styles";
|
|
4
4
|
|
|
5
|
-
type TypeProps = {
|
|
5
|
+
export type TypeProps = {
|
|
6
6
|
size: "small" | "large",
|
|
7
7
|
/** Text for the loader. This text is not visible, but is used for accessibility purposed */
|
|
8
8
|
text: string,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from "react";
|
|
2
|
-
import Loader from "./";
|
|
3
|
+
import Loader, { type TypeProps } from "./";
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: "Loader",
|
|
6
7
|
component: Loader,
|
|
7
8
|
};
|
|
8
9
|
|
|
9
|
-
export const defaultStory = (args) => <Loader {...args} />;
|
|
10
|
+
export const defaultStory = (args: TypeProps) => <Loader {...args} />;
|
|
10
11
|
|
|
11
12
|
defaultStory.args = {
|
|
12
13
|
text: "Content loading",
|
|
@@ -16,7 +17,7 @@ defaultStory.story = {
|
|
|
16
17
|
name: "Default",
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
export const small = (args) => <Loader {...args} />;
|
|
20
|
+
export const small = (args: TypeProps) => <Loader {...args} />;
|
|
20
21
|
|
|
21
22
|
small.args = {
|
|
22
23
|
text: "Content loading",
|
|
@@ -27,7 +28,7 @@ small.story = {
|
|
|
27
28
|
name: "Small",
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
export const noDelay = (args) => <Loader {...args} />;
|
|
31
|
+
export const noDelay = (args: TypeProps) => <Loader {...args} />;
|
|
31
32
|
|
|
32
33
|
noDelay.args = {
|
|
33
34
|
text: "Content loading",
|
|
@@ -14,7 +14,9 @@ type TypeLoaderButtonProps = TypeButtonProps & {
|
|
|
14
14
|
|
|
15
15
|
const getColor = (appearance) => {
|
|
16
16
|
switch (appearance) {
|
|
17
|
+
/** "default" is @deprecated in favour of unstyled */
|
|
17
18
|
case "default":
|
|
19
|
+
case "unstyled":
|
|
18
20
|
case "outline":
|
|
19
21
|
case "secondary":
|
|
20
22
|
return "dark";
|
|
@@ -44,7 +46,7 @@ const CustomLoader = styled(Loader)`
|
|
|
44
46
|
`;
|
|
45
47
|
|
|
46
48
|
export const LoaderButton = ({
|
|
47
|
-
appearance = "
|
|
49
|
+
appearance = "unstyled",
|
|
48
50
|
isLoading: _isLoading = false,
|
|
49
51
|
disabled,
|
|
50
52
|
loaderLabel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {"bitly-dark":"0 0 140 64","bitly":"0 0 140 64","canva-dark":"0 0 140 140","canva":"0 0 140 140","dropbox-dark":"0 0 140 119","dropbox":"0 0 140 119","facebook-audience-network-dark":"0 0 140 145","facebook-audience-network":"0 0 140 145","facebook-dark":"0 0 141 139","facebook-groups-dark":"0 0 140 140","facebook-groups":"0 0 140 140","facebook-shops-dark":"0 0 141 155","facebook-shops":"0 0 141 155","facebook":"0 0 141 139","feedly-dark":"0 0 141 123","feedly":"0 0 141 123","glassdoor-dark":"0 0 140 196","glassdoor":"0 0 140 196","google-analytics-dark":"0 0 140 160","google-analytics":"0 0 140 160","google-business-messages-dark":"0 0 140 140","google-business-messages":"0 0 140 140","google-drive-dark":"0 0 140 126","google-drive":"0 0 140 126","google-my-business-dark":"0 0 140 123","google-my-business":"0 0 140 123","hubspot-dark":"0 0 140 156","hubspot":"0 0 140 156","instagram-dark":"0 0 140 140","instagram":"0 0 140 140","linkedin-audience-network-dark":"0 0 140 141","linkedin-audience-network":"0 0 140 141","linkedin-dark":"0 0 140 140","linkedin":"0 0 140 140","marketo-dark":"0 0 140 164","marketo":"0 0 140 164","messenger-dark":"0 0 140 141","messenger":"0 0 140 140","microsoft-dynamics-dark":"0 0 140 227","microsoft-dynamics":"0 0 140 227","pinterest-dark":"0 0 140 141","pinterest":"0 0 140 141","reddit-dark":"0 0 140 140","reddit":"0 0 140 140","salesforce-dark":"0 0 140 99","salesforce":"0 0 140 99","shopify-dark":"0 0 140 159","shopify":"0 0 140 159","slack-dark":"0 0 140 140","slack":"0 0 140 140","tiktok-dark":"0 0 140 159","tiktok":"0 0 140 159","tripadvisor-dark":"0 0 140 140","tripadvisor":"0 0 140 140","tumblr-dark":"0 0 140 140","tumblr":"0 0 140 140","twitter-audience-network-dark":"0 0 140 140","twitter-audience-network":"0 0 140 140","twitter-dark":"0 0 140 114","twitter":"0 0 140 114","whatsapp-dark":"0 0 140 140","whatsapp":"0 0 140 141","woocommerce-dark":"0 0 140 84","woocommerce":"0 0 140 84","yelp-dark":"0 0 140 159","yelp":"0 0 140 159","youtube-dark":"0 0 140 99","youtube":"0 0 140 99","zendesk-dark":"0 0 140 107","zendesk":"0 0 140 107"};
|
|
1
|
+
module.exports = {"bitly-dark":"0 0 140 64","bitly":"0 0 140 64","canva-dark":"0 0 140 140","canva":"0 0 140 140","dropbox-dark":"0 0 140 119","dropbox-lockup-dark":"0 0 291 57","dropbox-lockup":"0 0 291 57","dropbox-wordmark-dark":"0 0 308 71","dropbox-wordmark":"0 0 308 71","dropbox":"0 0 140 119","facebook-audience-network-dark":"0 0 140 145","facebook-audience-network":"0 0 140 145","facebook-dark":"0 0 141 139","facebook-groups-dark":"0 0 140 140","facebook-groups":"0 0 140 140","facebook-shops-dark":"0 0 141 155","facebook-shops":"0 0 141 155","facebook":"0 0 141 139","feedly-dark":"0 0 141 123","feedly":"0 0 141 123","glassdoor-dark":"0 0 140 196","glassdoor":"0 0 140 196","google-analytics-dark":"0 0 140 160","google-analytics":"0 0 140 160","google-business-messages-dark":"0 0 140 140","google-business-messages":"0 0 140 140","google-drive-dark":"0 0 140 126","google-drive":"0 0 140 126","google-my-business-dark":"0 0 140 123","google-my-business":"0 0 140 123","hubspot-dark":"0 0 140 156","hubspot":"0 0 140 156","instagram-dark":"0 0 140 140","instagram":"0 0 140 140","linkedin-audience-network-dark":"0 0 140 141","linkedin-audience-network":"0 0 140 141","linkedin-dark":"0 0 140 140","linkedin":"0 0 140 140","marketo-dark":"0 0 140 164","marketo":"0 0 140 164","messenger-dark":"0 0 140 141","messenger":"0 0 140 140","microsoft-dynamics-dark":"0 0 140 227","microsoft-dynamics":"0 0 140 227","pinterest-dark":"0 0 140 141","pinterest":"0 0 140 141","reddit-dark":"0 0 140 140","reddit":"0 0 140 140","salesforce-dark":"0 0 140 99","salesforce":"0 0 140 99","shopify-dark":"0 0 140 159","shopify":"0 0 140 159","slack-dark":"0 0 140 140","slack":"0 0 140 140","tiktok-dark":"0 0 140 159","tiktok":"0 0 140 159","tripadvisor-dark":"0 0 140 140","tripadvisor":"0 0 140 140","tumblr-dark":"0 0 140 140","tumblr":"0 0 140 140","twitter-audience-network-dark":"0 0 140 140","twitter-audience-network":"0 0 140 140","twitter-dark":"0 0 140 114","twitter":"0 0 140 114","whatsapp-dark":"0 0 140 140","whatsapp":"0 0 140 141","woocommerce-dark":"0 0 140 84","woocommerce":"0 0 140 84","yelp-dark":"0 0 140 159","yelp":"0 0 140 159","youtube-dark":"0 0 140 99","youtube":"0 0 140 99","zendesk-dark":"0 0 140 107","zendesk-lockup-dark":"0 0 160 115","zendesk-lockup":"0 0 160 115","zendesk-wordmark-dark":"0 0 350 67","zendesk-wordmark":"0 0 350 67","zendesk":"0 0 140 107"};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React, { useContext } from "react";
|
|
2
3
|
import Menu, { MenuButton, MenuCheckbox } from "./index";
|
|
4
|
+
import type { TypeMenuProps } from "./index.flow";
|
|
3
5
|
import { MenuButtonContext } from "./hooks";
|
|
4
6
|
import OverflowList from "../OverflowList";
|
|
5
7
|
import Icon from "../Icon";
|
|
@@ -33,16 +35,16 @@ const BaseContents = () => (
|
|
|
33
35
|
</>
|
|
34
36
|
);
|
|
35
37
|
|
|
36
|
-
const BaseMenu = (props) => (
|
|
38
|
+
const BaseMenu = (props: TypeMenuProps) => (
|
|
37
39
|
<Menu width="200px" {...props}>
|
|
38
40
|
<BaseContents />
|
|
39
41
|
</Menu>
|
|
40
42
|
);
|
|
41
43
|
|
|
42
|
-
const VirtualizedMenu = (props) => {
|
|
44
|
+
const VirtualizedMenu = (props: TypeMenuProps) => {
|
|
43
45
|
return (
|
|
44
46
|
<Menu width="200px" {...props}>
|
|
45
|
-
<OverflowList height="200px">
|
|
47
|
+
<OverflowList height="200px" width="auto">
|
|
46
48
|
<Menu.Group title="1">
|
|
47
49
|
{fruit.map((item) => (
|
|
48
50
|
<Menu.Item key={item} onClick={() => alert(item)}>
|
|
@@ -127,6 +129,7 @@ export const PropGetters = () => {
|
|
|
127
129
|
<Menu.Group>
|
|
128
130
|
<OverflowList
|
|
129
131
|
height="400px"
|
|
132
|
+
width="auto"
|
|
130
133
|
items={names}
|
|
131
134
|
getItemProps={({ item }) => ({ key: item, item })}
|
|
132
135
|
ItemComponent={({ item }) => (
|
|
@@ -152,7 +155,7 @@ const CloseOnClick = () => {
|
|
|
152
155
|
return (
|
|
153
156
|
<Menu.Item
|
|
154
157
|
onClick={() => {
|
|
155
|
-
closePopout();
|
|
158
|
+
closePopout && closePopout();
|
|
156
159
|
}}
|
|
157
160
|
>
|
|
158
161
|
close the popout
|
|
@@ -180,7 +183,7 @@ export const OneItemCanCloseThePopout = () => {
|
|
|
180
183
|
);
|
|
181
184
|
};
|
|
182
185
|
|
|
183
|
-
export const MenuWithCheckboxes = (props) => {
|
|
186
|
+
export const MenuWithCheckboxes = (props: TypeMenuProps) => {
|
|
184
187
|
return (
|
|
185
188
|
<Menu width="200px" {...props}>
|
|
186
189
|
<Menu.Group title="Fruit" titleAs="h2">
|
|
@@ -206,7 +209,7 @@ export const MenuWithCheckboxes = (props) => {
|
|
|
206
209
|
};
|
|
207
210
|
|
|
208
211
|
// Specifically testing that icons with a color inverse when active like the text does.
|
|
209
|
-
export const MenuWithIcons = (props) => {
|
|
212
|
+
export const MenuWithIcons = (props: TypeMenuProps) => {
|
|
210
213
|
return (
|
|
211
214
|
<Box
|
|
212
215
|
width="200px"
|
|
@@ -234,7 +237,7 @@ export const MenuWithIcons = (props) => {
|
|
|
234
237
|
);
|
|
235
238
|
};
|
|
236
239
|
|
|
237
|
-
export const MenuWithFilter = (props) => {
|
|
240
|
+
export const MenuWithFilter = (props: TypeMenuProps) => {
|
|
238
241
|
return (
|
|
239
242
|
<Box
|
|
240
243
|
width="200px"
|
|
@@ -245,7 +248,12 @@ export const MenuWithFilter = (props) => {
|
|
|
245
248
|
backgroundColor="container.background.base"
|
|
246
249
|
>
|
|
247
250
|
<Menu {...props}>
|
|
248
|
-
<Menu.FilterInput
|
|
251
|
+
<Menu.FilterInput
|
|
252
|
+
id="menu-input"
|
|
253
|
+
name="menu-input"
|
|
254
|
+
placeholder="filter contents..."
|
|
255
|
+
m={300}
|
|
256
|
+
/>
|
|
249
257
|
<BaseContents />
|
|
250
258
|
</Menu>
|
|
251
259
|
</Box>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from "react";
|
|
2
3
|
import {
|
|
3
4
|
render,
|
|
@@ -8,13 +9,14 @@ import {
|
|
|
8
9
|
import Icon from "../Icon";
|
|
9
10
|
|
|
10
11
|
import Menu, { MenuButton } from "./index";
|
|
12
|
+
import type { TypeMenuProps } from "./index.flow";
|
|
11
13
|
import { MENU_ITEM_ROLES } from "./constants";
|
|
12
14
|
|
|
13
15
|
const fruit = ["Apple", "Banana", "Orange"];
|
|
14
16
|
const maybeFruit = ["Tomato", "Cucumber", "Squash"];
|
|
15
17
|
const mockOnClick = jest.fn();
|
|
16
18
|
|
|
17
|
-
export const AsMenu = (props) => {
|
|
19
|
+
export const AsMenu = (props: TypeMenuProps) => {
|
|
18
20
|
return (
|
|
19
21
|
<Menu width="200px" {...props}>
|
|
20
22
|
<Menu.Group title="Fruit">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from "react";
|
|
2
|
-
import Message from "./index";
|
|
3
|
+
import Message, { type EnumDensities } from "./index";
|
|
3
4
|
import Box from "../Box";
|
|
4
5
|
import Icon from "../Icon";
|
|
5
6
|
import { select } from "@storybook/addon-knobs";
|
|
@@ -14,6 +15,8 @@ export const defaultStory = ({
|
|
|
14
15
|
["condensed", "compact", "small", "large"],
|
|
15
16
|
"condensed"
|
|
16
17
|
),
|
|
18
|
+
}: {
|
|
19
|
+
density?: EnumDensities,
|
|
17
20
|
}) => (
|
|
18
21
|
<Message density={density} bg="container.background.base">
|
|
19
22
|
<Message.Header>
|
|
@@ -26,11 +29,16 @@ export const defaultStory = ({
|
|
|
26
29
|
Attribution
|
|
27
30
|
</Box>
|
|
28
31
|
<Box>
|
|
29
|
-
<Message.Checkbox
|
|
32
|
+
<Message.Checkbox
|
|
33
|
+
id="message-checkbox"
|
|
34
|
+
ariaLabel="Message Checkbox"
|
|
35
|
+
onChange={() => {}}
|
|
36
|
+
/>
|
|
30
37
|
</Box>
|
|
31
38
|
</Message.Header>
|
|
32
39
|
<Message.Body>Message Content</Message.Body>
|
|
33
40
|
<Message.Footer>
|
|
41
|
+
{/* $FlowIssue - Could not decide which case to select */}
|
|
34
42
|
<Box>
|
|
35
43
|
<Message.Button>
|
|
36
44
|
<Icon name="comment-alt-outline" mr={200} />
|
|
@@ -38,16 +46,16 @@ export const defaultStory = ({
|
|
|
38
46
|
</Message.Button>
|
|
39
47
|
</Box>
|
|
40
48
|
<Box>
|
|
41
|
-
<Message.Button>
|
|
49
|
+
<Message.Button aria-label="Heart Icon Example">
|
|
42
50
|
<Icon name="heart-outline" />
|
|
43
51
|
</Message.Button>
|
|
44
|
-
<Message.Button>
|
|
52
|
+
<Message.Button aria-label="Tag Icon Example">
|
|
45
53
|
<Icon name="tag-outline" />
|
|
46
54
|
</Message.Button>
|
|
47
|
-
<Message.Button>
|
|
55
|
+
<Message.Button aria-label="Reply Icon Example">
|
|
48
56
|
<Icon name="reply-outline" />
|
|
49
57
|
</Message.Button>
|
|
50
|
-
<Message.Button>
|
|
58
|
+
<Message.Button aria-label="Check Icon Example">
|
|
51
59
|
<Icon name="circle-check-outline" />
|
|
52
60
|
</Message.Button>
|
|
53
61
|
</Box>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// @flow
|
|
2
2
|
import { render } from "../utils/react-testing-library";
|
|
3
3
|
import "jest-styled-components";
|
|
4
|
-
import
|
|
4
|
+
import { defaultStory as defaultMessageStory } from "./index.stories";
|
|
5
5
|
|
|
6
6
|
describe("Message", () => {
|
|
7
7
|
it("should render properly", async () => {
|
|
8
|
-
const { container, runA11yCheck } = render(
|
|
8
|
+
const { container, runA11yCheck } = render(defaultMessageStory({}));
|
|
9
9
|
expect(container).toBeTruthy();
|
|
10
10
|
await runA11yCheck();
|
|
11
11
|
});
|
|
@@ -15,7 +15,7 @@ import { EM_DASH } from "../utils/constants";
|
|
|
15
15
|
|
|
16
16
|
type EnumNumeralFormat = "decimal" | "currency" | "percent";
|
|
17
17
|
|
|
18
|
-
type TypeProps = {
|
|
18
|
+
export type TypeProps = {
|
|
19
19
|
/** The number to be formatted */
|
|
20
20
|
number?: ?number,
|
|
21
21
|
/** Locale to format. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from "react";
|
|
2
|
-
import Numeral from "./index";
|
|
3
|
+
import Numeral, { type TypeProps } from "./index";
|
|
3
4
|
|
|
4
5
|
const localeOptions = [
|
|
5
6
|
"United States (en-US)",
|
|
@@ -120,13 +121,13 @@ export default {
|
|
|
120
121
|
},
|
|
121
122
|
};
|
|
122
123
|
|
|
123
|
-
export const defaultStory = (args) => <Numeral {...args} />;
|
|
124
|
+
export const defaultStory = (args: TypeProps) => <Numeral {...args} />;
|
|
124
125
|
|
|
125
126
|
defaultStory.story = {
|
|
126
127
|
name: "Default",
|
|
127
128
|
};
|
|
128
129
|
|
|
129
|
-
export const total = (args) => <Numeral {...args} />;
|
|
130
|
+
export const total = (args: TypeProps) => <Numeral {...args} />;
|
|
130
131
|
|
|
131
132
|
total.args = {
|
|
132
133
|
number: 100,
|
|
@@ -138,7 +139,7 @@ total.story = {
|
|
|
138
139
|
name: "Total",
|
|
139
140
|
};
|
|
140
141
|
|
|
141
|
-
export const trend = (args) => <Numeral {...args} />;
|
|
142
|
+
export const trend = (args: TypeProps) => <Numeral {...args} />;
|
|
142
143
|
|
|
143
144
|
trend.args = {
|
|
144
145
|
number: 100,
|
|
@@ -149,7 +150,7 @@ trend.story = {
|
|
|
149
150
|
name: "Trend",
|
|
150
151
|
};
|
|
151
152
|
|
|
152
|
-
export const noPrecision = (args) => <Numeral {...args} />;
|
|
153
|
+
export const noPrecision = (args: TypeProps) => <Numeral {...args} />;
|
|
153
154
|
|
|
154
155
|
noPrecision.args = {
|
|
155
156
|
number: 123.45678,
|
|
@@ -160,7 +161,7 @@ noPrecision.story = {
|
|
|
160
161
|
name: "No Precision",
|
|
161
162
|
};
|
|
162
163
|
|
|
163
|
-
export const currencyPrecision = (args) => <Numeral {...args} />;
|
|
164
|
+
export const currencyPrecision = (args: TypeProps) => <Numeral {...args} />;
|
|
164
165
|
|
|
165
166
|
currencyPrecision.args = {
|
|
166
167
|
number: 123.4,
|
|
@@ -171,7 +172,7 @@ currencyPrecision.story = {
|
|
|
171
172
|
name: "Currency precision",
|
|
172
173
|
};
|
|
173
174
|
|
|
174
|
-
export const invalid = (args) => <Numeral {...args} />;
|
|
175
|
+
export const invalid = (args: TypeProps) => <Numeral {...args} />;
|
|
175
176
|
|
|
176
177
|
invalid.args = {
|
|
177
178
|
number: null,
|
|
@@ -15,8 +15,8 @@ export type TypeOverflowListProps<Item, Props> = {|
|
|
|
15
15
|
width: string,
|
|
16
16
|
items?: Array<Item>,
|
|
17
17
|
children?: React.Node,
|
|
18
|
-
ItemComponent
|
|
19
|
-
getItemProps
|
|
18
|
+
ItemComponent?: React.ComponentType<Props>,
|
|
19
|
+
getItemProps?: (Item) => Props,
|
|
20
20
|
itemWrapperProps?: TypeContainerProps,
|
|
21
21
|
containerProps?: TypeContainerProps,
|
|
22
22
|
|};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from "react";
|
|
2
3
|
import OverflowList from "./index";
|
|
3
4
|
import Box from "../Box";
|
|
@@ -9,7 +10,7 @@ export default {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const defaultStory = () => (
|
|
12
|
-
<OverflowList height=
|
|
13
|
+
<OverflowList height="300px" width="200px">
|
|
13
14
|
{names.map((name) => (
|
|
14
15
|
<Box key={name}>
|
|
15
16
|
<Text color="text.body">{name}</Text>
|
|
@@ -25,8 +26,8 @@ defaultStory.story = {
|
|
|
25
26
|
export const PropGetters = () => {
|
|
26
27
|
return (
|
|
27
28
|
<OverflowList
|
|
28
|
-
height=
|
|
29
|
-
width=
|
|
29
|
+
height="300px"
|
|
30
|
+
width="200px"
|
|
30
31
|
items={names}
|
|
31
32
|
getItemProps={({ item }) => ({ key: item, item })}
|
|
32
33
|
ItemComponent={({ item }) => (
|
|
@@ -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";
|
|
@@ -41,13 +42,15 @@ describe("List", () => {
|
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
it("should render properly", async () => {
|
|
44
|
-
const { container, runA11yCheck } = render(
|
|
45
|
+
const { container, runA11yCheck } = render(
|
|
46
|
+
<List height="300px" width="200px" />
|
|
47
|
+
);
|
|
45
48
|
expect(container).toBeTruthy();
|
|
46
49
|
await runA11yCheck();
|
|
47
50
|
});
|
|
48
51
|
it("should render children", () => {
|
|
49
52
|
const { queryByText } = render(
|
|
50
|
-
<List>
|
|
53
|
+
<List height="300px" width="200px">
|
|
51
54
|
<div>item 1</div>
|
|
52
55
|
<div>item 2</div>
|
|
53
56
|
<div>item 3</div>
|
|
@@ -60,6 +63,8 @@ describe("List", () => {
|
|
|
60
63
|
it("should render items", () => {
|
|
61
64
|
const { queryByText } = render(
|
|
62
65
|
<List
|
|
66
|
+
height="300px"
|
|
67
|
+
width="200px"
|
|
63
68
|
items={["item 1", "item 2", "item 3"]}
|
|
64
69
|
getItemProps={(item) => ({
|
|
65
70
|
item,
|
|
@@ -3,52 +3,44 @@ import React from "react";
|
|
|
3
3
|
import logoViewBoxes from "../LogoViewBoxes";
|
|
4
4
|
import type { TypePartnerNames } from "./TypePartnerNames";
|
|
5
5
|
import { useTheme } from "styled-components";
|
|
6
|
-
import
|
|
7
|
-
import { COMMON, FLEXBOX } from "../utils/system-props";
|
|
8
|
-
import type {
|
|
9
|
-
TypeSystemCommonProps,
|
|
10
|
-
TypeSystemFlexboxProps,
|
|
11
|
-
} from "../types/system-props.flow";
|
|
12
|
-
import type { TypeTheme } from "../types/theme.flow";
|
|
6
|
+
import Container from "./styles";
|
|
13
7
|
|
|
14
|
-
type
|
|
15
|
-
...TypeSystemCommonProps,
|
|
16
|
-
...TypeSystemFlexboxProps,
|
|
17
|
-
|};
|
|
18
|
-
|
|
19
|
-
type TypeStyledSVG = StyledComponent<TypeSystemProps, TypeTheme, *>;
|
|
20
|
-
|
|
21
|
-
const StyledSVG: TypeStyledSVG = styled.svg`
|
|
22
|
-
${FLEXBOX};
|
|
23
|
-
${COMMON}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
type TypeProps = {
|
|
8
|
+
export type TypeProps = {
|
|
27
9
|
/** The name of the partner whose logo you want to render. */
|
|
28
10
|
partnerName: TypePartnerNames,
|
|
29
11
|
/** Manually override the default mode behavior by rendering a logo based on the background it's displayed on. */
|
|
30
12
|
backgroundType?: "dark" | "light",
|
|
13
|
+
logoType?: "wordmark" | "lockup",
|
|
31
14
|
height?: string,
|
|
32
15
|
width?: string,
|
|
16
|
+
size?:
|
|
17
|
+
| "mini" // 12x12
|
|
18
|
+
| "small" // 16x16
|
|
19
|
+
| "medium" // 24x24
|
|
20
|
+
| "large" // 32x32
|
|
21
|
+
| "jumbo", // 64x64
|
|
33
22
|
};
|
|
34
23
|
|
|
35
24
|
const PartnerLogo = ({
|
|
36
25
|
partnerName,
|
|
37
26
|
backgroundType,
|
|
27
|
+
logoType,
|
|
38
28
|
height,
|
|
39
29
|
width,
|
|
30
|
+
size,
|
|
40
31
|
...rest
|
|
41
32
|
}: TypeProps) => {
|
|
42
33
|
const { mode } = useTheme();
|
|
43
34
|
const whichLogo = (type) => {
|
|
35
|
+
const logo = logoType ? partnerName + "-" + logoType : partnerName;
|
|
44
36
|
if (type && type === "dark") {
|
|
45
|
-
return `${
|
|
37
|
+
return `${logo}-dark`;
|
|
46
38
|
} else if (type && type === "light") {
|
|
47
|
-
return
|
|
39
|
+
return logo;
|
|
48
40
|
} else if (mode === "dark") {
|
|
49
|
-
return `${
|
|
41
|
+
return `${logo}-dark`;
|
|
50
42
|
} else {
|
|
51
|
-
return
|
|
43
|
+
return logo;
|
|
52
44
|
}
|
|
53
45
|
};
|
|
54
46
|
const logoViewBox = logoViewBoxes[whichLogo(backgroundType)];
|
|
@@ -57,19 +49,27 @@ const PartnerLogo = ({
|
|
|
57
49
|
const defaultHeight = viewBoxCoordinates[3];
|
|
58
50
|
|
|
59
51
|
return (
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
height={height ? height : defaultHeight}
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
<Container
|
|
53
|
+
//we add pixels here because view box coordinates are numbers
|
|
54
|
+
height={height ? height : defaultHeight + "px"}
|
|
55
|
+
width={width ? width : defaultWidth + "px"}
|
|
56
|
+
logoSize={size}
|
|
65
57
|
// $FlowIssue - upgrade v0.112.0
|
|
66
58
|
{...rest}
|
|
67
59
|
>
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
<svg
|
|
61
|
+
className="logo-svg"
|
|
62
|
+
viewBox={logoViewBox}
|
|
63
|
+
focusable={false}
|
|
64
|
+
// $FlowIssue - upgrade v0.112.0
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
<use
|
|
68
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
69
|
+
xlinkHref={`#sslogosvg-${whichLogo(backgroundType)}`}
|
|
70
|
+
/>
|
|
71
|
+
</svg>
|
|
72
|
+
</Container>
|
|
73
73
|
);
|
|
74
74
|
};
|
|
75
75
|
|