@bikdotai/bik-component-library 0.0.419-beta.13 → 0.0.419-beta.14

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("../../helpers/BaseWhatsappContentLang.helper.js"),r=require("react"),l=require("../../constants/Theme.js"),o=require("../TypographyStyle.js"),i=require("./CustomEditor.styled.js"),u=require("./WhatsAppTextEditorHeader.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=c(r);const a="Character limit reached",d=new n.BaseWhatsappContentLangHelper,v={[u.EditorActionTypes.BOLD]:"*",[u.EditorActionTypes.ITALIC]:"_",[u.EditorActionTypes.STRIKETHROUGH]:"~"},p=s.default.forwardRef(((n,c)=>{var s,p,{onChange:h,text:f,RightComponent:g,error:x,limit:j,onError:m,rows:C,actions:E}=n,T=e.__rest(n,["onChange","text","RightComponent","error","limit","onError","rows","actions"]);const y=r.useRef(null);function O(e){const t=null==y?void 0:y.current;null!=t&&(t.selectionStart?(t.focus(),t.selectionEnd=e):t.focus())}function L(e){var t,n;let r=null!==(n=null===(t=y.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(y.current&&e){const t=y.current.selectionStart,n=y.current.selectionEnd,l=e;if(t===n)return S(l);{r=d.wrappWildcard(t,n,l,r);const e=d.getHTML(r);return y.current.value=r,{text:r,html:e}}}return{text:r,html:r}}function S(e){var t,n;let r=null!==(n=null===(t=y.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(y.current&&e){const t=y.current.selectionStart;if(t===y.current.selectionEnd)return H(e,t)}return{text:r,html:r}}function H(e,t){var n,r;let l=null!==(r=null===(n=y.current)||void 0===n?void 0:n.value)&&void 0!==r?r:"";l=l.slice(0,t)+e+l.slice(t);const o=d.getHTML(l);return y.current.value=l,{text:l,html:o}}return r.useImperativeHandle(c,(()=>({addTextOrWrap:L,addText:S,get(){var e,t;return null!==(t=null===(e=y.current)||void 0===e?void 0:e.value)&&void 0!==t?t:""},setCaretPosition:O}))),r.useEffect((()=>{if((null==y?void 0:y.current)&&f){y.current.value=f;const e=d.getHTML(f);null==h||h(f,e)}}),[f]),r.useEffect((()=>{var e,t;(null===(e=null==y?void 0:y.current)||void 0===e?void 0:e.value)&&j&&((null===(t=null==y?void 0:y.current)||void 0===t?void 0:t.value.length)>j?null==m||m(a):null==m||m(null!=x?x:""))}),[null===(s=null==y?void 0:y.current)||void 0===s?void 0:s.value.length]),t.jsxs(i.OuterContainer,{children:[t.jsxs(i.Container,Object.assign({isError:!!x},{children:[t.jsx(u.WhatsAppTextEditorHeader,{actions:E,ref:y,onActionSelect:function(e){if((null==v?void 0:v[e])&&y.current){const t=y.current.selectionStart;if(t===y.current.selectionEnd){H(null==v?void 0:v[e],t);const{text:n,html:r}=H(null==v?void 0:v[e],t);O(t+1),null==h||h(n,r)}else{const{text:t,html:n}=L(null==v?void 0:v[e]);null==h||h(t,n)}}},RightComponent:g,onEmojiClick:function(e){const{text:t,html:n}=S(e);null==h||h(t,n)}}),t.jsx(i.TextSpace,Object.assign({ref:y,onChange:function(e){const t=e.target.value,n=d.getHTML(t);null==h||h(t,n)}},T,{rows:C}))]})),x&&x!==a?t.jsx(o.BodyCaption,Object.assign({style:{color:l.COLORS.content.negative}},{children:x})):t.jsx(t.Fragment,{children:j&&(null==y?void 0:y.current)?t.jsxs(o.BodyCaption,Object.assign({style:{color:x===a||(null===(p=null==y?void 0:y.current)||void 0===p?void 0:p.value.length)>j?l.COLORS.content.negative:l.COLORS.content.secondary}},{children:[y.current.value.length,"/",j]})):t.jsx(t.Fragment,{})})]})}));p.displayName="WhatsAppTextEditor",exports.WhatsAppTextEditor=p;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("../../helpers/BaseWhatsappContentLang.helper.js"),r=require("react"),l=require("../../constants/Theme.js"),o=require("../TypographyStyle.js"),i=require("./CustomEditor.styled.js"),u=require("./WhatsAppTextEditorHeader.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=c(r);const a="Character limit reached",d=new n.BaseWhatsappContentLangHelper,v={[u.EditorActionTypes.BOLD]:"*",[u.EditorActionTypes.ITALIC]:"_",[u.EditorActionTypes.STRIKETHROUGH]:"~"},p=s.default.forwardRef(((n,c)=>{var s,p,{onChange:h,text:f,RightComponent:g,error:x,limit:j,onError:m,rows:C,actions:T}=n,E=e.__rest(n,["onChange","text","RightComponent","error","limit","onError","rows","actions"]);const y=r.useRef(null);function O(e){const t=null==y?void 0:y.current;null!=t&&(t.selectionStart?(t.focus(),t.selectionEnd=e):t.focus())}function S(e){var t,n;let r=null!==(n=null===(t=y.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(y.current&&e){const t=y.current.selectionStart,n=y.current.selectionEnd,l=e;if(t===n)return L(l);{r=d.wrappWildcard(t,n,l,r);const e=d.getHTML(r);return y.current.value=r,{text:r,html:e}}}return{text:r,html:r}}function L(e){var t,n;let r=null!==(n=null===(t=y.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(y.current&&e){const t=y.current.selectionStart;if(t===y.current.selectionEnd)return R(e,t)}return{text:r,html:r}}function R(e,t){var n,r;let l=null!==(r=null===(n=y.current)||void 0===n?void 0:n.value)&&void 0!==r?r:"";l=l.slice(0,t)+e+l.slice(t);const o=d.getHTML(l);return y.current.value=l,{text:l,html:o}}return r.useImperativeHandle(c,(()=>({addTextOrWrap:S,addText:L,get(){var e,t;return null!==(t=null===(e=y.current)||void 0===e?void 0:e.value)&&void 0!==t?t:""},setCaretPosition:O}))),r.useEffect((()=>{if(console.log("defaultText",f),console.log("textSpaceRef",y),(null==y?void 0:y.current)&&f){y.current.value=f;const e=d.getHTML(f);null==h||h(f,e)}}),[f]),r.useEffect((()=>{var e,t;(null===(e=null==y?void 0:y.current)||void 0===e?void 0:e.value)&&j&&((null===(t=null==y?void 0:y.current)||void 0===t?void 0:t.value.length)>j?null==m||m(a):null==m||m(null!=x?x:""))}),[null===(s=null==y?void 0:y.current)||void 0===s?void 0:s.value.length]),t.jsxs(i.OuterContainer,{children:[t.jsxs(i.Container,Object.assign({isError:!!x},{children:[t.jsx(u.WhatsAppTextEditorHeader,{actions:T,ref:y,onActionSelect:function(e){if((null==v?void 0:v[e])&&y.current){const t=y.current.selectionStart;if(t===y.current.selectionEnd){R(null==v?void 0:v[e],t);const{text:n,html:r}=R(null==v?void 0:v[e],t);O(t+1),null==h||h(n,r)}else{const{text:t,html:n}=S(null==v?void 0:v[e]);null==h||h(t,n)}}},RightComponent:g,onEmojiClick:function(e){const{text:t,html:n}=L(e);null==h||h(t,n)}}),t.jsx(i.TextSpace,Object.assign({ref:y,onChange:function(e){const t=e.target.value,n=d.getHTML(t);null==h||h(t,n)}},E,{rows:C}))]})),x&&x!==a?t.jsx(o.BodyCaption,Object.assign({style:{color:l.COLORS.content.negative}},{children:x})):t.jsx(t.Fragment,{children:j&&(null==y?void 0:y.current)?t.jsxs(o.BodyCaption,Object.assign({style:{color:x===a||(null===(p=null==y?void 0:y.current)||void 0===p?void 0:p.value.length)>j?l.COLORS.content.negative:l.COLORS.content.secondary}},{children:[y.current.value.length,"/",j]})):t.jsx(t.Fragment,{})})]})}));p.displayName="WhatsAppTextEditor",exports.WhatsAppTextEditor=p;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as n,jsx as e,Fragment as r}from"react/jsx-runtime";import{BaseWhatsappContentLangHelper as l}from"../../helpers/BaseWhatsappContentLang.helper.js";import o,{useRef as i,useImperativeHandle as u,useEffect as c}from"react";import{COLORS as s}from"../../constants/Theme.js";import{BodyCaption as a}from"../TypographyStyle.js";import{OuterContainer as d,Container as v,TextSpace as m}from"./CustomEditor.styled.js";import{EditorActionTypes as h,WhatsAppTextEditorHeader as f}from"./WhatsAppTextEditorHeader.js";const p="Character limit reached",g=new l,x={[h.BOLD]:"*",[h.ITALIC]:"_",[h.STRIKETHROUGH]:"~"},T=o.forwardRef(((l,o)=>{var h,T,{onChange:j,text:C,RightComponent:E,error:y,limit:H,onError:L,rows:O,actions:S}=l,w=t(l,["onChange","text","RightComponent","error","limit","onError","rows","actions"]);const R=i(null);function b(t){const n=null==R?void 0:R.current;null!=n&&(n.selectionStart?(n.focus(),n.selectionEnd=t):n.focus())}function W(t){var n,e;let r=null!==(e=null===(n=R.current)||void 0===n?void 0:n.value)&&void 0!==e?e:"";if(R.current&&t){const n=R.current.selectionStart,e=R.current.selectionEnd,l=t;if(n===e)return A(l);{r=g.wrappWildcard(n,e,l,r);const t=g.getHTML(r);return R.current.value=r,{text:r,html:t}}}return{text:r,html:r}}function A(t){var n,e;let r=null!==(e=null===(n=R.current)||void 0===n?void 0:n.value)&&void 0!==e?e:"";if(R.current&&t){const n=R.current.selectionStart;if(n===R.current.selectionEnd)return M(t,n)}return{text:r,html:r}}function M(t,n){var e,r;let l=null!==(r=null===(e=R.current)||void 0===e?void 0:e.value)&&void 0!==r?r:"";l=l.slice(0,n)+t+l.slice(n);const o=g.getHTML(l);return R.current.value=l,{text:l,html:o}}return u(o,(()=>({addTextOrWrap:W,addText:A,get(){var t,n;return null!==(n=null===(t=R.current)||void 0===t?void 0:t.value)&&void 0!==n?n:""},setCaretPosition:b}))),c((()=>{if((null==R?void 0:R.current)&&C){R.current.value=C;const t=g.getHTML(C);null==j||j(C,t)}}),[C]),c((()=>{var t,n;(null===(t=null==R?void 0:R.current)||void 0===t?void 0:t.value)&&H&&((null===(n=null==R?void 0:R.current)||void 0===n?void 0:n.value.length)>H?null==L||L(p):null==L||L(null!=y?y:""))}),[null===(h=null==R?void 0:R.current)||void 0===h?void 0:h.value.length]),n(d,{children:[n(v,Object.assign({isError:!!y},{children:[e(f,{actions:S,ref:R,onActionSelect:function(t){if((null==x?void 0:x[t])&&R.current){const n=R.current.selectionStart;if(n===R.current.selectionEnd){M(null==x?void 0:x[t],n);const{text:e,html:r}=M(null==x?void 0:x[t],n);b(n+1),null==j||j(e,r)}else{const{text:n,html:e}=W(null==x?void 0:x[t]);null==j||j(n,e)}}},RightComponent:E,onEmojiClick:function(t){const{text:n,html:e}=A(t);null==j||j(n,e)}}),e(m,Object.assign({ref:R,onChange:function(t){const n=t.target.value,e=g.getHTML(n);null==j||j(n,e)}},w,{rows:O}))]})),y&&y!==p?e(a,Object.assign({style:{color:s.content.negative}},{children:y})):e(r,{children:H&&(null==R?void 0:R.current)?n(a,Object.assign({style:{color:y===p||(null===(T=null==R?void 0:R.current)||void 0===T?void 0:T.value.length)>H?s.content.negative:s.content.secondary}},{children:[R.current.value.length,"/",H]})):e(r,{})})]})}));T.displayName="WhatsAppTextEditor";export{T as WhatsAppTextEditor};
1
+ import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as n,jsx as e,Fragment as r}from"react/jsx-runtime";import{BaseWhatsappContentLangHelper as l}from"../../helpers/BaseWhatsappContentLang.helper.js";import o,{useRef as i,useImperativeHandle as u,useEffect as c}from"react";import{COLORS as s}from"../../constants/Theme.js";import{BodyCaption as a}from"../TypographyStyle.js";import{OuterContainer as d,Container as v,TextSpace as m}from"./CustomEditor.styled.js";import{EditorActionTypes as h,WhatsAppTextEditorHeader as f}from"./WhatsAppTextEditorHeader.js";const p="Character limit reached",g=new l,x={[h.BOLD]:"*",[h.ITALIC]:"_",[h.STRIKETHROUGH]:"~"},T=o.forwardRef(((l,o)=>{var h,T,{onChange:j,text:C,RightComponent:E,error:y,limit:S,onError:H,rows:L,actions:O}=l,R=t(l,["onChange","text","RightComponent","error","limit","onError","rows","actions"]);const w=i(null);function b(t){const n=null==w?void 0:w.current;null!=n&&(n.selectionStart?(n.focus(),n.selectionEnd=t):n.focus())}function W(t){var n,e;let r=null!==(e=null===(n=w.current)||void 0===n?void 0:n.value)&&void 0!==e?e:"";if(w.current&&t){const n=w.current.selectionStart,e=w.current.selectionEnd,l=t;if(n===e)return A(l);{r=g.wrappWildcard(n,e,l,r);const t=g.getHTML(r);return w.current.value=r,{text:r,html:t}}}return{text:r,html:r}}function A(t){var n,e;let r=null!==(e=null===(n=w.current)||void 0===n?void 0:n.value)&&void 0!==e?e:"";if(w.current&&t){const n=w.current.selectionStart;if(n===w.current.selectionEnd)return M(t,n)}return{text:r,html:r}}function M(t,n){var e,r;let l=null!==(r=null===(e=w.current)||void 0===e?void 0:e.value)&&void 0!==r?r:"";l=l.slice(0,n)+t+l.slice(n);const o=g.getHTML(l);return w.current.value=l,{text:l,html:o}}return u(o,(()=>({addTextOrWrap:W,addText:A,get(){var t,n;return null!==(n=null===(t=w.current)||void 0===t?void 0:t.value)&&void 0!==n?n:""},setCaretPosition:b}))),c((()=>{if(console.log("defaultText",C),console.log("textSpaceRef",w),(null==w?void 0:w.current)&&C){w.current.value=C;const t=g.getHTML(C);null==j||j(C,t)}}),[C]),c((()=>{var t,n;(null===(t=null==w?void 0:w.current)||void 0===t?void 0:t.value)&&S&&((null===(n=null==w?void 0:w.current)||void 0===n?void 0:n.value.length)>S?null==H||H(p):null==H||H(null!=y?y:""))}),[null===(h=null==w?void 0:w.current)||void 0===h?void 0:h.value.length]),n(d,{children:[n(v,Object.assign({isError:!!y},{children:[e(f,{actions:O,ref:w,onActionSelect:function(t){if((null==x?void 0:x[t])&&w.current){const n=w.current.selectionStart;if(n===w.current.selectionEnd){M(null==x?void 0:x[t],n);const{text:e,html:r}=M(null==x?void 0:x[t],n);b(n+1),null==j||j(e,r)}else{const{text:n,html:e}=W(null==x?void 0:x[t]);null==j||j(n,e)}}},RightComponent:E,onEmojiClick:function(t){const{text:n,html:e}=A(t);null==j||j(n,e)}}),e(m,Object.assign({ref:w,onChange:function(t){const n=t.target.value,e=g.getHTML(n);null==j||j(n,e)}},R,{rows:L}))]})),y&&y!==p?e(a,Object.assign({style:{color:s.content.negative}},{children:y})):e(r,{children:S&&(null==w?void 0:w.current)?n(a,Object.assign({style:{color:y===p||(null===(T=null==w?void 0:w.current)||void 0===T?void 0:T.value.length)>S?s.content.negative:s.content.secondary}},{children:[w.current.value.length,"/",S]})):e(r,{})})]})}));T.displayName="WhatsAppTextEditor";export{T as WhatsAppTextEditor};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.419-beta.13",
3
+ "version": "0.0.419-beta.14",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",