@farm-investimentos/front-mfe-components 9.2.5 → 9.3.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/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.0",
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
  }
@@ -23,6 +23,15 @@
23
23
  border-color: var(--v-secondary-base);
24
24
  }
25
25
 
26
+ &--disabled {
27
+ border-color: #dadada;
28
+ cursor: default;
29
+
30
+ &.farm-checkbox--checked {
31
+ background-color: #dadada;
32
+ }
33
+ }
34
+
26
35
  .farm-icon {
27
36
  color: white;
28
37
  }
@@ -47,3 +47,16 @@ export const WithLabel = () => ({
47
47
  <farm-checkbox v-model="isChecked" label="custom label" />
48
48
  </div>`,
49
49
  });
50
+
51
+ export const Disabled = () => ({
52
+ data() {
53
+ return {
54
+ isChecked: true,
55
+ notIsChecked: false,
56
+ };
57
+ },
58
+ template: `<div>
59
+ <farm-checkbox v-model="isChecked" :disabled="true" /><br />
60
+ <farm-checkbox v-model="notIsChecked" :disabled="true" />
61
+ </div>`,
62
+ });
@@ -1,18 +1,18 @@
1
1
  <template>
2
2
  <div class="farm-checkbox__container">
3
3
  <span
4
- :class="{ 'farm-checkbox': true, 'farm-checkbox--checked': innerValue }"
4
+ :class="{ 'farm-checkbox': true, 'farm-checkbox--checked': innerValue, 'farm-checkbox--disabled': disabled }"
5
5
  @click="toggleValue"
6
6
  >
7
7
  <farm-icon size="sm" v-if="innerValue">check</farm-icon>
8
8
  </span>
9
9
  <farm-label v-if="label">
10
- {{ label }}
11
- </farm-label>
10
+ {{ label }}
11
+ </farm-label>
12
12
  </div>
13
13
  </template>
14
14
  <script lang="ts">
15
- import Vue, { ref } from 'vue';
15
+ import Vue, { ref, toRefs } from 'vue';
16
16
 
17
17
  export default Vue.extend({
18
18
  name: 'farm-checkbox',
@@ -25,12 +25,19 @@ export default Vue.extend({
25
25
  * Label
26
26
  */
27
27
  label: { type: String, default: null },
28
+ /**
29
+ * disabled
30
+ */
31
+ disabled: { type: Boolean, default: false },
28
32
  },
29
33
  setup(props, { emit }) {
30
34
  const innerValue = ref(props.value);
31
- const { label } = props;
35
+ const { label, disabled } = toRefs(props);
32
36
 
33
37
  const toggleValue = () => {
38
+ if(disabled.value) {
39
+ return false;
40
+ }
34
41
  innerValue.value = !innerValue.value;
35
42
  emit('input', innerValue.value);
36
43
  };
@@ -38,6 +45,7 @@ export default Vue.extend({
38
45
  return {
39
46
  innerValue,
40
47
  label,
48
+ disabled,
41
49
  toggleValue,
42
50
  };
43
51
  },
@@ -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,38 @@
26
29
  @each $color in $theme-colors-list {
27
30
  &#{'[color=' + $color + ']'} {
28
31
  background-color: themeColor($color);
29
-
30
- &[variation='lighten'] {
32
+ border-color: themeColor($color);
33
+
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
+ &--outlined {
48
+ @each $color in $theme-colors-list {
49
+ &#{'[color=' + $color + ']'} {
50
+ background-color: transparent;
51
+ color: themeColor($color);
52
+
53
+ &.farm-chip--lighten {
54
+ background-color: transparent;
55
+ border-color: themeColor($color, 'lighten');
56
+ color: themeColor($color);
57
+ }
58
+
59
+ &.farm-chip--darken {
60
+ background-color: transparent;
61
+ border-color: themeColor($color, 'darken');
62
+ color: themeColor($color, 'darken');
63
+ }
37
64
  }
38
65
  }
39
66
  }
@@ -1,8 +1,11 @@
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
+ console.log(baseThemeColors);
6
+
7
+ const colors = Object.keys(baseThemeColors);
8
+ const variations = ['', 'darken', 'lighten'];
6
9
 
7
10
  export default {
8
11
  title: 'Display/Chips',
@@ -10,14 +13,14 @@ export default {
10
13
  };
11
14
 
12
15
  export const Primary = () => ({
13
- template: `<div class="chips-container">
14
- <farm-chip color="info">Chip (100% width)</farm-chip>
16
+ template: `<div class="chips-container chips-container-full-example">
17
+ <farm-chip color="primary">Chip (100% width)</farm-chip>
15
18
  </div>`,
16
19
  });
