Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit d5f0897

Browse files
authored
feat(shape): Added Shape subsystem and integrated with all components (#3626)
BREAKING CHANGE: The previous contents of the mdc-shape package have been removed and replaced with mixins implementing the Shape system. This system implements only rounded corners to provide a straightforward CSS-only solution. Replaced all *-corner-radius component mixins with *-shape-radius mixins to integrate with Shape system.
1 parent 4888ebe commit d5f0897

File tree

84 files changed

+1100
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1100
-635
lines changed

demos/button.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ <h1 class="mdc-typography--headline3">Ripple Enabled</h1>
229229
</fieldset>
230230

231231
<fieldset>
232-
<legend class="mdc-typography--headline6">Custom button (Experimental)</legend>
232+
<legend class="mdc-typography--headline6">Custom button</legend>
233233
<div>
234-
<button class="mdc-button mdc-button--unelevated big-round-corner-button">
235-
Corner Radius
234+
<button class="mdc-button mdc-button--unelevated big-round-shape-button">
235+
Shape Radius
236236
</button>
237237
<button class="mdc-button mdc-button--outlined thick-outline-button">
238238
Thick Outline Width
@@ -375,8 +375,8 @@ <h1 class="mdc-typography--headline3">CSS Only</h1>
375375
<fieldset>
376376
<legend class="mdc-typography--headline6">Custom button (Experimental)</legend>
377377
<div>
378-
<button class="mdc-button mdc-button--unelevated big-round-corner-button" data-demo-no-js>
379-
Big Corner Radius
378+
<button class="mdc-button mdc-button--unelevated big-round-shape-button" data-demo-no-js>
379+
Shape Radius
380380
</button>
381381
<button class="mdc-button mdc-button--outlined thick-outline-button" data-demo-no-js>
382382
Thick Outline Width

demos/button.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343

4444
}
4545

46-
.mdc-button.big-round-corner-button {
47-
@include mdc-button-corner-radius(8px);
46+
.mdc-button.big-round-shape-button {
47+
@include mdc-button-shape-radius(8px);
4848
}
4949

5050
.mdc-button.thick-outline-button {

demos/card.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,7 @@
140140
//
141141

142142
.demo-card--music {
143-
@include mdc-card-corner-radius(24px 4px);
144-
145-
@include mdc-rtl {
146-
@include mdc-card-corner-radius(4px 24px);
147-
}
143+
@include mdc-card-shape-radius((24px, 4px), $rtl-reflexive: true);
148144
}
149145

150146
.demo-card__music-row {

demos/image-list.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,10 @@ <h1 class="mdc-typography--headline5">Masonry Image List</h1>
455455
});
456456

457457
document.getElementById('toggle-radius').addEventListener('change', function() {
458-
document.querySelector('.example').classList[this.checked ? 'add' : 'remove']('rounded-corners');
458+
var isChecked = this.checked;
459+
document.querySelectorAll('.mdc-image-list').forEach(function(el) {
460+
el.classList[isChecked ? 'add' : 'remove']('rounded-corners');
461+
});
459462
});
460463

461464
var standardImageListEl = document.getElementById('standard-image-list');

demos/image-list.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
}
5555

5656
.rounded-corners {
57-
@include mdc-image-list-corner-radius(8px);
57+
@include mdc-image-list-shape-radius(8px);
5858
}
5959

6060
@media (max-width: 599px) {

demos/index.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,6 @@
183183
</span>
184184
</a>
185185

186-
<a href="shape.html" role="listitem" class="mdc-list-item">
187-
<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/ic_component_24px.svg" /></span>
188-
<span class="mdc-list-item__text">
189-
<span class="mdc-list-item__primary-text">Shape</span>
190-
<span class="mdc-list-item__secondary-text">Mixins for angled corners on unelevated components</span>
191-
</span>
192-
</a>
193-
194186
<a href="slider.html" role="listitem" class="mdc-list-item">
195187
<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/slider.svg" /></span>
196188
<span class="mdc-list-item__text">

demos/shape.html

Lines changed: 0 additions & 127 deletions
This file was deleted.

demos/shape.scss

Lines changed: 0 additions & 100 deletions
This file was deleted.

packages/material-components-web/material-components-web.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
@import "@material/radio/mdc-radio";
4545
@import "@material/ripple/mdc-ripple";
4646
@import "@material/select/mdc-select";
47-
@import "@material/shape/mdc-shape";
4847
@import "@material/slider/mdc-slider";
4948
@import "@material/snackbar/mdc-snackbar";
5049
@import "@material/switch/mdc-switch";

packages/mdc-button/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ To style a contained button, add the `mdc-button--raised` class to the `<button>
7575

7676
To style an outlined button, add the class `mdc-button--outlined` to the `<button>` element.
7777

78-
### Icons
78+
### Icons
7979

8080
To add an icon, add an element with the `mdc-button__icon` class inside the button element and set the attribute `aria-hidden="true"`. The icon is set to 18px to meet legibility requirements.
8181

@@ -144,7 +144,7 @@ Mixin | Description
144144
`mdc-button-container-fill-color($color)` | Sets the container fill color to the given color.
145145
`mdc-button-icon-color($color)` | Sets the icon color to the given color.
146146
`mdc-button-ink-color($color)` | Sets the ink color to the given color, and sets the icon color to the given color unless `mdc-button-icon-color` is also used.
147-
`mdc-button-corner-radius($corner-radius)` | Sets the corner radius to the given number (defaults to 2px).
147+
`mdc-button-shape-radius($radius, $rtl-reflexive)` | Sets rounded shape to button with given radius size. Set `$rtl-reflexive` to true to flip radius values in RTL context, defaults to false.
148148
`mdc-button-horizontal-padding($padding)` | Sets horizontal padding to the given number.
149149
`mdc-button-outline-color($color)` | Sets the outline color to the given color.
150150
`mdc-button-outline-width($width, $padding)` | Sets the outline width to the given number (defaults to 2px) and adjusts padding accordingly. `$padding` is only required in cases where `mdc-button-horizontal-padding` is also included with a custom value.

0 commit comments

Comments
 (0)