@sproutsocial/racine 16.0.0 → 18.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 (101) hide show
  1. package/CHANGELOG.md +77 -0
  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__/EnumLogoNames.flow.js +1 -1
  6. package/__flow__/Icon/Icon.flow.js +2 -2
  7. package/__flow__/LogoViewBoxes.js +14 -0
  8. package/__flow__/Numeral/Numeral.flow.js +2 -0
  9. package/__flow__/PartnerLogo/PartnerLogo.flow.js +7 -2
  10. package/__flow__/PartnerLogo/index.flow.js +1 -2
  11. package/__flow__/Toast/Toast.flow.js +2 -2
  12. package/__flow__/index.flow.js +1 -2
  13. package/commonjs/Card/Card.js +14 -9
  14. package/commonjs/Card/index.js +8 -1
  15. package/commonjs/Card/styles.js +40 -12
  16. package/commonjs/Card/subComponents.js +46 -5
  17. package/commonjs/Card/utils.js +9 -5
  18. package/commonjs/ChartLegend/ChartLegend.js +6 -23
  19. package/commonjs/ChartLegend/useChartLabels.js +41 -0
  20. package/commonjs/Icon/Icon.js +3 -2
  21. package/commonjs/Link/Link.js +2 -1
  22. package/commonjs/LogoViewBoxes.js +14 -0
  23. package/commonjs/Menu/Menu.js +69 -55
  24. package/commonjs/Menu/styles.js +1 -1
  25. package/commonjs/Numeral/Numeral.js +11 -2
  26. package/commonjs/PartnerLogo/PartnerLogo.js +34 -29
  27. package/commonjs/PartnerLogo/PartnerLogoTypes.js +14 -3
  28. package/commonjs/PartnerLogo/index.flow.js +0 -11
  29. package/commonjs/Switch/styles.js +1 -1
  30. package/commonjs/iconNames.js +8 -0
  31. package/commonjs/illustrationNames.js +8 -0
  32. package/commonjs/index.js +24 -0
  33. package/commonjs/logoNames.js +8 -0
  34. package/dist/logo.svg +1 -1
  35. package/dist/logoList.js +1 -1
  36. package/dist/types/Card/Card.d.ts.map +1 -1
  37. package/dist/types/Card/CardTypes.d.ts +11 -1
  38. package/dist/types/Card/CardTypes.d.ts.map +1 -1
  39. package/dist/types/Card/index.d.ts +1 -1
  40. package/dist/types/Card/index.d.ts.map +1 -1
  41. package/dist/types/Card/styles.d.ts +9 -1
  42. package/dist/types/Card/styles.d.ts.map +1 -1
  43. package/dist/types/Card/subComponents.d.ts +5 -0
  44. package/dist/types/Card/subComponents.d.ts.map +1 -1
  45. package/dist/types/Card/utils.d.ts +2 -1
  46. package/dist/types/Card/utils.d.ts.map +1 -1
  47. package/dist/types/ChartLegend/ChartLegend.d.ts.map +1 -1
  48. package/dist/types/ChartLegend/ChartLegendTypes.d.ts +8 -5
  49. package/dist/types/ChartLegend/ChartLegendTypes.d.ts.map +1 -1
  50. package/dist/types/ChartLegend/useChartLabels.d.ts +4 -0
  51. package/dist/types/ChartLegend/useChartLabels.d.ts.map +1 -0
  52. package/dist/types/EnumLogoNames.d.ts +1 -1
  53. package/dist/types/EnumLogoNames.d.ts.map +1 -1
  54. package/dist/types/Icon/Icon.d.ts.map +1 -1
  55. package/dist/types/Icon/IconTypes.d.ts +2 -2
  56. package/dist/types/Icon/IconTypes.d.ts.map +1 -1
  57. package/dist/types/Menu/Menu.d.ts.map +1 -1
  58. package/dist/types/Menu/styles.d.ts.map +1 -1
  59. package/dist/types/Numeral/Numeral.d.ts.map +1 -1
  60. package/dist/types/Numeral/NumeralTypes.d.ts +2 -0
  61. package/dist/types/Numeral/NumeralTypes.d.ts.map +1 -1
  62. package/dist/types/Numeral/__tests__/features/testNumeral.d.ts.map +1 -1
  63. package/dist/types/PartnerLogo/PartnerLogo.d.ts.map +1 -1
  64. package/dist/types/PartnerLogo/PartnerLogoTypes.d.ts +13 -4
  65. package/dist/types/PartnerLogo/PartnerLogoTypes.d.ts.map +1 -1
  66. package/dist/types/Switch/styles.d.ts.map +1 -1
  67. package/dist/types/Toast/ToastTypes.d.ts +2 -2
  68. package/dist/types/Toast/ToastTypes.d.ts.map +1 -1
  69. package/dist/types/iconNames.d.ts +3 -0
  70. package/dist/types/iconNames.d.ts.map +1 -0
  71. package/dist/types/illustrationNames.d.ts +3 -0
  72. package/dist/types/illustrationNames.d.ts.map +1 -0
  73. package/dist/types/index.d.ts +3 -0
  74. package/dist/types/index.d.ts.map +1 -1
  75. package/dist/types/logoNames.d.ts +3 -0
  76. package/dist/types/logoNames.d.ts.map +1 -0
  77. package/lib/Card/Card.js +15 -10
  78. package/lib/Card/index.js +1 -1
  79. package/lib/Card/styles.js +38 -12
  80. package/lib/Card/subComponents.js +41 -4
  81. package/lib/Card/utils.js +9 -5
  82. package/lib/ChartLegend/ChartLegend.js +5 -23
  83. package/lib/ChartLegend/useChartLabels.js +33 -0
  84. package/lib/Icon/Icon.js +3 -2
  85. package/lib/Link/Link.js +2 -1
  86. package/lib/LogoViewBoxes.js +14 -0
  87. package/lib/Menu/Menu.js +69 -55
  88. package/lib/Menu/styles.js +1 -1
  89. package/lib/Numeral/Numeral.js +11 -2
  90. package/lib/PartnerLogo/PartnerLogo.js +34 -27
  91. package/lib/PartnerLogo/PartnerLogoTypes.js +13 -2
  92. package/lib/PartnerLogo/index.flow.js +1 -2
  93. package/lib/Switch/styles.js +1 -1
  94. package/lib/iconNames.js +1 -0
  95. package/lib/illustrationNames.js +1 -0
  96. package/lib/index.js +4 -0
  97. package/lib/logoNames.js +1 -0
  98. package/package.json +3 -2
  99. package/__flow__/PartnerLogo/TypePartnerNames.flow.js +0 -3
  100. package/commonjs/PartnerLogo/TypePartnerNames.flow.js +0 -1
  101. package/lib/PartnerLogo/TypePartnerNames.flow.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import styled from 'styled-components';
