@sproutsocial/racine 7.7.0-beta-collapsible.0 → 8.0.0-beta-dark-mode.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 (179) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/__flow__/Badge/styles.js +1 -1
  3. package/__flow__/Banner/index.js +2 -1
  4. package/__flow__/Banner/styles.js +9 -6
  5. package/__flow__/Box/index.stories.js +3 -3
  6. package/__flow__/Box/styles.js +9 -9
  7. package/__flow__/Button/__snapshots__/index.test.js.snap +4 -4
  8. package/__flow__/Button/index.js +7 -2
  9. package/__flow__/Button/index.stories.js +6 -1
  10. package/__flow__/Button/styles.js +17 -12
  11. package/__flow__/Card/index.js +2 -2
  12. package/__flow__/CharacterCounter/styles.js +1 -1
  13. package/__flow__/ChartLegend/styles.js +6 -6
  14. package/__flow__/Checkbox/styles.js +18 -16
  15. package/__flow__/Collapsible/index.js +6 -24
  16. package/__flow__/Collapsible/index.stories.js +11 -82
  17. package/__flow__/Collapsible/styles.js +2 -28
  18. package/__flow__/DatePicker/styles.js +14 -12
  19. package/__flow__/Drawer/styles.js +1 -1
  20. package/__flow__/FormField/index.js +1 -1
  21. package/__flow__/Icon/index.stories.js +24 -6
  22. package/__flow__/Input/styles.js +6 -6
  23. package/__flow__/KeyboardKey/styles.js +2 -2
  24. package/__flow__/Link/styles.js +3 -5
  25. package/__flow__/Listbox/__snapshots__/index.test.js.snap +8 -2
  26. package/__flow__/Listbox/index.js +4 -4
  27. package/__flow__/Menu/__snapshots__/index.test.js.snap +5 -2
  28. package/__flow__/Menu/index.js +7 -2
  29. package/__flow__/Menu/styles.js +6 -3
  30. package/__flow__/Message/index.js +2 -2
  31. package/__flow__/Message/index.stories.js +1 -1
  32. package/__flow__/Modal/index.js +1 -1
  33. package/__flow__/Modal/index.stories.js +14 -8
  34. package/__flow__/Modal/styles.js +2 -2
  35. package/__flow__/Numeral/styles.js +2 -1
  36. package/__flow__/OverflowList/index.stories.js +15 -8
  37. package/__flow__/Popout/index.js +3 -3
  38. package/__flow__/Radio/styles.js +8 -8
  39. package/__flow__/SegmentedControl/styles.js +9 -5
  40. package/__flow__/Select/styles.js +5 -5
  41. package/__flow__/Skeleton/index.js +4 -4
  42. package/__flow__/Skeleton/index.stories.js +1 -1
  43. package/__flow__/Stack/index.js +1 -1
  44. package/__flow__/Stack/index.stories.js +3 -1
  45. package/__flow__/Switch/styles.js +13 -11
  46. package/__flow__/Table/styles.js +2 -1
  47. package/__flow__/TableCell/index.stories.js +2 -0
  48. package/__flow__/TableHeaderCell/index.stories.js +3 -0
  49. package/__flow__/TableRowAccordion/styles.js +2 -1
  50. package/__flow__/Tabs/styles.js +5 -5
  51. package/__flow__/Textarea/styles.js +5 -5
  52. package/__flow__/ThemeProvider/index.js +2 -2
  53. package/__flow__/Toast/index.js +1 -1
  54. package/__flow__/Toast/styles.js +3 -3
  55. package/__flow__/Token/styles.js +19 -8
  56. package/__flow__/TokenInput/index.js +2 -1
  57. package/__flow__/TokenInput/styles.js +14 -6
  58. package/__flow__/Tooltip/index.js +2 -2
  59. package/__flow__/index.js +2 -2
  60. package/__flow__/themes/dark/decorative-palettes.js +43 -0
  61. package/__flow__/themes/dark/theme.js +195 -0
  62. package/__flow__/themes/default/decorative-palettes.js +43 -0
  63. package/__flow__/themes/default/literal-colors.js +160 -0
  64. package/__flow__/themes/default/theme.js +336 -0
  65. package/__flow__/types/system-props.flow.js +2 -2
  66. package/__flow__/types/theme.colors.flow.js +244 -0
  67. package/__flow__/types/theme.flow.js +38 -213
  68. package/__flow__/utils/mixins.js +4 -3
  69. package/__flow__/utils/responsiveProps/index.js +1 -1
  70. package/commonjs/Badge/styles.js +1 -1
  71. package/commonjs/Banner/index.js +3 -2
  72. package/commonjs/Banner/styles.js +1 -1
  73. package/commonjs/Button/index.js +5 -3
  74. package/commonjs/Button/styles.js +12 -11
  75. package/commonjs/Card/index.js +2 -2
  76. package/commonjs/CharacterCounter/styles.js +1 -1
  77. package/commonjs/Checkbox/styles.js +7 -7
  78. package/commonjs/Collapsible/index.js +6 -15
  79. package/commonjs/Collapsible/styles.js +1 -8
  80. package/commonjs/DatePicker/styles.js +13 -11
  81. package/commonjs/Drawer/styles.js +1 -1
  82. package/commonjs/FormField/index.js +1 -1
  83. package/commonjs/Input/styles.js +6 -6
  84. package/commonjs/KeyboardKey/styles.js +2 -2
  85. package/commonjs/Link/styles.js +4 -8
  86. package/commonjs/Listbox/index.js +4 -4
  87. package/commonjs/Menu/index.js +2 -2
  88. package/commonjs/Menu/styles.js +10 -4
  89. package/commonjs/Message/index.js +2 -2
  90. package/commonjs/Modal/index.js +1 -1
  91. package/commonjs/Modal/styles.js +2 -2
  92. package/commonjs/Numeral/styles.js +1 -1
  93. package/commonjs/Popout/index.js +2 -2
  94. package/commonjs/Radio/styles.js +4 -4
  95. package/commonjs/SegmentedControl/styles.js +5 -5
  96. package/commonjs/Select/styles.js +5 -5
  97. package/commonjs/Skeleton/index.js +2 -2
  98. package/commonjs/Switch/styles.js +7 -7
  99. package/commonjs/Table/styles.js +1 -1
  100. package/commonjs/TableRowAccordion/styles.js +1 -1
  101. package/commonjs/Tabs/styles.js +5 -5
  102. package/commonjs/Textarea/styles.js +5 -5
  103. package/commonjs/ThemeProvider/index.js +1 -1
  104. package/commonjs/Toast/index.js +1 -1
  105. package/commonjs/Toast/styles.js +3 -3
  106. package/commonjs/Token/styles.js +18 -10
  107. package/commonjs/TokenInput/index.js +38 -35
  108. package/commonjs/TokenInput/styles.js +9 -7
  109. package/commonjs/Tooltip/index.js +2 -2
  110. package/commonjs/index.js +3 -3
  111. package/commonjs/themes/dark/decorative-palettes.js +51 -0
  112. package/commonjs/themes/dark/theme.js +195 -0
  113. package/commonjs/themes/default/decorative-palettes.js +51 -0
  114. package/commonjs/themes/default/literal-colors.js +165 -0
  115. package/commonjs/themes/default/theme.js +334 -0
  116. package/commonjs/types/theme.colors.flow.js +5 -0
  117. package/commonjs/types/theme.flow.js +1 -5
  118. package/commonjs/utils/mixins.js +2 -2
  119. package/commonjs/utils/responsiveProps/index.js +1 -1
  120. package/lib/Badge/styles.js +1 -1
  121. package/lib/Banner/index.js +3 -2
  122. package/lib/Banner/styles.js +1 -1
  123. package/lib/Button/index.js +5 -3
  124. package/lib/Button/styles.js +11 -11
  125. package/lib/Card/index.js +2 -2
  126. package/lib/CharacterCounter/styles.js +1 -1
  127. package/lib/Checkbox/styles.js +7 -7
  128. package/lib/Collapsible/index.js +6 -15
  129. package/lib/Collapsible/styles.js +1 -8
  130. package/lib/DatePicker/styles.js +12 -11
  131. package/lib/Drawer/styles.js +1 -1
  132. package/lib/FormField/index.js +1 -1
  133. package/lib/Input/styles.js +6 -6
  134. package/lib/KeyboardKey/styles.js +2 -2
  135. package/lib/Link/styles.js +4 -8
  136. package/lib/Listbox/index.js +4 -4
  137. package/lib/Menu/index.js +2 -2
  138. package/lib/Menu/styles.js +10 -4
  139. package/lib/Message/index.js +2 -2
  140. package/lib/Modal/index.js +1 -1
  141. package/lib/Modal/styles.js +2 -2
  142. package/lib/Numeral/styles.js +1 -1
  143. package/lib/Popout/index.js +2 -2
  144. package/lib/Radio/styles.js +4 -4
  145. package/lib/SegmentedControl/styles.js +5 -5
  146. package/lib/Select/styles.js +5 -5
  147. package/lib/Skeleton/index.js +2 -2
  148. package/lib/Switch/styles.js +7 -7
  149. package/lib/Table/styles.js +1 -1
  150. package/lib/TableRowAccordion/styles.js +1 -1
  151. package/lib/Tabs/styles.js +5 -5
  152. package/lib/Textarea/styles.js +5 -5
  153. package/lib/ThemeProvider/index.js +1 -1
  154. package/lib/Toast/index.js +1 -1
  155. package/lib/Toast/styles.js +3 -3
  156. package/lib/Token/styles.js +18 -10
  157. package/lib/TokenInput/index.js +38 -35
  158. package/lib/TokenInput/styles.js +9 -7
  159. package/lib/Tooltip/index.js +2 -2
  160. package/lib/index.js +2 -2
  161. package/lib/themes/dark/decorative-palettes.js +36 -0
  162. package/lib/themes/dark/theme.js +185 -0
  163. package/lib/themes/default/decorative-palettes.js +36 -0
  164. package/lib/themes/default/literal-colors.js +156 -0
  165. package/lib/themes/default/theme.js +306 -0
  166. package/lib/types/theme.colors.flow.js +1 -0
  167. package/lib/types/theme.flow.js +1 -1
  168. package/lib/utils/mixins.js +2 -2
  169. package/lib/utils/responsiveProps/index.js +1 -1
  170. package/package.json +2 -2
  171. package/__flow__/themes/dark.js +0 -133
  172. package/__flow__/themes/light.js +0 -7
  173. package/__flow__/utils/theme.js +0 -422
  174. package/commonjs/themes/dark.js +0 -140
  175. package/commonjs/themes/light.js +0 -14
  176. package/commonjs/utils/theme.js +0 -421
  177. package/lib/themes/dark.js +0 -131
  178. package/lib/themes/light.js +0 -5
  179. package/lib/utils/theme.js +0 -402
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 7.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b69f92a: fix(token) hover styling for invalid tokens
8
+
3
9
  ## 7.5.0
