@eccenca/gui-elements 23.2.0 → 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.
Files changed (114) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
  3. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  4. package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
  5. package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
  6. package/dist/cjs/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +12 -0
  7. package/dist/cjs/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
  8. package/dist/cjs/components/Application/ApplicationHeader.js +2 -3
  9. package/dist/cjs/components/Application/ApplicationHeader.js.map +1 -1
  10. package/dist/cjs/components/Dialog/Modal.js +17 -8
  11. package/dist/cjs/components/Dialog/Modal.js.map +1 -1
  12. package/dist/cjs/components/Dialog/SimpleDialog.js +15 -2
  13. package/dist/cjs/components/Dialog/SimpleDialog.js.map +1 -1
  14. package/dist/cjs/components/Icon/IconButton.js +1 -1
  15. package/dist/cjs/components/Icon/IconButton.js.map +1 -1
  16. package/dist/cjs/components/Icon/canonicalIconNames.js +1 -0
  17. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  18. package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js +3 -6
  19. package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
  20. package/dist/cjs/components/PropertyValuePair/PropertyName.js +3 -3
  21. package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
  22. package/dist/cjs/components/Separation/Spacing.js +18 -4
  23. package/dist/cjs/components/Separation/Spacing.js.map +1 -1
  24. package/dist/cjs/components/TextField/TextField.js +23 -3
  25. package/dist/cjs/components/TextField/TextField.js.map +1 -1
  26. package/dist/cjs/extensions/codemirror/CodeMirror.js +39 -7
  27. package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
  28. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +26 -5
  29. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  30. package/dist/cjs/extensions/react-flow/handles/HandleTools.js +27 -0
  31. package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -0
  32. package/dist/cjs/extensions/react-flow/index.js +2 -0
  33. package/dist/cjs/extensions/react-flow/index.js.map +1 -1
  34. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +25 -5
  35. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  36. package/dist/esm/cmem/markdown/Markdown.js +1 -1
  37. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
  38. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  39. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
  40. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
  41. package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +6 -0
  42. package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
  43. package/dist/esm/components/Application/ApplicationHeader.js +2 -3
  44. package/dist/esm/components/Application/ApplicationHeader.js.map +1 -1
  45. package/dist/esm/components/Dialog/Modal.js +18 -9
  46. package/dist/esm/components/Dialog/Modal.js.map +1 -1
  47. package/dist/esm/components/Dialog/SimpleDialog.js +14 -1
  48. package/dist/esm/components/Dialog/SimpleDialog.js.map +1 -1
  49. package/dist/esm/components/Icon/IconButton.js +1 -1
  50. package/dist/esm/components/Icon/IconButton.js.map +1 -1
  51. package/dist/esm/components/Icon/canonicalIconNames.js +1 -0
  52. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  53. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +3 -6
  54. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
  55. package/dist/esm/components/PropertyValuePair/PropertyName.js +3 -3
  56. package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
  57. package/dist/esm/components/Separation/Spacing.js +28 -4
  58. package/dist/esm/components/Separation/Spacing.js.map +1 -1
  59. package/dist/esm/components/TextField/TextField.js +25 -5
  60. package/dist/esm/components/TextField/TextField.js.map +1 -1
  61. package/dist/esm/extensions/codemirror/CodeMirror.js +49 -6
  62. package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
  63. package/dist/esm/extensions/react-flow/handles/HandleDefault.js +45 -8
  64. package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  65. package/dist/esm/extensions/react-flow/handles/HandleTools.js +31 -0
  66. package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -0
  67. package/dist/esm/extensions/react-flow/index.js +2 -0
  68. package/dist/esm/extensions/react-flow/index.js.map +1 -1
  69. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +32 -12
  70. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  71. package/dist/types/cmem/react-flow/extensions/ReactFlowHotkeyContext.d.ts +8 -0
  72. package/dist/types/components/Application/ApplicationHeader.d.ts +1 -2
  73. package/dist/types/components/Dialog/Modal.d.ts +13 -6
  74. package/dist/types/components/Dialog/SimpleDialog.d.ts +12 -1
  75. package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
  76. package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
  77. package/dist/types/components/Separation/Spacing.d.ts +2 -2
  78. package/dist/types/components/TextField/TextField.d.ts +4 -2
  79. package/dist/types/extensions/codemirror/CodeMirror.d.ts +17 -3
  80. package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +2 -2
  81. package/dist/types/extensions/react-flow/handles/HandleTools.d.ts +6 -0
  82. package/dist/types/extensions/react-flow/index.d.ts +2 -0
  83. package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +21 -1
  84. package/package.json +14 -12
  85. package/scripts/compile-sass.ts +1 -1
  86. package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +10 -0
  87. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -12
  88. package/src/cmem/react-flow/extensions/ReactFlowHotkeyContext.ts +14 -0
  89. package/src/components/Application/ApplicationHeader.tsx +8 -13
  90. package/src/components/Application/_header.scss +17 -17
  91. package/src/components/Application/_toolbar.scss +22 -33
  92. package/src/components/AutoSuggestion/tests/AutoSuggestion.test.tsx +34 -21
  93. package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +20 -9
  94. package/src/components/Dialog/Modal.tsx +62 -37
  95. package/src/components/Dialog/SimpleDialog.tsx +19 -1
  96. package/src/components/Dialog/dialog.scss +29 -17
  97. package/src/components/Icon/IconButton.tsx +1 -1
  98. package/src/components/Icon/canonicalIconNames.tsx +2 -0
  99. package/src/components/OverviewItem/OverviewItemDepiction.tsx +8 -16
  100. package/src/components/PropertyValuePair/PropertyName.tsx +15 -4
  101. package/src/components/Separation/Spacing.tsx +12 -8
  102. package/src/components/TextField/TextField.tsx +32 -6
  103. package/src/components/Tooltip/tooltip.scss +15 -1
  104. package/src/extensions/codemirror/CodeMirror.tsx +62 -8
  105. package/src/extensions/codemirror/_codemirror.scss +53 -8
  106. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +43 -44
  107. package/src/extensions/react-flow/handles/HandleDefault.tsx +40 -33
  108. package/src/extensions/react-flow/handles/HandleTools.tsx +22 -0
  109. package/src/extensions/react-flow/handles/_handles.scss +64 -44
  110. package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +33 -27
  111. package/src/extensions/react-flow/index.ts +2 -0
  112. package/src/extensions/react-flow/nodes/NodeContent.tsx +62 -2
  113. package/src/extensions/react-flow/nodes/_nodes.scss +170 -110
  114. package/src/extensions/react-flow/nodes/stories/NodeDefault.stories.tsx +32 -34
