-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(notched-outline): separate outline from text-field (#2326)
BREAKING CHANGE: removed mdc-text-field__outline element for mdc-notched-outline. Renamed mdc-text-field-outlined-corner-radius to mdc-text-field-outline-corner-radius.
- Loading branch information
Matty Goo
authored
Mar 16, 2018
1 parent
c2eb537
commit e215ca8
Showing
32 changed files
with
509 additions
and
356 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
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
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
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,103 @@ | ||
<!--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 [here](../mdc-textfield/README.md#outlined/). | ||
### 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. | ||
`mdc-notched-outline-stroke-width($width)` | Changes notched outline width to a specified pixel value. | ||
`mdc-notched-outline-corner-radius($radius)` | Sets the corner radius of the notched outline element to the given number. | ||
`mdc-notched-outline-idle-corner-radius($radius)` | Sets the corner radius of the notched outline element in idle state. | ||
> NOTE: | ||
> Because notched-outline has sibling elements, you need to call the "idle" Sass mixins with parent selectors. | ||
> Consider the following example HTML: | ||
> | ||
> ```html | ||
> <div class="foo-line-ripple-parent"> | ||
> <div class="mdc-notched-outline foo-line-ripple"> | ||
> <svg> | ||
> <path class="mdc-notched-outline__path"/> | ||
> </svg> | ||
> </div> | ||
> <div class="mdc-notched-outline__idle"></div> | ||
> </div> | ||
> ``` | ||
> In order to customize any "non-idle" part of notched-outline, use the .foo-line-ripple CSS selector: | ||
> ```scss | ||
> .foo-line-ripple { | ||
> @include mdc-notched-outline-color($fooColor); | ||
> } | ||
> ``` | ||
> But in order to customize any "idle" part of the notched-outline, you must use the .foo-line-ripple-parent CSS selector: | ||
> ```scss | ||
> .foo-line-ripple-parent { | ||
> @include mdc-notched-outline-idle-color($fooColor); | ||
> } | ||
> ``` | ||
### `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) |
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,45 @@ | ||
// | ||
// 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 { | ||
@include mdc-theme-prop(stroke, $color); | ||
} | ||
} | ||
|
||
@mixin mdc-notched-outline-stroke-width($width) { | ||
.mdc-notched-outline__path { | ||
stroke-width: $width; | ||
} | ||
} | ||
|
||
@mixin mdc-notched-outline-corner-radius($radius) { | ||
border-radius: $radius; | ||
} | ||
|
||
@mixin mdc-notched-outline-idle-corner-radius($radius) { | ||
.mdc-notched-outline__idle { | ||
border-radius: $radius; | ||
} | ||
} |
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
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
Oops, something went wrong.