@farm-investimentos/front-mfe-components 11.3.1 → 11.4.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 +548 -1021
  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 +548 -1021
  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 +3 -3
  9. package/src/components/AlertBox/AlertBox.scss +0 -0
  10. package/src/components/AlertBox/AlertBox.stories.js +21 -0
  11. package/src/components/AlertBox/AlertBox.vue +16 -0
  12. package/src/components/AlertBox/__tests__/AlertBox.spec.js +20 -0
  13. package/src/components/AlertBox/index.ts +4 -0
  14. package/src/components/Card/Card.scss +1 -0
  15. package/src/components/Card/Card.stories.js +6 -4
  16. package/src/components/Card/CardComposition.stories.ts +10 -0
  17. package/src/components/Checkbox/Checkbox.scss +17 -4
  18. package/src/components/Checkbox/Checkbox.stories.js +12 -0
  19. package/src/components/Checkbox/Checkbox.vue +20 -2
  20. package/src/components/ContextMenu/ContextMenu.scss +1 -0
  21. package/src/components/ContextMenu/ContextMenu.stories.js +59 -0
  22. package/src/components/ContextMenu/ContextMenu.vue +19 -8
  23. package/src/components/DataTableHeader/DataTableHeader.vue +5 -3
  24. package/src/components/MultipleFilePicker/MultipleFilePicker.scss +0 -4
  25. package/src/components/MultipleFilePicker/MultipleFilePicker.vue +16 -16
  26. package/src/components/layout/Basic.stories.js +17 -9
  27. package/src/components/layout/Col/Col.scss +60 -3
  28. package/src/components/layout/Col/Col.stories.js +126 -10
  29. package/src/components/layout/Col/Col.vue +40 -19
  30. package/src/components/layout/DisplayBreakpoints.stories.mdx +2 -0
  31. package/src/components/layout/GridSystem.stories.js +138 -0
  32. package/src/components/layout/Row/Row.scss +11 -5
  33. package/src/components/layout/Row/Row.stories.js +8 -8
  34. package/src/components/layout/Row/Row.vue +10 -2
  35. package/src/configurations/_mixins.scss +46 -0
  36. package/src/configurations/_variables.scss +4 -4
  37. package/src/configurations/flexVariables.ts +3 -2
  38. package/src/main.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "11.3.1",
3
+ "version": "11.4.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "core-js": "^3.8.3",
25
- "vue": "^2.7.0",
25
+ "vue": "2.7.10",
26
26
  "vuetify": "^2.4.5",
27
27
  "vuetify-dialog": "^2.0.17"
28
28
  },
@@ -51,7 +51,7 @@
51
51
  "storybook-addon-designs": "^6.2.1",
52
52
  "typescript": "~4.1.5",
53
53
  "v-mask": "^2.3.0",
54
- "vue-template-compiler": "^2.7.0"
54
+ "vue-template-compiler": "2.7.10"
55
55
  },
