@sproutsocial/racine 8.5.1 → 8.6.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/__flow__/Collapsible/index.js +40 -11
  3. package/__flow__/Collapsible/index.stories.js +77 -0
  4. package/__flow__/Collapsible/styles.js +28 -2
  5. package/__flow__/Listbox/__snapshots__/index.test.js.snap +84 -42
  6. package/__flow__/Listbox/index.stories.js +33 -0
  7. package/__flow__/Listbox/index.test.js +52 -2
  8. package/__flow__/Menu/__snapshots__/index.test.js.snap +4 -0
  9. package/__flow__/Menu/hooks.js +8 -3
  10. package/__flow__/Menu/index.flow.js +1 -0
  11. package/__flow__/Menu/index.js +31 -4
  12. package/__flow__/Menu/index.stories.js +20 -0
  13. package/__flow__/Menu/styles.js +4 -0
  14. package/__flow__/dataviz/dataviz.stories.js +12 -0
  15. package/__flow__/dataviz/index.js +13 -0
  16. package/__flow__/themes/dark/dataviz-palette.js +50 -0
  17. package/__flow__/themes/dark/theme.js +2 -0
  18. package/__flow__/themes/default/dataviz-palette.js +50 -0
  19. package/__flow__/themes/default/theme.js +2 -0
  20. package/commonjs/Collapsible/index.js +28 -11
  21. package/commonjs/Collapsible/styles.js +8 -1
  22. package/commonjs/Menu/hooks.js +12 -3
  23. package/commonjs/Menu/index.js +26 -6
  24. package/commonjs/Menu/styles.js +4 -2
  25. package/commonjs/dataviz/index.js +24 -0
  26. package/commonjs/themes/dark/dataviz-palette.js +35 -0
  27. package/commonjs/themes/dark/theme.js +3 -1
  28. package/commonjs/themes/default/dataviz-palette.js +35 -0
  29. package/commonjs/themes/default/theme.js +3 -1
  30. package/lib/Collapsible/index.js +28 -11
  31. package/lib/Collapsible/styles.js +8 -1
  32. package/lib/Menu/hooks.js +12 -3
  33. package/lib/Menu/index.js +26 -6
  34. package/lib/Menu/styles.js +4 -2
  35. package/lib/dataviz/index.js +13 -0
  36. package/lib/themes/dark/dataviz-palette.js +26 -0
  37. package/lib/themes/dark/theme.js +2 -1
  38. package/lib/themes/default/dataviz-palette.js +26 -0
  39. package/lib/themes/default/theme.js +2 -1
  40. package/package.json +3 -2
@@ -1,5 +1,10 @@
1
1
  import React from "react";
2
- import { render, fireEvent, cleanup } from "../utils/react-testing-library";
2
+ import {
3
+ render,
4
+ fireEvent,
5
+ cleanup,
6
+ userEvent,
7
+ } from "../utils/react-testing-library";
3
8
  import Listbox, { ListboxButton } from "./";
4
9
  import { useSelect, useMultiselect } from "../utils/hooks";
5
10
  import { MENU_ITEM_ROLES } from "../Menu/constants";
@@ -16,6 +21,7 @@ const lotsOfFruit = [
16
21
  "Jackalope",
17
22
  "Lingonberry",
18
23
  "Dingleberry",
24
+ "Kaffir Lime",
19
25
  ];
20
26
  const mockOnClick = jest.fn();
21
27
 
@@ -182,6 +188,26 @@ describe("Listbox", () => {
182
188
  expect(await findByText(fruit[1])).toBeInTheDocument();
183
189
  expect(mockOnClick).toHaveBeenCalledTimes(1);
184
190
  });
191
+
192
+ it("should trigger select on enter", async () => {
193
+ const { findByText, queryByLabelText } = render(<AsListbox />);
194
+ const button = queryByLabelText(/Select a fruit/);
195
+
196
+ fireEvent.click(button);
197
+ userEvent.keyboard("{enter}");
198
+ expect(await findByText(fruit[0])).toBeInTheDocument();
199
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
200
+ });
201
+
202
+ it("should trigger select on space", async () => {
203
+ const { findByText, queryByLabelText } = render(<AsListbox />);
204
+ const button = queryByLabelText(/Select a fruit/);
205
+
206
+ fireEvent.click(button);
207
+ userEvent.keyboard("{space}");
208
+ expect(await findByText(fruit[0])).toBeInTheDocument();
209
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
210
+ });
185
211
  });
