-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c4170a5
commit 99e4081
Showing
12 changed files
with
98 additions
and
87 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,67 @@ | ||
# @patternfly/elements | ||
|
||
## 2.3.0 | ||
|
||
### Minor Changes | ||
|
||
- c4170a595: PatternFly elements are now available wrapped in React components. While it was | ||
always possible to use PatternFly elements (or any other custom elements) in | ||
React apps, this release makes it easier to integrate them into React without | ||
the need for cumbersome workarounds to React's [poor HTML and DOM support][cee]. | ||
|
||
Before: | ||
|
||
```jsx | ||
import { useEffect, useState, useRef } from "react"; | ||
import "@patternfly/elements/pf-switch/pf-switch.js"; | ||
|
||
function App() { | ||
const [checked, setChecked] = useState(false); | ||
const switchRef = useRef(null); | ||
useEffect(() => { | ||
switchRef.current.checked = checked; | ||
}, [switchRef.current, checked]); | ||
useEffect(() => { | ||
switchRef.current.addEventListener("change", () => | ||
setChecked(switchRef.current.checked) | ||
); | ||
}, [switchRef.current]); | ||
return ( | ||
<> | ||
<pf-switch ref={switchRef}></pf-switch> | ||
</> | ||
); | ||
} | ||
``` | ||
After: | ||
```jsx | ||
import { useState } from "react"; | ||
import { Switch } from "@patternfly/elements/react/pf-switch/pf-switch.js"; | ||
|
||
function App() { | ||
const [checked, setChecked] = useState(false); | ||
return ( | ||
<> | ||
<Switch | ||
checked={checked} | ||
onChange={({ target }) => setChecked(target.checked)} | ||
/> | ||
</> | ||
); | ||
} | ||
``` | ||
[cee]: https://custom-elements-everywhere.com/#react | ||
### Patch Changes | ||
- f4a7ae7d7: `<pf-accordion>`: update the `expandedIndex` DOM property on change | ||
- Updated dependencies [7055add74] | ||
- Updated dependencies [a81bcb133] | ||
- @patternfly/[email protected] | ||
## 2.2.2 | ||
### Patch Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters