@farm-investimentos/front-mfe-components 9.2.2 → 9.2.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "9.2.2",
3
+ "version": "9.2.4",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -12,6 +12,12 @@
12
12
  text-align: center;
13
13
  align-items: center;
14
14
  color: white;
15
+ width: 100%;
16
+
17
+ &--dense {
18
+ min-width: auto;
19
+ width: max-content;
20
+ }
15
21
 
16
22
  .farm-typography {
17
23
  width: 100%;
@@ -10,8 +10,15 @@ export default {
10
10
  };
11
11
 
12
12
  export const Primary = () => ({
13
- template: `<div>
14
- <farm-chip color="info">Chip</farm-chip>
13
+ template: `<div class="chips-container">
14
+ <farm-chip color="info">Chip (100% width)</farm-chip>
15
+ </div>`,
16
+ });
17
+
18
+ export const Dense = () => ({
19
+ template: `<div class="chips-container">
20
+ <farm-chip color="info" :dense="true">prop</farm-chip>
21
+ <farm-chip color="secondary" dense>attribute</farm-chip>
15
22
  </div>`,
16
23
  });
17
24
 
@@ -1,7 +1,7 @@
1
1
  .chips-container {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- max-width: 160px;
4
+ max-width: 320px;
5
5
 
6
6
  > .farm-chip {
7
7
  margin-bottom: 16px;
@@ -1,8 +1,6 @@
1
1
  <template>
2
- <span :class="{ 'farm-chip': true }">
3
- <farm-typography tag="span" size="sm">
4
- <slot></slot>
5
- </farm-typography>
2
+ <span :class="{ 'farm-chip': true, 'farm-chip--dense': dense }">
3
+ <farm-typography tag="span" size="sm"> <slot></slot> </farm-typography>
6
4
  </span>
7
5
  </template>
8
6
  <script lang="ts">
@@ -11,6 +9,15 @@ import Vue from 'vue';
11
9
  export default Vue.extend({
12
10
  name: 'farm-chip',
13
11
  inheritAttrs: true,
12
+ props: {
13
+ /**
14
+ * Is dense (not 100% width)?
15
+ */
16
+ dense: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ },
14
21
  });
15
22
  </script>
16
23
  <style lang="scss" scoped>
@@ -25,13 +25,13 @@ export const Primary = () => ({
25
25
  components: { DataTablePaginator },
26
26
  data() {
27
27
  return {
28
- totalPages: null
28
+ totalPages: 8
29
29
  };
30
30
  },
31
31
  template: '<DataTablePaginator :totalPages="totalPages" :page="1" />',
32
32
  mounted() {
33
33
  setTimeout(() => {
34
- this.totalPages = 2;
34
+ this.totalPages = 0;
35
35
  }, 1000);
36
36
  }
37
37
  });
@@ -16,9 +16,9 @@
16
16
  ></v-select>
17
17
  </div>
18
18
 
19
- <ul :class="{ 'farm-paginator': true, 'farm-paginator--disabled': disabled }">
19
+ <ul :class="{ 'farm-paginator': true, 'farm-paginator--disabled': disabled || totalPages == null }">
20
20
  <li>
21
- <button :disabled="currentPage === 1 || disabled" @click="previousPage">
21
+ <button :disabled="currentPage === 1 || disabled || totalPages == null" @click="previousPage">
22
22
  <farm-icon color="gray" size="sm">chevron-left</farm-icon>
23
23
  </button>
24
24
  </li>
@@ -37,7 +37,7 @@
37
37
  </li>
38
38
 
39
39
  <li>
40
- <button :disabled="currentPage === totalPages || disabled" @click="nextPage">
40
+ <button :disabled="currentPage === totalPages || disabled || totalPages == null || totalPages === 0" @click="nextPage">
41
41
  <farm-icon color="gray" size="sm">chevron-right</farm-icon>
42
42
  </button>
43
43
  </li>
@@ -70,7 +70,10 @@ export default Vue.extend({
70
70
  /**
71
71
  * Total de páginas
72
72
  */
73
- totalPages: null,
73
+ totalPages: {
74
+ type: Number,
75
+ default: null,
76
+ },
74
77
  /**
75
78
  * Desabilita controles
76
79
  */
@@ -28,7 +28,6 @@ export const Primary = () => ({
28
28
  </div>`,
29
29
  });
30
30
 
31
- /*
32
31
  export const InitValue = () => ({
33
32
  components: { DatePicker },
34
33
  template: `<div style='max-width: 320px'><DatePicker inputId="input-custom-id-1" value="2021-08-01" /></div>`,
@@ -49,16 +48,10 @@ export const RequiredDates = () => ({
49
48
  </div>`,
50
49
  });
51
50
 
52
- export const readonlyFalse = () => ({
51
+ export const ReadonlyFalse = () => ({
53
52
  components: { DatePicker },
54
53
  template: `<div style='max-width: 320px'>
55
54
  <DatePicker :readonly="false" inputId="input-custom-id-3"/>
56
55
  </div>`,
57
56
  });
58
57
 
59
- Primary.storyName = 'Básico';
60
- InitValue.storyName = 'Data inicial';
61
- MinMaxDates.storyName = 'Data mínima e máxima';
62
- RequiredDates.storyName = 'Obrigatório';
63
- readonlyFalse.storyName = 'Permitir digitação';
64
- */
@@ -8,3 +8,12 @@
8
8
  opacity: 0.8;
9
9
  }
