@eccenca/gui-elements 24.1.0-rc.3 → 24.1.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 (125) hide show
  1. package/CHANGELOG.md +57 -2
  2. package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +7 -2
  3. package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  4. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +5 -3
  5. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  6. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +4 -2
  7. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  8. package/dist/cjs/components/Card/CardActions.js +2 -1
  9. package/dist/cjs/components/Card/CardActions.js.map +1 -1
  10. package/dist/cjs/components/Card/CardContent.js +4 -6
  11. package/dist/cjs/components/Card/CardContent.js.map +1 -1
  12. package/dist/cjs/components/Dialog/SimpleDialog.js +3 -3
  13. package/dist/cjs/components/Dialog/SimpleDialog.js.map +1 -1
  14. package/dist/cjs/components/Icon/canonicalIconNames.js +12 -0
  15. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  16. package/dist/cjs/components/Label/Label.js +2 -1
  17. package/dist/cjs/components/Label/Label.js.map +1 -1
  18. package/dist/cjs/components/Menu/MenuItem.js +3 -2
  19. package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
  20. package/dist/cjs/components/Switch/Switch.js +6 -4
  21. package/dist/cjs/components/Switch/Switch.js.map +1 -1
  22. package/dist/cjs/components/Tag/TagList.js +1 -1
  23. package/dist/cjs/components/Tag/TagList.js.map +1 -1
  24. package/dist/cjs/components/Typography/OverflowText.js +1 -1
  25. package/dist/cjs/components/Typography/OverflowText.js.map +1 -1
  26. package/dist/cjs/extensions/codemirror/CodeMirror.js +52 -23
  27. package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
  28. package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js +4 -1
  29. package/dist/cjs/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
  30. package/dist/cjs/extensions/codemirror/toolbars/commands/markdown.command.js +278 -0
  31. package/dist/cjs/extensions/codemirror/toolbars/commands/markdown.command.js.map +1 -0
  32. package/dist/cjs/extensions/codemirror/toolbars/markdown.toolbar.js +47 -0
  33. package/dist/cjs/extensions/codemirror/toolbars/markdown.toolbar.js.map +1 -0
  34. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +136 -41
  35. package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  36. package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js +5 -6
  37. package/dist/cjs/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
  38. package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +7 -2
  39. package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  40. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +5 -3
  41. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  42. package/dist/esm/components/AutocompleteField/AutoCompleteField.js +4 -3
  43. package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  44. package/dist/esm/components/Card/CardActions.js +2 -1
  45. package/dist/esm/components/Card/CardActions.js.map +1 -1
  46. package/dist/esm/components/Card/CardContent.js +4 -5
  47. package/dist/esm/components/Card/CardContent.js.map +1 -1
  48. package/dist/esm/components/Dialog/SimpleDialog.js +4 -4
  49. package/dist/esm/components/Dialog/SimpleDialog.js.map +1 -1
  50. package/dist/esm/components/Icon/canonicalIconNames.js +12 -0
  51. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  52. package/dist/esm/components/Label/Label.js +2 -1
  53. package/dist/esm/components/Label/Label.js.map +1 -1
  54. package/dist/esm/components/Menu/MenuItem.js +3 -2
  55. package/dist/esm/components/Menu/MenuItem.js.map +1 -1
  56. package/dist/esm/components/Switch/Switch.js +7 -5
  57. package/dist/esm/components/Switch/Switch.js.map +1 -1
  58. package/dist/esm/components/Tag/TagList.js +1 -1
  59. package/dist/esm/components/Tag/TagList.js.map +1 -1
  60. package/dist/esm/components/Typography/OverflowText.js +1 -1
  61. package/dist/esm/components/Typography/OverflowText.js.map +1 -1
  62. package/dist/esm/extensions/codemirror/CodeMirror.js +53 -24
  63. package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
  64. package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js +4 -0
  65. package/dist/esm/extensions/codemirror/tests/codemirrorTestHelper.js.map +1 -1
  66. package/dist/esm/extensions/codemirror/toolbars/commands/markdown.command.js +283 -0
  67. package/dist/esm/extensions/codemirror/toolbars/commands/markdown.command.js.map +1 -0
  68. package/dist/esm/extensions/codemirror/toolbars/markdown.toolbar.js +41 -0
  69. package/dist/esm/extensions/codemirror/toolbars/markdown.toolbar.js.map +1 -0
  70. package/dist/esm/extensions/react-flow/nodes/NodeContent.js +145 -48
  71. package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
  72. package/dist/esm/extensions/react-flow/nodes/nodeUtils.js +5 -6
  73. package/dist/esm/extensions/react-flow/nodes/nodeUtils.js.map +1 -1
  74. package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +1 -1
  75. package/dist/types/components/Card/CardActions.d.ts +5 -1
  76. package/dist/types/components/Card/CardContent.d.ts +1 -2
  77. package/dist/types/components/Dialog/SimpleDialog.d.ts +4 -1
  78. package/dist/types/components/Icon/canonicalIconNames.d.ts +12 -0
  79. package/dist/types/components/Label/Label.d.ts +3 -1
  80. package/dist/types/components/Menu/MenuItem.d.ts +8 -1
  81. package/dist/types/components/Switch/Switch.d.ts +3 -3
  82. package/dist/types/components/Typography/OverflowText.d.ts +23 -2
  83. package/dist/types/extensions/codemirror/CodeMirror.d.ts +10 -1
  84. package/dist/types/extensions/codemirror/tests/codemirrorTestHelper.d.ts +1 -0
  85. package/dist/types/extensions/codemirror/toolbars/commands/markdown.command.d.ts +55 -0
  86. package/dist/types/extensions/codemirror/toolbars/markdown.toolbar.d.ts +12 -0
  87. package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +18 -4
  88. package/dist/types/extensions/react-flow/nodes/nodeUtils.d.ts +7 -6
  89. package/package.json +22 -20
  90. package/src/cmem/ActivityControl/ActivityControlWidget.tsx +5 -2
  91. package/src/cmem/react-flow/configuration/_colors-graph.scss +4 -1
  92. package/src/cmem/react-flow/configuration/_colors-workflow.scss +3 -0
  93. package/src/components/AutoSuggestion/AutoSuggestion.tsx +5 -3
  94. package/src/components/AutocompleteField/AutoCompleteField.tsx +5 -3
  95. package/src/components/Card/CardActions.tsx +6 -0
  96. package/src/components/Card/CardContent.tsx +8 -4
  97. package/src/components/Card/card.scss +15 -0
  98. package/src/components/CodeAutocompleteField/CodeAutocompleteField.stories.tsx +3 -2
  99. package/src/components/ContextOverlay/ContextOverlay.stories.tsx +15 -4
  100. package/src/components/Dialog/SimpleDialog.tsx +9 -2
  101. package/src/components/Dialog/stories/AlertDialog.stories.tsx +5 -1
  102. package/src/components/Dialog/stories/Modal.stories.tsx +4 -2
  103. package/src/components/Dialog/stories/SimpleDialog.stories.tsx +5 -2
  104. package/src/components/Icon/canonicalIconNames.tsx +12 -0
  105. package/src/components/Label/Label.tsx +4 -0
  106. package/src/components/Label/label.scss +5 -1
  107. package/src/components/Menu/MenuItem.tsx +27 -1
  108. package/src/components/Menu/menu.scss +1 -0
  109. package/src/components/OverviewItem/overviewitem.scss +4 -1
  110. package/src/components/Select/Select.stories.tsx +4 -1
  111. package/src/components/Switch/Switch.tsx +27 -8
  112. package/src/components/Tag/TagList.tsx +2 -2
  113. package/src/components/Typography/OverflowText.tsx +24 -3
  114. package/src/components/Typography/stories/OverflowText.stories.tsx +33 -0
  115. package/src/extensions/codemirror/CodeMirror.stories.tsx +5 -17
  116. package/src/extensions/codemirror/CodeMirror.tsx +82 -22
  117. package/src/extensions/codemirror/_codemirror.scss +35 -2
  118. package/src/extensions/codemirror/tests/codemirrorTestHelper.ts +4 -0
  119. package/src/extensions/codemirror/toolbars/commands/markdown.command.ts +340 -0
  120. package/src/extensions/codemirror/toolbars/markdown.toolbar.tsx +117 -0
  121. package/src/extensions/react-flow/_config.scss +1 -0
  122. package/src/extensions/react-flow/nodes/NodeContent.tsx +166 -52
  123. package/src/extensions/react-flow/nodes/_nodes.scss +71 -35
  124. package/src/extensions/react-flow/nodes/nodeUtils.tsx +16 -14
  125. package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +6 -3
