2018-06-14 06:29:01 +09:00
|
|
|
<template>
|
2018-10-26 14:47:30 +09:00
|
|
|
<div class="ui-textarea" :class="{ focused, filled, tall }">
|
2018-06-14 06:29:01 +09:00
|
|
|
<div class="input">
|
|
|
|
<span class="label" ref="label"><slot></slot></span>
|
2018-06-14 14:52:37 +09:00
|
|
|
<textarea ref="input"
|
2018-10-26 14:38:03 +09:00
|
|
|
:value="value"
|
|
|
|
:required="required"
|
|
|
|
:readonly="readonly"
|
|
|
|
:pattern="pattern"
|
|
|
|
:autocomplete="autocomplete"
|
|
|
|
@input="$emit('input', $event.target.value)"
|
|
|
|
@focus="focused = true"
|
|
|
|
@blur="focused = false"
|
|
|
|
></textarea>
|
2018-06-14 06:29:01 +09:00
|
|
|
</div>
|
2018-11-06 15:08:22 +09:00
|
|
|
<div class="desc"><slot name="desc"></slot></div>
|
2018-06-14 06:29:01 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-06-14 14:52:37 +09:00
|
|
|
|
2018-06-14 06:29:01 +09:00
|
|
|
export default Vue.extend({
|
2018-06-14 09:51:55 +09:00
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
required: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
readonly: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false
|
2018-06-14 14:52:37 +09:00
|
|
|
},
|
|
|
|
pattern: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
|
|
|
},
|
|
|
|
autocomplete: {
|
|
|
|
type: String,
|
|
|
|
required: false
|
2018-10-26 14:47:30 +09:00
|
|
|
},
|
|
|
|
tall: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
2018-06-14 09:51:55 +09:00
|
|
|
},
|
2018-06-14 06:29:01 +09:00
|
|
|
data() {
|
|
|
|
return {
|
2018-06-14 14:52:37 +09:00
|
|
|
focused: false,
|
|
|
|
passwordStrength: ''
|
2018-06-14 06:29:01 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
filled(): boolean {
|
|
|
|
return this.value != '' && this.value != null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
focus() {
|
|
|
|
this.$refs.input.focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-27 22:50:34 +09:00
|
|
|
root(fill)
|
2018-06-15 13:08:56 +09:00
|
|
|
margin 42px 0 32px 0
|
2018-06-14 06:29:01 +09:00
|
|
|
|
2018-10-26 08:37:30 +09:00
|
|
|
&:last-child
|
|
|
|
margin-bottom 0
|
|
|
|
|
2018-06-14 06:29:01 +09:00
|
|
|
> .input
|
2018-06-14 14:52:37 +09:00
|
|
|
padding 12px
|
2018-06-14 18:53:02 +09:00
|
|
|
|
|
|
|
if fill
|
|
|
|
background rgba(#000, 0.035)
|
|
|
|
border-radius 6px
|
|
|
|
else
|
|
|
|
&:before
|
|
|
|
content ''
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
bottom 0
|
|
|
|
left 0
|
|
|
|
right 0
|
|
|
|
background none
|
2018-09-27 22:50:34 +09:00
|
|
|
border solid 1px var(--inputBorder)
|
2018-06-14 18:53:02 +09:00
|
|
|
border-radius 3px
|
|
|
|
pointer-events none
|
|
|
|
|
|
|
|
&:after
|
|
|
|
content ''
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
bottom 0
|
|
|
|
left 0
|
|
|
|
right 0
|
|
|
|
background none
|
2018-09-26 20:19:35 +09:00
|
|
|
border solid 2px var(--primary)
|
2018-06-14 18:53:02 +09:00
|
|
|
border-radius 3px
|
|
|
|
opacity 0
|
|
|
|
transition opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1)
|
|
|
|
pointer-events none
|
2018-06-14 06:29:01 +09:00
|
|
|
|
|
|
|
> .label
|
|
|
|
position absolute
|
2018-06-14 07:22:50 +09:00
|
|
|
top 6px
|
2018-06-14 14:52:37 +09:00
|
|
|
left 12px
|
2018-06-14 06:29:01 +09:00
|
|
|
pointer-events none
|
|
|
|
transition 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)
|
|
|
|
transition-duration 0.3s
|
|
|
|
font-size 16px
|
|
|
|
line-height 32px
|
2018-09-27 22:50:34 +09:00
|
|
|
color var(--inputLabel)
|
2018-06-14 06:29:01 +09:00
|
|
|
pointer-events none
|
2018-06-14 14:52:37 +09:00
|
|
|
//will-change transform
|
|
|
|
transform-origin top left
|
|
|
|
transform scale(1)
|
2018-06-14 06:29:01 +09:00
|
|
|
|
2018-06-14 14:52:37 +09:00
|
|
|
> textarea
|
2018-06-14 06:29:01 +09:00
|
|
|
display block
|
|
|
|
width 100%
|
2018-06-14 14:52:37 +09:00
|
|
|
min-height 100px
|
2018-06-14 06:29:01 +09:00
|
|
|
padding 0
|
2018-06-14 07:22:50 +09:00
|
|
|
font inherit
|
2018-06-14 18:53:02 +09:00
|
|
|
font-weight fill ? bold : normal
|
2018-06-14 06:29:01 +09:00
|
|
|
font-size 16px
|
2018-09-27 22:50:34 +09:00
|
|
|
color var(--inputText)
|
2018-06-14 06:29:01 +09:00
|
|
|
background transparent
|
|
|
|
border none
|
|
|
|
border-radius 0
|
|
|
|
outline none
|
|
|
|
box-shadow none
|
|
|
|
|
2018-11-06 15:08:22 +09:00
|
|
|
> .desc
|
2018-06-14 14:52:37 +09:00
|
|
|
margin 6px 0
|
|
|
|
font-size 13px
|
2018-11-11 21:18:24 +09:00
|
|
|
opacity 0.7
|
2018-06-14 09:51:55 +09:00
|
|
|
|
2018-06-14 14:52:37 +09:00
|
|
|
*
|
2018-06-14 09:51:55 +09:00
|
|
|
margin 0
|
|
|
|
|
2018-06-14 06:29:01 +09:00
|
|
|
&.focused
|
|
|
|
> .input
|
2018-06-14 18:53:02 +09:00
|
|
|
if fill
|
|
|
|
background rgba(#000, 0.05)
|
|
|
|
else
|
|
|
|
&:after
|
|
|
|
opacity 1
|
2018-06-14 06:29:01 +09:00
|
|
|
|
|
|
|
> .label
|
2018-09-26 20:19:35 +09:00
|
|
|
color var(--primary)
|
2018-06-14 06:29:01 +09:00
|
|
|
|
|
|
|
&.focused
|
|
|
|
&.filled
|
|
|
|
> .input
|
|
|
|
> .label
|
2018-06-14 14:52:37 +09:00
|
|
|
top -24px
|
2018-06-14 06:29:01 +09:00
|
|
|
left 0 !important
|
2018-06-14 21:38:39 +09:00
|
|
|
transform scale(0.75)
|
2018-06-14 06:29:01 +09:00
|
|
|
|
2018-10-26 14:47:30 +09:00
|
|
|
&.tall
|
|
|
|
> .input
|
|
|
|
> textarea
|
|
|
|
min-height 200px
|
|
|
|
|
2018-09-27 22:50:34 +09:00
|
|
|
.ui-textarea.fill
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.ui-textarea:not(.fill)
|
|
|
|
root(false)
|
2018-06-14 18:53:02 +09:00
|
|
|
|
2018-06-14 06:29:01 +09:00
|
|
|
</style>
|