From d8648e705d33f76318de63899e06250567cd60ce Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Mon, 20 May 2024 17:07:00 -0700 Subject: [PATCH 01/14] feat(badge): add small/default size for ionic theme --- core/api.txt | 1 + core/src/components.d.ts | 8 ++++++ core/src/components/badge/badge.ionic.scss | 18 +++++++++++++ core/src/components/badge/badge.tsx | 26 ++++++++++++++++++- packages/angular/src/directives/proxies.ts | 4 +-- .../standalone/src/directives/proxies.ts | 4 +-- packages/vue/src/proxies.ts | 3 ++- 7 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 core/src/components/badge/badge.ionic.scss diff --git a/core/api.txt b/core/api.txt index 0b514e6580d..d86d9002b1e 100644 --- a/core/api.txt +++ b/core/api.txt @@ -310,6 +310,7 @@ ion-backdrop,event,ionBackdropTap,void,true ion-badge,shadow ion-badge,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record | undefined,undefined,false,true ion-badge,prop,mode,"ios" | "md",undefined,false,false +ion-badge,prop,size,"small" | undefined,undefined,false,false ion-badge,prop,theme,"ios" | "md" | "ionic",undefined,false,false ion-badge,css-prop,--background,ionic ion-badge,css-prop,--background,ios diff --git a/core/src/components.d.ts b/core/src/components.d.ts index d9802a3b7c5..517586ff279 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -409,6 +409,10 @@ export namespace Components { * The mode determines the platform behaviors of the component. */ "mode"?: "ios" | "md"; + /** + * Set to `"small"` for less height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. + */ + "size"?: 'small'; /** * The theme determines the visual appearance of the component. */ @@ -5637,6 +5641,10 @@ declare namespace LocalJSX { * The mode determines the platform behaviors of the component. */ "mode"?: "ios" | "md"; + /** + * Set to `"small"` for less height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. + */ + "size"?: 'small'; /** * The theme determines the visual appearance of the component. */ diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss new file mode 100644 index 00000000000..11e8f946681 --- /dev/null +++ b/core/src/components/badge/badge.ionic.scss @@ -0,0 +1,18 @@ +@import "./badge"; + +// Ionic Badge +// -------------------------------------------------- + +:host { + display: inline-flex; + + align-items: center; + justify-content: center; +} + +// Button Sizes +// -------------------------------------------------- +:host(.badge-small) { + min-width: 32px; + height: 32px; +} diff --git a/core/src/components/badge/badge.tsx b/core/src/components/badge/badge.tsx index 46dbd5a165a..59da1fbd133 100644 --- a/core/src/components/badge/badge.tsx +++ b/core/src/components/badge/badge.tsx @@ -14,7 +14,7 @@ import type { Color } from '../../interface'; styleUrls: { ios: 'badge.ios.scss', md: 'badge.md.scss', - ionic: 'badge.md.scss', + ionic: 'badge.ionic.scss', }, shadow: true, }) @@ -26,12 +26,36 @@ export class Badge implements ComponentInterface { */ @Prop({ reflect: true }) color?: Color; + /** + * Set to `"small"` for less height and width. + * Defaults to `"small"` for the `ionic` theme, undefined for all other themes. + */ + @Prop() size?: 'small'; + + private getSize(): string | undefined { + const theme = getIonTheme(this); + const { size } = this; + + // TODO(ROU-10747): Remove theme check when sizes are defined for all themes. + if (theme !== 'ionic') { + return undefined; + } + + if (size === undefined) { + return 'small'; + } + + return size; + } + render() { + const size = this.getSize(); const theme = getIonTheme(this); return ( diff --git a/packages/angular/src/directives/proxies.ts b/packages/angular/src/directives/proxies.ts index 552e9cecbef..3cfff5d14d0 100644 --- a/packages/angular/src/directives/proxies.ts +++ b/packages/angular/src/directives/proxies.ts @@ -260,14 +260,14 @@ export declare interface IonBackdrop extends Components.IonBackdrop { @ProxyCmp({ - inputs: ['color', 'mode', 'theme'] + inputs: ['color', 'mode', 'size', 'theme'] }) @Component({ selector: 'ion-badge', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: ['color', 'mode', 'theme'], + inputs: ['color', 'mode', 'size', 'theme'], }) export class IonBadge { protected el: HTMLElement; diff --git a/packages/angular/standalone/src/directives/proxies.ts b/packages/angular/standalone/src/directives/proxies.ts index 76ae26028a0..2cd74d64fef 100644 --- a/packages/angular/standalone/src/directives/proxies.ts +++ b/packages/angular/standalone/src/directives/proxies.ts @@ -344,14 +344,14 @@ export declare interface IonBackdrop extends Components.IonBackdrop { @ProxyCmp({ defineCustomElementFn: defineIonBadge, - inputs: ['color', 'mode', 'theme'] + inputs: ['color', 'mode', 'size', 'theme'] }) @Component({ selector: 'ion-badge', changeDetection: ChangeDetectionStrategy.OnPush, template: '', // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property - inputs: ['color', 'mode', 'theme'], + inputs: ['color', 'mode', 'size', 'theme'], standalone: true }) export class IonBadge { diff --git a/packages/vue/src/proxies.ts b/packages/vue/src/proxies.ts index b114af9f1ae..391bc1ad115 100644 --- a/packages/vue/src/proxies.ts +++ b/packages/vue/src/proxies.ts @@ -114,7 +114,8 @@ export const IonBackdrop = /*@__PURE__*/ defineContainer('ion-b export const IonBadge = /*@__PURE__*/ defineContainer('ion-badge', defineIonBadge, [ - 'color' + 'color', + 'size' ]); From 12659fbf09d6db8bf83d2df0fc1d33e47de468ab Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Mon, 20 May 2024 17:11:45 -0700 Subject: [PATCH 02/14] test(badge): add small size --- .../components/badge/test/size/badge.e2e.ts | 22 ++++++++++ ...ionic-md-ltr-light-Mobile-Chrome-linux.png | Bin 0 -> 418 bytes ...onic-md-ltr-light-Mobile-Firefox-linux.png | Bin 0 -> 559 bytes ...ionic-md-ltr-light-Mobile-Safari-linux.png | Bin 0 -> 349 bytes .../src/components/badge/test/size/index.html | 39 ++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 core/src/components/badge/test/size/badge.e2e.ts create mode 100644 core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Chrome-linux.png create mode 100644 core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Firefox-linux.png create mode 100644 core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Safari-linux.png create mode 100644 core/src/components/badge/test/size/index.html diff --git a/core/src/components/badge/test/size/badge.e2e.ts b/core/src/components/badge/test/size/badge.e2e.ts new file mode 100644 index 00000000000..c9c8aeb6ac1 --- /dev/null +++ b/core/src/components/badge/test/size/badge.e2e.ts @@ -0,0 +1,22 @@ +import { expect } from '@playwright/test'; +import { configs, test } from '@utils/test/playwright'; + +/** + * This behavior does not vary across directions. + */ +configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screenshot, title }) => { + test.describe(title('badge: size'), () => { + test('should render small badges', async ({ page }) => { + await page.setContent( + ` + 00 + `, + config + ); + + const badge = page.locator('ion-badge'); + + await expect(badge).toHaveScreenshot(screenshot(`badge-size-small`)); + }); + }); +}); diff --git a/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..3d6e7e145beeca9c452ae7ef88e69e1d798ad18f GIT binary patch literal 418 zcmV;T0bTxyP)Px$TuDShR9J=Wmb))QQ2>X(`zYFYG-V)77itl)5TnE+;SVqx#3*7j*hs7O_ks)tCD++)51Y>1lG48qO~{xx@EM?w6DE(pY@)XkqkL{#*$t0VSXW z{)K?qOgY_eFg|FK&AVJbTG*}}3q@dcKFZ!o7kYip&hIQ1c0MT8#H>*aMmDw@mEtjt z)6F>9H<#J%0{NoL(o_e9lE-b<4rG`2Rzm@)H83$0p*yB=d{N~lW3ziw24H5iO~_;- zC6G+`wf9f|<}Q>y92Zi3hLD9O5D8c*rXgmb2~@uPuTgJn^--#NLKd1pCg%W<>h3rfo`BPE~&lzj{m z4A-9gVK6Fv$H2_Qz;Jz{FoU!ZGsBEs-x#bl*ci-ISQvu3KQgR8^^>3@h;qQ5Ispb} zT{Z@h#McaOzx-#IpT)c7k?Qv^4}7&ALw8r8YFi>A;8bXz!wJzfw~ZGhQ@Gih5%p)@B$sM7#IS@3%@Y* zZ9#;K~zYI?bREKsN-#Q}7=Kiy&$-*aU+hMnNze z1i@x83xZJvHJgkw2PU)CA;aW`mMQMBdG8F?^Mr#X?-wq7fAIUn6Rb7p + + + + Badge - Size + + + + + + + + + + + + + Button - Size + + + + + + + Default Badge + 00 + + + Small Badge + 00 + + + + + + From 41f42103be4a59cbb50150ebebbd2c38b876f7d7 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 12:43:31 -0700 Subject: [PATCH 03/14] docs(badge): update comment --- core/src/components/badge/badge.ionic.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index 11e8f946681..8b04a1d62c4 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -10,7 +10,7 @@ justify-content: center; } -// Button Sizes +// Badge Sizes // -------------------------------------------------- :host(.badge-small) { min-width: 32px; From bf2657269b85da96449aa1d93ee641abfd743460 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 13:24:45 -0700 Subject: [PATCH 04/14] refactor(badge): add missing styles --- core/src/components/badge/badge.ionic.scss | 12 ++++++++++++ ...l-ionic-md-ltr-light-Mobile-Chrome-linux.png | Bin 418 -> 459 bytes ...-ionic-md-ltr-light-Mobile-Firefox-linux.png | Bin 559 -> 536 bytes ...l-ionic-md-ltr-light-Mobile-Safari-linux.png | Bin 349 -> 440 bytes 4 files changed, 12 insertions(+) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index 8b04a1d62c4..9d786ced9a6 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -1,13 +1,25 @@ +@use "../../foundations/ionic.vars.scss" as tokens; @import "./badge"; // Ionic Badge // -------------------------------------------------- :host { + --padding-start: 4px; + --padding-end: 4px; + --padding-top: 0; + --padding-bottom: 0; + display: inline-flex; align-items: center; justify-content: center; + + font-size: tokens.$ionic-font-size-l; + + font-weight: tokens.$ionic-font-weight-medium; + + line-height: tokens.$ionic-font-line-height-m; } // Badge Sizes diff --git a/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Chrome-linux.png index 3d6e7e145beeca9c452ae7ef88e69e1d798ad18f..9fe9cd84a5d3906717faf10897be097ad401eef4 100644 GIT binary patch delta 420 zcmV;V0bBl}1Iq)DF@J?gL_t(oh3%EGO9D|G$G@-ht`s%XObe%q3ZcEmAZRUUY7{r; z2wDoFK?;J3XliY>_L`!9z#3|ZRH#g`lGHBGdkvR?f$yFNBEtJFKkj}X-uv)=@E*Z( zmZF2{>Ez}@KnMtd?h%MB*m1w_gL*oI$D={4FF8OgFqQ-&bANp}jJhC81Sgjjd{rs7 zSDaW|bhN}Y3o*NjZ})td8j&y>%OjQ7;dK&Zj{PX96v1c?I^|<5oq*d;5DrPW$!JLB zbpSx&lj8dB8-6#zcu?YESYZkTJx2TWLvQ$B{|@x`a50tz6q`|NjccP?Git9)xERX< zX5o3q%^0SDT7NaF{BMjlsotkt3@bKPGh3gdr*ZY+-?=}(>Btq$8CIAlP^?fS(;C7d z31b0c1Fw@{c2dF1yN-u!jf=4?008ks8H4~A8v{6qxNx=Qgu z^j7{{2`B+2palMffZ0qr-ES~HXp+slTt8aat{e+RV0Avq-hWCLdVS8$?<^K}J}A}1 ztWgX`Hntj-;xUcW%{bXNm)Y$C`J&6xR0oBU$8FXQWS93=LjkEZFfkONJEn1bQROCM zvwKnoU}m&U$YdfVkWBcs_fP-kE|fhS7gBwOkcB1?30NtnA!eZoRKEPLQEzMYQL1`E z7MegN=KzrE^>gdVgpRJmbKVg$nMiHJs|Slr&SiNz%G0aE+*msRN9R=`lZht#CY(&0 z9Ip2;JYZluuzyxz?VyP3iCJg@KS^|I)GY7MLq^1c($rDRukF?>3rfo`BPE~&lzR+d$#k$76Q$8Gp_d7GEP&j^?|-l}y6s zN-gHvY4Ks#UI3=TSmdNcp>LUmbCnfq%F+Ck_L2bm6M7gkC=}QkoZfIS&>Eai8^FH2 zBdx^?jtAsu6ammW4el2Va9_Nk%yAd4;TlMQr8E`=T?}sgyrkyjn)~r{_p1Z>=@gD9 z^`iCGVSl*DQhyhX29p-%ejhydyrgFP=v5g&NhSsNxE|}f0n|7@0p@Kqnkuxg4*7`# zoTSF(4nzi^iU4>d00hmZQh>ZP3MW%~Y>@&MQYdsnEief!ATuDP*-_ep&=4M6awzU$ z!T?)?iKr}zL2d^F??Z41f76_K6b_;A;@(&iO0%L-)OXF`@QOofd=y#3WcXPg8LhYA zNgBz~C|X0|QlnXmg-%+udV_33xiJ_-y^D_+U3(Ji%F!qW5H7Y^b#T>0q~G#u(G;q)Bpeg07*qoM6N<$f}p3@h;qQ5Ispb}T{Z@h#McaOzx-#IpT)8UmvsFd6~? YOhNUbPY=jWqW}N^07*qoM6N<$f*@t%XaE2J diff --git a/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-small-ionic-md-ltr-light-Mobile-Safari-linux.png index 6fd90ecbedb13399b39874262d9123dc44b92934..94ffc598e3fda824bdab2e361ee2f5696a90afed 100644 GIT binary patch delta 396 zcmV;70dxM{0=NT^Hh*nNL_t(YiDP64dC5Raz(iBiM=cn&VCY+r?ZJ6#lJL*vq7SAC z*93DjG7=?)2ACPNO0h~LIdRNP{`@bI^5*Y9d{USIdl2z)GHS`NTz`H1=gy123=9mfKm9v) z^S1~uld?E79x1FwVYfg+fQf;D;pGQ}lU{!O$H2fKF2ICGiUbSTSQ!}@7?8dE`ws&H z0|PrNBOWOdEWic+|0h`ry9Gag|7T!eU}ZswK-fQj|HmVR)hHIMqL3h#Knhk#0VW0p zhUf49z5aw#ihl$jeERZ~t6{=5I`FCHlpEMQ<@=-&8^ zfq`Lvqrl=^z7y?&?5vD^o4@`0Pe2M2;LORF9{zdp;h(V*tBoex*B}48H-7Kj_>G_x qCcv4KsRf32aXo6ms0Aa%0sxkW)SI)=7#;us002ovP6b4+LSTaSSG_?1 delta 304 zcmV-00nh%p1Kk3UHh&UHL_t(YiS5-dNJBv!!13?BdvALS!az3!!&C4d28$qSG1vry zAVxtj8w9~-F$;oG1vQ(DG6yEJ)gi;=hL$Prv3c(d*7JmeCGQt5e1Gu!#1pJF=;Z`G zz3u@Ic;J5klS8tyUu<2JYRCQC%LPkx0Yb_3UU7arI;phZ-hZ>B&A!#yyfHcgb7Rry zpgg@zcg{c74_m;-Vr-0#KvI&xQ$qpIuPW1wl%+8`0)?CawC3m4nm8wn(Gf_y8VCe{ z5C}oLqm9uKs5ccbT$VsGAOk_Ysf^KbB(&`AAG@^|wY3y~DZMZe0hf2FF!4)?og!w0000 Date: Tue, 21 May 2024 13:35:43 -0700 Subject: [PATCH 05/14] feat(badge): add medium size --- core/src/components.d.ts | 4 ++-- core/src/components/badge/badge.ionic.scss | 10 +++++++++- core/src/components/badge/badge.tsx | 2 +- core/src/components/badge/test/size/badge.e2e.ts | 13 +++++++++++++ core/src/components/badge/test/size/index.html | 4 ++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 517586ff279..45bb5caccb6 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -410,7 +410,7 @@ export namespace Components { */ "mode"?: "ios" | "md"; /** - * Set to `"small"` for less height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. + * Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. */ "size"?: 'small'; /** @@ -5642,7 +5642,7 @@ declare namespace LocalJSX { */ "mode"?: "ios" | "md"; /** - * Set to `"small"` for less height and width. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. + * Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. */ "size"?: 'small'; /** diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index 9d786ced9a6..9fc7292deff 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -16,7 +16,6 @@ justify-content: center; font-size: tokens.$ionic-font-size-l; - font-weight: tokens.$ionic-font-weight-medium; line-height: tokens.$ionic-font-line-height-m; @@ -28,3 +27,12 @@ min-width: 32px; height: 32px; } + +:host(.badge-medium) { + min-width: 40px; + height: 40px; + + font-size: tokens.$ionic-font-size-h6; + + line-height: tokens.$ionic-font-line-height-l; +} diff --git a/core/src/components/badge/badge.tsx b/core/src/components/badge/badge.tsx index 59da1fbd133..e8bff6495a8 100644 --- a/core/src/components/badge/badge.tsx +++ b/core/src/components/badge/badge.tsx @@ -27,7 +27,7 @@ export class Badge implements ComponentInterface { @Prop({ reflect: true }) color?: Color; /** - * Set to `"small"` for less height and width. + * Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. * Defaults to `"small"` for the `ionic` theme, undefined for all other themes. */ @Prop() size?: 'small'; diff --git a/core/src/components/badge/test/size/badge.e2e.ts b/core/src/components/badge/test/size/badge.e2e.ts index c9c8aeb6ac1..3d277a4e959 100644 --- a/core/src/components/badge/test/size/badge.e2e.ts +++ b/core/src/components/badge/test/size/badge.e2e.ts @@ -18,5 +18,18 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens await expect(badge).toHaveScreenshot(screenshot(`badge-size-small`)); }); + + test('should render medium badges', async ({ page }) => { + await page.setContent( + ` + 00 + `, + config + ); + + const badge = page.locator('ion-badge'); + + await expect(badge).toHaveScreenshot(screenshot(`badge-size-medium`)); + }); }); }); diff --git a/core/src/components/badge/test/size/index.html b/core/src/components/badge/test/size/index.html index addbff82e40..793531d4e93 100644 --- a/core/src/components/badge/test/size/index.html +++ b/core/src/components/badge/test/size/index.html @@ -32,6 +32,10 @@ Small Badge 00 + + Medium Badge + 00 + From ec161bf7651f4a307cde67b38904d1ce1ac54605 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 13:37:53 -0700 Subject: [PATCH 06/14] test(badge): add medium snapshots --- core/src/components/badge/test/size/badge.e2e.ts | 2 +- ...ium-ionic-md-ltr-light-Mobile-Chrome-linux.png | Bin 0 -> 501 bytes ...um-ionic-md-ltr-light-Mobile-Firefox-linux.png | Bin 0 -> 924 bytes ...ium-ionic-md-ltr-light-Mobile-Safari-linux.png | Bin 0 -> 473 bytes 4 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Chrome-linux.png create mode 100644 core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Firefox-linux.png create mode 100644 core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Safari-linux.png diff --git a/core/src/components/badge/test/size/badge.e2e.ts b/core/src/components/badge/test/size/badge.e2e.ts index 3d277a4e959..2f2c426e12e 100644 --- a/core/src/components/badge/test/size/badge.e2e.ts +++ b/core/src/components/badge/test/size/badge.e2e.ts @@ -19,7 +19,7 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens await expect(badge).toHaveScreenshot(screenshot(`badge-size-small`)); }); - test('should render medium badges', async ({ page }) => { + test.only('should render medium badges', async ({ page }) => { await page.setContent( ` 00 diff --git a/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/badge/test/size/badge.e2e.ts-snapshots/badge-size-medium-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..6c1265c54f4acbd191950f5cc2b243f9420f8dc6 GIT binary patch literal 501 zcmVPx$uSrBfR9J=WmcK6pVH}5_x4lEF?LdM^<7Y%H#9)ya8H`x)2bhc^u_M7K@eha* zV`H@uiGfL28u7bQZPS)s&v0#nM7-y{(BXZiyUXY9ect!`zW2U@sXLo0#`oU>KcNLx z(SoXIK~=P%Dq2vLsuwiezA)Hfurd>3xYxuq1n2PrE4vx?j`F|C{e*CHn(1lrbF$Vz zI3T#ZwMgY`2HKrIPHrSCjmzd_a8=@^iF(2T!Omfhp7|#R7ZNOPrx5~{r$erDo(ql* z)Bvy<%TgZpt%EFY1?Y?Vi8lCL9b#fV$^LQPRnBukfc`dv)!7gueI}+~aQ4j}E1UCN@UN-* rhq#&@W6U^oY|{J_0EvyKKmPHj3x(t)iGk0VYPN@G#Yzo1neN4vm_DzmE*& zF$W^kjQC-g6&2Tv7)UehE-tqz0+$l)OGO|du3q98>9elOHvp}!2LN{3NU zZGl1tR9(GPn^mZIXT|=TW=s;W>^L+*)@$Nt+pv1yT`%10^#9?zuXISBfzzW zz(6s$D|ZOhpJo}5J*l;%2EX>&5tiz#!NsI~wBOdkPD)KlYEY>FtdIE`oOjHC9@1u} z;^$o*g8XFIc+rG9(m#cS;4KdEm!qRl3kzAe_NbowWMjt)H`HWK2k$J>Ay_BFmP;nQ zY34!Lo@grLPw~ItGl2>QWCv*@MIJ_q{Op4f z>VcOHRz&BUIlGxLYUCuS(L`>Xh&1ORqgfOM$kriyP#6Z>R(p}&#-3u+2)Rkpjp#D+ z+qsA|^UwKOc+X+bPudK7)36I;Z<2l2&8Q^cLPHcFJ1E<3&PS^ev4Gsg6AsjoewI-_ zjHWL8v^kfPd|sj_qLz`nSk92V4LKE~c=16voTxSMCSmYCn+?@`Jot)iT!b9^v4fC6Ce#|h;N3fVj zHzIY#D#Su8#6m2@KZ(Q2qRFTuxui@boKA|noW66SonF-}(oP|!-6;{KnO(mkljowL z)mSV@8N)(KZSKyeoS0wr*1SiN$?;_^vhp^%R@gq$2tjh$V};rhPfzp!*iTms1^@@? zN<+ukkR#GBnbO~jWhV*sNdWF&^yW;d%3ezbfaoCQQ(IzpFKG@wK3RLRRAm6XGT~EO zVySaEA%stDiCJf4Fvh30#N}$M-sk#0f!9Tvh)->a>kXDG=m6s3)>os*B;ad3C_c3% z25@mx2e2{gq7neC&$t~Fw~vjdqG3uoG5@(n0yLZQ`&=Zi8ft~bLzFSh?Wt#(nknUk zVtkXo;$36s*Y)868VgdtLb4C~>S4LPFQ3{v@gL>?^ Date: Tue, 21 May 2024 13:42:20 -0700 Subject: [PATCH 07/14] test(badge): remove only --- core/src/components/badge/test/size/badge.e2e.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/components/badge/test/size/badge.e2e.ts b/core/src/components/badge/test/size/badge.e2e.ts index 2f2c426e12e..3d277a4e959 100644 --- a/core/src/components/badge/test/size/badge.e2e.ts +++ b/core/src/components/badge/test/size/badge.e2e.ts @@ -19,7 +19,7 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens await expect(badge).toHaveScreenshot(screenshot(`badge-size-small`)); }); - test.only('should render medium badges', async ({ page }) => { + test('should render medium badges', async ({ page }) => { await page.setContent( ` 00 From 7553d17fa49a51ba7c5f077e4d7a197308091e51 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 13:52:11 -0700 Subject: [PATCH 08/14] refactor(badge): use tokens --- core/src/components/badge/badge.ionic.scss | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index 9d786ced9a6..aaacf2b5f26 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -5,10 +5,10 @@ // -------------------------------------------------- :host { - --padding-start: 4px; - --padding-end: 4px; - --padding-top: 0; - --padding-bottom: 0; + --padding-start: tokens.$ionic-space-xxxs; + --padding-end: tokens.$ionic-space-xxxs; + --padding-top: tokens.$ionic-space-none; + --padding-bottom: tokens.$ionic-space-none; display: inline-flex; @@ -16,7 +16,6 @@ justify-content: center; font-size: tokens.$ionic-font-size-l; - font-weight: tokens.$ionic-font-weight-medium; line-height: tokens.$ionic-font-line-height-m; From 01254668a5f82054bd7e231413247f7d4e99afc0 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 16:04:10 -0700 Subject: [PATCH 09/14] refactor(badge): use the globals import --- core/src/components/badge/badge.ionic.scss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index aaacf2b5f26..0c91e21255b 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -1,24 +1,24 @@ -@use "../../foundations/ionic.vars.scss" as tokens; +@use "../../themes/ionic/ionic.globals.scss" as globals; @import "./badge"; // Ionic Badge // -------------------------------------------------- :host { - --padding-start: tokens.$ionic-space-xxxs; - --padding-end: tokens.$ionic-space-xxxs; - --padding-top: tokens.$ionic-space-none; - --padding-bottom: tokens.$ionic-space-none; + --padding-start: globals.$ionic-space-xxxs; + --padding-end: globals.$ionic-space-xxxs; + --padding-top: globals.$ionic-space-none; + --padding-bottom: globals.$ionic-space-none; display: inline-flex; align-items: center; justify-content: center; - font-size: tokens.$ionic-font-size-l; - font-weight: tokens.$ionic-font-weight-medium; + font-size: globals.$ionic-font-size-l; + font-weight: globals.$ionic-font-weight-medium; - line-height: tokens.$ionic-font-line-height-m; + line-height: globals.$ionic-font-line-height-m; } // Badge Sizes From 460b6c137af0ef512fd8e7e7441a2fa59a391a85 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 16:06:35 -0700 Subject: [PATCH 10/14] refactor(badge): use globals variable --- core/src/components/badge/badge.ionic.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index c1ab65040f1..21e6149baee 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -32,7 +32,7 @@ min-width: 40px; height: 40px; - font-size: tokens.$ionic-font-size-h6; + font-size: globals.$ionic-font-size-h6; - line-height: tokens.$ionic-font-line-height-l; + line-height: globals.$ionic-font-line-height-l; } From 0a7bb81d4befa9bc1ba1ad5288ae5daa51646613 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 16:11:20 -0700 Subject: [PATCH 11/14] refactor(badge): use proper var structure --- core/src/components/badge/badge.ionic.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index 0c91e21255b..c233d4bd767 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -5,10 +5,10 @@ // -------------------------------------------------- :host { - --padding-start: globals.$ionic-space-xxxs; - --padding-end: globals.$ionic-space-xxxs; - --padding-top: globals.$ionic-space-none; - --padding-bottom: globals.$ionic-space-none; + --padding-start: #{globals.$ionic-space-xxxs}; + --padding-end: #{globals.$ionic-space-xxxs}; + --padding-top: #{globals.$ionic-space-none}; + --padding-bottom: #{globals.$ionic-space-none}; display: inline-flex; From 1f782c0c0f2232edf301ad8159970617266850cc Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Tue, 21 May 2024 16:49:09 -0700 Subject: [PATCH 12/14] refactor(badge): add prop value --- core/api.txt | 2 +- core/src/components.d.ts | 4 ++-- core/src/components/badge/badge.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/api.txt b/core/api.txt index d86d9002b1e..7b71e2ad13e 100644 --- a/core/api.txt +++ b/core/api.txt @@ -310,7 +310,7 @@ ion-backdrop,event,ionBackdropTap,void,true ion-badge,shadow ion-badge,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string & Record | undefined,undefined,false,true ion-badge,prop,mode,"ios" | "md",undefined,false,false -ion-badge,prop,size,"small" | undefined,undefined,false,false +ion-badge,prop,size,"medium" | "small" | undefined,undefined,false,false ion-badge,prop,theme,"ios" | "md" | "ionic",undefined,false,false ion-badge,css-prop,--background,ionic ion-badge,css-prop,--background,ios diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 45bb5caccb6..2d0dc800f56 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -412,7 +412,7 @@ export namespace Components { /** * Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. */ - "size"?: 'small'; + "size"?: 'small' | 'medium'; /** * The theme determines the visual appearance of the component. */ @@ -5644,7 +5644,7 @@ declare namespace LocalJSX { /** * Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. Defaults to `"small"` for the `ionic` theme, undefined for all other themes. */ - "size"?: 'small'; + "size"?: 'small' | 'medium'; /** * The theme determines the visual appearance of the component. */ diff --git a/core/src/components/badge/badge.tsx b/core/src/components/badge/badge.tsx index e8bff6495a8..c2c2f95c54e 100644 --- a/core/src/components/badge/badge.tsx +++ b/core/src/components/badge/badge.tsx @@ -30,7 +30,7 @@ export class Badge implements ComponentInterface { * Set to `"small"` for less height and width. Set to "medium" for slightly larger dimensions. * Defaults to `"small"` for the `ionic` theme, undefined for all other themes. */ - @Prop() size?: 'small'; + @Prop() size?: 'small' | 'medium'; private getSize(): string | undefined { const theme = getIonTheme(this); From 647b21740b05e3e56e2d9d2c1859148ce19b8e4d Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Wed, 22 May 2024 10:40:44 -0700 Subject: [PATCH 13/14] refactor(badge): use new tokens --- core/src/components/badge/badge.ionic.scss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index c233d4bd767..54b81649db8 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -5,25 +5,25 @@ // -------------------------------------------------- :host { - --padding-start: #{globals.$ionic-space-xxxs}; - --padding-end: #{globals.$ionic-space-xxxs}; - --padding-top: #{globals.$ionic-space-none}; - --padding-bottom: #{globals.$ionic-space-none}; + --padding-start: #{globals.$ionic-space-100}; + --padding-end: #{globals.$ionic-space-100}; + --padding-top: #{globals.$ionic-space-0}; + --padding-bottom: #{globals.$ionic-space-0}; display: inline-flex; align-items: center; justify-content: center; - font-size: globals.$ionic-font-size-l; + font-size: globals.$ionic-font-size-400; font-weight: globals.$ionic-font-weight-medium; - line-height: globals.$ionic-font-line-height-m; + line-height: globals.$ionic-line-height-600; } // Badge Sizes // -------------------------------------------------- :host(.badge-small) { - min-width: 32px; - height: 32px; + min-width: globals.$ionic-scale-800; + height: globals.$ionic-scale-800; } From ecd6359fb4983d38075ce35ff72bd4ec67faeb8a Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Wed, 22 May 2024 10:46:19 -0700 Subject: [PATCH 14/14] refactor(badge): use new tokens --- core/src/components/badge/badge.ionic.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/components/badge/badge.ionic.scss b/core/src/components/badge/badge.ionic.scss index 6d5a27c6757..f3015c7cdef 100644 --- a/core/src/components/badge/badge.ionic.scss +++ b/core/src/components/badge/badge.ionic.scss @@ -29,10 +29,10 @@ } :host(.badge-medium) { - min-width: 40px; - height: 40px; + min-width: globals.$ionic-scale-1000; + height: globals.$ionic-scale-1000; - font-size: globals.$ionic-font-size-h6; + font-size: globals.$ionic-font-size-450; - line-height: globals.$ionic-font-line-height-l; + line-height: globals.$ionic-line-height-700; }