Skip to content

Commit cb9d5aa

Browse files
Merge pull request #95 from kmcfaul/react-19-support
feat(ver): add support for react 19
2 parents ad688a3 + 61b3972 commit cb9d5aa

File tree

16 files changed

+751
-25366
lines changed

16 files changed

+751
-25366
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"plugin:react/recommended",
1010
"plugin:react-hooks/recommended",
1111
"plugin:@typescript-eslint/recommended",
12+
"plugin:react/jsx-runtime",
1213
"prettier"
1314
],
1415
"overrides": [

package-lock.json

Lines changed: 0 additions & 24993 deletions
This file was deleted.

packages/module/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"@patternfly/react-icons": "^6.0.0"
3737
},
3838
"peerDependencies": {
39-
"react": "^17 || ^18",
40-
"react-dom": "^17 || ^18"
39+
"react": "^17 || ^18 || ^19",
40+
"react-dom": "^17 || ^18 || ^19"
4141
},
4242
"devDependencies": {
4343
"copyfiles": "2.4.1",

packages/module/patternfly-docs/content/examples/Advanced.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable no-console */
2-
import React from 'react';
2+
import { FunctionComponent, useState } from 'react';
33
import { FeedbackModal} from '@patternfly/react-user-feedback';
44
import { Button } from '@patternfly/react-core';
55
import feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';
66

7-
export const AdvancedExample: React.FunctionComponent = () => {
8-
const [isOpen, setIsOpen] = React.useState<boolean>(false);
7+
export const AdvancedExample: FunctionComponent = () => {
8+
const [isOpen, setIsOpen] = useState<boolean>(false);
99
const handleButtonClicked = () => {setIsOpen(true)};
1010
return <>
1111
<Button onClick={handleButtonClicked}>Show Modal</Button>

packages/module/patternfly-docs/content/examples/AdvancedWithEmail.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable no-console */
2-
import React from 'react';
2+
import { FunctionComponent, useState } from 'react';
33
import { FeedbackModal} from '@patternfly/react-user-feedback';
44
import { Button } from '@patternfly/react-core';
55
import feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';
66

7-
export const AdvancedStaticEmailExample: React.FunctionComponent = () => {
8-
const [isOpen, setIsOpen] = React.useState<boolean>(false);
7+
export const AdvancedStaticEmailExample: FunctionComponent = () => {
8+
const [isOpen, setIsOpen] = useState<boolean>(false);
99
const handleButtonClicked = () => {setIsOpen(true)};
1010
return <>
1111
<Button onClick={handleButtonClicked}>Show Modal</Button>

packages/module/patternfly-docs/content/examples/Async.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable no-console */
2-
import React from 'react';
2+
import { FunctionComponent, useState } from 'react';
33
import { FeedbackModal} from '@patternfly/react-user-feedback';
44
import { Button } from '@patternfly/react-core';
55

6-
export const AsyncExample: React.FunctionComponent = () => {
7-
const [isOpen, setIsOpen] = React.useState<boolean>(false);
6+
export const AsyncExample: FunctionComponent = () => {
7+
const [isOpen, setIsOpen] = useState<boolean>(false);
88

99
const fakeNetworkCall = (email:string, feedback:string, bug:string) => new Promise<boolean>(resolve => {
1010
setTimeout(() => {

packages/module/patternfly-docs/content/examples/basic.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,26 @@ propComponents: ['FeedbackModalProps']
1414
sourceLink: https://github.com/patternfly/react-user-feedback/blob/c0c51c751abf0b798f511806409f25d2a2e87a60/packages/module/patternfly-docs/content/examples/basic.md
1515
---
1616

17+
import { FunctionComponent, useState } from 'react';
1718
import { FeedbackModal } from "@patternfly/react-user-feedback";
1819
import feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';
1920

2021
## About
21-
22+
2223
The user feedback extension is a PatternFly React based component used to collect user feedback. Examples of how to use this extension are documented below. This extensions allows users to submit feedback, report a bug, request support, as well as join a mailing list to stay updated on the latest news and research opportunities.
2324

2425
## Examples
2526

2627
### Basic modal
28+
2729
To collect data, you can link modal items to external sources instead of a built in form. For example, you can link to a custom form, which will be opened in a new tab.
2830

2931
```js file="./URL.tsx"
3032

3133
```
3234

3335
### Advanced modal
36+
3437
User feedback offers additional modal items that support different types of feedback. To allow users to report a bug, use the `onReportABug` property. To allow users to join a mailing list, such as one dedicated to future research participation, use the `onJoinMailingList` property. To allow users to open a support case, use the `onOpenSupportCase` property and link users to your support team.
3538

3639
The following example demonstrates each of these modal items. The "Share feedback", "Report a bug", and "Inform the direction of products" items all point to built-in forms.
@@ -40,20 +43,26 @@ The following example demonstrates each of these modal items. The "Share feedbac
4043
```
4144

4245
### Advanced that autofills an email address
46+
4347
To automatically pass a user's email address into a feedback modal, use the email property. This allows you to pre-populate the modal's email field.
48+
4449
```js file="./AdvancedWithEmail.tsx"
4550

4651
```
52+
4753
### Modal with asynchronous call support
48-
User feedback supports the ability to make asynchronous calls to send data collected from the modal to a backend service.
49-
54+
55+
User feedback supports the ability to make asynchronous calls to send data collected from the modal to a backend service.
5056
The following example demonstrates how to use the `async` function to send data to a backend service.
57+
5158
```js file="./Async.tsx"
5259

5360
```
5461

5562
### Modal with internationalization support
63+
5664
To customize the content displayed in the feedback modal, pass in a custom `i18n` object with values for each property of `<FeedbackModal>`. This allows you to prepare a modal for different languages and requirements.
65+
5766
```js file="./i18n.tsx"
5867

59-
```
68+
```

packages/module/patternfly-docs/generated/extensions/user-feedback/react.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3+
import { FunctionComponent, useState } from 'react';
34
import { FeedbackModal } from "@patternfly/react-user-feedback";
45
import feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';
56
const pageData = {
@@ -14,7 +15,7 @@ const pageData = {
1415
"source": "react",
1516
"tabName": null,
1617
"slug": "/extensions/user-feedback/react",
17-
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/module/patternfly-docs/content/examples/basic.md",
18+
"sourceLink": "https://github.com/patternfly/react-user-feedback/blob/c0c51c751abf0b798f511806409f25d2a2e87a60/packages/module/patternfly-docs/content/examples/basic.md",
1819
"relPath": "packages/module/patternfly-docs/content/examples/basic.md",
1920
"propComponents": [
2021
{
@@ -51,7 +52,7 @@ const pageData = {
5152
{
5253
"name": "onJoinMailingList",
5354
"type": "string | ((email: string) => boolean | Promise<boolean>)",
54-
"description": "If a URL is given the join mailing list link will redirect to another site to join the mailing list. \nIf a function is provided we will display a join mailing list screen with a submit button. The callback function should return a boolean or a Promise if the callback is successful or unsuccessful.\nIf it's undefined then report a bug will be removed from share feedback modal"
55+
"description": "If a URL is given the join mailing list link will redirect to another site to join the mailing list.\nIf a function is provided we will display a join mailing list screen with a submit button. The callback function should return a boolean or a Promise if the callback is successful or unsuccessful.\nIf it's undefined then report a bug will be removed from share feedback modal"
5556
},
5657
{
5758
"name": "onOpenSupportCase",
@@ -61,12 +62,12 @@ const pageData = {
6162
{
6263
"name": "onReportABug",
6364
"type": "string | ((email: string, bug: string) => boolean | Promise<boolean>)",
64-
"description": "If a URL is given the report a bug link will redirect to another site to report the bug. \nIf a function is provided we will display a feedback screen with a submit button. The callback function should return a boolean or a Promise \nif the callback is successful or unsuccessful.\nIf it's undefined then join mailing list will be removed from the share feedback modal"
65+
"description": "If a URL is given the report a bug link will redirect to another site to report the bug.\nIf a function is provided we will display a feedback screen with a submit button. The callback function should return a boolean or a Promise\nif the callback is successful or unsuccessful.\nIf it's undefined then join mailing list will be removed from the share feedback modal"
6566
},
6667
{
6768
"name": "onShareFeedback",
6869
"type": "string | ((email: string, feedback: string) => boolean | Promise<boolean>)",
69-
"description": "If a URL is given the share feedback link will redirect to another site share feedback. \nIf a function is provided we will display a share feedback screen with a submit button. The callback function should return a boolean or a Promise if the callback is successful or unsuccessful.",
70+
"description": "If a URL is given the share feedback link will redirect to another site share feedback.\nIf a function is provided we will display a share feedback screen with a submit button. The callback function should return a boolean or a Promise if the callback is successful or unsuccessful.",
7071
"required": true
7172
}
7273
]
@@ -81,6 +82,8 @@ const pageData = {
8182
]
8283
};
8384
pageData.liveContext = {
85+
FunctionComponent,
86+
useState,
8487
FeedbackModal,
8588
feedbackImage
8689
};
@@ -93,7 +96,7 @@ pageData.examples = {
9396
</p>
9497
</Example>,
9598
'Advanced modal': props =>
96-
<Example {...pageData} {...props} {...{"code":"/* eslint-disable no-console */\nimport React from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\nimport feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';\n\nexport const AdvancedExample: React.FunctionComponent = () => {\n const [isOpen, setIsOpen] = React.useState<boolean>(false);\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n onShareFeedback={(email:string, feedback:string)=>{\n // Example of a successful callback\n console.log (`Email Address: ${email} Feedback: ${feedback}`);\n return true\n }}\n onJoinMailingList={(email:string)=>{\n // Example of am unsuccessful callback\n console.log (`Email Address: ${email}`);\n return false;\n }}\n onOpenSupportCase='https://pf-user-feedback-extension-form-demos.surge.sh/requestSupport.html'\n onReportABug={(email:string, bug:string)=>{\n console.log (`Email Address: ${email} Bug: ${bug}`)\n return true;}}\n feedbackImg={feedbackImage}\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}","title":"Advanced modal","lang":"js","className":""}}>
99+
<Example {...pageData} {...props} {...{"code":"/* eslint-disable no-console */\nimport { FunctionComponent, useState } from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\nimport feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';\n\nexport const AdvancedExample: FunctionComponent = () => {\n const [isOpen, setIsOpen] = useState<boolean>(false);\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n onShareFeedback={(email:string, feedback:string)=>{\n // Example of a successful callback\n console.log (`Email Address: ${email} Feedback: ${feedback}`);\n return true\n }}\n onJoinMailingList={(email:string)=>{\n // Example of am unsuccessful callback\n console.log (`Email Address: ${email}`);\n return false;\n }}\n onOpenSupportCase='https://pf-user-feedback-extension-form-demos.surge.sh/requestSupport.html'\n onReportABug={(email:string, bug:string)=>{\n console.log (`Email Address: ${email} Bug: ${bug}`)\n return true;}}\n feedbackImg={feedbackImage}\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}","title":"Advanced modal","lang":"js","className":""}}>
97100

98101
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
99102
{`User feedback offers additional modal items that support different types of feedback. To allow users to report a bug, use the `}
@@ -119,21 +122,18 @@ pageData.examples = {
119122
</p>
120123
</Example>,
121124
'Advanced that autofills an email address': props =>
122-
<Example {...pageData} {...props} {...{"code":"/* eslint-disable no-console */\nimport React from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\nimport feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';\n\nexport const AdvancedStaticEmailExample: React.FunctionComponent = () => {\n const [isOpen, setIsOpen] = React.useState<boolean>(false);\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n email='[email protected]'\n onShareFeedback={(email:string, feedback:string)=>{\n // Example of a successful callback\n console.log (`Email Address: ${email} Feedback: ${feedback}`);\n return true\n }}\n onJoinMailingList={(email:string)=>{\n // Example of am unsuccessful callback\n console.log (`Email Address: ${email}`);\n return false;\n }}\n onOpenSupportCase='https://pf-user-feedback-extension-form-demos.surge.sh/requestSupport.html'\n onReportABug={(email:string, bug:string)=>{\n console.log (`Email Address: ${email} Bug: ${bug}`)\n return true;}}\n feedbackImg={feedbackImage}\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}","title":"Advanced that autofills an email address","lang":"js","className":""}}>
125+
<Example {...pageData} {...props} {...{"code":"/* eslint-disable no-console */\nimport { FunctionComponent, useState } from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\nimport feedbackImage from '@patternfly/react-user-feedback/dist/esm/images/rh_feedback.svg';\n\nexport const AdvancedStaticEmailExample: FunctionComponent = () => {\n const [isOpen, setIsOpen] = useState<boolean>(false);\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n email='[email protected]'\n onShareFeedback={(email:string, feedback:string)=>{\n // Example of a successful callback\n console.log (`Email Address: ${email} Feedback: ${feedback}`);\n return true\n }}\n onJoinMailingList={(email:string)=>{\n // Example of am unsuccessful callback\n console.log (`Email Address: ${email}`);\n return false;\n }}\n onOpenSupportCase='https://pf-user-feedback-extension-form-demos.surge.sh/requestSupport.html'\n onReportABug={(email:string, bug:string)=>{\n console.log (`Email Address: ${email} Bug: ${bug}`)\n return true;}}\n feedbackImg={feedbackImage}\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}","title":"Advanced that autofills an email address","lang":"js","className":""}}>
123126

124127
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
125128
{`To automatically pass a user's email address into a feedback modal, use the email property. This allows you to pre-populate the modal's email field.`}
126129
</p>
127130
</Example>,
128131
'Modal with asynchronous call support': props =>
129-
<Example {...pageData} {...props} {...{"code":"/* eslint-disable no-console */\nimport React from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\n\nexport const AsyncExample: React.FunctionComponent = () => {\n const [isOpen, setIsOpen] = React.useState<boolean>(false);\n\n const fakeNetworkCall = (email:string, feedback:string, bug:string) => new Promise<boolean>(resolve => {\n setTimeout(() => {\n console.log(`Email Address: ${email} Feedback: ${feedback} Bug: ${bug}`);\n console.log('Network call complete successfully so return true');\n resolve(true);\n }, 2000);\n })\n \n const simulatedAsyncCall = async (email='', feedback='', bug='') => {\n console.log('simulatedAsyncCall');\n const result = await fakeNetworkCall(email, feedback, bug);\n return result;\n }\n \n\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n onShareFeedback={(email:string, feedback:string)=>simulatedAsyncCall(email, feedback)}\n onJoinMailingList={(email:string)=>simulatedAsyncCall(email)}\n onOpenSupportCase='https://pf-user-feedback-extension-form-demos.surge.sh/requestSupport.html'\n onReportABug={(email:string, bug:string)=>simulatedAsyncCall(email, '', bug)}\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}","title":"Modal with asynchronous call support","lang":"js","className":""}}>
132+
<Example {...pageData} {...props} {...{"code":"/* eslint-disable no-console */\nimport { FunctionComponent, useState } from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\n\nexport const AsyncExample: FunctionComponent = () => {\n const [isOpen, setIsOpen] = useState<boolean>(false);\n\n const fakeNetworkCall = (email:string, feedback:string, bug:string) => new Promise<boolean>(resolve => {\n setTimeout(() => {\n console.log(`Email Address: ${email} Feedback: ${feedback} Bug: ${bug}`);\n console.log('Network call complete successfully so return true');\n resolve(true);\n }, 2000);\n })\n \n const simulatedAsyncCall = async (email='', feedback='', bug='') => {\n console.log('simulatedAsyncCall');\n const result = await fakeNetworkCall(email, feedback, bug);\n return result;\n }\n \n\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n onShareFeedback={(email:string, feedback:string)=>simulatedAsyncCall(email, feedback)}\n onJoinMailingList={(email:string)=>simulatedAsyncCall(email)}\n onOpenSupportCase='https://pf-user-feedback-extension-form-demos.surge.sh/requestSupport.html'\n onReportABug={(email:string, bug:string)=>simulatedAsyncCall(email, '', bug)}\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}","title":"Modal with asynchronous call support","lang":"js","className":""}}>
130133

131134
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
132-
{`User feedback supports the ability to make asynchronous calls to send data collected from the modal to a backend service.`}
133-
</p>
134-
135-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
136-
{`The following example demonstrates how to use the `}
135+
{`User feedback supports the ability to make asynchronous calls to send data collected from the modal to a backend service.
136+
The following example demonstrates how to use the `}
137137

138138
<code {...{"className":"ws-code "}}>
139139
{`async`}
@@ -150,7 +150,7 @@ pageData.examples = {
150150
<code {...{"className":"ws-code "}}>
151151
{`i18n`}
152152
</code>
153-
{` object with values for each property of`}
153+
{` object with values for each property of `}
154154

155155
<code {...{"className":"ws-code "}}>
156156
{`<FeedbackModal>`}

0 commit comments

Comments
 (0)