@sproutsocial/racine 11.6.0 → 11.6.1-input-beta.3

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 (47) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/__flow__/Checkbox/styles.js +75 -75
  3. package/__flow__/Collapsible/index.js +3 -2
  4. package/__flow__/Image/index.js +10 -2
  5. package/__flow__/Input/index.js +47 -23
  6. package/__flow__/Input/index.stories.js +14 -0
  7. package/__flow__/Input/index.test.js +20 -0
  8. package/__flow__/Input/styles.js +2 -2
  9. package/__flow__/SegmentedControl/index.js +3 -2
  10. package/__flow__/TableCell/index.js +9 -2
  11. package/__flow__/ThemeProvider/index.js +1 -2
  12. package/__flow__/ToggleHint/index.js +9 -2
  13. package/__flow__/index.js +1 -2
  14. package/__flow__/systemProps/color.js +1 -2
  15. package/__flow__/themes/dark/theme.js +3 -3
  16. package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +34 -15
  17. package/__flow__/themes/extendedThemes/sproutTheme/index.js +0 -1
  18. package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +34 -15
  19. package/__flow__/types/theme.colors.flow.js +8 -1
  20. package/__flow__/types/theme.flow.js +10 -13
  21. package/__flow__/utils/responsiveProps/index.test.js +10 -2
  22. package/commonjs/Input/index.js +40 -22
  23. package/commonjs/Input/styles.js +2 -2
  24. package/commonjs/themes/dark/theme.js +3 -3
  25. package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +36 -15
  26. package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +36 -15
  27. package/commonjs/types/theme.flow.js +3 -1
  28. package/dist/themes/dark/dark.scss +0 -3
  29. package/lib/Input/index.js +40 -22
  30. package/lib/Input/styles.js +2 -2
  31. package/lib/themes/dark/theme.js +3 -3
  32. package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +33 -10
  33. package/lib/themes/extendedThemes/sproutTheme/light/theme.js +33 -10
  34. package/lib/types/theme.flow.js +2 -1
  35. package/package.json +2 -3
  36. package/__flow__/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +0 -17
  37. package/__flow__/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +0 -36
  38. package/__flow__/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +0 -36
  39. package/__flow__/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +0 -36
  40. package/commonjs/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +0 -16
  41. package/commonjs/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +0 -39
  42. package/commonjs/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +0 -39
  43. package/commonjs/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +0 -1
  44. package/lib/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +0 -12
  45. package/lib/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +0 -34
  46. package/lib/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +0 -34
  47. package/lib/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +0 -0
@@ -229,7 +229,14 @@ type TypeElevationColors = {|
229
229
  },
230
230
  |};
231
231
 
232
- type TypeDatavizColors = typeof datavizPalette;
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,9 @@ 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 |};
17
19
  export type TypeThemeMode = "light" | "dark";
18
20
  export type TypeBreakpoint = typeof breakpoints;
19
21
  export type TypeTypography = typeof typography;
@@ -30,6 +32,7 @@ export type TypeDuration = typeof duration;
30
32
 
31
33
  export type TypeTheme = {
32
34
  mode: TypeThemeMode,
35
+ utils: TypeThemeUtils,
33
36
  breakpoints: TypeBreakpoint,
34
37
  colors: TypeColor,
35
38
  typography: TypeTypography,
@@ -44,17 +47,11 @@ export type TypeTheme = {
44
47
  duration: TypeDuration,
45
48
  };
46
49
 
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,
50
+ // Extended themes
51
+ export type TypeSproutTheme = {
52
+ ...$Exact<TypeTheme>,
53
+ colors: {|
54
+ ...$Exact<TypeColor>,
55
+ navigation: typeof navigation,
56
+ |},
60
57
  };
@@ -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
  });
