Skip to content

Commit b6ec080

Browse files
authored
Merge branch 'next' into ROU-11251
2 parents 23cbb08 + 715cc06 commit b6ec080

File tree

56 files changed

+302
-12
lines changed

Some content is hidden

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

56 files changed

+302
-12
lines changed

core/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ ion-badge,prop,mode,"ios" | "md",undefined,false,false
317317
ion-badge,prop,shape,"round | rectangular" | "soft" | undefined,undefined,false,false
318318
ion-badge,prop,size,"large" | "medium" | "small" | "xlarge" | "xsmall" | "xxsmall" | undefined,undefined,false,false
319319
ion-badge,prop,theme,"ios" | "md" | "ionic",undefined,false,false
320+
ion-badge,prop,vertical,"bottom" | "top" | undefined,undefined,false,false
320321
ion-badge,css-prop,--background,ionic
321322
ion-badge,css-prop,--background,ios
322323
ion-badge,css-prop,--background,md

core/src/components.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ export namespace Components {
334334
"mode"?: "ios" | "md";
335335
/**
336336
* Used to set focus on an element that uses `ion-focusable`. Do not use this if focusing the element as a result of a keyboard event as the focus utility should handle this for us. This method should be used when we want to programmatically focus an element as a result of another user action. (Ex: We focus the first element inside of a popover when the user presents it, but the popover is not always presented as a result of keyboard action.)
337+
* @param elements - The elements to set focus on.
337338
*/
338339
"setFocus": (elements: HTMLElement[]) => Promise<void>;
339340
/**
@@ -440,6 +441,10 @@ export namespace Components {
440441
* The theme determines the visual appearance of the component.
441442
*/
442443
"theme"?: "ios" | "md" | "ionic";
444+
/**
445+
* Set to `"top"` to position the badge on top right absolute position of the parent element. Set to `"bottom"` to position the badge on bottom right absolute position of the parent element.
446+
*/
447+
"vertical"?: 'top' | 'bottom';
443448
}
444449
interface IonBreadcrumb {
445450
/**
@@ -5808,6 +5813,10 @@ declare namespace LocalJSX {
58085813
* The theme determines the visual appearance of the component.
58095814
*/
58105815
"theme"?: "ios" | "md" | "ionic";
5816+
/**
5817+
* Set to `"top"` to position the badge on top right absolute position of the parent element. Set to `"bottom"` to position the badge on bottom right absolute position of the parent element.
5818+
*/
5819+
"vertical"?: 'top' | 'bottom';
58115820
}
58125821
interface IonBreadcrumb {
58135822
/**

core/src/components/app/app.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ComponentInterface } from '@stencil/core';
22
import { Component, Element, Host, Method, h } from '@stencil/core';
3-
import { getOrInitFocusVisibleUtility } from '@utils/focus-visible';
3+
import { focusElements } from '@utils/focus-visible';
44

55
import { config } from '../../global/config';
66
import { getIonTheme } from '../../global/ionic-global';
@@ -24,11 +24,16 @@ export class App implements ComponentInterface {
2424
* a result of another user action. (Ex: We focus the first element
2525
* inside of a popover when the user presents it, but the popover is not always
2626
* presented as a result of keyboard action.)
27+
*
28+
* @param elements - The elements to set focus on.
2729
*/
2830
@Method()
2931
async setFocus(elements: HTMLElement[]) {
30-
const focusVisible = getOrInitFocusVisibleUtility();
31-
focusVisible.setFocus(elements);
32+
/**
33+
* The focus-visible utility is used to set focus on an
34+
* element that uses `ion-focusable`.
35+
*/
36+
focusElements(elements);
3237
}
3338

3439
render() {

core/src/components/avatar/avatar.common.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
@include border-radius(var(--border-radius));
1111

1212
display: block;
13+
14+
position: relative;
1315
}
1416

1517
::slotted(ion-img),

core/src/components/avatar/avatar.ionic.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,22 @@
152152
width: globals.$ion-scale-1000;
153153
height: globals.$ion-scale-1000;
154154
}
155+
156+
// Avatar Empty Badge (hint)
157+
// --------------------------------------------------
158+
159+
:host ::slotted(ion-badge.badge-vertical-top:empty) {
160+
transform: translate(globals.$ion-scale-050, calc(globals.$ion-scale-050 * -1));
161+
}
162+
163+
:host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-top:empty) {
164+
transform: translate(globals.$ion-scale-100, calc(globals.$ion-scale-100 * -1));
165+
}
166+
167+
:host ::slotted(ion-badge.badge-vertical-bottom:empty) {
168+
transform: translate(0, globals.$ion-scale-100);
169+
}
170+
171+
:host(.avatar-xxsmall) ::slotted(ion-badge.badge-vertical-bottom:empty) {
172+
transform: translate(globals.$ion-scale-100, calc(globals.$ion-scale-100));
173+
}

