Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
4b38f4a
feat(badge): Add context selector when inside tab button.
joselrio Mar 13, 2025
2ea2c3a
feat(badge): Add styling when in context of tab button
joselrio Mar 13, 2025
53e64e6
feat(tab-button): Adding styling to the badge.
joselrio Mar 13, 2025
293d49c
feat(badge): Adding sample section when inside tab button.
joselrio Mar 13, 2025
15d96fd
feat(badge): Adding visual tests when inside tab button.
joselrio Mar 13, 2025
380c3df
fix(badge): Fixed html structure.
joselrio Mar 13, 2025
82d587e
feat(badge): Adding screenshot tests to badge when inside tab button
joselrio Mar 13, 2025
49e2e3b
fix(badge): run lint and fix based on lint feedback.
joselrio Mar 13, 2025
715bb99
feat(badge): create new badge tokens when inside tab button
joselrio Mar 13, 2025
f4e4813
feat(badge): make usage of the new tokens when inside tab button
joselrio Mar 13, 2025
35bca0a
feat(tab-button): new tokens to style badge when inside tab button
joselrio Mar 13, 2025
08c9a58
feat(tab-button): make usage of the new tokens to style badge
joselrio Mar 13, 2025
a93fcc7
feat(badge): updated test screenshots when inside tab button.
joselrio Mar 13, 2025
1061f8b
feat(badge): fix text vertical alignment when at md device.
joselrio Mar 14, 2025
1608e3e
feat(badge): update screenshots when inside tab button
joselrio Mar 14, 2025
1252527
fix(badge): Remove added styling under the context of tab button from…
joselrio Mar 17, 2025
78b5905
fix(badge): run lint
joselrio Mar 17, 2025
9a50f62
fix(badge): remove unneeded context.
joselrio Mar 17, 2025
2cd81fd
feat(badge): update badge test when inside tab button
joselrio Mar 17, 2025
bff2834
Merge branch 'next' into ROU-11666
joselrio Mar 17, 2025
f7c2378
fix(badge): Update screenshot tests when inside tab button.
joselrio Mar 17, 2025
def8fb9
fix(badge): run lint
joselrio Mar 17, 2025
85bfa52
fix(badge): improvements made based on feedback.
joselrio Mar 18, 2025
ac8f03f
fix(badge): updated tests screenshots.
joselrio Mar 18, 2025
30a3dfa
feat(badge): fix empty badge style when inside tab button.
joselrio Mar 18, 2025
ffcade7
fix(badge): update test page.
joselrio Mar 18, 2025
9e841b1
feat(badge): Updated tests screenshots.
joselrio Mar 18, 2025
d50c383
fet(badge): Update missing screenshot.
joselrio Mar 18, 2025
d8ff3ac
feat(badge): adding new tab button with badge use case.
joselrio Mar 18, 2025
ff966dd
feat(badge): Screenshot tests, update.
joselrio Mar 18, 2025
4946f13
feat(tab-button): Style badge when tab button has icon at bottom.
joselrio Mar 18, 2025
4a0b391
feat(badge): Update when inside tab button based on feedback.
joselrio Mar 19, 2025
19671b7
Merge branch 'next' into ROU-11666
joselrio Mar 19, 2025
3fa1864
fix(badge): remove unneeded variables file.
joselrio Mar 19, 2025
2695132
fix(badge): Grouping hint tests.
joselrio Mar 19, 2025
51af9f6
fix(tab-button): Make usage of token vars only and clean css vars.
joselrio Mar 19, 2025
d9ac8e9
fix(tab-button): remove scss variables.
joselrio Mar 19, 2025
065bb26
fix(badge): Remove unneeded property.
joselrio Mar 19, 2025
3e13b38
fix(badge): removed overriding size.
joselrio Mar 19, 2025
5827770
fix(tab-button): removed overriding size.
joselrio Mar 19, 2025
6346aa7
fix(tab-button): remove unneeded property.
joselrio Mar 19, 2025
9a876f7
Merge branch 'next' into ROU-11666
joselrio Mar 19, 2025
5954d03
feat(badge): run lint
joselrio Mar 19, 2025
762efec
fix(badge): update tests screenshots.
joselrio Mar 19, 2025
06ee460
fix(tab-button): update tests screenshots.
joselrio Mar 19, 2025
512732a
feat(badge): remove badge empty size since it's unneeded.
joselrio Mar 19, 2025
a2666e2
feat(badge): Update tests and screenshots.
joselrio Mar 19, 2025
aa6cadc
feat(tab-button): remove existing dependency.
joselrio Mar 19, 2025
5e0b248
feat(badge): code conventions
joselrio Mar 19, 2025
a143b8b
feat(badge): code conventions
joselrio Mar 19, 2025
0863a0f
feat(badge): code conventions
joselrio Mar 19, 2025
6867820
feat(badge): set default size
joselrio Mar 19, 2025
1552104
Merge branch 'next' into ROU-11666
joselrio Mar 19, 2025
823e9f1
fix(badge): text sentence
joselrio Mar 20, 2025
32e9bdd
feat(badge): remove default values.
joselrio Mar 20, 2025
3f805a0
feat(badge): update tests screenshots
joselrio Mar 20, 2025
21a4e65
feat(tab-button): update tests screenshots.
joselrio Mar 20, 2025
d8dee22
fix(core): Delete vue utils.ts
joselrio Mar 20, 2025
b7cfd97
Merge branch 'refs/heads/next' into ROU-11612
OS-pedrolourenco Mar 25, 2025
ab9acac
Add support for badges in ion-button
OS-pedrolourenco Mar 26, 2025
ae4187c
CR
OS-pedrolourenco Mar 27, 2025
ea679a0
Update snapshots
OS-pedrolourenco Mar 27, 2025
518a4de
CR
OS-pedrolourenco Mar 27, 2025
3d7ec25
CR
OS-pedrolourenco Mar 27, 2025
6837e3e
CR
OS-pedrolourenco Mar 28, 2025
bd8e625
Merge branch 'next' into ROU-11612
OS-pedrolourenco Mar 28, 2025
379b77e
Merge branch 'next' into ROU-11612
OS-pedrolourenco Mar 28, 2025
01d47c3
Fix broken tests
OS-pedrolourenco Mar 28, 2025
dc4ec1d
CR
OS-pedrolourenco Mar 31, 2025
0f6400d
Merge branch 'next' into ROU-11612
OS-pedrolourenco Mar 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions core/src/components/badge/badge.ionic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,32 @@

