@farm-investimentos/front-mfe-components 5.1.0 → 5.2.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 +289 -34
- 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 +289 -34
- 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/Logger/Logger.scss +19 -0
- package/src/components/Logger/Logger.stories.js +28 -0
- package/src/components/Logger/Logger.vue +28 -0
- package/src/components/Logger/LoggerItem/ILoggerItem.ts +9 -0
- package/src/components/Logger/LoggerItem/LoggerItem.scss +71 -0
- package/src/components/Logger/LoggerItem/LoggerItem.stories.js +34 -0
- package/src/components/Logger/LoggerItem/LoggerItem.vue +53 -0
- package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +53 -0
- package/src/components/Logger/LoggerItem/index.ts +4 -0
- package/src/components/Logger/__tests__/Logger.spec.js +26 -0
- package/src/components/Logger/index.ts +4 -0
- package/src/components/Stepper/StepperHeader/StepperHeader.scss +0 -2
- package/src/examples/Logger/Logger.stories.js +47 -0
- package/src/examples/Logger/LoggerItem.stories.js +81 -0
- package/src/main.ts +4 -0
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
$fore-color: #858585;
|
|
2
|
+
|
|
3
|
+
.logger {
|
|
4
|
+
display: block;
|
|
5
|
+
|
|
6
|
+
.logger__item {
|
|
7
|
+
float: left;
|
|
8
|
+
clear: both;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.logger__divider {
|
|
13
|
+
float: left;
|
|
14
|
+
clear: both;
|
|
15
|
+
height: 40px;
|
|
16
|
+
margin: -4px 0 -4px 16px;
|
|
17
|
+
width: 1px;
|
|
18
|
+
background-color: $fore-color;
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Logger from './Logger.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'API/Logger',
|
|
5
|
+
component: Logger,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Logger<br />
|
|
10
|
+
selector: <em>farm-logger</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Primary = () => ({
|
|
19
|
+
components: { Logger },
|
|
20
|
+
data() {
|
|
21
|
+
return {};
|
|
22
|
+
},
|
|
23
|
+
template: `<Logger>
|
|
24
|
+
|
|
25
|
+
</Logger>`,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
Primary.storyName = 'Básico';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="logger">
|
|
3
|
+
<template v-for="(item, index) in items">
|
|
4
|
+
<LoggerItem :item="item" :key="index" />
|
|
5
|
+
<div v-if="hasDivider(index)" class="logger__divider" :key="'divider_' + index">
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
</section>
|
|
9
|
+
</template>
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import Vue, { PropType } from 'vue';
|
|
12
|
+
import ILoggerItem from './LoggerItem/ILoggerItem';
|
|
13
|
+
import LoggerItem from './LoggerItem/';
|
|
14
|
+
|
|
15
|
+
export default Vue.extend({
|
|
16
|
+
name: 'farm-logger',
|
|
17
|
+
components: { LoggerItem },
|
|
18
|
+
props: { items: { required: true, type: Array as PropType<Array<ILoggerItem>> } },
|
|
19
|
+
methods: {
|
|
20
|
+
hasDivider(index: number): boolean {
|
|
21
|
+
return index < this.items.length - 1;
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
<style lang="sass" scoped>
|
|
27
|
+
@import './Logger.scss'
|
|
28
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
$line-color : #D6D6D6;
|
|
2
|
+
$fore-color: #858585;
|
|
3
|
+
$current-color: #5089DE;
|
|
4
|
+
$success-color: #00B493;
|
|
5
|
+
$error-color: #EA5455;
|
|
6
|
+
|
|
7
|
+
@mixin loggerMessage($color) {
|
|
8
|
+
>i.mdi {
|
|
9
|
+
border-color: $color;
|
|
10
|
+
background-color: $color;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.logger__message {
|
|
14
|
+
color: $color;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.logger__item {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
height: 64px;
|
|
22
|
+
align-items: center;
|
|
23
|
+
|
|
24
|
+
>div {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
padding-left: 8px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.logger__item--error {
|
|
31
|
+
@include loggerMessage($error-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.logger__item--success {
|
|
35
|
+
@include loggerMessage($success-color);
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
.logger__item>i.mdi {
|
|
43
|
+
border: 1px solid $line-color;
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
width: 32px;
|
|
46
|
+
height: 32px;
|
|
47
|
+
display: block;
|
|
48
|
+
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
|
|
53
|
+
border-color: $fore-color;
|
|
54
|
+
background-color: $fore-color;
|
|
55
|
+
|
|
56
|
+
&:before {
|
|
57
|
+
font-size: 16px;
|
|
58
|
+
color: white;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.logger__date,
|
|
63
|
+
.logger__username {
|
|
64
|
+
font-size: 10px;
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.logger__message {
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
font-weight: 700;
|
|
71
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import LoggerItem from './LoggerItem.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'API/Logger/LoggerItem',
|
|
5
|
+
component: LoggerItem,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `LoggerItem<br />
|
|
10
|
+
selector: <em>farm-logger-item</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Primary = () => ({
|
|
19
|
+
components: { LoggerItem },
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
item: {
|
|
23
|
+
icon: 'book',
|
|
24
|
+
message: 'Recusado entre as pré elegíveis',
|
|
25
|
+
userName: 'Cleyton Rasta',
|
|
26
|
+
formattedDate: '13/06/2022 20:40',
|
|
27
|
+
status: 'error',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
template: `<LoggerItem :item="item" />`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
Primary.storyName = 'Básico';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section
|
|
3
|
+
class="logger__item"
|
|
4
|
+
:class="{
|
|
5
|
+
'logger__item--error': item.status === 'error',
|
|
6
|
+
'logger__item--success': item.status === 'success',
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<i
|
|
10
|
+
:class="{
|
|
11
|
+
mdi: true,
|
|
12
|
+
[mdiIconName]: true,
|
|
13
|
+
}"
|
|
14
|
+
/>
|
|
15
|
+
<div>
|
|
16
|
+
<span class="logger__date">
|
|
17
|
+
{{ item.formattedDate }}
|
|
18
|
+
</span>
|
|
19
|
+
<span class="logger__message">
|
|
20
|
+
{{ item.message }}
|
|
21
|
+
</span>
|
|
22
|
+
<span class="logger__username">
|
|
23
|
+
<i class="mdi mdi-account-circle" />
|
|
24
|
+
{{ item.userName }}
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
</section>
|
|
28
|
+
</template>
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import Vue, { PropType } from 'vue';
|
|
31
|
+
import ILoggerItem from './ILoggerItem';
|
|
32
|
+
|
|
33
|
+
export default Vue.extend({
|
|
34
|
+
name: 'farm-logger-item',
|
|
35
|
+
props: {
|
|
36
|
+
item: { required: true, type: Object as PropType<ILoggerItem> },
|
|
37
|
+
},
|
|
38
|
+
computed: {
|
|
39
|
+
mdiIconName() {
|
|
40
|
+
if (this.item.icon) {
|
|
41
|
+
return `mdi-${this.item.icon}`;
|
|
42
|
+
}
|
|
43
|
+
if(!this.item.status) {
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
return `mdi-${this.item.status === 'success' ? 'check' : 'close'}`;
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
<style lang="sass" scoped>
|
|
52
|
+
@import './LoggerItem.scss'
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import LoggerItem from '../LoggerItem';
|
|
3
|
+
|
|
4
|
+
describe('LoggerItem component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(LoggerItem, {
|
|
10
|
+
propsData: {
|
|
11
|
+
item: {},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
component = wrapper.vm;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('LoggerItem created', () => {
|
|
18
|
+
expect(wrapper).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('Computed properties', () => {
|
|
22
|
+
it('Should return custom icon', async () => {
|
|
23
|
+
await wrapper.setProps({
|
|
24
|
+
item: {
|
|
25
|
+
message: 'Recusado entre as pré elegíveis',
|
|
26
|
+
userName: 'Cleyton Rasta',
|
|
27
|
+
formattedDate: '13/06/2022 20:40',
|
|
28
|
+
icon: 'aaa',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
expect(component.mdiIconName).toEqual('mdi-aaa');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('Should return success icon', async () => {
|
|
35
|
+
await wrapper.setProps({
|
|
36
|
+
item: {
|
|
37
|
+
status: 'success',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
expect(component.mdiIconName).toEqual('mdi-check');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('Should return success icon', async () => {
|
|
44
|
+
await wrapper.setProps({
|
|
45
|
+
item: {
|
|
46
|
+
status: 'error',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
expect(component.mdiIconName).toEqual('mdi-close');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import Logger from '../Logger';
|
|
3
|
+
|
|
4
|
+
describe('Logger component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(Logger, {
|
|
9
|
+
propsData: {
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
icon: 'book',
|
|
13
|
+
message: 'Recusado entre as pré elegíveis',
|
|
14
|
+
userName: 'Cleyton Rasta',
|
|
15
|
+
formattedDate: '13/06/2022 20:40',
|
|
16
|
+
status: 'error',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('Logger created', () => {
|
|
24
|
+
expect(wrapper).toBeDefined();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Logger } from '../../main';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Examples/Logger/Logger',
|
|
5
|
+
component: Logger,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Logger<br />
|
|
10
|
+
selector: <em>farm-logger</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Primary = () => ({
|
|
19
|
+
components: { Logger },
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
items: [
|
|
23
|
+
{
|
|
24
|
+
message: 'Recusado entre as pré elegíveis',
|
|
25
|
+
userName: 'Cleyton Rasta',
|
|
26
|
+
formattedDate: '13/06/2022 20:40',
|
|
27
|
+
status: 'error',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
message: 'Aprovado entre as pré elegíveis',
|
|
31
|
+
userName: 'Cleyton Rasta',
|
|
32
|
+
formattedDate: '13/06/2022 20:40',
|
|
33
|
+
status: 'success',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
message: 'Aprovado entre as pré elegíveis',
|
|
37
|
+
userName: 'Cleyton Rasta',
|
|
38
|
+
formattedDate: '13/06/2022 20:40',
|
|
39
|
+
status: 'success',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
template: `<Logger :items="items" />`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
Primary.storyName = 'Básico';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LoggerItem } from '../../main';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Examples/Logger/LoggerItem',
|
|
5
|
+
component: LoggerItem,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `LoggerItem<br />
|
|
10
|
+
selector: <em>farm-logger-item</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Primary = () => ({
|
|
19
|
+
components: { LoggerItem },
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
item: {
|
|
23
|
+
message: 'Recusado entre as pré elegíveis',
|
|
24
|
+
userName: 'Cleyton Rasta',
|
|
25
|
+
formattedDate: '13/06/2022 20:40',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
template: `<LoggerItem :item="item" />`,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Success = () => ({
|
|
33
|
+
components: { LoggerItem },
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
item: {
|
|
37
|
+
message: 'Recusado entre as pré elegíveis',
|
|
38
|
+
userName: 'Cleyton Rasta',
|
|
39
|
+
formattedDate: '13/06/2022 20:40',
|
|
40
|
+
status: 'success',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
template: `<LoggerItem :item="item" />`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Error = () => ({
|
|
48
|
+
components: { LoggerItem },
|
|
49
|
+
data() {
|
|
50
|
+
return {
|
|
51
|
+
item: {
|
|
52
|
+
message: 'Recusado entre as pré elegíveis',
|
|
53
|
+
userName: 'Cleyton Rasta',
|
|
54
|
+
formattedDate: '13/06/2022 20:40',
|
|
55
|
+
status: 'error',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
template: `<LoggerItem :item="item" />`,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const CustomIcon = () => ({
|
|
63
|
+
components: { LoggerItem },
|
|
64
|
+
data() {
|
|
65
|
+
return {
|
|
66
|
+
item: {
|
|
67
|
+
icon: 'book',
|
|
68
|
+
message: 'Recusado entre as pré elegíveis',
|
|
69
|
+
userName: 'Cleyton Rasta',
|
|
70
|
+
formattedDate: '13/06/2022 20:40',
|
|
71
|
+
status: 'success',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
template: `<LoggerItem :item="item" />`,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
Primary.storyName = 'Basic';
|
|
79
|
+
Success.storyName = 'Success';
|
|
80
|
+
Error.storyName = 'Error';
|
|
81
|
+
CustomIcon.storyName = 'Custom Icon';
|
package/src/main.ts
CHANGED
|
@@ -21,6 +21,7 @@ import IconBox from './components/IconBox';
|
|
|
21
21
|
import CardContext from './components/CardContext';
|
|
22
22
|
|
|
23
23
|
import DefaultButton from './components/Buttons/DefaultButton';
|
|
24
|
+
import Collapsible from './components/Collapsible';
|
|
24
25
|
|
|
25
26
|
export {
|
|
26
27
|
DataTableEmptyWrapper,
|
|
@@ -43,6 +44,7 @@ export {
|
|
|
43
44
|
DefaultButton,
|
|
44
45
|
IconBox,
|
|
45
46
|
CardContext,
|
|
47
|
+
Collapsible,
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
export * from './components/Buttons/DefaultButton';
|
|
@@ -60,3 +62,5 @@ export * from './components/MultipleSelectShortener';
|
|
|
60
62
|
export * from './components/SelectModalOptions';
|
|
61
63
|
export * from './components/ChipInviteStatus';
|
|
62
64
|
export * from './components/Stepper';
|
|
65
|
+
export * from './components/Logger';
|
|
66
|
+
export * from './components/Logger/LoggerItem';
|