@sproutsocial/racine 11.6.0 → 11.6.1-theme-type.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- (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};
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
- &:hover:before {
216
- opacity: ${props.disabled && !props.checked ? 0 : 1};
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.disabled &&
253
+ ${props.indeterminate &&
254
+ props.checked &&
220
255
  css`
221
- opacity: 0.4;
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
- 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
- `}
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
- ${COMMON}
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
- useContext(CollapsibleContext);
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);
@@ -80,8 +80,16 @@ export default class Image extends React.Component<TypeProps, TypeState> {
80
80
  };
81
81
 
82
82
  render() {
83
- const { alt, title, onClick, onError, onLoad, src, qa, ...rest } =
84
- this.props;
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
@@ -17,8 +17,9 @@ type TypeSegmentedControlContext = {
17
17
  onChange: (e: SyntheticInputEvent<HTMLInputElement>) => void,
18
18
  };
19
19
 
20
- const SegmentedControlContext =
21
- React.createContext<?TypeSegmentedControlContext>(null);
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 { id, content, colSpan, width, align, children, ...rest } =
26
- this.props;
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 { icon, isOpen, openString, closeString, qa, className, ...rest } =
36
- this.props;
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,
@@ -3,7 +3,7 @@ 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 { TypeSproutTheme } from "../sproutThemeType.flow";
6
+ import type { TypeSproutTheme } from "../../../../types/theme.flow";
7
7
 
8
8
  // clone base theme. (we don't want to mutate the base theme)
9
9
  const themeClone = clone(baseDarkTheme);
@@ -1,4 +1,3 @@
1
1
  // @flow
2
2
  export { default as sproutLightTheme } from "./light/theme";
3
3
  export { default as sproutDarkTheme } from "./dark/theme";
4
- export type { TypeSproutTheme } from "./sproutThemeType.flow";
@@ -3,7 +3,7 @@ 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 { TypeSproutTheme } from "../sproutThemeType.flow";
6
+ import type { TypeSproutTheme } from "../../../../types/theme.flow";
7
7
 
8
8
  // clone base theme. (we don't want to mutate the base theme)
9
9
  const themeClone = clone(baseLightTheme);
@@ -58,3 +58,39 @@ export type TypeNonColorThemeValues = {
58
58
  easing: TypeEasing,
59
59
  duration: TypeDuration,
60
60
  };
61
+
62
+ // Extended themes
63
+ export type TypeSproutTheme = {
64
+ ...$Exact<TypeTheme>,
65
+ colors: {|
66
+ ...$Exact<TypeColor>,
67
+ navigation: {|
68
+ main: {|
69
+ background: {|
70
+ base: string,
71
+ gradient: string,
72
+ |},
73
+ |},
74
+ secondary: {|
75
+ background: {|
76
+ base: string,
77
+ |},
78
+ |},
79
+ text: {|
80
+ base: string,
81
+ hover: string,
82
+ |},
83
+ icon: {|
84
+ base: string,
85
+ hover: string,
86
+ |},
87
+ listItem: {|
88
+ background: {|
89
+ base: string,
90
+ hover: string,
91
+ active: string,
92
+ |},
93
+ |},
94
+ |},
95
+ |},
96
+ };
@@ -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
  });
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-theme-type.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "__flow__",
@@ -1,36 +0,0 @@
1
- // @flow strict-local
2
- import type { TypeTheme } from "../../../types/theme.flow";
3
-
4
- export type TypeSproutTheme = {
5
- ...$Exact<TypeTheme>,
6
- colors: {|
7
- navigation: {|
8
- main: {|
9
- background: {|
10
- base: string,
11
- gradient: string,
12
- |},
13
- |},
14
- secondary: {|
15
- background: {|
16
- base: string,
17
- |},
18
- |},
19
- text: {|
20
- base: string,
21
- hover: string,
22
- |},
23
- icon: {|
24
- base: string,
25
- hover: string,
26
- |},
27
- listItem: {|
28
- background: {|
29
- base: string,
30
- hover: string,
31
- active: string,
32
- |},
33
- |},
34
- |},
35
- |},
36
- };