@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
@@ -1,21 +1,21 @@
1
- import React, { useState, useEffect, useCallback } from "react";
2
- import { ComponentStory, ComponentMeta } from "@storybook/react";
3
- import { ReactFlow, HandleDefault, HandleProps } from "./../../../../../index";
4
- import { Elements, ReactFlowProvider } from 'react-flow-renderer';
1
+ import React, { useCallback, useEffect, useState } from "react";
2
+ import { Elements, ReactFlowProvider } from "react-flow-renderer";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { HandleDefault, HandleProps, HandleTools, ReactFlow } from "./../../../../../index";
5
6
  import { edgeTypes } from "./../../edges/edgeTypes";
6
7
 
7
8
  const HandleDefaultDataProps = (data: HandleProps["data"]) => {
8
9
  // this is only a mock to get it as sub element in the table
9
10
  return <>{data.extendedTooltip}</>;
10
- }
11
+ };
11
12
 
12
13
  export default {
13
- title: "Extensions/React Flow/Default Handle",
14
+ title: "Extensions/React Flow/Handle",
14
15
  component: HandleDefault,
15
- subcomponents: { HandleDefaultDataProps },
16
- argTypes: {
17
- },
18
- } as ComponentMeta<typeof HandleDefault>;
16
+ subcomponents: { HandleDefaultDataProps, HandleTools },
17
+ argTypes: {},
18
+ } as Meta<typeof HandleDefault>;
19
19
 
20
20
  const HandleDefaultExample = (args: any) => {
21
21
  const [reactflowInstance, setReactflowInstance] = useState(null);
@@ -30,9 +30,7 @@ const HandleDefaultExample = (args: any) => {
30
30
  label: "Default ",
31
31
  content: "Example content.",
32
32
  minimalShape: "none",
33
- handles: [
34
- { ...args }
35
- ],
33
+ handles: [{ ...args }],
36
34
  },
37
35
  position: { x: 50, y: 200 },
38
36
  },
@@ -48,24 +46,32 @@ const HandleDefaultExample = (args: any) => {
48
46
  [reactflowInstance]
49
47
  );
50
48
 
51
- return <ReactFlowProvider>
52
- <ReactFlow
53
- elements={elements}
54
- style={{ height: '400px' }}
55
- onLoad={onLoad}
56
- edgeTypes={ edgeTypes }
57
- defaultZoom={1}
58
- />
59
- </ReactFlowProvider>
60
- }
49
+ return (
50
+ <ReactFlowProvider>
51
+ <ReactFlow
52
+ elements={elements}
53
+ style={{ height: "400px" }}
54
+ onLoad={onLoad}
55
+ edgeTypes={edgeTypes}
56
+ defaultZoom={1}
57
+ />
58
+ </ReactFlowProvider>
59
+ );
60
+ };
61
61
 
62
- const Template: ComponentStory<typeof HandleDefault> = (args) => (
63
- <HandleDefaultExample {...args} />
64
- );
62
+ const Template: StoryFn<typeof HandleDefault> = (args) => <HandleDefaultExample {...args} />;
65
63
 
66
64
  export const Default = Template.bind({});
67
65
  Default.args = {
68
66
  type: "target",
69
67
  tooltip: "this is a target handle",
70
- isConnectable: false,
68
+ isConnectable: true,
69
+ };
70
+
71
+ export const UsingHandleTools = Template.bind({});
72
+ UsingHandleTools.args = {
73
+ type: "source",
74
+ tooltip: "this is a handle with tools overlay",
75
+ isConnectable: true,
76
+ children: <HandleTools>Content could be an menu, or something else.</HandleTools>,
71
77
  };
@@ -7,6 +7,8 @@ export * from "./nodes/NodeContentExtension";
7
7
  export * from "./nodes/NodeTools";
8
8
  export * from "./nodes/nodeUtils";
9
9
  export * from "./handles/HandleDefault";
10
+ export * from "./handles/HandleContent";
11
+ export * from "./handles/HandleTools";
10
12
  export * from "./edges/EdgeDefault";
11
13
  export * from "./edges/EdgeStep";
12
14
  export * from "./edges/EdgeTools";
@@ -38,6 +38,23 @@ export type NodeDimensions = {
38
38
  height: number;
39
39
  };
40
40
 