56
56
  "browserslist": [
57
57
  "> 1%",
File without changes
@@ -0,0 +1,21 @@
1
+ import AlertBox from './AlertBox.vue';
2
+
3
+ export default {
4
+ title: 'Feedback/AlertBox',
5
+ component: AlertBox,
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: `Alert Box<br />
10
+ selector: <em>farm-alertbox</em><br />
11
+ <span style="color: var(--farm-extra-1-base);">development</span>
12
+ `,
13
+ },
14
+ },
15
+ viewMode: 'docs',
16
+ },
17
+ };
18
+
19
+ export const Primary = () => ({
20
+ template: '<farm-alertbox>alert box</farm-alertbox>',
21
+ });
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <div>alertbox</div>
3
+ </template>
4
+
5
+ <script lang="ts">
6
+ import Vue from 'vue';
7
+
8
+ export default Vue.extend({
9
+ name: 'farm-alertbox',
10
+ props: {},
11
+ setup() {},
12
+ });
13
+ </script>
14
+ <style lang="scss" scoped>
15
+ @import './AlertBox';
16
+ </style>
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import AlertBox from '../AlertBox';
3
+
4
+ describe('AlertBox component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(AlertBox, {});
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 AlertBox from './AlertBox.vue';
2
+
3
+ export { AlertBox };
4
+ export default AlertBox;
@@ -5,6 +5,7 @@
5
5
  background: #ffffff;
6
6
  border: 1px solid var(--farm-stroke-base);
7
7
  border-radius: 5px;
8
+ overflow: hidden;
8
9
 
9
10
  &[shadow] {
10
11
  @include addShadow;
@@ -18,8 +18,10 @@ export default {
18
18
 
19
19
  export const Primary = () => ({
20
20
  template: `
21
- <farm-card>
22
- Conteúdo do Card
23
- </farm-card>
24
- `,
21
+ <farm-card>
22
+ Card content
23
+ </farm-card>
24
+ `,
25
25
  });
26
+
27
+
@@ -51,3 +51,13 @@ export const Shadow = () => ({
51
51
  </farm-card>
52
52
  </div>`,
53
53
  });
54
+
55
+ export const BackgroundChildren = () => ({
56
+ template: `<div style="width: 480px;">
57
+ <farm-card>
58
+ <farm-card-content style="background: #DADADA">
59
+ Content!
60
+ </farm-card-content>
61
+ </farm-card>
62
+ </div>`,
63
+ });
@@ -1,9 +1,11 @@
1
1
  @import '../../configurations/theme-colors';
2
2
  @import '../../configurations/variables';
3
+ @import '../../configurations/mixins';
3
4
 
4
5
  .farm-checkbox__container {
5
6
  display: flex;
6
7
  flex-direction: row;
8
+ position: relative;
7
9
 
8
10
  .farm-label {
9
11
  margin-left: 8px;
@@ -11,7 +13,9 @@
11
13
 
12
14
  @each $color in $theme-colors-list {
13
15
  &#{'[color=' + $color + ']'} {
14
- .farm-checkbox--checked {
16
+
17
+ .farm-checkbox--checked,
18
+ .farm-checkbox--indeterminate {
15
19
  background-color: themeColor($color);
16
20
  border-color: themeColor($color);
17
21
 
@@ -31,11 +35,13 @@
31
35
  }
32
36
  }
33
37
  }
38
+
39
+ @include activateRipple;
34
40
  }
35
41
 
42
+ @include rippleStyles;
43
+
36
44
  .farm-checkbox {
37
- width: 20px;
38
- height: 20px;
39
45
  display: flex;
40
46
  justify-content: center;
41
47
  border: 2px solid #5c5c5c;
@@ -43,6 +49,7 @@
43
49
  cursor: pointer;
44
50
  line-height: 0;
45
51
  transition: all 0.4s;
52
+ z-index: 2;
46
53
 
47
54
  &--disabled {
48
55
  border-color: #dadada;
@@ -57,7 +64,6 @@
57
64
  .farm-icon {
58
65
  color: white;
59
66
  }
60
-
61
67
  }
62
68
 
63
69
  @each $size,
@@ -66,4 +72,11 @@ $value in $sizes {
66
72
  width: $value;
67
73
  height: $value;
68
74
  }
75
+
76
+ #{'.farm-ripple[size=' + $size +']'} {
77
+ height: $value*1.75;
78
+ width: $value*1.75;
79
+ left: -$value*0.4;
80
+ top: -$value*0.4 ;
81
+ }
69
82
  }
@@ -106,3 +106,15 @@ export const Sizes = () => ({
106
106
  </div>
107
107
  </div>`,
108
108
  });
109
+
110
+ export const Indeterminate = () => ({
111
+ data() {
112
+ return {
113
+ sizes,
114
+ isChecked: true,
115
+ };
116
+ },
117
+ template: `<div>
118
+ <farm-checkbox :indeterminate="true" v-model="isChecked" />
119
+ </div>`,
120
+ });
@@ -5,17 +5,20 @@
5
5
  'farm-checkbox': true,
6
6
  'farm-checkbox--checked': innerValue,
7
7
  'farm-checkbox--disabled': disabled,
8
+ 'farm-checkbox--indeterminate': indeterminate,
8
9
  'farm-checkbox--lighten': variation === 'lighten',
9
10
  'farm-checkbox--darken': variation === 'darken',
10
11
  }"
11
12
  :size="$props.size"
12
13
  @click="toggleValue"
13
14
  >
14
- <farm-icon :size="$props.size" v-if="innerValue">check</farm-icon>
15
+ <farm-icon :size="$props.size" v-if="innerValue && !indeterminate">check</farm-icon>
16
+ <farm-icon :size="$props.size" v-if="indeterminate">minus</farm-icon>
15
17
  </span>
16
18
  <farm-label v-if="label">
17
19
  {{ label }}
18
20
  </farm-label>
21
+ <div class="farm-ripple" :size="$props.size" v-if="!disabled"></div>
19
22
  </div>
20
23
  </template>
21
24
  <script lang="ts">
@@ -48,7 +51,18 @@ export default Vue.extend({
48
51
  default: '',
49
52
  },
50
53
  color: {
51
- type: String,
54
+ type: String as PropType<
55
+ | 'primary'
56
+ | 'secondary'
57
+ | 'neutral'
58
+ | 'info'
59
+ | 'success'
60
+ | 'error'
61
+ | 'warning'
62
+ | 'success'
63
+ | 'extra-1'
64
+ | 'extra-2'
65
+ >,
52
66
  default: 'primary',
53
67
  },
54
68
  /**
@@ -65,6 +79,10 @@ export default Vue.extend({
65
79
  type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
66
80
  default: 'md',
67
81
  },
82
+ /**
83
+ * Sets an indeterminate state for the simple checkbox
84
+ */
85
+ indeterminate: { type: Boolean, default: false },
68
86
  },
69
87
  setup(props, { emit }) {
70
88
  const innerValue = ref(props.value);
@@ -2,6 +2,7 @@
2
2
 
3
3
  .farm-contextmenu {
4
4
  display: inline-block;
5
+ flex: 0 1 auto;
5
6
  }
6
7
 
7
8
  .farm-contextmenu__popup {
@@ -101,4 +101,63 @@ export const ComplexContent = () => ({
101
101
  </template>
102
102
  </farm-contextmenu>
103
103
  </div>`,
104
+ });
105
+
106
+ export const OverflowContent = () => ({
107
+ data() {
108
+ return {
109
+ value: false,
110
+ };
111
+ },
112
+ methods: {
113
+ toggleValue() {
114
+ this.value = !this.value;
115
+ },
116
+ },
117
+ template: `<div style="padding-left: 120px; padding-top: 80px; display: flex; flex-direction: column">
118
+ <div>
119
+ default: 360px
120
+ </div>
121
+ <farm-contextmenu v-model="value">
122
+ first line<br />new line<br />new line<br />
123
+ new line<br />new line<br />new line<br />
124
+ new line<br />new line<br />new line<br />
125
+ new line<br />new line<br />new line<br />
126
+ new line<br />new line<br />new line<br />
127
+ new line<br />new line<br />new line<br />
128
+ new line<br />new line<br />new line<br />
129
+ new line<br />new line<br />last line<br />
130
+ <template v-slot:activator="{ on, attrs }">
131
+ <farm-btn @click="toggleValue">toggle</farm-btn>
132
+ </template>
133
+ </farm-contextmenu>
134
+ </div>`,
135
+ });
136
+
137
+ export const MaxHeight = () => ({
138
+ data() {
139
+ return {
140
+ value: false,
141
+ };
142
+ },
143
+ methods: {
144
+ toggleValue() {
145
+ this.value = !this.value;
146
+ },
147
+ },
148
+ template: `<div style="padding-left: 120px; padding-top: 80px; display: flex; flex-direction: column;">
149
+ <farm-contextmenu v-model="value" maxHeight="160">
150
+ first line<br />new line<br />new line<br />
151
+ new line<br />new line<br />new line<br />
152
+ new line<br />new line<br />new line<br />
153
+ new line<br />new line<br />new line<br />
154
+ new line<br />new line<br />new line<br />
155
+ new line<br />new line<br />new line<br />
156
+ new line<br />new line<br />new line<br />
157
+ new line<br />new line<br />last line<br />
158
+ <template v-slot:activator="{ on, attrs }">
159
+ <farm-btn @click="toggleValue">toggle</farm-btn>
160
+ </template>
161
+ </farm-contextmenu>
162
+ </div>`,
104
163
  });
@@ -38,13 +38,26 @@ export default Vue.extend({
38
38
  type: Boolean,
39
39
  default: false,
40
40
  },
41
+ /**
42
+ * Max height
43
+ */
44
+ maxHeight: {
45
+ type: [Number, String],
46
+ default: 320,
47
+ },
41
48
  },
42
49
  setup(props, { emit }) {
43
50
  const parent = ref(null);
44
51
  const popup = ref(null);
45
52
  const activator = ref(null);
46
- const styles = reactive({ minWidth: 0, top: 0, zIndex: 1 } as any);
47
- const { bottom } = toRefs(props);
53
+ const { bottom, maxHeight } = toRefs(props);
54
+
55
+ const styles = reactive({
56
+ minWidth: 0,
57
+ top: 0,
58
+ zIndex: 1,
59
+ maxHeight: parseInt(maxHeight.value as string) + 'px',
60
+ } as any);
48
61
 
49
62
  const inputValue = ref(props.value);
50
63
 
@@ -85,21 +98,19 @@ export default Vue.extend({
85
98
  const activatorBoundingClientRect = activator.value.children[0].getBoundingClientRect();
86
99
  const popupClientRect = popup.value.getBoundingClientRect();
87
100
 
88
- console.log(activatorBoundingClientRect);
89
-
90
101
  let offsetTop =
91
102
  parentBoundingClientRect.top +
92
103
  window.scrollY +
93
104
  (!bottom.value ? 0 : activatorBoundingClientRect.height);
94
105
 
95
- let offsetLeft = parentBoundingClientRect.left;
106
+ let offsetLeft = activatorBoundingClientRect.left;
96
107
  if (popupClientRect.width > activatorBoundingClientRect.width) {
97
108
  offsetLeft =
98
- offsetLeft + parentBoundingClientRect.width / 2 - popupClientRect.width / 2;
109
+ offsetLeft + activatorBoundingClientRect.width / 2 - popupClientRect.width / 2;
99
110
  }
100
111
  styles.minWidth =
101
- (parentBoundingClientRect.width > 96
102
- ? parseInt(parentBoundingClientRect.width)
112
+ (activatorBoundingClientRect.width > 96
113
+ ? parseInt(activatorBoundingClientRect.width)
103
114
  : 96) + 'px';
104
115
 
105
116
  //Do not allow to open outside window
@@ -34,10 +34,12 @@
34
34
  </span>
35
35
 
36
36
  <span v-if="isTHDataTableSelect(item) && showCheckbox" class="span-checkbox">
37
- <!--
37
+ <farm-checkbox
38
+ size="sm"
39
+ v-model="inputVal"
38
40
  :indeterminate="headerProps.someItems && !headerProps.everyItem"
39
- -->
40
- <farm-checkbox size="sm" v-model="inputVal" @input="selectAll" />
41
+ @input="selectAll"
42
+ />
41
43
  </span>
42
44
  </th>
43
45
  </tr>
@@ -129,10 +129,6 @@ section {
129
129
  }
130
130
  }
131
131
 
132
- .mdi {
133
- color: #fff;
134
- }
135
-
136
132
  .download-button {
137
133
  &__text {
138
134
  font-size: 0.95rem !important;
@@ -3,27 +3,27 @@
3
3
  <input
4
4
  type="file"
5
5
  name="file"
6
+ multiple
7
+ ref="upload"
6
8
  :class="{
7
9
  'hidden-input': hasFiles,
8
10
  }"
9
- @change="fileChange($event.target.files)"
10
11
  :accept="acceptedFileTypes"
11
- multiple
12
- ref="upload"
12
+ @change="fileChange($event.target.files)"
13
13
  />
14
14
  <div v-if="!hasFiles" class="selectfile-container">
15
- <farm-icon class="upload-icon" color="secondary" size="lg" @click="addMoreFiles"
16
- >cloud-upload</farm-icon
17
- >
15
+ <farm-icon class="upload-icon" size="lg" @click="addMoreFiles">
16
+ cloud-upload
17
+ </farm-icon>
18
18
  <p>Clique para selecionar ou arraste o arquivo aqui</p>
19
19
  </div>
20
20
 
21
21
  <ul
22
+ v-if="downloadFiles.length"
22
23
  class="listFilesStyled listFilesStyled--download"
23
24
  :class="{
24
25
  'listFilesStyled--margin-bottom': files.length === 0,
25
26
  }"
26
- v-if="downloadFiles.length"
27
27
  >
28
28
  <li class="itemFilesStyled" v-for="file in downloadFiles" :key="file.id">
29
29
  <div class="itemFilesContentStyled">
@@ -66,26 +66,26 @@
66
66
  </div>
67
67
  </div>
68
68
  <div class="itemFilesContentButtonStyled">
69
- <span
70
- class="mdi mdi-close"
71
- aria-role="button"
69
+ <farm-btn
70
+ icon
72
71
  title="Remover"
72
+ color="neutral"
73
+ size="md"
73
74
  @click.prevent="remove(index)"
74
- ></span>
75
-
76
- <span class="mdi mdi-check" v-if="file.success"></span>
75
+ >
76
+ <farm-icon size="md">close</farm-icon>
77
+ </farm-btn>
78
+ <farm-icon size="md" color="neutral" v-if="file.success">check</farm-icon>
77
79
  </div>
78
80
  </li>
79
81
  </ul>
80
82
 
81
83
  <farm-btn
82
- depressed
84
+ v-if="hasFiles"
83
85
  outlined
84
86
  title="Escolher Outro"
85
- color="gray"
86
87
  class="farm-btn--responsive"
87
88
  :disabled="disabledButton"
88
- v-if="hasFiles"
89
89
  @click="addMoreFiles"
90
90
  >
91
91
  Escolher Outro
@@ -17,6 +17,14 @@ export const Primary = () => ({
17
17
  export const Structure = () => ({
18
18
  template: `
19
19
  <farm-container>
20
+ <farm-row>
21
+ <farm-col md="6" xs="12">
22
+ Main Filter
23
+ </farm-col>
24
+ <farm-col md="6" xs="12">
25
+ Botoes laterais
26
+ </farm-col>
27
+ </farm-row>
20
28
  <farm-box>
21
29
  Content<br />
22
30
  Content<br />
@@ -25,20 +33,20 @@ export const Structure = () => ({
25
33
  Content<br />
26
34
  </farm-box>
27
35
  <farm-row>
28
- <v-col md="6" lg="3">
36
+ <farm-col md="6" lg="3">
29
37
  coluna 1
30
- </v-col>
31
- <v-col md="6" lg="3">
38
+ </farm-col>
39
+ <farm-col md="6" lg="3">
32
40
  coluna 2
33
- </v-col>
34
- <v-col md="6" lg="3">
41
+ </farm-col>
42
+ <farm-col md="6" lg="3">
35
43
  coluna 3
36
- </v-col>
37
- <v-col md="6" lg="3">
44
+ </farm-col>
45
+ <farm-col md="6" lg="3">
38
46
  coluna 4
39
- </v-col>
47
+ </farm-col>
40
48
  </farm-row>
41
- <farm-row>
49
+ <farm-row extra-decrease="true">
42
50
  <farm-container-footer>
43
51
  Footer content
44
52
  </farm-container-footer>
@@ -1,5 +1,62 @@
1
+ @import '../../../configurations/mixins.scss';
2
+ @import '../../../configurations/functions.scss';
3
+
1
4
  .farm-col {
2
- width: 100%;
3
- padding: 12px;
4
- display: flex;
5
+ padding: 0 gutter('vuetify');
6
+ flex-basis: 0;
7
+ flex-grow: 1;
8
+ max-width: 100%;
9
+
10
+ &--no-gutters {
11
+ padding: 0;
12
+ }
13
+
14
+ @each $k in $aligns {
15
+ &#{'--align-' + $k} {
16
+ align-self: $k!important;
17
+ }
18
+ }
19
+ }
20
+
21
+ @for $i from 1 through 12 {
22
+ .farm-col--xs-#{$i * 1} {
23
+ flex: 0 0 (100/12 * $i)+#{"%"};
24
+ max-width: (100/12 * $i)+#{"%"};
25
+ }
26
+ }
27
+
28
+ @include fromXs {
29
+ @for $i from 1 through 12 {
30
+ .farm-col--sm-#{$i * 1} {
31
+ flex: 0 0 (100/12 * $i)+#{"%"};
32
+ max-width: (100/12 * $i)+#{"%"};
33
+ }
34
+ }
35
+ }
36
+
37
+ @include fromSm {
38
+ @for $i from 1 through 12 {
39
+ .farm-col--md-#{$i * 1} {
40
+ flex: 0 0 (100/12 * $i)+#{"%"};
41
+ max-width: (100/12 * $i)+#{"%"};
42
+ }
43
+ }
44
+ }
45
+
46
+ @include fromMd {
47
+ @for $i from 1 through 12 {
48
+ .farm-col--lg-#{$i * 1} {
49
+ flex: 0 0 (100/12 * $i)+#{"%"};
50
+ max-width: (100/12 * $i)+#{"%"};
51
+ }
52
+ }
53
+ }
54
+
55
+ @include fromLg {
56
+ @for $i from 1 through 12 {
57
+ .farm-col--xl-#{$i * 1} {
58
+ flex: 0 0 (100/12 * $i)+#{"%"};
59
+ max-width: (100/12 * $i)+#{"%"};
60
+ }
61
+ }
5
62
  }