@farm-investimentos/front-mfe-components 11.7.2 → 11.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/front-mfe-components.common.js +531 -133
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +531 -133
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AlertBox/AlertBox.scss +45 -0
- package/src/components/AlertBox/AlertBox.stories.js +30 -1
- package/src/components/AlertBox/AlertBox.vue +66 -9
- package/src/components/DialogHeader/DialogHeader.scss +7 -1
- package/src/components/Form/Form.stories.js +35 -1
- package/src/components/Form/Form.vue +1 -1
- package/src/components/Icon/Icon.scss +27 -20
- package/src/components/Icon/Icon.stories.js +26 -0
- package/src/components/Icon/Icon.vue +6 -0
- package/src/components/Modal/Modal.scss +0 -6
- package/src/components/Select/Select.scss +13 -0
- package/src/components/Select/Select.stories.js +142 -0
- package/src/components/Select/Select.vue +229 -0
- package/src/components/Select/__tests__/Select.spec.js +35 -0
- package/src/components/Select/index.ts +4 -0
- package/src/components/TextFieldV2/TextFieldV2.stories.js +1 -1
- package/src/main.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@import '../../configurations/theme-colors';
|
|
2
|
+
|
|
3
|
+
.farm-alert-box {
|
|
4
|
+
background-color: themeColor('primary', 'lighten');
|
|
5
|
+
border-radius: 5px;
|
|
6
|
+
color: themeColor('primary', 'darken');
|
|
7
|
+
display: flex;
|
|
8
|
+
padding: 8px 16px;
|
|
9
|
+
position: relative;
|
|
10
|
+
min-height: 40px;
|
|
11
|
+
|
|
12
|
+
&__content {
|
|
13
|
+
flex: 1;
|
|
14
|
+
|
|
15
|
+
&--with-dismissable {
|
|
16
|
+
margin-right: 40px;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__icon {
|
|
21
|
+
align-items: center;
|
|
22
|
+
display: flex;
|
|
23
|
+
margin-right: 16px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&__close {
|
|
27
|
+
position: absolute;
|
|
28
|
+
right: 8px;
|
|
29
|
+
bottom: 50%;
|
|
30
|
+
transform: translateY(50%);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&--dense {
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.fade-enter-active,
|
|
39
|
+
.fade-leave-active {
|
|
40
|
+
transition: opacity 0.3s;
|
|
41
|
+
}
|
|
42
|
+
.fade-enter,
|
|
43
|
+
.fade-leave-to {
|
|
44
|
+
opacity: 0;
|
|
45
|
+
}
|
|
@@ -18,4 +18,33 @@ export default {
|
|
|
18
18
|
|
|
19
19
|
export const Primary = () => ({
|
|
20
20
|
template: '<farm-alertbox>alert box</farm-alertbox>',
|
|
21
|
-
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const withIcon = () => ({
|
|
24
|
+
template: '<farm-alertbox icon="book">alert box</farm-alertbox>',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const withDismissable = () => ({
|
|
28
|
+
template: '<farm-alertbox dismissable>alert box</farm-alertbox>',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const dense = () => ({
|
|
32
|
+
template: '<farm-alertbox dismissable dense>alert box</farm-alertbox>',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const full = () => ({
|
|
36
|
+
template: '<farm-alertbox icon="book" dismissable>alert box</farm-alertbox>',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const moreThanOneLine = () => ({
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
text: `lorem ipsu lorem ipsu lorem ipsu lorem ipsu
|
|
43
|
+
lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu
|
|
44
|
+
lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu
|
|
45
|
+
lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu
|
|
46
|
+
lorem ipsu lorem ipsu lorem ipsu`,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
template: '<farm-alertbox icon="book" dismissable>{{text}}</farm-alertbox>',
|
|
50
|
+
});
|
|
@@ -1,19 +1,76 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
<transition name="fade">
|
|
3
|
+
<div v-if="visible" :class="{ 'farm-alert-box': true, 'farm-alert-box--dense': dense }">
|
|
4
|
+
<farm-icon
|
|
5
|
+
v-if="icon"
|
|
6
|
+
class="farm-alert-box__icon"
|
|
7
|
+
color="primary"
|
|
8
|
+
variation="darken"
|
|
9
|
+
size="md"
|
|
10
|
+
>{{ icon }}</farm-icon
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
:class="{
|
|
14
|
+
'farm-alert-box__content': true,
|
|
15
|
+
'farm-alert-box__content--with-dismissable': dismissable,
|
|
16
|
+
}"
|
|
17
|
+
>
|
|
18
|
+
<farm-bodytext
|
|
19
|
+
:type="1"
|
|
20
|
+
variation="regular"
|
|
21
|
+
color="primary"
|
|
22
|
+
color-variation="darken"
|
|
23
|
+
>
|
|
24
|
+
<slot></slot>
|
|
25
|
+
</farm-bodytext>
|
|
26
|
+
</div>
|
|
27
|
+
<farm-btn class="farm-alert-box__close" v-if="dismissable" icon size="md">
|
|
28
|
+
<farm-icon color="primary" variation="darken" size="md">close</farm-icon>
|
|
29
|
+
</farm-btn>
|
|
30
|
+
</div>
|
|
31
|
+
</transition>
|
|
8
32
|
</template>
|
|
9
33
|
|
|
10
34
|
<script lang="ts">
|
|
11
|
-
import Vue from 'vue';
|
|
35
|
+
import Vue, { ref } from 'vue';
|
|
12
36
|
|
|
13
37
|
export default Vue.extend({
|
|
14
38
|
name: 'farm-alertbox',
|
|
15
|
-
props: {
|
|
16
|
-
|
|
39
|
+
props: {
|
|
40
|
+
/**
|
|
41
|
+
* Left Icon?
|
|
42
|
+
*/
|
|
43
|
+
icon: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: null,
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Close icon and option to close AlertBox?
|
|
49
|
+
*/
|
|
50
|
+
dismissable: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Dense?
|
|
56
|
+
*/
|
|
57
|
+
dense: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
setup() {
|
|
63
|
+
const visible = ref(true);
|
|
64
|
+
|
|
65
|
+
function close() {
|
|
66
|
+
visible.value = false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
visible,
|
|
71
|
+
close,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
17
74
|
});
|
|
18
75
|
</script>
|
|
19
76
|
<style lang="scss" scoped>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
header {
|
|
15
15
|
font-size: 12px;
|
|
16
|
-
padding: 16px;
|
|
16
|
+
padding: 6px 16px;
|
|
17
17
|
background-color: #fff;
|
|
18
18
|
font-weight: 700;
|
|
19
19
|
color: var(--farm-primary-base);
|
|
@@ -21,4 +21,10 @@ header {
|
|
|
21
21
|
display: flex;
|
|
22
22
|
justify-content: flex-start;
|
|
23
23
|
align-items: center;
|
|
24
|
+
|
|
25
|
+
>.farm-typography.farm-caption {
|
|
26
|
+
align-items: center;
|
|
27
|
+
width: 100%;
|
|
28
|
+
margin-bottom: 0;
|
|
29
|
+
}
|
|
24
30
|
}
|
|
@@ -296,4 +296,38 @@ export const MigrateTextVieldV2 = () => ({
|
|
|
296
296
|
form: {{ form }}
|
|
297
297
|
</farm-form>
|
|
298
298
|
`,
|
|
299
|
-
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
export const MigrateSelectV2 = () => ({
|
|
302
|
+
data() {
|
|
303
|
+
return {
|
|
304
|
+
form: {
|
|
305
|
+
document: '',
|
|
306
|
+
},
|
|
307
|
+
validForm: false,
|
|
308
|
+
rules: {
|
|
309
|
+
required: value => !!value || 'Campo obrigatório',
|
|
310
|
+
},
|
|
311
|
+
items: [
|
|
312
|
+
{ value: null, text: '' },
|
|
313
|
+
{ value: 1, text: 'label 1' },
|
|
314
|
+
{ value: 2, text: 'label 2' },
|
|
315
|
+
],
|
|
316
|
+
styles,
|
|
317
|
+
};
|
|
318
|
+
},
|
|
319
|
+
template: `
|
|
320
|
+
<farm-form v-model="validForm" :style="[styles.vForm]" ref="form">
|
|
321
|
+
<div>
|
|
322
|
+
<farm-label :required="true">Documento</farm-label>
|
|
323
|
+
<farm-select v-model="form.document" :items="items" :rules="[rules.required]" />
|
|
324
|
+
</div>
|
|
325
|
+
|
|
326
|
+
<div class="footer" :style="[styles.footer]">
|
|
327
|
+
<farm-btn outlined @click="$refs.form.reset()" class="mr-3">Reset</farm-btn>
|
|
328
|
+
<farm-btn :disabled="!validForm">Salvar</farm-btn>
|
|
329
|
+
</div>
|
|
330
|
+
form: {{ form }}
|
|
331
|
+
</farm-form>
|
|
332
|
+
`,
|
|
333
|
+
});
|
|
@@ -7,6 +7,7 @@ import Vue, { onMounted, reactive, ref, getCurrentInstance } from 'vue';
|
|
|
7
7
|
type ErrorsBag = Record<number, boolean>;
|
|
8
8
|
|
|
9
9
|
export default Vue.extend({
|
|
10
|
+
name: 'farm-form',
|
|
10
11
|
props: {
|
|
11
12
|
value: { type: [Boolean] },
|
|
12
13
|
},
|
|
@@ -27,7 +28,6 @@ export default Vue.extend({
|
|
|
27
28
|
field.$watch(
|
|
28
29
|
'hasError',
|
|
29
30
|
() => {
|
|
30
|
-
console.log(field.valid);
|
|
31
31
|
errorsBag[field._uid] = field.valid;
|
|
32
32
|
dispatchError();
|
|
33
33
|
},
|
|
@@ -2,25 +2,32 @@
|
|
|
2
2
|
@import '../../configurations/theme-colors';
|
|
3
3
|
|
|
4
4
|
.farm-icon {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
align-items: center;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
font-size: 24px;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
letter-spacing: normal;
|
|
10
|
+
line-height: 1;
|
|
11
|
+
position: relative;
|
|
12
|
+
text-indent: 0;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
14
|
+
@each $color in $theme-colors-list {
|
|
15
|
+
&#{'--' + $color} {
|
|
16
|
+
color: var(--farm-#{$color}-base);
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
18
|
+
&.farm-icon--lighten {
|
|
19
|
+
color: var(--farm-#{$color}-lighten);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.farm-icon--darken {
|
|
23
|
+
color: var(--farm-#{$color}-darken);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@each $size, $value in $sizes {
|
|
29
|
+
&#{'.farm-icon[size=' + $size + ']'} {
|
|
30
|
+
font-size: $value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -44,6 +44,32 @@ export const Colors = () => ({
|
|
|
44
44
|
</div>`,
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
export const ColorsLighten = () => ({
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
colors: [...colors],
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
template: `<div class="icons-container">
|
|
54
|
+
<farm-icon v-for="color of colors":key="color" :color="color" variation="lighten">
|
|
55
|
+
book
|
|
56
|
+
</farm-icon>
|
|
57
|
+
</div>`,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const ColorsDarken = () => ({
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
colors: [...colors],
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
template: `<div class="icons-container">
|
|
67
|
+
<farm-icon v-for="color of colors":key="color" :color="color" variation="darken">
|
|
68
|
+
book
|
|
69
|
+
</farm-icon>
|
|
70
|
+
</div>`,
|
|
71
|
+
});
|
|
72
|
+
|
|
47
73
|
export const Sizes = () => ({
|
|
48
74
|
data() {
|
|
49
75
|
return {
|
|
@@ -36,6 +36,10 @@ export default Vue.extend({
|
|
|
36
36
|
>,
|
|
37
37
|
default: 'default',
|
|
38
38
|
},
|
|
39
|
+
variation: {
|
|
40
|
+
type: String as PropType<'lighten' | 'base' | 'darken'>,
|
|
41
|
+
default: 'base',
|
|
42
|
+
},
|
|
39
43
|
},
|
|
40
44
|
|
|
41
45
|
data() {
|
|
@@ -52,6 +56,8 @@ export default Vue.extend({
|
|
|
52
56
|
['farm-icon--' + this.color]: true,
|
|
53
57
|
mdi: true,
|
|
54
58
|
['mdi-' + this.icon]: true,
|
|
59
|
+
'farm-icon--lighten': this.variation === 'lighten',
|
|
60
|
+
'farm-icon--darken': this.variation === 'darken',
|
|
55
61
|
...obj,
|
|
56
62
|
};
|
|
57
63
|
},
|
|
@@ -34,20 +34,14 @@
|
|
|
34
34
|
|
|
35
35
|
&--content {
|
|
36
36
|
max-height: calc(100vh - 48px);
|
|
37
|
-
//overflow-y: auto;
|
|
38
37
|
width: 100%;
|
|
39
38
|
padding: 0;
|
|
40
|
-
|
|
41
39
|
>div {
|
|
42
|
-
//max-height: calc(100vh - 176px);
|
|
43
|
-
//max-height: calc(100vh - 64px);
|
|
44
40
|
overflow-y: auto;
|
|
45
41
|
padding: 0 16px;
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
|
|
51
45
|
&--header {
|
|
52
46
|
position: absolute;
|
|
53
47
|
top: 0;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
import Select from './Select.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Form/SelectV2',
|
|
6
|
+
component: Select,
|
|
7
|
+
decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `Select<br />
|
|
12
|
+
selector: <em>farm-select</em><br />
|
|
13
|
+
<span style="color: var(--farm-extra-1-base);">development</span>
|
|
14
|
+
`,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
design: {
|
|
18
|
+
type: 'figma',
|
|
19
|
+
url: 'https://www.figma.com/file/jnZXo2e0nRJ3fVXl4Et8t4/%E2%9C%8D-Design-System-%7C-BACKUP-(10%2F10%2F2022)?node-id=2491%3A4487',
|
|
20
|
+
},
|
|
21
|
+
viewMode: 'docs',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Primary = () => ({
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
v: null,
|
|
29
|
+
items: [
|
|
30
|
+
{ value: 1, text: ' value 1' },
|
|
31
|
+
{ value: 2, text: ' value 2' },
|
|
32
|
+
{ value: 3, text: ' value 3' },
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
template: `<div style="width: 480px">
|
|
37
|
+
<farm-select v-model="v" :items="items" />
|
|
38
|
+
v-model: {{ v }}
|
|
39
|
+
</div>`,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const InitialValue = () => ({
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
v: 1,
|
|
46
|
+
items: [
|
|
47
|
+
{ value: 1, text: ' value 1' },
|
|
48
|
+
{ value: 2, text: ' value 2' },
|
|
49
|
+
{ value: 3, text: ' value 3' },
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
template: `<div style="width: 480px">
|
|
54
|
+
<farm-select v-model="v" :items="items" />
|
|
55
|
+
v-model: {{ v }}
|
|
56
|
+
</div>`,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const Readonly = () => ({
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
v: 1,
|
|
63
|
+
items: [
|
|
64
|
+
{ value: 1, text: ' value 1' },
|
|
65
|
+
{ value: 2, text: ' value 2' },
|
|
66
|
+
{ value: 3, text: ' value 3' },
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
template: `<div style="width: 480px">
|
|
71
|
+
<farm-select v-model="v" :items="items" readonly />
|
|
72
|
+
v-model: {{ v }}
|
|
73
|
+
</div>`,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const Disabled = () => ({
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
v: 1,
|
|
80
|
+
items: [
|
|
81
|
+
{ value: 1, text: ' value 1' },
|
|
82
|
+
{ value: 2, text: ' value 2' },
|
|
83
|
+
{ value: 3, text: ' value 3' },
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
template: `<div style="width: 480px">
|
|
88
|
+
<farm-select v-model="v" :items="items" disabled />
|
|
89
|
+
v-model: {{ v }}
|
|
90
|
+
</div>`,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const Validate = () => ({
|
|
94
|
+
data() {
|
|
95
|
+
return {
|
|
96
|
+
v: null,
|
|
97
|
+
items: [
|
|
98
|
+
{ value: null, text: '' },
|
|
99
|
+
{ value: 1, text: ' value 1' },
|
|
100
|
+
{ value: 2, text: ' value 2' },
|
|
101
|
+
{ value: 3, text: ' value 3' },
|
|
102
|
+
],
|
|
103
|
+
rules: {
|
|
104
|
+
required: value => !!value || 'Required field',
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
template: `<div style="width: 480px">
|
|
109
|
+
<farm-label required>Required</farm-label>
|
|
110
|
+
<farm-select v-model="v" :items="items" :rules="[rules.required]" />
|
|
111
|
+
v-model: {{ v }}
|
|
112
|
+
</div>`,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
export const Reset = () => ({
|
|
117
|
+
data() {
|
|
118
|
+
return {
|
|
119
|
+
v: 1,
|
|
120
|
+
items: [
|
|
121
|
+
{ value: 1, text: ' value 1' },
|
|
122
|
+
{ value: 2, text: ' value 2' },
|
|
123
|
+
{ value: 3, text: ' value 3' },
|
|
124
|
+
],
|
|
125
|
+
rules: {
|
|
126
|
+
required: value => !!value || 'Required field',
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
methods: {
|
|
131
|
+
click() {
|
|
132
|
+
this.$refs.select.reset();
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
template: `<div style="width: 480px">
|
|
136
|
+
<farm-select v-model="v" :items="items" ref="select" :rules="[rules.required]" />
|
|
137
|
+
v-model: {{ v }}
|
|
138
|
+
<farm-btn @click="click">
|
|
139
|
+
reset
|
|
140
|
+
</farm-btn>
|
|
141
|
+
</div>`,
|
|
142
|
+
});
|