@eccenca/gui-elements 24.0.0-rc.3 → 24.0.0-rc.5

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 (74) hide show
  1. package/CHANGELOG.md +45 -26
  2. package/dist/cjs/cmem/markdown/Markdown.js +7 -5
  3. package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
  4. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +14 -10
  5. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  6. package/dist/cjs/components/Icon/canonicalIconNames.js +2 -1
  7. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  8. package/dist/cjs/components/MultiSelect/MultiSelect.js +27 -1
  9. package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
  10. package/dist/cjs/components/Typography/HtmlContentBlock.js.map +1 -1
  11. package/dist/cjs/extensions/codemirror/CodeMirror.js +4 -3
  12. package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
  13. package/dist/cjs/extensions/react-flow/handles/HandleContent.js +1 -1
  14. package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
  15. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +18 -20
  16. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  17. package/dist/cjs/extensions/react-flow/handles/HandleTools.js +4 -3
  18. package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -1
  19. package/dist/esm/cmem/markdown/Markdown.js +7 -5
  20. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  21. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +14 -10
  22. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  23. package/dist/esm/components/Icon/canonicalIconNames.js +2 -1
  24. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  25. package/dist/esm/components/MultiSelect/MultiSelect.js +29 -3
  26. package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
  27. package/dist/esm/components/Typography/HtmlContentBlock.js.map +1 -1
  28. package/dist/esm/extensions/codemirror/CodeMirror.js +4 -3
  29. package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
  30. package/dist/esm/extensions/react-flow/handles/HandleContent.js +1 -1
  31. package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
  32. package/dist/esm/extensions/react-flow/handles/HandleDefault.js +18 -20
  33. package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  34. package/dist/esm/extensions/react-flow/handles/HandleTools.js +4 -3
  35. package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -1
  36. package/dist/types/cmem/markdown/Markdown.d.ts +8 -3
  37. package/dist/types/components/Icon/canonicalIconNames.d.ts +2 -1
  38. package/dist/types/components/MultiSelect/MultiSelect.d.ts +7 -1
  39. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  40. package/dist/types/components/Typography/HtmlContentBlock.d.ts +16 -4
  41. package/dist/types/extensions/codemirror/CodeMirror.d.ts +2 -2
  42. package/package.json +28 -26
  43. package/src/cmem/markdown/Markdown.stories.tsx +6 -0
  44. package/src/cmem/markdown/Markdown.tsx +21 -7
  45. package/src/components/Application/_config.scss +1 -1
  46. package/src/components/Application/stories/Application.stories.tsx +11 -1
  47. package/src/components/AutoSuggestion/AutoSuggestion.scss +21 -8
  48. package/src/components/AutoSuggestion/AutoSuggestion.tsx +34 -24
  49. package/src/components/Breadcrumb/breadcrumb.scss +8 -1
  50. package/src/components/Depiction/stories/Depiction.stories.tsx +18 -1
  51. package/src/components/Icon/canonicalIconNames.tsx +2 -1
  52. package/src/components/MultiSelect/MultiSelect.tsx +37 -0
  53. package/src/components/MultiSuggestField/MultiSuggestField.stories.tsx +22 -19
  54. package/src/components/MultiSuggestField/_multisuggestfield.scss +8 -0
  55. package/src/components/MultiSuggestField/tests/MultiSuggestField.test.tsx +103 -9
  56. package/src/components/OverviewItem/overviewitem.scss +18 -7
  57. package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +1 -1
  58. package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +25 -7
  59. package/src/components/TextField/textfield.scss +1 -2
  60. package/src/components/Tooltip/Tooltip.tsx +1 -1
  61. package/src/components/Typography/HtmlContentBlock.tsx +16 -4
  62. package/src/components/Typography/stories/HtmlContentBlock.stories.tsx +50 -0
  63. package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +15 -30
  64. package/src/components/Typography/typography.scss +10 -0
  65. package/src/components/index.scss +1 -1
  66. package/src/extensions/_index.scss +1 -6
  67. package/src/extensions/codemirror/CodeMirror.tsx +10 -7
  68. package/src/extensions/codemirror/_codemirror.scss +1 -1
  69. package/src/extensions/react-flow/handles/HandleContent.tsx +1 -1
  70. package/src/extensions/react-flow/handles/HandleDefault.tsx +21 -33
  71. package/src/extensions/react-flow/handles/HandleTools.tsx +4 -3
  72. package/src/extensions/react-flow/handles/_handles.scss +2 -1
  73. package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +12 -9
  74. package/src/index.scss +0 -1
