-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MdChips): feedback for duplicated chip (#1281)
* feat(MdChips): feedback for duplicated chip add `md-duplicated` class which has the same style as `md-accent`. add `md-check-duplicated-on-change` props. fix #1212 * fix(MdChips): change api `mdCheckDuplicatedOnChange` to `mdAlwaysCheckDuplicated` * fix(MdChips): change for loop key from `key` to `chip` to prevent triggering animate while removing * docs(MdChips): example and new props for duplicated chip checking fix #1212 * fix(MdChips): always clear `duplicatedChip` on change * style(MdChips): fix style to pass scss-lint * fix(MdChips): rename prop * fix(MdChips): rename prop * fix(MdChips): rename prop * fix(MdChips): rename prop * style(MdChips): adjust code style
- Loading branch information
1 parent
023723a
commit d15f63b
Showing
5 changed files
with
123 additions
and
11 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
59 changes: 59 additions & 0 deletions
59
docs/app/pages/Components/Chips/examples/DuplicatedFeedback.vue
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,59 @@ | ||
<template> | ||
<div> | ||
<md-chips class="md-primary" v-model="chips" md-placeholder="Add genre..."> | ||
<div class="md-helper-text">Default</div> | ||
</md-chips> | ||
<md-chips class="md-primary shake-on-error" v-model="chips" md-placeholder="Add genre..."> | ||
<div class="md-helper-text">Shake duplicated chip on insertion</div> | ||
</md-chips> | ||
<md-chips class="md-primary pulse-on-error" v-model="chips" md-placeholder="Add genre..." md-check-duplicated> | ||
<div class="md-helper-text">Always pulse duplicated chip</div> | ||
</md-chips> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'DuplicatedFeedback', | ||
data: () => ({ | ||
chips: [ | ||
'Pop', | ||
'Rock', | ||
'Jazz', | ||
'Metal' | ||
] | ||
}) | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.shake-on-error /deep/ .md-duplicated { | ||
animation-name: shake; | ||
animation-duration: 0.5s; | ||
} | ||
@keyframes shake { | ||
0% { transform: translate(15px); } | ||
20% { transform: translate(-15px); } | ||
40% { transform: translate(7px); } | ||
60% { transform: translate(-7px); } | ||
80% { transform: translate(3px); } | ||
100% { transform: translate(0px); } | ||
} | ||
</style> | ||
|
||
<style lang="css" scoped> | ||
.pulse-on-error >>> .md-duplicated { | ||
animation-name: pulse; | ||
animation-duration: 0.5s; | ||
animation-iteration-count: infinite; | ||
animation-direction: alternate; | ||
animation-timing-function: ease-in-out | ||
} | ||
@keyframes pulse { | ||
0% { transform: scale(1.1, 1.1); } | ||
100% { transform: scale(0.9, 0.9); } | ||
} | ||
</style> | ||
|
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 works only if chip is a single string an not an object :(