@eccenca/gui-elements 24.4.1-featurepreparefinalnextcmem6943.2 → 25.0.0-featureimproveprintstylescmem6985.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 (149) hide show
  1. package/CHANGELOG.md +74 -19
  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 +4 -0
  5. package/dist/cjs/common/index.js.map +1 -1
  6. package/dist/cjs/common/utils/reduceToText.js +94 -0
  7. package/dist/cjs/common/utils/reduceToText.js.map +1 -0
  8. package/dist/cjs/components/Application/ApplicationViewability.js +33 -0
  9. package/dist/cjs/components/Application/ApplicationViewability.js.map +1 -0
  10. package/dist/cjs/components/Application/index.js +1 -0
  11. package/dist/cjs/components/Application/index.js.map +1 -1
  12. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +1 -1
  13. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  14. package/dist/cjs/components/Button/Button.js +1 -1
  15. package/dist/cjs/components/Button/Button.js.map +1 -1
  16. package/dist/cjs/components/ContextOverlay/ContextMenu.js +2 -2
  17. package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
  18. package/dist/cjs/components/ContextOverlay/ContextOverlay.js +65 -18
  19. package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
  20. package/dist/cjs/components/Dialog/Modal.js +15 -3
  21. package/dist/cjs/components/Dialog/Modal.js.map +1 -1
  22. package/dist/cjs/components/Dialog/ModalContext.js +51 -0
  23. package/dist/cjs/components/Dialog/ModalContext.js.map +1 -0
  24. package/dist/cjs/components/Dialog/index.js +1 -0
  25. package/dist/cjs/components/Dialog/index.js.map +1 -1
  26. package/dist/cjs/components/Icon/canonicalIconNames.js +25 -2
  27. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  28. package/dist/cjs/components/Spinner/Spinner.js +2 -1
  29. package/dist/cjs/components/Spinner/Spinner.js.map +1 -1
  30. package/dist/cjs/components/TextReducer/TextReducer.js +17 -63
  31. package/dist/cjs/components/TextReducer/TextReducer.js.map +1 -1
  32. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +2 -2
  33. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  34. package/dist/esm/cmem/markdown/Markdown.js +1 -2
  35. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  36. package/dist/esm/common/index.js +4 -0
  37. package/dist/esm/common/index.js.map +1 -1
  38. package/dist/esm/common/utils/reduceToText.js +75 -0
  39. package/dist/esm/common/utils/reduceToText.js.map +1 -0
  40. package/dist/esm/components/Application/ApplicationViewability.js +28 -0
  41. package/dist/esm/components/Application/ApplicationViewability.js.map +1 -0
  42. package/dist/esm/components/Application/index.js +1 -0
  43. package/dist/esm/components/Application/index.js.map +1 -1
  44. package/dist/esm/components/AutocompleteField/AutoCompleteField.js +1 -1
  45. package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  46. package/dist/esm/components/Button/Button.js +1 -1
  47. package/dist/esm/components/Button/Button.js.map +1 -1
  48. package/dist/esm/components/ContextOverlay/ContextMenu.js +2 -2
  49. package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
  50. package/dist/esm/components/ContextOverlay/ContextOverlay.js +69 -22
  51. package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
  52. package/dist/esm/components/Dialog/Modal.js +15 -3
  53. package/dist/esm/components/Dialog/Modal.js.map +1 -1
  54. package/dist/esm/components/Dialog/ModalContext.js +69 -0
  55. package/dist/esm/components/Dialog/ModalContext.js.map +1 -0
  56. package/dist/esm/components/Dialog/index.js +1 -0
  57. package/dist/esm/components/Dialog/index.js.map +1 -1
  58. package/dist/esm/components/Icon/canonicalIconNames.js +25 -2
  59. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  60. package/dist/esm/components/Spinner/Spinner.js +2 -1
  61. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  62. package/dist/esm/components/TextReducer/TextReducer.js +17 -41
  63. package/dist/esm/components/TextReducer/TextReducer.js.map +1 -1
  64. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +2 -2
  65. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  66. package/dist/types/cmem/react-flow/StickyNoteModal/StickyNoteModal.d.ts +1 -1
  67. package/dist/types/common/index.d.ts +3 -0
  68. package/dist/types/common/utils/reduceToText.d.ts +10 -0
  69. package/dist/types/components/Application/ApplicationViewability.d.ts +36 -0
  70. package/dist/types/components/Application/index.d.ts +1 -0
  71. package/dist/types/components/Button/Button.d.ts +14 -7
  72. package/dist/types/components/ContextOverlay/ContextMenu.d.ts +1 -1
  73. package/dist/types/components/Dialog/Modal.d.ts +9 -1
  74. package/dist/types/components/Dialog/ModalContext.d.ts +13 -0
  75. package/dist/types/components/Dialog/index.d.ts +1 -0
  76. package/dist/types/components/Icon/canonicalIconNames.d.ts +23 -0
  77. package/dist/types/components/Spinner/Spinner.d.ts +11 -4
  78. package/dist/types/components/Tabs/Tab.d.ts +2 -2
  79. package/dist/types/components/TextReducer/TextReducer.d.ts +13 -1
  80. package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +1 -1
  81. package/package.json +5 -3
  82. package/src/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.tsx +1 -1
  83. package/src/cmem/markdown/Markdown.tsx +1 -2
  84. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +1 -1
  85. package/src/cmem/react-flow/_minimap.scss +10 -0
  86. package/src/cmem/react-flow/configuration/_colors-graph.scss +12 -12
  87. package/src/cmem/react-flow/configuration/_colors-linking.scss +8 -8
  88. package/src/cmem/react-flow/configuration/_colors-workflow.scss +11 -11
  89. package/src/common/index.ts +6 -0
  90. package/src/common/scss/_color-functions.scss +5 -0
  91. package/src/common/utils/reduceToText.tsx +82 -0
  92. package/src/components/Application/ApplicationViewability.tsx +61 -0
  93. package/src/components/Application/_content.scss +7 -0
  94. package/src/components/Application/_header.scss +12 -3
  95. package/src/components/Application/_viewability.scss +13 -0
  96. package/src/components/Application/application.scss +1 -0
  97. package/src/components/Application/index.ts +1 -0
  98. package/src/components/Application/stories/ApplicationViewability.stories.tsx +37 -0
  99. package/src/components/Application/tests/ApplicationViewability.test.tsx +43 -0
  100. package/src/components/AutocompleteField/AutoCompleteField.tsx +1 -0
  101. package/src/components/Button/Button.stories.tsx +7 -1
  102. package/src/components/Button/Button.tsx +16 -9
  103. package/src/components/Button/button.scss +86 -24
  104. package/src/components/Card/card.scss +6 -0
  105. package/src/components/Chat/stories/ChatField.stories.tsx +6 -1
  106. package/src/components/Checkbox/checkbox.scss +14 -2
  107. package/src/components/ContentGroup/_contentgroup.scss +9 -0
  108. package/src/components/ContextOverlay/ContextMenu.tsx +4 -1
  109. package/src/components/ContextOverlay/ContextOverlay.tsx +77 -18
  110. package/src/components/ContextOverlay/tests/ContextMenu.test.tsx +43 -0
  111. package/src/components/ContextOverlay/tests/ContextOverlay.test.tsx +71 -0
  112. package/src/components/Depiction/depiction.scss +6 -0
  113. package/src/components/Dialog/Modal.tsx +28 -3
  114. package/src/components/Dialog/ModalContext.tsx +56 -0
  115. package/src/components/Dialog/index.ts +1 -0
  116. package/src/components/Dialog/stories/Modal.stories.tsx +10 -7
  117. package/src/components/Dialog/stories/ModalContext.stories.tsx +153 -0
  118. package/src/components/FlexibleLayout/flexiblelayout.scss +16 -0
  119. package/src/components/Grid/grid.scss +17 -0
  120. package/src/components/Grid/stories/Grid.stories.tsx +10 -7
  121. package/src/components/Grid/stories/GridRow.stories.tsx +13 -7
  122. package/src/components/Icon/canonicalIconNames.tsx +25 -2
  123. package/src/components/Icon/icon.scss +6 -0
  124. package/src/components/Icon/stories/Icon.stories.tsx +65 -5
  125. package/src/components/Icon/stories/IconButton.stories.tsx +2 -1
  126. package/src/components/Notification/Notification.stories.tsx +20 -6
  127. package/src/components/Notification/notification.scss +14 -3
  128. package/src/components/OverviewItem/overviewitem.scss +9 -0
  129. package/src/components/ProgressBar/Stories/ProgressBar.stories.tsx +7 -1
  130. package/src/components/PropertyValuePair/propertyvalue.scss +23 -1
  131. package/src/components/Select/Select.stories.tsx +1 -1
  132. package/src/components/Separation/separation.scss +6 -0
  133. package/src/components/Spinner/Spinner.tsx +13 -3
  134. package/src/components/Spinner/Stories/spinner.stories.tsx +1 -1
  135. package/src/components/Spinner/spinner.scss +5 -1
  136. package/src/components/Table/table.scss +22 -0
  137. package/src/components/Tag/tag.scss +95 -68
  138. package/src/components/TextField/textfield.scss +23 -15
  139. package/src/components/TextReducer/TextReducer.stories.tsx +2 -1
  140. package/src/components/TextReducer/TextReducer.test.tsx +44 -0
  141. package/src/components/TextReducer/TextReducer.tsx +17 -44
  142. package/src/components/VisualTour/stories/VisualTour.stories.tsx +1 -1
  143. package/src/configuration/_palettes.scss +2 -1
  144. package/src/extensions/react-flow/_config.scss +8 -3
  145. package/src/extensions/react-flow/_react-flow_v12.scss +10 -14
  146. package/src/extensions/react-flow/edges/EdgeLabel.tsx +1 -1
  147. package/src/extensions/react-flow/edges/_edges.scss +15 -7
  148. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +5 -5
  149. package/src/extensions/react-flow/nodes/NodeContent.tsx +2 -2
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
  import { OverlayProps as BlueprintOverlayProps, SpinnerProps as BlueprintSpinnerProps } from "@blueprintjs/core";
