@sproutsocial/racine 11.7.1 → 11.9.0-useInteractiveColor.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.
Files changed (54) hide show
  1. package/__flow__/Checkbox/index.stories.js +73 -56
  2. package/__flow__/Checkbox/styles.js +75 -75
  3. package/__flow__/Collapsible/index.js +3 -2
  4. package/__flow__/Icon/index.stories.js +41 -36
  5. package/__flow__/Image/index.js +10 -2
  6. package/__flow__/Input/index.js +49 -25
  7. package/__flow__/Input/index.stories.js +59 -33
  8. package/__flow__/Input/index.test.js +20 -0
  9. package/__flow__/Input/styles.js +2 -2
  10. package/__flow__/Loader/index.stories.js +18 -14
  11. package/__flow__/Numeral/index.stories.js +109 -50
  12. package/__flow__/Radio/index.stories.js +41 -26
  13. package/__flow__/SegmentedControl/index.js +3 -2
  14. package/__flow__/Switch/index.stories.js +26 -18
  15. package/__flow__/TableCell/index.js +9 -2
  16. package/__flow__/ToggleHint/index.js +9 -2
  17. package/__flow__/Token/styles.js +13 -12
  18. package/__flow__/index.js +1 -0
  19. package/__flow__/systemProps/color.js +1 -2
  20. package/__flow__/themes/dark/theme.js +0 -5
  21. package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +9 -0
  22. package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +9 -0
  23. package/__flow__/themes/light/theme.js +0 -5
  24. package/__flow__/types/theme.flow.js +2 -2
  25. package/__flow__/utils/responsiveProps/index.test.js +10 -2
  26. package/__flow__/utils/useInteractiveColor.js +32 -0
  27. package/commonjs/Input/index.js +45 -23
  28. package/commonjs/Input/styles.js +2 -2
  29. package/commonjs/Token/styles.js +9 -7
  30. package/commonjs/index.js +6 -1
  31. package/commonjs/themes/dark/theme.js +0 -5
  32. package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +11 -2
  33. package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +11 -2
  34. package/commonjs/themes/light/theme.js +0 -5
  35. package/commonjs/utils/useInteractiveColor.js +33 -0
  36. package/dist/themes/dark/theme.scss +0 -3
  37. package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +14 -3
  38. package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +14 -3
  39. package/dist/themes/light/theme.scss +0 -3
  40. package/lib/Input/index.js +44 -23
  41. package/lib/Input/styles.js +2 -2
  42. package/lib/Token/styles.js +8 -7
  43. package/lib/index.js +1 -0
  44. package/lib/themes/dark/theme.js +0 -4
  45. package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +9 -1
  46. package/lib/themes/extendedThemes/sproutTheme/light/theme.js +9 -1
  47. package/lib/themes/light/theme.js +0 -4
  48. package/lib/types/theme.flow.js +1 -1
  49. package/lib/utils/useInteractiveColor.js +27 -0
  50. package/package.json +1 -1
  51. package/CHANGELOG.md +0 -3208
  52. package/__flow__/themes/utils/interact.js +0 -12
  53. package/commonjs/themes/utils/interact.js +0 -19
  54. package/lib/themes/utils/interact.js +0 -13
@@ -2,6 +2,7 @@
2
2
  import styled, { css, type StyledComponent } from "styled-components";
3
3
  import { COMMON } from "../utils/system-props";
4
4
  import { focusRing } from "../utils/mixins";
5
+ import { useInteractiveColor } from "../utils/useInteractiveColor";
5
6
 
6
7
  import type { TypeTheme } from "../types/theme.flow";
7
8
 
@@ -29,30 +30,30 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
29
30
  ${focusRing}
30
31
  }
31
32
 
