@bikdotai/bik-component-library 0.0.220 → 0.0.222
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/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/editor/mail/mailRTE.js +1 -1
- package/dist/cjs/components/stepper/WorkingStepper.d.ts +0 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/editor/mail/mailRTE.js +1 -1
- package/dist/esm/components/stepper/WorkingStepper.d.ts +0 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("emoji-picker-react"),i=require("react"),n=require("react-quill"),l=require("../../button/Button.js"),a=require("../../tooltips/Tooltip.js"),r=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js"),c=require("../../../assets/icons/cross.svg.js"),d=require("../../../assets/icons/paperclip.svg.js"),u=require("../../../assets/icons/smile_emoji.svg.js"),j=require("./MailRTE.styled.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=m(s),b=m(i);const h=e=>{const{fileName:s,uploadState:i,removeAttachment:n}=e;return t.jsx(t.Fragment,{children:t.jsxs(j.AttachmentContainer,{children:[t.jsx(j.AttachmentName,Object.assign({numberOfLines:1,style:{flex:1}},{children:s})),"loading"!==i.status&&t.jsx(r.BodyCaption,Object.assign({style:{flex:1}},{children:v(i.size)})),"loading"===i.status&&t.jsx(j.ProgressIndicatorContainer,{children:t.jsx(j.OuterProgressBarContainer,{children:t.jsx(j.InnerProgressBarContainer,{style:{backgroundColor:o.COLORS.background.brand,width:"60%"}})})}),t.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>n(s)},{children:t.jsx(c.default,{width:16,height:16})}))]})})},v=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(!+e)return"0 Bytes";const s=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,i)).toFixed(s))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][i]}`};exports.GmailRTE=s=>{let{isForwardMail:r,isSendDisabled:c,buttonAction:m,defaultInputText:v,isModalView:x,setErrorToast:f,uploadFile:p,isLoading:y,buttonText:O="Send",skipAttachments:q,initialHtml:C}=s;var N,k,S;const w=i.useRef(null),[B,T]=i.useState(!1),M=b.default.useRef(null),E=i.useRef(),[I,R]=i.useState({}),[_,z]=i.useState(""),[F,L]=i.useState(v||"");i.useEffect((()=>{var e,t;L(null===(t=null===(e=w.current)||void 0===e?void 0:e.unprivilegedEditor)||void 0===t?void 0:t.getText())}),[_]);const A=()=>{T(!B)},P=(null===(S=null===(k=null===(N=null==w?void 0:w.current)||void 0===N?void 0:N.editor)||void 0===k?void 0:k.container)||void 0===S?void 0:S.querySelector(".ql-editor"))||{};E.current=P;const Q=n.Quill.import("formats/font");Q.whitelist=["arial","comic-sans","courier-new","georgia","helvetica","lucida"],n.Quill.register(Q,!0);const V=n.Quill.import("formats/size");V.whitelist=["extra-small","small","medium","large"],n.Quill.register(V,!0),i.useEffect((()=>{C&&E.current&&(E.current.innerHTML=C)}),[E.current]);const G=e=>{const t=I;delete t[e],R(Object.assign({},t))};return t.jsxs(t.Fragment,{children:[t.jsxs(j.EditorContainer,Object.assign({isModalView:x},{children:[t.jsx(j.EditorInnerContainer,Object.assign({isModalView:x},{children:t.jsx(j.ReactQuilStyleContainer,{isModalView:x,ref:w,modules:{toolbar:{container:"#gmail-toolbar"}},onChange:e=>{z(e)},formats:["header","font","size","bold","italic","underline","align","strike","script","blockquote","background","list","bullet","indent","link","image","color","code-block"]})})),!q&&t.jsx("div",Object.assign({className:"attachment__container"},{children:Object.keys(I).map((e=>t.jsx(h,{fileName:e,uploadState:I[e],removeAttachment:G},e)))})),r&&t.jsx(j.ForwardMessageContainer,{children:t.jsx(j.StyledBodySecondary,Object.assign({style:{fontSize:12}},{children:"We cannot currently display the forwarded message thread. It will be visible after sending the message."}))})]})),t.jsxs("div",Object.assign({id:"gmail-toolbar",style:{border:0,display:"flex",zIndex:0,backgroundColor:o.COLORS.surface.subdued}},{children:[t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("button",{className:"ql-bold"}),t.jsx("button",{className:"ql-italic"}),t.jsx("button",{className:"ql-underline"}),t.jsx("button",{className:"ql-strike"})]})),t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("button",{className:"ql-list",value:"ordered"}),t.jsx("button",{className:"ql-list",value:"bullet"}),t.jsx("button",{className:"ql-indent",value:"-1"}),t.jsx("button",{className:"ql-indent",value:"+1"})]})),t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("button",{className:"ql-script",value:"super"}),t.jsx("button",{className:"ql-script",value:"sub"}),t.jsx("button",{className:"ql-blockquote"})]})),t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("select",{className:"ql-align"}),t.jsx("select",{className:"ql-color"}),t.jsx("select",{className:"ql-background"})]}))]})),t.jsx(j.SendConatiner,Object.assign({isModalView:!0},{children:t.jsxs(j.LeftItemsContainer,{children:[t.jsx(l.Button,{style:{marginRight:10},buttonText:O,onClick:()=>{e.__awaiter(void 0,void 0,void 0,(function*(){var e,t;const s=[];Object.keys(I).map((e=>{"finished"===I[e].status&&s.push({filename:e,path:I[e].url})})),(yield m(_,F,s))&&x&&(z(""),L(""),null===(t=null===(e=w.current)||void 0===e?void 0:e.editor)||void 0===t||t.setContents([{insert:"\n"}]),R({}))})).then()},size:"small",disabled:(null==F?void 0:F.length)<=0||c,isLoading:y}),!q&&t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:M,type:"file",name:"file",multiple:!0,style:{display:"none"},onChange:t=>{const s=t.target.files;if(s){const t=[],i=[];Object.values(s).forEach((e=>{e.size<=5242880?i.push(e):t.push(e)})),t.length>0&&f("Files greater than 5mb size are ignored."),i.forEach((t=>(t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e,s;const i=I;i[t.name]={status:"loading"},R(Object.assign({},i));const n=p&&(yield p(t,t.name));return(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.imageUrl)?(i[t.name]={status:"finished",url:null===(s=n.data)||void 0===s?void 0:s.imageUrl,size:null==t?void 0:t.size},R(Object.assign({},i)),n.data.imageUrl):(i[t.name]={status:"error"},R(Object.assign({},i)),null)})))(t)))}}}),p&&t.jsx(a.Tooltip,Object.assign({body:"Attach files",placement:"top"},{children:t.jsx(j.InboxIconContainer,Object.assign({onClick:()=>{(()=>{var e;null===(e=M.current)||void 0===e||e.click()})()}},{children:t.jsx(d.default,{style:{cursor:"pointer"},width:16,height:16,color:o.COLORS.content.secondary})}))}))]}),t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"row",columnGap:16,alignItems:"center"}},{children:t.jsxs("div",Object.assign({style:{position:"relative"}},{children:[t.jsx(a.Tooltip,Object.assign({body:"Emoji",placement:"top"},{children:t.jsx(j.InboxIconContainer,Object.assign({isSelected:!1,onClick:()=>{A()}},{children:t.jsx(u.default,{width:16,height:16,color:o.COLORS.content.secondary})}))})),B&&t.jsx("div",Object.assign({style:{position:"absolute",bottom:40,left:0}},{children:t.jsx(g.default,{onEmojiClick:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("emoji-picker-react"),i=require("react"),n=require("react-quill"),l=require("../../button/Button.js"),a=require("../../tooltips/Tooltip.js"),r=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js"),c=require("../../../assets/icons/cross.svg.js"),d=require("../../../assets/icons/paperclip.svg.js"),u=require("../../../assets/icons/smile_emoji.svg.js"),j=require("./MailRTE.styled.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=m(s),b=m(i);const h=e=>{const{fileName:s,uploadState:i,removeAttachment:n}=e;return t.jsx(t.Fragment,{children:t.jsxs(j.AttachmentContainer,{children:[t.jsx(j.AttachmentName,Object.assign({numberOfLines:1,style:{flex:1}},{children:s})),"loading"!==i.status&&t.jsx(r.BodyCaption,Object.assign({style:{flex:1}},{children:v(i.size)})),"loading"===i.status&&t.jsx(j.ProgressIndicatorContainer,{children:t.jsx(j.OuterProgressBarContainer,{children:t.jsx(j.InnerProgressBarContainer,{style:{backgroundColor:o.COLORS.background.brand,width:"60%"}})})}),t.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>n(s)},{children:t.jsx(c.default,{width:16,height:16})}))]})})},v=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(!+e)return"0 Bytes";const s=t<0?0:t,i=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,i)).toFixed(s))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][i]}`};exports.GmailRTE=s=>{let{isForwardMail:r,isSendDisabled:c,buttonAction:m,defaultInputText:v,isModalView:x,setErrorToast:f,uploadFile:p,isLoading:y,buttonText:O="Send",skipAttachments:q,initialHtml:C}=s;var N,k,S;const w=i.useRef(null),[B,T]=i.useState(!1),M=b.default.useRef(null),E=i.useRef(),[I,R]=i.useState({}),[_,z]=i.useState(""),[F,L]=i.useState(v||"");i.useEffect((()=>{var e,t;L(null===(t=null===(e=w.current)||void 0===e?void 0:e.unprivilegedEditor)||void 0===t?void 0:t.getText())}),[_]);const A=()=>{T(!B)},P=(null===(S=null===(k=null===(N=null==w?void 0:w.current)||void 0===N?void 0:N.editor)||void 0===k?void 0:k.container)||void 0===S?void 0:S.querySelector(".ql-editor"))||{};E.current=P;const Q=n.Quill.import("formats/font");Q.whitelist=["arial","comic-sans","courier-new","georgia","helvetica","lucida"],n.Quill.register(Q,!0);const V=n.Quill.import("formats/size");V.whitelist=["extra-small","small","medium","large"],n.Quill.register(V,!0),i.useEffect((()=>{C&&E.current&&(E.current.innerHTML=C)}),[E.current]);const G=e=>{const t=I;delete t[e],R(Object.assign({},t))};return t.jsxs(t.Fragment,{children:[t.jsxs(j.EditorContainer,Object.assign({isModalView:x},{children:[t.jsx(j.EditorInnerContainer,Object.assign({isModalView:x},{children:t.jsx(j.ReactQuilStyleContainer,{isModalView:x,ref:w,modules:{toolbar:{container:"#gmail-toolbar"}},onChange:e=>{z(e)},formats:["header","font","size","bold","italic","underline","align","strike","script","blockquote","background","list","bullet","indent","link","image","color","code-block"]})})),!q&&t.jsx("div",Object.assign({className:"attachment__container"},{children:Object.keys(I).map((e=>t.jsx(h,{fileName:e,uploadState:I[e],removeAttachment:G},e)))})),r&&t.jsx(j.ForwardMessageContainer,{children:t.jsx(j.StyledBodySecondary,Object.assign({style:{fontSize:12}},{children:"We cannot currently display the forwarded message thread. It will be visible after sending the message."}))})]})),t.jsxs("div",Object.assign({id:"gmail-toolbar",style:{border:0,display:"flex",zIndex:0,backgroundColor:o.COLORS.surface.subdued}},{children:[t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("button",{className:"ql-bold"}),t.jsx("button",{className:"ql-italic"}),t.jsx("button",{className:"ql-underline"}),t.jsx("button",{className:"ql-strike"})]})),t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("button",{className:"ql-list",value:"ordered"}),t.jsx("button",{className:"ql-list",value:"bullet"}),t.jsx("button",{className:"ql-indent",value:"-1"}),t.jsx("button",{className:"ql-indent",value:"+1"})]})),t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("button",{className:"ql-script",value:"super"}),t.jsx("button",{className:"ql-script",value:"sub"}),t.jsx("button",{className:"ql-blockquote"})]})),t.jsxs("span",Object.assign({className:"ql-formats"},{children:[t.jsx("select",{className:"ql-align"}),t.jsx("select",{className:"ql-color"}),t.jsx("select",{className:"ql-background"})]}))]})),t.jsx(j.SendConatiner,Object.assign({isModalView:!0},{children:t.jsxs(j.LeftItemsContainer,{children:[t.jsx(l.Button,{style:{marginRight:10},buttonText:O,onClick:()=>{e.__awaiter(void 0,void 0,void 0,(function*(){var e,t;const s=[];Object.keys(I).map((e=>{"finished"===I[e].status&&s.push({filename:e,path:I[e].url})})),(yield m(_,F,s))&&x&&(z(""),L(""),null===(t=null===(e=w.current)||void 0===e?void 0:e.editor)||void 0===t||t.setContents([{insert:"\n"}]),R({}))})).then()},size:"small",disabled:(null==F?void 0:F.length)<=0||c,isLoading:y}),!q&&t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:M,type:"file",name:"file",multiple:!0,style:{display:"none"},onChange:t=>{const s=t.target.files;if(s){const t=[],i=[];Object.values(s).forEach((e=>{e.size<=5242880?i.push(e):t.push(e)})),t.length>0&&f("Files greater than 5mb size are ignored."),i.forEach((t=>(t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e,s;const i=I;i[t.name]={status:"loading"},R(Object.assign({},i));const n=p&&(yield p(t,t.name));return(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.imageUrl)?(i[t.name]={status:"finished",url:null===(s=n.data)||void 0===s?void 0:s.imageUrl,size:null==t?void 0:t.size},R(Object.assign({},i)),n.data.imageUrl):(i[t.name]={status:"error"},R(Object.assign({},i)),null)})))(t)))}}}),p&&t.jsx(a.Tooltip,Object.assign({body:"Attach files",placement:"top"},{children:t.jsx(j.InboxIconContainer,Object.assign({onClick:()=>{(()=>{var e;null===(e=M.current)||void 0===e||e.click()})()}},{children:t.jsx(d.default,{style:{cursor:"pointer"},width:16,height:16,color:o.COLORS.content.secondary})}))}))]}),t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"row",columnGap:16,alignItems:"center"}},{children:t.jsxs("div",Object.assign({style:{position:"relative"}},{children:[t.jsx(a.Tooltip,Object.assign({body:"Emoji",placement:"top"},{children:t.jsx(j.InboxIconContainer,Object.assign({isSelected:!1,onClick:()=>{A()}},{children:t.jsx(u.default,{width:16,height:16,color:o.COLORS.content.secondary})}))})),B&&t.jsx("div",Object.assign({style:{position:"absolute",bottom:40,left:0}},{children:t.jsx(g.default,{onEmojiClick:e=>{var t,s,i,n,l;null===(t=null==w?void 0:w.current)||void 0===t||t.focus();const a=null===(i=null===(s=w.current)||void 0===s?void 0:s.editor)||void 0===i?void 0:i.getSelection();a&&(null===(l=null===(n=w.current)||void 0===n?void 0:n.editor)||void 0===l||l.insertText(null==a?void 0:a.index,e.emoji)),A(),z(P.innerText)}})}))]}))}))]})}))]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as t,Fragment as i,jsx as l}from"react/jsx-runtime";import s from"emoji-picker-react";import n,{useRef as o,useState as a,useEffect as r}from"react";import{Quill as c}from"react-quill";import{Button as d}from"../../button/Button.js";import{Tooltip as u}from"../../tooltips/Tooltip.js";import{BodyCaption as m}from"../../TypographyStyle.js";import{COLORS as g}from"../../../constants/Theme.js";import b from"../../../assets/icons/cross.svg.js";import h from"../../../assets/icons/paperclip.svg.js";import v from"../../../assets/icons/smile_emoji.svg.js";import{EditorContainer as p,EditorInnerContainer as f,ReactQuilStyleContainer as j,ForwardMessageContainer as y,StyledBodySecondary as O,SendConatiner as q,LeftItemsContainer as k,InboxIconContainer as N,AttachmentContainer as w,AttachmentName as x,ProgressIndicatorContainer as M,OuterProgressBarContainer as T,InnerProgressBarContainer as B}from"./MailRTE.styled.js";const z=m=>{let{isForwardMail:b,isSendDisabled:w,buttonAction:x,defaultInputText:M,isModalView:T,setErrorToast:B,uploadFile:z,isLoading:S,buttonText:E="Send",skipAttachments:A,initialHtml:F}=m;var V,_,I;const L=o(null),[R,U]=a(!1),D=n.useRef(null),G=o(),[H,$]=a({}),[K,P]=a(""),[W,Y]=a(M||"");r((()=>{var e,t;Y(null===(t=null===(e=L.current)||void 0===e?void 0:e.unprivilegedEditor)||void 0===t?void 0:t.getText())}),[K]);const Z=()=>{U(!R)},J=(null===(I=null===(_=null===(V=null==L?void 0:L.current)||void 0===V?void 0:V.editor)||void 0===_?void 0:_.container)||void 0===I?void 0:I.querySelector(".ql-editor"))||{};G.current=J;const Q=c.import("formats/font");Q.whitelist=["arial","comic-sans","courier-new","georgia","helvetica","lucida"],c.register(Q,!0);const X=c.import("formats/size");X.whitelist=["extra-small","small","medium","large"],c.register(X,!0),r((()=>{F&&G.current&&(G.current.innerHTML=F)}),[G.current]);const ee=e=>{const t=H;delete t[e],$(Object.assign({},t))};return t(i,{children:[t(p,Object.assign({isModalView:T},{children:[l(f,Object.assign({isModalView:T},{children:l(j,{isModalView:T,ref:L,modules:{toolbar:{container:"#gmail-toolbar"}},onChange:e=>{P(e)},formats:["header","font","size","bold","italic","underline","align","strike","script","blockquote","background","list","bullet","indent","link","image","color","code-block"]})})),!A&&l("div",Object.assign({className:"attachment__container"},{children:Object.keys(H).map((e=>l(C,{fileName:e,uploadState:H[e],removeAttachment:ee},e)))})),b&&l(y,{children:l(O,Object.assign({style:{fontSize:12}},{children:"We cannot currently display the forwarded message thread. It will be visible after sending the message."}))})]})),t("div",Object.assign({id:"gmail-toolbar",style:{border:0,display:"flex",zIndex:0,backgroundColor:g.surface.subdued}},{children:[t("span",Object.assign({className:"ql-formats"},{children:[l("button",{className:"ql-bold"}),l("button",{className:"ql-italic"}),l("button",{className:"ql-underline"}),l("button",{className:"ql-strike"})]})),t("span",Object.assign({className:"ql-formats"},{children:[l("button",{className:"ql-list",value:"ordered"}),l("button",{className:"ql-list",value:"bullet"}),l("button",{className:"ql-indent",value:"-1"}),l("button",{className:"ql-indent",value:"+1"})]})),t("span",Object.assign({className:"ql-formats"},{children:[l("button",{className:"ql-script",value:"super"}),l("button",{className:"ql-script",value:"sub"}),l("button",{className:"ql-blockquote"})]})),t("span",Object.assign({className:"ql-formats"},{children:[l("select",{className:"ql-align"}),l("select",{className:"ql-color"}),l("select",{className:"ql-background"})]}))]})),l(q,Object.assign({isModalView:!0},{children:t(k,{children:[l(d,{style:{marginRight:10},buttonText:E,onClick:()=>{e(void 0,void 0,void 0,(function*(){var e,t;const i=[];Object.keys(H).map((e=>{"finished"===H[e].status&&i.push({filename:e,path:H[e].url})})),(yield x(K,W,i))&&T&&(P(""),Y(""),null===(t=null===(e=L.current)||void 0===e?void 0:e.editor)||void 0===t||t.setContents([{insert:"\n"}]),$({}))})).then()},size:"small",disabled:(null==W?void 0:W.length)<=0||w,isLoading:S}),!A&&t(i,{children:[l("input",{ref:D,type:"file",name:"file",multiple:!0,style:{display:"none"},onChange:t=>{const i=t.target.files;if(i){const t=[],l=[];Object.values(i).forEach((e=>{e.size<=5242880?l.push(e):t.push(e)})),t.length>0&&B("Files greater than 5mb size are ignored."),l.forEach((t=>(t=>e(void 0,void 0,void 0,(function*(){var e,i;const l=H;l[t.name]={status:"loading"},$(Object.assign({},l));const s=z&&(yield z(t,t.name));return(null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.imageUrl)?(l[t.name]={status:"finished",url:null===(i=s.data)||void 0===i?void 0:i.imageUrl,size:null==t?void 0:t.size},$(Object.assign({},l)),s.data.imageUrl):(l[t.name]={status:"error"},$(Object.assign({},l)),null)})))(t)))}}}),z&&l(u,Object.assign({body:"Attach files",placement:"top"},{children:l(N,Object.assign({onClick:()=>{(()=>{var e;null===(e=D.current)||void 0===e||e.click()})()}},{children:l(h,{style:{cursor:"pointer"},width:16,height:16,color:g.content.secondary})}))}))]}),l("div",Object.assign({style:{display:"flex",flexDirection:"row",columnGap:16,alignItems:"center"}},{children:t("div",Object.assign({style:{position:"relative"}},{children:[l(u,Object.assign({body:"Emoji",placement:"top"},{children:l(N,Object.assign({isSelected:!1,onClick:()=>{Z()}},{children:l(v,{width:16,height:16,color:g.content.secondary})}))})),R&&l("div",Object.assign({style:{position:"absolute",bottom:40,left:0}},{children:l(s,{onEmojiClick:
|
|
1
|
+
import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as t,Fragment as i,jsx as l}from"react/jsx-runtime";import s from"emoji-picker-react";import n,{useRef as o,useState as a,useEffect as r}from"react";import{Quill as c}from"react-quill";import{Button as d}from"../../button/Button.js";import{Tooltip as u}from"../../tooltips/Tooltip.js";import{BodyCaption as m}from"../../TypographyStyle.js";import{COLORS as g}from"../../../constants/Theme.js";import b from"../../../assets/icons/cross.svg.js";import h from"../../../assets/icons/paperclip.svg.js";import v from"../../../assets/icons/smile_emoji.svg.js";import{EditorContainer as p,EditorInnerContainer as f,ReactQuilStyleContainer as j,ForwardMessageContainer as y,StyledBodySecondary as O,SendConatiner as q,LeftItemsContainer as k,InboxIconContainer as N,AttachmentContainer as w,AttachmentName as x,ProgressIndicatorContainer as M,OuterProgressBarContainer as T,InnerProgressBarContainer as B}from"./MailRTE.styled.js";const z=m=>{let{isForwardMail:b,isSendDisabled:w,buttonAction:x,defaultInputText:M,isModalView:T,setErrorToast:B,uploadFile:z,isLoading:S,buttonText:E="Send",skipAttachments:A,initialHtml:F}=m;var V,_,I;const L=o(null),[R,U]=a(!1),D=n.useRef(null),G=o(),[H,$]=a({}),[K,P]=a(""),[W,Y]=a(M||"");r((()=>{var e,t;Y(null===(t=null===(e=L.current)||void 0===e?void 0:e.unprivilegedEditor)||void 0===t?void 0:t.getText())}),[K]);const Z=()=>{U(!R)},J=(null===(I=null===(_=null===(V=null==L?void 0:L.current)||void 0===V?void 0:V.editor)||void 0===_?void 0:_.container)||void 0===I?void 0:I.querySelector(".ql-editor"))||{};G.current=J;const Q=c.import("formats/font");Q.whitelist=["arial","comic-sans","courier-new","georgia","helvetica","lucida"],c.register(Q,!0);const X=c.import("formats/size");X.whitelist=["extra-small","small","medium","large"],c.register(X,!0),r((()=>{F&&G.current&&(G.current.innerHTML=F)}),[G.current]);const ee=e=>{const t=H;delete t[e],$(Object.assign({},t))};return t(i,{children:[t(p,Object.assign({isModalView:T},{children:[l(f,Object.assign({isModalView:T},{children:l(j,{isModalView:T,ref:L,modules:{toolbar:{container:"#gmail-toolbar"}},onChange:e=>{P(e)},formats:["header","font","size","bold","italic","underline","align","strike","script","blockquote","background","list","bullet","indent","link","image","color","code-block"]})})),!A&&l("div",Object.assign({className:"attachment__container"},{children:Object.keys(H).map((e=>l(C,{fileName:e,uploadState:H[e],removeAttachment:ee},e)))})),b&&l(y,{children:l(O,Object.assign({style:{fontSize:12}},{children:"We cannot currently display the forwarded message thread. It will be visible after sending the message."}))})]})),t("div",Object.assign({id:"gmail-toolbar",style:{border:0,display:"flex",zIndex:0,backgroundColor:g.surface.subdued}},{children:[t("span",Object.assign({className:"ql-formats"},{children:[l("button",{className:"ql-bold"}),l("button",{className:"ql-italic"}),l("button",{className:"ql-underline"}),l("button",{className:"ql-strike"})]})),t("span",Object.assign({className:"ql-formats"},{children:[l("button",{className:"ql-list",value:"ordered"}),l("button",{className:"ql-list",value:"bullet"}),l("button",{className:"ql-indent",value:"-1"}),l("button",{className:"ql-indent",value:"+1"})]})),t("span",Object.assign({className:"ql-formats"},{children:[l("button",{className:"ql-script",value:"super"}),l("button",{className:"ql-script",value:"sub"}),l("button",{className:"ql-blockquote"})]})),t("span",Object.assign({className:"ql-formats"},{children:[l("select",{className:"ql-align"}),l("select",{className:"ql-color"}),l("select",{className:"ql-background"})]}))]})),l(q,Object.assign({isModalView:!0},{children:t(k,{children:[l(d,{style:{marginRight:10},buttonText:E,onClick:()=>{e(void 0,void 0,void 0,(function*(){var e,t;const i=[];Object.keys(H).map((e=>{"finished"===H[e].status&&i.push({filename:e,path:H[e].url})})),(yield x(K,W,i))&&T&&(P(""),Y(""),null===(t=null===(e=L.current)||void 0===e?void 0:e.editor)||void 0===t||t.setContents([{insert:"\n"}]),$({}))})).then()},size:"small",disabled:(null==W?void 0:W.length)<=0||w,isLoading:S}),!A&&t(i,{children:[l("input",{ref:D,type:"file",name:"file",multiple:!0,style:{display:"none"},onChange:t=>{const i=t.target.files;if(i){const t=[],l=[];Object.values(i).forEach((e=>{e.size<=5242880?l.push(e):t.push(e)})),t.length>0&&B("Files greater than 5mb size are ignored."),l.forEach((t=>(t=>e(void 0,void 0,void 0,(function*(){var e,i;const l=H;l[t.name]={status:"loading"},$(Object.assign({},l));const s=z&&(yield z(t,t.name));return(null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.imageUrl)?(l[t.name]={status:"finished",url:null===(i=s.data)||void 0===i?void 0:i.imageUrl,size:null==t?void 0:t.size},$(Object.assign({},l)),s.data.imageUrl):(l[t.name]={status:"error"},$(Object.assign({},l)),null)})))(t)))}}}),z&&l(u,Object.assign({body:"Attach files",placement:"top"},{children:l(N,Object.assign({onClick:()=>{(()=>{var e;null===(e=D.current)||void 0===e||e.click()})()}},{children:l(h,{style:{cursor:"pointer"},width:16,height:16,color:g.content.secondary})}))}))]}),l("div",Object.assign({style:{display:"flex",flexDirection:"row",columnGap:16,alignItems:"center"}},{children:t("div",Object.assign({style:{position:"relative"}},{children:[l(u,Object.assign({body:"Emoji",placement:"top"},{children:l(N,Object.assign({isSelected:!1,onClick:()=>{Z()}},{children:l(v,{width:16,height:16,color:g.content.secondary})}))})),R&&l("div",Object.assign({style:{position:"absolute",bottom:40,left:0}},{children:l(s,{onEmojiClick:e=>{var t,i,l,s,n;null===(t=null==L?void 0:L.current)||void 0===t||t.focus();const o=null===(l=null===(i=L.current)||void 0===i?void 0:i.editor)||void 0===l?void 0:l.getSelection();o&&(null===(n=null===(s=L.current)||void 0===s?void 0:s.editor)||void 0===n||n.insertText(null==o?void 0:o.index,e.emoji)),Z(),P(J.innerText)}})}))]}))}))]})}))]})},C=e=>{const{fileName:s,uploadState:n,removeAttachment:o}=e;return l(i,{children:t(w,{children:[l(x,Object.assign({numberOfLines:1,style:{flex:1}},{children:s})),"loading"!==n.status&&l(m,Object.assign({style:{flex:1}},{children:S(n.size)})),"loading"===n.status&&l(M,{children:l(T,{children:l(B,{style:{backgroundColor:g.background.brand,width:"60%"}})})}),l("div",Object.assign({style:{cursor:"pointer"},onClick:()=>o(s)},{children:l(b,{width:16,height:16})}))]})})},S=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(!+e)return"0 Bytes";const i=t<0?0:t,l=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,l)).toFixed(i))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][l]}`};export{z as GmailRTE};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bikdotai/bik-component-library",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.222",
|
|
4
4
|
"description": "Bik Component Library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"bootstrap": "^5.1.3",
|
|
55
55
|
"browser-image-compression": "^2.0.2",
|
|
56
56
|
"chart.js": "^3.9.1",
|
|
57
|
-
"emoji-picker-react": "^
|
|
57
|
+
"emoji-picker-react": "^4.4.9",
|
|
58
58
|
"lodash": "^4.17.21",
|
|
59
59
|
"phone": "^3.1.37",
|
|
60
60
|
"react-bootstrap": "^2.4.0",
|