diff --git a/packages/react-core/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap b/packages/react-core/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap index c1d75baf581..a121316bbd3 100644 --- a/packages/react-core/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap +++ b/packages/react-core/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap @@ -4,7 +4,7 @@ exports[`AboutModalBoxCloseButton should match snapshot (auto-generated) 1`] = `
- - +
`; diff --git a/packages/react-core/src/components/AboutModal/__tests__/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap b/packages/react-core/src/components/AboutModal/__tests__/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap index 998d2db76f9..874e258ad26 100644 --- a/packages/react-core/src/components/AboutModal/__tests__/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap +++ b/packages/react-core/src/components/AboutModal/__tests__/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap @@ -4,7 +4,7 @@ exports[`AboutModalBoxCloseButton Test 1`] = `
- - +
`; @@ -23,7 +23,7 @@ exports[`AboutModalBoxCloseButton Test close button aria label 1`] = `
- - +
`; @@ -42,7 +42,7 @@ exports[`AboutModalBoxCloseButton Test onclose 1`] = `
- - +
`; diff --git a/packages/react-core/src/components/Alert/Alert.tsx b/packages/react-core/src/components/Alert/Alert.tsx index 0ad829db510..601230fa71d 100644 --- a/packages/react-core/src/components/Alert/Alert.tsx +++ b/packages/react-core/src/components/Alert/Alert.tsx @@ -3,9 +3,8 @@ import { css } from '@patternfly/react-styles'; import styles from '@patternfly/react-styles/css/components/Alert/alert'; import accessibleStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility'; import { AlertIcon } from './AlertIcon'; -import { capitalize } from '../../helpers/util'; +import { capitalize, getOUIAProps, OUIAProps } from '../../helpers'; import { Omit } from '../../helpers/typeUtils'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; export enum AlertVariant { success = 'success', @@ -36,7 +35,7 @@ export interface AlertProps extends Omit, 'actio isLiveRegion?: boolean; } -const Alert: React.FunctionComponent = ({ +export const Alert: React.FunctionComponent = ({ variant = AlertVariant.info, isInline = false, isLiveRegion = false, @@ -46,10 +45,9 @@ const Alert: React.FunctionComponent = ({ title, children = '', className = '', - ouiaContext = null, - ouiaId = null, + ouiaId, ...props -}: AlertProps & InjectedOuiaProps) => { +}: AlertProps & OUIAProps) => { const readerTitle = ( {variantLabel} @@ -69,10 +67,7 @@ const Alert: React.FunctionComponent = ({ {...props} className={customClassName} aria-label={ariaLabel} - {...(ouiaContext.isOuia && { - 'data-ouia-component-type': 'Alert', - 'data-ouia-component-id': ouiaId || ouiaContext.ouiaId - })} + {...getOUIAProps('Alert', ouiaId)} {...(isLiveRegion && { 'aria-live': 'polite', 'aria-atomic': 'false' @@ -87,6 +82,3 @@ const Alert: React.FunctionComponent = ({ ); }; - -const AlertWithOuiaContext = withOuiaContext(Alert); -export { AlertWithOuiaContext as Alert }; diff --git a/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/Alert.test.tsx.snap b/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/Alert.test.tsx.snap index 02a373358da..8741fda4539 100644 --- a/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/Alert.test.tsx.snap +++ b/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/Alert.test.tsx.snap @@ -1,7 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Alert should match snapshot (auto-generated) 1`] = ` - - - +
+ +

+ + string + +
+ ReactNode +
+

+
`; diff --git a/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionCloseButton.test.tsx.snap b/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionCloseButton.test.tsx.snap index ea4098dfa30..1af619dff18 100644 --- a/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionCloseButton.test.tsx.snap +++ b/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionCloseButton.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`AlertActionCloseButton should match snapshot (auto-generated) 1`] = ` - - + `; diff --git a/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionLink.test.tsx.snap b/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionLink.test.tsx.snap index d1679013ae1..cf4b274ff48 100644 --- a/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionLink.test.tsx.snap +++ b/packages/react-core/src/components/Alert/__tests__/Generated/__snapshots__/AlertActionLink.test.tsx.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`AlertActionLink should match snapshot (auto-generated) 1`] = ` - '' - + `; diff --git a/packages/react-core/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap b/packages/react-core/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap index c09b48b91e3..92ac533681f 100644 --- a/packages/react-core/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +++ b/packages/react-core/src/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Alert - danger Action Close Button 1`] = ` - - , - "children": "Some alert", - "title": "", - "variant": "danger", - } - } - consumerContext={null} +
- - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
+ + + + + +
+
+

+ + Danger alert: + +

+
+ Some alert +
+
+ - -
- + - -
-
-

- - Danger alert: - -

-
- Some alert -
-
- - - , - "onClick": [MockFunction], - "variant": "plain", - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - - - - -
-
-
- - + + + + +
+ + `; exports[`Alert - danger Action Link 1`] = ` - test @@ -198,159 +136,102 @@ exports[`Alert - danger Action Link 1`] = ` title="" variant="danger" > - - test - , - "children": "Some alert", - "title": "", - "variant": "danger", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
- -
- - - - - -
-
-

- - Danger alert: - -

-
- Some alert -
-
- + + + + +
+ +

+ + Danger alert: + +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - danger Action and Title 1`] = ` - test @@ -359,160 +240,103 @@ exports[`Alert - danger Action and Title 1`] = ` title="Some title" variant="danger" > - - test - , - "children": "Some alert", - "title": "Some title", - "variant": "danger", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Danger alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Danger alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - danger Custom aria label 1`] = ` - test @@ -522,512 +346,367 @@ exports[`Alert - danger Custom aria label 1`] = ` title="Some title" variant="danger" > - - test - , - "aria-label": "Custom aria label for danger", - "children": "Some alert", - "title": "Some title", - "variant": "danger", - } - } - consumerContext={null} +
- - test - - } - aria-label="Custom aria label for danger" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Danger alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Danger alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - danger Description 1`] = ` - - -
- -
- - - - - -
-
-

- - Danger alert: - -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Danger alert: + +

+
+ Some alert +
+ + `; exports[`Alert - danger Title 1`] = ` - - -
- -
- - - - - -
-
-

- - Danger alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Danger alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - danger Toast alerts match snapsnot 1`] = ` - - -
- -
- - - - - -
-
-

- - Danger alert: - - Some title -

-
- Some toast alert -
+ + + + +
-
-
-
+ +

+ + Danger alert: + + Some title +

+
+ Some toast alert +
+ + `; exports[`Alert - danger inline variation 1`] = ` - - -
- -
- - - - - -
-
-

- - Danger alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Danger alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - default Action Close Button 1`] = ` - - , - "children": "Some alert", - "title": "", - "variant": "default", - } - } - consumerContext={null} +
- - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
- + + + + +
+
+

+ + Default alert: + +

+
+ Some alert +
+
+ + - - - - -
-
- -
-
+ + + + + + + `; exports[`Alert - default Action Link 1`] = ` - test @@ -1224,159 +841,102 @@ exports[`Alert - default Action Link 1`] = ` title="" variant="default" > - - test - , - "children": "Some alert", - "title": "", - "variant": "default", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
- -
- - - - - -
-
-

- - Default alert: - -

-
- Some alert -
-
- + + + + +
+ +

+ + Default alert: + +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - default Action and Title 1`] = ` - test @@ -1385,160 +945,103 @@ exports[`Alert - default Action and Title 1`] = ` title="Some title" variant="default" > - - test - , - "children": "Some alert", - "title": "Some title", - "variant": "default", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Default alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Default alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - default Custom aria label 1`] = ` - test @@ -1548,512 +1051,367 @@ exports[`Alert - default Custom aria label 1`] = ` title="Some title" variant="default" > - - test - , - "aria-label": "Custom aria label for default", - "children": "Some alert", - "title": "Some title", - "variant": "default", - } - } - consumerContext={null} +
- - test - - } - aria-label="Custom aria label for default" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Default alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Default alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - default Description 1`] = ` - - -
- -
- - - - - -
-
-

- - Default alert: - -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Default alert: + +

+
+ Some alert +
+ + `; exports[`Alert - default Title 1`] = ` - - -
- -
- - - - - -
-
-

- - Default alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Default alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - default Toast alerts match snapsnot 1`] = ` - - -
- -
- - - - - -
-
-

- - Default alert: - - Some title -

-
- Some toast alert -
+ + + + +
-
-
-
+ +

+ + Default alert: + + Some title +

+
+ Some toast alert +
+ + `; exports[`Alert - default inline variation 1`] = ` - - -
- -
- - - - - -
-
-

- - Default alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Default alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - info Action Close Button 1`] = ` - - , - "children": "Some alert", - "title": "", - "variant": "info", - } - } - consumerContext={null} +
- - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
+ + + + + +
+
+

+ + Info alert: + +

+
+ Some alert +
+
+ - -
- + - -
-
-

- - Info alert: - -

-
- Some alert -
-
- - - , - "onClick": [MockFunction], - "variant": "plain", - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - - - - -
-
-
- - + + + + +
+ + `; exports[`Alert - info Action Link 1`] = ` - test @@ -2250,159 +1546,102 @@ exports[`Alert - info Action Link 1`] = ` title="" variant="info" > - - test - , - "children": "Some alert", - "title": "", - "variant": "info", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
- -
- - - - - -
-
-

- - Info alert: - -

-
- Some alert -
-
- + + + + +
+ +

+ + Info alert: + +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - info Action and Title 1`] = ` - test @@ -2411,160 +1650,103 @@ exports[`Alert - info Action and Title 1`] = ` title="Some title" variant="info" > - - test - , - "children": "Some alert", - "title": "Some title", - "variant": "info", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Info alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Info alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - info Custom aria label 1`] = ` - test @@ -2574,512 +1756,367 @@ exports[`Alert - info Custom aria label 1`] = ` title="Some title" variant="info" > - - test - , - "aria-label": "Custom aria label for info", - "children": "Some alert", - "title": "Some title", - "variant": "info", - } - } - consumerContext={null} +
- - test - - } - aria-label="Custom aria label for info" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Info alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Info alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - info Description 1`] = ` - - -
- -
- - - - - -
-
-

- - Info alert: - -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Info alert: + +

+
+ Some alert +
+ + `; exports[`Alert - info Title 1`] = ` - - -
- -
- - - - - -
-
-

- - Info alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Info alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - info Toast alerts match snapsnot 1`] = ` - - -
- -
- - - - - -
-
-

- - Info alert: - - Some title -

-
- Some toast alert -
+ + + + +
-
-
-
+ +

+ + Info alert: + + Some title +

+
+ Some toast alert +
+ + `; exports[`Alert - info inline variation 1`] = ` - - -
- -
- - - - - -
-
-

- - Info alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Info alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - success Action Close Button 1`] = ` - - , - "children": "Some alert", - "title": "", - "variant": "success", - } - } - consumerContext={null} +
- - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
+ + + + + +
+
+

+ + Success alert: + +

+
+ Some alert +
+
+ - -
- + - -
-
-

- - Success alert: - -

