@farm-investimentos/front-mfe-components 9.0.0 → 9.1.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 +350 -176
  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 +350 -176
  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/DefaultButton/DefaultButton.scss +11 -2
  10. package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +8 -0
  11. package/src/components/Buttons/DefaultButton/DefaultButton.vue +15 -15
  12. package/src/components/Buttons/DefaultButton/__tests__/DefaultButton.spec.js +0 -4
  13. package/src/components/Chip/Chip.stories.js +1 -1
  14. package/src/components/DataTableHeader/DataTableHeader.scss +5 -3
  15. package/src/components/DataTableHeader/DataTableHeader.vue +6 -7
  16. package/src/components/DataTablePaginator/DataTablePaginator.stories.js +1 -1
  17. package/src/components/DatePicker/DatePicker.vue +8 -1
  18. package/src/components/IconBox/IconBox.scss +17 -5
  19. package/src/components/IconBox/IconBox.stories.js +18 -1
  20. package/src/components/IconBox/IconBox.vue +18 -2
  21. package/src/components/IdCaption/IdCaption.scss +36 -0
  22. package/src/components/IdCaption/IdCaption.stories.js +116 -0
  23. package/src/components/IdCaption/IdCaption.vue +63 -0
  24. package/src/components/IdCaption/__tests__/IdCaption.spec.js +14 -0
  25. package/src/components/IdCaption/index.ts +3 -0
  26. package/src/configurations/_theme-colors-base.scss +8 -0
  27. package/src/configurations/_theme-colors-variations.scss +9 -0
  28. package/src/examples/Colors.stories.js +28 -0
  29. package/src/examples/Colors.stories.scss +15 -0
  30. package/src/main.ts +2 -0
  31. package/src/scss/Sticky-table.scss +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "9.0.0",
3
+ "version": "9.1.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -36,7 +36,7 @@
36
36
  display: flex;
37
37
  flex-direction: row;
38
38
  align-items: center;
39
-
39
+
40
40
  ::v-deep i.mdi {
41
41
  font-size: 1rem;
42
42
  }
@@ -83,7 +83,6 @@
83
83
  }
84
84
 
85
85
  &:not(.farm-btn--plain):not(.farm-btn--disabled):active {
86
- box-shadow: 0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%);
87
86
 
88
87
  &:before {
89
88
  opacity: 0.16;
@@ -214,6 +213,16 @@
214
213
 
215
214
  }
216
215
 
216
+ .farm-btn--outlined.farm-btn--disabled {
217
+ border: 1px solid #D6D6D6;
218
+ color: #D6D6D6;
219
+ background-color: white;
220
+
221
+ i.mdi.farm-icon {
222
+ color: white;
223
+ }
224
+ }
225
+
217
226
  .farm-btn--elevated {
218
227
  box-shadow: 0px 3px 1px -2px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%), 0px 1px 5px 0px rgb(0 0 0 / 12%);
219
228
  }
@@ -15,6 +15,10 @@ export default {
15
15
  selector: <em>farm-btn</em>
16
16
  `,
17
17
  },
18
+ design: {
19
+ type: 'figma',
20
+ url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=2491%3A4486',
21
+ },
18
22
  },
19
23
  viewMode: 'docs',
20
24
  },
@@ -224,3 +228,7 @@ export const Sizes = () => ({
224
228
  </div>
225
229
  </div>`,
226
230
  });
