@farm-investimentos/front-mfe-components 9.4.1 → 10.0.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 (54) hide show
  1. package/dist/front-mfe-components.common.js +4917 -4508
  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 +4917 -4508
  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.vue +1 -1
  10. package/src/components/Card/CardContent/CardContent.vue +1 -1
  11. package/src/components/CopyToClipboard/__tests__/CopyToClipboard.spec.js +5 -1
  12. package/src/components/DatePicker/DatePicker.vue +0 -2
  13. package/src/components/Form/Form.stories.js +25 -0
  14. package/src/components/List/List.scss +0 -0
  15. package/src/components/List/List.stories.js +29 -0
  16. package/src/components/List/List.vue +16 -0
  17. package/src/components/List/__tests__/List.spec.js +20 -0
  18. package/src/components/List/index.ts +4 -0
  19. package/src/components/ListItem/ListItem.scss +37 -0
  20. package/src/components/ListItem/ListItem.stories.js +70 -0
  21. package/src/components/ListItem/ListItem.vue +82 -0
  22. package/src/components/ListItem/__tests__/ListItem.spec.js +20 -0
  23. package/src/components/ListItem/index.ts +4 -0
  24. package/src/components/Logger/Logger.vue +5 -7
  25. package/src/components/Modal/Modal.scss +1 -0
  26. package/src/components/ModalPromptUser/ModalPromptUser.scss +3 -0
  27. package/src/components/ModalPromptUser/ModalPromptUser.stories.js +7 -6
  28. package/src/components/ModalPromptUser/ModalPromptUser.vue +18 -17
  29. package/src/components/PromptUserToConfirm/PromptUserToConfirm.vue +2 -2
  30. package/src/components/RadioGroup/RadioGroup.scss +46 -20
  31. package/src/components/RadioGroup/RadioGroup.stories.js +69 -8
  32. package/src/components/RadioGroup/RadioGroup.vue +68 -46
  33. package/src/components/TableContextMenu/TableContextMenu.scss +5 -2
  34. package/src/components/TableContextMenu/TableContextMenu.stories.js +21 -4
  35. package/src/components/TableContextMenu/TableContextMenu.vue +6 -7
  36. package/src/components/TextField/__tests__/{Label.spec.js → TextField.spec.js} +0 -0
  37. package/src/{examples/Container → components/layout}/Basic.stories.js +27 -5
  38. package/src/components/layout/Col/Col.scss +5 -0
  39. package/src/components/layout/Col/Col.stories.js +42 -0
  40. package/src/components/layout/Col/Col.vue +62 -0
  41. package/src/components/layout/Col/__tests__/Col.spec.js +22 -0
  42. package/src/components/layout/Col/index.ts +4 -0
  43. package/src/components/layout/Container/Container.scss +9 -4
  44. package/src/components/layout/Container/Container.stories.js +2 -1
  45. package/src/components/layout/Container/Container.vue +1 -1
  46. package/src/components/layout/ContainerFooter/Container.stories.js +2 -1
  47. package/src/components/layout/ContainerFooter/ContainerFooter.scss +6 -3
  48. package/src/components/layout/DisplayBreakpoints.stories.mdx +100 -0
  49. package/src/components/layout/Row/Row.scss +25 -1
  50. package/src/components/layout/Row/Row.stories.js +48 -3
  51. package/src/components/layout/Row/Row.vue +33 -2
  52. package/src/configurations/_mixins.scss +6 -0
  53. package/src/configurations/_variables.scss +2 -2
  54. package/src/main.ts +4 -0
@@ -1,4 +1,7 @@
1
1
  import RadioGroup from './RadioGroup';
2
+ import baseThemeColors from '../../configurations/_theme-colors-base.scss';
3
+
4
+ const colors = Object.keys(baseThemeColors);
2
5
 