-
- Some alert -
-
- - - , - "onClick": [MockFunction], - "variant": "plain", - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - - - - -
-
-
- - + + + + +
+ + `; exports[`Alert - success Action Link 1`] = ` - test @@ -3276,159 +2251,102 @@ exports[`Alert - success Action Link 1`] = ` title="" variant="success" > - - test - , - "children": "Some alert", - "title": "", - "variant": "success", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
- -
- - - - - -
-
-

- - Success alert: - -

-
- Some alert -
-
- + + + + +
+ +

+ + Success alert: + +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - success Action and Title 1`] = ` - test @@ -3437,160 +2355,103 @@ exports[`Alert - success Action and Title 1`] = ` title="Some title" variant="success" > - - test - , - "children": "Some alert", - "title": "Some title", - "variant": "success", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Success alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Success alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - success Custom aria label 1`] = ` - test @@ -3600,512 +2461,367 @@ exports[`Alert - success Custom aria label 1`] = ` title="Some title" variant="success" > - - test - , - "aria-label": "Custom aria label for success", - "children": "Some alert", - "title": "Some title", - "variant": "success", - } - } - consumerContext={null} +
- - test - - } - aria-label="Custom aria label for success" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Success alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Success alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - success Description 1`] = ` - - -
- -
- - - - - -
-
-

- - Success alert: - -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Success alert: + +

+
+ Some alert +
+ + `; exports[`Alert - success Title 1`] = ` - - -
- -
- - - - - -
-
-

- - Success alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Success alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - success Toast alerts match snapsnot 1`] = ` - - -
- -
- - - - - -
-
-

- - Success alert: - - Some title -

-
- Some toast alert -
+ + + + +
-
-
-
+ +

+ + Success alert: + + Some title +

+
+ Some toast alert +
+ + `; exports[`Alert - success inline variation 1`] = ` - - -
- -
- - - - - -
-
-

- - Success alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Success alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - warning Action Close Button 1`] = ` - - , - "children": "Some alert", - "title": "", - "variant": "warning", - } - } - consumerContext={null} +
- - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
- + + + + +
+
+

+ + Warning alert: + +

+
+ Some alert +
+
+ + - - - - -
-
- -
-
+ + + + + + + `; exports[`Alert - warning Action Link 1`] = ` - test @@ -4302,159 +2956,102 @@ exports[`Alert - warning Action Link 1`] = ` title="" variant="warning" > - - test - , - "children": "Some alert", - "title": "", - "variant": "warning", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="" +
- -
- - - - - -
-
-

- - Warning alert: - -

-
- Some alert -
-
- + + + + +
+ +

+ + Warning alert: + +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - warning Action and Title 1`] = ` - test @@ -4463,160 +3060,103 @@ exports[`Alert - warning Action and Title 1`] = ` title="Some title" variant="warning" > - - test - , - "children": "Some alert", - "title": "Some title", - "variant": "warning", - } - } - consumerContext={null} +
- - test - - } - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Warning alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Warning alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - warning Custom aria label 1`] = ` - test @@ -4626,506 +3166,361 @@ exports[`Alert - warning Custom aria label 1`] = ` title="Some title" variant="warning" > - - test - , - "aria-label": "Custom aria label for warning", - "children": "Some alert", - "title": "Some title", - "variant": "warning", - } - } - consumerContext={null} +
- - test - - } - aria-label="Custom aria label for warning" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Some title" +
- -
- - - - - -
-
-

- - Warning alert: - - Some title -

-
- Some alert -
-
- + + + + +
+ +

+ + Warning alert: + + Some title +

+
+ Some alert +
+
+ + - - - - -
-
-
- - + test + + + + +
+ + `; exports[`Alert - warning Description 1`] = ` - - -
- -
- - - - - -
-
-

- - Warning alert: - -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Warning alert: + +

+
+ Some alert +
+ + `; exports[`Alert - warning Title 1`] = ` - - -
- -
- - - - - -
-
-

- - Warning alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Warning alert: + + Some title +

+
+ Some alert +
+ + `; exports[`Alert - warning Toast alerts match snapsnot 1`] = ` - - -
- -
- - - - - -
-
-

- - Warning alert: - - Some title -

-
- Some toast alert -
+ + + + +
-
-
-
+ +

+ + Warning alert: + + Some title +

+
+ Some toast alert +
+ + `; exports[`Alert - warning inline variation 1`] = ` - - -
- -
- - - - - -
-
-

- - Warning alert: - - Some title -

-
- Some alert -
+ + + + +
-
-
-
+ +

+ + Warning alert: + + Some title +