10
10
  }
11
+
12
+ header {
13
+ font-size: 12px;
14
+ padding: 16px;
15
+ background-color: #fff;
16
+ font-weight: 700;
17
+ color: var(--v-secondary-base);
18
+ border-bottom: 1px solid #d6d6d6;
19
+ }
@@ -1,34 +1,84 @@
1
- .farm-loader__spinner {
2
- display: inline-block;
1
+ $loader-rotate-animation: loader-rotate 1.4s linear infinite !default;
2
+ $loader-rotate-dash: loader-dash 1.4s ease-in-out infinite !default;
3
+ $loader-intermediate-svg-transition: all 0.2s ease-in-out !default;
4
+ $loader-overlay-transition: all 0.6s ease-in-out !default;
5
+
6
+ .farm-loader {
3
7
  width: 70px;
4
8
  height: 70px;
5
- border-radius: 50%;
9
+ color: var(--v-secondary-base) !important;
10
+ caret-color: var(--v-secondary-base) !important;
6
11
  position: relative;
7
- animation: rotate 1s linear infinite;
12
+ display: inline-flex;
13
+ vertical-align: middle;
14
+ justify-content: center;
15
+ align-items: center;
16
+
17
+ & circle {
18
+ stroke-width: 3.7;
19
+ }
8
20
 
9
21
  &--small {
10
22
  width: 35px;
11
23
  height: 35px;
24
+
25
+ & circle {
26
+ stroke-width: 5.7;
27
+ }
12
28
  }
13
29
 
14
30
  &--big {
15
31
  width: 100px;
16
32
  height: 100px;
33
+
34
+ & circle {
35
+ stroke-width: 2.7;
36
+ }
17
37
  }
18
- }
19
38
 
20
- .farm-loader__spinner::before {
21
- content: '';
22
- box-sizing: border-box;
23
- position: absolute;
24
- inset: 0px;
25
- border-radius: 50%;
26
- border: 5px solid var(--v-secondary-base);
27
- animation: prixClipFix 2s linear infinite;
28
- }
39
+ > svg {
40
+ width: 100%;
41
+ height: 100%;
42
+ margin: auto;
43
+ position: absolute;
44
+ top: 0;
45
+ bottom: 0;
46
+ left: 0;
47
+ right: 0;
48
+ z-index: 0;
49
+ }
50
+
51
+ &--visible {
52
+ animation: loader-dash 1.4s ease-in-out infinite;
53
+ stroke-linecap: round;
54
+ stroke-dasharray: 80, 200;
55
+ stroke-dashoffset: 0px;
56
+ }
57
+
58
+ &--indeterminate {
59
+ > svg {
60
+ animation: $loader-rotate-animation;
61
+ transform-origin: center center;
62
+ transition: $loader-intermediate-svg-transition;
63
+ }
29
64
 
30
- .farm-loader__spinner--big-border:before {
31
- border-width: 6px;
65
+ .farm-loader__overlay {
66
+ animation: $loader-rotate-dash;
67
+ stroke-linecap: round;
68
+ stroke-dasharray: 80, 200;
69
+ stroke-dashoffset: 0px;
70
+ }
71
+ }
72
+ &__info {
73
+ align-items: center;
74
+ display: flex;
75
+ justify-content: center;
76
+ }
77
+ &__overlay {
78
+ stroke: currentColor;
79
+ z-index: 2;
80
+ transition: $loader-overlay-transition;
81
+ }
32
82
  }
33
83
 
34
84
  .farm-loader__overlay {
@@ -44,26 +94,23 @@
44
94
  bottom: 0;
45
95
  }
46
96
 
47
- @keyframes rotate {
48
- 100% {
49
- transform: rotate(360deg);
50
- }
51
- }
52
-
53
- @keyframes prixClipFix {
97
+ @keyframes loader-dash {
54
98
  0% {
55
- clip-path: polygon(50% 50%, 0 0, 0 0, 0 0, 0 0, 0 0);
56
- }
57
- 25% {
58
- clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 0, 100% 0, 100% 0);
99
+ stroke-dasharray: 1, 200;
100
+ stroke-dashoffset: 0px;
59
101
  }
60
102
  50% {
61
- clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 100% 100%, 100% 100%);
103
+ stroke-dasharray: 100, 200;
104
+ stroke-dashoffset: -15px;
62
105
  }
63
- 75% {
64
- clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 100%);
106
+ 100% {
107
+ stroke-dasharray: 100, 200;
108
+ stroke-dashoffset: -125px;
65
109
  }
110
+ }
111
+
112
+ @keyframes loader-rotate {
66
113
  100% {
67
- clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 0);
114
+ transform: rotate(360deg);
68
115
  }
