@splunk/react-ui 4.5.3 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/Accordion.js +4 -4
  2. package/Anchor.js +2 -2
  3. package/Animation.js +2 -2
  4. package/AnimationToggle.js +2 -2
  5. package/Box.js +2 -2
  6. package/Button.js +8 -8
  7. package/ButtonGroup.js +4 -4
  8. package/ButtonSimple.js +2 -2
  9. package/CHANGELOG.md +17 -1
  10. package/Calendar.js +6 -6
  11. package/Card.js +25 -30
  12. package/CardLayout.js +4 -4
  13. package/Chip.js +2 -2
  14. package/Clickable.js +39 -13
  15. package/CloseButton.js +4 -4
  16. package/Code.js +8 -7
  17. package/CollapsiblePanel.js +6 -9
  18. package/Color.js +42 -42
  19. package/ColumnLayout.js +4 -4
  20. package/ComboBox.js +2 -2
  21. package/Concertina.js +4 -4
  22. package/ControlGroup.js +22 -29
  23. package/Date.js +4 -4
  24. package/DefinitionList.js +2 -2
  25. package/Dropdown.js +2 -2
  26. package/EventListener.js +4 -4
  27. package/FetchOptions.js +8 -8
  28. package/File.js +7 -7
  29. package/FormRows.js +16 -18
  30. package/Heading.js +2 -2
  31. package/Image.js +6 -6
  32. package/JSONTree.js +2 -2
  33. package/Layer.js +8 -8
  34. package/Link.js +4 -4
  35. package/List.js +2 -2
  36. package/Markdown.js +26 -14
  37. package/Menu.js +17 -17
  38. package/Message.js +10 -10
  39. package/Modal.js +43 -14
  40. package/ModalLayer.js +4 -4
  41. package/Monogram.js +2 -2
  42. package/Multiselect.js +255 -13
  43. package/Number.js +2 -2
  44. package/Paginator.js +10 -10
  45. package/Paragraph.js +2 -2
  46. package/Popover.js +6 -6
  47. package/Progress.js +6 -6
  48. package/Resize.js +2 -2
  49. package/ResultsMenu.js +6 -6
  50. package/ScreenReaderContent.js +2 -2
  51. package/Scroll.js +2 -2
  52. package/ScrollContainerContext.js +2 -2
  53. package/Search.js +4 -4
  54. package/Select.js +254 -13
  55. package/SidePanel.js +6 -6
  56. package/Slider.js +12 -6
  57. package/SlidingPanels.js +2 -2
  58. package/StaticContent.js +2 -2
  59. package/StepBar.js +6 -6
  60. package/Switch.js +4 -4
  61. package/TabLayout.js +4 -4
  62. package/Table.js +37 -36
  63. package/Text.js +144 -127
  64. package/Tooltip.js +2 -2
  65. package/TransitionOpen.js +62 -37
  66. package/WaitSpinner.js +2 -2
  67. package/cypress/plugins/index.ts +15 -0
  68. package/cypress/support/commands.ts +1 -0
  69. package/cypress/support/index.ts +9 -0
  70. package/cypress.json +12 -0
  71. package/package.json +13 -4
  72. package/types/src/Clickable/Clickable.d.ts +12 -2
  73. package/types/src/Clickable/NavigationProvider.d.ts +12 -2
  74. package/types/src/Color/Color.d.ts +3 -3
  75. package/types/src/Date/Date.d.ts +3 -3
  76. package/types/src/Modal/Modal.d.ts +2 -0
  77. package/types/src/Modal/ModalContext.d.ts +6 -0
  78. package/types/src/Multiselect/Multiselect.d.ts +1 -0
  79. package/types/src/Number/Number.d.ts +3 -3
  80. package/types/src/RadioBar/RadioBar.d.ts +3 -3
  81. package/types/src/Select/Select.d.ts +8 -3
  82. package/types/src/Select/SelectBase.d.ts +16 -4
  83. package/types/src/Select/matchUtils.d.ts +12 -0
  84. package/types/src/Slider/Slider.d.ts +3 -3
  85. package/types/src/Text/Text.d.ts +12 -5
  86. package/types/src/TransitionOpen/TransitionOpen.d.ts +1 -0
  87. package/usePrevious.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splunk/react-ui",