41
+ type IntroductionTime = {
42
+ /**
43
+ * The delay time in ms before the introduction animation is displayed.
44
+ * Until the animation starts the node is invisible.
45
+ */
46
+ delay?: number;
47
+ /**
48
+ * The time in ms the introdcution animation runs.
49
+ */
50
+ run: number;
51
+ /**
52
+ * Animation used for the visual introduction.
53
+ * `outline` is used as default animation.
54
+ */
55
+ animation?: "landing" | "outline";
56
+ };
57
+
41
58
  interface NodeContentData<CONTENT_PROPS = any> {
42
59
  /**
43
60
  * Name of icon that should be displayed before the node label.
@@ -167,6 +184,10 @@ export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
167
184
  * The node is displayed with some animated shadow for highlighting purposes.
168
185
  */
169
186
  animated?: boolean;
187
+ /**
188
+ * Time in ms used for a short animation of the node to visualize it was added or updated.
189
+ */
190
+ introductionTime?: number | IntroductionTime;
170
191
 
171
192
  /** Additional data stored in the node. */
172
193
  businessData?: NODE_DATA;
@@ -324,6 +345,7 @@ export function NodeContent<CONTENT_PROPS = any>({
324
345
  style = {},
325
346
  showUnconnectableHandles = false,
326
347
  animated = false,
348
+ introductionTime = 0,
327
349
  onNodeResize,
328
350
  nodeDimensions,
329
351
  // forwarded props
@@ -386,7 +408,7 @@ export function NodeContent<CONTENT_PROPS = any>({
386
408
  }
387
409
  }, [nodeContentRef, onNodeResize, minimalShape, nodeDimensions]);
388
410
 
389
- //update node dimensions when resized
411
+ // update node dimensions when resized
390
412
  React.useEffect(() => {
391
413
  if (nodeDimensions) {
392
414
  setWidth(nodeDimensions.width);
@@ -394,6 +416,26 @@ export function NodeContent<CONTENT_PROPS = any>({
394
416
  }
395
417
  }, [nodeDimensions]);
396
418
 
419
+ // remove introduction class
420
+ React.useEffect(() => {
421
+ if (nodeContentRef && introductionTime) {
422
+ const timeDelay = typeof introductionTime === "object" ? introductionTime.delay ?? 0 : 0;
423
+ const timeRun = typeof introductionTime === "object" ? introductionTime.run : introductionTime;
424
+ setTimeout(() => {
425
+ nodeContentRef.current.className = nodeContentRef.current.className.replace(
426
+ `${eccgui}-graphviz__node--introduction`,
427
+ `${eccgui}-graphviz__node--introduction-runs`
428
+ );
429
+ }, timeDelay);
430
+ setTimeout(() => {
431
+ nodeContentRef.current.className = nodeContentRef.current.className.replace(
432
+ `${eccgui}-graphviz__node--introduction-runs`,
433
+ ""
434
+ );
435
+ }, timeDelay + timeRun);
436
+ }
437
+ }, [nodeContentRef, introductionTime]);
438
+
397
439
  if (handles.length > 0) {
398
440
  handles.forEach((handle) => {
399
441
  if (handle.position) {
@@ -430,12 +472,26 @@ export function NodeContent<CONTENT_PROPS = any>({
430
472
 
431
473
  const resizableStyles =
432
474
  !!onNodeResize === true && minimalShape === "none" && width + height > 0 ? { width, height } : {};
475
+
476
+ const introductionStyles = introductionTime
477
+ ? ({
478
+ "--node-introduction-time": `${
479
+ typeof introductionTime === "object" ? introductionTime.run : introductionTime
480
+ }ms`,
481
+ } as React.CSSProperties)
482
+ : {};
433
483
  const nodeContent = (
434
484
  <>
435
485
  <section
436
486
  ref={nodeContentRef}
437
487
  {...otherProps}
438
- style={{ ...style, ...highlightCustomPropertySettings, ...styleExpandDimensions, ...resizableStyles }}
488
+ style={{
489
+ ...style,
490
+ ...highlightCustomPropertySettings,
491
+ ...styleExpandDimensions,
492
+ ...resizableStyles,
493
+ ...introductionStyles,
494
+ }}
439
495
  className={
440
496
  `${eccgui}-graphviz__node` +
441
497
  ` ${eccgui}-graphviz__node--${size}` +
@@ -452,9 +508,13 @@ export function NodeContent<CONTENT_PROPS = any>({
452
508
  ? " " + gethighlightedStateClasses(highlightedState, `${eccgui}-graphviz__node`)
453
509
  : "") +
454
510
  (animated ? ` ${eccgui}-graphviz__node--animated` : "") +
511
+ (introductionTime ? ` ${eccgui}-graphviz__node--introduction` : "") +
455
512
  (showUnconnectableHandles === false ? ` ${eccgui}-graphviz__node--hidehandles` : "") +
456
513
  (letPassWheelEvents === false ? ` nowheel` : "")
457
514
  }
515
+ data-introduction-animation={
516
+ typeof introductionTime === "object" ? introductionTime.animation : undefined
517
+ }
458
518
  >
459
519
  <header
460
520
  className={