Skip to content

Commit 346ecb2

Browse files
kelvindartliamdebeasi
authored andcommitted
fix(item-option): styling and behaviour for disabled item-option (#17909)
fixes #17905
1 parent 51614c1 commit 346ecb2

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

core/src/components/item-option/item-option.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,17 @@
112112
transition-property: none;
113113
transition-timing-function: cubic-bezier(.65, .05, .36, 1);
114114
}
115+
116+
117+
// Item Disabled Styling
118+
// --------------------------------------------------
119+
120+
:host(.item-option-disabled) {
121+
pointer-events: none;
122+
}
123+
124+
:host(.item-option-disabled) .button-native {
125+
cursor: default;
126+
opacity: .5;
127+
pointer-events: none;
128+
}

core/src/components/item-option/item-option.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ export class ItemOption implements ComponentInterface {
6060
}
6161

6262
hostData() {
63+
const { disabled, expandable } = this;
6364
return {
6465
class: {
6566
...createColorClasses(this.color),
66-
'item-option-expandable': this.expandable,
67+
'item-option-disabled': disabled,
68+
'item-option-expandable': expandable,
6769
'ion-activatable': true,
6870
}
6971
};

core/src/components/item-sliding/test/basic/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,30 @@ <h2>HubStruck Notifications</h2>
120120

121121
</ion-item-sliding>
122122

123+
<ion-item-sliding id="item100">
124+
<ion-item href="#">
125+
<ion-label>
126+
<h2>Disabled Buttons</h2>
127+
<p>Buttons should not be clickable</p>
128+
</ion-label>
129+
</ion-item>
130+
131+
<ion-item-options side="start">
132+
<ion-item-option disabled>
133+
Disabled
134+
</ion-item-option>
135+
</ion-item-options>
136+
<ion-item-options side="end">
137+
<ion-item-option color="danger" disabled>
138+
<ion-icon slot="icon-only" name="trash"></ion-icon>
139+
</ion-item-option>
140+
<ion-item-option disabled>
141+
<ion-icon slot="icon-only" name="star"></ion-icon>
142+
</ion-item-option>
143+
</ion-item-options>
144+
145+
</ion-item-sliding>
146+
123147
<ion-item-sliding id="item0">
124148
<ion-item onclick="clickedItem('item0')">
125149
<ion-label text-wrap>

core/src/themes/test/css-variables/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
<ion-item-sliding>
190190
<ion-item><ion-label>Goldeneye 007</ion-label></ion-item>
191191
<ion-item-options>
192-
<ion-item-option>More</ion-item-option>
192+
<ion-item-option disabled="true">More</ion-item-option>
193193
</ion-item-options>
194194
</ion-item-sliding>
195195
</ion-list>

0 commit comments

Comments
 (0)