@sproutsocial/racine 11.2.5-sproutTheme-beta.0 → 11.2.5-sproutTheme-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 (45) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/__flow__/Button/index.stories.js +1 -0
  3. package/__flow__/Input/index.js +185 -66
  4. package/__flow__/Input/index.stories.js +65 -0
  5. package/__flow__/Input/index.test.js +230 -1
  6. package/__flow__/Input/styles.js +1 -1
  7. package/__flow__/ThemeProvider/index.js +5 -1
  8. package/__flow__/TokenInput/index.js +1 -1
  9. package/__flow__/index.js +1 -0
  10. package/__flow__/themes/dark/theme.js +3 -0
  11. package/__flow__/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +17 -0
  12. package/__flow__/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +57 -0
  13. package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +17 -35
  14. package/__flow__/themes/extendedThemes/sproutTheme/index.js +2 -0
  15. package/__flow__/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +53 -0
  16. package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +16 -35
  17. package/__flow__/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +36 -0
  18. package/__flow__/themes/light/theme.js +3 -0
  19. package/__flow__/types/theme.colors.flow.js +3 -0
  20. package/__flow__/types/theme.flow.js +15 -0
  21. package/commonjs/Input/index.js +124 -30
  22. package/commonjs/Input/styles.js +1 -1
  23. package/commonjs/TokenInput/index.js +1 -1
  24. package/commonjs/themes/dark/theme.js +4 -1
  25. package/commonjs/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +15 -0
  26. package/commonjs/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +57 -0
  27. package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +16 -35
  28. package/commonjs/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +53 -0
  29. package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +16 -35
  30. package/commonjs/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +1 -0
  31. package/commonjs/themes/light/theme.js +4 -1
  32. package/dist/themes/dark/dark.scss +4 -1
  33. package/dist/themes/light/light.scss +4 -1
  34. package/lib/Input/index.js +117 -30
  35. package/lib/Input/styles.js +1 -1
  36. package/lib/TokenInput/index.js +1 -1
  37. package/lib/themes/dark/theme.js +4 -1
  38. package/lib/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +10 -0
  39. package/lib/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +52 -0
  40. package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +13 -35
  41. package/lib/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +48 -0
  42. package/lib/themes/extendedThemes/sproutTheme/light/theme.js +13 -35
  43. package/lib/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +0 -0
  44. package/lib/themes/light/theme.js +4 -1
  45. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getNonColorThemeValues = getNonColorThemeValues;