2
- import { border, color, flexbox, grid, layout, position, space } from 'styled-system';
2
+ import { border, color, flexbox, grid, layout, position, space, typography } from 'styled-system';
3
3
  import { focusRing, disabled } from "../utils/mixins";
4
4
  import Icon from "../Icon";
5
5
 
@@ -58,10 +58,22 @@ export var StyledSelectedIcon = styled(Icon).withConfig({
58
58
  var $selected = _ref10.$selected;
59
59
  return $selected && "\n opacity: 1;\n ";
60
60
  });
61
+ export var StyledCardLink = styled.a.withConfig({
62
+ displayName: "styles__StyledCardLink",
63
+ componentId: "sc-9tyqu4-5"
64
+ })(["font-family:", ";font-weight:", ";color:", ";", ";", " ", ""], function (p) {
65
+ return p.theme.fontFamily;
66
+ }, function (p) {
67
+ return p.theme.fontWeights.bold;
68
+ }, function (p) {
69
+ return p.theme.colors.text.headline;
70
+ }, function (p) {
71
+ return p.theme.typography[400];
72
+ }, color, typography);
61
73
  export var StyledCard = styled.div.withConfig({
62
74
  displayName: "styles__StyledCard",
63
- componentId: "sc-9tyqu4-5"
64
- })(["position:relative;display:flex;flex-direction:column;box-sizing:border-box;margin:0;background:", ";border:", " solid ", ";padding:", ";border-radius:", ";transition:box-shadow ", ",border ", ";&[role='link'],&[role='button'],&[role='checkbox']{cursor:pointer;}&:hover{box-shadow:", ";}&:focus{", "}", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (_ref11) {
75
+ componentId: "sc-9tyqu4-6"
76
+ })(["position:relative;display:flex;flex-direction:column;box-sizing:border-box;margin:0;background:", ";border:", " solid ", ";padding:", ";border-radius:", ";transition:box-shadow ", ",border ", ";&[role='button'],&[role='checkbox']{cursor:pointer;}", " &:hover{box-shadow:", ";}&:focus-within{", " ", ":focus{border:none;box-shadow:none;outline:none;}}&:focus{", "}", " ", " ", " ", " ", " ", " ", " ", " ", ""], function (_ref11) {
65
77
  var theme = _ref11.theme;
66
78
  return theme.colors.container.background.base;
67
79
  }, function (_ref12) {
@@ -84,15 +96,29 @@ export var StyledCard = styled.div.withConfig({
84
96
  var theme = _ref17.theme;
85
97
  return theme.duration.medium;
86
98
  }, function (_ref18) {
87
- var theme = _ref18.theme,
88
- _ref18$$elevation = _ref18.$elevation,
89
- $elevation = _ref18$$elevation === void 0 ? 'low' : _ref18$$elevation;
99
+ var $isRoleLink = _ref18.$isRoleLink;
100
+ return $isRoleLink && "\n\t\tcursor: pointer;\n\t";
101
+ }, function (_ref19) {
102
+ var theme = _ref19.theme,
103
+ _ref19$$elevation = _ref19.$elevation,
104
+ $elevation = _ref19$$elevation === void 0 ? 'low' : _ref19$$elevation;
90
105
  return theme.shadows[$elevation];
91
- }, focusRing, function (_ref19) {
92
- var $disabled = _ref19.$disabled;
93
- return $disabled && "\n ".concat(disabled, "\n ");
94
106
  }, function (_ref20) {
95
- var $selected = _ref20.$selected,
96
- theme = _ref20.theme;
107
+ var $isRoleLink = _ref20.$isRoleLink;
108
+ return $isRoleLink ? focusRing : null;
109
+ }, StyledCardLink, focusRing, function (_ref21) {
110
+ var $disabled = _ref21.$disabled;
111
+ return $disabled && "\n ".concat(disabled, "\n ");
112
+ }, function (_ref22) {
113
+ var $selected = _ref22.$selected,
114
+ theme = _ref22.theme;
97
115
  return $selected && "\n border: ".concat(theme.borderWidths[500], " solid ").concat(theme.colors.container.border.selected, "; \n ");
98
- }, border, color, flexbox, grid, layout, position, space);
116
+ }, border, color, flexbox, grid, layout, position, space);
117
+ export var StyledCardAffordance = styled(Icon).withConfig({
118
+ displayName: "styles__StyledCardAffordance",
119
+ componentId: "sc-9tyqu4-7"
120
+ })(["", ":hover &{transform:translateX(", ");}transition:", ";"], StyledCard, function (p) {
121
+ return p.theme.space[200];
122
+ }, function (p) {
123
+ return p.theme.duration.medium;
124
+ });
@@ -1,11 +1,14 @@
1
1
  var _excluded = ["children"],
2
2
  _excluded2 = ["children"],
3
- _excluded3 = ["children"];
3
+ _excluded3 = ["children"],
4
+ _excluded4 = ["affordance", "children", "external", "color"];
5
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
6
+ 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); }
4
7
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
8
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
- import React from 'react';
7
- import { useChildContext } from "./utils";
8
- import { StyledCardContent, StyledCardHeader, StyledCardFooter, StyledSelectedIcon, SelectedIconWrapper } from "./styles";
9
+ import React, { useContext } from 'react';
10
+ import { useChildContext, SubComponentContext } from "./utils";
11
+ import { StyledCardContent, StyledCardHeader, StyledCardFooter, StyledSelectedIcon, SelectedIconWrapper, StyledCardAffordance, StyledCardLink } from "./styles";
9
12
  export var CardContent = function CardContent(_ref) {
10
13
  var children = _ref.children,
11
14
  rest = _objectWithoutProperties(_ref, _excluded);
@@ -34,4 +37,38 @@ export var SelectedIcon = function SelectedIcon(_ref4) {
34
37
  name: "circle-check",
35
38
  $selected: $selected
36
39
  }));
