@sproutsocial/racine 11.4.2-input-beta.0 → 11.6.1-theme-type.0
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 +12 -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 +3 -27
- package/__flow__/Input/index.stories.js +0 -14
- package/__flow__/Input/index.test.js +0 -18
- 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/extendedThemes/sproutTheme/NonColorThemeValues/index.js +17 -0
- package/__flow__/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +36 -0
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +23 -0
- package/__flow__/themes/extendedThemes/sproutTheme/index.js +3 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +36 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +23 -0
- package/__flow__/types/theme.flow.js +53 -0
- package/commonjs/Button/index.js +1 -0
- package/commonjs/Button/styles.js +1 -0
- package/commonjs/Input/index.js +8 -22
- package/commonjs/Message/styles.js +1 -1
- package/commonjs/index.js +8 -1
- package/commonjs/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +16 -0
- package/commonjs/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +39 -0
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +28 -0
- package/commonjs/themes/extendedThemes/sproutTheme/index.js +14 -0
- package/commonjs/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +39 -0
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +28 -0
- package/lib/Button/index.js +1 -0
- package/lib/Button/styles.js +1 -0
- package/lib/Input/index.js +8 -22
- package/lib/Message/styles.js +1 -1
- package/lib/index.js +1 -0
- package/lib/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +12 -0
- package/lib/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +34 -0
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +16 -0
- package/lib/themes/extendedThemes/sproutTheme/index.js +2 -0
- package/lib/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +34 -0
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +16 -0
- package/package.json +25 -20
- 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,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 43adc28: Added a sprout theme to racine
|
|
8
|
+
|
|
9
|
+
## 11.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- fa8a45d: Dependency upgrades: upgraded severe vulnerabilities as well as storybook and jest suite fixes. Upgraded styled components from beta to stable v5.2.3.
|
|
14
|
+
|
|
3
15
|
## 11.4.1
|
|
4
16
|
|
|
5
17
|
### 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
|
@@ -74,10 +74,6 @@ type TypeProps = {
|
|
|
74
74
|
appearance?: "primary" | "secondary",
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
type TypeState = {
|
|
78
|
-
hasValue: boolean,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
77
|
// Using Context so that Input's Input.ClearButton-specific props can be passed to Input.ClearButton,
|
|
82
78
|
// regardless of whether it is manually included as elemAfter or automatically included for type="search" Inputs.
|
|
83
79
|
type TypeInputContext = $Shape<{
|
|
@@ -158,16 +154,7 @@ const isClearButton = (elem: any) => {
|
|
|
158
154
|
return false;
|
|
159
155
|
};
|
|
160
156
|
|
|
161
|
-
class Input extends React.Component<TypeProps
|
|
162
|
-
constructor(props: TypeProps) {
|
|
163
|
-
super(props);
|
|
164
|
-
this.state = {
|
|
165
|
-
// tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
166
|
-
// for both controlled and uncontrolled inputs.
|
|
167
|
-
hasValue: !!props.value,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
157
|
+
class Input extends React.Component<TypeProps> {
|
|
171
158
|
static defaultProps = {
|
|
172
159
|
autoFocus: false,
|
|
173
160
|
disabled: false,
|
|
@@ -190,10 +177,8 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
190
177
|
this.props.onClear?.(e);
|
|
191
178
|
};
|
|
192
179
|
|
|
193
|
-
handleChange = (e: SyntheticInputEvent<HTMLInputElement>) =>
|
|
180
|
+
handleChange = (e: SyntheticInputEvent<HTMLInputElement>) =>
|
|
194
181
|
this.props.onChange?.(e, e.currentTarget.value);
|
|
195
|
-
this.updateState(e.currentTarget.value);
|
|
196
|
-
};
|
|
197
182
|
|
|
198
183
|
handleFocus = (e: SyntheticFocusEvent<HTMLInputElement>) =>
|
|
199
184
|
this.props.onFocus?.(e);
|
|
@@ -207,15 +192,6 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
207
192
|
handlePaste = (e: SyntheticInputEvent<HTMLInputElement>) =>
|
|
208
193
|
this.props.onPaste?.(e, e.currentTarget.value);
|
|
209
194
|
|
|
210
|
-
updateState = (value: string) => {
|
|
211
|
-
const hasValue = value !== "";
|
|
212
|
-
const hadValue = this.state.hasValue;
|
|
213
|
-
// Only update state if the value has changed to avoid unnecessary renders.
|
|
214
|
-
if (hasValue !== hadValue) {
|
|
215
|
-
this.setState({ hasValue });
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
|
|
219
195
|
render() {
|
|
220
196
|
const {
|
|
221
197
|
autoComplete,
|
|
@@ -283,7 +259,7 @@ class Input extends React.Component<TypeProps, TypeState> {
|
|
|
283
259
|
<InputContext.Provider
|
|
284
260
|
value={{
|
|
285
261
|
handleClear: this.handleClear,
|
|
286
|
-
hasValue:
|
|
262
|
+
hasValue: !!value,
|
|
287
263
|
clearButtonLabel,
|
|
288
264
|
onClear,
|
|
289
265
|
size,
|
|
@@ -188,20 +188,6 @@ largeSearchInput.story = {
|
|
|
188
188
|
name: "Large Search Input",
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
export const uncontrolledSearchInput = () => (
|
|
192
|
-
<Input
|
|
193
|
-
type="search"
|
|
194
|
-
placeholder={text("placeholder", "Please enter a value...")}
|
|
195
|
-
onClear={() => window.alert("Cleared!")}
|
|
196
|
-
clearButtonLabel={text("clearButtonLabel", "Clear search")}
|
|
197
|
-
ariaLabel={text("ariaLabel", "Descriptive label goes here")}
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
uncontrolledSearchInput.story = {
|
|
202
|
-
name: "Uncontrolled Search Input",
|
|
203
|
-
};
|
|
204
|
-
|
|
205
191
|
export const nonSearchClearButtonInput = () => {
|
|
206
192
|
return (
|
|
207
193
|
<Input
|
|
@@ -85,24 +85,6 @@ describe("Input", () => {
|
|
|
85
85
|
expect(getByRole("button")).toBeTruthy();
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
it("should render a clear button for an uncontrolled search Input only once it is typed in", () => {
|
|
89
|
-
const { getByRole, queryByRole } = render(
|
|
90
|
-
<Input
|
|
91
|
-
id="name"
|
|
92
|
-
name="name"
|
|
93
|
-
type="search"
|
|
94
|
-
onClear={jest.fn()}
|
|
95
|
-
clearButtonLabel="Clear search"
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
expect(queryByRole("button")).toBeFalsy();
|
|
99
|
-
const input = getByRole("searchbox");
|
|
100
|
-
userEvent.tab();
|
|
101
|
-
expect(input).toHaveFocus();
|
|
102
|
-
userEvent.keyboard("some text");
|
|
103
|
-
expect(getByRole("button")).toBeTruthy();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
88
|
it("should not render a clear button for search Inputs if there is no text", () => {
|
|
107
89
|
const { queryByRole } = render(
|
|
108
90
|
<Input
|
|
@@ -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
|
<>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import type {
|
|
3
|
+
TypeNonColorThemeValues,
|
|
4
|
+
TypeTheme,
|
|
5
|
+
} from "../../../../types/theme.flow.js";
|
|
6
|
+
|
|
7
|
+
export function getNonColorThemeValues(
|
|
8
|
+
theme: TypeTheme
|
|
9
|
+
): TypeNonColorThemeValues {
|
|
10
|
+
const { colors, ...otherThemeValues } = theme;
|
|
11
|
+
return {
|
|
12
|
+
...otherThemeValues,
|
|
13
|
+
/**
|
|
14
|
+
* You can add your own theme values or overrides here.
|
|
15
|
+
*/
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import type { TypeColors } from "../../../../types/theme.colors.flow.js";
|
|
3
|
+
|
|
4
|
+
export function getDarkThemeColors(themeColors: TypeColors) {
|
|
5
|
+
return {
|
|
6
|
+
...themeColors,
|
|
7
|
+
navigation: {
|
|
8
|
+
main: {
|
|
9
|
+
background: {
|
|
10
|
+
base: themeColors.neutral[1000],
|
|
11
|
+
gradient: themeColors.neutral[1100],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
secondary: {
|
|
15
|
+
background: {
|
|
16
|
+
base: themeColors.neutral[900],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
text: {
|
|
20
|
+
base: themeColors.neutral[0],
|
|
21
|
+
hover: themeColors.neutral[0],
|
|
22
|
+
},
|
|
23
|
+
icon: {
|
|
24
|
+
base: themeColors.neutral[0],
|
|
25
|
+
hover: themeColors.neutral[0],
|
|
26
|
+
},
|
|
27
|
+
listItem: {
|
|
28
|
+
background: {
|
|
29
|
+
base: themeColors.neutral[1000],
|
|
30
|
+
hover: themeColors.neutral[1100],
|
|
31
|
+
active: themeColors.neutral[700],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import clone from "just-clone";
|
|
3
|
+
import baseDarkTheme from "../../../dark/theme";
|
|
4
|
+
import { getDarkThemeColors } from "./getDarkThemeColors";
|
|
5
|
+
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
+
import type { TypeSproutTheme } from "../../../../types/theme.flow";
|
|
7
|
+
|
|
8
|
+
// clone base theme. (we don't want to mutate the base theme)
|
|
9
|
+
const themeClone = clone(baseDarkTheme);
|
|
10
|
+
|
|
11
|
+
// get non color theme values
|
|
12
|
+
const nonColorThemeValues = getNonColorThemeValues(themeClone);
|
|
13
|
+
|
|
14
|
+
// get sprout specific dark theme colors
|
|
15
|
+
const darkThemeColors = getDarkThemeColors(themeClone.colors);
|
|
16
|
+
|
|
17
|
+
const darkTheme: TypeSproutTheme = {
|
|
18
|
+
...themeClone,
|
|
19
|
+
...nonColorThemeValues,
|
|
20
|
+
...darkThemeColors,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default darkTheme;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import type { TypeColors } from "../../../../types/theme.colors.flow.js";
|
|
3
|
+
|
|
4
|
+
export function getLightThemeColors(themeColors: TypeColors) {
|
|
5
|
+
return {
|
|
6
|
+
...themeColors,
|
|
7
|
+
navigation: {
|
|
8
|
+
main: {
|
|
9
|
+
background: {
|
|
10
|
+
base: themeColors.neutral[900],
|
|
11
|
+
overflowGradient: themeColors.neutral[1000],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
secondary: {
|
|
15
|
+
background: {
|
|
16
|
+
base: themeColors.neutral[800],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
text: {
|
|
20
|
+
base: themeColors.neutral[0],
|
|
21
|
+
hover: themeColors.neutral[0],
|
|
22
|
+
},
|
|
23
|
+
icon: {
|
|
24
|
+
base: themeColors.neutral[0],
|
|
25
|
+
hover: themeColors.neutral[0],
|
|
26
|
+
},
|
|
27
|
+
listItem: {
|
|
28
|
+
background: {
|
|
29
|
+
base: themeColors.neutral[800],
|
|
30
|
+
hover: themeColors.neutral[1000],
|
|
31
|
+
selected: themeColors.neutral[700],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import clone from "just-clone";
|
|
3
|
+
import baseLightTheme from "../../../light/theme";
|
|
4
|
+
import { getLightThemeColors } from "./getLightThemeColors";
|
|
5
|
+
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
+
import type { TypeSproutTheme } from "../../../../types/theme.flow";
|
|
7
|
+
|
|
8
|
+
// clone base theme. (we don't want to mutate the base theme)
|
|
9
|
+
const themeClone = clone(baseLightTheme);
|
|
10
|
+
|
|
11
|
+
// get non color theme values
|
|
12
|
+
const nonColorThemeValues = getNonColorThemeValues(themeClone);
|
|
13
|
+
|
|
14
|
+
// get sprout specific light theme colors
|
|
15
|
+
const lightThemeColors = getLightThemeColors(themeClone.colors);
|
|
16
|
+
|
|
17
|
+
const lightTheme: TypeSproutTheme = {
|
|
18
|
+
...themeClone,
|
|
19
|
+
...nonColorThemeValues,
|
|
20
|
+
...lightThemeColors,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default lightTheme;
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import type { TypeColors } from "./theme.colors.flow.js";
|
|
15
15
|
import type { TypeFontFamilyString } from "../themes/light/theme";
|
|
16
16
|
|
|
17
|
+
export type TypeThemeMode = "light" | "dark";
|
|
17
18
|
export type TypeBreakpoint = typeof breakpoints;
|
|
18
19
|
export type TypeTypography = typeof typography;
|
|
19
20
|
export type TypeFontWeight = typeof fontWeights;
|
|
@@ -28,6 +29,7 @@ export type TypeEasing = typeof easing;
|
|
|
28
29
|
export type TypeDuration = typeof duration;
|
|
29
30
|
|
|
30
31
|
export type TypeTheme = {
|
|
32
|
+
mode: TypeThemeMode,
|
|
31
33
|
breakpoints: TypeBreakpoint,
|
|
32
34
|
colors: TypeColor,
|
|
33
35
|
typography: TypeTypography,
|
|
@@ -41,3 +43,54 @@ export type TypeTheme = {
|
|
|
41
43
|
easing: TypeEasing,
|
|
42
44
|
duration: TypeDuration,
|
|
43
45
|
};
|
|
46
|
+
|
|
47
|
+
export type TypeNonColorThemeValues = {
|
|
48
|
+
mode: TypeThemeMode,
|
|
49
|
+
breakpoints: TypeBreakpoint,
|
|
50
|
+
typography: TypeTypography,
|
|
51
|
+
fontWeights: TypeFontWeight,
|
|
52
|
+
fontFamily: TypeFontFamily,
|
|
53
|
+
space: TypeSpace,
|
|
54
|
+
radii: TypeRadii,
|
|
55
|
+
borders: TypeBorder,
|
|
56
|
+
borderWidths: TypeBorderWidth,
|
|
57
|
+
shadows: TypeShadow,
|
|
58
|
+
easing: TypeEasing,
|
|
59
|
+
duration: TypeDuration,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Extended themes
|
|
63
|
+
export type TypeSproutTheme = {
|
|
64
|
+
...$Exact<TypeTheme>,
|
|
65
|
+
colors: {|
|
|
66
|
+
...$Exact<TypeColor>,
|
|
67
|
+
navigation: {|
|
|
68
|
+
main: {|
|
|
69
|
+
background: {|
|
|
70
|
+
base: string,
|
|
71
|
+
gradient: string,
|
|
72
|
+
|},
|
|
73
|
+
|},
|
|
74
|
+
secondary: {|
|
|
75
|
+
background: {|
|
|
76
|
+
base: string,
|
|
77
|
+
|},
|
|
78
|
+
|},
|
|
79
|
+
text: {|
|
|
80
|
+
base: string,
|
|
81
|
+
hover: string,
|
|
82
|
+
|},
|
|
83
|
+
icon: {|
|
|
84
|
+
base: string,
|
|
85
|
+
hover: string,
|
|
86
|
+
|},
|
|
87
|
+
listItem: {|
|
|
88
|
+
background: {|
|
|
89
|
+
base: string,
|
|
90
|
+
hover: string,
|
|
91
|
+
active: string,
|
|
92
|
+
|},
|
|
93
|
+
|},
|
|
94
|
+
|},
|
|
95
|
+
|},
|
|
96
|
+
};
|