-
-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new AppFocusableContainer component (#942)
Signed-off-by: Pedro Lamas <[email protected]>
- Loading branch information
1 parent
554936d
commit 961b45f
Showing
3 changed files
with
66 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div | ||
@focusin="setFocus(true)" | ||
@focusout="setFocus(false)" | ||
> | ||
<v-input | ||
class="v-text-field v-text-field--enclosed v-text-field--outlined" | ||
:class="{ | ||
'v-input--is-focused': hasFocus, | ||
'primary--text': hasFocus | ||
}" | ||
hide-details | ||
> | ||
<slot /> | ||
<fieldset aria-hidden="true" /> | ||
</v-input> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Vue } from 'vue-property-decorator' | ||
@Component({}) | ||
export default class AppFocusableContainer extends Vue { | ||
hasFocus = false | ||
setFocus (value: boolean) { | ||
this.hasFocus = value | ||
if (value) { | ||
this.$emit('focus') | ||
} else { | ||
this.$emit('blur') | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
:deep(.v-input__slot) { | ||
padding: 0px !important; | ||
outline: none !important; | ||
cursor: default !important; | ||
fieldset { | ||
top: 0px !important; | ||
} | ||
} | ||
</style> |
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