Updated accent-primary colors and added corresponding variant for button, callout, and link components.

This commit is contained in:
Ryan Clark
2026-11-13 15:57:34 -05:00
parent 892283f4f7
commit 1a0e617cb1
10 changed files with 72 additions and 5 deletions

View File

@@ -143,6 +143,20 @@ export const AllVariants: Story = {
<p class="tw-m-0" bitTypography="helper">subtleGhost</p>
</div>
</div>
<div class="tw-flex tw-gap-4">
<div class="tw-flex tw-flex-col tw-items-center tw-gap-2">
<button buttonType="accentPrimary" bitButton ${formatArgsForCodeSnippet<ButtonComponent>(args)}>Button</button>
<p class="tw-m-0" bitTypography="helper">accentPrimary</p>
</div>
<div class="tw-flex tw-flex-col tw-items-center tw-gap-2">
<button buttonType="accentPrimaryOutline" bitButton ${formatArgsForCodeSnippet<ButtonComponent>(args)}>Button</button>
<p class="tw-m-0" bitTypography="helper">accentPrimaryOutline</p>
</div>
<div class="tw-flex tw-flex-col tw-items-center tw-gap-2">
<button buttonType="accentPrimaryGhost" bitButton ${formatArgsForCodeSnippet<ButtonComponent>(args)}>Button</button>
<p class="tw-m-0" bitTypography="helper">accentPrimaryGhost</p>
</div>
</div>
<div class="tw-flex tw-gap-4">
<div class="tw-flex tw-flex-col tw-items-center tw-gap-2">
<button buttonType="danger" bitButton ${formatArgsForCodeSnippet<ButtonComponent>(args)}>Button</button>

View File

@@ -10,7 +10,7 @@ import { IconButtonModule } from "../icon-button";
import { BitwardenIcon } from "../shared/icon";
import { TypographyModule } from "../typography";
export type CalloutTypes = "success" | "info" | "warning" | "danger" | "subtle";
export type CalloutTypes = "success" | "info" | "warning" | "danger" | "subtle" | "accent-primary";
const defaultIcon: Record<CalloutTypes, BitwardenIcon> = {
success: "bwi-check-circle",
@@ -18,6 +18,7 @@ const defaultIcon: Record<CalloutTypes, BitwardenIcon> = {
warning: "bwi-exclamation-triangle",
danger: "bwi-error",
subtle: "bwi-info-circle",
"accent-primary": "bwi-info-circle",
};
const defaultI18n: Partial<Record<CalloutTypes, string>> = {
@@ -104,6 +105,8 @@ export class CalloutComponent implements OnInit {
return "tw-bg-bg-warning-soft tw-border-border-warning-soft";
case "subtle":
return "tw-bg-bg-secondary tw-border-border-base";
case "accent-primary":
return "tw-bg-bg-accent-primary-soft tw-border-border-accent-primary-soft";
}
});
@@ -119,6 +122,8 @@ export class CalloutComponent implements OnInit {
return "!tw-text-fg-warning-strong";
case "subtle":
return "!tw-text-fg-heading";
case "accent-primary":
return "!tw-text-fg-accent-primary-strong";
}
});

View File

@@ -77,6 +77,12 @@ not reversible.
The danger callout can also be used to alert the user of an error or errors, such as a server side
errors after form submit or failed communication request.
### Accent Primary
Use the accent primary callout to highlight teal-accented content, such as premium feature
promotions or contextual upsells that should stand out without implying a status (success, warning,
or danger).
## Icons
A custom icon can be passed in. Otherwise, the icon will default to the icon corresponding to the

View File

