-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat.Fuselage …
…into table * 'develop' of github.com:RocketChat/Rocket.Chat.Fuselage: fix: Avatar sizes (#202) v0.8.0 refactor!: Remove unused components (#206) fix: Selection button props split between container and input elements (#207) fix: Badge and Tag rendering a span (#208) feat: New hooks and server-side compatibility (#203) fix: Add missing Box prop types (#204)
- Loading branch information
Showing
178 changed files
with
1,006 additions
and
1,523 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
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,5 @@ | ||
{ | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"packages": [ | ||
|
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 |
---|---|---|
|
@@ -8,5 +8,6 @@ flow-typed | |
[lints] | ||
|
||
[options] | ||
esproposal.optional_chaining=enable | ||
|
||
[strict] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
// @flow | ||
|
||
export * from './useClassName'; | ||
export * from './useAutoFocus'; | ||
export * from './useDebouncedUpdates'; | ||
export * from './useDebouncedCallback'; | ||
export * from './useExclusiveBooleanProps'; | ||
export * from './useDebouncedValue'; | ||
export * from './useLazyRef'; | ||
export * from './useMediaQuery'; | ||
export * from './useMergedRefs'; | ||
export * from './useMutableCallback'; | ||
export * from './useSafely'; | ||
export * from './useToggle'; | ||
export * from './useUniqueId'; |
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,26 @@ | ||
// @flow | ||
|
||
import { useEffect, useRef } from 'react'; | ||
|
||
type FocusOptions = { | ||
preventScroll?: boolean, | ||
} | typeof undefined; | ||
|
||
/** | ||
* Hook to automatically request focus for an DOM element. | ||
* | ||
* @param isFocused if true, the focus will be requested | ||
* @param options options of the focus request | ||
* @return the ref which holds the element | ||
*/ | ||
export const useAutoFocus = (isFocused: boolean = true, options: FocusOptions) => { | ||
const elementRef = useRef<?HTMLElement>(); | ||
|
||
useEffect(() => { | ||
if (isFocused && elementRef.current) { | ||
elementRef.current.focus(options); | ||
} | ||
}, [elementRef, isFocused]); | ||
|
||
return elementRef; | ||
}; |
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,26 @@ | ||
// @flow | ||
|
||
import { useEffect, useState } from 'react'; | ||
|
||
/** | ||
* Hook to keep a debounced reference of a value. | ||
* | ||
* @param value the value to be debounced | ||
* @param delay the number of milliseconds to delay | ||
* @return a debounced value | ||
*/ | ||
export const useDebouncedValue = (value: any, delay: number) => { | ||
const [debouncedValue, setDebouncedValue] = useState(value); | ||
|
||
useEffect(() => { | ||
const timer = setTimeout(() => { | ||
setDebouncedValue(value); | ||
}, delay); | ||
|
||
return () => { | ||
clearTimeout(timer); | ||
}; | ||
}, [value, delay]); | ||
|
||
return debouncedValue; | ||
}; |
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,16 @@ | ||
// @flow | ||
|
||
import { createRef, useState } from 'react'; | ||
|
||
/** | ||
* Hook equivalent to useRef, but with a lazy initialization for computed value. | ||
* | ||
* @param initializer the function the computes the ref value | ||
* @return the ref | ||
*/ | ||
export const useLazyRef = <T>(initializer: () => T) => | ||
useState(() => { | ||
const ref = createRef<T>(); | ||
ref.current = initializer(); | ||
return ref; | ||
})[0]; |
Oops, something went wrong.