@eccenca/gui-elements 24.4.1-featurepreparefinalnextcmem6943.2 → 25.0.0-bugfixcenterednodecontentmenuitemscmem7184.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 (239) hide show
  1. package/CHANGELOG.md +93 -19
  2. package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +1 -3
  3. package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
  4. package/dist/cjs/cmem/ContentBlobToggler/ContentBlobToggler.js +1 -0
  5. package/dist/cjs/cmem/ContentBlobToggler/ContentBlobToggler.js.map +1 -1
  6. package/dist/cjs/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js +34 -11
  7. package/dist/cjs/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js.map +1 -1
  8. package/dist/cjs/cmem/markdown/Markdown.js +1 -2
  9. package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
  10. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlowV12.js.map +1 -1
  11. package/dist/cjs/common/Intent/index.js +1 -1
  12. package/dist/cjs/common/Intent/index.js.map +1 -1
  13. package/dist/cjs/common/index.js +4 -0
  14. package/dist/cjs/common/index.js.map +1 -1
  15. package/dist/cjs/common/utils/reduceToText.js +94 -0
  16. package/dist/cjs/common/utils/reduceToText.js.map +1 -0
  17. package/dist/cjs/components/Application/ApplicationViewability.js +33 -0
  18. package/dist/cjs/components/Application/ApplicationViewability.js.map +1 -0
  19. package/dist/cjs/components/Application/index.js +1 -0
  20. package/dist/cjs/components/Application/index.js.map +1 -1
  21. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +1 -1
  22. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  23. package/dist/cjs/components/Button/Button.js +1 -1
  24. package/dist/cjs/components/Button/Button.js.map +1 -1
  25. package/dist/cjs/components/ContextOverlay/ContextMenu.js +2 -2
  26. package/dist/cjs/components/ContextOverlay/ContextMenu.js.map +1 -1
  27. package/dist/cjs/components/ContextOverlay/ContextOverlay.js +65 -18
  28. package/dist/cjs/components/ContextOverlay/ContextOverlay.js.map +1 -1
  29. package/dist/cjs/components/Dialog/Modal.js +15 -3
  30. package/dist/cjs/components/Dialog/Modal.js.map +1 -1
  31. package/dist/cjs/components/Dialog/ModalContext.js +51 -0
  32. package/dist/cjs/components/Dialog/ModalContext.js.map +1 -0
  33. package/dist/cjs/components/Dialog/index.js +1 -0
  34. package/dist/cjs/components/Dialog/index.js.map +1 -1
  35. package/dist/cjs/components/Icon/IconButton.js.map +1 -1
  36. package/dist/cjs/components/Icon/canonicalIconNames.js +25 -2
  37. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  38. package/dist/cjs/components/Spinner/Spinner.js +2 -1
  39. package/dist/cjs/components/Spinner/Spinner.js.map +1 -1
  40. package/dist/cjs/components/TextReducer/TextReducer.js +17 -63
  41. package/dist/cjs/components/TextReducer/TextReducer.js.map +1 -1
  42. package/dist/cjs/components/Typography/InlineText.js +29 -0
  43. package/dist/cjs/components/Typography/InlineText.js.map +1 -0
  44. package/dist/cjs/components/Typography/index.js +1 -0
  45. package/dist/cjs/components/Typography/index.js.map +1 -1
  46. package/dist/cjs/extensions/codemirror/CodeMirror.js +2 -2
  47. package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
  48. package/dist/cjs/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js +1 -1
  49. package/dist/cjs/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js.map +1 -1
  50. package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js +2 -2
  51. package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
  52. package/dist/cjs/extensions/react-flow/edges/EdgeNew.js +1 -1
  53. package/dist/cjs/extensions/react-flow/edges/EdgeNew.js.map +1 -1
  54. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +1 -1
  55. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  56. package/dist/cjs/extensions/react-flow/minimap/MiniMap.js +1 -1
  57. package/dist/cjs/extensions/react-flow/minimap/MiniMap.js.map +1 -1
  58. package/dist/cjs/extensions/react-flow/minimap/MiniMapV12.js.map +1 -1
  59. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +2 -2
  60. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  61. package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
  62. package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +1 -3
  63. package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
  64. package/dist/esm/cmem/ContentBlobToggler/ContentBlobToggler.js +1 -0
  65. package/dist/esm/cmem/ContentBlobToggler/ContentBlobToggler.js.map +1 -1
  66. package/dist/esm/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js +32 -9
  67. package/dist/esm/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.js.map +1 -1
  68. package/dist/esm/cmem/markdown/Markdown.js +1 -2
  69. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  70. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlowV12.js.map +1 -1
  71. package/dist/esm/common/Intent/index.js +1 -1
  72. package/dist/esm/common/Intent/index.js.map +1 -1
  73. package/dist/esm/common/index.js +4 -0
  74. package/dist/esm/common/index.js.map +1 -1
  75. package/dist/esm/common/utils/reduceToText.js +75 -0
  76. package/dist/esm/common/utils/reduceToText.js.map +1 -0
  77. package/dist/esm/components/Application/ApplicationViewability.js +28 -0
  78. package/dist/esm/components/Application/ApplicationViewability.js.map +1 -0
  79. package/dist/esm/components/Application/index.js +1 -0
  80. package/dist/esm/components/Application/index.js.map +1 -1
  81. package/dist/esm/components/AutocompleteField/AutoCompleteField.js +1 -1
  82. package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  83. package/dist/esm/components/Button/Button.js +1 -1
  84. package/dist/esm/components/Button/Button.js.map +1 -1
  85. package/dist/esm/components/ContextOverlay/ContextMenu.js +2 -2
  86. package/dist/esm/components/ContextOverlay/ContextMenu.js.map +1 -1
  87. package/dist/esm/components/ContextOverlay/ContextOverlay.js +69 -22
  88. package/dist/esm/components/ContextOverlay/ContextOverlay.js.map +1 -1
  89. package/dist/esm/components/Dialog/Modal.js +15 -3
  90. package/dist/esm/components/Dialog/Modal.js.map +1 -1
  91. package/dist/esm/components/Dialog/ModalContext.js +69 -0
  92. package/dist/esm/components/Dialog/ModalContext.js.map +1 -0
  93. package/dist/esm/components/Dialog/index.js +1 -0
  94. package/dist/esm/components/Dialog/index.js.map +1 -1
  95. package/dist/esm/components/Icon/IconButton.js.map +1 -1
  96. package/dist/esm/components/Icon/canonicalIconNames.js +25 -2
  97. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  98. package/dist/esm/components/Spinner/Spinner.js +2 -1
  99. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  100. package/dist/esm/components/TextReducer/TextReducer.js +17 -41
  101. package/dist/esm/components/TextReducer/TextReducer.js.map +1 -1
  102. package/dist/esm/components/Typography/InlineText.js +33 -0
  103. package/dist/esm/components/Typography/InlineText.js.map +1 -0
  104. package/dist/esm/components/Typography/index.js +1 -0
  105. package/dist/esm/components/Typography/index.js.map +1 -1
  106. package/dist/esm/extensions/codemirror/CodeMirror.js +3 -3
  107. package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
  108. package/dist/esm/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js +1 -1
  109. package/dist/esm/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.js.map +1 -1
  110. package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js +3 -3
  111. package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
  112. package/dist/esm/extensions/react-flow/edges/EdgeNew.js +1 -1
  113. package/dist/esm/extensions/react-flow/edges/EdgeNew.js.map +1 -1
  114. package/dist/esm/extensions/react-flow/handles/HandleDefault.js +1 -1
  115. package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  116. package/dist/esm/extensions/react-flow/minimap/MiniMap.js +1 -1
  117. package/dist/esm/extensions/react-flow/minimap/MiniMap.js.map +1 -1
  118. package/dist/esm/extensions/react-flow/minimap/MiniMapV12.js.map +1 -1
  119. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +2 -2
  120. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  121. package/dist/esm/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
  122. package/dist/types/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.d.ts +26 -10
  123. package/dist/types/cmem/react-flow/StickyNoteModal/StickyNoteModal.d.ts +1 -1
  124. package/dist/types/common/index.d.ts +3 -0
  125. package/dist/types/common/utils/reduceToText.d.ts +10 -0
  126. package/dist/types/components/Application/ApplicationViewability.d.ts +36 -0
  127. package/dist/types/components/Application/index.d.ts +1 -0
  128. package/dist/types/components/Button/Button.d.ts +14 -7
  129. package/dist/types/components/ContextOverlay/ContextMenu.d.ts +1 -1
  130. package/dist/types/components/Dialog/Modal.d.ts +9 -1
  131. package/dist/types/components/Dialog/ModalContext.d.ts +13 -0
  132. package/dist/types/components/Dialog/index.d.ts +1 -0
  133. package/dist/types/components/Icon/IconButton.d.ts +1 -1
  134. package/dist/types/components/Icon/canonicalIconNames.d.ts +23 -0
  135. package/dist/types/components/Spinner/Spinner.d.ts +11 -4
  136. package/dist/types/components/Structure/TitleSubsection.d.ts +1 -1
  137. package/dist/types/components/Tabs/Tab.d.ts +4 -4
  138. package/dist/types/components/TextReducer/TextReducer.d.ts +13 -1
  139. package/dist/types/components/Typography/InlineText.d.ts +13 -0
  140. package/dist/types/components/Typography/index.d.ts +1 -0
  141. package/dist/types/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.d.ts +1 -1
  142. package/dist/types/extensions/codemirror/tests/codemirrorTestHelper.d.ts +1 -1
  143. package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +1 -1
  144. package/package.json +54 -53
  145. package/src/cmem/ActivityControl/SilkActivityControl.tsx +1 -1
  146. package/src/cmem/ContentBlobToggler/ContentBlobToggler.tsx +1 -1
  147. package/src/cmem/ContentBlobToggler/StringPreviewContentBlobToggler.tsx +65 -17
  148. package/src/cmem/ContentBlobToggler/stories/StringPreviewContentBlobToggler.stories.tsx +27 -0
  149. package/src/cmem/ContentBlobToggler/tests/StringPreviewContentBlobToggler.test.tsx +98 -0
  150. package/src/cmem/markdown/Markdown.tsx +1 -2
  151. package/src/cmem/react-flow/ReactFlow/ReactFlowV12.tsx +1 -0
  152. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +1 -1
  153. package/src/cmem/react-flow/_minimap.scss +10 -0
  154. package/src/cmem/react-flow/configuration/_colors-graph.scss +12 -12
  155. package/src/cmem/react-flow/configuration/_colors-linking.scss +8 -8
  156. package/src/cmem/react-flow/configuration/_colors-workflow.scss +11 -11
  157. package/src/common/Intent/index.ts +2 -1
  158. package/src/common/index.ts +6 -0
  159. package/src/common/scss/_color-functions.scss +5 -0
  160. package/src/common/utils/reduceToText.tsx +82 -0
  161. package/src/components/Application/ApplicationViewability.tsx +61 -0
  162. package/src/components/Application/_content.scss +7 -0
  163. package/src/components/Application/_header.scss +12 -3
  164. package/src/components/Application/_viewability.scss +13 -0
  165. package/src/components/Application/application.scss +1 -0
  166. package/src/components/Application/index.ts +1 -0
  167. package/src/components/Application/stories/ApplicationViewability.stories.tsx +37 -0
  168. package/src/components/Application/tests/ApplicationViewability.test.tsx +43 -0
  169. package/src/components/AutoSuggestion/tests/ExtendedCodeEditor.test.tsx +1 -1
  170. package/src/components/AutocompleteField/AutoCompleteField.tsx +1 -0
  171. package/src/components/Button/Button.stories.tsx +7 -1
  172. package/src/components/Button/Button.tsx +16 -9
  173. package/src/components/Button/button.scss +86 -24
  174. package/src/components/Card/card.scss +6 -0
  175. package/src/components/Chat/stories/ChatField.stories.tsx +6 -1
  176. package/src/components/Checkbox/checkbox.scss +14 -2
  177. package/src/components/ContentGroup/_contentgroup.scss +9 -0
  178. package/src/components/ContextOverlay/ContextMenu.tsx +4 -1
  179. package/src/components/ContextOverlay/ContextOverlay.tsx +77 -18
  180. package/src/components/ContextOverlay/tests/ContextMenu.test.tsx +43 -0
  181. package/src/components/ContextOverlay/tests/ContextOverlay.test.tsx +71 -0
  182. package/src/components/Depiction/depiction.scss +6 -0
  183. package/src/components/Dialog/Modal.tsx +28 -3
  184. package/src/components/Dialog/ModalContext.tsx +56 -0
  185. package/src/components/Dialog/index.ts +1 -0
  186. package/src/components/Dialog/stories/Modal.stories.tsx +10 -7
  187. package/src/components/Dialog/stories/ModalContext.stories.tsx +153 -0
  188. package/src/components/FlexibleLayout/flexiblelayout.scss +16 -0
  189. package/src/components/Grid/grid.scss +17 -0
  190. package/src/components/Grid/stories/Grid.stories.tsx +10 -7
  191. package/src/components/Grid/stories/GridRow.stories.tsx +13 -7
  192. package/src/components/Icon/IconButton.tsx +1 -1
  193. package/src/components/Icon/canonicalIconNames.tsx +25 -2
  194. package/src/components/Icon/icon.scss +6 -0
  195. package/src/components/Icon/stories/Icon.stories.tsx +65 -5
  196. package/src/components/Icon/stories/IconButton.stories.tsx +2 -1
  197. package/src/components/Notification/Notification.stories.tsx +20 -6
  198. package/src/components/Notification/notification.scss +14 -3
  199. package/src/components/OverviewItem/overviewitem.scss +9 -0
  200. package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +28 -0
  201. package/src/components/OverviewItem/stories/OverviewItemActions.stories.tsx +2 -2
  202. package/src/components/OverviewItem/stories/OverviewItemDescription.stories.tsx +1 -1
  203. package/src/components/OverviewItem/stories/OverviewItemLine.stories.tsx +1 -1
  204. package/src/components/ProgressBar/Stories/ProgressBar.stories.tsx +7 -1
  205. package/src/components/PropertyValuePair/propertyvalue.scss +23 -1
  206. package/src/components/Select/Select.stories.tsx +1 -1
  207. package/src/components/Separation/separation.scss +6 -0
  208. package/src/components/Spinner/Spinner.tsx +13 -3
  209. package/src/components/Spinner/Stories/spinner.stories.tsx +1 -1
  210. package/src/components/Spinner/spinner.scss +5 -1
  211. package/src/components/Table/table.scss +22 -0
  212. package/src/components/Tag/stories/TagList.stories.tsx +2 -2
  213. package/src/components/Tag/tag.scss +105 -74
  214. package/src/components/TextField/textfield.scss +23 -15
  215. package/src/components/TextReducer/TextReducer.stories.tsx +2 -1
  216. package/src/components/TextReducer/TextReducer.test.tsx +44 -0
  217. package/src/components/TextReducer/TextReducer.tsx +17 -44
  218. package/src/components/Typography/InlineText.tsx +24 -0
  219. package/src/components/Typography/index.ts +1 -0
  220. package/src/components/Typography/stories/InlineText.stories.tsx +27 -0
  221. package/src/components/Typography/typography.scss +23 -2
  222. package/src/components/VisualTour/stories/VisualTour.stories.tsx +1 -1
  223. package/src/configuration/_palettes.scss +2 -1
  224. package/src/extensions/codemirror/CodeMirror.tsx +4 -4
  225. package/src/extensions/codemirror/hooks/useCodemirrorModeExtension.hooks.ts +1 -2
  226. package/src/extensions/codemirror/tests/codemirrorTestHelper.ts +3 -3
  227. package/src/extensions/react-flow/_config.scss +8 -3
  228. package/src/extensions/react-flow/_react-flow_v12.scss +10 -14
  229. package/src/extensions/react-flow/edges/EdgeLabel.tsx +1 -1
  230. package/src/extensions/react-flow/edges/EdgeNew.tsx +2 -1
  231. package/src/extensions/react-flow/edges/_edges.scss +15 -7
  232. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +5 -5
  233. package/src/extensions/react-flow/handles/HandleDefault.tsx +2 -2
  234. package/src/extensions/react-flow/minimap/MiniMap.tsx +2 -1
  235. package/src/extensions/react-flow/minimap/MiniMapV12.tsx +1 -1
  236. package/src/extensions/react-flow/nodes/NodeContent.tsx +2 -2
  237. package/src/extensions/react-flow/nodes/_nodes.scss +4 -3
  238. package/src/extensions/react-flow/nodes/nodeUtils.tsx +1 -0
  239. package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +2 -2
