@farm-investimentos/front-mfe-components 10.0.1 → 10.1.1

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 (48) hide show
  1. package/dist/front-mfe-components.common.js +332 -209
  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 +332 -209
  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.stories.js +1 -1
  10. package/src/components/Card/CardContent/CardContent.vue +5 -2
  11. package/src/components/Checkbox/Checkbox.stories.js +1 -1
  12. package/src/components/Chip/Chip.stories.js +1 -1
  13. package/src/components/DialogHeader/DialogHeader.scss +4 -2
  14. package/src/components/DialogHeader/DialogHeader.vue +3 -5
  15. package/src/components/Form/Form.stories.js +1 -1
  16. package/src/components/Form/Form.vue +1 -1
  17. package/src/components/Form/__tests__/Form.spec.js +0 -1
  18. package/src/components/Icon/Icon.stories.js +1 -1
  19. package/src/components/ListItem/ListItem.stories.js +1 -1
  20. package/src/components/Loader/Loader.stories.ts +1 -1
  21. package/src/components/Logger/Logger.stories.js +1 -1
  22. package/src/components/MainFilter/MainFilter.scss +5 -1
  23. package/src/components/MainFilter/MainFilter.stories.js +23 -1
  24. package/src/components/MainFilter/MainFilter.vue +16 -5
  25. package/src/components/Modal/Modal.scss +2 -1
  26. package/src/components/Modal/Modal.stories.js +1 -1
  27. package/src/components/Modal/Modal.vue +1 -1
  28. package/src/components/ModalPromptUser/ModalPromptUser.stories.js +1 -1
  29. package/src/components/RadioGroup/RadioGroup.stories.js +1 -1
  30. package/src/components/TableContextMenu/TableContextMenu.stories.js +1 -1
  31. package/src/components/Tooltip/Tooltip.scss +12 -11
  32. package/src/components/Tooltip/Tooltip.stories.js +12 -38
  33. package/src/components/Tooltip/Tooltip.vue +18 -17
  34. package/src/components/layout/Basic.stories.js +2 -2
  35. package/src/components/layout/Box/Box.scss +20 -0
  36. package/src/components/layout/Box/Box.stories.js +66 -0
  37. package/src/components/layout/Box/Box.vue +43 -0
  38. package/src/components/layout/Box/__tests__/Box.spec.js +21 -0
  39. package/src/components/layout/Box/index.ts +4 -0
  40. package/src/components/layout/Col/__tests__/Col.spec.js +0 -1
  41. package/src/components/layout/Container/Container.stories.js +1 -1
  42. package/src/components/layout/ContainerFooter/Container.stories.js +1 -1
  43. package/src/components/layout/Row/Row.scss +1 -3
  44. package/src/components/layout/Row/Row.stories.js +3 -2
  45. package/src/components/layout/Row/__tests__/Row.spec.js +0 -1
  46. package/src/configurations/_variables.scss +8 -3
  47. package/src/configurations/flexVariables.ts +4 -0
  48. 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": "10.0.1",
3
+ "version": "10.1.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -8,7 +8,7 @@ export default {
8
8
  description: {
9
9
  component: `Card<br />
10
10
  selector: <em>farm-card</em><br />
11
- <span style="color: green;">ready for use</span>
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
12
12
  `,
13
13
  },
14
14
  },
@@ -5,13 +5,16 @@
5
5
  </template>
6
6
 
7
7
  <script lang="ts">
8
- import Vue from 'vue';
8
+ import Vue, { PropType } from 'vue';
9
9
 
10
10
  export default Vue.extend({
11
11
  name: 'farm-card-content',
12
12
  props: {
13
13
  tag: { type: String, default: 'div' },
14
- gutter: { type: String, default: 'default' },
14
+ gutter: {
15
+ type: String as PropType<'none' | 'xs' | 'sm' | 'default' | 'md' | 'lg' | 'xl'>,
16
+ default: 'default',
17
+ },
15
18
  },
16
19
  inheritAttrs: true,
17
20
  });