5
+
6
+ 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); }
7
+
8
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
+
10
+ function getNonColorThemeValues(theme) {
11
+ var colors = theme.colors,
12
+ otherThemeValues = _objectWithoutPropertiesLoose(theme, ["colors"]);
13
+
14
+ return _extends({}, otherThemeValues);
15
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getDarkThemeColors = getDarkThemeColors;
5
+
6
+ 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); }
7
+
8
+ function getDarkThemeColors(themeColors) {
9
+ return _extends({}, themeColors, {
10
+ navigation: {
11
+ main: {
12
+ background: {
13
+ base: themeColors.neutral[1000],
14
+ gradient: themeColors.neutral[1100]
15
+ }
16
+ },
17
+ secondary: {
18
+ background: {
19
+ base: themeColors.neutral[900]
20
+ }
21
+ },
22
+ text: {
23
+ base: themeColors.neutral[0],
24
+ hover: themeColors.neutral[0]
25
+ },
26
+ icon: {
27
+ base: themeColors.neutral[0],
28
+ hover: themeColors.neutral[0]
29
+ },
30
+ listItem: {
31
+ background: {
32
+ base: themeColors.neutral[1000],
33
+ hover: themeColors.neutral[1100],
34
+ active: themeColors.neutral[700]
35
+ }
36
+ }
37
+ },
38
+ container: _extends({}, themeColors.container, {
39
+ background: _extends({}, themeColors.container.background, {
40
+ // FIX: These need to be changed to have dark mode colors
41
+ // For now we've copied the light mode values here as well.
42
+ positive_sentiment: themeColors.blue[500],
43
+ negative_sentiment: themeColors.red[500],
44
+ neutral_sentiment: themeColors.neutral[300]
45
+ })
46
+ }),
47
+ icon: _extends({}, 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
+ }
@@ -5,43 +5,24 @@ exports.default = void 0;
5
5
 
6
6
  var _justClone = _interopRequireDefault(require("just-clone"));
7
7
 
8
+ var _theme = _interopRequireDefault(require("../../../dark/theme"));
9
+
10
+ var _getDarkThemeColors = require("./getDarkThemeColors");
11
+
12
+ var _NonColorThemeValues = require("../NonColorThemeValues");
13
+
8
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
15
 
10
- var darkTheme = function darkTheme(theme) {
11
- var sproutDarkTheme = (0, _justClone.default)(theme);
12
- sproutDarkTheme.sprout = {
13
- colors: {
14
- navigation: {
15
- main: {
16
- background: {
17
- base: theme.colors.neutral[1000],
18
- gradient: theme.colors.neutral[1100]
19
- }
20
- },
21
- secondary: {
22
- background: {
23
- base: theme.colors.neutral[900]
24
- }
25
- },
26
- text: {
27
- base: theme.colors.neutral[0],
28
- hover: theme.colors.neutral[0]
29
- },
30
- icon: {
31
- base: theme.colors.neutral[0],
32
- hover: theme.colors.neutral[0]
33
- },
34
- item: {
35
- background: {
36
- base: theme.colors.neutral[1000],
37
- hover: theme.colors.neutral[1100],
38
- active: theme.colors.neutral[700]
39
- }
40
- }
41
- }
42
- }
43
- };
44
- return sproutDarkTheme;
16
+ 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
+
18
+ var darkTheme = function darkTheme(baseDarkTheme) {
19
+ // clone base theme. (we don't want to mutate the base theme)
20
+ var themeClone = (0, _justClone.default)(baseDarkTheme); // get non color theme values
21
+
22
+ var nonColorThemeValues = (0, _NonColorThemeValues.getNonColorThemeValues)(themeClone); // get sprout specific dark theme colors
23
+
24
+ var darkThemeColors = (0, _getDarkThemeColors.getDarkThemeColors)(themeClone.colors);
25
+ return _extends({}, themeClone, nonColorThemeValues, darkThemeColors);
45
26
  };
46
27
 
47
28
  var _default = darkTheme;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getLightThemeColors = getLightThemeColors;
5
+
6
+ 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); }
7
+
8
+ function getLightThemeColors(themeColors) {
9
+ return _extends({}, themeColors, {
10
+ navigation: {
11
+ main: {
12
+ background: {
13
+ base: themeColors.neutral[900],
14
+ overflowGradient: themeColors.neutral[1000]
15
+ }
16
+ },
17
+ secondary: {
18
+ background: {
19
+ base: themeColors.neutral[800]
20
+ }
21
+ },
22
+ text: {
23
+ base: themeColors.neutral[0],
24
+ hover: themeColors.neutral[0]
25
+ },
26
+ icon: {
27
+ base: themeColors.neutral[0],
28
+ hover: themeColors.neutral[0]
29
+ },
30
+ listItem: {
31
+ background: {
32
+ base: themeColors.neutral[800],
33
+ hover: themeColors.neutral[1000],
34
+ selected: themeColors.neutral[700]
35
+ }
36
+ }
37
+ },
38
+ container: _extends({}, themeColors.container, {
39
+ background: _extends({}, themeColors.container.background, {
40
+ positive_sentiment: themeColors.blue[500],
41
+ negative_sentiment: themeColors.red[500],
42
+ neutral_sentiment: themeColors.neutral[300]
43
+ })
44
+ }),
45
+ icon: _extends({}, 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
+ }
@@ -5,43 +5,24 @@ exports.default = void 0;
5
5
 
6
6
  var _justClone = _interopRequireDefault(require("just-clone"));
7
7
 
8
+ var _theme = _interopRequireDefault(require("../../../light/theme"));
9
+
10
+ var _getLightThemeColors = require("./getLightThemeColors");
11
+
12
+ var _NonColorThemeValues = require("../NonColorThemeValues");
13
+
8
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
15
 
10
- var lightTheme = function lightTheme(theme) {
11
- var sproutLightTheme = (0, _justClone.default)(theme);
12
- sproutLightTheme.sprout = {
13
- colors: {
14
- navigation: {
15
- main: {
16
- background: {
17
- base: theme.colors.neutral[900],
18
- gradient: theme.colors.neutral[1000]
19
- }
20
- },
21
- secondary: {
22
- background: {
23
- base: theme.colors.neutral[800]
24
- }
25
- },
26
- text: {
27
- base: theme.colors.neutral[0],
28
- hover: theme.colors.neutral[0]
29
- },
30
- icon: {
31
- base: theme.colors.neutral[0],
32
- hover: theme.colors.neutral[0]
33
- },
34
- item: {
35
- background: {
36
- base: theme.colors.neutral[800],
37
- hover: theme.colors.neutral[1000],
38
- active: theme.colors.neutral[700]
39
- }
40
- }
41
- }
42
- }
43
- };
44
- return sproutLightTheme;
16
+ 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
+
18
+ var lightTheme = function lightTheme(baseLightTheme) {
19
+ // clone base theme. (we don't want to mutate the base theme)
20
+ var themeClone = (0, _justClone.default)(baseLightTheme); // get non color theme values
21
+
22
+ var nonColorThemeValues = (0, _NonColorThemeValues.getNonColorThemeValues)(themeClone); // get sprout specific light theme colors
23
+
24
+ var lightThemeColors = (0, _getLightThemeColors.getLightThemeColors)(themeClone.colors);
25
+ return _extends({}, themeClone, nonColorThemeValues, lightThemeColors);
45
26
  };
46
27
 
47
28
  var _default = lightTheme;
@@ -177,7 +177,10 @@ var colors = _extends({
177
177
  subtext: _seedsColor.default.COLOR_NEUTRAL_700,
178
178
  body: _seedsColor.default.COLOR_NEUTRAL_800,
179
179
  inverse: _seedsColor.default.COLOR_NEUTRAL_0,
180
- error: _seedsColor.default.COLOR_RED_800
180
+ error: _seedsColor.default.COLOR_RED_800,
181
+ background: {
182
+ highlight: _seedsColor.default.COLOR_YELLOW_200
183
+ }
181
184
  },
182
185
  icon: {
183
186
  base: _seedsColor.default.COLOR_NEUTRAL_800,
@@ -152,7 +152,10 @@ $dark: (
152
152
  subtext: #c8cccc,
153
153
  body: #f3f4f4,
154
154
  inverse: #273333,
155
- error: #ff7f6e
155
+ error: #ff7f6e,
156
+ background: (
157
+ highlight: #944c0c
158
+ )
156
159
  ),
157
160
  icon: (
158
161
  base: #f3f4f4,
@@ -246,7 +246,10 @@ $light: (
246
246
  subtext: #515e5f,
247
247
  body: #364141,
248
248
  inverse: #FFFFFF,
249
- error: #c63434
249
+ error: #c63434,
250
+ background: (
251
+ highlight: #ffe99a
252
+ )
250
253
  ),
251
254
  icon: (
252
255
  base: #364141,
@@ -8,6 +8,69 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
8
8
 
9
9
  import * as React from "react";
10
10
  import Container, { Accessory } from "./styles";
11
+ import Button from "../Button";
12
+ import Icon from "../Icon";
13
+ import styled from "styled-components";
14
+ var InputContext = /*#__PURE__*/React.createContext({});
15
+ var StyledButton = styled(Button).withConfig({
16
+ displayName: "Input__StyledButton",
17
+ componentId: "sc-1ck1dnm-0"
18
+ })(["&:hover,&:active{color:", ";}"], function (props) {
19
+ return props.theme.utils.interact(props.theme.colors.icon.base);
20
+ });
21
+
22
+ var ClearButton = function ClearButton() {
23
+ var _React$useContext = React.useContext(InputContext),
24
+ onClear = _React$useContext.onClear,
25
+ handleClear = _React$useContext.handleClear,
26
+ clearButtonLabel = _React$useContext.clearButtonLabel,
27
+ hasValue = _React$useContext.hasValue,
28
+ inputSize = _React$useContext.size; // Hide the button when there is no text to clear.
29
+
30
+
31
+ if (!hasValue) {
32
+ return null;
33
+ } // Log a warning and hide the button when no onClear callback is provided.
34
+ // If we called handleClear with no onClear prop, all the button would do is focus the Input.
35
+
36
+
37
+ if (!onClear) {
38
+ console.warn("Warning: No onClear prop provided to Input when using Input.ClearButton. Omitting Input.ClearButton.");
39
+ return null;
40
+ } // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.
41
+
42
+
43
+ if (!clearButtonLabel) {
44
+ console.warn("Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized clearButtonLabel to Input.");
45
+ } // Reduce Button padding for size small Inputs so that the Button won't go outside the bounds of the Input.
46
+ // This adjustment is handled automatically for default and large Inputs via Button's size. There is no "small" Button.
47
+
48
+
49
+ var py = inputSize === "small" ? 100 : undefined;
50
+ var px = inputSize === "small" ? 200 : undefined;
51
+ var buttonSize = inputSize === "small" ? "default" : inputSize;
52
+ return /*#__PURE__*/React.createElement(StyledButton, {
53
+ onClick: handleClear,
54
+ size: buttonSize,
55
+ py: py,
56
+ px: px,
57
+ title: clearButtonLabel || "Clear",
58
+ ariaLabel: clearButtonLabel || "Clear",
59
+ color: "icon.base"
60
+ }, /*#__PURE__*/React.createElement(Icon, {
61
+ name: "circlex"
62
+ }));
63
+ }; // Used for positioning elementAfter. This logic will detect if the element is a ClearButton,
64
+ // regardless of whether it was manually passed as elemAfter or automatically added to a search Input.
65
+
66
+
67
+ var isClearButton = function isClearButton(elem) {
68
+ if (elem != null && elem.type) {
69
+ return elem.type.displayName === "Input.ClearButton";
70
+ }
71
+
72
+ return false;
73
+ };
11
74
 
12
75
  var Input = /*#__PURE__*/function (_React$Component) {
13
76
  _inheritsLoose(Input, _React$Component);
@@ -22,39 +85,38 @@ var Input = /*#__PURE__*/function (_React$Component) {
22
85
  _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
23
86
 
24
87
  _this.handleBlur = function (e) {
25
- if (_this.props.onBlur) {
26
- _this.props.onBlur(e);
88
+ return _this.props.onBlur == null ? void 0 : _this.props.onBlur(e);
89
+ };
90
+
91
+ _this.handleClear = function (e) {
92
+ // Only attempt to focus the input if the ref is an object. It won't work for refs that are functions.
93
+ if (typeof _this.props.innerRef === "object") {
94
+ var _this$props$innerRef$;
95
+
96
+ (_this$props$innerRef$ = _this.props.innerRef.current) == null ? void 0 : _this$props$innerRef$.focus();
27
97
  }
98
+
99
+ _this.props.onClear == null ? void 0 : _this.props.onClear(e);
28
100
  };
29
101
 
30
102
  _this.handleChange = function (e) {
31
- if (_this.props.onChange) {
32
- _this.props.onChange(e, e.currentTarget.value);
33
- }
103
+ return _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
34
104
  };
35
105
 
36
106
  _this.handleFocus = function (e) {
37
- if (_this.props.onFocus) {
38
- _this.props.onFocus(e);
39
- }
107
+ return _this.props.onFocus == null ? void 0 : _this.props.onFocus(e);
40
108
  };
41
109
 
42
110
  _this.handleKeyDown = function (e) {
43
- if (_this.props.onKeyDown) {
44
- _this.props.onKeyDown(e, e.currentTarget.value);
45
- }
111
+ return _this.props.onKeyDown == null ? void 0 : _this.props.onKeyDown(e, e.currentTarget.value);
46
112
  };
47
113
 
48
114
  _this.handleKeyUp = function (e) {
49
- if (_this.props.onKeyUp) {
50
- _this.props.onKeyUp(e, e.currentTarget.value);
51
- }
115
+ return _this.props.onKeyUp == null ? void 0 : _this.props.onKeyUp(e, e.currentTarget.value);
52
116
  };
53
117
 
54
118
  _this.handlePaste = function (e) {
55
- if (_this.props.onPaste) {
56
- _this.props.onPaste(e, e.currentTarget.value);
57
- }
119
+ return _this.props.onPaste == null ? void 0 : _this.props.onPaste(e, e.currentTarget.value);
58
120
  };
59
121
 
60
122
  return _this;
@@ -81,9 +143,11 @@ var Input = /*#__PURE__*/function (_React$Component) {
81
143
  maxLength = _this$props.maxLength,
82
144
  ariaLabel = _this$props.ariaLabel,
83
145
  ariaDescribedby = _this$props.ariaDescribedby,
146
+ clearButtonLabel = _this$props.clearButtonLabel,
84
147
  innerRef = _this$props.innerRef,
85
148
  onBlur = _this$props.onBlur,
86
149
  onChange = _this$props.onChange,
150
+ onClear = _this$props.onClear,
87
151
  onFocus = _this$props.onFocus,
88
152
  onKeyDown = _this$props.onKeyDown,
89
153
  onKeyUp = _this$props.onKeyUp,
@@ -93,25 +157,44 @@ var Input = /*#__PURE__*/function (_React$Component) {
93
157
  _this$props$qa = _this$props.qa,
94
158
  qa = _this$props$qa === void 0 ? {} : _this$props$qa,
95
159
  appearance = _this$props.appearance,
96
- rest = _objectWithoutPropertiesLoose(_this$props, ["autoComplete", "autoFocus", "disabled", "readOnly", "isInvalid", "hasWarning", "id", "name", "placeholder", "type", "required", "value", "elemBefore", "elemAfter", "maxLength", "ariaLabel", "ariaDescribedby", "innerRef", "onBlur", "onChange", "onFocus", "onKeyDown", "onKeyUp", "onPaste", "inputProps", "qa", "appearance"]);
160
+ size = _this$props.size,
161
+ rest = _objectWithoutPropertiesLoose(_this$props, ["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"]); // Convert autoComplete from a boolean prop to a string value.
162
+
97
163
 
98
164
  var autoCompleteValue = undefined;
99
165
 
100
166
  if (autoComplete !== undefined) {
101
167
  autoCompleteValue = autoComplete ? "on" : "off";
102
- }
168
+ } // Add default elemBefore and elemAfter elements if type is search.
103
169
 
170
+
171
+ var elementBefore = type === "search" && !elemBefore ? /*#__PURE__*/React.createElement(Icon, {
172
+ name: "search",
173
+ ariaHidden: true,
174
+ color: "icon.base"
175
+ }) : elemBefore; // Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
176
+
177
+ var elementAfter = type === "search" && onClear && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
104
178
  return /*#__PURE__*/React.createElement(Container, _extends({
105
- hasBeforeElement: !!elemBefore,
106
- hasAfterElement: !!elemAfter,
179
+ hasBeforeElement: !!elementBefore,
180
+ hasAfterElement: !!elementAfter,
107
181
  disabled: disabled,
108
182
  invalid: !!isInvalid,
109
183
  warning: hasWarning,
110
- appearance: appearance // $FlowIssue - upgrade v0.112.0
111
-
112
- }, rest), elemBefore && /*#__PURE__*/React.createElement(Accessory, {
184
+ appearance: appearance,
185
+ size: size // $FlowIssue - upgrade v0.112.0
186
+
187
+ }, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
188
+ value: {
189
+ handleClear: this.handleClear,
190
+ hasValue: !!value,
191
+ clearButtonLabel: clearButtonLabel,
192
+ onClear: onClear,
193
+ size: size
194
+ }
195
+ }, elementBefore && /*#__PURE__*/React.createElement(Accessory, {
113
196
  before: true
114
- }, elemBefore), /*#__PURE__*/React.createElement("input", _extends({
197
+ }, elementBefore), /*#__PURE__*/React.createElement("input", _extends({
115
198
  "aria-invalid": !!isInvalid,
116
199
  "aria-label": ariaLabel,
117
200
  "aria-describedby": ariaDescribedby,
@@ -136,9 +219,10 @@ var Input = /*#__PURE__*/function (_React$Component) {
136
219
  "data-qa-input": name || "",
137
220
  "data-qa-input-isdisabled": disabled === true,
138
221
  "data-qa-input-isrequired": required === true
139
- }, qa, inputProps)), elemAfter && /*#__PURE__*/React.createElement(Accessory, {
140
- after: true
141
- }, elemAfter));
222
+ }, qa, inputProps)), elementAfter && /*#__PURE__*/React.createElement(Accessory, {
223
+ after: true,
224
+ isClearButton: isClearButton(elementAfter)
225
+ }, elementAfter)));
142
226
  };
143
227
 
144
228
  return Input;
@@ -149,6 +233,9 @@ Input.defaultProps = {
149
233
  disabled: false,
150
234
  type: "text",
151
235
  size: "default",
152
- appearance: "primary"
236
+ appearance: "primary",
237
+ innerRef: /*#__PURE__*/React.createRef()
153
238
  };
154
- export { Input as default };
239
+ Input.ClearButton = ClearButton;
240
+ Input.ClearButton.displayName = "Input.ClearButton";
241
+ export default Input;
@@ -73,7 +73,7 @@ export var Accessory = styled.div.withConfig({
73
73
  }, function (props) {
74
74
  return props.before && css(["left:", ";"], props.theme.space[350]);
75
75
  }, function (props) {
76
- return props.after && css(["right:", ";"], props.theme.space[350]);
76
+ return props.after && css(["right:", ";"], props.isClearButton ? 0 : props.theme.space[350]);
77
77
  });
78
78
  Container.displayName = "InputContainer";
79
79
  Accessory.displayName = "InputAccessory";
@@ -282,7 +282,7 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
282
282
  "aria-invalid": !!isInvalid,
283
283
  "aria-label": ariaLabel,
284
284
  autoFocus: autoFocus,
285
- autocomplete: autocomplete,
285
+ autoComplete: autocomplete,
286
286
  disabled: disabled,
287
287
  id: id,
288
288
  name: name,
@@ -159,7 +159,10 @@ var colors = _extends({}, lightTheme.colors, {
159
159
  subtext: COLORS.COLOR_NEUTRAL_300,
160
160
  body: COLORS.COLOR_NEUTRAL_100,
161
161
  inverse: COLORS.COLOR_NEUTRAL_900,
162
- error: COLORS.COLOR_RED_400
162
+ error: COLORS.COLOR_RED_400,
163
+ background: {
164
+ highlight: COLORS.COLOR_YELLOW_900
165
+ }
163
166
  },
164
167
  icon: {
165
168
  base: COLORS.COLOR_NEUTRAL_100,
@@ -0,0 +1,10 @@
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
+
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
+
5
+ export function getNonColorThemeValues(theme) {
6
+ var colors = theme.colors,
7
+ otherThemeValues = _objectWithoutPropertiesLoose(theme, ["colors"]);
8
+
9
+ return _extends({}, otherThemeValues);
10
+ }
@@ -0,0 +1,52 @@
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
+
3
+ export function getDarkThemeColors(themeColors) {
4
+ return _extends({}, themeColors, {
5
+ navigation: {
6
+ main: {
7
+ background: {
8
+ base: themeColors.neutral[1000],
9
+ gradient: themeColors.neutral[1100]
10
+ }
11
+ },
12
+ secondary: {
13
+ background: {
14
+ base: themeColors.neutral[900]
15
+ }
16
+ },
17
+ text: {
18
+ base: themeColors.neutral[0],
19
+ hover: themeColors.neutral[0]
20
+ },
21
+ icon: {
22
+ base: themeColors.neutral[0],
23
+ hover: themeColors.neutral[0]
24
+ },
25
+ listItem: {
26
+ background: {
27
+ base: themeColors.neutral[1000],
28
+ hover: themeColors.neutral[1100],
29
+ active: themeColors.neutral[700]
30
+ }
31
+ }
32
+ },
33
+ container: _extends({}, themeColors.container, {
34
+ background: _extends({}, themeColors.container.background, {
35
+ // FIX: These need to be changed to have dark mode colors
36
+ // For now we've copied the light mode values here as well.
37
+ positive_sentiment: themeColors.blue[500],
38
+ negative_sentiment: themeColors.red[500],
39
+ neutral_sentiment: themeColors.neutral[300]
40
+ })
41
+ }),
42
+ icon: _extends({}, themeColors.icon, {
43
+ // FIX: These need to be changed to have dark mode colors
44
+ // For now we've copied the light mode values here as well.
45
+ sentiment: {
46
+ positive_sentiment: themeColors.blue[500],
47
+ negative_sentiment: themeColors.red[500],
48
+ neutral_sentiment: themeColors.neutral[300]
49
+ }
50
+ })
51
+ });
52
+ }
@@ -1,40 +1,18 @@
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
+
1
3
  import clone from "just-clone";
4
+ import baseDarkTheme from "../../../dark/theme";
5
+ import { getDarkThemeColors } from "./getDarkThemeColors";
6
+ import { getNonColorThemeValues } from "../NonColorThemeValues";
7
+
8
+ var darkTheme = function darkTheme(baseDarkTheme) {
9
+ // clone base theme. (we don't want to mutate the base theme)
10
+ var themeClone = clone(baseDarkTheme); // get non color theme values
11
+
12
+ var nonColorThemeValues = getNonColorThemeValues(themeClone); // get sprout specific dark theme colors
2
13
 
3
- var darkTheme = function darkTheme(theme) {
4
- var sproutDarkTheme = clone(theme);
5
- sproutDarkTheme.sprout = {
6
- colors: {
7
- navigation: {
8
- main: {
9
- background: {
10
- base: theme.colors.neutral[1000],
11
- gradient: theme.colors.neutral[1100]
12
- }
13
- },
14
- secondary: {
15
- background: {
16
- base: theme.colors.neutral[900]
17
- }
18
- },
19
- text: {
20
- base: theme.colors.neutral[0],
21
- hover: theme.colors.neutral[0]
22
- },
23
- icon: {
24
- base: theme.colors.neutral[0],
25
- hover: theme.colors.neutral[0]
26
- },
27
- item: {
28
- background: {
29
- base: theme.colors.neutral[1000],
30
- hover: theme.colors.neutral[1100],
31
- active: theme.colors.neutral[700]
32
- }
33
- }
34
- }
35
- }
36
- };
37
- return sproutDarkTheme;
14
+ var darkThemeColors = getDarkThemeColors(themeClone.colors);
15
+ return _extends({}, themeClone, nonColorThemeValues, darkThemeColors);
38
16
  };
39
17
 
40
18
  export default darkTheme;