@bcrumbs.net/bc-chat 1.0.82 → 1.0.83

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/build/index.es.js CHANGED
@@ -444,7 +444,7 @@ i {
444
444
  direction: rtl;
445
445
  }
446
446
  }
447
- `,tt=({text:n,setText:o,config:r,send:s,placeholder:c,autoCompleteEnabled:d,autoCompleteSuggestion:g,onInputChange:p,onAutoCompleteMutate:h})=>{const u=a(null),m="AR"===r?.language,C=i((()=>{const e=u.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);l((()=>{n||(C(),u.current?.focus())}),[C,n]);const b=d&&g&&n;return t(et,{isRTL:m,children:[b&&t("div",{className:"bc-autoCompleteOverlay",children:[n,e("span",{className:"bc-suggestion",children:g})]}),e("textarea",{ref:u,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:c,maxLength:1024,dir:m?"rtl":"ltr",onKeyDown:e=>{if(d&&g&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+g;return o(t),C(),p?.(t),void h?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=u.current?.selectionStart||0,i=n.slice(0,t)+"\n"+n.slice(t);return o(i),C(),void p?.(i)}"Enter"===e.key&&(e.preventDefault(),s(),C())},onChange:e=>{const t=e.target.value,i=n||"";if(o(t),C(),p?.(t),d&&g&&h){const e=i+g;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?h(n):h(null)}else h(null)}},style:{color:b?"transparent":void 0}})]})},nt=({config:n,send:o,file:i,isFileSelected:a,text:r,setText:l,cancelFileUpload:s,noteMode:c,onCloseNoteMode:d,notePlaceholder:g,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m})=>{const C="AR"===n?.language,b=Array.isArray(i)?i:i?[i]:[],f=b.length>0;return t("div",{className:"bc-messageInput "+(C?"bc-RTL":""),children:[c?e(Ye,{onClick:d,isRTL:C,children:e(Xe,{})}):null,f?e(_e,{children:b.map(((t,o)=>e($e,{file:t,isFileSelected:a,cancelFileUpload:s,config:n},`${t.fileName}-${o}-${t.fileUrl}`)))}):null,f?null:e(tt,{text:r||"",setText:l,config:n,send:o,placeholder:c?g||$[n.language]?.notePlaceholder:n.inputPlaceholder||$[n.language]?.placeholder,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m}),e(Qe,{onClick:()=>o(),isRTL:C,children:r||f?e(Oe,{}):null})]})},ot=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,it="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.button`
447
+ `,tt=({text:n,setText:o,config:r,send:s,placeholder:c,autoCompleteEnabled:d,autoCompleteSuggestion:g,onInputChange:p,onAutoCompleteMutate:h})=>{const u=a(null),m="AR"===r?.language,C=i((()=>{const e=u.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);l((()=>{n||(C(),u.current?.focus())}),[C,n]),l((()=>{d&&u.current&&u.current.focus()}),[d,g]);const b=Boolean(d&&g);return t(et,{isRTL:m,children:[b&&t("div",{className:"bc-autoCompleteOverlay",children:[n,e("span",{className:"bc-suggestion",children:g})]}),e("textarea",{ref:u,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:c,maxLength:1024,dir:m?"rtl":"ltr",onKeyDown:e=>{if(d&&g&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+g;return o(t),C(),p?.(t),void h?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=u.current?.selectionStart||0,i=n.slice(0,t)+"\n"+n.slice(t);return o(i),C(),void p?.(i)}"Enter"===e.key&&(e.preventDefault(),s(),C())},onChange:e=>{const t=e.target.value,i=n||"";if(o(t),C(),p?.(t),d&&g&&h){const e=i+g;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?h(n):h(null)}else h(null)}},style:{color:b?"transparent":void 0}})]})},nt=({config:n,send:o,file:i,isFileSelected:a,text:r,setText:l,cancelFileUpload:s,noteMode:c,onCloseNoteMode:d,notePlaceholder:g,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m})=>{const C="AR"===n?.language,b=Array.isArray(i)?i:i?[i]:[],f=b.length>0;return t("div",{className:"bc-messageInput "+(C?"bc-RTL":""),children:[c?e(Ye,{onClick:d,isRTL:C,children:e(Xe,{})}):null,f?e(_e,{children:b.map(((t,o)=>e($e,{file:t,isFileSelected:a,cancelFileUpload:s,config:n},`${t.fileName}-${o}-${t.fileUrl}`)))}):null,f?null:e(tt,{text:r||"",setText:l,config:n,send:o,placeholder:c?g||$[n.language]?.notePlaceholder:n.inputPlaceholder||$[n.language]?.placeholder,autoCompleteEnabled:p,autoCompleteSuggestion:h,onInputChange:u,onAutoCompleteMutate:m}),e(Qe,{onClick:()=>o(),isRTL:C,children:r||f?e(Oe,{}):null})]})},ot=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,it="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.button`
448
448
  ${it}
