@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.
Files changed (120) hide show
  1. package/CHANGELOG.md +42 -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 +19 -6
  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/Select/Select.js +1 -0
  23. package/dist/cjs/components/Select/Select.js.map +1 -1
  24. package/dist/cjs/components/Separation/Spacing.js +18 -4
  25. package/dist/cjs/components/Separation/Spacing.js.map +1 -1
  26. package/dist/cjs/components/TextField/TextField.js +23 -3
  27. package/dist/cjs/components/TextField/TextField.js.map +1 -1
  28. package/dist/cjs/extensions/codemirror/CodeMirror.js +39 -7
  29. package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
  30. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +26 -5
  31. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  32. package/dist/cjs/extensions/react-flow/handles/HandleTools.js +27 -0
  33. package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -0
  34. package/dist/cjs/extensions/react-flow/index.js +2 -0
  35. package/dist/cjs/extensions/react-flow/index.js.map +1 -1
  36. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +25 -5
  37. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  38. package/dist/esm/cmem/markdown/Markdown.js +1 -1
  39. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
  40. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  41. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
  42. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
  43. package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +6 -0
  44. package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
  45. package/dist/esm/components/Application/ApplicationHeader.js +2 -3
  46. package/dist/esm/components/Application/ApplicationHeader.js.map +1 -1
  47. package/dist/esm/components/Dialog/Modal.js +18 -9
  48. package/dist/esm/components/Dialog/Modal.js.map +1 -1
  49. package/dist/esm/components/Dialog/SimpleDialog.js +20 -7
  50. package/dist/esm/components/Dialog/SimpleDialog.js.map +1 -1
  51. package/dist/esm/components/Icon/IconButton.js +1 -1
  52. package/dist/esm/components/Icon/IconButton.js.map +1 -1
  53. package/dist/esm/components/Icon/canonicalIconNames.js +1 -0
  54. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  55. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +3 -6
  56. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
  57. package/dist/esm/components/PropertyValuePair/PropertyName.js +3 -3
  58. package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
  59. package/dist/esm/components/Select/Select.js +1 -0
  60. package/dist/esm/components/Select/Select.js.map +1 -1
  61. package/dist/esm/components/Separation/Spacing.js +28 -4
  62. package/dist/esm/components/Separation/Spacing.js.map +1 -1
  63. package/dist/esm/components/TextField/TextField.js +25 -5
  64. package/dist/esm/components/TextField/TextField.js.map +1 -1
  65. package/dist/esm/extensions/codemirror/CodeMirror.js +49 -6
  66. package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
  67. package/dist/esm/extensions/react-flow/handles/HandleDefault.js +45 -8
  68. package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  69. package/dist/esm/extensions/react-flow/handles/HandleTools.js +31 -0
  70. package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -0
  71. package/dist/esm/extensions/react-flow/index.js +2 -0
  72. package/dist/esm/extensions/react-flow/index.js.map +1 -1
  73. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +32 -12
  74. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  75. package/dist/types/cmem/react-flow/extensions/ReactFlowHotkeyContext.d.ts +8 -0
  76. package/dist/types/components/Application/ApplicationHeader.d.ts +1 -2
  77. package/dist/types/components/Dialog/Modal.d.ts +13 -6
  78. package/dist/types/components/Dialog/SimpleDialog.d.ts +14 -3
  79. package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
  80. package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
  81. package/dist/types/components/Separation/Spacing.d.ts +2 -2
  82. package/dist/types/components/TextField/TextField.d.ts +4 -2
  83. package/dist/types/extensions/codemirror/CodeMirror.d.ts +17 -3
  84. package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +2 -2
  85. package/dist/types/extensions/react-flow/handles/HandleTools.d.ts +6 -0
  86. package/dist/types/extensions/react-flow/index.d.ts +2 -0
  87. package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +21 -1
  88. package/package.json +14 -12
  89. package/scripts/compile-sass.ts +1 -1
  90. package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +10 -0
  91. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -12
  92. package/src/cmem/react-flow/extensions/ReactFlowHotkeyContext.ts +14 -0
  93. package/src/components/Application/ApplicationHeader.tsx +8 -13
  94. package/src/components/Application/_header.scss +51 -60
  95. package/src/components/Application/_toolbar.scss +22 -33
  96. package/src/components/AutoSuggestion/tests/AutoSuggestion.test.tsx +34 -21
  97. package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +20 -9
  98. package/src/components/Dialog/Modal.tsx +62 -37
  99. package/src/components/Dialog/SimpleDialog.tsx +39 -34
  100. package/src/components/Dialog/dialog.scss +29 -17
  101. package/src/components/Icon/IconButton.tsx +1 -1
  102. package/src/components/Icon/canonicalIconNames.tsx +2 -0
  103. package/src/components/OverviewItem/OverviewItemDepiction.tsx +8 -16
  104. package/src/components/PropertyValuePair/PropertyName.tsx +15 -4
  105. package/src/components/Select/Select.tsx +3 -0
  106. package/src/components/Select/_select.scss +1 -1
  107. package/src/components/Separation/Spacing.tsx +12 -8
  108. package/src/components/TextField/TextField.tsx +32 -6
  109. package/src/components/Tooltip/tooltip.scss +15 -1
  110. package/src/extensions/codemirror/CodeMirror.tsx +62 -8
  111. package/src/extensions/codemirror/_codemirror.scss +53 -8
  112. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +43 -44
  113. package/src/extensions/react-flow/handles/HandleDefault.tsx +40 -33
  114. package/src/extensions/react-flow/handles/HandleTools.tsx +22 -0
  115. package/src/extensions/react-flow/handles/_handles.scss +64 -44
  116. package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +33 -27
  117. package/src/extensions/react-flow/index.ts +2 -0
  118. package/src/extensions/react-flow/nodes/NodeContent.tsx +62 -2
  119. package/src/extensions/react-flow/nodes/_nodes.scss +170 -110
  120. package/src/extensions/react-flow/nodes/stories/NodeDefault.stories.tsx +32 -34
