@farm-investimentos/front-mfe-components 9.2.5 → 9.3.1

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.5",
3
+ "version": "9.3.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -64,5 +64,8 @@
64
64
  },
65
65
  "publishConfig": {
66
66
  "@farm-investimentos:registry": "https://registry.npmjs.org"
67
+ },
68
+ "engines": {
69
+ "node": ">=14.0.0 <15.0.0"
67
70
  }
68
71
  }
@@ -1,3 +1,5 @@
1
+ @import '../../configurations/theme-colors';
2
+
1
3
  .farm-checkbox__container {
2
4
  display: flex;
3
5
  flex-direction: row;
@@ -5,6 +7,29 @@
5
7
  .farm-label {
6
8
  margin-left: 8px;
7
9
  }
10
+
11
+ @each $color in $theme-colors-list {
12
+ &#{'[color=' + $color + ']'} {
13
+ .farm-checkbox--checked {
14
+ background-color: themeColor($color);
15
+ border-color: themeColor($color);
16
+
17
+ &.farm-checkbox--lighten {
18
+ background-color: themeColor($color, 'lighten');
19
+ border-color: themeColor($color, 'lighten');
20
+
21
+ .farm-icon {
22
+ color: themeColor($color, 'darken');
23
+ }
24
+ }
25
+
26
+ &.farm-checkbox--darken {
27
+ background-color: themeColor($color, 'darken');
28
+ border-color: themeColor($color, 'darken');
29
+ }
30
+ }
31
+ }
32
+ }
8
33
  }
9
34
 
