@magicgol/polyjuice 0.40.6 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/components/components/alert-square/AlertSquare.stories.js +40 -0
- package/src/components/components/alert-square/AlertSquare.vue +70 -0
- package/src/components/form/input/textarea/Textarea.stories.js +23 -0
- package/src/components/form/input/textarea/Textarea.vue +81 -0
package/package.json
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
import MgAlertSquare from './AlertSquare.vue';
|
2
|
+
|
3
|
+
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
|
4
|
+
export default {
|
5
|
+
title: 'Components/Alert Square',
|
6
|
+
component: MgAlertSquare,
|
7
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
8
|
+
argTypes: {
|
9
|
+
level: {
|
10
|
+
control: { type: 'select' },
|
11
|
+
options: ['error', 'warning', 'success', 'info'],
|
12
|
+
defaultValue: 'error'
|
13
|
+
},
|
14
|
+
default: {
|
15
|
+
description: "The default Vue slot",
|
16
|
+
control: {
|
17
|
+
type: 'text',
|
18
|
+
},
|
19
|
+
table: {
|
20
|
+
category: 'Slots',
|
21
|
+
type: {
|
22
|
+
summary: 'html',
|
23
|
+
},
|
24
|
+
}
|
25
|
+
}
|
26
|
+
},
|
27
|
+
};
|
28
|
+
|
29
|
+
// More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
|
30
|
+
const Template = (args, { argTypes }) => ({
|
31
|
+
props: Object.keys(argTypes),
|
32
|
+
components: { MgAlertSquare },
|
33
|
+
template: `<mg-alert-square v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-alert-square>`,
|
34
|
+
});
|
35
|
+
|
36
|
+
export const Default = Template.bind({});
|
37
|
+
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
38
|
+
Default.args = {
|
39
|
+
default: 'testo in evidenza',
|
40
|
+
};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
:class="classes"
|
4
|
+
class="p-2"
|
5
|
+
>
|
6
|
+
<slot></slot>
|
7
|
+
</div>
|
8
|
+
</template>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
export default {
|
12
|
+
name: 'mg-alert-square',
|
13
|
+
|
14
|
+
props: {
|
15
|
+
level: {
|
16
|
+
type: String,
|
17
|
+
default: 'warning',
|
18
|
+
validator: function (value) {
|
19
|
+
return ['error', 'warning', 'success', 'info'].indexOf(value) !== -1;
|
20
|
+
},
|
21
|
+
}
|
22
|
+
},
|
23
|
+
|
24
|
+
computed: {
|
25
|
+
classes() {
|
26
|
+
return {
|
27
|
+
'mg-alert-square': true,
|
28
|
+
'mg-alert-square--level-error': this.level === 'error',
|
29
|
+
'mg-alert-square--level-warning': this.level === 'warning',
|
30
|
+
'mg-alert-square--level-success': this.level === 'success',
|
31
|
+
'mg-alert-square--level-info': this.level === 'info',
|
32
|
+
};
|
33
|
+
}
|
34
|
+
},
|
35
|
+
};
|
36
|
+
</script>
|
37
|
+
|
38
|
+
<style lang="scss">
|
39
|
+
@import '../../../assets/palette';
|
40
|
+
|
41
|
+
.mg-alert-square {
|
42
|
+
border-radius: 8px;
|
43
|
+
font-family: Ubuntu, sans-serif;
|
44
|
+
font-size: 0.875rem;
|
45
|
+
font-weight: 700;
|
46
|
+
text-align: center;
|
47
|
+
|
48
|
+
&--level {
|
49
|
+
&-error {
|
50
|
+
background-color: rgba(map-get($palette, 'error'), 0.05);
|
51
|
+
color: map-get($palette, 'error');
|
52
|
+
}
|
53
|
+
|
54
|
+
&-warning {
|
55
|
+
background-color: rgba(map-get($palette, 'warning'), 0.05);
|
56
|
+
color: map-get($palette, 'warning');
|
57
|
+
}
|
58
|
+
|
59
|
+
&-success {
|
60
|
+
background-color: rgba(map-get($palette, 'success'), 0.05);
|
61
|
+
color: map-get($palette, 'success');
|
62
|
+
}
|
63
|
+
|
64
|
+
&-info {
|
65
|
+
background-color: rgba(map-get($palette, 'info'), 0.05);
|
66
|
+
color: map-get($palette, 'info');
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
</style>
|
@@ -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,81 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
:class="classes"
|
4
|
+
class="border 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
|
+
console.log('propage focus')
|
48
|
+
this.focus = true;
|
49
|
+
this.$emit('focus');
|
50
|
+
},
|
51
|
+
propagateBlur () {
|
52
|
+
this.focus = false;
|
53
|
+
this.$emit('blur');
|
54
|
+
}
|
55
|
+
}
|
56
|
+
};
|
57
|
+
</script>
|
58
|
+
|
59
|
+
|
60
|
+
<style lang="scss">
|
61
|
+
@import '../../../../assets/palette';
|
62
|
+
|
63
|
+
.mg-textarea {
|
64
|
+
border-color: #c2c2c2;
|
65
|
+
|
66
|
+
> textarea {
|
67
|
+
font-family: 'Raleway', sans-serif;
|
68
|
+
font-weight: 400;
|
69
|
+
font-size: 0.875rem;
|
70
|
+
height: 4.6875rem;
|
71
|
+
|
72
|
+
&:focus {
|
73
|
+
outline: 0;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
&--focused {
|
78
|
+
border-color: #444444 !important;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
</style>
|