@eccenca/gui-elements 24.1.0-rc.0 → 24.1.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.
package/CHANGELOG.md CHANGED
@@ -6,14 +6,27 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ### Changed
9
+ ### Added
10
10
 
11
- - `eslint` libraries were upgraded to v9, so `node` v18.18 or higher is required
11
+ - `CntentGroup` component
12
+ - Manage display of a grouped content section.
13
+ - Add info, actions and context annotations by using its properties.
14
+ - Can be nested into each other.
15
+ - `<CodeEditor />`
16
+ - implemented support for linting which is enabled via `useLinting` prop
17
+ - `turtle` and `javascript` are currently supported languages for linting
18
+ - editor is focused on load if `autoFocus` prop is set to `true`
19
+ - implemented support for `disabled` state in code editor
20
+ - implemented support for `intent` states in code editor
12
21
 
13
22
  ### Fixed
14
23
 
15
24
  - `MultiSelect`:
16
- - Old suggestions might be shown for a very short time when typing in a new search query.
25
+ - Old suggestions might be shown for a very short time when typing in a new search query.
26
+
27
+ ### Changed
28
+
29
+ - `eslint` libraries were upgraded to v9, so `node` v18.18 or higher is required
17
30
 
18
31
  ## [24.0.0] - 2024-12-17
19
32
 
@@ -64,12 +77,6 @@ This is a major release, and it might be not compatible with your current usage
64
77
  - `htmlContentBlockProps` can now be used to configure the wrapper around the Markdown content
65
78
  - `$eccgui-selector-text-spot-highlight` SCSS config variable to specify selector that is used to create shortly highlighted spots
66
79
  - it is highlighted when the selector is also active local anchor target or if it has the `.eccgui-typography--spothighlight` class attached to it
67
- - `<CodeEditor />`
68
- - implemented support for linting which is enabled via `useLinting` prop
69
- - `turtle` and `javascript` are currently supported languages for linting
70
- - editor is focused on load if `autoFocus` prop is set to `true`
71
- - implemented support for `disabled` state in code editor
72
- - implemented support for `intent` states in code editor
73
80
 
74
81
  ### Fixed
75
82
 
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ContentGroup = void 0;
18
+ const react_1 = __importDefault(require("react"));
19
+ const classnames_1 = __importDefault(require("classnames"));
20
+ const color_1 = __importDefault(require("color"));
21
+ const constants_1 = require("../../configuration/constants");
22
+ const index_1 = require("../index");
23
+ /**
24
+ * Manage display of a grouped content section.
25
+ * Add info, actions and context annotations by using its properties.
26
+ * Can be nested into each other.
27
+ */
28
+ const ContentGroup = (_a) => {
29
+ var _b;
30
+ var { children, className = "", title, contextInfo, annotation, actionOptions, isCollapsed = false, textToggleCollapse, handlerToggleCollapse, borderMainConnection = false, borderSubConnection = false, level = 1, minimumHeadlineLevel = 3, whitespaceSize = "small", style, stickyHeaderProps, description, hideGroupDivider, contentProps } = _a, otherContentWrapperProps = __rest(_a, ["children", "className", "title", "contextInfo", "annotation", "actionOptions", "isCollapsed", "textToggleCollapse", "handlerToggleCollapse", "borderMainConnection", "borderSubConnection", "level", "minimumHeadlineLevel", "whitespaceSize", "style", "stickyHeaderProps", "description", "hideGroupDivider", "contentProps"]);
31
+ const displayHeader = title || handlerToggleCollapse;
32
+ let borderGradient = undefined;
33
+ if (typeof borderSubConnection === "object") {
34
+ const borderColors = Array.isArray(borderSubConnection) ? borderSubConnection : [borderSubConnection];
35
+ borderGradient = borderColors.reduce((acc, borderColor, index) => {
36
+ try {
37
+ const color = (0, color_1.default)(borderColor);
38
+ acc.push(`${color.rgb().toString()} ` +
39
+ `${(index / borderColors.length) * 100}% ` +
40
+ `${((index + 1) / borderColors.length) * 100}%`);
41
+ }
42
+ catch (_a) {
43
+ // eslint-disable-next-line no-console
44
+ console.warn("Received invalid background color for tag: " + borderColor);
45
+ }
46
+ return acc;
47
+ }, []);
48
+ }
49
+ const contextInfoElements = Array.isArray(contextInfo) ? contextInfo : [contextInfo];
50
+ const _c = contentProps !== null && contentProps !== void 0 ? contentProps : {}, { className: contentClassName } = _c, otherContentProps = __rest(_c, ["className"]);
51
+ const headerContent = displayHeader ? (react_1.default.createElement(react_1.default.Fragment, null,
52
+ react_1.default.createElement(index_1.SectionHeader, { className: `${constants_1.CLASSPREFIX}-contentgroup__header` },
53
+ react_1.default.createElement(index_1.Toolbar, null,
54
+ handlerToggleCollapse && (react_1.default.createElement(index_1.ToolbarSection, null,
55
+ react_1.default.createElement(index_1.IconButton, { className: `${constants_1.CLASSPREFIX}-contentgroup__header__toggler`, name: isCollapsed ? "toggler-showmore" : "toggler-showless", text: textToggleCollapse !== null && textToggleCollapse !== void 0 ? textToggleCollapse : (isCollapsed ? "Show more" : "Show less"), onClick: handlerToggleCollapse }),
56
+ react_1.default.createElement(index_1.Spacing, { vertical: true, size: "small" }))),
57
+ title && (react_1.default.createElement(index_1.ToolbarSection, { canShrink: true },
58
+ react_1.default.createElement("h" +
59
+ Math.min(Math.max(minimumHeadlineLevel, level + minimumHeadlineLevel), 6).toString(), {
60
+ children: react_1.default.createElement(index_1.OverflowText, null, title),
61
+ className: `${constants_1.CLASSPREFIX}-contentgroup__header__title`,
62
+ }),
63
+ description && (react_1.default.createElement(react_1.default.Fragment, null,
64
+ react_1.default.createElement(index_1.Spacing, { vertical: true, size: "tiny" }),
65
+ react_1.default.createElement(index_1.Tooltip, { content: description },
66
+ react_1.default.createElement(index_1.Icon, { name: "item-info", small: true, className: "dmapp--text-info" })))))),
67
+ contextInfoElements &&
68
+ ((_b = contextInfoElements[0]) === null || _b === void 0 ? void 0 : _b.props) &&
69
+ Object.values(contextInfoElements[0].props).every((v) => v !== undefined) && (react_1.default.createElement(index_1.ToolbarSection, { className: `${constants_1.CLASSPREFIX}-contentgroup__header__context`, canGrow: true },
70
+ react_1.default.createElement("div", { className: `${constants_1.CLASSPREFIX}-contentgroup__content ` },
71
+ react_1.default.createElement(index_1.Spacing, { vertical: true, size: "tiny" }),
72
+ contextInfoElements))),
73
+ !isCollapsed && handlerToggleCollapse && actionOptions && (react_1.default.createElement(index_1.ToolbarSection, { className: `${constants_1.CLASSPREFIX}-contentgroup__header__options` },
74
+ react_1.default.createElement(index_1.Spacing, { vertical: true, size: "small" }),
75
+ actionOptions)))),
76
+ (!isCollapsed || !handlerToggleCollapse) && (react_1.default.createElement(react_1.default.Fragment, null,
77
+ !hideGroupDivider && react_1.default.createElement(index_1.Divider, { addSpacing: "small" }),
78
+ react_1.default.createElement(index_1.Spacing, { size: whitespaceSize }))))) : (react_1.default.createElement(react_1.default.Fragment, null));
79
+ return (react_1.default.createElement(index_1.Section, Object.assign({ className: `${constants_1.CLASSPREFIX}-contentgroup` +
80
+ (className ? ` ${className}` : "") +
81
+ (whitespaceSize ? ` ${constants_1.CLASSPREFIX}-contentgroup--padding-${whitespaceSize}` : "") +
82
+ (borderMainConnection ? ` ${constants_1.CLASSPREFIX}-contentgroup--border-main` : "") +
83
+ (borderSubConnection ? ` ${constants_1.CLASSPREFIX}-contentgroup--border-sub` : ""), style: borderGradient
84
+ ? Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), { [`--${constants_1.CLASSPREFIX}-color-contentgroup-border-sub`]: borderGradient.join(", ") })
85
+ : style }, otherContentWrapperProps),
86
+ headerContent && stickyHeaderProps ? (react_1.default.createElement(index_1.StickyTarget, Object.assign({}, stickyHeaderProps), headerContent)) : (headerContent),
87
+ (!isCollapsed || !handlerToggleCollapse) && (react_1.default.createElement(react_1.default.Fragment, null,
88
+ react_1.default.createElement("div", { className: `${constants_1.CLASSPREFIX}-contentgroup__content` },
89
+ react_1.default.createElement("div", Object.assign({ className: (0, classnames_1.default)(`${constants_1.CLASSPREFIX}-contentgroup__content__body`, contentClassName) }, otherContentProps), children),
90
+ contextInfo && !displayHeader && (react_1.default.createElement("div", { className: `${constants_1.CLASSPREFIX}-contentgroup__content__context` }, contextInfoElements)),
91
+ annotation && react_1.default.createElement("div", null, annotation),
92
+ actionOptions && !displayHeader && (react_1.default.createElement("div", { className: `${constants_1.CLASSPREFIX}-contentgroup__content__options` }, actionOptions)))))));
93
+ };
94
+ exports.ContentGroup = ContentGroup;
95
+ //# sourceMappingURL=ContentGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentGroup.js","sourceRoot":"","sources":["../../../../src/components/ContentGroup/ContentGroup.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAoC;AACpC,kDAA0B;AAG1B,6DAAsE;AACtE,oCAakB;AAwElB;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,EAqBT,EAAE,EAAE;;QArBK,EACzB,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,KAAK,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,WAAW,GAAG,KAAK,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GAAG,KAAK,EAC5B,mBAAmB,GAAG,KAAK,EAC3B,KAAK,GAAG,CAAC,EACT,oBAAoB,GAAG,CAAC,EACxB,cAAc,GAAG,OAAO,EACxB,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,YAAY,OAEI,EADb,wBAAwB,cApBF,iUAqB5B,CAD8B;IAE3B,MAAM,aAAa,GAAG,KAAK,IAAI,qBAAqB,CAAC;IAErD,IAAI,cAAc,GAAyB,SAAS,CAAC;IACrD,IAAI,OAAO,mBAAmB,KAAK,QAAQ,EAAE,CAAC;QAC1C,MAAM,YAAY,GAAa,KAAK,CAAC,OAAO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AAa,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAClC,8BAAC,oBAAY,oBAAK,iBAAiB,GAAG,aAAa,CAAgB,CACtE,CAAC,CAAC,CAAC,CACA,aAAa,CAChB;QACA,CAAC,CAAC,WAAW,IAAI,CAAC,qBAAqB,CAAC,IAAI,CACzC;YACI,uCAAK,SAAS,EAAE,GAAG,uBAAM,wBAAwB;gBAC7C,qDACI,SAAS,EAAE,IAAA,oBAAU,EAAC,GAAG,uBAAM,8BAA8B,EAAE,gBAAgB,CAAC,IAC5E,iBAAiB,GAEpB,QAAQ,CACP;gBACL,WAAW,IAAI,CAAC,aAAa,IAAI,CAC9B,uCAAK,SAAS,EAAE,GAAG,uBAAM,iCAAiC,IAAG,mBAAmB,CAAO,CAC1F;gBACA,UAAU,IAAI,2CAAM,UAAU,CAAO;gBACrC,aAAa,IAAI,CAAC,aAAa,IAAI,CAChC,uCAAK,SAAS,EAAE,GAAG,uBAAM,iCAAiC,IAAG,aAAa,CAAO,CACpF,CACC,CACP,CACN,CACK,CACb,CAAC;AACN,CAAC,CAAC;AA/JW,QAAA,YAAY,gBA+JvB"}
@@ -64,5 +64,6 @@ __exportStar(require("./Tooltip/Tooltip"), exports);
64
64
  __exportStar(require("./Tree/Tree"), exports);
65
65
  __exportStar(require("./Typography"), exports);
66
66
  __exportStar(require("./Workspace"), exports);
67
+ __exportStar(require("./ContentGroup/ContentGroup"), exports);
67
68
  __exportStar(require("./interfaces"), exports);
68
69
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gDAA8B;AAC9B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,0DAAwC;AACxC,gDAA8B;AAC9B,+CAA6B;AAC7B,kDAAgC;AAChC,yCAAuB;AACvB,sDAAoC;AACpC,mDAAiC;AACjC,wDAAsC;AACtC,2CAAyB;AACzB,mDAAiC;AACjC,yCAAuB;AACvB,yCAAuB;AACvB,8DAA4C;AAC5C,yCAAuB;AACvB,2CAAyB;AACzB,oEAAkD;AAClD,gDAA8B;AAC9B,8CAA4B;AAC5B,8CAA4B;AAC5B,yCAAuB;AACvB,4DAA0C;AAC1C,wEAAsD;AACtD,iDAA+B;AAC/B,iDAA+B;AAC/B,0DAAwC;AACxC,gDAA8B;AAC9B,sDAAoC;AACpC,4DAA0C;AAC1C,kDAAgC;AAChC,uDAAqC;AACrC,uDAAqC;AACrC,sDAAoC;AACpC,oDAAkC;AAClC,2CAAyB;AACzB,8CAA4B;AAC5B,kDAAgC;AAChC,0CAAwB;AACxB,yCAAuB;AACvB,wCAAsB;AACtB,8CAA4B;AAC5B,4CAA0B;AAC1B,oDAAkC;AAClC,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAE5B,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gDAA8B;AAC9B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,0DAAwC;AACxC,gDAA8B;AAC9B,+CAA6B;AAC7B,kDAAgC;AAChC,yCAAuB;AACvB,sDAAoC;AACpC,mDAAiC;AACjC,wDAAsC;AACtC,2CAAyB;AACzB,mDAAiC;AACjC,yCAAuB;AACvB,yCAAuB;AACvB,8DAA4C;AAC5C,yCAAuB;AACvB,2CAAyB;AACzB,oEAAkD;AAClD,gDAA8B;AAC9B,8CAA4B;AAC5B,8CAA4B;AAC5B,yCAAuB;AACvB,4DAA0C;AAC1C,wEAAsD;AACtD,iDAA+B;AAC/B,iDAA+B;AAC/B,0DAAwC;AACxC,gDAA8B;AAC9B,sDAAoC;AACpC,4DAA0C;AAC1C,kDAAgC;AAChC,uDAAqC;AACrC,uDAAqC;AACrC,sDAAoC;AACpC,oDAAkC;AAClC,2CAAyB;AACzB,8CAA4B;AAC5B,kDAAgC;AAChC,0CAAwB;AACxB,yCAAuB;AACvB,wCAAsB;AACtB,8CAA4B;AAC5B,4CAA0B;AAC1B,oDAAkC;AAClC,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAC5B,8DAA4C;AAE5C,+CAA6B"}
@@ -0,0 +1,100 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from "react";
24
+ import classNames from "classnames";
25
+ import Color from "color";
26
+ import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
27
+ import { Divider, Icon, IconButton, OverflowText, Section, SectionHeader, Spacing, StickyTarget, Toolbar, ToolbarSection, Tooltip, } from "../index.js";
28
+ /**
29
+ * Manage display of a grouped content section.
30
+ * Add info, actions and context annotations by using its properties.
31
+ * Can be nested into each other.
32
+ */
33
+ export var ContentGroup = function (_a) {
34
+ var _b;
35
+ var _c;
36
+ var children = _a.children, _d = _a.className, className = _d === void 0 ? "" : _d, title = _a.title, contextInfo = _a.contextInfo, annotation = _a.annotation, actionOptions = _a.actionOptions, _e = _a.isCollapsed, isCollapsed = _e === void 0 ? false : _e, textToggleCollapse = _a.textToggleCollapse, handlerToggleCollapse = _a.handlerToggleCollapse, _f = _a.borderMainConnection, borderMainConnection = _f === void 0 ? false : _f, _g = _a.borderSubConnection, borderSubConnection = _g === void 0 ? false : _g, _h = _a.level, level = _h === void 0 ? 1 : _h, _j = _a.minimumHeadlineLevel, minimumHeadlineLevel = _j === void 0 ? 3 : _j, _k = _a.whitespaceSize, whitespaceSize = _k === void 0 ? "small" : _k, style = _a.style, stickyHeaderProps = _a.stickyHeaderProps, description = _a.description, hideGroupDivider = _a.hideGroupDivider, contentProps = _a.contentProps, otherContentWrapperProps = __rest(_a, ["children", "className", "title", "contextInfo", "annotation", "actionOptions", "isCollapsed", "textToggleCollapse", "handlerToggleCollapse", "borderMainConnection", "borderSubConnection", "level", "minimumHeadlineLevel", "whitespaceSize", "style", "stickyHeaderProps", "description", "hideGroupDivider", "contentProps"]);
37
+ var displayHeader = title || handlerToggleCollapse;
38
+ var borderGradient = undefined;
39
+ if (typeof borderSubConnection === "object") {
40
+ var borderColors_1 = Array.isArray(borderSubConnection) ? borderSubConnection : [borderSubConnection];
41
+ borderGradient = borderColors_1.reduce(function (acc, borderColor, index) {
42
+ try {
43
+ var color = Color(borderColor);
44
+ acc.push("".concat(color.rgb().toString(), " ") +
45
+ "".concat((index / borderColors_1.length) * 100, "% ") +
46
+ "".concat(((index + 1) / borderColors_1.length) * 100, "%"));
47
+ }
48
+ catch (_a) {
49
+ // eslint-disable-next-line no-console
50
+ console.warn("Received invalid background color for tag: " + borderColor);
51
+ }
52
+ return acc;
53
+ }, []);
54
+ }
55
+ var contextInfoElements = Array.isArray(contextInfo) ? contextInfo : [contextInfo];
56
+ var _l = contentProps !== null && contentProps !== void 0 ? contentProps : {}, contentClassName = _l.className, otherContentProps = __rest(_l, ["className"]);
57
+ var headerContent = displayHeader ? (React.createElement(React.Fragment, null,
58
+ React.createElement(SectionHeader, { className: "".concat(eccgui, "-contentgroup__header") },
59
+ React.createElement(Toolbar, null,
60
+ handlerToggleCollapse && (React.createElement(ToolbarSection, null,
61
+ React.createElement(IconButton, { className: "".concat(eccgui, "-contentgroup__header__toggler"), name: isCollapsed ? "toggler-showmore" : "toggler-showless", text: textToggleCollapse !== null && textToggleCollapse !== void 0 ? textToggleCollapse : (isCollapsed ? "Show more" : "Show less"), onClick: handlerToggleCollapse }),
62
+ React.createElement(Spacing, { vertical: true, size: "small" }))),
63
+ title && (React.createElement(ToolbarSection, { canShrink: true },
64
+ React.createElement("h" +
65
+ Math.min(Math.max(minimumHeadlineLevel, level + minimumHeadlineLevel), 6).toString(), {
66
+ children: React.createElement(OverflowText, null, title),
67
+ className: "".concat(eccgui, "-contentgroup__header__title"),
68
+ }),
69
+ description && (React.createElement(React.Fragment, null,
70
+ React.createElement(Spacing, { vertical: true, size: "tiny" }),
71
+ React.createElement(Tooltip, { content: description },
72
+ React.createElement(Icon, { name: "item-info", small: true, className: "dmapp--text-info" })))))),
73
+ contextInfoElements &&
74
+ ((_c = contextInfoElements[0]) === null || _c === void 0 ? void 0 : _c.props) &&
75
+ Object.values(contextInfoElements[0].props).every(function (v) { return v !== undefined; }) && (React.createElement(ToolbarSection, { className: "".concat(eccgui, "-contentgroup__header__context"), canGrow: true },
76
+ React.createElement("div", { className: "".concat(eccgui, "-contentgroup__content ") },
77
+ React.createElement(Spacing, { vertical: true, size: "tiny" }),
78
+ contextInfoElements))),
79
+ !isCollapsed && handlerToggleCollapse && actionOptions && (React.createElement(ToolbarSection, { className: "".concat(eccgui, "-contentgroup__header__options") },
80
+ React.createElement(Spacing, { vertical: true, size: "small" }),
81
+ actionOptions)))),
82
+ (!isCollapsed || !handlerToggleCollapse) && (React.createElement(React.Fragment, null,
83
+ !hideGroupDivider && React.createElement(Divider, { addSpacing: "small" }),
84
+ React.createElement(Spacing, { size: whitespaceSize }))))) : (React.createElement(React.Fragment, null));
85
+ return (React.createElement(Section, __assign({ className: "".concat(eccgui, "-contentgroup") +
86
+ (className ? " ".concat(className) : "") +
87
+ (whitespaceSize ? " ".concat(eccgui, "-contentgroup--padding-").concat(whitespaceSize) : "") +
88
+ (borderMainConnection ? " ".concat(eccgui, "-contentgroup--border-main") : "") +
89
+ (borderSubConnection ? " ".concat(eccgui, "-contentgroup--border-sub") : ""), style: borderGradient
90
+ ? __assign(__assign({}, (style !== null && style !== void 0 ? style : {})), (_b = {}, _b["--".concat(eccgui, "-color-contentgroup-border-sub")] = borderGradient.join(", "), _b))
91
+ : style }, otherContentWrapperProps),
92
+ headerContent && stickyHeaderProps ? (React.createElement(StickyTarget, __assign({}, stickyHeaderProps), headerContent)) : (headerContent),
93
+ (!isCollapsed || !handlerToggleCollapse) && (React.createElement(React.Fragment, null,
94
+ React.createElement("div", { className: "".concat(eccgui, "-contentgroup__content") },
95
+ React.createElement("div", __assign({ className: classNames("".concat(eccgui, "-contentgroup__content__body"), contentClassName) }, otherContentProps), children),
96
+ contextInfo && !displayHeader && (React.createElement("div", { className: "".concat(eccgui, "-contentgroup__content__context") }, contextInfoElements)),
97
+ annotation && React.createElement("div", null, annotation),
98
+ actionOptions && !displayHeader && (React.createElement("div", { className: "".concat(eccgui, "-contentgroup__content__options") }, actionOptions)))))));
99
+ };
100
+ //# sourceMappingURL=ContentGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentGroup.js","sourceRoot":"","sources":["../../../../src/components/ContentGroup/ContentGroup.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EACH,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,OAAO,EACP,aAAa,EACb,OAAO,EACP,YAAY,EAEZ,OAAO,EACP,cAAc,EACd,OAAO,GACV,MAAM,UAAU,CAAC;AAwElB;;;;GAIG;AACH,MAAM,CAAC,IAAM,YAA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AAU,CAAO;gBACrC,aAAa,IAAI,CAAC,aAAa,IAAI,CAChC,6BAAK,SAAS,EAAE,UAAG,MAAM,oCAAiC,IAAG,aAAa,CAAO,CACpF,CACC,CACP,CACN,CACK,CACb,CAAC;AACN,CAAC,CAAC"}
@@ -48,5 +48,6 @@ export * from "./Tooltip/Tooltip.js";
48
48
  export * from "./Tree/Tree.js";