3
3
  import Color from "color";
4
+ import { ButtonProps } from "./../Button/Button";
4
5
  type SpinnerPosition = "local" | "inline" | "global";
5
6
  type SpinnerSize = "tiny" | "small" | "medium" | "large" | "xlarge" | "inherit";
6
7
  type SpinnerStroke = "thin" | "medium" | "bold";
7
- type Intent = "primary" | "success" | "warning" | "danger";
8
8
  /** A spinner that is either displayed globally or locally. */
9
9
  export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "intent" | "color"> {
10
10
  /**
@@ -13,9 +13,16 @@ export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "inte
13
13
  */
14
14
  color?: Color | string | "inherit";
15
15
  /**
16
- * Intent state of the field item.
16
+ * Intent state of the spinner.
17
+ * When used the spinner is colored.
18
+ * Property overwrites `elevated` setting.
17
19
  */
18
- intent?: Intent;
20
+ intent?: ButtonProps["intent"];
21
+ /**
22
+ * Highlight the spinner.
23
+ * It is displayed with accent color intent.
24
+ */
25
+ elevated?: boolean;
19
26
  /**
20
27
  * Additional CSS class names.
21
28
  */
@@ -53,5 +60,5 @@ export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "inte
53
60
  */
54
61
  overlayProps?: BlueprintOverlayProps;
55
62
  }
