@corva/ui 0.26.0-6 → 0.26.0-7

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 e from"@babel/runtime/helpers/slicedToArray";import{jsxs as r,jsx as o}from"react/jsx-runtime";import{makeStyles as t,useTheme as i,AppBar as n,Toolbar as a,FormControlLabel as l,Checkbox as c,Tooltip as s,IconButton as m,Typography as p,Menu as h,MenuItem as u}from"@material-ui/core";import{useState as d}from"react";import f from"prop-types";import g from"../../../../../components/SwitchControl/index.js";import{LOCAL_STORAGE_PDF_REPORT_VIEW_KEY as b}from"../../../../hocs/constants.js";import{isPDFReportView as C}from"../../../../hocs/utils.js";import{useAuth as v}from"../../../../context/auth.js";import w from"@material-ui/icons/AccountCircle";import x from"../../../../assets/DevCenterLogo.js";import{isPDFReportsFeatureActive as k}from"../../../../flags/index.js";var T=t((function(e){return{grow:{flexGrow:1},flex:{display:"flex"},appBar:{backgroundColor:"rgb(30, 31, 31)"},iconButtonRoot:{borderRadius:"unset"},userProfileIcon:{marginLeft:4},headerControl:{marginRight:32},formControlLabel:{fontSize:14}}}));function j(t){var f=t.toggleTheme,j=T(),L=v(),N=L.user,B=L.logout,y=i(),z=d(null),R=e(z,2),S=R[0],D=R[1],P=Boolean(S),A=function(){return D(null)},I=N.first_name,O=N.last_name,F="".concat(I[0]).concat(O[0]).toUpperCase();return r("div",{children:[o(n,{position:"static",className:j.appBar,children:r(a,{children:[o(x,{}),o("div",{className:j.grow}),k()&&o(l,{control:o(c,{checked:C,size:"small",onChange:function(e){localStorage.setItem(b,e.target.checked),window.location.reload()}}),label:"PDF report view",classes:{label:j.formControlLabel},className:j.headerControl}),k()&&o(s,{title:"Switch to white theme to tune your app for PDF reports",placement:"bottom",children:o("div",{children:o(g,{className:j.headerControl,leftLabel:"Dark Theme",rightLabel:"White Theme",onChange:f,checked:y.isLightTheme,size:"small",title:""})})}),o("div",{children:o(m,{edge:"end","aria-label":"account of current user","aria-controls":"app-bar-menu","aria-haspopup":"true",onClick:function(e){return D(e.currentTarget)},color:"inherit",className:j.iconButtonRoot,children:r("div",{className:j.flex,children:[o(p,{children:F}),o(w,{className:j.userProfileIcon})]})})})]})}),o(h,{anchorEl:S,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:P,onClose:A,children:o(u,{onClick:function(){B(),A()},children:"Sign Out"})})]})}j.propTypes={toggleTheme:f.func.isRequired};export default j;
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{jsxs as r,jsx as t}from"react/jsx-runtime";import{makeStyles as o,useTheme as a,AppBar as i,Toolbar as n,FormControlLabel as l,Checkbox as c,Tooltip as s,IconButton as p,Typography as m,Menu as d,MenuItem as u}from"@material-ui/core";import{useState as h}from"react";import f from"prop-types";import g from"../../../../../components/SwitchControl/index.js";import{LOCAL_STORAGE_PDF_REPORT_VIEW_KEY as b}from"../../../../hocs/constants.js";import{isPDFReportView as C}from"../../../../hocs/utils.js";import{useAuth as v}from"../../../../context/auth.js";import w from"@material-ui/icons/AccountCircle";import B from"../../../../assets/DevCenterLogo.js";import{isPDFReportsFeatureActive as x}from"../../../../flags/index.js";var k=o((function(e){return{grow:{flexGrow:1},flex:{display:"flex"},appBar:{backgroundColor:"rgb(30, 31, 31)"},iconButtonRoot:{borderRadius:"unset"},userProfileIcon:{marginLeft:4},headerControl:{marginRight:32},formControlLabel:{fontSize:14}}}));function A(o){var f=o.toggleTheme,A=k(),T=v(),j=T.user,L=T.logout,N=a(),_=h(null),R=e(_,2),S=R[0],y=R[1],z=Boolean(S),D=function(){return y(null)},I=j.first_name,O=j.last_name,P="".concat(I[0]).concat(O[0]).toUpperCase();return r("div",{children:[t(i,{position:"static",className:A.appBar,children:r(n,{children:[t(B,{}),t("div",{className:A.grow}),x()&&t(l,{control:t(c,{"data-testid":"".concat("AppBar","_pdfReport"),checked:C,size:"small",onChange:function(e){localStorage.setItem(b,e.target.checked),window.location.reload()}}),label:"PDF report view",classes:{label:A.formControlLabel},className:A.headerControl}),x()&&t(s,{title:"Switch to white theme to tune your app for PDF reports",placement:"bottom",children:t("div",{children:t(g,{"data-testid":"".concat("AppBar","_themeSwitch"),className:A.headerControl,leftLabel:"Dark Theme",rightLabel:"White Theme",onChange:f,checked:N.isLightTheme,size:"small",title:""})})}),t("div",{children:t(p,{edge:"end","aria-label":"account of current user","aria-controls":"app-bar-menu","aria-haspopup":"true",onClick:function(e){return y(e.currentTarget)},color:"inherit",className:A.iconButtonRoot,children:r("div",{className:A.flex,children:[t(m,{"data-testid":"".concat("AppBar","_userInitials"),children:P}),t(w,{className:A.userProfileIcon})]})})})]})}),t(d,{"data-testid":"".concat("AppBar","_userDropdown"),anchorEl:S,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:z,onClose:D,children:t(u,{"data-testid":"".concat("AppBar","_signOutMenuItem"),onClick:function(){L(),D()},children:"Sign Out"})})]})}A.propTypes={toggleTheme:f.func.isRequired};export default A;
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{pick as r}from"lodash";import t from"@babel/runtime/helpers/slicedToArray";import{GRID_BREAKPOINTS as o,GRID_COLUMN_SIZES as i,GRID_ROW_HEIGHT as a,NON_DRAGGABLE_ELEMENT_SELECTOR as n}from"../../../constants/apps.js";import{isAppMaximized as l}from"../../../utils/devcenter.js";import{isPhoneDetected as s,isNativeDetected as c,isMobileDetected as p}from"../../../utils/mobileDetect.js";import{getAppSize as m}from"../../../utils/apps.js";import"../../../utils/index.js";import{jsxs as d,jsx as b}from"react/jsx-runtime";import{makeStyles as u,Tooltip as f,FormControlLabel as g,Switch as h}from"@material-ui/core";import{useState as y}from"react";import j from"@babel/runtime/helpers/objectWithoutProperties";import O from"classnames";import{getLocalAppData as v,getAppCoordinates as k,updateLocalAppData as w}from"../utils.js";import{WidthProvider as x,Responsive as D}from"react-grid-layout";import"./withGridLayoutHOC.global.css.js";import L from"./withGridLayoutHOC.css.js";function P(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function C(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?P(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):P(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var S=x(D),z=u({gridLockFormControl:{margin:"4px 0 0 2px"},gridLockLabel:{fontSize:14},gridLockLabelDisabled:{color:"#bdbdbd"}});export default function(e){return x((function(u){var x,D=u.width,P=j(u,["width"]),H=P.manifest.application.key,W=y(null!==(x=v(H).isDraggable)&&void 0!==x&&x),E=t(W,2),G=E[0],M=E[1],N=z(),R=c||p,F=l(P.devCenterRouter.location.query),T=y(k(P.manifest)),q=t(T,2),A=q[0],B=q[1],I=m({coordinates:A,dashboardWidth:D,isMaximized:F}),J=I.pixelHeight,K=I.pixelWidth,Q=function(e){var o=t(e,1)[0],i=r(o,["x","y","w","h"]);B(i),w(H,{coordinates:i})};return d("div",{children:[b(S,{breakpoints:s?o.phone:o.general,cols:i,rowHeight:a,measureBeforeMount:!0,onResizeStop:Q,onDragStop:Q,isDraggable:!R&&G,isResizable:!R&&G,draggableCancel:n,useCSSTransforms:!1,children:b("div",{"data-grid":A,children:b("div",{className:F?L.appMaximized:"",children:b(e,C(C({},P),{},{coordinates:C(C({},A),{},{pixelHeight:J,pixelWidth:K}),layoutEnvironment:{type:"general"}}))})},"with-grid-layout-hoc")}),b(f,{title:G?"":"Disable grid lock to move and resize your app",placement:"right",children:b(g,{className:N.gridLockFormControl,control:b(h,{onChange:function(e){var r=e.target.checked;M(!r),w(H,{isDraggable:!r})},checked:!G,color:"primary"}),label:b("span",{className:O(N.gridLockLabel,G&&N.gridLockLabelDisabled),children:"Grid locked"})})})]})}))}
1
+ import e from"@babel/runtime/helpers/defineProperty";import{pick as r}from"lodash";import t from"@babel/runtime/helpers/slicedToArray";import{GRID_BREAKPOINTS as o,GRID_COLUMN_SIZES as i,GRID_ROW_HEIGHT as a,NON_DRAGGABLE_ELEMENT_SELECTOR as n}from"../../../constants/apps.js";import{isAppMaximized as c}from"../../../utils/devcenter.js";import{isPhoneDetected as l,isNativeDetected as s,isMobileDetected as p}from"../../../utils/mobileDetect.js";import{getAppSize as d}from"../../../utils/apps.js";import"../../../utils/index.js";import{jsxs as m,jsx as b}from"react/jsx-runtime";import{makeStyles as u,Tooltip as f,FormControlLabel as g,Switch as h}from"@material-ui/core";import{useState as y}from"react";import j from"@babel/runtime/helpers/objectWithoutProperties";import O from"classnames";import{getLocalAppData as v,getAppCoordinates as k,updateLocalAppData as w}from"../utils.js";import{WidthProvider as D,Responsive as L}from"react-grid-layout";import"./withGridLayoutHOC.global.css.js";import x from"./withGridLayoutHOC.css.js";function P(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function C(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?P(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):P(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var S=D(L),z=u({gridLockFormControl:{margin:"4px 0 0 2px"},gridLockLabel:{fontSize:14},gridLockLabelDisabled:{color:"#bdbdbd"}});export default function(e){return D((function(u){var D,L=u.width,P=j(u,["width"]),H=P.manifest.application.key,W=y(null!==(D=v(H).isDraggable)&&void 0!==D&&D),E=t(W,2),G=E[0],M=E[1],N=z(),R=s||p,F=c(P.devCenterRouter.location.query),T=y(k(P.manifest)),q=t(T,2),A=q[0],B=q[1],_=d({coordinates:A,dashboardWidth:L,isMaximized:F}),I=_.pixelHeight,J=_.pixelWidth,K=function(e){var o=t(e,1)[0],i=r(o,["x","y","w","h"]);B(i),w(H,{coordinates:i})};return m("div",{children:[b(S,{breakpoints:l?o.phone:o.general,cols:i,rowHeight:a,measureBeforeMount:!0,onResizeStop:K,onDragStop:K,isDraggable:!R&&G,isResizable:!R&&G,draggableCancel:n,useCSSTransforms:!1,children:b("div",{"data-grid":A,children:b("div",{className:F?x.appMaximized:"",children:b(e,C(C({},P),{},{coordinates:C(C({},A),{},{pixelHeight:I,pixelWidth:J}),layoutEnvironment:{type:"general"}}))})},"with-grid-layout-hoc")}),b(f,{title:G?"":"Disable grid lock to move and resize your app",placement:"right",children:b(g,{className:N.gridLockFormControl,control:b(h,{"data-testid":"".concat("DashboardPo","_gridLocked"),onChange:function(e){var r=e.target.checked;M(!r),w(H,{isDraggable:!r})},checked:!G,color:"primary"}),label:b("span",{className:O(N.gridLockLabel,G&&N.gridLockLabelDisabled),children:"Grid locked"})})})]})}))}
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{get as t,capitalize as a}from"lodash";import s from"@babel/runtime/helpers/slicedToArray";import{jsxs as l,jsx as r}from"react/jsx-runtime";import{Button as i}from"@material-ui/core";import{useState as o}from"react";import n from"prop-types";import p from"./AssetEditors.css.js";import u from"./SingleAssetEditor.js";import c from"./AssetEditorAutocomplete.js";var d="DC_AppSettingsAssetEditor",m=function(n){var m=n.appKey,y=n.appType,f=n.defaultValue,A=n.isNullable,b=n.label,h=n.onSettingsChange,g=n.settings,T=t(y,["primaryAsset","assetType","type"]),C=t(y,["primaryAsset","assetType","id"]),v=t(y,["primaryAsset","autocompleteSelect"]),N=t(y,["secondaryAsset","assetType","type"]),V=t(y,["secondaryAsset","assetType","id"]),K=t(y,["secondaryAsset","autocompleteSelect"]),S=t(g,C),_=o(S||f),j=s(_,2),E=j[0],q=j[1],R=o(t(g,V)),k=s(R,2),x=k[0],B=k[1],D=o(!(!N||x)),I=s(D,2),P=I[0],U=I[1],W=o(!(!N||!x)),w=s(W,2),z=w[0],F=w[1],G=function(t){B(t),h(e({},V,t))},H=function(t){q(t),B(null),F(!1),U(!!N);var a=e({},C,t);V&&(a[V]=null),h(a)};return l("div",{className:p.main,children:[r("div",{className:p.title,children:"Active Asset"}),l("div",{className:p.editor,children:[v?r(c,{onChange:H,defaultValue:f,currentValue:E,isNullable:A,label:b,assetType:T,appKey:m}):r(u,{"data-testid":"".concat(d,"_primaryAutoComplete"),onChange:H,defaultValue:f,currentValue:E,isNullable:A,label:b,assetType:T,appKey:m}),P&&r(i,{"data-testid":"".concat(d,"_changeWellButton"),color:"primary",onClick:function(){F(!0),U(!1)},disabled:!S,children:"Change ".concat(a(N))}),!P&&z&&r(i,{"data-testid":"".concat(d,"_useDefaultButton"),color:"secondary",onClick:function(){B(null),F(!1),U(!!N),h(e({},V,null))},children:"Use active asset"})]}),z&&r("div",{className:p.editor,children:K?r(c,{onChange:G,defaultValue:f,currentValue:x,isNullable:A,label:"Active ".concat(a(N)),assetType:N,parentAssetId:E,parentAssetType:T,appKey:m}):r(u,{"data-testid":"".concat(d,"_secondaryAutoComplete"),onChange:G,defaultValue:f,currentValue:x,isNullable:A,label:"Active ".concat(a(N)),assetType:N,parentAssetId:E,parentAssetType:T,appKey:m})})]})};m.defaultProps={label:"Choose An Asset",isNullable:!1,defaultValue:void 0,appKey:null},m.propTypes={settings:n.shape({}).isRequired,appType:n.shape({}).isRequired,defaultValue:n.any,onSettingsChange:n.func.isRequired,label:n.string,isNullable:n.bool,appKey:n.string};export default m;
1
+ import e from"@babel/runtime/helpers/defineProperty";import{get as t,capitalize as a}from"lodash";import s from"@babel/runtime/helpers/slicedToArray";import{jsxs as l,jsx as r}from"react/jsx-runtime";import{Button as o}from"@material-ui/core";import{useState as i}from"react";import n from"prop-types";import p from"./AssetEditors.css.js";import c from"./SingleAssetEditor.js";import u from"./AssetEditorAutocomplete.js";var d="DC_AppSettingsAssetEditor",m=function(n){var m=n.appKey,y=n.appType,A=n.defaultValue,f=n.isNullable,b=n.label,h=n.onSettingsChange,g=n.settings,T=t(y,["primaryAsset","assetType","type"]),C=t(y,["primaryAsset","assetType","id"]),v=t(y,["primaryAsset","autocompleteSelect"]),N=t(y,["secondaryAsset","assetType","type"]),V=t(y,["secondaryAsset","assetType","id"]),K=t(y,["secondaryAsset","autocompleteSelect"]),_=t(g,C),E=i(_||A),S=s(E,2),j=S[0],q=S[1],R=i(t(g,V)),k=s(R,2),x=k[0],B=k[1],D=i(!(!N||x)),I=s(D,2),P=I[0],U=I[1],W=i(!(!N||!x)),w=s(W,2),z=w[0],F=w[1],G=function(t){B(t),h(e({},V,t))},H=function(t){q(t),B(null),F(!1),U(!!N);var a=e({},C,t);V&&(a[V]=null),h(a)};return l("div",{className:p.main,children:[r("div",{className:p.title,children:"Active Asset"}),l("div",{className:p.editor,children:[v?r(u,{"data-testid":"".concat(d,"_primaryAssetEditorAutocomplete"),onChange:H,defaultValue:A,currentValue:j,isNullable:f,label:b,assetType:T,appKey:m}):r(c,{"data-testid":"".concat(d,"_primaryAutoComplete"),onChange:H,defaultValue:A,currentValue:j,isNullable:f,label:b,assetType:T,appKey:m}),P&&r(o,{"data-testid":"".concat(d,"_changeWellButton"),color:"primary",onClick:function(){F(!0),U(!1)},disabled:!_,children:"Change ".concat(a(N))}),!P&&z&&r(o,{"data-testid":"".concat(d,"_useDefaultButton"),color:"secondary",onClick:function(){B(null),F(!1),U(!!N),h(e({},V,null))},children:"Use active asset"})]}),z&&r("div",{className:p.editor,children:K?r(u,{"data-testid":"".concat(d,"_secondaryAssetEditorAutocomplete"),onChange:G,defaultValue:A,currentValue:x,isNullable:f,label:"Active ".concat(a(N)),assetType:N,parentAssetId:j,parentAssetType:T,appKey:m}):r(c,{"data-testid":"".concat(d,"_secondaryAutoComplete"),onChange:G,defaultValue:A,currentValue:x,isNullable:f,label:"Active ".concat(a(N)),assetType:N,parentAssetId:j,parentAssetType:T,appKey:m})})]})};m.defaultProps={label:"Choose An Asset",isNullable:!1,defaultValue:void 0,appKey:null},m.propTypes={settings:n.shape({}).isRequired,appType:n.shape({}).isRequired,defaultValue:n.any,onSettingsChange:n.func.isRequired,label:n.string,isNullable:n.bool,appKey:n.string};export default m;
@@ -1 +1 @@
1
- import"@babel/runtime/helpers/defineProperty";import{formatAssetName as e}from"../../utils/formatting.js";import{jsxs as r,jsx as i}from"react/jsx-runtime";import{Tooltip as t}from"@material-ui/core";import{memo as s}from"react";import"@babel/runtime/helpers/objectWithoutProperties";import o from"prop-types";import a from"classnames";import"../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"react-router";import{UniversalLink as m}from"../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import n from"./styles.css.js";var d=function(s){var o=s.primaryAssetName,d=s.secondaryAssetName,p=s.isPrimaryNameVisible,l=s.coordinatesPixelWidth,c=s.primaryAssetLink,u=s.isMaximized;return r("div",{className:a(n.assetNameLabelContainer,u&&n.appMaximized),children:[d&&i(t,{title:d,children:i("div",{className:a(n.item,n.secondaryAsset),children:e(d,l)})}),p&&i(m,{href:c||"/feed",children:i("div",{className:n.item,children:e(o,l)})})]})};d.propTypes={isPrimaryNameVisible:o.bool.isRequired,primaryAssetName:o.string.isRequired,secondaryAssetName:o.string,primaryAssetLink:o.any.isRequired,coordinatesPixelWidth:o.number,isMaximized:o.bool},d.defaultProps={secondaryAssetName:"",coordinatesPixelWidth:void 0,isMaximized:!1};var p=s(d);export default p;
1
+ import"@babel/runtime/helpers/defineProperty";import{formatAssetName as e}from"../../utils/formatting.js";import{jsxs as r,jsx as i}from"react/jsx-runtime";import{Tooltip as t}from"@material-ui/core";import{memo as s}from"react";import"@babel/runtime/helpers/objectWithoutProperties";import a from"prop-types";import o from"classnames";import"../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"react-router";import{UniversalLink as m}from"../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import n from"./styles.css.js";var d=function(s){var a=s.primaryAssetName,d=s.secondaryAssetName,l=s.isPrimaryNameVisible,p=s.coordinatesPixelWidth,c=s.primaryAssetLink,u=s.isMaximized;return r("div",{className:o(n.assetNameLabelContainer,u&&n.appMaximized),children:[d&&i(t,{title:d,children:i("div",{"data-testid":"".concat("AssetNameLabel","_secondaryAsset"),className:o(n.item,n.secondaryAsset),children:e(d,p)})}),l&&i(m,{"data-testid":"".concat("AssetNameLabel","_primaryAsset"),href:c||"/feed",children:i("div",{className:n.item,children:e(a,p)})})]})};d.propTypes={isPrimaryNameVisible:a.bool.isRequired,primaryAssetName:a.string.isRequired,secondaryAssetName:a.string,primaryAssetLink:a.any.isRequired,coordinatesPixelWidth:a.number,isMaximized:a.bool},d.defaultProps={secondaryAssetName:"",coordinatesPixelWidth:void 0,isMaximized:!1};var l=s(d);export default l;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.26.0-6",
3
+ "version": "0.26.0-7",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"