@sproutsocial/racine 11.6.0 → 11.6.1-input-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/__flow__/Checkbox/styles.js +75 -75
- package/__flow__/Collapsible/index.js +3 -2
- package/__flow__/Image/index.js +10 -2
- package/__flow__/Input/index.js +48 -16
- package/__flow__/Input/index.stories.js +14 -0
- package/__flow__/Input/index.test.js +18 -0
- package/__flow__/Input/styles.js +2 -2
- package/__flow__/SegmentedControl/index.js +3 -2
- package/__flow__/TableCell/index.js +9 -2
- package/__flow__/ThemeProvider/index.js +1 -2
- package/__flow__/ToggleHint/index.js +9 -2
- package/__flow__/index.js +1 -2
- package/__flow__/systemProps/color.js +1 -2
- package/__flow__/themes/dark/theme.js +3 -3
- package/__flow__/themes/extendedThemes/sproutTheme/dark/theme.js +34 -15
- package/__flow__/themes/extendedThemes/sproutTheme/index.js +0 -1
- package/__flow__/themes/extendedThemes/sproutTheme/light/theme.js +34 -15
- package/__flow__/types/theme.colors.flow.js +8 -1
- package/__flow__/types/theme.flow.js +10 -13
- package/__flow__/utils/responsiveProps/index.test.js +10 -2
- package/commonjs/Input/index.js +40 -16
- package/commonjs/Input/styles.js +2 -2
- package/commonjs/themes/dark/theme.js +3 -3
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +36 -15
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +36 -15
- package/commonjs/types/theme.flow.js +3 -1
- package/dist/themes/dark/dark.scss +0 -3
- package/lib/Input/index.js +40 -16
- package/lib/Input/styles.js +2 -2
- package/lib/themes/dark/theme.js +3 -3
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +33 -10
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +33 -10
- package/lib/types/theme.flow.js +2 -1
- package/package.json +2 -3
- package/__flow__/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +0 -17
- package/__flow__/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +0 -36
- package/__flow__/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +0 -36
- package/__flow__/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +0 -36
- package/commonjs/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +0 -16
- package/commonjs/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +0 -39
- package/commonjs/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +0 -39
- package/commonjs/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +0 -1
- package/lib/themes/extendedThemes/sproutTheme/NonColorThemeValues/index.js +0 -12
- package/lib/themes/extendedThemes/sproutTheme/dark/getDarkThemeColors.js +0 -34
- package/lib/themes/extendedThemes/sproutTheme/light/getLightThemeColors.js +0 -34
- package/lib/themes/extendedThemes/sproutTheme/sproutThemeType.flow.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 11.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eb27d01: Fix interact util in dark mode themes
|
|
8
|
+
- The `interact` util was located at a different location in the light and dark mode base theme objects. It was at the base level of the light theme and nested inside of `colors` for the dark theme.
|
|
9
|
+
- `interact` was seemingly available at the base level of the theme in both modes, because we spread the light theme as the basis of the dark theme. However, the `interact` util accessible at the base level of the theme would behave like light mode in either mode.
|
|
10
|
+
- The `interact` util located inside the `colors` object inside the dark mode theme object was not usable, due to only being defined in that location for dark mode, and has been removed.
|
|
11
|
+
- eb27d01: Remove 'just-clone' dependency
|
|
12
|
+
- eb27d01: Fix "navigation" colors in SproutTheme
|
|
13
|
+
- The "navigation" colors were not available in the theme due to being spread in incorrectly.
|
|
14
|
+
- eb27d01: Improve theme types to be more accurate
|
|
15
|
+
|
|
3
16
|
## 11.6.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -182,90 +182,90 @@ const getIcon = (type, color) => {
|
|
|
182
182
|
|
|
183
183
|
// eslint-disable-next-line prettier/prettier
|
|
184
184
|
export const CheckboxContainer: StyledComponent<any, TypeTheme, *> = styled.span(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
185
|
+
(props) => css`
|
|
186
|
+
display: inline-flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
position: relative;
|
|
190
|
+
transition: all ${props.theme.duration.fast} ${props.theme.easing.ease_in};
|
|
191
|
+
|
|
192
|
+
@supports (-webkit-appearance: none) {
|
|
193
|
+
&:before {
|
|
194
|
+
/* stylelint-disable */
|
|
195
|
+
content: url("data:image/svg+xml;utf8,${getIcon(
|
|
196
|
+
props.indeterminate ? "indeterminate" : "check",
|
|
197
|
+
|
|
198
|
+
props.checked
|
|
199
|
+
? props.theme.colors.form.background.base
|
|
200
|
+
: props.theme.colors.form.border.base
|
|
201
|
+
)}");
|
|
202
|
+
opacity: ${props.checked ? 1 : 0};
|
|
203
|
+
position: absolute;
|
|
204
|
+
width: ${props.theme.space[400]};
|
|
205
|
+
height: ${props.theme.space[400]};
|
|
206
|
+
text-align: center;
|
|
207
|
+
transform: translateY(1px);
|
|
208
|
+
line-height: 1;
|
|
209
|
+
margin: auto;
|
|
210
|
+
pointer-events: none;
|
|
211
|
+
transition: ${props.theme.duration.fast}
|
|
212
|
+
${props.theme.easing.ease_inout};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&:hover:before {
|
|
216
|
+
opacity: ${props.disabled && !props.checked ? 0 : 1};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
${props.disabled &&
|
|
220
|
+
css`
|
|
221
|
+
opacity: 0.4;
|
|
222
|
+
`}
|
|
223
|
+
|
|
224
|
+
input[type='checkbox'] {
|
|
225
|
+
box-sizing: border-box;
|
|
226
|
+
appearance: none;
|
|
227
|
+
margin: 0;
|
|
228
|
+
padding: 0;
|
|
229
|
+
width: ${props.theme.space[400]};
|
|
230
|
+
height: ${props.theme.space[400]};
|
|
231
|
+
border: 1px solid ${props.theme.colors.form.border.base};
|
|
232
|
+
border-radius: 4px;
|
|
233
|
+
background-color: ${props.theme.colors.form.background.base};
|
|
234
|
+
transition: all ${props.theme.duration.fast}
|
|
235
|
+
${props.theme.easing.ease_in};
|
|
236
|
+
cursor: ${props.disabled ? "not-allowed" : "pointer"};
|
|
237
|
+
flex-shrink: 0;
|
|
238
|
+
|
|
239
|
+
&:not(:checked) {
|
|
240
|
+
${!props.indeterminate &&
|
|
241
|
+
css`
|
|
242
|
+
border-color: ${props.theme.colors
|
|
243
|
+
.neutral[300]} !important; /* We don't want the focus ring to remove the border */
|
|
244
|
+
background-color: ${props.theme.colors.form.background.base};
|
|
245
|
+
`}
|
|
213
246
|
}
|
|
214
247
|
|
|
215
|
-
&:
|
|
216
|
-
|
|
248
|
+
&:checked {
|
|
249
|
+
border-color: ${props.theme.colors.form.border.selected};
|
|
250
|
+
background-color: ${props.theme.colors.form.background.selected};
|
|
217
251
|
}
|
|
218
252
|
|
|
219
|
-
${props.
|
|
253
|
+
${props.indeterminate &&
|
|
254
|
+
props.checked &&
|
|
220
255
|
css`
|
|
221
|
-
|
|
256
|
+
border-color: ${props.theme.colors.form.border.selected} !important;
|
|
257
|
+
background-color: ${props.theme.colors.form.background
|
|
258
|
+
.selected} !important;
|
|
222
259
|
`}
|
|
223
260
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
appearance: none;
|
|
227
|
-
margin: 0;
|
|
228
|
-
padding: 0;
|
|
229
|
-
width: ${props.theme.space[400]};
|
|
230
|
-
height: ${props.theme.space[400]};
|
|
231
|
-
border: 1px solid ${props.theme.colors.form.border.base};
|
|
232
|
-
border-radius: 4px;
|
|
233
|
-
background-color: ${props.theme.colors.form.background.base};
|
|
234
|
-
transition: all ${props.theme.duration.fast}
|
|
235
|
-
${props.theme.easing.ease_in};
|
|
236
|
-
cursor: ${props.disabled ? "not-allowed" : "pointer"};
|
|
237
|
-
flex-shrink: 0;
|
|
238
|
-
|
|
239
|
-
&:not(:checked) {
|
|
240
|
-
${!props.indeterminate &&
|
|
241
|
-
css`
|
|
242
|
-
border-color: ${props.theme.colors
|
|
243
|
-
.neutral[300]} !important; /* We don't want the focus ring to remove the border */
|
|
244
|
-
background-color: ${props.theme.colors.form.background.base};
|
|
245
|
-
`}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
&:checked {
|
|
249
|
-
border-color: ${props.theme.colors.form.border.selected};
|
|
250
|
-
background-color: ${props.theme.colors.form.background.selected};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
${props.indeterminate &&
|
|
254
|
-
props.checked &&
|
|
255
|
-
css`
|
|
256
|
-
border-color: ${props.theme.colors.form.border.selected} !important;
|
|
257
|
-
background-color: ${props.theme.colors.form.background
|
|
258
|
-
.selected} !important;
|
|
259
|
-
`}
|
|
260
|
-
|
|
261
|
-
&:focus {
|
|
262
|
-
${focusRing}
|
|
263
|
-
}
|
|
261
|
+
&:focus {
|
|
262
|
+
${focusRing}
|
|
264
263
|
}
|
|
265
264
|
}
|
|
265
|
+
}
|
|
266
266
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
${COMMON}
|
|
268
|
+
`
|
|
269
|
+
);
|
|
270
270
|
|
|
271
271
|
export default Container;
|
|
@@ -73,8 +73,9 @@ const Trigger = ({ children, ...rest }) => {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
const Panel = ({ children, ...rest }) => {
|
|
76
|
-
const { isOpen, id, offset, collapsedHeight, openHeight } =
|
|
77
|
-
|
|
76
|
+
const { isOpen, id, offset, collapsedHeight, openHeight } = useContext(
|
|
77
|
+
CollapsibleContext
|
|
78
|
+
);
|
|
78
79
|
const ref = useRef();
|
|
79
80
|
const measurement = useMeasure(ref);
|
|
80
81
|
const [isHidden, setIsHidden] = useState(undefined);
|
package/__flow__/Image/index.js
CHANGED
|
@@ -80,8 +80,16 @@ export default class Image extends React.Component<TypeProps, TypeState> {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
render() {
|
|
83
|
-
const {
|
|
84
|
-
|
|
83
|
+
const {
|
|
84
|
+
alt,
|
|
85
|
+
title,
|
|
86
|
+
onClick,
|
|
87
|
+
onError,
|
|
88
|
+
onLoad,
|
|
89
|
+
src,
|
|
90
|
+
qa,
|
|
91
|
+
...rest
|
|
92
|
+
} = this.props;
|
|
85
93
|
|
|
86
94
|
return (
|
|
87
95
|
<ImageContainer
|
package/__flow__/Input/index.js
CHANGED
|
@@ -16,7 +16,7 @@ type TypeProps = {
|
|
|
16
16
|
ariaLabel?: string,
|
|
17
17
|
/** Attribute used to associate other elements that describe the Input, like an error */
|
|
18
18
|
ariaDescribedby?: string,
|
|
19
|
-
/** Label for Input.ClearButton. Required when using
|
|
19
|
+
/** Label for Input.ClearButton. Required when using Input.ClearButton. */
|
|
20
20
|
clearButtonLabel?: string,
|
|
21
21
|
/** Placeholder text for when value is undefined or empty */
|
|
22
22
|
placeholder?: string,
|
|
@@ -52,8 +52,9 @@ type TypeProps = {
|
|
|
52
52
|
| ((React.ElementRef<any> | HTMLElement) => void),
|
|
53
53
|
onBlur?: (e: SyntheticFocusEvent<HTMLInputElement>) => void,
|
|
54
54
|
onChange?: (e: SyntheticInputEvent<HTMLInputElement>, value: string) => void,
|
|
55
|
-
/** Input.ClearButton onClick callback. Required when using
|
|
56
|
-
The component handles returning focus to Input after onClear is called
|
|
55
|
+
/** Input.ClearButton onClick callback. Required when using Input.ClearButton.
|
|
56
|
+
The component handles returning focus to Input after onClear is called.
|
|
57
|
+
For controlled Inputs, you must reset "value" yourself.*/
|
|
57
58
|
onClear?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
58
59
|
onFocus?: (e: SyntheticFocusEvent<HTMLInputElement>) => void,
|
|
59
60
|
onKeyDown?: (
|
|
@@ -74,12 +75,17 @@ type TypeProps = {
|
|
|
74
75
|
appearance?: "primary" | "secondary",
|
|
75
76
|
};
|
|
76
77
|
|
|
78
|
+
type TypeState = {
|
|
79
|
+
hasValue: boolean,
|
|
80
|
+
};
|
|
81
|
+
|
|
77
82
|
// Using Context so that Input's Input.ClearButton-specific props can be passed to Input.ClearButton,
|
|
78
83
|
// regardless of whether it is manually included as elemAfter or automatically included for type="search" Inputs.
|
|
79
84
|
type TypeInputContext = $Shape<{
|
|
80
85
|
onClear?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
81
86
|
handleClear: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
82
87
|
clearButtonLabel: string,
|
|
88
|
+
isControlled: boolean,
|
|
83
89
|
hasValue: boolean,
|
|
84
90
|
size: "large" | "small" | "default",
|
|
85
91
|
}>;
|
|
@@ -99,6 +105,7 @@ const ClearButton = () => {
|
|
|
99
105
|
onClear,
|
|
100
106
|
handleClear,
|
|
101
107
|
clearButtonLabel,
|
|
108
|
+
isControlled,
|
|
102
109
|
hasValue,
|
|
103
110
|
size: inputSize,
|
|
104
111
|
} = React.useContext(InputContext);
|
|
@@ -108,12 +115,9 @@ const ClearButton = () => {
|
|
|
108
115
|
return null;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
if (!onClear) {
|
|
114
|
-
console.warn(
|
|
115
|
-
"Warning: No onClear prop provided to Input when using Input.ClearButton. Omitting Input.ClearButton."
|
|
116
|
-
);
|
|
118
|
+
// Hide the button when no onClear callback is provided to a controlled Input.
|
|
119
|
+
// For a controlled component, all the button would do without an onClear is focus the input.
|
|
120
|
+
if (isControlled && !onClear) {
|
|
117
121
|
return null;
|
|
118
122
|
}
|
|
119
123
|
|
|
@@ -154,7 +158,16 @@ const isClearButton = (elem: any) => {
|
|
|
154
158
|
return false;
|
|
155
159
|
};
|
|
156
160
|
|
|
157
|
-
class Input extends React.Component<TypeProps> {
|
|
161
|
+
class Input extends React.Component<TypeProps, TypeState> {
|
|
162
|
+
constructor(props: TypeProps) {
|
|
163
|
+
super(props);
|
|
164
|
+
this.state = {
|
|
165
|
+
// Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
166
|
+
// for both controlled and uncontrolled inputs.
|
|
167
|
+
hasValue: !!props.value,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
158
171
|
static defaultProps = {
|
|
159
172
|
autoFocus: false,
|
|
160
173
|
disabled: false,
|
|
@@ -165,7 +178,7 @@ class Input extends React.Component<TypeProps> {
|
|
|
165
178
|
|
|
166
179
|
static ClearButton = ClearButton;
|
|
167
180
|
|
|
168
|
-
// Define our own ref for
|
|
181
|
+
// Define our own ref for use in handleClear.
|
|
169
182
|
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
170
183
|
inputRef = React.createRef<HTMLInputElement>();
|
|
171
184
|
|
|
@@ -173,12 +186,21 @@ class Input extends React.Component<TypeProps> {
|
|
|
173
186
|
this.props.onBlur?.(e);
|
|
174
187
|
|
|
175
188
|
handleClear = (e: SyntheticEvent<HTMLButtonElement>) => {
|
|
176
|
-
|
|
189
|
+
// If the component is uncontrolled, clear its value via ref.
|
|
190
|
+
if (typeof this.props.value !== "string") {
|
|
191
|
+
if (this.inputRef.current) {
|
|
192
|
+
this.inputRef.current.value = "";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
this.inputRef.current?.focus();
|
|
177
196
|
this.props.onClear?.(e);
|
|
197
|
+
this.updateState("");
|
|
178
198
|
};
|
|
179
199
|
|
|
180
|
-
handleChange = (e: SyntheticInputEvent<HTMLInputElement>) =>
|
|
200
|
+
handleChange = (e: SyntheticInputEvent<HTMLInputElement>) => {
|
|
181
201
|
this.props.onChange?.(e, e.currentTarget.value);
|
|
202
|
+
this.updateState(e.currentTarget.value);
|
|
203
|
+
};
|
|
182
204
|
|
|
183
205
|
handleFocus = (e: SyntheticFocusEvent<HTMLInputElement>) =>
|
|
184
206
|
this.props.onFocus?.(e);
|
|
@@ -192,6 +214,15 @@ class Input extends React.Component<TypeProps> {
|
|
|
192
214
|
handlePaste = (e: SyntheticInputEvent<HTMLInputElement>) =>
|
|
193
215
|
this.props.onPaste?.(e, e.currentTarget.value);
|
|
194
216
|
|
|
217
|
+
updateState = (value: string) => {
|
|
218
|
+
const hasValue = value !== "";
|
|
219
|
+
const hadValue = this.state.hasValue;
|
|
220
|
+
// Only update state if the value has changed to avoid unnecessary renders.
|
|
221
|
+
if (hasValue !== hadValue) {
|
|
222
|
+
this.setState({ hasValue });
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
195
226
|
render() {
|
|
196
227
|
const {
|
|
197
228
|
autoComplete,
|
|
@@ -240,9 +271,9 @@ class Input extends React.Component<TypeProps> {
|
|
|
240
271
|
) : (
|
|
241
272
|
elemBefore
|
|
242
273
|
);
|
|
243
|
-
// Do not add a ClearButton if
|
|
274
|
+
// Do not add a ClearButton if an elemAfter prop was passed.
|
|
244
275
|
const elementAfter =
|
|
245
|
-
type === "search" &&
|
|
276
|
+
type === "search" && !elemAfter ? <ClearButton /> : elemAfter;
|
|
246
277
|
|
|
247
278
|
return (
|
|
248
279
|
<Container
|
|
@@ -259,7 +290,8 @@ class Input extends React.Component<TypeProps> {
|
|
|
259
290
|
<InputContext.Provider
|
|
260
291
|
value={{
|
|
261
292
|
handleClear: this.handleClear,
|
|
262
|
-
hasValue:
|
|
293
|
+
hasValue: this.state.hasValue,
|
|
294
|
+
isControlled: typeof this.props.value === "string",
|
|
263
295
|
clearButtonLabel,
|
|
264
296
|
onClear,
|
|
265
297
|
size,
|
|
@@ -188,6 +188,20 @@ largeSearchInput.story = {
|
|
|
188
188
|
name: "Large Search Input",
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
+
export const uncontrolledSearchInput = () => (
|
|
192
|
+
<Input
|
|
193
|
+
type="search"
|
|
194
|
+
placeholder={text("placeholder", "Please enter a value...")}
|
|
195
|
+
onClear={() => window.alert("Cleared!")}
|
|
196
|
+
clearButtonLabel={text("clearButtonLabel", "Clear search")}
|
|
197
|
+
ariaLabel={text("ariaLabel", "Descriptive label goes here")}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
uncontrolledSearchInput.story = {
|
|
202
|
+
name: "Uncontrolled Search Input",
|
|
203
|
+
};
|
|
204
|
+
|
|
191
205
|
export const nonSearchClearButtonInput = () => {
|
|
192
206
|
return (
|
|
193
207
|
<Input
|
|
@@ -85,6 +85,24 @@ describe("Input", () => {
|
|
|
85
85
|
expect(getByRole("button")).toBeTruthy();
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
it("should render a clear button for an uncontrolled search Input only once it is typed in", () => {
|
|
89
|
+
const { getByRole, queryByRole } = render(
|
|
90
|
+
<Input
|
|
91
|
+
id="name"
|
|
92
|
+
name="name"
|
|
93
|
+
type="search"
|
|
94
|
+
onClear={jest.fn()}
|
|
95
|
+
clearButtonLabel="Clear search"
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
expect(queryByRole("button")).toBeFalsy();
|
|
99
|
+
const input = getByRole("searchbox");
|
|
100
|
+
userEvent.tab();
|
|
101
|
+
expect(input).toHaveFocus();
|
|
102
|
+
userEvent.keyboard("some text");
|
|
103
|
+
expect(getByRole("button")).toBeTruthy();
|
|
104
|
+
});
|
|
105
|
+
|
|
88
106
|
it("should not render a clear button for search Inputs if there is no text", () => {
|
|
89
107
|
const { queryByRole } = render(
|
|
90
108
|
<Input
|
package/__flow__/Input/styles.js
CHANGED
|
@@ -134,13 +134,13 @@ export const Accessory: StyledComponent<any, TypeTheme, *> = styled.div`
|
|
|
134
134
|
${(props) =>
|
|
135
135
|
props.before &&
|
|
136
136
|
css`
|
|
137
|
-
left: ${props.theme.space[
|
|
137
|
+
left: ${props.theme.space[300]};
|
|
138
138
|
`};
|
|
139
139
|
|
|
140
140
|
${(props) =>
|
|
141
141
|
props.after &&
|
|
142
142
|
css`
|
|
143
|
-
right: ${props.isClearButton ? 0 : props.theme.space[
|
|
143
|
+
right: ${props.isClearButton ? 0 : props.theme.space[300]};
|
|
144
144
|
`};
|
|
145
145
|
`;
|
|
146
146
|
|
|
@@ -17,8 +17,9 @@ type TypeSegmentedControlContext = {
|
|
|
17
17
|
onChange: (e: SyntheticInputEvent<HTMLInputElement>) => void,
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const SegmentedControlContext =
|
|
21
|
-
|
|
20
|
+
const SegmentedControlContext = React.createContext<?TypeSegmentedControlContext>(
|
|
21
|
+
null
|
|
22
|
+
);
|
|
22
23
|
|
|
23
24
|
type TypeSegmentedControlItemProps = {
|
|
24
25
|
/** The value of this item. Should be unique among sibling items. */
|
|
@@ -22,8 +22,15 @@ export type TypeTableCell = {
|
|
|
22
22
|
*/
|
|
23
23
|
export default class TableCell extends React.Component<TypeTableCell> {
|
|
24
24
|
render() {
|
|
25
|
-
const {
|
|
26
|
-
|
|
25
|
+
const {
|
|
26
|
+
id,
|
|
27
|
+
content,
|
|
28
|
+
colSpan,
|
|
29
|
+
width,
|
|
30
|
+
align,
|
|
31
|
+
children,
|
|
32
|
+
...rest
|
|
33
|
+
} = this.props;
|
|
27
34
|
|
|
28
35
|
return (
|
|
29
36
|
<Container
|
|
@@ -3,8 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { ThemeProvider as BaseThemeProvider } from "styled-components";
|
|
4
4
|
import theme from "../themes/light/theme";
|
|
5
5
|
|
|
6
|
-
import type { TypeTheme } from "../types/theme.flow";
|
|
7
|
-
import type { TypeSproutTheme } from "../themes/extendedThemes/sproutTheme/sproutThemeType.flow";
|
|
6
|
+
import type { TypeTheme, TypeSproutTheme } from "../types/theme.flow";
|
|
8
7
|
|
|
9
8
|
// We can append additional themes types here
|
|
10
9
|
type TypeAllThemes = TypeTheme | TypeSproutTheme;
|
|
@@ -32,8 +32,15 @@ export default class ToggleHint extends React.Component<TypeProps> {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
render() {
|
|
35
|
-
const {
|
|
36
|
-
|
|
35
|
+
const {
|
|
36
|
+
icon,
|
|
37
|
+
isOpen,
|
|
38
|
+
openString,
|
|
39
|
+
closeString,
|
|
40
|
+
qa,
|
|
41
|
+
className,
|
|
42
|
+
...rest
|
|
43
|
+
} = this.props;
|
|
37
44
|
|
|
38
45
|
return (
|
|
39
46
|
<Container
|
package/__flow__/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
export type { EnumIconNames } from "./EnumIconNames";
|
|
3
|
-
export type { TypeTheme } from "./types/theme.flow";
|
|
3
|
+
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";
|
|
@@ -10,7 +10,6 @@ export {
|
|
|
10
10
|
sproutLightTheme,
|
|
11
11
|
sproutDarkTheme,
|
|
12
12
|
} from "./themes/extendedThemes/sproutTheme";
|
|
13
|
-
export type { TypeSproutTheme } from "./themes/extendedThemes/sproutTheme";
|
|
14
13
|
export { default as Icon } from "./Icon";
|
|
15
14
|
// DEPRECATED: Alert has been renamed to Banner
|
|
16
15
|
export { default as Alert } from "./Banner";
|
|
@@ -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,
|
|
@@ -29,9 +29,6 @@ export const shadows = {
|
|
|
29
29
|
|
|
30
30
|
const colors = {
|
|
31
31
|
...lightTheme.colors,
|
|
32
|
-
utils: {
|
|
33
|
-
interact: interact(MODE),
|
|
34
|
-
},
|
|
35
32
|
app: {
|
|
36
33
|
background: {
|
|
37
34
|
base: COLORS.COLOR_NEUTRAL_1000,
|
|
@@ -238,6 +235,9 @@ const colors = {
|
|
|
238
235
|
|
|
239
236
|
const darkTheme = {
|
|
240
237
|
...lightTheme,
|
|
238
|
+
utils: {
|
|
239
|
+
interact: interact(MODE),
|
|
240
|
+
},
|
|
241
241
|
colors,
|
|
242
242
|
shadows,
|
|
243
243
|
mode: MODE,
|
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
// @flow strict-local
|
|
2
|
-
import clone from "just-clone";
|
|
3
2
|
import baseDarkTheme from "../../../dark/theme";
|
|
4
|
-
import {
|
|
5
|
-
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
-
import type { TypeSproutTheme } from "../sproutThemeType.flow";
|
|
3
|
+
import type { TypeSproutTheme } from "../../../../types/theme.flow";
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
export const navigation = {
|
|
6
|
+
main: {
|
|
7
|
+
background: {
|
|
8
|
+
base: baseDarkTheme.colors.neutral[1000],
|
|
9
|
+
overflowGradient: baseDarkTheme.colors.neutral[1100],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
secondary: {
|
|
13
|
+
background: {
|
|
14
|
+
base: baseDarkTheme.colors.neutral[900],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
base: baseDarkTheme.colors.neutral[0],
|
|
19
|
+
hover: baseDarkTheme.colors.neutral[0],
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
base: baseDarkTheme.colors.neutral[0],
|
|
23
|
+
hover: baseDarkTheme.colors.neutral[0],
|
|
24
|
+
},
|
|
25
|
+
listItem: {
|
|
26
|
+
background: {
|
|
27
|
+
base: baseDarkTheme.colors.neutral[1000],
|
|
28
|
+
hover: baseDarkTheme.colors.neutral[1100],
|
|
29
|
+
selected: baseDarkTheme.colors.neutral[700],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
16
33
|
|
|
17
34
|
const darkTheme: TypeSproutTheme = {
|
|
18
|
-
...
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
...baseDarkTheme,
|
|
36
|
+
colors: {
|
|
37
|
+
...baseDarkTheme.colors,
|
|
38
|
+
navigation,
|
|
39
|
+
},
|
|
21
40
|
};
|
|
22
41
|
|
|
23
42
|
export default darkTheme;
|
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
// @flow strict-local
|
|
2
|
-
import clone from "just-clone";
|
|
3
2
|
import baseLightTheme from "../../../light/theme";
|
|
4
|
-
import {
|
|
5
|
-
import { getNonColorThemeValues } from "../NonColorThemeValues";
|
|
6
|
-
import type { TypeSproutTheme } from "../sproutThemeType.flow";
|
|
3
|
+
import type { TypeSproutTheme } from "../../../../types/theme.flow";
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
export const navigation = {
|
|
6
|
+
main: {
|
|
7
|
+
background: {
|
|
8
|
+
base: baseLightTheme.colors.neutral[900],
|
|
9
|
+
overflowGradient: baseLightTheme.colors.neutral[1000],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
secondary: {
|
|
13
|
+
background: {
|
|
14
|
+
base: baseLightTheme.colors.neutral[800],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
base: baseLightTheme.colors.neutral[0],
|
|
19
|
+
hover: baseLightTheme.colors.neutral[0],
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
base: baseLightTheme.colors.neutral[0],
|
|
23
|
+
hover: baseLightTheme.colors.neutral[0],
|
|
24
|
+
},
|
|
25
|
+
listItem: {
|
|
26
|
+
background: {
|
|
27
|
+
base: baseLightTheme.colors.neutral[800],
|
|
28
|
+
hover: baseLightTheme.colors.neutral[1000],
|
|
29
|
+
selected: baseLightTheme.colors.neutral[700],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
16
33
|
|
|
17
34
|
const lightTheme: TypeSproutTheme = {
|
|
18
|
-
...
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
...baseLightTheme,
|
|
36
|
+
colors: {
|
|
37
|
+
...baseLightTheme.colors,
|
|
38
|
+
navigation,
|
|
39
|
+
},
|
|
21
40
|
};
|
|
22
41
|
|
|
23
42
|
export default lightTheme;
|