diff --git a/CHANGELOG.md b/CHANGELOG.md
index 97afd0b7..43c46ff1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- `readOnly` appearance uses same borders like read-only text fields and it does not display a blinking cursor
- ` `, ` `
- outlines for focus by keyboard navigation are better recognizable on buttons with colored backgrounds (intent states)
+- ` `
+ - given `popoverClassName` is added
### Changed
@@ -38,6 +40,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- `Toaster.create` is now an async function
- ` `
- by default, if no searchPredicate or searchListPredicate is defined, the filtering is done via case-insensitive multi-word filtering.
+- ` `, ` `, `
`, ` `, ` `, ` `
+ - color for `intent="primary"` was changed to our brand color
+ - new option `accent` for `intent` uses the accent color
+- ` `, ``
+ - switch primary and accent colors
### Deprecated
diff --git a/src/components/Form/form.scss b/src/components/Form/form.scss
index 9e7ace70..553a5731 100644
--- a/src/components/Form/form.scss
+++ b/src/components/Form/form.scss
@@ -56,6 +56,9 @@ form {
.#{$eccgui}-fielditem__message {
&.#{$eccgui}-intent--primary {
+ color: $eccgui-color-primary;
+ }
+ &.#{$eccgui}-intent--accent {
color: $eccgui-color-accent;
}
&.#{$eccgui}-intent--success {
@@ -89,11 +92,20 @@ form {
&.#{$eccgui}-intent--primary {
&.#{$eccgui}-fieldset--boxed {
- background-color: $eccgui-color-info-background;
+ background-color: $eccgui-color-primary-contrast;
+ }
+ .#{$eccgui}-fieldset__message,
+ legend {
+ color: $eccgui-color-primary;
+ }
+ }
+ &.#{$eccgui}-intent--accent {
+ &.#{$eccgui}-fieldset--boxed {
+ background-color: $eccgui-color-accent-contrast;
}
.#{$eccgui}-fieldset__message,
legend {
- color: $eccgui-color-info-text;
+ color: $eccgui-color-accent;
}
}
&.#{$eccgui}-intent--success {
diff --git a/src/components/Menu/MenuItem.test.tsx b/src/components/Menu/MenuItem.test.tsx
new file mode 100644
index 00000000..6f72a0b6
--- /dev/null
+++ b/src/components/Menu/MenuItem.test.tsx
@@ -0,0 +1,25 @@
+import React from "react";
+import { Classes as BlueprintClasses } from "@blueprintjs/core";
+import { render } from "@testing-library/react";
+
+import "@testing-library/jest-dom";
+
+import { MenuItem } from "../../../index";
+import { CLASSPREFIX as eccgui } from "../../configuration/constants";
+
+describe("MenuItem", () => {
+ it("should not apply an intent class when intent is undefined", () => {
+ const { container } = render( );
+ const menuItem = container.querySelector(`.${eccgui}-menu__item`);
+ expect(menuItem).not.toBeNull();
+ expect((menuItem as HTMLElement).className).not.toMatch(
+ new RegExp(`${BlueprintClasses.getClassNamespace()}-intent-`),
+ );
+ });
+ it("should apply the intent class for the custom accent intent", () => {
+ const { container } = render( );
+ const menuItem = container.querySelector(`.${eccgui}-menu__item`);
+ expect(menuItem).not.toBeNull();
+ expect(menuItem).toHaveClass(`${BlueprintClasses.getClassNamespace()}-intent-accent`);
+ });
+});
diff --git a/src/components/Menu/MenuItem.tsx b/src/components/Menu/MenuItem.tsx
index 0b18e9cf..bed6fa6a 100644
--- a/src/components/Menu/MenuItem.tsx
+++ b/src/components/Menu/MenuItem.tsx
@@ -1,5 +1,10 @@
import React from "react";
-import { MenuItem as BlueprintMenuItem, MenuItemProps as BlueprintMenuItemProps } from "@blueprintjs/core";
+import {
+ Classes as BlueprintClasses,
+ MenuItem as BlueprintMenuItem,
+ MenuItemProps as BlueprintMenuItemProps,
+} from "@blueprintjs/core";
+import classNames from "classnames";
import { openInNewTab } from "../../common/utils/openInNewTab";
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
@@ -11,10 +16,10 @@ import { TestIconProps } from "./../Icon/TestIcon";
export interface MenuItemProps
extends
- Omit,
+ Omit,
Omit, "onClick" | "onFocus" | "target" | "children"> {
- /*
- * If set the icon is diplayed on the left side of the menu item.
+ /**
+ * If set the icon is displayed on the left side of the menu item.
*/
icon?: ValidIconName | string[] | React.ReactElement;
/**
@@ -25,6 +30,10 @@ export interface MenuItemProps
* Tooltip, but only added to the label, not to the full menu item.
*/
tooltip?: string | React.JSX.Element;
+ /**
+ * Visual intent color to apply to element.
+ */
+ intent?: BlueprintMenuItemProps["intent"] | "accent";
}
/**
@@ -38,6 +47,7 @@ export const MenuItem = ({
href,
text,
tooltip,
+ intent,
...restProps
}: MenuItemProps) => {
return (
@@ -56,7 +66,10 @@ export const MenuItem = ({
onClick={(e: React.MouseEvent) =>
openInNewTab(e as React.MouseEvent, onClick, href)
}
- className={`${eccgui}-menu__item ` + className}
+ className={classNames(`${eccgui}-menu__item`, className, {
+ // control blueprint intent classes to enhance it by new options
+ [`${BlueprintClasses.getClassNamespace()}-intent-${intent}`]: intent,
+ })}
icon={icon ? typeof icon === "string" || Array.isArray(icon) ? : icon : false}
>
{children ?? null}
diff --git a/src/components/Menu/Stories/MenuItem.stories.tsx b/src/components/Menu/Stories/MenuItem.stories.tsx
index a66422a3..f7e9e121 100644
--- a/src/components/Menu/Stories/MenuItem.stories.tsx
+++ b/src/components/Menu/Stories/MenuItem.stories.tsx
@@ -3,6 +3,7 @@ import { OverlaysProvider } from "@blueprintjs/core";
import { LogoReact } from "@carbon/icons-react";
import { Meta, StoryFn } from "@storybook/react";
+import { helpersArgTypes } from "../../../../.storybook/helpers";
import { Menu, MenuItem, TestIcon } from "../../../components";
import canonicalIcons from "./../../Icon/canonicalIconNames";
@@ -19,6 +20,10 @@ export default {
...Object.keys(canonicalIcons),
},
},
+ intent: {
+ ...helpersArgTypes.exampleIntent,
+ options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
+ },
},
} as Meta;
diff --git a/src/components/Menu/menu.scss b/src/components/Menu/menu.scss
index a7cfae7c..5dde963a 100644
--- a/src/components/Menu/menu.scss
+++ b/src/components/Menu/menu.scss
@@ -68,3 +68,51 @@ span.#{$ns}-menu-item-icon:empty {
}
}
}
+
+.#{$ns}-menu-item {
+ @each $intent in ("primary", "accent") {
+ $colorrange: $intent;
+
+ @if $intent == "primary" {
+ $colorrange: "brand";
+ }
+
+ @include menu-item-intent(
+ $intent,
+ false,
+ eccgui-color-var("identity", $colorrange, "300"),
+ eccgui-color-var("identity", $colorrange, "700"),
+ eccgui-color-var("identity", $colorrange, "900")
+ );
+ }
+}
+
+.#{$ns}-submenu {
+ .#{$ns}-popover-target {
+ &.#{$ns}-popover-open > .#{$ns}-menu-item {
+ &[class*="#{$ns}-intent-"] {
+ &,
+ &:hover,
+ &:active {
+ @each $intent in ("primary", "accent") {
+ $colorrange: $intent;
+
+ @if $intent == "primary" {
+ $colorrange: "brand";
+ }
+ &.#{$ns}-intent-#{$intent} {
+ color: eccgui-color-var("identity", $colorrange, "700");
+ background-color: rgba(eccgui-color-var("identity", $colorrange, "300"), 0.1);
+
+ &::before,
+ .#{$ns}-menu-item-icon,
+ .#{$ns}-submenu-icon {
+ color: inherit;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/components/MultiSelect/MultiSelect.tsx b/src/components/MultiSelect/MultiSelect.tsx
index 0ffcfb09..4ee74264 100644
--- a/src/components/MultiSelect/MultiSelect.tsx
+++ b/src/components/MultiSelect/MultiSelect.tsx
@@ -5,6 +5,7 @@ import {
MultiSelect as BlueprintMultiSelect,
MultiSelectProps as BlueprintMultiSelectProps,
} from "@blueprintjs/select";
+import classNames from "classnames";
import { removeExtraSpaces } from "../../common/utils/stringUtils";
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
@@ -96,7 +97,7 @@ export interface MultiSuggestFieldCommonProps
/**
* Intent state of the multi select.
*/
- intent?: BlueprintIntent;
+ intent?: BlueprintIntent | "accent";
/**
* Disables the input element
*/
@@ -555,10 +556,12 @@ export function MultiSuggestField({
"data-testid": dataTestid ? dataTestid + "_searchinput" : undefined,
...inputProps,
} as React.InputHTMLAttributes,
- className: `${eccgui}-multisuggestfield ${eccgui}-multiselect` + (className ? ` ${className}` : ""),
+ className: classNames(`${eccgui}-multisuggestfield`, `${eccgui}-multiselect`, className, {
+ [`${eccgui}-intent--${intent}`]: intent === "accent",
+ }),
fill: fullWidth,
inputRef: inputRef,
- intent: intent,
+ intent: intent && intent !== "accent" ? intent : undefined,
addOnBlur: true,
onKeyDown: handleOnKeyDown,
onKeyUp: handleOnKeyUp,
diff --git a/src/components/MultiSuggestField/MultiSuggestField.stories.tsx b/src/components/MultiSuggestField/MultiSuggestField.stories.tsx
index 02865445..5a6b97be 100644
--- a/src/components/MultiSuggestField/MultiSuggestField.stories.tsx
+++ b/src/components/MultiSuggestField/MultiSuggestField.stories.tsx
@@ -35,7 +35,7 @@ export default {
},
intent: {
...helpersArgTypes.exampleIntent,
- options: ["UNDEFINED", "primary", "success", "warning", "danger"],
+ options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
},
},
args: {
diff --git a/src/components/MultiSuggestField/_multisuggestfield.scss b/src/components/MultiSuggestField/_multisuggestfield.scss
index 98196b42..ae0f5a35 100644
--- a/src/components/MultiSuggestField/_multisuggestfield.scss
+++ b/src/components/MultiSuggestField/_multisuggestfield.scss
@@ -10,6 +10,14 @@
.#{$eccgui}-multisuggestfield {
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-accent};
+ &.#{$ns}-intent-primary {
+ @include pt-input-intent(eccgui-color-var("identity", "brand", "900"));
+
+ --#{$eccgui}-a11y-outline-color: #{$eccgui-color-primary};
+ }
+ &.#{$eccgui}-intent--accent {
+ @include pt-input-intent(eccgui-color-var("identity", "accent", "900"));
+ }
&.#{$ns}-intent-success {
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-success-text};
}
diff --git a/src/components/ProgressBar/ProgressBar.test.tsx b/src/components/ProgressBar/ProgressBar.test.tsx
new file mode 100644
index 00000000..63ff05fc
--- /dev/null
+++ b/src/components/ProgressBar/ProgressBar.test.tsx
@@ -0,0 +1,28 @@
+import React from "react";
+import { render } from "@testing-library/react";
+
+import "@testing-library/jest-dom";
+
+import { ProgressBar } from "../../../index";
+import { CLASSPREFIX as eccgui } from "../../configuration/constants";
+
+describe("ProgressBar", () => {
+ it("should not apply an intent class when no intent is set", () => {
+ const { container } = render( );
+ const progressbar = container.querySelector(`.${eccgui}-progressbar`);
+ expect(progressbar).not.toBeNull();
+ expect((progressbar as HTMLElement).className).not.toMatch(new RegExp(`${eccgui}-progressbar-intent-`));
+ });
+ it("should apply the matching intent class for a blueprint intent", () => {
+ const { container } = render( );
+ const progressbar = container.querySelector(`.${eccgui}-progressbar`);
+ expect(progressbar).not.toBeNull();
+ expect(progressbar).toHaveClass(`${eccgui}-progressbar-intent-success`);
+ });
+ it("should apply the intent class for the custom accent intent", () => {
+ const { container } = render( );
+ const progressbar = container.querySelector(`.${eccgui}-progressbar`);
+ expect(progressbar).not.toBeNull();
+ expect(progressbar).toHaveClass(`${eccgui}-progressbar-intent-accent`);
+ });
+});
diff --git a/src/components/ProgressBar/ProgressBar.tsx b/src/components/ProgressBar/ProgressBar.tsx
index 6111e98f..f7864ec4 100644
--- a/src/components/ProgressBar/ProgressBar.tsx
+++ b/src/components/ProgressBar/ProgressBar.tsx
@@ -1,5 +1,25 @@
+import React from "react";
import { ProgressBar as BlueprintProgressBar, ProgressBarProps as BlueprintProgressBarProps } from "@blueprintjs/core";
+import classNames from "classnames";
-// we currently do not apply changes or additions
-export const ProgressBar = BlueprintProgressBar;
-export type ProgressBarProps = BlueprintProgressBarProps;
+import { CLASSPREFIX as eccgui } from "../../configuration/constants";
+
+export interface ProgressBarProps extends Omit {
+ /**
+ * Visual intent color to apply to element.
+ */
+ intent?: BlueprintProgressBarProps["intent"] | "accent";
+}
+
+export const ProgressBar = ({ className, intent, ...otherProps }: ProgressBarProps) => {
+ return (
+
+ );
+};
+
+export default ProgressBar;
diff --git a/src/components/ProgressBar/Stories/ProgressBar.stories.tsx b/src/components/ProgressBar/Stories/ProgressBar.stories.tsx
index f180cc13..e00f5d98 100644
--- a/src/components/ProgressBar/Stories/ProgressBar.stories.tsx
+++ b/src/components/ProgressBar/Stories/ProgressBar.stories.tsx
@@ -9,7 +9,7 @@ export default {
argTypes: {
intent: {
...helpersArgTypes.exampleIntent,
- options: ["UNDEFINED", "primary", "success", "warning", "danger"],
+ options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
},
},
} as Meta;
diff --git a/src/components/ProgressBar/progressbar.scss b/src/components/ProgressBar/progressbar.scss
new file mode 100644
index 00000000..e3d3839c
--- /dev/null
+++ b/src/components/ProgressBar/progressbar.scss
@@ -0,0 +1,20 @@
+// lib import
+@import "~@blueprintjs/core/src/components/progress-bar/progress-bar";
+
+.#{$ns}-progress-meter {
+ .#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-primary & {
+ background-color: $eccgui-color-primary;
+ }
+ .#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-accent & {
+ background-color: $eccgui-color-accent;
+ }
+ .#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-danger & {
+ background-color: $eccgui-color-danger-text;
+ }
+ .#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-warning & {
+ background-color: $eccgui-color-warning-text;
+ }
+ .#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-success & {
+ background-color: $eccgui-color-success-text;
+ }
+}
diff --git a/src/components/TextField/TextArea.tsx b/src/components/TextField/TextArea.tsx
index 35b11794..c97fed0c 100644
--- a/src/components/TextField/TextArea.tsx
+++ b/src/components/TextField/TextArea.tsx
@@ -154,7 +154,7 @@ export const TextArea = ({
(className ? ` ${className}` : "")
}
intent={
- intent && !["info", "edited", "removed", "neutral"].includes(intent)
+ intent && !["info", "edited", "removed", "neutral", "accent"].includes(intent)
? (intent as BlueprintIntent)
: undefined
}
diff --git a/src/components/TextField/TextField.tsx b/src/components/TextField/TextField.tsx
index bf5adb05..98a1c822 100644
--- a/src/components/TextField/TextField.tsx
+++ b/src/components/TextField/TextField.tsx
@@ -107,7 +107,7 @@ export const TextField = ({
(className ? ` ${className}` : "")
}
intent={
- intent && !["info", "edited", "removed", "neutral"].includes(intent)
+ intent && !["info", "edited", "removed", "neutral", "accent"].includes(intent)
? (intent as BlueprintIntent)
: undefined
}
diff --git a/src/components/TextField/textfield.scss b/src/components/TextField/textfield.scss
index 9bfd961e..ac0ed8e0 100644
--- a/src/components/TextField/textfield.scss
+++ b/src/components/TextField/textfield.scss
@@ -76,30 +76,38 @@ $input-button-height-small: math.div($eccgui-size-textfield-height-small, $eccgu
// enhancements
$eccgui-map-intent-bgcolors: (
- "primary": $eccgui-color-info-background,
+ "primary": $eccgui-color-primary-contrast,
"success": $eccgui-color-success-background,
"warning": $eccgui-color-warning-background,
"danger": $eccgui-color-danger-background,
);
-@mixin intent-state-flash-animation($state, $bgcolor, $mixratio: 24%) {
+@mixin intent-state-flash-animation($state, $group, $tint) {
@keyframes intent-state-flash-#{$state} {
0% {
- background-color: eccgui-color-var("semantic", $state, "100");
+ background-color: eccgui-color-var($group, $tint, "100");
}
39% {
- background-color: eccgui-color-var("semantic", $state, "300");
+ background-color: eccgui-color-var($group, $tint, "300");
}
100% {
- background-color: eccgui-color-var("semantic", $state, "100");
+ background-color: eccgui-color-var($group, $tint, "100");
}
}
}
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
- @include intent-state-flash-animation($each-intent, $each-bgcolor);
+ $group: "semantic";
+ $tint: $each-intent;
+
+ @if $each-intent == "primary" {
+ $group: "identity";
+ $tint: "brand";
+ }
+
+ @include intent-state-flash-animation($each-intent, $group, $tint);
}
.#{$ns}-input {
@@ -111,11 +119,19 @@ $eccgui-map-intent-bgcolors: (
}
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
+ $group: "semantic";
+ $tint: $each-intent;
+
+ @if $each-intent == "primary" {
+ $group: "identity";
+ $tint: "brand";
+ }
.#{$ns}-input-group.#{$ns}-intent-#{$each-intent} & {
- background-color: eccgui-color-var("semantic", $each-intent, "100");
+ @include pt-input-intent(eccgui-color-var($group, $tint, "900"));
- --#{$eccgui}-a11y-outline-color: eccgui-color-var("semantic", $each-intent, "900");
+ --#{$eccgui}-a11y-outline-color: #{eccgui-color-var($group, $tint, "900")};
+ background-color: eccgui-color-var($group, $tint, "100");
animation-name: intent-state-flash-#{$each-intent};
}
}
@@ -127,9 +143,13 @@ $eccgui-map-intent-bgcolors: (
}
.#{$ns}-input-group.#{$eccgui}-intent--accent & {
- @include pt-input-intent($eccgui-color-primary);
+ @include pt-input-intent($eccgui-color-accent);
+ @include intent-state-flash-animation("accent", "identity", "accent");
- --#{$eccgui}-a11y-outline-color: #{$eccgui-color-primary};
+ background-color: eccgui-color-var("identity", "accent", "100");
+ animation-name: intent-state-flash-accent;
+
+ --#{$eccgui}-a11y-outline-color: #{$eccgui-color-accent};
}
.#{$ns}-input-group.#{$eccgui}-intent--neutral & {
@@ -162,11 +182,19 @@ $eccgui-map-intent-bgcolors: (
}
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
+ $group: "semantic";
+ $tint: $each-intent;
+
+ @if $each-intent == "primary" {
+ $group: "identity";
+ $tint: "brand";
+ }
&.#{$eccgui}-intent--#{$each-intent} {
- background-color: eccgui-color-var("semantic", $each-intent, "100");
+ @include pt-input-intent(eccgui-color-var($group, $tint, "900"));
- --#{$eccgui}-a11y-outline-color: eccgui-color-var("semantic", $each-intent, "900");
+ --#{$eccgui}-a11y-outline-color: #{eccgui-color-var($group, $tint, "900")};
+ background-color: eccgui-color-var($group, $tint, "100");
animation-name: intent-state-flash-#{$each-intent};
}
}
@@ -178,9 +206,13 @@ $eccgui-map-intent-bgcolors: (
}
&.#{$eccgui}-intent--accent {
- @include pt-input-intent($eccgui-color-primary);
+ @include pt-input-intent($eccgui-color-accent);
+ @include intent-state-flash-animation("accent", "identity", "accent");
+
+ background-color: eccgui-color-var("identity", "accent", "100");
+ animation-name: intent-state-flash-accent;
- --#{$eccgui}-a11y-outline-color: #{$eccgui-color-primary};
+ --#{$eccgui}-a11y-outline-color: #{$eccgui-color-accent};
}
&.#{$eccgui}-intent--neutral {
diff --git a/src/components/Tooltip/Tooltip.stories.tsx b/src/components/Tooltip/Tooltip.stories.tsx
index eab7c3fd..a7baf014 100644
--- a/src/components/Tooltip/Tooltip.stories.tsx
+++ b/src/components/Tooltip/Tooltip.stories.tsx
@@ -4,12 +4,18 @@ import { OverlaysProvider } from "@blueprintjs/core";
import { Meta, StoryFn } from "@storybook/react";
import { fn } from "storybook/test";
+import { helpersArgTypes } from "../../../.storybook/helpers";
import { Tooltip } from "../../index";
export default {
title: "Components/Tooltip",
component: Tooltip,
- argTypes: {},
+ argTypes: {
+ intent: {
+ ...helpersArgTypes.exampleIntent,
+ options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
+ },
+ },
} as Meta;
let forcedUpdateKey = 0; // @see https://github.com/storybookjs/storybook/issues/13375#issuecomment-1291011856
diff --git a/src/components/Tooltip/Tooltip.test.tsx b/src/components/Tooltip/Tooltip.test.tsx
index 79429c68..6edc9050 100644
--- a/src/components/Tooltip/Tooltip.test.tsx
+++ b/src/components/Tooltip/Tooltip.test.tsx
@@ -95,4 +95,20 @@ describe("Tooltip", () => {
});
expect(await screen.findByText(TooltipStory.args.content as string)).toBeVisible();
});
+ it("should not apply the accent intent class when intent is undefined", () => {
+ render(
+
+ target
+ ,
+ );
+ expect(document.querySelectorAll(`.${eccgui}-intent--accent`)).toHaveLength(0);
+ });
+ it("should apply the accent intent class for the custom accent intent", () => {
+ render(
+
+ target
+ ,
+ );
+ expect(document.querySelectorAll(`.${eccgui}-intent--accent`)).toHaveLength(1);
+ });
});
diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx
index 03a3b62c..f9b3a06a 100644
--- a/src/components/Tooltip/Tooltip.tsx
+++ b/src/components/Tooltip/Tooltip.tsx
@@ -5,12 +5,13 @@ import {
TooltipProps as BlueprintTooltipProps,
Utils as BlueprintUtils,
} from "@blueprintjs/core";
+import classNames from "classnames";
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
import { Markdown, MarkdownProps } from "./../../cmem/markdown/Markdown";
-export interface TooltipProps extends Omit {
+export interface TooltipProps extends Omit {
/**
* Add dotted underline as visual indication to the target that a tooltip is attached.
* Should be used together with text-only elements.
@@ -48,6 +49,10 @@ export interface TooltipProps extends Omit {
* For the first display of the tooltip this time adds up to `hoverOpenDelay`.
*/
swapPlaceholderDelay?: number;
+ /**
+ * Intent state of the tooltip.
+ */
+ intent?: BlueprintTooltipProps["intent"] | "accent";
}
export type TooltipSize = "small" | "medium" | "large";
@@ -63,6 +68,8 @@ export const Tooltip = ({
usePlaceholder,
swapPlaceholderDelay = 100,
hoverOpenDelay = 450,
+ popoverClassName,
+ intent,
...otherTooltipProps
}: TooltipProps) => {
const placeholderRef = React.useRef(null);
@@ -197,9 +204,15 @@ export const Tooltip = ({
content={tooltipContent}
className={targetClassName}
popoverClassName={
- `${eccgui}-tooltip__content` +
- ` ${eccgui}-tooltip--${size}` +
- (className ? " " + className + "__content" : "")
+ classNames(
+ `${eccgui}-tooltip__content`,
+ `${eccgui}-tooltip--${size}`,
+ popoverClassName,
+ {
+ [`${className}__content`]: className,
+ [`${eccgui}-intent--${intent}`]: intent === "accent",
+ }
+ )
}
ref={refocus}
targetProps={
@@ -211,6 +224,7 @@ export const Tooltip = ({
: undefined,
} as React.HTMLProps
}
+ intent={intent && intent !== "accent" ? intent : undefined}
>
{children}
diff --git a/src/components/Tooltip/tooltip.scss b/src/components/Tooltip/tooltip.scss
index 3e9678be..3bbd4b05 100644
--- a/src/components/Tooltip/tooltip.scss
+++ b/src/components/Tooltip/tooltip.scss
@@ -38,6 +38,7 @@ $tooltip-padding-horizontal: $eccgui-size-block-whitespace * 0.5; // !default;
}
.#{$eccgui}-tooltip__content {
+
a {
color: inherit;
text-decoration: none;
@@ -66,3 +67,23 @@ $tooltip-padding-horizontal: $eccgui-size-block-whitespace * 0.5; // !default;
--cds-popover-background-color: #{$tooltip-background-color};
--cds-popover-text-color: #{$tooltip-text-color};
}
+
+.#{$ns}-popover-content {
+ .#{$ns}-tooltip.#{$ns}-intent-primary & {
+ color: $eccgui-color-primary-contrast;
+ background-color: $eccgui-color-primary;
+ }
+ .#{$ns}-tooltip.#{$eccgui}-intent--accent & {
+ color: $eccgui-color-accent-contrast;
+ background-color: $eccgui-color-accent;
+ }
+}
+
+.#{$ns}-popover-arrow-fill {
+ .#{$ns}-tooltip.#{$ns}-intent-primary & {
+ fill: $eccgui-color-primary;
+ }
+ .#{$ns}-tooltip.#{$eccgui}-intent--accent & {
+ fill: $eccgui-color-accent;
+ }
+}
diff --git a/src/components/index.scss b/src/components/index.scss
index 7d0bc735..b3852c48 100644
--- a/src/components/index.scss
+++ b/src/components/index.scss
@@ -46,3 +46,4 @@
@import "./PropertyValuePair/propertyvalue";
@import "./MultiSuggestField/multisuggestfield";
@import "./ContentGroup/contentgroup";
+@import "./ProgressBar/progressbar";
diff --git a/src/includes/blueprintjs/_components.scss b/src/includes/blueprintjs/_components.scss
index 391cb2a0..5ea45542 100644
--- a/src/includes/blueprintjs/_components.scss
+++ b/src/includes/blueprintjs/_components.scss
@@ -3,4 +3,3 @@
@import "~@blueprintjs/core/src/components/context-menu/context-menu";
@import "~@blueprintjs/core/src/components/overlay/overlay";
@import "~@blueprintjs/core/src/components/portal/portal";
-@import "~@blueprintjs/core/src/components/progress-bar/progress-bar";