40
+ };
41
+ export var CardAffordance = function CardAffordance(_ref5) {
42
+ var rest = _extends({}, (_objectDestructuringEmpty(_ref5), _ref5));
43
+ return /*#__PURE__*/React.createElement(StyledCardAffordance, _extends({}, rest, {
44
+ size: "mini",
45
+ name: "arrow-right"
46
+ // TODO: probably need to make this available to the top level for external links https://sprout.atlassian.net/browse/DS-2223
47
+ ,
48
+ "aria-hidden": true
49
+ }));
50
+ };
51
+ export var CardLink = function CardLink(_ref6) {
52
+ var affordance = _ref6.affordance,
53
+ children = _ref6.children,
54
+ _ref6$external = _ref6.external,
55
+ external = _ref6$external === void 0 ? false : _ref6$external,
56
+ color = _ref6.color,
57
+ rest = _objectWithoutProperties(_ref6, _excluded4);
58
+ var _useContext = useContext(SubComponentContext),
59
+ href = _useContext.href,
60
+ linkRef = _useContext.linkRef;
61
+ return /*#__PURE__*/React.createElement(StyledCardLink, _extends({}, rest, {
62
+ target: external ? '_blank' : undefined,
63
+ rel: external ? 'noreferrer' : undefined,
64
+ href: href,
65
+ ref: linkRef
66
+ // TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.
67
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
68
+ // @ts-ignore
69
+ ,
70
+ color: color
71
+ }), /*#__PURE__*/React.createElement(React.Fragment, null, children, affordance ? /*#__PURE__*/React.createElement(CardAffordance, {
72
+ ml: 300
73
+ }) : null));
37
74
  };
