GitXplorerGitXplorer
k

angular-float-label

public
10 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
d39e2b11291bf74f0f34cbcabc5363babe89e666

Add Sinon. Switch expect() to should().

kkasperlewau committed 11 years ago
Unverified
509e1c05a3287b1ec0834c9ad50d5dd8fd861c97

Add imaginary specs. WIP

kkasperlewau committed 11 years ago
Unverified
ad17626b82dda0df78f63635b350a57b3f22798a

newline @eof

kkasperlewau committed 11 years ago
Unverified
85ce4a433f3f3620ff5fbc7de1c6084075bae758

Update node deps.

kkasperlewau committed 11 years ago
Unverified
665a96b49ce5e2a6c86311ec83ee4767658ac07f

start testing functions

kkasperlewau committed 11 years ago
Unverified
ac05e5968814898e75f7496c0d18ca87d05094a0

Update specs

kkasperlewau committed 11 years ago

README

The README file for this repository.

angular-float-label

An implementation of the Float Label Pattern for Angular. At this stage the code is still very much in its baby-state, so treat it as such (not production ready).

Installation

$ bower install kasperlewau/angular-float-label

or just grab the source.

Inclusion

var app = angular.module('myModule', ['kl.angular-float-label', ...]);

Example

alt text

Useage

.fl-input, .fl-textarea {
  position: relative;
  input, label, textarea {
    transition: all ease-in-out .15s;
    &::-webkit-input-placeholder { color: inherit; }
    &::-moz-placeholder { color: inherit; } /* firefox 19+ */
    &:-ms-input-placeholder { color: inherit; } /* ie */
    &:-moz-placeholder { color: inherit; }
  }
  label {
    position: absolute;
    top: -1.1em;
    left: 5px;
    opacity: 0;
  }
  &.fl-focused, &.fl-populated {
    label {
      opacity: 1;
      top: -1.5em;
      left: 5px;
    }
  }
}
<form>
  <input type="email" float-label="Email" ng-model="usr.email" required>
  <textarea float-label="Description" ng-model="usr.description"></textarea>
</form>
<!-- becomes -->
<form>
  <div class="fl-input">
    <label for="usr-email">Email</label>
    <input type="email" float-label="Email" ng-model="usr.email" required="" name="usr-email" class="ng-pristine ng-invalid ng-invalid-required ng-valid-email">
  </div>
  <div class="fl-textarea">
    <label for="usr-description">Description</label>
    <textarea float-label="Description" ng-model="usr.description" name="usr-description" class="ng-pristine ng-valid"></textarea>
  </div>
</form>

To-dos

  • [ ] Write tests
  • [x] Move away from the oh-so-stupid setTimeout() on init.
  • [x] Handle HTML5 inline validation.
    • [x] Conditional placeholder attributes + inherited styling to enable HTML5 validations.
    • [x] Some sort of flickering introduced with this upon multiple submits, check it out.
  • [x] Move DOM transforming to compile().
    • [/] Not fully switched to compile(), working as of now however.
  • [ ] Add hosted demo with examples // Improve README.
  • [ ] Add support for passed in opts as args
    • [ ] Classes
    • [ ] Animation
    • [ ] Predefined type
  • [ ] Probably 100 other things I've yet to think of.

License

MIT