@eccenca/gui-elements 23.8.0-rc.0 → 23.8.0-rc.1

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 (44) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +29 -3
  3. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  4. package/dist/cjs/components/Accordion/Accordion.js +14 -2
  5. package/dist/cjs/components/Accordion/Accordion.js.map +1 -1
  6. package/dist/cjs/components/Accordion/AccordionItem.js +10 -1
  7. package/dist/cjs/components/Accordion/AccordionItem.js.map +1 -1
  8. package/dist/cjs/components/Application/ApplicationContainer.js +5 -2
  9. package/dist/cjs/components/Application/ApplicationContainer.js.map +1 -1
  10. package/dist/cjs/components/Application/helper.js +38 -1
  11. package/dist/cjs/components/Application/helper.js.map +1 -1
  12. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +29 -3
  13. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  14. package/dist/esm/components/Accordion/Accordion.js +14 -2
  15. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  16. package/dist/esm/components/Accordion/AccordionItem.js +10 -1
  17. package/dist/esm/components/Accordion/AccordionItem.js.map +1 -1
  18. package/dist/esm/components/Application/ApplicationContainer.js +5 -2
  19. package/dist/esm/components/Application/ApplicationContainer.js.map +1 -1
  20. package/dist/esm/components/Application/helper.js +61 -0
  21. package/dist/esm/components/Application/helper.js.map +1 -1
  22. package/dist/types/cmem/react-flow/ReactFlow/ReactFlow.d.ts +4 -0
  23. package/dist/types/components/Accordion/Accordion.d.ts +11 -1
  24. package/dist/types/components/Accordion/AccordionItem.d.ts +15 -1
  25. package/dist/types/components/Application/ApplicationContainer.d.ts +8 -2
  26. package/dist/types/components/Application/helper.d.ts +6 -0
  27. package/package.json +5 -2
  28. package/src/_shame.scss +0 -27
  29. package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +40 -2
  30. package/src/cmem/react-flow/_canvas.scss +15 -0
  31. package/src/cmem/react-flow/_index.scss +1 -0
  32. package/src/components/Accordion/Accordion.tsx +28 -1
  33. package/src/components/Accordion/AccordionItem.tsx +23 -0
  34. package/src/components/Accordion/Stories/Accordion.stories.tsx +12 -4
  35. package/src/components/Accordion/Stories/AccordionItem.stories.tsx +11 -3
  36. package/src/components/Accordion/accordion.scss +103 -44
  37. package/src/components/Application/ApplicationContainer.tsx +19 -3
  38. package/src/components/Application/_dropzone.scss +36 -0
  39. package/src/components/Application/application.scss +1 -0
  40. package/src/components/Application/helper.ts +39 -0
  41. package/src/configuration/_variables.scss +1 -0
  42. package/src/extensions/_index.scss +2 -0
  43. package/src/extensions/uppy/_fileupload.scss +47 -0
  44. package/src/index.scss +9 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eccenca/gui-elements",
3
3
  "description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
4
- "version": "23.8.0-rc.0",
4
+ "version": "23.8.0-rc.1",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/eccenca/gui-elements",
7
7
  "bugs": "https://github.com/eccenca/gui-elements/issues",
@@ -166,7 +166,10 @@
166
166
  "**/word-wrap": "^1.2.4",
167
167
  "**/webpack-dev-middleware": "^6.1.2",
168
168
  "**/braces": "^3.0.3",
169
- "**/ws": "^8.17.1"
169
+ "**/ws": "^8.17.1",
170
+ "**/ejs": "^3.1.10",
171
+ "**/tar": "^6.2.1",
172
+ "**/express": "^4.19.2"
170
173
  },
