Skip to content
This repository has been archived by the owner on May 5, 2018. It is now read-only.

Commit

Permalink
Totally refactors the input.
Browse files Browse the repository at this point in the history
This commit has breaking changes, see full changelog.
Changes:
1. *Breaking* Refactored how classes works. Now they are applied on the root el$
2. *Breaking* Changed css-rules, old rules will not work.
3. Now `input` events are subscribed in template
4. Refactored how validation is handled
5. Now `:errorMessages` can be a `String`
6. Now `:disabled="true"` input has a dotted border
7. Fixed README.md and package.json

Closes #30, closes #31, closes #32, closes #33, closes #35, closes #38
  • Loading branch information
sobolevn committed Nov 22, 2016
1 parent e5d6702 commit 499d8ab
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 124 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -40,4 +40,4 @@ const vm = new Vue({
})
```

For more examples, please check [`/dev`](https://github.com/wemake-services/vue-material-input/tree/master/dev) folder and the [project's website](http://wemake.services/vue-material-input).
For more examples, please check [`/play`](https://github.com/wemake-services/vue-material-input/tree/master/play) folder and the [project's website](http://wemake.services/vue-material-input).
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "vue-material-input",
"version": "1.1.0",
"description": "Simple material input with no dependencies",
"description": "Simple implementation of Material Input with no dependencies",
"author": "sobolevn <mail@sobolevn.me>",
"private": false,
"scripts": {
Expand Down
67 changes: 66 additions & 1 deletion play/components/Constructor.vue
Expand Up @@ -21,6 +21,11 @@
<input type="text" v-model="childProperies.value" />
</div>

<div class="example-field">
<label>Error value</label>
<input type="text" v-model="childProperies.errorMessages" />
</div>

<div class="example-field">
<label>Disabled</label>
<input type="checkbox" v-model="childProperies.disabled" />
Expand All @@ -47,7 +52,8 @@
placeholder: null,
value: null,
disabled: false,
readonly: false
readonly: false,
errorMessages: 'Error value'
}
}
},
Expand All @@ -56,3 +62,62 @@
}
}
</script>

<style lang="sass">
// Theme:
$color-white: white;
$color-grey: #9E9E9E;
$color-grey-light: #E0F7FA;
$color-cyan: #00BCD4;
$color-cyan-dark: #006064;
$color-black: black;
.material-input--cyan {
background: $color-white;
.material-input {
background: none;
color: $color-black;
border-bottom: 1px solid $color-grey-light;
}
.material-label {
color: $color-grey;
}
.material-input-bar {
&:before,
&:after {
background: $color-cyan;
}
}
// Active state:
&.material--active {
.material-label {
color: $color-cyan;
}
}
// Errors:
&.material--has-errors {
&.material--active .material-label {
color: $color-cyan-dark;
}
.material-input-bar {
&:before,
&:after {
background: $color-cyan-dark;
}
}
.material-errors {
color: $color-cyan-dark;
}
}
}
</style>
12 changes: 6 additions & 6 deletions play/components/Validation.vue
@@ -1,13 +1,13 @@
<template>
<div class="example">
<h1>
<h4>
Validation
</h1>
</h4>

<form @submit.prevent="submitHTMLForm">
<h2>
<h5>
This example uses native html5 form validation
</h2>
</h5>

<MaterialInput
type="text"
Expand All @@ -25,10 +25,10 @@
</form>

<form @submit.prevent="submitVeeForm">
<h2>
<h5>
This example uses
<a href="http://vee-validate.logaretm.com/">vee-validate</a>
</h2>
</h5>

<MaterialInput
v-validate.initial="username"
Expand Down

0 comments on commit 499d8ab

Please sign in to comment.