Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 508d610

Browse files
authored
Update all components (#158)
* Material Button: Add raised mixin so that buttons can be made to be raised without using the attribute. * Material Expansionpanel: Add header minimum height mixin. * Material Input: Add support for custom number formatters. * Material Popup: * Remove `PopupEvent` and reduce asynchrony. * Update PopupSizeProvider max-width/height once the popup has been positioned. * Remove unused `contenWidth` and `contentHeight`. * Material Radio: Avoid selecting null when the new selected value is not found in the options. * Material Tab: * Fix logic for the active tab when tabs themselves are changed. Before logic was activating/deactivating based on index, but when tabs change the index has probably changed. * Make mixin to allow text wrapping. * Material Tree: * Fix bug where state of material tree option cannot be changed by selection model. * Fix bug where tree_dropdown_select did not auto open correctly using focus. * Scorecard: Update colors to match material spec. * Deprecate obsolete box-sizing style mixin. * Add link color styles and mixin. * Add typography style mixins. * Set preserveWhitespace: true in preparation for angular flipping the default to false. * Make functional directive name lowercase to conform with Dart style guide. * Replaces deprecated inputs and outputs with inline annotations. * Update visibility for provider resolution fix. * Update documentation.
1 parent e0f5073 commit 508d610

File tree

57 files changed

+882
-612
lines changed

Some content is hidden

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

57 files changed

+882
-612
lines changed

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
## 0.7.0
2+
3+
* Material Button: Add raised mixin so that buttons can be made to be raised
4+
without using the attribute.
5+
* Material Expansionpanel: Add header minimum height mixin.
6+
* Material Input: Add support for custom number formatters.
7+
* Material Popup:
8+
* Remove `PopupEvent` and reduce asynchrony.
9+
* Update PopupSizeProvider max-width/height once the popup has been
10+
positioned.
11+
* Remove unused `contenWidth` and `contentHeight`.
12+
* Material Radio: Avoid selecting null when the new selected value is not found
13+
in the options.
14+
* Material Tab:
15+
* Fix logic for the active tab when tabs themselves are changed. Before logic
16+
was activating/deactivating based on index, but when tabs change the index
17+
has probably changed.
18+
* Make mixin to allow text wrapping.
19+
* Material Tree:
20+
* Fix bug where state of material tree option cannot be changed by selection
21+
model.
22+
* Fix bug where tree_dropdown_select did not auto open correctly using focus.
23+
* Scorecard: Update colors to match material spec.
24+
* Deprecate obsolete box-sizing style mixin.
25+
* Add link color styles and mixin.
26+
* Add typography style mixins.
27+
* Set preserveWhitespace: true in preparation for angular flipping the default
28+
to false.
29+
* Make functional directive name lowercase to conform with Dart style guide.
30+
* Replaces deprecated inputs and outputs with inline annotations.
31+
* Update visibility for provider resolution fix.
32+
* Update documentation.
33+
34+
### Known Issues
35+
* Warnings are present when building with dart2js. Specifically:
36+
_Method type variables are treated as `dynamic` in `as` expressions._
37+
138
## 0.6.0
239

340
* Update dependency to angular: ^4.0.0.

lib/angular_components.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const List<dynamic> materialDirectives = const [
1818
ClickableTooltipTargetDirective,
1919
DarkThemeDirective,
2020
DeferredContentDirective,
21-
DisplayNameRendererDirective,
21+
displayNameRendererDirective,
2222
FixedMaterialTabStripComponent,
2323
FocusActivableItemDirective,
2424
FocusItemDirective,

lib/src/components/app_layout/README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ the material spec.
1010
## Setup
1111

1212
The styles are provided by
13-
`package:angular_components/src/components/app_layout/layout.scss.css`. To use
14-
these styles in an angular component simply add it as a `styleUrls` value in
13+
`package:angular_components/src/components/app_layout/layout.scss.css`. To use
14+
these styles in an angular component simply add it as a `styleUrls` value in
1515
your `Component` annotation. It is suggested that the style is added before any
1616
component specific styling so you can easily override style values as needed.
1717

@@ -215,5 +215,52 @@ Example:
215215
</material-content>
216216
```
217217

218-
<!-- TODO(tsander): Add documentation for navigation. Add images for examples
219-
-->
218+
## Navigation Styles
219+
220+
Navigation element styles within the drawer are also provided by app_layout.
221+
This is accomplished using the standard `material-list` component, and some
222+
special CSS classes.
223+
224+
The top level drawer content should be a `MaterialListComponent` with optional
225+
group elements which are specified by the `group` attribute on an element.
226+
227+
The `mat-drawer-spacer` CSS class is optional and ensures that if the header is
228+
inside of `material-content` then the drawer content will start at the bottom of
229+
the header.
230+
231+
Use `MaterialListItemComponent`s for the items in your drawer. For each group if
232+
you need a label on the group use the `label` attribute on a block element
233+
directly inside of your group element.
234+
235+
Here is an example:
236+
237+
```html
238+
<material-drawer permanent>
239+
<material-list *deferredContent>
240+
<!-- Position the start of the drawer content correctly -->
241+
<div group class="mat-drawer-spacer"></div>
242+
<!-- Here is a group without a label -->
243+
<div group>
244+
<material-list-item>
245+
<material-icon icon="inbox"></material-icon>Inbox
246+
</material-list-item>
247+
<material-list-item>
248+
<material-icon icon="star"></material-icon>Star
249+
</material-list-item>
250+
<material-list-item>
251+
<material-icon icon="send"></material-icon>Sent Mail
252+
</material-list-item>
253+
<material-list-item>
254+
<material-icon icon="drafts"></material-icon>Drafts
255+
</material-list-item>
256+
</div>
257+
<!-- This group has a label -->
258+
<div group>
259+
<div label>Tags</div>
260+
<material-list-item>
261+
<material-icon icon="star"></material-icon>Favorites
262+
</material-list-item>
263+
</div>
264+
</material-list>
265+
</material-drawer>
266+
```

lib/src/components/dynamic_component/dynamic_component.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ import '../../utils/async/async.dart';
2222
/// </dynamic-component>
2323
///
2424
@Component(
25-
selector: 'dynamic-component',
26-
template: '''<template #marker></template>''')
25+
selector: 'dynamic-component',
26+
template: '''<template #marker></template>''',
27+
// TODO(google): Change preserveWhitespace to false to improve codesize.
28+
preserveWhitespace: true,
29+
)
2730
class DynamicComponent implements OnDestroy {
2831
final SlowComponentLoader _slowComponentLoader;
2932
final ComponentLoader _componentLoader;

lib/src/components/material_button/_mixins.scss

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ $button-disabled-color-dark: rgba(255, 255, 255, $mat-dark-opacity-lightest);
221221
background-color: $background-color;
222222
}
223223

224-
::ng-deep #{$selector}:not([disabled]):hover {
224+
// Not selectors are used for specificity. Default hover selector is very
225+
// specific add a psuedo not value to overide default specificity.
226+
::ng-deep #{$selector}:not([disabled]):not([icon]):not([raised]):not(.xyzxyz):hover {
225227
background-color: $background-color;
226228
}
227229
}
@@ -248,3 +250,27 @@ $button-disabled-color-dark: rgba(255, 255, 255, $mat-dark-opacity-lightest);
248250
}
249251
}
250252
}
253+
254+
/// Mixin to create a raised button taking an optional color of the button.
255+
///
256+
/// Should be scopped to the specific button needed to make raised.
257+
/// Example:
258+
/// ```Sass
259+
/// material-button.my-raised {
260+
/// @include raised-button($mat-blue);
261+
/// }
262+
/// ```
263+
@mixin raised-button($color: null) {
264+
::ng-deep & {
265+
@include _button-raised;
266+
}
267+
268+
@if $color {
269+
@include button-background-color('&', $color);
270+
@include button-color('&', $mat-white);
271+
} @else {
272+
// Specifically set raised buttons to transparent. This ensures hover,
273+
// and other colors are correct.
274+
@include button-background-color('&', transparent);
275+
}
276+
}

lib/src/components/material_button/material_fab.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ import 'material_button_base.dart';
6262
preserveWhitespace: false,
6363
templateUrl: 'material_button.html',
6464
styleUrls: const ['material_fab.scss.css'],
65-
changeDetection: ChangeDetectionStrategy.OnPush)
65+
changeDetection: ChangeDetectionStrategy.OnPush,
66+
visibility: Visibility.none)
6667
class MaterialFabComponent extends MaterialButtonBase {
6768
final ChangeDetectorRef _changeDetector;
6869
MaterialFabComponent(HtmlElement element, this._changeDetector)

lib/src/components/material_chips/material_chip.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ import '../focus/focus.dart';
4444
templateUrl: 'material_chip.html',
4545
styleUrls: const ['material_chip.scss.css'],
4646
directives: const [ButtonDirective, NgIf],
47-
changeDetection: ChangeDetectionStrategy.OnPush)
47+
changeDetection: ChangeDetectionStrategy.OnPush,
48+
visibility: Visibility.none)
4849
class MaterialChipComponent extends RootFocusable implements HasRenderer {
4950
MaterialChipComponent(Element root) : super(root);
5051

lib/src/components/material_chips/material_chips.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ import './material_chip.dart';
4040
templateUrl: 'material_chips.html',
4141
styleUrls: const ['material_chips.scss.css'],
4242
directives: const [MaterialChipComponent, NgFor],
43-
changeDetection: ChangeDetectionStrategy.OnPush)
43+
changeDetection: ChangeDetectionStrategy.OnPush,
44+
visibility: Visibility.none)
4445
class MaterialChipsComponent implements HasRenderer, OnDestroy {
4546
final ChangeDetectorRef _changeDetector;
4647
final Disposer _disposer = new Disposer.multi();

lib/src/components/material_expansionpanel/_mixins.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,18 @@ $_panel: 'div.panel.themeable';
138138
}
139139
}
140140

141+
@mixin expansionpanel-header-min-height($min-height, $open-min-height) {
142+
::ng-deep #{$_panel} {
143+
header {
144+
min-height: $min-height;
145+
}
146+
147+
&.open > header {
148+
min-height: $open-min-height;
149+
}
150+
}
151+
}
152+
141153
@mixin expansionpanel-header-padding($padding) {
142154
::ng-deep #{$_panel} > header {
143155
padding: $padding;

lib/src/components/material_icon/material_icon.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ const List<String> _flippedIcons = const [
6464
templateUrl: 'material_icon.html',
6565
styleUrls: const ['material_icon.scss.css'],
6666
changeDetection: ChangeDetectionStrategy.OnPush,
67-
preserveWhitespace: false)
67+
preserveWhitespace: false,
68+
visibility: Visibility.none)
6869
class MaterialIconComponent {
6970
/// The `Icon` model (lib/src/model/ui/icon.dart) or icon
7071
/// identifier (String) this component should display.

0 commit comments

Comments
 (0)