@@ -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,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;
@@ -5,32 +5,37 @@
5
5
  own rule patches.
6
6
  */
7
7
 
8
+ @use "sass:color";
9
+
8
10
  /// Header bar background
9
- $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;
10
15
 
11
16
  /// Header menu trigger hover, Header nav link hover
12
- $shell-header-bg-02: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%) !default;
17
+ $shell-header-bg-02: color-mix(in srgb, $shell-header-bg-01, black 5%) !default;
13
18
 
14
19
  /// Header action active background
15
- $shell-header-bg-03: adjust-color($eccgui-color-applicationheader-background, $lightness: -10%) !default;
20
+ $shell-header-bg-03: color-mix(in srgb, $shell-header-bg-01, black 10%) !default;
16
21
 
17
22
  /// Header submenu link hover
18
- $shell-header-bg-04: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%) !default; //TODO needs color var gray-90-hover
23
+ $shell-header-bg-04: $shell-header-bg-02 !default;
19
24
 
20
25
  /// Header nav link active and focus background
21
- $shell-header-bg-05: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%) !default;
26
+ $shell-header-bg-05: $shell-header-bg-02 !default;
22
27
 
23
28
  /// Header nav link submenu
24
- $shell-header-bg-06: adjust-color($eccgui-color-applicationheader-background, $lightness: -10%) !default;
29
+ $shell-header-bg-06: $shell-header-bg-03 !default;
25
30
 
26
31
  /// Header border bottom
27
32
  $shell-header-border-01: transparent !default;
28
33
 
29
34
  /// Header focus
30
- $shell-header-focus: adjust-color($eccgui-color-applicationheader-text, $lightness: 39%) !default;
35
+ $shell-header-focus: color.adjust($eccgui-color-applicationheader-text, $lightness: 39%) !default;
31
36
 
32
37
  /// Primary text in header, Title text
33
- $shell-header-text-01: adjust-color($eccgui-color-applicationheader-text, $lightness: -5%) !default;
38
+ $shell-header-text-01: color.adjust($eccgui-color-applicationheader-text, $lightness: -5%) !default;
34
39
 
35
40
  /// Secondary text in header, Menu item nav text
36
41
  $shell-header-text-02: $eccgui-color-applicationheader-text !default;
@@ -48,7 +53,7 @@ $shell-header-icon-03: $eccgui-color-applicationheader-text !default;
48
53
  $shell-header-link: $blue-60 !default;
49
54
 
50
55
  // load library sub component
51
- @import '~@carbon/styles/scss/components/ui-shell/header/index';
56
+ @import "~@carbon/styles/scss/components/ui-shell/header/index";
52
57
 
53
58
  // tweack original layout
54
59
 
