@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,63 @@
1
1
  # Change Log
2
2
 
3
+ ## 19.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 7c096210: 🚧 Breaking Changes 🚧
8
+
9
+ - Remove deprecated `OverflowList` component (and `react-virtualized` dependency)
10
+ - Remove deprecated example dataviz color rotation exports
11
+
12
+ 🛠️ Non-breaking Changes 🛠️
13
+
14
+ - Add support for `react` and `react-dom` v17
15
+ - Upgrade dependencies
16
+ - `react-modal`
17
+ - `react-popper`
18
+
19
+ ### Minor Changes
20
+
21
+ - 0aea6f0d: Add `fontSizes` and `lineHeights` objects to the theme. These objects fix a bug on the Card component and set us up to use the default system props behavior in future refactors.
22
+
23
+ ### Patch Changes
24
+
25
+ - 7b871fe7: Clickable children of non-sortable `TableHeaderCell` components will now fire their onClicks properly.
26
+ - e6cc9ab1: Remove webpack specific raw css import from the toast component.
27
+
28
+ ## 18.0.0
29
+
30
+ ### Major Changes
31
+
32
+ - fb938ad3: The HTML structure for the menu and listbox groups has been rearranged to improve accessibility for grouping
33
+ - When a title is provided to the `<Menu.Group />` or `<Listbox.Group />` component, the title is now correctly nested within the menu group container with the appropriate `role` and `aria-labelledby` attributes
34
+ - `Menu` and `Listbox` title container is now a `li` instead of a `div` for improved accessibility
35
+ - Developers are now able to provide a custom `role` to the `Menu.Group` and `Listbox.Group` components as well as override the padding applied to the title container
36
+
37
+ ### Minor Changes
38
+
39
+ - 5f60f73a: Adds the `invalidNumberLabel` prop to `Numeral`
40
+ - The label you provide will be added as visually hidden text to any instance of Numeral with an invalid value (i.e., where we render an em dash (`—`)).
41
+ - The prop is optional, but passing in a localized label is strongly recommended for accessibility purposes.
42
+ - Without this prop, screen readers will not read off anything for invalid values.
43
+ - With this prop, screen readers will read off the `invalidNumberLabel` for invalid values, providing clear feedback to screen reader users.
44
+ - Users should pass an `invalidNumberLabel` prop to all instances of Numeral; Numeral handles conditionally applying or omitting the label as needed.
45
+ - 23f73d44: `Card` component enhancements
46
+ - Adds the ability to specify an external link on the CardLink component.
47
+ - Provides Flow types for the subcomponents.
48
+ - 9e33f361: Fix `Link` accessibility issues
49
+ - Changes default state of underline prop from false to true
50
+ - Updates stories to accurately reflect accessible link usage
51
+
52
+ ### Patch Changes
53
+
54
+ - ba5d2429: Accessibility bugfixes for the `ChartLegend` component
55
+ - Recreates provided "contrast", "compare", and "extended" palettes in React hook to utilize the Racine theme
56
+ - Deprecation warnings added to the "contrast", "compare", and "extended" palettes
57
+ - Due to low usage of these palettes, ChartLegend will rely solely on the dataviz rotation and custom colors moving forward
58
+ - Provides 3:1 contrast ratio
59
+ - Dark mode support
60
+
3
61
  ## 17.0.0
4
62
 
5
63
  ### Major Changes
@@ -13,7 +71,7 @@
13
71
  **Enhancements**
14
72
 
15
73
  - Cards with `role='link'` should now wrap link text in the `CardLink` subcomponent
16
- - Improves screen reader accessiblity by pairing Cards as links with the new `CardLink` subcomponent
74
+ - Improves screen reader accessibility by pairing Cards as links with the new `CardLink` subcomponent
17
75
  - Adds `CardLink` subcomponent
18
76
  - Link text wrapped in CardLink renders an anchor tag as a child of Card
19
77
  - Preserves the behavior that allows the user to click the whole Card as the link
package/README.md CHANGED
@@ -146,7 +146,7 @@ When writing code for Racine, please refer to the `code-guidelines.mdx` story in
146
146
 
147
147
  There are a few ways to get involved:
148
148
 
