GitXplorerGitXplorer
k

angular-float-label

public
10 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
019496bd7d5fcbdcdcbe3996ac8138c025d44122

Add specs

kkasperlewau committed 11 years ago
Unverified
29918d87ac850dfd57836a1352cee3f98ea4c53a

Rename some functions and variables.

kkasperlewau committed 11 years ago
Unverified
58e2f003c3710b9cde26d8548f4b1a7715a2c0fb

Scrap requiring ngModel

kkasperlewau committed 11 years ago
Unverified
f2b9b32bdcaf63129f991490a378b1300a2a63b3

Fix fliker by checking validity of input.

kkasperlewau committed 11 years ago
Unverified
c1ff5d07610b2f3d02d3947a9ebffc757c7e6911

Minor refactor

kkasperlewau committed 11 years ago
Unverified
ffbbe67446387f7cde74f707a990ebfc836b0971

Update README

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