4
10
 
5
11
  ### Minor Changes
@@ -16,7 +16,7 @@ const colors = {
16
16
  };
17
17
 
18
18
  const backgroundColors = {
19
- primary: "colors.cta.primary",
19
+ primary: "colors.blue.700",
20
20
  secondary: "colors.yellow.500",
21
21
  passive: "colors.neutral.200",
22
22
  common: "colors.aqua.600",
@@ -45,7 +45,8 @@ export default class Banner extends React.Component<TypeProps> {
45
45
  const { type, text, ...rest } = this.props;
46
46
  return (
47
47
  <Container
48
- type={type}
48
+ // danger needs to be properly deprecated and removed DS-1094
49
+ type={type === "danger" ? "error" : type}
49
50
  data-qa-alert={""}
50
51
  data-qa-alert-type={type}
51
52
  data-qa-alert-text={text}
@@ -15,28 +15,31 @@ const Container: StyledComponent<TypeProps, TypeTheme, *> = styled.div(
15
15
  overflow: hidden;
16
16
  align-items: center;
17
17
  justify-content: space-between;
18
- color: ${props.theme.colors.text.headline};
18
+ color: ${props.theme.colors.text.body};
19
19
  border-radius: ${props.theme.radii.outer};
20
20
  font-family: ${props.theme.fontFamily};
21
21
  ${props.theme.typography[200]}
22
22
  padding: ${props.theme.space[300]};
23
- border: 1px solid ${props.theme.colors[props.type].border};
24
- background-color: ${props.theme.colors[props.type].background};
23
+ border: 1px solid ${props.theme.colors.container.border[props.type]};
24
+ background-color: ${props.theme.colors.container.background[props.type]};
25
25
 
26
26
  .Icon {
27
27
  align-self: flex-start;
28
28
  margin-top: 3px;
29
29
  margin-right: ${props.theme.space[400]};
30
30
  min-width: 16px;
31
- color: ${props.theme.colors[props.type].icon};
31
+ color: ${props.theme.colors.icon[props.type]};
32
32
  }
33
33
 
34
34
  a,
35
35
  button {
36
36
  font-weight: ${props.theme.fontWeights.semibold};
37
- color: ${props.theme.colors.text.headline};
37
+ color: ${props.theme.colors.text.body};
38
38
  font-size: inherit;
39
- text-decoration: underline;
39
+ &:hover {
40
+ color: ${props.theme.colors.text.body};
41
+ text-decoration: underline;
42
+ }
40
43
  }
41
44
 
42
45
  > span:not(.Icon) {
@@ -3,7 +3,7 @@ import { css } from "styled-components";
3
3
  import { text } from "@storybook/addon-knobs";
4
4
  import Box from "./index";
5
5
  import useMeasure from "use-measure";
6
- import theme from "../utils/theme";
6
+ import theme from "../themes/default/theme";
7
7
 
8
8
  export default {
9
9
  title: "Box",
@@ -67,7 +67,7 @@ export const Responsive = () => {
67
67
  top: 0;
68
68
  bottom: 0;
69
69
  width: 324px;
70
- background: ${(p) => p.theme.colors.background.container};
70
+ background: ${(p) => p.theme.colors.container.background.base};
71
71
  }
72
72
 
73
73
  &:after {
@@ -78,7 +78,7 @@ export const Responsive = () => {
78
78
  bottom: 0;
79
79
  width: 64px;
80
80
  background: white;
81
- border: 1px solid ${(p) => p.theme.colors.border};
81
+ border: 1px solid ${(p) => p.theme.colors.container.border.base};
82
82
  }
83
83
  `}
84
84
  >
@@ -32,15 +32,15 @@ export type TypeContainerProps = $ReadOnly<{|
32
32
 
33
33
  type TypeBoxContainer = StyledComponent<TypeContainerProps, TypeTheme, *>;
34
34
  const Container: TypeBoxContainer = styled.div`
35
- box-sizing: border-box;
36
- font-family: ${({ theme }) => theme.fontFamily};
35
+ box-sizing: border-box;
36
+ font-family: ${({ theme }) => theme.fontFamily};
37
37
 
38
- ${COMMON}
39
- ${BORDER}
40
- ${LAYOUT}
41
- ${POSITION}
42
- ${FLEXBOX}
43
- ${GRID}
44
- `;
38
+ ${COMMON}
39
+ ${BORDER}
40
+ ${LAYOUT}
41
+ ${POSITION}
42
+ ${FLEXBOX}
43
+ ${GRID}
44
+ `;
45
45
 
46
46
  export default Container;
@@ -23,7 +23,7 @@ exports[`Racine Button should render in active state 1`] = `
23
23
  padding: 8px;
24
24
  font-size: 13px;
25
25
  color: #FFFFFF !important;
26
- background: #364141 !important;
26
+ background: #273333 !important;
27
27
  }
28
28
 
29
29
  .c0:visited {
@@ -40,7 +40,7 @@ exports[`Racine Button should render in active state 1`] = `
40
40
 
41
41
  .c0:active {
42
42
  color: #FFFFFF;
43
- background: #364141;
43
+ background: #273333;
44
44
  -webkit-transform: translateY(1px);
45
45
  -ms-transform: translateY(1px);
46
46
  transform: translateY(1px);
@@ -257,7 +257,7 @@ exports[`Racine Button should render in large size 1`] = `
257
257
 
258
258
  .c0:active {
259
259
  color: #FFFFFF;
260
- background: #364141;
260
+ background: #273333;
261
261
  -webkit-transform: translateY(1px);
262
262
  -ms-transform: translateY(1px);
263
263
  transform: translateY(1px);
@@ -475,7 +475,7 @@ exports[`Racine Button should render in secondary style 1`] = `
475
475
 
476
476
  .c0:active {
477
477
  color: #FFFFFF;
478
- background: #364141;
478
+ background: #273333;
479
479
  -webkit-transform: translateY(1px);
480
480
  -ms-transform: translateY(1px);
481
481
  transform: translateY(1px);
@@ -6,12 +6,14 @@ export type TypeProps = {
6
6
  /** If the button is being used as an anchor, this prop will cause the link to open in a new tab. */
7
7
  external?: boolean,
8
8
  size?: "large" | "default",
9
+ /** What the button looks like. "default" is deprecated in favor of "unstyled" */
9
10
  appearance?:
10
11
  | "primary"
11
12
  | "secondary"
12
13
  | "pill"
13
14
  | "destructive"
14
15
  | "default"
16
+ | "unstyled"
15
17
  | "placeholder",
16
18
  /** Set the button to display in its active state */
17
19
  active?: boolean,
@@ -33,7 +35,7 @@ export type TypeProps = {
33
35
 
34
36
  const Button = ({
35
37
  href,
36
- appearance = "default",
38
+ appearance = "unstyled",
37
39
  active = false,
38
40
  disabled,
39
41
  external,
@@ -53,6 +55,9 @@ const Button = ({
53
55
  );
54
56
  }
55
57
 
58
+ // plans to properly deprecate captured in DS-1096
59
+ const appearanceCheck = appearance === "default" ? "unstyled" : appearance;
60
+
56
61
  return (
57
62
  <Container
58
63
  title={title}
@@ -65,7 +70,7 @@ const Button = ({
65
70
  aria-disabled={disabled ? disabled : undefined}
66
71
  disabled={disabled}
67
72
  buttonSize={size}
68
- appearance={appearance}
73
+ appearance={appearanceCheck}
69
74
  ref={innerRef}
70
75
  onClick={onClick}
71
76
  data-qa-button={title || ""}
@@ -9,7 +9,12 @@ export default {
9
9
  };
10
10
 
11
11
  export const defaultStory = () => (
12
- <Button onClick={() => alert("Testing...")}>Default</Button>
12
+ <Button
13
+ appearance={text("appearance", "default")}
14
+ onClick={() => alert("Testing...")}
15
+ >
16
+ Default
17
+ </Button>
13
18
  );
14
19
 
15
20
  defaultStory.story = {
@@ -12,12 +12,13 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
12
12
  text-align: center;
13
13
  font-family: ${(props) => props.theme.fontFamily};
14
14
  border: 1px solid
15
- ${(props) => props.theme.colors.cta[props.appearance].borderColor};
15
+ ${(props) => props.theme.colors.button[props.appearance].border.base};
16
16
  border-radius: ${(props) => props.theme.radii[500]};
17
17
  border-style: ${(props) =>
18
18
  props.appearance === "placeholder" ? "dashed" : "solid"};
19
- background: ${(props) => props.theme.colors.cta[props.appearance].background};
20
- color: ${(props) => props.theme.colors.cta[props.appearance].color};
19
+ background: ${(props) =>
20
+ props.theme.colors.button[props.appearance].background.base};
21
+ color: ${(props) => props.theme.colors.button[props.appearance].text.base};
21
22
  cursor: pointer;
22
23
  text-decoration: none;
23
24
  /**
@@ -41,22 +42,22 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
41
42
  : props.theme.typography[300].fontSize};
42
43
 
43
44
  &:visited {
44
- color: ${(props) => props.theme.colors.cta[props.appearance].color};
45
+ color: ${(props) => props.theme.colors.button[props.appearance].text.base};
45
46
  }
46
47
 
47
48
  &:hover {
48
- color: ${(props) => props.theme.colors.cta[props.appearance].hoverColor};
49
+ color: ${(props) => props.theme.colors.button[props.appearance].text.hover};
49
50
  background: ${(props) =>
50
- props.theme.colors.cta[props.appearance].hoverBackground};
51
+ props.theme.colors.button[props.appearance].background.hover};
51
52
  text-decoration: none;
52
53
  box-shadow: ${(props) =>
53
54
  props.appearance === "placeholder" ? props.theme.shadows[100] : "none"};
54
55
  }
55
56
 
56
57
  &:active {
57
- color: ${(props) => props.theme.colors.cta[props.appearance].hoverColor};
58
+ color: ${(props) => props.theme.colors.button[props.appearance].text.hover};
58
59
  background: ${(props) =>
59
- props.theme.colors.cta[props.appearance].activeBackground};
60
+ props.theme.colors.button[props.appearance].background.active};
60
61
  transform: translateY(1px);
61
62
  }
62
63
 
@@ -71,9 +72,10 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
71
72
  ${(props) =>
72
73
  props.active &&
73
74
  css`
74
- color: ${props.theme.colors.cta[props.appearance].hoverColor} !important;
75
- background: ${props.theme.colors.cta[props.appearance]
76
- .activeBackground} !important;
75
+ color: ${props.theme.colors.button[props.appearance].text
76
+ .hover} !important;
77
+ background: ${props.theme.colors.button[props.appearance].background
78
+ .active} !important;
77
79
  `}
78
80
 
79
81
  ${(props) => props.disabled && disabled}
@@ -84,7 +86,8 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
84
86
  display: inline-flex;
85
87
  align-items: center;
86
88
  justify-content: center;
87
- mix-blend-mode: multiply;
89
+ /* This solution is temporary. DS-1095 */
90
+ mix-blend-mode: ${props.theme.mode ? "screen" : "multiply"};
88
91
 
89
92
  ${pill}
90
93
  `}
@@ -98,3 +101,5 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
98
101
  `;
99
102
 
100
103
  export default Container;
104
+
105
+ //${props.theme.mode === "dark" ? "screen" : "multiply"}
@@ -26,9 +26,9 @@ const Card = ({
26
26
  ariaLabel,
27
27
  buttonProps = {},
28
28
  border = 500,
29
- borderColor = "border",
29
+ borderColor = "container.border.base",
30
30
  color = "text.body",
31
- bg = "background.container",
31
+ bg = "container.background.base",
32
32
  ...rest
33
33
  }: TypeProps) => {
34
34
  return (
@@ -12,7 +12,7 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.div`
12
12
  font-variant-numeric: tabular-nums;
13
13
  color: ${(props) =>
14
14
  props.overlimit
15
- ? props.theme.colors.error.color
15
+ ? props.theme.colors.text.error
16
16
  : props.theme.colors.text.subtext};
17
17
 
18
18
  ${(p) =>
@@ -25,13 +25,13 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.div`
25
25
  ${(props) =>
26
26
  props.inline &&
27
27
  css`
28
- display: flex;
29
- justify-content: center;
28
+ display: flex;
29
+ justify-content: center;
30
30
 
31
- ${Label} + ${Label} {
32
- margin-left: ${(props) => props.theme.space[450]};
33
- }
34
- `}
31
+ ${Label} + ${Label} {
32
+ margin-left: ${(props) => props.theme.space[450]};
33
+ }
34
+ `}
35
35
 
36
36
  ${COMMON}
37
37
  ${LAYOUT}
@@ -34,11 +34,12 @@ export const InputWrapper = styled<typeof Box, TypeTheme, any>(Box)`
34
34
  background-color: transparent;
35
35
  transition: all ${(props) => props.theme.duration.fast}
36
36
  ${(props) => props.theme.easing.ease_inout};
37
- mix-blend-mode: multiply;
37
+ /* This solution is temporary. DS-1095 */
38
+ mix-blend-mode: ${props.theme.mode ? "screen" : "multiply"};
38
39
  ${pill}
39
40
 
40
41
  &:hover {
41
- background-color: ${props.theme.colors.background.app};
42
+ background-color: ${props.theme.colors.app.background.base};
42
43
  }
43
44
 
44
45
  ${PillInput} {
@@ -54,9 +55,9 @@ export const CheckboxBox: StyledComponent<{ ... }, TypeTheme, *> = styled.div`
54
55
  position: relative;
55
56
  width: ${(props) => props.theme.space[400]};
56
57
  height: ${(props) => props.theme.space[400]};
57
- border: 1px solid ${(props) => props.theme.colors.forms.borderColor};
58
+ border: 1px solid ${(props) => props.theme.colors.form.border.base};
58
59
  border-radius: 4px;
59
- background-color: ${(props) => props.theme.colors.background.container};
60
+ background-color: ${(props) => props.theme.colors.form.background.base};
60
61
  transition: border-color ${(props) => props.theme.duration.fast}
61
62
  ${(props) => props.theme.easing.ease_in},
62
63
  background-color ${(props) => props.theme.duration.fast}
@@ -116,7 +117,7 @@ export const PillInput: StyledComponent<any, TypeTheme, *> = styled.input`
116
117
  &:focus {
117
118
  ~ ${CheckboxBox} ${CheckIcon} {
118
119
  opacity: ${(props) => (props.disabled ? 0 : 1)};
119
- color: ${props.theme.colors.forms.borderColor};
120
+ color: ${props.theme.colors.form.border.base};
120
121
  }
121
122
  }
122
123
  `}
@@ -125,8 +126,8 @@ export const PillInput: StyledComponent<any, TypeTheme, *> = styled.input`
125
126
  props.checked &&
126
127
  css`
127
128
  ~ ${CheckboxBox} {
128
- border-color: ${props.theme.colors.selection.border};
129
- background-color: ${props.theme.colors.selection.background};
129
+ border-color: ${props.theme.colors.form.border.selected};
130
+ background-color: ${props.theme.colors.form.background.selected};
130
131
  }
131
132
  ~ ${CheckboxBox} ${CheckIcon} {
132
133
  opacity: 1;
@@ -195,8 +196,8 @@ export const CheckboxContainer: StyledComponent<any, TypeTheme, *> = styled.span
195
196
  props.indeterminate ? "indeterminate" : "check",
196
197
 
197
198
  props.checked
198
- ? props.theme.colors.background.container
199
- : props.theme.colors.forms.borderColor
199
+ ? props.theme.colors.form.background.base
200
+ : props.theme.colors.form.border.base
200
201
  )}");
201
202
  opacity: ${props.checked ? 1 : 0};
202
203
  position: absolute;
@@ -227,9 +228,9 @@ export const CheckboxContainer: StyledComponent<any, TypeTheme, *> = styled.span
227
228
  padding: 0;
228
229
  width: ${props.theme.space[400]};
229
230
  height: ${props.theme.space[400]};
230
- border: 1px solid ${props.theme.colors.forms.borderColor};
231
+ border: 1px solid ${props.theme.colors.form.border.base};
231
232
  border-radius: 4px;
232
- background-color: ${props.theme.colors.background.container};
233
+ background-color: ${props.theme.colors.form.background.base};
233
234
  transition: all ${props.theme.duration.fast}
234
235
  ${props.theme.easing.ease_in};
235
236
  cursor: ${props.disabled ? "not-allowed" : "pointer"};
@@ -240,20 +241,21 @@ export const CheckboxContainer: StyledComponent<any, TypeTheme, *> = styled.span
240
241
  css`
241
242
  border-color: ${props.theme.colors
242
243
  .neutral[300]} !important; /* We don't want the focus ring to remove the border */
243
- background-color: ${props.theme.colors.background.container};
244
+ background-color: ${props.theme.colors.form.background.base};
244
245
  `}
245
246
  }
246
247
 
247
248
  &:checked {
248
- border-color: ${props.theme.colors.selection.border};
249
- background-color: ${props.theme.colors.selection.background};
249
+ border-color: ${props.theme.colors.form.border.selected};
250
+ background-color: ${props.theme.colors.form.background.selected};
250
251
  }
251
252
 
252
253
  ${props.indeterminate &&
253
254
  props.checked &&
254
255
  css`
255
- border-color: ${props.theme.colors.selection.border} !important;
256
- background-color: ${props.theme.colors.selection} !important;
256
+ border-color: ${props.theme.colors.form.border.selected} !important;
257
+ background-color: ${props.theme.colors.form.background
258
+ .selected} !important;
257
259
  `}
258
260
 
259
261
  &:focus {
@@ -11,8 +11,6 @@ type TypeCollapsibleContext = $Shape<{
11
11
  isOpen: boolean,
12
12
  id: string,
13
13
  offset: number,
14
- openHeight: number,
15
- collapsedHeight: number,
16
14
  }>;
17
15
 
18
16
  const CollapsibleContext = React.createContext<TypeCollapsibleContext>({});
@@ -22,23 +20,13 @@ type TypeProps = {
22
20
  children: React.Node,
23
21
  /** If the children of the collapsible panel have a top or bottom margin, it will throw off the calculations for the height of the content. The total amount of vertical margin (in pixels) can be supplied to this prop to correct this. */
24
22
  offset?: number,
25
- collapsedHeight?: number,
26
- openHeight?: number,
27
23
  };
28
24
 
29
- const Collapsible = ({
30
- children,
31
- isOpen = false,
32
- offset = 0,
33
- collapsedHeight = 0,
34
- openHeight,
35
- }: TypeProps) => {
25
+ const Collapsible = ({ children, isOpen = false, offset = 0 }: TypeProps) => {
36
26
  const [id] = useState(`Racine-collapsible-${idCounter++}`);
37
27
 
38
28
  return (
39
- <CollapsibleContext.Provider
40
- value={{ isOpen, id, offset, collapsedHeight, openHeight }}
41
- >
29
+ <CollapsibleContext.Provider value={{ isOpen, id, offset }}>
42
30
  {children}
43
31
  </CollapsibleContext.Provider>
44
32
  );
@@ -59,9 +47,7 @@ const Trigger = ({ children, ...rest }) => {
59
47
  };
60
48
 
61
49
  const Panel = ({ children, ...rest }) => {
62
- const { isOpen, id, offset, collapsedHeight, openHeight } = useContext(
63
- CollapsibleContext
64
- );
50
+ const { isOpen, id, offset } = useContext(CollapsibleContext);
65
51
  const ref = useRef();
66
52
  const measurement = useMeasure(ref);
67
53
  const [isHidden, setIsHidden] = useState(undefined);
@@ -71,9 +57,7 @@ const Panel = ({ children, ...rest }) => {
71
57
  // This prevents an initial expansion animation if a component starts out open
72
58
  // There is no animation because css is not changing the maxHeight property after mount
73
59
  const maxHeight =
74
- typeof openHeight !== "undefined"
75
- ? openHeight
76
- : measurement.height + offset;
60
+ isHidden === undefined ? undefined : measurement.height + offset;
77
61
 
78
62
  /* We use the "hidden" attribute to remove the contents of the panel from the tab order of the page, but it fucks with the animation. This logic sets a slight timeout on setting the prop so that the animation has time to complete before the attribute is set. */
79
63
  useEffect(() => {
@@ -92,16 +76,14 @@ const Panel = ({ children, ...rest }) => {
92
76
 
93
77
  return (
94
78
  <CollapsingBox
95
- scrollable={isOpen}
96
- maxHeight={isOpen ? maxHeight : collapsedHeight}
97
- minHeight={collapsedHeight}
79
+ maxHeight={isOpen ? maxHeight : "0"}
98
80
  data-qa-collapsible={""}
99
81
  data-qa-collapsible-isopen={isOpen === true}
100
82
  {...rest}
101
83
  >
102
84
  <Box
103
85
  width="100%"
104
- hidden={isHidden && collapsedHeight === 0}
86
+ hidden={isHidden}
105
87
  aria-hidden={!isOpen}
106
88
  id={id}
107
89
  ref={ref}
@@ -26,7 +26,7 @@ export default {
26
26
 
27
27
  export const defaultStory = () => (
28
28
  <StatefulCollapse>
29
- <Box width="100%" height="200px" bg="neutral.200" p={400}>
29
+ <Box width="100%" height="200px" bg="container.background.base" p={400}>
30
30
  <Button appearance="secondary">A button</Button>
31
31
  </Box>
32
32
  </StatefulCollapse>
@@ -38,7 +38,7 @@ defaultStory.story = {
38
38
 
39
39
  export const initialIsOpen = () => (
40
40
  <StatefulCollapse initialIsOpen>
41
- <Box width="100%" height="200px" bg="neutral.200" p={400}>
41
+ <Box width="100%" height="200px" bg="container.background.base" p={400}>
42
42
  <Button appearance="secondary">A button</Button>
43
43
  </Box>
44
44
  </StatefulCollapse>
@@ -50,7 +50,13 @@ initialIsOpen.story = {
50
50
 
51
51
  export const withOffset = () => (
52
52
  <StatefulCollapse offset={100}>
53
- <Box width="100%" height="200px" bg="neutral.200" p={400} mt="100px">
53
+ <Box
54
+ width="100%"
55
+ height="200px"
56
+ bg="container.background.base"
57
+ p={400}
58
+ mt="100px"
59
+ >
54
60
  <Button appearance="secondary">A button</Button>
55
61
  </Box>
56
62
  </StatefulCollapse>
@@ -62,7 +68,7 @@ withOffset.story = {
62
68
 
63
69
  export const withShortContent = () => (
64
70
  <StatefulCollapse>
65
- <Box width="15%" height="50px" bg="neutral.200" p={400}>
71
+ <Box width="15%" height="50px" bg="container.background.base" p={400}>
66
72
  Hello.
67
73
  </Box>
68
74
  </StatefulCollapse>
@@ -74,7 +80,7 @@ withShortContent.story = {
74
80
 
75
81
  export const withTallContent = () => (
76
82
  <StatefulCollapse>
77
- <Box width="15%" height="200vh" bg="neutral.200" p={400}>
83
+ <Box width="15%" height="200vh" bg="container.background.base" p={400}>
78
84
  Hello.
79
85
  </Box>
80
86
  </StatefulCollapse>
@@ -83,80 +89,3 @@ export const withTallContent = () => (
83
89
  withTallContent.story = {
84
90
  name: "With tall content",
85
91
  };
86
-
87
- const StatefulCollapseWithMinHeight = ({
88
- children,
89
- offset = 0,
90
- collapsedHeight = 0,
91
- openHeight,
92
- }) => {
93
- const [open, setOpen] = useState(false);
94
- const toggle = () => setOpen(!open);
95
-
96
- return (
97
- <Collapsible
98
- id="test-id-1"
99
- isOpen={open}
100
- offset={offset}
101
- openHeight={openHeight}
102
- collapsedHeight={collapsedHeight}
103
- >
104
- <Collapsible.Panel>{children}</Collapsible.Panel>
105
- <Collapsible.Trigger>
106
- <Button onClick={toggle}>{open ? "Show Less" : "Show More"}</Button>
107
- </Collapsible.Trigger>
108
- </Collapsible>
109
- );
110
- };
111
-
112
- export const withCollapsedHeight = () => {
113
- return (
114
- <StatefulCollapseWithMinHeight collapsedHeight={100} openHeight={300}>
115
- <Box width="500px" p={400}>
116
- Threepio! Come in, Threepio! Threepio! Get to the top! I can’t Where
117
- could he be? Threepio! Threepio, will you come in? They aren’t here!
118
- Something must have happened to them. See if they’ve been captured.
119
- Hurry! One thing’s for sure. We’re all going to be a lot thinner! Get on
120
- top of it! I’m trying! Thank goodness, they haven’t found them! Where
121
- could they be? Use the comlink? Oh, my! I forgot I turned it off! Are
122
- you there, sir? Threepio! We’ve had some problems… Will you shut up and
123
- listen to me? Shut down all garbage mashers on the detention level, will
124
- you? Do you copy? Shut down all the garbage mashers on the detention
125
- level. Shut down all the garbage mashers on the detention level. No.
126
- Shut them all down! Hurry! Listen to them! They’re dying, Artoo! Curse
127
- my metal body! I wasn’t fast enough. It’s all my fault! My poor master!
128
- Threepio, we’re all right! We’re all right. You did great. Threepio!
129
- Come in, Threepio! Threepio! Get to the top! I can’t Where could he be?
130
- Threepio! Threepio, will you come in? They aren’t here! Something must
131
- have happened to them. See if they’ve been captured. Hurry! One thing’s
132
- for sure. We’re all going to be a lot thinner! Get on top of it! I’m
133
- trying! Thank goodness, they haven’t found them! Where could they be?
134
- Use the comlink? Oh, my! I forgot I turned it off! Are you there, sir?
135
- Threepio! We’ve had some problems… Will you shut up and listen to me?
136
- Shut down all garbage mashers on the detention level, will you? Do you
137
- copy? Shut down all the garbage mashers on the detention level. Shut
138
- down all the garbage mashers on the detention level. No. Shut them all
139
- down! Hurry! Listen to them! They’re dying, Artoo! Curse my metal body!
140
- I wasn’t fast enough. It’s all my fault! My poor master! Threepio, we’re
141
- all right! We’re all right. You did great. Threepio! Come in, Threepio!
142
- Threepio! Get to the top! I can’t Where could he be? Threepio! Threepio,
143
- will you come in? They aren’t here! Something must have happened to
144
- them. See if they’ve been captured. Hurry! One thing’s for sure. We’re
145
- all going to be a lot thinner! Get on top of it! I’m trying! Thank
146
- goodness, they haven’t found them! Where could they be? Use the comlink?
147
- Oh, my! I forgot I turned it off! Are you there, sir? Threepio! We’ve
148
- had some problems… Will you shut up and listen to me? Shut down all
149
- garbage mashers on the detention level, will you? Do you copy? Shut down
150
- all the garbage mashers on the detention level. Shut down all the
151
- garbage mashers on the detention level. No. Shut them all down! Hurry!
152
- Listen to them! They’re dying, Artoo! Curse my metal body! I wasn’t fast
153
- enough. It’s all my fault! My poor master! Threepio, we’re all right!
154
- We’re all right. You did great.
155
- </Box>
156
- </StatefulCollapseWithMinHeight>
157
- );
158
- };
159
-
160
- withCollapsedHeight.story = {
161
- name: "With collapsedHeight",
162
- };