@darajs/components 1.8.3 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../js/common/markdown/markdown.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAG1G,UAAU,aAAc,SAAQ,oBAAoB;IAChD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CACvC;AAuKD;;GAEG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAiBnD;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../js/common/markdown/markdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAG1G,UAAU,aAAc,SAAQ,oBAAoB;IAChD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CACvC;AAID;;GAEG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAoBnD;AAED,eAAe,QAAQ,CAAC"}
@@ -1,173 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import ReactMarkdown from 'react-markdown';
3
2
  import rehypeRaw from 'rehype-raw';
4
- import remarkGfm from 'remark-gfm';
5
3
  import { injectCss, useComponentStyles, useVariable } from '@darajs/core';
6
- import styled from '@darajs/styled-components';
7
- const _CustomMarkdown = styled.div `
8
- /*
9
- * Apply some base styles to the markdown content so it looks good by default
10
- * Inspired by https://tailwindcss.com/docs/typography-plugin
11
- */
12
- p {
13
- margin-top: 1.25rem;
14
- margin-bottom: 1.25rem;
15
- }
16
-
17
- blockquote {
18
- /* stylelint-disable declaration-property-value-no-unknown */
19
- quotes: '"\\201C""\\201D""\\2018""\\2019"';
20
- /* stylelint-enable declaration-property-value-no-unknown */
21
-
22
- margin-top: 1.5rem;
23
- margin-bottom: 1.5rem;
24
- padding-left: 1rem;
25
-
26
- font-weight: 500;
27
- font-style: italic;
28
- color: ${(props) => props.theme.colors.grey6};
29
-
30
- border-left: 0.25rem solid ${(props) => props.theme.colors.grey3};
31
- }
32
-
33
- h1 {
34
- margin-top: 2rem;
35
- margin-bottom: 1rem;
36
- font-size: 2.5rem;
37
- line-height: 1.1;
38
- }
39
-
40
- h2 {
41
- margin-top: 2rem;
42
- margin-bottom: 1rem;
43
- font-size: 1.5rem;
44
- line-height: 1.3;
45
- }
46
-
47
- h3 {
48
- margin-top: 1.6rem;
49
- margin-bottom: 0.6rem;
50
- font-size: 1.25rem;
51
- line-height: 1.25;
52
- }
53
-
54
- h4 {
55
- margin-top: 1.5rem;
56
- margin-bottom: 0.5rem;
57
- line-height: 1.5;
58
- }
59
-
60
- img,
61
- figure,
62
- video {
63
- margin-top: 1.5rem;
64
- margin-bottom: 1.5rem;
65
-
66
- * {
67
- margin-top: 0;
68
- margin-bottom: 0;
69
- }
70
- }
71
-
72
- code {
73
- font-size: 0.9rem;
74
- }
75
-
76
- h2 code {
77
- font-size: 0.875rem;
78
- }
79
-
80
- h3 code {
81
- font-size: 0.9rem;
82
- }
83
-
84
- pre {
85
- overflow-x: auto;
86
-
87
- margin-top: 1.7rem;
88
- margin-bottom: 1.7rem;
89
- padding: 0.85rem 1.15rem;
90
-
91
- font-size: 0.9rem;
92
- line-height: 1.7;
93
-
94
- border-radius: 0.375rem;
95
- }
96
-
97
- hr {
98
- margin-top: 3rem;
99
- margin-bottom: 3rem;
100
- }
101
-
102
- hr + *,
103
- h2 + *,
104
- h3 + *,
105
- h4 + * {
106
- margin-top: 0;
107
- }
108
-
109
- ol,
110
- ul {
111
- margin-top: 1.25rem;
112
- margin-bottom: 1.25rem;
113
- padding-left: 1.625rem;
114
-
115
- li {
116
- margin-top: 0.5rem;
117
- margin-bottom: 0.5rem;
118
- padding-left: 0.375rem;
119
-
120
- p {
121
- margin-top: 0.75rem;
122
- margin-bottom: 0.75rem;
123
- }
124
-
125
- *:first-child {
126
- margin-top: 1.25rem;
127
- }
128
-
129
- *:last-child {
130
- margin-bottom: 1.25rem;
131
- }
132
- }
133
- }
134
-
135
- table {
136
- font-size: 0.875rem;
137
- line-height: 1.7;
138
-
139
- thead {
140
- th {
141
- padding-right: 0.5rem;
142
- padding-bottom: 0.5rem;
143
- padding-left: 0.5rem;
144
- }
145
-
146
- th:first-child {
147
- padding-left: 0;
148
- }
149
-
150
- th:last-child {
151
- padding-right: 0;
152
- }
153
- }
154
-
155
- tbody {
156
- td {
157
- padding: 0.5rem;
158
- }
159
-
160
- td:first-child {
161
- padding-left: 0;
162
- }
163
-
164
- td:last-child {
165
- padding-right: 0;
166
- }
167
- }
168
- }
169
- `;
170
- const CustomMarkdown = injectCss(_CustomMarkdown);
4
+ import { Markdown as UiMarkdown } from '@darajs/ui-components';
5
+ const CustomMarkdown = injectCss(UiMarkdown);
171
6
  /**
172
7
  * A component for rendering markdown
173
8
  */
