@farm-investimentos/front-mfe-components 7.0.2 → 7.3.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.
Files changed (38) hide show
  1. package/dist/front-mfe-components.common.js +613 -286
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +1 -1
  4. package/dist/front-mfe-components.umd.js +613 -286
  5. package/dist/front-mfe-components.umd.js.map +1 -1
  6. package/dist/front-mfe-components.umd.min.js +1 -1
  7. package/dist/front-mfe-components.umd.min.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/Buttons/DefaultButton/DefaultButton.scss +26 -4
  10. package/src/components/Buttons/DefaultButton/DefaultButton.vue +34 -7
  11. package/src/components/ChipInviteStatus/ChipInviteStatus.vue +2 -0
  12. package/src/components/DefaultTextField/DefaultTextField.stories.js +4 -1
  13. package/src/components/DefaultTextField/DefaultTextField.vue +11 -13
  14. package/src/components/Icon/Icon.scss +4 -3
  15. package/src/components/Label/Label.scss +13 -0
  16. package/src/components/Label/Label.stories.js +38 -0
  17. package/src/components/Label/Label.vue +24 -0
  18. package/src/components/Label/__tests__/Label.spec.js +20 -0
  19. package/src/components/Label/index.ts +4 -0
  20. package/src/components/Loader/Loader.vue +40 -40
  21. package/src/components/ProgressBar/ProgressBar.scss +25 -0
  22. package/src/components/ProgressBar/ProgressBar.stories.js +43 -0
  23. package/src/components/ProgressBar/ProgressBar.vue +67 -0
  24. package/src/components/ProgressBar/__tests__/ProgressBar.spec.js +22 -0
  25. package/src/components/ProgressBar/index.ts +4 -0
  26. package/src/components/TextField/TextField.scss +51 -0
  27. package/src/components/TextField/TextField.stories.js +47 -0
  28. package/src/components/TextField/TextField.vue +18 -0
  29. package/src/components/TextField/__tests__/Label.spec.js +20 -0
  30. package/src/components/TextField/index.ts +4 -0
  31. package/src/examples/Buttons.stories.js +66 -11
  32. package/src/examples/Form/Full.stories.js +64 -0
  33. package/src/examples/Form/Label.stories.js +18 -0
  34. package/src/examples/Form/TextField.stories.js +47 -0
  35. package/src/examples/ProgressBar.stories.js +71 -0
  36. package/src/examples/inputs/Password.stories.js +1 -1
  37. package/src/examples/inputs/Select.stories.js +1 -1
  38. package/src/main.ts +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "7.0.2",
3
+ "version": "7.3.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -22,6 +22,13 @@
22
22
  min-width: 64px;
23
23
  padding: 0 16px;
24
24
 
25
+ @each $size,
26
+ $value in $sizes {
27
+ &#{'.farm-btn[size=' + $size +']'} {
28
+ font-size: $value;
29
+ }
30
+ }
31
+
25
32
 
26
33
  &.farm-btn--disabled {
27
34
  background-color: #DADADA;
@@ -97,6 +104,21 @@
97
104
  .farm-btn__content i.mdi {
98
105
  color: gray;
99
106
  }
107
+ @each $size,
108
+ $value in $sizes {
109
+ &#{'.farm-btn[size=' + $size +']'} {
110
+ font-size: $value;
111
+ }
112
+ }
113
+
114
+ &[size='lg'] {
115
+ width: 48px;
116
+ height: 48px;
117
+ }
118
+ &[size='xl'] {
119
+ width: 64px;
120
+ height: 64px;
121
+ }
100
122
 
101
123
  @each $color in $colors {
102
124
  &#{'.farm-btn--' + $color} {
@@ -133,12 +155,12 @@
133
155
  }
134
156
  }
135
157
 