@@ -41,7 +41,6 @@ var StyledButton = (0, _styledComponents.default)(_Button.default).withConfig({
41
41
 
42
42
  var ClearButton = function ClearButton() {
43
43
  var _React$useContext = React.useContext(InputContext),
44
- onClear = _React$useContext.onClear,
45
44
  handleClear = _React$useContext.handleClear,
46
45
  clearButtonLabel = _React$useContext.clearButtonLabel,
47
46
  hasValue = _React$useContext.hasValue,
@@ -50,13 +49,6 @@ var ClearButton = function ClearButton() {
50
49
 
51
50
  if (!hasValue) {
52
51
  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
52
  } // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.
61
53
 
62
54
 
@@ -95,14 +87,10 @@ var isClearButton = function isClearButton(elem) {
95
87
  var Input = /*#__PURE__*/function (_React$Component) {
96
88
  _inheritsLoose(Input, _React$Component);
97
89
 
98
- function Input() {
90
+ function Input(props) {
99
91
  var _this;
100
92
 
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;
93
+ _this = _React$Component.call(this, props) || this;
106
94
  _this.inputRef = /*#__PURE__*/React.createRef();
107
95
 
108
96
  _this.handleBlur = function (e) {
@@ -110,14 +98,29 @@ var Input = /*#__PURE__*/function (_React$Component) {
110
98
  };
111
99
 
112
100
  _this.handleClear = function (e) {
113
- var _this$inputRef, _this$inputRef$curren;
101
+ var input = _this.inputRef.current;
102
+
103
+ if (input) {
104
+ // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange
105
+ var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
106
+ nativeInputValueSetter.call(input, "");
107
+ var inputEvent = new Event("input", {
108
+ bubbles: true
109
+ });
110
+ input.dispatchEvent(inputEvent); // Focus the input, update hasValue, and call any onClear callback
111
+
112
+ input.focus();
113
+
114
+ _this.updateState("");
114
115
 
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);
116
+ _this.props.onClear == null ? void 0 : _this.props.onClear(e);
117
+ }
117
118
  };
118
119
 
119
120
  _this.handleChange = function (e) {
120
- return _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
121
+ _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
122
+
123
+ _this.updateState(e.currentTarget.value);
121
124
  };
122
125
 
123
126
  _this.handleFocus = function (e) {
@@ -136,6 +139,22 @@ var Input = /*#__PURE__*/function (_React$Component) {
136
139
  return _this.props.onPaste == null ? void 0 : _this.props.onPaste(e, e.currentTarget.value);
137
140
  };
138
141
 
142
+ _this.updateState = function (inputValue) {
143
+ var hasValue = inputValue !== "";
144
+ var previousHasValue = _this.state.hasValue; // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.
145
+
146
+ if (hasValue !== previousHasValue) {
147
+ _this.setState({
148
+ hasValue: hasValue
149
+ });
150
+ }
151
+ };
152
+
153
+ _this.state = {
154
+ // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
155
+ // for both controlled and uncontrolled inputs.
156
+ hasValue: !!props.value
157
+ };
139
158
  return _this;
140
159
  }
141
160
 
@@ -189,9 +208,9 @@ var Input = /*#__PURE__*/function (_React$Component) {
189
208
  name: "search",
190
209
  ariaHidden: true,
191
210
  color: "icon.base"
192
- }) : elemBefore; // Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
211
+ }) : elemBefore; // Do not add a ClearButton if an elemAfter prop was passed.
193
212
 
194
- var elementAfter = type === "search" && onClear && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
213
+ var elementAfter = type === "search" && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
195
214
  return /*#__PURE__*/React.createElement(_styles.default, _extends({
196
215
  hasBeforeElement: !!elementBefore,
197
216
  hasAfterElement: !!elementAfter,
@@ -204,9 +223,8 @@ var Input = /*#__PURE__*/function (_React$Component) {
204
223
  }, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
205
224
  value: {
206
225
  handleClear: this.handleClear,
207
- hasValue: !!value,
226
+ hasValue: this.state.hasValue,
208
227
  clearButtonLabel: clearButtonLabel,
209
- onClear: onClear,
210
228
  size: size
211
229
  }
212
230
  }, 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;
@@ -31,9 +31,6 @@ var shadows = {
31
31
  exports.shadows = shadows;
32
32
 
33
33
  var colors = _extends({}, _theme.default.colors, {
34
- utils: {
35
- interact: (0, _interact.default)(MODE)
36
- },
37
34
  app: {
38
35
  background: {
39
36
  base: _seedsColor.default.COLOR_NEUTRAL_1000
@@ -237,6 +234,9 @@ var colors = _extends({}, _theme.default.colors, {
237
234
  }, _datavizPalette.datavizPalette);
238
235
 
239
236
  var darkTheme = _extends({}, _theme.default, {
237
+ utils: {
238
+ interact: (0, _interact.default)(MODE)
239
+ },
240
240
  colors: colors,
241
241
  shadows: shadows,
242
242
  mode: MODE
@@ -1,28 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.default = void 0;
5
-
6
- var _justClone = _interopRequireDefault(require("just-clone"));
4
+ exports.navigation = exports.default = void 0;
7
5
 
8
6
  var _theme = _interopRequireDefault(require("../../../dark/theme"));
9
7
 
10
- var _getDarkThemeColors = require("./getDarkThemeColors");
11
-
12
- var _NonColorThemeValues = require("../NonColorThemeValues");
13
-
14
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
9
 
16
10
  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); }
17
11
 
18
- // clone base theme. (we don't want to mutate the base theme)
19
- var themeClone = (0, _justClone.default)(_theme.default); // get non color theme values
20
-
21
- var nonColorThemeValues = (0, _NonColorThemeValues.getNonColorThemeValues)(themeClone); // get sprout specific dark theme colors
22
-
23
- var darkThemeColors = (0, _getDarkThemeColors.getDarkThemeColors)(themeClone.colors);
24
-
25
- var darkTheme = _extends({}, themeClone, nonColorThemeValues, darkThemeColors);
12
+ var navigation = {
13
+ main: {
14
+ background: {
15
+ base: _theme.default.colors.neutral[1000],
16
+ overflowGradient: _theme.default.colors.neutral[1100]
17
+ }
18
+ },
19
+ secondary: {
20
+ background: {
21
+ base: _theme.default.colors.neutral[900]
22
+ }
23
+ },
24
+ text: {
25
+ base: _theme.default.colors.neutral[0],
26
+ hover: _theme.default.colors.neutral[0]
27
+ },
28
+ icon: {
29
+ base: _theme.default.colors.neutral[0],
30
+ hover: _theme.default.colors.neutral[0]
31
+ },
32
+ listItem: {
33
+ background: {
34
+ base: _theme.default.colors.neutral[1000],
35
+ hover: _theme.default.colors.neutral[1100],
36
+ selected: _theme.default.colors.neutral[700]
37
+ }
38
+ }
39
+ };
40
+ exports.navigation = navigation;
41
+
42
+ var darkTheme = _extends({}, _theme.default, {
43
+ colors: _extends({}, _theme.default.colors, {
44
+ navigation: navigation
45
+ })
46
+ });
26
47
 
27
48
  var _default = darkTheme;
28
49
  exports.default = _default;
@@ -1,28 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.default = void 0;
5
-
6
- var _justClone = _interopRequireDefault(require("just-clone"));
4
+ exports.navigation = exports.default = void 0;
7
5
 
8
6
  var _theme = _interopRequireDefault(require("../../../light/theme"));
9
7
 
10
- var _getLightThemeColors = require("./getLightThemeColors");
11
-
12
- var _NonColorThemeValues = require("../NonColorThemeValues");
13
-
14
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
9
 
16
10
  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); }
17
11
 
18
- // clone base theme. (we don't want to mutate the base theme)
19
- var themeClone = (0, _justClone.default)(_theme.default); // get non color theme values
20
-
21
- var nonColorThemeValues = (0, _NonColorThemeValues.getNonColorThemeValues)(themeClone); // get sprout specific light theme colors
22
-
23
- var lightThemeColors = (0, _getLightThemeColors.getLightThemeColors)(themeClone.colors);
24
-
25
- var lightTheme = _extends({}, themeClone, nonColorThemeValues, lightThemeColors);
12
+ var navigation = {
13
+ main: {
14
+ background: {
15
+ base: _theme.default.colors.neutral[900],
16
+ overflowGradient: _theme.default.colors.neutral[1000]
17
+ }
18
+ },
19
+ secondary: {
20
+ background: {
21
+ base: _theme.default.colors.neutral[800]
22
+ }
23
+ },
24
+ text: {
25
+ base: _theme.default.colors.neutral[0],
26
+ hover: _theme.default.colors.neutral[0]
27
+ },
28
+ icon: {
29
+ base: _theme.default.colors.neutral[0],
30
+ hover: _theme.default.colors.neutral[0]
31
+ },
32
+ listItem: {
33
+ background: {
34
+ base: _theme.default.colors.neutral[800],
35
+ hover: _theme.default.colors.neutral[1000],
36
+ selected: _theme.default.colors.neutral[700]
37
+ }
38
+ }
39
+ };
40
+ exports.navigation = navigation;
41
+
42
+ var lightTheme = _extends({}, _theme.default, {
43
+ colors: _extends({}, _theme.default.colors, {
44
+ navigation: navigation
45
+ })
46
+ });
26
47
 
27
48
  var _default = lightTheme;
28
49
  exports.default = _default;
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _theme = require("../themes/light/theme");
3
+ var _theme = require("../themes/light/theme");
4
+
5
+ var _theme2 = require("../themes/extendedThemes/sproutTheme/light/theme");
@@ -430,9 +430,6 @@ $dark: (
430
430
  18: #ff7f6e,
431
431
  19: #c2f2bd,
432
432
  20: #ffe99a
433
- ),
434
- utils: (
435
-
436
433
  )
437
434
  ),
438
435
  typography: (
@@ -24,7 +24,6 @@ var StyledButton = styled(Button).withConfig({
24
24
 
25
25
  var ClearButton = function ClearButton() {
26
26
  var _React$useContext = React.useContext(InputContext),
27
- onClear = _React$useContext.onClear,
28
27
  handleClear = _React$useContext.handleClear,
29
28
  clearButtonLabel = _React$useContext.clearButtonLabel,
30
29
  hasValue = _React$useContext.hasValue,
@@ -33,13 +32,6 @@ var ClearButton = function ClearButton() {
33
32
 
34
33
  if (!hasValue) {
35
34
  return null;
36
- } // Log a warning and hide the button when no onClear callback is provided.
37
- // If we called handleClear with no onClear prop, all the button would do is focus the Input.
38
-
39
-
40
- if (!onClear) {
41
- console.warn("Warning: No onClear prop provided to Input when using Input.ClearButton. Omitting Input.ClearButton.");
42
- return null;
43
35
  } // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.
44
36
 
45
37
 
@@ -78,14 +70,10 @@ var isClearButton = function isClearButton(elem) {
78
70
  var Input = /*#__PURE__*/function (_React$Component) {
79
71
  _inheritsLoose(Input, _React$Component);
80
72
 
81
- function Input() {
73
+ function Input(props) {
82
74
  var _this;
83
75
 
84
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
85
- args[_key] = arguments[_key];
86
- }
87
-
88
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
76
+ _this = _React$Component.call(this, props) || this;
89
77
  _this.inputRef = /*#__PURE__*/React.createRef();
90
78
 
91
79
  _this.handleBlur = function (e) {
@@ -93,14 +81,29 @@ var Input = /*#__PURE__*/function (_React$Component) {
93
81
  };
94
82
 
95
83
  _this.handleClear = function (e) {
96
- var _this$inputRef, _this$inputRef$curren;
84
+ var input = _this.inputRef.current;
85
+
86
+ if (input) {
87
+ // Clear the value via the input prototype, then dispatch an input event in order to trigger handleChange
88
+ var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
89
+ nativeInputValueSetter.call(input, "");
90
+ var inputEvent = new Event("input", {
91
+ bubbles: true
92
+ });
93
+ input.dispatchEvent(inputEvent); // Focus the input, update hasValue, and call any onClear callback
94
+
95
+ input.focus();
96
+
97
+ _this.updateState("");
97
98
 
98
- (_this$inputRef = _this.inputRef) == null ? void 0 : (_this$inputRef$curren = _this$inputRef.current) == null ? void 0 : _this$inputRef$curren.focus();
99
- _this.props.onClear == null ? void 0 : _this.props.onClear(e);
99
+ _this.props.onClear == null ? void 0 : _this.props.onClear(e);
100
+ }
100
101
  };
101
102
 
102
103
  _this.handleChange = function (e) {
103
- return _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
104
+ _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
105
+
106
+ _this.updateState(e.currentTarget.value);
104
107
  };
105
108
 
106
109
  _this.handleFocus = function (e) {
@@ -119,6 +122,22 @@ var Input = /*#__PURE__*/function (_React$Component) {
119
122
  return _this.props.onPaste == null ? void 0 : _this.props.onPaste(e, e.currentTarget.value);
120
123
  };
121
124
 
125
+ _this.updateState = function (inputValue) {
126
+ var hasValue = inputValue !== "";
127
+ var previousHasValue = _this.state.hasValue; // Only update state if the value of `hasValue` has changed to avoid unnecessary renders.
128
+
129
+ if (hasValue !== previousHasValue) {
130
+ _this.setState({
131
+ hasValue: hasValue
132
+ });
133
+ }
134
+ };
135
+
136
+ _this.state = {
137
+ // Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
138
+ // for both controlled and uncontrolled inputs.
139
+ hasValue: !!props.value
140
+ };
122
141
  return _this;
123
142
  }
124
143
 
@@ -172,9 +191,9 @@ var Input = /*#__PURE__*/function (_React$Component) {
172
191
  name: "search",
173
192
  ariaHidden: true,
174
193
  color: "icon.base"
175
- }) : elemBefore; // Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
194
+ }) : elemBefore; // Do not add a ClearButton if an elemAfter prop was passed.
176
195
 
177
- var elementAfter = type === "search" && onClear && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
196
+ var elementAfter = type === "search" && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
178
197
  return /*#__PURE__*/React.createElement(Container, _extends({
179
198
  hasBeforeElement: !!elementBefore,
180
199
  hasAfterElement: !!elementAfter,
@@ -187,9 +206,8 @@ var Input = /*#__PURE__*/function (_React$Component) {
187
206
  }, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
188
207
  value: {
189
208
  handleClear: this.handleClear,
190
- hasValue: !!value,
209
+ hasValue: this.state.hasValue,
191
210
  clearButtonLabel: clearButtonLabel,
192
- onClear: onClear,
193
211
  size: size
194
212
  }
195
213
  }, elementBefore && /*#__PURE__*/React.createElement(Accessory, {
@@ -71,9 +71,9 @@ export var Accessory = styled.div.withConfig({
71
71
  })(["position:absolute;top:50%;transform:translateY(-50%);color:", ";display:flex;align-items:center;", ";", ";"], function (props) {
72
72
  return props.theme.colors.icon.base;
73
73
  }, function (props) {
74
- return props.before && css(["left:", ";"], props.theme.space[350]);
74
+ return props.before && css(["left:", ";"], props.theme.space[300]);
75
75
  }, function (props) {
76
- return props.after && css(["right:", ";"], props.isClearButton ? 0 : props.theme.space[350]);
76
+ return props.after && css(["right:", ";"], props.isClearButton ? 0 : props.theme.space[300]);
77
77
  });
78
78
  Container.displayName = "InputContainer";
79
79
  Accessory.displayName = "InputAccessory";
@@ -15,9 +15,6 @@ export var shadows = {
15
15
  }; // If you are making changes to the colors in the theme file tag the Design Systems team on your PR! Thank you!!
16
16
 
17
17
  var colors = _extends({}, lightTheme.colors, {
18
- utils: {
19
- interact: interact(MODE)
20
- },
21
18
  app: {
22
19
  background: {
23
20
  base: COLORS.COLOR_NEUTRAL_1000
@@ -221,6 +218,9 @@ var colors = _extends({}, lightTheme.colors, {
221
218
  }, datavizPalette);
222
219
 
223
220
  var darkTheme = _extends({}, lightTheme, {
221
+ utils: {
222
+ interact: interact(MODE)
223
+ },
224
224
  colors: colors,
225
225
  shadows: shadows,
226
226
  mode: MODE
@@ -1,16 +1,39 @@
1
1
  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); }
2
2
 
3
- import clone from "just-clone";
4
3
  import baseDarkTheme from "../../../dark/theme";
5
- import { getDarkThemeColors } from "./getDarkThemeColors";
6
- import { getNonColorThemeValues } from "../NonColorThemeValues";
7
- // clone base theme. (we don't want to mutate the base theme)
8
- var themeClone = clone(baseDarkTheme); // get non color theme values
4
+ export var navigation = {
5
+ main: {
6
+ background: {
7
+ base: baseDarkTheme.colors.neutral[1000],
8
+ overflowGradient: baseDarkTheme.colors.neutral[1100]
9
+ }
10
+ },
11
+ secondary: {
12
+ background: {
13
+ base: baseDarkTheme.colors.neutral[900]
14
+ }
15
+ },
16
+ text: {
17
+ base: baseDarkTheme.colors.neutral[0],
18
+ hover: baseDarkTheme.colors.neutral[0]
19
+ },
20
+ icon: {
21
+ base: baseDarkTheme.colors.neutral[0],
22
+ hover: baseDarkTheme.colors.neutral[0]
23
+ },
24
+ listItem: {
25
+ background: {
26
+ base: baseDarkTheme.colors.neutral[1000],
27
+ hover: baseDarkTheme.colors.neutral[1100],
28
+ selected: baseDarkTheme.colors.neutral[700]
29
+ }
30
+ }
31
+ };
9
32
 
10
- var nonColorThemeValues = getNonColorThemeValues(themeClone); // get sprout specific dark theme colors
11
-
12
- var darkThemeColors = getDarkThemeColors(themeClone.colors);
13
-
14
- var darkTheme = _extends({}, themeClone, nonColorThemeValues, darkThemeColors);
33
+ var darkTheme = _extends({}, baseDarkTheme, {
34
+ colors: _extends({}, baseDarkTheme.colors, {
35
+ navigation: navigation
36
+ })
37
+ });
15
38
 
16
39
  export default darkTheme;
@@ -1,16 +1,39 @@
1
1
  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); }
2
2
 
3
- import clone from "just-clone";
4
3
  import baseLightTheme from "../../../light/theme";
5
- import { getLightThemeColors } from "./getLightThemeColors";
6
- import { getNonColorThemeValues } from "../NonColorThemeValues";
7
- // clone base theme. (we don't want to mutate the base theme)
8
- var themeClone = clone(baseLightTheme); // get non color theme values
4
+ export var navigation = {
5
+ main: {
6
+ background: {
7
+ base: baseLightTheme.colors.neutral[900],
8
+ overflowGradient: baseLightTheme.colors.neutral[1000]
9
+ }
10
+ },
11
+ secondary: {
12
+ background: {
13
+ base: baseLightTheme.colors.neutral[800]
14
+ }
15
+ },
16
+ text: {
17
+ base: baseLightTheme.colors.neutral[0],
18
+ hover: baseLightTheme.colors.neutral[0]
19
+ },
20
+ icon: {
21
+ base: baseLightTheme.colors.neutral[0],
22
+ hover: baseLightTheme.colors.neutral[0]
23
+ },
24
+ listItem: {
25
+ background: {
26
+ base: baseLightTheme.colors.neutral[800],
27
+ hover: baseLightTheme.colors.neutral[1000],
28
+ selected: baseLightTheme.colors.neutral[700]
29
+ }
30
+ }
31
+ };
9
32
 
10
- var nonColorThemeValues = getNonColorThemeValues(themeClone); // get sprout specific light theme colors
11
-
12
- var lightThemeColors = getLightThemeColors(themeClone.colors);
13
-
14
- var lightTheme = _extends({}, themeClone, nonColorThemeValues, lightThemeColors);
33
+ var lightTheme = _extends({}, baseLightTheme, {
34
+ colors: _extends({}, baseLightTheme.colors, {
35
+ navigation: navigation
36
+ })
37
+ });
15
38
 
16
39
  export default lightTheme;
@@ -1 +1,2 @@
1
- import { breakpoints, typography, fontWeights, radii, borders, borderWidths, shadows, space, easing, duration } from "../themes/light/theme";
1
+ import { breakpoints, typography, fontWeights, radii, borders, borderWidths, shadows, space, easing, duration } from "../themes/light/theme";
2
+ import { navigation } from "../themes/extendedThemes/sproutTheme/light/theme";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/racine",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-input-beta.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "__flow__",
@@ -66,7 +66,6 @@
66
66
  "dependencies": {
67
67
  "@styled-system/theme-get": "^5.1.2",
68
68
  "classnames": "^2.2.6",
69
- "just-clone": "^5.0.1",
70
69
  "lodash.curry": "^4.1.1",
71
70
  "lodash.uniqueid": "^4.0.1",
72
71
  "lru-memoize": "^1.1.0",
@@ -167,7 +166,7 @@
167
166
  "svgo": "^1.3.0",
168
167
  "svgstore": "^2.0.3",
169
168
  "webpack": "^4.20.0",
170
- "webpack-dev-server": "^3.11.0"
169
+ "webpack-dev-server": "^4.9.0"
171
170
  },
172
171
  "peerDependencies": {
173
172
  "@sproutsocial/seeds-border": ">=0.3.0",