@@ -12,7 +12,7 @@ export default {
12
12
  description: {
13
13
  component: `Checkbox<br />
14
14
  selector: <em>farm-checkbox</em><br />
15
- <span style="color: green;">ready for use</span>
15
+ <span style="color: var(--farm-primary-base);">ready for use</span>
16
16
  `,
17
17
  },
18
18
  },
@@ -13,7 +13,7 @@ export default {
13
13
  description: {
14
14
  component: `Chip<br />
15
15
  selector: <em>farm-chip</em><br />
16
- <span style="color: green;">ready for use</span>
16
+ <span style="color: var(--farm-primary-base);">ready for use</span>
17
17
  `,
18
18
  },
19
19
  },
@@ -14,6 +14,8 @@ header {
14
14
  padding: 16px;
15
15
  background-color: #fff;
16
16
  font-weight: 700;
17
- color: var(--v-secondary-base);
18
- border-bottom: 1px solid #d6d6d6;
17
+ color: var(--farm-primary-base);
18
+ border-bottom: 1px solid var(--farm-stroke-divider);
19
+ display: flex;
20
+ justify-content: flex-start;
19
21
  }
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <header>
3
3
  <farm-icon v-if="iconTitle" size="16px" color="secondary">{{ iconTitle }}</farm-icon>
4
- {{ title }}
4
+ <farm-caption v-if="title" variation="regular" bold>
5
+ {{ title }}
6
+ </farm-caption>
5
7
 
6
8
  <slot></slot>
7
9
 
@@ -19,7 +21,6 @@
19
21
  </template>
20
22
  <script lang="ts">
21
23
  import Vue from 'vue';
22
- import Icon from '../Icon';
23
24
  /**
24
25
  * Header de dialog/modal
25
26
  */
@@ -48,9 +49,6 @@ export default Vue.extend({
48
49
  default: true,
49
50
  },
50
51
  },