186
212
 
187
213
  describe("AsListbox multiselect", () => {
@@ -252,9 +278,33 @@ describe("Listbox", () => {
252
278
  <AsListboxWithFilterInput />
253
279
  );
254
280
  const input = queryByLabelText("Search fruit...");
255
- expect(queryAllByRole("menuitemcheckbox")).toHaveLength(10);
281
+ expect(queryAllByRole("menuitemcheckbox")).toHaveLength(11);
256
282
  fireEvent.change(input, { target: { value: "berry" } });
257
283
  expect(queryAllByRole("menuitemcheckbox")).toHaveLength(2);
258
284
  });
285
+
286
+ it("should allow spaces to be typed in the input", async () => {
287
+ const { queryByLabelText, queryAllByRole } = render(
288
+ <AsListboxWithFilterInput />
289
+ );
290
+
291
+ const input = queryByLabelText("Search fruit...");
292
+ userEvent.type(input, "Kaffir{space}L");
293
+ expect(queryAllByRole("menuitemcheckbox")).toHaveLength(1);
294
+ });
295
+
296
+ it("should trigger a submit on space if the input is not focused", async () => {
297
+ const { queryByRole } = render(<AsListboxWithFilterInput />);
298
+
299
+ // tab focus away from input
300
+ userEvent.tab();
301
+ userEvent.keyboard("{space}");
302
+ const firstItem = queryByRole(MENU_ITEM_ROLES.CHECKBOX, {
303
+ name: fruit[0],
304
+ });
305
+
306
+ expect(firstItem).toHaveAttribute("aria-checked", "true");
307
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
308
+ });
259
309
  });
260
310
  });
