@farm-investimentos/front-mfe-components 11.3.0 → 11.3.2

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 (31) hide show
  1. package/dist/front-mfe-components.common.js +475 -1030
  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 +475 -1030
  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/MultiImportButton/MultiImportButton.vue +0 -42
  10. package/src/components/Card/Card.scss +1 -0
  11. package/src/components/Card/Card.stories.js +6 -4
  12. package/src/components/Card/CardComposition.stories.ts +10 -0
  13. package/src/components/Checkbox/Checkbox.scss +17 -4
  14. package/src/components/Checkbox/Checkbox.stories.js +12 -0
  15. package/src/components/Checkbox/Checkbox.vue +20 -2
  16. package/src/components/ContextMenu/ContextMenu.scss +1 -0
  17. package/src/components/ContextMenu/ContextMenu.stories.js +59 -0
  18. package/src/components/ContextMenu/ContextMenu.vue +22 -8
  19. package/src/components/DataTableHeader/DataTableHeader.vue +5 -3
  20. package/src/components/IdCaption/IdCaption.stories.js +18 -1
  21. package/src/components/IdCaption/IdCaption.vue +2 -2
  22. package/src/components/MultipleFilePicker/MultipleFilePicker.scss +0 -4
  23. package/src/components/MultipleFilePicker/MultipleFilePicker.vue +16 -16
  24. package/src/components/layout/Col/Col.scss +52 -3
  25. package/src/components/layout/Col/Col.stories.js +113 -11
  26. package/src/components/layout/Col/Col.vue +32 -19
  27. package/src/components/layout/DisplayBreakpoints.stories.mdx +2 -0
  28. package/src/components/layout/GridSystem.stories.js +138 -0
  29. package/src/components/layout/Row/Row.scss +1 -1
  30. package/src/configurations/_mixins.scss +46 -0
  31. package/src/helpers/calculateMainZindex.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "11.3.0",
3
+ "version": "11.3.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -1,46 +1,4 @@
1
1
  <template>
2
- <!--
3
- <v-menu content-class="elevation-1" v-model="togglePopover" :offset-y="true" :rounded="'b t-0'">
4
- <template v-slot:activator="{ on, attrs }">
5
- <farm-btn
6
- v-bind="attrs"
7
- v-on="on"
8
- dense
9
- class="farm-btn--responsive farm-btn--import"
10
- outlined
11
- color="secondary"
12
- title="Importar"
13
- @onClick="togglePopover = true"
14
- >
15
- Importar
16
- <i
17
- :class="{
18
- 'ml-2': true,
19
- 'mr-0': true,
20
- mdi: true,
21
- 'mdi-chevron-up': togglePopover,
22
- 'mdi-chevron-down': !togglePopover,
23
- }"
24
- >
25
- </i>
26
- </farm-btn>
27
- </template>
28
-
29
- <v-list dense class="pa-0">
30
- <v-list-item
31
- v-for="option in optionsList"
32
- :key="option.listenerKey"
33
- link
34
- :title="option.title"
35
- @click="$emit('onClick', option.listenerKey)"
36
- >
37
- <v-list-item-content>
38
- <v-list-item-title>{{ option.title }}</v-list-item-title>
39
- </v-list-item-content>
40
- </v-list-item>
41
- </v-list>
42
- </v-menu>
43
- -->
44
2
  <farm-contextmenu v-model="value" :bottom="true">
45
3
  <template v-slot:activator="{}">
46
4
  <farm-btn outlined title="Importar" color="secondary" @click="toggleValue">
@@ -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
 