@@ -6,29 +6,31 @@
6
6
  own rule patches.
7
7
  */
8
8
 
9
+ @use "sass:color";
10
+
9
11
  /// Header-panel background
10
- $shell-panel-bg-01: $eccgui-color-applicationheader-background !default;
12
+ $shell-panel-bg-01: $shell-header-bg-01 !default;
11
13
 
12
14
  /// Panel item hover background
13
- $shell-panel-bg-02: adjust-color($eccgui-color-applicationheader-background, $lightness: -10%) !default;
15
+ $shell-panel-bg-02: color-mix(in srgb, $shell-header-bg-01, black 10%) !default;
14
16
 
15
17
  /// Panel item focus and active background
16
- $shell-panel-bg-03: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%) !default;
18
+ $shell-panel-bg-03: color-mix(in srgb, $shell-header-bg-01, black 5%) !default;
17
19
 
18
20
  /// Panel item link selected background
19
- $shell-panel-bg-04: adjust-color($eccgui-color-applicationheader-background, $lightness: 5%) !default;
21
+ $shell-panel-bg-04: color-mix(in srgb, $shell-header-bg-01, white 5%) !default;
20
22
 
21
23
  /// Panel border
22
- $shell-panel-border: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%) !default;
24
+ $shell-panel-border: $shell-panel-bg-03 !default;
23
25
 
