2020-05-31 10:46:22 +00:00
|
|
|
<template>
|
2022-08-03 09:34:32 +00:00
|
|
|
<label class="input-container">
|
2020-05-31 10:46:22 +00:00
|
|
|
<span v-if="label">{{ label }}</span>
|
|
|
|
<input
|
|
|
|
:value="value"
|
|
|
|
:type="type"
|
|
|
|
:placeholder="placeholder"
|
2021-09-30 16:37:20 +00:00
|
|
|
:readonly="readonly"
|
2022-06-07 12:03:33 +00:00
|
|
|
:style="styles"
|
2020-05-31 10:46:22 +00:00
|
|
|
@input="onChange"
|
2020-12-21 08:35:19 +00:00
|
|
|
@blur="onBlur"
|
2020-05-31 10:46:22 +00:00
|
|
|
/>
|
2022-07-26 06:45:01 +00:00
|
|
|
<p v-if="helpText" class="help-text">{{ helpText }}</p>
|
2020-12-21 08:35:19 +00:00
|
|
|
<span v-if="error" class="message">
|
|
|
|
{{ error }}
|
|
|
|
</span>
|
2020-05-31 10:46:22 +00:00
|
|
|
</label>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
label: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
type: [String, Number],
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
default: 'text',
|
|
|
|
},
|
|
|
|
placeholder: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
helpText: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-12-21 08:35:19 +00:00
|
|
|
error: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-09-30 16:37:20 +00:00
|
|
|
readonly: {
|
|
|
|
type: Boolean,
|
2022-07-26 06:45:01 +00:00
|
|
|
default: false,
|
2021-09-30 16:37:20 +00:00
|
|
|
},
|
2022-06-07 12:03:33 +00:00
|
|
|
styles: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
2020-05-31 10:46:22 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onChange(e) {
|
|
|
|
this.$emit('input', e.target.value);
|
|
|
|
},
|
2020-12-21 08:35:19 +00:00
|
|
|
onBlur(e) {
|
|
|
|
this.$emit('blur', e.target.value);
|
|
|
|
},
|
2020-05-31 10:46:22 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
2022-07-26 06:45:01 +00:00
|
|
|
<style scoped lang="scss">
|
2022-08-03 09:34:32 +00:00
|
|
|
.help-text {
|
|
|
|
margin-top: var(--space-micro);
|
|
|
|
font-size: var(--font-size-mini);
|
|
|
|
color: var(--s-600);
|
|
|
|
font-style: normal;
|
2022-07-26 06:45:01 +00:00
|
|
|
}
|
2022-08-10 05:18:41 +00:00
|
|
|
.message {
|
|
|
|
margin-top: 0 !important;
|
|
|
|
}
|
2022-07-26 06:45:01 +00:00
|
|
|
</style>
|