51
- components: {
52
- 'farm-icon': Icon,
53
- },
54
52
  methods: {
55
53
  onClose() {
56
54
  this.$emit('onClose', {});
@@ -8,7 +8,7 @@ export default {
8
8
  description: {
9
9
  component: `Form<br />
10
10
  selector: <em>farm-form</em><br />
11
- <span style="color: green;">ready for use</span>
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
12
12
  `,
13
13
  },
14
14
  },
@@ -9,7 +9,7 @@ type ErrorsBag = Record<number, boolean>;
9
9
  export default Vue.extend({
10
10
  name: 'farm-form',
11
11
  props: {
12
- value: { type: [Array, Boolean], required: true },
12
+ value: { type: [Boolean], required: true },
13
13
  },
14
14
  inheritAttrs: true,
15
15
  setup(props, { emit }) {
@@ -3,7 +3,6 @@ import Form from '../Form';
3
3
 
4
4
  describe('Form component', () => {
5
5
  let wrapper;
6
- let component;
7
6
 
8
7
  beforeEach(() => {
9
8
  wrapper = shallowMount(Form);
@@ -14,7 +14,7 @@ export default {
14
14
  description: {
15
15
  component: `Icon<br />
16
16
  selector: <em>farm-icon<em><br />
17
- <span style="color: green;">ready for use</span>`,
17
+ <span style="color: var(--farm-primary-base);">ready for use</span>`,
18
18
  },
19
19
  },
20
20
  },
@@ -55,7 +55,7 @@ export const ClickableCursor = () => ({
55
55
  export const ClickListener = () => ({
56
56
  methods: {
57
57
  onClick() {
58
- alert('Clicked')
58
+ alert('Clicked');
59
59
  }
60
60
  },
61
61
  template:
@@ -10,7 +10,7 @@ export default {
10
10
  description: {
11
11
  component: `Loader<br />
12
12
  selector: <em>farm-loader</em><br />
13
- <span style="color: green;">ready for use</span>`,
13
+ <span style="color: var(--farm-primary-base);">ready for use</span>`,
14
14
  },
15
15
  },
16
16
  },
@@ -8,7 +8,7 @@ export default {
8
8
  description: {
9
9
  component: `Logger<br />
10
10
  selector: <em>farm-logger</em><br />
11
- <span style="color: green;">ready for use</span>
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
12
12
  `,
13
13
  },
14
14
  },
@@ -10,6 +10,10 @@ section {
10
10
  border: 0;
11
11
  }
12
12
 
13
+ .farm-tooltip {
14
+ margin-left: 4px;
15
+ }
16
+
13
17
  }
14
18
 
15
19
  @media screen and (max-width: 600px) {
@@ -22,4 +26,4 @@ section {
22
26
  margin-top: 0 !important;
23
27
  }
24
28
  }
25
- }
29
+ }
@@ -3,6 +3,17 @@ import MainFilter from './MainFilter.vue';
3
3
  export default {
4
4
  title: 'Form/MainFilter',
5
5
  component: MainFilter,
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: `Main Filter<br />
10
+ selector: <em>farm-form-mainfilter</em><br />
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
12
+ `,
13
+ },
14
+ },
15
+ viewMode: 'docs',
16
+ },
6
17
  };
7
18
 
8
19
  export const Primary = () => ({
@@ -17,7 +28,6 @@ export const CustomLabel = () => ({
17
28
  template: '<farm-form-mainfilter label="Custom" />',
18
29
  });
19
30
 
20
-
21
31
  export const MainFilters = () => ({
22
32
  data() {
23
33
  return {
@@ -32,3 +42,15 @@ export const MainFilters = () => ({
32
42
  </section>
33
43
  </div>`,
34
44
  });
45
+
46
+ export const Tooltip = () => ({
47
+ data() {
48
+ return {
49
+ text: 'Some long tooltip text to be placed here!',
50
+ };
51
+ },
52
+ template: `
53
+ <div style="max-width: 480px; padding-top: 32px; margin-left: 32px;">
54
+ <farm-form-mainfilter label="Label" :tooltip="text" />
55
+ </div>`,
56
+ });
@@ -3,12 +3,16 @@
3
3
  <fieldset v-if="hasInitialInput">
4
4
  <farm-label :for="elementId">
5
5
  {{ label }}
6
+ <farm-tooltip v-if="tooltip">
7
+ <farm-caption>
8
+ {{ tooltip }}
9
+ </farm-caption>
10
+ <template v-slot:activator="">
11
+ <farm-icon size="sm" color="gray">help-circle</farm-icon>
12
+ </template>
13
+ </farm-tooltip>
6
14
  </farm-label>
7
- <farm-textfield
8
- v-model="inputValue"
9
- :id="elementId"
10
- @keyup="onKeyUp"
11
- />
15
+ <farm-textfield v-model="inputValue" :id="elementId" @keyup="onKeyUp" />
12
16
  </fieldset>
13
17
  <farm-btn
14
18
  v-if="hasExtraFilters"
@@ -65,6 +69,13 @@ export default Vue.extend({
65
69
  type: Boolean,
66
70
  default: false,
67
71
  },
72
+ /**
73
+ * Tooltip text
74
+ */
75
+ tooltip: {
76
+ type: String,
77
+ default: null,
78
+ },
68
79
  },
69
80
 
70
81
  watch: {
@@ -18,7 +18,8 @@
18
18
  left: 0;
19
19
  width: 100vw;
20
20
  height: 100vh;
21
- background: rgba(#999999, 0.8);
21
+ opacity: 0.46;
22
+ background-color: rgb(33, 33, 33) !important;
22
23
  z-index: 101;
23
24
  }
24
25
 
@@ -8,7 +8,7 @@ export default {
8
8
  description: {
9
9
  component: `Modal<br />
10
10
  selector: <em>farm-modal</em><br />
11
- <span style="color: green;">ready for use</span>
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
12
12
  `,
13
13
  },
14
14
  },
@@ -25,7 +25,7 @@ export default Vue.extend({
25
25
  /**
26
26
  * v-model binding
27
27
  */
28
- value: { type: Boolean, required: true, default: true },
28
+ value: { type: Boolean, required: true, default: false },
29
29
  /**
30
30
  * Is persistent
31
31
  */
@@ -11,7 +11,7 @@ export default {
11
11
  description: {
12
12
  component: `Modal Prompt User to Confirm<br />
13
13
  selector: <em>farm-prompt-user</em><br />
14
- <span style="color: green;">ready for use</span>`,
14
+ <span style="color: var(--farm-primary-base);">ready for use</span>`,
15
15
  },
16
16
  },
17
17
  design: {
@@ -11,7 +11,7 @@ export default {
11
11
  description: {
12
12
  component: `RadioGroup<br />
13
13
  selector: <em>farm-radio-group</em><br />
14
- <span style="color: green;">ready for use</span>
14
+ <span style="color: var(--farm-primary-base);">ready for use</span>
15
15
 
16
16
  `,
17
17
  },
@@ -14,7 +14,7 @@ export default {
14
14
  description: {
15
15
  component: `TableContextMenu<br />
16
16
  selector: <em>farm-context-menu</em><br />
17
- <span style="color: green;">ready for use</span>
17
+ <span style="color: var(--farm-primary-base);">ready for use</span>
18
18
  `,
19
19
  },
20
20
  },
@@ -1,8 +1,20 @@
1
+ @import '../../configurations/theme-colors';
1
2
  @import '../../configurations/variables';
2
3
 
3
4
  .farm-tooltip {
4
5
  display: inline-block;
5
6
  position: relative;
7
+
8
+ @each $color in $colors {
9
+ @each $color in $theme-colors-list {
10
+
11
+ &--#{$color} {
12
+ .farm-tooltip__popup {
13
+ background-color: themeColor($color);
14
+ }
15
+ }
16
+ }
17
+ }
6
18
  }
7
19
 
8
20
  .farm-tooltip__popup {
@@ -22,15 +34,4 @@
22
34
  opacity: 1;
23
35
  visibility: visible;
24
36
  }
25
-
26
- }
27
-
28
-
29
- @each $color in $colors {
30
- #{'.farm-tooltip--' + $color} {
31
- .farm-tooltip__popup {
32
- background-color: var(--v-#{$color}-base);
33
-
34
- }
35
- }
36
37
  }
@@ -1,25 +1,29 @@
1
1
  import { withDesign } from 'storybook-addon-designs';
2
2
  import Tooltip from '.';
3
- import colors from '../../configurations/colors';
4
-
3
+ import baseThemeColors from '../../configurations/_theme-colors-base.scss';
4
+ const colors = Object.keys(baseThemeColors);
5
5
 
6
6
  export default {
7
- title: 'Interactions/Tooltip',
8
- component: Tooltip,
9
- decorators: [withDesign],
10
- parameters: {
7
+ title: 'Interactions/Tooltip',
8
+ component: Tooltip,
9
+ decorators: [withDesign],
10
+ parameters: {
11
11
  docs: {
12
12
  description: {
13
13
  component: `Tooltip<br />
14
- selector: <em>farm-tooltip</em>
14
+ selector: <em>farm-tooltip</em><br />
15
+ <span style="color: var(--farm-primary-base);">ready for use</span>
15
16
  `,
16
17
  },
17
18
  },
19
+ design: {
20
+ type: 'figma',
21
+ url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=3779%3A6131',
22
+ },
18
23
  viewMode: 'docs',
19
24
  },
20
25
  };
21
26
 
22
-
23
27
  export const Tooltips = () => ({
24
28
  data() {
25
29
  return {
@@ -79,33 +83,3 @@ export const Visibility = () => ({
79
83
  </farm-tooltip>
80
84
  </div>`,
81
85
  });
82
-
83
- Tooltips.story = {
84
- name: 'Colors',
85
- parameters: {
86
- design: {
87
- type: 'figma',
88
- url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=3779%3A6131',
89
- },
90
- },
91
- };
92
-
93
- Iconed.story = {
94
- name: 'Iconed',
95
- parameters: {
96
- design: {
97
- type: 'figma',
98
- url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=3779%3A6131',
99
- },
100
- },
101
- };
102
-
103
- Visibility.story = {
104
- name: 'Visibility',
105
- parameters: {
106
- design: {
107
- type: 'figma',
108
- url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=3779%3A6131',
109
- },
110
- },
111
- };
@@ -9,7 +9,8 @@
9
9
  <span
10
10
  :class="{
11
11
  'farm-tooltip__popup': true,
12
- 'farm-tooltip__popup--visible': (!externalControl && showOver) || (externalControl && toggleComponent),
12
+ 'farm-tooltip__popup--visible':
13
+ (!externalControl && showOver) || (externalControl && toggleComponent),
13
14
  }"
14
15
  >
15
16
  <slot></slot>
@@ -29,32 +30,32 @@ export default Vue.extend({
29
30
  type: String as PropType<
30
31
  | 'primary'
31
32
  | 'secondary'
32
- | 'error'
33
- | 'extra'
34
- | 'accent'
33
+ | 'neutral'
35
34
  | 'info'
36
35
  | 'success'
37
- | 'gray'
38
- | 'yellow'
39
- | 'white'
36
+ | 'error'
37
+ | 'warning'
38
+ | 'success'
39
+ | 'extra-1'
40
+ | 'extra-2'
40
41
  >,
41
- default: 'gray',
42
+ default: 'secondary',
42
43
  },
43
44
  /**
44
45
  * Control visibility
46
+ * v-model bind
45
47
  */
46
- value: {},
48
+ value: {
49
+ type: Boolean,
50
+ default: undefined,
51
+ },
47
52
  },
48
53
  setup(props) {
49
54
  const parent = ref(null);
50
55
  const showOver = ref(false);
51
56
 
52
- const toggleComponent = computed(() => {
53
- return props.value;
54
- });
55
- const externalControl = computed(() => {
56
- return typeof props.value === 'boolean';
57
- });
57
+ const toggleComponent = computed(() => props.value);
58
+ const externalControl = computed(() => props.value !== undefined);
58
59
 
59
60
  const onOver = () => {
60
61
  showOver.value = true;
@@ -66,10 +67,10 @@ export default Vue.extend({
66
67
  return {
67
68
  parent,
68
69
  showOver,
69
- onOver,
70
- onOut,
71
70
  toggleComponent,
72
71
  externalControl,
72
+ onOver,
73
+ onOut,
73
74
  };
74
75
  },
75
76
  });
@@ -17,13 +17,13 @@ export const Primary = () => ({
17
17
  export const Structure = () => ({
18
18
  template: `
19
19
  <farm-container>
20
- <div>
20
+ <farm-box>
21
21
  Content<br />
22
22
  Content<br />
23
23
  Content<br />
24
24
  Content<br />
25
25
  Content<br />
26
- </div>
26
+ </farm-box>
27
27
  <farm-row>
28
28
  <v-col md="6" lg="3">
29
29
  coluna 1
@@ -0,0 +1,20 @@
1
+ @import '../../../configurations/variables';
2
+
3
+ .farm-box {
4
+ display: flex;
5
+ flex: 1 0 auto;
6
+ max-width: 100%;
7
+ transition: .2s cubic-bezier(.4, 0, .2, 1);
8
+
9
+ @each $k in $justifications {
10
+ &#{'--justify-' + $k} {
11
+ justify-content: $k;
12
+ }
13
+ }
14
+
15
+ @each $k in $directions {
16
+ &#{'--direction-' + $k} {
17
+ flex-direction: $k;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,66 @@
1
+ import Box from './Box.vue';
2
+ import { directions, justifications } from '../../../configurations/flexVariables';
3
+
4
+ export default {
5
+ title: 'Layout/Box',
6
+ component: Box,
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: `Box<br />
11
+ selector: <em>farm-box</em><br />
12
+ <span style="color: var(--farm-primary-base);">ready for use</span>
13
+ `,
14
+ },
15
+ },
16
+ viewMode: 'docs',
17
+ },
18
+ };
19
+
20
+ export const Primary = () => ({
21
+ template: `<div>
22
+ <farm-box>box</farm-box>
23
+ </div>`,
24
+ });
25
+
26
+ export const Tag = () => ({
27
+ template: `<div>
28
+ <farm-box tag="section">tag: section</farm-box>
29
+ </div>`,
30
+ });
31
+
32
+ export const Justify = () => ({
33
+ data() {
34
+ return {
35
+ justifications,
36
+ };
37
+ },
38
+ template: `<div>
39
+ <farm-box :justify="k" v-for="k in justifications" :key="'justify-_' + k" style="border:1px solid var(--farm-stroke-base); margin-bottom: 16px;">
40
+ <div>
41
+ justify {{ k }}
42
+ </div>
43
+ <div>
44
+ another div
45
+ </div>
46
+ </farm-box>
47
+ </div>`,
48
+ });
49
+
50
+ export const Directions = () => ({
51
+ data() {
52
+ return {
53
+ directions,
54
+ };
55
+ },
56
+ template: `<div>
57
+ <farm-box :direction="k" v-for="k in directions" :key="'direction-_' + k" style="border:1px solid var(--farm-stroke-base); margin-bottom: 16px;">
58
+ <div>
59
+ direction {{ k }}
60
+ </div>
61
+ <div>
62
+ another div
63
+ </div>
64
+ </farm-box>
65
+ </div>`,
66
+ });
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <component
3
+ :is="tag"
4
+ :class="{
5
+ 'farm-box': true,
6
+ [`farm-box--justify-${justify}`]: justify,
7
+ [`farm-box--direction-${direction}`]: direction,
8
+ }"
9
+ >
10
+ <slot></slot>
11
+ </component>
12
+ </template>
13
+ <script lang="ts">
14
+ import Vue, { PropType } from 'vue';
15
+
16
+ export default Vue.extend({
17
+ name: 'farm-box',
18
+ props: {
19
+ /**
20
+ * Html tag
21
+ */
22
+ tag: { type: String, default: 'div' },
23
+ /**
24
+ * Applies the flex-direction css property
25
+ */
26
+ direction: {
27
+ type: String as PropType<'row' | 'row-reverse' | 'column' | 'column-reverse'>,
28
+ default: 'row',
29
+ },
30
+ /**
31
+ * Applies the justify-content css property
32
+ */
33
+ justify: {
34
+ type: String as PropType<'start' | 'center' | 'end' | 'space-between' | 'space-around'>,
35
+ default: '',
36
+ },
37
+ },
38
+ inheritAttrs: true,
39
+ });
40
+ </script>
41
+ <style lang="scss" scoped>
42
+ @import 'Box';
43
+ </style>
@@ -0,0 +1,21 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import Box from '../Box';
3
+
4
+ describe('Box component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(Box);
9
+ component = wrapper.vm;
10
+ });
11
+
12
+ test('Created hook', () => {
13
+ expect(wrapper).toBeDefined();
14
+ });
15
+
16
+ describe('mount component', () => {
17
+ it('renders correctly', () => {
18
+ expect(wrapper.element).toMatchSnapshot();
19
+ });
20
+ });
21
+ });