Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(notched-outline): separate outline from text-field #2326

Merged
merged 86 commits into from
Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a9d6c3c
chore(floating-label): moved floating-label to new package and integr…
Feb 6, 2018
9b750cd
chore(floating-label): changed all css classes to floating-label
Feb 7, 2018
4b01134
Merge branch 'master' into chore/text-field/decouple-label
Feb 8, 2018
5a4500f
fix(floating-label): fixed all tests
Feb 8, 2018
324a638
chore(floating-label): created test directory
Feb 8, 2018
51f16f6
fix(floating-label): removed label foundation from text-field
Feb 9, 2018
af02b19
Merge branch 'master' into chore/text-field/decouple-label
Feb 10, 2018
6f9abdf
fix(floating-label): tests
Feb 12, 2018
028c00d
Merge branch 'master' into chore/text-field/decouple-label
Feb 12, 2018
024ff39
fix(floating-label): updated readmes to reflect changes to floating-l…
Feb 12, 2018
2f72c61
fix(floating-label): closure annotation
Feb 12, 2018
c2f6b95
Merge branch 'master' into chore/text-field/decouple-label
Feb 12, 2018
f452125
chore(floating-label): moved text-field-placeholder css rule into tex…
Feb 12, 2018
f00ef39
Merge branch 'chore/text-field/decouple-label' of github.com:material…
Feb 12, 2018
4a9846c
chore(text-field): moved invalid label keyframe animation shakes to t…
Feb 13, 2018
1f2cf62
fix(text-field): removed export of floating label
Feb 13, 2018
ab8b035
Merge branch 'master' into chore/text-field/decouple-label
Feb 13, 2018
040f739
fix(text-field): closure annotations
Feb 13, 2018
d3871a3
Merge branch 'chore/text-field/decouple-label' of github.com:material…
Feb 15, 2018
252ffc4
Merge branch 'master' into chore/text-field/decouple-label
Feb 15, 2018
43bd881
fix(floating-label): sass compliation failure
Feb 15, 2018
9b627e2
fix(text-field): updated foundation methods to guard against !hasLabe…
Feb 16, 2018
808b6ff
Merge branch 'master' into chore/text-field/decouple-label
Feb 16, 2018
bed6857
Merge branch 'master' into chore/text-field/decouple-label
Feb 16, 2018
2c1c55e
fix(text-field): changed floating-label ink color mixin and updated t…
Feb 16, 2018
d7e1776
fix(floating-label): updated API for shake and float in component, an…
Feb 17, 2018
8a03462
Merge branch 'master' into chore/text-field/decouple-label
Feb 20, 2018
5973760
fix(floating-label): reorder scss import statements alphabetical
Feb 20, 2018
8385248
Merge branch 'chore/text-field/decouple-label' of github.com:material…
Feb 20, 2018
182b4b1
Merge branch 'master' into chore/text-field/decouple-label
Feb 21, 2018
ce05cda
fix(floating-label): rename from styleShake to shake and styleFloat t…
Feb 21, 2018
1a0aa6c
Merge branch 'master' into chore/text-field/decouple-label
Feb 21, 2018
7f69180
Merge branch 'master' into chore/text-field/decouple-label
Feb 21, 2018
f8ca6f1
fix(floating-label): moved animationend listeners to the init/destroy…
Feb 22, 2018
161e40a
fix(floating-label): fix floating label animation function
Feb 22, 2018
d6a5606
Merge branch 'master' into chore/text-field/decouple-label
Feb 22, 2018
eb3893f
fix(floating-label): fixed rtl for floating-label
Feb 22, 2018
da53da7
fix(floating-label): updated floating label comments
Feb 22, 2018
ead024d
Merge branch 'master' into chore/text-field/decouple-label
Feb 22, 2018
78f5b2d
fix(floating-label): remove empty parens from scss mixins
Feb 22, 2018
8a05219
Merge branch 'master' into chore/text-field/decouple-label
Feb 22, 2018
60467b6
WIP - decouple outline
Feb 23, 2018
466e7e6
fix(notched-outline): mainly working notched-outline
Feb 23, 2018
699da0a
Merge branch 'master' into chore/text-field/decouple-outline
Feb 23, 2018
ca134d9
fix(text-field): decouple outline work on dense
Feb 23, 2018
67c1ab8
fix(floating-label): fixed some typos and empty white space
Feb 23, 2018
d7e6962
Merge branch 'master' into chore/text-field/decouple-label
Feb 23, 2018
d76fedc
Merge branch 'chore/text-field/decouple-label' into chore/text-field/…
Feb 23, 2018
91ad0a9
fix(notched-outline): updated notched-outline readme and scss
Feb 27, 2018
edc898b
fix(text-field): fixed tests and moved notched-outline to its own pac…
Feb 27, 2018
5dbf686
fix(text-field): closure tests
Feb 27, 2018
6fdbafc
Merge branch 'master' into chore/text-field/decouple-label
Feb 27, 2018
30b59cb
Merge branch 'chore/text-field/decouple-label' into chore/text-field/…
Feb 27, 2018
2ae20d1
fix(notched-outline): renamed noched-outline--idle to notched-outline…
Feb 27, 2018
f03ca0e
fix(floating-label): fixed readme
Feb 28, 2018
957fa3c
fix(text-field): reverted sass mixin name change to ...-label-ink-color
Feb 28, 2018
7d3a17c
Merge branch 'master' into chore/text-field/decouple-label
Feb 28, 2018
5247b43
Merge branch 'master' into chore/text-field/decouple-label
Feb 28, 2018
cf75c3b
fix(text-field): renamed shake animation names and updated readme
Feb 28, 2018
fbce528
Merge branch 'chore/text-field/decouple-label' into chore/text-field/…
Feb 28, 2018
4237987
Merge branch 'master' into chore/text-field/decouple-label
Feb 28, 2018
f556712
Merge branch 'chore/text-field/decouple-label' into chore/text-field/…
Feb 28, 2018
f772800
fix(notched-outline): some readme and comment edits
Feb 28, 2018
a14f34a
fix(text-field): updated golden files to pass tests
Feb 28, 2018
0898056
chore(notched-outline): update readme
Mar 1, 2018
c46fa37
Merge branch 'master' into chore/text-field/decouple-outline
Mar 2, 2018
5d19c87
Merge branch 'master' into chore/text-field/decouple-outline
Mar 5, 2018
c2a9737
fix(notched-outline): updated readme and fixed text-field readme
Mar 6, 2018
3bfdcf2
Merge branch 'master' into chore/text-field/decouple-outline
Mar 6, 2018
4d4c4fe
Merge branch 'master' into chore/text-field/decouple-outline
Mar 6, 2018
b98ae09
fix(notched-outline): removed unused scss rules and renamed mixin for…
Mar 6, 2018
b7b9ce7
fix(text-field): changed mixin name
Mar 6, 2018
fc35362
fix(text-field): moved textfield outline mixins to appropriate section
Mar 6, 2018
2a30f0d
fix(package): remove duplicate package.json entries
Mar 7, 2018
9b539e0
Merge branch 'master' into chore/text-field/decouple-outline
Mar 9, 2018
adf5817
Merge branch 'master' into chore/text-field/decouple-outline
Mar 14, 2018
3f3ca89
fix(notched-outline): added 2 mixins to notched-outline and updated r…
Mar 14, 2018
f351e17
Merge branch 'master' into chore/text-field/decouple-outline
Mar 14, 2018
526a69f
test(notched-outline): added notchedOutline to deps to pass test
Mar 14, 2018
67bb0a5
Merge branch 'chore/text-field/decouple-outline' of github.com:materi…
Mar 15, 2018
e9141ea
fix(notched-outline): updated sass mixins to using 2 broder-radius mi…
Mar 15, 2018
0a6294c
Merge branch 'master' into chore/text-field/decouple-outline
Mar 15, 2018
9378b7c
fix(text-field): lint fix
Mar 15, 2018
8157968
Merge branch 'chore/text-field/decouple-outline' of github.com:materi…
Mar 15, 2018
142a142
Merge branch 'master' into chore/text-field/decouple-outline
Mar 15, 2018
0ec3a8f
fix(notched-outline): readme update explaining hwo to use mixins
Mar 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions demos/text-field.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ <h2>Outlined Text Field</h2>
<input type="text" id="tf-outlined-input" class="mdc-text-field__input"
aria-controls="name-validation-message">
<label for="tf-outlined-input" class="mdc-floating-label">Your Name</label>
<div class="mdc-text-field__outline">
<div class="mdc-notched-outline">
<svg>
<path class="mdc-text-field__outline-path"/>
<path class="mdc-notched-outline__path"/>
</svg>
</div>
<div class="mdc-text-field__idle-outline"></div>
<div class="mdc-notched-outline__idle"></div>
</div>
<p class="mdc-text-field-helper-text mdc-text-field-helper-text--validation-msg"
id="name-validation-message">
Expand Down Expand Up @@ -263,12 +263,12 @@ <h2>Text Field - Leading/Trailing icons</h2>
<i class="material-icons mdc-text-field__icon" tabindex="0">event</i>
<input type="text" id="tf-outlined-leading" class="mdc-text-field__input">
<label for="tf-outlined-leading" class="mdc-floating-label">Your other name</label>
<div class="mdc-text-field__outline">
<div class="mdc-notched-outline">
<svg>
<path class="mdc-text-field__outline-path"/>
<path class="mdc-notched-outline__path"/>
</svg>
</div>
<div class="mdc-text-field__idle-outline"></div>
<div class="mdc-notched-outline__idle"></div>
</div>
</div>
<div id="demo-tf-outlined-trailing-wrapper">
Expand All @@ -277,12 +277,12 @@ <h2>Text Field - Leading/Trailing icons</h2>
<input type="text" id="tf-outlined-trailing" class="mdc-text-field__input">
<label for="tf-outlined-trailing" class="mdc-floating-label">Your other name</label>
<i class="material-icons mdc-text-field__icon" tabindex="0">delete</i>
<div class="mdc-text-field__outline">
<div class="mdc-notched-outline">
<svg>
<path class="mdc-text-field__outline-path"/>
<path class="mdc-notched-outline__path"/>
</svg>
</div>
<div class="mdc-text-field__idle-outline"></div>
<div class="mdc-notched-outline__idle"></div>
</div>
</div>
<div>
Expand Down
80 changes: 40 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"linear-progress",
"list",
"menu",
"notched-outline",
"radio",
"ripple",
"rtl",
Expand Down Expand Up @@ -174,6 +175,7 @@
"mdc-icon-toggle",
"mdc-line-ripple",
"mdc-menu",
"mdc-notched-outline",
"mdc-radio",
"mdc-ripple",
"mdc-selection-control",
Expand Down
3 changes: 3 additions & 0 deletions packages/material-components-web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import * as iconToggle from '@material/icon-toggle/index';
import * as linearProgress from '@material/linear-progress/index';
import * as lineRipple from '@material/line-ripple/index';
import * as menu from '@material/menu/index';
import * as notchedOutline from '@material/notched-outline/index';
import * as radio from '@material/radio/index';
import * as ripple from '@material/ripple/index';
import * as select from '@material/select/index';
Expand All @@ -52,6 +53,7 @@ autoInit.register('MDCGridList', gridList.MDCGridList);
autoInit.register('MDCIconToggle', iconToggle.MDCIconToggle);
autoInit.register('MDCLineRipple', lineRipple.MDCLineRipple);
autoInit.register('MDCLinearProgress', linearProgress.MDCLinearProgress);
autoInit.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline);
autoInit.register('MDCRadio', radio.MDCRadio);
autoInit.register('MDCSnackbar', snackbar.MDCSnackbar);
autoInit.register('MDCTab', tabs.MDCTab);
Expand All @@ -78,6 +80,7 @@ export {
lineRipple,
linearProgress,
menu,
notchedOutline,
radio,
ripple,
select,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@import "@material/linear-progress/mdc-linear-progress";
@import "@material/list/mdc-list";
@import "@material/menu/mdc-menu";
@import "@material/notched-outline/mdc-notched-outline";
@import "@material/radio/mdc-radio";
@import "@material/ripple/mdc-ripple";
@import "@material/select/mdc-select";
Expand Down
3 changes: 3 additions & 0 deletions packages/material-components-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
"@material/linear-progress": "^0.30.0",
"@material/list": "^0.32.0",
"@material/menu": "^0.31.0",
"@material/notched-outline": "0.0.0",
"@material/radio": "^0.32.0",
"@material/ripple": "^0.32.0",
"@material/radio": "^0.31.0",
"@material/ripple": "^0.31.0",
"@material/rtl": "^0.30.0",
"@material/select": "^0.32.0",
"@material/selection-control": "^0.32.0",
Expand Down
74 changes: 74 additions & 0 deletions packages/mdc-notched-outline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!--docs:
title: "Notched Outline"
layout: detail
section: components
excerpt: "The notched outline is a border around either a text field or select element"
iconId: text_field
path: /catalog/input-controls/notched-outline
-->

# Notched Outline

The outline is a border around all sides of either a text field or select component. This is used for the Outlined variant of either a Text Field or Select.

## Design & API Documentation

<ul class="icon-list">
<li class="icon-list-item icon-list-item--spec">
<a href="https://material.io/guidelines/components/text-fields.html#text-fields-field-variations">Material Design guidelines: Text Field Variations</a>
</li>
</ul>

## Usage

### HTML Structure

```html
<div class="mdc-notched-outline">
<svg>
<path class="mdc-notched-outline__path"/>
</svg>
</div>
<div class="mdc-notched-outline__idle"></div>
```

> For usage within a text field [see](../mdc-textfield/README.md#outlined/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the word "here"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean it should be text field see [here]?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, otherwise it would say "For usage within a text field see."


### CSS Classes

CSS Class | Description
--- | ---
`mdc-notched-outline` | Mandatory. Container for the SVG of the notched outline path.
`mdc-notched-outline__path` | Mandatory. The path of the SVG of the notched outline.
`mdc-notched-outline__idle` | Mandatory. The full outline when the notch is hidden.

### Sass Mixins

Mixin | Description
--- | ---
`mdc-notched-outline-color($color)` | Customizes the border color of the notched outlined.
`mdc-notched-outline-idle-color($color)` | Customizes the border color of the idle outline.

### `MDCNotchedOutline`

Method Signature | Description
--- | ---
`updateSvgPath(notchWidth: number, isRtl: boolean) => void` | Updates the SVG of the outline element with a notch calculated based off of the notchWidth. The notch will appear left justified, unless isRtl is true.

### `MDCNotchedOutlineAdapter`

Method Signature | Description
--- | ---
`getWidth() => number` | Returns the width of the outline element.
`getHeight() => number` | Returns the height of the outline element.
`setOutlinePathAttr(value: string) => void` | Sets the "d" attribute of the outline element's SVG path.
`getIdleOutlineStyleValue(propertyName: string) => string` | Returns the idle outline element's computed style value of a given css `propertyName`.

### `MDCNotchedOutlineFoundation`

Method Signature | Description
--- | ---
`updateSvgPath(notchWidth: number, isRtl: boolean) => void` | Updates the SVG path of the focus outline element based on the given notchWidth and the RTL context.


[//]: <> (TODO(mattgoo): add how to hide/show notch in outline)
29 changes: 29 additions & 0 deletions packages/mdc-notched-outline/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Copyright 2018 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

@import "@material/theme/mixins";

@mixin mdc-notched-outline-idle-color($color) {
.mdc-notched-outline__idle {
@include mdc-theme-prop(border-color, $color);
}
}

@mixin mdc-notched-outline-color($color) {
.mdc-notched-outline__path {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add .mdc-notched-outline at the front of this selector.
This is required when we're looking for the notched outline as a sibling of another element (e.g. in Text Field's mdc-text-field-hover-outline-color_ mixin)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that the .mdc-notched-outline selector should actually be in the mdc-text-field-hover-outline-color_? Having .mdc-notched-outline .mdc-notched-outline__path actually breaks our specificity rules. having .mdc-notched-outline in this mixin should be the exception not the rule. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

@include mdc-theme-prop(stroke, $color);
}
}
Loading