@farm-investimentos/front-mfe-components 11.3.1 → 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 (27) hide show
  1. package/dist/front-mfe-components.common.js +436 -993
  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 +436 -993
  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/Card/Card.scss +1 -0
  10. package/src/components/Card/Card.stories.js +6 -4
  11. package/src/components/Card/CardComposition.stories.ts +10 -0
  12. package/src/components/Checkbox/Checkbox.scss +17 -4
  13. package/src/components/Checkbox/Checkbox.stories.js +12 -0
  14. package/src/components/Checkbox/Checkbox.vue +20 -2
  15. package/src/components/ContextMenu/ContextMenu.scss +1 -0
  16. package/src/components/ContextMenu/ContextMenu.stories.js +59 -0
  17. package/src/components/ContextMenu/ContextMenu.vue +19 -8
  18. package/src/components/DataTableHeader/DataTableHeader.vue +5 -3
  19. package/src/components/MultipleFilePicker/MultipleFilePicker.scss +0 -4
  20. package/src/components/MultipleFilePicker/MultipleFilePicker.vue +16 -16
  21. package/src/components/layout/Col/Col.scss +52 -3
  22. package/src/components/layout/Col/Col.stories.js +113 -11
  23. package/src/components/layout/Col/Col.vue +32 -19
  24. package/src/components/layout/DisplayBreakpoints.stories.mdx +2 -0
  25. package/src/components/layout/GridSystem.stories.js +138 -0
  26. package/src/components/layout/Row/Row.scss +1 -1
  27. package/src/configurations/_mixins.scss +46 -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.3.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -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
@@ -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
  }
@@ -7,36 +7,138 @@ export default {
7
7
  docs: {
8
8
  description: {
9
9
  component: `Col<br />
10
- selector: <em>farm-col</em><br />
11
- <span style="color: var(--farm-extra-1-base);">development</span>
12
- `,
10
+ selector: <em>farm-col</em><br />
11
+ <span style="color: var(--farm-extra-1-base);">development</span>
12
+ `,
13
13
  },
14
14
  },
15
15
  viewMode: 'docs',
16
16
  },
17
17
  };
18
18
 
19
+ const style = {
20
+ border: '1px solid var(--farm-extra-1-darken)',
21
+ backgroundColor: 'var(--farm-extra-1-lighten)',
22
+ };
23
+
19
24
  export const Primary = () => ({
20
- template: '<farm-col>col</farm-col>',
25
+ data() {
26
+ return {
27
+ style,
28
+ };
29
+ },
30
+ template: '<farm-col :style="style">col</farm-col>',
21
31
  });
22
32
  export const Xl = () => ({
23
- template: '<farm-col xl="3">xl: 3</farm-col>',
33
+ data() {
34
+ return {
35
+ style,
36
+ };
37
+ },
38
+ template: `<farm-row>
39
+ <farm-col xl="4" :style="style">4</farm-col>
40
+ <farm-col xl="6" :style="style">6</farm-col>
41
+ <farm-col xl="12" :style="style">12</farm-col>
42
+ <farm-col xl="2" :style="style">2</farm-col>
43
+ </farm-row>`,
24
44
  });
25
45
  export const Lg = () => ({
26
- template: '<farm-col lg="4">lg: 4</farm-col>',
46
+ data() {
47
+ return {
48
+ style,
49
+ };
50
+ },
51
+ template: `<farm-row>
52
+ <farm-col lg="4" :style="style">4</farm-col>
53
+ <farm-col lg="6" :style="style">6</farm-col>
54
+ <farm-col lg="12" :style="style">12</farm-col>
55
+ <farm-col lg="2" :style="style">2</farm-col>
56
+ </farm-row>`,
27
57
  });
28
58
  export const Md = () => ({
29
- template: '<farm-col md="6">md: 6</farm-col>',
59
+ data() {
60
+ return {
61
+ style,
62
+ };
63
+ },
64
+ template: `<farm-row>
65
+ <farm-col md="4" :style="style">4</farm-col>
66
+ <farm-col md="6" :style="style">6</farm-col>
67
+ <farm-col md="12" :style="style">12</farm-col>
68
+ <farm-col md="2" :style="style">2</farm-col>
69
+ </farm-row>`,
30
70
  });
71
+
31
72
  export const Sm = () => ({
32
- template: '<farm-col sm="4">sm: 4</farm-col>',
73
+ data() {
74
+ return {
75
+ style,
76
+ };
77
+ },
78
+ template: `<farm-row>
79
+ <farm-col sm="4" :style="style">4</farm-col>
80
+ <farm-col sm="6" :style="style">6</farm-col>
81
+ <farm-col sm="12" :style="style">12</farm-col>
82
+ <farm-col sm="2" :style="style">2</farm-col>
83
+ </farm-row>`,
33
84
  });
85
+
34
86
  export const Xs = () => ({
35
- template: '<farm-col xs="4">xs: 4</farm-col>',
87
+ data() {
88
+ return {
89
+ style,
90
+ };
91
+ },
92
+ template: `<farm-row>
93
+ <farm-col xs="4" :style="style">4</farm-col>
94
+ <farm-col xs="6" :style="style">6</farm-col>
95
+ <farm-col xs="12" :style="style">12</farm-col>
96
+ <farm-col xs="2" :style="style">2</farm-col>
97
+ </farm-row>`,
36
98
  });
99
+
37
100
  export const Combination = () => ({
38
- template: '<farm-col xl="3" xs="4">xl: 3 - xs: 4</farm-col>',
101
+ data() {
102
+ return {
103
+ style,
104
+ };
105
+ },
106
+ template: `<div>
107
+ <farm-col lg="5" md="4" sm="3" :style="style">lg: 5 - md: 4 - sm: 3</farm-col>
108
+ </div>`,
39
109
  });
40
110
  export const TagP = () => ({
41
111
  template: '<farm-col tag="p">col</farm-col>',
42
- });
112
+ });
113
+
114
+ export const CompareToVCol = () => ({
115
+ data() {
116
+ return {
117
+ style,
118
+ };
119
+ },
120
+ template: `<div>
121
+
122
+ <h4>LG 3</h4>
123
+ <farm-col lg="3" :style="style">farm</farm-col>
124
+ <v-col lg="3" :style="style">v-col</v-col>
125
+
126
+ <h4>MD 3</h4>
127
+ <farm-col md="3" :style="style">farm</farm-col>
128
+ <v-col md="3" :style="style">v-col</v-col>
129
+
130
+
131
+ <h4>SM 3</h4>
132
+ <farm-col sm="3" :style="style">farm</farm-col>
133
+ <v-col sm="3" :style="style">v-col</v-col>
134
+ </div>`,
135
+ });
136
+
137
+ export const NoGutters = () => ({
138
+ data() {
139
+ return {
140
+ style,
141
+ };
142
+ },
143
+ template: '<farm-col :no-gutters="true" :style="style">col</farm-col>',
144
+ });