@corva/ui 3.82.0-1 → 3.82.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("@babel/runtime/helpers/slicedToArray"),o=require("react"),n=require("@material-ui/core"),i=require("@material-ui/icons/AlternateEmail"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),r=require("../../componentsV2/Tooltip/Tooltip.js"),t=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.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/SearchOne.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/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.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/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.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("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var u=require("../Avatar/index.js"),a=require("../AttachFileButton/AttachFileButton.js"),l=require("../CommentInputNext/CommentInputNext.js"),m=require("../EmojiIconButton.js"),d=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),p=require("../UserMention/utils/index.js"),q=require("../WellhubFilePicker/WellhubFilePicker.js");require("@babel/runtime/helpers/toConsumableArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("../../clients/api/rateLimiter.js"),require("uuid");var h=require("./useAttachmentUpload.js"),I=require("./CommentMetaLine.js"),b=require("./ShareToChatRow.js"),g=require("./CommentComposer.scss.js"),f=require("react/jsx-runtime");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=C(e),F=C(s),x=C(i);function y(e,s){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);s&&(n=n.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),o.push.apply(o,n)}return o}function O(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?y(Object(o),!0).forEach((function(s){v.default(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):y(Object(o)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(o,s))}))}return e}var A={fontSize:14,lineHeight:"20px",suggestions:{backgroundColor:"var(--palette-background-b-9)",list:{backgroundColor:"var(--palette-background-b-9)"},item:{color:"var(--palette-primary-text-1)","&focused":{backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.08)"}}}},S=function(e){return f.jsxs("div",{className:g.suggestion,children:[f.jsx(u.AvatarComponent,{size:26,alt:e.display,imgSrc:e.photo,displayName:e.display}),f.jsx("span",{children:e.display})]})};exports.CommentComposer=function(e){var s=e.body,i=e.onBodyChange,u=e.onSubmit,C=e.canSubmit,v=e.currentUser,y=e.attachments,P=e.onAttachmentsChange,k=e.maxAttachments,E=void 0===k?h.DEFAULT_MAX_ATTACHMENTS:k,M=e.attachment,w=e.onAttachmentChange,D=e.attachmentError,R=e.onAttachmentError,T=e.maxAttachmentSizeBytes,U=e.wellhubContext,L=e.disabled,B=e.autoFocus,N=e.placeholder,z=void 0===N?"Add a comment...":N,W=e.metaRows,G=e.isMetaSingleLine,_=e.shareToChat,H=e.trailing,K=e.embedded,V=e.className,Q=e.testId,X=!!P,Z=o.useMemo((function(){return X?null!=y?y:[]:[M].filter(Boolean)}),[X,y,M]),$=o.useCallback((function(e){var s;P?P(e):null==w||w(null!==(s=e[0])&&void 0!==s?s:null)}),[P,w]),J=h.useAttachmentUpload({value:Z,onChange:$,onError:R,maxSizeBytes:T,maxFiles:X?E:1}),Y=C&&!J.isUploading,ee=o.useState(!1),se=F.default(ee,2),oe=se[0],ne=se[1],ie=o.useMemo((function(){return Z.map((function(e){return e.name}))}),[Z]),ce=o.useRef(null);return f.jsxs(f.Fragment,{children:[f.jsx(l.CommentInput,{value:s,canSubmit:Y,disabled:L,onSubmit:u,trailing:H,embedded:K,className:V,testId:Q,field:f.jsx(n.Input,{inputComponent:j,inputProps:{onChange:i,currentUser:v,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:S},highlightLinks:!0,style:A},value:s,placeholder:z,inputRef:ce,className:g.mentionField,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||Y&&!L&&(p.isSuggestionsListOpened()||(e.preventDefault(),u()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:B}),attachments:J.items,onAttachmentRemove:J.removeAttachment,onAttachmentRetry:J.handleRetry,onAttachmentReorder:X?J.reorderAttachments:void 0,onFilesDrop:J.addFiles,onImageLinkPaste:J.addLinkedImage,dropLabel:1===J.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:D?f.jsx(d,{errorMessage:D}):void 0,toolbar:f.jsxs(f.Fragment,{children:[f.jsx(a.AttachFileButton,{inputRef:J.fileInputRef,onClick:J.openFileDialog,onFileSelect:J.handleFileSelect,onWellhubSelect:U?function(){return ne(!0)}:void 0,multiple:X,disabled:J.isFull,tooltip:J.isFull?"Up to ".concat(J.maxFiles," ").concat(1===J.maxFiles?"file":"files"," can be attached"):"Attach ".concat(X?"files":"file")}),f.jsx(r.Tooltip,{title:"Mention someone",children:f.jsx(c.ButtonIcon,{size:"xs",type:"tertiary",onClick:function(){var e,s=ce.current;if(s){s.focus();var o=!!s.value&&!/\s$/.test(s.value),n="".concat(s.value).concat(o?" @":"@"),i=null===(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===e?void 0:e.set;null==i||i.call(s,n),s.setSelectionRange(n.length,n.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:f.jsx(x.default,{fontSize:"inherit"})})}),f.jsx("span",{className:g.iconSlot,children:f.jsx(m,{icon:f.jsx(t.SmilingFaceIcon,{size:16}),handleSelectEmoji:function(e){return i("".concat(s).concat(e.native))}})})]}),footer:(!(null==W||!W.length)||!!_)&&f.jsxs(f.Fragment,{children:[f.jsx(I.CommentMetaLine,{rows:null!=W?W:[],singleLine:G}),_&&f.jsx(b.ShareToChatRow,O({},_))]})}),U&&f.jsx(q.WellhubFilePicker,O(O({},U),{},{open:oe,maxSelectable:J.maxFiles-J.count,attachedFileNames:ie,onAdd:function(e){ne(!1),J.addStoredFiles(e.map((function(e){return{fileName:e.fileName}})))},onClose:function(){return ne(!1)}}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("@babel/runtime/helpers/slicedToArray"),o=require("react"),n=require("@material-ui/core"),i=require("@material-ui/icons/AlternateEmail"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),r=require("../../componentsV2/Tooltip/Tooltip.js"),t=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.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/SearchOne.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/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.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/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.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("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var u=require("../Avatar/index.js"),a=require("../AttachFileButton/AttachFileButton.js"),l=require("../CommentInputNext/CommentInputNext.js"),m=require("../EmojiIconButton.js"),d=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),p=require("../UserMention/utils/index.js"),q=require("../WellhubFilePicker/WellhubFilePicker.js");require("@babel/runtime/helpers/toConsumableArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment"),require("../../clients/jsonApi/index.js"),require("../../clients/subscriptions/subscriptions-client.factory.js"),require("../../clients/api/apiCore.js"),require("../../clients/constants.js"),require("../../clients/sso/auth0.js"),require("../../clients/sso/oauth2.js"),require("../../clients/api/rateLimiter.js"),require("uuid");var h=require("./useAttachmentUpload.js"),I=require("./CommentMetaLine.js"),b=require("./ShareToChatRow.js"),g=require("./CommentComposer.scss.js"),f=require("react/jsx-runtime");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=C(e),F=C(s),x=C(i);function y(e,s){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);s&&(n=n.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),o.push.apply(o,n)}return o}function O(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?y(Object(o),!0).forEach((function(s){v.default(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):y(Object(o)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(o,s))}))}return e}var A={fontSize:14,lineHeight:"20px",suggestions:{backgroundColor:"var(--palette-background-b-9)",list:{backgroundColor:"var(--palette-background-b-9)"},item:{color:"var(--palette-primary-text-1)","&focused":{backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.08)"}}}},S=function(e){return f.jsxs("div",{className:g.suggestion,children:[f.jsx(u.AvatarComponent,{size:26,alt:e.display,imgSrc:e.photo,displayName:e.display}),f.jsx("span",{children:e.display})]})};exports.CommentComposer=function(e){var s=e.body,i=e.onBodyChange,u=e.onSubmit,C=e.canSubmit,v=e.currentUser,y=e.attachments,P=e.onAttachmentsChange,k=e.maxAttachments,E=void 0===k?h.DEFAULT_MAX_ATTACHMENTS:k,M=e.attachment,w=e.onAttachmentChange,D=e.attachmentError,R=e.onAttachmentError,T=e.maxAttachmentSizeBytes,U=e.wellhubContext,L=e.disabled,B=e.autoFocus,N=e.placeholder,z=void 0===N?"Add a comment...":N,W=e.metaRows,G=e.isMetaSingleLine,_=e.shareToChat,H=e.trailing,K=e.renderTrailing,V=e.embedded,Q=e.className,X=e.testId,Z=!!P,$=o.useMemo((function(){return Z?null!=y?y:[]:[M].filter(Boolean)}),[Z,y,M]),J=o.useCallback((function(e){var s;P?P(e):null==w||w(null!==(s=e[0])&&void 0!==s?s:null)}),[P,w]),Y=h.useAttachmentUpload({value:$,onChange:J,onError:R,maxSizeBytes:T,maxFiles:Z?E:1}),ee=C&&!Y.isUploading,se=function(){ee&&!L&&u()},oe=o.useState(!1),ne=F.default(oe,2),ie=ne[0],ce=ne[1],re=o.useMemo((function(){return $.map((function(e){return e.name}))}),[$]),te=o.useRef(null);return f.jsxs(f.Fragment,{children:[f.jsx(l.CommentInput,{value:s,canSubmit:ee,disabled:L,onSubmit:u,trailing:K?K({canSend:ee&&!L,submit:se}):H,embedded:V,className:Q,testId:X,field:f.jsx(n.Input,{inputComponent:j,inputProps:{onChange:i,currentUser:v,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:S},highlightLinks:!0,style:A},value:s,placeholder:z,inputRef:te,className:g.mentionField,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||ee&&!L&&(p.isSuggestionsListOpened()||(e.preventDefault(),se()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:B}),attachments:Y.items,onAttachmentRemove:Y.removeAttachment,onAttachmentRetry:Y.handleRetry,onAttachmentReorder:Z?Y.reorderAttachments:void 0,onFilesDrop:Y.addFiles,onImageLinkPaste:Y.addLinkedImage,dropLabel:1===Y.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:D?f.jsx(d,{errorMessage:D}):void 0,toolbar:f.jsxs(f.Fragment,{children:[f.jsx(a.AttachFileButton,{inputRef:Y.fileInputRef,onClick:Y.openFileDialog,onFileSelect:Y.handleFileSelect,onWellhubSelect:U?function(){return ce(!0)}:void 0,multiple:Z,disabled:Y.isFull,tooltip:Y.isFull?"Up to ".concat(Y.maxFiles," ").concat(1===Y.maxFiles?"file":"files"," can be attached"):"Attach ".concat(Z?"files":"file")}),f.jsx(r.Tooltip,{title:"Mention someone",children:f.jsx(c.ButtonIcon,{size:"xs",type:"tertiary",onClick:function(){var e,s=te.current;if(s){s.focus();var o=!!s.value&&!/\s$/.test(s.value),n="".concat(s.value).concat(o?" @":"@"),i=null===(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===e?void 0:e.set;null==i||i.call(s,n),s.setSelectionRange(n.length,n.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:f.jsx(x.default,{fontSize:"inherit"})})}),f.jsx("span",{className:g.iconSlot,children:f.jsx(m,{icon:f.jsx(t.SmilingFaceIcon,{size:16}),handleSelectEmoji:function(e){return i("".concat(s).concat(e.native))}})})]}),footer:(!(null==W||!W.length)||!!_)&&f.jsxs(f.Fragment,{children:[f.jsx(I.CommentMetaLine,{rows:null!=W?W:[],singleLine:G}),_&&f.jsx(b.ShareToChatRow,O({},_))]})}),U&&f.jsx(q.WellhubFilePicker,O(O({},U),{},{open:ie,maxSelectable:Y.maxFiles-Y.count,attachedFileNames:re,onAdd:function(e){ce(!1),Y.addStoredFiles(e.map((function(e){return{fileName:e.fileName}})))},onClose:function(){return ce(!1)}}))]})};
2
2
  //# sourceMappingURL=CommentComposer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommentComposer.js","sources":["../../../../src/components/CommentComposer/CommentComposer.tsx"],"sourcesContent":["import {\n CSSProperties,\n FormEventHandler,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\nimport { WellhubFilePicker } from '../WellhubFilePicker';\nimport type { WellhubContext, WellhubFile } from '../WellhubFilePicker';\n\nimport {\n useAttachmentUpload,\n UploadedAttachment,\n DEFAULT_MAX_ATTACHMENTS,\n} from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachments?: UploadedAttachment[];\n onAttachmentsChange?: (attachments: UploadedAttachment[]) => void;\n maxAttachments?: number;\n /** @deprecated Use `attachments` — kept so single-attachment callers keep working. */\n attachment?: UploadedAttachment | null;\n /** @deprecated Use `onAttachmentsChange`. */\n onAttachmentChange?: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n wellhubContext?: WellhubContext;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachments,\n onAttachmentsChange,\n maxAttachments = DEFAULT_MAX_ATTACHMENTS,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n wellhubContext,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n // Callers still on the singular props get the old one-file behaviour, unchanged.\n const isMulti = !!onAttachmentsChange;\n const value = useMemo(\n () => (isMulti ? attachments ?? [] : ([attachment].filter(Boolean) as UploadedAttachment[])),\n [isMulti, attachments, attachment]\n );\n\n const handleAttachmentsChange = useCallback(\n (next: UploadedAttachment[]) => {\n if (onAttachmentsChange) onAttachmentsChange(next);\n else onAttachmentChange?.(next[0] ?? null);\n },\n [onAttachmentsChange, onAttachmentChange]\n );\n\n const upload = useAttachmentUpload({\n value,\n onChange: handleAttachmentsChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n maxFiles: isMulti ? maxAttachments : 1,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const [isWellhubOpen, setIsWellhubOpen] = useState(false);\n const attachedKeys = useMemo(() => value.map(item => item.name), [value]);\n\n const addWellhubFiles = (files: WellhubFile[]) => {\n setIsWellhubOpen(false);\n upload.addStoredFiles(files.map(file => ({ fileName: file.fileName })));\n };\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n onSubmit();\n };\n\n return (\n <>\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={trailing}\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n highlightLinks: true,\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={isMulti ? upload.reorderAttachments : undefined}\n onFilesDrop={upload.addFiles}\n onImageLinkPaste={upload.addLinkedImage}\n dropLabel={upload.maxFiles === 1 ? 'Drop a file here' : 'Drop files here'}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n onWellhubSelect={wellhubContext ? () => setIsWellhubOpen(true) : undefined}\n multiple={isMulti}\n disabled={upload.isFull}\n tooltip={\n upload.isFull\n ? `Up to ${upload.maxFiles} ${\n upload.maxFiles === 1 ? 'file' : 'files'\n } can be attached`\n : `Attach ${isMulti ? 'files' : 'file'}`\n }\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n\n {wellhubContext && (\n <WellhubFilePicker\n {...wellhubContext}\n open={isWellhubOpen}\n maxSelectable={upload.maxFiles - upload.count}\n attachedFileNames={attachedKeys}\n onAdd={addWellhubFiles}\n onClose={() => setIsWellhubOpen(false)}\n />\n )}\n </>\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","jsx","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachments","onAttachmentsChange","_ref$maxAttachments","maxAttachments","DEFAULT_MAX_ATTACHMENTS","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","wellhubContext","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","embedded","testId","isMulti","value","useMemo","filter","Boolean","handleAttachmentsChange","useCallback","next","_next$","upload","useAttachmentUpload","onChange","onError","maxSizeBytes","maxFiles","canSend","isUploading","useState","_useState2","_slicedToArray","_useState","isWellhubOpen","setIsWellhubOpen","attachedKeys","map","name","fieldRef","useRef","_Fragment","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","highlightLinks","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","undefined","onFilesDrop","addFiles","onImageLinkPaste","addLinkedImage","dropLabel","attachmentSlot","FailedFileUploading","errorMessage","toolbar","jsxs","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","onWellhubSelect","multiple","isFull","tooltip","concat","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread","WellhubFilePicker","open","maxSelectable","count","attachedFileNames","onAdd","files","addStoredFiles","file","fileName","onClose"],"mappings":"4oMAgFA,IAGMA,EAAsB,CAC1BC,SAAU,GACVC,WAAY,OACZC,YAAa,CACXC,gBAP2B,gCAQ3BC,KAAM,CAAED,gBARmB,iCAS3BE,KAAM,CACJC,MAAO,gCACP,WAAY,CAAEH,gBAAiB,2DAK/BI,EAAmB,SAACC,GAA0C,OAClEC,EAAAA,KAAA,MAAA,CAAKC,UAAWC,EAAOC,WAAWC,SAAA,CAChCC,MAACC,kBAAM,CAACC,KAAM,GAAIC,IAAKT,EAAMU,QAASC,OAAQX,EAAMY,MAAOC,YAAab,EAAMU,UAC9EJ,EAAAQ,IAAA,OAAA,CAAAT,SAAOL,EAAMU,YACT,0BAGuB,SAyBHK,GAAA,IAxB1BC,IAAAA,KACAC,IAAAA,aACAC,IAAAA,SACAC,IAAAA,UACAC,IAAAA,YACAC,IAAAA,YACAC,IAAAA,oBAAmBC,EAAAR,EACnBS,eAAAA,aAAiBC,EAAuBA,wBAAAF,EACxCG,IAAAA,WACAC,IAAAA,mBACAC,IAAAA,gBACAC,IAAAA,kBACAC,IAAAA,uBACAC,IAAAA,eACAC,IAAAA,SACAC,IAAAA,UAASC,EAAAnB,EACToB,YAAAA,aAAc,mBAAkBD,EAChCE,IAAAA,SACAC,IAAAA,iBACAC,IAAAA,YACAC,IAAAA,SACAC,IAAAA,SACAtC,IAAAA,UACAuC,IAAAA,OAGMC,IAAYpB,EACZqB,EAAQC,EAAAA,SACZ,WAAA,OAAOF,EAAUrB,QAAAA,EAAe,GAAM,CAACK,GAAYmB,OAAOC,QAAkC,GAC5F,CAACJ,EAASrB,EAAaK,IAGnBqB,EAA0BC,eAC9B,SAACC,GAA+B,IAAAC,EAC1B5B,EAAqBA,EAAoB2B,GACxCtB,SAAAA,EAA4B,UAAPsB,EAAK,UAA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C,EAAOiJ,SAAS/I,SAC/BC,MAAC+I,EAAe,CACdC,KAAMhJ,MAACiJ,kBAAe,CAAC/I,KAAM,KAC7BgJ,kBAAmB,SAACC,GAAyB,OAC3CxI,EAAgBD,GAAAA,OAAAA,UAAOyI,EAAMC,QAAS,SAMhDC,UACKvH,UAAAA,EAAU2G,WAAYzG,IACvBrC,EAAAA,KAAAqE,EAAAA,SAAA,CAAAjE,SAAA,CACEC,MAACsJ,kBAAe,CAAC9D,KAAM1D,QAAAA,EAAY,GAAIyH,WAAYxH,IAClDC,GAAehC,MAACwJ,EAAAA,eAAcC,EAAA,CAAA,EAAKzH,SAM3CP,GACCzB,EAACQ,IAAAkJ,2BACKjI,GAAc,GAAA,CAClBkI,KAAMlG,GACNmG,cAAe/G,EAAOK,SAAWL,EAAOgH,MACxCC,kBAAmBnG,GACnBoG,MAhIgB,SAACC,GACvBtG,IAAiB,GACjBb,EAAOoH,eAAeD,EAAMpG,KAAI,SAAAsG,GAAI,MAAK,CAAEC,SAAUD,EAAKC,SAAW,MA+H/DC,QAAS,WAAA,OAAM1G,IAAiB,EAAM,OAKhD"}
1
+ {"version":3,"file":"CommentComposer.js","sources":["../../../../src/components/CommentComposer/CommentComposer.tsx"],"sourcesContent":["import {\n CSSProperties,\n FormEventHandler,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\nimport { WellhubFilePicker } from '../WellhubFilePicker';\nimport type { WellhubContext, WellhubFile } from '../WellhubFilePicker';\n\nimport {\n useAttachmentUpload,\n UploadedAttachment,\n DEFAULT_MAX_ATTACHMENTS,\n} from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerTrailingState = {\n canSend: boolean;\n submit: () => void;\n};\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachments?: UploadedAttachment[];\n onAttachmentsChange?: (attachments: UploadedAttachment[]) => void;\n maxAttachments?: number;\n /** @deprecated Use `attachments` — kept so single-attachment callers keep working. */\n attachment?: UploadedAttachment | null;\n /** @deprecated Use `onAttachmentsChange`. */\n onAttachmentChange?: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n wellhubContext?: WellhubContext;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Like `trailing`, but receives the upload-aware send state for a custom Save. */\n renderTrailing?: (state: CommentComposerTrailingState) => ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachments,\n onAttachmentsChange,\n maxAttachments = DEFAULT_MAX_ATTACHMENTS,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n wellhubContext,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n renderTrailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n // Callers still on the singular props get the old one-file behaviour, unchanged.\n const isMulti = !!onAttachmentsChange;\n const value = useMemo(\n () => (isMulti ? attachments ?? [] : ([attachment].filter(Boolean) as UploadedAttachment[])),\n [isMulti, attachments, attachment]\n );\n\n const handleAttachmentsChange = useCallback(\n (next: UploadedAttachment[]) => {\n if (onAttachmentsChange) onAttachmentsChange(next);\n else onAttachmentChange?.(next[0] ?? null);\n },\n [onAttachmentsChange, onAttachmentChange]\n );\n\n const upload = useAttachmentUpload({\n value,\n onChange: handleAttachmentsChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n maxFiles: isMulti ? maxAttachments : 1,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const submit = () => {\n if (!canSend || disabled) return;\n\n onSubmit();\n };\n\n const [isWellhubOpen, setIsWellhubOpen] = useState(false);\n const attachedKeys = useMemo(() => value.map(item => item.name), [value]);\n\n const addWellhubFiles = (files: WellhubFile[]) => {\n setIsWellhubOpen(false);\n upload.addStoredFiles(files.map(file => ({ fileName: file.fileName })));\n };\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n submit();\n };\n\n return (\n <>\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={\n renderTrailing ? renderTrailing({ canSend: canSend && !disabled, submit }) : trailing\n }\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n highlightLinks: true,\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={isMulti ? upload.reorderAttachments : undefined}\n onFilesDrop={upload.addFiles}\n onImageLinkPaste={upload.addLinkedImage}\n dropLabel={upload.maxFiles === 1 ? 'Drop a file here' : 'Drop files here'}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n onWellhubSelect={wellhubContext ? () => setIsWellhubOpen(true) : undefined}\n multiple={isMulti}\n disabled={upload.isFull}\n tooltip={\n upload.isFull\n ? `Up to ${upload.maxFiles} ${\n upload.maxFiles === 1 ? 'file' : 'files'\n } can be attached`\n : `Attach ${isMulti ? 'files' : 'file'}`\n }\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n\n {wellhubContext && (\n <WellhubFilePicker\n {...wellhubContext}\n open={isWellhubOpen}\n maxSelectable={upload.maxFiles - upload.count}\n attachedFileNames={attachedKeys}\n onAdd={addWellhubFiles}\n onClose={() => setIsWellhubOpen(false)}\n />\n )}\n </>\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","jsx","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachments","onAttachmentsChange","_ref$maxAttachments","maxAttachments","DEFAULT_MAX_ATTACHMENTS","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","wellhubContext","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","renderTrailing","embedded","testId","isMulti","value","useMemo","filter","Boolean","handleAttachmentsChange","useCallback","next","_next$","upload","useAttachmentUpload","onChange","onError","maxSizeBytes","maxFiles","canSend","isUploading","submit","useState","_useState2","_slicedToArray","_useState","isWellhubOpen","setIsWellhubOpen","attachedKeys","map","name","fieldRef","useRef","_Fragment","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","highlightLinks","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","undefined","onFilesDrop","addFiles","onImageLinkPaste","addLinkedImage","dropLabel","attachmentSlot","FailedFileUploading","errorMessage","toolbar","jsxs","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","onWellhubSelect","multiple","isFull","tooltip","concat","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread","WellhubFilePicker","open","maxSelectable","count","attachedFileNames","onAdd","files","addStoredFiles","file","fileName","onClose"],"mappings":"4oMAuFA,IAGMA,EAAsB,CAC1BC,SAAU,GACVC,WAAY,OACZC,YAAa,CACXC,gBAP2B,gCAQ3BC,KAAM,CAAED,gBARmB,iCA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,GAAAA,OAAAA,UAAO2I,EAAMC,QAAS,SAMhDC,UACKzH,UAAAA,EAAU6G,WAAY3G,IACvBrC,EAAAA,KAAAuE,EAAAA,SAAA,CAAAnE,SAAA,CACEC,MAACwJ,kBAAe,CAAC9D,KAAM5D,QAAAA,EAAY,GAAI2H,WAAY1H,IAClDC,GAAehC,MAAC0J,EAAAA,eAAcC,EAAA,CAAA,EAAK3H,SAM3CP,GACCzB,EAACQ,IAAAoJ,2BACKnI,GAAc,GAAA,CAClBoI,KAAMlG,GACNmG,cAAehH,EAAOK,SAAWL,EAAOiH,MACxCC,kBAAmBnG,GACnBoG,MAlIgB,SAACC,GACvBtG,IAAiB,GACjBd,EAAOqH,eAAeD,EAAMpG,KAAI,SAAAsG,GAAI,MAAK,CAAEC,SAAUD,EAAKC,SAAW,MAiI/DC,QAAS,WAAA,OAAM1G,IAAiB,EAAM,OAKhD"}
@@ -1,2 +1,2 @@
1
- "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentInputNext_root__5uxKl{overflow-clip-margin:12px;background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;overflow:clip;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{--attachment-arrow-outset:8px;align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{flex:1 0 0;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}"),module.exports={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};
1
+ "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentInputNext_root__5uxKl{overflow-clip-margin:12px;background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;overflow:clip;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{--attachment-arrow-outset:8px;align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{align-self:stretch;flex:1 0 0;justify-content:center;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}"),module.exports={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};
2
2
  //# sourceMappingURL=CommentInputNext.scss.js.map
@@ -11,6 +11,10 @@ export type CommentComposerUser = {
11
11
  profile_photo?: string;
12
12
  [key: string]: unknown;
13
13
  };
14
+ export type CommentComposerTrailingState = {
15
+ canSend: boolean;
16
+ submit: () => void;
17
+ };
14
18
  export type CommentComposerProps = {
15
19
  body: string;
16
20
  onBodyChange: (value: string) => void;
@@ -36,10 +40,12 @@ export type CommentComposerProps = {
36
40
  shareToChat?: Omit<ShareToChatRowProps, 'testId'>;
37
41
  /** Replaces the default send button, e.g. the edit form's Cancel/Save. */
38
42
  trailing?: ReactNode;
43
+ /** Like `trailing`, but receives the upload-aware send state for a custom Save. */
44
+ renderTrailing?: (state: CommentComposerTrailingState) => ReactNode;
39
45
  /** Render flush inside a host card instead of as its own surface. */
40
46
  embedded?: boolean;
41
47
  className?: string;
42
48
  testId?: string;
43
49
  };
44
- export declare const CommentComposer: ({ body, onBodyChange, onSubmit, canSubmit, currentUser, attachments, onAttachmentsChange, maxAttachments, attachment, onAttachmentChange, attachmentError, onAttachmentError, maxAttachmentSizeBytes, wellhubContext, disabled, autoFocus, placeholder, metaRows, isMetaSingleLine, shareToChat, trailing, embedded, className, testId, }: CommentComposerProps) => import("react/jsx-runtime").JSX.Element;
50
+ export declare const CommentComposer: ({ body, onBodyChange, onSubmit, canSubmit, currentUser, attachments, onAttachmentsChange, maxAttachments, attachment, onAttachmentChange, attachmentError, onAttachmentError, maxAttachmentSizeBytes, wellhubContext, disabled, autoFocus, placeholder, metaRows, isMetaSingleLine, shareToChat, trailing, renderTrailing, embedded, className, testId, }: CommentComposerProps) => import("react/jsx-runtime").JSX.Element;
45
51
  //# sourceMappingURL=CommentComposer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommentComposer.d.ts","sourceRoot":"","sources":["../../../src/components/CommentComposer/CommentComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAKV,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,sBAAsB,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C,EAAE,MAAM,CAAC;CACjB,CAAC;AAyBF,eAAO,MAAM,eAAe,8VA0BzB,oBAAoB,4CA4KtB,CAAC"}
@@ -1,2 +1,2 @@
1
- import o from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/helpers/slicedToArray";import{useMemo as n,useCallback as t,useState as i,useRef as c}from"react";import{Input as e}from"@material-ui/core";import r from"@material-ui/icons/AlternateEmail";import{ButtonIcon as m}from"../../componentsV2/ButtonIcon/ButtonIcon.js";import{Tooltip as a}from"../../componentsV2/Tooltip/Tooltip.js";import{SmilingFaceIcon as l}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.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/SearchOne.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/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.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/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.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"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import{AvatarComponent as p}from"../Avatar/index.js";import{AttachFileButton as u}from"../AttachFileButton/AttachFileButton.js";import{CommentInput as d}from"../CommentInputNext/CommentInputNext.js";import j from"../EmojiIconButton.js";import h from"../FailedFileUploading.js";import I from"../UserMention/index.js";import{isSuggestionsListOpened as b}from"../UserMention/utils/index.js";import{WellhubFilePicker as f}from"../WellhubFilePicker/WellhubFilePicker.js";import"@babel/runtime/helpers/toConsumableArray";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions/subscriptions-client.factory.js";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"../../clients/api/rateLimiter.js";import"uuid";import{useAttachmentUpload as g,DEFAULT_MAX_ATTACHMENTS as C}from"./useAttachmentUpload.js";import{CommentMetaLine as v}from"./CommentMetaLine.js";import{ShareToChatRow as y}from"./ShareToChatRow.js";import F from"./CommentComposer.scss.js";import{jsxs as O,Fragment as A,jsx as S}from"react/jsx-runtime";function P(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,t)}return n}function x(s){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?P(Object(t),!0).forEach((function(n){o(s,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):P(Object(t)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(t,o))}))}return s}var k={fontSize:14,lineHeight:"20px",suggestions:{backgroundColor:"var(--palette-background-b-9)",list:{backgroundColor:"var(--palette-background-b-9)"},item:{color:"var(--palette-primary-text-1)","&focused":{backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.08)"}}}},E=function(o){return O("div",{className:F.suggestion,children:[S(p,{size:26,alt:o.display,imgSrc:o.photo,displayName:o.display}),S("span",{children:o.display})]})},w=function(o){var p=o.body,P=o.onBodyChange,w=o.onSubmit,D=o.canSubmit,R=o.currentUser,M=o.attachments,U=o.onAttachmentsChange,N=o.maxAttachments,B=void 0===N?C:N,L=o.attachment,T=o.onAttachmentChange,z=o.attachmentError,W=o.onAttachmentError,G=o.maxAttachmentSizeBytes,q=o.wellhubContext,K=o.disabled,H=o.autoFocus,V=o.placeholder,Q=void 0===V?"Add a comment...":V,Z=o.metaRows,$=o.isMetaSingleLine,J=o.shareToChat,X=o.trailing,Y=o.embedded,_=o.className,oo=o.testId,so=!!U,no=n((function(){return so?null!=M?M:[]:[L].filter(Boolean)}),[so,M,L]),to=t((function(o){var s;U?U(o):null==T||T(null!==(s=o[0])&&void 0!==s?s:null)}),[U,T]),io=g({value:no,onChange:to,onError:W,maxSizeBytes:G,maxFiles:so?B:1}),co=D&&!io.isUploading,eo=i(!1),ro=s(eo,2),mo=ro[0],ao=ro[1],lo=n((function(){return no.map((function(o){return o.name}))}),[no]),po=c(null);return O(A,{children:[S(d,{value:p,canSubmit:co,disabled:K,onSubmit:w,trailing:X,embedded:Y,className:_,testId:oo,field:S(e,{inputComponent:I,inputProps:{onChange:P,currentUser:R,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:E},highlightLinks:!0,style:k},value:p,placeholder:Q,inputRef:po,className:F.mentionField,onKeyDown:function(o){"Enter"!==o.key||o.shiftKey||co&&!K&&(b()||(o.preventDefault(),w()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:H}),attachments:io.items,onAttachmentRemove:io.removeAttachment,onAttachmentRetry:io.handleRetry,onAttachmentReorder:so?io.reorderAttachments:void 0,onFilesDrop:io.addFiles,onImageLinkPaste:io.addLinkedImage,dropLabel:1===io.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:z?S(h,{errorMessage:z}):void 0,toolbar:O(A,{children:[S(u,{inputRef:io.fileInputRef,onClick:io.openFileDialog,onFileSelect:io.handleFileSelect,onWellhubSelect:q?function(){return ao(!0)}:void 0,multiple:so,disabled:io.isFull,tooltip:io.isFull?"Up to ".concat(io.maxFiles," ").concat(1===io.maxFiles?"file":"files"," can be attached"):"Attach ".concat(so?"files":"file")}),S(a,{title:"Mention someone",children:S(m,{size:"xs",type:"tertiary",onClick:function(){var o,s=po.current;if(s){s.focus();var n=!!s.value&&!/\s$/.test(s.value),t="".concat(s.value).concat(n?" @":"@"),i=null===(o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===o?void 0:o.set;null==i||i.call(s,t),s.setSelectionRange(t.length,t.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:S(r,{fontSize:"inherit"})})}),S("span",{className:F.iconSlot,children:S(j,{icon:S(l,{size:16}),handleSelectEmoji:function(o){return P("".concat(p).concat(o.native))}})})]}),footer:(!(null==Z||!Z.length)||!!J)&&O(A,{children:[S(v,{rows:null!=Z?Z:[],singleLine:$}),J&&S(y,x({},J))]})}),q&&S(f,x(x({},q),{},{open:mo,maxSelectable:io.maxFiles-io.count,attachedFileNames:lo,onAdd:function(o){ao(!1),io.addStoredFiles(o.map((function(o){return{fileName:o.fileName}})))},onClose:function(){return ao(!1)}}))]})};export{w as CommentComposer};
1
+ import o from"@babel/runtime/helpers/defineProperty";import s from"@babel/runtime/helpers/slicedToArray";import{useMemo as n,useCallback as t,useState as i,useRef as c}from"react";import{Input as e}from"@material-ui/core";import r from"@material-ui/icons/AlternateEmail";import{ButtonIcon as m}from"../../componentsV2/ButtonIcon/ButtonIcon.js";import{Tooltip as a}from"../../componentsV2/Tooltip/Tooltip.js";import{SmilingFaceIcon as l}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/DragOne.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/SearchOne.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/InfoRounded.js";import"../../icons/customIcons/icons/FlameFilled.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/PinOne.js";import"../../icons/customIcons/icons/PinOneCrossed.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"../../icons/customIcons/icons/CloudDelete.js";import"../../icons/customIcons/icons/Lasso.js";import"../../icons/customIcons/icons/Radius.js";import"../../icons/customIcons/icons/ErrorOps.js";import"../../icons/customIcons/icons/DataTypeOps.js";import"../../icons/customIcons/icons/FalsePositiveOps.js";import"../../icons/customIcons/icons/CalibrationOps.js";import"../../icons/customIcons/icons/CriticalOps.js";import"../../icons/customIcons/icons/Company.js";import"../../icons/customIcons/icons/ArchiveOne.js";import"../../icons/customIcons/icons/ParseBotFusion.js";import"../../icons/customIcons/icons/Connect.js";import"../../icons/customIcons/icons/PuzzleOne.js";import"../../icons/customIcons/icons/Feed.js";import"../../icons/customIcons/icons/Prompt.js";import"../../icons/customIcons/icons/Companies.js";import"../../icons/customIcons/icons/ClipboardAi.js";import"../../icons/customIcons/icons/Key.js";import"../../icons/customIcons/icons/AtSignCrossed.js";import"../../icons/customIcons/icons/MappingManual.js";import"../../icons/customIcons/icons/Mapping.js";import"../../icons/customIcons/icons/Metrics.js";import"../../icons/customIcons/icons/Drops.js";import"../../icons/customIcons/icons/ClipboardSearch.js";import"../../icons/customIcons/icons/Template.js";import"../../icons/customIcons/icons/ClipboardMetrics.js";import"../../icons/customIcons/icons/ClipboardBuilder.js";import"../../icons/customIcons/icons/UnitConversion.js";import"../../icons/customIcons/icons/NPT.js";import"../../icons/customIcons/icons/GuidedFrac.js";import{AvatarComponent as p}from"../Avatar/index.js";import{AttachFileButton as u}from"../AttachFileButton/AttachFileButton.js";import{CommentInput as d}from"../CommentInputNext/CommentInputNext.js";import j from"../EmojiIconButton.js";import h from"../FailedFileUploading.js";import I from"../UserMention/index.js";import{isSuggestionsListOpened as b}from"../UserMention/utils/index.js";import{WellhubFilePicker as f}from"../WellhubFilePicker/WellhubFilePicker.js";import"@babel/runtime/helpers/toConsumableArray";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import"../../clients/jsonApi/index.js";import"../../clients/subscriptions/subscriptions-client.factory.js";import"../../clients/api/apiCore.js";import"../../clients/constants.js";import"../../clients/sso/auth0.js";import"../../clients/sso/oauth2.js";import"../../clients/api/rateLimiter.js";import"uuid";import{useAttachmentUpload as g,DEFAULT_MAX_ATTACHMENTS as C}from"./useAttachmentUpload.js";import{CommentMetaLine as v}from"./CommentMetaLine.js";import{ShareToChatRow as y}from"./ShareToChatRow.js";import F from"./CommentComposer.scss.js";import{jsxs as O,Fragment as A,jsx as S}from"react/jsx-runtime";function P(o,s){var n=Object.keys(o);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(o);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable}))),n.push.apply(n,t)}return n}function x(s){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?P(Object(t),!0).forEach((function(n){o(s,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):P(Object(t)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(t,o))}))}return s}var k={fontSize:14,lineHeight:"20px",suggestions:{backgroundColor:"var(--palette-background-b-9)",list:{backgroundColor:"var(--palette-background-b-9)"},item:{color:"var(--palette-primary-text-1)","&focused":{backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.08)"}}}},E=function(o){return O("div",{className:F.suggestion,children:[S(p,{size:26,alt:o.display,imgSrc:o.photo,displayName:o.display}),S("span",{children:o.display})]})},w=function(o){var p=o.body,P=o.onBodyChange,w=o.onSubmit,D=o.canSubmit,R=o.currentUser,M=o.attachments,U=o.onAttachmentsChange,N=o.maxAttachments,B=void 0===N?C:N,L=o.attachment,T=o.onAttachmentChange,z=o.attachmentError,W=o.onAttachmentError,G=o.maxAttachmentSizeBytes,q=o.wellhubContext,K=o.disabled,H=o.autoFocus,V=o.placeholder,Q=void 0===V?"Add a comment...":V,Z=o.metaRows,$=o.isMetaSingleLine,J=o.shareToChat,X=o.trailing,Y=o.renderTrailing,_=o.embedded,oo=o.className,so=o.testId,no=!!U,to=n((function(){return no?null!=M?M:[]:[L].filter(Boolean)}),[no,M,L]),io=t((function(o){var s;U?U(o):null==T||T(null!==(s=o[0])&&void 0!==s?s:null)}),[U,T]),co=g({value:to,onChange:io,onError:W,maxSizeBytes:G,maxFiles:no?B:1}),eo=D&&!co.isUploading,ro=function(){eo&&!K&&w()},mo=i(!1),ao=s(mo,2),lo=ao[0],po=ao[1],uo=n((function(){return to.map((function(o){return o.name}))}),[to]),jo=c(null);return O(A,{children:[S(d,{value:p,canSubmit:eo,disabled:K,onSubmit:w,trailing:Y?Y({canSend:eo&&!K,submit:ro}):X,embedded:_,className:oo,testId:so,field:S(e,{inputComponent:I,inputProps:{onChange:P,currentUser:R,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:E},highlightLinks:!0,style:k},value:p,placeholder:Q,inputRef:jo,className:F.mentionField,onKeyDown:function(o){"Enter"!==o.key||o.shiftKey||eo&&!K&&(b()||(o.preventDefault(),ro()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:H}),attachments:co.items,onAttachmentRemove:co.removeAttachment,onAttachmentRetry:co.handleRetry,onAttachmentReorder:no?co.reorderAttachments:void 0,onFilesDrop:co.addFiles,onImageLinkPaste:co.addLinkedImage,dropLabel:1===co.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:z?S(h,{errorMessage:z}):void 0,toolbar:O(A,{children:[S(u,{inputRef:co.fileInputRef,onClick:co.openFileDialog,onFileSelect:co.handleFileSelect,onWellhubSelect:q?function(){return po(!0)}:void 0,multiple:no,disabled:co.isFull,tooltip:co.isFull?"Up to ".concat(co.maxFiles," ").concat(1===co.maxFiles?"file":"files"," can be attached"):"Attach ".concat(no?"files":"file")}),S(a,{title:"Mention someone",children:S(m,{size:"xs",type:"tertiary",onClick:function(){var o,s=jo.current;if(s){s.focus();var n=!!s.value&&!/\s$/.test(s.value),t="".concat(s.value).concat(n?" @":"@"),i=null===(o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===o?void 0:o.set;null==i||i.call(s,t),s.setSelectionRange(t.length,t.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:S(r,{fontSize:"inherit"})})}),S("span",{className:F.iconSlot,children:S(j,{icon:S(l,{size:16}),handleSelectEmoji:function(o){return P("".concat(p).concat(o.native))}})})]}),footer:(!(null==Z||!Z.length)||!!J)&&O(A,{children:[S(v,{rows:null!=Z?Z:[],singleLine:$}),J&&S(y,x({},J))]})}),q&&S(f,x(x({},q),{},{open:lo,maxSelectable:co.maxFiles-co.count,attachedFileNames:uo,onAdd:function(o){po(!1),co.addStoredFiles(o.map((function(o){return{fileName:o.fileName}})))},onClose:function(){return po(!1)}}))]})};export{w as CommentComposer};
2
2
  //# sourceMappingURL=CommentComposer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommentComposer.js","sources":["../../../src/components/CommentComposer/CommentComposer.tsx"],"sourcesContent":["import {\n CSSProperties,\n FormEventHandler,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\nimport { WellhubFilePicker } from '../WellhubFilePicker';\nimport type { WellhubContext, WellhubFile } from '../WellhubFilePicker';\n\nimport {\n useAttachmentUpload,\n UploadedAttachment,\n DEFAULT_MAX_ATTACHMENTS,\n} from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachments?: UploadedAttachment[];\n onAttachmentsChange?: (attachments: UploadedAttachment[]) => void;\n maxAttachments?: number;\n /** @deprecated Use `attachments` — kept so single-attachment callers keep working. */\n attachment?: UploadedAttachment | null;\n /** @deprecated Use `onAttachmentsChange`. */\n onAttachmentChange?: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n wellhubContext?: WellhubContext;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachments,\n onAttachmentsChange,\n maxAttachments = DEFAULT_MAX_ATTACHMENTS,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n wellhubContext,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n // Callers still on the singular props get the old one-file behaviour, unchanged.\n const isMulti = !!onAttachmentsChange;\n const value = useMemo(\n () => (isMulti ? attachments ?? [] : ([attachment].filter(Boolean) as UploadedAttachment[])),\n [isMulti, attachments, attachment]\n );\n\n const handleAttachmentsChange = useCallback(\n (next: UploadedAttachment[]) => {\n if (onAttachmentsChange) onAttachmentsChange(next);\n else onAttachmentChange?.(next[0] ?? null);\n },\n [onAttachmentsChange, onAttachmentChange]\n );\n\n const upload = useAttachmentUpload({\n value,\n onChange: handleAttachmentsChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n maxFiles: isMulti ? maxAttachments : 1,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const [isWellhubOpen, setIsWellhubOpen] = useState(false);\n const attachedKeys = useMemo(() => value.map(item => item.name), [value]);\n\n const addWellhubFiles = (files: WellhubFile[]) => {\n setIsWellhubOpen(false);\n upload.addStoredFiles(files.map(file => ({ fileName: file.fileName })));\n };\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n onSubmit();\n };\n\n return (\n <>\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={trailing}\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n highlightLinks: true,\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={isMulti ? upload.reorderAttachments : undefined}\n onFilesDrop={upload.addFiles}\n onImageLinkPaste={upload.addLinkedImage}\n dropLabel={upload.maxFiles === 1 ? 'Drop a file here' : 'Drop files here'}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n onWellhubSelect={wellhubContext ? () => setIsWellhubOpen(true) : undefined}\n multiple={isMulti}\n disabled={upload.isFull}\n tooltip={\n upload.isFull\n ? `Up to ${upload.maxFiles} ${\n upload.maxFiles === 1 ? 'file' : 'files'\n } can be attached`\n : `Attach ${isMulti ? 'files' : 'file'}`\n }\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n\n {wellhubContext && (\n <WellhubFilePicker\n {...wellhubContext}\n open={isWellhubOpen}\n maxSelectable={upload.maxFiles - upload.count}\n attachedFileNames={attachedKeys}\n onAdd={addWellhubFiles}\n onClose={() => setIsWellhubOpen(false)}\n />\n )}\n </>\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","CommentComposer","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachments","onAttachmentsChange","_ref$maxAttachments","maxAttachments","DEFAULT_MAX_ATTACHMENTS","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","wellhubContext","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","embedded","testId","isMulti","value","useMemo","filter","Boolean","handleAttachmentsChange","useCallback","next","_next$","upload","useAttachmentUpload","onChange","onError","maxSizeBytes","maxFiles","canSend","isUploading","useState","_useState2","_slicedToArray","_useState","isWellhubOpen","setIsWellhubOpen","attachedKeys","map","name","fieldRef","useRef","_Fragment","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","highlightLinks","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","undefined","onFilesDrop","addFiles","onImageLinkPaste","addLinkedImage","dropLabel","attachmentSlot","FailedFileUploading","errorMessage","toolbar","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","onWellhubSelect","multiple","isFull","tooltip","concat","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread","WellhubFilePicker","open","maxSelectable","count","attachedFileNames","onAdd","files","addStoredFiles","file","fileName","onClose"],"mappings":"yjMAgFA,IAGMA,EAAsB,CAC1BC,SAAU,GACVC,WAAY,OACZC,YAAa,CACXC,gBAP2B,gCAQ3BC,KAAM,CAAED,gBARmB,iCAS3BE,KAAM,CACJC,MAAO,gCACP,WAAY,CAAEH,gBAAiB,2DAK/BI,EAAmB,SAACC,GAA0C,OAClEC,EAAA,MAAA,CAAKC,UAAWC,EAAOC,WAAWC,SAAA,CAChCC,EAACC,EAAM,CAACC,KAAM,GAAIC,IAAKT,EAAMU,QAASC,OAAQX,EAAMY,MAAOC,YAAab,EAAMU,UAC9EJ,EAAA,OAAA,CAAAD,SAAOL,EAAMU,YACT,EAGKI,EAAkB,SAyBHC,GAAA,IAxB1BC,IAAAA,KACAC,IAAAA,aACAC,IAAAA,SACAC,I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sx"],"sourcesContent":["import {\n CSSProperties,\n FormEventHandler,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\nimport { WellhubFilePicker } from '../WellhubFilePicker';\nimport type { WellhubContext, WellhubFile } from '../WellhubFilePicker';\n\nimport {\n useAttachmentUpload,\n UploadedAttachment,\n DEFAULT_MAX_ATTACHMENTS,\n} from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerTrailingState = {\n canSend: boolean;\n submit: () => void;\n};\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachments?: UploadedAttachment[];\n onAttachmentsChange?: (attachments: UploadedAttachment[]) => void;\n maxAttachments?: number;\n /** @deprecated Use `attachments` — kept so single-attachment callers keep working. */\n attachment?: UploadedAttachment | null;\n /** @deprecated Use `onAttachmentsChange`. */\n onAttachmentChange?: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n wellhubContext?: WellhubContext;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Like `trailing`, but receives the upload-aware send state for a custom Save. */\n renderTrailing?: (state: CommentComposerTrailingState) => ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachments,\n onAttachmentsChange,\n maxAttachments = DEFAULT_MAX_ATTACHMENTS,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n wellhubContext,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n renderTrailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n // Callers still on the singular props get the old one-file behaviour, unchanged.\n const isMulti = !!onAttachmentsChange;\n const value = useMemo(\n () => (isMulti ? attachments ?? [] : ([attachment].filter(Boolean) as UploadedAttachment[])),\n [isMulti, attachments, attachment]\n );\n\n const handleAttachmentsChange = useCallback(\n (next: UploadedAttachment[]) => {\n if (onAttachmentsChange) onAttachmentsChange(next);\n else onAttachmentChange?.(next[0] ?? null);\n },\n [onAttachmentsChange, onAttachmentChange]\n );\n\n const upload = useAttachmentUpload({\n value,\n onChange: handleAttachmentsChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n maxFiles: isMulti ? maxAttachments : 1,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const submit = () => {\n if (!canSend || disabled) return;\n\n onSubmit();\n };\n\n const [isWellhubOpen, setIsWellhubOpen] = useState(false);\n const attachedKeys = useMemo(() => value.map(item => item.name), [value]);\n\n const addWellhubFiles = (files: WellhubFile[]) => {\n setIsWellhubOpen(false);\n upload.addStoredFiles(files.map(file => ({ fileName: file.fileName })));\n };\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n submit();\n };\n\n return (\n <>\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={\n renderTrailing ? renderTrailing({ canSend: canSend && !disabled, submit }) : trailing\n }\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n highlightLinks: true,\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={isMulti ? upload.reorderAttachments : undefined}\n onFilesDrop={upload.addFiles}\n onImageLinkPaste={upload.addLinkedImage}\n dropLabel={upload.maxFiles === 1 ? 'Drop a file here' : 'Drop files here'}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n onWellhubSelect={wellhubContext ? () => setIsWellhubOpen(true) : undefined}\n multiple={isMulti}\n disabled={upload.isFull}\n tooltip={\n upload.isFull\n ? `Up to ${upload.maxFiles} ${\n upload.maxFiles === 1 ? 'file' : 'files'\n } can be attached`\n : `Attach ${isMulti ? 'files' : 'file'}`\n }\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n\n {wellhubContext && (\n <WellhubFilePicker\n {...wellhubContext}\n open={isWellhubOpen}\n maxSelectable={upload.maxFiles - upload.count}\n attachedFileNames={attachedKeys}\n onAdd={addWellhubFiles}\n onClose={() => setIsWellhubOpen(false)}\n />\n )}\n </>\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","CommentComposer","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachments","onAttachmentsChange","_ref$maxAttachments","maxAttachments","DEFAULT_MAX_ATTACHMENTS","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","wellhubContext","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","renderTrailing","embedded","testId","isMulti","value","useMemo","filter","Boolean","handleAttachmentsChange","useCallback","next","_next$","upload","useAttachmentUpload","onChange","onError","maxSizeBytes","maxFiles","canSend","isUploading","submit","useState","_useState2","_slicedToArray","_useState","isWellhubOpen","setIsWellhubOpen","attachedKeys","map","name","fieldRef","useRef","_Fragment","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","highlightLinks","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","undefined","onFilesDrop","addFiles","onImageLinkPaste","addLinkedImage","dropLabel","attachmentSlot","FailedFileUploading","errorMessage","toolbar","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","onWellhubSelect","multiple","isFull","tooltip","concat","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread","WellhubFilePicker","open","maxSelectable","count","attachedFileNames","onAdd","files","addStoredFiles","file","fileName","onClose"],"mappings":"yjMAuFA,IAGMA,EAAsB,CAC1BC,SAAU,GACVC,WAAY,OACZC,YAAa,CACXC,gBAP2B,gCAQ3BC,KAAM,CAAED,gBARmB,iCAS3BE,KAAM,CACJC,MAAO,gCACP,WAAY,CAAEH,gBAAiB,2DAK/BI,EAAmB,SAACC,GAA0C,OAClEC,EAAA,MAAA,CAAKC,UAAWC,EAAOC,WAAWC,SAAA,CAChCC,EAACC,EAAM,CAACC,KAAM,GAAIC,IAAKT,EAAMU,QAASC,OAAQX,EAAMY,MAAOC,YAAab,EAAMU,UAC9EJ,EAAA,OAAA,CAAAD,SAAOL,EAAMU,YACT,EAGKI,EAAkB,SA0BHC,GAAA,IAzB1BC,IAAAA,KACAC,IAAAA,aACAC,IAAAA,SACAC,IAAAA,UACAC,IAAAA,YACAC,IAAAA,YACAC,IAAAA,oBAAmBC,EAAAR,EACnBS,eAAAA,aAAiBC,EAAuBF,EACxCG,IAAAA,WACAC,IAAAA,mBACAC,IAAAA,gBACAC,IAAAA,kBACAC,IAAAA,uBACAC,IAAAA,eACAC,IAAAA,SACAC,IAAAA,UAASC,EAAAnB,EACToB,YAAAA,aAAc,mBAAkBD,EAChCE,IAAAA,SACAC,IAAAA,iBACAC,IAAAA,YACAC,IAAAA,SACAC,IAAAA,eACAC,IAAAA,SACAvC,KAAAA,UACAwC,KAAAA,OAGMC,KAAYrB,EACZsB,GAAQC,GACZ,WAAA,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,EAAUQ,OAAQR,EAAUQ,QACpDtE,EAAMuE,cAAc,IAAIC,MAAM,QAAS,CAAEC,SAAS,KAClDzE,EAAMuE,cAAc,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAXtC,GA0F4D9I,SAC5DC,EAAC8I,EAAkB,CAAC5J,SAAS,gBAGjCc,EAAA,OAAA,CAAMJ,UAAWC,EAAOkJ,SAAShJ,SAC/BC,EAACgJ,EAAe,CACdC,KAAMjJ,EAACkJ,EAAe,CAAChJ,KAAM,KAC7BiJ,kBAAmB,SAACC,GAAyB,OAC3CzI,EAAgBD,GAAAA,OAAAA,UAAO0I,EAAMC,QAAS,SAMhDC,UACKxH,UAAAA,EAAU4G,WAAY1G,IACvBrC,EAAAuE,EAAA,CAAAnE,SAAA,CACEC,EAACuJ,EAAe,CAAC7D,KAAM5D,QAAAA,EAAY,GAAI0H,WAAYzH,IAClDC,GAAehC,EAACyJ,EAAcC,EAAA,CAAA,EAAK1H,SAM3CP,GACCzB,EAAC2J,SACKlI,GAAc,GAAA,CAClBmI,KAAMjG,GACNkG,cAAe/G,GAAOK,SAAWL,GAAOgH,MACxCC,kBAAmBlG,GACnBmG,MAlIgB,SAACC,GACvBrG,IAAiB,GACjBd,GAAOoH,eAAeD,EAAMnG,KAAI,SAAAqG,GAAI,MAAK,CAAEC,SAAUD,EAAKC,SAAW,MAiI/DC,QAAS,WAAA,OAAMzG,IAAiB,EAAM,OAKhD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CommentComposer.trailing.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommentComposer.trailing.test.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentComposer/__tests__/CommentComposer.trailing.test.tsx"],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var t={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};e(".CommentInputNext_root__5uxKl{overflow-clip-margin:12px;background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;overflow:clip;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{--attachment-arrow-outset:8px;align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{flex:1 0 0;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}");export{t as default};
1
+ import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var t={spacing:"8",root:"CommentInputNext_root__5uxKl",dropOverlay:"CommentInputNext_dropOverlay__E5Riv",inputPanel:"CommentInputNext_inputPanel__4KOFc",rootEmbedded:"CommentInputNext_rootEmbedded__-LyQl",toolbarRow:"CommentInputNext_toolbarRow__L8xXu",divider:"CommentInputNext_divider__LWp-3",metaShare:"CommentInputNext_metaShare__yJ8GZ",rootBare:"CommentInputNext_rootBare__lxyYY",fieldRow:"CommentInputNext_fieldRow__Rqcbr",leading:"CommentInputNext_leading__yDBbV",field:"CommentInputNext_field__OpnOp",fieldExpanded:"CommentInputNext_fieldExpanded__w1omA",fieldDisabled:"CommentInputNext_fieldDisabled__g3aIT",bareToolbar:"CommentInputNext_bareToolbar__nFQP-",fieldMain:"CommentInputNext_fieldMain__Rs8-Y",attachment:"CommentInputNext_attachment__2EDgL",input:"CommentInputNext_input__w6b1c",toolbar:"CommentInputNext_toolbar__Zs2OG",send:"CommentInputNext_send__p248I"};e(".CommentInputNext_root__5uxKl{overflow-clip-margin:12px;background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;overflow:clip;position:relative}.CommentInputNext_dropOverlay__E5Riv{align-items:center;background:rgb(from var(--palette-primary-main) r g b/.1);border:1px dashed var(--palette-primary-main);border-radius:inherit;color:var(--palette-primary-main);display:flex;font-size:14px;inset:0;justify-content:center;line-height:20px;pointer-events:none;position:absolute;z-index:5}.CommentInputNext_inputPanel__4KOFc{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px;padding:12px 12px 8px}.CommentInputNext_rootEmbedded__-LyQl{background:transparent;border-radius:0;overflow:visible}.CommentInputNext_toolbarRow__L8xXu{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentInputNext_divider__LWp-3{background:var(--palette-background-b-4);height:1px}.CommentInputNext_metaShare__yJ8GZ{color:var(--palette-primary-text-6);display:flex;flex-direction:column;gap:8px;padding:8px 12px}.CommentInputNext_rootBare__lxyYY{display:flex;flex-direction:column;gap:8px;position:relative}.CommentInputNext_fieldRow__Rqcbr{align-items:flex-start;display:flex;gap:8px}.CommentInputNext_leading__yDBbV{flex-shrink:0}.CommentInputNext_field__OpnOp{--attachment-arrow-outset:8px;align-items:flex-end;background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px solid rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;display:flex;flex:1 0 0;gap:8px;max-height:256px;min-height:36px;min-width:0;overflow:hidden;padding:6px 8px}.CommentInputNext_field__OpnOp:focus-within{border-color:var(--palette-primary-main)}.CommentInputNext_fieldExpanded__w1omA{max-height:none;overflow:visible}.CommentInputNext_fieldDisabled__g3aIT{opacity:.6}.CommentInputNext_bareToolbar__nFQP-{align-items:center;color:var(--palette-primary-text-6);display:flex;flex-shrink:0}.CommentInputNext_fieldMain__Rs8-Y{align-self:stretch;flex:1 0 0;justify-content:center;min-width:0}.CommentInputNext_attachment__2EDgL,.CommentInputNext_fieldMain__Rs8-Y{display:flex;flex-direction:column;gap:8px}.CommentInputNext_input__w6b1c{background:transparent;border:none;color:var(--palette-primary-text-1);font:inherit;font-size:14px;line-height:20px;outline:none;resize:none;width:100%}.CommentInputNext_input__w6b1c::placeholder{color:var(--palette-primary-text-9)}.CommentInputNext_input__w6b1c:disabled{cursor:not-allowed}.CommentInputNext_toolbar__Zs2OG{align-items:center;color:var(--palette-primary-text-6);display:flex;gap:4px;margin-left:-4px}.CommentInputNext_send__p248I{flex-shrink:0}");export{t as default};
2
2
  //# sourceMappingURL=CommentInputNext.scss.js.map
@@ -249,7 +249,7 @@ const validateDsn = dsn => {
249
249
 
250
250
  const MCP_SERVER_VERSION = '1.10.0';
251
251
 
252
- var version = "3.82.0-1";
252
+ var version = "3.82.0-2";
253
253
 
254
254
  const CORVA_UI_VERSION = version;
255
255
 
@@ -3474,6 +3474,11 @@ var componentsV1Data = [{
3474
3474
  type: "ReactNode",
3475
3475
  required: false,
3476
3476
  description: "Replaces the default send button, e.g. the edit form's Cancel/Save."
3477
+ }, {
3478
+ name: "renderTrailing",
3479
+ type: "(state: CommentComposerTrailingState) => ReactNode",
3480
+ required: false,
3481
+ description: "Like `trailing`, but receives the upload-aware send state for a custom Save."
3477
3482
  }, {
3478
3483
  name: "embedded",
3479
3484
  type: "boolean",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "3.82.0-1",
3
+ "version": "3.82.0-2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Shared components/utils for Corva ui projects",
6
6
  "repository": {