package/lib/Card/utils.js CHANGED
@@ -1,11 +1,15 @@
1
1
  import { createContext, useContext } from 'react';
2
2
  import { assertIsElement } from "../utils";
3
- export var SubComponentContext = /*#__PURE__*/createContext(
4
- // eslint-disable-next-line @typescript-eslint/no-empty-function
5
- function () {});
3
+ export var SubComponentContext = /*#__PURE__*/createContext({
4
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
5
+ setHasSubComponent: function setHasSubComponent() {},
6
+ href: '',
7
+ linkRef: null
8
+ });
6
9
  export function useChildContext() {
7
- var setHasSubComponent = useContext(SubComponentContext);
8
- setHasSubComponent(true);
10
+ var _useContext = useContext(SubComponentContext),
11
+ setHasSubComponent = _useContext.setHasSubComponent;
12
+ setHasSubComponent && setHasSubComponent(true);
9
13
  }
10
14
  export var navigateTo = function navigateTo(_ref) {
11
15
  var _ref$current, _window$open;
@@ -3,38 +3,20 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import * as React from 'react';
6
- import { THEME_MAP } from "../utils/chartColors";
7
- import { Text } from "../Text";
8
- import Container, { Label, Swatch } from "./styles";
9
- function getSwatchColor(theme, index) {
10
- return THEME_MAP[theme.toUpperCase()][index];
11
- }
12
- function getLabels(legendLabels, theme) {
13
- return legendLabels.map(function (label, i) {
14
- var labelColor = label.color ? label.color : getSwatchColor(theme, i);
15
- return /*#__PURE__*/React.createElement(Label, {
16
- key: label.name
17
- }, /*#__PURE__*/React.createElement(Swatch, {
18
- bg: labelColor,
19
- "data-qa-swatch": ""
20
- }), /*#__PURE__*/React.createElement(Text, {
21
- as: "div",
22
- fontSize: 200,
23
- breakWord: true
24
- }, label.name));
25
- });
26
- }
6
+ import Container from "./styles";
7
+ import { useChartLabels } from "./useChartLabels";
27
8
  var ChartLegend = function ChartLegend(_ref) {
28
9
  var legendLabels = _ref.legendLabels,
29
10
  stacked = _ref.stacked,
30
11
  _ref$theme = _ref.theme,
31
- theme = _ref$theme === void 0 ? 'compare' : _ref$theme,
12
+ theme = _ref$theme === void 0 ? 'datavizRotation' : _ref$theme,
32
13
  qa = _ref.qa,
33
14
  rest = _objectWithoutProperties(_ref, _excluded);
15
+ var chartLabels = useChartLabels(legendLabels, theme);
34
16
  return /*#__PURE__*/React.createElement(Container, _extends({
35
17
  inline: !stacked,
36
18
  "data-qa-chartlegend": "",
37
19
  qa: qa
38
- }, rest), getLabels(legendLabels, theme));
20
+ }, rest), chartLabels);
39
21
  };
40
22
  export default ChartLegend;
@@ -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
+ };
package/lib/Icon/Icon.js CHANGED
@@ -7,8 +7,9 @@ import * as React from 'react';
7
7
  import styled, { css } from 'styled-components';
8
8
  import iconViewBoxes from "../IconViewBoxes";
9
9
  import Box from "../Box";
10
- import PartnerLogo, { PartnerNames } from "../PartnerLogo";
10
+ import PartnerLogo from "../PartnerLogo";
11
11
  import { includes } from "../utils";
12
+ import PartnerLogoNames from "../logoNames";
12
13
 
