@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
@@ -16,21 +16,17 @@ import { NodeContentExtensionProps } from "./NodeContentExtension";
16
16
  import { NodeProps } from "./NodeDefault";
17
17
  import { HighlightingState, NodeHighlightColor } from "./sharedTypes";
18
18
 
19
- // @deprecated use `NodeContentProps<any>['highlightedState']` (or import from `src/extensions/react-flow/nodes/sharedTypes`)
20
- export type { HighlightingState };
19
+ type NodeContentHandleLegacyProps = HandleProps;
21
20
 
22
- interface NodeContentHandleLegacyProps extends HandleProps {
23
- category?: "configuration";
24
- }
21
+ type NodeContentHandleNextProps = HandleNextProps;
25
22
 
26
- // @deprecated use `NodeContentHandleProps`
27
- export type IHandleProps = NodeContentHandleLegacyProps;
23
+ export type NodeContentHandleProps = NodeContentHandleLegacyProps | NodeContentHandleNextProps;
28
24
 
29
- export interface NodeContentHandleNextProps extends HandleNextProps {
30
- category?: "configuration";
31
- }
25
+ // @deprecated use `NodeContentProps<any>['highlightedState']` (or import from `src/extensions/react-flow/nodes/sharedTypes`)
26
+ export type { HighlightingState };
32
27
 
33
- export type NodeContentHandleProps = NodeContentHandleLegacyProps | NodeContentHandleNextProps;
28
+ // @deprecated use `HandleDefaultProps`
29
+ export type IHandleProps = NodeContentHandleLegacyProps;
34
30
 
35
31
  // @deprecated use `NodeContentProps<any>['nodeDimensions']`