3
6
  export default {
4
7
  title: 'Form/RadioGroup',
@@ -7,7 +10,9 @@ export default {
7
10
  docs: {
8
11
  description: {
9
12
  component: `RadioGroup<br />
10
- selector: <em>farm-radio-group</em>
13
+ selector: <em>farm-radio-group</em><br />
14
+ <span style="color: green;">ready for use</span>
15
+
11
16
  `,
12
17
  },
13
18
  },
@@ -19,16 +24,72 @@ export const Primary = () => ({
19
24
  data() {
20
25
  return {
21
26
  buttons: [
22
- { label: 'Button 1', id: 1 },
23
- { label: 'Button 2', id: 2 },
24
- { label: 'Button 3', id: 3 }
25
- ],
26
- checkedValue: 1
27
+ { label: 'Random text', id: 1 },
28
+ { label: 'In', id: 2 },
29
+ { label: 'Radio Group', id: 3 },
30
+ ],
31
+ checkedValue: 1,
27
32
  };
28
33
  },
29
34
  template: `<div>
30
- <farm-radio-group v-model="checkedValue" column :buttons="buttons" />
35
+ <farm-radio-group v-model="checkedValue" :buttons="buttons" />
31
36
  </div>`,
32
37
  });
33
38
 
34
- Primary.storyName = 'Basic';
39
+ export const Reset = () => ({
40
+ data() {
41
+ return {
42
+ buttons: [
43
+ { label: 'Button 1', id: 1 },
44
+ { label: 'Button 2', id: 2 },
45
+ { label: 'Button 3', id: 3 },
46
+ ],
47
+ checkedValue: 1,
48
+ };
49
+ },
50
+ methods: {
51
+ reset() {
52
+ this.$refs.radiogroupreset.reset();
53
+ },
54
+ },
55
+ template: `<div>
56
+ <farm-radio-group v-model="checkedValue" :buttons="buttons" ref="radiogroupreset" /><br />
57
+ <farm-btn @click="reset">Reset</farm-btn>
58
+ </div>`,
59
+ });
60
+
61
+ export const Vertical = () => ({
62
+ data() {
63
+ return {
64
+ buttons: [
65
+ { label: 'Button 1', id: 1 },
66
+ { label: 'Button 2', id: 2 },
67
+ { label: 'Button 3', id: 3 },
68
+ ],
69
+ checkedValue: 1,
70
+ };
71
+ },
72
+ template: `<div>
73
+ <farm-radio-group v-model="checkedValue" vertical :buttons="buttons" />
74
+ </div>`,
75
+ });
76
+
77
+ export const Colors = () => ({
78
+ data() {
79
+ return {
80
+ buttons: [
81
+ { label: 'Button 1', id: 1 },
82
+ { label: 'Button 2', id: 2 },
83
+ { label: 'Button 3', id: 3 },
84
+ ],
85
+ checkedValue: 1,
86
+ colors,
87
+ };
88
+ },
89
+ template: `<div style="display: flex; flex-direction: row; flex-wrap: wrap;">
90
+ <div v-for="color in colors" style="width: 33.3%; margin-bottom: 32px;">
91
+ <h4 style="margin-bottom: 16px">{{ color }}</h4>
92
+ <farm-radio-group v-model="checkedValue" vertical :color="color" :buttons="buttons" />
93
+ </div>
94
+ </div>`,
95
+ });
@@ -1,30 +1,32 @@
1
1
  <template>
2
- <div
3
- :class="{
4
- 'farm-radio-group': true,
5
- 'farm-radio-group--column': $props.column,
6
- }">
7
- <div class="farm-radio-group__item"
8
- v-for="(button, index) in buttons"
9
- :key="`farm-radio-group_` + index"
10
- @click="clicked(button.id)"
11
- >
12
- <input
13
- type="radio"
14
- name="radio"
15
- :checked="button.id === $props.value"
16
- :id="`farm-radio-group_` + index"
17
- :style="cssVars"
18
- :value="button.id"
19
- >
20
- <label>
21
- {{button.label}}
22
- </label>
23
- </div>
24
- </div>
2
+ <div
3
+ :class="{
4
+ 'farm-radio-group': true,
5
+ 'farm-radio-group--vertical': $props.vertical,
6
+ }"
7
+ :color="color"
8
+ >
9
+ <div
10
+ class="farm-radio-group__item"
11
+ v-for="(button, index) in buttons"
12
+ :key="`farm-radio-group_` + index"
13
+ @click="clicked(button.id)"
14
+ >
15
+ <input
16
+ type="radio"
17
+ name="radio"
18
+ :checked="button.id === innerValue"
19
+ :id="`farm-radio-group_` + index"
20
+ :value="button.id"
21
+ :class="{ checked: button.id === innerValue }"
22
+ />
23
+ <label> {{ button.label }} </label>
24
+ </div>
25
+ </div>
25
26
  </template>
