@corva/ui 3.76.0-0 → 3.76.0-10

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.
Files changed (99) hide show
  1. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js +1 -1
  2. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
  3. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  4. package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js +2 -0
  5. package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
  6. package/cjs-bundle/components/Comment/index.js +1 -1
  7. package/cjs-bundle/components/Comment/index.js.map +1 -1
  8. package/cjs-bundle/components/Comment/useComment.js +2 -0
  9. package/cjs-bundle/components/Comment/useComment.js.map +1 -0
  10. package/cjs-bundle/components/CommentCard/CommentCard.scss.js +1 -1
  11. package/cjs-bundle/components/CommentInput/index.js +1 -1
  12. package/cjs-bundle/components/CommentInput/index.js.map +1 -1
  13. package/cjs-bundle/components/CommentInput/useCommentInput.js +2 -0
  14. package/cjs-bundle/components/CommentInput/useCommentInput.js.map +1 -0
  15. package/cjs-bundle/components/CommentInputNext/CommentInputNext.scss.js +1 -1
  16. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  17. package/cjs-bundle/components/FeedCard/FeedCard.scss.js +1 -1
  18. package/cjs-bundle/components/FileUploadIconButton.js +1 -1
  19. package/cjs-bundle/components/FileUploadIconButton.js.map +1 -1
  20. package/cjs-bundle/components/useFileUploadIconButton.js +2 -0
  21. package/cjs-bundle/components/useFileUploadIconButton.js.map +1 -0
  22. package/cjs-bundle/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  23. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  24. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  25. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  26. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  27. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  28. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  29. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  30. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  31. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  32. package/components/AttachmentPreview/AttachmentPreview.d.ts +1 -0
  33. package/components/AttachmentPreview/AttachmentPreview.d.ts.map +1 -1
  34. package/components/AttachmentPreview/AttachmentPreview.js +1 -1
  35. package/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
  36. package/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  37. package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts +2 -0
  38. package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts.map +1 -0
  39. package/components/AttachmentPreview/useScrollOverflow.d.ts +16 -0
  40. package/components/AttachmentPreview/useScrollOverflow.d.ts.map +1 -0
  41. package/components/AttachmentPreview/useScrollOverflow.js +2 -0
  42. package/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
  43. package/components/Comment/__tests__/useComment.test.d.ts +2 -0
  44. package/components/Comment/__tests__/useComment.test.d.ts.map +1 -0
  45. package/components/Comment/index.d.ts +2 -22
  46. package/components/Comment/index.js +1 -1
  47. package/components/Comment/index.js.map +1 -1
  48. package/components/Comment/useComment.d.ts +22 -0
  49. package/components/Comment/useComment.d.ts.map +1 -0
  50. package/components/Comment/useComment.js +2 -0
  51. package/components/Comment/useComment.js.map +1 -0
  52. package/components/CommentCard/CommentCard.scss.js +1 -1
  53. package/components/CommentInput/__tests__/useCommentInput.test.d.ts +2 -0
  54. package/components/CommentInput/__tests__/useCommentInput.test.d.ts.map +1 -0
  55. package/components/CommentInput/index.d.ts +26 -24
  56. package/components/CommentInput/index.js +1 -1
  57. package/components/CommentInput/index.js.map +1 -1
  58. package/components/CommentInput/useCommentInput.d.ts +26 -0
  59. package/components/CommentInput/useCommentInput.d.ts.map +1 -0
  60. package/components/CommentInput/useCommentInput.js +2 -0
  61. package/components/CommentInput/useCommentInput.js.map +1 -0
  62. package/components/CommentInputNext/CommentInputNext.scss.js +1 -1
  63. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts +2 -9
  64. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts.map +1 -1
  65. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  66. package/components/FeedCard/FeedCard.scss.js +1 -1
  67. package/components/FileUploadIconButton.d.ts +4 -60
  68. package/components/FileUploadIconButton.d.ts.map +1 -1
  69. package/components/FileUploadIconButton.js +1 -1
  70. package/components/FileUploadIconButton.js.map +1 -1
  71. package/components/__tests__/useFileUploadIconButton.test.d.ts +2 -0
  72. package/components/__tests__/useFileUploadIconButton.test.d.ts.map +1 -0
  73. package/components/useFileUploadIconButton.d.ts +15 -0
  74. package/components/useFileUploadIconButton.d.ts.map +1 -0
  75. package/components/useFileUploadIconButton.js +2 -0
  76. package/components/useFileUploadIconButton.js.map +1 -0
  77. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts +19 -6
  78. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts.map +1 -1
  79. package/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  80. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts +1 -0
  81. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts.map +1 -1
  82. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  83. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  84. package/componentsV2/AppHeader/V3/Actions/Actions.d.ts.map +1 -1
  85. package/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  86. package/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  87. package/componentsV2/AppHeader/V3/AppHeaderV3.d.ts.map +1 -1
  88. package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  89. package/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  90. package/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  91. package/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  92. package/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  93. package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts +2 -0
  94. package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts.map +1 -0
  95. package/mcp-server/server.mjs +7 -3
  96. package/package.json +1 -1
  97. package/styles/common.scss +14 -0
  98. package/styles/mixins.scss +14 -0
  99. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,22 @@
