@sproutsocial/racine 17.0.0 → 19.0.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 (129) hide show
  1. package/CHANGELOG.md +59 -1
  2. package/README.md +16 -14
  3. package/__flow__/Card/Card.flow.js +5 -1
  4. package/__flow__/Card/CardTypes.flow.js +8 -1
  5. package/__flow__/Numeral/Numeral.flow.js +2 -0
  6. package/__flow__/index.flow.js +1 -8
  7. package/commonjs/Card/subComponents.js +14 -6
  8. package/commonjs/ChartLegend/ChartLegend.js +6 -23
  9. package/commonjs/ChartLegend/useChartLabels.js +41 -0
  10. package/commonjs/Collapsible/Collapsible.js +2 -2
  11. package/commonjs/Link/Link.js +2 -1
  12. package/commonjs/Menu/Menu.js +69 -55
  13. package/commonjs/Menu/styles.js +1 -1
  14. package/commonjs/Numeral/Numeral.js +11 -2
  15. package/commonjs/TableHeaderCell/TableHeaderCell.js +3 -1
  16. package/commonjs/Toast/styles.js +2 -4
  17. package/commonjs/index.flow.js +48 -64
  18. package/commonjs/index.js +8 -24
  19. package/commonjs/themes/light/theme.js +33 -1
  20. package/commonjs/utils/use-measure.js +65 -0
  21. package/dist/themes/dark/theme.scss +28 -0
  22. package/dist/themes/extendedThemes/sproutTheme/dark/theme.scss +28 -0
  23. package/dist/themes/extendedThemes/sproutTheme/light/theme.scss +28 -0
  24. package/dist/themes/light/theme.scss +56 -0
  25. package/dist/types/Box/Box.d.ts +1 -1
  26. package/dist/types/Box/Box.d.ts.map +1 -1
  27. package/dist/types/Card/CardTypes.d.ts +3 -2
  28. package/dist/types/Card/CardTypes.d.ts.map +1 -1
  29. package/dist/types/Card/styles.d.ts +2 -2
  30. package/dist/types/Card/styles.d.ts.map +1 -1
  31. package/dist/types/Card/subComponents.d.ts +1 -1
  32. package/dist/types/Card/subComponents.d.ts.map +1 -1
  33. package/dist/types/ChartLegend/ChartLegend.d.ts.map +1 -1
  34. package/dist/types/ChartLegend/ChartLegendTypes.d.ts +8 -5
  35. package/dist/types/ChartLegend/ChartLegendTypes.d.ts.map +1 -1
  36. package/dist/types/ChartLegend/useChartLabels.d.ts +4 -0
  37. package/dist/types/ChartLegend/useChartLabels.d.ts.map +1 -0
  38. package/dist/types/Checkbox/styles.d.ts +1 -1
  39. package/dist/types/Checkbox/styles.d.ts.map +1 -1
  40. package/dist/types/Collapsible/styles.d.ts +1 -1
  41. package/dist/types/DatePicker/styles.d.ts +1 -1
  42. package/dist/types/Drawer/styles.d.ts +1 -1
  43. package/dist/types/Drawer/styles.d.ts.map +1 -1
  44. package/dist/types/Fieldset/styles.d.ts +1 -1
  45. package/dist/types/Fieldset/styles.d.ts.map +1 -1
  46. package/dist/types/Menu/Menu.d.ts.map +1 -1
  47. package/dist/types/Menu/styles.d.ts +2 -2
  48. package/dist/types/Menu/styles.d.ts.map +1 -1
  49. package/dist/types/Message/styles.d.ts +5 -5
  50. package/dist/types/Message/styles.d.ts.map +1 -1
  51. package/dist/types/Modal/Modal.d.ts +1 -1
  52. package/dist/types/Modal/styles.d.ts +4 -4
  53. package/dist/types/Modal/styles.d.ts.map +1 -1
  54. package/dist/types/Numeral/Numeral.d.ts.map +1 -1
  55. package/dist/types/Numeral/NumeralTypes.d.ts +2 -0
  56. package/dist/types/Numeral/NumeralTypes.d.ts.map +1 -1
  57. package/dist/types/Numeral/__tests__/features/testNumeral.d.ts.map +1 -1
  58. package/dist/types/SegmentedControl/styles.d.ts +2 -2
  59. package/dist/types/SegmentedControl/styles.d.ts.map +1 -1
  60. package/dist/types/Skeleton/Skeleton.d.ts +1 -1
  61. package/dist/types/Skeleton/Skeleton.d.ts.map +1 -1
  62. package/dist/types/TableHeaderCell/TableHeaderCell.d.ts.map +1 -1
  63. package/dist/types/Toast/styles.d.ts +2 -1
  64. package/dist/types/Toast/styles.d.ts.map +1 -1
  65. package/dist/types/Tooltip/styles.d.ts +1 -1
  66. package/dist/types/Tooltip/styles.d.ts.map +1 -1
  67. package/dist/types/index.d.ts +1 -5
  68. package/dist/types/index.d.ts.map +1 -1
  69. package/dist/types/themes/dark/theme.d.ts +28 -0
  70. package/dist/types/themes/dark/theme.d.ts.map +1 -1
  71. package/dist/types/themes/light/theme.d.ts +56 -0
  72. package/dist/types/themes/light/theme.d.ts.map +1 -1
  73. package/dist/types/utils/use-measure.d.ts +14 -0
  74. package/dist/types/utils/use-measure.d.ts.map +1 -0
  75. package/lib/Card/subComponents.js +14 -7
  76. package/lib/ChartLegend/ChartLegend.js +5 -23
  77. package/lib/ChartLegend/useChartLabels.js +33 -0
  78. package/lib/Collapsible/Collapsible.js +1 -1
  79. package/lib/Link/Link.js +2 -1
  80. package/lib/Menu/Menu.js +69 -55
  81. package/lib/Menu/styles.js +1 -1
  82. package/lib/Numeral/Numeral.js +11 -2
  83. package/lib/TableHeaderCell/TableHeaderCell.js +3 -1
  84. package/lib/Toast/styles.js +2 -3
  85. package/lib/index.flow.js +1 -7
  86. package/lib/index.js +2 -7
  87. package/lib/themes/light/theme.js +30 -0
  88. package/lib/utils/use-measure.js +59 -0
  89. package/package.json +14 -20
  90. package/__flow__/OverflowList/OverflowList.flow.js +0 -22
  91. package/__flow__/OverflowList/index.flow.js +0 -2
  92. package/__flow__/dataviz/DataVizRotation.flow.js +0 -12
  93. package/__flow__/dataviz/index.flow.js +0 -2
  94. package/commonjs/OverflowList/OverflowList.flow.js +0 -6
  95. package/commonjs/OverflowList/OverflowList.js +0 -115
  96. package/commonjs/OverflowList/OverflowListTypes.js +0 -5
  97. package/commonjs/OverflowList/index.flow.js +0 -16
  98. package/commonjs/OverflowList/index.js +0 -31
  99. package/commonjs/OverflowList/styles.js +0 -25
  100. package/commonjs/dataviz/DataVizRotation.flow.js +0 -6
  101. package/commonjs/dataviz/DataVizRotation.js +0 -21
  102. package/commonjs/dataviz/DataVizRotationTypes.js +0 -5
  103. package/commonjs/dataviz/index.flow.js +0 -16
  104. package/commonjs/dataviz/index.js +0 -27
  105. package/dist/types/OverflowList/OverflowList.d.ts +0 -5
  106. package/dist/types/OverflowList/OverflowList.d.ts.map +0 -1
  107. package/dist/types/OverflowList/OverflowListTypes.d.ts +0 -16
  108. package/dist/types/OverflowList/OverflowListTypes.d.ts.map +0 -1
  109. package/dist/types/OverflowList/index.d.ts +0 -5
  110. package/dist/types/OverflowList/index.d.ts.map +0 -1
  111. package/dist/types/OverflowList/styles.d.ts +0 -4
  112. package/dist/types/OverflowList/styles.d.ts.map +0 -1
  113. package/dist/types/dataviz/DataVizRotation.d.ts +0 -5
  114. package/dist/types/dataviz/DataVizRotation.d.ts.map +0 -1
  115. package/dist/types/dataviz/DataVizRotationTypes.d.ts +0 -5
  116. package/dist/types/dataviz/DataVizRotationTypes.d.ts.map +0 -1
  117. package/dist/types/dataviz/index.d.ts +0 -3
  118. package/dist/types/dataviz/index.d.ts.map +0 -1
  119. package/lib/OverflowList/OverflowList.flow.js +0 -1
  120. package/lib/OverflowList/OverflowList.js +0 -104
  121. package/lib/OverflowList/OverflowListTypes.js +0 -1
  122. package/lib/OverflowList/index.flow.js +0 -1
  123. package/lib/OverflowList/index.js +0 -4
  124. package/lib/OverflowList/styles.js +0 -14
  125. package/lib/dataviz/DataVizRotation.flow.js +0 -1
  126. package/lib/dataviz/DataVizRotation.js +0 -13
  127. package/lib/dataviz/DataVizRotationTypes.js +0 -1
  128. package/lib/dataviz/index.flow.js +0 -1
  129. package/lib/dataviz/index.js +0 -2
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { useTheme } from 'styled-components';
3
+ import { Label, Swatch } from "./styles";
4
+ import { Text } from "../Text";
5
+ var getSwatchColor = function getSwatchColor(theme, index, RacineThemeColors) {
6
+ var COMPARE_THEME = [RacineThemeColors.dataviz.map['1'], RacineThemeColors.dataviz.map['10'], RacineThemeColors.dataviz.map['11'], RacineThemeColors.dataviz.map['2']];
7
+ var CONTRAST_THEME = [RacineThemeColors.dataviz.map['1'], RacineThemeColors.dataviz.map['2'], RacineThemeColors.dataviz.map['3'], RacineThemeColors.dataviz.map['4'], RacineThemeColors.dataviz.map['5'], RacineThemeColors.dataviz.map['6'], RacineThemeColors.dataviz.map['4'], RacineThemeColors.dataviz.map['5'], RacineThemeColors.dataviz.map['6'], RacineThemeColors.dataviz.map['7'], RacineThemeColors.dataviz.map['8'], RacineThemeColors.dataviz.map['9'], RacineThemeColors.dataviz.map['10']];
8
+ var EXTENDED_THEME = [RacineThemeColors.dataviz.map['7'], RacineThemeColors.dataviz.map['1'], RacineThemeColors.dataviz.map['5'], RacineThemeColors.dataviz.map['11'], RacineThemeColors.dataviz.map['6'], RacineThemeColors.dataviz.map['3'], RacineThemeColors.dataviz.map['18'], RacineThemeColors.dataviz.map['8'], RacineThemeColors.dataviz.map['4'], RacineThemeColors.dataviz.map['13'], RacineThemeColors.dataviz.map['16'], RacineThemeColors.dataviz.map['10'], RacineThemeColors.dataviz.map['14'], RacineThemeColors.dataviz.map['2'], RacineThemeColors.dataviz.map['15'], RacineThemeColors.dataviz.map['12'], RacineThemeColors.dataviz.map['9'], RacineThemeColors.dataviz.map['17'], RacineThemeColors.dataviz.map['20'], RacineThemeColors.dataviz.map['19']];
9
+ var THEME_MAP = {
10
+ COMPARE: COMPARE_THEME,
11
+ CONTRAST: CONTRAST_THEME,
12
+ EXTENDED: EXTENDED_THEME,
13
+ DATAVIZROTATION: RacineThemeColors.dataviz.list
14
+ };
15
+ return THEME_MAP[theme.toUpperCase()][index];
16
+ };
17
+ export var useChartLabels = function useChartLabels(legendLabels, theme) {
18
+ var racineTheme = useTheme();
19
+ var colors = racineTheme.colors;
20
+ return legendLabels.map(function (label, i) {
21
+ var labelColor = label.color ? label.color : getSwatchColor(theme, i, colors);
22
+ return /*#__PURE__*/React.createElement(Label, {
23
+ key: label.name
24
+ }, /*#__PURE__*/React.createElement(Swatch, {
25
+ bg: labelColor,
26
+ "data-qa-swatch": ""
27
+ }), /*#__PURE__*/React.createElement(Text, {
28
+ as: "div",
29
+ fontSize: 200,
30
+ breakWord: true
31
+ }, label.name));
32
+ });
33
+ };
@@ -17,7 +17,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
  import * as React from 'react';
