@eccenca/gui-elements 24.4.0-fixpreventwronglydisplayedtooltipscmem6858.0 → 24.4.1-featurechatcomponentscmem6775.0

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 (53) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/common/index.js.map +1 -1
  3. package/dist/cjs/components/Chat/ChatArea.js +55 -0
  4. package/dist/cjs/components/Chat/ChatArea.js.map +1 -0
  5. package/dist/cjs/components/Chat/ChatContent.js +53 -0
  6. package/dist/cjs/components/Chat/ChatContent.js.map +1 -0
  7. package/dist/cjs/components/Chat/ChatField.js +45 -0
  8. package/dist/cjs/components/Chat/ChatField.js.map +1 -0
  9. package/dist/cjs/components/Chat/index.js +20 -0
  10. package/dist/cjs/components/Chat/index.js.map +1 -0
  11. package/dist/cjs/components/Icon/canonicalIconNames.js +3 -0
  12. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  13. package/dist/cjs/components/TextField/TextArea.js +2 -2
  14. package/dist/cjs/components/TextField/TextArea.js.map +1 -1
  15. package/dist/cjs/components/index.js +1 -0
  16. package/dist/cjs/components/index.js.map +1 -1
  17. package/dist/esm/common/index.js.map +1 -1
  18. package/dist/esm/components/Chat/ChatArea.js +59 -0
  19. package/dist/esm/components/Chat/ChatArea.js.map +1 -0
  20. package/dist/esm/components/Chat/ChatContent.js +57 -0
  21. package/dist/esm/components/Chat/ChatContent.js.map +1 -0
  22. package/dist/esm/components/Chat/ChatField.js +49 -0
  23. package/dist/esm/components/Chat/ChatField.js.map +1 -0
  24. package/dist/esm/components/Chat/index.js +4 -0
  25. package/dist/esm/components/Chat/index.js.map +1 -0
  26. package/dist/esm/components/Icon/canonicalIconNames.js +3 -0
  27. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  28. package/dist/esm/components/TextField/TextArea.js +2 -2
  29. package/dist/esm/components/TextField/TextArea.js.map +1 -1
  30. package/dist/esm/components/index.js +1 -0
  31. package/dist/esm/components/index.js.map +1 -1
  32. package/dist/types/common/index.d.ts +1 -0
  33. package/dist/types/components/Chat/ChatArea.d.ts +34 -0
  34. package/dist/types/components/Chat/ChatContent.d.ts +43 -0
  35. package/dist/types/components/Chat/ChatField.d.ts +19 -0
  36. package/dist/types/components/Chat/index.d.ts +3 -0
  37. package/dist/types/components/Icon/canonicalIconNames.d.ts +3 -0
  38. package/dist/types/components/index.d.ts +1 -0
  39. package/package.json +1 -1
  40. package/src/common/index.ts +1 -0
  41. package/src/components/Chat/ChatArea.tsx +114 -0
  42. package/src/components/Chat/ChatContent.tsx +116 -0
  43. package/src/components/Chat/ChatField.tsx +52 -0
  44. package/src/components/Chat/_chat.scss +81 -0
  45. package/src/components/Chat/index.ts +3 -0
  46. package/src/components/Chat/stories/ChatArea.stories.tsx +33 -0
  47. package/src/components/Chat/stories/ChatContent.stories.tsx +58 -0
  48. package/src/components/Chat/stories/ChatField.stories.tsx +18 -0
  49. package/src/components/Icon/canonicalIconNames.tsx +3 -0
  50. package/src/components/TextField/TextArea.tsx +2 -2
  51. package/src/components/Tooltip/Tooltip.stories.tsx +2 -0
  52. package/src/components/index.scss +1 -0
  53. package/src/components/index.ts +1 -0
@@ -60,7 +60,7 @@ export var TextArea = function (_a) {
60
60
  }
61
61
  leftIconElement.style.setProperty("left", textAreaStyle.paddingLeft);
62
62
  textAreaElement.style.setProperty("padding-left", "calc(".concat(leftIconElementRect.width ? 2 : 1, " * ").concat(textAreaStyle.paddingLeft, " + ").concat((_l = leftIconElementRect.width) !== null && _l !== void 0 ? _l : 0, "px)"));
