@eccenca/gui-elements 25.0.0-rc.0 → 25.0.0-rc.2

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 (50) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/cmem/markdown/Markdown.js +1 -2
  3. package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
  4. package/dist/cjs/common/index.js +2 -0
  5. package/dist/cjs/common/index.js.map +1 -1
  6. package/dist/cjs/common/utils/reduceToText.js +69 -0
  7. package/dist/cjs/common/utils/reduceToText.js.map +1 -0
  8. package/dist/cjs/components/ContextOverlay/ContextOverlay.js +12 -3
  9. package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
  10. package/dist/cjs/components/Dialog/ModalContext.js +10 -4
  11. package/dist/cjs/components/Dialog/ModalContext.js.map +1 -1
  12. package/dist/cjs/components/Icon/canonicalIconNames.js +21 -2
  13. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  14. package/dist/cjs/components/TextReducer/TextReducer.js +5 -63
  15. package/dist/cjs/components/TextReducer/TextReducer.js.map +1 -1
  16. package/dist/esm/cmem/markdown/Markdown.js +1 -2
  17. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  18. package/dist/esm/common/index.js +2 -0
  19. package/dist/esm/common/index.js.map +1 -1
  20. package/dist/esm/common/utils/reduceToText.js +39 -0
  21. package/dist/esm/common/utils/reduceToText.js.map +1 -0
  22. package/dist/esm/components/ContextOverlay/ContextOverlay.js +12 -3
  23. package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
  24. package/dist/esm/components/Dialog/ModalContext.js +9 -3
  25. package/dist/esm/components/Dialog/ModalContext.js.map +1 -1
  26. package/dist/esm/components/Icon/canonicalIconNames.js +21 -2
  27. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  28. package/dist/esm/components/TextReducer/TextReducer.js +5 -40
  29. package/dist/esm/components/TextReducer/TextReducer.js.map +1 -1
  30. package/dist/types/cmem/react-flow/StickyNoteModal/StickyNoteModal.d.ts +1 -1
  31. package/dist/types/common/index.d.ts +1 -0
  32. package/dist/types/common/utils/reduceToText.d.ts +10 -0
  33. package/dist/types/components/Dialog/ModalContext.d.ts +1 -1
  34. package/dist/types/components/Icon/canonicalIconNames.d.ts +19 -0
  35. package/dist/types/components/Tabs/Tab.d.ts +2 -2
  36. package/package.json +1 -1
  37. package/src/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.tsx +1 -1
  38. package/src/cmem/markdown/Markdown.tsx +1 -2
  39. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +1 -1
  40. package/src/common/index.ts +2 -0
  41. package/src/common/utils/reduceToText.tsx +54 -0
  42. package/src/components/ContextOverlay/ContextOverlay.tsx +12 -3
  43. package/src/components/Dialog/ModalContext.tsx +13 -5
  44. package/src/components/Dialog/stories/Modal.stories.tsx +1 -1
  45. package/src/components/Icon/canonicalIconNames.tsx +21 -2
  46. package/src/components/Notification/notification.scss +1 -1
  47. package/src/components/TextReducer/TextReducer.tsx +5 -42
  48. package/src/configuration/_palettes.scss +1 -1
  49. package/src/extensions/react-flow/_config.scss +8 -3
  50. package/src/extensions/react-flow/edges/_edges.scss +11 -7
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
- import { renderToString } from "react-dom/server";
3
- import * as ReactIs from "react-is";
4
2
 
3
+ import { reduceToText } from "../../common/utils/reduceToText";
5
4
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
6
5
 
7
6
  import { OverflowText, OverflowTextProps } from "./../Typography";