149
- - Join #eng-ui-systems on Slack to participate in discussions about Racine's development.
149
+ - Join #design-systems on Slack to participate in discussions about Racine's development.
150
150
  - Check out [the issues tab of this repository](https://github.com/sproutsocial/racine/issues). Issues contain community-collected bugs and features that need attention. If you're looking for an easy way to jump in, we have [a label which shows issues that are good for first-time contributors](https://github.com/sproutsocial/racine/issues?q=is%3Aopen+is%3Aissue+label%3A%22♥%EF%B8%8F+good+first+issue%22).
151
151
  - The Design Systems team [uses Jira to track our backlog, in-flight changes, and future changes](https://sprout.atlassian.net/jira/software/c/projects/DS/boards/601/backlog). It's a great way to get a broad look at what's happening in Racine, and tracks the squad's work from sprint to sprint, and release to release.
152
152
 
@@ -175,12 +175,12 @@ And you can interact with Racine via the command line with these commands:
175
175
 
176
176
  ### **✅ Step 3: Make your changes**
177
177
 
178
- If you're not a member of the Design Systems team, you'll want to start by creating a [fork of the Racine repo](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) using the "Fork" button in the top-right of the repo homescreen on GitHub. Before you start writing code, make sure your fork is up-to-date with the latest changes from the main `sproutsocial/racine` repo, and then create a new feature branch based off your local `dev`.
179
-
180
- If you are a member of the Design Systems team you'll have write access to `sproutsocial/racine`, which means you can branch directly off `dev` and start working. Either way, once you've got your new feature branch feel free to start coding! As updates are merged into `dev` on `sproutsocial/racine` by other developers over time you'll want to pull those updates into your feature branch, ideally via rebase, to avoid any conflicts when you open a pull request.
178
+ Cut a feature branch off `dev` and start coding! As updates are merged into `dev` by other developers over time you'll want to pull those updates into your branch, ideally via rebase, to avoid any conflicts when you open a pull request.
181
179
 
182
180
  _Need to make an urgent update? Branch off `main` instead of dev, and open your PR later against `main`. We consider this a hotfix and only support it for critical time-sensitive updates, so check with the Design Systems team prior to making this kind of contribution._
183
181
 
182
+ We use a [visual regression testing](https://racine.netlify.app/?path=/story/welcome-visual-regression-testing--page) suite to capture any unintended changes during development. After running `yarn build` you can run the suite locally with `yarn backstop-test`, which will open a report in your browser to show you what passed and what failed. If any fails are actually intentional visual changes you can run `yarn backstop-approve` to approve those changes as new reference images and include them in your PR.
183
+
184
184
  As you develop you'll want to track the scope of the changes you make. Racine supports this with a tool called [changesets](https://github.com/atlassian/changesets) to automatically pick new version numbers and update the changelog whenever we publish a new version of the package.
185
185
 
186
186
  **Run `yarn change` to generate a changeset that will be used to derive the next version number for Racine from your changes.**
@@ -193,26 +193,28 @@ When running this command, you will be asked to select whether your change is a
193
193
  - **minor** changes are for new features or improvements, and they bump the middle digit in the version number (`x.0.x`)
194
194
  - **major** changes are _breaking changes_, and they bump the first digit (`0.x.x`). These types of changes are rare and should be coordinated in advance with the Design Systems team.
195
195
 
196
- The changeset CLI will also ask you to input a message detailing your changes. The completion of the command will generate a new changeset markdown file. You are more than welcome to edit this file after it has been generated, so don't get hung up on trying to write the perfect text from the command line. Aim to make the text of the changeset file(s) as descriptive and informative as possible, as they will be used to build a changelog file when the new version is released.
196
+ The changeset CLI will also ask you to input a message detailing your changes. The completion of the command will generate a new changeset markdown file. You are more than welcome to edit this file after it has been generated, so don't get hung up on trying to write the perfect text from the command line. Aim to make the text of the changeset file(s) as descriptive and informative as possible, as they will be used to build a changelog file when the new version is released. Check out our documentation for the [Seeds Release Process](https://sprout.atlassian.net/wiki/spaces/SEEDS/pages/3522756609/DS+Seeds+Release+Process#Changesets) for examples of what makes a good or bad changeset.
197
197
 
198
198
  **You can add as many changesets to a PR as you would like.** If your PR makes several distinct changes to Racine, you should create a changeset detailing each one individually.
199
199
 
200
200
  ### **🗣 Step 4: Create a pull request**
201
201
 
202
- Once you're ready to submit your changes for review, open a PR against the `dev` branch in `sproutsocial/racine`. A few things will happen:
202
+ Once you're ready to submit your changes for review, open a PR against the `dev` branch. A few things will happen:
203
203
 
204
- - The Racine maintainers will be tagged to review your code. Feel free to tag any specific individuals who you think should take a look.
205
- - Racine's test suite will be ran on CI, and the status will be reported on the PR. You can run `yarn test` to run these tests locally. If there are any issues, they will need to be resolved before the PR can be merged.
206
- - If you're a member of the Design Systems team: Netlify will create a preview deploy of Racine's Storybook so that you can see your changes and share them with others. Due to limited Netlify seats only a limited group of developers can generate builds.
204
+ - The Racine maintainers will be tagged to review your code. Feel free to additionally tag any specific individuals who you think should take a look.
205
+ - Visual regression testing will run against your PR, and the results can be found in the "Report" artifact on the summary page for the associated Github Action run. `html_report/index.html` in `Report.zip` will show you what passed and what failed.
206
+ - Racine's test suite will run via CI, and the status will be reported on the PR. You can run `yarn test` to run these tests locally. If there are any issues, they will need to be resolved before the PR can be merged.
207
+ - Netlify will create a preview deploy of Racine's Storybook and include a link to it in a comment on the PR so you can see your changes and share them with others.
208
+ - A Racine package snapshot including your changes will be published to Artifactory and included in a comment on the PR so you can install it locally or in a web app PR/snapshot in order to test your changes.
207
209
 
208
- You may be asked to make changes to match Racine's contribution guidelines, so expect to keep attention on your PR for a little bit. Once your tests are passing and you have at least one approving Design Systems review, a member of the Design Systems team will merge your changes for inclusion in a future release of Racine!
210
+ You may be asked to make changes to match Racine's contribution guidelines, so expect to keep attention on your PR for a little bit. Once your tests are passing and you have at least one approving Design Systems review, a member of the Design Systems team will merge your changes for inclusion in a future release of Racine! Please **do NOT** merge your own PR unless expressly told to, since commits to `dev` end up in the next release, and the Design Systems team needs to make sure they have the bandwidth to validate any contribution before it releases.
209
211
 
210
- ### **☁️ Step 5: Publish your changes to npm**
212
+ ### **☁️ Step 5: Changes get published to Artifactory**
211
213
 
212
- As PRs get merged into Racine, changsets will keep a running PR open called `Version Packages`. This PR will detail all of the changes that have been made to the package since the last publish. **Anyone can release a new version of Racine by merging this PR.**
214
+ When the Design Systems team prepares the next Racine release, changsets will generate a PR called `Version Packages`. This PR will detail all of the changes that have been made to the package since the last publish. Merging this PR will release a new version of Racine.
213
215
 
214
- When the PR is merged, [GitHub will kick off a publish of the new version](https://github.com/sproutsocial/racine/actions?query=workflow%3ARelease). There will be a notification in #eng-ui-systems in Slack when the new version is available.
216
+ When the PR is merged, [GitHub will kick off a publish of the new version](https://github.com/sproutsocial/racine/actions?query=workflow%3ARelease). There will be a notification in #design-systems in Slack when the new version is available.
215
217
 
216
218
  ### **✍ Step 6: Document your changes**
217
219
 
218
- Racine components are documented in [Seeds](https://sproutsocial.com/seeds/components), Sprout's design system. You can open a PR to the [Seeds repository](https://github.com/sproutsocial/seeds) to add or edit component documentation. Reach out to the Design Systems team for help getting started.
220
+ Racine components are documented in [Seeds](https://sproutsocial.com/seeds/components), Sprout's design system. You can open a PR to the [Seeds repository](https://github.com/sproutsocial/seeds) to add or edit component documentation. It's a good idea to have documentation changes ready to go at the same time your Racine contributions are deployed, so start early! Reach out to the Design Systems team if you need help getting started.
@@ -1,5 +1,9 @@
1
1
  // @flow
2
2
  import * as React from 'react';
3
- import type { TypeCardProps } from "./CardTypes.flow";
3
+ import type { TypeCardProps, TypeCardLink, TypeCardArea } from "./CardTypes.flow";
4
4
  declare var Card: React.StatelessFunctionalComponent<TypeCardProps>;
5
+ declare export var CardLink: React.StatelessFunctionalComponent<TypeCardLink>;
6
+ declare export var CardHeader: React.StatelessFunctionalComponent<TypeCardArea>;
7
+ declare export var CardContent: React.StatelessFunctionalComponent<TypeCardArea>;
8
+ declare export var CardFooter: React.StatelessFunctionalComponent<TypeCardArea>;
5
9
  declare export default typeof Card;
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import type { TypeIconProps } from "../Icon/index.flow";
5
5
  import type { TypeStyledComponentsCommonProps, TypePropsWithChildren } from "../types/index.flow";
6
- import type { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps } from "../systemProps/index.flow";
6
+ import type { TypeBorderSystemProps, TypeColorSystemProps, TypeFlexboxSystemProps, TypeGridSystemProps, TypeLayoutSystemProps, TypePositionSystemProps, TypeSpaceSystemProps, TypeTypographySystemProps } from "../systemProps/index.flow";
7
7
  export type TypeSharedCardSystemProps = TypePropsWithChildren<{|
8
8
  ...TypeStyledComponentsCommonProps,
9
9
  ...TypeBorderSystemProps,
@@ -63,4 +63,11 @@ export type TypeStyledSelectedIcon = {
63
63
  ...TypeIconProps,
64
64
  $selected: $PropertyType<TypeCardStyleTransientProps, '$selected'>,
65
65
  ...
66
+ };
67
+ export type TypeCardLink = {
68
+ ...TypeColorSystemProps,
69
+ ...TypeTypographySystemProps,
70
+ affordance?: boolean,
71
+ external?: boolean,
72
+ ...
66
73
  };
@@ -12,6 +12,8 @@ export type TypeNumeralProps = {
12
12
  currency?: string,
13
13
  /** A boolean determining whether or not the number should be abbreviated, or a number representing the abbreviation threshold */
14
14
  abbreviate?: boolean | number,
15
+ /** Text to be read off by screen readers for invalid values (i.e., any value rendered as '—' (em dash)) */
16
+ invalidNumberLabel?: string,
15
17
  /** Override the default decimal precision (2 for decimals/currency, 1 for percentages), or "none" allowing unrestricted precision. */
16
18
  precision?: number | 'none',
17
19
  qa?: Object,
@@ -49,7 +49,6 @@ export { default as Menu, MenuButton, MenuButtonContext, MenuItemContainer } fro
49
49
  export { default as Message } from "./Message/index.flow";
50
50
  export { default as Modal } from "./Modal/index.flow";
51
51
  export { default as Numeral } from "./Numeral/index.flow";
52
- export { default as OverflowList } from "./OverflowList/index.flow";
53
52
  export { default as PartnerLogo } from "./PartnerLogo/index.flow";
54
53
  export { default as Popout } from "./Popout/index.flow";
55
54
  export { default as Radio } from "./Radio/index.flow";
@@ -104,7 +103,6 @@ export type { TypeMenuButtonContext, TypeMenuButtonProps, TypeMenuContext, TypeM
104
103
  export type { EnumDensities, TypeMessageProps } from "./Message/index.flow";
105
104
  export type { TypeModalProps, TypeModalContentProps, TypeModalFooterProps, TypeModalHeaderProps } from "./Modal/index.flow";
106
105
  export type { TypeNumeralProps } from "./Numeral/index.flow";
107
- export type { TypeOverflowListProps, TypeVirtualizedListProps } from "./OverflowList/index.flow";
108
106
  export type { TypePartnerLogoProps, TypePartnerNames } from "./PartnerLogo/index.flow";
109
107
  export type { EnumPlacements, TypePopoutProps } from "./Popout/index.flow";
110
108
  export type { TypeRadioProps } from "./Radio/index.flow";
@@ -136,9 +134,4 @@ export { legacyBadgeColors } from "./Badge/index.flow";
136
134
  /**
137
135
  * @deprecated Alert has been renamed to Banner
138
136
  */
139
- export { default as Alert } from "./Banner/index.flow";
140
-
141
- /**
142
- * Should this be exported? @deprecated?
143
- */
144
- export { DataVizRotation } from "./dataviz/index.flow";
137
+ export { default as Alert } from "./Banner/index.flow";
@@ -11,7 +11,7 @@ var _styles = require("./styles");
11
11
  var _excluded = ["children"],
12
12
  _excluded2 = ["children"],
13
13
  _excluded3 = ["children"],
14
- _excluded4 = ["affordance", "children"];
14
+ _excluded4 = ["affordance", "children", "external", "color"];
15
15
  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); }
16
16
  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; }
17
17
  function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
@@ -55,25 +55,33 @@ var CardAffordance = function CardAffordance(_ref5) {
55
55
  var rest = _extends({}, (_objectDestructuringEmpty(_ref5), _ref5));
56
56
  return /*#__PURE__*/_react.default.createElement(_styles.StyledCardAffordance, _extends({}, rest, {
57
57
  size: "mini",
58
- name: "arrow-right",
58
+ name: "arrow-right"
59
+ // TODO: probably need to make this available to the top level for external links https://sprout.atlassian.net/browse/DS-2223
60
+ ,
59
61
  "aria-hidden": true
60
62
  }));
61
63
  };
62
-
63
- // jsdocs, never types?
64
64
  exports.CardAffordance = CardAffordance;
65
65
  var CardLink = function CardLink(_ref6) {
66
66
  var affordance = _ref6.affordance,
67
67
  children = _ref6.children,
68
+ _ref6$external = _ref6.external,
69
+ external = _ref6$external === void 0 ? false : _ref6$external,
70
+ color = _ref6.color,
68
71
  rest = _objectWithoutProperties(_ref6, _excluded4);
69
72
  var _useContext = (0, _react.useContext)(_utils.SubComponentContext),
70
73
  href = _useContext.href,
71
74
  linkRef = _useContext.linkRef;
72
75
  return /*#__PURE__*/_react.default.createElement(_styles.StyledCardLink, _extends({}, rest, {
73
- target: "_blank",
74
- rel: "noreferrer",
76
+ target: external ? '_blank' : undefined,
77
+ rel: external ? 'noreferrer' : undefined,
75
78
  href: href,
76
79
  ref: linkRef
80
+ // TODO: fix this type since `color` should be valid here. TS can't resolve the correct type.
81
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
82
+ // @ts-ignore
83
+ ,
84
+ color: color
77
85
  }), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children, affordance ? /*#__PURE__*/_react.default.createElement(CardAffordance, {
78
86
  ml: 300
79
87
  }) : null));
@@ -6,45 +6,28 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var React = _interopRequireWildcard(require("react"));
9
- var _chartColors = require("../utils/chartColors");
10
- var _Text = require("../Text");
11
- var _styles = _interopRequireWildcard(require("./styles"));
9
+ var _styles = _interopRequireDefault(require("./styles"));
10
+ var _useChartLabels = require("./useChartLabels");
12
11
  var _excluded = ["legendLabels", "stacked", "theme", "qa"];
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  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); }
14
14
  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; }
15
15
  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); }
16
16
  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; }
17
17
  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; }
