Skip to content

Commit 9b64fae

Browse files
authoredMay 24, 2023
Merge pull request #346 from MyEtherWallet/devop/add-loading-state
devop: add loading state
2 parents 4ac6681 + 493e5b9 commit 9b64fae

File tree

5 files changed

+43
-37
lines changed

5 files changed

+43
-37
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 1.4.7
2+
3+
- add loading state to max button [#344](https://github.com/MyEtherWallet/mew-components/pull/344)
4+
15
### 1.4.6
26

37
- fix error on console for color code [#343](https://github.com/MyEtherWallet/mew-components/pull/343)

‎package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@myetherwallet/mew-components",
3-
"version": "1.4.6",
3+
"version": "1.4.7",
44
"description": "MEW Components",
55
"main": "dist/mew-components.umd.js",
66
"module": "dist/mew-components.esm.js",

‎src/components/MewInput/MewInput.vue

+32-31
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@
9494
maxBtnObj.disabled
9595
? 'disabled--text no-pointer-events'
9696
: 'textDarkWhite--text',
97-
'rounded-lg mt-n2 mew-caption font-weight-medium'
97+
'rounded-lg mt-n2 mew-caption font-weight-medium',
9898
]"
9999
min-width="40"
100100
min-height="40"
101101
height="40"
102102
width="40"
103103
depressed
104+
:loading="maxBtnObj.loading"
104105
color="maxButton"
105106
@click="maxBtnObj.method"
106107
>
@@ -120,85 +121,85 @@ export default {
120121
name: 'MewInput',
121122
components: {
122123
MewBlockie,
123-
MewTokenContainer
124+
MewTokenContainer,
124125
},
125126
props: {
126127
/**
127128
* Error messages to display at the bottom of the input.
128129
*/
129130
errorMessages: {
130131
type: [String, Array],
131-
default: ''
132+
default: '',
132133
},
133134
/**
134135
* Input becomes read only.
135136
*/
136137
isReadOnly: {
137138
type: Boolean,
138-
default: false
139+
default: false,
139140
},
140141
/**
141142
* Prepends the blockie to the beginning of the input.
142143
*/
143144
showBlockie: {
144145
type: Boolean,
145-
default: false
146+
default: false,
146147
},
147148
/**
148149
* Removes the input border and adds a box shadow.
149150
*/
150151
hasNoBorder: {
151152
type: Boolean,
152-
default: false
153+
default: false,
153154
},
154155
/**
155156
* Disables the input.
156157
*/
157158
disabled: {
158159
type: Boolean,
159-
default: false
160+
default: false,
160161
},
161162
/**
162163
* The input label.
163164
*/
164165
label: {
165166
type: String,
166-
default: ''
167+
default: '',
167168
},
168169
/**
169170
* The input placeholder.
170171
*/
171172
placeholder: {
172173
type: String,
173-
default: ''
174+
default: '',
174175
},
175176
/**
176177
* The input value.
177178
*/
178179
value: {
179180
type: String,
180-
default: ''
181+
default: '',
181182
},
182183
/**
183184
* The input id.
184185
*/
185186
id: {
186187
type: Number,
187-
default: null
188+
default: null,
188189
},
189190
/**
190191
* Displays text on the right inner side of the input.
191192
*/
192193
rightLabel: {
193194
type: String,
194-
default: ''
195+
default: '',
195196
},
196197
/**
197198
* Hides input clear functionality. Clear symbol will be displayed on the right side.
198199
*/
199200
hideClearBtn: {
200201
type: Boolean,
201-
default: false
202+
default: false,
202203
},
203204
/**
204205
* For validating your input - accepts an array of functions that take an input value as an argument and returns either true / false
@@ -208,81 +209,81 @@ export default {
208209
type: Array,
209210
default: () => {
210211
return [];
211-
}
212+
},
212213
},
213214
/**
214215
* The resolved address.
215216
*/
216217
resolvedAddr: {
217218
type: String,
218-
default: ''
219+
default: '',
219220
},
220221
/**
221222
* Enables persistent hint.
222223
*/
223224
persistentHint: {
224225
type: Boolean,
225-
default: false
226+
default: false,
226227
},
227228
/**
228229
* Hint text (will be displayed at the bottom of the input).
229230
*/
230231
hint: {
231232
type: String,
232-
default: ''
233+
default: '',
233234
},
234235
/**
235236
* Sets input type.
236237
*/
237238
type: {
238239
type: String,
239-
default: 'text'
240+
default: 'text',
240241
},
241242
/**
242243
* Prepends an image to the beginning of the input.
243244
*/
244245
image: {
245246
type: String,
246-
default: ''
247+
default: '',
247248
},
248249
/**
249250
* Adds a "Buy more" string to the end of the first index of the errorMessages prop.
250251
*/
251252
buyMoreStr: {
252253
type: String,
253-
default: ''
254+
default: '',
254255
},
255256
/**
256257
* Displays a button to the right inner side of the input.
257258
* Takes an object.
258-
* i.e. {title: 'Max', disabled: false, method: () => {}}.
259+
* i.e. {title: 'Max', disabled: false, method: () => {}, loading: false}.
259260
*/
260261
maxBtnObj: {
261262
type: Object,
262263
default: () => {
263264
return {};
264-
}
265+
},
265266
},
266267
/**
267268
* Autofocuses the input.
268269
*/
269270
autofocus: {
270271
type: Boolean,
271-
default: false
272+
default: false,
272273
},
273274
/**
274275
* Hides the toggle show password icon on the right
275276
* when input type is password.
276277
*/
277278
hidePasswordIcon: {
278279
type: Boolean,
279-
default: false
280-
}
280+
default: false,
281+
},
281282
},
282283
data() {
283284
return {
284285
inputValue: '',
285-
showPassword: false
286+
showPassword: false,
286287
};
287288
},
288289
computed: {
@@ -300,7 +301,7 @@ export default {
300301
return types[1];
301302
}
302303
return this.type;
303-
}
304+
},
304305
},
305306
watch: {
306307
inputValue(newVal, oldVal) {
@@ -312,7 +313,7 @@ export default {
312313
if (newVal !== oldVal) {
313314
this.inputValue = newVal;
314315
}
315-
}
316+
},
316317
},
317318
mounted() {
318319
this.inputValue = this.value;
@@ -328,13 +329,13 @@ export default {
328329
},
329330
/*eslint-disable */
330331
clear(val) {
331-
this.inputValue = val ? val : '';
332+
this.inputValue = val ? val : "";
332333
},
333334
/*eslint-enable */
334335
preventCharE(e) {
335336
if (this.type === 'number' && e.key === 'e') e.preventDefault();
336-
}
337-
}
337+
},
338+
},
338339
};
339340
</script>
340341

‎stories/MewInput/MewInput.stories.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export default {
1717
component: MewInput,
1818
docs: {
1919
page: MewInputDoc,
20-
inlineStories: true
21-
}
20+
inlineStories: true,
21+
},
2222
},
2323
decorators: [withKnobs],
2424
};
@@ -46,6 +46,7 @@ const maxBtnObj = {
4646
title: 'Max',
4747
disabled: false,
4848
method: onClick,
49+
loading: false,
4950
};
5051

5152
function onClick() {
@@ -119,8 +120,8 @@ export const MEWInput = () => ({
119120
default: object('max-btn-obj', maxBtnObj),
120121
},
121122
hidePasswordIcon: {
122-
default: boolean('hide-password-icon', false)
123-
}
123+
default: boolean('hide-password-icon', false),
124+
},
124125
},
125126
watch: {
126127
enableDarkMode(newVal) {