1
+ export default function useComment({ comment, showOnMount, handleShowOnMount, handleDeleteCallback, }: {
2
+ comment: any;
3
+ handleDeleteCallback: any;
4
+ handleShowOnMount: any;
5
+ showOnMount: any;
6
+ }): {
7
+ actionsMenuAnchorEl: null;
8
+ isLoading: boolean;
9
+ isEditing: boolean;
10
+ openDeleteDialog: boolean;
11
+ inputEl: import("react").MutableRefObject<null>;
12
+ commentEl: import("react").MutableRefObject<null>;
13
+ handleOpenActionsMenu: (event: any) => void;
14
+ handleCloseActionsMenu: (event: any) => void;
15
+ handleEditMenuItem: () => void;
16
+ onEditFinish: () => void;
17
+ setIsEditting: () => void;
18
+ handleDeleteMenuItem: () => void;
19
+ handleCloseDeleteDialog: () => void;
20
+ handleDelete: () => Promise<void>;
21
+ };
22
+ //# sourceMappingURL=useComment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComment.d.ts","sourceRoot":"","sources":["../../../src/components/Comment/useComment.js"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB;;;;;CAAA;;;;;;;;;;;;;;;EA+EA"}
@@ -0,0 +1,2 @@
1
+ import n from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/regenerator";import{useState as r,useRef as o,useLayoutEffect as u,useCallback as i}from"react";import{deleteFeedItemComment as c}from"../../clients/jsonApi/index.js";function a(a){var l=a.comment,s=a.showOnMount,d=a.handleShowOnMount,f=a.handleDeleteCallback,m=r(null),h=e(m,2),p=h[0],v=h[1],w=r(!1),M=e(w,2),E=M[0],b=M[1],g=r(!1),k=e(g,2),y=k[0],D=k[1],O=r(!1),x=e(O,2),A=x[0],C=x[1],I=o(null),L=o(null),S=o({showOnMount:s,handleShowOnMount:d}),T=o(f);u((function(){T.current=f}),[f]),u((function(){S.current.showOnMount&&(S.current.handleShowOnMount(),L.current.scrollIntoView({block:"end"}))}),[]),u((function(){y&&I.current&&I.current.focus()}),[y]);var j=i((function(n){27===n.keyCode&&D(!1),document.removeEventListener("keydown",j,!1)}),[]);u((function(){return function(){return document.removeEventListener("keydown",j,!1)}}),[j]);var P,_=(P=n(t.mark((function n(){var e,r,o;return t.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e=l.id,r=l.feed_activity_id,b(!0),n.prev=2,n.next=5,c(r,e);case 5:o=n.sent,n.next=11;break;case 8:n.prev=8,n.t0=n.catch(2),console.error(n.t0);case 11:b(!1),C(!1),o&&T.current(e);case 14:case"end":return n.stop()}}),n,null,[[2,8]])}))),function(){return P.apply(this,arguments)});return{actionsMenuAnchorEl:p,isLoading:E,isEditing:y,openDeleteDialog:A,inputEl:I,commentEl:L,handleOpenActionsMenu:function(n){n.stopPropagation(),v(n.currentTarget)},handleCloseActionsMenu:function(n){n.stopPropagation(),v(null)},handleEditMenuItem:function(){document.addEventListener("keydown",j,!1),D(!0)},onEditFinish:function(){D(!1),b(!1)},setIsEditting:function(){return b(!0)},handleDeleteMenuItem:function(){return C(!0)},handleCloseDeleteDialog:function(){return C(!1)},handleDelete:_}}export{a as default};
2
+ //# sourceMappingURL=useComment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComment.js","sources":["../../../src/components/Comment/useComment.js"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { deleteFeedItemComment } from '../../clients/jsonApi';\n\nexport default function useComment({\n comment,\n showOnMount,\n handleShowOnMount,\n handleDeleteCallback,\n}) {\n const [actionsMenuAnchorEl, setActionsMenuAnchorEl] = useState(null);\n const [isLoading, setIsLoading] = useState(false);\n const [isEditing, setIsEditing] = useState(false);\n const [openDeleteDialog, setOpenDeleteDialog] = useState(false);\n const inputEl = useRef(null);\n const commentEl = useRef(null);\n const initialMount = useRef({ showOnMount, handleShowOnMount });\n const deleteCallback = useRef(handleDeleteCallback);\n\n useLayoutEffect(() => {\n deleteCallback.current = handleDeleteCallback;\n }, [handleDeleteCallback]);\n\n useLayoutEffect(() => {\n if (initialMount.current.showOnMount) {\n initialMount.current.handleShowOnMount();\n commentEl.current.scrollIntoView({ block: 'end' });\n }\n }, []);\n\n useLayoutEffect(() => {\n if (isEditing && inputEl.current) inputEl.current.focus();\n }, [isEditing]);\n\n const handleKeyDown = useCallback(event => {\n if (event.keyCode === 27) setIsEditing(false);\n document.removeEventListener('keydown', handleKeyDown, false);\n }, []);\n\n useLayoutEffect(\n () => () => document.removeEventListener('keydown', handleKeyDown, false),\n [handleKeyDown]\n );\n\n const handleEditMenuItem = () => {\n document.addEventListener('keydown', handleKeyDown, false);\n setIsEditing(true);\n };\n\n const handleDelete = async () => {\n const { id, feed_activity_id: feedItemId } = comment;\n setIsLoading(true);\n let response;\n try {\n response = await deleteFeedItemComment(feedItemId, id);\n } catch (error) {\n console.error(error);\n }\n setIsLoading(false);\n setOpenDeleteDialog(false);\n if (response) deleteCallback.current(id);\n };\n\n return {\n actionsMenuAnchorEl,\n isLoading,\n isEditing,\n openDeleteDialog,\n inputEl,\n commentEl,\n handleOpenActionsMenu: event => {\n event.stopPropagation();\n setActionsMenuAnchorEl(event.currentTarget);\n },\n handleCloseActionsMenu: event => {\n event.stopPropagation();\n setActionsMenuAnchorEl(null);\n },\n handleEditMenuItem,\n onEditFinish: () => {\n setIsEditing(false);\n setIsLoading(false);\n },\n setIsEditting: () => setIsLoading(true),\n handleDeleteMenuItem: () => setOpenDeleteDialog(true),\n handleCloseDeleteDialog: () => setOpenDeleteDialog(false),\n handleDelete,\n };\n}\n"],"names":["useComment","_ref","comment","showOnMount","handleShowOnMount","handleDeleteCallback","useState","_useState2","_slicedToArray","_useState","actionsMenuAnchorEl","setActionsMenuAnchorEl","_useState4","_useState3","isLoading","setIsLoading","_useState6","_useState5","isEditing","setIsEditing","_useState8","_useState7","openDeleteDialog","setOpenDeleteDialog","inputEl","useRef","commentEl","initialMount","deleteCallback","useLayoutEffect","current","scrollIntoView","block","focus","handleKeyDown","useCallback","event","keyCode","document","removeEventListener","_ref2","handleDelete","_asyncToGenerator","_regeneratorRuntime","mark","_callee","id","feedItemId","response","wrap","_context","prev","next","feed_activity_id","deleteFeedItemComment","sent","t0","console","error","stop","apply","this","arguments","handleOpenActionsMenu","stopPropagation","currentTarget","handleCloseActionsMenu","handleEditMenuItem","addEventListener","onEditFinish","setIsEditting","handleDeleteMenuItem","handleCloseDeleteDialog"],"mappings":"+SAGe,SAASA,EAKrBC,GAAA,IAJDC,IAAAA,QACAC,IAAAA,YACAC,IAAAA,kBACAC,IAAAA,qBAEsDC,EAAAA,EAAS,MAAKC,EAAAC,EAAAC,EAAA,GAA7DC,EAAmBH,EAAA,GAAEI,EAAsBJ,EAAA,GAChBD,EAAAA,GAAS,GAAMM,EAAAJ,EAAAK,EAAA,GAA1CC,EAASF,EAAA,GAAEG,EAAYH,EAAA,GACIN,EAAAA,GAAS,GAAMU,EAAAR,EAAAS,EAAA,GAA1CC,EAASF,EAAA,GAAEG,EAAYH,EAAA,GACkBV,EAAAA,GA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AAAS,OAAA,GAAAd,EAAA,KAAA,CAAA,CAAA,EAAA,IAC1C,KAAA,WAZiB,OAAAL,EAAAoB,MAAAC,KAAAC,UAAA,GAclB,MAAO,CACLpD,oBAAAA,EACAI,UAAAA,EACAI,UAAAA,EACAI,iBAAAA,EACAE,QAAAA,EACAE,UAAAA,EACAqC,sBAAuB,SAAA3B,GACrBA,EAAM4B,kBACNrD,EAAuByB,EAAM6B,cAC9B,EACDC,uBAAwB,SAAA9B,GACtBA,EAAM4B,kBACNrD,EAAuB,KACxB,EACDwD,mBAlCyB,WACzB7B,SAAS8B,iBAAiB,UAAWlC,GAAe,GACpDf,GAAa,IAiCbkD,aAAc,WACZlD,GAAa,GACbJ,GAAa,EACd,EACDuD,cAAe,WAAA,OAAMvD,GAAa,EAAK,EACvCwD,qBAAsB,WAAA,OAAMhD,GAAoB,EAAK,EACrDiD,wBAAyB,WAAA,OAAMjD,GAAoB,EAAM,EACzDkB,aAAAA,EAEJ"}
@@ -1,2 +1,2 @@
1
- import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var t={spacing:"8",capped:"CommentCard_capped__izWBZ",bodySurface:"CommentCard_bodySurface__scobR",editHeader:"CommentCard_editHeader__8aUBt",scrollBody:"CommentCard_scrollBody__CIun9",footer:"CommentCard_footer__z3-CY",repliesSection:"CommentCard_repliesSection__iE7QO",compactBody:"CommentCard_compactBody__zM10O",compactTop:"CommentCard_compactTop__LpiQi",compactTime:"CommentCard_compactTime__JzVQR",compactFooter:"CommentCard_compactFooter__rgB4D",header:"CommentCard_header__T1SH8",headerText:"CommentCard_headerText__DRsQG",nameRow:"CommentCard_nameRow__Or1c0",timestamp:"CommentCard_timestamp__EbJCO",subtitle:"CommentCard_subtitle__d-XRe",avatar:"CommentCard_avatar__NA2ZA",name:"CommentCard_name__9-e7A",chip:"CommentCard_chip__4NUrf",chipAccented:"CommentCard_chipAccented__Xl8ek",bodyRow:"CommentCard_bodyRow__ZUufY",text:"CommentCard_text__eAIZM",attachment:"CommentCard_attachment__KktIn",infoButton:"CommentCard_infoButton__gqcvK",metadataTooltip:"CommentCard_metadataTooltip__AL0xt",metadataRows:"CommentCard_metadataRows__c-kqf",metadataRow:"CommentCard_metadataRow__BqcII",metadataLabel:"CommentCard_metadataLabel__WRWl7",metadataValue:"CommentCard_metadataValue__Xwf7S",metadataUnit:"CommentCard_metadataUnit__Bxeps",contextLine:"CommentCard_contextLine__Jyoui",contextItem:"CommentCard_contextItem__2Xmql",actionsRow:"CommentCard_actionsRow__1Ftxn",actions:"CommentCard_actions__mUmsV",trailingActions:"CommentCard_trailingActions__uGt-3",action:"CommentCard_action__ZfyBP",count:"CommentCard_count__stfpY",liked:"CommentCard_liked__zsBqe",replies:"CommentCard_replies__nRRYo",reply:"CommentCard_reply__7-U7Q",replyHeader:"CommentCard_replyHeader__sWnLA",replyNameRow:"CommentCard_replyNameRow__bs7h2",replyName:"CommentCard_replyName__C8tst",replyTimestamp:"CommentCard_replyTimestamp__YzuW1",replyText:"CommentCard_replyText__8JPKK"};e(".CommentCard_capped__izWBZ{display:flex;flex-direction:column;overflow:hidden}.CommentCard_bodySurface__scobR{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow:hidden;padding:8px 12px}.CommentCard_editHeader__8aUBt{padding:8px 12px 0}.CommentCard_scrollBody__CIun9{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow-x:hidden;overflow-y:auto}.CommentCard_footer__z3-CY{border-top:1px solid var(--palette-background-b-4);display:flex;flex-direction:column;flex-shrink:0;padding:4px 12px 8px}.CommentCard_repliesSection__iE7QO{padding:8px 12px 12px}.CommentCard_compactBody__zM10O{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow:hidden;padding:8px 12px}.CommentCard_compactTop__LpiQi{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_compactTime__JzVQR{color:var(--palette-primary-text-7);font-size:12px;line-height:16px;margin-left:auto;white-space:nowrap}.CommentCard_compactFooter__rgB4D{border-top:1px solid var(--palette-background-b-4);flex-shrink:0;padding:4px 12px 8px}.CommentCard_header__T1SH8{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_headerText__DRsQG{display:flex;flex:1 0 0;flex-direction:column;min-width:0;word-break:break-word}.CommentCard_nameRow__Or1c0{align-items:center;display:flex;gap:8px;width:100%}.CommentCard_nameRow__Or1c0 .CommentCard_timestamp__EbJCO{margin-left:auto}.CommentCard_subtitle__d-XRe{color:var(--palette-primary-main);font-size:12px;line-height:16px}.CommentCard_avatar__NA2ZA{flex-shrink:0}.CommentCard_name__9-e7A{color:var(--palette-primary-text-1);flex:0 1 auto;font-size:14px;line-height:20px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.CommentCard_timestamp__EbJCO{color:var(--palette-primary-text-7)}.CommentCard_chip__4NUrf,.CommentCard_timestamp__EbJCO{flex-shrink:0;font-size:12px;line-height:16px;white-space:nowrap}.CommentCard_chip__4NUrf{align-items:center;background:rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;color:var(--palette-primary-text-6);display:flex;height:24px;padding:6px 8px}.CommentCard_chipAccented__Xl8ek{border-left:2px solid transparent}.CommentCard_bodyRow__ZUufY{align-items:center;display:flex;gap:8px}.CommentCard_text__eAIZM{color:var(--palette-primary-text-1);flex:1 1 auto;font-size:12px;line-height:16px;min-width:0;white-space:pre-wrap;word-break:break-word}.CommentCard_text__eAIZM a,.CommentCard_text__eAIZM button{font:inherit;padding:0;vertical-align:baseline}.CommentCard_attachment__KktIn{display:flex;flex-direction:column;gap:8px}.CommentCard_infoButton__gqcvK{align-items:center;color:var(--palette-primary-text-6);cursor:default;display:inline-flex}.CommentCard_infoButton__gqcvK:hover{color:var(--palette-primary-text-1)}.CommentCard_metadataTooltip__AL0xt .MuiTooltip-tooltip{max-width:none!important}.CommentCard_metadataRows__c-kqf{display:flex;flex-direction:column;gap:4px;padding:4px 0}.CommentCard_metadataRow__BqcII{align-items:baseline;display:flex;font-size:14px;gap:4px;line-height:20px;white-space:nowrap}.CommentCard_metadataLabel__WRWl7{color:var(--palette-primary-text-6)}.CommentCard_metadataValue__Xwf7S{color:var(--palette-primary-text-1)}.CommentCard_metadataUnit__Bxeps{color:var(--palette-primary-text-6);font-size:12px}.CommentCard_contextLine__Jyoui{align-items:center;color:var(--palette-primary-text-7);column-gap:16px;display:flex;flex-wrap:wrap;font-size:12px;line-height:16px;row-gap:4px}.CommentCard_contextItem__2Xmql{white-space:nowrap}.CommentCard_actionsRow__1Ftxn{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentCard_actions__mUmsV{align-items:center;display:flex;gap:8px}.CommentCard_trailingActions__uGt-3{align-items:center;display:flex;gap:4px}.CommentCard_action__ZfyBP{align-items:center;display:flex;gap:2px}.CommentCard_count__stfpY{color:var(--palette-primary-text-6);font-size:12px;line-height:16px}.CommentCard_liked__zsBqe svg{color:var(--palette-primary-main)}.CommentCard_replies__nRRYo{display:flex;flex-direction:column;gap:8px}.CommentCard_reply__7-U7Q{display:flex;flex-direction:column;gap:4px}.CommentCard_replyHeader__sWnLA{align-items:center;display:flex;gap:8px}.CommentCard_replyNameRow__bs7h2{align-items:center;display:flex;flex:1 0 0;gap:12px;min-width:0}.CommentCard_replyName__C8tst{color:var(--palette-primary-text-1);font-size:14px;line-height:20px;white-space:nowrap}.CommentCard_replyTimestamp__YzuW1{color:var(--palette-primary-text-7);flex:1 0 0;font-size:12px;line-height:16px;min-width:0}.CommentCard_replyText__8JPKK{color:var(--palette-primary-text-1);font-size:12px;line-height:16px;padding-left:40px;white-space:pre-wrap;word-break:break-word}.CommentCard_replyText__8JPKK a,.CommentCard_replyText__8JPKK button{font:inherit;padding:0;vertical-align:baseline}");export{t as default};
1
+ import e from'./../../ext-esm/style-inject/dist/style-inject.es.js';var t={spacing:"8",capped:"CommentCard_capped__izWBZ",bodySurface:"CommentCard_bodySurface__scobR",editHeader:"CommentCard_editHeader__8aUBt",scrollBody:"CommentCard_scrollBody__CIun9",footer:"CommentCard_footer__z3-CY",repliesSection:"CommentCard_repliesSection__iE7QO",compactBody:"CommentCard_compactBody__zM10O",compactTop:"CommentCard_compactTop__LpiQi",compactTime:"CommentCard_compactTime__JzVQR",compactFooter:"CommentCard_compactFooter__rgB4D",header:"CommentCard_header__T1SH8",headerText:"CommentCard_headerText__DRsQG",nameRow:"CommentCard_nameRow__Or1c0",timestamp:"CommentCard_timestamp__EbJCO",subtitle:"CommentCard_subtitle__d-XRe",avatar:"CommentCard_avatar__NA2ZA",name:"CommentCard_name__9-e7A",chip:"CommentCard_chip__4NUrf",chipAccented:"CommentCard_chipAccented__Xl8ek",bodyRow:"CommentCard_bodyRow__ZUufY",text:"CommentCard_text__eAIZM",attachment:"CommentCard_attachment__KktIn",infoButton:"CommentCard_infoButton__gqcvK",metadataTooltip:"CommentCard_metadataTooltip__AL0xt",metadataRows:"CommentCard_metadataRows__c-kqf",metadataRow:"CommentCard_metadataRow__BqcII",metadataLabel:"CommentCard_metadataLabel__WRWl7",metadataValue:"CommentCard_metadataValue__Xwf7S",metadataUnit:"CommentCard_metadataUnit__Bxeps",contextLine:"CommentCard_contextLine__Jyoui",contextItem:"CommentCard_contextItem__2Xmql",actionsRow:"CommentCard_actionsRow__1Ftxn",actions:"CommentCard_actions__mUmsV",trailingActions:"CommentCard_trailingActions__uGt-3",action:"CommentCard_action__ZfyBP",count:"CommentCard_count__stfpY",liked:"CommentCard_liked__zsBqe",replies:"CommentCard_replies__nRRYo",reply:"CommentCard_reply__7-U7Q",replyHeader:"CommentCard_replyHeader__sWnLA",replyNameRow:"CommentCard_replyNameRow__bs7h2",replyName:"CommentCard_replyName__C8tst",replyTimestamp:"CommentCard_replyTimestamp__YzuW1",replyText:"CommentCard_replyText__8JPKK"};e(".CommentCard_capped__izWBZ{flex-direction:column}.CommentCard_bodySurface__scobR,.CommentCard_capped__izWBZ{overflow-clip-margin:12px;display:flex;overflow:hidden;overflow:clip}.CommentCard_bodySurface__scobR{flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;padding:8px 12px}.CommentCard_editHeader__8aUBt{padding:8px 12px 0}.CommentCard_scrollBody__CIun9{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;margin:0 -24px;min-height:0;overflow-x:hidden;overflow-y:auto;padding:0 24px}.CommentCard_footer__z3-CY{border-top:1px solid var(--palette-background-b-4);display:flex;flex-direction:column;flex-shrink:0;padding:4px 12px 8px}.CommentCard_repliesSection__iE7QO{padding:8px 12px 12px}.CommentCard_compactBody__zM10O{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow:hidden;padding:8px 12px}.CommentCard_compactTop__LpiQi{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_compactTime__JzVQR{color:var(--palette-primary-text-7);font-size:12px;line-height:16px;margin-left:auto;white-space:nowrap}.CommentCard_compactFooter__rgB4D{border-top:1px solid var(--palette-background-b-4);flex-shrink:0;padding:4px 12px 8px}.CommentCard_header__T1SH8{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_headerText__DRsQG{display:flex;flex:1 0 0;flex-direction:column;min-width:0;word-break:break-word}.CommentCard_nameRow__Or1c0{align-items:center;display:flex;gap:8px;width:100%}.CommentCard_nameRow__Or1c0 .CommentCard_timestamp__EbJCO{margin-left:auto}.CommentCard_subtitle__d-XRe{color:var(--palette-primary-main);font-size:12px;line-height:16px}.CommentCard_avatar__NA2ZA{flex-shrink:0}.CommentCard_name__9-e7A{color:var(--palette-primary-text-1);flex:0 1 auto;font-size:14px;line-height:20px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.CommentCard_timestamp__EbJCO{color:var(--palette-primary-text-7)}.CommentCard_chip__4NUrf,.CommentCard_timestamp__EbJCO{flex-shrink:0;font-size:12px;line-height:16px;white-space:nowrap}.CommentCard_chip__4NUrf{align-items:center;background:rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;color:var(--palette-primary-text-6);display:flex;height:24px;padding:6px 8px}.CommentCard_chipAccented__Xl8ek{border-left:2px solid transparent}.CommentCard_bodyRow__ZUufY{align-items:center;display:flex;gap:8px}.CommentCard_text__eAIZM{color:var(--palette-primary-text-1);flex:1 1 auto;font-size:12px;line-height:16px;min-width:0;white-space:pre-wrap;word-break:break-word}.CommentCard_text__eAIZM a,.CommentCard_text__eAIZM button{font:inherit;padding:0;vertical-align:baseline}.CommentCard_attachment__KktIn{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px}.CommentCard_infoButton__gqcvK{align-items:center;color:var(--palette-primary-text-6);cursor:default;display:inline-flex}.CommentCard_infoButton__gqcvK:hover{color:var(--palette-primary-text-1)}.CommentCard_metadataTooltip__AL0xt .MuiTooltip-tooltip{max-width:none!important}.CommentCard_metadataRows__c-kqf{display:flex;flex-direction:column;gap:4px;padding:4px 0}.CommentCard_metadataRow__BqcII{align-items:baseline;display:flex;font-size:14px;gap:4px;line-height:20px;white-space:nowrap}.CommentCard_metadataLabel__WRWl7{color:var(--palette-primary-text-6)}.CommentCard_metadataValue__Xwf7S{color:var(--palette-primary-text-1)}.CommentCard_metadataUnit__Bxeps{color:var(--palette-primary-text-6);font-size:12px}.CommentCard_contextLine__Jyoui{align-items:center;color:var(--palette-primary-text-7);column-gap:16px;display:flex;flex-wrap:wrap;font-size:12px;line-height:16px;row-gap:4px}.CommentCard_contextItem__2Xmql{white-space:nowrap}.CommentCard_actionsRow__1Ftxn{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentCard_actions__mUmsV{align-items:center;display:flex;gap:8px}.CommentCard_trailingActions__uGt-3{align-items:center;display:flex;gap:4px}.CommentCard_action__ZfyBP{align-items:center;display:flex;gap:2px}.CommentCard_count__stfpY{color:var(--palette-primary-text-6);font-size:12px;line-height:16px}.CommentCard_liked__zsBqe svg{color:var(--palette-primary-main)}.CommentCard_replies__nRRYo{display:flex;flex-direction:column;gap:8px}.CommentCard_reply__7-U7Q{display:flex;flex-direction:column;gap:4px}.CommentCard_replyHeader__sWnLA{align-items:center;display:flex;gap:8px}.CommentCard_replyNameRow__bs7h2{align-items:center;display:flex;flex:1 0 0;gap:12px;min-width:0}.CommentCard_replyName__C8tst{color:var(--palette-primary-text-1);font-size:14px;line-height:20px;white-space:nowrap}.CommentCard_replyTimestamp__YzuW1{color:var(--palette-primary-text-7);flex:1 0 0;font-size:12px;line-height:16px;min-width:0}.CommentCard_replyText__8JPKK{color:var(--palette-primary-text-1);font-size:12px;line-height:16px;padding-left:40px;white-space:pre-wrap;word-break:break-word}.CommentCard_replyText__8JPKK a,.CommentCard_replyText__8JPKK button{font:inherit;padding:0;vertical-align:baseline}");export{t as default};
2
2
  //# sourceMappingURL=CommentCard.scss.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useCommentInput.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCommentInput.test.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentInput/__tests__/useCommentInput.test.js"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import PropTypes from 'prop-types';