18
- function getSwatchColor(theme, index) {
19
- return _chartColors.THEME_MAP[theme.toUpperCase()][index];
20
- }
21
- function getLabels(legendLabels, theme) {
22
- return legendLabels.map(function (label, i) {
23
- var labelColor = label.color ? label.color : getSwatchColor(theme, i);
24
- return /*#__PURE__*/React.createElement(_styles.Label, {
25
- key: label.name
26
- }, /*#__PURE__*/React.createElement(_styles.Swatch, {
27
- bg: labelColor,
28
- "data-qa-swatch": ""
29
- }), /*#__PURE__*/React.createElement(_Text.Text, {
30
- as: "div",
31
- fontSize: 200,
32
- breakWord: true
33
- }, label.name));
34
- });
35
- }
36
18
  var ChartLegend = function ChartLegend(_ref) {
37
19
  var legendLabels = _ref.legendLabels,
38
20
  stacked = _ref.stacked,
39
21
  _ref$theme = _ref.theme,
40
- theme = _ref$theme === void 0 ? 'compare' : _ref$theme,
22
+ theme = _ref$theme === void 0 ? 'datavizRotation' : _ref$theme,
41
23
  qa = _ref.qa,
42
24
  rest = _objectWithoutProperties(_ref, _excluded);
25
+ var chartLabels = (0, _useChartLabels.useChartLabels)(legendLabels, theme);
43
26
  return /*#__PURE__*/React.createElement(_styles.default, _extends({
44
27
  inline: !stacked,
45
28
  "data-qa-chartlegend": "",
46
29
  qa: qa
47
- }, rest), getLabels(legendLabels, theme));
30
+ }, rest), chartLabels);
48
31
  };
