@sproutsocial/racine 11.4.2-input-beta.0 → 11.6.1-input-beta.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 +25 -0
- package/__flow__/Button/index.js +2 -0
- package/__flow__/Button/index.stories.js +51 -67
- package/__flow__/Button/styles.js +1 -1
- package/__flow__/EmptyState/index.test.js +1 -1
- package/__flow__/Input/index.js +22 -14
- package/__flow__/Input/styles.js +2 -2
- package/__flow__/Menu/__snapshots__/index.test.js.snap +2 -2
- package/__flow__/ThemeProvider/index.js +5 -2
- package/__flow__/index.js +5 -1
- package/__flow__/setupTests.js +1 -1
- package/__flow__/systemProps/tests/__snapshots__/layout.test.js.snap +0 -14
- package/__flow__/systemProps/tests/layout.test.js +0 -9
- package/__flow__/themes/dark/theme.js +3 -3
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +42 -0
- package/__flow__/themes/extendedThemes/sproutTheme/index.js +3 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +42 -0
- package/__flow__/types/theme.colors.flow.js +8 -1
- package/__flow__/types/theme.flow.js +14 -0
- package/commonjs/Button/index.js +1 -0
- package/commonjs/Button/styles.js +1 -0
- package/commonjs/Input/index.js +19 -9
- package/commonjs/Input/styles.js +2 -2
- package/commonjs/Message/styles.js +1 -1
- package/commonjs/index.js +8 -1
- package/commonjs/themes/dark/theme.js +3 -3
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +49 -0
- package/commonjs/themes/extendedThemes/sproutTheme/index.js +14 -0
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +49 -0
- package/commonjs/types/theme.flow.js +3 -1
- package/dist/themes/dark/dark.scss +0 -3
- package/lib/Button/index.js +1 -0
- package/lib/Button/styles.js +1 -0
- package/lib/Input/index.js +19 -9
- package/lib/Input/styles.js +2 -2
- package/lib/Message/styles.js +1 -1
- package/lib/index.js +1 -0
- package/lib/themes/dark/theme.js +3 -3
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +39 -0
- package/lib/themes/extendedThemes/sproutTheme/index.js +2 -0
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +39 -0
- package/lib/types/theme.flow.js +2 -1
- package/package.json +25 -21
- package/__flow__/Button/__snapshots__/index.test.js.snap +0 -511
- package/__flow__/Button/index.test.js +0 -113
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eb27d01: Fix interact util in dark mode themes
|
|
8
|
+
- The `interact` util was located at a different location in the light and dark mode base theme objects. It was at the base level of the light theme and nested inside of `colors` for the dark theme.
|
|
9
|
+
- `interact` was seemingly available at the base level of the theme in both modes, because we spread the light theme as the basis of the dark theme. However, the `interact` util accessible at the base level of the theme would behave like light mode in either mode.
|
|
10
|
+
- The `interact` util located inside the `colors` object inside the dark mode theme object was not usable, due to only being defined in that location for dark mode, and has been removed.
|
|
11
|
+
- eb27d01: Remove 'just-clone' dependency
|
|
12
|
+
- eb27d01: Fix "navigation" colors in SproutTheme
|
|
13
|
+
- The "navigation" colors were not available in the theme due to being spread in incorrectly.
|
|
14
|
+
- eb27d01: Improve theme types to be more accurate
|
|
15
|
+
|
|
16
|
+
## 11.6.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 43adc28: Added a sprout theme to racine
|
|
21
|
+
|
|
22
|
+
## 11.5.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- fa8a45d: Dependency upgrades: upgraded severe vulnerabilities as well as storybook and jest suite fixes. Upgraded styled components from beta to stable v5.2.3.
|
|
27
|
+
|
|
3
28
|
## 11.4.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/__flow__/Button/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { boolean, text, number } from "@storybook/addon-knobs";
|
|
3
2
|
import Button from "./index";
|
|
4
3
|
import Icon from "../Icon";
|
|
5
4
|
import Box from "../Box";
|
|
@@ -8,155 +7,140 @@ export default {
|
|
|
8
7
|
title: "Button",
|
|
9
8
|
};
|
|
10
9
|
|
|
11
|
-
export const defaultStory = () => (
|
|
12
|
-
<Button
|
|
13
|
-
appearance={text("appearance", "default")}
|
|
14
|
-
onClick={() => alert("Testing...")}
|
|
15
|
-
>
|
|
10
|
+
export const defaultStory = (args) => (
|
|
11
|
+
<Button {...args} onClick={() => alert("Testing...")}>
|
|
16
12
|
Default
|
|
17
13
|
</Button>
|
|
18
14
|
);
|
|
19
15
|
|
|
16
|
+
defaultStory.args = { appearance: "default" };
|
|
17
|
+
|
|
20
18
|
defaultStory.story = {
|
|
21
19
|
name: "Default",
|
|
22
20
|
};
|
|
23
21
|
|
|
24
|
-
export const primary = () => (
|
|
25
|
-
<Button
|
|
26
|
-
appearance={text("appearance", "primary")}
|
|
27
|
-
onClick={() => alert("Testing...")}
|
|
28
|
-
>
|
|
22
|
+
export const primary = (args) => (
|
|
23
|
+
<Button {...args} onClick={() => alert("Testing...")}>
|
|
29
24
|
Primary Button
|
|
30
25
|
</Button>
|
|
31
26
|
);
|
|
32
27
|
|
|
28
|
+
primary.args = { appearance: "primary" };
|
|
29
|
+
|
|
33
30
|
primary.story = {
|
|
34
31
|
name: "Primary",
|
|
35
32
|
};
|
|
36
33
|
|
|
37
|
-
export const secondary = () =>
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
export const secondary = (args) => <Button {...args}>Secondary Button</Button>;
|
|
35
|
+
|
|
36
|
+
secondary.args = { appearance: "secondary" };
|
|
40
37
|
|
|
41
38
|
secondary.story = {
|
|
42
39
|
name: "Secondary",
|
|
43
40
|
};
|
|
44
41
|
|
|
45
|
-
export const destructive = () => (
|
|
46
|
-
<Button
|
|
47
|
-
Destructive Button
|
|
48
|
-
</Button>
|
|
42
|
+
export const destructive = (args) => (
|
|
43
|
+
<Button {...args}>Destructive Button</Button>
|
|
49
44
|
);
|
|
50
45
|
|
|
46
|
+
destructive.args = { appearance: "destructive" };
|
|
51
47
|
destructive.story = {
|
|
52
48
|
name: "Destructive",
|
|
53
49
|
};
|
|
54
50
|
|
|
55
|
-
export const placeholder = () => (
|
|
56
|
-
<Button
|
|
57
|
-
Placeholder Button
|
|
58
|
-
</Button>
|
|
51
|
+
export const placeholder = (args) => (
|
|
52
|
+
<Button {...args}>Placeholder Button</Button>
|
|
59
53
|
);
|
|
60
54
|
|
|
55
|
+
placeholder.args = { appearance: "placeholder" };
|
|
61
56
|
placeholder.story = {
|
|
62
57
|
name: "Placeholder",
|
|
63
58
|
};
|
|
64
59
|
|
|
65
|
-
export const largeButton = () =>
|
|
66
|
-
|
|
67
|
-
appearance={text("appearance", "primary")}
|
|
68
|
-
size={text("size", "large")}
|
|
69
|
-
>
|
|
70
|
-
Large Button
|
|
71
|
-
</Button>
|
|
72
|
-
);
|
|
60
|
+
export const largeButton = (args) => <Button {...args}>Large Button</Button>;
|
|
61
|
+
largeButton.args = { size: "large", appearance: "primary" };
|
|
73
62
|
|
|
74
63
|
largeButton.story = {
|
|
75
64
|
name: "Large button",
|
|
76
65
|
};
|
|
77
66
|
|
|
78
|
-
export const pillButton = () => (
|
|
67
|
+
export const pillButton = (args) => (
|
|
79
68
|
<Box bg="container.background.base" p={400}>
|
|
80
|
-
<Button
|
|
69
|
+
<Button {...args}>
|
|
81
70
|
<Icon name="reply" mr={350} />
|
|
82
71
|
Pill Button
|
|
83
72
|
</Button>
|
|
84
73
|
</Box>
|
|
85
74
|
);
|
|
86
|
-
|
|
75
|
+
pillButton.args = { appearance: "pill" };
|
|
87
76
|
pillButton.story = {
|
|
88
77
|
name: "Pill button",
|
|
89
78
|
};
|
|
90
79
|
|
|
91
|
-
export const pillIconOnlyButton = () => (
|
|
80
|
+
export const pillIconOnlyButton = (args) => (
|
|
92
81
|
<Box bg="container.background.base" p={400}>
|
|
93
|
-
<Button
|
|
82
|
+
<Button {...args} ariaLabel="This is a label">
|
|
94
83
|
<Icon name="circle-check-outline" />
|
|
95
84
|
</Button>
|
|
96
85
|
</Box>
|
|
97
86
|
);
|
|
98
87
|
|
|
88
|
+
pillIconOnlyButton.args = { appearance: "pill" };
|
|
99
89
|
pillIconOnlyButton.story = {
|
|
100
90
|
name: "Pill icon only button",
|
|
101
91
|
};
|
|
102
92
|
|
|
103
|
-
export const activeButton = () =>
|
|
104
|
-
<Button
|
|
105
|
-
appearance={text("appearance", "secondary")}
|
|
106
|
-
active={boolean("active", true)}
|
|
107
|
-
>
|
|
108
|
-
Active Button
|
|
109
|
-
</Button>
|
|
110
|
-
);
|
|
93
|
+
export const activeButton = (args) => <Button {...args}>Active Button</Button>;
|
|
111
94
|
|
|
95
|
+
activeButton.args = { appearance: "secondary", active: true };
|
|
112
96
|
activeButton.story = {
|
|
113
97
|
name: "Active button",
|
|
114
98
|
};
|
|
115
99
|
|
|
116
|
-
export const buttonAsALink = () => (
|
|
117
|
-
<Button
|
|
118
|
-
href={text("href", "http://sproutsocial.style")}
|
|
119
|
-
external={boolean("external", true)}
|
|
120
|
-
appearance={text("appearance", "primary")}
|
|
121
|
-
>
|
|
122
|
-
Button using anchor element
|
|
123
|
-
</Button>
|
|
100
|
+
export const buttonAsALink = (args) => (
|
|
101
|
+
<Button {...args}>Button using anchor element</Button>
|
|
124
102
|
);
|
|
125
|
-
|
|
103
|
+
buttonAsALink.args = {
|
|
104
|
+
appearance: "primary",
|
|
105
|
+
external: true,
|
|
106
|
+
href: "http://sproutsocial.style",
|
|
107
|
+
};
|
|
126
108
|
buttonAsALink.story = {
|
|
127
109
|
name: "Button as a link",
|
|
128
110
|
};
|
|
129
111
|
|
|
130
|
-
export const disabledButton = () => (
|
|
131
|
-
<Button
|
|
132
|
-
appearance={text("appearance", "primary")}
|
|
133
|
-
disabled={text("disabled", "true")}
|
|
134
|
-
>
|
|
135
|
-
This Button is disabled
|
|
136
|
-
</Button>
|
|
112
|
+
export const disabledButton = (args) => (
|
|
113
|
+
<Button {...args}>This Button is disabled</Button>
|
|
137
114
|
);
|
|
138
|
-
|
|
115
|
+
disabledButton.args = {
|
|
116
|
+
appearance: "primary",
|
|
117
|
+
disabled: true,
|
|
118
|
+
};
|
|
139
119
|
disabledButton.story = {
|
|
140
120
|
name: "Disabled button",
|
|
141
121
|
};
|
|
142
122
|
|
|
143
|
-
export const fullWidthButton = () => (
|
|
144
|
-
<Button
|
|
145
|
-
Full-Width Button
|
|
146
|
-
</Button>
|
|
123
|
+
export const fullWidthButton = (args) => (
|
|
124
|
+
<Button {...args}>Full-Width Button</Button>
|
|
147
125
|
);
|
|
148
|
-
|
|
126
|
+
fullWidthButton.args = {
|
|
127
|
+
appearance: "primary",
|
|
128
|
+
width: 1,
|
|
129
|
+
};
|
|
149
130
|
fullWidthButton.story = {
|
|
150
131
|
name: "Full width button",
|
|
151
132
|
};
|
|
152
133
|
|
|
153
|
-
export const withIcon = () => (
|
|
154
|
-
<Button
|
|
134
|
+
export const withIcon = (args) => (
|
|
135
|
+
<Button {...args}>
|
|
155
136
|
<Icon name="twitter" mr={350} />
|
|
156
137
|
Secondary Button
|
|
157
138
|
</Button>
|
|
158
139
|
);
|
|
159
140
|
|
|
141
|
+
withIcon.args = {
|
|
142
|
+
appearance: "secondary",
|
|
143
|
+
};
|
|
160
144
|
withIcon.story = {
|
|
161
145
|
name: "With icon",
|
|
162
146
|
};
|
package/__flow__/Input/index.js
CHANGED
|
@@ -16,7 +16,7 @@ type TypeProps = {
|
|
|
16
16
|
ariaLabel?: string,
|
|
17
17
|
/** Attribute used to associate other elements that describe the Input, like an error */
|
|
18
18
|
ariaDescribedby?: string,
|
|
19
|
-
/** Label for Input.ClearButton. Required when using
|
|
19
|
+
/** Label for Input.ClearButton. Required when using Input.ClearButton. */
|
|
20
20
|
clearButtonLabel?: string,
|
|
21
21
|
/** Placeholder text for when value is undefined or empty */
|
|
22
22
|
placeholder?: string,
|
|
@@ -52,8 +52,9 @@ type TypeProps = {
|
|
|
52
52
|
| ((React.ElementRef<any> | HTMLElement) => void),
|
|
53
53
|
onBlur?: (e: SyntheticFocusEvent<HTMLInputElement>) => void,
|
|
54
54
|
onChange?: (e: SyntheticInputEvent<HTMLInputElement>, value: string) => void,
|
|
55
|
-
/** Input.ClearButton onClick callback. Required when using
|
|
56
|
-
The component handles returning focus to Input after onClear is called
|
|
55
|
+
/** Input.ClearButton onClick callback. Required when using Input.ClearButton.
|
|
56
|
+
The component handles returning focus to Input after onClear is called.
|
|
57
|
+
For controlled Inputs, you must reset "value" yourself.*/
|
|
57
58
|
onClear?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
58
59
|
onFocus?: (e: SyntheticFocusEvent<HTMLInputElement>) => void,
|
|
59
60
|
onKeyDown?: (
|
|
@@ -84,6 +85,7 @@ type TypeInputContext = $Shape<{
|
|
|
84
85
|
onClear?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
85
86
|
handleClear: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
86
87
|
clearButtonLabel: string,
|
|
88
|
+
isControlled: boolean,
|
|
87
89
|
hasValue: boolean,
|
|
88
90
|
size: "large" | "small" | "default",
|
|
89
91
|
}>;
|
|
@@ -103,6 +105,7 @@ const ClearButton = () => {
|
|
|
103
105
|
onClear,
|
|
104
106
|
handleClear,
|
|
105
107
|
clearButtonLabel,
|
|
108
|
+
isControlled,
|
|
106
109
|
hasValue,
|
|
107
110
|
size: inputSize,
|
|
108
111
|
} = React.useContext(InputContext);
|
|
@@ -112,12 +115,9 @@ const ClearButton = () => {
|
|
|
112
115
|
return null;
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
if (!onClear) {
|
|
118
|
-
console.warn(
|
|
119
|
-
"Warning: No onClear prop provided to Input when using Input.ClearButton. Omitting Input.ClearButton."
|
|
120
|
-
);
|
|
118
|
+
// Hide the button when no onClear callback is provided to a controlled Input.
|
|
119
|
+
// For a controlled component, all the button would do without an onClear is focus the input.
|
|
120
|
+
if (isControlled && !onClear) {
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -162,7 +162,7 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
162
162
|
constructor(props: TypeProps) {
|
|
163
163
|
super(props);
|
|
164
164
|
this.state = {
|
|
165
|
-
//
|
|
165
|
+
// Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
166
166
|
// for both controlled and uncontrolled inputs.
|
|
167
167
|
hasValue: !!props.value,
|
|
168
168
|
};
|
|
@@ -178,7 +178,7 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
178
178
|
|
|
179
179
|
static ClearButton = ClearButton;
|
|
180
180
|
|
|
181
|
-
// Define our own ref for
|
|
181
|
+
// Define our own ref for use in handleClear.
|
|
182
182
|
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
183
183
|
inputRef = React.createRef<HTMLInputElement>();
|
|
184
184
|
|
|
@@ -186,8 +186,15 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
186
186
|
this.props.onBlur?.(e);
|
|
187
187
|
|
|
188
188
|
handleClear = (e: SyntheticEvent<HTMLButtonElement>) => {
|
|
189
|
-
|
|
189
|
+
// If the component is uncontrolled, clear its value via ref.
|
|
190
|
+
if (typeof this.props.value !== "string") {
|
|
191
|
+
if (this.inputRef.current) {
|
|
192
|
+
this.inputRef.current.value = "";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
this.inputRef.current?.focus();
|
|
190
196
|
this.props.onClear?.(e);
|
|
197
|
+
this.updateState("");
|
|
191
198
|
};
|
|
192
199
|
|
|
193
200
|
handleChange = (e: SyntheticInputEvent<HTMLInputElement>) => {
|
|
@@ -264,9 +271,9 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
264
271
|
) : (
|
|
265
272
|
elemBefore
|
|
266
273
|
);
|
|
267
|
-
// Do not add a ClearButton if
|
|
274
|
+
// Do not add a ClearButton if an elemAfter prop was passed.
|
|
268
275
|
const elementAfter =
|
|
269
|
-
type === "search" &&
|
|
276
|
+
type === "search" && !elemAfter ? <ClearButton /> : elemAfter;
|
|
270
277
|
|
|
271
278
|
return (
|
|
272
279
|
<Container
|
|
@@ -284,6 +291,7 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
284
291
|
value={{
|
|
285
292
|
handleClear: this.handleClear,
|
|
286
293
|
hasValue: this.state.hasValue,
|
|
294
|
+
isControlled: typeof this.props.value === "string",
|
|
287
295
|
clearButtonLabel,
|
|
288
296
|
onClear,
|
|
289
297
|
size,
|
package/__flow__/Input/styles.js
CHANGED
|
@@ -134,13 +134,13 @@ export const Accessory: StyledComponent<any, TypeTheme, *> = styled.div`
|
|
|
134
134
|
${(props) =>
|
|
135
135
|
props.before &&
|
|
136
136
|
css`
|
|
137
|
-
left: ${props.theme.space[
|
|
137
|
+
left: ${props.theme.space[300]};
|
|
138
138
|
`};
|
|
139
139
|
|
|
140
140
|
${(props) =>
|
|
141
141
|
props.after &&
|
|
142
142
|
css`
|
|
143
|
-
right: ${props.isClearButton ? 0 : props.theme.space[
|
|
143
|
+
right: ${props.isClearButton ? 0 : props.theme.space[300]};
|
|
144
144
|
`};
|
|
145
145
|
`;
|
|
146
146
|
|
|
@@ -3,10 +3,13 @@ import * as React from "react";
|
|
|
3
3
|
import { ThemeProvider as BaseThemeProvider } from "styled-components";
|
|
4
4
|
import theme from "../themes/light/theme";
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import type { TypeTheme, TypeSproutTheme } from "../types/theme.flow";
|
|
7
|
+
|
|
8
|
+
// We can append additional themes types here
|
|
9
|
+
type TypeAllThemes = TypeTheme | TypeSproutTheme;
|
|
7
10
|
|
|
8
11
|
type TypeProps = $ReadOnly<{|
|
|
9
|
-
theme?:
|
|
12
|
+
theme?: TypeAllThemes,
|
|
10
13
|
children: React.Node,
|
|
11
14
|
|}>;
|
|
12
15
|
|
package/__flow__/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
export type { EnumIconNames } from "./EnumIconNames";
|
|
3
|
-
export type { TypeTheme } from "./types/theme.flow";
|
|
3
|
+
export type { TypeTheme, TypeSproutTheme } from "./types/theme.flow";
|
|
4
4
|
export * from "./systemProps";
|
|
5
5
|
export { visuallyHidden, focusRing, disabled } from "./utils/mixins";
|
|
6
6
|
export { useSelect, useMultiselect, useTextContent } from "./utils/hooks";
|
|
7
7
|
export { default as theme } from "./themes/light/theme";
|
|
8
8
|
export { default as darkTheme } from "./themes/dark/theme";
|
|
9
|
+
export {
|
|
10
|
+
sproutLightTheme,
|
|
11
|
+
sproutDarkTheme,
|
|
12
|
+
} from "./themes/extendedThemes/sproutTheme";
|
|
9
13
|
export { default as Icon } from "./Icon";
|
|
10
14
|
// DEPRECATED: Alert has been renamed to Banner
|
|
11
15
|
export { default as Alert } from "./Banner";
|
package/__flow__/setupTests.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`layout system props display 1`] = `
|
|
4
|
-
.c0 {
|
|
5
|
-
display: -webkit-string;
|
|
6
|
-
display: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
<div>
|
|
10
|
-
<div
|
|
11
|
-
class="c0"
|
|
12
|
-
display="string"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
3
|
exports[`layout system props height 1`] = `
|
|
18
4
|
.c0 {
|
|
19
5
|
height: string;
|
|
@@ -10,15 +10,6 @@ describe("layout system props", () => {
|
|
|
10
10
|
${layoutSystemProps}
|
|
11
11
|
`;
|
|
12
12
|
|
|
13
|
-
test("display", () => {
|
|
14
|
-
const { container } = render(
|
|
15
|
-
<>
|
|
16
|
-
<Component display="string" />
|
|
17
|
-
</>
|
|
18
|
-
);
|
|
19
|
-
expect(container).toMatchSnapshot();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
13
|
test("height", () => {
|
|
23
14
|
const { container } = render(
|
|
24
15
|
<>
|
|
@@ -29,9 +29,6 @@ export const shadows = {
|
|
|
29
29
|
|
|
30
30
|
const colors = {
|
|
31
31
|
...lightTheme.colors,
|
|
32
|
-
utils: {
|
|
33
|
-
interact: interact(MODE),
|
|
34
|
-
},
|
|
35
32
|
app: {
|
|
36
33
|
background: {
|
|
37
34
|
base: COLORS.COLOR_NEUTRAL_1000,
|
|
@@ -238,6 +235,9 @@ const colors = {
|
|
|
238
235
|
|
|
239
236
|
const darkTheme = {
|
|
240
237
|
...lightTheme,
|
|
238
|
+
utils: {
|
|
239
|
+
interact: interact(MODE),
|
|
240
|
+
},
|
|
241
241
|
colors,
|
|
242
242
|
shadows,
|
|
243
243
|
mode: MODE,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import baseDarkTheme from "../../../dark/theme";
|
|
3
|
+
import type { TypeSproutTheme } from "../../../../types/theme.flow";
|
|
4
|
+
|
|
5
|
+
export const navigation = {
|
|
6
|
+
main: {
|
|
7
|
+
background: {
|
|
8
|
+
base: baseDarkTheme.colors.neutral[1000],
|
|
9
|
+
overflowGradient: baseDarkTheme.colors.neutral[1100],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
secondary: {
|
|
13
|
+
background: {
|
|
14
|
+
base: baseDarkTheme.colors.neutral[900],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
base: baseDarkTheme.colors.neutral[0],
|
|
19
|
+
hover: baseDarkTheme.colors.neutral[0],
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
base: baseDarkTheme.colors.neutral[0],
|
|
23
|
+
hover: baseDarkTheme.colors.neutral[0],
|
|
24
|
+
},
|
|
25
|
+
listItem: {
|
|
26
|
+
background: {
|
|
27
|
+
base: baseDarkTheme.colors.neutral[1000],
|
|
28
|
+
hover: baseDarkTheme.colors.neutral[1100],
|
|
29
|
+
selected: baseDarkTheme.colors.neutral[700],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const darkTheme: TypeSproutTheme = {
|
|
35
|
+
...baseDarkTheme,
|
|
36
|
+
colors: {
|
|
37
|
+
...baseDarkTheme.colors,
|
|
38
|
+
navigation,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default darkTheme;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import baseLightTheme from "../../../light/theme";
|
|
3
|
+
import type { TypeSproutTheme } from "../../../../types/theme.flow";
|
|
4
|
+
|
|
5
|
+
export const navigation = {
|
|
6
|
+
main: {
|
|
7
|
+
background: {
|
|
8
|
+
base: baseLightTheme.colors.neutral[900],
|
|
9
|
+
overflowGradient: baseLightTheme.colors.neutral[1000],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
secondary: {
|
|
13
|
+
background: {
|
|
14
|
+
base: baseLightTheme.colors.neutral[800],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
base: baseLightTheme.colors.neutral[0],
|
|
19
|
+
hover: baseLightTheme.colors.neutral[0],
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
base: baseLightTheme.colors.neutral[0],
|
|
23
|
+
hover: baseLightTheme.colors.neutral[0],
|
|
24
|
+
},
|
|
25
|
+
listItem: {
|
|
26
|
+
background: {
|
|
27
|
+
base: baseLightTheme.colors.neutral[800],
|
|
28
|
+
hover: baseLightTheme.colors.neutral[1000],
|
|
29
|
+
selected: baseLightTheme.colors.neutral[700],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const lightTheme: TypeSproutTheme = {
|
|
35
|
+
...baseLightTheme,
|
|
36
|
+
colors: {
|
|
37
|
+
...baseLightTheme.colors,
|
|
38
|
+
navigation,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default lightTheme;
|
|
@@ -229,7 +229,14 @@ type TypeElevationColors = {|
|
|
|
229
229
|
},
|
|
230
230
|
|};
|
|
231
231
|
|
|
232
|
-
type TypeDatavizColors =
|
|
232
|
+
type TypeDatavizColors = {|
|
|
233
|
+
DATAVIZ_COLORS_MAP: typeof datavizPalette.DATAVIZ_COLORS_MAP,
|
|
234
|
+
DATAVIZ_COLORS_LIST: typeof datavizPalette.DATAVIZ_COLORS_LIST,
|
|
235
|
+
dataviz: {
|
|
236
|
+
map: typeof datavizPalette.DATAVIZ_COLORS_MAP,
|
|
237
|
+
list: typeof datavizPalette.DATAVIZ_COLORS_LIST,
|
|
238
|
+
},
|
|
239
|
+
|};
|
|
233
240
|
|
|
234
241
|
type TypeNetworkColors = {|
|
|
235
242
|
network: {
|
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
} from "../themes/light/theme";
|
|
14
14
|
import type { TypeColors } from "./theme.colors.flow.js";
|
|
15
15
|
import type { TypeFontFamilyString } from "../themes/light/theme";
|
|
16
|
+
import { navigation } from "../themes/extendedThemes/sproutTheme/light/theme";
|
|
16
17
|
|
|
18
|
+
export type TypeThemeUtils = {| interact: (color: string) => string |};
|
|
19
|
+
export type TypeThemeMode = "light" | "dark";
|
|
17
20
|
export type TypeBreakpoint = typeof breakpoints;
|
|
18
21
|
export type TypeTypography = typeof typography;
|
|
19
22
|
export type TypeFontWeight = typeof fontWeights;
|
|
@@ -28,6 +31,8 @@ export type TypeEasing = typeof easing;
|
|
|
28
31
|
export type TypeDuration = typeof duration;
|
|
29
32
|
|
|
30
33
|
export type TypeTheme = {
|
|
34
|
+
mode: TypeThemeMode,
|
|
35
|
+
utils: TypeThemeUtils,
|
|
31
36
|
breakpoints: TypeBreakpoint,
|
|
32
37
|
colors: TypeColor,
|
|
33
38
|
typography: TypeTypography,
|
|
@@ -41,3 +46,12 @@ export type TypeTheme = {
|
|
|
41
46
|
easing: TypeEasing,
|
|
42
47
|
duration: TypeDuration,
|
|
43
48
|
};
|
|
49
|
+
|
|
50
|
+
// Extended themes
|
|
51
|
+
export type TypeSproutTheme = {
|
|
52
|
+
...$Exact<TypeTheme>,
|
|
53
|
+
colors: {|
|
|
54
|
+
...$Exact<TypeColor>,
|
|
55
|
+
navigation: typeof navigation,
|
|
56
|
+
|},
|
|
57
|
+
};
|
package/commonjs/Button/index.js
CHANGED
|
@@ -60,6 +60,7 @@ var Container = _styledComponents.default.button.withConfig({
|
|
|
60
60
|
return props.appearance === "pill" && (0, _styledComponents.css)(["display:inline-flex;align-items:center;justify-content:center;mix-blend-mode:", ";", ""], props.theme.mode === "dark" ? "screen" : "multiply", _mixins.pill);
|
|
61
61
|
}, _styles.default, _systemProps.LAYOUT, _systemProps.COMMON);
|
|
62
62
|
|
|
63
|
+
Container.displayName = "Button-Container";
|
|
63
64
|
var _default = Container; //${props.theme.mode === "dark" ? "screen" : "multiply"}
|
|
64
65
|
|
|
65
66
|
exports.default = _default;
|