63
- leftIconElement.addEventListener("click", function (_event) {
63
+ leftIconElement.addEventListener("click", function () {
64
64
  textAreaElement.focus();
65
65
  });
66
66
  }
@@ -98,7 +98,7 @@ export var TextArea = function (_a) {
98
98
  ? intent
99
99
  : undefined, spellCheck: intent === "removed" ? false : undefined, rows: rows && !otherBlueprintTextAreaProps.autoResize && !otherBlueprintTextAreaProps.growVertically
100
100
  ? rows
101
- : 1 }, otherBlueprintTextAreaProps, { dir: "auto", onChange: maybeWrappedOnChange })));
101
+ : 2 }, otherBlueprintTextAreaProps, { dir: "auto", onChange: maybeWrappedOnChange })));
102
102
  var _d = wrapperDivProps !== null && wrapperDivProps !== void 0 ? wrapperDivProps : {}, wrapperClassName = _d.className, otherWrapperDivProps = __rest(_d, ["className"]);
103
103
  return wrapperDivProps || leftIcon || rightElement ? (React.createElement("div", __assign({ className: "".concat(eccgui, "-textarea__wrapper") + (wrapperClassName ? " ".concat(wrapperClassName) : "") }, otherWrapperDivProps),
104
104
  textarea,
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../../src/components/TextField/TextArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACH,OAAO,IAAI,mBAAmB,EAG9B,QAAQ,IAAI,iBAAiB,GAEhC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAe,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAkC,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA4BxF,MAAM,CAAC,IAAM,QAAQ,GAAG,UAAC,EAST;IARZ,IAAA,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA,EACd,YAAQ,EAAR,IAAI,mBAAG,CAAC,KAAA,EACR,yBAAyB,+BAAA,EACzB,QAAQ,cAAA,EACR,YAAY,kBAAA,EACZ,eAAe,qBAAA,EACf,MAAM,YAAA,EACH,2BAA2B,cART,2GASxB,CADiC;IAE9B,IAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CACtC,UAAC,eAAoC;;QACjC,IAAI,eAAe,IAAI,OAAO,eAAe,KAAK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"./Badge/Badge.js";
8
8
  export * from "./Breadcrumb/index.js";
9
9
  export * from "./Button/Button.js";
10
10
  export * from "./Card/index.js";
11
+ export * from "./Chat/index.js";
11
12
  export * from "./Checkbox/Checkbox.js";
12
13
  export * from "./ContextOverlay/index.js";
13
14
  export * from "./Depiction/Depiction.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;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,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,qBAAq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AC;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"}
@@ -1,3 +1,4 @@
1
+ export type { IntentTypes as IntentBaseTypes } from "./Intent";
1
2
  export declare const utils: {
2
3
  openInNewTab: (event: React.MouseEvent<HTMLAnchorElement>, handler?: (e: React.MouseEvent<HTMLAnchorElement>) => void, url?: string) => void;
3
4
  decideContrastColorValue: ({ testColor, lightColor, darkColor, }: import("./utils/colorDecideContrastvalue").decideContrastColorValueProps) => string;
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { TestableComponent } from "../../components/interfaces";
3
+ import { FlexibleLayoutContainerProps } from "./../FlexibleLayout";
4
+ import { SpacingProps } from "./../Separation/Spacing";
5
+ import { ChatFieldProps } from "./ChatField";
6
+ export interface ChatAreaProps extends Omit<FlexibleLayoutContainerProps, "vertical" | "noEqualItemSpace">, TestableComponent {
7
+ /**
8
+ * The inut field for the chat.
9
+ */
10
+ chatField?: React.ReactElement<ChatFieldProps>;
11
+ /**
12
+ * Set the position of the chat field.
13
+ */
14
+ chatFieldPosition?: "top" | "bottom";
15
+ /**
16
+ * Sets the maximum width for chat contents and input.
17
+ */
18
+ contentWidth?: "small" | "medium" | "large" | "full";
19
+ /**
20
+ * Put chat content in a list and add spacings automatically.
21
+ * Works best if each `ChatArea` child represents one chat content item.
22
+ */
23
+ autoSpacingSize?: SpacingProps["size"];
24
+ /**
25
+ * Scrolls content to the first or last child automatically.
26
+ * The correct value depends on the place where you insert the most recent chat item.
27
+ */
28
+ autoScrollTo?: "first" | "last";
29
+ }
30
+ /**
31
+ * Component to display a full chat, containing chat content bubbles and text input.
32
+ */
33
+ export declare const ChatArea: ({ children, className, chatField, chatFieldPosition, contentWidth, autoSpacingSize, gapSize, autoScrollTo, ...otherFlexibleLayoutContainerProps }: ChatAreaProps) => React.JSX.Element;
34
+ export default ChatArea;
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { TestableComponent } from "../../components/interfaces";
3
+ import { MarkdownProps } from "./../../cmem/markdown/Markdown";
4
+ import { DepictionProps } from "./../Depiction/Depiction";
5
+ import { OverflowTextProps } from "./../Typography";
6
+ export interface ChatContentProps extends React.HTMLAttributes<HTMLDivElement>, TestableComponent {
7
+ /**
8
+ * Should be a line of text, e.g. username, timestamp, ...
9
+ */
10
+ statusLine?: React.ReactElement<OverflowTextProps>;
11
+ /**
12
+ * How the chat content box is displayed.
13
+ */
14
+ displayType?: "free" | "simple" | "bubble";
15
+ /**
16
+ * A depiction used as avatar next to the content box.
17
+ */
18
+ avatar?: React.ReactElement<DepictionProps>;
19
+ /**
20
+ * If indented then the content box has some white space on the opposite side to the alignment
21
+ */
22
+ indentationSize?: "small" | "medium" | "large";
23
+ /**
24
+ * How the content box and avatar is aligned.
25
+ * If `left` is set then the avatar is on the left side, and the indentation on the right side.
26
+ */
27
+ alignment?: "left" | "right";
28
+ /**
29
+ * If set then the chat bubble only grows to a height of 50% of the viewport.
30
+ * In case you need to set other maximum heights then use the `style` property directly.
31
+ */
32
+ limitHeight?: boolean;
33
+ /**
34
+ * If given then the content is automatically parsed and displayed by our `<Markdown />` component.
35
+ * `children` need to a `string` then, otherwise it cannot be parsed.
36
+ */
37
+ markdownProps?: Omit<MarkdownProps, "children">;
38
+ }
39
+ /**
40
+ * Component to display singe chat contents, including avatar and status line.
41
+ */
42
+ export declare const ChatContent: ({ className, children, statusLine, avatar, displayType, indentationSize, alignment, limitHeight, markdownProps, ...otherDivProps }: ChatContentProps) => React.JSX.Element;
43
+ export default ChatContent;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { TestableComponent } from "../../components/interfaces";
3
+ import { TextAreaProps } from "../TextField/TextArea";
4
+ export interface ChatFieldProps extends Pick<TextAreaProps, "className">, TestableComponent {
5
+ /**
6
+ * Default input to start with.
7
+ */
8
+ children?: string;
9
+ /**
10
+ * Callback handler to process the input of the field when `Enter` is pressed or the submit button is clicked.
11
+ */
12
+ onSubmit: (value: string) => void;
13
+ }
14
+ /**
15
+ * Component to input chat text.
16
+ * Based on `TextArea` component.
17
+ */
18
+ export declare const ChatField: ({ className, onSubmit, ...otherTextAreaProps }: ChatFieldProps) => React.JSX.Element;
19
+ export default ChatField;
@@ -0,0 +1,3 @@
1
+ export * from "./ChatArea";
2
+ export * from "./ChatContent";
3
+ export * from "./ChatField";
@@ -7,6 +7,7 @@ declare const canonicalIcons: {
7
7
  "application-homepage": icons.CarbonIconType;
8
8
  "application-legacygui": icons.CarbonIconType;
9
9
  "application-mapping": icons.CarbonIconType;
10
+ "application-colors": icons.CarbonIconType;
10
11
  "application-queries": icons.CarbonIconType;
11
12
  "application-useraccount": icons.CarbonIconType;
12
13
  "application-vocabularies": icons.CarbonIconType;
@@ -47,6 +48,7 @@ declare const canonicalIcons: {
47
48
  "artefact-uncategorized": icons.CarbonIconType;
48
49
  "artefact-workflow": icons.CarbonIconType;
49
50
  "data-boolean": icons.CarbonIconType;
51
+ "data-color": icons.CarbonIconType;
50
52
  "data-sourcepath": icons.CarbonIconType;
51
53
  "data-targetpath": icons.CarbonIconType;
52
54
  "data-string": icons.CarbonIconType;
@@ -136,6 +138,7 @@ declare const canonicalIcons: {
136
138
  "operation-merge": icons.CarbonIconType;
137
139
  "operation-redo": icons.CarbonIconType;
138
140
  "operation-search": icons.CarbonIconType;
141
+ "operation-send": icons.CarbonIconType;
139
142
  "operation-sharelink": icons.CarbonIconType;
140
143
  "operation-transform": icons.CarbonIconType;
141
144
  "operation-translate": icons.CarbonIconType;
@@ -8,6 +8,7 @@ export * from "./Badge/Badge";
8
8
  export * from "./Breadcrumb";
9
9
  export * from "./Button/Button";
10
10
  export * from "./Card";
11
+ export * from "./Chat";
11
12
  export * from "./Checkbox/Checkbox";
12
13
  export * from "./ContextOverlay";
13
14
  export * from "./Depiction/Depiction";
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.0-fixpreventwronglydisplayedtooltipscmem6858.0",
4
+ "version": "24.4.1-featurechatcomponentscmem6775.0",
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",
@@ -4,6 +4,7 @@ import getColorConfiguration from "./utils/getColorConfiguration";
4
4
  import { getScrollParent } from "./utils/getScrollParent";
5
5
  import { getGlobalVar, setGlobalVar } from "./utils/globalVars";
6
6
  import { openInNewTab } from "./utils/openInNewTab";
7
+ export type { IntentTypes as IntentBaseTypes } from "./Intent";
7
8
 
8
9
  export const utils = {
9
10
  openInNewTab,
@@ -0,0 +1,114 @@
1
+ import React from "react";
2
+
3
+ import { TestableComponent } from "../../components/interfaces";
4
+ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
+
6
+ import { FlexibleLayoutContainer, FlexibleLayoutContainerProps, FlexibleLayoutItem } from "./../FlexibleLayout";
7
+ import { Spacing, SpacingProps } from "./../Separation/Spacing";
8
+ import { ChatFieldProps } from "./ChatField";
9
+
10
+ export interface ChatAreaProps
11
+ extends Omit<FlexibleLayoutContainerProps, "vertical" | "noEqualItemSpace">,
12
+ TestableComponent {
13
+ /**
14
+ * The inut field for the chat.
15
+ */
16
+ chatField?: React.ReactElement<ChatFieldProps>;
17
+ /**
18
+ * Set the position of the chat field.
19
+ */
20
+ chatFieldPosition?: "top" | "bottom";
21
+ /**
22
+ * Sets the maximum width for chat contents and input.
23
+ */
24
+ contentWidth?: "small" | "medium" | "large" | "full";
25
+ /**
26
+ * Put chat content in a list and add spacings automatically.
27
+ * Works best if each `ChatArea` child represents one chat content item.
28
+ */
29
+ autoSpacingSize?: SpacingProps["size"];
30
+ /**
31
+ * Scrolls content to the first or last child automatically.
32
+ * The correct value depends on the place where you insert the most recent chat item.
33
+ */
34
+ autoScrollTo?: "first" | "last";
35
+ }
36
+
37
+ /**
38
+ * Component to display a full chat, containing chat content bubbles and text input.
39
+ */
40
+ export const ChatArea = ({
41
+ children,
42
+ className,
43
+ chatField,
44
+ chatFieldPosition = "bottom",
45
+ contentWidth = "medium",
46
+ autoSpacingSize,
47
+ gapSize = "medium",
48
+ autoScrollTo,
49
+ ...otherFlexibleLayoutContainerProps
50
+ }: ChatAreaProps) => {
51
+ const chatcontents = React.useRef<HTMLDivElement>(null);
52
+
53
+ React.useEffect(() => {
54
+ if (chatcontents.current && children && autoScrollTo) {
55
+ const chatitems = chatcontents.current.getElementsByClassName(`${eccgui}-chat__content`);
56
+ if (chatitems.length > 0) {
57
+ chatitems[autoScrollTo === "first" ? 0 : chatitems.length - 1].scrollIntoView({
58
+ behavior: "instant",
59
+ block: autoScrollTo === "first" ? "start" : "end",
60
+ });
61
+ }
62
+ }
63
+ }, [chatcontents, children, autoScrollTo]);
64
+
65
+ return (
66
+ <FlexibleLayoutContainer
67
+ className={
68
+ `${eccgui}-chat__area` + ` ${eccgui}-chat__area--${contentWidth}` + (className ? ` ${className}` : "")
69
+ }
70
+ vertical
71
+ noEqualItemSpace
72
+ gapSize={gapSize}
73
+ {...otherFlexibleLayoutContainerProps}
74
+ >
75
+ {chatField && (
76
+ <FlexibleLayoutItem
77
+ growFactor={0}
78
+ shrinkFactor={0}
79
+ style={chatFieldPosition === "bottom" ? { order: 1 } : undefined}
80
+ >
81
+ <div className={`${eccgui}-chat__area-contentwidth`}>{chatField}</div>
82
+ </FlexibleLayoutItem>
83
+ )}
84
+ <FlexibleLayoutItem
85
+ style={
86
+ otherFlexibleLayoutContainerProps.useAbsoluteSpace
87
+ ? {
88
+ overflow: "auto",
89
+ minHeight: 0,
90
+ padding: "2px 0",
91
+ }
92
+ : undefined
93
+ }
94
+ >
95
+ <div className={`${eccgui}-chat__area-contentwidth`} ref={chatcontents}>
96
+ {autoSpacingSize && children ? (
97
+ <ul>
98
+ {React.Children.toArray(children).map((child) => (
99
+ <li>
100
+ {child}
101
+ <Spacing size={autoSpacingSize} />
102
+ </li>
103
+ ))}
104
+ </ul>
105
+ ) : (
106
+ children
107
+ )}
108
+ </div>
109
+ </FlexibleLayoutItem>
110
+ </FlexibleLayoutContainer>
111
+ );
112
+ };
113
+
114
+ export default ChatArea;
@@ -0,0 +1,116 @@
1
+ import React from "react";
2
+
3
+ import { TestableComponent } from "../../components/interfaces";
4
+ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
+
6
+ import { Markdown, MarkdownProps } from "./../../cmem/markdown/Markdown";
7
+ import { DepictionProps } from "./../Depiction/Depiction";
8
+ import { FlexibleLayoutContainer, FlexibleLayoutItem } from "./../FlexibleLayout";
9
+ import { Spacing } from "./../Separation/Spacing";
10
+ import { HtmlContentBlock, OverflowTextProps } from "./../Typography";
11
+
12
+ export interface ChatContentProps extends React.HTMLAttributes<HTMLDivElement>, TestableComponent {
13
+ /**
14
+ * Should be a line of text, e.g. username, timestamp, ...
15
+ */
16
+ statusLine?: React.ReactElement<OverflowTextProps>;
17
+ /**
18
+ * How the chat content box is displayed.
19
+ */
20
+ displayType?: "free" | "simple" | "bubble";
21
+ /**
22
+ * A depiction used as avatar next to the content box.
23
+ */
24
+ avatar?: React.ReactElement<DepictionProps>;
25
+ /**
26
+ * If indented then the content box has some white space on the opposite side to the alignment
27
+ */
28
+ indentationSize?: "small" | "medium" | "large";
29
+ /**
30
+ * How the content box and avatar is aligned.
31
+ * If `left` is set then the avatar is on the left side, and the indentation on the right side.
32
+ */
33
+ alignment?: "left" | "right";
34
+ /**
35
+ * If set then the chat bubble only grows to a height of 50% of the viewport.
36
+ * In case you need to set other maximum heights then use the `style` property directly.
37
+ */
38
+ limitHeight?: boolean;
39
+ /**
40
+ * If given then the content is automatically parsed and displayed by our `<Markdown />` component.
41
+ * `children` need to a `string` then, otherwise it cannot be parsed.
42
+ */
43
+ markdownProps?: Omit<MarkdownProps, "children">;
44
+ }
45
+
46
+ /**
47
+ * Component to display singe chat contents, including avatar and status line.
48
+ */
49
+ export const ChatContent = ({
50
+ className,
51
+ children,
52
+ statusLine,
53
+ avatar,
54
+ displayType = "bubble",
55
+ indentationSize,
56
+ alignment = "left",
57
+ limitHeight,
58
+ markdownProps,
59
+ ...otherDivProps
60
+ }: ChatContentProps) => {
61
+ const content = (
62
+ <div
63
+ className={
64
+ `${eccgui}-chat__content` +
65
+ ` ${eccgui}-chat__content--display-${displayType}` +
66
+ ` ${eccgui}-chat__content--align-${alignment}` +
67
+ (limitHeight ? ` ${eccgui}-chat__content--limitheight` : "") +
68
+ (className ? ` ${className}` : "")
69
+ }
70
+ {...otherDivProps}
71
+ >
72
+ {statusLine && (
73
+ <HtmlContentBlock small>
74
+ {statusLine}
75
+ <Spacing size="tiny" />
76
+ </HtmlContentBlock>
77
+ )}
78
+ {markdownProps && typeof children === "string" ? (
79
+ <Markdown {...markdownProps}>{children}</Markdown>
80
+ ) : (
81
+ children
82
+ )}
83
+ </div>
84
+ );
85
+
86
+ const indentationSizes = {
87
+ small: "8%",
88
+ medium: "21%",
89
+ large: "34%",
90
+ };
91
+
92
+ return (
93
+ <div
94
+ style={{
95
+ marginLeft: alignment === "right" && indentationSize ? indentationSizes[indentationSize] : undefined,
96
+ marginRight: alignment === "left" && indentationSize ? indentationSizes[indentationSize] : undefined,
97
+ }}
98
+ >
99
+ <FlexibleLayoutContainer noEqualItemSpace gapSize="tiny">
100
+ {avatar && (
101
+ <FlexibleLayoutItem
102
+ className={`${eccgui}-chat__content-avatar`}
103
+ growFactor={0}
104
+ shrinkFactor={0}
105
+ style={alignment === "right" ? { order: 1 } : undefined}
106
+ >
107
+ {React.cloneElement(avatar, { size: "small", ratio: "1:1", rounded: true, resizing: "cover" })}
108
+ </FlexibleLayoutItem>
109
+ )}
110
+ <FlexibleLayoutItem className={`${eccgui}-chat__content-wrapper`}>{content}</FlexibleLayoutItem>
111
+ </FlexibleLayoutContainer>
112
+ </div>
113
+ );
114
+ };
115
+
116
+ export default ChatContent;
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+
3
+ import { TestableComponent } from "../../components/interfaces";
4
+ import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5
+ import { IconButton } from "../Icon/IconButton";
6
+ import { TextArea, TextAreaProps } from "../TextField/TextArea";
7
+
8
+ export interface ChatFieldProps extends Pick<TextAreaProps, "className">, TestableComponent {
9
+ /**
10
+ * Default input to start with.
11
+ */
12
+ children?: string;
13
+ /**
14
+ * Callback handler to process the input of the field when `Enter` is pressed or the submit button is clicked.
15
+ */
16
+ onSubmit: (value: string) => void;
17
+ }
18
+
19
+ /**
20
+ * Component to input chat text.
21
+ * Based on `TextArea` component.
22
+ */
23
+ export const ChatField = ({ className, onSubmit, ...otherTextAreaProps }: ChatFieldProps) => {
24
+ const chatvalue = React.useRef<string>(otherTextAreaProps.children ?? "");
25
+
26
+ const onContentChange = (value: string) => {
27
+ chatvalue.current = value;
28
+ };
29
+
30
+ const onEnter = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
31
+ if (e.keyCode === 13 && e.shiftKey === false) {
32
+ e.preventDefault();
33
+ onSubmit(chatvalue.current);
34
+ }
35
+ };
36
+
37
+ return (
38
+ <TextArea
39
+ fill
40
+ autoResize
41
+ className={`${eccgui}-chat__inputfield` + (className ? ` ${className}` : "")}
42
+ onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
43
+ onContentChange(e.target.value);
44
+ }}
45
+ onKeyDown={onEnter}
46
+ rightElement={<IconButton name={"operation-send"} onClick={() => onSubmit(chatvalue.current)} />}
47
+ {...otherTextAreaProps}
48
+ />
49
+ );
50
+ };
51
+
52
+ export default ChatField;
@@ -0,0 +1,81 @@
1
+ .#{$eccgui}-chat__content {
2
+ @extend .bp5-elevation-1;
3
+
4
+ position: relative;
5
+ z-index: 0;
6
+ min-height: $button-height;
7
+ padding: $eccgui-size-inline-whitespace;
8
+ overflow: auto;
9
+ background-color: var(--#{$eccgui}-chat__content-background);
10
+ border-radius: 3 * $pt-border-radius;
11
+ }
12
+
13
+ .#{$eccgui}-chat__content--display-free {
14
+ --#{$eccgui}-chat__content-background: transparent;
15
+
16
+ padding: 1px 0;
17
+ box-shadow: none;
18
+ }
19
+
20
+ .#{$eccgui}-chat__content--display-bubble {
21
+ margin-left: 0.75 * $eccgui-size-block-whitespace;
22
+
23
+ &.#{$eccgui}-chat__content--align-right {
24
+ margin-right: 0.75 * $eccgui-size-block-whitespace;
25
+ margin-left: none;
26
+ }
27
+ }
28
+
29
+ .#{$eccgui}-chat__content-wrapper {
30
+ --#{$eccgui}-chat__content-background: #{$light-gray5};
31
+ &:has(.#{$eccgui}-chat__content--display-bubble) {
32
+ position: relative;
33
+
34
+ &::before {
35
+ @extend .bp5-elevation-1;
36
+
37
+ position: absolute;
38
+ top: calc(#{mini-units(3)} - #{0.5 * $eccgui-size-block-whitespace});
39
+ left: 0.25 * $eccgui-size-block-whitespace;
40
+ z-index: 1;
41
+ width: $eccgui-size-block-whitespace;
42
+ height: $eccgui-size-block-whitespace;
43
+ content: " ";
44
+ background-color: var(--#{$eccgui}-chat__content-background);
45
+ clip-path: polygon(-5px calc(100% + 5px), -5px -5px, calc(100% + 5px) calc(100% + 5px));
46
+ transform: rotate(45deg);
47
+ }
48
+ }
49
+ &:has(.#{$eccgui}-chat__content--display-bubble.#{$eccgui}-chat__content--align-right) {
50
+ &::before {
51
+ right: 0.25 * $eccgui-size-block-whitespace;
52
+ left: auto;
53
+ transform: rotate(225deg);
54
+ }
55
+ }
56
+ }
57
+
58
+ .#{$eccgui}-chat__content--limitheight {
59
+ max-height: 50vh;
60
+ }
61
+
62
+ .#{$eccgui}-chat__inputfield {
63
+ min-height: mini-units(9);
64
+ max-height: 39vh;
65
+ resize: none !important;
66
+ }
67
+
68
+ .#{$eccgui}-chat__area-contentwidth {
69
+ width: 100%;
70
+ margin: 0 auto;
71
+
72
+ .#{$eccgui}-chat__area--small & {
73
+ max-width: 40rem;
74
+ }
75
+ .#{$eccgui}-chat__area--medium & {
76
+ max-width: 60rem;
77
+ }
78
+ .#{$eccgui}-chat__area--large & {
79
+ max-width: 80rem;
80
+ }
81
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./ChatArea";
2
+ export * from "./ChatContent";
3
+ export * from "./ChatField";
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { Meta, StoryFn } from "@storybook/react";
3
+
4
+ import { ChatArea, ChatContent, ChatField } from "../../../index";
5
+
6
+ import { Default as ShortChatBubble, LongChatBubble } from "./ChatContent.stories";
7
+ import { Default as ChatFieldExample } from "./ChatField.stories";
8
+
9
+ export default {
10
+ title: "Components/Chat/ChatArea",
11
+ component: ChatArea,
12
+ argTypes: {},
13
+ } as Meta<typeof ChatArea>;
14
+
15
+ let forceupdate = 0;
16
+ const TemplateFull: StoryFn<typeof ChatArea> = (args) => (
17
+ <div style={args.useAbsoluteSpace ? { position: "relative", height: "75vh" } : undefined}>
18
+ <ChatArea {...args} key={forceupdate++} />
19
+ </div>
20
+ );
21
+
22
+ export const Default = TemplateFull.bind({});
23
+ Default.args = {
24
+ chatField: <ChatField {...ChatFieldExample.args} />,
25
+ children: [
26
+ <ChatContent {...ShortChatBubble.args} alignment="right" indentationSize="medium" />,
27
+ <ChatContent {...ShortChatBubble.args} avatar={undefined} displayType="free" />,
28
+ <ChatContent {...ShortChatBubble.args} alignment="right" indentationSize="medium" />,
29
+ <ChatContent {...LongChatBubble.args} />,
30
+ <ChatContent {...ShortChatBubble.args} alignment="right" indentationSize="medium" />,
31
+ <ChatContent {...ShortChatBubble.args} />,
32
+ ],
33
+ };