@farm-investimentos/front-mfe-components 11.11.3 → 11.11.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": "11.11.3",
3
+ "version": "11.11.4",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -6,7 +6,11 @@ describe('DataTablePaginator component', () => {
6
6
  let component;
7
7
 
8
8
  beforeEach(() => {
9
- wrapper = shallowMount(DataTablePaginator);
9
+ wrapper = shallowMount(DataTablePaginator, {
10
+ propsData: {
11
+ title: '',
12
+ },
13
+ });
10
14
  component = wrapper.vm;
11
15
  });
12
16
 
@@ -1,3 +1,5 @@
1
+ @import '../../configurations/variables';
2
+
1
3
  input[type="radio"] {
2
4
  -webkit-appearance: none;
3
5
  appearance: none;
@@ -5,8 +7,6 @@ input[type="radio"] {
5
7
  margin: 0;
6
8
  font: inherit;
7
9
  color: rgba(0, 0, 0, .6);
8
- width: 24px;
9
- height: 24px;
10
10
  border: 1.5px solid rgba(0, 0, 0, .6);
11
11
  border-radius: 50%;
12
12
  display: grid;
@@ -15,8 +15,6 @@ input[type="radio"] {
15
15
 
16
16
  &::before {
17
17
  content: "";
18
- width: 10px;
19
- height: 10px;
20
18
  border-radius: 50%;
21
19
  transform: scale(0);
22
20
  transition: 120ms transform ease-in-out;
@@ -47,4 +45,19 @@ input[type="radio"] {
47
45
  &:active {
48
46
  animation: pulse 0.2s 1 ease-out;
49
47
  }
48
+ }
49
+
50
+
51
+ @each $size,
52
+ $value in $sizes {
53
+ #{'input[type="radio"][size=' + $size +']'} {
54
+ width: $value;
55
+ height: $value;
56
+
57
+ &::before {
58
+ content: "";
59
+ width: $value / 2;
60
+ height: $value / 2;
61
+ }
62
+ }
50
63
  }
@@ -1,5 +1,6 @@
1
1
  import { withDesign } from 'storybook-addon-designs';
2
2
  import Radio from './Radio.vue';
3
+ import sizes from '../../configurations/sizes';
3
4
 
4
5
  export default {
5
6
  title: 'Form/Radio',
@@ -10,7 +11,7 @@ export default {
10
11
  description: {
11
12
  component: `Radio<br />
12
13
  selector: <em>farm-radio</em><br />
13
- <span style="color: var(--farm-extra-1-base);">development</span>
14
+ <span style="color: var(--farm-primary-base);">ready for use</span>
14
15
  `,
15
16
  },
16
17
  design: {
@@ -81,3 +82,17 @@ export const Checked = () => ({
81
82
  v-model: {{ v }}
82
83
  </div>`,
83
84
  });
85
+
86
+ export const Sizes = () => ({
87
+ data() {
88
+ return {
89
+ sizes,
90
+ v: 1,
91
+ };
92
+ },
93
+ template: `<div style="width: 480px">
94
+ <div v-for="size in sizes" :key="size" class="d-flex flex-row align-center mb-3">
95
+ <farm-radio v-model="v" :value="size" :size="size" />&nbsp;&nbsp;{{ size }}
96
+ </div>
97
+ </div>`,
98
+ });
@@ -5,13 +5,14 @@
5
5
  'farm-radio--checked': isChecked,
6
6
  }"
7
7
  type="radio"
8
+ :size="$props.size"
8
9
  :checked="isChecked"
9
10
  :value="value"
10
11
  @click="onClick"
11
12
  />
12
13
  </template>
13
14
  <script lang="ts">
14
- import Vue from 'vue';
15
+ import Vue, { PropType } from 'vue';
15
16
 
16
17
  export default Vue.extend({
17
18
  name: 'farm-radio',
@@ -27,6 +28,13 @@ export default Vue.extend({
27
28
  * Value to be set to v-model
28
29
  */
29
30
  value: { type: [String, Number, Boolean], required: true },
31
+ /**
32
+ * Size
33
+ */
34
+ size: {
35
+ type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
36
+ default: 'md',
37
+ },
30
38
  },
31
39
  computed: {
32
40
  isChecked() {
@@ -4,14 +4,24 @@ import Radio from '../Radio.vue';
4
4
 
5
5
  describe('Radio component', () => {
6
6
  let wrapper;
7
+ let component;
7
8
 
8
9
  beforeEach(() => {
9
10
  wrapper = shallowMount(Radio, {
10
- propsData: {},
11
+ propsData: {
12
+ value: 1,
13
+ },
11
14
  });
15
+ component = wrapper.vm;
12
16
  });
13
17
 
14
18
  test('Radio created', () => {
15
19
  expect(wrapper).toBeDefined();
16
20
  });
21
+
22
+ describe('computed properties', () => {
23
+ it('get isRound false', () => {
24
+ expect(component.isChecked).toBeFalsy();
25
+ });
26
+ });
17
27
  });
@@ -5,7 +5,11 @@ describe('RadioGroup component', () => {
5
5
  let wrapper;
6
6
 
7
7
  beforeEach(() => {
8
- wrapper = shallowMount(RadioGroup, {});
8
+ wrapper = shallowMount(RadioGroup, {
9
+ propsData: {
10
+ value: 1,
11
+ },
12
+ });
9
13
  });
10
14
 
11
15
  test('Created hook', () => {