10
35
  .farm-checkbox {
@@ -18,12 +43,17 @@
18
43
  line-height: 0;
19
44
  transition: all 0.4s;
20
45
 
21
- &--checked {
22
- background-color: var(--v-secondary-base);
23
- border-color: var(--v-secondary-base);
46
+ &--disabled {
47
+ border-color: #dadada;
48
+ cursor: default;
49
+
50
+ &.farm-checkbox--checked {
51
+ background-color: #dadada;
52
+ }
24
53
  }
25
54
 
26
55
  .farm-icon {
27
56
  color: white;
28
57
  }
58
+
29
59
  }
@@ -1,4 +1,8 @@
1
1
  import Checkbox from './Checkbox';
2
+ import baseThemeColors from '../../configurations/_theme-colors-base.scss';
3
+
4
+ const colors = Object.keys(baseThemeColors);
5
+ const variations = ['', 'darken', 'lighten'];
2
6
 
3
7
  export default {
4
8
  title: 'Form/Checkbox',
@@ -47,3 +51,43 @@ export const WithLabel = () => ({
47
51
  <farm-checkbox v-model="isChecked" label="custom label" />
48
52
  </div>`,
49
53
  });
54
+
55
+ export const Disabled = () => ({
56
+ data() {
57
+ return {
58
+ isChecked: true,
59
+ notIsChecked: false,
60
+ };
61
+ },
62
+ template: `<div>
63
+ <farm-checkbox v-model="isChecked" :disabled="true" /><br />
64
+ <farm-checkbox v-model="notIsChecked" :disabled="true" />
65
+ </div>`,
66
+ });
67
+
68
+ export const Colors = () => ({
69
+ data() {
70
+ return {
71
+ isChecked: true,
72
+ colors,
73
+ variations,
74
+ };
75
+ },
76
+ template: `<div style="display: flex; flex-direction: row; flex-wrap: wrap;">
77
+ <div v-for="color in colors" style="width: 33.3%;">
78
+ <h4>{{ color }}</h4>
79
+ <div
80
+ style="display: flex; flex-direction: column;"
81
+ v-for="variation in variations"
82
+ :key="color + '_' + variation"
83
+ >
84
+ <farm-checkbox
85
+ v-model="isChecked"
86
+ :color="color"
87
+ :variation="variation"
88
+ :label="variation || 'Base'"
89
+ />
90
+ </div>
91
+ </div>
92
+ </div>`,
93
+ });
@@ -1,18 +1,24 @@
1
1
  <template>
2
- <div class="farm-checkbox__container">
2
+ <div class="farm-checkbox__container" :color="$props.color">
3
3
  <span
4
- :class="{ 'farm-checkbox': true, 'farm-checkbox--checked': innerValue }"
4
+ :class="{
5
+ 'farm-checkbox': true,
6
+ 'farm-checkbox--checked': innerValue,
7
+ 'farm-checkbox--disabled': disabled,
8
+ 'farm-checkbox--lighten': variation === 'lighten',
9
+ 'farm-checkbox--darken': variation === 'darken',
10
+ }"
5
11
  @click="toggleValue"
6
12
  >
7
13
  <farm-icon size="sm" v-if="innerValue">check</farm-icon>
8
14
  </span>
9
15
  <farm-label v-if="label">
10
- {{ label }}
11
- </farm-label>
16
+ {{ label }}
17
+ </farm-label>
12
18
  </div>
13
19
  </template>
14
20
  <script lang="ts">
15
- import Vue, { ref } from 'vue';
21
+ import Vue, { ref, toRefs, watch } from 'vue';
16
22
 
17
23
  export default Vue.extend({
18
24
  name: 'farm-checkbox',
@@ -25,19 +31,42 @@ export default Vue.extend({
25
31
  * Label
26
32
  */
27
33
  label: { type: String, default: null },
34
+ /**
35
+ * disabled
36
+ */
37
+ disabled: { type: Boolean, default: false },
38
+ variation: {
39
+ type: String,
40
+ default: '',
41
+ },
42
+ color: {
43
+ type: String,
44
+ default: 'primary',
45
+ },
28
46
  },
29
47
  setup(props, { emit }) {
30
48
  const innerValue = ref(props.value);
31
- const { label } = props;
49
+ const { label, disabled } = toRefs(props);
32
50
 
33
51
  const toggleValue = () => {
52
+ if (disabled.value) {
53
+ return false;
54
+ }
34
55
  innerValue.value = !innerValue.value;
35
56
  emit('input', innerValue.value);
36
57
  };
37
58
 
59
+ watch(
60
+ () => props.value,
61
+ () => {
62
+ innerValue.value = props.value;
63
+ }
64
+ );
65
+
38
66
  return {
39
67
  innerValue,
40
68
  label,
69
+ disabled,
41
70
  toggleValue,
42
71
  };
43
72
  },
@@ -3,8 +3,8 @@
3
3
  .farm-chip {
4
4
  display: inline-flex;
5
5
  padding: 0 8px;
6
- border-radius: 8px;
7
- background-color: themeColor('secondary');
6
+ border-radius: 16px;
7
+ background-color: themeColor('primary');
8
8
  height: 24px;
9
9
  min-width: 80px;
10
10
  max-width: 100%;
@@ -13,6 +13,9 @@
13
13
  align-items: center;
14
14
  color: white;
15
15
  width: 100%;
16
+ border: 1px solid themeColor('primary');
17
+ font-size: 12px;
18
+ font-weight: 500;
16
19
 
17
20
  &--dense {
18
21
  min-width: auto;
@@ -26,14 +29,54 @@
26
29
  @each $color in $theme-colors-list {
27
30
  &#{'[color=' + $color + ']'} {
28
31
  background-color: themeColor($color);
32
+ border-color: themeColor($color);
29
33
 
30
- &[variation='lighten'] {
34
+ &.farm-chip--lighten {
31
35
  background-color: themeColor($color, 'lighten');
32
- color: black;
36
+ border-color: themeColor($color, 'lighten');
37
+ color: themeColor($color, 'darken');
33
38
  }
34
39
 
35
- &[variation='darken'] {
40
+ &.farm-chip--darken {
36
41
  background-color: themeColor($color, 'darken');
42
+ border-color: themeColor($color, 'darken');
43
+ }
44
+ }
45
+ }
46
+
47
+ &[color='neutral'] {
48
+ color: themeColor('secondary');
49
+
50
+ &.farm-chip--lighten {
51
+ color: themeColor('secondary');
52
+ }
53
+ }
54
+
55
+ &--outlined {
56
+ @each $color in $theme-colors-list {
57
+ &#{'[color=' + $color + ']'} {
58
+ background-color: transparent;
59
+ color: themeColor($color);
60
+
61
+ &.farm-chip--lighten {
62
+ background-color: transparent;
63
+ border-color: themeColor($color, 'lighten');
64
+ color: themeColor($color);
65
+ }
66
+
67
+ &.farm-chip--darken {
68
+ background-color: transparent;
69
+ border-color: themeColor($color, 'darken');
70
+ color: themeColor($color, 'darken');
71
+ }
72
+ }
73
+ }
74
+
75
+ &[color='neutral'] {
76
+ color: themeColor('secondary');
77
+
78
+ &.farm-chip--lighten {
79
+ color: themeColor('secondary');
37
80
  }
38
81
  }
39
82
  }
@@ -1,8 +1,9 @@
1
1
  import Chip from './Chip.vue';
2
+ import baseThemeColors from '../../configurations/_theme-colors-base.scss';
2
3
  import('./Chip.stories.scss');
3
4
 
4
- const colors = ['secondary', 'info', 'error'];
5
- const variations = ['darken', 'lighten'];
5
+ const colors = Object.keys(baseThemeColors);
6
+ const variations = ['', 'darken', 'lighten'];
6
7
 
7
8
  export default {
8
9
  title: 'Display/Chips',
@@ -10,14 +11,14 @@ export default {
10
11
  };
11
12
 
12
13
  export const Primary = () => ({
13
- template: `<div class="chips-container">
14
- <farm-chip color="info">Chip (100% width)</farm-chip>
14
+ template: `<div class="chips-container chips-container-full-example">
15
+ <farm-chip color="primary">Chip (100% width)</farm-chip>
15
16
  </div>`,
16
17
  });
17
18
 
18
19
  export const Dense = () => ({
19
20
  template: `<div class="chips-container">
20
- <farm-chip color="info" :dense="true">prop</farm-chip>
21
+ <farm-chip color="primary" :dense="true">prop</farm-chip>
21
22
  <farm-chip color="secondary" dense>attribute</farm-chip>
22
23
  </div>`,
23
24
  });
@@ -26,20 +27,27 @@ export const Colors = () => ({
26
27
  data() {
27
28
  return {
28
29
  colors,
30
+ variations,
29
31
  };
30
32
  },
31
- template: `<div class="chips-container">
32
- <h3>Base Colors</h3>
33
- <farm-chip
34
- v-for="color in colors"
35
- :key="color"
36
- :color="color">
37
- {{ color }}
38
- </farm-chip>
33
+ template: `
34
+ <div>
35
+ <h3>Colors & variations</h3>
36
+ <div class="chips-container" v-for="color in colors">
37
+ <h4>{{ color }}</h4>
38
+ <farm-chip
39
+ v-for="variation in variations"
40
+ :key="color + '_' + variation"
41
+ :color="color"
42
+ :variation="variation">
43
+ {{ variation || 'base' }}
44
+ </farm-chip>
45
+ </div>
46
+
39
47
  </div>`,
40
48
  });
41
49
 
42
- export const Variations = () => ({
50
+ export const ColorsOutlined = () => ({
43
51
  data() {
44
52
  return {
45
53
  colors,
@@ -48,16 +56,26 @@ export const Variations = () => ({
48
56
  },
49
57
  template: `
50
58
  <div>
51
- <h3>Variations</h3>
59
+ <h3>Outlined</h3>
52
60
  <div class="chips-container" v-for="color in colors">
53
61
  <h4>{{ color }}</h4>
54
62
  <farm-chip
55
63
  v-for="variation in variations"
56
64
  :key="color + '_' + variation"
57
65
  :color="color"
66
+ :outlined="true"
58
67
  :variation="variation">
59
- {{ variation }}
68
+ {{ variation || 'base' }}
60
69
  </farm-chip>
61
70
  </div>
71
+
72
+ </div>`,
73
+ });
74
+
75
+ export const CustomTypography = () => ({
76
+ template: `<div class="chips-container">
77
+ <farm-chip color="primary">
78
+ <farm-bodytext :type="2">BodyText 2</farm-bodytext>
79
+ </farm-chip>
62
80
  </div>`,
63
81
  });
@@ -1,9 +1,16 @@
1
1
  .chips-container {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- max-width: 320px;
4
+ max-width: 160px;
5
5
 
6
6
  > .farm-chip {
7
7
  margin-bottom: 16px;
8
8
  }
9
+
10
+ &-full-example {
11
+ border:1px solid black;
12
+ > .farm-chip {
13
+ margin-bottom: 0;
14
+ }
15
+ }
9
16
  }
@@ -1,5 +1,13 @@
1
1
  <template>
2
- <span :class="{ 'farm-chip': true, 'farm-chip--dense': dense }">
2
+ <span
3
+ :class="{
4
+ 'farm-chip': true,
5
+ 'farm-chip--dense': dense,
6
+ 'farm-chip--outlined': outlined,
7
+ 'farm-chip--lighten': variation === 'lighten',
8
+ 'farm-chip--darken': variation === 'darken',
9
+ }"
10
+ >
3
11
  <farm-typography tag="span" size="sm"> <slot></slot> </farm-typography>
4
12
  </span>
5
13
  </template>
@@ -17,6 +25,17 @@ export default Vue.extend({
17
25
  type: Boolean,
18
26
  default: false,
19
27
  },
28
+ /**
29
+ * Is outlined
30
+ */
31
+ outlined: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ variation: {
36
+ type: String,
37
+ default: '',
38
+ },
20
39
  },
21
40
  });
22
41
  </script>
@@ -17,7 +17,6 @@ export const Secondary = () => ({
17
17
  </div>`,
18
18
  });
19
19
 
20
-
21
20
  export const CustomIcon = () => ({
22
21
  template: `
23
22
  <div style="max-width: 480px; position: relative;">
@@ -42,4 +41,12 @@ export const NoCloseIcon = () => ({
42
41
  <div style="max-width: 480px; position: relative;">
43
42
  <farm-dialog-header title="Título do header" :hasCloseIcon="false" />
44
43
  </div>`,
45
- });
44
+ });
45
+
46
+ export const TemplateSlot = () => ({
47
+ template: `<div style="max-width: 480px; position: relative;">
48
+ <farm-dialog-header>
49
+ Template Slot <farm-chip :dense="true">chip</farm-chip>
50
+ </farm-dialog-header>
51
+ </div>`,
52
+ });
@@ -3,6 +3,8 @@
3
3
  <farm-icon v-if="iconTitle" size="16px" color="secondary">{{ iconTitle }}</farm-icon>
