@sproutsocial/racine 8.4.0 → 8.6.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +24 -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__/EnumIconNames.js +1 -1
  6. package/__flow__/IconViewBoxes.js +1 -1
  7. package/__flow__/dataviz/dataviz.stories.js +12 -0
  8. package/__flow__/dataviz/index.js +13 -0
  9. package/__flow__/themes/dark/dataviz-palette.js +50 -0
  10. package/__flow__/themes/dark/theme.js +2 -0
  11. package/__flow__/themes/default/dataviz-palette.js +50 -0
  12. package/__flow__/themes/default/theme.js +3 -0
  13. package/commonjs/Collapsible/index.js +28 -11
  14. package/commonjs/Collapsible/styles.js +8 -1
  15. package/commonjs/IconViewBoxes.js +11 -1
  16. package/commonjs/dataviz/index.js +24 -0
  17. package/commonjs/include-icons.js +1 -1
  18. package/commonjs/themes/dark/dataviz-palette.js +35 -0
  19. package/commonjs/themes/dark/theme.js +3 -1
  20. package/commonjs/themes/default/dataviz-palette.js +35 -0
  21. package/commonjs/themes/default/theme.js +5 -2
  22. package/dist/iconList.js +1 -1
  23. package/dist/icons.svg +1 -1
  24. package/icons/bigcommerce.svg +1 -2
  25. package/icons/deconstructed-negative-sentiment.svg +3 -0
  26. package/icons/deconstructed-neutral-sentiment.svg +3 -0
  27. package/icons/deconstructed-positive-sentiment.svg +3 -0
  28. package/icons/flat-negative-sentiment-outline.svg +4 -0
  29. package/icons/flat-negative-sentiment.svg +3 -0
  30. package/icons/flat-neutral-sentiment-outline.svg +4 -0
  31. package/icons/flat-neutral-sentiment.svg +3 -0
  32. package/icons/flat-positive-sentiment-outline.svg +4 -0
  33. package/icons/flat-positive-sentiment.svg +3 -0
  34. package/icons/tiktok.svg +5 -0
  35. package/icons/woocommerce.svg +2 -4
  36. package/includeIcons.js +1 -1
  37. package/lib/Collapsible/index.js +28 -11
  38. package/lib/Collapsible/styles.js +8 -1
  39. package/lib/IconViewBoxes.js +11 -1
  40. package/lib/dataviz/index.js +13 -0
  41. package/lib/include-icons.js +1 -1
  42. package/lib/themes/dark/dataviz-palette.js +26 -0
  43. package/lib/themes/dark/theme.js +2 -1
  44. package/lib/themes/default/dataviz-palette.js +26 -0
  45. package/lib/themes/default/theme.js +4 -2
  46. package/package.json +3 -2
@@ -15,7 +15,10 @@ 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;
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;
19
22
 
20
23
  var _useState = useState("Racine-collapsible-" + idCounter++),
21
24
  id = _useState[0];
@@ -24,11 +27,25 @@ var Collapsible = function Collapsible(_ref) {
24
27
  value: {
25
28
  isOpen: isOpen,
26
29
  id: id,
27
- offset: offset
30
+ offset: offset,
31
+ collapsedHeight: collapsedHeight,
32
+ openHeight: openHeight
28
33
  }
29
34
  }, children);
30
35
  };
31
36
 
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
+
32
49
  var Trigger = function Trigger(_ref2) {
33
50
  var children = _ref2.children,
34
51
  rest = _objectWithoutPropertiesLoose(_ref2, ["children"]);
@@ -50,20 +67,18 @@ var Panel = function Panel(_ref3) {
50
67
  var _useContext2 = useContext(CollapsibleContext),
51
68
  isOpen = _useContext2.isOpen,
52
69
  id = _useContext2.id,
53
- offset = _useContext2.offset;
70
+ offset = _useContext2.offset,
71
+ collapsedHeight = _useContext2.collapsedHeight,
72
+ openHeight = _useContext2.openHeight;
54
73
 
55
74
  var ref = useRef();
56
75
  var measurement = useMeasure(ref);
57
76
 
58
77
  var _useState2 = useState(undefined),
59
78
  isHidden = _useState2[0],
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
-
79
+ setIsHidden = _useState2[1];
65
80
 
66
- var maxHeight = isHidden === undefined ? undefined : measurement.height + offset;
81
+ var maxHeight = determineMaxHeight(isHidden, openHeight, measurement.height + offset);
67
82
  /* 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. */
68
83
 
69
84
  useEffect(function () {
@@ -89,12 +104,14 @@ var Panel = function Panel(_ref3) {
89
104
  }
90
105
  }, [isOpen]);
91
106
  return /*#__PURE__*/React.createElement(CollapsingBox, _extends({
92
- maxHeight: isOpen ? maxHeight : "0",
107
+ scrollable: isOpen,
108
+ maxHeight: isOpen ? maxHeight : collapsedHeight,
109
+ minHeight: collapsedHeight,
93
110
  "data-qa-collapsible": "",
94
111
  "data-qa-collapsible-isopen": isOpen === true
95
112
  }, rest), /*#__PURE__*/React.createElement(Box, {
96
113
  width: "100%",
97
- hidden: isHidden,
114
+ hidden: isHidden && collapsedHeight === 0,
98
115
  "aria-hidden": !isOpen,
99
116
  id: id,
100
117
  ref: ref
@@ -3,8 +3,15 @@ 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;overflow:hidden;"], function (p) {
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) {
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";
10
17
  });
@@ -86,6 +86,9 @@ module.exports = {
86
86
  "crop": "0 0 16 16",
87
87
  "crown": "0 0 16 16",
88
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",
89
92
  "discovery": "0 0 16 16",
90
93
  "dislike-outline": "0 0 15 16",
91
94
  "dislike": "0 0 16 16",
@@ -135,6 +138,12 @@ module.exports = {
135
138
  "filter": "0 0 16 16",
136
139
  "flag-outline": "0 0 16 16",
137
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",
138
147
  "folder-open": "0 0 16 15",
139
148
  "folder": "0 0 16 16",
140
149
  "follow-outline": "0 0 20 16",
@@ -305,6 +314,7 @@ module.exports = {
305
314
  "team": "0 0 18 16",
306
315
  "text-asset": "0 0 16 16",
307
316
  "text": "0 0 8 16",
317
+ "tiktok": "0 0 16 18",
308
318
  "times": "0 0 16 22",
309
319
  "trash-can-outline": "0 0 14 16",
310
320
  "trash-can": "0 0 14 16",
@@ -338,7 +348,7 @@ module.exports = {
338
348
  "window-minimize": "0 0 16 16",
339
349
  "window-regular": "0 0 16 16",
340
350
  "window-restore": "0 0 16 16",
341
- "woocommerce": "0 0 16 16",
351
+ "woocommerce": "0 0 18 16",
342
352
  "x": "0 0 16 18",
343
353
  "yelp-full-star": "0 0 16 16",
344
354
  "yelp-half-star": "0 0 16 16",
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import Box from "../Box";
3
+ import { withTheme } from "styled-components";
4
+ export var DataVizRotation = withTheme(function (p) {
5
+ return p.theme.colors.DATAVIZ_COLORS_LIST.map(function (color, i) {
6
+ return /*#__PURE__*/React.createElement(Box, {
7
+ key: color,
8
+ py: 300,
9
+ px: 400,
10
+ bg: color
11
+ }, i + 1);
12
+ });
13
+ });