fix(item): prevent slotted form controls from taking whole width of item (#26897)
@ -42,6 +42,11 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:host(.in-item[slot="start"]:not(.legacy-checkbox)),
|
||||
:host(.in-item[slot="end"]:not(.legacy-checkbox)) {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
// TODO(FW-3100): remove this
|
||||
:host(.legacy-checkbox) {
|
||||
width: var(--size);
|
||||
|
@ -87,6 +87,11 @@
|
||||
--padding-start: 0;
|
||||
}
|
||||
|
||||
:host-context(ion-item)[slot="start"],
|
||||
:host-context(ion-item)[slot="end"] {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
// TODO FW-2764 Remove this
|
||||
:host(.legacy-input.ion-color) {
|
||||
color: current-color(base);
|
||||
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
66
core/src/components/item/test/slotted-inputs/index.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Item - Slotted Inputs</title>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
|
||||
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
|
||||
<script src="../../../../../scripts/testing/scripts.js"></script>
|
||||
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
|
||||
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ion-app>
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>Slotted Inputs</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content id="content">
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-checkbox slot="start">Start</ion-checkbox>
|
||||
Checkbox
|
||||
<ion-checkbox slot="end">End</ion-checkbox>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-radio slot="start">Start</ion-radio>
|
||||
Radio
|
||||
<ion-radio slot="end">End</ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-toggle slot="start">Start</ion-toggle>
|
||||
Toggle
|
||||
<ion-toggle slot="end">End</ion-toggle>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-range slot="start"><div slot="label">Start</div></ion-range>
|
||||
Range
|
||||
<ion-range slot="end"><div slot="label">End</div></ion-range>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-input label="Start" slot="start"></ion-input>
|
||||
Input
|
||||
<ion-input label="End" slot="end"></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-textarea label="Start" slot="start"></ion-textarea>
|
||||
Textarea
|
||||
<ion-textarea label="End" slot="end"></ion-textarea>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-select label="Start" slot="start"></ion-select>
|
||||
Select
|
||||
<ion-select label="End" slot="end"></ion-select>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
</ion-app>
|
||||
</body>
|
||||
</html>
|
12
core/src/components/item/test/slotted-inputs/item.e2e.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('item: slotted inputs', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/item/test/slotted-inputs`);
|
||||
|
||||
await page.setIonViewport();
|
||||
|
||||
await expect(page).toHaveScreenshot(`item-slotted-inputs-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
});
|
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 19 KiB |
@ -74,6 +74,11 @@ input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:host(.in-item[slot="start"]:not(.legacy-radio)),
|
||||
:host(.in-item[slot="end"]:not(.legacy-radio)) {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
// Radio Wrapper
|
||||
// --------------------------------------------------
|
||||
.radio-wrapper {
|
||||
|
@ -168,6 +168,11 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:host(.in-item[slot="start"]),
|
||||
:host(.in-item[slot="end"]) {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
:host(.in-item) ::slotted(ion-label) {
|
||||
align-self: center;
|
||||
}
|
||||
|
@ -93,6 +93,12 @@
|
||||
border: 2px solid #5e9ed6;
|
||||
}
|
||||
|
||||
// TODO FW-3194 - Remove :not(.legacy-select) piece
|
||||
:host(.in-item[slot="start"]:not(.legacy-select)),
|
||||
:host(.in-item[slot="end"]:not(.legacy-select)) {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.select-placeholder {
|
||||
color: var(--placeholder-color);
|
||||
|
||||
|
@ -103,6 +103,11 @@
|
||||
--padding-start: 0;
|
||||
}
|
||||
|
||||
:host-context(ion-item)[slot="start"],
|
||||
:host-context(ion-item)[slot="end"] {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
// Native Textarea
|
||||
// --------------------------------------------------
|
||||
|
||||
|
@ -188,67 +188,67 @@
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" enable-on-off-labels="true">Unchecked</ion-toggle>
|
||||
<ion-toggle enable-on-off-labels="true">Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" enable-on-off-labels="true" checked>Checked</ion-toggle>
|
||||
<ion-toggle enable-on-off-labels="true" checked>Checked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="secondary" enable-on-off-labels="true">Secondary Unchecked</ion-toggle>
|
||||
<ion-toggle color="secondary" enable-on-off-labels="true">Secondary Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="secondary" enable-on-off-labels="true" checked>Secondary Checked</ion-toggle>
|
||||
<ion-toggle color="secondary" enable-on-off-labels="true" checked>Secondary Checked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="success" enable-on-off-labels="true">Success Unchecked</ion-toggle>
|
||||
<ion-toggle color="success" enable-on-off-labels="true">Success Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="success" enable-on-off-labels="true" checked>Success Checked</ion-toggle>
|
||||
<ion-toggle color="success" enable-on-off-labels="true" checked>Success Checked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="danger" enable-on-off-labels="true">Danger Unchecked</ion-toggle>
|
||||
<ion-toggle color="danger" enable-on-off-labels="true">Danger Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="danger" enable-on-off-labels="true" checked>Danger Checked</ion-toggle>
|
||||
<ion-toggle color="danger" enable-on-off-labels="true" checked>Danger Checked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="tertiary" enable-on-off-labels="true">Tertiary Unchecked</ion-toggle>
|
||||
<ion-toggle color="tertiary" enable-on-off-labels="true">Tertiary Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="tertiary" enable-on-off-labels="true" checked>Tertiary Checked</ion-toggle>
|
||||
<ion-toggle color="tertiary" enable-on-off-labels="true" checked>Tertiary Checked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="light" enable-on-off-labels="true">Light Unchecked</ion-toggle>
|
||||
<ion-toggle color="light" enable-on-off-labels="true">Light Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="light" enable-on-off-labels="true" checked>Light Checked</ion-toggle>
|
||||
<ion-toggle color="light" enable-on-off-labels="true" checked>Light Checked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="medium" enable-on-off-labels="true">Medium Unchecked</ion-toggle>
|
||||
<ion-toggle color="medium" enable-on-off-labels="true">Medium Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="medium" enable-on-off-labels="true" checked>Medium Checked</ion-toggle>
|
||||
<ion-toggle color="medium" enable-on-off-labels="true" checked>Medium Checked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="dark" enable-on-off-labels="true">Dark Unchecked</ion-toggle>
|
||||
<ion-toggle color="dark" enable-on-off-labels="true">Dark Unchecked</ion-toggle>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-toggle slot="end" color="dark" enable-on-off-labels="true" checked>Dark Checked</ion-toggle>
|
||||
<ion-toggle color="dark" enable-on-off-labels="true" checked>Dark Checked</ion-toggle>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
@ -43,6 +43,11 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:host(.in-item[slot="start"]:not(.legacy-toggle)),
|
||||
:host(.in-item[slot="end"]:not(.legacy-toggle)) {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
:host(.legacy-toggle) {
|
||||
contain: content;
|
||||
}
|
||||
|