13
14
  // TODO: get json file working in flow so this can be shared
14
15
  // import deprecatedIcons from './deprecatedIcons.json';
@@ -24,7 +25,7 @@ var Icon = function Icon(_ref) {
24
25
  color = _ref.color,
25
26
  svgProps = _ref.svgProps,
26
27
  rest = _objectWithoutProperties(_ref, _excluded);
27
- if (includes(PartnerNames, name)) {
28
+ if (includes(PartnerLogoNames, name)) {
28
29
  // Icon's "default" size is equivalent to PartnerLogo's "small" size
29
30
  var logoSize = size === 'default' ? 'small' : size;
30
31
  var logoProps = {
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);
@@ -1,8 +1,12 @@
1
1
  module.exports = {
2
2
  "adobe-experience-manager-dark": "0 0 16 17",
3
3
  "adobe-experience-manager": "0 0 16 17",
4
+ "android-dark": "0 0 18 18",
5
+ "android": "0 0 18 18",
4
6
  "apple-app-store-dark": "0 0 140 140",
5
7
  "apple-app-store": "0 0 140 140",
8
+ "apple-dark": "0 0 18 18",
9
+ "apple": "0 0 18 18",
6
10
  "bigcommerce-dark": "0 0 140 140",
7
11
  "bigcommerce-lockup-dark": "0 0 291 66",
8
12
  "bigcommerce-lockup": "0 0 291 66",
@@ -29,6 +33,8 @@ module.exports = {
29
33
  "facebook": "0 0 141 139",
30
34
  "feedly-dark": "0 0 141 123",
31
35
  "feedly": "0 0 141 123",
36
+ "github-dark": "0 0 18 18",
37
+ "github": "0 0 18 18",
32
38
  "glassdoor-dark": "0 0 140 196",
33
39
  "glassdoor": "0 0 140 196",
34
40
  "google-analytics-dark": "0 0 140 160",
@@ -57,8 +63,12 @@ module.exports = {
57
63
  "microsoft-dynamics": "0 0 140 227",
58
64
  "pinterest-dark": "0 0 140 141",
59
65
  "pinterest": "0 0 140 141",
66
+ "reddit-alien-dark": "0 0 18 18",
67
+ "reddit-alien": "0 0 18 18",
60
68
  "reddit-dark": "0 0 140 140",
61
69
  "reddit": "0 0 140 140",
70
+ "salesforce-cloud-dark": "0 0 20 18",
71
+ "salesforce-cloud": "0 0 20 18",
62
72
  "salesforce-dark": "0 0 140 99",
63
73
  "salesforce": "0 0 140 99",
64
74
  "shopify-dark": "0 0 140 159",
@@ -71,6 +81,10 @@ module.exports = {
71
81
  "sproutsocial-wordmark-dark": "0 0 320 52",
72
82
  "sproutsocial-wordmark": "0 0 320 52",
73
83
  "sproutsocial": "0 0 140 174",
84
+ "tableau-dark": "0 0 18 18",
85
+ "tableau-lockup-dark": "0 0 291 56",
86
+ "tableau-lockup": "0 0 291 56",
87
+ "tableau": "0 0 18 18",
74
88
  "tiktok-dark": "0 0 140 159",
75
89
  "tiktok": "0 0 140 159",
76
90
  "tripadvisor-dark": "0 0 140 140",
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) {
@@ -4,35 +4,42 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React from 'react';
6
6
  import { useTheme } from 'styled-components';
7
- // eslint-disable-next-line no-restricted-syntax
8
- import * as logoViewBoxes from "../LogoViewBoxes";
7
+ import logoViewBoxes from "../LogoViewBoxes";
9
8
  import Container from "./styles";
10
- var PartnerLogo = function PartnerLogo(_ref) {
11
- var partnerName = _ref.partnerName,
12
- backgroundType = _ref.backgroundType,
13
- _ref$logoType = _ref.logoType,
14
- logoType = _ref$logoType === void 0 ? 'symbol' : _ref$logoType,
15
- height = _ref.height,
16
- width = _ref.width,
17
- size = _ref.size,
18
- ariaLabel = _ref['aria-label'],
19
- svgProps = _ref.svgProps,
20
- rest = _objectWithoutProperties(_ref, _excluded);
9
+ var whichLogo = function whichLogo(_ref, mode) {
10
+ var backgroundType = _ref.backgroundType,
11
+ logoType = _ref.logoType,
12
+ partnerName = _ref.partnerName;
13
+ var logo = logoType && logoType !== 'symbol' ? partnerName + '-' + logoType : partnerName;
14
+ if (backgroundType && backgroundType === 'dark') {
15
+ return "".concat(logo, "-dark");
16
+ } else if (backgroundType && backgroundType === 'light') {
17
+ return logo;
18
+ } else if (mode === 'dark') {
19
+ return "".concat(logo, "-dark");
20
+ } else {
21
+ return logo;
22
+ }
23
+ };
24
+ var PartnerLogo = function PartnerLogo(_ref2) {
25
+ var partnerName = _ref2.partnerName,
26
+ backgroundType = _ref2.backgroundType,
27
+ _ref2$logoType = _ref2.logoType,
28
+ logoType = _ref2$logoType === void 0 ? 'symbol' : _ref2$logoType,
29
+ height = _ref2.height,
30
+ width = _ref2.width,
31
+ size = _ref2.size,
32
+ ariaLabel = _ref2['aria-label'],
33
+ svgProps = _ref2.svgProps,
34
+ rest = _objectWithoutProperties(_ref2, _excluded);
21
35
  var _useTheme = useTheme(),
22
36
  mode = _useTheme.mode;
23
- var whichLogo = function whichLogo(type) {
24
- var logo = logoType && logoType !== 'symbol' ? partnerName + '-' + logoType : partnerName;
25
- if (type && type === 'dark') {
26
- return "".concat(logo, "-dark");
27
- } else if (type && type === 'light') {
28
- return logo;
29
- } else if (mode === 'dark') {
30
- return "".concat(logo, "-dark");
31
- } else {
32
- return logo;
33
- }
34
- };
35
- var logoViewBox = logoViewBoxes[whichLogo(backgroundType)];
37
+ var logo = whichLogo({
38
+ backgroundType: backgroundType,
39
+ logoType: logoType,
40
+ partnerName: partnerName
41
+ }, mode);
42
+ var logoViewBox = logoViewBoxes[logo];
36
43
  var viewBoxCoordinates = (logoViewBox === null || logoViewBox === void 0 ? void 0 : logoViewBox.split(' ')) || [];
37
44
  var defaultWidth = viewBoxCoordinates[2];
38
45
  var defaultHeight = viewBoxCoordinates[3];
@@ -52,7 +59,7 @@ var PartnerLogo = function PartnerLogo(_ref) {
52
59
  "data-qa-logo-svg": "".concat(partnerName, "-svg")
53
60
  }, svgProps), /*#__PURE__*/React.createElement("use", {
54
61
  xmlnsXlink: "http://www.w3.org/1999/xlink",
55
- xlinkHref: "#sslogosvg-".concat(whichLogo(backgroundType))
62
+ xlinkHref: "#sslogosvg-".concat(logo)
56
63
  })));
57
64
  };
58
65
  export default PartnerLogo;
@@ -1,8 +1,19 @@
1
- export var PartnerNames = ['apple-app-store', 'bigcommerce', 'bitly', 'bynder', 'canva', 'dropbox', 'facebook', 'facebook-audience-network', 'facebook-groups', 'facebook-shops', 'feedly', 'glassdoor', 'google-analytics', 'google-business-messages', 'google-drive', 'google-my-business', 'google-play-store', 'hubspot', 'instagram', 'linkedin', 'linkedin-audience-network', 'marketo', 'messenger', 'microsoft-dynamics', 'pinterest', 'reddit', 'salesforce', 'shopify', 'slack', 'sproutsocial', 'tiktok', 'tripadvisor', 'tumblr', 'twitter', 'twitter-audience-network', 'whatsapp', 'woocommerce', 'yelp', 'youtube', 'zendesk'];
1
+ import PartnerLogoNames from "../logoNames";
2
+
3
+ /**
4
+ * @deprecated Use PartnerLogoNames instead
5
+ */
6
+ export var PartnerNames = PartnerLogoNames;
7
+
8
+ /**
9
+ * @deprecated Use EnumLogoNames instead
10
+ */
11
+
2
12
  export var PartnerLogoSizes = {
3
13
  mini: '12px',
4
14
  small: '16px',
5
15
  medium: '24px',
6
16
  large: '32px',
7
17
  jumbo: '64px'
8
- };
18
+ };
19
+ export var PartnerLogoTypes = ['symbol', 'wordmark', 'lockup'];
@@ -1,2 +1 @@
1
- export * from "./PartnerLogo.flow";
2
- export * from "./TypePartnerNames.flow";
1
+ export * from "./PartnerLogo.flow";