@@ -38,47 +37,11 @@ export const TextReducer = ({
38
37
  useOverflowTextWrapper,
39
38
  overflowTextProps,
40
39
  }: TextReducerProps) => {
41
- const nodesCount = 0;
40
+ if (typeof children === "undefined") {
41
+ return <></>;
42
+ }
42
43
 
43
- const onlyText = (children: React.ReactNode | React.ReactNode[], maxNodes?: number): string => {
44
- if (typeof maxNodes !== "undefined" && nodesCount >= maxNodes) {
45
- return "";
46
- }
47
-
48
- if (children instanceof Array) {
49
- return children
50
- .slice(0, maxNodes)
51
- .map((child: React.ReactNode) => {
52
- return onlyText(child, maxNodes);
53
- })
54
- .join(" ");
55
- }
56
-
57
- return React.Children.toArray(children)
58
- .slice(0, maxNodes)
59
- .map((child) => {
60
- if (ReactIs.isFragment(child)) {
61
- return onlyText(child.props?.children, maxNodes);
62
- }
63
- if (typeof child === "string") {
64
- return child;
65
- }
66
- if (typeof child === "number") {
67
- return child.toString();
68
- }
69
- if (ReactIs.isElement(child)) {
70
- // for some reasons `renderToString` returns empty string if not wrappe in a `span`
71
- return renderToString(<span>{child}</span>);
72
- }
73
- return "";
74
- })
75
- .join(" ")
76
- .replaceAll("\n", " ");
77
- };
78
-
79
- const shrinkedContent = onlyText(children, maxNodes)
80
- .replaceAll(/<[^\s][^>]*>/g, "")
81
- .slice(0, maxLength);
44
+ const shrinkedContent = reduceToText(children, { maxLength, maxNodes });
82
45
 
83
46
  return useOverflowTextWrapper ? (
84
47
  <OverflowText
@@ -13,7 +13,7 @@ $eccgui-color-palette-light: (
13
13
  ),
14
14
  "semantic": (
15
15
  "info": eccgui-create-color-tints(#e5f4fb #aecfe3 #77aaca #4086b2 #096199),
16
- "success": eccgui-create-color-tints(#e8f5e9 #b2c6b4 #7c967e #466749 #2f5e3a),
16
+ "success": eccgui-create-color-tints(#e8f5e9 #b1d4b7 #7ab286 #429154 #0b6f22),
17
17
  "warning": eccgui-create-color-tints(#fff3e0 #fad2b3 #f5b287 #f0915a #eb702d),
18
18
  "danger": eccgui-create-color-tints(#fff5f6 #edbfc0 #db8989 #c95253 #b71c1c),
19
19
  ),
@@ -7,9 +7,14 @@ $reactflow-node-color: $eccgui-color-workspace-text !default;
7
7
  $reactflow-node-font-size: $eccgui-size-typo-caption !default;
8
8
  $reactflow-node-border-width: 2 * $button-border-width !default;
9
9
  $reactflow-node-border-radius: $button-border-radius !default;
10
- $reactflow-edge-stroke-opacity-default: 0.8 !default;
11
- $reactflow-edge-stroke-opacity-hover: 0.9 !default;
12
- $reactflow-edge-stroke-opacity-selected: 1 !default;
10
+ $reactflow-edge-rendering: geometricprecision !default;
11
+ $reactflow-edge-stroke-width-default: 2px !default;
12
+ $reactflow-edge-stroke-width-hover: 2px !default;
13
+ $reactflow-edge-stroke-width-selected: 2px !default;
14
+ $reactflow-edge-stroke-opacity-default: $eccgui-opacity-muted !default;
15
+ $reactflow-edge-stroke-opacity-hover: $eccgui-opacity-narrow !default;
16
+ $reactflow-edge-stroke-opacity-selected: $eccgui-opacity-regular !default;
17
+ $reactflow-edge-stroke-opacity-interaction-ratio: $eccgui-opacity-ghostly !default;
13
18
  $reactflow-edge-stroke-color-default: #{eccgui-color-var("identity", "text", "700")} !default;
14
19
  $reactflow-edge-stroke-color-hover: $reactflow-edge-stroke-color-default !default;
15
20
  $reactflow-edge-stroke-color-selected: $eccgui-color-accent !default;
@@ -10,7 +10,7 @@
10
10
  path[class*="react-flow__edge"],
11
11
  rect[class*="react-flow__edge"] {
12
12
  stroke-opacity: $reactflow-edge-stroke-opacity-default;
13
- shape-rendering: optimizespeed;
13
+ shape-rendering: $reactflow-edge-rendering;
14
14
  }
15
15
 
16
16
  text[class*="react-flow__edge"] {
@@ -60,11 +60,15 @@
60
60
  path.react-flow__edge-path {
61
61
  stroke: currentcolor;
62
62
  stroke-opacity: $reactflow-edge-stroke-opacity-default;
63
- stroke-width: 2;
63
+ stroke-width: $reactflow-edge-stroke-width-default;
64
+
65
+ .react-flow__edge:hover & {
66
+ stroke-width: $reactflow-edge-stroke-width-hover;
67
+ }
64
68
 
65
69
  .react-flow__edge.selected & {
66
70
  stroke: currentcolor;
67
- stroke-width: 2;
71
+ stroke-width: $reactflow-edge-stroke-width-selected;
68
72
  }
69
73
  }
70
74
 
@@ -78,11 +82,11 @@ path.react-flow__edge-interaction {
78
82
  }
79
83
 
80
84
  .react-flow__edge:hover & {
81
- stroke-opacity: $reactflow-edge-stroke-opacity-hover * 0.2;
85
+ stroke-opacity: $reactflow-edge-stroke-opacity-hover * $reactflow-edge-stroke-opacity-interaction-ratio;
82
86
  }
83
87
 
84
88
  .react-flow__edge.selected & {
85
- stroke-opacity: $reactflow-edge-stroke-opacity-selected * 0.2;
89
+ stroke-opacity: $reactflow-edge-stroke-opacity-selected * $reactflow-edge-stroke-opacity-interaction-ratio;
86
90
  }
87
91
  }
88
92
 
@@ -96,11 +100,11 @@ path.react-flow__edge-path-glow {
96
100
  }
97
101
 
98
102
  .react-flow__edge:hover & {
99
- stroke-opacity: $reactflow-edge-stroke-opacity-hover * 0.2;
103
+ stroke-opacity: $reactflow-edge-stroke-opacity-hover * $reactflow-edge-stroke-opacity-interaction-ratio;
100
104
  }
101
105
 
102
106
  .react-flow__edge.selected & {
103
- stroke-opacity: $reactflow-edge-stroke-opacity-selected * 0.2;
107
+ stroke-opacity: $reactflow-edge-stroke-opacity-selected * $reactflow-edge-stroke-opacity-interaction-ratio;
104
108
  }
105
109
 
106
110
  .react-flow__edge.animated & {