@@ -70,6 +70,10 @@ exports[`Menu AsMenu should match snapshot 1`] = `
70
70
  background-color: #364141;
71
71
  }
72
72
 
73
+ .c6 .Icon-svg {
74
+ color: #FFFFFF;
75
+ }
76
+
73
77
  .c6:focus,
74
78
  .c6:hover {
75
79
  color: #364141;
@@ -24,6 +24,7 @@ export const MenuContext = createContext<TypeMenuContext>({
24
24
  selectionIndex: 0,
25
25
  filterQuery: "",
26
26
  filteredItems: null,
27
+ isFilterInputFocused: false,
27
28
  },
28
29
  setState: () => {},
29
30
  selectCallbacks: {
@@ -75,7 +76,7 @@ export function useMenuKeyDown() {
75
76
  selectCallbacks,
76
77
  setState,
77
78
  multiselect,
78
- state: { filterQuery, selectionIndex, filteredItems },
79
+ state: { filterQuery, selectionIndex, filteredItems, isFilterInputFocused },
79
80
  } = useContext(MenuContext);
80
81
  const { closePopout, closeOnItemClick } = useContext(MenuButtonContext);
81
82
  const { descendants: items } = useContext(MenuDescendantContext);
@@ -142,10 +143,14 @@ export function useMenuKeyDown() {
142
143
  handleKeyDown: wrapEvent<SyntheticKeyboardEvent<>>(
143
144
  function (event) {
144
145
  const { key } = event;
145
-
146
146
  switch (key) {
147
- case "Enter":
148
147
  case " ":
148
+ if (isFilterInputFocused) {
149
+ return;
150
+ }
151
+ // falls through
152
+ // eslint-disable-next-line no-fallthrough
153
+ case "Enter":
149
154
  const selected = items[selectionIndex];
150
155
 
151
156
  if (selected) {
@@ -12,6 +12,7 @@ export type TypeMenuState = {|
12
12
  selectionIndex: number,
13
13
  filterQuery: string,
14
14
  filteredItems: ?(number[]),
15
+ isFilterInputFocused: boolean,
15
16
  |};
16
17
 
17
18
  export type TypeMenuSharedProps = {|
@@ -308,14 +308,40 @@ export const MenuDivider = (props: any) => (
308
308
  );
309
309
 
310
310
  const MenuFilterInput = (props: React$ElementConfig<typeof Input>) => {
311
+ const { onChange, onFocus, onBlur } = props;
311
312
  const { state, setState } = useContext(MenuContext);
312
- const updateFilterQuery = useCallback(
313
- (event) => setState({ filterQuery: event.currentTarget.value }),
314
- [setState]
313
+ const handleOnChange = useCallback(
314
+ (event, value) => {
315
+ onChange && onChange(event, value);
316
+ setState({ filterQuery: value });
317
+ },
318
+ [setState, onChange]
319
+ );
320
+
321
+ const handleOnFocus = useCallback(
322
+ (event) => {
323
+ onFocus && onFocus(event);
324
+ setState({ isFilterInputFocused: true });
325
+ },
326
+ [setState, onFocus]
327
+ );
328
+
329
+ const handleOnBlur = useCallback(
330
+ (event) => {
331
+ onBlur && onBlur(event);
332
+ setState({ isFilterInputFocused: false });
333
+ },
334
+ [setState, onBlur]
315
335
  );
316
336
 
317
337
  return (
318
- <Input {...props} value={state.filterQuery} onChange={updateFilterQuery} />
338
+ <Input
339
+ {...props}
340
+ value={state.filterQuery}
341
+ onChange={handleOnChange}
342
+ onFocus={handleOnFocus}
343
+ onBlur={handleOnBlur}
344
+ />
319
345
  );
320
346
  };
321
347
 
@@ -364,6 +390,7 @@ export const Menu = ({
364
390
  selectionIndex: 0,
365
391
  filterQuery: "",
366
392
  filteredItems: null,
393
+ isFilterInputFocused: false,
367
394
  });
368
395
  const selectCallbacks = useRef<(?(() => void))[]>([]);
369
396
  const menuRef = useRef(null);
@@ -203,3 +203,23 @@ export const MenuWithCheckboxes = (props) => {
203
203
  </Menu>
204
204
  );
205
205
  };
206
+
207
+ // Specifically testing that icons with a color inverse when active like the text does.
208
+ export const MenuWithIcons = (props) => {
209
+ return (
210
+ <Menu width="200px" {...props}>
211
+ <Menu.Item key="positive" onClick={() => alert("positive")}>
212
+ <Icon name="flat-positive-sentiment" mr={200} color="blue.600" />
213
+ Positive
214
+ </Menu.Item>
215
+ <Menu.Item key="negative" onClick={() => alert("negative")}>
216
+ <Icon name="flat-negative-sentiment" mr={200} color="red.500" />
217
+ Negative
218
+ </Menu.Item>
219
+ <Menu.Item key="neutral" onClick={() => alert("neutral")}>
220
+ <Icon name="flat-neutral-sentiment" mr={200} />
221
+ Neutral
222
+ </Menu.Item>
223
+ </Menu>
224
+ );
225
+ };
@@ -41,6 +41,10 @@ export const MenuItemContainer = styled<
41
41
  css`
42
42
  color: ${(props) => props.theme.colors.text.inverse};
43
43
  background-color: ${props.theme.colors.listItem.background.selected};
