From 8c8b3f1853ab8972e8ee76c57599fa33b22ab9c6 Mon Sep 17 00:00:00 2001 From: lindsaym-fa Date: Tue, 23 Jan 2024 11:27:01 -0500 Subject: [PATCH 01/11] add custom properties to badge --- src/components/badge/badge.component.ts | 7 +++ src/components/badge/badge.styles.ts | 64 ++++++++++++++----------- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/src/components/badge/badge.component.ts b/src/components/badge/badge.component.ts index a1e56a2ed..53c967c99 100644 --- a/src/components/badge/badge.component.ts +++ b/src/components/badge/badge.component.ts @@ -14,6 +14,13 @@ import type { CSSResultGroup } from 'lit'; * @slot - The badge's content. * * @csspart base - The component's base wrapper. + * + * @cssproperty --background - The badge's background styles. + * @cssproperty --border-color - The color of the badge's border. + * @cssproperty --border-radius - The radius of the badge's corners. + * @cssproperty --border-style - The style of the badge's border. + * @cssproperty --border-width - The width of the badge's border. + * @cssproperty --content-color - The color of the badge's content. */ export default class WaBadge extends WebAwesomeElement { static styles: CSSResultGroup = styles; diff --git a/src/components/badge/badge.styles.ts b/src/components/badge/badge.styles.ts index e4ce52f43..978cbd687 100644 --- a/src/components/badge/badge.styles.ts +++ b/src/components/badge/badge.styles.ts @@ -5,9 +5,39 @@ export default css` ${componentStyles} :host { + --border-color: var(--wa-color-surface-default); + --border-radius: var(--wa-corners-xs); + --border-style: var(--wa-border-style); + --border-width: var(--wa-border-width-s); + display: inline-flex; } + :host([variant='brand']) { + --background: var(--wa-color-brand-spot); + --content-color: var(--wa-color-brand-text-on-spot); + } + + :host([variant='success']) { + --background: var(--wa-color-success-spot); + --content-color: var(--wa-color-success-text-on-spot); + } + + :host([variant='warning']) { + --background: var(--wa-color-warning-spot); + --content-color: var(--wa-color-warning-text-on-spot); + } + + :host([variant='neutral']) { + --background: var(--wa-color-neutral-spot); + --content-color: var(--wa-color-neutral-text-on-spot); + } + + :host([variant='danger']) { + --background: var(--wa-color-danger-spot); + --content-color: var(--wa-color-danger-text-on-spot); + } + .badge { display: inline-flex; align-items: center; @@ -15,8 +45,12 @@ export default css` font-size: max(12px, 0.75em); font-weight: var(--wa-font-weight-medium); line-height: 1; - border-radius: var(--wa-corners-xs); - border: solid 1px var(--wa-color-surface-default); + background: var(--background); + border-color: var(--border-color); + border-radius: var(--border-radius); + border-style: var(--border-style); + border-width: var(--border-width); + color: var(--content-color); white-space: nowrap; padding: 0.35em 0.6em; user-select: none; @@ -24,32 +58,6 @@ export default css` cursor: inherit; } - /* Variant modifiers */ - .badge--brand { - background-color: var(--wa-color-brand-spot); - color: var(--wa-color-brand-text-on-spot); - } - - .badge--success { - background-color: var(--wa-color-success-spot); - color: var(--wa-color-success-text-on-spot); - } - - .badge--neutral { - background-color: var(--wa-color-neutral-spot); - color: var(--wa-color-neutral-text-on-spot); - } - - .badge--warning { - background-color: var(--wa-color-warning-spot); - color: var(--wa-color-warning-text-on-spot); - } - - .badge--danger { - background-color: var(--wa-color-danger-spot); - color: var(--wa-color-danger-text-on-spot); - } - /* Pill modifier */ .badge--pill { border-radius: var(--wa-corners-pill); From 651eae8cb64cefb628479241b690b4fa6cb23d3e Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Wed, 24 Jan 2024 12:21:41 -0500 Subject: [PATCH 02/11] backport 1820 --- docs/pages/resources/changelog.md | 1 + src/components/option/option.component.ts | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index 46308231a..bbb2b6a86 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -32,6 +32,7 @@ New versions of Web Awesome are released as-needed and generally occur when a cr - Fixed a bug in `` and `` that made it work differently from `` and `