-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(live-region): update live region helpers to match ADR (#4673)
* refactor(live-region): update live region helpers to match ADR * fix: update file paths from moving to live-region folder * feat(live-region): add support for delayMs to announce * feat: add support for delayMs to Announce, AriaStatus, AriaAlert * chore: add changeset * docs: update stories * chore: fix eslint violations * docs: update jsdoc for hook * fix: update signature to include support for "as" * chore: add support for sx to components --------- Co-authored-by: Josh Black <[email protected]>
- Loading branch information
Showing
25 changed files
with
615 additions
and
188 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Add experimental support for the AriaStatus, AriaAlert, and Announce components |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
packages/react/src/internal/components/__tests__/Status.test.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {useCallback, useEffect, useRef} from 'react' | ||
|
||
/** | ||
* Create a callback that can be used within an effect without re-running the | ||
* effect when the values used change. The callback passed to this hook will | ||
* always see the latest snapshot of values that it uses and does not need to | ||
* use a dependency array. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export function useEffectCallback<T extends (...args: any) => any>(callback: T) { | ||
const savedCallback = useRef<T>(callback) | ||
|
||
useEffect(() => { | ||
savedCallback.current = callback | ||
}, [callback]) | ||
|
||
return useCallback((...args: Parameters<T>): ReturnType<T> => { | ||
return savedCallback.current(...args) | ||
}, []) | ||
} |
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
Oops, something went wrong.