19
19
  import { useState, useRef, useContext, useEffect } from 'react';
20
- import useMeasure from 'use-measure';
20
+ import { useMeasure } from "../utils/use-measure";
21
21
  import Box from "../Box";
22
22
  import { CollapsingBox } from "./styles";
23
23
  var idCounter = 0;
package/lib/Link/Link.js CHANGED
@@ -11,7 +11,8 @@ var Link = function Link(_ref) {
11
11
  disabled = _ref.disabled,
12
12
  onClick = _ref.onClick,
13
13
  as = _ref.as,
14
- underline = _ref.underline,
14
+ _ref$underline = _ref.underline,
15
+ underline = _ref$underline === void 0 ? true : _ref$underline,
15
16
  _ref$qa = _ref.qa,
16
17
  qa = _ref$qa === void 0 ? {} : _ref$qa,
17
18
  rest = _objectWithoutProperties(_ref, _excluded);
package/lib/Menu/Menu.js CHANGED
@@ -237,29 +237,49 @@ export var MenuRadio = function MenuRadio(props) {
237
237
  role: MENU_ITEM_ROLES.RADIO
238
238
  }, props));
239
239
  };
240
- export var MenuGroup = function MenuGroup(_ref2) {
241
- var children = _ref2.children,
242
- title = _ref2.title,
243
- titleAs = _ref2.titleAs,
244
- _ref2$disabled = _ref2.disabled,
245
- isDisabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
246
- props = _objectWithoutProperties(_ref2, _excluded2);
247
- return /*#__PURE__*/React.createElement(React.Fragment, null, title && /*#__PURE__*/React.createElement(Box, {
248
- pl: 400,
240
+ var MenuTitle = styled(Text).withConfig({
241
+ displayName: "Menu__MenuTitle",
242
+ componentId: "sc-1jmjosz-0"
243
+ })(["font-weight:600;padding-left:", ";padding-top:", ";padding-bottom:", ";color:", ";"], function (_ref2) {
244
+ var theme = _ref2.theme;
245
+ return theme.space[300];
246
+ }, function (_ref3) {
247
+ var theme = _ref3.theme;
248
+ return theme.space[200];
249
+ }, function (_ref4) {
250
+ var theme = _ref4.theme;
251
+ return theme.space[300];
252
+ }, function (_ref5) {
253
+ var theme = _ref5.theme;
254
+ return theme.colors.text.headline;
255
+ });
256
+ var _StyledMenuTitle = styled(MenuTitle).withConfig({
257
+ displayName: "Menu___StyledMenuTitle",
258
+ componentId: "sc-1jmjosz-1"
259
+ })(["", ""], function (p) {
260
+ return p.$_css;
261
+ });
262
+ export var MenuGroup = function MenuGroup(_ref6) {
263
+ var children = _ref6.children,
264
+ title = _ref6.title,
265
+ titleAs = _ref6.titleAs,
266
+ _ref6$disabled = _ref6.disabled,
267
+ isDisabled = _ref6$disabled === void 0 ? false : _ref6$disabled,
268
+ props = _objectWithoutProperties(_ref6, _excluded2);
269
+ var menuTitleId = uniqueId('menu-title-');
270
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, _extends({
271
+ p: 300,
272
+ role: "group",
273
+ "aria-labelledby": title ? menuTitleId : undefined,
249
274
  borderTop: "1px solid",
250
- borderColor: "container.border.base",
251
- mt: "-1px"
252
- }, /*#__PURE__*/React.createElement(_StyledText, {
253
- forwardedAs: titleAs || 'div',
275
+ borderColor: "container.border.base"
276
+ }, props), title && /*#__PURE__*/React.createElement(_StyledMenuTitle, {
277
+ id: menuTitleId,
278
+ role: "presentation",
254
279
  fontSize: 200,
255
- fontWeight: 600,
256
- mt: 350,
257
- color: "text.headline",
280
+ forwardedAs: titleAs || 'li',
258
281
  $_css: isDisabled ? disabled : undefined
259
- }, title)), /*#__PURE__*/React.createElement(Box, _extends({}, props, {
260
- p: 300,
261
- role: "group"
262
- }), children));
282
+ }, title), children));
263
283
  };
264
284
  export var MenuDivider = function MenuDivider(props) {
265
285
  return /*#__PURE__*/React.createElement(Box, _extends({
@@ -302,12 +322,12 @@ var MenuFilterInput = function MenuFilterInput(props) {
302
322
  onBlur: handleOnBlur
303
323
  }));
304
324
  };
305
- var MenuItems = function MenuItems(_ref3) {
306
- var children = _ref3.children,
307
- role = _ref3.role,
308
- multiselect = _ref3.multiselect,
309
- innerRef = _ref3.innerRef,
310
- props = _objectWithoutProperties(_ref3, _excluded3);
325
+ var MenuItems = function MenuItems(_ref7) {
326
+ var children = _ref7.children,
327
+ role = _ref7.role,
328
+ multiselect = _ref7.multiselect,
329
+ innerRef = _ref7.innerRef,
330
+ props = _objectWithoutProperties(_ref7, _excluded3);
311
331
  var _useMenuKeyDown = useMenuKeyDown(),
312
332
  handleKeyDown = _useMenuKeyDown.handleKeyDown,
313
333
  activeDescendent = _useMenuKeyDown.activeDescendent;
@@ -327,15 +347,15 @@ var MenuItems = function MenuItems(_ref3) {
327
347
  overflow: "hidden"
328
348
  }), children);
329
349
  };
