@@ -292,11 +292,6 @@ export const Styling = () => {
292
292
const [ themeConfig , setThemeConfig ] = useState < Theme | undefined > ( undefined ) ;
293
293
const [ selectedOption , setSelectedOption ] = useCallbackState < SelectedOption | null > ( null ) ;
294
294
295
- const selectWrapperStyle = { marginTop : '1rem' } ;
296
- const noteStyle = { fontSize : 'inherit' , fontWeight : 700 } ;
297
- const noteCodeStyle = { fontWeight : 500 } ;
298
- const menuItemSize = selectedOption ?. value === ThemeEnum . LARGE_TEXT ? 44 : 35 ;
299
-
300
295
const memoizedMarkupNode = useMemo ( ( ) => (
301
296
< CodeMarkup
302
297
language = 'markup'
@@ -308,10 +303,15 @@ export const Styling = () => {
308
303
useEffect ( ( ) => {
309
304
if ( selectedOption ) {
310
305
const { value } = selectedOption ;
311
- setThemeConfig ( ThemeConfigMap [ value as string | number ] ) ;
306
+ setThemeConfig ( ThemeConfigMap [ value ! ] ) ;
312
307
}
313
308
} , [ selectedOption ] ) ;
314
309
310
+ const noteCodeStyle = { fontWeight : 500 } ;
311
+ const selectWrapperStyle = { marginTop : '1rem' } ;
312
+ const noteStyle = { fontSize : 'inherit' , fontWeight : 700 } ;
313
+ const menuItemSize = selectedOption ?. value === ThemeEnum . LARGE_TEXT ? 44 : 35 ;
314
+
315
315
return (
316
316
< Container >
317
317
< Title > Styling</ Title >
@@ -590,7 +590,7 @@ export const Methods = () => {
590
590
< Button onClick = { blurSelect } > Blur</ Button >
591
591
< Button onClick = { toggleMenuOpen } > Open Menu</ Button >
592
592
< Button onClick = { clearValue } > Clear Value</ Button >
593
- < Button onClick = { updateSelectedOption } > Set Value (1st Option) </ Button >
593
+ < Button onClick = { updateSelectedOption } > Set Value</ Button >
594
594
</ Buttons >
595
595
</ CardHeader >
596
596
< CardBody >
@@ -699,10 +699,10 @@ export const Filtering = () => {
699
699
} ;
700
700
701
701
export const Virtualization = ( ) => {
702
- const optionCountList = useMemo < number [ ] > ( ( ) => [ 100 , 1000 , 10000 , 25000 , 50000 , 100000 ] , [ ] ) ;
703
- const selectRef = useRef < SelectRef | null > ( null ) ;
704
- const [ options , setOptions ] = useState < Option [ ] > ( [ ] ) ;
702
+ const optionCountList = useMemo ( ( ) => [ 100 , 1000 , 10000 , 25000 , 50000 , 100000 ] , [ ] ) ;
705
703
const [ optionsCount , setOptionsCount ] = useState ( optionCountList [ 0 ] ) ;
704
+ const [ options , setOptions ] = useState < Option [ ] > ( [ ] ) ;
705
+ const selectRef = useRef < SelectRef | null > ( null ) ;
706
706
707
707
useUpdateEffect ( ( ) => {
708
708
selectRef . current ?. clearValue ( ) ;
@@ -789,19 +789,19 @@ export const Virtualization = () => {
789
789
790
790
export const Advanced = ( ) => {
791
791
const getOptionValue = useCallback ( ( { id } : PackageOption ) : number => id , [ ] ) ;
792
- const getIsOptionDisabled = useCallback ( ( opt : PackageOption ) : boolean => opt . name === PACKAGE_OPTIONS [ 3 ] . name , [ ] ) ;
792
+ const getIsOptionDisabled = useCallback ( ( { name } : PackageOption ) : boolean => name === PACKAGE_OPTIONS [ 3 ] . name , [ ] ) ;
793
793
794
794
const renderOptionLabel = useCallback (
795
- ( opt : PackageOption ) => (
795
+ ( option : PackageOption ) => (
796
796
< OptionContainer >
797
797
< ReactSvg
798
798
{ ...REACT_SVG_PROPS }
799
- isDisabled = { getIsOptionDisabled ( opt ) }
799
+ isDisabled = { getIsOptionDisabled ( option ) }
800
800
>
801
801
< path { ...REACT_SVG_PATH_PROPS } />
802
802
< circle { ...REACT_SVG_CIRCLE_PROPS } />
803
803
</ ReactSvg >
804
- < OptionName > { opt . name } </ OptionName >
804
+ < OptionName > { option . name } </ OptionName >
805
805
</ OptionContainer >
806
806
) ,
807
807
[ getIsOptionDisabled ]
@@ -878,19 +878,18 @@ export const Advanced = () => {
878
878
} ;
879
879
880
880
export const Portaling = ( ) => {
881
- const menuPortalElId = 'menu-portal-test' ;
881
+ const portalId = 'menu-portal-test' ;
882
882
const options = useMemo < Option [ ] > ( ( ) => createSelectOptions ( 3 ) , [ ] ) ;
883
883
884
884
const [ menuOpen , setMenuOpen ] = useState ( false ) ;
885
- const [ menuPortalTarget , setMenuPortalTarget ] = useState < Element | undefined > ( undefined ) ;
886
-
885
+ const [ menuPortalTarget , setMenuPortalTarget ] = useState < Element | undefined > ( ) ;
887
886
const onMenuOpen = useCallback ( ( ) => setMenuOpen ( true ) , [ ] ) ;
888
887
const onMenuClose = useCallback ( ( ) => setMenuOpen ( false ) , [ ] ) ;
889
888
890
889
useEffect ( ( ) => {
891
- const portalEl = document . getElementById ( menuPortalElId ) as HTMLElement ;
890
+ const portalEl = document . getElementById ( portalId ) as HTMLElement ;
892
891
setMenuPortalTarget ( portalEl ) ;
893
- } , [ menuPortalElId ] ) ;
892
+ } , [ portalId ] ) ;
894
893
895
894
return (
896
895
< Container >
@@ -908,10 +907,10 @@ export const Portaling = () => {
908
907
< CardHeader >
909
908
< Label > Menu component portaled to an element below this text.</ Label >
910
909
< MenuPortalElement
910
+ id = { portalId }
911
911
menuOpen = { menuOpen }
912
- id = { menuPortalElId }
913
912
>
914
- < span > Portal { '<' } div /{ '>' } </ span >
913
+ < span > portal { '<' } div /{ '>' } </ span >
915
914
</ MenuPortalElement >
916
915
</ CardHeader >
917
916
< CardBody >
@@ -935,15 +934,13 @@ export const Async = () => {
935
934
const selectRef = useRef < SelectRef | null > ( null ) ;
936
935
const [ isLoading , setIsLoading ] = useState ( false ) ;
937
936
const [ options , setOptions ] = useState < Option [ ] > ( ( ) => createAsyncOptions ( 5 , 'Initial' ) ) ;
938
-
939
937
const onInputChange = useCallback ( ( ) => setIsLoading ( true ) , [ ] ) ;
940
938
941
939
const onSearchChange = useCallback (
942
940
async ( value : string = 'Initial' ) => {
943
941
try {
944
942
await mockHttpRequest ( ) ;
945
- const count = getRandomInt ( 1 , 5 ) ;
946
- const nextOptions = createAsyncOptions ( count , `Search text: ${ value } ` ) ;
943
+ const nextOptions = createAsyncOptions ( getRandomInt ( 1 , 5 ) , `Search text: ${ value } ` ) ;
947
944
selectRef . current ?. clearValue ( ) ;
948
945
setOptions ( nextOptions ) ;
949
946
setIsLoading ( false ) ;
0 commit comments