@farm-investimentos/front-mfe-components 9.2.3 → 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.3",
3
+ "version": "9.2.4",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -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!`;
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <transition name="fade">
3
+ <div :class="{ 'farm-modal': true, ['farm-modal--size-' + size]: true }" v-if="inputValue">
4
+ <div class="farm-modal--container">
5
+ <div class="farm-modal--header">
6
+ <slot name="header"></slot>
7
+ </div>
8
+ <div class="farm-modal--content" :style="styles">
9
+ <slot name="content"></slot>
10
+ </div>
11
+ <div class="farm-modal--footer">
12
+ <slot name="footer"></slot>
13
+ </div>
14
+ </div>
15
+ <div class="farm-modal--overlay" @click="close()"></div>
16
+ </div>
17
+ </transition>
18
+ </template>
19
+ <script lang="ts">
20
+ import Vue, { PropType, ref, toRefs, watch } from 'vue';
21
+
22
+ export default Vue.extend({
23
+ name: 'farm-modal',
24
+ props: {
25
+ /**
26
+ * v-model binding
27
+ */
28
+ value: { type: Boolean, required: true, default: true },
29
+ /**
30
+ * Is persistent
31
+ */
32
+ persistent: { type: Boolean, default: false },
33
+ size: {
34
+ type: String as PropType<'xs' | 'sm' | 'md' | 'default'>,
35
+ default: 'default',
36
+ },
37
+ /**
38
+ * content offset, in pixels, from the top
39
+ */
40
+ offsetTop: {
41
+ type: Number,
42
+ default: 0,
43
+ },
44
+ /**
45
+ * content offset, in pixels, from the bottom
46
+ */
47
+ offsetBottom: {
48
+ type: Number,
49
+ default: 0,
50
+ },
51
+ },
52
+ setup(props, { emit }) {
53
+ const { offsetTop, offsetBottom, persistent, size } = toRefs(props);
54
+ const inputValue = ref(props.value);
55
+ const styles = {
56
+ paddingTop: offsetTop.value + 'px',
57
+ paddingBottom: offsetBottom.value + 'px',
58
+ };
59
+
60
+ const close = () => {
61
+ if (persistent.value) {
62
+ return false;
63
+ }
64
+ inputValue.value = false;
65
+ emit('input', false);
66
+ };
67
+
68
+ watch(
69
+ () => props.value,
70
+ newValue => {
71
+ inputValue.value = newValue;
72
+ }
73
+ );
74
+
75
+ return {
76
+ inputValue,
77
+ styles,
78
+ close,
79
+ size,
80
+ };
81
+ },
82
+ });
83
+ </script>
84
+ <style lang="scss" scoped>
85
+ @import './Modal';
86
+ </style>
@@ -0,0 +1,21 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import Modal from '../index';
4
+
5
+ describe('Modal component', () => {
6
+ let wrapper;
7
+ let component;
8
+
9
+ beforeEach(() => {
10
+ wrapper = shallowMount(Modal, {
11
+ propsData: {
12
+ value: false,
13
+ },
14
+ });
15
+ component = wrapper.vm;
16
+ });
17
+
18
+ test('Modal created', () => {
19
+ expect(wrapper).toBeDefined();
20
+ });
21
+ });
@@ -0,0 +1,4 @@
1
+ import Modal from './Modal.vue';
2
+
3
+ export { Modal };
4
+ export default Modal;
package/src/main.ts CHANGED
@@ -62,6 +62,7 @@ export * from './components/Buttons/MultiImportButton';
62
62
  export * from './components/Card';
63
63
  export * from './components/Checkbox';
64
64
  export * from './components/Chip';
65
+ export * from './components/CopyToClipboard';
65
66
  export * from './components/Logos/ProductLogo';
66
67
  export * from './components/Logos/OriginatorLogo';
67
68
  export * from './components/ResetTableRowSelection';
@@ -72,7 +73,7 @@ export * from './components/Label';
72
73
  export * from './components/Logger';
73
74
  export * from './components/Logger/LoggerItem';
74
75
  export * from './components/Icon';
75
- export * from './components/CopyToClipboard';
76
+ export * from './components/Modal';
76
77
  export * from './components/ProgressBar';
77
78
  export * from './components/Stepper';
78
79
  export * from './components/Switcher';