@farm-investimentos/front-mfe-components 12.1.4 → 12.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.
@@ -0,0 +1,48 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import TextArea from '../TextArea';
3
+
4
+ describe('TextArea component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(TextArea);
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('methods', () => {
24
+ it('reset', () => {
25
+ component.reset();
26
+ expect(component.isTouched).toBeTruthy();
27
+ expect(component.innerValue).toEqual('');
28
+ });
29
+
30
+ it('onKeyUp', () => {
31
+ component.onKeyUp();
32
+ expect(component.isTouched).toBeTruthy();
33
+ });
34
+
35
+ it('onBlur', () => {
36
+ component.onBlur();
37
+ expect(component.isBlured).toBeTruthy();
38
+ });
39
+
40
+ it('makePristine', () => {
41
+ component.isTouched = true;
42
+ component.isBlured = true;
43
+ component.makePristine();
44
+ expect(component.isTouched).toBeFalsy();
45
+ expect(component.isBlured).toBeFalsy();
46
+ });
47
+ });
48
+ });
@@ -0,0 +1,4 @@
1
+ import TextArea from './TextArea.vue';
2
+
3
+ export { TextArea };
4
+ export default TextArea;
@@ -230,27 +230,3 @@ export const ToggleVisibility = () => ({
230
230
  <farm-textfield-v2 v-model="v" :type="visible ? 'text' : 'password'" :icon="visible ? 'eye-off' : 'eye'" @onClickIcon="toggle" />
231
231
  </div>`,
232
232
  });
233
-
234
-
235
- export const Compare = () => ({
236
- data() {
237
- return {
238
- v1: '',
239
- rules: {
240
- required: value => !!value || 'Required field',
241
- email: v =>
242
- !v ||
243
- /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) ||
244
- 'Must be an e-mail',
245
- },
246
- };
247
- },
248
- template: `<div style="width: 480px">
249
-
250
- <farm-label required>Required and e-mail</farm-label>
251
- <farm-textfield-v2 v-model="v1" :rules="[rules.required, rules.email]" />
252
-
253
- <farm-textfield v-model="v1" :rules="[rules.required, rules.email]" />
254
-
255
- </div>`,
256
- });
@@ -4,6 +4,7 @@
4
4
 
5
5
  .farm-typography {
6
6
  font-size: 16px;
7
+ color: var(--farm-text-primary);
7
8
 
8
9
  &[bold] {
9
10
  font-weight: bold;
@@ -25,16 +26,12 @@
25
26
  margin-bottom: auto;
26
27
  }
27
28
 
28
- color: var(--farm-text-primary);
29
-
30
29
  &--lighten {
31
30
  color: var(--farm-text-secondary);
32
31
  }
33
32
 
34
33
  &.farm-typography--ellipsis {
35
- overflow: hidden;
36
- white-space: nowrap;
37
- text-overflow: ellipsis;
34
+ @include ellipsis;
38
35
  }
39
36
 
40
37
  @each $k in $theme-colors-list {
@@ -76,10 +76,17 @@
76
76
  }
77
77
  }
78
78
  }
79
+
79
80
  @mixin activateRipple {
80
81
  &:hover {
81
82
  .farm-ripple:before {
82
83
  opacity: 0.3;
83
84
  }
84
85
  }
86
+ }
87
+
88
+ @mixin ellipsis {
89
+ white-space: nowrap;
90
+ overflow: hidden;
91
+ text-overflow: ellipsis;
85
92
  }
package/src/main.ts CHANGED
@@ -87,6 +87,7 @@ export * from './components/RadioGroup';
87
87
  export * from './components/Select';
88
88
  export * from './components/Stepper';
89
89
  export * from './components/Switcher';
90
+ export * from './components/TextArea';
90
91
  export * from './components/TextField';
91
92
  export * from './components/TextFieldV2';
92
93
  export * from './components/Tooltip';
@@ -1,42 +0,0 @@
1
- export default {
2
- title: 'Form/Textfield/Examples/Password',
3
- component: Password,
4
- parameters: {
5
- docs: {
6
- description: {
7
- component: `How to toggle password visivility.<br />
8
- - Password visibility: hidden -> eye on icon (the click/tap will show the password)
9
- - Password visibility: show -> eye off icon (the click/tap will hide the password)`,
10
- },
11
- },
12
- },
13
- };
14
-
15
- export const Password = () => ({
16
- data() {
17
- return {
18
- password: '',
19
- showHidden: false,
20
- };
21
- },
22
- template: `
23
- <v-col cols="12" sm="12" md="4" class="v-col-fieldset-default pl-0">
24
- <label>
25
- Toggle visibility from password field
26
- </label>
27
- <v-text-field
28
- color="secondary"
29
- dense
30
- outlined
31
- v-model="password"
32
- :append-icon="showHidden ? 'mdi-eye-off' : 'mdi-eye'"
33
- :type="showHidden ? 'text' : 'password'"
34
- @click:append="showHidden = !showHidden"
35
- />
36
- </v-col>
37
- `,
38
- });
39
-
40
- Password.story = {
41
- name: 'Básico',
42
- };
@@ -1,27 +0,0 @@
1
- export default {
2
- title: 'Form/Select/Examples',
3
- parameters: {
4
- docs: {
5
- description: {
6
- component: `How to show select (v-select)<br />
7
- `,
8
- },
9
- },
10
- },
11
- };
12
-
13
- export const VSelect = () => ({
14
- data() {
15
- return {
16
- items: ['SP', 'RJ', 'MG', 'RS', 'BA'],
17
- };
18
- },
19
- template: `
20
- <v-col cols="12" sm="6" md="2" class="v-col-fieldset-default pl-0">
21
- <v-select dense outlined :items="items" />
22
- </v-col>`,
23
- });
24
-
25
- VSelect.story = {
26
- name: 'Básico',
27
- };