@@ -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
+ });
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { render } from "@testing-library/react";
3
2
  import { EditorView } from "@codemirror/view";
3
+ import { render } from "@testing-library/react";
4
4
 
5
5
  import "@testing-library/jest-dom";
6
6
 
@@ -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}
@@ -20,7 +20,7 @@ export default {
20
20
  },
21
21
  intent: {
22
22
  ...helpersArgTypes.exampleIntent,
23
- options: ["UNDEFINED", "primary", "success", "warning", "danger"],
23
+ options: ["UNDEFINED", "primary", "accent", "success", "warning", "danger"],
24
24
  },
25
25
  },
26
26
  } as Meta<typeof Button>;
@@ -62,6 +62,8 @@ const TemplateSemantic: StoryFn<typeof Button> = (args) => (
62
62
  <Button {...args} affirmative text="Affirmative action" />
63
63
  <Spacing vertical />
64
64
  <Button {...args} disruptive text="Disruptive action" />
65
+ <Spacing vertical />
66
+ <Button {...args} elevated text="Elevated action" />
65
67
  </OverlaysProvider>
66
68
  );
67
69
  export const ButtonSemantics = TemplateSemantic.bind({});
@@ -74,6 +76,10 @@ const TemplateIntent: StoryFn<typeof Button> = (args) => (
74
76
  <Button {...args} text="Warning" intent="warning" />
75
77
  <Spacing vertical />
76
78
  <Button {...args} text="Danger" intent="danger" />
79
+ <Spacing vertical />
80
+ <Button {...args} text="Primary" intent="primary" />
81
+ <Spacing vertical />
82
+ <Button {...args} text="Accent" intent="accent" />
77
83
  </OverlaysProvider>
78
84
  );