core/src/components/avatar/avatar.md.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,14 @@
1010
width: $avatar-md-width;
1111
height: $avatar-md-height;
1212
}
13+
14+
// Avatar Empty Badge (hint)
15+
// --------------------------------------------------
16+
17+
::slotted(ion-badge.badge-vertical-top:empty) {
18+
transform: translate(-50%, 50%);
19+
}
20+
21+
::slotted(ion-badge.badge-vertical-bottom:empty) {
22+
transform: translateX(-100%);
23+
}

core/src/components/badge/badge.common.scss

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@
4848
color: #{color.current-color(contrast)};
4949
}
5050

51-
:host(:empty) {
52-
display: none;
51+
// Badge Empty (hint)
52+
// --------------------------------------------------
53+
54+
:host([vertical]) {
55+
@include position(null, 0, null, null);
56+
position: absolute;
57+
}
58+
59+
:host(:empty.badge-vertical-top) {
60+
top: 0;
61+
}
62+
63+
:host(:empty.badge-vertical-bottom) {
64+
bottom: 0;
5365
}

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,32 @@
145145
width: globals.$ion-scale-1000;
146146
height: globals.$ion-scale-1000;
147147
}
148+
149+
// Badge Empty
150+
// --------------------------------------------------
151+
152+
:host(:empty) {
153+
--padding-start: 0;
154+
--padding-end: 0;
155+
}
156+
157+
// Badge Sizes Empty
158+
// --------------------------------------------------
159+
160+
/* sm */
161+
:host(.badge-small:empty) {
162+
min-width: globals.$ion-scale-200;
163+
height: globals.$ion-scale-200;
164+
}
165+
166+
/* md */
167+
:host(.badge-medium:empty) {
168+
min-width: globals.$ion-scale-300;
169+
height: globals.$ion-scale-300;
170+
}
171+
172+
/* lg */
173+
:host(.badge-large:empty) {
174+
min-width: globals.$ion-scale-400;
175+
height: globals.$ion-scale-400;
176+
}

core/src/components/badge/badge.native.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@
1111

1212
font-family: $font-family-base;
1313
}
14+
15+
// TODO(ROU-10747): Review size styles when sizes are defined for native themes.
16+
:host(:empty) {
17+
--padding-start: 0;
18+
--padding-end: 0;
19+
--padding-bottom: 0;
20+
--padding-top: 0;
21+
22+
@include border-radius(999px);
23+
24+
width: $badge-min-width;
25+
height: $badge-min-width;
26+
}

core/src/components/badge/badge.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ export class Badge implements ComponentInterface {
4747
*/
4848
@Prop() size?: 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
4949

50+
/**
51+
* Set to `"top"` to position the badge on top right absolute position of the parent element.
52+
* Set to `"bottom"` to position the badge on bottom right absolute position of the parent element.
53+
*/
54+
@Prop() vertical?: 'top' | 'bottom';
55+
5056
private getShape(): string | undefined {
5157
const theme = getIonTheme(this);
5258
const { shape } = this;
@@ -89,6 +95,7 @@ export class Badge implements ComponentInterface {
8995
[theme]: true,
9096
[`badge-${shape}`]: shape !== undefined,
9197
[`badge-${size}`]: size !== undefined,
98+
[`badge-vertical-${this.vertical}`]: this.vertical !== undefined,
9299
})}
93100
>
94101
<slot></slot>

0 commit comments

Comments
 (0)