330
- export var Menu = function Menu(_ref4) {
331
- var _ref4$role = _ref4.role,
332
- role = _ref4$role === void 0 ? MENU_ROLES.MENU : _ref4$role,
333
- children = _ref4.children,
334
- onChange = _ref4.onChange,
335
- value = _ref4.value,
336
- multiselect = _ref4.multiselect,
337
- innerRef = _ref4.innerRef,
338
- props = _objectWithoutProperties(_ref4, _excluded4);
350
+ export var Menu = function Menu(_ref8) {
351
+ var _ref8$role = _ref8.role,
352
+ role = _ref8$role === void 0 ? MENU_ROLES.MENU : _ref8$role,
353
+ children = _ref8.children,
354
+ onChange = _ref8.onChange,
355
+ value = _ref8.value,
356
+ multiselect = _ref8.multiselect,
357
+ innerRef = _ref8.innerRef,
358
+ props = _objectWithoutProperties(_ref8, _excluded4);
339
359
  var _useDescendants = useDescendants(),
340
360
  _useDescendants2 = _slicedToArray(_useDescendants, 2),
341
361
  descendants = _useDescendants2[0],
@@ -392,20 +412,20 @@ Menu.Divider = MenuDivider;
392
412
  Menu.FilterInput = MenuFilterInput;
393
413
  var CustomPopoutContent = styled(Popout.Content).withConfig({
394
414
  displayName: "Menu__CustomPopoutContent",
395
- componentId: "sc-1jmjosz-0"
415
+ componentId: "sc-1jmjosz-2"
396
416
  })(["padding:0;margin-left:0;margin-right:0;"]);
397
- export var MenuButton = function MenuButton(_ref5) {
398
- var content = _ref5.content,
399
- popoutProps = _ref5.popoutProps,
400
- children = _ref5.children,
401
- _onClick = _ref5.onClick,
402
- _ref5$closeOnItemClic = _ref5.closeOnItemClick,
403
- closeOnItemClick = _ref5$closeOnItemClic === void 0 ? true : _ref5$closeOnItemClic,
404
- _ref5$id = _ref5.id,
405
- id = _ref5$id === void 0 ? uniqueId('MenuButton-') : _ref5$id,
406
- _ref5$placement = _ref5.placement,
407
- placement = _ref5$placement === void 0 ? 'bottom' : _ref5$placement,
408
- props = _objectWithoutProperties(_ref5, _excluded5);
417
+ export var MenuButton = function MenuButton(_ref9) {
418
+ var content = _ref9.content,
419
+ popoutProps = _ref9.popoutProps,
420
+ children = _ref9.children,
421
+ _onClick = _ref9.onClick,
422
+ _ref9$closeOnItemClic = _ref9.closeOnItemClick,
423
+ closeOnItemClick = _ref9$closeOnItemClic === void 0 ? true : _ref9$closeOnItemClic,
424
+ _ref9$id = _ref9.id,
425
+ id = _ref9$id === void 0 ? uniqueId('MenuButton-') : _ref9$id,
426
+ _ref9$placement = _ref9.placement,
427
+ placement = _ref9$placement === void 0 ? 'bottom' : _ref9$placement,
428
+ props = _objectWithoutProperties(_ref9, _excluded5);
409
429
  var _useState5 = useState(false),
410
430
  _useState6 = _slicedToArray(_useState5, 2),
411
431
  isOpen = _useState6[0],
@@ -445,10 +465,4 @@ export var MenuButton = function MenuButton(_ref5) {
445
465
  }
446
466
  }), children)));