36
32
  export type NodeDimensions = {
@@ -38,6 +34,23 @@ export type NodeDimensions = {
38
34
  height: number;
39
35
  };
40
36
 
37
+ type IntroductionTime = {
38
+ /**
39
+ * The delay time in ms before the introduction animation is displayed.
40
+ * Until the animation starts the node is invisible.
41
+ */
42
+ delay?: number;
43
+ /**
44
+ * The time in ms the introdcution animation runs.
45
+ */
46
+ run: number;
47
+ /**
48
+ * Animation used for the visual introduction.
49
+ * `outline` is used as default animation.
50
+ */
51
+ animation?: "landing" | "outline";
52
+ };
53
+
41
54
  interface NodeContentData<CONTENT_PROPS = any> {
42
55
  /**
43
56
  * Name of icon that should be displayed before the node label.
@@ -167,6 +180,10 @@ export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
167
180
  * The node is displayed with some animated shadow for highlighting purposes.
168
181
  */
169
182
  animated?: boolean;
183
+ /**
184
+ * Time in ms used for a short animation of the node to visualize it was added or updated.
185
+ */
186
+ introductionTime?: number | IntroductionTime;
170
187
 
171
188
  /** Additional data stored in the node. */
172
189
  businessData?: NODE_DATA;
@@ -253,22 +270,18 @@ const addHandles = (
253
270
  flowVersion: any = "legacy"
254
271
  ) => {
255
272
  return handles[position].map((handle: any, idx: any) => {
256
- const { className, style = {}, category } = handle;
273
+ const { style = {}, ...otherHandleProps } = handle;
257
274
  const styleAdditions: { [key: string]: string } = {
258
275
  color: nodeStyle.borderColor ?? undefined,
259
276
  };
260
277
  styleAdditions[posDirection] = (100 / (handles[position].length + 1)) * (idx + 1) + "%";
261
278
  const handleProperties = {
262
- ...handle,
279
+ ...otherHandleProps,
263
280
  ...{
264
281
  position: handle.position ?? position,
265
282
  style: { ...style, ...styleAdditions },
266
283
  posdirection: posDirection,
267
284
  isConnectable: typeof handle.isConnectable !== "undefined" ? handle.isConnectable : isConnectable,
268
- className: category
269
- ? (className ? className + " " : "") +
270
- gethighlightedStateClasses(category, `${eccgui}-graphviz__handle`)
271
- : className,
272
285
  },
273
286
  };
274
287
  return <MemoHandler flowVersion={flowVersion} {...handleProperties} key={"handle" + idx} />;
@@ -286,7 +299,10 @@ const MemoHandler = React.memo(
286
299
  return (
287
300
  // we only test a few properties to control re-rendering
288
301
  // need to be extended if also other properties need to be changed late
289
- prev.style[prev.posdirection] === next.style[next.posdirection] && prev.isConnectable === next.isConnectable
302
+ prev.style[prev.posdirection] === next.style[next.posdirection] &&
303
+ prev.isConnectable === next.isConnectable &&
304
+ prev.intent === next.intent &&
305
+ prev.category === next.category
290
306
  );
291
307
  }
292
308
  );
@@ -324,6 +340,7 @@ export function NodeContent<CONTENT_PROPS = any>({
324
340
  style = {},
325
341
  showUnconnectableHandles = false,
326
342
  animated = false,
343
+ introductionTime = 0,
327
344
  onNodeResize,
328
345
  nodeDimensions,
329
346
  // forwarded props
@@ -386,7 +403,7 @@ export function NodeContent<CONTENT_PROPS = any>({
386
403
  }
387
404
  }, [nodeContentRef, onNodeResize, minimalShape, nodeDimensions]);
388
405
 
389
- //update node dimensions when resized
406
+ // update node dimensions when resized
390
407
  React.useEffect(() => {
391
408
  if (nodeDimensions) {
392
409
  setWidth(nodeDimensions.width);
@@ -394,21 +411,51 @@ export function NodeContent<CONTENT_PROPS = any>({
394
411
  }
395
412
  }, [nodeDimensions]);
396
413
 
414
+ // remove introduction class
415
+ React.useEffect(() => {
416
+ if (nodeContentRef && introductionTime) {
417
+ const timeDelay = typeof introductionTime === "object" ? introductionTime.delay ?? 0 : 0;
418
+ const timeRun = typeof introductionTime === "object" ? introductionTime.run : introductionTime;
419
+ setTimeout(() => {
420
+ nodeContentRef.current.className = nodeContentRef.current.className.replace(
421
+ `${eccgui}-graphviz__node--introduction`,
422
+ `${eccgui}-graphviz__node--introduction-runs`
423
+ );
424
+ }, timeDelay);
425
+ setTimeout(() => {
426
+ nodeContentRef.current.className = nodeContentRef.current.className.replace(
427
+ `${eccgui}-graphviz__node--introduction-runs`,
428
+ ""
429
+ );
430
+ }, timeDelay + timeRun);
431
+ }
432
+ }, [nodeContentRef, introductionTime]);
433
+
397
434
  if (handles.length > 0) {
398
- handles.forEach((handle) => {
399
- if (handle.position) {
400
- handleStack[handle.position].push(handle);
401
- } else if (handle.category === "configuration") {
402
- handleStack[Position.Top].push(handle);
403
- } else {
404
- if (handle.type === "target") {
405
- handleStack[targetPosition].push(handle);
435
+ handles
436
+ .sort((a, b) => {
437
+ if (a.category === "dependency") {
438
+ return 1;
406
439
  }
407
- if (handle.type === "source") {
408
- handleStack[sourcePosition].push(handle);
440
+ if (b.category === "dependency") {
441
+ return -1;
409
442
  }
410
- }
411
- });
443
+ return 0;
444
+ })
445
+ .forEach((handle) => {
446
+ if (handle.position) {
447
+ handleStack[handle.position].push(handle);
448
+ } else if (handle.category === "configuration") {
449
+ handleStack[Position.Top].push(handle);
450
+ } else {
451
+ if (handle.type === "target") {
452
+ handleStack[targetPosition].push(handle);
453
+ }
454
+ if (handle.type === "source") {
455
+ handleStack[sourcePosition].push(handle);
456
+ }
457
+ }
458
+ });
412
459
  }
413
460
  const styleExpandDimensions: { [key: string]: string | number } = Object.create(null);
414
461
  if (
@@ -430,12 +477,26 @@ export function NodeContent<CONTENT_PROPS = any>({
430
477
 
431
478
  const resizableStyles =
432
479
  !!onNodeResize === true && minimalShape === "none" && width + height > 0 ? { width, height } : {};
480
+
481
+ const introductionStyles = introductionTime
482
+ ? ({
483
+ "--node-introduction-time": `${
484
+ typeof introductionTime === "object" ? introductionTime.run : introductionTime
485
+ }ms`,
486
+ } as React.CSSProperties)
487
+ : {};
433
488
  const nodeContent = (
434
489
  <>
435
490
  <section
436
491
  ref={nodeContentRef}
437
492
  {...otherProps}
438
- style={{ ...style, ...highlightCustomPropertySettings, ...styleExpandDimensions, ...resizableStyles }}
493
+ style={{
494
+ ...style,
495
+ ...highlightCustomPropertySettings,
496
+ ...styleExpandDimensions,
497
+ ...resizableStyles,
498
+ ...introductionStyles,
499
+ }}
439
500
  className={
440
501
  `${eccgui}-graphviz__node` +
441
502
  ` ${eccgui}-graphviz__node--${size}` +
@@ -452,9 +513,13 @@ export function NodeContent<CONTENT_PROPS = any>({
452
513
  ? " " + gethighlightedStateClasses(highlightedState, `${eccgui}-graphviz__node`)
453
514
  : "") +
454
515
  (animated ? ` ${eccgui}-graphviz__node--animated` : "") +
516
+ (introductionTime ? ` ${eccgui}-graphviz__node--introduction` : "") +
455
517
  (showUnconnectableHandles === false ? ` ${eccgui}-graphviz__node--hidehandles` : "") +
456
518
  (letPassWheelEvents === false ? ` nowheel` : "")
457
519
  }
520
+ data-introduction-animation={
521
+ typeof introductionTime === "object" ? introductionTime.animation : undefined
522
+ }
458
523
  >
459
524
  <header
460
525
  className={