@corva/ui 0.29.0-1 → 0.29.0-2

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
- import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import n from"@babel/runtime/regenerator";import o from"@babel/runtime/helpers/asyncToGenerator";import{isNativeDetected as a}from"../../../../utils/mobileDetect.js";import{jsx as r,jsxs as i,Fragment as s}from"react/jsx-runtime";import{RootRef as c,Paper as p,Typography as d,Tooltip as m,IconButton as l}from"@material-ui/core";import{memo as u,useRef as f,useState as h,useEffect as y}from"react";import{getAnnotations as b}from"../../../../clients/jsonApi/index.js";import g from"../../../../effects/useOutsideClick.js";import{number as A,string as v,shape as N,func as I,bool as C}from"prop-types";import T from"classnames";import{withStyles as x}from"@material-ui/core/styles";import j from"@material-ui/icons/ChevronLeft";import w from"../../../InfiniteList/index.js";import{SET_ANNOTATIONS as S,APPEND_ANNOTATIONS as L}from"../../constants.js";import{useAnnotationsState as k,useAnnotationsDispatch as R}from"../../AnnotationsContext.js";import _ from"./components/AddAnnotationForm/index.js";import q from"./components/Annotation/index.js";import H from"./style.css.js";var U="AppAnnotationsPo",F=function(a){var u,A=a.appId,v=a.appTitle,N=a.assetId,I=a.assetCompanyId,C=a.appSettings,x=a.currentUser,F=a.onClose,O=a.isNative,P=a.classes,W=a.showSuccessNotification,B=a.dashboardType,D=k().annotations,E=R(),G=f(),M=f();g(G,F);var z=h(!1),J=e(z,2),K=J[0],Q=J[1],V=h(!0),X=e(V,2),Y=X[0],Z=X[1],$=h(!0),tt=e($,2),et=tt[0],nt=tt[1],ot=h(1),at=e(ot,2),rt=at[0],it=at[1];function st(){return(st=o(n.mark((function t(){var e,o,a;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(A&&N){t.next=2;break}return t.abrupt("return");case 2:return Z(!0),t.prev=3,o={page:rt,per_page:4,sort:"created_at",order:"desc"},B&&(o.dashboard_type=B),t.next=8,b(A,N,o);case 8:e=t.sent,E({type:1===rt?S:L,annotations:e}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(3),console.error(t.t0);case 15:a=e&&e.data.length<4,it(rt+1),nt(!a),Z(!1);case 19:case"end":return t.stop()}}),t,null,[[3,12]])})))).apply(this,arguments)}return y((function(){Q(!0)}),[]),r(c,{rootRef:G,children:i(p,{className:T(H.cAnnotationsList,(u={},t(u,H.cAnnotationsListOpen,K),t(u,H.cAnnotationsListOpenNative,O),u)),children:[r(w,{infiniteClassName:H.cAnnotationsListContentContainer,headerComponent:i(s,{children:[r(d,{"data-testid":"".concat(U,"_appTitle"),variant:"body1",className:P.title,children:v}),r("div",{className:H.cAnnotationsListContentTop,children:i(d,{"data-testid":"".concat(U,"_annotationsTitle"),variant:"caption",className:P.secondaryTitle,children:["Annotations (",D.data?D.data.length:0,")"]})}),r(_,{appId:A,assetId:N,assetCompanyId:I,appSettings:C,currentUser:x,showSuccessNotification:W,dashboardType:B})]}),useWindow:O,items:D.data||[],showNoItemsFound:!(D.data&&0!==D.data.length||Y),noItemsFoundLabel:r(d,{variant:"body2","data-testid":"".concat(U,"_noAnnotations"),className:P.noAnnotations,children:"No Annotations yet"}),threshold:50,infiniteContainerHeight:G.current&&M.current?G.current.clientHeight-M.current.clientHeight:null,moreItemsMayExist:et,pathToCreatedAt:["attributes","created_at"],renderItem:function(t){return r(q,{isNative:O,annotation:t,assetCompanyId:I,included:D.included,currentUser:x,showSuccessNotification:W},t.id)},loadItems:function(){return st.apply(this,arguments)}}),r("div",{className:H.cAnnotationsListActions,ref:M,children:r(m,{title:"Hide",placement:"bottom",children:r(l,{"data-testid":"".concat(U,"_hideButton"),onClick:F,className:P.backIcon,children:r(j,{})})})})]})})};F.propTypes={appId:A.isRequired,appTitle:v.isRequired,assetId:A.isRequired,assetCompanyId:A.isRequired,appSettings:N(),classes:N().isRequired,onClose:I.isRequired,showSuccessNotification:I,currentUser:N({}).isRequired,isNative:C,dashboardType:v},F.defaultProps={appSettings:{},isNative:a,showSuccessNotification:function(){},dashboardType:null};var O=x((function(t){return{title:{fontWeight:200,marginBottom:20},secondaryTitle:{fontWeight:200,textTransform:"uppercase",color:t.palette.grey[600]},annotateIcon:{padding:0,"&:hover":{backgroundColor:"transparent",boxShadow:"none"}},noAnnotations:{marginTop:16},backIcon:{cursor:"pointer",color:t.palette.grey[600],padding:5}}}))(u(F));export default O;
1
+ import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import n from"@babel/runtime/regenerator";import o from"@babel/runtime/helpers/asyncToGenerator";import{isNativeDetected as r}from"../../../../utils/mobileDetect.js";import{showSuccessNotification as a}from"../../../../utils/notificationToasts.js";import"../../../../utils/index.js";import{jsx as i,jsxs as s,Fragment as c}from"react/jsx-runtime";import{RootRef as p,Paper as d,Typography as m,Tooltip as l,IconButton as u}from"@material-ui/core";import{memo as f,useRef as h,useState as y,useEffect as b}from"react";import{getAnnotations as g}from"../../../../clients/jsonApi/index.js";import A from"../../../../effects/useOutsideClick.js";import{number as v,string as I,shape as C,func as T,bool as N}from"prop-types";import x from"classnames";import{withStyles as j}from"@material-ui/core/styles";import L from"@material-ui/icons/ChevronLeft";import k from"../../../InfiniteList/index.js";import{SET_ANNOTATIONS as R,APPEND_ANNOTATIONS as _}from"../../constants.js";import{useAnnotationsState as q,useAnnotationsDispatch as w}from"../../AnnotationsContext.js";import S from"./components/AddAnnotationForm/index.js";import H from"./components/Annotation/index.js";import U from"./style.css.js";var F="AppAnnotationsPo",O=function(r){var f,v=r.appId,I=r.appTitle,C=r.assetId,T=r.assetCompanyId,N=r.appSettings,j=r.currentUser,O=r.onClose,P=r.isNative,W=r.classes,B=r.dashboardType,D=q().annotations,E=w(),G=h(),M=h();A(G,O);var z=y(!1),J=e(z,2),K=J[0],Q=J[1],V=y(!0),X=e(V,2),Y=X[0],Z=X[1],$=y(!0),tt=e($,2),et=tt[0],nt=tt[1],ot=y(1),rt=e(ot,2),at=rt[0],it=rt[1];function st(){return(st=o(n.mark((function t(){var e,o,r;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v&&C){t.next=2;break}return t.abrupt("return");case 2:return Z(!0),t.prev=3,o={page:at,per_page:4,sort:"created_at",order:"desc"},B&&(o.dashboard_type=B),t.next=8,g(v,C,o);case 8:e=t.sent,E({type:1===at?R:_,annotations:e}),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(3),console.error(t.t0);case 15:r=e&&e.data.length<4,it(at+1),nt(!r),Z(!1);case 19:case"end":return t.stop()}}),t,null,[[3,12]])})))).apply(this,arguments)}return b((function(){Q(!0)}),[]),i(p,{rootRef:G,children:s(d,{className:x(U.cAnnotationsList,(f={},t(f,U.cAnnotationsListOpen,K),t(f,U.cAnnotationsListOpenNative,P),f)),children:[i(k,{infiniteClassName:U.cAnnotationsListContentContainer,headerComponent:s(c,{children:[i(m,{"data-testid":"".concat(F,"_appTitle"),variant:"body1",className:W.title,children:I}),i("div",{className:U.cAnnotationsListContentTop,children:s(m,{"data-testid":"".concat(F,"_annotationsTitle"),variant:"caption",className:W.secondaryTitle,children:["Annotations (",D.data?D.data.length:0,")"]})}),i(S,{appId:v,assetId:C,assetCompanyId:T,appSettings:N,currentUser:j,showSuccessNotification:a,dashboardType:B})]}),useWindow:P,items:D.data||[],showNoItemsFound:!(D.data&&0!==D.data.length||Y),noItemsFoundLabel:i(m,{variant:"body2","data-testid":"".concat(F,"_noAnnotations"),className:W.noAnnotations,children:"No Annotations yet"}),threshold:50,infiniteContainerHeight:G.current&&M.current?G.current.clientHeight-M.current.clientHeight:null,moreItemsMayExist:et,pathToCreatedAt:["attributes","created_at"],renderItem:function(t){return i(H,{isNative:P,annotation:t,assetCompanyId:T,included:D.included,currentUser:j,showSuccessNotification:a},t.id)},loadItems:function(){return st.apply(this,arguments)}}),i("div",{className:U.cAnnotationsListActions,ref:M,children:i(l,{title:"Hide",placement:"bottom",children:i(u,{"data-testid":"".concat(F,"_hideButton"),onClick:O,className:W.backIcon,children:i(L,{})})})})]})})};O.propTypes={appId:v.isRequired,appTitle:I.isRequired,assetId:v.isRequired,assetCompanyId:v.isRequired,appSettings:C(),classes:C().isRequired,onClose:T.isRequired,currentUser:C({}).isRequired,isNative:N,dashboardType:I},O.defaultProps={appSettings:{},isNative:r,dashboardType:null};var P=j((function(t){return{title:{fontWeight:200,marginBottom:20},secondaryTitle:{fontWeight:200,textTransform:"uppercase",color:t.palette.grey[600]},annotateIcon:{padding:0,"&:hover":{backgroundColor:"transparent",boxShadow:"none"}},noAnnotations:{marginTop:16},backIcon:{cursor:"pointer",color:t.palette.grey[600],padding:5}}}))(f(O));export default P;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.29.0-1",
3
+ "version": "0.29.0-2",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"