+
+ Some alert +
+ + `; diff --git a/packages/react-core/src/components/AlertGroup/__tests__/__snapshots__/AlertGroup.test.tsx.snap b/packages/react-core/src/components/AlertGroup/__tests__/__snapshots__/AlertGroup.test.tsx.snap index 7833eec1d8c..09b1cd2551f 100644 --- a/packages/react-core/src/components/AlertGroup/__tests__/__snapshots__/AlertGroup.test.tsx.snap +++ b/packages/react-core/src/components/AlertGroup/__tests__/__snapshots__/AlertGroup.test.tsx.snap @@ -11,83 +11,64 @@ exports[`Standard Alert Group is not a toast alert group 1`] = `
  • - - -
    - -
    - - - - - -
    -
    -

    - - Danger alert: - - alert title -

    + + +
    -
    -
    -
    + +

    + + Danger alert: + + alert title +

    + +
  • @@ -108,6 +89,9 @@ exports[`Toast Alert Group contains expected modifier class 1`] = `
    - - -
    - -
    - - - - - -
    -
    -

    - - Warning alert: - - alert title -

    + + +
    -
    -
    -
    + +

    + + Warning alert: + + alert title +

    +
    + @@ -253,6 +218,9 @@ exports[`alertgroup closes when alerts are closed 1`] = `
    - - , - "isLiveRegion": true, - "title": "Test Alert", - } - } - consumerContext={null} +
    - - } - isLiveRegion={true} - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - title="Test Alert" +
    + + + + + +
    +
    +

    + + Info alert: + + Test Alert +

    +
    + - -
    - - -
    -
    -

    - - Info alert: - - Test Alert -

    -
    - - - , - "onClick": [MockFunction], - "variant": "plain", - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - - - - -
    -
    -
    - - + + + + +
    +
    + diff --git a/packages/react-core/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncher.test.tsx.snap b/packages/react-core/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncher.test.tsx.snap index a341d15778d..6bb648daf9f 100644 --- a/packages/react-core/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncher.test.tsx.snap +++ b/packages/react-core/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncher.test.tsx.snap @@ -26,8 +26,9 @@ exports[`ApplicationLauncher should match snapshot (auto-generated) 1`] = ` } } > - } > - } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isGrouped": false, - "isOpen": true, - "position": "left", - "toggle": - - , - } - } - consumerContext={null} + , - } - } - > - + + + , + } + } + > + - - + @@ -545,330 +305,455 @@ exports[`ApplicationLauncher custom icon 1`] = ` transform="rotate(180 0 512) scale(-1 1)" /> - - - - - - - + , + } + } + > + + + + + + + + `; @@ -929,8 +814,9 @@ exports[`ApplicationLauncher dropup + right aligned 1`] = ` /> } > - } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isGrouped": false, - "isOpen": false, - "position": "right", - "toggle": - - , - } - } - consumerContext={null} + , - } - } + class="pf-c-app-launcher pf-m-top pf-m-align-right" + data-ouia-component-id="3" + data-ouia-component-type="PF4/Dropdown" + data-ouia-safe="true" > + , + } + } + > + + - - - - - - + + + , + } + } + > + + + + + `; @@ -1318,8 +1090,9 @@ exports[`ApplicationLauncher dropup 1`] = ` /> } > - } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isGrouped": false, - "isOpen": false, - "position": "left", - "toggle": - - , - } - } - consumerContext={null} + , - } - } + class="pf-c-app-launcher pf-m-top" + data-ouia-component-id="2" + data-ouia-component-type="PF4/Dropdown" + data-ouia-safe="true" > + , + } + } + > + - - - - - - - - + + + , + } + } + > + + + + + `; @@ -1707,8 +1366,9 @@ exports[`ApplicationLauncher expanded 1`] = ` /> } > - } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isGrouped": false, - "isOpen": true, - "position": "left", - "toggle": - - , - } - } - consumerContext={null} + , - } - } - > - + + + , + } + } + > + - - + @@ -2187,330 +1610,453 @@ exports[`ApplicationLauncher expanded 1`] = ` transform="" /> - - - - - - - + + + `; @@ -2571,8 +2117,9 @@ exports[`ApplicationLauncher regular 1`] = ` /> } > - } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isGrouped": false, - "isOpen": false, - "position": "left", - "toggle": - - , - } - } - consumerContext={null} + , - } - } + class="pf-c-app-launcher" + data-ouia-component-id="0" + data-ouia-component-type="PF4/Dropdown" + data-ouia-safe="true" > + , + } + } + > + + - - - - - - + + + , + } + } + > + + + + + `; @@ -2960,8 +2393,9 @@ exports[`ApplicationLauncher right aligned 1`] = ` /> } > - } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isGrouped": false, - "isOpen": false, - "position": "right", - "toggle": - - , - } - } - consumerContext={null} + , - } - } + class="pf-c-app-launcher pf-m-align-right" + data-ouia-component-id="1" + data-ouia-component-type="PF4/Dropdown" + data-ouia-safe="true" > + , + } + } + > + + - - - - - - + + + , + } + } + > + + + + + `; diff --git a/packages/react-core/src/components/Breadcrumb/Breadcrumb.tsx b/packages/react-core/src/components/Breadcrumb/Breadcrumb.tsx index b95fe747ac9..525ddf1cafd 100644 --- a/packages/react-core/src/components/Breadcrumb/Breadcrumb.tsx +++ b/packages/react-core/src/components/Breadcrumb/Breadcrumb.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import styles from '@patternfly/react-styles/css/components/Breadcrumb/breadcrumb'; import { css } from '@patternfly/react-styles'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; export interface BreadcrumbProps extends React.HTMLProps { /** Children nodes be rendered to the BreadCrumb. Should be of type BreadCrumbItem. */ @@ -12,26 +12,19 @@ export interface BreadcrumbProps extends React.HTMLProps { 'aria-label'?: string; } -const Breadcrumb: React.FunctionComponent = ({ +export const Breadcrumb: React.FunctionComponent = ({ children = null, className = '', 'aria-label': ariaLabel = 'Breadcrumb', - ouiaContext = null, - ouiaId = null, + ouiaId, ...props -}: BreadcrumbProps & InjectedOuiaProps) => ( +}: BreadcrumbProps & OUIAProps) => ( ); - -const BreadcrumbWithOuiaContext = withOuiaContext(Breadcrumb); -export { BreadcrumbWithOuiaContext as Breadcrumb }; diff --git a/packages/react-core/src/components/Breadcrumb/__tests__/Generated/__snapshots__/Breadcrumb.test.tsx.snap b/packages/react-core/src/components/Breadcrumb/__tests__/Generated/__snapshots__/Breadcrumb.test.tsx.snap index 3ee2fe72d61..6fdd26b6ed1 100644 --- a/packages/react-core/src/components/Breadcrumb/__tests__/Generated/__snapshots__/Breadcrumb.test.tsx.snap +++ b/packages/react-core/src/components/Breadcrumb/__tests__/Generated/__snapshots__/Breadcrumb.test.tsx.snap @@ -1,7 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Breadcrumb should match snapshot (auto-generated) 1`] = ` - - - + `; diff --git a/packages/react-core/src/components/Breadcrumb/__tests__/__snapshots__/Breadcrumb.test.tsx.snap b/packages/react-core/src/components/Breadcrumb/__tests__/__snapshots__/Breadcrumb.test.tsx.snap index b4a04999235..0039879504b 100644 --- a/packages/react-core/src/components/Breadcrumb/__tests__/__snapshots__/Breadcrumb.test.tsx.snap +++ b/packages/react-core/src/components/Breadcrumb/__tests__/__snapshots__/Breadcrumb.test.tsx.snap @@ -1,235 +1,161 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Breadcrumb component should render breadcrumb with aria-label 1`] = ` - - - - - - - +
      + + `; exports[`Breadcrumb component should render breadcrumb with children 1`] = ` - - - Item 1 - , - " ", - - Item 1 - , - ], - } - } - consumerContext={null} + +
    + + `; exports[`Breadcrumb component should render breadcrumb with className 1`] = ` - - - - - - - +
      + + `; exports[`Breadcrumb component should render default breadcrumb 1`] = ` - - + + `; diff --git a/packages/react-core/src/components/Button/Button.tsx b/packages/react-core/src/components/Button/Button.tsx index da4c8af596d..e0c197043ea 100644 --- a/packages/react-core/src/components/Button/Button.tsx +++ b/packages/react-core/src/components/Button/Button.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import styles from '@patternfly/react-styles/css/components/Button/button'; import { css } from '@patternfly/react-styles'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; export enum ButtonVariant { primary = 'primary', @@ -52,7 +52,7 @@ export interface ButtonProps extends React.HTMLProps { tabIndex?: number; } -const Button: React.FunctionComponent = ({ +export const Button: React.FunctionComponent = ({ children = null, className = '', component = 'button', @@ -67,11 +67,10 @@ const Button: React.FunctionComponent = ({ iconPosition = 'left', 'aria-label': ariaLabel = null, icon = null, - ouiaContext = null, ouiaId = null, tabIndex = null as number, ...props -}: ButtonProps & InjectedOuiaProps) => { +}: ButtonProps & OUIAProps) => { const Component = component as any; const isButtonElement = Component === 'button'; return ( @@ -93,10 +92,7 @@ const Button: React.FunctionComponent = ({ disabled={isButtonElement ? isDisabled : null} tabIndex={isDisabled && !isButtonElement ? -1 : tabIndex} type={isButtonElement ? type : null} - {...(ouiaContext.isOuia && { - 'data-ouia-component-type': 'Button', - 'data-ouia-component-id': ouiaId || ouiaContext.ouiaId - })} + {...getOUIAProps('Button', ouiaId)} > {icon && variant === ButtonVariant.link && iconPosition === 'left' && ( {icon} @@ -109,6 +105,3 @@ const Button: React.FunctionComponent = ({ ); }; - -const ButtonWithOuiaContext = withOuiaContext(Button); -export { ButtonWithOuiaContext as Button }; diff --git a/packages/react-core/src/components/Button/__tests__/Generated/__snapshots__/Button.test.tsx.snap b/packages/react-core/src/components/Button/__tests__/Generated/__snapshots__/Button.test.tsx.snap index d707e6651bb..bbfce54b702 100644 --- a/packages/react-core/src/components/Button/__tests__/Generated/__snapshots__/Button.test.tsx.snap +++ b/packages/react-core/src/components/Button/__tests__/Generated/__snapshots__/Button.test.tsx.snap @@ -1,7 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Button should match snapshot (auto-generated) 1`] = ` - - - + `; diff --git a/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap b/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap index 9ac6e60da7f..79151056b14 100644 --- a/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +++ b/packages/react-core/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap @@ -1,384 +1,203 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`aria-disabled is set to true and tabIndex to -1 if component is not a button and is disabled 1`] = ` - - - - - + Disabled Anchor Button + + `; exports[`control button 1`] = ` - - - - - - + control + Button + + `; exports[`danger button 1`] = ` - - - - - - + danger + Button + + `; exports[`isBlock 1`] = ` - - - - - - + Block Button + + `; exports[`isDisabled 1`] = ` - - - - - - + Disabled Button + + `; exports[`isFocus 1`] = ` - - - - - - + Focused Button + + `; exports[`isHover 1`] = ` - - - - - - + Hovered Button + + `; exports[`isInline 1`] = ` - - - - - - + Hovered Button + + + `; exports[`link button 1`] = ` - - - - - - + link + Button + + + `; exports[`link with icon 1`] = ` - - , - "variant": "link", - } - } - consumerContext={null} + - - - + + + + + + Block Button + + + `; exports[`plain button 1`] = ` - - - - - - + plain + Button + + `; exports[`primary button 1`] = ` - - - - - - + primary + Button + + `; exports[`secondary button 1`] = ` - - - - - - + secondary + Button + + `; exports[`tertiary button 1`] = ` - - - - - - + tertiary + Button + + `; diff --git a/packages/react-core/src/components/ChipGroup/Chip.tsx b/packages/react-core/src/components/ChipGroup/Chip.tsx index 99dfe3b8194..65872c0e039 100644 --- a/packages/react-core/src/components/ChipGroup/Chip.tsx +++ b/packages/react-core/src/components/ChipGroup/Chip.tsx @@ -5,7 +5,7 @@ import { Tooltip } from '../Tooltip'; import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon'; import styles from '@patternfly/react-styles/css/components/Chip/chip'; import GenerateId from '../../helpers/GenerateId/GenerateId'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; export interface ChipProps extends React.HTMLProps { /** Content rendered inside the chip text */ @@ -30,8 +30,8 @@ interface ChipState { isTooltipVisible: boolean; } -class Chip extends React.Component { - constructor(props: ChipProps & InjectedOuiaProps) { +export class Chip extends React.Component { + constructor(props: ChipProps & OUIAProps) { super(props); this.state = { isTooltipVisible: false @@ -57,15 +57,12 @@ class Chip extends React.Component { } renderOverflowChip = () => { - const { children, className, onClick, ouiaContext, ouiaId } = this.props; + const { children, className, onClick, ouiaId } = this.props; const Component = this.props.component as any; return ( {children} @@ -75,16 +72,7 @@ class Chip extends React.Component { }; renderChip = (randomId: string) => { - const { - children, - closeBtnAriaLabel, - tooltipPosition, - className, - onClick, - isReadOnly, - ouiaContext, - ouiaId - } = this.props; + const { children, closeBtnAriaLabel, tooltipPosition, className, onClick, isReadOnly, ouiaId } = this.props; const Component = this.props.component as any; if (this.state.isTooltipVisible) { return ( @@ -92,10 +80,7 @@ class Chip extends React.Component { {children} @@ -117,10 +102,7 @@ class Chip extends React.Component { return ( {children} @@ -146,6 +128,3 @@ class Chip extends React.Component { ); } } - -const ChipWithOuiaContext = withOuiaContext(Chip); -export { ChipWithOuiaContext as Chip }; diff --git a/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/Chip.test.tsx.snap b/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/Chip.test.tsx.snap index b9244a60fd2..031848c52f6 100644 --- a/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/Chip.test.tsx.snap +++ b/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/Chip.test.tsx.snap @@ -1,7 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Chip should match snapshot (auto-generated) 1`] = ` - + - + `; diff --git a/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/ChipButton.test.tsx.snap b/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/ChipButton.test.tsx.snap index 5fc4c852410..99c9775080d 100644 --- a/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/ChipButton.test.tsx.snap +++ b/packages/react-core/src/components/ChipGroup/__tests__/Generated/__snapshots__/ChipButton.test.tsx.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ChipButton should match snapshot (auto-generated) 1`] = ` - ReactNode - + `; diff --git a/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/Chip.test.tsx.snap b/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/Chip.test.tsx.snap index ce1d7b13448..555dcb68d8c 100644 --- a/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/Chip.test.tsx.snap +++ b/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/Chip.test.tsx.snap @@ -1,455 +1,264 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Chip closable 1`] = ` - - - - + Chip + + -
      - - Chip - - - - -
      - - - -
      + + + + + +
      +
    + + `; exports[`Chip closable with tooltip 1`] = ` - - - - -
    + + - - - - -
    -
    -
    -
    -
    + + + + + + +
    + + `; exports[`Chip overflow 1`] = ` - - - - -
    - - - - 4 more - , - "className": "", - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - - - - -
    -
    -
    -
    -
    + 4 more + + + + +
    + + `; exports[`Chip readonly 1`] = ` - - - - -
    - - 4 more - -
    -
    -
    -
    -
    + 4 more + +
    + + `; exports[`ChipButton 1`] = ` @@ -457,58 +266,30 @@ exports[`ChipButton 1`] = ` className="chip-bttn-cls" id="my-chip-button" > - - - Close - , - "className": "chip-bttn-cls", - "id": "my-chip-button", - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + Close + + + `; diff --git a/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/ChipGroup.test.tsx.snap b/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/ChipGroup.test.tsx.snap index e40ce7ecbb6..321c2df301b 100644 --- a/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/ChipGroup.test.tsx.snap +++ b/packages/react-core/src/components/ChipGroup/__tests__/__snapshots__/ChipGroup.test.tsx.snap @@ -14,9 +14,17 @@ exports[`ChipGroup chip group default 1`] = ` onToggleCollapse={[Function]} withToolbar={false} > - + 1.1 - + `; @@ -43,9 +51,17 @@ exports[`ChipGroup chip group with closable toolbar 1`] = ` onClick={[Function]} tooltipPosition="top" > - + 1.1 - + @@ -73,9 +89,17 @@ exports[`ChipGroup chip group with toolbar 1`] = ` onClick={[Function]} tooltipPosition="top" > - + 1.1 - + @@ -103,9 +127,17 @@ exports[`ChipGroup chip group with toolbar and tooltip 1`] = ` onClick={[Function]} tooltipPosition="bottom" > - + 1.1 - + diff --git a/packages/react-core/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap b/packages/react-core/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap index 127abc6f145..88be6962ed8 100644 --- a/packages/react-core/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap +++ b/packages/react-core/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap @@ -63,7 +63,7 @@ exports[`Renders ContextSelector open 1`] = ` type="search" value="" /> - - + - - + `; diff --git a/packages/react-core/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap b/packages/react-core/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap index a1458165bf7..6779adbf492 100644 --- a/packages/react-core/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap +++ b/packages/react-core/src/components/DataList/__tests__/__snapshots__/DataList.test.tsx.snap @@ -33,11 +33,11 @@ exports[`DataList DataListAction button 1`] = `
    - Delete - +
    `; diff --git a/packages/react-core/src/components/DataToolbar/__tests__/__snapshots__/DataToolbar.test.tsx.snap b/packages/react-core/src/components/DataToolbar/__tests__/__snapshots__/DataToolbar.test.tsx.snap index 5f29e85af84..b0ae2680060 100644 --- a/packages/react-core/src/components/DataToolbar/__tests__/__snapshots__/DataToolbar.test.tsx.snap +++ b/packages/react-core/src/components/DataToolbar/__tests__/__snapshots__/DataToolbar.test.tsx.snap @@ -43,86 +43,55 @@ exports[`data toolbar DataToolbarFilter 1`] = `
    - - , - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    - - , - , - ], - "isExpanded": false, - "onSelect": [Function], - "onToggle": [Function], - "selections": "Running", - "variant": "single", + "width": "", } } - consumerContext={null} > - - - + + , + } + } + type="button" + variant="single" + > + + + +
  • @@ -419,6 +337,9 @@ exports[`data toolbar DataToolbarFilter 1`] = `
  • @@ -471,6 +394,9 @@ exports[`data toolbar DataToolbarFilter 1`] = ` >
  • @@ -557,296 +485,178 @@ exports[`data toolbar DataToolbarFilter 1`] = `
      - - - - -
    • + +
    • -
      -
      -
      -
      - + + + + + + + + + - - - -
    • + + - - - - -
    • -
      -
      -
      -
      + + + + + + + + +
  • @@ -872,203 +682,95 @@ exports[`data toolbar DataToolbarFilter 1`] = `
    - - , - , - ], - "isExpanded": false, - "onSelect": [Function], - "onToggle": [Function], - "selections": "Low", - "variant": "single", + "width": "", } } - consumerContext={null} > - - - + +
    , + } + } + type="button" + variant="single" + > + + + +
  • @@ -1141,6 +900,9 @@ exports[`data toolbar DataToolbarFilter 1`] = `
  • @@ -1193,6 +957,9 @@ exports[`data toolbar DataToolbarFilter 1`] = ` >
  • @@ -1279,151 +1048,92 @@ exports[`data toolbar DataToolbarFilter 1`] = `
      - - - - + Low + + -
    • - - Low - - - - -
    • -
      -
      -
      -
      + + + + + + + + +
  • @@ -1471,6 +1181,8 @@ exports[`data toolbar DataToolbarFilter 1`] = ` > - -
    -
    + Clear all filters + + + @@ -1615,6 +1305,9 @@ exports[`data toolbar DataToolbarFilter 1`] = ` >
  • @@ -1647,6 +1342,9 @@ exports[`data toolbar DataToolbarFilter 1`] = `
  • @@ -1699,6 +1399,9 @@ exports[`data toolbar DataToolbarFilter 1`] = ` >
  • @@ -1739,6 +1444,8 @@ exports[`data toolbar DataToolbarFilter 1`] = ` > - - - + Clear all filters + + + @@ -1870,142 +1555,96 @@ exports[`data toolbar DataToolbarItemsAndGroups 1`] = `
    - - , - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    - - , - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    @@ -2242,86 +1881,55 @@ exports[`data toolbar DataToolbarToggleGroup 1`] = `
    - - , - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    - - , - , - ], - "isExpanded": false, - "onSelect": [Function], - "onToggle": [Function], - "selections": "Running", - "variant": "single", + "width": "", } } - consumerContext={null} > - - - + + , + } + } + type="button" + variant="single" + > + + + +
    - - , - , - ], - "isExpanded": false, - "onSelect": [Function], - "onToggle": [Function], - "selections": "Low", - "variant": "single", + "width": "", } } - consumerContext={null} > - - - + +
    , + } + } + type="button" + variant="single" + > + + + +
    diff --git a/packages/react-core/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap b/packages/react-core/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap index ee4d69b1754..7a85fec5ff3 100644 --- a/packages/react-core/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap +++ b/packages/react-core/src/components/Drawer/__tests__/__snapshots__/Drawer.test.tsx.snap @@ -67,78 +67,51 @@ exports[`Drawer isExpanded = false and isInline = false and isStatic = false 1`]
    - - , - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    @@ -230,78 +203,51 @@ exports[`Drawer isExpanded = false and isInline = true and isStatic = false 1`]
    - - , - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    @@ -393,78 +339,51 @@ exports[`Drawer isExpanded = true and isInline = false and isStatic = false 1`]
    - - , - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    @@ -556,78 +475,51 @@ exports[`Drawer isExpanded = true and isInline = false and isStatic = true 1`] =
    - - , - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    @@ -719,78 +611,51 @@ exports[`Drawer isExpanded = true and isInline = true and isStatic = false 1`] =
    - - , - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={null} + - - - + + + + +
    diff --git a/packages/react-core/src/components/Dropdown/DropdownWithContext.tsx b/packages/react-core/src/components/Dropdown/DropdownWithContext.tsx index 75412344590..77b43f7a036 100644 --- a/packages/react-core/src/components/Dropdown/DropdownWithContext.tsx +++ b/packages/react-core/src/components/Dropdown/DropdownWithContext.tsx @@ -4,10 +4,10 @@ import { css } from '@patternfly/react-styles'; import { DropdownMenu } from './DropdownMenu'; import { DropdownProps } from './Dropdown'; import { DropdownContext, DropdownDirection, DropdownPosition } from './dropdownConstants'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; import { PickOptional } from '../../helpers/typeUtils'; -class DropdownWithContext extends React.Component { +export class DropdownWithContext extends React.Component { openedOnEnter = false; baseComponentRef = React.createRef(); @@ -27,7 +27,7 @@ class DropdownWithContext extends React.Component 0 && props.children) { // eslint-disable-next-line no-console @@ -61,7 +61,6 @@ class DropdownWithContext extends React.Component {React.Children.map(toggle, oneToggle => React.cloneElement(oneToggle, { @@ -129,7 +125,3 @@ class DropdownWithContext extends React.Component - @@ -39,6 +41,6 @@ exports[`Dropdown should match snapshot (auto-generated) 1`] = `
    ReactNode
    -
    + `; diff --git a/packages/react-core/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap b/packages/react-core/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap index b525f18c575..04310230f06 100644 --- a/packages/react-core/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +++ b/packages/react-core/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap @@ -9,184 +9,116 @@ exports[`KebabToggle basic 1`] = ` /> } > - } > - - BASIC - , - "isOpen": true, - "toggle": , - } - } - consumerContext={null} +
    - - } - > -
    - - -
    -
    - BASIC -
    -
    -
    , - } - } - > - - -
    -
    - BASIC -
    -
    -
    , - } - } + "current":
    +
    +
    + BASIC +
    +
    +
    , + } + } + > + + - -
    - +
    +
    + BASIC +
    +
    + , + } + } + > + + + + + - -
    -
    + + + `; @@ -369,7 +347,9 @@ exports[`KebabToggle dropup + right aligned 1`] = ` /> } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" position="right" toggle={ } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - + - Separated Action - , - ], - "position": "right", - "toggle": + + + +`; + +exports[`KebabToggle dropup 1`] = ` + - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={false} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="right" - toggle={ - - } - > -
    - - -
    , - } - } - > - - - , - } - } - > - - -
    - -
    -
    -
    - -`; - -exports[`KebabToggle dropup 1`] = ` - - Link - , - + Link + , + } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" toggle={ } > - - Link - , - + - Action - , - `; @@ -1791,7 +1209,10 @@ exports[`KebabToggle expanded 1`] = ` /> } > - , ] } + isGrouped={false} isOpen={true} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" toggle={ } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isOpen": true, - "toggle": , - } - } - consumerContext={null} - > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} - isOpen={true} - isPlain={false} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } - > -
    - - - -
    , - } - } - > - - - - , - } - } +
    + - - - - - -
    -
    -
    -
    - + + , + } + } + > + + + + , + } + } + > + + + + + + + + + `; exports[`KebabToggle plain 1`] = ` @@ -2920,7 +2059,10 @@ exports[`KebabToggle plain 1`] = ` /> } > - , ] } + isGrouped={false} + isOpen={false} isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" toggle={ } > - - Link - , - - Action - , - + - Disabled Link - , - - - - - + + + + + + + + `; @@ -3629,7 +2489,10 @@ exports[`KebabToggle regular 1`] = ` /> } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" toggle={ } > - + - Link - , - - - - - + + + + + + + + `; @@ -4337,7 +2920,10 @@ exports[`KebabToggle right aligned 1`] = ` /> } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" position="right" toggle={ } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "position": "right", - "toggle": , - } - } - consumerContext={null} - > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={false} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="right" - toggle={ - - } - > -
    - - -
    , - } - } - > - - - , - } - } +
    + +
    , + } + } + > + + - -
    - -
    -
    -
    + + , + } + } + > + + + + + `; @@ -4918,8 +3222,17 @@ exports[`dropdown basic 1`] = ` } > - } > - - BASIC - , - "isOpen": true, - "toggle": - Dropdown - , - } - } - consumerContext={null} +
    - + +
    +
    + BASIC +
    +
    +
    , } } - position="left" - toggle={ - - Dropdown - - } > -
    - - -
    -
    - BASIC -
    -
    -
    , - } - } - > - - -
    -
    - BASIC -
    -
    - , - } - } - > - -
    - - +
    +
    + BASIC +
    +
    + , + } + } + > + + + + + - -
    -
    + + + `; @@ -5301,7 +3579,9 @@ exports[`dropdown dropup + right aligned 1`] = ` } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" position="right" toggle={ } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - + - Separated Action - , - ], - "position": "right", - "toggle": + + + +`; + +exports[`dropdown dropup 1`] = ` + - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={false} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="right" - toggle={ - - Dropdown - - } - > -
    - - -
    , - } - } - > - - - , - } - } - > - - -
    - - - -
    - -`; - -exports[`dropdown dropup 1`] = ` - - Link - , - + Link + , + } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" toggle={ } > - - Link - , - + - Action - , - `; @@ -6769,7 +4479,10 @@ exports[`dropdown expanded 1`] = ` } > - Separated Link - , - - Separated Action - , - ] - } - isOpen={true} - toggle={ - - Dropdown - - } - > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "isOpen": true, - "toggle": - Dropdown - , - } - } - consumerContext={null} - > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} - isOpen={true} - isPlain={false} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - Dropdown - - } - > -
    - - - -
    , - } - } - > - - - - , - } - } + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={true} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + + Dropdown + + } + > +
    + - - - - - -
    -
    -
    -
    + + , + } + } + > + + + + , + } + } + > + + + + + + + + `; @@ -7921,7 +5348,10 @@ exports[`dropdown primary 1`] = ` } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" toggle={ } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "toggle": - Dropdown - , - } - } - consumerContext={null} +
    - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} + - Dropdown - - } - > -
    - - -
    , - } - } - > - - -
    , - } - } + "current":
    +
    , + } + } + > + + - -
    - - - -
    + + , + } + } + > + + + + + `; @@ -8655,7 +5799,10 @@ exports[`dropdown regular 1`] = ` } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" toggle={ } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "toggle": - Dropdown - , - } - } - consumerContext={null} +
    - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} + - Dropdown - - } - > -
    - - -
    , - } - } - > - - -
    , - } - } + "current":
    +
    , + } + } + > + + - -
    - - - -
    + + , + } + } + > + + + + + `; @@ -9386,7 +6249,10 @@ exports[`dropdown right aligned 1`] = ` } > - , ] } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + ouiaComponentType="Dropdown" position="right" toggle={ } > - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ], - "position": "right", - "toggle": - Dropdown - , - } - } - consumerContext={null} +
    - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - - Separated Link - , - - Separated Action - , - ] - } - isGrouped={false} + - Dropdown - - } - > -
    - - -
    , - } - } - > - - -
    , - } - } + "current":
    +
    , + } + } + > + + - -
    - - - -
    + + , + } + } + > + + + + + `; diff --git a/packages/react-core/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap b/packages/react-core/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap index 45367cf8f28..753bd0ff101 100644 --- a/packages/react-core/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap +++ b/packages/react-core/src/components/EmptyState/__tests__/__snapshots__/EmptyState.test.tsx.snap @@ -13,18 +13,18 @@ exports[`EmptyState Main 1`] = ` Defining HTTP Proxies that exist on your network allows you to perform various actions through those proxies. - New HTTP Proxy - + - Learn more about this in the documentation. - + `; diff --git a/packages/react-core/src/components/FileUpload/__tests__/__snapshots__/FileUploadField.test.tsx.snap b/packages/react-core/src/components/FileUpload/__tests__/__snapshots__/FileUploadField.test.tsx.snap index bee42a75056..d12cf12c71f 100644 --- a/packages/react-core/src/components/FileUpload/__tests__/__snapshots__/FileUploadField.test.tsx.snap +++ b/packages/react-core/src/components/FileUpload/__tests__/__snapshots__/FileUploadField.test.tsx.snap @@ -18,21 +18,21 @@ exports[`simple fileuploadfield 1`] = ` placeholder="Do something custom with this!" value="" /> - Browse... - - +
    - 'Log In' - + `; diff --git a/packages/react-core/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap b/packages/react-core/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap index 70c354485d3..72b83fbdf8d 100644 --- a/packages/react-core/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap +++ b/packages/react-core/src/components/LoginPage/__tests__/__snapshots__/LoginForm.test.tsx.snap @@ -55,7 +55,7 @@ exports[`LoginForm with rememberMeLabel 1`] = ` /> - Log In - + `; @@ -123,7 +123,7 @@ exports[`LoginForm with rememberMeLabel and rememberMeAriaLabel uses the remembe /> - Log In - + `; @@ -178,7 +178,7 @@ exports[`should render Login form 1`] = ` /> - Log In - + `; diff --git a/packages/react-core/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxCloseButton.test.tsx.snap b/packages/react-core/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxCloseButton.test.tsx.snap index 16a61cf31f4..910f511ef3a 100644 --- a/packages/react-core/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxCloseButton.test.tsx.snap +++ b/packages/react-core/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxCloseButton.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ModalBoxCloseButton should match snapshot (auto-generated) 1`] = ` - - + `; diff --git a/packages/react-core/src/components/Modal/__tests__/__snapshots__/ModalBoxCloseButton.test.tsx.snap b/packages/react-core/src/components/Modal/__tests__/__snapshots__/ModalBoxCloseButton.test.tsx.snap index 701ea7044b7..4e8016de6f4 100644 --- a/packages/react-core/src/components/Modal/__tests__/__snapshots__/ModalBoxCloseButton.test.tsx.snap +++ b/packages/react-core/src/components/Modal/__tests__/__snapshots__/ModalBoxCloseButton.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ModalBoxCloseButton Test 1`] = ` - - + `; diff --git a/packages/react-core/src/components/Nav/Nav.tsx b/packages/react-core/src/components/Nav/Nav.tsx index d687f98330e..86e51ceb8b6 100644 --- a/packages/react-core/src/components/Nav/Nav.tsx +++ b/packages/react-core/src/components/Nav/Nav.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import styles from '@patternfly/react-styles/css/components/Nav/nav'; import { css } from '@patternfly/react-styles'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; import { Omit } from '../../helpers/typeUtils'; export type NavSelectClickHandler = ( @@ -38,7 +38,7 @@ export interface NavProps export const NavContext = React.createContext({}); -class Nav extends React.Component { +export class Nav extends React.Component { static defaultProps: NavProps = { 'aria-label': '', children: null, @@ -100,7 +100,6 @@ class Nav extends React.Component { // eslint-disable-next-line @typescript-eslint/no-unused-vars onToggle, theme, - ouiaContext, ouiaId, ...props } = this.props; @@ -143,10 +142,7 @@ class Nav extends React.Component { : 'Global' : ariaLabel } - {...(ouiaContext.isOuia && { - 'data-ouia-component-type': 'Nav', - 'data-ouia-component-id': ouiaId || ouiaContext.ouiaId - })} + {...getOUIAProps('Nav', ouiaId)} {...props} > {children} @@ -155,6 +151,3 @@ class Nav extends React.Component { ); } } - -const NavWithOuiaContext = withOuiaContext(Nav); -export { NavWithOuiaContext as Nav }; diff --git a/packages/react-core/src/components/Nav/__tests__/Generated/__snapshots__/Nav.test.tsx.snap b/packages/react-core/src/components/Nav/__tests__/Generated/__snapshots__/Nav.test.tsx.snap index 7737f1dc3d9..6216685dbbc 100644 --- a/packages/react-core/src/components/Nav/__tests__/Generated/__snapshots__/Nav.test.tsx.snap +++ b/packages/react-core/src/components/Nav/__tests__/Generated/__snapshots__/Nav.test.tsx.snap @@ -1,7 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Nav should match snapshot (auto-generated) 1`] = ` - - - + + + `; diff --git a/packages/react-core/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap b/packages/react-core/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap index 8836240d84c..1e3351e6fcb 100644 --- a/packages/react-core/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +++ b/packages/react-core/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap @@ -1,2082 +1,1553 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Dark Nav List 1`] = ` - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - , - "className": "test=nav-class", - "theme": "dark", - } - } - consumerContext={null} +
  • + + + + + `; exports[`Default Nav List - Trigger item active update 1`] = ` - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - , - } - } - consumerContext={null} + `; exports[`Default Nav List 1`] = ` - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - , - "className": "test=nav-class", - } - } - consumerContext={null} + + +`; + +exports[`Expandable Nav List - Trigger toggle 1`] = ` + `; exports[`Expandable Nav List 1`] = ` - - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - - , - } - } - consumerContext={null} + `; exports[`Expandable Nav List with aria label 1`] = ` - - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - - , - } - } - consumerContext={null} + + `; exports[`Horizontal Nav List 1`] = ` - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - , - } - } - consumerContext={null} + `; exports[`Nav Grouped List 1`] = ` - - + + +`; + +exports[`Nav List with custom item nodes 1`] = ` + - - + + + + + + + `; exports[`Simple Nav List 1`] = ` - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - , - } - } - consumerContext={null} + `; exports[`Tertiary Nav List 1`] = ` - - - - Link 1 - - - Link 2 - - - Link 3 - - - Link 4 - - , - } - } - consumerContext={null} + `; diff --git a/packages/react-core/src/components/NotificationBadge/__tests__/Generated/__snapshots__/NotificationBadge.test.tsx.snap b/packages/react-core/src/components/NotificationBadge/__tests__/Generated/__snapshots__/NotificationBadge.test.tsx.snap index 4a2b3c0e2a2..6a6cfe153a0 100644 --- a/packages/react-core/src/components/NotificationBadge/__tests__/Generated/__snapshots__/NotificationBadge.test.tsx.snap +++ b/packages/react-core/src/components/NotificationBadge/__tests__/Generated/__snapshots__/NotificationBadge.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`NotificationBadge should match snapshot (auto-generated) 1`] = ` - - + `; diff --git a/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap b/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap index 6911058f16a..fff822c719f 100644 --- a/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap +++ b/packages/react-core/src/components/NotificationBadge/__tests__/__snapshots__/NotificationBadge.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`false NotificationBadge 1`] = ` - - + `; exports[`true NotificationBadge 1`] = ` - - + `; diff --git a/packages/react-core/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenu.test.tsx.snap b/packages/react-core/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenu.test.tsx.snap index 272869d1c5d..8ec1853eba3 100644 --- a/packages/react-core/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenu.test.tsx.snap +++ b/packages/react-core/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenu.test.tsx.snap @@ -18,8 +18,9 @@ exports[`OptionsMenu should match snapshot (auto-generated) 1`] = ` } } > - diff --git a/packages/react-core/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap b/packages/react-core/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap index a20444b314d..6c8076d63af 100644 --- a/packages/react-core/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap +++ b/packages/react-core/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap @@ -44,8 +44,10 @@ exports[`optionsMenu expanded 1`] = ` } > - Options Menu } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "expanded", - "isGrouped": false, - "isOpen": true, - "toggle": - Options Menu - , - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="expanded" - isGrouped={false} + + + +
    , } } - position="left" - toggle={ - - Options Menu - - } > -
    + + +
    , + } + } > - - - , - } - } + onClick={[Function]} + onKeyDown={[Function]} + type="button" > - - - - , - } - } + + - - - - - + + + + + + + + + + + + + `; @@ -1180,8 +1092,10 @@ exports[`optionsMenu isDisabled 1`] = ` } > - } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "disabled", - "isGrouped": false, - "toggle": - Options Menu - , - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="disabled" - isGrouped={false} + + +
    , } } - position="left" - toggle={ - - Options Menu - - } > -
    + +
    , + } + } > - - , - } - } - > - - - , - } - } - > - - - , - } - } - > - - - - - - -
    -
    + , + } + } + > + + + + + + `; @@ -1585,7 +1407,8 @@ exports[`optionsMenu open up 1`] = ` } > - Options Menu } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "openUp", - "isGrouped": false, - "toggle": - Options Menu - , - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="openUp" - isGrouped={false} + + +
    , } } - position="left" - toggle={ - - Options Menu - - } > -
    + +
    , + } + } > - - , - } - } + onClick={[Function]} + onKeyDown={[Function]} + type="button" > - - - , - } - } + + - - - - - - -
    -
    + + + + + + + + `; @@ -1982,8 +1716,10 @@ exports[`optionsMenu plain 1`] = ` } > - Options Menu } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "plain", - "isGrouped": false, - "isPlain": true, - "toggle": - Options Menu - , - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="plain" - isGrouped={false} + + +
    , } } - position="left" - toggle={ - - Options Menu - - } > -
    + +
    , + } + } > - - , - } - } + onClick={[Function]} + onKeyDown={[Function]} + type="button" > - - - , - } - } - > - - - - - - -
    -
    + + + + + + + `; @@ -2300,8 +1946,10 @@ exports[`optionsMenu regular 1`] = ` } > - Options Menu } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "regular", - "isGrouped": false, - "toggle": - Options Menu - , - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="regular" - isGrouped={false} + + +
    , } } - position="left" - toggle={ - - Options Menu - - } > -
    + +
    , + } + } > - - , - } - } - > - - - , - } - } - > - - - , - } - } - > - - - - - - -
    -
    + + , + } + } + > + + + + + + `; @@ -2696,7 +2256,8 @@ exports[`optionsMenu right aligned + open up 1`] = ` } > - @@ -2742,126 +2307,136 @@ exports[`optionsMenu right aligned + open up 1`] = ` } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "rightAlignedOpenUp", - "isGrouped": false, - "position": "right", - "toggle": - Options Menu - , - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="rightAlignedOpenUp" - isGrouped={false} + + +
    , } } - position="right" - toggle={ - - Options Menu - - } > -
    + +
    , + } + } > - - , - } - } + onClick={[Function]} + onKeyDown={[Function]} + type="button" > - - - , - } - } + + - - - - - - -
    -
    + + + + + + + + `; @@ -3095,8 +2565,10 @@ exports[`optionsMenu right aligned 1`] = ` } > - @@ -3140,125 +2616,136 @@ exports[`optionsMenu right aligned 1`] = ` } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "rightAligned", - "isGrouped": false, - "position": "right", - "toggle": - Options Menu - , - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="rightAligned" - isGrouped={false} + + +
    , } } - position="right" - toggle={ - - Options Menu - - } > -
    + +
    , + } + } > - - , - } - } + onClick={[Function]} + onKeyDown={[Function]} + type="button" > - - - , - } - } + + - - - - - - -
    -
    + + + + + + + + `; @@ -3496,8 +2878,10 @@ exports[`optionsMenu text 1`] = ` /> } > - } > - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ], - "id": "text", - "isGrouped": false, - "toggle": - Test -
    - } - toggleText="Test" - />, - } - } - consumerContext={null} +
    - - - Name - - - Date - - - Disabled - - - Size - - , - , - - - Ascending - - - Descending - - , - ] - } - id="text" - isGrouped={false} + +
    + + Test + + +
    +
    , } } - position="left" - toggle={ - - Test - - } - toggleText="Test" - /> + toggleButtonContents={ + + Test + } + toggleText="Test" >
    - -
    - - Test - - -
    -
    , - } - } - toggleButtonContents={ - - Test - - } - toggleText="Test" + -
    - - Test - - -
    -
    + Test + + - - - + + + `; diff --git a/packages/react-core/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap b/packages/react-core/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap index 660ec0dbcb5..c5a54ba5780 100644 --- a/packages/react-core/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +++ b/packages/react-core/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap @@ -321,200 +321,164 @@ exports[`Check page to verify breadcrumb is created 1`] = ` className="pf-c-page__main-breadcrumb" > - - - Section Home - , - - Section Title - , - - Section Title - , - - Section Landing - , - ], - } - } - consumerContext={null} + + + + Section Home @@ -582,7 +546,7 @@ exports[`Check page to verify skip to content points to main content region 1`] > Section Landing - + } className="my-page-class" defaultManagedSidebarIsOpen={true} @@ -683,200 +647,164 @@ exports[`Check page to verify skip to content points to main content region 1`]
    - - - Section Home - , - - Section Title - , - - Section Title - , - - Section Landing - , - ], - } - } - consumerContext={null} + + +
    { }; let paginationId = 0; -class Pagination extends React.Component { +export class Pagination extends React.Component { paginationRef = React.createRef(); - static defaultProps: PickOptional = { + static defaultProps: PickOptional = { children: null, className: '', variant: PaginationVariant.top, @@ -175,7 +175,6 @@ class Pagination extends React.Component { onNextClick: () => undefined, onPageInput: () => undefined, onLastClick: () => undefined, - ouiaContext: null, ouiaId: null }; @@ -189,7 +188,7 @@ class Pagination extends React.Component { handleInputWidth(this.getLastPage(), node); } - componentDidUpdate(prevProps: PaginationProps & InjectedOuiaProps) { + componentDidUpdate(prevProps: PaginationProps & OUIAProps) { const node = this.paginationRef.current; if (prevProps.perPage !== this.props.perPage || prevProps.itemCount !== this.props.itemCount) { handleInputWidth(this.getLastPage(), node); @@ -222,7 +221,6 @@ class Pagination extends React.Component { onNextClick, onPageInput, onLastClick, - ouiaContext, ouiaId, ...props } = this.props; @@ -257,10 +255,7 @@ class Pagination extends React.Component { className )} id={`${widgetId}-${paginationId++}`} - {...(ouiaContext.isOuia && { - 'data-ouia-component-type': 'Pagination', - 'data-ouia-component-id': ouiaId || ouiaContext.ouiaId - })} + {...getOUIAProps('Pagination', ouiaId)} {...props} > {variant === PaginationVariant.top && ( @@ -318,6 +313,3 @@ class Pagination extends React.Component { ); } } - -const PaginationWithOuiaContext = withOuiaContext(Pagination); -export { PaginationWithOuiaContext as Pagination }; diff --git a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap index 053968d3008..1333de23b13 100644 --- a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap +++ b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap @@ -5,7 +5,7 @@ exports[`Navigation should match snapshot (auto-generated) 1`] = ` aria-label="'Pagination'" className="pf-c-pagination__nav ''" > - - - +
    @@ -54,7 +54,7 @@ exports[`Navigation should match snapshot (auto-generated) 1`] = ` 0 ''s
    - - - + `; diff --git a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap index 6775ffe577f..124c3619dac 100644 --- a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap +++ b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap @@ -1,7 +1,84 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Pagination should match snapshot (auto-generated) 1`] = ` - - - +
    +
    + +
    + + + ReactNode +
    `; diff --git a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap index 84cd63a24b7..5e544dc5764 100644 --- a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap +++ b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/PaginationOptionsMenu.test.tsx.snap @@ -18,11 +18,17 @@ exports[`PaginationOptionsMenu should match snapshot (auto-generated) 1`] = ` } } > - - +
    - + + + 1 + - + 10 + + + of + + 40 + + + +
    + -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + + } >
    - - - 1 - - - 10 - - - of - - 40 - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - + +
    + , } + } + showToggle={true} + toggleTemplate="\${firstIndex} - \${lastIndex} - \${itemCount} - \${itemsTitle}" + widgetId="pagination-options-menu" + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} + + 1 - 10 - 40 - + + - } - > -
    - -
    - - 1 - 10 - 40 - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate="\${firstIndex} - \${lastIndex} - \${itemCount} - \${itemsTitle}" - widgetId="pagination-options-menu" - > -
    - - 1 - 10 - 40 - - - -
    - - 1 - 10 - 40 - - - -
    -
    , - } - } +
    - + 1 - 10 - 40 - + + -
    -
    , - } - } + type="button" + > + + + + , + } + } + > + +
    + + 1 - 10 - 40 - + - - -
    - - - -
    -
    - - - + + + `; exports[`component render custom perPageOptions 1`] = ` - - +
    - + + + 1 + - + 10 + + + of + + 40 + + + +
    + -
    + some + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + + } >
    - - - 1 - - - 10 - - - of - - 40 - - - -
    - - - some - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - + + + 1 + - + 10 + + + of + + 40 + + + + + +
    + , } + } + showToggle={true} + toggleTemplate={[Function]} + widgetId="pagination-options-menu" + > +
    - - some - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } + -
    - -
    - - - 1 - - - 10 - - - of - - 40 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    + 1 + - + 10 + + + of + + 40 + + + + + - - 1 @@ -1409,264 +988,118 @@ exports[`component render custom perPageOptions 1`] = ` 40 - - - -
    - - - 1 - - - 10 - - - of - - 40 - - - - - -
    -
    , - } - } - > - + -
    - , - } - } + type="button" + > + + + + , + } + } + > + +
    + + + 1 + - + 10 + + + of + + 40 + + + + - - -
    - - - -
    -
    - - - - - - - -
    -`; - -exports[`component render custom start end 1`] = ` - - - + + + + + + + -
    -
    - - - 1 - - - 10 - - - of - - 40 - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } + -
    - , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    - - - - 5 - - - 15 - - - of - - 40 - - - - - -
    - - - 5 - - - 15 - - - of - - 40 - - - - - -
    -
    , - } - } - > - -
    - - - 5 - - - 15 - - - of - - 40 - - - - - -
    - , - } - } - > - -
    - - - - - -
    -
    - - + + + + + + +
    + + +
    + + + - - -
    - - , - "data-action": "last", - "isDisabled": false, - "onClick": [Function], - "variant": "plain", - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - - - - - - - - - + + + + + + + + + `; exports[`component render empty per page options 1`] = ` - - +
    - + + + 1 + - + 10 + + + of + + 40 + + + +
    + -
    -
    - - - 1 - - - 10 - - - of - - 40 - - - -
    - + } + > +
    - - } - > - , - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - } - > -
    - -
    -
    , - } - } - showToggle={false} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    - -
    - - - - - - - -
    - -
    -
    -`; - -exports[`component render last page 1`] = ` - - - -
    -
    - - - 11 - - - 20 - - - of - - 20 - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ], - "isOpen": false, - "isPlain": true, - "toggle": , - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } - > -
    - -
    - - - 11 - - - 20 - - - of - - 20 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    - - - - 11 - - - 20 - - - of - - 20 - - - - - -
    - - - 11 - - - 20 - - - of - - 20 - - - - - -
    -
    , - } - } - > - -
    - - - 11 - - - 20 - - - of - - 20 - - - - - -
    -
    , - } - } - > - - - -
    - -
    - -
    -
    - - - - - - - - -`; - -exports[`component render limited number of pages 1`] = ` - - - -
    -
    - - - 1 - - - 20 - - - of - - 20 - - - -
    - - - 10 - - per page - - , - - 20 - - per page - - - - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - - 10 - - per page - - , - - 20 - - per page - - - - - , - - 50 - - per page - - , - - 100 - - per page - - , - ], - "isOpen": false, - "isPlain": true, - "toggle": , - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - 10 - - per page - - , - - 20 - - per page - - - - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } - > -
    - -
    - - - 1 - - - 20 - - - of - - 20 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    - - - - 1 - - - 20 - - - of - - 20 - - - - - -
    - - - 1 - - - 20 - - - of - - 20 - - - - - -
    -
    , - } - } - > - -
    - - - 1 - - - 20 - - - of - - 20 - - - - - -
    -
    , - } - } - > - - - - - - - -
    -
    - - - - - - - - -`; - -exports[`component render no items 1`] = ` - - - -
    -
    - - - 0 - - - 0 - - - of - - 0 - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ], - "isOpen": false, - "isPlain": true, - "toggle": , - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } - > -
    - -
    - - - 0 - - - 0 - - - of - - 0 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    - - - - 0 - - - 0 - - - of - - 0 - - - - - -
    - - - 0 - - - 0 - - - of - - 0 - - - - - -
    -
    , - } - } - > - -
    - - - 0 - - - 0 - - - of - - 0 - - - - - -
    -
    , - } - } - > - - - - - - - -
    -
    - - - - - - - - -`; - -exports[`component render should render correctly bottom 1`] = ` - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ], - "isOpen": false, - "isPlain": true, - "toggle": , - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } - > -
    - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    - - - - 1 - - - 10 - - - of - - 20 - - - - - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - > - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - > - - - - - - - -
    -
    - - - + + + `; -exports[`component render should render correctly compact 1`] = ` - - +
    - + + + 11 + - + 20 + + + of + + 20 + + + +
    + -
    -
    - - - 1 - - + 10 - - - of - + + per page + + + + + , + 20 - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ], - "isOpen": false, - "isPlain": true, - "toggle": , - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } + + per page + + , + - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + + } + > +
    + +
    + + + 11 + - + 20 + + + of + + 20 + + + + + +
    +
    , + } + } + showToggle={true} + toggleTemplate={[Function]} + widgetId="pagination-options-menu" + > +
    + -
    - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    + 11 + - + 20 + + + of + + 20 + + + + + - - - 1 + 11 - - 10 + 20 of @@ -8581,264 +2901,118 @@ exports[`component render should render correctly compact 1`] = ` 20 - - - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - > - + -
    -
    , - } - } + class=" pf-c-options-menu__toggle-button" + id="pagination-options-menu-toggle-6" + type="button" + > + + + + , + } + } + > + +
    + + + 11 + - + 20 + + + of + + 20 + + + + - - -
    - - - -
    -
    - - - - - - - - -`; - -exports[`component render should render correctly disabled 1`] = ` - - - + + + + + + + + + + + +`; + +exports[`component render no items 1`] = ` + +
    +
    + + + 0 + - + 0 + + + of + + 0 + + + +
    + -
    -
    - - - 1 - - - 10 - - - of - - 20 - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ], - "isOpen": false, - "isPlain": true, - "toggle": , - } - } - consumerContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } + - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } + 10 + -
    - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    - - - - 1 - - - 10 - - - of - - 20 - - - - - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - > - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - > - - - -
    - - - -
    -
    - - - + + + `; -exports[`component render should render correctly top 1`] = ` - - +
    - + + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + } - } - toggleTemplate={[Function]} - variant="top" - widgetId="pagination-options-menu" - > -
    - - - 1 - - - 10 - - - of - - 20 - - - -
    - - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isOpen={false} - isPlain={true} - toggle={ - - } - > - + + + 1 + - + 10 + + + of + + 20 + + + + + +
    +
    , } + } + showToggle={true} + toggleTemplate={[Function]} + widgetId="pagination-options-menu" + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } + -
    - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    + 1 + - + 10 + + + of + + 20 + + + + + - - 1 @@ -10579,264 +5135,118 @@ exports[`component render should render correctly top 1`] = ` 20 - - - -
    - - - 1 - - - 10 - - - of - - 20 - - - - - -
    -
    , - } - } - > - + -
    - , - } - } + class=" pf-c-options-menu__toggle-button" + id="pagination-options-menu-toggle-1" + type="button" > + + + + , + } + } + > + +
    + + + 1 + - + 10 + + + of + + 20 + + + + - - -
    - - - -
    -
    - - - + + + `; -exports[`component render titles 1`] = ` - - - + + + 1 + - + 10 + + + of + + 20 + + + + + -
    -
    - - - 1 - - + 10 - - - of - - 40 - - - values - -
    - + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + + } + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } + - } - > - +
    + + + 1 + - + 10 + + + of + + 20 + + + + + +
    +
    , } + } + showToggle={true} + toggleTemplate={[Function]} + widgetId="pagination-options-menu" + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } + -
    - -
    - - - 1 - - - 10 - - - of - - 40 - - - values - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    + 1 + - + 10 + + + of + + 20 + + + + + - - 1 @@ -11669,268 +6518,123 @@ exports[`component render titles 1`] = ` of - 40 + 20 - values - - - -
    - - - 1 - - - 10 - - - of - - 40 - - - values - - -
    -
    , - } - } - > - -
    - - - 1 - - - 10 - - - of - - 40 - - - values - - -
    -
    , - } - } + + + - - -
    - - - -
    -
    - - - + + + `; -exports[`component render up drop direction 1`] = ` - - +
    - + + + 1 + - + 10 + + + of + + 40 + + + values + +
    + -
    -
    - + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + - - 1 - - - 10 - - - of - - 40 - - - -
    - + } + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } + - } - > - +
    + + + 1 + - + 10 + + + of + + 40 + + + values + + +
    +
    , } + } + showToggle={true} + toggleTemplate={[Function]} + widgetId="pagination-options-menu" + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } + -
    - -
    - - - 1 - - - 10 - - - of - - 40 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    + 1 + - + 10 + + + of + + 40 + + + values + + + - - 1 @@ -12766,264 +8018,118 @@ exports[`component render up drop direction 1`] = ` 40 - - - -
    - - - 1 - - - 10 - - - of - - 40 - - - - - -
    -
    , - } - } - > - -
    - - - 1 - - - 10 - - - of - - 40 - - - - - -
    -
    , - } - } + values + + - - -
    - - - - - - - - + + + `; exports[`component render zero results 1`] = ` - - +
    - + + + 0 + - + 0 + + + of + + 0 + + + +
    + -
    -
    - + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + ouiaComponentType="Dropdown" + position="left" + toggle={ + - - 0 - - - 0 - - - of - - 0 - - - -
    - + } + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } + - } - > - +
    + + + 0 + - + 0 + + + of + + 0 + + + + + +
    +
    , } + } + showToggle={true} + toggleTemplate={[Function]} + widgetId="pagination-options-menu" + > +
    - - 10 - - per page - - - - - , - - 20 - - per page - - , - - 50 - - per page - - , - - 100 - - per page - - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaComponentType="Dropdown" - ouiaContext={ - Object { - "isOuia": false, - "ouiaId": null, - } - } - position="left" - toggle={ - - } + -
    - -
    - - - 0 - - - 0 - - - of - - 0 - - - - - -
    -
    , - } - } - showToggle={true} - toggleTemplate={[Function]} - widgetId="pagination-options-menu" - > -
    + 0 + - + 0 + + + of + + 0 + + + + + - - 0 @@ -13858,266 +9521,120 @@ exports[`component render zero results 1`] = ` 0 - - - -
    - - - 0 - - - 0 - - - of - - 0 - - - - - -
    -
    , - } - } - > - + -
    -
    , - } - } + type="button" + > + + + + , + } + } + > + +
    + + + 0 + - + 0 + + + of + + 0 + + + + - - -
    - - - -
    -
    - - - + + + `; diff --git a/packages/react-core/src/components/Popover/__tests__/Generated/__snapshots__/PopoverCloseButton.test.tsx.snap b/packages/react-core/src/components/Popover/__tests__/Generated/__snapshots__/PopoverCloseButton.test.tsx.snap index b263081d9c5..f982a78c594 100644 --- a/packages/react-core/src/components/Popover/__tests__/Generated/__snapshots__/PopoverCloseButton.test.tsx.snap +++ b/packages/react-core/src/components/Popover/__tests__/Generated/__snapshots__/PopoverCloseButton.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`PopoverCloseButton should match snapshot (auto-generated) 1`] = ` - - + `; diff --git a/packages/react-core/src/components/Select/Select.tsx b/packages/react-core/src/components/Select/Select.tsx index b88dc766e82..2d2f5f200c2 100644 --- a/packages/react-core/src/components/Select/Select.tsx +++ b/packages/react-core/src/components/Select/Select.tsx @@ -12,7 +12,7 @@ import { SelectContext, SelectVariant, SelectDirection, KeyTypes } from './selec import { Chip, ChipGroup } from '../ChipGroup'; import { keyHandler, getNextIndex } from '../../helpers/util'; import { Omit, PickOptional } from '../../helpers/typeUtils'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; import { Divider } from '../Divider'; // seed for the aria-labelledby ID @@ -95,7 +95,7 @@ export interface SelectState { creatableValue: string; } -class Select extends React.Component { +export class Select extends React.Component { private parentRef = React.createRef(); private filterRef = React.createRef(); private refCollection: HTMLElement[] = []; @@ -365,7 +365,6 @@ class Select extends React.Component - - +
    + + +
    + +
    +
    +
    +
    `; diff --git a/packages/react-core/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap b/packages/react-core/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap index b6c543ab445..036a724e536 100644 --- a/packages/react-core/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +++ b/packages/react-core/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap @@ -1,410 +1,93 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`checkbox select renders checkbox select groups successfully - old classes 1`] = ` - - - - - - - , - - - - - - , - ], - "isExpanded": true, - "isGrouped": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "checkbox", + "width": "", } } - consumerContext={null} > - - - Mr - - - - - - - -
    - -
    - - - - -
    -
    - - - - , - } - } - type="button" - variant="checkbox" - > - -
    - - +
    - - - + +
    +
    +
    - + Other + + + +
    -
    -
    - - - - -`; - -exports[`checkbox select renders checkbox select groups successfully 1`] = ` - - - - - - - , - , + } + } + type="button" + variant="checkbox" + > + + + -
    - +
    +
    + - -
    -
    -
    + -
    - -
    + + + +
    -
    -
    + + + +
    -
    + Other + + + +
    +
    + + +
    +
    + group 2
    +
    + + + + + + + + + + + + +
    -
    , - } - } - type="button" - variant="checkbox" - > - -
    -
    -
    + + + + + + + -
    -
    + +
    - , - } - } - type="button" - variant="checkbox" - > - + + + `; -exports[`checkbox select renders expanded successfully 1`] = ` - - , - , - , - , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "checkbox", + "width": "", } } - consumerContext={null} > - - - Mr - - - - - - - - - , - } - } - type="button" - variant="checkbox" - > - - - + , + } + } + type="button" + variant="checkbox" + > + + + + `; -exports[`checkbox select renders expanded successfully with custom objects 1`] = ` - - , - , - , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "checkbox", + "width": "", } } - consumerContext={null} > - - - Mr: User One - - - - - - - - , - } - } - type="button" - variant="checkbox" - > - - - - +
    - - - - + + - + + + Ms + + +
    -
    -
    - - -
    -
    + , + } + } + type="button" + variant="checkbox" + > + + + + +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    +
    +
    + + `; -exports[`checkbox select renders expanded with filtering successfully 1`] = ` - - , - , - , - , - ], - "hasInlineFilter": true, - "isExpanded": true, - "onClear": [MockFunction], - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "checkbox", + "width": "", } } - consumerContext={null} > - - -
    - - - - - - - - , - } - } - type="button" - variant="checkbox" - > -
    -
    - -
    -
    + - - - -
    -
    -
    - -
    -
    - - - - + + - + + - + + + Other + +
    -
    -
    - - -
    -
    + , + } + } + type="button" + variant="checkbox" + > + + + + +
    +
    +
    + + + + + + + + + + + + +
    +
    +
    +
    +
    + + `; -exports[`select custom select filter filters properly 1`] = ` - - , - , - , - + + +
    +
    +
    + + + +
    +
    +
    + , + } + } + type="button" + variant="checkbox" + > + +
    + + +
    +
    +
    + + + + + + + + + +
    +
    +
    +
    +
    + + +`; + +exports[`checkbox select renders expanded with filtering successfully 1`] = ` + + +
    + + + + + + + + , + } + } + type="button" + variant="checkbox" + > +
    +
    + +
    + +
    + + + +
    +
    +
    +
    + +
    + +
    +
    + + + + + + + + + + + + +
    +
    +
    +
    +
    + + +`; + +exports[`select custom select filter filters properly 1`] = ` + + + + + +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    + , + } + } + type="button" + variant="typeahead" + > +
    +
    + , - ], - "isExpanded": true, - "onFilter": [Function], - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "typeahead", + onFocus={[Function]} + placeholder="" + type="text" + value="r" + /> +
    + + +
    + + +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      +
    +
    + + +`; + +exports[`select renders select groups successfully 1`] = ` + -
    - + +
      +
      +
      + -
        - -
      • +
      • +
      • + -
      • -
      • +
      • +
      • + -
      • -
      -
      , - } - } - type="button" - variant="typeahead" + Ms + + +
    • + +
    • +
      +
    +
    , + } + } + type="button" + variant="single" + > + - - - - + + + + + +
      + -
        +
        + group 1 +
        -
      • - -
      • -
        - -
      - - - - - -`; - -exports[`select renders select groups successfully 1`] = ` - - - - - - -
      , - - - - - , - ], - "isExpanded": true, - "isGrouped": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "single", - } - } - consumerContext={null} - > - - - + Other + + + + + +
    +
    + + `; exports[`select renders up drection successfully 1`] = ` - - , - , - , - , - ], - "direction": "up", - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "single", + "width": "", } } - consumerContext={null} > - - - + + , + } + } + type="button" + variant="single" + > + + + + `; exports[`select single select renders closed successfully 1`] = ` - - , - , - , - , - ], - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "single", + "width": "", } } - consumerContext={null} > - - - -`; - -exports[`select single select renders disabled successfully 1`] = ` - - , - , - , - , - ], - "isDisabled": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "single", + + , + } + } + type="button" + variant="single" + > + + + + +`; + +exports[`select single select renders disabled successfully 1`] = ` + -
    - - -
    , - } - } - type="button" - variant="single" - > - - - - -
    -
    + + , + } + } + type="button" + variant="single" + > + + + + `; exports[`select single select renders expanded successfully 1`] = ` - - , - , - , - , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "single", + "width": "", } } - consumerContext={null} > - - - + + , + } + } + type="button" + variant="single" + > + + + +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      +
    +
    + + `; exports[`select single select renders expanded successfully with custom objects 1`] = ` - - , - , - , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "single", + "width": "", } } - consumerContext={null} > - - - + + , + } + } + type="button" + variant="single" + > + + + +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      +
    +
    + + `; exports[`select with custom content renders closed successfully 1`] = ` - - - - - + + , + } + } + type="button" + variant="single" + > + + + + `; exports[`select with custom content renders expanded successfully 1`] = ` - - - - - +
    + + `; exports[`toggle icon select checkbox 1`] = ` @@ -7188,570 +5776,288 @@ exports[`toggle icon typeahead select 1`] = ` `; exports[`typeahead multi select renders closed successfully 1`] = ` - - , - , - , - , - ], - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "typeaheadmulti", + "width": "", } } - consumerContext={null} > - - - - - , - } - } - type="button" - variant="typeaheadmulti" - > -
    - -
    -
    + - - - - -
    -
    -`; - -exports[`typeahead multi select renders expanded successfully 1`] = ` - - , - , - , - , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "typeaheadmulti", - } - } - consumerContext={null} - > - - - - -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    - , - } - } - type="button" - variant="typeaheadmulti" + transform="" + /> + + + + , + } + } + type="button" + variant="typeaheadmulti" + > +
    +
    -
    +
    + +
    + +
    + +`; + +exports[`typeahead multi select renders expanded successfully 1`] = ` + + + - - - -
      - + +
      • - -
      • -
        -
      • -
        -
      • -
        -
      - +
    + , + } + } + type="button" + variant="typeaheadmulti" + > +
    +
    + +
    +
    - -
    -
    + + +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      +
    +
    + + `; exports[`typeahead multi select renders selected successfully 1`] = ` - - , - , - , - , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "selections": Array [ - "Mr", - "Mrs", - ], - "variant": "typeaheadmulti", + "Mrs", + ] + } + toggleIcon={null} + toggleId={null} + variant="typeaheadmulti" + width="" +> +
    - -
    - - -
      -
    • + + + + + +
        +
      • +
      • -
      • + + +
      • +
      • +
      • -
      - , - } - } - type="button" - variant="typeaheadmulti" + + + +
    • +
    • + +
    • +
    • + +
    • +
    + , + } + } + type="button" + variant="typeaheadmulti" + > +
    +
    -
    -
    - -
      - - - + Mr + + - - - - - - - - + + + + + + + + + + +
    • - + Mrs + + - - -
    • -
      -
      - -
      -
      -
    -
    - + + + + + + + + + + + + +
    + +
    + + + +
    + + +
      + +
    • +
    • +
      + +
    • -
    - - +
    + -
      - -
    • - -
    • -
      - -
    • - -
    • -
      - -
    • - -
    • -
      - + + + +
    • + -
    • -
      -
    -
    - - -
    -
    + Other + + +
    + + + + `; exports[`typeahead multi select test onChange 1`] = ` - - , - , - , - , - ], - "isExpanded": true, - "onClear": [MockFunction], - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "typeahead", - } - } - consumerContext={null} - > - - - - - -
      -
    • - -
    • -
    - , - } - } - type="button" - variant="typeahead" - > -
    +
    - -
    -
    + - - - - -
      - + +
      • - -
      - +
    + , + } + } + type="button" + variant="typeahead" + > +
    +
    + +
    + +
    - -
    -
    + + +
      + +
    • + +
    • +
      +
    +
    + + `; exports[`typeahead select renders closed successfully 1`] = ` - - , - , - , - , - ], - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "typeahead", + "width": "", } } - consumerContext={null} > - - - - - , - } - } - type="button" - variant="typeahead" - > -
    - -
    -
    + - - - - -
    -
    -`; - -exports[`typeahead select renders expanded successfully 1`] = ` - - , - , - , - + + , + } + } + type="button" + variant="typeahead" + > +
    +
    + , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "typeahead", + onFocus={[Function]} + placeholder="" + type="text" + value="" + /> +
    + +
    + + + +`; + +exports[`typeahead select renders expanded successfully 1`] = ` + -
    - -
    -
    - -
    - -
    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -
    , - } - } - type="button" - variant="typeahead" - > -
    - -
    -
    + - - - -
      - + +
      • - -
      • -
        -
      • -
        -
      • -
        -
      - +
    + , + } + } + type="button" + variant="typeahead" + > +
    +
    + +
    +
    - -
    -
    + + +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      + +
    • + +
    • +
      +
    +
    + + `; exports[`typeahead select renders selected successfully 1`] = ` - - , - , - , - , - ], - "isExpanded": true, - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "selections": "Mr", - "variant": "typeahead", + "width": "", } } - consumerContext={null} > - - - - - -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    - , - } - } - type="button" - variant="typeahead" - > -
    - -
    -
    + - - - - -
      - + +
      • - -
      • - -
      • -
        - + > + +
      • -
        -
      • -
        -
      - - - - - -`; - -exports[`typeahead select test creatable option 1`] = ` - - + , + } + } + type="button" + variant="typeahead" + > +
      +
      + , - , - , - , - ], - "isCreatable": true, - "isExpanded": true, - "onToggle": [MockFunction], - "variant": "typeahead", - } - } - consumerContext={null} - > - -
      - - -
      -
        -
      • - -
      • -
      - , - } - } - type="button" - variant="typeahead" + isFocused={null} + isNoResultsOption={false} + isPlaceholder={false} + isSelected={true} + key=".$.$00" + keyHandler={[Function]} + onClick={[Function]} + sendRef={[Function]} + value="Mr" > -
      -
      - -
      + + + +
    • + +
    • +
      + +
    • +
      + +
    • + +
    • +
      +
    +
    + + +`; + +exports[`typeahead select test creatable option 1`] = ` + + + - - - -
      - + + + + +
      • - -
      - +
    + , + } + } + type="button" + variant="typeahead" + > +
    +
    + +
    + +
    - -
    -
    + + +
      + +
    • + +
    • +
      +
    +
    + + `; exports[`typeahead select test onChange 1`] = ` - - , - , - , - , - ], - "isExpanded": true, - "onClear": [MockFunction], - "onSelect": [MockFunction], - "onToggle": [MockFunction], - "variant": "typeahead", + "width": "", } } - consumerContext={null} > - - - - - -
      -
    • - -
    • -
    - , - } - } - type="button" - variant="typeahead" - > -
    - -
    -
    + - - - - -
      - + +
      • - -
      - +
    + , + } + } + type="button" + variant="typeahead" + > +
    +
    + +
    + +
    - -
    -
    + + +
      + +
    • + +
    • +
      +
    +
    + + `; diff --git a/packages/react-core/src/components/Switch/Switch.tsx b/packages/react-core/src/components/Switch/Switch.tsx index 865874f2beb..33893e96ff9 100644 --- a/packages/react-core/src/components/Switch/Switch.tsx +++ b/packages/react-core/src/components/Switch/Switch.tsx @@ -4,7 +4,7 @@ import { css } from '@patternfly/react-styles'; import CheckIcon from '@patternfly/react-icons/dist/js/icons/check-icon'; import { getUniqueId } from '../../helpers/util'; import { Omit } from '../../helpers/typeUtils'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; export interface SwitchProps extends Omit, 'type' | 'onChange' | 'disabled' | 'label'> { @@ -26,7 +26,7 @@ export interface SwitchProps 'aria-label'?: string; } -class Switch extends React.Component { +export class Switch extends React.Component { id = ''; static defaultProps: SwitchProps = { @@ -40,7 +40,7 @@ class Switch extends React.Component { onChange: () => undefined as any }; - constructor(props: SwitchProps & InjectedOuiaProps) { + constructor(props: SwitchProps & OUIAProps) { super(props); if (!props.id && !props['aria-label']) { // eslint-disable-next-line no-console @@ -59,21 +59,13 @@ class Switch extends React.Component { isChecked, isDisabled, onChange, - ouiaContext, ouiaId, ...props } = this.props; const isAriaLabelledBy = props['aria-label'] === ''; return ( - + `; exports[`switch is checked 1`] = ` - - - + + - - + On + + + + `; exports[`switch is checked and disabled 1`] = ` - - - + - - - - + + + + + + + `; exports[`switch is not checked 1`] = ` - - - + + - - + On + + + + `; exports[`switch is not checked and disabled 1`] = ` - - - + - - - - + + + + + + + `; exports[`switch with only label is checked 1`] = ` - - - + + - - + On + + + + `; exports[`switch with only label is not checked 1`] = ` - - - + + - - + Off + + + + `; diff --git a/packages/react-core/src/components/Tabs/Tabs.tsx b/packages/react-core/src/components/Tabs/Tabs.tsx index 3c4d44e53be..4f3cda90cbd 100644 --- a/packages/react-core/src/components/Tabs/Tabs.tsx +++ b/packages/react-core/src/components/Tabs/Tabs.tsx @@ -9,7 +9,7 @@ import { getUniqueId, isElementInView, sideElementIsOutOfView } from '../../help import { SIDE } from '../../helpers/constants'; import { TabButton } from './TabButton'; import { TabContent } from './TabContent'; -import { InjectedOuiaProps, withOuiaContext } from '../withOuia'; +import { getOUIAProps, OUIAProps } from '../../helpers'; export enum TabsVariant { div = 'div', @@ -53,9 +53,9 @@ export interface TabsState { shownKeys: (string | number)[]; } -class Tabs extends React.Component { +export class Tabs extends React.Component { tabList = React.createRef(); - constructor(props: TabsProps & InjectedOuiaProps) { + constructor(props: TabsProps & OUIAProps) { super(props); this.state = { showLeftScrollButton: false, @@ -199,7 +199,6 @@ class Tabs extends React.Component { rightScrollAriaLabel, 'aria-label': ariaLabel, variant, - ouiaContext, ouiaId, mountOnEnter, unmountOnExit, @@ -230,10 +229,7 @@ class Tabs extends React.Component { highlightRightScrollButton && styles.modifiers.endCurrent, className )} - {...(ouiaContext.isOuia && { - 'data-ouia-component-type': 'Tabs', - 'data-ouia-component-id': ouiaId || ouiaContext.ouiaId - })} + {...getOUIAProps('Tabs', ouiaId)} id={id && id} {...props} > @@ -291,7 +287,3 @@ class Tabs extends React.Component { ); } } - -const TabsWithOuiaContext = withOuiaContext(Tabs); - -export { TabsWithOuiaContext as Tabs }; diff --git a/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap b/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap index b77fc26aae2..7ed8884d713 100644 --- a/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +++ b/packages/react-core/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap @@ -1,7 +1,66 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Tabs should match snapshot (auto-generated) 1`] = ` - - - + +
    + +
      +
    • + +
    • +
    + +
    + + ReactNode + + } + id="string" + key="0/.0" + /> +
    `; diff --git a/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap b/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap index 820673afc86..7b64940f80f 100644 --- a/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +++ b/packages/react-core/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap @@ -1,1089 +1,963 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should call handleScrollButtons tabs with scrolls 1`] = ` - - - Tab 1 section - , - - Tab 2 section - , - - Tab 3 section - , - ], - "id": "handleScrollButtons", - "isFilled": true, - } - } - consumerContext={null} +
    - -
    - -
      + + + +
        +
      • + -
      • - - - - - - - -
      • -
      • + + + +
      • +
      • + + - - - - - - - -
      • -
      • + + + +
      • +
      • + + - - - - - - - -
      • -
      -
    + -
    - - Tab 1 section - - } + + + + +
    + - - Tab 1 section - - } + Tab 1 section + + } + id="tab1" + key="0/.0" + > + - - - - - Tab 2 section - - } + Tab 1 section + + } + id="tab1" + innerRef={null} + > + + + + - - Tab 2 section - - } + Tab 2 section + + } + id="tab2" + key="1/.1" + > + - - - - - Tab 3 section - - } + Tab 2 section + + } + id="tab2" + innerRef={null} + > + + + + - - Tab 3 section - - } + Tab 3 section + + } + id="tab3" + key="2/.2" + > + - - - - -
    -
    + Tab 3 section + + } + id="tab3" + innerRef={null} + > + + + + `; exports[`should call scrollLeft tabs with scrolls 1`] = ` - - - Tab 1 section - , - - Tab 2 section - , - - Tab 3 section - , - ], - "id": "scrollLeft", - "isFilled": true, - } - } - consumerContext={null} +
    - -
    - -
      + + + +
        +
      • + -
      • - - - - - - - -
      • -
      • + + + +
      • +
      • + + - - - - - - - -
      • -
      • + + + +
      • +
      • + + - - - - - - - -
      • -
      -
    + -
    - - Tab 1 section - - } + + + + +
    + - - Tab 1 section - - } + Tab 1 section + + } + id="tab1" + key="0/.0" + > + - - - - - Tab 2 section - - } + Tab 1 section + + } + id="tab1" + innerRef={null} + > + + + + - - Tab 2 section - - } + Tab 2 section + + } + id="tab2" + key="1/.1" + > + - - - - - Tab 3 section - - } + Tab 2 section + + } + id="tab2" + innerRef={null} + > + + + + - - Tab 3 section - - } + Tab 3 section + + } + id="tab3" + key="2/.2" + > + - - - - -
    -
    + Tab 3 section + + } + id="tab3" + innerRef={null} + > + + + + `; exports[`should call scrollRight tabs with scrolls 1`] = ` - - - Tab 1 section - , - - Tab 2 section - , - - Tab 3 section - , - ], - "id": "scrollRight", - "isFilled": true, - } - } - consumerContext={null} +
    - -
    - -
      + + + +
        +
      • + -
      • - - - - - - - -
      • -
      • + + + +
      • +
      • + + - - - - - - - -
      • -
      • + + + +
      • +
      • + + - - - - - - - -
      • -
      -
    + -
    - - Tab 1 section - - } + + + + +
    + - - Tab 1 section - - } + Tab 1 section + + } + id="tab1" + key="0/.0" + > + - - - - - Tab 2 section - - } + Tab 1 section + + } + id="tab1" + innerRef={null} + > + + + + - - Tab 2 section - - } + Tab 2 section + + } + id="tab2" + key="1/.1" + > + - - - - - Tab 3 section - - } + Tab 2 section + + } + id="tab2" + innerRef={null} + > + + + + - - Tab 3 section - - } + Tab 3 section + + } + id="tab3" + key="2/.2" + > + - - - - -
    -
    + Tab 3 section + + } + id="tab3" + innerRef={null} + > + + + + `; exports[`should render accessible tabs 1`] = ` @@ -1091,6 +965,9 @@ Array [