@gemboss/ui 0.42.0 → 0.43.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.
- package/CHANGELOG.md +78 -0
- package/README.md +113 -7
- package/catalog/editor.html +1 -1
- package/catalog/index.html +147 -51
- package/gemboss-ui.css +3 -3
- package/package.json +6 -1
- package/parts/components.css +1 -1
- package/parts/core.css +2 -2
- package/parts/shell.css +1 -1
- package/src/assistant/engine.tsx +3 -2
- package/src/assistant.css +1 -1
- package/src/briefing-card.css +1 -0
- package/src/briefing-card.tsx +50 -0
- package/src/editor.css +1 -1
- package/src/gemboss-tokens.css +1 -1
- package/src/icons.tsx +2 -0
- package/src/index.ts +8 -2
- package/src/progress-ring.css +1 -0
- package/src/progress-ring.tsx +65 -0
- package/src/question-card.css +1 -0
- package/src/question-card.tsx +116 -0
- package/src/range-bar.css +1 -0
- package/src/range-bar.tsx +102 -0
- package/src/reactions.tsx +32 -6
- package/src/spot-art.css +1 -0
- package/src/spot-art.tsx +130 -0
- package/src/team-chat-plain.js +1 -1
- package/src/team-chat.css +1 -1
- package/src/team-chat.tsx +106 -9
- package/src/theme-dark.css +1 -1
package/src/team-chat-plain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(v){"use strict";var j=v.gembossUI||(v.gembossUI={});if(j.teamChat)return;var H={reaction:'<path d="M16.5 10a6.5 6.5 0 1 1-6.5-6.5"/><path d="M7.5 11.8s.9 1.2 2.5 1.2 2.5-1.2 2.5-1.2"/><path d="M7.8 8.2h.01M12.2 8.2h.01"/><path d="M15 2.5v4M13 4.5h4"/>',reply:'<path d="M8 13.5 3.5 9 8 4.5M3.5 9h8a5 5 0 0 1 5 5v2"/>',thread:'<path d="M3 4.5h14v9H8.5L5 16.5v-3H3z"/><path d="M6.5 8h7M6.5 10.5h4.5"/>',chevronsDown:'<path d="M6 5.5l4 4 4-4M6 10.5l4 4 4-4"/>',hash:'<path d="M8 3.5 6.5 16.5M13.5 3.5 12 16.5M4 7.5h12.5M3.5 12.5H16"/>',lock:'<rect x="4.5" y="9" width="11" height="8" rx="1.5"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/>',user:'<circle cx="10" cy="7" r="3.2"/><path d="M3.8 16.5c.8-2.8 3.3-4.5 6.2-4.5s5.4 1.7 6.2 4.5"/>',more:'<circle cx="4.5" cy="10" r="1"/><circle cx="10" cy="10" r="1"/><circle cx="15.5" cy="10" r="1"/>'},W=["\u{1F44D}","\u2705"],Y=["\u{1F44D}","\u2705","\u{1F64F}","\u{1F389}","\u{1F602}","\u2764\uFE0F","\u{1F440}","\u{1F64C}","\u{1F525}"],D=[["Smileys",[["\u{1F600}","grin smile happy"],["\u{1F603}","smile happy"],["\u{1F604}","smile laugh happy"],["\u{1F601}","grin beam"],["\u{1F606}","laugh squint"],["\u{1F605}","sweat smile relief"],["\u{1F602}","joy tears laugh lol"],["\u{1F923}","rofl rolling laugh"],["\u{1F60A}","blush smile"],["\u{1F607}","innocent halo"],["\u{1F642}","slight smile ok"],["\u{1F609}","wink"],["\u{1F60D}","heart eyes love"],["\u{1F970}","love hearts"],["\u{1F618}","kiss"],["\u{1F60B}","yum tasty"],["\u{1F61C}","wink tongue"],["\u{1F92A}","zany crazy"],["\u{1F917}","hug"],["\u{1F92D}","oops giggle"],["\u{1F914}","think hmm"],["\u{1F928}","raised eyebrow doubt"],["\u{1F610}","neutral"],["\u{1F636}","no words"],["\u{1F644}","eye roll"],["\u{1F60F}","smirk"],["\u{1F62C}","grimace awkward"],["\u{1F60C}","relieved"],["\u{1F634}","sleep tired"],["\u{1F637}","mask sick"],["\u{1F92F}","mind blown"],["\u{1F973}","party celebrate"],["\u{1F60E}","cool sunglasses"],["\u{1F913}","nerd"],["\u{1F615}","confused"],["\u{1F61F}","worried"],["\u{1F62E}","wow surprised"],["\u{1F632}","astonished"],["\u{1F633}","flushed embarrassed"],["\u{1F97A}","pleading please"],["\u{1F622}","cry sad"],["\u{1F62D}","sob crying"],["\u{1F631}","scream shock"],["\u{1F624}","huff frustrated"],["\u{1F621}","angry mad"],["\u{1F92C}","swear"],["\u{1F480}","dead skull"],["\u{1FAE0}","melting"],["\u{1FAE1}","salute"]]],["Hands",[["\u{1F44D}","like thumbs up yes ok"],["\u{1F44E}","dislike thumbs down no"],["\u{1F44C}","ok perfect"],["\u270C\uFE0F","peace victory"],["\u{1F91E}","fingers crossed luck"],["\u{1F91F}","love you"],["\u{1F918}","rock"],["\u{1F44F}","clap applause"],["\u{1F64C}","raise hands hooray"],["\u{1F450}","open hands"],["\u{1F91D}","handshake deal"],["\u{1F64F}","thanks please pray"],["\u{1F4AA}","strong muscle"],["\u{1F440}","eyes looking"],["\u{1FAF6}","heart hands"],["\u270D\uFE0F","writing"],["\u{1F44B}","wave hi bye"],["\u261D\uFE0F","point up"],["\u{1F447}","point down"],["\u{1F449}","point right"],["\u{1F448}","point left"],["\u{1F919}","call me"],["\u{1F590}\uFE0F","stop hand"],["\u{1F90C}","pinched"]]],["Marks",[["\u2764\uFE0F","heart love red"],["\u{1F9E1}","orange heart"],["\u{1F49B}","yellow heart"],["\u{1F49A}","green heart"],["\u{1F499}","blue heart"],["\u{1F49C}","purple heart"],["\u{1F5A4}","black heart"],["\u{1F4AF}","hundred perfect"],["\u2705","done check yes"],["\u2611\uFE0F","checked box"],["\u2714\uFE0F","check mark"],["\u274C","no cross wrong"],["\u2757","important exclamation"],["\u2753","question"],["\u26A0\uFE0F","warning"],["\u{1F525}","fire hot lit"],["\u2B50","star"],["\u2728","sparkles new"],["\u{1F4A1}","idea"],["\u{1F4CC}","pin"],["\u{1F680}","rocket ship launch"],["\u{1F3AF}","target goal"],["\u{1F197}","ok button"],["\u{1F195}","new"],["\u{1F534}","red circle urgent"],["\u{1F7E2}","green circle"],["\u{1F7E1}","yellow circle"],["\u2795","plus one add"]]],["Work",[["\u{1F389}","party tada celebrate"],["\u{1F38A}","confetti"],["\u{1F3C6}","trophy win"],["\u{1F947}","gold medal first"],["\u{1F381}","gift"],["\u2615","coffee"],["\u{1F37B}","cheers beer"],["\u{1F355}","pizza"],["\u{1F4C8}","chart up growth"],["\u{1F4C9}","chart down"],["\u{1F4B0}","money"],["\u{1F6D2}","cart shop"],["\u{1F4E6}","package order shipping"],["\u{1F9FE}","receipt invoice"],["\u{1F4DD}","note memo"],["\u{1F4C5}","calendar date"],["\u23F0","alarm time"],["\u23F3","waiting hourglass"],["\u{1F527}","fix wrench"],["\u{1F41B}","bug"],["\u{1F9EA}","test"],["\u{1F50D}","search look"],["\u{1F4AC}","comment chat"],["\u{1F4DE}","call phone"],["\u{1F4E7}","email"],["\u{1F512}","lock private"],["\u{1F517}","link"],["\u{1F5BC}\uFE0F","image picture"],["\u{1F4BB}","laptop computer"],["\u{1F4F1}","phone mobile"],["\u{1F648}","see no evil oops"],["\u{1F649}","hear no evil"],["\u{1F916}","robot bot ai"],["\u{1F9E0}","brain"],["\u{1F451}","crown vip"],["\u{1F48E}","gem diamond"]]]],R={channels:"Channels",conversation:"Conversation",back:"Back to channels",members:"Members",hideMembers:"Hide members",showMembers:"Show members",thread:"Thread",closeThread:"Close thread",replies:function(e){return e===1?"1 reply":e+" replies"},newMessages:"New messages",edited:"(edited)",someone:"Someone who has left",actionsFor:function(e){return"Actions for the message from "+e},react:function(e,t,n){return(n?"Remove":"Add")+" "+e+" on the message from "+t},moreReactions:function(e){return"More reactions for the message from "+e},reply:"Reply",replyTo:function(e){return"Reply to the message from "+e},replyInThread:"Reply in thread",replyInThreadTo:function(e){return"Reply in thread to the message from "+e},openThread:function(e,t){return"Open the thread, "+(e===1?"1 reply":e+" replies")+(t?", "+t:"")},jump:"Jump to the latest message",jumpNew:function(e){return"Jump to the latest message, "+e+" new"},message:"Message",send:"Send",attach:"Attach a file",stopReplying:"Stop replying",privateChannel:"private channel",directMessage:"direct message",mentioningYou:function(e){return e+" mentioning you"},unread:function(e){return e+" unread"},online:"Online",away:"Away",offline:"Offline"},E=Object.prototype.hasOwnProperty;function S(e){if(!e)return R;var t={},n;for(n in R)t[n]=R[n];for(n in e)E.call(e,n)&&(t[n]=e[n]);return t}var L=function(e){return typeof Node<"u"&&e instanceof Node},C=function(){return[].filter.call(arguments,Boolean).join(" ")};function i(e,t,n){var a=document.createElement(e),r;for(r in t)t[r]!==void 0&&t[r]!==null&&t[r]!==!1&&a.setAttribute(r,String(t[r]));return A(a,n)}function A(e,t){if(t==null||typeof t=="boolean"||t==="")return e;if(Array.isArray(t)){for(var n=0;n<t.length;n++)A(e,t[n]);return e}return e.appendChild(L(t)?t:document.createTextNode(String(t))),e}var ue=function(e){return e==null?void 0:String(e)},m=function(e,t){return t&&e.addEventListener("click",t),e},G=0;function _(e,t){var n=Number(t)||20,a=document.createElement("template");return a.innerHTML='<svg viewBox="0 0 20 20" width="'+n+'" height="'+n+'" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'+(E.call(H,e)?H[e]:"")+"</g></svg>",a.content.firstChild}function x(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg",e);for(var a in t)n.setAttribute(a,t[a]);return n}var de=function(){try{return new RegExp("^\\p{L}","u")}catch{return/^[A-Za-zÀ-ɏͰ-ϿЀ-ӿ]/}}();function z(e){var t=String(e).trim().split(/\s+/).filter(Boolean),n=t.filter(function(r){return de.test(r)}),a=n.length?n:t;return a.length?(a.length===1?a[0].slice(0,2):a[0][0]+a[a.length-1][0]).toUpperCase():"?"}function V(e){var t=0,n=String(e),a,r,l;for(a=0;a<n.length;a++)r=n.charCodeAt(a),r>=55296&&r<=56319&&a+1<n.length&&(l=n.charCodeAt(a+1),l>=56320&&l<=57343&&(r=(r-55296)*1024+(l-56320)+65536,a++)),t=t*31+r>>>0;return t%8}var pe={24:"gb-avatar--24",32:"gb-avatar--32",40:"gb-avatar--40",56:"gb-avatar--56"};function I(e,t,n,a){return n=n===void 0?24:n,i("span",{class:C("gb-avatar",pe[n],a),"data-tone":V(e),"aria-hidden":"true"},t?i("img",{class:"gb-avatar-img",src:t,alt:"",loading:"lazy",width:n,height:n}):z(e))}var T={},P=[];D.forEach(function(e){e[1].forEach(function(t){T[t[0]]=t[1],P.push(t[0])})});var Q=function(e){return typeof e=="string"&&E.call(T,e)},O=function(e){return E.call(T,e)?T[e]:""};function X(e){var t=String(e).trim().toLowerCase();return t?P.filter(function(n){return T[n].indexOf(t)>-1}):P.slice()}function Z(e){return e.length>2?e.slice(0,2).join(", ")+" +"+(e.length-2):e.join(", ")}var $="gemboss-ui:reactions-recent",U=9;function ee(e){var t=[];return e.concat(Y).forEach(function(n){Q(n)&&t.indexOf(n)<0&&t.length<U&&t.push(n)}),t}function te(){try{var e=JSON.parse(v.localStorage&&v.localStorage.getItem($)||"[]");return Array.isArray(e)?e.filter(function(t){return typeof t=="string"&&O(t)!==""}).slice(0,U):[]}catch{return[]}}function fe(e){try{var t=[e].concat(te().filter(function(n){return n!==e})).slice(0,U);v.localStorage&&v.localStorage.setItem($,JSON.stringify(t))}catch{}}var q=function(e,t){return e.some(function(n){return n.emoji===t&&n.mine})};function B(e){var t=e.items||[],n=ee(te()),a=function(c){var d=q(t,c);return m(i("button",{type:"button",class:"ui-reaction-picker__btn",title:O(c).split(" ")[0]||c,"aria-label":((d?"Remove":"Add")+" "+c+" "+O(c)).trim(),"aria-pressed":String(d)},c),function(){e.onPick(c)})},r=function(c){return i("div",{class:"ui-reaction-picker__grid"},c.map(a))},l=function(c){return i("p",{class:"ui-reaction-picker__head"},c)},u=i("input",{type:"search",class:"gemboss-field ui-reaction-picker__search",placeholder:"Search emoji","aria-label":"Search emoji",autocomplete:"off",value:""}),o=i("div",{class:"ui-reaction-picker__body"}),g=function(){var c=u.value,d=c.trim()?X(c):null,s=[];d?s.push(d.length?r(d):i("p",{class:"ui-reaction-picker__empty"},"No emoji matches.")):(s.push(l("Frequently used"),r(n)),D.forEach(function(b){s.push(l(b[0]),r(b[1].map(function(y){return y[0]})))})),o.replaceChildren.apply(o,s)},h=i("div",{id:e.id,class:"ui-reaction-picker",role:"group","aria-label":"Pick a reaction"},[u,o]);return u.addEventListener("input",g),h.addEventListener("keydown",function(c){if(c.key==="Escape"){c.preventDefault(),c.stopPropagation(),e.onClose();return}var d=[].slice.call(o.querySelectorAll(".ui-reaction-picker__btn"));if(c.target===u){c.key==="Enter"&&(c.preventDefault(),d[0]&&d[0].click()),c.key==="ArrowDown"&&(c.preventDefault(),d[0]&&d[0].focus());return}var s=d.indexOf(document.activeElement);if(!(s<0)){var b=o.querySelector(".ui-reaction-picker__grid"),y=Math.max(1,Math.round((b?b.getBoundingClientRect().width:44)/44)),p={ArrowRight:1,ArrowLeft:-1,ArrowDown:y,ArrowUp:-y}[c.key];if(p){if(c.preventDefault(),s+p<0){u.focus();return}d[Math.min(d.length-1,s+p)]&&d[Math.min(d.length-1,s+p)].focus()}}}),g(),h}function ne(e){var t=e.items||[],n=e.target===void 0?"this":e.target,a=e.canReact===void 0?!0:e.canReact;if(!t.length&&!a)return null;var r=!1,l=null,u="gb-tc-rp"+ ++G,o=null,g=function(s){if(!a){e.onSignIn&&e.onSignIn();return}q(t,s)||fe(s),e.onToggle&&e.onToggle(s)},h=i("div",{class:"ui-reactions__row"},t.map(function(s){return m(i("button",{type:"button",class:"ui-reaction"+(s.mine?" is-mine":""),"aria-pressed":ue(s.mine),title:s.names.join(", "),"aria-label":s.emoji+", "+s.names.join(", ")+". "+(s.mine?"Remove yours":"Add yours")},[i("span",{class:"ui-reaction__emoji"},s.emoji),i("span",{class:"ui-reaction__names"},Z(s.names))]),function(){g(s.emoji)})})),c=i("div",{class:C("ui-reactions",e.className)},h),d=function(s,b){r=s,o.setAttribute("aria-expanded",String(r)),r?(o.setAttribute("aria-controls",u),l=B({id:u,items:t,onPick:function(y){d(!1,!0),g(y),o.focus()},onClose:function(){d(!1,!0),o.focus()}}),c.appendChild(l),b&&l.firstChild.focus()):(o.removeAttribute("aria-controls"),l&&l.remove(),l=null),b&&e.onOpenChange&&e.onOpenChange(r)};return a&&(o=i("button",{type:"button",class:"ui-reaction-add",title:"Add reaction","aria-label":"Add a reaction to "+n,"aria-expanded":"false"},_("reaction",18)),h.appendChild(m(o,function(){d(!r,!0)})),e.open&&d(!0,!1)),c}function he(e){var t=e.read,n=e.of;if(n<=0)return null;var a=t>=n,r=Math.min(t,n)/n*Math.PI*2,l=x("svg",{viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":"true",focusable:"false"});return l.appendChild(x("circle",{cx:"7",cy:"7",r:"6",fill:a?"currentColor":"none",stroke:"currentColor","stroke-width":"1.4"})),a?l.appendChild(x("path",{class:"gb-tc-receipt__tick",d:"M4.2 7.2l1.9 1.9 3.7-4",fill:"none","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"})):t>0&&l.appendChild(x("path",{d:"M7 7 L7 1 A6 6 0 "+(r>Math.PI?1:0)+" 1 "+(7+6*Math.sin(r)).toFixed(2)+" "+(7-6*Math.cos(r)).toFixed(2)+" Z",fill:"currentColor"})),i("span",{class:C("gb-tc-receipt",a&&"gb-tc-receipt--all"),role:"img","aria-label":e.label,title:e.label},l)}function ge(e){var t={ArrowRight:1,ArrowLeft:-1}[e.key],n=[].slice.call(e.currentTarget.querySelectorAll("button:not([disabled]), summary, a[href]")).filter(function(l){return l.offsetParent!==null}),a=n.indexOf(document.activeElement);if(!(a<0)){var r=t?n[(a+t+n.length)%n.length]:e.key==="Home"?n[0]:e.key==="End"?n[n.length-1]:null;r&&(e.preventDefault(),r.focus())}}function me(e){var t=S(e.labels),n=e.author||t.someone,a=e.reactions||[],r=e.editor!=null,l=!!(e.picking&&e.onReact),u=null,o=null,g=!1,h=function(){var f=e.time;return L(f)&&g?f.cloneNode(!0):(g=!0,f)},c=function(){return C("gb-tc-msg",e.grouped&&"gb-tc-msg--grouped",e.mentionsMe&&"gb-tc-msg--mention",e.highlight&&"gb-tc-msg--highlight",e.sending&&"gb-tc-msg--sending",e.failed&&"gb-tc-msg--failed",l&&"gb-tc-msg--active",r&&"gb-tc-msg--editing",e.className)},d=i("li",{id:e.id,class:c(),"data-msg-id":e.messageId,tabindex:"-1"},e.grouped?i("time",{class:"gb-tc-msg__hover-time",datetime:e.dateTime},h()):e.avatar!=null?e.avatar:I(n,e.avatarSrc,32,"gb-tc-msg__av")),s=i("div",{class:"gb-tc-msg__main"});e.replyTo&&s.appendChild(m(i("button",{type:"button",class:"gb-tc-quote","aria-busy":e.replyTo.busy||void 0},[i("span",{class:"gb-tc-quote__who"},e.replyTo.author||t.someone),i("span",{class:"gb-tc-quote__text"},e.replyTo.excerpt)]),e.replyTo.onOpen)),s.appendChild(e.grouped?i("span",{class:"gb-tc-sr"},[n,", ",h(),": "]):i("div",{class:"gb-tc-msg__who"},[i("span",{class:"gb-tc-msg__name"},n),e.badges,i("time",{class:"gb-tc-msg__time",datetime:e.dateTime},h())])),r?s.appendChild(i("div",{class:"gb-tc-msg__editor"},e.editor)):(e.body!=null||e.edited||e.receipt)&&s.appendChild(i("div",{class:"gb-tc-msg__body"},[e.body,e.edited?i("span",{class:"gb-tc-msg__edited"},t.edited):null,e.receipt])),e.status&&s.appendChild(i("p",{class:"gb-tc-msg__status",role:e.failed?"alert":void 0},e.status)),e.attachments&&s.appendChild(i("div",{class:"gb-tc-msg__files"},e.attachments)),e.extra&&s.appendChild(i("div",{class:"gb-tc-msg__extra"},e.extra));var b=function(f,w){e.onPickingChange&&e.onPickingChange(f,w)},y=a.length?ne({items:a,onToggle:e.onReact,canReact:!!e.onReact,target:"the message from "+n,open:e.reactionsPicking,onOpenChange:function(f){b("reactions",f)}}):null,p=e.thread,K=null;p&&p.count>0&&(K=m(i("button",{type:"button",class:"gb-tc-threadprev","aria-label":t.openThread(p.count,p.last==null?"":p.last)},[p.repliers&&p.repliers.length?i("span",{class:"gb-tc-threadprev__faces","aria-hidden":"true"},p.repliers.slice(0,3).map(function(f){return I(f.name,f.src,24)})):null,i("span",{class:"gb-tc-threadprev__count"},t.replies(p.count)),p.last?i("span",{class:"gb-tc-threadprev__last"},p.last):null]),p.onOpen)),A(s,[y,K]),d.appendChild(s);var N=function(f,w){l=f,d.className=c(),o&&o.setAttribute("aria-expanded",String(l)),l?(u=B({items:a,onPick:function(Me){N(!1,!0),e.onReact(Me),o.focus()},onClose:function(){N(!1,!0),o.focus()}}),s.insertBefore(u,y||K),w&&u.firstChild.focus()):u&&(u.remove(),u=null),w&&b("bar",l)};if(!r&&!e.sending&&(e.onReact||e.onReply||e.onOpenThread||e.moreActions)){var k=i("div",{class:"gb-tc-acts",role:"toolbar","aria-label":t.actionsFor(n)});e.onReact&&(W.forEach(function(f){var w=q(a,f);k.appendChild(m(i("button",{type:"button",class:"gb-tc-act gb-tc-act--quick","aria-pressed":String(w),"aria-label":t.react(f,n,w)},f),function(){e.onReact(f)}))}),o=i("button",{type:"button",class:"gb-tc-act","aria-expanded":String(l),"aria-label":t.moreReactions(n),title:"Add reaction"},_("reaction",18)),k.appendChild(m(o,function(){N(!l,!0)}))),e.onReply&&k.appendChild(m(i("button",{type:"button",class:"gb-tc-act","aria-label":t.replyTo(n),title:t.reply},_("reply",18)),e.onReply)),e.onOpenThread&&k.appendChild(m(i("button",{type:"button",class:"gb-tc-act","aria-label":t.replyInThreadTo(n),title:t.replyInThread},_("thread",18)),e.onOpenThread)),A(k,e.moreActions),k.addEventListener("keydown",ge),d.appendChild(k)}return l&&N(!0,!1),d}function be(e,t){return i("li",{class:"gb-tc-day"},t?i("time",{class:"gb-tc-day__label",datetime:t},e):i("span",{class:"gb-tc-day__label"},e))}function ve(e){var t=S(e);return i("li",{class:"gb-tc-new"},i("span",{class:"gb-tc-new__label",role:"separator","aria-label":t.newMessages},t.newMessages))}function ye(e){return e=e||{},ae(m(i("button",{type:"button",class:"gb-tc-jump"},_("chevronsDown",20)),e.onJump),e)}function ae(e,t){t=t||{};var n=S(t.labels),a=t.count===void 0?0:t.count,r=e.querySelector(".gb-tc-jump__n");return t.visible===void 0||t.visible?e.removeAttribute("hidden"):e.setAttribute("hidden",""),e.setAttribute("aria-label",a?n.jumpNew(a):n.jump),a?(r||(r=e.appendChild(i("span",{class:"gb-tc-jump__n","aria-hidden":"true"}))),r.textContent=a>99?"99+":String(a),e):(r&&r.remove(),e)}var _e={channel:"hash",private:"lock",dm:"user"},re={online:"gb-tc-presence gb-tc-presence--online",away:"gb-tc-presence gb-tc-presence--away",offline:"gb-tc-presence gb-tc-presence--offline"};function ie(e){var t=S(e.labels),n=e.kind===void 0?"channel":e.kind,a=e.unread===void 0?0:e.unread,r=e.mentions===void 0?0:e.mentions,l=[e.name,n==="private"?t.privateChannel:n==="dm"?t.directMessage:null,r?t.mentioningYou(r):null,a?t.unread(a):null].filter(Boolean).join(", "),u=[i("span",{class:"gb-tc-channel__glyph","aria-hidden":"true"},[_(_e[n],16),n==="dm"&&e.online!==void 0?i("span",{class:re[e.online?"online":"offline"]}):null]),i("span",{class:"gb-tc-channel__name"},e.name),r?i("span",{class:"gb-tc-badge gb-tc-badge--mention","aria-hidden":"true"},"@"+r):null,a?i("span",{class:"gb-tc-badge","aria-hidden":"true"},a):null],o=C("gb-tc-channel",a>0&&"gb-tc-channel--unread");return i("li",null,m(e.href!==void 0?i("a",{class:o,href:e.href,"aria-current":e.active?"page":void 0,"aria-label":l},u):i("button",{type:"button",class:o,"aria-current":e.active?"true":void 0,"aria-label":l},u),e.onOpen))}function le(e,t,n,a){var r=(e.id==null?"gb-tc-s"+ ++G:e.id)+"-h";return i("div",{class:t[0],role:"group","aria-labelledby":r},[i("h3",{class:t[1],id:r},n),i("ul",{class:t[2]},(e.items||[]).map(function(l){return l&&!L(l)?a(l):l}))])}function ke(e){return le(e,["gb-tc-rail__section","gb-tc-rail__heading","gb-tc-rail__list"],e.label,ie)}function we(e){return le(e,["gb-tc-people__section","gb-tc-people__heading","gb-tc-people__list"],[e.label,e.count!==void 0?" \u2014 "+e.count:null],ce)}function ce(e){var t=S(e.labels),n=[i("span",{class:"gb-tc-person__av"},[e.avatar!=null?e.avatar:I(e.name,e.src,32),e.presence?i("span",{class:re[e.presence]},i("span",{class:"gb-tc-sr"},t[e.presence])):null]),i("span",{class:"gb-tc-person__text"},[i("span",{class:"gb-tc-person__name"},e.name),e.subtitle?i("span",{class:"gb-tc-person__sub"},e.subtitle):null]),e.role?i("span",{class:"gb-tc-person__role"},e.role):null],a=C("gb-tc-person",e.presence==="offline"&&"gb-tc-person--offline");return i("li",null,m(e.href!==void 0?i("a",{class:a,href:e.href,title:e.name},n):e.onSelect?i("button",{type:"button",class:a,title:e.name},n):i("div",{class:a,title:e.name},n),e.onSelect))}var F=function(e){return e instanceof Date?e:new Date(e)},se={};function J(e,t){var n=F(e),a,r,l,u;if(t){if(a=se[t],a===void 0){try{a=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric"})}catch{a=null}se[t]=a}if(a&&!isNaN(n.getTime())){for(r={},l=a.formatToParts(n),u=0;u<l.length;u++)l[u].type!=="literal"&&(r[l[u].type]=Number(l[u].value));return[r.year,r.month,r.day]}}return[n.getFullYear(),n.getMonth()+1,n.getDate()]}function M(e,t){var n=J(e,t);return n[0]+"-"+n[1]+"-"+n[2]}function Ce(e,t){var n=J(e,t),a=function(r){return(r<10?"0":"")+r};return n[0]+"-"+a(n[1])+"-"+a(n[2])}function Se(e,t,n){t=t===void 0?new Date:t;var a=M(e,n),r=J(t,n),l;return a===r[0]+"-"+r[1]+"-"+r[2]?"Today":(l=new Date(Date.UTC(r[0],r[1]-1,r[2]-1)),a===l.getUTCFullYear()+"-"+(l.getUTCMonth()+1)+"-"+l.getUTCDate()?"Yesterday":null)}function Te(e,t){t=t||{};var n=t.groupWithinMs==null?5*60*1e3:t.groupWithinMs,a=-1,r=[],l,u=t.timeZone;if(t.isUnread){for(l=0;l<e.length;l++)if(t.isUnread(e[l])&&(t.meId==null||e[l].authorId!==t.meId)){a=l;break}}return e.forEach(function(o,g){var h=g>0?e[g-1]:void 0,c=F(o.at),d=!h||M(h.at,u)!==M(c,u);d&&r.push({kind:"day",key:M(c,u),date:c}),g===a&&r.push({kind:"new"}),r.push({kind:"message",message:o,grouped:!!(h&&!d&&g!==a&&o.authorId!=null&&h.authorId===o.authorId&&o.replyToId==null&&c.getTime()-F(h.at).getTime()<n)})}),r}j.teamChat={message:me,readReceipt:he,daySeparator:be,newMessagesLine:ve,jumpToLatest:ye,updateJump:ae,channelSection:ke,channelItem:ie,peopleSection:we,personRow:ce,reactions:ne,reactionPicker:B,avatar:function(e){return I(e.name,e.src,e.size,e.className)},icon:_,rows:Te,dayKey:M,dayISO:Ce,dayWord:Se,LABELS:R,initialsOf:z,avatarTone:V,isReactionEmoji:Q,reactionWords:O,searchReactions:X,reactionLabel:Z,frequentReactions:ee,QUICK_REACTIONS:W,SUGGESTED_REACTIONS:Y,REACTION_GROUPS:D};function oe(){!j.openModal&&v.console&&document.querySelector('script[src*="kit-plain"]')&&v.console.error("@gemboss/ui team-chat-plain.js: load it after kit-plain.js (kit-plain.js defines nothing when gembossUI exists)")}v.document&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",oe,{once:!0}):oe())})(typeof globalThis<"u"?globalThis:this);
|
|
1
|
+
(function(y){"use strict";var L=y.gembossUI||(y.gembossUI={});if(L.teamChat)return;var W={reaction:'<path d="M16.5 10a6.5 6.5 0 1 1-6.5-6.5"/><path d="M7.5 11.8s.9 1.2 2.5 1.2 2.5-1.2 2.5-1.2"/><path d="M7.8 8.2h.01M12.2 8.2h.01"/><path d="M15 2.5v4M13 4.5h4"/>',emoji:'<circle cx="10" cy="10" r="6.5"/><path d="M7.5 11.8s.9 1.2 2.5 1.2 2.5-1.2 2.5-1.2"/><path d="M7.8 8.2h.01M12.2 8.2h.01"/>',reply:'<path d="M8 13.5 3.5 9 8 4.5M3.5 9h8a5 5 0 0 1 5 5v2"/>',thread:'<path d="M3 4.5h14v9H8.5L5 16.5v-3H3z"/><path d="M6.5 8h7M6.5 10.5h4.5"/>',chevronsDown:'<path d="M6 5.5l4 4 4-4M6 10.5l4 4 4-4"/>',hash:'<path d="M8 3.5 6.5 16.5M13.5 3.5 12 16.5M4 7.5h12.5M3.5 12.5H16"/>',lock:'<rect x="4.5" y="9" width="11" height="8" rx="1.5"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/>',user:'<circle cx="10" cy="7" r="3.2"/><path d="M3.8 16.5c.8-2.8 3.3-4.5 6.2-4.5s5.4 1.7 6.2 4.5"/>',more:'<circle cx="4.5" cy="10" r="1"/><circle cx="10" cy="10" r="1"/><circle cx="15.5" cy="10" r="1"/>'},Y=["\u{1F44D}","\u2705"],G=["\u{1F44D}","\u2705","\u{1F64F}","\u{1F389}","\u{1F602}","\u2764\uFE0F","\u{1F440}","\u{1F64C}","\u{1F525}"],D=[["Smileys",[["\u{1F600}","grin smile happy"],["\u{1F603}","smile happy"],["\u{1F604}","smile laugh happy"],["\u{1F601}","grin beam"],["\u{1F606}","laugh squint"],["\u{1F605}","sweat smile relief"],["\u{1F602}","joy tears laugh lol"],["\u{1F923}","rofl rolling laugh"],["\u{1F60A}","blush smile"],["\u{1F607}","innocent halo"],["\u{1F642}","slight smile ok"],["\u{1F609}","wink"],["\u{1F60D}","heart eyes love"],["\u{1F970}","love hearts"],["\u{1F618}","kiss"],["\u{1F60B}","yum tasty"],["\u{1F61C}","wink tongue"],["\u{1F92A}","zany crazy"],["\u{1F917}","hug"],["\u{1F92D}","oops giggle"],["\u{1F914}","think hmm"],["\u{1F928}","raised eyebrow doubt"],["\u{1F610}","neutral"],["\u{1F636}","no words"],["\u{1F644}","eye roll"],["\u{1F60F}","smirk"],["\u{1F62C}","grimace awkward"],["\u{1F60C}","relieved"],["\u{1F634}","sleep tired"],["\u{1F637}","mask sick"],["\u{1F92F}","mind blown"],["\u{1F973}","party celebrate"],["\u{1F60E}","cool sunglasses"],["\u{1F913}","nerd"],["\u{1F615}","confused"],["\u{1F61F}","worried"],["\u{1F62E}","wow surprised"],["\u{1F632}","astonished"],["\u{1F633}","flushed embarrassed"],["\u{1F97A}","pleading please"],["\u{1F622}","cry sad"],["\u{1F62D}","sob crying"],["\u{1F631}","scream shock"],["\u{1F624}","huff frustrated"],["\u{1F621}","angry mad"],["\u{1F92C}","swear"],["\u{1F480}","dead skull"],["\u{1FAE0}","melting"],["\u{1FAE1}","salute"]]],["Hands",[["\u{1F44D}","like thumbs up yes ok"],["\u{1F44E}","dislike thumbs down no"],["\u{1F44C}","ok perfect"],["\u270C\uFE0F","peace victory"],["\u{1F91E}","fingers crossed luck"],["\u{1F91F}","love you"],["\u{1F918}","rock"],["\u{1F44F}","clap applause"],["\u{1F64C}","raise hands hooray"],["\u{1F450}","open hands"],["\u{1F91D}","handshake deal"],["\u{1F64F}","thanks please pray"],["\u{1F4AA}","strong muscle"],["\u{1F440}","eyes looking"],["\u{1FAF6}","heart hands"],["\u270D\uFE0F","writing"],["\u{1F44B}","wave hi bye"],["\u261D\uFE0F","point up"],["\u{1F447}","point down"],["\u{1F449}","point right"],["\u{1F448}","point left"],["\u{1F919}","call me"],["\u{1F590}\uFE0F","stop hand"],["\u{1F90C}","pinched"]]],["Marks",[["\u2764\uFE0F","heart love red"],["\u{1F9E1}","orange heart"],["\u{1F49B}","yellow heart"],["\u{1F49A}","green heart"],["\u{1F499}","blue heart"],["\u{1F49C}","purple heart"],["\u{1F5A4}","black heart"],["\u{1F4AF}","hundred perfect"],["\u2705","done check yes"],["\u2611\uFE0F","checked box"],["\u2714\uFE0F","check mark"],["\u274C","no cross wrong"],["\u2757","important exclamation"],["\u2753","question"],["\u26A0\uFE0F","warning"],["\u{1F525}","fire hot lit"],["\u2B50","star"],["\u2728","sparkles new"],["\u{1F4A1}","idea"],["\u{1F4CC}","pin"],["\u{1F680}","rocket ship launch"],["\u{1F3AF}","target goal"],["\u{1F197}","ok button"],["\u{1F195}","new"],["\u{1F534}","red circle urgent"],["\u{1F7E2}","green circle"],["\u{1F7E1}","yellow circle"],["\u2795","plus one add"]]],["Work",[["\u{1F389}","party tada celebrate"],["\u{1F38A}","confetti"],["\u{1F3C6}","trophy win"],["\u{1F947}","gold medal first"],["\u{1F381}","gift"],["\u2615","coffee"],["\u{1F37B}","cheers beer"],["\u{1F355}","pizza"],["\u{1F4C8}","chart up growth"],["\u{1F4C9}","chart down"],["\u{1F4B0}","money"],["\u{1F6D2}","cart shop"],["\u{1F4E6}","package order shipping"],["\u{1F9FE}","receipt invoice"],["\u{1F4DD}","note memo"],["\u{1F4C5}","calendar date"],["\u23F0","alarm time"],["\u23F3","waiting hourglass"],["\u{1F527}","fix wrench"],["\u{1F41B}","bug"],["\u{1F9EA}","test"],["\u{1F50D}","search look"],["\u{1F4AC}","comment chat"],["\u{1F4DE}","call phone"],["\u{1F4E7}","email"],["\u{1F512}","lock private"],["\u{1F517}","link"],["\u{1F5BC}\uFE0F","image picture"],["\u{1F4BB}","laptop computer"],["\u{1F4F1}","phone mobile"],["\u{1F648}","see no evil oops"],["\u{1F649}","hear no evil"],["\u{1F916}","robot bot ai"],["\u{1F9E0}","brain"],["\u{1F451}","crown vip"],["\u{1F48E}","gem diamond"]]]],A={channels:"Channels",conversation:"Conversation",back:"Back to channels",members:"Members",hideMembers:"Hide members",showMembers:"Show members",thread:"Thread",closeThread:"Close thread",replies:function(e){return e===1?"1 reply":e+" replies"},newMessages:"New messages",edited:"(edited)",someone:"Someone who has left",actionsFor:function(e){return"Actions for the message from "+e},react:function(e,t,n){return(n?"Remove":"Add")+" "+e+" on the message from "+t},moreReactions:function(e){return"More reactions for the message from "+e},reply:"Reply",replyTo:function(e){return"Reply to the message from "+e},replyInThread:"Reply in thread",replyInThreadTo:function(e){return"Reply in thread to the message from "+e},openThread:function(e,t){return"Open the thread, "+(e===1?"1 reply":e+" replies")+(t?", "+t:"")},jump:"Jump to the latest message",jumpNew:function(e){return"Jump to the latest message, "+e+" new"},message:"Message",send:"Send",attach:"Attach a file",emoji:"Emoji",pickEmoji:"Pick an emoji",stopReplying:"Stop replying",privateChannel:"private channel",directMessage:"direct message",mentioningYou:function(e){return e+" mentioning you"},unread:function(e){return e+" unread"},online:"Online",away:"Away",offline:"Offline"},x=Object.prototype.hasOwnProperty;function S(e){if(!e)return A;var t={},n;for(n in A)t[n]=A[n];for(n in e)x.call(e,n)&&(t[n]=e[n]);return t}var P=function(e){return typeof Node<"u"&&e instanceof Node},k=function(){return[].filter.call(arguments,Boolean).join(" ")};function i(e,t,n){var a=document.createElement(e),r;for(r in t)t[r]!==void 0&&t[r]!==null&&t[r]!==!1&&a.setAttribute(r,String(t[r]));return R(a,n)}function R(e,t){if(t==null||typeof t=="boolean"||t==="")return e;if(Array.isArray(t)){for(var n=0;n<t.length;n++)R(e,t[n]);return e}return e.appendChild(P(t)?t:document.createTextNode(String(t))),e}var pe=function(e){return e==null?void 0:String(e)},b=function(e,t){return t&&e.addEventListener("click",t),e},U=0;function _(e,t){var n=Number(t)||20,a=document.createElement("template");return a.innerHTML='<svg viewBox="0 0 20 20" width="'+n+'" height="'+n+'" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'+(x.call(W,e)?W[e]:"")+"</g></svg>",a.content.firstChild}function I(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg",e);for(var a in t)n.setAttribute(a,t[a]);return n}var fe=function(){try{return new RegExp("^\\p{L}","u")}catch{return/^[A-Za-zÀ-ɏͰ-ϿЀ-ӿ]/}}();function z(e){var t=String(e).trim().split(/\s+/).filter(Boolean),n=t.filter(function(r){return fe.test(r)}),a=n.length?n:t;return a.length?(a.length===1?a[0].slice(0,2):a[0][0]+a[a.length-1][0]).toUpperCase():"?"}function V(e){var t=0,n=String(e),a,r,l;for(a=0;a<n.length;a++)r=n.charCodeAt(a),r>=55296&&r<=56319&&a+1<n.length&&(l=n.charCodeAt(a+1),l>=56320&&l<=57343&&(r=(r-55296)*1024+(l-56320)+65536,a++)),t=t*31+r>>>0;return t%8}var he={24:"gb-avatar--24",32:"gb-avatar--32",40:"gb-avatar--40",56:"gb-avatar--56"};function E(e,t,n,a){return n=n===void 0?24:n,i("span",{class:k("gb-avatar",he[n],a),"data-tone":V(e),"aria-hidden":"true"},t?i("img",{class:"gb-avatar-img",src:t,alt:"",loading:"lazy",width:n,height:n}):z(e))}var M={},q=[];D.forEach(function(e){e[1].forEach(function(t){M[t[0]]=t[1],q.push(t[0])})});var Q=function(e){return typeof e=="string"&&x.call(M,e)},j=function(e){return x.call(M,e)?M[e]:""};function X(e){var t=String(e).trim().toLowerCase();return t?q.filter(function(n){return M[n].indexOf(t)>-1}):q.slice()}function Z(e){return e.length>2?e.slice(0,2).join(", ")+" +"+(e.length-2):e.join(", ")}var $="gemboss-ui:reactions-recent",B=9;function ee(e){var t=[];return e.concat(G).forEach(function(n){Q(n)&&t.indexOf(n)<0&&t.length<B&&t.push(n)}),t}function te(){try{var e=JSON.parse(y.localStorage&&y.localStorage.getItem($)||"[]");return Array.isArray(e)?e.filter(function(t){return typeof t=="string"&&j(t)!==""}).slice(0,B):[]}catch{return[]}}function ne(e){try{var t=[e].concat(te().filter(function(n){return n!==e})).slice(0,B);y.localStorage&&y.localStorage.setItem($,JSON.stringify(t))}catch{}}var F=function(e,t){return e.some(function(n){return n.emoji===t&&n.mine})};function O(e){var t=e.items,n=ee(te()),a=function(s){var d=t?F(t,s):!1;return b(i("button",{type:"button",class:"ui-reaction-picker__btn",title:j(s).split(" ")[0]||s,"aria-label":((t?(d?"Remove":"Add")+" ":"")+s+" "+j(s)).trim(),"aria-pressed":t?String(d):void 0},s),function(){e.onPick(s)})},r=function(s){return i("div",{class:"ui-reaction-picker__grid"},s.map(a))},l=function(s){return i("p",{class:"ui-reaction-picker__head"},s)},o=i("input",{type:"search",class:"gemboss-field ui-reaction-picker__search",placeholder:"Search emoji","aria-label":"Search emoji",autocomplete:"off",value:""}),u=i("div",{class:"ui-reaction-picker__body"}),g=function(){var s=o.value,d=s.trim()?X(s):null,c=[];d?c.push(d.length?r(d):i("p",{class:"ui-reaction-picker__empty"},"No emoji matches.")):(c.push(l("Frequently used"),r(n)),D.forEach(function(m){c.push(l(m[0]),r(m[1].map(function(v){return v[0]})))})),u.replaceChildren.apply(u,c)},p=i("div",{id:e.id,class:k("ui-reaction-picker",e.className),role:"group","aria-label":e.label==null?"Pick a reaction":e.label},[o,u]);return o.addEventListener("input",g),p.addEventListener("keydown",function(s){if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),e.onClose();return}var d=[].slice.call(u.querySelectorAll(".ui-reaction-picker__btn"));if(s.target===o){s.key==="Enter"&&(s.preventDefault(),d[0]&&d[0].click()),s.key==="ArrowDown"&&(s.preventDefault(),d[0]&&d[0].focus());return}var c=d.indexOf(document.activeElement);if(!(c<0)){var m=u.querySelector(".ui-reaction-picker__grid"),v=Math.max(1,Math.round((m?m.getBoundingClientRect().width:44)/44)),f={ArrowRight:1,ArrowLeft:-1,ArrowDown:v,ArrowUp:-v}[s.key];if(f){if(s.preventDefault(),c+f<0){o.focus();return}d[Math.min(d.length-1,c+f)]&&d[Math.min(d.length-1,c+f)].focus()}}}),g(),p}function ae(e){var t=e.items||[],n=e.target===void 0?"this":e.target,a=e.canReact===void 0?!0:e.canReact;if(!t.length&&!a)return null;var r=!1,l=null,o="gb-tc-rp"+ ++U,u=null,g=function(c){if(!a){e.onSignIn&&e.onSignIn();return}F(t,c)||ne(c),e.onToggle&&e.onToggle(c)},p=i("div",{class:"ui-reactions__row"},t.map(function(c){return b(i("button",{type:"button",class:"ui-reaction"+(c.mine?" is-mine":""),"aria-pressed":pe(c.mine),title:c.names.join(", "),"aria-label":c.emoji+", "+c.names.join(", ")+". "+(c.mine?"Remove yours":"Add yours")},[i("span",{class:"ui-reaction__emoji"},c.emoji),i("span",{class:"ui-reaction__names"},Z(c.names))]),function(){g(c.emoji)})})),s=i("div",{class:k("ui-reactions",e.className)},p),d=function(c,m){r=c,u.setAttribute("aria-expanded",String(r)),r?(u.setAttribute("aria-controls",o),l=O({id:o,items:t,onPick:function(v){d(!1,!0),g(v),u.focus()},onClose:function(){d(!1,!0),u.focus()}}),s.appendChild(l),m&&l.firstChild.focus()):(u.removeAttribute("aria-controls"),l&&l.remove(),l=null),m&&e.onOpenChange&&e.onOpenChange(r)};return a&&(u=i("button",{type:"button",class:"ui-reaction-add",title:"Add reaction","aria-label":"Add a reaction to "+n,"aria-expanded":"false"},_("reaction",18)),p.appendChild(b(u,function(){d(!r,!0)})),e.open&&d(!0,!1)),s}function re(e,t){var n=e.value.length,a=Math.min(t[0],n),r=Math.min(Math.max(t[1],a),n);return e.focus({preventScroll:!0}),e.setSelectionRange(a,r),[a,r]}function ge(e,t,n){var a=e.value,r=re(e,n),l=r[0],o=r[1];if(e.maxLength>=0&&a.length-(o-l)+t.length>e.maxLength)return!1;try{document.execCommand("insertText",!1,t)}catch{}return e.value===a&&(e.setRangeText(t,l,o,"end"),e.dispatchEvent(new Event("input",{bubbles:!0}))),!0}var me=function(){return typeof y.matchMedia=="function"&&y.matchMedia("(pointer: coarse)").matches};function be(e){var t=S(e.labels),n=e.textarea,a=e.button,r=null,l=[0,0],o=document.activeElement===n,u=e.host||n.closest&&n.closest(".gb-tc-composer__box")||n.parentNode,g="gb-tc-rp"+ ++U;a?(a.setAttribute("aria-expanded","false"),a.hasAttribute("aria-label")||a.setAttribute("aria-label",t.emoji)):a=i("button",{type:"button",class:"ui-btn ui-btn--ghost ui-btn--icon gb-tc-composer__emoji","aria-label":t.emoji,"aria-expanded":"false",disabled:n.disabled?"":void 0},_("emoji",20)),n.addEventListener("focus",function(){o=!0});var p=function(c){r&&!(c.target&&(r.contains(c.target)||a.contains(c.target)))&&s()};function s(){r&&(r.remove(),r=null,a.setAttribute("aria-expanded","false"),a.removeAttribute("aria-controls"),document.removeEventListener("pointerdown",p,!0),document.removeEventListener("focusin",p,!0))}function d(){var c=n.value.length;l=o?[n.selectionStart==null?c:n.selectionStart,n.selectionEnd==null?c:n.selectionEnd]:[c,c],r=O({id:g,className:"gb-tc-composer__emoji-pop",label:t.pickEmoji,onPick:function(v){s(),ne(v),ge(n,v,l)},onClose:function(){s(),re(n,l)}}),a.setAttribute("aria-expanded","true"),a.setAttribute("aria-controls",g),u.appendChild(r);var m=me()?r.querySelector(".ui-reaction-picker__btn"):r.firstChild;m&&m.focus(),document.addEventListener("pointerdown",p,!0),document.addEventListener("focusin",p,!0)}return b(a,function(){r?s():n.disabled||d()}),a}function ve(e){var t=e.read,n=e.of;if(n<=0)return null;var a=t>=n,r=Math.min(t,n)/n*Math.PI*2,l=I("svg",{viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":"true",focusable:"false"});return l.appendChild(I("circle",{cx:"7",cy:"7",r:"6",fill:a?"currentColor":"none",stroke:"currentColor","stroke-width":"1.4"})),a?l.appendChild(I("path",{class:"gb-tc-receipt__tick",d:"M4.2 7.2l1.9 1.9 3.7-4",fill:"none","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"})):t>0&&l.appendChild(I("path",{d:"M7 7 L7 1 A6 6 0 "+(r>Math.PI?1:0)+" 1 "+(7+6*Math.sin(r)).toFixed(2)+" "+(7-6*Math.cos(r)).toFixed(2)+" Z",fill:"currentColor"})),i("span",{class:k("gb-tc-receipt",a&&"gb-tc-receipt--all"),role:"img","aria-label":e.label,title:e.label},l)}function ye(e){var t={ArrowRight:1,ArrowLeft:-1}[e.key],n=[].slice.call(e.currentTarget.querySelectorAll("button:not([disabled]), summary, a[href]")).filter(function(l){return l.offsetParent!==null}),a=n.indexOf(document.activeElement);if(!(a<0)){var r=t?n[(a+t+n.length)%n.length]:e.key==="Home"?n[0]:e.key==="End"?n[n.length-1]:null;r&&(e.preventDefault(),r.focus())}}function _e(e){var t=S(e.labels),n=e.author||t.someone,a=e.reactions||[],r=e.editor!=null,l=!!(e.picking&&e.onReact),o=null,u=null,g=!1,p=function(){var h=e.time;return P(h)&&g?h.cloneNode(!0):(g=!0,h)},s=function(){return k("gb-tc-msg",e.grouped&&"gb-tc-msg--grouped",e.mentionsMe&&"gb-tc-msg--mention",e.highlight&&"gb-tc-msg--highlight",e.sending&&"gb-tc-msg--sending",e.failed&&"gb-tc-msg--failed",l&&"gb-tc-msg--active",r&&"gb-tc-msg--editing",e.className)},d=i("li",{id:e.id,class:s(),"data-msg-id":e.messageId,tabindex:"-1"},e.grouped?i("time",{class:"gb-tc-msg__hover-time",datetime:e.dateTime},p()):e.avatar!=null?e.avatar:E(n,e.avatarSrc,32,"gb-tc-msg__av")),c=i("div",{class:"gb-tc-msg__main"});e.replyTo&&c.appendChild(b(i("button",{type:"button",class:"gb-tc-quote","aria-busy":e.replyTo.busy||void 0},[i("span",{class:"gb-tc-quote__who"},e.replyTo.author||t.someone),i("span",{class:"gb-tc-quote__text"},e.replyTo.excerpt)]),e.replyTo.onOpen)),c.appendChild(e.grouped?i("span",{class:"gb-tc-sr"},[n,", ",p(),": "]):i("div",{class:"gb-tc-msg__who"},[i("span",{class:"gb-tc-msg__name"},n),e.badges,i("time",{class:"gb-tc-msg__time",datetime:e.dateTime},p())])),r?c.appendChild(i("div",{class:"gb-tc-msg__editor"},e.editor)):(e.body!=null||e.edited||e.receipt)&&c.appendChild(i("div",{class:"gb-tc-msg__body"},[e.body,e.edited?i("span",{class:"gb-tc-msg__edited"},t.edited):null,e.receipt])),e.status&&c.appendChild(i("p",{class:"gb-tc-msg__status",role:e.failed?"alert":void 0},e.status)),e.attachments&&c.appendChild(i("div",{class:"gb-tc-msg__files"},e.attachments)),e.extra&&c.appendChild(i("div",{class:"gb-tc-msg__extra"},e.extra));var m=function(h,C){e.onPickingChange&&e.onPickingChange(h,C)},v=a.length?ae({items:a,onToggle:e.onReact,canReact:!!e.onReact,target:"the message from "+n,open:e.reactionsPicking,onOpenChange:function(h){m("reactions",h)}}):null,f=e.thread,H=null;f&&f.count>0&&(H=b(i("button",{type:"button",class:"gb-tc-threadprev","aria-label":t.openThread(f.count,f.last==null?"":f.last)},[f.repliers&&f.repliers.length?i("span",{class:"gb-tc-threadprev__faces","aria-hidden":"true"},f.repliers.slice(0,3).map(function(h){return E(h.name,h.src,24)})):null,i("span",{class:"gb-tc-threadprev__count"},t.replies(f.count)),f.last?i("span",{class:"gb-tc-threadprev__last"},f.last):null]),f.onOpen)),R(c,[v,H]),d.appendChild(c);var N=function(h,C){l=h,d.className=s(),u&&u.setAttribute("aria-expanded",String(l)),l?(o=O({items:a,onPick:function(Re){N(!1,!0),e.onReact(Re),u.focus()},onClose:function(){N(!1,!0),u.focus()}}),c.insertBefore(o,v||H),C&&o.firstChild.focus()):o&&(o.remove(),o=null),C&&m("bar",l)};if(!r&&!e.sending&&(e.onReact||e.onReply||e.onOpenThread||e.moreActions)){var w=i("div",{class:"gb-tc-acts",role:"toolbar","aria-label":t.actionsFor(n)});e.onReact&&(Y.forEach(function(h){var C=F(a,h);w.appendChild(b(i("button",{type:"button",class:"gb-tc-act gb-tc-act--quick","aria-pressed":String(C),"aria-label":t.react(h,n,C)},h),function(){e.onReact(h)}))}),u=i("button",{type:"button",class:"gb-tc-act","aria-expanded":String(l),"aria-label":t.moreReactions(n),title:"Add reaction"},_("reaction",18)),w.appendChild(b(u,function(){N(!l,!0)}))),e.onReply&&w.appendChild(b(i("button",{type:"button",class:"gb-tc-act","aria-label":t.replyTo(n),title:t.reply},_("reply",18)),e.onReply)),e.onOpenThread&&w.appendChild(b(i("button",{type:"button",class:"gb-tc-act","aria-label":t.replyInThreadTo(n),title:t.replyInThread},_("thread",18)),e.onOpenThread)),R(w,e.moreActions),w.addEventListener("keydown",ye),d.appendChild(w)}return l&&N(!0,!1),d}function ke(e,t){return i("li",{class:"gb-tc-day"},t?i("time",{class:"gb-tc-day__label",datetime:t},e):i("span",{class:"gb-tc-day__label"},e))}function we(e){var t=S(e);return i("li",{class:"gb-tc-new"},i("span",{class:"gb-tc-new__label",role:"separator","aria-label":t.newMessages},t.newMessages))}function Ce(e){return e=e||{},ie(b(i("button",{type:"button",class:"gb-tc-jump"},_("chevronsDown",20)),e.onJump),e)}function ie(e,t){t=t||{};var n=S(t.labels),a=t.count===void 0?0:t.count,r=e.querySelector(".gb-tc-jump__n");return t.visible===void 0||t.visible?e.removeAttribute("hidden"):e.setAttribute("hidden",""),e.setAttribute("aria-label",a?n.jumpNew(a):n.jump),a?(r||(r=e.appendChild(i("span",{class:"gb-tc-jump__n","aria-hidden":"true"}))),r.textContent=a>99?"99+":String(a),e):(r&&r.remove(),e)}var Se={channel:"hash",private:"lock",dm:"user"},le={online:"gb-tc-presence gb-tc-presence--online",away:"gb-tc-presence gb-tc-presence--away",offline:"gb-tc-presence gb-tc-presence--offline"};function ce(e){var t=S(e.labels),n=e.kind===void 0?"channel":e.kind,a=e.unread===void 0?0:e.unread,r=e.mentions===void 0?0:e.mentions,l=[e.name,n==="private"?t.privateChannel:n==="dm"?t.directMessage:null,r?t.mentioningYou(r):null,a?t.unread(a):null].filter(Boolean).join(", "),o=[i("span",{class:"gb-tc-channel__glyph","aria-hidden":"true"},[n==="dm"&&e.avatar?E(e.avatar.name==null?e.name:e.avatar.name,e.avatar.src,24,"gb-tc-channel__av"):_(Se[n],16),n==="dm"&&e.online!==void 0?i("span",{class:le[e.online?"online":"offline"]}):null]),i("span",{class:"gb-tc-channel__name"},e.name),r?i("span",{class:"gb-tc-badge gb-tc-badge--mention","aria-hidden":"true"},"@"+r):null,a?i("span",{class:"gb-tc-badge","aria-hidden":"true"},a):null],u=k("gb-tc-channel",a>0&&"gb-tc-channel--unread");return i("li",null,b(e.href!==void 0?i("a",{class:u,href:e.href,"aria-current":e.active?"page":void 0,"aria-label":l},o):i("button",{type:"button",class:u,"aria-current":e.active?"true":void 0,"aria-label":l},o),e.onOpen))}function se(e,t,n,a){var r=(e.id==null?"gb-tc-s"+ ++U:e.id)+"-h";return i("div",{class:t[0],role:"group","aria-labelledby":r},[i("h3",{class:t[1],id:r},n),i("ul",{class:t[2]},(e.items||[]).map(function(l){return l&&!P(l)?a(l):l}))])}function Ee(e){return se(e,["gb-tc-rail__section","gb-tc-rail__heading","gb-tc-rail__list"],e.label,ce)}function Me(e){return se(e,["gb-tc-people__section","gb-tc-people__heading","gb-tc-people__list"],[e.label,e.count!==void 0?" \u2014 "+e.count:null],oe)}function oe(e){var t=S(e.labels),n=[i("span",{class:"gb-tc-person__av"},[e.avatar!=null?e.avatar:E(e.name,e.src,32),e.presence?i("span",{class:le[e.presence]},i("span",{class:"gb-tc-sr"},t[e.presence])):null]),i("span",{class:"gb-tc-person__text"},[i("span",{class:"gb-tc-person__name"},e.name),e.subtitle?i("span",{class:"gb-tc-person__sub"},e.subtitle):null]),e.role?i("span",{class:"gb-tc-person__role"},e.role):null],a=k("gb-tc-person",e.presence==="offline"&&"gb-tc-person--offline");return i("li",null,b(e.href!==void 0?i("a",{class:a,href:e.href,title:e.name},n):e.onSelect?i("button",{type:"button",class:a,title:e.name},n):i("div",{class:a,title:e.name},n),e.onSelect))}var J=function(e){return e instanceof Date?e:new Date(e)},ue={};function K(e,t){var n=J(e),a,r,l,o;if(t){if(a=ue[t],a===void 0){try{a=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric"})}catch{a=null}ue[t]=a}if(a&&!isNaN(n.getTime())){for(r={},l=a.formatToParts(n),o=0;o<l.length;o++)l[o].type!=="literal"&&(r[l[o].type]=Number(l[o].value));return[r.year,r.month,r.day]}}return[n.getFullYear(),n.getMonth()+1,n.getDate()]}function T(e,t){var n=K(e,t);return n[0]+"-"+n[1]+"-"+n[2]}function Te(e,t){var n=K(e,t),a=function(r){return(r<10?"0":"")+r};return n[0]+"-"+a(n[1])+"-"+a(n[2])}function Ae(e,t,n){t=t===void 0?new Date:t;var a=T(e,n),r=K(t,n),l;return a===r[0]+"-"+r[1]+"-"+r[2]?"Today":(l=new Date(Date.UTC(r[0],r[1]-1,r[2]-1)),a===l.getUTCFullYear()+"-"+(l.getUTCMonth()+1)+"-"+l.getUTCDate()?"Yesterday":null)}function xe(e,t){t=t||{};var n=t.groupWithinMs==null?5*60*1e3:t.groupWithinMs,a=-1,r=[],l,o=t.timeZone;if(t.isUnread){for(l=0;l<e.length;l++)if(t.isUnread(e[l])&&(t.meId==null||e[l].authorId!==t.meId)){a=l;break}}return e.forEach(function(u,g){var p=g>0?e[g-1]:void 0,s=J(u.at),d=!p||T(p.at,o)!==T(s,o);d&&r.push({kind:"day",key:T(s,o),date:s}),g===a&&r.push({kind:"new"}),r.push({kind:"message",message:u,grouped:!!(p&&!d&&g!==a&&u.authorId!=null&&p.authorId===u.authorId&&u.replyToId==null&&s.getTime()-J(p.at).getTime()<n)})}),r}L.teamChat={message:_e,readReceipt:ve,daySeparator:ke,newMessagesLine:we,jumpToLatest:Ce,updateJump:ie,channelSection:Ee,channelItem:ce,peopleSection:Me,personRow:oe,reactions:ae,reactionPicker:O,emojiButton:be,avatar:function(e){return E(e.name,e.src,e.size,e.className)},icon:_,rows:xe,dayKey:T,dayISO:Te,dayWord:Ae,LABELS:A,initialsOf:z,avatarTone:V,isReactionEmoji:Q,reactionWords:j,searchReactions:X,reactionLabel:Z,frequentReactions:ee,QUICK_REACTIONS:Y,SUGGESTED_REACTIONS:G,REACTION_GROUPS:D};function de(){!L.openModal&&y.console&&document.querySelector('script[src*="kit-plain"]')&&y.console.error("@gemboss/ui team-chat-plain.js: load it after kit-plain.js (kit-plain.js defines nothing when gembossUI exists)")}y.document&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",de,{once:!0}):de())})(typeof globalThis<"u"?globalThis:this);
|
package/src/team-chat.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gb-tc{container:gb-tc / inline-size;position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr);height:100%;min-height:0;overflow:hidden;box-sizing:border-box;background:var(--gemboss-surface);color:var(--gemboss-text);font-size:var(--gemboss-fs-body)}.gb-tc>.gb-tc-rail{grid-column:1;grid-row:1}.gb-tc>.gb-tc-main{grid-column:2;grid-row:1}.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people{grid-column:3;grid-row:1;height:auto}.gb-tc-main,.gb-tc-rail,.gb-tc-thread,.gb-tc-people{display:flex;flex-direction:column;min-width:0;min-height:0}.gb-tc-main{position:relative}.gb-tc-main>*,.gb-tc-rail>*,.gb-tc-thread>*,.gb-tc-people>*{flex:none}.gb-tc-main>.gb-tc-body,.gb-tc-thread>.gb-tc-body,.gb-tc-rail>.gb-tc-rail__scroll,.gb-tc-people>.gb-tc-people__body{flex:1 1 0;min-height:0}.gb-tc-body,.gb-tc-composer,.gb-tc-rail__list,.gb-tc-people__list{grid-template-columns:minmax(0,1fr)}.gb-tc-scrim{display:none}.gb-tc :is(.gb-tc-thread,.gb-tc-people,.gb-tc-scrim,.gb-tc-replying,.gb-tc-jump,.gb-tc-composer__files,.gb-tc-composer__picker)[hidden]{display:none}.gb-tc-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.gb-tc-rail{width:var(--gb-tc-rail-w, 240px);box-sizing:border-box;border-right:1px solid var(--gemboss-divider);background:var(--gemboss-rail-bg)}.gb-tc-rail__head,.gb-tc-head,.gb-tc-panel-head{display:flex;align-items:center;gap:8px;min-height:56px;min-width:0;box-sizing:border-box;border-bottom:1px solid var(--gemboss-divider)}.gb-tc-rail__head{justify-content:space-between;padding:8px 8px 8px 16px}.gb-tc-rail__title,.gb-tc-panel-head__title{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--gemboss-fs-h3);font-weight:650;line-height:1.3;color:var(--gemboss-text-strong)}.gb-tc-rail__actions,.gb-tc-head__actions,.gb-tc-panel-head__actions{flex:none;display:flex;align-items:center;gap:4px}.gb-tc-rail__scroll{overflow-y:auto;overscroll-behavior:contain;padding:8px 8px 16px}.gb-tc-rail__section+.gb-tc-rail__section{margin-top:16px}.gb-tc-rail__heading,.gb-tc-people__heading{margin:0 8px 4px;font-size:var(--gemboss-fs-caption);font-weight:650;line-height:20px;color:var(--gemboss-text-muted)}.gb-tc-rail__list,.gb-tc-people__list{list-style:none;margin:0;padding:0;display:grid;gap:1px}.gb-tc-channel{display:flex;align-items:center;gap:8px;width:100%;min-width:0;min-height:32px;padding:0 8px;box-sizing:border-box;border:0;border-radius:var(--gemboss-radius-md);background:none;cursor:pointer;text-align:left;text-decoration:none;font:inherit;font-size:var(--gemboss-fs-body);color:var(--gemboss-text-muted)}.gb-tc-channel:hover{background:var(--gemboss-hover);color:var(--gemboss-text-strong)}.gb-tc-channel:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-channel--unread{color:var(--gemboss-text-strong);font-weight:650}.gb-tc-channel[aria-current]{background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong);font-weight:650}.gb-tc-channel__glyph{position:relative;flex:none;display:inline-grid;place-items:center;width:20px;height:20px}.gb-tc-channel__glyph>.gb-tc-presence{right:-3px;bottom:-2px;width:7px;height:7px;border-color:var(--gemboss-rail-bg)}.gb-tc-channel__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-badge{flex:none;min-width:20px;height:18px;padding:0 6px;box-sizing:border-box;border-radius:var(--gemboss-radius-full);background:var(--gemboss-accent);color:var(--gemboss-on-primary);font-size:var(--gemboss-fs-micro);font-weight:700;line-height:18px;text-align:center;font-variant-numeric:tabular-nums}.gb-tc-badge--mention{background:var(--gemboss-warning-soft);color:var(--gemboss-warning);box-shadow:inset 0 0 0 1px var(--gemboss-warning-border)}.gb-tc-head{padding:8px 12px 8px 16px}.gb-tc .gb-tc-head__back{display:none}.gb-tc-head__text,.gb-tc-panel-head__text{flex:1 1 auto;min-width:0}.gb-tc-head__title{margin:0;display:flex;align-items:center;gap:6px;min-width:0;font-size:var(--gemboss-fs-h3);font-weight:650;line-height:1.3;color:var(--gemboss-text-strong)}.gb-tc-head__glyph{flex:none;display:inline-flex;color:var(--gemboss-text-muted)}.gb-tc-head__name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-head__sub,.gb-tc-panel-head__sub{margin:2px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--gemboss-fs-caption);line-height:16px;color:var(--gemboss-text-muted)}.gb-tc .gb-tc-head__members{gap:6px;padding:0 8px}.gb-tc .gb-tc-head__members[aria-expanded=true]{background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong)}.gb-tc-head__count{font-variant-numeric:tabular-nums}.gb-tc-body{position:relative;display:grid;grid-template-rows:minmax(0,1fr);min-width:0;min-height:0}.gb-tc-log{container:gb-tc-log / inline-size;min-height:0;overflow-y:auto;overscroll-behavior:contain}.gb-tc-log:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-list{list-style:none;margin:0;padding:8px 0 16px;display:flex;flex-direction:column}.gb-tc-list>*{flex-shrink:0}.gb-tc-older,.gb-tc-empty,.gb-tc-status{display:flex;justify-content:center;padding:8px 16px;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption)}.gb-tc-empty{padding-block:32px;font-size:var(--gemboss-fs-body)}.gb-tc-status{justify-content:flex-start;padding-left:60px}.gb-tc-day{position:sticky;top:0;z-index:1;display:flex;justify-content:center;margin:4px 0 0;padding:4px 0;background:var(--gemboss-surface);pointer-events:none}.gb-tc-day__label{padding:1px 12px;border:1px solid var(--gemboss-divider);border-radius:var(--gemboss-radius-full);background:var(--gemboss-surface);box-shadow:var(--gemboss-shadow-resting);font-size:var(--gemboss-fs-caption);font-weight:600;line-height:20px;color:var(--gemboss-text)}.gb-tc-new{display:flex;align-items:center;gap:8px;margin:6px 16px;color:var(--gemboss-accent)}.gb-tc-new:before,.gb-tc-new:after{content:"";flex:1;height:1px;background:currentColor}.gb-tc-new__label{font-size:var(--gemboss-fs-caption);font-weight:650;line-height:16px}.gb-tc-msg{position:relative;display:grid;grid-template-columns:36px minmax(0,1fr);column-gap:8px;align-items:start;padding:8px 16px 4px}.gb-tc-msg:focus{outline:none}.gb-tc-msg:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-msg--grouped{padding-block:2px}.gb-tc-msg>.gb-avatar,.gb-tc-msg>.gb-tc-msg__hover-time{grid-column:1;grid-row:1}.gb-tc-msg>.gb-tc-msg__main{grid-column:2;grid-row:1;min-width:0}.gb-avatar.gb-tc-msg__av{width:36px;height:36px;font-size:13px;margin-top:2px}.gb-tc-msg:hover,.gb-tc-msg--active,.gb-tc-msg--editing{background:var(--gemboss-divider-soft)}.gb-tc-msg:has(:focus-visible){background:var(--gemboss-divider-soft)}.gb-tc-msg__hover-time{justify-self:end;opacity:0;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:var(--gemboss-fs-micro);line-height:20px;color:var(--gemboss-text-muted)}.gb-tc-msg:hover>.gb-tc-msg__hover-time,.gb-tc-msg:focus-within>.gb-tc-msg__hover-time{opacity:1}.gb-tc-msg__who{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px;min-width:0;line-height:20px}.gb-tc-msg__name{font-weight:650;color:var(--gemboss-text-strong);overflow-wrap:anywhere}.gb-tc-msg__time{font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted);font-variant-numeric:tabular-nums}.gb-tc-msg__body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:20px;color:var(--gemboss-text)}.gb-tc-msg__edited{margin-left:4px;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted);white-space:nowrap}.gb-tc-msg__status{margin:2px 0 0;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-msg--failed .gb-tc-msg__status{color:var(--gemboss-danger)}.gb-tc-msg--sending>.gb-tc-msg__main{opacity:.6}.gb-tc-msg__files,.gb-tc-msg__extra{margin-top:4px;min-width:0}.gb-tc-msg__editor{display:grid;gap:6px;margin-top:2px}.gb-tc-msg--mention{box-shadow:inset 2px 0 0 var(--gemboss-warning)}.gb-tc-msg--highlight{background:var(--gemboss-accent-soft)}.gb-tc-quote{display:flex;align-items:baseline;gap:6px;max-width:100%;min-height:28px;margin:0 0 4px;padding:4px 8px;box-sizing:border-box;border:0;border-left:2px solid var(--gemboss-divider);border-radius:0 var(--gemboss-radius-sm) var(--gemboss-radius-sm) 0;background:none;cursor:pointer;text-align:left;font:inherit;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-quote:hover{background:var(--gemboss-hover)}.gb-tc-quote:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:1px}.gb-tc-quote[aria-busy=true]{opacity:.55;cursor:progress}.gb-tc-quote__who{flex:none;font-weight:650;color:var(--gemboss-text)}.gb-tc-quote__text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-msg .ui-reactions{margin-top:2px}.gb-tc-msg .ui-reaction-picker{margin:4px 0;max-width:calc(100cqi - 64px)}.gb-tc-threadprev{display:flex;align-items:center;gap:8px;max-width:100%;min-height:32px;margin-top:4px;padding:4px 8px 4px 4px;box-sizing:border-box;border:1px solid transparent;border-radius:var(--gemboss-radius-md);background:none;cursor:pointer;text-align:left;font:inherit;font-size:var(--gemboss-fs-caption)}.gb-tc-threadprev:hover{border-color:var(--gemboss-divider);background:var(--gemboss-surface)}.gb-tc-threadprev:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:1px}.gb-tc-threadprev__faces{flex:none;display:flex;gap:2px}.gb-tc-threadprev__faces>.gb-avatar{width:22px;height:22px;font-size:9px;border-radius:var(--gemboss-radius-xs)}.gb-tc-threadprev__count{flex:none;font-weight:650;color:var(--gemboss-accent-strong)}.gb-tc-threadprev__last{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gemboss-text-muted)}.gb-tc-receipt{display:inline-flex;margin-left:6px;vertical-align:-2px;color:var(--gemboss-text-muted)}.gb-tc-receipt--all{color:var(--gemboss-success)}.gb-tc-receipt__tick{stroke:var(--gemboss-surface)}.gb-tc-acts{position:absolute;top:-14px;right:16px;z-index:2;display:flex;align-items:center;gap:0;padding:2px;border:1px solid var(--gemboss-divider);border-radius:var(--gemboss-radius-md);background:var(--gemboss-surface);box-shadow:var(--gemboss-shadow-raised);white-space:nowrap;opacity:0;pointer-events:none}.gb-tc-list>.gb-tc-msg:first-child>.gb-tc-acts{top:2px}.gb-tc-msg:hover>.gb-tc-acts,.gb-tc-msg--active>.gb-tc-acts,.gb-tc-acts:focus-within{opacity:1;pointer-events:auto}.gb-tc-act{display:inline-grid;place-items:center;min-width:32px;height:32px;padding:0 6px;box-sizing:border-box;border:0;border-radius:var(--gemboss-radius-sm);background:transparent;cursor:pointer;font:inherit;font-size:16px;line-height:1;color:var(--gemboss-text-muted)}.gb-tc-act:hover{background:var(--gemboss-hover);color:var(--gemboss-text-strong)}.gb-tc-act:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-act[aria-pressed=true],.gb-tc-act[aria-expanded=true]{background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong)}@container gb-tc-log (max-width: 560px){.gb-tc-act--quick{display:none}.gb-tc-acts{right:8px}.gb-tc-msg{padding-inline:12px}.gb-tc-status{padding-left:56px}}@media (hover: none){.gb-tc-msg:focus-within{background:var(--gemboss-divider-soft)}.gb-tc-msg:focus-within>.gb-tc-acts{opacity:1;pointer-events:auto}.gb-tc-act--quick{display:none}.gb-tc-acts{top:-22px}}.gb-tc-jump{position:absolute;right:16px;bottom:16px;z-index:3;display:grid;place-items:center;width:40px;height:40px;padding:0;border:1px solid var(--gemboss-divider);border-radius:50%;background:var(--gemboss-surface);color:var(--gemboss-text-strong);box-shadow:var(--gemboss-shadow-raised);cursor:pointer}.gb-tc-jump[hidden]{display:none}.gb-tc-jump:hover{background:var(--gemboss-hover)}.gb-tc-jump:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:2px}.gb-tc-jump__n{position:absolute;top:-6px;right:-6px;min-width:20px;height:20px;padding:0 4px;box-sizing:border-box;border-radius:var(--gemboss-radius-full);background:var(--gemboss-accent);color:var(--gemboss-on-primary);font-size:var(--gemboss-fs-micro);font-weight:700;line-height:20px;text-align:center;font-variant-numeric:tabular-nums}.gb-tc-composer{display:grid;gap:6px;min-width:0;padding:8px 16px 16px}.gb-tc-composer__box{display:flex;align-items:flex-end;gap:4px;min-width:0;padding:4px;box-sizing:border-box;border:1px solid var(--gemboss-field-line);border-radius:var(--gemboss-radius-lg);background:var(--gemboss-field-bg)}.gb-tc-composer__box:hover{border-color:var(--gemboss-field-line-hover)}.gb-tc-composer__box:focus-within{border-color:var(--gemboss-field-line-active);box-shadow:0 0 0 1px var(--gemboss-field-line-active)}.gb-tc-composer__input{flex:1 1 auto;min-width:0;min-height:32px;max-height:40vh;margin:0;padding:6px 4px;box-sizing:border-box;border:0;background:transparent;resize:none;outline:none;field-sizing:content;font:inherit;font-size:var(--gemboss-fs-body);line-height:20px;color:var(--gemboss-field-ink)}.gb-tc-composer__input::placeholder{color:var(--gemboss-field-placeholder)}.gb-tc-composer__input:disabled{cursor:not-allowed}.gb-tc-composer__box>.ui-btn--icon{width:32px;height:32px}.gb-tc .gb-tc-composer__attach,.gb-tc .gb-tc-composer__send,.gb-tc .gb-tc-panel-head__close,.gb-tc .gb-tc-people__toggle{flex:none}.gb-tc .gb-tc-composer__send:disabled{opacity:.35}.gb-tc-replying{display:flex;align-items:center;gap:8px;min-width:0;padding:2px 2px 2px 8px;box-sizing:border-box;border-left:2px solid var(--gemboss-accent);border-radius:var(--gemboss-radius-sm);background:var(--gemboss-accent-soft)}.gb-tc-replying__text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text)}.gb-tc-composer__files,.gb-tc-composer__picker{min-width:0}.gb-tc-composer__picker{max-height:240px;overflow-y:auto;overscroll-behavior:contain}.gb-tc-composer__also{justify-self:start}.gb-tc-composer__error{margin:0;font-size:var(--gemboss-fs-caption);color:var(--gemboss-danger)}.gb-tc-thread,.gb-tc-people{height:100%;box-sizing:border-box;border-left:1px solid var(--gemboss-divider);background:var(--gemboss-surface);color:var(--gemboss-text)}.gb-tc-thread:focus,.gb-tc-people:focus{outline:none}.gb-tc-panel-head{padding:8px 8px 8px 16px}.gb-tc-thread{width:var(--gb-tc-thread-w, 380px)}.gb-tc-thread__note{margin:8px 16px 0;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-thread__note--error{color:var(--gemboss-danger-strong, var(--gemboss-danger))}.gb-tc-thread__count{display:flex;align-items:center;gap:8px;margin:8px 16px 4px;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-thread__count:after{content:"";flex:1;border-top:1px solid var(--gemboss-divider)}.gb-tc-people{width:var(--gb-tc-people-w, 260px)}.gb-tc-people__body{overflow-y:auto;overscroll-behavior:contain;padding:8px 8px 16px}.gb-tc-people__section+.gb-tc-people__section{margin-top:16px}.gb-tc-person{display:flex;align-items:center;gap:8px;width:100%;min-width:0;min-height:40px;padding:4px 8px;box-sizing:border-box;border:0;border-radius:var(--gemboss-radius-md);background:none;text-align:left;text-decoration:none;font:inherit;color:inherit}:is(a,button).gb-tc-person{cursor:pointer}:is(a,button).gb-tc-person:hover{background:var(--gemboss-hover)}.gb-tc-person:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-person__av{position:relative;flex:none;display:inline-flex}.gb-tc-person__text{flex:1 1 auto;min-width:0;display:grid}.gb-tc-person__name,.gb-tc-person__sub{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-person__name{font-weight:550;line-height:20px;color:var(--gemboss-text-strong)}.gb-tc-person__sub{font-size:var(--gemboss-fs-caption);line-height:16px;color:var(--gemboss-text-muted)}.gb-tc-person__role{flex:none;padding:0 6px;border:1px solid var(--gemboss-divider);border-radius:var(--gemboss-radius-full);font-size:var(--gemboss-fs-micro);font-weight:650;line-height:18px;color:var(--gemboss-text-muted)}.gb-tc-person--offline .gb-tc-person__name{color:var(--gemboss-text-muted)}.gb-tc-person--offline .gb-avatar{opacity:.55}.gb-tc-presence{position:absolute;right:-1px;bottom:-1px;width:8px;height:8px;border-radius:50%;border:2px solid var(--gemboss-surface);background:var(--gemboss-success)}.gb-tc-presence--away{background:var(--gemboss-warning)}.gb-tc-presence--offline{background:var(--gemboss-surface);box-shadow:inset 0 0 0 1.5px var(--gemboss-text-muted)}.gb-tc-presence--online{background:var(--gemboss-success)}.gb-tc-people[data-collapsed]{width:56px}.gb-tc-people[data-collapsed] .gb-tc-panel-head{justify-content:center;padding:8px 0}.gb-tc-people[data-collapsed] .gb-tc-panel-head__actions{display:none}.gb-tc-people[data-collapsed] :is(.gb-tc-panel-head__text,.gb-tc-people__heading,.gb-tc-person__text,.gb-tc-person__role){position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.gb-tc-people[data-collapsed] .gb-tc-people__body{padding:8px 4px}.gb-tc-people[data-collapsed] .gb-tc-people__section+.gb-tc-people__section{margin-top:8px;padding-top:8px;border-top:1px solid var(--gemboss-divider)}.gb-tc-people[data-collapsed] .gb-tc-person{justify-content:center;padding:4px 0}@media (pointer: coarse),(max-width: 47.9975em){.gb-tc-channel,.gb-tc-person,.gb-tc-quote,.gb-tc-threadprev{min-height:44px}.gb-tc-act{min-width:44px;height:44px}.gb-tc-jump{width:48px;height:48px}.gb-tc-composer__input{font-size:16px;min-height:44px;padding-block:12px}.gb-tc-composer__box>.ui-btn--icon{width:44px;height:44px}}@container gb-tc (max-width: 1100px){.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people,.gb-tc>.gb-tc-scrim{grid-area:1 / 1 / -1 / -1}.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people{position:absolute;top:0;right:0;bottom:0;z-index:5;width:min(var(--gb-tc-thread-w, 380px),100%);box-shadow:var(--gemboss-shadow-overlay)}.gb-tc>.gb-tc-people{width:min(var(--gb-tc-people-w, 260px) + 40px,100%)}.gb-tc>.gb-tc-people[data-collapsed]{display:none}.gb-tc>.gb-tc-scrim{display:block;position:absolute;inset:0;z-index:4;background:color-mix(in srgb,var(--gemboss-dark-bg) 32%,transparent)}}@container gb-tc (max-width: 760px){.gb-tc>.gb-tc-rail{grid-column:1 / -1;width:auto;border-right:0}.gb-tc>.gb-tc-main{grid-column:1 / -1}.gb-tc:not([data-view=list])>.gb-tc-rail,.gb-tc[data-view=list]>:is(.gb-tc-main,.gb-tc-scrim,.gb-tc-thread,.gb-tc-people){display:none}.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people{left:0;width:auto;border-left:0;box-shadow:none}.gb-tc>.gb-tc-scrim{display:none}.gb-tc .gb-tc-head__back{display:inline-flex;margin-left:-8px}.gb-tc-head{padding-left:12px}.gb-tc-composer{padding:8px 12px 12px}}@media (prefers-reduced-motion: no-preference){.gb-tc-msg{transition:background-color .15s linear}.gb-tc-acts{transition:opacity .1s linear}}
|
|
1
|
+
.gb-tc{container:gb-tc / inline-size;position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr);height:100%;min-height:0;overflow:hidden;box-sizing:border-box;background:var(--gemboss-surface);color:var(--gemboss-text);font-size:var(--gemboss-fs-body)}.gb-tc>.gb-tc-rail{grid-column:1;grid-row:1}.gb-tc>.gb-tc-main{grid-column:2;grid-row:1}.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people{grid-column:3;grid-row:1;height:auto}.gb-tc-main,.gb-tc-rail,.gb-tc-thread,.gb-tc-people{display:flex;flex-direction:column;min-width:0;min-height:0}.gb-tc-main{position:relative}.gb-tc-main>*,.gb-tc-rail>*,.gb-tc-thread>*,.gb-tc-people>*{flex:none}.gb-tc-main>.gb-tc-body,.gb-tc-thread>.gb-tc-body,.gb-tc-rail>.gb-tc-rail__scroll,.gb-tc-people>.gb-tc-people__body{flex:1 1 0;min-height:0}.gb-tc-body,.gb-tc-composer,.gb-tc-rail__list,.gb-tc-people__list{grid-template-columns:minmax(0,1fr)}.gb-tc-scrim{display:none}.gb-tc :is(.gb-tc-thread,.gb-tc-people,.gb-tc-scrim,.gb-tc-replying,.gb-tc-jump,.gb-tc-composer__files,.gb-tc-composer__picker)[hidden]{display:none}.gb-tc-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.gb-tc-rail{width:var(--gb-tc-rail-w, 240px);box-sizing:border-box;border-right:1px solid var(--gemboss-divider);background:var(--gemboss-rail-bg)}.gb-tc-rail__head,.gb-tc-head,.gb-tc-panel-head{display:flex;align-items:center;gap:8px;min-height:56px;min-width:0;box-sizing:border-box;border-bottom:1px solid var(--gemboss-divider)}.gb-tc-rail__head{justify-content:space-between;padding:8px 8px 8px 16px}.gb-tc-rail__title,.gb-tc-panel-head__title{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--gemboss-fs-h3);font-weight:650;line-height:1.3;color:var(--gemboss-text-strong)}.gb-tc-rail__actions,.gb-tc-head__actions,.gb-tc-panel-head__actions{flex:none;display:flex;align-items:center;gap:4px}.gb-tc-rail__scroll{overflow-y:auto;overscroll-behavior:contain;padding:8px 8px 16px}.gb-tc-rail__section+.gb-tc-rail__section{margin-top:16px}.gb-tc-rail__heading,.gb-tc-people__heading{margin:0 8px 4px;font-size:var(--gemboss-fs-caption);font-weight:650;line-height:20px;color:var(--gemboss-text-muted)}.gb-tc-rail__list,.gb-tc-people__list{list-style:none;margin:0;padding:0;display:grid;gap:1px}.gb-tc-channel{display:flex;align-items:center;gap:8px;width:100%;min-width:0;min-height:32px;padding:0 8px;box-sizing:border-box;border:0;border-radius:var(--gemboss-radius-md);background:none;cursor:pointer;text-align:left;text-decoration:none;font:inherit;font-size:var(--gemboss-fs-body);color:var(--gemboss-text-muted)}.gb-tc-channel:hover{background:var(--gemboss-hover);color:var(--gemboss-text-strong)}.gb-tc-channel:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-channel--unread{color:var(--gemboss-text-strong);font-weight:650}.gb-tc-channel[aria-current]{background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong);font-weight:650}.gb-tc-channel__glyph{position:relative;flex:none;display:inline-grid;place-items:center;width:20px;height:20px}.gb-tc-channel__glyph>.gb-tc-presence{right:-3px;bottom:-2px;width:7px;height:7px;border-color:var(--gemboss-rail-bg)}.gb-avatar.gb-tc-channel__av{width:20px;height:20px;font-size:8px}.gb-tc-channel__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-badge{flex:none;min-width:20px;height:18px;padding:0 6px;box-sizing:border-box;border-radius:var(--gemboss-radius-full);background:var(--gemboss-accent);color:var(--gemboss-on-primary);font-size:var(--gemboss-fs-micro);font-weight:700;line-height:18px;text-align:center;font-variant-numeric:tabular-nums}.gb-tc-badge--mention{background:var(--gemboss-warning-soft);color:var(--gemboss-warning);box-shadow:inset 0 0 0 1px var(--gemboss-warning-border)}.gb-tc-head{padding:8px 12px 8px 16px}.gb-tc .gb-tc-head__back{display:none}.gb-tc-head__text,.gb-tc-panel-head__text{flex:1 1 auto;min-width:0}.gb-tc-head__title{margin:0;display:flex;align-items:center;gap:6px;min-width:0;font-size:var(--gemboss-fs-h3);font-weight:650;line-height:1.3;color:var(--gemboss-text-strong)}.gb-tc-head__glyph{flex:none;display:inline-flex;color:var(--gemboss-text-muted)}.gb-avatar.gb-tc-head__av{flex:none;margin-right:2px}.gb-tc-head__name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-head__sub,.gb-tc-panel-head__sub{margin:2px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--gemboss-fs-caption);line-height:16px;color:var(--gemboss-text-muted)}.gb-tc .gb-tc-head__members{gap:6px;padding:0 8px}.gb-tc .gb-tc-head__members[aria-expanded=true]{background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong)}.gb-tc-head__count{font-variant-numeric:tabular-nums}.gb-tc-body{position:relative;display:grid;grid-template-rows:minmax(0,1fr);min-width:0;min-height:0}.gb-tc-log{container:gb-tc-log / inline-size;min-height:0;overflow-y:auto;overscroll-behavior:contain}.gb-tc-log:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-list{list-style:none;margin:0;padding:8px 0 16px;display:flex;flex-direction:column}.gb-tc-list>*{flex-shrink:0}.gb-tc-older,.gb-tc-empty,.gb-tc-status{display:flex;justify-content:center;padding:8px 16px;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption)}.gb-tc-empty{padding-block:32px;font-size:var(--gemboss-fs-body)}.gb-tc-status{justify-content:flex-start;padding-left:60px}.gb-tc-day{position:sticky;top:0;z-index:1;display:flex;justify-content:center;margin:4px 0 0;padding:4px 0;background:var(--gemboss-surface);pointer-events:none}.gb-tc-day__label{padding:1px 12px;border:1px solid var(--gemboss-divider);border-radius:var(--gemboss-radius-full);background:var(--gemboss-surface);box-shadow:var(--gemboss-shadow-resting);font-size:var(--gemboss-fs-caption);font-weight:600;line-height:20px;color:var(--gemboss-text)}.gb-tc-new{display:flex;align-items:center;gap:8px;margin:6px 16px;color:var(--gemboss-accent)}.gb-tc-new:before,.gb-tc-new:after{content:"";flex:1;height:1px;background:currentColor}.gb-tc-new__label{font-size:var(--gemboss-fs-caption);font-weight:650;line-height:16px}.gb-tc-msg{position:relative;display:grid;grid-template-columns:36px minmax(0,1fr);column-gap:8px;align-items:start;padding:8px 16px 4px}.gb-tc-msg:focus{outline:none}.gb-tc-msg:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-msg--grouped{padding-block:2px}.gb-tc-msg>.gb-avatar,.gb-tc-msg>.gb-tc-msg__hover-time{grid-column:1;grid-row:1}.gb-tc-msg>.gb-tc-msg__main{grid-column:2;grid-row:1;min-width:0}.gb-avatar.gb-tc-msg__av{width:36px;height:36px;font-size:13px;margin-top:2px}.gb-tc-msg:hover,.gb-tc-msg--active,.gb-tc-msg--editing{background:var(--gemboss-divider-soft)}.gb-tc-msg:has(:focus-visible){background:var(--gemboss-divider-soft)}.gb-tc-msg__hover-time{justify-self:end;opacity:0;white-space:nowrap;font-variant-numeric:tabular-nums;font-size:var(--gemboss-fs-micro);line-height:20px;color:var(--gemboss-text-muted)}.gb-tc-msg:hover>.gb-tc-msg__hover-time,.gb-tc-msg:focus-within>.gb-tc-msg__hover-time{opacity:1}.gb-tc-msg__who{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px;min-width:0;line-height:20px}.gb-tc-msg__name{font-weight:650;color:var(--gemboss-text-strong);overflow-wrap:anywhere}.gb-tc-msg__time{font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted);font-variant-numeric:tabular-nums}.gb-tc-msg__body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:20px;color:var(--gemboss-text)}.gb-tc-msg__edited{margin-left:4px;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted);white-space:nowrap}.gb-tc-msg__status{margin:2px 0 0;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-msg--failed .gb-tc-msg__status{color:var(--gemboss-danger)}.gb-tc-msg--sending>.gb-tc-msg__main{opacity:.6}.gb-tc-msg__files,.gb-tc-msg__extra{margin-top:4px;min-width:0}.gb-tc-msg__editor{display:grid;gap:6px;margin-top:2px}.gb-tc-msg--mention{box-shadow:inset 2px 0 0 var(--gemboss-warning)}.gb-tc-msg--highlight{background:var(--gemboss-accent-soft)}.gb-tc-quote{display:flex;align-items:baseline;gap:6px;max-width:100%;min-height:28px;margin:0 0 4px;padding:4px 8px;box-sizing:border-box;border:0;border-left:2px solid var(--gemboss-divider);border-radius:0 var(--gemboss-radius-sm) var(--gemboss-radius-sm) 0;background:none;cursor:pointer;text-align:left;font:inherit;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-quote:hover{background:var(--gemboss-hover)}.gb-tc-quote:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:1px}.gb-tc-quote[aria-busy=true]{opacity:.55;cursor:progress}.gb-tc-quote__who{flex:none;font-weight:650;color:var(--gemboss-text)}.gb-tc-quote__text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-msg .ui-reactions{margin-top:2px}.gb-tc-msg .ui-reaction-picker{margin:4px 0;max-width:calc(100cqi - 64px)}.gb-tc-threadprev{display:flex;align-items:center;gap:8px;max-width:100%;min-height:32px;margin-top:4px;padding:4px 8px 4px 4px;box-sizing:border-box;border:1px solid transparent;border-radius:var(--gemboss-radius-md);background:none;cursor:pointer;text-align:left;font:inherit;font-size:var(--gemboss-fs-caption)}.gb-tc-threadprev:hover{border-color:var(--gemboss-divider);background:var(--gemboss-surface)}.gb-tc-threadprev:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:1px}.gb-tc-threadprev__faces{flex:none;display:flex;gap:2px}.gb-tc-threadprev__faces>.gb-avatar{width:22px;height:22px;font-size:9px;border-radius:var(--gemboss-radius-xs)}.gb-tc-threadprev__count{flex:none;font-weight:650;color:var(--gemboss-accent-strong)}.gb-tc-threadprev__last{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gemboss-text-muted)}.gb-tc-receipt{display:inline-flex;margin-left:6px;vertical-align:-2px;color:var(--gemboss-text-muted)}.gb-tc-receipt--all{color:var(--gemboss-success)}.gb-tc-receipt__tick{stroke:var(--gemboss-surface)}.gb-tc-acts{position:absolute;top:-14px;right:16px;z-index:2;display:flex;align-items:center;gap:0;padding:2px;border:1px solid var(--gemboss-divider);border-radius:var(--gemboss-radius-md);background:var(--gemboss-surface);box-shadow:var(--gemboss-shadow-raised);white-space:nowrap;opacity:0;pointer-events:none}.gb-tc-list>.gb-tc-msg:first-child>.gb-tc-acts{top:2px}.gb-tc-msg:hover>.gb-tc-acts,.gb-tc-msg--active>.gb-tc-acts,.gb-tc-acts:focus-within{opacity:1;pointer-events:auto}.gb-tc-act{display:inline-grid;place-items:center;min-width:32px;height:32px;padding:0 6px;box-sizing:border-box;border:0;border-radius:var(--gemboss-radius-sm);background:transparent;cursor:pointer;font:inherit;font-size:16px;line-height:1;color:var(--gemboss-text-muted)}.gb-tc-act:hover{background:var(--gemboss-hover);color:var(--gemboss-text-strong)}.gb-tc-act:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-act[aria-pressed=true],.gb-tc-act[aria-expanded=true]{background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong)}@container gb-tc-log (max-width: 560px){.gb-tc-act--quick{display:none}.gb-tc-acts{right:8px}.gb-tc-msg{padding-inline:12px}.gb-tc-status{padding-left:56px}}@media (hover: none){.gb-tc-msg:focus-within{background:var(--gemboss-divider-soft)}.gb-tc-msg:focus-within>.gb-tc-acts{opacity:1;pointer-events:auto}.gb-tc-act--quick{display:none}.gb-tc-acts{top:-22px}}.gb-tc-jump{position:absolute;right:16px;bottom:16px;z-index:3;display:grid;place-items:center;width:40px;height:40px;padding:0;border:1px solid var(--gemboss-divider);border-radius:50%;background:var(--gemboss-surface);color:var(--gemboss-text-strong);box-shadow:var(--gemboss-shadow-raised);cursor:pointer}.gb-tc-jump[hidden]{display:none}.gb-tc-jump:hover{background:var(--gemboss-hover)}.gb-tc-jump:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:2px}.gb-tc-jump__n{position:absolute;top:-6px;right:-6px;min-width:20px;height:20px;padding:0 4px;box-sizing:border-box;border-radius:var(--gemboss-radius-full);background:var(--gemboss-accent);color:var(--gemboss-on-primary);font-size:var(--gemboss-fs-micro);font-weight:700;line-height:20px;text-align:center;font-variant-numeric:tabular-nums}.gb-tc-composer{display:grid;gap:6px;min-width:0;padding:8px 16px 16px}.gb-tc-composer__box{position:relative;display:flex;align-items:flex-end;gap:4px;min-width:0;padding:4px;box-sizing:border-box;border:1px solid var(--gemboss-field-line);border-radius:var(--gemboss-radius-lg);background:var(--gemboss-field-bg)}.gb-tc-composer__box:hover{border-color:var(--gemboss-field-line-hover)}.gb-tc-composer__box:focus-within{border-color:var(--gemboss-field-line-active);box-shadow:0 0 0 1px var(--gemboss-field-line-active)}.gb-tc-composer__input{flex:1 1 auto;min-width:0;min-height:32px;max-height:40vh;margin:0;padding:6px 4px;box-sizing:border-box;border:0;background:transparent;resize:none;outline:none;field-sizing:content;font:inherit;font-size:var(--gemboss-fs-body);line-height:20px;color:var(--gemboss-field-ink)}.gb-tc-composer__input::placeholder{color:var(--gemboss-field-placeholder)}.gb-tc-composer__input:disabled{cursor:not-allowed}.gb-tc-composer__box>.ui-btn--icon{width:32px;height:32px}.gb-tc .gb-tc-composer__attach,.gb-tc .gb-tc-composer__emoji,.gb-tc .gb-tc-composer__send,.gb-tc .gb-tc-panel-head__close,.gb-tc .gb-tc-people__toggle{flex:none}.gb-tc .gb-tc-composer__send:disabled{opacity:.35}.gb-tc .gb-tc-composer__emoji[aria-expanded=true]{background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong)}.gb-tc-composer__emoji-pop{position:absolute;right:0;bottom:calc(100% + 6px);z-index:4}.gb-tc-composer__emoji-pop .ui-reaction-picker__body{max-height:min(300px,40vh)}.gb-tc-replying{display:flex;align-items:center;gap:8px;min-width:0;padding:2px 2px 2px 8px;box-sizing:border-box;border-left:2px solid var(--gemboss-accent);border-radius:var(--gemboss-radius-sm);background:var(--gemboss-accent-soft)}.gb-tc-replying__text{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text)}.gb-tc-composer__files,.gb-tc-composer__picker{min-width:0}.gb-tc-composer__picker{max-height:240px;overflow-y:auto;overscroll-behavior:contain}.gb-tc-composer__also{justify-self:start}.gb-tc-composer__error{margin:0;font-size:var(--gemboss-fs-caption);color:var(--gemboss-danger)}.gb-tc-thread,.gb-tc-people{height:100%;box-sizing:border-box;border-left:1px solid var(--gemboss-divider);background:var(--gemboss-surface);color:var(--gemboss-text)}.gb-tc-thread:focus,.gb-tc-people:focus{outline:none}.gb-tc-panel-head{padding:8px 8px 8px 16px}.gb-tc-thread{width:var(--gb-tc-thread-w, 380px)}.gb-tc-thread__note{margin:8px 16px 0;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-thread__note--error{color:var(--gemboss-danger-strong, var(--gemboss-danger))}.gb-tc-thread__count{display:flex;align-items:center;gap:8px;margin:8px 16px 4px;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-tc-thread__count:after{content:"";flex:1;border-top:1px solid var(--gemboss-divider)}.gb-tc-people{width:var(--gb-tc-people-w, 260px)}.gb-tc-people__body{overflow-y:auto;overscroll-behavior:contain;padding:8px 8px 16px}.gb-tc-people__section+.gb-tc-people__section{margin-top:16px}.gb-tc-person{display:flex;align-items:center;gap:8px;width:100%;min-width:0;min-height:40px;padding:4px 8px;box-sizing:border-box;border:0;border-radius:var(--gemboss-radius-md);background:none;text-align:left;text-decoration:none;font:inherit;color:inherit}:is(a,button).gb-tc-person{cursor:pointer}:is(a,button).gb-tc-person:hover{background:var(--gemboss-hover)}.gb-tc-person:focus-visible{outline:2px solid var(--gemboss-accent);outline-offset:-2px}.gb-tc-person__av{position:relative;flex:none;display:inline-flex}.gb-tc-person__text{flex:1 1 auto;min-width:0;display:grid}.gb-tc-person__name,.gb-tc-person__sub{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gb-tc-person__name{font-weight:550;line-height:20px;color:var(--gemboss-text-strong)}.gb-tc-person__sub{font-size:var(--gemboss-fs-caption);line-height:16px;color:var(--gemboss-text-muted)}.gb-tc-person__role{flex:none;padding:0 6px;border:1px solid var(--gemboss-divider);border-radius:var(--gemboss-radius-full);font-size:var(--gemboss-fs-micro);font-weight:650;line-height:18px;color:var(--gemboss-text-muted)}.gb-tc-person--offline .gb-tc-person__name{color:var(--gemboss-text-muted)}.gb-tc-person--offline .gb-avatar{opacity:.55}.gb-tc-presence{position:absolute;right:-1px;bottom:-1px;width:8px;height:8px;border-radius:50%;border:2px solid var(--gemboss-surface);background:var(--gemboss-success)}.gb-tc-presence--away{background:var(--gemboss-warning)}.gb-tc-presence--offline{background:var(--gemboss-surface);box-shadow:inset 0 0 0 1.5px var(--gemboss-text-muted)}.gb-tc-presence--online{background:var(--gemboss-success)}.gb-tc-people[data-collapsed]{width:56px}.gb-tc-people[data-collapsed] .gb-tc-panel-head{justify-content:center;padding:8px 0}.gb-tc-people[data-collapsed] .gb-tc-panel-head__actions{display:none}.gb-tc-people[data-collapsed] :is(.gb-tc-panel-head__text,.gb-tc-people__heading,.gb-tc-person__text,.gb-tc-person__role){position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.gb-tc-people[data-collapsed] .gb-tc-people__body{padding:8px 4px}.gb-tc-people[data-collapsed] .gb-tc-people__section+.gb-tc-people__section{margin-top:8px;padding-top:8px;border-top:1px solid var(--gemboss-divider)}.gb-tc-people[data-collapsed] .gb-tc-person{justify-content:center;padding:4px 0}@media (pointer: coarse),(max-width: 47.9975em){.gb-tc-channel,.gb-tc-person,.gb-tc-quote,.gb-tc-threadprev{min-height:44px}.gb-tc-act{min-width:44px;height:44px}.gb-tc-jump{width:48px;height:48px}.gb-tc-composer__input{font-size:16px;min-height:44px;padding-block:12px}.gb-tc-composer__box>.ui-btn--icon{width:44px;height:44px}}@container gb-tc (max-width: 1100px){.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people,.gb-tc>.gb-tc-scrim{grid-area:1 / 1 / -1 / -1}.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people{position:absolute;top:0;right:0;bottom:0;z-index:5;width:min(var(--gb-tc-thread-w, 380px),100%);box-shadow:var(--gemboss-shadow-overlay)}.gb-tc>.gb-tc-people{width:min(var(--gb-tc-people-w, 260px) + 40px,100%)}.gb-tc>.gb-tc-people[data-collapsed]{display:none}.gb-tc>.gb-tc-scrim{display:block;position:absolute;inset:0;z-index:4;background:color-mix(in srgb,var(--gemboss-dark-bg) 32%,transparent)}}@container gb-tc (max-width: 760px){.gb-tc>.gb-tc-rail{grid-column:1 / -1;width:auto;border-right:0}.gb-tc>.gb-tc-main{grid-column:1 / -1}.gb-tc:not([data-view=list])>.gb-tc-rail,.gb-tc[data-view=list]>:is(.gb-tc-main,.gb-tc-scrim,.gb-tc-thread,.gb-tc-people){display:none}.gb-tc>.gb-tc-thread,.gb-tc>.gb-tc-people{left:0;width:auto;border-left:0;box-shadow:none}.gb-tc>.gb-tc-scrim{display:none}.gb-tc .gb-tc-head__back{display:inline-flex;margin-left:-8px}.gb-tc-head{padding-left:12px}.gb-tc-composer{padding:8px 12px 12px}}@container gb-tc (max-width: 359px){.gb-tc-composer__box{gap:0}}@media (prefers-reduced-motion: no-preference){.gb-tc-msg{transition:background-color .15s linear}.gb-tc-acts{transition:opacity .1s linear}}
|
package/src/team-chat.tsx
CHANGED
|
@@ -17,13 +17,14 @@
|
|
|
17
17
|
* emit the same thing and the two cannot drift. Change the markup here, and the README block with it.
|
|
18
18
|
*
|
|
19
19
|
* Classes: `gb-tc-*` (team-chat.css, imported below). Reused from the package, not redrawn: `Avatar` (portal.css),
|
|
20
|
-
* `Reactions` / `ReactionPicker` (reactions.css), the kit's `ui-btn` and
|
|
20
|
+
* `Reactions` / `ReactionPicker` (reactions.css; the composer's emoji button opens the same picker), the kit's `ui-btn` and
|
|
21
|
+
* `ui-check` (components.css, the core).
|
|
21
22
|
*/
|
|
22
23
|
import "./team-chat.css";
|
|
23
24
|
import React, { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
24
25
|
import { Icon } from "./icons";
|
|
25
26
|
import { Avatar } from "./portal";
|
|
26
|
-
import { ReactionPicker, Reactions } from "./reactions";
|
|
27
|
+
import { ReactionPicker, Reactions, rememberRecent } from "./reactions";
|
|
27
28
|
import { QUICK_REACTIONS, type Reaction } from "./reactions-data";
|
|
28
29
|
|
|
29
30
|
const cx = (...c: Array<string | false | null | undefined>) => c.filter(Boolean).join(" ");
|
|
@@ -57,6 +58,8 @@ export type TeamChatLabels = {
|
|
|
57
58
|
message: string;
|
|
58
59
|
send: string;
|
|
59
60
|
attach: string;
|
|
61
|
+
emoji: string;
|
|
62
|
+
pickEmoji: string;
|
|
60
63
|
stopReplying: string;
|
|
61
64
|
privateChannel: string;
|
|
62
65
|
directMessage: string;
|
|
@@ -93,6 +96,8 @@ export const TEAM_CHAT_LABELS: TeamChatLabels = {
|
|
|
93
96
|
message: "Message",
|
|
94
97
|
send: "Send",
|
|
95
98
|
attach: "Attach a file",
|
|
99
|
+
emoji: "Emoji",
|
|
100
|
+
pickEmoji: "Pick an emoji",
|
|
96
101
|
stopReplying: "Stop replying",
|
|
97
102
|
privateChannel: "private channel",
|
|
98
103
|
directMessage: "direct message",
|
|
@@ -246,8 +251,12 @@ export type ChannelItemProps = {
|
|
|
246
251
|
mentions?: number;
|
|
247
252
|
/** The channel on screen: `aria-current`. */
|
|
248
253
|
active?: boolean;
|
|
249
|
-
/** A direct message: whether the other person is online (a dot on the glyph). */
|
|
254
|
+
/** A direct message: whether the other person is online (a dot on the glyph, or on their picture). */
|
|
250
255
|
online?: boolean;
|
|
256
|
+
/** A direct message: the person's picture in place of the person glyph (21/10/2026), the kit's `Avatar` at the glyph's
|
|
257
|
+
* 20px, their initials and tone when there is no `src`; the presence dot sits on it. `name` defaults to the row's.
|
|
258
|
+
* Only on a DM: a channel keeps its glyph. Absent: the glyph, as before. */
|
|
259
|
+
avatar?: DmAvatar;
|
|
251
260
|
/** A link (the channel has its own URL) … */
|
|
252
261
|
href?: string;
|
|
253
262
|
/** … drawn by the app's link component (Next's `Link`). */
|
|
@@ -257,15 +266,18 @@ export type ChannelItemProps = {
|
|
|
257
266
|
labels?: Partial<TeamChatLabels>;
|
|
258
267
|
};
|
|
259
268
|
|
|
269
|
+
/** A person's picture on a DM (the rail's row, the conversation's head): an image URL, else initials from `name`. */
|
|
270
|
+
export type DmAvatar = { src?: string | null; name?: string };
|
|
271
|
+
|
|
260
272
|
/** One row of the rail. Its accessible name says the counts too: a dot cannot be read out. */
|
|
261
|
-
export function ChannelItem({ name, kind = "channel", unread = 0, mentions = 0, active = false, online, href, linkAs, onOpen, labels }: ChannelItemProps) {
|
|
273
|
+
export function ChannelItem({ name, kind = "channel", unread = 0, mentions = 0, active = false, online, avatar, href, linkAs, onOpen, labels }: ChannelItemProps) {
|
|
262
274
|
const t = words(labels);
|
|
263
275
|
const label = [name, kind === "private" ? t.privateChannel : kind === "dm" ? t.directMessage : null,
|
|
264
276
|
mentions ? t.mentioningYou(mentions) : null, unread ? t.unread(unread) : null].filter(Boolean).join(", ");
|
|
265
277
|
const inner = (
|
|
266
278
|
<>
|
|
267
279
|
<span className="gb-tc-channel__glyph" aria-hidden="true">
|
|
268
|
-
<Icon name={KIND_ICON[kind]} size={16} />
|
|
280
|
+
{kind === "dm" && avatar ? <Avatar name={avatar.name ?? name} src={avatar.src} size={24} className="gb-tc-channel__av" /> : <Icon name={KIND_ICON[kind]} size={16} />}
|
|
269
281
|
{kind === "dm" && online !== undefined ? <span className={PRESENCE_CLASS[online ? "online" : "offline"]} /> : null}
|
|
270
282
|
</span>
|
|
271
283
|
<span className="gb-tc-channel__name">{name}</span>
|
|
@@ -290,6 +302,9 @@ export type ChatHeaderProps = {
|
|
|
290
302
|
kind?: ChannelKind;
|
|
291
303
|
/** One line under the name: the topic, "Just the two of you", "12 members". */
|
|
292
304
|
topic?: React.ReactNode;
|
|
305
|
+
/** A direct message (`kind="dm"`): the person's picture left of the name in place of the glyph (21/10/2026), the kit's
|
|
306
|
+
* `Avatar` at 24px, initials and tone when there is no `src`. `name` defaults to the header's when it is text. */
|
|
307
|
+
avatar?: DmAvatar;
|
|
293
308
|
/** The phone's way back to the channel list (shown only at phone width). */
|
|
294
309
|
onBack?: () => void;
|
|
295
310
|
/** The "members" toggle: opens and closes the people panel. */
|
|
@@ -300,7 +315,7 @@ export type ChatHeaderProps = {
|
|
|
300
315
|
labels?: Partial<TeamChatLabels>;
|
|
301
316
|
};
|
|
302
317
|
|
|
303
|
-
export function ChatHeader({ name, kind, topic, onBack, members, actions, headingId, labels }: ChatHeaderProps) {
|
|
318
|
+
export function ChatHeader({ name, kind, topic, avatar, onBack, members, actions, headingId, labels }: ChatHeaderProps) {
|
|
304
319
|
const t = words(labels);
|
|
305
320
|
return (
|
|
306
321
|
<header className="gb-tc-head">
|
|
@@ -311,7 +326,8 @@ export function ChatHeader({ name, kind, topic, onBack, members, actions, headin
|
|
|
311
326
|
) : null}
|
|
312
327
|
<div className="gb-tc-head__text">
|
|
313
328
|
<h2 className="gb-tc-head__title" id={headingId}>
|
|
314
|
-
{kind ? <
|
|
329
|
+
{kind === "dm" && avatar ? <Avatar name={avatar.name ?? (typeof name === "string" ? name : "")} src={avatar.src} size={24} className="gb-tc-head__av" />
|
|
330
|
+
: kind ? <span className="gb-tc-head__glyph" aria-hidden="true"><Icon name={KIND_ICON[kind]} size={16} /></span> : null}
|
|
315
331
|
<span className="gb-tc-head__name">{name}</span>
|
|
316
332
|
</h2>
|
|
317
333
|
{topic ? <p className="gb-tc-head__sub">{topic}</p> : null}
|
|
@@ -582,6 +598,9 @@ export type ComposerProps = {
|
|
|
582
598
|
picker?: React.ReactNode;
|
|
583
599
|
/** Show the paperclip; the app opens its file input. */
|
|
584
600
|
onAttach?: () => void;
|
|
601
|
+
/** The emoji button (Chris 21/10/2026), on by default: it opens the reactions' picker (search, "Frequently used", the
|
|
602
|
+
* groups) over the field, and a pick goes in at the caret. `false` for an app that does not want it. */
|
|
603
|
+
emoji?: boolean;
|
|
585
604
|
/** The thread's "Also send to #general". */
|
|
586
605
|
also?: { label: React.ReactNode; checked: boolean; onChange: (checked: boolean) => void };
|
|
587
606
|
error?: React.ReactNode;
|
|
@@ -597,18 +616,84 @@ export type ComposerProps = {
|
|
|
597
616
|
};
|
|
598
617
|
|
|
599
618
|
/**
|
|
600
|
-
*
|
|
619
|
+
* Write `text` into a field over its selection (at its caret when nothing is selected) as typing would: focus stays in
|
|
620
|
+
* the field with the caret after the text, the browser's undo has it, and the field fires `input`, so React's onChange
|
|
621
|
+
* and any listener of the app's own hear it. `execCommand("insertText")` does all of that; where a browser refuses it,
|
|
622
|
+
* `setRangeText` and an `input` event. Nothing is written past the field's `maxLength`. Returns whether it wrote.
|
|
623
|
+
*/
|
|
624
|
+
function insertAtCaret(el: HTMLTextAreaElement, text: string, [from, to]: readonly [number, number]): boolean {
|
|
625
|
+
const before = el.value;
|
|
626
|
+
const s = Math.min(from, before.length), e = Math.min(Math.max(to, s), before.length);
|
|
627
|
+
el.focus({ preventScroll: true });
|
|
628
|
+
el.setSelectionRange(s, e);
|
|
629
|
+
if (el.maxLength >= 0 && before.length - (e - s) + text.length > el.maxLength) return false;
|
|
630
|
+
try { document.execCommand("insertText", false, text); } catch { /* not supported: below */ }
|
|
631
|
+
if (el.value === before) {
|
|
632
|
+
el.setRangeText(text, s, e, "end");
|
|
633
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
634
|
+
}
|
|
635
|
+
return true;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/** Under a finger: a question about the device, as team-chat.css asks it (`pointer: coarse`). */
|
|
639
|
+
const coarsePointer = () => typeof matchMedia === "function" && matchMedia("(pointer: coarse)").matches;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* The field and its buttons in one box (paperclip · text · emoji · send), as Slack: one row even at 320px. Enter sends,
|
|
601
643
|
* Shift+Enter is a new line, and an IME composition (Vietnamese Telex, Japanese) is never cut short by its own Enter.
|
|
602
644
|
* The field grows with its text (`field-sizing: content`; where a browser lacks it, the component sets the height).
|
|
645
|
+
*
|
|
646
|
+
* The emoji button opens the reactions' own picker (`ReactionPicker` with no `items`) over the box, at its right edge
|
|
647
|
+
* (the box's whole width where the box is narrower than the picker: a phone). A pick goes in at the caret, over a
|
|
648
|
+
* selection, and joins "Frequently used"; focus stays in the field, after the emoji. Escape closes it and puts focus back
|
|
649
|
+
* in the field where the caret was; a press or focus anywhere else closes it. Under a finger it opens on the emoji, not
|
|
650
|
+
* the search, so the keyboard does not come up over it.
|
|
603
651
|
*/
|
|
604
652
|
export function Composer({ onSend, value, defaultValue = "", onValueChange, placeholder, label, id, disabled, busy, canSendEmpty, replyingTo, onCancelReply,
|
|
605
|
-
files, picker, onAttach, also, error, inputRef, onKeyDown, onPaste, maxLength = 4000, maxRows = 8, className, labels }: ComposerProps) {
|
|
653
|
+
files, picker, onAttach, emoji = true, also, error, inputRef, onKeyDown, onPaste, maxLength = 4000, maxRows = 8, className, labels }: ComposerProps) {
|
|
606
654
|
const t = words(labels);
|
|
607
655
|
const auto = useId();
|
|
608
656
|
const fieldId = id ?? `${auto}-input`;
|
|
657
|
+
const popId = useId();
|
|
609
658
|
const [own, setOwn] = useState(defaultValue);
|
|
610
659
|
const text = value ?? own;
|
|
611
660
|
const field = useRef<HTMLTextAreaElement | null>(null);
|
|
661
|
+
const [emojiOpen, setEmojiOpen] = useState(false);
|
|
662
|
+
const [emojiFocus, setEmojiFocus] = useState<"search" | "emoji">("search");
|
|
663
|
+
const emojiBtn = useRef<HTMLButtonElement>(null);
|
|
664
|
+
// Where the pick goes: the field's selection when the picker opened. A field never focused has no caret yet: its end.
|
|
665
|
+
const touched = useRef(false);
|
|
666
|
+
const at = useRef<[number, number]>([0, 0]);
|
|
667
|
+
const openEmoji = () => {
|
|
668
|
+
const el = field.current, n = el?.value.length ?? 0;
|
|
669
|
+
at.current = el && touched.current ? [el.selectionStart ?? n, el.selectionEnd ?? n] : [n, n];
|
|
670
|
+
setEmojiFocus(coarsePointer() ? "emoji" : "search");
|
|
671
|
+
setEmojiOpen(true);
|
|
672
|
+
};
|
|
673
|
+
const backToField = () => {
|
|
674
|
+
const el = field.current;
|
|
675
|
+
if (!el) return;
|
|
676
|
+
el.focus({ preventScroll: true });
|
|
677
|
+
el.setSelectionRange(Math.min(at.current[0], el.value.length), Math.min(at.current[1], el.value.length));
|
|
678
|
+
};
|
|
679
|
+
const pickEmoji = (e: string) => {
|
|
680
|
+
setEmojiOpen(false);
|
|
681
|
+
rememberRecent(e);
|
|
682
|
+
if (field.current) insertAtCaret(field.current, e, at.current);
|
|
683
|
+
};
|
|
684
|
+
// A press or focus outside the picker and its button closes it (and leaves focus where the person put it).
|
|
685
|
+
useEffect(() => {
|
|
686
|
+
if (!emojiOpen) return;
|
|
687
|
+
const away = (ev: Event) => {
|
|
688
|
+
const n = ev.target as Node | null, pop = document.getElementById(popId);
|
|
689
|
+
if (n && (pop?.contains(n) || emojiBtn.current?.contains(n))) return;
|
|
690
|
+
setEmojiOpen(false);
|
|
691
|
+
};
|
|
692
|
+
document.addEventListener("pointerdown", away, true);
|
|
693
|
+
document.addEventListener("focusin", away, true);
|
|
694
|
+
return () => { document.removeEventListener("pointerdown", away, true); document.removeEventListener("focusin", away, true); };
|
|
695
|
+
}, [emojiOpen, popId]);
|
|
696
|
+
useEffect(() => { if (disabled) setEmojiOpen(false); }, [disabled]);
|
|
612
697
|
const setField = (el: HTMLTextAreaElement | null) => {
|
|
613
698
|
field.current = el;
|
|
614
699
|
if (typeof inputRef === "function") inputRef(el);
|
|
@@ -651,15 +736,27 @@ export function Composer({ onSend, value, defaultValue = "", onValueChange, plac
|
|
|
651
736
|
<textarea ref={setField} id={fieldId} className="gb-tc-composer__input" rows={1} maxLength={maxLength} placeholder={placeholder}
|
|
652
737
|
value={text} disabled={disabled} onPaste={onPaste}
|
|
653
738
|
onChange={(e) => set(e.target.value)}
|
|
739
|
+
onFocus={() => { touched.current = true; }}
|
|
654
740
|
onKeyDown={(e) => {
|
|
655
741
|
onKeyDown?.(e);
|
|
656
742
|
if (e.defaultPrevented || e.key !== "Enter" || e.shiftKey || e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
657
743
|
e.preventDefault();
|
|
658
744
|
send();
|
|
659
745
|
}} />
|
|
746
|
+
{emoji ? (
|
|
747
|
+
<button ref={emojiBtn} type="button" className="ui-btn ui-btn--ghost ui-btn--icon gb-tc-composer__emoji" aria-label={t.emoji}
|
|
748
|
+
aria-expanded={emojiOpen} aria-controls={emojiOpen ? popId : undefined} disabled={disabled}
|
|
749
|
+
onClick={() => (emojiOpen ? setEmojiOpen(false) : openEmoji())}>
|
|
750
|
+
<Icon name="emoji" />
|
|
751
|
+
</button>
|
|
752
|
+
) : null}
|
|
660
753
|
<button type="submit" className="ui-btn ui-btn--primary ui-btn--icon gb-tc-composer__send" aria-label={t.send} disabled={!can}>
|
|
661
754
|
<Icon name="send" />
|
|
662
755
|
</button>
|
|
756
|
+
{emoji && emojiOpen ? (
|
|
757
|
+
<ReactionPicker id={popId} className="gb-tc-composer__emoji-pop" label={t.pickEmoji} initialFocus={emojiFocus}
|
|
758
|
+
onPick={pickEmoji} onClose={() => { setEmojiOpen(false); backToField(); }} />
|
|
759
|
+
) : null}
|
|
663
760
|
</div>
|
|
664
761
|
{also ? (
|
|
665
762
|
<label className="ui-check gb-tc-composer__also">
|
package/src/theme-dark.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root[data-theme=dark]{color-scheme:dark;--gemboss-primary: #f2f3f5;--gemboss-primary-dark: #ffffff;--gemboss-primary-soft: #23242a;--gemboss-on-primary: #0d0d12;--gemboss-accent: #7c84ff;--gemboss-accent-strong: #a3a9ff;--gemboss-accent-soft: #1f2140;--gemboss-text-strong: #f2f3f5;--gemboss-text: #e3e4e8;--gemboss-text-muted: #9a9ca6;--gemboss-surface: #16171d;--gemboss-canvas: #0d0d12;--gemboss-app-bg: #0d0d12;--gemboss-rail-bg: #0d0d12;--gemboss-panel-bg: #16171d;--gemboss-topbar-bg: rgba(13, 13, 18, .96);--gemboss-nav-bg: #0d0d12;--gemboss-nav-hover: rgba(255, 255, 255, .06);--gemboss-divider: #2a2b33;--gemboss-divider-soft: #22232a;--gemboss-hover: #22232b;--gemboss-active-bg: #262833;--gemboss-active-fg: #f2f3f5;--gemboss-field-bg: #121318;--gemboss-field-bg-hover: #17181e;--gemboss-field-ink: #e3e4e8;--gemboss-field-placeholder: #8a8c96;--gemboss-field-line: #3a3c46;--gemboss-field-line-hover: #50525e;--gemboss-field-line-active: #c9cbd3;--gemboss-chip-ink: #d6d8de;--gemboss-chip-line: #3a3c46;--gemboss-chip-line-hover: #50525e;--gemboss-chip-bg-hover: #22232b;--gemboss-success: #34c38f;--gemboss-success-strong: #5fd6a8;--gemboss-success-soft: #13291f;--gemboss-success-border: #22533e;--gemboss-warning: #e0b341;--gemboss-warning-soft: #2b2412;--gemboss-warning-border: #5a4a1d;--gemboss-danger: #ff6b5a;--gemboss-danger-strong: #ff8a7c;--gemboss-danger-soft: #2e1714;--gemboss-danger-border: #5c2a24;--ui-accent-fg: #0d0d12;--ui-warning-fg: #e8c063;--ui-card-shadow: none;--gb-brand-ink: #f2f3f5}:root[data-theme=dark] .gb-avatar[data-tone]{background:color-mix(in srgb,var(--gb-tone) 30%,#16171d);color:color-mix(in srgb,var(--gb-tone) 35%,#ffffff)}:root[data-theme=dark] body{background:var(--gemboss-app-bg);color:var(--gemboss-text)}:root[data-theme=dark] .gb-leaderboard-row.is-first .gb-leaderboard-value,:root[data-theme=dark] .gb-podium-slot--1 .gb-podium-value{color:#e0b341}
|
|
1
|
+
:root[data-theme=dark]{color-scheme:dark;--gemboss-primary: #f2f3f5;--gemboss-primary-dark: #ffffff;--gemboss-primary-soft: #23242a;--gemboss-on-primary: #0d0d12;--gemboss-accent: #7c84ff;--gemboss-accent-strong: #a3a9ff;--gemboss-accent-soft: #1f2140;--gemboss-accent-wash: #181a33;--gemboss-accent-tint: #2a2e5c;--gemboss-accent-mid: #3b4180;--gemboss-text-strong: #f2f3f5;--gemboss-text: #e3e4e8;--gemboss-text-muted: #9a9ca6;--gemboss-surface: #16171d;--gemboss-canvas: #0d0d12;--gemboss-app-bg: #0d0d12;--gemboss-rail-bg: #0d0d12;--gemboss-panel-bg: #16171d;--gemboss-topbar-bg: rgba(13, 13, 18, .96);--gemboss-nav-bg: #0d0d12;--gemboss-nav-hover: rgba(255, 255, 255, .06);--gemboss-divider: #2a2b33;--gemboss-divider-soft: #22232a;--gemboss-hover: #22232b;--gemboss-active-bg: #262833;--gemboss-active-fg: #f2f3f5;--gemboss-field-bg: #121318;--gemboss-field-bg-hover: #17181e;--gemboss-field-ink: #e3e4e8;--gemboss-field-placeholder: #8a8c96;--gemboss-field-line: #3a3c46;--gemboss-field-line-hover: #50525e;--gemboss-field-line-active: #c9cbd3;--gemboss-chip-ink: #d6d8de;--gemboss-chip-line: #3a3c46;--gemboss-chip-line-hover: #50525e;--gemboss-chip-bg-hover: #22232b;--gemboss-success: #34c38f;--gemboss-success-strong: #5fd6a8;--gemboss-success-soft: #13291f;--gemboss-success-border: #22533e;--gemboss-warning: #e0b341;--gemboss-warning-soft: #2b2412;--gemboss-warning-border: #5a4a1d;--gemboss-danger: #ff6b5a;--gemboss-danger-strong: #ff8a7c;--gemboss-danger-soft: #2e1714;--gemboss-danger-border: #5c2a24;--ui-accent-fg: #0d0d12;--ui-warning-fg: #e8c063;--ui-card-shadow: none;--gb-brand-ink: #f2f3f5}:root[data-theme=dark] .gb-avatar[data-tone]{background:color-mix(in srgb,var(--gb-tone) 30%,#16171d);color:color-mix(in srgb,var(--gb-tone) 35%,#ffffff)}:root[data-theme=dark] body{background:var(--gemboss-app-bg);color:var(--gemboss-text)}:root[data-theme=dark] .gb-leaderboard-row.is-first .gb-leaderboard-value,:root[data-theme=dark] .gb-podium-slot--1 .gb-podium-value{color:#e0b341}
|