4
4
  {{ title }}
5
5
 
6
+ <slot></slot>
7
+
6
8
  <farm-icon
7
9
  v-if="hasCloseIcon"
8
10
  role="button"
@@ -30,7 +32,6 @@ export default Vue.extend({
30
32
  title: {
31
33
  type: String,
32
34
  default: '',
33
- required: true,
34
35
  },
35
36
  /**
36
37
  * Ícone - usa os do material icons
@@ -38,7 +39,6 @@ export default Vue.extend({
38
39
  iconTitle: {
39
40
  type: String,
40
41
  default: null,
41
- required: false,
42
42
  },
43
43
  /**
44
44
  * Ícone - se possui o ícone de fechar
@@ -46,7 +46,6 @@ export default Vue.extend({
46
46
  hasCloseIcon: {
47
47
  type: Boolean,
48
48
  default: true,
49
- required: false,
50
49
  },
51
50
  },
52
51
  components: {
@@ -32,34 +32,6 @@
32
32
  @include addShadow;
33
33
  }
34
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
35
  &--content {
64
36
  max-height: calc(100vh - 64px);
65
37
  overflow-y: auto;
@@ -99,4 +71,36 @@
99
71
  max-width: calc(100vw - 32px);
100
72
  }
101
73
  }
74
+ }
75
+
76
+ @include fromSm {
77
+ .farm-modal {
78
+ &--size-default {
79
+ .farm-modal--container {
80
+ width: 960px;
81
+ max-width: 960px;
82
+ }
83
+ }
84
+
85
+ &--size-md {
86
+ .farm-modal--container {
87
+ width: 568px;
88
+ max-width: 568px;
89
+ }
90
+ }
91
+
92
+ &--size-sm {
93
+ .farm-modal--container {
94
+ width: 448px;
95
+ max-width: 448px;
96
+ }
97
+ }
98
+
99
+ &--size-xs {
100
+ .farm-modal--container {
101
+ width: 360px;
102
+ max-width: 360px;
103
+ }
104
+ }
105
+ }
102
106
  }
@@ -41,7 +41,7 @@ export const HeaderAndBottomFromDS = () => ({
41
41
  },
42
42
  template: `<div>
43
43
  <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
44
- <farm-modal v-model="value" :offsetTop="48" :offsetBottom="64">
44
+ <farm-modal v-model="value" :offsetTop="48" :offsetBottom="68">
45
45
  <template v-slot:header>
46
46
  <farm-dialog-header title="Título" @onClose="() => value = false" />
47
47
  </template>
@@ -116,22 +116,68 @@ export const HeaderAndBottom = () => ({
116
116
  },
117
117
  template: `<div>
118
118
  <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
119
- <farm-modal v-model="value" :offsetTop="24" :offsetBottom="64">
119
+ <farm-modal v-model="value" :offsetTop="24" :offsetBottom="68">
120
120
  <template v-slot:header>
121
- header vai aqui
121
+ Header
122
122
  </template>
123
123
  <template v-slot:content>
124
124
  <div v-html="text" />
125
125
  </template>
126
126
 
127
127
  <template v-slot:footer>
128
- footer vai aqui
128
+ Footer
129
+ </template>
130
+ </farm-modal>
131
+ </div>`,
132
+ });
133
+
134
+ export const HorizontalScroll = () => ({
135
+ data() {
136
+ return {
137
+ value: false,
138
+ };
139
+ },
140
+ template: `<div>
141
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
142
+ <farm-modal v-model="value" size="md" :offsetBottom="68">
143
+ <template v-slot:content>
144
+ <div style="width: 800px;">
145
+ horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll
146
+ </div>
147
+ </template>
148
+ <template v-slot:footer>
149
+ <farm-dialog-footer @onConfirm="() => value = false" @onClose="() => value = false" />
150
+ </template>
151
+ </farm-modal>
152
+ </div>`,
153
+ });
154
+
155
+ export const CustomHeader = () => ({
156
+ data() {
157
+ return {
158
+ value: false,
159
+ text,
160
+ };
161
+ },
162
+ template: `<div>
163
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
164
+ <farm-modal v-model="value" :offsetTop="24" :offsetBottom="68">
165
+ <template v-slot:header>
166
+ <farm-dialog-header>
167
+ Template Slot <farm-chip :dense="true">chip</farm-chip>
168
+ </farm-dialog-header>
169
+ </template>
170
+ <template v-slot:content>
171
+ <div v-html="text" />
172
+ </template>
173
+
174
+ <template v-slot:footer>
175
+ <farm-dialog-footer @onConfirm="() => value = false" @onClose="() => value = false" />
129
176
  </template>
130
177
  </farm-modal>
131
178
  </div>`,
132
179
  });
133
180
 
134
- <<<<<<< HEAD
135
181
  export const Persistent = () => ({
136
182
  data() {
137
183
  return {
@@ -156,8 +202,6 @@ export const Persistent = () => ({
156
202
  </div>`,
157
203
  });
158
204
 
159
- =======
160
- >>>>>>> develop
161
205
  const text = `inicio!<br />
162
206
  teste!<br />
163
207
  teste!<br />
@@ -53,8 +53,8 @@ export default Vue.extend({
53
53
  const { offsetTop, offsetBottom, persistent, size } = toRefs(props);
54
54
  const inputValue = ref(props.value);
55
55
  const styles = {
56
- paddingTop: offsetTop.value + 'px',
57
- paddingBottom: offsetBottom.value + 'px',
56
+ marginTop: offsetTop.value + 'px',
57
+ marginBottom: offsetBottom.value + 'px',
58
58
  };
59
59
 
60
60
  const close = () => {
@@ -17,7 +17,7 @@
17
17
  }
18
18
 
19
19
  @mixin fromSm {
20
- @media (min-width: 960) {
20
+ @media (min-width: 960px) {
21
21
  @content;
22
22
  }
23
23
  }
@@ -1,8 +1,10 @@
1
1
  @import './theme-colors';
2
2
 
3
3
  :export {
4
+
4
5
  @each $name,
5
6
  $color in $theme-colors {
6
7
  #{$name}: themeColor($name);
7
8
  }
8
- }
9
+
10
+ }
@@ -0,0 +1,10 @@
1
+ @import './theme-colors';
2
+
3
+ :export {
4
+
5
+ @each $name,
6
+ $color in $stroke-colors {
7
+ #{'stroke-' + $name}: $color;
8
+ }
9
+
10
+ }