69
116
  }
@@ -1,9 +1,56 @@
1
1
  <template>
2
- <div class="farm-loader__overlay" v-if="mode === 'overlay'" :style="styleObject">
3
- <span class="farm-loader__spinner farm-loader__spinner--big"></span>
4
- </div>
5
- <div v-else>
6
- <span class="farm-loader__spinner farm-loader__spinner--big-border" :class="calculateSize"></span>
2
+ <div>
3
+ <div class="farm-loader__overlay" v-if="mode === 'overlay'" :style="styleObject">
4
+ <div
5
+ role="progressbar"
6
+ aria-valuemin="0"
7
+ aria-valuemax="100"
8
+ class="farm-loader farm-loader--big farm-loader--visible farm-loader--indeterminate"
9
+ >
10
+ <svg
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ viewBox="22.857142857142858 22.857142857142858 45.714285714285715 45.714285714285715"
13
+ style="transform: rotate(0deg)"
14
+ >
15
+ <circle
16
+ fill="transparent"
17
+ cx="45.714285714285715"
18
+ cy="45.714285714285715"
19
+ r="20"
20
+ stroke-dasharray="125.664"
21
+ stroke-dashoffset="125.66370614359172px"
22
+ class="farm-loader__overlay"
23
+ ></circle>
24
+ </svg>
25
+ <div class="farm-loader__info"></div>
26
+ </div>
27
+ </div>
28
+ <div v-else>
29
+ <div
30
+ role="progressbar"
31
+ aria-valuemin="0"
32
+ aria-valuemax="100"
33
+ class="farm-loader farm-loader--visible farm-loader--indeterminate"
34
+ :class="calculateSize"
35
+ >
36
+ <svg
37
+ xmlns="http://www.w3.org/2000/svg"
38
+ viewBox="22.857142857142858 22.857142857142858 45.714285714285715 45.714285714285715"
39
+ style="transform: rotate(0deg)"
40
+ >
41
+ <circle
42
+ fill="transparent"
43
+ cx="45.714285714285715"
44
+ cy="45.714285714285715"
45
+ r="20"
46
+ stroke-dasharray="125.664"
47
+ stroke-dashoffset="125.66370614359172px"
48
+ class="farm-loader__overlay"
49
+ ></circle>
50
+ </svg>
51
+ <div class="farm-loader__info"></div>
52
+ </div>
53
+ </div>
7
54
  </div>
8
55
  </template>
9
56
  <script lang="ts">
@@ -22,7 +69,6 @@ export default Vue.extend({
22
69
  },
23
70
  },