49
32
  var _default = ChartLegend;
50
33
  exports.default = _default;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useChartLabels = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _styledComponents = require("styled-components");
9
+ var _styles = require("./styles");
10
+ var _Text = require("../Text");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var getSwatchColor = function getSwatchColor(theme, index, RacineThemeColors) {
13
+ var COMPARE_THEME = [RacineThemeColors.dataviz.map['1'], RacineThemeColors.dataviz.map['10'], RacineThemeColors.dataviz.map['11'], RacineThemeColors.dataviz.map['2']];
14
+ 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']];
15
+ 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']];
16
+ var THEME_MAP = {
17
+ COMPARE: COMPARE_THEME,
18
+ CONTRAST: CONTRAST_THEME,
19
+ EXTENDED: EXTENDED_THEME,
20
+ DATAVIZROTATION: RacineThemeColors.dataviz.list
21
+ };
22
+ return THEME_MAP[theme.toUpperCase()][index];
23
+ };
24
+ var useChartLabels = function useChartLabels(legendLabels, theme) {
25
+ var racineTheme = (0, _styledComponents.useTheme)();
26
+ var colors = racineTheme.colors;
27
+ return legendLabels.map(function (label, i) {
28
+ var labelColor = label.color ? label.color : getSwatchColor(theme, i, colors);
29
+ return /*#__PURE__*/_react.default.createElement(_styles.Label, {
30
+ key: label.name
31
+ }, /*#__PURE__*/_react.default.createElement(_styles.Swatch, {
32
+ bg: labelColor,
33
+ "data-qa-swatch": ""
34
+ }), /*#__PURE__*/_react.default.createElement(_Text.Text, {
35
+ as: "div",
36
+ fontSize: 200,
37
+ breakWord: true
38
+ }, label.name));
39
+ });
40
+ };
41
+ exports.useChartLabels = useChartLabels;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var React = _interopRequireWildcard(require("react"));
9
- var _useMeasure = _interopRequireDefault(require("use-measure"));
9
+ var _useMeasure = require("../utils/use-measure");
10
10
  var _Box = _interopRequireDefault(require("../Box"));