24
26
  /// Header panel text
25
- $shell-panel-text-01: adjust-color($eccgui-color-applicationheader-text, $lightness: -5%) !default;
27
+ $shell-panel-text-01: color.adjust($eccgui-color-applicationheader-text, $lightness: -5%) !default;
26
28
 
27
29
  /// Header panel secondary text
28
30
  $shell-panel-text-02: $eccgui-color-applicationheader-text !default;
29
31
 
30
32
  /// Header panel focus border
31
- $shell-panel-focus: adjust-color($eccgui-color-applicationheader-text, $lightness: 39%) !default;
33
+ $shell-panel-focus: color.adjust($eccgui-color-applicationheader-text, $lightness: 39%) !default;
32
34
 
33
35
  @import "~@carbon/styles/scss/components/ui-shell/header-panel/index";
34
36
 
@@ -36,53 +38,40 @@ $shell-panel-focus: adjust-color($eccgui-color-applicationheader-text, $lightnes
36
38
 
37
39
  .#{$prefix}--header-panel {
38
40
  top: mini-units(8);
41
+ padding: $eccgui-size-block-whitespace;
42
+ color: $shell-panel-text-01;
43
+ background-color: $shell-panel-bg-01;
39
44
  }
40
45
 
41
46
  .#{$prefix}--header-panel--expanded {
42
- //width: carbon--mini-units(32);
47
+ border-right-color: $shell-panel-border;
48
+ border-left-color: $shell-panel-border;
43
49
  }
44
50
 
45
51
  .#{$eccgui}-application__toolbar__panel-backdrop--onleave,
46
52
  .#{$eccgui}-application__toolbar__panel-backdrop--onoutsideclick {
47
53
  position: fixed;
48
- top: mini-units(8);
49
- right: 0;
50
- bottom: 0;
51
- left: 0;
54
+ inset: mini-units(8) 0 0 0;
52
55
  }
53
56
 
54
57
  .#{$eccgui}-application__toolbar__panel-backdrop--onoutsideclick {
55
58
  top: 0;
56
59
  }
57
60
 
58
- // tweak original colors
59
-
60
- // $shell-panel-bg-01
61
- .#{$prefix}--header-panel {
62
- background-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%);
63
- padding: $eccgui-size-block-whitespace;
64
- }
65
-
66
- // $shell-panel-text-01
67
- .#{$prefix}--header-panel {
68
- color: adjust-color($eccgui-color-applicationheader-text, $lightness: -5%);
69
- }
70
-
71
- // $shell-panel-border
72
- .#{$prefix}--header-panel--expanded {
73
- border-left-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%);
74
- border-right-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%);
75
- }
76
-
77
61
  // add rules for own class identiiers
78
62
 
79
63
  .#{$eccgui}-application__toolbar {
80
- flex-grow: 0;
81
64
  flex-basis: auto;
65
+ flex-grow: 0;
66
+
67
+ .#{$prefix}--popover--bottom-right .#{$prefix}--popover-content {
68
+ // for some reason the original calculation still moves out the tooltip
69
+ transform: translate(calc(-1 * var(--cds-popover-offset, 0rem)), calc(100% + var(--cds-popover-offset, 0rem)));
70
+ }
82
71
  }
83
72
 
84
73
  .#{$eccgui}-application__toolbar__section {
85
- padding: 0 mini-units(1);
86
74
  display: flex;
87
75
  align-items: center;
76
+ padding: 0 mini-units(1);
88
77
  }
@@ -1,37 +1,50 @@
1
1
  import React from "react";
2
2
  import "@testing-library/jest-dom";
3
- import {render} from "@testing-library/react";
4
- import AutoSuggestion, {AutoSuggestionProps} from "../AutoSuggestion"
3
+ import { render } from "@testing-library/react";
4
+ import AutoSuggestion, { AutoSuggestionProps } from "../AutoSuggestion";
5
5
 
