@farm-investimentos/front-mfe-components 13.1.1 → 14.0.1
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 +8500 -8673
- 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 +8500 -8673
- 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/Select/Select.scss +7 -0
- package/src/components/Select/Select.stories.js +34 -0
- package/src/components/Select/Select.vue +30 -1
- package/src/components/TextArea/TextArea.scss +10 -5
- package/src/components/TextArea/TextArea.stories.js +12 -1
- package/src/components/TextArea/TextArea.vue +25 -1
- package/src/components/TextFieldV2/TextFieldV2.scss +6 -0
- package/src/components/TextFieldV2/TextFieldV2.stories.js +11 -0
- package/src/components/TextFieldV2/TextFieldV2.vue +20 -0
- package/src/components/Tooltip/Tooltip.stories.js +2 -2
- package/src/components/layout/Col/Col.scss +42 -2
- package/src/components/layout/Col/Col.stories.js +30 -23
- package/src/components/layout/Col/Col.vue +50 -0
- package/src/components/layout/ContainerFooter/Container.stories.js +5 -0
- package/src/components/layout/ContainerFooter/ContainerFooter.scss +10 -6
- package/src/components/layout/ContainerFooter/ContainerFooter.vue +12 -1
- package/src/configurations/_mixins.scss +68 -57
- package/src/main.ts +0 -2
- package/src/components/DefaultTextField/DefaultTextField.stories.js +0 -87
- package/src/components/DefaultTextField/DefaultTextField.vue +0 -111
- package/src/components/DefaultTextField/__tests__/DefaultTextField.spec.js +0 -54
- package/src/components/DefaultTextField/index.ts +0 -3
- package/src/examples/Form/Full.stories.js +0 -58
|
@@ -1,92 +1,103 @@
|
|
|
1
1
|
@mixin forXsOnly {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
@media (max-width: 599px) {
|
|
3
|
+
@content;
|
|
4
|
+
}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
@mixin upToSm {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
@media (max-width: 959px) {
|
|
9
|
+
@content;
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@mixin upToMd {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
@media (max-width: 1263px) {
|
|
15
|
+
@content;
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
@mixin fromXs {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
@media (min-width: 600px) {
|
|
21
|
+
@content;
|
|
22
|
+
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@mixin fromSm {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
@media (min-width: 960px) {
|
|
27
|
+
@content;
|
|
28
|
+
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@mixin fromMd {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
@media (min-width: 1264px) {
|
|
33
|
+
@content;
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@mixin fromLg {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
@media (min-width: 1904px) {
|
|
39
|
+
@content;
|
|
40
|
+
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@mixin addShadow {
|
|
44
|
-
|
|
44
|
+
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.16);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
@mixin buildCol($code) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
@for $i from 1 through 12 {
|
|
49
|
+
.farm-col--#{$code}-#{$i * 1} {
|
|
50
|
+
flex: 0 0 (100/12 * $i) +#{'%'};
|
|
51
|
+
max-width: (100/12 * $i) +#{'%'};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
@mixin rippleStyles {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
.farm-ripple {
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
position: absolute;
|
|
61
|
+
transition: all 0.4s;
|
|
62
|
+
z-index: 1;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
&:before {
|
|
65
|
+
transition: all 0.2s;
|
|
66
|
+
border-radius: inherit;
|
|
67
|
+
bottom: 0;
|
|
68
|
+
content: '';
|
|
69
|
+
position: absolute;
|
|
70
|
+
opacity: 0;
|
|
71
|
+
left: 0;
|
|
72
|
+
right: 0;
|
|
73
|
+
top: 0;
|
|
74
|
+
transform-origin: center center;
|
|
75
|
+
background-color: var(--farm-stroke-base);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
@mixin activateRipple {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
&:hover {
|
|
82
|
+
.farm-ripple:before {
|
|
83
|
+
opacity: 0.3;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
@mixin ellipsis {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@mixin hintText {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
visibility: hidden;
|
|
97
|
+
transition: opacity 0.3s;
|
|
98
|
+
|
|
99
|
+
&--show {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
visibility: visible;
|
|
102
|
+
}
|
|
103
|
+
}
|
package/src/main.ts
CHANGED
|
@@ -9,7 +9,6 @@ import MultipleFilePicker from './components/MultipleFilePicker';
|
|
|
9
9
|
import Tabs from './components/Tabs';
|
|
10
10
|
import DialogHeader from './components/DialogHeader';
|
|
11
11
|
import DialogFooter from './components/DialogFooter';
|
|
12
|
-
import DefaultTextField from './components/DefaultTextField';
|
|
13
12
|
import RangeDatePicker from './components/RangeDatePicker';
|
|
14
13
|
import DatePicker from './components/DatePicker';
|
|
15
14
|
import ManagersList from './components/ManagersList';
|
|
@@ -36,7 +35,6 @@ export {
|
|
|
36
35
|
Tabs,
|
|
37
36
|
DialogHeader,
|
|
38
37
|
DialogFooter,
|
|
39
|
-
DefaultTextField,
|
|
40
38
|
RangeDatePicker,
|
|
41
39
|
DatePicker,
|
|
42
40
|
ManagersList,
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import DefaultTextField from './DefaultTextField.vue';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Form/DefaultTextField',
|
|
6
|
-
component: DefaultTextField,
|
|
7
|
-
decorators: [withDesign],
|
|
8
|
-
parameters: {
|
|
9
|
-
viewMode: 'docs',
|
|
10
|
-
docs: {
|
|
11
|
-
description: {
|
|
12
|
-
component: `Default Text Field with label (inherit from Vuetify)<br />
|
|
13
|
-
selector: <em>farm-textfield-labelled</em>`,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const Primary = () => ({
|
|
20
|
-
components: { DefaultTextField },
|
|
21
|
-
data() {
|
|
22
|
-
return {
|
|
23
|
-
model: 'primary',
|
|
24
|
-
item: { label: 'Nome do campo', key: 'key', md: 4 },
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
template: '<DefaultTextField v-model="model" :item="item" />',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export const Secondary = () => ({
|
|
31
|
-
components: { DefaultTextField },
|
|
32
|
-
data() {
|
|
33
|
-
return {
|
|
34
|
-
model: 'secondary',
|
|
35
|
-
item: { label: 'Nome do campo', key: 'key', md: 4 },
|
|
36
|
-
rules: {
|
|
37
|
-
required: val => !!val,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
template: `<v-form>
|
|
42
|
-
<DefaultTextField :item="item" v-model="model" :required="true" :rules='[rules.required]' />
|
|
43
|
-
</v-form>`,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export const ReadOnly = () => ({
|
|
47
|
-
components: { DefaultTextField },
|
|
48
|
-
data() {
|
|
49
|
-
return {
|
|
50
|
-
model: 'readonly',
|
|
51
|
-
item: { label: 'Nome do campo', key: 'key', md: 4 },
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
template: '<DefaultTextField :item="item" v-model="model" :readonly="true" />',
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export const Masked = () => ({
|
|
58
|
-
components: { DefaultTextField },
|
|
59
|
-
data() {
|
|
60
|
-
return {
|
|
61
|
-
model: '12345',
|
|
62
|
-
item: { label: 'Máscara (##.###)', key: 'key', md: 4 },
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
template: `
|
|
66
|
-
<v-form>
|
|
67
|
-
<DefaultTextField :item="item" v-model="model" mask="##.###" />
|
|
68
|
-
</v-form>
|
|
69
|
-
`,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export const Placeholder = () => ({
|
|
73
|
-
components: { DefaultTextField },
|
|
74
|
-
data() {
|
|
75
|
-
return {
|
|
76
|
-
model: '',
|
|
77
|
-
item: { label: 'Nome do campo', key: 'key', md: 4 },
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
template: '<DefaultTextField v-model="model" :item="item" placeholder="your text" />',
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
Primary.storyName = 'Basic';
|
|
84
|
-
Secondary.storyName = 'Required field';
|
|
85
|
-
ReadOnly.storyName = 'Readonly input';
|
|
86
|
-
Masked.storyName = 'Masked';
|
|
87
|
-
Placeholder.storyName = 'Placeholder';
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-col cols="12" sm="12" :md="item.md ? item.md : 2" class="pl-0">
|
|
3
|
-
<farm-label :for="inputId" :required="required && !disabled">
|
|
4
|
-
{{ item.label }}
|
|
5
|
-
</farm-label>
|
|
6
|
-
<farm-textfield
|
|
7
|
-
v-model="inputVal"
|
|
8
|
-
v-mask="`${mask ? mask : ''}`"
|
|
9
|
-
:placeholder="placeholder"
|
|
10
|
-
:id="inputId"
|
|
11
|
-
:rules="inputRules"
|
|
12
|
-
:disabled="disabled"
|
|
13
|
-
:readonly="readonly"
|
|
14
|
-
/>
|
|
15
|
-
</v-col>
|
|
16
|
-
</template>
|
|
17
|
-
<script lang="ts">
|
|
18
|
-
import Vue from 'vue';
|
|
19
|
-
import Label from '../Label';
|
|
20
|
-
import TextField from '../TextField';
|
|
21
|
-
import { VCol } from 'vuetify/lib/components/VGrid';
|
|
22
|
-
|
|
23
|
-
export default Vue.extend({
|
|
24
|
-
name: 'farm-textfield-labelled',
|
|
25
|
-
components: {
|
|
26
|
-
'farm-label': Label,
|
|
27
|
-
'farm-textfield': TextField,
|
|
28
|
-
VCol,
|
|
29
|
-
},
|
|
30
|
-
props: {
|
|
31
|
-
item: {
|
|
32
|
-
type: Object,
|
|
33
|
-
required: true,
|
|
34
|
-
},
|
|
35
|
-
/**
|
|
36
|
-
* v-model
|
|
37
|
-
*/
|
|
38
|
-
value: {
|
|
39
|
-
required: true,
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* Array of rules
|
|
43
|
-
*/
|
|
44
|
-
rules: {
|
|
45
|
-
type: Array,
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Input is disabled or not
|
|
49
|
-
*/
|
|
50
|
-
disabled: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false,
|
|
53
|
-
},
|
|
54
|
-
forKey: {
|
|
55
|
-
type: String,
|
|
56
|
-
required: false,
|
|
57
|
-
default: 'form',
|
|
58
|
-
},
|
|
59
|
-
/**
|
|
60
|
-
* Input is required or not
|
|
61
|
-
*/
|
|
62
|
-
required: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: false,
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* Mask (v-mask)
|
|
68
|
-
*/
|
|
69
|
-
mask: {
|
|
70
|
-
type: String,
|
|
71
|
-
default: null,
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* Input is readonly or not
|
|
75
|
-
*/
|
|
76
|
-
readonly: {
|
|
77
|
-
type: Boolean,
|
|
78
|
-
default: false,
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* Placeholder is helper text for input
|
|
82
|
-
*/
|
|
83
|
-
placeholder: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: null,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
computed: {
|
|
89
|
-
inputVal: {
|
|
90
|
-
get() {
|
|
91
|
-
return this.value;
|
|
92
|
-
},
|
|
93
|
-
set(val) {
|
|
94
|
-
this.$emit('input', val);
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
inputRules() {
|
|
98
|
-
if (this.disabled) {
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
if (this.rules && this.rules.length) {
|
|
102
|
-
return this.rules;
|
|
103
|
-
}
|
|
104
|
-
return [];
|
|
105
|
-
},
|
|
106
|
-
inputId() {
|
|
107
|
-
return `${this.forKey}-${this.item.key}`;
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
</script>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import DefaultTextField from '../DefaultTextField';
|
|
3
|
-
|
|
4
|
-
describe('DefaultTextField component', () => {
|
|
5
|
-
let wrapper;
|
|
6
|
-
let component;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
wrapper = shallowMount(DefaultTextField, {
|
|
10
|
-
propsData: {
|
|
11
|
-
item: { key: 'key' },
|
|
12
|
-
value: false,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
component = wrapper.vm;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('Created hook', () => {
|
|
19
|
-
expect(wrapper).toBeDefined();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('mount component', () => {
|
|
23
|
-
it('renders correctly', () => {
|
|
24
|
-
expect(wrapper.element).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('Computed properties', () => {
|
|
29
|
-
it('Should have inputId', () => {
|
|
30
|
-
expect(component.inputId).toEqual('form-key');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('Should have default inputRules', () => {
|
|
34
|
-
expect(component.inputRules).toEqual([]);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('Should have inputRules from prop', async () => {
|
|
38
|
-
expect(component.inputRules).toEqual([]);
|
|
39
|
-
await wrapper.setProps({
|
|
40
|
-
rules: [jest.fn()],
|
|
41
|
-
});
|
|
42
|
-
expect(component.inputRules.length).toEqual(1);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('Should not have inputRules if disabled', async () => {
|
|
46
|
-
expect(component.inputRules).toEqual([]);
|
|
47
|
-
await wrapper.setProps({
|
|
48
|
-
rules: [jest.fn()],
|
|
49
|
-
disabled: true,
|
|
50
|
-
});
|
|
51
|
-
expect(component.inputRules.length).toEqual(0);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
title: 'Form/Examples',
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
export const Primary = () => ({
|
|
6
|
-
data() {
|
|
7
|
-
return {
|
|
8
|
-
form: {
|
|
9
|
-
document: 22055527835,
|
|
10
|
-
email: '',
|
|
11
|
-
name: '',
|
|
12
|
-
},
|
|
13
|
-
validForm: false,
|
|
14
|
-
rules: {
|
|
15
|
-
required: value => !!value || 'Campo obrigatório',
|
|
16
|
-
email: value =>
|
|
17
|
-
value === '' || value === null || emailValidator(value) || 'E-mail inválido',
|
|
18
|
-
},
|
|
19
|
-
styles: {
|
|
20
|
-
vForm: {
|
|
21
|
-
maxWidth: '480px',
|
|
22
|
-
},
|
|
23
|
-
footer: {
|
|
24
|
-
display: 'flex',
|
|
25
|
-
justifyContent: 'end',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
template: `
|
|
31
|
-
<v-form v-model="validForm" :style="[styles.vForm]">
|
|
32
|
-
<div>
|
|
33
|
-
<farm-label :required="true">Documento</farm-label>
|
|
34
|
-
<farm-textfield v-model="form.document" :rules="[rules.required]" />
|
|
35
|
-
</div>
|
|
36
|
-
<div>
|
|
37
|
-
<farm-label :required="true">E-mail</farm-label>
|
|
38
|
-
<farm-textfield v-model="form.email" :rules="[rules.required, rules.email]" />
|
|
39
|
-
</div>
|
|
40
|
-
<div>
|
|
41
|
-
<farm-label>Nome</farm-label>
|
|
42
|
-
<farm-textfield v-model="form.name" />
|
|
43
|
-
</div>
|
|
44
|
-
<div class="footer" :style="[styles.footer]">
|
|
45
|
-
<farm-btn color="secondary" :disabled="!validForm">Salvar</farm-btn>
|
|
46
|
-
</div>
|
|
47
|
-
</v-form>
|
|
48
|
-
`,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const emailValidator = value => {
|
|
52
|
-
if (!value) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
const pattern =
|
|
56
|
-
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
57
|
-
return pattern.test(value.trim()) || false;
|
|
58
|
-
};
|