@farm-investimentos/front-mfe-components 15.0.1 → 15.0.3

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 (28) hide show
  1. package/dist/front-mfe-components.common.js +119 -333
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +2 -2
  4. package/dist/front-mfe-components.umd.js +119 -333
  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/AlertReload/AlertReload.scss +1 -1
  10. package/src/components/Buttons/ExportButton/ExportButton.stories.js +7 -0
  11. package/src/components/Buttons/ExportButton/ExportButton.vue +4 -3
  12. package/src/components/Buttons/ImportButton/ImportButton.stories.js +8 -0
  13. package/src/components/Buttons/ImportButton/ImportButton.vue +6 -1
  14. package/src/components/Buttons/MultiImportButton/MultiImportButton.stories.js +13 -0
  15. package/src/components/Buttons/MultiImportButton/MultiImportButton.vue +3 -6
  16. package/src/components/Buttons/ToggleButton/ToggleButton.stories.js +5 -1
  17. package/src/components/Buttons/ToggleButton/ToggleButton.vue +7 -11
  18. package/src/components/DatePicker/vDatePicker.scss +2 -2
  19. package/src/components/Loader/Loader.scss +2 -2
  20. package/src/components/Typography/Typography.stories.js +1 -1
  21. package/src/main.ts +0 -2
  22. package/src/scss/VMenuOverrides.scss +1 -1
  23. package/src/components/Buttons/MultiImportButton/MultiImportButton.scss +0 -18
  24. package/src/components/CardContext/CardContext.scss +0 -54
  25. package/src/components/CardContext/CardContext.stories.js +0 -75
  26. package/src/components/CardContext/CardContext.vue +0 -130
  27. package/src/components/CardContext/__tests__/CardContext.spec.js +0 -39
  28. package/src/components/CardContext/index.ts +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "15.0.1",
3
+ "version": "15.0.3",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -1,7 +1,7 @@
1
1
  @import '../../configurations/functions';
2
2
 