17
20
 
18
21
  export const Dense = () => ({
19
22
  template: `<div class="chips-container">
20
- <farm-chip color="info" :dense="true">prop</farm-chip>
23
+ <farm-chip color="primary" :dense="true">prop</farm-chip>
21
24
  <farm-chip color="secondary" dense>attribute</farm-chip>
22
25
  </div>`,
23
26
  });
@@ -26,20 +29,27 @@ export const Colors = () => ({
26
29
  data() {
27
30
  return {
28
31
  colors,
32
+ variations,
29
33
  };
30
34
  },
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>
35
+ template: `
36
+ <div>
37
+ <h3>Colors & variations</h3>
38
+ <div class="chips-container" v-for="color in colors">
39
+ <h4>{{ color }}</h4>
40
+ <farm-chip
41
+ v-for="variation in variations"
42
+ :key="color + '_' + variation"
43
+ :color="color"
44
+ :variation="variation">
45
+ {{ variation || 'base' }}
46
+ </farm-chip>
47
+ </div>
48
+
39
49
  </div>`,
40
50
  });
41
51
 
42
- export const Variations = () => ({
52
+ export const ColorsOutlined = () => ({
43
53
  data() {
44
54
  return {
45
55
  colors,
@@ -48,16 +58,26 @@ export const Variations = () => ({
48
58
  },
49
59
  template: `
50
60
  <div>
51
- <h3>Variations</h3>
61
+ <h3>Outlined</h3>
52
62
  <div class="chips-container" v-for="color in colors">
53
63
  <h4>{{ color }}</h4>
54
64
  <farm-chip
55
65
  v-for="variation in variations"
56
66
  :key="color + '_' + variation"
57
67
  :color="color"
68
+ :outlined="true"
58
69
  :variation="variation">
59
- {{ variation }}
70
+ {{ variation || 'base' }}
60
71
  </farm-chip>
61
72
  </div>
73
+
74
+ </div>`,
75
+ });
76
+
77
+ export const CustomTypography = () => ({
78
+ template: `<div class="chips-container">
79
+ <farm-chip color="primary">
80
+ <farm-bodytext :type="2">BodyText 2</farm-bodytext>
81
+ </farm-chip>
62
82
  </div>`,
63
83
  });
@@ -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,16 +116,87 @@ 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 Persistent = () => ({
135
+ data() {
136
+ return {
137
+ value: false,
138
+ text,
139
+ };
140
+ },
141
+ template: `<div>
142
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
143
+ <farm-modal v-model="value" :offsetTop="48" :offsetBottom="68" :persistent="true">
144
+ <template v-slot:header>
145
+ <farm-dialog-header title="Título" @onClose="() => value = false" />
146
+ </template>
147
+ <template v-slot:content>
148
+ <br />persistent modal<br />
149
+ </template>
150
+
151
+ <template v-slot:footer>
152
+ <farm-dialog-footer @onConfirm="() => value = false" @onClose="() => value = false" />
153
+ </template>
154
+ </farm-modal>
155
+ </div>`,
156
+ });
157
+
158
+ export const HorizontalScroll = () => ({
159
+ data() {
160
+ return {
161
+ value: false,
162
+ };
163
+ },
164
+ template: `<div>
165
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
166
+ <farm-modal v-model="value" size="md" :offsetBottom="68">
167
+ <template v-slot:content>
168
+ <div style="width: 800px;">
169
+ horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll horizontal scroll
170
+ </div>
171
+ </template>
172
+ <template v-slot:footer>
173
+ <farm-dialog-footer @onConfirm="() => value = false" @onClose="() => value = false" />
174
+ </template>
175
+ </farm-modal>
176
+ </div>`,
177
+ });
178
+
179
+ export const CustomHeader = () => ({
180
+ data() {
181
+ return {
182
+ value: false,
183
+ text,
184
+ };
185
+ },
186
+ template: `<div>
187
+ <farm-btn color="secondary" @click="value = true">abrir</farm-btn>
188
+ <farm-modal v-model="value" :offsetTop="24" :offsetBottom="68">
189
+ <template v-slot:header>
190
+ <farm-dialog-header>
191
+ Template Slot <farm-chip :dense="true">chip</farm-chip>
192
+ </farm-dialog-header>
193
+ </template>
194
+ <template v-slot:content>
195
+ <div v-html="text" />
196
+ </template>
197
+
198
+ <template v-slot:footer>
199
+ <farm-dialog-footer @onConfirm="() => value = false" @onClose="() => value = false" />
129
200
  </template>
130
201
  </farm-modal>
131
202
  </div>`,
@@ -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
+ }
@@ -0,0 +1,10 @@
1
+ @import './theme-colors';
2
+
3
+ :export {
4
+
5
+ @each $name,
6
+ $color in $text-colors {
7
+ #{'text-' + $name}: $color;
8
+ }
9
+
10
+ }
@@ -1,25 +1,79 @@
1
+ $primary: (
2
+ base: #00CCA7,
3
+ lighten: #EBFFFB,
4
+ darken: #00B493,
5
+ );
6
+
1
7
  $secondary: (
2
- base: #00B493,
3
- lighten: #ADFFF0,
4
- darken: #006653,
8
+ base: #5C5C5C,
9
+ lighten: #F5F5F5,
10
+ darken: #1A3738,
5
11
  );
6
12
 
7
- $info: (
8
- base: #5089DE,
9
- lighten: #95e8ff,
10
- darken: #003784
13
+ $neutral: (
14
+ base: #EEEEEE,
15
+ lighten: #F5F5F5,
16
+ darken: #E0E0E0,
11
17
  );
12
18
 
13
19
  $error: (
14
- base: #ea5455,
15
- lighten: #ff706d,
16
- darken: #6f0000
20
+ base: #F44336,
21
+ lighten: #FFEBEE,
22
+ darken: #B71C1C,
23
+ );
24
+
25
+ $warning: (
26
+ base: #FF9800,
27
+ lighten: #FFF3E0,
28
+ darken: #FF6D00,
29
+ );
30
+
31
+ $info: (
32
+ base: #2196F3,
33
+ lighten: #E3F2FD,
34
+ darken: #0D47A1,
35
+ );
36
+
37
+ $success: (
38
+ base: #4CAF50,
39
+ lighten: #E8F5E9,
40
+ darken: #1B5E20,
41
+ );
42
+
43
+ $extra-1: (
44
+ base: #8E24AA,
45
+ lighten: #E8F5E9,
46
+ darken: #4A148C,
47
+ );
48
+
49
+ $extra-2: (
50
+ base: #EC407A,
51
+ lighten: #FCE4EC,
52
+ darken: #880E4F,
17
53
  );
18
54
 
19
55
  $theme-colors: (
56
+ "primary": $primary,
20
57
  "secondary": $secondary,
58
+ "neutral": $neutral,
21
59
  "info": $info,
22
- "error": $error
60
+ "error": $error,
61
+ "warning": $warning,
62
+ "success": $success,
63
+ "extra-1": $extra-1,
64
+ "extra-2": $extra-2
65
+ );
66
+
67
+ $text-colors: (
68
+ "primary": #1C1C1C,
69
+ "secondary": #757575,
70
+ "disabled": #BDBDBD
71
+ );
72
+
73
+ $stroke-colors: (
74
+ "base": #E0E0E0,
75
+ "disabled": #BDBDBD,
76
+ "divider": #E0E0E0
23
77
  );
24
78
 
25
79
  $theme-colors-list: map-keys($theme-colors);