@farm-investimentos/front-mfe-components 9.1.2 → 9.2.2
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 +300 -155
- 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 +300 -155
- 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/ButtonToggle/ButtonToggle.scss +14 -0
- package/src/components/ButtonToggle/ButtonToggle.stories.js +49 -0
- package/src/components/ButtonToggle/ButtonToggle.vue +52 -0
- package/src/components/ButtonToggle/IButtonToggle.ts +5 -0
- package/src/components/ButtonToggle/__tests__/ButtonToggle.spec.js +18 -0
- package/src/components/ButtonToggle/index.ts +4 -0
- package/src/components/DataTablePaginator/DataTablePaginator.scss +5 -1
- package/src/components/DataTablePaginator/DataTablePaginator.vue +10 -3
- package/src/components/Icon/Icon.scss +1 -1
- package/src/components/Icon/Icon.stories.js +28 -14
- package/src/components/Icon/Icons.stories.scss +17 -0
- package/src/components/Icon/icons_list.ts +2566 -0
- package/src/components/Logger/Logger.stories.js +55 -0
- package/src/components/Logger/LoggerItem/ILoggerItem.ts +1 -0
- package/src/components/Logger/LoggerItem/LoggerItem.stories.js +40 -0
- package/src/components/Logger/LoggerItem/LoggerItem.vue +27 -2
- package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +40 -0
- package/src/components/MultipleFilePicker/MultipleFilePicker.stories.js +35 -4
- package/src/components/MultipleFilePicker/MultipleFilePicker.vue +5 -14
- package/src/examples/Modal.stories.js +0 -1
- package/src/examples/Table.stories.js +2 -0
- package/src/main.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import ButtonToggle from './ButtonToggle.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Interactions/Button Toggle',
|
|
5
|
+
component: ButtonToggle,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Button Toggle<br />
|
|
10
|
+
selector: <em>farm-button-toggle</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
design: {
|
|
15
|
+
type: 'figma',
|
|
16
|
+
url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=3772%3A5973',
|
|
17
|
+
},
|
|
18
|
+
viewMode: 'docs',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Primary = () => ({
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
buttons: [{ label: 'label 1' }, { label: 'label 2' }, { label: 'label 3' }],
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
template: `
|
|
29
|
+
<div>
|
|
30
|
+
<farm-button-toggle :buttons="buttons" />
|
|
31
|
+
</div>`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const BindModel = () => ({
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
buttons: [{ label: 'label 1' }, { label: 'label 2' }, { label: 'label 3' }],
|
|
38
|
+
currentItem: 1,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
template: `
|
|
42
|
+
<div>
|
|
43
|
+
<farm-button-toggle
|
|
44
|
+
v-model="currentItem"
|
|
45
|
+
:buttons="buttons"
|
|
46
|
+
/>
|
|
47
|
+
selected item: {{ currentItem }}
|
|
48
|
+
</div>`,
|
|
49
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="farm-button-toggle">
|
|
3
|
+
<farm-btn
|
|
4
|
+
v-for="(button, index) in buttons"
|
|
5
|
+
:key="`button_toggle_` + index"
|
|
6
|
+
:color="isSelected(index) ? 'secondary' : 'gray'"
|
|
7
|
+
:outlined="!isSelected(index)"
|
|
8
|
+
@click="setValue(index)"
|
|
9
|
+
>
|
|
10
|
+
{{ button.label }}
|
|
11
|
+
</farm-btn>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import Vue, { PropType, ref } from 'vue';
|
|
16
|
+
import IButtonToggle from './IButtonToggle';
|
|
17
|
+
export default Vue.extend({
|
|
18
|
+
name: 'farm-button-toggle',
|
|
19
|
+
props: {
|
|
20
|
+
/**
|
|
21
|
+
* Array of buttons
|
|
22
|
+
*/
|
|
23
|
+
buttons: {
|
|
24
|
+
type: Array as PropType<Array<IButtonToggle>>,
|
|
25
|
+
default: () => [],
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* v-model binding
|
|
29
|
+
*/
|
|
30
|
+
value: { default: null },
|
|
31
|
+
},
|
|
32
|
+
setup(props, { emit }) {
|
|
33
|
+
const inputVal = ref(props.value);
|
|
34
|
+
|
|
35
|
+
const setValue = (index: number) => {
|
|
36
|
+
inputVal.value = index;
|
|
37
|
+
emit('input', inputVal.value);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const isSelected = (index: number) => index === inputVal.value;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
inputVal,
|
|
44
|
+
setValue,
|
|
45
|
+
isSelected,
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
<style lang="scss" scoped>
|
|
51
|
+
@import './ButtonToggle';
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import ButtonToggle from '../ButtonToggle.vue';
|
|
3
|
+
|
|
4
|
+
describe('ButtonToggle component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(ButtonToggle, {
|
|
9
|
+
propsData: {
|
|
10
|
+
buttons: [],
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('Created hook', () => {
|
|
16
|
+
expect(wrapper).toBeDefined();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -55,9 +55,13 @@ ul.farm-paginator {
|
|
|
55
55
|
display: flex;
|
|
56
56
|
flex-direction: row;
|
|
57
57
|
justify-content: space-between;
|
|
58
|
-
margin:
|
|
58
|
+
margin: 0;
|
|
59
59
|
|
|
60
60
|
&.hidden-perpageoptions {
|
|
61
61
|
justify-content: flex-end;
|
|
62
62
|
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.farm-paginator--gutter {
|
|
66
|
+
margin: 1rem 1.5rem 0;
|
|
63
67
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section
|
|
3
|
-
class="
|
|
4
|
-
|
|
3
|
+
:class="{
|
|
4
|
+
'v-data-table-custom-footer': true,
|
|
5
|
+
'hidden-perpageoptions': hidePerPageOptions,
|
|
6
|
+
'farm-paginator--gutter': hasGutter,
|
|
7
|
+
}"
|
|
5
8
|
>
|
|
6
9
|
<div v-if="!hidePerPageOptions">
|
|
7
10
|
<v-select
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
</li>
|
|
35
38
|
|
|
36
39
|
<li>
|
|
37
|
-
<button :disabled="currentPage === totalPages || disabled"
|
|
40
|
+
<button :disabled="currentPage === totalPages || disabled" @click="nextPage">
|
|
38
41
|
<farm-icon color="gray" size="sm">chevron-right</farm-icon>
|
|
39
42
|
</button>
|
|
40
43
|
</li>
|
|
@@ -89,6 +92,10 @@ export default Vue.extend({
|
|
|
89
92
|
type: Number,
|
|
90
93
|
default: 10,
|
|
91
94
|
},
|
|
95
|
+
hasGutter: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: true,
|
|
98
|
+
},
|
|
92
99
|
},
|
|
93
100
|
methods: {
|
|
94
101
|
range(from: number, to: number) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import Icon from './Icon';
|
|
3
2
|
import colors from '../../configurations/colors';
|
|
4
3
|
import sizes from '../../configurations/sizes';
|
|
4
|
+
import iconsList from './icons_list';
|
|
5
5
|
|
|
6
6
|
import('./Icons.stories.scss');
|
|
7
7
|
|
|
@@ -26,10 +26,7 @@ export const Atom = () => ({
|
|
|
26
26
|
</div>`,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
export const
|
|
30
|
-
components: {
|
|
31
|
-
'farm-icon': Icon,
|
|
32
|
-
},
|
|
29
|
+
export const Colors = () => ({
|
|
33
30
|
data() {
|
|
34
31
|
return {
|
|
35
32
|
colors,
|
|
@@ -43,9 +40,6 @@ export const Icons = () => ({
|
|
|
43
40
|
});
|
|
44
41
|
|
|
45
42
|
export const Sizes = () => ({
|
|
46
|
-
components: {
|
|
47
|
-
'farm-icon': Icon,
|
|
48
|
-
},
|
|
49
43
|
data() {
|
|
50
44
|
return {
|
|
51
45
|
sizes,
|
|
@@ -85,9 +79,29 @@ export const Sizes = () => ({
|
|
|
85
79
|
</div>`,
|
|
86
80
|
});
|
|
87
81
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
};
|
|
82
|
+
export const ListOfIcons = () => ({
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
iconsList: [...iconsList],
|
|
86
|
+
filterKey: '',
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
watch: {
|
|
90
|
+
filterKey(newValue) {
|
|
91
|
+
this.iconsList = [...iconsList].filter(
|
|
92
|
+
item => item.toLowerCase().indexOf(newValue.toLowerCase()) >= 0
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
template: `<div>
|
|
97
|
+
<farm-textfield v-model="filterKey" style="margin: 0 auto; width: 240px;" />
|
|
98
|
+
<div class="icons-container__list">
|
|
99
|
+
<div v-for="icon of iconsList" :key="'icon_' + icon">
|
|
100
|
+
<farm-icon>
|
|
101
|
+
{{ icon }}
|
|
102
|
+
</farm-icon>
|
|
103
|
+
<span>{{ icon }}</span>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>`,
|
|
107
|
+
});
|
|
@@ -11,4 +11,21 @@
|
|
|
11
11
|
margin-right: 1rem;
|
|
12
12
|
align-items: center;
|
|
13
13
|
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.icons-container__list {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
> div {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
width: 120px;
|
|
25
|
+
height: 100px;
|
|
26
|
+
text-align: center;
|
|
27
|
+
span {
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
14
31
|
}
|