56
- export declare const Spinner: ({ className, color, intent, position, size, stroke, showLocalBackdrop, delay, overlayProps, ...otherProps }: SpinnerProps) => React.JSX.Element | null;
63
+ export declare const Spinner: ({ className, color, intent, elevated, position, size, stroke, showLocalBackdrop, delay, overlayProps, ...otherProps }: SpinnerProps) => React.JSX.Element | null;
57
64
  export default Spinner;
@@ -31,8 +31,8 @@ export declare const transformTabProperties: ({ title, dontShrink, className, ba
31
31
  "data-testid"?: string;
32
32
  color?: string | undefined;
33
33
  slot?: string | undefined;
34
- disabled?: boolean;
35
34
  children?: React.ReactNode;
35
+ disabled?: boolean;
36
36
  defaultChecked?: boolean | undefined;
37
37
  defaultValue?: string | number | readonly string[] | undefined;
38
38
  suppressContentEditableWarning?: boolean | undefined;
@@ -309,8 +309,8 @@ export declare const transformTabProperties: ({ title, dontShrink, className, ba
309
309
  "data-testid"?: string;
310
310
  color?: string | undefined;
311
311
  slot?: string | undefined;
312
- disabled?: boolean;
313
312
  children?: React.ReactNode;
313
+ disabled?: boolean;
314
314
  defaultChecked?: boolean | undefined;
315
315
  defaultValue?: string | number | readonly string[] | undefined;
316
316
  suppressContentEditableWarning?: boolean | undefined;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { DecodeHtmlEntitiesOptions } from "../../common";
2
3
  import { OverflowTextProps } from "./../Typography";
3
4
  export interface TextReducerProps extends Pick<React.HTMLAttributes<HTMLElement>, "children"> {
4
5
  /**
@@ -19,10 +20,21 @@ export interface TextReducerProps extends Pick<React.HTMLAttributes<HTMLElement>
19
20
  * Specify more `OverflowText` properties used when `useOverflowTextWrapper` is set to `true`.
20
21
  */
21
22
  overflowTextProps?: Omit<OverflowTextProps, "passDown">;
23
+ /**
24
+ * If you transform HTML markup to text then the result could contain HTML entity encoded strings.
25
+ * By enabling this option they are decoded back to it's original char.
26
+ */
27
+ decodeHtmlEntities?: boolean;
28
+ /**
29
+ * Set the options used to decode the HTML entities, if `decodeHtmlEntities` is enabled.
30
+ * Internally we use `he` library, see their [documentation on decode options](https://www.npmjs.com/package/he#hedecodehtml-options).
31
+ * If not set we use `{ isAttributeValue: true, strict: true }` as default value.
32
+ */
33
+ decodeHtmlEntitiesOptions?: DecodeHtmlEntitiesOptions;
22
34
  }
23
35
  /**
24
36
  * Component to reduce HTML markup content to simple text.
25
37
  * Display can be wrapped easily in `OverflowText`.
26
38
  */
27
- export declare const TextReducer: ({ children, maxNodes, maxLength, useOverflowTextWrapper, overflowTextProps, }: TextReducerProps) => React.JSX.Element;
39
+ export declare const TextReducer: ({ children, useOverflowTextWrapper, overflowTextProps, ...reduceToTextOptions }: TextReducerProps) => React.JSX.Element;
28
40
  export default TextReducer;
@@ -25,7 +25,7 @@ export interface EdgeLabelProps extends React.HTMLAttributes<HTMLDivElement> {
25
25
  */
26
26
  fullWidth?: boolean;
27
27
  /**
28
- * Label is diaplayed without a box that comes with borders and background color.
28
+ * Label is displayed without a box that comes with borders and background color.
29
29
  */
30
30
  loose?: boolean;
31
31
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eccenca/gui-elements",
3
3
  "description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
4
- "version": "24.4.1-featurepreparefinalnextcmem6943.2",
4
+ "version": "25.0.0-featureimproveprintstylescmem6985.0",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/eccenca/gui-elements",
7
7
  "bugs": "https://github.com/eccenca/gui-elements/issues",
@@ -87,6 +87,7 @@
87
87
  "codemirror": "^6.0.1",
88
88
  "color": "^4.2.3",
89
89
  "compute-scroll-into-view": "^3.1.1",
90
+ "he": "^1.2.0",
90
91
  "jshint": "^2.13.6",
91
92
  "lodash": "^4.17.21",
92
93
  "n3": "^1.25.1",
@@ -134,6 +135,7 @@
134
135
  "@testing-library/react": "^12.1.5",
135
136
  "@types/codemirror": "^5.60.15",
136
137
  "@types/color": "^3.0.6",
138
+ "@types/he": "^1.2.3",
137
139
  "@types/jest": "^29.5.14",
138
140
  "@types/jshint": "^2.12.4",
139
141
  "@types/lodash": "^4.17.16",
@@ -150,8 +152,8 @@
150
152
  "eslint-plugin-simple-import-sort": "^12.1.1",
151
153
  "husky": "4",
152
154
  "identity-obj-proxy": "^3.0.0",
153
- "jest": "^30.0.5",
154
- "jest-environment-jsdom": "^30.0.5",
155
+ "jest": "^30.2.0",
156
+ "jest-environment-jsdom": "^30.2.0",
155
157
  "jest-pnp-resolver": "^1.2.3",
156
158
  "lint-staged": "^15.5.1",
157
159
  "node-sass-package-importer": "^5.3.3",
@@ -83,4 +83,4 @@ function firstNonEmptyLine(preview: string) {
83
83
 
84
84
  export const stringPreviewContentBlobTogglerUtils = {
85
85
  firstNonEmptyLine,
86
- };
86
+ };
@@ -2,7 +2,6 @@ import React from "react";
2
2
  import ReactMarkdown from "react-markdown";
3
3
  import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
4
4
  // @ts-ignore: No declaration file for module (TODO: should be @ts-expect-error but GUI elements is used inside project with `noImplicitAny=false`)
5
- import remarkTypograf from "@mavrin/remark-typograf";
6
5
  import rehypeExternalLinks from "rehype-external-links";
7
6
  import rehypeRaw from "rehype-raw";
8
7
  import { remarkDefinitionList } from "remark-definition-list";
@@ -55,7 +54,7 @@ const configDefault = {
55
54
  @see https://github.com/remarkjs/react-markdown#api
56
55
  */
57
56
  // @see https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins
58
- remarkPlugins: [remarkGfm, remarkTypograf, remarkDefinitionList] as PluggableList,
57
+ remarkPlugins: [remarkGfm, remarkDefinitionList] as PluggableList,
59
58
  // @see https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins
60
59
  rehypePlugins: [] as PluggableList,
61
60
  allowedElements: [
@@ -40,7 +40,7 @@ export interface StickyNoteModalProps {
40
40
  /**
41
41
  * Forward other properties to the `SimpleModal` element that is used for this dialog.
42
42
  */
43
- simpleDialogProps?: Omit<SimpleDialogProps, "size" | "title" | "hasBorder" | "isOpen" | "onClose" | "actions">;
43
+ simpleDialogProps?: Omit<SimpleDialogProps, "size" | "title" | "hasBorder" | "isOpen" | "onClose" | "actions" | "children">;
44
44
  /**
45
45
  * Code editor props
46
46
  */
@@ -1,3 +1,13 @@
1
+ .#{$eccgui}-graphviz__minimap__node--default {
2
+ &:not([fill]) {
3
+ fill: $reactflow-node-border-color;
4
+ }
5
+
6
+ &:not([stroke]) {
7
+ stroke: $reactflow-node-border-color;
8
+ }
9
+ }
10
+
1
11
  @mixin mapnodestyles($type) {
2
12
  .#{$eccgui}-graphviz__minimap__node--#{$type} {
3
13
  @include mapcoloring($type);
@@ -1,20 +1,20 @@
1
1
  .#{$eccgui}-configuration--colors__react-flow-graph {
2
- --#{$eccgui}-graph-node: #{eccgui-color-var("layout", "purple", 700)};
3
- --#{$eccgui}-graph-node-bright: #{eccgui-color-var("layout", "purple", 100)};
4
- --#{$eccgui}-class-node: #{eccgui-color-var("layout", "magenta", 900)};
5
- --#{$eccgui}-class-node-bright: #{eccgui-color-var("layout", "magenta", 100)};
6
- --#{$eccgui}-instance-node: #{eccgui-color-var("layout", "magenta", 500)};
7
- --#{$eccgui}-instance-node-bright: #{eccgui-color-var("layout", "magenta", 100)};
2
+ --#{$eccgui}-graph-node: #{eccgui-color-var("layout", "magenta", 900)};
3
+ --#{$eccgui}-graph-node-bright: #{eccgui-color-var("layout", "magenta", 100)};
4
+ --#{$eccgui}-class-node: #{eccgui-color-var("layout", "purple", 700)};
5
+ --#{$eccgui}-class-node-bright: #{eccgui-color-var("layout", "purple", 100)};
6
+ --#{$eccgui}-instance-node: #{eccgui-color-var("layout", "purple", 500)};
7
+ --#{$eccgui}-instance-node-bright: #{eccgui-color-var("layout", "purple", 100)};
8
8
  --#{$eccgui}-property-node: #{eccgui-color-var("layout", "teal", 700)};
9
9
  --#{$eccgui}-property-node-bright: #{eccgui-color-var("layout", "teal", 100)};
10
10
  --#{$eccgui}-implicit-edge: #{eccgui-color-var("identity", "text", 700)};
11
11
  --#{$eccgui}-implicit-edge-bright: #{eccgui-color-var("identity", "text", 100)};
12
- --#{$eccgui}-import-edge: #{eccgui-color-var("layout", "purple", 700)};
13
- --#{$eccgui}-import-edge-bright: #{eccgui-color-var("layout", "purple", 100)};
14
- --#{$eccgui}-subclass-edge: #{eccgui-color-var("layout", "magenta", 900)};
15
- --#{$eccgui}-subclass-edge-bright: #{eccgui-color-var("layout", "magenta", 100)};
12
+ --#{$eccgui}-import-edge: #{eccgui-color-var("layout", "magenta", 900)};
13
+ --#{$eccgui}-import-edge-bright: #{eccgui-color-var("layout", "magenta", 100)};
14
+ --#{$eccgui}-subclass-edge: #{eccgui-color-var("layout", "purple", 700)};
15
+ --#{$eccgui}-subclass-edge-bright: #{eccgui-color-var("layout", "purple", 100)};
16
16
  --#{$eccgui}-subproperty-edge: #{eccgui-color-var("layout", "teal", 700)};
17
17
  --#{$eccgui}-subproperty-edge-bright: #{eccgui-color-var("layout", "teal", 100)};
18
- --#{$eccgui}-rdftype-edge: #{eccgui-color-var("layout", "magenta", 500)};
19
- --#{$eccgui}-rdftype-edge-bright: #{eccgui-color-var("layout", "magenta", 100)};
18
+ --#{$eccgui}-rdftype-edge: #{eccgui-color-var("layout", "purple", 500)};
19
+ --#{$eccgui}-rdftype-edge-bright: #{eccgui-color-var("layout", "purple", 100)};
20
20
  }
@@ -1,16 +1,16 @@
1
1
  .#{eccgui}-configuration--colors__react-flow-linking {
2
- --#{$eccgui}-sourcepath-node: #{eccgui-color-var("layout", "violet", 700)};
3
- --#{$eccgui}-sourcepath-node-bright: #{eccgui-color-var("layout", "violet", 100)};
4
- --#{$eccgui}-targetpath-node: #{eccgui-color-var("layout", "cyan", 900)};
5
- --#{$eccgui}-targetpath-node-bright: #{eccgui-color-var("layout", "cyan", 100)};
2
+ --#{$eccgui}-sourcepath-node: #{eccgui-color-var("layout", "purple", 700)};
3
+ --#{$eccgui}-sourcepath-node-bright: #{eccgui-color-var("layout", "purple", 300)};
4
+ --#{$eccgui}-targetpath-node: #{eccgui-color-var("layout", "petrol", 700)};
5
+ --#{$eccgui}-targetpath-node-bright: #{eccgui-color-var("layout", "petrol", 300)};
6
6
  --#{$eccgui}-transformation-node: #{eccgui-color-var("layout", "pink", 700)};
7
- --#{$eccgui}-transformation-node-bright: #{eccgui-color-var("layout", "pink", 100)};
7
+ --#{$eccgui}-transformation-node-bright: #{eccgui-color-var("layout", "pink", 300)};
8
8
  --#{$eccgui}-comparator-node: #{eccgui-color-var("layout", "teal", 700)};
9
- --#{$eccgui}-comparator-node-bright: #{eccgui-color-var("layout", "teal", 100)};
9
+ --#{$eccgui}-comparator-node-bright: #{eccgui-color-var("layout", "teal", 300)};
10
10
  --#{$eccgui}-aggregator-node: #{eccgui-color-var("layout", "cyan", 700)};
11
11
  --#{$eccgui}-aggregator-node-bright: #{eccgui-color-var("layout", "cyan", 100)};
12
12
  --#{$eccgui}-value-edge: #{eccgui-color-var("layout", "grey", 700)};
13
- --#{$eccgui}-value-edge-bright: #{eccgui-color-var("layout", "grey", 100)};
13
+ --#{$eccgui}-value-edge-bright: #{eccgui-color-var("layout", "grey", 300)};
14
14
  --#{$eccgui}-score-edge: #{eccgui-color-var("layout", "cyan", 900)};
15
- --#{$eccgui}-score-edge-bright: #{eccgui-color-var("layout", "cyan", 100)};
15
+ --#{$eccgui}-score-edge-bright: #{eccgui-color-var("layout", "cyan", 300)};
16
16
  }
@@ -1,16 +1,16 @@
1
1
  .#{$eccgui}-configuration--colors__react-flow-workflow {
2
2
  --#{$eccgui}-project-node: #{eccgui-color-var("layout", "magenta", 700)};
3
- --#{$eccgui}-project-node-bright: #{eccgui-color-var("layout", "magenta", 100)};
4
- --#{$eccgui}-dataset-node: #{eccgui-color-var("layout", "cyan", 900)};
5
- --#{$eccgui}-dataset-node-bright: #{eccgui-color-var("layout", "cyan", 100)};
6
- --#{$eccgui}-linking-node: #{eccgui-color-var("layout", "teal", 900)};
7
- --#{$eccgui}-linking-node-bright: #{eccgui-color-var("layout", "teal", 100)};
8
- --#{$eccgui}-transform-node: #{eccgui-color-var("layout", "pink", 700)};
9
- --#{$eccgui}-transform-node-bright: #{eccgui-color-var("layout", "pink", 100)};
3
+ --#{$eccgui}-project-node-bright: #{eccgui-color-var("layout", "magenta", 300)};
4
+ --#{$eccgui}-dataset-node: #{eccgui-color-var("layout", "petrol", 700)};
5
+ --#{$eccgui}-dataset-node-bright: #{eccgui-color-var("layout", "petrol", 300)};
6
+ --#{$eccgui}-linking-node: #{eccgui-color-var("layout", "cyan", 700)};
7
+ --#{$eccgui}-linking-node-bright: #{eccgui-color-var("layout", "cyan", 300)};
8
+ --#{$eccgui}-transform-node: #{eccgui-color-var("layout", "teal", 700)};
9
+ --#{$eccgui}-transform-node-bright: #{eccgui-color-var("layout", "teal", 300)};
10
10
  --#{$eccgui}-task-node: #{eccgui-color-var("layout", "lime", 700)};
11
- --#{$eccgui}-task-node-bright: #{eccgui-color-var("layout", "lime", 100)};
11
+ --#{$eccgui}-task-node-bright: #{eccgui-color-var("layout", "lime", 300)};
12
12
  --#{$eccgui}-workflow-node: #{eccgui-color-var("layout", "purple", 700)};
13
- --#{$eccgui}-workflow-node-bright: #{eccgui-color-var("layout", "purple", 100)};
14
- --#{$eccgui}-replaceableInput: #{eccgui-color-var("layout", "amber", 700)};
15
- --#{$eccgui}-replaceableInput-bright: #{eccgui-color-var("layout", "amber", 100)};
13
+ --#{$eccgui}-workflow-node-bright: #{eccgui-color-var("layout", "purple", 300)};
14
+ --#{$eccgui}-replaceable-input: #{eccgui-color-var("layout", "amber", 700)};
15
+ --#{$eccgui}-replaceable-input-bright: #{eccgui-color-var("layout", "amber", 300)};
16
16
  }
@@ -1,3 +1,5 @@
1
+ import { decode } from "he";
2
+
1
3
  import { invisibleZeroWidthCharacters } from "./utils/characters";
2
4
  import { colorCalculateDistance } from "./utils/colorCalculateDistance";
3
5
  import decideContrastColorValue from "./utils/colorDecideContrastvalue";
@@ -6,6 +8,8 @@ import getColorConfiguration from "./utils/getColorConfiguration";
6
8
  import { getScrollParent } from "./utils/getScrollParent";
7
9
  import { getGlobalVar, setGlobalVar } from "./utils/globalVars";
8
10
  import { openInNewTab } from "./utils/openInNewTab";
11
+ import { reduceToText } from "./utils/reduceToText";
12
+ export type { DecodeOptions as DecodeHtmlEntitiesOptions } from "he";
9
13
  export type { IntentTypes as IntentBaseTypes } from "./Intent";
10
14
 
11
15
  export const utils = {
@@ -19,4 +23,6 @@ export const utils = {
19
23
  getScrollParent,
20
24
  getEnabledColorsFromPalette,
21
25
  textToColorHash,
26
+ reduceToText,
27
+ decodeHtmlEntities: decode,
22
28
  };
@@ -86,6 +86,11 @@
86
86
  * Created to replace them easily for CSS custom properties.
87
87
  */
88
88
  @function eccgui-color-rgba($color, $alpha) {
89
+ @if meta.type-of($alpha) != "number" {
90
+ // in case it is for example a CSS custom property
91
+ @return eccgui-color-mix($color $alpha, transparent);
92
+ }
93
+
89
94
  @if $alpha > 0 {
90
95
  @return eccgui-color-mix($color 100% * $alpha, transparent);
91
96
  } @else {
@@ -0,0 +1,82 @@
1
+ import React from "react";
2
+ import { renderToString } from "react-dom/server";
3
+ import * as ReactIs from "react-is";
4
+
5
+ import { TextReducerProps } from "./../../components/TextReducer/TextReducer";
6
+ import { DecodeHtmlEntitiesOptions, utils } from "./../";
7
+
8
+ export interface ReduceToTextFuncType {
9
+ (
10
+ /**
11
+ * Component or text to reduce HTML markup content to plain text.
12
+ */
13
+ input: React.ReactNode | React.ReactNode[] | string,
14
+ options?: Pick<TextReducerProps, "maxNodes" | "maxLength" | "decodeHtmlEntities" | "decodeHtmlEntitiesOptions">
15
+ ): string;
16
+ }
17
+
18
+ export const reduceToText: ReduceToTextFuncType = (input, options) => {
19
+ const { maxNodes, maxLength, decodeHtmlEntities } = options || {};
20
+ const content: React.ReactNode | React.ReactNode[] = input;
21
+ let nodeCount = 0;
22
+
23
+ const onlyText = (nodes: React.ReactNode | React.ReactNode[]): string => {
24
+ if (typeof maxNodes !== "undefined" && nodeCount >= maxNodes) return "";
25
+
26
+ return React.Children.toArray(nodes)
27
+ .slice(0, maxNodes)
28
+ .map((child) => {
29
+ if (typeof maxNodes !== "undefined" && nodeCount >= maxNodes) return "";
30
+
31
+ if (ReactIs.isFragment(child)) return onlyText(child.props?.children);
32
+ if (typeof child === "string" || typeof child === "number") {
33
+ nodeCount++;
34
+ return child.toString();
35
+ }
36
+ if (ReactIs.isElement(child)) {
37
+ nodeCount++;
38
+ return renderToString(<span>{child}</span>);
39
+ }
40
+ return "";
41
+ })
42
+ .join(" ");
43
+ };
44
+
45
+ let text = typeof content === "string" ? content : onlyText(content);
46
+
47
+ // Basic HTML cleanup
48
+ text = text.replace(/<[^\s][^>]*>/g, "").replace(/\n/g, " ");
49
+
50
+ if (decodeHtmlEntities) {
51
+ const decodeDefaultOptions = {
52
+ isAttributeValue: true,
53
+ strict: true,
54
+ } as DecodeHtmlEntitiesOptions;
55
+ let decodeErrors = 0;
56
+ // we decode in pieces to apply some error tolerance even in strict mode
57
+ text = text
58
+ .split(" ")
59
+ .map((value) => {
60
+ try {
61
+ return utils.decodeHtmlEntities(value, {
62
+ ...decodeDefaultOptions,
63
+ ...options?.decodeHtmlEntitiesOptions,
64
+ });
65
+ } catch {
66
+ decodeErrors++;
67
+ return value;
68
+ }
69
+ })
70
+ .join(" ");
71
+ if (decodeErrors > 0) {
72
+ // eslint-disable-next-line no-console
73
+ console.warn(`${decodeErrors} parse error(s) for decodeHtmlEntities, return un-decoded text`, text);
74
+ }
75
+ }
76
+
77
+ if (typeof maxLength === "number") {
78
+ text = text.slice(0, maxLength);
79
+ }
80
+
81
+ return text.trim();
82
+ };
@@ -0,0 +1,61 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
+
6
+ type media = "print" | "screen";
7
+
8
+ interface ApplicationViewabilityShow {
9
+ /**
10
+ * Show on media type.
11
+ * If used, `hide` cannot be set.
12
+ */
13
+ show: media;
14
+ hide?: never;
15
+ }
16
+
17
+ interface ApplicationViewabilityHide {
18
+ /**
19
+ * Hide on media type.
20
+ * If used, `show` cannot be set.
21
+ */
22
+ hide: media;
23
+ show?: never;
24
+ }
25
+
26
+ interface ApplicationViewabilityUndecided {
27
+ /**
28
+ * Only one child allowed.
29
+ * Need to process the `className` property.
30
+ */
31
+ children: React.ReactElement<{ className?: string }>;
32
+ }
33
+
34
+ export type ApplicationViewabilityProps = ApplicationViewabilityUndecided &
35
+ (ApplicationViewabilityShow | ApplicationViewabilityHide);
36
+
37
+ /**
38
+ * Sets the viewability of the the contained element regarding media.
39
+ * Can be used to hide elements, e.g. when the page is printed.
40
+ */
41
+ export const ApplicationViewability = ({ children, show, hide }: ApplicationViewabilityProps) => {
42
+ if (!show && !hide) {
43
+ return children;
44
+ }
45
+ if (show === hide) {
46
+ // eslint-disable-next-line no-console
47
+ console.warn("`<ApplicationViewability/>` used with same media type for `hide` and `show`.");
48
+ return children;
49
+ }
50
+
51
+ const enhancedClone = React.cloneElement(children, {
52
+ className: classNames(children.props.className, {
53
+ [`${eccgui}-application__hide--${hide}`]: hide,
54
+ [`${eccgui}-application__show--${show}`]: show,
55
+ }),
56
+ });
57
+
58
+ return enhancedClone;
59
+ };
60
+
61
+ export default ApplicationViewability;
@@ -25,3 +25,10 @@ $ui-02: $eccgui-color-workspace-background !default;
25
25
  .#{$eccgui}-application__content--railsidebar {
26
26
  margin-left: mini-units(8);
27
27
  }
28
+
29
+ @media print {
30
+ .#{$eccgui}-application__content {
31
+ padding: $eccgui-size-block-whitespace 0 0 0 !important;
32
+ margin: 0;
33
+ }
34
+ }
@@ -98,10 +98,10 @@ span.#{$prefix}--header__name {
98
98
  .#{$eccgui}-application__title--content {
99
99
  display: inline-block;
100
100
  overflow: hidden;
101
+ text-overflow: ellipsis;
101
102
  font-size: $eccgui-size-typo-caption;
102
103
  font-weight: $eccgui-font-weight-bold;
103
104
  line-height: $eccgui-size-typo-caption-lineheight;
104
- text-overflow: ellipsis;
105
105
  letter-spacing: $eccgui-font-spacing-wide;
106
106
  white-space: nowrap;
107
107
  }
@@ -122,7 +122,7 @@ span.#{$prefix}--header__name {
122
122
  height: auto;
123
123
  max-height: mini-units(5);
124
124
  padding: 0;
125
- margin: mini-units(1.4) 0 mini-units(1.6) 0;
125
+ margin: mini-units(1.4) 0 mini-units(1.6);
126
126
  vertical-align: middle;
127
127
  }
128
128
  }
@@ -195,9 +195,9 @@ a.#{$prefix}--header__menu-item:active {
195
195
  .#{$prefix}--header__action.#{$prefix}--btn--primary:focus,
196
196
  a.#{$prefix}--header__name:focus,
197
197
  a.#{$prefix}--header__menu-item:focus {
198
- border: none;
199
198
  outline: 1px dotted $shell-header-focus;
200
199
  outline-offset: -1px;
200
+ border: none;
201
201
  box-shadow: none;
202
202
  }
203
203
  .#{$prefix}--header__menu-title[aria-expanded="true"] {
@@ -267,3 +267,12 @@ a.#{$prefix}--header__menu-item:focus > svg {
267
267
  margin: 0;
268
268
  }
269
269
  }
