@corva/ui 3.36.0-1 → 3.36.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.
- package/cjs-bundle/components/Attachment/index.js +1 -1
- package/cjs-bundle/components/Attachment/index.js.map +1 -1
- package/cjs-bundle/componentsV2/AppHeader/AppHeader.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
- package/cjs-bundle/effects/useSignedURL.js +1 -1
- package/cjs-bundle/effects/useSignedURL.js.map +1 -1
- package/components/Attachment/index.js +1 -1
- package/components/Attachment/index.js.map +1 -1
- package/componentsV2/AppHeader/AppHeader.d.ts +5 -1
- package/componentsV2/AppHeader/AppHeader.d.ts.map +1 -1
- package/componentsV2/AppHeader/AppHeader.js +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.d.ts +4 -3
- package/componentsV2/AppHeader/V3/AppHeaderV3.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
- package/componentsV2/AppHeader/V3/AppHeaderV3.stories.d.ts +1 -0
- package/componentsV2/AppHeader/V3/AppHeaderV3.stories.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.d.ts +2 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js +1 -1
- package/componentsV2/AppHeader/V3/useResponsivity.d.ts +6 -13
- package/componentsV2/AppHeader/V3/useResponsivity.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
- package/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
- package/effects/useSignedURL.d.ts +1 -1
- package/effects/useSignedURL.d.ts.map +1 -1
- package/effects/useSignedURL.js +1 -1
- package/effects/useSignedURL.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),i=require("prop-types"),t=require("react-player"),n=require("classnames"),a=require("@material-ui/core/styles"),o=require("@material-ui/core"),r=require("@material-ui/icons/Image"),c=require("@material-ui/icons/Fullscreen"),l=require("@material-ui/core/colors/grey"),u=require("../NewDocumentViewer/NewDocumentViewer.js"),m=require("../NewDocumentViewer/icons/UnavailableFileIcon.js"),d=require("./styles.css.js"),h=require("../FileTypeIcon.js"),p=require("../ImageViewer/index.js"),q=require("../IconButton/index.js"),j=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js"),g=require("../../utils/filePreview.js"),v=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/subscriptions.v1.js"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../constants/corvaCompanyId.js"),require("../GradientManager/configuration/constants.js");var I=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../../utils/env.js"),require("../StatusBadge/constants.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../constants/streamSourceType.js"),require("../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var b=require("react/jsx-runtime");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var x=require("../../utils/main.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w=N(e),y=N(i),C=N(t),F=N(n),A=N(r),P=N(c),D=N(l),S=D.default[200],W=D.default[400],U={label:"small",value:135},z={label:"medium",value:300},R={fileImage:function(e,s){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:s===U.label?U.value:z.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{padding:"10px 10px 10px 5px",border:"1px solid #616161",borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:S,borderRadius:3,marginTop:10,height:135,width:135}},L=function(e){var s=I(e.attachmentFileName)||e.attachmentUrl;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{onClick:e.openLightbox,className:d.cAttachmentImg,children:[b.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:s,style:R.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),b.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:d.cAttachmentImgPreviwBtn,children:b.jsx(P.default,{})})]}),!e.imageIsLoaded&&b.jsx("div",{style:R.imagePlaceholder,children:b.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:W,fontSize:"large"})}),e.lightboxIsOpen&&b.jsx(p,{mainSrc:s,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},k=function(e){var s=x.default.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),i=I(e.attachmentFileName),t=g.getIsPreviewUnavailable(s);return b.jsxs("div",{className:d.cAttachmentFileWrapper,children:[b.jsxs("div",{className:F.default(d.cAttachmentFileDownloadWrapper,t&&e.classes.disabledPreview),style:R.fileDownloadWrapper,onClick:function(){t||e.openPreview()},children:[t?b.jsx(m.UnavailableFileIcon,{className:e.classes.unavailableFileIcon}):b.jsx(h,{fileName:e.displayName||e.attachmentUrl,className:d.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),b.jsxs("div",{className:e.classes.titleContainer,children:[t&&b.jsx("div",{className:e.classes.caption,children:"Preview unavailable"}),b.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:F.default(d.cAttachmentFileDownloadWrapperFileName,t&&e.classes.fileName),children:b.jsx(o.Typography,{variant:"subtitle2",noWrap:!0,className:e.classes.unavailableFileName,children:s})})]}),b.jsx(u,{fileUrl:i,classes:{root:e.classes.dialogRoot,paper:j.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},fileName:s,fileSize:e.attachmentSize,onClose:e.closePreview,open:e.previewIsOpen})]}),b.jsx("a",{download:e.displayName,href:i,className:d.cAttachmentFileDownloadWrapperForm,children:b.jsx(q,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:b.jsx(v.DownloadIcon,{size:24,className:e.classes.downloadIcon})})})]})};function O(e){var i=s.useState(!1),t=w.default(i,2),n=t[0],a=t[1],o=s.useState(!1),r=w.default(o,2),c=r[0],l=r[1],u=s.useState(!1),m=w.default(u,2),h=m[0],p=m[1],q=e.displayName||e.attachmentUrl||e.fileName,g=f.getIsImage(q),v=f.getIsVideo(q),x=I(!e.attachmentUrl&&e.fileName),N=e.attachmentUrl||x,y=s.useCallback((function(e){return e.preventDefault()}),[]);return g?b.jsx("div",{className:d.cAttachment,children:b.jsx(L,{size:e.size,openLightbox:function(){return l(!0)},attachmentFileName:e.fileName,attachmentUrl:e.attachmentUrl,setImageIsLoaded:function(){return a(!0)},imageIsLoaded:n,lightboxIsOpen:c,handleLightboxOpen:function(){j.isNativeDetected&&document.documentElement.addEventListener("touchmove",y,{passive:!1})},handleLightboxClose:function(){j.isNativeDetected&&document.documentElement.removeEventListener("touchmove",y),l(!1)},classes:e.classes})}):v&&C.default.canPlay(N)?b.jsx("div",{className:d.cAttachment,children:b.jsx(C.default,{"data-testid":"".concat("Attachment","_player"),className:d.cAttachmentReactPlayer,url:N,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===U.label?U.value:z.value,width:null})}):b.jsx("div",{className:d.cAttachment,children:b.jsx(k,{attachmentUrl:N,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return p(!0)},closePreview:function(e){e.stopPropagation(),p(!1)},previewIsOpen:h,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:y.default.string.isRequired,attachmentSize:y.default.number,displayName:y.default.string,fileName:y.default.string,size:y.default.oneOf([U.label,z.label]),classes:y.default.shape({}).isRequired,small:y.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:z.label,small:!1};var E=a.withStyles((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:400},downloadIcon:{color:e.palette.primary.text3},disabledPreview:{backgroundColor:e.palette.primary.text9},unavailableFileIcon:{marginRight:12,minWidth:32},titleContainer:{display:"flex",flexDirection:"column",width:"100%"},caption:{fontSize:12,fontWeight:400,width:"fit-content"},unavailableFileName:{fontSize:12,fontWeight:400}}}))(O);module.exports=E;
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),i=require("prop-types"),t=require("react-player"),n=require("classnames"),a=require("@material-ui/core/styles"),o=require("@material-ui/core"),r=require("@material-ui/icons/Image"),c=require("@material-ui/icons/Fullscreen"),l=require("@material-ui/core/colors/grey"),u=require("../NewDocumentViewer/NewDocumentViewer.js"),m=require("../NewDocumentViewer/icons/UnavailableFileIcon.js"),d=require("./styles.css.js"),h=require("../FileTypeIcon.js"),p=require("../ImageViewer/index.js"),q=require("../IconButton/index.js"),j=require("../../utils/mobileDetect.js"),f=require("../../utils/fileExtension.js"),g=require("../../utils/filePreview.js"),v=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../clients/subscriptions.v1.js"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/appPackages.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js"),require("../../constants/corvaCompanyId.js"),require("../GradientManager/configuration/constants.js");var I=require("../../effects/useSignedURL.js");require("../../utils/index.js"),require("uuid"),require("jsona"),require("../../utils/env.js"),require("../StatusBadge/constants.js"),require("@babel/runtime/helpers/toConsumableArray"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../constants/streamSourceType.js"),require("../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var b=require("react/jsx-runtime");require("../../componentsV2/AppCommonsProvider/AppCommonsContext.js");var x=require("../../utils/main.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w=N(e),y=N(i),C=N(t),F=N(n),A=N(r),P=N(c),D=N(l),S=D.default[200],W=D.default[400],U={label:"small",value:135},z={label:"medium",value:300},R={fileImage:function(e,s){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:s===U.label?U.value:z.value,display:e?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{padding:"10px 10px 10px 5px",border:"1px solid #616161",borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:S,borderRadius:3,marginTop:10,height:135,width:135}},L=function(e){var s=I(e.attachmentFileName)||e.attachmentUrl;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{onClick:e.openLightbox,className:d.cAttachmentImg,children:[b.jsx("img",{"data-testid":"".concat("Attachment","_image"),src:s,style:R.fileImage(e.imageIsLoaded,e.size),alt:"Attachment",onLoad:e.setImageIsLoaded}),b.jsx("div",{"data-testid":"".concat("Attachment","_button"),className:d.cAttachmentImgPreviwBtn,children:b.jsx(P.default,{})})]}),!e.imageIsLoaded&&b.jsx("div",{style:R.imagePlaceholder,children:b.jsx(A.default,{"data-testid":"".concat("Attachment","_placeholder"),className:e.classes.imageIconRoot,htmlColor:W,fontSize:"large"})}),e.lightboxIsOpen&&b.jsx(p,{mainSrc:s,imagePadding:50,onAfterOpen:e.handleLightboxOpen,onCloseRequest:e.handleLightboxClose})]})},k=function(e){var s=x.default.getFileNameWithExtensionFromPath(e.displayName||e.attachmentUrl),i=I(e.attachmentFileName,"inline"),t=I(e.attachmentFileName,"attachment"),n=g.getIsPreviewUnavailable(s);return b.jsxs("div",{className:d.cAttachmentFileWrapper,children:[b.jsxs("div",{className:F.default(d.cAttachmentFileDownloadWrapper,n&&e.classes.disabledPreview),style:R.fileDownloadWrapper,onClick:function(){n||e.openPreview()},children:[n?b.jsx(m.UnavailableFileIcon,{className:e.classes.unavailableFileIcon}):b.jsx(h,{fileName:e.displayName||e.attachmentUrl,className:d.cAttachmentFileDownloadWrapperFileIcon,size:e.small?25:50}),b.jsxs("div",{className:e.classes.titleContainer,children:[n&&b.jsx("div",{className:e.classes.caption,children:"Preview unavailable"}),b.jsx("div",{"data-testid":"".concat("Attachment","_name"),className:F.default(d.cAttachmentFileDownloadWrapperFileName,n&&e.classes.fileName),children:b.jsx(o.Typography,{variant:"subtitle2",noWrap:!0,className:e.classes.unavailableFileName,children:s})})]}),b.jsx(u,{fileUrl:i,classes:{root:e.classes.dialogRoot,paper:j.isNativeDetected?e.classes.nativeDialog:e.classes.dialog},fileName:s,fileSize:e.attachmentSize,onClose:e.closePreview,open:e.previewIsOpen})]}),b.jsx("a",{download:e.displayName,href:t,className:d.cAttachmentFileDownloadWrapperForm,children:b.jsx(q,{"data-testid":"".concat("Attachment","_downloadButton"),className:e.classes.downloadIcon,type:"submit",children:b.jsx(v.DownloadIcon,{size:24,className:e.classes.downloadIcon})})})]})};function O(e){var i=s.useState(!1),t=w.default(i,2),n=t[0],a=t[1],o=s.useState(!1),r=w.default(o,2),c=r[0],l=r[1],u=s.useState(!1),m=w.default(u,2),h=m[0],p=m[1],q=e.displayName||e.attachmentUrl||e.fileName,g=f.getIsImage(q),v=f.getIsVideo(q),x=I(!e.attachmentUrl&&e.fileName),N=e.attachmentUrl||x,y=s.useCallback((function(e){return e.preventDefault()}),[]);return g?b.jsx("div",{className:d.cAttachment,children:b.jsx(L,{size:e.size,openLightbox:function(){return l(!0)},attachmentFileName:e.fileName,attachmentUrl:e.attachmentUrl,setImageIsLoaded:function(){return a(!0)},imageIsLoaded:n,lightboxIsOpen:c,handleLightboxOpen:function(){j.isNativeDetected&&document.documentElement.addEventListener("touchmove",y,{passive:!1})},handleLightboxClose:function(){j.isNativeDetected&&document.documentElement.removeEventListener("touchmove",y),l(!1)},classes:e.classes})}):v&&C.default.canPlay(N)?b.jsx("div",{className:d.cAttachment,children:b.jsx(C.default,{"data-testid":"".concat("Attachment","_player"),className:d.cAttachmentReactPlayer,url:N,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:e.size===U.label?U.value:z.value,width:null})}):b.jsx("div",{className:d.cAttachment,children:b.jsx(k,{attachmentUrl:N,attachmentFileName:e.fileName,attachmentSize:e.attachmentSize,displayName:e.displayName,openPreview:function(){return p(!0)},closePreview:function(e){e.stopPropagation(),p(!1)},previewIsOpen:h,classes:e.classes,small:e.small})})}O.propTypes={attachmentUrl:y.default.string.isRequired,attachmentSize:y.default.number,displayName:y.default.string,fileName:y.default.string,size:y.default.oneOf([U.label,z.label]),classes:y.default.shape({}).isRequired,small:y.default.bool},O.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:z.label,small:!1};var E=a.withStyles((function(e){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:400},downloadIcon:{color:e.palette.primary.text3},disabledPreview:{backgroundColor:e.palette.primary.text9},unavailableFileIcon:{marginRight:12,minWidth:32},titleContainer:{display:"flex",flexDirection:"column",width:"100%"},caption:{fontSize:12,fontWeight:400,width:"fit-content"},unavailableFileName:{fontSize:12,fontWeight:400}}}))(O);module.exports=E;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n const fileUrl = useSignedURL(props.attachmentFileName);\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={fileUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={fileUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","jsxs","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","fileUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"6nJA2BMA,EA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M,MAGnB9C,EAAW+C,aAAe,CACxBxF,YAAa,KACbH,SAAU,KACVgC,oBAAgB4D,EAChBlJ,KAAMN,EAAaC,MACnB2E,OAAO,GAGT,IAAA6E,EAAeC,cAzRG,SAAAC,GAAK,MAAK,CAC1B3G,cAAe,CACb9B,SAAU,WACV0I,IAAK,MACLC,KAAM,MACNC,UAAW,yBAEbpE,OAAQ,CACN1E,MAAO,MACPK,OAAQ,MACRd,SAAU,OACVW,SAAU,YAEZuE,aAAc,CACZzE,MAAO,OACPK,OAAQ,OACRd,SAAU,OACVG,UAAW,OACXqJ,OAAQ,GAEVzE,WAAY,CAEVnE,gBAAiB,uBAEnByC,SAAU,CACRnD,SAAU,SACVuJ,WAAY,SACZC,aAAc,WACdC,WAAY,KAEd7D,aAAc,CACZ8D,MAAOR,EAAMS,QAAQC,QAAQC,OAE/BhG,gBAAiB,CACfnD,gBAAiBwI,EAAMS,QAAQC,QAAQE,OAEzC9F,oBAAqB,CACnB+F,YAAa,GACbC,SAAU,IAEZ5F,eAAgB,CACdlE,QAAS,OACT+J,cAAe,SACf1J,MAAO,QAET8D,QAAS,CACP5B,SAAU,GACVgH,WAAY,IACZlJ,MAAO,eAETmE,oBAAqB,CACnBjC,SAAU,GACVgH,WAAY,KAEf,GAmOcR,CAAsBlD"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n\n const previewUrl = useSignedURL(props.attachmentFileName, 'inline');\n const downloadUrl = useSignedURL(props.attachmentFileName, 'attachment');\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={previewUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={downloadUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","jsxs","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","previewUrl","downloadUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","fileUrl","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"6nJA2BMA,EAAUC,EAAAA,QAAK,KACfC,EAAUD,EAAAA,QAAK,KAEfE,EACG,CAAEC,MAAO,QAASC,MAAO,KAD5BF,EAEI,CAAEC,MAAO,SAAUC,MAAO,KAG9BC,EAAQ,CACZC,UAAW,SAACC,EAAeC,GAAI,MAAM,CACnCC,SAAU,OACVC,aAAc,EACdC,SAAU,SAGVC,UAAWJ,IAASN,EAAYC,MAAQD,EAAYE,MAAQF,EAAaE,MACzES,QAASN,EAAgB,UAAY,OACrCO,OAAQ,UACR,EACFC,oBAAqB,CACnBC,QAAS,qBACTC,OAA2B,oBAC3BP,aAAc,EACdD,SAAU,IACVS,MAAO,OAETC,iBAAkB,CAChBC,SAAU,WACVC,gBAAiBtB,EACjBW,aAAc,EACdY,UAAW,GACXC,OAAQ,IACRL,MAAO,MA6DLM,EAAkB,SAAAC,GACtB,IAAMC,EAAeC,EAAaF,EAAMG,qBAAuBH,EAAMI,cACrE,OACEC,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SACE,CAAAF,EAAAG,KAAA,MAAA,CAAKC,QAAST,EAAMU,aAAcC,UAAWC,EAAOC,eAAeN,SACjE,CAAAO,EAAAC,IAAA,MAAA,CACE,cAAA,GAAAC,OArGQ,aAqG0B,UAClCC,IAAKhB,EACLrB,MAAOA,EAAMC,UAAUmB,EAAMlB,cAAekB,EAAMjB,MAClDmC,IAAI,aACJC,OAAQnB,EAAMoB,mBAEhBN,EAAAC,IAAA,MAAA,CAAK,cAAA,GAAAC,OA3GK,aA2G8B,WAACL,UAAWC,EAAOS,wBAAwBd,SACjFO,EAAAA,IAACQ,EAAY,QAAA,UAIftB,EAAMlB,eACNgC,EAAAA,IAAA,MAAA,CAAKlC,MAAOA,EAAMc,iBAAiBa,SACjCO,MAACS,U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amF,EAAS,QAACC,OACvBvF,SAAUsF,EAAS,QAACC,OACpB7I,KAAM4I,EAAAA,QAAUI,MAAM,CAACtJ,EAAYC,MAAOD,EAAaC,QACvD8C,QAASmG,EAAS,QAACK,MAAM,CAAA,GAAIH,WAC7BvE,MAAOqE,EAAS,QAACM,MAGnB9C,EAAW+C,aAAe,CACxB1F,YAAa,KACbH,SAAU,KACVkC,oBAAgB4D,EAChBpJ,KAAMN,EAAaC,MACnB4E,OAAO,GAGT,IAAA8E,EAAeC,cA3RG,SAAAC,GAAK,MAAK,CAC1B7G,cAAe,CACb9B,SAAU,WACV4I,IAAK,MACLC,KAAM,MACNC,UAAW,yBAEbpE,OAAQ,CACN5E,MAAO,MACPK,OAAQ,MACRd,SAAU,OACVW,SAAU,YAEZyE,aAAc,CACZ3E,MAAO,OACPK,OAAQ,OACRd,SAAU,OACVG,UAAW,OACXuJ,OAAQ,GAEVzE,WAAY,CAEVrE,gBAAiB,uBAEnByC,SAAU,CACRnD,SAAU,SACVyJ,WAAY,SACZC,aAAc,WACdC,WAAY,KAEd7D,aAAc,CACZ8D,MAAOR,EAAMS,QAAQC,QAAQC,OAE/BjG,gBAAiB,CACfpD,gBAAiB0I,EAAMS,QAAQC,QAAQE,OAEzC/F,oBAAqB,CACnBgG,YAAa,GACbC,SAAU,IAEZ7F,eAAgB,CACdnE,QAAS,OACTiK,cAAe,SACf5J,MAAO,QAET+D,QAAS,CACP7B,SAAU,GACVkH,WAAY,IACZpJ,MAAO,eAEToE,oBAAqB,CACnBlC,SAAU,GACVkH,WAAY,KAEf,GAqOcR,CAAsBlD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("classnames"),t=require("react"),a=require("lodash"),i=require("../Header/Header.js"),d=require("../TextEndTruncated/TextEndTruncated.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("classnames"),t=require("react"),a=require("lodash"),i=require("../Header/Header.js"),d=require("../TextEndTruncated/TextEndTruncated.js"),l=require("../../utils/devcenter.js"),n=require("../../constants/segment.js"),o=require("../AppCommonsProvider/AppCommonsContext.js"),r=require("./AppBadge/AppBadge.js"),p=require("./AppAssets/AppAssets.js"),c=require("./PadMode/PadMode.js"),u=require("./AppHeader.constants.js"),m=require("./V3/AppHeaderV3.js"),g=require("./AppHeader.scss.js");function A(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=A(s);exports.AppHeader=function(s){var A=s.className,C=s.testId,h=s.logo,x=s.children,v=s.padModeDisabled,N=s.padModeWells,q=s.onPadModeChange,f=s.elementsClassNames,S=s.title,M=s.asset,T=s.dqData,b=s.lastUpdate,P=s.additionalActions,H=s.showComments,w=s.titleControls,E=s.titleControlsPosition,I=void 0===E?"right":E,y=s.disableSettingsPin,B=void 0===y||y,D=s.disableSettings,V=s.showAssetChips,O=void 0===V||V,F=s.additionalControls,L=s.rightSideContent,U=s.disableAssetSelector,W=s.titleMenuActions,_=o.useAppCommons(),G=_.app,k=_.well,z=_.fracFleet,J=_.wells,K=_.onSettingChange,Q=_.appSettings,R=void 0===Q?{}:Q,X=_.appHeadersV3Enabled,Y=_.appName,Z=N||J,$=l.getAppSegment(G),ee=!(v||$!==n.SEGMENTS.COMPLETION||k||a.isEmpty(Z)||!z),se=t.useMemo((function(){return q?function(e,s){return q(s)}:K}),[q,K]);return X?e.jsx(m.AppHeaderV3,{testId:C,className:A,elementsClassNames:f,logo:h,title:S,padModeDisabled:v,padModeWells:N,asset:M,dqData:T,lastUpdate:b,additionalActions:P,showComments:H,titleControls:w,disableSettingsPin:B,disableSettings:D,showAssetChips:O,additionalControls:F||x,disableAssetSelector:U,titleMenuActions:W,titleControlsPosition:I}):e.jsxs("div",{className:j.default(g.root,A),"data-testid":C,children:[e.jsxs(i.Header,{className:j.default(g.logoTitleBadgeContainer,null==f?void 0:f.title),appearance:"appName",children:[h&&e.jsx("div",{className:g.logoContainer,children:"string"==typeof h?e.jsx("img",{className:g.logo,src:h,alt:"Logo"}):h}),e.jsx(d.TextEndTruncated,{className:g.appName,testId:u.AppHeaderTestIds.AppTitleTestId,children:S||Y}),e.jsx(r.AppBadge,{app:G})]}),(x||F||ee)&&e.jsxs("div",{className:j.default(g.additional,null==f?void 0:f.additional),children:[ee&&e.jsx(c.PadMode,{app:G,appSettings:R,fracFleet:z,onSettingChange:se,well:k,wells:Z}),F||x]}),e.jsx("div",{className:j.default(g.assetChips,null==f?void 0:f.chips),children:e.jsx(p.AppAssets,{forceNarrow:ee||!!x})}),L&&e.jsx("div",{className:g.rightSideContent,children:L})]})};
|
|
2
2
|
//# sourceMappingURL=AppHeader.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("classnames"),l=require("lodash"),i=require("../../../constants/segment.js"),o=require("../../../utils/devcenter.js"),n=require("../../PadModeSelect/PadModeSelect.js");require("../../PadModeSelect/PadModeSelect.constants.js");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("classnames"),l=require("lodash"),i=require("../../../constants/segment.js"),o=require("../../../utils/devcenter.js"),n=require("../../PadModeSelect/PadModeSelect.js");require("../../PadModeSelect/PadModeSelect.constants.js");var d=require("../AppHeader.constants.js"),a=require("../../AppCommonsProvider/AppCommonsContext.js"),r=require("./VersionSelect/VersionSelect.js"),u=require("./AssetChips/AssetChips.js"),c=require("./AppTitle/AppTitle.js");require("./AppTitle/AppTitle.constants.js");var p=require("./useResponsivity.js"),v=require("./Actions/Actions.js");require("./Actions/Actions.constants.js");var f=require("./AppHeaderV3.scss.js");function A(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=A(t);exports.AppHeaderV3=function(t){var A,m,C,h,y,I,q,R,x,S,M,N,g,L=t.elementsClassNames,T=t.className,b=t.testId,P=t.logo,w=t.additionalControls,H=t.title,V=t.padModeDisabled,E=t.padModeWells,D=t.dqData,O=t.asset,W=t.lastUpdate,k=t.additionalActions,U=t.showComments,_=t.titleControls,B=t.disableSettingsPin,F=void 0===B||B,G=t.disableSettings,z=t.showAssetChips,J=t.disableAssetSelector,K=t.titleMenuActions,Q=t.titleControlsPosition,X=void 0===Q?"right":Q,Y=s.useRef(null),Z=a.useAppCommonsInternal(),$=Z.app,ee=Z.well,se=Z.wells,te=Z.fracFleet,le=Z.isInsideNewMobileApp,ie=o.getAppSegment($),oe=E||se,ne=!(V||ie!==i.SEGMENTS.COMPLETION||ee||l.isEmpty(oe)||!te||le),de=P?"ultranarrow":ne||w||_?"narrow":void 0,ae="left"===X&&!!_,re=s.useRef(null),ue=s.useRef(null),ce=s.useRef(null),pe=s.useRef(null),ve=s.useRef(null),fe=s.useRef(null),Ae=s.useRef(null),je=p.useResponsivity({disabled:le,titleControlsLeft:ae,rootRef:Y,versionRef:re,additionalControlsRef:ce,titleControlsRef:pe,logoRef:fe,padModeRef:ue,chipsRef:ve,actionsRef:Ae});return e.jsxs("div",{className:j.default(f.root,T),"data-testid":b,ref:Y,style:null===(A=je.root)||void 0===A?void 0:A.style,children:[e.jsx("div",{className:j.default(f.logoContainer,null==L?void 0:L.logoContainer),ref:fe,children:P&&"string"==typeof P?e.jsx("img",{className:f.logo,src:P,alt:"Logo"}):P}),e.jsx(c.AppTitle,{title:H,asset:O,dqData:D,lastUpdate:W,className:j.default(f.title,ae&&f.titleWithControlsLeft,null==L?void 0:L.title),disableAssetSelector:J,titleMenuActions:K,style:null===(m=je.title)||void 0===m?void 0:m.style}),_&&e.jsx("div",{className:j.default(f.titleControls,ae&&f.titleControlsLeft,(null===(C=je.titleControls)||void 0===C?void 0:C.lastInLine)&&f.lastInLine,null==L?void 0:L.titleControls),ref:pe,style:null===(h=je.titleControls)||void 0===h?void 0:h.style,children:_}),!le&&e.jsx("div",{className:f.version,ref:re,children:e.jsx(r.VersionSelect,{className:null==L?void 0:L.versionSelect})}),ne&&e.jsx("div",{className:j.default(f.padMode,(null===(y=je.padMode)||void 0===y?void 0:y.lastInLine)&&f.lastInLine),ref:ue,style:null===(I=je.padMode)||void 0===I?void 0:I.style,children:e.jsx(n.PadModeSelect,{testId:d.AppHeaderTestIds.PadModeSelectTestId})}),w&&e.jsx("div",{className:j.default(f.additionalControls,(null===(q=je.additionalControls)||void 0===q?void 0:q.lastInLine)&&f.lastInLine,null==L?void 0:L.additionalControls),ref:ce,style:null===(R=je.additionalControls)||void 0===R?void 0:R.style,"data-testid":d.AppHeaderTestIds.AdditionalControlsTestId,children:w}),z&&!le&&e.jsx("div",{className:j.default(f.assetChips,(null===(x=je.chips)||void 0===x?void 0:x.lastInLine)&&f.lastInLine,null==L?void 0:L.chips),ref:ve,style:null===(S=je.chips)||void 0===S?void 0:S.style,children:e.jsx(u.AssetChips,{chipsWidth:de})}),e.jsx("div",{className:j.default(f.actions,(null===(M=je.actions)||void 0===M?void 0:M.lastInLine)&&f.lastInLine,null==L?void 0:L.actions),ref:Ae,style:null===(N=je.actions)||void 0===N?void 0:N.style,"data-testid":d.AppHeaderTestIds.ActionsRootTestId,children:e.jsx(v.Actions,{additionalActions:k,showComments:U,disableSettingsPin:F,disableSettings:G,rootRef:Y})}),null===(g=je.linebreaks)||void 0===g?void 0:g.map((function(s,t){return e.jsx("div",{className:f.responsivenessLineBreak,style:s},t)}))]})};
|
|
2
2
|
//# sourceMappingURL=AppHeaderV3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../../ext-esm/style-inject/dist/style-inject.es.js')(".AppHeaderV3_root__urLNv{align-items:center;display:flex;flex-
|
|
1
|
+
"use strict";require('./../../../ext-esm/style-inject/dist/style-inject.es.js')(".AppHeaderV3_root__urLNv{--headerV3-responsivity-flexwrap:wrap;align-items:center;display:flex;flex-direction:row;flex-wrap:var(--headerV3-responsivity-flexwrap);gap:0 8px;min-height:48px;overflow:hidden;padding:6px 0;width:100%}.AppHeaderV3_logoContainer__Bv-lU{max-height:36px;max-width:130px;overflow:hidden}.AppHeaderV3_logo__0VO16{display:block;max-height:36px;max-width:100%}.AppHeaderV3_title__vVZB9{flex:1 0 90px;min-width:90px}.AppHeaderV3_titleWithControlsLeft__Mnnkm{--headerV3-responsivity-marginRight:auto;--headerV3-responsivity-maxWidth:100%;flex:0 1 auto;margin-right:var(--headerV3-responsivity-marginRight);max-width:var(--headerV3-responsivity-maxWidth);min-width:1px}.AppHeaderV3_additionalControls__-QrO4,.AppHeaderV3_assetChips__4LwGe,.AppHeaderV3_logoContainer__Bv-lU,.AppHeaderV3_padMode__-uTzy,.AppHeaderV3_titleControls__Yzl06,.AppHeaderV3_version__Acke3{align-items:center;display:flex;flex-flow:row nowrap;flex-shrink:0;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_additionalControls__-QrO4:empty,.AppHeaderV3_assetChips__4LwGe:empty,.AppHeaderV3_logoContainer__Bv-lU:empty,.AppHeaderV3_padMode__-uTzy:empty,.AppHeaderV3_titleControls__Yzl06:empty,.AppHeaderV3_version__Acke3:empty{display:none}.AppHeaderV3_titleControlsLeft__NrIwI{margin-right:auto}.AppHeaderV3_actions__Q0PRr{align-items:center;display:flex;flex:0 0 auto;flex-flow:row nowrap;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_responsivenessLineBreak__2QL6d{flex:0 0 100%}.AppHeaderV3_lastInLine__cbmHb{margin-left:auto}"),module.exports={spacing:"8",gap:"8px",titleMinWidth:"90px",root:"AppHeaderV3_root__urLNv",logoContainer:"AppHeaderV3_logoContainer__Bv-lU",logo:"AppHeaderV3_logo__0VO16",title:"AppHeaderV3_title__vVZB9",titleWithControlsLeft:"AppHeaderV3_titleWithControlsLeft__Mnnkm",additionalControls:"AppHeaderV3_additionalControls__-QrO4",titleControls:"AppHeaderV3_titleControls__Yzl06",assetChips:"AppHeaderV3_assetChips__4LwGe",padMode:"AppHeaderV3_padMode__-uTzy",version:"AppHeaderV3_version__Acke3",titleControlsLeft:"AppHeaderV3_titleControlsLeft__NrIwI",actions:"AppHeaderV3_actions__Q0PRr",responsivenessLineBreak:"AppHeaderV3_responsivenessLineBreak__2QL6d",lastInLine:"AppHeaderV3_lastInLine__cbmHb"};
|
|
2
2
|
//# sourceMappingURL=AppHeaderV3.scss.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),n=require("classnames"),i=require("react"),o=require("moment"),t=require("@material-ui/core"),r=require("../../../TextEndTruncated/TextEndTruncated.js"),c=require("../../../Button/Button.js"),u=require("../DqStatusIcon/DqStatusIcon.js");require("../DqStatusIcon/DqStatusIcon.constants.js");var l=require("../../../AppDqPopover/AppDqPopover.js"),a=require("../../../Menu/Menu.js"),d=require("../../../../components/AppIcon/AppIcon.js"),p=require("../../../../utils/devcenter.js"),m=require("../../../Text/Text.js"),j=require("../../../Accordion/Accordion.js"),I=require("../AppRemoveConfirmationModal/AppRemoveConfirmationModal.js"),q=require("../AssetSelector/AssetSelector.js");require("../AssetSelector/constants.js");var v=require("../../../../constants/segment.js"),x=require("../../../AppCommonsProvider/AppCommonsContext.js"),A=require("../../../UniversalLink/UniversalLink.js"),f=require("./AppTitle.constants.js"),T=require("../../../AppContainer/headerCommon.scss.js"),h=require("./AppTitle.scss.js"),C=require("../../../../icons/iconParkIcons.js"),g=require("../../../../icons/customIcons/icons/AddMessage.js");require("../../../../icons/customIcons/icons/Attention.js"),require("../../../../icons/customIcons/icons/Collapse.js"),require("../../../../icons/customIcons/icons/Dashboard.js"),require("../../../../icons/customIcons/icons/Expand.js"),require("../../../../icons/customIcons/icons/FolderClosed.js"),require("../../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../../icons/customIcons/icons/FolderOpened.js"),require("../../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../../icons/customIcons/icons/Search.js"),require("../../../../icons/customIcons/icons/Wellhub.js"),require("../../../../icons/customIcons/icons/MultiRuler.js"),require("../../../../icons/customIcons/icons/Checkbox.js"),require("../../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../../icons/customIcons/icons/Radio.js"),require("../../../../icons/customIcons/icons/RadioChecked.js"),require("../../../../icons/customIcons/icons/SimulFrac.js"),require("../../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../../icons/customIcons/icons/CautionFilled.js"),require("../../../../icons/customIcons/icons/MoreApp.js"),require("../../../../icons/customIcons/icons/Pad.js"),require("../../../../icons/customIcons/icons/DrilloutUnit.js"),require("../../../../icons/customIcons/icons/FracFleet.js"),require("../../../../icons/customIcons/icons/Global.js"),require("../../../../icons/customIcons/icons/Program.js"),require("../../../../icons/customIcons/icons/Rig.js"),require("../../../../icons/customIcons/icons/Well.js"),require("../../../../icons/customIcons/icons/Gap.js"),require("../../../../icons/customIcons/icons/Pin.js"),require("../../../../icons/customIcons/icons/CloseOneFilled.js"),require("../../../../icons/customIcons/icons/AttentionFilled.js"),require("../../../../icons/customIcons/icons/CheckOneFilled.js"),require("../../../../icons/customIcons/icons/Archive.js"),require("../../../../icons/customIcons/icons/ArchiveCancel.js"),require("../../../../icons/customIcons/icons/Unarchive.js"),require("../../../../icons/customIcons/icons/Archived.js"),require("../../../../icons/customIcons/icons/InterventionUnit.js"),require("../../../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../../../clients/subscriptions.v1.js"),require("../../../../clients/jsonApi/index.js"),require("../../../../clients/subscriptions/subscriptions-client.factory.js");var b=require("../../../../effects/useOutsideClick.js");require("../../../../utils/index.js");var k=require("../../../../effects/useWellnessAlerts.js");function M(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("lodash/get"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../../../constants/completion.js"),require("../../../../constants/streamSourceType.js"),require("../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var N=M(n),S=M(o),y=function(e){return e&&"asset_id"in e?{name:e.name,id:e.asset_id}:e};exports.AppTitle=function(n){var o,M,D,E,F,R,z,O,P=n.asset,L=n.className,B=n.dqData,_=n.lastUpdate,U=n.title,w=n.disableAssetSelector,H=n.titleMenuActions,G=x.useAppCommonsInternal(),W=G.app,Y=G.appId,V=G.maximized,Z=G.toggleAnnotationsList,J=G.onHelpCenterClick,K=G.secondaryMenuItems,Q=G.appName,X=G.layoutEnvironment,$=G.isInsideNewMobileApp,ee=i.useState(!1),se=ee[0],ne=ee[1],ie=i.useRef(),oe=i.useRef(),te=i.useRef(null),re=i.useRef(null),ce=i.useState(!1),ue=ce[0],le=ce[1],ae=i.useRef(null),de=i.useCallback((function(){return ne((function(e){return!e}))}),[]),pe=i.useCallback((function(){return le((function(e){return!e}))}),[]),me=i.useCallback((function(){clearTimeout(ie.current),clearTimeout(oe.current),ie.current=setTimeout((function(){ne(!0)}),300)}),[]),je=i.useCallback((function(){clearTimeout(ie.current),clearTimeout(oe.current),ie.current=setTimeout((function(){ne(!1)}),700)}),[]);b(re,de,[te.current]);var Ie=(P instanceof Array&&P.length>0||!!P)&&!B&&!$,qe=k.useWellnessAlerts({isDCApp:Ie,appId:Y,multiRigAssets:P instanceof Array?P:void 0,asset:P instanceof Array?void 0:y(P),maximized:V,dashboards:[]}),ve=B||qe,xe=(Ie||!!B)&&!$,Ae=(null===(o=null==ve?void 0:ve.wellnessAlerts)||void 0===o?void 0:o.alertsData)||{},fe=function(e){if(e){if("number"==typeof e){var s=Date.now();return Math.abs(s-e)>Math.abs(s-1e3*e)?S.default.unix(e):S.default(e)}return S.default(e)}return null}(_),Te=i.useCallback((function(){pe(),null==Z||Z()}),[Z,pe]),he=i.useCallback((function(){pe(),null==J||J()}),[J,pe]),Ce=i.useState(!1),ge=Ce[0],be=Ce[1],ke=i.useCallback((function(){pe(),be(!0)}),[pe]),Me=i.useCallback((function(){be(!1)}),[]),Ne=i.useMemo((function(){return[].concat(K||[]).concat(H||[]).map((function(s){return e.__assign(e.__assign({},s),{onClick:function(){var e;pe(),null===(e=s.onClick)||void 0===e||e.call(s)}})}))}),[K,H,pe]),Se=!!(null===(F=null===(E=null===(D=null===(M=W.package)||void 0===M?void 0:M.manifest)||void 0===D?void 0:D.application)||void 0===E?void 0:E.ui)||void 0===F?void 0:F.multi_rig),ye="asset"===(null==X?void 0:X.type),De=p.getAppSegment(W)===v.SEGMENTS.COMPLETION,Ee=!(Se||ye&&De||w),Fe=(null==fe?void 0:fe.isValid())?"Last Update: ".concat(fe.format("MMM D YYYY, hh:mm A")):void 0,Re=U||Q;return $?s.jsx("div",{className:N.default(h.root,L),children:s.jsx("div",{className:h.title,children:s.jsx(r.TextEndTruncated,{className:N.default(h.titleText),testId:f.AppTitleTestIds.AppNameTestId,children:Re})})}):s.jsxs("div",{className:N.default(h.root,L),children:[xe&&s.jsx(u.DqStatusIcon,{statusBadgeIconType:ve.statusBadgeIconType,className:h.dqBadge,onClick:de,onMouseEnter:me,onMouseLeave:je,ref:te}),s.jsx(c.Button,{type:"tertiary",size:"small",className:h.title,suffix:s.jsx("div",{className:N.default(h.titleChevron,T.titleChevron,ue&&h.titleChevronOpen),children:s.jsx(C.DownIcon,{size:16})}),ref:ae,onClick:pe,children:s.jsx(r.TextEndTruncated,{className:N.default(h.titleText,xe&&h.withDq),testId:f.AppTitleTestIds.AppNameTestId,children:Re})}),s.jsx(l.AppDqPopover,{open:se,anchorEl:te.current,placement:"bottom-start",alertsData:Ae,onClose:de,contentRef:re,onMouseEnter:me,onMouseLeave:je}),s.jsxs(a.Menu,{anchorEl:ae.current,open:ue,className:h.menuRoot,onClose:pe,children:[s.jsxs(A.UniversalLink,{href:"/app-store/app/".concat(null===(R=null==W?void 0:W.app)||void 0===R?void 0:R.id),className:h.menuHeader,"data-testid":f.AppTitleTestIds.AppStoreLinkTestId,children:[s.jsx(d.AppIcon,{"data-testid":f.AppTitleTestIds.AppIconTestId,className:h.appIcon,segment:[p.getAppSegment(W)],iconUrl:null===(O=null===(z=null==W?void 0:W.app)||void 0===z?void 0:z.icon)||void 0===O?void 0:O.url,height:40,width:40}),s.jsxs("div",{className:h.menuHeaderText,children:[s.jsx(m.Text,{children:s.jsx(r.TextEndTruncated,{testId:f.AppTitleTestIds.MenuAppNameTestId,children:Q})}),s.jsx(m.Text,{size:12,color:"T6",children:"Open in Appstore"})]})]}),s.jsx("div",{className:h.divider}),Ee&&s.jsx(a.Menu.Item,{size:"large",disableClickEffect:!0,className:h.assetMenuItem,children:s.jsx(j.Accordion,{title:s.jsxs("div",{className:h.accordionTitle,children:[s.jsx(C.SettingOneIcon,{size:24,className:h.accordionIcon}),"Change Asset"]}),iconPosition:"end",titleHover:!1,testId:f.AppTitleTestIds.AssetSelectorAccordionTestId,children:s.jsx(q.AssetSelector,{})})}),null==Ne?void 0:Ne.map((function(e,n){return s.jsxs(i.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",onClick:e.onClick,prefix:"string"==typeof e.icon?s.jsx(t.Icon,{children:e.icon}):e.icon,testId:f.AppTitleTestIds.AdditionalSelectionTestId,children:e.title})]},n)})),J&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",prefix:s.jsx(C.HelpIcon,{}),onClick:he,testId:f.AppTitleTestIds.HelpCenterLinkTestId,children:"Help Center"})]}),Z&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",prefix:s.jsx(g.AddMessageCustomIcon,{fill:"currentColor"}),onClick:Te,testId:f.AppTitleTestIds.AnnotationsTestId,children:"Add Annotation"})]}),s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",prefix:s.jsx(C.DeleteFourIcon,{}),className:h.removeAppItem,onClick:ke,testId:f.AppTitleTestIds.RemoveAppTestId,children:"Remove App"}),(null==fe?void 0:fe.isValid())&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsxs("div",{className:h.footer,children:[s.jsx(u.DqStatusIcon,{statusBadgeIconType:ve.statusBadgeIconType,className:h.footerDqBadge,ref:te}),Fe&&s.jsx(m.Text,{size:12,color:"T6",children:Fe})]})]})]}),s.jsx(I.AppRemoveConfirmationModal,{open:ge,onClose:Me})]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),n=require("classnames"),i=require("react"),o=require("moment"),t=require("@material-ui/core"),r=require("../../../TextEndTruncated/TextEndTruncated.js"),c=require("../../../Button/Button.js"),u=require("../DqStatusIcon/DqStatusIcon.js");require("../DqStatusIcon/DqStatusIcon.constants.js");var l=require("../../../AppDqPopover/AppDqPopover.js"),a=require("../../../Menu/Menu.js"),d=require("../../../../components/AppIcon/AppIcon.js"),p=require("../../../../utils/devcenter.js"),m=require("../../../Text/Text.js"),j=require("../../../Accordion/Accordion.js"),I=require("../AppRemoveConfirmationModal/AppRemoveConfirmationModal.js"),q=require("../AssetSelector/AssetSelector.js");require("../AssetSelector/constants.js");var v=require("../../../../constants/segment.js"),x=require("../../../AppCommonsProvider/AppCommonsContext.js"),A=require("../../../UniversalLink/UniversalLink.js"),f=require("./AppTitle.constants.js"),T=require("../../../AppContainer/headerCommon.scss.js"),h=require("./AppTitle.scss.js"),C=require("../../../../icons/iconParkIcons.js"),g=require("../../../../icons/customIcons/icons/AddMessage.js");require("../../../../icons/customIcons/icons/Attention.js"),require("../../../../icons/customIcons/icons/Collapse.js"),require("../../../../icons/customIcons/icons/Dashboard.js"),require("../../../../icons/customIcons/icons/Expand.js"),require("../../../../icons/customIcons/icons/FolderClosed.js"),require("../../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../../icons/customIcons/icons/FolderOpened.js"),require("../../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../../icons/customIcons/icons/Search.js"),require("../../../../icons/customIcons/icons/Wellhub.js"),require("../../../../icons/customIcons/icons/MultiRuler.js"),require("../../../../icons/customIcons/icons/Checkbox.js"),require("../../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../../icons/customIcons/icons/Radio.js"),require("../../../../icons/customIcons/icons/RadioChecked.js"),require("../../../../icons/customIcons/icons/SimulFrac.js"),require("../../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../../icons/customIcons/icons/CautionFilled.js"),require("../../../../icons/customIcons/icons/MoreApp.js"),require("../../../../icons/customIcons/icons/Pad.js"),require("../../../../icons/customIcons/icons/DrilloutUnit.js"),require("../../../../icons/customIcons/icons/FracFleet.js"),require("../../../../icons/customIcons/icons/Global.js"),require("../../../../icons/customIcons/icons/Program.js"),require("../../../../icons/customIcons/icons/Rig.js"),require("../../../../icons/customIcons/icons/Well.js"),require("../../../../icons/customIcons/icons/Gap.js"),require("../../../../icons/customIcons/icons/Pin.js"),require("../../../../icons/customIcons/icons/CloseOneFilled.js"),require("../../../../icons/customIcons/icons/AttentionFilled.js"),require("../../../../icons/customIcons/icons/CheckOneFilled.js"),require("../../../../icons/customIcons/icons/Archive.js"),require("../../../../icons/customIcons/icons/ArchiveCancel.js"),require("../../../../icons/customIcons/icons/Unarchive.js"),require("../../../../icons/customIcons/icons/Archived.js"),require("../../../../icons/customIcons/icons/InterventionUnit.js"),require("../../../../clients/subscriptions/constants.js"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("querystring"),require("uuid/v1"),require("lodash"),require("../../../../clients/subscriptions.v1.js"),require("../../../../clients/jsonApi/index.js"),require("../../../../clients/subscriptions/subscriptions-client.factory.js");var b=require("../../../../effects/useOutsideClick.js");require("../../../../utils/index.js");var k=require("../../../../effects/useWellnessAlerts.js");function M(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("lodash/get"),require("lodash/isEmpty"),require("lodash/sortBy"),require("../../../../constants/completion.js"),require("../../../../constants/streamSourceType.js"),require("../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js");var N=M(n),S=M(o),y=function(e){return e&&"asset_id"in e?{name:e.name,id:e.asset_id}:e};exports.AppTitle=function(n){var o,M,D,E,F,R,z,O,P=n.asset,L=n.className,B=n.dqData,_=n.lastUpdate,U=n.title,w=n.disableAssetSelector,H=n.titleMenuActions,G=n.style,W=x.useAppCommonsInternal(),Y=W.app,V=W.appId,Z=W.maximized,J=W.toggleAnnotationsList,K=W.onHelpCenterClick,Q=W.secondaryMenuItems,X=W.appName,$=W.layoutEnvironment,ee=W.isInsideNewMobileApp,se=i.useState(!1),ne=se[0],ie=se[1],oe=i.useRef(),te=i.useRef(),re=i.useRef(null),ce=i.useRef(null),ue=i.useState(!1),le=ue[0],ae=ue[1],de=i.useRef(null),pe=i.useCallback((function(){return ie((function(e){return!e}))}),[]),me=i.useCallback((function(){return ae((function(e){return!e}))}),[]),je=i.useCallback((function(){clearTimeout(oe.current),clearTimeout(te.current),oe.current=setTimeout((function(){ie(!0)}),300)}),[]),Ie=i.useCallback((function(){clearTimeout(oe.current),clearTimeout(te.current),oe.current=setTimeout((function(){ie(!1)}),700)}),[]);b(ce,pe,[re.current]);var qe=(P instanceof Array&&P.length>0||!!P)&&!B&&!ee,ve=k.useWellnessAlerts({isDCApp:qe,appId:V,multiRigAssets:P instanceof Array?P:void 0,asset:P instanceof Array?void 0:y(P),maximized:Z,dashboards:[]}),xe=B||ve,Ae=(qe||!!B)&&!ee,fe=(null===(o=null==xe?void 0:xe.wellnessAlerts)||void 0===o?void 0:o.alertsData)||{},Te=function(e){if(e){if("number"==typeof e){var s=Date.now();return Math.abs(s-e)>Math.abs(s-1e3*e)?S.default.unix(e):S.default(e)}return S.default(e)}return null}(_),he=i.useCallback((function(){me(),null==J||J()}),[J,me]),Ce=i.useCallback((function(){me(),null==K||K()}),[K,me]),ge=i.useState(!1),be=ge[0],ke=ge[1],Me=i.useCallback((function(){me(),ke(!0)}),[me]),Ne=i.useCallback((function(){ke(!1)}),[]),Se=i.useMemo((function(){return[].concat(Q||[]).concat(H||[]).map((function(s){return e.__assign(e.__assign({},s),{onClick:function(){var e;me(),null===(e=s.onClick)||void 0===e||e.call(s)}})}))}),[Q,H,me]),ye=!!(null===(F=null===(E=null===(D=null===(M=Y.package)||void 0===M?void 0:M.manifest)||void 0===D?void 0:D.application)||void 0===E?void 0:E.ui)||void 0===F?void 0:F.multi_rig),De="asset"===(null==$?void 0:$.type),Ee=p.getAppSegment(Y)===v.SEGMENTS.COMPLETION,Fe=!(ye||De&&Ee||w),Re=(null==Te?void 0:Te.isValid())?"Last Update: ".concat(Te.format("MMM D YYYY, hh:mm A")):void 0,ze=U||X;return ee?s.jsx("div",{className:N.default(h.root,L),children:s.jsx("div",{className:h.title,children:s.jsx(r.TextEndTruncated,{className:N.default(h.titleText),testId:f.AppTitleTestIds.AppNameTestId,children:ze})})}):s.jsxs("div",{className:N.default(h.root,L),style:G,children:[Ae&&s.jsx(u.DqStatusIcon,{statusBadgeIconType:xe.statusBadgeIconType,className:h.dqBadge,onClick:pe,onMouseEnter:je,onMouseLeave:Ie,ref:re}),s.jsx(c.Button,{type:"tertiary",size:"small",className:h.title,suffix:s.jsx("div",{className:N.default(h.titleChevron,T.titleChevron,le&&h.titleChevronOpen),children:s.jsx(C.DownIcon,{size:16})}),ref:de,onClick:me,children:s.jsx(r.TextEndTruncated,{className:N.default(h.titleText,Ae&&h.withDq),testId:f.AppTitleTestIds.AppNameTestId,children:ze})}),s.jsx(l.AppDqPopover,{open:ne,anchorEl:re.current,placement:"bottom-start",alertsData:fe,onClose:pe,contentRef:ce,onMouseEnter:je,onMouseLeave:Ie}),s.jsxs(a.Menu,{anchorEl:de.current,open:le,className:h.menuRoot,onClose:me,children:[s.jsxs(A.UniversalLink,{href:"/app-store/app/".concat(null===(R=null==Y?void 0:Y.app)||void 0===R?void 0:R.id),className:h.menuHeader,"data-testid":f.AppTitleTestIds.AppStoreLinkTestId,children:[s.jsx(d.AppIcon,{"data-testid":f.AppTitleTestIds.AppIconTestId,className:h.appIcon,segment:[p.getAppSegment(Y)],iconUrl:null===(O=null===(z=null==Y?void 0:Y.app)||void 0===z?void 0:z.icon)||void 0===O?void 0:O.url,height:40,width:40}),s.jsxs("div",{className:h.menuHeaderText,children:[s.jsx(m.Text,{children:s.jsx(r.TextEndTruncated,{testId:f.AppTitleTestIds.MenuAppNameTestId,children:X})}),s.jsx(m.Text,{size:12,color:"T6",children:"Open in Appstore"})]})]}),s.jsx("div",{className:h.divider}),Fe&&s.jsx(a.Menu.Item,{size:"large",disableClickEffect:!0,className:h.assetMenuItem,children:s.jsx(j.Accordion,{title:s.jsxs("div",{className:h.accordionTitle,children:[s.jsx(C.SettingOneIcon,{size:24,className:h.accordionIcon}),"Change Asset"]}),iconPosition:"end",titleHover:!1,testId:f.AppTitleTestIds.AssetSelectorAccordionTestId,children:s.jsx(q.AssetSelector,{})})}),null==Se?void 0:Se.map((function(e,n){return s.jsxs(i.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",onClick:e.onClick,prefix:"string"==typeof e.icon?s.jsx(t.Icon,{children:e.icon}):e.icon,testId:f.AppTitleTestIds.AdditionalSelectionTestId,children:e.title})]},n)})),K&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",prefix:s.jsx(C.HelpIcon,{}),onClick:Ce,testId:f.AppTitleTestIds.HelpCenterLinkTestId,children:"Help Center"})]}),J&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",prefix:s.jsx(g.AddMessageCustomIcon,{fill:"currentColor"}),onClick:he,testId:f.AppTitleTestIds.AnnotationsTestId,children:"Add Annotation"})]}),s.jsx("div",{className:h.divider}),s.jsx(a.Menu.Item,{size:"large",prefix:s.jsx(C.DeleteFourIcon,{}),className:h.removeAppItem,onClick:Me,testId:f.AppTitleTestIds.RemoveAppTestId,children:"Remove App"}),(null==Te?void 0:Te.isValid())&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:h.divider}),s.jsxs("div",{className:h.footer,children:[s.jsx(u.DqStatusIcon,{statusBadgeIconType:xe.statusBadgeIconType,className:h.footerDqBadge,ref:re}),Re&&s.jsx(m.Text,{size:12,color:"T6",children:Re})]})]})]}),s.jsx(I.AppRemoveConfirmationModal,{open:be,onClose:Ne})]})};
|
|
2
2
|
//# sourceMappingURL=AppTitle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require('./../../../../ext-esm/style-inject/dist/style-inject.es.js')('.AppTitle_root__2z-8W{
|
|
1
|
+
"use strict";require('./../../../../ext-esm/style-inject/dist/style-inject.es.js')('.AppTitle_root__2z-8W{overflow:hidden;position:relative}.AppTitle_title__-OfhC{max-width:100%;overflow:hidden}.AppTitle_titleText__miwjo{color:var(--palette-primary-text-1);font-size:18px;font-weight:500;letter-spacing:normal;line-height:24px;text-transform:none}.AppTitle_withDq__8ZfD6{padding-left:20px}.AppTitle_titleChevron__ZjfXd{margin-right:-4px;transition:opacity .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1)}.AppTitle_titleChevronOpen__mmQn-{opacity:1;transform:rotate(180deg)}.AppTitle_dqBadge__miNBd{left:0;position:absolute;top:50%;transform:translateY(-50%);z-index:1}.AppTitle_menuRoot__An9Ta{--corvaui-background:var(--palette-background-b-6);background-color:var(--palette-background-b-6)!important;width:296px}.AppTitle_menuHeader__jJGvl{cursor:pointer;display:flex;flex-flow:row nowrap;gap:8px;margin:-8px -16px 0;padding:16px}.AppTitle_appIcon__hojKJ{flex-shrink:0}.AppTitle_menuHeaderText__9Fr3w{display:flex;flex-flow:column nowrap;gap:4px;overflow:hidden}.AppTitle_divider__58c-O{border-bottom:1px solid var(--palette-background-b-4);margin:0 -16px}.AppTitle_assetMenuItem__aTqr-{cursor:auto!important}.AppTitle_accordionTitle__-cs1z{align-items:center;display:flex;flex-flow:row nowrap;min-height:30px}.AppTitle_accordionTitle__-cs1z:after{content:"";cursor:pointer;inset:-12px -16px;position:absolute;z-index:1}.AppTitle_accordionIcon__1rKbM{display:inline-block;margin-right:16px;vertical-align:middle}.AppTitle_removeAppItem__s10Cz{color:var(--palette-error-main)!important}.AppTitle_footer__O5bKk{padding-top:8px}.AppTitle_footerDqBadge__ptC05{display:inline-block;margin-right:8px;vertical-align:middle}'),module.exports={spacing:"8",gap:"8px",titleMinWidth:"90px",root:"AppTitle_root__2z-8W",title:"AppTitle_title__-OfhC",titleText:"AppTitle_titleText__miwjo",withDq:"AppTitle_withDq__8ZfD6",titleChevron:"AppTitle_titleChevron__ZjfXd",titleChevronOpen:"AppTitle_titleChevronOpen__mmQn-",dqBadge:"AppTitle_dqBadge__miNBd",menuRoot:"AppTitle_menuRoot__An9Ta",menuHeader:"AppTitle_menuHeader__jJGvl",appIcon:"AppTitle_appIcon__hojKJ",menuHeaderText:"AppTitle_menuHeaderText__9Fr3w",divider:"AppTitle_divider__58c-O",assetMenuItem:"AppTitle_assetMenuItem__aTqr-",accordionTitle:"AppTitle_accordionTitle__-cs1z",accordionIcon:"AppTitle_accordionIcon__1rKbM",removeAppItem:"AppTitle_removeAppItem__s10Cz",footer:"AppTitle_footer__O5bKk",footerDqBadge:"AppTitle_footerDqBadge__ptC05"};
|
|
2
2
|
//# sourceMappingURL=AppTitle.scss.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../ext-esm/tslib/tslib.es6.js'),r=require("react"),t=require("lodash"),n=require("./constants.scss.js"),i=parseInt(n.gap,10),s=parseInt(n.titleMinWidth,10)+i,o=function(e){var r;return(null===(r=e.current)||void 0===r?void 0:r.getBoundingClientRect().width)||0},l=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];var n=r.filter((function(e){return!!e.current&&e.current.offsetWidth>0}));return e+n.reduce((function(e,r){return e+o(r)}),0)+(n.length>1?(n.length-1)*i:0)};exports.useResponsivity=function(n){var o=n.disabled,a=n.actionsRef,d=n.chipsRef,u=n.logoRef,c=n.rootRef,v=n.titleControlsRef,y=n.additionalControlsRef,f=n.versionRef,p=n.padModeRef,h=n.titleControlsLeft,V=r.useState({}),g=V[0],b=V[1],R=r.useRef(-1);return r.useEffect((function(){var r=t.throttle((function(){requestAnimationFrame((function(){var r,n=(null===(r=c.current)||void 0===r?void 0:r.offsetWidth)||0,o=function(r){var i,o=h&&l(s,u,f,d,a,v,y,p)<=n?e.__assign(e.__assign({},r),{root:{style:e.__assign(e.__assign({},null===(i=r.root)||void 0===i?void 0:i.style),{"--headerV3-responsivity-flexwrap":"nowrap"})}}):r;b((function(e){return t.isEqual(e,o)?e:o}))},V=function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];if(h){var n=l.apply(void 0,e.__spreadArray([0],r,!1))+i;return{"--headerV3-responsivity-maxWidth":"calc(100% - ".concat(n,"px)")}}};l(s,u,f,d,a,v,y,p)<=n?o({title:{style:{"--headerV3-responsivity-marginRight":0}}}):l(s,u,f,d,a)<=n?o({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},padMode:{style:{"--headerV3-responsivity-order":120}},additionalControls:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:V(u,f,d,a)}}):!p.current&&l(s,u,f,d)<=n?o({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:V(u,f,d)}}):l(s,u,f,d)<=n&&l(0,v,y,p,a)<=n?o({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},padMode:{style:{"--headerV3-responsivity-order":130}},actions:{style:{"--headerV3-responsivity-order":140},lastInLine:!0},title:{style:V(u,f,d)}}):o({linebreaks:[{order:100},{order:200}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},padMode:{style:{"--headerV3-responsivity-order":210}},chips:{style:{"--headerV3-responsivity-order":220},lastInLine:!0},title:{style:V(u,f)}})}))}),100,{leading:!0}),n=new ResizeObserver((function(){var e,t=(null===(e=c.current)||void 0===e?void 0:e.offsetWidth)||0;t!==R.current&&r(),R.current=t})),V=new MutationObserver(r);return c.current&&!o&&(n.observe(c.current),V.observe(c.current,{childList:!0,subtree:!0,characterData:!0}),r.cancel()),function(){n.disconnect(),V.disconnect()}}),[a,d,u,c,v,y,f,p,o,h]),g};
|
|
2
2
|
//# sourceMappingURL=useResponsivity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,kFAAkF,uCAA0C;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("../clients/jsonApi/index.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=n(e);module.exports=function(e){var n=t.useState(""),
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("../clients/jsonApi/index.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=n(e);module.exports=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"attachment",i=t.useState(""),o=u.default(i,2),c=o[0],a=o[1];return t.useEffect((function(){e&&r.getS3DownloadLink(e,n).then((function(e){a(e.url)})).catch((function(e){console.error(e),a("")}))}),[e,n]),c};
|
|
2
2
|
//# sourceMappingURL=useSignedURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignedURL.js","sources":["../../../src/effects/useSignedURL.js"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { getS3DownloadLink } from '~/clients/jsonApi';\n\nfunction useSignedURL(fileName) {\n const [signedURL, setSignedURL] = useState('');\n\n useEffect(() => {\n if (fileName)\n getS3DownloadLink(fileName)\n .then(response => setSignedURL(response.url))\n .catch(
|
|
1
|
+
{"version":3,"file":"useSignedURL.js","sources":["../../../src/effects/useSignedURL.js"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { getS3DownloadLink } from '~/clients/jsonApi';\n\nfunction useSignedURL(fileName, contentDisposition = 'attachment') {\n const [signedURL, setSignedURL] = useState('');\n\n useEffect(() => {\n if (fileName) {\n getS3DownloadLink(fileName, contentDisposition)\n .then(response => {\n setSignedURL(response.url);\n })\n .catch(error => {\n console.error(error);\n setSignedURL('');\n });\n }\n }, [fileName, contentDisposition]);\n\n return signedURL;\n}\n\nexport default useSignedURL;\n"],"names":["fileName","contentDisposition","useState","_useState2","_slicedToArray","_useState","signedURL","setSignedURL","useEffect","getS3DownloadLink","then","response","url","catch","error","console"],"mappings":"iOAIA,SAAsBA,GAA6C,IAAnCC,yDAAqB,aACjBC,EAAAA,EAAQA,SAAC,IAAGC,EAAAC,EAAAA,QAAAC,EAAA,GAAvCC,EAASH,EAAA,GAAEI,EAAYJ,EAAA,GAe9B,OAbAK,EAAAA,WAAU,WACJR,GACFS,EAAAA,kBAAkBT,EAAUC,GACzBS,MAAK,SAAAC,GACJJ,EAAaI,EAASC,IACxB,IACCC,OAAM,SAAAC,GACLC,QAAQD,MAAMA,GACdP,EAAa,GACf,GAEN,GAAG,CAACP,EAAUC,IAEPK,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"@babel/runtime/helpers/slicedToArray";import{useState as t,useCallback as e}from"react";import s from"prop-types";import i from"react-player";import n from"classnames";import{withStyles as a}from"@material-ui/core/styles";import{Typography as c}from"@material-ui/core";import r from"@material-ui/icons/Image";import m from"@material-ui/icons/Fullscreen";import l from"@material-ui/core/colors/grey";import p from"../NewDocumentViewer/NewDocumentViewer.js";import{UnavailableFileIcon as d}from"../NewDocumentViewer/icons/UnavailableFileIcon.js";import u from"./styles.css.js";import h from"../FileTypeIcon.js";import f from"../ImageViewer/index.js";import j from"../IconButton/index.js";import{isNativeDetected as g}from"../../utils/mobileDetect.js";import{getIsImage as I,getIsVideo as v}from"../../utils/fileExtension.js";import{getIsPreviewUnavailable as b}from"../../utils/filePreview.js";import{DownloadIcon as N}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../clients/subscriptions/constants.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"lodash";import"../../clients/subscriptions.v1.js";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions/subscriptions-client.factory.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/appPackages.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import"../../constants/corvaCompanyId.js";import"../GradientManager/configuration/constants.js";import w from"../../effects/useSignedURL.js";import"../../utils/index.js";import"uuid";import"jsona";import"../../utils/env.js";import"../StatusBadge/constants.js";import"@babel/runtime/helpers/toConsumableArray";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"lodash/isEmpty";import"lodash/sortBy";import"../../constants/streamSourceType.js";import"../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import{jsx as x,jsxs as y,Fragment as C}from"react/jsx-runtime";import"../../componentsV2/AppCommonsProvider/AppCommonsContext.js";import F from"../../utils/main.js";var A=l[200],P=l[400],W={label:"small",value:135},D={label:"medium",value:300},S={fileImage:function(o,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===W.label?W.value:D.value,display:o?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{padding:"10px 10px 10px 5px",border:"1px solid #616161",borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:A,borderRadius:3,marginTop:10,height:135,width:135}},z=function(o){var t=w(o.attachmentFileName)||o.attachmentUrl;return y(C,{children:[y("div",{onClick:o.openLightbox,className:u.cAttachmentImg,children:[x("img",{"data-testid":"".concat("Attachment","_image"),src:t,style:S.fileImage(o.imageIsLoaded,o.size),alt:"Attachment",onLoad:o.setImageIsLoaded}),x("div",{"data-testid":"".concat("Attachment","_button"),className:u.cAttachmentImgPreviwBtn,children:x(m,{})})]}),!o.imageIsLoaded&&x("div",{style:S.imagePlaceholder,children:x(r,{"data-testid":"".concat("Attachment","_placeholder"),className:o.classes.imageIconRoot,htmlColor:P,fontSize:"large"})}),o.lightboxIsOpen&&x(f,{mainSrc:t,imagePadding:50,onAfterOpen:o.handleLightboxOpen,onCloseRequest:o.handleLightboxClose})]})},R=function(o){var t=F.getFileNameWithExtensionFromPath(o.displayName||o.attachmentUrl),e=w(o.attachmentFileName),s=b(t);return y("div",{className:u.cAttachmentFileWrapper,children:[y("div",{className:n(u.cAttachmentFileDownloadWrapper,
|
|
1
|
+
import o from"@babel/runtime/helpers/slicedToArray";import{useState as t,useCallback as e}from"react";import s from"prop-types";import i from"react-player";import n from"classnames";import{withStyles as a}from"@material-ui/core/styles";import{Typography as c}from"@material-ui/core";import r from"@material-ui/icons/Image";import m from"@material-ui/icons/Fullscreen";import l from"@material-ui/core/colors/grey";import p from"../NewDocumentViewer/NewDocumentViewer.js";import{UnavailableFileIcon as d}from"../NewDocumentViewer/icons/UnavailableFileIcon.js";import u from"./styles.css.js";import h from"../FileTypeIcon.js";import f from"../ImageViewer/index.js";import j from"../IconButton/index.js";import{isNativeDetected as g}from"../../utils/mobileDetect.js";import{getIsImage as I,getIsVideo as v}from"../../utils/fileExtension.js";import{getIsPreviewUnavailable as b}from"../../utils/filePreview.js";import{DownloadIcon as N}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import"../../icons/customIcons/icons/Pad.js";import"../../icons/customIcons/icons/DrilloutUnit.js";import"../../icons/customIcons/icons/FracFleet.js";import"../../icons/customIcons/icons/Global.js";import"../../icons/customIcons/icons/Program.js";import"../../icons/customIcons/icons/Rig.js";import"../../icons/customIcons/icons/Well.js";import"../../icons/customIcons/icons/Gap.js";import"../../icons/customIcons/icons/Pin.js";import"../../icons/customIcons/icons/CloseOneFilled.js";import"../../icons/customIcons/icons/AttentionFilled.js";import"../../icons/customIcons/icons/CheckOneFilled.js";import"../../icons/customIcons/icons/Archive.js";import"../../icons/customIcons/icons/ArchiveCancel.js";import"../../icons/customIcons/icons/Unarchive.js";import"../../icons/customIcons/icons/Archived.js";import"../../icons/customIcons/icons/InterventionUnit.js";import"../../clients/subscriptions/constants.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"lodash";import"../../clients/subscriptions.v1.js";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions/subscriptions-client.factory.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/appPackages.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import"../../constants/corvaCompanyId.js";import"../GradientManager/configuration/constants.js";import w from"../../effects/useSignedURL.js";import"../../utils/index.js";import"uuid";import"jsona";import"../../utils/env.js";import"../StatusBadge/constants.js";import"@babel/runtime/helpers/toConsumableArray";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"lodash/isEmpty";import"lodash/sortBy";import"../../constants/streamSourceType.js";import"../DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";import{jsx as x,jsxs as y,Fragment as C}from"react/jsx-runtime";import"../../componentsV2/AppCommonsProvider/AppCommonsContext.js";import F from"../../utils/main.js";var A=l[200],P=l[400],W={label:"small",value:135},D={label:"medium",value:300},S={fileImage:function(o,t){return{maxWidth:"100%",borderRadius:4,overflow:"hidden",maxHeight:t===W.label?W.value:D.value,display:o?"initial":"none",cursor:"pointer"}},fileDownloadWrapper:{padding:"10px 10px 10px 5px",border:"1px solid #616161",borderRadius:3,maxWidth:500,width:"75%"},imagePlaceholder:{position:"relative",backgroundColor:A,borderRadius:3,marginTop:10,height:135,width:135}},z=function(o){var t=w(o.attachmentFileName)||o.attachmentUrl;return y(C,{children:[y("div",{onClick:o.openLightbox,className:u.cAttachmentImg,children:[x("img",{"data-testid":"".concat("Attachment","_image"),src:t,style:S.fileImage(o.imageIsLoaded,o.size),alt:"Attachment",onLoad:o.setImageIsLoaded}),x("div",{"data-testid":"".concat("Attachment","_button"),className:u.cAttachmentImgPreviwBtn,children:x(m,{})})]}),!o.imageIsLoaded&&x("div",{style:S.imagePlaceholder,children:x(r,{"data-testid":"".concat("Attachment","_placeholder"),className:o.classes.imageIconRoot,htmlColor:P,fontSize:"large"})}),o.lightboxIsOpen&&x(f,{mainSrc:t,imagePadding:50,onAfterOpen:o.handleLightboxOpen,onCloseRequest:o.handleLightboxClose})]})},R=function(o){var t=F.getFileNameWithExtensionFromPath(o.displayName||o.attachmentUrl),e=w(o.attachmentFileName,"inline"),s=w(o.attachmentFileName,"attachment"),i=b(t);return y("div",{className:u.cAttachmentFileWrapper,children:[y("div",{className:n(u.cAttachmentFileDownloadWrapper,i&&o.classes.disabledPreview),style:S.fileDownloadWrapper,onClick:function(){i||o.openPreview()},children:[i?x(d,{className:o.classes.unavailableFileIcon}):x(h,{fileName:o.displayName||o.attachmentUrl,className:u.cAttachmentFileDownloadWrapperFileIcon,size:o.small?25:50}),y("div",{className:o.classes.titleContainer,children:[i&&x("div",{className:o.classes.caption,children:"Preview unavailable"}),x("div",{"data-testid":"".concat("Attachment","_name"),className:n(u.cAttachmentFileDownloadWrapperFileName,i&&o.classes.fileName),children:x(c,{variant:"subtitle2",noWrap:!0,className:o.classes.unavailableFileName,children:t})})]}),x(p,{fileUrl:e,classes:{root:o.classes.dialogRoot,paper:g?o.classes.nativeDialog:o.classes.dialog},fileName:t,fileSize:o.attachmentSize,onClose:o.closePreview,open:o.previewIsOpen})]}),x("a",{download:o.displayName,href:s,className:u.cAttachmentFileDownloadWrapperForm,children:x(j,{"data-testid":"".concat("Attachment","_downloadButton"),className:o.classes.downloadIcon,type:"submit",children:x(N,{size:24,className:o.classes.downloadIcon})})})]})};function L(s){var n=t(!1),a=o(n,2),c=a[0],r=a[1],m=t(!1),l=o(m,2),p=l[0],d=l[1],h=t(!1),f=o(h,2),j=f[0],b=f[1],N=s.displayName||s.attachmentUrl||s.fileName,y=I(N),C=v(N),F=w(!s.attachmentUrl&&s.fileName),A=s.attachmentUrl||F,P=e((function(o){return o.preventDefault()}),[]);return y?x("div",{className:u.cAttachment,children:x(z,{size:s.size,openLightbox:function(){return d(!0)},attachmentFileName:s.fileName,attachmentUrl:s.attachmentUrl,setImageIsLoaded:function(){return r(!0)},imageIsLoaded:c,lightboxIsOpen:p,handleLightboxOpen:function(){g&&document.documentElement.addEventListener("touchmove",P,{passive:!1})},handleLightboxClose:function(){g&&document.documentElement.removeEventListener("touchmove",P),d(!1)},classes:s.classes})}):C&&i.canPlay(A)?x("div",{className:u.cAttachment,children:x(i,{"data-testid":"".concat("Attachment","_player"),className:u.cAttachmentReactPlayer,url:A,config:{file:{attributes:{preload:"metadata"}}},controls:!0,height:s.size===W.label?W.value:D.value,width:null})}):x("div",{className:u.cAttachment,children:x(R,{attachmentUrl:A,attachmentFileName:s.fileName,attachmentSize:s.attachmentSize,displayName:s.displayName,openPreview:function(){return b(!0)},closePreview:function(o){o.stopPropagation(),b(!1)},previewIsOpen:j,classes:s.classes,small:s.small})})}L.propTypes={attachmentUrl:s.string.isRequired,attachmentSize:s.number,displayName:s.string,fileName:s.string,size:s.oneOf([W.label,D.label]),classes:s.shape({}).isRequired,small:s.bool},L.defaultProps={displayName:null,fileName:null,attachmentSize:void 0,size:D.label,small:!1};var U=a((function(o){return{imageIconRoot:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},dialog:{width:"95%",height:"95%",maxWidth:"100%",position:"relative"},nativeDialog:{width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",margin:0},dialogRoot:{backgroundColor:"rgba(0, 0, 0, 0.85)"},fileName:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:400},downloadIcon:{color:o.palette.primary.text3},disabledPreview:{backgroundColor:o.palette.primary.text9},unavailableFileIcon:{marginRight:12,minWidth:32},titleContainer:{display:"flex",flexDirection:"column",width:"100%"},caption:{fontSize:12,fontWeight:400,width:"fit-content"},unavailableFileName:{fontSize:12,fontWeight:400}}}))(L);export{U as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n const fileUrl = useSignedURL(props.attachmentFileName);\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={fileUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={fileUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","fileUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"6+IAyBA,IAEMA,EAAUC,EAAK,KACfC,EAAUD,EAAK,KAEfE,EACG,CAAEC,MAAO,QAASC,MAAO,KAD5BF,EAEI,CAAEC,MAAO,SAAUC,MAAO,KAG9BC,EAAQ,CACZC,UAAW,SAACC,EAAeC,GAAI,MAAM,CACnCC,SAAU,OACVC,aAAc,EACdC,SAAU,SAGVC,UAAWJ,IAASN,EAAYC,MAAQD,EAAYE,MAAQF,EAAaE,MACzES,QAASN,EAAgB,UAAY,OACrCO,OAAQ,UACR,EACFC,oBAAqB,CACnBC,QAAS,qBACTC,OAA2B,oBAC3BP,aAAc,EACdD,SAAU,IACVS,MAAO,OAETC,iBAAkB,CAChBC,SAAU,WACVC,gBAAiBtB,EACjBW,aAAc,EACdY,UAAW,GACXC,OAAQ,IACRL,MAAO,MA6DLM,EAAkB,SAAAC,GACtB,IAAMC,EAAeC,EAAaF,EAAMG,qBAAuBH,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
{"version":3,"file":"index.js","sources":["../../../src/components/Attachment/index.js"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactPlayer from 'react-player';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Typography } from '@material-ui/core';\nimport ImageIcon from '@material-ui/icons/Image';\nimport FullSizeIcon from '@material-ui/icons/Fullscreen';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { NewDocumentViewer } from '../NewDocumentViewer';\nimport { UnavailableFileIcon } from '../NewDocumentViewer/icons/UnavailableFileIcon';\n\nimport styles from './styles.css';\n\nimport FileTypeIcon from '~components/FileTypeIcon';\nimport ImageViewer from '~components/ImageViewer';\nimport IconButton from '~components/IconButton';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { getIsVideo, getIsImage } from '~/utils/fileExtension';\nimport { getIsPreviewUnavailable } from '~/utils/filePreview';\nimport { DownloadIcon } from '~/icons';\nimport { useSignedURL } from '~/effects';\nimport utils from '~utils/main'; // question here\n\nconst PAGE_NAME = 'Attachment';\n\nconst grey200 = grey[200];\nconst grey400 = grey[400];\n\nconst SIZES = {\n small: { label: 'small', value: 135 },\n medium: { label: 'medium', value: 300 },\n};\n\nconst style = {\n fileImage: (imageIsLoaded, size) => ({\n maxWidth: '100%',\n borderRadius: 4,\n overflow: 'hidden',\n // NOTE: Makes one-line comment with image fits into comments container. Equals to\n // imagePlaceholder height\n maxHeight: size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value,\n display: imageIsLoaded ? 'initial' : 'none',\n cursor: 'pointer',\n }),\n fileDownloadWrapper: {\n padding: '10px 10px 10px 5px',\n border: `1px solid #616161`,\n borderRadius: 3,\n maxWidth: 500, // NOTE: Corresponds to react-player max width\n width: '75%',\n },\n imagePlaceholder: {\n position: 'relative',\n backgroundColor: grey200,\n borderRadius: 3,\n marginTop: 10,\n height: 135,\n width: 135,\n },\n};\n\nconst muiStyles = theme => ({\n imageIconRoot: {\n position: 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n },\n dialog: {\n width: '95%',\n height: '95%',\n maxWidth: '100%',\n position: 'relative',\n },\n nativeDialog: {\n width: '100%',\n height: '100%',\n maxWidth: '100%',\n maxHeight: '100%',\n margin: 0,\n },\n dialogRoot: {\n // NOTE: Make background color similar to lightbox\n backgroundColor: 'rgba(0, 0, 0, 0.85)',\n },\n fileName: {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n fontWeight: 400,\n },\n downloadIcon: {\n color: theme.palette.primary.text3,\n },\n disabledPreview: {\n backgroundColor: theme.palette.primary.text9,\n },\n unavailableFileIcon: {\n marginRight: 12,\n minWidth: 32,\n },\n titleContainer: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n },\n caption: {\n fontSize: 12,\n fontWeight: 400,\n width: 'fit-content',\n },\n unavailableFileName: {\n fontSize: 12,\n fontWeight: 400,\n },\n});\n\n/* eslint-disable react/prop-types */\nconst ImageAttachment = props => {\n const downloadLink = useSignedURL(props.attachmentFileName) || props.attachmentUrl;\n return (\n <>\n <div onClick={props.openLightbox} className={styles.cAttachmentImg}>\n <img\n data-testid={`${PAGE_NAME}_image`}\n src={downloadLink}\n style={style.fileImage(props.imageIsLoaded, props.size)}\n alt=\"Attachment\"\n onLoad={props.setImageIsLoaded}\n />\n <div data-testid={`${PAGE_NAME}_button`} className={styles.cAttachmentImgPreviwBtn}>\n <FullSizeIcon />\n </div>\n </div>\n\n {!props.imageIsLoaded && (\n <div style={style.imagePlaceholder}>\n <ImageIcon\n data-testid={`${PAGE_NAME}_placeholder`}\n className={props.classes.imageIconRoot}\n htmlColor={grey400}\n fontSize=\"large\"\n />\n </div>\n )}\n\n {props.lightboxIsOpen && (\n <ImageViewer\n mainSrc={downloadLink}\n imagePadding={50}\n onAfterOpen={props.handleLightboxOpen}\n onCloseRequest={props.handleLightboxClose}\n />\n )}\n </>\n );\n};\n\nconst FileAttachment = props => {\n const fileName = utils.getFileNameWithExtensionFromPath(props.displayName || props.attachmentUrl);\n\n const previewUrl = useSignedURL(props.attachmentFileName, 'inline');\n const downloadUrl = useSignedURL(props.attachmentFileName, 'attachment');\n\n const isPreviewUnavailable = getIsPreviewUnavailable(fileName);\n\n const handleFilePreviewOpen = () => {\n if (isPreviewUnavailable) return;\n props.openPreview();\n };\n\n return (\n <div className={styles.cAttachmentFileWrapper}>\n <div\n className={classNames(\n styles.cAttachmentFileDownloadWrapper,\n isPreviewUnavailable && props.classes.disabledPreview\n )}\n style={style.fileDownloadWrapper}\n onClick={handleFilePreviewOpen}\n >\n {isPreviewUnavailable ? (\n <UnavailableFileIcon className={props.classes.unavailableFileIcon} />\n ) : (\n <FileTypeIcon\n fileName={props.displayName || props.attachmentUrl}\n className={styles.cAttachmentFileDownloadWrapperFileIcon}\n size={props.small ? 25 : 50}\n />\n )}\n <div className={props.classes.titleContainer}>\n {isPreviewUnavailable && <div className={props.classes.caption}>Preview unavailable</div>}\n <div\n data-testid={`${PAGE_NAME}_name`}\n className={classNames(\n styles.cAttachmentFileDownloadWrapperFileName,\n isPreviewUnavailable && props.classes.fileName\n )}\n >\n <Typography variant=\"subtitle2\" noWrap className={props.classes.unavailableFileName}>\n {fileName}\n </Typography>\n </div>\n </div>\n <NewDocumentViewer\n fileUrl={previewUrl}\n classes={{\n root: props.classes.dialogRoot,\n paper: isNativeDetected ? props.classes.nativeDialog : props.classes.dialog,\n }}\n fileName={fileName}\n fileSize={props.attachmentSize}\n onClose={props.closePreview}\n open={props.previewIsOpen}\n />\n </div>\n <a\n download={props.displayName}\n href={downloadUrl}\n className={styles.cAttachmentFileDownloadWrapperForm}\n >\n <IconButton\n data-testid={`${PAGE_NAME}_downloadButton`}\n className={props.classes.downloadIcon}\n type=\"submit\"\n >\n <DownloadIcon size={24} className={props.classes.downloadIcon} />\n </IconButton>\n </a>\n </div>\n );\n};\n\n/* eslint-enable react/prop-types */\n\nfunction Attachment(props) {\n const [isImageLoaded, setIsImageLoaded] = useState(false);\n const [isLightboxOpen, setIsLightboxOpen] = useState(false);\n const [isPreviewOpen, setIsPreviewOpen] = useState(false);\n\n const fileName = props.displayName || props.attachmentUrl || props.fileName;\n const isImage = getIsImage(fileName);\n const isVideo = getIsVideo(fileName);\n\n // Don't fetch download link if attachmentUrl is provided\n const downloadLink = useSignedURL(!props.attachmentUrl && props.fileName);\n const attachmentUrl = props.attachmentUrl || downloadLink;\n const preventIOSScroll = useCallback(e => e.preventDefault(), []);\n\n // NOTE: iOS WebView has a bug when background content of React Modal is scrollable\n // Source: https://github.com/reactjs/react-modal/issues/369\n const handleLightboxOpen = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'hidden';\n document.documentElement.addEventListener('touchmove', preventIOSScroll, {\n passive: false,\n });\n }\n };\n\n const handleLightboxClose = () => {\n if (isNativeDetected) {\n // document.documentElement.style.overflowY = 'visible';\n document.documentElement.removeEventListener('touchmove', preventIOSScroll);\n }\n setIsLightboxOpen(false);\n };\n\n const openLightbox = () => setIsLightboxOpen(true);\n const setImageLoaded = () => setIsImageLoaded(true);\n const openPreview = () => setIsPreviewOpen(true);\n const closePreview = e => {\n e.stopPropagation();\n setIsPreviewOpen(false);\n };\n\n if (isImage)\n return (\n <div className={styles.cAttachment}>\n <ImageAttachment\n size={props.size}\n openLightbox={openLightbox}\n attachmentFileName={props.fileName}\n attachmentUrl={props.attachmentUrl}\n setImageIsLoaded={setImageLoaded}\n imageIsLoaded={isImageLoaded}\n lightboxIsOpen={isLightboxOpen}\n handleLightboxOpen={handleLightboxOpen}\n handleLightboxClose={handleLightboxClose}\n classes={props.classes}\n />\n </div>\n );\n\n if (isVideo && ReactPlayer.canPlay(attachmentUrl))\n return (\n <div className={styles.cAttachment}>\n <ReactPlayer\n data-testid={`${PAGE_NAME}_player`}\n className={styles.cAttachmentReactPlayer}\n url={attachmentUrl}\n config={{ file: { attributes: { preload: 'metadata' } } }}\n controls\n height={props.size === SIZES.small.label ? SIZES.small.value : SIZES.medium.value}\n width={null}\n />\n </div>\n );\n\n return (\n <div className={styles.cAttachment}>\n <FileAttachment\n attachmentUrl={attachmentUrl}\n attachmentFileName={props.fileName}\n attachmentSize={props.attachmentSize}\n displayName={props.displayName}\n openPreview={openPreview}\n closePreview={closePreview}\n previewIsOpen={isPreviewOpen}\n classes={props.classes}\n small={props.small}\n />\n </div>\n );\n}\n\nAttachment.propTypes = {\n attachmentUrl: PropTypes.string.isRequired,\n attachmentSize: PropTypes.number,\n displayName: PropTypes.string,\n fileName: PropTypes.string,\n size: PropTypes.oneOf([SIZES.small.label, SIZES.medium.label]),\n classes: PropTypes.shape({}).isRequired,\n small: PropTypes.bool,\n};\n\nAttachment.defaultProps = {\n displayName: null,\n fileName: null,\n attachmentSize: undefined,\n size: SIZES.medium.label,\n small: false,\n};\n\nexport default withStyles(muiStyles)(Attachment);\n"],"names":["grey200","grey","grey400","SIZES","label","value","style","fileImage","imageIsLoaded","size","maxWidth","borderRadius","overflow","maxHeight","display","cursor","fileDownloadWrapper","padding","border","width","imagePlaceholder","position","backgroundColor","marginTop","height","ImageAttachment","props","downloadLink","useSignedURL","attachmentFileName","attachmentUrl","_jsxs","_Fragment","children","onClick","openLightbox","className","styles","cAttachmentImg","_jsx","concat","src","alt","onLoad","setImageIsLoaded","cAttachmentImgPreviwBtn","FullSizeIcon","ImageIcon","classes","imageIconRoot","htmlColor","fontSize","lightboxIsOpen","ImageViewer","mainSrc","imagePadding","onAfterOpen","handleLightboxOpen","onCloseRequest","handleLightboxClose","FileAttachment","fileName","utils","getFileNameWithExtensionFromPath","displayName","previewUrl","downloadUrl","isPreviewUnavailable","getIsPreviewUnavailable","cAttachmentFileWrapper","classNames","cAttachmentFileDownloadWrapper","disabledPreview","openPreview","UnavailableFileIcon","unavailableFileIcon","FileTypeIcon","cAttachmentFileDownloadWrapperFileIcon","small","titleContainer","caption","cAttachmentFileDownloadWrapperFileName","Typography","variant","noWrap","unavailableFileName","NewDocumentViewer","fileUrl","root","dialogRoot","paper","isNativeDetected","nativeDialog","dialog","fileSize","attachmentSize","onClose","closePreview","open","previewIsOpen","download","href","cAttachmentFileDownloadWrapperForm","IconButton","downloadIcon","type","DownloadIcon","Attachment","useState","_useState2","_slicedToArray","_useState","isImageLoaded","setIsImageLoaded","_useState4","_useState3","isLightboxOpen","setIsLightboxOpen","_useState6","_useState5","isPreviewOpen","setIsPreviewOpen","isImage","getIsImage","isVideo","getIsVideo","preventIOSScroll","useCallback","e","preventDefault","cAttachment","document","documentElement","addEventListener","passive","removeEventListener","ReactPlayer","canPlay","cAttachmentReactPlayer","url","config","file","attributes","preload","controls","stopPropagation","propTypes","PropTypes","string","isRequired","number","oneOf","shape","bool","defaultProps","undefined","Attachment$1","withStyles","theme","top","left","transform","margin","whiteSpace","textOverflow","fontWeight","color","palette","primary","text3","text9","marginRight","minWidth","flexDirection"],"mappings":"6+IAyBA,IAEMA,EAAUC,EAAK,KACfC,EAAUD,EAAK,KAEfE,EACG,CAAEC,MAAO,QAASC,MAAO,KAD5BF,EAEI,CAAEC,MAAO,SAAUC,MAAO,KAG9BC,EAAQ,CACZC,UAAW,SAACC,EAAeC,GAAI,MAAM,CACnCC,SAAU,OACVC,aAAc,EACdC,SAAU,SAGVC,UAAWJ,IAASN,EAAYC,MAAQD,EAAYE,MAAQF,EAAaE,MACzES,QAASN,EAAgB,UAAY,OACrCO,OAAQ,UACR,EACFC,oBAAqB,CACnBC,QAAS,qBACTC,OAA2B,oBAC3BP,aAAc,EACdD,SAAU,IACVS,MAAO,OAETC,iBAAkB,CAChBC,SAAU,WACVC,gBAAiBtB,EACjBW,aAAc,EACdY,UAAW,GACXC,OAAQ,IACRL,MAAO,MA6DLM,EAAkB,SAAAC,GACtB,IAAMC,EAAeC,EAAaF,EAAMG,qBAAuBH,EAAMI,cACrE,OACEC,EAAAC,EAAA,CAAAC,SACE,CAAAF,EAAA,MAAA,CAAKG,QAASR,EAAMS,aAAcC,UAAWC,EAAOC,eAAeL,SACjE,CAAAM,EA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
|
titleControls?: ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* **(V3 only)** Title controls position
|
|
80
|
+
*/
|
|
81
|
+
titleControlsPosition?: 'right' | 'left';
|
|
78
82
|
/**
|
|
79
83
|
* **(V3 only)** Disables settings button
|
|
80
84
|
*/
|
|
@@ -96,5 +100,5 @@ export type AppHeaderProps = {
|
|
|
96
100
|
*/
|
|
97
101
|
titleMenuActions?: TitleMenuAction[];
|
|
98
102
|
};
|
|
99
|
-
export declare const AppHeader: ({ className, testId, logo, children, padModeDisabled, padModeWells, onPadModeChange, elementsClassNames, title, asset, dqData, lastUpdate, additionalActions, showComments, titleControls, disableSettingsPin, disableSettings, showAssetChips, additionalControls, rightSideContent, disableAssetSelector, titleMenuActions, }: AppHeaderProps) => JSX.Element;
|
|
103
|
+
export declare const AppHeader: ({ className, testId, logo, children, padModeDisabled, padModeWells, onPadModeChange, elementsClassNames, title, asset, dqData, lastUpdate, additionalActions, showComments, titleControls, titleControlsPosition, disableSettingsPin, disableSettings, showAssetChips, additionalControls, rightSideContent, disableAssetSelector, titleMenuActions, }: AppHeaderProps) => JSX.Element;
|
|
100
104
|
//# sourceMappingURL=AppHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../src/componentsV2/AppHeader/AppHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAOzE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAKxE,OAAO,EAAoB,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAInE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,C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AAC;KAClB,CAAC;IAEF,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAK7B;;OAEG;IACH,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,2BAA2B,CAAC;IACrC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,SAAS,2VAyBnB,cAAc,gBAiGhB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import s from"classnames";import{useMemo as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import s from"classnames";import{useMemo as o}from"react";import{isEmpty as a}from"lodash";import{Header as i}from"../Header/Header.js";import{TextEndTruncated as l}from"../TextEndTruncated/TextEndTruncated.js";import{getAppSegment as n}from"../../utils/devcenter.js";import{SEGMENTS as d}from"../../constants/segment.js";import{useAppCommons as r}from"../AppCommonsProvider/AppCommonsContext.js";import{AppBadge as p}from"./AppBadge/AppBadge.js";import{AppAssets as m}from"./AppAssets/AppAssets.js";import{PadMode as c}from"./PadMode/PadMode.js";import{AppHeaderTestIds as g}from"./AppHeader.constants.js";import{AppHeaderV3 as C}from"./V3/AppHeaderV3.js";import h from"./AppHeader.scss.js";var f=function(f){var A=f.className,N=f.testId,v=f.logo,u=f.children,j=f.padModeDisabled,S=f.padModeWells,M=f.onPadModeChange,b=f.elementsClassNames,w=f.title,P=f.asset,T=f.dqData,H=f.lastUpdate,x=f.additionalActions,I=f.showComments,D=f.titleControls,E=f.titleControlsPosition,B=void 0===E?"right":E,V=f.disableSettingsPin,q=void 0===V||V,F=f.disableSettings,L=f.showAssetChips,O=void 0===L||L,U=f.additionalControls,W=f.rightSideContent,y=f.disableAssetSelector,k=f.titleMenuActions,z=r(),G=z.app,J=z.well,K=z.fracFleet,Q=z.wells,R=z.onSettingChange,X=z.appSettings,Y=void 0===X?{}:X,Z=z.appHeadersV3Enabled,$=z.appName,_=S||Q,ee=n(G),te=!(j||ee!==d.COMPLETION||J||a(_)||!K),se=o((function(){return M?function(e,t){return M(t)}:R}),[M,R]);return Z?e(C,{testId:N,className:A,elementsClassNames:b,logo:v,title:w,padModeDisabled:j,padModeWells:S,asset:P,dqData:T,lastUpdate:H,additionalActions:x,showComments:I,titleControls:D,disableSettingsPin:q,disableSettings:F,showAssetChips:O,additionalControls:U||u,disableAssetSelector:y,titleMenuActions:k,titleControlsPosition:B}):t("div",{className:s(h.root,A),"data-testid":N,children:[t(i,{className:s(h.logoTitleBadgeContainer,null==b?void 0:b.title),appearance:"appName",children:[v&&e("div",{className:h.logoContainer,children:"string"==typeof v?e("img",{className:h.logo,src:v,alt:"Logo"}):v}),e(l,{className:h.appName,testId:g.AppTitleTestId,children:w||$}),e(p,{app:G})]}),(u||U||te)&&t("div",{className:s(h.additional,null==b?void 0:b.additional),children:[te&&e(c,{app:G,appSettings:Y,fracFleet:K,onSettingChange:se,well:J,wells:_}),U||u]}),e("div",{className:s(h.assetChips,null==b?void 0:b.chips),children:e(m,{forceNarrow:te||!!u})}),W&&e("div",{className:h.rightSideContent,children:W})]})};export{f as AppHeader};
|
|
2
2
|
//# sourceMappingURL=AppHeader.js.map
|
|
@@ -9,6 +9,7 @@ export type AppHeaderV3Props = {
|
|
|
9
9
|
* Used to put some controls alongside title
|
|
10
10
|
*/
|
|
11
11
|
titleControls?: ReactNode;
|
|
12
|
+
titleControlsPosition?: 'right' | 'left';
|
|
12
13
|
/**
|
|
13
14
|
* An escape hatch to tweak the styling of internal elements
|
|
14
15
|
*
|
|
@@ -26,8 +27,6 @@ export type AppHeaderV3Props = {
|
|
|
26
27
|
title?: ReactNode;
|
|
27
28
|
padModeDisabled?: boolean;
|
|
28
29
|
padModeWells?: ReturnType<typeof useAppCommonsInternal>['wells'];
|
|
29
|
-
className?: string;
|
|
30
|
-
testId?: string;
|
|
31
30
|
lastUpdate?: number | string | Date;
|
|
32
31
|
asset?: Asset | Asset[];
|
|
33
32
|
dqData?: UseWellnessAlertsReturnType;
|
|
@@ -38,6 +37,8 @@ export type AppHeaderV3Props = {
|
|
|
38
37
|
showAssetChips?: boolean;
|
|
39
38
|
disableAssetSelector?: boolean;
|
|
40
39
|
titleMenuActions?: TitleMenuAction[];
|
|
40
|
+
className?: string;
|
|
41
|
+
testId?: string;
|
|
41
42
|
};
|
|
42
|
-
export declare const AppHeaderV3: ({ elementsClassNames, className, testId, logo, additionalControls, title, padModeDisabled, padModeWells, dqData, asset, lastUpdate, additionalActions, showComments, titleControls, disableSettingsPin, disableSettings, showAssetChips, disableAssetSelector, titleMenuActions, }: AppHeaderV3Props) => JSX.Element;
|
|
43
|
+
export declare const AppHeaderV3: ({ elementsClassNames, className, testId, logo, additionalControls, title, padModeDisabled, padModeWells, dqData, asset, lastUpdate, additionalActions, showComments, titleControls, disableSettingsPin, disableSettings, showAssetChips, disableAssetSelector, titleMenuActions, titleControlsPosition, }: AppHeaderV3Props) => JSX.Element;
|
|
43
44
|
//# sourceMappingURL=AppHeaderV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeaderV3.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/AppHeader/V3/AppHeaderV3.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAOxD,OAAO,EAAoB,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMjE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAE7B,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAE/B;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"AppHeaderV3.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/AppHeader/V3/AppHeaderV3.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAOxD,OAAO,EAAoB,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMjE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAE7B,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAE/B;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IAEF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC;IAEjE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,2BAA2B,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,8SAqBrB,gBAAgB,gBAwKlB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useRef as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useRef as o}from"react";import s from"classnames";import{isEmpty as l}from"lodash";import{SEGMENTS as i}from"../../../constants/segment.js";import{getAppSegment as n}from"../../../utils/devcenter.js";import{PadModeSelect as d}from"../../PadModeSelect/PadModeSelect.js";import"../../PadModeSelect/PadModeSelect.constants.js";import{AppHeaderTestIds as a}from"../AppHeader.constants.js";import{useAppCommonsInternal as r}from"../../AppCommonsProvider/AppCommonsContext.js";import{VersionSelect as c}from"./VersionSelect/VersionSelect.js";import{AssetChips as m}from"./AssetChips/AssetChips.js";import{AppTitle as p}from"./AppTitle/AppTitle.js";import"./AppTitle/AppTitle.constants.js";import{useResponsivity as v}from"./useResponsivity.js";import{Actions as f}from"./Actions/Actions.js";import"./Actions/Actions.constants.js";import u from"./AppHeaderV3.scss.js";var C=function(C){var h,A,y,I,L,N,j,M,g,S,R,b,P,w=C.elementsClassNames,T=C.className,x=C.testId,D=C.logo,V=C.additionalControls,W=C.title,k=C.padModeDisabled,q=C.padModeWells,H=C.dqData,O=C.asset,U=C.lastUpdate,B=C.additionalActions,E=C.showComments,F=C.titleControls,z=C.disableSettingsPin,G=void 0===z||z,J=C.disableSettings,K=C.showAssetChips,Q=C.disableAssetSelector,X=C.titleMenuActions,Y=C.titleControlsPosition,Z=void 0===Y?"right":Y,$=o(null),_=r(),tt=_.app,et=_.well,ot=_.wells,st=_.fracFleet,lt=_.isInsideNewMobileApp,it=n(tt),nt=q||ot,dt=!(k||it!==i.COMPLETION||et||l(nt)||!st||lt),at=D?"ultranarrow":dt||V||F?"narrow":void 0,rt="left"===Z&&!!F,ct=o(null),mt=o(null),pt=o(null),vt=o(null),ft=o(null),ut=o(null),Ct=o(null),ht=v({disabled:lt,titleControlsLeft:rt,rootRef:$,versionRef:ct,additionalControlsRef:pt,titleControlsRef:vt,logoRef:ut,padModeRef:mt,chipsRef:ft,actionsRef:Ct});return t("div",{className:s(u.root,T),"data-testid":x,ref:$,style:null===(h=ht.root)||void 0===h?void 0:h.style,children:[e("div",{className:s(u.logoContainer,null==w?void 0:w.logoContainer),ref:ut,children:D&&"string"==typeof D?e("img",{className:u.logo,src:D,alt:"Logo"}):D}),e(p,{title:W,asset:O,dqData:H,lastUpdate:U,className:s(u.title,rt&&u.titleWithControlsLeft,null==w?void 0:w.title),disableAssetSelector:Q,titleMenuActions:X,style:null===(A=ht.title)||void 0===A?void 0:A.style}),F&&e("div",{className:s(u.titleControls,rt&&u.titleControlsLeft,(null===(y=ht.titleControls)||void 0===y?void 0:y.lastInLine)&&u.lastInLine,null==w?void 0:w.titleControls),ref:vt,style:null===(I=ht.titleControls)||void 0===I?void 0:I.style,children:F}),!lt&&e("div",{className:u.version,ref:ct,children:e(c,{className:null==w?void 0:w.versionSelect})}),dt&&e("div",{className:s(u.padMode,(null===(L=ht.padMode)||void 0===L?void 0:L.lastInLine)&&u.lastInLine),ref:mt,style:null===(N=ht.padMode)||void 0===N?void 0:N.style,children:e(d,{testId:a.PadModeSelectTestId})}),V&&e("div",{className:s(u.additionalControls,(null===(j=ht.additionalControls)||void 0===j?void 0:j.lastInLine)&&u.lastInLine,null==w?void 0:w.additionalControls),ref:pt,style:null===(M=ht.additionalControls)||void 0===M?void 0:M.style,"data-testid":a.AdditionalControlsTestId,children:V}),K&&!lt&&e("div",{className:s(u.assetChips,(null===(g=ht.chips)||void 0===g?void 0:g.lastInLine)&&u.lastInLine,null==w?void 0:w.chips),ref:ft,style:null===(S=ht.chips)||void 0===S?void 0:S.style,children:e(m,{chipsWidth:at})}),e("div",{className:s(u.actions,(null===(R=ht.actions)||void 0===R?void 0:R.lastInLine)&&u.lastInLine,null==w?void 0:w.actions),ref:Ct,style:null===(b=ht.actions)||void 0===b?void 0:b.style,"data-testid":a.ActionsRootTestId,children:e(f,{additionalActions:B,showComments:E,disableSettingsPin:G,disableSettings:J,rootRef:$})}),null===(P=ht.linebreaks)||void 0===P?void 0:P.map((function(t,o){return e("div",{className:u.responsivenessLineBreak,style:t},o)}))]})};export{C as AppHeaderV3};
|
|
2
2
|
//# sourceMappingURL=AppHeaderV3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var
|
|
1
|
+
import e from'./../../../ext-esm/style-inject/dist/style-inject.es.js';var r={spacing:"8",gap:"8px",titleMinWidth:"90px",root:"AppHeaderV3_root__urLNv",logoContainer:"AppHeaderV3_logoContainer__Bv-lU",logo:"AppHeaderV3_logo__0VO16",title:"AppHeaderV3_title__vVZB9",titleWithControlsLeft:"AppHeaderV3_titleWithControlsLeft__Mnnkm",additionalControls:"AppHeaderV3_additionalControls__-QrO4",titleControls:"AppHeaderV3_titleControls__Yzl06",assetChips:"AppHeaderV3_assetChips__4LwGe",padMode:"AppHeaderV3_padMode__-uTzy",version:"AppHeaderV3_version__Acke3",titleControlsLeft:"AppHeaderV3_titleControlsLeft__NrIwI",actions:"AppHeaderV3_actions__Q0PRr",responsivenessLineBreak:"AppHeaderV3_responsivenessLineBreak__2QL6d",lastInLine:"AppHeaderV3_lastInLine__cbmHb"};e(".AppHeaderV3_root__urLNv{--headerV3-responsivity-flexwrap:wrap;align-items:center;display:flex;flex-direction:row;flex-wrap:var(--headerV3-responsivity-flexwrap);gap:0 8px;min-height:48px;overflow:hidden;padding:6px 0;width:100%}.AppHeaderV3_logoContainer__Bv-lU{max-height:36px;max-width:130px;overflow:hidden}.AppHeaderV3_logo__0VO16{display:block;max-height:36px;max-width:100%}.AppHeaderV3_title__vVZB9{flex:1 0 90px;min-width:90px}.AppHeaderV3_titleWithControlsLeft__Mnnkm{--headerV3-responsivity-marginRight:auto;--headerV3-responsivity-maxWidth:100%;flex:0 1 auto;margin-right:var(--headerV3-responsivity-marginRight);max-width:var(--headerV3-responsivity-maxWidth);min-width:1px}.AppHeaderV3_additionalControls__-QrO4,.AppHeaderV3_assetChips__4LwGe,.AppHeaderV3_logoContainer__Bv-lU,.AppHeaderV3_padMode__-uTzy,.AppHeaderV3_titleControls__Yzl06,.AppHeaderV3_version__Acke3{align-items:center;display:flex;flex-flow:row nowrap;flex-shrink:0;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_additionalControls__-QrO4:empty,.AppHeaderV3_assetChips__4LwGe:empty,.AppHeaderV3_logoContainer__Bv-lU:empty,.AppHeaderV3_padMode__-uTzy:empty,.AppHeaderV3_titleControls__Yzl06:empty,.AppHeaderV3_version__Acke3:empty{display:none}.AppHeaderV3_titleControlsLeft__NrIwI{margin-right:auto}.AppHeaderV3_actions__Q0PRr{align-items:center;display:flex;flex:0 0 auto;flex-flow:row nowrap;gap:8px;min-height:36px;order:var(--headerV3-responsivity-order)}.AppHeaderV3_responsivenessLineBreak__2QL6d{flex:0 0 100%}.AppHeaderV3_lastInLine__cbmHb{margin-left:auto}");export{r as default};
|
|
2
2
|
//# sourceMappingURL=AppHeaderV3.scss.js.map
|
|
@@ -16,5 +16,6 @@ export declare const WithDataQuality: () => JSX.Element;
|
|
|
16
16
|
export declare const WithAddtitionalActionsInTitleMenu: () => JSX.Element;
|
|
17
17
|
export declare const WithCommentsAndAdditionalActions: () => JSX.Element;
|
|
18
18
|
export declare const DisabledAssetSelector: () => JSX.Element;
|
|
19
|
+
export declare const WithTitleControlsOnTheLeft: () => JSX.Element;
|
|
19
20
|
export declare const Responsiveness: () => JSX.Element;
|
|
20
21
|
//# sourceMappingURL=AppHeaderV3.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeaderV3.stories.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/AppHeader/V3/AppHeaderV3.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAyB,MAAM,OAAO,CAAC;AAa9D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"AppHeaderV3.stories.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/AppHeader/V3/AppHeaderV3.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAyB,MAAM,OAAO,CAAC;AAa9D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAazC,KAAK,KAAK,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAsJ9C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,KAAK,CAGrB,CAAC;AA2CF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,UAAW,KAAK,gBAInC,CAAC;AAEF,eAAO,MAAM,GAAG,mBAsBf,CAAC;AAUF,eAAO,MAAM,cAAc,mBAuB1B,CAAC;AAMF,eAAO,MAAM,WAAW,mBA0CvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,mBAQ/B,CAAC;AAEF,eAAO,MAAM,uBAAuB,mBAsBnC,CAAC;AAEF,eAAO,MAAM,QAAQ,mBAIpB,CAAC;AAEF,eAAO,MAAM,WAAW,mBA4FvB,CAAC;AAEF,eAAO,MAAM,eAAe,mBA0C3B,CAAC;AAEF,eAAO,MAAM,iCAAiC,mBA2B7C,CAAC;AAOF,eAAO,MAAM,gCAAgC,mBAmE5C,CAAC;AAeF,eAAO,MAAM,qBAAqB,mBAQjC,CAAC;AAMF,eAAO,MAAM,0BAA0B,mBAsEtC,CAAC;AAMF,eAAO,MAAM,cAAc,mBA0J1B,CAAC"}
|
|
@@ -9,6 +9,7 @@ export type AppTitleProps = {
|
|
|
9
9
|
title?: ReactNode;
|
|
10
10
|
disableAssetSelector?: boolean;
|
|
11
11
|
titleMenuActions?: TitleMenuAction[];
|
|
12
|
+
style?: React.CSSProperties;
|
|
12
13
|
};
|
|
13
|
-
export declare const AppTitle: ({ asset, className, dqData, lastUpdate, title, disableAssetSelector, titleMenuActions, }: AppTitleProps) => JSX.Element;
|
|
14
|
+
export declare const AppTitle: ({ asset, className, dqData, lastUpdate, title, disableAssetSelector, titleMenuActions, style, }: AppTitleProps) => JSX.Element;
|
|
14
15
|
//# sourceMappingURL=AppTitle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppTitle.d.ts","sourceRoot":"","sources":["../../../../../src/componentsV2/AppHeader/V3/AppTitle/AppTitle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,SAAS,EAA0C,MAAM,OAAO,CAAC;AAMpF,OAAO,EAAE,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAa/E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,2BAA2B,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"AppTitle.d.ts","sourceRoot":"","sources":["../../../../../src/componentsV2/AppHeader/V3/AppTitle/AppTitle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,SAAS,EAA0C,MAAM,OAAO,CAAC;AAMpF,OAAO,EAAE,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAa/E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAqB/C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,2BAA2B,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAwBF,eAAO,MAAM,QAAQ,oGASlB,aAAa,gBAmSf,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as o}from'./../../../../ext-esm/tslib/tslib.es6.js';import{jsx as s,jsxs as
|
|
1
|
+
import{__assign as o}from'./../../../../ext-esm/tslib/tslib.es6.js';import{jsx as s,jsxs as t,Fragment as i}from"react/jsx-runtime";import e from"classnames";import{useState as n,useRef as c,useCallback as r,useMemo as m,Fragment as l}from"react";import a from"moment";import{Icon as p}from"@material-ui/core";import{TextEndTruncated as d}from"../../../TextEndTruncated/TextEndTruncated.js";import{Button as u}from"../../../Button/Button.js";import{DqStatusIcon as I}from"../DqStatusIcon/DqStatusIcon.js";import"../DqStatusIcon/DqStatusIcon.constants.js";import{AppDqPopover as f}from"../../../AppDqPopover/AppDqPopover.js";import{Menu as v}from"../../../Menu/Menu.js";import{AppIcon as j}from"../../../../components/AppIcon/AppIcon.js";import{getAppSegment as h}from"../../../../utils/devcenter.js";import{Text as A}from"../../../Text/Text.js";import{Accordion as C}from"../../../Accordion/Accordion.js";import{AppRemoveConfirmationModal as T}from"../AppRemoveConfirmationModal/AppRemoveConfirmationModal.js";import{AssetSelector as N}from"../AssetSelector/AssetSelector.js";import"../AssetSelector/constants.js";import{SEGMENTS as g}from"../../../../constants/segment.js";import{useAppCommonsInternal as b}from"../../../AppCommonsProvider/AppCommonsContext.js";import{UniversalLink as x}from"../../../UniversalLink/UniversalLink.js";import{AppTitleTestIds as k}from"./AppTitle.constants.js";import y from"../../../AppContainer/headerCommon.scss.js";import M from"./AppTitle.scss.js";import{DownIcon as D,SettingOneIcon as S,HelpIcon as q,DeleteFourIcon as E}from"../../../../icons/iconParkIcons.js";import{AddMessageCustomIcon as F}from"../../../../icons/customIcons/icons/AddMessage.js";import"../../../../icons/customIcons/icons/Attention.js";import"../../../../icons/customIcons/icons/Collapse.js";import"../../../../icons/customIcons/icons/Dashboard.js";import"../../../../icons/customIcons/icons/Expand.js";import"../../../../icons/customIcons/icons/FolderClosed.js";import"../../../../icons/customIcons/icons/FolderClosedFilled.js";import"../../../../icons/customIcons/icons/FolderOpened.js";import"../../../../icons/customIcons/icons/GreaterOrEqual.js";import"../../../../icons/customIcons/icons/LessOrEqual.js";import"../../../../icons/customIcons/icons/Search.js";import"../../../../icons/customIcons/icons/Wellhub.js";import"../../../../icons/customIcons/icons/MultiRuler.js";import"../../../../icons/customIcons/icons/Checkbox.js";import"../../../../icons/customIcons/icons/CheckboxChecked.js";import"../../../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../../../icons/customIcons/icons/Radio.js";import"../../../../icons/customIcons/icons/RadioChecked.js";import"../../../../icons/customIcons/icons/SimulFrac.js";import"../../../../icons/customIcons/icons/ZipperFrac.js";import"../../../../icons/customIcons/icons/CautionFilled.js";import"../../../../icons/customIcons/icons/MoreApp.js";import"../../../../icons/customIcons/icons/Pad.js";import"../../../../icons/customIcons/icons/DrilloutUnit.js";import"../../../../icons/customIcons/icons/FracFleet.js";import"../../../../icons/customIcons/icons/Global.js";import"../../../../icons/customIcons/icons/Program.js";import"../../../../icons/customIcons/icons/Rig.js";import"../../../../icons/customIcons/icons/Well.js";import"../../../../icons/customIcons/icons/Gap.js";import"../../../../icons/customIcons/icons/Pin.js";import"../../../../icons/customIcons/icons/CloseOneFilled.js";import"../../../../icons/customIcons/icons/AttentionFilled.js";import"../../../../icons/customIcons/icons/CheckOneFilled.js";import"../../../../icons/customIcons/icons/Archive.js";import"../../../../icons/customIcons/icons/ArchiveCancel.js";import"../../../../icons/customIcons/icons/Unarchive.js";import"../../../../icons/customIcons/icons/Archived.js";import"../../../../icons/customIcons/icons/InterventionUnit.js";import"../../../../clients/subscriptions/constants.js";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/defineProperty";import"@babel/runtime/regenerator";import"querystring";import"uuid/v1";import"lodash";import"../../../../clients/subscriptions.v1.js";import"../../../../clients/jsonApi/index.js";import"../../../../clients/subscriptions/subscriptions-client.factory.js";import z from"../../../../effects/useOutsideClick.js";import"../../../../utils/index.js";import{useWellnessAlerts as R}from"../../../../effects/useWellnessAlerts.js";import"lodash/get";import"lodash/isEmpty";import"lodash/sortBy";import"../../../../constants/completion.js";import"../../../../constants/streamSourceType.js";import"../../../../components/DevCenter/DevCenterAppContainer/components/CommentsSwitch/CommentsSwitchContext.js";var L=function(o){return o&&"asset_id"in o?{name:o.name,id:o.asset_id}:o},O=function(O){var P,B,U,w,H,G,Y,_,W=O.asset,V=O.className,Z=O.dqData,J=O.lastUpdate,K=O.title,Q=O.disableAssetSelector,X=O.titleMenuActions,$=O.style,oo=b(),so=oo.app,to=oo.appId,io=oo.maximized,eo=oo.toggleAnnotationsList,no=oo.onHelpCenterClick,co=oo.secondaryMenuItems,ro=oo.appName,mo=oo.layoutEnvironment,lo=oo.isInsideNewMobileApp,ao=n(!1),po=ao[0],uo=ao[1],Io=c(),fo=c(),vo=c(null),jo=c(null),ho=n(!1),Ao=ho[0],Co=ho[1],To=c(null),No=r((function(){return uo((function(o){return!o}))}),[]),go=r((function(){return Co((function(o){return!o}))}),[]),bo=r((function(){clearTimeout(Io.current),clearTimeout(fo.current),Io.current=setTimeout((function(){uo(!0)}),300)}),[]),xo=r((function(){clearTimeout(Io.current),clearTimeout(fo.current),Io.current=setTimeout((function(){uo(!1)}),700)}),[]);z(jo,No,[vo.current]);var ko=(W instanceof Array&&W.length>0||!!W)&&!Z&&!lo,yo=R({isDCApp:ko,appId:to,multiRigAssets:W instanceof Array?W:void 0,asset:W instanceof Array?void 0:L(W),maximized:io,dashboards:[]}),Mo=Z||yo,Do=(ko||!!Z)&&!lo,So=(null===(P=null==Mo?void 0:Mo.wellnessAlerts)||void 0===P?void 0:P.alertsData)||{},qo=function(o){if(o){if("number"==typeof o){var s=Date.now();return Math.abs(s-o)>Math.abs(s-1e3*o)?a.unix(o):a(o)}return a(o)}return null}(J),Eo=r((function(){go(),null==eo||eo()}),[eo,go]),Fo=r((function(){go(),null==no||no()}),[no,go]),zo=n(!1),Ro=zo[0],Lo=zo[1],Oo=r((function(){go(),Lo(!0)}),[go]),Po=r((function(){Lo(!1)}),[]),Bo=m((function(){return[].concat(co||[]).concat(X||[]).map((function(s){return o(o({},s),{onClick:function(){var o;go(),null===(o=s.onClick)||void 0===o||o.call(s)}})}))}),[co,X,go]),Uo=!!(null===(H=null===(w=null===(U=null===(B=so.package)||void 0===B?void 0:B.manifest)||void 0===U?void 0:U.application)||void 0===w?void 0:w.ui)||void 0===H?void 0:H.multi_rig),wo="asset"===(null==mo?void 0:mo.type),Ho=h(so)===g.COMPLETION,Go=!(Uo||wo&&Ho||Q),Yo=(null==qo?void 0:qo.isValid())?"Last Update: ".concat(qo.format("MMM D YYYY, hh:mm A")):void 0,_o=K||ro;return lo?s("div",{className:e(M.root,V),children:s("div",{className:M.title,children:s(d,{className:e(M.titleText),testId:k.AppNameTestId,children:_o})})}):t("div",{className:e(M.root,V),style:$,children:[Do&&s(I,{statusBadgeIconType:Mo.statusBadgeIconType,className:M.dqBadge,onClick:No,onMouseEnter:bo,onMouseLeave:xo,ref:vo}),s(u,{type:"tertiary",size:"small",className:M.title,suffix:s("div",{className:e(M.titleChevron,y.titleChevron,Ao&&M.titleChevronOpen),children:s(D,{size:16})}),ref:To,onClick:go,children:s(d,{className:e(M.titleText,Do&&M.withDq),testId:k.AppNameTestId,children:_o})}),s(f,{open:po,anchorEl:vo.current,placement:"bottom-start",alertsData:So,onClose:No,contentRef:jo,onMouseEnter:bo,onMouseLeave:xo}),t(v,{anchorEl:To.current,open:Ao,className:M.menuRoot,onClose:go,children:[t(x,{href:"/app-store/app/".concat(null===(G=null==so?void 0:so.app)||void 0===G?void 0:G.id),className:M.menuHeader,"data-testid":k.AppStoreLinkTestId,children:[s(j,{"data-testid":k.AppIconTestId,className:M.appIcon,segment:[h(so)],iconUrl:null===(_=null===(Y=null==so?void 0:so.app)||void 0===Y?void 0:Y.icon)||void 0===_?void 0:_.url,height:40,width:40}),t("div",{className:M.menuHeaderText,children:[s(A,{children:s(d,{testId:k.MenuAppNameTestId,children:ro})}),s(A,{size:12,color:"T6",children:"Open in Appstore"})]})]}),s("div",{className:M.divider}),Go&&s(v.Item,{size:"large",disableClickEffect:!0,className:M.assetMenuItem,children:s(C,{title:t("div",{className:M.accordionTitle,children:[s(S,{size:24,className:M.accordionIcon}),"Change Asset"]}),iconPosition:"end",titleHover:!1,testId:k.AssetSelectorAccordionTestId,children:s(N,{})})}),null==Bo?void 0:Bo.map((function(o,i){return t(l,{children:[s("div",{className:M.divider}),s(v.Item,{size:"large",onClick:o.onClick,prefix:"string"==typeof o.icon?s(p,{children:o.icon}):o.icon,testId:k.AdditionalSelectionTestId,children:o.title})]},i)})),no&&t(i,{children:[s("div",{className:M.divider}),s(v.Item,{size:"large",prefix:s(q,{}),onClick:Fo,testId:k.HelpCenterLinkTestId,children:"Help Center"})]}),eo&&t(i,{children:[s("div",{className:M.divider}),s(v.Item,{size:"large",prefix:s(F,{fill:"currentColor"}),onClick:Eo,testId:k.AnnotationsTestId,children:"Add Annotation"})]}),s("div",{className:M.divider}),s(v.Item,{size:"large",prefix:s(E,{}),className:M.removeAppItem,onClick:Oo,testId:k.RemoveAppTestId,children:"Remove App"}),(null==qo?void 0:qo.isValid())&&t(i,{children:[s("div",{className:M.divider}),t("div",{className:M.footer,children:[s(I,{statusBadgeIconType:Mo.statusBadgeIconType,className:M.footerDqBadge,ref:vo}),Yo&&s(A,{size:12,color:"T6",children:Yo})]})]})]}),s(T,{open:Ro,onClose:Po})]})};export{O as AppTitle};
|
|
2
2
|
//# sourceMappingURL=AppTitle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from'./../../../../ext-esm/style-inject/dist/style-inject.es.js';var t={spacing:"8",gap:"8px",titleMinWidth:"90px",root:"AppTitle_root__2z-8W",title:"AppTitle_title__-OfhC",titleText:"AppTitle_titleText__miwjo",withDq:"AppTitle_withDq__8ZfD6",titleChevron:"AppTitle_titleChevron__ZjfXd",titleChevronOpen:"AppTitle_titleChevronOpen__mmQn-",dqBadge:"AppTitle_dqBadge__miNBd",menuRoot:"AppTitle_menuRoot__An9Ta",menuHeader:"AppTitle_menuHeader__jJGvl",appIcon:"AppTitle_appIcon__hojKJ",menuHeaderText:"AppTitle_menuHeaderText__9Fr3w",divider:"AppTitle_divider__58c-O",assetMenuItem:"AppTitle_assetMenuItem__aTqr-",accordionTitle:"AppTitle_accordionTitle__-cs1z",accordionIcon:"AppTitle_accordionIcon__1rKbM",removeAppItem:"AppTitle_removeAppItem__s10Cz",footer:"AppTitle_footer__O5bKk",footerDqBadge:"AppTitle_footerDqBadge__ptC05"};e('.AppTitle_root__2z-8W{
|
|
1
|
+
import e from'./../../../../ext-esm/style-inject/dist/style-inject.es.js';var t={spacing:"8",gap:"8px",titleMinWidth:"90px",root:"AppTitle_root__2z-8W",title:"AppTitle_title__-OfhC",titleText:"AppTitle_titleText__miwjo",withDq:"AppTitle_withDq__8ZfD6",titleChevron:"AppTitle_titleChevron__ZjfXd",titleChevronOpen:"AppTitle_titleChevronOpen__mmQn-",dqBadge:"AppTitle_dqBadge__miNBd",menuRoot:"AppTitle_menuRoot__An9Ta",menuHeader:"AppTitle_menuHeader__jJGvl",appIcon:"AppTitle_appIcon__hojKJ",menuHeaderText:"AppTitle_menuHeaderText__9Fr3w",divider:"AppTitle_divider__58c-O",assetMenuItem:"AppTitle_assetMenuItem__aTqr-",accordionTitle:"AppTitle_accordionTitle__-cs1z",accordionIcon:"AppTitle_accordionIcon__1rKbM",removeAppItem:"AppTitle_removeAppItem__s10Cz",footer:"AppTitle_footer__O5bKk",footerDqBadge:"AppTitle_footerDqBadge__ptC05"};e('.AppTitle_root__2z-8W{overflow:hidden;position:relative}.AppTitle_title__-OfhC{max-width:100%;overflow:hidden}.AppTitle_titleText__miwjo{color:var(--palette-primary-text-1);font-size:18px;font-weight:500;letter-spacing:normal;line-height:24px;text-transform:none}.AppTitle_withDq__8ZfD6{padding-left:20px}.AppTitle_titleChevron__ZjfXd{margin-right:-4px;transition:opacity .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1)}.AppTitle_titleChevronOpen__mmQn-{opacity:1;transform:rotate(180deg)}.AppTitle_dqBadge__miNBd{left:0;position:absolute;top:50%;transform:translateY(-50%);z-index:1}.AppTitle_menuRoot__An9Ta{--corvaui-background:var(--palette-background-b-6);background-color:var(--palette-background-b-6)!important;width:296px}.AppTitle_menuHeader__jJGvl{cursor:pointer;display:flex;flex-flow:row nowrap;gap:8px;margin:-8px -16px 0;padding:16px}.AppTitle_appIcon__hojKJ{flex-shrink:0}.AppTitle_menuHeaderText__9Fr3w{display:flex;flex-flow:column nowrap;gap:4px;overflow:hidden}.AppTitle_divider__58c-O{border-bottom:1px solid var(--palette-background-b-4);margin:0 -16px}.AppTitle_assetMenuItem__aTqr-{cursor:auto!important}.AppTitle_accordionTitle__-cs1z{align-items:center;display:flex;flex-flow:row nowrap;min-height:30px}.AppTitle_accordionTitle__-cs1z:after{content:"";cursor:pointer;inset:-12px -16px;position:absolute;z-index:1}.AppTitle_accordionIcon__1rKbM{display:inline-block;margin-right:16px;vertical-align:middle}.AppTitle_removeAppItem__s10Cz{color:var(--palette-error-main)!important}.AppTitle_footer__O5bKk{padding-top:8px}.AppTitle_footerDqBadge__ptC05{display:inline-block;margin-right:8px;vertical-align:middle}');export{t as default};
|
|
2
2
|
//# sourceMappingURL=AppTitle.scss.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, RefObject } from 'react';
|
|
2
2
|
type Params = {
|
|
3
3
|
disabled?: boolean;
|
|
4
|
+
titleControlsLeft?: boolean;
|
|
4
5
|
rootRef: RefObject<HTMLElement>;
|
|
5
6
|
versionRef: RefObject<HTMLElement>;
|
|
6
7
|
padModeRef: RefObject<HTMLElement>;
|
|
@@ -11,7 +12,7 @@ type Params = {
|
|
|
11
12
|
actionsRef: RefObject<HTMLElement>;
|
|
12
13
|
};
|
|
13
14
|
type ResponsivityDataItem = {
|
|
14
|
-
style
|
|
15
|
+
style?: CSSProperties & Record<`--${string}`, number | string>;
|
|
15
16
|
lastInLine?: boolean;
|
|
16
17
|
};
|
|
17
18
|
type ResponsivityData = {
|
|
@@ -21,6 +22,7 @@ type ResponsivityData = {
|
|
|
21
22
|
titleControls?: ResponsivityDataItem;
|
|
22
23
|
chips?: ResponsivityDataItem;
|
|
23
24
|
actions?: ResponsivityDataItem;
|
|
25
|
+
title?: ResponsivityDataItem;
|
|
24
26
|
linebreaks?: CSSProperties[];
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
@@ -32,21 +34,12 @@ type ResponsivityData = {
|
|
|
32
34
|
* 2. 2 lines:
|
|
33
35
|
* [logo] [title] [version] [asset chips] [actions]
|
|
34
36
|
* [title controls] [pad mode] [additional controls]
|
|
35
|
-
* 2
|
|
37
|
+
* and other variants that fit into 2 lines
|
|
38
|
+
* 3. 3 lines:
|
|
36
39
|
* [logo] [title] [version]
|
|
37
40
|
* [title controls] [additional controls] [actions]
|
|
38
41
|
* [pad mode] [chips]
|
|
39
|
-
*
|
|
40
|
-
* @param disabled
|
|
41
|
-
* @param actionsRef
|
|
42
|
-
* @param chipsRef
|
|
43
|
-
* @param logoRef
|
|
44
|
-
* @param rootRef
|
|
45
|
-
* @param titleControlsRef
|
|
46
|
-
* @param additionalControlsRef
|
|
47
|
-
* @param versionRef
|
|
48
|
-
* @param padModeRef
|
|
49
42
|
*/
|
|
50
|
-
export declare const useResponsivity: ({ disabled, actionsRef, chipsRef, logoRef, rootRef, titleControlsRef, additionalControlsRef, versionRef, padModeRef, }: Params) => ResponsivityData;
|
|
43
|
+
export declare const useResponsivity: ({ disabled, actionsRef, chipsRef, logoRef, rootRef, titleControlsRef, additionalControlsRef, versionRef, padModeRef, titleControlsLeft, }: Params) => ResponsivityData;
|
|
51
44
|
export {};
|
|
52
45
|
//# sourceMappingURL=useResponsivity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResponsivity.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/AppHeader/V3/useResponsivity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"useResponsivity.d.ts","sourceRoot":"","sources":["../../../../src/componentsV2/AppHeader/V3/useResponsivity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAK9E,KAAK,MAAM,GAAG;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC,qBAAqB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC9C,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC,QAAQ,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACjC,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAChC,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACpC,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,KAAK,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAE7B,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B,CAAC;AAoBF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,8IAWzB,MAAM,qBAiLR,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__assign as e,__spreadArray as r}from'./../../../ext-esm/tslib/tslib.es6.js';import{useState as t,useRef as o,useEffect as n}from"react";import{throttle as i,isEqual as s}from"lodash";import l from"./constants.scss.js";var d=parseInt(l.gap,10),a=parseInt(l.titleMinWidth,10)+d,c=function(e){var r;return(null===(r=e.current)||void 0===r?void 0:r.getBoundingClientRect().width)||0},v=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];var o=r.filter((function(e){return!!e.current&&e.current.offsetWidth>0}));return e+o.reduce((function(e,r){return e+c(r)}),0)+(o.length>1?(o.length-1)*d:0)},u=function(l){var c=l.disabled,u=l.actionsRef,y=l.chipsRef,f=l.logoRef,p=l.rootRef,h=l.titleControlsRef,V=l.additionalControlsRef,m=l.versionRef,b=l.padModeRef,C=l.titleControlsLeft,g=t({}),R=g[0],I=g[1],L=o(-1);return n((function(){var t=i((function(){requestAnimationFrame((function(){var t,o=(null===(t=p.current)||void 0===t?void 0:t.offsetWidth)||0,n=function(r){var t,n=C&&v(a,f,m,y,u,h,V,b)<=o?e(e({},r),{root:{style:e(e({},null===(t=r.root)||void 0===t?void 0:t.style),{"--headerV3-responsivity-flexwrap":"nowrap"})}}):r;I((function(e){return s(e,n)?e:n}))},i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(C){var o=v.apply(void 0,r([0],e,!1))+d;return{"--headerV3-responsivity-maxWidth":"calc(100% - ".concat(o,"px)")}}};v(a,f,m,y,u,h,V,b)<=o?n({title:{style:{"--headerV3-responsivity-marginRight":0}}}):v(a,f,m,y,u)<=o?n({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},padMode:{style:{"--headerV3-responsivity-order":120}},additionalControls:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:i(f,m,y,u)}}):!b.current&&v(a,f,m,y)<=o?n({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},title:{style:i(f,m,y)}}):v(a,f,m,y)<=o&&v(0,h,V,b,u)<=o?n({linebreaks:[{order:100}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},padMode:{style:{"--headerV3-responsivity-order":130}},actions:{style:{"--headerV3-responsivity-order":140},lastInLine:!0},title:{style:i(f,m,y)}}):n({linebreaks:[{order:100},{order:200}],titleControls:{style:{"--headerV3-responsivity-order":110}},additionalControls:{style:{"--headerV3-responsivity-order":120}},actions:{style:{"--headerV3-responsivity-order":130},lastInLine:!0},padMode:{style:{"--headerV3-responsivity-order":210}},chips:{style:{"--headerV3-responsivity-order":220},lastInLine:!0},title:{style:i(f,m)}})}))}),100,{leading:!0}),o=new ResizeObserver((function(){var e,r=(null===(e=p.current)||void 0===e?void 0:e.offsetWidth)||0;r!==L.current&&t(),L.current=r})),n=new MutationObserver(t);return p.current&&!c&&(o.observe(p.current),n.observe(p.current,{childList:!0,subtree:!0,characterData:!0}),t.cancel()),function(){o.disconnect(),n.disconnect()}}),[u,y,f,p,h,V,m,b,c,C]),R};export{u as useResponsivity};
|
|
2
2
|
//# sourceMappingURL=useResponsivity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA,4CAA4C,uCAA0C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignedURL.d.ts","sourceRoot":"","sources":["../../src/effects/useSignedURL.js"],"names":[],"mappings":";AAIA,
|
|
1
|
+
{"version":3,"file":"useSignedURL.d.ts","sourceRoot":"","sources":["../../src/effects/useSignedURL.js"],"names":[],"mappings":";AAIA,kFAiBC"}
|
package/effects/useSignedURL.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"@babel/runtime/helpers/slicedToArray";import{useState as t,useEffect as n}from"react";import{getS3DownloadLink as
|
|
1
|
+
import r from"@babel/runtime/helpers/slicedToArray";import{useState as t,useEffect as n}from"react";import{getS3DownloadLink as o}from"../clients/jsonApi/index.js";function e(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"attachment",c=t(""),a=r(c,2),f=a[0],l=a[1];return n((function(){e&&o(e,i).then((function(r){l(r.url)})).catch((function(r){console.error(r),l("")}))}),[e,i]),f}export{e as default};
|
|
2
2
|
//# sourceMappingURL=useSignedURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignedURL.js","sources":["../../src/effects/useSignedURL.js"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { getS3DownloadLink } from '~/clients/jsonApi';\n\nfunction useSignedURL(fileName) {\n const [signedURL, setSignedURL] = useState('');\n\n useEffect(() => {\n if (fileName)\n getS3DownloadLink(fileName)\n .then(response => setSignedURL(response.url))\n .catch(
|
|
1
|
+
{"version":3,"file":"useSignedURL.js","sources":["../../src/effects/useSignedURL.js"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { getS3DownloadLink } from '~/clients/jsonApi';\n\nfunction useSignedURL(fileName, contentDisposition = 'attachment') {\n const [signedURL, setSignedURL] = useState('');\n\n useEffect(() => {\n if (fileName) {\n getS3DownloadLink(fileName, contentDisposition)\n .then(response => {\n setSignedURL(response.url);\n })\n .catch(error => {\n console.error(error);\n setSignedURL('');\n });\n }\n }, [fileName, contentDisposition]);\n\n return signedURL;\n}\n\nexport default useSignedURL;\n"],"names":["useSignedURL","fileName","contentDisposition","useState","_useState2","_slicedToArray","_useState","signedURL","setSignedURL","useEffect","getS3DownloadLink","then","response","url","catch","error","console"],"mappings":"oKAIA,SAASA,EAAaC,GAA6C,IAAnCC,yDAAqB,aACjBC,EAAAA,EAAS,IAAGC,EAAAC,EAAAC,EAAA,GAAvCC,EAASH,EAAA,GAAEI,EAAYJ,EAAA,GAe9B,OAbAK,GAAU,WACJR,GACFS,EAAkBT,EAAUC,GACzBS,MAAK,SAAAC,GACJJ,EAAaI,EAASC,IACxB,IACCC,OAAM,SAAAC,GACLC,QAAQD,MAAMA,GACdP,EAAa,GACf,GAEN,GAAG,CAACP,EAAUC,IAEPK,CACT"}
|