@farm-investimentos/front-mfe-components 11.12.0 → 12.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "11.12.0",
3
+ "version": "12.0.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -1,14 +1,19 @@
1
1
  @import '../../configurations/theme-colors';
2
2
 
3
3
  .farm-alert-box {
4
- background-color: themeColor('primary', 'lighten');
5
4
  border-radius: 5px;
6
- color: themeColor('primary', 'darken');
7
5
  display: flex;
8
6
  padding: 8px 16px;
9
7
  position: relative;
10
8
  min-height: 40px;
11
9
 
10
+ @each $color in $theme-colors-list {
11
+ &#{'[color=' + $color + ']'} {
12
+ background-color: themeColor($color, 'lighten');
13
+ color: themeColor($color, 'darken');
14
+ }
15
+ }
16
+
12
17
  &__content {
13
18
  flex: 1;
14
19
 
@@ -1,4 +1,6 @@
1
1
  import AlertBox from './AlertBox.vue';
2
+ import baseThemeColors from '../../configurations/_theme-colors-base.scss';
3
+ const colors = Object.keys(baseThemeColors);
2
4
 
3
5
  export default {
4
6
  title: 'Feedback/AlertBox',
@@ -48,3 +50,15 @@ export const moreThanOneLine = () => ({
48
50
  },
49
51
  template: '<farm-alertbox icon="book" dismissable>{{text}}</farm-alertbox>',
50
52
  });
53
+
54
+ export const Colors = () => ({
55
+ data() {
56
+ return {
57
+ colors,
58
+ };
59
+ },
60
+ template: `
61
+ <div>
62
+ <farm-alertbox class="mt-3" v-for="color of colors" :key="'random_10_' + color" :color="color" icon="book" dismissable>alert box</farm-alertbox>
63
+ </div> `,
64
+ });
@@ -1,12 +1,16 @@
1
1
  <template>
2
2
  <transition name="fade">
3
- <div v-if="visible" :class="{ 'farm-alert-box': true, 'farm-alert-box--dense': dense }">
3
+ <div
4
+ v-if="visible"
5
+ :color="color"
6
+ :class="{ 'farm-alert-box': true, 'farm-alert-box--dense': dense }"
7
+ >
4
8
  <farm-icon
5
9
  v-if="icon"
6
10
  class="farm-alert-box__icon"
7
- color="primary"
8
11
  variation="darken"
9
12
  size="md"
13
+ :color="color"
10
14
  >{{ icon }}</farm-icon
11
15
  >
12
16
  <div
@@ -16,23 +20,30 @@
16
20
  }"
17
21
  >
18
22
  <farm-bodytext
19
- :type="1"
20
23
  variation="regular"
21
- color="primary"
22
24
  color-variation="darken"
25
+ :type="1"
26
+ :color="color"
23
27
  >
24
28
  <slot></slot>
25
29
  </farm-bodytext>
26
30
  </div>
27
- <farm-btn class="farm-alert-box__close" v-if="dismissable" icon size="md">
28
- <farm-icon color="primary" variation="darken" size="md">close</farm-icon>
31
+ <farm-btn
32
+ class="farm-alert-box__close"
33
+ v-if="dismissable"
34
+ icon
35
+ size="md"
36
+ :color="color"
37
+ @click="close"
38
+ >
39
+ <farm-icon variation="darken" size="md" :color="color">close</farm-icon>
29
40
  </farm-btn>
30
41
  </div>
31
42
  </transition>
32
43
  </template>
33
44
 
34
45
  <script lang="ts">
35
- import Vue, { ref } from 'vue';
46
+ import Vue, { ref, PropType } from 'vue';
36
47
 
