@farm-investimentos/front-mfe-components 11.5.0 → 11.5.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": "11.5.0",
3
+ "version": "11.5.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -76,7 +76,9 @@ export const Validate = () => ({
76
76
  rules: {
77
77
  required: value => !!value || 'Required field',
78
78
  email: v =>
79
- /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || 'Must be an e-mail',
79
+ !v ||
80
+ /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) ||
81
+ 'Must be an e-mail',
80
82
  },
81
83
  };
82
84
  },
@@ -93,6 +95,9 @@ export const Validate = () => ({
93
95
  <farm-label required>Required field with hint</farm-label>
94
96
  <farm-textfield-v2 v-model="v4" :rules="[rules.required]" hint="hint text" />
95
97
 
98
+ <farm-label required>Required field with icon</farm-label>
99
+ <farm-textfield-v2 v-model="v1" :rules="[rules.required]" icon="eye" />
100
+
96
101
  </div>`,
97
102
  });
98
103
 
@@ -108,8 +113,8 @@ export const Icon = () => ({
108
113
  },
109
114
  },
110
115
  template: `<div style="width: 480px">
111
- <farm-textfield-v2 v-model="v" icon="eye" onClickIcon="this.show" />
112
- <farm-textfield-v2 v-model="v" icon="eye" icon-position="left" onClickIcon="this.show" />
116
+ <farm-textfield-v2 v-model="v" icon="eye" @onClickIcon="show" />
117
+ <farm-textfield-v2 v-model="v" icon="eye" icon-position="left" @onClickIcon="show" />
113
118
  </div>`,
114
119
  });
115
120
 
@@ -207,3 +212,20 @@ export const Mask = () => ({
207
212
 
208
213
  </div>`,
209
214
  });
215
+
216
+ export const ToggleVisibility = () => ({
217
+ data() {
218
+ return {
219
+ v: 'hidden password',
220
+ visible: false,
221
+ };
222
+ },
223
+ methods: {
224
+ toggle() {
225
+ this.visible = !this.visible;
226
+ },
227
+ },
228
+ template: `<div style="width: 480px">
229
+ <farm-textfield-v2 v-model="v" :type="visible ? 'text' : 'password'" :icon="visible ? 'eye-off' : 'eye'" @onClickIcon="toggle" />
230
+ </div>`,
231
+ });
@@ -10,7 +10,7 @@
10
10
  }"
11
11
  >
12
12
  <div class="farm-textfield--input">
13
- <button v-if="icon && iconPosition === 'left'" @click="$emit('onClickIcon')">
13
+ <button type="button" v-if="icon && iconPosition === 'left'" @click="$emit('onClickIcon')">
14
14
  <farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
15
15
  </button>
16
16
  <input
@@ -22,7 +22,7 @@
22
22
  @keyup="onKeyUp"
23
23
  @blur="onBlur"
24
24
  />
25
- <button v-if="icon && iconPosition === 'right'" @click="$emit('onClickIcon')">
25
+ <button type="button" v-if="icon && iconPosition === 'right'" @click="$emit('onClickIcon')">
26
26
  <farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
27
27
  </button>
28
28
  </div>