@sproutsocial/racine 11.2.5-sproutTheme-beta.1 → 11.2.5-sproutTheme-beta.4
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 +22 -0
- package/__flow__/Button/index.stories.js +6 -21
- package/__flow__/Input/index.js +185 -66
- package/__flow__/Input/index.stories.js +65 -0
- package/__flow__/Input/index.test.js +230 -1
- package/__flow__/Input/styles.js +1 -1
- package/__flow__/ThemeProvider/index.js +5 -1
- package/__flow__/TokenInput/index.js +1 -1
- package/__flow__/index.js +1 -0
- package/__flow__/themes/dark/theme.js +3 -0
- package/__flow__/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +17 -0
- package/__flow__/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +57 -0
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +17 -35
- package/__flow__/themes/extendedThemes/sproutTheme/index.js +2 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +53 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +17 -45
- package/__flow__/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +36 -0
- package/__flow__/themes/light/theme.js +3 -0
- package/__flow__/types/theme.colors.flow.js +3 -0
- package/__flow__/types/theme.flow.js +15 -0
- package/commonjs/Input/index.js +124 -30
- package/commonjs/Input/styles.js +1 -1
- package/commonjs/TokenInput/index.js +1 -1
- package/commonjs/themes/dark/theme.js +4 -1
- package/commonjs/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +15 -0
- package/commonjs/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +57 -0
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +14 -33
- package/commonjs/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +53 -0
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +14 -43
- package/commonjs/themes/extendedThemes/sproutTheme/{dark/colors.js → sproutThemeType.flow.js} +0 -0
- package/commonjs/themes/light/theme.js +4 -1
- package/dist/themes/dark/dark.scss +4 -1
- package/dist/themes/light/light.scss +4 -1
- package/lib/Input/index.js +117 -30
- package/lib/Input/styles.js +1 -1
- package/lib/TokenInput/index.js +1 -1
- package/lib/themes/dark/theme.js +4 -1
- package/lib/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +10 -0
- package/lib/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +52 -0
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +11 -33
- package/lib/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +48 -0
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +10 -42
- package/{__flow__/themes/extendedThemes/sproutTheme/dark/colors.js → lib/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js} +0 -0
- package/lib/themes/light/theme.js +4 -1
- package/package.json +1 -1
- package/__flow__/themes/extendedThemes/sproutTheme/light/colors.js +0 -0
- package/__flow__/themes/extendedThemes/sproutTheme/otherVals/theme.js +0 -6
- package/commonjs/themes/extendedThemes/sproutTheme/light/colors.js +0 -1
- package/commonjs/themes/extendedThemes/sproutTheme/otherVals/theme.js +0 -9
- package/lib/themes/extendedThemes/sproutTheme/dark/colors.js +0 -0
- package/lib/themes/extendedThemes/sproutTheme/light/colors.js +0 -0
- package/lib/themes/extendedThemes/sproutTheme/otherVals/theme.js +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "jest-styled-components";
|
|
3
|
-
import { render, fireEvent } from "../utils/react-testing-library";
|
|
3
|
+
import { render, fireEvent, userEvent } from "../utils/react-testing-library";
|
|
4
4
|
import Input from "./";
|
|
5
5
|
import Text from "../Text";
|
|
6
6
|
|
|
@@ -69,6 +69,235 @@ describe("Input", () => {
|
|
|
69
69
|
expect(getByText("After")).toBeTruthy();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
+
describe("Input.ClearButton", () => {
|
|
73
|
+
describe("Input type=search", () => {
|
|
74
|
+
it("should render a clear button for search Inputs", () => {
|
|
75
|
+
const { getByRole } = render(
|
|
76
|
+
<Input
|
|
77
|
+
id="name"
|
|
78
|
+
name="name"
|
|
79
|
+
value="mic"
|
|
80
|
+
type="search"
|
|
81
|
+
onClear={jest.fn()}
|
|
82
|
+
clearButtonLabel="Clear search"
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
expect(getByRole("button")).toBeTruthy();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("should not render a clear button for search Inputs if there is no text", () => {
|
|
89
|
+
const { queryByRole } = render(
|
|
90
|
+
<Input
|
|
91
|
+
id="name"
|
|
92
|
+
name="name"
|
|
93
|
+
value=""
|
|
94
|
+
type="search"
|
|
95
|
+
onClear={jest.fn()}
|
|
96
|
+
clearButtonLabel="Clear search"
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
expect(queryByRole("button")).toBeFalsy();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("should not override an elemAfter prop if passed", () => {
|
|
103
|
+
const { getByText, queryByTitle } = render(
|
|
104
|
+
<Input
|
|
105
|
+
id="name"
|
|
106
|
+
name="name"
|
|
107
|
+
value="mic"
|
|
108
|
+
type="search"
|
|
109
|
+
onClear={jest.fn()}
|
|
110
|
+
elemAfter={<Text>After</Text>}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
expect(getByText("After")).toBeTruthy();
|
|
114
|
+
expect(queryByTitle("Clear")).not.toBeInTheDocument();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("should use the fallback title if clearButtonLabel is not provided", () => {
|
|
118
|
+
const { getByTitle } = render(
|
|
119
|
+
<Input
|
|
120
|
+
id="name"
|
|
121
|
+
name="name"
|
|
122
|
+
value="mic"
|
|
123
|
+
type="search"
|
|
124
|
+
onClear={jest.fn()}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
127
|
+
expect(getByTitle("Clear")).toBeTruthy();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("should call onClear when clicked", () => {
|
|
131
|
+
const mockOnClear = jest.fn();
|
|
132
|
+
const { getByRole } = render(
|
|
133
|
+
<Input
|
|
134
|
+
id="name"
|
|
135
|
+
name="name"
|
|
136
|
+
value="mic"
|
|
137
|
+
type="search"
|
|
138
|
+
onClear={mockOnClear}
|
|
139
|
+
clearButtonLabel="Clear search"
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
fireEvent.click(getByRole("button"));
|
|
143
|
+
expect(mockOnClear).toHaveBeenCalled();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("should allow keyboard access to and Space key triggering of the clear button", () => {
|
|
147
|
+
const mockOnClear = jest.fn();
|
|
148
|
+
const { getByRole } = render(
|
|
149
|
+
<Input
|
|
150
|
+
id="name"
|
|
151
|
+
name="name"
|
|
152
|
+
value="mic"
|
|
153
|
+
type="search"
|
|
154
|
+
onClear={mockOnClear}
|
|
155
|
+
clearButtonLabel="Clear search"
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
const input = getByRole("searchbox");
|
|
159
|
+
const button = getByRole("button");
|
|
160
|
+
userEvent.tab();
|
|
161
|
+
expect(input).toHaveFocus();
|
|
162
|
+
userEvent.tab();
|
|
163
|
+
expect(button).toHaveFocus();
|
|
164
|
+
userEvent.keyboard("{space}");
|
|
165
|
+
expect(mockOnClear).toHaveBeenCalled();
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it("should allow keyboard access to and Enter key triggering of the clear button", () => {
|
|
169
|
+
const mockOnClear = jest.fn();
|
|
170
|
+
const { getByRole } = render(
|
|
171
|
+
<Input
|
|
172
|
+
id="name"
|
|
173
|
+
name="name"
|
|
174
|
+
value="mic"
|
|
175
|
+
type="search"
|
|
176
|
+
onClear={mockOnClear}
|
|
177
|
+
clearButtonLabel="Clear search"
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
180
|
+
const input = getByRole("searchbox");
|
|
181
|
+
const button = getByRole("button");
|
|
182
|
+
userEvent.tab();
|
|
183
|
+
expect(input).toHaveFocus();
|
|
184
|
+
userEvent.tab();
|
|
185
|
+
expect(button).toHaveFocus();
|
|
186
|
+
userEvent.keyboard("{enter}");
|
|
187
|
+
expect(mockOnClear).toHaveBeenCalled();
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
describe("Manual Input.ClearButton usage", () => {
|
|
192
|
+
it("should render a clear button when passed with elemAfter", () => {
|
|
193
|
+
const { getByRole } = render(
|
|
194
|
+
<Input
|
|
195
|
+
id="name"
|
|
196
|
+
name="name"
|
|
197
|
+
value="mic"
|
|
198
|
+
type="text"
|
|
199
|
+
elemAfter={<Input.ClearButton />}
|
|
200
|
+
onClear={jest.fn()}
|
|
201
|
+
clearButtonLabel="Clear search"
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
204
|
+
expect(getByRole("button")).toBeTruthy();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("should not render a clear button if there is no text", () => {
|
|
208
|
+
const { queryByRole } = render(
|
|
209
|
+
<Input
|
|
210
|
+
id="name"
|
|
211
|
+
name="name"
|
|
212
|
+
value=""
|
|
213
|
+
type="text"
|
|
214
|
+
elemAfter={<Input.ClearButton />}
|
|
215
|
+
onClear={jest.fn()}
|
|
216
|
+
clearButtonLabel="Clear search"
|
|
217
|
+
/>
|
|
218
|
+
);
|
|
219
|
+
expect(queryByRole("button")).toBeFalsy();
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("should use the fallback title if clearButtonLabel is not provided", () => {
|
|
223
|
+
const { getByTitle } = render(
|
|
224
|
+
<Input
|
|
225
|
+
id="name"
|
|
226
|
+
name="name"
|
|
227
|
+
value="mic"
|
|
228
|
+
type="text"
|
|
229
|
+
elemAfter={<Input.ClearButton />}
|
|
230
|
+
onClear={jest.fn()}
|
|
231
|
+
/>
|
|
232
|
+
);
|
|
233
|
+
expect(getByTitle("Clear")).toBeTruthy();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("should call onClear when Input.ClearButton is clicked", () => {
|
|
237
|
+
const mockOnClear = jest.fn();
|
|
238
|
+
const { getByRole } = render(
|
|
239
|
+
<Input
|
|
240
|
+
id="name"
|
|
241
|
+
name="name"
|
|
242
|
+
value="mic"
|
|
243
|
+
type="text"
|
|
244
|
+
elemAfter={<Input.ClearButton />}
|
|
245
|
+
onClear={mockOnClear}
|
|
246
|
+
clearButtonLabel="Clear search"
|
|
247
|
+
/>
|
|
248
|
+
);
|
|
249
|
+
fireEvent.click(getByRole("button"));
|
|
250
|
+
expect(mockOnClear).toHaveBeenCalled();
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("should allow keyboard access to and Space key triggering of the clear button", () => {
|
|
254
|
+
const mockOnClear = jest.fn();
|
|
255
|
+
const { getByRole } = render(
|
|
256
|
+
<Input
|
|
257
|
+
id="name"
|
|
258
|
+
name="name"
|
|
259
|
+
value="mic"
|
|
260
|
+
type="text"
|
|
261
|
+
elemAfter={<Input.ClearButton />}
|
|
262
|
+
onClear={mockOnClear}
|
|
263
|
+
clearButtonLabel="Clear search"
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
const input = getByRole("textbox");
|
|
267
|
+
const button = getByRole("button");
|
|
268
|
+
userEvent.tab();
|
|
269
|
+
expect(input).toHaveFocus();
|
|
270
|
+
userEvent.tab();
|
|
271
|
+
expect(button).toHaveFocus();
|
|
272
|
+
userEvent.keyboard("{space}");
|
|
273
|
+
expect(mockOnClear).toHaveBeenCalled();
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
it("should allow keyboard access to and Enter key triggering of the clear button", () => {
|
|
277
|
+
const mockOnClear = jest.fn();
|
|
278
|
+
const { getByRole } = render(
|
|
279
|
+
<Input
|
|
280
|
+
id="name"
|
|
281
|
+
name="name"
|
|
282
|
+
value="mic"
|
|
283
|
+
type="text"
|
|
284
|
+
elemAfter={<Input.ClearButton />}
|
|
285
|
+
onClear={mockOnClear}
|
|
286
|
+
clearButtonLabel="Clear search"
|
|
287
|
+
/>
|
|
288
|
+
);
|
|
289
|
+
const input = getByRole("textbox");
|
|
290
|
+
const button = getByRole("button");
|
|
291
|
+
userEvent.tab();
|
|
292
|
+
expect(input).toHaveFocus();
|
|
293
|
+
userEvent.tab();
|
|
294
|
+
expect(button).toHaveFocus();
|
|
295
|
+
userEvent.keyboard("{enter}");
|
|
296
|
+
expect(mockOnClear).toHaveBeenCalled();
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
72
301
|
describe("autoComplete prop", () => {
|
|
73
302
|
it("should not have autoComplete attribute when passed prop is not passed", () => {
|
|
74
303
|
const { getByDataQaLabel } = render(<Input id="name" name="name" />);
|
package/__flow__/Input/styles.js
CHANGED
|
@@ -4,9 +4,13 @@ import { ThemeProvider as BaseThemeProvider } from "styled-components";
|
|
|
4
4
|
import theme from "../themes/light/theme";
|
|
5
5
|
|
|
6
6
|
import type { TypeTheme } from "../types/theme.flow";
|
|
7
|
+
import type { TypeSproutTheme } from "../themes/extendedThemes/sproutTheme/sproutThemeType.flow";
|
|
8
|
+
|
|
9
|
+
// We can append additional themes types here
|
|
10
|
+
type TypeAllThemes = TypeTheme | TypeSproutTheme;
|
|
7
11
|
|
|
8
12
|
type TypeProps = $ReadOnly<{|
|
|
9
|
-
theme?:
|
|
13
|
+
theme?: TypeAllThemes,
|
|
10
14
|
children: React.Node,
|
|
11
15
|
|}>;
|
|
12
16
|
|
|
@@ -341,7 +341,7 @@ export default class TokenInput extends React.Component<TypeProps, TypeState> {
|
|
|
341
341
|
aria-invalid={!!isInvalid}
|
|
342
342
|
aria-label={ariaLabel}
|
|
343
343
|
autoFocus={autoFocus}
|
|
344
|
-
|
|
344
|
+
autoComplete={autocomplete}
|
|
345
345
|
disabled={disabled}
|
|
346
346
|
id={id}
|
|
347
347
|
name={name}
|
package/__flow__/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export {
|
|
|
10
10
|
sproutLightTheme,
|
|
11
11
|
sproutDarkTheme,
|
|
12
12
|
} from "./themes/extendedThemes/sproutTheme";
|
|
13
|
+
export type { TypeSproutTheme } from "./themes/extendedThemes/sproutTheme";
|
|
13
14
|
export { default as Icon } from "./Icon";
|
|
14
15
|
// DEPRECATED: Alert has been renamed to Banner
|
|
15
16
|
export { default as Alert } from "./Banner";
|
|
@@ -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,57 @@
|
|
|
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
|
+
container: {
|
|
36
|
+
...themeColors.container,
|
|
37
|
+
background: {
|
|
38
|
+
...themeColors.container.background,
|
|
39
|
+
// FIX: These need to be changed to have dark mode colors
|
|
40
|
+
// For now we've copied the light mode values here as well.
|
|
41
|
+
positive_sentiment: themeColors.blue[500],
|
|
42
|
+
negative_sentiment: themeColors.red[500],
|
|
43
|
+
neutral_sentiment: themeColors.neutral[300],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
icon: {
|
|
47
|
+
...themeColors.icon,
|
|
48
|
+
// FIX: These need to be changed to have dark mode colors
|
|
49
|
+
// For now we've copied the light mode values here as well.
|
|
50
|
+
sentiment: {
|
|
51
|
+
positive_sentiment: themeColors.blue[500],
|
|
52
|
+
negative_sentiment: themeColors.red[500],
|
|
53
|
+
neutral_sentiment: themeColors.neutral[300],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -1,43 +1,25 @@
|
|
|
1
1
|
// @flow strict-local
|
|
2
2
|
import clone from "just-clone";
|
|
3
|
-
import
|
|
3
|
+
import baseDarkTheme from "../../../dark/theme";
|
|
4
|
+
import { getDarkThemeColors } from "./getDarkThemeColors";
|
|
5
|
+
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
+
import type { TypeSproutTheme } from "../sproutThemeType.flow";
|
|
4
7
|
|
|
5
|
-
const darkTheme = (
|
|
6
|
-
|
|
8
|
+
const darkTheme = (): TypeSproutTheme => {
|
|
9
|
+
// clone base theme. (we don't want to mutate the base theme)
|
|
10
|
+
const themeClone = clone(baseDarkTheme);
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
base: theme.colors.neutral[1000],
|
|
14
|
-
gradient: theme.colors.neutral[1100],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
secondary: {
|
|
18
|
-
background: {
|
|
19
|
-
base: theme.colors.neutral[900],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
text: {
|
|
23
|
-
base: theme.colors.neutral[0],
|
|
24
|
-
hover: theme.colors.neutral[0],
|
|
25
|
-
},
|
|
26
|
-
icon: {
|
|
27
|
-
base: theme.colors.neutral[0],
|
|
28
|
-
hover: theme.colors.neutral[0],
|
|
29
|
-
},
|
|
30
|
-
item: {
|
|
31
|
-
background: {
|
|
32
|
-
base: theme.colors.neutral[1000],
|
|
33
|
-
hover: theme.colors.neutral[1100],
|
|
34
|
-
active: theme.colors.neutral[700],
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
};
|
|
12
|
+
// get non color theme values
|
|
13
|
+
const nonColorThemeValues = getNonColorThemeValues(themeClone);
|
|
14
|
+
|
|
15
|
+
// get sprout specific dark theme colors
|
|
16
|
+
const darkThemeColors = getDarkThemeColors(themeClone.colors);
|
|
39
17
|
|
|
40
|
-
return
|
|
18
|
+
return {
|
|
19
|
+
...themeClone,
|
|
20
|
+
...nonColorThemeValues,
|
|
21
|
+
...darkThemeColors,
|
|
22
|
+
};
|
|
41
23
|
};
|
|
42
24
|
|
|
43
25
|
export default darkTheme;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
container: {
|
|
36
|
+
...themeColors.container,
|
|
37
|
+
background: {
|
|
38
|
+
...themeColors.container.background,
|
|
39
|
+
positive_sentiment: themeColors.blue[500],
|
|
40
|
+
negative_sentiment: themeColors.red[500],
|
|
41
|
+
neutral_sentiment: themeColors.neutral[300],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
icon: {
|
|
45
|
+
...themeColors.icon,
|
|
46
|
+
sentiment: {
|
|
47
|
+
positive_sentiment: themeColors.blue[500],
|
|
48
|
+
negative_sentiment: themeColors.red[500],
|
|
49
|
+
neutral_sentiment: themeColors.neutral[300],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -1,53 +1,25 @@
|
|
|
1
1
|
// @flow strict-local
|
|
2
2
|
import clone from "just-clone";
|
|
3
|
-
import
|
|
3
|
+
import baseLightTheme from "../../../light/theme";
|
|
4
|
+
import { getLightThemeColors } from "./getLightThemeColors";
|
|
5
|
+
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
+
import type { TypeSproutTheme } from "../sproutThemeType.flow";
|
|
4
7
|
|
|
5
|
-
const lightTheme = (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// get all non color theme values
|
|
9
|
-
// get light theme changes
|
|
8
|
+
const lightTheme = (): TypeSproutTheme => {
|
|
9
|
+
// clone base theme. (we don't want to mutate the base theme)
|
|
10
|
+
const themeClone = clone(baseLightTheme);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
base: theme.colors.neutral[900],
|
|
17
|
-
overflowGradient: theme.colors.neutral[1000],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
secondary: {
|
|
21
|
-
background: {
|
|
22
|
-
base: theme.colors.neutral[800],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
text: {
|
|
26
|
-
base: theme.colors.neutral[0],
|
|
27
|
-
hover: theme.colors.neutral[0],
|
|
28
|
-
},
|
|
29
|
-
icon: {
|
|
30
|
-
base: theme.colors.neutral[0],
|
|
31
|
-
hover: theme.colors.neutral[0],
|
|
32
|
-
},
|
|
33
|
-
listItem: {
|
|
34
|
-
background: {
|
|
35
|
-
base: theme.colors.neutral[800],
|
|
36
|
-
hover: theme.colors.neutral[1000],
|
|
37
|
-
selected: theme.colors.neutral[700],
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
icon: {
|
|
42
|
-
sentiment: {
|
|
43
|
-
positive_sentiment: theme.colors.blue[500],
|
|
44
|
-
negative_sentiment: theme.colors.red[500],
|
|
45
|
-
neutral_sentiment: theme.colors.neutral[300],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
12
|
+
// get non color theme values
|
|
13
|
+
const nonColorThemeValues = getNonColorThemeValues(themeClone);
|
|
14
|
+
|
|
15
|
+
// get sprout specific light theme colors
|
|
16
|
+
const lightThemeColors = getLightThemeColors(themeClone.colors);
|
|
49
17
|
|
|
50
|
-
return
|
|
18
|
+
return {
|
|
19
|
+
...themeClone,
|
|
20
|
+
...nonColorThemeValues,
|
|
21
|
+
...lightThemeColors,
|
|
22
|
+
};
|
|
51
23
|
};
|
|
52
24
|
|
|
53
25
|
export default lightTheme;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import type { TypeTheme } from "../../../types/theme.flow";
|
|
3
|
+
|
|
4
|
+
export type TypeSproutTheme = {
|
|
5
|
+
...$Exact<TypeTheme>,
|
|
6
|
+
colors: {|
|
|
7
|
+
navigation: {|
|
|
8
|
+
main: {|
|
|
9
|
+
background: {|
|
|
10
|
+
base: string,
|
|
11
|
+
gradient: string,
|
|
12
|
+
|},
|
|
13
|
+
|},
|
|
14
|
+
secondary: {|
|
|
15
|
+
background: {|
|
|
16
|
+
base: string,
|
|
17
|
+
|},
|
|
18
|
+
|},
|
|
19
|
+
text: {|
|
|
20
|
+
base: string,
|
|
21
|
+
hover: string,
|
|
22
|
+
|},
|
|
23
|
+
icon: {|
|
|
24
|
+
base: string,
|
|
25
|
+
hover: string,
|
|
26
|
+
|},
|
|
27
|
+
listItem: {|
|
|
28
|
+
background: {|
|
|
29
|
+
base: string,
|
|
30
|
+
hover: string,
|
|
31
|
+
active: string,
|
|
32
|
+
|},
|
|
33
|
+
|},
|
|
34
|
+
|},
|
|
35
|
+
|},
|
|
36
|
+
};
|
|
@@ -43,3 +43,18 @@ export type TypeTheme = {
|
|
|
43
43
|
easing: TypeEasing,
|
|
44
44
|
duration: TypeDuration,
|
|
45
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
|
+
};
|