Skip to content

Commit c72eced

Browse files
authored
refactor(toggle): remove legacy property and support for legacy syntax (#29037)
BREAKING CHANGE: The `legacy` property and support for the legacy syntax, which involved placing an `ion-toggle` inside of an `ion-item` with an `ion-label`, have been removed from toggle. For more information on migrating from the legacy toggle syntax, refer to the [Toggle documentation](https://ionicframework.com/docs/api/toggle#migrating-from-legacy-toggle-syntax).
1 parent 6bd446f commit c72eced

File tree

86 files changed

+21
-1161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+21
-1161
lines changed

BREAKING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver
2626
- [Progress bar](#version-8x-progress-bar)
2727
- [Select](#version-8x-select)
2828
- [Textarea](#version-8x-textarea)
29+
- [Toggle](#version-8x-toggle)
2930

3031
<h2 id="version-8x-browser-platform-support">Browser and Platform Support</h2>
3132

@@ -184,3 +185,7 @@ For more information on styling toast buttons, refer to the [Toast Theming docum
184185
<h4 id="version-8x-textarea">Textarea</h4>
185186

186187
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-textarea` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy textarea syntax, refer to the [Textarea documentation](https://ionicframework.com/docs/api/textarea#migrating-from-legacy-textarea-syntax).
188+
189+
<h4 id="version-8x-toggle">Toggle</h4>
190+
191+
- The `legacy` property and support for the legacy syntax, which involved placing an `ion-toggle` inside of an `ion-item` with an `ion-label`, have been removed. For more information on migrating from the legacy toggle syntax, refer to the [Toggle documentation](https://ionicframework.com/docs/api/toggle#migrating-from-legacy-toggle-syntax).

core/api.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,6 @@ ion-toggle,prop,disabled,boolean,false,false,false
15141514
ion-toggle,prop,enableOnOffLabels,boolean | undefined,config.get('toggleOnOffLabels'),false,false
15151515
ion-toggle,prop,justify,"end" | "space-between" | "start",'space-between',false,false
15161516
ion-toggle,prop,labelPlacement,"end" | "fixed" | "stacked" | "start",'start',false,false
1517-
ion-toggle,prop,legacy,boolean | undefined,undefined,false,false
15181517
ion-toggle,prop,mode,"ios" | "md",undefined,false,false
15191518
ion-toggle,prop,name,string,this.inputId,false,false
15201519
ion-toggle,prop,value,null | string | undefined,'on',false,false

core/src/components.d.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,10 +3223,6 @@ export namespace Components {
32233223
* Where to place the label relative to the input. `"start"`: The label will appear to the left of the toggle in LTR and to the right in RTL. `"end"`: The label will appear to the right of the toggle in LTR and to the left in RTL. `"fixed"`: The label has the same behavior as `"start"` except it also has a fixed width. Long text will be truncated with ellipses ("..."). `"stacked"`: The label will appear above the toggle regardless of the direction. The alignment of the label can be controlled with the `alignment` property.
32243224
*/
32253225
"labelPlacement": 'start' | 'end' | 'fixed' | 'stacked';
3226-
/**
3227-
* Set the `legacy` property to `true` to forcibly use the legacy form control markup. Ionic will only opt components in to the modern form markup when they are using either the `aria-label` attribute or the default slot that contains the label text. As a result, the `legacy` property should only be used as an escape hatch when you want to avoid this automatic opt-in behavior. Note that this property will be removed in an upcoming major release of Ionic, and all form components will be opted-in to using the modern form markup.
3228-
*/
3229-
"legacy"?: boolean;
32303226
/**
32313227
* The mode determines which platform styles to use.
32323228
*/
@@ -4605,7 +4601,6 @@ declare global {
46054601
"ionChange": ToggleChangeEventDetail;
46064602
"ionFocus": void;
46074603
"ionBlur": void;
4608-
"ionStyle": StyleEventDetail;
46094604
}
46104605
interface HTMLIonToggleElement extends Components.IonToggle, HTMLStencilElement {
46114606
addEventListener<K extends keyof HTMLIonToggleElementEventMap>(type: K, listener: (this: HTMLIonToggleElement, ev: IonToggleCustomEvent<HTMLIonToggleElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -8032,10 +8027,6 @@ declare namespace LocalJSX {
80328027
* Where to place the label relative to the input. `"start"`: The label will appear to the left of the toggle in LTR and to the right in RTL. `"end"`: The label will appear to the right of the toggle in LTR and to the left in RTL. `"fixed"`: The label has the same behavior as `"start"` except it also has a fixed width. Long text will be truncated with ellipses ("..."). `"stacked"`: The label will appear above the toggle regardless of the direction. The alignment of the label can be controlled with the `alignment` property.
80338028
*/
80348029
"labelPlacement"?: 'start' | 'end' | 'fixed' | 'stacked';
8035-
/**
8036-
* Set the `legacy` property to `true` to forcibly use the legacy form control markup. Ionic will only opt components in to the modern form markup when they are using either the `aria-label` attribute or the default slot that contains the label text. As a result, the `legacy` property should only be used as an escape hatch when you want to avoid this automatic opt-in behavior. Note that this property will be removed in an upcoming major release of Ionic, and all form components will be opted-in to using the modern form markup.
8037-
*/
8038-
"legacy"?: boolean;
80398030
/**
80408031
* The mode determines which platform styles to use.
80418032
*/
@@ -8056,10 +8047,6 @@ declare namespace LocalJSX {
80568047
* Emitted when the toggle has focus.
80578048
*/
80588049
"onIonFocus"?: (event: IonToggleCustomEvent<void>) => void;
8059-
/**
8060-
* Emitted when the styles change.
8061-
*/
8062-
"onIonStyle"?: (event: IonToggleCustomEvent<StyleEventDetail>) => void;
80638050
/**
80648051
* The value of the toggle does not mean if it's checked or not, use the `checked` property for that. The value of a toggle is analogous to the value of a `<input type="checkbox">`, it's only used when the toggle participates in a native `<form>`.
80658052
*/

core/src/components/item/test/disabled/index.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@
3939
<ion-label>Disabled Item Anchor</ion-label>
4040
</ion-item>
4141

42-
<ion-item>
43-
<ion-toggle disabled checked> Disabled Toggle </ion-toggle>
44-
</ion-item>
45-
4642
<ion-item>
4743
<ion-checkbox disabled checked> Disabled Checkbox </ion-checkbox>
4844
</ion-item>
@@ -85,7 +81,6 @@
8581

8682
<ion-item>
8783
<ion-checkbox aria-label="Checkbox" slot="start"></ion-checkbox>
88-
<ion-toggle disabled value="45">Checkbox + Toggle</ion-toggle>
8984
</ion-item>
9085

9186
<ion-item>
-5.59 KB
Loading
-5.93 KB
Loading
-5.3 KB
Loading
-5.53 KB
Loading
-5.53 KB
Loading
-4.97 KB
Loading

0 commit comments

Comments
 (0)