3
- "version": "4.5.3",
3
+ "version": "4.6.0",
4
4
  "description": "Library of React components that implement the Splunk design language",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Splunk Inc.",
@@ -22,6 +22,8 @@
22
22
  "test:functional:coverage": "cross-env NODE_ENV=test-coverage splunk-wdio-functional-test-runner functional.local.conf.js --coverage",
23
23
  "test:functional:ci": "cross-env NODE_ENV=test-coverage splunk-wdio-functional-test-runner functional.ci.conf.js --coverage-maps",
24
24
  "test:functional:cloud": "splunk-wdio-functional-test-runner functional.cloud.conf.js",
25
+ "test:cypress": "yarn cypress open-ct",
26
+ "test:cypress:ci": "yarn cypress run-ct",
25
27
  "test:visual:cloud": "splunk-wdio-functional-test-runner functional.visual.conf.js",
26
28
  "types:build": "tsc --emitDeclarationOnly --declaration --declarationDir ./types && node ./scripts/pruneTypes.js",
27
29
  "types:start": "tsc --emitDeclarationOnly --declaration --declarationDir ./types --watch"
@@ -29,11 +31,11 @@
29
31
  "peerDependencies": {
30
32
  "react": "^16.8",
31
33
  "react-dom": "^16.8",
32
- "styled-components": "^5.1"
34
+ "styled-components": "5.1.1"
33
35
  },
34
36
  "dependencies": {
35
- "@splunk/react-icons": "^3.1.0",
36
- "@splunk/themes": "^0.10.0",
37
+ "@splunk/react-icons": "^3.2.0",
38
+ "@splunk/themes": "^0.10.1",
37
39
  "@splunk/ui-utils": "^1.4.0",
38
40
  "@types/commonmark": "^0.27.0",
39
41
  "@types/lodash": "^4.14.156",
@@ -56,6 +58,8 @@
56
58
  },
57
59
  "devDependencies": {
58
60
  "@babel/core": "^7.2.0",
61
+ "@cypress/react": "^5.12.4",
62
+ "@cypress/webpack-dev-server": "^1.8.2",
59
63
  "@splunk/babel-preset": "^3.0.0",
60
64
  "@splunk/eslint-config": "^4.0.0",
61
65
  "@splunk/stylelint-config": "^4.0.0",
@@ -66,6 +70,8 @@
66
70
  "@storybook/addon-essentials": "^6.3.0",
67
71
  "@storybook/csf": "^0.0.1",
68
72
  "@storybook/react": "^6.3.0",
73
+ "@storybook/testing-react": "^1.2.3",
74
+ "@testing-library/cypress": "^8.0.2",
69
75
  "@types/chai": "^3.5.2",
70
76
  "@types/enzyme": "^3.10.5",
71
77
  "@types/jest": "^25.2.1",
@@ -83,12 +89,14 @@
83
89
  "chai": "^3.5.0",
84
90
  "core-js": "^3.6.4",
85
91
  "cross-env": "^6.0.3",
92
+ "cypress": "^9.5.1",
86
93
  "enzyme": "^3.11.0",
87
94
  "enzyme-adapter-react-16": "^1.15.2",
88
95
  "eslint": "^7.14.0",
89
96
  "eslint-config-airbnb": "^18.2.1",
90
97
  "eslint-config-prettier": "^6.15.0",
91
98
  "eslint-import-resolver-webpack": "^0.13.0",
99
+ "eslint-plugin-cypress": "^2.12.1",
92
100
  "eslint-plugin-import": "^2.22.1",
93
101
  "eslint-plugin-jsx-a11y": "^6.4.1",
94
102
  "eslint-plugin-react": "^7.21.5",
@@ -114,6 +122,7 @@
114
122
  "wdio-image-comparison-service": "^1.9.0",
115
123
  "webpack": "^4.16.2",
116
124
  "webpack-cli": "^3.1.0",
125
+ "webpack-dev-server": "^4.7.4",
117
126
  "webpack-merge": "^4.1.3"
118
127
  },