2
- declare const _default: import("react").ComponentType<Pick<Pick<PropTypes.InferProps<{
2
+ declare const _default: import("react").ComponentType<Pick<PropTypes.InferPropsInner<Pick<{
3
3
  inputRef: PropTypes.Requireable<PropTypes.InferProps<{
4
4
  current: PropTypes.Requireable<PropTypes.InferProps<{
5
5
  focus: PropTypes.Requireable<PropTypes.InferProps<{}>>;
@@ -28,7 +28,7 @@ declare const _default: import("react").ComponentType<Pick<Pick<PropTypes.InferP
28
28
  isNative: PropTypes.Requireable<boolean>;
29
29
  companyId: PropTypes.Requireable<number>;
30
30
  parentId: PropTypes.Requireable<string>;
31
- }>, PropTypes.RequiredKeys<{
31
+ }, PropTypes.RequiredKeys<{
32
32
  inputRef: PropTypes.Requireable<PropTypes.InferProps<{
33
33
  current: PropTypes.Requireable<PropTypes.InferProps<{
34
34
  focus: PropTypes.Requireable<PropTypes.InferProps<{}>>;
@@ -57,33 +57,35 @@ declare const _default: import("react").ComponentType<Pick<Pick<PropTypes.InferP
57
57
  isNative: PropTypes.Requireable<boolean>;
58
58
  companyId: PropTypes.Requireable<number>;
59
59
  parentId: PropTypes.Requireable<string>;
60
- }>> & {
61
- inputRef?: PropTypes.InferProps<{
60
+ }>>> & Partial<PropTypes.InferPropsInner<Pick<{
61
+ inputRef: PropTypes.Requireable<PropTypes.InferProps<{
62
62
  current: PropTypes.Requireable<PropTypes.InferProps<{
63
63
  focus: PropTypes.Requireable<PropTypes.InferProps<{}>>;
64
64
  }>>;
65
- }> | null | undefined;
66
- editFeedItemId?: number | null | undefined;
67
- editCommentId?: number | null | undefined;
68
- editComment?: string | null | undefined;
69
- editAttachment?: PropTypes.InferProps<{
65
+ }>>;
66
+ editFeedItemId: PropTypes.Requireable<number>;
67
+ editCommentId: PropTypes.Requireable<number>;
68
+ editComment: PropTypes.Requireable<string>;
69
+ editAttachment: PropTypes.Requireable<PropTypes.InferProps<{
70
70
  url: PropTypes.Requireable<string>;
71
71
  size: PropTypes.Requireable<number>;
72
72
  file_name: PropTypes.Requireable<string>;
73
- }> | null | undefined;
74
- spaceAround?: boolean | null | undefined;
75
- postCommentCallback?: ((...args: any[]) => any) | null | undefined;
76
- patchCommentCallback?: ((...args: any[]) => any) | null | undefined;
77
- exitEditMode?: ((...args: any[]) => any) | null | undefined;
78
- setIsPosting?: ((...args: any[]) => any) | null | undefined;
79
- setIsEditting?: ((...args: any[]) => any) | null | undefined;
80
- onMount?: ((...args: any[]) => any) | null | undefined;
81
- autoFocus?: boolean | null | undefined;
82
- disabled?: boolean | null | undefined;
83
- currentUser?: PropTypes.InferProps<PropTypes.ValidationMap<any>> | null | undefined;
84
- isNative?: boolean | null | undefined;
85
- companyId?: number | null | undefined;
86
- parentId?: string | null | undefined;
87
- } & {}, "autoFocus" | "companyId" | "currentUser" | "disabled" | "editAttachment" | "editComment" | "editCommentId" | "editFeedItemId" | "exitEditMode" | "inputRef" | "isNative" | "onMount" | "parentId" | "patchCommentCallback" | "postComment" | "postCommentCallback" | "setIsEditting" | "setIsPosting" | "spaceAround"> & import("@material-ui/styles").StyledComponentProps<"additionalActionButton" | "cancelText" | "fileUploadingError" | "highlightedLabel" | "iconTooltip" | "input" | "inputAdornment" | "inputEl" | "inputHelper" | "inputMain" | "inputRoot" | "nativeActionButton" | "paperRoot" | "sendButton">>;
73
+ }>>;
74
+ spaceAround: PropTypes.Requireable<boolean>;
75
+ postComment: PropTypes.Validator<(...args: any[]) => any>;
76
+ postCommentCallback: PropTypes.Requireable<(...args: any[]) => any>;
77
+ patchCommentCallback: PropTypes.Requireable<(...args: any[]) => any>;
78
+ exitEditMode: PropTypes.Requireable<(...args: any[]) => any>;
79
+ setIsPosting: PropTypes.Requireable<(...args: any[]) => any>;
80
+ setIsEditting: PropTypes.Requireable<(...args: any[]) => any>;
81
+ onMount: PropTypes.Requireable<(...args: any[]) => any>;
82
+ autoFocus: PropTypes.Requireable<boolean>;
83
+ disabled: PropTypes.Requireable<boolean>;
84
+ classes: PropTypes.Validator<NonNullable<PropTypes.InferProps<{}>>>;
85
+ currentUser: PropTypes.Requireable<PropTypes.InferProps<PropTypes.ValidationMap<any>>>;
86
+ isNative: PropTypes.Requireable<boolean>;
87
+ companyId: PropTypes.Requireable<number>;
88
+ parentId: PropTypes.Requireable<string>;
89
+ }, "autoFocus" | "companyId" | "currentUser" | "disabled" | "editAttachment" | "editComment" | "editCommentId" | "editFeedItemId" | "exitEditMode" | "inputRef" | "isNative" | "onMount" | "parentId" | "patchCommentCallback" | "postCommentCallback" | "setIsEditting" | "setIsPosting" | "spaceAround">>> & import("react").RefAttributes<any>, "autoFocus" | "companyId" | "currentUser" | "disabled" | "editAttachment" | "editComment" | "editCommentId" | "editFeedItemId" | "exitEditMode" | "inputRef" | "isNative" | "onMount" | "parentId" | "patchCommentCallback" | "postComment" | "postCommentCallback" | "setIsEditting" | "setIsPosting" | "spaceAround" | keyof import("react").RefAttributes<any>> & import("@material-ui/styles").StyledComponentProps<"additionalActionButton" | "cancelText" | "fileUploadingError" | "highlightedLabel" | "iconTooltip" | "input" | "inputAdornment" | "inputEl" | "inputHelper" | "inputMain" | "inputRoot" | "nativeActionButton" | "paperRoot" | "sendButton">>;
88
90
  export default _default;
89
91
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import p from"prop-types";import m from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import{Paper as d,TextField as h,InputAdornment as f,Collapse as g,Typography as C}from"@material-ui/core";import b from"classnames";import{get as I}from"lodash";import v from"@material-ui/core/colors/grey";import{patchFeedItemComment as x}from"../../clients/jsonApi/index.js";import y from"./styles.css.js";import{AvatarComponent as E}from"../Avatar/index.js";import F from"../FileUploadIconButton.js";import S from"../EmojiIconButton.js";import U from"../FailedFileUploading.js";import N from"../UserMention/index.js";import k from"../FilePreview/index.js";import A from"../IconButton/index.js";import M from"../Icons/SendIcon.js";import{isSuggestionsListOpened as R}from"../UserMention/utils/index.js";import j from"../../utils/main.js";import{isNativeDetected as B}from"../../utils/mobileDetect.js";import{notifyCommentEdit as w,notifyCommentPost as P}from"../../utils/nativeMessages.js";import{jsxs as T,jsx as L}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(p,c);var r=z(p);function p(n){var i,a,c;return e(this,p),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,x(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(R()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(w(t),i.clearCommentField(i.props.exitEditMode)):(P(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(p,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?this.props.editAttachment.file_name||j.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t,e=this,n=this.props,o=n.classes,i=n.currentUser,a="".concat(I(i,["attributes","first_name"])||I(i,"first_name")," ").concat(I(i,["attributes","last_name"])||I(i,"last_name")),r=this.state.isInputFocused||this.state.attachmentUrl||this.state.comment||this.props.editComment||(null===(t=this.props.editAttachment)||void 0===t?void 0:t.url);return T("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[L("div",{style:D.chatAvatarWrapper,children:L(E,{displayName:a,size:32,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),L(d,{className:this.props.classes.paperRoot,children:L(h,{"data-testid":"".concat("commentInput","_input"),placeholder:"Type Comment",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:N,inputProps:{onChange:function(t){return e.setState({comment:t})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return e.setState({isInputFocused:!0})},onBlur:function(){return e.setState({isInputFocused:!1})},allowSuggestionsAboveCursor:!0},endAdornment:!this.props.isNative&&T(f,{position:"end",className:this.props.classes.inputAdornment,children:[!this.state.attachmentUrl&&L("div",{className:b(y.cCommentInputIconContainer,y.cCommentInputIconUpload),children:L(F,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId),tooltipProps:{title:"Attach File",classes:{tooltip:o.iconTooltip},placement:"top"}})}),L("div",{className:y.cCommentInputIconContainer,children:L(S,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],disableRipple:!0,tooltipProps:{title:"Add Emoji",classes:{tooltip:o.iconTooltip},placement:"top"}})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&L(U,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&L(k,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),L(g,{in:r,mountOnEnter:!0,unmountOnExit:!0,children:T("div",{className:y.cCommentInputSendContainer,children:[L("div",{className:y.cCommentInputSendContainerCancel,children:L(C,{"data-testid":"".concat("commentInput","_cancel"),variant:"caption",className:b(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),T("div",{className:y.cCommentInputSendContainerSend,children:[T(C,{variant:"caption",className:b(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",L(C,{variant:"caption",color:"primary",className:b(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),L(A,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:L(M,{})})]})]})})]})}}]),p}();_.propTypes={inputRef:p.shape({current:p.shape({focus:p.shape({})})}),editFeedItemId:p.number,editCommentId:p.number,editComment:p.string,editAttachment:p.shape({url:p.string,size:p.number,file_name:p.string}),spaceAround:p.bool,postComment:p.func.isRequired,postCommentCallback:p.func,patchCommentCallback:p.func,exitEditMode:p.func,setIsPosting:p.func,setIsEditting:p.func,onMount:p.func,autoFocus:p.bool,disabled:p.bool,classes:p.shape({}).isRequired,currentUser:p.shape(),isNative:p.bool,companyId:p.number,parentId:p.string},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:m,setIsEditting:m,onMount:m,autoFocus:void 0,disabled:!1,patchCommentCallback:m,postCommentCallback:m,exitEditMode:m,companyId:null,currentUser:{},isNative:B};var O=u((function(t){return{paperRoot:{width:"calc(100% - 48px)",marginLeft:48,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none",background:"#4D4D4D"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"8px",lineHeight:"29px",paddingLeft:"8px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"6px"},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}},inputAdornment:{marginBottom:"0!important",height:"100%"}}}))(_);export{O as default};
1
+ import{forwardRef as t,useImperativeHandle as e,memo as n}from"react";import o from"prop-types";import i from"lodash/noop";import{withStyles as a}from"@material-ui/core/styles";import{Paper as r,TextField as l,InputAdornment as m,Collapse as d,Typography as s}from"@material-ui/core";import p from"classnames";import{get as c}from"lodash";import u from"@material-ui/core/colors/grey";import h from"./useCommentInput.js";import g from"./styles.css.js";import{AvatarComponent as f}from"../Avatar/index.js";import C from"../FileUploadIconButton.js";import v from"../EmojiIconButton.js";import I from"../FailedFileUploading.js";import b from"../UserMention/index.js";import x from"../FilePreview/index.js";import F from"../IconButton/index.js";import y from"../Icons/SendIcon.js";import{isNativeDetected as A}from"../../utils/mobileDetect.js";import{jsxs as E,jsx as N}from"react/jsx-runtime";var j={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},B={},U=t((function(t,n){var o=t.inputRef,a=void 0===o?null:o,U=t.editFeedItemId,S=void 0===U?null:U,T=t.editCommentId,R=void 0===T?null:T,M=t.parentId,k=void 0===M?null:M,L=t.editComment,P=void 0===L?null:L,w=t.editAttachment,_=void 0===w?B:w,D=t.spaceAround,H=void 0!==D&&D,z=t.postComment,O=t.setIsPosting,q=void 0===O?i:O,K=t.setIsEditting,W=void 0===K?i:K,G=t.onMount,J=void 0===G?i:G,Q=t.autoFocus,V=t.disabled,X=void 0!==V&&V,Y=t.patchCommentCallback,Z=void 0===Y?i:Y,$=t.postCommentCallback,tt=void 0===$?i:$,et=t.exitEditMode,nt=void 0===et?i:et,ot=t.companyId,it=void 0===ot?null:ot,at=t.currentUser,rt=void 0===at?B:at,lt=t.isNative,mt=void 0===lt?A:lt,dt=t.classes,st=h({inputRef:a,editFeedItemId:S,editCommentId:R,editComment:P,editAttachment:_,postComment:z,setIsPosting:q,setIsEditting:W,patchCommentCallback:Z,postCommentCallback:tt,exitEditMode:nt}),pt=st.state,ct=st.update,ut=st.imperativeHandle,ht=st.handleSendComment,gt=st.handleKeyDown,ft=st.handleSelectEmoji,Ct=st.handleAttachmentLoadingError,vt=st.handleFileUpload,It=st.handleFileDelete,bt=st.handleCancelClick;e(n,(function(){return ut}),[ut]);var xt="".concat(c(rt,["attributes","first_name"])||c(rt,"first_name")," ").concat(c(rt,["attributes","last_name"])||c(rt,"last_name")),Ft=pt.isInputFocused||pt.attachmentUrl||pt.comment||P||(null==_?void 0:_.url);return E("div",{style:H?j.commentTextFieldContainerSpaceAround:j.commentTextFieldContainer,children:[N("div",{style:j.chatAvatarWrapper,children:N(f,{displayName:xt,size:32,imgSrc:rt&&rt.profile_photo})}),N(r,{className:dt.paperRoot,children:N(l,{"data-testid":"".concat("commentInput","_input"),placeholder:"Type Comment",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:b,inputProps:{onChange:function(t){return ct({comment:t})},singleLine:!0,value:pt.comment||"",inputRef:a,withLightTheme:!1,onMount:J,companyId:it,autoFocus:Q,disabled:X,onFocus:function(){return ct({isInputFocused:!0})},onBlur:function(){return ct({isInputFocused:!1})},allowSuggestionsAboveCursor:!0},endAdornment:!mt&&E(m,{position:"end",className:dt.inputAdornment,children:[!pt.attachmentUrl&&N("div",{className:p(g.cCommentInputIconContainer,g.cCommentInputIconUpload),children:N(C,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:vt,onError:Ct,fileUploadIconClassName:dt.additionalActionButton,htmlColor:u[400],inputId:"comment-attachment-".concat(R||k),tooltipProps:{title:"Attach File",classes:{tooltip:dt.iconTooltip},placement:"top"}})}),N("div",{className:g.cCommentInputIconContainer,children:N(v,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:ft,emojiIconClassName:dt.additionalActionButton,htmlColor:u[400],disableRipple:!0,tooltipProps:{title:"Add Emoji",classes:{tooltip:dt.iconTooltip},placement:"top"}})})]}),disableUnderline:!0,classes:{root:dt.inputRoot,input:dt.inputEl}},className:dt.input,onKeyDown:gt})}),pt.attachmentLoadingError&&N(I,{errorMessage:pt.attachmentLoadingError,className:dt.fileUploadingError}),pt.attachmentUrl&&N(x,{fileName:pt.attachmentName,fileUrl:pt.attachmentUrl,handleFileDelete:It,classes:dt}),N(d,{in:Ft,mountOnEnter:!0,unmountOnExit:!0,children:E("div",{className:g.cCommentInputSendContainer,children:[N("div",{className:g.cCommentInputSendContainerCancel,children:N(s,{"data-testid":"".concat("commentInput","_cancel"),variant:"caption",className:p(dt.inputMain,dt.cancelText,dt.highlightedLabel),component:"div",gutterBottom:!0,onClick:bt,children:"Cancel"})}),E("div",{className:g.cCommentInputSendContainerSend,children:[E(s,{variant:"caption",className:p(dt.inputMain,dt.inputHelper),component:"div",gutterBottom:!0,children:["Press ",N(s,{variant:"caption",color:"primary",className:p(dt.inputMain,dt.highlightedLabel),children:"Enter"})," to send"]}),N(F,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:ht,classes:{root:dt.sendButton},children:N(y,{})})]})]})})]})})),S={inputRef:o.shape({current:o.shape({focus:o.shape({})})}),editFeedItemId:o.number,editCommentId:o.number,editComment:o.string,editAttachment:o.shape({url:o.string,size:o.number,file_name:o.string}),spaceAround:o.bool,postComment:o.func.isRequired,postCommentCallback:o.func,patchCommentCallback:o.func,exitEditMode:o.func,setIsPosting:o.func,setIsEditting:o.func,onMount:o.func,autoFocus:o.bool,disabled:o.bool,classes:o.shape({}).isRequired,currentUser:o.shape(),isNative:o.bool,companyId:o.number,parentId:o.string};U.propTypes=S;var T=a((function(t){return{paperRoot:{width:"calc(100% - 48px)",marginLeft:48,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none",background:"#4D4D4D"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"8px",lineHeight:"29px",paddingLeft:"8px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"6px"},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}},inputAdornment:{marginBottom:"0!important",height:"100%"}}}))(n(U));export{T as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/CommentInput/index.js"],"sourcesContent":["import { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport noop from 'lodash/noop';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapse, Typography, TextField, InputAdornment, Paper } from '@material-ui/core';\nimport classNames from 'classnames';\nimport { get } from 'lodash';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { patchFeedItemComment } from '../../clients/jsonApi';\n\nimport styles from './styles.css';\n\nimport Avatar from '~components/Avatar';\nimport FileUploadIconButton from '~components/FileUploadIconButton';\nimport EmojiIconButton from '~components/EmojiIconButton';\nimport FailedFileUploading from '~components/FailedFileUploading';\nimport UserMention from '~components/UserMention';\nimport FilePreview from '~components/FilePreview';\nimport IconButton from '~components/IconButton';\nimport SendIcon from '~components/Icons/SendIcon';\nimport { isSuggestionsListOpened } from '~components/UserMention/utils';\nimport utils from '~utils/main';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { notifyCommentEdit, notifyCommentPost } from '~utils/nativeMessages'; // question here\n\nconst PAGE_NAME = 'commentInput';\n\nconst INPUT_HEIGHT = 32;\nconst AVATAR_SIZE = 32;\n\nconst style = {\n chatAvatarWrapper: {\n display: 'flex',\n alignItems: 'center',\n position: 'absolute',\n left: 0,\n height: INPUT_HEIGHT,\n },\n commentTextFieldContainer: { position: 'relative', margin: '0' },\n commentTextFieldContainerSpaceAround: { position: 'relative', margin: '20px 10px' },\n};\n\nconst muiStyles = theme => ({\n paperRoot: {\n width: 'calc(100% - 48px)',\n marginLeft: AVATAR_SIZE + 16,\n display: 'inline-block',\n height: INPUT_HEIGHT,\n border: '0',\n '&:focus-within': {\n boxShadow: `inset 0 0 0 2px ${theme.palette.primary.main}`,\n },\n boxShadow: 'none',\n background: '#4D4D4D',\n },\n input: {\n paddingLeft: 5,\n width: '100%',\n },\n inputRoot: {\n height: INPUT_HEIGHT,\n paddingRight: '8px',\n lineHeight: '29px',\n paddingLeft: '8px',\n },\n inputEl: { padding: '0 0 0 6px', height: '100%' },\n additionalActionButton: {\n padding: '6px',\n },\n nativeActionButton: {\n margin: '5px 10px',\n cursor: 'pointer',\n },\n fileUploadingError: {\n marginTop: 10,\n marginLeft: 24,\n },\n inputMain: {\n marginBottom: 0,\n fontSize: '11px',\n color: theme.palette.primary.text8,\n },\n inputHelper: {\n display: 'flex',\n paddingRight: 5,\n },\n cancelText: {\n cursor: 'pointer',\n },\n highlightedLabel: {\n color: theme.palette.primary.main,\n },\n iconTooltip: {\n marginTop: '3px',\n },\n sendButton: {\n '&:hover': {\n backgroundColor: 'rgba(3,188,212, 0.1)',\n },\n '&.MuiButtonBase-root': {\n padding: 7,\n },\n },\n inputAdornment: {\n marginBottom: '0!important',\n height: '100%',\n },\n});\n\nclass CommentInput extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n\n attachmentLoadingError: null,\n isInputFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.isEditMode) {\n this.setInitialCommentValue();\n }\n }\n\n componentDidUpdate(prevProps) {\n const enteredEditMode = this.isEditMode && !prevProps.editFeedItemId;\n if (\n enteredEditMode ||\n (this.props.editCommentId && this.props.editCommentId !== prevProps.editCommentId)\n ) {\n this.setInitialCommentValue();\n }\n }\n\n get isEditMode() {\n return !!this.props.editFeedItemId;\n }\n\n setInitialCommentValue() {\n const attachmentUrl = this.props.editAttachment ? this.props.editAttachment.url : null;\n\n this.setState({\n comment: this.props.editComment,\n attachmentUrl,\n attachmentName: attachmentUrl\n ? this.props.editAttachment.file_name ||\n utils.getFileNameWithExtensionFromPath(attachmentUrl)\n : null,\n attachmentSize: this.props.editAttachment ? this.props.editAttachment.size : null,\n });\n }\n\n handleSelectEmoji = emoji =>\n this.setState(({ comment }) => ({ comment: `${comment}${emoji.native}` }));\n\n postComment = async comment => {\n let commentResponse;\n try {\n commentResponse = await this.props.postComment(comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n patchComment = async comment => {\n const { editFeedItemId, editCommentId } = this.props;\n\n let commentResponse;\n\n try {\n commentResponse = await patchFeedItemComment(editFeedItemId, editCommentId, comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n focusOnRef() {\n if (this.props.inputRef) this.props.inputRef.current.focus();\n }\n\n clearCommentField = callback => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n () => {\n this.focusOnRef();\n if (callback && typeof callback === 'function') callback();\n }\n );\n };\n\n handleKeyDown = event => {\n const { key } = event;\n\n if (key === 'Escape') this.props.exitEditMode();\n\n if (key === 'Enter') {\n if (!isSuggestionsListOpened()) {\n event.preventDefault();\n this.handleSendComment();\n }\n }\n };\n\n handleAttachmentLoadingError = attachmentLoadingError => {\n this.setState({\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n attachmentLoadingError,\n });\n };\n\n handleFileUpload = (attachmentUrl, attachmentName, attachmentSize) => {\n this.setState({\n attachmentUrl,\n attachmentName,\n attachmentSize,\n attachmentLoadingError: null,\n });\n };\n\n handleNativeFileUpload = () => {\n const { comment } = this.state;\n\n if (this.isEditMode) {\n notifyCommentEdit(comment);\n this.clearCommentField(this.props.exitEditMode);\n } else {\n notifyCommentPost(comment);\n this.clearCommentField();\n }\n };\n\n handleFileDelete = () =>\n this.setState({ attachmentUrl: null, attachmentName: null, attachmentSize: null });\n\n handleSendComment = async () => {\n const textComment = this.state.comment ? this.state.comment.trim() : null;\n if (!textComment && !this.state.attachmentUrl) return;\n\n const comment = {\n comment: {\n body: textComment,\n attachment: {\n url: this.state.attachmentUrl,\n size: this.state.attachmentSize,\n file_name: this.state.attachmentName,\n },\n },\n };\n\n let commentResponse;\n\n if (this.isEditMode) {\n this.props.setIsEditting(true);\n\n commentResponse = await this.patchComment(comment);\n await this.props.patchCommentCallback(commentResponse);\n\n this.props.setIsEditting(false);\n this.clearCommentField();\n this.props.exitEditMode();\n } else {\n this.props.setIsPosting(true);\n\n commentResponse = await this.postComment(comment);\n await this.props.postCommentCallback(commentResponse);\n\n this.props.setIsPosting(false);\n this.clearCommentField();\n }\n };\n\n handleCancelClick = () => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n this.props.exitEditMode()\n );\n };\n\n render() {\n const { classes, currentUser } = this.props;\n\n const currentUserFullName = `${\n get(currentUser, ['attributes', 'first_name']) || get(currentUser, 'first_name')\n } ${get(currentUser, ['attributes', 'last_name']) || get(currentUser, 'last_name')}`;\n\n const isVisibleActionBar =\n this.state.isInputFocused ||\n this.state.attachmentUrl ||\n this.state.comment ||\n this.props.editComment ||\n this.props.editAttachment?.url;\n\n return (\n <div\n style={\n this.props.spaceAround\n ? style.commentTextFieldContainerSpaceAround\n : style.commentTextFieldContainer\n }\n >\n <div style={style.chatAvatarWrapper}>\n <Avatar\n displayName={currentUserFullName}\n size={AVATAR_SIZE}\n imgSrc={this.props.currentUser && this.props.currentUser.profile_photo}\n />\n </div>\n <Paper className={this.props.classes.paperRoot}>\n <TextField\n data-testid={`${PAGE_NAME}_input`}\n placeholder=\"Type Comment\"\n FormHelperTextProps={{\n component: 'div',\n margin: 'dense',\n }}\n InputProps={{\n inputComponent: UserMention,\n inputProps: {\n onChange: comment => this.setState({ comment }),\n singleLine: true,\n value: this.state.comment || '',\n inputRef: this.props.inputRef,\n withLightTheme: false,\n onMount: this.props.onMount,\n companyId: this.props.companyId,\n autoFocus: this.props.autoFocus,\n disabled: this.props.disabled,\n onFocus: () => this.setState({ isInputFocused: true }),\n onBlur: () => this.setState({ isInputFocused: false }),\n allowSuggestionsAboveCursor: true,\n },\n endAdornment: !this.props.isNative && (\n <InputAdornment position=\"end\" className={this.props.classes.inputAdornment}>\n {!this.state.attachmentUrl && (\n <div\n className={classNames(\n styles.cCommentInputIconContainer,\n styles.cCommentInputIconUpload\n )}\n >\n <FileUploadIconButton\n openPreviewDialogOnUpload={false}\n disableRipple\n onFinish={this.handleFileUpload}\n onError={this.handleAttachmentLoadingError}\n fileUploadIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n inputId={`comment-attachment-${\n this.props.editCommentId || this.props.parentId\n }`}\n tooltipProps={{\n title: 'Attach File',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n )}\n <div className={styles.cCommentInputIconContainer}>\n <EmojiIconButton\n data-testid={`${PAGE_NAME}_emojiButton`}\n handleSelectEmoji={this.handleSelectEmoji}\n emojiIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n disableRipple\n tooltipProps={{\n title: 'Add Emoji',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n </InputAdornment>\n ),\n disableUnderline: true,\n classes: {\n root: this.props.classes.inputRoot,\n input: this.props.classes.inputEl,\n },\n }}\n className={this.props.classes.input}\n onKeyDown={this.handleKeyDown}\n />\n </Paper>\n\n {this.state.attachmentLoadingError && (\n <FailedFileUploading\n errorMessage={this.state.attachmentLoadingError}\n className={this.props.classes.fileUploadingError}\n />\n )}\n\n {this.state.attachmentUrl && (\n <FilePreview\n fileName={this.state.attachmentName}\n fileUrl={this.state.attachmentUrl}\n handleFileDelete={this.handleFileDelete}\n classes={this.props.classes}\n />\n )}\n <Collapse in={isVisibleActionBar} mountOnEnter unmountOnExit>\n <div className={styles.cCommentInputSendContainer}>\n <div className={styles.cCommentInputSendContainerCancel}>\n <Typography\n data-testid={`${PAGE_NAME}_cancel`}\n variant=\"caption\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.cancelText,\n this.props.classes.highlightedLabel\n )}\n component=\"div\"\n gutterBottom\n onClick={this.handleCancelClick}\n >\n Cancel\n </Typography>\n </div>\n <div className={styles.cCommentInputSendContainerSend}>\n <Typography\n variant=\"caption\"\n className={classNames(this.props.classes.inputMain, this.props.classes.inputHelper)}\n component=\"div\"\n gutterBottom\n >\n Press&nbsp;\n <Typography\n variant=\"caption\"\n color=\"primary\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.highlightedLabel\n )}\n >\n Enter\n </Typography>\n &nbsp;to send\n </Typography>\n <IconButton\n size=\"large\"\n tooltipProps={{ title: 'Send' }}\n data-testid={`${PAGE_NAME}_sendButton`}\n onClick={this.handleSendComment}\n classes={{ root: this.props.classes.sendButton }}\n >\n <SendIcon />\n </IconButton>\n </div>\n </div>\n </Collapse>\n </div>\n );\n }\n}\n\nCommentInput.propTypes = {\n inputRef: PropTypes.shape({ current: PropTypes.shape({ focus: PropTypes.shape({}) }) }),\n editFeedItemId: PropTypes.number,\n editCommentId: PropTypes.number,\n editComment: PropTypes.string,\n editAttachment: PropTypes.shape({\n url: PropTypes.string,\n size: PropTypes.number,\n file_name: PropTypes.string,\n }),\n spaceAround: PropTypes.bool,\n postComment: PropTypes.func.isRequired,\n postCommentCallback: PropTypes.func,\n patchCommentCallback: PropTypes.func,\n exitEditMode: PropTypes.func,\n setIsPosting: PropTypes.func,\n setIsEditting: PropTypes.func,\n onMount: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n\n currentUser: PropTypes.shape(),\n isNative: PropTypes.bool,\n companyId: PropTypes.number,\n parentId: PropTypes.string,\n};\n\nCommentInput.defaultProps = {\n inputRef: null,\n editFeedItemId: null,\n editCommentId: null,\n parentId: null,\n editComment: null,\n editAttachment: {},\n spaceAround: false,\n setIsPosting: noop,\n setIsEditting: noop,\n onMount: noop,\n autoFocus: undefined,\n disabled: false,\n patchCommentCallback: noop,\n postCommentCallback: noop,\n exitEditMode: noop,\n companyId: null,\n currentUser: {},\n\n isNative: isNativeDetected,\n};\n\nexport default withStyles(muiStyles)(CommentInput);\n"],"names":["style","chatAvatarWrapper","display","alignItems","position","left","height","commentTextFieldContainer","margin","commentTextFieldContainerSpaceAround","CommentInput","_PureComponent","_inherits","PureComponent","_super","_createSuper","props","_this","_ref2","_ref3","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","emoji","setState","_ref","comment","native","_asyncToGenerator","_regeneratorRuntime","mark","commentResponse","wrap","_context","prev","next","postComment","sent","t0","console","error","message","abrupt","stop","_callee","_x","apply","arguments","_this$props","editFeedItemId","editCommentId","_context2","patchFeedItemComment","_callee2","_x2","callback","attachmentUrl","attachmentName","attachmentSize","focusOnRef","event","key","exitEditMode","isSuggestionsListOpened","preventDefault","handleSendComment","attachmentLoadingError","state","isEditMode","notifyCommentEdit","clearCommentField","notifyCommentPost","_callee3","textComment","_context3","trim","body","attachment","url","size","file_name","setIsEditting","patchComment","patchCommentCallback","setIsPosting","postCommentCallback","isInputFocused","_createClass","value","setInitialCommentValue","prevProps","get","editAttachment","editComment","utils","getFileNameWithExtensionFromPath","inputRef","current","focus","_this$props$editAttac","_this2","_this$props2","classes","currentUser","currentUserFullName","concat","isVisibleActionBar","_jsxs","spaceAround","children","_jsx","Avatar","displayName","imgSrc","profile_photo","Paper","className","paperRoot","TextField","placeholder","FormHelperTextProps","component","InputProps","inputComponent","UserMention","inputProps","onChange","singleLine","withLightTheme","onMount","companyId","autoFocus","disabled","onFocus","onBlur","allowSuggestionsAboveCursor","endAdornment","isNative","InputAdornment","inputAdornment","classNames","styles","cCommentInputIconContainer","cCommentInputIconUpload","FileUploadIconButton","openPreviewDialogOnUpload","disableRipple","onFinish","handleFileUpload","onError","handleAttachmentLoadingError","fileUploadIconClassName","additionalActionButton","htmlColor","grey","inputId","parentId","tooltipProps","title","tooltip","iconTooltip","placement","EmojiIconButton","handleSelectEmoji","emojiIconClassName","disableUnderline","root","inputRoot","input","inputEl","onKeyDown","handleKeyDown","FailedFileUploading","errorMessage","fileUploadingError","FilePreview","fileName","fileUrl","handleFileDelete","Collapse","in","mountOnEnter","unmountOnExit","cCommentInputSendContainer","cCommentInputSendContainerCancel","Typography","variant","inputMain","cancelText","highlightedLabel","gutterBottom","onClick","handleCancelClick","cCommentInputSendContainerSend","inputHelper","color","IconButton","sendButton","SendIcon","propTypes","PropTypes","shape","number","string","bool","func","isRequired","defaultProps","noop","undefined","isNativeDetected","CommentInput$1","withStyles","theme","width","marginLeft","AVATAR_SIZE","border","boxShadow","palette","primary","main","background","paddingLeft","paddingRight","lineHeight","padding","nativeActionButton","cursor","marginTop","marginBottom","fontSize","text8","backgroundColor"],"mappings":"m8DA0BA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,QAAS,OACTC,WAAY,SACZC,SAAU,WACVC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AAQC,OAEtDH,UAAW,OACXI,WAAY,WAEdtD,MAAO,CACLuD,YAAa,EACbT,MAAO,QAET/C,UAAW,CACTnK,OAjCiB,GAkCjB4N,aAAc,MACdC,WAAY,OACZF,YAAa,OAEftD,QAAS,CAAEyD,QAAS,YAAa9N,OAAQ,QACzCoJ,uBAAwB,CACtB0E,QAAS,OAEXC,mBAAoB,CAClB7N,OAAQ,WACR8N,OAAQ,WAEVtD,mBAAoB,CAClBuD,UAAW,GACXd,WAAY,IAEd5B,UAAW,CACT2C,aAAc,EACdC,SAAU,OACVpC,MAAOkB,EAAMM,QAAQC,QAAQY,OAE/BtC,YAAa,CACXlM,QAAS,OACTgO,aAAc,GAEhBpC,WAAY,CACVwC,OAAQ,WAEVvC,iBAAkB,CAChBM,MAAOkB,EAAMM,QAAQC,QAAQC,MAE/B7D,YAAa,CACXqE,UAAW,OAEbhC,WAAY,CACV,UAAW,CACToC,gBAAiB,wBAEnB,uBAAwB,CACtBP,QAAS,IAGbvF,eAAgB,CACd2F,aAAc,cACdlO,OAAQ,QAEX,GAqacgN,CAAsB5M"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/CommentInput/index.js"],"sourcesContent":["import { forwardRef, memo, useImperativeHandle } from 'react';\nimport PropTypes from 'prop-types';\nimport noop from 'lodash/noop';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapse, Typography, TextField, InputAdornment, Paper } from '@material-ui/core';\nimport classNames from 'classnames';\nimport { get } from 'lodash';\nimport grey from '@material-ui/core/colors/grey';\n\nimport useCommentInput from './useCommentInput';\n\nimport styles from './styles.css';\n\nimport Avatar from '~components/Avatar';\nimport FileUploadIconButton from '~components/FileUploadIconButton';\nimport EmojiIconButton from '~components/EmojiIconButton';\nimport FailedFileUploading from '~components/FailedFileUploading';\nimport UserMention from '~components/UserMention';\nimport FilePreview from '~components/FilePreview';\nimport IconButton from '~components/IconButton';\nimport SendIcon from '~components/Icons/SendIcon';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'commentInput';\n\nconst INPUT_HEIGHT = 32;\nconst AVATAR_SIZE = 32;\n\nconst style = {\n chatAvatarWrapper: {\n display: 'flex',\n alignItems: 'center',\n position: 'absolute',\n left: 0,\n height: INPUT_HEIGHT,\n },\n commentTextFieldContainer: { position: 'relative', margin: '0' },\n commentTextFieldContainerSpaceAround: { position: 'relative', margin: '20px 10px' },\n};\n\nconst muiStyles = theme => ({\n paperRoot: {\n width: 'calc(100% - 48px)',\n marginLeft: AVATAR_SIZE + 16,\n display: 'inline-block',\n height: INPUT_HEIGHT,\n border: '0',\n '&:focus-within': {\n boxShadow: `inset 0 0 0 2px ${theme.palette.primary.main}`,\n },\n boxShadow: 'none',\n background: '#4D4D4D',\n },\n input: {\n paddingLeft: 5,\n width: '100%',\n },\n inputRoot: {\n height: INPUT_HEIGHT,\n paddingRight: '8px',\n lineHeight: '29px',\n paddingLeft: '8px',\n },\n inputEl: { padding: '0 0 0 6px', height: '100%' },\n additionalActionButton: {\n padding: '6px',\n },\n nativeActionButton: {\n margin: '5px 10px',\n cursor: 'pointer',\n },\n fileUploadingError: {\n marginTop: 10,\n marginLeft: 24,\n },\n inputMain: {\n marginBottom: 0,\n fontSize: '11px',\n color: theme.palette.primary.text8,\n },\n inputHelper: {\n display: 'flex',\n paddingRight: 5,\n },\n cancelText: {\n cursor: 'pointer',\n },\n highlightedLabel: {\n color: theme.palette.primary.main,\n },\n iconTooltip: {\n marginTop: '3px',\n },\n sendButton: {\n '&:hover': {\n backgroundColor: 'rgba(3,188,212, 0.1)',\n },\n '&.MuiButtonBase-root': {\n padding: 7,\n },\n },\n inputAdornment: {\n marginBottom: '0!important',\n height: '100%',\n },\n});\n\nconst emptyObject = {};\n\nconst CommentInput = forwardRef(\n /** @param {PropTypes.InferProps<typeof propTypes>} props */ function CommentInput(\n {\n inputRef = null,\n editFeedItemId = null,\n editCommentId = null,\n parentId = null,\n editComment = null,\n editAttachment = emptyObject,\n spaceAround = false,\n postComment,\n setIsPosting = noop,\n setIsEditting = noop,\n onMount = noop,\n autoFocus,\n disabled = false,\n patchCommentCallback = noop,\n postCommentCallback = noop,\n exitEditMode = noop,\n companyId = null,\n currentUser = emptyObject,\n isNative = isNativeDetected,\n classes,\n },\n ref\n ) {\n const {\n state,\n update,\n imperativeHandle,\n handleSendComment,\n handleKeyDown,\n handleSelectEmoji,\n handleAttachmentLoadingError,\n handleFileUpload,\n handleFileDelete,\n handleCancelClick,\n } = useCommentInput({\n inputRef,\n editFeedItemId,\n editCommentId,\n editComment,\n editAttachment,\n postComment,\n setIsPosting,\n setIsEditting,\n patchCommentCallback,\n postCommentCallback,\n exitEditMode,\n });\n useImperativeHandle(ref, () => imperativeHandle, [imperativeHandle]);\n\n const currentUserFullName = `${\n get(currentUser, ['attributes', 'first_name']) || get(currentUser, 'first_name')\n } ${get(currentUser, ['attributes', 'last_name']) || get(currentUser, 'last_name')}`;\n\n const isVisibleActionBar =\n state.isInputFocused ||\n state.attachmentUrl ||\n state.comment ||\n editComment ||\n editAttachment?.url;\n\n return (\n <div\n style={\n spaceAround ? style.commentTextFieldContainerSpaceAround : style.commentTextFieldContainer\n }\n >\n <div style={style.chatAvatarWrapper}>\n <Avatar\n displayName={currentUserFullName}\n size={AVATAR_SIZE}\n imgSrc={currentUser && currentUser.profile_photo}\n />\n </div>\n <Paper className={classes.paperRoot}>\n <TextField\n data-testid={`${PAGE_NAME}_input`}\n placeholder=\"Type Comment\"\n FormHelperTextProps={{\n component: 'div',\n margin: 'dense',\n }}\n InputProps={{\n inputComponent: UserMention,\n inputProps: {\n onChange: comment => update({ comment }),\n singleLine: true,\n value: state.comment || '',\n inputRef: inputRef,\n withLightTheme: false,\n onMount: onMount,\n companyId: companyId,\n autoFocus: autoFocus,\n disabled: disabled,\n onFocus: () => update({ isInputFocused: true }),\n onBlur: () => update({ isInputFocused: false }),\n allowSuggestionsAboveCursor: true,\n },\n endAdornment: !isNative && (\n <InputAdornment position=\"end\" className={classes.inputAdornment}>\n {!state.attachmentUrl && (\n <div\n className={classNames(\n styles.cCommentInputIconContainer,\n styles.cCommentInputIconUpload\n )}\n >\n <FileUploadIconButton\n openPreviewDialogOnUpload={false}\n disableRipple\n onFinish={handleFileUpload}\n onError={handleAttachmentLoadingError}\n fileUploadIconClassName={classes.additionalActionButton}\n htmlColor={grey[400]}\n inputId={`comment-attachment-${editCommentId || parentId}`}\n tooltipProps={{\n title: 'Attach File',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n )}\n <div className={styles.cCommentInputIconContainer}>\n <EmojiIconButton\n data-testid={`${PAGE_NAME}_emojiButton`}\n handleSelectEmoji={handleSelectEmoji}\n emojiIconClassName={classes.additionalActionButton}\n htmlColor={grey[400]}\n disableRipple\n tooltipProps={{\n title: 'Add Emoji',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n </InputAdornment>\n ),\n disableUnderline: true,\n classes: {\n root: classes.inputRoot,\n input: classes.inputEl,\n },\n }}\n className={classes.input}\n onKeyDown={handleKeyDown}\n />\n </Paper>\n\n {state.attachmentLoadingError && (\n <FailedFileUploading\n errorMessage={state.attachmentLoadingError}\n className={classes.fileUploadingError}\n />\n )}\n\n {state.attachmentUrl && (\n <FilePreview\n fileName={state.attachmentName}\n fileUrl={state.attachmentUrl}\n handleFileDelete={handleFileDelete}\n classes={classes}\n />\n )}\n <Collapse in={isVisibleActionBar} mountOnEnter unmountOnExit>\n <div className={styles.cCommentInputSendContainer}>\n <div className={styles.cCommentInputSendContainerCancel}>\n <Typography\n data-testid={`${PAGE_NAME}_cancel`}\n variant=\"caption\"\n className={classNames(\n classes.inputMain,\n classes.cancelText,\n classes.highlightedLabel\n )}\n component=\"div\"\n gutterBottom\n onClick={handleCancelClick}\n >\n Cancel\n </Typography>\n </div>\n <div className={styles.cCommentInputSendContainerSend}>\n <Typography\n variant=\"caption\"\n className={classNames(classes.inputMain, classes.inputHelper)}\n component=\"div\"\n gutterBottom\n >\n Press&nbsp;\n <Typography\n variant=\"caption\"\n color=\"primary\"\n className={classNames(classes.inputMain, classes.highlightedLabel)}\n >\n Enter\n </Typography>\n &nbsp;to send\n </Typography>\n <IconButton\n size=\"large\"\n tooltipProps={{ title: 'Send' }}\n data-testid={`${PAGE_NAME}_sendButton`}\n onClick={handleSendComment}\n classes={{ root: classes.sendButton }}\n >\n <SendIcon />\n </IconButton>\n </div>\n </div>\n </Collapse>\n </div>\n );\n }\n);\n\nconst propTypes = {\n inputRef: PropTypes.shape({ current: PropTypes.shape({ focus: PropTypes.shape({}) }) }),\n editFeedItemId: PropTypes.number,\n editCommentId: PropTypes.number,\n editComment: PropTypes.string,\n editAttachment: PropTypes.shape({\n url: PropTypes.string,\n size: PropTypes.number,\n file_name: PropTypes.string,\n }),\n spaceAround: PropTypes.bool,\n postComment: PropTypes.func.isRequired,\n postCommentCallback: PropTypes.func,\n patchCommentCallback: PropTypes.func,\n exitEditMode: PropTypes.func,\n setIsPosting: PropTypes.func,\n setIsEditting: PropTypes.func,\n onMount: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n\n currentUser: PropTypes.shape(),\n isNative: PropTypes.bool,\n companyId: PropTypes.number,\n parentId: PropTypes.string,\n};\n\nCommentInput.propTypes = propTypes;\n\nexport default withStyles(muiStyles)(memo(CommentInput));\n"],"names":["style","chatAvatarWrapper","display","alignItems","position","left","height","commentTextFieldContainer","margin","commentTextFieldContainerSpaceAround","emptyObject","CommentInput","forwardRef","ref","_ref$inputRef","_ref","inputRef","_ref$editFeedItemId","editFeedItemId","_ref$editCommentId","editCommentId","_ref$parentId","parentId","_ref$editComment","editComment","_ref$editAttachment","editAttachment","_ref$spaceAround","spaceAround","postComment","_ref$setIsPosting","setIsPosting","noop","_ref$setIsEditting","setIsEditting","_ref$onMount","onMount","autoFocus","_ref$disabled","disabled","_ref$patchCommentCall","patchCommentCallback","_ref$postCommentCallb","postCommentCallback","_ref$exitEditMode","exitEditMode","_ref$companyId","companyId","_ref$currentUser","currentUser","_ref$isNative","isNative","isNativeDetected","classes","_useCommentInput","useCommentInput","state","update","imperativeHandle","handleSendComment","handleKeyDown","handleSelectEmoji","handleAttachmentLoadingError","handleFileUpload","handleFileDelete","handleCancelClick","useImperativeHandle","currentUserFullName","get","concat","isVisibleActionBar","isInputFocused","attachmentUrl","comment","url","_jsxs","children","_jsx","Avatar","displayName","size","imgSrc","profile_photo","Paper","className","paperRoot","TextField","placeholder","FormHelperTextProps","component","InputProps","inputComponent","UserMention","inputProps","onChange","singleLine","value","withLightTheme","onFocus","onBlur","allowSuggestionsAboveCursor","endAdornment","InputAdornment","inputAdornment","classNames","styles","cCommentInputIconContainer","cCommentInputIconUpload","FileUploadIconButton","openPreviewDialogOnUpload","disableRipple","onFinish","onError","fileUploadIconClassName","additionalActionButton","htmlColor","grey","inputId","tooltipProps","title","tooltip","iconTooltip","placement","EmojiIconButton","emojiIconClassName","disableUnderline","root","inputRoot","input","inputEl","onKeyDown","attachmentLoadingError","FailedFileUploading","errorMessage","fileUploadingError","FilePreview","fileName","attachmentName","fileUrl","Collapse","in","mountOnEnter","unmountOnExit","cCommentInputSendContainer","cCommentInputSendContainerCancel","Typography","variant","inputMain","cancelText","highlightedLabel","gutterBottom","onClick","cCommentInputSendContainerSend","inputHelper","color","IconButton","sendButton","SendIcon","propTypes","PropTypes","shape","current","focus","number","string","file_name","bool","func","isRequired","withStyles","theme","width","marginLeft","AVATAR_SIZE","border","boxShadow","palette","primary","main","background","paddingLeft","paddingRight","lineHeight","padding","nativeActionButton","cursor","marginTop","marginBottom","fontSize","text8","backgroundColor","memo"],"mappings":"y3BAuBA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,QAAS,OACTC,WAAY,SACZC,SAAU,WACVC,KAAM,EACNC,OATiB,IAWnBC,0BAA2B,CAAEH,SAAU,WAAYI,OAAQ,KAC3DC,qCAAsC,CAAEL,SAAU,WAAYI,OAAQ,cAsElE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ACTI,OApBiB,GAqBjBwK,OAAQ,IACR,iBAAkB,CAChBC,oCAA8BL,EAAMM,QAAQC,QAAQC,OAEtDH,UAAW,OACXI,WAAY,WAEdnD,MAAO,CACLoD,YAAa,EACbT,MAAO,QAET5C,UAAW,CACTzH,OAjCiB,GAkCjB+K,aAAc,MACdC,WAAY,OACZF,YAAa,OAEfnD,QAAS,CAAEsD,QAAS,YAAajL,OAAQ,QACzC4G,uBAAwB,CACtBqE,QAAS,OAEXC,mBAAoB,CAClBhL,OAAQ,WACRiL,OAAQ,WAEVnD,mBAAoB,CAClBoD,UAAW,GACXd,WAAY,IAEdzB,UAAW,CACTwC,aAAc,EACdC,SAAU,OACVlC,MAAOgB,EAAMM,QAAQC,QAAQY,OAE/BpC,YAAa,CACXvJ,QAAS,OACTmL,aAAc,GAEhBjC,WAAY,CACVqC,OAAQ,WAEVpC,iBAAkB,CAChBK,MAAOgB,EAAMM,QAAQC,QAAQC,MAE/BzD,YAAa,CACXiE,UAAW,OAEb9B,WAAY,CACV,UAAW,CACTkC,gBAAiB,wBAEnB,uBAAwB,CACtBP,QAAS,IAGbhF,eAAgB,CACdoF,aAAc,cACdrL,OAAQ,QAEX,GA8PcmK,CAAsBsB,EAAKpL"}
@@ -0,0 +1,26 @@
1
+ export default function useCommentInput(props: any): {
2
+ state: {
3
+ comment: string;
4
+ attachmentUrl: null;
5
+ attachmentName: null;
6
+ attachmentSize: null;
7
+ attachmentLoadingError: null;
8
+ isInputFocused: boolean;
9
+ };
10
+ update: (patch: any) => void;
11
+ imperativeHandle: {
12
+ clearCommentField: (callback: any) => void;
13
+ focusOnRef: () => void;
14
+ setInitialCommentValue: () => void;
15
+ handleNativeFileUpload: () => void;
16
+ handleSendComment: () => Promise<void>;
17
+ };
18
+ handleSendComment: () => Promise<void>;
19
+ handleKeyDown: (event: any) => void;
20
+ handleSelectEmoji: (emoji: any) => void;
21
+ handleAttachmentLoadingError: (attachmentLoadingError: any) => void;
22
+ handleFileUpload: (attachmentUrl: any, attachmentName: any, attachmentSize: any) => void;
23
+ handleFileDelete: () => void;
24
+ handleCancelClick: () => void;
25
+ };
26
+ //# sourceMappingURL=useCommentInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCommentInput.d.ts","sourceRoot":"","sources":["../../../src/components/CommentInput/useCommentInput.js"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,KAAA;;;;;;;;;;;;;;;;;;;;;;;;EAuJ5C"}
@@ -0,0 +1,2 @@
1
+ import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/regenerator";import{useState as a,useRef as c,useCallback as o,useLayoutEffect as i}from"react";import{patchFeedItemComment as m}from"../../clients/jsonApi/index.js";import{isSuggestionsListOpened as u}from"../UserMention/utils/index.js";import s from"../../utils/main.js";import{notifyCommentEdit as l,notifyCommentPost as p}from"../../utils/nativeMessages.js";function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function f(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?d(Object(r),!0).forEach((function(n){e(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var h={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null};function b(e){var d=a(f(f({},h),{},{attachmentLoadingError:null,isInputFocused:!1})),b=n(d,2),v=b[0],I=b[1],y=c({props:e,state:v}),g=c(null),x=c([]),O=o((function(t){return I((function(e){return f(f({},e),t)}))}),[]),j=function(){y.current.props.inputRef&&y.current.props.inputRef.current.focus()},E=function(){var t=y.current.props,e=t.editAttachment?t.editAttachment.url:null;O({comment:t.editComment,attachmentUrl:e,attachmentName:e?t.editAttachment.file_name||s.getFileNameWithExtensionFromPath(e):null,attachmentSize:t.editAttachment?t.editAttachment.size:null})};i((function(){y.current={props:e,state:v};var t=g.current;g.current=e,(!t&&e.editFeedItemId||e.editFeedItemId&&t&&!t.editFeedItemId||t&&e.editCommentId&&e.editCommentId!==t.editCommentId)&&E();var n=x.current;x.current=[],n.forEach((function(t){var e=t.focus,n=t.callback;e&&j(),"function"==typeof n&&n()}))}));var C,k=function(t){x.current.push({focus:!0,callback:t}),O(h)},F=(C=t(r.mark((function t(){var e,n,a,c,o,i,u;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=y.current,(n=e.state.comment?e.state.comment.trim():null)||e.state.attachmentUrl){t.next=4;break}return t.abrupt("return");case 4:if(a={comment:{body:n,attachment:{url:e.state.attachmentUrl,size:e.state.attachmentSize,file_name:e.state.attachmentName}}},!e.props.editFeedItemId){t.next=24;break}return e.props.setIsEditting(!0),t.prev=7,o=y.current.props,i=o.editFeedItemId,u=o.editCommentId,t.next=11,m(i,u,a);case 11:c=t.sent,t.next=17;break;case 14:t.prev=14,t.t0=t.catch(7),console.error(t.t0.message);case 17:return t.next=19,y.current.props.patchCommentCallback(c);case 19:y.current.props.setIsEditting(!1),k(),y.current.props.exitEditMode(),t.next=38;break;case 24:return e.props.setIsPosting(!0),t.prev=25,t.next=28,y.current.props.postComment(a);case 28:c=t.sent,t.next=34;break;case 31:t.prev=31,t.t1=t.catch(25),console.error(t.t1.message);case 34:return t.next=36,y.current.props.postCommentCallback(c);case 36:y.current.props.setIsPosting(!1),k();case 38:case"end":return t.stop()}}),t,null,[[7,14],[25,31]])}))),function(){return C.apply(this,arguments)}),P=c({clearCommentField:k,focusOnRef:j,setInitialCommentValue:E,handleNativeFileUpload:function(){var t=y.current;t.props.editFeedItemId?(l(t.state.comment),k(y.current.props.exitEditMode)):(p(t.state.comment),k())},handleSendComment:F}),S=o((function(t){return I((function(e){return f(f({},e),{},{comment:"".concat(e.comment).concat(t.native)})}))}),[]),U=o((function(t){return O({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})}),[O]),w=o((function(t,e,n){return O({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})}),[O]);return{state:v,update:O,imperativeHandle:P.current,handleSendComment:F,handleKeyDown:function(t){"Escape"===t.key&&y.current.props.exitEditMode(),"Enter"!==t.key||u()||(t.preventDefault(),F())},handleSelectEmoji:S,handleAttachmentLoadingError:U,handleFileUpload:w,handleFileDelete:function(){return O({attachmentUrl:null,attachmentName:null,attachmentSize:null})},handleCancelClick:function(){var t=y.current.props.exitEditMode();"function"==typeof t&&x.current.push({callback:t}),O(h)}}}export{b as default};
2
+ //# sourceMappingURL=useCommentInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCommentInput.js","sources":["../../../src/components/CommentInput/useCommentInput.js"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { patchFeedItemComment } from '../../clients/jsonApi';\nimport { isSuggestionsListOpened } from '~components/UserMention/utils';\nimport utils from '~utils/main';\nimport { notifyCommentEdit, notifyCommentPost } from '~utils/nativeMessages';\n\nconst clearedComment = {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n};\n\nexport default function useCommentInput(props) {\n const [state, setState] = useState({\n ...clearedComment,\n attachmentLoadingError: null,\n isInputFocused: false,\n });\n const latest = useRef({ props, state });\n const previousProps = useRef(null);\n const afterCommit = useRef([]);\n const update = useCallback(patch => setState(current => ({ ...current, ...patch })), []);\n const focusOnRef = () => {\n if (latest.current.props.inputRef) latest.current.props.inputRef.current.focus();\n };\n const setInitialCommentValue = () => {\n const current = latest.current.props;\n const attachmentUrl = current.editAttachment ? current.editAttachment.url : null;\n update({\n comment: current.editComment,\n attachmentUrl,\n attachmentName: attachmentUrl\n ? current.editAttachment.file_name || utils.getFileNameWithExtensionFromPath(attachmentUrl)\n : null,\n attachmentSize: current.editAttachment ? current.editAttachment.size : null,\n });\n };\n\n useLayoutEffect(() => {\n latest.current = { props, state };\n const previous = previousProps.current;\n previousProps.current = props;\n if (\n (!previous && props.editFeedItemId) ||\n (props.editFeedItemId && previous && !previous.editFeedItemId) ||\n (previous && props.editCommentId && props.editCommentId !== previous.editCommentId)\n ) {\n setInitialCommentValue();\n }\n const pending = afterCommit.current;\n afterCommit.current = [];\n pending.forEach(({ focus, callback }) => {\n if (focus) focusOnRef();\n if (typeof callback === 'function') callback();\n });\n });\n\n const clearCommentField = callback => {\n afterCommit.current.push({ focus: true, callback });\n update(clearedComment);\n };\n const handleNativeFileUpload = () => {\n const current = latest.current;\n if (current.props.editFeedItemId) {\n notifyCommentEdit(current.state.comment);\n clearCommentField(latest.current.props.exitEditMode);\n } else {\n notifyCommentPost(current.state.comment);\n clearCommentField();\n }\n };\n const handleSendComment = async () => {\n const current = latest.current;\n const textComment = current.state.comment ? current.state.comment.trim() : null;\n if (!textComment && !current.state.attachmentUrl) return;\n const payload = {\n comment: {\n body: textComment,\n attachment: {\n url: current.state.attachmentUrl,\n size: current.state.attachmentSize,\n file_name: current.state.attachmentName,\n },\n },\n };\n let response;\n if (current.props.editFeedItemId) {\n current.props.setIsEditting(true);\n try {\n const { editFeedItemId, editCommentId } = latest.current.props;\n response = await patchFeedItemComment(editFeedItemId, editCommentId, payload);\n } catch (error) {\n console.error(error.message);\n }\n await latest.current.props.patchCommentCallback(response);\n latest.current.props.setIsEditting(false);\n clearCommentField();\n latest.current.props.exitEditMode();\n } else {\n current.props.setIsPosting(true);\n try {\n response = await latest.current.props.postComment(payload);\n } catch (error) {\n console.error(error.message);\n }\n await latest.current.props.postCommentCallback(response);\n latest.current.props.setIsPosting(false);\n clearCommentField();\n }\n };\n\n const imperativeHandle = useRef({\n clearCommentField,\n focusOnRef,\n setInitialCommentValue,\n handleNativeFileUpload,\n handleSendComment,\n });\n\n const handleSelectEmoji = useCallback(\n emoji => setState(current => ({ ...current, comment: `${current.comment}${emoji.native}` })),\n []\n );\n const handleAttachmentLoadingError = useCallback(\n attachmentLoadingError =>\n update({\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n attachmentLoadingError,\n }),\n [update]\n );\n const handleFileUpload = useCallback(\n (attachmentUrl, attachmentName, attachmentSize) =>\n update({ attachmentUrl, attachmentName, attachmentSize, attachmentLoadingError: null }),\n [update]\n );\n\n return {\n state,\n update,\n imperativeHandle: imperativeHandle.current,\n handleSendComment,\n handleKeyDown: event => {\n if (event.key === 'Escape') latest.current.props.exitEditMode();\n if (event.key === 'Enter' && !isSuggestionsListOpened()) {\n event.preventDefault();\n handleSendComment();\n }\n },\n handleSelectEmoji,\n handleAttachmentLoadingError,\n handleFileUpload,\n handleFileDelete: () =>\n update({ attachmentUrl: null, attachmentName: null, attachmentSize: null }),\n handleCancelClick: () => {\n // The legacy cancel handler exits synchronously, before clearing commits.\n const callback = latest.current.props.exitEditMode();\n if (typeof callback === 'function') afterCommit.current.push({ callback });\n update(clearedComment);\n },\n };\n}\n"],"names":["clearedComment","comment","attachmentUrl","attachmentName","attachmentSize","useCommentInput","props","useState","attachmentLoadingError","isInputFocused","_useState2","_slicedToArray","_useState","state","setState","latest","useRef","previousProps","afterCommit","update","useCallback","patch","current","focusOnRef","inputRef","focus","setInitialCommentValue","editAttachment","url","editComment","file_name","utils","getFileNameWithExtensionFromPath","size","useLayoutEffect","previous","editFeedItemId","editCommentId","pending","forEach","_ref","callback","_ref2","clearCommentField","push","handleSendComment","_asyncToGenerator","_regeneratorRuntime","mark","_callee","textComment","payload","response","_latest$current$props","wrap","_context","prev","next","trim","abrupt","body","attachment","setIsEditting","patchFeedItemComment","sent","t0","console","error","message","patchCommentCallback","exitEditMode","setIsPosting","postComment","t1","postCommentCallback","stop","apply","this","arguments","imperativeHandle","handleNativeFileUpload","notifyCommentEdit","notifyCommentPost","handleSelectEmoji","emoji","_objectSpread","native","handleAttachmentLoadingError","handleFileUpload","handle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AZ,GAAsB,OACpBW,EAAO,CACLjB,cAAe,KACfC,eAAgB,KAChBC,eAAgB,KAChBI,uBAAAA,MAEJ,CAACW,IAEGqE,EAAmBpE,GACvB,SAAClB,EAAeC,EAAgBC,GAAc,OAC5Ce,EAAO,CAAEjB,cAAAA,EAAeC,eAAAA,EAAgBC,eAAAA,EAAgBI,uBAAwB,SAClF,CAACW,IAGH,MAAO,CACLN,MAAAA,EACAM,OAAAA,EACA4D,iBAAkBA,EAAiBzD,QACnCuB,kBAAAA,EACA4C,cAAe,SAAAC,GACK,WAAdA,EAAMC,KAAkB5E,EAAOO,QAAQhB,MAAMgE,eAC/B,UAAdoB,EAAMC,KAAoBC,MAC5BF,EAAMG,iBACNhD,IAEH,EACDsC,kBAAAA,EACAI,6BAAAA,EACAC,iBAAAA,EACAM,iBAAkB,WAAA,OAChB3E,EAAO,CAAEjB,cAAe,KAAMC,eAAgB,KAAMC,eAAgB,MAAO,EAC7E2F,kBAAmB,WAEjB,IAAMtD,EAAW1B,EAAOO,QAAQhB,MAAMgE,eACd,mBAAb7B,GAAyBvB,EAAYI,QAAQsB,KAAK,CAAEH,SAAAA,IAC/DtB,EAAOnB,EACT,EAEJ"}
@@ -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{background:var(--palette-background-b-6);border-radius:12px;display:flex;flex-direction:column;overflow:hidden;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{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{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{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};
2
2
  //# sourceMappingURL=CommentInputNext.scss.js.map
@@ -1,7 +1,7 @@
1
1
  import type { ComponentType, FC } from 'react';
2
2
  import type { AppCoordinates, ChatActions, DashboardAppLastAnnotation, DevCenterAppResource, DevCenterCurrentUser, DevCenterRouter, LayoutEnvironment, RegisterAITools, SetIsFullscreenModalMode, UpdateDashboardAppLastAnnotation } from './types';
3
3
  import type { FullscreenModes } from '../../../types';
4
- import type { GlobalOffsetWell } from '../../../componentsV2/AppCommonsProvider/AppCommonsContext';
4
+ import type { AppDashboardMeta } from '../../../componentsV2/AppCommonsProvider/AppCommonsContext';
5
5
  /**
6
6
  * `Partial<FullscreenModes>` carries the seven browser-fullscreen and separate-window members.
7
7
  * `AppCommonsProvider` derives `isExpanded` from them and republishes them to the app bundle,
@@ -26,14 +26,7 @@ export type DevCenterAppContainerProps = Partial<FullscreenModes> & {
26
26
  chatActions?: ChatActions | null;
27
27
  coordinates?: AppCoordinates | null;
28
28
  currentDashboardAppsLastAnnotations?: DashboardAppLastAnnotation[] | null;
29
- dashboardMeta?: {
30
- isMultiAsset?: boolean;
31
- isMultiWell?: boolean;
32
- isChiplessDashboard?: boolean;
33
- globalOffsetWells?: GlobalOffsetWell[];
34
- globalOffsetWellsVersion?: number;
35
- globalOffsetWellsToken?: number;
36
- };
29
+ dashboardMeta?: AppDashboardMeta;
37
30
  disableAppAssetSelection?: boolean;
38
31
  isActionsDisabled?: boolean;
39
32
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DevCenterAppContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA2B/C,OAAO,KAAK,EACV,cAAc,EAEd,WAAW,EACX,0BAA0B,EAC1B,o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,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC7C,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,gBAAgB,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IACvC,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uCAAuC,CAAC,EAAE,gCAAgC,CAAC;CAC5E,CAAC;AAKF,QAAA,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAkSzD,CAAC;eAEa,qBAAqB"}
1
+ {"version":3,"file":"DevCenterAppContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA2B/C,OAAO,KAAK,EACV,cAAc,EAEd,WAAW,EACX,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,wBAAwB,E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