feat(base-components): add ability to remove ios and md theme (#26669)

This commit is contained in:
Liam DeBeasi
2023-01-24 16:18:35 -05:00
committed by GitHub
parent 4d24b328e2
commit 18f109c7da
114 changed files with 1585 additions and 383 deletions

View File

@ -3,7 +3,7 @@ import { Component, Element, Host, Prop, h } from '@stencil/core';
import { arrowBackSharp, chevronBack } from 'ionicons/icons';
import { config } from '../../global/config';
import { getIonMode } from '../../global/ionic-global';
import { getIonStylesheet, getIonBehavior } from '../../global/ionic-global';
import type { AnimationBuilder, Color } from '../../interface';
import type { ButtonInterface } from '../../utils/element-interface';
import type { Attributes } from '../../utils/helpers';
@ -11,6 +11,7 @@ import { inheritAriaAttributes } from '../../utils/helpers';
import { createColorClasses, hostContext, openURL } from '../../utils/theme';
/**
* @virtualProp {true | false} useBase - useBase determines if base components is enabled.
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*
* @part native - The native HTML button element that wraps all child elements.
@ -20,6 +21,7 @@ import { createColorClasses, hostContext, openURL } from '../../utils/theme';
@Component({
tag: 'ion-back-button',
styleUrls: {
base: 'back-button.scss',
ios: 'back-button.ios.scss',
md: 'back-button.md.scss',
},
@ -84,7 +86,7 @@ export class BackButton implements ComponentInterface, ButtonInterface {
return icon;
}
if (getIonMode(this) === 'ios') {
if (getIonBehavior(this) === 'ios') {
// default ios back button icon
return config.get('backButtonIcon', chevronBack);
}
@ -94,7 +96,7 @@ export class BackButton implements ComponentInterface, ButtonInterface {
}
get backButtonText() {
const defaultBackButtonText = getIonMode(this) === 'ios' ? 'Back' : null;
const defaultBackButtonText = getIonBehavior(this) === 'ios' ? 'Back' : null;
return this.text != null ? this.text : config.get('backButtonText', defaultBackButtonText);
}
@ -135,7 +137,7 @@ export class BackButton implements ComponentInterface, ButtonInterface {
inheritedAttributes,
} = this;
const showBackButton = defaultHref !== undefined;
const mode = getIonMode(this);
const mode = getIonStylesheet(this);
const ariaLabel = inheritedAttributes['aria-label'] || backButtonText || 'back';
return (