@@ -62,11 +67,10 @@ $shell-header-link: $blue-60 !default;
62
67
  }
63
68
 
64
69
  .#{$prefix}--header__menu-trigger {
65
- margin-right: 0;
66
70
  flex-shrink: 0;
71
+ margin-right: 0;
67
72
  }
68
73
 
69
-
70
74
  span.#{$prefix}--header__name {
71
75
  // @extend a.#{$prefix}--header__name;
72
76
  @extend .#{$prefix}--header__name;
@@ -79,15 +83,19 @@ span.#{$prefix}--header__name {
79
83
  }
80
84
 
81
85
  .#{$eccgui}-application__title--withsidebar {
82
- width: mini-units(40 - 8);
83
86
  flex-shrink: 0;
87
+ width: mini-units(40 - 8);
84
88
  }
85
89
 
86
90
  .#{$eccgui}-application__title--content {
87
- white-space: nowrap;
88
91
  display: inline-block;
89
92
  overflow: hidden;
93
+ font-size: $eccgui-size-typo-caption;
94
+ font-weight: $eccgui-font-weight-bold;
95
+ line-height: $eccgui-size-typo-caption-lineheight;
90
96
  text-overflow: ellipsis;
97
+ letter-spacing: $eccgui-font-spacing-wide;
98
+ white-space: nowrap;
91
99
  }
92
100
 
93
101
  .#{$eccgui}-application__title--depiction {
@@ -98,77 +106,64 @@ span.#{$prefix}--header__name {
98
106
  display: none;
99
107
  }
100
108
 
101
- & > img, & > svg {
109
+ & > img,
110
+ & > svg {
102
111
  display: inline;
112
+ width: auto;
113
+ max-width: mini-units(5);
114
+ height: auto;
115
+ max-height: mini-units(5);
103
116
  padding: 0;
104
117
  margin: mini-units(1.4) 0 mini-units(1.6) 0;
105
- max-height: mini-units(5);
106
- max-width: mini-units(5);
107
- width: auto;
108
- height:auto;
109
118
  vertical-align: middle;
110
119
  }
111
120
  }
112
121
 
113
- .#{$prefix}--header__nav {
114
- // padding-left: mini-units(2);
115
- }
116
-
117
- a.#{$prefix}--header__menu-item {
118
- // padding: 0 mini-units(2);
119
- }
120
-
121
- .#{$prefix}--header__menu-title[aria-expanded='true'] + .#{$prefix}--header__menu {
122
- // width: mini-units(25);
123
- }
124
-
125
122
  .#{$prefix}--header__menu .#{$prefix}--header__menu-item {
126
123
  height: mini-units(8);
127
124
  }
128
125
 
129
- .#{$prefix}--header__menu-arrow {
130
- // margin-left: mini-units(1);
131
- }
132
-
133
126
  // tweak original colors (as long as config does not work properly)
134
127
 
135
128
  // $shell-header-bg-01
136
129
  .#{$prefix}--header,
137
130
  .#{$prefix}--skip-to-content:focus {
138
- background-color: $eccgui-color-applicationheader-background;
131
+ background-color: $shell-header-bg-01;
139
132
  }
133
+
140
134
  // $shell-header-bg-02
141
135
  a.#{$prefix}--header__menu-item:hover {
142
- background-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%);
136
+ background-color: $shell-header-bg-02;
143
137
  }
144
138
  .#{$prefix}--header__menu-trigger:hover {
145
- fill: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%);
139
+ fill: $shell-header-bg-02;
146
140
  }
147
141
 
148
142
  // $shell-header-bg-03
149
143
  .#{$prefix}--header__action:active,
150
- .#{$prefix}--header__menu-title[aria-expanded='true'] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:active,
151
- .#{$prefix}--header__action:active,
144
+ .#{$prefix}--header__menu-title[aria-expanded="true"] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:active,
152
145
  a.#{$prefix}--header__menu-item:active {
153
- background-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -10%);
146
+ background-color: $shell-header-bg-03;
154
147
  }
155
148
 
156
149
  // $shell-header-bg-04
157
150
  .#{$prefix}--header__action:hover,
158
- .#{$prefix}--header__menu-title[aria-expanded='true'] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover {
159
- background-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -10%);
151
+ .#{$prefix}--header__menu-title[aria-expanded="true"] + .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover {
152
+ background-color: $shell-header-bg-04;
160
153
  }
