@meetelise/chat 1.20.98 → 1.20.99

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,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.20.98",
3
+ "version": "1.20.99",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -3073,7 +3073,8 @@ otherwise there's some empty space at the bottom of the button, which interferes
3073
3073
  }
3074
3074
 
3075
3075
  #footer {
3076
- height: 70px;
3076
+ min-height: 70px;
3077
+ max-height: 200px;
3077
3078
  width: 100%;
3078
3079
  background: black;
3079
3080
 
@@ -3086,8 +3087,13 @@ otherwise there's some empty space at the bottom of the button, which interferes
3086
3087
  z-index: 100001;
3087
3088
  }
3088
3089
  #message-input {
3089
- height: 40px;
3090
3090
  width: 100%;
3091
+ height: auto;
3092
+ max-height: 100%;
3093
+
3094
+ resize: none;
3095
+
3096
+ font-family: inherit;
3091
3097
  box-sizing: border-box;
3092
3098
  font-weight: 300;
3093
3099
  font-size: 14px;
@@ -3095,6 +3101,9 @@ otherwise there's some empty space at the bottom of the button, which interferes
3095
3101
  border: none;
3096
3102
  color: white;
3097
3103
  background: none;
3104
+
3105
+ padding-right: 6px; /* width of the scrollbar */
3106
+ box-sizing: border-box;
3098
3107
  z-index: 1000000000000000000000000001;
3099
3108
  }
3100
3109
  #message-input:focus {
@@ -3200,7 +3209,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3200
3209
  </div>
3201
3210
  </div>
3202
3211
  </a></div> `}))}
3203
- </div>`:B``}};kr.styles=[Mr],Dr([de({attribute:!0})],kr.prototype,"message",void 0),Dr([de({attribute:!0})],kr.prototype,"myPubnub",void 0),Dr([de({attribute:!0})],kr.prototype,"onMount",void 0),Dr([ce()],kr.prototype,"loadingPreviews",void 0),Dr([ce()],kr.prototype,"parsedMessage",void 0),Dr([ce()],kr.prototype,"websitePreviewInfo",void 0),kr=Dr([ue("pubnub-message")],kr);var Ur=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let qr=class extends ae{constructor(){super(...arguments),this.brandColor=yi,this.onClickExit=()=>({}),this.onMount=()=>({}),this.messages=[],this.isMobile=!1,this.isLoadingMessages=!1,this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})}}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom()}render(){return this.buildingSlug&&this.building?B`
3212
+ </div>`:B``}};kr.styles=[Mr],Dr([de({attribute:!0})],kr.prototype,"message",void 0),Dr([de({attribute:!0})],kr.prototype,"myPubnub",void 0),Dr([de({attribute:!0})],kr.prototype,"onMount",void 0),Dr([ce()],kr.prototype,"loadingPreviews",void 0),Dr([ce()],kr.prototype,"parsedMessage",void 0),Dr([ce()],kr.prototype,"websitePreviewInfo",void 0),kr=Dr([ue("pubnub-message")],kr);var Ur=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let qr=class extends ae{constructor(){super(...arguments),this.brandColor=yi,this.onClickExit=()=>({}),this.onMount=()=>({}),this.messages=[],this.isMobile=!1,this.isLoadingMessages=!1,this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"}}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom()}render(){return this.buildingSlug&&this.building?B`
3204
3213
  <div
3205
3214
  id="pubnub-chat-container"
3206
3215
  class=${ge({"pubnub-container__mobile":this.isMobile,"pubnub-container__desktop":!this.isMobile})}
@@ -3256,11 +3265,13 @@ otherwise there's some empty space at the bottom of the button, which interferes
3256
3265
  </ul>
3257
3266
  </div>
3258
3267
  <div id="footer">
3259
- <input
3268
+ <textarea
3260
3269
  id="message-input"
3261
3270
  placeholder="Ask a question..."
3262
- @keydown=${e=>{"Enter"===e.key&&this.sendMessage(this.messageInput.value)}}
3263
- />
3271
+ @keydown=${e=>{"Enter"===e.key&&(e.preventDefault(),this.sendMessage(this.messageInput.value))}}
3272
+ @input=${()=>this.autoResizeMessageInput()}
3273
+ rows="1"
3274
+ ></textarea>
3264
3275
  <button
3265
3276
  id="send-message-bttn"
3266
3277
  @click=${()=>this.sendMessage(this.messageInput.value)}
@@ -168,7 +168,8 @@ export const pubnubChatStyles = css`
168
168
  }
169
169
 
170
170
  #footer {
171
- height: 70px;
171
+ min-height: 70px;
172
+ max-height: 200px;
172
173
  width: 100%;
173
174
  background: black;
174
175
 
@@ -181,8 +182,13 @@ export const pubnubChatStyles = css`
181
182
  z-index: 100001;
182
183
  }
183
184
  #message-input {
184
- height: 40px;
185
185
  width: 100%;
186
+ height: auto;
187
+ max-height: 100%;
188
+
189
+ resize: none;
190
+
191
+ font-family: inherit;
186
192
  box-sizing: border-box;
187
193
  font-weight: 300;
188
194
  font-size: 14px;
@@ -190,6 +196,9 @@ export const pubnubChatStyles = css`
190
196
  border: none;
191
197
  color: white;
192
198
  background: none;
199
+
200
+ padding-right: 6px; /* width of the scrollbar */
201
+ box-sizing: border-box;
193
202
  z-index: 1000000000000000000000000001;
194
203
  }
195
204
  #message-input:focus {
@@ -36,7 +36,7 @@ export class PubnubChat extends LitElement {
36
36
  onMount: () => void = () => ({});
37
37
 
38
38
  @query("#message-input", true)
39
- messageInput!: HTMLInputElement;
39
+ messageInput!: HTMLTextAreaElement;
40
40
 
41
41
  @query("#conversation-body", true)
42
42
  messageBody!: HTMLDivElement;
@@ -63,6 +63,7 @@ export class PubnubChat extends LitElement {
63
63
 
64
64
  sendMessage = async (message: string): Promise<void> => {
65
65
  this.messageInput.value = "";
66
+ this.autoResizeMessageInput();
66
67
  await this.myPubnub?.sendMessage(message);
67
68
  };
68
69
  firstUpdated(): void {
@@ -87,6 +88,11 @@ export class PubnubChat extends LitElement {
87
88
  this.scrollToChatBottom();
88
89
  }
89
90
 
91
+ autoResizeMessageInput = (): void => {
92
+ this.messageInput.style.height = "auto";
93
+ this.messageInput.style.height = this.messageInput.scrollHeight + "px";
94
+ };
95
+
90
96
  render(): TemplateResult {
91
97
  if (!this.buildingSlug || !this.building) {
92
98
  return html``; // error here
@@ -167,13 +173,18 @@ export class PubnubChat extends LitElement {
167
173
  </ul>
168
174
  </div>
169
175
  <div id="footer">
170
- <input
176
+ <textarea
171
177
  id="message-input"
172
178
  placeholder="Ask a question..."
173
179
  @keydown=${(e: KeyboardEvent) => {
174
- if (e.key === "Enter") this.sendMessage(this.messageInput.value);
180
+ if (e.key === "Enter") {
181
+ e.preventDefault();
182
+ this.sendMessage(this.messageInput.value);
183
+ }
175
184
  }}
176
- />
185
+ @input=${() => this.autoResizeMessageInput()}
186
+ rows="1"
187
+ ></textarea>
177
188
  <button
178
189
  id="send-message-bttn"
179
190
  @click=${() => this.sendMessage(this.messageInput.value)}