@farm-investimentos/front-mfe-components 11.11.4 → 11.12.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.11.4",
3
+ "version": "11.12.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -78,6 +78,7 @@ export default Vue.extend({
78
78
  () => inputValue.value,
79
79
  newValue => {
80
80
  if (newValue) {
81
+ styles.display = 'block';
81
82
  if (!hasBeenBoostrapped) {
82
83
  document.querySelector('body').appendChild(popup.value);
83
84
  hasBeenBoostrapped = true;
@@ -86,6 +87,7 @@ export default Vue.extend({
86
87
  window.addEventListener('resize', resizeWindowHandler);
87
88
  calculatePosition();
88
89
  } else {
90
+ styles.display = 'none';
89
91
  styles.top = 0;
90
92
  styles.left = 0;
91
93
  styles.zIndex = 0;
@@ -107,8 +109,6 @@ export default Vue.extend({
107
109
  window.scrollY +
108
110
  (!bottom.value ? 0 : activatorBoundingClientRect.height);
109
111
 
110
- //
111
-
112
112
  let offsetLeft = activatorBoundingClientRect.left;
113
113
 
114
114
  styles.minWidth =
@@ -1,29 +1,16 @@
1
- section {
2
- display: flex;
3
- flex-direction: row;
4
-
5
- .farm-btn {
6
- margin-left: 16px;
7
- }
8
-
9
- fieldset {
10
- border: 0;
11
- }
12
-
13
- .farm-tooltip {
14
- margin-left: 4px;
15
- }
1
+ .farm-tooltip {
2
+ margin-left: 4px;
3
+ }
16
4
 
5
+ .farm-btn {
6
+ margin-left: 12px;
17
7
  }
18
8
 
19
9
  @media screen and (max-width: 600px) {
20
- section {
21
- flex-direction: column;
22
- margin-bottom: 1rem;
23
-
24
- .farm-btn {
25
- margin-left: 0;
26
- margin-top: 0 !important;
27
- }
10
+ .farm-btn {
11
+ width: calc(100% - 24px);
12
+ margin-left: 12px;
13
+ margin-top: 0 !important;
28
14
  }
15
+
29
16
  }
@@ -32,29 +32,46 @@ export const WithSlot = () => ({
32
32
  template: '<farm-form-mainfilter>With Slot</farm-form-mainfilter>',
33
33
  });
34
34
 
35
- export const MainFilters = () => ({
35
+ export const Tooltip = () => ({
36
36
  data() {
37
37
  return {
38
- showFilters: false,
39
- items: [1, 2, 3, 4, 5],
38
+ text: 'Some long tooltip text to be placed here!',
40
39
  };
41
40
  },
42
- template: `<div style="max-width: 480px">
43
- <farm-form-mainfilter @onClick="showFilters = !showFilters" :showFilters="showFilters" />
44
- <section v-if="showFilters">
45
- <v-select :items="items" />
46
- </section>
41
+ template: `
42
+ <div style="max-width: 480px; padding-top: 32px; margin-left: 32px;">
43
+ <farm-form-mainfilter label="Label" :tooltip="text" />
47
44
  </div>`,
48
45
  });
49
46
 
50
- export const Tooltip = () => ({
47
+ export const Application = () => ({
51
48
  data() {
52
49
  return {
53
- text: 'Some long tooltip text to be placed here!',
50
+ showFilters: false,
54
51
  };
55
52
  },
56
- template: `
57
- <div style="max-width: 480px; padding-top: 32px; margin-left: 32px;">
58
- <farm-form-mainfilter label="Label" :tooltip="text" />
53
+ template: `<div>
54
+ <farm-row>
55
+ <farm-col md="6">
56
+ <farm-form-mainfilter @onClick="showFilters = !showFilters" :showFilters="showFilters" />
57
+ </farm-col>
58
+ </farm-row>
59
+ <farm-row v-if="showFilters">
60
+ <farm-col cols="12">
61
+ Aqui são os filtros extras
62
+ </farm-col>
63
+ <farm-col cols="12" md="3">
64
+ <farm-textfield />
65
+ </farm-col>
66
+ <farm-col cols="12" md="3">
67
+ <farm-textfield />
68
+ </farm-col>
69
+ <farm-col cols="12" md="3">
70
+ <farm-textfield />
71
+ </farm-col>
72
+ <farm-col cols="12" md="3">
73
+ <farm-textfield />
74
+ </farm-col>
75
+ </farm-row>
59
76
  </div>`,
60
- });
77
+ });
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <section :class="{ 'justify-end': justifyEnd === true }">
3
- <fieldset v-if="hasInitialInput">
2
+ <farm-row :class="{ 'justify-end': justifyEnd === true }">
3
+ <farm-col v-if="hasInitialInput" md="6">
4
4
  <farm-label :for="elementId">
5
5
  {{ !hasSlotData ? label : '' }}
6
6
  <slot v-if="hasSlotData"></slot>
@@ -14,16 +14,16 @@
14
14
  </farm-tooltip>
15
15
  </farm-label>
16
16
  <farm-textfield-v2 v-model="inputValue" :id="elementId" @keyup="onKeyUp" />
17
- </fieldset>
17
+ </farm-col>
18
18
  <farm-btn
19
19
  v-if="hasExtraFilters"
20
- class="farm-btn--responsive mt-14 mt-sm-8"
20
+ class="mt-14 mt-sm-8"
21
21
  @click="onFilterClick"
22
22
  >
23
23
  <farm-icon class="mr-2">{{ extraFiltersBtnIcon }}</farm-icon>
24
24
  {{ extraFiltersBtnLabel }}
25
25
  </farm-btn>
26
- </section>
26
+ </farm-row>
27
27
  </template>
28
28
 
29
29
  <script lang="ts">
@@ -27,7 +27,7 @@
27
27
  </template>
28
28
 
29
29
  <script lang="ts">
30
- import Vue, { PropType, reactive, ref, toRefs, watch } from 'vue';
30
+ import Vue, { onBeforeUnmount, onMounted, PropType, reactive, ref, toRefs, watch } from 'vue';
31
31
  import { calculateMainZindex } from '../../helpers';
32
32
 
33
33
  export default Vue.extend({
@@ -61,6 +61,7 @@ export default Vue.extend({
61
61
  },
62
62
  },
63
63
  setup(props, { emit }) {
64
+ let hasBeenBoostrapped = false;
64
65
  const { offsetTop, offsetBottom, persistent, size } = toRefs(props);
65
66
  const inputValue = ref(props.value);
66
67
  const styleObject = reactive({ zIndex: 1 });
@@ -84,18 +85,33 @@ export default Vue.extend({
84
85
  newValue => {
85
86
  inputValue.value = newValue;
86
87
  if (newValue) {
87
- (styleObject.zIndex = calculateMainZindex()),
88
- window.addEventListener('keyup', escHandler);
88
+ bootstrap();
89
89
  }
90
90
  }
91
91
  );
92
92
 
93
+ onMounted(() => {
94
+ bootstrap();
95
+ });
96
+
93
97
  const escHandler = event => {
94
98
  if (event.key === 'Escape') {
95
99
  close();
96
100
  }
97
101
  };
98
102
 
103
+ const bootstrap = () => {
104
+ styleObject.zIndex = calculateMainZindex();
105
+ window.addEventListener('keyup', escHandler);
106
+ hasBeenBoostrapped = true;
107
+ };
108
+
109
+ onBeforeUnmount(() => {
110
+ if (hasBeenBoostrapped) {
111
+ window.removeEventListener('resize', escHandler);
112
+ }
113
+ });
114
+
99
115
  return {
100
116
  inputValue,
101
117
  styles,
@@ -1,11 +1,10 @@
1
1
  import RadioGroup from './RadioGroup';
2
- import baseThemeColors from '../../configurations/_theme-colors-base.scss';
3
-
4
- const colors = Object.keys(baseThemeColors);
2
+ import { withDesign } from 'storybook-addon-designs';
5
3
 
6
4
  export default {
7
5
  title: 'Form/RadioGroup',
8
6
  component: RadioGroup,
7
+ decorators: [withDesign],
9
8
  parameters: {
10
9
  docs: {
11
10
  description: {
@@ -1,5 +1,7 @@
1
1
  import { withDesign } from 'storybook-addon-designs';
2
2
  import ValueCaption from '.';
3
+ import baseThemeColors from '../../configurations/_theme-colors-base.scss';
4
+ const colors = Object.keys(baseThemeColors);
3
5
 
4
6
  export default {
5
7
  title: 'Display/ValueCaption',
@@ -31,3 +33,26 @@ export const Primary = () => ({
31
33
  </farm-valuecaption>
32
34
  `,
33
35
  });
36
+
37
+ export const Colors = () => ({
38
+ data() {
39
+ return {
40
+ colors: [...colors],
41
+ };
42
+ },
43
+ template: `<div class="d-flex flex-column">
44
+ <farm-valuecaption
45
+ icon="account-box-outline"
46
+ v-for="color of colors":key="color"
47
+ :iconBoxColor="color"
48
+ class="mb-3"
49
+ >
50
+ <template v-slot:title>
51
+ color: {{ color }}
52
+ </template>
53
+ <template v-slot:subtitle>
54
+ R$ 1.000,00
55
+ </template>
56
+ </farm-valuecaption>
57
+ </div>`,
58
+ });