@sproutsocial/racine 8.4.0-collapsible-updates.0 → 8.5.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 (48) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/__flow__/Avatar/index.js +34 -5
  3. package/__flow__/Avatar/index.stories.js +29 -0
  4. package/__flow__/Collapsible/index.js +11 -40
  5. package/__flow__/Collapsible/index.stories.js +0 -77
  6. package/__flow__/Collapsible/styles.js +2 -28
  7. package/__flow__/EnumIconNames.js +1 -1
  8. package/__flow__/IconViewBoxes.js +1 -1
  9. package/__flow__/Link/styles.js +2 -1
  10. package/__flow__/Menu/index.flow.js +2 -1
  11. package/__flow__/Menu/index.js +2 -1
  12. package/__flow__/OverflowList/index.js +1 -4
  13. package/__flow__/OverflowList/index.test.js +36 -4
  14. package/__flow__/themes/default/theme.js +1 -0
  15. package/commonjs/Avatar/index.js +37 -13
  16. package/commonjs/Collapsible/index.js +11 -28
  17. package/commonjs/Collapsible/styles.js +1 -8
  18. package/commonjs/IconViewBoxes.js +12 -0
  19. package/commonjs/Link/styles.js +2 -2
  20. package/commonjs/Menu/index.js +4 -2
  21. package/commonjs/OverflowList/index.js +1 -3
  22. package/commonjs/include-icons.js +1 -1
  23. package/commonjs/themes/default/theme.js +2 -1
  24. package/dist/iconList.js +1 -1
  25. package/dist/icons.svg +1 -1
  26. package/icons/bigcommerce.svg +3 -0
  27. package/icons/deconstructed-negative-sentiment.svg +3 -0
  28. package/icons/deconstructed-neutral-sentiment.svg +3 -0
  29. package/icons/deconstructed-positive-sentiment.svg +3 -0
  30. package/icons/flat-negative-sentiment-outline.svg +4 -0
  31. package/icons/flat-negative-sentiment.svg +3 -0
  32. package/icons/flat-neutral-sentiment-outline.svg +4 -0
  33. package/icons/flat-neutral-sentiment.svg +3 -0
  34. package/icons/flat-positive-sentiment-outline.svg +4 -0
  35. package/icons/flat-positive-sentiment.svg +3 -0
  36. package/icons/tiktok.svg +5 -0
  37. package/icons/woocommerce.svg +3 -0
  38. package/includeIcons.js +1 -1
  39. package/lib/Avatar/index.js +36 -13
  40. package/lib/Collapsible/index.js +11 -28
  41. package/lib/Collapsible/styles.js +1 -8
  42. package/lib/IconViewBoxes.js +12 -0
  43. package/lib/Link/styles.js +3 -3
  44. package/lib/Menu/index.js +4 -2
  45. package/lib/OverflowList/index.js +1 -3
  46. package/lib/include-icons.js +1 -1
  47. package/lib/themes/default/theme.js +2 -1
  48. package/package.json +2 -3
@@ -4,7 +4,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
4
4
 
5
5
  import * as React from "react";
6
6
  import { useState, useCallback, useMemo, memo } from "react";
7
- import styled from "styled-components";
7
+ import styled, { css } from "styled-components";
8
+ import classnames from "classnames";
8
9
  import Box from "../Box";
9
10
  import Image from "../Image";
10
11
  import Text from "../Text";
@@ -16,8 +17,20 @@ var AvatarText = styled(function (_ref) {
16
17
  }).withConfig({
17
18
  displayName: "Avatar__AvatarText",
18
19
  componentId: "yx873f-0"
19
- })(["font-size:", "px;"], function (props) {
20
+ })(["font-size:", "px;color:", "px;"], function (props) {
20
21
  return props.fontSize;
22
+ }, function (props) {
23
+ return props.color;
24
+ });
25
+ var Container = styled(Box).withConfig({
26
+ displayName: "Avatar__Container",
27
+ componentId: "yx873f-1"
28
+ })(["", ""], function (_ref2) {
29
+ var theme = _ref2.theme,
30
+ type = _ref2.type,
31
+ variant = _ref2.variant,
32
+ bg = _ref2.bg;
33
+ return css(["color:", ";background:", ";"], theme.colors[type][variant === "dark" ? "200" : "900"], bg ? bg : theme.colors[type][variant === "dark" ? "900" : "200"]);
21
34
  });
22
35
 
