@eccenca/gui-elements 23.0.0-rc.1 → 23.0.0-rc.2
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 +13 -0
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +4 -10
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +2 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +19 -19
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +4 -12
- package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +15 -6
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/cjs/components/Button/Button.js +2 -2
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/ContextOverlay/ContextMenu.js +6 -5
- package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js +6 -8
- package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/cjs/components/Form/FieldItem.js +2 -2
- package/dist/cjs/components/Form/FieldItem.js.map +1 -1
- package/dist/cjs/components/Icon/Icon.js +2 -2
- package/dist/cjs/components/Icon/Icon.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js +2 -2
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Label/Label.js +6 -6
- package/dist/cjs/components/Label/Label.js.map +1 -1
- package/dist/cjs/components/Menu/MenuItem.js +2 -5
- package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +8 -10
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/Select/Select.js +29 -0
- package/dist/cjs/components/Select/Select.js.map +1 -0
- package/dist/cjs/components/Tabs/TabTitle.js +2 -4
- package/dist/cjs/components/Tabs/TabTitle.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +7 -4
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeTools.js +2 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeTools.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeTools.js +1 -3
- package/dist/cjs/extensions/react-flow/nodes/NodeTools.js.map +1 -1
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +4 -10
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +2 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +23 -21
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +4 -12
- package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js +32 -23
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/esm/components/Button/Button.js +2 -2
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/ContextOverlay/ContextMenu.js +6 -5
- package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
- package/dist/esm/components/ContextOverlay/ContextOverlay.js +6 -8
- package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
- package/dist/esm/components/Form/FieldItem.js +2 -2
- package/dist/esm/components/Form/FieldItem.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js +2 -2
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js +2 -2
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Label/Label.js +6 -6
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +2 -5
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +5 -7
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/Select/Select.js +35 -0
- package/dist/esm/components/Select/Select.js.map +1 -0
- package/dist/esm/components/Tabs/TabTitle.js +2 -4
- package/dist/esm/components/Tabs/TabTitle.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +7 -4
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeTools.js +2 -1
- package/dist/esm/extensions/react-flow/edges/EdgeTools.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeTools.js +1 -3
- package/dist/esm/extensions/react-flow/nodes/NodeTools.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/AutocompleteField/AutoCompleteField.d.ts +7 -4
- package/dist/types/components/Button/Button.d.ts +2 -2
- package/dist/types/components/ContextOverlay/ContextMenu.d.ts +37 -3
- package/dist/types/components/ContextOverlay/ContextOverlay.d.ts +12 -1
- package/dist/types/components/Form/FieldItem.d.ts +3 -2
- package/dist/types/components/Icon/Icon.d.ts +32 -7
- package/dist/types/components/Icon/IconButton.d.ts +21 -7
- package/dist/types/components/Label/Label.d.ts +30 -2
- package/dist/types/components/Menu/MenuItem.d.ts +3 -7
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +13 -9
- package/dist/types/components/Select/Select.d.ts +22 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +13 -11
- package/dist/types/components/interfaces.d.ts +1 -0
- package/dist/types/extensions/react-flow/edges/EdgeTools.d.ts +2 -2
- package/dist/types/extensions/react-flow/nodes/NodeTools.d.ts +2 -2
- package/dist/types/index.d.ts +2 -1
- package/package.json +8 -5
- package/src/cmem/ActivityControl/ActivityControlWidget.stories.tsx +2 -2
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +5 -10
- package/src/cmem/react-flow/ReactFlow/ReactFlow.stories.tsx +48 -15
- package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +2 -0
- package/src/common/utils/CssCustomProperties.ts +12 -10
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +23 -23
- package/src/components/AutoSuggestion/AutoSuggestionList.tsx +15 -17
- package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +1 -1
- package/src/components/AutocompleteField/AutoCompleteField.tsx +44 -19
- package/src/components/AutocompleteField/autocompletefield.scss +5 -3
- package/src/components/AutocompleteField/stories/AutoCompleteField.stories.tsx +75 -0
- package/src/components/Button/Button.tsx +3 -3
- package/src/components/ContextOverlay/ContextMenu.stories.tsx +30 -0
- package/src/components/ContextOverlay/ContextMenu.tsx +46 -8
- package/src/components/ContextOverlay/ContextOverlay.stories.tsx +148 -0
- package/src/components/ContextOverlay/ContextOverlay.tsx +16 -9
- package/src/components/ContextOverlay/contextoverlay.scss +3 -3
- package/src/components/Form/FieldItem.tsx +4 -4
- package/src/components/Icon/Icon.tsx +33 -18
- package/src/components/Icon/IconButton.tsx +24 -19
- package/src/components/Icon/stories/Icon.stories.tsx +52 -0
- package/src/components/Icon/stories/IconButton.stories.tsx +27 -0
- package/src/components/Label/Label.stories.tsx +27 -0
- package/src/components/Label/Label.tsx +47 -15
- package/src/components/Menu/MenuItem.tsx +9 -16
- package/src/components/Menu/menu.scss +4 -3
- package/src/components/MultiSelect/MultiSelect.tsx +30 -18
- package/src/components/Select/Select.stories.tsx +35 -0
- package/src/components/Select/Select.tsx +38 -0
- package/src/components/Select/_select.scss +8 -0
- package/src/components/Tabs/TabTitle.tsx +2 -4
- package/src/components/Tabs/tabs.scss +1 -1
- package/src/components/Tag/tag.scss +26 -22
- package/src/components/Tooltip/Tooltip.stories.tsx +36 -0
- package/src/components/Tooltip/Tooltip.tsx +23 -18
- package/src/components/Tooltip/tooltip.scss +6 -6
- package/src/components/Typography/typography.scss +1 -0
- package/src/components/interfaces.ts +3 -1
- package/src/extensions/react-flow/edges/EdgeTools.tsx +6 -4
- package/src/extensions/react-flow/handles/HandleContent.tsx +0 -1
- package/src/extensions/react-flow/nodes/NodeTools.tsx +10 -7
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +18 -0
- package/src/includes/blueprintjs/_variables.scss +1 -1
- package/src/index.scss +9 -5
- package/src/index.ts +3 -1
|
@@ -1,8 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
|
-
import Tooltip from "../Tooltip/Tooltip";
|
|
3
|
+
import Tooltip, { TooltipProps } from "../Tooltip/Tooltip";
|
|
4
4
|
import Icon from "../Icon/Icon";
|
|
5
5
|
|
|
6
|
+
export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
7
|
+
/**
|
|
8
|
+
* Label text.
|
|
9
|
+
*/
|
|
10
|
+
text?: string | JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Short info about label semantic, it is displayed in parentesis after the label text.
|
|
13
|
+
*/
|
|
14
|
+
info?: string | JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Additional tooltip, attached to an info icon that is displayed after the info.
|
|
17
|
+
*/
|
|
18
|
+
tooltip?: string | JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Additonal tooltip properties, e.g. `hoverOpenDelay`.
|
|
21
|
+
*/
|
|
22
|
+
tooltipProps?: Partial<Omit<TooltipProps, "content" | "children" | "disabled">>;
|
|
23
|
+
/**
|
|
24
|
+
* Set the name of an HTML element if the display should be used for something else that a `label` element.
|
|
25
|
+
*/
|
|
26
|
+
isLayoutForElement?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Label is displayed inactive.
|
|
29
|
+
* If there is no `isLayoutForElement` set then a `span` is used.
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
6
34
|
function Label({
|
|
7
35
|
children,
|
|
8
36
|
className = "",
|
|
@@ -10,34 +38,38 @@ function Label({
|
|
|
10
38
|
text,
|
|
11
39
|
info,
|
|
12
40
|
tooltip,
|
|
13
|
-
|
|
41
|
+
tooltipProps,
|
|
14
42
|
isLayoutForElement = "label",
|
|
15
|
-
...
|
|
16
|
-
}:
|
|
43
|
+
...otherLabelProps
|
|
44
|
+
}: LabelProps) {
|
|
17
45
|
let htmlElementstring = isLayoutForElement;
|
|
18
46
|
htmlElementstring = disabled && htmlElementstring === "label" ? "span" : htmlElementstring;
|
|
19
|
-
const labelElement = React.createElement(htmlElementstring);
|
|
20
47
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className={`${eccgui}-
|
|
24
|
-
{...otherProps}
|
|
25
|
-
htmlFor={disabled ? "" : otherProps.htmlFor}
|
|
26
|
-
>
|
|
27
|
-
<span className={`${eccgui}-label__text`}>{text}</span>
|
|
48
|
+
const labelContent = (
|
|
49
|
+
<>
|
|
50
|
+
{text && <span className={`${eccgui}-label__text`}>{text}</span>}
|
|
28
51
|
{info && <span className={`${eccgui}-label__info`}>{info}</span>}
|
|
29
52
|
{tooltip && (
|
|
30
53
|
<span className={`${eccgui}-label__tooltip`}>
|
|
31
|
-
<Tooltip content={tooltip} disabled={disabled} {...
|
|
54
|
+
<Tooltip content={tooltip} disabled={disabled} {...tooltipProps}>
|
|
32
55
|
<Icon name="item-info" small />
|
|
33
56
|
</Tooltip>
|
|
34
57
|
</span>
|
|
35
58
|
)}
|
|
36
59
|
{children && <span className={`${eccgui}-label__other`}>{children}</span>}
|
|
37
|
-
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return (!!text || !!info || !!tooltip || !!children) ? React.createElement(
|
|
64
|
+
htmlElementstring,
|
|
65
|
+
{
|
|
66
|
+
className: `${eccgui}-label` + (className ? " " + className : "") + (disabled ? ` ${eccgui}-label--disabled` : ""),
|
|
67
|
+
...otherLabelProps,
|
|
68
|
+
},
|
|
69
|
+
labelContent
|
|
38
70
|
) : (
|
|
39
71
|
<></>
|
|
40
|
-
)
|
|
72
|
+
)
|
|
41
73
|
}
|
|
42
74
|
|
|
43
75
|
export default Label;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {MenuItem as BlueprintMenuItem, MenuItemProps} from "@blueprintjs/core";
|
|
2
|
+
import {MenuItem as BlueprintMenuItem, MenuItemProps as BlueprintMenuItemProps} from "@blueprintjs/core";
|
|
3
3
|
import {CLASSPREFIX as eccgui} from "../../configuration/constants";
|
|
4
4
|
import Icon from '../Icon/Icon';
|
|
5
5
|
import { openInNewTab } from '../../common/utils/openInNewTab';
|
|
6
6
|
import {ValidIconName} from "../Icon/canonicalIconNames";
|
|
7
7
|
|
|
8
|
-
interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
internalProps?: Partial<MenuItemProps> & React.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
14
|
-
// FIXME: CMEM-3742: For backward compatibility, should be avoided in all code bases
|
|
15
|
-
[key: string]: any
|
|
8
|
+
export interface MenuItemProps extends Omit<BlueprintMenuItemProps, "icon">, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "target"> {
|
|
9
|
+
/*
|
|
10
|
+
* If set the icon is diplayed on the left side of the menu item.
|
|
11
|
+
*/
|
|
12
|
+
icon?: ValidIconName | string[];
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
/** A single item in a Menu. */
|
|
@@ -20,19 +17,15 @@ function MenuItem({
|
|
|
20
17
|
children,
|
|
21
18
|
className = '',
|
|
22
19
|
icon,
|
|
23
|
-
internalProps,
|
|
24
20
|
onClick,
|
|
25
21
|
href,
|
|
26
22
|
...restProps
|
|
27
|
-
}:
|
|
28
|
-
const actualHref = internalProps?.href ?? href;
|
|
29
|
-
const onClickHandler = internalProps?.onClick ?? onClick;
|
|
23
|
+
}: MenuItemProps) {
|
|
30
24
|
return (
|
|
31
25
|
<BlueprintMenuItem
|
|
32
|
-
{...internalProps}
|
|
33
26
|
{...restProps}
|
|
34
|
-
href={
|
|
35
|
-
onClick={(e) => openInNewTab(e,
|
|
27
|
+
href={href}
|
|
28
|
+
onClick={(e) => openInNewTab(e, onClick, href)}
|
|
36
29
|
className={`${eccgui}-menu__item ` + className}
|
|
37
30
|
icon={
|
|
38
31
|
icon ? <Icon name={icon} /> : false
|
|
@@ -48,7 +48,7 @@ $menu-background-color: transparent !default;
|
|
|
48
48
|
.#{$ns}-menu {
|
|
49
49
|
padding: 0;
|
|
50
50
|
|
|
51
|
-
.#{$ns}-
|
|
51
|
+
.#{$ns}-popover2-content > & {
|
|
52
52
|
padding: $eccgui-size-inline-whitespace / 2;
|
|
53
53
|
min-width: 10em;
|
|
54
54
|
max-width: 20em;
|
|
@@ -69,11 +69,12 @@ $menu-background-color: transparent !default;
|
|
|
69
69
|
|
|
70
70
|
&:hover {
|
|
71
71
|
.#{$ns}-menu-item {
|
|
72
|
-
max-width: none
|
|
72
|
+
max-width: 100vw; // something similar like `none` in this situation
|
|
73
|
+
transition: max-width $pt-transition-duration ease-in 0.75s;
|
|
73
74
|
}
|
|
74
75
|
.#{$ns}-text-overflow-ellipsis {
|
|
75
76
|
opacity: $eccgui-opacity-regular;
|
|
76
|
-
transition: opacity 0.
|
|
77
|
+
transition: opacity $pt-transition-duration ease-in 0.75s;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import {
|
|
3
|
+
Intent as BlueprintIntent,
|
|
4
|
+
HTMLInputProps as BlueprintHTMLInputProps
|
|
5
|
+
} from "@blueprintjs/core";
|
|
6
|
+
import {
|
|
7
|
+
IItemRendererProps as BlueprintItemRendererProps,
|
|
8
|
+
MultiSelect2 as BlueprintMultiSelect,
|
|
9
|
+
MultiSelect2Props as BlueprintMultiSelectProps
|
|
10
|
+
} from "@blueprintjs/select";
|
|
11
|
+
import {
|
|
12
|
+
MenuItem,
|
|
13
|
+
Highlighter,
|
|
14
|
+
Button,
|
|
15
|
+
OverflowText,
|
|
16
|
+
ContextOverlayProps,
|
|
17
|
+
} from "./../../index";
|
|
18
|
+
|
|
9
19
|
import {removeExtraSpaces} from "../../common/utils/stringUtils";
|
|
10
20
|
|
|
11
21
|
export interface SelectedParamsType<T> {
|
|
@@ -14,7 +24,7 @@ export interface SelectedParamsType<T> {
|
|
|
14
24
|
createdItems: Partial<T>[];
|
|
15
25
|
}
|
|
16
26
|
|
|
17
|
-
interface IProps<T> extends Pick<
|
|
27
|
+
interface IProps<T> extends Pick<BlueprintMultiSelectProps<T>, "items" | "placeholder" | "openOnKeyDown"> {
|
|
18
28
|
/**
|
|
19
29
|
* Returns the unique ID of an item. This will be used for equality of items.
|
|
20
30
|
*/
|
|
@@ -33,16 +43,16 @@ interface IProps<T> extends Pick<MultiSelectProps<T>, "items" | "placeholder" |
|
|
|
33
43
|
*/
|
|
34
44
|
onSelection?: (params: SelectedParamsType<T>) => void;
|
|
35
45
|
/**
|
|
36
|
-
* Props to spread to `
|
|
46
|
+
* Props to spread to `ContextOverlay`. Note that `content` cannot be changed.
|
|
37
47
|
*/
|
|
38
|
-
|
|
48
|
+
contextOverlayProps?: Partial<Omit<ContextOverlayProps, "content" | "children">>;
|
|
39
49
|
/**
|
|
40
50
|
* Props to spread to `TagInput`. Use `query` and `onQueryChange` to control the input.
|
|
41
51
|
*/
|
|
42
|
-
tagInputProps?:
|
|
52
|
+
tagInputProps?: BlueprintMultiSelectProps<T>["tagInputProps"];
|
|
43
53
|
|
|
44
54
|
/** Additional properties for the (query) input field of the multi-selection. */
|
|
45
|
-
inputProps?:
|
|
55
|
+
inputProps?: BlueprintHTMLInputProps;
|
|
46
56
|
|
|
47
57
|
/**
|
|
48
58
|
* prop to listen for query changes, when text is entered in the multi-select input
|
|
@@ -50,7 +60,7 @@ interface IProps<T> extends Pick<MultiSelectProps<T>, "items" | "placeholder" |
|
|
|
50
60
|
runOnQueryChange?: (query: string) => Promise<T[] | undefined>;
|
|
51
61
|
/**
|
|
52
62
|
* Whether the component should take up the full width of its container.
|
|
53
|
-
* This overrides `
|
|
63
|
+
* This overrides `tagInputProps.fill`.
|
|
54
64
|
*/
|
|
55
65
|
fullWidth?: boolean;
|
|
56
66
|
/**
|
|
@@ -99,7 +109,7 @@ function MultiSelect<T>({
|
|
|
99
109
|
itemId,
|
|
100
110
|
itemLabel,
|
|
101
111
|
onSelection,
|
|
102
|
-
|
|
112
|
+
contextOverlayProps,
|
|
103
113
|
tagInputProps,
|
|
104
114
|
inputProps,
|
|
105
115
|
runOnQueryChange,
|
|
@@ -221,7 +231,7 @@ function MultiSelect<T>({
|
|
|
221
231
|
/**
|
|
222
232
|
* defines how an item in the item list is displayed
|
|
223
233
|
*/
|
|
224
|
-
const onItemRenderer = (item: T, { handleClick, modifiers }:
|
|
234
|
+
const onItemRenderer = (item: T, { handleClick, modifiers }: BlueprintItemRendererProps) => {
|
|
225
235
|
if (!modifiers.matchesPredicate) {
|
|
226
236
|
return null;
|
|
227
237
|
}
|
|
@@ -361,13 +371,15 @@ function MultiSelect<T>({
|
|
|
361
371
|
}}
|
|
362
372
|
popoverProps={{
|
|
363
373
|
minimal: true,
|
|
364
|
-
|
|
374
|
+
placement: "bottom-start",
|
|
365
375
|
hasBackdrop: true,
|
|
366
|
-
|
|
367
|
-
|
|
376
|
+
fill: true,
|
|
377
|
+
...contextOverlayProps,
|
|
368
378
|
}}
|
|
369
379
|
/>
|
|
370
380
|
);
|
|
371
381
|
}
|
|
372
382
|
|
|
383
|
+
MultiSelect.ofType = BlueprintMultiSelect.ofType;
|
|
384
|
+
|
|
373
385
|
export default MultiSelect;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { loremIpsum } from "react-lorem-ipsum";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Select,
|
|
7
|
+
Button,
|
|
8
|
+
MenuItem,
|
|
9
|
+
} from "../../index";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: "Components/Select",
|
|
13
|
+
component: Select,
|
|
14
|
+
argTypes: {
|
|
15
|
+
},
|
|
16
|
+
} as ComponentMeta<typeof Select>;
|
|
17
|
+
|
|
18
|
+
const Template: ComponentStory<typeof Select> = (args) => (
|
|
19
|
+
<Select {...args}>
|
|
20
|
+
<Button alignText="left" text="Select an element" fill outlined rightIcon="toggler-showmore"/>
|
|
21
|
+
</Select>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({});
|
|
25
|
+
Default.args = {
|
|
26
|
+
items: loremIpsum({ p: 1, avgSentencesPerParagraph: 5, random: false })
|
|
27
|
+
.toString()
|
|
28
|
+
.split(".")
|
|
29
|
+
.map((item) => { return { label: item }}),
|
|
30
|
+
itemRenderer: (item, props) => {
|
|
31
|
+
return <MenuItem text={item.label} />
|
|
32
|
+
},
|
|
33
|
+
fill: true,
|
|
34
|
+
filterable: false,
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Select2 as BlueprintSelect,
|
|
4
|
+
Select2Props as BlueprintSelectProps,
|
|
5
|
+
} from "@blueprintjs/select";
|
|
6
|
+
import { ContextOverlayProps } from "./../../index";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* FIXME: Currently we only route the original element through.
|
|
10
|
+
* We should add here basic elemeents and processes for target and selections, etc.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export interface SelectProps<T> extends Omit<
|
|
14
|
+
BlueprintSelectProps<T>,
|
|
15
|
+
"popoverTargetProps" | "popoverContentProps" | "popoverProps" | "popoverRef"
|
|
16
|
+
> {
|
|
17
|
+
/**
|
|
18
|
+
* Props to spread to `ContextOverlay` that is used to display the dropdown.
|
|
19
|
+
*/
|
|
20
|
+
contextOverlayProps?: Partial<Omit<ContextOverlayProps, "content" | "defaultIsOpen" | "disabled" | "fill" | "renderTarget" | "targetTagName">>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Create a Select box without the HTML select element.
|
|
25
|
+
* It is possible to filter options, as well as to add new options if necessary.
|
|
26
|
+
*/
|
|
27
|
+
function Select<T>({contextOverlayProps, ...otherSelectProps}: SelectProps<T>) {
|
|
28
|
+
return (
|
|
29
|
+
<BlueprintSelect<T>
|
|
30
|
+
popoverProps={{ minimal: true, ...contextOverlayProps}}
|
|
31
|
+
{...otherSelectProps}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Select.ofType = BlueprintSelect.ofType;
|
|
37
|
+
|
|
38
|
+
export default Select;
|
|
@@ -54,10 +54,8 @@ const TabTitle = ({
|
|
|
54
54
|
tabIndex={-1}
|
|
55
55
|
text={text}
|
|
56
56
|
tooltip={disabled ? undefined : tooltip}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
boundary: "window"
|
|
60
|
-
}
|
|
57
|
+
tooltipProps={{
|
|
58
|
+
rootBoundary: "viewport"
|
|
61
59
|
}}
|
|
62
60
|
icon={<>{titlePrefix}</>}
|
|
63
61
|
rightIcon={<>{titleSuffix}</>}
|
|
@@ -33,7 +33,7 @@ $tab-indicator-width: 3px !default;
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
& > .#{$ns}-button, // normal button
|
|
36
|
-
& > span > span >
|
|
36
|
+
& > span > span > .#{$ns}-button { // button with tooltip
|
|
37
37
|
outline: none;
|
|
38
38
|
margin-bottom: $tab-indicator-width;
|
|
39
39
|
max-width: 15rem;
|
|
@@ -86,8 +86,6 @@ $tag-round-adjustment: 0px !default;
|
|
|
86
86
|
.#{$ns}-tag {
|
|
87
87
|
border-width: 1px;
|
|
88
88
|
border-style: solid;
|
|
89
|
-
border-color: rgba($tag-default-color, 0.75);
|
|
90
|
-
background-color: rgba($tag-default-color, 0.75);
|
|
91
89
|
|
|
92
90
|
&:not([class*="#{$ns}-intent-"]) {
|
|
93
91
|
&.#{$eccgui}-tag--strongeremphasis {
|
|
@@ -98,6 +96,10 @@ $tag-round-adjustment: 0px !default;
|
|
|
98
96
|
border-color: rgba($tag-default-color, 0.875);
|
|
99
97
|
background-color: rgba($tag-default-color, 0.875);
|
|
100
98
|
}
|
|
99
|
+
&.#{$eccgui}-tag--normalemphasis {
|
|
100
|
+
border-color: rgba($tag-default-color, 0.75);
|
|
101
|
+
background-color: rgba($tag-default-color, 0.75);
|
|
102
|
+
}
|
|
101
103
|
&.#{$eccgui}-tag--weakemphasis {
|
|
102
104
|
border-color: rgba($tag-default-color, 0.625);
|
|
103
105
|
background-color: rgba($tag-default-color, 0.625);
|
|
@@ -106,27 +108,29 @@ $tag-round-adjustment: 0px !default;
|
|
|
106
108
|
border-color: rgba($tag-default-color, 0.5);
|
|
107
109
|
background-color: rgba($tag-default-color, 0.5);
|
|
108
110
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
&.#{$ns}-minimal:not([class*="#{$ns}-intent-"]) {
|
|
112
|
-
border-color: rgba($tag-default-color, 0.15);
|
|
113
|
-
background-color: rgba(mix(rgba($tag-default-color, 0.15), #fff), 0.75);
|
|
114
111
|
|
|
115
|
-
&.#{$
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
112
|
+
&.#{$ns}-minimal,
|
|
113
|
+
&.#{$ns}-minimal.#{$ns}-interactive {
|
|
114
|
+
&.#{$eccgui}-tag--strongeremphasis {
|
|
115
|
+
border-color: rgba($tag-default-color, 0.3);
|
|
116
|
+
background-color: rgba(mix(rgba($tag-default-color, 0.3), #fff), 1);
|
|
117
|
+
}
|
|
118
|
+
&.#{$eccgui}-tag--strongemphasis {
|
|
119
|
+
border-color: rgba($tag-default-color, 0.225);
|
|
120
|
+
background-color: rgba(mix(rgba($tag-default-color, 0.225), #fff), 0.875);
|
|
121
|
+
}
|
|
122
|
+
&.#{$eccgui}-tag--normalemphasis {
|
|
123
|
+
border-color: rgba($tag-default-color, 0.15);
|
|
124
|
+
background-color: rgba(mix(rgba($tag-default-color, 0.15), #fff), 0.75);
|
|
125
|
+
}
|
|
126
|
+
&.#{$eccgui}-tag--weakemphasis {
|
|
127
|
+
border-color: rgba($tag-default-color, 0.075);
|
|
128
|
+
background-color: rgba(mix(rgba($tag-default-color, 0.075), #fff), 0.625);
|
|
129
|
+
}
|
|
130
|
+
&.#{$eccgui}-tag--weakeremphasis {
|
|
131
|
+
border-color: rgba($tag-default-color, 0.15);
|
|
132
|
+
background-color: rgba(mix(rgba($tag-default-color, 0), #fff), 0.5);
|
|
133
|
+
}
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { loremIpsum } from "react-lorem-ipsum";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Tooltip
|
|
7
|
+
} from "../../index";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Components/Tooltip",
|
|
11
|
+
component: Tooltip,
|
|
12
|
+
argTypes: {
|
|
13
|
+
},
|
|
14
|
+
} as ComponentMeta<typeof Tooltip>;
|
|
15
|
+
|
|
16
|
+
const Template: ComponentStory<typeof Tooltip> = (args) => (
|
|
17
|
+
<Tooltip {...args} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({});
|
|
21
|
+
Default.args = {
|
|
22
|
+
children: <span>hover me</span>,
|
|
23
|
+
content: loremIpsum({
|
|
24
|
+
p: 1,
|
|
25
|
+
avgSentencesPerParagraph: 2,
|
|
26
|
+
random: false
|
|
27
|
+
}).toString(),
|
|
28
|
+
addIndicator: true,
|
|
29
|
+
// this is a workaround to prevent empty functions in code example
|
|
30
|
+
onClose: false,
|
|
31
|
+
// onClosed: false, // this somehow leads to a problem when closed with `<span>` target
|
|
32
|
+
onClosing: false,
|
|
33
|
+
onInteraction: false,
|
|
34
|
+
onOpened: false,
|
|
35
|
+
onOpening: false,
|
|
36
|
+
}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
TOOLTIP2_INDICATOR
|
|
4
|
+
} from "@blueprintjs/popover2/src/classes";
|
|
5
|
+
import {
|
|
6
|
+
Tooltip2 as BlueprintTooltip,
|
|
7
|
+
Tooltip2Props as BlueprintTooltipProps
|
|
8
|
+
} from "@blueprintjs/popover2";
|
|
3
9
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
|
-
import {TooltipProps as BlueprintTooltipProps} from "@blueprintjs/core";
|
|
5
10
|
|
|
6
|
-
export interface TooltipProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
11
|
+
export interface TooltipProps extends Omit<BlueprintTooltipProps, "position"> {
|
|
12
|
+
/**
|
|
13
|
+
* Add dotted underline as visual indication to the target that a tooltip is attached.
|
|
14
|
+
* Should be used together with text-only elements.
|
|
15
|
+
*/
|
|
16
|
+
addIndicator?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The size specifies the dimension the tooltip overlay element can maximal grow.
|
|
19
|
+
*/
|
|
20
|
+
size?: "small" | "medium" | "large";
|
|
21
|
+
/**
|
|
22
|
+
* The tolltip will be attached to this element when it is hovered.
|
|
23
|
+
*/
|
|
24
|
+
children: React.ReactNode | React.ReactNode[];
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
function Tooltip({
|
|
@@ -23,7 +30,6 @@ function Tooltip({
|
|
|
23
30
|
className = "",
|
|
24
31
|
size = "medium",
|
|
25
32
|
addIndicator = false,
|
|
26
|
-
tooltipProps = {},
|
|
27
33
|
...otherProps
|
|
28
34
|
}: TooltipProps) {
|
|
29
35
|
return (
|
|
@@ -32,13 +38,12 @@ function Tooltip({
|
|
|
32
38
|
hoverOpenDelay={500}
|
|
33
39
|
{...otherProps}
|
|
34
40
|
content={content}
|
|
35
|
-
{...tooltipProps}
|
|
36
41
|
className={
|
|
37
42
|
`${eccgui}-tooltip__wrapper` +
|
|
38
43
|
(className ? " " + className : "") +
|
|
39
|
-
(addIndicator === true ? " " +
|
|
44
|
+
(addIndicator === true ? " " + TOOLTIP2_INDICATOR : "")
|
|
40
45
|
}
|
|
41
|
-
targetClassName={`${eccgui}-tooltip__target` + (className ? " " + className + "__target" : "")}
|
|
46
|
+
//targetClassName={`${eccgui}-tooltip__target` + (className ? " " + className + "__target" : "")}
|
|
42
47
|
popoverClassName={
|
|
43
48
|
`${eccgui}-tooltip__content` +
|
|
44
49
|
` ${eccgui}-tooltip--${size}` +
|
|
@@ -3,16 +3,16 @@ $eccgui-size-typo-tooltip: $eccgui-size-typo-caption !default;
|
|
|
3
3
|
$eccgui-size-typo-tooltip-lineheight: $eccgui-size-typo-caption-lineheight !default;
|
|
4
4
|
$eccgui-size-tooltip-width: 20em !default;
|
|
5
5
|
// library vars
|
|
6
|
-
$
|
|
7
|
-
$
|
|
6
|
+
$tooltip2-background-color: $eccgui-color-applicationheader-text; // !default;
|
|
7
|
+
$tooltip2-text-color: $eccgui-color-applicationheader-background; // !default;
|
|
8
8
|
// $dark-tooltip-background-color: $light-gray3 !default;
|
|
9
9
|
// $dark-tooltip-text-color: $dark-gray5 !default;
|
|
10
|
-
$
|
|
11
|
-
$
|
|
10
|
+
$tooltip2-padding-vertical: $eccgui-size-block-whitespace/4; // !default;
|
|
11
|
+
$tooltip2-padding-horizontal: $eccgui-size-block-whitespace/2; // !default;
|
|
12
12
|
|
|
13
|
-
@import "~@blueprintjs/
|
|
13
|
+
@import "~@blueprintjs/popover2/src/tooltip2";
|
|
14
14
|
|
|
15
|
-
.#{$ns}-
|
|
15
|
+
.#{$ns}-tooltip2 {
|
|
16
16
|
font-size: $eccgui-size-typo-tooltip;
|
|
17
17
|
line-height: $eccgui-size-typo-tooltip-lineheight;
|
|
18
18
|
white-space: normal;
|
|
@@ -2,16 +2,17 @@ import React, {memo} from 'react';
|
|
|
2
2
|
import {ContextOverlay} from "../../../index";
|
|
3
3
|
import {CLASSPREFIX as eccgui} from "../../../configuration/constants";
|
|
4
4
|
import {
|
|
5
|
-
IPopoverProps as IBlueprintPopoverProps,
|
|
6
5
|
PopoverInteractionKind as BlueprintPopoverInteractionKind,
|
|
7
6
|
} from "@blueprintjs/core";
|
|
8
7
|
|
|
8
|
+
import { ContextOverlayProps } from "./../../../components/ContextOverlay/ContextOverlay";
|
|
9
|
+
|
|
9
10
|
interface PosOffset {
|
|
10
11
|
left: number;
|
|
11
12
|
top: number;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export interface EdgeToolsProps extends
|
|
15
|
+
export interface EdgeToolsProps extends Omit<ContextOverlayProps, "children"> {
|
|
15
16
|
posOffset: PosOffset;
|
|
16
17
|
children: string | JSX.Element | JSX.Element[];
|
|
17
18
|
}
|
|
@@ -30,9 +31,10 @@ export const EdgeTools = memo(
|
|
|
30
31
|
autoFocus={true}
|
|
31
32
|
interactionKind={BlueprintPopoverInteractionKind.HOVER}
|
|
32
33
|
content={<div className={`${eccgui}-graphviz__edgetools-content`}>{children}</div>}
|
|
33
|
-
target={<div className={`${eccgui}-graphviz__edgetools-target`} style={{ ...posOffset }} />}
|
|
34
34
|
popoverClassName={`${eccgui}-graphviz__edgetools-overlay`}
|
|
35
|
-
|
|
35
|
+
>
|
|
36
|
+
<div className={`${eccgui}-graphviz__edgetools-target`} style={{ ...posOffset }} />
|
|
37
|
+
</ContextOverlay>
|
|
36
38
|
</div>
|
|
37
39
|
);
|
|
38
40
|
}
|