@bikdotai/bik-component-library 0.0.48-editor.14 → 0.0.48-editor.15
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/CustomEditor/CustomEditor.js +1 -1
- package/dist/cjs/components/searchBar/searchBar.d.ts +0 -1
- package/dist/cjs/components/stepper/WorkingStepper.d.ts +0 -1
- package/dist/esm/components/CustomEditor/CustomEditor.js +1 -1
- package/dist/esm/components/searchBar/searchBar.d.ts +0 -1
- package/dist/esm/components/stepper/WorkingStepper.d.ts +0 -1
- package/package.json +1 -1
|
@@ -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"),
|
|
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("./CustomEditorHeader.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]:"~"},f=s.default.forwardRef(((n,c)=>{var s,f,{onChange:h,text:g,RightComponent:p,error:m,limit:C,onError:x,rows:j,actions:E}=n,y=e.__rest(n,["onChange","text","RightComponent","error","limit","onError","rows","actions"]);const O=r.useRef(null);function T(e){const t=null==O?void 0:O.current;null!=t&&(t.selectionStart?(t.focus(),t.setSelectionRange(e,e)):t.focus())}function S(e){var t,n;let r=null!==(n=null===(t=O.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(O.current&&e){const t=O.current.selectionStart,n=O.current.selectionEnd,l=e;if(t===n)return L(l);{r=d.wrappWildcard(t,n,l,r);const e=d.getHTML(r);return O.current.value=r,{text:r,html:e}}}return{text:r,html:r}}function L(e){var t,n;let r=null!==(n=null===(t=O.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(O.current&&e){const t=O.current.selectionStart;if(t===O.current.selectionEnd)return R(e,t)}return{text:r,html:r}}function R(e,t){var n,r;let l=null!==(r=null===(n=O.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 O.current.value=l,{text:l,html:o}}return r.useImperativeHandle(c,(()=>({addTextOrWrap:S,addText:L,get(){var e,t;return null!==(t=null===(e=O.current)||void 0===e?void 0:e.value)&&void 0!==t?t:""},setCaretPosition:T}))),r.useEffect((()=>{if((null==O?void 0:O.current)&&g){O.current.value=g;const e=d.getHTML(g);null==h||h(g,e)}}),[]),r.useEffect((()=>{var e,t;(null===(e=null==O?void 0:O.current)||void 0===e?void 0:e.value)&&C&&((null===(t=null==O?void 0:O.current)||void 0===t?void 0:t.value.length)>C?null==x||x(a):null==x||x(null!=m?m:""))}),[null===(s=null==O?void 0:O.current)||void 0===s?void 0:s.value.length]),t.jsxs(i.OuterContainer,{children:[t.jsxs(i.Container,Object.assign({isError:!!m},{children:[t.jsx(u.CustomEditorHeader,{actions:E,ref:O,onActionSelect:function(e){if((null==v?void 0:v[e])&&O.current){const t=O.current.selectionStart;if(t===O.current.selectionEnd){R(null==v?void 0:v[e],t);const{text:n,html:r}=R(null==v?void 0:v[e],t);T(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:p,onEmojiClick:function(e){const{text:t,html:n}=L(e);null==h||h(t,n)}}),t.jsx(i.TextSpace,Object.assign({ref:O,onChange:function(e){const t=e.target.value,n=d.getHTML(t);null==h||h(t,n)}},y,{rows:j}))]})),m&&m!==a?t.jsx(o.BodyCaption,Object.assign({style:{color:l.COLORS.content.negative}},{children:m})):t.jsx(t.Fragment,{children:C&&(null==O?void 0:O.current)?t.jsxs(o.BodyCaption,Object.assign({style:{color:m===a||(null===(f=null==O?void 0:O.current)||void 0===f?void 0:f.value.length)>C?l.COLORS.content.negative:l.COLORS.content.secondary}},{children:[O.current.value.length,"/",C]})):t.jsx(t.Fragment,{})})]})}));f.displayName="CustomEditor",exports.CustomEditor=f;
|
|
@@ -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
|
|
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,CustomEditorHeader as f}from"./CustomEditorHeader.js";const g="Character limit reached",p=new l,C={[h.BOLD]:"*",[h.ITALIC]:"_",[h.STRIKETHROUGH]:"~"},x=o.forwardRef(((l,o)=>{var h,x,{onChange:j,text:E,RightComponent:T,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.setSelectionRange(t,t)):n.focus())}function M(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 I(l);{r=p.wrappWildcard(n,e,l,r);const t=p.getHTML(r);return w.current.value=r,{text:r,html:t}}}return{text:r,html:r}}function I(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 W(t,n)}return{text:r,html:r}}function W(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=p.getHTML(l);return w.current.value=l,{text:l,html:o}}return u(o,(()=>({addTextOrWrap:M,addText:I,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((null==w?void 0:w.current)&&E){w.current.value=E;const t=p.getHTML(E);null==j||j(E,t)}}),[]),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(g):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==C?void 0:C[t])&&w.current){const n=w.current.selectionStart;if(n===w.current.selectionEnd){W(null==C?void 0:C[t],n);const{text:e,html:r}=W(null==C?void 0:C[t],n);b(n+1),null==j||j(e,r)}else{const{text:n,html:e}=M(null==C?void 0:C[t]);null==j||j(n,e)}}},RightComponent:T,onEmojiClick:function(t){const{text:n,html:e}=I(t);null==j||j(n,e)}}),e(m,Object.assign({ref:w,onChange:function(t){const n=t.target.value,e=p.getHTML(n);null==j||j(n,e)}},R,{rows:L}))]})),y&&y!==g?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===g||(null===(x=null==w?void 0:w.current)||void 0===x?void 0:x.value.length)>S?s.content.negative:s.content.secondary}},{children:[w.current.value.length,"/",S]})):e(r,{})})]})}));x.displayName="CustomEditor";export{x as CustomEditor};
|