@corva/ui 3.71.0-9 → 3.72.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs-bundle/components/AddComment/Popover.js +1 -1
- package/cjs-bundle/components/AddComment/Popover.js.map +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js +1 -1
- package/cjs-bundle/components/AddComment/components/Content.js.map +1 -1
- package/cjs-bundle/components/AttachFileButton/AttachFileButton.js +1 -1
- package/cjs-bundle/components/AttachFileButton/AttachFileButton.js.map +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/AttachmentRow.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentRow.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentTile.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/AttachmentTile.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/SortableAttachments.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/SortableAttachments.js.map +1 -0
- package/cjs-bundle/components/AttachmentPreview/StoredAttachmentPreview.js +1 -1
- package/cjs-bundle/components/AttachmentPreview/StoredAttachmentPreview.js.map +1 -1
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachments.js +2 -0
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachments.js.map +1 -0
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/CommentCard/CommentCard.js +1 -1
- package/cjs-bundle/components/CommentCard/CommentCard.js.map +1 -1
- package/cjs-bundle/components/CommentCard/CommentCardReplies.js +1 -1
- package/cjs-bundle/components/CommentCard/CommentCardReplies.js.map +1 -1
- package/cjs-bundle/components/CommentCard/buildCommentReply.js +1 -1
- package/cjs-bundle/components/CommentCard/buildCommentReply.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/CommentComposer.js +1 -1
- package/cjs-bundle/components/CommentComposer/CommentComposer.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/CommentReplyInput.js +1 -1
- package/cjs-bundle/components/CommentComposer/CommentReplyInput.js.map +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/cjs-bundle/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/cjs-bundle/components/CommentInputNext/CommentInputNext.js +1 -1
- package/cjs-bundle/components/CommentInputNext/CommentInputNext.js.map +1 -1
- package/cjs-bundle/components/CommentInputNext/CommentInputNext.scss.js +1 -1
- package/cjs-bundle/components/CommentInputNext/useFileDrop.js +2 -0
- package/cjs-bundle/components/CommentInputNext/useFileDrop.js.map +1 -0
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js +1 -1
- package/cjs-bundle/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/cjs-bundle/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/cjs-bundle/components/FeedCard/useActivityInteractions.js +1 -1
- package/cjs-bundle/components/FeedCard/useActivityInteractions.js.map +1 -1
- package/cjs-bundle/components/FeedCard/useFeedActivity.js +1 -1
- package/cjs-bundle/components/FeedCard/useFeedActivity.js.map +1 -1
- package/cjs-bundle/components/IconMenu/index.js +1 -1
- package/cjs-bundle/components/IconMenu/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/cjs-bundle/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/cjs-bundle/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
- package/cjs-bundle/components/index.js +1 -1
- package/cjs-bundle/componentsV2/AppContainer/AppContainer.scss.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.scss.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppTitle/AppTitle.js.map +1 -1
- package/cjs-bundle/componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.js +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.js.map +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/Autocomplete.scss.js +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/AutocompleteMenuItem.js +1 -1
- package/cjs-bundle/componentsV2/Autocomplete/AutocompleteMenuItem.js.map +1 -1
- package/cjs-bundle/componentsV2/Checkbox/Checkbox.js +1 -1
- package/cjs-bundle/componentsV2/Checkbox/Checkbox.js.map +1 -1
- package/cjs-bundle/componentsV2/ColorPicker/ColorPicker.scss.js +1 -1
- package/cjs-bundle/componentsV2/Menu/Menu.scss.js +1 -1
- package/cjs-bundle/componentsV2/Menu/MenuDivider/MenuDivider.scss.js +1 -1
- package/cjs-bundle/componentsV2/Menu/MenuGroup/MenuGroup.js +1 -1
- package/cjs-bundle/componentsV2/Menu/MenuGroup/MenuGroup.js.map +1 -1
- package/cjs-bundle/componentsV2/Menu/MenuGroup/MenuGroup.scss.js +1 -1
- package/cjs-bundle/componentsV2/Menu/MenuItem/MenuItem.js +1 -1
- package/cjs-bundle/componentsV2/Menu/MenuItem/MenuItem.js.map +1 -1
- package/cjs-bundle/componentsV2/Menu/MenuItem/MenuItem.scss.js +1 -1
- package/cjs-bundle/componentsV2/PadModeSelect/PadModeSelect.scss.js +1 -1
- package/cjs-bundle/componentsV2/Paper/Paper.js +1 -1
- package/cjs-bundle/componentsV2/Paper/Paper.js.map +1 -1
- package/cjs-bundle/componentsV2/Paper/Paper.scss.js +1 -1
- package/cjs-bundle/componentsV2/Popover/Popover.js +1 -1
- package/cjs-bundle/componentsV2/Popover/Popover.js.map +1 -1
- package/cjs-bundle/componentsV2/Radio/Radio.js +1 -1
- package/cjs-bundle/componentsV2/Radio/Radio.js.map +1 -1
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.js +2 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.js.map +1 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.scss.js +2 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.scss.js.map +1 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/RadioIcon.js +2 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/RadioIcon.js.map +1 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/RadioIcon.scss.js +2 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxIcons/RadioIcon.scss.js.map +1 -0
- package/cjs-bundle/componentsV2/RadioAndCheckboxLabel/RadioAndCheckboxLabel.scss.js +1 -1
- package/cjs-bundle/componentsV2/Tabs/Tabs.js +1 -1
- package/cjs-bundle/componentsV2/Tabs/Tabs.js.map +1 -1
- package/cjs-bundle/componentsV2/Tabs/Tabs.scss.js +1 -1
- package/cjs-bundle/componentsV2/TemplatesControl/ShareModal/ShareModal.js +1 -1
- package/cjs-bundle/componentsV2/TemplatesControl/ShareModal/ShareModal.js.map +1 -1
- package/cjs-bundle/componentsV2/TemplatesControl/ShareModal/ShareModal.scss.js +1 -1
- package/cjs-bundle/componentsV2/TemplatesControl/TemplatesTreeMenuHeader/TemplatesTreeMenuHeader.scss.js +1 -1
- package/cjs-bundle/componentsV2/TemplatesControl/Toggle/Toggle.scss.js +1 -1
- package/cjs-bundle/config/theme/checkboxOverrides.js +1 -1
- package/cjs-bundle/config/theme/checkboxOverrides.js.map +1 -1
- package/cjs-bundle/config/theme/index.js +1 -1
- package/cjs-bundle/config/theme/index.js.map +1 -1
- package/cjs-bundle/config/theme/radioOverrides.js +1 -1
- package/cjs-bundle/config/theme/radioOverrides.js.map +1 -1
- package/cjs-bundle/constants/attachments.js +2 -0
- package/cjs-bundle/constants/attachments.js.map +1 -0
- package/cjs-bundle/constants/index.js +1 -1
- package/components/AddComment/Popover.js +1 -1
- package/components/AddComment/Popover.js.map +1 -1
- package/components/AddComment/components/Content.js +1 -1
- package/components/AddComment/components/Content.js.map +1 -1
- package/components/AttachFileButton/AttachFileButton.d.ts +2 -1
- package/components/AttachFileButton/AttachFileButton.d.ts.map +1 -1
- package/components/AttachFileButton/AttachFileButton.js +1 -1
- package/components/AttachFileButton/AttachFileButton.js.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.d.ts +4 -0
- package/components/AttachmentPreview/AttachmentPreview.d.ts.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.js +1 -1
- package/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
- package/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
- package/components/AttachmentPreview/AttachmentPreview.types.d.ts +2 -0
- package/components/AttachmentPreview/AttachmentPreview.types.d.ts.map +1 -1
- package/components/AttachmentPreview/AttachmentRow.d.ts +5 -0
- package/components/AttachmentPreview/AttachmentRow.d.ts.map +1 -0
- package/components/AttachmentPreview/AttachmentRow.js +2 -0
- package/components/AttachmentPreview/AttachmentRow.js.map +1 -0
- package/components/AttachmentPreview/AttachmentTile.d.ts +9 -0
- package/components/AttachmentPreview/AttachmentTile.d.ts.map +1 -0
- package/components/AttachmentPreview/AttachmentTile.js +2 -0
- package/components/AttachmentPreview/AttachmentTile.js.map +1 -0
- package/components/AttachmentPreview/SortableAttachments.d.ts +8 -0
- package/components/AttachmentPreview/SortableAttachments.d.ts.map +1 -0
- package/components/AttachmentPreview/SortableAttachments.js +2 -0
- package/components/AttachmentPreview/SortableAttachments.js.map +1 -0
- package/components/AttachmentPreview/StoredAttachmentPreview.d.ts +3 -3
- package/components/AttachmentPreview/StoredAttachmentPreview.d.ts.map +1 -1
- package/components/AttachmentPreview/StoredAttachmentPreview.js +1 -1
- package/components/AttachmentPreview/StoredAttachmentPreview.js.map +1 -1
- package/components/AttachmentPreview/index.d.ts +3 -0
- package/components/AttachmentPreview/index.d.ts.map +1 -1
- package/components/AttachmentPreview/useStoredAttachments.d.ts +8 -0
- package/components/AttachmentPreview/useStoredAttachments.d.ts.map +1 -0
- package/components/AttachmentPreview/useStoredAttachments.js +2 -0
- package/components/AttachmentPreview/useStoredAttachments.js.map +1 -0
- package/components/BICOffsetPickerDialog/index.js +1 -1
- package/components/BICOffsetPickerDialog/index.js.map +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/CasingJoints/Editor.js.map +1 -1
- package/components/Casing/CasingTableV2/components/Component.js +1 -1
- package/components/Casing/CasingTableV2/components/Component.js.map +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js +1 -1
- package/components/Casing/CasingTableV2/components/DrillPipe/Editor.js.map +1 -1
- package/components/CommentCard/CommentCard.d.ts.map +1 -1
- package/components/CommentCard/CommentCard.js +1 -1
- package/components/CommentCard/CommentCard.js.map +1 -1
- package/components/CommentCard/CommentCard.types.d.ts +5 -1
- package/components/CommentCard/CommentCard.types.d.ts.map +1 -1
- package/components/CommentCard/CommentCardReplies.js +1 -1
- package/components/CommentCard/CommentCardReplies.js.map +1 -1
- package/components/CommentCard/__tests__/buildCommentReply.test.d.ts +2 -0
- package/components/CommentCard/__tests__/buildCommentReply.test.d.ts.map +1 -0
- package/components/CommentCard/buildCommentReply.d.ts +15 -7
- package/components/CommentCard/buildCommentReply.d.ts.map +1 -1
- package/components/CommentCard/buildCommentReply.js +1 -1
- package/components/CommentCard/buildCommentReply.js.map +1 -1
- package/components/CommentComposer/CommentComposer.d.ts +8 -3
- package/components/CommentComposer/CommentComposer.d.ts.map +1 -1
- package/components/CommentComposer/CommentComposer.js +1 -1
- package/components/CommentComposer/CommentComposer.js.map +1 -1
- package/components/CommentComposer/CommentReplyInput.d.ts +6 -2
- package/components/CommentComposer/CommentReplyInput.d.ts.map +1 -1
- package/components/CommentComposer/CommentReplyInput.js +1 -1
- package/components/CommentComposer/CommentReplyInput.js.map +1 -1
- package/components/CommentComposer/useAttachmentUpload.d.ts +15 -6
- package/components/CommentComposer/useAttachmentUpload.d.ts.map +1 -1
- package/components/CommentComposer/useAttachmentUpload.js +1 -1
- package/components/CommentComposer/useAttachmentUpload.js.map +1 -1
- package/components/CommentInputNext/CommentInputNext.d.ts +6 -0
- package/components/CommentInputNext/CommentInputNext.d.ts.map +1 -1
- package/components/CommentInputNext/CommentInputNext.js +1 -1
- package/components/CommentInputNext/CommentInputNext.js.map +1 -1
- package/components/CommentInputNext/CommentInputNext.scss.js +1 -1
- package/components/CommentInputNext/useFileDrop.d.ts +17 -0
- package/components/CommentInputNext/useFileDrop.d.ts.map +1 -0
- package/components/CommentInputNext/useFileDrop.js +2 -0
- package/components/CommentInputNext/useFileDrop.js.map +1 -0
- package/components/DocumentViewer/DocumentViewer.js +1 -1
- package/components/DocumentViewer/DocumentViewer.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Agitator/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Bit/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Component.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillCollar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/DrillPipe/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Jar/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Lwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Mwd/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Pdm/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Rss/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Stabilizer/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Sub/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/Ur/Editor.js.map +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js +1 -1
- package/components/Drillstring/BHAComponentsTable/components/shared/ConfirmationPopup.js.map +1 -1
- package/components/FeedCard/useActivityInteractions.d.ts +9 -2
- package/components/FeedCard/useActivityInteractions.d.ts.map +1 -1
- package/components/FeedCard/useActivityInteractions.js +1 -1
- package/components/FeedCard/useActivityInteractions.js.map +1 -1
- package/components/FeedCard/useFeedActivity.d.ts.map +1 -1
- package/components/FeedCard/useFeedActivity.js +1 -1
- package/components/FeedCard/useFeedActivity.js.map +1 -1
- package/components/IconMenu/index.d.ts +1 -1
- package/components/IconMenu/index.js +1 -1
- package/components/IconMenu/index.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV2/components/Filter/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV2/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Table/MetricsAddMenu.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/OffsetWellSelectionView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/ToggleMapButton.js.map +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js +1 -1
- package/components/OffsetWellPickerV3/components/TabSelection/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js +1 -1
- package/components/OffsetWellPickerV3/components/WellHubView/index.js.map +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js +1 -1
- package/components/OffsetWellPickerV3/components/shared/OffsetWellTableHead.js.map +1 -1
- package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js +1 -1
- package/components/OffsetWellPickerV5/components/Filter/components/CustomDateFields/CustomDateFields.js.map +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js +1 -1
- package/components/OffsetWellPickerV5/components/OffsetWellPickerContent/OffsetWellPickerContent.js.map +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js +1 -1
- package/components/PadOffsetsPicker/StagesSelector.js.map +1 -1
- package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js +1 -1
- package/components/PadOffsetsPickerV2/PadOffsetsPickerV2.js.map +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.map +1 -1
- package/components/index.js +1 -1
- package/componentsV2/AppContainer/AppContainer.scss.js +1 -1
- package/componentsV2/AppHeader/V3/Actions/Actions.scss.js +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.d.ts.map +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.js +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.js.map +1 -1
- package/componentsV2/AppHeader/V3/AppTitle/AppTitle.scss.js +1 -1
- package/componentsV2/Autocomplete/Autocomplete.d.ts +5 -1
- package/componentsV2/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/componentsV2/Autocomplete/Autocomplete.js +1 -1
- package/componentsV2/Autocomplete/Autocomplete.js.map +1 -1
- package/componentsV2/Autocomplete/Autocomplete.scss.js +1 -1
- package/componentsV2/Autocomplete/AutocompleteMenuItem.d.ts +7 -3
- package/componentsV2/Autocomplete/AutocompleteMenuItem.d.ts.map +1 -1
- package/componentsV2/Autocomplete/AutocompleteMenuItem.js +1 -1
- package/componentsV2/Autocomplete/AutocompleteMenuItem.js.map +1 -1
- package/componentsV2/Autocomplete/AutocompleteNext.stories.d.ts.map +1 -1
- package/componentsV2/Checkbox/Checkbox.d.ts.map +1 -1
- package/componentsV2/Checkbox/Checkbox.js +1 -1
- package/componentsV2/Checkbox/Checkbox.js.map +1 -1
- package/componentsV2/ColorPicker/ColorPicker.scss.js +1 -1
- package/componentsV2/Menu/Menu.scss.js +1 -1
- package/componentsV2/Menu/Menu.stories.d.ts +1 -0
- package/componentsV2/Menu/Menu.stories.d.ts.map +1 -1
- package/componentsV2/Menu/MenuDivider/MenuDivider.scss.js +1 -1
- package/componentsV2/Menu/MenuGroup/MenuGroup.js +1 -1
- package/componentsV2/Menu/MenuGroup/MenuGroup.js.map +1 -1
- package/componentsV2/Menu/MenuGroup/MenuGroup.scss.js +1 -1
- package/componentsV2/Menu/MenuItem/MenuItem.d.ts +2 -0
- package/componentsV2/Menu/MenuItem/MenuItem.d.ts.map +1 -1
- package/componentsV2/Menu/MenuItem/MenuItem.js +1 -1
- package/componentsV2/Menu/MenuItem/MenuItem.js.map +1 -1
- package/componentsV2/Menu/MenuItem/MenuItem.scss.js +1 -1
- package/componentsV2/PadModeSelect/PadModeSelect.scss.js +1 -1
- package/componentsV2/Paper/Paper.d.ts.map +1 -1
- package/componentsV2/Paper/Paper.js +1 -1
- package/componentsV2/Paper/Paper.js.map +1 -1
- package/componentsV2/Paper/Paper.scss.js +1 -1
- package/componentsV2/Popover/Popover.d.ts.map +1 -1
- package/componentsV2/Popover/Popover.js +1 -1
- package/componentsV2/Popover/Popover.js.map +1 -1
- package/componentsV2/Radio/Radio.d.ts.map +1 -1
- package/componentsV2/Radio/Radio.js +1 -1
- package/componentsV2/Radio/Radio.js.map +1 -1
- package/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.d.ts +5 -0
- package/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.d.ts.map +1 -0
- package/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.js +2 -0
- package/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.js.map +1 -0
- package/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.scss.js +2 -0
- package/componentsV2/RadioAndCheckboxIcons/CheckboxIcon.scss.js.map +1 -0
- package/componentsV2/RadioAndCheckboxIcons/RadioIcon.d.ts +2 -0
- package/componentsV2/RadioAndCheckboxIcons/RadioIcon.d.ts.map +1 -0
- package/componentsV2/RadioAndCheckboxIcons/RadioIcon.js +2 -0
- package/componentsV2/RadioAndCheckboxIcons/RadioIcon.js.map +1 -0
- package/componentsV2/RadioAndCheckboxIcons/RadioIcon.scss.js +2 -0
- package/componentsV2/RadioAndCheckboxIcons/RadioIcon.scss.js.map +1 -0
- package/componentsV2/RadioAndCheckboxIcons/index.d.ts +3 -0
- package/componentsV2/RadioAndCheckboxIcons/index.d.ts.map +1 -0
- package/componentsV2/RadioAndCheckboxLabel/RadioAndCheckboxLabel.scss.js +1 -1
- package/componentsV2/Tabs/Tabs.d.ts +1 -0
- package/componentsV2/Tabs/Tabs.d.ts.map +1 -1
- package/componentsV2/Tabs/Tabs.js +1 -1
- package/componentsV2/Tabs/Tabs.js.map +1 -1
- package/componentsV2/Tabs/Tabs.scss.js +1 -1
- package/componentsV2/Tabs/Tabs.stories.d.ts +1 -1
- package/componentsV2/Tabs/Tabs.stories.d.ts.map +1 -1
- package/componentsV2/TemplatesControl/ShareModal/ShareModal.d.ts.map +1 -1
- package/componentsV2/TemplatesControl/ShareModal/ShareModal.js +1 -1
- package/componentsV2/TemplatesControl/ShareModal/ShareModal.js.map +1 -1
- package/componentsV2/TemplatesControl/ShareModal/ShareModal.scss.js +1 -1
- package/componentsV2/TemplatesControl/TemplatesTreeMenuHeader/TemplatesTreeMenuHeader.scss.js +1 -1
- package/componentsV2/TemplatesControl/Toggle/Toggle.scss.js +1 -1
- package/config/theme/checkboxOverrides.d.ts +0 -9
- package/config/theme/checkboxOverrides.d.ts.map +1 -1
- package/config/theme/checkboxOverrides.js +1 -1
- package/config/theme/checkboxOverrides.js.map +1 -1
- package/config/theme/index.d.ts.map +1 -1
- package/config/theme/index.js +1 -1
- package/config/theme/index.js.map +1 -1
- package/config/theme/radioOverrides.d.ts +3 -15
- package/config/theme/radioOverrides.d.ts.map +1 -1
- package/config/theme/radioOverrides.js +1 -1
- package/config/theme/radioOverrides.js.map +1 -1
- package/constants/attachments.d.ts +2 -0
- package/constants/attachments.d.ts.map +1 -0
- package/constants/attachments.js +2 -0
- package/constants/attachments.js.map +1 -0
- package/constants/index.d.ts +2 -1
- package/constants/index.d.ts.map +1 -1
- package/constants/index.js +1 -1
- package/mcp-server/server.mjs +79 -11
- package/package.json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachment.js +0 -2
- package/cjs-bundle/components/AttachmentPreview/useStoredAttachment.js.map +0 -1
- package/components/AttachmentPreview/useStoredAttachment.js +0 -2
- package/components/AttachmentPreview/useStoredAttachment.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("moment-timezone"),o=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var c=require("../AttachmentPreview/StoredAttachmentPreview.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("moment-timezone"),o=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var c=require("../AttachmentPreview/StoredAttachmentPreview.js"),e=require("../UserMention/utils/index.js"),i=require("../../utils/mobileDetect.js"),n=require("react/jsx-runtime");function r(s){return s&&"object"==typeof s&&"default"in s?s:{default:s}}var u=r(s),t=function(s){var o;return(null!==(o=s.attachments)&&void 0!==o&&o.length?s.attachments:[s.attachment]).reduce((function(s,o){var c,e=null!==(c=null==o?void 0:o.file_name)&&void 0!==c?c:null==o?void 0:o.name;return null!=o&&o.url&&e&&s.push({url:o.url,name:e,size:o.size}),s}),[])};exports.buildCommentReply=function(s,r){var l,m,a,d,j,q,I,v,p,h,C,b=r.currentUserId,F=r.onDelete,f=r.onEdit,O=Number(null===(l=s.user)||void 0===l?void 0:l.id)===Number(b)||(null!==(m=s.allowed_actions)&&void 0!==m?m:[]).includes("update"),x=Number(null===(a=s.user)||void 0===a?void 0:a.id)===Number(b)||(null!==(d=s.allowed_actions)&&void 0!==d?d:[]).includes("destroy"),A=t(s);return{id:s.id,author:{id:null===(j=s.user)||void 0===j?void 0:j.id,name:(p=s.user,"".concat(null!==(h=null==p?void 0:p.first_name)&&void 0!==h?h:""," ").concat(null!==(C=null==p?void 0:p.last_name)&&void 0!==C?C:"").trim()),avatarUrl:null===(q=s.user)||void 0===q?void 0:q.profile_photo},timestamp:u.default(s.created_at).format("MM/DD/YY H:mm"),body:n.jsxs(n.Fragment,{children:[e.formatMentionText(null!==(I=s.body)&&void 0!==I?I:"",null!==(v=s.mentioned_users)&&void 0!==v?v:[],i.isNativeDetected,void 0,void 0),!!A.length&&n.jsx(c.StoredAttachmentPreview,{attachments:A})]}),menuItems:[{label:"Edit",icon:n.jsx(o.WriteIcon,{size:16}),disabled:!O,onClick:function(){return f(s.id)}},{label:"Delete",icon:n.jsx(o.DeleteFourIcon,{size:16}),disabled:!x,onClick:function(){return F(s.id)}}]}},exports.getReplyAttachments=t;
|
|
2
2
|
//# sourceMappingURL=buildCommentReply.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildCommentReply.js","sources":["../../../../src/components/CommentCard/buildCommentReply.tsx"],"sourcesContent":["import moment from 'moment-timezone';\n\nimport { DeleteFourIcon } from '../../icons';\nimport { StoredAttachmentPreview } from '../AttachmentPreview/StoredAttachmentPreview';\nimport { formatMentionText } from '../UserMention/utils';\n\nimport { CommentReply } from './CommentCard.types';\n\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst COMMENT_TIME_FORMAT = 'MM/DD/YY H:mm';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case activity payload. */\ntype ReplyUser = {\n id?: string | number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n};\n\nexport type ActivityReply = {\n id: string | number;\n body?: string;\n user?: ReplyUser;\n created_at?: string | number;\n allowed_actions?: string[];\n mentioned_users?: unknown[];\n attachment?:
|
|
1
|
+
{"version":3,"file":"buildCommentReply.js","sources":["../../../../src/components/CommentCard/buildCommentReply.tsx"],"sourcesContent":["import moment from 'moment-timezone';\n\nimport { DeleteFourIcon, WriteIcon } from '../../icons';\nimport { StoredAttachmentPreview } from '../AttachmentPreview/StoredAttachmentPreview';\nimport { formatMentionText } from '../UserMention/utils';\n\nimport { CommentReply } from './CommentCard.types';\n\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst COMMENT_TIME_FORMAT = 'MM/DD/YY H:mm';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case activity payload. */\ntype ReplyUser = {\n id?: string | number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n};\n\ntype ReplyAttachment = { url?: string; name?: string; file_name?: string; size?: number };\n\nexport type ActivityReply = {\n id: string | number;\n body?: string;\n user?: ReplyUser;\n created_at?: string | number;\n allowed_actions?: string[];\n mentioned_users?: unknown[];\n attachment?: ReplyAttachment | null;\n attachments?: ReplyAttachment[] | null;\n};\n\n// Old replies only carry the singular field; the API mirrors the first file into both.\nexport const getReplyAttachments = (\n reply: ActivityReply\n): { url: string; name: string; size?: number }[] =>\n (reply.attachments?.length ? reply.attachments : [reply.attachment]).reduce<\n { url: string; name: string; size?: number }[]\n >((acc, file) => {\n const name = file?.file_name ?? file?.name;\n if (file?.url && name) acc.push({ url: file.url, name, size: file.size });\n return acc;\n }, []);\n\nconst getReplyUserName = (user?: ReplyUser): string =>\n `${user?.first_name ?? ''} ${user?.last_name ?? ''}`.trim();\n/* eslint-enable camelcase */\n\nexport type BuildCommentReplyOptions = {\n currentUserId?: string | number;\n onDelete: (id: string | number) => void;\n onEdit: (id: string | number) => void;\n};\n\nexport const buildCommentReply = (\n reply: ActivityReply,\n { currentUserId, onDelete, onEdit }: BuildCommentReplyOptions\n): CommentReply => {\n const canUpdate =\n Number(reply.user?.id) === Number(currentUserId) ||\n (reply.allowed_actions ?? []).includes('update');\n const canDelete =\n Number(reply.user?.id) === Number(currentUserId) ||\n (reply.allowed_actions ?? []).includes('destroy');\n const attachments = getReplyAttachments(reply);\n\n return {\n id: reply.id,\n author: {\n id: reply.user?.id,\n name: getReplyUserName(reply.user),\n avatarUrl: reply.user?.profile_photo,\n },\n timestamp: moment(reply.created_at).format(COMMENT_TIME_FORMAT),\n body: (\n <>\n {formatMentionText(\n reply.body ?? '',\n reply.mentioned_users ?? [],\n isNativeDetected,\n undefined,\n undefined\n )}\n {!!attachments.length && <StoredAttachmentPreview attachments={attachments} />}\n </>\n ),\n menuItems: [\n {\n label: 'Edit',\n icon: <WriteIcon size={16} />,\n disabled: !canUpdate,\n onClick: () => onEdit(reply.id),\n },\n {\n label: 'Delete',\n icon: <DeleteFourIcon size={16} />,\n disabled: !canDelete,\n onClick: () => onDelete(reply.id),\n },\n ],\n };\n};\n"],"names":["getReplyAttachments","reply","_reply$attachments","attachments","length","attachment","reduce","acc","file","_file$file_name","name","file_name","url","push","size","_ref","_reply$user","_reply$allowed_action","_reply$user2","_reply$allowed_action2","_reply$user3","_reply$user4","_reply$body","_reply$mentioned_user","user","_user$first_name","_user$last_name","currentUserId","onDelete","onEdit","canUpdate","Number","id","allowed_actions","includes","canDelete","author","concat","first_name","last_name","trim","avatarUrl","profile_photo","timestamp","moment","created_at","format","body","_jsxs","jsxs","_Fragment","children","formatMentionText","mentioned_users","isNativeDetected","undefined","_jsx","StoredAttachmentPreview","menuItems","label","icon","WriteIcon","disabled","onClick","DeleteFourIcon"],"mappings":"4rIAkCaA,EAAsB,SACjCC,GAAoB,IAAAC,EAAA,eAEnBD,EAAAA,EAAME,0BAAND,EAAmBE,OAASH,EAAME,YAAc,CAACF,EAAMI,aAAaC,QAEnE,SAACC,EAAKC,GAAS,IAAAC,EACTC,EAAsB,QAAfF,EAAAA,eAAAA,EAAMG,iBAAS,IAAAF,EAAAA,EAAID,aAAAA,EAAAA,EAAME,KAEtC,OADIF,SAAAA,EAAMI,KAAOF,GAAMH,EAAIM,KAAK,CAAED,IAAKJ,EAAKI,IAAKF,KAAAA,EAAMI,KAAMN,EAAKM,OAC3DP,CACR,GAAE,GAAG,4BAYyB,SAC/BN,EAEiBc,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAbOC,EAAgBC,EAAAC,EAYtCC,IAAAA,cAAeC,IAAAA,SAAUC,IAAAA,OAErBC,EACJC,OAAO,QAAA9B,EAAAA,EAAMuB,YAAN,IAAAR,OAAA,EAAAA,EAAYgB,MAAQD,OAAOJ,KACR,QAAzB1B,EAAAA,EAAMgC,uBAAmB,IAAAhB,EAAAA,EAAA,IAAIiB,SAAS,UACnCC,EACJJ,OAAO,QAAA9B,EAAAA,EAAMuB,YAAN,IAAAN,OAAA,EAAAA,EAAYc,MAAQD,OAAOJ,KACR,QAAzB1B,EAAAA,EAAMgC,uBAAmB,IAAAd,EAAAA,EAAA,IAAIe,SAAS,WACnC/B,EAAcH,EAAoBC,GAExC,MAAO,CACL+B,GAAI/B,EAAM+B,GACVI,OAAQ,CACNJ,GAAc,UAAV/B,EAAMuB,YAAI,IAAAJ,OAAA,EAAVA,EAAYY,GAChBtB,MA1BoBc,EA0BGvB,EAAMuB,KAzBjC,GAAAa,OAAmB,QAAnBZ,EAAGD,eAAAA,EAAMc,kBAAU,IAAAb,EAAAA,EAAI,GAAE,KAAAY,OAAuB,QAAvBX,EAAIF,eAAAA,EAAMe,iBAAa,IAAAb,EAAAA,EAAA,IAAKc,QA0BjDC,kBAAWxC,EAAAA,EAAMuB,yBAANH,EAAYqB,eAEzBC,UAAWC,EAAM,QAAC3C,EAAM4C,YAAYC,OAhEZ,iBAiExBC,KACEC,EAAAC,KAAAC,WAAA,CAAAC,SAAA,CACGC,EAAiBA,kBACN,QADM9B,EAChBrB,EAAM8C,YAAI,IAAAzB,EAAAA,EAAI,GACO,QADLC,EAChBtB,EAAMoD,uBAAe,IAAA9B,EAAAA,EAAI,GACzB+B,EAAgBA,sBAChBC,OACAA,KAECpD,EAAYC,QAAUoD,EAAAA,IAACC,EAAAA,wBAAuB,CAACtD,YAAaA,OAGnEuD,UAAW,CACT,CACEC,MAAO,OACPC,KAAMJ,MAACK,YAAS,CAAC/C,KAAM,KACvBgD,UAAWhC,EACXiC,QAAS,WAAA,OAAMlC,EAAO5B,EAAM+B,GAAG,GAEjC,CACE2B,MAAO,SACPC,KAAMJ,MAACQ,iBAAc,CAAClD,KAAM,KAC5BgD,UAAW3B,EACX4B,QAAS,WAAA,OAAMnC,EAAS3B,EAAM+B,GAAG,IAIzC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("react"),o=require("@material-ui/core"),n=require("@material-ui/icons/AlternateEmail"),i=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),c=require("../../componentsV2/Tooltip/Tooltip.js"),r=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var t=require("../Avatar/index.js"),u=require("../AttachFileButton/AttachFileButton.js"),a=require("../CommentInputNext/CommentInputNext.js"),l=require("../EmojiIconButton.js"),m=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),d=require("../UserMention/utils/index.js"),p=require("./useAttachmentUpload.js"),q=require("./CommentMetaLine.js"),I=require("./ShareToChatRow.js"),h=require("./CommentComposer.scss.js"),b=require("react/jsx-runtime");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("react"),o=require("@material-ui/core"),n=require("@material-ui/icons/AlternateEmail"),i=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),c=require("../../componentsV2/Tooltip/Tooltip.js"),r=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var t=require("../Avatar/index.js"),u=require("../AttachFileButton/AttachFileButton.js"),a=require("../CommentInputNext/CommentInputNext.js"),l=require("../EmojiIconButton.js"),m=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),d=require("../UserMention/utils/index.js"),p=require("./useAttachmentUpload.js"),q=require("./CommentMetaLine.js"),I=require("./ShareToChatRow.js"),h=require("./CommentComposer.scss.js"),b=require("react/jsx-runtime");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=g(e),v=g(n);function C(e,s){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);s&&(n=n.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),o.push.apply(o,n)}return o}function y(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?C(Object(o),!0).forEach((function(s){f.default(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):C(Object(o)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(o,s))}))}return e}var x={fontSize:14,lineHeight:"20px",suggestions:{backgroundColor:"var(--palette-background-b-9)",list:{backgroundColor:"var(--palette-background-b-9)"},item:{color:"var(--palette-primary-text-1)","&focused":{backgroundColor:"rgb(from var(--palette-primary-text-1) r g b / 0.08)"}}}},F=function(e){return b.jsxs("div",{className:h.suggestion,children:[b.jsx(t.AvatarComponent,{size:26,alt:e.display,imgSrc:e.photo,displayName:e.display}),b.jsx("span",{children:e.display})]})};exports.CommentComposer=function(e){var n=e.body,t=e.onBodyChange,g=e.onSubmit,f=e.canSubmit,C=e.currentUser,O=e.attachments,A=e.onAttachmentsChange,S=e.maxAttachments,P=void 0===S?p.DEFAULT_MAX_ATTACHMENTS:S,E=e.attachment,M=e.onAttachmentChange,k=e.attachmentError,D=e.onAttachmentError,w=e.maxAttachmentSizeBytes,R=e.disabled,U=e.autoFocus,T=e.placeholder,B=void 0===T?"Add a comment...":T,L=e.metaRows,N=e.isMetaSingleLine,z=e.shareToChat,G=e.trailing,_=e.embedded,H=e.className,K=e.testId,W=!!A,V=s.useMemo((function(){return W?null!=O?O:[]:[E].filter(Boolean)}),[W,O,E]),Q=s.useCallback((function(e){var s;A?A(e):null==M||M(null!==(s=e[0])&&void 0!==s?s:null)}),[A,M]),X=p.useAttachmentUpload({value:V,onChange:Q,onError:D,maxSizeBytes:w,maxFiles:W?P:1}),Z=f&&!X.isUploading,$=s.useRef(null);return b.jsx(a.CommentInput,{value:n,canSubmit:Z,disabled:R,onSubmit:g,trailing:G,embedded:_,className:H,testId:K,field:b.jsx(o.Input,{inputComponent:j,inputProps:{onChange:t,currentUser:C,allowEmptyQuery:!0,suggestionsPortalHost:document.querySelector("body"),withLightTheme:!1,mentionProps:{renderSuggestion:F},style:x},value:n,placeholder:B,inputRef:$,className:h.mentionField,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||Z&&!R&&(d.isSuggestionsListOpened()||(e.preventDefault(),g()))},disableUnderline:!0,rows:1,fullWidth:!0,multiline:!0,autoFocus:U}),attachments:X.items,onAttachmentRemove:X.removeAttachment,onAttachmentRetry:X.handleRetry,onAttachmentReorder:W?X.reorderAttachments:void 0,onFilesDrop:X.addFiles,dropLabel:1===X.maxFiles?"Drop a file here":"Drop files here",attachmentSlot:k?b.jsx(m,{errorMessage:k}):void 0,toolbar:b.jsxs(b.Fragment,{children:[b.jsx(u.AttachFileButton,{inputRef:X.fileInputRef,onClick:X.openFileDialog,onFileSelect:X.handleFileSelect,multiple:W,disabled:X.isFull,tooltip:X.isFull?"Up to ".concat(X.maxFiles," ").concat(1===X.maxFiles?"file":"files"," can be attached"):"Attach file"}),b.jsx(c.Tooltip,{title:"Mention someone",children:b.jsx(i.ButtonIcon,{size:"xs",type:"tertiary",onClick:function(){var e,s=$.current;if(s){s.focus();var o=!!s.value&&!/\s$/.test(s.value),n="".concat(s.value).concat(o?" @":"@"),i=null===(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),"value"))||void 0===e?void 0:e.set;null==i||i.call(s,n),s.setSelectionRange(n.length,n.length),s.dispatchEvent(new Event("input",{bubbles:!0})),s.dispatchEvent(new Event("keyup",{bubbles:!0}))}},children:b.jsx(v.default,{fontSize:"inherit"})})}),b.jsx("span",{className:h.iconSlot,children:b.jsx(l,{icon:b.jsx(r.SmilingFaceIcon,{size:16}),handleSelectEmoji:function(e){return t("".concat(n).concat(e.native))}})})]}),footer:(!(null==L||!L.length)||!!z)&&b.jsxs(b.Fragment,{children:[b.jsx(q.CommentMetaLine,{rows:null!=L?L:[],singleLine:N}),z&&b.jsx(I.ShareToChatRow,y({},z))]})})};
|
|
2
2
|
//# sourceMappingURL=CommentComposer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentComposer.js","sources":["../../../../src/components/CommentComposer/CommentComposer.tsx"],"sourcesContent":["import { CSSProperties, FormEventHandler, KeyboardEvent, ReactNode, useRef } from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\n\nimport { useAttachmentUpload, UploadedAttachment } from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachment: UploadedAttachment | null;\n onAttachmentChange: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n const upload = useAttachmentUpload({\n value: attachment,\n onChange: onAttachmentChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n onSubmit();\n };\n\n return (\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={trailing}\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n disabled={upload.hasAttachment}\n tooltip={upload.hasAttachment ? 'Only one file can be attached' : 'Attach file'}\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","jsx","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","embedded","testId","upload","useAttachmentUpload","value","onChange","onError","maxSizeBytes","canSend","isUploading","fieldRef","useRef","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","attachments","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","attachmentSlot","FailedFileUploading","errorMessage","undefined","toolbar","jsxs","_Fragment","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","hasAttachment","tooltip","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread"],"mappings":"gxK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,SAC5DC,MAAC2G,UAAkB,CAACzH,SAAS,gBAGjCc,EAAAQ,IAAA,OAAA,CAAMZ,UAAWC,EAAO+G,SAAS7G,SAC/BC,MAAC6G,EAAe,CACdC,KAAM9G,MAAC+G,kBAAe,CAAC7G,KAAM,KAC7B8G,kBAAmB,SAACC,GAAyB,OAC3CtG,EAAgBD,GAAAA,OAAAA,UAAOuG,EAAMC,QAAS,SAMhDC,UACK3F,UAAAA,EAAU+E,WAAY7E,IACvB/B,EAAAA,KAAAkF,EAAAA,SAAA,CAAA9E,SAAA,CACEC,MAACoH,kBAAe,CAACtD,KAAMtC,QAAAA,EAAY,GAAI6F,WAAY5F,IAClDC,GAAe1B,MAACsH,EAAAA,eAAcC,EAAA,CAAA,EAAK7F,QAMhD"}
|
|
1
|
+
{"version":3,"file":"CommentComposer.js","sources":["../../../../src/components/CommentComposer/CommentComposer.tsx"],"sourcesContent":["import {\n CSSProperties,\n FormEventHandler,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { Input } from '@material-ui/core';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { SmilingFaceIcon } from '../../icons';\nimport Avatar from '../Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport EmojiIconButton from '../EmojiIconButton';\nimport FailedFileUploading from '../FailedFileUploading';\nimport UserMention from '../UserMention';\nimport { isSuggestionsListOpened } from '../UserMention/utils';\n\nimport {\n useAttachmentUpload,\n UploadedAttachment,\n DEFAULT_MAX_ATTACHMENTS,\n} from './useAttachmentUpload';\nimport { CommentMetaLine, CommentMetaRow } from './CommentMetaLine';\nimport { ShareToChatRow, ShareToChatRowProps } from './ShareToChatRow';\n\nimport styles from './CommentComposer.scss';\n\n/* eslint-disable camelcase -- mirrors the platform's snake_case user payload. */\nexport type CommentComposerUser = {\n id?: number;\n company_id?: number;\n first_name?: string;\n last_name?: string;\n profile_photo?: string;\n [key: string]: unknown;\n};\n/* eslint-enable camelcase */\n\nexport type CommentComposerProps = {\n body: string;\n onBodyChange: (value: string) => void;\n onSubmit: () => void;\n canSubmit: boolean;\n currentUser: CommentComposerUser;\n\n attachments?: UploadedAttachment[];\n onAttachmentsChange?: (attachments: UploadedAttachment[]) => void;\n maxAttachments?: number;\n /** @deprecated Use `attachments` — kept so single-attachment callers keep working. */\n attachment?: UploadedAttachment | null;\n /** @deprecated Use `onAttachmentsChange`. */\n onAttachmentChange?: (attachment: UploadedAttachment | null) => void;\n attachmentError?: string | null;\n onAttachmentError?: (message: string | null) => void;\n maxAttachmentSizeBytes?: number;\n\n disabled?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n metaRows?: CommentMetaRow[];\n isMetaSingleLine?: boolean;\n shareToChat?: Omit<ShareToChatRowProps, 'testId'>;\n /** Replaces the default send button, e.g. the edit form's Cancel/Save. */\n trailing?: ReactNode;\n /** Render flush inside a host card instead of as its own surface. */\n embedded?: boolean;\n className?: string;\n testId?: string;\n};\n\nconst SUGGESTIONS_BACKGROUND = 'var(--palette-background-b-9)';\n\n// Module-level so react-mentions isn't re-rendered on every keystroke.\nconst MENTION_INPUT_STYLE = {\n fontSize: 14,\n lineHeight: '20px',\n suggestions: {\n backgroundColor: SUGGESTIONS_BACKGROUND,\n list: { backgroundColor: SUGGESTIONS_BACKGROUND },\n item: {\n color: 'var(--palette-primary-text-1)',\n '&focused': { backgroundColor: 'rgb(from var(--palette-primary-text-1) r g b / 0.08)' },\n },\n },\n} as unknown as CSSProperties;\n\nconst renderSuggestion = (entry: { display: string; photo?: string }) => (\n <div className={styles.suggestion}>\n <Avatar size={26} alt={entry.display} imgSrc={entry.photo} displayName={entry.display} />\n <span>{entry.display}</span>\n </div>\n);\n\nexport const CommentComposer = ({\n body,\n onBodyChange,\n onSubmit,\n canSubmit,\n currentUser,\n attachments,\n onAttachmentsChange,\n maxAttachments = DEFAULT_MAX_ATTACHMENTS,\n attachment,\n onAttachmentChange,\n attachmentError,\n onAttachmentError,\n maxAttachmentSizeBytes,\n disabled,\n autoFocus,\n placeholder = 'Add a comment...',\n metaRows,\n isMetaSingleLine,\n shareToChat,\n trailing,\n embedded,\n className,\n testId,\n}: CommentComposerProps) => {\n // Callers still on the singular props get the old one-file behaviour, unchanged.\n const isMulti = !!onAttachmentsChange;\n const value = useMemo(\n () => (isMulti ? attachments ?? [] : ([attachment].filter(Boolean) as UploadedAttachment[])),\n [isMulti, attachments, attachment]\n );\n\n const handleAttachmentsChange = useCallback(\n (next: UploadedAttachment[]) => {\n if (onAttachmentsChange) onAttachmentsChange(next);\n else onAttachmentChange?.(next[0] ?? null);\n },\n [onAttachmentsChange, onAttachmentChange]\n );\n\n const upload = useAttachmentUpload({\n value,\n onChange: handleAttachmentsChange,\n onError: onAttachmentError,\n maxSizeBytes: maxAttachmentSizeBytes,\n maxFiles: isMulti ? maxAttachments : 1,\n });\n\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n const canSend = canSubmit && !upload.isUploading;\n\n const fieldRef = useRef<HTMLTextAreaElement | null>(null);\n\n // react-mentions opens suggestions from textarea events, so type \"@\" instead of setting state.\n const mentionSomeone = () => {\n const field = fieldRef.current;\n if (!field) return;\n\n field.focus();\n\n const needsSpace = !!field.value && !/\\s$/.test(field.value);\n const nextValue = `${field.value}${needsSpace ? ' @' : '@'}`;\n const setValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(field), 'value')?.set;\n\n setValue?.call(field, nextValue);\n field.setSelectionRange(nextValue.length, nextValue.length);\n field.dispatchEvent(new Event('input', { bubbles: true }));\n field.dispatchEvent(new Event('keyup', { bubbles: true }));\n };\n\n const handleEnterKey = (event: KeyboardEvent) => {\n if (event.key !== 'Enter' || event.shiftKey) return;\n if (!canSend || disabled) return;\n if (isSuggestionsListOpened()) return;\n\n event.preventDefault();\n onSubmit();\n };\n\n return (\n <CommentInput\n value={body}\n canSubmit={canSend}\n disabled={disabled}\n onSubmit={onSubmit}\n trailing={trailing}\n embedded={embedded}\n className={className}\n testId={testId}\n field={\n <Input\n inputComponent={UserMention}\n inputProps={{\n // UserMention calls onChange with the text string, not a DOM event.\n onChange: onBodyChange as unknown as FormEventHandler<HTMLInputElement>,\n currentUser,\n allowEmptyQuery: true,\n suggestionsPortalHost: document.querySelector('body'),\n withLightTheme: false,\n mentionProps: { renderSuggestion },\n style: MENTION_INPUT_STYLE,\n }}\n value={body}\n placeholder={placeholder}\n inputRef={fieldRef}\n className={styles.mentionField}\n onKeyDown={handleEnterKey}\n disableUnderline\n rows={1}\n fullWidth\n multiline\n autoFocus={autoFocus}\n />\n }\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={isMulti ? upload.reorderAttachments : undefined}\n onFilesDrop={upload.addFiles}\n dropLabel={upload.maxFiles === 1 ? 'Drop a file here' : 'Drop files here'}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <>\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n multiple={isMulti}\n disabled={upload.isFull}\n tooltip={\n upload.isFull\n ? `Up to ${upload.maxFiles} ${\n upload.maxFiles === 1 ? 'file' : 'files'\n } can be attached`\n : 'Attach file'\n }\n />\n <Tooltip title=\"Mention someone\">\n <ButtonIcon size=\"xs\" type=\"tertiary\" onClick={mentionSomeone}>\n <AlternateEmailIcon fontSize=\"inherit\" />\n </ButtonIcon>\n </Tooltip>\n <span className={styles.iconSlot}>\n <EmojiIconButton\n icon={<SmilingFaceIcon size={16} />}\n handleSelectEmoji={(emoji: { native: string }) =>\n onBodyChange(`${body}${emoji.native}`)\n }\n />\n </span>\n </>\n }\n footer={\n (!!metaRows?.length || !!shareToChat) && (\n <>\n <CommentMetaLine rows={metaRows ?? []} singleLine={isMetaSingleLine} />\n {shareToChat && <ShareToChatRow {...shareToChat} />}\n </>\n )\n }\n />\n );\n};\n"],"names":["MENTION_INPUT_STYLE","fontSize","lineHeight","suggestions","backgroundColor","list","item","color","renderSuggestion","entry","_jsxs","className","styles","suggestion","children","_jsx","Avatar","size","alt","display","imgSrc","photo","displayName","jsx","_ref","body","onBodyChange","onSubmit","canSubmit","currentUser","attachments","onAttachmentsChange","_ref$maxAttachments","maxAttachments","DEFAULT_MAX_ATTACHMENTS","attachment","onAttachmentChange","attachmentError","onAttachmentError","maxAttachmentSizeBytes","disabled","autoFocus","_ref$placeholder","placeholder","metaRows","isMetaSingleLine","shareToChat","trailing","embedded","testId","isMulti","value","useMemo","filter","Boolean","handleAttachmentsChange","useCallback","next","_next$","upload","useAttachmentUpload","onChange","onError","maxSizeBytes","maxFiles","canSend","isUploading","fieldRef","useRef","CommentInput","field","Input","inputComponent","UserMention","inputProps","allowEmptyQuery","suggestionsPortalHost","document","querySelector","withLightTheme","mentionProps","style","inputRef","mentionField","onKeyDown","event","key","shiftKey","isSuggestionsListOpened","preventDefault","disableUnderline","rows","fullWidth","multiline","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","undefined","onFilesDrop","addFiles","dropLabel","attachmentSlot","FailedFileUploading","errorMessage","toolbar","jsxs","_Fragment","AttachFileButton","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","multiple","isFull","tooltip","concat","Tooltip","title","ButtonIcon","type","_Object$getOwnPropert","current","focus","needsSpace","test","nextValue","setValue","Object","getOwnPropertyDescriptor","getPrototypeOf","set","call","setSelectionRange","length","dispatchEvent","Event","bubbles","AlternateEmailIcon","iconSlot","EmojiIconButton","icon","SmilingFaceIcon","handleSelectEmoji","emoji","native","footer","CommentMetaLine","singleLine","ShareToChatRow","_objectSpread"],"mappings":"gxKA4EA,IAGMA,EAAsB,CAC1BC,SAAU,GACVC,WAAY,OACZC,YAAa,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AU,CAAC1G,KAAK,KAAK2G,KAAK,WAAWX,QAtFzB,WAAM,IAAAY,EACrBvD,EAAQH,EAAS2D,QACvB,GAAKxD,EAAL,CAEAA,EAAMyD,QAEN,IAAMC,IAAe1D,EAAMnB,QAAU,MAAM8E,KAAK3D,EAAMnB,OAChD+E,EAAe5D,GAAAA,OAAAA,EAAMnB,OAAQ6E,OAAAA,EAAa,KAAO,KACjDG,EAAiF,QAAtEC,EAAAA,OAAOC,yBAAyBD,OAAOE,eAAehE,GAAQ,gBAAQ,IAAAuD,OAAA,EAAtEA,EAAwEU,IAEzFJ,SAAAA,EAAUK,KAAKlE,EAAO4D,GACtB5D,EAAMmE,kBAAkBP,EAAUQ,OAAQR,EAAUQ,QACpDpE,EAAMqE,cAAc,IAAIC,MAAM,QAAS,CAAEC,SAAS,KAClDvE,EAAMqE,cAAc,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAXtC,GAoF0D/H,SAC5DC,MAAC+H,UAAkB,CAAC7I,SAAS,gBAGjCc,EAAAQ,IAAA,OAAA,CAAMZ,UAAWC,EAAOmI,SAASjI,SAC/BC,MAACiI,EAAe,CACdC,KAAMlI,MAACmI,kBAAe,CAACjI,KAAM,KAC7BkI,kBAAmB,SAACC,GAAyB,OAC3C1H,EAAgBD,GAAAA,OAAAA,UAAO2H,EAAMC,QAAS,SAMhDC,UACK1G,UAAAA,EAAU8F,WAAY5F,IACvBpC,EAAAA,KAAAoG,EAAAA,SAAA,CAAAhG,SAAA,CACEC,MAACwI,kBAAe,CAAC5D,KAAM/C,QAAAA,EAAY,GAAI4G,WAAY3G,IAClDC,GAAe/B,MAAC0I,EAAAA,eAAcC,EAAA,CAAA,EAAK5G,QAMhD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),a=require("@babel/runtime/regenerator"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/slicedToArray"),a=require("@babel/runtime/regenerator"),n=require("react"),r=require("../../componentsV2/Avatar/Avatar.js"),i=require("../AttachFileButton/AttachFileButton.js"),l=require("../CommentInputNext/CommentInputNext.js"),o=require("../FailedFileUploading.js"),u=require("./useAttachmentUpload.js"),s=require("react/jsx-runtime");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(e),m=c(t),p=c(a),h=[];exports.CommentReplyInput=function(e){var t=e.onSubmit,a=e.author,c=e.disabled,f=e.placeholder,v=void 0===f?"Reply":f,b=e.autoFocus,A=void 0===b||b,F=e.maxAttachments,x=e.initialBody,j=void 0===x?"":x,g=e.initialAttachments,q=void 0===g?h:g,y=e.onCancel,S=e.testId,C=n.useState(j),R=m.default(C,2),I=R[0],U=R[1],B=n.useState(q),k=m.default(B,2),w=k[0],D=k[1],M=n.useState(null),N=m.default(M,2),T=N[0],_=N[1],z=u.useAttachmentUpload({value:w,onChange:D,onError:_,maxFiles:F}),E=function(){var e=d.default(p.default.mark((function e(a){return p.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(a,w);case 2:if(e.t0=e.sent,!1!==e.t0){e.next=5;break}return e.abrupt("return");case 5:U(""),D([]),z.clearAttachments();case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return s.jsx(l.CommentInput,{bare:!0,autoFocus:A,placeholder:v,value:I,onChange:U,canSubmit:!(!I.trim()&&!w.length||z.isUploading),onSubmit:E,onCancel:y,disabled:c,attachments:z.items,onAttachmentRemove:z.removeAttachment,onAttachmentRetry:z.handleRetry,onAttachmentReorder:z.reorderAttachments,onFilesDrop:z.addFiles,testId:S,attachmentSlot:T?s.jsx(o,{errorMessage:T}):void 0,toolbar:s.jsx(i.AttachFileButton,{inputRef:z.fileInputRef,onClick:z.openFileDialog,onFileSelect:z.handleFileSelect,multiple:!0,disabled:z.isFull,tooltip:z.isFull?"Up to ".concat(z.maxFiles," files can be attached"):"Attach file"}),leading:s.jsx(r.Avatar,{size:32,name:null==a?void 0:a.name,imageSrc:null==a?void 0:a.avatarUrl})})};
|
|
2
2
|
//# sourceMappingURL=CommentReplyInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentReplyInput.js","sources":["../../../../src/components/CommentComposer/CommentReplyInput.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { Avatar } from '../../componentsV2/Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport FailedFileUploading from '../FailedFileUploading';\n\nimport { useAttachmentUpload, UploadedAttachment } from './useAttachmentUpload';\n\nexport type CommentReplyInputProps = {\n /** Resolving to `false` keeps the draft, so a failed post can be retried. */\n onSubmit: (\n body: string,\n
|
|
1
|
+
{"version":3,"file":"CommentReplyInput.js","sources":["../../../../src/components/CommentComposer/CommentReplyInput.tsx"],"sourcesContent":["import { useState } from 'react';\n\nimport { Avatar } from '../../componentsV2/Avatar';\nimport { AttachFileButton } from '../AttachFileButton';\nimport { CommentInput } from '../CommentInputNext/CommentInputNext';\nimport FailedFileUploading from '../FailedFileUploading';\n\nimport { useAttachmentUpload, UploadedAttachment } from './useAttachmentUpload';\n\nconst EMPTY_ATTACHMENTS: UploadedAttachment[] = [];\n\nexport type CommentReplyInputProps = {\n /** Resolving to `false` keeps the draft, so a failed post can be retried. */\n onSubmit: (\n body: string,\n attachments: UploadedAttachment[]\n ) => void | boolean | Promise<void | boolean>;\n author?: { name?: string; avatarUrl?: string };\n disabled?: boolean;\n placeholder?: string;\n autoFocus?: boolean;\n maxAttachments?: number;\n initialBody?: string;\n initialAttachments?: UploadedAttachment[];\n onCancel?: () => void;\n testId?: string;\n};\n\nexport const CommentReplyInput = ({\n onSubmit,\n author,\n disabled,\n placeholder = 'Reply',\n autoFocus = true,\n maxAttachments,\n initialBody = '',\n initialAttachments = EMPTY_ATTACHMENTS,\n onCancel,\n testId,\n}: CommentReplyInputProps) => {\n const [body, setBody] = useState(initialBody);\n const [attachments, setAttachments] = useState<UploadedAttachment[]>(initialAttachments);\n const [attachmentError, setAttachmentError] = useState<string | null>(null);\n\n const upload = useAttachmentUpload({\n value: attachments,\n onChange: setAttachments,\n onError: setAttachmentError,\n maxFiles: maxAttachments,\n });\n\n const handleSubmit = async (value: string) => {\n if ((await onSubmit(value, attachments)) === false) return;\n\n setBody('');\n setAttachments([]);\n upload.clearAttachments();\n };\n\n return (\n <CommentInput\n bare\n autoFocus={autoFocus}\n placeholder={placeholder}\n value={body}\n onChange={setBody}\n // An attachment only lands once S3 confirms, so posting mid-upload would drop it.\n canSubmit={(!!body.trim() || !!attachments.length) && !upload.isUploading}\n onSubmit={handleSubmit}\n onCancel={onCancel}\n disabled={disabled}\n attachments={upload.items}\n onAttachmentRemove={upload.removeAttachment}\n onAttachmentRetry={upload.handleRetry}\n onAttachmentReorder={upload.reorderAttachments}\n onFilesDrop={upload.addFiles}\n testId={testId}\n attachmentSlot={\n attachmentError ? <FailedFileUploading errorMessage={attachmentError} /> : undefined\n }\n toolbar={\n <AttachFileButton\n inputRef={upload.fileInputRef}\n onClick={upload.openFileDialog}\n onFileSelect={upload.handleFileSelect}\n multiple\n disabled={upload.isFull}\n tooltip={upload.isFull ? `Up to ${upload.maxFiles} files can be attached` : 'Attach file'}\n />\n }\n leading={<Avatar size={32} name={author?.name} imageSrc={author?.avatarUrl} />}\n />\n );\n};\n"],"names":["EMPTY_ATTACHMENTS","_ref","onSubmit","author","disabled","_ref$placeholder","placeholder","_ref$autoFocus","autoFocus","maxAttachments","_ref$initialBody","initialBody","_ref$initialAttachmen","initialAttachments","onCancel","testId","useState","_useState2","_slicedToArray","_useState","body","setBody","_useState4","_useState3","attachments","setAttachments","_useState6","_useState5","attachmentError","setAttachmentError","upload","useAttachmentUpload","value","onChange","onError","maxFiles","handleSubmit","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","wrap","_context","prev","next","t0","sent","abrupt","clearAttachments","stop","_callee","_x","apply","this","arguments","_jsx","CommentInput","bare","canSubmit","trim","length","isUploading","items","onAttachmentRemove","removeAttachment","onAttachmentRetry","handleRetry","onAttachmentReorder","reorderAttachments","onFilesDrop","addFiles","attachmentSlot","jsx","FailedFileUploading","errorMessage","undefined","toolbar","AttachFileButton","inputRef","fileInputRef","onClick","openFileDialog","onFileSelect","handleFileSelect","multiple","isFull","tooltip","leading","Avatar","size","name","imageSrc","avatarUrl"],"mappings":"klBASMA,EAA0C,6BAmBf,SAWHC,GAAA,IAV5BC,IAAAA,SACAC,IAAAA,OACAC,IAAAA,SAAQC,EAAAJ,EACRK,YAAAA,aAAc,QAAOD,EAAAE,EAAAN,EACrBO,UAAAA,cAAgBD,EAChBE,IAAAA,eAAcC,EAAAT,EACdU,YAAAA,aAAc,GAAED,EAAAE,EAAAX,EAChBY,mBAAAA,aAAqBb,EAAiBY,EACtCE,IAAAA,SACAC,IAAAA,OAEwBC,EAAAA,EAAQA,SAACL,GAAYM,EAAAC,EAAAA,QAAAC,EAAA,GAAtCC,EAAIH,EAAA,GAAEI,EAAOJ,EAAA,GACkBD,EAAAA,EAAQA,SAAuBH,GAAmBS,EAAAJ,EAAAA,QAAAK,EAAA,GAAjFC,EAAWF,EAAA,GAAEG,EAAcH,EAAA,GACYN,EAAAA,EAAQA,SAAgB,MAAKU,EAAAR,EAAAA,QAAAS,EAAA,GAApEC,EAAeF,EAAA,GAAEG,EAAkBH,EAAA,GAEpCI,EAASC,EAAAA,oBAAoB,CACjCC,MAAOR,EACPS,SAAUR,EACVS,QAASL,EACTM,SAAU1B,IAGN2B,EAAY,WAAA,IAAAC,EAAAC,EAAAA,QAAAC,EAAAA,QAAAC,MAAG,WAAOR,GAAa,OAAAO,UAAAE,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,OAAAF,EAAAE,KAAA,EAC5B1C,EAAS8B,EAAOR,GAAY,KAAA,EAAA,GAAAkB,EAAAG,GAAAH,EAAAI,MAAM,IAANJ,EAAAG,GAAW,CAAAH,EAAAE,KAAA,EAAA,KAAA,CAAA,OAAAF,EAAAK,OAAA,UAAA,KAAA,EAElD1B,EAAQ,IACRI,EAAe,IACfK,EAAOkB,mBAAmB,KAAA,EAAA,IAAA,MAAA,OAAAN,EAAAO,OAAA,GAAAC,EAC3B,KAAA,OAAA,SANiBC,GAAA,OAAAd,EAAAe,MAAAC,KAAAC,UAAA,EAAA,GAQlB,OACEC,EAAAA,IAACC,EAAAA,aAAY,CACXC,MAAI,EACJjD,UAAWA,EACXF,YAAaA,EACb0B,MAAOZ,EACPa,SAAUZ,EAEVqC,aAActC,EAAKuC,SAAYnC,EAAYoC,QAAY9B,EAAO+B,aAC9D3D,SAAUkC,EACVtB,SAAUA,EACVV,SAAUA,EACVoB,YAAaM,EAAOgC,MACpBC,mBAAoBjC,EAAOkC,iBAC3BC,kBAAmBnC,EAAOoC,YAC1BC,oBAAqBrC,EAAOsC,mBAC5BC,YAAavC,EAAOwC,SACpBvD,OAAQA,EACRwD,eACE3C,EAAkB2B,EAAAiB,IAACC,EAAmB,CAACC,aAAc9C,SAAsB+C,EAE7EC,QACErB,MAACsB,mBAAgB,CACfC,SAAUhD,EAAOiD,aACjBC,QAASlD,EAAOmD,eAChBC,aAAcpD,EAAOqD,iBACrBC,UAAQ,EACRhF,SAAU0B,EAAOuD,OACjBC,QAASxD,EAAOuD,uBAAkBvD,EAAOK,SAAmC,0BAAA,gBAGhFoD,QAAShC,MAACiC,SAAM,CAACC,KAAM,GAAIC,KAAMvF,aAAAA,EAAAA,EAAQuF,KAAMC,SAAUxF,aAAM,EAANA,EAAQyF,aAGvE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),r=require("@babel/runtime/helpers/asyncToGenerator"),n=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),u=require("@babel/runtime/regenerator"),i=require("react"),l=require("react-s3-uploader/s3upload"),o=require("../AttachmentPreview/getAttachmentKind.js"),a=require("../AttachFileButton/AttachFileButton.js"),c=require("../../clients/jsonApi/index.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=f(e),d=f(r),p=f(n),v=f(t),h=f(u),m=f(l);function g(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function b(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?g(Object(n),!0).forEach((function(r){p.default(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var U=function(e){return e.type.startsWith("image/")?"image":e.type.startsWith("video/")?"video":"file"},w=function(e){return(e/1048576).toFixed(1)},y=function(e){return{id:e.url,name:e.name,file:null,previewUrl:"",isUploading:!1,error:null,uploaded:e}},k=0;exports.DEFAULT_MAX_ATTACHMENTS=10,exports.useAttachmentUpload=function(e){var r,n,t=e.value,u=e.onChange,l=e.onError,f=e.maxSizeBytes,p=e.maxFiles,g=void 0===p?10:p,j=e.accept,C=void 0===j?a.ACCEPTED_ATTACHMENT_TYPES:j,O=i.useState([]),A=v.default(O,2),E=A[0],S=A[1],R=i.useRef(null),x=i.useRef(new Map),F=i.useRef(new Map),P=i.useRef([]),L=i.useRef(u),T=i.useRef(l);L.current=u,T.current=l;var q=i.useRef([]),M=i.useCallback((function(e){var r=e(P.current);P.current=r,S(r),q.current=function(e){return e.map((function(e){return e.uploaded})).filter(Boolean)}(r),L.current(q.current)}),[]),D=i.useCallback((function(e,r){return M((function(n){return n.map((function(n){return n.id===e?b(b({},n),r):n}))}))}),[M]),B=i.useCallback((function(e){var r,n;null===(r=x.current.get(e))||void 0===r||r.abortUpload(),x.current.delete(e),F.current.set(e,(null!==(n=F.current.get(e))&&void 0!==n?n:0)+1)}),[]),_=i.useCallback((function(e){null!=e&&e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}),[]),z=i.useCallback((function(){var e,r,n;null===(e=T.current)||void 0===e||e.call(T,null!==(r=null===(n=P.current.find((function(e){return e.error})))||void 0===n?void 0:n.error)&&void 0!==r?r:null)}),[]);i.useEffect((function(){return function(){x.current.forEach((function(e){return e.abortUpload()})),x.current.clear(),P.current.forEach((function(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}))}}),[]);var W=i.useCallback((function(e,r){var n,t=(null!==(n=F.current.get(e))&&void 0!==n?n:0)+1;F.current.set(e,t);var u,i,l=function(){return F.current.get(e)===t},o=function(r){var n;l()&&(D(e,{isUploading:!1,error:r}),null===(n=T.current)||void 0===n||n.call(T,r))},a="",f=new m.default({files:[r],preprocess:function(e,r){return r(e)},onProgress:function(){},getSignedUrl:(i=d.default(h.default.mark((function e(r,n){var t;return h.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c.getS3SignedUrl(r.name,r.type);case 3:t=e.sent,a=t.file_name,n(b(b({},t),{},{signedUrl:t.signed_url})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),o((null===e.t0||void 0===e.t0?void 0:e.t0.message)||"Failed to upload the file");case 11:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(e,r){return i.apply(this,arguments)}),onFinishS3Put:(u=d.default(h.default.mark((function n(){var t,u;return h.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,c.getS3DownloadLink(a);case 3:if(t=n.sent,u=t.url,l()){n.next=7;break}return n.abrupt("return");case 7:x.current.delete(e),D(e,{isUploading:!1,error:null,uploaded:{url:u,name:a,size:r.size}}),z(),n.next=15;break;case 12:n.prev=12,n.t0=n.catch(0),o((null===n.t0||void 0===n.t0?void 0:n.t0.message)||"Failed to upload the file");case 15:case"end":return n.stop()}}),n,null,[[0,12]])}))),function(){return u.apply(this,arguments)}),onError:function(e){return o(e||"Failed to upload the file")}});x.current.set(e,f)}),[D,z]),K=i.useCallback((function(e){var r,n,t,u,i=e.filter((function(e){return function(e,r){return r.split(",").map((function(e){return e.trim().toLowerCase()})).filter(Boolean).some((function(r){if(r.startsWith("."))return e.name.toLowerCase().endsWith(r);if(r.endsWith("/*")){var n=e.type.toLowerCase();return n?n.startsWith(r.slice(0,-1)):o.getAttachmentKind({name:e.name})===r.slice(0,-1)}return e.type.toLowerCase()===r}))}(e,C)})),l=i.length<e.length?1===e.length?"That file type is not supported.":"Some files were skipped — unsupported file type.":null,a="You can attach up to ".concat(g," files."),c=g-P.current.length;if(!i.length||c<=0){var d;null===(d=T.current)||void 0===d||d.call(T,i.length?a:l)}else{var p=i.slice(0,c),v=p.map((function(e){var r=U(e),n=!!f&&e.size>f;return{id:"attachment-".concat(k+=1),name:e.name,file:e,previewUrl:"file"===r?"":URL.createObjectURL(e),isUploading:!n,error:n?"File is too large (".concat(w(e.size)," MB). Maximum size is ").concat(w(f)," MB."):null,uploaded:null}}));M((function(e){return[].concat(s.default(e),s.default(v))}));var h=i.length>p.length?a:null;null===(r=T.current)||void 0===r||r.call(T,null!==(n=null!==(t=null===(u=P.current.find((function(e){return e.error})))||void 0===u?void 0:u.error)&&void 0!==t?t:l)&&void 0!==n?n:h),v.filter((function(e){return!e.error})).forEach((function(e){return W(e.id,e.file)}))}}),[M,g,f,W,C]),H=i.useCallback((function(e){var r,n=Array.from(null!==(r=e.target.files)&&void 0!==r?r:[]);R.current&&(R.current.value=""),n.length&&K(n)}),[K]),N=i.useCallback((function(){var e;return null===(e=R.current)||void 0===e?void 0:e.click()}),[]),Y=i.useCallback((function(e){var r=String(e);B(r),_(P.current.find((function(e){return e.id===r}))),M((function(e){return e.filter((function(e){return e.id!==r}))})),z()}),[B,_,M,z]),G=i.useCallback((function(e){var r=String(e),n=P.current.find((function(e){return e.id===r}));null!=n&&n.file&&(B(r),D(r,{isUploading:!0,error:null}),z(),W(r,n.file))}),[B,D,W,z]),I=i.useCallback((function(e){return M((function(r){var n=new Map(r.map((function(e){return[e.id,e]}))),t=e.map((function(e){return n.get(String(e))})).filter(Boolean),u=r.filter((function(r){return!e.some((function(e){return String(e)===r.id}))}));return[].concat(s.default(t),s.default(u))}))}),[M]),X=i.useCallback((function(){var e;P.current.forEach((function(e){B(e.id),_(e)})),M((function(){return[]})),null===(e=T.current)||void 0===e||e.call(T,null)}),[B,M,_]);i.useEffect((function(){var e,r,n;(r=q.current,n=t,r.length===n.length&&r.every((function(e,r){return e.url===n[r].url})))||(P.current.forEach((function(e){B(e.id),e.previewUrl&&URL.revokeObjectURL(e.previewUrl)})),P.current=t.map(y),q.current=t,S(P.current),null===(e=T.current)||void 0===e||e.call(T,null))}),[t,B]);var J=i.useState({}),Q=v.default(J,2),V=Q[0],Z=Q[1],$=i.useRef(V);$.current=V;var ee=E.filter((function(e){return!e.file&&e.uploaded})).map((function(e){return e.uploaded.name})).join("|");return i.useEffect((function(){var e=ee.split("|").filter((function(e){return e&&!(e in $.current)}));if(e.length){var r=!0;return Promise.all(e.map((function(e){return c.getS3DownloadLink(e,"inline").then((function(r){var n=r.url;return[e,n]})).catch((function(r){return console.error('Failed to sign stored attachment "'.concat(e,'"'),r),[e,""]}))}))).then((function(e){r&&Z((function(r){return b(b({},r),Object.fromEntries(e))}))})),function(){r=!1}}}),[ee]),{items:E.reduce((function(e,r){var n;if(r.file)return e.push({id:r.id,name:r.name,src:r.previewUrl,kind:U(r.file),isUploading:r.isUploading,error:null!==(n=r.error)&&void 0!==n?n:void 0}),e;var t=r.uploaded,u=o.getAttachmentKind(t),i=V[t.name];return"file"===u||i?(e.push({id:r.id,name:t.name,src:i,kind:u}),e):e}),[]),fileInputRef:R,openFileDialog:N,handleFileSelect:H,addFiles:K,removeAttachment:Y,handleRetry:G,reorderAttachments:I,clearAttachments:X,isUploading:E.some((function(e){return e.isUploading})),error:null!==(r=null===(n=E.find((function(e){return e.error})))||void 0===n?void 0:n.error)&&void 0!==r?r:null,count:E.length,isFull:E.length>=g,maxFiles:g}};
|
|
2
2
|
//# sourceMappingURL=useAttachmentUpload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAttachmentUpload.js","sources":["../../../../src/components/CommentComposer/useAttachmentUpload.ts"],"sourcesContent":["import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport S3Upload from 'react-s3-uploader/s3upload';\n\nimport type {\n AttachmentKind,\n AttachmentPreviewItem,\n} from '../AttachmentPreview/AttachmentPreview.types';\nimport { getAttachmentKind } from '../AttachmentPreview/getAttachmentKind';\n\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\n\nexport type UploadedAttachment = {\n url: string;\n name: string;\n size?: number;\n};\n\ntype UseAttachmentUploadOptions = {\n value: UploadedAttachment | null;\n onChange: (attachment: UploadedAttachment | null) => void;\n onError?: (message: string | null) => void;\n maxSizeBytes?: number;\n};\n\ntype PendingUpload = {\n file: File;\n previewUrl: string;\n isUploading: boolean;\n error: string | null;\n};\n\nconst PENDING_ITEM_ID = 'pending-attachment';\n\nconst getFileKind = (file: File): AttachmentKind => {\n if (file.type.startsWith('image/')) return 'image';\n if (file.type.startsWith('video/')) return 'video';\n return 'file';\n};\n\nconst formatMb = (bytes: number) => (bytes / (1024 * 1024)).toFixed(1);\n\nexport const useAttachmentUpload = ({\n value,\n onChange,\n onError,\n maxSizeBytes,\n}: UseAttachmentUploadOptions) => {\n const [pending, setPending] = useState<PendingUpload | null>(null);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n const uploaderRef = useRef<S3Upload | null>(null);\n const previewUrlRef = useRef<string | null>(null);\n const storedKeyRef = useRef<string | null>(null);\n // Bumped per pick so a superseded upload can't write stale state.\n const sessionRef = useRef(0);\n\n const releasePreview = useCallback(() => {\n if (!previewUrlRef.current) return;\n URL.revokeObjectURL(previewUrlRef.current);\n previewUrlRef.current = null;\n }, []);\n\n const abortUpload = useCallback(() => {\n sessionRef.current += 1;\n uploaderRef.current?.abortUpload();\n uploaderRef.current = null;\n }, []);\n\n useEffect(() => () => releasePreview(), [releasePreview]);\n\n const startUpload = useCallback(\n (file: File) => {\n const session = sessionRef.current;\n const isCurrent = () => sessionRef.current === session;\n\n const fail = (message: string) => {\n if (!isCurrent()) return;\n setPending(prev => (prev ? { ...prev, isUploading: false, error: message } : prev));\n onError?.(message);\n };\n\n uploaderRef.current = new S3Upload({\n files: [file],\n preprocess: (target, next) => next(target),\n onProgress: () => {},\n getSignedUrl: async (target, callback) => {\n try {\n const data = await getS3SignedUrl(target.name, target.type);\n storedKeyRef.current = data.file_name;\n callback({ ...data, signedUrl: data.signed_url });\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onFinishS3Put: async () => {\n try {\n const key = storedKeyRef.current as string;\n const { url } = await getS3DownloadLink(key);\n if (!isCurrent()) return;\n\n setPending(prev => (prev ? { ...prev, isUploading: false, error: null } : prev));\n onError?.(null);\n onChange({ url, name: key, size: file.size });\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onError: message => fail(message || 'Failed to upload the file'),\n });\n },\n [onChange, onError]\n );\n\n const selectFile = useCallback(\n (file: File) => {\n abortUpload();\n releasePreview();\n\n const kind = getFileKind(file);\n const previewUrl = kind === 'file' ? '' : URL.createObjectURL(file);\n previewUrlRef.current = previewUrl || null;\n\n const isTooLarge = !!maxSizeBytes && file.size > maxSizeBytes;\n const sizeError = isTooLarge\n ? `File is too large (${formatMb(file.size)} MB). Maximum size is ${formatMb(\n maxSizeBytes as number\n )} MB.`\n : null;\n\n setPending({ file, previewUrl, isUploading: !isTooLarge, error: sizeError });\n\n if (sizeError) {\n onError?.(sizeError);\n return;\n }\n\n onError?.(null);\n startUpload(file);\n },\n [abortUpload, releasePreview, maxSizeBytes, onError, startUpload]\n );\n\n const handleFileSelect = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n // Reset the input so re-picking the same file still fires a change event.\n if (fileInputRef.current) fileInputRef.current.value = '';\n if (file) selectFile(file);\n },\n [selectFile]\n );\n\n const openFileDialog = useCallback(() => fileInputRef.current?.click(), []);\n\n const removeAttachment = useCallback(() => {\n abortUpload();\n releasePreview();\n setPending(null);\n onError?.(null);\n onChange(null);\n }, [abortUpload, releasePreview, onChange, onError]);\n\n const handleRetry = useCallback(() => {\n const file = pending?.file;\n if (!file) return;\n\n abortUpload();\n setPending({ ...(pending as PendingUpload), isUploading: true, error: null });\n onError?.(null);\n startUpload(file);\n }, [pending, abortUpload, onError, startUpload]);\n\n // Uploading / failed tiles outlive a cleared value so retries stay visible.\n const isIdle = !pending?.isUploading && !pending?.error;\n useEffect(() => {\n if (!value && pending && isIdle) {\n releasePreview();\n setPending(null);\n }\n }, [value, pending, isIdle, releasePreview]);\n\n // A stored url has expired by now, so re-sign it for the preview.\n const storedName = !pending && value ? value.name : '';\n const [storedSrc, setStoredSrc] = useState('');\n useEffect(() => {\n let isActive = true;\n\n if (!storedName) {\n setStoredSrc('');\n } else {\n getS3DownloadLink(storedName, 'inline')\n .then(({ url }: { url: string }) => {\n if (isActive) setStoredSrc(url);\n })\n .catch(() => {\n if (isActive) setStoredSrc('');\n });\n }\n\n return () => {\n isActive = false;\n };\n }, [storedName]);\n\n const items: AttachmentPreviewItem[] = [];\n // A finished upload keeps its local tile: the picked file name is what the user expects to see,\n // and the blob preview spares a re-sign round trip. Submitting clears `value`, which drops it.\n if (pending) {\n items.push({\n id: PENDING_ITEM_ID,\n name: pending.file.name,\n src: pending.previewUrl,\n kind: getFileKind(pending.file),\n isUploading: pending.isUploading,\n error: pending.error ?? undefined,\n });\n } else if (value && storedSrc) {\n items.push({\n id: value.url,\n name: value.name,\n src: storedSrc,\n kind: getAttachmentKind(value),\n });\n }\n\n return {\n items,\n fileInputRef,\n openFileDialog,\n handleFileSelect,\n removeAttachment,\n handleRetry,\n isUploading: !!pending?.isUploading,\n error: pending?.error ?? null,\n hasAttachment: !!pending || !!value,\n };\n};\n"],"names":["getFileKind","file","type","startsWith","formatMb","bytes","toFixed","_ref","_pending$error2","value","onChange","onError","maxSizeBytes","useState","_useState2","_slicedToArray","_useState","pending","setPending","fileInputRef","useRef","uploaderRef","previewUrlRef","storedKeyRef","sessionRef","releasePreview","useCallback","current","URL","revokeObjectURL","abortUpload","_uploaderRef$current","useEffect","startUpload","_onFinishS3Put","_getSignedUrl","session","isCurrent","fail","message","prev","isUploading","error","S3Upload","files","preprocess","target","next","onProgress","getSignedUrl","_asyncToGenerator","_regeneratorRuntime","mark","_callee","callback","data","wrap","_context","getS3SignedUrl","name","sent","file_name","signedUrl","signed_url","t0","stop","_x","_x2","apply","this","arguments","onFinishS3Put","_callee2","key","_yield$getS3DownloadL","url","_context2","getS3DownloadLink","abrupt","size","selectFile","previewUrl","createObjectURL","isTooLarge","sizeError","handleFileSelect","event","_event$target$files","openFileDialog","_fileInputRef$current","click","removeAttachment","handleRetry","isIdle","storedName","_useState4","_useState3","storedSrc","setStoredSrc","isActive","then","_ref2","catch","_pending$error","items","push","id","src","kind","undefined","getAttachmentKind","hasAttachment"],"mappings":"8lCA+BA,IAEMA,EAAc,SAACC,GACnB,OAAIA,EAAKC,KAAKC,WAAW,UAAkB,QACvCF,EAAKC,KAAKC,WAAW,UAAkB,QACpC,MACT,EAEMC,EAAW,SAACC,GAAa,OAAMA,EAAK,SAAkBC,QAAQ,EAAE,8BAEnC,SAKDC,GAAA,IAAAC,EAJhCC,IAAAA,MACAC,IAAAA,SACAC,IAAAA,QACAC,IAAAA,aAE8BC,EAAAA,EAAQA,SAAuB,MAAKC,EAAAC,EAAAA,QAAAC,EAAA,GAA3DC,EAAOH,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BlC,EAAES,eAAAA,EAASyB,aAAK,IAAAlC,EAAAA,EAAI,KACzBuG,gBAAiB9F,KAAaR,EAElC"}
|
|
1
|
+
{"version":3,"file":"useAttachmentUpload.js","sources":["../../../../src/components/CommentComposer/useAttachmentUpload.ts"],"sourcesContent":["import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport S3Upload from 'react-s3-uploader/s3upload';\n\nimport type {\n AttachmentKind,\n AttachmentPreviewItem,\n} from '../AttachmentPreview/AttachmentPreview.types';\nimport { getAttachmentKind } from '../AttachmentPreview/getAttachmentKind';\nimport { ACCEPTED_ATTACHMENT_TYPES } from '../AttachFileButton';\n\nimport { getS3SignedUrl, getS3DownloadLink } from '~/clients/jsonApi';\n\nexport type UploadedAttachment = {\n url: string;\n name: string;\n size?: number;\n};\n\ntype UseAttachmentUploadOptions = {\n value: UploadedAttachment[];\n onChange: (attachments: UploadedAttachment[]) => void;\n onError?: (message: string | null) => void;\n maxSizeBytes?: number;\n maxFiles?: number;\n /** Mirrors the file input's `accept`; also gates drag-and-drop. */\n accept?: string;\n};\n\n/** A picked or already-stored file, in the order the user arranged it. */\ntype Entry = {\n id: string;\n name: string;\n /** Set while the file is local; cleared entries come from `value`. */\n file: File | null;\n previewUrl: string;\n isUploading: boolean;\n error: string | null;\n uploaded: UploadedAttachment | null;\n};\n\nexport const DEFAULT_MAX_ATTACHMENTS = 10;\n\n/** Same rules the file input enforces via `accept`, so drag-and-drop can't smuggle a type past it. */\nconst isAcceptedType = (file: File, accept: string) =>\n accept\n .split(',')\n .map(rule => rule.trim().toLowerCase())\n .filter(Boolean)\n .some(rule => {\n if (rule.startsWith('.')) return file.name.toLowerCase().endsWith(rule);\n if (rule.endsWith('/*')) {\n const type = file.type.toLowerCase();\n if (type) return type.startsWith(rule.slice(0, -1));\n\n return getAttachmentKind({ name: file.name }) === rule.slice(0, -1);\n }\n\n return file.type.toLowerCase() === rule;\n });\n\nconst getFileKind = (file: File): AttachmentKind => {\n if (file.type.startsWith('image/')) return 'image';\n if (file.type.startsWith('video/')) return 'video';\n return 'file';\n};\n\nconst formatMb = (bytes: number) => (bytes / (1024 * 1024)).toFixed(1);\n\nconst getUploaded = (entries: Entry[]) =>\n entries.map(entry => entry.uploaded).filter(Boolean) as UploadedAttachment[];\n\nconst isSameList = (a: UploadedAttachment[], b: UploadedAttachment[]) =>\n a.length === b.length && a.every((item, index) => item.url === b[index].url);\n\nconst toStoredEntry = (attachment: UploadedAttachment): Entry => ({\n id: attachment.url,\n name: attachment.name,\n file: null,\n previewUrl: '',\n isUploading: false,\n error: null,\n uploaded: attachment,\n});\n\nlet entrySeq = 0;\nconst nextEntryId = () => {\n entrySeq += 1;\n return `attachment-${entrySeq}`;\n};\n\nexport const useAttachmentUpload = ({\n value,\n onChange,\n onError,\n maxSizeBytes,\n maxFiles = DEFAULT_MAX_ATTACHMENTS,\n accept = ACCEPTED_ATTACHMENT_TYPES,\n}: UseAttachmentUploadOptions) => {\n const [entries, setEntries] = useState<Entry[]>([]);\n\n const fileInputRef = useRef<HTMLInputElement>(null);\n const uploadersRef = useRef(new Map<string, S3Upload>());\n // Bumped per attempt so a superseded upload can't write state for a restarted entry.\n const sessionsRef = useRef(new Map<string, number>());\n // Mutations are driven from async upload callbacks, so the latest list lives in a ref.\n const entriesRef = useRef<Entry[]>([]);\n const onChangeRef = useRef(onChange);\n const onErrorRef = useRef(onError);\n\n onChangeRef.current = onChange;\n onErrorRef.current = onError;\n\n // What we last handed the parent. A `value` that still matches it is our own change echoing\n // back; anything else is a parent-driven reset we must adopt.\n const emittedRef = useRef<UploadedAttachment[]>([]);\n\n const commit = useCallback((updater: (prev: Entry[]) => Entry[]) => {\n const next = updater(entriesRef.current);\n entriesRef.current = next;\n setEntries(next);\n emittedRef.current = getUploaded(next);\n onChangeRef.current(emittedRef.current);\n }, []);\n\n const patchEntry = useCallback(\n (id: string, patch: Partial<Entry>) =>\n commit(prev => prev.map(entry => (entry.id === id ? { ...entry, ...patch } : entry))),\n [commit]\n );\n\n const abortUpload = useCallback((id: string) => {\n uploadersRef.current.get(id)?.abortUpload();\n uploadersRef.current.delete(id);\n // Bump, never delete: deleting would let the next attempt reuse session 1, so a callback\n // still in flight from the aborted attempt would pass `isCurrent` and clobber it.\n sessionsRef.current.set(id, (sessionsRef.current.get(id) ?? 0) + 1);\n }, []);\n\n const releasePreview = useCallback((entry?: Entry) => {\n if (entry?.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n }, []);\n\n // The banner is shared by every tile, so recompute it rather than clear it — one file\n // succeeding must not hide a sibling that is still failing.\n const syncError = useCallback(() => {\n onErrorRef.current?.(entriesRef.current.find(entry => entry.error)?.error ?? null);\n }, []);\n\n useEffect(\n () => () => {\n uploadersRef.current.forEach(uploader => uploader.abortUpload());\n uploadersRef.current.clear();\n entriesRef.current.forEach(entry => {\n if (entry.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n });\n },\n []\n );\n\n const startUpload = useCallback(\n (id: string, file: File) => {\n const session = (sessionsRef.current.get(id) ?? 0) + 1;\n sessionsRef.current.set(id, session);\n // A superseded upload must not write state for an entry that is gone or restarted.\n const isCurrent = () => sessionsRef.current.get(id) === session;\n\n const fail = (message: string) => {\n if (!isCurrent()) return;\n patchEntry(id, { isUploading: false, error: message });\n onErrorRef.current?.(message);\n };\n\n let storedKey = '';\n\n const uploader = new S3Upload({\n files: [file],\n preprocess: (target: File, next: (file: File) => void) => next(target),\n onProgress: () => {},\n getSignedUrl: async (\n target: File,\n callback: (data: { signedUrl: string; [key: string]: unknown }) => void\n ) => {\n try {\n const data = await getS3SignedUrl(target.name, target.type);\n storedKey = data.file_name;\n callback({ ...data, signedUrl: data.signed_url });\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onFinishS3Put: async () => {\n try {\n const { url } = await getS3DownloadLink(storedKey);\n if (!isCurrent()) return;\n\n uploadersRef.current.delete(id);\n patchEntry(id, {\n isUploading: false,\n error: null,\n uploaded: { url, name: storedKey, size: file.size },\n });\n syncError();\n } catch (e) {\n fail((e as Error)?.message || 'Failed to upload the file');\n }\n },\n onError: (message: string) => fail(message || 'Failed to upload the file'),\n });\n\n uploadersRef.current.set(id, uploader);\n },\n [patchEntry, syncError]\n );\n\n const addFiles = useCallback(\n (files: File[]) => {\n const supported = files.filter(file => isAcceptedType(file, accept));\n const skipped = supported.length < files.length;\n // One banner, one message: report the most actionable reason once, at the end. Reporting\n // as we go would let a later call overwrite an earlier warning on a mixed drop.\n const unsupported = skipped\n ? (files.length === 1 && 'That file type is not supported.') ||\n 'Some files were skipped — unsupported file type.'\n : null;\n const tooMany = `You can attach up to ${maxFiles} files.`;\n\n const room = maxFiles - entriesRef.current.length;\n if (!supported.length || room <= 0) {\n onErrorRef.current?.(supported.length ? tooMany : unsupported);\n return;\n }\n\n const accepted = supported.slice(0, room);\n const added: Entry[] = accepted.map(file => {\n const kind = getFileKind(file);\n const isTooLarge = !!maxSizeBytes && file.size > maxSizeBytes;\n\n return {\n id: nextEntryId(),\n name: file.name,\n file,\n previewUrl: kind === 'file' ? '' : URL.createObjectURL(file),\n isUploading: !isTooLarge,\n error: isTooLarge\n ? `File is too large (${formatMb(file.size)} MB). Maximum size is ${formatMb(\n maxSizeBytes as number\n )} MB.`\n : null,\n uploaded: null,\n };\n });\n\n commit(prev => [...prev, ...added]);\n\n const overflow = supported.length > accepted.length ? tooMany : null;\n onErrorRef.current?.(\n entriesRef.current.find(entry => entry.error)?.error ?? unsupported ?? overflow\n );\n\n added\n .filter(entry => !entry.error)\n .forEach(entry => startUpload(entry.id, entry.file as File));\n },\n [commit, maxFiles, maxSizeBytes, startUpload, accept]\n );\n\n const handleFileSelect = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from(event.target.files ?? []);\n // Reset the input so re-picking the same file still fires a change event.\n if (fileInputRef.current) fileInputRef.current.value = '';\n if (files.length) addFiles(files);\n },\n [addFiles]\n );\n\n const openFileDialog = useCallback(() => fileInputRef.current?.click(), []);\n\n const removeAttachment = useCallback(\n (id: AttachmentPreviewItem['id']) => {\n const key = String(id);\n abortUpload(key);\n releasePreview(entriesRef.current.find(entry => entry.id === key));\n commit(prev => prev.filter(entry => entry.id !== key));\n syncError();\n },\n [abortUpload, releasePreview, commit, syncError]\n );\n\n const handleRetry = useCallback(\n (id: AttachmentPreviewItem['id']) => {\n const key = String(id);\n const entry = entriesRef.current.find(item => item.id === key);\n if (!entry?.file) return;\n\n abortUpload(key);\n patchEntry(key, { isUploading: true, error: null });\n syncError();\n startUpload(key, entry.file);\n },\n [abortUpload, patchEntry, startUpload, syncError]\n );\n\n const reorderAttachments = useCallback(\n (orderedIds: AttachmentPreviewItem['id'][]) =>\n commit(prev => {\n const byId = new Map(prev.map(entry => [entry.id, entry]));\n const reordered = orderedIds.map(id => byId.get(String(id))).filter(Boolean) as Entry[];\n // Unlisted ids (a race with a removal) keep their place at the end.\n const missing = prev.filter(entry => !orderedIds.some(id => String(id) === entry.id));\n return [...reordered, ...missing];\n }),\n [commit]\n );\n\n const clearAttachments = useCallback(() => {\n entriesRef.current.forEach(entry => {\n abortUpload(entry.id);\n releasePreview(entry);\n });\n commit(() => []);\n onErrorRef.current?.(null);\n }, [abortUpload, commit, releasePreview]);\n\n // Adopt a value we didn't produce — an edit form's initial attachments, or a parent-side reset.\n // Compared against what we emitted, not against the current entries: a failed-only or\n // mid-upload list emits `[]` too, and treating that as \"in sync\" would strand those tiles\n // on screen and let a late upload write itself back into freshly reset parent state.\n useEffect(() => {\n if (isSameList(emittedRef.current, value)) return;\n\n entriesRef.current.forEach(entry => {\n abortUpload(entry.id);\n if (entry.previewUrl) URL.revokeObjectURL(entry.previewUrl);\n });\n entriesRef.current = value.map(toStoredEntry);\n emittedRef.current = value;\n setEntries(entriesRef.current);\n onErrorRef.current?.(null);\n }, [value, abortUpload]);\n\n // A stored url has expired by now, so re-sign it for the preview.\n const [storedSrcs, setStoredSrcs] = useState<Record<string, string>>({});\n const storedSrcsRef = useRef(storedSrcs);\n storedSrcsRef.current = storedSrcs;\n\n const storedNames = entries\n .filter(entry => !entry.file && entry.uploaded)\n .map(entry => (entry.uploaded as UploadedAttachment).name)\n .join('|');\n\n useEffect(() => {\n const pending = storedNames.split('|').filter(name => name && !(name in storedSrcsRef.current));\n if (!pending.length) return undefined;\n\n let isActive = true;\n Promise.all(\n pending.map(name =>\n getS3DownloadLink(name, 'inline')\n .then(({ url }: { url: string }) => [name, url] as const)\n .catch(error => {\n console.error(`Failed to sign stored attachment \"${name}\"`, error);\n\n return [name, ''] as const;\n })\n )\n ).then(resolved => {\n if (isActive) setStoredSrcs(prev => ({ ...prev, ...Object.fromEntries(resolved) }));\n });\n\n return () => {\n isActive = false;\n };\n }, [storedNames]);\n\n const items = entries.reduce<AttachmentPreviewItem[]>((acc, entry) => {\n if (entry.file) {\n acc.push({\n id: entry.id,\n name: entry.name,\n src: entry.previewUrl,\n kind: getFileKind(entry.file),\n isUploading: entry.isUploading,\n error: entry.error ?? undefined,\n });\n return acc;\n }\n\n const stored = entry.uploaded as UploadedAttachment;\n const kind = getAttachmentKind(stored);\n const src = storedSrcs[stored.name];\n // A thumbnail without its signed url would paint as a broken image, so hold it back.\n if (kind !== 'file' && !src) return acc;\n\n acc.push({ id: entry.id, name: stored.name, src, kind });\n return acc;\n }, []);\n\n return {\n items,\n fileInputRef,\n openFileDialog,\n handleFileSelect,\n addFiles,\n removeAttachment,\n handleRetry,\n reorderAttachments,\n clearAttachments,\n isUploading: entries.some(entry => entry.isUploading),\n error: entries.find(entry => entry.error)?.error ?? null,\n count: entries.length,\n isFull: entries.length >= maxFiles,\n maxFiles,\n };\n};\n"],"names":["getFileKind","file","type","startsWith","formatMb","bytes","toFixed","toStoredEntry","attachment","id","url","name","previewUrl","isUploading","error","uploaded","entrySeq","_ref","_entries$find$error","_entries$find","value","onChange","onError","maxSizeBytes","_ref$maxFiles","maxFiles","_ref$accept","accept","ACCEPTED_ATTACHMENT_TYPES","useState","_useState2","_slicedToArray","_useState","entries","setEntries","fileInputRef","useRef","uploadersRef","Map","sessionsRef","entriesRef","onChangeRef","onErrorRef","current","emittedRef","commit","useCallback","updater","next","map","entry","filter","Boolean","getUploaded","patchEntry","patch","prev","abortUpload","_uploadersRef$current","_sessionsRef$current$","get","delete","set","releasePreview","URL","revokeObjectURL","syncError","_onErrorRef$current","_entriesRef$current$f","_entriesRef$current$f2","find","useEffect","forEach","uploader","clear","startUpload","_sessionsRef$current$2","session","_onFinishS3Put","_getSignedUrl","isCurrent","fail","message","_onErrorRef$current2","storedKey","S3Upload","files","preprocess","target","onProgress","getSignedUrl","_asyncToGenerator","_regeneratorRuntime","mark","_callee","callback","_data","wrap","_context","getS3SignedUrl","data","sent","file_name","signedUrl","signed_url","t0","stop","_x","_x2","apply","this","arguments","onFinishS3Put","_callee2","_yield$getS3DownloadL","_context2","getS3DownloadLink","abrupt","size","addFiles","_onErrorRef$current4","_ref2","_entriesRef$current$f3","_entriesRef$current$f4","supported","split","rule","trim","toLowerCase","some","endsWith","slice","getAttachmentKind","isAcceptedType","unsupported","length","tooMany","room","_onErrorRef$current3","accepted","added","kind","isTooLarge","concat","createObjectURL","overflow","handleFileSelect","event","_event$target$files","Array","from","openFileDialog","_fileInputRef$current","click","removeAttachment","key","String","handleRetry","item","reorderAttachments","orderedIds","byId","reordered","missing","clearAttachments","_onErrorRef$current5","_onErrorRef$current6","a","b","every","index","_useState3","_useState4","storedSrcs","setStoredSrcs","storedSrcsRef","storedNames","join","pending","isActive","Promise","all","then","_ref3","catch","console","resolved","_objectSpread","Object","fromEntries","items","reduce","acc","_entry$error","push","src","undefined","stored","count","isFull"],"mappings":"gtCAwCO,IAoBDA,EAAc,SAACC,GACnB,OAAIA,EAAKC,KAAKC,WAAW,UAAkB,QACvCF,EAAKC,KAAKC,WAAW,UAAkB,QACpC,MACT,EAEMC,EAAW,SAACC,GAAa,OAAMA,EAAK,SAAkBC,QAAQ,EAAE,EAQhEC,EAAgB,SAACC,GAA8B,MAAa,CAChEC,GAAID,EAAW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MwL,IAAAA,EAAKtD,KAAAA,IAC1CmD,GAH6BA,CAIrC,GAAE,IAID7J,aAAAA,EACAoH,eAAAA,EACAL,iBAAAA,EACA3B,SAAAA,EACAmC,iBAAAA,EACAG,YAAAA,EACAE,mBAAAA,EACAK,iBAAAA,EACAvJ,YAAaoB,EAAQgG,MAAK,SAAA/E,GAAK,OAAIA,EAAMrC,eACzCC,MAAgD,UAAzC,UAAAmB,EAAQqC,MAAK,SAAApB,GAAK,OAAIA,EAAMpC,KAAK,WAAjC,IAAAK,OAAA,EAAAA,EAAoCL,aAAK,IAAAI,EAAAA,EAAI,KACpDoL,MAAOrK,EAAQsG,OACfgE,OAAQtK,EAAQsG,QAAU9G,EAC1BA,SAAAA,EAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("@babel/runtime/helpers/slicedToArray"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),s=require("@babel/runtime/helpers/slicedToArray"),o=require("react"),i=require("classnames"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),n=require("../../componentsV2/Tooltip/Tooltip.js"),r=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var t=require("../AttachmentPreview/AttachmentPreview.js");require("../../componentsV2/FileIcon/FileIcon.js"),require("@material-ui/core");var u=require("react/jsx-runtime");require("../AttachmentPreview/AttachmentPreview.scss.js"),require("../../utils/main.js"),require("file-extension"),require("image-extensions"),require("video-extensions"),require("../../clients/jsonApi/index.js"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator");var a=require("./useFileDrop.js"),l=require("./CommentInputNext.scss.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=m(e),j=m(s),q=m(i);function I(e,s){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);s&&(i=i.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),o.push.apply(o,i)}return o}function p(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?I(Object(o),!0).forEach((function(s){d.default(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):I(Object(o)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(o,s))}))}return e}var h=o.forwardRef((function(e,s){var i=e.placeholder,m=void 0===i?"Add a comment":i,d=e.value,I=e.onChange,h=e.onSubmit,v=e.onCancel,f=e.disabled,b=e.autoFocus,x=e.minRows,g=void 0===x?1:x,O=e.maxRows,y=e.field,C=e.canSubmit,P=e.bare,F=e.leading,A=e.trailing,w=e.sendTooltip,D=void 0===w?"Send":w,N=e.attachments,R=e.onAttachmentRemove,S=e.onAttachmentRetry,k=e.onAttachmentReorder,E=e.onFilesDrop,M=e.dropLabel,T=void 0===M?"Drop files here":M,B=e.attachmentSlot,G=e.toolbar,U=e.footer,L=e.embedded,z=e.className,H=e.testId,K=a.useFileDrop(f?void 0:E),V=K.isDragging,W=K.dropHandlers,_=V&&u.jsx("div",{className:l.dropOverlay,children:T}),Y=void 0!==d,Z=o.useState(""),J=j.default(Z,2),Q=J[0],X=J[1],$=Y?d:Q,ee=null!=O?O:P?12:8,se=o.useRef(null),oe=o.useCallback((function(e){if(se.current=e,e){var s=e;s.style.height="auto";var o=20*ee;s.style.height="".concat(Math.min(s.scrollHeight,o),"px"),s.style.overflowY=s.scrollHeight>o?"auto":"hidden"}}),[ee]);o.useLayoutEffect((function(){y||oe(se.current)}),[$,y,oe]);var ie=(null!=C?C:!!$.trim())&&!f,ce=function(){ie&&(null==h||h($.trim()),Y||y||X(""))},ne=null!=y?y:u.jsx("textarea",{ref:oe,className:l.input,rows:g,placeholder:m,value:$,disabled:f,autoFocus:b,onChange:function(e){var s;s=e.target.value,Y||X(s),null==I||I(s),oe(e.target)},onKeyDown:function(e){if("Escape"===e.key&&v)return e.preventDefault(),void v();"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ce())}}),re=null!=A?A:u.jsx(n.Tooltip,{title:D,children:u.jsx("span",{className:l.send,children:u.jsx(c.ButtonIcon,{size:P?"xs":"small",type:"primary",disabled:!ie,onClick:ce,testId:"comment-input-send",children:u.jsx(r.ArrowUpIcon,{})})})}),te=((null==N?void 0:N.length)||B)&&u.jsxs("div",{className:l.attachment,children:[null!=N&&N.length?u.jsx(t.AttachmentPreview,{items:N,onRemove:R,onRetry:S,onReorder:k}):null,B]});return P?u.jsxs("div",p(p({ref:s,"data-testid":H,className:q.default(l.rootBare,z)},W),{},{children:[_,u.jsxs("div",{className:l.fieldRow,children:[F&&u.jsx("div",{className:l.leading,children:F}),u.jsxs("div",{className:q.default(l.field,!!te&&l.fieldExpanded,f&&l.fieldDisabled),children:[u.jsxs("div",{className:l.fieldMain,children:[ne,te]}),G&&u.jsx("div",{className:l.bareToolbar,children:G}),re]})]})]})):u.jsxs("div",p(p({ref:s,"data-testid":H,className:q.default(l.root,L&&l.rootEmbedded,z)},W),{},{children:[_,u.jsxs("div",{className:l.inputPanel,children:[ne,te,u.jsxs("div",{className:l.toolbarRow,children:[u.jsx("div",{className:l.toolbar,children:G}),re]})]}),U&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:l.divider}),u.jsx("div",{className:l.metaShare,children:U})]})]}))}));exports.CommentInput=h;
|
|
2
2
|
//# sourceMappingURL=CommentInputNext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentInputNext.js","sources":["../../../../src/components/CommentInputNext/CommentInputNext.tsx"],"sourcesContent":["import {\n forwardRef,\n KeyboardEvent,\n ReactNode,\n useState,\n useCallback,\n useRef,\n useLayoutEffect,\n ChangeEvent,\n} from 'react';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { ArrowUpIcon } from '../../icons';\nimport { AttachmentPreview } from '../AttachmentPreview';\nimport { AttachmentPreviewItem } from '../AttachmentPreview/AttachmentPreview.types';\n\nimport styles from './CommentInputNext.scss';\n\nexport type CommentInputProps = {\n placeholder?: string;\n value?: string;\n onChange?: (value: string) => void;\n onSubmit?: (value: string) => void;\n disabled?: boolean;\n autoFocus?: boolean;\n minRows?: number;\n maxRows?: number;\n\n /** Editable control rendered in place of the built-in textarea. */\n field?: ReactNode;\n canSubmit?: boolean;\n /** Drop the outer surface so the field sits flush, for the in-card reply input. */\n bare?: boolean;\n\n leading?: ReactNode;\n /** Replaces the default send button. */\n trailing?: ReactNode;\n sendTooltip?: string;\n\n attachments?: AttachmentPreviewItem[];\n onAttachmentRemove?: (id: AttachmentPreviewItem['id']) => void;\n onAttachmentRetry?: (id: AttachmentPreviewItem['id']) => void;\n /** Extra content in the attachment area, e.g. an upload-error banner. */\n attachmentSlot?: ReactNode;\n toolbar?: ReactNode;\n footer?: ReactNode;\n /** Render flush inside a host surface: no background, full-width divider. */\n embedded?: boolean;\n\n className?: string;\n testId?: string;\n};\n\nconst LINE_HEIGHT_PX = 20;\nconst DEFAULT_MAX_ROWS = 8;\nconst BARE_MAX_ROWS = 12;\n\nexport const CommentInput = forwardRef<HTMLDivElement, CommentInputProps>(\n (\n {\n placeholder = 'Add a comment',\n value,\n onChange,\n onSubmit,\n disabled,\n autoFocus,\n minRows = 1,\n maxRows,\n field,\n canSubmit,\n bare,\n leading,\n trailing,\n sendTooltip = 'Send',\n attachments,\n onAttachmentRemove,\n onAttachmentRetry,\n attachmentSlot,\n toolbar,\n footer,\n embedded,\n className,\n testId,\n },\n ref\n ) => {\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState('');\n const text = isControlled ? value : internalValue;\n\n // The bare reply field has no toolbar row, so text may fill the whole box.\n const rowsCap = maxRows ?? (bare ? BARE_MAX_ROWS : DEFAULT_MAX_ROWS);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const resize = useCallback(\n (el: HTMLTextAreaElement | null) => {\n textareaRef.current = el;\n if (!el) return;\n const node = el;\n node.style.height = 'auto';\n const maxHeight = rowsCap * LINE_HEIGHT_PX;\n node.style.height = `${Math.min(node.scrollHeight, maxHeight)}px`;\n node.style.overflowY = node.scrollHeight > maxHeight ? 'auto' : 'hidden';\n },\n [rowsCap]\n );\n\n // The ref callback won't fire for a prop-driven value change.\n useLayoutEffect(() => {\n if (!field) resize(textareaRef.current);\n }, [text, field, resize]);\n\n const setText = (next: string) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n };\n\n const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {\n setText(event.target.value);\n resize(event.target);\n };\n\n const canSend = (canSubmit ?? !!text.trim()) && !disabled;\n\n const submit = () => {\n if (!canSend) return;\n onSubmit?.(text.trim());\n if (!isControlled && !field) setInternalValue('');\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n submit();\n }\n };\n\n const editor = field ?? (\n <textarea\n ref={resize}\n className={styles.input}\n rows={minRows}\n placeholder={placeholder}\n value={text}\n disabled={disabled}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n />\n );\n\n const sendButton = trailing ?? (\n // A disabled button fires no events, so the tooltip needs its own target.\n <Tooltip title={sendTooltip}>\n <span className={styles.send}>\n <ButtonIcon\n size={bare ? 'xs' : 'small'}\n type=\"primary\"\n disabled={!canSend}\n onClick={submit}\n testId=\"comment-input-send\"\n >\n <ArrowUpIcon />\n </ButtonIcon>\n </span>\n </Tooltip>\n );\n\n const attachmentArea = (attachments?.length || attachmentSlot) && (\n <div className={styles.attachment}>\n {attachments?.length ? (\n <AttachmentPreview\n items={attachments}\n onRemove={onAttachmentRemove}\n onRetry={onAttachmentRetry}\n />\n ) : null}\n {attachmentSlot}\n </div>\n );\n\n if (bare) {\n return (\n <div ref={ref} data-testid={testId} className={classNames(styles.rootBare, className)}>\n <div className={styles.fieldRow}>\n {leading && <div className={styles.leading}>{leading}</div>}\n <div\n className={classNames(\n styles.field,\n !!attachmentArea && styles.fieldExpanded,\n disabled && styles.fieldDisabled\n )}\n >\n <div className={styles.fieldMain}>\n {editor}\n {attachmentArea}\n </div>\n {toolbar && <div className={styles.bareToolbar}>{toolbar}</div>}\n {sendButton}\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={classNames(styles.root, embedded && styles.rootEmbedded, className)}\n >\n <div className={styles.inputPanel}>\n {editor}\n {attachmentArea}\n <div className={styles.toolbarRow}>\n <div className={styles.toolbar}>{toolbar}</div>\n {sendButton}\n </div>\n </div>\n\n {footer && (\n <>\n <div className={styles.divider} />\n <div className={styles.metaShare}>{footer}</div>\n </>\n )}\n </div>\n );\n }\n);\n"],"names":["CommentInput","forwardRef","_ref","ref","_ref$placeholder","placeholder","value","onChange","onSubmit","disabled","autoFocus","_ref$minRows","minRows","maxRows","field","canSubmit","bare","leading","trailing","_ref$sendTooltip","sendTooltip","attachments","onAttachmentRemove","onAttachmentRetry","attachmentSlot","toolbar","footer","embedded","className","testId","isControlled","undefined","useState","_useState2","_slicedToArray","_useState","internalValue","setInternalValue","text","rowsCap","textareaRef","useRef","resize","useCallback","el","current","node","style","height","maxHeight","Math","min","scrollHeight","overflowY","useLayoutEffect","canSend","trim","submit","editor","_jsx","jsx","styles","input","rows","event","next","target","onKeyDown","key","shiftKey","preventDefault","sendButton","Tooltip","title","children","send","ButtonIcon","size","type","onClick","ArrowUpIcon","attachmentArea","length","_jsxs","attachment","AttachmentPreview","items","onRemove","onRetry","classNames","rootBare","jsxs","fieldRow","fieldExpanded","fieldDisabled","fieldMain","bareToolbar","root","rootEmbedded","inputPanel","toolbarRow","_Fragment","divider","metaShare"],"mappings":"0hJA2DaA,EAAeC,EAAUA,YACpC,SAAAC,EA0BEC,GACG,IAAAC,EAAAF,EAzBDG,YAAAA,aAAc,gBAAeD,EAC7BE,IAAAA,MACAC,IAAAA,SACAC,IAAAA,SACAC,IAAAA,SACAC,IAAAA,UAASC,EAAAT,EACTU,QAAAA,aAAU,EAACD,EACXE,IAAAA,QACAC,IAAAA,MACAC,IAAAA,UACAC,IAAAA,KACAC,IAAAA,QACAC,IAAAA,SAAQC,EAAAjB,EACRkB,YAAAA,aAAc,OAAMD,EACpBE,IAAAA,YACAC,IAAAA,mBACAC,IAAAA,kBACAC,IAAAA,eACAC,IAAAA,QACAC,IAAAA,OACAC,IAAAA,SACAC,IAAAA,UACAC,IAAAA,OAIIC,OAAyBC,IAAVzB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AW1B,SAChC,CAAAf,EAAAC,IAAA,MAAA,CAAKhC,UAAWiC,EAAOpC,QAAQiD,SAAEjD,IAChC8C,QAIJ7C,GACCyD,EAAAQ,KAAAU,WAAA,CAAA3B,SACE,CAAAf,EAAAC,IAAA,MAAA,CAAKhC,UAAWiC,EAAOyC,UACvB3C,EAAAC,IAAA,MAAA,CAAKhC,UAAWiC,EAAO0C,UAAU7B,SAAEhD,SAK7C"}
|
|
1
|
+
{"version":3,"file":"CommentInputNext.js","sources":["../../../../src/components/CommentInputNext/CommentInputNext.tsx"],"sourcesContent":["import {\n forwardRef,\n KeyboardEvent,\n ReactNode,\n useState,\n useCallback,\n useRef,\n useLayoutEffect,\n ChangeEvent,\n} from 'react';\nimport classNames from 'classnames';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { ArrowUpIcon } from '../../icons';\nimport { AttachmentPreview } from '../AttachmentPreview';\nimport { AttachmentPreviewItem } from '../AttachmentPreview/AttachmentPreview.types';\n\nimport { useFileDrop } from './useFileDrop';\n\nimport styles from './CommentInputNext.scss';\n\nexport type CommentInputProps = {\n placeholder?: string;\n value?: string;\n onChange?: (value: string) => void;\n onSubmit?: (value: string) => void;\n onCancel?: () => void;\n disabled?: boolean;\n autoFocus?: boolean;\n minRows?: number;\n maxRows?: number;\n\n /** Editable control rendered in place of the built-in textarea. */\n field?: ReactNode;\n canSubmit?: boolean;\n /** Drop the outer surface so the field sits flush, for the in-card reply input. */\n bare?: boolean;\n\n leading?: ReactNode;\n /** Replaces the default send button. */\n trailing?: ReactNode;\n sendTooltip?: string;\n\n attachments?: AttachmentPreviewItem[];\n onAttachmentRemove?: (id: AttachmentPreviewItem['id']) => void;\n onAttachmentRetry?: (id: AttachmentPreviewItem['id']) => void;\n /** Enables drag-to-reorder on the attachment strip. */\n onAttachmentReorder?: (orderedIds: AttachmentPreviewItem['id'][]) => void;\n /** Enables dropping files from the desktop onto the composer. */\n onFilesDrop?: (files: File[]) => void;\n dropLabel?: string;\n /** Extra content in the attachment area, e.g. an upload-error banner. */\n attachmentSlot?: ReactNode;\n toolbar?: ReactNode;\n footer?: ReactNode;\n /** Render flush inside a host surface: no background, full-width divider. */\n embedded?: boolean;\n\n className?: string;\n testId?: string;\n};\n\nconst LINE_HEIGHT_PX = 20;\nconst DEFAULT_MAX_ROWS = 8;\nconst BARE_MAX_ROWS = 12;\n\nexport const CommentInput = forwardRef<HTMLDivElement, CommentInputProps>(\n (\n {\n placeholder = 'Add a comment',\n value,\n onChange,\n onSubmit,\n onCancel,\n disabled,\n autoFocus,\n minRows = 1,\n maxRows,\n field,\n canSubmit,\n bare,\n leading,\n trailing,\n sendTooltip = 'Send',\n attachments,\n onAttachmentRemove,\n onAttachmentRetry,\n onAttachmentReorder,\n onFilesDrop,\n dropLabel = 'Drop files here',\n attachmentSlot,\n toolbar,\n footer,\n embedded,\n className,\n testId,\n },\n ref\n ) => {\n const { isDragging, dropHandlers } = useFileDrop(disabled ? undefined : onFilesDrop);\n const dropOverlay = isDragging && <div className={styles.dropOverlay}>{dropLabel}</div>;\n\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState('');\n const text = isControlled ? value : internalValue;\n\n // The bare reply field has no toolbar row, so text may fill the whole box.\n const rowsCap = maxRows ?? (bare ? BARE_MAX_ROWS : DEFAULT_MAX_ROWS);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const resize = useCallback(\n (el: HTMLTextAreaElement | null) => {\n textareaRef.current = el;\n if (!el) return;\n const node = el;\n node.style.height = 'auto';\n const maxHeight = rowsCap * LINE_HEIGHT_PX;\n node.style.height = `${Math.min(node.scrollHeight, maxHeight)}px`;\n node.style.overflowY = node.scrollHeight > maxHeight ? 'auto' : 'hidden';\n },\n [rowsCap]\n );\n\n // The ref callback won't fire for a prop-driven value change.\n useLayoutEffect(() => {\n if (!field) resize(textareaRef.current);\n }, [text, field, resize]);\n\n const setText = (next: string) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n };\n\n const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {\n setText(event.target.value);\n resize(event.target);\n };\n\n const canSend = (canSubmit ?? !!text.trim()) && !disabled;\n\n const submit = () => {\n if (!canSend) return;\n onSubmit?.(text.trim());\n if (!isControlled && !field) setInternalValue('');\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Escape' && onCancel) {\n event.preventDefault();\n onCancel();\n return;\n }\n\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n submit();\n }\n };\n\n const editor = field ?? (\n <textarea\n ref={resize}\n className={styles.input}\n rows={minRows}\n placeholder={placeholder}\n value={text}\n disabled={disabled}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n />\n );\n\n const sendButton = trailing ?? (\n // A disabled button fires no events, so the tooltip needs its own target.\n <Tooltip title={sendTooltip}>\n <span className={styles.send}>\n <ButtonIcon\n size={bare ? 'xs' : 'small'}\n type=\"primary\"\n disabled={!canSend}\n onClick={submit}\n testId=\"comment-input-send\"\n >\n <ArrowUpIcon />\n </ButtonIcon>\n </span>\n </Tooltip>\n );\n\n const attachmentArea = (attachments?.length || attachmentSlot) && (\n <div className={styles.attachment}>\n {attachments?.length ? (\n <AttachmentPreview\n items={attachments}\n onRemove={onAttachmentRemove}\n onRetry={onAttachmentRetry}\n onReorder={onAttachmentReorder}\n />\n ) : null}\n {attachmentSlot}\n </div>\n );\n\n if (bare) {\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={classNames(styles.rootBare, className)}\n {...dropHandlers}\n >\n {dropOverlay}\n <div className={styles.fieldRow}>\n {leading && <div className={styles.leading}>{leading}</div>}\n <div\n className={classNames(\n styles.field,\n !!attachmentArea && styles.fieldExpanded,\n disabled && styles.fieldDisabled\n )}\n >\n <div className={styles.fieldMain}>\n {editor}\n {attachmentArea}\n </div>\n {toolbar && <div className={styles.bareToolbar}>{toolbar}</div>}\n {sendButton}\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={classNames(styles.root, embedded && styles.rootEmbedded, className)}\n {...dropHandlers}\n >\n {dropOverlay}\n <div className={styles.inputPanel}>\n {editor}\n {attachmentArea}\n <div className={styles.toolbarRow}>\n <div className={styles.toolbar}>{toolbar}</div>\n {sendButton}\n </div>\n </div>\n\n {footer && (\n <>\n <div className={styles.divider} />\n <div className={styles.metaShare}>{footer}</div>\n </>\n )}\n </div>\n );\n }\n);\n"],"names":["CommentInput","forwardRef","_ref","ref","_ref$placeholder","placeholder","value","onChange","onSubmit","onCancel","disabled","autoFocus","_ref$minRows","minRows","maxRows","field","canSubmit","bare","leading","trailing","_ref$sendTooltip","sendTooltip","attachments","onAttachmentRemove","onAttachmentRetry","onAttachmentReorder","onFilesDrop","_ref$dropLabel","dropLabel","attachmentSlot","toolbar","footer","embedded","className","testId","_useFileDrop","useFileDrop","undefined","isDragging","dropHandlers","dropOverlay","_jsx","jsx","styles","children","isControlled","useState","_useState2","_slicedToArray","_useState","internalValue","setInternalValue","text","rowsCap","textareaRef","useRef","resize","useCallback","el","current","node","style","height","maxHeight","Math","min","scrollHeight","overflowY","useLayoutEffect","canSend","trim","submit","editor","input","rows","event","next","target","onKeyDown","key","preventDefault","shiftKey","sendButton","Tooltip","title","send","ButtonIcon","size","type","onClick","ArrowUpIcon","attachmentArea","length","_jsxs","attachment","AttachmentPreview","items","onRemove","onRetry","onReorder","_objectSpread","classNames","rootBare","jsxs","fieldRow","fieldExpanded","fieldDisabled","fieldMain","bareToolbar","root","rootEmbedded","inputPanel","toolbarRow","_Fragment","divider","metaShare"],"mappings":"k2KA+DA,IAIaA,EAAeC,EAAUA,YACpC,SAAAC,EA8BEC,GACG,IAAAC,EAAAF,EA7BDG,YAAAA,aAAc,gBAAeD,EAC7BE,IAAAA,MACAC,IAAAA,SACAC,IAAAA,SACAC,IA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