feat(item): add styles for pressed state in ionic theme (#29586)

Issue number: internal

---------

## What is the new behavior?
- Added scss for the pressed state of `ion-item` for the Ionic theme
- Added item with class `ion-activatable` ([according to
docs](https://github.com/ionic-team/ionic-framework/blob/main/docs/component-guide.md#activated))
to test page

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

---------

Co-authored-by: Bernardo Cardoso <32780808+BenOsodrac@users.noreply.github.com>
This commit is contained in:
rug
2024-06-06 19:12:53 +02:00
committed by GitHub
parent 14d3500b50
commit 0807e6b037
3 changed files with 20 additions and 0 deletions

View File

@ -985,6 +985,7 @@ ion-item,prop,type,"button" | "reset" | "submit",'button',false,false
ion-item,css-prop,--background,ionic
ion-item,css-prop,--background,ios
ion-item,css-prop,--background,md
ion-item,css-prop,--background-activated,ionic
ion-item,css-prop,--background-activated,ios
ion-item,css-prop,--background-activated,md
ion-item,css-prop,--background-activated-opacity,ios

View File

@ -6,6 +6,7 @@
:host {
/**
* @prop --background: Background of the item
* @prop --background-activated: Background of the item when pressed. Note: setting this will interfere with the Material Design ripple.
*
* @prop --border-color: Color of the item border
* @prop --border-style: Style of the item border
@ -20,6 +21,7 @@
*
*/
--background: #{globals.$ionic-color-base-white};
--background-activated: #{globals.$ionic-color-neutral-200};
--border-color: #{globals.$ionic-color-neutral-300};
--border-style: #{globals.$ionic-border-style-solid};
--border-width: #{globals.$ionic-border-size-025};
@ -88,3 +90,10 @@
box-sizing: border-box;
}
}
// Item: Activated
// --------------------------------------------------
:host(.ion-activated) .item-native {
background: var(--background-activated);
}

View File

@ -158,6 +158,16 @@
</ion-label>
<ion-button slot="end" fill="outline">Outline</ion-button>
</ion-item>
<ion-item-divider>
<ion-label>Item activatable</ion-label>
</ion-item-divider>
<ion-item class="ion-activatable">
<ion-label slot="start">Start</ion-label>
<ion-label>
<h1>Heading</h1>
<p>Normal paragraph</p>
</ion-label>
</ion-item>
</ion-content>
<ion-footer>