161
154
 
162
155
  // $shell-header-bg-05
163
156
  .#{$prefix}--header__action--active {
164
- background-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%);
165
- border-bottom-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -5%);
157
+ background-color: $shell-header-bg-05;
158
+ border-right-color: transparent;
159
+ border-bottom-color: $shell-header-bg-05;
160
+ border-left-color: transparent;
166
161
  }
167
162
 
168
163
  // $shell-header-bg-06
169
- .#{$prefix}--header__menu-title[aria-expanded='true'],
164
+ .#{$prefix}--header__menu-title[aria-expanded="true"],
170
165
  .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover {
171
- background-color: adjust-color($eccgui-color-applicationheader-background, $lightness: -10%);
166
+ background-color: $shell-header-bg-06;
172
167
  }
173
168
 
174
169
  // $shell-header-border-01
@@ -176,10 +171,6 @@ a.#{$prefix}--header__menu-item:active {
176
171
  .#{$prefix}--header__action {
177
172
  border-bottom: none;
178
173
  }
179
- .#{$prefix}--header__action--active {
180
- border-left-color: transparent;
181
- border-right-color: transparent;
182
- }
183
174
  .#{$prefix}--header__nav {
184
175
  &::before {
185
176
  background-color: transparent;
@@ -187,13 +178,13 @@ a.#{$prefix}--header__menu-item:active {
187
178
  }
188
179
 
189
180
  // $shell-header-focus
190
- .#{$prefix}--header__action:focus ,
181
+ .#{$prefix}--header__action:focus,
191
182
  a.#{$prefix}--header__name:focus,
192
183
  a.#{$prefix}--header__menu-item:focus {
193
- border-color: adjust-color($eccgui-color-applicationheader-text, $lightness: 39%);
184
+ border-color: color.adjust($eccgui-color-applicationheader-text, $lightness: 39%);
194
185
  }
195
- .#{$prefix}--header__menu-title[aria-expanded='true'] {
196
- color: adjust-color($eccgui-color-applicationheader-text, $lightness: 39%);
186
+ .#{$prefix}--header__menu-title[aria-expanded="true"] {
187
+ color: color.adjust($eccgui-color-applicationheader-text, $lightness: 39%);
197
188
  }
198
189
 
199
190
  // $shell-header-text-01
@@ -205,34 +196,34 @@ a.#{$prefix}--header__menu-item:active,
205
196
  a.#{$prefix}--header__menu-item:focus,
206
197
  .#{$prefix}--header__menu .#{$prefix}--header__menu-item:hover,
207
198
  .#{$prefix}--skip-to-content:focus {
208
- color: adjust-color($eccgui-color-applicationheader-text, $lightness: -5%);
199
+ color: color.adjust($eccgui-color-applicationheader-text, $lightness: -5%);
209
200
  }
210
201
 
211
202
  // $shell-header-text-02
212
203
  a.#{$prefix}--header__menu-item {
213
- color: $eccgui-color-applicationheader-text;
204
+ color: $eccgui-color-applicationheader-text;
214
205
  }
215
206
 
216
207
  // $shell-header-icon-01
217
208
  .#{$prefix}--header__action,
218
209
  .#{$prefix}--header__action:hover,
219
210
  .#{$prefix}--header__action:active,
220
- .#{$prefix}--header__action:focus {
211
+ .#{$prefix}--header__action:focus {
221
212
  color: $eccgui-color-applicationheader-text;
222
213
  }
223
214
  .#{$prefix}--header__menu-trigger > svg,
224
215
  a.#{$prefix}--header__menu-item:hover > svg,
225
216
  a.#{$prefix}--header__menu-item:active > svg,
226
217
  a.#{$prefix}--header__menu-item:focus > svg {
227
- fill: $eccgui-color-applicationheader-text;
218
+ fill: $eccgui-color-applicationheader-text;
228
219
  }
229
220
 
230
221
  // $shell-header-icon-02
231
222
  .#{$prefix}--header__action > svg {
232
- fill: $eccgui-color-applicationheader-text;
223
+ fill: $eccgui-color-applicationheader-text;
233
224
  }
234
225
 
235
226
  // $shell-header-icon-03
236
227
  .#{$prefix}--header__menu-arrow {
237
- fill: $eccgui-color-applicationheader-text;
228
+ fill: $eccgui-color-applicationheader-text;
238
229
  }
@@ -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
  });