livechat 0.4.2 → 0.4.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/livechat/version.rb +1 -1
- data/lib/livechat/widget.js +68 -47
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d674110938432200c4426cfe1c4bb5c551759316ac2468406fa4aeb4dcbf5919
|
|
4
|
+
data.tar.gz: 5b68f89574ab49bc74b40697f37c05137f2e2082bd91fca3ec940c126977df0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f55e9b8235489c32e792dcd947195a2332fa402cb35ee2923f653d3fc318dfdf6370f8ebcf493c551ff267a8e1f8ecb48739e15c7d35df882b9c5c6d62fcb01a
|
|
7
|
+
data.tar.gz: 919af379b17dc1baaf24ad0997d8fa1a6dc6167baba7104178c0c6821ab970c0530a0ef53825ea1de773e974b28c15ce09ed732be026d1ee660272d751dd5c76
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
- Unified composer. The message box, attach button and send button are now one
|
|
6
|
+
bordered container (the textarea on top, a toolbar row with the tools on the
|
|
7
|
+
left and a circular send on the right) that lights up on focus — instead of a
|
|
8
|
+
textarea flanked by loose buttons. Reads as a single control, closer to what
|
|
9
|
+
people expect from a chat composer. Pending-file chips ride inside the box.
|
|
10
|
+
|
|
3
11
|
## 0.4.2
|
|
4
12
|
|
|
5
13
|
- Breathing room between the widget's pending-file chips and the composer —
|
data/lib/livechat/version.rb
CHANGED
data/lib/livechat/widget.js
CHANGED
|
@@ -245,9 +245,22 @@
|
|
|
245
245
|
emailRowEl = buildEmailRow();
|
|
246
246
|
panel.appendChild(emailRowEl);
|
|
247
247
|
|
|
248
|
+
// The composer is one bordered box: the textarea on top, a toolbar row
|
|
249
|
+
// (tools on the left, send on the right) below — so it reads as a single
|
|
250
|
+
// control, not a textarea flanked by loose buttons.
|
|
248
251
|
formEl = document.createElement("form");
|
|
249
252
|
formEl.id = "lvc-form";
|
|
253
|
+
|
|
254
|
+
// Pending-file chips sit at the top of the box, inside the border.
|
|
255
|
+
if (config.attachments) {
|
|
256
|
+
filesBarEl = document.createElement("div");
|
|
257
|
+
filesBarEl.id = "lvc-files";
|
|
258
|
+
filesBarEl.hidden = true;
|
|
259
|
+
formEl.appendChild(filesBarEl);
|
|
260
|
+
}
|
|
261
|
+
|
|
250
262
|
inputEl = document.createElement("textarea");
|
|
263
|
+
inputEl.id = "lvc-input";
|
|
251
264
|
inputEl.rows = 1;
|
|
252
265
|
inputEl.placeholder = config.labels.placeholder;
|
|
253
266
|
inputEl.setAttribute("aria-label", config.labels.placeholder);
|
|
@@ -258,32 +271,15 @@
|
|
|
258
271
|
send();
|
|
259
272
|
}
|
|
260
273
|
});
|
|
261
|
-
var sendButton = document.createElement("button");
|
|
262
|
-
sendButton.type = "submit";
|
|
263
|
-
sendButton.setAttribute("aria-label", config.labels.send);
|
|
264
|
-
sendButton.title = config.labels.send;
|
|
265
|
-
// Paper airplane (Heroicons, MIT). CSS mirrors it for RTL.
|
|
266
|
-
sendButton.innerHTML =
|
|
267
|
-
'<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">' +
|
|
268
|
-
'<path fill="currentColor" d="M3.478 2.404a.75.75 0 0 0-.926.941l2.432 ' +
|
|
269
|
-
"7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 " +
|
|
270
|
-
"60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 " +
|
|
271
|
-
'0 3.478 2.404Z"/></svg>';
|
|
272
274
|
formEl.appendChild(inputEl);
|
|
273
|
-
formEl.appendChild(sendButton);
|
|
274
|
-
formEl.addEventListener("submit", function (event) {
|
|
275
|
-
event.preventDefault();
|
|
276
|
-
send();
|
|
277
|
-
});
|
|
278
275
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
filesBarEl.id = "lvc-files";
|
|
284
|
-
filesBarEl.hidden = true;
|
|
285
|
-
panel.appendChild(filesBarEl);
|
|
276
|
+
var toolbar = document.createElement("div");
|
|
277
|
+
toolbar.id = "lvc-toolbar";
|
|
278
|
+
var tools = document.createElement("div");
|
|
279
|
+
tools.id = "lvc-tools";
|
|
286
280
|
|
|
281
|
+
// Attachments: a paperclip in the toolbar that opens the file picker.
|
|
282
|
+
if (config.attachments) {
|
|
287
283
|
fileInputEl = document.createElement("input");
|
|
288
284
|
fileInputEl.type = "file";
|
|
289
285
|
fileInputEl.multiple = true;
|
|
@@ -296,18 +292,40 @@
|
|
|
296
292
|
var attach = document.createElement("button");
|
|
297
293
|
attach.type = "button";
|
|
298
294
|
attach.id = "lvc-attach";
|
|
295
|
+
attach.className = "lvc-tool";
|
|
299
296
|
attach.setAttribute("aria-label", config.labels.attach);
|
|
300
297
|
attach.title = config.labels.attach;
|
|
301
298
|
// Paperclip (Heroicons, MIT).
|
|
302
299
|
attach.innerHTML =
|
|
303
|
-
'<svg viewBox="0 0 24 24" width="
|
|
300
|
+
'<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">' +
|
|
304
301
|
'<path fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" ' +
|
|
305
302
|
'stroke-linejoin="round" d="M18.4 8.6 9.9 17a3.5 3.5 0 0 1-5-5l8.5-8.4a2.3 2.3 0 0 1 ' +
|
|
306
303
|
'3.3 3.3l-8.5 8.4a1.1 1.1 0 0 1-1.6-1.6l7.8-7.8"/></svg>';
|
|
307
304
|
attach.addEventListener("click", function () { fileInputEl.click(); });
|
|
308
|
-
|
|
305
|
+
tools.appendChild(attach);
|
|
309
306
|
formEl.appendChild(fileInputEl);
|
|
310
307
|
}
|
|
308
|
+
toolbar.appendChild(tools);
|
|
309
|
+
|
|
310
|
+
var sendButton = document.createElement("button");
|
|
311
|
+
sendButton.type = "submit";
|
|
312
|
+
sendButton.id = "lvc-send";
|
|
313
|
+
sendButton.setAttribute("aria-label", config.labels.send);
|
|
314
|
+
sendButton.title = config.labels.send;
|
|
315
|
+
// Paper airplane (Heroicons, MIT). CSS mirrors it for RTL.
|
|
316
|
+
sendButton.innerHTML =
|
|
317
|
+
'<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">' +
|
|
318
|
+
'<path fill="currentColor" d="M3.478 2.404a.75.75 0 0 0-.926.941l2.432 ' +
|
|
319
|
+
"7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 " +
|
|
320
|
+
"60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 " +
|
|
321
|
+
'0 3.478 2.404Z"/></svg>';
|
|
322
|
+
toolbar.appendChild(sendButton);
|
|
323
|
+
|
|
324
|
+
formEl.appendChild(toolbar);
|
|
325
|
+
formEl.addEventListener("submit", function (event) {
|
|
326
|
+
event.preventDefault();
|
|
327
|
+
send();
|
|
328
|
+
});
|
|
311
329
|
|
|
312
330
|
panel.appendChild(formEl);
|
|
313
331
|
|
|
@@ -818,25 +836,28 @@
|
|
|
818
836
|
"background:var(--lvc-bg);color:var(--lvc-text);font:inherit}" +
|
|
819
837
|
"#lvc-email button{padding:6px 10px;border:1px solid var(--lvc-border);border-radius:8px;" +
|
|
820
838
|
"background:var(--lvc-surface);color:var(--lvc-text);font:inherit;cursor:pointer}" +
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
"
|
|
825
|
-
"
|
|
826
|
-
"#lvc-form
|
|
827
|
-
"
|
|
828
|
-
"
|
|
829
|
-
"#lvc-
|
|
830
|
-
"#lvc-
|
|
831
|
-
//
|
|
832
|
-
//
|
|
833
|
-
|
|
834
|
-
"
|
|
835
|
-
"
|
|
836
|
-
"
|
|
837
|
-
"
|
|
838
|
-
|
|
839
|
-
"#lvc-
|
|
839
|
+
// The composer is one bordered box (Intercom-style): textarea on top, a
|
|
840
|
+
// toolbar row below. focus-within lights the whole box, so it reads as a
|
|
841
|
+
// single control.
|
|
842
|
+
"#lvc-form{display:flex;flex-direction:column;gap:6px;margin:10px 12px;padding:8px 10px;" +
|
|
843
|
+
"border:1px solid var(--lvc-border);border-radius:16px;background:var(--lvc-bg)}" +
|
|
844
|
+
"#lvc-form:focus-within{border-color:var(--lvc-accent);box-shadow:0 0 0 1px var(--lvc-accent)}" +
|
|
845
|
+
"#lvc-root #lvc-input{border:none;background:none;resize:none;font:inherit;color:var(--lvc-text);" +
|
|
846
|
+
"padding:4px 4px 0;max-height:120px;outline:none}" +
|
|
847
|
+
"#lvc-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px}" +
|
|
848
|
+
"#lvc-tools{display:flex;align-items:center;gap:2px}" +
|
|
849
|
+
// Tool buttons (attach, and room for more) are quiet — the accent is the
|
|
850
|
+
// send button's alone.
|
|
851
|
+
"#lvc-root .lvc-tool{border:none;background:none;color:var(--lvc-muted);width:32px;height:32px;" +
|
|
852
|
+
"display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:8px;padding:0}" +
|
|
853
|
+
"#lvc-root .lvc-tool:hover{background:var(--lvc-border);color:var(--lvc-text)}" +
|
|
854
|
+
"#lvc-send{border:none;border-radius:50%;background:var(--lvc-accent);color:var(--lvc-accent-text);" +
|
|
855
|
+
"width:32px;height:32px;min-width:32px;display:flex;align-items:center;justify-content:center;" +
|
|
856
|
+
"cursor:pointer;padding:0}" +
|
|
857
|
+
"#lvc-send:disabled{opacity:.5;cursor:default}" +
|
|
858
|
+
"#lvc-root[dir=rtl] #lvc-send svg{transform:scaleX(-1)}" +
|
|
859
|
+
// Pending-file chips ride at the top of the composer box.
|
|
860
|
+
"#lvc-files{display:flex;flex-wrap:wrap;gap:6px;padding:2px 2px 0}" +
|
|
840
861
|
"#lvc-files[hidden]{display:none}" +
|
|
841
862
|
"#lvc-root .lvc-chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;" +
|
|
842
863
|
"padding:4px 6px 4px 10px;border:1px solid var(--lvc-border);border-radius:999px;" +
|
|
@@ -862,9 +883,9 @@
|
|
|
862
883
|
"{left:0;right:0;top:0;bottom:0;width:100%;max-width:100%;height:100dvh;max-height:100dvh;" +
|
|
863
884
|
"border-radius:0;border:none}" +
|
|
864
885
|
// 16px stops iOS Safari from zoom-jumping into focused fields.
|
|
865
|
-
"#lvc-root #lvc-
|
|
866
|
-
// Keep the composer above the iPhone home indicator.
|
|
867
|
-
"#lvc-root #lvc-form{
|
|
886
|
+
"#lvc-root #lvc-input,#lvc-root #lvc-email input{font-size:16px}" +
|
|
887
|
+
// Keep the composer box above the iPhone home indicator.
|
|
888
|
+
"#lvc-root #lvc-form{margin-bottom:calc(10px + env(safe-area-inset-bottom))}" +
|
|
868
889
|
"}" +
|
|
869
890
|
// Lives in host DOM (on data-livechat-open elements), so no #lvc-root prefix.
|
|
870
891
|
".lvc-opener-badge{display:inline-flex;min-width:18px;height:18px;padding:0 5px;" +
|