@farm-investimentos/front-mfe-components 10.0.0 → 10.1.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 +256 -146
  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 +256 -146
  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 +5 -5
  9. package/src/components/Card/Card.stories.js +1 -1
  10. package/src/components/Checkbox/Checkbox.stories.js +1 -1
  11. package/src/components/Chip/Chip.stories.js +1 -1
  12. package/src/components/Form/Form.stories.js +1 -1
  13. package/src/components/Icon/Icon.stories.js +1 -1
  14. package/src/components/List/List.vue +0 -1
  15. package/src/components/Loader/Loader.stories.ts +1 -1
  16. package/src/components/Logger/Logger.stories.js +1 -1
  17. package/src/components/Modal/Modal.stories.js +1 -1
  18. package/src/components/ModalPromptUser/ModalPromptUser.stories.js +1 -1
  19. package/src/components/RadioGroup/RadioGroup.stories.js +1 -1
  20. package/src/components/TableContextMenu/TableContextMenu.stories.js +1 -1
  21. package/src/{examples/Container → components/layout}/Basic.stories.js +11 -5
  22. package/src/components/layout/Box/Box.scss +20 -0
  23. package/src/components/layout/Box/Box.stories.js +66 -0
  24. package/src/components/layout/Box/Box.vue +43 -0
  25. package/src/components/layout/Box/__tests__/Box.spec.js +22 -0
  26. package/src/components/layout/Box/index.ts +4 -0
  27. package/src/components/layout/Container/Container.scss +5 -4
  28. package/src/components/layout/Container/Container.stories.js +1 -1
  29. package/src/components/layout/Container/Container.vue +1 -1
  30. package/src/components/layout/ContainerFooter/Container.stories.js +2 -1
  31. package/src/components/layout/DisplayBreakpoints.stories.mdx +100 -0
  32. package/src/components/layout/Row/Row.scss +1 -3
  33. package/src/components/layout/Row/Row.stories.js +3 -2
  34. package/src/components/layout/Row/Row.vue +10 -2
  35. package/src/configurations/_mixins.scss +6 -0
  36. package/src/configurations/_variables.scss +6 -1
  37. package/src/configurations/flexVariables.ts +4 -0
  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": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -29,10 +29,10 @@
29
29
  "devDependencies": {
30
30
  "@farm-investimentos/front-mfe-libs-ts": "^1.0.9",
31
31
  "@socheatsok78/storybook-addon-vuetify": "^0.1.9",
32
- "@storybook/addon-actions": "^6.5.8",
33
- "@storybook/addon-essentials": "^6.5.8",
34
- "@storybook/addon-links": "^6.5.8",
35
- "@storybook/vue": "^6.5.8",
32
+ "@storybook/addon-actions": "6.5.8",
33
+ "@storybook/addon-essentials": "6.5.8",
34
+ "@storybook/addon-links": "6.5.8",
35
+ "@storybook/vue": "6.5.8",
36
36
  "@types/jest": "^24.9.1",
37
37
  "@typescript-eslint/eslint-plugin": "^4.18.0",
38
38
  "@typescript-eslint/parser": "^4.18.0",
@@ -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
  },
@@ -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
  },
@@ -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
  },
@@ -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
  },
@@ -8,7 +8,6 @@ import Vue from 'vue';
8
8
 
9
9
  export default Vue.extend({
10
10
  name: 'farm-list',
11
- props: {},
12
11
  setup() {},
13
12
  });
14
13
  </script>
@@ -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
  },
@@ -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
  },
@@ -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
  },
@@ -14,23 +14,29 @@ export const Primary = () => ({
14
14
  template: '<farm-container>content</farm-container>',
15
15
  });
16
16
 
17
- export const Secondary = () => ({
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
- <v-col md="6">
28
+ <v-col md="6" lg="3">
29
29
  coluna 1
30
30
  </v-col>
31
- <v-col md="6">
31
+ <v-col md="6" lg="3">
32
32
  coluna 2
33
33
  </v-col>
34
+ <v-col md="6" lg="3">
35
+ coluna 3
36
+ </v-col>
37
+ <v-col md="6" lg="3">
38
+ coluna 4
39
+ </v-col>
34
40
  </farm-row>
35
41
  <farm-row>
36
42
  <farm-container-footer>
@@ -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,22 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import Box from '../Box';
3
+
4
+ describe('Box component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(Box);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+
17
+ describe('mount component', () => {
18
+ it('renders correctly', () => {
19
+ expect(wrapper.element).toMatchSnapshot();
20
+ });
21
+ });
22
+ });
@@ -0,0 +1,4 @@
1
+ import Box from './Box.vue';
2
+
3
+ export { Box };
4
+ export default Box;
@@ -3,18 +3,19 @@
3
3
 
4
4
  .farm-container {
5
5
  width: 100%;
6
- padding: 12px;
6
+ padding: 0;
7
7
  margin-right: auto;
8
8
  margin-left: auto;
9
9
  max-width: 100%;
10
10
 
11
11
  >div {
12
+ border-top: 1px solid var(--farm-stroke-base);
12
13
  background-color: white;
13
14
  border-radius: 8px;
14
- max-width: calc(100% - 24px);
15
- margin: gutter('lg') auto;
15
+ max-width: 100%;
16
+ margin: gutter('lg');
16
17
  padding: gutter('lg');
17
- @include addShadow;
18
+ 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%) !important;
18
19
 
19
20
  // deprecated
20
21
  .container-main__footer-buttons-right {
@@ -8,7 +8,7 @@ export default {
8
8
  description: {
9
9
  component: `Container<br />
10
10
  selector: <em>farm-container</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
  },
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <section class="farm-container">
3
- <div class="elevation-2">
3
+ <div>
4
4
  <slot></slot>
5
5
  </div>
6
6
  </section>
@@ -7,7 +7,8 @@ export default {
7
7
  docs: {
8
8
  description: {
9
9
  component: `Container Footer<br />
10
- selector: <em>farm-container-footer</em>
10
+ selector: <em>farm-container-footer</em><br />
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
11
12
  `,
12
13
  },
13
14
  },
@@ -0,0 +1,100 @@
1
+ import { Meta } from '@storybook/addon-docs';
2
+
3
+ <Meta title="Layout/Display Breakpoints" />
4
+
5
+ # Display Breakpoints
6
+
7
+ <table width="100%">
8
+ <thead>
9
+ <tr>
10
+ <th>Device</th>
11
+ <th>Code</th>
12
+ <th>Type</th>
13
+ <th>Range</th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <tr>
18
+ <td>
19
+ <span>
20
+ <i className="mdi mdi-cellphone" />
21
+ &nbsp; Extra small
22
+ </span>
23
+ </td>
24
+ <td>
25
+ <strong>xs</strong>
26
+ </td>
27
+ <td>Small to large phone</td>
28
+ <td>&lt; 600px</td>
29
+ </tr>
30
+ <tr>
31
+ <td>
32
+ <i className="mdi mdi-tablet" />
33
+ &nbsp;
34
+ <span>Small</span>
35
+ </td>
36
+ <td>
37
+ <strong>sm</strong>
38
+ </td>
39
+ <td>Small to medium tablet</td>
40
+ <td>600px &gt; &lt; 960px</td>
41
+ </tr>
42
+ <tr>
43
+ <td>
44
+ <i className="mdi mdi-laptop" />
45
+ &nbsp;
46
+ <span>Medium</span>
47
+ </td>
48
+ <td>
49
+ <strong>md</strong>
50
+ </td>
51
+ <td>Large tablet to laptop</td>
52
+ <td>960px &gt; &lt; 1264px*</td>
53
+ </tr>
54
+ <tr>
55
+ <td>
56
+ <i className="mdi mdi-monitor" />
57
+ &nbsp;
58
+ <span>Large</span>
59
+ </td>
60
+ <td>
61
+ <strong>lg</strong>
62
+ </td>
63
+ <td>Desktop</td>
64
+ <td>1264px &gt; &lt; 1904px*</td>
65
+ </tr>
66
+ <tr>
67
+ <td>
68
+ <i className="mdi mdi-television" />
69
+ &nbsp;
70
+ <span>Extra large</span>
71
+ </td>
72
+ <td>
73
+ <strong>xl</strong>
74
+ </td>
75
+ <td>4k and ultra-wide</td>
76
+ <td>&gt; 1904px*</td>
77
+ </tr>
78
+ </tbody>
79
+ <tfoot>
80
+ <tr>
81
+ <td colSpan="4">
82
+ <em> * -16px on desktop for browser scrollbar</em>
83
+ </td>
84
+ </tr>
85
+ </tfoot>
86
+ </table>
87
+
88
+ ## SCSS Helpers
89
+
90
+ The _mixins.scss contains mixins for media query, to abstract the breakpoints and create queries for different breakpoints.
91
+
92
+ <code>
93
+ @import '@farm-investimentos/front-mfe-components/src/configurations/_mixins.scss';
94
+
95
+ @include fromSm { // min-width: 960px <br />
96
+ .product-limit {<br />
97
+ text-align: center;<br />
98
+ }<br />
99
+ }
100
+ </code>
@@ -1,7 +1,5 @@
1
1
  @import '../../../configurations/functions';
2
- $aligns: start, center, end, baseline, stretch;
3
- $align-contents: start, center, end, space-between, space-around, stretch;
4
- $justifications: start, center, end, space-between, space-around;
2
+ @import '../../../configurations/variables';
5
3
 
6
4
 
7
5
  .farm-row {
@@ -1,4 +1,5 @@
1
1
  import Row from './Row.vue';
2
+ import { justifications } from '../../../configurations/flexVariables';
2
3
 
3
4
  export default {
4
5
  title: 'Layout/Row',
@@ -8,7 +9,7 @@ export default {
8
9
  description: {
9
10
  component: `Row<br />
10
11
  selector: <em>farm-row</em><br />
11
- <span style="color: var(--farm-extra-1-base);">development</span>
12
+ <span style="color: var(--farm-primary-base);">ready for use</span>
12
13
  `,
13
14
  },
14
15
  },
@@ -55,7 +56,7 @@ export const AlignContent = () => ({
55
56
  export const Justify = () => ({
56
57
  data() {
57
58
  return {
58
- justifications: ['start', 'center', 'end', 'space-between', 'space-around'],
59
+ justifications,
59
60
  };
60
61
  },
61
62
  template: `<div>
@@ -12,8 +12,7 @@
12
12
  </component>
13
13
  </template>
14
14
  <script lang="ts">
15
- import Vue from 'vue';
16
- import { PropType } from 'vue/types/v3-component-props';
15
+ import Vue, { PropType } from 'vue';
17
16
 
18
17
  export default Vue.extend({
19
18
  name: 'farm-row',
@@ -22,16 +21,25 @@ export default Vue.extend({
22
21
  * Html tag
23
22
  */
24
23
  tag: { type: String, default: 'div' },
24
+ /**
25
+ * Applies the align-items css property.
26
+ */
25
27
  align: {
26
28
  type: String as PropType<'start' | 'center' | 'end' | 'baseline' | 'stretch'>,
27
29
  default: '',
28
30
  },
31
+ /**
32
+ * applies the align-content css property
33
+ */
29
34
  alignContent: {
30
35
  type: String as PropType<
31
36
  'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'stretch'
32
37
  >,
33
38
  default: '',
34
39
  },
40
+ /**
41
+ * Applies the justify-content css property
42
+ */
35
43
  justify: {
36
44
  type: String as PropType<'start' | 'center' | 'end' | 'space-between' | 'space-around'>,
37
45
  default: '',
@@ -28,6 +28,12 @@
28
28
  }
29
29
  }
30
30
 
31
+ @mixin fromLg {
32
+ @media (min-width: 1904px) {
33
+ @content;
34
+ }
35
+ }
36
+
31
37
  @mixin addShadow {
32
38
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.16);
33
39
  }
@@ -25,4 +25,9 @@ $fontSizes: (
25
25
  "xl": 24px
26
26
  );
27
27
 
28
- $fontWeights: 100, 200, 300, 400, 500, 600, 700;
28
+ $fontWeights: 100, 200, 300, 400, 500, 600, 700;
29
+
30
+ $aligns: start, center, end, baseline, stretch;
31
+ $align-contents: start, center, end, space-between, space-around, stretch;
32
+ $justifications: start, center, end, space-between, space-around;
33
+ $directions: row, row-reverse, column, column-reverse;
@@ -0,0 +1,4 @@
1
+ const directions = ['row', 'row-reverse', 'column', 'column-reverse'];
2
+ const justifications = ['start', 'center', 'end', 'space-between', 'space-around'];
3
+
4
+ export { directions, justifications };
package/src/main.ts CHANGED
@@ -85,6 +85,7 @@ export * from './components/TextField';
85
85
  export * from './components/Tooltip';
86
86
  export * from './components/Typography';
87
87
 
88
+ export * from './components/layout/Box';
88
89
  export * from './components/layout/Col';
89
90
  export * from './components/layout/Container';
90
91
  export * from './components/layout/ContainerFooter';