44
+
45
+ .Icon-svg {
46
+ color: ${(props) => props.theme.colors.text.inverse};
47
+ }
44
48
  `}
45
49
 
46
50
  ${(props) =>
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { DataVizRotation } from ".";
3
+
4
+ export default {
5
+ title: "Dataviz color rotation",
6
+ };
7
+
8
+ export const JSdataviz = () => <DataVizRotation />;
9
+
10
+ JSdataviz.story = {
11
+ name: "JS dataviz rotation",
12
+ };
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import Box from "../Box";
3
+ import { withTheme } from "styled-components";
4
+
5
+ export const DataVizRotation = withTheme((p) => {
6
+ return p.theme.colors.DATAVIZ_COLORS_LIST.map((color, i) => {
7
+ return (
8
+ <Box key={color} py={300} px={400} bg={color}>
9
+ {i + 1}
10
+ </Box>
11
+ );
12
+ });
13
+ });
@@ -0,0 +1,50 @@
1
+ // @flow strict-local
2
+
3
+ import COLORS from "@sproutsocial/seeds-color";
4
+
5
+ export const datavizPalette = {
6
+ DATAVIZ_COLORS_LIST: [
7
+ COLORS.COLOR_TEAL_400,
8
+ COLORS.COLOR_PURPLE_400,
9
+ COLORS.COLOR_PINK_400,
10
+ COLORS.COLOR_YELLOW_500,
11
+ COLORS.COLOR_BLUE_400,
12
+ COLORS.COLOR_MAGENTA_400,
13
+ COLORS.COLOR_GREEN_400,
14
+ COLORS.COLOR_ORANGE_400,
15
+ COLORS.COLOR_RED_700,
16
+ COLORS.COLOR_TEAL_700,
17
+ COLORS.COLOR_PURPLE_700,
18
+ COLORS.COLOR_PINK_700,
19
+ COLORS.COLOR_YELLOW_800,
20
+ COLORS.COLOR_BLUE_700,
21
+ COLORS.COLOR_MAGENTA_700,
22
+ COLORS.COLOR_GREEN_700,
23
+ COLORS.COLOR_ORANGE_700,
24
+ COLORS.COLOR_RED_400,
25
+ COLORS.COLOR_GREEN_200,
26
+ COLORS.COLOR_YELLOW_200,
27
+ ],
28
+ DATAVIZ_COLORS_MAP: {
29
+ "1": COLORS.COLOR_TEAL_400,
30
+ "2": COLORS.COLOR_PURPLE_400,
31
+ "3": COLORS.COLOR_PINK_400,
32
+ "4": COLORS.COLOR_YELLOW_500,
33
+ "5": COLORS.COLOR_BLUE_400,
34
+ "6": COLORS.COLOR_MAGENTA_400,
35
+ "7": COLORS.COLOR_GREEN_400,
36
+ "8": COLORS.COLOR_ORANGE_400,
37
+ "9": COLORS.COLOR_RED_700,
38
+ "10": COLORS.COLOR_TEAL_700,
39
+ "11": COLORS.COLOR_PURPLE_700,
40
+ "12": COLORS.COLOR_PINK_700,
41
+ "13": COLORS.COLOR_YELLOW_800,
42
+ "14": COLORS.COLOR_BLUE_700,
43
+ "15": COLORS.COLOR_MAGENTA_700,
44
+ "16": COLORS.COLOR_GREEN_700,
45
+ "17": COLORS.COLOR_ORANGE_700,
46
+ "18": COLORS.COLOR_RED_400,
47
+ "19": COLORS.COLOR_GREEN_200,
48
+ "20": COLORS.COLOR_YELLOW_200,
49
+ },
50
+ };
@@ -2,6 +2,7 @@
2
2
 
3
3
  import COLORS from "@sproutsocial/seeds-color";
4
4
  import defaultTheme from "../default/theme";
5
+ import { datavizPalette } from "./dataviz-palette";
5
6
  import {
6
7
  green,
7
8
  blue,
@@ -188,6 +189,7 @@ const darkTheme = {
188
189
  selected: COLORS.COLOR_NEUTRAL_0,
189
190
  },
190
191
  },
192
+ ...datavizPalette,
191
193
  },
192
194
  mode: "dark",
193
195
  };
@@ -0,0 +1,50 @@
1
+ // @flow strict-local
2
+
3
+ import COLORS from "@sproutsocial/seeds-color";
4
+
5
+ export const datavizPalette = {
6
+ DATAVIZ_COLORS_LIST: [
7
+ COLORS.COLOR_TEAL_500,
8
+ COLORS.COLOR_PURPLE_700,
9
+ COLORS.COLOR_PINK_700,
10
+ COLORS.COLOR_YELLOW_500,
11
+ COLORS.COLOR_BLUE_500,
12
+ COLORS.COLOR_MAGENTA_500,
13
+ COLORS.COLOR_GREEN_500,
14
+ COLORS.COLOR_ORANGE_500,
15
+ COLORS.COLOR_RED_700,
16
+ COLORS.COLOR_TEAL_900,
17
+ COLORS.COLOR_PURPLE_400,
18
+ COLORS.COLOR_PINK_900,
19
+ COLORS.COLOR_YELLOW_900,
20
+ COLORS.COLOR_BLUE_900,
21
+ COLORS.COLOR_MAGENTA_900,
22
+ COLORS.COLOR_GREEN_900,
23
+ COLORS.COLOR_ORANGE_900,
24
+ COLORS.COLOR_RED_400,
25
+ COLORS.COLOR_GREEN_700,
26
+ COLORS.COLOR_YELLOW_800,
27
+ ],
28
+ DATAVIZ_COLORS_MAP: {
29
+ "1": COLORS.COLOR_TEAL_500,
30
+ "2": COLORS.COLOR_PURPLE_700,
31
+ "3": COLORS.COLOR_PINK_700,
32
+ "4": COLORS.COLOR_YELLOW_500,
33
+ "5": COLORS.COLOR_BLUE_500,
34
+ "6": COLORS.COLOR_MAGENTA_500,
35
+ "7": COLORS.COLOR_GREEN_500,
36
+ "8": COLORS.COLOR_ORANGE_500,
37
+ "9": COLORS.COLOR_RED_700,
38
+ "10": COLORS.COLOR_TEAL_900,
39
+ "11": COLORS.COLOR_PURPLE_400,
40
+ "12": COLORS.COLOR_PINK_900,
41
+ "13": COLORS.COLOR_YELLOW_900,
42
+ "14": COLORS.COLOR_BLUE_900,
43
+ "15": COLORS.COLOR_MAGENTA_900,
44
+ "16": COLORS.COLOR_GREEN_900,
45
+ "17": COLORS.COLOR_ORANGE_900,
46
+ "18": COLORS.COLOR_RED_400,
47
+ "19": COLORS.COLOR_GREEN_700,
48
+ "20": COLORS.COLOR_YELLOW_800,
49
+ },
50
+ };
@@ -2,6 +2,7 @@
2
2
 
3
3
  import COLORS from "@sproutsocial/seeds-color";
4
4
  import literalColors from "./literal-colors";
5
+ import { datavizPalette } from "./dataviz-palette";
5
6
  import {
6
7
  green,
7
8
  blue,
@@ -223,6 +224,7 @@ const colors = {
223
224
  tiktok: NETWORKCOLORS.NETWORK_COLOR_TIKTOK,
224
225
  },
225
226
  ...literalColors,
227
+ ...datavizPalette,
226
228
  };
227
229
 
228
230
  export const typography = {
@@ -29,7 +29,10 @@ var Collapsible = function Collapsible(_ref) {
29
29
  _ref$isOpen = _ref.isOpen,
30
30
  isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
31
31
  _ref$offset = _ref.offset,
32
- offset = _ref$offset === void 0 ? 0 : _ref$offset;
32
+ offset = _ref$offset === void 0 ? 0 : _ref$offset,
33
+ _ref$collapsedHeight = _ref.collapsedHeight,
34
+ collapsedHeight = _ref$collapsedHeight === void 0 ? 0 : _ref$collapsedHeight,
35
+ openHeight = _ref.openHeight;
33
36
 
34
37
  var _useState = (0, React.useState)("Racine-collapsible-" + idCounter++),
35
38
  id = _useState[0];
@@ -38,11 +41,25 @@ var Collapsible = function Collapsible(_ref) {
38
41
  value: {
39
42
  isOpen: isOpen,
40
43
  id: id,
41
- offset: offset
44
+ offset: offset,
45
+ collapsedHeight: collapsedHeight,
46
+ openHeight: openHeight
42
47
  }
43
48
  }, children);
44
49
  };
45
50
 
51
+ var determineMaxHeight = function determineMaxHeight(isHidden, openHeight, computedHeight) {
52
+ // If isHidden is undefined this is the first render. Return undefined so the max-height prop is not added
53
+ // This is a hack to prevent css from animating if it begins in the open state
54
+ // css animates when attribute values change (IE from 0 to another number)
55
+ // css does not animate when simply adding an attribute to an HTML element
56
+ if (isHidden === undefined) return undefined; // If the user has defined an explicit open height, return that as the max height
57
+
58
+ if (!!openHeight) return openHeight; // Otherwise, fallback to the computed height
59
+
60
+ return computedHeight;
61
+ };
62
+
46
63
  var Trigger = function Trigger(_ref2) {
47
64
  var children = _ref2.children,
48
65
  rest = _objectWithoutPropertiesLoose(_ref2, ["children"]);
@@ -64,20 +81,18 @@ var Panel = function Panel(_ref3) {
64
81
  var _useContext2 = (0, React.useContext)(CollapsibleContext),
65
82
  isOpen = _useContext2.isOpen,
66
83
  id = _useContext2.id,
67
- offset = _useContext2.offset;
84
+ offset = _useContext2.offset,
85
+ collapsedHeight = _useContext2.collapsedHeight,
86
+ openHeight = _useContext2.openHeight;
68
87
 
69
88
  var ref = (0, React.useRef)();
70
89
  var measurement = (0, _useMeasure.default)(ref);
71
90
 
72
91
  var _useState2 = (0, React.useState)(undefined),
73
92
  isHidden = _useState2[0],
74
- setIsHidden = _useState2[1]; // If this is the initial render isHidden will be undefined
75
- // When that is the case, set maxHeight to undefined rather than the comptued 0
76
- // This prevents an initial expansion animation if a component starts out open
77
- // There is no animation because css is not changing the maxHeight property after mount
78
-
93
+ setIsHidden = _useState2[1];
79
94
 
80
- var maxHeight = isHidden === undefined ? undefined : measurement.height + offset;
95
+ var maxHeight = determineMaxHeight(isHidden, openHeight, measurement.height + offset);
81
96
  /* 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. */
82
97
 
83
98
  (0, React.useEffect)(function () {
@@ -103,12 +118,14 @@ var Panel = function Panel(_ref3) {
103
118
  }
104
119
  }, [isOpen]);
105
120
  return /*#__PURE__*/React.createElement(_styles.CollapsingBox, _extends({
106
- maxHeight: isOpen ? maxHeight : "0",
121
+ scrollable: isOpen,
122
+ maxHeight: isOpen ? maxHeight : collapsedHeight,
123
+ minHeight: collapsedHeight,
107
124
  "data-qa-collapsible": "",
108
125
  "data-qa-collapsible-isopen": isOpen === true
109
126
  }, rest), /*#__PURE__*/React.createElement(_Box.default, {
110
127
  width: "100%",
111
- hidden: isHidden,
128
+ hidden: isHidden && collapsedHeight === 0,
112
129
  "aria-hidden": !isOpen,
113
130
  id: id,
114
131
  ref: ref
@@ -12,9 +12,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  var CollapsingBox = (0, _styledComponents.default)(_Box.default).withConfig({
13
13
  displayName: "styles__CollapsingBox",
14
14
  componentId: "sc-1xvfbl7-0"
15
- })(["transition:max-height ", " ", ";will-change:max-height;overflow:hidden;"], function (p) {
15
+ })(["transition:max-height ", " ", ";will-change:max-height;position:relative;overflow:auto;background:linear-gradient( ", " 30%,rgba(255,255,255,0) ),linear-gradient( rgba(255,255,255,0),", " 70% ) 0 100%,radial-gradient( farthest-side at 50% 0,rgb(39 51 51 / 5%),rgba(0,0,0,0) ),radial-gradient( farthest-side at 50% 100%,rgb(39 51 51 / 5%),rgba(0,0,0,0) ) 0 100%;background-repeat:no-repeat;background-size:100% 40px,100% 40px,100% 14px,100% 14px;background-attachment:local,local,scroll,scroll;", ";"], function (p) {
16
16
  return p.theme.duration.medium;
17
17
  }, function (p) {
18
18
  return p.theme.easing.ease_inout;
19
+ }, function (p) {
20
+ return p.theme.colors.neutral[100];
21
+ }, function (p) {
22
+ return p.theme.colors.neutral[100];
23
+ }, function (_ref) {
24
+ var scrollable = _ref.scrollable;
25
+ return scrollable ? "overflow: auto" : "overflow: hidden";
19
26
  });
20
27
  exports.CollapsingBox = CollapsingBox;
@@ -25,7 +25,8 @@ var MenuContext = /*#__PURE__*/(0, _react.createContext)({
25
25
  state: {
26
26
  selectionIndex: 0,
27
27
  filterQuery: "",
28
- filteredItems: null
28
+ filteredItems: null,
29
+ isFilterInputFocused: false
29
30
  },
30
31
  setState: function setState() {},
31
32
  selectCallbacks: {
@@ -75,7 +76,8 @@ function useMenuKeyDown() {
75
76
  _useContext$state = _useContext.state,
76
77
  filterQuery = _useContext$state.filterQuery,
77
78
  selectionIndex = _useContext$state.selectionIndex,
78
- filteredItems = _useContext$state.filteredItems;
79
+ filteredItems = _useContext$state.filteredItems,
80
+ isFilterInputFocused = _useContext$state.isFilterInputFocused;
79
81
 
80
82
  var _useContext2 = (0, _react.useContext)(MenuButtonContext),
81
83
  closePopout = _useContext2.closePopout,
@@ -134,8 +136,15 @@ function useMenuKeyDown() {
134
136
  var key = event.key;
135
137
 
136
138
  switch (key) {
137
- case "Enter":
138
139
  case " ":
140
+ if (isFilterInputFocused) {
141
+ return;
142
+ }
143
+
144
+ // falls through
145
+ // eslint-disable-next-line no-fallthrough
146
+
147
+ case "Enter":
139
148
  var selected = items[selectionIndex];
140
149
 
141
150
  if (selected) {
@@ -296,18 +296,37 @@ var MenuDivider = function MenuDivider(props) {
296
296
  exports.MenuDivider = MenuDivider;
297
297
 
298
298
  var MenuFilterInput = function MenuFilterInput(props) {
299
+ var onChange = props.onChange,
300
+ onFocus = props.onFocus,
301
+ onBlur = props.onBlur;
302
+
299
303
  var _useContext3 = (0, React.useContext)(_hooks2.MenuContext),
300
304
  state = _useContext3.state,
301
305
  setState = _useContext3.setState;
302
306
 
303
- var updateFilterQuery = (0, React.useCallback)(function (event) {
304
- return setState({
305
- filterQuery: event.currentTarget.value
307
+ var handleOnChange = (0, React.useCallback)(function (event, value) {
308
+ onChange && onChange(event, value);
309
+ setState({
310
+ filterQuery: value
311
+ });
312
+ }, [setState, onChange]);
313
+ var handleOnFocus = (0, React.useCallback)(function (event) {
314
+ onFocus && onFocus(event);
315
+ setState({
316
+ isFilterInputFocused: true
317
+ });
318
+ }, [setState, onFocus]);
319
+ var handleOnBlur = (0, React.useCallback)(function (event) {
320
+ onBlur && onBlur(event);
321
+ setState({
322
+ isFilterInputFocused: false
306
323
  });
307
- }, [setState]);
324
+ }, [setState, onBlur]);
308
325
  return /*#__PURE__*/React.createElement(_Input.default, _extends({}, props, {
309
326
  value: state.filterQuery,
310
- onChange: updateFilterQuery
327
+ onChange: handleOnChange,
328
+ onFocus: handleOnFocus,
329
+ onBlur: handleOnBlur
311
330
  }));
312
331
  };
313
332
 
@@ -353,7 +372,8 @@ var Menu = function Menu(_ref4) {
353
372
  var _useState = (0, React.useState)({
354
373
  selectionIndex: 0,
355
374
  filterQuery: "",
356
- filteredItems: null
375
+ filteredItems: null,
376
+ isFilterInputFocused: false
357
377
  }),
358
378
  state = _useState[0],
359
379
  setState = _useState[1];
@@ -35,9 +35,11 @@ var MenuItemContainer = (0, _styledComponents.default)(_Box.default).withConfig(
35
35
  }, function (props) {
36
36
  return (0, _styledComponents.css)(["", ";"], props.theme.typography[200]);
37
37
  }, function (props) {
38
- return props.active && !props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";"], function (props) {
38
+ return props.active && !props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";.Icon-svg{color:", ";}"], function (props) {
39
39
  return props.theme.colors.text.inverse;
40
- }, props.theme.colors.listItem.background.selected);
40
+ }, props.theme.colors.listItem.background.selected, function (props) {
41
+ return props.theme.colors.text.inverse;
42
+ });
41
43
  }, function (props) {
42
44
  return props.selected && !props.isCheckboxOrRadio && (0, _styledComponents.css)(["font-weight:", ";"], function (props) {
43
45
  return props.theme.fontWeights.semibold;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.DataVizRotation = void 0;
5
+
6
+ var _react = _interopRequireDefault(require("react"));
7
+
8
+ var _Box = _interopRequireDefault(require("../Box"));
9
+
10
+ var _styledComponents = require("styled-components");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ var DataVizRotation = (0, _styledComponents.withTheme)(function (p) {
15
+ return p.theme.colors.DATAVIZ_COLORS_LIST.map(function (color, i) {
16
+ return /*#__PURE__*/_react.default.createElement(_Box.default, {
17
+ key: color,
18
+ py: 300,
19
+ px: 400,
20
+ bg: color
21
+ }, i + 1);
22
+ });
23
+ });
24
+ exports.DataVizRotation = DataVizRotation;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.datavizPalette = void 0;
5
+
6
+ var _seedsColor = _interopRequireDefault(require("@sproutsocial/seeds-color"));
7
+
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+
10
+ var datavizPalette = {
11
+ DATAVIZ_COLORS_LIST: [_seedsColor.default.COLOR_TEAL_400, _seedsColor.default.COLOR_PURPLE_400, _seedsColor.default.COLOR_PINK_400, _seedsColor.default.COLOR_YELLOW_500, _seedsColor.default.COLOR_BLUE_400, _seedsColor.default.COLOR_MAGENTA_400, _seedsColor.default.COLOR_GREEN_400, _seedsColor.default.COLOR_ORANGE_400, _seedsColor.default.COLOR_RED_700, _seedsColor.default.COLOR_TEAL_700, _seedsColor.default.COLOR_PURPLE_700, _seedsColor.default.COLOR_PINK_700, _seedsColor.default.COLOR_YELLOW_800, _seedsColor.default.COLOR_BLUE_700, _seedsColor.default.COLOR_MAGENTA_700, _seedsColor.default.COLOR_GREEN_700, _seedsColor.default.COLOR_ORANGE_700, _seedsColor.default.COLOR_RED_400, _seedsColor.default.COLOR_GREEN_200, _seedsColor.default.COLOR_YELLOW_200],
12
+ DATAVIZ_COLORS_MAP: {
13
+ "1": _seedsColor.default.COLOR_TEAL_400,
14
+ "2": _seedsColor.default.COLOR_PURPLE_400,
15
+ "3": _seedsColor.default.COLOR_PINK_400,
16
+ "4": _seedsColor.default.COLOR_YELLOW_500,
17
+ "5": _seedsColor.default.COLOR_BLUE_400,
18
+ "6": _seedsColor.default.COLOR_MAGENTA_400,
19
+ "7": _seedsColor.default.COLOR_GREEN_400,
20
+ "8": _seedsColor.default.COLOR_ORANGE_400,
21
+ "9": _seedsColor.default.COLOR_RED_700,
22
+ "10": _seedsColor.default.COLOR_TEAL_700,
23
+ "11": _seedsColor.default.COLOR_PURPLE_700,
24
+ "12": _seedsColor.default.COLOR_PINK_700,
25
+ "13": _seedsColor.default.COLOR_YELLOW_800,
26
+ "14": _seedsColor.default.COLOR_BLUE_700,
27
+ "15": _seedsColor.default.COLOR_MAGENTA_700,
28
+ "16": _seedsColor.default.COLOR_GREEN_700,
29
+ "17": _seedsColor.default.COLOR_ORANGE_700,
30
+ "18": _seedsColor.default.COLOR_RED_400,
31
+ "19": _seedsColor.default.COLOR_GREEN_200,
32
+ "20": _seedsColor.default.COLOR_YELLOW_200
33
+ }
34
+ };
35
+ exports.datavizPalette = datavizPalette;
@@ -7,6 +7,8 @@ var _seedsColor = _interopRequireDefault(require("@sproutsocial/seeds-color"));
7
7
 
8
8
  var _theme = _interopRequireDefault(require("../default/theme"));
9
9
 
10
+ var _datavizPalette = require("./dataviz-palette");
11
+
10
12
  var _decorativePalettes = require("./decorative-palettes");
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -187,7 +189,7 @@ var darkTheme = _extends({}, _theme.default, {
187
189
  selected: _seedsColor.default.COLOR_NEUTRAL_0
188
190
  }
189
191
  }
190
- }),
192
+ }, _datavizPalette.datavizPalette),
191
193
  mode: "dark"
192
194
  });
193
195