@farm-investimentos/front-mfe-components 11.8.2 → 11.8.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/dist/front-mfe-components.common.js +282 -155
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +282 -155
- 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/DialogHeader/DialogHeader.scss +0 -1
- package/src/components/DialogHeader/DialogHeader.vue +1 -1
- package/src/components/MainFilter/MainFilter.vue +2 -2
- package/src/components/Radio/Radio.scss +50 -0
- package/src/components/Radio/Radio.stories.js +83 -0
- package/src/components/Radio/Radio.vue +52 -0
- package/src/components/Radio/__tests__/Radio.spec.js +17 -0
- package/src/components/Radio/index.ts +4 -0
- package/src/components/Select/Select.stories.js +1 -1
- package/src/components/Select/Select.vue +2 -2
- package/src/main.ts +1 -0
package/package.json
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
<farm-label :for="elementId">
|
|
5
5
|
{{ label }}
|
|
6
6
|
<farm-tooltip v-if="tooltip">
|
|
7
|
-
<farm-caption>
|
|
7
|
+
<farm-caption color="white">
|
|
8
8
|
{{ tooltip }}
|
|
9
9
|
</farm-caption>
|
|
10
|
-
<template v-slot:activator
|
|
10
|
+
<template v-slot:activator>
|
|
11
11
|
<farm-icon size="sm" color="gray">help-circle</farm-icon>
|
|
12
12
|
</template>
|
|
13
13
|
</farm-tooltip>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
input[type="radio"] {
|
|
2
|
+
-webkit-appearance: none;
|
|
3
|
+
appearance: none;
|
|
4
|
+
background-color: #ffffff;
|
|
5
|
+
margin: 0;
|
|
6
|
+
font: inherit;
|
|
7
|
+
color: rgba(0, 0, 0, .6);
|
|
8
|
+
width: 24px;
|
|
9
|
+
height: 24px;
|
|
10
|
+
border: 1.5px solid rgba(0, 0, 0, .6);
|
|
11
|
+
border-radius: 50%;
|
|
12
|
+
display: grid;
|
|
13
|
+
place-content: center;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
|
|
16
|
+
&::before {
|
|
17
|
+
content: "";
|
|
18
|
+
width: 10px;
|
|
19
|
+
height: 10px;
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
transform: scale(0);
|
|
22
|
+
transition: 120ms transform ease-in-out;
|
|
23
|
+
background-color: CanvasText;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.farm-radio--checked::before {
|
|
27
|
+
transform: scale(1);
|
|
28
|
+
box-shadow: inset 16px 16px var(--farm-primary-base);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.farm-radio--checked {
|
|
32
|
+
border-color: var(--farm-primary-base);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:focus {
|
|
36
|
+
outline: none;
|
|
37
|
+
outline-offset: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
box-shadow: 0px 0px 0px 8px rgba(0, 0, 0, 0.1);
|
|
42
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:active {
|
|
48
|
+
animation: pulse 0.2s 1 ease-out;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
import Radio from './Radio.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Form/Radio',
|
|
6
|
+
component: Radio,
|
|
7
|
+
decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `Radio<br />
|
|
12
|
+
selector: <em>farm-radio</em><br />
|
|
13
|
+
<span style="color: var(--farm-extra-1-base);">development</span>
|
|
14
|
+
`,
|
|
15
|
+
},
|
|
16
|
+
design: {
|
|
17
|
+
type: 'figma',
|
|
18
|
+
url: 'https://www.figma.com/file/p62YDSTfWg0Mcnf5APfdvI/%E2%9C%8D-Design-System-%7C-v2?node-id=4913%3A20222&t=RIUg7AZerUGMSaM9-0',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
viewMode: 'docs',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Primary = () => ({
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
v: null,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
template: `<div style="width: 480px">
|
|
32
|
+
<farm-radio v-model="v" value="1" />
|
|
33
|
+
v-model: {{ v }}
|
|
34
|
+
</div>`,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const Group = () => ({
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
v: null,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
template: `<div style="width: 480px">
|
|
44
|
+
<farm-radio v-model="v" value="1" />
|
|
45
|
+
<farm-radio v-model="v" value="2" />
|
|
46
|
+
<farm-radio v-model="v" value="3" />
|
|
47
|
+
v-model: {{ v }}
|
|
48
|
+
</div>`,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const Reset = () => ({
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
v: null,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
methods: {
|
|
58
|
+
reset() {
|
|
59
|
+
this.$refs.form.reset();
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
template: `<div style="width: 480px">
|
|
63
|
+
<farm-form ref="form">
|
|
64
|
+
<farm-radio v-model="v" value="1" />
|
|
65
|
+
<farm-radio v-model="v" value="2" />
|
|
66
|
+
<farm-radio v-model="v" value="3" />
|
|
67
|
+
v-model: {{ v }}
|
|
68
|
+
<farm-btn @click="reset">reset</farm-btn>
|
|
69
|
+
</farm-form>
|
|
70
|
+
</div>`,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const Checked = () => ({
|
|
74
|
+
data() {
|
|
75
|
+
return {
|
|
76
|
+
v: 1,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
template: `<div style="width: 480px">
|
|
80
|
+
<farm-radio v-model="v" value="1" />
|
|
81
|
+
v-model: {{ v }}
|
|
82
|
+
</div>`,
|
|
83
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<input
|
|
3
|
+
:class="{
|
|
4
|
+
'farm-radio': true,
|
|
5
|
+
'farm-radio--checked': isChecked,
|
|
6
|
+
}"
|
|
7
|
+
type="radio"
|
|
8
|
+
:checked="isChecked"
|
|
9
|
+
:value="value"
|
|
10
|
+
@click="onClick"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import Vue from 'vue';
|
|
15
|
+
|
|
16
|
+
export default Vue.extend({
|
|
17
|
+
name: 'farm-radio',
|
|
18
|
+
model: {
|
|
19
|
+
prop: 'modelValue',
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
/**
|
|
23
|
+
* v-model binding
|
|
24
|
+
*/
|
|
25
|
+
modelValue: { default: '' },
|
|
26
|
+
/**
|
|
27
|
+
* Value to be set to v-model
|
|
28
|
+
*/
|
|
29
|
+
value: { type: [String, Number, Boolean], default: undefined },
|
|
30
|
+
},
|
|
31
|
+
computed: {
|
|
32
|
+
isChecked() {
|
|
33
|
+
return this.modelValue == this.value;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
setup(_, { emit }) {
|
|
37
|
+
const onClick = event => {
|
|
38
|
+
emit('change', event.target.value);
|
|
39
|
+
emit('input', event.target.value);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const reset = () => {
|
|
43
|
+
emit('input', null);
|
|
44
|
+
};
|
|
45
|
+
const validate = () => {};
|
|
46
|
+
return { onClick, reset, validate };
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
<style lang="scss" scoped>
|
|
51
|
+
@import 'Radio';
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
|
|
3
|
+
import Radio from '../Radio.vue';
|
|
4
|
+
|
|
5
|
+
describe('Radio component', () => {
|
|
6
|
+
let wrapper;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(Radio, {
|
|
10
|
+
propsData: {},
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Radio created', () => {
|
|
15
|
+
expect(wrapper).toBeDefined();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</farm-listitem>
|
|
27
27
|
</farm-list>
|
|
28
28
|
<template v-slot:activator="{}">
|
|
29
|
-
<div class="farm-textfield--input">
|
|
29
|
+
<div class="farm-textfield--input farm-textfield--input--iconed">
|
|
30
30
|
<input
|
|
31
31
|
v-model="selectedText"
|
|
32
32
|
:disabled="disabled"
|
|
@@ -165,7 +165,7 @@ export default Vue.extend({
|
|
|
165
165
|
|
|
166
166
|
onBeforeMount(() => {
|
|
167
167
|
validate(innerValue.value);
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
const selectedItem = items.value.find(
|
|
170
170
|
item => item[itemValue.value] === innerValue.value
|
|
171
171
|
);
|
package/src/main.ts
CHANGED
|
@@ -82,6 +82,7 @@ export * from './components/Logger/LoggerItem';
|
|
|
82
82
|
export * from './components/Icon';
|
|
83
83
|
export * from './components/Modal';
|
|
84
84
|
export * from './components/ProgressBar';
|
|
85
|
+
export * from './components/Radio';
|
|
85
86
|
export * from './components/RadioGroup';
|
|
86
87
|
export * from './components/Select';
|
|
87
88
|
export * from './components/Stepper';
|