@@ -82,21 +95,22 @@ export default Vue.extend({
82
95
 
83
96
  const calculatePosition = () => {
84
97
  const parentBoundingClientRect = parent.value.getBoundingClientRect();
98
+ const activatorBoundingClientRect = activator.value.children[0].getBoundingClientRect();
85
99
  const popupClientRect = popup.value.getBoundingClientRect();
86
100
 
87
101
  let offsetTop =
88
102
  parentBoundingClientRect.top +
89
103
  window.scrollY +
90
- (!bottom.value ? 0 : parentBoundingClientRect.height);
104
+ (!bottom.value ? 0 : activatorBoundingClientRect.height);
91
105
 
92
- let offsetLeft = parentBoundingClientRect.left;
93
- if (popupClientRect.width > parentBoundingClientRect.width) {
106
+ let offsetLeft = activatorBoundingClientRect.left;
107
+ if (popupClientRect.width > activatorBoundingClientRect.width) {
94
108
  offsetLeft =
95
- offsetLeft + parentBoundingClientRect.width / 2 - popupClientRect.width / 2;
109
+ offsetLeft + activatorBoundingClientRect.width / 2 - popupClientRect.width / 2;
96
110
  }
97
111
  styles.minWidth =
98
- (parentBoundingClientRect.width > 96
99
- ? parseInt(parentBoundingClientRect.width)
112
+ (activatorBoundingClientRect.width > 96
113
+ ? parseInt(activatorBoundingClientRect.width)
100
114
  : 96) + 'px';
101
115
 
102
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>
@@ -4,7 +4,7 @@ import IdCaption from './';
4
4
  export default {
5
5
  title: 'Display/IdCaption',
6
6
  component: IdCaption,
7
- decorators: [withDesign],
7
+ decorators: [withDesign],
8
8
  parameters: {
9
9
  docs: {
10
10
  description: {
@@ -132,3 +132,20 @@ export const IconBoxCustomColor = () => ({
132
132
  </farm-idcaption>
133
133
  `,
134
134
  });
135
+
136
+ export const CustomTag = () => ({
137
+ template: `
138
+ <farm-idcaption
139
+ icon="account-box-outline"
140
+ copyText="texto a copiar"
141
+ :link="true"
142
+ >
143
+ <template v-slot:title>
144
+ <b>Upper Line Text</b>
145
+ </template>
146
+ <template v-slot:subtitle>
147
+ <b>Lower:</b> Line Text Line Text Line Text
148
+ </template>
149
+ </farm-idcaption>
150
+ `,
151
+ });
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <farm-caption variation="medium" v-if="hasTitle">
8
8
  <span>
9
- {{ $slots.title ? $slots.title[0].text : null }}
9
+ <slot name="title"></slot>
10
10
  <farm-btn icon color="gray" v-if="link" @click="$emit('onLinkClick')">
11
11
  <farm-icon size="xs">open-in-new</farm-icon>
12
12
  </farm-btn>
@@ -15,7 +15,7 @@
15
15
 
16
16
  <farm-caption variation="regular" color="gray" v-if="hasSubtitle">
17
17
  <span>
18
- {{ $slots.subtitle ? $slots.subtitle[0].text : null }}
18
+ <slot name="subtitle"></slot>
19
19
  <farm-copytoclipboard v-if="copyText" :toCopy="copyText" />
20
20
  </span>
21
21
  </farm-caption>
@@ -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
@@ -1,5 +1,54 @@
1
+ @import '../../../configurations/mixins.scss';
2
+
1
3
  .farm-col {
2
- width: 100%;
3
- padding: 12px;
4
- display: flex;
4
+ flex: 0 0 100%;
5
+ max-width: 100%;
6
+ padding: 0 24px;
7
+
8
+ &--no-gutters {
9
+ padding: 0;
10
+ }
11
+ }
12
+
13
+ @for $i from 1 through 12 {
14
+ .farm-col--xs-#{$i * 1} {
15
+ flex: 0 0 (100/12 * $i)+#{"%"};
16
+ max-width: (100/12 * $i)+#{"%"};
17
+ }
18
+ }
19
+
20
+ @include fromXs {
21
+ @for $i from 1 through 12 {
22
+ .farm-col--sm-#{$i * 1} {
23
+ flex: 0 0 (100/12 * $i)+#{"%"};
24
+ max-width: (100/12 * $i)+#{"%"};
25
+ }
26
+ }
27
+ }
28
+
29
+ @include fromSm {
30
+ @for $i from 1 through 12 {
31
+ .farm-col--md-#{$i * 1} {
32
+ flex: 0 0 (100/12 * $i)+#{"%"};
33
+ max-width: (100/12 * $i)+#{"%"};
34
+ }
35
+ }
36
+ }
37
+
38
+ @include fromMd {
39
+ @for $i from 1 through 12 {
40
+ .farm-col--lg-#{$i * 1} {
41
+ flex: 0 0 (100/12 * $i)+#{"%"};
42
+ max-width: (100/12 * $i)+#{"%"};
43
+ }
44
+ }
45
+ }
46
+
47
+ @include fromLg {
48
+ @for $i from 1 through 12 {
49
+ .farm-col--xl-#{$i * 1} {
50
+ flex: 0 0 (100/12 * $i)+#{"%"};
51
+ max-width: (100/12 * $i)+#{"%"};
52
+ }
53
+ }
5
54
  }