From f16d9eaac95149fc3baa2333dae9eefd8012c2b7 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Mon, 13 May 2024 18:20:54 +0300 Subject: [PATCH] Fixed overlay badge visuals --- components/lib/badge/Badge.d.ts | 4 +- .../lib/badgedirective/BadgeDirective.js | 6 +-- doc/badge/PositionDoc.vue | 50 ++++++++++++++----- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/components/lib/badge/Badge.d.ts b/components/lib/badge/Badge.d.ts index 1d399cc8f..95b880b87 100644 --- a/components/lib/badge/Badge.d.ts +++ b/components/lib/badge/Badge.d.ts @@ -72,9 +72,9 @@ export interface BadgeProps { */ severity?: HintedString<'secondary' | 'info' | 'success' | 'warn' | 'danger' | 'contrast'> | null | undefined; /** - * Size of the badge, valid options are 'large' and 'xlarge'. + * Size of the badge, valid options are 'small', 'large', and 'xlarge'. */ - size?: 'large' | 'xlarge' | null | undefined; + size?: 'small' | 'large' | 'xlarge' | null | undefined; /** * It generates scoped CSS variables using design tokens for the component. */ diff --git a/components/lib/badgedirective/BadgeDirective.js b/components/lib/badgedirective/BadgeDirective.js index 1c325cf9c..918feb8bf 100644 --- a/components/lib/badgedirective/BadgeDirective.js +++ b/components/lib/badgedirective/BadgeDirective.js @@ -30,7 +30,7 @@ const BadgeDirective = BaseBadgeDirective.extend('badge', { badge.appendChild(document.createTextNode(el.$_badgeValue)); if (String(el.$_badgeValue).length === 1 && !this.isUnstyled()) { - !this.isUnstyled() && DomHandler.addClass(badge, 'p-badge-no-gutter'); + !this.isUnstyled() && DomHandler.addClass(badge, 'p-badge-circle'); } } else { !this.isUnstyled() && DomHandler.addClass(badge, 'p-badge-dot'); @@ -57,8 +57,8 @@ const BadgeDirective = BaseBadgeDirective.extend('badge', { if (el.$_badgeValue) { if (DomHandler.hasClass(badge, 'p-badge-dot')) DomHandler.removeClass(badge, 'p-badge-dot'); - if (el.$_badgeValue.length === 1) DomHandler.addClass(badge, 'p-badge-no-gutter'); - else DomHandler.removeClass(badge, 'p-badge-no-gutter'); + if (el.$_badgeValue.length === 1) DomHandler.addClass(badge, 'p-badge-circle'); + else DomHandler.removeClass(badge, 'p-badge-circle'); } else if (!el.$_badgeValue && !DomHandler.hasClass(badge, 'p-badge-dot')) { DomHandler.addClass(badge, 'p-badge-dot'); } diff --git a/doc/badge/PositionDoc.vue b/doc/badge/PositionDoc.vue index 48346b5e9..0e9c7a92f 100644 --- a/doc/badge/PositionDoc.vue +++ b/doc/badge/PositionDoc.vue @@ -1,11 +1,17 @@ @@ -16,16 +22,28 @@ export default { return { code: { basic: ` - - - + + + + + + + + + `, options: ` @@ -36,9 +54,15 @@ export default { composition: `