@corva/ui 0.75.0-12 → 0.75.0-13

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('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),r=require("react"),n=require("@material-ui/core"),i=require("classnames"),c=require("../../utils/formatting.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(i),o=n.makeStyles({root:{opacity:0,overflow:"visible",whiteSpace:"nowrap",textOverflow:"ellipsis"}});exports.MiddleTruncatedText=function(i){var u=i.children,l=i.className,a=i.showTooltip,d=void 0===a||a,v=i.customTooltipTitle,f=void 0===v?"":v,p=e.__rest(i,["children","className","showTooltip","customTooltipTitle"]),h=r.useRef(),T=r.useRef(),g=r.useRef(),m=r.useState({isTruncated:!1,content:u}),_=m[0],b=m[1],w=r.useRef(0),x=r.useRef(0),y=o();r.useEffect((function(){h.current&&T.current&&u&&(g.current&&g.current.unobserve(h.current),g.current=new ResizeObserver((function(e){var t,r,n,i=e[0].contentRect.width,s=null===(t=T.current)||void 0===t?void 0:t.getBoundingClientRect().width,o=null===(r=T.current)||void 0===r?void 0:r.innerHTML;w.current=Math.max(s,w.current);var l=x.current<i,a=Math.abs(i-w.current)<=2;if(e[0].target.scrollWidth<=e[0].target.clientWidth&&!l||a)(null===(n=h.current)||void 0===n?void 0:n.style)&&(h.current.style.opacity="1");else{var d=c.truncateInTheMiddle(u.toString(),i,w.current);i&&w.current&&w.current!==i&&(d!==o&&b({content:d,isTruncated:u.toString()!==d}),u.toString()===d&&b({content:u.toString(),isTruncated:!1}),x.current=i),h.current.style.opacity="1"}})),g.current.observe(h.current))}),[_.content,u,h.current,T.current]);var j=t.jsx("div",e.__assign({className:s.default(y.root,l),ref:h},p,{children:t.jsx("span",e.__assign({ref:T},{children:_.content}))}));return d&&_.isTruncated?t.jsx(n.Tooltip,e.__assign({title:f||u},{children:j})):j};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),r=require("react"),n=require("lodash"),i=require("@material-ui/core"),u=require("classnames"),c=require("../../utils/formatting.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(u),l=i.makeStyles({root:{opacity:0,overflow:"visible",whiteSpace:"nowrap",textOverflow:"ellipsis"}});exports.MiddleTruncatedText=function(u){var o=u.children,a=u.className,d=u.showTooltip,v=void 0===d||d,f=u.customTooltipTitle,h=void 0===f?"":f,p=e.__rest(u,["children","className","showTooltip","customTooltipTitle"]),T=r.useRef(),g=r.useRef(),m=r.useRef(),_=r.useState({isTruncated:!1,content:o}),b=_[0],w=_[1],x=r.useRef(0),y=r.useRef(0),j=l();r.useEffect((function(){T.current&&g.current&&o&&(m.current&&m.current.unobserve(T.current),m.current=new ResizeObserver(n.debounce((function(e){var t,r,n,i=e[0].contentRect.width,u=null===(t=g.current)||void 0===t?void 0:t.getBoundingClientRect().width,s=null===(r=g.current)||void 0===r?void 0:r.innerHTML;x.current=Math.max(u,x.current);var l=y.current<i,a=Math.abs(i-x.current)<=2;if(e[0].target.scrollWidth<=e[0].target.clientWidth&&!l||a)(null===(n=T.current)||void 0===n?void 0:n.style)&&(T.current.style.opacity="1");else{var d=c.truncateInTheMiddle(o.toString(),i,x.current);i&&x.current&&x.current!==i&&(d!==s&&w({content:d,isTruncated:o.toString()!==d}),o.toString()===d&&w({content:o.toString(),isTruncated:!1}),y.current=i),T.current.style.opacity="1"}}))),m.current.observe(T.current))}),[b.content,o,T.current,g.current]);var R=t.jsx("div",e.__assign({className:s.default(j.root,a),ref:T},p,{children:t.jsx("span",e.__assign({ref:g},{children:b.content}))}));return v&&b.isTruncated?t.jsx(i.Tooltip,e.__assign({title:h||o},{children:R})):R};
@@ -1 +1 @@
1
- {"version":3,"file":"MiddleTruncatedText.d.ts","sourceRoot":"","sources":["../../../src/components/MiddleTruncatedText/MiddleTruncatedText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAe3F,aAAK,KAAK,GAAG,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,GAAG;IAC/E,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,KAAK,CAgFzC,CAAC"}
1
+ {"version":3,"file":"MiddleTruncatedText.d.ts","sourceRoot":"","sources":["../../../src/components/MiddleTruncatedText/MiddleTruncatedText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAgB3F,aAAK,KAAK,GAAG,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,GAAG;IAC/E,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,KAAK,CAkFzC,CAAC"}
@@ -1 +1 @@
1
- import{__rest as t,__assign as r}from'./../../ext-esm/tslib/tslib.es6.js';import{jsx as e}from"react/jsx-runtime";import{useRef as n,useState as o,useEffect as i}from"react";import{makeStyles as c,Tooltip as u}from"@material-ui/core";import l from"classnames";import{truncateInTheMiddle as s}from"../../utils/formatting.js";var a=c({root:{opacity:0,overflow:"visible",whiteSpace:"nowrap",textOverflow:"ellipsis"}}),d=function(c){var d=c.children,m=c.className,v=c.showTooltip,p=void 0===v||v,f=c.customTooltipTitle,h=void 0===f?"":f,T=t(c,["children","className","showTooltip","customTooltipTitle"]),g=n(),w=n(),b=n(),y=o({isTruncated:!1,content:d}),S=y[0],x=y[1],j=n(0),M=n(0),N=a();i((function(){g.current&&w.current&&d&&(b.current&&b.current.unobserve(g.current),b.current=new ResizeObserver((function(t){var r,e,n,o=t[0].contentRect.width,i=null===(r=w.current)||void 0===r?void 0:r.getBoundingClientRect().width,c=null===(e=w.current)||void 0===e?void 0:e.innerHTML;j.current=Math.max(i,j.current);var u=M.current<o,l=Math.abs(o-j.current)<=2;if(t[0].target.scrollWidth<=t[0].target.clientWidth&&!u||l)(null===(n=g.current)||void 0===n?void 0:n.style)&&(g.current.style.opacity="1");else{var a=s(d.toString(),o,j.current);o&&j.current&&j.current!==o&&(a!==c&&x({content:a,isTruncated:d.toString()!==a}),d.toString()===a&&x({content:d.toString(),isTruncated:!1}),M.current=o),g.current.style.opacity="1"}})),b.current.observe(g.current))}),[S.content,d,g.current,w.current]);var R=e("div",r({className:l(N.root,m),ref:g},T,{children:e("span",r({ref:w},{children:S.content}))}));return p&&S.isTruncated?e(u,r({title:h||d},{children:R})):R};export{d as MiddleTruncatedText};
1
+ import{__rest as t,__assign as r}from'./../../ext-esm/tslib/tslib.es6.js';import{jsx as e}from"react/jsx-runtime";import{useRef as n,useState as o,useEffect as i}from"react";import{debounce as c}from"lodash";import{makeStyles as u,Tooltip as l}from"@material-ui/core";import s from"classnames";import{truncateInTheMiddle as a}from"../../utils/formatting.js";var d=u({root:{opacity:0,overflow:"visible",whiteSpace:"nowrap",textOverflow:"ellipsis"}}),m=function(u){var m=u.children,v=u.className,p=u.showTooltip,f=void 0===p||p,h=u.customTooltipTitle,T=void 0===h?"":h,g=t(u,["children","className","showTooltip","customTooltipTitle"]),w=n(),b=n(),y=n(),S=o({isTruncated:!1,content:m}),x=S[0],j=S[1],M=n(0),N=n(0),R=d();i((function(){w.current&&b.current&&m&&(y.current&&y.current.unobserve(w.current),y.current=new ResizeObserver(c((function(t){var r,e,n,o=t[0].contentRect.width,i=null===(r=b.current)||void 0===r?void 0:r.getBoundingClientRect().width,c=null===(e=b.current)||void 0===e?void 0:e.innerHTML;M.current=Math.max(i,M.current);var u=N.current<o,l=Math.abs(o-M.current)<=2;if(t[0].target.scrollWidth<=t[0].target.clientWidth&&!u||l)(null===(n=w.current)||void 0===n?void 0:n.style)&&(w.current.style.opacity="1");else{var s=a(m.toString(),o,M.current);o&&M.current&&M.current!==o&&(s!==c&&j({content:s,isTruncated:m.toString()!==s}),m.toString()===s&&j({content:m.toString(),isTruncated:!1}),N.current=o),w.current.style.opacity="1"}}))),y.current.observe(w.current))}),[x.content,m,w.current,b.current]);var O=e("div",r({className:s(R.root,v),ref:w},g,{children:e("span",r({ref:b},{children:x.content}))}));return f&&x.isTruncated?e(l,r({title:T||m},{children:O})):O};export{m as MiddleTruncatedText};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.75.0-12",
3
+ "version": "0.75.0-13",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"