@@ -1,26 +1,23 @@
1
1
  import React from "react";
2
- import { loremIpsum } from "react-lorem-ipsum";
3
2
  import { Meta, StoryFn } from "@storybook/react";
4
3
 
5
- import { WhiteSpaceContainer as WhiteSpaceContainerElement } from "../../../index";
4
+ import { WhiteSpaceContainer } from "../../../index";
5
+
6
+ import { Default as HtmlContentBlockStrory } from "./HtmlContentBlock.stories";
6
7
 
7
8
  const whiteSpaceSizeOptions = {
8
- control: "select",
9
- options: {
9
+ control: { type: "select" },
10
+ options: ["not set", "tiny", "small", "regular", "large", "xlarge"],
11
+ mapping: {
10
12
  "not set": undefined,
11
- tiny: "tiny",
12
- small: "small",
13
- regular: "regular",
14
- large: "large",
15
- xlarge: "xlarge",
16
13
  },
17
14
  };
18
15
 
19
16
  export default {
20
- title: "Components/Typography",
21
- component: WhiteSpaceContainerElement,
17
+ title: "Components/Typography/WhiteSpaceContainer",
18
+ component: WhiteSpaceContainer,
22
19
  argTypes: {
23
- children: { control: "none" },
20
+ children: { control: false },
24
21
  marginTop: { ...whiteSpaceSizeOptions },
25
22
  marginRight: { ...whiteSpaceSizeOptions },
26
23
  marginBottom: { ...whiteSpaceSizeOptions },
@@ -30,27 +27,15 @@ export default {
30
27
  paddingBottom: { ...whiteSpaceSizeOptions },
31
28
  paddingLeft: { ...whiteSpaceSizeOptions },
32
29
  },
33
- } as Meta<typeof WhiteSpaceContainerElement>;
30
+ } as Meta<typeof WhiteSpaceContainer>;
34
31
 
35
- const Template: StoryFn<typeof WhiteSpaceContainerElement> = (args) => (
36
- <WhiteSpaceContainerElement {...args} style={{ background: "#eee" }} />
32
+ const Template: StoryFn<typeof WhiteSpaceContainer> = (args) => (
33
+ <WhiteSpaceContainer {...args} style={{ background: "#eee" }} />
37
34
  );
38
35
 
39
- const testContent = loremIpsum({
40
- p: 2,
41
- avgSentencesPerParagraph: 4,
42
- random: false,
43
- }).toString();
44
-
45
- export const WhiteSpaceContainer = Template.bind({});
46
- WhiteSpaceContainer.args = {
47
- children: [
48
- <p>{testContent}</p>,
49
- <p>
50
- <strong>{testContent.replaceAll(" ", "")}</strong>
51
- </p>,
52
- <p>{testContent}</p>,
53
- ],
36
+ export const Default = Template.bind({});
37
+ Default.args = {
38
+ children: HtmlContentBlockStrory.args.children,
54
39
  paddingTop: "tiny",
55
40
  paddingRight: "small",
56
41
  paddingBottom: "regular",
@@ -184,6 +184,16 @@ pre {
184
184
  padding: $eccgui-size-block-whitespace * 0.5;
185
185
  overflow-x: auto;
186
186
  background-color: $eccgui-color-workspace-background;
187
+
188
+ & > div[style]:has(.#{$eccgui}-markdown__syntaxhighlighter) {
189
+ // remove styles like padding and font from prism div
190
+ padding: 0 !important;
191
+ margin: 0 !important;
192
+ font-family: inherit !important;
193
+ font-size: inherit !important;
194
+ line-height: inherit !important;
195
+ background-color: transparent !important;
196
+ }
187
197
  }
188
198
  }
189
199
 
@@ -38,6 +38,6 @@
38
38
  @import "./Typography/typography";
39
39
  @import "./Workspace/workspace";
40
40
  @import "./Accordion/accordion";
41
- @import "./AutoSuggestion/AutoSuggestion";
42
41
  @import "./Badge/badge";
43
42
  @import "./PropertyValuePair/propertyvalue";
43
+ @import "./MultiSuggestField/multisuggestfield";
@@ -1,9 +1,4 @@
1
1
  @import "./react-flow/react-flow";
2
-
3
- /*
4
- CodeMirror styles are already included by the base component styles
5
- because it is used as lib for elements there already.
6
2
  @import "./codemirror/codemirror";
7
- */
8
-
3
+ @import "./../components/AutoSuggestion/AutoSuggestion"; // the whole element should moved to extensions forlder
9
4
  @import "./uppy/fileupload";
@@ -1,13 +1,11 @@
1
- import React, { AllHTMLAttributes, useRef } from "react";
1
+ import React, { useRef } from "react";
2
2
  import { defaultKeymap, indentWithTab } from "@codemirror/commands";
3
3
  import { foldKeymap } from "@codemirror/language";
4
4
  import { EditorState, Extension } from "@codemirror/state";
5
5
  import { DOMEventHandlers, EditorView, KeyBinding, keymap, Rect, ViewUpdate } from "@codemirror/view";
6
- //CodeMirror
7
6
  import { minimalSetup } from "codemirror";
8
7
 
9
8
  import { markField } from "../../components/AutoSuggestion/extensions/markText";
10
- //constants
11
9
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
12
10
 
13
11
  //hooks
@@ -27,6 +25,7 @@ import {
27
25
  adaptedLineNumbers,
28
26
  adaptedPlaceholder,
29
27
  } from "./tests/codemirrorTestHelper";
28
+
30
29
  export interface CodeEditorProps {
31
30
  // Is called with the editor instance that allows access via the CodeMirror API
32
31
  setEditorView?: (editor: EditorView | undefined) => any;
@@ -92,7 +91,7 @@ export interface CodeEditorProps {
92
91
  /** Long lines are wrapped and displayed on multiple lines */
93
92
  wrapLines?: boolean;
94
93
 
95
- outerDivAttributes?: Partial<AllHTMLAttributes<HTMLDivElement>>;
94
+ outerDivAttributes?: Omit<React.HTMLAttributes<HTMLDivElement>, "id" | "data-test-id">;
96
95
 
97
96
  /**
98
97
  * Size in spaces that is used for a tabulator key.
@@ -276,11 +275,15 @@ export const CodeEditor = ({
276
275
 
277
276
  return (
278
277
  <div
279
- id={id ? id : `codemirror-${name}`}
278
+ {...outerDivAttributes}
279
+ // overwrite/extend some attributes
280
+ id={id ? id : name ? `codemirror-${name}` : undefined}
280
281
  ref={parent}
281
282
  data-test-id="codemirror-wrapper"
282
- className={`${eccgui}-codeeditor ${eccgui}-codeeditor--mode-${mode}`}
283
- {...outerDivAttributes}
283
+ className={
284
+ `${eccgui}-codeeditor ${eccgui}-codeeditor--mode-${mode}` +
285
+ (outerDivAttributes?.className ? ` ${outerDivAttributes?.className}` : "")
286
+ }
284
287
  />
285
288
  );
286
289
  };
@@ -29,7 +29,6 @@ $eccgui-color-codeeditor-background: $eccgui-color-textfield-background !default
29
29
  // fix size to prevent wrong calculation of other elements
30
30
  padding: 0;
31
31
  margin: 1px;
32
- cursor: text;
33
32
  }
34
33
 
35
34
  &.cm-focused {
@@ -54,6 +53,7 @@ $eccgui-color-codeeditor-background: $eccgui-color-textfield-background !default
54
53
  }
55
54
 
56
55
  .cm-content {
56
+ cursor: text;
57
57
  border-right-width: $eccgui-size-inline-whitespace !important;
58
58
  }
59
59
 
@@ -26,7 +26,7 @@ export const HandleContent = memo(
26
26
  <></>
27
27
  );
28
28
 
29
- if (extendedTooltip && tooltipProps?.isOpen) {
29
+ if (extendedTooltip) {
30
30
  return (
31
31
  <Tooltip
32
32
  content={extendedTooltip}
@@ -1,6 +1,7 @@
1
1
  import React, { memo } from "react";
2
2
  import { Handle as HandleLegacy, HandleProps as ReactFlowHandleLegacyProps } from "react-flow-renderer";
3
3
  import { Handle as HandleNext, HandleProps as ReactFlowHandleNextProps } from "react-flow-renderer-lts";
4
+ import { Classes as BlueprintClasses } from "@blueprintjs/core";
4
5
 
5
6
  import { intentClassName, IntentTypes } from "../../../common/Intent";
6
7
  import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
@@ -44,34 +45,11 @@ export const HandleDefault = memo(
44
45
  const flowVersionCheck = flowVersion || evaluateFlowVersion;
45
46
  const handleDefaultRef = React.useRef<any>();
46
47
  const [extendedTooltipDisplayed, setExtendedTooltipDisplayed] = React.useState<boolean>(false);
47
- const [handleToolsDisplayed, setHandleToolsDisplayed] = React.useState<boolean>(false);
48
48
 
49
- const routeClickToTools = React.useCallback(
50
- (e: Event) => {
51
- const toolsTarget = handleDefaultRef.current.getElementsByClassName(
52
- `${eccgui}-graphviz__handletools-target`
53
- );
54
- if (toolsTarget.length > 0 && e.target === handleDefaultRef.current) {
55
- setHandleToolsDisplayed(true);
56
- setExtendedTooltipDisplayed(false);
57
- }
58
- },
59
- [handleDefaultRef]
60
- );
61
-
62
- React.useEffect(() => {
63
- const toolsTarget = handleDefaultRef.current.getElementsByClassName(
64
- `${eccgui}-graphviz__handletools-target`
65
- );
66
- if (toolsTarget && toolsTarget[0] && handleToolsDisplayed) {
67
- toolsTarget[0].click();
68
- }
69
- }, [handleToolsDisplayed]);
49
+ let toolsTarget: HTMLElement[];
70
50
 
71
51
  React.useEffect(() => {
72
- const toolsTarget = handleDefaultRef.current.getElementsByClassName(
73
- `${eccgui}-graphviz__handletools-target`
74
- );
52
+ toolsTarget = handleDefaultRef.current.getElementsByClassName(`${eccgui}-graphviz__handletools-target`);
75
53
  if (toolsTarget && toolsTarget[0]) {
76
54
  // Polyfill for FF that does not support the `:has()` pseudo selector until at least version 119 or 120
77
55
  // need to be re-evaluated then
@@ -97,7 +75,7 @@ export const HandleDefault = memo(
97
75
  },
98
76
  intent: intent,
99
77
  className: `${eccgui}-graphviz__handle__tooltip-target`,
100
- isOpen: extendedTooltipDisplayed && !handleToolsDisplayed,
78
+ isOpen: extendedTooltipDisplayed,
101
79
  };
102
80
 
103
81
  const handleContentProps = {
@@ -111,6 +89,8 @@ export const HandleDefault = memo(
111
89
  const handleContent = <HandleContent {...handleContentProps}>{children}</HandleContent>;
112
90
 
113
91
  let switchTooltipTimerOn: ReturnType<typeof setTimeout>;
92
+ let switchToolsTimerOff: ReturnType<typeof setTimeout>;
93
+
114
94
  const handleConfig = {
115
95
  ...handleProps,
116
96
  ...tooltipTitle,
@@ -119,18 +99,26 @@ export const HandleDefault = memo(
119
99
  if (handleProps.onClick) {
120
100
  handleProps.onClick(e);
121
101
  }
122
- routeClickToTools(e);
102
+ if (toolsTarget.length > 0 && e.target === handleDefaultRef.current) {
103
+ setExtendedTooltipDisplayed(false);
104
+ toolsTarget[0].click();
105
+ }
123
106
  },
124
107
  "data-category": category,
125
- onMouseEnter: () => {
126
- switchTooltipTimerOn = setTimeout(
127
- () => setExtendedTooltipDisplayed(true),
128
- data?.tooltipProps?.hoverOpenDelay ?? 500
129
- );
130
- setHandleToolsDisplayed(false);
108
+ onMouseEnter: (e: any) => {
109
+ if (switchToolsTimerOff) clearTimeout(switchToolsTimerOff);
110
+ if (e.target === handleDefaultRef.current) {
111
+ switchTooltipTimerOn = setTimeout(
112
+ () => setExtendedTooltipDisplayed(true),
113
+ data?.tooltipProps?.hoverOpenDelay ?? 500
114
+ );
115
+ }
131
116
  },
132
117
  onMouseLeave: () => {
133
118
  if (switchTooltipTimerOn) clearTimeout(switchTooltipTimerOn);
119
+ if (toolsTarget.length > 0 && toolsTarget[0].classList.contains(BlueprintClasses.POPOVER_OPEN)) {
120
+ switchToolsTimerOff = setTimeout(() => toolsTarget[0].click(), 500);
121
+ }
134
122
  setExtendedTooltipDisplayed(false);
135
123
  },
136
124
  };
@@ -18,8 +18,9 @@ export const HandleTools = ({ children, ...otherContextOverlayProps }: HandleToo
18
18
  const configToolsDisplayed = toolsDisplayed
19
19
  ? {
20
20
  defaultIsOpen: true,
21
- autoFocus: true,
22
- interactionKind: BlueprintPopoverInteractionKind.HOVER,
21
+ autoFocus: false,
22
+ interactionKind: BlueprintPopoverInteractionKind.CLICK,
23
+ openOnTargetFocus: true,
23
24
  onClosing: () => setToolsDisplayed(false),
24
25
  }
25
26
  : {
@@ -38,7 +39,7 @@ export const HandleTools = ({ children, ...otherContextOverlayProps }: HandleToo
38
39
  popoverClassName={`${eccgui}-graphviz__handletools-overlay`}
39
40
  >
40
41
  <div
41
- className={`${eccgui}-graphviz__handletools-target`}
42
+ className={`${eccgui}-graphviz__handletools-placeholder`}
42
43
  data-test-id={otherContextOverlayProps["data-test-id"]}
43
44
  data-testid={otherContextOverlayProps["data-testid"]}
44
45
  />
@@ -230,7 +230,8 @@ div.react-flow__handle-bottom {
230
230
  }
231
231
  }
232
232
 
233
- .#{$eccgui}-graphviz__handletools-target {
233
+ .#{$eccgui}-graphviz__handletools-target,
234
+ .#{$eccgui}-graphviz__handletools-placeholder {
234
235
  position: absolute;
235
236
  top: 0;
236
237
  left: 0;
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useState } from "react";
2
2
  import { Elements, ReactFlowProvider } from "react-flow-renderer";
3
+ import { OverlaysProvider } from "@blueprintjs/core";
3
4
  import { Meta, StoryFn } from "@storybook/react";
4
5
 
5
6
  import { Definitions } from "../../../../common/Intent";
@@ -63,15 +64,17 @@ const HandleDefaultExample = (args: any) => {
63
64
  );
64
65
 
65
66
  return (
66
- <ReactFlowProvider>
67
- <ReactFlow
68
- elements={elements}
69
- style={{ height: "400px" }}
70
- onLoad={onLoad}
71
- edgeTypes={edgeTypes}
72
- defaultZoom={1}
73
- />
74
- </ReactFlowProvider>
67
+ <OverlaysProvider>
68
+ <ReactFlowProvider>
69
+ <ReactFlow
70
+ elements={elements}
71
+ style={{ height: "400px" }}
72
+ onLoad={onLoad}
73
+ edgeTypes={edgeTypes}
74
+ defaultZoom={1}
75
+ />
76
+ </ReactFlowProvider>
77
+ </OverlaysProvider>
75
78
  );
76
79
  };
77
80
 
package/src/index.scss CHANGED
@@ -50,7 +50,6 @@ $prefix-carbon: $prefix;
50
50
  // == Load basic components styles =============================================
51
51
 
52
52
  @import "./components";
53
- @import "./extensions/codemirror/codemirror";
54
53
 
55
54
  // set more readable variable for prefix
56
55
  $prefix-eccgui: $eccgui;