171
174
  "husky": {
172
175
  "hooks": {
package/src/_shame.scss CHANGED
@@ -19,33 +19,6 @@
19
19
  border: 0;
20
20
  }
21
21
 
22
- .uppy-DragDrop-container {
23
- color: inherit;
24
- background-color: $data-table-zebra-color;
25
- // TODO: create own file upload elements
26
-
27
- border-width: 1px;
28
-
29
- //border-style: dotted;
30
- border-radius: 3px;
31
-
32
- .uppy-DragDrop-inner {
33
- padding: 1rem;
34
- line-height: inherit;
35
- }
36
-
37
- .uppy-DragDrop-arrow {
38
- width: 2rem;
39
- height: 2rem;
40
- margin-bottom: 0.5rem;
41
- }
42
-
43
- .uppy-DragDrop-label {
44
- margin-bottom: 0.5rem;
45
- font-size: inherit;
46
- }
47
- }
48
-
49
22
  /*
50
23
  WORKAROUND: thinner scrollbars
51
24
  */
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { default as ReactFlowOriginal, ReactFlowProps as ReactFlowOriginalProps } from "react-flow-renderer";
3
3
 
4
+ import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
4
5
  import { ReactFlowMarkers } from "../../../extensions/react-flow/markers/ReactFlowMarkers";
5
6
  import { ReactFlowHotkeyContext } from "../extensions/ReactFlowHotkeyContext";
6
7
  import { useReactFlowScrollOnDrag } from "../extensions/scrollOnDragHook";
@@ -16,6 +17,11 @@ export interface ReactFlowProps extends ReactFlowOriginalProps {
16
17
  */
17
18
  configuration?: "unspecified" | "graph" | "workflow" | "linking";
18
19
 
20
+ /**
21
+ * Types data transfers that can be dragged in and dropped on the canvas.
22
+ */
23
+ dropzoneFor?: string[];
24
+
19
25
  /** If defined the canvas scrolls on all drag operations (node, selection, edge connect)
20
26
  * when the mouse pointer comes near the canvas borders or goes beyond them.
21
27
  * The `id` property of the ReactFlow component must be set in order for this to work.
@@ -37,7 +43,37 @@ export interface ReactFlowProps extends ReactFlowOriginalProps {
37
43
  * Corporate Memory tools.
38
44
  */
39
45
  export const ReactFlow = React.forwardRef<HTMLDivElement, ReactFlowProps>(
40
- ({ configuration = "unspecified", scrollOnDrag, children, ...originalProps }, ref) => {
46
+ ({ configuration = "unspecified", scrollOnDrag, dropzoneFor, children, className, ...originalProps }, outerRef) => {
47
+ const innerRef = React.useRef<HTMLDivElement>(null);
48
+ React.useImperativeHandle(outerRef, () => innerRef.current!, []);
49
+
50
+ React.useEffect(() => {
51
+ const reactflowContainer = innerRef?.current;
52
+
53
+ if (reactflowContainer && dropzoneFor) {
54
+ const addDragover = (event: DragEvent) => {
55
+ reactflowContainer.classList.add(`${eccgui}-graphviz__canvas--draghover`);
56
+ event.preventDefault();
57
+ };
58
+
59
+ const removeDragover = (event: DragEvent) => {
60
+ if (reactflowContainer === event.target) {
61
+ reactflowContainer.classList.remove(`${eccgui}-graphviz__canvas--draghover`);
62
+ }
63
+ };
64
+
65
+ reactflowContainer.addEventListener("dragover", addDragover);
66
+ reactflowContainer.addEventListener("dragleave", removeDragover);
67
+ reactflowContainer.addEventListener("drop", removeDragover);
68
+ return () => {
69
+ reactflowContainer.removeEventListener("dragover", addDragover);
70
+ reactflowContainer.removeEventListener("dragleave", removeDragover);
71
+ reactflowContainer.removeEventListener("drop", removeDragover);
72
+ };
73
+ }
74
+ return;
75
+ }, [innerRef, dropzoneFor]);
76
+
41
77
  /** If the hot keys should be disabled. By default, they are always disabled. */
42
78
  const { hotKeysDisabled } = React.useContext(ReactFlowHotkeyContext);
43
79
 
@@ -57,11 +93,13 @@ export const ReactFlow = React.forwardRef<HTMLDivElement, ReactFlowProps>(
57
93
 
58
94
  return (
59
95
  <ReactFlowOriginal
60
- ref={ref}
96
+ ref={innerRef}
97
+ className={`${eccgui}-graphviz__canvas` + className ? ` ${className}` : ""}
61
98
  nodeTypes={configReactFlow[configuration].nodeTypes}
62
99
  edgeTypes={configReactFlow[configuration].edgeTypes}
63
100
  {...originalProps}
64
101
  {...scrollOnDragFunctions}
102
+ data-dropzone-for={dropzoneFor ? dropzoneFor.join(" ") : undefined}
65
103
  selectionKeyCode={hotKeysDisabled ? null : (selectionKeyCode as any)}
66
104
  deleteKeyCode={hotKeysDisabled ? null : (deleteKeyCode as any)}
67
105
  multiSelectionKeyCode={hotKeysDisabled ? null : (multiSelectionKeyCode as any)}
@@ -0,0 +1,15 @@
1
+ .eccgui-graphviz__canvas--draghover {
2
+ body[data-monitor-dropzone~="application/reactflow"] &[data-dropzone-for~="application/reactflow"],
3
+ body[data-monitor-dropzone~="Files"] &[data-dropzone-for~="Files"] {
4
+ background-color: rgba($eccgui-color-accent, $eccgui-opacity-ghostly);
5
+ box-shadow: 0 0 $eccgui-size-block-whitespace $eccgui-color-accent inset;
6
+
7
+ & > * {
8
+ opacity: $eccgui-opacity-narrow;
9
+ }
10
+
11
+ .react-flow__node {
12
+ pointer-events: none !important;
13
+ }
14
+ }
15
+ }
@@ -1,4 +1,5 @@
1
1
  @import "./configuration/colors";
2
+ @import "canvas";
2
3
  @import "edges";
3
4
  @import "handles";
4
5
  @import "minimap";
@@ -3,13 +3,24 @@ import { Accordion as CarbonAccordion, AccordionProps as CarbonAccordionProps }
3
3
 
4
4
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
5
 
6
+ import { AccordionItemProps } from "./AccordionItem";
7
+
6
8
  export interface AccordionProps extends Omit<CarbonAccordionProps, "className" | "size"> {
7
9
  /**
8
10
  * Additional CSS classes.
9
11
  */
10
12
  className?: string;
13
+ /**
14
+ * Defines how much whitespace is used on top and bottom inside the header and content of an accordion item.
15
+ */
16
+ whitespaceSize?: AccordionItemProps["whitespaceSize"];
17
+ /**
18
+ * Defines how much space is used for the separation between an accordion item and the next one.
19
+ */
20
+ separationSize?: AccordionItemProps["separationSize"];
11
21
  /**
12
22
  * How much space is used for the header of the each of the accordion items.
23
+ * @deprecated Use ẁhitespaceSize` on `Accordion` or `AccordionItem` instead.
13
24
  */
14
25
  size?: "small" | "medium" | "large";
15
26
  }
@@ -24,12 +35,28 @@ export const Accordion = ({
24
35
  children,
25
36
  className = "",
26
37
  align = "start",
38
+ whitespaceSize = "medium",
39
+ separationSize = "none",
27
40
  size = "medium",
28
41
  ...otherProps
29
42
  }: AccordionProps) => {
43
+ const headerWhitespaceSize = typeof whitespaceSize === "string" ? whitespaceSize : whitespaceSize.header;
44
+ const contentWhitespaceSize = typeof whitespaceSize === "string" ? whitespaceSize : whitespaceSize.content;
30
45
  return (
31
46
  <CarbonAccordion
32
- className={`${eccgui}-accordion__container ` + className}
47
+ className={
48
+ `${eccgui}-accordion__container` +
49
+ (headerWhitespaceSize !== "medium"
50
+ ? ` ${eccgui}-accordion__container--global-headerspace-${headerWhitespaceSize}`
51
+ : "") +
52
+ (contentWhitespaceSize !== "medium"
53
+ ? ` ${eccgui}-accordion__container--global-contentspace-${contentWhitespaceSize}`
54
+ : "") +
55
+ (separationSize !== "none"
56
+ ? ` ${eccgui}-accordion__container--global-separationspace-${separationSize}`
57
+ : "") +
58
+ (className ? ` ${className}` : "")
59
+ }
33
60
  align={align}
34
61
  size={carbonAccordionSizeMapping[size]}
35
62
  {...otherProps}
@@ -6,6 +6,8 @@ import {
6
6
 
7
7
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
8
8
 
9
+ type sizeOptions = "none" | "small" | "medium" | "large";
10
+
9
11
  export interface AccordionItemProps
10
12
  extends Omit<CarbonAccordionItemProps, "title" | "iconDescription" | "renderExpando"> {
11
13
  /**
@@ -20,8 +22,18 @@ export interface AccordionItemProps
20
22
  * use full available width for content
21
23
  */
22
24
  fullWidth?: boolean;
25
+ /**
26
+ * Defines how much whitespace is used on top and bottom inside the header and content of an accordion item.
27
+ * Seeting on `AccordionItem` overwrites the global setting on `Accordion`.
28
+ */
29
+ whitespaceSize?: sizeOptions | { header: sizeOptions; content: sizeOptions };
30
+ /**
31
+ * Defines how much space is used for the separation between the accordion item and the next one.
32
+ */
33
+ separationSize?: sizeOptions;
23
34
  /**
24
35
  * minimize white space and paddings
36
+ * @deprecated Use `whitespaceSize="none"` on `Accordion` or `AccordionItem` instead.
25
37
  */
26
38
  condensed?: boolean;
27
39
  /**
@@ -40,10 +52,14 @@ export const AccordionItem = ({
40
52
  className = "",
41
53
  fullWidth = false,
42
54
  elevated = false,
55
+ whitespaceSize = "medium",
56
+ separationSize = "none",
43
57
  condensed = false,
44
58
  noBorder = false,
45
59
  ...otherProps
46
60
  }: AccordionItemProps) => {
61
+ const headerWhitespaceSize = typeof whitespaceSize === "string" ? whitespaceSize : whitespaceSize.header;
62
+ const contentWhitespaceSize = typeof whitespaceSize === "string" ? whitespaceSize : whitespaceSize.content;
47
63
  return (
48
64
  <CarbonAccordionItem
49
65
  className={
@@ -51,6 +67,13 @@ export const AccordionItem = ({
51
67
  (className ? " " + className : "") +
52
68
  (fullWidth ? ` ${eccgui}-accordion__item--fullwidth` : "") +
53
69
  (elevated ? ` ${eccgui}-accordion__item--elevated` : "") +
70
+ (headerWhitespaceSize !== "medium"
71
+ ? ` ${eccgui}-accordion__item--headerspace-${headerWhitespaceSize}`
72
+ : "") +
73
+ (contentWhitespaceSize !== "medium"
74
+ ? ` ${eccgui}-accordion__item--contentspace-${contentWhitespaceSize}`
75
+ : "") +
76
+ (separationSize !== "none" ? ` ${eccgui}-accordion__item--separationspace-${separationSize}` : "") +
54
77
  (condensed ? ` ${eccgui}-accordion__item--condensed` : "") +
55
78
  (noBorder ? ` ${eccgui}-accordion__item--noborder` : "")
56
79
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { ComponentMeta, ComponentStory } from "@storybook/react";
2
+ import { Meta, StoryFn } from "@storybook/react";
3
3
 
4
4
  import { Accordion, AccordionItem } from "../../../../index";
5
5
  import { Default as AccordionStoryItem } from "../Stories/AccordionItem.stories";
@@ -13,14 +13,22 @@ export default {
13
13
  control: "none",
14
14
  description: "Elements to include into the Accordion component",
15
15
  },
16
+ whitespaceSize: {
17
+ control: "select",
18
+ options: ["none", "small", "medium", "large"],
19
+ },
20
+ separationSize: {
21
+ control: "select",
22
+ options: ["none", "small", "medium", "large"],
23
+ },
16
24
  },
17
- } as ComponentMeta<typeof Accordion>;
25
+ } as Meta<typeof Accordion>;
18
26
 
19
- const TemplateIcons: ComponentStory<typeof Accordion> = (args) => <Accordion {...args} />;
27
+ const TemplateIcons: StoryFn<typeof Accordion> = (args) => <Accordion {...args} />;
20
28
  export const Default = TemplateIcons.bind({});
21
29
  Default.args = {
22
30
  children: [
23
- <AccordionItem {...AccordionStoryItem.args} label="Accordion item 1" />,
31
+ <AccordionItem {...AccordionStoryItem.args} label="Accordion item 1" fullWidth />,
24
32
  <AccordionItem {...AccordionStoryItem.args} label="Accordion item 2 (elevated)" elevated />,
25
33
  <AccordionItem {...AccordionStoryItem.args} label="Accordion item 3 (initially opened)" open />,
26
34
  <AccordionItem {...AccordionStoryItem.args} label="Accordion item 4 (disabled)" disabled />,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { LoremIpsum } from "react-lorem-ipsum";
3
- import { ComponentMeta, ComponentStory } from "@storybook/react";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
4
 
5
5
  import { Accordion, AccordionItem, HtmlContentBlock } from "../../../../index";
6
6
 
@@ -12,10 +12,18 @@ export default {
12
12
  control: "none",
13
13
  description: "content of accordion item",
14
14
  },
15
+ whitespaceSize: {
16
+ control: "select",
17
+ options: ["none", "small", "medium", "large"],
18
+ },
19
+ separationSize: {
20
+ control: "select",
21
+ options: ["none", "small", "medium", "large"],
22
+ },
15
23
  },
16
- } as ComponentMeta<typeof AccordionItem>;
24
+ } as Meta<typeof AccordionItem>;
17
25
 
18
- const Template: ComponentStory<typeof AccordionItem> = (args) => (
26
+ const Template: StoryFn<typeof AccordionItem> = (args) => (
19
27
  <Accordion>
20
28
  <AccordionItem {...args} />
21
29
  </Accordion>
@@ -1,21 +1,85 @@
1
1
  // lib import
2
+ @use "sass:color";
2
3
  @use "~@carbon/styles/scss/components/accordion/accordion";
3
4
  @include accordion.accordion;
4
5
 
5
6
  // own vars
6
7
  $eccgui-color-accordion-background-elevated: rgba($eccgui-color-accent, 0.1) !default;
7
8
  $eccgui-color-accordion-toggler-hover: $menu-item-color-hover !default;
8
- $eccgui-color-accordion-toggler-elevated-hover: mix(
9
+ $eccgui-color-accordion-toggler-elevated-hover: color.mix(
9
10
  $eccgui-color-accordion-background-elevated,
10
11
  $eccgui-color-accordion-toggler-hover,
11
12
  50%
12
13
  ) !default;
14
+ $eccgui-size-accordion-header-baseheight: mini-units(5) !default;
15
+ $eccgui-size-accordion-content-basespace: $eccgui-size-block-whitespace * 0.5 !default;
16
+ $eccgui-size-accordion-separation: $eccgui-size-block-whitespace * 0.5 !default;
13
17
 
14
18
  // changes
15
19
 
20
+ .#{$prefix}--accordion {
21
+ --#{$eccgui}-accordion-header-height: #{$eccgui-size-accordion-header-baseheight};
22
+ --#{$eccgui}-accordion-content-whitespace: #{$eccgui-size-accordion-content-basespace};
23
+ --#{$eccgui}-accordion-separation: 0;
24
+ }
25
+ .#{$eccgui}-accordion__item--condensed,
26
+ .#{$eccgui}-accordion__container--global-headerspace-none,
27
+ .#{$eccgui}-accordion__item--headerspace-none {
28
+ --#{$eccgui}-accordion-header-height: 0;
29
+ }
30
+ .#{$eccgui}-accordion__item--condensed,
31
+ .#{$eccgui}-accordion__container--global-contentspace-none,
32
+ .#{$eccgui}-accordion__item--contentspace-none {
33
+ --#{$eccgui}-accordion-content-whitespace: #{$eccgui-size-block-whitespace * 0.25};
34
+ }
35
+ .#{$eccgui}-accordion__container--global-headerspace-small,
36
+ .#{$eccgui}-accordion__item--headerspace-small {
37
+ --#{$eccgui}-accordion-header-height: calc(
38
+ #{$eccgui-size-accordion-header-baseheight} - #{$eccgui-size-block-whitespace * 0.5}
39
+ );
40
+ }
41
+ .#{$eccgui}-accordion__container--global-contentspace-small,
42
+ .#{$eccgui}-accordion__item--contentspace-small {
43
+ --#{$eccgui}-accordion-content-whitespace: #{$eccgui-size-accordion-content-basespace * 0.5};
44
+ }
45
+ .#{$eccgui}-accordion__container--global-headerspace-large,
46
+ .#{$eccgui}-accordion__item--headerspace-large {
47
+ --#{$eccgui}-accordion-header-height: calc(
48
+ #{$eccgui-size-accordion-header-baseheight} + #{$eccgui-size-block-whitespace * 0.5}
49
+ );
50
+ }
51
+ .#{$eccgui}-accordion__container--global-contentspace-large,
52
+ .#{$eccgui}-accordion__item--contentspace-large {
53
+ --#{$eccgui}-accordion-content-whitespace: #{$eccgui-size-accordion-content-basespace * 1.5};
54
+ }
55
+
56
+ .#{$eccgui}-accordion__container--global-separationspace-small,
57
+ .#{$eccgui}-accordion__item--separationspace-small {
58
+ --#{$eccgui}-accordion-separation: #{$eccgui-size-accordion-separation * 0.5};
59
+ }
60
+ .#{$eccgui}-accordion__container--global-separationspace-medium,
61
+ .#{$eccgui}-accordion__item--separationspace-medium {
62
+ --#{$eccgui}-accordion-separation: #{$eccgui-size-accordion-separation};
63
+ }
64
+ .#{$eccgui}-accordion__container--global-separationspace-large,
65
+ .#{$eccgui}-accordion__item--separationspace-large {
66
+ --#{$eccgui}-accordion-separation: #{$eccgui-size-accordion-separation * 1.5};
67
+ }
68
+
69
+ .#{$eccgui}-accordion__item {
70
+ &:not(:last-child) {
71
+ margin-bottom: var(--#{$eccgui}-accordion-separation);
72
+ }
73
+
74
+ [class*="#{$eccgui}-accordion__container--global-separationspace-"] &:not(.#{$eccgui}-accordion__item--noborder),
75
+ &[class*="#{$eccgui}-accordion__item--separationspace-"]:not(.#{$eccgui}-accordion__item--noborder) {
76
+ border-bottom: 1px solid var(--#{$prefix}-border-subtle);
77
+ }
78
+ }
79
+
16
80
  .#{$prefix}--accordion__heading {
17
81
  align-items: center;
18
- min-height: mini-units(5);
82
+ min-height: var(--#{$eccgui}-accordion-header-height, mini-units(5));
19
83
  color: inherit;
20
84
 
21
85
  .#{$prefix}--accordion__arrow {
@@ -25,6 +89,23 @@ $eccgui-color-accordion-toggler-elevated-hover: mix(
25
89
  margin: 0 0 0 $eccgui-size-block-whitespace * 0.5;
26
90
  }
27
91
  }
92
+
93
+ .#{$eccgui}-accordion__item--condensed &,
94
+ .#{$eccgui}-accordion__container--global-contentspace-none &,
95
+ .#{$eccgui}-accordion__item--contentspace-none & {
96
+ .#{$prefix}--accordion__arrow {
97
+ margin: 0;
98
+ }
99
+
100
+ .#{$prefix}--accordion__title {
101
+ margin: 0 0 0 $eccgui-size-block-whitespace * 0.25;
102
+ }
103
+ }
104
+
105
+ &:hover::before,
106
+ &:focus::before {
107
+ background-color: $eccgui-color-accordion-toggler-hover;
108
+ }
28
109
  }
29
110
 
30
111
  .#{$prefix}--accordion__title {
@@ -43,15 +124,15 @@ $eccgui-color-accordion-toggler-elevated-hover: mix(
43
124
  position: fixed;
44
125
  left: -5000em;
45
126
  display: block;
46
- padding: $eccgui-size-block-whitespace * 0.5;
127
+ padding: 0 $eccgui-size-block-whitespace * 0.5;
47
128
  margin: 0 calc(1rem + #{$eccgui-size-block-whitespace * 0.5}) 0 $eccgui-size-block-whitespace * 0.5;
48
129
  opacity: 0;
49
130
 
50
131
  .#{$prefix}--accordion__item--active & {
51
132
  position: static;
52
133
  left: auto;
53
- padding: $eccgui-size-block-whitespace * 0.5 $eccgui-size-block-whitespace * 0.5 $eccgui-size-block-whitespace
54
- $eccgui-size-block-whitespace * 0.5;
134
+ padding: calc(0.75 * var(--#{$eccgui}-accordion-content-whitespace)) $eccgui-size-block-whitespace * 0.5
135
+ calc(1.25 * var(--#{$eccgui}-accordion-content-whitespace)) $eccgui-size-block-whitespace * 0.5;
55
136
  opacity: 1;
56
137
  }
57
138
 
@@ -63,6 +144,23 @@ $eccgui-color-accordion-toggler-elevated-hover: mix(
63
144
  margin: 0;
64
145
  }
65
146
 
147
+ .#{$eccgui}-accordion__item--condensed &,
148
+ .#{$eccgui}-accordion__container--global-contentspace-none &,
149
+ .#{$eccgui}-accordion__item--contentspace-none & {
150
+ padding-right: 0;
151
+ padding-left: 0;
152
+ }
153
+
154
+ .#{$eccgui}-accordion__item--condensed:not(.#{$eccgui}-accordion__item--fullwidth) &,
155
+ .#{$prefix}--accordion--start.#{$eccgui}-accordion__container--global-contentspace-none
156
+ :not(.#{$eccgui}-accordion__item--fullwidth)
157
+ &,
158
+ .#{$prefix}--accordion--start
159
+ .#{$eccgui}-accordion__item--contentspace-none:not(.#{$eccgui}-accordion__item--fullwidth)
160
+ & {
161
+ margin-left: calc(1rem + #{$eccgui-size-block-whitespace * 0.25});
162
+ }
163
+
66
164
  *,
67
165
  *::before,
68
166
  *::after {
@@ -70,13 +168,6 @@ $eccgui-color-accordion-toggler-elevated-hover: mix(
70
168
  }
71
169
  }
72
170
 
73
- .#{$prefix}--accordion__heading {
74
- &:hover::before,
75
- &:focus::before {
76
- background-color: $eccgui-color-accordion-toggler-hover;
77
- }
78
- }
79
-
80
171
  .#{$eccgui}-accordion__item--elevated {
81
172
  background-color: $eccgui-color-accordion-background-elevated;
82
173
 
@@ -95,35 +186,3 @@ $eccgui-color-accordion-toggler-elevated-hover: mix(
95
186
  border-bottom: none;
96
187
  }
97
188
  }
98
-
99
- .#{$eccgui}-accordion__item--condensed {
100
- .#{$prefix}--accordion__heading {
101
- min-height: 0;
102
- padding: 0;
103
- line-height: 1em;
104
-
105
- .#{$prefix}--accordion__arrow {
106
- margin: 0;
107
-
108
- .#{$prefix}--accordion--start & {
109
- margin: 0;
110
- }
111
- }
112
-
113
- .#{$prefix}--accordion__title {
114
- margin: 0 0 0 $eccgui-size-block-whitespace * 0.25;
115
-
116
- .#{$prefix}--accordion--start & {
117
- margin: 0 0 0 $eccgui-size-block-whitespace * 0.25;
118
- }
119
- }
120
- }
121
-
122
- .#{$prefix}--accordion__content {
123
- padding: $eccgui-size-block-whitespace * 0.25 0;
124
-
125
- .#{$prefix}--accordion__item--active & {
126
- padding: $eccgui-size-block-whitespace * 0.25 0;
127
- }
128
- }
129
- }
@@ -3,12 +3,28 @@ import { OverlaysProvider } from "@blueprintjs/core";
3
3
 
4
4
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
5
 
6
- export type ApplicationContainerProps = React.HTMLAttributes<HTMLDivElement>;
6
+ import { useDropzoneMonitor } from "./helper";
7
+
8
+ export interface ApplicationContainerProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ /**
10
+ * If set then the `element` is extended automatically by a `monitor-dropzone` data attribute.
11
+ * This need to match with a `dropzone-for` data attribute on available dropzones for dragged elements.
12
+ */
13
+ monitorDropzonesFor?: string[];
14
+ }
15
+
16
+ export const ApplicationContainer = ({
17
+ children,
18
+ className = "",
19
+ monitorDropzonesFor = [],
20
+ ...otherDivProps
21
+ }: ApplicationContainerProps) => {
22
+ const containerRef = React.useRef<any>(null);
23
+ useDropzoneMonitor(monitorDropzonesFor);
7
24
 
8
- export const ApplicationContainer = ({ children, className = "", ...otherDivProps }: ApplicationContainerProps) => {
9
25
  return (
10
26
  <OverlaysProvider>
11
- <div className={`${eccgui}-application__container ${className}`} {...otherDivProps}>
27
+ <div ref={containerRef} className={`${eccgui}-application__container ${className}`} {...otherDivProps}>
12
28
  {children}
13
29
  </div>
14
30
  </OverlaysProvider>
@@ -0,0 +1,36 @@
1
+ [data-dropzone-for] {
2
+ transition: box-shadow 500ms;
3
+ }
4
+
5
+ body[data-monitor-dropzone] {
6
+ & > * {
7
+ pointer-events: none;
8
+ }
9
+ .#{$eccgui}-application__container,
10
+ .#{$eccgui}-dialog__portal {
11
+ *:not([data-dropzone-for], .uppy-DragDrop--isDragDropSupported) {
12
+ pointer-events: none;
13
+ }
14
+ }
15
+ }
16
+
17
+ body[data-monitor-dropzone~="application/reactflow"] [data-dropzone-for~="application/reactflow"],
18
+ body[data-monitor-dropzone~="Files"] [data-dropzone-for~="Files"],
19
+ body[data-monitor-dropzone~="Files"] .uppy-DragDrop--isDragDropSupported {
20
+ pointer-events: all !important;
21
+ box-shadow: 0 0 $eccgui-size-inline-whitespace $eccgui-color-accent inset;
22
+
23
+ & > * {
24
+ pointer-events: all;
25
+ opacity: $eccgui-opacity-regular;
26
+ }
27
+ }
28
+
29
+ body[data-monitor-dropzone]:has(.#{$eccgui}-dialog__portal > .#{$ns}-overlay-open) {
30
+ & > *:not(.#{$eccgui}-dialog__portal) {
31
+ &,
32
+ & * {
33
+ pointer-events: none !important;
34
+ }
35
+ }
36
+ }
@@ -8,3 +8,4 @@
8
8
 
9
9
  // @import '~@carbon/styles/scss/components/ui-shell/navigation-menu';
10
10
  @import "content";
11
+ @import "dropzone";
@@ -19,3 +19,42 @@ export const useApplicationHeaderOverModals = (elevate: boolean, className: stri
19
19
  }
20
20
  }, [elevate, className]);
21
21
  };
22
+
23
+ /**
24
+ * Tracks drag operations over the application.
25
+ * Sets different data attributes to the body element.
26
+ * They can be used to apply styling rules.
27
+ */
28
+ export const useDropzoneMonitor = (enabledTypes: string[]) => {
29
+ React.useEffect(() => {
30
+ const monitor = window.document.body;
31
+
32
+ const addMonitor = (event: DragEvent) => {
33
+ const types = event.dataTransfer?.types || [];
34
+ const monitorTypes = [...new Set(types.filter((type) => enabledTypes.includes(type)))];
35
+ if (monitorTypes.length > 0 && !monitor.dataset.monitorDropzone) {
36
+ monitor.dataset.monitorDropzone = monitorTypes.join(" ");
37
+ }
38
+ event.preventDefault();
39
+ };
40
+
41
+ const removeMonitor = (event: DragEvent) => {
42
+ if (event.type === "drop" || monitor === event.target) {
43
+ delete monitor.dataset.monitorDropzone;
44
+ event.preventDefault();
45
+ }
46
+ };
47
+
48
+ if (monitor) {
49
+ monitor.addEventListener("dragover", addMonitor);
50
+ monitor.addEventListener("dragleave", removeMonitor);
51
+ monitor.addEventListener("drop", removeMonitor);
52
+ return () => {
53
+ monitor.removeEventListener("dragover", addMonitor);
54
+ monitor.removeEventListener("dragleave", removeMonitor);
55
+ monitor.removeEventListener("drop", removeMonitor);
56
+ };
57
+ }
58
+ return;
59
+ }, []);
60
+ };
@@ -72,6 +72,7 @@ $eccgui-opacity-regular: 1 !default;
72
72
  $eccgui-opacity-narrow: 0.8 !default;
73
73
  $eccgui-opacity-muted: 0.61 !default;
74
74
  $eccgui-opacity-disabled: 0.39 !default;
75
+ $eccgui-opacity-ghostly: 0.2 !default;
75
76
  $eccgui-opacity-invisible: 0 !default;
76
77
 
77
78
  // -- Configuration stack of z-indexes -----------------------------------------
@@ -5,3 +5,5 @@ CodeMirror styles are already included by the base component styles
5
5
  because it is used as lib for elements there already.
6
6
  @import "./codemirror/codemirror";
7
7
  */
8
+
9
+ @import "./uppy/fileupload";