This repository has been archived by the owner on Nov 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tagsInput): Add visual feedback for invalid tags
Add visual feedback for invalid tags so one knows why a tag cannot be added. Make the directive invalid when it loses focus and there is some leftover text that couldn't be turned into a tag (either because it's invalid or the addOnBlur option is off). That behavior can be turned off by setting the newly created allowLeftoverText option to true. Closes #77.
- Loading branch information
Showing
11 changed files
with
213 additions
and
140 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,82 @@ | ||
@import "mixins"; | ||
@import "variables"; | ||
|
||
tags-input .tags { | ||
-moz-appearance: textfield; | ||
-webkit-appearance: textfield; | ||
padding: 1px; | ||
overflow: hidden; | ||
word-wrap: break-word; | ||
cursor: text; | ||
background-color: $tags-bgcolor; | ||
border: $tags-border; | ||
box-shadow: $tags-border-shadow; | ||
tags-input { | ||
.tags { | ||
-moz-appearance: textfield; | ||
-webkit-appearance: textfield; | ||
padding: 1px; | ||
overflow: hidden; | ||
word-wrap: break-word; | ||
cursor: text; | ||
background-color: $tags-bgcolor; | ||
border: $tags-border; | ||
box-shadow: $tags-border-shadow; | ||
|
||
&.focused { | ||
outline: none; | ||
@include box-shadow($tags-outline-box-shadow); | ||
} | ||
&.focused { | ||
outline: none; | ||
@include box-shadow($tags-outline-box-shadow); | ||
} | ||
|
||
.tag-list { | ||
margin: 0; | ||
padding: 0; | ||
list-style-type: none; | ||
} | ||
.tag-list { | ||
margin: 0; | ||
padding: 0; | ||
list-style-type: none; | ||
} | ||
|
||
.tag-item { | ||
margin: 2px; | ||
padding: 0 5px; | ||
display: inline-block; | ||
float: left; | ||
font: $tag-font; | ||
height: $tag-height; | ||
line-height: $tag-height - 1px; | ||
border: $tag-border; | ||
border-radius: $tag-border-radius; | ||
@include gradient($tag-color); | ||
|
||
.tag-item { | ||
margin: 2px; | ||
padding: 0 5px; | ||
display: inline-block; | ||
float: left; | ||
font: $tag-font; | ||
height: $tag-height; | ||
line-height: $tag-height - 1px; | ||
border: $tag-border; | ||
border-radius: $tag-border-radius; | ||
@include gradient($tag-color); | ||
&.selected { | ||
@include gradient($tag-color-selected); | ||
} | ||
|
||
&.selected { | ||
@include gradient($tag-color-selected); | ||
.remove-button { | ||
margin: 0 0 0 5px; | ||
padding: 0; | ||
border: none; | ||
background: none; | ||
cursor: pointer; | ||
vertical-align: middle; | ||
font: $remove-button-font; | ||
color: $remove-button-color; | ||
|
||
&:active { | ||
color: $remove-button-color-active; | ||
} | ||
} | ||
} | ||
|
||
.remove-button { | ||
margin: 0 0 0 5px; | ||
.input { | ||
border: 0; | ||
outline: none; | ||
margin: 2px; | ||
padding: 0; | ||
border: none; | ||
background: none; | ||
cursor: pointer; | ||
vertical-align: middle; | ||
font: $remove-button-font; | ||
color: $remove-button-color; | ||
padding-left: 5px; | ||
float: left; | ||
height: $tag-height; | ||
font: $input-font; | ||
|
||
&:active { | ||
color: $remove-button-color-active; | ||
&.invalid-tag { | ||
color: $tag-color-invalid; | ||
} | ||
} | ||
} | ||
|
||
.input { | ||
border: 0; | ||
outline: none; | ||
margin: 2px; | ||
padding: 0; | ||
padding-left: 5px; | ||
float: left; | ||
height: $tag-height; | ||
font: $input-font; | ||
&::-ms-clear { | ||
display: none; | ||
} | ||
} | ||
} | ||
|
||
.input::-ms-clear { | ||
display: none; | ||
&.ng-invalid .tags { | ||
@include box-shadow($tags-outline-box-shadow-invalid); | ||
} | ||
} |
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,14 @@ | ||
'use strict'; | ||
|
||
var customMatchers = { | ||
toHaveClass: function () { | ||
return { | ||
compare: function(actual, expected) { | ||
var result = {}; | ||
result.pass = actual.hasClass(expected); | ||
result.message = 'Expected element' + (result.pass ? ' not ' : ' ') + 'to have class \'' + expected + '\''; | ||
return result; | ||
} | ||
}; | ||
} | ||
}; |
Oops, something went wrong.