@magicgol/polyjuice 0.41.0 → 0.42.1
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
import MgTextarea from './Textarea.vue';
|
2
|
+
|
3
|
+
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
|
4
|
+
export default {
|
5
|
+
title: 'Form/Input/Textarea',
|
6
|
+
component: MgTextarea,
|
7
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
8
|
+
argTypes: {
|
9
|
+
},
|
10
|
+
};
|
11
|
+
|
12
|
+
// More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
|
13
|
+
const Template = (args, { argTypes }) => ({
|
14
|
+
props: Object.keys(argTypes),
|
15
|
+
components: { MgTextarea },
|
16
|
+
template: `<mg-textarea @click="$emit('click')" v-bind="$props"></mg-textarea>`,
|
17
|
+
});
|
18
|
+
|
19
|
+
export const Default = Template.bind({});
|
20
|
+
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
21
|
+
Default.args = {
|
22
|
+
value: 'given input'
|
23
|
+
};
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
:class="classes"
|
4
|
+
class="bg-white rounded p-1"
|
5
|
+
>
|
6
|
+
<textarea
|
7
|
+
v-on:input="$emit('input', $event.target.value)"
|
8
|
+
v-on:focus="propagateFocus"
|
9
|
+
v-on:blur="propagateBlur"
|
10
|
+
v-bind:value="value"
|
11
|
+
v-bind:placeholder="placeholder"
|
12
|
+
style="resize: none;"
|
13
|
+
class="w-100 border-0"
|
14
|
+
></textarea>
|
15
|
+
</div>
|
16
|
+
</template>
|
17
|
+
|
18
|
+
<script>
|
19
|
+
export default {
|
20
|
+
data () {
|
21
|
+
return {
|
22
|
+
focus: false
|
23
|
+
};
|
24
|
+
},
|
25
|
+
props: {
|
26
|
+
value: {
|
27
|
+
type: String,
|
28
|
+
default: null
|
29
|
+
},
|
30
|
+
placeholder: {
|
31
|
+
type: String,
|
32
|
+
default: null
|
33
|
+
}
|
34
|
+
},
|
35
|
+
computed: {
|
36
|
+
classes () {
|
37
|
+
return {
|
38
|
+
'mg-textarea': true,
|
39
|
+
'mg-textarea--disabled': this.disabled,
|
40
|
+
'mg-textarea--errored': this.error === true,
|
41
|
+
'mg-textarea--focused': this.focus === true,
|
42
|
+
};
|
43
|
+
}
|
44
|
+
},
|
45
|
+
methods: {
|
46
|
+
propagateFocus () {
|
47
|
+
this.focus = true;
|
48
|
+
this.$emit('focus');
|
49
|
+
},
|
50
|
+
propagateBlur () {
|
51
|
+
this.focus = false;
|
52
|
+
this.$emit('blur');
|
53
|
+
}
|
54
|
+
}
|
55
|
+
};
|
56
|
+
</script>
|
57
|
+
|
58
|
+
|
59
|
+
<style lang="scss">
|
60
|
+
@import '../../../../assets/palette';
|
61
|
+
|
62
|
+
.mg-textarea {
|
63
|
+
border: 1px solid #c2c2c2;
|
64
|
+
|
65
|
+
> textarea {
|
66
|
+
font-family: 'Raleway', sans-serif;
|
67
|
+
font-weight: 400;
|
68
|
+
font-size: 0.875rem;
|
69
|
+
height: 4.6875rem;
|
70
|
+
|
71
|
+
&:focus {
|
72
|
+
outline: 0;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
&--focused {
|
77
|
+
border-color: #444444 !important;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
</style>
|