49
49
  export * from "./Typography/index.js";
50
50
  export * from "./Workspace/index.js";
51
+ export * from "./ContentGroup/ContentGroup.js";
51
52
  export * from "./interfaces.js";
52
53
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,mCAAmC,CAAC;AAClD,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAA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Q,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAE5C,cAAc,cAAc,CAAC"}
@@ -0,0 +1,78 @@
1
+ import React from "react";
2
+ import { TestableComponent } from "../../components/interfaces";
3
+ import { StickyTargetProps } from "../index";
4
+ export interface ContentGroupProps extends Omit<React.HTMLAttributes<HTMLElement>, "title">, TestableComponent {
5
+ /**
6
+ * Title of the content group.
7
+ */
8
+ title?: string;
9
+ /**
10
+ * Level of the content group.
11
+ */
12
+ level?: number;
13
+ /**
14
+ * Context information to display in the header.
15
+ */
16
+ contextInfo?: React.ReactElement | React.ReactElement[];
17
+ /**
18
+ * Annotation to display in the content.
19
+ */
20
+ annotation?: React.ReactElement | React.ReactElement[];
21
+ /**
22
+ * Action options to display in the header.
23
+ */
24
+ actionOptions?: React.ReactElement | React.ReactElement[];
25
+ /**
26
+ * Flag to collapse the content group.
27
+ */
28
+ isCollapsed?: boolean;
29
+ /**
30
+ * Text to display when the callapse button is hovered.
31
+ * If not set then it uses "Show more" or "Show less".
32
+ */
33
+ textToggleCollapse?: string;
34
+ /**
35
+ * Event handler to toggle the collapse state.
36
+ */
37
+ handlerToggleCollapse?: () => void;
38
+ /**
39
+ * Use a border on the left side to visually connect the whole content content group.
40
+ */
41
+ borderMainConnection?: boolean;
42
+ /**
43
+ * Use a border on the left side to visually emphase the content group.
44
+ * If it is set to an array of color codes then the border is multi colored.
45
+ */
46
+ borderSubConnection?: boolean | string[];
47
+ /**
48
+ * Whitespace size between header and the content.
49
+ */
50
+ whitespaceSize?: "tiny" | "small" | "medium" | "large" | "xlarge";
51
+ /**
52
+ * Title minimum headline level.
53
+ */
54
+ minimumHeadlineLevel?: 1 | 2 | 3 | 4 | 5 | 6;
55
+ /**
56
+ * Props to pass to `StickyTarget`.
57
+ */
58
+ stickyHeaderProps?: Omit<StickyTargetProps, "children">;
59
+ /**
60
+ * Description of the content group.
61
+ * Added as tooltip to an info icon placed in the content group header.
62
+ */
63
+ description?: string;
64
+ /**
65
+ * Flag to hide the group divider.
66
+ */
67
+ hideGroupDivider?: boolean;
68
+ /**
69
+ * Additional props to pass to the content container.
70
+ */
71
+ contentProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
72
+ }
73
+ /**
74
+ * Manage display of a grouped content section.
75
+ * Add info, actions and context annotations by using its properties.
76
+ * Can be nested into each other.
77
+ */
78
+ export declare const ContentGroup: ({ children, className, title, contextInfo, annotation, actionOptions, isCollapsed, textToggleCollapse, handlerToggleCollapse, borderMainConnection, borderSubConnection, level, minimumHeadlineLevel, whitespaceSize, style, stickyHeaderProps, description, hideGroupDivider, contentProps, ...otherContentWrapperProps }: ContentGroupProps) => React.JSX.Element;
@@ -48,4 +48,5 @@ export * from "./Tooltip/Tooltip";
48
48
  export * from "./Tree/Tree";
