Skip to content

Commit 51e76ee

Browse files
committed
fix additionalLabel Field styles
1 parent 1a2bb05 commit 51e76ee

4 files changed

Lines changed: 44 additions & 7 deletions

File tree

src/components/Field/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export const ExtraTextContainer = styled.div<{ $cssMixin?: ReturnType<typeof css
7373
7474
&& {
7575
overflow-wrap: break-word;
76-
word-wrap: break-word;
7776
}
7877
7978
padding-top: 8px;
@@ -244,7 +243,7 @@ export const Field = forwardRef<HTMLDivElement, FieldProps>(
244243
labelCssMixin,
245244
additionalLabelCssMixin,
246245
extraTextCssMixin,
247-
disableAdditionalLabelTooltip,
246+
disableAdditionalLabelTooltip = true,
248247
...restFieldProps
249248
} = props;
250249
const [defaultID] = useState(uid());

src/components/Label/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const MainLabel = styled.div<{ $cssMixin?: ReturnType<typeof css> }>`
99
1010
&& {
1111
overflow-wrap: break-word;
12-
word-wrap: break-word;
1312
}
1413
1514
&&& {
@@ -24,9 +23,8 @@ export const AdditionalLabel = styled.div<{ $cssMixin?: ReturnType<typeof css> }
2423
margin-left: 8px;
2524
2625
&& {
27-
overflow: hidden;
28-
text-overflow: ellipsis;
29-
white-space: nowrap;
26+
overflow-wrap: break-word;
27+
word-wrap: break-word;
3028
}
3129
3230
&&& {

src/components/form/InputField/stories/InputFieldInput.template.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export const InputFieldInputTemplate = ({
166166
labelCssMixin={compactStyles}
167167
additionalLabelCssMixin={compactStyles}
168168
extraTextCssMixin={compactStyles}
169-
disableAdditionalLabelTooltip={true}
169+
disableAdditionalLabelTooltip={false}
170170
placeholder="Custom compact Label, AdditionalLabel, ExtraText behavior"
171171
/>
172172
</DisplayContainer>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
import { getStorybookFrameLocator } from '../utils';
4+
5+
const STORY_PATH = '/?path=/story/admiral-2-1-input-textinput--text-input-with-icon';
6+
7+
test.describe('TextInput icons spacing', () => {
8+
test('reserves space for nested icons and keeps them accessible', async ({ page }) => {
9+
await page.goto(STORY_PATH);
10+
const frame = getStorybookFrameLocator(page);
11+
12+
// Третий инпут в истории — с тремя иконками + крестик
13+
const targetInput = frame.locator('.text-input-native-input').nth(2);
14+
await targetInput.click();
15+
await targetInput.fill(
16+
'Очень-очень-очень длинный текст для проверки того, что иконки точно-точно-точно не перекрывают содержимое инпута',
17+
);
18+
19+
const container = targetInput.locator('xpath=..');
20+
const iconPanel = container.locator('[data-role="icon-pane-after"]');
21+
await expect(iconPanel).toHaveCount(1);
22+
23+
// 3 пользовательские иконки + иконка очистки
24+
const iconButtons = iconPanel.locator(':scope > *');
25+
await expect(iconButtons).toHaveCount(4);
26+
27+
const paddingRight = await targetInput.evaluate((el) =>
28+
parseFloat(window.getComputedStyle(el).paddingRight || '0'),
29+
);
30+
expect(paddingRight).toBeGreaterThanOrEqual(140); // 16 + (24 + 8) * 4 = 144px
31+
32+
const [inputBox, panelBox] = await Promise.all([targetInput.boundingBox(), iconPanel.boundingBox()]);
33+
expect(inputBox && panelBox).toBeTruthy();
34+
35+
if (inputBox && panelBox) {
36+
const safeTextAreaEnd = inputBox.x + inputBox.width - paddingRight;
37+
expect(panelBox.x).toBeGreaterThanOrEqual(safeTextAreaEnd - 1);
38+
}
39+
});
40+
});

0 commit comments

Comments
 (0)