@eccenca/gui-elements 24.4.1-featurechatcomponentscmem6775.2 → 24.4.1-featurechatcomponentscmem6775.4
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 +7 -3
- package/dist/cjs/components/Chat/ChatArea.js +1 -1
- package/dist/cjs/components/Chat/ChatArea.js.map +1 -1
- package/dist/cjs/components/Chat/ChatContent.js +4 -16
- package/dist/cjs/components/Chat/ChatContent.js.map +1 -1
- package/dist/cjs/components/Chat/ChatContentCollapsed.js +24 -0
- package/dist/cjs/components/Chat/ChatContentCollapsed.js.map +1 -0
- package/dist/cjs/components/Chat/ChatField.js +10 -4
- package/dist/cjs/components/Chat/ChatField.js.map +1 -1
- package/dist/cjs/components/Chat/index.js +1 -0
- package/dist/cjs/components/Chat/index.js.map +1 -1
- package/dist/cjs/components/ContentGroup/ContentGroup.js +1 -1
- package/dist/cjs/components/ContentGroup/ContentGroup.js.map +1 -1
- package/dist/cjs/components/{ContentShrinker/ContentShrinker.js → TextReducer/TextReducer.js} +23 -26
- package/dist/cjs/components/TextReducer/TextReducer.js.map +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.js +3 -1
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/esm/components/Chat/ChatArea.js +1 -1
- package/dist/esm/components/Chat/ChatArea.js.map +1 -1
- package/dist/esm/components/Chat/ChatContent.js +4 -32
- package/dist/esm/components/Chat/ChatContent.js.map +1 -1
- package/dist/esm/components/Chat/ChatContentCollapsed.js +45 -0
- package/dist/esm/components/Chat/ChatContentCollapsed.js.map +1 -0
- package/dist/esm/components/Chat/ChatField.js +10 -4
- package/dist/esm/components/Chat/ChatField.js.map +1 -1
- package/dist/esm/components/Chat/index.js +1 -0
- package/dist/esm/components/Chat/index.js.map +1 -1
- package/dist/esm/components/ContentGroup/ContentGroup.js +1 -1
- package/dist/esm/components/ContentGroup/ContentGroup.js.map +1 -1
- package/dist/esm/components/{ContentShrinker/ContentShrinker.js → TextReducer/TextReducer.js} +22 -24
- package/dist/esm/components/TextReducer/TextReducer.js.map +1 -0
- package/dist/esm/components/Tooltip/Tooltip.js +3 -1
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +1 -1
- package/dist/types/components/Chat/ChatContent.d.ts +7 -19
- package/dist/types/components/Chat/ChatContentCollapsed.d.ts +28 -0
- package/dist/types/components/Chat/ChatField.d.ts +1 -1
- package/dist/types/components/Chat/index.d.ts +1 -0
- package/dist/types/components/TextReducer/TextReducer.d.ts +28 -0
- package/dist/types/components/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Chat/ChatArea.tsx +2 -2
- package/src/components/Chat/ChatContent.tsx +10 -41
- package/src/components/Chat/ChatContentCollapsed.tsx +64 -0
- package/src/components/Chat/ChatField.tsx +18 -5
- package/src/components/Chat/index.ts +1 -0
- package/src/components/Chat/stories/ChatArea.stories.tsx +28 -3
- package/src/components/Chat/stories/ChatContent.stories.tsx +3 -2
- package/src/components/Chat/stories/ChatContentCollapsed.stories.tsx +24 -0
- package/src/components/ContentGroup/ContentGroup.tsx +1 -1
- package/src/components/TextReducer/TextReducer.stories.tsx +47 -0
- package/src/components/TextReducer/TextReducer.tsx +98 -0
- package/src/components/Tooltip/Tooltip.test.tsx +63 -0
- package/src/components/Tooltip/Tooltip.tsx +3 -1
- package/src/components/index.ts +1 -1
- package/dist/cjs/components/ContentShrinker/ContentShrinker.js.map +0 -1
- package/dist/esm/components/ContentShrinker/ContentShrinker.js.map +0 -1
- package/dist/types/components/ContentShrinker/ContentShrinker.d.ts +0 -9
- package/src/components/ContentShrinker/ContentShrinker.stories.tsx +0 -25
- package/src/components/ContentShrinker/ContentShrinker.tsx +0 -59
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Chat/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Chat/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC"}
|
|
@@ -76,7 +76,7 @@ export var ContentGroup = function (_a) {
|
|
|
76
76
|
React.createElement("div", { className: "".concat(eccgui, "-contentgroup__content ") },
|
|
77
77
|
React.createElement(Spacing, { vertical: true, size: "tiny" }),
|
|
78
78
|
contextInfoElements))),
|
|
79
|
-
!isCollapsed
|
|
79
|
+
(!isCollapsed || !handlerToggleCollapse) && actionOptions && (React.createElement(ToolbarSection, { className: "".concat(eccgui, "-contentgroup__header__options") },
|
|
80
80
|
React.createElement(Spacing, { vertical: true, size: "small" }),
|
|
81
81
|
actionOptions)))),
|
|
82
82
|
(!isCollapsed || !handlerToggleCollapse) && (React.createElement(React.Fragment, null,
|
|
@@ -1 +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,Y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C,UAAG,MAAM,iCAA8B,EAAE,gBAAgB,CAAC,IAC5E,iBAAiB,GAEpB,QAAQ,CACP;gBACL,WAAW,IAAI,CAAC,aAAa,IAAI,CAC9B,6BAAK,SAAS,EAAE,UAAG,MAAM,oCAAiC,IAAG,mBAAmB,CAAO,CAC1F;gBACA,UAAU,IAAI,iCAAM,UAAU,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"}
|
package/dist/esm/components/{ContentShrinker/ContentShrinker.js → TextReducer/TextReducer.js}
RENAMED
|
@@ -9,42 +9,36 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
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
12
|
import React from "react";
|
|
24
13
|
import { renderToString } from "react-dom/server.js";
|
|
25
14
|
import * as ReactIs from "react-is";
|
|
26
15
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
|
|
27
|
-
import { Markdown } from "./../../cmem/markdown/Markdown.js";
|
|
28
16
|
import { OverflowText } from "./../Typography/index.js";
|
|
29
17
|
/**
|
|
30
|
-
* Component to
|
|
31
|
-
* Display
|
|
18
|
+
* Component to reduce HTML markup content to simple text.
|
|
19
|
+
* Display can be wrapped easily in `OverflowText`.
|
|
32
20
|
*/
|
|
33
|
-
export var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
21
|
+
export var TextReducer = function (_a) {
|
|
22
|
+
var children = _a.children, maxNodes = _a.maxNodes, maxLength = _a.maxLength, useOverflowTextWrapper = _a.useOverflowTextWrapper, overflowTextProps = _a.overflowTextProps;
|
|
23
|
+
var nodesCount = 0;
|
|
24
|
+
var onlyText = function (children, maxNodes) {
|
|
25
|
+
if (typeof maxNodes !== "undefined" && nodesCount >= maxNodes) {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
36
28
|
if (children instanceof Array) {
|
|
37
29
|
return children
|
|
30
|
+
.slice(0, maxNodes)
|
|
38
31
|
.map(function (child) {
|
|
39
|
-
return onlyText(child);
|
|
32
|
+
return onlyText(child, maxNodes);
|
|
40
33
|
})
|
|
41
34
|
.join(" ");
|
|
42
35
|
}
|
|
43
36
|
return React.Children.toArray(children)
|
|
37
|
+
.slice(0, maxNodes)
|
|
44
38
|
.map(function (child) {
|
|
45
39
|
var _a;
|
|
46
40
|
if (ReactIs.isFragment(child)) {
|
|
47
|
-
return onlyText((_a = child.props) === null || _a === void 0 ? void 0 : _a.children);
|
|
41
|
+
return onlyText((_a = child.props) === null || _a === void 0 ? void 0 : _a.children, maxNodes);
|
|
48
42
|
}
|
|
49
43
|
if (typeof child === "string") {
|
|
50
44
|
return child;
|
|
@@ -58,10 +52,14 @@ export var ContentShrinker = function (_a) {
|
|
|
58
52
|
}
|
|
59
53
|
return "";
|
|
60
54
|
})
|
|
61
|
-
.join(" ")
|
|
55
|
+
.join(" ")
|
|
56
|
+
.replaceAll("\n", " ");
|
|
62
57
|
};
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
var shrinkedContent = onlyText(children, maxNodes)
|
|
59
|
+
.replaceAll(/<[^\s][^>]*>/g, "")
|
|
60
|
+
.slice(0, maxLength);
|
|
61
|
+
return useOverflowTextWrapper ? (React.createElement(OverflowText, __assign({}, overflowTextProps, { className: "".concat(eccgui, "-textreducer") +
|
|
62
|
+
(overflowTextProps && overflowTextProps.className ? " ".concat(overflowTextProps.className) : "") }), shrinkedContent)) : (React.createElement(React.Fragment, null, shrinkedContent));
|
|
65
63
|
};
|
|
66
|
-
export default
|
|
67
|
-
//# sourceMappingURL=
|
|
64
|
+
export default TextReducer;
|
|
65
|
+
//# sourceMappingURL=TextReducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextReducer.js","sourceRoot":"","sources":["../../../../src/components/TextReducer/TextReducer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAqB,MAAM,iBAAiB,CAAC;AAuBlE;;;GAGG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,EAMT;QALf,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,sBAAsB,4BAAA,EACtB,iBAAiB,uBAAA;IAEjB,IAAM,UAAU,GAAG,CAAC,CAAC;IAErB,IAAM,QAAQ,GAAG,UAAC,QAA6C,EAAE,QAAiB;QAC9E,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;YAC5D,OAAO,EAAE,CAAC;QACd,CAAC;QAED,IAAI,QAAQ,YAAY,KAAK,EAAE,CAAC;YAC5B,OAAO,QAAQ;iBACV,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC;iBAClB,GAAG,CAAC,UAAC,KAAsB;gBACxB,OAAO,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACrC,CAAC,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,CACL,CAClB,CAAC,CAAC,CAAC,CACA,0CAAG,eAAe,CAAI,CACzB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -131,7 +131,9 @@ export var Tooltip = function (_a) {
|
|
|
131
131
|
}
|
|
132
132
|
return placeholder ? (displayPlaceholder()) : (React.createElement(BlueprintTooltip, __assign({ lazy: true, hoverOpenDelay: hoverOpenDelay }, otherTooltipProps, { content: tooltipContent, className: targetClassName, popoverClassName: "".concat(eccgui, "-tooltip__content") +
|
|
133
133
|
" ".concat(eccgui, "-tooltip--").concat(size) +
|
|
134
|
-
(className ? " " + className + "__content" : ""), ref: refocus, targetProps: __assign(__assign({}, otherTooltipProps.targetProps), { "data-postplaceholder":
|
|
134
|
+
(className ? " " + className + "__content" : ""), ref: refocus, targetProps: __assign(__assign({}, otherTooltipProps.targetProps), { "data-postplaceholder": eventMemory.current
|
|
135
|
+
? "id".concat(eventMemory.current).concat(searchId.current)
|
|
136
|
+
: undefined }) }), children));
|
|
135
137
|
};
|
|
136
138
|
export default Tooltip;
|
|
137
139
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACH,OAAO,IAAI,gBAAgB,EAC3B,OAAO,IAAI,gBAAgB,EAE3B,KAAK,IAAI,cAAc,GAC1B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAiB,MAAM,gCAAgC,CAAC;AA0CzE,MAAM,CAAC,IAAM,OAAO,GAAG,UAAC,EAYT;IAXX,IAAA,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,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c,GAAG,oBAAC,QAAQ,eAAK,aAAa,GAAG,OAAO,CAAY,CAAC;IACvE,CAAC;IAED,OAAO,WAAW,CAAC,CAAC,CAAC,CACjB,kBAAkB,EAAE,CACvB,CAAC,CAAC,CAAC,CACA,oBAAC,gBAAgB,aACb,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,IAC1B,iBAAiB,IACrB,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,eAAe,EAC1B,gBAAgB,EACZ,UAAG,MAAM,sBAAmB;YAC5B,WAAI,MAAM,uBAAa,IAAI,CAAE;YAC7B,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAEpD,GAAG,EAAE,OAAO,EACZ,WAAW,EACP,sBACO,iBAAiB,CAAC,WAAW,KAChC,sBAAsB,EAAE,WAAW,CAAC,OAAO;gBACvC,CAAC,CAAC,YAAK,WAAW,CAAC,OAAO,SAAG,QAAQ,CAAC,OAAO,CAAE;gBAC/C,CAAC,CAAC,SAAS,GACc,KAGpC,QAAQ,CACM,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -10,7 +10,7 @@ export * from "./Button/Button.js";
|
|
|
10
10
|
export * from "./Card/index.js";
|
|
11
11
|
export * from "./Chat/index.js";
|
|
12
12
|
export * from "./Checkbox/Checkbox.js";
|
|
13
|
-
export * from "./
|
|
13
|
+
export * from "./TextReducer/TextReducer.js";
|
|
14
14
|
export * from "./ContextOverlay/index.js";
|
|
15
15
|
export * from "./Depiction/Depiction.js";
|
|
16
16
|
export * from "./Dialog/index.js";
|
|
@@ -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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AC;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"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TestableComponent } from "../../components/interfaces";
|
|
3
3
|
import { MarkdownProps } from "./../../cmem/markdown/Markdown";
|
|
4
|
+
import { ContextMenuProps } from "./../ContextOverlay/ContextMenu";
|
|
4
5
|
import { DepictionProps } from "./../Depiction/Depiction";
|
|
6
|
+
import { IconButtonProps } from "./../Icon/IconButton";
|
|
5
7
|
import { OverflowTextProps } from "./../Typography";
|
|
6
8
|
export interface ChatContentProps extends React.HTMLAttributes<HTMLDivElement>, TestableComponent {
|
|
7
9
|
/**
|
|
@@ -29,33 +31,19 @@ export interface ChatContentProps extends React.HTMLAttributes<HTMLDivElement>,
|
|
|
29
31
|
* If set then the chat bubble only grows to a height of 50% of the viewport.
|
|
30
32
|
* In case you need to set other maximum heights then use the `style` property directly.
|
|
31
33
|
*/
|
|
32
|
-
limitHeight?:
|
|
34
|
+
limitHeight?: boolean;
|
|
33
35
|
/**
|
|
34
36
|
* If given then the content is automatically parsed and displayed by our `<Markdown />` component.
|
|
35
37
|
* `children` need to a `string` then, otherwise it cannot be parsed.
|
|
36
38
|
*/
|
|
37
39
|
markdownProps?: Omit<MarkdownProps, "children">;
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
40
|
-
* Button to shrink/expand is displayed, depending on `shrinked` value.
|
|
41
|
-
* If this handler is given then the component never will change the `shrinked` state automatically.
|
|
41
|
+
* Could be used to add some type of toggle button or to include a context menu.
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Content should dislayed shrinked.
|
|
46
|
-
* Button to expand content is displayed.
|
|
47
|
-
* Component can reduce content automatically to one line if `autoShrink` is set to `true`.
|
|
48
|
-
* If `onToggleSize` handler is not given then `autoShrink=true` is inferred and size toggling is automatically provided.
|
|
49
|
-
*/
|
|
50
|
-
shrinked?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Children elements are automatically shrinked to one line.
|
|
53
|
-
* If `shrinked` are not given then `shrinked=true` is infered.
|
|
54
|
-
*/
|
|
55
|
-
autoShrink?: boolean;
|
|
43
|
+
actionButton?: React.ReactElement<IconButtonProps> | React.ReactElement<ContextMenuProps>;
|
|
56
44
|
}
|
|
57
45
|
/**
|
|
58
|
-
* Component to display
|
|
46
|
+
* Component to display single chat contents, including avatar and status line.
|
|
59
47
|
*/
|
|
60
|
-
export declare const ChatContent: ({ className, children, statusLine, avatar, displayType, indentationSize, alignment, limitHeight, markdownProps,
|
|
48
|
+
export declare const ChatContent: ({ className, children, statusLine, avatar, displayType, indentationSize, alignment, limitHeight, markdownProps, actionButton, ...otherDivProps }: ChatContentProps) => React.JSX.Element;
|
|
61
49
|
export default ChatContent;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextReducerProps } from "../TextReducer/TextReducer";
|
|
3
|
+
import { ChatContentProps } from "./ChatContent";
|
|
4
|
+
export interface ChatContentCollapsedProps {
|
|
5
|
+
children: React.ReactElement<ChatContentProps>;
|
|
6
|
+
/**
|
|
7
|
+
* Set this to `false` if the compoment should initally start in an expanded state.
|
|
8
|
+
*/
|
|
9
|
+
collapsed?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Use this to set extra `TextReducer` properties.
|
|
12
|
+
* This is used to create the collapsed variant of the given content.
|
|
13
|
+
*/
|
|
14
|
+
textReducerProps?: Omit<TextReducerProps, "children">;
|
|
15
|
+
/**
|
|
16
|
+
* Text for collapse button.
|
|
17
|
+
*/
|
|
18
|
+
textCollapse?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Text for expand button.
|
|
21
|
+
*/
|
|
22
|
+
textExpand?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Adds an auto collapsing feature for convenience to `ChatContent`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ChatContentCollapsed: ({ children, collapsed, textReducerProps, textCollapse, textExpand, }: ChatContentCollapsedProps) => React.ReactElement<ChatContentProps, string | React.JSXElementConstructor<any>>;
|
|
28
|
+
export default ChatContentCollapsed;
|
|
@@ -16,5 +16,5 @@ export interface ChatFieldProps extends TextAreaProps, TestableComponent {
|
|
|
16
16
|
* Component to input chat text.
|
|
17
17
|
* Based on `TextArea` component.
|
|
18
18
|
*/
|
|
19
|
-
export declare const ChatField: ({ className, onTextSubmit, rightElement, ...otherTextAreaProps }: ChatFieldProps) => React.JSX.Element;
|
|
19
|
+
export declare const ChatField: ({ className, onTextSubmit, onChange, onKeyDown, rightElement, ...otherTextAreaProps }: ChatFieldProps) => React.JSX.Element;
|
|
20
20
|
export default ChatField;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OverflowTextProps } from "./../Typography";
|
|
3
|
+
export interface TextReducerProps extends Pick<React.HTMLAttributes<HTMLElement>, "children"> {
|
|
4
|
+
/**
|
|
5
|
+
* Maximum number of nodes that are used from the HTML content.
|
|
6
|
+
* An HTML element with multiple sub elements is count as only 1 node.
|
|
7
|
+
*/
|
|
8
|
+
maxNodes?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Set maximum string length of returned content.
|
|
11
|
+
*/
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Wrap returned content automatically in a `OverflowText` component.
|
|
15
|
+
* This way you always will get a element returned that displays only 1 single text line.
|
|
16
|
+
*/
|
|
17
|
+
useOverflowTextWrapper?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Specify more `OverflowText` properties used when `useOverflowTextWrapper` is set to `true`.
|
|
20
|
+
*/
|
|
21
|
+
overflowTextProps?: Omit<OverflowTextProps, "passDown">;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Component to reduce HTML markup content to simple text.
|
|
25
|
+
* Display can be wrapped easily in `OverflowText`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const TextReducer: ({ children, maxNodes, maxLength, useOverflowTextWrapper, overflowTextProps, }: TextReducerProps) => React.JSX.Element;
|
|
28
|
+
export default TextReducer;
|
|
@@ -10,7 +10,7 @@ export * from "./Button/Button";
|
|
|
10
10
|
export * from "./Card";
|
|
11
11
|
export * from "./Chat";
|
|
12
12
|
export * from "./Checkbox/Checkbox";
|
|
13
|
-
export * from "./
|
|
13
|
+
export * from "./TextReducer/TextReducer";
|
|
14
14
|
export * from "./ContextOverlay";
|
|
15
15
|
export * from "./Depiction/Depiction";
|
|
16
16
|
export * from "./Dialog";
|
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.4.1-featurechatcomponentscmem6775.
|
|
4
|
+
"version": "24.4.1-featurechatcomponentscmem6775.4",
|
|
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",
|
|
@@ -95,8 +95,8 @@ export const ChatArea = ({
|
|
|
95
95
|
<div className={`${eccgui}-chat__area-contentwidth`} ref={chatcontents}>
|
|
96
96
|
{autoSpacingSize && children ? (
|
|
97
97
|
<ul>
|
|
98
|
-
{React.Children.toArray(children).map((child) => (
|
|
99
|
-
<li>
|
|
98
|
+
{React.Children.toArray(children).map((child, index) => (
|
|
99
|
+
<li key={index}>
|
|
100
100
|
{child}
|
|
101
101
|
<Spacing size={autoSpacingSize} />
|
|
102
102
|
</li>
|
|
@@ -4,10 +4,10 @@ import { TestableComponent } from "../../components/interfaces";
|
|
|
4
4
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
5
|
|
|
6
6
|
import { Markdown, MarkdownProps } from "./../../cmem/markdown/Markdown";
|
|
7
|
-
import {
|
|
7
|
+
import { ContextMenuProps } from "./../ContextOverlay/ContextMenu";
|
|
8
8
|
import { DepictionProps } from "./../Depiction/Depiction";
|
|
9
9
|
import { FlexibleLayoutContainer, FlexibleLayoutItem } from "./../FlexibleLayout";
|
|
10
|
-
import {
|
|
10
|
+
import { IconButtonProps } from "./../Icon/IconButton";
|
|
11
11
|
import { Spacing } from "./../Separation/Spacing";
|
|
12
12
|
import { HtmlContentBlock, OverflowTextProps } from "./../Typography";
|
|
13
13
|
|
|
@@ -37,34 +37,20 @@ export interface ChatContentProps extends React.HTMLAttributes<HTMLDivElement>,
|
|
|
37
37
|
* If set then the chat bubble only grows to a height of 50% of the viewport.
|
|
38
38
|
* In case you need to set other maximum heights then use the `style` property directly.
|
|
39
39
|
*/
|
|
40
|
-
limitHeight?:
|
|
40
|
+
limitHeight?: boolean;
|
|
41
41
|
/**
|
|
42
42
|
* If given then the content is automatically parsed and displayed by our `<Markdown />` component.
|
|
43
43
|
* `children` need to a `string` then, otherwise it cannot be parsed.
|
|
44
44
|
*/
|
|
45
45
|
markdownProps?: Omit<MarkdownProps, "children">;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* Button to shrink/expand is displayed, depending on `shrinked` value.
|
|
49
|
-
* If this handler is given then the component never will change the `shrinked` state automatically.
|
|
47
|
+
* Could be used to add some type of toggle button or to include a context menu.
|
|
50
48
|
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Content should dislayed shrinked.
|
|
54
|
-
* Button to expand content is displayed.
|
|
55
|
-
* Component can reduce content automatically to one line if `autoShrink` is set to `true`.
|
|
56
|
-
* If `onToggleSize` handler is not given then `autoShrink=true` is inferred and size toggling is automatically provided.
|
|
57
|
-
*/
|
|
58
|
-
shrinked?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Children elements are automatically shrinked to one line.
|
|
61
|
-
* If `shrinked` are not given then `shrinked=true` is infered.
|
|
62
|
-
*/
|
|
63
|
-
autoShrink?: boolean;
|
|
49
|
+
actionButton?: React.ReactElement<IconButtonProps> | React.ReactElement<ContextMenuProps>;
|
|
64
50
|
}
|
|
65
51
|
|
|
66
52
|
/**
|
|
67
|
-
* Component to display
|
|
53
|
+
* Component to display single chat contents, including avatar and status line.
|
|
68
54
|
*/
|
|
69
55
|
export const ChatContent = ({
|
|
70
56
|
className,
|
|
@@ -76,23 +62,9 @@ export const ChatContent = ({
|
|
|
76
62
|
alignment = "left",
|
|
77
63
|
limitHeight,
|
|
78
64
|
markdownProps,
|
|
79
|
-
|
|
80
|
-
autoShrink,
|
|
81
|
-
onToggleSize,
|
|
65
|
+
actionButton,
|
|
82
66
|
...otherDivProps
|
|
83
67
|
}: ChatContentProps) => {
|
|
84
|
-
const [displayShrinked, setDispayShrinked] = React.useState<boolean>(
|
|
85
|
-
shrinked === true || (autoShrink === true && typeof shrinked === "undefined")
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const toggleSize = () => {
|
|
89
|
-
if (onToggleSize) {
|
|
90
|
-
onToggleSize();
|
|
91
|
-
} else {
|
|
92
|
-
setDispayShrinked(!displayShrinked);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
68
|
const content =
|
|
97
69
|
markdownProps && typeof children === "string" ? <Markdown {...markdownProps}>{children}</Markdown> : children;
|
|
98
70
|
|
|
@@ -113,7 +85,7 @@ export const ChatContent = ({
|
|
|
113
85
|
<Spacing size="tiny" />
|
|
114
86
|
</HtmlContentBlock>
|
|
115
87
|
)}
|
|
116
|
-
{
|
|
88
|
+
{content}
|
|
117
89
|
</div>
|
|
118
90
|
);
|
|
119
91
|
|
|
@@ -142,17 +114,14 @@ export const ChatContent = ({
|
|
|
142
114
|
</FlexibleLayoutItem>
|
|
143
115
|
)}
|
|
144
116
|
<FlexibleLayoutItem className={`${eccgui}-chat__content-wrapper`}>{chatitem}</FlexibleLayoutItem>
|
|
145
|
-
{
|
|
117
|
+
{actionButton && (
|
|
146
118
|
<FlexibleLayoutItem
|
|
147
119
|
className={`${eccgui}-chat__content-sizetoggle`}
|
|
148
120
|
growFactor={0}
|
|
149
121
|
shrinkFactor={0}
|
|
150
122
|
style={alignment === "right" ? { order: -1 } : undefined}
|
|
151
123
|
>
|
|
152
|
-
|
|
153
|
-
name={displayShrinked ? "toggler-showmore" : "toggler-showless"}
|
|
154
|
-
onClick={() => toggleSize()}
|
|
155
|
-
/>
|
|
124
|
+
{actionButton}
|
|
156
125
|
</FlexibleLayoutItem>
|
|
157
126
|
)}
|
|
158
127
|
</FlexibleLayoutContainer>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { Markdown } from "../../cmem/markdown/Markdown";
|
|
4
|
+
import { IconButton } from "../Icon/IconButton";
|
|
5
|
+
import { TextReducer, TextReducerProps } from "../TextReducer/TextReducer";
|
|
6
|
+
|
|
7
|
+
import { ChatContentProps } from "./ChatContent";
|
|
8
|
+
|
|
9
|
+
export interface ChatContentCollapsedProps {
|
|
10
|
+
children: React.ReactElement<ChatContentProps>;
|
|
11
|
+
/**
|
|
12
|
+
* Set this to `false` if the compoment should initally start in an expanded state.
|
|
13
|
+
*/
|
|
14
|
+
collapsed?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Use this to set extra `TextReducer` properties.
|
|
17
|
+
* This is used to create the collapsed variant of the given content.
|
|
18
|
+
*/
|
|
19
|
+
textReducerProps?: Omit<TextReducerProps, "children">;
|
|
20
|
+
/**
|
|
21
|
+
* Text for collapse button.
|
|
22
|
+
*/
|
|
23
|
+
textCollapse?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Text for expand button.
|
|
26
|
+
*/
|
|
27
|
+
textExpand?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Adds an auto collapsing feature for convenience to `ChatContent`.
|
|
32
|
+
*/
|
|
33
|
+
export const ChatContentCollapsed = ({
|
|
34
|
+
children,
|
|
35
|
+
collapsed = true,
|
|
36
|
+
textReducerProps = {},
|
|
37
|
+
textCollapse = "Collapse",
|
|
38
|
+
textExpand = "Expand",
|
|
39
|
+
}: ChatContentCollapsedProps) => {
|
|
40
|
+
const [displayCollapsed, setDispayCollapsed] = React.useState<boolean>(collapsed);
|
|
41
|
+
|
|
42
|
+
const childrenAsTextline = (
|
|
43
|
+
<TextReducer useOverflowTextWrapper {...textReducerProps}>
|
|
44
|
+
{typeof children.props.children === "string" ? (
|
|
45
|
+
<Markdown>{children.props.children}</Markdown>
|
|
46
|
+
) : (
|
|
47
|
+
children.props.children
|
|
48
|
+
)}
|
|
49
|
+
</TextReducer>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return React.cloneElement(children, {
|
|
53
|
+
children: displayCollapsed ? childrenAsTextline : children.props.children,
|
|
54
|
+
actionButton: (
|
|
55
|
+
<IconButton
|
|
56
|
+
text={displayCollapsed ? textExpand : textCollapse}
|
|
57
|
+
name={displayCollapsed ? "toggler-showmore" : "toggler-showless"}
|
|
58
|
+
onClick={() => setDispayCollapsed(!displayCollapsed)}
|
|
59
|
+
/>
|
|
60
|
+
),
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default ChatContentCollapsed;
|
|
@@ -21,7 +21,14 @@ export interface ChatFieldProps extends TextAreaProps, TestableComponent {
|
|
|
21
21
|
* Component to input chat text.
|
|
22
22
|
* Based on `TextArea` component.
|
|
23
23
|
*/
|
|
24
|
-
export const ChatField = ({
|
|
24
|
+
export const ChatField = ({
|
|
25
|
+
className,
|
|
26
|
+
onTextSubmit,
|
|
27
|
+
onChange,
|
|
28
|
+
onKeyDown,
|
|
29
|
+
rightElement,
|
|
30
|
+
...otherTextAreaProps
|
|
31
|
+
}: ChatFieldProps) => {
|
|
25
32
|
const chatvalue = React.useRef<string>(otherTextAreaProps.children ?? "");
|
|
26
33
|
|
|
27
34
|
const onContentChange = (value: string) => {
|
|
@@ -29,6 +36,7 @@ export const ChatField = ({ className, onTextSubmit, rightElement, ...otherTextA
|
|
|
29
36
|
};
|
|
30
37
|
|
|
31
38
|
const onEnter = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
39
|
+
if (onKeyDown) onKeyDown(e);
|
|
32
40
|
if (e.keyCode === 13 && e.shiftKey === false && onTextSubmit) {
|
|
33
41
|
e.preventDefault();
|
|
34
42
|
onTextSubmit(chatvalue.current);
|
|
@@ -40,10 +48,15 @@ export const ChatField = ({ className, onTextSubmit, rightElement, ...otherTextA
|
|
|
40
48
|
fill
|
|
41
49
|
autoResize
|
|
42
50
|
className={`${eccgui}-chat__inputfield` + (className ? ` ${className}` : "")}
|
|
43
|
-
onChange={
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
onChange={
|
|
52
|
+
onTextSubmit
|
|
53
|
+
? (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
54
|
+
onContentChange(e.target.value);
|
|
55
|
+
if (onChange) onChange(e);
|
|
56
|
+
}
|
|
57
|
+
: onChange
|
|
58
|
+
}
|
|
59
|
+
onKeyDown={onTextSubmit ? onEnter : onKeyDown}
|
|
47
60
|
rightElement={
|
|
48
61
|
(onTextSubmit || rightElement) && (
|
|
49
62
|
<>
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Meta, StoryFn } from "@storybook/react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ChatArea,
|
|
6
|
+
ChatContent,
|
|
7
|
+
ChatContentCollapsed,
|
|
8
|
+
ChatField,
|
|
9
|
+
ContentGroup,
|
|
10
|
+
Spacing,
|
|
11
|
+
TitleSubsection,
|
|
12
|
+
} from "../../../index";
|
|
5
13
|
|
|
14
|
+
import { BasicExample as ContentGroupExample } from "./../../ContentGroup/ContentGroup.stories";
|
|
6
15
|
import { Default as ShortChatBubble, LongChatBubble } from "./ChatContent.stories";
|
|
7
16
|
import { Default as ChatFieldExample } from "./ChatField.stories";
|
|
8
17
|
|
|
@@ -24,9 +33,25 @@ Default.args = {
|
|
|
24
33
|
chatField: <ChatField {...ChatFieldExample.args} />,
|
|
25
34
|
children: [
|
|
26
35
|
<ChatContent {...ShortChatBubble.args} alignment="right" indentationSize="medium" />,
|
|
27
|
-
<
|
|
36
|
+
<ChatContentCollapsed textReducerProps={{ maxNodes: 1 }}>
|
|
37
|
+
<ChatContent
|
|
38
|
+
avatar={undefined}
|
|
39
|
+
displayType="free"
|
|
40
|
+
statusLine={
|
|
41
|
+
<>
|
|
42
|
+
<strong>Bot</strong> right now
|
|
43
|
+
</>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
<TitleSubsection>Some technical content</TitleSubsection>
|
|
47
|
+
<Spacing size="small" />
|
|
48
|
+
<ContentGroup {...ContentGroupExample.args} style={{ marginRight: "2px" }} />
|
|
49
|
+
</ChatContent>
|
|
50
|
+
</ChatContentCollapsed>,
|
|
28
51
|
<ChatContent {...ShortChatBubble.args} alignment="right" indentationSize="medium" />,
|
|
29
|
-
<
|
|
52
|
+
<ChatContentCollapsed>
|
|
53
|
+
<ChatContent {...LongChatBubble.args} />
|
|
54
|
+
</ChatContentCollapsed>,
|
|
30
55
|
<ChatContent {...ShortChatBubble.args} alignment="right" indentationSize="medium" />,
|
|
31
56
|
<ChatContent {...ShortChatBubble.args} />,
|
|
32
57
|
],
|
|
@@ -45,15 +45,16 @@ Default.args = {
|
|
|
45
45
|
<strong>Username</strong> 25 minutes ago
|
|
46
46
|
</OverflowText>
|
|
47
47
|
),
|
|
48
|
-
onToggleSize: undefined,
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
export const LongChatBubble = TemplateFull.bind({});
|
|
52
51
|
LongChatBubble.args = {
|
|
53
52
|
...Default.args,
|
|
53
|
+
avatar: undefined,
|
|
54
|
+
displayType: "simple",
|
|
54
55
|
children: (
|
|
55
56
|
<HtmlContentBlock>
|
|
56
|
-
<LoremIpsum p={
|
|
57
|
+
<LoremIpsum p={7} avgSentencesPerParagraph={7} random={false} />
|
|
57
58
|
</HtmlContentBlock>
|
|
58
59
|
),
|
|
59
60
|
limitHeight: true,
|