26
27
  <script lang="ts">
27
- import Vue, { PropType } from 'vue';
28
+ import Vue, { PropType, ref, watch } from 'vue';
29
+ import validateFormStateBuilder from '../../composition/validateFormStateBuilder';
28
30
  import IRadioGroup from './IRadioGroup';
29
31
  export default Vue.extend({
30
32
  name: 'farm-radio-group',
@@ -34,36 +36,56 @@ export default Vue.extend({
34
36
  */
35
37
  buttons: {
36
38
  type: Array as PropType<Array<IRadioGroup>>,
37
- default: () => [],
39
+ default: [],
38
40
  },
39
- /**
41
+ /**
40
42
  * v-model
41
43
  */
42
44
  value: {
43
45
  required: true,
44
46
  },
45
- column: {
46
- type: Boolean,
47
- default: false
48
- },
49
- color: {
50
- type: String,
51
- default: '#00B493',
52
- }
47
+ /**
48
+ * Is vertical?
49
+ */
50
+ vertical: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ color: {
55
+ type: String,
56
+ default: 'primary',
57
+ },
53
58
  },
54
- methods: {
55
- clicked(value) {
56
- this.$emit('input', value);
57
- }
58
- },
59
- computed: {
60
- cssVars () {
61
- return {
62
- '--radio-group-color': this.color
63
- };
64
- }
65
- }
59
+ setup(props, { emit }) {
60
+ const innerValue = ref(props.value);
61
+ const { errorBucket, valid, validatable } = validateFormStateBuilder();
66
62
 
63
+ const reset = () => {
64
+ innerValue.value = false;
65
+ emit('input', innerValue.value);
66
+ };
67
+
68
+ watch(
69
+ () => props.value,
70
+ () => {
71
+ innerValue.value = props.value;
72
+ }
73
+ );
74
+
75
+ const clicked = value => {
76
+ innerValue.value = value;
77
+ emit('input', innerValue.value);
78
+ };
79
+
80
+ return {
81
+ innerValue,
82
+ errorBucket,
83
+ valid,
84
+ validatable,
85
+ reset,
86
+ clicked,
87
+ };
88
+ },
67
89
  });
68
90
  </script>
69
91
  <style lang="scss" scoped>
@@ -1,6 +1,9 @@
1
1
  [role='menuitem'] {
2
2
  border-bottom: 1px solid var(--v-gray-lighten2);
3
3
  }
4
- .farm-btn__content i.mdi.farm-btn__icon {
5
- font-size: 24px;
4
+ .v-list-item__title {
5
+ .farm-icon {
6
+ vertical-align: sub;
7
+ margin-right: 8px;
8
+ }
6
9
  }
@@ -10,16 +10,31 @@ export default {
10
10
  type: 'figma',
11
11
  url: 'https://www.figma.com/file/rkkAsX4IP0tzv1udIDXlqe/%E2%9C%8D---Onboarding---PJ?node-id=3516%3A11516',
12
12
  },
13
+ docs: {
14
+ description: {
15
+ component: `TableContextMenu<br />
16
+ selector: <em>farm-context-menu</em><br />
17
+ <span style="color: green;">ready for use</span>
18
+ `,
19
+ },
20
+ },
21
+ viewMode: 'docs',
13
22
  },
14
23
  };
15
24
 
16
25
  export const Primary = () => ({
17
- template: `<farm-context-menu :items="[{ label: 'Remover' }]" />`,
26
+ template: `<div>
27
+ <farm-context-menu :items="[{ label: 'Remover', icon: { color: 'error', type: 'open-in-new' } }]" />
28
+ </div>`,
18
29
  });
19
30
 
20
31
  export const Icons = () => ({
21
- template: `<farm-context-menu
22
- :items="[{ label: 'Remover', icon: { color: 'error', type: 'delete' } }]" />`,
32
+ template: `<div>
33
+ <farm-context-menu
34
+ ref="icons"
35
+ :items="[{ label: 'Remover', icon: { color: 'error', type: 'delete' } }]"
36
+ />
37
+ </div>`,
23
38
  });