23
36
  var getInitials = function getInitials(name, fallback) {
@@ -33,14 +46,20 @@ var getInitials = function getInitials(name, fallback) {
33
46
  .join("");
34
47
  };
35
48
 
36
- export var Avatar = function Avatar(_ref2) {
37
- var _ref2$appearance = _ref2.appearance,
38
- appearance = _ref2$appearance === void 0 ? "circle" : _ref2$appearance,
39
- name = _ref2.name,
40
- src = _ref2.src,
41
- _ref2$size = _ref2.size,
42
- size = _ref2$size === void 0 ? "40px" : _ref2$size,
43
- rest = _objectWithoutPropertiesLoose(_ref2, ["appearance", "name", "src", "size"]);
49
+ export var Avatar = function Avatar(_ref3) {
50
+ var _ref3$appearance = _ref3.appearance,
51
+ appearance = _ref3$appearance === void 0 ? "circle" : _ref3$appearance,
52
+ name = _ref3.name,
53
+ src = _ref3.src,
54
+ _ref3$variant = _ref3.variant,
55
+ variant = _ref3$variant === void 0 ? "light" : _ref3$variant,
56
+ _ref3$type = _ref3.type,
57
+ type = _ref3$type === void 0 ? "neutral" : _ref3$type,
58
+ _ref3$size = _ref3.size,
59
+ size = _ref3$size === void 0 ? "40px" : _ref3$size,
60
+ bg = _ref3.bg,
61
+ color = _ref3.color,
62
+ rest = _objectWithoutPropertiesLoose(_ref3, ["appearance", "name", "src", "variant", "type", "size", "bg", "color"]);
44
63
 
45
64
  var _useState = useState(false),
46
65
  imageFailedLoading = _useState[0],
@@ -54,7 +73,8 @@ export var Avatar = function Avatar(_ref2) {
54
73
  }, [setImageFailedLoading]); // Font size for initials is half the size of the avatar, rounded down.
55
74
 
56
75
  var fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
57
- return /*#__PURE__*/React.createElement(Box, _extends({
76
+ return /*#__PURE__*/React.createElement(Container, _extends({
77
+ className: classnames(variant),
58
78
  size: size,
59
79
  overflow: "hidden",
60
80
  borderRadius: appearance === "leaf" ? "40% 0 40% 0" : "50%",
@@ -64,13 +84,16 @@ export var Avatar = function Avatar(_ref2) {
64
84
  justifyContent: "center",
65
85
  alignItems: "center",
66
86
  title: name,
67
- bg: "neutral.200",
87
+ bg: bg,
88
+ variant: variant,
89
+ type: type,
68
90
  "data-qa-user-avatar": name // $FlowIssue - upgrade v0.112.0
69
91
 
70
92
  }, rest), !src || imageFailedLoading ? /*#__PURE__*/React.createElement(AvatarText, {
71
93
  lineHeight: size,
72
94
  fontWeight: "semibold",
73
- fontSize: fontSize
95
+ fontSize: fontSize,
96
+ color: color
74
97
  }, initials) : /*#__PURE__*/React.createElement(Image, {
75
98
  alt: name,
76
99
  width: "auto",
@@ -15,10 +15,7 @@ var Collapsible = function Collapsible(_ref) {
15
15
  _ref$isOpen = _ref.isOpen,
16
16
  isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
17
17
  _ref$offset = _ref.offset,
18
- offset = _ref$offset === void 0 ? 0 : _ref$offset,
19
- _ref$collapsedHeight = _ref.collapsedHeight,
20
- collapsedHeight = _ref$collapsedHeight === void 0 ? 0 : _ref$collapsedHeight,
21
- openHeight = _ref.openHeight;
18
+ offset = _ref$offset === void 0 ? 0 : _ref$offset;
22
19
 
23
20
  var _useState = useState("Racine-collapsible-" + idCounter++),
24
21
  id = _useState[0];
@@ -27,25 +24,11 @@ var Collapsible = function Collapsible(_ref) {
27
24
  value: {
28
25
  isOpen: isOpen,
29
26
  id: id,
30
- offset: offset,
31
- collapsedHeight: collapsedHeight,
32
- openHeight: openHeight
27
+ offset: offset
33
28
  }
34
29
  }, children);
35
30
  };
36
31
 
37
- var determineMaxHeight = function determineMaxHeight(isHidden, openHeight, computedHeight) {
38
- // If isHidden is undefined this is the first render. Return undefined so the max-height prop is not added
39
- // This is a hack to prevent css from animating if it begins in the open state
40
- // css animates when attribute values change (IE from 0 to another number)
41
- // css does not animate when simply adding an attribute to an HTML element
42
- if (isHidden === undefined) return undefined; // If the user has defined an explicit open height, return that as the max height
43
-
44
- if (!!openHeight) return openHeight; // Otherwise, fallback to the computed height
45
-
46
- return computedHeight;
47
- };
48
-
49
32
  var Trigger = function Trigger(_ref2) {
50
33
  var children = _ref2.children,
51
34
  rest = _objectWithoutPropertiesLoose(_ref2, ["children"]);
@@ -67,18 +50,20 @@ var Panel = function Panel(_ref3) {
67
50
  var _useContext2 = useContext(CollapsibleContext),
68
51
  isOpen = _useContext2.isOpen,
69
52
  id = _useContext2.id,
70
- offset = _useContext2.offset,
71
- collapsedHeight = _useContext2.collapsedHeight,
72
- openHeight = _useContext2.openHeight;
53
+ offset = _useContext2.offset;
73
54
 
74
55
  var ref = useRef();
75
56
  var measurement = useMeasure(ref);
76
57
 
77
58
  var _useState2 = useState(undefined),
78
59
  isHidden = _useState2[0],
79
- setIsHidden = _useState2[1];
60
+ setIsHidden = _useState2[1]; // If this is the initial render isHidden will be undefined
61
+ // When that is the case, set maxHeight to undefined rather than the comptued 0
62
+ // This prevents an initial expansion animation if a component starts out open
63
+ // There is no animation because css is not changing the maxHeight property after mount
64
+
80
65
 
81
- var maxHeight = determineMaxHeight(isHidden, openHeight, measurement.height + offset);
66
+ var maxHeight = isHidden === undefined ? undefined : measurement.height + offset;
82
67
  /* 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. */
83
68
 
84
69
  useEffect(function () {
@@ -104,14 +89,12 @@ var Panel = function Panel(_ref3) {
104
89
  }
105
90
  }, [isOpen]);
106
91
  return /*#__PURE__*/React.createElement(CollapsingBox, _extends({
107
- scrollable: isOpen,
108
- maxHeight: isOpen ? maxHeight : collapsedHeight,
109
- minHeight: collapsedHeight,
92
+ maxHeight: isOpen ? maxHeight : "0",
110
93
  "data-qa-collapsible": "",
111
94
  "data-qa-collapsible-isopen": isOpen === true
112
95
  }, rest), /*#__PURE__*/React.createElement(Box, {
113
96
  width: "100%",
114
- hidden: isHidden && collapsedHeight === 0,
97
+ hidden: isHidden,
115
98
  "aria-hidden": !isOpen,
116
99
  id: id,
117
100
  ref: ref
@@ -3,15 +3,8 @@ import Box from "../Box";
3
3
  export var CollapsingBox = styled(Box).withConfig({
4
4
  displayName: "styles__CollapsingBox",
5
5
  componentId: "sc-1xvfbl7-0"
6
- })(["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) {
6
+ })(["transition:max-height ", " ", ";will-change:max-height;overflow:hidden;"], function (p) {
7
7
  return p.theme.duration.medium;
8
8
  }, function (p) {
9
9
  return p.theme.easing.ease_inout;
10
- }, function (p) {
11
- return p.theme.colors.neutral[100];
12
- }, function (p) {
13
- return p.theme.colors.neutral[100];
14
- }, function (_ref) {
15
- var scrollable = _ref.scrollable;
16
- return scrollable ? "overflow: auto" : "overflow: hidden";
17
10
  });
@@ -32,6 +32,7 @@ module.exports = {
32
32
  "barcode": "0 0 18 16",
33
33
  "basketball": "0 0 16 16",
34
34
  "bell-outline": "0 0 14 16",
35
+ "bigcommerce": "0 0 16 16",
35
36
  "bitly": "0 0 16 16",
36
37
  "bold": "0 0 16 16",
37
38
  "book": "0 0 14 16",
@@ -85,6 +86,9 @@ module.exports = {
85
86
  "crop": "0 0 16 16",
86
87
  "crown": "0 0 16 16",
87
88
  "dashboard": "0 0 16 14",
89
+ "deconstructed-negative-sentiment": "0 0 18 18",
90
+ "deconstructed-neutral-sentiment": "0 0 18 18",
91
+ "deconstructed-positive-sentiment": "0 0 18 18",
88
92
  "discovery": "0 0 16 16",
89
93
  "dislike-outline": "0 0 15 16",
90
94
  "dislike": "0 0 16 16",
@@ -134,6 +138,12 @@ module.exports = {
134
138
  "filter": "0 0 16 16",
135
139
  "flag-outline": "0 0 16 16",
136
140
  "flag": "0 0 16 16",
141
+ "flat-negative-sentiment-outline": "0 0 18 18",
142
+ "flat-negative-sentiment": "0 0 18 18",
143
+ "flat-neutral-sentiment-outline": "0 0 18 18",
144
+ "flat-neutral-sentiment": "0 0 18 18",
145
+ "flat-positive-sentiment-outline": "0 0 18 18",
146
+ "flat-positive-sentiment": "0 0 18 18",
137
147
  "folder-open": "0 0 16 15",
138
148
  "folder": "0 0 16 16",
139
149
  "follow-outline": "0 0 20 16",
@@ -304,6 +314,7 @@ module.exports = {
304
314
  "team": "0 0 18 16",
305
315
  "text-asset": "0 0 16 16",
306
316
  "text": "0 0 8 16",
317
+ "tiktok": "0 0 16 18",
307
318
  "times": "0 0 16 22",
308
319
  "trash-can-outline": "0 0 14 16",
309
320
  "trash-can": "0 0 14 16",
@@ -337,6 +348,7 @@ module.exports = {
337
348
  "window-minimize": "0 0 16 16",
338
349
  "window-regular": "0 0 16 16",
339
350
  "window-restore": "0 0 16 16",
351
+ "woocommerce": "0 0 18 16",
340
352
  "x": "0 0 16 18",
341
353
  "yelp-full-star": "0 0 16 16",
342
354
  "yelp-half-star": "0 0 16 16",
@@ -1,11 +1,11 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import { focusRing, disabled } from "../utils/mixins";
3
3
  import Text from "../Text";
4
- import { TYPOGRAPHY, COMMON } from "../utils/system-props";
4
+ import { TYPOGRAPHY, COMMON, FLEXBOX } from "../utils/system-props";
5
5
  var Container = styled(Text).withConfig({
6
6
  displayName: "styles__Container",
7
7
  componentId: "adcw4a-0"
8
- })(["border:0;font-family:", ";text-decoration:", ";appearance:none;cursor:pointer;", " font-weight:", ";color:", ";&:hover{color:", ";text-decoration:underline;}&:active{color:", ";}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", ""], function (props) {
8
+ })(["border:0;font-family:", ";text-decoration:", ";appearance:none;cursor:pointer;", " font-weight:", ";color:", ";&:hover{color:", ";text-decoration:underline;}&:active{color:", ";}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", " ", ""], function (props) {
9
9
  return props.theme.fontFamily;
10
10
  }, function (props) {
11
11
  return props.underline ? "underline" : "none";
@@ -23,5 +23,5 @@ var Container = styled(Text).withConfig({
23
23
  return !props.href && css(["background:none;"]);
24
24
  }, function (props) {
25
25
  return props.disabled && disabled;
26
- }, COMMON, TYPOGRAPHY);
26
+ }, COMMON, TYPOGRAPHY, FLEXBOX);
27
27
  export default Container;
package/lib/Menu/index.js CHANGED
@@ -370,7 +370,9 @@ export var MenuButton = function MenuButton(_ref5) {
370
370
  closeOnItemClick = _ref5$closeOnItemClic === void 0 ? true : _ref5$closeOnItemClic,
371
371
  _ref5$id = _ref5.id,
372
372
  id = _ref5$id === void 0 ? uniqueId("MenuButton-") : _ref5$id,
373
- props = _objectWithoutPropertiesLoose(_ref5, ["content", "popoutProps", "children", "onClick", "closeOnItemClick", "id"]);
373
+ _ref5$placement = _ref5.placement,
374
+ placement = _ref5$placement === void 0 ? "bottom" : _ref5$placement,
375
+ props = _objectWithoutPropertiesLoose(_ref5, ["content", "popoutProps", "children", "onClick", "closeOnItemClick", "id", "placement"]);
374
376
 
375
377
  var _useState2 = useState(false),
376
378
  isOpen = _useState2[0],
@@ -390,7 +392,7 @@ export var MenuButton = function MenuButton(_ref5) {
390
392
  isOpen: isOpen,
391
393
  setIsOpen: setIsOpen,
392
394
  content: /*#__PURE__*/React.createElement(CustomPopoutContent, null, content),
393
- placement: "bottom"
395
+ placement: placement
394
396
  }, popoutProps, {
395
397
  // $FlowIssue
396
398
  width: props.width
@@ -2,9 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import List from "./styles";
4
4
  import React, { useCallback, useMemo } from "react";
5
- import { CellMeasurer, CellMeasurerCache } from "react-virtualized"; // imported separately so it can be mocked separately (otherwise height and width will always be 0 in jsdom)
6
-
7
- import AutoSizer from "react-virtualized/dist/es/AutoSizer";
5
+ import { AutoSizer, CellMeasurer, CellMeasurerCache } from "react-virtualized";
8
6
  import Box from "../Box";
9
7
 
10
8
  var VirtualizedList = function VirtualizedList(_ref) {