@corva/ui 0.36.0-5 → 0.36.0-8

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 t from"@babel/runtime/helpers/toConsumableArray";import o from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/objectWithoutProperties";import{useMemo as i,useState as n,useEffect as p}from"react";import s from"prop-types";import m from"classnames";import{get as a,noop as l,identity as c}from"lodash";import{makeStyles as d}from"@material-ui/core";import j from"@material-ui/lab/Autocomplete";import C from"@material-ui/icons/Close";import"../Modal/index.js";import"../IconMenu/index.js";import"../StyledMenuItem/index.js";import"../DevCenter/AppHeader/AppHeader.js";import"../DevCenter/AppSideBar/AppSideBar.js";import"../DevCenter/AppsDataProvider/AppsDataProvider.js";import"@material-ui/icons/Help";import"../Icons/AnnotationIcon.js";import"../Annotations/components/AnnotationsList/index.js";import"../Annotations/components/LastAnnotation/index.js";import"../Annotations/AnnotationsContext.js";import"../../utils/mobileDetect.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions.js";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/alerts.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/completion.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import"../../utils/index.js";import"../HelpCenter/ArticleIcon.js";import"../HelpCenter/DialogLayout.js";import"../HelpCenter/HelpCenterDialog/HelpCenterDialog.js";import"../HelpCenter/ItemContent/ItemContent.js";import"../HelpCenter/SingleItemHeader.js";import"../HelpCenter/shapes/index.js";import"../DevCenter/DevCenterAppContainer/components/AppActions/AppActions.css.js";import{jsx as u}from"react/jsx-runtime";import"../DevCenter/DevCenterAppContainer/components/AppSettingsDialog/AppSettingsDialog.js";import"../DevCenter/DevCenterAppContainer/components/AnnotationsButton/AnnotationsButton.js";import"../DevCenter/DevCenterAppContainer/components/NonPriorityMenus/NonPriorityMenus.js";import"../DevCenter/DevCenterAppContainer/components/FullscreenButton/FullscreenButton.js";import"../DevCenter/DevCenterAppContainer/components/AppInfoMessage/AppInfoMessage.js";import"../ErrorBoundary/ErrorBoundary.js";import"../ErrorBoundary/DevCenterAppErrorView/DevCenterAppErrorView.js";import"../LoadingIndicator/LoadingIndicator.js";import"../EmptyView/EmptyAppView/components/ErrorSubtitleWithIntercomLink.js";import"../DevCenter/DevCenterAppContainer/components/DevCenterAppView/components/ChooseAssetButton/index.js";import"../DevCenter/DevCenterAppContainer/components/DisabledSettingsMessage/DisabledSettingsMessage.js";import"../DevCenter/DevCenterAppContainer/components/DcTooltipsCoordinatorProvider/DcTooltipsCoordinatorProvider.js";import"../DevCenter/DevCenterAppContainer/components/IsInsideDcAppProvider/IsInsideDcAppProvider.js";import"../DevCenter/AppContext.js";import"../DevCenter/DevCenterAppContainer/DevCenterAppContainer.css.js";import"../DevCenter/DevCenterAppContainer/components/RestoreAppSizeButton/index.js";import"../DevCenter/DevCenterAppContainer/components/PriorityMenus/PriorityMenus.css.js";import"../DevCenter/DevCenterRouterContext/DevCenterRouterContext.js";import"../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import"react-router";import"../DevCenter/NavigationBar/NavigationBar.js";import"../DevCenter/SideBar/SideBar.js";import"../DevCenter/AppSettingsPopover/AppSettingsPopover.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedAppPage.js";import"../DevCenter/IsolatedDevCenterAppContainer/DevCenterIsolatedApp.js";import"../DevCenter/IsolatedDevCenterAppContainer/AppsGridDragHandle.js";import"../AssetEditor/index.js";import"../AppVersionsSelect/AppVersionsSelect.js";import"../Typography.js";import"../CollapsableSidebar.js";import"../DateTimePicker/index.js";import"../DatePicker/index.js";import"../SlateFormattedText/SlateFormattedText.js";import"../SlateFormattedText/RenderElements.js";import"@babel/runtime/helpers/typeof";import"slate";import"../ParameterCharts/ParameterCharts.js";import"../ParameterCharts/AddEditTrack.js";import"../ChartActionsList/ChartActionsList.js";import"../AssetEditor/AssetEditorAutocomplete.js";import"../AssetEditor/SingleAssetEditor.js";import"../SettingEditors/ColorEditor/index.js";import"../SettingEditors/DropdownEditor/index.js";import"../SettingEditors/RadioEditor/index.js";import"../SwitchControl/index.js";import"../ColorPicker/ColorPicker.js";import"../ColorPicker/PaletteChromePicker/PaletteChromePicker.js";import"../TruncatedText/index.js";import"../RangeSlider/RangeSlider.js";import"../Login/components/Login.js";import"../Login/components/PasswordField.js";import"../Login/components/Chip.js";import"../Login/components/StepFooter.js";import"../Login/components/StepContent.js";import"../Login/components/StepHeader.js";import"../Login/components/Step.js";import"../Login/components/OrDivider.js";import"../Login/components/HiddenEmailField.js";import"../Login/components/EmailField.js";import"../Breadcrumbs/index.js";import"../VirtualizedTable/index.js";import"../EmptyView/EmptyView.js";import"../EmptyView/EmptyAppView/EmptyAppView.js";import"../Button/index.js";import"../ContextMenuItem/index.js";import"../FolderMenuItem/index.js";import"../EditableItem/EditableItem/index.js";import"../EditableItem/EditableItemWithBadge/index.js";import"../Checkbox/index.js";import"../FolderMenuItemWithLinks/index.js";import"../IconButton/index.js";import"../TextField/index.js";import"../Chip/index.js";import"../Counter/index.js";import"../AnchorsList/AnchorsList.js";import"../Select/index.js";import"../CustomSelect/index.js";import"../Tabs/Tabs.js";import"../Tabs/Tab.js";import"../ResizableTable/ResizableTable.js";import"../Drillstring/BHASchematic.js";import"../Drillstring/BHATable/index.js";import"../Drillstring/BHAComponentIcon.js";import"../Drillstring/BHAComponentDetail/index.js";import"../Drillstring/BHATileIcon.js";import"../Drillstring/BHATile/BHATile.js";import"../Drillstring/BHAList/BHAList.js";import"../Casing/CasingTable/index.js";import"../Casing/CasingComponentIcon.js";import"../Casing/CasingTileIcon.js";import"../Casing/CasingTableV2/CasingTableV2.js";import"../Casing/CasingTile/CasingTile.js";import"../WellSummary/WellSummaryItemLabel.js";import"../WellSummary/WellSummaryItemTitle.js";import"../WellSummary/WellSummaryItemValue.js";import"../WellSummary/ActivitySummaryChart.js";import"../WellSummary/FracWirelineTimeChart.js";import"../BICOffsetPickerDialog/index.js";import"../OffsetWellPickerV2/OffsetWellPickerDialog.js";import"../OffsetWellPickerV3/index.js";import"../Notifications/Notifications.js";import"uuid";import"../ConfirmationDialog.js";import"../TextLink/index.js";import"../Avatar/index.js";import"../Template/TemplatePopover/index.js";import"../MenuItem/index.js";import"../PadModeSelect/PadModeSelect.js";import"../PinnableFilters/PinnableFilters.js";import"../HeaderLayout/HeaderLayout.js";import"../PadOffsetsPicker/PadOffsetsPicker.js";import"../PadOffsetsPicker/OffsetAssetChip.js";import"../PadOffsetsPicker/OffsetAssetsListExpander.js";import"../PadOffsetsPicker/StagesSelector.js";import"../Table/TableToolbar/TableToolbar.js";import{Tooltip as g}from"../Tooltip/Tooltip.js";import"../PriceInput/PriceInput.js";import"../LabelsCounter/LabelsCounter.js";import"../Stepper/Step.js";import"../Stepper/StepsWrapper.js";import"../Stepper/Stepper.js";import"../Comment/CommentIcon/index.js";import"../FilesLoader/FilesLoader.js";import"../FilesLoader/Icons/FileIcon.js";import"../SearchInput/index.js";import"../FeedItem/FeedItem.js";import"../FeedItem/FeedItemEditProvider/FeedItemEditProvider.js";import"../PostInput/PostInput.js";import"../KeyboardDateTimePicker.js";import"../AddComment/Popover.js";import"../AddComment/Popup.js";import"../StageDesignVActual/ComparisonBar/ComparisonBar.js";import"../StageDesignVActual/ElementsComparison/ElementsComparison.js";import"../StageDesignVActual/ComparisonHeader.js";import"../StageDesignVActual/ComparisonRow.js";import"../EmbeddedApp/DevCenterEmbeddedApp.js";import"../EmbeddedApp/EmbeddedApp.js";import"../DocumentViewer/DocumentViewer.js";var A=["isCreatable","options","value","getOptionLabel","onInputChange","onChange","renderOption","classes"];function v(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function D(t){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?v(Object(r),!0).forEach((function(o){e(t,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var b=function(e){return a(a(e.split('Create "'),"1","").split('"'),"0","")},f=d((function(e){return{root:{width:200},paper:{maxHeight:400,boxShadow:"0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)"},createLabel:{fontSize:"16px",lineHeight:"22.5px",color:e.palette.primary.main},openIcon:{marginLeft:5},option:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"},closeIcon:{width:16,height:16}}})),x=function(s){var a=s.isCreatable,l=s.options,c=s.value,d=s.getOptionLabel,v=s.onInputChange,x=s.onChange,P=s.renderOption,I=s.classes,S=r(s,A),h=f(),y=i((function(){return null==l?void 0:l.map((function(e){return a?d(e):e}))}),[l]),L=i((function(){return a?d(c)||"":c}),[c]),T=n(y),E=o(T,2),O=E[0],B=E[1],w=n(null),H=o(w,2),k=H[0],F=H[1];p((function(){B(y)}),[y]);return u(j,D({value:L,onChange:a?function(e,o){return function(e){if(null!=e&&e.includes('Create "')&&d(e)===d(k)){F(null);var o=b(k);B([].concat(t(y),[o])),x(o,!0)}else x(e,!1)}(o)}:x,onInputChange:a?function(e,o){return function(e){if(""===e)F(null),B(y);else if(y.find((function(t){return t===e}))){var o=y.filter((function(e){return!e.includes('Create "')}));B(o)}else{var r=function(e){return'Create "'.concat(e,'"')}(e);F(r),B([].concat(t(y),[r]))}}(o)}:v,options:O,getOptionLabel:a?function(e){return e}:d,renderOption:a?function(t){var o=b(t);return u(g,{title:t,children:u("div",{className:m(e({},h.createLabel,o&&t!==o),h.option,null==I?void 0:I.optionLabelClass),children:t})})}:P,classes:D({root:m(h.root,null==I?void 0:I.root),paper:m(h.paper,null==I?void 0:I.paper),popupIndicator:h.openIcon},I),closeIcon:(L||k)&&u(C,{className:h.closeIcon})},S))};x.propTypes={value:s.oneOfType([s.string,s.shape({})]).isRequired,options:s.shape([]).isRequired,isCreatable:s.bool,getOptionLabel:s.func,onChange:s.func,onInputChange:s.func,renderOption:s.func,classes:s.shape()},x.defaultProps={isCreatable:!1,onChange:l,getOptionLabel:c,onInputChange:l,renderOption:c,classes:{}};export{x as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/toConsumableArray";import t from"@babel/runtime/helpers/slicedToArray";import n from"@babel/runtime/helpers/objectWithoutProperties";import{useMemo as o,useState as i,useEffect as p}from"react";import a from"prop-types";import l from"classnames";import{get as c,noop as u,identity as s}from"lodash";import{makeStyles as f}from"@material-ui/core";import m from"@material-ui/lab/Autocomplete";import b from"@material-ui/icons/Close";import{Tooltip as h}from"../Tooltip/Tooltip.js";import{jsx as d}from"react/jsx-runtime";var g=["isCreatable","options","value","getOptionLabel","onInputChange","onChange","renderOption","classes"];function O(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function v(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){e(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}))}return r}var C=function(e){return c(c(e.split('Create "'),"1","").split('"'),"0","")},x=f((function(e){return{root:{width:200},paper:{maxHeight:400,boxShadow:"0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)"},createLabel:{fontSize:"16px",lineHeight:"22.5px",color:e.palette.primary.main},openIcon:{marginLeft:5},option:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"},closeIcon:{width:16,height:16}}})),y=function(a){var c=a.isCreatable,u=a.options,s=a.value,f=a.getOptionLabel,O=a.onInputChange,y=a.onChange,j=a.renderOption,w=a.classes,I=n(a,g),P=x(),L=o((function(){return null==u?void 0:u.map((function(e){return c?f(e):e}))}),[u]),S=o((function(){return c?f(s)||"":s}),[s]),T=i(L),D=t(T,2),A=D[0],q=D[1],E=i(null),H=t(E,2),N=H[0],R=H[1];p((function(){q(L)}),[L]);return d(m,v({value:S,onChange:c?function(e,t){return function(e){if(null!=e&&e.includes('Create "')&&f(e)===f(N)){R(null);var t=C(N);q([].concat(r(L),[t])),y(t,!0)}else y(e,!1)}(t)}:y,onInputChange:c?function(e,t){return function(e){if(""===e)R(null),q(L);else if(L.find((function(r){return r===e}))){var t=L.filter((function(e){return!e.includes('Create "')}));q(t)}else{var n=function(e){return'Create "'.concat(e,'"')}(e);R(n),q([].concat(r(L),[n]))}}(t)}:O,options:A,getOptionLabel:c?function(e){return e}:f,renderOption:c?function(r){var t=C(r);return d(h,{title:r,children:d("div",{className:l(e({},P.createLabel,t&&r!==t),P.option,null==w?void 0:w.optionLabelClass),children:r})})}:j,classes:v({root:l(P.root,null==w?void 0:w.root),paper:l(P.paper,null==w?void 0:w.paper),popupIndicator:P.openIcon},w),closeIcon:(S||N)&&d(b,{className:P.closeIcon})},I))};y.propTypes={value:a.oneOfType([a.string,a.shape({})]).isRequired,options:a.shape([]).isRequired,isCreatable:a.bool,getOptionLabel:a.func,onChange:a.func,onInputChange:a.func,renderOption:a.func,classes:a.shape()},y.defaultProps={isCreatable:!1,onChange:u,getOptionLabel:s,onInputChange:u,renderOption:s,classes:{}};export{y as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import{memo as r}from"react";import{shape as i,number as n}from"prop-types";import{makeStyles as o,TableRow as a,TableCell as l}from"@material-ui/core";import{InfoOutlined as c}from"@material-ui/icons";import t from"../CasingComponentIcon.js";import{jsxs as m,jsx as s}from"react/jsx-runtime";var d,p=o({tableBodyCell:{padding:0,borderBottom:"none",height:49},componentIconCell:{padding:0,borderBottom:"none",height:49,display:"flex",alignItems:"center"},infoIcon:{fontSize:16,color:"#ccc"},iconWrapper:(d={display:"inline-block",width:"40px",height:"48px"},e(d,"display","flex"),e(d,"justifyContent","center"),e(d,"marginRight","4px"),d)}),h=function(e){var r=e.component,i=e.order,n=p(),o=n.tableBodyCell,d=n.componentIconCell,h=n.infoIcon,f=n.iconWrapper;return m(a,{children:[s(l,{className:o,children:i}),m(l,{className:d,children:[s("div",{className:f,children:s(t,{component:r})}),s("div",{children:r.family_name||r.family})]}),s(l,{className:o,children:r.name}),s(l,{className:o,children:r.outer_diameter}),s(l,{className:o,children:r.inner_diameter}),s(l,{className:o,children:r.linear_weight}),s(l,{className:o,children:r.length}),s(l,{className:o,children:r.weight}),s(l,{className:o,children:r.cum_length}),s(l,{className:o,children:r.grade}),s(l,{className:o,children:s(c,{className:h})})]})};h.propTypes={component:i({}).isRequired,order:n.isRequired};var f=r(h);export{f as default};
1
+ import{memo as e}from"react";import{shape as r,number as n}from"prop-types";import{makeStyles as i,TableRow as a,TableCell as o}from"@material-ui/core";import{InfoOutlined as c}from"@material-ui/icons";import l from"../CasingComponentIcon.js";import{jsxs as t,jsx as m}from"react/jsx-runtime";var s=i({tableBodyCell:{padding:0,borderBottom:"none",height:49},componentIconCell:{padding:0,borderBottom:"none",height:49,display:"flex",alignItems:"center"},infoIcon:{fontSize:16,color:"#ccc"},iconWrapper:{width:"40px",height:"48px",display:"flex",justifyContent:"center",marginRight:"4px"}}),d=function(e){var r=e.component,n=e.order,i=s(),d=i.tableBodyCell,p=i.componentIconCell,h=i.infoIcon,f=i.iconWrapper;return t(a,{children:[m(o,{className:d,children:n}),t(o,{className:p,children:[m("div",{className:f,children:m(l,{component:r})}),m("div",{children:r.family_name||r.family})]}),m(o,{className:d,children:r.name}),m(o,{className:d,children:r.outer_diameter}),m(o,{className:d,children:r.inner_diameter}),m(o,{className:d,children:r.linear_weight}),m(o,{className:d,children:r.length}),m(o,{className:d,children:r.weight}),m(o,{className:d,children:r.cum_length}),m(o,{className:d,children:r.grade}),m(o,{className:d,children:m(c,{className:h})})]})};d.propTypes={component:r({}).isRequired,order:n.isRequired};var p=e(d);export{p as default};
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import m from"prop-types";import p from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import d from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as v}from"@material-ui/core";import I from"@material-ui/core/colors/grey";import x from"../Avatar/index.js";import y from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import E from"../FailedFileUploading.js";import S from"../UserMention/index.js";import U from"../FilePreview/index.js";import N from"../IconButton/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as B}from"../../utils/nativeMessages.js";import{patchFeedItemComment as w}from"../../clients/jsonApi/index.js";import L from"./styles.css.js";import{jsxs as P,jsx as T}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(m,c);var r=z(m);function m(n){var i,a,c;return e(this,m),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,w(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(B(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(m,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.url:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[T("div",{style:D.chatAvatarWrapper,children:T(x,{displayName:i,size:24,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),T(f,{className:this.props.classes.paperRoot,children:T(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:S,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return t.setState({isInputFocused:!0})},onBlur:function(){return t.setState({isInputFocused:!1})}},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&T(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:d(L.cCommentInputIconContainer,L.cCommentInputIconUpload),children:T(y,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],inputId:"comment-attachment-".concat(this.props.editCommentId)})})}),T(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:L.cCommentInputIconContainer,children:T(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&T(E,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&T(U,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),(this.state.isInputFocused||this.state.attachmentUrl||this.state.comment)&&P("div",{className:L.cCommentInputSendContainer,children:[T("div",{className:L.cCommentInputSendContainerCancel,children:T(v,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),P("div",{className:L.cCommentInputSendContainerSend,children:[P(v,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",T(v,{variant:"caption",color:"primary",className:d(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),T(N,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:T(k,{})})]})]})]})}}]),m}();_.propTypes={inputRef:m.shape({current:m.shape({focus:m.shape({})})}),editFeedItemId:m.number,editCommentId:m.number,editComment:m.string,editAttachment:m.shape({url:m.string}),spaceAround:m.bool,postComment:m.func.isRequired,postCommentCallback:m.func,patchCommentCallback:m.func,exitEditMode:m.func,setIsPosting:m.func,setIsEditting:m.func,onMount:m.func,autoFocus:m.bool,disabled:m.bool,classes:m.shape({}).isRequired,currentUser:m.shape(),isNative:m.bool,companyId:m.number},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:p,setIsEditting:p,onMount:p,autoFocus:void 0,disabled:!1,patchCommentCallback:p,postCommentCallback:p,exitEditMode:p,companyId:null,currentUser:{},isNative:R};var O=u((function(t){return{paperRoot:{width:"calc(100% - 40px)",marginLeft:40,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"8px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}}}}))(_);export{O as default};
1
+ import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import p from"prop-types";import m from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import d from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as I}from"@material-ui/core";import v from"@material-ui/core/colors/grey";import x from"../Avatar/index.js";import y from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import E from"../FailedFileUploading.js";import S from"../UserMention/index.js";import U from"../FilePreview/index.js";import N from"../IconButton/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as B}from"../../utils/nativeMessages.js";import{patchFeedItemComment as w}from"../../clients/jsonApi/index.js";import L from"./styles.css.js";import{jsxs as P,jsx as T}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(p,c);var r=z(p);function p(n){var i,a,c;return e(this,p),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,w(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(B(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(p,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?this.props.editAttachment.file_name||M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[T("div",{style:D.chatAvatarWrapper,children:T(x,{displayName:i,size:24,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),T(f,{className:this.props.classes.paperRoot,children:T(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:S,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return t.setState({isInputFocused:!0})},onBlur:function(){return t.setState({isInputFocused:!1})}},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&T(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:d(L.cCommentInputIconContainer,L.cCommentInputIconUpload),children:T(y,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId)})})}),T(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:L.cCommentInputIconContainer,children:T(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&T(E,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&T(U,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),(this.state.isInputFocused||this.state.attachmentUrl||this.state.comment)&&P("div",{className:L.cCommentInputSendContainer,children:[T("div",{className:L.cCommentInputSendContainerCancel,children:T(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),P("div",{className:L.cCommentInputSendContainerSend,children:[P(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",T(I,{variant:"caption",color:"primary",className:d(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),T(N,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:T(k,{})})]})]})]})}}]),p}();_.propTypes={inputRef:p.shape({current:p.shape({focus:p.shape({})})}),editFeedItemId:p.number,editCommentId:p.number,editComment:p.string,editAttachment:p.shape({url:p.string,size:p.number,file_name:p.string}),spaceAround:p.bool,postComment:p.func.isRequired,postCommentCallback:p.func,patchCommentCallback:p.func,exitEditMode:p.func,setIsPosting:p.func,setIsEditting:p.func,onMount:p.func,autoFocus:p.bool,disabled:p.bool,classes:p.shape({}).isRequired,currentUser:p.shape(),isNative:p.bool,companyId:p.number,parentId:p.string},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:m,setIsEditting:m,onMount:m,autoFocus:void 0,disabled:!1,patchCommentCallback:m,postCommentCallback:m,exitEditMode:m,companyId:null,currentUser:{},isNative:R};var O=u((function(t){return{paperRoot:{width:"calc(100% - 40px)",marginLeft:40,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"8px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}}}}))(_);export{O as default};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useRef as t}from"react";import r from"prop-types";import n from"lodash/noop";import m from"moment";import{makeStyles as i,Button as s,Typography as a}from"@material-ui/core";import p from"../../Comment/index.js";import c from"../../CommentLoader.js";import d from"../../CommentInput/index.js";import{postFeedItemComment as u}from"../../../clients/jsonApi/index.js";import{isNativeDetected as l}from"../../../utils/mobileDetect.js";import{jsxs as f,jsx as C}from"react/jsx-runtime";var h=i({showMoreButtonRoot:{textTransform:"none",backgroundColor:"transparent!important"},feedCommentsContainer:{padding:"0 24px 0 32px"}});function x(r){var i=r.openCommentInput,x=r.feedItem,y=r.currentUser,I=o(!1),b=e(I,2),j=b[0],v=b[1],R=o(3),g=e(R,2),k=g[0],w=g[1],U=t(),_=h(),q=x.comments.length,M=q>k;return f("div",{className:(i||!!q)&&_.feedCommentsContainer,children:[i&&!l&&C(d,{inputRef:U,postComment:function(e){u(x.id,e)},setIsPosting:v,companyId:x.company_id,autoFocus:!1,currentUser:y}),M&&C(s,{"data-testid":"".concat("FeedComments","_viewMoreComments"),classes:_.showMoreButtonRoot,onClick:function(){w((function(e){return 3===e?e+7:e+10}))},children:C(a,{variant:"caption",color:"primary",children:"View more comments"})}),x.comments.sort((function(e){return-m(e.created_at).unix()})).slice(0,k).reverse().map((function(e){return C(p,{comment:e,handleDeleteCallback:n,patchCommentCallback:n,companyId:x.company_id,currentUser:y},e.id)})),j&&C(c,{})]})}x.propTypes={openCommentInput:r.bool.isRequired,feedItem:r.shape().isRequired,currentUser:r.shape().isRequired};export{x as default};
1
+ import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useRef as t}from"react";import r from"prop-types";import n from"lodash/noop";import m from"moment";import{makeStyles as i,Button as s,Typography as a}from"@material-ui/core";import c from"../../Comment/index.js";import p from"../../CommentLoader.js";import d from"../../CommentInput/index.js";import{postFeedItemComment as u}from"../../../clients/jsonApi/index.js";import{isNativeDetected as l}from"../../../utils/mobileDetect.js";import{jsxs as f,jsx as C}from"react/jsx-runtime";var h=i({showMoreButtonRoot:{textTransform:"none",backgroundColor:"transparent!important"},feedCommentsContainer:{padding:"0 24px 0 32px"}});function x(r){var i,x=r.openCommentInput,I=r.feedItem,v=r.currentUser,y=o(!1),b=e(y,2),j=b[0],R=b[1],g=o(3),k=e(g,2),w=k[0],U=k[1],_=t(),q=h(),M=I.comments.length,T=M>w;return f("div",{className:(x||!!M)&&q.feedCommentsContainer,children:[x&&!l&&C(d,{inputRef:_,postComment:function(e){u(I.id,e)},setIsPosting:R,companyId:I.company_id,autoFocus:!1,currentUser:v,parentId:"".concat(I.id,"-").concat(null===(i=I.comments)||void 0===i?void 0:i.size)}),T&&C(s,{"data-testid":"".concat("FeedComments","_viewMoreComments"),classes:q.showMoreButtonRoot,onClick:function(){U((function(e){return 3===e?e+7:e+10}))},children:C(a,{variant:"caption",color:"primary",children:"View more comments"})}),I.comments.sort((function(e){return-m(e.created_at).unix()})).slice(0,w).reverse().map((function(e){return C(c,{comment:e,handleDeleteCallback:n,patchCommentCallback:n,companyId:I.company_id,currentUser:v},e.id)})),j&&C(p,{})]})}x.propTypes={openCommentInput:r.bool.isRequired,feedItem:r.shape().isRequired,currentUser:r.shape().isRequired};export{x as default};
@@ -1 +1 @@
1
- import e from"prop-types";import{withStyles as r,FormControl as a,InputLabel as i,Select as s,MenuItem as n}from"@material-ui/core";import{jsxs as t,jsx as o}from"react/jsx-runtime";var l=function(e){var r=e.value,l=e.onChange,u=e.mapping,p=e.classes,c=e.showLabel;return t(a,{children:[o(i,{htmlFor:"traceKey",children:c?"Trace Name":r?"":"Choose a trace"}),o(s,{displayEmpty:!0,value:r,className:p.select,onChange:function(e){return l(e.target.value)},inputProps:{name:"traceKey"},children:u&&u.map((function(e){var r=e.key,a=e.name;return o(n,{value:r,children:a},r)}))})]})};l.propTypes={value:e.string.isRequired,onChange:e.func.isRequired,classes:e.shape({}).isRequired,showLabel:e.bool,mapping:e.arrayOf(e.shape({name:e.string.isRequired,key:e.string.isRequired}).isRequired)},l.defaultProps={value:"",showLabel:!1};var u=r({select:{width:200}})(l);export{u as default};
1
+ import e from"prop-types";import{withStyles as r,FormControl as a,InputLabel as i,Select as s,MenuItem as n}from"@material-ui/core";import{jsxs as t,jsx as o}from"react/jsx-runtime";var l=function(e){var r=e.value,l=e.onChange,u=e.mapping,p=e.classes,c=e.showLabel;return t(a,{children:[o(i,{htmlFor:"traceKey",children:c?"Trace Name":r?"":"Choose a trace"}),o(s,{displayEmpty:!0,value:r,className:p.select,onChange:function(e){return l(e.target.value)},inputProps:{name:"traceKey"},children:u&&u.map((function(e){var r=e.key,a=e.name;return o(n,{value:r,children:a},r)}))})]})};l.propTypes={value:e.string,onChange:e.func.isRequired,classes:e.shape({}).isRequired,showLabel:e.bool,mapping:e.arrayOf(e.shape({name:e.string.isRequired,key:e.string.isRequired}).isRequired).isRequired},l.defaultProps={value:"",showLabel:!1};var u=r({select:{width:200}})(l);export{u as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.36.0-5",
3
+ "version": "0.36.0-8",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"
@@ -21,7 +21,8 @@
21
21
  "test-watch": "jest --watch",
22
22
  "generate-css-themes": "node ./scripts/generateCssThemesVariables.mjs",
23
23
  "build-storybook": "IS_STORYBOOK_BUILD=true build-storybook -c storybook --no-dll",
24
- "storybook": "IS_STORYBOOK_BUILD=true start-storybook -p 6006 -c storybook --no-dll"
24
+ "storybook": "IS_STORYBOOK_BUILD=true start-storybook -p 6006 -c storybook --no-dll",
25
+ "check-duplications": "echo \"👀 Checking code duplications\" && jscpd src --silent"
25
26
  },
26
27
  "config": {
27
28
  "commitizen": {
@@ -29,7 +30,8 @@
29
30
  }
30
31
  },
31
32
  "pre-commit": [
32
- "lint-staged"
33
+ "lint-staged",
34
+ "check-duplications"
33
35
  ],
34
36
  "lint-staged": {
35
37
  "*.js": [
@@ -118,6 +120,7 @@
118
120
  "image-extensions": "1.1.0",
119
121
  "immutable": "3.8.2",
120
122
  "jest": "^26.4.1",
123
+ "jscpd": "^3.4.5",
121
124
  "jsona": "1.5.1",
122
125
  "lodash": "4.17.20",
123
126
  "mapbox.js": "3.2.1",
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/toConsumableArray";var r="SMALL",n="MEDIUM",e="LARGE",o="XLARGE",i=37.7952755906,a=18.8976377953,s=function(t){var r=t.width,n=t.height;return{pixelWidth:Math.round(18.8976377953*r),pixelHeight:Math.round(18.8976377953*n),realWidth:Math.round(2*r*18.8976377953),realHeight:Math.round(2*n*18.8976377953)}},u={NORMAL:{type:"NORMAL",columns:{min:1,max:7},rows:{min:1,max:1e3},slots:1,height:17.5,width:20.8},WIDE:{type:"WIDE",columns:{min:8,max:12},rows:{min:1,max:25},slots:2,height:17.5,width:41.8},HALFSCREEN:{type:"HALFSCREEN",columns:{min:8,max:12},rows:{min:26,max:40},slots:4,height:26.5,width:41.8},FULLSCREEN:{type:"FULLSCREEN",columns:{min:8,max:12},rows:{min:41,max:1e3},slots:6,height:53.3,width:41.8}};function c(t){return t.concat().sort((function(t,r){var n=t.coordinates.y,e=r.coordinates.y;if(n<e)return-1;if(n>e)return 1;if(n===e){var o=t.coordinates.x,i=r.coordinates.x;if(o<i)return-1;if(o>i)return 1}return 0}))}function m(t){var r=t.coordinates,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"dashboard";if("singleApp"===n)return u.FULLSCREEN;var e=r.w,o=r.h;return Object.values(u).find((function(t){return e>=t.columns.min&&e<=t.columns.max&&o>=t.rows.min&&o<=t.rows.max}))}function h(r,n){var e,o=[],i=[o],a=0;return r.reduce((function(i,s,c){e=!1;var h=m(s,n),l=h.slots,d=h.type;if(d!==u.FULLSCREEN.type){var f=r[c+1];if(f){var p=m(f,n);if(a%2==0&&1===l&&p.slots%2==0){var E=u.WIDE;l=E.slots,d=E.type}}else if(c%2==0){var v=u.WIDE;l=v.slots,d=v.type}}a+=l;var L={app:s,slots:l,reportAppSize:h},x=i.map((function(r){if(e)return r;var n=6-r.reduce((function(t,r){return t+r.slots}),0);return n>=l&&(e=!0),n>=l?[].concat(t(r),[L]):r}));return e?x:[].concat(t(x),[[].concat(o,[L])])}),i)}function l(t){var i=t.w,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return a?o:i>=5?e:i>=3?n:r}export{a as PDF_REPORT_PIXEL_RATIO,i as PIXELS_IN_CM,m as getAppType,s as getPDFAppPixelSize,l as getPDFAppSize,h as getPages,c as sortPDFDashboardApps};
1
+ import t from"@babel/runtime/helpers/toConsumableArray";var r="SMALL",n="MEDIUM",o="LARGE",e="XLARGE",i=37.7952755906,a=18.8976377953,u=function(t){var r=t.width,n=t.height;return{pixelWidth:Math.round(18.8976377953*r),pixelHeight:Math.round(18.8976377953*n),realWidth:Math.round(2*r*18.8976377953),realHeight:Math.round(2*n*18.8976377953)}},s={NORMAL:{type:"NORMAL",columns:{min:1,max:7},rows:{min:1,max:1e3},slots:1,height:17.5,width:20.8},WIDE:{type:"WIDE",columns:{min:8,max:12},rows:{min:1,max:25},slots:2,height:17.5,width:41.8},HALFSCREEN:{type:"HALFSCREEN",columns:{min:8,max:12},rows:{min:26,max:40},slots:4,height:26.5,width:41.8},FULLSCREEN:{type:"FULLSCREEN",columns:{min:8,max:12},rows:{min:41,max:1e3},slots:6,height:53.3,width:41.8}};function l(t){return t.concat().sort((function(t,r){var n=t.coordinates.y,o=r.coordinates.y;if(n<o)return-1;if(n>o)return 1;if(n===o){var e=t.coordinates.x,i=r.coordinates.x;if(e<i)return-1;if(e>i)return 1}return 0}))}function c(t){var r=t.coordinates,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"dashboard";if("singleApp"===n)return s.FULLSCREEN;var o=r.w,e=r.h;return Object.values(s).find((function(t){return o>=t.columns.min&&o<=t.columns.max&&e>=t.rows.min&&e<=t.rows.max}))}function m(r,n){var o,e=[],i=[e],a=0;return r.reduce((function(i,u,l){o=!1;var m=c(u,(null==u?void 0:u.layout)||n),h=m.slots,d=m.type;if(d!==s.FULLSCREEN.type){var f=r[l+1];if(f){var p=c(f,(null==f?void 0:f.layout)||n);if(a%2==0&&1===h&&p.slots%2==0){var v=s.WIDE;h=v.slots,d=v.type}}else if(l%2==0){var E=s.WIDE;h=E.slots,d=E.type}}a+=h;var L={app:u,slots:h,reportAppSize:m},x=i.map((function(r){if(o)return r;var n=6-r.reduce((function(t,r){return t+r.slots}),0);return n>=h&&(o=!0),n>=h?[].concat(t(r),[L]):r}));return o?x:[].concat(t(x),[[].concat(e,[L])])}),i)}function h(t){var i=t.w,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return a?e:i>=5?o:i>=3?n:r}export{a as PDF_REPORT_PIXEL_RATIO,i as PIXELS_IN_CM,c as getAppType,u as getPDFAppPixelSize,h as getPDFAppSize,m as getPages,l as sortPDFDashboardApps};
package/utils/time.js CHANGED
@@ -1 +1 @@
1
- import r from"moment-timezone";var n=function(n,o){return r.unix(n).format(o)},o=function(r,o){var u="M/D/YYYY h:mm a";return o?formatTimestampUsingTimezone(r,u):n(r,u)},u=function(r){return r-r.clone().hour(0).minute(0).second(0).millisecond(0)},t=function(n,o){var t=r.unix(n),i=r.unix(o),e=r.duration(6,"hours"),a=r.duration(12,"hours"),m=r.duration(18,"hours"),s=i-u(i),h=t-u(t),c=(r.duration(s-h).asDays()+1)*a;return t.hours()>17?c-=a:t.hours()>=6&&(c-=u(t)-e),i.hours()<=5?c-=a:i.hours()<18&&(c-=m-u(i)),Math.round(c/1e3)};export{o as formatLastDataUpdate,n as formatTimestamp,t as getDayTimeDuration,u as getDurationFromDayStart};
1
+ import r from"moment-timezone";var n=function(n,o){return r.unix(n).format(o)},o=function(r){return n(r,"M/D/YYYY h:mm a")},u=function(r){return r-r.clone().hour(0).minute(0).second(0).millisecond(0)},t=function(n,o){var t=r.unix(n),i=r.unix(o),e=r.duration(6,"hours"),a=r.duration(12,"hours"),s=r.duration(18,"hours"),h=i-u(i),m=t-u(t),c=(r.duration(h-m).asDays()+1)*a;return t.hours()>17?c-=a:t.hours()>=6&&(c-=u(t)-e),i.hours()<=5?c-=a:i.hours()<18&&(c-=s-u(i)),Math.round(c/1e3)};export{o as formatLastDataUpdate,n as formatTimestamp,t as getDayTimeDuration,u as getDurationFromDayStart};