24
39
 
25
40
  export const Multi = () => ({
@@ -32,5 +47,7 @@ export const Multi = () => ({
32
47
  ],
33
48
  };
34
49
  },
35
- template: `<farm-context-menu :items="items" />`,
50
+ template: `<div>
51
+ <farm-context-menu ref="multi" :items="items" />
52
+ </div>`,
36
53
  });
@@ -2,7 +2,7 @@
2
2
  <v-menu>
3
3
  <template v-slot:activator="{ on, attrs }">
4
4
  <farm-btn icon v-bind="attrs" v-on="on" title="Abrir opções">
5
- <i class="farm-btn__icon mdi mdi-dots-horizontal"></i>
5
+ <farm-icon size="md">dots-horizontal</farm-icon>
6
6
  </farm-btn>
7
7
  </template>
8
8
 
@@ -15,12 +15,13 @@
15
15
  >
16
16
  <v-list-item-content>
17
17
  <v-list-item-title>
18
- <v-icon
18
+ <farm-icon
19
19
  v-if="item.icon"
20
+ size="md"
20
21
  :color="item.icon.color || 'secondary'"
21
- class="mb-1"
22
- >mdi-{{ item.icon.type }}</v-icon
23
22
  >
23
+ {{ item.icon.type }}
24
+ </farm-icon>
24
25
  {{ item.label }}
25
26
  </v-list-item-title>
26
27
  </v-list-item-content>
@@ -28,10 +29,9 @@
28
29
  </v-list>
29
30
  </v-menu>
30
31
  </template>
31
- <script>
32
+ <script lang="ts">
32
33
  import Vue from 'vue';
33
34
  import { VMenu } from 'vuetify/lib/components/VMenu';
34
- import { VIcon } from 'vuetify/lib/components/VIcon';
35
35
  import { VList } from 'vuetify/lib/components/VList';
36
36
  import VListItem from 'vuetify/lib/components/VList/VListItem';
37
37
  import { VListItemContent, VListItemTitle } from 'vuetify/lib';