@@ -178,7 +13,9 @@ function Markdown(props) {
178
13
  if (props.html_raw) {
179
14
  rehypePlugins.push(rehypeRaw);
180
15
  }
181
- return (_jsx(CustomMarkdown, { "$rawCss": css, className: props.className, style: style, children: _jsx(ReactMarkdown, { rehypePlugins: rehypePlugins, remarkPlugins: [remarkGfm], children: markdown }) }));
16
+ return (_jsx(CustomMarkdown, { "$rawCss": css, className: props.className, style: style, markdown: markdown,
17
+ // @ts-expect-error rehype type
18
+ rehypePlugins: rehypePlugins }));
182
19
  }
183
20
  export default Markdown;
184
21
  //# sourceMappingURL=markdown.js.map
@@ -1 +1 @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AAC,aAAa,IAAC,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC,SAAS,CAAC,YAClE,QAAQ,GACG,GACH,CACpB,CAAC;AACN,CAAC;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../js/common/markdown/markdown.tsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAkC,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1G,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAa/D,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAE7C;;GAEG;AACH,SAAS,QAAQ,CAAC,KAAoB;IAClC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE/C,MAAM,aAAa,GAAG,EAAE,CAAC;IAEzB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,CACH,KAAC,cAAc,eACF,GAAG,EACZ,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ;QAClB,+BAA+B;QAC/B,aAAa,EAAE,aAAa,GAC9B,CACL,CAAC;AACN,CAAC;AAED,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../js/smart/chat/chat.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,oBAAoB,EAEpB,QAAQ,EAQX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAA0C,MAAM,uBAAuB,CAAC;AAGxF,UAAU,SAAU,SAAQ,oBAAoB;IAC5C,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CAC/B;AAiGD;;;;GAIG;AACH,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAgF3C;AAED,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../js/smart/chat/chat.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,oBAAoB,EAEpB,QAAQ,EAQX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAA0C,MAAM,uBAAuB,CAAC;AAGxF,UAAU,SAAU,SAAQ,oBAAoB;IAC5C,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;CAC/B;AAkID;;;;GAIG;AACH,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAyF3C;AAED,eAAe,IAAI,CAAC"}
@@ -7,31 +7,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import * as React from 'react';
12
12
  import { handleAuthErrors, injectCss, request, useComponentStyles, useRequestExtras, useUser, useVariable, } from '@darajs/core';
13
13
  import styled, { useTheme } from '@darajs/styled-components';
14
14
  import { Chat as UiChat } from '@darajs/ui-components';
15
15
  import { HTTP_METHOD, validateResponse } from '@darajs/ui-utils';
16
- const ChatWrapper = styled.div `
16
+ const ThreadWrapper = styled.div `
17
17
  pointer-events: auto;
18
18
 
19
19
  position: fixed;
20
- z-index: 999;
21
20
  right: 1rem;
22
21
  bottom: -0.1rem;
22
+
23
+ margin: 1rem;
24
+
25
+ border-radius: 0.4rem;
23
26
  `;
24
27
  const ChatButton = styled.button `
25
- width: 3.5rem;
26
- height: 3.5rem;
27
- margin: 0 2rem 2rem 0;
28
- padding-top: 0.5rem;
28
+ position: absolute;
29
+ right: 1rem;
30
+ bottom: 1rem;
31
+
32
+ width: 2rem;
33
+ height: 2rem;
34
+ padding-top: 0.45rem;
29
35
 
30
36
  color: ${(props) => props.theme.colors.background};
31
37
 
32
38
  background-color: ${(props) => props.theme.colors.primary};