79
85
  export const ButtonIntent = TemplateIntent.bind({});
@@ -17,19 +17,23 @@ import Tooltip, { TooltipProps } from "./../Tooltip/Tooltip";
17
17
  interface AdditionalButtonProps {
18
18
  /**
19
19
  * Always use this when the button triggers an affirmative action, e.g. confirm a process.
20
- * The button is displayed with primary color scheme.
20
+ * The button is displayed with accent color intent.
21
21
  */
22
22
  affirmative?: boolean;
23
23
  /**
24
24
  * Always use this when the button triggers an disruptive action, e.g. delete or remove.
25
- * The button is displayed with primary color scheme.
25
+ * The button is displayed with danger color intent.
26
26
  */
27
27
  disruptive?: boolean;
28
28
  /**
29
29
  * Use this when a button is important enough to highlight it in a set of other buttons.
30
- * The button is displayed with primary color scheme.
30
+ * The button is displayed with accent color intent.
31
31
  */
32
32
  elevated?: boolean;
33
+ /**
34
+ * Intent state visualized by color.
35
+ */
36
+ intent?: BlueprintIntent | "accent";
33
37
  /**
34
38
  * Content displayed in a badge that is attached to the button.
35
39
  * By default it is displayed `{ size: "small", position: "top-right", maxLength: 2 }` and with the same intent state of the button.
@@ -49,18 +53,21 @@ interface AdditionalButtonProps {
49
53
  */
50
54
  tooltipProps?: Partial<Omit<TooltipProps, "content" | "children">>;
51
55
  /**
52
- * If an URL is set then the button is included as HTML anchor element instead of a button form element.
56
+ * Icon displayed on button start.
53
57
  */
54
- //href?: string;
55
58
  icon?: ValidIconName | JSX.Element;
59
+ /**
60
+ * Icon displayed on button end.
61
+ */
56
62
  rightIcon?: ValidIconName | JSX.Element;
57
- //target?: string;
58
63
  }
