@eccenca/gui-elements 24.0.0-rc.4 → 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 (49) hide show
  1. package/CHANGELOG.md +41 -27
  2. package/dist/cjs/cmem/markdown/Markdown.js +2 -2
  3. package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
  4. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +12 -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/Typography/HtmlContentBlock.js.map +1 -1
  9. package/dist/cjs/extensions/react-flow/handles/HandleContent.js +1 -1
  10. package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
  11. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +18 -20
  12. package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  13. package/dist/cjs/extensions/react-flow/handles/HandleTools.js +4 -3
  14. package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -1
  15. package/dist/esm/cmem/markdown/Markdown.js +2 -2
  16. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  17. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +12 -10
  18. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  19. package/dist/esm/components/Icon/canonicalIconNames.js +2 -1
  20. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  21. package/dist/esm/components/Typography/HtmlContentBlock.js.map +1 -1
  22. package/dist/esm/extensions/react-flow/handles/HandleContent.js +1 -1
  23. package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
  24. package/dist/esm/extensions/react-flow/handles/HandleDefault.js +18 -20
  25. package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
  26. package/dist/esm/extensions/react-flow/handles/HandleTools.js +4 -3
  27. package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -1
  28. package/dist/types/cmem/markdown/Markdown.d.ts +8 -3
  29. package/dist/types/components/Icon/canonicalIconNames.d.ts +2 -1
  30. package/dist/types/components/Tooltip/Tooltip.d.ts +1 -1
  31. package/dist/types/components/Typography/HtmlContentBlock.d.ts +16 -4
  32. package/package.json +4 -2
  33. package/src/cmem/markdown/Markdown.tsx +14 -4
  34. package/src/components/Application/stories/Application.stories.tsx +11 -1
  35. package/src/components/AutoSuggestion/AutoSuggestion.tsx +31 -26
  36. package/src/components/Depiction/stories/Depiction.stories.tsx +18 -1
  37. package/src/components/Icon/canonicalIconNames.tsx +2 -1
  38. package/src/components/OverviewItem/overviewitem.scss +18 -7
  39. package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +1 -1
  40. package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +25 -7
  41. package/src/components/Tooltip/Tooltip.tsx +1 -1
  42. package/src/components/Typography/HtmlContentBlock.tsx +16 -4
  43. package/src/components/Typography/stories/HtmlContentBlock.stories.tsx +50 -0
  44. package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +15 -30
  45. package/src/extensions/react-flow/handles/HandleContent.tsx +1 -1
  46. package/src/extensions/react-flow/handles/HandleDefault.tsx +21 -33
  47. package/src/extensions/react-flow/handles/HandleTools.tsx +4 -3
  48. package/src/extensions/react-flow/handles/_handles.scss +2 -1
  49. package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +12 -9
@@ -46,11 +46,19 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
46
46
  .#{$eccgui}-overviewitem__item {
47
47
  display: flex;
48
48
  flex-flow: row nowrap;
49
- align-content: stretch;
49
+ place-content: stretch flex-start;
50
50
  align-items: stretch;
51
- justify-content: flex-start;
52
51
  max-width: 100%;
53
- height: mini-units(6);
52
+ height: auto;
53
+
54
+ // TODO: we may revalidate later again
55
+ // @see http://localhost:6006/?path=/docs/components-application--docs as testcase
56
+ // there is a weird bug in Firefox v132+
57
+ // with a fixed height the calculation of `asprect-ratio` for child elements seems to be broken in some situations (especially in combination with top/bottom `padding`)
58
+ // however, it is working when we set min- and max-height (what leads basically to the same layout like a fixed height)
59
+ // height: mini-units(6);
60
+ min-height: mini-units(6);
61
+ max-height: mini-units(6);
54
62
 