11
11
  var _styles = require("./styles");
12
12
  var _excluded = ["children"],
@@ -86,7 +86,7 @@ var Panel = function Panel(_ref3) {
86
86
  collapsedHeight = _useContext2.collapsedHeight,
87
87
  openHeight = _useContext2.openHeight;
88
88
  var ref = (0, React.useRef)(null);
89
- var measurement = (0, _useMeasure.default)(ref);
89
+ var measurement = (0, _useMeasure.useMeasure)(ref);
90
90
  var _useState3 = (0, React.useState)(undefined),
91
91
  _useState4 = _slicedToArray(_useState3, 2),
92
92
  isHidden = _useState4[0],
@@ -21,7 +21,8 @@ var Link = function Link(_ref) {
21
21
  disabled = _ref.disabled,
22
22
  onClick = _ref.onClick,
23
23
  as = _ref.as,
24
- underline = _ref.underline,
24
+ _ref$underline = _ref.underline,
25
+ underline = _ref$underline === void 0 ? true : _ref$underline,
25
26
  _ref$qa = _ref.qa,
26
27
  qa = _ref$qa === void 0 ? {} : _ref$qa,
27
28
  rest = _objectWithoutProperties(_ref, _excluded);
@@ -246,29 +246,49 @@ var MenuRadio = function MenuRadio(props) {
246
246
  }, props));