transform: translate(-50%, -50%);
}

// Badge in Button
// --------------------------------------------------

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

:host([vertical]:not(.in-tab-button).in-button.badge-medium),
:host([vertical]:not(.in-tab-button).in-button.badge-large),
:host([vertical]:not(.in-tab-button).in-button.badge-xlarge) {
@include globals.position(null, globals.$ion-space-050);
}

:host(:not(:empty).in-button) {
min-width: globals.$ion-scale-400;
height: globals.$ion-scale-400;

font-size: globals.$ion-font-size-300;

line-height: globals.$ion-font-line-height-500;

::slotted(ion-icon) {
width: globals.$ion-scale-300;
height: globals.$ion-scale-300;
}
}
19 changes: 18 additions & 1 deletion core/src/components/badge/badge.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}

// TODO(ROU-10747): Review size styles when sizes are defined for native themes.
:host([vertical]:not(.in-tab-button)),
:host([vertical]:not(.in-button):not(.in-tab-button)),
:host(:empty) {
--padding-start: 0;
--padding-end: 0;
Expand All @@ -29,3 +29,20 @@

line-height: 10px;
}

// Badge in Button
// --------------------------------------------------

:host(:not(:empty).in-button) {
min-width: $badge-size-in-button;
height: $badge-size-in-button;

font-size: $badge-font-size-in-button;

line-height: $badge-line-height-in-button;

::slotted(ion-icon) {
width: $badge-icon-size-in-button;
height: $badge-icon-size-in-button;
}
}
13 changes: 13 additions & 0 deletions core/src/components/badge/badge.native.vars.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "../../themes/functions.font";
@import "../../themes/functions.sizes";

// Badge
// --------------------------------------------------
Expand All @@ -8,3 +9,15 @@ $badge-hint-baseline-font-size: 8px;

/// @prop - Font size of the badge hint
$badge-hint-font-size: dynamic-font($badge-hint-baseline-font-size);

/// @prop - Size of the badge when inside button
$badge-size-in-button: 16px;

/// @prop - Font size of the badge when inside button
$badge-font-size-in-button: px-to-rem(12);

/// @prop - Line height of the badge when inside button
$badge-line-height-in-button: 20px;