@@ -39,7 +39,6 @@ import { VListItemContent, VListItemTitle } from 'vuetify/lib';
39
39
  export default Vue.extend({
40
40
  name: 'farm-context-menu',
41
41
  components: {
42
- VIcon,
43
42
  VMenu,
44
43
  VList,
45
44
  VListItem,
@@ -14,13 +14,35 @@ 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
- Content
21
- <farm-container-footer>
22
- Footer content
23
- </farm-container-footer>
20
+ <div>
21
+ Content<br />
22
+ Content<br />
23
+ Content<br />
24
+ Content<br />
25
+ Content<br />
26
+ </div>
27
+ <farm-row>
28
+ <v-col md="6" lg="3">
29
+ coluna 1
30
+ </v-col>
31
+ <v-col md="6" lg="3">
32
+ coluna 2
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>
40
+ </farm-row>
41
+ <farm-row>
42
+ <farm-container-footer>
43
+ Footer content
44
+ </farm-container-footer>
45
+ </farm-row>
24
46
  </farm-container>
25
47
  `,
26
48
  });
@@ -0,0 +1,5 @@
1
+ .farm-col {
2
+ width: 100%;
3
+ padding: 12px;
4
+ display: flex;
5
+ }
@@ -0,0 +1,42 @@
1
+ import Col from './Col.vue';
2
+
3
+ export default {
4
+ title: 'Layout/Col',
5
+ component: Col,
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: `Col<br />
10
+ selector: <em>farm-col</em><br />
11
+ <span style="color: var(--farm-extra-1-base);">development</span>
12
+ `,
13
+ },
14
+ },
15
+ viewMode: 'docs',
16
+ },
17
+ };
18
+
19
+ export const Primary = () => ({
20
+ template: '<farm-col>col</farm-col>',
21
+ });
22
+ export const Xl = () => ({
23
+ template: '<farm-col xl="3">xl: 3</farm-col>',
24
+ });
25
+ export const Lg = () => ({
26
+ template: '<farm-col lg="4">lg: 4</farm-col>',
27
+ });
28
+ export const Md = () => ({
29
+ template: '<farm-col md="6">md: 6</farm-col>',
30
+ });
31
+ export const Sm = () => ({
32
+ template: '<farm-col sm="4">sm: 4</farm-col>',
33
+ });
34
+ export const Xs = () => ({
35
+ template: '<farm-col xs="4">xs: 4</farm-col>',
36
+ });
37
+ export const Combination = () => ({
38
+ template: '<farm-col xl="3" xs="4">xl: 3 - xs: 4</farm-col>',
39
+ });
40
+ export const TagP = () => ({
41
+ template: '<farm-col tag="p">col</farm-col>',
42
+ });
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <component
3
+ :is="tag"
4
+ :class="{
5
+ 'farm-col': true,
6
+ [`farm-col--xl-${xl}`]: xl,
7
+ [`farm-col--lg-${lg}`]: lg,
8
+ [`farm-col--md-${md}`]: md,
9
+ [`farm-col--sm-${sm}`]: sm,
10
+ [`farm-col--xs-${xs}`]: xs,
11
+ }"
12
+ >
13
+ <slot></slot>
14
+ </component>
15
+ </template>
16
+ <script lang="ts">
17
+ import Vue, { PropType } from 'vue';
18
+
19
+ export default Vue.extend({
20
+ name: 'farm-col',
21
+ props: {
22
+ /**
23
+ * Html tag
24
+ */
25
+ tag: { type: String, default: 'div' },
26
+ xl: {
27
+ type: [String, Number, Boolean] as PropType<
28
+ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
29
+ >,
30
+ default: false,
31
+ },
32
+ lg: {
33
+ type: [String, Number, Boolean] as PropType<
34
+ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
35
+ >,
36
+ default: false,
37
+ },
38
+ md: {
39
+ type: [String, Number, Boolean] as PropType<
40
+ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
41
+ >,
42
+ default: false,
43
+ },
44
+ sm: {
45
+ type: [String, Number, Boolean] as PropType<
46
+ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
47
+ >,
48
+ default: false,
49
+ },
50
+ xs: {
51
+ type: [String, Number, Boolean] as PropType<
52
+ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
53
+ >,
54
+ default: false,
55
+ },
56
+ },
57
+ inheritAttrs: true,
58
+ });
59
+ </script>
60
+ <style lang="scss" scoped>
61
+ @import 'Col';
62
+ </style>
@@ -0,0 +1,22 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import Col from '../Col';
3
+
4
+ describe('Col component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(Col);
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 Col from './Col.vue';
2
+
3
+ export { Col };
4
+ export default Col;
@@ -1,16 +1,21 @@
1
+ @import '../../../configurations/functions';
2
+ @import '../../../configurations/_mixins';
3
+
1
4
  .farm-container {
2
5
  width: 100%;
3
- padding: 12px;
6
+ padding: 0;
4
7
  margin-right: auto;
5
8
  margin-left: auto;
6
9
  max-width: 100%;
7
10
 
8
11
  >div {
12
+ border-top: 1px solid var(--farm-stroke-base);
9
13
  background-color: white;
10
14
  border-radius: 8px;
11
- max-width: calc(100% - 32px);
12
- margin: 16px auto;
13
- padding: 12px;
15
+ max-width: 100%;
16
+ margin: gutter('lg');
17
+ padding: gutter('lg');
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;
14
19
 
15
20
  // deprecated
16
21
  .container-main__footer-buttons-right {
@@ -7,7 +7,8 @@ export default {
7
7
  docs: {
8
8
  description: {
9
9
  component: `Container<br />
10
- selector: <em>farm-container</em>
10
+ selector: <em>farm-container</em><br />
11
+ <span style="color: green;">ready for use</span>
11
12
  `,
12
13
  },
13
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: green">ready for use</span>
11
12
  `,
12
13
  },
13
14
  },
@@ -1,6 +1,9 @@
1
+ @import '../../../configurations/functions';
2
+
1
3
  .farm-container-footer {
2
4
  width: 100%;
3
- padding: 24px 32px;
4
- border-top: 1px solid var(--v-gray-lighten2);
5
- margin-top: 12px;
5
+ padding: gutter('lg');
6
+ padding-bottom: 0;
7
+ border-top: 1px solid var(--farm-stroke-base);
8
+ margin-top: gutter('lg');
6
9
  }