37
48
  export default Vue.extend({
38
49
  name: 'farm-alertbox',
@@ -58,6 +69,24 @@ export default Vue.extend({
58
69
  type: Boolean,
59
70
  default: false,
60
71
  },
72
+ /**
73
+ * Color
74
+ */
75
+ color: {
76
+ type: String as PropType<
77
+ | 'primary'
78
+ | 'secondary'
79
+ | 'neutral'
80
+ | 'info'
81
+ | 'success'
82
+ | 'error'
83
+ | 'warning'
84
+ | 'success'
85
+ | 'extra-1'
86
+ | 'extra-2'
87
+ >,
88
+ default: 'primary',
89
+ },
61
90
  },
62
91
  setup() {
63
92
  const visible = ref(true);
@@ -3,9 +3,11 @@ import AlertBox from '../AlertBox';
3
3
 
4
4
  describe('AlertBox component', () => {
5
5
  let wrapper;
6
+ let component;
6
7
 
7
8
  beforeEach(() => {
8
9
  wrapper = shallowMount(AlertBox, {});
10
+ component = wrapper.vm;
9
11
  });
10
12
 
11
13
  test('Created hook', () => {
@@ -17,4 +19,14 @@ describe('AlertBox component', () => {
17
19
  expect(wrapper.element).toMatchSnapshot();
18
20
  });
19
21
  });
22
+
23
+ describe('Methods', () => {
24
+ describe('close', () => {
25
+ it('should close the AlertBox', () => {
26
+ expect(component.visible).toBeTruthy();
27
+ component.close();
28
+ expect(component.visible).toBeFalsy();
29
+ });
30
+ });
31
+ });
20
32
  });
@@ -24,4 +24,17 @@ export const Primary = () => ({
24
24
  `,
25
25
  });
26
26
 
27
-
27
+ export const Events = () => ({
28
+ methods: {
29
+ handleEvent(type) {
30
+ alert(type);
31
+ },
32
+ },
33
+ template: `
34
+ <farm-card
35
+ @click.stop="handleEvent('click')"
36
+ >
37
+ Card content
38
+ </farm-card>
39
+ `,
40
+ });
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <component class="farm-card" :is="tag">
2
+ <component class="farm-card" :is="tag" v-on="$listeners">
3
3
  <slot></slot>
4
4
  </component>
5
5
  </template>
@@ -31,3 +31,17 @@
31
31
  }
32
32
  }
33
33
  }
34
+
35
+ @each $color in $theme-colors-list {
36
+ .farm-btn.farm-btn--icon.farm-btn--#{$color}:not(.farm-btn--disabled)
37
+ .farm-btn__content
38
+ i.mdi.farm-icon--darken {
39
+ color: var(--farm-#{$color}-darken);
40
+ }
41
+
42
+ .farm-btn.farm-btn--icon.farm-btn--#{$color}:not(.farm-btn--disabled)
43
+ .farm-btn__content
44
+ i.mdi.farm-icon--lighten {
45
+ color: var(--farm-#{$color}-lighten);
46
+ }
47
+ }
@@ -2,15 +2,15 @@
2
2
  margin-left: 4px;
3
3
  }
4
4
 
5
- .farm-btn {
5
+ .farm-btn.farm-btn__cta {
6
6
  margin-left: 12px;
7
+ margin-top: 32px;
7
8
  }
8
9
 
9
10
  @media screen and (max-width: 600px) {
10
- .farm-btn {
11
+ .farm-btn.farm-btn__cta {
11
12
  width: calc(100% - 24px);
12
13
  margin-left: 12px;
13
14
  margin-top: 0 !important;
14
15
  }
15
-
16
16
  }
@@ -47,7 +47,7 @@ export const Tooltip = () => ({
47
47
  export const Application = () => ({
48
48
  data() {
49
49
  return {
50
- showFilters: false,
50
+ showFilters: true,
51
51
  };
52
52
  },
53
53
  template: `<div>
@@ -58,7 +58,7 @@ export const Application = () => ({
58
58
  </farm-row>
59
59
  <farm-row v-if="showFilters">
60
60
  <farm-col cols="12">
61
- Aqui são os filtros extras
61
+ Extra filters
62
62
  </farm-col>
63
63
  <farm-col cols="12" md="3">
64
64
  <farm-textfield />
@@ -17,7 +17,8 @@
17
17
  </farm-col>
18
18
  <farm-btn
19
19
  v-if="hasExtraFilters"
20
- class="mt-14 mt-sm-8"
20
+ class="farm-btn__cta"
21
+ :title="extraFiltersBtnLabel"
21
22
  @click="onFilterClick"
22
23
  >
23
24
  <farm-icon class="mr-2">{{ extraFiltersBtnIcon }}</farm-icon>
@@ -27,6 +27,7 @@ export const Primary = () => ({
27
27
  return {
28
28
  v: null,
29
29
  items: [
30
+ { value: 0, text: 'value 0' },
30
31
  { value: 1, text: 'value 1' },
31
32
  { value: 2, text: 'value 2' },
32
33
  { value: 3, text: 'value 3' },
@@ -223,7 +223,7 @@ export default Vue.extend({
223
223
  };
224
224
 
225
225
  const updateSelectedTextValue = () => {
226
- if (!items.value || items.value.length === 0 || !innerValue.value) {
226
+ if (!items.value || items.value.length === 0 || innerValue.value === null) {
227
227
  selectedText.value = '';
228
228
  return;
229
229
  }