32
- ${({ theme, palette }) =>
33
- palette === "blue" &&
33
+ ${({ closeable, theme }) =>
34
+ closeable &&
34
35
  css`
35
- color: ${theme.colors.text.body};
36
- background: ${theme.colors.container.background.decorative.blue};
37
- border: 1px solid ${theme.colors.container.border.decorative.blue};
36
+ cursor: pointer;
38
37
  &:hover,
39
38
  &:active {
40
- cursor: pointer;
41
39
  box-shadow: ${theme.shadows.low};
42
40
  border: 1px solid
43
- ${theme.utils.interact(theme.colors.container.border.decorative.blue)};
41
+ ${useInteractiveColor(theme.colors.container.border.base)};
44
42
  }
45
43
  `}
46
44
 
47
- ${({ closeable, theme }) =>
48
- closeable &&
45
+ ${({ theme, palette }) =>
46
+ palette === "blue" &&
49
47
  css`
50
- cursor: pointer;
48
+ color: ${theme.colors.text.body};
49
+ background: ${theme.colors.container.background.decorative.blue};
50
+ border: 1px solid ${theme.colors.container.border.decorative.blue};
51
51
  &:hover,
52
52
  &:active {
53
+ cursor: pointer;
53
54
  box-shadow: ${theme.shadows.low};
54
55
  border: 1px solid
55
- ${theme.utils.interact(theme.colors.container.border.base)};
56
+ ${useInteractiveColor(theme.colors.container.border.decorative.blue)};
56
57
  }
57
58
  `}
58
59
 
@@ -77,7 +78,7 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
77
78
  &:hover {
78
79
  box-shadow: ${theme.shadows.low};
79
80
  border: 1px solid
80
- ${theme.utils.interact(theme.colors.container.border.error)};
81
+ ${useInteractiveColor(theme.colors.container.border.error)};
81
82
  }
82
83
  `}
83
84
 
package/__flow__/index.js CHANGED
@@ -4,6 +4,7 @@ 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
+ export { useInteractiveColor } from "./utils/useInteractiveColor";
7
8
  export { default as theme } from "./themes/light/theme";
8
9
  export { default as darkTheme } from "./themes/dark/theme";
9
10
  export {
@@ -14,8 +14,7 @@ import type {
14
14
 
15
15
  // https://styled-system.com/table#color
16
16
 
17
- type TypeBackgroundColorSystemProp =
18
- TypeResponsiveBaseSystemProp<BackgroundColorProperty>;
17
+ type TypeBackgroundColorSystemProp = TypeResponsiveBaseSystemProp<BackgroundColorProperty>;
19
18
  export type TypeColorSystemProps = $ReadOnly<{|
20
19
  backgroundColor?: TypeBackgroundColorSystemProp,
21
20
  bg?: TypeBackgroundColorSystemProp,
@@ -15,8 +15,6 @@ import {
15
15
  } from "./decorative-palettes";
16
16
  import { transparentize } from "polished";
17
17
 
18
- import interact from "../utils/interact";
19
-
20
18
  const MODE = "dark";
21
19
 
22
20
  export const shadows = {
@@ -235,9 +233,6 @@ const colors = {
235
233
 
236
234
  const darkTheme = {
237
235
  ...lightTheme,
238
- utils: {
239
- interact: interact(MODE),
240
- },
241
236
  colors,
242
237
  shadows,
243
238
  mode: MODE,
@@ -42,12 +42,21 @@ export const datePicker = {
42
42
  },
43
43
  };
44
44
 
45
+ export const analytics = {
46
+ trend: {
47
+ positive: baseDarkTheme.colors.teal[500],
48
+ neutral: baseDarkTheme.colors.neutral[100],
49
+ negative: baseDarkTheme.colors.neutral[100],
50
+ },
51
+ };
52
+
45
53
  const darkTheme: TypeSproutTheme = {
46
54
  ...baseDarkTheme,
47
55
  colors: {
48
56
  ...baseDarkTheme.colors,
49
57
  navigation,
50
58
  datePicker,
59
+ analytics,
51
60
  },
52
61
  };
53
62
 
@@ -42,12 +42,21 @@ export const datePicker = {
42
42
  },
43
43
  };
44
44
 
45
+ export const analytics = {
46
+ trend: {
47
+ positive: baseLightTheme.colors.teal[800],
48
+ neutral: baseLightTheme.colors.neutral[800],
49
+ negative: baseLightTheme.colors.neutral[800],
50
+ },
51
+ };
52
+
45
53
  const lightTheme: TypeSproutTheme = {
46
54
  ...baseLightTheme,
47
55
  colors: {
48
56
  ...baseLightTheme.colors,
49
57
  navigation,
50
58
  datePicker,
59
+ analytics,
51
60
  },
52
61
  };
53
62
 
@@ -20,8 +20,6 @@ import MOTION from "@sproutsocial/seeds-motion";
20
20
  import BORDER from "@sproutsocial/seeds-border";
21
21
  import { transparentize } from "polished";
22
22
 
23
- import interact from "../utils/interact";
24
-
25
23
  export const breakpoints = ["900px", "1200px", "1500px", "1800px"];
26
24
 
27
25
  const MODE = "light";
@@ -350,9 +348,6 @@ export const duration = {
350
348
  };
351
349
 
352
350
  const theme = {
353
- utils: {
354
- interact: interact(MODE),
355
- },
356
351
  breakpoints,
357
352
  colors,
358
353
  typography: {
@@ -16,9 +16,9 @@ import type { TypeFontFamilyString } from "../themes/light/theme";
16
16
  import {
17
17
  datePicker,
18
18
  navigation,
19
+ analytics,
19
20
  } from "../themes/extendedThemes/sproutTheme/light/theme";
20
21
 
21
- export type TypeThemeUtils = {| interact: (color: string) => string |};
22
22
  export type TypeThemeMode = "light" | "dark";
23
23
  export type TypeBreakpoint = typeof breakpoints;
24
24
  export type TypeTypography = typeof typography;
@@ -35,7 +35,6 @@ export type TypeDuration = typeof duration;
35
35
 
36
36
  export type TypeTheme = {
37
37
  mode: TypeThemeMode,
38
- utils: TypeThemeUtils,
39
38
  breakpoints: TypeBreakpoint,
40
39
  colors: TypeColor,
41
40
  typography: TypeTypography,
@@ -57,5 +56,6 @@ export type TypeSproutTheme = {
57
56
  ...$Exact<TypeColor>,
58
57
  navigation: typeof navigation,
59
58
  datePicker: typeof datePicker,
59
+ analytics: typeof analytics,
60
60
  |},
61
61
  };
@@ -19,13 +19,21 @@ describe("normalizeResponsiveProp", () => {
19
19
 
20
20
  it("should handle arrays with 4 values", () => {
21
21
  expect(normalizeResponsiveProp([0, 1, 2, 3])).toMatchObject([
22
- 0, 1, 2, 3, 3,
22
+ 0,
23
+ 1,
24
+ 2,
25
+ 3,
26
+ 3,
23
27
  ]);
24
28
  });
25
29
 
26
30
  it("should handle arrays with 5 values", () => {
27
31
  expect(normalizeResponsiveProp([0, 1, 2, 3, 4])).toMatchObject([
28
- 0, 1, 2, 3, 4,
32
+ 0,
33
+ 1,
34
+ 2,
35
+ 3,
36
+ 4,
29
37
  ]);
30
38
  });
31
39
  });
@@ -0,0 +1,32 @@
1
+ //@flow strict-local
2
+ import { darken, lighten } from "polished";
3
+ import { useTheme } from "styled-components";
4
+ import type { TypeColors } from "../types/theme.colors.flow.js";
5
+
6
+ /**
7
+ * The useInteractiveColor hook has context of theme mode (light or dark)
8
+ * and can be used to lighten or darken a color dynamically
9
+ *
10
+ * note: colors are limited to our theme colors
11
+ */
12
+ const useInteractiveColor = (themeColor: TypeColors): string => {
13
+ // Throw error if used outside of a ThemeProvider (styled-components)
14
+ if (!useTheme()) {
15
+ throw new Error(
16
+ "useInteractiveColor() must be used within a Styled Components ThemeProvider"
17
+ );
18
+ }
19
+
20
+ // Get the current theme mode ie. 'light' or 'dark'
21
+ const themeMode = useTheme().mode;
22
+
23
+ // If the theme mode is dark, return a lightened version of the themeValue
24
+ if (themeMode === "dark") {
25
+ return lighten(0.2, themeColor);
26
+ } else {
27
+ // If the theme mode is light, return a darkened version of the themeValue
28
+ return darken(0.2, themeColor);
29
+ }
30
+ };
31
+
32
+ export { useInteractiveColor };
@@ -15,6 +15,8 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
15
 
16
16
  var _utils = require("../utils");
17
17
 
18
+ var _useInteractiveColor = require("../utils/useInteractiveColor");
19
+
18
20
  var _excluded = ["autoComplete", "autoFocus", "disabled", "readOnly", "isInvalid", "hasWarning", "id", "name", "placeholder", "type", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaLabel", "ariaDescribedby", "clearButtonLabel", "innerRef", "onBlur", "onChange", "onClear", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "appearance", "size"];
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -36,12 +38,11 @@ var StyledButton = (0, _styledComponents.default)(_Button.default).withConfig({
36
38
  displayName: "Input__StyledButton",
37
39
  componentId: "sc-1ck1dnm-0"
38
40
  })(["&:hover,&:active{color:", ";}"], function (props) {
39
- return props.theme.utils.interact(props.theme.colors.icon.base);
41
+ return (0, _useInteractiveColor.useInteractiveColor)(props.theme.colors.icon.base);
40
42
  });
41
43
 
42
44
  var ClearButton = function ClearButton() {
43
45
  var _React$useContext = React.useContext(InputContext),
44
- onClear = _React$useContext.onClear,
45
46
  handleClear = _React$useContext.handleClear,
46
47
  clearButtonLabel = _React$useContext.clearButtonLabel,
47
48
  hasValue = _React$useContext.hasValue,
@@ -50,13 +51,6 @@ var ClearButton = function ClearButton() {
50
51
 
51
52
  if (!hasValue) {
52
53
  return null;
53
- } // Log a warning and hide the button when no onClear callback is provided.
54
- // If we called handleClear with no onClear prop, all the button would do is focus the Input.
55
-
56
-
57
- if (!onClear) {
58
- console.warn("Warning: No onClear prop provided to Input when using Input.ClearButton. Omitting Input.ClearButton.");
59
- return null;
60
54
  } // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.
61
55
 
62
56
 
@@ -95,14 +89,10 @@ var isClearButton = function isClearButton(elem) {
95
89
  var Input = /*#__PURE__*/function (_React$Component) {
96
90
  _inheritsLoose(Input, _React$Component);
97
91
 
98
- function Input() {
92
+ function Input(props) {
99
93
  var _this;
100
94
 
101
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
102
- args[_key] = arguments[_key];
103
- }
104
-
105
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
95
+ _this = _React$Component.call(this, props) || this;
106
96
  _this.inputRef = /*#__PURE__*/React.createRef();
107
97
 
108
98
  _this.handleBlur = function (e) {
@@ -110,14 +100,31 @@ var Input = /*#__PURE__*/function (_React$Component) {
110
100
  };
111
101
 
112
102
  _this.handleClear = function (e) {
113
- var _this$inputRef, _this$inputRef$curren;
103
+ var input = _this.inputRef.current;
104
+
105
+ if (input) {
106
+ var _Object$getOwnPropert;
107
+
108
+ // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange
109
+ var nativeInputValueSetter = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")) == null ? void 0 : _Object$getOwnPropert.set;
110
+ nativeInputValueSetter == null ? void 0 : nativeInputValueSetter.call(input, "");
111
+ var inputEvent = new Event("input", {
112
+ bubbles: true
113
+ });
114
+ input.dispatchEvent(inputEvent); // Focus the input, update hasValue, and call any onClear callback
115
+
116
+ input.focus();
114
117
 
115
- (_this$inputRef = _this.inputRef) == null ? void 0 : (_this$inputRef$curren = _this$inputRef.current) == null ? void 0 : _this$inputRef$curren.focus();
116
- _this.props.onClear == null ? void 0 : _this.props.onClear(e);
118
+ _this.updateState("");
119
+
120
+ _this.props.onClear == null ? void 0 : _this.props.onClear(e);
121
+ }
117
122
  };
118
123
 
119
124
  _this.handleChange = function (e) {
120
- return _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
125
+ _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
126
+
127
+ _this.updateState(e.currentTarget.value);
121
128
  };
122
129
 
123
130
  _this.handleFocus = function (e) {
@@ -136,6 +143,22 @@ var Input = /*#__PURE__*/function (_React$Component) {
136
143
  return _this.props.onPaste == null ? void 0 : _this.props.onPaste(e, e.currentTarget.value);
137
144
  };
138
145
 
146
+ _this.updateState = function (inputValue) {
147
+ var hasValue = inputValue !== "";
148
+ var previousHasValue = _this.state.hasValue; // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.
149
+
150
+ if (hasValue !== previousHasValue) {
151
+ _this.setState({
152
+ hasValue: hasValue
153
+ });
154
+ }
155
+ };
156
+
157
+ _this.state = {
158
+ // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
159
+ // for both controlled and uncontrolled inputs.
160
+ hasValue: !!props.value
161
+ };
139
162
  return _this;
140
163
  }
141
164
 
@@ -189,9 +212,9 @@ var Input = /*#__PURE__*/function (_React$Component) {
189
212
  name: "search",
190
213
  ariaHidden: true,
191
214
  color: "icon.base"
192
- }) : elemBefore; // Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
215
+ }) : elemBefore; // Do not add a ClearButton if an elemAfter prop was passed.
193
216
 
194
- var elementAfter = type === "search" && onClear && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
217
+ var elementAfter = type === "search" && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
195
218
  return /*#__PURE__*/React.createElement(_styles.default, _extends({
196
219
  hasBeforeElement: !!elementBefore,
197
220
  hasAfterElement: !!elementAfter,
@@ -204,9 +227,8 @@ var Input = /*#__PURE__*/function (_React$Component) {
204
227
  }, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
205
228
  value: {
206
229
  handleClear: this.handleClear,
207
- hasValue: !!value,
230
+ hasValue: this.state.hasValue,
208
231
  clearButtonLabel: clearButtonLabel,
209
- onClear: onClear,
210
232
  size: size
211
233
  }
212
234
  }, elementBefore && /*#__PURE__*/React.createElement(_styles.Accessory, {
@@ -84,9 +84,9 @@ var Accessory = _styledComponents.default.div.withConfig({
84
84
  })(["position:absolute;top:50%;transform:translateY(-50%);color:", ";display:flex;align-items:center;", ";", ";"], function (props) {
85
85
  return props.theme.colors.icon.base;
86
86
  }, function (props) {
87
- return props.before && (0, _styledComponents.css)(["left:", ";"], props.theme.space[350]);
87
+ return props.before && (0, _styledComponents.css)(["left:", ";"], props.theme.space[300]);
88
88
  }, function (props) {
89
- return props.after && (0, _styledComponents.css)(["right:", ";"], props.isClearButton ? 0 : props.theme.space[350]);
89
+ return props.after && (0, _styledComponents.css)(["right:", ";"], props.isClearButton ? 0 : props.theme.space[300]);
90
90
  });
91
91
 
92
92
  exports.Accessory = Accessory;
@@ -9,6 +9,8 @@ var _systemProps = require("../utils/system-props");
9
9
 
10
10
  var _mixins = require("../utils/mixins");
11
11
 
12
+ var _useInteractiveColor = require("../utils/useInteractiveColor");
13
+
12
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
15
 
14
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -20,13 +22,13 @@ var Container = _styledComponents.default.button.withConfig({
20
22
  var theme = _ref.theme;
21
23
  return (0, _styledComponents.css)(["", " font-family:", ";font-weight:", ";border:1px solid ", ";border-radius:", ";color:", ";background:", ";padding:", " ", ";transition:all ", " ", ";"], theme.typography[200], theme.fontFamily, theme.fontWeights.normal, theme.colors.container.border.base, theme.radii[500], theme.colors.text.body, theme.colors.container.background.base, theme.space[200], theme.space[300], theme.duration.fast, theme.easing.ease_inout);
22
24
  }, _mixins.focusRing, function (_ref2) {
23
- var theme = _ref2.theme,
24
- palette = _ref2.palette;
25
- return palette === "blue" && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover,&:active{cursor:pointer;box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.body, theme.colors.container.background.decorative.blue, theme.colors.container.border.decorative.blue, theme.shadows.low, theme.utils.interact(theme.colors.container.border.decorative.blue));
25
+ var closeable = _ref2.closeable,
26
+ theme = _ref2.theme;
27
+ return closeable && (0, _styledComponents.css)(["cursor:pointer;&:hover,&:active{box-shadow:", ";border:1px solid ", ";}"], theme.shadows.low, (0, _useInteractiveColor.useInteractiveColor)(theme.colors.container.border.base));
26
28
  }, function (_ref3) {
27
- var closeable = _ref3.closeable,
28
- theme = _ref3.theme;
29
- return closeable && (0, _styledComponents.css)(["cursor:pointer;&:hover,&:active{box-shadow:", ";border:1px solid ", ";}"], theme.shadows.low, theme.utils.interact(theme.colors.container.border.base));
29
+ var theme = _ref3.theme,
30
+ palette = _ref3.palette;
31
+ return palette === "blue" && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover,&:active{cursor:pointer;box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.body, theme.colors.container.background.decorative.blue, theme.colors.container.border.decorative.blue, theme.shadows.low, (0, _useInteractiveColor.useInteractiveColor)(theme.colors.container.border.decorative.blue));
30
32
  }, function (_ref4) {
31
33
  var disabled = _ref4.disabled,
32
34
  theme = _ref4.theme;
@@ -34,7 +36,7 @@ var Container = _styledComponents.default.button.withConfig({
34
36
  }, function (_ref5) {
35
37
  var valid = _ref5.valid,
36
38
  theme = _ref5.theme;
37
- return !valid && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low, theme.utils.interact(theme.colors.container.border.error));
39
+ return !valid && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low, (0, _useInteractiveColor.useInteractiveColor)(theme.colors.container.border.error));
38
40
  }, _systemProps.COMMON);
39
41
 
40
42
  var _default = Container;
package/commonjs/index.js CHANGED
@@ -8,6 +8,7 @@ var _exportNames = {
8
8
  useSelect: true,
9
9
  useMultiselect: true,
10
10
  useTextContent: true,
11
+ useInteractiveColor: true,
11
12
  theme: true,
12
13
  darkTheme: true,
13
14
  Icon: true,
@@ -72,7 +73,7 @@ var _exportNames = {
72
73
  DateRangePicker: true,
73
74
  VisuallyHidden: true
74
75
  };
75
- exports.visuallyHidden = exports.useTextContent = exports.useSelect = exports.useMultiselect = exports.toast = exports.theme = exports.sproutLightTheme = exports.sproutDarkTheme = exports.focusRing = exports.disabled = exports.darkTheme = exports.VisuallyHidden = exports.Tooltip = exports.TokenInput = exports.Token = exports.ToggleHint = exports.ToastContainer = exports.ThemeProvider = exports.Textarea = exports.Text = exports.Tabs = exports.TableRowAccordion = exports.TableHeaderCell = exports.TableCell = exports.Table = exports.Switch = exports.Stack = exports.Skeleton = exports.SingleDatePicker = exports.Select = exports.SegmentedControl = exports.Radio = exports.Popout = exports.OverflowList = exports.Numeral = exports.Modal = exports.Message = exports.MenuItemContainer = exports.MenuButtonContext = exports.MenuButton = exports.Menu = exports.LoaderButton = exports.Loader = exports.ListboxButton = exports.Listbox = exports.Link = exports.Label = exports.KeyboardKey = exports.Input = exports.Indicator = exports.Image = exports.Icon = exports.FormField = exports.Fieldset = exports.EmptyState = exports.Drawer = exports.DateRangePicker = exports.Collapsible = exports.Checkbox = exports.ChartLegend = exports.CharacterCounter = exports.Card = exports.Button = exports.Breadcrumb = exports.Box = exports.Banner = exports.Badge = exports.Avatar = exports.Alert = void 0;
76
+ exports.visuallyHidden = exports.useTextContent = exports.useSelect = exports.useMultiselect = exports.useInteractiveColor = exports.toast = exports.theme = exports.sproutLightTheme = exports.sproutDarkTheme = exports.focusRing = exports.disabled = exports.darkTheme = exports.VisuallyHidden = exports.Tooltip = exports.TokenInput = exports.Token = exports.ToggleHint = exports.ToastContainer = exports.ThemeProvider = exports.Textarea = exports.Text = exports.Tabs = exports.TableRowAccordion = exports.TableHeaderCell = exports.TableCell = exports.Table = exports.Switch = exports.Stack = exports.Skeleton = exports.SingleDatePicker = exports.Select = exports.SegmentedControl = exports.Radio = exports.Popout = exports.OverflowList = exports.Numeral = exports.Modal = exports.Message = exports.MenuItemContainer = exports.MenuButtonContext = exports.MenuButton = exports.Menu = exports.LoaderButton = exports.Loader = exports.ListboxButton = exports.Listbox = exports.Link = exports.Label = exports.KeyboardKey = exports.Input = exports.Indicator = exports.Image = exports.Icon = exports.FormField = exports.Fieldset = exports.EmptyState = exports.Drawer = exports.DateRangePicker = exports.Collapsible = exports.Checkbox = exports.ChartLegend = exports.CharacterCounter = exports.Card = exports.Button = exports.Breadcrumb = exports.Box = exports.Banner = exports.Badge = exports.Avatar = exports.Alert = void 0;
76
77
 
77
78
  var _systemProps = require("./systemProps");
78
79
 
@@ -95,6 +96,10 @@ exports.useSelect = _hooks.useSelect;
95
96
  exports.useMultiselect = _hooks.useMultiselect;
96
97
  exports.useTextContent = _hooks.useTextContent;
97
98
 
99
+ var _useInteractiveColor = require("./utils/useInteractiveColor");
100
+
101
+ exports.useInteractiveColor = _useInteractiveColor.useInteractiveColor;
102
+
98
103
  var _theme = _interopRequireDefault(require("./themes/light/theme"));
99
104
 
100
105
  exports.theme = _theme.default;
@@ -15,8 +15,6 @@ var _decorativePalettes = require("./decorative-palettes");
15
15
 
16
16
  var _polished = require("polished");
17
17
 
18
- var _interact = _interopRequireDefault(require("../utils/interact"));
19
-
20
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
19
 
22
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -234,9 +232,6 @@ var colors = _extends({}, _theme.default.colors, {
234
232
  }, _datavizPalette.datavizPalette);
235
233
 
236
234
  var darkTheme = _extends({}, _theme.default, {
237
- utils: {
238
- interact: (0, _interact.default)(MODE)
239
- },
240
235
  colors: colors,
241
236
  shadows: shadows,
242
237
  mode: MODE
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.navigation = exports.default = exports.datePicker = void 0;
4
+ exports.navigation = exports.default = exports.datePicker = exports.analytics = void 0;
5
5
 
6
6
  var _theme = _interopRequireDefault(require("../../../dark/theme"));
7
7
 
@@ -49,11 +49,20 @@ var datePicker = {
49
49
  }
50
50
  };
51
51
  exports.datePicker = datePicker;
52
+ var analytics = {
53
+ trend: {
54
+ positive: _theme.default.colors.teal[500],
55
+ neutral: _theme.default.colors.neutral[100],
56
+ negative: _theme.default.colors.neutral[100]
57
+ }
58
+ };
59
+ exports.analytics = analytics;
52
60
 
53
61
  var darkTheme = _extends({}, _theme.default, {
54
62
  colors: _extends({}, _theme.default.colors, {
55
63
  navigation: navigation,
56
- datePicker: datePicker
64
+ datePicker: datePicker,
65
+ analytics: analytics
57
66
  })
58
67
  });
59
68
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.navigation = exports.default = exports.datePicker = void 0;
4
+ exports.navigation = exports.default = exports.datePicker = exports.analytics = void 0;
5
5
 
6
6
  var _theme = _interopRequireDefault(require("../../../light/theme"));
7
7
 
@@ -49,11 +49,20 @@ var datePicker = {
49
49
  }
50
50
  };
51
51
  exports.datePicker = datePicker;
52
+ var analytics = {
53
+ trend: {
54
+ positive: _theme.default.colors.teal[800],
55
+ neutral: _theme.default.colors.neutral[800],
56
+ negative: _theme.default.colors.neutral[800]
57
+ }
58
+ };
59
+ exports.analytics = analytics;
52
60
 
53
61
  var lightTheme = _extends({}, _theme.default, {
54
62
  colors: _extends({}, _theme.default.colors, {
55
63
  navigation: navigation,
56
- datePicker: datePicker
64
+ datePicker: datePicker,
65
+ analytics: analytics
57
66
  })
58
67
  });
59
68
 
@@ -25,8 +25,6 @@ var _seedsBorder = _interopRequireDefault(require("@sproutsocial/seeds-border"))
25
25
 
26
26
  var _polished = require("polished");
27
27
 
28
- var _interact = _interopRequireDefault(require("../utils/interact"));
29
-
30
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
29
 
32
30
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -338,9 +336,6 @@ var duration = {
338
336
  };
339
337
  exports.duration = duration;
340
338
  var theme = {
341
- utils: {
342
- interact: (0, _interact.default)(MODE)
343
- },
344
339
  breakpoints: breakpoints,
345
340
  colors: colors,
346
341
  typography: _extends({}, typography, {
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useInteractiveColor = void 0;
5
+
6
+ var _polished = require("polished");
7
+
8
+ var _styledComponents = require("styled-components");
9
+
10
+ /**
11
+ * The useInteractiveColor hook has context of theme mode (light or dark)
12
+ * and can be used to lighten or darken a color dynamically
13
+ *
14
+ * note: colors are limited to our theme colors
15
+ */
16
+ var useInteractiveColor = function useInteractiveColor(themeColor) {
17
+ // Throw error if used outside of a ThemeProvider (styled-components)
18
+ if (!(0, _styledComponents.useTheme)()) {
19
+ throw new Error("useInteractiveColor() must be used within a Styled Components ThemeProvider");
20
+ } // Get the current theme mode ie. 'light' or 'dark'
21
+
22
+
23
+ var themeMode = (0, _styledComponents.useTheme)().mode; // If the theme mode is dark, return a lightened version of the themeValue
24
+
25
+ if (themeMode === "dark") {
26
+ return (0, _polished.lighten)(0.2, themeColor);
27
+ } else {
28
+ // If the theme mode is light, return a darkened version of the themeValue
29
+ return (0, _polished.darken)(0.2, themeColor);
30
+ }
31
+ };
32
+
33
+ exports.useInteractiveColor = useInteractiveColor;
@@ -1,9 +1,6 @@
1
1
  $theme: (
2
2
  __esModule: true,
3
3
  default: (
4
- utils: (
5
-
6
- ),
7
4
  breakpoints: (900px, 1200px, 1500px, 1800px),
8
5
  colors: (
9
6
  app: (
@@ -1,5 +1,12 @@
1
1
  $theme: (
2
2
  __esModule: true,
3
+ analytics: (
4
+ trend: (
5
+ positive: #08c4b2,
6
+ neutral: #f3f4f4,
7
+ negative: #f3f4f4
8
+ )
9
+ ),
3
10
  datePicker: (
4
11
  comparison: (
5
12
  background: (
@@ -11,9 +18,6 @@ $theme: (
11
18
  )
12
19
  ),
13
20
  default: (
14
- utils: (
15
-
16
- ),
17
21
  breakpoints: (900px, 1200px, 1500px, 1800px),
18
22
  colors: (
19
23
  app: (
@@ -478,6 +482,13 @@ $theme: (
478
482
  base: #364141
479
483
  )
480
484
  )
485
+ ),
486
+ analytics: (
487
+ trend: (
488
+ positive: #08c4b2,
489
+ neutral: #f3f4f4,
490
+ negative: #f3f4f4
491
+ )
481
492
  )
482
493
  ),
483
494
  typography: (