Skip to content

Commit

Permalink
fix(field)!: remove resizable, use css resize: both
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 547567087
  • Loading branch information
asyncLiz authored and copybara-github committed Jul 12, 2023
1 parent 0ab5fd5 commit 6734344
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions field/demo/stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import '@material/web/field/outlined-field.js';

import {MaterialStoryInit} from './material-collection.js';
import {css, html, nothing} from 'lit';
import {styleMap} from 'lit/directives/style-map.js';

/** Knob types for field stories. */
export interface StoryKnobs {
Expand Down Expand Up @@ -62,16 +63,17 @@ const filled: MaterialStoryInit<StoryKnobs> = {
html`<textarea rows="1" ?disabled=${disabled}></textarea>` :
html`<input ?disabled=${disabled}>`;

const styles = {resize: resizable ? 'both' : null};
return html`
<md-filled-field
style=${styleMap(styles)}
.label=${label}
?disabled=${disabled}
.error=${error}
.focused=${focused}
.hasStart=${hasStart}
.hasEnd=${hasEnd}
.populated=${populated}
.resizable=${resizable}
.required=${required}
supporting-text=${supportingText}
error-text=${errorText}
Expand Down Expand Up @@ -110,16 +112,17 @@ const outlined: MaterialStoryInit<StoryKnobs> = {
disabled} aria-describedby="description"></textarea>` :
html`<input ?disabled=${disabled} aria-describedby="description">`;

const styles = {resize: resizable ? 'both' : null};
return html`
<md-outlined-field
style=${styleMap(styles)}
.label=${label}
?disabled=${disabled}
.error=${error}
.focused=${focused}
.hasStart=${hasStart}
.hasEnd=${hasEnd}
.populated=${populated}
.resizable=${resizable}
.required=${required}
supporting-text=${supportingText}
error-text=${errorText}
Expand Down
6 changes: 4 additions & 2 deletions field/lib/_shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@
position: relative;
}

.resizable .container {
resize: both;
.field,
.container-overflow,
.container {
resize: inherit;
}

.disabled {
Expand Down
2 changes: 0 additions & 2 deletions field/lib/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class Field extends LitElement implements SurfacePositionTarget {
@property({type: Boolean}) focused = false;
@property() label = '';
@property({type: Boolean}) populated = false;
@property({type: Boolean}) resizable = false;
@property({type: Boolean}) required = false;
@property({attribute: 'supporting-text'}) supportingText = '';
@property({attribute: 'error-text'}) errorText = '';
Expand Down Expand Up @@ -104,7 +103,6 @@ export class Field extends LitElement implements SurfacePositionTarget {
'with-start': this.hasStart,
'with-end': this.hasEnd,
'populated': this.populated,
'resizable': this.resizable,
'required': this.required,
'no-label': !this.label,
};
Expand Down

0 comments on commit 6734344

Please sign in to comment.