49
49
  export * from "./Typography";
50
50
  export * from "./Workspace";
51
+ export * from "./ContentGroup/ContentGroup";
51
52
  export * from "./interfaces";
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": "24.1.0-rc.0",
4
+ "version": "24.1.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",
@@ -78,6 +78,7 @@
78
78
  "@codemirror/lang-xml": "^6.1.0",
79
79
  "@codemirror/legacy-modes": "^6.4.2",
80
80
  "@mavrin/remark-typograf": "^2.2.0",
81
+ "classnames": "^2.5.1",
81
82
  "codemirror": "^6.0.1",
82
83
  "color": "^4.2.3",
83
84
  "compute-scroll-into-view": "^3.1.0",
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import { LoremIpsum } from "react-lorem-ipsum";
3
+ import { Meta, StoryFn } from "@storybook/react";
4
+
5
+ import { Badge, ContentGroup, HtmlContentBlock, IconButton, Tag } from "../../../index";
6
+
7
+ export default {
8
+ title: "Components/ContentGroup",
9
+ component: ContentGroup,
10
+ argTypes: {
11
+ handlerToggleCollapse: {
12
+ action: "toggle collapse",
13
+ },
14
+ },
15
+ } as Meta<typeof ContentGroup>;
16
+
17
+ const TemplateFull: StoryFn<typeof ContentGroup> = (args) => <ContentGroup {...args} />;
18
+
19
+ export const BasicExample = TemplateFull.bind({});
20
+ BasicExample.args = {
21
+ title: "Content group title",
22
+ contextInfo: <Badge children={100} maxLength={3} intent={"warning"} title="Found warnings context." />,
23
+ annotation: (
24
+ <Tag backgroundColor={"purple"} round>
25
+ Context tag
26
+ </Tag>
27
+ ),
28
+ actionOptions: (
29
+ <>
30
+ <IconButton name="item-remove" text="Example remove tooltip" disruptive />
31
+ </>
32
+ ),
33
+ isCollapsed: false,
34
+ handlerToggleCollapse: () => {},
35
+ borderMainConnection: true,
36
+ borderSubConnection: ["red", "blue"],
37
+ level: 1,
38
+ minimumHeadlineLevel: 5,
39
+ whitespaceSize: "small",
40
+ description: "More context description by tooltip.",
41
+ hideGroupDivider: false,
42
+ children: (
43
+ <HtmlContentBlock>
44
+ <LoremIpsum p={3} avgSentencesPerParagraph={4} random={false} />
45
+ </HtmlContentBlock>
46
+ ),
47
+ };
@@ -0,0 +1,256 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+ import Color from "color";
4
+
5
+ import { TestableComponent } from "../../components/interfaces";
6
+ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
7
+ import {
8
+ Divider,
9
+ Icon,
10
+ IconButton,
11
+ OverflowText,
12
+ Section,
13
+ SectionHeader,
14
+ Spacing,
15
+ StickyTarget,
16
+ StickyTargetProps,
17
+ Toolbar,
18
+ ToolbarSection,
19
+ Tooltip,
20
+ } from "../index";
21
+
22
+ export interface ContentGroupProps extends Omit<React.HTMLAttributes<HTMLElement>, "title">, TestableComponent {
23
+ /**
24
+ * Title of the content group.
25
+ */
26
+ title?: string;
27
+ /**
28
+ * Level of the content group.
29
+ */
30
+ level?: number;
31
+ /**
32
+ * Context information to display in the header.
33
+ */
34
+ contextInfo?: React.ReactElement | React.ReactElement[];
35
+ /**
36
+ * Annotation to display in the content.
37
+ */
38
+ annotation?: React.ReactElement | React.ReactElement[];
39
+ /**
40
+ * Action options to display in the header.
41
+ */
42
+ actionOptions?: React.ReactElement | React.ReactElement[];
43
+ /**
44
+ * Flag to collapse the content group.
45
+ */
46
+ isCollapsed?: boolean;
47
+ /**
48
+ * Text to display when the callapse button is hovered.
49
+ * If not set then it uses "Show more" or "Show less".
50
+ */
51
+ textToggleCollapse?: string;
52
+ /**
53
+ * Event handler to toggle the collapse state.
54
+ */
55
+ handlerToggleCollapse?: () => void;
56
+ /**
57
+ * Use a border on the left side to visually connect the whole content content group.
58
+ */
59
+ borderMainConnection?: boolean;
60
+ /**
61
+ * Use a border on the left side to visually emphase the content group.
62
+ * If it is set to an array of color codes then the border is multi colored.
63
+ */
64
+ borderSubConnection?: boolean | string[];
65
+ /**
66
+ * Whitespace size between header and the content.
67
+ */
68
+ whitespaceSize?: "tiny" | "small" | "medium" | "large" | "xlarge";
69
+ /**
70
+ * Title minimum headline level.
71
+ */
72
+ minimumHeadlineLevel?: 1 | 2 | 3 | 4 | 5 | 6;
73
+ /**
74
+ * Props to pass to `StickyTarget`.
75
+ */
76
+ stickyHeaderProps?: Omit<StickyTargetProps, "children">;
77
+ /**
78
+ * Description of the content group.
79
+ * Added as tooltip to an info icon placed in the content group header.
80
+ */
81
+ description?: string;
82
+ /**
83
+ * Flag to hide the group divider.
84
+ */
85
+ hideGroupDivider?: boolean;
86
+ /**
87
+ * Additional props to pass to the content container.
88
+ */
89
+ contentProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
90
+ }
91
+
92
+ /**
93
+ * Manage display of a grouped content section.
94
+ * Add info, actions and context annotations by using its properties.
95
+ * Can be nested into each other.
96
+ */
97
+ export const ContentGroup = ({
98
+ children,
99
+ className = "",
100
+ title,
101
+ contextInfo,
102
+ annotation,
103
+ actionOptions,
104
+ isCollapsed = false,
105
+ textToggleCollapse,
106
+ handlerToggleCollapse,
107
+ borderMainConnection = false,
108
+ borderSubConnection = false,
109
+ level = 1,
110
+ minimumHeadlineLevel = 3,
111
+ whitespaceSize = "small",
112
+ style,
113
+ stickyHeaderProps,
114
+ description,
115
+ hideGroupDivider,
116
+ contentProps,
117
+ ...otherContentWrapperProps
118
+ }: ContentGroupProps) => {
119
+ const displayHeader = title || handlerToggleCollapse;
120
+
121
+ let borderGradient: string[] | undefined = undefined;
122
+ if (typeof borderSubConnection === "object") {
123
+ const borderColors: string[] = Array.isArray(borderSubConnection) ? borderSubConnection : [borderSubConnection];
124
+ borderGradient = borderColors.reduce((acc: string[], borderColor: string, index: number): string[] => {
125
+ try {
126
+ const color = Color(borderColor);
127
+
128
+ acc.push(
129
+ `${color.rgb().toString()} ` +
130
+ `${(index / borderColors.length) * 100}% ` +
131
+ `${((index + 1) / borderColors.length) * 100}%`
132
+ );
133
+ } catch {
134
+ // eslint-disable-next-line no-console
135
+ console.warn("Received invalid background color for tag: " + borderColor);
136
+ }
137
+ return acc;
138
+ }, []);
139
+ }
140
+
141
+ const contextInfoElements = Array.isArray(contextInfo) ? contextInfo : [contextInfo];
142
+ const { className: contentClassName, ...otherContentProps } = contentProps ?? {};
143
+
144
+ const headerContent = displayHeader ? (
145
+ <>
146
+ <SectionHeader className={`${eccgui}-contentgroup__header`}>
147
+ <Toolbar>
148
+ {handlerToggleCollapse && (
149
+ <ToolbarSection>
150
+ <IconButton
151
+ className={`${eccgui}-contentgroup__header__toggler`}
152
+ name={isCollapsed ? "toggler-showmore" : "toggler-showless"}
153
+ text={textToggleCollapse ?? (isCollapsed ? "Show more" : "Show less")}
154
+ onClick={handlerToggleCollapse}
155
+ />
156
+ <Spacing vertical size="small" />
157
+ </ToolbarSection>
158
+ )}
159
+ {title && (
160
+ <ToolbarSection canShrink>
161
+ {React.createElement(
162
+ "h" +
163
+ Math.min(
164
+ Math.max(minimumHeadlineLevel, level + minimumHeadlineLevel),
165
+ 6
166
+ ).toString(),
167
+ {
168
+ children: <OverflowText>{title}</OverflowText>,
169
+ className: `${eccgui}-contentgroup__header__title`,
170
+ }
171
+ )}
172
+ {description && (
173
+ <>
174
+ <Spacing vertical size="tiny" />
175
+ <Tooltip content={description}>
176
+ <Icon name="item-info" small className="dmapp--text-info" />
177
+ </Tooltip>
178
+ </>
179
+ )}
180
+ </ToolbarSection>
181
+ )}
182
+ {contextInfoElements &&
183
+ contextInfoElements[0]?.props &&
184
+ Object.values(contextInfoElements[0].props).every((v) => v !== undefined) && (
185
+ <ToolbarSection className={`${eccgui}-contentgroup__header__context`} canGrow>
186
+ <div className={`${eccgui}-contentgroup__content `}>
187
+ <Spacing vertical size="tiny" />
188
+ {contextInfoElements}
189
+ </div>
190
+ </ToolbarSection>
191
+ )}
192
+ {!isCollapsed && handlerToggleCollapse && actionOptions && (
193
+ <ToolbarSection className={`${eccgui}-contentgroup__header__options`}>
194
+ <Spacing vertical size="small" />
195
+ {actionOptions}
196
+ </ToolbarSection>
197
+ )}
198
+ </Toolbar>
199
+ </SectionHeader>
200
+ {(!isCollapsed || !handlerToggleCollapse) && (
201
+ <>
202
+ {!hideGroupDivider && <Divider addSpacing="small" />}
203
+ <Spacing size={whitespaceSize} />
204
+ </>
205
+ )}
206
+ </>
207
+ ) : (
208
+ <></>
209
+ );
210
+
211
+ return (
212
+ <Section
213
+ className={
214
+ `${eccgui}-contentgroup` +
215
+ (className ? ` ${className}` : "") +
216
+ (whitespaceSize ? ` ${eccgui}-contentgroup--padding-${whitespaceSize}` : "") +
217
+ (borderMainConnection ? ` ${eccgui}-contentgroup--border-main` : "") +
218
+ (borderSubConnection ? ` ${eccgui}-contentgroup--border-sub` : "")
219
+ }
220
+ style={
221
+ borderGradient
222
+ ? ({
223
+ ...(style ?? {}),
224
+ [`--${eccgui}-color-contentgroup-border-sub`]: borderGradient.join(", "),
225
+ } as React.CSSProperties)
226
+ : style
227
+ }
228
+ {...otherContentWrapperProps}
229
+ >
230
+ {headerContent && stickyHeaderProps ? (
231
+ <StickyTarget {...stickyHeaderProps}>{headerContent}</StickyTarget>
232
+ ) : (
233
+ headerContent
234
+ )}
235
+ {(!isCollapsed || !handlerToggleCollapse) && (
236
+ <>
237
+ <div className={`${eccgui}-contentgroup__content`}>
238
+ <div
239
+ className={classNames(`${eccgui}-contentgroup__content__body`, contentClassName)}
240
+ {...otherContentProps}
241
+ >
242
+ {children}
243
+ </div>
244
+ {contextInfo && !displayHeader && (
245
+ <div className={`${eccgui}-contentgroup__content__context`}>{contextInfoElements}</div>
246
+ )}
247
+ {annotation && <div>{annotation}</div>}
248
+ {actionOptions && !displayHeader && (
249
+ <div className={`${eccgui}-contentgroup__content__options`}>{actionOptions}</div>
250
+ )}
251
+ </div>
252
+ </>
253
+ )}
254
+ </Section>
255
+ );
256
+ };
@@ -0,0 +1,56 @@
1
+ $eccgui-color-scontentgroup-border-main: rgba($eccgui-color-workspace-text, $eccgui-opacity-muted) !default;
2
+ $eccgui-color-scontentgroup-border-sub: rgba($eccgui-color-workspace-text, $eccgui-opacity-disabled) !default;
3
+
4
+ .#{$eccgui}-contentgroup {
5
+ --#{$eccgui}-color-contentgroup-border-main: #{$eccgui-color-scontentgroup-border-main};
6
+ --#{$eccgui}-color-contentgroup-border-sub: #{$eccgui-color-scontentgroup-border-sub};
7
+ }
8
+
9
+ .#{$eccgui}-contentgroup--border-main {
10
+ border-left: 0.25 * $eccgui-size-block-whitespace solid
11
+ var(--#{$eccgui}-color-contentgroup-border-main, #{$eccgui-color-scontentgroup-border-main});
12
+
13
+ &.#{$eccgui}-contentgroup--padding-small {
14
+ padding-left: 0.5 * $eccgui-size-block-whitespace;
15
+ }
16
+ }
17
+
18
+ .#{$eccgui}-contentgroup--border-sub {
19
+ position: relative;
20
+ border-right: 0.25 * $eccgui-size-block-whitespace solid transparent;
21
+
22
+ &::after {
23
+ position: absolute;
24
+ top: 0;
25
+ bottom: 0;
26
+ left: 100%;
27
+ width: 0.25 * $eccgui-size-block-whitespace;
28
+ content: " ";
29
+ background-color: var(--#{$eccgui}-color-contentgroup-border-sub, #{$eccgui-color-scontentgroup-border-sub});
30
+ background-image: linear-gradient(to bottom, var(--#{$eccgui}-color-contentgroup-border-sub));
31
+ }
32
+
33
+ &.#{$eccgui}-contentgroup--padding-small {
34
+ padding-right: 0.5 * $eccgui-size-block-whitespace;
35
+ }
36
+ }
37
+
38
+ .#{$eccgui}-contentgroup--padding-small {
39
+ + .#{$eccgui}-contentgroup {
40
+ margin-top: 0.5 * $eccgui-size-block-whitespace;
41
+ }
42
+
43
+ > .#{$eccgui}-contentgroup__content {
44
+ column-gap: 0.5 * $eccgui-size-block-whitespace;
45
+ }
46
+ }
47
+
48
+ .#{$eccgui}-contentgroup__content {
49
+ display: flex;
50
+ }
51
+
52
+ .#{$eccgui}-contentgroup__content__body {
53
+ flex-grow: 1;
54
+ flex-shrink: 1;
55
+ width: 100%;
56
+ }
@@ -41,3 +41,4 @@
41
41
  @import "./Badge/badge";
42
42
  @import "./PropertyValuePair/propertyvalue";
43
43
  @import "./MultiSuggestField/multisuggestfield";
44
+ @import "./ContentGroup/contentgroup";
@@ -48,5 +48,6 @@ export * from "./Tooltip/Tooltip";
48
48
  export * from "./Tree/Tree";
49
49
  export * from "./Typography";
50
50
  export * from "./Workspace";
51
+ export * from "./ContentGroup/ContentGroup";
51
52
 
52
53
  export * from "./interfaces";