Skip to content

Commit 310abe5

Browse files
authored
Merge pull request #98 from cloudblue/feat/LITE-30390-fixes-for-textarea
LITE-30390: Some fixes for Textarea
2 parents cf7e787 + 732868f commit 310abe5

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

components/src/widgets/textarea/widget.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ describe('TextArea component', () => {
3030

3131
expect(wrapper.get('textarea').attributes()).toEqual(
3232
expect.objectContaining({
33-
class: 'textarea-field__input textarea-field__no-resize textarea-field__no-border',
33+
class:
34+
'textarea-field__input textarea-field__input_no-resize textarea-field__input_no-border',
3435
name: 'textarea',
3536
placeholder: 'placeholder',
3637
rows: '4',

components/src/widgets/textarea/widget.vue

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
v-model="localValue"
2020
class="textarea-field__input"
2121
:class="{
22-
'textarea-field__no-resize': autoGrow,
23-
'textarea-field__no-border': noBorder,
22+
'textarea-field__input_no-resize': autoGrow,
23+
'textarea-field__input_no-border': noBorder,
2424
}"
2525
:placeholder="placeholder"
2626
:readonly="props.readonly"
@@ -29,10 +29,16 @@
2929
@input.stop
3030
></textarea>
3131
<div
32-
v-if="!isValid"
33-
class="textarea-field__error-message"
32+
v-if="hint || !isValid"
33+
class="textarea-field__hint"
3434
>
35-
<p>{{ errorMessagesString }}</p>
35+
<p
36+
v-if="!isValid"
37+
class="textarea-field__error-message"
38+
>
39+
{{ errorMessagesString }}
40+
</p>
41+
<p v-else>{{ hint }}</p>
3642
</div>
3743
</div>
3844
</template>
@@ -68,6 +74,10 @@ const props = defineProps({
6874
type: String,
6975
default: '',
7076
},
77+
hint: {
78+
type: String,
79+
default: '',
80+
},
7181
rows: {
7282
type: [Number, String],
7383
default: 5,
@@ -141,28 +151,30 @@ watch(localValue, async (newValue) => {
141151
color: base-text-color;
142152
143153
&_optional label::after {
144-
content: '(optional)';
154+
content: '(Optional)';
145155
display: inline-block;
146156
margin-left: 3px;
147157
color: #212121;
148158
text-decoration: none;
149159
}
150160
151161
&__input {
162+
box-sizing: border-box;
152163
width: 100%;
153164
background-color: #FBFBFB;
154165
border: 1px solid #D8D8D8;
155166
border-radius: 2px;
156167
padding: 11px;
157-
}
168+
resize: vertical;
158169
159-
&__no-resize {
160-
resize: none;
161-
}
170+
&_no-resize {
171+
resize: none;
172+
}
162173
163-
&__no-border {
164-
border: none;
165-
outline: none;
174+
&_no-border {
175+
border: none;
176+
outline: none;
177+
}
166178
}
167179
168180
&__label {
@@ -178,16 +190,20 @@ watch(localValue, async (newValue) => {
178190
outline: 1px solid #4797f2;
179191
}
180192
181-
&__error-message {
193+
&__hint {
182194
margin-top: 4px;
183195
184196
p {
185-
color: #FF6A6A;
197+
color: #707070;
186198
font-size: 12px;
187199
font-weight: 400;
188200
line-height: 1.3;
189201
margin: 0;
190202
}
203+
204+
.textarea-field__error-message {
205+
color: #FF6A6A;
206+
}
191207
}
192208
}
193209
</style>

0 commit comments

Comments
 (0)