@@ -219,6 +219,8 @@ const AutoSuggestion = ({
219
219
  CodeAutocompleteFieldSuggestionWithReplacementInfo | undefined
220
220
  >(undefined);
221
221
  const [cm, setCM] = React.useState<EditorView>();
222
+ const currentCm = React.useRef<EditorView>()
223
+ currentCm.current = cm
222
224
  const isFocused = React.useRef(false);
223
225
  const autoSuggestionDivRef = React.useRef<HTMLDivElement>(null);
224
226
  /** Mutable editor state, since this needs to be current in scope of the SingleLineEditorComponent. */
@@ -235,12 +237,12 @@ const AutoSuggestion = ({
235
237
  const pathIsValid = validationResponse?.valid ?? true;
236
238
 
237
239
  React.useEffect(() => {
238
- if (reInitOnInitialValueChange && initialValue != null && cm) {
240
+ if (reInitOnInitialValueChange && initialValue != null && currentCm.current) {
239
241
  dispatch({
240
- changes: { from: 0, to: cm?.state?.doc.length, insert: initialValue },
242
+ changes: { from: 0, to: currentCm.current.state?.doc.length, insert: initialValue },
241
243
  });
242
244
  }
243
- }, [initialValue, cm, reInitOnInitialValueChange]);
245
+ }, [initialValue, reInitOnInitialValueChange]);
244
246
 
245
247
  const setCurrentIndex = (newIndex: number) => {
246
248
  editorState.index = newIndex;
@@ -301,13 +301,15 @@ function AutoCompleteField<T, UPDATE_VALUE>(props: AutoCompleteFieldProps<T, UPD
301
301
  let enableHighlighting = true;
302
302
  if (onlySelectItemReturned) {
303
303
  // If the auto-completion only returns no suggestion or the selected item itself, query with empty string.
304
- const emptyStringResults = await onSearch("");
304
+ const emptyStringResults: T[] = await onSearch("");
305
305
  // Disable highlighting, since we used empty string search
306
306
  enableHighlighting = false;
307
307
  // Put selected item at the top if it is not in the result list
308
308
  if (!!selectedItem && itemIndexOf(emptyStringResults, selectedItem) > -1) {
309
- emptyStringResults.splice(itemIndexOf(emptyStringResults, selectedItem), 1);
310
- result = [selectedItem, ...emptyStringResults];
309
+ // Do not mutate original array
310
+ const withoutSelected = [...emptyStringResults]
311
+ withoutSelected.splice(itemIndexOf(emptyStringResults, selectedItem), 1);
312
+ result = [selectedItem, ...withoutSelected];
311
313
  } else {
312
314
  result = emptyStringResults;
313
315
  }
@@ -8,6 +8,10 @@ export interface CardActionsProps extends React.HTMLAttributes<HTMLDivElement> {
8
8
  * Mainly used for cards used as modals (dialogs).
9
9
  */
10
10
  inverseDirection?: boolean;
11
+ /**
12
+ * Set footer to display its children on only one line.
13
+ */
14
+ noWrap?: boolean;
11
15
  }
12
16
 
13
17
  /**
@@ -18,6 +22,7 @@ export const CardActions = ({
18
22
  children,
19
23
  className = "",
20
24
  inverseDirection = false,
25
+ noWrap = false,
21
26
  ...otherProps
22
27
  }: CardActionsProps) => {
23
28
  return (
@@ -26,6 +31,7 @@ export const CardActions = ({
26
31
  className={
27
32
  `${eccgui}-card__actions` +
28
33
  (inverseDirection ? ` ${eccgui}-card__actions--inversedirection` : "") +
34
+ (noWrap ? ` ${eccgui}-card__actions--nowrap` : "") +
29
35
  (className ? " " + className : "")
30
36
  }
31
37
  >
@@ -15,10 +15,16 @@ export interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
15
15
  * Holds the card content.
16
16
  * Display scrollbars in case there is not enough space for it.
17
17
  */
18
- export const CardContent = ({ children, className = "", noFlexHeight, ...otherProps }: CardContentProps) => {
18
+ export const CardContent = React.forwardRef<HTMLDivElement, CardContentProps>(({
19
+ children,
20
+ className='',
21
+ noFlexHeight,
22
+ ...otherProps
23
+ }: CardContentProps, ref) => {
19
24
  return (
20
25
  <div
21
26
  {...otherProps}
27
+ ref={ref}
22
28
  className={
23
29
  `${eccgui}-card__content` +
24
30
  (noFlexHeight ? ` ${eccgui}-card__content--noflexheight` : "") +
@@ -28,6 +34,4 @@ export const CardContent = ({ children, className = "", noFlexHeight, ...otherPr
28
34
  {children}
29
35
  </div>
30
36
  );
31
- };
32
-
33
- export default CardContent;
37
+ });
@@ -236,6 +236,10 @@ $eccgui-size-card-spacing: $eccgui-size-typo-base !default;
236
236
  flex-direction: row-reverse;
237
237
  }
238
238
 
239
+ .#{$eccgui}-card__actions--nowrap {
240
+ flex-wrap: nowrap;
241
+ }
242
+
239
243
  .#{$eccgui}-card__actions__aux {
240
244
  display: flex;
241
245
  flex-flow: row wrap;
@@ -272,4 +276,15 @@ $eccgui-size-card-spacing: $eccgui-size-typo-base !default;
272
276
  .#{$eccgui}-card__actions--inversedirection > & {
273
277
  justify-content: flex-start;
274
278
  }
279
+
280
+ .#{$eccgui}-card__actions--nowrap > & {
281
+ flex-shrink: 5;
282
+ flex-wrap: nowrap;
283
+ min-width: 0;
284
+
285
+ & > * {
286
+ flex-shrink: 10;
287
+ min-width: 0;
288
+ }
289
+ }
275
290
  }
@@ -15,9 +15,10 @@ export default {
15
15
  },
16
16
  } as Meta<typeof CodeAutocompleteField>;
17
17
 
18
+ let forcedUpdateKey = 0; // @see https://github.com/storybookjs/storybook/issues/13375#issuecomment-1291011856
18
19
  const Template: StoryFn<typeof CodeAutocompleteField> = (args) => (
19
20
  <OverlaysProvider>
20
- <CodeAutocompleteField {...args} />
21
+ <CodeAutocompleteField {...args} key={++forcedUpdateKey} />
21
22
  </OverlaysProvider>
22
23
  );
23
24
 
@@ -63,7 +64,7 @@ const defaultProps: CodeAutocompleteFieldProps = {
63
64
  },
64
65
  placeholder:
65
66
  "The word before the cursor will be auto-completed. At the beginning or after a space, all results are shown.",
66
- onChange(): any {
67
+ onChange(): void {
67
68
  // Do nothing
68
69
  },
69
70
  };
@@ -4,31 +4,40 @@ import { PopoverInteractionKind, PopperModifierOverrides } from "@blueprintjs/co
4
4
  import { PopperPlacements } from "@blueprintjs/core";
5
5
  import { OverlaysProvider } from "@blueprintjs/core";
6
6
  import { Meta, StoryFn } from "@storybook/react";
7
+ import { fn } from "@storybook/test";
7
8
 
8
9
  import { Button, ContextOverlay, HtmlContentBlock } from "../../index";
9
10
 
11
+ const interactionKindOptions = { UNDEFINED: undefined, ...PopoverInteractionKind };
12
+ const rootBoundaryOptions = { UNDEFINED: undefined, VIEWPORT: "viewport", DOCUMENT: "document" };
13
+ const positioningStrategyOptions = { UNDEFINED: undefined, ABSOLUTE: "absolute", FIXED: "fixed" };
14
+
10
15
  export default {
11
16
  title: "Components/ContextOverlay",
12
17
  component: ContextOverlay,
13
18
  argTypes: {
14
19
  interactionKind: {
15
- options: { UNDEFINED: undefined, ...PopoverInteractionKind },
20
+ options: Object.keys(interactionKindOptions),
21
+ mapping: interactionKindOptions,
16
22
  },
17
23
  placement: {
18
24
  options: PopperPlacements,
19
25
  },
20
26
  rootBoundary: {
21
- options: { UNDEFINED: undefined, VIEWPORT: "viewport", DOCUMENT: "document" },
27
+ options: Object.keys(rootBoundaryOptions),
28
+ mapping: rootBoundaryOptions,
22
29
  },
23
30
  positioningStrategy: {
24
- options: { UNDEFINED: undefined, ABSOLUTE: "absolute", FIXED: "fixed" },
31
+ options: Object.keys(positioningStrategyOptions),
32
+ mapping: positioningStrategyOptions,
25
33
  },
26
34
  },
27
35
  } as Meta<typeof ContextOverlay>;
28
36
 
37
+ let forcedUpdateKey = 0;
29
38
  const Template: StoryFn<typeof ContextOverlay> = (args) => (
30
39
  <OverlaysProvider>
31
- <ContextOverlay {...args} />
40
+ <ContextOverlay {...args} key={++forcedUpdateKey} />
32
41
  </OverlaysProvider>
33
42
  );
34
43
 
@@ -55,4 +64,6 @@ Default.args = {
55
64
  } as PopperModifierOverrides,
56
65
  rootBoundary: "viewport",
57
66
  hasBackdrop: false,
67
+ onOpening: fn(),
68
+ onInteraction: fn(),
58
69
  };
@@ -5,7 +5,7 @@ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
5
  import IconButton from "../Icon/IconButton";
6
6
  import { TestableComponent } from "../interfaces";
7
7
 
8
- import { Card, CardActions, CardContent, CardHeader, CardOptions, CardTitle } from "./../Card";
8
+ import { Card, CardActions, CardActionsProps, CardContent, CardHeader, CardOptions, CardTitle } from "./../Card";
9
9
  import Divider from "./../Separation/Divider";
10
10
  import Modal, { ModalProps } from "./Modal";
11
11
 
@@ -45,6 +45,8 @@ export interface SimpleDialogProps extends ModalProps, TestableComponent {
45
45
  showFullScreenToggler?: boolean;
46
46
  /** Starts the modal in full screen mode. The show full screen toggler will be automatically enabled. */
47
47
  startInFullScreenMode?: boolean;
48
+ /** Forward properties to the actions footer component. */
49
+ actionsProps?: Omit<CardActionsProps, "inverseDirection">;
48
50
  }
49
51
 
50
52
  /**
@@ -66,6 +68,7 @@ export const SimpleDialog = ({
66
68
  showFullScreenToggler = false,
67
69
  startInFullScreenMode = false,
68
70
  size,
71
+ actionsProps,
69
72
  ...otherProps
70
73
  }: SimpleDialogProps) => {
71
74
  const [displayFullscreen, setDisplayFullscreen] = React.useState<boolean>(startInFullScreenMode);
@@ -112,7 +115,11 @@ export const SimpleDialog = ({
112
115
  <CardContent className={`${eccgui}-dialog__notifications`}>{notifications}</CardContent>
113
116
  )}
114
117
  {actions && (
115
- <CardActions inverseDirection className={intentClassName}>
118
+ <CardActions
119
+ {...actionsProps}
120
+ inverseDirection
121
+ className={`${actionsProps?.className ?? ""} ${intentClassName}`}
122
+ >
116
123
  {actions}
117
124
  </CardActions>
118
125
  )}
@@ -1,14 +1,16 @@
1
1
  import React from "react";
2
2
  import { OverlaysProvider } from "@blueprintjs/core";
3
3
  import { Meta, StoryFn } from "@storybook/react";
4
+ import { fn } from "@storybook/test";
4
5
 
5
6
  import { AlertDialog } from "./../../../../index";
6
- import { Default as SimpleDialogExample } from "./SimpleDialog.stories";
7
+ import simpleDialogStory, { Default as SimpleDialogExample } from "./SimpleDialog.stories";
7
8
 
8
9
  export default {
9
10
  title: "Components/Dialog/AlertDialog",
10
11
  component: AlertDialog,
11
12
  argTypes: {
13
+ ...simpleDialogStory.argTypes,
12
14
  headerOptions: { table: { disable: true } },
13
15
  children: { table: { disable: true } },
14
16
  actions: { table: { disable: true } },
@@ -42,4 +44,6 @@ Default.args = {
42
44
  success: false,
43
45
  warning: true,
44
46
  danger: false,
47
+ onOpening: fn(),
48
+ onClosing: fn(),
45
49
  };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { OverlaysProvider } from "@blueprintjs/core";
3
3
  import { Meta, StoryFn } from "@storybook/react";
4
+ import { fn } from "@storybook/test";
4
5
 
5
6
  import { SimpleCard } from "../../Card/stories/Card.stories";
6
7
 
@@ -11,8 +12,7 @@ export default {
11
12
  component: Modal,
12
13
  argTypes: {
13
14
  children: {
14
- control: "none",
15
- description: "Elements to include into the modal container.",
15
+ control: false,
16
16
  },
17
17
  },
18
18
  } as Meta<typeof Modal>;
@@ -30,4 +30,6 @@ Default.args = {
30
30
  isOpen: true,
31
31
  usePortal: false,
32
32
  children: <Card {...SimpleCard.args} />,
33
+ onOpening: fn(),
34
+ onClosing: fn(),
33
35
  };
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { OverlaysProvider } from "@blueprintjs/core";
3
3
  import { Meta, StoryFn } from "@storybook/react";
4
+ import { fn } from "@storybook/test";
4
5
 
5
6
  import { SimpleDialog } from "./../../../../index";
6
7
  import { Default as CardActionsExample } from "./../../Card/stories/CardActions.stories";
@@ -14,10 +15,10 @@ export default {
14
15
  argTypes: {
15
16
  ...storyModal.argTypes,
16
17
  headerOptions: {
17
- control: "none",
18
+ control: false,
18
19
  },
19
20
  actions: {
20
- control: "none",
21
+ control: false,
21
22
  },
22
23
  },
23
24
  } as Meta<typeof SimpleDialog>;
@@ -39,4 +40,6 @@ Default.args = {
39
40
  hasBorder: true,
40
41
  isOpen: true,
41
42
  usePortal: false,
43
+ onOpening: fn(),
44
+ onClosing: fn(),
42
45
  };
@@ -19,6 +19,9 @@ const canonicalIcons = {
19
19
  "artefact-commit": icons.Commit,
20
20
  "artefact-task-deleteprojectfiles": icons.TrashCan,
21
21
  "artefact-task-downloadfile": icons.CloudDownload,
22
+ "artefact-task-pivot": icons.Transpose,
23
+ "artefact-task-unpivot": icons.Transpose,
24
+ "artefact-task-concatenatetofile": icons.DocumentExport,
22
25
  "artefact-dataset-csv": icons.Csv,
23
26
  "artefact-dataset-eccencadataplatform": icons.DataVis_1,
24
27
  "artefact-dataset-excel": icons.Xls,
@@ -65,6 +68,7 @@ const canonicalIcons = {
65
68
  "item-download": icons.Download,
66
69
  "item-draggable": icons.Draggable,
67
70
  "item-edit": icons.Edit,
71
+ "item-magic-edit": icons.MagicWand,
68
72
  "item-evaluation": icons.Analytics,
69
73
  "item-execution": icons.Run,
70
74
  "item-info": icons.Information,
@@ -84,6 +88,7 @@ const canonicalIcons = {
84
88
  "item-vertmenu": icons.OverflowMenuHorizontal,
85
89
  "item-viewdetails": icons.View,
86
90
  "item-hidedetails": icons.ViewOff,
91
+ "item-image": icons.Image,
87
92
 
88
93
  "list-sortasc": icons.ArrowDown,
89
94
  "list-sortdesc": icons.ArrowUp,
@@ -125,6 +130,13 @@ const canonicalIcons = {
125
130
  "operation-filterremove": icons.FilterRemove,
126
131
  "operation-filter": icons.Filter,
127
132
  "operation-format-codeblock": icons.CodeBlock,
133
+ "operation-format-text-code": icons.Code,
134
+ "operation-format-text-bold": icons.TextBold,
135
+ "operation-format-text-italic": icons.TextItalic,
136
+ "operation-format-text-strikethrough": icons.TextStrikethrough,
137
+ "operation-format-list-bullet": icons.ListBulleted,
138
+ "operation-format-list-checked": icons.ListChecked,
139
+ "operation-format-list-numbered": icons.ListNumbered,
128
140
  "operation-fix": icons.Tools,
129
141
  "operation-link": icons.Link,
130
142
  "operation-logout": icons.Logout,
@@ -39,6 +39,8 @@ export interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement>
39
39
  * Add other elements to the end of the label content
40
40
  */
41
41
  additionalElements?: React.ReactNode | React.ReactNode[];
42
+ /** Force label to get displayed as inline block element. */
43
+ inline?: boolean;
42
44
  }
43
45
 
44
46
  export const Label = ({
@@ -52,6 +54,7 @@ export const Label = ({
52
54
  isLayoutForElement = "label",
53
55
  emphasis = "normal",
54
56
  additionalElements,
57
+ inline,
55
58
  ...otherLabelProps
56
59
  }: LabelProps) => {
57
60
  let htmlElementstring = isLayoutForElement;
@@ -85,6 +88,7 @@ export const Label = ({
85
88
  className:
86
89
  `${eccgui}-label ${eccgui}-label--${emphasis}` +
87
90
  (className ? " " + className : "") +
91
+ (inline ? ` ${eccgui}-label--inline` : "") +
88
92
  (disabled ? ` ${eccgui}-label--disabled` : ""),
89
93
  ...otherLabelProps,
90
94
  },
@@ -8,7 +8,6 @@ $eccgui-color-label-info: rgba($eccgui-color-workspace-text, $eccgui-opacity-mut
8
8
  font-size: $eccgui-size-typo-label;
9
9
  line-height: $eccgui-size-typo-label-lineheight;
10
10
  color: $eccgui-color-label-text;
11
- vertical-align: middle;
12
11
 
13
12
  .#{$eccgui}-typography__overflowtext--passdown > & {
14
13
  display: flex;
@@ -17,6 +16,11 @@ $eccgui-color-label-info: rgba($eccgui-color-workspace-text, $eccgui-opacity-mut
17
16
  }
18
17
  }
19
18
 
19
+ .#{$eccgui}-label--inline {
20
+ display: inline-block;
21
+ vertical-align: middle;
22
+ }
23
+
20
24
  .#{$eccgui}-label--disabled {
21
25
  opacity: $eccgui-opacity-disabled;
22
26
  }
@@ -5,6 +5,7 @@ import { openInNewTab } from "../../common/utils/openInNewTab";
5
5
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
6
6
  import { ValidIconName } from "../Icon/canonicalIconNames";
7
7
  import Icon from "../Icon/Icon";
8
+ import Tooltip from "../Tooltip/Tooltip";
8
9
 
9
10
  import { TestIconProps } from "./../Icon/TestIcon";
10
11
 
@@ -15,16 +16,41 @@ export interface MenuItemProps
15
16
  * If set the icon is diplayed on the left side of the menu item.
16
17
  */
17
18
  icon?: ValidIconName | string[] | React.ReactElement<TestIconProps>;
19
+ /**
20
+ * Submenu.
21
+ */
18
22
  children?: React.ReactNode;
23
+ /**
24
+ * Tooltip, but only added to the label, not to the full menu item.
25
+ */
26
+ tooltip?: string | JSX.Element;
19
27
  }
20
28
 
21
29
  /**
22
30
  * Single item, used as child inside `Menu`.
23
31
  */
24
- export const MenuItem = ({ children, className = "", icon, onClick, href, ...restProps }: MenuItemProps) => {
32
+ export const MenuItem = ({
33
+ children,
34
+ className = "",
35
+ icon,
36
+ onClick,
37
+ href,
38
+ text,
39
+ tooltip,
40
+ ...restProps
41
+ }: MenuItemProps) => {
25
42
  return (
26
43
  <BlueprintMenuItem
27
44
  {...restProps}
45
+ text={
46
+ tooltip ? (
47
+ <Tooltip content={tooltip} fill>
48
+ {text}
49
+ </Tooltip>
50
+ ) : (
51
+ text
52
+ )
53
+ }
28
54
  href={href}
29
55
  onClick={(e: React.MouseEvent<HTMLElement>) =>
30
56
  openInNewTab(e as React.MouseEvent<HTMLAnchorElement>, onClick, href)
@@ -48,6 +48,7 @@ $menu-background-color: transparent !default;
48
48
  @import "~@blueprintjs/core/src/components/menu/menu";
49
49
 
50
50
  .#{$ns}-menu {
51
+ min-width: auto;
51
52
  padding: 0;
52
53
 
53
54
  .#{$ns}-popover2-content > & {
@@ -193,7 +193,10 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
193
193
 
194
194
  .#{$eccgui}-overviewitem__item:hover &,
195
195
  .#{$eccgui}-overviewitem__item:focus &,
196
- .#{$eccgui}-overviewitem__item:active & {
196
+ .#{$eccgui}-overviewitem__item:active &,
197
+ &:focus-within,
198
+ &:has(.#{$ns}-active),
199
+ &:has(.#{$ns}-popover-open) {
197
200
  display: flex;
198
201
  }
199
202
  }
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { loremIpsum } from "react-lorem-ipsum";
3
3
  import { Meta, StoryFn } from "@storybook/react";
4
+ import { fn } from "@storybook/test";
4
5
 
5
6
  import { helpersArgTypes } from "../../../.storybook/helpers";
6
7
  import { Button, Depiction, MenuItem, Select } from "../../index";
@@ -30,7 +31,7 @@ Default.args = {
30
31
  return { label: item };
31
32
  }),
32
33
  itemRenderer: (item, props) => {
33
- return <MenuItem text={item.label} title={item.label} />;
34
+ return <MenuItem text={item.label} title={item.label} {...props} />;
34
35
  },
35
36
  fill: true,
36
37
  };
@@ -53,6 +54,7 @@ ControlledTarget.args = {
53
54
  ...Default.args,
54
55
  fill: false,
55
56
  children: <Button text="Controlled select target" intent="primary" />,
57
+ onActiveItemChange: fn(),
56
58
  };
57
59
 
58
60
  /**
@@ -70,4 +72,5 @@ ClearanceOption.args = {
70
72
  onClearanceHandler: () => {
71
73
  alert("Reset now.");
72
74
  },
75
+ onActiveItemChange: fn(),
73
76
  };
@@ -1,26 +1,45 @@
1
- import React, { memo, SyntheticEvent } from "react";
2
- import { Switch as BlueprintSwitch, SwitchProps as BlueprintSwitchProps } from "@blueprintjs/core";
1
+ import React, { memo } from "react";
2
+ import {
3
+ Classes as BlueprintClasses,
4
+ Switch as BlueprintSwitch,
5
+ SwitchProps as BlueprintSwitchProps,
6
+ } from "@blueprintjs/core";
3
7
 
4
8
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
9
+ import { Label } from "../Label/Label";
5
10
 
6
11
  export interface SwitchProps extends Omit<BlueprintSwitchProps, "onChange"> {
7
12
  /**
8
13
  * Event handler for changed state.
9
14
  */
10
- onChange?: (value: boolean) => any;
15
+ onChange?: (value: boolean) => void;
11
16
  /**
12
17
  * class names
13
18
  */
14
19
  className?: string;
15
20
  }
16
21
 
17
- export const Switch = ({ onChange, className, ...otherProps }: SwitchProps) => {
18
- const handleChange = (e: SyntheticEvent<HTMLInputElement>) => {
19
- const checked = !!(e as any).target?.checked;
20
- onChange && onChange(checked);
22
+ export const Switch = ({ onChange, className, label, ...otherProps }: SwitchProps) => {
23
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
24
+ if (onChange) {
25
+ onChange(!!e.target?.checked);
26
+ }
21
27
  };
22
28
 
23
- return <BlueprintSwitch className={`${eccgui}-switch ${className}`} {...otherProps} onChange={handleChange} />;
29
+ return (
30
+ <BlueprintSwitch
31
+ className={`${eccgui}-switch ${className ?? ""} ${
32
+ label && !otherProps.labelElement ? BlueprintClasses.INLINE : ""
33
+ }`}
34
+ labelElement={
35
+ label ? (
36
+ <Label text={label} isLayoutForElement="span" disabled={otherProps.disabled} inline />
37
+ ) : undefined
38
+ }
39
+ {...otherProps}
40
+ onChange={handleChange}
41
+ />
42
+ );
24
43
  };
25
44
 
26
45
  export default memo(Switch);
@@ -10,11 +10,11 @@ function TagList({ children, className = "", label = "", ...otherProps }: TagLis
10
10
  const tagList = (
11
11
  <ul className={`${eccgui}-tag__list` + (className && !label ? " " + className : "")} {...otherProps}>
12
12
  {React.Children.map(children, (child, i) => {
13
- return (
13
+ return child ? (
14
14
  <li className={`${eccgui}-tag__list-item`} key={"tagitem_" + i}>
15
15
  {child}
16
16
  </li>
17
- );
17
+ ) : null;
18
18
  })}
19
19
  </ul>
20
20
  );
@@ -1,13 +1,34 @@
1
1
  import React from "react";
2
2
 
3
3
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
+ import { TestableComponent } from "../../components/interfaces";
4
5
 
5
- export interface OverflowTextProps {
6
- ellipsis?: "reverse" | "none";
6
+ export interface OverflowTextProps extends React.HTMLAttributes<HTMLElement>, TestableComponent {
7
+ /**
8
+ * How is ellipsis used to cut text overflows.
9
+ * Use `reverse`to use the ellipis on text start and display the end of the text.
10
+ */
11
+ ellipsis?: "add" | "reverse" | "none";
12
+ /**
13
+ * Display component as inline element.
14
+ */
7
15
  inline?: boolean;
16
+ /**
17
+ * Using text overflow on all children elements.
18
+ */
8
19
  passDown?: boolean;
20
+ /**
21
+ * Additional CSS class name.
22
+ */
9
23
  className?: string;
24
+ /**
25
+ * HTML element that is used for the component.
26
+ */
10
27
  useHtmlElement?: "p" | "div" | "span";
28
+ /**
29
+ * Used for all other necessary properties.
30
+ * @deprecated (v25) we will allow only basic HTML element properties and testing IDs
31
+ */
11
32
  [key: string]: any;
12
33
  }
13
34
 
@@ -15,7 +36,7 @@ export interface OverflowTextProps {
15
36
  export const OverflowText = ({
16
37
  className = "",
17
38
  children,
18
- ellipsis,
39
+ ellipsis = "add",
19
40
  inline = false,
20
41
  passDown = false,
21
42
  useHtmlElement,
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import LoremIpsum, { loremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { OverflowText } from "../../../index";
6
+
7
+ const config = {
8
+ title: "Components/Typography/OverflowText",
9
+ component: OverflowText,
10
+ argTypes: {
11
+ children: {
12
+ control: "select",
13
+ options: ["simple text", "2 paragraphs"],
14
+ mapping: {
15
+ "simple text": loremIpsum({
16
+ p: 1,
17
+ avgSentencesPerParagraph: 4,
18
+ random: false,
19
+ }),
20
+ "2 paragraphs": <LoremIpsum p={2} avgSentencesPerParagraph={4} random={false} />
21
+ },
22
+ description: "Content of the element.",
23
+ },
24
+ },
25
+ } as Meta<typeof OverflowText>;
26
+ export default config;
27
+
28
+ const Template: StoryFn<typeof OverflowText> = (args) => <OverflowText {...args} />;
29
+
30
+ export const Default = Template.bind({});
31
+ Default.args = {
32
+ children: config?.argTypes?.children?.mapping ? config.argTypes.children.mapping["simple text"] : "Overflow text",
33
+ };