247
247
  };
248
248
  exports.MenuRadio = MenuRadio;
249
- var MenuGroup = function MenuGroup(_ref2) {
250
- var children = _ref2.children,
251
- title = _ref2.title,
252
- titleAs = _ref2.titleAs,
253
- _ref2$disabled = _ref2.disabled,
254
- isDisabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
255
- props = _objectWithoutProperties(_ref2, _excluded2);
256
- return /*#__PURE__*/React.createElement(React.Fragment, null, title && /*#__PURE__*/React.createElement(_Box.default, {
257
- pl: 400,
249
+ var MenuTitle = (0, _styledComponents.default)(_Text.default).withConfig({
250
+ displayName: "Menu__MenuTitle",
251
+ componentId: "sc-1jmjosz-0"
252
+ })(["font-weight:600;padding-left:", ";padding-top:", ";padding-bottom:", ";color:", ";"], function (_ref2) {
253
+ var theme = _ref2.theme;
254
+ return theme.space[300];
255
+ }, function (_ref3) {
256
+ var theme = _ref3.theme;
257
+ return theme.space[200];
258
+ }, function (_ref4) {
259
+ var theme = _ref4.theme;
260
+ return theme.space[300];
261
+ }, function (_ref5) {
262
+ var theme = _ref5.theme;
263
+ return theme.colors.text.headline;
264
+ });
265
+ var _StyledMenuTitle = (0, _styledComponents.default)(MenuTitle).withConfig({
266
+ displayName: "Menu___StyledMenuTitle",
267
+ componentId: "sc-1jmjosz-1"
268
+ })(["", ""], function (p) {
269
+ return p.$_css;
270
+ });
271
+ var MenuGroup = function MenuGroup(_ref6) {
272
+ var children = _ref6.children,
273
+ title = _ref6.title,
274
+ titleAs = _ref6.titleAs,
275
+ _ref6$disabled = _ref6.disabled,
276
+ isDisabled = _ref6$disabled === void 0 ? false : _ref6$disabled,
277
+ props = _objectWithoutProperties(_ref6, _excluded2);
278
+ var menuTitleId = (0, _lodash.default)('menu-title-');
279
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Box.default, _extends({
280
+ p: 300,
281
+ role: "group",
282
+ "aria-labelledby": title ? menuTitleId : undefined,
258
283
  borderTop: "1px solid",
259
- borderColor: "container.border.base",
260
- mt: "-1px"
261
- }, /*#__PURE__*/React.createElement(_StyledText, {
262
- forwardedAs: titleAs || 'div',
284
+ borderColor: "container.border.base"
285
+ }, props), title && /*#__PURE__*/React.createElement(_StyledMenuTitle, {
286
+ id: menuTitleId,
287
+ role: "presentation",
263
288
  fontSize: 200,
264
- fontWeight: 600,
265
- mt: 350,
266
- color: "text.headline",
289
+ forwardedAs: titleAs || 'li',
267
290
  $_css: isDisabled ? _mixins.disabled : undefined
268
- }, title)), /*#__PURE__*/React.createElement(_Box.default, _extends({}, props, {
269
- p: 300,
270
- role: "group"
271
- }), children));
291
+ }, title), children));
272
292
  };
273
293
  exports.MenuGroup = MenuGroup;