119
128
  "engines": {
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
2
2
  import { legacyRefMode } from '@splunk/react-ui/Dropdown';
3
3
  import { NavigationProviderClickHandler } from './NavigationProvider';
4
4
  import { ClassComponentProps } from '../utils/types';
5
- export declare const isInternalLink: (to: string) => boolean;
5
+ export declare const isInternalLink: (to: string | undefined) => boolean;
6
6
  interface ClickablePropsBase {
7
7
  children?: React.ReactNode;
8
8
  /**
@@ -25,6 +25,13 @@ interface ClickablePropsBase {
25
25
  * Ignored if not in link mode.
26
26
  */
27
27
  openInNewContext?: boolean;
28
+ /**
29
+ * The text representation of the navigational link.
30
+ * This should be provided if child content is not a string.
31
+ *
32
+ * Ignored if not in link mode.
33
+ */
34
+ navigationLabel?: string;
28
35
  /**
29
36
  * A URL for a link. If set and not disabled, an `a` element is used instead
30
37
  * of a `button` element (link mode).
@@ -41,7 +48,10 @@ declare type ClickableProps = ClickableButtonProps | ClickableLinkProps;
41
48
  */
42
49
  declare class Clickable extends Component<ClickableProps> {
43
50
  private el;
44
- static contextType: React.Context<NavigationProviderClickHandler | undefined>;
51
+ static contextType: React.Context<{
52
+ onClick?: NavigationProviderClickHandler | undefined;
53
+ prefix?: string | undefined;
54
+ }>;
45
55
  static propTypes: React.WeakValidationMap<ClassComponentProps<ClickablePropsBase, Required<Pick<ClickablePropsBase, "disabled" | "openInNewContext">>, "button", never>> | React.WeakValidationMap<ClassComponentProps<ClickablePropsBase, Required<Pick<ClickablePropsBase, "disabled" | "openInNewContext">>, "a", "href">>;
46
56
  static defaultProps: Required<Pick<ClickablePropsBase, "disabled" | "openInNewContext">>;
47
57
  static [legacyRefMode]: boolean;
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
4
4
  declare type NavigationProviderClickHandler = (event: React.MouseEvent<HTMLAnchorElement>, data: {
5
5
  openInNewContext?: boolean;
6
6
  to: string;
7
+ label?: string;
7
8
  }) => void;
8
9
  interface NavigationProviderProps {
9
10
  children?: React.ReactNode;
@@ -12,17 +13,26 @@ interface NavigationProviderProps {
12
13
  * The function takes the event and an options argument with `to` and `openInNewContext`
13
14
  */
14
15
  onClick?: NavigationProviderClickHandler;
16
+ /**
17
+ * If set, all links that use the NavigationProvider's context will have this prepended to them.
18
+ */
19
+ prefix?: string;
15
20
  }
16
- declare const NavigationContext: React.Context<NavigationProviderClickHandler | undefined>;
21
+ declare type NavigationContextValue = {
22
+ onClick?: NavigationProviderClickHandler;
23
+ prefix?: string;
24
+ };
25
+ declare const NavigationContext: React.Context<NavigationContextValue>;
17
26
  /**
18
27
  * Used to provide an override for the `onClick` for links for single page applications so that
19
28
  * internal links can navigate without a page reload.
20
29
  */
21
- declare function NavigationProvider({ children, onClick }: NavigationProviderProps): JSX.Element;
30
+ declare function NavigationProvider({ children, onClick, prefix }: NavigationProviderProps): JSX.Element;
22
31
  declare namespace NavigationProvider {
23
32
  var propTypes: {
24
33
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
25
34
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
35
+ prefix: PropTypes.Requireable<string>;
26
36
  };
27
37
  }
28
38
  export { NavigationContext, NavigationProvider, NavigationProviderClickHandler };