@sproutsocial/racine 11.2.5-sproutTheme-beta.2 → 11.2.5-sproutTheme-beta.5
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/__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 +4 -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 +1 -1
- package/__flow__/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +12 -0
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +11 -13
- package/__flow__/themes/extendedThemes/sproutTheme/index.js +2 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +10 -0
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +11 -13
- package/__flow__/themes/light/theme.js +3 -0
- package/__flow__/types/theme.colors.flow.js +3 -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/dark/getDarkThemeColors.js +11 -2
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +6 -7
- package/commonjs/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +9 -2
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +6 -7
- 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/dark/getDarkThemeColors.js +11 -2
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +5 -7
- package/lib/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +9 -2
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +5 -7
- package/lib/themes/light/theme.js +4 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -3133
package/__flow__/Input/styles.js
CHANGED
|
@@ -6,8 +6,11 @@ import theme from "../themes/light/theme";
|
|
|
6
6
|
import type { TypeTheme } from "../types/theme.flow";
|
|
7
7
|
import type { TypeSproutTheme } from "../themes/extendedThemes/sproutTheme/sproutThemeType.flow";
|
|
8
8
|
|
|
9
|
+
// We can append additional themes types here
|
|
10
|
+
type TypeAllThemes = TypeTheme | TypeSproutTheme;
|
|
11
|
+
|
|
9
12
|
type TypeProps = $ReadOnly<{|
|
|
10
|
-
theme?:
|
|
13
|
+
theme?: TypeAllThemes,
|
|
11
14
|
children: React.Node,
|
|
12
15
|
|}>;
|
|
13
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";
|
|
@@ -32,7 +32,19 @@ export function getDarkThemeColors(themeColors: TypeColors) {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
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
|
+
},
|
|
35
46
|
icon: {
|
|
47
|
+
...themeColors.icon,
|
|
36
48
|
// FIX: These need to be changed to have dark mode colors
|
|
37
49
|
// For now we've copied the light mode values here as well.
|
|
38
50
|
sentiment: {
|
|
@@ -3,23 +3,21 @@ import clone from "just-clone";
|
|
|
3
3
|
import baseDarkTheme from "../../../dark/theme";
|
|
4
4
|
import { getDarkThemeColors } from "./getDarkThemeColors";
|
|
5
5
|
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
-
import type {
|
|
6
|
+
import type { TypeSproutTheme } from "../sproutThemeType.flow";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const themeClone = clone(baseDarkTheme);
|
|
8
|
+
// clone base theme. (we don't want to mutate the base theme)
|
|
9
|
+
const themeClone = clone(baseDarkTheme);
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// get non color theme values
|
|
12
|
+
const nonColorThemeValues = getNonColorThemeValues(themeClone);
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// get sprout specific dark theme colors
|
|
15
|
+
const darkThemeColors = getDarkThemeColors(themeClone.colors);
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
17
|
+
const darkTheme: TypeSproutTheme = {
|
|
18
|
+
...themeClone,
|
|
19
|
+
...nonColorThemeValues,
|
|
20
|
+
...darkThemeColors,
|
|
23
21
|
};
|
|
24
22
|
|
|
25
23
|
export default darkTheme;
|
|
@@ -32,7 +32,17 @@ export function getLightThemeColors(themeColors: TypeColors) {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
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
|
+
},
|
|
35
44
|
icon: {
|
|
45
|
+
...themeColors.icon,
|
|
36
46
|
sentiment: {
|
|
37
47
|
positive_sentiment: themeColors.blue[500],
|
|
38
48
|
negative_sentiment: themeColors.red[500],
|
|
@@ -3,23 +3,21 @@ import clone from "just-clone";
|
|
|
3
3
|
import baseLightTheme from "../../../light/theme";
|
|
4
4
|
import { getLightThemeColors } from "./getLightThemeColors";
|
|
5
5
|
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
-
import type {
|
|
6
|
+
import type { TypeSproutTheme } from "../sproutThemeType.flow";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const themeClone = clone(baseLightTheme);
|
|
8
|
+
// clone base theme. (we don't want to mutate the base theme)
|
|
9
|
+
const themeClone = clone(baseLightTheme);
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// get non color theme values
|
|
12
|
+
const nonColorThemeValues = getNonColorThemeValues(themeClone);
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// get sprout specific light theme colors
|
|
15
|
+
const lightThemeColors = getLightThemeColors(themeClone.colors);
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
17
|
+
const lightTheme: TypeSproutTheme = {
|
|
18
|
+
...themeClone,
|
|
19
|
+
...nonColorThemeValues,
|
|
20
|
+
...lightThemeColors,
|
|
23
21
|
};
|
|
24
22
|
|
|
25
23
|
export default lightTheme;
|
package/commonjs/Input/index.js
CHANGED
|
@@ -7,6 +7,14 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _styles = _interopRequireWildcard(require("./styles"));
|
|
9
9
|
|
|
10
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
11
|
+
|
|
12
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
10
18
|
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); }
|
|
11
19
|
|
|
12
20
|
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; }
|
|
@@ -19,6 +27,67 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.crea
|
|
|
19
27
|
|
|
20
28
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
29
|
|
|
30
|
+
var InputContext = /*#__PURE__*/React.createContext({});
|
|
31
|
+
var StyledButton = (0, _styledComponents.default)(_Button.default).withConfig({
|
|
32
|
+
displayName: "Input__StyledButton",
|
|
33
|
+
componentId: "sc-1ck1dnm-0"
|
|
34
|
+
})(["&:hover,&:active{color:", ";}"], function (props) {
|
|
35
|
+
return props.theme.utils.interact(props.theme.colors.icon.base);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var ClearButton = function ClearButton() {
|
|
39
|
+
var _React$useContext = React.useContext(InputContext),
|
|
40
|
+
onClear = _React$useContext.onClear,
|
|
41
|
+
handleClear = _React$useContext.handleClear,
|
|
42
|
+
clearButtonLabel = _React$useContext.clearButtonLabel,
|
|
43
|
+
hasValue = _React$useContext.hasValue,
|
|
44
|
+
inputSize = _React$useContext.size; // Hide the button when there is no text to clear.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if (!hasValue) {
|
|
48
|
+
return null;
|
|
49
|
+
} // Log a warning and hide the button when no onClear callback is provided.
|
|
50
|
+
// If we called handleClear with no onClear prop, all the button would do is focus the Input.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if (!onClear) {
|
|
54
|
+
console.warn("Warning: No onClear prop provided to Input when using Input.ClearButton. Omitting Input.ClearButton.");
|
|
55
|
+
return null;
|
|
56
|
+
} // Warn if clearButtonLabel is not included, so that the unlocalized fallback will not be mistaken for a proper label.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if (!clearButtonLabel) {
|
|
60
|
+
console.warn("Warning: clearButtonLabel prop is required when using Input.ClearButton. Please pass a localized clearButtonLabel to Input.");
|
|
61
|
+
} // Reduce Button padding for size small Inputs so that the Button won't go outside the bounds of the Input.
|
|
62
|
+
// This adjustment is handled automatically for default and large Inputs via Button's size. There is no "small" Button.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
var py = inputSize === "small" ? 100 : undefined;
|
|
66
|
+
var px = inputSize === "small" ? 200 : undefined;
|
|
67
|
+
var buttonSize = inputSize === "small" ? "default" : inputSize;
|
|
68
|
+
return /*#__PURE__*/React.createElement(StyledButton, {
|
|
69
|
+
onClick: handleClear,
|
|
70
|
+
size: buttonSize,
|
|
71
|
+
py: py,
|
|
72
|
+
px: px,
|
|
73
|
+
title: clearButtonLabel || "Clear",
|
|
74
|
+
ariaLabel: clearButtonLabel || "Clear",
|
|
75
|
+
color: "icon.base"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(_Icon.default, {
|
|
77
|
+
name: "circlex"
|
|
78
|
+
}));
|
|
79
|
+
}; // Used for positioning elementAfter. This logic will detect if the element is a ClearButton,
|
|
80
|
+
// regardless of whether it was manually passed as elemAfter or automatically added to a search Input.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var isClearButton = function isClearButton(elem) {
|
|
84
|
+
if (elem != null && elem.type) {
|
|
85
|
+
return elem.type.displayName === "Input.ClearButton";
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return false;
|
|
89
|
+
};
|
|
90
|
+
|
|
22
91
|
var Input = /*#__PURE__*/function (_React$Component) {
|
|
23
92
|
_inheritsLoose(Input, _React$Component);
|
|
24
93
|
|
|
@@ -32,39 +101,38 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
32
101
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
33
102
|
|
|
34
103
|
_this.handleBlur = function (e) {
|
|
35
|
-
|
|
36
|
-
|
|
104
|
+
return _this.props.onBlur == null ? void 0 : _this.props.onBlur(e);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
_this.handleClear = function (e) {
|
|
108
|
+
// Only attempt to focus the input if the ref is an object. It won't work for refs that are functions.
|
|
109
|
+
if (typeof _this.props.innerRef === "object") {
|
|
110
|
+
var _this$props$innerRef$;
|
|
111
|
+
|
|
112
|
+
(_this$props$innerRef$ = _this.props.innerRef.current) == null ? void 0 : _this$props$innerRef$.focus();
|
|
37
113
|
}
|
|
114
|
+
|
|
115
|
+
_this.props.onClear == null ? void 0 : _this.props.onClear(e);
|
|
38
116
|
};
|
|
39
117
|
|
|
40
118
|
_this.handleChange = function (e) {
|
|
41
|
-
|
|
42
|
-
_this.props.onChange(e, e.currentTarget.value);
|
|
43
|
-
}
|
|
119
|
+
return _this.props.onChange == null ? void 0 : _this.props.onChange(e, e.currentTarget.value);
|
|
44
120
|
};
|
|
45
121
|
|
|
46
122
|
_this.handleFocus = function (e) {
|
|
47
|
-
|
|
48
|
-
_this.props.onFocus(e);
|
|
49
|
-
}
|
|
123
|
+
return _this.props.onFocus == null ? void 0 : _this.props.onFocus(e);
|
|
50
124
|
};
|
|
51
125
|
|
|
52
126
|
_this.handleKeyDown = function (e) {
|
|
53
|
-
|
|
54
|
-
_this.props.onKeyDown(e, e.currentTarget.value);
|
|
55
|
-
}
|
|
127
|
+
return _this.props.onKeyDown == null ? void 0 : _this.props.onKeyDown(e, e.currentTarget.value);
|
|
56
128
|
};
|
|
57
129
|
|
|
58
130
|
_this.handleKeyUp = function (e) {
|
|
59
|
-
|
|
60
|
-
_this.props.onKeyUp(e, e.currentTarget.value);
|
|
61
|
-
}
|
|
131
|
+
return _this.props.onKeyUp == null ? void 0 : _this.props.onKeyUp(e, e.currentTarget.value);
|
|
62
132
|
};
|
|
63
133
|
|
|
64
134
|
_this.handlePaste = function (e) {
|
|
65
|
-
|
|
66
|
-
_this.props.onPaste(e, e.currentTarget.value);
|
|
67
|
-
}
|
|
135
|
+
return _this.props.onPaste == null ? void 0 : _this.props.onPaste(e, e.currentTarget.value);
|
|
68
136
|
};
|
|
69
137
|
|
|
70
138
|
return _this;
|
|
@@ -91,9 +159,11 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
91
159
|
maxLength = _this$props.maxLength,
|
|
92
160
|
ariaLabel = _this$props.ariaLabel,
|
|
93
161
|
ariaDescribedby = _this$props.ariaDescribedby,
|
|
162
|
+
clearButtonLabel = _this$props.clearButtonLabel,
|
|
94
163
|
innerRef = _this$props.innerRef,
|
|
95
164
|
onBlur = _this$props.onBlur,
|
|
96
165
|
onChange = _this$props.onChange,
|
|
166
|
+
onClear = _this$props.onClear,
|
|
97
167
|
onFocus = _this$props.onFocus,
|
|
98
168
|
onKeyDown = _this$props.onKeyDown,
|
|
99
169
|
onKeyUp = _this$props.onKeyUp,
|
|
@@ -103,25 +173,44 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
103
173
|
_this$props$qa = _this$props.qa,
|
|
104
174
|
qa = _this$props$qa === void 0 ? {} : _this$props$qa,
|
|
105
175
|
appearance = _this$props.appearance,
|
|
106
|
-
|
|
176
|
+
size = _this$props.size,
|
|
177
|
+
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.
|
|
178
|
+
|
|
107
179
|
|
|
108
180
|
var autoCompleteValue = undefined;
|
|
109
181
|
|
|
110
182
|
if (autoComplete !== undefined) {
|
|
111
183
|
autoCompleteValue = autoComplete ? "on" : "off";
|
|
112
|
-
}
|
|
184
|
+
} // Add default elemBefore and elemAfter elements if type is search.
|
|
185
|
+
|
|
113
186
|
|
|
187
|
+
var elementBefore = type === "search" && !elemBefore ? /*#__PURE__*/React.createElement(_Icon.default, {
|
|
188
|
+
name: "search",
|
|
189
|
+
ariaHidden: true,
|
|
190
|
+
color: "icon.base"
|
|
191
|
+
}) : elemBefore; // Do not add a ClearButton if no onClear callback is provided or if an elemAfter prop was passed.
|
|
192
|
+
|
|
193
|
+
var elementAfter = type === "search" && onClear && !elemAfter ? /*#__PURE__*/React.createElement(ClearButton, null) : elemAfter;
|
|
114
194
|
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
115
|
-
hasBeforeElement: !!
|
|
116
|
-
hasAfterElement: !!
|
|
195
|
+
hasBeforeElement: !!elementBefore,
|
|
196
|
+
hasAfterElement: !!elementAfter,
|
|
117
197
|
disabled: disabled,
|
|
118
198
|
invalid: !!isInvalid,
|
|
119
199
|
warning: hasWarning,
|
|
120
|
-
appearance: appearance
|
|
200
|
+
appearance: appearance,
|
|
201
|
+
size: size // $FlowIssue - upgrade v0.112.0
|
|
121
202
|
|
|
122
|
-
}, rest),
|
|
203
|
+
}, rest), /*#__PURE__*/React.createElement(InputContext.Provider, {
|
|
204
|
+
value: {
|
|
205
|
+
handleClear: this.handleClear,
|
|
206
|
+
hasValue: !!value,
|
|
207
|
+
clearButtonLabel: clearButtonLabel,
|
|
208
|
+
onClear: onClear,
|
|
209
|
+
size: size
|
|
210
|
+
}
|
|
211
|
+
}, elementBefore && /*#__PURE__*/React.createElement(_styles.Accessory, {
|
|
123
212
|
before: true
|
|
124
|
-
},
|
|
213
|
+
}, elementBefore), /*#__PURE__*/React.createElement("input", _extends({
|
|
125
214
|
"aria-invalid": !!isInvalid,
|
|
126
215
|
"aria-label": ariaLabel,
|
|
127
216
|
"aria-describedby": ariaDescribedby,
|
|
@@ -146,19 +235,24 @@ var Input = /*#__PURE__*/function (_React$Component) {
|
|
|
146
235
|
"data-qa-input": name || "",
|
|
147
236
|
"data-qa-input-isdisabled": disabled === true,
|
|
148
237
|
"data-qa-input-isrequired": required === true
|
|
149
|
-
}, qa, inputProps)),
|
|
150
|
-
after: true
|
|
151
|
-
|
|
238
|
+
}, qa, inputProps)), elementAfter && /*#__PURE__*/React.createElement(_styles.Accessory, {
|
|
239
|
+
after: true,
|
|
240
|
+
isClearButton: isClearButton(elementAfter)
|
|
241
|
+
}, elementAfter)));
|
|
152
242
|
};
|
|
153
243
|
|
|
154
244
|
return Input;
|
|
155
245
|
}(React.Component);
|
|
156
246
|
|
|
157
|
-
exports.default = Input;
|
|
158
247
|
Input.defaultProps = {
|
|
159
248
|
autoFocus: false,
|
|
160
249
|
disabled: false,
|
|
161
250
|
type: "text",
|
|
162
251
|
size: "default",
|
|
163
|
-
appearance: "primary"
|
|
164
|
-
|
|
252
|
+
appearance: "primary",
|
|
253
|
+
innerRef: /*#__PURE__*/React.createRef()
|
|
254
|
+
};
|
|
255
|
+
Input.ClearButton = ClearButton;
|
|
256
|
+
Input.ClearButton.displayName = "Input.ClearButton";
|
|
257
|
+
var _default = Input;
|
|
258
|
+
exports.default = _default;
|
package/commonjs/Input/styles.js
CHANGED
|
@@ -86,7 +86,7 @@ var Accessory = _styledComponents.default.div.withConfig({
|
|
|
86
86
|
}, function (props) {
|
|
87
87
|
return props.before && (0, _styledComponents.css)(["left:", ";"], props.theme.space[350]);
|
|
88
88
|
}, function (props) {
|
|
89
|
-
return props.after && (0, _styledComponents.css)(["right:", ";"], props.theme.space[350]);
|
|
89
|
+
return props.after && (0, _styledComponents.css)(["right:", ";"], props.isClearButton ? 0 : props.theme.space[350]);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
exports.Accessory = Accessory;
|
|
@@ -300,7 +300,7 @@ var TokenInput = /*#__PURE__*/function (_React$Component) {
|
|
|
300
300
|
"aria-invalid": !!isInvalid,
|
|
301
301
|
"aria-label": ariaLabel,
|
|
302
302
|
autoFocus: autoFocus,
|
|
303
|
-
|
|
303
|
+
autoComplete: autocomplete,
|
|
304
304
|
disabled: disabled,
|
|
305
305
|
id: id,
|
|
306
306
|
name: name,
|
|
@@ -175,7 +175,10 @@ var colors = _extends({}, _theme.default.colors, {
|
|
|
175
175
|
subtext: _seedsColor.default.COLOR_NEUTRAL_300,
|
|
176
176
|
body: _seedsColor.default.COLOR_NEUTRAL_100,
|
|
177
177
|
inverse: _seedsColor.default.COLOR_NEUTRAL_900,
|
|
178
|
-
error: _seedsColor.default.COLOR_RED_400
|
|
178
|
+
error: _seedsColor.default.COLOR_RED_400,
|
|
179
|
+
background: {
|
|
180
|
+
highlight: _seedsColor.default.COLOR_YELLOW_900
|
|
181
|
+
}
|
|
179
182
|
},
|
|
180
183
|
icon: {
|
|
181
184
|
base: _seedsColor.default.COLOR_NEUTRAL_100,
|
|
@@ -35,7 +35,16 @@ function getDarkThemeColors(themeColors) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
|
|
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, {
|
|
39
48
|
// FIX: These need to be changed to have dark mode colors
|
|
40
49
|
// For now we've copied the light mode values here as well.
|
|
41
50
|
sentiment: {
|
|
@@ -43,6 +52,6 @@ function getDarkThemeColors(themeColors) {
|
|
|
43
52
|
negative_sentiment: themeColors.red[500],
|
|
44
53
|
neutral_sentiment: themeColors.neutral[300]
|
|
45
54
|
}
|
|
46
|
-
}
|
|
55
|
+
})
|
|
47
56
|
});
|
|
48
57
|
}
|
|
@@ -15,15 +15,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
|
|
16
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
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var themeClone = (0, _justClone.default)(baseDarkTheme); // get non color theme values
|
|
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
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
var nonColorThemeValues = (0, _NonColorThemeValues.getNonColorThemeValues)(themeClone); // get sprout specific dark theme colors
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
23
|
+
var darkThemeColors = (0, _getDarkThemeColors.getDarkThemeColors)(themeClone.colors);
|
|
24
|
+
|
|
25
|
+
var darkTheme = _extends({}, themeClone, nonColorThemeValues, darkThemeColors);
|
|
27
26
|
|
|
28
27
|
var _default = darkTheme;
|
|
29
28
|
exports.default = _default;
|
|
@@ -35,12 +35,19 @@ function getLightThemeColors(themeColors) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
|
|
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, {
|
|
39
46
|
sentiment: {
|
|
40
47
|
positive_sentiment: themeColors.blue[500],
|
|
41
48
|
negative_sentiment: themeColors.red[500],
|
|
42
49
|
neutral_sentiment: themeColors.neutral[300]
|
|
43
50
|
}
|
|
44
|
-
}
|
|
51
|
+
})
|
|
45
52
|
});
|
|
46
53
|
}
|
|
@@ -15,15 +15,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
|
|
16
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
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var themeClone = (0, _justClone.default)(baseLightTheme); // get non color theme values
|
|
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
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
var nonColorThemeValues = (0, _NonColorThemeValues.getNonColorThemeValues)(themeClone); // get sprout specific light theme colors
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
23
|
+
var lightThemeColors = (0, _getLightThemeColors.getLightThemeColors)(themeClone.colors);
|
|
24
|
+
|
|
25
|
+
var lightTheme = _extends({}, themeClone, nonColorThemeValues, lightThemeColors);
|
|
27
26
|
|
|
28
27
|
var _default = lightTheme;
|
|
29
28
|
exports.default = _default;
|
|
@@ -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,
|