274
294
  var MenuDivider = function MenuDivider(props) {
@@ -313,12 +333,12 @@ var MenuFilterInput = function MenuFilterInput(props) {
313
333
  onBlur: handleOnBlur
314
334
  }));
315
335
  };
316
- var MenuItems = function MenuItems(_ref3) {
317
- var children = _ref3.children,
318
- role = _ref3.role,
319
- multiselect = _ref3.multiselect,
320
- innerRef = _ref3.innerRef,
321
- props = _objectWithoutProperties(_ref3, _excluded3);
336
+ var MenuItems = function MenuItems(_ref7) {
337
+ var children = _ref7.children,
338
+ role = _ref7.role,
339
+ multiselect = _ref7.multiselect,
340
+ innerRef = _ref7.innerRef,
341
+ props = _objectWithoutProperties(_ref7, _excluded3);
322
342
  var _useMenuKeyDown = (0, _utils.useMenuKeyDown)(),
323
343
  handleKeyDown = _useMenuKeyDown.handleKeyDown,
324
344
  activeDescendent = _useMenuKeyDown.activeDescendent;
@@ -338,15 +358,15 @@ var MenuItems = function MenuItems(_ref3) {
338
358
  overflow: "hidden"
339
359
  }), children);
340
360
  };
341
- var Menu = function Menu(_ref4) {
342
- var _ref4$role = _ref4.role,
343
- role = _ref4$role === void 0 ? _utils.MENU_ROLES.MENU : _ref4$role,
344
- children = _ref4.children,
345
- onChange = _ref4.onChange,
346
- value = _ref4.value,
347
- multiselect = _ref4.multiselect,
348
- innerRef = _ref4.innerRef,
349
- props = _objectWithoutProperties(_ref4, _excluded4);
361
+ var Menu = function Menu(_ref8) {
362
+ var _ref8$role = _ref8.role,
363
+ role = _ref8$role === void 0 ? _utils.MENU_ROLES.MENU : _ref8$role,
364
+ children = _ref8.children,
365
+ onChange = _ref8.onChange,
366
+ value = _ref8.value,
367
+ multiselect = _ref8.multiselect,
368
+ innerRef = _ref8.innerRef,
369
+ props = _objectWithoutProperties(_ref8, _excluded4);
350
370
  var _useDescendants = (0, _utils.useDescendants)(),
351
371
  _useDescendants2 = _slicedToArray(_useDescendants, 2),
352
372
  descendants = _useDescendants2[0],
@@ -404,20 +424,20 @@ Menu.Divider = MenuDivider;
404
424
  Menu.FilterInput = MenuFilterInput;
405
425
  var CustomPopoutContent = (0, _styledComponents.default)(_Popout.default.Content).withConfig({
406
426
  displayName: "Menu__CustomPopoutContent",
407
- componentId: "sc-1jmjosz-0"
427
+ componentId: "sc-1jmjosz-2"
408
428
  })(["padding:0;margin-left:0;margin-right:0;"]);
409
- var MenuButton = function MenuButton(_ref5) {
410
- var content = _ref5.content,
411
- popoutProps = _ref5.popoutProps,
412
- children = _ref5.children,
413
- _onClick = _ref5.onClick,
414
- _ref5$closeOnItemClic = _ref5.closeOnItemClick,
415
- closeOnItemClick = _ref5$closeOnItemClic === void 0 ? true : _ref5$closeOnItemClic,
416
- _ref5$id = _ref5.id,
417
- id = _ref5$id === void 0 ? (0, _lodash.default)('MenuButton-') : _ref5$id,
418
- _ref5$placement = _ref5.placement,
419
- placement = _ref5$placement === void 0 ? 'bottom' : _ref5$placement,
420
- props = _objectWithoutProperties(_ref5, _excluded5);
429
+ var MenuButton = function MenuButton(_ref9) {
430
+ var content = _ref9.content,
431
+ popoutProps = _ref9.popoutProps,
432
+ children = _ref9.children,
433
+ _onClick = _ref9.onClick,
434
+ _ref9$closeOnItemClic = _ref9.closeOnItemClick,
435
+ closeOnItemClick = _ref9$closeOnItemClic === void 0 ? true : _ref9$closeOnItemClic,
436
+ _ref9$id = _ref9.id,
437
+ id = _ref9$id === void 0 ? (0, _lodash.default)('MenuButton-') : _ref9$id,
438
+ _ref9$placement = _ref9.placement,
439
+ placement = _ref9$placement === void 0 ? 'bottom' : _ref9$placement,
440
+ props = _objectWithoutProperties(_ref9, _excluded5);
421
441
  var _useState5 = (0, React.useState)(false),
422
442
  _useState6 = _slicedToArray(_useState5, 2),
423
443
  isOpen = _useState6[0],
@@ -459,10 +479,4 @@ var MenuButton = function MenuButton(_ref5) {
459
479
  };
460
480
  exports.MenuButton = MenuButton;
461
481
  var _default = Menu;
462
- exports.default = _default;
463
- var _StyledText = (0, _styledComponents.default)(_Text.default).withConfig({
464
- displayName: "Menu___StyledText",
465
- componentId: "sc-1jmjosz-1"
466
- })(["", ""], function (p) {
467
- return p.$_css;
468
- });
482
+ exports.default = _default;
@@ -55,5 +55,5 @@ exports.MenuItemContainer = MenuItemContainer;
55
55
  var MenuItemsContainer = (0, _styledComponents.default)(_Box.default).withConfig({
56
56
  displayName: "styles__MenuItemsContainer",
57
57
  componentId: "sc-168zlb1-1"
58
- })(["list-style-type:none;&:focus{", "}"], _mixins.focusRing);
58
+ })(["list-style-type:none;&:focus{", "}& > div[role='group']:first-of-type{border-top:none;}"], _mixins.focusRing);
59
59
  exports.MenuItemsContainer = MenuItemsContainer;
@@ -9,9 +9,10 @@ var React = _interopRequireWildcard(require("react"));
9
9
  var _lruMemoize = _interopRequireDefault(require("lru-memoize"));
10
10
  var _constants = require("../utils/constants");
11
11
  var _Tooltip = _interopRequireDefault(require("../Tooltip"));
12
+ var _VisuallyHidden = require("../VisuallyHidden");
12
13
  var _constants2 = require("./constants");
13
14
  var _styles = require("./styles");
14
- var _excluded = ["number", "locale", "format", "currency", "abbreviate", "precision", "qa"];
15
+ var _excluded = ["number", "locale", "format", "currency", "abbreviate", "invalidNumberLabel", "precision", "qa"];
15
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
17
  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); }
