@salesforcedevs/docs-components 0.0.27-chat → 0.0.29-chat
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/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* Fixed positioned chat with full viewport height */
|
|
2
2
|
:host {
|
|
3
|
-
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
height: 100vh;
|
|
7
|
+
z-index: 100000;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Apply content shift to main page content when chat is open */
|
|
11
|
+
body.chat-open .content {
|
|
12
|
+
transform: translateX(-400px);
|
|
13
|
+
transition: transform 0.3s ease-in-out;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body.chat-closed .content {
|
|
17
|
+
transform: translateX(0);
|
|
18
|
+
transition: transform 0.3s ease-in-out;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Also shift the global header if it exists */
|
|
22
|
+
body.chat-open dx-global-header,
|
|
23
|
+
body.chat-open .global-header {
|
|
24
|
+
transform: translateX(-400px);
|
|
25
|
+
transition: transform 0.3s ease-in-out;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
body.chat-closed dx-global-header,
|
|
29
|
+
body.chat-closed .global-header {
|
|
30
|
+
transform: translateX(0);
|
|
31
|
+
transition: transform 0.3s ease-in-out;
|
|
4
32
|
}
|
|
5
33
|
|
|
6
34
|
/* Floating trigger button */
|
|
@@ -63,7 +91,7 @@
|
|
|
63
91
|
|
|
64
92
|
/* Chat container */
|
|
65
93
|
.chat-container {
|
|
66
|
-
height:
|
|
94
|
+
height: 100vh;
|
|
67
95
|
width: 400px;
|
|
68
96
|
background-color: #ffffff;
|
|
69
97
|
box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
|
|
@@ -56,6 +56,14 @@ export default class Chat extends LightningElement {
|
|
|
56
56
|
connectedCallback() {
|
|
57
57
|
// Add a welcome message
|
|
58
58
|
this.addMessage("Hello! How can I help you today?", "assistant");
|
|
59
|
+
|
|
60
|
+
// Ensure body has proper class state
|
|
61
|
+
this.updateBodyClass();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
disconnectedCallback() {
|
|
65
|
+
// Clean up body classes when component is destroyed
|
|
66
|
+
document.body.classList.remove('chat-open', 'chat-closed');
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
get chatContainerClass() {
|
|
@@ -109,6 +117,17 @@ export default class Chat extends LightningElement {
|
|
|
109
117
|
}, 0);
|
|
110
118
|
}
|
|
111
119
|
|
|
120
|
+
private updateBodyClass() {
|
|
121
|
+
// Update body classes to trigger content shift
|
|
122
|
+
if (this.isOpen) {
|
|
123
|
+
document.body.classList.remove('chat-closed');
|
|
124
|
+
document.body.classList.add('chat-open');
|
|
125
|
+
} else {
|
|
126
|
+
document.body.classList.remove('chat-open');
|
|
127
|
+
document.body.classList.add('chat-closed');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
112
131
|
handleInputChange(event: Event) {
|
|
113
132
|
const target = event.target as HTMLInputElement;
|
|
114
133
|
this.currentMessage = target.value;
|
|
@@ -178,6 +197,7 @@ export default class Chat extends LightningElement {
|
|
|
178
197
|
|
|
179
198
|
handleCloseClick() {
|
|
180
199
|
this.isOpen = false;
|
|
200
|
+
this.updateBodyClass();
|
|
181
201
|
|
|
182
202
|
// Dispatch custom event to notify parent components
|
|
183
203
|
this.dispatchEvent(new CustomEvent('chatclosed', {
|
|
@@ -187,6 +207,7 @@ export default class Chat extends LightningElement {
|
|
|
187
207
|
|
|
188
208
|
handleOpenClick() {
|
|
189
209
|
this.isOpen = true;
|
|
210
|
+
this.updateBodyClass();
|
|
190
211
|
|
|
191
212
|
// Dispatch custom event to notify parent components
|
|
192
213
|
this.dispatchEvent(new CustomEvent('chatopened', {
|
|
@@ -196,6 +217,7 @@ export default class Chat extends LightningElement {
|
|
|
196
217
|
|
|
197
218
|
openChat() {
|
|
198
219
|
this.isOpen = true;
|
|
220
|
+
this.updateBodyClass();
|
|
199
221
|
|
|
200
222
|
// Dispatch custom event to notify parent components
|
|
201
223
|
this.dispatchEvent(new CustomEvent('chatopened', {
|
|
@@ -205,6 +227,7 @@ export default class Chat extends LightningElement {
|
|
|
205
227
|
|
|
206
228
|
closeChat() {
|
|
207
229
|
this.isOpen = false;
|
|
230
|
+
this.updateBodyClass();
|
|
208
231
|
|
|
209
232
|
// Dispatch custom event to notify parent components
|
|
210
233
|
this.dispatchEvent(new CustomEvent('chatclosed', {
|
|
@@ -59,15 +59,17 @@
|
|
|
59
59
|
value={tocValue}
|
|
60
60
|
></dx-toc>
|
|
61
61
|
</div>
|
|
62
|
-
<doc-chat
|
|
63
|
-
title="Smart Agent"
|
|
64
|
-
placeholder="Type your message..."
|
|
65
|
-
assistant-name="Assistant"
|
|
66
|
-
></doc-chat>
|
|
67
62
|
</div>
|
|
68
63
|
<div lwc:if={showFooter} class="footer-container">
|
|
69
64
|
<dx-footer variant="no-signup"></dx-footer>
|
|
70
65
|
</div>
|
|
71
66
|
</div>
|
|
72
67
|
</div>
|
|
68
|
+
|
|
69
|
+
<!-- Fixed positioned chat component -->
|
|
70
|
+
<doc-chat
|
|
71
|
+
title="Smart Agent"
|
|
72
|
+
placeholder="Type your message..."
|
|
73
|
+
assistant-name="Assistant"
|
|
74
|
+
></doc-chat>
|
|
73
75
|
</template>
|