55
63
  &[tabindex]:not([tabindex="-1"]) {
56
64
  cursor: pointer;
@@ -70,7 +78,10 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
70
78
 
71
79
  .#{$eccgui}-overviewitem__item--highdensity,
72
80
  .#{$eccgui}-overviewitem__list--highdensity > li > .#{$eccgui}-overviewitem__item {
73
- height: $button-height; // mini-units(4);
81
+ // same fix for Firefox v132+ like for the normal element height
82
+ // height: $button-height; // mini-units(4);
83
+ min-height: $button-height;
84
+ max-height: $button-height;
74
85
 
75
86
  & > .#{$eccgui}-overviewitem__depiction {
76
87
  width: $button-height; // mini-units(4);
@@ -107,9 +118,10 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
107
118
 
108
119
  & > * {
109
120
  display: block;
110
- width: auto;
121
+ max-width: 100%;
111
122
  max-height: 100%;
112
123
  margin: 0 auto;
124
+ object-fit: contain;
113
125
  }
114
126
 
115
127
  &:not(.#{$eccgui}-overviewitem__depiction--keepcolors) {
@@ -127,9 +139,8 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
127
139
  flex-direction: column;
128
140
  flex-grow: 1;
129
141
  flex-shrink: 1;
130
- align-content: stretch;
142
+ place-content: stretch flex-start;
131
143
  align-items: stretch;
132
- justify-content: flex-start;
133
144
  overflow: hidden;
134
145
 
135
146
  .#{$eccgui}-overviewitem__depiction + & {
@@ -13,7 +13,7 @@ import {
13
13
  } from "./../../../../index";
14
14
  import { FullExample as OtherDepictionExample } from "./../../Depiction/stories/Depiction.stories";
15
15
  import { Default as ActionsExample } from "./OverviewItemActions.stories";
16
- import { Default as DepictionExample } from "./OverviewItemDepiction.stories";
16
+ import { AutoTransform as DepictionExample } from "./OverviewItemDepiction.stories";
17
17
  import { Default as DescriptionExample } from "./OverviewItemDescription.stories";
18
18
 
19
19
  export default {
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  import { Meta, StoryFn } from "@storybook/react";
3
3
 
4
- import { Depiction, Icon, OverviewItemDepiction } from "./../../../../index";
4
+ import png16to9 from "../../Depiction/stories/test-16to9.png";
5
+
6
+ import { Depiction, Icon, OverviewItem, OverviewItemDepiction } from "./../../../../index";
5
7
  import { FullExample as DepictionExample } from "./../../Depiction/stories/Depiction.stories";
6
8
 
7
9
  export default {
@@ -17,11 +19,24 @@ export default {
17
19
  } as Meta<typeof OverviewItemDepiction>;
18
20
 
19
21
  const Template: StoryFn<typeof OverviewItemDepiction> = (args) => (
20
- <OverviewItemDepiction {...args}></OverviewItemDepiction>
22
+ <OverviewItem>
23
+ <OverviewItemDepiction {...args}></OverviewItemDepiction>
24
+ </OverviewItem>
21
25
  );
22
26
 
23
- export const Default = Template.bind({});
24
- Default.args = {
27
+ /**
28
+ * If a `<Depiction/>` is used as only content then it is returned directly by `<OverviewItemDepiction/>`.
29
+ */
30
+ export const UseDepictionElement = Template.bind({});
31
+ UseDepictionElement.args = {
32
+ children: <Depiction {...DepictionExample.args} resizing="contain" />,
33
+ };
34
+
35
+ /**
36
+ * If an `<Icon/>` (or `<TestIcon/>`) is used as only content for `<OverviewItemDepiction/>` then it returns automatically a `<Depiction/>` element setting the `image` property to that icon.
37
+ */
38
+ export const AutoTransform = Template.bind({});
39
+ AutoTransform.args = {
25
40
  children: (
26
41
  <>
27
42
  <Icon name="artefact-dataset" />
@@ -29,7 +44,10 @@ Default.args = {
29
44
  ),
30
45
  };
31
46
 
32
- export const UseDepictionElement = Template.bind({});
33
- UseDepictionElement.args = {
34
- children: <Depiction {...DepictionExample.args} resizing="contain" />,
47
+ /**
48
+ * For all other content the `<OverviewItemDepiction/>` wrapper is set around it to keep it in the allowed size. This works mainly for image content.
49
+ */
50
+ export const Default = Template.bind({});
51
+ Default.args = {
52
+ children: <img src={png16to9} />,
35
53
  };
@@ -20,7 +20,7 @@ export interface TooltipProps extends Omit<BlueprintTooltipProps, "position"> {
20
20
  */
21
21
  size?: "small" | "medium" | "large";
22
22
  /**
23
- * The tolltip will be attached to this element when it is hovered.
23
+ * The tooltip will be attached to this element when it is hovered.
24
24
  */
25
25
  children: React.ReactNode | React.ReactNode[];
26
26
  /**
@@ -7,17 +7,29 @@ import * as TypographyClassNames from "./classnames";
7
7
  // FIXME: CMEM-3742: comment + add story
8
8
 
9
9
  export interface HtmlContentBlockProps extends React.HTMLAttributes<HTMLDivElement> {
10
- className?: string;
10
+ /**
11
+ * Content block uses smaller font size.
12
+ */
11
13
  small?: boolean;
14
+ /**
15
+ * To prevent overflow, an otherwise unbreakable string of characters — like a long word or URL — may be broken at any point if there are no otherwise-acceptable break points in the line.
16
+ */
17
+ linebreakForced?: boolean;
18
+ /**
19
+ * No automatic line breaks are inserted.
20
+ */
21
+ linebreakPrevented?: boolean;
22
+ /**
23
+ * Sub elements like code blocks are displayed without own scrollbars.
24
+ * This option may infer with `linebreakForced` and `linebreakPrevented`.
25
+ */
26
+ noScrollbarsOnChildren?: boolean;
12
27
  /** currently not supported */
13
28
  large?: boolean;
14
29
  /** currently not supported */
15
30
  muted?: boolean;
16
31
  /** currently not supported */
17
32
  disabled?: boolean;
18
- linebreakForced?: boolean;
19
- linebreakPrevented?: boolean;
20
- noScrollbarsOnChildren?: boolean;
21
33
  }
22
34
 
23
35
  export const HtmlContentBlock = ({
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import LoremIpsum, { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { HtmlContentBlock } from "../../../index";
6
+
7
+ const whiteSpaceSizeOptions = {
8
+ control: "select",
9
+ options: {
10
+ "not set": undefined,
11
+ tiny: "tiny",
12
+ small: "small",
13
+ regular: "regular",
14
+ large: "large",
15
+ xlarge: "xlarge",
16
+ },
17
+ };
18
+
19
+ export default {
20
+ title: "Components/Typography/HtmlContentBlock",
21
+ component: HtmlContentBlock,
22
+ argTypes: {
23
+ children: { control: false },
24
+ },
25
+ } as Meta<typeof HtmlContentBlock>;
26
+
27
+ const Template: StoryFn<typeof HtmlContentBlock> = (args) => <HtmlContentBlock {...args} />;
28
+
29
+ const testContent = (
30
+ <>
31
+ <LoremIpsum p={2} avgSentencesPerParagraph={4} random={false} />
32
+ <p>
33
+ <strong>
34
+ {loremIpsum({
35
+ p: 2,
36
+ avgSentencesPerParagraph: 4,
37
+ random: false,
38
+ })
39
+ .toString()
40
+ .replaceAll(" ", "")}
41
+ </strong>
42
+ </p>
43
+ <LoremIpsum p={3} avgSentencesPerParagraph={5} random={false} />
44
+ </>
45
+ );
46
+
47
+ export const Default = Template.bind({});
48
+ Default.args = {
49
+ children: testContent,
50
+ };
@@ -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",
@@ -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