File tree Expand file tree Collapse file tree 4 files changed +26
-8
lines changed
joy/components/autocomplete
material/components/autocomplete Expand file tree Collapse file tree 4 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,17 @@ const StyledDiv = styled('div')({
1515function Wrapper ( { children, hint, ...props } ) {
1616 return (
1717 < StyledDiv { ...props } >
18- < Typography sx = { { position : 'absolute' , opacity : 0.6 } } > { hint } </ Typography >
18+ < Typography
19+ sx = { {
20+ position : 'absolute' ,
21+ opacity : 0.6 ,
22+ overflow : 'hidden' , // Hide overflow
23+ whiteSpace : 'nowrap' , // Prevent text wrapping
24+ maxWidth : '100%' , // Ensure the hint doesn't exceed container width
25+ } }
26+ >
27+ { hint }
28+ </ Typography >
1929 { children }
2030 </ StyledDiv >
2131 ) ;
@@ -53,7 +63,7 @@ export default function AutocompleteHint() {
5363 }
5464 }
5565 } }
56- onBlur = { ( ) => {
66+ onClose = { ( ) => {
5767 hint . current = '' ;
5868 } }
5969 inputValue = { inputValue }
Original file line number Diff line number Diff line change @@ -19,7 +19,17 @@ type WrapperProps = {
1919function Wrapper ( { children, hint, ...props } : WrapperProps ) {
2020 return (
2121 < StyledDiv { ...props } >
22- < Typography sx = { { position : 'absolute' , opacity : 0.6 } } > { hint } </ Typography >
22+ < Typography
23+ sx = { {
24+ position : 'absolute' ,
25+ opacity : 0.6 ,
26+ overflow : 'hidden' , // Hide overflow
27+ whiteSpace : 'nowrap' , // Prevent text wrapping
28+ maxWidth : '100%' , // Ensure the hint doesn't exceed container width
29+ } }
30+ >
31+ { hint }
32+ </ Typography >
2333 { children }
2434 </ StyledDiv >
2535 ) ;
@@ -52,7 +62,7 @@ export default function AutocompleteHint() {
5262 }
5363 }
5464 } }
55- onBlur = { ( ) => {
65+ onClose = { ( ) => {
5666 hint . current = '' ;
5767 } }
5868 inputValue = { inputValue }
Original file line number Diff line number Diff line change @@ -16,15 +16,14 @@ export default function AutocompleteHint() {
1616 }
1717 }
1818 } }
19- onBlur = { ( ) => {
19+ onClose = { ( ) => {
2020 hint . current = '' ;
2121 } }
2222 onChange = { ( event , newValue ) => {
2323 setInputValue ( newValue && newValue . label ? newValue . label : '' ) ;
2424 } }
2525 disablePortal
2626 inputValue = { inputValue }
27- blurOnSelect
2827 id = "combo-box-hint-demo"
2928 options = { top100Films }
3029 sx = { { width : 300 } }
Original file line number Diff line number Diff line change @@ -16,15 +16,14 @@ export default function AutocompleteHint() {
1616 }
1717 }
1818 } }
19- onBlur = { ( ) => {
19+ onClose = { ( ) => {
2020 hint . current = '' ;
2121 } }
2222 onChange = { ( event , newValue ) => {
2323 setInputValue ( newValue && newValue . label ? newValue . label : '' ) ;
2424 } }
2525 disablePortal
2626 inputValue = { inputValue }
27- blurOnSelect
2827 id = "combo-box-hint-demo"
2928 options = { top100Films }
3029 sx = { { width : 300 } }
You can’t perform that action at this time.
0 commit comments