@farm-investimentos/front-mfe-components 11.2.1 → 11.2.2

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": "11.2.1",
3
+ "version": "11.2.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -18,6 +18,7 @@
18
18
  </template>
19
19
  <script lang="ts">
20
20
  import Vue, { ref, watch, reactive, onBeforeUnmount, toRefs } from 'vue';
21
+ import { calculateMainZindex } from '../../helpers';
21
22
 
22
23
  export default Vue.extend({
23
24
  name: 'farm-contextmenu',
@@ -42,7 +43,7 @@ export default Vue.extend({
42
43
  const parent = ref(null);
43
44
  const popup = ref(null);
44
45
  const activator = ref(null);
45
- const styles = reactive({ minWidth: 0, top: 0 } as any);
46
+ const styles = reactive({ minWidth: 0, top: 0, zIndex: 1 } as any);
46
47
  const { bottom } = toRefs(props);
47
48
 
48
49
  const inputValue = ref(props.value);
@@ -111,8 +112,9 @@ export default Vue.extend({
111
112
  offsetTop -= bottomEdge - window.scrollY - clientHeight + 12;
112
113
  }
113
114
 
114
- styles.top = offsetTop + 'px';
115
- styles.left = offsetLeft + 'px';
115
+ styles.top = `${offsetTop}px`;
116
+ styles.left = `${offsetLeft}px`;
117
+ styles.zIndex = calculateMainZindex();
116
118
  };
117
119
 
118
120
  onBeforeUnmount(() => {
File without changes
@@ -0,0 +1,35 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import TextFieldV2 from './TextFieldV2.vue';
3
+
4
+ export default {
5
+ title: 'Form/TextFieldV2',
6
+ component: TextFieldV2,
7
+ decorators: [withDesign],
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `Text field v2<br />
12
+ selector: <em>farm-texfield-v2</em><br />
13
+ <span style="color: var(--farm-extra-1-base);">development</span>
14
+ `,
15
+ },
16
+ },
17
+ design: {
18
+ type: 'figma',
19
+ url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%85---Design-System-%7C-v1?node-id=1503%3A227',
20
+ },
21
+ viewMode: 'docs',
22
+ },
23
+ };
24
+
25
+ export const Primary = () => ({
26
+ data() {
27
+ return {
28
+ v: 'some text',
29
+ };
30
+ },
31
+ template: `<div style="width: 480px">
32
+ <farm-textfield-v2 v-model="v" />
33
+ value: {{ v }}
34
+ </div>`,
35
+ });
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div class="farm-textfield">
3
+ <div class="farm-textfield--input">
4
+ <input v-bind="$attrs" v-model="innerValue" />
5
+ </div>
6
+ <span class="farm-textfield--text"> hint text</span>
7
+ </div>
8
+ </template>
9
+ <script lang="ts">
10
+ import Vue, { ref, watch } from 'vue';
11
+
12
+ export default Vue.extend({
13
+ name: 'farm-textfield-v2',
14
+ inheritAttrs: true,
15
+ props: {
16
+ /**
17
+ * v-model binding
18
+ */
19
+ value: {},
20
+ },
21
+ setup(props, { emit }) {
22
+ const innerValue = ref(props.value);
23
+
24
+ watch(
25
+ () => props.value,
26
+ () => {
27
+ innerValue.value = props.value;
28
+ }
29
+ );
30
+
31
+ watch(
32
+ () => innerValue.value,
33
+ () => {
34
+ emit('input', innerValue.value);
35
+ }
36
+ );
37
+
38
+ return {
39
+ innerValue,
40
+ };
41
+ },
42
+ });
43
+ </script>
44
+ <style lang="scss" scoped>
45
+ @import 'TextFieldV2';
46
+ </style>
@@ -0,0 +1,20 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import TextFieldV2 from '../TextFieldV2';
3
+
4
+ describe('TextFieldV2 component', () => {
5
+ let wrapper;
6
+
7
+ beforeEach(() => {
8
+ wrapper = shallowMount(TextFieldV2);
9
+ });
10
+
11
+ test('Created hook', () => {
12
+ expect(wrapper).toBeDefined();
13
+ });
14
+
15
+ describe('mount component', () => {
16
+ it('renders correctly', () => {
17
+ expect(wrapper.element).toMatchSnapshot();
18
+ });
19
+ });
20
+ });
@@ -0,0 +1,4 @@
1
+ import TextFieldV2 from './TextFieldV2.vue';
2
+
3
+ export { TextFieldV2 };
4
+ export default TextFieldV2;
@@ -1,9 +1,11 @@
1
1
  export default () => {
2
- const zIndex = Math.max(
3
- ...Array.from(document.querySelectorAll('body *'), el =>
4
- parseFloat(window.getComputedStyle(el).zIndex)
5
- ).filter(zIndex => !Number.isNaN(zIndex)),
6
- 0
2
+ const all_z = [];
3
+ document.querySelectorAll('*').forEach(function (elem) {
4
+ all_z.push(elem.style.zIndex);
5
+ });
6
+ const zIndex = Math.max.apply(
7
+ null,
8
+ all_z.map(x => Number(x))
7
9
  );
8
10
 
9
11
  return zIndex;
package/src/main.ts CHANGED
@@ -83,6 +83,7 @@ export * from './components/RadioGroup';
83
83
  export * from './components/Stepper';
84
84
  export * from './components/Switcher';
85
85
  export * from './components/TextField';
86
+ export * from './components/TextFieldV2';
86
87
  export * from './components/Tooltip';
87
88
  export * from './components/Typography';
88
89