@corva/ui 0.28.0-2 → 0.28.0-3

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 t}from"react/jsx-runtime";import{makeStyles as o,useTheme as a,AppBar as n,Toolbar as i,FormControlLabel as c,Checkbox as l,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";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 x(o){var f=o.toggleTheme,x=k(),A=v(),T=A.user,L=A.logout,N=a(),_=h(null),j=e(_,2),R=j[0],S=j[1],y=Boolean(R),z=function(){return S(null)},D=T.first_name,I=T.last_name,O="".concat(D[0]).concat(I[0]).toUpperCase();return r("div",{children:[t(n,{position:"static",className:x.appBar,children:r(i,{children:[t(B,{}),t("div",{className:x.grow}),t(c,{control:t(l,{"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:x.formControlLabel},className:x.headerControl}),!C&&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:x.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 S(e.currentTarget)},color:"inherit",className:x.iconButtonRoot,children:r("div",{className:x.flex,children:[t(m,{"data-testid":"".concat("AppBar","_userInitials"),children:O}),t(w,{className:x.userProfileIcon})]})})})]})}),t(d,{"data-testid":"".concat("AppBar","_userDropdown"),anchorEl:R,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:y,onClose:z,children:t(u,{"data-testid":"".concat("AppBar","_signOutMenuItem"),onClick:function(){L(),z()},children:"Sign Out"})})]})}x.propTypes={toggleTheme:f.func.isRequired};export default x;
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 n,Toolbar as i,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 B from"@material-ui/icons/AccountCircle";import w from"../../../../assets/DevCenterLogo.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 x(o){var f=o.toggleTheme,x=k(),A=v(),L=A.user,T=A.logout,N=a(),_=h(null),j=e(_,2),R=j[0],S=j[1],y=Boolean(R),z=function(){return S(null)},D=L.first_name,I=L.last_name,O="".concat(D[0]).concat(I[0]).toUpperCase();return r("div",{children:[t(n,{position:"static",className:x.appBar,children:r(i,{children:[t(w,{}),t("div",{className:x.grow}),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:x.formControlLabel},className:x.headerControl}),!C&&t(s,{title:"Switch to light theme to tune your app for PDF reports",placement:"bottom",children:t("div",{children:t(g,{"data-testid":"".concat("AppBar","_themeSwitch"),className:x.headerControl,leftLabel:"Dark Theme",rightLabel:"Light 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 S(e.currentTarget)},color:"inherit",className:x.iconButtonRoot,children:r("div",{className:x.flex,children:[t(m,{"data-testid":"".concat("AppBar","_userInitials"),children:O}),t(B,{className:x.userProfileIcon})]})})})]})}),t(d,{"data-testid":"".concat("AppBar","_userDropdown"),anchorEl:R,id:"app-bar-menu",keepMounted:!0,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:y,onClose:z,children:t(u,{"data-testid":"".concat("AppBar","_signOutMenuItem"),onClick:function(){T(),z()},children:"Sign Out"})})]})}x.propTypes={toggleTheme:f.func.isRequired};export default x;
package/clients/index.js CHANGED
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/defineProperty";import{noop as r}from"lodash";import*as e from"./clientStorage/index.js";export{e as clientStorage};import{get as n,put as o,patch as i,post as c,del as p}from"./api/apiCore.js";import{CORVA_API_URLS as u}from"./constants.js";import*as s from"./jsonApi/index.js";export{s as jsonApi};import*as a from"./subscriptions.js";export{a as subscriptions};import{v4 as f}from"uuid";function l(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function b(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){t(r,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}var m={get:function(t,r){return n(t,r)},put:function(t,r,e){return o(t,r,e)},patch:function(t,r,e){return i(t,r,e)},post:function(t,r){return c(t,r)},del:function(t,r){return p(t,r)}},d={get:function(t,r){return n(t,r,{apiUrl:u.DATA_API})},put:function(t,r,e){return o(t,r,e,{apiUrl:u.DATA_API})},patch:function(t,r,e){return i(t,r,e,{apiUrl:u.DATA_API})},post:function(t,r){return c(t,r,{apiUrl:u.DATA_API})},del:function(t,r){return p(t,r,{apiUrl:u.DATA_API})}},j={subscribe:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.onDataReceive,o=void 0===n?r:n;if(!window[Symbol.for("socket")])throw"Socket client is not initialized";var i=window[Symbol.for("socket")],c=i.subscribe,p=i.unsubscribe,u=i.socket,s=f(),a=b(b({},t),{},{collection:t.collection||t.dataset,appInstanceId:s});return c(a),u.on("data",(function(t){return t.appInstanceId===s&&o(t)})),function(){return p(a)}}};export{m as corvaAPI,d as corvaDataAPI,j as socketClient};
1
+ import r from"@babel/runtime/helpers/defineProperty";import{noop as t}from"lodash";import*as e from"./clientStorage/index.js";export{e as clientStorage};import{get as n,put as o,patch as i,post as c,del as p}from"./api/apiCore.js";import{CORVA_API_URLS as u}from"./constants.js";import*as s from"./jsonApi/index.js";export{s as jsonApi};import*as a from"./subscriptions.js";export{a as subscriptions};import{v4 as f}from"uuid";function l(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function b(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}var m={get:function(r,t){return n(r,t)},put:function(r,t,e){return o(r,t,e)},patch:function(r,t,e){return i(r,t,e)},post:function(r,t){return c(r,t)},del:function(r,t){return p(r,t)}},j={get:function(r,t){return n(r,t,{apiUrl:u.DATA_API})},put:function(r,t,e){return o(r,t,e,{apiUrl:u.DATA_API})},patch:function(r,t,e){return i(r,t,e,{apiUrl:u.DATA_API})},post:function(r,t){return c(r,t,{apiUrl:u.DATA_API})},del:function(r,t){return p(r,t,{apiUrl:u.DATA_API})}},d={subscribe:function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.onDataReceive,o=void 0===n?t:n,i=window[Symbol.for("socket")]||{},c=i.subscribe,p=i.unsubscribe,u=i.socket;if(!u)return console.error("Socket is not initialized!"),t;var s=f(),a=b(b({},r),{},{collection:r.collection||r.dataset,appInstanceId:s});return c(a),u.on("data",(function(r){return r.appInstanceId===s&&o(r)})),function(){return p(a)}}};export{m as corvaAPI,j as corvaDataAPI,d as socketClient};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.28.0-2",
3
+ "version": "0.28.0-3",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"