diff --git a/core/api.txt b/core/api.txt index eb5e5a7824..3b248e57df 100644 --- a/core/api.txt +++ b/core/api.txt @@ -465,7 +465,7 @@ ion-item,shadow ion-item,prop,button,boolean,false,false,false ion-item,prop,color,string | undefined,undefined,false,false ion-item,prop,detail,boolean | undefined,undefined,false,false -ion-item,prop,detailIcon,string,'ios-arrow-forward',false,false +ion-item,prop,detailIcon,string,'chevron-forward',false,false ion-item,prop,disabled,boolean,false,false,false ion-item,prop,download,string | undefined,undefined,false,false ion-item,prop,href,string | undefined,undefined,false,false @@ -947,7 +947,7 @@ ion-searchbar,scoped ion-searchbar,prop,animated,boolean,false,false,false ion-searchbar,prop,autocomplete,"off" | "on",'off',false,false ion-searchbar,prop,autocorrect,"off" | "on",'off',false,false -ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', 'md-arrow-back') as string,false,false +ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', 'arrow-back-sharp') as string,false,false ion-searchbar,prop,cancelButtonText,string,'Cancel',false,false ion-searchbar,prop,clearIcon,string | undefined,undefined,false,false ion-searchbar,prop,color,string | undefined,undefined,false,false @@ -956,7 +956,7 @@ ion-searchbar,prop,disabled,boolean,false,false,false ion-searchbar,prop,inputmode,"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url",'search',false,false ion-searchbar,prop,mode,"ios" | "md",undefined,false,false ion-searchbar,prop,placeholder,string,'Search',false,false -ion-searchbar,prop,searchIcon,string,'search',false,false +ion-searchbar,prop,searchIcon,string | undefined,undefined,false,false ion-searchbar,prop,showCancelButton,"always" | "focus" | "never",'never',false,false ion-searchbar,prop,spellcheck,boolean,false,false,false ion-searchbar,prop,type,"email" | "number" | "password" | "search" | "tel" | "text" | "url",'search',false,false diff --git a/core/package.json b/core/package.json index 1c8613778a..9f7f7cf50f 100644 --- a/core/package.json +++ b/core/package.json @@ -30,7 +30,7 @@ "loader/" ], "dependencies": { - "ionicons": "^4.6.3", + "ionicons": "^5.0.0-12", "tslib": "^1.10.0" }, "devDependencies": { diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 0df2050ff4..1e73aee79e 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -2141,7 +2141,7 @@ export namespace Components { */ 'autocorrect': 'on' | 'off'; /** - * Set the cancel button icon. Only applies to `md` mode. + * Set the cancel button icon. Only applies to `md` mode. Defaults to `"arrow-back-sharp"`. */ 'cancelButtonIcon': string; /** @@ -2149,7 +2149,7 @@ export namespace Components { */ 'cancelButtonText': string; /** - * Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close"` for `md`. + * Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close-sharp"` for `md`. */ 'clearIcon'?: string; /** @@ -2181,9 +2181,9 @@ export namespace Components { */ 'placeholder': string; /** - * The icon to use as the search icon. + * The icon to use as the search icon. Defaults to `"search-outline"` in `ios` mode and `"search-sharp"` in `md` mode. */ - 'searchIcon': string; + 'searchIcon'?: string; /** * Sets focus on the specified `ion-searchbar`. Use this method instead of the global `input.focus()`. */ @@ -5370,7 +5370,7 @@ declare namespace LocalJSX { */ 'autocorrect'?: 'on' | 'off'; /** - * Set the cancel button icon. Only applies to `md` mode. + * Set the cancel button icon. Only applies to `md` mode. Defaults to `"arrow-back-sharp"`. */ 'cancelButtonIcon'?: string; /** @@ -5378,7 +5378,7 @@ declare namespace LocalJSX { */ 'cancelButtonText'?: string; /** - * Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close"` for `md`. + * Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close-sharp"` for `md`. */ 'clearIcon'?: string; /** @@ -5430,7 +5430,7 @@ declare namespace LocalJSX { */ 'placeholder'?: string; /** - * The icon to use as the search icon. + * The icon to use as the search icon. Defaults to `"search-outline"` in `ios` mode and `"search-sharp"` in `md` mode. */ 'searchIcon'?: string; /** diff --git a/core/src/components/action-sheet/test/basic/index.html b/core/src/components/action-sheet/test/basic/index.html index 73199c8e28..07813c7b8f 100644 --- a/core/src/components/action-sheet/test/basic/index.html +++ b/core/src/components/action-sheet/test/basic/index.html @@ -79,7 +79,7 @@ } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'chevron-forward-circle', handler: () => { console.log('Play clicked'); } @@ -221,7 +221,7 @@ } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'chevron-forward-circle', handler: () => { console.log('Play clicked'); } diff --git a/core/src/components/action-sheet/test/standalone/index.html b/core/src/components/action-sheet/test/standalone/index.html index f51abea605..499d6cf465 100644 --- a/core/src/components/action-sheet/test/standalone/index.html +++ b/core/src/components/action-sheet/test/standalone/index.html @@ -55,7 +55,7 @@ } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'chevron-forward-circle', handler: () => { console.log('Play clicked'); } @@ -98,7 +98,7 @@ } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'chevron-forward-circle', handler: () => { console.log('Play clicked'); } diff --git a/core/src/components/action-sheet/test/translucent/index.html b/core/src/components/action-sheet/test/translucent/index.html index 49d26d8e52..ed0b5c31ad 100644 --- a/core/src/components/action-sheet/test/translucent/index.html +++ b/core/src/components/action-sheet/test/translucent/index.html @@ -68,7 +68,7 @@ } }, { text: 'Play (open modal)', - icon: 'arrow-dropright-circle', + icon: 'chevron-forward-circle', handler: () => { console.log('Play clicked'); } diff --git a/core/src/components/back-button/back-button.tsx b/core/src/components/back-button/back-button.tsx index 13c395f701..26217c9d2b 100644 --- a/core/src/components/back-button/back-button.tsx +++ b/core/src/components/back-button/back-button.tsx @@ -19,7 +19,7 @@ import { createColorClasses, openURL } from '../../utils/theme'; }) export class BackButton implements ComponentInterface, ButtonInterface { - private mode = getIonMode(this); + mode = getIonMode(this); @Element() el!: HTMLElement; /** @@ -54,20 +54,32 @@ export class BackButton implements ComponentInterface, ButtonInterface { */ @Prop() type: 'submit' | 'reset' | 'button' = 'button'; - private get backButtonIcon() { - return this.icon != null ? this.icon : config.get('backButtonIcon', 'arrow-back'); + get backButtonIcon() { + const icon = this.icon; + if (icon != null) { + // icon is set on the component or by the config + return icon; + } + + if (this.mode === 'ios') { + // default ios back button icon + return config.get('backButtonIcon', 'chevron-back'); + } + + // default md back button icon + return config.get('backButtonIcon', 'arrow-back-sharp'); } - private get backButtonText() { + get backButtonText() { const defaultBackButtonText = this.mode === 'ios' ? 'Back' : null; return this.text != null ? this.text : config.get('backButtonText', defaultBackButtonText); } - private get hasIconOnly() { + get hasIconOnly() { return this.backButtonIcon && !this.backButtonText; } - private get rippleType() { + get rippleType() { // If the button only has an icon we use the unbounded // "circular" ripple effect if (this.hasIconOnly) { diff --git a/core/src/components/back-button/test/back-button.spec.ts b/core/src/components/back-button/test/back-button.spec.ts new file mode 100644 index 0000000000..441d2d6f37 --- /dev/null +++ b/core/src/components/back-button/test/back-button.spec.ts @@ -0,0 +1,59 @@ +import { BackButton } from "../back-button"; +import { config } from "../../../global/config"; + + +describe('back button', () => { + let bb: BackButton; + + beforeEach(() => { + config.reset({}); + bb = new BackButton(); + }); + + describe('backButtonIcon', () => { + + it('set custom icon on the instance, override config', () => { + bb.icon = 'custom-icon-instance'; + config.reset({ + backButtonIcon: 'custom-icon-config' + }); + expect(bb.backButtonIcon).toBe('custom-icon-instance'); + }); + + it('set custom icon in the config', () => { + config.reset({ + backButtonIcon: 'custom-icon-config' + }); + expect(bb.backButtonIcon).toBe('custom-icon-config'); + }); + + it('set custom icon on the instance', () => { + bb.icon = 'custom-icon-instance'; + expect(bb.backButtonIcon).toBe('custom-icon-instance'); + }); + + it('default icon for ios mode', () => { + bb.mode = 'ios'; + expect(bb.backButtonIcon).toBe('chevron-back'); + }); + + it('default icon', () => { + expect(bb.backButtonIcon).toBe('arrow-back-sharp'); + }); + + }); + + describe('backButtonText', () => { + + it('default text for ios mode', () => { + bb.mode = 'ios'; + expect(bb.backButtonText).toBe('Back'); + }); + + it('default text', () => { + expect(bb.backButtonText).toBe(null); + }); + + }); + +}); diff --git a/core/src/components/button/test/toolbar/index.html b/core/src/components/button/test/toolbar/index.html index 8d8c95fd4b..8a17767817 100644 --- a/core/src/components/button/test/toolbar/index.html +++ b/core/src/components/button/test/toolbar/index.html @@ -32,7 +32,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -117,10 +117,10 @@ - + - + Solid @@ -136,10 +136,10 @@ - + - + Solid @@ -155,7 +155,7 @@ - + @@ -164,7 +164,7 @@ - + Outline @@ -173,7 +173,7 @@ - + @@ -182,7 +182,7 @@ - + Outline.activated @@ -191,7 +191,7 @@ - + Clear diff --git a/core/src/components/fab/test/basic/index.html b/core/src/components/fab/test/basic/index.html index 63e1692772..13c673f5ea 100644 --- a/core/src/components/fab/test/basic/index.html +++ b/core/src/components/fab/test/basic/index.html @@ -50,7 +50,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -110,7 +110,7 @@ - + diff --git a/core/src/components/fab/test/translucent/index.html b/core/src/components/fab/test/translucent/index.html index 0539b78771..1dc8dabe66 100644 --- a/core/src/components/fab/test/translucent/index.html +++ b/core/src/components/fab/test/translucent/index.html @@ -48,7 +48,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -78,7 +78,7 @@ - + diff --git a/core/src/components/icon/readme.md b/core/src/components/icon/readme.md index 22956b79b0..4f902706d5 100644 --- a/core/src/components/icon/readme.md +++ b/core/src/components/icon/readme.md @@ -4,9 +4,15 @@ Icons can be used on their own as a standalone component, or inside of another component. -Ionicons provide platform continuity out of the box in Ionic by rendering a different icon based on the device the app is running on. For example, by setting the icon `name` to `alarm` the icon will automatically use the `ios-alarm` on an iOS device, and the `md-alarm` for any device running Material Design. This allows the developer to write the markup once while Ionic handles displaying the appropriate icon based on the mode. +By default, Ionicons will use the same icon for each platform (iOS or Material Design). In previous versions of Ionicons, icons would automatically update based on the platform. As of Ionicons 5.0, apps will have to handle this on a per-icon basis, if needed. -For a full list of available icons and more usage explanations, check out the [Ionicons documentation](https://ionicons.com/). +To use different icons depending on platform, set the `ios` and `md` properties or attributes. In the example below, when the app has the `ios` mode applied, it'll show the `logo-apple` icon. When using `md`, it'll show the `logo-android` icon. + +``` + +``` + +For a full list of available icons and more usage explanations, please check out the [Ionicons documentation](https://ionicons.com/). diff --git a/core/src/components/icon/test/basic/index.html b/core/src/components/icon/test/basic/index.html index 72e3672071..42d3fbd512 100644 --- a/core/src/components/icon/test/basic/index.html +++ b/core/src/components/icon/test/basic/index.html @@ -50,55 +50,19 @@ - + - name="md-home" + name="STAR" - + - name="ios-home" - - - - - - - - - name="ios-home" - - - - - - - - - name="ios-star-outline" - - - - - - - - - name="IOS-STAR-OUTLINE" - - - - - - - - - name="md-home" + icon="home" @@ -130,24 +94,6 @@ - - - - - ios="ios-color-filter" md="md-color-filter" - - - - - - - - - ios="MD-COLOR-FILTER" md="IOS-COLOR-FILTER" - - - - diff --git a/core/src/components/icon/test/dir/index.html b/core/src/components/icon/test/dir/index.html index e448fab987..5f6c79ad4b 100644 --- a/core/src/components/icon/test/dir/index.html +++ b/core/src/components/icon/test/dir/index.html @@ -51,25 +51,17 @@ null - - - - - + - + false - - - - - + - + diff --git a/core/src/components/icon/test/items/index.html b/core/src/components/icon/test/items/index.html index 61d80dacc9..b3aeea3729 100644 --- a/core/src/components/icon/test/items/index.html +++ b/core/src/components/icon/test/items/index.html @@ -56,30 +56,16 @@ - + - name="md-home" is-active="true" + name="home" is-active="true" - + - name="ios-home" is-active="true" - - - - - - - name="ios-home" - - - - - - - name="md-home" + name="home" @@ -96,18 +82,11 @@ ios="logo-apple" md="logo-android" - + - + - ios="md-color-filter" md="ios-color-filter" - - - - - - - ios="md-color-filter" md="ios-color-filter" is-active="false" + ios="logo-apple" md="logo-android" is-active="false" diff --git a/core/src/components/icon/test/standalone/index.html b/core/src/components/icon/test/standalone/index.html index b4cf376d4a..fb985f6225 100644 --- a/core/src/components/icon/test/standalone/index.html +++ b/core/src/components/icon/test/standalone/index.html @@ -20,12 +20,12 @@ - + - + - + @@ -35,7 +35,6 @@ - @@ -47,9 +46,9 @@ - + - + diff --git a/core/src/components/item-sliding/test/standalone/index.html b/core/src/components/item-sliding/test/standalone/index.html index 689e51e700..8d1a7e43d0 100644 --- a/core/src/components/item-sliding/test/standalone/index.html +++ b/core/src/components/item-sliding/test/standalone/index.html @@ -86,7 +86,7 @@ - + More @@ -105,7 +105,7 @@ - + More @@ -124,7 +124,7 @@ - + More @@ -143,7 +143,7 @@ - + More diff --git a/core/src/components/item/item.tsx b/core/src/components/item/item.tsx index 84b7364f49..610ce66e89 100644 --- a/core/src/components/item/item.tsx +++ b/core/src/components/item/item.tsx @@ -49,7 +49,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac /** * The icon to use when `detail` is set to `true`. */ - @Prop() detailIcon = 'ios-arrow-forward'; + @Prop() detailIcon = 'chevron-forward'; /** * If `true`, the user cannot interact with the item. diff --git a/core/src/components/item/readme.md b/core/src/components/item/readme.md index 6903ac6137..6aa3432b8c 100644 --- a/core/src/components/item/readme.md +++ b/core/src/components/item/readme.md @@ -1364,21 +1364,21 @@ Item Inputs ## Properties -| Property | Attribute | Description | Type | Default | -| ----------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | --------------------- | -| `button` | `button` | If `true`, a button tag will be rendered and the item will be tappable. | `boolean` | `false` | -| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `string \| undefined` | `undefined` | -| `detail` | `detail` | If `true`, a detail arrow will appear on the item. Defaults to `false` unless the `mode` is `ios` and an `href` or `button` property is present. | `boolean \| undefined` | `undefined` | -| `detailIcon` | `detail-icon` | The icon to use when `detail` is set to `true`. | `string` | `'ios-arrow-forward'` | -| `disabled` | `disabled` | If `true`, the user cannot interact with the item. | `boolean` | `false` | -| `download` | `download` | This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want). | `string \| undefined` | `undefined` | -| `href` | `href` | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | `string \| undefined` | `undefined` | -| `lines` | `lines` | How the bottom border should be displayed on the item. | `"full" \| "inset" \| "none" \| undefined` | `undefined` | -| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | -| `rel` | `rel` | Specifies the relationship of the target object to the link object. The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types). | `string \| undefined` | `undefined` | -| `routerDirection` | `router-direction` | When using a router, it specifies the transition direction when navigating to another page using `href`. | `"back" \| "forward" \| "root"` | `'forward'` | -| `target` | `target` | Specifies where to display the linked URL. Only applies when an `href` is provided. Special keywords: `"_blank"`, `"_self"`, `"_parent"`, `"_top"`. | `string \| undefined` | `undefined` | -| `type` | `type` | The type of the button. Only used when an `onclick` or `button` property is present. | `"button" \| "reset" \| "submit"` | `'button'` | +| Property | Attribute | Description | Type | Default | +| ----------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | ------------------- | +| `button` | `button` | If `true`, a button tag will be rendered and the item will be tappable. | `boolean` | `false` | +| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `string \| undefined` | `undefined` | +| `detail` | `detail` | If `true`, a detail arrow will appear on the item. Defaults to `false` unless the `mode` is `ios` and an `href` or `button` property is present. | `boolean \| undefined` | `undefined` | +| `detailIcon` | `detail-icon` | The icon to use when `detail` is set to `true`. | `string` | `'chevron-forward'` | +| `disabled` | `disabled` | If `true`, the user cannot interact with the item. | `boolean` | `false` | +| `download` | `download` | This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want). | `string \| undefined` | `undefined` | +| `href` | `href` | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | `string \| undefined` | `undefined` | +| `lines` | `lines` | How the bottom border should be displayed on the item. | `"full" \| "inset" \| "none" \| undefined` | `undefined` | +| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | +| `rel` | `rel` | Specifies the relationship of the target object to the link object. The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types). | `string \| undefined` | `undefined` | +| `routerDirection` | `router-direction` | When using a router, it specifies the transition direction when navigating to another page using `href`. | `"back" \| "forward" \| "root"` | `'forward'` | +| `target` | `target` | Specifies where to display the linked URL. Only applies when an `href` is provided. Special keywords: `"_blank"`, `"_self"`, `"_parent"`, `"_top"`. | `string \| undefined` | `undefined` | +| `type` | `type` | The type of the button. Only used when an `onclick` or `button` property is present. | `"button" \| "reset" \| "submit"` | `'button'` | ## Slots diff --git a/core/src/components/menu-button/menu-button.tsx b/core/src/components/menu-button/menu-button.tsx index f8a5c30fb6..98eddd521a 100644 --- a/core/src/components/menu-button/menu-button.tsx +++ b/core/src/components/menu-button/menu-button.tsx @@ -64,7 +64,7 @@ export class MenuButton implements ComponentInterface, ButtonInterface { render() { const { color, disabled } = this; const mode = getIonMode(this); - const menuIcon = config.get('menuIcon', 'menu'); + const menuIcon = config.get('menuIcon', mode === 'ios' ? 'menu-outline' : 'menu-sharp'); const hidden = this.autoHide && !this.visible; const attrs = { diff --git a/core/src/components/reorder/reorder.tsx b/core/src/components/reorder/reorder.tsx index 42da75f1fc..7ccb4d9915 100644 --- a/core/src/components/reorder/reorder.tsx +++ b/core/src/components/reorder/reorder.tsx @@ -19,10 +19,12 @@ export class Reorder implements ComponentInterface { } render() { + const mode = getIonMode(this); + const reorderIcon = mode === 'ios' ? 'reorder-three-outline' : 'reorder-two-sharp'; return ( - + - + ); diff --git a/core/src/components/searchbar/readme.md b/core/src/components/searchbar/readme.md index fac2f0a70c..42bd4aad42 100644 --- a/core/src/components/searchbar/readme.md +++ b/core/src/components/searchbar/readme.md @@ -219,25 +219,25 @@ export const SearchbarExample: React.FC = () => ( ## Properties -| Property | Attribute | Description | Type | Default | -| ------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------- | -| `animated` | `animated` | If `true`, enable searchbar animation. | `boolean` | `false` | -| `autocomplete` | `autocomplete` | Set the input's autocomplete property. | `"off" \| "on"` | `'off'` | -| `autocorrect` | `autocorrect` | Set the input's autocorrect property. | `"off" \| "on"` | `'off'` | -| `cancelButtonIcon` | `cancel-button-icon` | Set the cancel button icon. Only applies to `md` mode. | `string` | `config.get('backButtonIcon', 'md-arrow-back') as string` | -| `cancelButtonText` | `cancel-button-text` | Set the the cancel button text. Only applies to `ios` mode. | `string` | `'Cancel'` | -| `clearIcon` | `clear-icon` | Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close"` for `md`. | `string \| undefined` | `undefined` | -| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `string \| undefined` | `undefined` | -| `debounce` | `debounce` | Set the amount of time, in milliseconds, to wait to trigger the `ionChange` event after each keystroke. | `number` | `250` | -| `disabled` | `disabled` | If `true`, the user cannot interact with the input. | `boolean` | `false` | -| `inputmode` | `inputmode` | A hint to the browser for which keyboard to display. Possible values: `"none"`, `"text"`, `"tel"`, `"url"`, `"email"`, `"numeric"`, `"decimal"`, and `"search"`. | `"decimal" \| "email" \| "none" \| "numeric" \| "search" \| "tel" \| "text" \| "url"` | `'search'` | -| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | -| `placeholder` | `placeholder` | Set the input's placeholder. `placeholder` can accept either plaintext or HTML as a string. To display characters normally reserved for HTML, they must be escaped. For example `` would become `<Ionic>` For more information: [Security Documentation](https://ionicframework.com/docs/faq/security) | `string` | `'Search'` | -| `searchIcon` | `search-icon` | The icon to use as the search icon. | `string` | `'search'` | -| `showCancelButton` | `show-cancel-button` | Sets the behavior for the cancel button. Defaults to `"never"`. Setting to `"focus"` shows the cancel button on focus. Setting to `"never"` hides the cancel button. Setting to `"always"` shows the cancel button regardless of focus state. | `"always" \| "focus" \| "never"` | `'never'` | -| `spellcheck` | `spellcheck` | If `true`, enable spellcheck on the input. | `boolean` | `false` | -| `type` | `type` | Set the type of the input. | `"email" \| "number" \| "password" \| "search" \| "tel" \| "text" \| "url"` | `'search'` | -| `value` | `value` | the value of the searchbar. | `null \| string \| undefined` | `''` | +| Property | Attribute | Description | Type | Default | +| ------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------ | +| `animated` | `animated` | If `true`, enable searchbar animation. | `boolean` | `false` | +| `autocomplete` | `autocomplete` | Set the input's autocomplete property. | `"off" \| "on"` | `'off'` | +| `autocorrect` | `autocorrect` | Set the input's autocorrect property. | `"off" \| "on"` | `'off'` | +| `cancelButtonIcon` | `cancel-button-icon` | Set the cancel button icon. Only applies to `md` mode. Defaults to `"arrow-back-sharp"`. | `string` | `config.get('backButtonIcon', 'arrow-back-sharp') as string` | +| `cancelButtonText` | `cancel-button-text` | Set the the cancel button text. Only applies to `ios` mode. | `string` | `'Cancel'` | +| `clearIcon` | `clear-icon` | Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close-sharp"` for `md`. | `string \| undefined` | `undefined` | +| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `string \| undefined` | `undefined` | +| `debounce` | `debounce` | Set the amount of time, in milliseconds, to wait to trigger the `ionChange` event after each keystroke. | `number` | `250` | +| `disabled` | `disabled` | If `true`, the user cannot interact with the input. | `boolean` | `false` | +| `inputmode` | `inputmode` | A hint to the browser for which keyboard to display. Possible values: `"none"`, `"text"`, `"tel"`, `"url"`, `"email"`, `"numeric"`, `"decimal"`, and `"search"`. | `"decimal" \| "email" \| "none" \| "numeric" \| "search" \| "tel" \| "text" \| "url"` | `'search'` | +| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | +| `placeholder` | `placeholder` | Set the input's placeholder. `placeholder` can accept either plaintext or HTML as a string. To display characters normally reserved for HTML, they must be escaped. For example `` would become `<Ionic>` For more information: [Security Documentation](https://ionicframework.com/docs/faq/security) | `string` | `'Search'` | +| `searchIcon` | `search-icon` | The icon to use as the search icon. Defaults to `"search-outline"` in `ios` mode and `"search-sharp"` in `md` mode. | `string \| undefined` | `undefined` | +| `showCancelButton` | `show-cancel-button` | Sets the behavior for the cancel button. Defaults to `"never"`. Setting to `"focus"` shows the cancel button on focus. Setting to `"never"` hides the cancel button. Setting to `"always"` shows the cancel button regardless of focus state. | `"always" \| "focus" \| "never"` | `'never'` | +| `spellcheck` | `spellcheck` | If `true`, enable spellcheck on the input. | `boolean` | `false` | +| `type` | `type` | Set the type of the input. | `"email" \| "number" \| "password" \| "search" \| "tel" \| "text" \| "url"` | `'search'` | +| `value` | `value` | the value of the searchbar. | `null \| string \| undefined` | `''` | ## Events diff --git a/core/src/components/searchbar/searchbar.tsx b/core/src/components/searchbar/searchbar.tsx index 322b9db941..c0802abcd5 100644 --- a/core/src/components/searchbar/searchbar.tsx +++ b/core/src/components/searchbar/searchbar.tsx @@ -53,8 +53,9 @@ export class Searchbar implements ComponentInterface { /** * Set the cancel button icon. Only applies to `md` mode. + * Defaults to `"arrow-back-sharp"`. */ - @Prop() cancelButtonIcon = config.get('backButtonIcon', 'md-arrow-back') as string; + @Prop() cancelButtonIcon = config.get('backButtonIcon', 'arrow-back-sharp') as string; /** * Set the the cancel button text. Only applies to `ios` mode. @@ -62,7 +63,7 @@ export class Searchbar implements ComponentInterface { @Prop() cancelButtonText = 'Cancel'; /** - * Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close"` for `md`. + * Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close-sharp"` for `md`. */ @Prop() clearIcon?: string; @@ -100,9 +101,10 @@ export class Searchbar implements ComponentInterface { @Prop() placeholder = 'Search'; /** - * The icon to use as the search icon. + * The icon to use as the search icon. Defaults to `"search-outline"` in + * `ios` mode and `"search-sharp"` in `md` mode. */ - @Prop() searchIcon = 'search'; + @Prop() searchIcon?: string; /** * Sets the behavior for the cancel button. Defaults to `"never"`. @@ -412,8 +414,8 @@ export class Searchbar implements ComponentInterface { render() { const animated = this.animated && config.getBoolean('animated', true); const mode = getIonMode(this); - const clearIcon = this.clearIcon || (mode === 'ios' ? 'ios-close-circle' : 'md-close'); - const searchIcon = this.searchIcon; + const clearIcon = this.clearIcon || (mode === 'ios' ? 'close-circle' : 'close-sharp'); + const searchIcon = this.searchIcon || (mode === 'ios' ? 'search-outline' : 'search-sharp'); const cancelButton = (this.showCancelButton !== 'never') && (