33
39
  border: none;
34
- border-radius: 3rem;
40
+ border-radius: 2rem;
35
41
 
36
42
  :hover {
37
43
  background-color: ${(props) => props.theme.colors.primaryHover};
@@ -92,6 +98,31 @@ function sendNewMessage(payload, extras) {
92
98
  }
93
99
  });
94
100
  }
101
+ /**
102
+ * Check if the given selector has been rendered more than once in the document
103
+ *
104
+ * @param selector the selector to check
105
+ */
106
+ function checkMoreThanOneRenderedElement(selector) {
107
+ const elements = document.querySelectorAll(selector);
108
+ return elements.length > 1;
109
+ }
110
+ /**
111
+ * Get the highest z-index of the elements with the given selector
112
+ *
113
+ * @param selector the selector to get the z-index from
114
+ */
115
+ function getHighestZIndex(selector) {
116
+ const elements = document.querySelectorAll(selector);
117
+ let highest = 998; // Start with 998
118
+ elements.forEach((element) => {
119
+ const zIndex = parseInt(window.getComputedStyle(element).zIndex);
120
+ if (zIndex > highest) {
121
+ highest = zIndex;
122
+ }
123
+ });
124
+ return highest;
125
+ }
95
126
  /**
96
127
  * The Chat component switches between a chat button and a chat sidebar, allowing the user to interact with a chat.
97
128
  *
@@ -102,6 +133,8 @@ function Chat(props) {
102
133
  const [style, css] = useComponentStyles(props);
103
134
  const [value, setValue] = useVariable(props.value);
104
135
  const [showChat, setShowChat] = React.useState(false);
136
+ const [areThereOtherChats, setAreThereOtherChats] = React.useState(false);
137
+ const [zIndex, setZIndex] = React.useState(998);
105
138
  const user = useUser();
106
139
  const theme = useTheme();
107
140
  const extras = useRequestExtras();
@@ -121,7 +154,23 @@ function Chat(props) {
121
154
  }
122
155
  setValue(newValue);
123
156
  };
124
- return (_jsxs(ChatWrapper, { children: [showChat && (_jsx(StyledChat, { "$rawCss": css, className: props.className, onClose: () => setShowChat(false), onUpdate: onUpdate, style: style, value: value, activeUser: parseUserData(userData) })), !showChat && (_jsx(ChatButton, { onClick: () => setShowChat(true), children: _jsxs("svg", { fill: "none", height: "32", viewBox: "0 0 32 32", width: "32", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { fill: "none", height: "24", rx: "3", width: "30", x: "1", y: "1.33594" }), _jsx("rect", { height: "24", rx: "3", stroke: theme.colors.background, strokeWidth: "2", width: "30", x: "1", y: "1.33594" }), _jsx("path", { d: "M8 8.33594H24", stroke: theme.colors.background, strokeLinecap: "round", strokeWidth: "2" }), _jsx("path", { d: "M8 13.3359H24", stroke: theme.colors.background, strokeLinecap: "round", strokeWidth: "2" }), _jsx("path", { d: "M8 18.3359H24", stroke: theme.colors.background, strokeLinecap: "round", strokeWidth: "2" }), _jsx("path", { d: "M18.5981 26.1641L16 30.6641L13.4019 26.1641L18.5981 26.1641Z", fill: theme.colors.background, stroke: theme.colors.background }), _jsx("path", { d: "M16 28.3359L13.4019 23.8359L18.5981 23.8359L16 28.3359Z", fill: "none" })] }) }))] }));
157
+ const onClickChatButton = () => {
158
+ setShowChat(true);
159
+ setZIndex(getHighestZIndex('.chat-thread') + 1);
160
+ // we need to update here so that if the chat button is clicked again when it is already open, the background color is updated
161
+ setAreThereOtherChats(checkMoreThanOneRenderedElement('.chat-thread'));
162
+ };
163
+ React.useLayoutEffect(() => {
164
+ setAreThereOtherChats(checkMoreThanOneRenderedElement('.chat-thread'));
165
+ }, [showChat]);
166
+ return (_jsxs(_Fragment, { children: [showChat && (
167
+ // we set the z-index so that the latest chat thread opened is always on top, and if there is a chat thread open, we set the background color so that the transparency does not show the thread behind
168
+ _jsx(ThreadWrapper, { className: "chat-thread", style: {
169
+ zIndex,
170
+ backgroundColor: areThereOtherChats ? theme.colors.background : 'transparent',
171
+ }, children: _jsx(StyledChat, { "$rawCss": css, className: props.className, onClose: () => setShowChat(false), onUpdate: onUpdate,
172
+ // TODO: remove margin 0 when dara-ui is updated to not set it
173
+ style: Object.assign({ margin: 0 }, style), value: value, activeUser: parseUserData(userData) }) })), _jsx(ChatButton, { onClick: onClickChatButton, children: _jsxs("svg", { fill: "none", height: "32", viewBox: "0 0 52 52", width: "32", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { fill: "none", height: "24", rx: "3", width: "30", x: "1", y: "1.33594" }), _jsx("rect", { height: "24", rx: "3", stroke: theme.colors.background, strokeWidth: "2", width: "30", x: "1", y: "1.33594" }), _jsx("path", { d: "M8 8.33594H24", stroke: theme.colors.background, strokeLinecap: "round", strokeWidth: "2" }), _jsx("path", { d: "M8 13.3359H24", stroke: theme.colors.background, strokeLinecap: "round", strokeWidth: "2" }), _jsx("path", { d: "M8 18.3359H24", stroke: theme.colors.background, strokeLinecap: "round", strokeWidth: "2" }), _jsx("path", { d: "M18.5981 26.1641L16 30.6641L13.4019 26.1641L18.5981 26.1641Z", fill: theme.colors.background, stroke: theme.colors.background }), _jsx("path", { d: "M16 28.3359L13.4019 23.8359L18.5981 23.8359L16 28.3359Z", fill: "none" })] }) })] }));
125
174
  }
126
175
  export default Chat;
127
176
  //# sourceMappingURL=chat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../js/smart/chat/chat.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAKH,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,WAAW,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,MAAM,EAAE,EAA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G,IAC9E,GACG,IACd,CACN,CAAC;AACN,CAAC;AAED,eAAe,IAAI,CAAC"}
@@ -31232,7 +31232,7 @@
31232
31232
  };
31233
31233
  return jsxRuntime.exports.jsxs(MessageWrapper, { className: props.className, style: props.style, children: [jsxRuntime.exports.jsxs(MessageTop, { children: [jsxRuntime.exports.jsxs(UserInfoWrapper, { children: [jsxRuntime.exports.jsx(AvatarIcon, { style: { backgroundColor: selectColor(localMessage.user.name, tokenColors) }, children: getInitials(localMessage.user.name) }), jsxRuntime.exports.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [localMessage.user.name, jsxRuntime.exports.jsx(MessageTimestamp, { children: getFormattedTimestamp(props.value.created_at) })] }), localMessage.updated_at !== localMessage.created_at && jsxRuntime.exports.jsx(Tooltip$1, { content: getFormattedTimestamp(props.value.updated_at), children: jsxRuntime.exports.jsx(EditedText, { children: " (edited)" }) })] }), !editMode && props.isEditable && jsxRuntime.exports.jsxs(InteractiveIcons, { children: [jsxRuntime.exports.jsx(EditIcon, { "data-testid": "message-edit-button", onClick: () => setEditMode(true), role: "button" }), jsxRuntime.exports.jsx(DeleteIcon, { "data-testid": "message-delete-button", onClick: onDelete, role: "button" })] })] }), editMode && jsxRuntime.exports.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [jsxRuntime.exports.jsx(TextArea, { onChange: setEditMessage, resize: "vertical", value: editMessage }), jsxRuntime.exports.jsxs(EditButtons, { children: [jsxRuntime.exports.jsx(Button$3, { onClick: () => setEditMode(false), outline: true, children: "Cancel" }), jsxRuntime.exports.jsx(Button$3, { onClick: onAccept, children: "Save" })] })] }), !editMode && jsxRuntime.exports.jsx(MessageBody, { children: jsxRuntime.exports.jsx(Markdown$1, { markdown: processText(localMessage.message) }) })] });
31234
31234
  }
31235
- const ChatWrapper$1 = styled__default.default.div`
31235
+ const ChatWrapper = styled__default.default.div`
31236
31236
  overflow-y: auto;
31237
31237
  display: flex;
31238
31238
  flex-direction: column;
@@ -31358,7 +31358,7 @@
31358
31358
  React__namespace.useLayoutEffect(() => {
31359
31359
  scrollToBottom(chatBodyRef === null || chatBodyRef === void 0 ? void 0 : chatBodyRef.current);
31360
31360
  }, []);
31361
- return jsxRuntime.exports.jsxs(ChatWrapper$1, { className: props.className, style: props.style, children: [jsxRuntime.exports.jsxs(ChatTop, { children: [jsxRuntime.exports.jsx("span", { children: "Chat" }), jsxRuntime.exports.jsx(CloseIcon, { onClick: props.onClose })] }), jsxRuntime.exports.jsx(ChatBody, { ref: chatBodyRef, children: localMessages.map((message) => jsxRuntime.exports.jsx(MessageComponent, { onChange: onEditMessage, onDelete: onDeleteMessage, value: message, isEditable: didUserWriteMessage(message, props.activeUser) }, message.id)) }), jsxRuntime.exports.jsxs(ReplyWrapper, { children: [jsxRuntime.exports.jsx(TextArea, { onChange: onChangeReply, onComplete: onSubmitMessage, placeholder: "Add a comment", resize: "none", value: reply }), jsxRuntime.exports.jsx(ReplyButtons, { children: jsxRuntime.exports.jsx(Button$3, { disabled: !(reply.trim().length > 0), onClick: onSubmitMessage, children: "Send" }) })] })] });
31361
+ return jsxRuntime.exports.jsxs(ChatWrapper, { className: props.className, style: props.style, children: [jsxRuntime.exports.jsxs(ChatTop, { children: [jsxRuntime.exports.jsx("span", { children: "Chat" }), jsxRuntime.exports.jsx(CloseIcon, { onClick: props.onClose })] }), jsxRuntime.exports.jsx(ChatBody, { ref: chatBodyRef, children: localMessages.map((message) => jsxRuntime.exports.jsx(MessageComponent, { onChange: onEditMessage, onDelete: onDeleteMessage, value: message, isEditable: didUserWriteMessage(message, props.activeUser) }, message.id)) }), jsxRuntime.exports.jsxs(ReplyWrapper, { children: [jsxRuntime.exports.jsx(TextArea, { onChange: onChangeReply, onComplete: onSubmitMessage, placeholder: "Add a comment", resize: "none", value: reply }), jsxRuntime.exports.jsx(ReplyButtons, { children: jsxRuntime.exports.jsx(Button$3, { disabled: !(reply.trim().length > 0), onClick: onSubmitMessage, children: "Send" }) })] })] });
31362
31362
  }
31363
31363
  const CheckboxWrapper$1 = styled__default.default.label`
31364
31364
  cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
@@ -64319,170 +64319,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
64319
64319
  return result;
64320
64320
  };
64321
64321
  }
64322
- const _CustomMarkdown = styled__default.default.div`
64323
- /*
64324
- * Apply some base styles to the markdown content so it looks good by default
64325
- * Inspired by https://tailwindcss.com/docs/typography-plugin
64326
- */
64327
- p {
64328
- margin-top: 1.25rem;
64329
- margin-bottom: 1.25rem;
64330
- }
64331
-
64332
- blockquote {
64333
- /* stylelint-disable declaration-property-value-no-unknown */
64334
- quotes: '"\\201C""\\201D""\\2018""\\2019"';
64335
- /* stylelint-enable declaration-property-value-no-unknown */
64336
-
64337
- margin-top: 1.5rem;
64338
- margin-bottom: 1.5rem;
64339
- padding-left: 1rem;
64340
-
64341
- font-weight: 500;
64342
- font-style: italic;
64343
- color: ${(props) => props.theme.colors.grey6};
64344
-
64345
- border-left: 0.25rem solid ${(props) => props.theme.colors.grey3};
64346
- }
64347
-
64348
- h1 {
64349
- margin-top: 2rem;
64350
- margin-bottom: 1rem;
64351
- font-size: 2.5rem;
64352
- line-height: 1.1;
64353
- }
64354
-
64355
- h2 {
64356
- margin-top: 2rem;
64357
- margin-bottom: 1rem;
64358
- font-size: 1.5rem;
64359
- line-height: 1.3;
64360
- }
64361
-
64362
- h3 {
64363
- margin-top: 1.6rem;
64364
- margin-bottom: 0.6rem;
64365
- font-size: 1.25rem;
64366
- line-height: 1.25;
64367
- }
64368
-
64369
- h4 {
64370
- margin-top: 1.5rem;
64371
- margin-bottom: 0.5rem;
64372
- line-height: 1.5;
64373
- }
64374
-
64375
- img,
64376
- figure,
64377
- video {
64378
- margin-top: 1.5rem;
64379
- margin-bottom: 1.5rem;
64380
-
64381
- * {
64382
- margin-top: 0;
64383
- margin-bottom: 0;
64384
- }
64385
- }
64386
-
64387
- code {
64388
- font-size: 0.9rem;
64389
- }
64390
-
64391
- h2 code {
64392
- font-size: 0.875rem;
64393
- }
64394
-
64395
- h3 code {
64396
- font-size: 0.9rem;
64397
- }
64398
-
64399
- pre {
64400
- overflow-x: auto;
64401
-
64402
- margin-top: 1.7rem;
64403
- margin-bottom: 1.7rem;
64404
- padding: 0.85rem 1.15rem;
64405
-
64406
- font-size: 0.9rem;
64407
- line-height: 1.7;
64408
-
64409
- border-radius: 0.375rem;
64410
- }
64411
-
64412
- hr {
64413
- margin-top: 3rem;
64414
- margin-bottom: 3rem;
64415
- }
64416
-
64417
- hr + *,
64418
- h2 + *,
64419
- h3 + *,
64420
- h4 + * {
64421
- margin-top: 0;
64422
- }
64423
-
64424
- ol,
64425
- ul {
64426
- margin-top: 1.25rem;
64427
- margin-bottom: 1.25rem;
64428
- padding-left: 1.625rem;
64429
-
64430
- li {
64431
- margin-top: 0.5rem;
64432
- margin-bottom: 0.5rem;
64433
- padding-left: 0.375rem;
64434
-
64435
- p {
64436
- margin-top: 0.75rem;
64437
- margin-bottom: 0.75rem;
64438
- }
64439
-
64440
- *:first-child {
64441
- margin-top: 1.25rem;
64442
- }
64443
-
64444
- *:last-child {
64445
- margin-bottom: 1.25rem;
64446
- }
64447
- }
64448
- }
64449
-
64450
- table {
64451
- font-size: 0.875rem;
64452
- line-height: 1.7;
64453
-
64454
- thead {
64455
- th {
64456
- padding-right: 0.5rem;
64457
- padding-bottom: 0.5rem;
64458
- padding-left: 0.5rem;
64459
- }
64460
-
64461
- th:first-child {
64462
- padding-left: 0;
64463
- }
64464
-
64465
- th:last-child {
64466
- padding-right: 0;
64467
- }
64468
- }
64469
-
64470
- tbody {
64471
- td {
64472
- padding: 0.5rem;
64473
- }
64474
-
64475
- td:first-child {
64476
- padding-left: 0;
64477
- }
64478
-
64479
- td:last-child {
64480
- padding-right: 0;
64481
- }
64482
- }
64483
- }
64484
- `;
64485
- const CustomMarkdown = core$2.injectCss(_CustomMarkdown);
64322
+ const CustomMarkdown = core$2.injectCss(Markdown$1);
64486
64323
  function Markdown(props) {
64487
64324
  const [style2, css2] = core$2.useComponentStyles(props);
64488
64325
  const [markdown] = core$2.useVariable(props.markdown);
@@ -64490,7 +64327,16 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
64490
64327
  if (props.html_raw) {
64491
64328
  rehypePlugins.push(rehypeRaw);
64492
64329
  }
64493
- return /* @__PURE__ */ React__default.default.createElement(CustomMarkdown, { $rawCss: css2, className: props.className, style: style2 }, /* @__PURE__ */ React__default.default.createElement(Markdown$2, { rehypePlugins, remarkPlugins: [remarkGfm] }, markdown));
64330
+ return /* @__PURE__ */ React__default.default.createElement(
64331
+ CustomMarkdown,
64332
+ {
64333
+ $rawCss: css2,
64334
+ className: props.className,
64335
+ style: style2,
64336
+ markdown,
64337
+ rehypePlugins
64338
+ }
64339
+ );
64494
64340
  }
64495
64341
  const StyledModal = core$2.injectCss(Modal$1);
64496
64342
  function Modal(props) {
@@ -309868,25 +309714,31 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
309868
309714
  const [script, setScript] = core$2.useVariable(props.script);
309869
309715
  return /* @__PURE__ */ React__default.default.createElement(StyledCodeEditor, { $rawCss: css2, initialScript: script, onChange: setScript, style: style2 });
309870
309716
  }
309871
- const ChatWrapper = styled__default.default.div`
309717
+ const ThreadWrapper = styled__default.default.div`
309872
309718
  pointer-events: auto;
309873
309719
 
309874
309720
  position: fixed;
309875
- z-index: 999;
309876
309721
  right: 1rem;
309877
309722
  bottom: -0.1rem;
309723
+
309724
+ margin: 1rem;
309725
+
309726
+ border-radius: 0.4rem;
309878
309727
  `;
