@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.
- package/CHANGELOG.md +60 -0
- package/__flow__/Avatar/index.js +34 -5
- package/__flow__/Avatar/index.stories.js +29 -0
- package/__flow__/Collapsible/index.js +11 -40
- package/__flow__/Collapsible/index.stories.js +0 -77
- package/__flow__/Collapsible/styles.js +2 -28
- package/__flow__/EnumIconNames.js +1 -1
- package/__flow__/IconViewBoxes.js +1 -1
- package/__flow__/Link/styles.js +2 -1
- package/__flow__/Menu/index.flow.js +2 -1
- package/__flow__/Menu/index.js +2 -1
- package/__flow__/OverflowList/index.js +1 -4
- package/__flow__/OverflowList/index.test.js +36 -4
- package/__flow__/themes/default/theme.js +1 -0
- package/commonjs/Avatar/index.js +37 -13
- package/commonjs/Collapsible/index.js +11 -28
- package/commonjs/Collapsible/styles.js +1 -8
- package/commonjs/IconViewBoxes.js +12 -0
- package/commonjs/Link/styles.js +2 -2
- package/commonjs/Menu/index.js +4 -2
- package/commonjs/OverflowList/index.js +1 -3
- package/commonjs/include-icons.js +1 -1
- package/commonjs/themes/default/theme.js +2 -1
- package/dist/iconList.js +1 -1
- package/dist/icons.svg +1 -1
- package/icons/bigcommerce.svg +3 -0
- package/icons/deconstructed-negative-sentiment.svg +3 -0
- package/icons/deconstructed-neutral-sentiment.svg +3 -0
- package/icons/deconstructed-positive-sentiment.svg +3 -0
- package/icons/flat-negative-sentiment-outline.svg +4 -0
- package/icons/flat-negative-sentiment.svg +3 -0
- package/icons/flat-neutral-sentiment-outline.svg +4 -0
- package/icons/flat-neutral-sentiment.svg +3 -0
- package/icons/flat-positive-sentiment-outline.svg +4 -0
- package/icons/flat-positive-sentiment.svg +3 -0
- package/icons/tiktok.svg +5 -0
- package/icons/woocommerce.svg +3 -0
- package/includeIcons.js +1 -1
- package/lib/Avatar/index.js +36 -13
- package/lib/Collapsible/index.js +11 -28
- package/lib/Collapsible/styles.js +1 -8
- package/lib/IconViewBoxes.js +12 -0
- package/lib/Link/styles.js +3 -3
- package/lib/Menu/index.js +4 -2
- package/lib/OverflowList/index.js +1 -3
- package/lib/include-icons.js +1 -1
- package/lib/themes/default/theme.js +2 -1
- package/package.json +2 -3
package/commonjs/Avatar/index.js
CHANGED
|
@@ -5,7 +5,9 @@ exports.default = exports.Avatar = void 0;
|
|
|
5
5
|
|
|
6
6
|
var React = _interopRequireWildcard(require("react"));
|
|
7
7
|
|
|
8
|
-
var _styledComponents =
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
11
|
|
|
10
12
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
11
13
|
|
|
@@ -31,8 +33,20 @@ var AvatarText = (0, _styledComponents.default)(function (_ref) {
|
|
|
31
33
|
}).withConfig({
|
|
32
34
|
displayName: "Avatar__AvatarText",
|
|
33
35
|
componentId: "yx873f-0"
|
|
34
|
-
})(["font-size:", "px;"], function (props) {
|
|
36
|
+
})(["font-size:", "px;color:", "px;"], function (props) {
|
|
35
37
|
return props.fontSize;
|
|
38
|
+
}, function (props) {
|
|
39
|
+
return props.color;
|
|
40
|
+
});
|
|
41
|
+
var Container = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
42
|
+
displayName: "Avatar__Container",
|
|
43
|
+
componentId: "yx873f-1"
|
|
44
|
+
})(["", ""], function (_ref2) {
|
|
45
|
+
var theme = _ref2.theme,
|
|
46
|
+
type = _ref2.type,
|
|
47
|
+
variant = _ref2.variant,
|
|
48
|
+
bg = _ref2.bg;
|
|
49
|
+
return (0, _styledComponents.css)(["color:", ";background:", ";"], theme.colors[type][variant === "dark" ? "200" : "900"], bg ? bg : theme.colors[type][variant === "dark" ? "900" : "200"]);
|
|
36
50
|
});
|
|
37
51
|
|
|
38
52
|
var getInitials = function getInitials(name, fallback) {
|
|
@@ -48,14 +62,20 @@ var getInitials = function getInitials(name, fallback) {
|
|
|
48
62
|
.join("");
|
|
49
63
|
};
|
|
50
64
|
|
|
51
|
-
var Avatar = function Avatar(
|
|
52
|
-
var
|
|
53
|
-
appearance =
|
|
54
|
-
name =
|
|
55
|
-
src =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
var Avatar = function Avatar(_ref3) {
|
|
66
|
+
var _ref3$appearance = _ref3.appearance,
|
|
67
|
+
appearance = _ref3$appearance === void 0 ? "circle" : _ref3$appearance,
|
|
68
|
+
name = _ref3.name,
|
|
69
|
+
src = _ref3.src,
|
|
70
|
+
_ref3$variant = _ref3.variant,
|
|
71
|
+
variant = _ref3$variant === void 0 ? "light" : _ref3$variant,
|
|
72
|
+
_ref3$type = _ref3.type,
|
|
73
|
+
type = _ref3$type === void 0 ? "neutral" : _ref3$type,
|
|
74
|
+
_ref3$size = _ref3.size,
|
|
75
|
+
size = _ref3$size === void 0 ? "40px" : _ref3$size,
|
|
76
|
+
bg = _ref3.bg,
|
|
77
|
+
color = _ref3.color,
|
|
78
|
+
rest = _objectWithoutPropertiesLoose(_ref3, ["appearance", "name", "src", "variant", "type", "size", "bg", "color"]);
|
|
59
79
|
|
|
60
80
|
var _useState = (0, React.useState)(false),
|
|
61
81
|
imageFailedLoading = _useState[0],
|
|
@@ -69,7 +89,8 @@ var Avatar = function Avatar(_ref2) {
|
|
|
69
89
|
}, [setImageFailedLoading]); // Font size for initials is half the size of the avatar, rounded down.
|
|
70
90
|
|
|
71
91
|
var fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
|
|
72
|
-
return /*#__PURE__*/React.createElement(
|
|
92
|
+
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
93
|
+
className: (0, _classnames.default)(variant),
|
|
73
94
|
size: size,
|
|
74
95
|
overflow: "hidden",
|
|
75
96
|
borderRadius: appearance === "leaf" ? "40% 0 40% 0" : "50%",
|
|
@@ -79,13 +100,16 @@ var Avatar = function Avatar(_ref2) {
|
|
|
79
100
|
justifyContent: "center",
|
|
80
101
|
alignItems: "center",
|
|
81
102
|
title: name,
|
|
82
|
-
bg:
|
|
103
|
+
bg: bg,
|
|
104
|
+
variant: variant,
|
|
105
|
+
type: type,
|
|
83
106
|
"data-qa-user-avatar": name // $FlowIssue - upgrade v0.112.0
|
|
84
107
|
|
|
85
108
|
}, rest), !src || imageFailedLoading ? /*#__PURE__*/React.createElement(AvatarText, {
|
|
86
109
|
lineHeight: size,
|
|
87
110
|
fontWeight: "semibold",
|
|
88
|
-
fontSize: fontSize
|
|
111
|
+
fontSize: fontSize,
|
|
112
|
+
color: color
|
|
89
113
|
}, initials) : /*#__PURE__*/React.createElement(_Image.default, {
|
|
90
114
|
alt: name,
|
|
91
115
|
width: "auto",
|
|
@@ -29,10 +29,7 @@ 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
|
|
33
|
-
_ref$collapsedHeight = _ref.collapsedHeight,
|
|
34
|
-
collapsedHeight = _ref$collapsedHeight === void 0 ? 0 : _ref$collapsedHeight,
|
|
35
|
-
openHeight = _ref.openHeight;
|
|
32
|
+
offset = _ref$offset === void 0 ? 0 : _ref$offset;
|
|
36
33
|
|
|
37
34
|
var _useState = (0, React.useState)("Racine-collapsible-" + idCounter++),
|
|
38
35
|
id = _useState[0];
|
|
@@ -41,25 +38,11 @@ var Collapsible = function Collapsible(_ref) {
|
|
|
41
38
|
value: {
|
|
42
39
|
isOpen: isOpen,
|
|
43
40
|
id: id,
|
|
44
|
-
offset: offset
|
|
45
|
-
collapsedHeight: collapsedHeight,
|
|
46
|
-
openHeight: openHeight
|
|
41
|
+
offset: offset
|
|
47
42
|
}
|
|
48
43
|
}, children);
|
|
49
44
|
};
|
|
50
45
|
|
|
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
|
-
|
|
63
46
|
var Trigger = function Trigger(_ref2) {
|
|
64
47
|
var children = _ref2.children,
|
|
65
48
|
rest = _objectWithoutPropertiesLoose(_ref2, ["children"]);
|
|
@@ -81,18 +64,20 @@ var Panel = function Panel(_ref3) {
|
|
|
81
64
|
var _useContext2 = (0, React.useContext)(CollapsibleContext),
|
|
82
65
|
isOpen = _useContext2.isOpen,
|
|
83
66
|
id = _useContext2.id,
|
|
84
|
-
offset = _useContext2.offset
|
|
85
|
-
collapsedHeight = _useContext2.collapsedHeight,
|
|
86
|
-
openHeight = _useContext2.openHeight;
|
|
67
|
+
offset = _useContext2.offset;
|
|
87
68
|
|
|
88
69
|
var ref = (0, React.useRef)();
|
|
89
70
|
var measurement = (0, _useMeasure.default)(ref);
|
|
90
71
|
|
|
91
72
|
var _useState2 = (0, React.useState)(undefined),
|
|
92
73
|
isHidden = _useState2[0],
|
|
93
|
-
setIsHidden = _useState2[1];
|
|
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
|
+
|
|
94
79
|
|
|
95
|
-
var maxHeight =
|
|
80
|
+
var maxHeight = isHidden === undefined ? undefined : measurement.height + offset;
|
|
96
81
|
/* 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. */
|
|
97
82
|
|
|
98
83
|
(0, React.useEffect)(function () {
|
|
@@ -118,14 +103,12 @@ var Panel = function Panel(_ref3) {
|
|
|
118
103
|
}
|
|
119
104
|
}, [isOpen]);
|
|
120
105
|
return /*#__PURE__*/React.createElement(_styles.CollapsingBox, _extends({
|
|
121
|
-
|
|
122
|
-
maxHeight: isOpen ? maxHeight : collapsedHeight,
|
|
123
|
-
minHeight: collapsedHeight,
|
|
106
|
+
maxHeight: isOpen ? maxHeight : "0",
|
|
124
107
|
"data-qa-collapsible": "",
|
|
125
108
|
"data-qa-collapsible-isopen": isOpen === true
|
|
126
109
|
}, rest), /*#__PURE__*/React.createElement(_Box.default, {
|
|
127
110
|
width: "100%",
|
|
128
|
-
hidden: isHidden
|
|
111
|
+
hidden: isHidden,
|
|
129
112
|
"aria-hidden": !isOpen,
|
|
130
113
|
id: id,
|
|
131
114
|
ref: ref
|
|
@@ -12,16 +12,9 @@ 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;
|
|
15
|
+
})(["transition:max-height ", " ", ";will-change:max-height;overflow:hidden;"], 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";
|
|
26
19
|
});
|
|
27
20
|
exports.CollapsingBox = CollapsingBox;
|
|
@@ -34,6 +34,7 @@ module.exports = {
|
|
|
34
34
|
"barcode": "0 0 18 16",
|
|
35
35
|
"basketball": "0 0 16 16",
|
|
36
36
|
"bell-outline": "0 0 14 16",
|
|
37
|
+
"bigcommerce": "0 0 16 16",
|
|
37
38
|
"bitly": "0 0 16 16",
|
|
38
39
|
"bold": "0 0 16 16",
|
|
39
40
|
"book": "0 0 14 16",
|
|
@@ -87,6 +88,9 @@ module.exports = {
|
|
|
87
88
|
"crop": "0 0 16 16",
|
|
88
89
|
"crown": "0 0 16 16",
|
|
89
90
|
"dashboard": "0 0 16 14",
|
|
91
|
+
"deconstructed-negative-sentiment": "0 0 18 18",
|
|
92
|
+
"deconstructed-neutral-sentiment": "0 0 18 18",
|
|
93
|
+
"deconstructed-positive-sentiment": "0 0 18 18",
|
|
90
94
|
"discovery": "0 0 16 16",
|
|
91
95
|
"dislike-outline": "0 0 15 16",
|
|
92
96
|
"dislike": "0 0 16 16",
|
|
@@ -136,6 +140,12 @@ module.exports = {
|
|
|
136
140
|
"filter": "0 0 16 16",
|
|
137
141
|
"flag-outline": "0 0 16 16",
|
|
138
142
|
"flag": "0 0 16 16",
|
|
143
|
+
"flat-negative-sentiment-outline": "0 0 18 18",
|
|
144
|
+
"flat-negative-sentiment": "0 0 18 18",
|
|
145
|
+
"flat-neutral-sentiment-outline": "0 0 18 18",
|
|
146
|
+
"flat-neutral-sentiment": "0 0 18 18",
|
|
147
|
+
"flat-positive-sentiment-outline": "0 0 18 18",
|
|
148
|
+
"flat-positive-sentiment": "0 0 18 18",
|
|
139
149
|
"folder-open": "0 0 16 15",
|
|
140
150
|
"folder": "0 0 16 16",
|
|
141
151
|
"follow-outline": "0 0 20 16",
|
|
@@ -306,6 +316,7 @@ module.exports = {
|
|
|
306
316
|
"team": "0 0 18 16",
|
|
307
317
|
"text-asset": "0 0 16 16",
|
|
308
318
|
"text": "0 0 8 16",
|
|
319
|
+
"tiktok": "0 0 16 18",
|
|
309
320
|
"times": "0 0 16 22",
|
|
310
321
|
"trash-can-outline": "0 0 14 16",
|
|
311
322
|
"trash-can": "0 0 14 16",
|
|
@@ -339,6 +350,7 @@ module.exports = {
|
|
|
339
350
|
"window-minimize": "0 0 16 16",
|
|
340
351
|
"window-regular": "0 0 16 16",
|
|
341
352
|
"window-restore": "0 0 16 16",
|
|
353
|
+
"woocommerce": "0 0 18 16",
|
|
342
354
|
"x": "0 0 16 18",
|
|
343
355
|
"yelp-full-star": "0 0 16 16",
|
|
344
356
|
"yelp-half-star": "0 0 16 16",
|
package/commonjs/Link/styles.js
CHANGED
|
@@ -20,7 +20,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
20
20
|
var Container = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
21
21
|
displayName: "styles__Container",
|
|
22
22
|
componentId: "adcw4a-0"
|
|
23
|
-
})(["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) {
|
|
23
|
+
})(["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) {
|
|
24
24
|
return props.theme.fontFamily;
|
|
25
25
|
}, function (props) {
|
|
26
26
|
return props.underline ? "underline" : "none";
|
|
@@ -38,6 +38,6 @@ var Container = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
|
38
38
|
return !props.href && (0, _styledComponents.css)(["background:none;"]);
|
|
39
39
|
}, function (props) {
|
|
40
40
|
return props.disabled && _mixins.disabled;
|
|
41
|
-
}, _systemProps.COMMON, _systemProps.TYPOGRAPHY);
|
|
41
|
+
}, _systemProps.COMMON, _systemProps.TYPOGRAPHY, _systemProps.FLEXBOX);
|
|
42
42
|
var _default = Container;
|
|
43
43
|
exports.default = _default;
|
package/commonjs/Menu/index.js
CHANGED
|
@@ -411,7 +411,9 @@ var MenuButton = function MenuButton(_ref5) {
|
|
|
411
411
|
closeOnItemClick = _ref5$closeOnItemClic === void 0 ? true : _ref5$closeOnItemClic,
|
|
412
412
|
_ref5$id = _ref5.id,
|
|
413
413
|
id = _ref5$id === void 0 ? (0, _lodash.default)("MenuButton-") : _ref5$id,
|
|
414
|
-
|
|
414
|
+
_ref5$placement = _ref5.placement,
|
|
415
|
+
placement = _ref5$placement === void 0 ? "bottom" : _ref5$placement,
|
|
416
|
+
props = _objectWithoutPropertiesLoose(_ref5, ["content", "popoutProps", "children", "onClick", "closeOnItemClick", "id", "placement"]);
|
|
415
417
|
|
|
416
418
|
var _useState2 = (0, React.useState)(false),
|
|
417
419
|
isOpen = _useState2[0],
|
|
@@ -431,7 +433,7 @@ var MenuButton = function MenuButton(_ref5) {
|
|
|
431
433
|
isOpen: isOpen,
|
|
432
434
|
setIsOpen: setIsOpen,
|
|
433
435
|
content: /*#__PURE__*/React.createElement(CustomPopoutContent, null, content),
|
|
434
|
-
placement:
|
|
436
|
+
placement: placement
|
|
435
437
|
}, popoutProps, {
|
|
436
438
|
// $FlowIssue
|
|
437
439
|
width: props.width
|
|
@@ -9,8 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _reactVirtualized = require("react-virtualized");
|
|
11
11
|
|
|
12
|
-
var _AutoSizer = _interopRequireDefault(require("react-virtualized/dist/es/AutoSizer"));
|
|
13
|
-
|
|
14
12
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
15
13
|
|
|
16
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -59,7 +57,7 @@ var VirtualizedList = function VirtualizedList(_ref) {
|
|
|
59
57
|
})));
|
|
60
58
|
});
|
|
61
59
|
}, [items, getItemProps, cache, itemWrapperProps]);
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_reactVirtualized.AutoSizer, null, function (_ref4) {
|
|
63
61
|
var height = _ref4.height,
|
|
64
62
|
width = _ref4.width;
|
|
65
63
|
return /*#__PURE__*/_react.default.createElement(_styles.default, _extends({
|