Skip to content

Commit 7fec492

Browse files
feat(badge): remove xxsmall, xsmall and xlarge sizes (#30392)
Issue number: resolves internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? The badge presents the `xxsmall`, `xsmall`, and `xlarge`. The user experience design expects only the `small` and `medium` sizes for badges with content (number or icon), and `small`, `medium`, and `large` sizes for empty badges. ## What is the new behavior? - The badge should support only the sizes mentioned above. - The `small` and `medium` sizes must be adjusted to the new requirements for badges with content. - The size property descriptions must inform that the `large` size is only available for empty badges. ## Does this introduce a breaking change? - [x] Yes - [ ] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> --------- Co-authored-by: ionitron <[email protected]>
1 parent 3b643a7 commit 7fec492

File tree

111 files changed

+63
-340
lines changed

Some content is hidden

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

111 files changed

+63
-340
lines changed

core/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ ion-badge,prop,color,"danger" | "dark" | "light" | "medium" | "primary" | "secon
317317
ion-badge,prop,hue,"bold" | "subtle" | undefined,undefined,false,false
318318
ion-badge,prop,mode,"ios" | "md",undefined,false,false
319319
ion-badge,prop,shape,"round | rectangular" | "soft" | undefined,undefined,false,false
320-
ion-badge,prop,size,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxsmall" | undefined,undefined,false,false
320+
ion-badge,prop,size,"large" | "medium" | "small" | undefined,undefined,false,false
321321
ion-badge,prop,theme,"ios" | "md" | "ionic",undefined,false,false
322322
ion-badge,prop,vertical,"bottom" | "top" | undefined,undefined,false,false
323323
ion-badge,css-prop,--background,ionic

core/src/components.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ export namespace Components {
442442
*/
443443
"shape"?: 'soft' | 'round | rectangular';
444444
/**
445-
* Set to `"xxsmall"` for the smallest badge. Set to "xsmall" for a very small badge. Set to `"small"` for a small badge. Set to "medium" for a medium badge. Set to "large" for a large badge. Set to `"xlarge"` for the largest badge. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
445+
* Set to `"small"` for a small badge. Set to `"medium"` for a medium badge. Set to `"large"` for a large badge, when it is empty (no text or icon). Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
446446
*/
447-
"size"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
447+
"size"?: 'small' | 'medium' | 'large';
448448
/**
449449
* The theme determines the visual appearance of the component.
450450
*/
@@ -5899,9 +5899,9 @@ declare namespace LocalJSX {
58995899
*/
59005900
"shape"?: 'soft' | 'round | rectangular';
59015901
/**
5902-
* Set to `"xxsmall"` for the smallest badge. Set to "xsmall" for a very small badge. Set to `"small"` for a small badge. Set to "medium" for a medium badge. Set to "large" for a large badge. Set to `"xlarge"` for the largest badge. Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
5902+
* Set to `"small"` for a small badge. Set to `"medium"` for a medium badge. Set to `"large"` for a large badge, when it is empty (no text or icon). Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
59035903
*/
5904-
"size"?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
5904+
"size"?: 'small' | 'medium' | 'large';
59055905
/**
59065906
* The theme determines the visual appearance of the component.
59075907
*/

core/src/components/badge/badge.ionic.scss

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
@include globals.border-radius(globals.$ion-border-radius-200);
5555
}
5656

57-
:host(.badge-xxsmall.badge-soft),
58-
:host(.badge-xsmall.badge-soft),
5957
:host(.badge-small.badge-soft) {
6058
@include globals.border-radius(globals.$ion-border-radius-100);
6159
}
@@ -73,90 +71,37 @@
7371
// Badge Sizes
7472
// --------------------------------------------------
7573

76-
/* 2-Extra Small Badge */
77-
:host(.badge-xxsmall) {
74+
/* Small Badge */
75+
:host(.badge-small) {
7876
--padding-start: #{globals.$ion-space-050};
7977
--padding-end: #{globals.$ion-space-050};
8078

8179
min-width: globals.$ion-scale-400;
8280
height: globals.$ion-scale-400;
83-
84-
font-size: globals.$ion-font-size-300;
85-
86-
line-height: globals.$ion-font-line-height-400;
8781
}
8882

89-
:host(.badge-xxsmall) ::slotted(ion-icon) {
83+
:host(.badge-small) ::slotted(ion-icon) {
9084
width: globals.$ion-scale-300;
9185
height: globals.$ion-scale-300;
9286
}
9387

94-
/* Extra Small Badge */
95-
:host(.badge-xsmall) {
96-
--padding-start: #{globals.$ion-space-100};
97-
--padding-end: #{globals.$ion-space-100};
98-
99-
min-width: globals.$ion-scale-600;
100-
height: globals.$ion-scale-600;
101-
102-
font-size: globals.$ion-font-size-350;
103-
104-
line-height: globals.$ion-font-line-height-600;
105-
}
106-
107-
:host(.badge-xsmall) ::slotted(ion-icon) {
108-
width: globals.$ion-scale-400;
109-
height: globals.$ion-scale-400;
110-
}
111-
112-
/* Small Badge */
113-
:host(.badge-small) {
88+
/* Medium Badge */
89+
/* Large size defaults to the medium size to avoid styles breakage */
90+
:host(.badge-medium),
91+
:host(.badge-large) {
11492
--padding-start: #{globals.$ion-space-100};
11593
--padding-end: #{globals.$ion-space-100};
11694

117-
min-width: globals.$ion-scale-800;
118-
height: globals.$ion-scale-800;
119-
}
120-
121-
:host(.badge-small) ::slotted(ion-icon) {
122-
width: globals.$ion-scale-500;
123-
height: globals.$ion-scale-500;
124-
}
125-
126-
/* Medium Badge */
127-
:host(.badge-medium) {
12895
@include globals.typography(globals.$ion-body-md-medium);
129-
min-width: globals.$ion-scale-1000;
130-
height: globals.$ion-scale-1000;
131-
}
13296

133-
:host(.badge-medium) ::slotted(ion-icon) {
134-
width: globals.$ion-scale-600;
97+
min-width: globals.$ion-scale-600;
13598
height: globals.$ion-scale-600;
13699
}
137100

138-
/* Large Badge */
139-
:host(.badge-large) {
140-
@include globals.typography(globals.$ion-body-lg-medium);
141-
min-width: globals.$ion-scale-1200;
142-
height: globals.$ion-scale-1200;
143-
}
144-
101+
:host(.badge-medium) ::slotted(ion-icon),
145102
:host(.badge-large) ::slotted(ion-icon) {
146-
width: globals.$ion-scale-800;
147-
height: globals.$ion-scale-800;
148-
}
149-
150-
/* Extra Large Badge */
151-
:host(.badge-xlarge) {
152-
@include globals.typography(globals.$ion-heading-h4-medium);
153-
min-width: globals.$ion-scale-1400;
154-
height: globals.$ion-scale-1400;
155-
}
156-
157-
:host(.badge-xlarge) ::slotted(ion-icon) {
158-
width: globals.$ion-scale-1000;
159-
height: globals.$ion-scale-1000;
103+
width: globals.$ion-scale-400;
104+
height: globals.$ion-scale-400;
160105
}
161106

162107
// Badge (hint)
@@ -215,15 +160,12 @@
215160
// Badge in Button
216161
// --------------------------------------------------
217162

218-
:host([vertical]:not(.in-tab-button).in-button.badge-xxsmall),
219-
:host([vertical]:not(.in-tab-button).in-button.badge-xsmall),
220163
:host([vertical]:not(.in-tab-button).in-button.badge-small) {
221164
@include globals.position(null, calc(-1 * var(globals.$ion-space-050)));
222165
}
223166

224167
:host([vertical]:not(.in-tab-button).in-button.badge-medium),
225-
:host([vertical]:not(.in-tab-button).in-button.badge-large),
226-
:host([vertical]:not(.in-tab-button).in-button.badge-xlarge) {
168+
:host([vertical]:not(.in-tab-button).in-button.badge-large) {
227169
@include globals.position(null, globals.$ion-space-050);
228170
}
229171

core/src/components/badge/badge.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,13 @@ export class Badge implements ComponentInterface {
4646
@Prop() shape?: 'soft' | 'round | rectangular';
4747

4848
/**
49-
* Set to `"xxsmall"` for the smallest badge.
50-
* Set to "xsmall" for a very small badge.
5149
* Set to `"small"` for a small badge.
52-
* Set to "medium" for a medium badge.
53-
* Set to "large" for a large badge.
54-
* Set to `"xlarge"` for the largest badge.
50+
* Set to `"medium"` for a medium badge.
51+
* Set to `"large"` for a large badge, when it is empty (no text or icon).
5552
*
5653
* Defaults to `"small"` for the `ionic` theme, undefined for all other themes.
5754
*/
58-
@Prop() size?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
55+
@Prop() size?: 'small' | 'medium' | 'large';
5956

6057
/**
6158
* Set to `"top"` to position the badge on top right absolute position of the parent element.
-12 KB
Loading
-16.1 KB
Loading
-13.8 KB
Loading
-12.5 KB
Loading
-16.3 KB
Loading
-14.9 KB
Loading

0 commit comments

Comments
 (0)