136
- :not(.farm-btn--disabled){
158
+ :not(.farm-btn--disabled) {
137
159
  &.farm-btn--outlined#{'.farm-btn--' + $color} {
138
160
  border: 1px solid var(--v-#{$color}-base);
139
161
  background: white;
140
162
  color: var(--v-#{$color}-base);
141
-
163
+
142
164
  .farm-btn__content i.mdi {
143
165
  color: var(--v-#{$color}-base);
144
166
  }
@@ -148,14 +170,14 @@
148
170
  border: none;
149
171
  background: white;
150
172
  color: var(--v-#{$color}-base);
151
-
173
+
152
174
  .farm-btn__content i.mdi {
153
175
  color: var(--v-#{$color}-base);
154
176
  }
155
177
  }
156
178
  }
157
179
 
158
-
180
+
159
181
  }
160
182
 
161
183
  .farm-btn--elevated {
@@ -6,6 +6,7 @@
6
6
  :disabled="disabled"
7
7
  :type="type"
8
8
  :class="classes"
9
+ :size="$props.size"
9
10
  >
10
11
  <span class="farm-btn__content">
11
12
  <slot></slot>
@@ -18,19 +19,39 @@
18
19
  </router-link>
19
20
  </template>
20
21
  <script lang="ts">
21
- import Vue from 'vue';
22
+ import Vue, { PropType } from 'vue';
22
23
 
23
24
  export default Vue.extend({
24
25
  name: 'farm-btn',
25
26
  inheritAttrs: true,
26
27
 
27
28
  props: {
28
- color: { type: String, default: 'primary' },
29
- outlined: Boolean,
30
- plain: Boolean,
31
- disabled: Boolean,
32
- rounded: Boolean,
33
- icon: Boolean,
29
+ /**
30
+ * Color
31
+ */
32
+ color: {
33
+ type: String as PropType<
34
+ | 'primary'
35
+ | 'secondary'
36
+ | 'error'
37
+ | 'extra'
38
+ | 'accent'
39
+ | 'info'
40
+ | 'success'
41
+ | 'gray'
42
+ | 'yellow'
43
+ | 'white'
44
+ >,
45
+ default: 'primary',
46
+ },
47
+ /**
48
+ * Outlined
49
+ */
50
+ outlined: { type: Boolean, default: false },
51
+ plain: { type: Boolean, default: false },
52
+ disabled: { type: Boolean, default: false },
53
+ rounded: { type: Boolean, default: false },
54
+ icon: { type: Boolean, default: false },
34
55
  type: {
35
56
  type: String,
36
57
  default: 'button',
@@ -39,6 +60,12 @@ export default Vue.extend({
39
60
  type: String,
40
61
  default: null,
41
62
  },
63
+ size: {
64
+ type: String as PropType<
65
+ 'xs' | 'sm' | 'md' | 'lg' | 'xl'
66
+ >,
67
+ default: 'default',
68
+ },
42
69
  },
43
70
 
44
71
  computed: {
@@ -23,6 +23,7 @@ const StatusLabel = {
23
23
  15: 'EM ANÁLISE',
24
24
  16: 'EM ANDAMENTO',
25
25
  17: 'EM ESPERA',
26
+ 18: 'DECLINADO'
26
27
  };
27
28
 
28
29
  const StatusColor = {
@@ -34,6 +35,7 @@ const StatusColor = {
34
35
  15: 'accent',
35
36
  16: 'primary',
36
37
  17: 'on-wait',
38
+ 18: 'error',
37
39
  };
38
40
 
39
41
  import VChip from 'vuetify/lib/components/VChip/';
@@ -33,10 +33,13 @@ export const Secondary = () => ({
33
33
  return {
34
34
  model: 'secondary',
35
35
  item: { label: 'Nome do campo', key: 'key', md: 4 },
36
+ rules: {
37
+ required: val => !!val,
38
+ },
36
39
  };
37
40
  },
38
41
  template: `<v-form>
39
- <DefaultTextField :item="item" v-model="model" :required="true" />
42
+ <DefaultTextField :item="item" v-model="model" :required="true" :rules='[rules.required]' />
40
43
  </v-form>`,
41
44
  });
42
45
 
@@ -1,30 +1,32 @@
1
1
  <template>
2
2
  <v-col cols="12" sm="12" :md="item.md ? item.md : 2" class="v-col-fieldset-default pl-0">
3
- <label :for="inputId">
3
+ <farm-label :for="inputId" :required="required && !disabled">
4
4
  {{ item.label }}
5
- <span class="required" v-if="required && !disabled">*</span>
6
- </label>
7
- <v-text-field
8
- color="secondary"
5
+ </farm-label>
6
+ <farm-textfield
9
7
  v-model="inputVal"
10
- outlined
11
- dense
12
8
  v-mask="`${mask ? mask : ''}`"
13
9
  :placeholder="placeholder"
14
10
  :id="inputId"
15
11
  :rules="inputRules"
16
12
  :disabled="disabled"
17
13
  :readonly="readonly"
18
- ></v-text-field>
14
+ />
19
15
  </v-col>
20
16
  </template>
21
17
  <script>
22
18
  import Vue from 'vue';
23
- import { VTextField } from 'vuetify/lib/components/VTextField';
19
+ import Label from '../Label';
20
+ import TextField from '../TextField';
24
21
  import { VCol } from 'vuetify/lib/components/VGrid';
25
22
 
26
23
  export default Vue.extend({
27
24
  name: 'farm-textfield-labelled',
25
+ components: {
26
+ 'farm-label': Label,
27
+ 'farm-textfield': TextField,
28
+ VCol,
29
+ },
28
30
  props: {
29
31
  item: {
30
32
  type: Object,
@@ -83,10 +85,6 @@ export default Vue.extend({
83
85
  default: null,
84
86
  },
85
87
  },
86
- components: {
87
- VCol,
88
- VTextField,
89
- },
90
88
  computed: {
91
89
  inputVal: {
92
90
  get() {
@@ -9,16 +9,17 @@
9
9
  line-height: 1;
10
10
  position: relative;
11
11
  text-indent: 0;
12
+
12
13
  @each $color in $colors {
13
14
  &#{'.farm-icon--' + $color} {
14
15
  color: var(--v-#{$color}-base);
15
16
  }
16
17
  }
17
18
 
18
- @each $size, $value in $sizes {
19
+ @each $size,
20
+ $value in $sizes {
19
21
  &#{'.farm-icon[size=' + $size +']'} {
20
- font-size: $value;
22
+ font-size: $value;
21
23
  }
22
-
23
24
  }
24
25
  }
@@ -0,0 +1,13 @@
1
+ .farm-label {
2
+ font-weight: bold;
3
+ display: block;
4
+ font-size: 12px;
5
+ margin-bottom: 8px;
6
+ line-height: 24px;
7
+
8
+ &.farm-label--required::after {
9
+ content: '*';
10
+ margin-left: 2px;
11
+ color: var(--v-error-base);
12
+ }
13
+ }
@@ -0,0 +1,38 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import Label from './Label.vue';
3
+
4
+ export default {
5
+ title: 'API/Form/Label',
6
+ component: Label,
7
+ decorators: [withDesign],
8
+ parameters: {
9
+ viewMode: 'docs',
10
+ design: {
11
+ type: 'figma',
12
+ url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%85---Design-System-%7C-v1?node-id=1503%3A227',
13
+ },
14
+ docs: {
15
+ description: {
16
+ component: `Label<br />
17
+ selector: <em>farm-label</em>`,
18
+ },
19
+ },
20
+ },
21
+ };
22
+
23
+ export const Primary = () => ({
24
+ components: { 'farm-label': Label },
25
+ template: '<farm-label>Label</farm-label>',
26
+ });
27
+
28
+ const parameters = {
29
+ design: {
30
+ type: 'figma',
31
+ url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%85---Design-System-%7C-v1?node-id=1503%3A227',
32
+ },
33
+ };
34
+
35
+ Primary.story = {
36
+ name: 'Basic',
37
+ parameters,
38
+ };
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <label :class="{ 'farm-label': true, 'farm-label--required': required }" v-bind="$attrs">
3
+ <slot></slot>
4
+ </label>
5
+ </template>
6
+ <script lang="ts">
7
+ import Vue from 'vue';
8
+
9
+ export default Vue.extend({
10
+ name: 'farm-label',
11
+ props: {
12
+ /**
13
+ * Show required indicator
14
+ */
15
+ required: {
16
+ type: Boolean,
17
+ default: false,
18
+ },
19
+ },
20
+ });
21
+ </script>
22
+ <style lang="scss" scoped>
23
+ @import 'Label.scss';
24
+ </style>
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import Label from '../Label';
3
+
4
+ describe('Label component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(Label);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+
15
+ describe('mount component', () => {
16
+ it('renders correctly', () => {
17
+ expect(wrapper.element).toMatchSnapshot();
18
+ });
19
+ });
20
+ });
@@ -0,0 +1,4 @@
1
+ import Label from './Label.vue';
2
+
3
+ export { Label };
4
+ export default Label;
@@ -1,46 +1,46 @@
1
1
  <template>
2
- <div>
3
- <v-overlay opacity="0.3" v-if="mode === 'overlay'">
4
- <v-progress-circular indeterminate :size="100" color="secondary"></v-progress-circular>
5
- </v-overlay>
6
- <v-progress-circular
7
- v-else
8
- :size="calculateSize"
9
- :width="6"
10
- color="secondary"
11
- indeterminate
12
- ></v-progress-circular>
13
- </div>
2
+ <div>
3
+ <v-overlay opacity="0.3" v-if="mode === 'overlay'">
4
+ <v-progress-circular indeterminate :size="100" color="secondary"></v-progress-circular>
5
+ </v-overlay>
6
+ <v-progress-circular
7
+ v-else
8
+ :size="calculateSize"
9
+ :width="6"
10
+ color="secondary"
11
+ indeterminate
12
+ ></v-progress-circular>
13
+ </div>
14
14
  </template>
15
- <script>
15
+ <script lang="ts">
16
16
  import { VOverlay } from 'vuetify/lib/components/VOverlay';
17
17
  import { VProgressCircular } from 'vuetify/lib/components/VProgressCircular';
18
18
  export default {
19
- name: 'farm-loader',
20
- components: {
21
- VOverlay,
22
- VProgressCircular,
23
- },
24
- props: {
25
- status: {
26
- default: 'IDLE',
27
- },
28
- mode: {
29
- type: String,
30
- default: 'inline',
31
- },
32
- size: {
33
- type: String,
34
- default: 'normal',
35
- },
36
- },
37
- computed: {
38
- calculateSize() {
39
- if (this.size === 'small') {
40
- return 35;
41
- }
42
- return 70;
43
- },
44
- },
19
+ name: 'farm-loader',
20
+ components: {
21
+ VOverlay,
22
+ VProgressCircular,
23
+ },
24
+ props: {
25
+ status: {
26
+ default: 'IDLE',
27
+ },
28
+ mode: {
29
+ type: String,
30
+ default: 'inline',
31
+ },
32
+ size: {
33
+ type: String,
34
+ default: 'normal',
35
+ },
36
+ },
37
+ computed: {
38
+ calculateSize() {
39
+ if (this.size === 'small') {
40
+ return 35;
41
+ }
42
+ return 70;
43
+ },
44
+ },
45
45
  };
46
- </script>
46
+ </script>
@@ -0,0 +1,25 @@
1
+ @import '../../configurations/variables';
2
+
3
+ $radius: 5px;
4
+
5
+ .farm-progressbar {
6
+ width: 100%;
7
+ height: 5px;
8
+ border-radius: $radius;
9
+
10
+ > div {
11
+ border-radius: $radius;
12
+ height: 100%;
13
+ }
14
+
15
+ @each $color in $colors {
16
+ &#{'.farm-progressbar--' + $color} {
17
+ background-color: var(--v-#{$color}-base);
18
+ }
19
+
20
+ &#{'.farm-progressbar--value-' + $color}>div {
21
+ background-color: var(--v-#{$color}-base);
22
+ }
23
+ }
24
+
25
+ }
@@ -0,0 +1,43 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import ProgressBar from './ProgressBar.vue';
3
+
4
+ export default {
5
+ title: 'API/ProgressBar',
6
+ component: ProgressBar,
7
+ decorators: [withDesign],
8
+ parameters: {
9
+ viewMode: 'docs',
10
+ design: {
11
+ type: 'figma',
12
+ url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%85---Design-System-%7C-v1?node-id=1503%3A227',
13
+ },
14
+ docs: {
15
+ description: {
16
+ component: `ProgressBar<br />
17
+ selector: <em>farm-progressbar</em>`,
18
+ },
19
+ },
20
+ },
21
+ };
22
+
23
+ export const Primary = () => ({
24
+ components: { 'farm-progressbar': ProgressBar },
25
+ data() {
26
+ return {
27
+ val: 35,
28
+ };
29
+ },
30
+ template: '<farm-progressbar :value="val" />',
31
+ });
32
+
33
+ const parameters = {
34
+ design: {
35
+ type: 'figma',
36
+ url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%85---Design-System-%7C-v1?node-id=1503%3A227',
37
+ },
38
+ };
39
+
40
+ Primary.story = {
41
+ name: 'Basic',
42
+ parameters,
43
+ };
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div :class="classes" :style="containerStyle">
3
+ <div :style="valueStyle"></div>
4
+ </div>
5
+ </template>
6
+ <script lang="ts">
7
+ import Vue from 'vue';
8
+
9
+ export default Vue.extend({
10
+ name: 'farm-progressbar',
11
+ props: {
12
+ /**
13
+ * backgroundColor
14
+ */
15
+ backgroundColor: { type: String, default: 'secondary' },
16
+ /**
17
+ * color
18
+ */
19
+ valueColor: { type: String, default: 'error' },
20
+ /**
21
+ * Value (form 0 to 100)
22
+ */
23
+ value: {
24
+ type: Number,
25
+ required: true,
26
+ },
27
+ },
28
+ computed: {
29
+ classes() {
30
+ const obj = {};
31
+
32
+ if (!this.backgroundColor.startsWith('#')) {
33
+ obj['farm-progressbar--' + this.backgroundColor] = true;
34
+ }
35
+ if (!this.valueColor.startsWith('#')) {
36
+ obj['farm-progressbar--value-' + this.valueColor] = true;
37
+ }
38
+
39
+ return {
40
+ 'farm-progressbar': true,
41
+ ...obj,
42
+ };
43
+ },
44
+ valueStyle() {
45
+ const obj = {
46
+ width: `${this.value}%`,
47
+ };
48
+ if (this.valueColor.startsWith('#')) {
49
+ obj['background-color'] = this.valueColor;
50
+ }
51
+ return obj;
52
+ },
53
+ containerStyle() {
54
+ const obj = {};
55
+
56
+ if (this.backgroundColor.startsWith('#')) {
57
+ obj['background-color'] = this.backgroundColor;
58
+ }
59
+
60
+ return obj;
61
+ },
62
+ },
63
+ });
64
+ </script>
65
+ <style lang="scss" scoped>
66
+ @import 'ProgressBar.scss';
67
+ </style>
@@ -0,0 +1,22 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import ProgressBar from '../ProgressBar';
3
+
4
+ describe('ProgressBar component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(ProgressBar, {
9
+ propsData: { value: 40 },
10
+ });
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
+ });
@@ -0,0 +1,4 @@
1
+ import ProgressBar from './ProgressBar.vue';
2
+
3
+ export { ProgressBar };
4
+ export default ProgressBar;
@@ -0,0 +1,51 @@
1
+ .farm-textfield {
2
+
3
+ &.v-input {
4
+
5
+ &.v-text-field {
6
+
7
+ :deep(.v-input__slot) {
8
+ min-height: 36px !important;
9
+ height: 36px;
10
+ background: white;
11
+
12
+ fieldset {
13
+ border-color: var(--v-gray-lighten2);
14
+ }
15
+
16
+ input,
17
+ .v-select__selection {
18
+ font-size: 0.75rem;
19
+ }
20
+ }
21
+
22
+ &.v-input--is-label-active.v-input--is-focused {
23
+ :deep(.v-input__slot fieldset) {
24
+
25
+ border-color: var(--v-secondary-base);
26
+ }
27
+
28
+ :deep(input) {
29
+ color: var(--v-secondary-base);
30
+ }
31
+ }
32
+
33
+ &.error--text {
34
+ :deep(.v-input__slot) fieldset {
35
+ border-color: var(--v-error-base);
36
+ border-width: 1px;
37
+ }
38
+
39
+ &:after {
40
+ content: '\F0028';
41
+ position: absolute;
42
+ font: normal normal normal 24px/1 'Material Design Icons';
43
+ right: 6px;
44
+ top: 6px;
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+
51
+