449
449
  height: 32px;
450
450
  min-height: 32px;
@@ -576,7 +576,7 @@ i {
576
576
  color: #111827;
577
577
  outline: none;
578
578
  }
579
- `,Et=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),Rt=({config:n,sendMessage:a,setView:s,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,notePlaceholder:h,replyMessageTitle:u,replyMessageContent:m,onCancelReplyMessage:b,autoCompleteEnabled:f,autoCompleteSuggestion:x,onInputChange:v,onAutoCompleteMutate:y})=>{const w="AR"===n?.language,[M,A]=r(),[k,L]=r([]),[I,E]=r(),[R,S]=r(0),F=o((()=>Boolean(u||m)),[u,m]),D=o((()=>u||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,u]),B=o((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);l((()=>{I&&M&&M.trim().length>0&&E(void 0)}),[M]),l((()=>{const e=Array.isArray(k)?k:k?[k]:[];I&&e.length>0&&E(void 0)}),[k,I]);const z=i((e=>{if(d){const e=(M||"").trim();return g&&g(e),void A("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(C.SupportedImageFormats.indexOf(n)>=0?"image":C.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?We(e.blob,S,((n,o)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(o)})):t(e));const n=Array.isArray(k)?k:k?[k]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),o=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let i=o.length+e.length,a=0;o.forEach((e=>{t(e),a++})),e.length>0?e.forEach((e=>{We(e.blob,S,((n,o)=>{if(a++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(`Failed to upload "${e.fileName}": ${o}`);a===i&&(L([]),S(0))}))})):L([])}else a(Ke,M),A("")}),[k,M,a,d,g,L,E,S]);return t(wt,{isRTL:w,children:[F?t(Mt,{isRTL:w,children:[t(At,{isRTL:w,children:[D?e(kt,{children:D}):null,b?e(It,{type:"button",onClick:b,"aria-label":B,title:B,children:e(Et,{})}):null]}),m?e(Lt,{children:m}):null]}):null,e("div",{className:"bc-InputArea",children:e(nt,{config:n,send:z,text:M,setText:A,file:d?void 0:k,isFileSelected:Array.isArray(k)?k.length>0:!!k,cancelFileUpload:e=>{L(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:d,onCloseNoteMode:()=>{A(""),p?.()},notePlaceholder:h,autoCompleteEnabled:f,autoCompleteSuggestion:x,onInputChange:v,onAutoCompleteMutate:y})}),t("div",{className:"bc-BottomBar "+(w?"bc-RTL":""),children:[void 0!==c?c:null,e("div",{className:"bc-CommandsArea "+(w?"bc-RTL":""),children:d?null:e(yt,{setView:s,setFile:L,setProgress:S,setError:E,setText:A,text:M,send:z,config:n})})]}),I?e("div",{className:"bc-uploadFileError",children:I}):null]})},St="bc-chat-header-banner",Ft=390,Dt=c.div`
579
+ `,Et=()=>e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),Rt=({config:n,sendMessage:a,setView:s,actionChips:c,noteMode:d,onNoteSend:g,onCloseNoteMode:p,notePlaceholder:h,replyMessageTitle:u,replyMessageContent:m,onCancelReplyMessage:b,autoCompleteEnabled:f,autoCompleteSuggestion:x,onInputChange:v,onAutoCompleteMutate:y})=>{const w="AR"===n?.language,[M,A]=r(),[k,L]=r([]),[I,E]=r(),[R,S]=r(0),F=o((()=>Boolean(u||m)),[u,m]),D=o((()=>u||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,u]),B=o((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);l((()=>{I&&M&&M.trim().length>0&&E(void 0)}),[I,M]),l((()=>{const e=Array.isArray(k)?k:k?[k]:[];I&&e.length>0&&E(void 0)}),[k,I]);const z=i((e=>{if(d){const e=(M||"").trim();return g&&g(e),void A("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(C.SupportedImageFormats.indexOf(n)>=0?"image":C.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?We(e.blob,S,((n,o)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(o)})):t(e));const n=Array.isArray(k)?k:k?[k]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),o=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let i=o.length+e.length,a=0;o.forEach((e=>{t(e),a++})),e.length>0?e.forEach((e=>{We(e.blob,S,((n,o)=>{if(a++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else o&&E(`Failed to upload "${e.fileName}": ${o}`);a===i&&(L([]),S(0))}))})):L([])}else a(Ke,M),A("")}),[k,M,a,d,g,L,E,S]);return t(wt,{isRTL:w,children:[F?t(Mt,{isRTL:w,children:[t(At,{isRTL:w,children:[D?e(kt,{children:D}):null,b?e(It,{type:"button",onClick:b,"aria-label":B,title:B,children:e(Et,{})}):null]}),m?e(Lt,{children:m}):null]}):null,e("div",{className:"bc-InputArea",children:e(nt,{config:n,send:z,text:M,setText:A,file:d?void 0:k,isFileSelected:Array.isArray(k)?k.length>0:!!k,cancelFileUpload:e=>{L(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:d,onCloseNoteMode:()=>{A(""),p?.()},notePlaceholder:h,autoCompleteEnabled:f,autoCompleteSuggestion:x,onInputChange:v,onAutoCompleteMutate:y})}),t("div",{className:"bc-BottomBar "+(w?"bc-RTL":""),children:[void 0!==c?c:null,e("div",{className:"bc-CommandsArea "+(w?"bc-RTL":""),children:d?null:e(yt,{setView:s,setFile:L,setProgress:S,setError:E,setText:A,text:M,send:z,config:n})})]}),I?e("div",{className:"bc-uploadFileError",children:I}):null]})},St="bc-chat-header-banner",Ft=390,Dt=c.div`
580
580
  ${e=>e.bannerWidth>Ft?"height: 60px;":"height: 90px;"}
