@eccenca/gui-elements 26.0.0-rc.1 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -3
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +1 -1
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/react-flow/configuration/linking.js +1 -0
- package/dist/cjs/cmem/react-flow/configuration/linking.js.map +1 -1
- package/dist/cjs/cmem/react-flow/configuration/typing.js +1 -0
- package/dist/cjs/cmem/react-flow/configuration/typing.js.map +1 -1
- package/dist/cjs/common/Intent/index.js +4 -2
- package/dist/cjs/common/Intent/index.js.map +1 -1
- package/dist/cjs/common/index.js +3 -1
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/components/Button/Button.js +2 -1
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +2 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Menu/MenuItem.js +6 -2
- package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +7 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/ProgressBar/ProgressBar.js +25 -2
- package/dist/cjs/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/cjs/components/TextField/TextArea.js +1 -1
- package/dist/cjs/components/TextField/TextArea.js.map +1 -1
- package/dist/cjs/components/TextField/TextField.js +1 -1
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +7 -5
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +2 -2
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +16 -6
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/react-flow/configuration/linking.js +1 -0
- package/dist/esm/cmem/react-flow/configuration/linking.js.map +1 -1
- package/dist/esm/cmem/react-flow/configuration/typing.js +1 -0
- package/dist/esm/cmem/react-flow/configuration/typing.js.map +1 -1
- package/dist/esm/common/Intent/index.js +3 -1
- package/dist/esm/common/Intent/index.js.map +1 -1
- package/dist/esm/common/index.js +1 -0
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/components/Button/Button.js +3 -2
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +2 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +8 -3
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +12 -8
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/ProgressBar/ProgressBar.js +33 -2
- package/dist/esm/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/esm/components/TextField/TextArea.js +1 -1
- package/dist/esm/components/TextField/TextArea.js.map +1 -1
- package/dist/esm/components/TextField/TextField.js +1 -1
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +10 -7
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +2 -2
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +17 -7
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +1 -0
- package/dist/types/cmem/react-flow/configuration/typing.d.ts +1 -0
- package/dist/types/common/Intent/index.d.ts +9 -1
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/components/Button/Button.d.ts +3 -2
- package/dist/types/components/Icon/canonicalIconNames.d.ts +2 -0
- package/dist/types/components/Menu/MenuItem.d.ts +9 -2
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +3 -2
- package/dist/types/components/ProgressBar/ProgressBar.d.ts +9 -2
- package/dist/types/components/Tooltip/Tooltip.d.ts +7 -2
- package/package.json +3 -2
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +11 -0
- package/src/cmem/ActivityControl/tests/ActivityControlWidget.test.tsx +21 -0
- package/src/cmem/react-flow/ReactFlow/ReactFlow.stories.tsx +11 -1
- package/src/cmem/react-flow/_handles.scss +1 -0
- package/src/cmem/react-flow/_minimap.scss +1 -0
- package/src/cmem/react-flow/configuration/_colors-linking.scss +2 -0
- package/src/cmem/react-flow/configuration/linking.ts +1 -0
- package/src/cmem/react-flow/configuration/typing.ts +1 -0
- package/src/cmem/react-flow/nodes/_colors.scss +1 -0
- package/src/common/Intent/index.ts +4 -2
- package/src/common/index.ts +1 -0
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Form/form.scss +14 -2
- package/src/components/Icon/canonicalIconNames.tsx +2 -0
- package/src/components/Menu/MenuItem.test.tsx +25 -0
- package/src/components/Menu/MenuItem.tsx +18 -5
- package/src/components/Menu/Stories/MenuItem.stories.tsx +5 -0
- package/src/components/Menu/menu.scss +48 -0
- package/src/components/MultiSelect/MultiSelect.tsx +8 -4
- package/src/components/MultiSuggestField/MultiSuggestField.stories.tsx +1 -1
- package/src/components/MultiSuggestField/_multisuggestfield.scss +8 -0
- package/src/components/ProgressBar/ProgressBar.test.tsx +28 -0
- package/src/components/ProgressBar/ProgressBar.tsx +23 -3
- package/src/components/ProgressBar/Stories/ProgressBar.stories.tsx +1 -1
- package/src/components/ProgressBar/progressbar.scss +20 -0
- package/src/components/TextField/TextArea.tsx +3 -4
- package/src/components/TextField/TextField.tsx +3 -4
- package/src/components/TextField/textfield.scss +46 -14
- package/src/components/Tooltip/Tooltip.stories.tsx +7 -1
- package/src/components/Tooltip/Tooltip.test.tsx +16 -0
- package/src/components/Tooltip/Tooltip.tsx +19 -4
- package/src/components/Tooltip/tooltip.scss +21 -0
- package/src/components/index.scss +1 -0
- package/src/extensions/react-flow/handles/HandleContent.tsx +2 -1
- package/src/extensions/react-flow/handles/HandleDefault.tsx +23 -21
- package/src/extensions/react-flow/handles/_handles.scss +8 -1
- package/src/extensions/react-flow/handles/tests/HandleDefault.test.tsx +60 -0
- package/src/includes/blueprintjs/_components.scss +0 -1
|
@@ -63,6 +63,7 @@ const canonicalIcons = {
|
|
|
63
63
|
"artefact-report": icons.Report,
|
|
64
64
|
"artefact-task": icons.Script,
|
|
65
65
|
"artefact-transform": icons.DataRefinery,
|
|
66
|
+
"artefact-ruleblock": transform(icons.Fragments, 90),
|
|
66
67
|
"artefact-uncategorized": icons.Unknown,
|
|
67
68
|
"artefact-workflow": icons.ModelBuilder,
|
|
68
69
|
|
|
@@ -120,6 +121,7 @@ const canonicalIcons = {
|
|
|
120
121
|
"module-dashboard": icons.Dashboard,
|
|
121
122
|
"module-gdprsearch": icons.UserProfile,
|
|
122
123
|
"module-integrations": icons.AppConnectivity,
|
|
124
|
+
"module-marketplace": icons.ShoppingCatalog,
|
|
123
125
|
"module-linkedrules": icons.Connect,
|
|
124
126
|
"module-reports": icons.ReportData,
|
|
125
127
|
"module-search": icons.Search,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Classes as BlueprintClasses } from "@blueprintjs/core";
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
|
|
5
|
+
import "@testing-library/jest-dom";
|
|
6
|
+
|
|
7
|
+
import { MenuItem } from "../../../index";
|
|
8
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
9
|
+
|
|
10
|
+
describe("MenuItem", () => {
|
|
11
|
+
it("should not apply an intent class when intent is undefined", () => {
|
|
12
|
+
const { container } = render(<MenuItem text="item" intent={undefined} />);
|
|
13
|
+
const menuItem = container.querySelector(`.${eccgui}-menu__item`);
|
|
14
|
+
expect(menuItem).not.toBeNull();
|
|
15
|
+
expect((menuItem as HTMLElement).className).not.toMatch(
|
|
16
|
+
new RegExp(`${BlueprintClasses.getClassNamespace()}-intent-`),
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
it("should apply the intent class for the custom accent intent", () => {
|
|
20
|
+
const { container } = render(<MenuItem text="item" intent="accent" />);
|
|
21
|
+
const menuItem = container.querySelector(`.${eccgui}-menu__item`);
|
|
22
|
+
expect(menuItem).not.toBeNull();
|
|
23
|
+
expect(menuItem).toHaveClass(`${BlueprintClasses.getClassNamespace()}-intent-accent`);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Classes as BlueprintClasses,
|
|
4
|
+
MenuItem as BlueprintMenuItem,
|
|
5
|
+
MenuItemProps as BlueprintMenuItemProps,
|
|
6
|
+
} from "@blueprintjs/core";
|
|
7
|
+
import classNames from "classnames";
|
|
3
8
|
|
|
4
9
|
import { openInNewTab } from "../../common/utils/openInNewTab";
|
|
5
10
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
@@ -11,10 +16,10 @@ import { TestIconProps } from "./../Icon/TestIcon";
|
|
|
11
16
|
|
|
12
17
|
export interface MenuItemProps
|
|
13
18
|
extends
|
|
14
|
-
Omit<BlueprintMenuItemProps, "icon" | "children">,
|
|
19
|
+
Omit<BlueprintMenuItemProps, "icon" | "children" | "intent">,
|
|
15
20
|
Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "onFocus" | "target" | "children"> {
|
|
16
|
-
|
|
17
|
-
* If set the icon is
|
|
21
|
+
/**
|
|
22
|
+
* If set the icon is displayed on the left side of the menu item.
|
|
18
23
|
*/
|
|
19
24
|
icon?: ValidIconName | string[] | React.ReactElement<TestIconProps>;
|
|
20
25
|
/**
|
|
@@ -25,6 +30,10 @@ export interface MenuItemProps
|
|
|
25
30
|
* Tooltip, but only added to the label, not to the full menu item.
|
|
26
31
|
*/
|
|
27
32
|
tooltip?: string | React.JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Visual intent color to apply to element.
|
|
35
|
+
*/
|
|
36
|
+
intent?: BlueprintMenuItemProps["intent"] | "accent";
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
/**
|
|
@@ -38,6 +47,7 @@ export const MenuItem = ({
|
|
|
38
47
|
href,
|
|
39
48
|
text,
|
|
40
49
|
tooltip,
|
|
50
|
+
intent,
|
|
41
51
|
...restProps
|
|
42
52
|
}: MenuItemProps) => {
|
|
43
53
|
return (
|
|
@@ -56,7 +66,10 @@ export const MenuItem = ({
|
|
|
56
66
|
onClick={(e: React.MouseEvent<HTMLElement>) =>
|
|
57
67
|
openInNewTab(e as React.MouseEvent<HTMLAnchorElement>, onClick, href)
|
|
58
68
|
}
|
|
59
|
-
className={`${eccgui}-menu__item
|
|
69
|
+
className={classNames(`${eccgui}-menu__item`, className, {
|
|
70
|
+
// control blueprint intent classes to enhance it by new options
|
|
71
|
+
[`${BlueprintClasses.getClassNamespace()}-intent-${intent}`]: intent,
|
|
72
|
+
})}
|
|
60
73
|
icon={icon ? typeof icon === "string" || Array.isArray(icon) ? <Icon name={icon} /> : icon : false}
|
|
61
74
|
>
|
|
62
75
|
{children ?? null}
|
|
@@ -3,6 +3,7 @@ import { OverlaysProvider } from "@blueprintjs/core";
|
|
|
3
3
|
import { LogoReact } from "@carbon/icons-react";
|
|
4
4
|
import { Meta, StoryFn } from "@storybook/react";
|
|
5
5
|
|
|
6
|
+
import { helpersArgTypes } from "../../../../.storybook/helpers";
|
|
6
7
|
import { Menu, MenuItem, TestIcon } from "../../../components";
|
|
7
8
|
|
|
8
9
|
import canonicalIcons from "./../../Icon/canonicalIconNames";
|
|
@@ -19,6 +20,10 @@ export default {
|
|
|
19
20
|
...Object.keys(canonicalIcons),
|
|
20
21
|
},
|
|
21
22
|
},
|
|
23
|
+
intent: {
|
|
24
|
+
...helpersArgTypes.exampleIntent,
|
|
25
|
+
options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
|
|
26
|
+
},
|
|
22
27
|
},
|
|
23
28
|
} as Meta<typeof MenuItem>;
|
|
24
29
|
|
|
@@ -68,3 +68,51 @@ span.#{$ns}-menu-item-icon:empty {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
.#{$ns}-menu-item {
|
|
73
|
+
@each $intent in ("primary", "accent") {
|
|
74
|
+
$colorrange: $intent;
|
|
75
|
+
|
|
76
|
+
@if $intent == "primary" {
|
|
77
|
+
$colorrange: "brand";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@include menu-item-intent(
|
|
81
|
+
$intent,
|
|
82
|
+
false,
|
|
83
|
+
eccgui-color-var("identity", $colorrange, "300"),
|
|
84
|
+
eccgui-color-var("identity", $colorrange, "700"),
|
|
85
|
+
eccgui-color-var("identity", $colorrange, "900")
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.#{$ns}-submenu {
|
|
91
|
+
.#{$ns}-popover-target {
|
|
92
|
+
&.#{$ns}-popover-open > .#{$ns}-menu-item {
|
|
93
|
+
&[class*="#{$ns}-intent-"] {
|
|
94
|
+
&,
|
|
95
|
+
&:hover,
|
|
96
|
+
&:active {
|
|
97
|
+
@each $intent in ("primary", "accent") {
|
|
98
|
+
$colorrange: $intent;
|
|
99
|
+
|
|
100
|
+
@if $intent == "primary" {
|
|
101
|
+
$colorrange: "brand";
|
|
102
|
+
}
|
|
103
|
+
&.#{$ns}-intent-#{$intent} {
|
|
104
|
+
color: eccgui-color-var("identity", $colorrange, "700");
|
|
105
|
+
background-color: rgba(eccgui-color-var("identity", $colorrange, "300"), 0.1);
|
|
106
|
+
|
|
107
|
+
&::before,
|
|
108
|
+
.#{$ns}-menu-item-icon,
|
|
109
|
+
.#{$ns}-submenu-icon {
|
|
110
|
+
color: inherit;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
import { HTMLInputProps as BlueprintHTMLInputProps
|
|
2
|
+
import { HTMLInputProps as BlueprintHTMLInputProps } from "@blueprintjs/core";
|
|
3
3
|
import {
|
|
4
4
|
ItemRendererProps as BlueprintItemRendererProps,
|
|
5
5
|
MultiSelect as BlueprintMultiSelect,
|
|
6
6
|
MultiSelectProps as BlueprintMultiSelectProps,
|
|
7
7
|
} from "@blueprintjs/select";
|
|
8
|
+
import classNames from "classnames";
|
|
8
9
|
|
|
10
|
+
import { IntentBlueprint } from "../../common/Intent";
|
|
9
11
|
import { removeExtraSpaces } from "../../common/utils/stringUtils";
|
|
10
12
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
11
13
|
import { TestableComponent } from "../interfaces";
|
|
@@ -96,7 +98,7 @@ export interface MultiSuggestFieldCommonProps<T>
|
|
|
96
98
|
/**
|
|
97
99
|
* Intent state of the multi select.
|
|
98
100
|
*/
|
|
99
|
-
intent?:
|
|
101
|
+
intent?: IntentBlueprint | "accent";
|
|
100
102
|
/**
|
|
101
103
|
* Disables the input element
|
|
102
104
|
*/
|
|
@@ -555,10 +557,12 @@ export function MultiSuggestField<T>({
|
|
|
555
557
|
"data-testid": dataTestid ? dataTestid + "_searchinput" : undefined,
|
|
556
558
|
...inputProps,
|
|
557
559
|
} as React.InputHTMLAttributes<HTMLInputElement>,
|
|
558
|
-
className: `${eccgui}-multisuggestfield
|
|
560
|
+
className: classNames(`${eccgui}-multisuggestfield`, `${eccgui}-multiselect`, className, {
|
|
561
|
+
[`${eccgui}-intent--${intent}`]: intent === "accent",
|
|
562
|
+
}),
|
|
559
563
|
fill: fullWidth,
|
|
560
564
|
inputRef: inputRef,
|
|
561
|
-
intent: intent,
|
|
565
|
+
intent: intent && intent !== "accent" ? intent : undefined,
|
|
562
566
|
addOnBlur: true,
|
|
563
567
|
onKeyDown: handleOnKeyDown,
|
|
564
568
|
onKeyUp: handleOnKeyUp,
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
.#{$eccgui}-multisuggestfield {
|
|
11
11
|
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-accent};
|
|
12
12
|
|
|
13
|
+
&.#{$ns}-intent-primary {
|
|
14
|
+
@include pt-input-intent(eccgui-color-var("identity", "brand", "900"));
|
|
15
|
+
|
|
16
|
+
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-primary};
|
|
17
|
+
}
|
|
18
|
+
&.#{$eccgui}-intent--accent {
|
|
19
|
+
@include pt-input-intent(eccgui-color-var("identity", "accent", "900"));
|
|
20
|
+
}
|
|
13
21
|
&.#{$ns}-intent-success {
|
|
14
22
|
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-success-text};
|
|
15
23
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
|
|
4
|
+
import "@testing-library/jest-dom";
|
|
5
|
+
|
|
6
|
+
import { ProgressBar } from "../../../index";
|
|
7
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
|
+
|
|
9
|
+
describe("ProgressBar", () => {
|
|
10
|
+
it("should not apply an intent class when no intent is set", () => {
|
|
11
|
+
const { container } = render(<ProgressBar />);
|
|
12
|
+
const progressbar = container.querySelector(`.${eccgui}-progressbar`);
|
|
13
|
+
expect(progressbar).not.toBeNull();
|
|
14
|
+
expect((progressbar as HTMLElement).className).not.toMatch(new RegExp(`${eccgui}-progressbar-intent-`));
|
|
15
|
+
});
|
|
16
|
+
it("should apply the matching intent class for a blueprint intent", () => {
|
|
17
|
+
const { container } = render(<ProgressBar intent="success" />);
|
|
18
|
+
const progressbar = container.querySelector(`.${eccgui}-progressbar`);
|
|
19
|
+
expect(progressbar).not.toBeNull();
|
|
20
|
+
expect(progressbar).toHaveClass(`${eccgui}-progressbar-intent-success`);
|
|
21
|
+
});
|
|
22
|
+
it("should apply the intent class for the custom accent intent", () => {
|
|
23
|
+
const { container } = render(<ProgressBar intent="accent" />);
|
|
24
|
+
const progressbar = container.querySelector(`.${eccgui}-progressbar`);
|
|
25
|
+
expect(progressbar).not.toBeNull();
|
|
26
|
+
expect(progressbar).toHaveClass(`${eccgui}-progressbar-intent-accent`);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { ProgressBar as BlueprintProgressBar, ProgressBarProps as BlueprintProgressBarProps } from "@blueprintjs/core";
|
|
3
|
+
import classNames from "classnames";
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
5
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
6
|
+
|
|
7
|
+
export interface ProgressBarProps extends Omit<BlueprintProgressBarProps, "intent"> {
|
|
8
|
+
/**
|
|
9
|
+
* Visual intent color to apply to element.
|
|
10
|
+
*/
|
|
11
|
+
intent?: BlueprintProgressBarProps["intent"] | "accent";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ProgressBar = ({ className, intent, ...otherProps }: ProgressBarProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<BlueprintProgressBar
|
|
17
|
+
className={classNames(`${eccgui}-progressbar`, className, {
|
|
18
|
+
[`${eccgui}-progressbar-intent-${intent}`]: intent,
|
|
19
|
+
})}
|
|
20
|
+
{...otherProps}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default ProgressBar;
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
argTypes: {
|
|
10
10
|
intent: {
|
|
11
11
|
...helpersArgTypes.exampleIntent,
|
|
12
|
-
options: ["UNDEFINED", "primary", "success", "warning", "danger"],
|
|
12
|
+
options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
} as Meta<typeof ProgressBar>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// lib import
|
|
2
|
+
@import "~@blueprintjs/core/src/components/progress-bar/progress-bar";
|
|
3
|
+
|
|
4
|
+
.#{$ns}-progress-meter {
|
|
5
|
+
.#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-primary & {
|
|
6
|
+
background-color: $eccgui-color-primary;
|
|
7
|
+
}
|
|
8
|
+
.#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-accent & {
|
|
9
|
+
background-color: $eccgui-color-accent;
|
|
10
|
+
}
|
|
11
|
+
.#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-danger & {
|
|
12
|
+
background-color: $eccgui-color-danger-text;
|
|
13
|
+
}
|
|
14
|
+
.#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-warning & {
|
|
15
|
+
background-color: $eccgui-color-warning-text;
|
|
16
|
+
}
|
|
17
|
+
.#{$ns}-progress-bar.#{$eccgui}-progressbar-intent-success & {
|
|
18
|
+
background-color: $eccgui-color-success-text;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Classes as BlueprintClassNames,
|
|
4
|
-
Intent as BlueprintIntent,
|
|
5
4
|
MaybeElement,
|
|
6
5
|
TextArea as BlueprintTextArea,
|
|
7
6
|
TextAreaProps as BlueprintTextAreaProps,
|
|
8
7
|
} from "@blueprintjs/core";
|
|
9
8
|
|
|
10
|
-
import { Definitions as IntentDefinitions, IntentTypes } from "../../common/Intent";
|
|
9
|
+
import { Definitions as IntentDefinitions, IntentBlueprint, IntentTypes } from "../../common/Intent";
|
|
11
10
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
12
11
|
import { Icon } from "../Icon";
|
|
13
12
|
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
@@ -154,8 +153,8 @@ export const TextArea = ({
|
|
|
154
153
|
(className ? ` ${className}` : "")
|
|
155
154
|
}
|
|
156
155
|
intent={
|
|
157
|
-
intent && !["info", "edited", "removed", "neutral"].includes(intent)
|
|
158
|
-
? (intent as
|
|
156
|
+
intent && !["info", "edited", "removed", "neutral", "accent"].includes(intent)
|
|
157
|
+
? (intent as IntentBlueprint)
|
|
159
158
|
: undefined
|
|
160
159
|
}
|
|
161
160
|
spellCheck={intent === "removed" ? false : undefined}
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
HTMLInputProps,
|
|
5
5
|
InputGroup as BlueprintInputGroup,
|
|
6
6
|
InputGroupProps as BlueprintInputGroupProps,
|
|
7
|
-
Intent as BlueprintIntent,
|
|
8
7
|
MaybeElement,
|
|
9
8
|
} from "@blueprintjs/core";
|
|
10
9
|
|
|
11
|
-
import { Definitions as IntentDefinitions, IntentTypes } from "../../common/Intent";
|
|
10
|
+
import { Definitions as IntentDefinitions, IntentBlueprint, IntentTypes } from "../../common/Intent";
|
|
12
11
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
13
12
|
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
14
13
|
import Icon from "../Icon/Icon";
|
|
@@ -107,8 +106,8 @@ export const TextField = ({
|
|
|
107
106
|
(className ? ` ${className}` : "")
|
|
108
107
|
}
|
|
109
108
|
intent={
|
|
110
|
-
intent && !["info", "edited", "removed", "neutral"].includes(intent)
|
|
111
|
-
? (intent as
|
|
109
|
+
intent && !["info", "edited", "removed", "neutral", "accent"].includes(intent)
|
|
110
|
+
? (intent as IntentBlueprint)
|
|
112
111
|
: undefined
|
|
113
112
|
}
|
|
114
113
|
fill={fullWidth}
|
|
@@ -76,30 +76,38 @@ $input-button-height-small: math.div($eccgui-size-textfield-height-small, $eccgu
|
|
|
76
76
|
// enhancements
|
|
77
77
|
|
|
78
78
|
$eccgui-map-intent-bgcolors: (
|
|
79
|
-
"primary": $eccgui-color-
|
|
79
|
+
"primary": $eccgui-color-primary-contrast,
|
|
80
80
|
"success": $eccgui-color-success-background,
|
|
81
81
|
"warning": $eccgui-color-warning-background,
|
|
82
82
|
"danger": $eccgui-color-danger-background,
|
|
83
83
|
);
|
|
84
84
|
|
|
85
|
-
@mixin intent-state-flash-animation($state, $
|
|
85
|
+
@mixin intent-state-flash-animation($state, $group, $tint) {
|
|
86
86
|
@keyframes intent-state-flash-#{$state} {
|
|
87
87
|
0% {
|
|
88
|
-
background-color: eccgui-color-var(
|
|
88
|
+
background-color: eccgui-color-var($group, $tint, "100");
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
39% {
|
|
92
|
-
background-color: eccgui-color-var(
|
|
92
|
+
background-color: eccgui-color-var($group, $tint, "300");
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
100% {
|
|
96
|
-
background-color: eccgui-color-var(
|
|
96
|
+
background-color: eccgui-color-var($group, $tint, "100");
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
|
|
102
|
-
|
|
102
|
+
$group: "semantic";
|
|
103
|
+
$tint: $each-intent;
|
|
104
|
+
|
|
105
|
+
@if $each-intent == "primary" {
|
|
106
|
+
$group: "identity";
|
|
107
|
+
$tint: "brand";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@include intent-state-flash-animation($each-intent, $group, $tint);
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
.#{$ns}-input {
|
|
@@ -111,11 +119,19 @@ $eccgui-map-intent-bgcolors: (
|
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
|
|
122
|
+
$group: "semantic";
|
|
123
|
+
$tint: $each-intent;
|
|
124
|
+
|
|
125
|
+
@if $each-intent == "primary" {
|
|
126
|
+
$group: "identity";
|
|
127
|
+
$tint: "brand";
|
|
128
|
+
}
|
|
114
129
|
.#{$ns}-input-group.#{$ns}-intent-#{$each-intent} & {
|
|
115
|
-
|
|
130
|
+
@include pt-input-intent(eccgui-color-var($group, $tint, "900"));
|
|
116
131
|
|
|
117
|
-
--#{$eccgui}-a11y-outline-color: eccgui-color-var(
|
|
132
|
+
--#{$eccgui}-a11y-outline-color: #{eccgui-color-var($group, $tint, "900")};
|
|
118
133
|
|
|
134
|
+
background-color: eccgui-color-var($group, $tint, "100");
|
|
119
135
|
animation-name: intent-state-flash-#{$each-intent};
|
|
120
136
|
}
|
|
121
137
|
}
|
|
@@ -127,9 +143,13 @@ $eccgui-map-intent-bgcolors: (
|
|
|
127
143
|
}
|
|
128
144
|
|
|
129
145
|
.#{$ns}-input-group.#{$eccgui}-intent--accent & {
|
|
130
|
-
@include pt-input-intent($eccgui-color-
|
|
146
|
+
@include pt-input-intent($eccgui-color-accent);
|
|
147
|
+
@include intent-state-flash-animation("accent", "identity", "accent");
|
|
131
148
|
|
|
132
|
-
|
|
149
|
+
background-color: eccgui-color-var("identity", "accent", "100");
|
|
150
|
+
animation-name: intent-state-flash-accent;
|
|
151
|
+
|
|
152
|
+
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-accent};
|
|
133
153
|
}
|
|
134
154
|
|
|
135
155
|
.#{$ns}-input-group.#{$eccgui}-intent--neutral & {
|
|
@@ -162,11 +182,19 @@ $eccgui-map-intent-bgcolors: (
|
|
|
162
182
|
}
|
|
163
183
|
|
|
164
184
|
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
|
|
185
|
+
$group: "semantic";
|
|
186
|
+
$tint: $each-intent;
|
|
187
|
+
|
|
188
|
+
@if $each-intent == "primary" {
|
|
189
|
+
$group: "identity";
|
|
190
|
+
$tint: "brand";
|
|
191
|
+
}
|
|
165
192
|
&.#{$eccgui}-intent--#{$each-intent} {
|
|
166
|
-
|
|
193
|
+
@include pt-input-intent(eccgui-color-var($group, $tint, "900"));
|
|
167
194
|
|
|
168
|
-
--#{$eccgui}-a11y-outline-color: eccgui-color-var(
|
|
195
|
+
--#{$eccgui}-a11y-outline-color: #{eccgui-color-var($group, $tint, "900")};
|
|
169
196
|
|
|
197
|
+
background-color: eccgui-color-var($group, $tint, "100");
|
|
170
198
|
animation-name: intent-state-flash-#{$each-intent};
|
|
171
199
|
}
|
|
172
200
|
}
|
|
@@ -178,9 +206,13 @@ $eccgui-map-intent-bgcolors: (
|
|
|
178
206
|
}
|
|
179
207
|
|
|
180
208
|
&.#{$eccgui}-intent--accent {
|
|
181
|
-
@include pt-input-intent($eccgui-color-
|
|
209
|
+
@include pt-input-intent($eccgui-color-accent);
|
|
210
|
+
@include intent-state-flash-animation("accent", "identity", "accent");
|
|
211
|
+
|
|
212
|
+
background-color: eccgui-color-var("identity", "accent", "100");
|
|
213
|
+
animation-name: intent-state-flash-accent;
|
|
182
214
|
|
|
183
|
-
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-
|
|
215
|
+
--#{$eccgui}-a11y-outline-color: #{$eccgui-color-accent};
|
|
184
216
|
}
|
|
185
217
|
|
|
186
218
|
&.#{$eccgui}-intent--neutral {
|
|
@@ -4,12 +4,18 @@ import { OverlaysProvider } from "@blueprintjs/core";
|
|
|
4
4
|
import { Meta, StoryFn } from "@storybook/react";
|
|
5
5
|
import { fn } from "storybook/test";
|
|
6
6
|
|
|
7
|
+
import { helpersArgTypes } from "../../../.storybook/helpers";
|
|
7
8
|
import { Tooltip } from "../../index";
|
|
8
9
|
|
|
9
10
|
export default {
|
|
10
11
|
title: "Components/Tooltip",
|
|
11
12
|
component: Tooltip,
|
|
12
|
-
argTypes: {
|
|
13
|
+
argTypes: {
|
|
14
|
+
intent: {
|
|
15
|
+
...helpersArgTypes.exampleIntent,
|
|
16
|
+
options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
13
19
|
} as Meta<typeof Tooltip>;
|
|
14
20
|
|
|
15
21
|
let forcedUpdateKey = 0; // @see https://github.com/storybookjs/storybook/issues/13375#issuecomment-1291011856
|
|
@@ -95,4 +95,20 @@ describe("Tooltip", () => {
|
|
|
95
95
|
});
|
|
96
96
|
expect(await screen.findByText(TooltipStory.args.content as string)).toBeVisible();
|
|
97
97
|
});
|
|
98
|
+
it("should not apply the accent intent class when intent is undefined", () => {
|
|
99
|
+
render(
|
|
100
|
+
<Tooltip {...TooltipStory.args} isOpen intent={undefined}>
|
|
101
|
+
<span>target</span>
|
|
102
|
+
</Tooltip>,
|
|
103
|
+
);
|
|
104
|
+
expect(document.querySelectorAll(`.${eccgui}-intent--accent`)).toHaveLength(0);
|
|
105
|
+
});
|
|
106
|
+
it("should apply the accent intent class for the custom accent intent", () => {
|
|
107
|
+
render(
|
|
108
|
+
<Tooltip {...TooltipStory.args} isOpen intent="accent">
|
|
109
|
+
<span>target</span>
|
|
110
|
+
</Tooltip>,
|
|
111
|
+
);
|
|
112
|
+
expect(document.querySelectorAll(`.${eccgui}-intent--accent`)).toHaveLength(1);
|
|
113
|
+
});
|
|
98
114
|
});
|
|
@@ -5,12 +5,14 @@ import {
|
|
|
5
5
|
TooltipProps as BlueprintTooltipProps,
|
|
6
6
|
Utils as BlueprintUtils,
|
|
7
7
|
} from "@blueprintjs/core";
|
|
8
|
+
import classNames from "classnames";
|
|
8
9
|
|
|
9
10
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
11
|
+
import { IntentBlueprint } from "../../common/Intent";
|
|
10
12
|
|
|
11
13
|
import { Markdown, MarkdownProps } from "./../../cmem/markdown/Markdown";
|
|
12
14
|
|
|
13
|
-
export interface TooltipProps extends Omit<BlueprintTooltipProps, "position"> {
|
|
15
|
+
export interface TooltipProps extends Omit<BlueprintTooltipProps, "position" | "intent"> {
|
|
14
16
|
/**
|
|
15
17
|
* Add dotted underline as visual indication to the target that a tooltip is attached.
|
|
16
18
|
* Should be used together with text-only elements.
|
|
@@ -48,6 +50,10 @@ export interface TooltipProps extends Omit<BlueprintTooltipProps, "position"> {
|
|
|
48
50
|
* For the first display of the tooltip this time adds up to `hoverOpenDelay`.
|
|
49
51
|
*/
|
|
50
52
|
swapPlaceholderDelay?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Intent state of the tooltip.
|
|
55
|
+
*/
|
|
56
|
+
intent?: IntentBlueprint | "accent";
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
export type TooltipSize = "small" | "medium" | "large";
|
|
@@ -63,6 +69,8 @@ export const Tooltip = ({
|
|
|
63
69
|
usePlaceholder,
|
|
64
70
|
swapPlaceholderDelay = 100,
|
|
65
71
|
hoverOpenDelay = 450,
|
|
72
|
+
popoverClassName,
|
|
73
|
+
intent,
|
|
66
74
|
...otherTooltipProps
|
|
67
75
|
}: TooltipProps) => {
|
|
68
76
|
const placeholderRef = React.useRef(null);
|
|
@@ -197,9 +205,15 @@ export const Tooltip = ({
|
|
|
197
205
|
content={tooltipContent}
|
|
198
206
|
className={targetClassName}
|
|
199
207
|
popoverClassName={
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
208
|
+
classNames(
|
|
209
|
+
`${eccgui}-tooltip__content`,
|
|
210
|
+
`${eccgui}-tooltip--${size}`,
|
|
211
|
+
popoverClassName,
|
|
212
|
+
{
|
|
213
|
+
[`${className}__content`]: className,
|
|
214
|
+
[`${eccgui}-intent--${intent}`]: intent === "accent",
|
|
215
|
+
}
|
|
216
|
+
)
|
|
203
217
|
}
|
|
204
218
|
ref={refocus}
|
|
205
219
|
targetProps={
|
|
@@ -211,6 +225,7 @@ export const Tooltip = ({
|
|
|
211
225
|
: undefined,
|
|
212
226
|
} as React.HTMLProps<HTMLElement>
|
|
213
227
|
}
|
|
228
|
+
intent={intent && intent !== "accent" ? intent : undefined}
|
|
214
229
|
>
|
|
215
230
|
{children}
|
|
216
231
|
</BlueprintTooltip>
|
|
@@ -38,6 +38,7 @@ $tooltip-padding-horizontal: $eccgui-size-block-whitespace * 0.5; // !default;
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.#{$eccgui}-tooltip__content {
|
|
41
|
+
|
|
41
42
|
a {
|
|
42
43
|
color: inherit;
|
|
43
44
|
text-decoration: none;
|
|
@@ -66,3 +67,23 @@ $tooltip-padding-horizontal: $eccgui-size-block-whitespace * 0.5; // !default;
|
|
|
66
67
|
--cds-popover-background-color: #{$tooltip-background-color};
|
|
67
68
|
--cds-popover-text-color: #{$tooltip-text-color};
|
|
68
69
|
}
|
|
70
|
+
|
|
71
|
+
.#{$ns}-popover-content {
|
|
72
|
+
.#{$ns}-tooltip.#{$ns}-intent-primary & {
|
|
73
|
+
color: $eccgui-color-primary-contrast;
|
|
74
|
+
background-color: $eccgui-color-primary;
|
|
75
|
+
}
|
|
76
|
+
.#{$ns}-tooltip.#{$eccgui}-intent--accent & {
|
|
77
|
+
color: $eccgui-color-accent-contrast;
|
|
78
|
+
background-color: $eccgui-color-accent;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.#{$ns}-popover-arrow-fill {
|
|
83
|
+
.#{$ns}-tooltip.#{$ns}-intent-primary & {
|
|
84
|
+
fill: $eccgui-color-primary;
|
|
85
|
+
}
|
|
86
|
+
.#{$ns}-tooltip.#{$eccgui}-intent--accent & {
|
|
87
|
+
fill: $eccgui-color-accent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -21,7 +21,7 @@ export const HandleContent = memo(
|
|
|
21
21
|
{children}
|
|
22
22
|
</div>
|
|
23
23
|
) : extendedTooltip ? (
|
|
24
|
-
<div className={`${eccgui}-graphviz__handle__content`} {...otherDivProps} />
|
|
24
|
+
<div className={`${eccgui}-graphviz__handle__content ${eccgui}-graphviz__handle__content--extendedTooltip`} {...otherDivProps} />
|
|
25
25
|
) : (
|
|
26
26
|
<></>
|
|
27
27
|
);
|
|
@@ -33,6 +33,7 @@ export const HandleContent = memo(
|
|
|
33
33
|
autoFocus={false}
|
|
34
34
|
enforceFocus={false}
|
|
35
35
|
openOnTargetFocus={false}
|
|
36
|
+
usePlaceholder={false}
|
|
36
37
|
{...tooltipProps}
|
|
37
38
|
>
|
|
38
39
|
{handleContent}
|