59
64
 
60
- interface ExtendedButtonProps extends AdditionalButtonProps, Omit<BlueprintButtonProps, "icon" | "rightIcon"> {}
65
+ interface ExtendedButtonProps
66
+ extends AdditionalButtonProps,
67
+ Omit<BlueprintButtonProps, "intent" | "icon" | "rightIcon"> {}
61
68
  interface ExtendedAnchorButtonProps
62
69
  extends AdditionalButtonProps,
63
- Omit<BlueprintAnchorButtonProps, "icon" | "rightIcon"> {}
70
+ Omit<BlueprintAnchorButtonProps, "intent" | "icon" | "rightIcon"> {}
64
71
 
65
72
  export type ButtonProps = ExtendedButtonProps & ExtendedAnchorButtonProps;
66
73
 
@@ -86,7 +93,7 @@ export const Button = ({
86
93
  let intentByFunction;
87
94
  switch (true) {
88
95
  case affirmative || elevated:
89
- intentByFunction = BlueprintIntent.PRIMARY;
96
+ intentByFunction = "accent";
90
97
  break;
91
98
  case disruptive:
92
99
  intentByFunction = BlueprintIntent.DANGER;
@@ -1,5 +1,6 @@
1
1
  @use "sass:color";
2
2
  @use "sass:map";
3
+ @use "sass:list";
3
4
 
4
5
  $button-height: $pt-button-height;
5
6
  $button-border-width: 1px; // !default;
@@ -49,64 +50,125 @@ $dark-button-gradient: $button-gradient; // !default;
49
50
  // $button-outlined-border-disabled-intent-opacity: 0.2 !default;
50
51
 
51
52
  $button-intents: (
52
- "primary": (
53
+ // default - hover - active
54
+ "primary":
55
+ (
56
+ eccgui-color-var("identity", "brand", "900"),
57
+ eccgui-color-mix(
58
+ eccgui-color-var("identity", "brand", "900"),
59
+ eccgui-color-var("identity", "text", "900") 10%
60
+ ),
61
+ eccgui-color-mix(
62
+ eccgui-color-var("identity", "brand", "900"),
63
+ eccgui-color-var("identity", "text", "900") 20%
64
+ )
65
+ ),
66
+ "accent": (
53
67
  eccgui-color-var("identity", "accent", "900"),
54
- eccgui-color-var("identity", "accent", "700"),
55
- eccgui-color-var("identity", "accent", "500"),
68
+ eccgui-color-mix(
69
+ eccgui-color-var("identity", "accent", "900"),
70
+ eccgui-color-var("identity", "text", "900") 10%
71
+ ),
72
+ eccgui-color-mix(eccgui-color-var("identity", "accent", "900"), eccgui-color-var("identity", "text", "900") 20%)
56
73
  ),
57
74
  "success": (
58
75
  eccgui-color-var("semantic", "success", "900"),
59
- eccgui-color-var("semantic", "success", "700"),
60
- eccgui-color-var("semantic", "success", "500"),
76
+ eccgui-color-mix(
77
+ eccgui-color-var("semantic", "success", "900"),
78
+ eccgui-color-var("identity", "text", "900") 10%
79
+ ),
80
+ eccgui-color-mix(
81
+ eccgui-color-var("semantic", "success", "900"),
82
+ eccgui-color-var("identity", "text", "900") 20%
83
+ )
61
84
  ),
62
85
  "warning": (
63
86
  eccgui-color-var("semantic", "warning", "900"),
64
- eccgui-color-var("semantic", "warning", "700"),
65
- eccgui-color-var("semantic", "warning", "500"),
87
+ eccgui-color-mix(
88
+ eccgui-color-var("semantic", "warning", "900"),
89
+ eccgui-color-var("identity", "text", "900") 10%
90
+ ),
91
+ eccgui-color-mix(
92
+ eccgui-color-var("semantic", "warning", "900"),
93
+ eccgui-color-var("identity", "text", "900") 20%
94
+ )
66
95
  ),
67
96
  "danger": (
68
97
  eccgui-color-var("semantic", "danger", "900"),
69
- eccgui-color-var("semantic", "danger", "700"),
70
- eccgui-color-var("semantic", "danger", "500"),
71
- ),
98
+ eccgui-color-mix(
99
+ eccgui-color-var("semantic", "danger", "900"),
100
+ eccgui-color-var("identity", "text", "900") 10%
101
+ ),
102
+ eccgui-color-mix(eccgui-color-var("semantic", "danger", "900"), eccgui-color-var("identity", "text", "900") 20%)
103
+ )
72
104
  );
73
105
 
74
106
  @import "~@blueprintjs/core/src/components/button/button";
75
107
 
76
- .#{$ns}-button {
77
- position: relative;
78
-
79
- .#{$ns}-large {
80
- min-height: mini-units(6);
81
- }
82
-
83
- // special case override: blueprint do not use configured colors here
84
- &.#{$ns}-intent-warning {
85
- @include pt-button-intent(map.get($button-intents, "warning")...);
108
+ @mixin eccgui-enhance-blueprint-button-intent($intentvalue) {
109
+ &.#{$ns}-intent-#{$intentvalue} {
110
+ @include pt-button-intent(map.get($button-intents, $intentvalue)...);
86
111
 
87
112
  &:not(.#{$ns}-disabled).#{$ns}-icon > svg {
88
113
  fill: eccgui-color-rgba($white, 0.7);
89
114
  }
90
115
 
91
116
  &:not(.#{$ns}-disabled):not(.#{$ns}-minimal):not(.#{$ns}-outlined) {
92
- @include pt-button-intent(map.get($button-intents, "warning")...);
117
+ @include pt-button-intent(map.get($button-intents, $intentvalue)...);
93
118
  }
94
119
 
95
120
  &.#{$ns}-minimal,
96
121
  &.#{$ns}-outlined {
97
- color: $eccgui-color-warning-text;
122
+ color: list.nth(map.get($button-intents, $intentvalue), 1);
98
123
  background: none;
99
- border-color: $eccgui-color-warning-text;
124
+ border-color: list.nth(map.get($button-intents, $intentvalue), 1);
100
125
  box-shadow: none;
101
126
 
102
127
  &:disabled,
103
128
  &.#{$ns}-disabled {
104
- color: eccgui-color-rgba($eccgui-color-warning-text, 0.39);
129
+ color: eccgui-color-rgba(list.nth(map.get($button-intents, $intentvalue), 1), $eccgui-opacity-disabled);
130
+ border-color: eccgui-color-rgba(
131
+ list.nth(map.get($button-intents, $intentvalue), 1),
132
+ $eccgui-opacity-disabled
133
+ );
134
+ }
135
+
136
+ &:active:not(:disabled):not(.#{$ns}-disabled),
137
+ &.#{$ns}-active:not(:disabled):not(.#{$ns}-disabled) {
138
+ color: list.nth(map.get($button-intents, $intentvalue), 3);
139
+ background-color: eccgui-color-rgba(
140
+ list.nth(map.get($button-intents, $intentvalue), 3),
141
+ $eccgui-opacity-ghostly
142
+ );
143
+ border-color: list.nth(map.get($button-intents, $intentvalue), 3);
144
+ }
145
+
146
+ &:focus:not(:disabled):not(.#{$ns}-disabled),
147
+ &:hover:not(:disabled):not(.#{$ns}-disabled) {
148
+ color: list.nth(map.get($button-intents, $intentvalue), 2);
149
+ background-color: eccgui-color-rgba(
150
+ list.nth(map.get($button-intents, $intentvalue), 2),
151
+ 0.5 * $eccgui-opacity-ghostly
152
+ );
153
+ border-color: list.nth(map.get($button-intents, $intentvalue), 2);
105
154
  }
106
155
  }
107
156
  }
108
157
  }
