@eccenca/gui-elements 23.2.0-rc.1 → 23.3.0-rc.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 +42 -0
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/cjs/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +12 -0
- package/dist/cjs/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
- package/dist/cjs/components/Application/ApplicationHeader.js +2 -3
- package/dist/cjs/components/Application/ApplicationHeader.js.map +1 -1
- package/dist/cjs/components/Dialog/Modal.js +17 -8
- package/dist/cjs/components/Dialog/Modal.js.map +1 -1
- package/dist/cjs/components/Dialog/SimpleDialog.js +19 -6
- package/dist/cjs/components/Dialog/SimpleDialog.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js +1 -1
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +1 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js +3 -6
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/cjs/components/PropertyValuePair/PropertyName.js +3 -3
- package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/cjs/components/Select/Select.js +1 -0
- package/dist/cjs/components/Select/Select.js.map +1 -1
- package/dist/cjs/components/Separation/Spacing.js +18 -4
- package/dist/cjs/components/Separation/Spacing.js.map +1 -1
- package/dist/cjs/components/TextField/TextField.js +23 -3
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +39 -7
- package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +26 -5
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js +27 -0
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -0
- package/dist/cjs/extensions/react-flow/index.js +2 -0
- package/dist/cjs/extensions/react-flow/index.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +25 -5
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/cmem/markdown/Markdown.js +1 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +6 -0
- package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
- package/dist/esm/components/Application/ApplicationHeader.js +2 -3
- package/dist/esm/components/Application/ApplicationHeader.js.map +1 -1
- package/dist/esm/components/Dialog/Modal.js +18 -9
- package/dist/esm/components/Dialog/Modal.js.map +1 -1
- package/dist/esm/components/Dialog/SimpleDialog.js +20 -7
- package/dist/esm/components/Dialog/SimpleDialog.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js +1 -1
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +1 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +3 -6
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/esm/components/PropertyValuePair/PropertyName.js +3 -3
- package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/esm/components/Select/Select.js +1 -0
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Separation/Spacing.js +28 -4
- package/dist/esm/components/Separation/Spacing.js.map +1 -1
- package/dist/esm/components/TextField/TextField.js +25 -5
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +49 -6
- package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +45 -8
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleTools.js +31 -0
- package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -0
- package/dist/esm/extensions/react-flow/index.js +2 -0
- package/dist/esm/extensions/react-flow/index.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +32 -12
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/types/cmem/react-flow/extensions/ReactFlowHotkeyContext.d.ts +8 -0
- package/dist/types/components/Application/ApplicationHeader.d.ts +1 -2
- package/dist/types/components/Dialog/Modal.d.ts +13 -6
- package/dist/types/components/Dialog/SimpleDialog.d.ts +14 -3
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
- package/dist/types/components/Separation/Spacing.d.ts +2 -2
- package/dist/types/components/TextField/TextField.d.ts +4 -2
- package/dist/types/extensions/codemirror/CodeMirror.d.ts +17 -3
- package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +2 -2
- package/dist/types/extensions/react-flow/handles/HandleTools.d.ts +6 -0
- package/dist/types/extensions/react-flow/index.d.ts +2 -0
- package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +21 -1
- package/package.json +14 -12
- package/scripts/compile-sass.ts +1 -1
- package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +10 -0
- package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -12
- package/src/cmem/react-flow/extensions/ReactFlowHotkeyContext.ts +14 -0
- package/src/components/Application/ApplicationHeader.tsx +8 -13
- package/src/components/Application/_header.scss +51 -60
- package/src/components/Application/_toolbar.scss +22 -33
- package/src/components/AutoSuggestion/tests/AutoSuggestion.test.tsx +34 -21
- package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +20 -9
- package/src/components/Dialog/Modal.tsx +62 -37
- package/src/components/Dialog/SimpleDialog.tsx +39 -34
- package/src/components/Dialog/dialog.scss +29 -17
- package/src/components/Icon/IconButton.tsx +1 -1
- package/src/components/Icon/canonicalIconNames.tsx +2 -0
- package/src/components/OverviewItem/OverviewItemDepiction.tsx +8 -16
- package/src/components/PropertyValuePair/PropertyName.tsx +15 -4
- package/src/components/Select/Select.tsx +3 -0
- package/src/components/Select/_select.scss +1 -1
- package/src/components/Separation/Spacing.tsx +12 -8
- package/src/components/TextField/TextField.tsx +32 -6
- package/src/components/Tooltip/tooltip.scss +15 -1
- package/src/extensions/codemirror/CodeMirror.tsx +62 -8
- package/src/extensions/codemirror/_codemirror.scss +53 -8
- package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +43 -44
- package/src/extensions/react-flow/handles/HandleDefault.tsx +40 -33
- package/src/extensions/react-flow/handles/HandleTools.tsx +22 -0
- package/src/extensions/react-flow/handles/_handles.scss +64 -44
- package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +33 -27
- package/src/extensions/react-flow/index.ts +2 -0
- package/src/extensions/react-flow/nodes/NodeContent.tsx +62 -2
- package/src/extensions/react-flow/nodes/_nodes.scss +170 -110
- package/src/extensions/react-flow/nodes/stories/NodeDefault.stories.tsx +32 -34
|
@@ -1,57 +1,79 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Classes as BlueprintClassNames,
|
|
4
|
-
OverlayProps, Overlay as BlueprintOverlay,
|
|
5
4
|
IOverlayState,
|
|
5
|
+
Overlay as BlueprintOverlay,
|
|
6
|
+
OverlayProps,
|
|
6
7
|
} from "@blueprintjs/core";
|
|
7
|
-
|
|
8
|
-
import {CLASSPREFIX as eccgui} from "../../configuration/constants";
|
|
8
|
+
|
|
9
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
10
|
+
|
|
11
|
+
import { Card } from "./../Card";
|
|
9
12
|
|
|
10
13
|
export interface ModalProps extends OverlayProps, IOverlayState {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
14
|
+
children: React.ReactNode | React.ReactNode[];
|
|
15
|
+
/**
|
|
16
|
+
* A space-delimited list of class names to pass along to the BlueprintJS `Overlay` element that is used to create the modal.
|
|
17
|
+
*/
|
|
18
|
+
overlayClassName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Size of the modal.
|
|
21
|
+
*/
|
|
22
|
+
size?: "tiny" | "small" | "regular" | "large" | "xlarge" | "fullscreen";
|
|
23
|
+
/**
|
|
24
|
+
* Prevents that a backdrop area is displayed behind the modal elements.
|
|
25
|
+
*/
|
|
26
|
+
preventBackdrop?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Optional props for the wrapper div element inside the modal overlay.
|
|
29
|
+
*/
|
|
30
|
+
wrapperDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
31
|
+
/**
|
|
32
|
+
* Make the modal focusable, e.g. when clicking somewhere on it.
|
|
33
|
+
* This is needed, e.g. when capturing key (down, up) events that should bubble to the modal's parent elements.
|
|
34
|
+
*/
|
|
35
|
+
modalFocusable?: boolean;
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
/**
|
|
29
39
|
* Displays contents on top of other elements, used to create dialogs.
|
|
30
|
-
* For most situations the usage of `SimpleDialog` and `AlertDialog` should be
|
|
40
|
+
* For most situations the usage of `SimpleDialog` and `AlertDialog` should be sufficient.
|
|
31
41
|
* Otherwise this element can be used to create own modal elements and edge cases for modal dialogs.
|
|
32
42
|
* Then it is recommended to use the `Card` element inside.
|
|
33
43
|
*/
|
|
34
44
|
export const Modal = ({
|
|
35
45
|
children,
|
|
36
|
-
className=
|
|
37
|
-
overlayClassName=
|
|
38
|
-
size="regular",
|
|
39
|
-
canOutsideClickClose=false,
|
|
40
|
-
canEscapeKeyClose=false,
|
|
41
|
-
preventBackdrop=false,
|
|
46
|
+
className = "",
|
|
47
|
+
overlayClassName = "",
|
|
48
|
+
size = "regular",
|
|
49
|
+
canOutsideClickClose = false,
|
|
50
|
+
canEscapeKeyClose = false,
|
|
51
|
+
preventBackdrop = false,
|
|
42
52
|
wrapperDivProps,
|
|
53
|
+
modalFocusable = true,
|
|
43
54
|
...otherProps
|
|
44
55
|
}: ModalProps) => {
|
|
56
|
+
const backdropProps: React.HTMLProps<HTMLDivElement> | undefined =
|
|
57
|
+
!canOutsideClickClose && canEscapeKeyClose
|
|
58
|
+
? {
|
|
59
|
+
...otherProps.backdropProps,
|
|
60
|
+
// Escape key won't work anymore otherwise after clicking on the backdrop
|
|
61
|
+
tabIndex: 0,
|
|
62
|
+
}
|
|
63
|
+
: otherProps.backdropProps;
|
|
64
|
+
|
|
65
|
+
const focusableProps = modalFocusable
|
|
66
|
+
? {
|
|
67
|
+
tabIndex: 0,
|
|
68
|
+
}
|
|
69
|
+
: undefined;
|
|
45
70
|
|
|
46
71
|
const alteredChildren = React.Children.map(children, (child) => {
|
|
47
|
-
if ((child as React.ReactElement).type && (child
|
|
48
|
-
return React.cloneElement(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
elevation: 4
|
|
53
|
-
}
|
|
54
|
-
);
|
|
72
|
+
if ((child as React.ReactElement).type && (child as React.ReactElement).type === Card) {
|
|
73
|
+
return React.cloneElement(child as React.ReactElement, {
|
|
74
|
+
isOnlyLayout: true,
|
|
75
|
+
elevation: 4,
|
|
76
|
+
});
|
|
55
77
|
}
|
|
56
78
|
|
|
57
79
|
return child;
|
|
@@ -60,6 +82,7 @@ export const Modal = ({
|
|
|
60
82
|
return (
|
|
61
83
|
<BlueprintOverlay
|
|
62
84
|
{...otherProps}
|
|
85
|
+
backdropProps={backdropProps}
|
|
63
86
|
className={overlayClassName}
|
|
64
87
|
backdropClassName={`${eccgui}-dialog__backdrop`}
|
|
65
88
|
canOutsideClickClose={canOutsideClickClose}
|
|
@@ -71,12 +94,14 @@ export const Modal = ({
|
|
|
71
94
|
className={BlueprintClassNames.DIALOG_CONTAINER}
|
|
72
95
|
// this is a workaround because data attribute on SimpleDialog is not correctly routed to the overlay by blueprint js
|
|
73
96
|
data-test-id={(otherProps as any)["data-test-id"] ?? "simpleDialogWidget"}
|
|
97
|
+
{...focusableProps}
|
|
98
|
+
tabIndex={0}
|
|
74
99
|
>
|
|
75
100
|
<section
|
|
76
101
|
className={
|
|
77
102
|
`${eccgui}-dialog__wrapper` +
|
|
78
|
-
(typeof size ===
|
|
79
|
-
(className ?
|
|
103
|
+
(typeof size === "string" ? ` ${eccgui}-dialog__wrapper--` + size : "") +
|
|
104
|
+
(className ? " " + className : "")
|
|
80
105
|
}
|
|
81
106
|
>
|
|
82
107
|
{alteredChildren}
|
|
@@ -84,6 +109,6 @@ export const Modal = ({
|
|
|
84
109
|
</div>
|
|
85
110
|
</BlueprintOverlay>
|
|
86
111
|
);
|
|
87
|
-
}
|
|
112
|
+
};
|
|
88
113
|
|
|
89
114
|
export default Modal;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
1
|
+
import React, {BaseSyntheticEvent} from "react";
|
|
2
|
+
|
|
3
3
|
import { IntentTypes } from "../../common/Intent";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
CardOptions,
|
|
10
|
-
CardTitle,
|
|
11
|
-
} from "./../Card";
|
|
4
|
+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
|
+
import IconButton from "../Icon/IconButton";
|
|
6
|
+
import { TestableComponent } from "../interfaces";
|
|
7
|
+
|
|
8
|
+
import { Card, CardActions, CardContent, CardHeader, CardOptions, CardTitle } from "./../Card";
|
|
12
9
|
import Divider from "./../Separation/Divider";
|
|
13
10
|
import Modal, { ModalProps } from "./Modal";
|
|
14
|
-
import {TestableComponent} from "../interfaces";
|
|
15
|
-
import IconButton from "../Icon/IconButton";
|
|
16
11
|
|
|
17
12
|
export interface SimpleDialogProps extends ModalProps, TestableComponent {
|
|
18
13
|
/**
|
|
@@ -45,11 +40,11 @@ export interface SimpleDialogProps extends ModalProps, TestableComponent {
|
|
|
45
40
|
*/
|
|
46
41
|
intent?: IntentTypes;
|
|
47
42
|
/** Optional props for the wrapper div element inside the modal. */
|
|
48
|
-
wrapperDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement
|
|
43
|
+
wrapperDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
49
44
|
/** If a full screen toggler is shown that will allow to switch to full screen mode. */
|
|
50
|
-
showFullScreenToggler?: boolean
|
|
45
|
+
showFullScreenToggler?: boolean;
|
|
51
46
|
/** Starts the modal in full screen mode. The show full screen toggler will be automatically enabled. */
|
|
52
|
-
startInFullScreenMode?: boolean
|
|
47
|
+
startInFullScreenMode?: boolean;
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
/**
|
|
@@ -65,6 +60,7 @@ export const SimpleDialog = ({
|
|
|
65
60
|
notifications = null,
|
|
66
61
|
hasBorder = false,
|
|
67
62
|
preventSimpleClosing = false,
|
|
63
|
+
enforceFocus = false,
|
|
68
64
|
intent,
|
|
69
65
|
headerOptions,
|
|
70
66
|
showFullScreenToggler = false,
|
|
@@ -73,29 +69,30 @@ export const SimpleDialog = ({
|
|
|
73
69
|
...otherProps
|
|
74
70
|
}: SimpleDialogProps) => {
|
|
75
71
|
const [displayFullscreen, setDisplayFullscreen] = React.useState<boolean>(startInFullScreenMode);
|
|
76
|
-
const showToggler = startInFullScreenMode || showFullScreenToggler
|
|
72
|
+
const showToggler = startInFullScreenMode || showFullScreenToggler;
|
|
77
73
|
const intentClassName = intent ? `${eccgui}-intent--${intent}` : "";
|
|
74
|
+
const wrapperDivProps = {
|
|
75
|
+
...modalPreventEvents,
|
|
76
|
+
...otherProps.wrapperDivProps,
|
|
77
|
+
};
|
|
78
78
|
return (
|
|
79
79
|
<Modal
|
|
80
|
+
enforceFocus={enforceFocus}
|
|
80
81
|
{...otherProps}
|
|
82
|
+
wrapperDivProps={wrapperDivProps}
|
|
81
83
|
// set default test id if not given
|
|
82
84
|
data-test-id={otherProps["data-test-id"] ?? "simpleDialogWidget"}
|
|
83
85
|
canOutsideClickClose={canOutsideClickClose || !preventSimpleClosing}
|
|
84
86
|
canEscapeKeyClose={canEscapeKeyClose || !preventSimpleClosing}
|
|
85
87
|
size={displayFullscreen ? "fullscreen" : size}
|
|
86
88
|
>
|
|
87
|
-
<Card className={intentClassName}
|
|
88
|
-
|
|
89
|
-
{(title || headerOptions || showToggler) ? (
|
|
89
|
+
<Card className={intentClassName}>
|
|
90
|
+
{title || headerOptions || showToggler ? (
|
|
90
91
|
<CardHeader>
|
|
91
|
-
<CardTitle
|
|
92
|
-
|
|
93
|
-
>
|
|
94
|
-
{title}
|
|
95
|
-
</CardTitle>
|
|
96
|
-
{(headerOptions || showToggler) ? (
|
|
92
|
+
<CardTitle className={intentClassName}>{title}</CardTitle>
|
|
93
|
+
{headerOptions || showToggler ? (
|
|
97
94
|
<CardOptions>
|
|
98
|
-
{
|
|
95
|
+
{headerOptions}
|
|
99
96
|
{showToggler && (
|
|
100
97
|
<IconButton
|
|
101
98
|
name={displayFullscreen ? "toggler-minimize" : "toggler-maximize"}
|
|
@@ -112,21 +109,29 @@ export const SimpleDialog = ({
|
|
|
112
109
|
<CardContent>{children}</CardContent>
|
|
113
110
|
{hasBorder && <Divider />}
|
|
114
111
|
{!!notifications && (
|
|
115
|
-
<CardContent className={`${eccgui}-dialog__notifications`}>
|
|
116
|
-
{notifications}
|
|
117
|
-
</CardContent>
|
|
112
|
+
<CardContent className={`${eccgui}-dialog__notifications`}>{notifications}</CardContent>
|
|
118
113
|
)}
|
|
119
114
|
{actions && (
|
|
120
|
-
<CardActions
|
|
121
|
-
inverseDirection
|
|
122
|
-
className={intentClassName}
|
|
123
|
-
>
|
|
115
|
+
<CardActions inverseDirection className={intentClassName}>
|
|
124
116
|
{actions}
|
|
125
117
|
</CardActions>
|
|
126
118
|
)}
|
|
127
119
|
</Card>
|
|
128
120
|
</Modal>
|
|
129
121
|
);
|
|
130
|
-
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Events that should be prevented to bubble up from a modal that goes beyond the most simple version of a modal, e.g.
|
|
125
|
+
* allows to drag or supports hot keys etc. */
|
|
126
|
+
export const modalPreventEvents = {
|
|
127
|
+
// Prevent certain events from leaving the modal, so that e.g. react-flow does not receive these events doing unexpected stuff
|
|
128
|
+
onContextMenu: (event: BaseSyntheticEvent) => event.stopPropagation(),
|
|
129
|
+
onDrag: (event: BaseSyntheticEvent) => event.stopPropagation(),
|
|
130
|
+
onDragStart: (event: BaseSyntheticEvent) => event.stopPropagation(),
|
|
131
|
+
onDragEnd: (event: BaseSyntheticEvent) => event.stopPropagation(),
|
|
132
|
+
onMouseDown: (event: BaseSyntheticEvent) => event.stopPropagation(),
|
|
133
|
+
onMouseUp: (event: BaseSyntheticEvent) => event.stopPropagation(),
|
|
134
|
+
onClick: (event: BaseSyntheticEvent) => event.stopPropagation()
|
|
135
|
+
};
|
|
131
136
|
|
|
132
137
|
export default SimpleDialog;
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
// our vars
|
|
4
4
|
$eccgui-size-modal-tiny-width: math.div(4, 16) * 100vw !default;
|
|
5
|
-
$eccgui-size-modal-tiny-height:
|
|
6
|
-
$eccgui-size-modal-small-width:
|
|
7
|
-
$eccgui-size-modal-small-height:
|
|
8
|
-
$eccgui-size-modal-regular-width:
|
|
9
|
-
$eccgui-size-modal-regular-height:
|
|
10
|
-
$eccgui-size-modal-large-width:
|
|
11
|
-
$eccgui-size-modal-large-height:
|
|
5
|
+
$eccgui-size-modal-tiny-height: math.div(1, 9) * 100vh !default;
|
|
6
|
+
$eccgui-size-modal-small-width: math.div(5, 16) * 100vw !default;
|
|
7
|
+
$eccgui-size-modal-small-height: math.div(2, 9) * 100vh !default;
|
|
8
|
+
$eccgui-size-modal-regular-width: math.div(6, 16) * 100vw !default;
|
|
9
|
+
$eccgui-size-modal-regular-height: math.div(3, 9) * 100vh !default;
|
|
10
|
+
$eccgui-size-modal-large-width: math.div(9, 16) * 100vw !default;
|
|
11
|
+
$eccgui-size-modal-large-height: math.div(6, 9) * 100vh !default;
|
|
12
|
+
$eccgui-size-modal-xlarge-width: math.div(12, 16) * 100vw !default;
|
|
13
|
+
$eccgui-size-modal-xlarge-height: math.div(7, 9) * 100vh !default;
|
|
12
14
|
$eccgui-color-modal-backdrop: rgba(invert($eccgui-color-workspace-background), 0.69) !default;
|
|
13
15
|
|
|
14
16
|
@import "~@blueprintjs/core/src/components/dialog/dialog";
|
|
@@ -18,15 +20,15 @@ $eccgui-color-modal-backdrop: rgba(invert($eccgui-color-workspace-background), 0
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
.#{$eccgui}-dialog__wrapper {
|
|
21
|
-
|
|
23
|
+
display: flex;
|
|
24
|
+
align-content: stretch;
|
|
25
|
+
align-items: stretch;
|
|
26
|
+
justify-content: center;
|
|
22
27
|
max-width: calc(100vw - 4rem);
|
|
23
28
|
max-height: calc(100vh - 4rem);
|
|
29
|
+
margin: 2rem;
|
|
24
30
|
pointer-events: all;
|
|
25
31
|
user-select: text;
|
|
26
|
-
display: flex;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
align-items: stretch;
|
|
29
|
-
align-content: stretch;
|
|
30
32
|
|
|
31
33
|
& > * {
|
|
32
34
|
flex-grow: 1;
|
|
@@ -34,9 +36,14 @@ $eccgui-color-modal-backdrop: rgba(invert($eccgui-color-workspace-background), 0
|
|
|
34
36
|
max-width: 100%;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
* {
|
|
38
40
|
pointer-events: all;
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
.#{$prefix}--popover {
|
|
44
|
+
// workaround to fix the arrows in pagination when used in modal
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
.#{$eccgui}-dialog__wrapper--tiny {
|
|
@@ -59,14 +66,19 @@ $eccgui-color-modal-backdrop: rgba(invert($eccgui-color-workspace-background), 0
|
|
|
59
66
|
min-height: $eccgui-size-modal-large-height;
|
|
60
67
|
}
|
|
61
68
|
|
|
69
|
+
.#{$eccgui}-dialog__wrapper--xlarge {
|
|
70
|
+
width: $eccgui-size-modal-xlarge-width;
|
|
71
|
+
min-height: $eccgui-size-modal-xlarge-height;
|
|
72
|
+
}
|
|
73
|
+
|
|
62
74
|
.#{$eccgui}-dialog__wrapper--fullscreen {
|
|
63
|
-
margin: 0;
|
|
64
|
-
padding: $eccgui-size-block-whitespace;
|
|
65
75
|
box-sizing: border-box;
|
|
66
|
-
height: 100vh;
|
|
67
76
|
width: 100vw;
|
|
68
|
-
max-height: 100vh;
|
|
69
77
|
max-width: 100vw;
|
|
78
|
+
height: 100vh;
|
|
79
|
+
max-height: 100vh;
|
|
80
|
+
padding: $eccgui-size-block-whitespace;
|
|
81
|
+
margin: 0;
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
.#{$eccgui}-dialog__notifications {
|
|
@@ -48,7 +48,7 @@ export const IconButton = ({
|
|
|
48
48
|
}: IconButtonProps) => {
|
|
49
49
|
const defaultIconTooltipProps = {
|
|
50
50
|
hoverOpenDelay: 1000,
|
|
51
|
-
openOnTargetFocus: restProps.disabled || (restProps.tabIndex ??
|
|
51
|
+
openOnTargetFocus: restProps.disabled || (restProps.tabIndex ?? 0) < 0 ? false : undefined,
|
|
52
52
|
};
|
|
53
53
|
const iconProps = {
|
|
54
54
|
small: restProps.small,
|
|
@@ -13,6 +13,7 @@ export type ValidIconName =
|
|
|
13
13
|
| "application-useraccount"
|
|
14
14
|
| "application-vocabularies"
|
|
15
15
|
| "application-warning"
|
|
16
|
+
| "application-hotkeys"
|
|
16
17
|
| "artefact-commit"
|
|
17
18
|
| "artefact-customtask"
|
|
18
19
|
| "artefact-dataset"
|
|
@@ -162,6 +163,7 @@ const canonicalIconNames: Record<ValidIconName, CarbonIconType> = {
|
|
|
162
163
|
"application-useraccount": icons.UserAvatar,
|
|
163
164
|
"application-vocabularies": icons.Catalog,
|
|
164
165
|
"application-warning": icons.WarningAlt,
|
|
166
|
+
"application-hotkeys": icons.Keyboard,
|
|
165
167
|
|
|
166
168
|
"artefact-commit": icons.Commit,
|
|
167
169
|
"artefact-customtask": icons.Script,
|
|
@@ -11,7 +11,7 @@ export interface OverviewItemDepictionProps extends React.HTMLAttributes<HTMLDiv
|
|
|
11
11
|
|
|
12
12
|
export const OverviewItemDepiction = ({
|
|
13
13
|
children,
|
|
14
|
-
className =
|
|
14
|
+
className = "",
|
|
15
15
|
keepColors = false,
|
|
16
16
|
...restProps
|
|
17
17
|
}: OverviewItemDepictionProps) => {
|
|
@@ -20,19 +20,11 @@ export const OverviewItemDepiction = ({
|
|
|
20
20
|
border: false,
|
|
21
21
|
backgroundColor: keepColors ? undefined : "dark",
|
|
22
22
|
ratio: "1:1" as "1:1",
|
|
23
|
-
padding: "medium" as "medium"
|
|
24
|
-
}
|
|
23
|
+
padding: "medium" as "medium",
|
|
24
|
+
};
|
|
25
25
|
// only return Depiction element if it is wrapped inside OverviewItemDepiction
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
!!children &&
|
|
29
|
-
"type" in children &&
|
|
30
|
-
children.type === Depiction
|
|
31
|
-
) {
|
|
32
|
-
return React.cloneElement(
|
|
33
|
-
children,
|
|
34
|
-
defaultDepictionDisplay
|
|
35
|
-
);
|
|
26
|
+
if (typeof children === "object" && !!children && "type" in children && children.type === Depiction) {
|
|
27
|
+
return React.cloneElement(children, defaultDepictionDisplay);
|
|
36
28
|
}
|
|
37
29
|
// use Depiction element for basic icons
|
|
38
30
|
if (
|
|
@@ -41,7 +33,7 @@ export const OverviewItemDepiction = ({
|
|
|
41
33
|
"type" in children &&
|
|
42
34
|
(children.type === Icon || children.type === TestIcon)
|
|
43
35
|
) {
|
|
44
|
-
return <Depiction image={children} {...defaultDepictionDisplay}
|
|
36
|
+
return <Depiction image={children as JSX.Element} {...defaultDepictionDisplay} />;
|
|
45
37
|
}
|
|
46
38
|
return (
|
|
47
39
|
<div
|
|
@@ -54,7 +46,7 @@ export const OverviewItemDepiction = ({
|
|
|
54
46
|
>
|
|
55
47
|
{children}
|
|
56
48
|
</div>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
59
51
|
|
|
60
52
|
export default OverviewItemDepiction;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
4
|
-
import Label from "../Label/Label";
|
|
4
|
+
import Label, { LabelProps } from "../Label/Label";
|
|
5
5
|
|
|
6
6
|
export interface PropertyNameProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
7
|
/**
|
|
8
8
|
* Increase or decrease the width used for the property name.
|
|
9
9
|
*/
|
|
10
10
|
size?: "small" | "medium" | "large";
|
|
11
|
+
/**
|
|
12
|
+
* Additional label properties, e.g. `tooltip`.
|
|
13
|
+
* It is only used if the `PropertyName` has simple text input.
|
|
14
|
+
*/
|
|
15
|
+
labelProps?: LabelProps;
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
export const PropertyName = ({ className = "", size, children, ...
|
|
18
|
+
export const PropertyName = ({ className = "", size, children, labelProps, ...otherDtProps }: PropertyNameProps) => {
|
|
14
19
|
return (
|
|
15
20
|
<dt
|
|
16
21
|
className={
|
|
@@ -18,9 +23,15 @@ export const PropertyName = ({ className = "", size, children, ...otherProps }:
|
|
|
18
23
|
(size ? ` ${eccgui}-propertyvalue__property--${size}` : "") +
|
|
19
24
|
(className ? " " + className : "")
|
|
20
25
|
}
|
|
21
|
-
{...
|
|
26
|
+
{...otherDtProps}
|
|
22
27
|
>
|
|
23
|
-
<div>
|
|
28
|
+
<div>
|
|
29
|
+
{typeof children === "string" ? (
|
|
30
|
+
<Label text={children} isLayoutForElement="span" {...labelProps} />
|
|
31
|
+
) : (
|
|
32
|
+
children
|
|
33
|
+
)}
|
|
34
|
+
</div>
|
|
24
35
|
</dt>
|
|
25
36
|
);
|
|
26
37
|
};
|
|
@@ -105,6 +105,9 @@ export function Select<T>({
|
|
|
105
105
|
|
|
106
106
|
/** @deprecated: instead of `const MySelect = Select.ofType<MyType>()` use directly `<Select<MyType> {...props} />` */
|
|
107
107
|
function ofType<U>() {
|
|
108
|
+
console.warn(
|
|
109
|
+
"Usage of `ofType()` is deprecated! Instead of `const MySelect = Select.ofType<MyType>()` use directly `<Select<MyType> {...props} />`"
|
|
110
|
+
);
|
|
108
111
|
return (props: SelectProps<U>) => <Select<U> {...props} />;
|
|
109
112
|
}
|
|
110
113
|
|
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
|
|
2
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
3
4
|
|
|
4
|
-
export interface SpacingProps {
|
|
5
|
+
export interface SpacingProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
6
|
/**
|
|
6
7
|
* Set the amount of white space that separates two elements.
|
|
7
8
|
*/
|
|
8
|
-
size?: "tiny" | "small" | "medium" | "large" | "xlarge"
|
|
9
|
+
size?: "tiny" | "small" | "medium" | "large" | "xlarge";
|
|
9
10
|
/**
|
|
10
11
|
* If set then is a ruler displayed in the middle of the spacing area.
|
|
11
12
|
* The direction of the ruler is used from the spacing.
|
|
12
13
|
*/
|
|
13
|
-
hasDivider?: boolean
|
|
14
|
+
hasDivider?: boolean;
|
|
14
15
|
/**
|
|
15
16
|
* If set then the spacing separates two elements on the horizontal axis.
|
|
16
17
|
* The spacing area then is created on a vertical axis.
|
|
17
18
|
*/
|
|
18
|
-
vertical?: boolean
|
|
19
|
+
vertical?: boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Adds horizontal or vertical space between neighbouring elements.
|
|
23
24
|
* It also can add a visual ruler inside.
|
|
24
25
|
*/
|
|
25
|
-
export const Spacing = ({ size = "medium", hasDivider = false, vertical = false }: SpacingProps) => {
|
|
26
|
+
export const Spacing = ({ size = "medium", hasDivider = false, vertical = false, ...otherDivProps }: SpacingProps) => {
|
|
26
27
|
const direction = vertical ? "vertical" : "horizontal";
|
|
27
28
|
return (
|
|
28
29
|
<div
|
|
29
30
|
className={
|
|
30
|
-
`${eccgui}-separation__spacing-` +
|
|
31
|
-
|
|
31
|
+
`${eccgui}-separation__spacing-` +
|
|
32
|
+
direction +
|
|
33
|
+
` ${eccgui}-separation__spacing--` +
|
|
34
|
+
size +
|
|
32
35
|
(hasDivider ? ` ${eccgui}-separation__spacing--hasdivider` : "")
|
|
33
36
|
}
|
|
37
|
+
{...otherDivProps}
|
|
34
38
|
/>
|
|
35
39
|
);
|
|
36
|
-
}
|
|
40
|
+
};
|
|
37
41
|
|
|
38
42
|
export default Spacing;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {KeyboardEventHandler, RefObject} from "react";
|
|
2
2
|
import {
|
|
3
|
-
InputGroup as BlueprintInputGroup,
|
|
4
3
|
Classes as BlueprintClassNames,
|
|
5
|
-
Intent as BlueprintIntent,
|
|
6
|
-
MaybeElement,
|
|
7
4
|
HTMLInputProps,
|
|
5
|
+
InputGroup as BlueprintInputGroup,
|
|
8
6
|
InputGroupProps2,
|
|
7
|
+
Intent as BlueprintIntent,
|
|
8
|
+
MaybeElement,
|
|
9
9
|
} from "@blueprintjs/core";
|
|
10
|
-
import {
|
|
10
|
+
import {Definitions as IntentDefinitions, IntentTypes} from "../../common/Intent";
|
|
11
11
|
import Icon from "../Icon/Icon";
|
|
12
|
-
import {
|
|
12
|
+
import {CLASSPREFIX as eccgui} from "../../configuration/constants";
|
|
13
13
|
import {ValidIconName} from "../Icon/canonicalIconNames";
|
|
14
14
|
import {InvisibleCharacterWarningProps, useTextValidation} from "./useTextValidation";
|
|
15
15
|
|
|
@@ -50,6 +50,9 @@ export interface TextFieldProps extends Partial<Omit<InputGroupProps2, "intent"
|
|
|
50
50
|
* If set, allows to be informed of invisible, hard to spot characters in the string value.
|
|
51
51
|
*/
|
|
52
52
|
invisibleCharacterWarning?: InvisibleCharacterWarningProps
|
|
53
|
+
|
|
54
|
+
/** If true pressing the Escape key will blur/de-focus the input field. Default: false */
|
|
55
|
+
escapeToBlur?: boolean
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
/**
|
|
@@ -64,8 +67,10 @@ export const TextField = ({
|
|
|
64
67
|
fullWidth = true,
|
|
65
68
|
leftIcon,
|
|
66
69
|
invisibleCharacterWarning,
|
|
70
|
+
escapeToBlur = false,
|
|
67
71
|
...otherProps
|
|
68
72
|
}: TextFieldProps) => {
|
|
73
|
+
const inputRef = React.useRef<HTMLInputElement | null>(null)
|
|
69
74
|
let deprecatedIntent;
|
|
70
75
|
switch (true) {
|
|
71
76
|
case hasStatePrimary:
|
|
@@ -84,6 +89,25 @@ export const TextField = ({
|
|
|
84
89
|
break;
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
const handleLabelEscape = React.useCallback(() => {
|
|
93
|
+
inputRef.current?.blur()
|
|
94
|
+
if(otherProps.inputRef) {
|
|
95
|
+
const otherInputRef = otherProps.inputRef as RefObject<HTMLInputElement>
|
|
96
|
+
if(otherInputRef.current) {
|
|
97
|
+
otherInputRef.current.blur()
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, [])
|
|
101
|
+
|
|
102
|
+
const onKeyDown: KeyboardEventHandler<HTMLInputElement> = React.useCallback((event) => {
|
|
103
|
+
if(escapeToBlur && event.key === "Escape") {
|
|
104
|
+
event.preventDefault()
|
|
105
|
+
handleLabelEscape()
|
|
106
|
+
return false
|
|
107
|
+
}
|
|
108
|
+
return otherProps.onKeyDown?.(event)
|
|
109
|
+
}, [otherProps.onKeyDown, escapeToBlur])
|
|
110
|
+
|
|
87
111
|
const {
|
|
88
112
|
intent = deprecatedIntent,
|
|
89
113
|
...otherBlueprintInputGroupProps
|
|
@@ -110,6 +134,7 @@ export const TextField = ({
|
|
|
110
134
|
|
|
111
135
|
return (
|
|
112
136
|
<BlueprintInputGroup
|
|
137
|
+
inputRef={inputRef}
|
|
113
138
|
className={
|
|
114
139
|
`${eccgui}-textfield` +
|
|
115
140
|
(intent ? ` ${eccgui}-intent--${intent}` : "") +
|
|
@@ -133,6 +158,7 @@ export const TextField = ({
|
|
|
133
158
|
}
|
|
134
159
|
dir={"auto"}
|
|
135
160
|
onChange={maybeWrappedOnChange}
|
|
161
|
+
onKeyDown={otherProps.onKeyDown || escapeToBlur ? onKeyDown : undefined}
|
|
136
162
|
/>
|
|
137
163
|
);
|
|
138
164
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
$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
6
|
// library vars
|
|
6
7
|
$tooltip2-background-color: $eccgui-color-applicationheader-text; // !default;
|
|
7
8
|
$tooltip2-text-color: $eccgui-color-applicationheader-background; // !default;
|
|
@@ -15,8 +16,8 @@ $tooltip2-padding-horizontal: $eccgui-size-block-whitespace * 0.5; // !default;
|
|
|
15
16
|
.#{$ns}-tooltip2 {
|
|
16
17
|
font-size: $eccgui-size-typo-tooltip;
|
|
17
18
|
line-height: $eccgui-size-typo-tooltip-lineheight;
|
|
18
|
-
white-space: normal;
|
|
19
19
|
overflow-wrap: break-word;
|
|
20
|
+
white-space: normal;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
.#{$eccgui}-tooltip--small {
|
|
@@ -39,3 +40,16 @@ $tooltip2-padding-horizontal: $eccgui-size-block-whitespace * 0.5; // !default;
|
|
|
39
40
|
text-decoration: none;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
|
|
44
|
+
.#{$prefix}--tooltip-content {
|
|
45
|
+
max-width: $eccgui-size-tooltip-width;
|
|
46
|
+
padding: 0.25 * $eccgui-size-block-whitespace 0.5 * $eccgui-size-block-whitespace;
|
|
47
|
+
// align Carbon tooltips, they are used automatically by a few carbon based elements, e.g. pagination buttons
|
|
48
|
+
font-size: $eccgui-size-typo-tooltip;
|
|
49
|
+
line-height: $eccgui-size-typo-tooltip-lineheight;
|
|
50
|
+
overflow-wrap: break-word;
|
|
51
|
+
white-space: normal;
|
|
52
|
+
|
|
53
|
+
--cds-popover-background-color: #{$tooltip2-background-color};
|
|
54
|
+
--cds-popover-text-color: #{$tooltip2-text-color};
|
|
55
|
+
}
|