@farm-investimentos/front-mfe-components 5.2.2 → 6.1.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 +450 -3806
- 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 +450 -3806
- 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/RadioButton/RadioButton.scss +11 -0
- package/src/components/RadioButton/RadioButton.stories.js +52 -0
- package/src/components/RadioButton/RadioButton.vue +61 -0
- package/src/components/RadioButton/__tests__/RadioButton.spec.js +20 -0
- package/src/components/RadioButton/index.ts +3 -0
- package/src/components/Stepper/StepperHeader/StepperHeader.scss +15 -12
- package/src/components/Stepper/StepperHeader/StepperHeader.vue +7 -2
- package/src/components/Stepper/StepperHeader/__tests__/StepperHeader.spec.js +7 -0
- package/src/examples/Buttons.stories.js +27 -7
- package/src/examples/Buttons.stories.scss +10 -0
- package/src/examples/Stepper/StepperHeader.stories.js +21 -1
- package/src/scss/ButtonOverrides.scss +20 -3
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import RadioButton from './RadioButton.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'API/RadioButton',
|
|
5
|
+
component: RadioButton,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Primary = () => ({
|
|
9
|
+
components: { RadioButton },
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
value: null,
|
|
13
|
+
label: ['teste', 'teste']
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
template: `<div>
|
|
17
|
+
<RadioButton v-model="value" :labels="label">
|
|
18
|
+
</RadioButton>
|
|
19
|
+
</div>`,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const Secondary = () => ({
|
|
23
|
+
components: { RadioButton },
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
value: 2,
|
|
27
|
+
label: ['teste', 'teste', 'teste', 'teste']
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
template: `<div>
|
|
31
|
+
<RadioButton v-model="value" :labels="label">
|
|
32
|
+
</RadioButton>
|
|
33
|
+
</div>`,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const Tertiary = () => ({
|
|
37
|
+
components: { RadioButton },
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
value: 2,
|
|
41
|
+
label: ['teste', 'teste', 'teste', 'teste']
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
template: `<div>
|
|
45
|
+
<RadioButton v-model="value" isBlock :labels="label">
|
|
46
|
+
</RadioButton>
|
|
47
|
+
</div>`,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
Primary.storyName = 'Basic';
|
|
51
|
+
Secondary.storyName = 'Selected Horizontal';
|
|
52
|
+
Tertiary.storyName = 'Selected Vertical';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-radio-group v-model="selectedVal" :column="isBlock">
|
|
3
|
+
<v-radio
|
|
4
|
+
color="secondary"
|
|
5
|
+
v-for="(item, index) in labels"
|
|
6
|
+
:class="{ 'ml-3': isBlock, 'mr-3': isBlock }"
|
|
7
|
+
:key="index"
|
|
8
|
+
:label="item"
|
|
9
|
+
>
|
|
10
|
+
</v-radio>
|
|
11
|
+
</v-radio-group>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import Vue from 'vue';
|
|
16
|
+
import { VRadioGroup, VRadio } from 'vuetify/lib/components/VRadioGroup';
|
|
17
|
+
|
|
18
|
+
export default Vue.extend({
|
|
19
|
+
name: 'farm-radio-button',
|
|
20
|
+
components: {
|
|
21
|
+
VRadioGroup,
|
|
22
|
+
VRadio,
|
|
23
|
+
},
|
|
24
|
+
props: {
|
|
25
|
+
/**
|
|
26
|
+
* Value to change with v-model, if has some value it'ill be the * initial selected value
|
|
27
|
+
* */
|
|
28
|
+
value: {
|
|
29
|
+
require: true,
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* Labels to show aside radio buttons
|
|
33
|
+
*/
|
|
34
|
+
labels: {
|
|
35
|
+
type: Array,
|
|
36
|
+
require: true,
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* To change if is vertical or horizontal view
|
|
40
|
+
*/
|
|
41
|
+
isBlock: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
computed: {
|
|
47
|
+
selectedVal: {
|
|
48
|
+
get() {
|
|
49
|
+
return this.value;
|
|
50
|
+
},
|
|
51
|
+
set(val) {
|
|
52
|
+
this.$emit('input', val);
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style lang="scss" scoped>
|
|
60
|
+
@import './RadioButton.scss';
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import RadioButton from '../RadioButton.vue';
|
|
3
|
+
|
|
4
|
+
describe('RadioButton component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(RadioButton, {
|
|
9
|
+
propsData: {
|
|
10
|
+
value: 2,
|
|
11
|
+
label: ['teste', 'teste', 'teste', 'teste'],
|
|
12
|
+
isBlock: true,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('Created hook', () => {
|
|
18
|
+
expect(wrapper).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -42,6 +42,12 @@ $step-height: 64px;
|
|
|
42
42
|
@include stepperHeaderStepColor(var(--v-error-base));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
&.stepper__header-step--next {
|
|
46
|
+
i.mdi {
|
|
47
|
+
color: var(--v-gray-lighten1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
span {
|
|
46
52
|
margin-top: 8px;
|
|
47
53
|
text-align: center;
|
|
@@ -110,19 +116,15 @@ $step-height: 64px;
|
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
&.stepper__divider--previous-to-current {
|
|
113
|
-
background: linear-gradient(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var(--v-accent-base)
|
|
117
|
-
);
|
|
119
|
+
background: linear-gradient(to bottom,
|
|
120
|
+
var(--v-secondary-base),
|
|
121
|
+
var(--v-accent-base));
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
&.stepper__divider--previous-to-error {
|
|
121
|
-
background: linear-gradient(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var(--v-error-base)
|
|
125
|
-
);
|
|
125
|
+
background: linear-gradient(to bottom,
|
|
126
|
+
var(--v-secondary-base),
|
|
127
|
+
var(--v-error-base));
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
}
|
|
@@ -133,14 +135,15 @@ i.mdi {
|
|
|
133
135
|
border-radius: 50%;
|
|
134
136
|
width: 32px;
|
|
135
137
|
height: 32px;
|
|
136
|
-
display: block;
|
|
137
138
|
|
|
138
139
|
display: flex;
|
|
139
140
|
align-items: center;
|
|
140
141
|
justify-content: center;
|
|
142
|
+
color: white;
|
|
143
|
+
font-style: normal;
|
|
141
144
|
|
|
142
145
|
&:before {
|
|
143
146
|
font-size: 16px;
|
|
144
147
|
color: var(--v-gray-lighten1);
|
|
145
148
|
}
|
|
146
|
-
}
|
|
149
|
+
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
'stepper__header-step--current': isStepCurrent(index),
|
|
9
9
|
'stepper__header-step--previous': isStepPrevious(index),
|
|
10
10
|
'stepper__header-step--error': isStepError(index),
|
|
11
|
+
'stepper__header-step--next': isStepNext(index),
|
|
11
12
|
}"
|
|
12
13
|
:key="step.label"
|
|
13
14
|
>
|
|
@@ -16,8 +17,9 @@
|
|
|
16
17
|
mdi: true,
|
|
17
18
|
['mdi-' + step.icon]: true,
|
|
18
19
|
}"
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
>
|
|
21
|
+
{{ step.icon ? '' : index + 1 }}
|
|
22
|
+
</i>
|
|
21
23
|
<span>
|
|
22
24
|
{{ step.label }}
|
|
23
25
|
</span>
|
|
@@ -89,6 +91,9 @@ export default Vue.extend({
|
|
|
89
91
|
this.isStepError(index + 1)
|
|
90
92
|
);
|
|
91
93
|
},
|
|
94
|
+
isStepNext(index: number): boolean {
|
|
95
|
+
return index + 1 > this.currentStep;
|
|
96
|
+
},
|
|
92
97
|
},
|
|
93
98
|
});
|
|
94
99
|
</script>
|
|
@@ -43,5 +43,12 @@ describe('StepperHeader component', () => {
|
|
|
43
43
|
expect(component.hasDivider(4)).toBeFalsy();
|
|
44
44
|
expect(component.hasDivider(1)).toBeTruthy();
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
it('Should check if step is next', () => {
|
|
48
|
+
expect(component.isStepNext(4)).toBeTruthy();
|
|
49
|
+
expect(component.isStepNext(1)).toBeFalsy();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
|
|
46
53
|
});
|
|
47
54
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { withDesign } from 'storybook-addon-designs';
|
|
2
2
|
import { DefaultButton } from '../main';
|
|
3
|
+
import('./Buttons.stories.scss');
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: 'Examples/Buttons',
|
|
@@ -14,7 +15,7 @@ export default {
|
|
|
14
15
|
},
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
const colors = ['primary', 'secondary', 'error', '
|
|
18
|
+
const colors = ['primary', 'secondary', 'error', 'gray', 'accent', 'yellow'];
|
|
18
19
|
|
|
19
20
|
export const ActiveButtons = () => ({
|
|
20
21
|
components: {
|
|
@@ -25,8 +26,8 @@ export const ActiveButtons = () => ({
|
|
|
25
26
|
colors,
|
|
26
27
|
};
|
|
27
28
|
},
|
|
28
|
-
template: `<div
|
|
29
|
-
<DefaultButton v-for="color of colors":key="color" :color="color"
|
|
29
|
+
template: `<div class="buttons-container">
|
|
30
|
+
<DefaultButton v-for="color of colors":key="color" :color="color">
|
|
30
31
|
{{ color }}
|
|
31
32
|
</DefaultButton>
|
|
32
33
|
</div>`,
|
|
@@ -41,8 +42,8 @@ export const OutlinedButtons = () => ({
|
|
|
41
42
|
colors,
|
|
42
43
|
};
|
|
43
44
|
},
|
|
44
|
-
template: `<div
|
|
45
|
-
<DefaultButton v-for="color of colors":key="color" :color="color"
|
|
45
|
+
template: `<div class="buttons-container">
|
|
46
|
+
<DefaultButton v-for="color of colors":key="color" :color="color"outlined>
|
|
46
47
|
{{ color }}
|
|
47
48
|
</DefaultButton>
|
|
48
49
|
</div>`,
|
|
@@ -57,8 +58,24 @@ export const DisabledButtons = () => ({
|
|
|
57
58
|
colors,
|
|
58
59
|
};
|
|
59
60
|
},
|
|
60
|
-
template: `<div
|
|
61
|
-
<DefaultButton v-for="color of colors":key="color" :color="color"
|
|
61
|
+
template: `<div class="buttons-container">
|
|
62
|
+
<DefaultButton v-for="color of colors":key="color" :color="color" disabled>
|
|
63
|
+
{{ color }}
|
|
64
|
+
</DefaultButton>
|
|
65
|
+
</div>`,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const Plain = () => ({
|
|
69
|
+
components: {
|
|
70
|
+
DefaultButton,
|
|
71
|
+
},
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
colors,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
template: `<div class="buttons-container">
|
|
78
|
+
<DefaultButton v-for="color of colors":key="color" :color="color" plain>
|
|
62
79
|
{{ color }}
|
|
63
80
|
</DefaultButton>
|
|
64
81
|
</div>`,
|
|
@@ -73,3 +90,6 @@ OutlinedButtons.story = {
|
|
|
73
90
|
DisabledButtons.story = {
|
|
74
91
|
name: 'Disabled',
|
|
75
92
|
};
|
|
93
|
+
Plain.story = {
|
|
94
|
+
name: 'Plain',
|
|
95
|
+
};
|
|
@@ -62,7 +62,24 @@ export const VerticalError = () => ({
|
|
|
62
62
|
currentStep: 3,
|
|
63
63
|
};
|
|
64
64
|
},
|
|
65
|
-
template:
|
|
65
|
+
template:
|
|
66
|
+
'<StepperHeader :steps="steps" :currentStep="currentStep" vertical :errorCurrentStepStatus="true" />',
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const Numbers = () => ({
|
|
70
|
+
components: { StepperHeader },
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
steps: [
|
|
74
|
+
{ label: 'Solicitação de limite' },
|
|
75
|
+
{ label: 'Lista impeditiva' },
|
|
76
|
+
{ label: 'Lista pré-elegíveis' },
|
|
77
|
+
{ label: 'Fila de compliance' },
|
|
78
|
+
],
|
|
79
|
+
currentStep: 2,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
template: '<StepperHeader :steps="steps" :currentStep="currentStep" />',
|
|
66
83
|
});
|
|
67
84
|
|
|
68
85
|
Primary.story = {
|
|
@@ -77,3 +94,6 @@ Error.story = {
|
|
|
77
94
|
VerticalError.story = {
|
|
78
95
|
name: 'Vertical Error',
|
|
79
96
|
};
|
|
97
|
+
Numbers.story = {
|
|
98
|
+
name: 'Numbers',
|
|
99
|
+
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
1
|
.v-btn {
|
|
3
|
-
|
|
2
|
+
|
|
4
3
|
.v-btn__content {
|
|
5
4
|
text-transform: none;
|
|
6
5
|
letter-spacing: 0;
|
|
7
6
|
font-weight: 700;
|
|
8
7
|
}
|
|
8
|
+
|
|
9
9
|
&.v-size--default {
|
|
10
10
|
font-size: 0.75rem !important;
|
|
11
|
+
|
|
11
12
|
.v-icon {
|
|
12
13
|
font-size: 1rem;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
16
|
+
|
|
15
17
|
&.v-btn-outlined-noborder {
|
|
16
18
|
border: 0;
|
|
17
19
|
}
|
|
@@ -31,19 +33,34 @@
|
|
|
31
33
|
&:hover {
|
|
32
34
|
opacity: 0.8;
|
|
33
35
|
}
|
|
36
|
+
|
|
34
37
|
&:before {
|
|
35
38
|
opacity: 0 !important;
|
|
36
39
|
}
|
|
40
|
+
|
|
37
41
|
.v-ripple__container {
|
|
38
42
|
opacity: 0 !important;
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
|
|
47
|
+
.v-btn--plain {
|
|
48
|
+
&:not(.v-btn--active):not(.v-btn--loading):not(:focus):not(:hover) {
|
|
49
|
+
.v-btn__content {
|
|
50
|
+
opacity: 1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
&:hover {
|
|
54
|
+
opacity: 0.62;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
43
59
|
@media screen and (max-width: 600px) {
|
|
60
|
+
|
|
44
61
|
.v-btn.v-btn-responsive,
|
|
45
62
|
.v-btn.v-btn--responsive {
|
|
46
63
|
width: 100%;
|
|
47
64
|
margin: 0;
|
|
48
65
|
}
|
|
49
|
-
}
|
|
66
|
+
}
|