Skip to content

Commit 484de50

Browse files
perf(various): don't use lazy-loaded icon names in components (#24671)
1 parent bdb5c42 commit 484de50

File tree

16 files changed

+78
-125
lines changed

16 files changed

+78
-125
lines changed

core/api.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ion-accordion,shadow
33
ion-accordion,prop,disabled,boolean,false,false,false
44
ion-accordion,prop,mode,"ios" | "md",undefined,false,false
55
ion-accordion,prop,readonly,boolean,false,false,false
6-
ion-accordion,prop,toggleIcon,string,'chevron-down',false,false
6+
ion-accordion,prop,toggleIcon,string,chevronDown,false,false
77
ion-accordion,prop,toggleIconSlot,"end" | "start",'end',false,false
88
ion-accordion,prop,value,string,`ion-accordion-${accordionIds++}`,false,false
99
ion-accordion,part,content
@@ -416,7 +416,7 @@ ion-fab,method,close,close() => Promise<void>
416416

417417
ion-fab-button,shadow
418418
ion-fab-button,prop,activated,boolean,false,false,false
419-
ion-fab-button,prop,closeIcon,string,'close',false,false
419+
ion-fab-button,prop,closeIcon,string,close,false,false
420420
ion-fab-button,prop,color,string | undefined,undefined,false,true
421421
ion-fab-button,prop,disabled,boolean,false,false,false
422422
ion-fab-button,prop,download,string | undefined,undefined,false,false
@@ -557,7 +557,7 @@ ion-item,prop,button,boolean,false,false,false
557557
ion-item,prop,color,string | undefined,undefined,false,true
558558
ion-item,prop,counter,boolean,false,false,false
559559
ion-item,prop,detail,boolean | undefined,undefined,false,false
560-
ion-item,prop,detailIcon,string,'chevron-forward',false,false
560+
ion-item,prop,detailIcon,string,chevronForward,false,false
561561
ion-item,prop,disabled,boolean,false,false,false
562562
ion-item,prop,download,string | undefined,undefined,false,false
563563
ion-item,prop,fill,"outline" | "solid" | undefined,undefined,false,false
@@ -1070,7 +1070,7 @@ ion-searchbar,scoped
10701070
ion-searchbar,prop,animated,boolean,false,false,false
10711071
ion-searchbar,prop,autocomplete,"off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo",'off',false,false
10721072
ion-searchbar,prop,autocorrect,"off" | "on",'off',false,false
1073-
ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', 'arrow-back-sharp') as string,false,false
1073+
ion-searchbar,prop,cancelButtonIcon,string,config.get('backButtonIcon', arrowBackSharp) as string,false,false
10741074
ion-searchbar,prop,cancelButtonText,string,'Cancel',false,false
10751075
ion-searchbar,prop,clearIcon,string | undefined,undefined,false,false
10761076
ion-searchbar,prop,color,string | undefined,undefined,false,true