3
3
  .farm-alert-reload {
4
- border: 1px solid var(--v-error-base);
4
+ border: 1px solid var(--farm-error-base);
5
5
  border-radius: 8px;
6
6
  padding: gutter('sm') gutter('md');
7
7
  display: flex;
@@ -27,3 +27,10 @@ export const Disabled = () => ({
27
27
  export const List = () => ({
28
28
  template: `<farm-btn-export :optionsList="[{ key: 1, label: 'XLS teste'}, { key: 2, label: 'CSV teste novo'}]" />`,
29
29
  });
30
+
31
+ export const CustomColor = () => ({
32
+ template: `<div>
33
+ <farm-btn-export color="info" />
34
+ <farm-btn-export color="info" :optionsList="[{ key: 1, label: 'XLS teste'}, { key: 2, label: 'CSV teste novo'}]" />
35
+ </div>`,
36
+ });
@@ -5,15 +5,16 @@
5
5
  class="farm-btn--responsive"
6
6
  outlined
7
7
  title="Exportar"
8
- color="secondary-green"
8
+ :color="$attrs.color"
9
9
  :disabled="disabled"
10
10
  >
11
11
  <i :class="{ 'mr-2': true, 'mdi-file-export-outline': true, mdi: true }"></i>
12
12
  Exportar
13
13
  </farm-btn>
14
+
14
15
  <farm-contextmenu v-else v-model="value" :bottom="true">
15
16
  <template v-slot:activator="{}">
16
- <farm-btn outlined title="Exportar" color="secondary" @click="toggleValue">
17
+ <farm-btn outlined title="Exportar" :color="$attrs.color" @click="toggleValue">
17
18
  Exportar
18
19
  <farm-icon class="ml-2"> chevron-{{ value ? 'up' : 'down' }} </farm-icon>
19
20
  </farm-btn>
@@ -22,7 +23,7 @@
22
23
  <farm-listitem
23
24
  v-for="item in optionsList"
24
25
  clickable
25
- hoverColor="primary"
26
+ :hoverColor="$attrs.color || 'primary'"
26
27
  hoverColorVariation="lighten"
27
28
  :key="'exportbutton_key_' + item.label"
28
29
  :title="item.label"
@@ -13,3 +13,11 @@ export const CustomLabel = () => ({
13
13
  components: { ImportButton },
14
14
  template: '<farm-btn-import label="Label custom" />',
15
15
  });
16
+
17
+ export const CustomColors = () => ({
18
+ components: { ImportButton },
19
+ template: `<div>
20
+ <farm-btn-import color="info" variation="lighten" />
21
+ <farm-btn-import color="info" variation="darken" />
22
+ </div>`,
23
+ });
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <farm-btn class="farm-btn--responsive farm-btn--import" color="secondary" title="Importar" @click="onClick">
2
+ <farm-btn
3
+ class="farm-btn--responsive farm-btn--import"
4
+ title="Importar"
5
+ v-bind="$attrs"
6
+ @click="onClick"
7
+ >
3
8
  <farm-icon>upload</farm-icon>
4
9
  {{ label }}
5
10
  </farm-btn>
@@ -20,3 +20,16 @@ export const List = () => ({
20
20
  @onClick="listener"
21
21
  />`,
22
22
  });
23
+
24
+ export const CustomColor = () => ({
25
+ methods: {
26
+ listener(key) {
27
+ alert('Handler for item ' + key);
28
+ },
29
+ },
30
+ template: `<farm-btn-multipleimport
31
+ color="info"
32
+ :optionsList="[{ listenerKey: 1, title: 'XLS teste'}, { listenerKey: 2, title: 'CSV teste novo'}]"
33
+ @onClick="listener"
34
+ />`,
35
+ });
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <farm-contextmenu v-model="value" :bottom="true">
3
3
  <template v-slot:activator="{}">
4
- <farm-btn outlined title="Importar" color="secondary" @click="toggleValue">
4
+ <farm-btn outlined title="Importar" v-bind="$attrs">
5
5
  Importar
6
6
  <farm-icon class="ml-2"> chevron-{{ value ? 'up' : 'down' }} </farm-icon>
7
7
  </farm-btn>
@@ -10,7 +10,7 @@
10
10
  <farm-listitem
11
11
  v-for="item in optionsList"
12
12
  clickable
13
- hoverColor="primary"
13
+ :hoverColor="$attrs.color || 'primary'"
14
14
  hoverColorVariation="lighten"
15
15
  :key="'importbutton_key_' + item.title"
16
16
  :title="item.title"
@@ -49,9 +49,6 @@ export default Vue.extend({
49
49
  onClick(key) {
50
50
  this.$emit('onClick', key);
51
51
  },
52
- toggleValue() {
53
- this.value = !this.value;
54
- },
55
52
  },
56
53
  });
57
- </script>
54
+ </script>
@@ -9,10 +9,14 @@ export const Primary = () => ({
9
9
  template: '<farm-btn-toggle label="Botão" />',
10
10
  });
11
11
 
12
- export const Secondary = () => ({
12
+ export const PositionRight = () => ({
13
13
  template: '<farm-btn-toggle label="Botão" position="right" />',
14
14
  });
15
15
 
16
16
  export const Opened = () => ({
17
17
  template: '<farm-btn-toggle label="Botão" :pressed="true" />',
18
18
  });
19
+
20
+ export const CustomColor = () => ({
21
+ template: '<farm-btn-toggle color="info" label="Botão" />',
22
+ });
@@ -1,19 +1,22 @@
1
1
  <template>
2
2
  <farm-btn
3
3
  @click="onClick"
4
- dense
4
+ v-bind="$attrs"
5
5
  class="farm-btn--responsive"
6
6
  :class="{
7
7
  'v-btn_icon--prepend': prepend,
8
8
  'v-btn_icon--apppend': !prepend,
9
9
  }"
10
- :color="color"
11
10
  :outlined="!open"
12
11
  :title="label"
13
12
  >
14
- <farm-icon v-if="prepend" class="mr-3 ml-0">{{ `chevron-${open ? 'up' : 'down'}` }}</farm-icon>
13
+ <farm-icon v-if="prepend" class="mr-3 ml-0">{{
14
+ `chevron-${open ? 'up' : 'down'}`
15
+ }}</farm-icon>
15
16
  {{ label }}
16
- <farm-icon v-if="!prepend" class="ml-3 mr-0">{{ `chevron-${open ? 'up' : 'down'}` }}</farm-icon>
17
+ <farm-icon v-if="!prepend" class="ml-3 mr-0">{{
18
+ `chevron-${open ? 'up' : 'down'}`
19
+ }}</farm-icon>
17
20
  </farm-btn>
18
21
  </template>
19
22
  <script lang="ts">
@@ -35,13 +38,6 @@ export default Vue.extend({
35
38
  type: String,
36
39
  default: '',
37
40
  },
38
- /**
39
- * Cor do botão - usando as do tema do vuetify
40
- */
41
- color: {
42
- type: String,
43
- default: 'primary',
44
- },
45
41
  /**
46
42
  * Pressionado ou não
47
43
  */
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  button:hover:after {
17
- border-top-color: var(--v-secondary-base);
17
+ border-top-color: var(--farm-primary-base);
18
18
  }
19
19
 
20
20
  button:after {
@@ -22,7 +22,7 @@
22
22
  content: '';
23
23
  width: 0px;
24
24
  height: 0px;
25
- border-top: 0.25rem solid var(--v-primary-base);
25
+ border-top: 0.25rem solid var(--farm-secondary-green-base);
26
26
  border-right: 0.25rem solid transparent;
27
27
  border-bottom: 0.25rem solid transparent;
28
28
  border-left: 0.25rem solid transparent;
@@ -6,8 +6,8 @@ $loader-overlay-transition: all 0.6s ease-in-out !default;
6
6
  .farm-loader {
7
7
  width: 70px;
8
8
  height: 70px;
9
- color: var(--v-secondary-base) !important;
10
- caret-color: var(--v-secondary-base) !important;
9
+ color: var(--farm-primary-base) !important;
10
+ caret-color: var(--farm-primary-base) !important;
11
11
  position: relative;
12
12
  display: inline-flex;
13
13
  vertical-align: middle;
@@ -183,7 +183,7 @@ export const LineHeight = () => ({
183
183
  tag="p"
184
184
  :lineHeight="h"
185
185
  :key="h"
186
- style="border: 1px solid var(--v-gray-lighten2); padding: 8px;"
186
+ style="border: 1px solid var(--farm-gray-base); padding: 8px;"
187
187
  >
188
188
  Typography - height {{ h }}<br />
189
189
  Lorem ipsum dolor sit amet, consectetur adipiscing elit,
package/src/main.ts CHANGED
@@ -15,7 +15,6 @@ import ModalPromptUser from './components/ModalPromptUser';
15
15
 
16
16
  import TableContextMenu from './components/TableContextMenu';
17
17
  import IconBox from './components/IconBox';
18
- import CardContext from './components/CardContext';
19
18
 
20
19
  import DefaultButton from './components/Buttons/DefaultButton';
21
20
  import Collapsible from './components/Collapsible';
@@ -39,7 +38,6 @@ export {
39
38
  ModalPromptUser,
40
39
  DefaultButton,
41
40
  IconBox,
42
- CardContext,
43
41
  Collapsible,
44
42
  IdCaption,
45
43
  ResourceMetaInfo,
@@ -7,7 +7,7 @@
7
7
  padding: 0;
8
8
 
9
9
  div.v-list-item {
10
- border-bottom: 1px solid var(--v-gray-lighten2);
10
+ border-bottom: 1px solid var(--farm-gray-lighten2);
11
11
 
12
12
  &:last-child {
13
13
  border-bottom: 0;
@@ -1,18 +0,0 @@
1
- .farm-btn.farm-btn--import {
2
- background: var(--v-extra-lighten2);
3
- color: var(--v-gray-lighten5);
4
- .farm-btn__content i.mdi {
5
- margin-right: 1rem;
6
- color: var(--v-gray-lighten5);
7
- }
8
- }
9
-
10
- .v-list-item {
11
- border-bottom: 1px solid var(--v-gray-lighten2);
12
- &:last-child {
13
- border-bottom: none;
14
- }
15
- }
16
- .v-list-item--link {
17
- font-size: 0.875rem;
18
- }
@@ -1,54 +0,0 @@
1
- .card-context {
2
- width: 100%;
3
- padding: 1.5rem;
4
- background: #ffffff;
5
- box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.16);
6
- border-radius: 5px;
7
-
8
- &.card-context--outlined {
9
- box-shadow: none;
10
- border: 1px solid var(--v-gray-lighten2);
11
- }
12
- }
13
-
14
- .card-context.height-full {
15
- height: 100%;
16
- }
17
-
18
- .card-context-header {
19
- width: 100%;
20
- height: 40px;
21
- display: flex;
22
- align-items: center;
23
- justify-content: space-between;
24
- }
25
-
26
- .card-context-content {
27
- width: calc(100% - 56px);
28
- height: 40px;
29
- display: flex;
30
- align-items: center;
31
- }
32
-
33
- .card-context-title {
34
- color: #5c5c5c;
35
- margin: 0;
36
- font-size: 0.75rem;
37
- &.card-context-content--bold {
38
- font-size: 0.875rem;
39
- font-weight: bold;
40
- color: #1c1c1c;
41
- }
42
- }
43
-
44
- .card-context-body {
45
- width: 100%;
46
- padding-top: 1rem;
47
- }
48
-
49
- .card-context-loading-or-error {
50
- width: 100%;
51
- display: flex;
52
- align-items: center;
53
- justify-content: center;
54
- }
@@ -1,75 +0,0 @@
1
- import CardContext from './CardContext.vue';
2
-
3
- export default {
4
- title: 'Surfaces/CardContext',
5
- component: CardContext,
6
- parameters: {
7
- docs: {
8
- description: {
9
- component: `Card Context<br />
10
- selector: <em>farm-card-context</em>
11
- `,
12
- },
13
- },
14
- viewMode: 'docs',
15
- },
16
- };
17
-
18
- export const Primary = () => ({
19
- template: `
20
- <farm-card-context icon="mdi-currency-usd" title="Titulo do Card">
21
- <p>Conteúdo do Card</p>
22
- </farm-card-context>
23
- `,
24
- });
25
-
26
- export const Secondary = () => ({
27
- template: `
28
- <farm-card-context icon="mdi-currency-usd" title="Titulo do Card" bold>
29
- <p>Conteúdo do Card</p>
30
- </farm-card-context>
31
- `,
32
- });
33
-
34
- export const WithLoading = () => ({
35
- template: `
36
- <farm-card-context icon="mdi-currency-usd" title="Titulo do Card" isLoading>
37
- <p>Conteúdo do Card</p>
38
- </farm-card-context>
39
- `,
40
- });
41
-
42
- export const WithLoadingLarge = () => ({
43
- template: `
44
- <farm-card-context icon="mdi-currency-usd" title="Titulo do Card" isLoading largeLoading>
45
- <p>Conteúdo do Card</p>
46
- </farm-card-context>
47
- `,
48
- });
49
-
50
- export const WithError = () => ({
51
- components: { CardContext },
52
- template: `
53
- <farm-card-context icon="mdi-currency-usd" title="Titulo do Card" isError>
54
- <p>Conteúdo do Card</p>
55
- </farm-card-context>
56
- `,
57
- });
58
-
59
- export const NoIcon = () => ({
60
- components: { CardContext },
61
- template: `
62
- <farm-card-context title="Titulo do Card">
63
- <p>Conteúdo do Card</p>
64
- </farm-card-context>
65
- `,
66
- });
67
-
68
- export const TooltipText = () => ({
69
- template: `
70
- <farm-card-context tooltipText="Lorem Ipsum is simply dummy text of the printing and typesetting industry" icon="mdi-currency-usd" title="Titulo do Card">
71
- <p>Conteúdo do Card</p>
72
- </farm-card-context>
73
- `,
74
- });
75
-
@@ -1,130 +0,0 @@
1
- <template>
2
- <div
3
- :class="{
4
- 'card-context': true,
5
- 'height-full': this.full,
6
- 'card-context--outlined': this.outlined,
7
- }"
8
- >
9
- <div class="card-context-header" v-if="isSuccess && title">
10
- <farm-icon-box v-if="icon" :icon="icon" />
11
- <div class="card-context-content">
12
- <div class="d-flex align-center">
13
- <p :class="{
14
- 'mr-2': true,
15
- 'mb-1': true,
16
- 'card-context-title': true,
17
- 'card-context-content--bold': bold }"
18
- >
19
- {{ title }}
20
- </p>
21
- <farm-tooltip v-if="tooltipText !== null">
22
- {{ tooltipText }}
23
- <template v-slot:activator="{}">
24
- <farm-icon size="sm" color="gray">help-circle</farm-icon>
25
- </template>
26
- </farm-tooltip>
27
- </div>
28
- </div>
29
- </div>
30
- <div class="card-context-body" v-if="isSuccess">
31
- <slot></slot>
32
- </div>
33
- <div class="card-context-loading-or-error" v-if="isLoading">
34
- <farm-loader :size="isLargeLoading" />
35
- </div>
36
- <div class="card-context-loading-or-error" v-if="isError">
37
- <farm-alert-reload :label="errorLabel" @onClick="$emit('onLoad')" />
38
- </div>
39
- </div>
40
- </template>
41
-
42
- <script lang="ts">
43
- import Vue from 'vue';
44
-
45
- export default Vue.extend({
46
- name: 'farm-card-context',
47
- props: {
48
- /**
49
- * Title
50
- */
51
- title: {
52
- type: String,
53
- required: true,
54
- },
55
- /**
56
- * Set bold text
57
- */
58
- bold: {
59
- type: Boolean,
60
- default: false,
61
- },
62
- /**
63
- * Icon (from Material Icons)
64
- * Example: mdi-chart-bar
65
- */
66
- icon: {
67
- type: String,
68
- default: null,
69
- },
70
- /**
71
- * Show loader
72
- */
73
- isLoading: {
74
- type: Boolean,
75
- default: false,
76
- },
77
- largeLoading: {
78
- type: Boolean,
79
- default: false,
80
- },
81
- /**
82
- * Show error alert
83
- */
84
- isError: {
85
- type: Boolean,
86
- default: false,
87
- },
88
- /**
89
- * Label to be shown in error alert
90
- */
91
- errorLabel: {
92
- type: String,
93
- default: 'Ocorreu um erro',
94
- },
95
- /**
96
- * Is full
97
- */
98
- full: {
99
- type: Boolean,
100
- default: false,
101
- },
102
- /**
103
- * Is outlined
104
- */
105
- outlined: {
106
- type: Boolean,
107
- default: false,
108
- },
109
- /**
110
- * Show Tooltip and help text
111
- */
112
- tooltipText: {
113
- type: String,
114
- default: null,
115
- }
116
- },
117
- computed: {
118
- isSuccess() {
119
- return !this.isLoading && !this.isError;
120
- },
121
- isLargeLoading() {
122
- return this.largeLoading ? 'normal' : 'small';
123
- },
124
- },
125
- });
126
- </script>
127
-
128
- <style lang="scss" scoped>
129
- @import './CardContext.scss';
130
- </style>
@@ -1,39 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
- import CardContext from '../CardContext';
3
-
4
- describe('CardContext component', () => {
5
- let wrapper;
6
- let component;
7
-
8
- beforeEach(() => {
9
- wrapper = shallowMount(CardContext, {
10
- propsData: {
11
- title: 'title',
12
- },
13
- });
14
- component = wrapper.vm;
15
- });
16
-
17
- test('Created hook', () => {
18
- expect(wrapper).toBeDefined();
19
- });
20
-
21
- describe('mount component', () => {
22
- it('renders correctly', () => {
23
- expect(wrapper.element).toMatchSnapshot();
24
- });
25
- });
26
-
27
- describe('Computed properties', () => {
28
- it('Should compute isLargeLoading for false', () => {
29
- expect(component.isLargeLoading).toEqual('small');
30
- });
31
-
32
- it('Should compute isLargeLoading for true', async () => {
33
- await wrapper.setProps({
34
- largeLoading: true,
35
- });
36
- expect(component.isLargeLoading).toEqual('normal');
37
- });
38
- });
39
- });
@@ -1,3 +0,0 @@
1
- import CardContext from './CardContext.vue';
2
-
3
- export default CardContext;