@corva/ui 0.26.0-rc.0 → 0.26.0
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/defineProperty";import{debounce as t,identity as n}from"lodash";import r from"@babel/runtime/helpers/slicedToArray";import{jsxs as o,jsx as i}from"react/jsx-runtime";import{withStyles as a,List as l,FormControl as s,InputLabel as p,FormHelperText as
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{debounce as t,identity as n}from"lodash";import r from"@babel/runtime/helpers/slicedToArray";import{jsxs as o,jsx as i}from"react/jsx-runtime";import{withStyles as a,List as l,FormControl as s,InputLabel as p,FormHelperText as d,Typography as u,TextField as c,InputAdornment as f,Chip as m}from"@material-ui/core";import{forwardRef as b,useState as g,useEffect as h,useMemo as y}from"react";import O from"@babel/runtime/helpers/objectWithoutProperties";import v from"prop-types";import{Search as x}from"@material-ui/icons";import T from"../TruncatedText/index.js";import{PER_PAGE as I,SCROLL_THRESHOLD as C}from"./constants.js";import{useAssetAutoCompleteSelectData as j}from"./effects/index.js";import{Autocomplete as A}from"@material-ui/lab";function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function S(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?P(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var M="DC_SingleAssetEditorAutocomplete",w={paddingLeft:"16px",height:36,listStyleType:"none",display:"flex",alignItems:"center"},L=function(e){var t=e.text;return i("li",{style:w,children:i(u,{variant:"body2",color:"textSecondary",children:void 0===t?"Loading...":t})},"loading")},D=b((function(e,t){var n=e.children,r=e.loading,a=e.hasMore,s=O(e,["children","loading","hasMore"]);return o(l,S(S({},s),{},{ref:t,role:"listbox",children:[n,(a||r)&&i(L,{})]}))})),N=function(e){var a=e["data-testid"],l=e.appKey,u=e.assetType,b=e.classes,O=e.companyId,v=e.currentValue,P=e.disabled,w=e.disableClearable,N=e.errorText,R=e.isMultiple,V=e.isNullable,E=e.label,K=e.onChange,_=e.parentAssetId,k=e.parentAssetType,q=g(R?[]:null),z=r(q,2),H=z[0],B=z[1],W=g(""),F=r(W,2),G=F[0],J=F[1],Q=g(""),U=r(Q,2),X=U[0],Y=U[1],Z=g(!1),$=r(Z,2),ee=$[0],te=$[1],ne=g(1),re=r(ne,2),oe=re[0],ie=re[1],ae=g(!0),le=r(ae,2),se=le[0],pe=le[1];h((function(){B(R?[]:null),ie(1),te(!1)}),[u]);var de=j({appKey:l,assetType:u,companyId:O,currentValue:v,isMultiple:R,parentAssetId:_,parentAssetType:k,scrollPage:oe,searchText:G,setCurrentOption:B}),ue=de.assets,ce=de.loading;h((function(){var e=ue.length>=I*oe;pe(e)}),[ue,oe]);var fe=y((function(){return t((function(e){ie(1),J(e)}),200)}),[]),me=y((function(){return t((function(){return ie((function(e){return e+1}))}),250)}),[]),be={endAdornment:b.endAdornment,inputRoot:b.inputRoot,listbox:b.listbox,noOptions:b.noOptions,option:b.option,popupIndicator:b.popupIndicator,root:b.root};return o(s,{disabled:P,error:!!N,className:b.formControl,children:[!V&&i(p,{shrink:!0,children:E}),i(A,S({disabled:P,blurOnSelect:!0,classes:be,clearOnBlur:!0,clearOnEscape:!0,"data-testid":a,disableClearable:w,filterOptions:n,getOptionLabel:function(e){return null==e?void 0:e.name},getOptionSelected:function(e,t){return e&&t&&e.id===t.id},inputValue:ee?X:(null==H?void 0:H.name)||"",ListboxComponent:D,ListboxProps:{onScroll:function(e){if(se&&!ce){var t=e.currentTarget;t.scrollTop+t.clientHeight>t.scrollHeight-C&&me()}},loading:ce,hasMore:se},options:ue,onChange:function(e,t){var n;B(t),K(R?t.map((function(e){return e.id})):null!==(n=null==t?void 0:t.id)&&void 0!==n?n:null,t)},onClose:function(){Y(""),J(""),te(!1),ie(1)},onInputChange:function(e,t,n){"input"===n?(Y(t),te(!0),fe(t)):J("")},noOptionsText:i(L,{text:ce?"Loading...":"No options"}),renderInput:function(e){return i(c,S(S({},e),{},{variant:"standard",placeholder:"Search for asset..."},!R&&{InputProps:S(S({},e.InputProps),{},{startAdornment:i(f,{children:i(x,{className:b.searchIcon})})})}))},renderOption:function(e){var t=e.id,n=e.name;return i(T,{"data-testid":"".concat(M,"_option_").concat(n,"MenuItem"),children:R&&v.includes(t)?"".concat(n," (already selected)"):n},t)},value:H,multiple:R},R&&{renderTags:function(e,t){return e.map((function(e,n){return i(m,S({label:null==e?void 0:e.name},t({index:n})),e.id)}))},getOptionDisabled:function(e){return v.includes(e.id)}})),i(d,{children:N})]})};N.defaultProps={label:"Choose An Asset",currentValue:void 0,disableClearable:!0,isNullable:!1,parentAssetId:void 0,parentAssetType:void 0,companyId:void 0,errorText:"","data-testid":"".concat(M,"_autoComplete"),disabled:!1,isMultiple:!1,appKey:null},N.propTypes={label:v.string,currentValue:v.oneOfType([v.number,v.arrayOf(v.number)]),isNullable:v.bool,onChange:v.func.isRequired,classes:v.shape({}).isRequired,disableClearable:v.bool,parentAssetId:v.number,parentAssetType:v.string,companyId:v.number,assetType:v.string.isRequired,errorText:v.string,"data-testid":v.string,disabled:v.bool,isMultiple:v.bool,appKey:v.string};var R=a((function(e){return{formControl:{},listbox:{maxHeight:350},root:{fontSize:16},inputRoot:{paddingTop:16,padding:"8px 0",paddingBottom:0,width:350,fontSize:16},popupIndicator:{display:"none"},option:{paddingLeft:"16px !important",height:36,"&[aria-disabled=true]":{color:e.palette.primary.text9,opacity:1,backgroundColor:"unset"}},noOptions:{padding:0},searchIcon:{fontSize:"20px !important"}}}))(N);export default R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'../../ext-esm/style-inject/dist/style-inject.es.js';e(".HeaderLayout_layoutContainer__1t8ww{display:flex;flex-direction:column}.HeaderLayout_layoutTopLarge__3Bhug{display:flex;align-items:center;justify-content:space-between}.HeaderLayout_layoutTopRightLarge__Ykjaw{
|
|
1
|
+
import e from'../../ext-esm/style-inject/dist/style-inject.es.js';e(".HeaderLayout_layoutContainer__1t8ww{display:flex;flex-direction:column}.HeaderLayout_layoutTopLarge__3Bhug{display:flex;align-items:center;justify-content:space-between}.HeaderLayout_layoutTopRightLarge__Ykjaw{align-items:baseline;justify-content:end}.HeaderLayout_layoutTopRightLarge__Ykjaw,.HeaderLayout_layoutTopSmall__3bKdD{display:flex;width:auto;overflow:hidden}.HeaderLayout_layoutTopSmall__3bKdD{align-items:center;justify-content:space-between}.HeaderLayout_assetChips__3D5Me{overflow:hidden;display:flex;justify-content:end}.HeaderLayout_layoutBottomSmall__35m3P{display:flex;align-items:baseline;justify-content:flex-start;flex-wrap:wrap;padding-top:8px}.HeaderLayout_layoutOffsetpicker__3QDW5{display:flex;align-items:center}.HeaderLayout_layoutOffsetwellChipsLarge__HmO44{display:flex;justify-content:flex-end;flex-wrap:wrap}.HeaderLayout_layoutOffsetwellChipsSmall__2qfWG{display:flex;justify-content:flex-start;flex-wrap:wrap}");export default{layoutContainer:"HeaderLayout_layoutContainer__1t8ww",layoutTopLarge:"HeaderLayout_layoutTopLarge__3Bhug",layoutTopRightLarge:"HeaderLayout_layoutTopRightLarge__Ykjaw",layoutTopSmall:"HeaderLayout_layoutTopSmall__3bKdD",assetChips:"HeaderLayout_assetChips__3D5Me",layoutBottomSmall:"HeaderLayout_layoutBottomSmall__35m3P",layoutOffsetpicker:"HeaderLayout_layoutOffsetpicker__3QDW5",layoutOffsetwellChipsLarge:"HeaderLayout_layoutOffsetwellChipsLarge__HmO44",layoutOffsetwellChipsSmall:"HeaderLayout_layoutOffsetwellChipsSmall__2qfWG"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i,jsxs as e,Fragment as r}from"react/jsx-runtime";import{Collapse as t}from"@material-ui/core";import{useMemo as l,cloneElement as
|
|
1
|
+
import{jsx as i,jsxs as e,Fragment as r}from"react/jsx-runtime";import{Collapse as t}from"@material-ui/core";import{useMemo as l,cloneElement as a}from"react";import n from"prop-types";import{SizeMe as c}from"react-sizeme";import{getAppTitle as o,getAppSubTitle as d,getExpander as s,getOffsetPicker as m,getSecondaryAsset as p,getModeSelect as h,getPadChip as u,getPrimaryAsset as f,getOffsetWellsChip as v}from"./utils.js";import{LARGE_SIZE_LAYOUT as y,MEDIUM_SIZE_LAYOUT as N,SMALL_SIZE_LAYOUT as O}from"./constants.js";import{useComonentsWidth as g,useFilterLayout as j}from"./effects/index.js";import C from"./HeaderLayout.css.js";function T(i,e){var r,t,l,n;return i===O&&e?a(e,e.props,(r=e.props.children,t=r.split(" "),l=r[0],n=t[t.length-1],"".concat(l," ").concat(n))):e}function w(a){var n=a.children,c=a.appWidth,w=g(n),L=j(n,w,c),R=o(n),W=d(n),q=s(n),x=m(n),S=p(n),k=h(n),z=u(n),B=f(n),H=v(n),b=l((function(){return T(L,B)}),[L,B]),A=l((function(){return T(L,z)}),[L,z]);return e("div",{style:{width:"100%"},children:[i(t,{timeout:10,in:L===y,children:e("div",{className:C.layoutContainer,children:[e("div",{className:C.layoutTopLarge,children:[i("div",{children:R}),e("div",{className:C.layoutTopRightLarge,children:[S,k,e("div",{className:C.layoutOffsetpicker,children:[q,x]}),z,B]})]}),i("div",{children:W}),i("div",{className:C.layoutOffsetwellChipsLarge,children:H})]})}),i(t,{timeout:10,in:[N,O].includes(L),children:e("div",{className:C.layoutContainer,children:[e("div",{className:C.layoutTopSmall,children:[i("div",{children:R}),e("div",{className:C.assetChips,children:[L===N&&e(r,{children:[z,B]}),L===O&&b]})]}),i("div",{children:W}),e("div",{className:C.layoutBottomSmall,children:[S,k,L===O&&A,e("div",{className:C.layoutOffsetpicker,children:[q,x]})]}),i("div",{className:C.layoutOffsetwellChipsSmall,children:H})]})})]})}function L(e){return i(c,{monitorWidth:!0,children:function(r){var t=r.size;return i(w,{appWidth:t.width-21,children:e.children})}})}w.propTypes={appWidth:n.func.isRequired,children:n.arrayOf(n.node).isRequired},L.propTypes={children:n.arrayOf(n.node).isRequired};export default L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import{jsxs as a,jsx as i}from"react/jsx-runtime";import{withStyles as l,Grid as
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{jsxs as a,jsx as i}from"react/jsx-runtime";import{withStyles as l,Grid as r,Typography as t,Switch as o}from"@material-ui/core";import{forwardRef as s}from"react";import c from"prop-types";import n from"classnames";import d from"./style.css.js";var b=s((function(l,s){var c,b,m=l.title,p=l.leftLabel,h=l.rightLabel,f=l.checked,g=l.onChange,u=l.disabled,L=l.classes,k=l.size,D=l.className,w=p&&h;return a("div",{className:D,children:[m&&i("div",{className:d.switchControlTitle,children:m}),a(r,{component:"label",container:!0,alignItems:"center",spacing:0,children:[p&&i(r,{item:!0,children:i(t,{variant:"body2",className:n(L.label,"small"===k&&L.labelSmall,!f&&!u&&L.activeLabel,u&&L.disabledLabel),children:p})}),i(r,{item:!0,children:i(o,{ref:s,checked:f,onChange:g,color:"primary",disabled:u,classes:{root:L.root,switchBase:n((c={},e(c,L.switchBase,w||f&&!u),e(c,L.switchBaseDisabled,u&&(w||f)),e(c,L.switchBaseDisabledNoLabels,!w&&u&&!f),c)),track:n((b={},e(b,L.track,w||f&&!u),e(b,L.trackDisabled,u&&(w||f)),e(b,L.trackDisabledNoLabels,!w&&u&&!f),b))},size:k})}),h&&i(r,{item:!0,children:i(t,{variant:"body2",className:n(L.label,"small"===k&&L.labelSmall,f&&!u&&L.activeLabel,u&&L.disabledLabel),children:h})})]})]})}));b.propTypes={title:c.string,leftLabel:c.string,rightLabel:c.string,checked:c.bool.isRequired,onChange:c.func.isRequired,disabled:c.bool,classes:c.shape({}).isRequired,size:c.string,className:c.string},b.defaultProps={title:"",leftLabel:"",rightLabel:"",disabled:!1,size:"medium",className:""};var m=l({root:{width:60,height:40,padding:13,"&.MuiSwitch-sizeSmall":{width:52,height:36,padding:13},"& .MuiSwitch-switchBase":{padding:10}},switchBase:{padding:10,color:"#03BCD4","&.MuiIconButton-root:hover":{backgroundColor:"rgba(3, 188, 212, 0.08)"}},switchBaseDisabled:{color:"#196069 !important"},track:{backgroundColor:"#196069 !important",opacity:"1 !important",border:"none"},trackDisabled:{backgroundColor:"#223D40 !important",opacity:"1 !important",border:"none"},switchBaseDisabledNoLabels:{color:"#545454 !important"},trackDisabledNoLabels:{backgroundColor:"#3D3D3D !important",opacity:"1 !important",border:"none"},label:{display:"flex",justifyContent:"center",flexDirection:"column",fontSize:"16px",lineHeight:"22px",color:"#bdbdbd",margin:"8px 0px",cursor:"pointer"},labelSmall:{fontSize:"14px",lineHeight:"20px"},disabledLabel:{cursor:"default",color:"#616161"},activeLabel:{color:"#ffffff"}})(b);export default m;
|