309879
309728
  const ChatButton = styled__default.default.button`
309880
- width: 3.5rem;
309881
- height: 3.5rem;
309882
- margin: 0 2rem 2rem 0;
309883
- padding-top: 0.5rem;
309729
+ position: absolute;
309730
+ right: 1rem;
309731
+ bottom: 1rem;
309732
+
309733
+ width: 2rem;
309734
+ height: 2rem;
309735
+ padding-top: 0.45rem;
309884
309736
 
309885
309737
  color: ${(props) => props.theme.colors.background};
309886
309738
 
309887
309739
  background-color: ${(props) => props.theme.colors.primary};
309888
309740
  border: none;
309889
- border-radius: 3rem;
309741
+ border-radius: 2rem;
309890
309742
 
309891
309743
  :hover {
309892
309744
  background-color: ${(props) => props.theme.colors.primaryHover};
@@ -309931,11 +309783,28 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
309931
309783
  console.error("Failed to send message notification:", error2);
309932
309784
  }
309933
309785
  }
309786
+ function checkMoreThanOneRenderedElement(selector2) {
309787
+ const elements = document.querySelectorAll(selector2);
309788
+ return elements.length > 1;
309789
+ }
309790
+ function getHighestZIndex(selector2) {
309791
+ const elements = document.querySelectorAll(selector2);
309792
+ let highest = 998;
309793
+ elements.forEach((element2) => {
309794
+ const zIndex = parseInt(window.getComputedStyle(element2).zIndex);
309795
+ if (zIndex > highest) {
309796
+ highest = zIndex;
309797
+ }
309798
+ });
309799
+ return highest;
309800
+ }
309934
309801
  function Chat(props) {
309935
309802
  var _a3;
309936
309803
  const [style2, css2] = core$2.useComponentStyles(props);
309937
309804
  const [value, setValue] = core$2.useVariable(props.value);
309938
309805
  const [showChat, setShowChat] = React__namespace.useState(false);
309806
+ const [areThereOtherChats, setAreThereOtherChats] = React__namespace.useState(false);
309807
+ const [zIndex, setZIndex] = React__namespace.useState(998);
309939
309808
  const user = core$2.useUser();
309940
309809
  const theme2 = useClTheme();
309941
309810
  const extras = core$2.useRequestExtras();
@@ -309953,18 +309822,36 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
309953
309822
  }
309954
309823
  setValue(newValue);
309955
309824
  };
309956
- return /* @__PURE__ */ React__namespace.createElement(ChatWrapper, null, showChat && /* @__PURE__ */ React__namespace.createElement(
309957
- StyledChat,
309825
+ const onClickChatButton = () => {
309826
+ setShowChat(true);
309827
+ setZIndex(getHighestZIndex(".chat-thread") + 1);
309828
+ setAreThereOtherChats(checkMoreThanOneRenderedElement(".chat-thread"));
309829
+ };
309830
+ React__namespace.useLayoutEffect(() => {
309831
+ setAreThereOtherChats(checkMoreThanOneRenderedElement(".chat-thread"));
309832
+ }, [showChat]);
309833
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, showChat && /* @__PURE__ */ React__namespace.createElement(
309834
+ ThreadWrapper,
309958
309835
  {
309959
- $rawCss: css2,
309960
- className: props.className,
309961
- onClose: () => setShowChat(false),
309962
- onUpdate,
309963
- style: style2,
309964
- value,
309965
- activeUser: parseUserData(userData)
309966
- }
309967
- ), !showChat && /* @__PURE__ */ React__namespace.createElement(ChatButton, { onClick: () => setShowChat(true) }, /* @__PURE__ */ React__namespace.createElement("svg", { fill: "none", height: "32", viewBox: "0 0 32 32", width: "32", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React__namespace.createElement("rect", { fill: "none", height: "24", rx: "3", width: "30", x: "1", y: "1.33594" }), /* @__PURE__ */ React__namespace.createElement(
309836
+ className: "chat-thread",
309837
+ style: {
309838
+ zIndex,
309839
+ backgroundColor: areThereOtherChats ? theme2.colors.background : "transparent"
309840
+ }
309841
+ },
309842
+ /* @__PURE__ */ React__namespace.createElement(
309843
+ StyledChat,
309844
+ {
309845
+ $rawCss: css2,
309846
+ className: props.className,
309847
+ onClose: () => setShowChat(false),
309848
+ onUpdate,
309849
+ style: { margin: 0, ...style2 },
309850
+ value,
309851
+ activeUser: parseUserData(userData)
309852
+ }
309853
+ )
309854
+ ), /* @__PURE__ */ React__namespace.createElement(ChatButton, { onClick: onClickChatButton }, /* @__PURE__ */ React__namespace.createElement("svg", { fill: "none", height: "32", viewBox: "0 0 52 52", width: "32", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React__namespace.createElement("rect", { fill: "none", height: "24", rx: "3", width: "30", x: "1", y: "1.33594" }), /* @__PURE__ */ React__namespace.createElement(
309968
309855
  "rect",
309969
309856
  {
309970
309857
  height: "24",
@@ -309975,31 +309862,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
309975
309862
  x: "1",
309976
309863
  y: "1.33594"
309977
309864
  }
309978
- ), /* @__PURE__ */ React__namespace.createElement(
309979
- "path",
309980
- {
309981
- d: "M8 8.33594H24",
309982
- stroke: theme2.colors.background,
309983
- strokeLinecap: "round",
309984
- strokeWidth: "2"
309985
- }
309986
- ), /* @__PURE__ */ React__namespace.createElement(
309987
- "path",
309988
- {
309989
- d: "M8 13.3359H24",
309990
- stroke: theme2.colors.background,
309991
- strokeLinecap: "round",
309992
- strokeWidth: "2"
309993
- }
309994
- ), /* @__PURE__ */ React__namespace.createElement(
309995
- "path",
309996
- {
309997
- d: "M8 18.3359H24",
309998
- stroke: theme2.colors.background,
309999
- strokeLinecap: "round",
310000
- strokeWidth: "2"
310001
- }
310002
- ), /* @__PURE__ */ React__namespace.createElement(
309865
+ ), /* @__PURE__ */ React__namespace.createElement("path", { d: "M8 8.33594H24", stroke: theme2.colors.background, strokeLinecap: "round", strokeWidth: "2" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M8 13.3359H24", stroke: theme2.colors.background, strokeLinecap: "round", strokeWidth: "2" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M8 18.3359H24", stroke: theme2.colors.background, strokeLinecap: "round", strokeWidth: "2" }), /* @__PURE__ */ React__namespace.createElement(
310003
309866
  "path",
310004
309867
  {
310005
309868
  d: "M18.5981 26.1641L16 30.6641L13.4019 26.1641L18.5981 26.1641Z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darajs/components",
3
- "version": "1.8.3",
3
+ "version": "1.8.5",
4
4
  "description": "Components for the Dara framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@bokeh/bokehjs": "~3.1.1",
57
- "@darajs/core": "1.8.3",
57
+ "@darajs/core": "1.8.5",
58
58
  "@darajs/styled-components": "~1.9.1",
59
59
  "@darajs/ui-causal-graph-editor": "~1.9.1",
60
60
  "@darajs/ui-code-editor": "~1.9.1",
@@ -72,12 +72,10 @@
72
72
  "prism-react-renderer": "^1.2.0",
73
73
  "react": "^18.2.0",
74
74
  "react-dom": "^18.2.0",
75
- "react-markdown": "^9.0.1",
76
75
  "react-plotly.js": "~2.6.0",
77
76
  "react-virtualized-auto-sizer": "1.0.6",
78
77
  "recoil": "^0.7.7",
79
- "rehype-raw": "^6.1.1",
80
- "remark-gfm": "^4.0.0"
78
+ "rehype-raw": "^6.1.1"
81
79
  },
82
80
  "files": [
83
81
  "dist"
@@ -85,5 +83,5 @@
85
83
  "publishConfig": {
86
84
  "access": "public"
87
85
  },
88
- "gitHead": "ffff2bfec38372833e56eea7d38b2b6c57a97de1"
86
+ "gitHead": "f4c1285e26248fd773de207552542e357fe66553"
89
87
  }