/// @prop - Size of of the badge icon when inside button
$badge-icon-size-in-button: 12px;
1 change: 1 addition & 0 deletions core/src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class Badge implements ComponentInterface {
[`badge-${shape}`]: shape !== undefined,
[`badge-${size}`]: size !== undefined,
[`badge-vertical-${this.vertical}`]: this.vertical !== undefined,
'in-button': hostContext('ion-button', this.el),
'in-tab-button': hostContext('ion-tab-button', this.el),
})}
>
Expand Down
18 changes: 18 additions & 0 deletions core/src/components/badge/test/hint/badge.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,22 @@ configs({ directions: ['ltr'], modes: ['md', 'ios', 'ionic-md'] }).forEach(({ co
await expect(container).toHaveScreenshot(screenshot(`badge-hint-tab-button-icon-bottom`));
});
});

test.describe(title('badge: hint inside button'), () => {
test('should not have visual regressions when icon is on the top', async ({ page }) => {
await page.goto('/src/components/badge/test/hint', config);

const container = page.locator('#button-top');

await expect(container).toHaveScreenshot(screenshot(`badge-hint-button-top`));
});

test('should not have visual regressions when icon is at the bottom', async ({ page }) => {
await page.goto('/src/components/badge/test/hint', config);

const container = page.locator('#button-bottom');

await expect(container).toHaveScreenshot(screenshot(`badge-hint-button-bottom`));
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions core/src/components/badge/test/hint/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,58 @@
</ion-tab-bar>
</div>
</ion-list>

<ion-list id="button-top">
<ion-list-header>
<ion-label> Inside Button - Top Placement </ion-label>
</ion-list-header>
<div class="ion-display-flex ion-align-items-center ion-justify-content-around ion-margin">
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="top"></ion-badge>
</ion-button>
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="top">1</ion-badge>
</ion-button>
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="top">99+</ion-badge>
</ion-button>
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="top">
<ion-icon name="star"></ion-icon>
</ion-badge>
</ion-button>
</div>
</ion-list>

<ion-list id="button-bottom">
<ion-list-header>
<ion-label> Inside Button - Bottom Placement </ion-label>
</ion-list-header>
<div class="ion-display-flex ion-align-items-center ion-justify-content-around ion-margin">
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="bottom"></ion-badge>
</ion-button>
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="bottom">1</ion-badge>
</ion-button>
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="bottom">99+</ion-badge>
</ion-button>
<ion-button fill="clear">
<ion-icon slot="icon-only" name="add"></ion-icon>
<ion-badge color="danger" size="small" vertical="bottom">
<ion-icon name="star"></ion-icon>
</ion-badge>
</ion-button>
</div>
</ion-list>
</ion-content>
</ion-app>
</body>
Expand Down
28 changes: 28 additions & 0 deletions core/src/components/button/button.common.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "../../themes/mixins";
@import "./button.vars";

// Button
Expand Down Expand Up @@ -306,3 +307,30 @@ ion-ripple-effect {
background: #{var(--ion-toolbar-color, var(--background))};
color: #{var(--ion-toolbar-background, var(--color))};
}

// Button Badge
// --------------------------------------------------

.button-native ion-ripple-effect,
.button-native::after {
@include border-radius(inherit);
}

// This rule works for Chrome.
:has(ion-badge) .button-native {
--overflow: visible;
}

// This rule works for the rest of the browsers.
:host(:has(ion-badge)) .button-native {
Comment on lines +319 to +325
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This rule works for Chrome.
:has(ion-badge) .button-native {
--overflow: visible;
}
// This rule works for the rest of the browsers.
:host(:has(ion-badge)) .button-native {
// This rule works for Chrome.
:has(ion-badge) .button-native,
// This rule works for the rest of the browsers.
:host(:has(ion-badge)) .button-native {

--overflow: visible;
}

:host ::slotted(ion-badge[vertical]:not(:empty)) {
@include padding($button-badge-padding);

display: flex;

align-items: center;
justify-content: center;
}
7 changes: 7 additions & 0 deletions core/src/components/button/button.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@
::slotted(ion-icon[slot="end"]) {
@include globals.margin(0, -0.2em, 0, 0.3em);
}

// Button Badge
// --------------------------------------------------

.button-native ::slotted(ion-badge) {
position: fixed;
}
3 changes: 3 additions & 0 deletions core/src/components/button/button.vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

// Button
// --------------------------------------------------

/// @prop - Badge padding inside button
$button-badge-padding: 2px;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading