@instincthub/react-ui 0.1.46 → 0.1.48

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,2 +1,2 @@
1
- import{slicedToArray as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as a,jsx as r}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";var t=function(t){var l=t.id,o=t.name,u=t.label,c=t.value,s=t.onChange,d=t.disabled,p=void 0!==d&&d,m=t.readOnly,h=void 0!==m&&m,v=t.placeholder,f=void 0===v?"0.00":v,b=t.min,g=t.max,y=t.required,N=void 0!==y&&y,x=t.currencySymbol,F=void 0===x?"₦":x,S=t.error,q=t.className,B=void 0===q?"":q,O=t.plainDisplay,$=void 0!==O&&O,_=i(!1),j=e(_,2),C=j[0],w=j[1],A=i(""),D=e(A,2),H=D[0],M=D[1],P=i(0),T=e(P,2),W=T[0],k=T[1],z=function(e){if(""===e||null==e)return"";var a,r="";if("string"==typeof e){var i=e.split(".");i.length>1&&(r="."+i[1]),a=parseFloat(e.replace(/,/g,""))}else a=e;if(isNaN(a))return"";var n=a.toString().split(".")[0].replace(/\B(?=(\d{3})+(?!\d))/g,",");return"string"==typeof e&&r?n+r:"number"==typeof e?n+a.toString().substring(a.toString().indexOf(".")):n};n(function(){if(null!=c&&""!==c){k(Number(c));var e=z(c);M(e)}else M("")},[c]);if($){var E=z(c||0);return a("p",{className:"ihub-amount-plain ".concat(B||""),children:[F,E||"0.00"]})}var G=""!==H,I="ihub-wrapper".concat(G||C?" ihub-value":"").concat(S?" ihub-is_invalid":"").concat(B?" ".concat(B):"");return a("div",{className:I,children:[r("input",{type:"hidden",name:o,value:W}),a("div",{className:"ihub-amount-input-container",children:[r("span",{className:"ihub-currency-symbol ".concat(G||C?"":"ihub-ghost"),children:F}),r("input",{id:l||o,type:"text",value:H,onChange:function(e){var a=e.target.value;if(/^[\d,.]*$/.test(a)){var r=a.replace(/,/g,"");if(/^[0-9]*\.?[0-9]*$/.test(r)){var i=""===r?0:parseFloat(r);if(i!==W){var n=a;a.endsWith(".")||a.match(/\.\d*$/)||(n=z(r)),M(n),k(i),s&&s(i,o)}}}},onFocus:function(){w(!0)},onBlur:function(){if(w(!1),H){var e=function(e){return e?parseFloat(e.replace(/,/g,"")):0}(H),a=z(e.toFixed(2));M(a),s&&s(e,o)}},disabled:p,readOnly:h,placeholder:G||C?f:"",className:"ihub-input ihub-amount-input",required:N,min:b,max:g,inputMode:"decimal"}),a("label",{htmlFor:l||o,className:"ihub-text-label",children:[u,N&&r("span",{className:"ihub-required",children:"*"})]})]}),S&&r("p",{className:"ihub-error-message",children:S})]})};export{t as default};
1
+ import{slicedToArray as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as a,jsx as r}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";var t=function(t){var l=t.id,u=t.name,o=t.label,c=t.value,s=t.onChange,d=t.disabled,p=void 0!==d&&d,m=t.readOnly,v=void 0!==m&&m,h=t.placeholder,f=void 0===h?"0.00":h,b=t.min,g=t.max,y=t.required,N=void 0!==y&&y,x=t.currencySymbol,F=void 0===x?"₦":x,q=t.error,B=t.className,O=void 0===B?"":B,S=t.plainDisplay,$=void 0!==S&&S,_=i(!1),j=e(_,2),C=j[0],w=j[1],A=i(""),D=e(A,2),H=D[0],M=D[1],P=i(0),T=e(P,2),W=T[0],k=T[1],z=function(e){if(""===e||null==e)return"";var a,r="";if("string"==typeof e){var i=e.split(".");i.length>1&&(r="."+i[1]),a=parseFloat(e.replace(/,/g,""))}else a=e;if(isNaN(a))return"";var n=a.toString().split(".")[0].replace(/\B(?=(\d{3})+(?!\d))/g,",");if("string"==typeof e&&r)return n+r;if("number"==typeof e){var t=a.toString(),l=t.indexOf(".");return n+(-1!==l?t.substring(l):"")}return n};n(function(){if(null!=c&&""!==c){k(Number(c));var e=z(c);M(e)}else M("")},[c]);if($){var E=z(c||0);return a("p",{className:"ihub-amount-plain ".concat(O||""),children:[F,E||"0.00"]})}var G=""!==H,I="ihub-wrapper".concat(G||C?" ihub-value":"").concat(q?" ihub-is_invalid":"").concat(O?" ".concat(O):"");return a("div",{className:I,children:[r("input",{type:"hidden",name:u,value:W}),a("div",{className:"ihub-amount-input-container",children:[r("span",{className:"ihub-currency-symbol ".concat(G||C?"":"ihub-ghost"),children:F}),r("input",{id:l||u,type:"text",value:H,onChange:function(e){var a=e.target.value;if(/^[\d,.]*$/.test(a)){var r=a.replace(/,/g,"");if(/^[0-9]*\.?[0-9]*$/.test(r)){var i=""===r?0:parseFloat(r);if(i!==W){var n=a;a.endsWith(".")||a.match(/\.\d*$/)||(n=z(r)),M(n),k(i),s&&s(i,u)}}}},onFocus:function(){w(!0)},onBlur:function(){if(w(!1),H){var e=function(e){return e?parseFloat(e.replace(/,/g,"")):0}(H),a=z(e.toFixed(2));M(a),s&&s(e,u)}},disabled:p,readOnly:v,placeholder:G||C?f:"",className:"ihub-input ihub-amount-input",required:N,min:b,max:g,inputMode:"decimal"}),a("label",{htmlFor:l||u,className:"ihub-text-label",children:[o,N&&r("span",{className:"ihub-required",children:"*"})]})]}),q&&r("p",{className:"ihub-error-message",children:q})]})};export{t as default};
2
2
  //# sourceMappingURL=InputAmount.js.map
@@ -1,2 +1,2 @@
1
- import{slicedToArray as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as a,jsx as i}from"react/jsx-runtime";import{useState as r,useEffect as n}from"react";var o=function(o){var t=o.id,l=o.name,c=o.label,d=o.placeholder,u=o.min,s=o.max,b=o.step,m=void 0===b?1:b,h=o.defaultValue,v=o.value,p=o.required,f=void 0!==p&&p,N=o.disabled,g=void 0!==N&&N,F=o.readOnly,y=void 0!==F&&F,S=o.onChange,x=o.onBlur,C=o.className,q=void 0===C?"":C,B=o.error,j=o.note,k=r(""),O=e(k,2),_=O[0],w=O[1],A=r(!1),D=e(A,2),H=D[0],I=D[1],P=r(!1),T=e(P,2),V=T[0],$=T[1];n(function(){void 0!==v?(w(v.toString()),$(!0)):void 0!==h&&(w(h.toString()),$(!0))},[v,h]);var z="ihub-wrapper ".concat(V||H?"ihub-value":""," ").concat(B?"ihub-error":""," ").concat(q);return a("div",{className:"ihub-mb-2 "+z,children:[a("div",{className:"ihub-number-input-container",children:[i("input",{id:t||l,name:l,type:"text",className:"ihub-input ihub-number-input",value:_,onChange:function(e){var a=e.target.value;if((""===a||/^-?\d*\.?\d*$/.test(a))&&(w(a),$(""!==a),S)){var i=""===a?null:parseFloat(a);S(i)}},onFocus:function(){I(!0)},onBlur:function(e){if(I(!1),""!==_){var a=parseFloat(_);void 0!==u&&a<u?(a=u,w(u.toString())):void 0!==s&&a>s&&(a=s,w(s.toString())),S&&S(a)}x&&x(e)},placeholder:d,disabled:g,readOnly:y,required:f,"aria-invalid":!!B,"aria-describedby":B?"".concat(l,"-error"):void 0}),a("label",{htmlFor:t||l,className:"ihub-text-label",children:[c,f&&i("span",{className:"ihub-required",children:"*"})]}),a("div",{className:"ihub-number-controls",children:[i("button",{type:"button",className:"ihub-number-increment",onClick:function(){if(!g&&!y){var e=(""===_?0:parseFloat(_))+m;void 0!==s&&e>s&&(e=s),w(e.toString()),$(!0),S&&S(e)}},disabled:g||y||void 0!==s&&""!==_&&parseFloat(_)>=s,"aria-label":"Increment",children:i("span",{className:"ihub-control-icon",children:"+"})}),i("button",{type:"button",className:"ihub-number-decrement",onClick:function(){if(!g&&!y){var e=(""===_?0:parseFloat(_))-m;void 0!==u&&e<u&&(e=u),w(e.toString()),$(!0),S&&S(e)}},disabled:g||y||void 0!==u&&""!==_&&parseFloat(_)<=u,"aria-label":"Decrement",children:i("span",{className:"ihub-control-icon",children:"-"})})]})]}),B&&i("div",{className:"ihub-error-message",id:"".concat(l,"-error"),children:B}),j&&i("p",{className:"ihub-input-notes",id:"".concat(l,"-note"),children:j})]})};export{o as default};
1
+ import{slicedToArray as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as r,jsx as i}from"react/jsx-runtime";import{useState as a,useRef as n,useEffect as t}from"react";var o=function(o){var l=o.id,c=o.name,u=o.label,d=o.placeholder,s=o.min,b=o.max,m=o.step,v=void 0===m?1:m,h=o.defaultValue,p=o.value,f=o.required,g=void 0!==f&&f,N=o.disabled,F=void 0!==N&&N,S=o.readOnly,y=void 0!==S&&S,x=o.onChange,C=o.onBlur,q=o.className,B=void 0===q?"":q,j=o.error,k=o.note,O=void 0!==p?p.toString():void 0!==h?h.toString():"",_=a(O),w=e(_,2),A=w[0],D=w[1],H=a(!1),I=e(H,2),P=I[0],T=I[1],V=a(""!==O),$=e(V,2),z=$[0],E=$[1],G=n(!1);t(function(){G.current?G.current=!1:void 0!==p?(D(p.toString()),E(!0)):void 0!==h&&(D(h.toString()),E(!0))},[p,h]);var J="ihub-wrapper ".concat(z||P?"ihub-value":""," ").concat(j?"ihub-error":""," ").concat(B);return r("div",{className:"ihub-mb-2 "+J,children:[r("div",{className:"ihub-number-input-container",children:[i("input",{id:l||c,name:c,type:"text",className:"ihub-input ihub-number-input",value:A,onChange:function(e){var r=e.target.value;if((""===r||/^-?\d*\.?\d*$/.test(r))&&(D(r),E(""!==r),x)){G.current=!0;var i=""===r?null:parseFloat(r);x(i)}},onFocus:function(){T(!0)},onBlur:function(e){if(T(!1),""!==A){var r=parseFloat(A);void 0!==s&&r<s?(r=s,D(s.toString())):void 0!==b&&r>b&&(r=b,D(b.toString())),x&&x(r)}C&&C(e)},placeholder:d,disabled:F,readOnly:y,required:g,"aria-invalid":!!j,"aria-describedby":j?"".concat(c,"-error"):void 0}),r("label",{htmlFor:l||c,className:"ihub-text-label",children:[u,g&&i("span",{className:"ihub-required",children:"*"})]}),r("div",{className:"ihub-number-controls",children:[i("button",{type:"button",className:"ihub-number-increment",onClick:function(){if(!F&&!y){var e=(""===A?0:parseFloat(A))+v;void 0!==b&&e>b&&(e=b),D(e.toString()),E(!0),x&&(G.current=!0,x(e))}},disabled:F||y||void 0!==b&&""!==A&&parseFloat(A)>=b,"aria-label":"Increment",children:i("span",{className:"ihub-control-icon",children:"+"})}),i("button",{type:"button",className:"ihub-number-decrement",onClick:function(){if(!F&&!y){var e=(""===A?0:parseFloat(A))-v;void 0!==s&&e<s&&(e=s),D(e.toString()),E(!0),x&&(G.current=!0,x(e))}},disabled:F||y||void 0!==s&&""!==A&&parseFloat(A)<=s,"aria-label":"Decrement",children:i("span",{className:"ihub-control-icon",children:"-"})})]})]}),j&&i("div",{className:"ihub-error-message",id:"".concat(c,"-error"),children:j}),k&&i("p",{className:"ihub-input-notes",id:"".concat(c,"-note"),children:k})]})};export{o as default};
2
2
  //# sourceMappingURL=InputNumber.js.map
@@ -1,2 +1,2 @@
1
- import{slicedToArray as e,objectSpread2 as a}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as i,jsx as r}from"react/jsx-runtime";import{useState as l,useEffect as t}from"react";var n=function(n){var o=n.label,d=n.name,c=n.value,s=void 0===c?"":c,u=n.placeholder,h=void 0===u?"":u,m=n.required,p=void 0!==m&&m,v=n.type,b=void 0===v?"text":v,f=n.maxLength,x=n.disabled,N=void 0!==x&&x,g=n.readOnly,y=void 0!==g&&g,_=n.className,j=void 0===_?"":_,q=n.textTransform,B=n.error,L=n.onChange,T=n.onBlur,C=n.helperText,O=n.note,w=n.id,A=n.activeLabel,F=void 0!==A&&A,H=l(),P=e(H,2),S=P[0],k=P[1],z=l(F),D=e(z,2),E=D[0],G=D[1];t(function(){G(!!F||!!s),s!==S&&k(s)},[s]);var I={};return q&&(I["data-text-transform"]=q),i("div",a(a({className:"ihub-wrapper ".concat(E?"ihub-value":""," ").concat(B?"ihub-is_invalid":""," ").concat(h?"ihub-has-placeholder":""," ").concat(j)},I),{},{children:[r("input",{type:b,id:w||d,name:d,value:S,className:"ihub-input",placeholder:h,required:p,maxLength:f,disabled:N,readOnly:y,onChange:function(e){G(!!e.target.value),k(e.target.value),L&&L(e)},onBlur:T}),i("label",{htmlFor:w||d,className:"ihub-text-label",children:[o,p&&r("span",{className:"ihub-required",children:"*"})]}),C&&!B&&r("p",{className:"ihub-notes",children:C}),B&&r("p",{className:"ihub-notes ihub-is_invalid",children:B}),O&&r("p",{className:"ihub-input-notes",id:"".concat(w,"-note"),children:O})]}))};export{n as default};
1
+ import{slicedToArray as e,objectSpread2 as a}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as i,jsx as l}from"react/jsx-runtime";import{useState as r,useEffect as t}from"react";var n=function(n){var o=n.label,d=n.name,c=n.value,u=void 0===c?"":c,s=n.placeholder,h=void 0===s?"":s,m=n.required,p=void 0!==m&&m,v=n.type,b=void 0===v?"text":v,f=n.maxLength,x=n.disabled,N=void 0!==x&&x,g=n.readOnly,y=void 0!==g&&g,_=n.className,j=void 0===_?"":_,q=n.textTransform,B=n.error,L=n.onChange,T=n.onBlur,C=n.helperText,O=n.note,w=n.id,A=n.activeLabel,F=void 0!==A&&A,H=r(null!=u?u:""),P=e(H,2),S=P[0],k=P[1],z=r(F||!!u),D=e(z,2),E=D[0],G=D[1];t(function(){k(null!=u?u:""),G(F||!!u)},[u,F]);var I={};return q&&(I["data-text-transform"]=q),i("div",a(a({className:"ihub-wrapper ".concat(E?"ihub-value":""," ").concat(B?"ihub-is_invalid":""," ").concat(h?"ihub-has-placeholder":""," ").concat(j)},I),{},{children:[l("input",{type:b,id:w||d,name:d,value:S,className:"ihub-input",placeholder:h,required:p,maxLength:f,disabled:N,readOnly:y,onChange:function(e){G(!!e.target.value),k(e.target.value),L&&L(e)},onBlur:T}),i("label",{htmlFor:w||d,className:"ihub-text-label",children:[o,p&&l("span",{className:"ihub-required",children:"*"})]}),C&&!B&&l("p",{className:"ihub-notes",children:C}),B&&l("p",{className:"ihub-notes ihub-is_invalid",children:B}),O&&l("p",{className:"ihub-input-notes",id:"".concat(w,"-note"),children:O})]}))};export{n as default};
2
2
  //# sourceMappingURL=InputText.js.map
@@ -1,2 +1,2 @@
1
- import{slicedToArray as e,objectSpread2 as r,asyncToGenerator as n,regenerator as t}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as o,Fragment as i}from"react/jsx-runtime";import a,{useState as l,useRef as u,useEffect as s,useMemo as c}from"react";import d from"../../../../node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs.js";import{marked as f}from"../../../../node_modules/.pnpm/marked@15.0.12/node_modules/marked/lib/marked.esm.js";var m={html:!0},v=function(e){return e.replace(/<code>([\s\S]*?)<\/code>/g,function(e,r){var n=r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return"<code>".concat(n,"</code>")})};function p(p){var g,b,h,A,k=p.content,_=p.children,S=p.as,T=void 0===S?"div":S,j=p.className,y=void 0===j?"":j,E=p.style,w=p.id,D=p.isMarkdown,N=void 0!==D&&D,R=p.allowedTags,L=p.allowedAttributes,z=p.forbiddenTags,I=p.forbiddenAttributes,x=p.useProfiles,B=void 0===x?m:x,H=p.escapeCodeBlocks,F=void 0===H||H,M=p.noReferrer,O=void 0===M||M,P=p.openLinksInNewTab,G=void 0===P||P,C=p.maxLength,V=void 0===C?1e6:C,U=p.trusted,q=void 0!==U&&U,J=p.fallback,K=void 0===J?null:J,Q=p.loading,W=void 0!==Q&&Q,X=p.loadingComponent,Y=void 0===X?null:X,Z=p.onSanitize,$=p.onError,ee=p.ariaLabel,re=p.role,ne=l(""),te=e(ne,2),oe=te[0],ie=te[1],ae=u(!1),le=u(Z),ue=u($);s(function(){le.current=Z,ue.current=$},[Z,$]),s(function(){if(!ae.current)return ae.current=!0,d.addHook("afterSanitizeAttributes",function(e){if("A"===e.tagName&&e.getAttribute("href")){O&&e.setAttribute("rel","noopener noreferrer");var r=e.getAttribute("href")||"";G&&/^https?:\/\//i.test(r)&&e.setAttribute("target","_blank")}}),function(){d.removeHook("afterSanitizeAttributes"),ae.current=!1}},[O,G]);var se=null!==(g=null==R?void 0:R.join(","))&&void 0!==g?g:"",ce=null!==(b=null==L?void 0:L.join(","))&&void 0!==b?b:"",de=null!==(h=null==z?void 0:z.join(","))&&void 0!==h?h:"",fe=null!==(A=null==I?void 0:I.join(","))&&void 0!==A?A:"",me="".concat(B.html?1:0).concat(B.svg?1:0).concat(B.svgFilters?1:0).concat(B.mathMl?1:0),ve=c(function(){var e={USE_PROFILES:B};return R&&(e.ADD_TAGS=R),L&&(e.ADD_ATTR=L),z&&(e.FORBID_TAGS=z),I&&(e.FORBID_ATTR=I),e},[me,se,ce,de,fe]);if(s(function(){var e=!1,r=function(){var r=n(t().m(function r(){var n,o,i,a,l,u,s,c;return t().w(function(r){for(;;)switch(r.p=r.n){case 0:if(r.p=0,k){r.n=1;break}return e||ie(""),r.a(2);case 1:if(!(k.length>V)){r.n=2;break}throw new Error("DangerousRenderer: content length (".concat(k.length,") exceeds maxLength (").concat(V,")."));case 2:if(!N){r.n=4;break}return r.n=3,Promise.resolve(f.parse(k));case 3:s=r.v,r.n=5;break;case 4:s=k;case 5:o=s,F&&"string"==typeof o&&(o=v(o)),i=String(null!=o?o:""),a=q?i:String(null!==(n=d.sanitize(i,ve))&&void 0!==n?n:""),q&&"production"!==process.env.NODE_ENV&&console.warn("DangerousRenderer: `trusted` enabled — content injected without sanitization. Ensure the source is fully trusted."),e||(ie(a),null===(l=le.current)||void 0===l||l.call(le,{sanitized:a,original:k,changed:a!==k})),r.n=7;break;case 6:r.p=6,c=r.v,e||(ie(""),null===(u=ue.current)||void 0===u||u.call(ue,c instanceof Error?c:new Error(String(c))));case 7:return r.a(2)}},r,null,[[0,6]])}));return function(){return r.apply(this,arguments)}}();return r(),function(){e=!0}},[k,N,F,q,V,ve]),W)return o(i,{children:Y});if(!oe)return o(i,{children:K});var pe={__html:oe};if(a.isValidElement(_)){var ge=_.props.className;return a.cloneElement(_,r(r(r({},ee?{"aria-label":ee}:{}),re?{role:re}:{}),{},{className:[ge,"ihub-dangerous-renderer"].filter(Boolean).join(" "),dangerouslySetInnerHTML:pe}))}return a.createElement(T,{id:w,className:"ihub-dangerous-renderer ".concat(y).trim(),style:E,"aria-label":ee,role:re,dangerouslySetInnerHTML:pe})}export{p as default};
1
+ import{slicedToArray as e,objectSpread2 as r,asyncToGenerator as n,regenerator as t}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as o,Fragment as i}from"react/jsx-runtime";import a,{useState as l,useRef as s,useEffect as u,useMemo as c}from"react";import d from"../../../../node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs.js";import{marked as f}from"../../../../node_modules/.pnpm/marked@15.0.12/node_modules/marked/lib/marked.esm.js";var m={html:!0},v=function(e){return e.replace(/<code>([\s\S]*?)<\/code>/g,function(e,r){var n=r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return"<code>".concat(n,"</code>")})};function p(p){var g,b,h,A,k=p.content,_=p.children,S=p.as,T=void 0===S?"div":S,j=p.className,y=void 0===j?"":j,E=p.style,w=p.id,D=p.isMarkdown,N=void 0!==D&&D,R=p.allowedTags,I=p.allowedAttributes,L=p.forbiddenTags,x=p.forbiddenAttributes,z=p.useProfiles,B=void 0===z?m:z,H=p.escapeCodeBlocks,O=void 0===H||H,F=p.noReferrer,M=void 0===F||F,P=p.openLinksInNewTab,G=void 0===P||P,C=p.maxLength,V=void 0===C?1e6:C,U=p.truncate,q=p.trusted,J=void 0!==q&&q,K=p.fallback,Q=void 0===K?null:K,W=p.loading,X=void 0!==W&&W,Y=p.loadingComponent,Z=void 0===Y?null:Y,$=p.onSanitize,ee=p.onError,re=p.ariaLabel,ne=p.role,te=l(""),oe=e(te,2),ie=oe[0],ae=oe[1],le=s(!1),se=s($),ue=s(ee);u(function(){se.current=$,ue.current=ee},[$,ee]),u(function(){if(!le.current)return le.current=!0,d.addHook("afterSanitizeAttributes",function(e){if("A"===e.tagName&&e.getAttribute("href")){M&&e.setAttribute("rel","noopener noreferrer");var r=e.getAttribute("href")||"";G&&/^https?:\/\//i.test(r)&&e.setAttribute("target","_blank")}}),function(){d.removeHook("afterSanitizeAttributes"),le.current=!1}},[M,G]);var ce=null!==(g=null==R?void 0:R.join(","))&&void 0!==g?g:"",de=null!==(b=null==I?void 0:I.join(","))&&void 0!==b?b:"",fe=null!==(h=null==L?void 0:L.join(","))&&void 0!==h?h:"",me=null!==(A=null==x?void 0:x.join(","))&&void 0!==A?A:"",ve="".concat(B.html?1:0).concat(B.svg?1:0).concat(B.svgFilters?1:0).concat(B.mathMl?1:0),pe=c(function(){var e={USE_PROFILES:B};return R&&(e.ADD_TAGS=R),I&&(e.ADD_ATTR=I),L&&(e.FORBID_TAGS=L),x&&(e.FORBID_ATTR=x),e},[ve,ce,de,fe,me]);if(u(function(){var e=!1,r=function(){var r=n(t().m(function r(){var n,o,i,a,l,s,u,c,m;return t().w(function(r){for(;;)switch(r.p=r.n){case 0:if(r.p=0,k){r.n=1;break}return e||ae(""),r.a(2);case 1:if(!(k.length>V)){r.n=2;break}throw new Error("DangerousRenderer: content length (".concat(k.length,") exceeds maxLength (").concat(V,")."));case 2:if(o=U&&k.length>U?k.slice(0,k.lastIndexOf(" ",U)||U)+"…":k,!N){r.n=4;break}return r.n=3,Promise.resolve(f.parse(o));case 3:c=r.v,r.n=5;break;case 4:c=o;case 5:i=c,O&&"string"==typeof i&&(i=v(i)),a=String(null!=i?i:""),l=J?a:String(null!==(n=d.sanitize(a,pe))&&void 0!==n?n:""),J&&"production"!==process.env.NODE_ENV&&console.warn("DangerousRenderer: `trusted` enabled — content injected without sanitization. Ensure the source is fully trusted."),e||(ae(l),null===(s=se.current)||void 0===s||s.call(se,{sanitized:l,original:k,changed:l!==k})),r.n=7;break;case 6:r.p=6,m=r.v,e||(ae(""),null===(u=ue.current)||void 0===u||u.call(ue,m instanceof Error?m:new Error(String(m))));case 7:return r.a(2)}},r,null,[[0,6]])}));return function(){return r.apply(this,arguments)}}();return r(),function(){e=!0}},[k,N,O,J,V,U,pe]),X)return o(i,{children:Z});if(!ie)return o(i,{children:Q});var ge={__html:ie};if(a.isValidElement(_)){var be=_.props.className;return a.cloneElement(_,r(r(r({},re?{"aria-label":re}:{}),ne?{role:ne}:{}),{},{className:[be,"ihub-dangerous-renderer"].filter(Boolean).join(" "),dangerouslySetInnerHTML:ge}))}return a.createElement(T,{id:w,className:"ihub-dangerous-renderer ".concat(y).trim(),style:E,"aria-label":re,role:ne,dangerouslySetInnerHTML:ge})}export{p as default};
2
2
  //# sourceMappingURL=DangerousRenderer.js.map
@@ -47,6 +47,12 @@ export interface DangerousRendererProps {
47
47
  * comes from a fully trusted source. Logs a warning in development.
48
48
  */
49
49
  trusted?: boolean;
50
+ /**
51
+ * Maximum number of characters to display. When set, content is truncated
52
+ * at the nearest word boundary and an ellipsis is appended. Renders the
53
+ * full content when omitted.
54
+ */
55
+ truncate?: number;
50
56
  /** Node rendered when `content` is empty after processing. */
51
57
  fallback?: React.ReactNode;
52
58
  /** If true, renders `loadingComponent` instead of the content. */
@@ -87,5 +93,5 @@ export interface DangerousRendererProps {
87
93
  * </DangerousRenderer>
88
94
  * ```
89
95
  */
90
- export default function DangerousRenderer({ content, children, as, className, style, id, isMarkdown, allowedTags, allowedAttributes, forbiddenTags, forbiddenAttributes, useProfiles, escapeCodeBlocks, noReferrer, openLinksInNewTab, maxLength, trusted, fallback, loading, loadingComponent, onSanitize, onError, ariaLabel, role, }: DangerousRendererProps): import("react/jsx-runtime").JSX.Element;
96
+ export default function DangerousRenderer({ content, children, as, className, style, id, isMarkdown, allowedTags, allowedAttributes, forbiddenTags, forbiddenAttributes, useProfiles, escapeCodeBlocks, noReferrer, openLinksInNewTab, maxLength, truncate, trusted, fallback, loading, loadingComponent, onSanitize, onError, ariaLabel, role, }: DangerousRendererProps): import("react/jsx-runtime").JSX.Element;
91
97
  export {};