24
71
  data() {
25
-
26
72
  const zIndex = Math.max(
27
73
  ...Array.from(document.querySelectorAll('body *'), el =>
28
74
  parseFloat(window.getComputedStyle(el).zIndex)
@@ -38,7 +84,7 @@ export default Vue.extend({
38
84
 
39
85
  computed: {
40
86
  calculateSize() {
41
- return this.size === 'small' ? 'loader--small' : '';
87
+ return this.size === 'small' ? 'farm-loader--small' : '';
42
88
  },
43
89
  },
44
90
  });
@@ -20,7 +20,7 @@ describe('Loader component', () => {
20
20
  });
21
21
  });
22
22
 
23
- describe('Compited properties', () => {
23
+ describe('Computed properties', () => {
24
24
  it('Should calculate calculateSize for default size prop', () => {
25
25
  expect(component.calculateSize).toEqual('');
26
26
  });
@@ -29,7 +29,7 @@ describe('Loader component', () => {
29
29
  await wrapper.setProps({
30
30
  size: 'small',
31
31
  });
32
- expect(component.calculateSize).toEqual('loader--small');
32
+ expect(component.calculateSize).toEqual('farm-loader--small');
33
33
  });
34
34
  });
35
35
  });
@@ -0,0 +1,102 @@
1
+ @import '../../configurations/mixins';
2
+
3
+ .farm-modal {
4
+ position: fixed;
5
+ top: 0;
6
+ left: 0;
7
+ width: 100vw;
8
+ height: 100vh;
9
+ z-index: 100;
10
+ align-items: center;
11
+ display: flex;
12
+ justify-content: center;
13
+ transition: .2s cubic-bezier(0.25, 0.8, 0.25, 1), z-index 1ms;
14
+
15
+ &--overlay {
16
+ position: fixed;
17
+ top: 0;
18
+ left: 0;
19
+ width: 100vw;
20
+ height: 100vh;
21
+ background: rgba(#999999, 0.8);
22
+ z-index: 101;
23
+ }
24
+
25
+ &--container {
26
+ background-color: white;
27
+ border-radius: 8px;
28
+ max-height: calc(100vh - 64px);
29
+ position: relative;
30
+ overflow: hidden;
31
+ z-index: 102;
32
+ @include addShadow;
33
+ }
34
+
35
+ &--size-default {
36
+ .farm-modal--container {
37
+ width: 960px;
38
+ max-width: 960px;
39
+ }
40
+ }
41
+
42
+ &--size-md {
43
+ .farm-modal--container {
44
+ width: 568px;
45
+ max-width: 568px;
46
+ }
47
+ }
48
+
49
+ &--size-sm {
50
+ .farm-modal--container {
51
+ width: 448px;
52
+ max-width: 448px;
53
+ }
54
+ }
55
+
56
+ &--size-xs {
57
+ .farm-modal--container {
58
+ width: 360px;
59
+ max-width: 360px;
60
+ }
61
+ }
62
+
63
+ &--content {
64
+ max-height: calc(100vh - 64px);
65
+ overflow-y: auto;
66
+ width: 100%;
67
+ }
68
+
69
+ &--header {
70
+ position: absolute;
71
+ top: 0;
72
+ background: white;
73
+ width: 100%;
74
+ }
75
+
76
+ &--footer {
77
+ position: absolute;
78
+ bottom: 0;
79
+ background: white;
80
+ width: 100%;
81
+ }
82
+
83
+ }
84
+
85
+ .fade-enter-active,
86
+ .fade-leave-active {
87
+ transition: opacity .25s
88
+ }
89
+
90
+ .fade-enter,
91
+ .fade-leave-to {
92
+ opacity: 0
93
+ }
94
+
95
+ @include upToSm {
96
+ .farm-modal {
97
+ &--container {
98
+ width: calc(100vw - 32px);
99
+ max-width: calc(100vw - 32px);
100
+ }
101
+ }
102
+ }
@@ -0,0 +1,176 @@
1
+ import Modal from './Modal.vue';
2
+
3
+ export default {
4
+ title: 'Display/Modal',
5
+ component: Modal,
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: `Modal<br />
10
+ selector: <em>farm-modal</em>
11
+ `,
12
+ },
13
+ },
14
+ viewMode: 'docs',
15
+ },
16
+ };
17
+
18
+ export const Primary = () => ({
19
+ data() {
20
+ return {
21
+ value: false,
22
+ text,
23
+ };
24
+ },
25
+ template: `<div>
26
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
27
+ <farm-modal v-model="value">
28
+ <template v-slot:content>
29
+ <div v-html="text" />
30
+ </template>
31
+ </farm-modal>
32
+ </div>`,
33
+ });
34
+
35
+ export const HeaderAndBottomFromDS = () => ({
36
+ data() {
37
+ return {
38
+ value: false,
39
+ text,
40
+ };
41
+ },
42
+ template: `<div>
43
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
44
+ <farm-modal v-model="value" :offsetTop="48" :offsetBottom="64">
45
+ <template v-slot:header>
46
+ <farm-dialog-header title="Título" @onClose="() => value = false" />
47
+ </template>
48
+ <template v-slot:content>
49
+ <div v-html="text" />
50
+ </template>
51
+
52
+ <template v-slot:footer>
53
+ <farm-dialog-footer @onConfirm="() => value = false" @onClose="() => value = false" />
54
+ </template>
55
+ </farm-modal>
56
+ </div>`,
57
+ });
58
+
59
+ export const SizeMD = () => ({
60
+ data() {
61
+ return {
62
+ value: false,
63
+ text,
64
+ };
65
+ },
66
+ template: `<div>
67
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
68
+ <farm-modal v-model="value" size="md">
69
+ <template v-slot:content>
70
+ <div v-html="text" />
71
+ </template>
72
+ </farm-modal>
73
+ </div>`,
74
+ });
75
+
76
+ export const SizeSmall = () => ({
77
+ data() {
78
+ return {
79
+ value: false,
80
+ text,
81
+ };
82
+ },
83
+ template: `<div>
84
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
85
+ <farm-modal v-model="value" size="sm">
86
+ <template v-slot:content>
87
+ <div v-html="text" />
88
+ </template>
89
+ </farm-modal>
90
+ </div>`,
91
+ });
92
+
93
+ export const SizeXs = () => ({
94
+ data() {
95
+ return {
96
+ value: false,
97
+ text,
98
+ };
99
+ },
100
+ template: `<div>
101
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
102
+ <farm-modal v-model="value" size="xs">
103
+ <template v-slot:content>
104
+ <div v-html="text" />
105
+ </template>
106
+ </farm-modal>
107
+ </div>`,
108
+ });
109
+
110
+ export const HeaderAndBottom = () => ({
111
+ data() {
112
+ return {
113
+ value: false,
114
+ text,
115
+ };
116
+ },
117
+ template: `<div>
118
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
119
+ <farm-modal v-model="value" :offsetTop="24" :offsetBottom="64">
120
+ <template v-slot:header>
121
+ header vai aqui
122
+ </template>
123
+ <template v-slot:content>
124
+ <div v-html="text" />
125
+ </template>
126
+
127
+ <template v-slot:footer>
128
+ footer vai aqui
129
+ </template>
130
+ </farm-modal>
131
+ </div>`,
132
+ });
133
+
134
+ const text = `inicio!<br />
135
+ teste!<br />
136
+ teste!<br />
137
+ teste!<br />
138
+ teste!<br />
139
+ teste!<br />
140
+ teste!<br />
141
+ teste!<br />
142
+ teste!<br />
143
+ teste!<br />
144
+ teste!<br />
145
+ teste 1!<br />
146
+ teste!<br />
147
+ teste!<br />
148
+ teste!<br />
149
+ teste!<br />
150
+ teste!<br />
151
+ teste!<br />
152
+ teste!<br />
153
+ teste!<br />
154
+ teste!<br />
155
+ teste!<br />
156
+ teste!<br />
157
+ teste!<br />
158
+ teste!<br />
159
+ teste!<br />
160
+ teste!<br />
161
+ teste!<br />
162
+ teste!<br />
163
+ teste 2!<br />
164
+ teste!<br />
165
+ teste!<br />
166
+ teste!<br />
167
+ teste!<br />
168
+ teste!<br />
169
+ teste!<br />
170
+ teste!<br />
171
+ teste!<br />
172
+ teste!<br />
173
+ teste!<br />
174
+ teste!<br />
175
+ teste!<br />
176
+ teste 3!`;