-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(autocomplete): Create MdAutocompleteSurface to adjust width
PiperOrigin-RevId: 477450294
- Loading branch information
1 parent
e65ebd8
commit cc4603e
Showing
7 changed files
with
83 additions
and
13 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,28 @@ | ||
/** | ||
* @license | ||
* Copyright 2022 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import {customElement} from 'lit/decorators.js'; | ||
|
||
import {styles} from '../menusurface/lib/menu-surface-styles.css.js'; | ||
|
||
import {AutocompleteSurface} from './lib/autocompletesurface/autocomplete-surface.js'; | ||
import {styles as autocompleteStyles} from './lib/autocompletesurface/autocomplete-surface-styles.css.js'; | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'md-autocomplete-surface': MdAutocompleteSurface; | ||
} | ||
} | ||
|
||
/** | ||
* @soyCompatible | ||
* @final | ||
* @suppress {visibility} | ||
*/ | ||
@customElement('md-autocomplete-surface') | ||
export class MdAutocompleteSurface extends AutocompleteSurface { | ||
static override styles = [styles, autocompleteStyles]; | ||
} |
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
13 changes: 13 additions & 0 deletions
13
autocomplete/lib/autocompletesurface/_autocomplete-surface.scss
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,13 @@ | ||
// | ||
// Copyright 2022 Google LLC | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
// stylelint-disable selector-class-pattern -- | ||
// Selector '.md3-*' should only be used in this project. | ||
|
||
@mixin static-styles() { | ||
.md3-autocomplete-surface { | ||
width: 100%; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
autocomplete/lib/autocompletesurface/autocomplete-surface-styles.scss
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,8 @@ | ||
// | ||
// Copyright 2022 Google LLC | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
@use './autocomplete-surface'; | ||
|
||
@include autocomplete-surface.static-styles; |
21 changes: 21 additions & 0 deletions
21
autocomplete/lib/autocompletesurface/autocomplete-surface.ts
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,21 @@ | ||
/** | ||
* @license | ||
* Copyright 2022 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import {MenuSurface} from '@material/web/menu-surface/lib/menu-surface.js'; | ||
import {ClassInfo} from 'lit/directives/class-map.js'; | ||
|
||
/** Base class for autocomplete surface component. */ | ||
export class AutocompleteSurface extends MenuSurface { | ||
override stayOpenOnBodyClick = true; | ||
|
||
/** @soyTemplate */ | ||
protected override getRenderClasses(): ClassInfo { | ||
return { | ||
...super.getRenderClasses(), | ||
'md3-autocomplete-surface': true, | ||
}; | ||
} | ||
} |
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