@farm-investimentos/front-mfe-components 14.2.1 → 15.0.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 +4146 -5381
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +2 -2
- package/dist/front-mfe-components.umd.js +4146 -5381
- 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 +3 -2
- package/src/components/AlertBox/AlertBox.vue +2 -0
- package/src/components/Buttons/DefaultButton/DefaultButton.scss +57 -18
- package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +49 -16
- package/src/components/Buttons/DefaultButton/DefaultButton.vue +3 -1
- package/src/components/Buttons/ExportButton/ExportButton.vue +2 -1
- package/src/components/Card/Card.scss +1 -1
- package/src/components/Card/CardComposition.stories.ts +8 -2
- package/src/components/Card/CardContent/CardContent.scss +11 -0
- package/src/components/Card/CardContent/CardContent.stories.js +11 -0
- package/src/components/Card/CardContent/CardContent.vue +9 -1
- package/src/components/CardContext/__tests__/CardContext.spec.js +5 -2
- package/src/components/Checkbox/Checkbox.scss +2 -2
- package/src/components/Checkbox/Checkbox.vue +2 -1
- package/src/components/Chip/Chip.scss +15 -15
- package/src/components/Chip/Chip.stories.js +13 -13
- package/src/components/Chip/Chip.stories.scss +1 -16
- package/src/components/Chip/Chip.vue +25 -3
- package/src/components/Collapsible/Collapsible.scss +8 -3
- package/src/components/Collapsible/Collapsible.stories.js +68 -1
- package/src/components/Collapsible/Collapsible.vue +68 -8
- package/src/components/ContextMenu/ContextMenu.scss +1 -1
- package/src/components/ContextMenu/ContextMenu.stories.js +42 -29
- package/src/components/ContextMenu/ContextMenu.vue +20 -1
- package/src/components/CopyToClipboard/CopyToClipboard.stories.js +7 -1
- package/src/components/CopyToClipboard/CopyToClipboard.vue +15 -3
- package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.scss +6 -9
- package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.stories.js +4 -0
- package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.vue +21 -5
- package/src/components/{TextField/__tests__/TextField.spec.js → DataTableEmptyWrapper/__tests__/DataTableEmptyWrapper.spec.js} +3 -3
- package/src/components/DataTableHeader/DataTableHeader.scss +10 -12
- package/src/components/DataTableHeader/DataTableHeader.vue +5 -4
- package/src/components/DataTablePaginator/DataTablePaginator.scss +71 -69
- package/src/components/DatePicker/DatePicker.scss +5 -5
- package/src/components/DatePicker/DatePicker.vue +2 -3
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +1 -1
- package/src/components/DatePicker/vDatePicker.scss +214 -0
- package/src/components/DialogFooter/DialogFooter.scss +1 -1
- package/src/components/DialogFooter/DialogFooter.stories.js +2 -2
- package/src/components/DialogFooter/DialogFooter.vue +1 -1
- package/src/components/DialogHeader/DialogHeader.scss +2 -3
- package/src/components/DialogHeader/DialogHeader.vue +4 -4
- package/src/components/Form/Form.stories.js +1 -1
- package/src/components/Icon/Icon.scss +6 -0
- package/src/components/Icon/Icon.stories.js +19 -1
- package/src/components/Icon/Icon.vue +8 -2
- package/src/components/IconBox/IconBox.stories.js +16 -0
- package/src/components/IconBox/IconBox.vue +17 -7
- package/src/components/IdCaption/IdCaption.vue +27 -13
- package/src/components/Label/Label.scss +17 -5
- package/src/components/Label/Label.stories.js +0 -1
- package/src/components/ListItem/ListItem.scss +5 -3
- package/src/components/ListItem/ListItem.vue +2 -0
- package/src/components/Logger/LoggerItem/LoggerItem.scss +9 -1
- package/src/components/Logger/LoggerItem/LoggerItem.vue +25 -8
- package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +1 -1
- package/src/components/MainFilter/MainFilter.stories.js +4 -4
- package/src/components/Modal/Modal.scss +3 -3
- package/src/components/ModalPromptUser/ModalPromptUser.stories.js +26 -0
- package/src/components/ModalPromptUser/ModalPromptUser.vue +10 -0
- package/src/components/MultipleFilePicker/MultipleFilePicker.scss +19 -12
- package/src/components/MultipleFilePicker/MultipleFilePicker.stories.js +12 -0
- package/src/components/MultipleFilePicker/MultipleFilePicker.vue +18 -11
- package/src/components/MultipleFilePicker/__tests__/MultipleFilePicker.spec.js +9 -0
- package/src/components/ProgressBar/ProgressBar.vue +4 -0
- package/src/components/Radio/Radio.scss +18 -4
- package/src/components/Radio/Radio.stories.js +2 -1
- package/src/components/Radio/Radio.vue +3 -1
- package/src/components/RangeDatePicker/RangeDatePicker.vue +0 -2
- package/src/components/ResourceMetaInfo/ResourceMetaInfo.vue +8 -8
- package/src/components/Select/Select.scss +4 -0
- package/src/components/Select/Select.vue +9 -1
- package/src/components/Stepper/StepperHeader/StepperHeader.scss +7 -7
- package/src/components/Stepper/StepperHeader/StepperHeader.vue +35 -36
- package/src/components/Switcher/Switcher.scss +24 -8
- package/src/components/Switcher/Switcher.stories.js +33 -0
- package/src/components/Switcher/Switcher.vue +24 -3
- package/src/components/TableContextMenu/TableContextMenu.scss +4 -9
- package/src/components/TableContextMenu/TableContextMenu.stories.js +2 -0
- package/src/components/TableContextMenu/TableContextMenu.vue +5 -4
- package/src/components/Tabs/Tabs.scss +69 -0
- package/src/components/Tabs/Tabs.stories.js +51 -4
- package/src/components/Tabs/Tabs.vue +59 -32
- package/src/components/Tabs/__tests__/Tabs.spec.js +54 -54
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/TextArea/TextArea.scss +7 -3
- package/src/components/TextArea/TextArea.vue +1 -0
- package/src/components/TextFieldV2/TextFieldV2.scss +8 -4
- package/src/components/TextFieldV2/TextFieldV2.vue +1 -0
- package/src/components/Tooltip/Tooltip.scss +8 -10
- package/src/components/Tooltip/Tooltip.vue +4 -2
- package/src/components/Typography/BodyText/BodyText.scss +7 -7
- package/src/components/Typography/Caption/Caption.scss +7 -7
- package/src/components/Typography/Caption/Caption.stories.js +1 -1
- package/src/components/Typography/Caption/Caption.vue +4 -1
- package/src/components/Typography/Caption/configurations.ts +3 -2
- package/src/components/Typography/Heading/Heading.scss +19 -19
- package/src/components/Typography/Heading/configurations.ts +5 -5
- package/src/components/Typography/Small/Small.scss +3 -0
- package/src/components/Typography/Small/Small.stories.js +34 -0
- package/src/components/Typography/Small/Small.vue +47 -0
- package/src/components/Typography/Small/__tests__/Small.spec.js +31 -0
- package/src/components/Typography/Small/configurations.ts +7 -0
- package/src/components/Typography/Subtitle/Subtitle.scss +7 -7
- package/src/components/Typography/Typography.scss +10 -0
- package/src/components/Typography/Typography.stories.js +15 -2
- package/src/components/Typography/Typography.vue +6 -2
- package/src/components/Typography/index.ts +2 -1
- package/src/components/ValueCaption/ValueCaption.vue +2 -0
- package/src/components/layout/Line/Line.scss +15 -0
- package/src/components/layout/Line/Line.stories.js +28 -5
- package/src/components/layout/Line/Line.vue +37 -3
- package/src/configurations/_mixins.scss +1 -1
- package/src/configurations/_theme-colors-background.scss +10 -0
- package/src/configurations/_theme-colors-bw.scss +10 -0
- package/src/configurations/_theme-colors.scss +79 -48
- package/src/configurations/_variables.scss +2 -0
- package/src/examples/Colors.stories.js +39 -1
- package/src/examples/Colors.stories.scss +1 -1
- package/src/helpers/index.ts +2 -1
- package/src/helpers/isChildOfFixedElement.js +16 -0
- package/src/main.ts +1 -5
- package/src/scss/Sticky-table.scss +13 -7
- package/src/scss/VuejsDialog.scss +58 -51
- package/src/scss/cssVariablesGenerator.scss +17 -14
- package/src/scss/utils.scss +17 -251
- package/src/components/FilePicker/FilePicker.scss +0 -53
- package/src/components/FilePicker/FilePicker.stories.js +0 -14
- package/src/components/FilePicker/FilePicker.vue +0 -109
- package/src/components/FilePicker/__tests__/FilePicker.spec.js +0 -77
- package/src/components/FilePicker/index.ts +0 -3
- package/src/components/TextField/TextField.scss +0 -43
- package/src/components/TextField/TextField.stories.js +0 -104
- package/src/components/TextField/TextField.vue +0 -18
- package/src/components/TextField/index.ts +0 -4
- package/src/scss/ButtonOverrides.scss +0 -73
- package/src/scss/DefaultModal.scss +0 -89
- package/src/scss/DialogOverrides.scss +0 -94
- package/src/scss/FormOverrides.scss +0 -264
- package/src/scss/Status-Chip.scss +0 -34
|
@@ -1,32 +1,56 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
v-for="(tab, index) in tabs"
|
|
5
|
-
:key="index"
|
|
6
|
-
:class="{ hideCounter: !showCounter }"
|
|
7
|
-
@change="changeTab(tab, index)"
|
|
8
|
-
:disabled="!allowUserChange"
|
|
9
|
-
>
|
|
2
|
+
<div class="farm-tabs">
|
|
3
|
+
<div class="tabs" :class="{ 'tabs--disabled': !allowUserChange }">
|
|
10
4
|
<div
|
|
11
|
-
v-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
v-for="(tab, index) in tabs"
|
|
6
|
+
class="tabs__tab"
|
|
7
|
+
:key="index"
|
|
8
|
+
:class="{ hideCounter: !showCounter, 'tabs__tab--selected': isSelected(index) }"
|
|
9
|
+
@click="changeTab(tab, index)"
|
|
14
10
|
>
|
|
15
|
-
<
|
|
11
|
+
<div
|
|
12
|
+
v-if="showCounter"
|
|
13
|
+
class="
|
|
14
|
+
mr-2
|
|
15
|
+
rounded-circle
|
|
16
|
+
d-inline-flex
|
|
17
|
+
align-center
|
|
18
|
+
justify-center
|
|
19
|
+
white--text
|
|
20
|
+
"
|
|
21
|
+
:class="{ 'is-selected': isSelected(index) }"
|
|
22
|
+
>
|
|
23
|
+
<farm-subtitle
|
|
24
|
+
color="white"
|
|
25
|
+
tag="span"
|
|
26
|
+
:type="2"
|
|
27
|
+
:color-variation="isSelected(index) ? 'base' : 'darken'"
|
|
28
|
+
>
|
|
29
|
+
{{ index + 1 }}
|
|
30
|
+
</farm-subtitle>
|
|
31
|
+
</div>
|
|
32
|
+
<farm-subtitle
|
|
33
|
+
tag="span"
|
|
34
|
+
:type="2"
|
|
35
|
+
:color="isSelected(index) ? 'primary' : 'gray'"
|
|
36
|
+
:color-variation="isSelected(index) ? 'base' : 'darken'"
|
|
37
|
+
>
|
|
38
|
+
{{ forceUppercase ? tab.name.toUpperCase() : tab.name }}
|
|
39
|
+
</farm-subtitle>
|
|
16
40
|
</div>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</v-tabs>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
20
43
|
</template>
|
|
21
44
|
|
|
22
45
|
<script lang="ts">
|
|
23
46
|
import Vue from 'vue';
|
|
24
|
-
import { VTabs, VTab } from 'vuetify/lib/components/VTabs';
|
|
25
47
|
export default Vue.extend({
|
|
26
48
|
name: 'farm-tabs',
|
|
27
|
-
data
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
data() {
|
|
50
|
+
return {
|
|
51
|
+
selected: 0,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
30
54
|
props: {
|
|
31
55
|
tabs: {
|
|
32
56
|
type: Array,
|
|
@@ -45,6 +69,9 @@ export default Vue.extend({
|
|
|
45
69
|
type: Boolean,
|
|
46
70
|
default: true,
|
|
47
71
|
},
|
|
72
|
+
/**
|
|
73
|
+
* Initial tab selected
|
|
74
|
+
*/
|
|
48
75
|
initialSelect: {
|
|
49
76
|
type: Number,
|
|
50
77
|
default: 0,
|
|
@@ -53,19 +80,31 @@ export default Vue.extend({
|
|
|
53
80
|
type: Boolean,
|
|
54
81
|
default: true,
|
|
55
82
|
},
|
|
83
|
+
/**
|
|
84
|
+
* Force uppercase in tab
|
|
85
|
+
*/
|
|
86
|
+
forceUppercase: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: true,
|
|
89
|
+
},
|
|
56
90
|
},
|
|
57
91
|
methods: {
|
|
58
92
|
isSelected(index) {
|
|
59
93
|
return index === this.selected;
|
|
60
94
|
},
|
|
61
95
|
changeTab(_, index) {
|
|
96
|
+
if (!this.allowUserChange) return;
|
|
97
|
+
this.selected = index;
|
|
62
98
|
this.$emit('update', this.tabs[index]);
|
|
63
99
|
},
|
|
64
100
|
next() {
|
|
101
|
+
if (this.tabs.length - 1 > this.selected + 1)
|
|
102
|
+
return this.$emit('update', this.tabs[this.selected]);
|
|
65
103
|
this.selected = this.selected + 1;
|
|
66
104
|
this.$emit('update', this.tabs[this.selected]);
|
|
67
105
|
},
|
|
68
106
|
previous() {
|
|
107
|
+
if (this.selected - 1 < 0) return this.$emit('update', this.tabs[this.selected]);
|
|
69
108
|
this.selected = this.selected - 1;
|
|
70
109
|
this.$emit('update', this.tabs[this.selected]);
|
|
71
110
|
},
|
|
@@ -83,20 +122,8 @@ export default Vue.extend({
|
|
|
83
122
|
created() {
|
|
84
123
|
this.selected = this.initialSelect;
|
|
85
124
|
},
|
|
86
|
-
components: {
|
|
87
|
-
VTabs,
|
|
88
|
-
VTab,
|
|
89
|
-
},
|
|
90
125
|
});
|
|
91
126
|
</script>
|
|
92
127
|
<style scoped lang="scss">
|
|
93
|
-
|
|
94
|
-
background-color: var(--v-gray-lighten3);
|
|
95
|
-
&.is-selected {
|
|
96
|
-
background-color: var(--v-secondary-base);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
.v-tab--active.v-tab--disabled {
|
|
100
|
-
opacity: 1;
|
|
101
|
-
}
|
|
128
|
+
@import './Tabs.scss';
|
|
102
129
|
</style>
|
|
@@ -2,58 +2,58 @@ import { shallowMount } from '@vue/test-utils';
|
|
|
2
2
|
import Tabs from '../Tabs';
|
|
3
3
|
|
|
4
4
|
describe('Tabs component', () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(Tabs);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Created hook', () => {
|
|
12
|
+
expect(wrapper).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('methods', () => {
|
|
16
|
+
it('Should check isSelected', () => {
|
|
17
|
+
expect(wrapper.vm.isSelected(1)).toBeFalsy();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('Should emit event when tab is changed', () => {
|
|
21
|
+
wrapper.vm.changeTab();
|
|
22
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('Should emit event when next is triggeredx', () => {
|
|
26
|
+
wrapper.vm.next();
|
|
27
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('Should emit event when previous is triggered', () => {
|
|
31
|
+
wrapper.vm.previous();
|
|
32
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('Should emit event when toIndex is triggered', () => {
|
|
36
|
+
wrapper.vm.toIndex(1);
|
|
37
|
+
expect(wrapper.vm.selected).toEqual(1);
|
|
38
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('Should updateTab in parent and route', () => {
|
|
42
|
+
const _component = {
|
|
43
|
+
currentTab: '',
|
|
44
|
+
$router: {
|
|
45
|
+
history: {
|
|
46
|
+
current: {
|
|
47
|
+
path: 'some',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
push: () => {},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
const spyObj = jest.spyOn(_component.$router, 'push');
|
|
54
|
+
wrapper.vm.updateTabRouting(_component, { path: 'desembolso' }, 'nextRoutePrefix');
|
|
55
|
+
expect(_component.currentTab).toEqual('desembolso');
|
|
56
|
+
expect(spyObj).toHaveBeenCalled();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
59
|
});
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
gap: 8px;
|
|
14
14
|
border: 1px solid;
|
|
15
|
-
border-color: var(--farm-
|
|
15
|
+
border-color: var(--farm-bw-black-10);
|
|
16
16
|
min-height: 36px;
|
|
17
17
|
border-radius: 5px;
|
|
18
18
|
padding: 8px 0 0 8px;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
& > textarea {
|
|
24
24
|
flex: 1;
|
|
25
25
|
outline: none;
|
|
26
|
-
color: var(--farm-
|
|
26
|
+
color: var(--farm-bw-black-50);
|
|
27
27
|
font-size: 12px;
|
|
28
28
|
font-weight: 400;
|
|
29
29
|
max-width: 100%;
|
|
@@ -31,9 +31,13 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
&--focused .farm-textarea--textarea {
|
|
35
|
+
border-color: var(--farm-bw-black-30);
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
&--disabled {
|
|
35
39
|
textarea {
|
|
36
|
-
color: var(--farm-
|
|
40
|
+
color: var(--farm-bw-black-30);
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
gap: 8px;
|
|
14
14
|
border: 1px solid;
|
|
15
|
-
border-color: var(--farm-
|
|
15
|
+
border-color: var(--farm-bw-black-10);
|
|
16
16
|
height: 36px;
|
|
17
17
|
border-radius: 5px;
|
|
18
18
|
padding: 8px;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
& > input {
|
|
27
27
|
flex: 1;
|
|
28
28
|
outline: none;
|
|
29
|
-
color: var(--farm-
|
|
29
|
+
color: var(--farm-bw-black-50);
|
|
30
30
|
font-size: 12px;
|
|
31
31
|
font-weight: 400;
|
|
32
32
|
max-width: 100%;
|
|
@@ -39,12 +39,16 @@
|
|
|
39
39
|
width: 100%;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
&--focused .farm-textfield--input {
|
|
43
|
+
border-color: var(--farm-bw-black-30);
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
&--disabled {
|
|
43
47
|
input {
|
|
44
|
-
color: var(--farm-
|
|
48
|
+
color: var(--farm-bw-black-30);
|
|
45
49
|
}
|
|
46
50
|
.farm-icon {
|
|
47
|
-
color: var(--farm-
|
|
51
|
+
color: var(--farm-bw-black-30);
|
|
48
52
|
cursor: default;
|
|
49
53
|
}
|
|
50
54
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
'farm-textfield--touched': isTouched,
|
|
8
8
|
'farm-textfield--blured': isBlured,
|
|
9
9
|
'farm-textfield--error': hasError,
|
|
10
|
+
'farm-textfield--focused': isFocus && !readonly,
|
|
10
11
|
'farm-textfield--disabled': disabled,
|
|
11
12
|
'farm-textfield--hiddendetails': hideDetails,
|
|
12
13
|
'farm-textfield--uppercase': isUppercase,
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
.farm-tooltip__popup {
|
|
10
10
|
background-color: rgba(themeColor('primary'), 0.95);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
&.farm-tooltip--#{$color} {
|
|
15
|
-
background-color: rgba(themeColor($color), 0.95);
|
|
16
|
-
}
|
|
11
|
+
@each $color in $theme-colors-list {
|
|
12
|
+
&.farm-tooltip--#{$color} {
|
|
13
|
+
background-color: rgba(themeColor($color), 0.95);
|
|
17
14
|
}
|
|
18
15
|
}
|
|
16
|
+
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
.farm-tooltip__popup {
|
|
@@ -26,10 +24,10 @@
|
|
|
26
24
|
width: 160px;
|
|
27
25
|
contain: content;
|
|
28
26
|
color: white;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
font-
|
|
32
|
-
font-
|
|
27
|
+
border-radius: 5px;
|
|
28
|
+
font-family: 'Manrope', sans-serif !important;
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
font-weight: 500px;
|
|
33
31
|
padding: 8px 12px;
|
|
34
32
|
display: block;
|
|
35
33
|
|
|
@@ -33,16 +33,18 @@ export default Vue.extend({
|
|
|
33
33
|
type: String as PropType<
|
|
34
34
|
| 'primary'
|
|
35
35
|
| 'secondary'
|
|
36
|
+
| 'secondary-green'
|
|
37
|
+
| 'secondary-golden'
|
|
36
38
|
| 'neutral'
|
|
37
39
|
| 'info'
|
|
38
40
|
| 'success'
|
|
39
41
|
| 'error'
|
|
40
42
|
| 'warning'
|
|
41
|
-
| 'success'
|
|
42
43
|
| 'extra-1'
|
|
43
44
|
| 'extra-2'
|
|
45
|
+
| 'gray'
|
|
44
46
|
>,
|
|
45
|
-
default: '
|
|
47
|
+
default: 'gray',
|
|
46
48
|
},
|
|
47
49
|
/**
|
|
48
50
|
* Control visibility
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.farm-bodytext {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
&--1 {
|
|
3
|
+
letter-spacing: 0.5px;
|
|
4
|
+
}
|
|
5
|
+
&--2 {
|
|
6
|
+
letter-spacing: 0.5px;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.farm-subtitle {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
&--1 {
|
|
3
|
+
letter-spacing: 0.5px;
|
|
4
|
+
}
|
|
5
|
+
&--2 {
|
|
6
|
+
letter-spacing: 0.5px;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -22,7 +22,10 @@ export default Vue.extend({
|
|
|
22
22
|
/**
|
|
23
23
|
* Variation of the caption
|
|
24
24
|
*/
|
|
25
|
-
variation: {
|
|
25
|
+
variation: {
|
|
26
|
+
type: String as PropType<'regular' | 'medium' | 'semiBold'>,
|
|
27
|
+
default: 'medium',
|
|
28
|
+
},
|
|
26
29
|
},
|
|
27
30
|
setup(props) {
|
|
28
31
|
const { variation } = toRefs(props);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
.farm-heading-- {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
2
|
+
&h1 {
|
|
3
|
+
letter-spacing: 0.5px;
|
|
4
|
+
}
|
|
5
|
+
&h2 {
|
|
6
|
+
letter-spacing: 0.5px;
|
|
7
|
+
}
|
|
8
|
+
&h3 {
|
|
9
|
+
letter-spacing: 0.5px;
|
|
10
|
+
}
|
|
11
|
+
&h4 {
|
|
12
|
+
letter-spacing: 0.75px;
|
|
13
|
+
}
|
|
14
|
+
&h5 {
|
|
15
|
+
letter-spacing: 0.75px;
|
|
16
|
+
}
|
|
17
|
+
&h6 {
|
|
18
|
+
letter-spacing: 0.75px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const Keys = {
|
|
2
|
-
1: { weight:
|
|
3
|
-
2: { weight: 300, size: '
|
|
4
|
-
3: { weight:
|
|
5
|
-
4: { weight:
|
|
6
|
-
5: { weight:
|
|
2
|
+
1: { weight: 200, size: '60px' },
|
|
3
|
+
2: { weight: 300, size: '52px' },
|
|
4
|
+
3: { weight: 600, size: '44px' },
|
|
5
|
+
4: { weight: 500, size: '32px' },
|
|
6
|
+
5: { weight: 600, size: 'xl' },
|
|
7
7
|
6: { weight: 500, size: 'lg' },
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Small from './Small';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Typography/Small',
|
|
5
|
+
component: Small,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Small<br />
|
|
10
|
+
selector: <em>farm-bodysmall</em><br />
|
|
11
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
12
|
+
`,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
viewMode: 'docs',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Primary = () => ({
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
variations: ['regular', 'medium', 'bold'],
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
template: `<div >
|
|
26
|
+
<div v-for="variation in variations" :key="variation">
|
|
27
|
+
<farm-bodysmall :variation="variation">
|
|
28
|
+
Small {{ variation }}
|
|
29
|
+
</farm-bodysmall>
|
|
30
|
+
</div>
|
|
31
|
+
</div>`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
Primary.storyName = 'Basic';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<farm-typography
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
v-on="$listeners"
|
|
5
|
+
:weight="weight"
|
|
6
|
+
:size="size"
|
|
7
|
+
:key="key"
|
|
8
|
+
:class="{ 'farm-small': true, [`farm-small--${variation}`]: true }"
|
|
9
|
+
>
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</farm-typography>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import Vue, { computed, ref, watch, toRefs, PropType } from 'vue';
|
|
15
|
+
|
|
16
|
+
import { Keys } from './configurations';
|
|
17
|
+
|
|
18
|
+
export default Vue.extend({
|
|
19
|
+
inheritAttrs: true,
|
|
20
|
+
name: 'farm-bodysmall',
|
|
21
|
+
props: {
|
|
22
|
+
/**
|
|
23
|
+
* Variation of the small
|
|
24
|
+
*/
|
|
25
|
+
variation: { type: String as PropType<'regular' | 'medium' | 'bold'>, default: 'medium' },
|
|
26
|
+
},
|
|
27
|
+
setup(props) {
|
|
28
|
+
const { variation } = toRefs(props);
|
|
29
|
+
const key = ref(variation.value);
|
|
30
|
+
|
|
31
|
+
watch(
|
|
32
|
+
() => props,
|
|
33
|
+
() => {
|
|
34
|
+
key.value = variation.value;
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const config = computed(() => Keys[key.value]);
|
|
39
|
+
const weight = computed(() => config.value.weight);
|
|
40
|
+
const size = computed(() => config.value.size);
|
|
41
|
+
return { weight, size, key, variation };
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
<style lang="scss" scoped>
|
|
46
|
+
@import 'Small';
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import Small from '../Small.vue';
|
|
3
|
+
|
|
4
|
+
describe('Small component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(Small, {});
|
|
10
|
+
component = wrapper.vm;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('Created hook', () => {
|
|
14
|
+
expect(wrapper).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('mount component', () => {
|
|
18
|
+
it('renders correctly', () => {
|
|
19
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('Computed properties', () => {
|
|
24
|
+
it('Should return weight 500', async () => {
|
|
25
|
+
await wrapper.setProps({
|
|
26
|
+
variation: 'medium',
|
|
27
|
+
});
|
|
28
|
+
expect(component.weight).toEqual(500);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.farm-subtitle {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
&--1 {
|
|
3
|
+
letter-spacing: 0.5px;
|
|
4
|
+
}
|
|
5
|
+
&--2 {
|
|
6
|
+
letter-spacing: 0.5px;
|
|
7
|
+
}
|
|
8
|
+
}
|