Skip to content

Commit

Permalink
update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli committed Jul 23, 2024
1 parent db057a1 commit 3c51e2a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
14 changes: 12 additions & 2 deletions docs/data/joy/components/autocomplete/AutocompleteHint.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ const StyledDiv = styled('div')({
function Wrapper({ children, hint, ...props }) {
return (
<StyledDiv {...props}>
<Typography sx={{ position: 'absolute', opacity: 0.6 }}>{hint}</Typography>
<Typography
sx={{
position: 'absolute',
opacity: 0.6,
overflow: 'hidden', // Hide overflow
whiteSpace: 'nowrap', // Prevent text wrapping
maxWidth: '100%', // Ensure the hint doesn't exceed container width
}}
>
{hint}
</Typography>
{children}
</StyledDiv>
);
Expand Down Expand Up @@ -53,7 +63,7 @@ export default function AutocompleteHint() {
}
}
}}
onBlur={() => {
onClose={() => {
hint.current = '';
}}
inputValue={inputValue}
Expand Down
14 changes: 12 additions & 2 deletions docs/data/joy/components/autocomplete/AutocompleteHint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ type WrapperProps = {
function Wrapper({ children, hint, ...props }: WrapperProps) {
return (
<StyledDiv {...props}>
<Typography sx={{ position: 'absolute', opacity: 0.6 }}>{hint}</Typography>
<Typography
sx={{
position: 'absolute',
opacity: 0.6,
overflow: 'hidden', // Hide overflow
whiteSpace: 'nowrap', // Prevent text wrapping
maxWidth: '100%', // Ensure the hint doesn't exceed container width
}}
>
{hint}
</Typography>
{children}
</StyledDiv>
);
Expand Down Expand Up @@ -52,7 +62,7 @@ export default function AutocompleteHint() {
}
}
}}
onBlur={() => {
onClose={() => {
hint.current = '';
}}
inputValue={inputValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ export default function AutocompleteHint() {
}
}
}}
onBlur={() => {
onClose={() => {
hint.current = '';
}}
onChange={(event, newValue) => {
setInputValue(newValue && newValue.label ? newValue.label : '');
}}
disablePortal
inputValue={inputValue}
blurOnSelect
id="combo-box-hint-demo"
options={top100Films}
sx={{ width: 300 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ export default function AutocompleteHint() {
}
}
}}
onBlur={() => {
onClose={() => {
hint.current = '';
}}
onChange={(event, newValue) => {
setInputValue(newValue && newValue.label ? newValue.label : '');
}}
disablePortal
inputValue={inputValue}
blurOnSelect
id="combo-box-hint-demo"
options={top100Films}
sx={{ width: 300 }}
Expand Down

0 comments on commit 3c51e2a

Please sign in to comment.