231
+
232
+ export const Elevated = () => ({
233
+ template: '<farm-btn :elevated="true">Elevated</farm-btn>',
234
+ });
@@ -48,10 +48,23 @@ export default Vue.extend({
48
48
  * Outlined
49
49
  */
50
50
  outlined: { type: Boolean, default: false },
51
+ /**
52
+ * Is plain
53
+ */
51
54
  plain: { type: Boolean, default: false },
55
+ /**
56
+ * Is disabled
57
+ */
52
58
  disabled: { type: Boolean, default: false },
59
+ /**
60
+ * Is rounded
61
+ */
53
62
  rounded: { type: Boolean, default: false },
54
63
  icon: { type: Boolean, default: false },
64
+ /**
65
+ * Has elevation
66
+ */
67
+ elevated: { type: Boolean, default: false },
55
68
  type: {
56
69
  type: String,
57
70
  default: 'button',
@@ -61,9 +74,7 @@ export default Vue.extend({
61
74
  default: null,
62
75
  },
63
76
  size: {
64
- type: String as PropType<
65
- 'xs' | 'sm' | 'md' | 'lg' | 'xl'
66
- >,
77
+ type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
67
78
  default: 'default',
68
79
  },
69
80
  },
@@ -78,7 +89,7 @@ export default Vue.extend({
78
89
  });
79
90
  return {
80
91
  'farm-btn': true,
81
- 'farm-btn--elevated': this.isElevated,
92
+ 'farm-btn--elevated': this.elevated,
82
93
  'farm-btn--round': this.isRound,
83
94
  'farm-btn--rounded': this.rounded,
84
95
  'farm-btn--icon': this.icon,
@@ -89,17 +100,6 @@ export default Vue.extend({
89
100
  isRound(): boolean {
90
101
  return Boolean(this.icon || this.fab);
91
102
  },
92
- isElevated(): boolean {
93
- return Boolean(
94
- !this.icon &&
95
- !this.text &&
96
- !this.outlined &&
97
- !this.depressed &&
98
- !this.disabled &&
99
- !this.plain &&
100
- (this.elevation == null || Number(this.elevation) > 0)
101
- );
102
- },
103
103
  },
104
104
  });
105
105
  </script>
@@ -24,10 +24,6 @@ describe('DefaultButton component', () => {
24
24
  expect(component.isRound).toBeTruthy();
25
25
  });
26
26
 
27
- it('get isElevated false', () => {
28
- expect(component.isElevated).toBeTruthy();
29
- });
30
-
31
27
  it('get classes', () => {
32
28
  expect(component.classes).toBeDefined();
33
29
  });
@@ -53,4 +53,4 @@ export const Variations = () => ({
53
53
  </farm-chip>
54
54
  </div>
55
55
  </div>`,
56
- });
56
+ });
@@ -1,13 +1,15 @@
1
1
  .header-text {
2
2
  position: relative;
3
- i {
3
+ color: var(--v-primary-base);
4
+ font-size: 12px;
5
+ .farm-icon {
4
6
  position: absolute;
5
7
  right: -20px;
6
8
  top: -1px;
7
9
  }
8
10
 
9
- .v-icon {
10
- &.v-icon--asc {
11
+ .farm-icon {
12
+ &.farm-icon--asc {
11
13
  transform: rotateX(180deg);
12
14
  }
13
15
  }
@@ -21,15 +21,16 @@
21
21
  <span class="header-text" v-if="!isTHDataTableSelect(item)">
22
22
  {{ item.text }}
23
23
 
24
- <v-icon
24
+ <farm-icon
25
25
  v-if="item.sortable && sortClick[$index].show"
26
26
  v-bind:class="[
27
- sortClick[$index][item.value] ? 'v-icon--desc' : 'v-icon--asc',
27
+ sortClick[$index][item.value] ? 'farm-icon--desc' : 'farm-icon--asc',
28
28
  ]"
29
- small
29
+ size="sm"
30
+ color="gray"
30
31
  >
31
- mdi-sort-descending
32
- </v-icon>
32
+ sort-descending
33
+ </farm-icon>
33
34
  </span>
34
35
 
35
36
  <span v-if="isTHDataTableSelect(item) && showCheckbox">
@@ -47,13 +48,11 @@
47
48
  <script>
48
49
  /* eslint-disable */
49
50
  import Vue from 'vue';
50
- import VIcon from 'vuetify/lib/components/VIcon';
51
51
  import VSimpleCheckbox from 'vuetify/lib/components/VCheckbox/VSimpleCheckbox';
52
52
 
53
53
  export default Vue.extend({
54
54
  name: 'farm-datatable-header',
55
55
  components: {
56
- VIcon,
57
56
  VSimpleCheckbox,
58
57
  },
59
58
  props: {
@@ -38,7 +38,7 @@ export const Primary = () => ({
38
38
 
39
39
  export const Secondary = () => ({
40
40
  components: { DataTablePaginator },
41
- template: '<DataTablePaginator :hidePerPageOptions="true" :totalPages="19" :page="1" />',
41
+ template: '<DataTablePaginator :hidePerPageOptions="true" :totalPages="190000" :page="1" />',
42
42
  });
43
43
 
44
44
  export const Disabled = () => ({
@@ -136,7 +136,9 @@ export default Vue.extend({
136
136
  timeZone: 'America/Sao_Paulo',
137
137
  });
138
138
 
139
- return this.min && locatedSelectedDate < locatedMinDate
139
+ console.log(this.getUniversalDate(locatedSelectedDate), this.getUniversalDate(locatedMinDate));
140
+
141
+ return this.min && this.getUniversalDate(locatedSelectedDate) < this.getUniversalDate(locatedMinDate)
140
142
  ? 'A data está fora do período permitido'
141
143
  : true;
142
144
  },
@@ -174,6 +176,11 @@ export default Vue.extend({
174
176
  this.save();
175
177
  }
176
178
  },
179
+ getUniversalDate(d) {
180
+ const onlyDMY = d.split(' ')[0];
181
+ const arr = onlyDMY.split('/');
182
+ return new Date(arr[2], arr[1] -1, arr[0]);
183
+ },
177
184
  },
178
185
  computed: {
179
186
  inputVal: {
@@ -9,9 +9,21 @@
9
9
  align-items: center;
10
10
 
11
11
  @each $color in $colors {
12
- &#{'--' + $color} {
13
- background: var(--v-#{$color}-lighten5);
14
- }
15
- }
16
-
12
+ &#{'--' + $color} {
13
+ background: var(--v-#{$color}-lighten5);
14
+ }
15
+ }
17
16
  }
17
+
18
+ .farm-icon-box--inverted.farm-icon-box {
19
+ @each $color in $colors {
20
+ &#{'--' + $color} {
21
+ background: var(--v-#{$color}-base);
22
+ }
23
+ }
24
+
25
+ .farm-icon.farm-icon--white {
26
+ color: white;
27
+ }
28
+
29
+ }
@@ -25,7 +25,7 @@ export const Primary = () => ({
25
25
  </div>`,
26
26
  });
27
27
 
28
- export const IconBoxes = () => ({
28
+ export const Colors = () => ({
29
29
  data() {
30
30
  return {
31
31
  colors,
@@ -54,3 +54,20 @@ export const Sizes = () => ({
54
54
 
55
55
  </div>`,
56
56
  });
57
+
58
+ export const Inverted = () => ({
59
+ data() {
60
+ return {
61
+ colors,
62
+ };
63
+ },
64
+ template: `<div class="icons-container">
65
+ <farm-icon-box
66
+ v-for="color of colors"
67
+ :key="'inverted_' + color"
68
+ :color="color"
69
+ :inverted="true"
70
+ icon="book"
71
+ />
72
+ </div>`,
73
+ });
@@ -1,6 +1,15 @@
1
1
  <template>
2
- <div :class="{ 'farm-icon-box': true, [cssColorClass]: true }" :size="size">
3
- <farm-icon :color="color" :size="size">{{ iconParsed }}</farm-icon>
2
+ <div
3
+ :class="{
4
+ 'farm-icon-box': true,
5
+ [cssColorClass]: true,
6
+ 'farm-icon-box--inverted': inverted,
7
+ }"
8
+ :size="size"
9
+ >
10
+ <farm-icon :color="inverted ? 'white' : color" :size="size">{{
11
+ iconParsed
12
+ }}</farm-icon>
4
13
  </div>
5
14
  </template>
6
15
 
@@ -28,6 +37,13 @@ export default Vue.extend({
28
37
  type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
29
38
  default: 'md',
30
39
  },
40
+ /**
41
+ * INverted
42
+ */
43
+ inverted: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
31
47
  },
32
48
  computed: {
33
49
  iconParsed() {
@@ -0,0 +1,36 @@
1
+ .idcaption {
2
+ display: flex;
3
+
4
+ .farm-icon-box {
5
+ margin-right: 8px;
6
+ }
7
+
8
+ &__body {
9
+
10
+ display: flex;
11
+ flex-direction: column;
12
+ justify-content: space-between;
13
+ align-content: flex-start;
14
+
15
+ &--single {
16
+ justify-content: center;
17
+ }
18
+
19
+ .farm-typography {
20
+
21
+ margin-bottom: 0;
22
+ display: flex;
23
+ flex: none;
24
+ > span {
25
+ position: relative;
26
+ }
27
+ }
28
+
29
+ .farm-btn,
30
+ .farm-tooltip {
31
+ position: absolute;
32
+ right: -30px;
33
+ top: -8px;
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,116 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import IdCaption from './';
3
+
4
+ export default {
5
+ title: 'Display/IdCaption',
6
+ component: IdCaption,
7
+ decorators: [withDesign],
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `Id Caption<br />
12
+ selector: <em>farm-idcaption</em>
13
+ `,
14
+ },
15
+ },
16
+ design: {
17
+ type: 'figma',
18
+ url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=4087%3A6463',
19
+ },
20
+ viewMode: 'docs',
21
+ },
22
+ };
23
+
24
+ export const Primary = () => ({
25
+ template: `
26
+ <farm-idcaption
27
+ icon="account-box-outline"
28
+ copyText="texto a copiar"
29
+ :link="true"
30
+ >
31
+ <template v-slot:title>
32
+ Upper Line Text
33
+ </template>
34
+ <template v-slot:subtitle>
35
+ Lower: Line Text Line Text Line Text
36
+ </template>
37
+ </farm-idcaption>
38
+ `,
39
+ });
40
+
41
+ export const Linkless = () => ({
42
+ template: `
43
+ <farm-idcaption
44
+ icon="account-box-outline"
45
+ copyText="texto a copiar"
46
+ >
47
+ <template v-slot:title>
48
+ Upper Line Text
49
+ </template>
50
+ <template v-slot:subtitle>
51
+ Lower:Line Text
52
+ </template>
53
+ </farm-idcaption>
54
+
55
+ `,
56
+ });
57
+
58
+ export const Iconless = () => ({
59
+ template: `
60
+ <farm-idcaption
61
+ copyText="texto a copiar"
62
+ :link="true"
63
+ >
64
+ <template v-slot:title>
65
+ Upper Line Text
66
+ </template>
67
+ <template v-slot:subtitle>
68
+ Lower:Line Text
69
+ </template>
70
+ </farm-idcaption>
71
+ `,
72
+ });
73
+
74
+ export const NoUpperText = () => ({
75
+ template: `
76
+ <farm-idcaption
77
+ icon="account-box-outline"
78
+ copyText="texto a copiar"
79
+ :link="true"
80
+ >
81
+ <template v-slot:subtitle>
82
+ Lower:Line Text
83
+ </template>
84
+ </farm-idcaption>
85
+ `,
86
+ });
87
+
88
+ export const NoBottomText = () => ({
89
+ template: `
90
+ <farm-idcaption
91
+ icon="account-box-outline"
92
+ copyText="texto a copiar"
93
+ :link="true"
94
+ >
95
+ <template v-slot:title>
96
+ Upper Line Text
97
+ </template>
98
+ </farm-idcaption>
99
+ `,
100
+ });
101
+
102
+ export const NoTextToClip = () => ({
103
+ template: `
104
+ <farm-idcaption
105
+ icon="account-box-outline"
106
+ :link="true"
107
+ >
108
+ <template v-slot:title>
109
+ Upper Line Text
110
+ </template>
111
+ <template v-slot:subtitle>
112
+ Lower:Line Text
113
+ </template>
114
+ </farm-idcaption>
115
+ `,
116
+ });
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div class="idcaption">
3
+ <farm-icon-box v-if="icon" :icon="icon" color="secondary" size="md" />
4
+ <div
5
+ :class="{ idcaption__body: true, 'idcaption__body--single': !hasTitle || !hasSubtitle }"
6
+ >
7
+ <farm-caption bold variation="medium" v-if="hasTitle">
8
+ <span>
9
+ {{ $slots.title ? $slots.title[0].text : null }}
10
+ <farm-btn icon color="gray" v-if="link" @click="$emit('onLinkClick')">
11
+ <farm-icon size="xs">open-in-new</farm-icon>
12
+ </farm-btn>
13
+ </span>
14
+ </farm-caption>
15
+
16
+ <farm-caption variation="regular" color="gray" v-if="hasSubtitle">
17
+ <span>
18
+ {{ $slots.subtitle ? $slots.subtitle[0].text : null }}
19
+ <farm-copytoclipboard v-if="copyText" :toCopy="copyText" />
20
+ </span>
21
+ </farm-caption>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <script lang="ts">
27
+ import Vue, { computed } from 'vue';
28
+ export default Vue.extend({
29
+ name: 'farm-idcaption',
30
+ props: {
31
+ /**
32
+ * Icon
33
+ */
34
+ icon: {
35
+ type: String,
36
+ },
37
+ /**
38
+ * copy to clipboard
39
+ */
40
+ copyText: {
41
+ type: String,
42
+ },
43
+ /**
44
+ * Has link?
45
+ */
46
+ link: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ },
51
+
52
+ setup(_, { slots }) {
53
+ const hasTitle = computed(() => slots.title);
54
+ const hasSubtitle = computed(() => slots.subtitle);
55
+
56
+ return { hasSubtitle, hasTitle };
57
+ },
58
+ });
59
+ </script>
60
+
61
+ <style lang="scss" scoped>
62
+ @import './IdCaption.scss';
63
+ </style>
@@ -0,0 +1,14 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import IdCaption from '../IdCaption.vue';
3
+
4
+ describe('FilePicker component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(IdCaption);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+ });
@@ -0,0 +1,3 @@
1
+ import IdCaption from './IdCaption.vue';
2
+
3
+ export default IdCaption;
@@ -0,0 +1,8 @@
1
+ @import './theme-colors';
2
+
3
+ :export {
4
+ @each $name,
5
+ $color in $theme-colors {
6
+ #{$name}: themeColor($name);
7
+ }
8
+ }
@@ -0,0 +1,9 @@
1
+ @import './theme-colors';
2
+
3
+ :export {
4
+ @each $name,
5
+ $color in $theme-colors {
6
+ #{$name + "-lighten"}: themeColor($name, "lighten");
7
+ #{$name + "-darken"}: themeColor($name, "darken");
8
+ }
9
+ }
@@ -0,0 +1,28 @@
1
+ import baseThemeColors from '../configurations/_theme-colors-base.scss';
2
+ import variationThemeColors from '../configurations/_theme-colors-variations.scss';
3
+ import('./Colors.stories.scss');
4
+
5
+ export default {
6
+ title: 'Colors/Pallete',
7
+ };
8
+
9
+ export const NamesAndValues = () => ({
10
+ data() {
11
+ return {
12
+ baseThemeColors: { ...baseThemeColors },
13
+ keys: Object.keys(baseThemeColors),
14
+ variationThemeColors: { ...variationThemeColors },
15
+ };
16
+ },
17
+ template: `<div class="palette-container">
18
+ <div
19
+ v-for="key in keys"
20
+ :key="key"
21
+ >
22
+ <farm-heading :type="5">{{ key }}</farm-heading>
23
+ <span :style="{ backgroundColor: baseThemeColors[key] }">Base {{ baseThemeColors[key] }}</span>
24
+ <span :style="{ backgroundColor: variationThemeColors[key + '-lighten'] }">Lighten: {{ variationThemeColors[key + '-lighten'] }}</span>
25
+ <span :style="{ backgroundColor: variationThemeColors[key + '-darken'], color: 'white' }">Darken: {{ variationThemeColors[key + '-darken'] }}</span>
26
+ </div>
27
+ </div>`,
28
+ });
@@ -0,0 +1,15 @@
1
+ .palette-container {
2
+ display: flex;
3
+ flex-direction: row;
4
+
5
+ >div {
6
+ display: flex;
7
+ flex-direction: column;
8
+ width: calc(25% - 32px);
9
+ margin: auto 16px;
10
+
11
+ span {
12
+ padding: 4px 8px;
13
+ }
14
+ }
15
+ }
package/src/main.ts CHANGED
@@ -22,6 +22,7 @@ import CardContext from './components/CardContext';
22
22
 
23
23
  import DefaultButton from './components/Buttons/DefaultButton';
24
24
  import Collapsible from './components/Collapsible';
25
+ import IdCaption from './components/IdCaption';
25
26
 
26
27
  export {
27
28
  DataTableEmptyWrapper,
@@ -45,6 +46,7 @@ export {
45
46
  IconBox,
46
47
  CardContext,
47
48
  Collapsible,
49
+ IdCaption,
48
50
  };
49
51
 
50
52
  export * from './components/AlertReload';
@@ -10,7 +10,7 @@ $defaultLefts: 0, 4rem, 4rem;
10
10
  tr td {
11
11
  background-color: white;
12
12
  }
13
- tr th {
13
+ .v-data-table-header tr th {
14
14
  color: var(--v-primary-base);
15
15
  text-transform: uppercase;
16
16
  font-weight: bold;