@farm-investimentos/front-mfe-components 9.3.1 → 9.4.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.
- package/dist/front-mfe-components.common.js +558 -118
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +2 -2
- package/dist/front-mfe-components.umd.js +558 -118
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Card/Card.stories.js +2 -1
- package/src/components/Checkbox/Checkbox.stories.js +2 -1
- package/src/components/Checkbox/Checkbox.vue +52 -4
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +5 -1
- package/src/components/Chip/Chip.scss +9 -0
- package/src/components/Form/Form.stories.js +146 -0
- package/src/components/Form/Form.vue +69 -0
- package/src/components/Form/__tests__/Form.spec.js +16 -0
- package/src/components/Form/index.ts +4 -0
- package/src/components/Loader/Loader.stories.ts +2 -1
- package/src/components/Logger/Logger.stories.js +2 -1
- package/src/components/Modal/Modal.stories.js +1 -0
- package/src/components/RadioGroup/IRadioGroup.ts +6 -0
- package/src/components/RadioGroup/RadioGroup.scss +82 -0
- package/src/components/RadioGroup/RadioGroup.stories.js +34 -0
- package/src/components/RadioGroup/RadioGroup.vue +71 -0
- package/src/components/RadioGroup/__tests__/RadioGroup.spec.js +20 -0
- package/src/components/RadioGroup/index.ts +4 -0
- package/src/components/layout/Container/Container.stories.js +0 -1
- package/src/components/layout/Row/Row.scss +6 -0
- package/src/components/layout/Row/Row.stories.js +23 -0
- package/src/components/layout/Row/Row.vue +22 -0
- package/src/components/layout/Row/__tests__/Row.spec.js +22 -0
- package/src/components/layout/Row/index.ts +4 -0
- package/src/composition/__tests__/deepEqual.spec.js +13 -0
- package/src/composition/__tests__/validateFormFieldBuilder.spec.js +8 -0
- package/src/composition/__tests__/validateFormStateBuilder.spec.js +8 -0
- package/src/composition/deepEqual.ts +24 -0
- package/src/composition/validateFormFieldBuilder.ts +19 -0
- package/src/composition/validateFormMethodBuilder.ts +9 -0
- package/src/composition/validateFormStateBuilder.ts +13 -0
- package/src/configurations/_theme-colors.scss +3 -3
- package/src/examples/Form/Full.stories.js +1 -1
- package/src/main.ts +3 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Row from './Row.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Layout/Row',
|
|
5
|
+
component: Row,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Row<br />
|
|
10
|
+
selector: <em>farm-row</em>
|
|
11
|
+
<span style="color: yellow;">wait</span>
|
|
12
|
+
`,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
viewMode: 'docs',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Primary = () => ({
|
|
20
|
+
template: '<farm-row>row content</farm-row>',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
Primary.storyName = 'Basic';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component v-bind:is="tag" class="farm-row">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</component>
|
|
5
|
+
</template>
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
import Vue from 'vue';
|
|
8
|
+
|
|
9
|
+
export default Vue.extend({
|
|
10
|
+
name: 'farm-row',
|
|
11
|
+
props: {
|
|
12
|
+
/**
|
|
13
|
+
* Html tag
|
|
14
|
+
*/
|
|
15
|
+
tag: { type: String, default: 'div' },
|
|
16
|
+
},
|
|
17
|
+
inheritAttrs: true,
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
<style lang="scss" scoped>
|
|
21
|
+
@import 'Row.scss';
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import Row from '../Row';
|
|
3
|
+
|
|
4
|
+
describe('Row component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(Row);
|
|
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,13 @@
|
|
|
1
|
+
import deepEqual from '../deepEqual';
|
|
2
|
+
|
|
3
|
+
describe('deepEqual', () => {
|
|
4
|
+
it('Should return true for same object', () => {
|
|
5
|
+
const r = deepEqual({ a: 1 }, { a: 1 });
|
|
6
|
+
expect(r).toBeTruthy();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('Should return true for different object', () => {
|
|
10
|
+
const r = deepEqual({ a: 1 }, { a: '1' });
|
|
11
|
+
expect(r).toBeFalsy();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function deepEqual(a: any, b: any): boolean {
|
|
2
|
+
if (a === b) return true;
|
|
3
|
+
|
|
4
|
+
if (a instanceof Date && b instanceof Date && a.getTime() !== b.getTime()) {
|
|
5
|
+
// If the values are Date, compare them as timestamps
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (a !== Object(a) || b !== Object(b)) {
|
|
10
|
+
// If the values aren't objects, they were already checked for equality
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = Object.keys(a);
|
|
15
|
+
|
|
16
|
+
if (props.length !== Object.keys(b).length) {
|
|
17
|
+
// Different number of props, don't bother to check
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return props.every(p => deepEqual(a[p], b[p]));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default deepEqual;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default function (rules) {
|
|
2
|
+
return value => {
|
|
3
|
+
const innerErrorBucket = [];
|
|
4
|
+
for (let index = 0; index < rules.length; index++) {
|
|
5
|
+
const rule = rules[index];
|
|
6
|
+
const valid = typeof rule === 'function' ? rule(value) : rule;
|
|
7
|
+
|
|
8
|
+
if (valid === false || typeof valid === 'string') {
|
|
9
|
+
innerErrorBucket.push(valid || '');
|
|
10
|
+
} else if (typeof valid !== 'boolean') {
|
|
11
|
+
console.error(
|
|
12
|
+
`Rules should return a string or boolean, received '${typeof valid}' instead`,
|
|
13
|
+
this
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return innerErrorBucket;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -11,9 +11,9 @@ $secondary: (
|
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
$neutral: (
|
|
14
|
-
base: #
|
|
14
|
+
base: #E0E0E0,
|
|
15
15
|
lighten: #F5F5F5,
|
|
16
|
-
darken: #
|
|
16
|
+
darken: #5C5C5C,
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
$error: (
|
|
@@ -42,7 +42,7 @@ $success: (
|
|
|
42
42
|
|
|
43
43
|
$extra-1: (
|
|
44
44
|
base: #8E24AA,
|
|
45
|
-
lighten: #
|
|
45
|
+
lighten: #F3E5F5,
|
|
46
46
|
darken: #4A148C,
|
|
47
47
|
);
|
|
48
48
|
|
|
@@ -42,7 +42,7 @@ export const Primary = () => ({
|
|
|
42
42
|
<farm-textfield v-model="form.name" />
|
|
43
43
|
</div>
|
|
44
44
|
<div class="footer" :style="[styles.footer]">
|
|
45
|
-
<
|
|
45
|
+
<farm-btn color="secondary" :disabled="!validForm">Salvar</farm-btn>
|
|
46
46
|
</div>
|
|
47
47
|
</v-form>
|
|
48
48
|
`,
|
package/src/main.ts
CHANGED
|
@@ -69,12 +69,14 @@ export * from './components/ResetTableRowSelection';
|
|
|
69
69
|
export * from './components/MultipleSelectShortener';
|
|
70
70
|
export * from './components/SelectModalOptions';
|
|
71
71
|
export * from './components/ChipInviteStatus';
|
|
72
|
+
export * from './components/Form';
|
|
72
73
|
export * from './components/Label';
|
|
73
74
|
export * from './components/Logger';
|
|
74
75
|
export * from './components/Logger/LoggerItem';
|
|
75
76
|
export * from './components/Icon';
|
|
76
77
|
export * from './components/Modal';
|
|
77
78
|
export * from './components/ProgressBar';
|
|
79
|
+
export * from './components/RadioGroup';
|
|
78
80
|
export * from './components/Stepper';
|
|
79
81
|
export * from './components/Switcher';
|
|
80
82
|
export * from './components/TextField';
|
|
@@ -83,4 +85,5 @@ export * from './components/Typography';
|
|
|
83
85
|
|
|
84
86
|
export * from './components/layout/Container';
|
|
85
87
|
export * from './components/layout/ContainerFooter';
|
|
88
|
+
export * from './components/layout/Row';
|
|
86
89
|
export * from './components/layout/Line';
|