447
467
  };
448
- export default Menu;
449
- var _StyledText = styled(Text).withConfig({
450
- displayName: "Menu___StyledText",
451
- componentId: "sc-1jmjosz-1"
452
- })(["", ""], function (p) {
453
- return p.$_css;
454
- });
468
+ export default Menu;
@@ -44,4 +44,4 @@ export var MenuItemContainer = styled(Box).withConfig({
44
44
  export var MenuItemsContainer = styled(Box).withConfig({
45
45
  displayName: "styles__MenuItemsContainer",
46
46
  componentId: "sc-168zlb1-1"
47
- })(["list-style-type:none;&:focus{", "}"], focusRing);
47
+ })(["list-style-type:none;&:focus{", "}& > div[role='group']:first-of-type{border-top:none;}"], focusRing);
@@ -1,4 +1,4 @@
1
- var _excluded = ["number", "locale", "format", "currency", "abbreviate", "precision", "qa"];
1
+ var _excluded = ["number", "locale", "format", "currency", "abbreviate", "invalidNumberLabel", "precision", "qa"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -12,6 +12,7 @@ import * as React from 'react';
12
12
  import memoize from 'lru-memoize';
13
13
  import { EM_DASH } from "../utils/constants";
14
14
  import Tooltip from "../Tooltip";
15
+ import { VisuallyHidden } from "../VisuallyHidden";
15
16
  import { DEFAULT_THRESHOLD, MEMO_CACHE_SIZE, COMPARE_OBJECTS, MAX_PRECISION, ABBREV_PRECISION, DefaultPrecisions } from "./constants";
16
17
  import { AbbrContainer, Container } from "./styles";
17
18
  var _getNumberFormatters = function _getNumberFormatters(options) {
@@ -76,6 +77,7 @@ var normalizeArgs = function normalizeArgs(props) {
76
77
  currency = _props$currency === void 0 ? 'USD' : _props$currency,
77
78
  _props$abbreviate = props.abbreviate,
78
79
  abbreviate = _props$abbreviate === void 0 ? true : _props$abbreviate,
80
+ invalidNumberLabel = props.invalidNumberLabel,
79
81
  precision = props.precision,
80
82
  qa = props.qa,
81
83
  rest = _objectWithoutProperties(props, _excluded);
@@ -97,6 +99,7 @@ var normalizeArgs = function normalizeArgs(props) {
97
99
  return {
98
100
  value: value,
99
101
  canAbbreviate: canAbbreviate,
102
+ invalidNumberLabel: invalidNumberLabel,
100
103
  options: options,
101
104
  qa: qa,
102
105
  rest: rest
@@ -106,10 +109,16 @@ var Numeral = function Numeral(props) {
106
109
  var _normalizeArgs = normalizeArgs(props),
107
110
  value = _normalizeArgs.value,
108
111
  canAbbreviate = _normalizeArgs.canAbbreviate,
112
+ invalidNumberLabel = _normalizeArgs.invalidNumberLabel,
109
113
  options = _normalizeArgs.options,
110
114
  qa = _normalizeArgs.qa,
111
115
  rest = _normalizeArgs.rest;
112
- if (!isValidNumber(props.number)) return /*#__PURE__*/React.createElement(Container, qa, EM_DASH);
116
+ if (!isValidNumber(props.number)) return /*#__PURE__*/React.createElement(React.Fragment, null, invalidNumberLabel &&
117
+ /*#__PURE__*/
118
+ // Give screen readers something useful to read off + hide the em dash
119
+ React.createElement(VisuallyHidden, null, invalidNumberLabel), /*#__PURE__*/React.createElement(Container, _extends({
120
+ "aria-hidden": true
121
+ }, qa), EM_DASH));
113
122
  var formatters = getNumberFormatters(options);
114
123
  var fullText = formatters.standard.format(value);
115
124
  if (canAbbreviate) {
@@ -45,12 +45,14 @@ export var TableHeaderCell = /*#__PURE__*/function (_React$Component) {
45
45
  }));
46
46
  });
47
47
  _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
48
- e.preventDefault();
49
48
  var _this$props = _this.props,
50
49
  onClick = _this$props.onClick,
51
50
  onSort = _this$props.onSort,
52
51
  isSortable = _this$props.isSortable,
53
52
  id = _this$props.id;
53
+ if (onClick || isSortable) {
54
+ e.preventDefault();
55
+ }
54
56
  if (onClick) {
55
57
  // @ts-note: Right now the `onClick` is incorrectly set to consume an HTMLButtonElement event
56
58
  onClick(e);
@@ -1,8 +1,7 @@
1
1
  import styled, { createGlobalStyle } from 'styled-components';
2
- // TODO: this is something ugly that needs to be fixed
3
2
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
3
  // @ts-ignore
5
- import toastStyles from '!!raw-loader!react-toastify/dist/ReactToastify.css'; // eslint-disable-line import/no-unresolved
4
+ import 'react-toastify/dist/ReactToastify.css';
6
5
  import Box from "../Box";
7
6
  import Icon from "../Icon";
8
7
  var Container = styled(Box).withConfig({
@@ -25,7 +24,7 @@ export var CustomIcon = styled(Icon).withConfig({
25
24
  }, function (p) {
26
25
  return p.customColor ? undefined : p.theme.colors.icon[p.type];
27
26
  });
28
- export var GlobalToastStyles = createGlobalStyle(["", " .Toastify__toast{box-shadow:", ";background:transparent;}.Toastify__toast:last-of-type{margin-bottom:0;}.Toastify-container-overrides{padding:0;width:360px;}.Toastify-toast-overrides{padding:0;min-height:0;border-radius:2px;}.Toastify__toast-container--bottom-right{bottom:", ";right:", ";}@media only screen and (max-width:480px){.Toastify-container-overrides{min-width:initial;}}"], toastStyles, function (p) {
27
+ export var GlobalToastStyles = createGlobalStyle([".Toastify__toast{box-shadow:", " !important;background:transparent !important;}.Toastify__toast:last-of-type{margin-bottom:0 !important;}.Toastify-container-overrides{padding:0 !important;width:360px !important;}.Toastify-toast-overrides{padding:0 !important;min-height:0 !important;border-radius:2px !important;}.Toastify__toast-container--bottom-right{bottom:", " !important;right:", " !important;}@media only screen and (max-width:480px){.Toastify-container-overrides{min-width:initial !important;}}"], function (p) {
29
28
  return p.theme.shadows.low;
30
29
  }, function (p) {
31
30
  return p.theme.space[400];
package/lib/index.flow.js CHANGED
@@ -42,7 +42,6 @@ export { default as Menu, MenuButton, MenuButtonContext, MenuItemContainer } fro
42
42
  export { default as Message } from "./Message/index.flow";
43
43
  export { default as Modal } from "./Modal/index.flow";
44
44
  export { default as Numeral } from "./Numeral/index.flow";
45
- export { default as OverflowList } from "./OverflowList/index.flow";
46
45
  export { default as PartnerLogo } from "./PartnerLogo/index.flow";
47
46
  export { default as Popout } from "./Popout/index.flow";
48
47
  export { default as Radio } from "./Radio/index.flow";
@@ -77,9 +76,4 @@ export { legacyBadgeColors } from "./Badge/index.flow";
77
76
  /**
78
77
  * @deprecated Alert has been renamed to Banner
79
78
  */
80
- export { default as Alert } from "./Banner/index.flow";
81
-
82
- /**
83
- * Should this be exported? @deprecated?
84
- */
85
- export { DataVizRotation } from "./dataviz/index.flow";
79
+ export { default as Alert } from "./Banner/index.flow";
package/lib/index.js CHANGED
@@ -15,6 +15,7 @@ export { default as ThemeProvider } from "./ThemeProvider";
15
15
  export { useSelect, useMultiselect, useTextContent } from "./utils/hooks";
16
16
  export { visuallyHidden, focusRing, disabled } from "./utils/mixins";
17
17
  export { useInteractiveColor } from "./utils/useInteractiveColor";
18
+ export { useMeasure } from "./utils/use-measure";
18
19
 
19
20
  /* Components */
20
21
  export * from "./Avatar";
@@ -47,7 +48,6 @@ export * from "./Menu";
47
48
  export * from "./Message";
48
49
  export * from "./Modal";
49
50
  export * from "./Numeral";
50
- export * from "./OverflowList";
51
51
  export * from "./PartnerLogo";
52
52
  export * from "./Popout";
53
53
  export * from "./Radio";
@@ -74,9 +74,4 @@ export * from "./VisuallyHidden";
74
74
  /**
75
75
  * @deprecated Alert has been renamed to Banner
76
76
  */
77
- export { Banner as Alert } from "./Banner";
78
-
79
- /**
80
- * Should this be exported? @deprecated?
81
- */
82
- export * from "./dataviz";
77
+ export { Banner as Alert } from "./Banner";
@@ -286,6 +286,34 @@ export var typography = {
286
286
  1100: TYPOGRAPHY.TYPOGRAPHY_SIZE_1100,
287
287
  1200: TYPOGRAPHY.TYPOGRAPHY_SIZE_1200
288
288
  };
289
+ export var fontSizes = {
290
+ 100: TYPOGRAPHY.TYPOGRAPHY_SIZE_100.fontSize,
291
+ 200: TYPOGRAPHY.TYPOGRAPHY_SIZE_200.fontSize,
292
+ 300: TYPOGRAPHY.TYPOGRAPHY_SIZE_300.fontSize,
293
+ 400: TYPOGRAPHY.TYPOGRAPHY_SIZE_400.fontSize,
294
+ 500: TYPOGRAPHY.TYPOGRAPHY_SIZE_500.fontSize,
295
+ 600: TYPOGRAPHY.TYPOGRAPHY_SIZE_600.fontSize,
296
+ 700: TYPOGRAPHY.TYPOGRAPHY_SIZE_700.fontSize,
297
+ 800: TYPOGRAPHY.TYPOGRAPHY_SIZE_800.fontSize,
298
+ 900: TYPOGRAPHY.TYPOGRAPHY_SIZE_900.fontSize,
299
+ 1000: TYPOGRAPHY.TYPOGRAPHY_SIZE_1000.fontSize,
300
+ 1100: TYPOGRAPHY.TYPOGRAPHY_SIZE_1100.fontSize,
301
+ 1200: TYPOGRAPHY.TYPOGRAPHY_SIZE_1200.fontSize
302
+ };
303
+ export var lineHeights = {
304
+ 100: TYPOGRAPHY.TYPOGRAPHY_SIZE_100.lineHeight,
305
+ 200: TYPOGRAPHY.TYPOGRAPHY_SIZE_200.lineHeight,
306
+ 300: TYPOGRAPHY.TYPOGRAPHY_SIZE_300.lineHeight,
307
+ 400: TYPOGRAPHY.TYPOGRAPHY_SIZE_400.lineHeight,
308
+ 500: TYPOGRAPHY.TYPOGRAPHY_SIZE_500.lineHeight,
309
+ 600: TYPOGRAPHY.TYPOGRAPHY_SIZE_600.lineHeight,
310
+ 700: TYPOGRAPHY.TYPOGRAPHY_SIZE_700.lineHeight,
311
+ 800: TYPOGRAPHY.TYPOGRAPHY_SIZE_800.lineHeight,
312
+ 900: TYPOGRAPHY.TYPOGRAPHY_SIZE_900.lineHeight,
313
+ 1000: TYPOGRAPHY.TYPOGRAPHY_SIZE_1000.lineHeight,
314
+ 1100: TYPOGRAPHY.TYPOGRAPHY_SIZE_1100.lineHeight,
315
+ 1200: TYPOGRAPHY.TYPOGRAPHY_SIZE_1200.lineHeight
316
+ };
289
317
  export var fontFamily = TYPOGRAPHY.TYPOGRAPHY_FAMILY;
290
318
  export var fontWeights = {
291
319
  normal: TYPOGRAPHY.TYPOGRAPHY_WEIGHT_NORMAL,
@@ -340,6 +368,8 @@ var theme = {
340
368
  typography: _objectSpread(_objectSpread({}, typography), {}, {
341
369
  typography: typography
342
370
  }),
371
+ fontSizes: fontSizes,
372
+ lineHeights: lineHeights,
343
373
  fontFamily: fontFamily,
344
374
  fontWeights: fontWeights,
345
375
  space: _objectSpread(_objectSpread({}, space), {}, {
@@ -0,0 +1,59 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useState, useLayoutEffect } from 'react';
8
+ var initialBounds = Object.freeze({
9
+ x: 0,
10
+ y: 0,
11
+ width: 0,
12
+ height: 0,
13
+ top: 0,
14
+ right: 0,
15
+ bottom: 0,
16
+ left: 0
17
+ });
18
+ export function useMeasure(ref) {
19
+ var _useState = useState(initialBounds),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ bounds = _useState2[0],
22
+ setContentRect = _useState2[1];
23
+ useLayoutEffect(function () {
24
+ var element = ref.current;
25
+ if (!element ||
26
+ // in non-browser environments (e.g. Jest tests) ResizeObserver is not defined
27
+ !('ResizeObserver' in window)) {
28
+ return;
29
+ }
30
+ var resizeObserver = new ResizeObserver(function (_ref) {
31
+ var _ref2 = _slicedToArray(_ref, 1),
32
+ entry = _ref2[0];
33
+ var _entry$contentRect = entry.contentRect,
34
+ x = _entry$contentRect.x,
35
+ y = _entry$contentRect.y,
36
+ width = _entry$contentRect.width,
37
+ height = _entry$contentRect.height,
38
+ top = _entry$contentRect.top,
39
+ right = _entry$contentRect.right,
40
+ bottom = _entry$contentRect.bottom,
41
+ left = _entry$contentRect.left;
42
+ setContentRect({
43
+ x: x,
44
+ y: y,
45
+ width: width,
46
+ height: height,
47
+ top: top,
48
+ right: right,
49
+ bottom: bottom,
50
+ left: left
51
+ });
52
+ });
53
+ resizeObserver.observe(ref.current);
54
+ return function () {
55
+ resizeObserver.disconnect();
56
+ };
57
+ }, [ref]);
58
+ return bounds;
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/racine",
3
- "version": "17.0.0",
3
+ "version": "19.0.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "__flow__",
@@ -61,8 +61,8 @@
61
61
  "**/*": [
62
62
  "prettier --write"
63
63
  ],
64
- "**/*.js": [
65
- "eslint --fix"
64
+ "**/*.{ts,tsx,js}": [
65
+ "eslint --max-warnings=0 --fix --ext .ts,.tsx,.js"
66
66
  ],
67
67
  "*.scss": [
68
68
  "stylelint --fix"
@@ -82,14 +82,12 @@
82
82
  "polished": "^3.4.1",
83
83
  "raw-loader": "^3.0.0",
84
84
  "react-focus-lock": "^2.0.3",
85
- "react-modal": "^3.8.1",
86
- "react-popper": "^1.3.3",
85
+ "react-modal": "^3.16.1",
86
+ "react-popper": "^1.3.11",
87
87
  "react-spring": "^8.0.25",
88
88
  "react-toastify": "^6.0.5",
89
- "react-virtualized": "9.18.5",
90
89
  "scroll-into-view-if-needed": "1.1.0",
91
- "styled-system": "^5.1.5",
92
- "use-measure": "^0.2.2"
90
+ "styled-system": "^5.1.5"
93
91
  },
94
92
  "devDependencies": {
95
93
  "@babel/cli": "^7.5.5",
@@ -125,11 +123,10 @@
125
123
  "@types/jest": "^27.0.0",
126
124
  "@types/jest-axe": "^3.5.5",
127
125
  "@types/node": "^16.15.0",
128
- "@types/react": "^16.0.0",
126
+ "@types/react": "^17.0.0",
129
127
  "@types/react-dates": "^21.8.3",
130
- "@types/react-dom": "^16.0.0",
131
- "@types/react-modal": "^3.13.1",
132
- "@types/react-virtualized": "9.18.*",
128
+ "@types/react-dom": "^17.0.0",
129
+ "@types/react-modal": "^3.16.0",
133
130
  "@types/styled-components": "^5.1.26",
134
131
  "@types/styled-system": "^5.1.15",
135
132
  "@typescript-eslint/eslint-plugin": "^5.43.0",
@@ -180,9 +177,9 @@
180
177
  "pify": "^4.0.1",
181
178
  "prettier": "^2.7.1",
182
179
  "prop-types": "^15.6.1",
183
- "react": "^16.12.0",
180
+ "react": "^17.0.2",
184
181
  "react-dates": "^21.8.0",
185
- "react-dom": "^16.12.0",
182
+ "react-dom": "^17.0.2",
186
183
  "rimraf": "^2.6.3",
187
184
  "storybook-dark-mode": "^1.0.9",
188
185
  "styled-components": "^5.2.3",
@@ -207,15 +204,12 @@
207
204
  "@sproutsocial/seeds-typography": ">=2.0.0",
208
205
  "moment": "^2.29.4",
209
206
  "prop-types": "^15.0.0",
210
- "react": ">=16.8.0",
211
207
  "react-dates": "^21.8.0",
212
- "react-virtualized": "9.18.5",
213
- "styled-components": "^5.2.3",
214
- "react-dom": "^16.12.0"
208
+ "react-dom": "^16.8.0 || ^17.0.0",
209
+ "react": "^16.8.0 || ^17.0.0",
210
+ "styled-components": "^5.2.3"
215
211
  },
216
212
  "resolutions": {
217
- "@types/react": "^16.0.0",
218
- "@types/react-dom": "^16.0.0",
219
213
  "lodash": "^4.17.21",
220
214
  "react-popper/create-react-context": "^0.3.0",
221
215
  "glob-parent": "^5.1.2",
@@ -1,22 +0,0 @@
1
- // @flow
2
- import * as React from 'react';
3
- import type { TypeContainerProps } from "../Box/index.flow";
4
- export type TypeVirtualizedListProps = {|
5
- items: Array<*>,
6
- ItemComponent: React.ComponentType<*>,
7
- getItemProps: (*) => *,
8
- itemWrapperProps?: TypeContainerProps,
9
- containerProps?: TypeContainerProps,
10
- |};
11
- export type TypeOverflowListProps = {|
12
- height: string,
13
- width: string,
14
- items?: Array<*>,
15
- children?: React.Node,
16
- ItemComponent?: React.ComponentType<*>,
17
- getItemProps?: (*) => *,
18
- itemWrapperProps?: TypeContainerProps,
19
- containerProps?: TypeContainerProps,
20
- |};
21
- declare var OverflowList: React.StatelessFunctionalComponent<TypeOverflowListProps>;
22
- declare export default typeof OverflowList;
@@ -1,2 +0,0 @@
1
- // @flow
2
- export * from "./OverflowList.flow";
@@ -1,12 +0,0 @@
1
- // @flow
2
- import * as React from 'react';
3
- import type { TypeSproutTheme } from "../types/theme.flow";
4
- export type TypeDataVizRotationProps = {
5
- theme: TypeSproutTheme,
6
- ...
7
- };
8
- declare export var DataVizRotation: React.AbstractComponent<
9
- // Component props minus theme prop which is handled by withTheme
10
- $Diff<TypeDataVizRotationProps, {|
11
- theme: TypeSproutTheme
12
- |}>, void>;
@@ -1,2 +0,0 @@
1
- // @flow
2
- export * from "./DataVizRotation.flow";
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
- var React = _interopRequireWildcard(require("react"));
5
- 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); }
6
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }