@eccenca/gui-elements 23.2.0 → 23.3.0-rc.1

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 (149) hide show
  1. package/CHANGELOG.md +53 -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/common/index.js +5 -2
  9. package/dist/cjs/common/index.js.map +1 -1
  10. package/dist/cjs/common/utils/globalVars.js +21 -0
  11. package/dist/cjs/common/utils/globalVars.js.map +1 -0
  12. package/dist/cjs/components/Application/ApplicationHeader.js +2 -3
  13. package/dist/cjs/components/Application/ApplicationHeader.js.map +1 -1
  14. package/dist/cjs/components/Dialog/Modal.js +35 -8
  15. package/dist/cjs/components/Dialog/Modal.js.map +1 -1
  16. package/dist/cjs/components/Dialog/SimpleDialog.js +15 -2
  17. package/dist/cjs/components/Dialog/SimpleDialog.js.map +1 -1
  18. package/dist/cjs/components/Icon/IconButton.js +1 -1
  19. package/dist/cjs/components/Icon/IconButton.js.map +1 -1
  20. package/dist/cjs/components/Icon/canonicalIconNames.js +1 -0
  21. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  22. package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js +3 -6
  23. package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
  24. package/dist/cjs/components/PropertyValuePair/PropertyName.js +3 -3
  25. package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
  26. package/dist/cjs/components/Separation/Spacing.js +18 -4
  27. package/dist/cjs/components/Separation/Spacing.js.map +1 -1
  28. package/dist/cjs/components/Table/TableExpandHeader.js +7 -8
  29. package/dist/cjs/components/Table/TableExpandHeader.js.map +1 -1
  30. package/dist/cjs/components/TextField/TextField.js +23 -3
  31. package/dist/cjs/components/TextField/TextField.js.map +1 -1
  32. package/dist/cjs/extensions/codemirror/CodeMirror.js +39 -7
  33. package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
  34. package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js +10 -9
  35. package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
  36. package/dist/cjs/extensions/react-flow/handles/HandleContent.js +4 -4
  37. package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
  38. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +56 -6
  39. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  40. package/dist/cjs/extensions/react-flow/handles/HandleTools.js +41 -0
  41. package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -0
  42. package/dist/cjs/extensions/react-flow/index.js +2 -0
  43. package/dist/cjs/extensions/react-flow/index.js.map +1 -1
  44. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +42 -13
  45. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  46. package/dist/esm/cmem/markdown/Markdown.js +1 -1
  47. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
  48. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  49. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
  50. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
  51. package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +6 -0
  52. package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
  53. package/dist/esm/common/index.js +5 -2
  54. package/dist/esm/common/index.js.map +1 -1
  55. package/dist/esm/common/utils/globalVars.js +16 -0
  56. package/dist/esm/common/utils/globalVars.js.map +1 -0
  57. package/dist/esm/components/Application/ApplicationHeader.js +2 -3
  58. package/dist/esm/components/Application/ApplicationHeader.js.map +1 -1
  59. package/dist/esm/components/Dialog/Modal.js +36 -9
  60. package/dist/esm/components/Dialog/Modal.js.map +1 -1
  61. package/dist/esm/components/Dialog/SimpleDialog.js +14 -1
  62. package/dist/esm/components/Dialog/SimpleDialog.js.map +1 -1
  63. package/dist/esm/components/Icon/IconButton.js +1 -1
  64. package/dist/esm/components/Icon/IconButton.js.map +1 -1
  65. package/dist/esm/components/Icon/canonicalIconNames.js +1 -0
  66. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  67. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +3 -6
  68. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
  69. package/dist/esm/components/PropertyValuePair/PropertyName.js +3 -3
  70. package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
  71. package/dist/esm/components/Separation/Spacing.js +28 -4
  72. package/dist/esm/components/Separation/Spacing.js.map +1 -1
  73. package/dist/esm/components/Table/TableExpandHeader.js +7 -8
  74. package/dist/esm/components/Table/TableExpandHeader.js.map +1 -1
  75. package/dist/esm/components/TextField/TextField.js +25 -5
  76. package/dist/esm/components/TextField/TextField.js.map +1 -1
  77. package/dist/esm/extensions/codemirror/CodeMirror.js +49 -6
  78. package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
  79. package/dist/esm/extensions/react-flow/edges/EdgeLabel.js +10 -9
  80. package/dist/esm/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
  81. package/dist/esm/extensions/react-flow/handles/HandleContent.js +16 -5
  82. package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
  83. package/dist/esm/extensions/react-flow/handles/HandleDefault.js +75 -9
  84. package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  85. package/dist/esm/extensions/react-flow/handles/HandleTools.js +61 -0
  86. package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -0
  87. package/dist/esm/extensions/react-flow/index.js +2 -0
  88. package/dist/esm/extensions/react-flow/index.js.map +1 -1
  89. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +49 -20
  90. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  91. package/dist/types/cmem/react-flow/extensions/ReactFlowHotkeyContext.d.ts +8 -0
  92. package/dist/types/common/index.d.ts +4 -0
  93. package/dist/types/common/utils/globalVars.d.ts +2 -0
  94. package/dist/types/components/Application/ApplicationHeader.d.ts +1 -2
  95. package/dist/types/components/Dialog/Modal.d.ts +22 -7
  96. package/dist/types/components/Dialog/SimpleDialog.d.ts +12 -1
  97. package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
  98. package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
  99. package/dist/types/components/Separation/Spacing.d.ts +2 -2
  100. package/dist/types/components/Table/TableExpandHeader.d.ts +5 -1
  101. package/dist/types/components/TextField/TextField.d.ts +4 -2
  102. package/dist/types/extensions/codemirror/CodeMirror.d.ts +17 -3
  103. package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +7 -3
  104. package/dist/types/extensions/react-flow/handles/HandleContent.d.ts +7 -2
  105. package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +15 -6
  106. package/dist/types/extensions/react-flow/handles/HandleTools.d.ts +7 -0
  107. package/dist/types/extensions/react-flow/index.d.ts +2 -0
  108. package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +24 -8
  109. package/package.json +19 -17
  110. package/scripts/compile-sass.ts +1 -1
  111. package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +10 -0
  112. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -12
  113. package/src/cmem/react-flow/extensions/ReactFlowHotkeyContext.ts +14 -0
  114. package/src/common/index.ts +6 -3
  115. package/src/common/utils/globalVars.ts +18 -0
  116. package/src/components/Application/ApplicationHeader.tsx +8 -13
  117. package/src/components/Application/_header.scss +17 -17
  118. package/src/components/Application/_toolbar.scss +22 -33
  119. package/src/components/Application/application.scss +8 -6
  120. package/src/components/AutoSuggestion/tests/AutoSuggestion.test.tsx +34 -21
  121. package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +20 -9
  122. package/src/components/Dialog/Modal.tsx +96 -39
  123. package/src/components/Dialog/SimpleDialog.tsx +19 -1
  124. package/src/components/Dialog/dialog.scss +33 -17
  125. package/src/components/Icon/IconButton.tsx +1 -1
  126. package/src/components/Icon/canonicalIconNames.tsx +2 -0
  127. package/src/components/OverviewItem/OverviewItemDepiction.tsx +8 -16
  128. package/src/components/PropertyValuePair/PropertyName.tsx +15 -4
  129. package/src/components/PropertyValuePair/propertyvalue.scss +1 -0
  130. package/src/components/Separation/Spacing.tsx +12 -8
  131. package/src/components/Table/TableExpandHeader.tsx +21 -18
  132. package/src/components/TextField/TextField.tsx +32 -6
  133. package/src/components/Tooltip/tooltip.scss +15 -1
  134. package/src/extensions/codemirror/CodeMirror.tsx +62 -8
  135. package/src/extensions/codemirror/_codemirror.scss +53 -8
  136. package/src/extensions/react-flow/edges/EdgeLabel.tsx +78 -81
  137. package/src/extensions/react-flow/edges/_edges.scss +62 -67
  138. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +43 -44
  139. package/src/extensions/react-flow/handles/HandleContent.tsx +14 -13
  140. package/src/extensions/react-flow/handles/HandleDefault.tsx +121 -44
  141. package/src/extensions/react-flow/handles/HandleTools.tsx +46 -0
  142. package/src/extensions/react-flow/handles/_handles.scss +135 -50
  143. package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +69 -25
  144. package/src/extensions/react-flow/index.ts +2 -0
  145. package/src/extensions/react-flow/nodes/NodeContent.tsx +97 -32
  146. package/src/extensions/react-flow/nodes/_nodes.scss +170 -110
  147. package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +75 -52
  148. package/src/extensions/react-flow/nodes/stories/NodeDefault.stories.tsx +34 -36
  149. package/src/extensions/react-flow/nodes/stories/nodeTypes.ts +11 -0
@@ -6,6 +6,7 @@ import * as graphConfig from "./../configuration/graph";
6
6
  import * as workflowConfig from "./../configuration/workflow";
7
7
  import * as linkingConfig from "./../configuration/linking";
8
8
  import {useReactFlowScrollOnDrag} from "../extensions/scrollOnDragHook";
9
+ import {ReactFlowHotkeyContext} from "../extensions/ReactFlowHotkeyContext";
9
10
 
10
11
  export interface ReactFlowProps extends ReactFlowOriginalProps {
11
12
  /**
@@ -42,11 +43,16 @@ export const ReactFlow = React.forwardRef<HTMLDivElement, ReactFlowProps>((
42
43
  },
43
44
  ref) => {
44
45
 
46
+ /** If the hot keys should be disabled. By default, they are always disabled. */
47
+ const {hotKeysDisabled} = React.useContext(ReactFlowHotkeyContext)
48
+
45
49
  const scrollOnDragFunctions = useReactFlowScrollOnDrag({
46
50
  reactFlowProps: originalProps,
47
51
  scrollOnDrag
48
52
  })
49
53
 
54
+ const {selectionKeyCode, multiSelectionKeyCode, deleteKeyCode, zoomActivationKeyCode} = originalProps
55
+
50
56
  const configReactFlow = {
51
57
  unspecified: unspecifiedConfig,
52
58
  graph: graphConfig,
@@ -61,6 +67,10 @@ export const ReactFlow = React.forwardRef<HTMLDivElement, ReactFlowProps>((
61
67
  edgeTypes={ configReactFlow[configuration].edgeTypes }
62
68
  {...originalProps}
63
69
  {...scrollOnDragFunctions}
70
+ selectionKeyCode={hotKeysDisabled ? null : selectionKeyCode as any}
71
+ deleteKeyCode={hotKeysDisabled ? null : deleteKeyCode as any}
72
+ multiSelectionKeyCode={hotKeysDisabled ? null : multiSelectionKeyCode as any}
73
+ zoomActivationKeyCode={hotKeysDisabled ? null : zoomActivationKeyCode as any}
64
74
  >
65
75
  { children }
66
76
  <ReactFlowMarkers />
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { Tag, TagList, SimpleDialog, Icon, Button, FieldItem } from "./../../../index";
3
3
  import getColorConfiguration from "../../../common/utils/getColorConfiguration";
4
4
  import { CodeEditor } from "../../../extensions";
5
+ import { ReactFlowHotkeyContext } from "../extensions/ReactFlowHotkeyContext";
5
6
 
6
7
  export type StickyNoteModalTranslationKeys = "modalTitle" | "noteLabel" | "colorLabel" | "saveButton" | "cancelButton";
7
8
 
@@ -38,6 +39,15 @@ export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(({
38
39
  const noteColors: [string, string][] = Object.entries(getColorConfiguration("stickynotes")).map(
39
40
  ([key, value]) => [key, value as string]
40
41
  );
42
+ const {disableHotKeys} = React.useContext(ReactFlowHotkeyContext)
43
+
44
+ React.useEffect(() => {
45
+ disableHotKeys(true)
46
+
47
+ return () => {
48
+ disableHotKeys(false)
49
+ }
50
+ }, [])
41
51
 
42
52
  React.useEffect(() => {
43
53
  if (!color && noteColors[0][1]) {
@@ -45,17 +55,6 @@ export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(({
45
55
  }
46
56
  }, [color, noteColors]);
47
57
 
48
- const wrapperDivProps: { [key: string]: (event: any) => any } = {
49
- // Prevent react-flow from getting these events
50
- onContextMenu: (event) => event.stopPropagation(),
51
- onDrag: (event) => event.stopPropagation(),
52
- onDragStart: (event) => event.stopPropagation(),
53
- onDragEnd: (event) => event.stopPropagation(),
54
- onMouseDown: (event) => event.stopPropagation(),
55
- onMouseUp: (event) => event.stopPropagation(),
56
- onClick: (event) => event.stopPropagation(),
57
- };
58
-
59
58
  const predefinedColorsMenu = (
60
59
  <TagList>
61
60
  {noteColors &&
@@ -88,7 +87,6 @@ export const StickyNoteModal: React.FC<StickyNoteModalProps> = React.memo(({
88
87
  hasBorder
89
88
  isOpen
90
89
  onClose={onClose}
91
- wrapperDivProps={wrapperDivProps}
92
90
  actions={[
93
91
  <Button
94
92
  key="submit"
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+
3
+ export interface ReactFlowHotkeyContextProps {
4
+ /** Allows to disable hot keys. */
5
+ disableHotKeys: (enable: boolean) => any
6
+
7
+ /** If the hot keys are currently disabled. */
8
+ hotKeysDisabled: boolean
9
+ }
10
+
11
+ export const ReactFlowHotkeyContext = React.createContext<ReactFlowHotkeyContextProps>({
12
+ disableHotKeys: () => {},
13
+ hotKeysDisabled: false
14
+ })
@@ -1,13 +1,16 @@
1
- import { openInNewTab } from "./utils/openInNewTab";
1
+ import { invisibleZeroWidthCharacters } from "./utils/characters";
2
2
  import decideContrastColorValue from "./utils/colorDecideContrastvalue";
3
3
  import getColorConfiguration from "./utils/getColorConfiguration";
4
- import { invisibleZeroWidthCharacters } from "./utils/characters";
4
+ import { getGlobalVar, setGlobalVar } from "./utils/globalVars";
5
+ import { openInNewTab } from "./utils/openInNewTab";
5
6
 
6
7
  export const utils = {
7
8
  openInNewTab,
8
9
  decideContrastColorValue,
9
10
  getColorConfiguration,
10
11
  invisibleZeroWidthCharacters,
11
- }
12
+ getGlobalVar,
13
+ setGlobalVar,
14
+ };
12
15
  // @deprecated use `utils`
13
16
  export const Utilities = utils;
@@ -0,0 +1,18 @@
1
+ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
2
+
3
+ const getGlobalConfig = () => {
4
+ return typeof window[eccgui as any] === "undefined"
5
+ ? Object.defineProperty(window, `${eccgui}`, {
6
+ value: {},
7
+ writable: true,
8
+ })[eccgui as any]
9
+ : window[eccgui as any];
10
+ };
11
+
12
+ export const getGlobalVar = (varname: string) => {
13
+ return getGlobalConfig()[varname as any];
14
+ };
15
+
16
+ export const setGlobalVar = (varname: string, value: any) => {
17
+ return (getGlobalConfig()[varname as any] = value);
18
+ };
@@ -1,25 +1,20 @@
1
1
  import React from "react";
2
- import {
3
- Header as CarbonHeader,
4
- HeaderProps as CarbonHeaderProps,
5
- } from "carbon-components-react";
2
+ import { Header as CarbonHeader, HeaderProps as CarbonHeaderProps } from "carbon-components-react";
3
+
6
4
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
7
5
 
8
- export interface ApplicationHeaderProps extends CarbonHeaderProps {};
6
+ export type ApplicationHeaderProps = CarbonHeaderProps;
9
7
 
10
8
  export const ApplicationHeader = ({
11
9
  children = "",
12
- className,
10
+ className = "",
13
11
  ...otherCarbonHeaderProps
14
12
  }: ApplicationHeaderProps) => {
15
13
  return (
16
- <CarbonHeader
17
- className={`${eccgui}-application__header ` + className}
18
- {...otherCarbonHeaderProps}
19
- >
20
- { children }
14
+ <CarbonHeader className={`${eccgui}-application__header ${className}`} {...otherCarbonHeaderProps}>
15
+ {children}
21
16
  </CarbonHeader>
22
- )
23
- }
17
+ );
18
+ };
24
19
 
25
20
  export default ApplicationHeader;
@@ -8,25 +8,25 @@
8
8
  @use "sass:color";
9
9
 
10
10
  /// Header bar background
11
- $shell-header-bg-01: $eccgui-color-applicationheader-background !default;
11
+ $shell-header-bg-01: var(
12
+ --#{$eccgui}-appheader-color-background,
13
+ #{$eccgui-color-applicationheader-background}
14
+ ) !default;
12
15
 
13
16
  /// Header menu trigger hover, Header nav link hover
14
- $shell-header-bg-02: color.adjust($eccgui-color-applicationheader-background, $lightness: -5%) !default;
17
+ $shell-header-bg-02: color-mix(in srgb, $shell-header-bg-01, black 5%) !default;
15
18
 
16
19
  /// Header action active background
17
- $shell-header-bg-03: color.adjust($eccgui-color-applicationheader-background, $lightness: -10%) !default;
20
+ $shell-header-bg-03: color-mix(in srgb, $shell-header-bg-01, black 10%) !default;
18
21
 
19
22
  /// Header submenu link hover
20
- $shell-header-bg-04: color.adjust(
21
- $eccgui-color-applicationheader-background,
22
- $lightness: -5%
23
- ) !default; // TODO needs color var gray-90-hover
23
+ $shell-header-bg-04: $shell-header-bg-02 !default;
24
24
 
25
25
  /// Header nav link active and focus background
26
- $shell-header-bg-05: color.adjust($eccgui-color-applicationheader-background, $lightness: -5%) !default;
26
+ $shell-header-bg-05: $shell-header-bg-02 !default;
27
27
 
28
28
  /// Header nav link submenu
29
- $shell-header-bg-06: color.adjust($eccgui-color-applicationheader-background, $lightness: -10%) !default;
29
+ $shell-header-bg-06: $shell-header-bg-03 !default;
30
30
 
31
31
  /// Header border bottom
32
32
  $shell-header-border-01: transparent !default;
@@ -128,42 +128,42 @@ span.#{$prefix}--header__name {
128
128
  // $shell-header-bg-01
129
129
  .#{$prefix}--header,
130
130
  .#{$prefix}--skip-to-content:focus {
131
- background-color: $eccgui-color-applicationheader-background;
131
+ background-color: $shell-header-bg-01;
132
132
  }
133
133
 
134
134
  // $shell-header-bg-02
135
135
  a.#{$prefix}--header__menu-item:hover {
136
- background-color: color.adjust($eccgui-color-applicationheader-background, $lightness: -5%);
136
+ background-color: $shell-header-bg-02;
137
137
  }
138
138
  .#{$prefix}--header__menu-trigger:hover {
139
- fill: color.adjust($eccgui-color-applicationheader-background, $lightness: -5%);
139
+ fill: $shell-header-bg-02;
140
140
  }
141
141
 
142
142
  // $shell-header-bg-03
143
143
  .#{$prefix}--header__action:active,
144
144
  .#{$prefix}--header__menu-title[aria-expanded="true"] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:active,
145
145
  a.#{$prefix}--header__menu-item:active {
146
- background-color: color.adjust($eccgui-color-applicationheader-background, $lightness: -10%);
146
+ background-color: $shell-header-bg-03;
147
147
  }
148
148
 
149
149
  // $shell-header-bg-04
150
150
  .#{$prefix}--header__action:hover,
151
151
  .#{$prefix}--header__menu-title[aria-expanded="true"] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover {
152
- background-color: color.adjust($eccgui-color-applicationheader-background, $lightness: -10%);
152
+ background-color: $shell-header-bg-04;
153
153
  }
154
154
 
155
155
  // $shell-header-bg-05
156
156
  .#{$prefix}--header__action--active {
157
- background-color: color.adjust($eccgui-color-applicationheader-background, $lightness: -5%);
157
+ background-color: $shell-header-bg-05;
158
158
  border-right-color: transparent;
159
- border-bottom-color: color.adjust($eccgui-color-applicationheader-background, $lightness: -5%);
159
+ border-bottom-color: $shell-header-bg-05;
160
160
  border-left-color: transparent;
161
161
  }
162
162
 
163
163
  // $shell-header-bg-06
164
164
  .#{$prefix}--header__menu-title[aria-expanded="true"],
165
165
  .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover {
166
- background-color: color.adjust($eccgui-color-applicationheader-background, $lightness: -10%);
166
+ background-color: $shell-header-bg-06;
167
167
  }
168
168
 
169
169
  // $shell-header-border-01
@@ -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,13 +1,15 @@
1
1
  // @import 'config';
2
- @import '~@carbon/styles/scss/components/ui-shell/functions';
3
- @import 'header';
4
- @import 'toolbar';
2
+ @import "~@carbon/styles/scss/components/ui-shell/functions";
3
+ @import "header";
4
+ @import "toolbar";
5
+
5
6
  // @import '~@carbon/styles/scss/components/ui-shell/product-switcher';
6
7
  // @import '~@carbon/styles/scss/components/ui-shell/switcher';
7
- @import 'sidebar';
8
+ @import "sidebar";
9
+
8
10
  // @import '~@carbon/styles/scss/components/ui-shell/navigation-menu';
9
- @import 'content';
11
+ @import "content";
10
12
 
11
13
  .#{$ns}-portal {
12
- z-index: 8001; // higher than carbon ui shell header
14
+ z-index: 10001; // higher than carbon ui shell header and delta to dialog portals
13
15
  }
@@ -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
  });