box-ui-elements 19.0.0 → 20.0.0-beta.1
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/dist/explorer.js +1 -1
- package/dist/openwith.js +1 -1
- package/dist/picker.js +1 -1
- package/dist/preview.js +1 -1
- package/dist/sharing.js +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/uploader.js +1 -1
- package/es/components/breadcrumb/Breadcrumb.js.flow +3 -2
- package/es/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/es/components/date-picker/DatePicker.js.flow +3 -2
- package/es/components/grid-view/GridViewSlider.js.flow +3 -2
- package/es/components/grid-view/GridViewSlider.js.map +1 -1
- package/es/components/i18n/FormattedCompMessage.js +1 -0
- package/es/components/i18n/FormattedCompMessage.js.flow +1 -0
- package/es/components/i18n/FormattedCompMessage.js.map +1 -1
- package/es/components/i18n/Plural.js +1 -1
- package/es/components/i18n/Plural.js.flow +1 -1
- package/es/components/i18n/Plural.js.map +1 -1
- package/es/components/i18n/index.js +1 -1
- package/es/components/i18n/index.js.flow +1 -1
- package/es/components/i18n/index.js.map +1 -1
- package/es/components/sidebar-toggle-button/SidebarToggleButton.js.flow +3 -2
- package/es/components/sidebar-toggle-button/SidebarToggleButton.js.map +1 -1
- package/es/components/time/ReadableTime.js +7 -8
- package/es/components/time/ReadableTime.js.flow +4 -8
- package/es/components/time/ReadableTime.js.map +1 -1
- package/es/elements/common/breadcrumbs/Breadcrumbs.js.flow +3 -2
- package/es/elements/common/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/es/elements/common/create-folder-dialog/CreateFolderDialog.js.flow +3 -2
- package/es/elements/common/create-folder-dialog/CreateFolderDialog.js.map +1 -1
- package/es/elements/common/date/DateField.js.flow +3 -2
- package/es/elements/common/date/DateField.js.map +1 -1
- package/es/elements/common/share-access-select/ShareAccessSelect.js.flow +3 -2
- package/es/elements/common/share-access-select/ShareAccessSelect.js.map +1 -1
- package/es/elements/common/sub-header/SubHeaderLeft.js.flow +3 -2
- package/es/elements/common/sub-header/SubHeaderLeft.js.map +1 -1
- package/es/elements/common/sub-header/ViewModeChangeButton.js.flow +3 -2
- package/es/elements/common/sub-header/ViewModeChangeButton.js.map +1 -1
- package/es/elements/common/upload-dialog/UploadDialog.js.flow +3 -2
- package/es/elements/common/upload-dialog/UploadDialog.js.map +1 -1
- package/es/elements/content-explorer/DeleteConfirmationDialog.js.flow +3 -2
- package/es/elements/content-explorer/DeleteConfirmationDialog.js.map +1 -1
- package/es/elements/content-explorer/ItemList.js.flow +3 -2
- package/es/elements/content-explorer/ItemList.js.map +1 -1
- package/es/elements/content-explorer/PreviewDialog.js.flow +3 -2
- package/es/elements/content-explorer/PreviewDialog.js.map +1 -1
- package/es/elements/content-explorer/RenameDialog.js.flow +3 -2
- package/es/elements/content-explorer/RenameDialog.js.map +1 -1
- package/es/elements/content-explorer/ShareDialog.js.flow +3 -2
- package/es/elements/content-explorer/ShareDialog.js.map +1 -1
- package/es/elements/content-preview/PreviewNavigation.js.flow +3 -2
- package/es/elements/content-preview/PreviewNavigation.js.map +1 -1
- package/es/elements/content-preview/preview-header/PreviewHeader.js.flow +3 -2
- package/es/elements/content-preview/preview-header/PreviewHeader.js.map +1 -1
- package/es/elements/content-sidebar/SidebarAccessStats.js.flow +3 -2
- package/es/elements/content-sidebar/SidebarAccessStats.js.map +1 -1
- package/es/elements/content-sidebar/SidebarFileProperties.js.flow +3 -2
- package/es/elements/content-sidebar/SidebarFileProperties.js.map +1 -1
- package/es/elements/content-sidebar/SidebarNav.js.flow +3 -2
- package/es/elements/content-sidebar/SidebarNav.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js.flow +3 -2
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.js.flow +3 -2
- package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js.flow +2 -2
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/version/CollapsedVersion.js.flow +3 -2
- package/es/elements/content-sidebar/activity-feed/version/CollapsedVersion.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/version/Version.js.flow +3 -2
- package/es/elements/content-sidebar/activity-feed/version/Version.js.map +1 -1
- package/es/elements/content-uploader/ItemAction.js.flow +3 -2
- package/es/elements/content-uploader/ItemAction.js.map +1 -1
- package/es/elements/content-uploader/ItemRemove.js.flow +3 -2
- package/es/elements/content-uploader/ItemRemove.js.map +1 -1
- package/es/features/classification/security-controls/messages.js +1 -1
- package/es/features/classification/security-controls/messages.js.flow +1 -1
- package/es/features/classification/security-controls/messages.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorAvatarItem.js.flow +3 -2
- package/es/features/collaborator-avatars/CollaboratorAvatarItem.js.map +1 -1
- package/es/features/collapsible-sidebar/CollapsibleSidebarLogo.js.flow +4 -2
- package/es/features/collapsible-sidebar/CollapsibleSidebarLogo.js.map +1 -1
- package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js +5 -3
- package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js.flow +3 -0
- package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js.map +1 -1
- package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js +10 -4
- package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js.flow +5 -0
- package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js.map +1 -1
- package/es/features/content-explorer/new-folder-modal/NewFolderModal.js +9 -3
- package/es/features/content-explorer/new-folder-modal/NewFolderModal.js.flow +5 -0
- package/es/features/content-explorer/new-folder-modal/NewFolderModal.js.map +1 -1
- package/es/features/message-center/components/message-center-modal/MessageCenterModal.js.flow +4 -2
- package/es/features/message-center/components/message-center-modal/MessageCenterModal.js.map +1 -1
- package/es/features/presence/PresenceAvatarTooltipContent.js +8 -10
- package/es/features/presence/PresenceAvatarTooltipContent.js.map +1 -1
- package/es/features/presence/PresenceCollaborator.js +6 -1
- package/es/features/presence/PresenceCollaborator.js.flow +3 -3
- package/es/features/presence/PresenceCollaborator.js.map +1 -1
- package/es/features/shared-link-modal/SharedLink.js.flow +3 -2
- package/es/features/shared-link-modal/SharedLink.js.map +1 -1
- package/es/features/unified-share-modal/ContactRestrictionNotice.js.flow +3 -2
- package/es/features/unified-share-modal/ContactRestrictionNotice.js.map +1 -1
- package/es/features/virtualized-table/VirtualizedTable.js.flow +2 -2
- package/es/features/virtualized-table/VirtualizedTable.js.map +1 -1
- package/es/features/virtualized-table-renderers/lastModifiedByCellRenderer.js +6 -11
- package/es/features/virtualized-table-renderers/lastModifiedByCellRenderer.js.flow +3 -8
- package/es/features/virtualized-table-renderers/lastModifiedByCellRenderer.js.map +1 -1
- package/es/src/components/avatar/Avatar.d.ts +1 -3
- package/es/src/components/avatar/Avatar.stories.d.ts +1 -3
- package/es/src/components/close-button/CloseButton.d.ts +1 -3
- package/es/src/components/close-button/CloseButton.stories.d.ts +1 -3
- package/es/src/components/date-picker/DatePicker.d.ts +1 -3
- package/es/src/components/date-picker/DatePicker.stories.d.ts +1 -3
- package/es/src/components/media/Media.d.ts +1 -3
- package/es/src/components/media/MediaMenu.d.ts +1 -3
- package/es/src/components/media/stories/Media.stories.d.ts +1 -3
- package/es/src/components/media/stories/MediaMenu.stories.d.ts +1 -3
- package/es/src/components/search-form/SearchActions.d.ts +2 -2
- package/es/src/components/time-input/TimeInput.d.ts +1 -3
- package/es/src/components/time-input/TimeInput.stories.d.ts +1 -3
- package/es/src/components/tooltip/CloseButton.d.ts +1 -3
- package/es/src/elements/content-sidebar/SidebarNavSignButton.d.ts +2 -4
- package/es/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivityLink.d.ts +1 -3
- package/es/src/features/content-answers/ContentAnswersModalFooter.d.ts +1 -3
- package/es/src/features/content-answers/ContentAnswersOpenButton.d.ts +1 -3
- package/es/src/features/content-insights/CompactCount.d.ts +1 -3
- package/es/src/features/content-insights/GraphCardPreviewsSummary.d.ts +1 -3
- package/es/src/features/content-insights/MetricSummary.d.ts +1 -3
- package/es/src/features/content-insights/TrendPill.d.ts +1 -3
- package/es/src/features/presence/PresenceAvatarTooltipContent.d.ts +2 -4
- package/es/utils/relativeTime.js +54 -0
- package/es/utils/relativeTime.js.flow +31 -0
- package/es/utils/relativeTime.js.map +1 -0
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.properties +1 -1
- package/package.json +4 -4
- package/src/components/breadcrumb/Breadcrumb.js +3 -2
- package/src/components/date-picker/DatePicker.js.flow +3 -2
- package/src/components/grid-view/GridViewSlider.js +3 -2
- package/src/components/i18n/FormattedCompMessage.js +1 -0
- package/src/components/i18n/Plural.js +1 -1
- package/src/components/i18n/README.md +4 -0
- package/src/components/i18n/index.js +1 -1
- package/src/components/sidebar-toggle-button/SidebarToggleButton.js +3 -2
- package/src/components/time/ReadableTime.js +4 -8
- package/src/components/time/__tests__/__snapshots__/ReadableTime.test.js.snap +7 -7
- package/src/elements/common/breadcrumbs/Breadcrumbs.js +3 -2
- package/src/elements/common/create-folder-dialog/CreateFolderDialog.js +3 -2
- package/src/elements/common/date/DateField.js +3 -2
- package/src/elements/common/share-access-select/ShareAccessSelect.js +3 -2
- package/src/elements/common/sub-header/SubHeaderLeft.js +3 -2
- package/src/elements/common/sub-header/ViewModeChangeButton.js +3 -2
- package/src/elements/common/upload-dialog/UploadDialog.js +3 -2
- package/src/elements/content-explorer/DeleteConfirmationDialog.js +3 -2
- package/src/elements/content-explorer/ItemList.js +3 -2
- package/src/elements/content-explorer/PreviewDialog.js +3 -2
- package/src/elements/content-explorer/RenameDialog.js +3 -2
- package/src/elements/content-explorer/ShareDialog.js +3 -2
- package/src/elements/content-preview/PreviewNavigation.js +3 -2
- package/src/elements/content-preview/preview-header/PreviewHeader.js +3 -2
- package/src/elements/content-sidebar/SidebarAccessStats.js +3 -2
- package/src/elements/content-sidebar/SidebarFileProperties.js +3 -2
- package/src/elements/content-sidebar/SidebarNav.js +3 -2
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js +3 -2
- package/src/elements/content-sidebar/activity-feed/comment-form/CommentForm.js +3 -2
- package/src/elements/content-sidebar/activity-feed/task-form/TaskForm.js +2 -2
- package/src/elements/content-sidebar/activity-feed/version/CollapsedVersion.js +3 -2
- package/src/elements/content-sidebar/activity-feed/version/Version.js +3 -2
- package/src/elements/content-uploader/ItemAction.js +3 -2
- package/src/elements/content-uploader/ItemRemove.js +3 -2
- package/src/features/classification/security-controls/__tests__/__snapshots__/SecurityControlsModal.test.js.snap +1 -1
- package/src/features/classification/security-controls/messages.js +1 -1
- package/src/features/collaborator-avatars/CollaboratorAvatarItem.js +3 -2
- package/src/features/collapsible-sidebar/CollapsibleSidebarLogo.js +4 -2
- package/src/features/content-explorer/content-explorer-modal/ContentExplorerModal.js +3 -0
- package/src/features/content-explorer/content-explorer-modal/__tests__/__snapshots__/ContentExplorerModal.test.js.snap +1 -0
- package/src/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js +5 -0
- package/src/features/content-explorer/content-explorer-modal-container/__tests__/ContentExplorerModalContainer.test.js +16 -2
- package/src/features/content-explorer/new-folder-modal/NewFolderModal.js +5 -0
- package/src/features/message-center/components/message-center-modal/MessageCenterModal.js +4 -2
- package/src/features/presence/PresenceAvatarTooltipContent.tsx +4 -8
- package/src/features/presence/PresenceCollaborator.js +3 -3
- package/src/features/presence/__tests__/PresenceAvatarTooltipContent.test.tsx +2 -2
- package/src/features/shared-link-modal/SharedLink.js +3 -2
- package/src/features/unified-share-modal/ContactRestrictionNotice.js +3 -2
- package/src/features/virtualized-table/VirtualizedTable.js +2 -2
- package/src/features/virtualized-table-renderers/__tests__/__snapshots__/lastModifiedByCellRenderer.test.js.snap +1 -1
- package/src/features/virtualized-table-renderers/__tests__/lastModifiedByCellRenderer.test.js +14 -9
- package/src/features/virtualized-table-renderers/lastModifiedByCellRenderer.js +3 -8
- package/src/utils/__tests__/relativeTime.test.js +45 -0
- package/src/utils/relativeTime.js +31 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js"],"names":["PropTypes","React","Component","classNames","BreadcrumbPropType","ContentExplorerModePropType","FoldersPathPropType","ItemsPropType","ContentExplorerModal","NewFolderModal","ContentExplorerModalContainer","constructor","props","enteredFolder","newFoldersPath","onEnterFolder","setState","foldersPath","onNewFolderModalShown","isNewFolderModalOpen","onNewFolderModalClosed","state","initialFoldersPath","componentDidUpdate","prevInitialFoldersPath","render","className","modalTitle","modalDescription","onCreateFolderSubmit","onCreateFolderInput","isCreatingFolder","createFolderError","rest","currentFolder","length","handleEnterFolder","handleCreateNewFolderButtonClick","name","handleNewFolderModalClose","additionalColumns","arrayOf","element","isNoSelectionAllowed","bool","breadcrumbProps","string","hasFolderTreeBreadcrumbs","headerActionsAccessory","node","onRequestClose","func","isRequired","onSelectedClick","onSelectItem","onViewSelectedClick","isSelectAllAllowed","contentExplorerMode","includeSubfoldersProps","object","initialSelectedItems","controlledSelectedItems","onFoldersPathUpdate","onSelectedItemsUpdate","onChooseItems","onMoveItem","onCopyItem","isCreateNewFolderAllowed","onSearchSubmit","onExitSearch","items","numItemsPerPage","number","numTotalItems","onLoadMoreItems","itemIconRenderer","itemNameLinkRenderer","itemButtonRenderer","itemRowHeight","itemRowRenderer","listHeaderHeight","listHeaderRenderer","showCreateNewFolderButton","searchInputProps","chooseButtonText"],"mappings":";;;;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAASC,kBAAT,EAA6BC,2BAA7B,EAA0DC,mBAA1D,EAA+EC,aAA/E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S,CAACwE,MAjIV;;AAkIf;AACAO,EAAAA,eAAe,EAAE/E,SAAS,CAACmD,IAnIZ;;AAoIf;AACA6B,EAAAA,gBAAgB,EAAEhF,SAAS,CAACwE,MArIb;;AAsIf;AACAS,EAAAA,kBAAkB,EAAEjF,SAAS,CAACmD,IAvIf;;AAwIf;AACA+B,EAAAA,yBAAyB,EAAElF,SAAS,CAAC4C,IAzItB;;AA0If;AACAuC,EAAAA,gBAAgB,EAAEnF,SAAS,CAAC2D,MA3Ib;;AA4If;AACAyB,EAAAA,gBAAgB,EAAEpF,SAAS,CAACiD;AA7Ib,C;;gBADjBvC,6B,kBAiJoB;AAClBmB,EAAAA,oBAAoB,EAAE,MAAM,CAAE;AADZ,C;;AAsF1B,eAAenB,6BAAf","sourcesContent":["import PropTypes from 'prop-types';\nimport React, { Component } from 'react';\nimport classNames from 'classnames';\n\nimport { BreadcrumbPropType, ContentExplorerModePropType, FoldersPathPropType, ItemsPropType } from '../prop-types';\nimport ContentExplorerModal from '../content-explorer-modal';\nimport NewFolderModal from '../new-folder-modal';\n\nclass ContentExplorerModalContainer extends Component {\n static propTypes = {\n /**\n * Extra columns displayed in the folders table after folder name column\n * Each column has to be a Column element\n */\n additionalColumns: PropTypes.arrayOf(PropTypes.element),\n /** Allow users to choose no selections in MULTI_SELECT mode, defaults to false */\n isNoSelectionAllowed: PropTypes.bool,\n /** Breadcrumb component options */\n breadcrumbProps: BreadcrumbPropType,\n /** Adds class name. */\n className: PropTypes.string,\n /** Whether the user can see the breadcrumbs represented with the folder tree button */\n hasFolderTreeBreadcrumbs: PropTypes.bool,\n /** Any extra items in the header to the right of the search input (and new folder button) */\n headerActionsAccessory: PropTypes.node,\n /** Title shown in the ContentExplorerModal. */\n modalTitle: PropTypes.string,\n /** Description text shown in the ContentExplorerModal. */\n modalDescription: PropTypes.string,\n /** Called when the ContentExplorerModal is closed. */\n onRequestClose: PropTypes.func.isRequired,\n /**\n * Called when the folder creation is submitted.\n *\n * @param {string} folderName\n */\n onCreateFolderSubmit: PropTypes.func,\n /**\n * Called with the latest folder name input.\n *\n * @param {string} folderName\n */\n onCreateFolderInput: PropTypes.func,\n /** Called when the NewFolderModal is shown. */\n onNewFolderModalShown: PropTypes.func,\n /** Called when the NewFolderModal is closed. */\n onNewFolderModalClosed: PropTypes.func,\n /** Called when selected button is clicked */\n onSelectedClick: PropTypes.func,\n /**\n * Called when an item is selected\n *\n * @param {Object} selectedItem\n * @param {number} selectedItemIndex\n */\n onSelectItem: PropTypes.func,\n /** Called when the number of items selected text is clicked */\n onViewSelectedClick: PropTypes.func,\n /** Folder is in the process of being created. */\n isCreatingFolder: PropTypes.bool,\n /** Whether the user can see select all checkbox */\n isSelectAllAllowed: PropTypes.bool,\n /** Message that will be shown when there was an error creating the folder. */\n createFolderError: PropTypes.string,\n /** Configures the content explorer based on the user's intended action (ex. select file or move/copy) */\n contentExplorerMode: ContentExplorerModePropType.isRequired,\n /** Props for the include subfolders toggle */\n includeSubfoldersProps: PropTypes.object,\n /** Initial path of folders. The last folder in the array is the current folder. */\n initialFoldersPath: FoldersPathPropType.isRequired,\n /** Initial items that will show up as selected */\n initialSelectedItems: PropTypes.object,\n /** Items that will show up as selected */\n controlledSelectedItems: PropTypes.object,\n /**\n * Called when the current folder changes\n *\n * @param {Object} enteredFolder\n * @param {Array} newFoldersPath\n */\n onEnterFolder: PropTypes.func.isRequired,\n /** Called when the folders path is updated\n *\n * @param {Array} newFoldersPath\n */\n onFoldersPathUpdate: PropTypes.func,\n /** Called whenever the selected items list changes\n *\n * @param {Object} selectedItems\n */\n onSelectedItemsUpdate: PropTypes.func,\n /**\n * Called when items are chosen.\n *\n * @param {Object[]} chosenItems In non-multi select mode, the chosenItems will be a 1 element array contain the one chosen item\n */\n onChooseItems: PropTypes.func,\n /**\n * Called when a destination folder has been selected for moving an item to\n *\n * @param {Object} destFolder destination folder\n */\n onMoveItem: PropTypes.func,\n /**\n * Called when a destination folder has been selected for copying an item to\n *\n * @param {Object} destFolder destination folder\n */\n onCopyItem: PropTypes.func,\n /** Whether the user has permission to create a new folder */\n isCreateNewFolderAllowed: PropTypes.bool,\n /**\n * Called when a search query is submitted.\n *\n * @param {string} searchQuery\n */\n onSearchSubmit: PropTypes.func.isRequired,\n /**\n * Called when search mode is exited. An updated items list should now be passed in to display the user's file tree.\n *\n * @param {Object} folderBeforeSearch the previous folder object before entering search mode\n */\n onExitSearch: PropTypes.func.isRequired,\n /** List of items to display */\n items: ItemsPropType.isRequired,\n /** Number of items to load per page as the user scrolls */\n numItemsPerPage: PropTypes.number,\n /** Total number of items across all pages */\n numTotalItems: PropTypes.number,\n /** Called to load more items */\n onLoadMoreItems: PropTypes.func,\n /** Used to render item icons in the list. Overrides the default icons. */\n itemIconRenderer: PropTypes.func,\n /** Used to render item name links in the list. Overrides the default links. */\n itemNameLinkRenderer: PropTypes.func,\n /** Used to render item buttons in the list. Overrides the default buttons. */\n itemButtonRenderer: PropTypes.func,\n /** Height of an item row */\n itemRowHeight: PropTypes.number,\n /** Used to render the row element for items on the list */\n itemRowRenderer: PropTypes.func,\n /** Height of the item list header, defaults to 0, which makes header not visible */\n listHeaderHeight: PropTypes.number,\n /** Used to render the header row on the item list */\n listHeaderRenderer: PropTypes.func,\n /** Whether the new folder button should be shown */\n showCreateNewFolderButton: PropTypes.bool,\n /** Props for the search input */\n searchInputProps: PropTypes.object,\n /** Custom text for the choose button */\n chooseButtonText: PropTypes.node,\n };\n\n static defaultProps = {\n onCreateFolderSubmit: () => {},\n };\n\n constructor(props) {\n super(props);\n this.state = {\n foldersPath: props.initialFoldersPath,\n isNewFolderModalOpen: false,\n };\n }\n\n componentDidUpdate({ initialFoldersPath: prevInitialFoldersPath }) {\n const { initialFoldersPath } = this.props;\n\n if (prevInitialFoldersPath !== initialFoldersPath) {\n // Close the new folder modal when the folders path has changed\n this.setState({\n foldersPath: initialFoldersPath,\n isNewFolderModalOpen: false,\n });\n }\n }\n\n handleEnterFolder = (enteredFolder, newFoldersPath) => {\n const { onEnterFolder } = this.props;\n\n this.setState({ foldersPath: newFoldersPath });\n onEnterFolder(enteredFolder, newFoldersPath);\n };\n\n handleCreateNewFolderButtonClick = () => {\n const { onNewFolderModalShown } = this.props;\n\n this.setState({ isNewFolderModalOpen: true }, () => onNewFolderModalShown && onNewFolderModalShown());\n };\n\n handleNewFolderModalClose = () => {\n const { onNewFolderModalClosed } = this.props;\n\n this.setState({ isNewFolderModalOpen: false }, () => onNewFolderModalClosed && onNewFolderModalClosed());\n };\n\n render() {\n const {\n className,\n modalTitle,\n modalDescription,\n onCreateFolderSubmit,\n onCreateFolderInput,\n isCreatingFolder,\n createFolderError,\n initialFoldersPath,\n ...rest\n } = this.props;\n const { foldersPath, isNewFolderModalOpen } = this.state;\n const currentFolder = foldersPath[foldersPath.length - 1];\n\n return (\n <div className={classNames('content-explorer-modal-container', className)}>\n <ContentExplorerModal\n className={isNewFolderModalOpen ? 'hidden' : ''}\n title={modalTitle}\n description={modalDescription}\n initialFoldersPath={initialFoldersPath}\n isOpen\n onEnterFolder={this.handleEnterFolder}\n onCreateNewFolderButtonClick={this.handleCreateNewFolderButtonClick}\n {...rest}\n />\n {isNewFolderModalOpen && (\n <NewFolderModal\n isOpen\n parentFolderName={currentFolder.name}\n onRequestClose={this.handleNewFolderModalClose}\n onCreateFolderSubmit={onCreateFolderSubmit}\n onCreateFolderInput={onCreateFolderInput}\n isCreatingFolder={isCreatingFolder}\n createFolderError={createFolderError}\n />\n )}\n </div>\n );\n }\n}\n\nexport default ContentExplorerModalContainer;\n"],"file":"ContentExplorerModalContainer.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js"],"names":["PropTypes","React","Component","classNames","BreadcrumbPropType","ContentExplorerModePropType","FoldersPathPropType","ItemsPropType","ContentExplorerModal","NewFolderModal","ContentExplorerModalContainer","constructor","props","enteredFolder","newFoldersPath","onEnterFolder","setState","foldersPath","onNewFolderModalShown","isNewFolderModalOpen","onNewFolderModalClosed","state","initialFoldersPath","componentDidUpdate","prevInitialFoldersPath","render","className","modalTitle","modalDescription","onCreateFolderSubmit","onCreateFolderInput","isCreatingFolder","createFolderError","shouldNotUsePortal","rest","currentFolder","length","handleEnterFolder","handleCreateNewFolderButtonClick","name","handleNewFolderModalClose","additionalColumns","arrayOf","element","isNoSelectionAllowed","bool","breadcrumbProps","string","hasFolderTreeBreadcrumbs","headerActionsAccessory","node","onRequestClose","func","isRequired","onSelectedClick","onSelectItem","onViewSelectedClick","isSelectAllAllowed","contentExplorerMode","includeSubfoldersProps","object","initialSelectedItems","controlledSelectedItems","onFoldersPathUpdate","onSelectedItemsUpdate","onChooseItems","onMoveItem","onCopyItem","isCreateNewFolderAllowed","onSearchSubmit","onExitSearch","items","numItemsPerPage","number","numTotalItems","onLoadMoreItems","itemIconRenderer","itemNameLinkRenderer","itemButtonRenderer","itemRowHeight","itemRowRenderer","listHeaderHeight","listHeaderRenderer","showCreateNewFolderButton","searchInputProps","chooseButtonText"],"mappings":";;;;;;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAASC,kBAAT,EAA6BC,2BAA7B,EAA0DC,mBAA1D,EAA+EC,aAA/E,QAAoG,eAApG;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;;AAEA,MAAMC,6BAAN,SAA4CR,SAA5C,CAAsD;AAuJlDS,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACf,UAAMA,KAAN;;AADe,+CAoBC,CAACC,aAAD,EAAgBC,cAAhB,KAAmC;AACnD,YAAM;AAAEC,QAAAA;AAAF,UAAoB,KAAKH,KAA/B;AAEA,WAAKI,QAAL,CAAc;AAAEC,QAAAA,WAAW,EAAEH;AAAf,OAAd;AACAC,MAAAA,aAAa,CAACF,aAAD,EAAgBC,cAAhB,CAAb;AAC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;AACAuC,EAAAA,gBAAgB,EAAEpF,SAAS,CAAC4D,MA7Ib;;AA8If;AACAyB,EAAAA,gBAAgB,EAAErF,SAAS,CAACkD;AA/Ib,C;;gBADjBxC,6B,kBAmJoB;AAClBmB,EAAAA,oBAAoB,EAAE,MAAM,CAAE;AADZ,C;;AAyF1B,eAAenB,6BAAf","sourcesContent":["import PropTypes from 'prop-types';\nimport React, { Component } from 'react';\nimport classNames from 'classnames';\n\nimport { BreadcrumbPropType, ContentExplorerModePropType, FoldersPathPropType, ItemsPropType } from '../prop-types';\nimport ContentExplorerModal from '../content-explorer-modal';\nimport NewFolderModal from '../new-folder-modal';\n\nclass ContentExplorerModalContainer extends Component {\n static propTypes = {\n /**\n * Extra columns displayed in the folders table after folder name column\n * Each column has to be a Column element\n */\n additionalColumns: PropTypes.arrayOf(PropTypes.element),\n /** Allow users to choose no selections in MULTI_SELECT mode, defaults to false */\n isNoSelectionAllowed: PropTypes.bool,\n /** Breadcrumb component options */\n breadcrumbProps: BreadcrumbPropType,\n /** Adds class name. */\n className: PropTypes.string,\n /** Whether the user can see the breadcrumbs represented with the folder tree button */\n hasFolderTreeBreadcrumbs: PropTypes.bool,\n /** Any extra items in the header to the right of the search input (and new folder button) */\n headerActionsAccessory: PropTypes.node,\n /** Title shown in the ContentExplorerModal. */\n modalTitle: PropTypes.string,\n /** Description text shown in the ContentExplorerModal. */\n modalDescription: PropTypes.string,\n /** Called when the ContentExplorerModal is closed. */\n onRequestClose: PropTypes.func.isRequired,\n /**\n * Called when the folder creation is submitted.\n *\n * @param {string} folderName\n */\n onCreateFolderSubmit: PropTypes.func,\n /**\n * Called with the latest folder name input.\n *\n * @param {string} folderName\n */\n onCreateFolderInput: PropTypes.func,\n /** Called when the NewFolderModal is shown. */\n onNewFolderModalShown: PropTypes.func,\n /** Called when the NewFolderModal is closed. */\n onNewFolderModalClosed: PropTypes.func,\n /** Called when selected button is clicked */\n onSelectedClick: PropTypes.func,\n /**\n * Called when an item is selected\n *\n * @param {Object} selectedItem\n * @param {number} selectedItemIndex\n */\n onSelectItem: PropTypes.func,\n /** Called when the number of items selected text is clicked */\n onViewSelectedClick: PropTypes.func,\n /** Folder is in the process of being created. */\n isCreatingFolder: PropTypes.bool,\n /** Whether the user can see select all checkbox */\n isSelectAllAllowed: PropTypes.bool,\n /** Message that will be shown when there was an error creating the folder. */\n createFolderError: PropTypes.string,\n /** Configures the content explorer based on the user's intended action (ex. select file or move/copy) */\n contentExplorerMode: ContentExplorerModePropType.isRequired,\n /** Props for the include subfolders toggle */\n includeSubfoldersProps: PropTypes.object,\n /** Initial path of folders. The last folder in the array is the current folder. */\n initialFoldersPath: FoldersPathPropType.isRequired,\n /** Initial items that will show up as selected */\n initialSelectedItems: PropTypes.object,\n /** Items that will show up as selected */\n controlledSelectedItems: PropTypes.object,\n /**\n * Called when the current folder changes\n *\n * @param {Object} enteredFolder\n * @param {Array} newFoldersPath\n */\n onEnterFolder: PropTypes.func.isRequired,\n /** Called when the folders path is updated\n *\n * @param {Array} newFoldersPath\n */\n onFoldersPathUpdate: PropTypes.func,\n /** Called whenever the selected items list changes\n *\n * @param {Object} selectedItems\n */\n onSelectedItemsUpdate: PropTypes.func,\n /**\n * Called when items are chosen.\n *\n * @param {Object[]} chosenItems In non-multi select mode, the chosenItems will be a 1 element array contain the one chosen item\n */\n onChooseItems: PropTypes.func,\n /**\n * Called when a destination folder has been selected for moving an item to\n *\n * @param {Object} destFolder destination folder\n */\n onMoveItem: PropTypes.func,\n /**\n * Called when a destination folder has been selected for copying an item to\n *\n * @param {Object} destFolder destination folder\n */\n onCopyItem: PropTypes.func,\n /** Whether the user has permission to create a new folder */\n isCreateNewFolderAllowed: PropTypes.bool,\n /**\n * Called when a search query is submitted.\n *\n * @param {string} searchQuery\n */\n onSearchSubmit: PropTypes.func.isRequired,\n /**\n * Called when search mode is exited. An updated items list should now be passed in to display the user's file tree.\n *\n * @param {Object} folderBeforeSearch the previous folder object before entering search mode\n */\n onExitSearch: PropTypes.func.isRequired,\n /** List of items to display */\n items: ItemsPropType.isRequired,\n /** Number of items to load per page as the user scrolls */\n numItemsPerPage: PropTypes.number,\n /** Total number of items across all pages */\n numTotalItems: PropTypes.number,\n /** Called to load more items */\n onLoadMoreItems: PropTypes.func,\n /** Used to render item icons in the list. Overrides the default icons. */\n itemIconRenderer: PropTypes.func,\n /** Used to render item name links in the list. Overrides the default links. */\n itemNameLinkRenderer: PropTypes.func,\n /** Used to render item buttons in the list. Overrides the default buttons. */\n itemButtonRenderer: PropTypes.func,\n /** Height of an item row */\n itemRowHeight: PropTypes.number,\n /** Used to render the row element for items on the list */\n itemRowRenderer: PropTypes.func,\n /** Height of the item list header, defaults to 0, which makes header not visible */\n listHeaderHeight: PropTypes.number,\n /** Used to render the header row on the item list */\n listHeaderRenderer: PropTypes.func,\n /** Whether the new folder button should be shown */\n showCreateNewFolderButton: PropTypes.bool,\n /** Whether the modals should be nested in a Portal or in a div */\n shouldNotUsePortal: PropTypes.bool,\n /** Props for the search input */\n searchInputProps: PropTypes.object,\n /** Custom text for the choose button */\n chooseButtonText: PropTypes.node,\n };\n\n static defaultProps = {\n onCreateFolderSubmit: () => {},\n };\n\n constructor(props) {\n super(props);\n this.state = {\n foldersPath: props.initialFoldersPath,\n isNewFolderModalOpen: false,\n };\n }\n\n componentDidUpdate({ initialFoldersPath: prevInitialFoldersPath }) {\n const { initialFoldersPath } = this.props;\n\n if (prevInitialFoldersPath !== initialFoldersPath) {\n // Close the new folder modal when the folders path has changed\n this.setState({\n foldersPath: initialFoldersPath,\n isNewFolderModalOpen: false,\n });\n }\n }\n\n handleEnterFolder = (enteredFolder, newFoldersPath) => {\n const { onEnterFolder } = this.props;\n\n this.setState({ foldersPath: newFoldersPath });\n onEnterFolder(enteredFolder, newFoldersPath);\n };\n\n handleCreateNewFolderButtonClick = () => {\n const { onNewFolderModalShown } = this.props;\n\n this.setState({ isNewFolderModalOpen: true }, () => onNewFolderModalShown && onNewFolderModalShown());\n };\n\n handleNewFolderModalClose = () => {\n const { onNewFolderModalClosed } = this.props;\n\n this.setState({ isNewFolderModalOpen: false }, () => onNewFolderModalClosed && onNewFolderModalClosed());\n };\n\n render() {\n const {\n className,\n modalTitle,\n modalDescription,\n onCreateFolderSubmit,\n onCreateFolderInput,\n isCreatingFolder,\n createFolderError,\n initialFoldersPath,\n shouldNotUsePortal,\n ...rest\n } = this.props;\n const { foldersPath, isNewFolderModalOpen } = this.state;\n const currentFolder = foldersPath[foldersPath.length - 1];\n\n return (\n <div className={classNames('content-explorer-modal-container', className)}>\n <ContentExplorerModal\n className={isNewFolderModalOpen ? 'hidden' : ''}\n title={modalTitle}\n description={modalDescription}\n initialFoldersPath={initialFoldersPath}\n isOpen\n onEnterFolder={this.handleEnterFolder}\n onCreateNewFolderButtonClick={this.handleCreateNewFolderButtonClick}\n shouldNotUsePortal={shouldNotUsePortal}\n {...rest}\n />\n {isNewFolderModalOpen && (\n <NewFolderModal\n isOpen\n parentFolderName={currentFolder.name}\n onRequestClose={this.handleNewFolderModalClose}\n onCreateFolderSubmit={onCreateFolderSubmit}\n onCreateFolderInput={onCreateFolderInput}\n isCreatingFolder={isCreatingFolder}\n createFolderError={createFolderError}\n shouldNotUsePortal={shouldNotUsePortal}\n />\n )}\n </div>\n );\n }\n}\n\nexport default ContentExplorerModalContainer;\n"],"file":"ContentExplorerModalContainer.js"}
|
|
@@ -54,7 +54,8 @@ class NewFolderModal extends Component {
|
|
|
54
54
|
onRequestClose,
|
|
55
55
|
parentFolderName,
|
|
56
56
|
isCreatingFolder,
|
|
57
|
-
createFolderError
|
|
57
|
+
createFolderError,
|
|
58
|
+
shouldNotUsePortal
|
|
58
59
|
} = this.props;
|
|
59
60
|
const {
|
|
60
61
|
folderNameInput
|
|
@@ -65,6 +66,7 @@ class NewFolderModal extends Component {
|
|
|
65
66
|
focusElementSelector: ".folder-name-input input",
|
|
66
67
|
isOpen: isOpen,
|
|
67
68
|
onRequestClose: onRequestClose,
|
|
69
|
+
shouldNotUsePortal: shouldNotUsePortal,
|
|
68
70
|
title: React.createElement(FormattedMessage, _extends({}, messages.newFolderModalTitle, {
|
|
69
71
|
values: {
|
|
70
72
|
parentFolderName
|
|
@@ -126,7 +128,10 @@ _defineProperty(NewFolderModal, "propTypes", {
|
|
|
126
128
|
isCreatingFolder: PropTypes.bool,
|
|
127
129
|
|
|
128
130
|
/** Message that will be shown when there was an error creating the folder. */
|
|
129
|
-
createFolderError: PropTypes.string
|
|
131
|
+
createFolderError: PropTypes.string,
|
|
132
|
+
|
|
133
|
+
/** Whether the modal should be nested in a Portal or in a div */
|
|
134
|
+
shouldNotUsePortal: PropTypes.bool
|
|
130
135
|
});
|
|
131
136
|
|
|
132
137
|
_defineProperty(NewFolderModal, "defaultProps", {
|
|
@@ -134,7 +139,8 @@ _defineProperty(NewFolderModal, "defaultProps", {
|
|
|
134
139
|
isOpen: false,
|
|
135
140
|
parentFolderName: '',
|
|
136
141
|
isCreatingFolder: false,
|
|
137
|
-
createFolderError: null
|
|
142
|
+
createFolderError: null,
|
|
143
|
+
shouldNotUsePortal: false
|
|
138
144
|
});
|
|
139
145
|
|
|
140
146
|
export { NewFolderModal as NewFolderModalBase };
|
|
@@ -39,6 +39,8 @@ class NewFolderModal extends Component {
|
|
|
39
39
|
isCreatingFolder: PropTypes.bool,
|
|
40
40
|
/** Message that will be shown when there was an error creating the folder. */
|
|
41
41
|
createFolderError: PropTypes.string,
|
|
42
|
+
/** Whether the modal should be nested in a Portal or in a div */
|
|
43
|
+
shouldNotUsePortal: PropTypes.bool,
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
static defaultProps = {
|
|
@@ -47,6 +49,7 @@ class NewFolderModal extends Component {
|
|
|
47
49
|
parentFolderName: '',
|
|
48
50
|
isCreatingFolder: false,
|
|
49
51
|
createFolderError: null,
|
|
52
|
+
shouldNotUsePortal: false,
|
|
50
53
|
};
|
|
51
54
|
|
|
52
55
|
constructor(props) {
|
|
@@ -82,6 +85,7 @@ class NewFolderModal extends Component {
|
|
|
82
85
|
parentFolderName,
|
|
83
86
|
isCreatingFolder,
|
|
84
87
|
createFolderError,
|
|
88
|
+
shouldNotUsePortal,
|
|
85
89
|
} = this.props;
|
|
86
90
|
const { folderNameInput } = this.state;
|
|
87
91
|
|
|
@@ -93,6 +97,7 @@ class NewFolderModal extends Component {
|
|
|
93
97
|
focusElementSelector=".folder-name-input input"
|
|
94
98
|
isOpen={isOpen}
|
|
95
99
|
onRequestClose={onRequestClose}
|
|
100
|
+
shouldNotUsePortal={shouldNotUsePortal}
|
|
96
101
|
title={
|
|
97
102
|
<FormattedMessage
|
|
98
103
|
{...messages.newFolderModalTitle}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/content-explorer/new-folder-modal/NewFolderModal.js"],"names":["PropTypes","React","Component","classNames","FormattedMessage","injectIntl","Modal","ModalActions","TextInput","Button","PrimaryButton","messages","NewFolderModal","constructor","props","onCreateFolderSubmit","folderNameInput","state","event","onCreateFolderInput","input","target","value","setState","render","className","intl","isOpen","onRequestClose","parentFolderName","isCreatingFolder","createFolderError","isCreateButtonDisabled","trim","length","newFolderModalTitle","newFolderModalFolderNameLabel","handleFolderNameInput","formatMessage","newFolderModalFolderNamePlaceholder","newFolderModalCancel","handleCreateClick","newFolderModalCreate","string","any","bool","func","isRequired","NewFolderModalBase"],"mappings":";;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,YAA7C;AAEA,SAASC,KAAT,EAAgBC,YAAhB,QAAoC,2BAApC;AACA,OAAOC,SAAP,MAAsB,gCAAtB;AACA,OAAOC,MAAP,MAAmB,4BAAnB;AACA,OAAOC,aAAP,MAA0B,oCAA1B;AAEA,OAAOC,QAAP,MAAqB,aAArB;AAEA,OAAO,uBAAP;;AAEA,MAAMC,cAAN,SAA6BV,SAA7B,CAAuC;
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/content-explorer/new-folder-modal/NewFolderModal.js"],"names":["PropTypes","React","Component","classNames","FormattedMessage","injectIntl","Modal","ModalActions","TextInput","Button","PrimaryButton","messages","NewFolderModal","constructor","props","onCreateFolderSubmit","folderNameInput","state","event","onCreateFolderInput","input","target","value","setState","render","className","intl","isOpen","onRequestClose","parentFolderName","isCreatingFolder","createFolderError","shouldNotUsePortal","isCreateButtonDisabled","trim","length","newFolderModalTitle","newFolderModalFolderNameLabel","handleFolderNameInput","formatMessage","newFolderModalFolderNamePlaceholder","newFolderModalCancel","handleCreateClick","newFolderModalCreate","string","any","bool","func","isRequired","NewFolderModalBase"],"mappings":";;;;AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,YAA7C;AAEA,SAASC,KAAT,EAAgBC,YAAhB,QAAoC,2BAApC;AACA,OAAOC,SAAP,MAAsB,gCAAtB;AACA,OAAOC,MAAP,MAAmB,4BAAnB;AACA,OAAOC,aAAP,MAA0B,oCAA1B;AAEA,OAAOC,QAAP,MAAqB,aAArB;AAEA,OAAO,uBAAP;;AAEA,MAAMC,cAAN,SAA6BV,SAA7B,CAAuC;AAwCnCW,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACf,UAAMA,KAAN;;AADe,+CAOC,MAAM;AACtB,YAAM;AAAEC,QAAAA;AAAF,UAA2B,KAAKD,KAAtC;AACA,YAAM;AAAEE,QAAAA;AAAF,UAAsB,KAAKC,KAAjC;AACAF,MAAAA,oBAAoB,CAACC,eAAD,CAApB;AACH,KAXkB;;AAAA,mDAaKE,KAAK,IAAI;AAC7B,YAAM;AAAEC,QAAAA;AAAF,UAA0B,KAAKL,KAArC;AACA,YAAMM,KAAK,GAAGF,KAAK,CAACG,MAAN,CAAaC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bf,C;;gBADjBlC,c,kBA+BoB;AAClBa,EAAAA,SAAS,EAAE,EADO;AAElBE,EAAAA,MAAM,EAAE,KAFU;AAGlBE,EAAAA,gBAAgB,EAAE,EAHA;AAIlBC,EAAAA,gBAAgB,EAAE,KAJA;AAKlBC,EAAAA,iBAAiB,EAAE,IALD;AAMlBC,EAAAA,kBAAkB,EAAE;AANF,C;;AA6F1B,SAASpB,cAAc,IAAIqC,kBAA3B;AACA,eAAe5C,UAAU,CAACO,cAAD,CAAzB","sourcesContent":["import PropTypes from 'prop-types';\nimport React, { Component } from 'react';\nimport classNames from 'classnames';\nimport { FormattedMessage, injectIntl } from 'react-intl';\n\nimport { Modal, ModalActions } from '../../../components/modal';\nimport TextInput from '../../../components/text-input';\nimport Button from '../../../components/button';\nimport PrimaryButton from '../../../components/primary-button';\n\nimport messages from '../messages';\n\nimport './NewFolderModal.scss';\n\nclass NewFolderModal extends Component {\n static propTypes = {\n /** Adds class name to modal. */\n className: PropTypes.string,\n intl: PropTypes.any,\n /** Opens the modal. */\n isOpen: PropTypes.bool,\n /** Called when the modal is requested to be closed. */\n onRequestClose: PropTypes.func.isRequired,\n /**\n * Called when the folder creation is submitted.\n *\n * @param {string} folderName\n */\n onCreateFolderSubmit: PropTypes.func.isRequired,\n /**\n * Called with the latest folder name input.\n *\n * @param {string} folderName\n */\n onCreateFolderInput: PropTypes.func,\n /** The name of the parent folder that the new folder will be created in. */\n parentFolderName: PropTypes.string,\n /** Folder is in the process of being created. */\n isCreatingFolder: PropTypes.bool,\n /** Message that will be shown when there was an error creating the folder. */\n createFolderError: PropTypes.string,\n /** Whether the modal should be nested in a Portal or in a div */\n shouldNotUsePortal: PropTypes.bool,\n };\n\n static defaultProps = {\n className: '',\n isOpen: false,\n parentFolderName: '',\n isCreatingFolder: false,\n createFolderError: null,\n shouldNotUsePortal: false,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n folderNameInput: '',\n };\n }\n\n handleCreateClick = () => {\n const { onCreateFolderSubmit } = this.props;\n const { folderNameInput } = this.state;\n onCreateFolderSubmit(folderNameInput);\n };\n\n handleFolderNameInput = event => {\n const { onCreateFolderInput } = this.props;\n const input = event.target.value;\n this.setState({\n folderNameInput: input,\n });\n if (onCreateFolderInput) {\n onCreateFolderInput(input);\n }\n };\n\n render() {\n const {\n className,\n intl,\n isOpen,\n onRequestClose,\n parentFolderName,\n isCreatingFolder,\n createFolderError,\n shouldNotUsePortal,\n } = this.props;\n const { folderNameInput } = this.state;\n\n const isCreateButtonDisabled = !folderNameInput.trim().length || !!createFolderError || !!isCreatingFolder;\n\n return (\n <Modal\n className={classNames('new-folder-modal', className)}\n focusElementSelector=\".folder-name-input input\"\n isOpen={isOpen}\n onRequestClose={onRequestClose}\n shouldNotUsePortal={shouldNotUsePortal}\n title={\n <FormattedMessage\n {...messages.newFolderModalTitle}\n values={{\n parentFolderName,\n }}\n />\n }\n >\n <TextInput\n className=\"folder-name-input\"\n error={createFolderError}\n isRequired\n label={<FormattedMessage {...messages.newFolderModalFolderNameLabel} />}\n onInput={this.handleFolderNameInput}\n placeholder={intl.formatMessage(messages.newFolderModalFolderNamePlaceholder)}\n type=\"text\"\n value={folderNameInput}\n />\n <ModalActions>\n <Button className=\"new-folder-modal-cancel-button\" onClick={onRequestClose} type=\"button\">\n <FormattedMessage {...messages.newFolderModalCancel} />\n </Button>\n <PrimaryButton\n className=\"new-folder-modal-create-button\"\n isDisabled={isCreateButtonDisabled}\n isLoading={isCreatingFolder}\n onClick={this.handleCreateClick}\n type=\"button\"\n >\n <FormattedMessage {...messages.newFolderModalCreate} />\n </PrimaryButton>\n </ModalActions>\n </Modal>\n );\n }\n}\n\nexport { NewFolderModal as NewFolderModalBase };\nexport default injectIntl(NewFolderModal);\n"],"file":"NewFolderModal.js"}
|
package/es/features/message-center/components/message-center-modal/MessageCenterModal.js.flow
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { FormattedMessage, injectIntl
|
|
3
|
+
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
4
|
+
import type { IntlShape } from 'react-intl';
|
|
4
5
|
import classNames from 'classnames';
|
|
5
6
|
import { AutoSizer, CellMeasurer, CellMeasurerCache, List } from '@box/react-virtualized';
|
|
6
7
|
import debounce from 'lodash/debounce';
|
|
@@ -26,6 +27,7 @@ type Props = {|
|
|
|
26
27
|
apiHost: string,
|
|
27
28
|
contentPreviewProps?: ContentPreviewProps,
|
|
28
29
|
getToken: (fileId: string) => Promise<Token>,
|
|
30
|
+
intl: IntlShape,
|
|
29
31
|
messages: Array<EligibleMessageCenterMessage> | null | Error,
|
|
30
32
|
onMessageShown: EligibleMessageCenterMessage => void,
|
|
31
33
|
onRequestClose: () => void,
|
|
@@ -51,7 +53,7 @@ function MessageCenterModal({
|
|
|
51
53
|
intl,
|
|
52
54
|
overscanRowCount = 1,
|
|
53
55
|
onMessageShown,
|
|
54
|
-
}: Props
|
|
56
|
+
}: Props) {
|
|
55
57
|
const categories: Array<{ displayText: string, value: string }> | null = React.useMemo(() => {
|
|
56
58
|
if (!Array.isArray(messages)) {
|
|
57
59
|
return null;
|
package/es/features/message-center/components/message-center-modal/MessageCenterModal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/message-center/components/message-center-modal/MessageCenterModal.js"],"names":["React","FormattedMessage","injectIntl","classNames","AutoSizer","CellMeasurer","CellMeasurerCache","List","debounce","AnimateHeight","Scrollbar","Modal","CategorySelector","CollapsibleScrollbar","Message","intlMessages","MessagePreviewGhost","ContentGhost","BottomContentWrapper","ErrorState","EmptyState","ALL","cache","defaultHeight","fixedWidth","SCROLLBAR_MARGIN","listStyle","overflowX","overflowY","trackYStyles","marginLeft","MessageCenterModal","apiHost","contentPreviewProps","onRequestClose","messages","getToken","intl","overscanRowCount","onMessageShown","categories","useMemo","Array","isArray","messageCategoriesSet","Set","forEach","templateParams","category","add","size","value","displayText","formatMessage","all","product","events","boxEducation","listRef","useRef","isMouseInTitleRef","messageLoadCacheRef","Map","setCategory","useState","isExpanded","setIsExpanded","dimensions","setDimensions","width","height","scrollRef","title","current","clearAll","filteredMessages","filter","sort","activateDate","activateDateA","priority","priorityA","activateDateB","priorityB","useEffect","scrollbarRef","scrollToTop","rowRenderer","index","parent","style","isVisible","message","messageId","id","isFirstTimeBeingShown","has","set","registerChild","handleOnScroll","clientHeight","scrollTop","prevClientHeight","prevScrollTop","isScrollingDown","handleResize","resizeDimensions","handlOnResize","useCallback","renderMessages","length","rowHeight","scrollLeft","Grid","handleScrollEvent","Error","errorFetchingPosts"],"mappings":";;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA2E,YAA3E;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,iBAAlC,EAAqDC,IAArD,QAAiE,wBAAjE;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,aAAP,MAA0B,sBAA1B;AACA,OAAOC,SAAP,MAAsB,yBAAtB;AAEA,OAAOC,KAAP,MAAkB,oCAAlB;AACA,OAAOC,gBAAP,MAA6B,2DAA7B;AAEA,OAAOC,oBAAP,MAAiC,gDAAjC;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AAGA,OAAO,2BAAP;AACA,OAAOC,mBAAP,MAAgC,oDAAhC;AACA,OAAOC,YAAP,MAAyB,kCAAzB;AACA,OAAOC,oBAAP,MAAiC,0CAAjC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAYA,MAAMC,GAAG,GAAG,KAAZ;AACA,MAAMC,KAAK,GAAG,IAAIhB,iBAAJ,CAAsB;AAChCiB,EAAAA,aAAa,EAAE,GADiB;AAEhCC,EAAAA,UAAU,EAAE;AAFoB,CAAtB,CAAd;AAKA,M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AA;AAAF,cAAWvD,OAAO,CAACe,OAAzB;AACAwC,UAAAA,IAAI,CAACC,iBAAL,CAAuB;AAAEb,YAAAA,SAAF;AAAaW,YAAAA;AAAb,WAAvB;AACH;AACJ,OAXL;AAYI,MAAA,eAAe,MAZnB;AAaI,MAAA,KAAK,EAAE;AAAE3C,QAAAA,KAAF;AAASC,QAAAA;AAAT,OAbX;AAcI,MAAA,YAAY,EAAEzC;AAdlB,OAgBKM,QAAQ,YAAYgF,KAApB,GACG,oBAAC,UAAD,QACI,oBAAC,gBAAD,EAAsBpG,YAAY,CAACqG,kBAAnC,CADJ,CADH,GAKGP,cAAc,CAACxC,KAAD,EAAQC,MAAR,CArBtB,CADH;AAAA,GADL,CADJ,CARJ,CADJ;AAyCH;;AAED,eAAepE,UAAU,CAAC6B,kBAAD,CAAzB","sourcesContent":["// @flow\nimport * as React from 'react';\nimport { FormattedMessage, injectIntl, type InjectIntlProvidedProps } from 'react-intl';\nimport classNames from 'classnames';\nimport { AutoSizer, CellMeasurer, CellMeasurerCache, List } from '@box/react-virtualized';\nimport debounce from 'lodash/debounce';\nimport AnimateHeight from 'react-animate-height';\nimport Scrollbar from 'react-scrollbars-custom';\nimport type { Token } from '../../../../common/types/core';\nimport Modal from '../../../../components/modal/Modal';\nimport CategorySelector from '../../../../components/category-selector/CategorySelector';\n\nimport CollapsibleScrollbar from '../collapsibile-scrollbar/CollapsibleScrollbar';\nimport Message from '../message/Message';\nimport intlMessages from '../../messages';\nimport type { EligibleMessageCenterMessage } from '../../types';\nimport type { ContentPreviewProps } from '../../../message-preview-content/MessagePreviewContent';\nimport './MessageCenterModal.scss';\nimport MessagePreviewGhost from '../../../message-preview-ghost/MessagePreviewGhost';\nimport ContentGhost from '../templates/common/ContentGhost';\nimport BottomContentWrapper from '../templates/common/BottomContentWrapper';\nimport ErrorState from '../error-state/ErrorState';\nimport EmptyState from './EmptyState';\n\ntype Props = {|\n apiHost: string,\n contentPreviewProps?: ContentPreviewProps,\n getToken: (fileId: string) => Promise<Token>,\n messages: Array<EligibleMessageCenterMessage> | null | Error,\n onMessageShown: EligibleMessageCenterMessage => void,\n onRequestClose: () => void,\n overscanRowCount?: number,\n|};\n\nconst ALL = 'all';\nconst cache = new CellMeasurerCache({\n defaultHeight: 400,\n fixedWidth: true,\n});\n\nconst SCROLLBAR_MARGIN = 16;\nconst listStyle = { overflowX: false, overflowY: false };\nconst trackYStyles = { marginLeft: `${SCROLLBAR_MARGIN}px` };\n\nfunction MessageCenterModal({\n apiHost,\n contentPreviewProps,\n onRequestClose,\n messages,\n getToken,\n intl,\n overscanRowCount = 1,\n onMessageShown,\n}: Props & InjectIntlProvidedProps) {\n const categories: Array<{ displayText: string, value: string }> | null = React.useMemo(() => {\n if (!Array.isArray(messages)) {\n return null;\n }\n\n const messageCategoriesSet = new Set<string>();\n messages.forEach(({ templateParams: { category } }) => {\n messageCategoriesSet.add(category);\n });\n\n if (messageCategoriesSet.size <= 1) {\n return null;\n }\n\n return [\n {\n value: ALL,\n displayText: intl.formatMessage(intlMessages.all),\n },\n {\n value: 'product',\n displayText: intl.formatMessage(intlMessages.product),\n },\n {\n value: 'events',\n displayText: intl.formatMessage(intlMessages.events),\n },\n {\n value: 'education',\n displayText: intl.formatMessage(intlMessages.boxEducation),\n },\n ];\n }, [intl, messages]);\n const listRef = React.useRef(null);\n const isMouseInTitleRef = React.useRef(false);\n const messageLoadCacheRef = React.useRef(new Map<number, boolean>());\n const [category, setCategory] = React.useState(ALL);\n const [isExpanded, setIsExpanded] = React.useState(true);\n const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });\n const scrollRef = React.useRef<{ scrollbarRef: React.ElementRef<typeof Scrollbar> } | null>(null);\n\n const title = (\n <section\n className={classNames('bdl-MessageCenterModal-title', {\n 'is-expanded': isExpanded,\n 'is-collapsed': !isExpanded,\n })}\n data-testid=\"modal-title\"\n onMouseEnter={() => {\n isMouseInTitleRef.current = true;\n setIsExpanded(true);\n }}\n onMouseLeave={() => {\n isMouseInTitleRef.current = false;\n }}\n >\n <div className=\"bdl-MessageCenterModal-whatsNew\">\n <FormattedMessage {...intlMessages.title} />\n </div>\n {categories && (\n <AnimateHeight duration={300} height={isExpanded ? 'auto' : 0}>\n <section className=\"bdl-MessageCenterModal-categorySelector\">\n <CategorySelector\n currentCategory={category}\n categories={categories}\n onSelect={value => {\n cache.clearAll();\n setCategory(value);\n }}\n />\n </section>\n </AnimateHeight>\n )}\n </section>\n );\n\n const filteredMessages = React.useMemo(() => {\n if (!Array.isArray(messages)) {\n return [];\n }\n\n return messages\n .filter(({ templateParams }) => {\n return category === ALL || templateParams.category === category;\n })\n .sort(\n (\n { activateDate: activateDateA, priority: priorityA },\n { activateDate: activateDateB, priority: priorityB },\n ) => {\n // sort by date (descending), secondary sort by priority (descending)\n if (activateDateA > activateDateB) {\n return -1;\n }\n\n if (activateDateA < activateDateB) {\n return 1;\n }\n\n if (priorityA > priorityB) {\n return -1;\n }\n\n if (priorityA < priorityB) {\n return 1;\n }\n\n return 0;\n },\n );\n }, [category, messages]);\n\n React.useEffect(() => {\n if (scrollRef.current && scrollRef.current.scrollbarRef && scrollRef.current.scrollbarRef.current) {\n scrollRef.current.scrollbarRef.current.scrollToTop();\n }\n }, [category]);\n\n function rowRenderer({ index, parent, style, isVisible }: Object) {\n const message = filteredMessages[index];\n const messageId = message.id;\n const isFirstTimeBeingShown = !messageLoadCacheRef.current.has(messageId);\n if (isVisible && isFirstTimeBeingShown) {\n messageLoadCacheRef.current.set(messageId, true);\n onMessageShown(message);\n }\n\n return (\n <CellMeasurer key={messageId} cache={cache} columnIndex={0} parent={parent} rowIndex={index}>\n {({ registerChild }) => (\n <div\n ref={registerChild}\n className=\"bdl-MessageCenterModal-message\"\n style={style}\n data-testid=\"messagecentermodalmessage\"\n >\n <Message\n contentPreviewProps={contentPreviewProps}\n apiHost={apiHost}\n {...message}\n getToken={getToken}\n />\n </div>\n )}\n </CellMeasurer>\n );\n }\n\n function handleOnScroll(clientHeight, scrollTop, prevClientHeight, prevScrollTop) {\n if (clientHeight > 0 && clientHeight === prevClientHeight && !isMouseInTitleRef.current) {\n const isScrollingDown = prevScrollTop < scrollTop;\n if (isExpanded && isScrollingDown) {\n setIsExpanded(false);\n } else if (!isExpanded && !isScrollingDown) {\n setIsExpanded(true);\n }\n }\n }\n\n function handleResize(resizeDimensions) {\n setDimensions(resizeDimensions);\n }\n\n const handlOnResize = React.useCallback(debounce(handleResize, 300), []);\n\n function renderMessages(width: number, height: number): React.Node {\n if (!messages) {\n return (\n <div className=\"bdl-MessageCenterModal-message\">\n <div className=\"bdl-MessageCenterModal-ghost\">\n <MessagePreviewGhost />\n <BottomContentWrapper>\n <ContentGhost />\n </BottomContentWrapper>\n </div>\n </div>\n );\n }\n\n return (\n <List\n ref={listRef}\n className=\"bdl-MessageCenterModal-list\"\n deferredMeasurementCache={cache}\n height={dimensions.height || height}\n noRowsRenderer={EmptyState}\n overscanRowCount={overscanRowCount}\n rowCount={filteredMessages.length}\n rowHeight={cache.rowHeight}\n rowRenderer={rowRenderer}\n scrollToIndex={0}\n style={listStyle}\n width={width - SCROLLBAR_MARGIN}\n />\n );\n }\n\n return (\n <Modal\n className=\"bdl-MessageCenterModal\"\n data-resin-component=\"messageCenterModal\"\n data-testid=\"messagecentermodal\"\n isOpen\n onRequestClose={onRequestClose}\n title={title}\n >\n <section className=\"bdl-MessageCenterModal-messages\">\n <AutoSizer onResize={handlOnResize}>\n {({ height, width }) => (\n <CollapsibleScrollbar\n ref={scrollRef}\n onScroll={(\n { clientHeight, scrollTop, scrollLeft },\n { clientHeight: prevClientHeight, scrollTop: prevScrollTop },\n ) => {\n handleOnScroll(clientHeight, scrollTop, prevClientHeight, prevScrollTop);\n if (listRef.current && listRef.current.Grid) {\n const { Grid } = listRef.current;\n Grid.handleScrollEvent({ scrollTop, scrollLeft });\n }\n }}\n permanentTrackY\n style={{ width, height }}\n trackYStyles={trackYStyles}\n >\n {messages instanceof Error ? (\n <ErrorState>\n <FormattedMessage {...intlMessages.errorFetchingPosts} />\n </ErrorState>\n ) : (\n renderMessages(width, height)\n )}\n </CollapsibleScrollbar>\n )}\n </AutoSizer>\n </section>\n </Modal>\n );\n}\n\nexport default injectIntl(MessageCenterModal);\n"],"file":"MessageCenterModal.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/message-center/components/message-center-modal/MessageCenterModal.js"],"names":["React","FormattedMessage","injectIntl","classNames","AutoSizer","CellMeasurer","CellMeasurerCache","List","debounce","AnimateHeight","Scrollbar","Modal","CategorySelector","CollapsibleScrollbar","Message","intlMessages","MessagePreviewGhost","ContentGhost","BottomContentWrapper","ErrorState","EmptyState","ALL","cache","defaultHeight","fixedWidth","SCROLLBAR_MARGIN","listStyle","overflowX","overflowY","trackYStyles","marginLeft","MessageCenterModal","apiHost","contentPreviewProps","onRequestClose","messages","getToken","intl","overscanRowCount","onMessageShown","categories","useMemo","Array","isArray","messageCategoriesSet","Set","forEach","templateParams","category","add","size","value","displayText","formatMessage","all","product","events","boxEducation","listRef","useRef","isMouseInTitleRef","messageLoadCacheRef","Map","setCategory","useState","isExpanded","setIsExpanded","dimensions","setDimensions","width","height","scrollRef","title","current","clearAll","filteredMessages","filter","sort","activateDate","activateDateA","priority","priorityA","activateDateB","priorityB","useEffect","scrollbarRef","scrollToTop","rowRenderer","index","parent","style","isVisible","message","messageId","id","isFirstTimeBeingShown","has","set","registerChild","handleOnScroll","clientHeight","scrollTop","prevClientHeight","prevScrollTop","isScrollingDown","handleResize","resizeDimensions","handlOnResize","useCallback","renderMessages","length","rowHeight","scrollLeft","Grid","handleScrollEvent","Error","errorFetchingPosts"],"mappings":";;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,YAA7C;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,iBAAlC,EAAqDC,IAArD,QAAiE,wBAAjE;AACA,OAAOC,QAAP,MA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ANX,KAQI;AAAS,IAAA,SAAS,EAAC;AAAnB,KACI,oBAAC,SAAD;AAAW,IAAA,QAAQ,EAAEmC;AAArB,KACK;AAAA,QAAC;AAAErC,MAAAA,MAAF;AAAUD,MAAAA;AAAV,KAAD;AAAA,WACG,oBAAC,oBAAD;AACI,MAAA,GAAG,EAAEE,SADT;AAEI,MAAA,QAAQ,EAAE,mBAGL;AAAA,YAFD;AAAE6B,UAAAA,YAAF;AAAgBC,UAAAA,SAAhB;AAA2BW,UAAAA;AAA3B,SAEC;AAAA,YADD;AAAEZ,UAAAA,YAAY,EAAEE,gBAAhB;AAAkCD,UAAAA,SAAS,EAAEE;AAA7C,SACC;AACDJ,QAAAA,cAAc,CAACC,YAAD,EAAeC,SAAf,EAA0BC,gBAA1B,EAA4CC,aAA5C,CAAd;;AACA,YAAI7C,OAAO,CAACe,OAAR,IAAmBf,OAAO,CAACe,OAAR,CAAgBwC,IAAvC,EAA6C;AACzC,gBAAM;AAAEA,YAAAA;AAAF,cAAWvD,OAAO,CAACe,OAAzB;AACAwC,UAAAA,IAAI,CAACC,iBAAL,CAAuB;AAAEb,YAAAA,SAAF;AAAaW,YAAAA;AAAb,WAAvB;AACH;AACJ,OAXL;AAYI,MAAA,eAAe,MAZnB;AAaI,MAAA,KAAK,EAAE;AAAE3C,QAAAA,KAAF;AAASC,QAAAA;AAAT,OAbX;AAcI,MAAA,YAAY,EAAEzC;AAdlB,OAgBKM,QAAQ,YAAYgF,KAApB,GACG,oBAAC,UAAD,QACI,oBAAC,gBAAD,EAAsBpG,YAAY,CAACqG,kBAAnC,CADJ,CADH,GAKGP,cAAc,CAACxC,KAAD,EAAQC,MAAR,CArBtB,CADH;AAAA,GADL,CADJ,CARJ,CADJ;AAyCH;;AAED,eAAepE,UAAU,CAAC6B,kBAAD,CAAzB","sourcesContent":["// @flow\nimport * as React from 'react';\nimport { FormattedMessage, injectIntl } from 'react-intl';\nimport type { IntlShape } from 'react-intl';\nimport classNames from 'classnames';\nimport { AutoSizer, CellMeasurer, CellMeasurerCache, List } from '@box/react-virtualized';\nimport debounce from 'lodash/debounce';\nimport AnimateHeight from 'react-animate-height';\nimport Scrollbar from 'react-scrollbars-custom';\nimport type { Token } from '../../../../common/types/core';\nimport Modal from '../../../../components/modal/Modal';\nimport CategorySelector from '../../../../components/category-selector/CategorySelector';\n\nimport CollapsibleScrollbar from '../collapsibile-scrollbar/CollapsibleScrollbar';\nimport Message from '../message/Message';\nimport intlMessages from '../../messages';\nimport type { EligibleMessageCenterMessage } from '../../types';\nimport type { ContentPreviewProps } from '../../../message-preview-content/MessagePreviewContent';\nimport './MessageCenterModal.scss';\nimport MessagePreviewGhost from '../../../message-preview-ghost/MessagePreviewGhost';\nimport ContentGhost from '../templates/common/ContentGhost';\nimport BottomContentWrapper from '../templates/common/BottomContentWrapper';\nimport ErrorState from '../error-state/ErrorState';\nimport EmptyState from './EmptyState';\n\ntype Props = {|\n apiHost: string,\n contentPreviewProps?: ContentPreviewProps,\n getToken: (fileId: string) => Promise<Token>,\n intl: IntlShape,\n messages: Array<EligibleMessageCenterMessage> | null | Error,\n onMessageShown: EligibleMessageCenterMessage => void,\n onRequestClose: () => void,\n overscanRowCount?: number,\n|};\n\nconst ALL = 'all';\nconst cache = new CellMeasurerCache({\n defaultHeight: 400,\n fixedWidth: true,\n});\n\nconst SCROLLBAR_MARGIN = 16;\nconst listStyle = { overflowX: false, overflowY: false };\nconst trackYStyles = { marginLeft: `${SCROLLBAR_MARGIN}px` };\n\nfunction MessageCenterModal({\n apiHost,\n contentPreviewProps,\n onRequestClose,\n messages,\n getToken,\n intl,\n overscanRowCount = 1,\n onMessageShown,\n}: Props) {\n const categories: Array<{ displayText: string, value: string }> | null = React.useMemo(() => {\n if (!Array.isArray(messages)) {\n return null;\n }\n\n const messageCategoriesSet = new Set<string>();\n messages.forEach(({ templateParams: { category } }) => {\n messageCategoriesSet.add(category);\n });\n\n if (messageCategoriesSet.size <= 1) {\n return null;\n }\n\n return [\n {\n value: ALL,\n displayText: intl.formatMessage(intlMessages.all),\n },\n {\n value: 'product',\n displayText: intl.formatMessage(intlMessages.product),\n },\n {\n value: 'events',\n displayText: intl.formatMessage(intlMessages.events),\n },\n {\n value: 'education',\n displayText: intl.formatMessage(intlMessages.boxEducation),\n },\n ];\n }, [intl, messages]);\n const listRef = React.useRef(null);\n const isMouseInTitleRef = React.useRef(false);\n const messageLoadCacheRef = React.useRef(new Map<number, boolean>());\n const [category, setCategory] = React.useState(ALL);\n const [isExpanded, setIsExpanded] = React.useState(true);\n const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });\n const scrollRef = React.useRef<{ scrollbarRef: React.ElementRef<typeof Scrollbar> } | null>(null);\n\n const title = (\n <section\n className={classNames('bdl-MessageCenterModal-title', {\n 'is-expanded': isExpanded,\n 'is-collapsed': !isExpanded,\n })}\n data-testid=\"modal-title\"\n onMouseEnter={() => {\n isMouseInTitleRef.current = true;\n setIsExpanded(true);\n }}\n onMouseLeave={() => {\n isMouseInTitleRef.current = false;\n }}\n >\n <div className=\"bdl-MessageCenterModal-whatsNew\">\n <FormattedMessage {...intlMessages.title} />\n </div>\n {categories && (\n <AnimateHeight duration={300} height={isExpanded ? 'auto' : 0}>\n <section className=\"bdl-MessageCenterModal-categorySelector\">\n <CategorySelector\n currentCategory={category}\n categories={categories}\n onSelect={value => {\n cache.clearAll();\n setCategory(value);\n }}\n />\n </section>\n </AnimateHeight>\n )}\n </section>\n );\n\n const filteredMessages = React.useMemo(() => {\n if (!Array.isArray(messages)) {\n return [];\n }\n\n return messages\n .filter(({ templateParams }) => {\n return category === ALL || templateParams.category === category;\n })\n .sort(\n (\n { activateDate: activateDateA, priority: priorityA },\n { activateDate: activateDateB, priority: priorityB },\n ) => {\n // sort by date (descending), secondary sort by priority (descending)\n if (activateDateA > activateDateB) {\n return -1;\n }\n\n if (activateDateA < activateDateB) {\n return 1;\n }\n\n if (priorityA > priorityB) {\n return -1;\n }\n\n if (priorityA < priorityB) {\n return 1;\n }\n\n return 0;\n },\n );\n }, [category, messages]);\n\n React.useEffect(() => {\n if (scrollRef.current && scrollRef.current.scrollbarRef && scrollRef.current.scrollbarRef.current) {\n scrollRef.current.scrollbarRef.current.scrollToTop();\n }\n }, [category]);\n\n function rowRenderer({ index, parent, style, isVisible }: Object) {\n const message = filteredMessages[index];\n const messageId = message.id;\n const isFirstTimeBeingShown = !messageLoadCacheRef.current.has(messageId);\n if (isVisible && isFirstTimeBeingShown) {\n messageLoadCacheRef.current.set(messageId, true);\n onMessageShown(message);\n }\n\n return (\n <CellMeasurer key={messageId} cache={cache} columnIndex={0} parent={parent} rowIndex={index}>\n {({ registerChild }) => (\n <div\n ref={registerChild}\n className=\"bdl-MessageCenterModal-message\"\n style={style}\n data-testid=\"messagecentermodalmessage\"\n >\n <Message\n contentPreviewProps={contentPreviewProps}\n apiHost={apiHost}\n {...message}\n getToken={getToken}\n />\n </div>\n )}\n </CellMeasurer>\n );\n }\n\n function handleOnScroll(clientHeight, scrollTop, prevClientHeight, prevScrollTop) {\n if (clientHeight > 0 && clientHeight === prevClientHeight && !isMouseInTitleRef.current) {\n const isScrollingDown = prevScrollTop < scrollTop;\n if (isExpanded && isScrollingDown) {\n setIsExpanded(false);\n } else if (!isExpanded && !isScrollingDown) {\n setIsExpanded(true);\n }\n }\n }\n\n function handleResize(resizeDimensions) {\n setDimensions(resizeDimensions);\n }\n\n const handlOnResize = React.useCallback(debounce(handleResize, 300), []);\n\n function renderMessages(width: number, height: number): React.Node {\n if (!messages) {\n return (\n <div className=\"bdl-MessageCenterModal-message\">\n <div className=\"bdl-MessageCenterModal-ghost\">\n <MessagePreviewGhost />\n <BottomContentWrapper>\n <ContentGhost />\n </BottomContentWrapper>\n </div>\n </div>\n );\n }\n\n return (\n <List\n ref={listRef}\n className=\"bdl-MessageCenterModal-list\"\n deferredMeasurementCache={cache}\n height={dimensions.height || height}\n noRowsRenderer={EmptyState}\n overscanRowCount={overscanRowCount}\n rowCount={filteredMessages.length}\n rowHeight={cache.rowHeight}\n rowRenderer={rowRenderer}\n scrollToIndex={0}\n style={listStyle}\n width={width - SCROLLBAR_MARGIN}\n />\n );\n }\n\n return (\n <Modal\n className=\"bdl-MessageCenterModal\"\n data-resin-component=\"messageCenterModal\"\n data-testid=\"messagecentermodal\"\n isOpen\n onRequestClose={onRequestClose}\n title={title}\n >\n <section className=\"bdl-MessageCenterModal-messages\">\n <AutoSizer onResize={handlOnResize}>\n {({ height, width }) => (\n <CollapsibleScrollbar\n ref={scrollRef}\n onScroll={(\n { clientHeight, scrollTop, scrollLeft },\n { clientHeight: prevClientHeight, scrollTop: prevScrollTop },\n ) => {\n handleOnScroll(clientHeight, scrollTop, prevClientHeight, prevScrollTop);\n if (listRef.current && listRef.current.Grid) {\n const { Grid } = listRef.current;\n Grid.handleScrollEvent({ scrollTop, scrollLeft });\n }\n }}\n permanentTrackY\n style={{ width, height }}\n trackYStyles={trackYStyles}\n >\n {messages instanceof Error ? (\n <ErrorState>\n <FormattedMessage {...intlMessages.errorFetchingPosts} />\n </ErrorState>\n ) : (\n renderMessages(width, height)\n )}\n </CollapsibleScrollbar>\n )}\n </AutoSizer>\n </section>\n </Modal>\n );\n}\n\nexport default injectIntl(MessageCenterModal);\n"],"file":"MessageCenterModal.js"}
|
|
@@ -6,7 +6,9 @@ import { FormattedMessage, injectIntl } from 'react-intl'; // @ts-ignore flow im
|
|
|
6
6
|
import messages from './messages'; // @ts-ignore flow import
|
|
7
7
|
|
|
8
8
|
import { determineInteractionMessage } from './utils/presenceUtils';
|
|
9
|
-
import './PresenceAvatarTooltipContent.scss';
|
|
9
|
+
import './PresenceAvatarTooltipContent.scss'; // @ts-ignore flow import
|
|
10
|
+
|
|
11
|
+
import timeFromNow from '../../utils/relativeTime';
|
|
10
12
|
|
|
11
13
|
function PresenceAvatarTooltipContent(_ref) {
|
|
12
14
|
let {
|
|
@@ -17,15 +19,11 @@ function PresenceAvatarTooltipContent(_ref) {
|
|
|
17
19
|
isActive
|
|
18
20
|
} = _ref;
|
|
19
21
|
const lastActionMessage = determineInteractionMessage(interactionType);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// @ts-ignore: react-intl v2 backwards compatibility
|
|
26
|
-
timeAgo = intl.formatRelative(interactedAt);
|
|
27
|
-
}
|
|
28
|
-
|
|
22
|
+
const {
|
|
23
|
+
value,
|
|
24
|
+
unit
|
|
25
|
+
} = timeFromNow(interactedAt);
|
|
26
|
+
const timeAgo = intl.formatRelativeTime(value, unit);
|
|
29
27
|
return React.createElement("div", {
|
|
30
28
|
className: "bdl-PresenceAvatarTooltipContent"
|
|
31
29
|
}, React.createElement("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/presence/PresenceAvatarTooltipContent.tsx"],"names":["React","FormattedMessage","injectIntl","messages","determineInteractionMessage","PresenceAvatarTooltipContent","name","interactedAt","interactionType","intl","isActive","lastActionMessage","
|
|
1
|
+
{"version":3,"sources":["../../../src/features/presence/PresenceAvatarTooltipContent.tsx"],"names":["React","FormattedMessage","injectIntl","messages","determineInteractionMessage","timeFromNow","PresenceAvatarTooltipContent","name","interactedAt","interactionType","intl","isActive","lastActionMessage","value","unit","timeAgo","formatRelativeTime","activeNowText","PresenceAvatarTooltipContentComponent"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAAoE,YAApE,C,CACA;;AACA,OAAOC,QAAP,MAAqB,YAArB,C,CACA;;AACA,SAASC,2BAAT,QAA4C,uBAA5C;AACA,OAAO,qCAAP,C,CACA;;AACA,OAAOC,WAAP,MAAwB,0BAAxB;;AASA,SAASC,4BAAT,OAAmH;AAAA,MAA7E;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,YAAR;AAAsBC,IAAAA,eAAtB;AAAuCC,IAAAA,IAAvC;AAA6CC,IAAAA;AAA7C,GAA6E;AAC/G,QAAMC,iBAAiB,GAAGR,2BAA2B,CAACK,eAAD,CAArD;AACA,QAAM;AAAEI,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBT,WAAW,CAACG,YAAD,CAAnC;AACA,QAAMO,OAAO,GAAGL,IAAI,CAACM,kBAAL,CAAwBH,KAAxB,EAA+BC,IAA/B,CAAhB;AAEA,SACI;AAAK,IAAA,SAAS,EAAC;AAAf,KACI;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAyDP,IAAzD,CADJ,EAEKK,iBAAiB,IACd;AAAM,IAAA,SAAS,EAAC;AAAhB,KACKD,QAAQ,GACL,oBAAC,gBAAD,EAAsBR,QAAQ,CAACc,aAA/B,CADK,GAGL,oBAAC,gBAAD,eACQL,iBADR;AAEI,IAAA,MAAM,EAAE;AACJG,MAAAA;AADI;AAFZ,KAJR,CAHR,CADJ;AAmBH;;AAED,SAAST,4BAA4B,IAAIY,qCAAzC;AAEA,eAAehB,UAAU,CAACI,4BAAD,CAAzB","sourcesContent":["import React from 'react';\nimport { FormattedMessage, injectIntl, WrappedComponentProps } from 'react-intl';\n// @ts-ignore flow import\nimport messages from './messages';\n// @ts-ignore flow import\nimport { determineInteractionMessage } from './utils/presenceUtils';\nimport './PresenceAvatarTooltipContent.scss';\n// @ts-ignore flow import\nimport timeFromNow from '../../utils/relativeTime';\n\nexport type Props = {\n name: string;\n interactedAt: number;\n interactionType: string;\n isActive?: boolean;\n} & WrappedComponentProps;\n\nfunction PresenceAvatarTooltipContent({ name, interactedAt, interactionType, intl, isActive }: Props): JSX.Element {\n const lastActionMessage = determineInteractionMessage(interactionType);\n const { value, unit } = timeFromNow(interactedAt);\n const timeAgo = intl.formatRelativeTime(value, unit as Intl.RelativeTimeFormatUnit);\n\n return (\n <div className=\"bdl-PresenceAvatarTooltipContent\">\n <span className=\"bdl-PresenceAvatarTooltipContent-name\">{name}</span>\n {lastActionMessage && (\n <span className=\"bdl-PresenceAvatarTooltipContent-event\">\n {isActive ? (\n <FormattedMessage {...messages.activeNowText} />\n ) : (\n <FormattedMessage\n {...lastActionMessage}\n values={{\n timeAgo,\n }}\n />\n )}\n </span>\n )}\n </div>\n );\n}\n\nexport { PresenceAvatarTooltipContent as PresenceAvatarTooltipContentComponent };\n\nexport default injectIntl(PresenceAvatarTooltipContent);\n"],"file":"PresenceAvatarTooltipContent.js"}
|
|
@@ -13,10 +13,15 @@ import Link from '../../components/link/LinkBase';
|
|
|
13
13
|
import messages from './messages';
|
|
14
14
|
import PresenceAvatar from './PresenceAvatar';
|
|
15
15
|
import { determineInteractionMessage } from './utils/presenceUtils';
|
|
16
|
+
import timeFromNow from '../../utils/relativeTime';
|
|
16
17
|
import './PresenceCollaborator.scss';
|
|
17
18
|
export const renderTimestampMessage = (interactedAt, interactionType, intl) => {
|
|
18
19
|
const lastActionMessage = determineInteractionMessage(interactionType, interactedAt);
|
|
19
|
-
const
|
|
20
|
+
const {
|
|
21
|
+
value,
|
|
22
|
+
unit
|
|
23
|
+
} = timeFromNow(interactedAt);
|
|
24
|
+
const timeAgo = intl.formatRelativeTime(value, unit);
|
|
20
25
|
|
|
21
26
|
if (lastActionMessage) {
|
|
22
27
|
return React.createElement(FormattedMessage, _extends({}, lastActionMessage, {
|
|
@@ -8,14 +8,14 @@ import Link from '../../components/link/LinkBase';
|
|
|
8
8
|
import messages from './messages';
|
|
9
9
|
import PresenceAvatar from './PresenceAvatar';
|
|
10
10
|
import { determineInteractionMessage } from './utils/presenceUtils';
|
|
11
|
+
import timeFromNow from '../../utils/relativeTime';
|
|
11
12
|
|
|
12
13
|
import './PresenceCollaborator.scss';
|
|
13
14
|
|
|
14
15
|
export const renderTimestampMessage = (interactedAt, interactionType, intl) => {
|
|
15
16
|
const lastActionMessage = determineInteractionMessage(interactionType, interactedAt);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
: intl.formatRelative(interactedAt);
|
|
17
|
+
const { value, unit } = timeFromNow(interactedAt);
|
|
18
|
+
const timeAgo = intl.formatRelativeTime(value, unit);
|
|
19
19
|
|
|
20
20
|
if (lastActionMessage) {
|
|
21
21
|
return (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/presence/PresenceCollaborator.js"],"names":["React","isEmpty","PropTypes","FormattedMessage","injectIntl","Avatar","Link","messages","PresenceAvatar","determineInteractionMessage","renderTimestampMessage","interactedAt","interactionType","intl","lastActionMessage","
|
|
1
|
+
{"version":3,"sources":["../../../src/features/presence/PresenceCollaborator.js"],"names":["React","isEmpty","PropTypes","FormattedMessage","injectIntl","Avatar","Link","messages","PresenceAvatar","determineInteractionMessage","timeFromNow","renderTimestampMessage","interactedAt","interactionType","intl","lastActionMessage","value","unit","timeAgo","formatRelativeTime","PresenceCollaborator","collaborator","isAnonymous","props","avatarUrl","id","isActive","name","profileUrl","activeNowText","propTypes","shape","string","oneOfType","number","bool","isRequired","any","PresenceCollaboratorComponent"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,YAA7C;AAEA,OAAOC,MAAP,MAAmB,yBAAnB;AACA,OAAOC,IAAP,MAAiB,gCAAjB;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,2BAAT,QAA4C,uBAA5C;AACA,OAAOC,WAAP,MAAwB,0BAAxB;AAEA,OAAO,6BAAP;AAEA,OAAO,MAAMC,sBAAsB,GAAG,CAACC,YAAD,EAAeC,eAAf,EAAgCC,IAAhC,KAAyC;AAC3E,QAAMC,iBAAiB,GAAGN,2BAA2B,CAACI,eAAD,EAAkBD,YAAlB,CAArD;AACA,QAAM;AAAEI,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBP,WAAW,CAACE,YAAD,CAAnC;AACA,QAAMM,OAAO,GAAGJ,IAAI,CAACK,kBAAL,CAAwBH,KAAxB,EAA+BC,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,CAVJ,CANJ,CADJ;AA2BH,CA9BD;;AAgCAM,oBAAoB,CAACU,SAArB,GAAiC;AAC7BT,EAAAA,YAAY,EAAEnB,SAAS,CAAC6B,KAAV,CAAgB;AAC1B;AACAP,IAAAA,SAAS,EAAEtB,SAAS,CAAC8B,MAFK;;AAG1B;AACAP,IAAAA,EAAE,EAAEvB,SAAS,CAAC+B,SAAV,CAAoB,CAAC/B,SAAS,CAAC8B,MAAX,EAAmB9B,SAAS,CAACgC,MAA7B,CAApB,CAJsB;AAK1BR,IAAAA,QAAQ,EAAExB,SAAS,CAACiC,IALM;;AAM1B;AACAvB,IAAAA,YAAY,EAAEV,SAAS,CAACgC,MAPE;;AAQ1B;AACArB,IAAAA,eAAe,EAAEX,SAAS,CAAC8B,MATD;;AAU1B;AACAL,IAAAA,IAAI,EAAEzB,SAAS,CAAC8B,MAAV,CAAiBI,UAXG;;AAY1B;AACAR,IAAAA,UAAU,EAAE1B,SAAS,CAAC8B;AAbI,GAAhB,EAcXI,UAf0B;AAgB7Bd,EAAAA,WAAW,EAAEpB,SAAS,CAACiC,IAhBM;;AAiB7B;AACArB,EAAAA,IAAI,EAAEZ,SAAS,CAACmC;AAlBa,CAAjC;AAqBA,SAASjB,oBAAoB,IAAIkB,6BAAjC;AACA,eAAelC,UAAU,CAACgB,oBAAD,CAAzB","sourcesContent":["import * as React from 'react';\nimport isEmpty from 'lodash/isEmpty';\nimport PropTypes from 'prop-types';\nimport { FormattedMessage, injectIntl } from 'react-intl';\n\nimport Avatar from '../../components/avatar';\nimport Link from '../../components/link/LinkBase';\nimport messages from './messages';\nimport PresenceAvatar from './PresenceAvatar';\nimport { determineInteractionMessage } from './utils/presenceUtils';\nimport timeFromNow from '../../utils/relativeTime';\n\nimport './PresenceCollaborator.scss';\n\nexport const renderTimestampMessage = (interactedAt, interactionType, intl) => {\n const lastActionMessage = determineInteractionMessage(interactionType, interactedAt);\n const { value, unit } = timeFromNow(interactedAt);\n const timeAgo = intl.formatRelativeTime(value, unit);\n\n if (lastActionMessage) {\n return (\n <FormattedMessage\n {...lastActionMessage}\n values={{\n timeAgo,\n }}\n />\n );\n }\n return null;\n};\n\nconst PresenceCollaborator = ({ collaborator, isAnonymous = false, intl, ...props }) => {\n const { avatarUrl, id, interactedAt, interactionType, isActive, name, profileUrl } = collaborator;\n\n return (\n <div className=\"bdl-PresenceCollaborator\" {...props}>\n {isAnonymous ? (\n <Avatar />\n ) : (\n <PresenceAvatar avatarUrl={avatarUrl} id={id} isActive={isActive} isDropDownAvatar name={name} />\n )}\n <div className=\"bdl-PresenceCollaborator-info-container\">\n <div className=\"bdl-PresenceCollaborator-info-name\" title={name}>\n {isEmpty(profileUrl) ? (\n <span>{name}</span>\n ) : (\n <Link href={profileUrl} target=\"_blank\">\n {name}\n </Link>\n )}\n </div>\n <div className=\"bdl-PresenceCollaborator-info-time\">\n {isActive ? (\n <FormattedMessage {...messages.activeNowText} />\n ) : (\n renderTimestampMessage(interactedAt, interactionType, intl)\n )}\n </div>\n </div>\n </div>\n );\n};\n\nPresenceCollaborator.propTypes = {\n collaborator: PropTypes.shape({\n /** Url to avatar image. If passed in, component will render the avatar image instead of the initials */\n avatarUrl: PropTypes.string,\n /** Users id */\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n isActive: PropTypes.bool,\n /** Unix timestamp of when the user last interacted with the document */\n interactedAt: PropTypes.number,\n /** The type of interaction by the user */\n interactionType: PropTypes.string,\n /** User's full name */\n name: PropTypes.string.isRequired,\n /** Custom Profile URL */\n profileUrl: PropTypes.string,\n }).isRequired,\n isAnonymous: PropTypes.bool,\n /* Intl object */\n intl: PropTypes.any,\n};\n\nexport { PresenceCollaborator as PresenceCollaboratorComponent };\nexport default injectIntl(PresenceCollaborator);\n"],"file":"PresenceCollaborator.js"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IntlShape } from 'react-intl';
|
|
5
5
|
|
|
6
6
|
import TextInputWithCopyButton from '../../components/text-input-with-copy-button';
|
|
7
7
|
import Tooltip from '../../components/tooltip';
|
|
@@ -27,6 +27,7 @@ type Props = {
|
|
|
27
27
|
copyButtonProps?: Object,
|
|
28
28
|
enterpriseName?: string,
|
|
29
29
|
expiration?: number,
|
|
30
|
+
intl: IntlShape,
|
|
30
31
|
isDownloadAllowed?: boolean,
|
|
31
32
|
isEditAllowed?: boolean,
|
|
32
33
|
isPreviewAllowed?: boolean,
|
|
@@ -39,7 +40,7 @@ type Props = {
|
|
|
39
40
|
settingsButtonProps?: Object,
|
|
40
41
|
sharedLink: string,
|
|
41
42
|
submitting?: boolean,
|
|
42
|
-
}
|
|
43
|
+
};
|
|
43
44
|
|
|
44
45
|
const SharedLink = (props: Props) => {
|
|
45
46
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/shared-link-modal/SharedLink.js"],"names":["React","FormattedMessage","injectIntl","TextInputWithCopyButton","Tooltip","PlainButton","convertToMs","IconExpirationInverted","IconSettingInverted","SharedLinkAccess","messages","accessLevelPropType","allowedAccessLevelsPropType","permissionLevelPropType","SharedLink","props","accessDropdownMenuProps","accessLevel","accessMenuButtonProps","allowedAccessLevels","canRemoveLink","changeAccessLevel","changePermissionLevel","copyButtonProps","enterpriseName","expiration","intl","isDownloadAllowed","isEditAllowed","isPreviewAllowed","itemType","onCopySuccess","onSettingsClick","permissionLevel","removeLink","removeLinkButtonProps","settingsButtonProps","sharedLink","submitting","sharedLinkExpirationTooltip","formatMessage","settingsButtonLabel","sharedLinkLabel","SharedLinkBase"],"mappings":";;AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,YAA7C;AAGA,OAAOC,uBAAP,MAAoC,8CAApC;AACA,OAAOC,OAAP,MAAoB,0BAApB;AACA,OAAOC,WAAP,MAAwB,+BAAxB;AACA,SAASC,WAAT,QAA4B,sBAA5B;AACA,OAAOC,sBAAP,MAAmC,4CAAnC;AACA,OAAOC,mBAAP,MAAgC,yCAAhC;AAEA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,mBAAT,EAA8BC,2BAA9B,EAA2DC,uBAA3D,QAA0F,aAA1F;AAEA,OAAO,mBAAP;;
|
|
1
|
+
{"version":3,"sources":["../../../src/features/shared-link-modal/SharedLink.js"],"names":["React","FormattedMessage","injectIntl","TextInputWithCopyButton","Tooltip","PlainButton","convertToMs","IconExpirationInverted","IconSettingInverted","SharedLinkAccess","messages","accessLevelPropType","allowedAccessLevelsPropType","permissionLevelPropType","SharedLink","props","accessDropdownMenuProps","accessLevel","accessMenuButtonProps","allowedAccessLevels","canRemoveLink","changeAccessLevel","changePermissionLevel","copyButtonProps","enterpriseName","expiration","intl","isDownloadAllowed","isEditAllowed","isPreviewAllowed","itemType","onCopySuccess","onSettingsClick","permissionLevel","removeLink","removeLinkButtonProps","settingsButtonProps","sharedLink","submitting","sharedLinkExpirationTooltip","formatMessage","settingsButtonLabel","sharedLinkLabel","SharedLinkBase"],"mappings":";;AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,gBAAT,EAA2BC,UAA3B,QAA6C,YAA7C;AAGA,OAAOC,uBAAP,MAAoC,8CAApC;AACA,OAAOC,OAAP,MAAoB,0BAApB;AACA,OAAOC,WAAP,MAAwB,+BAAxB;AACA,SAASC,WAAT,QAA4B,sBAA5B;AACA,OAAOC,sBAAP,MAAmC,4CAAnC;AACA,OAAOC,mBAAP,MAAgC,yCAAhC;AAEA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,mBAAT,EAA8BC,2BAA9B,EAA2DC,uBAA3D,QAA0F,aAA1F;AAEA,OAAO,mBAAP;;AA4BA,MAAMC,UAAU,GAAIC,KAAD,IAAkB;AAC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I,oBAAC,uBAAD;AACI,IAAA,WAAW,EAAET,eADjB;AAEI,IAAA,SAAS,EAAC,uBAFd;AAGI,IAAA,QAAQ,EAAEe,UAHd;AAII,IAAA,KAAK,EAAE,oBAAC,gBAAD,EAAsB5B,QAAQ,CAACgC,eAA/B,CAJX;AAKI,IAAA,aAAa,EAAEX,aALnB;AAMI,IAAA,IAAI,EAAC,KANT;AAOI,IAAA,KAAK,EAAEM;AAPX,IA/BJ,EAwCI,oBAAC,gBAAD;AACI,IAAA,uBAAuB,EAAErB,uBAD7B;AAEI,IAAA,WAAW,EAAEC,WAFjB;AAGI,IAAA,qBAAqB,EAAEC,qBAH3B;AAII,IAAA,mBAAmB,EAAEC,mBAJzB;AAKI,IAAA,aAAa,EAAEC,aALnB;AAMI,IAAA,iBAAiB,EAAEC,iBANvB;AAOI,IAAA,qBAAqB,EAAEC,qBAP3B;AAQI,IAAA,cAAc,EAAEE,cARpB;AASI,IAAA,iBAAiB,EAAEG,iBATvB;AAUI,IAAA,aAAa,EAAEC,aAVnB;AAWI,IAAA,gBAAgB,EAAEC,gBAXtB;AAYI,IAAA,QAAQ,EAAEC,QAZd;AAaI,IAAA,eAAe,EAAEG,eAbrB;AAcI,IAAA,UAAU,EAAEC,UAdhB;AAeI,IAAA,qBAAqB,EAAEC,qBAf3B;AAgBI,IAAA,UAAU,EAAEG;AAhBhB,IAxCJ,CADJ;AA6DH,CAxFD;;AA0FA,SAASxB,UAAU,IAAI6B,cAAvB;AACA,eAAezC,UAAU,CAACY,UAAD,CAAzB","sourcesContent":["/* @flow */\nimport React from 'react';\nimport { FormattedMessage, injectIntl } from 'react-intl';\nimport type { IntlShape } from 'react-intl';\n\nimport TextInputWithCopyButton from '../../components/text-input-with-copy-button';\nimport Tooltip from '../../components/tooltip';\nimport PlainButton from '../../components/plain-button';\nimport { convertToMs } from '../../utils/datetime';\nimport IconExpirationInverted from '../../icons/general/IconExpirationInverted';\nimport IconSettingInverted from '../../icons/general/IconSettingInverted';\n\nimport SharedLinkAccess from './SharedLinkAccess';\nimport messages from './messages';\nimport { accessLevelPropType, allowedAccessLevelsPropType, permissionLevelPropType } from './propTypes';\n\nimport './SharedLink.scss';\n\ntype Props = {\n accessDropdownMenuProps?: Object,\n accessLevel?: accessLevelPropType,\n accessMenuButtonProps?: Object,\n allowedAccessLevels?: allowedAccessLevelsPropType,\n canRemoveLink?: boolean,\n changeAccessLevel: Function,\n changePermissionLevel?: Function,\n copyButtonProps?: Object,\n enterpriseName?: string,\n expiration?: number,\n intl: IntlShape,\n isDownloadAllowed?: boolean,\n isEditAllowed?: boolean,\n isPreviewAllowed?: boolean,\n itemType: string,\n onCopySuccess?: Function,\n onSettingsClick?: Function,\n permissionLevel?: permissionLevelPropType,\n removeLink: Function,\n removeLinkButtonProps?: Object,\n settingsButtonProps?: Object,\n sharedLink: string,\n submitting?: boolean,\n};\n\nconst SharedLink = (props: Props) => {\n const {\n accessDropdownMenuProps,\n accessLevel,\n accessMenuButtonProps,\n allowedAccessLevels,\n canRemoveLink,\n changeAccessLevel,\n changePermissionLevel,\n copyButtonProps,\n enterpriseName,\n expiration,\n intl,\n isDownloadAllowed,\n isEditAllowed,\n isPreviewAllowed,\n itemType,\n onCopySuccess,\n onSettingsClick,\n permissionLevel,\n removeLink,\n removeLinkButtonProps,\n settingsButtonProps = {},\n sharedLink,\n submitting,\n } = props;\n\n return (\n <div className=\"shared-link\">\n <div className=\"shared-link-icons\">\n {expiration ? (\n <Tooltip\n position=\"middle-left\"\n text={\n <FormattedMessage\n {...messages.sharedLinkExpirationTooltip}\n values={{\n expiration: convertToMs(expiration),\n }}\n />\n }\n >\n <span className=\"shared-link-expiration\">\n <IconExpirationInverted height={16} width={16} />\n </span>\n </Tooltip>\n ) : null}\n {onSettingsClick && (\n <PlainButton\n {...settingsButtonProps}\n aria-label={intl.formatMessage(messages.settingsButtonLabel)}\n className=\"shared-link-settings-btn\"\n onClick={onSettingsClick}\n type=\"button\"\n >\n <IconSettingInverted />\n </PlainButton>\n )}\n </div>\n <TextInputWithCopyButton\n buttonProps={copyButtonProps}\n className=\"shared-link-container\"\n disabled={submitting}\n label={<FormattedMessage {...messages.sharedLinkLabel} />}\n onCopySuccess={onCopySuccess}\n type=\"url\"\n value={sharedLink}\n />\n <SharedLinkAccess\n accessDropdownMenuProps={accessDropdownMenuProps}\n accessLevel={accessLevel}\n accessMenuButtonProps={accessMenuButtonProps}\n allowedAccessLevels={allowedAccessLevels}\n canRemoveLink={canRemoveLink}\n changeAccessLevel={changeAccessLevel}\n changePermissionLevel={changePermissionLevel}\n enterpriseName={enterpriseName}\n isDownloadAllowed={isDownloadAllowed}\n isEditAllowed={isEditAllowed}\n isPreviewAllowed={isPreviewAllowed}\n itemType={itemType}\n permissionLevel={permissionLevel}\n removeLink={removeLink}\n removeLinkButtonProps={removeLinkButtonProps}\n submitting={submitting}\n />\n </div>\n );\n};\n\nexport { SharedLink as SharedLinkBase };\nexport default injectIntl(SharedLink);\n"],"file":"SharedLink.js"}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import noop from 'lodash/noop';
|
|
5
5
|
import getProp from 'lodash/get';
|
|
6
6
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
7
|
-
import type {
|
|
7
|
+
import type { IntlShape } from 'react-intl';
|
|
8
8
|
|
|
9
9
|
import Tooltip from '../../components/tooltip';
|
|
10
10
|
import PlainButton from '../../components/plain-button';
|
|
@@ -51,6 +51,7 @@ const restrictionNoticeMessageMap = {
|
|
|
51
51
|
type Props = {
|
|
52
52
|
collabRestrictionType?: CollabRestrictionType,
|
|
53
53
|
error?: React.Node,
|
|
54
|
+
intl: IntlShape,
|
|
54
55
|
isFetchingJustificationReasons?: boolean,
|
|
55
56
|
isRestrictionJustificationEnabled?: boolean,
|
|
56
57
|
justificationReasons: Array<SelectOptionProp>,
|
|
@@ -60,7 +61,7 @@ type Props = {
|
|
|
60
61
|
restrictedGroups: Array<number>,
|
|
61
62
|
selectedContacts: Array<Contact>,
|
|
62
63
|
selectedJustificationReason: ?SelectOptionProp,
|
|
63
|
-
}
|
|
64
|
+
};
|
|
64
65
|
|
|
65
66
|
const ContactRestrictionNotice = ({
|
|
66
67
|
collabRestrictionType = COLLAB_RESTRICTION_TYPE_ACCESS_POLICY,
|