6
6
  describe("AutoSuggestion", () => {
7
- let props: AutoSuggestionProps
7
+ let props: AutoSuggestionProps;
8
+
9
+ beforeAll(() => {
10
+ document.createRange = () => {
11
+ const range = new Range();
12
+ range.getBoundingClientRect = jest.fn();
13
+ range.getClientRects = () => {
14
+ return {
15
+ item: () => null,
16
+ length: 0,
17
+ [Symbol.iterator]: jest.fn(),
18
+ };
19
+ };
20
+ return range;
21
+ };
22
+ });
23
+
8
24
  beforeEach(() => {
9
25
  props = {
10
26
  label: "test value path",
11
27
  initialValue: "",
12
- onChange: jest.fn((value) => {
13
- }),
28
+ onChange: jest.fn((value) => {}),
14
29
  fetchSuggestions: jest.fn((inputString, cursorPosition) => undefined),
15
- checkInput: jest.fn(inputString => ({
16
- valid: true
30
+ checkInput: jest.fn((inputString) => ({
31
+ valid: true,
17
32
  })),
18
- onInputChecked: jest.fn(validInput => {
19
- }),
33
+ onInputChecked: jest.fn((validInput) => {}),
20
34
  validationErrorText: "",
21
35
  clearIconText: "",
22
- onFocusChange: jest.fn(hasFocus => {
23
- }),
24
- id: "test-auto-suggestion"
25
- }
26
- })
36
+ onFocusChange: jest.fn((hasFocus) => {}),
37
+ id: "test-auto-suggestion",
38
+ };
39
+ });
27
40
 
28
41
  it("should render properly", () => {
29
- const {container} = render(<AutoSuggestion {...props} />)
30
- expect(container).not.toBeEmptyDOMElement()
31
- })
42
+ const { container } = render(<AutoSuggestion {...props} />);
43
+ expect(container).not.toBeEmptyDOMElement();
44
+ });
32
45
 
33
46
  it("should set label prop properly", () => {
34
- const {getByText} = render(<AutoSuggestion {...props}/>)
35
- expect(getByText(props.label!!)).toBeTruthy()
36
- })
37
- })
47
+ const { getByText } = render(<AutoSuggestion {...props} />);
48
+ expect(getByText(props.label!!)).toBeTruthy();
49
+ });
50
+ });
@@ -1,16 +1,29 @@
1
1
  import React from "react";
2
2
  import "@testing-library/jest-dom";
3
3
  import { render } from "@testing-library/react";
4
- import {
5
- SingleLineCodeEditor,
6
- SingleLineCodeEditorProps,
7
- } from "../../../../index";
4
+ import { SingleLineCodeEditor, SingleLineCodeEditorProps } from "../../../../index";
8
5
  import CodeMirror from "codemirror";
9
6
  import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
10
7
 