109
158
 
159
+ .#{$ns}-button {
160
+ position: relative;
161
+
162
+ .#{$ns}-large {
163
+ min-height: mini-units(6);
164
+ }
165
+
166
+ // special case override: blueprint do not use configured colors here
167
+ @include eccgui-enhance-blueprint-button-intent("primary");
168
+ @include eccgui-enhance-blueprint-button-intent("accent");
169
+ @include eccgui-enhance-blueprint-button-intent("warning");
170
+ }
171
+
110
172
  .#{$ns}-button-text {
111
173
  min-width: 0;
112
174
  }
@@ -288,3 +288,9 @@ $eccgui-size-card-spacing: $eccgui-size-typo-base !default;
288
288
  }
289
289
  }
290
290
  }
291
+
292
+ @media print {
293
+ .#{$eccgui}-card__actions {
294
+ display: none;
295
+ }
296
+ }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Meta, StoryFn } from "@storybook/react";
3
3
 
4
- import { ChatField } from "../../../index";
4
+ import { ChatField, ContextMenu, MenuItem } from "../../../index";
5
5
 
6
6
  export default {
7
7
  title: "Components/Chat/ChatField",
@@ -15,4 +15,9 @@ const TemplateFull: StoryFn<typeof ChatField> = (args) => <ChatField {...args} k
15
15
  export const Default = TemplateFull.bind({});
16
16
  Default.args = {
17
17
  onTextSubmit: (value) => alert(value),
18
+ rightElement: (
19
+ <ContextMenu>
20
+ <MenuItem text="Just a test" />
21
+ </ContextMenu>
22
+ ),
18
23
  };
@@ -24,9 +24,15 @@ $control-indicator-spacing: $eccgui-size-inline-whitespace !default;
24
24
  // $switch-background-color-active: rgba($gray1, 0.5) !default;
25
25
  // $switch-background-color-disabled: $button-background-color-disabled !default;
26
26
  $switch-checked-background-color: $eccgui-color-accent !default;
27
- $switch-checked-background-color-hover: eccgui-color-rgba($switch-checked-background-color, $eccgui-opacity-narrow) !default;
27
+ $switch-checked-background-color-hover: eccgui-color-rgba(
28
+ $switch-checked-background-color,
29
+ $eccgui-opacity-narrow
30
+ ) !default;
28
31
  $switch-checked-background-color-active: $switch-checked-background-color-hover !default;
29
- $switch-checked-background-color-disabled: eccgui-color-rgba($switch-checked-background-color, $eccgui-opacity-disabled) !default;
32
+ $switch-checked-background-color-disabled: eccgui-color-rgba(
33
+ $switch-checked-background-color,
34
+ $eccgui-opacity-disabled
35
+ ) !default;
30
36
 
31
37
  @import "~@blueprintjs/core/src/components/forms/controls"; // Checkbox, Radio, Switch
32
38
 
@@ -73,3 +79,9 @@ $switch-checked-background-color-disabled: eccgui-color-rgba($switch-checked-bac
73
79
  display: inline-block;
74
80
  vertical-align: text-top;
75
81
  }
82
+
83
+ @media print {
84
+ .#{$ns}-control {
85
+ print-color-adjust: exact;
86
+ }
87
+ }
@@ -60,3 +60,12 @@ $eccgui-color-scontentgroup-border-sub: eccgui-color-rgba(
60
60
  flex-shrink: 1;
61
61
  width: 100%;
62
62
  }
63
+
64
+ @media print {
65
+ .#{$eccgui}-contentgroup__header__options {
66
+ display: none;
67
+ }
68
+ .#{$eccgui}-contentgroup--border-sub::after {
69
+ print-color-adjust: exact;
70
+ }
71
+ }