Skip to content

Commit 638a050

Browse files
author
Petr Krotov
committed
fix: change screenshots
1 parent f78913e commit 638a050

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

src/components/controls/TextArea/TextArea.scss

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ $block: '.#{variables.$ns}text-area';
1010
--_--placeholder-color: var(--g-color-text-hint);
1111
--_--background-color: transparent;
1212
--_--border-width: #{control-variables.$border-width};
13-
--_--clear-offset: calc(
14-
var(--g-text-area-border-width, #{control-variables.$border-width}) + 1px
15-
);
13+
--_--clear-offset: calc(var(--g-text-area-border-width, #{control-variables.$border-width}));
1614
--_--focus-outline-color: var(--g-text-area-focus-outline-color);
1715

1816
display: inline-block;
@@ -77,10 +75,6 @@ $block: '.#{variables.$ns}text-area';
7775
}
7876

7977
&__clear {
80-
display: flex;
81-
align-items: center;
82-
justify-content: center;
83-
8478
&_size_s,
8579
&_size_m {
8680
inset-inline-end: var(--_--clear-offset);
@@ -122,6 +116,10 @@ $block: '.#{variables.$ns}text-area';
122116
@include control-mixins.input-control(s);
123117
}
124118

119+
&#{$block}_has-clear #{$block}__control {
120+
padding-inline-end: 0;
121+
}
122+
125123
--_--error-icon-padding-block: 5px;
126124
--_--error-icon-padding-inline-start: 0;
127125
--_--error-icon-padding-inline-end: 5px;
@@ -134,6 +132,10 @@ $block: '.#{variables.$ns}text-area';
134132
@include control-mixins.input-control(m);
135133
}
136134

135+
&#{$block}_has-clear #{$block}__control {
136+
padding-inline-end: 0;
137+
}
138+
137139
--_--error-icon-padding-block: 6px;
138140
--_--error-icon-padding-inline-start: 0;
139141
--_--error-icon-padding-inline-end: 6px;
@@ -146,6 +148,10 @@ $block: '.#{variables.$ns}text-area';
146148
@include control-mixins.input-control(l);
147149
}
148150

151+
&#{$block}_has-clear #{$block}__control {
152+
padding-inline-end: 0;
153+
}
154+
149155
--_--error-icon-padding-block: 9px;
150156
--_--error-icon-padding-inline-start: 0;
151157
--_--error-icon-padding-inline-end: 9px;
@@ -158,6 +164,10 @@ $block: '.#{variables.$ns}text-area';
158164
@include control-mixins.input-control(xl);
159165
}
160166

167+
&#{$block}_has-clear #{$block}__control {
168+
padding-inline-end: 0;
169+
}
170+
161171
--_--error-icon-padding-block: 13px;
162172
--_--error-icon-padding-inline-start: 0;
163173
--_--error-icon-padding-inline-end: 13px;

src/components/controls/TextArea/TextArea.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ import './TextArea.scss';
2626
const b = block('text-area');
2727

2828
export type TextAreaProps = BaseInputControlProps<HTMLTextAreaElement> & {
29+
/** The control's html attributes */
2930
controlProps?: React.TextareaHTMLAttributes<HTMLTextAreaElement>;
31+
/** The number of visible text lines for the control. If not specified, the hight will be automatically calculated based on the content */
3032
rows?: number;
33+
/** The number of minimum visible text lines for the control. Ignored if `rows` is specified */
3134
minRows?: number;
35+
/** The number of maximum visible text lines for the control. Ignored if `rows` is specified */
3236
maxRows?: number;
37+
/** An optional element displayed under the lower right corner of the control and sharing the place with the error container */
3338
note?: React.ReactNode;
3439
};
3540

@@ -138,8 +143,10 @@ export const TextArea = React.forwardRef<HTMLSpanElement, TextAreaProps>(
138143

139144
React.useEffect(() => {
140145
const control = innerControlRef.current;
146+
141147
if (control) {
142148
const currHasVerticalScrollbar = control.scrollHeight > control.clientHeight;
149+
143150
if (hasVerticalScrollbar !== currHasVerticalScrollbar) {
144151
setHasVerticalScrollbar(currHasVerticalScrollbar);
145152
}
Loading
-20.3 KB
Loading

src/components/controls/TextArea/__tests__/TextArea.visual.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {TextArea} from '../TextArea';
66

77
import {
88
disabledCases,
9+
errorPlacementCases,
910
hasClearCases,
1011
maxRowsCases,
1112
minRowsCases,
@@ -94,6 +95,7 @@ test.describe('TextArea', {tag: '@TextArea'}, () => {
9495
} as const,
9596
{
9697
value: valueCases,
98+
errorPlacement: errorPlacementCases,
9799
},
98100
);
99101

src/components/controls/TextArea/__tests__/cases.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export const hasClearCases: Array<TextAreaProps['hasClear']> = [true];
1313

1414
export const validationStateCases: Array<TextAreaProps['validationState']> = ['invalid'];
1515

16+
export const errorPlacementCases: Cases<TextAreaProps['errorPlacement']> = ['outside', 'inside'];
17+
1618
export const pinCases: Cases<TextAreaProps['pin']> = [
1719
'round-round',
1820
'brick-brick',

0 commit comments

Comments
 (0)