This repository has been archived by the owner on Nov 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(floating-label): Synchronise with mdc-web v0.32.0 (add component)
- Loading branch information
Showing
8 changed files
with
119 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<label | ||
class="mdc-floating-label" | ||
:class="classes"> | ||
<slot/> | ||
</label> | ||
</template> | ||
|
||
<script> | ||
import { MDCFloatingLabel } from '@material/floating-label' | ||
export default { | ||
props: { | ||
floatAbove: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
shake: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
data () { | ||
return { | ||
mdcFloatingLabel: null | ||
} | ||
}, | ||
computed: { | ||
classes () { | ||
return { | ||
'mdc-floating-label--float-above': this.floatAbove, | ||
'mdc-floating-label--shake': this.shake | ||
} | ||
} | ||
}, | ||
mounted () { | ||
this.mdcFloatingLabel = MDCFloatingLabel.attachTo(this.$el) | ||
}, | ||
beforeDestroy () { | ||
this.mdcFloatingLabel.destroy() | ||
} | ||
} | ||
</script> |
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,29 @@ | ||
## FloatingLabel | ||
|
||
### Markup | ||
|
||
|
||
```html | ||
<m-text-field id="textfield"> | ||
<m-floating-label for="textfield">Textfield label</m-floating-label> | ||
<m-line-ripple slot="bottomLine"/> | ||
</m-text-field> | ||
|
||
### Props | ||
|
||
| Prop | Type | Default | Description | | ||
|------|------|---------|-------------| | ||
| floatAbove | Boolean | false | label is floating above | | ||
| absoluteRight | Boolean | false | shakes the label | | ||
|
||
### Slots | ||
|
||
| Slot | Description | | ||
|------|-------------| | ||
| default | label content | | ||
|
||
### Reference | ||
|
||
- https://github.com/material-components/material-components-web/tree/master/packages/mdc-floating-label | ||
|
||
|
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,13 @@ | ||
import FloatingLabel from './FloatingLabel.vue' | ||
import './styles.scss' | ||
|
||
import { initPlugin } from '../' | ||
|
||
const plugin = { | ||
install (vm) { | ||
vm.component('m-floating-label', FloatingLabel) | ||
} | ||
} | ||
export default plugin | ||
|
||
initPlugin(plugin) |
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 @@ | ||
@import "@material/floating-label/mdc-floating-label"; |
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