11
8
  describe("SingleLineCodeEditor", () => {
12
9
  let props: SingleLineCodeEditorProps,
13
10
  codeMirrorEditorInstance: CodeMirror.Editor = null as any;
11
+
12
+ beforeAll(() => {
13
+ document.createRange = () => {
14
+ const range = new Range();
15
+ range.getBoundingClientRect = jest.fn();
16
+ range.getClientRects = () => {
17
+ return {
18
+ item: () => null,
19
+ length: 0,
20
+ [Symbol.iterator]: jest.fn(),
21
+ };
22
+ };
23
+ return range;
24
+ };
25
+ });
26
+
14
27
  beforeEach(() => {
15
28
  props = {
16
29
  setEditorInstance: jest.fn((editor) => {
@@ -18,7 +31,7 @@ describe("SingleLineCodeEditor", () => {
18
31
  }),
19
32
  onChange: jest.fn((value) => {}),
20
33
  onCursorChange: jest.fn((pos, coords) => {}),
21
- mode: null,
34
+ mode: undefined,
22
35
  initialValue: "",
23
36
  onFocusChange: jest.fn((focused) => {}),
24
37
  onKeyDown: jest.fn((event) => {}),
@@ -49,14 +62,12 @@ describe("SingleLineCodeEditor", () => {
49
62
 
50
63
  it("should not allow user to create new lines", () => {
51
64
  render(<SingleLineCodeEditor {...props} />);
52
- codeMirrorEditorInstance
53
- .getDoc()
54
- .setValue("I'm entering a new line \n character");
65
+ codeMirrorEditorInstance.getDoc().setValue("I'm entering a new line \n character");
55
66
  expect(codeMirrorEditorInstance.lineCount()).toBe(1);
56
67
  });
57
68
 
58
69
  it("should convert multiple lines to a single line", () => {
59
- render(<SingleLineCodeEditor {...{...props, initialValue: "1\n2\n3"}} />);
70
+ render(<SingleLineCodeEditor {...{ ...props, initialValue: "1\n2\n3" }} />);
60
71
  expect(codeMirrorEditorInstance.lineCount()).toBe(1);
61
72
  });
62
73
  });
@@ -1,57 +1,79 @@
1
- import React from 'react';
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
- import {Card} from "./../Card";
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
- children: React.ReactNode | React.ReactNode[];
12
- /**
13
- * A space-delimited list of class names to pass along to the BlueprintJS `Overlay` element that is used to create the modal.
14
- */
15
- overlayClassName?: string;
16
- /**
17
- * Size of the modal.
18
- */
19
- size?: "tiny" | "small" | "regular" | "large" | "fullscreen";
20
- /**
21
- * Prevents that a backdrop area is displayed behind the modal elements.
22
- */
23
- preventBackdrop?: boolean;
24
- /** Optional props for the wrapper div element inside the modal overlay. */
25
- wrapperDivProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
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 sufficent.
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 as React.ReactElement).type === Card) {
48
- return React.cloneElement(
49
- child as React.ReactElement,
50
- {
51
- isOnlyLayout: true,
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 === 'string' ? ` ${eccgui}-dialog__wrapper--` + size : '') +
79
- (className ? ' ' + 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,4 +1,4 @@
1
- import React from "react";
1
+ import React, {BaseSyntheticEvent} from "react";
2
2
 
3
3
  import { IntentTypes } from "../../common/Intent";
4
4
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
@@ -71,10 +71,15 @@ export const SimpleDialog = ({
71
71
  const [displayFullscreen, setDisplayFullscreen] = React.useState<boolean>(startInFullScreenMode);
72
72
  const showToggler = startInFullScreenMode || showFullScreenToggler;
73
73
  const intentClassName = intent ? `${eccgui}-intent--${intent}` : "";
74
+ const wrapperDivProps = {
75
+ ...modalPreventEvents,
76
+ ...otherProps.wrapperDivProps,
77
+ };
74
78
  return (
75
79
  <Modal
76
80
  enforceFocus={enforceFocus}
77
81
  {...otherProps}
82
+ wrapperDivProps={wrapperDivProps}
78
83
  // set default test id if not given
79
84
  data-test-id={otherProps["data-test-id"] ?? "simpleDialogWidget"}
80
85
  canOutsideClickClose={canOutsideClickClose || !preventSimpleClosing}
@@ -116,4 +121,17 @@ export const SimpleDialog = ({
116
121
  );
117
122
  };
118
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
+ };
136
+
119
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: math.div(1, 9) * 100vh !default;
6
- $eccgui-size-modal-small-width: math.div(6, 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(8, 16) * 100vw !default;
11
- $eccgui-size-modal-large-height: math.div(6, 9) * 100vh !default;
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
- margin: 2rem;
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 ?? "0") < 0 ? false : undefined,
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
- typeof children === "object" &&
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, ...otherProps }: PropertyNameProps) => {
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
- {...otherProps}
26
+ {...otherDtProps}
22
27
  >
23
- <div>{typeof children === "string" ? <Label text={children} isLayoutForElement="span" /> : children}</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
  };