@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.
- package/CHANGELOG.md +45 -26
- package/dist/cjs/cmem/markdown/Markdown.js +7 -5
- package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +14 -10
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +2 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +27 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/Typography/HtmlContentBlock.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +4 -3
- package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +18 -20
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js +4 -3
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/esm/cmem/markdown/Markdown.js +7 -5
- package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +14 -10
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +2 -1
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +29 -3
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/Typography/HtmlContentBlock.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +4 -3
- package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +18 -20
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleTools.js +4 -3
- package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -1
- package/dist/types/cmem/markdown/Markdown.d.ts +8 -3
- package/dist/types/components/Icon/canonicalIconNames.d.ts +2 -1
- package/dist/types/components/MultiSelect/MultiSelect.d.ts +7 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/Typography/HtmlContentBlock.d.ts +16 -4
- package/dist/types/extensions/codemirror/CodeMirror.d.ts +2 -2
- package/package.json +28 -26
- package/src/cmem/markdown/Markdown.stories.tsx +6 -0
- package/src/cmem/markdown/Markdown.tsx +21 -7
- package/src/components/Application/_config.scss +1 -1
- package/src/components/Application/stories/Application.stories.tsx +11 -1
- package/src/components/AutoSuggestion/AutoSuggestion.scss +21 -8
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +34 -24
- package/src/components/Breadcrumb/breadcrumb.scss +8 -1
- package/src/components/Depiction/stories/Depiction.stories.tsx +18 -1
- package/src/components/Icon/canonicalIconNames.tsx +2 -1
- package/src/components/MultiSelect/MultiSelect.tsx +37 -0
- package/src/components/MultiSuggestField/MultiSuggestField.stories.tsx +22 -19
- package/src/components/MultiSuggestField/_multisuggestfield.scss +8 -0
- package/src/components/MultiSuggestField/tests/MultiSuggestField.test.tsx +103 -9
- package/src/components/OverviewItem/overviewitem.scss +18 -7
- package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +1 -1
- package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +25 -7
- package/src/components/TextField/textfield.scss +1 -2
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/Typography/HtmlContentBlock.tsx +16 -4
- package/src/components/Typography/stories/HtmlContentBlock.stories.tsx +50 -0
- package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +15 -30
- package/src/components/Typography/typography.scss +10 -0
- package/src/components/index.scss +1 -1
- package/src/extensions/_index.scss +1 -6
- package/src/extensions/codemirror/CodeMirror.tsx +10 -7
- package/src/extensions/codemirror/_codemirror.scss +1 -1
- package/src/extensions/react-flow/handles/HandleContent.tsx +1 -1
- package/src/extensions/react-flow/handles/HandleDefault.tsx +21 -33
- package/src/extensions/react-flow/handles/HandleTools.tsx +4 -3
- package/src/extensions/react-flow/handles/_handles.scss +2 -1
- package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +12 -9
- 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
|
|
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:
|
|
17
|
+
title: "Components/Typography/WhiteSpaceContainer",
|
|
18
|
+
component: WhiteSpaceContainer,
|
|
22
19
|
argTypes: {
|
|
23
|
-
children: { control:
|
|
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
|
|
30
|
+
} as Meta<typeof WhiteSpaceContainer>;
|
|
34
31
|
|
|
35
|
-
const Template: StoryFn<typeof
|
|
36
|
-
<
|
|
32
|
+
const Template: StoryFn<typeof WhiteSpaceContainer> = (args) => (
|
|
33
|
+
<WhiteSpaceContainer {...args} style={{ background: "#eee" }} />
|
|
37
34
|
);
|
|
38
35
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
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, {
|
|
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?:
|
|
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
|
-
|
|
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={
|
|
283
|
-
|
|
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
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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:
|
|
22
|
-
interactionKind: BlueprintPopoverInteractionKind.
|
|
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-
|
|
42
|
+
className={`${eccgui}-graphviz__handletools-placeholder`}
|
|
42
43
|
data-test-id={otherContextOverlayProps["data-test-id"]}
|
|
43
44
|
data-testid={otherContextOverlayProps["data-testid"]}
|
|
44
45
|
/>
|
|
@@ -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
|
-
<
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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;
|