17
18
  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; }
@@ -86,6 +87,7 @@ var normalizeArgs = function normalizeArgs(props) {
86
87
  currency = _props$currency === void 0 ? 'USD' : _props$currency,
87
88
  _props$abbreviate = props.abbreviate,
88
89
  abbreviate = _props$abbreviate === void 0 ? true : _props$abbreviate,
90
+ invalidNumberLabel = props.invalidNumberLabel,
89
91
  precision = props.precision,
90
92
  qa = props.qa,
91
93
  rest = _objectWithoutProperties(props, _excluded);
@@ -107,6 +109,7 @@ var normalizeArgs = function normalizeArgs(props) {
107
109
  return {
108
110
  value: value,
109
111
  canAbbreviate: canAbbreviate,
112
+ invalidNumberLabel: invalidNumberLabel,
110
113
  options: options,
111
114
  qa: qa,
112
115
  rest: rest
@@ -116,10 +119,16 @@ var Numeral = function Numeral(props) {
116
119
  var _normalizeArgs = normalizeArgs(props),
117
120
  value = _normalizeArgs.value,
118
121
  canAbbreviate = _normalizeArgs.canAbbreviate,
122
+ invalidNumberLabel = _normalizeArgs.invalidNumberLabel,
119
123
  options = _normalizeArgs.options,
120
124
  qa = _normalizeArgs.qa,
121
125
  rest = _normalizeArgs.rest;
122
- if (!isValidNumber(props.number)) return /*#__PURE__*/React.createElement(_styles.Container, qa, _constants.EM_DASH);
126
+ if (!isValidNumber(props.number)) return /*#__PURE__*/React.createElement(React.Fragment, null, invalidNumberLabel &&
127
+ /*#__PURE__*/
128
+ // Give screen readers something useful to read off + hide the em dash
129
+ React.createElement(_VisuallyHidden.VisuallyHidden, null, invalidNumberLabel), /*#__PURE__*/React.createElement(_styles.Container, _extends({
130
+ "aria-hidden": true
131
+ }, qa), _constants.EM_DASH));
123
132
  var formatters = getNumberFormatters(options);
124
133
  var fullText = formatters.standard.format(value);
125
134
  if (canAbbreviate) {
@@ -54,12 +54,14 @@ var TableHeaderCell = /*#__PURE__*/function (_React$Component) {
54
54
  }));
55
55
  });
56
56
  _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
57
- e.preventDefault();
58
57
  var _this$props = _this.props,
59
58
  onClick = _this$props.onClick,
60
59
  onSort = _this$props.onSort,
61
60
  isSortable = _this$props.isSortable,
62
61
  id = _this$props.id;
62
+ if (onClick || isSortable) {
63
+ e.preventDefault();
64
+ }
63
65
  if (onClick) {
64
66
  // @ts-note: Right now the `onClick` is incorrectly set to consume an HTMLButtonElement event
65
67
  onClick(e);