270
+
271
+ @media print {
272
+ .#{$eccgui}-application__header {
273
+ position: relative;
274
+ & > :not(.#{$eccgui}-workspace__header) {
275
+ display: none;
276
+ }
277
+ }
278
+ }
@@ -0,0 +1,13 @@
1
+ @media print {
2
+ .#{eccgui}-application__hide--print,
3
+ .#{eccgui}-application__show--screen {
4
+ display: none !important;
5
+ }
6
+ }
7
+
8
+ @media screen {
9
+ .#{eccgui}-application__hide--screen,
10
+ .#{eccgui}-application__show--print {
11
+ display: none !important;
12
+ }
13
+ }
@@ -10,3 +10,4 @@
10
10
  // @import '~@carbon/react/scss/components/ui-shell/navigation-menu';
11
11
  @import "content";
12
12
  @import "dropzone";
13
+ @import "viewability";
@@ -8,4 +8,5 @@ export * from "./ApplicationToolbar";
8
8
  export * from "./ApplicationToolbarSection";
9
9
  export * from "./ApplicationToolbarAction";
10
10
  export * from "./ApplicationToolbarPanel";
11
+ export * from "./ApplicationViewability";
11
12
  export * from "./helper";
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import { LoremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { ApplicationViewability } from "../../../index";
6
+ export default {
7
+ title: "Components/Application/Viewability",
8
+ component: ApplicationViewability,
9
+ argTypes: {
10
+ children: {
11
+ control: false,
12
+ },
13
+ hide: {
14
+ control: {
15
+ type: "radio",
16
+ },
17
+ options: ["print", "screen"],
18
+ },
19
+ show: {
20
+ control: {
21
+ type: "radio",
22
+ },
23
+ options: ["print", "screen"],
24
+ },
25
+ },
26
+ } as Meta<typeof ApplicationViewability>;
27
+
28
+ const TemplateBasicExample: StoryFn<typeof ApplicationViewability> = (args) => <ApplicationViewability {...args} />;
29
+
30
+ export const Default = TemplateBasicExample.bind({});
31
+ Default.args = {
32
+ children: (
33
+ <div>
34
+ <LoremIpsum random={false} />
35
+ </div>
36
+ ),
37
+ };
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { expect } from "@storybook/test";
3
+ import { render } from "@testing-library/react";
4
+
5
+ import "@testing-library/jest-dom";
6
+
7
+ import { ApplicationViewability, ApplicationViewabilityProps, CLASSPREFIX as eccgui } from "../../../index";
8
+
9
+ import { Default as ApplicationViewabilityStory } from "./../stories/ApplicationViewability.stories";
10
+
11
+ const applyViewabilityAndCheckClass = (props: Omit<ApplicationViewabilityProps, "children">) => {
12
+ const { container } = render(<ApplicationViewability {...ApplicationViewabilityStory.args} {...props} />);
13
+ const element = container.getElementsByClassName(
14
+ props.hide ? `${eccgui}-application__hide--${props.hide}` : `${eccgui}-application__show--${props.show}`
15
+ );
16
+ expect(element.length).toBe(1);
17
+ return element;
18
+ };
19
+
20
+ describe("ApplicationViewability", () => {
21
+ it("should be visible on `show=screen`", () => {
22
+ applyViewabilityAndCheckClass({ show: "screen" });
23
+ /**
24
+ * Currently we cannot really test visibility via jest if it is defined by S/CSS rules because those styles are not known.
25
+ * Looks like it is not too easy to include and test them.
26
+ * So we only test for the correct CSS class.
27
+ */
28
+ // console.log(window.getComputedStyle(element.item(0)??new Element).getPropertyValue("display"));
29
+ // waitFor(() => expect(element).toBeVisible());
30
+ });
31
+ it("should not be visible on `hide=screen`", () => {
32
+ applyViewabilityAndCheckClass({ hide: "screen" });
33
+ // waitFor(() => expect(element).not.toBeVisible());
34
+ });
35
+ it("should be visible on `hide=print`", () => {
36
+ applyViewabilityAndCheckClass({ hide: "print" });
37
+ // waitFor(() => expect(element).toBeVisible());
38
+ });
39
+ it("should not be visible on `show=print`", () => {
40
+ applyViewabilityAndCheckClass({ show: "print" });
41
+ // waitFor(() => expect(element).not.toBeVisible());
42
+ });
43
+ });
@@ -494,6 +494,7 @@ export function SuggestField<T, UPDATE_VALUE>(props: SuggestFieldProps<T, UPDATE
494
494
  query={query}
495
495
  // This leads to odd compile errors without "as any"
496
496
  popoverProps={updatedContextOverlayProps as any}
497
+ popoverContentProps={{className: "nodrag"}}
497
498
  selectedItem={selectedItem}
498
499
  fill={fill}
499
500
  {...createNewItemProps}