581
581
  display: block;
582
582
  width: 100%;
package/build/index.js CHANGED
@@ -444,7 +444,7 @@ i {
444
444
  direction: rtl;
445
445
  }
446
446
  }
447
- `,Xe=({text:n,setText:a,config:o,send:i,placeholder:r,autoCompleteEnabled:s,autoCompleteSuggestion:l,onInputChange:c,onAutoCompleteMutate:d})=>{const g=t.useRef(null),p="AR"===o?.language,u=t.useCallback((()=>{const e=g.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);t.useEffect((()=>{n||(u(),g.current?.focus())}),[u,n]);const h=s&&l&&n;return e.jsxs(qe,{isRTL:p,children:[h&&e.jsxs("div",{className:"bc-autoCompleteOverlay",children:[n,e.jsx("span",{className:"bc-suggestion",children:l})]}),e.jsx("textarea",{ref:g,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:r,maxLength:1024,dir:p?"rtl":"ltr",onKeyDown:e=>{if(s&&l&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+l;return a(t),u(),c?.(t),void d?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=g.current?.selectionStart||0,o=n.slice(0,t)+"\n"+n.slice(t);return a(o),u(),void c?.(o)}"Enter"===e.key&&(e.preventDefault(),i(),u())},onChange:e=>{const t=e.target.value,o=n||"";if(a(t),u(),c?.(t),s&&l&&d){const e=o+l;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?d(n):d(null)}else d(null)}},style:{color:h?"transparent":void 0}})]})},_e=({config:t,send:n,file:a,isFileSelected:o,text:i,setText:r,cancelFileUpload:s,noteMode:l,onCloseNoteMode:c,notePlaceholder:d,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h})=>{const m="AR"===t?.language,C=Array.isArray(a)?a:a?[a]:[],x=C.length>0;return e.jsxs("div",{className:"bc-messageInput "+(m?"bc-RTL":""),children:[l?e.jsx(Je,{onClick:c,isRTL:m,children:e.jsx(Qe,{})}):null,x?e.jsx(Ye,{children:C.map(((n,a)=>e.jsx(Oe,{file:n,isFileSelected:o,cancelFileUpload:s,config:t},`${n.fileName}-${a}-${n.fileUrl}`)))}):null,x?null:e.jsx(Xe,{text:i||"",setText:r,config:t,send:n,placeholder:l?d||O[t.language]?.notePlaceholder:t.inputPlaceholder||O[t.language]?.placeholder,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h}),e.jsx(Ge,{onClick:()=>n(),isRTL:m,children:i||x?e.jsx(Ke,{}):null})]})},$e=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,et="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.default.button`
447
+ `,Xe=({text:n,setText:a,config:o,send:i,placeholder:r,autoCompleteEnabled:s,autoCompleteSuggestion:l,onInputChange:c,onAutoCompleteMutate:d})=>{const g=t.useRef(null),p="AR"===o?.language,u=t.useCallback((()=>{const e=g.current;if(!e)return;e.style.height="20px";const t=e.scrollHeight;t!==e.offsetHeight&&(e.style.height=t+"px")}),[]);t.useEffect((()=>{n||(u(),g.current?.focus())}),[u,n]),t.useEffect((()=>{s&&g.current&&g.current.focus()}),[s,l]);const h=Boolean(s&&l);return e.jsxs(qe,{isRTL:p,children:[h&&e.jsxs("div",{className:"bc-autoCompleteOverlay",children:[n,e.jsx("span",{className:"bc-suggestion",children:l})]}),e.jsx("textarea",{ref:g,value:n,className:"bc-messageInputTextArea",id:"textInput",placeholder:r,maxLength:1024,dir:p?"rtl":"ltr",onKeyDown:e=>{if(s&&l&&("Tab"===e.key||"ArrowRight"===e.key&&!e.shiftKey)){e.preventDefault();const t=(n||"")+l;return a(t),u(),c?.(t),void d?.(null)}if("Enter"===e.key&&(e.shiftKey||e.ctrlKey||e.altKey)){e.preventDefault();const t=g.current?.selectionStart||0,o=n.slice(0,t)+"\n"+n.slice(t);return a(o),u(),void c?.(o)}"Enter"===e.key&&(e.preventDefault(),i(),u())},onChange:e=>{const t=e.target.value,o=n||"";if(a(t),u(),c?.(t),s&&l&&d){const e=o+l;if(t&&e.toLowerCase().startsWith(t.toLowerCase())){const n=e.slice(t.length);n.length>0?d(n):d(null)}else d(null)}},style:{color:h?"transparent":void 0}})]})},_e=({config:t,send:n,file:a,isFileSelected:o,text:i,setText:r,cancelFileUpload:s,noteMode:l,onCloseNoteMode:c,notePlaceholder:d,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h})=>{const m="AR"===t?.language,C=Array.isArray(a)?a:a?[a]:[],x=C.length>0;return e.jsxs("div",{className:"bc-messageInput "+(m?"bc-RTL":""),children:[l?e.jsx(Je,{onClick:c,isRTL:m,children:e.jsx(Qe,{})}):null,x?e.jsx(Ye,{children:C.map(((n,a)=>e.jsx(Oe,{file:n,isFileSelected:o,cancelFileUpload:s,config:t},`${n.fileName}-${a}-${n.fileUrl}`)))}):null,x?null:e.jsx(Xe,{text:i||"",setText:r,config:t,send:n,placeholder:l?d||O[t.language]?.notePlaceholder:t.inputPlaceholder||O[t.language]?.placeholder,autoCompleteEnabled:g,autoCompleteSuggestion:p,onInputChange:u,onAutoCompleteMutate:h}),e.jsx(Ge,{onClick:()=>n(),isRTL:m,children:i||x?e.jsx(Ke,{}):null})]})},$e=(e,t)=>`\n &:hover {\n background-image: ${e.replaceAll("%23a3a3a3",t.activeColor)};\n }\n background-image: ${t.isActive?e.replaceAll("%23a3a3a3",t.activeColor):e};\n`,et="\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: 4px;\nborder-radius: 8px;\nborder: 1px solid #D2D6DB;\nbackground: #FFF;\ntransition: background-color 0.2s ease, border-color 0.2s ease;\ncursor: pointer;\nfont-size: 14px;\n&:hover {\n background: #f7f7f7;\n border-color: #dcdcdc;\n}\n&:active {\n background: #f0f0f0;\n}\n";c.default.button`
448
448
  ${et}
449
449
  height: 32px;
450
450
  min-height: 32px;
@@ -576,7 +576,7 @@ i {
576
576
  color: #111827;
577
577
  outline: none;
578
578
  }
579
- `,At=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),kt=({config:n,sendMessage:a,setView:o,actionChips:i,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:u,autoCompleteEnabled:h,autoCompleteSuggestion:m,onInputChange:C,onAutoCompleteMutate:x})=>{const b="AR"===n?.language,[f,v]=t.useState(),[y,w]=t.useState([]),[M,A]=t.useState(),[k,j]=t.useState(0),L=t.useMemo((()=>Boolean(d||g)),[d,g]),E=t.useMemo((()=>d||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,d]),I=t.useMemo((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);t.useEffect((()=>{M&&f&&f.trim().length>0&&A(void 0)}),[f]),t.useEffect((()=>{const e=Array.isArray(y)?y:y?[y]:[];M&&e.length>0&&A(void 0)}),[y,M]);const R=t.useCallback((e=>{if(r){const e=(f||"").trim();return s&&s(e),void v("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(p.SupportedImageFormats.indexOf(n)>=0?"image":p.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?Ve(e.blob,j,((n,a)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(a)})):t(e));const n=Array.isArray(y)?y:y?[y]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),a=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let o=a.length+e.length,i=0;a.forEach((e=>{t(e),i++})),e.length>0?e.forEach((e=>{Ve(e.blob,j,((n,a)=>{if(i++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(`Failed to upload "${e.fileName}": ${a}`);i===o&&(w([]),j(0))}))})):w([])}else a(Ue,f),v("")}),[y,f,a,r,s,w,A,j]);return e.jsxs(bt,{isRTL:b,children:[L?e.jsxs(ft,{isRTL:b,children:[e.jsxs(vt,{isRTL:b,children:[E?e.jsx(yt,{children:E}):null,u?e.jsx(Mt,{type:"button",onClick:u,"aria-label":I,title:I,children:e.jsx(At,{})}):null]}),g?e.jsx(wt,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(_e,{config:n,send:R,text:f,setText:v,file:r?void 0:y,isFileSelected:Array.isArray(y)?y.length>0:!!y,cancelFileUpload:e=>{w(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:r,onCloseNoteMode:()=>{v(""),l?.()},notePlaceholder:c,autoCompleteEnabled:h,autoCompleteSuggestion:m,onInputChange:C,onAutoCompleteMutate:x})}),e.jsxs("div",{className:"bc-BottomBar "+(b?"bc-RTL":""),children:[void 0!==i?i:null,e.jsx("div",{className:"bc-CommandsArea "+(b?"bc-RTL":""),children:r?null:e.jsx(xt,{setView:o,setFile:w,setProgress:j,setError:A,setText:v,text:f,send:R,config:n})})]}),M?e.jsx("div",{className:"bc-uploadFileError",children:M}):null]})},jt="bc-chat-header-banner",Lt=390,Et=c.default.div`
579
+ `,At=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8 6.58579L11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289C13.0976 3.68342 13.0976 4.31658 12.7071 4.70711L9.41421 8L12.7071 11.2929C13.0976 11.6834 13.0976 12.3166 12.7071 12.7071C12.3166 13.0976 11.6834 13.0976 11.2929 12.7071L8 9.41421L4.70711 12.7071C4.31658 13.0976 3.68342 13.0976 3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929L6.58579 8L3.29289 4.70711C2.90237 4.31658 2.90237 3.68342 3.29289 3.29289C3.68342 2.90237 4.31658 2.90237 4.70711 3.29289L8 6.58579Z",fill:"currentColor"})}),kt=({config:n,sendMessage:a,setView:o,actionChips:i,noteMode:r,onNoteSend:s,onCloseNoteMode:l,notePlaceholder:c,replyMessageTitle:d,replyMessageContent:g,onCancelReplyMessage:u,autoCompleteEnabled:h,autoCompleteSuggestion:m,onInputChange:C,onAutoCompleteMutate:x})=>{const b="AR"===n?.language,[f,v]=t.useState(),[y,w]=t.useState([]),[M,A]=t.useState(),[k,j]=t.useState(0),L=t.useMemo((()=>Boolean(d||g)),[d,g]),E=t.useMemo((()=>d||("AR"===n?.language?"الرد على رسالة":"TR"===n?.language?"Bir mesaja yanıt veriliyor":"Replying to message")),[n?.language,d]),I=t.useMemo((()=>"AR"===n?.language?"إلغاء":"TR"===n?.language?"İptal":"Cancel"),[n?.language]);t.useEffect((()=>{M&&f&&f.trim().length>0&&A(void 0)}),[M,f]),t.useEffect((()=>{const e=Array.isArray(y)?y:y?[y]:[];M&&e.length>0&&A(void 0)}),[y,M]);const R=t.useCallback((e=>{if(r){const e=(f||"").trim();return s&&s(e),void v("")}const t=e=>{const{fileUrl:t,extension:n}=e;a(p.SupportedImageFormats.indexOf(n)>=0?"image":p.SupportedAudioFormats.indexOf(n)>=0?"audio":"document",t)};if(e)return void(e.blob&&e.fileUrl.startsWith("blob:")?Ve(e.blob,j,((n,a)=>{if(n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(a)})):t(e));const n=Array.isArray(y)?y:y?[y]:[];if(n.length>0){const e=n.filter((e=>e.blob&&e.fileUrl.startsWith("blob:"))),a=n.filter((e=>!e.blob||!e.fileUrl.startsWith("blob:")));let o=a.length+e.length,i=0;a.forEach((e=>{t(e),i++})),e.length>0?e.forEach((e=>{Ve(e.blob,j,((n,a)=>{if(i++,n){try{URL.revokeObjectURL(e.fileUrl)}catch{}t({...e,fileUrl:n,blob:void 0})}else a&&A(`Failed to upload "${e.fileName}": ${a}`);i===o&&(w([]),j(0))}))})):w([])}else a(Ue,f),v("")}),[y,f,a,r,s,w,A,j]);return e.jsxs(bt,{isRTL:b,children:[L?e.jsxs(ft,{isRTL:b,children:[e.jsxs(vt,{isRTL:b,children:[E?e.jsx(yt,{children:E}):null,u?e.jsx(Mt,{type:"button",onClick:u,"aria-label":I,title:I,children:e.jsx(At,{})}):null]}),g?e.jsx(wt,{children:g}):null]}):null,e.jsx("div",{className:"bc-InputArea",children:e.jsx(_e,{config:n,send:R,text:f,setText:v,file:r?void 0:y,isFileSelected:Array.isArray(y)?y.length>0:!!y,cancelFileUpload:e=>{w(e?t=>{const n=(Array.isArray(t)?t:t?[t]:[]).filter((t=>!(t.fileName===e.fileName&&t.fileUrl===e.fileUrl)));if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}return n}:e=>((Array.isArray(e)?e:e?[e]:[]).forEach((e=>{if(e.blob&&e.fileUrl.startsWith("blob:"))try{URL.revokeObjectURL(e.fileUrl)}catch{}})),[]))},noteMode:r,onCloseNoteMode:()=>{v(""),l?.()},notePlaceholder:c,autoCompleteEnabled:h,autoCompleteSuggestion:m,onInputChange:C,onAutoCompleteMutate:x})}),e.jsxs("div",{className:"bc-BottomBar "+(b?"bc-RTL":""),children:[void 0!==i?i:null,e.jsx("div",{className:"bc-CommandsArea "+(b?"bc-RTL":""),children:r?null:e.jsx(xt,{setView:o,setFile:w,setProgress:j,setError:A,setText:v,text:f,send:R,config:n})})]}),M?e.jsx("div",{className:"bc-uploadFileError",children:M}):null]})},jt="bc-chat-header-banner",Lt=390,Et=c.default.div`
580
580
  ${e=>e.bannerWidth>Lt?"height: 60px;":"height: 90px;"}
581
581
  display: block;
582
582
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bcrumbs.net/bc-chat",
3
- "version": "1.0.82",
3
+ "version": "1.0.83",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.es.js",
6
6
  "jsnext:main": "build/index.es.js",