@@ -64,6 +64,7 @@ export const AllVariants: Story = {
<bit-callout type="warning" title="Warning">${calloutContent}</bit-callout>
<bit-callout type="danger" title="Danger">${calloutContent}</bit-callout>
<bit-callout type="subtle" title="Subtle">${calloutContent}</bit-callout>
<bit-callout type="accent-primary" title="Accent Primary">${calloutContent}</bit-callout>
</div>
`,
}),

View File

@@ -21,6 +21,7 @@ export const LinkTypes = [
"success",
"warning",
"danger",
"accent-primary",
] as const;
export type LinkType = (typeof LinkTypes)[number];
@@ -65,6 +66,11 @@ const linkStyles: Record<LinkType, string[]> = {
"focus-visible:tw-text-fg-contrast-strong",
"focus-visible:before:tw-ring-fg-contrast",
],
"accent-primary": [
"tw-text-fg-accent-primary",
"hover:tw-text-fg-accent-primary-strong",
"focus-visible:tw-text-fg-accent-primary-strong",
],
};
const commonStyles = [

View File

@@ -35,6 +35,7 @@ You can use one of the following variants by providing it as the `linkType` inpu
- `warning` - used in association with warning callouts/banners
- `success` - used in association with success callouts/banners
- `danger` - used in association with danger callouts/banners
- `accent-primary` - teal-accented, used in association with accent-primary callouts/banners
## Sizes

View File

@@ -164,6 +164,31 @@ export const getButtonColorStyles = ({
"aria-expanded:tw-text-fg-success-strong",
"focus-visible:tw-text-fg-success-strong",
],
accentPrimary: [
"tw-border-border-accent-primary-strong",
"tw-bg-bg-accent-primary-strong",
"hover:tw-bg-bg-accent-primary-stronger",
"hover:tw-border-border-accent-primary-stronger",
"aria-expanded:tw-bg-bg-accent-primary-stronger",
"aria-expanded:tw-border-border-accent-primary-stronger",
"focus-visible:tw-bg-bg-accent-primary-stronger",
"focus-visible:tw-border-border-accent-primary-stronger",
],
accentPrimaryOutline: [
"tw-border-border-accent-primary",
"tw-text-fg-accent-primary",
"hover:tw-border-border-accent-primary-strong",
"hover:tw-text-fg-accent-primary-strong",
"aria-expanded:tw-border-border-accent-primary-strong",
"aria-expanded:tw-text-fg-accent-primary-strong",
"focus-visible:tw-text-fg-accent-primary-strong",
],
accentPrimaryGhost: [
"tw-text-fg-accent-primary",
"hover:tw-text-fg-accent-primary-strong",
"aria-expanded:tw-text-fg-accent-primary-strong",
"focus-visible:tw-text-fg-accent-primary-strong",
],
contrast: [
"tw-text-fg-heading",
"tw-bg-bg-primary",

View File

@@ -17,6 +17,9 @@ export const ButtonTypes = {
Success: "success",
SuccessOutline: "successOutline",
SuccessGhost: "successGhost",
AccentPrimary: "accentPrimary",
AccentPrimaryOutline: "accentPrimaryOutline",
AccentPrimaryGhost: "accentPrimaryGhost",
Contrast: "contrast",
ContrastOutline: "contrastOutline",
ContrastGhost: "contrastGhost",

View File

@@ -265,7 +265,7 @@
/* Accent Foreground */
--color-fg-accent-primary-soft: var(--color-teal-200);
--color-fg-accent-primary: var(--color-teal-400);
--color-fg-accent-primary: var(--color-teal-700);
--color-fg-accent-primary-strong: var(--color-teal-800);
--color-fg-accent-secondary-soft: var(--color-coral-200);
--color-fg-accent-secondary: var(--color-coral-400);
@@ -323,6 +323,7 @@
--color-bg-accent-primary-medium: var(--color-teal-100);
--color-bg-accent-primary: var(--color-teal-400);
--color-bg-accent-primary-strong: var(--color-teal-700);
--color-bg-accent-primary-stronger: var(--color-teal-800);
--color-bg-accent-secondary-soft: var(--color-coral-050);
--color-bg-accent-secondary-medium: var(--color-coral-100);
--color-bg-accent-secondary: var(--color-coral-400);
@@ -439,7 +440,8 @@
/* Accent Border */
--color-border-accent-primary-soft: var(--color-teal-200);
--color-border-accent-primary: var(--color-teal-600);
--color-border-accent-primary: var(--color-teal-700);
--color-border-accent-primary-strong: var(--color-teal-800);
--color-border-accent-secondary-soft: var(--color-coral-200);
--color-border-accent-secondary: var(--color-coral-600);
--color-border-accent-tertiary-soft: var(--color-purple-200);
@@ -580,7 +582,7 @@
/* Accent Foreground */
--color-fg-accent-primary-soft: var(--color-teal-400);
--color-fg-accent-primary: var(--color-teal-300);
--color-fg-accent-primary-strong: var(--color-teal-100);
--color-fg-accent-primary-strong: var(--color-teal-200);
--color-fg-accent-secondary-soft: var(--color-coral-500);
--color-fg-accent-secondary: var(--color-coral-400);
--color-fg-accent-secondary-strong: var(--color-coral-100);
@@ -634,7 +636,8 @@
--color-bg-accent-primary-soft: var(--color-teal-950);
--color-bg-accent-primary-medium: var(--color-teal-900);
--color-bg-accent-primary: var(--color-teal-400);
--color-bg-accent-primary-strong: var(--color-teal-200);
--color-bg-accent-primary-strong: var(--color-teal-300);
--color-bg-accent-primary-stronger: var(--color-teal-200);
--color-bg-accent-secondary-soft: var(--color-coral-950);
--color-bg-accent-secondary-medium: var(--color-coral-900);
--color-bg-accent-secondary: var(--color-coral-400);
@@ -749,6 +752,8 @@
/* Accent Border */
--color-border-accent-primary-soft: var(--color-teal-800);
--color-border-accent-primary: var(--color-teal-300);
--color-border-accent-primary-strong: var(--color-teal-200);
--color-border-accent-secondary-soft: var(--color-coral-800);
--color-border-accent-secondary: var(--color-coral-500);
--color-border-accent-tertiary-soft: var(--color-purple-800);

View File

@@ -127,6 +127,7 @@ module.exports = {
"accent-primary-soft": "var(--color-bg-accent-primary-soft)",
"accent-primary-medium": "var(--color-bg-accent-primary-medium)",
"accent-primary-strong": "var(--color-bg-accent-primary-strong)",
"accent-primary-stronger": "var(--color-bg-accent-primary-stronger)",
"accent-primary": "var(--color-bg-accent-primary)",
"accent-secondary-soft": "var(--color-bg-accent-secondary-soft)",
"accent-secondary-medium": "var(--color-bg-accent-secondary-medium)",