@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
|
@@ -52,7 +52,7 @@ export interface ButtonProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
52
52
|
/**
|
|
53
53
|
* Object with additional properties for the tooltip.
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
tooltipProps?: Partial<Omit<TooltipProps, "content" | "children">>;
|
|
56
56
|
/**
|
|
57
57
|
* If an URL is set then the button is included as HTML anchor element instead of a button form element.
|
|
58
58
|
*/
|
|
@@ -79,7 +79,7 @@ function Button({
|
|
|
79
79
|
icon,
|
|
80
80
|
rightIcon,
|
|
81
81
|
tooltip = null,
|
|
82
|
-
|
|
82
|
+
tooltipProps,
|
|
83
83
|
...restProps
|
|
84
84
|
}: ButtonProps & AnchorOrButtonProps) {
|
|
85
85
|
let intention;
|
|
@@ -117,7 +117,7 @@ function Button({
|
|
|
117
117
|
);
|
|
118
118
|
|
|
119
119
|
return (tooltip && !restProps.loading) ? (
|
|
120
|
-
<Tooltip content={tooltip} {...
|
|
120
|
+
<Tooltip content={tooltip} {...tooltipProps}>
|
|
121
121
|
<span>{button}</span>
|
|
122
122
|
</Tooltip>
|
|
123
123
|
) : (
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ContextMenu,
|
|
6
|
+
MenuItem,
|
|
7
|
+
} from "../../index";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Components/ContextMenu",
|
|
11
|
+
component: ContextMenu,
|
|
12
|
+
subcomponents: { MenuItem },
|
|
13
|
+
argTypes: {
|
|
14
|
+
children: {
|
|
15
|
+
control: "none",
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
} as ComponentMeta<typeof ContextMenu>;
|
|
19
|
+
|
|
20
|
+
const Template: ComponentStory<typeof ContextMenu> = (args) => (
|
|
21
|
+
<ContextMenu {...args} />
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({});
|
|
25
|
+
Default.args = {
|
|
26
|
+
children: [
|
|
27
|
+
<MenuItem key="m0" text={"First option"} />,
|
|
28
|
+
<MenuItem key="m1" text={"Item two"} />
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -1,20 +1,54 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {ReactElement} from "react";
|
|
2
2
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
|
-
import
|
|
3
|
+
import { TestableComponent } from "../interfaces";
|
|
4
|
+
import ContextOverlay, { ContextOverlayProps } from "./ContextOverlay";
|
|
4
5
|
import Menu from "../Menu/Menu";
|
|
5
6
|
import IconButton from "../Icon/IconButton";
|
|
6
7
|
import {ValidIconName} from "../Icon/canonicalIconNames";
|
|
7
8
|
|
|
8
|
-
interface ContextMenuProps {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
interface ContextMenuProps extends TestableComponent {
|
|
10
|
+
/**
|
|
11
|
+
* Addional CSS class names.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The elements of the context menu.
|
|
16
|
+
* They will be wrapped in a `Menu` element automatically.
|
|
17
|
+
*/
|
|
18
|
+
children?: JSX.Element | JSX.Element[];
|
|
19
|
+
/**
|
|
20
|
+
* Toggler that need to be used to display menu.
|
|
21
|
+
* If a valid icon name is used then the icon element is displayed.
|
|
22
|
+
* In this case `togglerText`, `togglerLarge` and `tooltipAsTitle` are used, too.
|
|
23
|
+
*/
|
|
24
|
+
togglerElement?: ValidIconName | JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* Text displayed as title or tooltip on toggler element.
|
|
27
|
+
*/
|
|
28
|
+
togglerText?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Toggler element is displayed larger than normal.
|
|
31
|
+
*/
|
|
32
|
+
togglerLarge?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Tooltip on toggler element is display as HTML title, not as extra tooltip element.
|
|
35
|
+
*/
|
|
36
|
+
tooltipAsTitle?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Props to spread to `ContextOverlay` that is used to display the dropdown.
|
|
39
|
+
*/
|
|
40
|
+
contextOverlayProps?: Partial<Omit<ContextOverlayProps, "content" | "children" | "className">>
|
|
11
41
|
}
|
|
12
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Element displays menu items after toggler is clicked.
|
|
45
|
+
*/
|
|
13
46
|
function ContextMenu({
|
|
14
47
|
children,
|
|
15
48
|
className = "",
|
|
16
49
|
togglerElement = "item-moremenu",
|
|
17
50
|
togglerText = "Show more options",
|
|
51
|
+
contextOverlayProps,
|
|
18
52
|
togglerLarge = false,
|
|
19
53
|
/* FIXME: The Tooltip component can interfere with the opened menu, since it is implemented via portal and may cover the menu,
|
|
20
54
|
so by default we use the title attribute instead of Tooltip. */
|
|
@@ -22,7 +56,12 @@ function ContextMenu({
|
|
|
22
56
|
...restProps
|
|
23
57
|
}: ContextMenuProps) {
|
|
24
58
|
return (
|
|
25
|
-
<ContextOverlay
|
|
59
|
+
<ContextOverlay
|
|
60
|
+
{...restProps}
|
|
61
|
+
{...contextOverlayProps}
|
|
62
|
+
className={`${eccgui}-contextmenu ` + className}
|
|
63
|
+
content={<Menu>{children}</Menu>}
|
|
64
|
+
>
|
|
26
65
|
{typeof togglerElement === "string" ? (
|
|
27
66
|
<IconButton
|
|
28
67
|
tooltipAsTitle={tooltipAsTitle}
|
|
@@ -32,9 +71,8 @@ function ContextMenu({
|
|
|
32
71
|
data-test-id={restProps["data-test-id"]}
|
|
33
72
|
/>
|
|
34
73
|
) : (
|
|
35
|
-
|
|
74
|
+
togglerElement as ReactElement
|
|
36
75
|
)}
|
|
37
|
-
<Menu>{children}</Menu>
|
|
38
76
|
</ContextOverlay>
|
|
39
77
|
);
|
|
40
78
|
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { LoremIpsum } from 'react-lorem-ipsum';
|
|
4
|
+
import {
|
|
5
|
+
PopoverPosition,
|
|
6
|
+
PopoverInteractionKind,
|
|
7
|
+
PopperModifiers,
|
|
8
|
+
} from "@blueprintjs/core";
|
|
9
|
+
import {
|
|
10
|
+
PlacementOptions
|
|
11
|
+
} from "@blueprintjs/popover2";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
ContextOverlay,
|
|
15
|
+
HtmlContentBlock,
|
|
16
|
+
Button
|
|
17
|
+
} from "../../index";
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: "Components/ContextOverlay",
|
|
21
|
+
component: ContextOverlay,
|
|
22
|
+
argTypes: {
|
|
23
|
+
className: {
|
|
24
|
+
control: "string",
|
|
25
|
+
description: "A space-delimited list of class names to pass along to a child element."
|
|
26
|
+
},
|
|
27
|
+
defaultIsOpen: {
|
|
28
|
+
control: "boolean",
|
|
29
|
+
description: "Initial opened state when uncontrolled."
|
|
30
|
+
},
|
|
31
|
+
isOpen: {
|
|
32
|
+
control: "boolean",
|
|
33
|
+
description: "Whether the popover is visible. Passing this prop puts the popover in controlled mode, where the only way to change visibility is by updating this property."
|
|
34
|
+
},
|
|
35
|
+
interactionKind: {
|
|
36
|
+
control: "select",
|
|
37
|
+
options: {UNDEFINED: undefined, ...PopoverInteractionKind},
|
|
38
|
+
description: "The kind of interaction that triggers the display of the popover."
|
|
39
|
+
},
|
|
40
|
+
canEscapeKeyClose: {
|
|
41
|
+
control: "boolean",
|
|
42
|
+
description: "Whether pressing the esc key should invoke `onClose`."
|
|
43
|
+
},
|
|
44
|
+
onClose: {
|
|
45
|
+
control: "none",
|
|
46
|
+
description: "A callback that is invoked when user interaction causes the overlay to close, such as clicking on the overlay or pressing the esc key (if enabled).",
|
|
47
|
+
table: {
|
|
48
|
+
defaultValue: { summary: undefined },
|
|
49
|
+
type: { summary: "(event: SyntheticEvent<HTMLElement>) => void" },
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
onInteraction: {
|
|
53
|
+
control: "none",
|
|
54
|
+
description: "Callback invoked in controlled mode when the popover open state would change due to user interaction.",
|
|
55
|
+
table: {
|
|
56
|
+
defaultValue: { summary: undefined },
|
|
57
|
+
type: { summary: "(nextOpenState: boolean, e?: React.SyntheticEvent<HTMLElement>) => void" },
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
children: {
|
|
61
|
+
control: "none",
|
|
62
|
+
},
|
|
63
|
+
content: {
|
|
64
|
+
control: "none",
|
|
65
|
+
description: "Elements for overlay content."
|
|
66
|
+
},
|
|
67
|
+
minimal: {
|
|
68
|
+
control: "boolean",
|
|
69
|
+
description: "Whether to apply minimal styling to this popover or tooltip. Minimal popovers do not have an arrow pointing to their target and use a subtler animation."
|
|
70
|
+
},
|
|
71
|
+
placement: {
|
|
72
|
+
control: "select",
|
|
73
|
+
options: PlacementOptions,
|
|
74
|
+
description: "The placement (relative to the target) at which the popover should appear. Mutually exclusive with `position` prop."
|
|
75
|
+
},
|
|
76
|
+
/*
|
|
77
|
+
position: {
|
|
78
|
+
control: "select",
|
|
79
|
+
options: {UNDEFINED: undefined, ...PopoverPosition},
|
|
80
|
+
description: "The position (relative to the target) at which the popover should appear. Mutually exclusive with `placement` prop."
|
|
81
|
+
},
|
|
82
|
+
*/
|
|
83
|
+
usePortal: {
|
|
84
|
+
control: "boolean",
|
|
85
|
+
description: "Whether the popover should be rendered inside a Portal attached to `portalContainer` prop."
|
|
86
|
+
},
|
|
87
|
+
modifiers: {
|
|
88
|
+
control: "object",
|
|
89
|
+
description: "Popper modifier options, passed directly to internal Popper instance. See https://popper.js.org/docs/v2/modifiers/ for complete details.",
|
|
90
|
+
table: {
|
|
91
|
+
defaultValue: { summary: undefined },
|
|
92
|
+
type: { summary: "PopperModifiers" },
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
hasBackdrop: {
|
|
96
|
+
control: "boolean",
|
|
97
|
+
description: "Enables an invisible overlay beneath the popover that captures clicks and prevents interaction with the rest of the document until the popover is closed, only available with `PopoverInteractionKind.CLICK`."
|
|
98
|
+
},
|
|
99
|
+
rootBoundary: {
|
|
100
|
+
control: "select",
|
|
101
|
+
options: {UNDEFINED: undefined, VIEWPORT: "viewport", DOCUMENT: "document"},
|
|
102
|
+
description: "A root boundary element supplied to the `flip` and `preventOverflow` modifiers, shorthand for overriding Popper.js modifier options. See: https://popper.js.org/docs/v2/utils/detect-overflow/#rootboundary",
|
|
103
|
+
table: {
|
|
104
|
+
defaultValue: { summary: "viewport" },
|
|
105
|
+
type: { summary: "RootBoundary" },
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
positioningStrategy: {
|
|
109
|
+
control: "select",
|
|
110
|
+
options: {UNDEFINED: undefined, ABSOLUTE: "absolute", FIXED: "fixed"},
|
|
111
|
+
description: "Popper.js positioning strategy. See: https://popper.js.org/docs/v2/constructors/#strategy",
|
|
112
|
+
table: {
|
|
113
|
+
defaultValue: { summary: "absolute" },
|
|
114
|
+
type: { summary: "PositioningStrategy" },
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
} as ComponentMeta<typeof ContextOverlay>;
|
|
119
|
+
|
|
120
|
+
const Template: ComponentStory<typeof ContextOverlay> = (args) => (
|
|
121
|
+
<ContextOverlay {...args} />
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
export const Default = Template.bind({});
|
|
125
|
+
Default.args = {
|
|
126
|
+
children: <Button>Target</Button>,
|
|
127
|
+
content: (
|
|
128
|
+
<HtmlContentBlock style={{maxWidth: "40em", padding: "0.5rem"}}>
|
|
129
|
+
Overlay:
|
|
130
|
+
<LoremIpsum p={2} avgSentencesPerParagraph={4} random={false} />
|
|
131
|
+
</HtmlContentBlock>
|
|
132
|
+
),
|
|
133
|
+
//position: PopoverPosition.RIGHT,
|
|
134
|
+
placement: "auto-start",
|
|
135
|
+
usePortal: true,
|
|
136
|
+
minimal: false,
|
|
137
|
+
defaultIsOpen: false,
|
|
138
|
+
modifiers: {
|
|
139
|
+
flip: {
|
|
140
|
+
enabled: true
|
|
141
|
+
},
|
|
142
|
+
preventOverflow: {
|
|
143
|
+
enabled: true,
|
|
144
|
+
}
|
|
145
|
+
} as PopperModifiers,
|
|
146
|
+
rootBoundary: "viewport",
|
|
147
|
+
hasBackdrop: false,
|
|
148
|
+
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Popover2 as BlueprintPropover,
|
|
4
|
+
Popover2Props as BlueprintPopoverProps,
|
|
5
|
+
} from "@blueprintjs/popover2";
|
|
3
6
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export interface ContextOverlayProps extends Omit<BlueprintPopoverProps, "position"> {
|
|
9
|
+
/**
|
|
10
|
+
* `target` element to use as toggler for the overlay display.
|
|
11
|
+
*/
|
|
12
|
+
children?: JSX.Element;
|
|
13
|
+
}
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Element displays connected content by interacting with a target element.
|
|
17
|
+
* Full list of available option can be seen at https://blueprintjs.com/docs/#popover2-package/popover2
|
|
18
|
+
*/
|
|
12
19
|
function ContextOverlay({
|
|
13
20
|
children,
|
|
14
21
|
className='',
|
|
15
22
|
...restProps
|
|
16
|
-
}:
|
|
23
|
+
}: ContextOverlayProps) {
|
|
17
24
|
|
|
18
25
|
return (
|
|
19
26
|
<BlueprintPropover
|
|
20
|
-
|
|
27
|
+
placement="bottom"
|
|
21
28
|
{...restProps}
|
|
22
29
|
className={`${eccgui}-contextoverlay ` + className}
|
|
23
30
|
>
|
|
@@ -3,13 +3,13 @@ $popover-background-color: $white !default;
|
|
|
3
3
|
$dark-popover-background-color: $dark-gray4 !default;
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
@import "~@blueprintjs/
|
|
6
|
+
@import "~@blueprintjs/popover2/src/popover2";
|
|
7
7
|
|
|
8
|
-
.#{$ns}-
|
|
8
|
+
.#{$ns}-popover2-content {
|
|
9
9
|
max-width: 100%;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.#{$ns}-
|
|
12
|
+
.#{$ns}-popover2-target {
|
|
13
13
|
cursor: pointer;
|
|
14
14
|
max-width: 100%;
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Label from "../Label/Label";
|
|
2
|
+
import Label, { LabelProps } from "../Label/Label";
|
|
3
3
|
import {ClassNames as IntentClassNames} from "../../common/Intent";
|
|
4
4
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
5
|
import {TestableComponent} from "../interfaces";
|
|
@@ -21,7 +21,7 @@ interface IProps extends TestableComponent {
|
|
|
21
21
|
children: JSX.Element | JSX.Element[] | null
|
|
22
22
|
className?: string
|
|
23
23
|
disabled?: boolean
|
|
24
|
-
|
|
24
|
+
labelProps?: LabelProps
|
|
25
25
|
helperText?: string | JSX.Element
|
|
26
26
|
messageText?: string
|
|
27
27
|
}
|
|
@@ -34,7 +34,7 @@ function FieldItem({
|
|
|
34
34
|
children,
|
|
35
35
|
className,
|
|
36
36
|
disabled,
|
|
37
|
-
|
|
37
|
+
labelProps,
|
|
38
38
|
helperText,
|
|
39
39
|
messageText,
|
|
40
40
|
...otherProps
|
|
@@ -57,7 +57,7 @@ function FieldItem({
|
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const label = <Label {...
|
|
60
|
+
const label = <Label {...labelProps} disabled={disabled} />;
|
|
61
61
|
|
|
62
62
|
const userhelp =
|
|
63
63
|
helperText &&
|
|
@@ -6,24 +6,40 @@ import Tooltip, { TooltipProps } from "./../Tooltip/Tooltip";
|
|
|
6
6
|
import canonicalIcons, {IconSized, ValidIconName} from "./canonicalIconNames"
|
|
7
7
|
|
|
8
8
|
export interface IconProps extends Omit<CarbonIconProps, "icon" | "description" | "name"> {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Canonical icon name, or an array of strings.
|
|
11
|
+
* In case of the array the first valid icon name is used.
|
|
12
|
+
*/
|
|
12
13
|
name: ValidIconName | string[],
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
large?: boolean,
|
|
17
|
-
// Display small icon version
|
|
18
|
-
small?: boolean,
|
|
19
|
-
// Add tooltip text to icon
|
|
14
|
+
/**
|
|
15
|
+
* Add tooltip text to icon
|
|
16
|
+
*/
|
|
20
17
|
tooltipText?: string,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Intent state of icon (currently only success, info, warning and danger are implemented in style rules)
|
|
18
|
+
/**
|
|
19
|
+
* Intent state of icon.
|
|
20
|
+
* Currently only `success`, `info`, `warning` and `danger` are implemented for icons, even there are more states available.
|
|
21
|
+
*/
|
|
26
22
|
intent?: IntentTypes
|
|
23
|
+
/**
|
|
24
|
+
* Display large icon version.
|
|
25
|
+
*/
|
|
26
|
+
large?: boolean,
|
|
27
|
+
/**
|
|
28
|
+
* Display small icon version.
|
|
29
|
+
*/
|
|
30
|
+
small?: boolean,
|
|
31
|
+
/**
|
|
32
|
+
* Additional CSS classes.
|
|
33
|
+
*/
|
|
34
|
+
className?: string,
|
|
35
|
+
/**
|
|
36
|
+
* Description for icon as accessibility fallback.
|
|
37
|
+
*/
|
|
38
|
+
description?: string,
|
|
39
|
+
/**
|
|
40
|
+
* Additonal tooltip properties, e.g. `hoverOpenDelay`.
|
|
41
|
+
*/
|
|
42
|
+
tooltipProps?: Partial<Omit<TooltipProps, "content" | "children">>,
|
|
27
43
|
}
|
|
28
44
|
|
|
29
45
|
/** Returns the first icon that exists or the fallback icon. */
|
|
@@ -56,8 +72,7 @@ function Icon({
|
|
|
56
72
|
large = false,
|
|
57
73
|
small = false,
|
|
58
74
|
tooltipText,
|
|
59
|
-
|
|
60
|
-
tooltipProperties,
|
|
75
|
+
tooltipProps,
|
|
61
76
|
intent,
|
|
62
77
|
...restProps
|
|
63
78
|
}: IconProps) {
|
|
@@ -85,7 +100,7 @@ function Icon({
|
|
|
85
100
|
/>
|
|
86
101
|
);
|
|
87
102
|
return tooltipText ? (
|
|
88
|
-
<Tooltip content={tooltipText}
|
|
103
|
+
<Tooltip content={tooltipText} {...tooltipProps}>
|
|
89
104
|
<span>{icon}</span>
|
|
90
105
|
</Tooltip>
|
|
91
106
|
) : (
|
|
@@ -4,24 +4,30 @@ import {CLASSPREFIX as eccgui} from "../../configuration/constants";
|
|
|
4
4
|
import Icon from "./Icon";
|
|
5
5
|
import {ValidIconName} from "./canonicalIconNames";
|
|
6
6
|
|
|
7
|
-
interface IconButtonProps extends ButtonProps {
|
|
8
|
-
|
|
7
|
+
interface IconButtonProps extends Omit<ButtonProps, "icon" | "rightIcon" | "text" | "minimal" | "tooltip"> {
|
|
8
|
+
/**
|
|
9
|
+
* Canonical icon name, or an array of strings.
|
|
10
|
+
* In case of the array the first valid icon name is used.
|
|
11
|
+
*/
|
|
9
12
|
name: ValidIconName | string[]
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Button text, will be displayed as tooltip.
|
|
15
|
+
*/
|
|
12
16
|
text?: string,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// Display small icon version
|
|
18
|
-
small?: boolean
|
|
19
|
-
// If the tooltip should be set as title attribute instead of the Tooltip component. If true, all other tooltip parameters are ignored.
|
|
17
|
+
/**
|
|
18
|
+
* If `text` should be set as HTML `title` attribute instead of attaching it as tooltip.
|
|
19
|
+
* If true then `tooltipProps` is ignored.
|
|
20
|
+
*/
|
|
20
21
|
tooltipAsTitle?: boolean
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Description for icon as accessibility fallback.
|
|
24
|
+
* If not set then `text` is used.
|
|
25
|
+
*/
|
|
24
26
|
description?: string
|
|
27
|
+
/**
|
|
28
|
+
* Button is displayed with minimal styles (no borders, no background color).
|
|
29
|
+
*/
|
|
30
|
+
minimal?: boolean;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/** A button with an icon instead of text. */
|
|
@@ -29,10 +35,10 @@ function IconButton({
|
|
|
29
35
|
className = "",
|
|
30
36
|
name = "undefined",
|
|
31
37
|
text,
|
|
32
|
-
|
|
38
|
+
tooltipProps,
|
|
33
39
|
description,
|
|
34
|
-
tooltipOpenDelay = 1000,
|
|
35
40
|
tooltipAsTitle = false,
|
|
41
|
+
minimal=true,
|
|
36
42
|
...restProps
|
|
37
43
|
}: IconButtonProps & AnchorOrButtonProps) {
|
|
38
44
|
return (
|
|
@@ -45,13 +51,12 @@ function IconButton({
|
|
|
45
51
|
small={restProps.small}
|
|
46
52
|
large={restProps.large}
|
|
47
53
|
tooltipText={tooltipAsTitle ? undefined : text}
|
|
48
|
-
|
|
49
|
-
tooltipProperties={!!tooltipProperties ? tooltipProperties : {}}
|
|
54
|
+
tooltipProps={!!tooltipProps ? {hoverOpenDelay: 1000, ...tooltipProps} : {hoverOpenDelay: 1000}}
|
|
50
55
|
description={description ? description : text}
|
|
51
56
|
/>
|
|
52
57
|
}
|
|
53
58
|
className={`${eccgui}-button--icon ` + className}
|
|
54
|
-
minimal
|
|
59
|
+
minimal={minimal}
|
|
55
60
|
/>
|
|
56
61
|
);
|
|
57
62
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Icon,
|
|
6
|
+
Button,
|
|
7
|
+
} from "../../../index";
|
|
8
|
+
import canonicalIcons, { ValidIconName } from "./../canonicalIconNames";
|
|
9
|
+
import { Definitions } from "../../../common/Intent";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: "Components/Icon",
|
|
13
|
+
component: Icon,
|
|
14
|
+
argTypes: {
|
|
15
|
+
name: {
|
|
16
|
+
control: "select",
|
|
17
|
+
options: [...(Object.keys(canonicalIcons))],
|
|
18
|
+
},
|
|
19
|
+
intent: {
|
|
20
|
+
control: "select",
|
|
21
|
+
options: {...Definitions},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
} as ComponentMeta<typeof Icon>;
|
|
25
|
+
|
|
26
|
+
const Template: ComponentStory<typeof Icon> = (args) => (
|
|
27
|
+
<Icon {...args} tooltipText={args.name?.toString()}/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const Default = Template.bind({});
|
|
31
|
+
Default.args = {
|
|
32
|
+
name: "undefined"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const IconsOverview = () => {
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
{
|
|
39
|
+
Object.keys(canonicalIcons).map((iconName) => {
|
|
40
|
+
return (
|
|
41
|
+
<Button
|
|
42
|
+
icon={iconName as ValidIconName}
|
|
43
|
+
outlined
|
|
44
|
+
large
|
|
45
|
+
tooltip={iconName}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IconButton,
|
|
6
|
+
} from "../../../index";
|
|
7
|
+
import canonicalIcons from "./../canonicalIconNames";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Components/IconButton",
|
|
11
|
+
component: IconButton,
|
|
12
|
+
argTypes: {
|
|
13
|
+
name: {
|
|
14
|
+
control: "select",
|
|
15
|
+
options: [...(Object.keys(canonicalIcons))],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} as ComponentMeta<typeof IconButton>;
|
|
19
|
+
|
|
20
|
+
const Template: ComponentStory<typeof IconButton> = (args) => (
|
|
21
|
+
<IconButton {...args} text={args.name?.toString()}/>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({});
|
|
25
|
+
Default.args = {
|
|
26
|
+
name: "item-moremenu"
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { loremIpsum } from "react-lorem-ipsum";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Label
|
|
7
|
+
} from "../../index";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Components/Label",
|
|
11
|
+
component: Label,
|
|
12
|
+
argTypes: {
|
|
13
|
+
},
|
|
14
|
+
} as ComponentMeta<typeof Label>;
|
|
15
|
+
|
|
16
|
+
const Template: ComponentStory<typeof Label> = (args) => (
|
|
17
|
+
<Label {...args} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({});
|
|
21
|
+
Default.args = {
|
|
22
|
+
text: "Label text",
|
|
23
|
+
info: loremIpsum({ p: 1, avgSentencesPerParagraph: 1, avgWordsPerSentence: 4, random: false }).toString(),
|
|
24
|
+
tooltip: loremIpsum({ p: 1, avgSentencesPerParagraph: 2, startWithLoremIpsum: false, random: false }).toString(),
|
|
25
|
+
disabled: false,
|
|
26
|
+
htmlFor: "inputid",
|
|
27
|
+
}
|