Skip to content

feat(chips): Add chip avatar and chip trailing icon #9557

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

Merged
merged 3 commits into from
Jan 26, 2018

Conversation

tinayuangao
Copy link
Contributor

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 24, 2018

.mat-chip:not(.mat-basic-chip) {
.mat-chip.mat-standard-chip {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need the extra specificity from .mat-chip, or can you just remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed


[dir='rtl'] & {
margin: 0;
margin-bottom: $mat-chips-chip-margin;
padding-left: $mat-chip-remove-after-padding;
Copy link
Contributor

Choose a reason for hiding this comment

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

do you also need to zero out the padding-right?

&:last-child, [dir='rtl'] &:last-child {
margin-bottom: 0;
[dir='rtl'] & {
padding-right: $mat-chip-avatar-before-padding;
Copy link
Contributor

Choose a reason for hiding this comment

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

zero out padding-left?

margin-right: $mat-chip-avatar-after-margin;

[dir='rtl'] & {
margin-left: $mat-chip-avatar-after-margin;
Copy link
Contributor

Choose a reason for hiding this comment

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

zero out margin-right

margin-left: $mat-chip-remove-before-margin;

[dir='rtl'] & {
margin-right: $mat-chip-remove-before-margin;
Copy link
Contributor

Choose a reason for hiding this comment

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

zero out margin-left

<mat-chip>
<mat-icon matChipAvatar>home</mat-icon>
Home
<mat-icon matChipRemove matChipTrailingIcon>cancel</mat-icon>
Copy link
Contributor

Choose a reason for hiding this comment

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

what does matChipTrailingIcon do? it looks the same as the example above where you only applied matChipRemove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My plan is that matChipRemove is responsible for the remove action, and matChipTrailingIcon is responsible for the styling. The trailing icon can be a status icon instead of X.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah ok, do these examples need both directives? It seems like just matChipRemove would be sufficient since does everything that trailing icon does + some extra behavior. In fact you could probably make the CSS simpler by having matChipRemove just apply the mat-chip-trailing-icon class .

Also should add an example of a trailing icon that isn't a remove icon

@@ -31,6 +31,47 @@ <h4>Advanced</h4>
</mat-chip>
</mat-chip-list>
<div>{{message}}</div>

Copy link
Contributor

Choose a reason for hiding this comment

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

add color example with avatar

Copy link
Contributor Author

@tinayuangao tinayuangao left a comment

Choose a reason for hiding this comment

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

Thanks for review.

Made some changes: Removed MatBasicChip and MatStandardChip, use the same way as button variant to add css class.

<mat-chip>
<mat-icon matChipAvatar>home</mat-icon>
Home
<mat-icon matChipRemove matChipTrailingIcon>cancel</mat-icon>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My plan is that matChipRemove is responsible for the remove action, and matChipTrailingIcon is responsible for the styling. The trailing icon can be a status icon instead of X.


.mat-chip:not(.mat-basic-chip) {
.mat-chip.mat-standard-chip {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM aside from any comments from @mmalerba

@tinayuangao
Copy link
Contributor Author

Added examples in demo, and added mat-chip-trailing-icon to MatChipRemove. Thanks!

@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Jan 25, 2018
@mmalerba
Copy link
Contributor

LGTM

@tinayuangao tinayuangao merged commit ef86655 into angular:input-chip Jan 26, 2018
mmalerba pushed a commit that referenced this pull request Jan 26, 2018
* feat(chips): Add chip avatar and chip trailing icon

* Removed MatBasicChip and MatStandardChip

* Add mat-chip-trailing-icon style to MatChipRemove and add examples in
demo
@jelbourn jelbourn added the target: minor This PR is targeted for the next minor release label Jan 29, 2018
mmalerba pushed a commit that referenced this pull request Feb 1, 2018
* feat(chips): Add chip avatar and chip trailing icon

* Removed MatBasicChip and MatStandardChip

* Add mat-chip-trailing-icon style to MatChipRemove and add examples in
demo
mmalerba pushed a commit that referenced this pull request Feb 2, 2018
* feat(chips): Add chip avatar and chip trailing icon

* Removed MatBasicChip and MatStandardChip

* Add mat-chip-trailing-icon style to MatChipRemove and add examples in
demo
mmalerba pushed a commit that referenced this pull request Feb 4, 2018
* feat(chips): Add chip avatar and chip trailing icon

* Removed MatBasicChip and MatStandardChip

* Add mat-chip-trailing-icon style to MatChipRemove and add examples in
demo
mmalerba added a commit that referenced this pull request Feb 6, 2018
…ter (#9762)

* feat(form-field): support for different spec variants (#9366)

* feat(form-field): implement hover state

[Based on the spec](https://material.io/guidelines/components/text-fields.html#text-fields-states) form fields should have a hover state where the underline gets darkened while the user is hovering and gets replaced by the theme color after the focus the input.

* branch css logic

* extract underline css into standard variant

* box variant underline

* box variant spacing

* add legacy variant

* fix select ellipsis

* move hover state changes out of legacy variant

* add variants section to input demo

* use filter/backface-visibility to address label jumpiness

* address comments

* fix box variant text fuzziness

* remove bluriness fixes that aren't needed anymore

* address comments

* remove the floatLabel=never option in the new variants

* variant --> appearance

* add tests for new label & placeholder behavior

* update demo to use mat-label

* fix bazel build

* feat(chips): Add chip avatar and chip trailing icon (#9557)

* feat(chips): Add chip avatar and chip trailing icon

* Removed MatBasicChip and MatStandardChip

* Add mat-chip-trailing-icon style to MatChipRemove and add examples in
demo

* fix(form-field): rename box to fill and tweak the styles a bit (#9636)

* make some tweaks to the box appearance

* rename 'box' appearance to 'fill'

* feat(form-field): add outline style (#9705)

* remove datepicker reliance on form-field's underlineRef

* add spacing and alignment rules for outline variant

* outline color & thickness

* style tweaks

* correctly position and size the gap

* address comments

* fix(form-field): correct prefix & suffix icons as well as select arrow for various form field appearances (#9743)

* feat(input): add utilities for custom styling and monitoring state of input autofill (#9719)

* add utility for monitoring input autofill

* add scss mixin for styling input autofill colors

* tests

* move everything from cdk to MatInputModule

* address comments

* add doc comments

* fix(form-field): fixes for outline appearance (#9759)

* use the `AutofillMonitor` in `MatInput`

* Make `updateOutlineGap` public so users can call it if needed

* feat(chips): add ripple to chips (#9761)

* fix(form-field, chips): fix tests & lint (#9767)

* undo change that caused darkened color for legacy form field

* fix change detection

* fix(chips): remove margin for chip list (#9793)

* add terminateOnPointerUp to ripple config
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants