feat(item): add styles for disabled state in ionic theme (#29583)

Issue number: internal

---------

## What is the new behavior?
- Added scss for the disabled state of `ion-item` for the Ionic theme
- Added disabled elements to test page

## Does this introduce a breaking change?
- [ ] Yes
- [x] No

---------

Co-authored-by: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Brandy Carney <brandyscarney@gmail.com>
This commit is contained in:
rug
2024-06-06 21:48:12 +02:00
committed by GitHub
parent 0807e6b037
commit 00a6b2dfbd
6 changed files with 30 additions and 12 deletions

View File

@ -91,9 +91,25 @@
} }
} }
// Item: Disabled
// --------------------------------------------------
:host(.item-disabled) {
cursor: default;
pointer-events: none;
&::after {
@include globals.position(0, 0, 0, 0);
position: absolute;
background: #{globals.$ionic-state-disabled};
content: "";
}
}
// Item: Activated // Item: Activated
// -------------------------------------------------- // --------------------------------------------------
:host(.ion-activated) .item-native { :host(.ion-activated) .item-native {
background: var(--background-activated); background: var(--background-activated);
} }

View File

@ -4,7 +4,7 @@ import { configs, test } from '@utils/test/playwright';
/** /**
* This behavior does not vary across directions * This behavior does not vary across directions
*/ */
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { configs({ modes: ['ionic-md', 'md', 'ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('item: disabled state'), () => { test.describe(title('item: disabled state'), () => {
test('should not have visual regressions', async ({ page }) => { test('should not have visual regressions', async ({ page }) => {
await page.goto(`/src/components/item/test/disabled`, config); await page.goto(`/src/components/item/test/disabled`, config);

View File

@ -134,14 +134,6 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-item>
<ion-label>
<h1>Heading</h1>
<p>Normal paragraph</p>
</ion-label>
<ion-button slot="end" fill="outline">Outline</ion-button>
</ion-item>
<ion-item> <ion-item>
<ion-label slot="start">Start</ion-label> <ion-label slot="start">Start</ion-label>
<ion-label> <ion-label>
@ -150,13 +142,23 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-item> <ion-text color="primary">
<h2>Disabled Item</h2>
</ion-text>
<ion-item disabled>
<ion-label>
<h1>Heading</h1>
<p>Normal paragraph</p>
</ion-label>
</ion-item>
<ion-item disabled>
<ion-label slot="start">Start</ion-label> <ion-label slot="start">Start</ion-label>
<ion-label> <ion-label>
<h1>Heading</h1> <h1>Heading</h1>
<p>Normal paragraph</p> <p>Normal paragraph</p>
</ion-label> </ion-label>
<ion-button slot="end" fill="outline">Outline</ion-button>
</ion-item> </ion-item>
<ion-item-divider> <ion-item-divider>
<ion-label>Item activatable</ion-label> <ion-label>Item activatable</ion-label>