core/src/components.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,15 +2272,15 @@ export namespace Components {
22722272
*/
22732273
"autocorrect": 'on' | 'off';
22742274
/**
2275-
* Set the cancel button icon. Only applies to `md` mode. Defaults to `"arrow-back-sharp"`.
2275+
* Set the cancel button icon. Only applies to `md` mode. Defaults to `arrow-back-sharp`.
22762276
*/
22772277
"cancelButtonIcon": string;
22782278
/**
22792279
* Set the the cancel button text. Only applies to `ios` mode.
22802280
*/
22812281
"cancelButtonText": string;
22822282
/**
2283-
* Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close-sharp"` for `md`.
2283+
* Set the clear icon. Defaults to `close-circle` for `ios` and `close-sharp` for `md`.
22842284
*/
22852285
"clearIcon"?: string;
22862286
/**
@@ -2316,7 +2316,7 @@ export namespace Components {
23162316
*/
23172317
"placeholder": string;
23182318
/**
2319-
* The icon to use as the search icon. Defaults to `"search-outline"` in `ios` mode and `"search-sharp"` in `md` mode.
2319+
* The icon to use as the search icon. Defaults to `search-outline` in `ios` mode and `search-sharp` in `md` mode.
23202320
*/
23212321
"searchIcon"?: string;
23222322
/**
@@ -5943,15 +5943,15 @@ declare namespace LocalJSX {
59435943
*/
59445944
"autocorrect"?: 'on' | 'off';
59455945
/**
5946-
* Set the cancel button icon. Only applies to `md` mode. Defaults to `"arrow-back-sharp"`.
5946+
* Set the cancel button icon. Only applies to `md` mode. Defaults to `arrow-back-sharp`.
59475947
*/
59485948
"cancelButtonIcon"?: string;
59495949
/**
59505950
* Set the the cancel button text. Only applies to `ios` mode.
59515951
*/
59525952
"cancelButtonText"?: string;
59535953
/**
5954-
* Set the clear icon. Defaults to `"close-circle"` for `ios` and `"close-sharp"` for `md`.
5954+
* Set the clear icon. Defaults to `close-circle` for `ios` and `close-sharp` for `md`.
59555955
*/
59565956
"clearIcon"?: string;
59575957
/**
@@ -6011,7 +6011,7 @@ declare namespace LocalJSX {
60116011
*/
60126012
"placeholder"?: string;
60136013
/**
6014-
* The icon to use as the search icon. Defaults to `"search-outline"` in `ios` mode and `"search-sharp"` in `md` mode.
6014+
* The icon to use as the search icon. Defaults to `search-outline` in `ios` mode and `search-sharp` in `md` mode.
60156015
*/
60166016
"searchIcon"?: string;
60176017
/**

core/src/components/accordion/accordion.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, ComponentInterface, Element, Host, Prop, State, h } from '@stencil/core';
2+
import { chevronDown } from 'ionicons/icons';
23

34
import { config } from '../../global/config';
45
import { getIonMode } from '../../global/ionic-global';
@@ -71,7 +72,7 @@ export class Accordion implements ComponentInterface {
7172
* rotated when the accordion is expanded
7273
* or collapsed.
7374
*/
74-
@Prop() toggleIcon = 'chevron-down';
75+
@Prop() toggleIcon = chevronDown;
7576

7677
/**
7778
* The slot inside of `ion-item` to

core/src/components/accordion/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ export const AccordionExample {
16261626
| `disabled` | `disabled` | If `true`, the accordion cannot be interacted with. | `boolean` | `false` |
16271627
| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` |
16281628
| `readonly` | `readonly` | If `true`, the accordion cannot be interacted with, but does not alter the opacity. | `boolean` | `false` |
1629-
| `toggleIcon` | `toggle-icon` | The toggle icon to use. This icon will be rotated when the accordion is expanded or collapsed. | `string` | `'chevron-down'` |
1629+
| `toggleIcon` | `toggle-icon` | The toggle icon to use. This icon will be rotated when the accordion is expanded or collapsed. | `string` | `chevronDown` |
16301630
| `toggleIconSlot` | `toggle-icon-slot` | The slot inside of `ion-item` to place the toggle icon. Defaults to `'end'`. | `"end" \| "start"` | `'end'` |
16311631
| `value` | `value` | The value of the accordion. Defaults to an autogenerated value. | `string` | ``ion-accordion-${accordionIds++}`` |
16321632

core/src/components/back-button/back-button.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, ComponentInterface, Element, Host, Prop, h } from '@stencil/core';
2+
import { arrowBackSharp, chevronBack } from 'ionicons/icons';
23

34
import { config } from '../../global/config';
45
import { getIonMode } from '../../global/ionic-global';
@@ -83,11 +84,11 @@ export class BackButton implements ComponentInterface, ButtonInterface {
8384

8485
if (getIonMode(this) === 'ios') {
8586
// default ios back button icon
86-
return config.get('backButtonIcon', 'chevron-back');
87+
return config.get('backButtonIcon', chevronBack);
8788
}
8889

8990
// default md back button icon
90-
return config.get('backButtonIcon', 'arrow-back-sharp');
91+
return config.get('backButtonIcon', arrowBackSharp);
9192
}
9293

9394
get backButtonText() {

core/src/components/back-button/test/back-button.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { arrowBackSharp, chevronBack } from 'ionicons/icons';
2+
13
import { newSpecPage } from '@stencil/core/testing';
24
import { BackButton } from "../back-button";
35
import { config } from "../../../global/config";
@@ -46,12 +48,12 @@ describe('back button', () => {
4648

4749
it('default icon for ios mode', async () => {
4850
const bb = await newBackButton('ios');
49-
expect(bb.backButtonIcon).toBe('chevron-back');
51+
expect(bb.backButtonIcon).toBe(chevronBack);
5052
});
5153

5254
it('default icon', async () => {
5355
const bb = await newBackButton();
54-
expect(bb.backButtonIcon).toBe('arrow-back-sharp');
56+
expect(bb.backButtonIcon).toBe(arrowBackSharp);
5557
});
5658

5759
});

core/src/components/fab-button/fab-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Prop, h } from '@stencil/core';
2+
import { close } from 'ionicons/icons';
23

34
import { getIonMode } from '../../global/ionic-global';
45
import { AnimationBuilder, Color, RouterDirection } from '../../interface';
@@ -105,7 +106,7 @@ export class FabButton implements ComponentInterface, AnchorInterface, ButtonInt
105106
* is pressed. Only applies if it is the main button inside of a fab containing a
106107
* fab list.
107108
*/
108-
@Prop() closeIcon = 'close';
109+
@Prop() closeIcon = close;
109110

110111
/**
111112
* Emitted when the button has focus.

core/src/components/fab-button/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export default defineComponent({
149149
| Property | Attribute | Description | Type | Default |
150150
| ----------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----------- |
151151
| `activated` | `activated` | If `true`, the fab button will be show a close icon. | `boolean` | `false` |
152-
| `closeIcon` | `close-icon` | The icon name to use for the close icon. This will appear when the fab button is pressed. Only applies if it is the main button inside of a fab containing a fab list. | `string` | `'close'` |
152+
| `closeIcon` | `close-icon` | The icon name to use for the close icon. This will appear when the fab button is pressed. Only applies if it is the main button inside of a fab containing a fab list. | `string` | `close` |
153153
| `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` |
154154
| `disabled` | `disabled` | If `true`, the user cannot interact with the fab button. | `boolean` | `false` |
155155
| `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` |

core/src/components/item/item.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, ComponentInterface, Element, Host, Listen, Prop, State, forceUpdate, h } from '@stencil/core';
2+
import { chevronForward } from 'ionicons/icons';
23

34
import { getIonMode } from '../../global/ionic-global';
45
import { AnimationBuilder, Color, CssClassMap, RouterDirection, StyleEventDetail } from '../../interface';
@@ -61,7 +62,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
6162
/**
6263
* The icon to use when `detail` is set to `true`.
6364
*/
64-
@Prop() detailIcon = 'chevron-forward';
65+
@Prop() detailIcon = chevronForward;
6566

6667
/**
6768
* If `true`, the user cannot interact with the item.

0 commit comments

Comments
 (0)